import{r as w,g as xn,j as _,P as Pn}from"./index-BeH8ha5h.js";import{S as Mn}from"./close_icon-white-BxOV8PmD.js";import{S as ze}from"./arrow-right_icon-C84xKQ9u.js";import{S as en}from"./VideoPlayer-CbEhmaK5.js";const kn="_carouselContainer_paakb_1",vn="_carousel_paakb_1",Un="_carouselItem_paakb_22",Fn="_carouselPlaceholderIcon_paakb_34",Bn="_imageClip_paakb_40",jn="_previewImage_paakb_47",zn="_scrollButton_paakb_54",Hn="_scrollButtonRight_paakb_67",Gn="_scrollButtonLeft_paakb_72",Wn="_scrollIcon_paakb_77",$n="_scrollIconLeft_paakb_81",Yn="_carouselItemClickable_paakb_85",U={carouselContainer:kn,carousel:vn,carouselItem:Un,carouselPlaceholderIcon:Fn,imageClip:Bn,previewImage:jn,scrollButton:zn,scrollButtonRight:Hn,scrollButtonLeft:Gn,scrollIcon:Wn,scrollIconLeft:$n,carouselItemClickable:Yn},Xn="_overlay_jtlca_1",Vn="_closing_jtlca_15",qn="_stage_jtlca_20",Kn="_image_jtlca_30",Zn="_imageSwitched_jtlca_41",Jn="_fallback_jtlca_45",Qn="_fallbackIcon_jtlca_54",eo="_fallbackText_jtlca_60",to="_closeButton_jtlca_65",no="_closeIcon_jtlca_85",oo="_controls_jtlca_90",ro="_navButton_jtlca_100",ao="_navButtonPrev_jtlca_120",so="_navButtonNext_jtlca_124",io="_navIcon_jtlca_128",lo="_navIconPrev_jtlca_137",co="_counter_jtlca_141",N={overlay:Xn,closing:Vn,stage:qn,image:Kn,imageSwitched:Zn,fallback:Jn,fallbackIcon:Qn,fallbackText:eo,closeButton:to,closeIcon:no,controls:oo,navButton:ro,navButtonPrev:ao,navButtonNext:so,navIcon:io,navIconPrev:lo,counter:co},uo=50,fo=220,mo=({photos:n,startIndex:o=0,onClose:i})=>{const s=n.length,c=s>1,[f,S]=w.useState(()=>Math.min(Math.max(o,0),s-1)),[J,R]=w.useState([]),[W,te]=w.useState(!1),[ne,B]=w.useState(!1),oe=w.useRef(null),T=w.useRef(!1),H=w.useRef(null);xn(!0);const $=w.useCallback(()=>{H.current||(te(!0),H.current=setTimeout(i,fo))},[i]);w.useEffect(()=>()=>{H.current&&clearTimeout(H.current)},[]);const Y=w.useCallback(()=>{B(!0),S(d=>(d-1+s)%s)},[s]),ce=w.useCallback(()=>{B(!0),S(d=>(d+1)%s)},[s]);w.useEffect(()=>{s<2||[(f+1)%s,(f-1+s)%s].forEach(d=>{const O=n[d];if(!O)return;const j=new Image;j.referrerPolicy="no-referrer",j.src=O})},[f,n,s]),w.useEffect(()=>{const d=O=>{if(O.key==="Escape"){$();return}c&&(O.key==="ArrowLeft"&&Y(),O.key==="ArrowRight"&&ce())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[c,$,ce,Y]);const Se=d=>{var O;oe.current=((O=d.touches[0])==null?void 0:O.clientX)??null,T.current=!1},k=d=>{var De;const O=oe.current;if(oe.current=null,O==null||!c)return;const j=(((De=d.changedTouches[0])==null?void 0:De.clientX)??O)-O;Math.abs(j)<uo||(T.current=!0,j>0?Y():ce())},X=()=>{if(T.current){T.current=!1;return}$()},D=(d,O)=>{d.stopPropagation(),O()},Q=()=>{R(d=>d.includes(f)?d:[...d,f])};if(s===0)return null;const pe=n[f],we=!pe||J.includes(f);return _.jsx(Pn,{children:_.jsxs("div",{className:`${N.overlay} ${W?N.closing:""}`.trim(),role:"dialog","aria-modal":"true","aria-label":"Просмотр фото",onClick:X,onTouchStart:Se,onTouchEnd:k,children:[_.jsx("button",{type:"button",className:N.closeButton,onClick:$,"aria-label":"Закрыть просмотр",children:_.jsx(Mn,{className:N.closeIcon})}),_.jsx("div",{className:N.stage,children:we?_.jsxs("div",{className:N.fallback,onClick:d=>d.stopPropagation(),children:[_.jsx(en,{className:N.fallbackIcon}),_.jsx("p",{className:`body-1 ${N.fallbackText}`,children:"Фото не загрузилось"})]}):_.jsx("img",{src:pe,alt:"",className:`${N.image} ${ne?N.imageSwitched:""}`.trim(),referrerPolicy:"no-referrer",onError:Q,onClick:d=>d.stopPropagation()},f)}),c&&_.jsxs("div",{className:N.controls,children:[_.jsx("button",{type:"button",className:`${N.navButton} ${N.navButtonPrev}`,onClick:d=>D(d,Y),"aria-label":"Предыдущее фото",children:_.jsx(ze,{className:`${N.navIcon} ${N.navIconPrev}`})}),_.jsxs("span",{className:`body-3 ${N.counter}`,children:[f+1," из ",s]}),_.jsx("button",{type:"button",className:`${N.navButton} ${N.navButtonNext}`,onClick:d=>D(d,ce),"aria-label":"Следующее фото",children:_.jsx(ze,{className:N.navIcon})})]})]})})},Qo=({photos:n,className:o="",enableLightbox:i=!1})=>{const s=w.useRef(null),[c,f]=w.useState(!1),[S,J]=w.useState(!1),[R,W]=w.useState(null),te=()=>{const T=s.current;T&&(f(T.scrollWidth-T.clientWidth-T.scrollLeft>4),J(T.scrollLeft>4))};w.useEffect(()=>{te()},[n]);const ne=()=>{var T;(T=s.current)==null||T.scrollBy({left:220,behavior:"smooth"})},B=()=>{var T;(T=s.current)==null||T.scrollBy({left:-220,behavior:"smooth"})};if(n.length===0)return null;const oe=T=>T?_.jsx("div",{className:U.imageClip,children:_.jsx("img",{src:T,alt:"",className:U.previewImage})}):_.jsx(en,{className:U.carouselPlaceholderIcon});return _.jsxs("div",{className:`${U.carouselContainer} ${o}`.trim(),children:[_.jsx("div",{className:U.carousel,ref:s,onScroll:te,children:n.map((T,H)=>i?_.jsx("button",{type:"button",className:`${U.carouselItem} ${U.carouselItemClickable}`,onClick:()=>W(H),"aria-label":`Открыть фото ${H+1} на весь экран`,children:oe(T)},H):_.jsx("div",{className:U.carouselItem,children:oe(T)},H))}),S&&_.jsx("button",{type:"button",className:`${U.scrollButton} ${U.scrollButtonLeft}`,onClick:B,"aria-label":"Назад",children:_.jsx(ze,{className:`${U.scrollIcon} ${U.scrollIconLeft}`})}),c&&_.jsx("button",{type:"button",className:`${U.scrollButton} ${U.scrollButtonRight}`,onClick:ne,"aria-label":"Дальше",children:_.jsx(ze,{className:U.scrollIcon})}),R!==null&&_.jsx(mo,{photos:n,startIndex:R,onClose:()=>W(null)})]})};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function jt(n,o){(o==null||o>n.length)&&(o=n.length);for(var i=0,s=Array(o);i<o;i++)s[i]=n[i];return s}function po(n){if(Array.isArray(n))return n}function _o(n,o){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var s,c,f,S,J=[],R=!0,W=!1;try{if(f=(i=i.call(n)).next,o!==0)for(;!(R=(s=f.call(i)).done)&&(J.push(s.value),J.length!==o);R=!0);}catch(te){W=!0,c=te}finally{try{if(!R&&i.return!=null&&(S=i.return(),Object(S)!==S))return}finally{if(W)throw c}}return J}}function To(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ho(n,o){return po(n)||_o(n,o)||go(n,o)||To()}function go(n,o){if(n){if(typeof n=="string")return jt(n,o);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?jt(n,o):void 0}}const tn=Object.entries,zt=Object.setPrototypeOf,Eo=Object.isFrozen,Ao=Object.getPrototypeOf,So=Object.getOwnPropertyDescriptor;let P=Object.freeze,M=Object.seal,Ae=Object.create,nn=typeof Reflect<"u"&&Reflect,ft=nn.apply,mt=nn.construct;P||(P=function(o){return o});M||(M=function(o){return o});ft||(ft=function(o,i){for(var s=arguments.length,c=new Array(s>2?s-2:0),f=2;f<s;f++)c[f-2]=arguments[f];return o.apply(i,c)});mt||(mt=function(o){for(var i=arguments.length,s=new Array(i>1?i-1:0),c=1;c<i;c++)s[c-1]=arguments[c];return new o(...s)});const Re=I(Array.prototype.forEach),yo=I(Array.prototype.lastIndexOf),Ht=I(Array.prototype.pop),Ee=I(Array.prototype.push),bo=I(Array.prototype.splice),le=Array.isArray,Ce=I(String.prototype.toLowerCase),st=I(String.prototype.toString),Gt=I(String.prototype.match),Oe=I(String.prototype.replace),Wt=I(String.prototype.indexOf),Io=I(String.prototype.trim),No=I(Number.prototype.toString),Ro=I(Boolean.prototype.toString),$t=typeof BigInt>"u"?null:I(BigInt.prototype.toString),Yt=typeof Symbol>"u"?null:I(Symbol.prototype.toString),C=I(Object.prototype.hasOwnProperty),Le=I(Object.prototype.toString),x=I(RegExp.prototype.test),me=Oo(TypeError);function I(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),c=1;c<i;c++)s[c-1]=arguments[c];return ft(n,o,s)}}function Oo(n){return function(){for(var o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return mt(n,i)}}function m(n,o){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ce;if(zt&&zt(n,null),!le(o))return n;let s=o.length;for(;s--;){let c=o[s];if(typeof c=="string"){const f=i(c);f!==c&&(Eo(o)||(o[s]=f),c=f)}n[c]=!0}return n}function Lo(n){for(let o=0;o<n.length;o++)C(n,o)||(n[o]=null);return n}function F(n){const o=Ae(null);for(const s of tn(n)){var i=ho(s,2);const c=i[0],f=i[1];C(n,c)&&(le(f)?o[c]=Lo(f):f&&typeof f=="object"&&f.constructor===Object?o[c]=F(f):o[c]=f)}return o}function Co(n){switch(typeof n){case"string":return n;case"number":return No(n);case"boolean":return Ro(n);case"bigint":return $t?$t(n):"0";case"symbol":return Yt?Yt(n):"Symbol()";case"undefined":return Le(n);case"function":case"object":{if(n===null)return Le(n);const o=n,i=Z(o,"toString");if(typeof i=="function"){const s=i(o);return typeof s=="string"?s:Le(s)}return Le(n)}default:return Le(n)}}function Z(n,o){for(;n!==null;){const s=So(n,o);if(s){if(s.get)return I(s.get);if(typeof s.value=="function")return I(s.value)}n=Ao(n)}function i(){return null}return i}function wo(n){try{return x(n,""),!0}catch{return!1}}const Xt=P(["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"]),it=P(["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","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),lt=P(["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"]),Do=P(["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"]),ct=P(["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"]),xo=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Vt=P(["#text"]),qt=P(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),ut=P(["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","mask-type","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"]),Kt=P(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),je=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Po=M(/{{[\w\W]*|^[\w\W]*}}/g),Mo=M(/<%[\w\W]*|^[\w\W]*%>/g),ko=M(/\${[\w\W]*/g),vo=M(/^data-[\-\w.\u00B7-\uFFFF]+$/),Uo=M(/^aria-[\-\w]+$/),Zt=M(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fo=M(/^(?:\w+script|data):/i),Bo=M(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jo=M(/^html$/i),zo=M(/^[a-z][.\w]*(-[.\w]+)+$/i),Jt=M(/<[/\w!]/g),Ho=M(/<[/\w]/g),Go=M(/<\/no(script|embed|frames)/i),Wo=M(/\/>/i),K={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$o=function(){return typeof window>"u"?null:window},Yo=function(o,i){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let s=null;const c="data-tt-policy-suffix";i&&i.hasAttribute(c)&&(s=i.getAttribute(c));const f="dompurify"+(s?"#"+s:"");try{return o.createPolicy(f,{createHTML(S){return S},createScriptURL(S){return S}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},Qt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ie=function(o,i,s,c){return C(o,i)&&le(o[i])?m(c.base?F(c.base):{},o[i],c.transform):s};function on(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$o();const o=a=>on(a);if(o.version="3.4.11",o.removed=[],!n||!n.document||n.document.nodeType!==K.document||!n.Element)return o.isSupported=!1,o;let i=n.document;const s=i,c=s.currentScript;n.DocumentFragment;const f=n.HTMLTemplateElement,S=n.Node,J=n.Element,R=n.NodeFilter,W=n.NamedNodeMap;W===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const te=n.DOMParser,ne=n.trustedTypes,B=J.prototype,oe=Z(B,"cloneNode"),T=Z(B,"remove"),H=Z(B,"nextSibling"),$=Z(B,"childNodes"),Y=Z(B,"parentNode"),ce=Z(B,"shadowRoot"),Se=Z(B,"attributes"),k=S&&S.prototype?Z(S.prototype,"nodeType"):null,X=S&&S.prototype?Z(S.prototype,"nodeName"):null;if(typeof f=="function"){const a=i.createElement("template");a.content&&a.content.ownerDocument&&(i=a.content.ownerDocument)}let D,Q="",pe,we=!1,d=0;const O=function(){if(d>0)throw me('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},j=function(e){O(),d++;try{return D.createHTML(e)}finally{d--}},De=function(e){O(),d++;try{return D.createScriptURL(e)}finally{d--}},rn=function(){return we||(pe=Yo(ne,c),we=!0),pe},xe=i,He=xe.implementation,pt=xe.createNodeIterator,an=xe.createDocumentFragment,sn=xe.getElementsByTagName,ln=s.importNode;let y=Qt();o.isSupported=typeof tn=="function"&&typeof Y=="function"&&He&&He.createHTMLDocument!==void 0;const cn=Po,un=Mo,fn=ko,mn=vo,pn=Uo,dn=Fo,dt=Bo,_n=zo;let _t=Zt,h=null;const Tt=m({},[...Xt,...it,...lt,...ct,...Vt]);let g=null;const ht=m({},[...qt,...ut,...Kt,...je]);let E=Object.seal(Ae(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}})),ye=null,gt=null;const re=Object.seal(Ae(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Et=!0,Ge=!0,At=!1,St=!0,ae=!1,be=!0,ue=!1,We=!1,$e=null,Ye=null,Xe=!1,de=!1,Pe=!1,Me=!1,yt=!0,bt=!1;const It="user-content-";let Ve=!0,qe=!1,_e={},V=null;const Ke=m({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Nt=null;const Rt=m({},["audio","video","img","source","image","track"]);let Ze=null;const Ot=m({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ke="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",q="http://www.w3.org/1999/xhtml";let Te=q,Je=!1,Qe=null;const Tn=m({},[ke,ve,q],st),Lt=P(["mi","mo","mn","ms","mtext"]);let et=m({},Lt);const Ct=P(["annotation-xml"]);let tt=m({},Ct);const hn=m({},["title","style","font","a","script"]);let Ie=null;const gn=["application/xhtml+xml","text/html"],En="text/html";let A=null,he=null;const An=i.createElement("form"),wt=function(e){return e instanceof RegExp||e instanceof Function},nt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(he&&he===e)return;(!e||typeof e!="object")&&(e={}),e=F(e),Ie=gn.indexOf(e.PARSER_MEDIA_TYPE)===-1?En:e.PARSER_MEDIA_TYPE,A=Ie==="application/xhtml+xml"?st:Ce,h=ie(e,"ALLOWED_TAGS",Tt,{transform:A}),g=ie(e,"ALLOWED_ATTR",ht,{transform:A}),Qe=ie(e,"ALLOWED_NAMESPACES",Tn,{transform:st}),Ze=ie(e,"ADD_URI_SAFE_ATTR",Ot,{transform:A,base:Ot}),Nt=ie(e,"ADD_DATA_URI_TAGS",Rt,{transform:A,base:Rt}),V=ie(e,"FORBID_CONTENTS",Ke,{transform:A}),ye=ie(e,"FORBID_TAGS",F({}),{transform:A}),gt=ie(e,"FORBID_ATTR",F({}),{transform:A}),_e=C(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?F(e.USE_PROFILES):e.USE_PROFILES:!1,Et=e.ALLOW_ARIA_ATTR!==!1,Ge=e.ALLOW_DATA_ATTR!==!1,At=e.ALLOW_UNKNOWN_PROTOCOLS||!1,St=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ae=e.SAFE_FOR_TEMPLATES||!1,be=e.SAFE_FOR_XML!==!1,ue=e.WHOLE_DOCUMENT||!1,de=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Me=e.RETURN_TRUSTED_TYPE||!1,Xe=e.FORCE_BODY||!1,yt=e.SANITIZE_DOM!==!1,bt=e.SANITIZE_NAMED_PROPS||!1,Ve=e.KEEP_CONTENT!==!1,qe=e.IN_PLACE||!1,_t=wo(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Zt,Te=typeof e.NAMESPACE=="string"?e.NAMESPACE:q,et=C(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?F(e.MATHML_TEXT_INTEGRATION_POINTS):m({},Lt),tt=C(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?F(e.HTML_INTEGRATION_POINTS):m({},Ct);const t=C(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?F(e.CUSTOM_ELEMENT_HANDLING):Ae(null);if(E=Ae(null),C(t,"tagNameCheck")&&wt(t.tagNameCheck)&&(E.tagNameCheck=t.tagNameCheck),C(t,"attributeNameCheck")&&wt(t.attributeNameCheck)&&(E.attributeNameCheck=t.attributeNameCheck),C(t,"allowCustomizedBuiltInElements")&&typeof t.allowCustomizedBuiltInElements=="boolean"&&(E.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),M(E),ae&&(Ge=!1),Pe&&(de=!0),_e&&(h=m({},Vt),g=Ae(null),_e.html===!0&&(m(h,Xt),m(g,qt)),_e.svg===!0&&(m(h,it),m(g,ut),m(g,je)),_e.svgFilters===!0&&(m(h,lt),m(g,ut),m(g,je)),_e.mathMl===!0&&(m(h,ct),m(g,Kt),m(g,je))),re.tagCheck=null,re.attributeCheck=null,C(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?re.tagCheck=e.ADD_TAGS:le(e.ADD_TAGS)&&(h===Tt&&(h=F(h)),m(h,e.ADD_TAGS,A))),C(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?re.attributeCheck=e.ADD_ATTR:le(e.ADD_ATTR)&&(g===ht&&(g=F(g)),m(g,e.ADD_ATTR,A))),C(e,"ADD_URI_SAFE_ATTR")&&le(e.ADD_URI_SAFE_ATTR)&&m(Ze,e.ADD_URI_SAFE_ATTR,A),C(e,"FORBID_CONTENTS")&&le(e.FORBID_CONTENTS)&&(V===Ke&&(V=F(V)),m(V,e.FORBID_CONTENTS,A)),C(e,"ADD_FORBID_CONTENTS")&&le(e.ADD_FORBID_CONTENTS)&&(V===Ke&&(V=F(V)),m(V,e.ADD_FORBID_CONTENTS,A)),Ve&&(h["#text"]=!0),ue&&m(h,["html","head","body"]),h.table&&(m(h,["tbody"]),delete ye.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw me('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const r=D;D=e.TRUSTED_TYPES_POLICY;try{Q=j("")}catch(l){throw D=r,l}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,Q=""):(D===void 0&&(D=rn()),D&&typeof Q=="string"&&(Q=j("")));P&&P(e),he=e},Dt=m({},[...it,...lt,...Do]),xt=m({},[...ct,...xo]),Sn=function(e,t,r){return t.namespaceURI===q?e==="svg":t.namespaceURI===ke?e==="svg"&&(r==="annotation-xml"||et[r]):!!Dt[e]},yn=function(e,t,r){return t.namespaceURI===q?e==="math":t.namespaceURI===ve?e==="math"&&tt[r]:!!xt[e]},bn=function(e,t,r){return t.namespaceURI===ve&&!tt[r]||t.namespaceURI===ke&&!et[r]?!1:!xt[e]&&(hn[e]||!Dt[e])},In=function(e){let t=Y(e);(!t||!t.tagName)&&(t={namespaceURI:Te,tagName:"template"});const r=Ce(e.tagName),l=Ce(t.tagName);return Qe[e.namespaceURI]?e.namespaceURI===ve?Sn(r,t,l):e.namespaceURI===ke?yn(r,t,l):e.namespaceURI===q?bn(r,t,l):!!(Ie==="application/xhtml+xml"&&Qe[e.namespaceURI]):!1},se=function(e){Ee(o.removed,{element:e});try{Y(e).removeChild(e)}catch{if(T(e),!Y(e))throw me("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Pt=function(e){const t=$(e);if(t){const l=[];Re(t,u=>{Ee(l,u)}),Re(l,u=>{try{T(u)}catch{}})}const r=Se(e);if(r)for(let l=r.length-1;l>=0;--l){const u=r[l],p=u&&u.name;if(typeof p=="string")try{e.removeAttribute(p)}catch{}}},fe=function(e,t){try{Ee(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{Ee(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(de||Pe)try{se(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Nn=function(e){const t=Se(e);if(t)for(let r=t.length-1;r>=0;--r){const l=t[r],u=l&&l.name;if(!(typeof u!="string"||g[A(u)]))try{e.removeAttribute(u)}catch{}}},Rn=function(e){const t=[e];for(;t.length>0;){const r=t.pop();(k?k(r):r.nodeType)===K.element&&Nn(r);const u=$(r);if(u)for(let p=u.length-1;p>=0;--p)t.push(u[p])}},Mt=function(e){let t=null,r=null;if(Xe)e="<remove></remove>"+e;else{const p=Gt(e,/^[\r\n\t ]+/);r=p&&p[0]}Ie==="application/xhtml+xml"&&Te===q&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const l=D?j(e):e;if(Te===q)try{t=new te().parseFromString(l,Ie)}catch{}if(!t||!t.documentElement){t=He.createDocument(Te,"template",null);try{t.documentElement.innerHTML=Je?Q:l}catch{}}const u=t.body||t.documentElement;return e&&r&&u.insertBefore(i.createTextNode(r),u.childNodes[0]||null),Te===q?sn.call(t,ue?"html":"body")[0]:ue?t.documentElement:u},kt=function(e){return pt.call(e.ownerDocument||e,e,R.SHOW_ELEMENT|R.SHOW_COMMENT|R.SHOW_TEXT|R.SHOW_PROCESSING_INSTRUCTION|R.SHOW_CDATA_SECTION,null)},Ue=function(e){return e=Oe(e,cn," "),e=Oe(e,un," "),e=Oe(e,fn," "),e},ot=function(e){var t;e.normalize();const r=pt.call(e.ownerDocument||e,e,R.SHOW_TEXT|R.SHOW_COMMENT|R.SHOW_CDATA_SECTION|R.SHOW_PROCESSING_INSTRUCTION,null);let l=r.nextNode();for(;l;)l.data=Ue(l.data),l=r.nextNode();const u=(t=e.querySelectorAll)===null||t===void 0?void 0:t.call(e,"template");u&&Re(u,p=>{ge(p.content)&&ot(p.content)})},Fe=function(e){const t=X?X(e):null;return typeof t!="string"||A(t)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Se(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==k(e)||e.childNodes!==$(e)},ge=function(e){if(!k||typeof e!="object"||e===null)return!1;try{return k(e)===K.documentFragment}catch{return!1}},Ne=function(e){if(!k||typeof e!="object"||e===null)return!1;try{return typeof k(e)=="number"}catch{return!1}};function ee(a,e,t){a.length!==0&&Re(a,r=>{r.call(o,e,t,he)})}const On=function(e,t){return!!(be&&e.hasChildNodes()&&!Ne(e.firstElementChild)&&x(Jt,e.textContent)&&x(Jt,e.innerHTML)||be&&e.namespaceURI===q&&t==="style"&&Ne(e.firstElementChild)||e.nodeType===K.processingInstruction||be&&e.nodeType===K.comment&&x(Ho,e.data))},Ln=function(e,t){if(!ye[t]&&Ft(t)&&(E.tagNameCheck instanceof RegExp&&x(E.tagNameCheck,t)||E.tagNameCheck instanceof Function&&E.tagNameCheck(t)))return!1;if(Ve&&!V[t]){const r=Y(e),l=$(e);if(l&&r){const u=l.length;for(let p=u-1;p>=0;--p){const L=qe?l[p]:oe(l[p],!0);r.insertBefore(L,H(e))}}}return se(e),!0},vt=function(e){if(ee(y.beforeSanitizeElements,e,null),Fe(e))return se(e),!0;const t=A(X?X(e):e.nodeName);if(ee(y.uponSanitizeElement,e,{tagName:t,allowedTags:h}),On(e,t))return se(e),!0;if(ye[t]||!(re.tagCheck instanceof Function&&re.tagCheck(t))&&!h[t])return Ln(e,t);if((k?k(e):e.nodeType)===K.element&&!In(e)||(t==="noscript"||t==="noembed"||t==="noframes")&&x(Go,e.innerHTML))return se(e),!0;if(ae&&e.nodeType===K.text){const l=Ue(e.textContent);e.textContent!==l&&(Ee(o.removed,{element:e.cloneNode()}),e.textContent=l)}return ee(y.afterSanitizeElements,e,null),!1},Ut=function(e,t,r){if(gt[t]||yt&&(t==="id"||t==="name")&&(r in i||r in An))return!1;const l=g[t]||re.attributeCheck instanceof Function&&re.attributeCheck(t,e);if(!(Ge&&x(mn,t))){if(!(Et&&x(pn,t))){if(l){if(!Ze[t]){if(!x(_t,Oe(r,dt,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Wt(r,"data:")===0&&Nt[e])){if(!(At&&!x(dn,Oe(r,dt,"")))){if(r)return!1}}}}}else if(!(Ft(e)&&(E.tagNameCheck instanceof RegExp&&x(E.tagNameCheck,e)||E.tagNameCheck instanceof Function&&E.tagNameCheck(e))&&(E.attributeNameCheck instanceof RegExp&&x(E.attributeNameCheck,t)||E.attributeNameCheck instanceof Function&&E.attributeNameCheck(t,e))||t==="is"&&E.allowCustomizedBuiltInElements&&(E.tagNameCheck instanceof RegExp&&x(E.tagNameCheck,r)||E.tagNameCheck instanceof Function&&E.tagNameCheck(r))))return!1}}return!0},Cn=m({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ft=function(e){return!Cn[Ce(e)]&&x(_n,e)},wn=function(e,t,r,l){if(D&&typeof ne=="object"&&typeof ne.getAttributeType=="function"&&!r)switch(ne.getAttributeType(e,t)){case"TrustedHTML":return j(l);case"TrustedScriptURL":return De(l)}return l},Dn=function(e,t,r,l){try{r?e.setAttributeNS(r,t,l):e.setAttribute(t,l),Fe(e)?se(e):Ht(o.removed)}catch{fe(t,e)}},Bt=function(e){ee(y.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||Fe(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:g,forceKeepAttr:void 0};let l=t.length;const u=A(e.nodeName);for(;l--;){const p=t[l],L=p.name,b=p.namespaceURI,z=p.value,G=A(L),at=z;let v=L==="value"?at:Io(at);if(r.attrName=G,r.attrValue=v,r.keepAttr=!0,r.forceKeepAttr=void 0,ee(y.uponSanitizeAttribute,e,r),v=r.attrValue,bt&&(G==="id"||G==="name")&&Wt(v,It)!==0&&(fe(L,e),v=It+v),be&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,v)){fe(L,e);continue}if(G==="attributename"&&Gt(v,"href")){fe(L,e);continue}if(!r.forceKeepAttr){if(!r.keepAttr){fe(L,e);continue}if(!St&&x(Wo,v)){fe(L,e);continue}if(ae&&(v=Ue(v)),!Ut(u,G,v)){fe(L,e);continue}v=wn(u,G,b,v),v!==at&&Dn(e,L,b,v)}}ee(y.afterSanitizeAttributes,e,null)},Be=function(e){let t=null;const r=kt(e);for(ee(y.beforeSanitizeShadowDOM,e,null);t=r.nextNode();)if(ee(y.uponSanitizeShadowNode,t,null),vt(t),Bt(t),ge(t.content)&&Be(t.content),(k?k(t):t.nodeType)===K.element){const u=ce(t);ge(u)&&(rt(u),Be(u))}ee(y.afterSanitizeShadowDOM,e,null)},rt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const r=t.pop();if(r.shadow){Be(r.shadow);continue}const l=r.node,p=(k?k(l):l.nodeType)===K.element,L=$(l);if(L)for(let b=L.length-1;b>=0;--b)t.push({node:L[b],shadow:null});if(p){const b=X?X(l):null;if(typeof b=="string"&&A(b)==="template"){const z=l.content;ge(z)&&t.push({node:z,shadow:null})}}if(p){const b=ce(l);ge(b)&&t.push({node:null,shadow:b},{node:b,shadow:null})}}};return o.sanitize=function(a){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,r=null,l=null,u=null;if(Je=!a,Je&&(a="<!-->"),typeof a!="string"&&!Ne(a)&&(a=Co(a),typeof a!="string"))throw me("dirty is not a string, aborting");if(!o.isSupported)return a;We?(h=$e,g=Ye):nt(e),(y.uponSanitizeElement.length>0||y.uponSanitizeAttribute.length>0)&&(h=F(h)),y.uponSanitizeAttribute.length>0&&(g=F(g)),o.removed=[];const p=qe&&typeof a!="string"&&Ne(a);if(p){const z=X?X(a):a.nodeName;if(typeof z=="string"){const G=A(z);if(!h[G]||ye[G])throw me("root node is forbidden and cannot be sanitized in-place")}if(Fe(a))throw me("root node is clobbered and cannot be sanitized in-place");try{rt(a)}catch(G){throw Pt(a),G}}else if(Ne(a))t=Mt("<!---->"),r=t.ownerDocument.importNode(a,!0),r.nodeType===K.element&&r.nodeName==="BODY"||r.nodeName==="HTML"?t=r:t.appendChild(r),rt(r);else{if(!de&&!ae&&!ue&&a.indexOf("<")===-1)return D&&Me?j(a):a;if(t=Mt(a),!t)return de?null:Me?Q:""}t&&Xe&&se(t.firstChild);const L=kt(p?a:t);try{for(;l=L.nextNode();)vt(l),Bt(l),ge(l.content)&&Be(l.content)}catch(z){throw p&&Pt(a),z}if(p)return Re(o.removed,z=>{z.element&&Rn(z.element)}),ae&&ot(a),a;if(de){if(ae&&ot(t),Pe)for(u=an.call(t.ownerDocument);t.firstChild;)u.appendChild(t.firstChild);else u=t;return(g.shadowroot||g.shadowrootmode)&&(u=ln.call(s,u,!0)),u}let b=ue?t.outerHTML:t.innerHTML;return ue&&h["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&x(jo,t.ownerDocument.doctype.name)&&(b="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
`+b),ae&&(b=Ue(b)),D&&Me?j(b):b},o.setConfig=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(a),We=!0,$e=h,Ye=g},o.clearConfig=function(){he=null,We=!1,$e=null,Ye=null,D=pe,Q=""},o.isValidAttribute=function(a,e,t){he||nt({});const r=A(a),l=A(e);return Ut(r,l,t)},o.addHook=function(a,e){typeof e=="function"&&C(y,a)&&Ee(y[a],e)},o.removeHook=function(a,e){if(C(y,a)){if(e!==void 0){const t=yo(y[a],e);return t===-1?void 0:bo(y[a],t,1)[0]}return Ht(y[a])}},o.removeHooks=function(a){C(y,a)&&(y[a]=[])},o.removeAllHooks=function(){y=Qt()},o}var Xo=on();const Vo=["p","br","strong","em","u","s","a","ul","ol","li","h1","h2","h3","span"],er=n=>Xo.sanitize(n||"",{ALLOWED_TAGS:Vo,ALLOWED_ATTR:["href","target","rel","style","class"]});export{Qo as P,er as s};