!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.ZSEC=t()}(this,function(){"use strict";function e(e,t,n,o,r,i,a){if(o||!(t in e))return Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),1}catch(e){}}()?(r=!0===r,i=!0===i,a=!0===a,Object.defineProperty(e,t,{value:n,writable:r,configurable:i,enumerable:a})):(e[t]=n,e)}function o(e,t){for(var n=0;nthis.LEVELS.INFO)){for(var t=arguments.length,n=Array(t),o=0;othis.LEVELS.WARN)){for(var t=arguments.length,n=Array(t),o=0;othis.LEVELS.ERROR)){for(var t=arguments.length,n=Array(t),o=0;o/gm),Ye=t(/^data-[\-\w.\u00B7-\uFFFF]/),Qe=t(/^aria-[\-\w]+$/),qe=t(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ze=t(/^(?:\w+script|data):/i),$e=t(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He={svg:A,svgFilters:E,svgDisallowed:S,mathMl:h,mathMlDisallowed:g};var t=function F(e){var l=0"+e:n=(o=Ce(e,/^[\r\n\t ]+/))&&o[0],A?A.createHTML(e):e);if(w===D)try{t=(new k).parseFromString(o,"text/html")}catch(e){}if(!t||!t.documentElement){t=i.createDocument(w,"template",null);try{t.documentElement.innerHTML=Z?"":o}catch(e){}}return o=t.body||t.documentElement,e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),w===D?Q.call(t,L?"html":"body")[0]:L?t.documentElement:o},ge=function(e){return K.call(e.ownerDocument||e,e,t.SHOW_ELEMENT|t.SHOW_COMMENT|t.SHOW_TEXT,null,!1)},C=function(e){return"object"===(void 0===f?"undefined":ke(f))?e instanceof f:e&&"object"===(void 0===e?"undefined":ke(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},M=function(e,t,n){a[e]&&Ve(a[e],function(e){e.call(u,t,n,b)})},ye=function(e){if(M("beforeSanitizeElements",e,null),((i=e)instanceof H||i instanceof V||"string"==typeof i.nodeName&&"string"==typeof i.textContent&&"function"==typeof i.removeChild&&i.attributes instanceof B&&"function"==typeof i.removeAttribute&&"function"==typeof i.setAttribute&&"string"==typeof i.namespaceURI&&"function"==typeof i.insertBefore)&&!Ce(e.nodeName,/[\u0080-\uFFFF]/)){var t,n,o,r,i=Pe(e.nodeName);if(M("uponSanitizeElement",e,{tagName:i,allowedTags:E}),C(e.firstElementChild)||C(e.content)&&C(e.content.firstElementChild)||!Fe(/<[/\w]/g,e.innerHTML)||!Fe(/<[/\w]/g,e.textContent)){if(!_[i]&&(E[i]||oe&&-1!==i.indexOf("-")))return e instanceof x&&((n=s(t=e))&&n.tagName||(n={namespaceURI:D,tagName:"template"}),o=Pe(t.tagName),r=Pe(n.tagName),t.namespaceURI===me?n.namespaceURI===D?"svg"!==o:n.namespaceURI===Ee?"svg"!==o||"annotation-xml"!==r&&!Re[r]:!Boolean(U[o]):t.namespaceURI===Ee?n.namespaceURI===D?"math"!==o:n.namespaceURI===me?"math"!==o||!Oe[r]:!Boolean(Le[o]):t.namespaceURI!==D||n.namespaceURI===me&&!Oe[r]||n.namespaceURI===Ee&&!Re[r]||(n=Ge({},["title","style","font","a","script"]),Le[o])||!n[o]&&U[o])||("noscript"===i||"noembed"===i)&&Fe(/<\/no(script|embed)/i,e.innerHTML)?(P(e),!0):(O&&3===e.nodeType&&(t=e.textContent,t=Me(t,d," "),t=Me(t,T," "),e.textContent!==t)&&(Ue(u.removed,{element:e.cloneNode()}),e.textContent=t),M("afterSanitizeElements",e,null),!1);if(fe&&!se[i]){var a=s(e)||e.parentNode,l=z(e)||e.childNodes;if(l&&a)for(var c=l.length-1;0<=c;--c)a.insertBefore(W(l[c],!0),j(e))}}}return P(e),!0},ve=function(e,t,n){if(ue&&("id"===t||"name"===t)&&(n in r||n in _e))return!1;if((!R||N[t]||!Fe($,t))&&(!ae||!Fe(J,t))){if(!m[t]||N[t])return!1;if(!Te[t]&&!Fe(p,Me(n,te,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==We(n,"data:")||!Ae[e])&&(!le||Fe(ee,Me(n,te,"")))&&n)return!1}return!0},Ie=function(e){var t=void 0,n=void 0,o=(M("beforeSanitizeAttributes",e,null),e.attributes);if(o){for(var r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:m,nodeName:e.nodeName.toLowerCase()},n=o.length;n--;){var i,a=(i=o[n]).name,l=i.namespaceURI,t=je(i.value);if(re&&(t=i.value),i=Pe(a),r.attrName=i,r.attrValue=t,r.keepAttr=!0,r.keepElement=!0,r.forceKeepAttr=void 0,M("uponSanitizeAttribute",e,r),!r.keepElement)return!0;if(t=r.attrValue,!r.forceKeepAttr&&(Se(a,e),r.keepAttr))if(Fe(/\/>/i,t))Se(a,e);else{O&&(t=Me(t,d," "),t=Me(t,T," "));var c=e.nodeName.toLowerCase();if(ve(c,i,t))try{l?e.setAttributeNS(l,a,t):e.setAttribute(a,t),be(u.removed)}catch(e){}}}M("afterSanitizeAttributes",e,null)}return!1},De=function e(t){var n,o=ge(t);for(M("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)M("uponSanitizeShadowNode",n,null),ye(n)||(n.content instanceof G&&e(n.content),Ie(n)&&P(n));M("afterSanitizeShadowDOM",t,null)};u.sanitize=function(e,t){var n,o=void 0,r=void 0,i=void 0;if("string"!=typeof(e=(Z=!e)?"\x3c!--\x3e":e)&&!C(e)){if("function"!=typeof e.toString)throw ze("toString is not a function");if("string"!=typeof(e=e.toString()))throw ze("dirty is not a string, aborting")}if(!u.isSupported){if("object"===ke(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(C(e))return l.toStaticHTML(e.outerHTML)}return e}if(S||Ne(t),u.removed=[],!(I="string"!=typeof e&&I))if(e instanceof f)1===(t=(o=he("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?o=t:o.appendChild(t);else{if(!g&&!O&&!L&&-1===e.indexOf("<"))return A&&v?A.createHTML(e):e;if(!(o=he(e)))return g?null:X}o&&h&&P(o.firstChild);for(var a=ge(I?e:o);n=a.nextNode();)3===n.nodeType&&n===r||ye(n)||(n.content instanceof G&&De(n.content),Ie(n)?P(n):r=n);if(r=null,I)return e;if(g){if(y)for(i=Y.call(o.ownerDocument);o.firstChild;)i.appendChild(o.firstChild);else i=o;return i=ce?q.call(c,i,!0):i}return t=L?o.outerHTML:o.innerHTML,O&&(t=Me(t,d," "),t=Me(t,T," ")),A&&v?A.createHTML(t):t},u.setConfig=function(e){Ne(e),S=!0},u.clearConfig=function(){b=null,S=!1},u.isValidAttribute=function(e,t,n){return b||Ne({}),e=Pe(e),t=Pe(t),ve(e,t,n)},u.addHook=function(e,t){"function"==typeof t&&(a[e]=a[e]||[],Ue(a[e],t))},u.removeHook=function(e){a[e]&&be(a[e])},u.removeHooks=function(e){a[e]&&(a[e]=[])},u.removeAllHooks=function(){a={}}}else u.isSupported=!1;return u}(),X=(Object.seal||function(e){return e})(/\$\{[A-Z._]+?\}/i);function j(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);tt.MAX_LENGTH)return!1;if(t.MIN_LENGTH&&e.length=t.LESSER_THAN)return!1;if(void 0!==t.LESSER_THAN_OR_EQUAL&&n>t.LESSER_THAN_OR_EQUAL)return!1;if(void 0!==t.EQUAL&&n!==t.EQUAL)return!1;if(void 0!==t.NOT_EQUAL&&n===t.NOT_EQUAL)return!1}return!0}function p(e,t,n){var o=!0;if(t&&t.CONDITIONS&&0!==t.CONDITIONS.length){n=t.ATTR_NAME||n;for(var r,i,a,l,c=0;c