import{Y as C,h as p,O as I,aj as M,ak as b,al as T,am as H,Q as P,$ as G,j as Q,_ as U,N as W,m as X,an as J,H as Y,ao as S,A as w,z as k,v as h,ap as N,aq as A,w as K,ar as Z,as as ee,at as te,au as re,av as ae,o as ne,p as oe,e as ie,a as se}from"./DBjB5OCe.js";import{d as ue}from"./BPWik_uC.js";function we(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const le=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Ee(e){return le.includes(e)}const ce={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function me(e){return e=e.toLowerCase(),ce[e]??e}const de=["touchstart","touchmove"];function fe(e){return de.includes(e)}const _e=["textarea","script","style","title"];function be(e){return _e.includes(e)}function Te(e,t){if(t){const r=document.body;e.autofocus=!0,C(()=>{document.activeElement===r&&e.focus()})}}function ke(e){p&&I(e)!==null&&M(e)}let j=!1;function he(){j||(j=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function q(e){var t=H,r=P;b(null),T(null);try{return e()}finally{b(t),T(r)}}function Le(e,t,r,n=r){e.addEventListener(t,()=>q(r));const o=e.__on_r;o?e.__on_r=()=>{o(),n(!0)}:e.__on_r=()=>n(!0),he()}const x=new Set,R=new Set;function B(e,t,r,n={}){function o(a){if(n.capture||E.call(t,a),!a.cancelBubble)return q(()=>r==null?void 0:r.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?C(()=>{t.addEventListener(e,o,n)}):t.addEventListener(e,o,n),o}function Ae(e,t,r,n={}){var o=B(t,e,r,n);return()=>{e.removeEventListener(t,o,n)}}function Se(e,t,r,n,o){var a={capture:n,passive:o},l=B(e,t,r,a);(t===document.body||t===window||t===document)&&U(()=>{t.removeEventListener(e,l,a)})}function Ne(e){for(var t=0;t<e.length;t++)x.add(e[t]);for(var r of R)r(e)}function E(e){var V;var t=this,r=t.ownerDocument,n=e.type,o=((V=e.composedPath)==null?void 0:V.call(e))||[],a=o[0]||e.target,l=0,v=e.__root;if(v){var f=o.indexOf(v);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var y=o.indexOf(t);if(y===-1)return;f<=y&&(l=f)}if(a=o[l]||e.target,a!==t){G(e,"currentTarget",{configurable:!0,get(){return a||r}});var L=H,c=P;b(null),T(null);try{for(var i,s=[];a!==null;){var d=a.assignedSlot||a.parentNode||a.host||null;try{var _=a["__"+n];if(_!=null&&(!a.disabled||e.target===a))if(Q(_)){var[$,...z]=_;$.apply(a,[e,...z])}else _.call(a,e)}catch(m){i?s.push(m):i=m}if(e.cancelBubble||d===t||d===null)break;a=d}if(i){for(let m of s)queueMicrotask(()=>{throw m});throw i}}finally{e.__root=t,delete e.currentTarget,b(L),T(c)}}}let u;function pe(){u=void 0}function Re(e){let t=null,r=p;var n;if(p){for(t=h,u===void 0&&(u=I(document.head));u!==null&&(u.nodeType!==8||u.data!==Y);)u=S(u);u===null?w(!1):u=k(S(u))}p||(n=document.head.appendChild(W()));try{X(()=>e(n),J)}finally{r&&(w(!0),u=h,k(t))}}let O=!0;function Oe(e){O=e}function De(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r+"")}function ve(e,t){return F(e,t)}function Ie(e,t){N(),t.intro=t.intro??!1;const r=t.target,n=p,o=h;try{for(var a=I(r);a&&(a.nodeType!==8||a.data!==Y);)a=S(a);if(!a)throw A;w(!0),k(a),K();const l=F(e,{...t,anchor:a});if(h===null||h.nodeType!==8||h.data!==Z)throw ee(),A;return w(!1),l}catch(l){if(l===A)return t.recover===!1&&te(),N(),M(r),w(!1),ve(e,t);throw l}finally{w(n),k(o),pe()}}const g=new Map;function F(e,{target:t,anchor:r,props:n={},events:o,context:a,intro:l=!0}){N();var v=new Set,f=c=>{for(var i=0;i<c.length;i++){var s=c[i];if(!v.has(s)){v.add(s);var d=fe(s);t.addEventListener(s,E,{passive:d});var _=g.get(s);_===void 0?(document.addEventListener(s,E,{passive:d}),g.set(s,1)):g.set(s,_+1)}}};f(re(x)),R.add(f);var y=void 0,L=ae(()=>{var c=r??t.appendChild(W());return ne(()=>{if(a){oe({});var i=ie;i.c=a}o&&(n.$$events=o),p&&ue(c,null),O=l,y=e(c,n)||{},O=!0,p&&(P.nodes_end=h),a&&se()}),()=>{var d;for(var i of v){t.removeEventListener(i,E);var s=g.get(i);--s===0?(document.removeEventListener(i,E),g.delete(i)):g.set(i,s)}R.delete(f),c!==r&&((d=c.parentNode)==null||d.removeChild(c))}});return D.set(y,L),y}let D=new WeakMap;function Pe(e,t){const r=D.get(e);return r?(D.delete(e),r(t)):Promise.resolve()}export{Te as a,Ee as b,B as c,Ne as d,he as e,O as f,be as g,Ie as h,we as i,Oe as j,Re as k,Le as l,ve as m,me as n,Ae as o,Se as p,ke as r,De as s,Pe as u,q as w};
