/i,o)){Ue&&(o=A(o,be," "),o=A(o,ve," "),o=A(o,Te," "));var f=ye(t.nodeName);if(Lt(f,a,o)){if(!qe||"id"!==a&&"name"!==a||(Et(s,t),o=Ye+o),ie&&"object"===e(x)&&"function"==typeof x.getAttributeType)if(m);else switch(x.getAttributeType(f,a)){case"TrustedHTML":o=ie.createHTML(o);break;case"TrustedScriptURL":o=ie.createScriptURL(o)}try{m?t.setAttributeNS(m,s,o):t.setAttribute(s,o),b(r.removed)}catch(e){}}}else Et(s,t)}kt("afterSanitizeAttributes",t,null)}},Dt=function e(t){var n,r=_t(t);for(kt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)kt("uponSanitizeShadowNode",n,null),xt(n)||(n.content instanceof l&&e(n.content),Ct(n));kt("afterSanitizeShadowDOM",t,null)};return r.sanitize=function(t){var o,i,c,s,m,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((it=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!St(t)){if("function"!=typeof t.toString)throw k("toString is not a function");if("string"!=typeof(t=t.toString()))throw k("dirty is not a string, aborting")}if(!r.isSupported){if("object"===e(n.toStaticHTML)||"function"==typeof n.toStaticHTML){if("string"==typeof t)return n.toStaticHTML(t);if(St(t))return n.toStaticHTML(t.outerHTML)}return t}if(ze||dt(f),r.removed=[],"string"==typeof t&&(Ke=!1),Ke){if(t.nodeName){var p=ye(t.nodeName);if(!Se[p]||Ce[p])throw k("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof u)1===(i=(o=At("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!Be&&!Ue&&!He&&-1===t.indexOf("<"))return ie&&Ge?ie.createHTML(t):t;if(!(o=At(t)))return Be?null:Ge?le:""}o&&Pe&&Nt(o.firstChild);for(var d=_t(Ke?t:o);c=d.nextNode();)3===c.nodeType&&c===s||xt(c)||(c.content instanceof l&&Dt(c.content),Ct(c),s=c);if(s=null,Ke)return t;if(Be){if(je)for(m=me.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(xe.shadowroot||xe.shadowrootmod)&&(m=pe.call(a,m,!0)),m}var h=He?o.outerHTML:o.innerHTML;return He&&Se["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&S(Z,o.ownerDocument.doctype.name)&&(h="\n"+h),Ue&&(h=A(h,be," "),h=A(h,ve," "),h=A(h,Te," ")),ie&&Ge?ie.createHTML(h):h},r.setConfig=function(e){dt(e),ze=!0},r.clearConfig=function(){mt=null,ze=!1},r.isValidAttribute=function(e,t,n){mt||dt({});var r=ye(e),o=ye(t);return Lt(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&(he[e]=he[e]||[],v(he[e],t))},r.removeHook=function(e){if(he[e])return b(he[e])},r.removeHooks=function(e){he[e]&&(he[e]=[])},r.removeAllHooks=function(){he={}},r}()}()}}])