import{ay as te,g as G,ah as re,R as J,ag as se,Z as m,az as W,j as p,h as g,an as b,aA as j,b as ie,a as ne,B as ae,aB as z,I as u,A as U,X as C,G as _,a1 as fe,aC as he,aD as D,aE as N,aF as $,aG as oe,aH as le,aI as X,am as K,F as ce,a2 as x,e as O,aj as de,c as ue,aJ as R,E as _e,aK as pe,aL as ge,aM as ve,d as ye,aN as me,aO as be,aP as L,z as Ee,C as Q,H as Te,a3 as we,aQ as M,i as S,aR as ke,a0 as Re,aS as Se,P as Ae,p as De,D as Ne,aT as Oe,o as Fe,aU as q}from"./QoSX5tB3.js";import{d as Ce}from"./DNDc8P0N.js";function xe(r){let e=0,t=J(0),n;return()=>{te()&&(G(t),re(()=>(e===0&&(n=se(()=>r(()=>W(t)))),e+=1,()=>{m(()=>{e-=1,e===0&&(n?.(),n=void 0,W(t))})})))}}var He=_e|pe;function Ie(r,e,t,n){new Le(r,e,t,n)}class Le{parent;is_pending=!1;transform_error;#r;#_=g?p:null;#i;#o;#t;#n=null;#e=null;#s=null;#a=null;#l=0;#h=0;#c=!1;#p=new Set;#g=new Set;#f=null;#E=xe(()=>(this.#f=J(this.#l),()=>{this.#f=null}));constructor(e,t,n,i){this.#r=e,this.#i=t,this.#o=s=>{var a=b;a.b=this,a.f|=j,n(s)},this.parent=b.b,this.transform_error=i??this.parent?.transform_error??(s=>s),this.#t=ie(()=>{if(g){const s=this.#_;ne();const a=s.data===ae;if(s.data.startsWith(z)){const c=JSON.parse(s.data.slice(z.length));this.#w(c)}else a?this.#k():this.#T()}else this.#y()},He),g&&(this.#r=p)}#T(){try{this.#n=u(()=>this.#o(this.#r))}catch(e){this.error(e)}}#w(e){const t=this.#i.failed,{reset:n,invoke_onerror:i}=this.#v(e);m(i),t&&(this.#s=u(()=>{t(this.#r,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;const i=()=>{if(t){ge();return}t=!0,n&&ve(),this.#s!==null&&C(this.#s,()=>{this.#s=null}),this.#u(()=>{this.#y()})};return{reset:i,invoke_onerror:()=>{try{n=!0,this.#i.onerror?.(e,i),n=!1}catch(a){R(a,this.#t&&this.#t.parent)}}}}#k(){const e=this.#i.pending;e&&(this.is_pending=!0,this.#e=u(()=>e(this.#r)),m(()=>{var t=this.#a=document.createDocumentFragment(),n=U();t.append(n),this.#n=this.#u(()=>u(()=>this.#o(n))),this.#h===0&&(this.#r.before(t),this.#a=null,C(this.#e,()=>{this.#e=null}),this.#d(_))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#h=0,this.#l=0,this.#n=u(()=>{this.#o(this.#r)}),this.#h>0){var e=this.#a=document.createDocumentFragment();fe(this.#n,e);const t=this.#i.pending;this.#e=u(()=>t(this.#r))}else this.#d(_)}catch(t){this.error(t)}}#d(e){this.is_pending=!1,e.transfer_effects(this.#p,this.#g)}defer_effect(e){he(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 t=b,n=X,i=K;D(this.#t),N(this.#t),$(this.#t.ctx);try{return oe.ensure(),e()}catch(s){return le(s),null}finally{D(t),N(n),$(i)}}#m(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#m(e,t);return}this.#h+=e,this.#h===0&&(this.#d(t),this.#e&&C(this.#e,()=>{this.#e=null}),this.#a&&(this.#r.before(this.#a),this.#a=null))}update_pending_count(e,t){this.#m(e,t),this.#l+=e,!(!this.#f||this.#c)&&(this.#c=!0,m(()=>{this.#c=!1,this.#f&&ce(this.#f,this.#l)}))}get_effect_pending(){return this.#E(),G(this.#f)}error(e){if(!this.#i.onerror&&!this.#i.failed)throw e;_?.is_fork?(this.#n&&_.skip_effect(this.#n),this.#e&&_.skip_effect(this.#e),this.#s&&_.skip_effect(this.#s),_.oncommit(()=>{this.#b(e)})):this.#b(e)}#b(e){this.#n&&(x(this.#n),this.#n=null),this.#e&&(x(this.#e),this.#e=null),this.#s&&(x(this.#s),this.#s=null),g&&(O(this.#_),de(),O(ue()));let t=this.#i.failed;const n=i=>{const{reset:s,invoke_onerror:a}=this.#v(i);a(),t&&(this.#s=this.#u(()=>{try{return u(()=>{var l=b;l.b=this,l.f|=j,t(this.#r,()=>i,()=>s)})}catch(l){return R(l,this.#t.parent),null}}))};m(()=>{var i;try{i=this.transform_error(e)}catch(s){R(s,this.#t&&this.#t.parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(n,s=>R(s,this.#t&&this.#t.parent)):n(i)})}}const w=Symbol("events"),Z=new Set,B=new Set;function Me(r,e,t,n={}){function i(s){if(n.capture||P.call(e,s),!s.cancelBubble)return be(()=>t?.call(this,s))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?m(()=>{e.addEventListener(r,i,n)}):e.addEventListener(r,i,n),i}function je(r,e,t,n,i){var s={capture:n,passive:i},a=Me(r,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&me(()=>{e.removeEventListener(r,a,s)})}function ze(r,e,t){(e[w]??={})[r]=t}function $e(r){for(var e=0;e{I=!1,H=null}));var a=0,l=H===r&&r[w];if(l){var c=i.indexOf(l);if(c!==-1&&(e===document||e===window)){r[w]=e;return}var k=i.indexOf(e);if(k===-1)return;c<=k&&(a=c)}if(s=i[a]||r.target,s!==e){ye(r,"currentTarget",{configurable:!0,get(){return s||t}});var v=X,E=b;N(null),D(null);try{for(var d,h=[];s!==null&&s!==e;){try{var o=s[w]?.[n];o!=null&&(!s.disabled||r.target===s)&&o.call(s,r)}catch(f){d?h.push(f):d=f}if(r.cancelBubble)break;a++,s=a{throw f});throw d}}finally{r[w]=e,delete r.currentTarget,N(v),D(E)}}}const Be=["touchstart","touchmove"];function Pe(r){return Be.includes(r)}function qe(r,e){var t=e==null?"":typeof e=="object"?`${e}`:e;t!==(r[q]??=r.nodeValue)&&(r[q]=t,r.nodeValue=`${t}`)}function Ye(r,e){return ee(r,e)}function Ge(r,e){L(),e.intro=e.intro??!1;const t=e.target,n=g,i=p;try{for(var s=Ee(t);s&&(s.nodeType!==Q||s.data!==Te);)s=we(s);if(!s)throw M;S(!0),O(s);const a=ee(r,{...e,anchor:s});return S(!1),a}catch(a){if(a instanceof Error&&a.message.split(` `).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==M&&console.warn("Failed to hydrate: ",a),e.recover===!1&&ke(),L(),Re(t),S(!1),Ye(r,e)}finally{S(n),O(i)}}const A=new Map;function ee(r,{target:e,anchor:t,props:n={},events:i,context:s,intro:a=!0,transformError:l}){L();var c=void 0,k=Se(()=>{var v=t??e.appendChild(U());Ie(v,{pending:()=>{}},h=>{De({});var o=K;if(s&&(o.c=s),i&&(n.$$events=i),g&&Ce(h,null),c=r(h,n)||{},g&&(b.nodes.end=p,p===null||p.nodeType!==Q||p.data!==Ne))throw Oe(),M;Fe()},l);var E=new Set,d=h=>{for(var o=0;o{for(var h of E)for(const T of[e,document]){var o=A.get(T),f=o.get(h);--f==0?(T.removeEventListener(h,P),o.delete(h),o.size===0&&A.delete(T)):o.set(h,f)}B.delete(d),v!==t&&v.parentNode?.removeChild(v)}});return Y.set(c,k),c}let Y=new WeakMap;function Je(r,e){const t=Y.get(r);return t?(Y.delete(r),t(e)):Promise.resolve()}export{ze as a,$e as d,je as e,Ge as h,Ye as m,qe as s,Je as u};