!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).DOMPurify=t()}(this,function(){"use strict";var r,o=Object.hasOwnProperty,i=Object.setPrototypeOf,a=Object.isFrozen,l=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor,Re=Object.freeze,e=Object.seal,s=Object.create,t="undefined"!=typeof Reflect&&Reflect,u=(u=t.apply)||function(e,t,n){return e.apply(t,n)},Re=Re||function(e){return e},e=e||function(e){return e},m=(m=t.construct)||function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t/gm),tt=e(/^data-[\-\w.\u00B7-\uFFFF]/),nt=e(/^aria-[\-\w]+$/),rt=e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ot=e(/^(?:\w+script|data):/i),it=e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),at="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};function lt(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t/i,n))ke(a,e);else{q&&(n=Fe(n,_," "),n=Fe(n,N," "));var s=e.nodeName.toLowerCase();if(Ee(s,c,n))try{l?e.setAttributeNS(l,a,n):e.setAttribute(a,n),Ne(u.removed)}catch(e){}}}De("afterSanitizeAttributes",e,null)}}function Se(e){var t,n=Ae(e);for(De("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)De("uponSanitizeShadowNode",t,null),we(t)||(t.content instanceof s&&Se(t.content),xe(t));De("afterSanitizeShadowDOM",e,null)}var ke=function(e,t){try{Oe(u.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Oe(u.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!U[e])if(X||$)try{ve(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},De=function(e,t,n){D[e]&&_e(D[e],function(e){e.call(u,t,n,fe)})},Ee=function(e,t,n){if(Q&&("id"===t||"name"===t)&&(n in o||n in pe))return!1;if(!(W&&ze(O,t)||B&&ze(M,t))){if(!U[t]||P[t])return!1;if(!ae[t]&&!ze(I,Fe(n,F,""))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Ie(n,"data:")||!oe[e])&&(!G||ze(L,Fe(n,F,"")))&&n)return!1}return!0};return u.sanitize=function(e,t){var n,r=void 0,o=void 0,i=void 0;if("string"!=typeof(e=(R=!e)?"\x3c!--\x3e":e)&&!Te(e)){if("function"!=typeof e.toString)throw Ue("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ue("dirty is not a string, aborting")}if(!u.isSupported){if("object"===at(l.toStaticHTML)||"function"==typeof l.toStaticHTML){if("string"==typeof e)return l.toStaticHTML(e);if(Te(e))return l.toStaticHTML(e.outerHTML)}return e}if(V||E(t),u.removed=[],!(te="string"!=typeof e&&te))if(e instanceof m)1===(t=(r=be("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===t.nodeName||"HTML"===t.nodeName?r=t:r.appendChild(t);else{if(!X&&!q&&!K&&-1===e.indexOf("<"))return A&&J?A.createHTML(e):e;if(!(r=be(e)))return X?null:T}r&&Y&&ve(r.firstChild);for(var a=Ae(te?e:r);n=a.nextNode();)3===n.nodeType&&n===o||we(n)||(n.content instanceof s&&Se(n.content),xe(n),o=n);if(o=null,te)return e;if(X){if($)for(i=S.call(r.ownerDocument);r.firstChild;)i.appendChild(r.firstChild);else i=r;return i=Z?k.call(c,i,!0):i}return e=K?r.outerHTML:r.innerHTML,q&&(e=Fe(e,_," "),e=Fe(e,N," ")),A&&J?A.createHTML(e):e},u.setConfig=function(e){E(e),V=!0},u.clearConfig=function(){fe=null,V=!1},u.isValidAttribute=function(e,t,n){return fe||E({}),e=Me(e),t=Me(t),Ee(e,t,n)},u.addHook=function(e,t){"function"==typeof t&&(D[e]=D[e]||[],Oe(D[e],t))},u.removeHook=function(e){D[e]&&Ne(D[e])},u.removeHooks=function(e){D[e]&&(D[e]=[])},u.removeAllHooks=function(){D={}},u}()});