!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.DOMPurify=t()}(this,function(){"use strict";function n(n,t){var r,i,u;for(d&&d(n,null),r=t.length;r--;)i=t[r],"string"==typeof i&&(u=i.toLowerCase(),u!==i&&(Object.isFrozen(t)||(t[r]=u),i=u)),n[i]=!0;return n}function c(n){var i={},t=void 0;for(t in n)s(tt,n,[t])&&(i[t]=n[t]);return i}function t(n){if(Array.isArray(n)){for(var t=0,i=Array(n.length);t<n.length;t++)i[t]=n[t];return i}return Array.from(n)}function l(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct(),i=function(n){return l(n)},ni;if(i.version="1.0.10",i.removed=[],!r||!r.document||9!==r.document.nodeType)return i.isSupported=!1,i;var ui=r.document,di=!1,gi=!1,at=r.document,nr=r.DocumentFragment,wr=r.HTMLTemplateElement,dt=r.Node,gt=r.NodeFilter,tr=r.NamedNodeMap,br=void 0===tr?r.NamedNodeMap||r.MozNamedAttrMap:tr,kr=r.Text,dr=r.Comment,gr=r.DOMParser,nu=r.TrustedTypes;"function"==typeof wr&&(ni=at.createElement("template"),ni.content&&ni.content.ownerDocument&&(at=ni.content.ownerDocument));var d=nt(nu,ui),ir=d?d.createHTML(""):"",ti=at,fi=ti.implementation,tu=ti.createNodeIterator,iu=ti.getElementsByTagName,ru=ti.createDocumentFragment,uu=ui.importNode,tt={};i.isSupported=fi&&void 0!==fi.createHTMLDocument&&9!==at.documentMode;var ei=it,oi=rt,fu=ut,eu=ft,ou=ot,rr=st,si=et,f=null,ur=n({},[].concat(t(a),t(v),t(y),t(p),t(w))),s=null,fr=n({},[].concat(t(b),t(o),t(k),t(e))),hi=null,ci=null,er=!0,li=!0,or=!1,sr=!1,vt=!1,wt=!1,ai=!1,vi=!1,bt=!1,yi=!1,hr=!1,cr=!0,pi=!0,ii=!1,yt={},su=n({},["audio","head","math","script","style","template","svg","video"]),hu=n({},["audio","video","img","source","image"]),wi=null,cu=n({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),pt=null,lu=at.createElement("form"),bi=function(i){pt&&pt===i||(i&&"object"===(void 0===i?"undefined":u(i))||(i={}),f="ALLOWED_TAGS"in i?n({},i.ALLOWED_TAGS):ur,s="ALLOWED_ATTR"in i?n({},i.ALLOWED_ATTR):fr,wi="ADD_URI_SAFE_ATTR"in i?n({},i.ADD_URI_SAFE_ATTR):cu,hi="FORBID_TAGS"in i?n({},i.FORBID_TAGS):{},ci="FORBID_ATTR"in i?n({},i.FORBID_ATTR):{},yt="USE_PROFILES"in i&&i.USE_PROFILES,er=!1!==i.ALLOW_ARIA_ATTR,li=!1!==i.ALLOW_DATA_ATTR,or=i.ALLOW_UNKNOWN_PROTOCOLS||!1,sr=i.SAFE_FOR_JQUERY||!1,vt=i.SAFE_FOR_TEMPLATES||!1,wt=i.WHOLE_DOCUMENT||!1,bt=i.RETURN_DOM||!1,yi=i.RETURN_DOM_FRAGMENT||!1,hr=i.RETURN_DOM_IMPORT||!1,vi=i.FORCE_BODY||!1,cr=!1!==i.SANITIZE_DOM,pi=!1!==i.KEEP_CONTENT,ii=i.IN_PLACE||!1,si=i.ALLOWED_URI_REGEXP||si,vt&&(li=!1),yi&&(bt=!0),yt&&(f=n({},[].concat(t(w))),s=[],!0===yt.html&&(n(f,a),n(s,b)),!0===yt.svg&&(n(f,v),n(s,o),n(s,e)),!0===yt.svgFilters&&(n(f,y),n(s,o),n(s,e)),!0===yt.mathMl&&(n(f,p),n(s,k),n(s,e))),i.ADD_TAGS&&(f===ur&&(f=c(f)),n(f,i.ADD_TAGS)),i.ADD_ATTR&&(s===fr&&(s=c(s)),n(s,i.ADD_ATTR)),i.ADD_URI_SAFE_ATTR&&n(wi,i.ADD_URI_SAFE_ATTR),pi&&(f["#text"]=!0),wt&&n(f,["html","head","body"]),f.table&&n(f,["tbody"]),g&&g(i),pt=i)},kt=function(n){i.removed.push({element:n});try{n.parentNode.removeChild(n)}catch(t){n.outerHTML=ir}},ki=function(n,t){try{i.removed.push({attribute:t.getAttributeNode(n),from:t})}catch(n){i.removed.push({attribute:null,from:t})}t.removeAttribute(n)},ri=function(t){var i=void 0,r=void 0,f,u;if(vi?t="<remove><\/remove>"+t:(f=t.match(/^[\s]+/),(r=f&&f[0])&&(t=t.slice(r.length))),di)try{i=(new gr).parseFromString(t,"text/html")}catch(n){}return(gi&&n(hi,["title"]),i&&i.documentElement)||(u=(i=fi.createHTMLDocument("")).body,u.parentNode.removeChild(u.parentNode.firstElementChild),u.outerHTML=d?d.createHTML(t):t),r&&i.body.insertBefore(at.createTextNode(r),i.body.childNodes[0]||null),iu.call(i,wt?"html":"body")[0]};i.isSupported&&(function(){try{ri('<svg><p><style><img src="<\/style><img src=x onerror=1//">').querySelector("svg img")&&(di=!0)}catch(n){}}(),function(){try{ri("<x/><title>&lt;/title&gt;&lt;img&gt;").querySelector("title").innerHTML.match(/<\/title/)&&(gi=!0)}catch(n){}}());var lr=function(n){return tu.call(n.ownerDocument||n,n,gt.SHOW_ELEMENT|gt.SHOW_COMMENT|gt.SHOW_TEXT,function(){return gt.FILTER_ACCEPT},!1)},au=function(n){return!(n instanceof kr||n instanceof dr)&&!("string"==typeof n.nodeName&&"string"==typeof n.textContent&&"function"==typeof n.removeChild&&n.attributes instanceof br&&"function"==typeof n.removeAttribute&&"function"==typeof n.setAttribute)},ar=function(n){return"object"===(void 0===dt?"undefined":u(dt))?n instanceof dt:n&&"object"===(void 0===n?"undefined":u(n))&&"number"==typeof n.nodeType&&"string"==typeof n.nodeName},lt=function(n,t,r){tt[n]&&tt[n].forEach(function(n){n.call(i,t,r,pt)})},vr=function(n){var r=void 0,t,u;if(lt("beforeSanitizeElements",n,null),au(n))return kt(n),!0;if(t=n.nodeName.toLowerCase(),lt("uponSanitizeElement",n,{tagName:t,allowedTags:f}),!f[t]||hi[t]){if(pi&&!su[t]&&"function"==typeof n.insertAdjacentHTML)try{u=n.innerHTML;n.insertAdjacentHTML("AfterEnd",d?d.createHTML(u):u)}catch(n){}return kt(n),!0}return"noscript"===t&&n.innerHTML.match(/<\/noscript/i)?(kt(n),!0):"noembed"===t&&n.innerHTML.match(/<\/noembed/i)?(kt(n),!0):(!sr||n.firstElementChild||n.content&&n.content.firstElementChild||!/</g.test(n.textContent)||(i.removed.push({element:n.cloneNode()}),n.innerHTML=n.innerHTML?n.innerHTML.replace(/</g,"&lt;"):n.textContent.replace(/</g,"&lt;")),vt&&3===n.nodeType&&(r=(r=(r=n.textContent).replace(ei," ")).replace(oi," "),n.textContent!==r&&(i.removed.push({element:n.cloneNode()}),n.textContent=r)),lt("afterSanitizeElements",n,null),!1)},yr=function(n,t,i){return cr&&("id"===t||"name"===t)&&(i in at||i in lu)?!1:(!li||!fu.test(t))&&(!er||!eu.test(t))&&(!s[t]||ci[t]||!wi[t]&&!si.test(i.replace(rr,""))&&("src"!==t&&"xlink:href"!==t||"script"===n||0!==i.indexOf("data:")||!hu[n])&&(!or||ou.test(i.replace(rr,"")))&&i)?!1:!0},pr=function(n){var l=void 0,t=void 0,u=void 0,c=void 0,o=void 0,r,f,y;if(lt("beforeSanitizeAttributes",n,null),r=n.attributes,r){for(f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:s},o=r.length;o--;){var a=l=r[o],e=a.name,v=a.namespaceURI;if(t=l.value.trim(),u=e.toLowerCase(),f.attrName=u,f.attrValue=t,f.keepAttr=!0,lt("uponSanitizeAttribute",n,f),t=f.attrValue,"name"===u&&"IMG"===n.nodeName&&r.id)c=r.id,r=h(ht,r,[]),ki("id",n),ki(e,n),r.indexOf(c)>o&&n.setAttribute("id",c.value);else{if("INPUT"===n.nodeName&&"type"===u&&"file"===t&&(s[u]||!ci[u]))continue;"id"===e&&n.setAttribute(e,"");ki(e,n)}if(f.keepAttr&&(vt&&(t=(t=t.replace(ei," ")).replace(oi," ")),y=n.nodeName.toLowerCase(),yr(y,u,t)))try{v?n.setAttributeNS(v,e,t):n.setAttribute(e,t);i.removed.pop()}catch(n){}}lt("afterSanitizeAttributes",n,null)}},vu=function n(t){var i=void 0,r=lr(t);for(lt("beforeSanitizeShadowDOM",t,null);i=r.nextNode();)lt("uponSanitizeShadowNode",i,null),vr(i)||(i.content instanceof nr&&n(i.content),pr(i));lt("afterSanitizeShadowDOM",t,null)};return i.sanitize=function(n,t){var f=void 0,o=void 0,e=void 0,c=void 0,s=void 0,l,h;if(n||(n="<!-->"),"string"!=typeof n&&!ar(n)){if("function"!=typeof n.toString)throw new TypeError("toString is not a function");if("string"!=typeof(n=n.toString()))throw new TypeError("dirty is not a string, aborting");}if(!i.isSupported){if("object"===u(r.toStaticHTML)||"function"==typeof r.toStaticHTML){if("string"==typeof n)return r.toStaticHTML(n);if(ar(n))return r.toStaticHTML(n.outerHTML)}return n}if(ai||bi(t),i.removed=[],!ii)if(n instanceof dt)1===(o=(f=ri("<!-->")).ownerDocument.importNode(n,!0)).nodeType&&"BODY"===o.nodeName?f=o:"HTML"===o.nodeName?f=o:f.appendChild(o);else{if(!bt&&!vt&&!wt&&-1===n.indexOf("<"))return d?d.createHTML(n):n;if(!(f=ri(n)))return bt?null:ir}for(f&&vi&&kt(f.firstChild),l=lr(ii?n:f);e=l.nextNode();)3===e.nodeType&&e===c||vr(e)||(e.content instanceof nr&&vu(e.content),pr(e),c=e);if(c=null,ii)return n;if(bt){if(yi)for(s=ru.call(f.ownerDocument);f.firstChild;)s.appendChild(f.firstChild);else s=f;return hr&&(s=uu.call(ui,s,!0)),s}return h=wt?f.outerHTML:f.innerHTML,vt&&(h=(h=h.replace(ei," ")).replace(oi," ")),d?d.createHTML(h):h},i.setConfig=function(n){bi(n);ai=!0},i.clearConfig=function(){pt=null;ai=!1},i.isValidAttribute=function(n,t,i){pt||bi({});var r=n.toLowerCase(),u=t.toLowerCase();return yr(r,u,i)},i.addHook=function(n,t){"function"==typeof t&&(tt[n]=tt[n]||[],tt[n].push(t))},i.removeHook=function(n){tt[n]&&tt[n].pop()},i.removeHooks=function(n){tt[n]&&(tt[n]=[])},i.removeAllHooks=function(){tt={}},i}var r=Object.freeze||function(n){return n},a=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),v=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","audio","canvas","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","video","view","vkern"]),y=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),p=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),w=r(["#text"]),f=Object.freeze||function(n){return n},b=f(["accept","action","align","alt","autocomplete","background","bgcolor","border","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","coords","crossorigin","datetime","default","dir","disabled","download","enctype","face","for","headers","height","hidden","high","href","hreflang","id","integrity","ismap","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","type","usemap","valign","value","width","xmlns"]),o=f(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),k=f(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),e=f(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tt=Object.hasOwnProperty,d=Object.setPrototypeOf,s=("undefined"!=typeof Reflect&&Reflect).apply,nt;s||(s=function(n,t,i){return n.apply(t,i)});var i=Object.seal||function(n){return n},it=i(/\{\{[\s\S]*|[\s\S]*\}\}/gm),rt=i(/<%[\s\S]*|[\s\S]*%>/gm),ut=i(/^data-[\-\w.\u00B7-\uFFFF]/),ft=i(/^aria-[\-\w]+$/),et=i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ot=i(/^(?:\w+script|data):/i),st=i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},h=("undefined"!=typeof Reflect&&Reflect).apply,ht=Array.prototype.slice,g=Object.freeze,ct=function(){return"undefined"==typeof window?null:window};return h||(h=function(n,t,i){return n.apply(t,i)}),nt=function(n,t){var i,r;if("object"!==(void 0===n?"undefined":u(n))||"function"!=typeof n.createPolicy)return null;i=null;t.currentScript&&t.currentScript.hasAttribute("data-tt-policy-suffix")&&(i=t.currentScript.getAttribute("data-tt-policy-suffix"));r="dompurify"+(i?"#"+i:"");try{return n.createPolicy(r,{createHTML:function(n){return n}})}catch(n){return console.warn("TrustedTypes policy "+r+" could not be created."),null}},l()})