import{aQ as K,g as j,E as ee,o as te,aR as H,Q as T,aw as z,a4 as g,F as v,l as m,aS as V,Y as re,Z as se,ao as ie,aT as W,a9 as p,a8 as Q,a7 as k,B as P,aa as ne,aU as ae,aV as A,aW as D,aX as $,aY as fe,aZ as he,a_ as U,an as Z,aq as oe,a6 as x,a2 as O,n as le,a1 as de,a$ as S,_ as ce,aE as ue,b0 as _e,b1 as pe,M as ge,G as ve,b2 as ye,b3 as M,ac as be,ae as G,b4 as me,af as Ee,ah as L,a3 as R,b5 as we,aA as Te,b6 as Se,at as Re,d as Ne,ap as Ae,ag as De,h as Oe}from"./Cjw4vZKn.js";import{b as Fe}from"./Bkzsmr9I.js";function ke(t){let e=0,r=z(0),i;return()=>{K()&&(j(r),ee(()=>(e===0&&(i=te(()=>t(()=>H(r)))),e+=1,()=>{T(()=>{e-=1,e===0&&(i?.(),i=void 0,H(r))})})))}}var xe=ce|ue;function Me(t,e,r,i){new Le(t,e,r,i)}class Le{parent;is_pending=!1;transform_error;#t;#_=v?g:null;#i;#o;#e;#n=null;#r=null;#s=null;#a=null;#l=0;#h=0;#d=!1;#p=new Set;#g=new Set;#f=null;#b=ke(()=>(this.#f=z(this.#l),()=>{this.#f=null}));constructor(e,r,i,n){this.#t=e,this.#i=r,this.#o=s=>{var a=m;a.b=this,a.f|=V,i(s)},this.parent=m.b,this.transform_error=n??this.parent?.transform_error??(s=>s),this.#e=re(()=>{if(v){const s=this.#_;se();const a=s.data===ie;if(s.data.startsWith(W)){const f=JSON.parse(s.data.slice(W.length));this.#E(f)}else a?this.#w():this.#m()}else this.#v()},xe),v&&(this.#t=g)}#m(){try{this.#n=p(()=>this.#o(this.#t))}catch(e){this.error(e)}}#E(e){const r=this.#i.failed;r&&(this.#s=p(()=>{r(this.#t,()=>e,()=>()=>{})}))}#w(){const e=this.#i.pending;e&&(this.is_pending=!0,this.#r=p(()=>e(this.#t)),T(()=>{var r=this.#a=document.createDocumentFragment(),i=Q();r.append(i),this.#n=this.#u(()=>p(()=>this.#o(i))),this.#h===0&&(this.#t.before(r),this.#a=null,k(this.#r,()=>{this.#r=null}),this.#c(P))}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#h=0,this.#l=0,this.#n=p(()=>{this.#o(this.#t)}),this.#h>0){var e=this.#a=document.createDocumentFragment();ne(this.#n,e);const r=this.#i.pending;this.#r=p(()=>r(this.#t))}else this.#c(P)}catch(r){this.error(r)}}#c(e){this.is_pending=!1,e.transfer_effects(this.#p,this.#g)}defer_effect(e){ae(e,this.#p,this.#g)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#i.pending}#u(e){var r=m,i=U,n=Z;A(this.#e),D(this.#e),$(this.#e.ctx);try{return fe.ensure(),e()}catch(s){return he(s),null}finally{A(r),D(i),$(n)}}#y(e,r){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e,r);return}this.#h+=e,this.#h===0&&(this.#c(r),this.#r&&k(this.#r,()=>{this.#r=null}),this.#a&&(this.#t.before(this.#a),this.#a=null))}update_pending_count(e,r){this.#y(e,r),this.#l+=e,!(!this.#f||this.#d)&&(this.#d=!0,T(()=>{this.#d=!1,this.#f&&oe(this.#f,this.#l)}))}get_effect_pending(){return this.#b(),j(this.#f)}error(e){var r=this.#i.onerror;let i=this.#i.failed;if(!r&&!i)throw e;this.#n&&(x(this.#n),this.#n=null),this.#r&&(x(this.#r),this.#r=null),this.#s&&(x(this.#s),this.#s=null),v&&(O(this.#_),le(),O(de()));var n=!1,s=!1;const a=()=>{if(n){pe();return}n=!0,s&&_e(),this.#s!==null&&k(this.#s,()=>{this.#s=null}),this.#u(()=>{this.#v()})},c=f=>{try{s=!0,r?.(f,a),s=!1}catch(h){S(h,this.#e&&this.#e.parent)}i&&(this.#s=this.#u(()=>{try{return p(()=>{var h=m;h.b=this,h.f|=V,i(this.#t,()=>f,()=>a)})}catch(h){return S(h,this.#e.parent),null}}))};T(()=>{var f;try{f=this.transform_error(e)}catch(h){S(h,this.#e&&this.#e.parent);return}f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(c,h=>S(h,this.#e&&this.#e.parent)):c(f)})}}const Ye=["touchstart","touchmove"];function Ie(t){return Ye.includes(t)}const w=Symbol("events"),J=new Set,Y=new Set;function Be(t,e,r,i={}){function n(s){if(i.capture||I.call(e,s),!s.cancelBubble)return ye(()=>r?.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?T(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function We(t,e,r,i,n){var s={capture:i,passive:n},a=Be(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ve(()=>{e.removeEventListener(t,a,s)})}function Pe(t,e,r){(e[w]??={})[t]=r}function $e(t){for(var e=0;e{throw u});throw _}}finally{t[w]=e,delete t.currentTarget,D(y),A(E)}}}function qe(t,e){var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t.__t??=t.nodeValue)&&(t.__t=r,t.nodeValue=`${r}`)}function Ce(t,e){return X(t,e)}function je(t,e){M(),e.intro=e.intro??!1;const r=e.target,i=v,n=g;try{for(var s=be(r);s&&(s.nodeType!==G||s.data!==me);)s=Ee(s);if(!s)throw L;R(!0),O(s);const a=X(t,{...e,anchor:s});return R(!1),a}catch(a){if(a instanceof Error&&a.message.split(` `).some(c=>c.startsWith("https://svelte.dev/e/")))throw a;return a!==L&&console.warn("Failed to hydrate: ",a),e.recover===!1&&we(),M(),Te(r),R(!1),Ce(t,e)}finally{R(i),O(n)}}const N=new Map;function X(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:c}){M();var f=void 0,h=Se(()=>{var y=r??e.appendChild(Q());Me(y,{pending:()=>{}},l=>{Ne({});var o=Z;if(s&&(o.c=s),n&&(i.$$events=n),v&&Fe(l,null),f=t(l,i)||{},v&&(m.nodes.end=g,g===null||g.nodeType!==G||g.data!==Ae))throw De(),L;Oe()},c);var E=new Set,_=l=>{for(var o=0;o{for(var l of E)for(const u of[e,document]){var o=N.get(u),d=o.get(l);--d==0?(u.removeEventListener(l,I),o.delete(l),o.size===0&&N.delete(u)):o.set(l,d)}Y.delete(_),y!==r&&y.parentNode?.removeChild(y)}});return B.set(f,h),f}let B=new WeakMap;function ze(t,e){const r=B.get(t);return r?(B.delete(t),r(e)):Promise.resolve()}export{Pe as a,$e as d,We as e,je as h,Ce as m,qe as s,ze as u};