import{D as S,aq as H,a9 as I,ar as J,G as q,f as K,u as W,as as k,q as P,w as d,h as c,a8 as E,b as z,a1 as Q,at as O,a3 as U,v as _,au as g,o as R,s as V,ab as C,av as v,aw as L,ax as X,ay as M,N as $,x as Z,az as ee,n as w,a5 as b,K as te,a4 as se,aA as Y,aB as ie,E as ne,aC as re,aD as ae,aE as he,aF as N,aG as oe,aH as fe,aI as le,aJ as A,a6 as y,aK as ue,aL as _e,S as de,aM as ce,aN as pe,aO as ge,aP as ve,A as ye,aQ as me,aR as Ee,J as be}from"./C9jiJh7I.js";import{g as Te,r as B,h as m,i as Re,j as we}from"./C5_K9giE.js";function Ne(i){let e=0,t=I(0),n;return S&&H(t,"createSubscriber version"),()=>{J()&&(q(t),K(()=>(e===0&&(n=W(()=>i(()=>k(t)))),e+=1,()=>{P(()=>{e-=1,e===0&&(n?.(),n=void 0,k(t))})})))}}var Ae=ne|re|ae;function De(i,e,t){new Se(i,e,t)}class Se{parent;#s=!1;#t;#g=c?d:null;#n;#u;#r;#i=null;#e=null;#a=null;#h=null;#f=null;#_=0;#l=0;#d=!1;#o=null;#m=Ne(()=>(this.#o=I(this.#_),S&&H(this.#o,"$effect.pending()"),()=>{this.#o=null}));constructor(e,t,n){this.#t=e,this.#n=t,this.#u=n,this.parent=E.b,this.#s=!!this.#n.pending,this.#r=z(()=>{if(E.b=this,c){const s=this.#g;Q(),s.nodeType===O&&s.data===U?this.#b():this.#E()}else{var o=this.#v();try{this.#i=_(()=>n(o))}catch(s){this.error(s)}this.#l>0?this.#p():this.#s=!1}return()=>{this.#f?.remove()}},Ae),c&&(this.#t=d)}#E(){try{this.#i=_(()=>this.#u(this.#t))}catch(e){this.error(e)}this.#s=!1}#b(){const e=this.#n.pending;e&&(this.#e=_(()=>e(this.#t)),g.enqueue(()=>{var t=this.#v();this.#i=this.#c(()=>(g.ensure(),_(()=>this.#u(t)))),this.#l>0?this.#p():(R(this.#e,()=>{this.#e=null}),this.#s=!1)}))}#v(){var e=this.#t;return this.#s&&(this.#f=V(),this.#t.before(this.#f),e=this.#f),e}is_pending(){return this.#s||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#n.pending}#c(e){var t=E,n=M,o=$;C(this.#r),v(this.#r),L(this.#r.ctx);try{return e()}catch(s){return X(s),null}finally{C(t),v(n),L(o)}}#p(){const e=this.#n.pending;this.#i!==null&&(this.#h=document.createDocumentFragment(),this.#h.append(this.#f),Z(this.#i,this.#h)),this.#e===null&&(this.#e=_(()=>e(this.#t)))}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#l+=e,this.#l===0&&(this.#s=!1,this.#e&&R(this.#e,()=>{this.#e=null}),this.#h&&(this.#t.before(this.#h),this.#h=null))}update_pending_count(e){this.#y(e),this.#_+=e,this.#o&&ee(this.#o,this.#_)}get_effect_pending(){return this.#m(),q(this.#o)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(this.#d||!t&&!n)throw e;this.#i&&(w(this.#i),this.#i=null),this.#e&&(w(this.#e),this.#e=null),this.#a&&(w(this.#a),this.#a=null),c&&(b(this.#g),te(),b(se()));var o=!1,s=!1;const a=()=>{if(o){he();return}o=!0,s&&ie(),g.ensure(),this.#_=0,this.#a!==null&&R(this.#a,()=>{this.#a=null}),this.#s=this.has_pending_snippet(),this.#i=this.#c(()=>(this.#d=!1,_(()=>this.#u(this.#t)))),this.#l>0?this.#p():this.#s=!1};var f=M;try{v(null),s=!0,t?.(e,a),s=!1}catch(l){Y(l,this.#r&&this.#r.parent)}finally{v(f)}n&&P(()=>{this.#a=this.#c(()=>{g.ensure(),this.#d=!0;try{return _(()=>{n(this.#t,()=>e,()=>a)})}catch(l){return Y(l,this.#r.parent),null}finally{this.#d=!1}})})}}function ke(i,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(i.__t??=i.nodeValue)&&(i.__t=t,i.nodeValue=t+"")}function Oe(i,e){return j(i,e)}function Ce(i,e){N(),e.intro=e.intro??!1;const t=e.target,n=c,o=d;try{for(var s=oe(t);s&&(s.nodeType!==O||s.data!==fe);)s=le(s);if(!s)throw A;y(!0),b(s);const a=j(i,{...e,anchor:s});return y(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(f=>f.startsWith("https://svelte.dev/e/")))throw a;return a!==A&&console.warn("Failed to hydrate: ",a),e.recover===!1&&ue(),N(),_e(t),y(!1),Oe(i,e)}finally{y(n),b(o)}}const p=new Map;function j(i,{target:e,anchor:t,props:n={},events:o,context:s,intro:a=!0}){N();var f=new Set,l=u=>{for(var h=0;h<u.length;h++){var r=u[h];if(!f.has(r)){f.add(r);var x=Re(r);e.addEventListener(r,m,{passive:x});var F=p.get(r);F===void 0?(document.addEventListener(r,m,{passive:x}),p.set(r,1)):p.set(r,F+1)}}};l(ge(Te)),B.add(l);var T=void 0,G=ve(()=>{var u=t??e.appendChild(V());return De(u,{pending:()=>{}},h=>{if(s){ye({});var r=$;r.c=s}if(o&&(n.$$events=o),c&&we(h,null),T=i(h,n)||{},c&&(E.nodes_end=d,d===null||d.nodeType!==O||d.data!==me))throw Ee(),A;s&&be()}),()=>{for(var h of f){e.removeEventListener(h,m);var r=p.get(h);--r===0?(document.removeEventListener(h,m),p.delete(h)):p.set(h,r)}B.delete(l),u!==t&&u.parentNode?.removeChild(u)}});return D.set(T,G),T}let D=new WeakMap;function Le(i,e){const t=D.get(i);return t?(D.delete(i),t(e)):(S&&(de in i?ce():pe()),Promise.resolve())}export{Ne as c,Ce as h,Oe as m,ke as s,Le as u};
