12 |
- /*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */const{entries:Tt,setPrototypeOf:st,isFrozen:Bt,getPrototypeOf:Yt,getOwnPropertyDescriptor:Xt}=Object;let{freeze:S,seal:y,create:Et}=Object,{apply:xe,construct:Pe}=typeof Reflect<"u"&&Reflect;S||(S=function(o){return o});y||(y=function(o){return o});xe||(xe=function(o,l){for(var a=arguments.length,c=new Array(a>2?a-2:0),O=2;O<a;O++)c[O-2]=arguments[O];return o.apply(l,c)});Pe||(Pe=function(o){for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return new o(...a)});const le=R(Array.prototype.forEach),jt=R(Array.prototype.lastIndexOf),lt=R(Array.prototype.pop),$=R(Array.prototype.push),Vt=R(Array.prototype.splice),fe=R(String.prototype.toLowerCase),be=R(String.prototype.toString),Ne=R(String.prototype.match),q=R(String.prototype.replace),$t=R(String.prototype.indexOf),qt=R(String.prototype.trim),D=R(Object.prototype.hasOwnProperty),A=R(RegExp.prototype.test),K=Kt(TypeError);function R(s){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return xe(s,o,a)}}function Kt(s){return function(){for(var o=arguments.length,l=new Array(o),a=0;a<o;a++)l[a]=arguments[a];return Pe(s,l)}}function r(s,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fe;st&&st(s,null);let a=o.length;for(;a--;){let c=o[a];if(typeof c=="string"){const O=l(c);O!==c&&(Bt(o)||(o[a]=O),c=O)}s[c]=!0}return s}function Zt(s){for(let o=0;o<s.length;o++)D(s,o)||(s[o]=null);return s}function C(s){const o=Et(null);for(const[l,a]of Tt(s))D(s,l)&&(Array.isArray(a)?o[l]=Zt(a):a&&typeof a=="object"&&a.constructor===Object?o[l]=C(a):o[l]=a);return o}function Z(s,o){for(;s!==null;){const a=Xt(s,o);if(a){if(a.get)return R(a.get);if(typeof a.value=="function")return R(a.value)}s=Yt(s)}function l(){return null}return l}const ct=S(["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","dialog","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","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","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"]),Ie=S(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Me=S(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Jt=S(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ce=S(["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","mprescripts"]),Qt=S(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ft=S(["#text"]),ut=S(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),we=S(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","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","exponent","fill","fill-opacity","fill-rule","filter","filterunits","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","intercept","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","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","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"]),mt=S(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","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"]),ce=S(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),en=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),tn=y(/<%[\w\W]*|[\w\W]*%>/gm),nn=y(/\$\{[\w\W]*/gm),on=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),an=y(/^aria-[\-\w]+$/),_t=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rn=y(/^(?:\w+script|data):/i),sn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gt=y(/^html$/i),ln=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var pt=Object.freeze({__proto__:null,ARIA_ATTR:an,ATTR_WHITESPACE:sn,CUSTOM_ELEMENT:ln,DATA_ATTR:on,DOCTYPE_NAME:gt,ERB_EXPR:tn,IS_ALLOWED_URI:_t,IS_SCRIPT_OR_DATA:rn,MUSTACHE_EXPR:en,TMPLIT_EXPR:nn});const J={element:1,text:3,progressingInstruction:7,comment:8,document:9},cn=function(){return typeof window>"u"?null:window},fn=function(o,l){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let a=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(a=l.getAttribute(c));const O="dompurify"+(a?"#"+a:"");try{return o.createPolicy(O,{createHTML(P){return P},createScriptURL(P){return P}})}catch{return console.warn("TrustedTypes policy "+O+" could not be created."),null}},dt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ht(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cn();const o=i=>ht(i);if(o.version="3.2.7",o.removed=[],!s||!s.document||s.document.nodeType!==J.document||!s.Element)return o.isSupported=!1,o;let{document:l}=s;const a=l,c=a.currentScript,{DocumentFragment:O,HTMLTemplateElement:P,Node:ue,Element:ve,NodeFilter:W,NamedNodeMap:At=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:St,DOMParser:Rt,trustedTypes:Q}=s,B=ve.prototype,Ot=Z(B,"cloneNode"),Lt=Z(B,"remove"),yt=Z(B,"nextSibling"),Dt=Z(B,"childNodes"),ee=Z(B,"parentNode");if(typeof P=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let g,Y="";const{implementation:me,createNodeIterator:bt,createDocumentFragment:Nt,getElementsByTagName:It}=l,{importNode:Mt}=a;let h=dt();o.isSupported=typeof Tt=="function"&&typeof ee=="function"&&me&&me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:pe,ERB_EXPR:de,TMPLIT_EXPR:Te,DATA_ATTR:Ct,ARIA_ATTR:wt,IS_SCRIPT_OR_DATA:xt,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:Pt}=pt;let{IS_ALLOWED_URI:Ue}=pt,p=null;const Fe=r({},[...ct,...Ie,...Me,...Ce,...ft]);let T=null;const He=r({},[...ut,...we,...mt,...ce]);let u=Object.seal(Et(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,Ee=null,ze=!0,_e=!0,Ge=!1,We=!0,v=!1,te=!0,w=!1,ge=!1,he=!1,k=!1,ne=!1,oe=!1,Be=!0,Ye=!1;const vt="user-content-";let Ae=!0,j=!1,U={},F=null;const Xe=r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let je=null;const Ve=r({},["audio","video","img","source","image","track"]);let Se=null;const $e=r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",ae="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xhtml";let H=N,Re=!1,Oe=null;const kt=r({},[ie,ae,N],be);let re=r({},["mi","mo","mn","ms","mtext"]),se=r({},["annotation-xml"]);const Ut=r({},["title","style","font","a","script"]);let V=null;const Ft=["application/xhtml+xml","text/html"],Ht="text/html";let d=null,z=null;const zt=l.createElement("form"),qe=function(e){return e instanceof RegExp||e instanceof Function},Le=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===e)){if((!e||typeof e!="object")&&(e={}),e=C(e),V=Ft.indexOf(e.PARSER_MEDIA_TYPE)===-1?Ht:e.PARSER_MEDIA_TYPE,d=V==="application/xhtml+xml"?be:fe,p=D(e,"ALLOWED_TAGS")?r({},e.ALLOWED_TAGS,d):Fe,T=D(e,"ALLOWED_ATTR")?r({},e.ALLOWED_ATTR,d):He,Oe=D(e,"ALLOWED_NAMESPACES")?r({},e.ALLOWED_NAMESPACES,be):kt,Se=D(e,"ADD_URI_SAFE_ATTR")?r(C($e),e.ADD_URI_SAFE_ATTR,d):$e,je=D(e,"ADD_DATA_URI_TAGS")?r(C(Ve),e.ADD_DATA_URI_TAGS,d):Ve,F=D(e,"FORBID_CONTENTS")?r({},e.FORBID_CONTENTS,d):Xe,X=D(e,"FORBID_TAGS")?r({},e.FORBID_TAGS,d):C({}),Ee=D(e,"FORBID_ATTR")?r({},e.FORBID_ATTR,d):C({}),U=D(e,"USE_PROFILES")?e.USE_PROFILES:!1,ze=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,Ge=e.ALLOW_UNKNOWN_PROTOCOLS||!1,We=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,v=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,w=e.WHOLE_DOCUMENT||!1,k=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ye=e.SANITIZE_NAMED_PROPS||!1,Ae=e.KEEP_CONTENT!==!1,j=e.IN_PLACE||!1,Ue=e.ALLOWED_URI_REGEXP||_t,H=e.NAMESPACE||N,re=e.MATHML_TEXT_INTEGRATION_POINTS||re,se=e.HTML_INTEGRATION_POINTS||se,u=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(u.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(u.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(u.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),v&&(_e=!1),ne&&(k=!0),U&&(p=r({},ft),T=[],U.html===!0&&(r(p,ct),r(T,ut)),U.svg===!0&&(r(p,Ie),r(T,we),r(T,ce)),U.svgFilters===!0&&(r(p,Me),r(T,we),r(T,ce)),U.mathMl===!0&&(r(p,Ce),r(T,mt),r(T,ce))),e.ADD_TAGS&&(p===Fe&&(p=C(p)),r(p,e.ADD_TAGS,d)),e.ADD_ATTR&&(T===He&&(T=C(T)),r(T,e.ADD_ATTR,d)),e.ADD_URI_SAFE_ATTR&&r(Se,e.ADD_URI_SAFE_ATTR,d),e.FORBID_CONTENTS&&(F===Xe&&(F=C(F)),r(F,e.FORBID_CONTENTS,d)),Ae&&(p["#text"]=!0),w&&r(p,["html","head","body"]),p.table&&(r(p,["tbody"]),delete X.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');g=e.TRUSTED_TYPES_POLICY,Y=g.createHTML("")}else g===void 0&&(g=fn(Q,c)),g!==null&&typeof Y=="string"&&(Y=g.createHTML(""));S&&S(e),z=e}},Ke=r({},[...Ie,...Me,...Jt]),Ze=r({},[...Ce,...Qt]),Gt=function(e){let t=ee(e);(!t||!t.tagName)&&(t={namespaceURI:H,tagName:"template"});const n=fe(e.tagName),f=fe(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ae?t.namespaceURI===N?n==="svg":t.namespaceURI===ie?n==="svg"&&(f==="annotation-xml"||re[f]):!!Ke[n]:e.namespaceURI===ie?t.namespaceURI===N?n==="math":t.namespaceURI===ae?n==="math"&&se[f]:!!Ze[n]:e.namespaceURI===N?t.namespaceURI===ae&&!se[f]||t.namespaceURI===ie&&!re[f]?!1:!Ze[n]&&(Ut[n]||!Ke[n]):!!(V==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},b=function(e){$(o.removed,{element:e});try{ee(e).removeChild(e)}catch{Lt(e)}},x=function(e,t){try{$(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{$(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(k||ne)try{b(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Je=function(e){let t=null,n=null;if(he)e="<remove></remove>"+e;else{const m=Ne(e,/^[\r\n\t ]+/);n=m&&m[0]}V==="application/xhtml+xml"&&H===N&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const f=g?g.createHTML(e):e;if(H===N)try{t=new Rt().parseFromString(f,V)}catch{}if(!t||!t.documentElement){t=me.createDocument(H,"template",null);try{t.documentElement.innerHTML=Re?Y:f}catch{}}const _=t.body||t.documentElement;return e&&n&&_.insertBefore(l.createTextNode(n),_.childNodes[0]||null),H===N?It.call(t,w?"html":"body")[0]:w?t.documentElement:_},Qe=function(e){return bt.call(e.ownerDocument||e,e,W.SHOW_ELEMENT|W.SHOW_COMMENT|W.SHOW_TEXT|W.SHOW_PROCESSING_INSTRUCTION|W.SHOW_CDATA_SECTION,null)},ye=function(e){return e instanceof St&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof At)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},et=function(e){return typeof ue=="function"&&e instanceof ue};function I(i,e,t){le(i,n=>{n.call(o,e,t,z)})}const tt=function(e){let t=null;if(I(h.beforeSanitizeElements,e,null),ye(e))return b(e),!0;const n=d(e.nodeName);if(I(h.uponSanitizeElement,e,{tagName:n,allowedTags:p}),te&&e.hasChildNodes()&&!et(e.firstElementChild)&&A(/<[/\w!]/g,e.innerHTML)&&A(/<[/\w!]/g,e.textContent)||e.nodeType===J.progressingInstruction||te&&e.nodeType===J.comment&&A(/<[/\w]/g,e.data))return b(e),!0;if(!p[n]||X[n]){if(!X[n]&&ot(n)&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,n)||u.tagNameCheck instanceof Function&&u.tagNameCheck(n)))return!1;if(Ae&&!F[n]){const f=ee(e)||e.parentNode,_=Dt(e)||e.childNodes;if(_&&f){const m=_.length;for(let L=m-1;L>=0;--L){const M=Ot(_[L],!0);M.__removalCount=(e.__removalCount||0)+1,f.insertBefore(M,yt(e))}}}return b(e),!0}return e instanceof ve&&!Gt(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&A(/<\/no(script|embed|frames)/i,e.innerHTML)?(b(e),!0):(v&&e.nodeType===J.text&&(t=e.textContent,le([pe,de,Te],f=>{t=q(t,f," ")}),e.textContent!==t&&($(o.removed,{element:e.cloneNode()}),e.textContent=t)),I(h.afterSanitizeElements,e,null),!1)},nt=function(e,t,n){if(Be&&(t==="id"||t==="name")&&(n in l||n in zt))return!1;if(!(_e&&!Ee[t]&&A(Ct,t))){if(!(ze&&A(wt,t))){if(!T[t]||Ee[t]){if(!(ot(e)&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,e)||u.tagNameCheck instanceof Function&&u.tagNameCheck(e))&&(u.attributeNameCheck instanceof RegExp&&A(u.attributeNameCheck,t)||u.attributeNameCheck instanceof Function&&u.attributeNameCheck(t,e))||t==="is"&&u.allowCustomizedBuiltInElements&&(u.tagNameCheck instanceof RegExp&&A(u.tagNameCheck,n)||u.tagNameCheck instanceof Function&&u.tagNameCheck(n))))return!1}else if(!Se[t]){if(!A(Ue,q(n,ke,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&$t(n,"data:")===0&&je[e])){if(!(Ge&&!A(xt,q(n,ke,"")))){if(n)return!1}}}}}}return!0},ot=function(e){return e!=="annotation-xml"&&Ne(e,Pt)},it=function(e){I(h.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||ye(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let f=t.length;for(;f--;){const _=t[f],{name:m,namespaceURI:L,value:M}=_,G=d(m),De=M;let E=m==="value"?De:qt(De);if(n.attrName=G,n.attrValue=E,n.keepAttr=!0,n.forceKeepAttr=void 0,I(h.uponSanitizeAttribute,e,n),E=n.attrValue,Ye&&(G==="id"||G==="name")&&(x(m,e),E=vt+E),te&&A(/((--!?|])>)|<\/(style|title|textarea)/i,E)){x(m,e);continue}if(G==="attributename"&&Ne(E,"href")){x(m,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){x(m,e);continue}if(!We&&A(/\/>/i,E)){x(m,e);continue}v&&le([pe,de,Te],rt=>{E=q(E,rt," ")});const at=d(e.nodeName);if(!nt(at,G,E)){x(m,e);continue}if(g&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!L)switch(Q.getAttributeType(at,G)){case"TrustedHTML":{E=g.createHTML(E);break}case"TrustedScriptURL":{E=g.createScriptURL(E);break}}if(E!==De)try{L?e.setAttributeNS(L,m,E):e.setAttribute(m,E),ye(e)?b(e):lt(o.removed)}catch{x(m,e)}}I(h.afterSanitizeAttributes,e,null)},Wt=function i(e){let t=null;const n=Qe(e);for(I(h.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)I(h.uponSanitizeShadowNode,t,null),tt(t),it(t),t.content instanceof O&&i(t.content);I(h.afterSanitizeShadowDOM,e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,f=null,_=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!et(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw K("dirty is not a string, aborting")}else throw K("toString is not a function");if(!o.isSupported)return i;if(ge||Le(e),o.removed=[],typeof i=="string"&&(j=!1),j){if(i.nodeName){const M=d(i.nodeName);if(!p[M]||X[M])throw K("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof ue)t=Je("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===J.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!k&&!v&&!w&&i.indexOf("<")===-1)return g&&oe?g.createHTML(i):i;if(t=Je(i),!t)return k?null:oe?Y:""}t&&he&&b(t.firstChild);const m=Qe(j?i:t);for(;f=m.nextNode();)tt(f),it(f),f.content instanceof O&&Wt(f.content);if(j)return i;if(k){if(ne)for(_=Nt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(T.shadowroot||T.shadowrootmode)&&(_=Mt.call(a,_,!0)),_}let L=w?t.outerHTML:t.innerHTML;return w&&p["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&A(gt,t.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
- `+L),v&&le([pe,de,Te],M=>{L=q(L,M," ")}),g&&oe?g.createHTML(L):L},o.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Le(i),ge=!0},o.clearConfig=function(){z=null,ge=!1},o.isValidAttribute=function(i,e,t){z||Le({});const n=d(i),f=d(e);return nt(n,f,t)},o.addHook=function(i,e){typeof e=="function"&&$(h[i],e)},o.removeHook=function(i,e){if(e!==void 0){const t=jt(h[i],e);return t===-1?void 0:Vt(h[i],t,1)[0]}return lt(h[i])},o.removeHooks=function(i){h[i]=[]},o.removeAllHooks=function(){h=dt()},o}var un=ht();export{un as default};
|