@claude-sessions/web 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/build/client/_app/immutable/assets/0.DYXbBCWs.css +1 -0
- package/build/client/_app/immutable/assets/0.DYXbBCWs.css.br +0 -0
- package/build/client/_app/immutable/assets/0.DYXbBCWs.css.gz +0 -0
- package/build/client/_app/immutable/chunks/{CzuOkoRV.js → BdX-57is.js} +1 -1
- package/build/client/_app/immutable/chunks/BdX-57is.js.br +0 -0
- package/build/client/_app/immutable/chunks/BdX-57is.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BsiXkKmR.js +1 -0
- package/build/client/_app/immutable/chunks/BsiXkKmR.js.br +0 -0
- package/build/client/_app/immutable/chunks/BsiXkKmR.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C68Ru4Jq.js +90 -0
- package/build/client/_app/immutable/chunks/C68Ru4Jq.js.br +0 -0
- package/build/client/_app/immutable/chunks/C68Ru4Jq.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{HouQR_BO.js → HaThayHP.js} +1 -1
- package/build/client/_app/immutable/chunks/HaThayHP.js.br +0 -0
- package/build/client/_app/immutable/chunks/HaThayHP.js.gz +0 -0
- package/build/client/_app/immutable/chunks/fuY-CvTV.js +1 -0
- package/build/client/_app/immutable/chunks/fuY-CvTV.js.br +0 -0
- package/build/client/_app/immutable/chunks/fuY-CvTV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/nUq5tIUU.js +2 -0
- package/build/client/_app/immutable/chunks/nUq5tIUU.js.br +0 -0
- package/build/client/_app/immutable/chunks/nUq5tIUU.js.gz +0 -0
- package/build/client/_app/immutable/chunks/pOdkXMWy.js +1 -0
- package/build/client/_app/immutable/chunks/pOdkXMWy.js.br +0 -0
- package/build/client/_app/immutable/chunks/pOdkXMWy.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.qHc_uqht.js +2 -0
- package/build/client/_app/immutable/entry/app.qHc_uqht.js.br +0 -0
- package/build/client/_app/immutable/entry/app.qHc_uqht.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.CMr0TC12.js +1 -0
- package/build/client/_app/immutable/entry/start.CMr0TC12.js.br +2 -0
- package/build/client/_app/immutable/entry/start.CMr0TC12.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js +1 -0
- package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.BJ_w-1Nt.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1._FRxD68P.js +1 -0
- package/build/client/_app/immutable/nodes/1._FRxD68P.js.br +0 -0
- package/build/client/_app/immutable/nodes/1._FRxD68P.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.MZuWFdHT.js +4 -0
- package/build/client/_app/immutable/nodes/2.MZuWFdHT.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.MZuWFdHT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.B_st5yrl.js +4 -0
- package/build/client/_app/immutable/nodes/3.B_st5yrl.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.B_st5yrl.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/chunks/0-48UfwAoW.js +17 -0
- package/build/server/chunks/0-48UfwAoW.js.map +1 -0
- package/build/server/chunks/1-iKu9xlG-.js +9 -0
- package/build/server/chunks/{1-NzhdkXbT.js.map → 1-iKu9xlG-.js.map} +1 -1
- package/build/server/chunks/2-BnOskmnU.js +9 -0
- package/build/server/chunks/2-BnOskmnU.js.map +1 -0
- package/build/server/chunks/3-CxYJayeh.js +9 -0
- package/build/server/chunks/3-CxYJayeh.js.map +1 -0
- package/build/server/chunks/InputModal-XaplAR5y.js +36 -0
- package/build/server/chunks/InputModal-XaplAR5y.js.map +1 -0
- package/build/server/chunks/Toast-DctHqvip.js +80 -0
- package/build/server/chunks/Toast-DctHqvip.js.map +1 -0
- package/build/server/chunks/_layout.svelte-gA6iNIQM.js +105 -0
- package/build/server/chunks/_layout.svelte-gA6iNIQM.js.map +1 -0
- package/build/server/chunks/_page.svelte-CTdF2hwa.js +96 -0
- package/build/server/chunks/_page.svelte-CTdF2hwa.js.map +1 -0
- package/build/server/chunks/{_page.svelte-Bgd-L7N_.js → _page.svelte-g3nbsvo6.js} +612 -463
- package/build/server/chunks/_page.svelte-g3nbsvo6.js.map +1 -0
- package/build/server/chunks/{_server.ts-DZQssvoI.js → _server.ts-CDkvpI_I.js} +2 -2
- package/build/server/chunks/{_server.ts-DZQssvoI.js.map → _server.ts-CDkvpI_I.js.map} +1 -1
- package/build/server/chunks/{error.svelte-DNhMU_b6.js → error.svelte-C43AeaaJ.js} +4 -4
- package/build/server/chunks/{error.svelte-DNhMU_b6.js.map → error.svelte-C43AeaaJ.js.map} +1 -1
- package/build/server/chunks/{exports-CgQJUv15.js → exports-BXvEiaiv.js} +6 -6
- package/build/server/chunks/exports-BXvEiaiv.js.map +1 -0
- package/build/server/chunks/index-CoD1IJuy.js.map +1 -1
- package/build/server/chunks/{index-CMS8WiSi.js → index-DzYX9r1_.js} +4 -4
- package/build/server/chunks/index-DzYX9r1_.js.map +1 -0
- package/build/server/chunks/{index2-gtN4acH3.js → index2-Da0doXJY.js} +2 -2
- package/build/server/chunks/{index2-gtN4acH3.js.map → index2-Da0doXJY.js.map} +1 -1
- package/build/server/chunks/{index4-Cm9gf6zG.js → index4-BUZEWk-I.js} +3 -3
- package/build/server/chunks/{index4-Cm9gf6zG.js.map → index4-BUZEWk-I.js.map} +1 -1
- package/build/server/index.js +5 -11
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +6 -6
- package/build/server/manifest.js.map +1 -1
- package/package.json +24 -11
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css +0 -1
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.br +0 -0
- package/build/client/_app/immutable/assets/0.B2yA_bPQ.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bapp9IYO.js +0 -1
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bapp9IYO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js +0 -1
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.br +0 -0
- package/build/client/_app/immutable/chunks/BzTxzCCu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js +0 -1
- package/build/client/_app/immutable/chunks/CUTXPORg.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUTXPORg.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.br +0 -0
- package/build/client/_app/immutable/chunks/CzuOkoRV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js +0 -1
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.br +0 -0
- package/build/client/_app/immutable/chunks/DHCLGQT_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js +0 -66
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.br +0 -0
- package/build/client/_app/immutable/chunks/DUNnSDh5.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js +0 -2
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.br +0 -0
- package/build/client/_app/immutable/chunks/Di6YbRZt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/HouQR_BO.js.br +0 -0
- package/build/client/_app/immutable/chunks/HouQR_BO.js.gz +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js +0 -25
- package/build/client/_app/immutable/chunks/IVrlObbe.js.br +0 -0
- package/build/client/_app/immutable/chunks/IVrlObbe.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js +0 -2
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Dj3HhwA8.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js +0 -1
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.br +0 -2
- package/build/client/_app/immutable/entry/start.DhjCZi9N.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js +0 -1
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CAbelkQT.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js +0 -1
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.DYaH4O8k.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js +0 -5
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.VvV6w9cZ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js +0 -4
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.D_uYLiIh.js.gz +0 -0
- package/build/server/chunks/0-CWHakFRJ.js +0 -17
- package/build/server/chunks/0-CWHakFRJ.js.map +0 -1
- package/build/server/chunks/1-NzhdkXbT.js +0 -9
- package/build/server/chunks/2-DrysGJ9C.js +0 -9
- package/build/server/chunks/2-DrysGJ9C.js.map +0 -1
- package/build/server/chunks/3-D4BIPCPc.js +0 -9
- package/build/server/chunks/3-D4BIPCPc.js.map +0 -1
- package/build/server/chunks/Toast-CTZhGpnd.js +0 -45
- package/build/server/chunks/Toast-CTZhGpnd.js.map +0 -1
- package/build/server/chunks/_layout.svelte-D9DyGgZM.js +0 -61
- package/build/server/chunks/_layout.svelte-D9DyGgZM.js.map +0 -1
- package/build/server/chunks/_page.svelte-Bgd-L7N_.js.map +0 -1
- package/build/server/chunks/_page.svelte-C7sseaTW.js +0 -56
- package/build/server/chunks/_page.svelte-C7sseaTW.js.map +0 -1
- package/build/server/chunks/config-DKyxRWWg.js +0 -20
- package/build/server/chunks/config-DKyxRWWg.js.map +0 -1
- package/build/server/chunks/exports-CgQJUv15.js.map +0 -1
- package/build/server/chunks/index-CMS8WiSi.js.map +0 -1
- package/readme.md +0 -47
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var th=Object.defineProperty;var $c=e=>{throw TypeError(e)};var nh=(e,t,n)=>t in e?th(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var u=(e,t,n)=>nh(e,typeof t!="symbol"?t+"":t,n),Cc=(e,t,n)=>t.has(e)||$c("Cannot "+n);var Rc=(e,t,n)=>(Cc(e,t,"read from private field"),n?n.call(e):t.get(e)),Tc=(e,t,n)=>t.has(e)?$c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mc=(e,t,n,r)=>(Cc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{i as ds,j as Pa,q as gs,k as ue,l as rh,E as sh,g as Ts,a7 as ih,G as ch,I as oh,J as Nc,n as un,v as Gn,C as ah,aL as uh,ar as Fc,w as lh,aY as Pe,A as pn,D as fh,aj as Ac,_ as hh,aJ as yi,aN as ja,aZ as dh,a_ as gh,a$ as ph,x as La,z as xa,b0 as ps,m as mh,aI as _h,y as fr,b1 as Da,V as Ua,b2 as bh,F as yh,b3 as qa,T as Ba,b4 as Sh,b5 as vh,X as kh,b6 as wh,b7 as Ih,b8 as Eh,aO as Oh,b9 as $h,ba as Ch,bb as Rh,bc as Th,aV as Mh,bd as Nh,be as Fh,a1 as Ah}from"./CUTXPORg.js";import{B as Ph}from"./Bapp9IYO.js";import{i as jh,b as Lh,d as xh,n as Dh,g as Uh}from"./Di6YbRZt.js";function aw(e,t){return t}function qh(e,t,n){for(var r=[],s=t.length,i,c=t.length,o=0;o<s;o++){let d=t[o];xa(d,()=>{if(i){if(i.pending.delete(d),i.done.add(d),i.pending.size===0){var g=e.outrogroups;Ms(yi(i.done)),g.delete(i),g.size===0&&(e.outrogroups=null)}}else c-=1},!1)}if(c===0){var a=r.length===0&&n!==null;if(a){var l=n,h=l.parentNode;_h(h),h.append(l),e.items.clear()}Ms(t,!a)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function Ms(e,t=!0){for(var n=0;n<e.length;n++)fr(e[n],t)}var Pc;function uw(e,t,n,r,s,i=null){var c=e,o=new Map,a=(t&Da)!==0;if(a){var l=e;c=ue?gs(rh(l)):l.appendChild(ds())}ue&&sh();var h=null,d=ih(()=>{var y=n();return ja(y)?y:y==null?[]:yi(y)}),g,m=!0;function _(){b.fallback=h,Bh(b,g,c,t,r),h!==null&&(g.length===0?(h.f&Pe)===0?La(h):(h.f^=Pe,on(h,null,c)):xa(h,()=>{h=null}))}var v=Pa(()=>{g=Ts(d);var y=g.length;let x=!1;if(ue){var G=ch(c)===oh;G!==(y===0)&&(c=Nc(),gs(c),un(!1),x=!0)}for(var T=new Set,re=lh,E=fh(),O=0;O<y;O+=1){ue&&Gn.nodeType===ah&&Gn.data===uh&&(c=Gn,x=!0,un(!1));var k=g[O],D=r(k,O),M=m?null:o.get(D);M?(M.v&&Fc(M.v,k),M.i&&Fc(M.i,O),E&&re.skipped_effects.delete(M.e)):(M=Vh(o,m?c:Pc??(Pc=ds()),k,D,O,s,t,n),m||(M.e.f|=Pe),o.set(D,M)),T.add(D)}if(y===0&&i&&!h&&(m?h=pn(()=>i(c)):(h=pn(()=>i(Pc??(Pc=ds()))),h.f|=Pe)),ue&&y>0&&gs(Nc()),!m)if(E){for(const[B,se]of o)T.has(B)||re.skipped_effects.add(se.e);re.oncommit(_),re.ondiscard(()=>{})}else _();x&&un(!0),Ts(d)}),b={effect:v,items:o,outrogroups:null,fallback:h};m=!1,ue&&(c=Gn)}function Bh(e,t,n,r,s){var M,B,se,ze,$e,We,he,ie,Be;var i=(r&bh)!==0,c=t.length,o=e.items,a=e.effect.first,l,h=null,d,g=[],m=[],_,v,b,y;if(i)for(y=0;y<c;y+=1)_=t[y],v=s(_,y),b=o.get(v).e,(b.f&Pe)===0&&((B=(M=b.nodes)==null?void 0:M.a)==null||B.measure(),(d??(d=new Set)).add(b));for(y=0;y<c;y+=1){if(_=t[y],v=s(_,y),b=o.get(v).e,e.outrogroups!==null)for(const me of e.outrogroups)me.pending.delete(b),me.done.delete(b);if((b.f&Pe)!==0)if(b.f^=Pe,b===a)on(b,null,n);else{var x=h?h.next:a;b===e.effect.last&&(e.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),Ve(e,h,b),Ve(e,b,x),on(b,x,n),h=b,g=[],m=[],a=h.next;continue}if((b.f&ps)!==0&&(La(b),i&&((ze=(se=b.nodes)==null?void 0:se.a)==null||ze.unfix(),(d??(d=new Set)).delete(b))),b!==a){if(l!==void 0&&l.has(b)){if(g.length<m.length){var G=m[0],T;h=G.prev;var re=g[0],E=g[g.length-1];for(T=0;T<g.length;T+=1)on(g[T],G,n);for(T=0;T<m.length;T+=1)l.delete(m[T]);Ve(e,re.prev,E.next),Ve(e,h,re),Ve(e,E,G),a=G,h=E,y-=1,g=[],m=[]}else l.delete(b),on(b,a,n),Ve(e,b.prev,b.next),Ve(e,b,h===null?e.effect.first:h.next),Ve(e,h,b),h=b;continue}for(g=[],m=[];a!==null&&a!==b;)(l??(l=new Set)).add(a),m.push(a),a=a.next;if(a===null)continue}(b.f&Pe)===0&&g.push(b),h=b,a=b.next}if(e.outrogroups!==null){for(const me of e.outrogroups)me.pending.size===0&&(Ms(yi(me.done)),($e=e.outrogroups)==null||$e.delete(me));e.outrogroups.size===0&&(e.outrogroups=null)}if(a!==null||l!==void 0){var O=[];if(l!==void 0)for(b of l)(b.f&ps)===0&&O.push(b);for(;a!==null;)(a.f&ps)===0&&a!==e.fallback&&O.push(a),a=a.next;var k=O.length;if(k>0){var D=(r&Da)!==0&&c===0?n:null;if(i){for(y=0;y<k;y+=1)(he=(We=O[y].nodes)==null?void 0:We.a)==null||he.measure();for(y=0;y<k;y+=1)(Be=(ie=O[y].nodes)==null?void 0:ie.a)==null||Be.fix()}qh(e,O,D)}}i&&Ua(()=>{var me,Jn;if(d!==void 0)for(b of d)(Jn=(me=b.nodes)==null?void 0:me.a)==null||Jn.apply()})}function Vh(e,t,n,r,s,i,c,o){var a=(c&dh)!==0?(c&gh)===0?hh(n,!1,!1):Ac(n):null,l=(c&ph)!==0?Ac(s):null;return{v:a,i:l,e:pn(()=>(i(t,a??n,l??s,o),()=>{e.delete(r)}))}}function on(e,t,n){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end,i=t&&(t.f&Pe)===0?t.nodes.start:n;r!==null;){var c=mh(r);if(i.before(r),r===s)return;r=c}}function Ve(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function lw(e,t,...n){var r=new Ph(e);Pa(()=>{const s=t()??null;r.ensure(s,s&&(i=>s(i,...n)))},yh)}function Kh(e,t){var n=void 0,r;qa(()=>{n!==(n=t())&&(r&&(fr(r),r=null),n&&(r=pn(()=>{Ba(()=>n(e))})))})}function Va(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Va(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Hh(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Va(e))&&(r&&(r+=" "),r+=t);return r}function Jh(e){return typeof e=="object"?Hh(e):e??""}const jc=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function Gh(e,t,n){var r=e==null?"":""+e;if(t&&(r=r?r+" "+t:t),n){for(var s in n)if(n[s])r=r?r+" "+s:s;else if(r.length)for(var i=s.length,c=0;(c=r.indexOf(s,c))>=0;){var o=c+i;(c===0||jc.includes(r[c-1]))&&(o===r.length||jc.includes(r[o]))?r=(c===0?"":r.substring(0,c))+r.substring(o+1):c=o}}return r===""?null:r}function Lc(e,t=!1){var n=t?" !important;":";",r="";for(var s in e){var i=e[s];i!=null&&i!==""&&(r+=" "+s+": "+i+n)}return r}function ms(e){return e[0]!=="-"||e[1]!=="-"?e.toLowerCase():e}function zh(e,t){if(t){var n="",r,s;if(Array.isArray(t)?(r=t[0],s=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var i=!1,c=0,o=!1,a=[];r&&a.push(...Object.keys(r).map(ms)),s&&a.push(...Object.keys(s).map(ms));var l=0,h=-1;const v=e.length;for(var d=0;d<v;d++){var g=e[d];if(o?g==="/"&&e[d-1]==="*"&&(o=!1):i?i===g&&(i=!1):g==="/"&&e[d+1]==="*"?o=!0:g==='"'||g==="'"?i=g:g==="("?c++:g===")"&&c--,!o&&i===!1&&c===0){if(g===":"&&h===-1)h=d;else if(g===";"||d===v-1){if(h!==-1){var m=ms(e.substring(l,h).trim());if(!a.includes(m)){g!==";"&&d++;var _=e.substring(l,d).trim();n+=" "+_+";"}}l=d+1,h=-1}}}}return r&&(n+=Lc(r)),s&&(n+=Lc(s,!0)),n=n.trim(),n===""?null:n}return e==null?null:String(e)}function Wh(e,t,n,r,s,i){var c=e.__className;if(ue||c!==n||c===void 0){var o=Gh(n,r,i);(!ue||o!==e.getAttribute("class"))&&(o==null?e.removeAttribute("class"):t?e.className=o:e.setAttribute("class",o)),e.__className=n}else if(i&&s!==i)for(var a in i){var l=!!i[a];(s==null||l!==!!s[a])&&e.classList.toggle(a,l)}return i}function _s(e,t={},n,r){for(var s in n){var i=n[s];t[s]!==i&&(n[s]==null?e.style.removeProperty(s):e.style.setProperty(s,i,r))}}function Yh(e,t,n,r){var s=e.__style;if(ue||s!==t){var i=zh(t,r);(!ue||i!==e.getAttribute("style"))&&(i==null?e.removeAttribute("style"):e.style.cssText=i),e.__style=t}else r&&(Array.isArray(r)?(_s(e,n==null?void 0:n[0],r[0]),_s(e,n==null?void 0:n[1],r[1],"important")):_s(e,n,r));return r}function Ns(e,t,n=!1){if(e.multiple){if(t==null)return;if(!ja(t))return Sh();for(var r of e.options)r.selected=t.includes(xc(r));return}for(r of e.options){var s=xc(r);if(vh(s,t)){r.selected=!0;return}}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Qh(e){var t=new MutationObserver(()=>{Ns(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),kh(()=>{t.disconnect()})}function xc(e){return"__value"in e?e.__value:e.value}const zn=Symbol("class"),Zt=Symbol("style"),Ka=Symbol("is custom element"),Ha=Symbol("is html");function Xh(e){if(ue){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var r=e.value;hr(e,"value",null),e.value=r}if(e.hasAttribute("checked")){var s=e.checked;hr(e,"checked",null),e.checked=s}}};e.__on_r=n,Ua(n),wh()}}function fw(e,t){var n=Si(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!=="PROGRESS")||(e.value=t??"")}function Zh(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function hr(e,t,n,r){var s=Si(e);ue&&(s[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||s[t]!==(s[t]=n)&&(t==="loading"&&(e[Ih]=n),n==null?e.removeAttribute(t):typeof n!="string"&&Ja(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function ed(e,t,n,r,s=!1,i=!1){if(ue&&s&&e.tagName==="INPUT"){var c=e,o=c.type==="checkbox"?"defaultChecked":"defaultValue";o in n||Xh(c)}var a=Si(e),l=a[Ka],h=!a[Ha];let d=ue&&l;d&&un(!1);var g=t||{},m=e.tagName==="OPTION";for(var _ in t)_ in n||(n[_]=null);n.class?n.class=Jh(n.class):n.class=null,n[Zt]&&(n.style??(n.style=null));var v=Ja(e);for(const E in n){let O=n[E];if(m&&E==="value"&&O==null){e.value=e.__value="",g[E]=O;continue}if(E==="class"){var b=e.namespaceURI==="http://www.w3.org/1999/xhtml";Wh(e,b,O,r,t==null?void 0:t[zn],n[zn]),g[E]=O,g[zn]=n[zn];continue}if(E==="style"){Yh(e,O,t==null?void 0:t[Zt],n[Zt]),g[E]=O,g[Zt]=n[Zt];continue}var y=g[E];if(!(O===y&&!(O===void 0&&e.hasAttribute(E)))){g[E]=O;var x=E[0]+E[1];if(x!=="$$")if(x==="on"){const k={},D="$$"+E;let M=E.slice(2);var G=Uh(M);if(jh(M)&&(M=M.slice(0,-7),k.capture=!0),!G&&y){if(O!=null)continue;e.removeEventListener(M,g[D],k),g[D]=null}if(O!=null)if(G)e[`__${M}`]=O,xh([M]);else{let B=function(se){g[E].call(this,se)};g[D]=Lh(M,e,B,k)}else G&&(e[`__${M}`]=void 0)}else if(E==="style")hr(e,E,O);else if(E==="autofocus")Th(e,!!O);else if(!l&&(E==="__value"||E==="value"&&O!=null))e.value=e.__value=O;else if(E==="selected"&&m)Zh(e,O);else{var T=E;h||(T=Dh(T));var re=T==="defaultValue"||T==="defaultChecked";if(O==null&&!l&&!re)if(a[E]=null,T==="value"||T==="checked"){let k=e;const D=t===void 0;if(T==="value"){let M=k.defaultValue;k.removeAttribute(T),k.defaultValue=M,k.value=k.__value=D?M:null}else{let M=k.defaultChecked;k.removeAttribute(T),k.defaultChecked=M,k.checked=D?M:!1}}else e.removeAttribute(E);else re||v.includes(T)&&(l||typeof O!="string")?(e[T]=O,T in a&&(a[T]=Mh)):typeof O!="function"&&hr(e,T,O)}}}return d&&un(!0),g}function hw(e,t,n=[],r=[],s=[],i,c=!1,o=!1){Ch(s,n,r,a=>{var l=void 0,h={},d=e.nodeName==="SELECT",g=!1;if(qa(()=>{var _=t(...a.map(Ts)),v=ed(e,l,_,i,c,o);g&&d&&"value"in _&&Ns(e,_.value);for(let y of Object.getOwnPropertySymbols(h))_[y]||fr(h[y]);for(let y of Object.getOwnPropertySymbols(_)){var b=_[y];y.description===Rh&&(!l||b!==l[y])&&(h[y]&&fr(h[y]),h[y]=pn(()=>Kh(e,()=>b))),v[y]=b}l=v}),d){var m=e;Ba(()=>{Ns(m,l.value,!0),Qh(m)})}g=!0})}function Si(e){return e.__attributes??(e.__attributes={[Ka]:e.nodeName.includes("-"),[Ha]:e.namespaceURI===Eh})}var Dc=new Map;function Ja(e){var t=e.getAttribute("is")||e.nodeName,n=Dc.get(t);if(n)return n;Dc.set(t,n=[]);for(var r,s=e,i=Element.prototype;i!==s;){r=$h(s);for(var c in r)r[c].set&&n.push(c);s=Oh(s)}return n}const Lr="/api",Me=async e=>{const t=await fetch(`${Lr}${e}`);if(!t.ok)throw new Error(await t.text());return t.json()},qe=async(e,t)=>{const n=await fetch(`${Lr}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await n.text());return n.json()},Ga=async e=>{const t=await fetch(`${Lr}${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text());return t.json()},td=async(e,t)=>{const n=await fetch(`${Lr}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await n.text());return n.json()},dw=()=>Me("/projects"),gw=e=>Me(`/sessions?project=${encodeURIComponent(e)}`),pw=(e,t)=>Me(`/session?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),mw=(e,t)=>Ga(`/session?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),_w=(e,t,n)=>qe("/session/rename",{project:e,id:t,title:n}),bw=(e,t,n)=>Ga(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&uuid=${encodeURIComponent(n)}`),yw=(e,t,n,r)=>qe(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}`,{message:n,index:r}),Sw=(e,t,n,r)=>td(`/message?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&uuid=${encodeURIComponent(n)}`,{customTitle:r}),vw=e=>Me("/cleanup"),kw=e=>qe("/cleanup",e),ww=()=>Me("/version"),Iw=()=>qe("/shutdown",{}),Ew=(e,t)=>qe("/open-file",{sessionId:e,backupFileName:t}),Ow=e=>qe("/open-file",{filePath:e}),$w=(e,t,n)=>qe("/session/split",{project:e,sessionId:t,messageUuid:n}),Cw=(e,t,n)=>qe("/session/move",{sourceProject:e,sessionId:t,targetProject:n}),Rw=async e=>{try{return(await Me(`/file-exists?path=${encodeURIComponent(e)}`)).exists}catch{return!1}},Tw=(e,t)=>{const n=new URLSearchParams({q:e});return t!=null&&t.project&&n.set("project",t.project),t!=null&&t.searchContent&&n.set("content","true"),Me(`/search?${n}`)},Mw=e=>Me(`/project/expand?project=${encodeURIComponent(e)}`),Nw=(e,t)=>Me(`/session/tree-data?project=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`),Fw=(e,t,n)=>Me(`/agent/messages?project=${encodeURIComponent(e)}&session=${encodeURIComponent(t)}&agent=${encodeURIComponent(n)}`),Aw=(e,t)=>qe("/session/resume",{projectName:e,sessionId:t}),nd={},za=Object.freeze(Object.defineProperty({__proto__:null,default:nd},Symbol.toStringTag,{value:"Module"})),rd=e=>typeof e=="function",f=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(s){return t(s,n)}};case 3:return function(n,r,s){return arguments.length>=3?t(n,r,s):function(i){return t(i,n,r)}};case 4:return function(n,r,s,i){return arguments.length>=4?t(n,r,s,i):function(c){return t(c,n,r,s)}};case 5:return function(n,r,s,i,c){return arguments.length>=5?t(n,r,s,i,c):function(o){return t(o,n,r,s,i)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(r){return t(r,...n)}}}},q=e=>e,xr=e=>()=>e,Uc=xr(!0),Fs=xr(!1),Wa=xr(void 0),sd=Wa;function p(e,t,n,r,s,i,c,o,a){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return s(r(n(t(e))));case 6:return i(s(r(n(t(e)))));case 7:return c(i(s(r(n(t(e))))));case 8:return o(c(i(s(r(n(t(e)))))));case 9:return a(o(c(i(s(r(n(t(e))))))));default:{let l=arguments[0];for(let h=1;h<arguments.length;h++)l=arguments[h](l);return l}}}const vi=e=>(t,n)=>t===n||e(t,n),id=f(2,(e,t)=>vi((n,r)=>e(t(n),t(r)))),cd=e=>vi((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),Wn="effect/GlobalValue";let en;const L=(e,t)=>(en||(globalThis[Wn]??(globalThis[Wn]=new Map),en=globalThis[Wn]),en.has(e)||en.set(e,t()),en.get(e)),od=e=>typeof e=="string",As=e=>typeof e=="number",ad=e=>typeof e=="bigint",Dr=rd,ud=e=>typeof e=="object"&&e!==null,Ur=e=>ud(e)||Dr(e),A=f(2,(e,t)=>Ur(e)&&t in e),Ya=f(2,(e,t)=>A(e,"_tag")&&e._tag===t),mt=e=>e==null,Qa=e=>typeof e=="string"||A(e,Symbol.iterator),ld=e=>A(e,"then")&&Dr(e.then),qr=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;let Xa=class Za{constructor(t){u(this,"self");u(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Za(this.self)}};const fd=335903614,hd=4150755663,dd=1481765933,gd=1284865837,pd=9007199254740992,md=134217728;class _d{constructor(t,n,r,s){u(this,"_state");return mt(n)&&mt(t)?(n=Math.random()*4294967295>>>0,t=0):mt(n)&&(n=t,t=0),mt(s)&&mt(r)?(s=this._state?this._state[3]:hd,r=this._state?this._state[2]:fd):mt(s)&&(s=r,r=0),this._state=new Int32Array([0,0,r>>>0,((s||0)|1)>>>0]),this._next(),qc(this._state,this._state[0],this._state[1],t>>>0,n>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=t[3]|1}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){const t=(this._next()&67108863)*1,n=(this._next()&134217727)*1;return(t*md+n)/pd}_next(){const t=this._state[0]>>>0,n=this._state[1]>>>0;bd(this._state,t,n,dd,gd),qc(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,s=(n>>>18|t<<14)>>>0;r=(r^t)>>>0,s=(s^n)>>>0;const i=(s>>>27|r<<5)>>>0,c=t>>>27,o=(-c>>>0&31)>>>0;return(i>>>c|i<<o)>>>0}}function bd(e,t,n,r,s){let i=(n>>>16)*(s&65535)>>>0,c=(n&65535)*(s>>>16)>>>0,o=(n&65535)*(s&65535)>>>0,a=(n>>>16)*(s>>>16)+((c>>>16)+(i>>>16))>>>0;c=c<<16>>>0,o=o+c>>>0,o>>>0<c>>>0&&(a=a+1>>>0),i=i<<16>>>0,o=o+i>>>0,o>>>0<i>>>0&&(a=a+1>>>0),a=a+Math.imul(n,r)>>>0,a=a+Math.imul(t,s)>>>0,e[0]=a,e[1]=o}function qc(e,t,n,r,s){let i=t+r>>>0;const c=n+s>>>0;c>>>0<n>>>0&&(i=i+1|0),e[0]=i,e[1]=c}const Ps=Symbol.for("effect/Utils/YieldWrap");var $n;class Cn{constructor(t){Tc(this,$n);Mc(this,$n,t)}[Ps](){return Rc(this,$n)}}$n=new WeakMap;function yd(e){if(typeof e=="object"&&e!==null&&Ps in e)return e[Ps]();throw new Error(qr("yieldWrapGet"))}const _e=L("effect/Utils/isStructuralRegion",()=>({enabled:!1,tester:void 0})),eu={effect_internal_function:e=>e()},Sd={effect_internal_function:e=>{try{return e()}finally{}}};var zo;const vd=((zo=eu.effect_internal_function(()=>new Error().stack))==null?void 0:zo.includes("effect_internal_function"))===!0,ce=vd?eu.effect_internal_function:Sd.effect_internal_function,bs=L(Symbol.for("effect/Hash/randomHashCache"),()=>new WeakMap),N=Symbol.for("effect/Hash"),S=e=>{if(_e.enabled===!0)return 0;switch(typeof e){case"number":return wi(e);case"bigint":return H(e.toString(10));case"boolean":return H(String(e));case"symbol":return H(String(e));case"string":return H(e);case"undefined":return H("undefined");case"function":case"object":return e===null?H("null"):e instanceof Date?Number.isNaN(e.getTime())?H("Invalid Date"):S(e.toISOString()):e instanceof URL?S(e.href):kd(e)?e[N]():ki(e);default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ki=e=>(bs.has(e)||bs.set(e,wi(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),bs.get(e)),j=e=>t=>t*53^e,Br=e=>e&3221225471|e>>>1&1073741824,kd=e=>A(e,N),wi=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Br(t)},H=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Br(t)},wd=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=p(H(t[r]),j(S(e[t[r]])));return Br(n)},tu=e=>wd(e,Object.keys(e)),Rn=e=>{let t=6151;for(let n=0;n<e.length;n++)t=p(t,j(S(e[n])));return Br(t)},K=function(){if(arguments.length===1){const n=arguments[0];return function(r){return Object.defineProperty(n,N,{value(){return r},enumerable:!1}),r}}const e=arguments[0],t=arguments[1];return Object.defineProperty(e,N,{value(){return t},enumerable:!1}),t},R=Symbol.for("effect/Equal");function F(){return arguments.length===1?e=>dr(e,arguments[0]):dr(arguments[0],arguments[1])}function dr(e,t){if(e===t)return!0;const n=typeof e;if(n!==typeof t)return!1;if(n==="object"||n==="function"){if(e!==null&&t!==null){if(gr(e)&&gr(t))return S(e)===S(t)&&e[R](t)?!0:_e.enabled&&_e.tester?_e.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){const r=e.getTime(),s=t.getTime();return r===s||Number.isNaN(r)&&Number.isNaN(s)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(_e.enabled){if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((r,s)=>dr(r,t[s]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const r=Object.keys(e),s=Object.keys(t);if(r.length===s.length){for(const i of r)if(!(i in t&&dr(e[i],t[i])))return _e.tester?_e.tester(e,t):!1;return!0}}return _e.tester?_e.tester(e,t):!1}}return _e.enabled&&_e.tester?_e.tester(e,t):!1}const gr=e=>A(e,R),Ii=()=>F,J=Symbol.for("nodejs.util.inspect.custom"),X=e=>{try{if(A(e,"toJSON")&&Dr(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(X)}catch{return{}}return Ed(e)},ee=e=>JSON.stringify(e,null,2),It=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?nu(e,t):String(e)}catch{return String(e)}},nu=(e,t)=>{let n=[];const r=JSON.stringify(e,(s,i)=>typeof i=="object"&&i!==null?n.includes(i)?void 0:n.push(i)&&(nt.fiberRefs!==void 0&&ru(i)?i[Ei](nt.fiberRefs):i):i,t);return n=void 0,r},Ei=Symbol.for("effect/Inspectable/Redactable"),ru=e=>typeof e=="object"&&e!==null&&Ei in e,nt=L("effect/Inspectable/redactableState",()=>({fiberRefs:void 0})),Id=(e,t)=>{const n=nt.fiberRefs;nt.fiberRefs=e;try{return t()}finally{nt.fiberRefs=n}},Ed=e=>ru(e)&&nt.fiberRefs!==void 0?e[Ei](nt.fiberRefs):e,C=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,s=t.length;r<s;r++)n=t[r](n);return n}}},ln="Async",Vr="Commit",we="Failure",ys="OnFailure",pr="OnSuccess",mr="OnSuccessAndFailure",Ie="Success",su="Sync",Od="Tag",Tn="UpdateRuntimeFlags",_r="While",fn="Iterator",iu="WithRuntime",rr="Yield",Oi="RevertFlags";let $d="3.19.12";const $i=()=>$d,Cd=Symbol.for("effect/Effect"),Rd=Symbol.for("effect/Stream"),Td=Symbol.for("effect/Sink"),Md=Symbol.for("effect/Channel"),Et={_R:e=>e,_E:e=>e,_A:e=>e,_V:$i()},Nd={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},Fd={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Mn={[Cd]:Et,[Rd]:Et,[Td]:Nd,[Md]:Fd,[R](e){return this===e},[N](){return K(this,ki(this))},[Symbol.iterator](){return new Xa(new Cn(this))},pipe(){return C(this,arguments)}},Ci={[N](){return K(this,tu(this))},[R](e){const t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!(r in e&&F(this[r],e[r])))return!1;return!0}},Nn={...Mn,_op:Vr},Ad={...Nn,...Ci},Pd=(function(){function e(){}return e.prototype=Nn,e})(),cu=Symbol.for("effect/Option"),ou={...Mn,[cu]:{_A:e=>e},[J](){return this.toJSON()},toString(){return ee(this.toJSON())}},jd=Object.assign(Object.create(ou),{_tag:"Some",_op:"Some",[R](e){return au(e)&&lu(e)&&F(this.value,e.value)},[N](){return K(this,j(S(this._tag))(S(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:X(this.value)}}}),Ld=S("None"),xd=Object.assign(Object.create(ou),{_tag:"None",_op:"None",[R](e){return au(e)&&uu(e)},[N](){return Ld},toJSON(){return{_id:"Option",_tag:this._tag}}}),au=e=>A(e,cu),uu=e=>e._tag==="None",lu=e=>e._tag==="Some",fu=Object.create(xd),js=e=>{const t=Object.create(jd);return t.value=e,t},hu=Symbol.for("effect/Either"),du={...Mn,[hu]:{_R:e=>e},[J](){return this.toJSON()},toString(){return ee(this.toJSON())}},Dd=Object.assign(Object.create(du),{_tag:"Right",_op:"Right",[R](e){return gu(e)&&mu(e)&&F(this.right,e.right)},[N](){return j(S(this._tag))(S(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:X(this.right)}}}),Ud=Object.assign(Object.create(du),{_tag:"Left",_op:"Left",[R](e){return gu(e)&&pu(e)&&F(this.left,e.left)},[N](){return j(S(this._tag))(S(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:X(this.left)}}}),gu=e=>A(e,hu),pu=e=>e._tag==="Left",mu=e=>e._tag==="Right",qd=e=>{const t=Object.create(Ud);return t.left=e,t},Bd=e=>{const t=Object.create(Dd);return t.right=e,t},je=Bd,Ot=qd,an=pu,Yn=mu,Vd=f(2,(e,{onLeft:t,onRight:n})=>an(e)?t(e.left):n(e.right)),Kd=Vd({onLeft:q,onRight:q}),_u=e=>e.length>0,bu=e=>(t,n)=>t===n?0:e(t,n),Hd=bu((e,t)=>e<t?-1:1),Jd=f(2,(e,t)=>bu((n,r)=>e(t(n),t(r)))),Gd=e=>f(2,(t,n)=>e(t,n)===1),$=()=>fu,P=js,ae=uu,Re=lu,gt=f(2,(e,{onNone:t,onSome:n})=>ae(e)?t():n(e.value)),ct=f(2,(e,t)=>ae(e)?t():e.value),zd=f(2,(e,t)=>ae(e)?P(t()):e),Ri=e=>e==null?$():P(e),Qe=ct(Wa),Wd=f(2,(e,t)=>ae(e)?$():P(t(e.value))),Yd=f(2,(e,t)=>ae(e)?$():t(e.value)),Qd=e=>f(2,(t,n)=>ae(t)?!1:e(t.value,n)),Xd=Ii(),Zd=Qd(Xd),eg=(...e)=>e,Ti=e=>new Array(e),tg=f(2,(e,t)=>{const n=Math.max(1,Math.floor(e)),r=new Array(n);for(let s=0;s<n;s++)r[s]=t(s);return r}),z=e=>Array.isArray(e)?e:Array.from(e),ng=e=>Array.isArray(e)?e:[e],br=f(2,(e,t)=>[t,...e]),rg=f(2,(e,t)=>[...e,t]),yu=f(2,(e,t)=>z(e).concat(z(t))),sg=e=>e.length===0,ig=sg,cg=_u,de=_u,Su=(e,t)=>e<0||e>=t.length,og=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),ag=f(2,(e,t)=>{const n=Math.floor(t);return Su(n,e)?$():P(e[n])}),vu=f(2,(e,t)=>{const n=Math.floor(t);if(Su(n,e))throw new Error(`Index ${n} out of bounds`);return e[n]}),hn=ag(0),le=vu(0),ug=e=>de(e)?P(ku(e)):$(),ku=e=>e[e.length-1],$t=e=>e.slice(1),lg=(e,t)=>{let n=0;for(const r of e){if(!t(r,n))break;n++}return n},fg=f(2,(e,t)=>pg(e,lg(e,t))),hg=f(2,(e,t)=>{const n=z(e);return n.slice(og(t,n),n.length)}),Bc=e=>Array.from(e).reverse(),yr=f(2,(e,t)=>{const n=Array.from(e);return n.sort(t),n}),Vc=f(2,(e,t)=>dg(e,t,eg)),dg=f(3,(e,t,n)=>{const r=z(e),s=z(t);if(de(r)&&de(s)){const i=[n(le(r),le(s))],c=Math.min(r.length,s.length);for(let o=1;o<c;o++)i[o]=n(r[o],s[o]);return i}return[]}),gg=Ii(),pg=f(2,(e,t)=>{const n=Array.from(e),r=Math.floor(t);return de(n)?r>=1?mg(n,r):[[],n]:[n,[]]}),mg=f(2,(e,t)=>{const n=Math.max(1,Math.floor(t));return n>=e.length?[_g(e),[]]:[br(e.slice(1,n),le(e)),e.slice(n)]}),_g=e=>e.slice(),bg=f(3,(e,t,n)=>{const r=z(e),s=z(t);return de(r)?de(s)?Iu(n)(yu(r,s)):r:s}),sr=f(2,(e,t)=>bg(e,t,gg)),Ct=()=>[],Se=e=>[e],St=f(2,(e,t)=>e.map(t)),yg=f(2,(e,t)=>{if(ig(e))return[];const n=[];for(let r=0;r<e.length;r++){const s=t(e[r],r);for(let i=0;i<s.length;i++)n.push(s[i])}return n}),Sg=yg(q),wu=f(3,(e,t,n)=>z(e).reduce((r,s,i)=>n(r,s,i),t)),Kc=(e,t)=>{const n=[];let r=e,s;for(;Re(s=t(r));){const[i,c]=s.value;n.push(i),r=c}return n},Mi=cd,Iu=f(2,(e,t)=>{const n=z(e);if(de(n)){const r=[le(n)],s=$t(n);for(const i of s)r.every(c=>!t(i,c))&&r.push(i);return r}return[]}),vg=e=>Iu(e,Ii()),Ht=f(2,(e,t)=>z(e).join(t)),mn=Hd,kg=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),wg=Symbol.for("effect/Context/Tag"),Sr=Symbol.for("effect/Context/Reference"),Ig="effect/STM",Eg=Symbol.for(Ig),Eu={...Mn,_op:"Tag",[Eg]:Et,[wg]:{_Service:e=>e,_Identifier:e=>e},toString(){return ee(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[J](){return this.toJSON()},of(e){return e},context(e){return $u(this,e)}},Og={...Eu,[Sr]:Sr},$g=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;Error.stackTraceLimit=t;const r=Object.create(Eu);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},Cg=()=>(e,t)=>{const n=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=n;function s(){}return Object.setPrototypeOf(s,Og),s.key=e,s.defaultValue=t.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},Ou=Symbol.for("effect/Context"),Rg={[Ou]:{_Services:e=>e},[R](e){if(Mg(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!F(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[N](){return K(this,wi(this.unsafeMap.size))},pipe(){return C(this,arguments)},toString(){return ee(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(X)}},[J](){return this.toJSON()}},Rt=e=>{const t=Object.create(Rg);return t.unsafeMap=e,t},Tg=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
|
|
3
|
-
`);if(n.length>2){const r=n[2].match(/at (.*)/);r&&(t.message=t.message+` (defined at ${r[1]})`)}}if(t.stack){const n=t.stack.split(`
|
|
4
|
-
`);n.splice(1,3),t.stack=n.join(`
|
|
5
|
-
`)}return t},Mg=e=>A(e,Ou),Ng=e=>A(e,Sr),Fg=Rt(new Map),Ag=()=>Fg,$u=(e,t)=>Rt(new Map([[e.key,t]])),Pg=f(3,(e,t,n)=>{const r=new Map(e.unsafeMap);return r.set(t.key,n),Rt(r)}),Ss=L("effect/Context/defaultValueCache",()=>new Map),Ni=e=>{if(Ss.has(e.key))return Ss.get(e.key);const t=e.defaultValue();return Ss.set(e.key,t),t},jg=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):Ni(t),Cu=f(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(Sr in t)return Ni(t);throw Tg(t)}return e.unsafeMap.get(t.key)}),Lg=Cu,xg=f(2,(e,t)=>e.unsafeMap.has(t.key)?js(e.unsafeMap.get(t.key)):Ng(t)?js(Ni(t)):fu),Dg=f(2,(e,t)=>{const n=new Map(e.unsafeMap);for(const[r,s]of t.unsafeMap)n.set(r,s);return Rt(n)}),pt=$g,Ru=Ag,Ug=$u,tn=Pg,Tu=Lg,Mu=Cu,Fn=xg,Nu=Dg,Fu=Cg,Au=Symbol.for("effect/Chunk");function qg(e,t,n,r,s){for(let i=t;i<Math.min(e.length,t+s);i++)n[r+i-t]=e[i];return n}const Pu=[],Bg=e=>vi((t,n)=>t.length===n.length&&rt(t).every((r,s)=>e(r,vt(n,s)))),Vg=Bg(F),Kg={[Au]:{_A:e=>e},toString(){return ee(this.toJSON())},toJSON(){return{_id:"Chunk",values:rt(this).map(X)}},[J](){return this.toJSON()},[R](e){return ju(e)&&Vg(this,e)},[N](){return K(this,Rn(rt(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Pu[Symbol.iterator]();default:return rt(this)[Symbol.iterator]()}},pipe(){return C(this,arguments)}},W=e=>{const t=Object.create(Kg);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=Ce,t.right=Ce;break}case"ISingleton":{t.length=1,t.depth=0,t.left=Ce,t.right=Ce;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=Ce,t.right=Ce;break}}return t},ju=e=>A(e,Au),Ce=W({_tag:"IEmpty"}),De=()=>Ce,vs=(...e)=>Gg(e),ge=e=>W({_tag:"ISingleton",a:e}),Lu=e=>ju(e)?e:Kr(z(e)),Ls=(e,t,n)=>{switch(e.backing._tag){case"IArray":{qg(e.backing.array,0,t,n,e.length);break}case"IConcat":{Ls(e.left,t,n),Ls(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,s=n;for(;r<e.length;)t[s]=vt(e,r),r+=1,s+=1;break}}},Hg=e=>{switch(e.backing._tag){case"IEmpty":return Pu;case"IArray":return e.backing.array;default:{const t=new Array(e.length);return Ls(e,t,0),e.backing={_tag:"IArray",array:t},e.left=Ce,e.right=Ce,e.depth=0,t}}},rt=Hg,Jg=e=>{switch(e.backing._tag){case"IEmpty":case"ISingleton":return e;case"IArray":return W({_tag:"IArray",array:Bc(e.backing.array)});case"IConcat":return W({_tag:"IConcat",left:Tt(e.backing.right),right:Tt(e.backing.left)});case"ISlice":return Kr(Bc(rt(e)))}},Tt=Jg,Kr=e=>e.length===0?De():e.length===1?ge(e[0]):W({_tag:"IArray",array:e}),Gg=e=>Kr(e),vt=f(2,(e,t)=>{switch(e.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":{if(t!==0)throw new Error("Index out of bounds");return e.backing.a}case"IArray":{if(t>=e.length||t<0)throw new Error("Index out of bounds");return e.backing.array[t]}case"IConcat":return t<e.left.length?vt(e.left,t):vt(e.right,t-e.left.length);case"ISlice":return vt(e.backing.chunk,t+e.backing.offset)}}),zg=f(2,(e,t)=>ve(e,ge(t))),Ee=f(2,(e,t)=>ve(ge(t),e)),xs=f(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Ce;switch(e.backing._tag){case"ISlice":return W({_tag:"ISlice",chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case"IConcat":return t>e.left.length?xs(e.right,t-e.left.length):W({_tag:"IConcat",left:xs(e.left,t),right:e.right});default:return W({_tag:"ISlice",chunk:e,offset:t,length:e.length-t})}}),ve=f(2,(e,t)=>{if(e.backing._tag==="IEmpty")return t;if(t.backing._tag==="IEmpty")return e;const n=t.depth-e.depth;if(Math.abs(n)<=1)return W({_tag:"IConcat",left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){const r=ve(e.right,t);return W({_tag:"IConcat",left:e.left,right:r})}else{const r=ve(e.right.right,t);if(r.depth===e.depth-3){const s=W({_tag:"IConcat",left:e.right.left,right:r});return W({_tag:"IConcat",left:e.left,right:s})}else{const s=W({_tag:"IConcat",left:e.left,right:e.right.left});return W({_tag:"IConcat",left:s,right:r})}}else if(t.right.depth>=t.left.depth){const r=ve(e,t.left);return W({_tag:"IConcat",left:r,right:t.right})}else{const r=ve(e,t.left.left);if(r.depth===t.depth-3){const s=W({_tag:"IConcat",left:r,right:t.left.right});return W({_tag:"IConcat",left:s,right:t.right})}else{const s=W({_tag:"IConcat",left:t.left.right,right:t.right});return W({_tag:"IConcat",left:r,right:s})}}}),Wg=e=>e.length===0,Mt=e=>e.length>0,xu=e=>vt(e,0),Nt=xu,Ze=e=>xs(e,1),Ds=Symbol.for("effect/Duration"),Du=BigInt(0),Hc=BigInt(24),Qn=BigInt(60),Us=BigInt(1e3),Jc=BigInt(1e6),Gc=BigInt(1e9),Yg=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ue=e=>{if(Uu(e))return e;if(As(e))return qs(e);if(ad(e))return ks(e);if(Array.isArray(e)&&e.length===2&&e.every(As))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?qu:e[0]===1/0||e[1]===1/0?ep:ks(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(od(e)){const t=Yg.exec(e);if(t){const[n,r,s]=t,i=Number(r);switch(s){case"nano":case"nanos":return ks(BigInt(r));case"micro":case"micros":return tp(BigInt(r));case"milli":case"millis":return qs(i);case"second":case"seconds":return np(i);case"minute":case"minutes":return rp(i);case"hour":case"hours":return sp(i);case"day":case"days":return ip(i);case"week":case"weeks":return cp(i)}}}throw new Error("Invalid DurationInput")},zc={_tag:"Millis",millis:0},Qg={_tag:"Infinity"},Xg={[Ds]:Ds,[N](){return K(this,tu(this.value))},[R](e){return Uu(e)&&dp(this,e)},toString(){return`Duration(${pp(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:ap(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[J](){return this.toJSON()},pipe(){return C(this,arguments)}},Ne=e=>{const t=Object.create(Xg);return As(e)?isNaN(e)||e<=0?t.value=zc:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=Qg:e<=Du?t.value=zc:t.value={_tag:"Nanos",nanos:e},t},Uu=e=>A(e,Ds),Zg=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Du;case"Infinity":return!1}},qu=Ne(0),ep=Ne(1/0),ks=e=>Ne(e),tp=e=>Ne(e*Us),qs=e=>Ne(e),np=e=>Ne(e*1e3),rp=e=>Ne(e*6e4),sp=e=>Ne(e*36e5),ip=e=>Ne(e*864e5),cp=e=>Ne(e*6048e5),Bs=e=>up(e,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),op=e=>{const t=Ue(e);switch(t.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return BigInt(Math.round(t.value.millis*1e6))}},ap=e=>{const t=Ue(e);switch(t.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(t.value.nanos/Gc),Number(t.value.nanos%Gc)];case"Millis":return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},up=f(2,(e,t)=>{const n=Ue(e);switch(n.value._tag){case"Nanos":return t.onNanos(n.value.nanos);case"Infinity":return t.onMillis(1/0);case"Millis":return t.onMillis(n.value.millis)}}),Fi=f(3,(e,t,n)=>{const r=Ue(e),s=Ue(t);if(r.value._tag==="Infinity"||s.value._tag==="Infinity")return n.onMillis(Bs(r),Bs(s));if(r.value._tag==="Nanos"||s.value._tag==="Nanos"){const i=r.value._tag==="Nanos"?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),c=s.value._tag==="Nanos"?s.value.nanos:BigInt(Math.round(s.value.millis*1e6));return n.onNanos(i,c)}return n.onMillis(r.value.millis,s.value.millis)}),lp=(e,t)=>Fi(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r}),fp=f(2,(e,t)=>Fi(e,t,{onMillis:(n,r)=>n<=r,onNanos:(n,r)=>n<=r})),hp=f(2,(e,t)=>Fi(e,t,{onMillis:(n,r)=>n>=r,onNanos:(n,r)=>n>=r})),dp=f(2,(e,t)=>lp(Ue(e),Ue(t))),gp=e=>{const t=Ue(e);if(t.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const n=op(t),r=n/Jc,s=r/Us,i=s/Qn,c=i/Qn,o=c/Hc;return{days:Number(o),hours:Number(c%Hc),minutes:Number(i%Qn),seconds:Number(s%Qn),millis:Number(r%Us),nanos:Number(n%Jc)}},pp=e=>{const t=Ue(e);if(t.value._tag==="Infinity")return"Infinity";if(Zg(t))return"0";const n=gp(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(" ")},ot=5,Ai=Math.pow(2,ot),mp=Ai-1,_p=Ai/2,bp=Ai/4;function yp(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function Ft(e,t){return t>>>e&mp}function yt(e){return 1<<e}function Bu(e,t){return yp(e&t-1)}const Sp=(e,t)=>({value:e,previous:t});function kt(e,t,n,r){let s=r;if(!e){const i=r.length;s=new Array(i);for(let c=0;c<i;++c)s[c]=r[c]}return s[t]=n,s}function Vu(e,t,n){const r=n.length-1;let s=0,i=0,c=n;if(e)s=i=t;else for(c=new Array(r);s<t;)c[i++]=n[s++];for(++s;s<=r;)c[i++]=n[s++];return e&&(c.length=r),c}function vp(e,t,n,r){const s=r.length;if(e){let a=s;for(;a>=t;)r[a--]=r[a];return r[t]=n,r}let i=0,c=0;const o=new Array(s+1);for(;i<t;)o[c++]=r[i++];for(o[t]=n;i<s;)o[++c]=r[i++];return o}class Ge{constructor(){u(this,"_tag","EmptyNode")}modify(t,n,r,s,i,c){const o=r($());return ae(o)?new Ge:(++c.value,new st(t,s,i,o))}}function ke(e){return Ya(e,"EmptyNode")}function kp(e){return ke(e)||e._tag==="LeafNode"||e._tag==="CollisionNode"}function Hr(e,t){return ke(e)?!1:t===e.edit}class st{constructor(t,n,r,s){u(this,"edit");u(this,"hash");u(this,"key");u(this,"value");u(this,"_tag","LeafNode");this.edit=t,this.hash=n,this.key=r,this.value=s}modify(t,n,r,s,i,c){if(F(i,this.key)){const a=r(this.value);return a===this.value?this:ae(a)?(--c.value,new Ge):Hr(this,t)?(this.value=a,this):new st(t,s,i,a)}const o=r($());return ae(o)?this:(++c.value,Ku(t,n,this.hash,this,s,new st(t,s,i,o)))}}class Pi{constructor(t,n,r){u(this,"edit");u(this,"hash");u(this,"children");u(this,"_tag","CollisionNode");this.edit=t,this.hash=n,this.children=r}modify(t,n,r,s,i,c){if(s===this.hash){const a=Hr(this,t),l=this.updateCollisionList(a,t,this.hash,this.children,r,i,c);return l===this.children?this:l.length>1?new Pi(t,this.hash,l):l[0]}const o=r($());return ae(o)?this:(++c.value,Ku(t,n,this.hash,this,s,new st(t,s,i,o)))}updateCollisionList(t,n,r,s,i,c,o){const a=s.length;for(let h=0;h<a;++h){const d=s[h];if("key"in d&&F(c,d.key)){const g=d.value,m=i(g);return m===g?s:ae(m)?(--o.value,Vu(t,h,s)):kt(t,h,new st(n,r,c,m),s)}}const l=i($());return ae(l)?s:(++o.value,kt(t,a,new st(n,r,c,l),s))}}class At{constructor(t,n,r){u(this,"edit");u(this,"mask");u(this,"children");u(this,"_tag","IndexedNode");this.edit=t,this.mask=n,this.children=r}modify(t,n,r,s,i,c){const o=this.mask,a=this.children,l=Ft(n,s),h=yt(l),d=Bu(o,h),g=o&h,m=Hr(this,t);if(!g){const x=new Ge().modify(t,n+ot,r,s,i,c);return x?a.length>=_p?Ip(t,l,x,o,a):new At(t,o|h,vp(m,d,x,a)):this}const _=a[d],v=_.modify(t,n+ot,r,s,i,c);if(_===v)return this;let b=o,y;if(ke(v)){if(b&=~h,!b)return new Ge;if(a.length<=2&&kp(a[d^1]))return a[d^1];y=Vu(m,d,a)}else y=kt(m,d,v,a);return m?(this.mask=b,this.children=y,this):new At(t,b,y)}}class ji{constructor(t,n,r){u(this,"edit");u(this,"size");u(this,"children");u(this,"_tag","ArrayNode");this.edit=t,this.size=n,this.children=r}modify(t,n,r,s,i,c){let o=this.size;const a=this.children,l=Ft(n,s),h=a[l],d=(h||new Ge).modify(t,n+ot,r,s,i,c);if(h===d)return this;const g=Hr(this,t);let m;if(ke(h)&&!ke(d))++o,m=kt(g,l,d,a);else if(!ke(h)&&ke(d)){if(--o,o<=bp)return wp(t,o,l,a);m=kt(g,l,new Ge,a)}else m=kt(g,l,d,a);return g?(this.size=o,this.children=m,this):new ji(t,o,m)}}function wp(e,t,n,r){const s=new Array(t-1);let i=0,c=0;for(let o=0,a=r.length;o<a;++o)if(o!==n){const l=r[o];l&&!ke(l)&&(s[i++]=l,c|=1<<o)}return new At(e,c,s)}function Ip(e,t,n,r,s){const i=[];let c=r,o=0;for(let a=0;c;++a)c&1&&(i[a]=s[o++]),c>>>=1;return i[t]=n,new ji(e,o+1,i)}function Ep(e,t,n,r,s,i){if(n===s)return new Pi(e,n,[i,r]);const c=Ft(t,n),o=Ft(t,s);if(c===o)return a=>new At(e,yt(c)|yt(o),[a]);{const a=c<o?[r,i]:[i,r];return new At(e,yt(c)|yt(o),a)}}function Ku(e,t,n,r,s,i){let c,o=t;for(;;){const a=Ep(e,o,n,r,s,i);if(typeof a=="function")c=Sp(a,c),o=o+ot;else{let l=a;for(;c!=null;)l=c.value(l),c=c.previous;return l}}}const Hu="effect/HashMap",Vs=Symbol.for(Hu),Op={[Vs]:Vs,[Symbol.iterator](){return new Jr(this,(e,t)=>[e,t])},[N](){let e=S(Hu);for(const t of this)e^=p(S(t[0]),j(S(t[1])));return K(this,e)},[R](e){if(Rp(e)){if(e._size!==this._size)return!1;for(const t of this){const n=p(e,xi(t[0],S(t[0])));if(ae(n))return!1;if(!F(t[1],n.value))return!1}return!0}return!1},toString(){return ee(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(X)}},[J](){return this.toJSON()},pipe(){return C(this,arguments)}},Li=(e,t,n,r)=>{const s=Object.create(Op);return s._editable=e,s._edit=t,s._root=n,s._size=r,s};class Jr{constructor(t,n){u(this,"map");u(this,"f");u(this,"v");this.map=t,this.f=n,this.v=Ju(this.map._root,this.f,void 0)}next(){if(ae(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=vr(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new Jr(this.map,this.f)}}const vr=e=>e?Gu(e[0],e[1],e[2],e[3],e[4]):$(),Ju=(e,t,n=void 0)=>{switch(e._tag){case"LeafNode":return Re(e.value)?P({value:t(e.key,e.value.value),cont:n}):vr(n);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const r=e.children;return Gu(r.length,r,0,t,n)}default:return vr(n)}},Gu=(e,t,n,r,s)=>{for(;n<e;){const i=t[n++];if(i&&!ke(i))return Ju(i,r,[e,t,n,r,s])}return vr(s)},$p=Li(!1,0,new Ge,0),Gr=()=>$p,Cp=e=>{const t=Wu(Gr());for(const n of e)_n(t,n[0],n[1]);return Ap(t)},Rp=e=>A(e,Vs),Tp=e=>e&&ke(e._root),Mp=f(2,(e,t)=>xi(e,t,S(t))),xi=f(3,(e,t,n)=>{let r=e._root,s=0;for(;;)switch(r._tag){case"LeafNode":return F(t,r.key)?r.value:$();case"CollisionNode":{if(n===r.hash){const i=r.children;for(let c=0,o=i.length;c<o;++c){const a=i[c];if("key"in a&&F(t,a.key))return a.value}}return $()}case"IndexedNode":{const i=Ft(s,n),c=yt(i);if(r.mask&c){r=r.children[Bu(r.mask,c)],s+=ot;break}return $()}case"ArrayNode":{if(r=r.children[Ft(s,n)],r){s+=ot;break}return $()}default:return $()}}),Np=f(2,(e,t)=>Re(xi(e,t,S(t)))),_n=f(3,(e,t,n)=>Di(e,t,()=>P(n))),Fp=f(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:Li(e._editable,e._edit,t,n)),zu=e=>new Jr(e,t=>t),Ks=e=>e._size,Wu=e=>Li(!0,e._edit+1,e._root,e._size),Ap=e=>(e._editable=!1,e),Di=f(3,(e,t,n)=>Pp(e,t,S(t),n)),Pp=f(4,(e,t,n,r)=>{const s={value:e._size},i=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,s);return p(e,Fp(i,s.value))}),Wc=f(2,(e,t)=>Di(e,t,$)),jp=f(2,(e,t)=>zr(e,Gr(),(n,r,s)=>_n(n,s,t(r,s)))),Lp=f(2,(e,t)=>zr(e,void 0,(n,r,s)=>t(r,s))),zr=f(3,(e,t,n)=>{const r=e._root;if(r._tag==="LeafNode")return Re(r.value)?n(t,r.value.value,r.key):t;if(r._tag==="EmptyNode")return t;const s=[r.children];let i;for(;i=s.pop();)for(let c=0,o=i.length;c<o;){const a=i[c++];a&&!ke(a)&&(a._tag==="LeafNode"?Re(a.value)&&(t=n(t,a.value.value,a.key)):s.push(a.children))}return t}),Yu="effect/HashSet",Hs=Symbol.for(Yu),xp={[Hs]:Hs,[Symbol.iterator](){return zu(this._keyMap)},[N](){return K(this,j(S(this._keyMap))(S(Yu)))},[R](e){return Dp(e)?Ks(this._keyMap)===Ks(e._keyMap)&&F(this._keyMap,e._keyMap):!1},toString(){return ee(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(X)}},[J](){return this.toJSON()},pipe(){return C(this,arguments)}},Wr=e=>{const t=Object.create(xp);return t._keyMap=e,t},Dp=e=>A(e,Hs),Up=Wr(Gr()),Yr=()=>Up,qp=e=>{const t=Ui(Yr());for(const n of e)bn(t,n);return qi(t)},Bp=(...e)=>{const t=Ui(Yr());for(const n of e)bn(t,n);return qi(t)},Vp=f(2,(e,t)=>Np(e._keyMap,t)),Kp=e=>Ks(e._keyMap),Ui=e=>Wr(Wu(e._keyMap)),qi=e=>(e._keyMap._editable=!1,e),Qu=f(2,(e,t)=>{const n=Ui(e);return t(n),qi(n)}),bn=f(2,(e,t)=>e._keyMap._editable?(_n(t,!0)(e._keyMap),e):Wr(_n(t,!0)(e._keyMap))),Xu=f(2,(e,t)=>e._keyMap._editable?(Wc(t)(e._keyMap),e):Wr(Wc(t)(e._keyMap))),Hp=f(2,(e,t)=>Qu(e,n=>{for(const r of t)Xu(n,r)})),Jp=f(2,(e,t)=>Qu(Yr(),n=>{Gp(e,r=>bn(n,r));for(const r of t)bn(n,r)})),Gp=f(2,(e,t)=>Lp(e._keyMap,(n,r)=>t(r))),zp=f(3,(e,t,n)=>zr(e._keyMap,t,(r,s,i)=>n(r,i))),at=Yr,Wp=qp,Bi=Bp,Yp=Vp,Zu=Kp,dn=bn,el=Xu,Yc=Hp,yn=Jp,kr=zp,Qc=Symbol.for("effect/MutableRef"),Qp={[Qc]:Qc,toString(){return ee(this.toJSON())},toJSON(){return{_id:"MutableRef",current:X(this.current)}},[J](){return this.toJSON()},pipe(){return C(this,arguments)}},tl=e=>{const t=Object.create(Qp);return t.current=e,t},Qr=e=>e.current,nl=f(2,(e,t)=>(e.current=t,e)),Vi="effect/FiberId",Sn=Symbol.for(Vi),wr="None",Js="Runtime",Xp="Composite",Zp=H(`${Vi}-${wr}`);var Wo;let em=class{constructor(){u(this,Wo,Sn);u(this,"_tag",wr);u(this,"id",-1);u(this,"startTimeMillis",-1)}[(Wo=Sn,N)](){return Zp}[R](t){return rl(t)&&t._tag===wr}toString(){return ee(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[J](){return this.toJSON()}};var Yo;class tm{constructor(t,n){u(this,"id");u(this,"startTimeMillis");u(this,Yo,Sn);u(this,"_tag",Js);this.id=t,this.startTimeMillis=n}[(Yo=Sn,N)](){return K(this,H(`${Vi}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[R](t){return rl(t)&&t._tag===Js&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return ee(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[J](){return this.toJSON()}}const nm=new em,rl=e=>A(e,Sn),Gs=e=>{switch(e._tag){case wr:return at();case Js:return Bi(e.id);case Xp:return p(Gs(e.left),yn(Gs(e.right)))}},Xc=L(Symbol.for("effect/Fiber/Id/_fiberCounter"),()=>tl(0)),sl=e=>Array.from(Gs(e)).map(n=>`#${n}`).join(","),rm=()=>{const e=Qr(Xc);return p(Xc,nl(e+1)),new tm(e,Date.now())},Pt=nm,sm=sl,im=rm,Ki=Gr,cm=Cp,om=Tp,il=Mp,cl=_n,ol=zu,am=Di,um=jp,al=zr,vn=Symbol.for("effect/List"),zs=e=>z(e),lm=e=>id(Mi(e),zs),fm=lm(F),hm={[vn]:vn,_tag:"Cons",toString(){return ee(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:zs(this).map(X)}},[J](){return this.toJSON()},[R](e){return ll(e)&&this._tag===e._tag&&fm(this,e)},[N](){return K(this,Rn(zs(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag==="Nil")return e=!0,this.return();const n=t.head;return t=t.tail,{done:e,value:n}},return(n){return e||(e=!0),{done:!0,value:n}}}},pipe(){return C(this,arguments)}},Ir=(e,t)=>{const n=Object.create(hm);return n.head=e,n.tail=t,n},dm=H("Nil"),gm={[vn]:vn,_tag:"Nil",toString(){return ee(this.toJSON())},toJSON(){return{_id:"List",_tag:"Nil"}},[J](){return this.toJSON()},[N](){return dm},[R](e){return ll(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return C(this,arguments)}},ul=Object.create(gm),ll=e=>A(e,vn),Le=e=>e._tag==="Nil",pm=e=>e._tag==="Cons",mm=()=>ul,ut=(e,t)=>Ir(e,t),jt=mm,Hi=e=>Ir(e,ul),_m=f(2,(e,t)=>ym(t,e)),bm=f(2,(e,t)=>ut(t,e)),ym=f(2,(e,t)=>{if(Le(e))return t;if(Le(t))return e;{const n=Ir(t.head,e);let r=n,s=t.tail;for(;!Le(s);){const i=Ir(s.head,e);r.tail=i,r=i,s=s.tail}return n}}),Sm=f(3,(e,t,n)=>{let r=t,s=e;for(;!Le(s);)r=n(r,s.head),s=s.tail;return r}),vm=e=>{let t=jt(),n=e;for(;!Le(n);)t=bm(t,n.head),n=n.tail;return t},Ji=(function(){function e(t){t&&Object.assign(this,t)}return e.prototype=Ci,e})(),km=Symbol.for("effect/DifferContextPatch");function Zc(e){return e}const An={...Ji.prototype,[km]:{_Value:Zc,_Patch:Zc}},wm=Object.assign(Object.create(An),{_tag:"Empty"}),Im=Object.create(wm),fl=()=>Im,Em=Object.assign(Object.create(An),{_tag:"AndThen"}),Om=(e,t)=>{const n=Object.create(Em);return n.first=e,n.second=t,n},$m=Object.assign(Object.create(An),{_tag:"AddService"}),Cm=(e,t)=>{const n=Object.create($m);return n.key=e,n.service=t,n},Rm=Object.assign(Object.create(An),{_tag:"RemoveService"}),Tm=e=>{const t=Object.create(Rm);return t.key=e,t},Mm=Object.assign(Object.create(An),{_tag:"UpdateService"}),Nm=(e,t)=>{const n=Object.create(Mm);return n.key=e,n.update=t,n},Fm=(e,t)=>{const n=new Map(e.unsafeMap);let r=fl();for(const[s,i]of t.unsafeMap.entries())if(n.has(s)){const c=n.get(s);n.delete(s),F(c,i)||(r=ir(Nm(s,()=>i))(r))}else n.delete(s),r=ir(Cm(s,i))(r);for(const[s]of n.entries())r=ir(Tm(s))(r);return r},ir=f(2,(e,t)=>Om(e,t)),Am=f(2,(e,t)=>{if(e._tag==="Empty")return t;let n=!1,r=ge(e);const s=new Map(t.unsafeMap);for(;Mt(r);){const c=Nt(r),o=Ze(r);switch(c._tag){case"Empty":{r=o;break}case"AddService":{s.set(c.key,c.service),r=o;break}case"AndThen":{r=Ee(Ee(o,c.second),c.first);break}case"RemoveService":{s.delete(c.key),r=o;break}case"UpdateService":{s.set(c.key,c.update(s.get(c.key))),n=!0,r=o;break}}}if(!n)return Rt(s);const i=new Map;for(const[c]of t.unsafeMap)s.has(c)&&(i.set(c,s.get(c)),s.delete(c));for(const[c,o]of s)i.set(c,o);return Rt(i)}),Pm=Symbol.for("effect/DifferHashSetPatch");function ws(e){return e}const Xr={...Ji.prototype,[Pm]:{_Value:ws,_Key:ws,_Patch:ws}},jm=Object.assign(Object.create(Xr),{_tag:"Empty"}),Lm=Object.create(jm),hl=()=>Lm,xm=Object.assign(Object.create(Xr),{_tag:"AndThen"}),Dm=(e,t)=>{const n=Object.create(xm);return n.first=e,n.second=t,n},Um=Object.assign(Object.create(Xr),{_tag:"Add"}),qm=e=>{const t=Object.create(Um);return t.value=e,t},Bm=Object.assign(Object.create(Xr),{_tag:"Remove"}),Vm=e=>{const t=Object.create(Bm);return t.value=e,t},Km=(e,t)=>{const[n,r]=kr([e,hl()],([s,i],c)=>Yp(c)(s)?[el(c)(s),i]:[s,Ws(qm(c))(i)])(t);return kr(r,(s,i)=>Ws(Vm(i))(s))(n)},Ws=f(2,(e,t)=>Dm(e,t)),Hm=f(2,(e,t)=>{if(e._tag==="Empty")return t;let n=t,r=ge(e);for(;Mt(r);){const s=Nt(r),i=Ze(r);switch(s._tag){case"Empty":{r=i;break}case"AndThen":{r=Ee(s.first)(Ee(s.second)(i));break}case"Add":{n=dn(s.value)(n),r=i;break}case"Remove":n=el(s.value)(n),r=i}}return n}),Jm=Symbol.for("effect/DifferReadonlyArrayPatch");function eo(e){return e}const Pn={...Ji.prototype,[Jm]:{_Value:eo,_Patch:eo}},Gm=Object.assign(Object.create(Pn),{_tag:"Empty"}),zm=Object.create(Gm),dl=()=>zm,Wm=Object.assign(Object.create(Pn),{_tag:"AndThen"}),Ym=(e,t)=>{const n=Object.create(Wm);return n.first=e,n.second=t,n},Qm=Object.assign(Object.create(Pn),{_tag:"Append"}),Xm=e=>{const t=Object.create(Qm);return t.values=e,t},Zm=Object.assign(Object.create(Pn),{_tag:"Slice"}),e_=(e,t)=>{const n=Object.create(Zm);return n.from=e,n.until=t,n},t_=Object.assign(Object.create(Pn),{_tag:"Update"}),n_=(e,t)=>{const n=Object.create(t_);return n.index=e,n.patch=t,n},r_=e=>{let t=0,n=dl();for(;t<e.oldValue.length&&t<e.newValue.length;){const r=e.oldValue[t],s=e.newValue[t],i=e.differ.diff(r,s);F(i,e.differ.empty)||(n=cr(n,n_(t,i))),t=t+1}return t<e.oldValue.length&&(n=cr(n,e_(0,t))),t<e.newValue.length&&(n=cr(n,Xm(hg(t)(e.newValue)))),n},cr=f(2,(e,t)=>Ym(e,t)),s_=f(3,(e,t,n)=>{if(e._tag==="Empty")return t;let r=t.slice(),s=Se(e);for(;cg(s);){const i=le(s),c=$t(s);switch(i._tag){case"Empty":{s=c;break}case"AndThen":{c.unshift(i.first,i.second),s=c;break}case"Append":{for(const o of i.values)r.push(o);s=c;break}case"Slice":{r=r.slice(i.from,i.until),s=c;break}case"Update":{r[i.index]=n.patch(i.patch,r[i.index]),s=c;break}}}return r}),i_=Symbol.for("effect/Differ"),c_={[i_]:{_P:q,_V:q},pipe(){return C(this,arguments)}},Jt=e=>{const t=Object.create(c_);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},o_=()=>Jt({empty:fl(),combine:(e,t)=>ir(t)(e),diff:(e,t)=>Fm(e,t),patch:(e,t)=>Am(t)(e)}),a_=()=>Jt({empty:hl(),combine:(e,t)=>Ws(t)(e),diff:(e,t)=>Km(e,t),patch:(e,t)=>Hm(t)(e)}),u_=e=>Jt({empty:dl(),combine:(t,n)=>cr(t,n),diff:(t,n)=>r_({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>s_(t,n,e)}),gl=()=>l_((e,t)=>t),l_=e=>Jt({empty:q,combine:(t,n)=>t===q?n:n===q?t:r=>n(t(r)),diff:(t,n)=>F(t,n)?q:xr(n),patch:(t,n)=>e(n,t(n))}),kn=255,pl=8,Ys=e=>e&kn,Qs=e=>e>>pl&kn,jn=(e,t)=>(e&kn)+((t&e&kn)<<pl),f_=jn(0,0),h_=e=>jn(e,e),d_=e=>jn(e,0),g_=f(2,(e,t)=>jn(Ys(e)&~t,Qs(e))),p_=f(2,(e,t)=>e|t),m_=e=>~e>>>0&kn,__=0,Ln=1,b_=2,y_=4,Xs=16,S_=32,v_=e=>Zr(e,S_),k_=f(2,(e,t)=>e|t),Ke=e=>ml(e)&&!E_(e),ml=e=>Zr(e,Ln),Zr=f(2,(e,t)=>(e&t)!==0),w_=(...e)=>e.reduce((t,n)=>t|n,0),I_=w_(__),to=e=>Zr(e,y_),E_=e=>Zr(e,Xs),or=f(2,(e,t)=>jn(e^t,t)),ar=f(2,(e,t)=>e&(m_(Ys(t))|Qs(t))|Ys(t)&Qs(t)),no=Jt({empty:f_,diff:(e,t)=>or(e,t),combine:(e,t)=>p_(t)(e),patch:(e,t)=>ar(t,e)}),O_=h_,_l=d_,ro=g_,bl=(e,t)=>({_tag:"Par",left:e,right:t}),Xn=(e,t)=>({_tag:"Seq",left:e,right:t}),$_=e=>{let t=Hi(e),n=jt();for(;;){const[r,s]=Sm(t,[yl(),jt()],([i,c],o)=>{const[a,l]=C_(o);return[F_(i,a),_m(c,l)]});if(n=R_(n,r),Le(s))return vm(n);t=s}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")},C_=e=>{let t=e,n=yl(),r=jt(),s=jt();for(;;)switch(t._tag){case"Empty":{if(Le(r))return[n,s];t=r.head,r=r.tail;break}case"Par":{r=ut(t.right,r),t=t.left;break}case"Seq":{const i=t.left,c=t.right;switch(i._tag){case"Empty":{t=c;break}case"Par":{const o=i.left,a=i.right;t=bl(Xn(o,c),Xn(a,c));break}case"Seq":{const o=i.left,a=i.right;t=Xn(o,Xn(a,c));break}case"Single":{t=i,s=ut(c,s);break}}break}case"Single":{if(n=N_(n,t),Le(r))return[n,s];t=r.head,r=r.tail;break}}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},R_=(e,t)=>{if(Le(e))return Hi(Is(t));if(A_(t))return e;const n=U_(e.head),r=P_(t);return n.length===1&&r.length===1&&F(n[0],r[0])?ut(D_(e.head,Is(t)),e.tail):ut(Is(t),e)},T_=Symbol.for("effect/RequestBlock/RequestBlockParallel"),M_={_R:e=>e};var Qo;Qo=T_;class Gi{constructor(t){u(this,"map");u(this,Qo,M_);this.map=t}}const yl=()=>new Gi(Ki()),N_=(e,t)=>new Gi(am(e.map,t.dataSource,n=>zd(Wd(n,zg(t.blockedRequest)),()=>ge(t.blockedRequest)))),F_=(e,t)=>new Gi(al(e.map,t.map,(n,r,s)=>cl(n,s,gt(il(n,s),{onNone:()=>r,onSome:i=>ve(r,i)})))),A_=e=>om(e.map),P_=e=>Array.from(ol(e.map)),Is=e=>x_(um(e.map,t=>ge(t))),j_=Symbol.for("effect/RequestBlock/RequestBlockSequential"),L_={_R:e=>e};var Xo;Xo=j_;class Sl{constructor(t){u(this,"map");u(this,Xo,L_);this.map=t}}const x_=e=>new Sl(e),D_=(e,t)=>new Sl(al(t.map,e.map,(n,r,s)=>cl(n,s,gt(il(n,s),{onNone:()=>De(),onSome:i=>ve(i,r)})))),U_=e=>Array.from(ol(e.map)),q_=e=>Array.from(e.map),xn="Die",lt="Empty",Gt="Fail",zt="Interrupt",Lt="Parallel",xt="Sequential",vl="effect/Cause",kl=Symbol.for(vl),B_={_E:e=>e},Wt={[kl]:B_,[N](){return p(S(vl),j(S(tb(this))),K(this))},[R](e){return V_(e)&&eb(this,e)},pipe(){return C(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:X(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:X(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:X(this.left),right:X(this.right)}}},toString(){return ts(this)},[J](){return this.toJSON()}},Dt=(()=>{const e=Object.create(Wt);return e._tag=lt,e})(),Zs=e=>{const t=Object.create(Wt);return t._tag=Gt,t.error=e,t},xe=e=>{const t=Object.create(Wt);return t._tag=xn,t.defect=e,t},He=e=>{const t=Object.create(Wt);return t._tag=zt,t.fiberId=e,t},es=(e,t)=>{const n=Object.create(Wt);return n._tag=Lt,n.left=e,n.right=t,n},ye=(e,t)=>{const n=Object.create(Wt);return n._tag=xt,n.left=e,n.right=t,n},V_=e=>A(e,kl),K_=e=>e._tag===lt,H_=e=>e._tag===lt?!0:Ut(e,!0,(t,n)=>{switch(n._tag){case lt:return P(t);case xn:case Gt:case zt:return P(!1);default:return $()}}),J_=e=>Re(X_(e)),zi=e=>Wi(void 0,rb)(e),G_=e=>Tt(Ut(e,De(),(t,n)=>n._tag===Gt?P(p(t,Ee(n.error))):$())),z_=e=>Tt(Ut(e,De(),(t,n)=>n._tag===xn?P(p(t,Ee(n.defect))):$())),W_=e=>Ut(e,at(),(t,n)=>n._tag===zt?P(p(t,dn(n.fiberId))):$()),Y_=e=>wl(e,t=>t._tag===Gt?P(t.error):$()),Q_=e=>{const t=Y_(e);switch(t._tag){case"None":return je(e);case"Some":return Ot(t.value)}},X_=e=>wl(e,t=>t._tag===zt?P(t.fiberId):$()),so=e=>Il(e,{onEmpty:Dt,onFail:()=>Dt,onDie:xe,onInterrupt:He,onSequential:ye,onParallel:es}),Z_=e=>Il(e,{onEmpty:Dt,onFail:xe,onDie:xe,onInterrupt:He,onSequential:ye,onParallel:es}),eb=(e,t)=>{let n=ge(e),r=ge(t);for(;Mt(n)&&Mt(r);){const[s,i]=p(Nt(n),Ut([at(),De()],([a,l],h)=>{const[d,g]=ei(h);return P([p(a,yn(d)),p(l,ve(g))])})),[c,o]=p(Nt(r),Ut([at(),De()],([a,l],h)=>{const[d,g]=ei(h);return P([p(a,yn(d)),p(l,ve(g))])}));if(!F(s,c))return!1;n=i,r=o}return!0},tb=e=>nb(ge(e),De()),nb=(e,t)=>{for(;;){const[n,r]=p(e,wu([at(),De()],([i,c],o)=>{const[a,l]=ei(o);return[p(i,yn(a)),p(c,ve(l))]})),s=Zu(n)>0?p(t,Ee(n)):t;if(Wg(r))return Tt(s);e=r,t=s}throw new Error(qr("Cause.flattenCauseLoop"))},wl=f(2,(e,t)=>{const n=[e];for(;n.length>0;){const r=n.pop(),s=t(r);switch(s._tag){case"None":{switch(r._tag){case xt:case Lt:{n.push(r.right),n.push(r.left);break}}break}case"Some":return s}}return $()}),ei=e=>{let t=e;const n=[];let r=at(),s=De();for(;t!==void 0;)switch(t._tag){case lt:{if(n.length===0)return[r,s];t=n.pop();break}case Gt:{if(r=dn(r,vs(t._tag,t.error)),n.length===0)return[r,s];t=n.pop();break}case xn:{if(r=dn(r,vs(t._tag,t.defect)),n.length===0)return[r,s];t=n.pop();break}case zt:{if(r=dn(r,vs(t._tag,t.fiberId)),n.length===0)return[r,s];t=n.pop();break}case xt:{switch(t.left._tag){case lt:{t=t.right;break}case xt:{t=ye(t.left.left,ye(t.left.right,t.right));break}case Lt:{t=es(ye(t.left.left,t.right),ye(t.left.right,t.right));break}default:{s=Ee(s,t.right),t=t.left;break}}break}case Lt:{n.push(t.right),t=t.left;break}}throw new Error(qr("Cause.evaluateCauseLoop"))},rb={emptyCase:Uc,failCase:Fs,dieCase:Fs,interruptCase:Uc,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},io="SequentialCase",co="ParallelCase",Il=f(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:s,onParallel:i,onSequential:c})=>Wi(e,void 0,{emptyCase:()=>n,failCase:(o,a)=>r(a),dieCase:(o,a)=>t(a),interruptCase:(o,a)=>s(a),sequentialCase:(o,a,l)=>c(a,l),parallelCase:(o,a,l)=>i(a,l)})),Ut=f(3,(e,t,n)=>{let r=t,s=e;const i=[];for(;s!==void 0;){const c=n(r,s);switch(r=Re(c)?c.value:r,s._tag){case xt:{i.push(s.right),s=s.left;break}case Lt:{i.push(s.right),s=s.left;break}default:{s=void 0;break}}s===void 0&&i.length>0&&(s=i.pop())}return r}),Wi=f(3,(e,t,n)=>{const r=[e],s=[];for(;r.length>0;){const c=r.pop();switch(c._tag){case lt:{s.push(je(n.emptyCase(t)));break}case Gt:{s.push(je(n.failCase(t,c.error)));break}case xn:{s.push(je(n.dieCase(t,c.defect)));break}case zt:{s.push(je(n.interruptCase(t,c.fiberId)));break}case xt:{r.push(c.right),r.push(c.left),s.push(Ot({_tag:io}));break}case Lt:{r.push(c.right),r.push(c.left),s.push(Ot({_tag:co}));break}}}const i=[];for(;s.length>0;){const c=s.pop();switch(c._tag){case"Left":{switch(c.left._tag){case io:{const o=i.pop(),a=i.pop(),l=n.sequentialCase(t,o,a);i.push(l);break}case co:{const o=i.pop(),a=i.pop(),l=n.parallelCase(t,o,a);i.push(l);break}}break}case"Right":{i.push(c.right);break}}}if(i.length===0)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return i.pop()}),ts=(e,t)=>zi(e)?"All fibers interrupted without errors.":ab(e).map(function(n){return(t==null?void 0:t.renderErrorCause)!==!0||n.cause===void 0?n.stack:`${n.stack} {
|
|
6
|
-
${El(n.cause," ")}
|
|
7
|
-
}`}).join(`
|
|
8
|
-
`),El=(e,t)=>{const n=e.stack.split(`
|
|
9
|
-
`);let r=`${t}[cause]: ${n[0]}`;for(let s=1,i=n.length;s<i;s++)r+=`
|
|
10
|
-
${t}${n[s]}`;return e.cause&&(r+=` {
|
|
11
|
-
${El(e.cause,`${t} `)}
|
|
12
|
-
${t}}`),r};class Er extends globalThis.Error{constructor(n){const r=typeof n=="object"&&n!==null,s=Error.stackTraceLimit;Error.stackTraceLimit=1;super(sb(n),r&&"cause"in n&&typeof n.cause<"u"?{cause:new Er(n.cause)}:void 0);u(this,"span");this.message===""&&(this.message="An error has occurred"),Error.stackTraceLimit=s,this.name=n instanceof Error?n.name:"Error",r&&(qt in n&&(this.span=n[qt]),Object.keys(n).forEach(i=>{i in this||(this[i]=n[i])})),this.stack=ob(`${this.name}: ${this.message}`,n instanceof Error&&n.stack?n.stack:"",this.span)}}const sb=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&e instanceof Error)return e.message;try{if(A(e,"toString")&&Dr(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return nu(e)},ib=/\((.*)\)/g,cb=L("effect/Tracer/spanToTrace",()=>new WeakMap),ob=(e,t,n)=>{const r=[e],s=t.startsWith(e)?t.slice(e.length).split(`
|
|
13
|
-
`):t.split(`
|
|
14
|
-
`);for(let i=1;i<s.length;i++){if(s[i].includes(" at new BaseEffectError")||s[i].includes(" at new YieldableError")){i++;continue}if(s[i].includes("Generator.next")||s[i].includes("effect_internal_function"))break;r.push(s[i].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(n){let i=n,c=0;for(;i&&i._tag==="Span"&&c<10;){const o=cb.get(i);if(typeof o=="function"){const a=o();if(typeof a=="string"){const l=a.matchAll(ib);let h=!1;for(const[,d]of l)h=!0,r.push(` at ${i.name} (${d})`);h||r.push(` at ${i.name} (${a.replace(/^at /,"")})`)}else r.push(` at ${i.name}`)}else r.push(` at ${i.name}`);i=Qe(i.parent),c++}}return r.join(`
|
|
15
|
-
`)},qt=Symbol.for("effect/SpanAnnotation"),ab=e=>Wi(e,void 0,{emptyCase:()=>[],dieCase:(t,n)=>[new Er(n)],failCase:(t,n)=>[new Er(n)],interruptCase:()=>[],parallelCase:(t,n,r)=>[...n,...r],sequentialCase:(t,n,r)=>[...n,...r]}),ns="Pending",Ol="Done",ub="effect/Deferred",lb=Symbol.for(ub),fb={_E:e=>e,_A:e=>e},hb=e=>({_tag:ns,joiners:e}),db=e=>({_tag:Ol,effect:e});class Dn{constructor(t){u(this,"self");u(this,"called",!1);this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new Dn(this.self)}}const $l=(e,t)=>{const n=new te("Blocked");return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},gb=e=>{const t=new te("RunBlocked");return t.effect_instruction_i0=e,t},Bt=Symbol.for("effect/Effect");class pb{constructor(t,n){u(this,"patch");u(this,"op");u(this,"_op",Oi);this.patch=t,this.op=n}}var Zo;class te{constructor(t){u(this,"_op");u(this,"effect_instruction_i0");u(this,"effect_instruction_i1");u(this,"effect_instruction_i2");u(this,"trace");u(this,Zo,Et);this._op=t}[(Zo=Bt,R)](t){return this===t}[N](){return K(this,ki(this))}pipe(){return C(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:X(this.effect_instruction_i0),effect_instruction_i1:X(this.effect_instruction_i1),effect_instruction_i2:X(this.effect_instruction_i2)}}toString(){return ee(this.toJSON())}[J](){return this.toJSON()}[Symbol.iterator](){return new Dn(new Cn(this))}}var ea;class Cl{constructor(t){u(this,"_op");u(this,"effect_instruction_i0");u(this,"effect_instruction_i1");u(this,"effect_instruction_i2");u(this,"trace");u(this,ea,Et);this._op=t,this._tag=t}[(ea=Bt,R)](t){return as(t)&&t._op==="Failure"&&F(this.effect_instruction_i0,t.effect_instruction_i0)}[N](){return p(H(this._tag),j(S(this.effect_instruction_i0)),K(this))}get cause(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return ee(this.toJSON())}[J](){return this.toJSON()}[Symbol.iterator](){return new Dn(new Cn(this))}}var ta;class Rl{constructor(t){u(this,"_op");u(this,"effect_instruction_i0");u(this,"effect_instruction_i1");u(this,"effect_instruction_i2");u(this,"trace");u(this,ta,Et);this._op=t,this._tag=t}[(ta=Bt,R)](t){return as(t)&&t._op==="Success"&&F(this.effect_instruction_i0,t.effect_instruction_i0)}[N](){return p(H(this._tag),j(S(this.effect_instruction_i0)),K(this))}get value(){return this.effect_instruction_i0}pipe(){return C(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:X(this.value)}}toString(){return ee(this.toJSON())}[J](){return this.toJSON()}[Symbol.iterator](){return new Dn(new Cn(this))}}const Yi=e=>A(e,Bt),pe=e=>{const t=new te(iu);return t.effect_instruction_i0=e,t},mb=f(3,(e,t,n)=>is(r=>I(e,s=>I(Nl(Y(()=>r(t(s)))),i=>Y(()=>n(s,i)).pipe(Vt({onFailure:c=>{switch(i._tag){case we:return Oe(ye(i.effect_instruction_i0,c));case Ie:return Oe(c)}},onSuccess:()=>i})))))),Un=f(2,(e,t)=>I(e,()=>U(t))),rs=e=>Un(e,void 0),Tl=function(){const e=new te(Vr);switch(arguments.length){case 2:{e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break}case 3:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break}case 4:{e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break}default:throw new Error(qr("you're not supposed to end up here"))}return e},Or=(e,t=Pt)=>{const n=new te(ln);let r;return n.effect_instruction_i0=s=>{r=e(s)},n.effect_instruction_i1=t,Ll(n,s=>Yi(r)?r:Te)},_b=(e,t=Pt)=>Y(()=>Or(e,t)),ft=(e,t=Pt)=>Tl(e,function(){let n,r;function s(a){n?n(a):r===void 0&&(r=a)}const i=new te(ln);i.effect_instruction_i0=a=>{n=a,r&&a(r)},i.effect_instruction_i1=t;let c,o;return this.effect_instruction_i0.length!==1?(o=new AbortController,c=ce(()=>this.effect_instruction_i0(s,o.signal))):c=ce(()=>this.effect_instruction_i0(s)),c||o?Ll(i,a=>(o&&o.abort(),c??Te)):i}),oo=f(2,(e,t)=>Xi(e,{onFailure:t,onSuccess:U})),ao=Symbol.for("effect/OriginalAnnotation"),Ml=(e,t)=>Re(t)?new Proxy(e,{has(n,r){return r===qt||r===ao||r in n},get(n,r){return r===qt?t.value:r===ao?e:n[r]}}):e,uo=e=>Ur(e)&&!(qt in e)?pe(t=>Oe(xe(Ml(e,Ql(t))))):Oe(xe(e)),bb=e=>yb(()=>xe(new Xb(e))),wn=e=>Xi(e,{onFailure:t=>U(Ot(t)),onSuccess:t=>U(je(t))}),Nl=e=>wb(e,{onFailure:V,onSuccess:Z}),ne=e=>Ur(e)&&!(qt in e)?pe(t=>Oe(Zs(Ml(e,Ql(t))))):Oe(Zs(e)),Qi=e=>I(w(e),ne),Oe=e=>{const t=new Cl(we);return t.effect_instruction_i0=e,t},yb=e=>I(w(e),Oe),Sb=pe(e=>U(e.id())),vb=e=>pe(t=>e(t.id())),I=f(2,(e,t)=>{const n=new te(pr);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),kb=e=>{const t=new te("OnStep");return t.effect_instruction_i0=e,t},Fl=e=>I(e,q),wb=f(2,(e,t)=>Vt(e,{onFailure:n=>U(t.onFailure(n)),onSuccess:n=>U(t.onSuccess(n))})),Vt=f(2,(e,t)=>{const n=new te(mr);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Xi=f(2,(e,t)=>Vt(e,{onFailure:n=>{if(z_(n).length>0)return Oe(Z_(n));const s=G_(n);return s.length>0?t.onFailure(xu(s)):Oe(n)},onSuccess:t.onSuccess})),Je=f(2,(e,t)=>Y(()=>{const n=z(e),r=Ti(n.length);let s=0;return Un(ec({while:()=>s<n.length,body:()=>t(n[s],s),step:i=>{r[s++]=i}}),r)})),ss=f(2,(e,t)=>Y(()=>{const n=z(e);let r=0;return ec({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),Al=e=>{const t=new te(Tn);return t.effect_instruction_i0=O_(Ln),t.effect_instruction_i1=()=>e,t},oe=f(2,(e,t)=>I(e,n=>w(()=>t(n)))),Pl=f(2,(e,t)=>Xi(e,{onFailure:n=>Qi(()=>t.onFailure(n)),onSuccess:n=>w(()=>t.onSuccess(n))})),Zi=f(2,(e,t)=>Vt(e,{onFailure:n=>{const r=Q_(n);switch(r._tag){case"Left":return Qi(()=>t(r.left));case"Right":return Oe(r.right)}},onSuccess:U})),jl=f(2,(e,t)=>is(n=>Vt(n(e),{onFailure:r=>{const s=V(r);return Vt(t(s),{onFailure:i=>V(ye(r,i)),onSuccess:()=>s})},onSuccess:r=>{const s=Z(r);return nc(t(s),s)}}))),Ll=f(2,(e,t)=>jl(e,zl({onFailure:n=>zi(n)?rs(t(W_(n))):Te,onSuccess:()=>Te}))),U=e=>{const t=new Rl(Ie);return t.effect_instruction_i0=e,t},Y=e=>{const t=new te(Vr);return t.commit=e,t},w=e=>{const t=new te(su);return t.effect_instruction_i0=e,t},Ib=f(e=>e.length===3||e.length===2&&!(Ur(e[1])&&"onlyEffect"in e[1]),(e,t)=>I(e,n=>{const r=typeof t=="function"?t(n):t;return Yi(r)?Un(r,n):ld(r)?Or(s=>{r.then(i=>s(U(n)),i=>s(ne(new Gl(i,"An unknown error occurred in Effect.tap"))))}):U(n)})),Eb=e=>pe(t=>{const n=t.getFiberRef(ni),r=p(n,ct(()=>t.scope()));return e(cs(ni,P(r)))}),xl=e=>{const t=new te(Tn);return t.effect_instruction_i0=_l(Ln),t.effect_instruction_i1=()=>e,t},is=e=>Tl(e,function(){const t=new te(Tn);return t.effect_instruction_i0=_l(Ln),t.effect_instruction_i1=n=>ml(n)?ce(()=>this.effect_instruction_i0(Al)):ce(()=>this.effect_instruction_i0(xl)),t}),Te=U(void 0),Ob=e=>{const t=new te(Tn);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},ec=e=>{const t=new te(_r);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},$b=e=>Y(()=>{const t=new te(fn);return t.effect_instruction_i0=e(),t}),Cb=function(){const e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return $b(()=>e(p))},tc=e=>{const t=new te(rr);return typeof(e==null?void 0:e.priority)<"u"?Gb(t,e.priority):t},Dl=f(2,(e,t)=>I(e,n=>oe(t,r=>[n,r]))),Ul=f(2,(e,t)=>I(e,n=>Un(t,n))),nc=f(2,(e,t)=>I(e,()=>t)),Rb=e=>I(Sb,t=>p(e,Tb(t))),Tb=f(2,(e,t)=>I(e.interruptAsFork(t),()=>e.await)),Mb={_tag:"All",syslog:0,label:"ALL",ordinal:Number.MIN_SAFE_INTEGER,pipe(){return C(this,arguments)}},Nb={_tag:"Fatal",syslog:2,label:"FATAL",ordinal:5e4,pipe(){return C(this,arguments)}},Fb={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return C(this,arguments)}},ql={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return C(this,arguments)}},Bl={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return C(this,arguments)}},Vl={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return C(this,arguments)}},Ab={_tag:"Trace",syslog:7,label:"TRACE",ordinal:0,pipe(){return C(this,arguments)}},Pb={_tag:"None",syslog:7,label:"OFF",ordinal:Number.MAX_SAFE_INTEGER,pipe(){return C(this,arguments)}},jb="effect/FiberRef",Lb=Symbol.for(jb),xb={_A:e=>e},rc=e=>pe(t=>Z(t.getFiberRef(e))),sc=f(2,(e,t)=>I(rc(e),t)),lo=f(2,(e,t)=>Db(e,()=>[void 0,t])),Db=f(2,(e,t)=>pe(n=>{const[r,s]=t(n.getFiberRef(e));return n.setFiberRef(e,s),U(r)})),cs=f(3,(e,t,n)=>mb(Ul(rc(t),lo(t,n)),()=>e,r=>lo(t,r))),fe=(e,t)=>Yt(e,{differ:gl(),fork:(t==null?void 0:t.fork)??q,join:t==null?void 0:t.join}),Ub=e=>{const t=a_();return Yt(e,{differ:t,fork:t.empty})},qb=e=>{const t=u_(gl());return Yt(e,{differ:t,fork:t.empty})},Kl=e=>{const t=o_();return Yt(e,{differ:t,fork:t.empty})},Yt=(e,t)=>({...Nn,[Lb]:xb,initial:e,commit(){return rc(this)},diff:(r,s)=>t.differ.diff(r,s),combine:(r,s)=>t.differ.combine(r,s),patch:r=>s=>t.differ.patch(r,s),fork:t.fork,join:t.join??((r,s)=>s)}),Bb=e=>Yt(e,{differ:no,fork:no.empty}),os=L(Symbol.for("effect/FiberRef/currentContext"),()=>Kl(Ru())),ic=L(Symbol.for("effect/FiberRef/currentSchedulingPriority"),()=>fe(0)),Vb=L(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),()=>fe(2048)),Kb=L(Symbol.for("effect/FiberRef/currentLogAnnotation"),()=>fe(Ki())),Hb=L(Symbol.for("effect/FiberRef/currentLogLevel"),()=>fe(Bl)),Jb=L(Symbol.for("effect/FiberRef/currentLogSpan"),()=>fe(jt())),Gb=f(2,(e,t)=>cs(e,ic,t)),zb=L(Symbol.for("effect/FiberRef/currentConcurrency"),()=>fe("unbounded")),Wb=L(Symbol.for("effect/FiberRef/currentRequestBatching"),()=>fe(!0)),Yb=L(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),()=>fe(P(Vl))),Qb=L(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),()=>fe(P(ql))),ti=L(Symbol.for("effect/FiberRef/currentMetricLabels"),()=>qb(Ct())),ni=L(Symbol.for("effect/FiberRef/currentForkScopeOverride"),()=>fe($(),{fork:()=>$(),join:(e,t)=>e})),Zn=L(Symbol.for("effect/FiberRef/currentInterruptedCause"),()=>fe(Dt,{fork:()=>Dt,join:(e,t)=>e})),cc=(e,t)=>e.fork(t),Hl=(function(){class e extends globalThis.Error{commit(){return ne(this)}toJSON(){const n={...this};return this.message&&(n.message=this.message),this.cause&&(n.cause=this.cause),n}[J](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}
|
|
16
|
-
${this.stack.split(`
|
|
17
|
-
`).slice(1).join(`
|
|
18
|
-
`)}`:this.toString():"Bun"in globalThis?ts(Zs(this),{renderErrorCause:!0}):this}}return Object.assign(e.prototype,Ad),e})(),Jl=(e,t)=>{class n extends Hl{constructor(){super(...arguments);u(this,"_tag",t)}}return Object.assign(n.prototype,e),n.prototype.name=t,n},fo=Symbol.for("effect/Cause/errors/RuntimeException"),Xb=Jl({[fo]:fo},"RuntimeException"),Zb=Symbol.for("effect/Cause/errors/InterruptedException"),ey=e=>A(e,Zb),ho=Symbol.for("effect/Cause/errors/NoSuchElement"),ty=Jl({[ho]:ho},"NoSuchElementException"),go=Symbol.for("effect/Cause/errors/UnknownException"),Gl=(function(){class e extends Hl{constructor(r,s){super(s??"An unknown error occurred",{cause:r});u(this,"_tag","UnknownException");u(this,"error");this.error=r}}return Object.assign(e.prototype,{[go]:go,name:"UnknownException"}),e})(),as=e=>Yi(e)&&"_tag"in e&&(e._tag==="Success"||e._tag==="Failure"),po=(e,t)=>sy(e,t!=null&&t.parallel?es:ye),V=e=>{const t=new Cl(we);return t.effect_instruction_i0=e,t},ny=e=>V(He(e)),Es=f(2,(e,t)=>{switch(e._tag){case we:return V(e.effect_instruction_i0);case Ie:return Z(t(e.effect_instruction_i0))}}),zl=f(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case we:return t(e.effect_instruction_i0);case Ie:return n(e.effect_instruction_i0)}}),Z=e=>{const t=new Rl(Ie);return t.effect_instruction_i0=e,t},et=Z(void 0),ry=f(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case we:switch(t._tag){case Ie:return V(e.effect_instruction_i0);case we:return V(n(e.effect_instruction_i0,t.effect_instruction_i0))}case Ie:switch(t._tag){case Ie:return Z(r(e.effect_instruction_i0,t.effect_instruction_i0));case we:return V(t.effect_instruction_i0)}}}),sy=(e,t)=>{const n=Lu(e);return Mt(n)?p(Ze(n),wu(p(Nt(n),Es(ge)),(r,s)=>p(r,ry(s,{onSuccess:(i,c)=>p(i,Ee(c)),onFailure:t}))),Es(Tt),Es(r=>rt(r)),P):$()},iy=e=>({...Nn,[lb]:fb,state:tl(hb([])),commit(){return Wl(this)},blockingOn:e}),Wl=e=>_b(t=>{const n=Qr(e.state);switch(n._tag){case Ol:return t(n.effect);case ns:return n.joiners.push(t),cy(e,t)}},e.blockingOn),Yl=(e,t)=>{const n=Qr(e.state);if(n._tag===ns){nl(e.state,db(t));for(let r=0,s=n.joiners.length;r<s;r++)n.joiners[r](t)}},cy=(e,t)=>w(()=>{const n=Qr(e.state);if(n._tag===ns){const r=n.joiners.indexOf(t);r>=0&&n.joiners.splice(r,1)}}),oy=pe(e=>Z(e.currentContext)),ay=()=>oy,qn=e=>I(ay(),e),uy=f(2,(e,t)=>cs(os,t)(e)),ly=f(2,(e,t)=>qn(n=>uy(e,t(n)))),Ql=e=>{const t=e.currentSpan;return t!==void 0&&t._tag==="Span"?P(t):$()},mo=Symbol.for("effect/MutableHashMap"),fy={[mo]:mo,[Symbol.iterator](){return new oc(this)},toString(){return ee(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(X)}},[J](){return this.toJSON()},pipe(){return C(this,arguments)}};class oc{constructor(t){u(this,"self");u(this,"referentialIterator");u(this,"bucketIterator");this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new hy(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new oc(this.self)}}class hy{constructor(t){u(this,"backing");u(this,"currentBucket");this.backing=t}next(){if(this.currentBucket===void 0){const n=this.backing.next();if(n.done)return n;this.currentBucket=n.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const dy=()=>{const e=Object.create(fy);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},Xe=f(2,(e,t)=>{if(gr(t)===!1)return e.referential.has(t)?P(e.referential.get(t)):$();const n=t[N](),r=e.buckets.get(n);return r===void 0?$():gy(e,r,t)}),gy=(e,t,n,r=!1)=>{for(let s=0,i=t.length;s<i;s++)if(n[R](t[s][0])){const c=t[s][1];return r&&(t.splice(s,1),e.bucketsSize--),P(c)}return $()},nn=f(2,(e,t)=>Re(Xe(e,t))),rn=f(3,(e,t,n)=>{if(gr(t)===!1)return e.referential.set(t,n),e;const r=t[N](),s=e.buckets.get(r);return s===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(py(e,s,t),s.push([t,n]),e.bucketsSize++,e)}),py=(e,t,n)=>{for(let r=0,s=t.length;r<s;r++)if(n[R](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},my="effect/Clock",_o=Symbol.for(my),ac=pt("effect/Clock"),_y=2**31-1,bo={unsafeSchedule(e,t){const n=Bs(t);if(n>_y)return Fs;let r=!1;const s=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(s),!r)}},yo=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now!="function")return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))})(),by=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return yo;const t=yo()-e.bigint();return()=>t+e.bigint()})();var na;na=_o;class yy{constructor(){u(this,na,_o);u(this,"currentTimeMillis",w(()=>this.unsafeCurrentTimeMillis()));u(this,"currentTimeNanos",w(()=>this.unsafeCurrentTimeNanos()))}unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return by()}scheduler(){return U(bo)}sleep(t){return ft(n=>{const r=bo.unsafeSchedule(()=>n(Te),t);return rs(w(r))})}}const Sy=()=>new yy,Xl="And",Zl="Or",ef="InvalidData",tf="MissingData",nf="SourceUnavailable",rf="Unsupported",vy="effect/ConfigError",So=Symbol.for(vy),Qt={_tag:"ConfigError",[So]:So},sf=(e,t)=>{const n=Object.create(Qt);return n._op=Xl,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},cf=(e,t)=>{const n=Object.create(Qt);return n._op=Zl,n.left=e,n.right=t,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,"message",{enumerable:!1,get(){return this.toString()}}),n},ky=(e,t,n={pathDelim:"."})=>{const r=Object.create(Qt);return r._op=ef,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Invalid data at ${p(this.path,Ht(n.pathDelim))}: "${this.message}")`}}),r},ht=(e,t,n={pathDelim:"."})=>{const r=Object.create(Qt);return r._op=tf,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Missing data at ${p(this.path,Ht(n.pathDelim))}: "${this.message}")`}}),r},wy=(e,t,n,r={pathDelim:"."})=>{const s=Object.create(Qt);return s._op=nf,s.path=e,s.message=t,s.cause=n,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${p(this.path,Ht(r.pathDelim))}: "${this.message}")`}}),s},Iy=(e,t,n={pathDelim:"."})=>{const r=Object.create(Qt);return r._op=rf,r.path=e,r.message=t,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${p(this.path,Ht(n.pathDelim))}: "${this.message}")`}}),r},tt=f(2,(e,t)=>{switch(e._op){case Xl:return sf(tt(e.left,t),tt(e.right,t));case Zl:return cf(tt(e.left,t),tt(e.right,t));case ef:return ky([...t,...e.path],e.message);case tf:return ht([...t,...e.path],e.message);case nf:return wy([...t,...e.path],e.message,e.cause);case rf:return Iy([...t,...e.path],e.message)}}),Ey={_tag:"Empty"},Os=f(2,(e,t)=>{let n=Hi(t),r=e;for(;pm(n);){const s=n.head;switch(s._tag){case"Empty":{n=n.tail;break}case"AndThen":{n=ut(s.first,ut(s.second,n.tail));break}case"MapName":{r=St(r,s.f),n=n.tail;break}case"Nested":{r=br(r,s.name),n=n.tail;break}case"Unnested":{if(p(hn(r),Zd(s.name)))r=$t(r),n=n.tail;else return Ot(ht(r,`Expected ${s.name} to be in path in ConfigProvider#unnested`));break}}}return je(r)}),Oy="Constant",$y="Fail",Cy="Fallback",Ry="Described",Ty="Lazy",My="MapOrFail",Ny="Nested",Fy="Primitive",Ay="Sequence",Py="HashMap",jy="ZipWith";var vo={};const $r=(e,t)=>[...e,...t],Ly="effect/ConfigProvider",ko=Symbol.for(Ly),xy=pt("effect/ConfigProvider"),Dy="effect/ConfigProviderFlat",wo=Symbol.for(Dy),Uy=e=>({[ko]:ko,pipe(){return C(this,arguments)},...e}),qy=e=>({[wo]:wo,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),By=e=>Uy({load:t=>I(be(e,Ct(),t,!1),n=>gt(hn(n),{onNone:()=>ne(ht(Ct(),`Expected a single value having structure: ${t}`)),onSome:U})),flattened:e}),Vy=e=>{const{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:"_",seqDelim:","},e),r=a=>p(a,Ht(t)),s=a=>a.split(t),i=()=>typeof process<"u"&&"env"in process&&typeof vo=="object"?vo:{};return By(qy({load:(a,l,h=!0)=>{const d=r(a),g=i(),m=d in g?P(g[d]):$();return p(m,Zi(()=>ht(a,`Expected ${d} to exist in the process context`)),I(_=>zy(_,a,l,n,h)))},enumerateChildren:a=>w(()=>{const l=i(),g=Object.keys(l).map(m=>s(m.toUpperCase())).filter(m=>{for(let _=0;_<a.length;_++){const v=p(a,vu(_)),b=m[_];if(b===void 0||v!==b)return!1}return!0}).flatMap(m=>m.slice(a.length,a.length+1));return Wp(g)}),patch:Ey}))},Ky=(e,t,n,r)=>{const s=Kc(n.length,a=>a>=r.length?$():P([e(a),a+1])),i=Kc(r.length,a=>a>=n.length?$():P([t(a),a+1])),c=$r(n,s),o=$r(r,i);return[c,o]},Hy=(e,t)=>{let n=t;if(n._tag==="Nested"){const r=e.slice();for(;n._tag==="Nested";)r.push(n.name),n=n.config;return r}return e},be=(e,t,n,r)=>{const s=n;switch(s._tag){case Oy:return U(Se(s.value));case Ry:return Y(()=>be(e,t,s.config,r));case $y:return ne(ht(t,s.message));case Cy:return p(Y(()=>be(e,t,s.first,r)),oo(i=>s.condition(i)?p(be(e,t,s.second,r),oo(c=>ne(cf(i,c)))):ne(i)));case Ty:return Y(()=>be(e,t,s.config(),r));case My:return Y(()=>p(be(e,t,s.original,r),I(Je(i=>p(s.mapOrFail(i),Zi(tt(Hy(t,s.original))))))));case Ny:return Y(()=>be(e,$r(t,Se(s.name)),s.config,r));case Fy:return p(Os(t,e.patch),I(i=>p(e.load(i,s,r),I(c=>{if(c.length===0){const o=p(ug(i),ct(()=>"<n/a>"));return ne(ht([],`Expected ${s.description} with name ${o}`))}return U(c)}))));case Ay:return p(Os(t,e.patch),I(i=>p(e.enumerateChildren(i),I(Yy),I(c=>c.length===0?Y(()=>oe(be(e,t,s.config,!0),Se)):p(Je(c,o=>be(e,rg(t,`[${o}]`),s.config,!0)),oe(o=>{const a=Sg(o);return a.length===0?Se(Ct()):Se(a)}))))));case Py:return Y(()=>p(Os(t,e.patch),I(i=>p(e.enumerateChildren(i),I(c=>p(c,Je(o=>be(e,$r(i,Se(o)),s.valueConfig,r)),oe(o=>o.length===0?Se(Ki()):p(Wy(o),St(a=>cm(Vc(z(c),a)))))))))));case jy:return Y(()=>p(be(e,t,s.left,r),wn,I(i=>p(be(e,t,s.right,r),wn,I(c=>{if(an(i)&&an(c))return ne(sf(i.left,c.left));if(an(i)&&Yn(c))return ne(i.left);if(Yn(i)&&an(c))return ne(c.left);if(Yn(i)&&Yn(c)){const o=p(t,Ht(".")),a=Jy(t,o),[l,h]=Ky(a,a,p(i.right,St(je)),p(c.right,St(je)));return p(l,Vc(h),Je(([d,g])=>p(Dl(d,g),oe(([m,_])=>s.zip(m,_)))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")})))))}},Jy=(e,t)=>n=>Ot(ht(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),Gy=(e,t)=>e.split(new RegExp(`\\s*${kg(t)}\\s*`)),zy=(e,t,n,r,s)=>s?p(Gy(e,r),Je(i=>n.parse(i.trim())),Zi(tt(t))):p(n.parse(e),Pl({onFailure:tt(t),onSuccess:Se})),Wy=e=>Object.keys(e[0]).map(t=>e.map(n=>n[t])),Yy=e=>p(Je(e,Xy),Pl({onFailure:()=>Ct(),onSuccess:yr(mn)}),wn,oe(Kd)),Qy=/^(\[(\d+)\])$/,Xy=e=>{const t=e.match(Qy);if(t!==null){const n=t[2];return p(n!==void 0&&n.length>0?P(n):$(),Yd(Zy))}return $()},Zy=e=>{const t=Number.parseInt(e);return Number.isNaN(t)?$():P(t)},Io=Symbol.for("effect/Console"),of=pt("effect/Console"),eS={[Io]:Io,assert(e,...t){return w(()=>{console.assert(e,...t)})},clear:w(()=>{console.clear()}),count(e){return w(()=>{console.count(e)})},countReset(e){return w(()=>{console.countReset(e)})},debug(...e){return w(()=>{console.debug(...e)})},dir(e,t){return w(()=>{console.dir(e,t)})},dirxml(...e){return w(()=>{console.dirxml(...e)})},error(...e){return w(()=>{console.error(...e)})},group(e){return e!=null&&e.collapsed?w(()=>console.groupCollapsed(e==null?void 0:e.label)):w(()=>console.group(e==null?void 0:e.label))},groupEnd:w(()=>{console.groupEnd()}),info(...e){return w(()=>{console.info(...e)})},log(...e){return w(()=>{console.log(...e)})},table(e,t){return w(()=>{console.table(e,t)})},time(e){return w(()=>console.time(e))},timeEnd(e){return w(()=>console.timeEnd(e))},timeLog(e,...t){return w(()=>{console.timeLog(e,...t)})},trace(...e){return w(()=>{console.trace(...e)})},warn(...e){return w(()=>{console.warn(...e)})},unsafe:console},tS="effect/Random",Eo=Symbol.for(tS),nS=pt("effect/Random");var ra;ra=Eo;class rS{constructor(t){u(this,"seed");u(this,ra,Eo);u(this,"PRNG");this.seed=t,this.PRNG=new _d(t)}get next(){return w(()=>this.PRNG.number())}get nextBoolean(){return oe(this.next,t=>t>.5)}get nextInt(){return w(()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER))}nextRange(t,n){return oe(this.next,r=>(n-t)*r+t)}nextIntBetween(t,n){return w(()=>this.PRNG.integer(n-t)+t)}shuffle(t){return sS(t,n=>this.nextIntBetween(0,n))}}const sS=(e,t)=>Y(()=>p(w(()=>Array.from(e)),I(n=>{const r=[];for(let s=n.length;s>=2;s=s-1)r.push(s);return p(r,ss(s=>p(t(s),oe(i=>iS(n,s-1,i)))),Un(Lu(n)))}))),iS=(e,t,n)=>{const r=e[t];return e[t]=e[n],e[n]=r,e},cS=e=>new rS(S(e)),Oo=Symbol.for("effect/Tracer"),oS=e=>({[Oo]:Oo,...e}),af=pt("effect/Tracer"),uf=pt("effect/ParentSpan"),$o=(function(){const e="abcdef0123456789",t=e.length;return function(n){let r="";for(let s=0;s<n;s++)r+=e.charAt(Math.floor(Math.random()*t));return r}})();class aS{constructor(t,n,r,s,i,c){u(this,"name");u(this,"parent");u(this,"context");u(this,"startTime");u(this,"kind");u(this,"_tag","Span");u(this,"spanId");u(this,"traceId","native");u(this,"sampled",!0);u(this,"status");u(this,"attributes");u(this,"events",[]);u(this,"links");this.name=t,this.parent=n,this.context=r,this.startTime=i,this.kind=c,this.status={_tag:"Started",startTime:i},this.attributes=new Map,this.traceId=n._tag==="Some"?n.value.traceId:$o(32),this.spanId=$o(16),this.links=Array.from(s)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}}const uS=oS({span:(e,t,n,r,s,i)=>new aS(e,t,n,r,s,i),context:e=>e()}),lS=p(Ru(),tn(ac,Sy()),tn(of,eS),tn(nS,cS(Math.random())),tn(xy,Vy()),tn(af,uS)),Cr=L(Symbol.for("effect/DefaultServices/currentServices"),()=>Kl(lS)),Co=Symbol.for("effect/FiberRefs");var sa;sa=Co;class In{constructor(t){u(this,"locals");u(this,sa,Co);this.locals=t}pipe(){return C(this,arguments)}}const fS=(e,t,n,r=!1)=>{const s=e;let i=t,c=n,o=r,a;for(;a===void 0;)if(de(i)&&de(c)){const l=le(i)[0],h=$t(i),d=le(c)[0],g=le(c)[1],m=$t(c);l.startTimeMillis<d.startTimeMillis?(c=m,o=!0):l.startTimeMillis>d.startTimeMillis?i=h:l.id<d.id?(c=m,o=!0):l.id>d.id?i=h:a=[g,o]}else a=[s.initial,!0];return a},hS=f(3,(e,t,n)=>{const r=new Map(e.locals);return n.locals.forEach((s,i)=>{const c=s[0][1];if(!s[0][0][R](t)){if(!r.has(i)){if(F(c,i.initial))return;r.set(i,[[t,i.join(i.initial,c)]]);return}const o=r.get(i),[a,l]=fS(i,o,s);if(l){const h=i.diff(a,c),d=o[0][1],g=i.join(d,i.patch(h)(d));if(!F(d,g)){let m;const _=o[0][0];_[R](t)?m=[[_,g],...o.slice(1)]:m=[[t,g],...o],r.set(i,m)}}}}),new In(r)}),dS=f(2,(e,t)=>{const n=new Map;return gS(e,n,t),new In(n)}),gS=(e,t,n)=>{e.locals.forEach((r,s)=>{const i=r[0][1],c=s.patch(s.fork)(i);F(i,c)?t.set(s,r):t.set(s,[[n,c],...r])})},lf=f(2,(e,t)=>{const n=new Map(e.locals);return n.delete(t),new In(n)}),pS=f(2,(e,t)=>e.locals.has(t)?P(le(e.locals.get(t))[1]):$()),En=f(2,(e,t)=>p(pS(e,t),ct(()=>t.initial))),ri=f(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new In(new Map([[n,[[t,r]]]]));const s=new Map(e.locals);return mS(s,t,n,r),new In(s)}),mS=(e,t,n,r)=>{const s=e.get(n)??[];let i;if(de(s)){const[c,o]=le(s);if(c[R](t)){if(F(o,r))return;i=[[t,r],...s.slice(1)]}else i=[[t,r],...s]}else i=[[t,r]];e.set(n,i)},_S=En,bS=Mb,yS=Nb,SS=Fb,vS=ql,kS=Bl,wS=Vl,IS=Ab,ES=Pb,OS=p(mn,Jd(e=>e.ordinal)),$S=Gd(OS),CS=e=>{switch(e){case"All":return bS;case"Debug":return wS;case"Error":return SS;case"Fatal":return yS;case"Info":return kS;case"Trace":return IS;case"None":return ES;case"Warning":return vS}},ff=e=>e.replace(/[\s="]/g,"_"),RS=e=>t=>`${ff(t.label)}=${e-t.startTime}ms`,TS=Mn,MS=Pd;class NS extends MS{}const hf="Empty",df="Add",gf="Remove",pf="Update",mf="AndThen",FS={_tag:hf},AS=(e,t)=>{const n=new Map(e.locals);let r=FS;for(const[s,i]of t.locals.entries()){const c=le(i)[1],o=n.get(s);if(o!==void 0){const a=le(o)[1];F(a,c)||(r=$s({_tag:pf,fiberRef:s,patch:s.diff(a,c)})(r))}else r=$s({_tag:df,fiberRef:s,value:c})(r);n.delete(s)}for(const[s]of n.entries())r=$s({_tag:gf,fiberRef:s})(r);return r},$s=f(2,(e,t)=>({_tag:mf,first:e,second:t})),PS=f(3,(e,t,n)=>{let r=n,s=Se(e);for(;de(s);){const i=le(s),c=$t(s);switch(i._tag){case hf:{s=c;break}case df:{r=ri(r,{fiberId:t,fiberRef:i.fiberRef,value:i.value}),s=c;break}case gf:{r=lf(r,i.fiberRef),s=c;break}case pf:{const o=En(r,i.fiberRef);r=ri(r,{fiberId:t,fiberRef:i.fiberRef,value:i.fiberRef.patch(i.patch)(o)}),s=c;break}case mf:{s=br(i.first)(br(i.second)(c));break}}}return r}),_f="effect/MetricLabel",si=Symbol.for(_f);var ia;class jS{constructor(t,n){u(this,"key");u(this,"value");u(this,ia,si);u(this,"_hash");this.key=t,this.value=n,this._hash=H(_f+this.key+this.value)}[(ia=si,N)](){return this._hash}[R](t){return xS(t)&&this.key===t.key&&this.value===t.value}pipe(){return C(this,arguments)}}const LS=(e,t)=>new jS(e,t),xS=e=>A(e,si),DS=e=>{let t,n;typeof e=="function"?t=e:(t=e.try,n=e.catch);const r=s=>n?Qi(()=>n(s)):ne(new Gl(s,"An unknown error occurred in Effect.tryPromise"));return t.length>=1?ft((s,i)=>{try{t(i).then(c=>s(U(c)),c=>s(r(c)))}catch(c){s(r(c))}}):ft(s=>{try{t().then(i=>s(U(i)),i=>s(r(i)))}catch(i){s(r(i))}})},US="Sequential",qS="Parallel",BS="ParallelN",VS={_tag:US},KS={_tag:qS},HS=e=>({_tag:BS,parallelism:e}),ii=VS,ci=KS,oi=HS,JS=AS,GS=PS,us="effect/FiberStatus",dt=Symbol.for(us),Rr="Done",Ro="Running",To="Suspended",zS=H(`${us}-${Rr}`);var ca;class WS{constructor(){u(this,ca,dt);u(this,"_tag",Rr)}[(ca=dt,N)](){return zS}[R](t){return uc(t)&&t._tag===Rr}}var oa;class YS{constructor(t){u(this,"runtimeFlags");u(this,oa,dt);u(this,"_tag",Ro);this.runtimeFlags=t}[(oa=dt,N)](){return p(S(us),j(S(this._tag)),j(S(this.runtimeFlags)),K(this))}[R](t){return uc(t)&&t._tag===Ro&&this.runtimeFlags===t.runtimeFlags}}var aa;class QS{constructor(t,n){u(this,"runtimeFlags");u(this,"blockingOn");u(this,aa,dt);u(this,"_tag",To);this.runtimeFlags=t,this.blockingOn=n}[(aa=dt,N)](){return p(S(us),j(S(this._tag)),j(S(this.runtimeFlags)),j(S(this.blockingOn)),K(this))}[R](t){return uc(t)&&t._tag===To&&this.runtimeFlags===t.runtimeFlags&&F(this.blockingOn,t.blockingOn)}}const XS=new WS,ZS=e=>new YS(e),e0=(e,t)=>new QS(e,t),uc=e=>A(e,dt),t0=e=>e._tag===Rr,n0=XS,bf=ZS,r0=e0,s0=t0,i0=Symbol.for("effect/Micro"),Tr=Symbol.for("effect/Micro/MicroExit"),Mo=Symbol.for("effect/Micro/MicroCause"),c0={_E:q};var ua;class yf extends globalThis.Error{constructor(n,r,s){const i=`MicroCause.${n}`;let c,o,a;if(r instanceof globalThis.Error){c=`(${i}) ${r.name}`,o=r.message;const l=o.split(`
|
|
19
|
-
`).length;a=r.stack?`(${i}) ${r.stack.split(`
|
|
20
|
-
`).slice(0,l+3).join(`
|
|
21
|
-
`)}`:`${c}: ${o}`}else c=i,o=It(r,0),a=`${c}: ${o}`;s.length>0&&(a+=`
|
|
22
|
-
${s.join(`
|
|
23
|
-
`)}`);super(o);u(this,"_tag");u(this,"traces");u(this,ua);this._tag=n,this.traces=s,this[Mo]=c0,this.name=c,this.stack=a}pipe(){return C(this,arguments)}toString(){return this.stack}[(ua=Mo,J)](){return this.stack}}class o0 extends yf{constructor(n,r=[]){super("Die",n,r);u(this,"defect");this.defect=n}}const a0=(e,t=[])=>new o0(e,t);class u0 extends yf{constructor(t=[]){super("Interrupt","interrupted",t)}}const l0=(e=[])=>new u0(e),f0=e=>e._tag==="Interrupt",No=Symbol.for("effect/Micro/MicroFiber"),h0={_A:q,_E:q};var la;la=No;class d0{constructor(t,n=!0){u(this,"context");u(this,"interruptible");u(this,la);u(this,"_stack",[]);u(this,"_observers",[]);u(this,"_exit");u(this,"_children");u(this,"currentOpCount",0);u(this,"_interrupted",!1);u(this,"_yielded");this.context=t,this.interruptible=n,this[No]=h0}getRef(t){return jg(this.context,t)}addObserver(t){return this._exit?(t(this._exit),sd):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(gc))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(t);if(n===er)return;const r=Fo.interruptChildren&&Fo.interruptChildren(this);if(r!==void 0)return this.evaluate(Nr(r,()=>n));this._exit=n;for(let s=0;s<this._observers.length;s++)this._observers[s](n);this._observers.length=0}runLoop(t){let n=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!n&&this.getRef(pc).shouldYield(this)){n=!0;const s=r;r=Nr(b0,()=>s)}if(r=r[ai](this),r===er){const s=this._yielded;return Tr in s?(this._yielded=void 0,s):er}}}catch(s){return A(r,ai)?ui(s):ui(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[Mr]&&n[Mr](this);if(r)return{[t]:r};if(n[t])return n}}yieldWith(t){return this._yielded=t,er}children(){return this._children??(this._children=new Set)}}const Fo=L("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),Sf=Symbol.for("effect/Micro/identifier"),Q=Symbol.for("effect/Micro/args"),ai=Symbol.for("effect/Micro/evaluate"),Kt=Symbol.for("effect/Micro/successCont"),wt=Symbol.for("effect/Micro/failureCont"),Mr=Symbol.for("effect/Micro/ensureCont"),er=Symbol.for("effect/Micro/Yield"),g0={_A:q,_E:q,_R:q},p0={...TS,_op:"Micro",[i0]:g0,pipe(){return C(this,arguments)},[Symbol.iterator](){return new Xa(new Cn(this))},toJSON(){return{_id:"Micro",op:this[Sf],...Q in this?{args:this[Q]}:void 0}},toString(){return ee(this)},[J](){return ee(this)}};function m0(e){return ui("Micro.evaluate: Not implemented")}const ls=e=>({...p0,[Sf]:e.op,[ai]:e.eval??m0,[Kt]:e.contA,[wt]:e.contE,[Mr]:e.ensure}),lc=e=>{const t=ls(e);return function(){const n=Object.create(t);return n[Q]=e.single===!1?arguments:arguments[0],n}},vf=e=>{const t={...ls(e),[Tr]:Tr,_tag:e.op,get[e.prop](){return this[Q]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[Q]}},[R](n){return v0(n)&&n._tag===e.op&&F(this[Q],n[Q])},[N](){return K(this,j(H(e.op))(S(this[Q])))}};return function(n){const r=Object.create(t);return r[Q]=n,r[Kt]=void 0,r[wt]=void 0,r[Mr]=void 0,r}},fc=vf({op:"Success",prop:"value",eval(e){const t=e.getCont(Kt);return t?t[Kt](this[Q],e):e.yieldWith(this)}}),kf=vf({op:"Failure",prop:"cause",eval(e){let t=e.getCont(wt);for(;f0(this[Q])&&t&&e.interruptible;)t=e.getCont(wt);return t?t[wt](this[Q],e):e.yieldWith(this)}}),_0=lc({op:"Yield",eval(e){let t=!1;return e.getRef(pc).scheduleTask(()=>{t||e.evaluate(k0)},this[Q]??0),e.yieldWith(()=>{t=!0})}}),b0=_0(0),y0=fc(void 0),hc=lc({op:"WithMicroFiber",eval(e){return this[Q](e)}}),Nr=f(2,(e,t)=>{const n=Object.create(S0);return n[Q]=e,n[Kt]=t,n}),S0=ls({op:"OnSuccess",eval(e){return e._stack.push(this),this[Q]}}),v0=e=>A(e,Tr),wf=fc,dc=kf,gc=dc(l0()),ui=e=>dc(a0(e)),k0=wf(void 0),w0="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class If{constructor(){u(this,"tasks",[]);u(this,"running",!1);u(this,"afterScheduled",()=>{this.running=!1,this.runTasks()})}scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,w0(this.afterScheduled))}runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n<r;n++)t[n]()}shouldYield(t){return t.currentOpCount>=t.getRef(O0)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const I0=f(2,(e,t)=>hc(n=>{const r=n.context;return n.context=t(r),R0(e,()=>(n.context=r,y0))})),E0=f(2,(e,t)=>I0(e,Nu(t)));class O0 extends Fu()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class pc extends Fu()("effect/Micro/currentScheduler",{defaultValue:()=>new If}){}const $0=f(2,(e,t)=>{const n=Object.create(C0);return n[Q]=e,n[Kt]=t.onSuccess,n[wt]=t.onFailure,n}),C0=ls({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[Q]}}),R0=f(2,(e,t)=>M0(n=>$0(n(e),{onFailure:r=>Nr(t(dc(r)),()=>kf(r)),onSuccess:r=>Nr(t(wf(r)),()=>fc(r))}))),Ef=lc({op:"SetInterruptible",ensure(e){if(e.interruptible=this[Q],e._interrupted&&e.interruptible)return()=>gc}}),T0=e=>hc(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(Ef(!1)),t._interrupted?gc:e)),M0=e=>hc(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ef(!0)),e(T0)):e(q)),N0=(e,t)=>{const n=new d0(pc.context(new If));return n.evaluate(e),n};class F0{constructor(){u(this,"buckets",[])}scheduleTask(t,n){const r=this.buckets.length;let s,i=0;for(;i<r&&this.buckets[i][0]<=n;i++)s=this.buckets[i];s&&s[0]===n?s[1].push(t):i===r?this.buckets.push([n,[t]]):this.buckets.splice(i,0,[n,[t]])}}class A0{constructor(t){u(this,"maxNextTickBeforeTimer");u(this,"running",!1);u(this,"tasks",new F0);this.maxNextTickBeforeTimer=t}starveInternal(t){const n=this.tasks.buckets;this.tasks.buckets=[];for(const[r,s]of n)for(let i=0;i<s.length;i++)s[i]();this.tasks.buckets.length===0?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(Vb)?t.getFiberRef(ic):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const P0=L(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new A0(2048)),j0=L(Symbol.for("effect/FiberRef/currentScheduler"),()=>fe(P0)),Of=L(Symbol.for("effect/FiberRef/currentRequestMap"),()=>fe(new Map)),Ao=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return sc(zb,s=>s==="unbounded"?n():s>1?r(s):t());default:return e>1?r(e):t()}},mc="InterruptSignal",_c="Stateful",bc="Resume",yc="YieldNow",Cs=e=>({_tag:mc,cause:e}),ur=e=>({_tag:_c,onFiber:e}),_t=e=>({_tag:bc,effect:e}),L0=()=>({_tag:yc}),x0="effect/FiberScope",Fr=Symbol.for(x0);var fa;fa=Fr;class D0{constructor(){u(this,fa,Fr);u(this,"fiberId",Pt);u(this,"roots",new Set)}add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}var ha;ha=Fr;class U0{constructor(t,n){u(this,"fiberId");u(this,"parent");u(this,ha,Fr);this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(ur(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const q0=e=>new U0(e.id(),e),$f=L(Symbol.for("effect/FiberScope/Global"),()=>new D0),B0="effect/Fiber",V0=Symbol.for(B0),K0={_E:e=>e,_A:e=>e},H0="effect/Fiber",J0=Symbol.for(H0),Cf=e=>Ul(Fl(e.await),e.inheritAll);({...Nn});const Ye="effect/FiberCurrent",G0="effect/Logger",z0=Symbol.for(G0),W0={_Message:e=>e,_Output:e=>e},Sc=e=>({[z0]:W0,log:e,pipe(){return C(this,arguments)}}),Y0=/^[^\s"=]*$/,Q0=(e,t)=>({annotations:n,cause:r,date:s,fiberId:i,logLevel:c,message:o,spans:a})=>{const l=_=>_.match(Y0)?_:e(_),h=(_,v)=>`${ff(_)}=${l(v)}`,d=(_,v)=>" "+h(_,v);let g=h("timestamp",s.toISOString());g+=d("level",c.label),g+=d("fiber",sl(i));const m=ng(o);for(let _=0;_<m.length;_++)g+=d("message",It(m[_],t));K_(r)||(g+=d("cause",ts(r,{renderErrorCause:!0})));for(const _ of a)g+=" "+RS(s.getTime())(_);for(const[_,v]of n)g+=d(_,It(v,t));return g},X0=e=>`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,Z0=Sc(Q0(X0)),ev=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;ev&&process.stdout.isTTY;const Rf="effect/MetricBoundaries",li=Symbol.for(Rf);var da;class tv{constructor(t){u(this,"values");u(this,da,li);u(this,"_hash");this.values=t,this._hash=p(H(Rf),j(Rn(this.values)))}[(da=li,N)](){return this._hash}[R](t){return nv(t)&&F(this.values,t.values)}pipe(){return C(this,arguments)}}const nv=e=>A(e,li),rv=e=>{const t=p(e,yu(ge(Number.POSITIVE_INFINITY)),vg);return new tv(t)},sv=e=>p(tg(e.count-1,t=>e.start*Math.pow(e.factor,t)),Kr,rv),iv="effect/MetricKeyType",Tf=Symbol.for(iv),Mf="effect/MetricKeyType/Counter",fi=Symbol.for(Mf),cv="effect/MetricKeyType/Frequency",ov=Symbol.for(cv),av="effect/MetricKeyType/Gauge",uv=Symbol.for(av),Nf="effect/MetricKeyType/Histogram",hi=Symbol.for(Nf),lv="effect/MetricKeyType/Summary",fv=Symbol.for(lv),Ff={_In:e=>e,_Out:e=>e};var ga,pa;class hv{constructor(t,n){u(this,"incremental");u(this,"bigint");u(this,pa,Ff);u(this,ga,fi);u(this,"_hash");this.incremental=t,this.bigint=n,this._hash=H(Mf)}[(pa=Tf,ga=fi,N)](){return this._hash}[R](t){return Af(t)}pipe(){return C(this,arguments)}}var ma,_a;class dv{constructor(t){u(this,"boundaries");u(this,_a,Ff);u(this,ma,hi);u(this,"_hash");this.boundaries=t,this._hash=p(H(Nf),j(S(this.boundaries)))}[(_a=Tf,ma=hi,N)](){return this._hash}[R](t){return Pf(t)&&F(this.boundaries,t.boundaries)}pipe(){return C(this,arguments)}}const gv=e=>new hv((e==null?void 0:e.incremental)??!1,(e==null?void 0:e.bigint)??!1),pv=e=>new dv(e),Af=e=>A(e,fi),mv=e=>A(e,ov),_v=e=>A(e,uv),Pf=e=>A(e,hi),bv=e=>A(e,fv),yv="effect/MetricKey",jf=Symbol.for(yv),Sv={_Type:e=>e},vv=Mi(F);var ba;class vc{constructor(t,n,r,s=[]){u(this,"name");u(this,"keyType");u(this,"description");u(this,"tags");u(this,ba,Sv);u(this,"_hash");this.name=t,this.keyType=n,this.description=r,this.tags=s,this._hash=p(H(this.name+this.description),j(S(this.keyType)),j(Rn(this.tags)))}[(ba=jf,N)](){return this._hash}[R](t){return kv(t)&&this.name===t.name&&F(this.keyType,t.keyType)&&F(this.description,t.description)&&vv(this.tags,t.tags)}pipe(){return C(this,arguments)}}const kv=e=>A(e,jf),wv=(e,t)=>new vc(e,gv(t),Ri(t==null?void 0:t.description)),Iv=(e,t,n)=>new vc(e,pv(t),Ri(n)),Ev=f(2,(e,t)=>t.length===0?e:new vc(e.name,e.keyType,e.description,sr(e.tags,t))),Ov="effect/MetricState",Bn=Symbol.for(Ov),Lf="effect/MetricState/Counter",di=Symbol.for(Lf),xf="effect/MetricState/Frequency",gi=Symbol.for(xf),Df="effect/MetricState/Gauge",pi=Symbol.for(Df),Uf="effect/MetricState/Histogram",mi=Symbol.for(Uf),qf="effect/MetricState/Summary",_i=Symbol.for(qf),Vn={_A:e=>e};var ya,Sa;class $v{constructor(t){u(this,"count");u(this,Sa,Vn);u(this,ya,di);this.count=t}[(Sa=Bn,ya=di,N)](){return p(S(Lf),j(S(this.count)),K(this))}[R](t){return xv(t)&&this.count===t.count}pipe(){return C(this,arguments)}}const Cv=Mi(F);var va,ka;class Rv{constructor(t){u(this,"occurrences");u(this,ka,Vn);u(this,va,gi);u(this,"_hash");this.occurrences=t}[(ka=Bn,va=gi,N)](){return p(H(xf),j(Rn(z(this.occurrences.entries()))),K(this))}[R](t){return Dv(t)&&Cv(z(this.occurrences.entries()),z(t.occurrences.entries()))}pipe(){return C(this,arguments)}}var wa,Ia;class Tv{constructor(t){u(this,"value");u(this,Ia,Vn);u(this,wa,pi);this.value=t}[(Ia=Bn,wa=pi,N)](){return p(S(Df),j(S(this.value)),K(this))}[R](t){return Uv(t)&&this.value===t.value}pipe(){return C(this,arguments)}}var Ea,Oa;class Mv{constructor(t,n,r,s,i){u(this,"buckets");u(this,"count");u(this,"min");u(this,"max");u(this,"sum");u(this,Oa,Vn);u(this,Ea,mi);this.buckets=t,this.count=n,this.min=r,this.max=s,this.sum=i}[(Oa=Bn,Ea=mi,N)](){return p(S(Uf),j(S(this.buckets)),j(S(this.count)),j(S(this.min)),j(S(this.max)),j(S(this.sum)),K(this))}[R](t){return qv(t)&&F(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return C(this,arguments)}}var $a,Ca;class Nv{constructor(t,n,r,s,i,c){u(this,"error");u(this,"quantiles");u(this,"count");u(this,"min");u(this,"max");u(this,"sum");u(this,Ca,Vn);u(this,$a,_i);this.error=t,this.quantiles=n,this.count=r,this.min=s,this.max=i,this.sum=c}[(Ca=Bn,$a=_i,N)](){return p(S(qf),j(S(this.error)),j(S(this.quantiles)),j(S(this.count)),j(S(this.min)),j(S(this.max)),j(S(this.sum)),K(this))}[R](t){return Bv(t)&&this.error===t.error&&F(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return C(this,arguments)}}const Fv=e=>new $v(e),Av=e=>new Rv(e),Pv=e=>new Tv(e),jv=e=>new Mv(e.buckets,e.count,e.min,e.max,e.sum),Lv=e=>new Nv(e.error,e.quantiles,e.count,e.min,e.max,e.sum),xv=e=>A(e,di),Dv=e=>A(e,gi),Uv=e=>A(e,pi),qv=e=>A(e,mi),Bv=e=>A(e,_i),Vv="effect/MetricHook",Kv=Symbol.for(Vv),Hv={_In:e=>e,_Out:e=>e},Kn=e=>({[Kv]:Hv,pipe(){return C(this,arguments)},...e}),Po=BigInt(0),Jv=e=>{let t=e.keyType.bigint?Po:0;const n=e.keyType.incremental?e.keyType.bigint?s=>s>=Po:s=>s>=0:s=>!0,r=s=>{n(s)&&(t=t+s)};return Kn({get:()=>Fv(t),update:r,modify:r})},Gv=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const s=t.get(r)??0;t.set(r,s+1)};return Kn({get:()=>Av(t),update:n,modify:n})},zv=(e,t)=>{let n=t;return Kn({get:()=>Pv(n),update:r=>{n=r},modify:r=>{n=n+r}})},Wv=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),s=new Float64Array(n);let i=0,c=0,o=Number.MAX_VALUE,a=Number.MIN_VALUE;p(t,yr(mn),St((d,g)=>{s[g]=d}));const l=d=>{let g=0,m=n;for(;g!==m;){const _=Math.floor(g+(m-g)/2),v=s[_];d<=v?m=_:g=_,m===g+1&&(d<=s[g]?m=g:g=m)}r[g]=r[g]+1,i=i+1,c=c+d,d<o&&(o=d),d>a&&(a=d)},h=()=>{const d=Ti(n);let g=0;for(let m=0;m<n;m++){const _=s[m],v=r[m];g=g+v,d[m]=[_,g]}return d};return Kn({get:()=>jv({buckets:h(),count:i,min:o,max:a,sum:c}),update:l,modify:l})},Yv=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:s}=e.keyType,i=p(s,yr(mn)),c=Ti(r);let o=0,a=0,l=0,h=0,d=0;const g=_=>{const v=[];let b=0;for(;b!==r-1;){const y=c[b];if(y!=null){const[x,G]=y,T=qs(_-x);hp(T,qu)&&fp(T,n)&&v.push(G)}b=b+1}return Qv(t,i,yr(v,mn))},m=(_,v)=>{if(r>0){o=o+1;const b=o%r;c[b]=[v,_]}h=a===0?_:Math.min(h,_),d=a===0?_:Math.max(d,_),a=a+1,l=l+_};return Kn({get:()=>Lv({error:t,quantiles:g(Date.now()),count:a,min:h,max:d,sum:l}),update:([_,v])=>m(_,v),modify:([_,v])=>m(_,v)})},Qv=(e,t,n)=>{const r=n.length;if(!de(t))return Ct();const s=t[0],i=t.slice(1),c=jo(e,r,$(),0,s,n),o=Se(c);return i.forEach(a=>{o.push(jo(e,r,c.value,c.consumed,a,c.rest))}),St(o,a=>[a.quantile,a.value])},jo=(e,t,n,r,s,i)=>{let c=e,o=t,a=n,l=r,h=s,d=i,g=e,m=t,_=n,v=r,b=s,y=i;for(;;){if(!de(d))return{quantile:h,value:$(),consumed:l,rest:[]};if(h===1)return{quantile:h,value:P(ku(d)),consumed:l+d.length,rest:[]};const x=le(d),G=fg(d,k=>k===x),T=h*o,re=c/2*T,E=l+G[0].length,O=Math.abs(E-T);if(E<T-re){g=c,m=o,_=hn(d),v=E,b=h,y=G[1],c=g,o=m,a=_,l=v,h=b,d=y;continue}if(E>T+re){const k=ae(a)?P(x):a;return{quantile:h,value:k,consumed:l,rest:d}}switch(a._tag){case"None":{g=c,m=o,_=hn(d),v=E,b=h,y=G[1],c=g,o=m,a=_,l=v,h=b,d=y;continue}case"Some":{const k=Math.abs(T-a.value);if(O<k){g=c,m=o,_=hn(d),v=E,b=h,y=G[1],c=g,o=m,a=_,l=v,h=b,d=y;continue}return{quantile:h,value:P(a.value),consumed:l,rest:d}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},Xv="effect/MetricPair",Zv=Symbol.for(Xv),ek={_Type:e=>e},tk=(e,t)=>({[Zv]:ek,metricKey:e,metricState:t,pipe(){return C(this,arguments)}}),nk="effect/MetricRegistry",Lo=Symbol.for(nk);var Ra;Ra=Lo;class rk{constructor(){u(this,Ra,Lo);u(this,"map",dy())}snapshot(){const t=[];for(const[n,r]of this.map)t.push(tk(n,r.get()));return t}get(t){const n=p(this.map,Xe(t),Qe);if(n==null){if(Af(t.keyType))return this.getCounter(t);if(_v(t.keyType))return this.getGauge(t);if(mv(t.keyType))return this.getFrequency(t);if(Pf(t.keyType))return this.getHistogram(t);if(bv(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=p(this.map,Xe(t),Qe);if(n==null){const r=Jv(t);p(this.map,nn(t))||p(this.map,rn(t,r)),n=r}return n}getFrequency(t){let n=p(this.map,Xe(t),Qe);if(n==null){const r=Gv(t);p(this.map,nn(t))||p(this.map,rn(t,r)),n=r}return n}getGauge(t){let n=p(this.map,Xe(t),Qe);if(n==null){const r=zv(t,t.keyType.bigint?BigInt(0):0);p(this.map,nn(t))||p(this.map,rn(t,r)),n=r}return n}getHistogram(t){let n=p(this.map,Xe(t),Qe);if(n==null){const r=Wv(t);p(this.map,nn(t))||p(this.map,rn(t,r)),n=r}return n}getSummary(t){let n=p(this.map,Xe(t),Qe);if(n==null){const r=Yv(t);p(this.map,nn(t))||p(this.map,rn(t,r)),n=r}return n}}const sk=()=>new rk,ik="effect/Metric",ck=Symbol.for(ik),ok={_Type:e=>e,_In:e=>e,_Out:e=>e},xo=L(Symbol.for("effect/Metric/globalMetricRegistry"),()=>sk()),Bf=function(e,t,n,r){const s=Object.assign(i=>Ib(i,c=>fk(s,c)),{[ck]:ok,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return C(this,arguments)}});return s},fs=(e,t)=>Vf(wv(e,t)),Vf=e=>{let t;const n=new WeakMap,r=s=>{if(s.length===0)return t!==void 0||(t=xo.get(e)),t;let i=n.get(s);return i!==void 0||(i=xo.get(Ev(e,s)),n.set(s,i)),i};return Bf(e.keyType,(s,i)=>r(i).update(s),s=>r(s).get(),(s,i)=>r(i).modify(s))},ak=(e,t,n)=>Vf(Iv(e,t,n)),uk=f(3,(e,t,n)=>lk(e,[LS(t,n)])),lk=f(2,(e,t)=>Bf(e.keyType,(n,r)=>e.unsafeUpdate(n,sr(t,r)),n=>e.unsafeValue(sr(t,n)),(n,r)=>e.unsafeModify(n,sr(t,r)))),fk=f(2,(e,t)=>sc(ti,n=>w(()=>e.unsafeUpdate(t,n))));({...Ci});const hk=f(2,(e,t)=>sc(Of,n=>w(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,Yl(r.result,t))}}))),dk="effect/Supervisor",hs=Symbol.for(dk),kc={_T:e=>e};var Ta;Ta=hs;const Ec=class Ec{constructor(t,n){u(this,"underlying");u(this,"value0");u(this,Ta,kc);this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,s){this.underlying.onStart(t,n,r,s)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new Ec(this,p(this.value,oe(t)))}zip(t){return new Pr(this,t)}};let Ar=Ec;var Ma;Ma=hs;const Oc=class Oc{constructor(t,n){u(this,"left");u(this,"right");u(this,"_tag","Zip");u(this,Ma,kc);this.left=t,this.right=n}get value(){return Dl(this.left.value,this.right.value)}onStart(t,n,r,s){this.left.onStart(t,n,r,s),this.right.onStart(t,n,r,s)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Ar(this,p(this.value,oe(t)))}zip(t){return new Oc(this,t)}};let Pr=Oc;const Kf=e=>A(e,hs)&&Ya(e,"Zip");var Na;Na=hs;class gk{constructor(t){u(this,"effect");u(this,Na,kc);this.effect=t}get value(){return this.effect}onStart(t,n,r,s){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new Ar(this,p(this.value,oe(t)))}zip(t){return new Pr(this,t)}onRun(t,n){return t()}}const pk=e=>new gk(e),wc=L("effect/Supervisor/none",()=>pk(Te)),mk=Jt,Hf="Empty",Jf="AddSupervisor",Gf="RemoveSupervisor",zf="AndThen",gn={_tag:Hf},lr=(e,t)=>({_tag:zf,first:e,second:t}),_k=(e,t)=>bk(t,ge(e)),bk=(e,t)=>{let n=e,r=t;for(;Mt(r);){const s=Nt(r);switch(s._tag){case Hf:{r=Ze(r);break}case Jf:{n=n.zip(s.supervisor),r=Ze(r);break}case Gf:{n=bi(n,s.supervisor),r=Ze(r);break}case zf:{r=Ee(s.first)(Ee(s.second)(Ze(r)));break}}}return n},bi=(e,t)=>F(e,t)?wc:Kf(e)?bi(e.left,t).zip(bi(e.right,t)):e,jr=e=>F(e,wc)?at():Kf(e)?p(jr(e.left),yn(jr(e.right))):Bi(e),yk=(e,t)=>{if(F(e,t))return gn;const n=jr(e),r=jr(t),s=p(r,Yc(n),kr(gn,(c,o)=>lr(c,{_tag:Jf,supervisor:o}))),i=p(n,Yc(r),kr(gn,(c,o)=>lr(c,{_tag:Gf,supervisor:o})));return lr(s,i)},Sk=mk({empty:gn,patch:_k,combine:lr,diff:yk}),vk=fs("effect_fiber_started",{incremental:!0}),Do=fs("effect_fiber_active"),kk=fs("effect_fiber_successes",{incremental:!0}),wk=fs("effect_fiber_failures",{incremental:!0}),Ik=uk(ak("effect_fiber_lifetimes",sv({start:.5,factor:2,count:35})),"time_unit","milliseconds"),sn="Continue",Ek="Done",Uo="Yield",Ok={_E:e=>e,_A:e=>e},tr=e=>{throw new Error(`BUG: FiberRuntime - ${It(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},Fe=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Ae=L("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),cn={[pr]:(e,t,n)=>ce(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>Z(Z(n)),[mr]:(e,t,n)=>ce(()=>t.effect_instruction_i2(n)),[Oi]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),Ke(e.currentRuntimeFlags)&&e.isInterrupted()?V(e.getInterruptedCause()):Z(n)),[_r]:(e,t,n)=>(ce(()=>t.effect_instruction_i2(n)),ce(()=>t.effect_instruction_i0())?(e.pushStack(t),ce(()=>t.effect_instruction_i1())):Te),[fn]:(e,t,n)=>{for(;;){const r=ce(()=>t.effect_instruction_i0.next(n));if(r.done)return Z(r.value);const s=yd(r.value);if(as(s)){if(s._tag==="Failure")return s}else return e.pushStack(t),s;n=s.value}}},$k={[mc]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),Ke(t)?V(r.cause):n),[bc]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[_c]:(e,t,n,r)=>(r.onFiber(e,bf(t)),n),[yc]:(e,t,n,r)=>I(tc(),()=>n)},Ck=e=>ss($_(e),t=>it(q_(t),([n,r])=>{const s=new Map,i=[];for(const o of r){i.push(rt(o));for(const a of o)s.set(a.request,a)}const c=i.flat();return cs(Jk(n.runAll(i),c,()=>c.forEach(o=>{o.listeners.interrupted=!0})),Of,s)},!1,!1)),Rk=$i();var Fa,Aa;class Tk extends NS{constructor(n,r,s){super();u(this,Aa,K0);u(this,Fa,Ok);u(this,"_fiberRefs");u(this,"_fiberId");u(this,"_queue",new Array);u(this,"_children",null);u(this,"_observers",new Array);u(this,"_running",!1);u(this,"_stack",[]);u(this,"_asyncInterruptor",null);u(this,"_asyncBlockingOn",null);u(this,"_exitValue",null);u(this,"_steps",[]);u(this,"_isYielding",!1);u(this,"currentRuntimeFlags");u(this,"currentOpCount",0);u(this,"currentSupervisor");u(this,"currentScheduler");u(this,"currentTracer");u(this,"currentSpan");u(this,"currentContext");u(this,"currentDefaultServices");u(this,"run",()=>{this.drainQueueOnCurrentThread()});if(this.currentRuntimeFlags=s,this._fiberId=n,this._fiberRefs=r,to(s)){const i=this.getFiberRef(ti);vk.unsafeUpdate(1,i),Do.unsafeUpdate(1,i)}this.refreshRefCache()}commit(){return Cf(this)}id(){return this._fiberId}resume(n){this.tell(_t(n))}get status(){return this.ask((n,r)=>r)}get runtimeFlags(){return this.ask((n,r)=>s0(r)?n.currentRuntimeFlags:r.runtimeFlags)}scope(){return q0(this)}get children(){return this.ask(n=>Array.from(n.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(Zn)}fiberRefs(){return this.ask(n=>n.getFiberRefs())}ask(n){return Y(()=>{const r=iy(this._fiberId);return this.tell(ur((s,i)=>{Yl(r,w(()=>n(s,i)))})),Wl(r)})}tell(n){this._queue.push(n),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return ft(n=>{const r=s=>n(U(s));return this.tell(ur((s,i)=>{s._exitValue!==null?r(this._exitValue):s.addObserver(r)})),w(()=>this.tell(ur((s,i)=>{s.removeObserver(r)})))},this.id())}get inheritAll(){return pe((n,r)=>{const s=n.id(),i=n.getFiberRefs(),c=r.runtimeFlags,o=this.getFiberRefs(),a=hS(i,s,o);n.setFiberRefs(a);const l=n.getFiberRef(Ho),h=p(or(c,l),ro(Ln),ro(Xs));return Ob(h)})}get poll(){return w(()=>Ri(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(n){return w(()=>this.tell(Cs(He(n))))}unsafeInterruptAsFork(n){this.tell(Cs(He(n)))}addObserver(n){this._exitValue!==null?n(this._exitValue):this._observers.push(n)}removeObserver(n){this._observers=this._observers.filter(r=>r!==n)}getFiberRefs(){return this.setFiberRef(Ho,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(n){this._fiberRefs=lf(this._fiberRefs,n)}getFiberRef(n){return this._fiberRefs.locals.has(n)?this._fiberRefs.locals.get(n)[0][1]:n.initial}setFiberRef(n,r){this._fiberRefs=ri(this._fiberRefs,{fiberId:this._fiberId,fiberRef:n,value:r}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Cr),this.currentTracer=this.currentDefaultServices.unsafeMap.get(af.key),this.currentSupervisor=this.getFiberRef(Hk),this.currentScheduler=this.getFiberRef(j0),this.currentContext=this.getFiberRef(os),this.currentSpan=this.currentContext.unsafeMap.get(uf.key)}setFiberRefs(n){this._fiberRefs=n,this.refreshRefCache()}addChild(n){this.getChildren().add(n)}removeChild(n){this.getChildren().delete(n)}transferChildren(n){const r=this._children;if(this._children=null,r!==null&&r.size>0)for(const s of r)s._exitValue===null&&n.add(this.currentRuntimeFlags,s)}drainQueueOnCurrentThread(){let n=!0;for(;n;){let r=sn;const s=globalThis[Ye];globalThis[Ye]=this;try{for(;r===sn;)r=this._queue.length===0?Ek:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[Ye]=s}this._queue.length>0&&!this._running?(this._running=!0,r===Uo?(this.drainQueueLaterOnExecutor(),n=!1):n=!0):n=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(ic))}drainQueueWhileRunning(n,r){let s=r;for(;this._queue.length>0;){const i=this._queue.splice(0,1)[0];s=$k[i._tag](this,n,s,i)}return s}isInterrupted(){return!H_(this.getFiberRef(Zn))}addInterruptedCause(n){const r=this.getFiberRef(Zn);this.setFiberRef(Zn,ye(r,n))}processNewInterruptSignal(n){this.addInterruptedCause(n),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let n=!1;for(const r of this._children)r.tell(Cs(He(this.id()))),n=!0;return n}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const n=this._children.values();this._children=null;let r=!1;return ec({while:()=>!r,body:()=>{const i=n.next();return i.done?w(()=>{r=!0}):rs(i.value.await)},step:()=>{}})}return null}reportExitValue(n){if(to(this.currentRuntimeFlags)){const r=this.getFiberRef(ti),s=this.id().startTimeMillis,i=Date.now();switch(Ik.unsafeUpdate(i-s,r),Do.unsafeUpdate(-1,r),n._tag){case Ie:{kk.unsafeUpdate(1,r);break}case we:{wk.unsafeUpdate(1,r);break}}}if(n._tag==="Failure"){const r=this.getFiberRef(Yb);!zi(n.cause)&&r._tag==="Some"&&this.log("Fiber terminated with an unhandled error",n.cause,r)}}setExitValue(n){this._exitValue=n,this.reportExitValue(n);for(let r=this._observers.length-1;r>=0;r--)this._observers[r](n);this._observers=[]}getLoggers(){return this.getFiberRef(Pk)}log(n,r,s){const i=Re(s)?s.value:this.getFiberRef(Hb),c=this.getFiberRef(Mk);if($S(c,i))return;const o=this.getFiberRef(Jb),a=this.getFiberRef(Kb),l=this.getLoggers(),h=this.getFiberRefs();if(Zu(l)>0){const d=Tu(this.getFiberRef(Cr),ac),g=new Date(d.unsafeCurrentTimeMillis());Id(h,()=>{for(const m of l)m.log({fiberId:this.id(),logLevel:i,message:n,cause:r,context:h,spans:o,annotations:a,date:g})})}}evaluateMessageWhileSuspended(n){switch(n._tag){case yc:return Uo;case mc:return this.processNewInterruptSignal(n.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(V(n.cause)),this._asyncInterruptor=null),sn;case bc:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(n.effect),sn;case _c:return n.onFiber(this,this._exitValue!==null?n0:r0(this.currentRuntimeFlags,this._asyncBlockingOn)),sn;default:return tr(n)}}evaluateEffect(n){this.currentSupervisor.onResume(this);try{let r=Ke(this.currentRuntimeFlags)&&this.isInterrupted()?V(this.getInterruptedCause()):n;for(;r!==null;){const s=r,i=this.runLoop(s);if(i===Fe){const c=Ae.currentOp;Ae.currentOp=null,c._op===rr?v_(this.currentRuntimeFlags)?(this.tell(L0()),this.tell(_t(et)),r=null):r=et:c._op===ln&&(r=null)}else{this.currentRuntimeFlags=p(this.currentRuntimeFlags,k_(Xs));const c=this.interruptAllChildren();c!==null?r=I(c,()=>i):(this._queue.length===0?this.setExitValue(i):this.tell(_t(i)),r=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(n){if(this._running)this.tell(_t(n));else{this._running=!0;const r=globalThis[Ye];globalThis[Ye]=this;try{this.evaluateEffect(n)}finally{this._running=!1,globalThis[Ye]=r,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(n){this.tell(_t(n))}patchRuntimeFlags(n,r){const s=ar(n,r);return globalThis[Ye]=this,this.currentRuntimeFlags=s,s}initiateAsync(n,r){let s=!1;const i=c=>{s||(s=!0,this.tell(_t(c)))};Ke(n)&&(this._asyncInterruptor=i);try{r(i)}catch(c){i(Oe(xe(c)))}}pushStack(n){this._stack.push(n),n._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const n=this._stack.pop();if(n)return n._op==="OnStep"&&this._steps.pop(),n}getNextSuccessCont(){let n=this.popStack();for(;n;){if(n._op!==ys)return n;n=this.popStack()}}getNextFailCont(){let n=this.popStack();for(;n;){if(n._op!==pr&&n._op!==_r&&n._op!==fn)return n;n=this.popStack()}}[(Aa=V0,Fa=J0,Od)](n){return w(()=>Mu(this.currentContext,n))}Left(n){return ne(n.left)}None(n){return ne(new ty)}Right(n){return Z(n.right)}Some(n){return Z(n.value)}Micro(n){return Or(r=>{let s=r;const i=N0(E0(n,this.currentContext));return i.addObserver(c=>{if(c._tag==="Success")return s(Z(c.value));switch(c.cause._tag){case"Interrupt":return s(V(He(Pt)));case"Fail":return s(ne(c.cause.error));case"Die":return s(uo(c.cause.defect))}}),Or(c=>{s=o=>{c(Te)},i.unsafeInterrupt()})})}[su](n){const r=ce(()=>n.effect_instruction_i0()),s=this.getNextSuccessCont();return s!==void 0?(s._op in cn||tr(s),cn[s._op](this,s,r)):(Ae.currentOp=Z(r),Fe)}[Ie](n){const r=n,s=this.getNextSuccessCont();return s!==void 0?(s._op in cn||tr(s),cn[s._op](this,s,r.effect_instruction_i0)):(Ae.currentOp=r,Fe)}[we](n){const r=n.effect_instruction_i0,s=this.getNextFailCont();if(s!==void 0)switch(s._op){case ys:case mr:return Ke(this.currentRuntimeFlags)&&this.isInterrupted()?V(so(r)):ce(()=>s.effect_instruction_i1(r));case"OnStep":return Ke(this.currentRuntimeFlags)&&this.isInterrupted()?V(so(r)):Z(V(r));case Oi:return this.patchRuntimeFlags(this.currentRuntimeFlags,s.patch),Ke(this.currentRuntimeFlags)&&this.isInterrupted()?V(ye(r,this.getInterruptedCause())):V(r);default:tr(s)}else return Ae.currentOp=V(r),Fe}[iu](n){return ce(()=>n.effect_instruction_i0(this,bf(this.currentRuntimeFlags)))}Blocked(n){const r=this.getFiberRefs(),s=this.currentRuntimeFlags;if(this._steps.length>0){const i=[],c=this._steps[this._steps.length-1];let o=this.popStack();for(;o&&o._op!=="OnStep";)i.push(o),o=this.popStack();this.setFiberRefs(c.refs),this.currentRuntimeFlags=c.flags;const a=JS(c.refs,r),l=or(c.flags,s);return Z($l(n.effect_instruction_i0,pe(h=>{for(;i.length>0;)h.pushStack(i.pop());return h.setFiberRefs(GS(h.id(),h.getFiberRefs())(a)),h.currentRuntimeFlags=ar(l)(h.currentRuntimeFlags),n.effect_instruction_i1})))}return is(i=>I(Wf(gb(n.effect_instruction_i0)),()=>i(n.effect_instruction_i1)))}RunBlocked(n){return Ck(n.effect_instruction_i0)}[Tn](n){const r=n.effect_instruction_i0,s=this.currentRuntimeFlags,i=ar(s,r);if(Ke(i)&&this.isInterrupted())return V(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,r),n.effect_instruction_i1){const c=or(i,s);return this.pushStack(new pb(c,n)),ce(()=>n.effect_instruction_i1(s))}else return et}[pr](n){return this.pushStack(n),n.effect_instruction_i0}OnStep(n){return this.pushStack(n),n.effect_instruction_i0}[ys](n){return this.pushStack(n),n.effect_instruction_i0}[mr](n){return this.pushStack(n),n.effect_instruction_i0}[ln](n){return this._asyncBlockingOn=n.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,n.effect_instruction_i0),Ae.currentOp=n,Fe}[rr](n){return this._isYielding=!1,Ae.currentOp=n,Fe}[_r](n){const r=n.effect_instruction_i0,s=n.effect_instruction_i1;return r()?(this.pushStack(n),s()):et}[fn](n){return cn[fn](this,n,void 0)}[Vr](n){return ce(()=>n.commit())}runLoop(n){let r=n;for(this.currentOpCount=0;;){if((this.currentRuntimeFlags&b_)!==0&&this.currentSupervisor.onEffect(this,r),this._queue.length>0&&(r=this.drainQueueWhileRunning(this.currentRuntimeFlags,r)),!this._isYielding){this.currentOpCount+=1;const s=this.currentScheduler.shouldYield(this);if(s!==!1){this._isYielding=!0,this.currentOpCount=0;const i=r;r=I(tc({priority:s}),()=>i)}}try{if(r=this.currentTracer.context(()=>{if(Rk!==r[Bt]._V){const s=this.getFiberRef(Qb);if(s._tag==="Some"){const i=r[Bt]._V;this.log(`Executing an Effect versioned ${i} with a Runtime of version ${$i()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,Dt,s)}}return this[r._op](r)},this),r===Fe){const s=Ae.currentOp;return s._op===rr||s._op===ln?Fe:(Ae.currentOp=null,s._op===Ie||s._op===we?s:V(xe(s)))}}catch(s){r!==Fe&&!A(r,"_op")||!(r._op in this)?r=bb(`Not a valid effect: ${It(r)}`):ey(s)?r=V(ye(xe(s),He(Pt))):r=uo(s)}}}}const Mk=L("effect/FiberRef/currentMinimumLogLevel",()=>fe(CS("Info"))),Nk=e=>Sc(t=>{const n=_S(t.context,Cr);Tu(n,of).unsafe.log(e.log(t))}),Fk=L(Symbol.for("effect/Logger/defaultLogger"),()=>Nk(Z0)),Ak=L(Symbol.for("effect/Logger/tracerLogger"),()=>Sc(({annotations:e,cause:t,context:n,fiberId:r,logLevel:s,message:i})=>{const c=Fn(En(n,os),uf);if(c._tag==="None"||c.value._tag==="ExternalSpan")return;const o=Mu(En(n,Cr),ac),a={};for(const[l,h]of e)a[l]=h;a["effect.fiberId"]=sm(r),a["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(a["effect.cause"]=ts(t,{renderErrorCause:!0})),c.value.event(It(Array.isArray(i)&&i.length===1?i[0]:i),o.unsafeCurrentTimeNanos(),a)})),Pk=L(Symbol.for("effect/FiberRef/currentLoggers"),()=>Ub(Bi(Fk,Ak))),jk=e=>{if(Array.isArray(e)||Qa(e))return[e,$()];const t=Object.keys(e),n=t.length;return[t.map(r=>e[r]),P(r=>{const s={};for(let i=0;i<n;i++)s[t[i]]=r[i];return s})]},Lk=(e,t,n)=>{const r=[];for(const s of e)r.push(wn(s));return I(On(r,q,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}),s=>{const i=$(),c=s.length,o=new Array(c),a=new Array(c);let l=!1;for(let h=0;h<c;h++){const d=s[h];d._tag==="Left"?(o[h]=P(d.left),l=!0):(a[h]=d.right,o[h]=i)}return l?t._tag==="Some"?ne(t.value(o)):ne(o):n!=null&&n.discard?Te:t._tag==="Some"?U(t.value(a)):U(a)})},xk=(e,t,n)=>{const r=[];for(const s of e)r.push(wn(s));return n!=null&&n.discard?On(r,q,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,discard:!0,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}):oe(On(r,q,{concurrency:n==null?void 0:n.concurrency,batching:n==null?void 0:n.batching,concurrentFinalizers:n==null?void 0:n.concurrentFinalizers}),s=>t._tag==="Some"?t.value(s):s)},Dk=(e,t)=>{const[n,r]=jk(e);return(t==null?void 0:t.mode)==="validate"?Lk(n,r,t):(t==null?void 0:t.mode)==="either"?xk(n,r,t):(t==null?void 0:t.discard)!==!0&&r._tag==="Some"?oe(On(n,q,t),r.value):On(n,q,t)},On=f(e=>Qa(e[0]),(e,t,n)=>pe(r=>{const s=(n==null?void 0:n.batching)===!0||(n==null?void 0:n.batching)==="inherit"&&r.getFiberRef(Wb);return n!=null&&n.discard?Ao(n.concurrency,()=>bt(ii,n==null?void 0:n.concurrentFinalizers)(i=>s?it(e,(c,o)=>i(t(c,o)),!0,!1,1):ss(e,(c,o)=>i(t(c,o)))),()=>bt(ci,n==null?void 0:n.concurrentFinalizers)(i=>it(e,(c,o)=>i(t(c,o)),s,!1)),i=>bt(oi(i),n==null?void 0:n.concurrentFinalizers)(c=>it(e,(o,a)=>c(t(o,a)),s,!1,i))):Ao(n==null?void 0:n.concurrency,()=>bt(ii,n==null?void 0:n.concurrentFinalizers)(i=>s?qo(e,1,(c,o)=>i(t(c,o)),!0):Je(e,(c,o)=>i(t(c,o)))),()=>bt(ci,n==null?void 0:n.concurrentFinalizers)(i=>Uk(e,(c,o)=>i(t(c,o)),s)),i=>bt(oi(i),n==null?void 0:n.concurrentFinalizers)(c=>qo(e,i,(o,a)=>c(t(o,a)),s)))})),Uk=(e,t,n)=>Y(()=>{const r=z(e),s=new Array(r.length);return nc(it(r,(c,o)=>I(t(c,o),a=>w(()=>s[o]=a)),n,!1),U(s))}),it=(e,t,n,r,s)=>is(i=>Eb(c=>pe(o=>{let a=Array.from(e).reverse(),l=a.length;if(l===0)return Te;let h=0,d=!1;const g=s?Math.min(a.length,s):a.length,m=new Set,_=new Array,v=()=>m.forEach(k=>{k.currentScheduler.scheduleTask(()=>{k.unsafeInterruptAsFork(o.id())},0)}),b=new Array,y=new Array,x=new Array,G=()=>{const k=_.filter(({exit:D})=>D._tag==="Failure").sort((D,M)=>D.index<M.index?-1:D.index===M.index?0:1).map(({exit:D})=>D);return k.length===0&&k.push(et),k},T=(k,D=!1)=>{const M=xl(c(k)),B=Bk(M,o,o.currentRuntimeFlags,$f);return o.currentScheduler.scheduleTask(()=>{D&&B.unsafeInterruptAsFork(o.id()),B.resume(M)},0),B},re=()=>{r||(l-=a.length,a=[]),d=!0,v()},E=n?kb:Nl,O=T(ft(k=>{const D=(B,se)=>{B._op==="Blocked"?x.push(B):(_.push({index:se,exit:B}),B._op==="Failure"&&!d&&re())},M=()=>{if(a.length>0){const B=a.pop();let se=h++;const ze=()=>{const ie=a.pop();return se=h++,I(tc(),()=>I(E(i(t(ie,se))),$e))},$e=ie=>a.length>0&&(D(ie,se),a.length>0)?ze():U(ie),We=I(E(i(t(B,se))),$e),he=T(We);b.push(he),m.add(he),d&&he.currentScheduler.scheduleTask(()=>{he.unsafeInterruptAsFork(o.id())},0),he.addObserver(ie=>{let Be;if(ie._op==="Failure"?Be=ie:Be=ie.effect_instruction_i0,y.push(he),m.delete(he),D(Be,se),_.length===l)k(U(ct(po(G(),{parallel:!0}),()=>et)));else if(x.length+_.length===l){const me=G(),Jn=x.map(Xt=>Xt.effect_instruction_i0).reduce(bl);k(U($l(Jn,it([ct(po(me,{parallel:!0}),()=>et),...x.map(Xt=>Xt.effect_instruction_i1)],Xt=>Xt,n,!0,s))))}else M()})}};for(let B=0;B<g;B++)M()}));return rs(jl(Fl(i(Cf(O))),zl({onFailure:k=>{re();const D=x.length+1,M=Math.min(typeof s=="number"?s:x.length,x.length),B=Array.from(x);return ft(se=>{let ze=0,$e=0;const We=(ie,Be)=>me=>{ze++,ze===D&&se(Z(V(k))),B.length>0&&Be&&he()},he=()=>{T(B.pop(),!0).addObserver(We($e,!0)),$e++};O.addObserver(We($e,!1)),$e++;for(let ie=0;ie<M;ie++)he()})},onSuccess:()=>Je(y,k=>k.inheritAll)})))}))),qo=(e,t,n,r)=>Y(()=>{const s=z(e),i=new Array(s.length);return nc(it(s,(o,a)=>oe(n(o,a),l=>i[a]=l),r,!1,t),U(i))}),Wf=e=>Vk(e,$f),qk=(e,t,n,r=null)=>{const s=Yf(e,t,n,r);return s.resume(e),s},Bk=(e,t,n,r=null)=>Yf(e,t,n,r),Yf=(e,t,n,r=null)=>{const s=im(),i=t.getFiberRefs(),c=dS(i,s),o=new Tk(s,c,n),a=En(c,os),l=o.currentSupervisor;return l.onStart(a,e,P(t),o),o.addObserver(d=>l.onEnd(d,o)),(r!==null?r:p(t.getFiberRef(ni),ct(()=>t.scope()))).add(n,o),o},Vk=(e,t)=>pe((n,r)=>U(qk(e,n,r.runtimeFlags,t))),Bo=e=>qn(t=>gt(Fn(t,Hn),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return I(cc(n,ci),r=>Ic(e,r))}}})),Vo=e=>t=>qn(n=>gt(Fn(n,Hn),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:I(cc(r,oi(e)),s=>Ic(t,s))})),bt=(e,t)=>n=>qn(r=>gt(Fn(r,Hn),{onNone:()=>n(q),onSome:s=>{if(t===!0){const i=e._tag==="Parallel"?Bo:e._tag==="Sequential"?Ko:Vo(e.parallelism);switch(s.strategy._tag){case"Parallel":return i(n(Bo));case"Sequential":return i(n(Ko));case"ParallelN":return i(n(Vo(s.strategy.parallelism)))}}else return n(q)}})),Ko=e=>qn(t=>gt(Fn(t,Hn),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return I(cc(n,ii),r=>Ic(e,r))}}})),Hn=pt("effect/Scope"),Ic=f(2,(e,t)=>ly(e,Nu(Ug(Hn,t)))),Kk=e=>Yt(e,{differ:Sk,fork:gn}),Ho=Bb(I_),Hk=Kk(wc),Jk=(e,t,n)=>vb(r=>I(I(Wf(Al(e)),s=>ft(i=>{const c=t.map(l=>l.listeners.count),o=()=>{c.every(l=>l===0)&&t.every(l=>l.result.state.current._tag==="Pending"?!0:!!(l.result.state.current._tag==="Done"&&as(l.result.state.current.effect)&&l.result.state.current.effect._tag==="Failure"&&J_(l.result.state.current.effect.cause)))&&(a.forEach(l=>l()),n==null||n(),i(Rb(s)))};s.addObserver(l=>{a.forEach(h=>h()),i(l)});const a=t.map((l,h)=>{const d=g=>{c[h]=g,o()};return l.listeners.addObserver(d),()=>l.listeners.removeObserver(d)});return o(),w(()=>{a.forEach(l=>l())})})),()=>Y(()=>{const s=t.flatMap(i=>i.state.completed?[]:[i]);return ss(s,i=>hk(i.request,ny(r)))}))),Gk=Dk,Jo=Cb,Rs=DS;var zk={debug:(e,...t)=>console.debug(`[DEBUG] ${e}`,...t),info:(e,...t)=>console.info(`[INFO] ${e}`,...t),warn:(e,...t)=>console.warn(`[WARN] ${e}`,...t),error:(e,...t)=>console.error(`[ERROR] ${e}`,...t)},nr=zk,Wk=e=>({debug:(t,...n)=>nr.debug(`[${e}] ${t}`,...n),info:(t,...n)=>nr.info(`[${e}] ${t}`,...n),warn:(t,...n)=>nr.warn(`[${e}] ${t}`,...n),error:(t,...n)=>nr.error(`[${e}] ${t}`,...n)}),Qf=Wk("paths"),Xf=()=>(void 0)((void 0)(),".claude","projects"),Yk=e=>{const t=e.split(`
|
|
24
|
-
`).filter(n=>n.trim());for(const n of t)try{const r=JSON.parse(n);if(r!=null&&r.cwd)return r.cwd}catch{}return null},Qk=e=>e.endsWith(".jsonl")&&!e.startsWith("agent-"),Go=(e,t)=>{const n=e.replace(/\\/g,"/"),r=t.replace(/\\/g,"/");return n===r?"~":n.startsWith(r+"/")?"~"+n.slice(r.length):e},Xk=e=>{const t=e.match(/^([A-Za-z])--/);if(t){const n=t[1],r=e.slice(3);return n+":\\"+r.replace(/--/g,"\\.").replace(/-/g,"\\")}return e.replace(/^-/,"/").replace(/--/g,"/.").replace(/-/g,"/")},Zf=e=>{const t=r=>[...r].map(s=>s.charCodeAt(0)<=127?s:"-").join(""),n=e.match(/^([A-Za-z]):[/\\]/);if(n){const r=n[1].toLowerCase(),s=e.slice(3);return r+"--"+t(s).replace(/[/\\]\./g,"--").replace(/[/\\]/g,"-").replace(/\./g,"-")}return t(e).replace(/^\//g,"-").replace(/\/\./g,"--").replace(/\//g,"-").replace(/\./g,"-")},Zk=(e,t=za,n=Qf)=>{const r=(void 0)(e);try{const s=t.readFileSync(e,"utf-8"),i=Yk(s);if(i===null){const c=s.split(`
|
|
25
|
-
`).filter(o=>o.trim());return c.length===0?n.debug(`tryGetCwdFromFile: ${r} -> empty file`):n.debug(`tryGetCwdFromFile: ${r} -> no cwd found in ${c.length} lines`),null}return i}catch(s){return n.warn(`tryGetCwdFromFile: ${r} -> read error: ${s}`),null}},ew=(e,t=Xf(),n=za,r=Qf)=>{const s=(void 0)(t,e);try{const i=n.readdirSync(s).filter(Qk),c=[];for(const a of i){const l=Zk((void 0)(s,a),n,r);l!==null&&c.push(l)}const o=c.find(a=>Zf(a)===e);return o||(c.length>0?r.warn(`getRealPathFromSession: ${e} -> no match, cwds found: ${c.join(", ")}`):r.warn(`getRealPathFromSession: ${e} -> no valid cwd in any session`),null)}catch{return null}},tw=e=>{const t=(void 0)(),n=ew(e);if(n)return Go(n,t);const r=Xk(e);return Go(r,t)},jw=(e,t,n,r=60,s="Untitled")=>e||(t?t.length>r?t.slice(0,r-3)+"...":t:n&&n!=="Untitled"?n:s),nw=(e,t)=>{if(!t)return e;const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`${n}(?=[/\\\\]|$)`,"g");return e.replace(r,"~")},Lw=(e,t={})=>{const{currentProjectName:n,homeDir:r,filterEmpty:s=!0}=t,i=s?e.filter(o=>o.sessionCount>0):e,c=r?Zf(r):null;return i.sort((o,a)=>{if(n){if(o.name===n)return-1;if(a.name===n)return 1}if(c){const l=o.name.startsWith(c),h=a.name.startsWith(c);if(l&&!h)return-1;if(!l&&h)return 1}return o.displayName.localeCompare(a.displayName)})};Jo(function*(){const e=Xf();if(!(yield*Rs(()=>(void 0)(e).then(()=>!0).catch(()=>!1))))return[];const n=yield*Rs(()=>(void 0)(e,{withFileTypes:!0}));return yield*Gk(n.filter(s=>s.isDirectory()&&!s.name.startsWith(".")).map(s=>Jo(function*(){const i=(void 0)(e,s.name),o=(yield*Rs(()=>(void 0)(i))).filter(a=>a.endsWith(".jsonl")&&!a.startsWith("agent-"));return{name:s.name,displayName:tw(s.name),path:i,sessionCount:o.length}})),{concurrency:10})});const eh=Fh({version:"",homeDir:"",currentProjectName:""}),rw=(e,t)=>{const n=t??Ah(eh).homeDir;return n?nw(e,n):e.replace(/(?:\/Users\/[^/\s]+|C:\\Users\\[^\\\s]+)(?=[/\\]|(?=\s|$|[)"'\]}>,:;]))/g,"~")};Nh(eh,e=>t=>rw(t,e.homeDir));export{rw as A,hw as B,Yh as C,Lw as D,Rw as E,Ow as F,Jh as G,Ew as H,Fw as I,yw as J,gw as a,_w as b,pw as c,mw as d,Nw as e,Mw as f,jw as g,bw as h,lw as i,Iw as j,Tw as k,dw as l,Cw as m,ww as n,eh as o,vw as p,Xh as q,Aw as r,$w as s,hr as t,Sw as u,fw as v,Wh as w,kw as x,uw as y,aw as z};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CAbelkQT.js","../chunks/Di6YbRZt.js","../chunks/CUTXPORg.js","../chunks/Bapp9IYO.js","../chunks/IVrlObbe.js","../chunks/HouQR_BO.js","../chunks/BzTxzCCu.js","../chunks/CzuOkoRV.js","../assets/0.B2yA_bPQ.css","../nodes/1.DYaH4O8k.js","../nodes/2.VvV6w9cZ.js","../chunks/DUNnSDh5.js","../chunks/DHCLGQT_.js","../assets/Toast.CQSY_S6M.css","../nodes/3.D_uYLiIh.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var Y=t=>{throw TypeError(t)};var G=(t,e,r)=>e.has(t)||Y("Cannot "+r);var u=(t,e,r)=>(G(t,e,"read from private field"),r?r.call(t):e.get(t)),A=(t,e,r)=>e.has(t)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),C=(t,e,r,a)=>(G(t,e,"write to private field"),a?a.call(t,r):e.set(t,r),r);import{k as K,E as Q,j as X,F as Z,e as S,ae as $,g,ag as ee,Y as te,_ as re,p as se,L as ne,M as ae,o as oe,s as T,ah as ce,f as j,c as ie,b as le,d as ue,r as de,u as p,t as fe}from"../chunks/CUTXPORg.js";import{h as me,m as he,u as _e,f as N,a as w,c as B,t as ve,s as ge}from"../chunks/Di6YbRZt.js";import{B as ye,i as D}from"../chunks/Bapp9IYO.js";import{p as I,b as V}from"../chunks/DHCLGQT_.js";function F(t,e,r){K&&Q();var a=new ye(t);X(()=>{var c=e()??null;a.ensure(c,c&&(m=>r(m,c)))},Z)}function be(t){return class extends Ee{constructor(e){super({component:t,...e})}}}var y,f;class Ee{constructor(e){A(this,y);A(this,f);var m;var r=new Map,a=(n,s)=>{var i=re(s,!1,!1);return r.set(n,i),i};const c=new Proxy({...e.props||{},$$events:{}},{get(n,s){return g(r.get(s)??a(s,Reflect.get(n,s)))},has(n,s){return s===$?!0:(g(r.get(s)??a(s,Reflect.get(n,s))),Reflect.has(n,s))},set(n,s,i){return S(r.get(s)??a(s,i),i),Reflect.set(n,s,i)}});C(this,f,(e.hydrate?me:he)(e.component,{target:e.target,anchor:e.anchor,props:c,context:e.context,intro:e.intro??!1,recover:e.recover})),(!((m=e==null?void 0:e.props)!=null&&m.$$host)||e.sync===!1)&&ee(),C(this,y,c.$$events);for(const n of Object.keys(u(this,f)))n==="$set"||n==="$destroy"||n==="$on"||te(this,n,{get(){return u(this,f)[n]},set(s){u(this,f)[n]=s},enumerable:!0});u(this,f).$set=n=>{Object.assign(c,n)},u(this,f).$destroy=()=>{_e(u(this,f))}}$set(e){u(this,f).$set(e)}$on(e,r){u(this,y)[e]=u(this,y)[e]||[];const a=(...c)=>r.call(this,...c);return u(this,y)[e].push(a),()=>{u(this,y)[e]=u(this,y)[e].filter(c=>c!==a)}}$destroy(){u(this,f).$destroy()}}y=new WeakMap,f=new WeakMap;const Pe="modulepreload",Re=function(t,e){return new URL(t,e).href},M={},L=function(e,r,a){let c=Promise.resolve();if(r&&r.length>0){let n=function(l){return Promise.all(l.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};const s=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),k=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));c=n(r.map(l=>{if(l=Re(l,a),l in M)return;M[l]=!0;const v=l.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(!!a)for(let o=s.length-1;o>=0;o--){const d=s[o];if(d.href===l&&(!v||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":Pe,v||(_.as="script"),_.crossOrigin="",_.href=l,k&&_.setAttribute("nonce",k),document.head.appendChild(_),v)return new Promise((o,d)=>{_.addEventListener("load",o),_.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${l}`)))})}))}function m(n){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=n,window.dispatchEvent(s),!s.defaultPrevented)throw n}return c.then(n=>{for(const s of n||[])s.status==="rejected"&&m(s.reason);return e().catch(m)})},pe={};var we=N('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),ke=N("<!> <!>",1);function Oe(t,e){se(e,!0);let r=I(e,"components",23,()=>[]),a=I(e,"data_0",3,null),c=I(e,"data_1",3,null);ne(()=>e.stores.page.set(e.page)),ae(()=>{e.stores,e.page,e.constructors,r(),e.form,a(),c(),e.stores.page.notify()});let m=T(!1),n=T(!1),s=T(null);oe(()=>{const o=e.stores.page.subscribe(()=>{g(m)&&(S(n,!0),ce().then(()=>{S(s,document.title||"untitled page",!0)}))});return S(m,!0),o});const i=p(()=>e.constructors[1]);var k=ke(),l=j(k);{var v=o=>{const d=p(()=>e.constructors[0]);var E=B(),O=j(E);F(O,()=>g(d),(P,R)=>{V(R(P,{get data(){return a()},get form(){return e.form},get params(){return e.page.params},children:(h,je)=>{var U=B(),z=j(U);F(z,()=>g(i),(H,J)=>{V(J(H,{get data(){return c()},get form(){return e.form},get params(){return e.page.params}}),x=>r()[1]=x,()=>{var x;return(x=r())==null?void 0:x[1]})}),w(h,U)},$$slots:{default:!0}}),h=>r()[0]=h,()=>{var h;return(h=r())==null?void 0:h[0]})}),w(o,E)},b=o=>{const d=p(()=>e.constructors[0]);var E=B(),O=j(E);F(O,()=>g(d),(P,R)=>{V(R(P,{get data(){return a()},get form(){return e.form},get params(){return e.page.params}}),h=>r()[0]=h,()=>{var h;return(h=r())==null?void 0:h[0]})}),w(o,E)};D(l,o=>{e.constructors[1]?o(v):o(b,!1)})}var q=ie(l,2);{var _=o=>{var d=we(),E=ue(d);{var O=P=>{var R=ve();fe(()=>ge(R,g(s))),w(P,R)};D(E,P=>{g(n)&&P(O)})}de(d),w(o,d)};D(q,o=>{g(m)&&o(_)})}w(t,k),le()}const Be=be(Oe),De=[()=>L(()=>import("../nodes/0.CAbelkQT.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>L(()=>import("../nodes/1.DYaH4O8k.js"),__vite__mapDeps([9,1,2,7,6]),import.meta.url),()=>L(()=>import("../nodes/2.VvV6w9cZ.js"),__vite__mapDeps([10,1,2,3,4,11,12,13]),import.meta.url),()=>L(()=>import("../nodes/3.D_uYLiIh.js"),__vite__mapDeps([14,1,2,3,5,7,6,4,11,12,13]),import.meta.url)],Ie=[],Ve={"/":[2],"/session/[project]/[id]":[3]},W={handleError:(({error:t})=>{console.error(t)}),reroute:(()=>{}),transport:{}},xe=Object.fromEntries(Object.entries(W.transport).map(([t,e])=>[t,e.decode])),Fe=Object.fromEntries(Object.entries(W.transport).map(([t,e])=>[t,e.encode])),qe=!1,Ue=(t,e)=>xe[t](e);export{Ue as decode,xe as decoders,Ve as dictionary,Fe as encoders,qe as hash,W as hooks,pe as matchers,De as nodes,Be as root,Ie as server_loads};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as o,a as r}from"../chunks/BzTxzCCu.js";export{o as load_css,r as start};
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as _t,f as _,e as Fe,a as i,s as h,c as ft,t as z}from"../chunks/Di6YbRZt.js";import{af as bt,k as mt,N as yt,U as wt,p as Ct,s as x,a as kt,o as $t,f as L,d as s,c as a,t as y,b as jt,e as n,g as e,u as B,T as St,$ as Tt,r as o}from"../chunks/CUTXPORg.js";import{i as u}from"../chunks/Bapp9IYO.js";import{i as It,j as Nt,p as Ot,k as Pe,n as Rt,o as Dt,q as de,t as Ge,v as Mt,w as Ae,x as zt,y as Et,z as Pt}from"../chunks/IVrlObbe.js";import{h as At}from"../chunks/HouQR_BO.js";import{g as Ut}from"../chunks/BzTxzCCu.js";import{p as Je}from"../chunks/CzuOkoRV.js";function we(S,V,X=V){bt(S,"change",Y=>{var E=Y?S.defaultChecked:S.checked;X(E)}),(mt&&S.defaultChecked!==S.checked||yt(V)==null)&&X(S.checked),wt(()=>{var Y=V();S.checked=!!Y})}const Wt=!0,cr=Object.freeze(Object.defineProperty({__proto__:null,ssr:Wt},Symbol.toStringTag,{value:"Module"}));var Bt=_('<span class="text-xs text-gh-text-secondary bg-gh-border px-2 py-0.5 rounded hidden sm:inline"> </span>'),Vt=_('<div class="absolute right-3 top-1/2 -translate-y-1/2"><svg class="animate-spin h-4 w-4 text-gh-text-secondary" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" fill="none"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg></div>'),Ht=_('<div class="px-4 py-3 text-sm text-gh-text-secondary">Searching...</div>'),Qt=_('<div class="px-4 py-3 text-sm text-gh-text-secondary">No results found</div>'),qt=_('<div class="text-xs text-gh-text-secondary mt-1 line-clamp-2"> </div>'),Ft=_('<button class="w-full text-left px-4 py-2 hover:bg-gh-border-subtle border-b border-gh-border last:border-b-0"><div class="flex items-center gap-2"><span> </span> <span class="text-xs text-gh-text-secondary truncate flex-shrink-0 max-w-[120px]"> </span> <span class="text-sm font-medium truncate"> </span></div> <!></button>'),Gt=_('<div class="px-4 py-2 text-xs text-gh-text-secondary border-t border-gh-border">Searching content...</div>'),Jt=_("<!> <!>",1),Kt=_('<div class="absolute top-full left-0 right-0 mt-1 bg-gh-bg-secondary border border-gh-border rounded-md shadow-lg max-h-80 overflow-y-auto z-50"><!></div>'),Lt=_(" <!>",1),Xt=_("<!> ",1),Yt=_("<!> ",1),Zt=_('<div class="fixed inset-0 bg-black/50 flex items-center justify-center z-50" role="dialog" aria-modal="true" aria-labelledby="cleanup-modal-title"><div class="bg-gh-bg-secondary border border-gh-border rounded-lg p-6 w-[400px] shadow-xl text-gh-text"><h2 id="cleanup-modal-title" class="text-lg font-semibold mb-4">Cleanup Options</h2> <div class="space-y-3 text-gh-text"><label class="flex items-center gap-3 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gh-border bg-gh-bg text-gh-green focus:ring-gh-green"/> <span class="flex-1">Delete empty sessions <span class="text-gh-text-secondary"> </span></span></label> <label><input type="checkbox" class="w-4 h-4 rounded border-gh-border bg-gh-bg text-gh-green focus:ring-gh-green disabled:opacity-50"/> <span class="flex-1">Preserve sessions with todos <span class="text-gh-text-secondary"> </span></span></label> <label class="flex items-center gap-3 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gh-border bg-gh-bg text-gh-green focus:ring-gh-green"/> <span class="flex-1">Delete orphan agents <span class="text-gh-text-secondary"> </span></span></label> <label class="flex items-center gap-3 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gh-border bg-gh-bg text-gh-green focus:ring-gh-green"/> <span class="flex-1">Delete orphan todos <span class="text-gh-text-secondary"> </span></span></label></div> <div class="mt-4 pt-4 border-t border-gh-border text-sm text-gh-text-secondary"><!> <!> <!> <!></div> <div class="flex gap-2 mt-6 justify-end"><button class="px-4 py-2 text-sm rounded-md border border-gh-border hover:bg-gh-border-subtle">Cancel</button> <button class="px-4 py-2 text-sm rounded-md bg-gh-red text-white hover:bg-red-700 disabled:opacity-50"> </button></div></div></div>'),er=_('<div class="fixed bottom-4 right-4 bg-gh-green text-white px-5 py-3 rounded-md text-sm z-50"><!> <!> <!> <!></div>'),tr=_('<div class="min-h-screen flex flex-col bg-gh-bg text-gh-text"><header class="bg-gh-bg-secondary border-b border-gh-border px-8 py-4 flex justify-between items-center"><div class="flex items-center gap-3"><a class="flex items-center gap-2 hover:text-gh-accent"><svg class="w-6 h-6 text-gh-accent" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg> <span class="text-2xl font-semibold hidden sm:inline">Claude Sessions</span></a> <!></div> <div class="relative flex-1 max-w-md mx-8"><input type="text" placeholder="Search sessions..." class="w-full px-4 py-2 bg-gh-bg border border-gh-border rounded-md text-sm focus:outline-none focus:border-gh-accent"/> <!> <!></div> <div class="flex gap-2"><button class="bg-gh-border-subtle border border-gh-border text-gh-text px-4 py-2 rounded-md text-sm transition-colors hover:bg-gh-border hover:border-gh-text-secondary disabled:opacity-50 disabled:cursor-not-allowed"> </button> <button class="bg-gh-red border border-gh-red text-white px-4 py-2 rounded-md text-sm transition-colors hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"> </button></div></header> <main><!></main></div> <!> <!>',1);function ir(S,V){Ct(V,!0);const X=B(()=>Je.url.pathname.startsWith("/session/")),Y=t=>{const r="___DOT___";let l=t.replace(/--/g,r).replace(/-/g,"/").replace(new RegExp(r,"g"),"/.");const g=l.match(/^\/Users\/[^/]+\/(.+)$/);return g?`~/${g[1]}`:l},E=B(()=>{if(!e(X))return null;const t=Je.url.pathname.match(/^\/session\/([^/]+)\/([^/]+)/);return t?{projectName:decodeURIComponent(t[1]),sessionId:decodeURIComponent(t[2])}:null});let ce=x(""),H=x(!1),Ce=x(!1),ie=x(!1),N=x(null),C=x(null),ve=x(""),f=x(kt([])),Z=x(!1),pe=x(!1),Q=x(!1),ke=null,T=x(!0),ee=x(!0),O=x(!1),P=x(!1),$e=B(()=>{var t;return((t=e(N))==null?void 0:t.reduce((r,l)=>r+l.emptySessions.length,0))??0}),te=B(()=>{var t;return((t=e(N))==null?void 0:t.reduce((r,l)=>r+l.emptyWithTodosCount,0))??0}),he=B(()=>{var t;return((t=e(N))==null?void 0:t.reduce((r,l)=>r+l.orphanAgentCount,0))??0}),ue=B(()=>{var t;return((t=e(N))==null?void 0:t.reduce((r,l)=>r+l.orphanTodoCount,0))??0}),ge=B(()=>e(ee)?e($e)-e(te):e($e));$t(async()=>{try{const t=await Rt();n(ce,t.version,!0),Dt.set({version:t.version,homeDir:t.homeDir,currentProjectName:t.currentProjectName})}catch{n(ce,"unknown")}});const Ke=async()=>{if(confirm("Shutdown the server?")){n(Ce,!0);try{await Nt()}catch{}}},Le=async()=>{try{n(N,await Ot(),!0),n(ie,!0)}catch(t){alert(`Error: ${t}`)}},je=()=>{n(ie,!1),n(N,null)},Xe=async()=>{if(e(ge)===0&&!e(O)&&!e(P)){alert("Nothing to clean up");return}n(H,!0);try{n(C,await zt({clearEmpty:e(T),clearInvalid:!1,skipWithTodos:e(ee),clearOrphanAgents:e(O),clearOrphanTodos:e(P)}),!0),n(ie,!1),n(N,null),setTimeout(()=>{n(C,null),window.location.reload()},2e3)}catch(t){alert(`Error: ${t}`)}finally{n(H,!1)}},Ye=t=>{const r=t.target.value;if(n(ve,r,!0),ke&&clearTimeout(ke),!r.trim()){n(f,[],!0),n(Q,!1);return}ke=setTimeout(()=>Ze(r),300)},Se=t=>{const r=e(E);return r?[...t].sort((l,g)=>{const b=l.projectName===r.projectName&&l.sessionId===r.sessionId,v=g.projectName===r.projectName&&g.sessionId===r.sessionId;return b&&!v?-1:!b&&v?1:0}):t},Ze=async t=>{if(!t.trim())return;const r=e(E);n(Z,!0),n(Q,!0);try{const l=await Pe(t,{searchContent:!1,project:r==null?void 0:r.projectName});n(f,Se(l),!0)}catch(l){console.error("Title search error:",l)}finally{n(Z,!1)}n(pe,!0);try{if(r){const v=await Pe(t,{searchContent:!0,project:r.projectName}),w=new Set(e(f).map(k=>`${k.projectName}:${k.sessionId}`)),R=v.filter(k=>!w.has(`${k.projectName}:${k.sessionId}`));n(f,Se([...e(f),...R]),!0)}const l=await Pe(t,{searchContent:!0}),g=new Set(e(f).map(v=>`${v.projectName}:${v.sessionId}`)),b=l.filter(v=>!g.has(`${v.projectName}:${v.sessionId}`));n(f,Se([...e(f),...b]),!0)}catch(l){console.error("Content search error:",l)}finally{n(pe,!1)}},et=t=>{n(ve,""),n(f,[],!0),n(Q,!1),Ut(`/session/${encodeURIComponent(t.projectName)}/${encodeURIComponent(t.sessionId)}`)},tt=()=>{setTimeout(()=>{n(Q,!1)},200)};var Ue=tr();At("12qhfyh",t=>{St(()=>{Tt.title="Claude Sessions"})});var Te=L(Ue),Ie=s(Te),Ne=s(Ie),Oe=s(Ne),rt=a(Oe,2);{var at=t=>{var r=Bt(),l=s(r);o(r),y(()=>h(l,`v${e(ce)??""}`)),i(t,r)};u(rt,t=>{e(ce)&&t(at)})}o(Ne);var Re=a(Ne,2),q=s(Re);de(q),q.__input=Ye;var We=a(q,2);{var st=t=>{var r=Vt();i(t,r)};u(We,t=>{(e(Z)||e(pe))&&t(st)})}var ot=a(We,2);{var nt=t=>{var r=Kt(),l=s(r);{var g=v=>{var w=Ht();i(v,w)},b=v=>{var w=ft(),R=L(w);{var k=c=>{var p=Qt();i(c,p)},D=c=>{var p=Jt(),ae=L(p);Et(ae,17,()=>e(f),Pt,(I,m)=>{var A=Ft();A.__click=()=>et(e(m));var F=s(A),G=s(F),fe=s(G,!0);o(G);var U=a(G,2),be=s(U,!0);o(U);var se=a(U,2),ze=s(se,!0);o(se),o(F);var oe=a(F,2);{var me=W=>{var J=qt(),Ee=s(J,!0);o(J),y(()=>h(Ee,e(m).snippet)),i(W,J)};u(oe,W=>{e(m).snippet&&W(me)})}o(A),y(W=>{Ae(G,1,`text-xs px-1.5 py-0.5 rounded ${e(m).matchType==="title"?"bg-gh-green/20 text-gh-green":"bg-gh-accent/20 text-gh-accent"}`),h(fe,e(m).matchType==="title"?"Title":"Content"),h(be,W),h(ze,e(m).title)},[()=>Y(e(m).projectName)]),i(I,A)});var _e=a(ae,2);{var Me=I=>{var m=Gt();i(I,m)};u(_e,I=>{e(pe)&&I(Me)})}i(c,p)};u(R,c=>{e(f).length===0?c(k):c(D,!1)},!0)}i(v,w)};u(l,v=>{e(f).length===0&&e(Z)?v(g):v(b,!1)})}o(r),i(t,r)};u(ot,t=>{e(Q)&&(e(f).length>0||e(Z))&&t(nt)})}o(Re);var Be=a(Re,2),re=s(Be);re.__click=Le;var lt=s(re,!0);o(re);var xe=a(re,2);xe.__click=Ke;var dt=s(xe,!0);o(xe),o(Be),o(Ie);var De=a(Ie,2),ct=s(De);It(ct,()=>V.children),o(De),o(Te);var Ve=a(Te,2);{var it=t=>{var r=Zt();r.__click=d=>d.target===d.currentTarget&&je(),r.__keydown=d=>d.key==="Escape"&&je();var l=s(r),g=a(s(l),2),b=s(g),v=s(b);de(v);var w=a(v,2),R=a(s(w)),k=s(R);o(R),o(w),o(b);var D=a(b,2);let c;var p=s(D);de(p);var ae=a(p,2),_e=a(s(ae)),Me=s(_e);o(_e),o(ae),o(D);var I=a(D,2),m=s(I);de(m);var A=a(m,2),F=a(s(A)),G=s(F);o(F),o(A),o(I);var fe=a(I,2),U=s(fe);de(U);var be=a(U,2),se=a(s(be)),ze=s(se);o(se),o(be),o(fe),o(g);var oe=a(g,2),me=s(oe);{var W=d=>{var j=Lt(),M=L(j),ne=a(M);{var le=$=>{var K=z();y(()=>h(K,`(skipping ${e(te)??""} with todos)`)),i($,K)};u(ne,$=>{e(ee)&&e(te)>0&&$(le)})}y(()=>h(M,`Will delete ${e(ge)??""} session${e(ge)!==1?"s":""} `)),i(d,j)};u(me,d=>{e(T)&&d(W)})}var J=a(me,2);{var Ee=d=>{var j=Xt(),M=L(j);{var ne=$=>{var K=z(",");i($,K)};u(M,$=>{e(T)&&$(ne)})}var le=a(M);y(()=>h(le,` ${e(he)??""} orphan agent${e(he)!==1?"s":""}`)),i(d,j)};u(J,d=>{e(O)&&e(he)>0&&d(Ee)})}var He=a(J,2);{var ht=d=>{var j=Yt(),M=L(j);{var ne=$=>{var K=z(",");i($,K)};u(M,$=>{(e(T)||e(O))&&$(ne)})}var le=a(M);y(()=>h(le,` ${e(ue)??""} orphan todo${e(ue)!==1?"s":""}`)),i(d,j)};u(He,d=>{e(P)&&e(ue)>0&&d(ht)})}var ut=a(He,2);{var gt=d=>{var j=z("Nothing selected");i(d,j)};u(ut,d=>{!e(T)&&!e(O)&&!e(P)&&d(gt)})}o(oe);var Qe=a(oe,2),qe=s(Qe);qe.__click=je;var ye=a(qe,2);ye.__click=Xe;var xt=s(ye,!0);o(ye),o(Qe),o(l),o(r),y(()=>{h(k,`(${e($e)??""})`),c=Ae(D,1,"flex items-center gap-3 cursor-pointer ml-6",null,c,{"opacity-50":!e(T)}),p.disabled=!e(T),h(Me,`(${e(te)>0?`-${e(te)}`:"0"})`),h(G,`(${e(he)??""})`),h(ze,`(${e(ue)??""})`),ye.disabled=e(H)||e(ge)===0&&!e(O)&&!e(P),h(xt,e(H)?"Cleaning...":"Execute Cleanup")}),we(v,()=>e(T),d=>n(T,d)),we(p,()=>e(ee),d=>n(ee,d)),we(m,()=>e(O),d=>n(O,d)),we(U,()=>e(P),d=>n(P,d)),i(t,r)};u(Ve,t=>{e(ie)&&e(N)&&t(it)})}var vt=a(Ve,2);{var pt=t=>{var r=er(),l=s(r);{var g=c=>{var p=z();y(()=>h(p,`Removed ${e(C).removedMessageCount??""} invalid messages.`)),i(c,p)};u(l,c=>{e(C).removedMessageCount>0&&c(g)})}var b=a(l,2);{var v=c=>{var p=z();y(()=>h(p,`Deleted ${e(C).deletedCount??""} empty sessions.`)),i(c,p)};u(b,c=>{e(C).deletedCount>0&&c(v)})}var w=a(b,2);{var R=c=>{var p=z();y(()=>h(p,`Deleted ${e(C).deletedOrphanAgentCount??""} orphan agents.`)),i(c,p)};u(w,c=>{e(C).deletedOrphanAgentCount>0&&c(R)})}var k=a(w,2);{var D=c=>{var p=z();y(()=>h(p,`Deleted ${e(C).deletedOrphanTodoCount??""} orphan todos.`)),i(c,p)};u(k,c=>{e(C).deletedOrphanTodoCount>0&&c(D)})}o(r),i(t,r)};u(vt,t=>{e(C)&&t(pt)})}y(t=>{Ge(Oe,"href",t),Ge(Oe,"title",e(E)?"Back to project":"Claude Sessions"),Mt(q,e(ve)),re.disabled=e(H),h(lt,e(H)?"Cleaning...":"Cleanup"),xe.disabled=e(Ce),h(dt,e(Ce)?"Shutting down...":"Shutdown"),Ae(De,1,`flex-1 ${e(X)?"":"p-8 max-w-7xl mx-auto"} w-full overflow-y-auto`)},[()=>e(E)?`/#project=${encodeURIComponent(e(E).projectName)}`:"/"]),Fe("focus",q,()=>e(ve)&&n(Q,!0)),Fe("blur",q,tt),i(S,Ue),jt()}_t(["input","click","keydown"]);export{ir as component,cr as universal};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as v,a as b,s as c}from"../chunks/Di6YbRZt.js";import{K as x,L as k,M as i,N as y,O as u,P as E,g as h,Q as K,R as L,S as M,p as N,f as O,t as P,b as Q,c as R,d as m,r as _}from"../chunks/CUTXPORg.js";import{p as g}from"../chunks/CzuOkoRV.js";function S(r=!1){const t=x,e=t.l.u;if(!e)return;let a=()=>K(t.s);if(r){let o=0,s={};const l=L(()=>{let n=!1;const p=t.s;for(const f in p)p[f]!==s[f]&&(s[f]=p[f],n=!0);return n&&o++,o});a=()=>h(l)}e.b.length&&k(()=>{d(t,a),u(e.b)}),i(()=>{const o=y(()=>e.m.map(E));return()=>{for(const s of o)typeof s=="function"&&s()}}),e.a.length&&i(()=>{d(t,a),u(e.a)})}function d(r,t){if(r.l.s)for(const e of r.l.s)h(e);t()}M();var j=v("<h1> </h1> <p> </p>",1);function A(r,t){N(t,!1),S();var e=j(),a=O(e),o=m(a,!0);_(a);var s=R(a,2),l=m(s,!0);_(s),P(()=>{var n;c(o,g.status),c(l,(n=g.error)==null?void 0:n.message)}),b(r,e),Q()}export{A as component};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{f as L,a as A,s as ue}from"../chunks/Di6YbRZt.js";import{p as le,s as f,a as T,o as pe,f as me,g as e,b as ge,c as C,d as O,e as n,u as V,r as q,t as fe}from"../chunks/CUTXPORg.js";import{i as z}from"../chunks/Bapp9IYO.js";import{l as Se,r as he,m as we,a as ye,d as je,g as ve,b as Te,c as B,e as Me,s as Ne,f as G,u as xe,h as Ce}from"../chunks/IVrlObbe.js";import{P as Pe,S as _e,T as Ie}from"../chunks/DUNnSDh5.js";var De=L('<div class="fixed bottom-4 right-4 bg-gh-accent text-white px-4 py-2 rounded">Loading...</div>'),$e=L('<div class="fixed bottom-4 right-4 bg-gh-red text-white px-4 py-2 rounded"> </div>'),be=L('<div class="grid grid-cols-[350px_1fr] gap-4 h-[calc(100vh-120px)]"><!> <!></div> <!> <!> <!>',1);function Ue(J,K){le(K,!0);let M=f(T([])),c=f(T(new Map)),p=f(T(new Map)),S=f(T(new Set)),i=f(null),l=f(T([])),P=f(T([])),_=f(T([])),w=f(!1),I=f(null),d=f(null),x=f(null);const Q=()=>{const t=window.location.hash.slice(1),a=new URLSearchParams(t);return{project:a.get("project")??void 0,session:a.get("session")??void 0}},N=(t,a)=>{const s=new URLSearchParams;t&&s.set("project",t),a&&s.set("session",a);const r=s.toString();window.history.replaceState(null,"",r?`#${r}`:window.location.pathname)},W=async()=>{n(w,!0),n(d,null);try{n(M,await Se(),!0)}catch(t){n(d,String(t),!0)}finally{n(w,!1)}},E=async t=>{if(!e(c).has(t)){n(I,t,!0);try{const a=await G(t),s=[],r=new Map;for(const o of a)s.push({id:o.id,projectName:t,title:o.title,messageCount:o.messageCount,createdAt:o.createdAt,updatedAt:o.updatedAt}),r.set(o.id,o);e(c).set(t,s),n(c,new Map(e(c)),!0),e(p).set(t,r),n(p,new Map(e(p)),!0)}catch(a){n(d,String(a),!0)}finally{n(I,null)}}},D=async()=>{const{project:t,session:a}=Q();if(t&&(await E(t),e(S).add(t),n(S,new Set(e(S)),!0),a)){const s=e(c).get(t),r=s==null?void 0:s.find(o=>o.id===a);r&&await R(r,!1)}},X=async t=>{var a,s;e(S).has(t)?(e(S).delete(t),n(S,new Set(e(S)),!0),((a=e(i))==null?void 0:a.projectName)===t&&N()):(await E(t),e(S).add(t),n(S,new Set(e(S)),!0),N(t,((s=e(i))==null?void 0:s.projectName)===t?e(i).id:void 0))},R=async(t,a=!0)=>{var s,r,o,h,u,y,g;n(i,t,!0),n(w,!0),n(d,null);try{n(l,await B(t.projectName,t.id),!0);const j=(s=e(p).get(t.projectName))==null?void 0:s.get(t.id);if(j){const v=((r=j.todos)==null?void 0:r.sessionTodos)??[],m=((h=(o=j.todos)==null?void 0:o.agentTodos)==null?void 0:h.flatMap(b=>b.todos))??[];n(P,[...v,...m],!0),n(_,j.agents??[],!0)}else{const v=await Me(t.projectName,t.id),m=((u=v.todos)==null?void 0:u.sessionTodos)??[],b=((g=(y=v.todos)==null?void 0:y.agentTodos)==null?void 0:g.flatMap(de=>de.todos))??[];n(P,[...m,...b],!0),n(_,v.agents??[],!0)}a&&N(t.projectName,t.id)}catch(j){n(d,String(j),!0)}finally{n(w,!1)}},Y=async(t,a)=>{var s;if(t.stopPropagation(),!!confirm(`Delete session "${a.title}"?`))try{await je(a.projectName,a.id);const r=e(c).get(a.projectName);r&&(e(c).set(a.projectName,r.filter(o=>o.id!==a.id)),n(c,new Map(e(c)),!0)),((s=e(i))==null?void 0:s.id)===a.id&&(n(i,null),n(l,[],!0),N(a.projectName))}catch(r){n(d,String(r),!0)}},Z=async(t,a)=>{var h,u;t.stopPropagation();const s=(h=e(p).get(a.projectName))==null?void 0:h.get(a.id),r=ve(s==null?void 0:s.customTitle,s==null?void 0:s.currentSummary,a.title,1/0,""),o=prompt(`Enter session title:
|
|
2
|
-
(Sets custom-title for CLI, first summary for VSCode extension)`,r);if(o!==null)try{await Te(a.projectName,a.id,o),s&&(s.customTitle=o,s.currentSummary=o,s.summaries.length>0?s.summaries[0]={...s.summaries[0],summary:o}:s.summaries=[{summary:o}]),n(c,new Map(e(c)),!0),n(p,new Map(e(p)),!0),((u=e(i))==null?void 0:u.id)===a.id&&n(l,await B(a.projectName,a.id),!0)}catch(y){n(d,String(y),!0)}},ee=async t=>{if(!e(i))return;const a=t.uuid||t.messageId||t.leafUuid;if(a)try{await Ce(e(i).projectName,e(i).id,a),n(l,e(l).filter(o=>(o.uuid||o.messageId||o.leafUuid)!==a),!0);const s=e(c).get(e(i).projectName),r=s==null?void 0:s.find(o=>o.id===e(i).id);r&&(r.messageCount=e(l).length,n(c,new Map(e(c)),!0))}catch(s){n(d,String(s),!0)}},te=async t=>{if(!e(i))return;const a=t.customTitle??"",s=prompt("Enter new custom title:",a);if(!(s===null||s===a))try{await xe(e(i).projectName,e(i).id,t.uuid,s),t.customTitle=s,n(l,[...e(l)],!0)}catch(r){n(d,String(r),!0)}},se=async t=>{if(!e(i))return;const a=e(l).findIndex(u=>u.uuid===t.uuid),s=a,r=e(l).length-a;if(!confirm(`Split session at this message?
|
|
3
|
-
|
|
4
|
-
This session will keep ${r} messages (from here onwards).
|
|
5
|
-
Old messages (${s}) will be moved to a new session.`))return;const o=e(i).projectName,h=e(i).id;try{n(w,!0);const u=await Ne(o,h,t.uuid);if(u.success&&u.newSessionId){const y=await G(o),g=[],j=new Map;for(const m of y)g.push({id:m.id,projectName:o,title:m.title,messageCount:m.messageCount,createdAt:m.createdAt,updatedAt:m.updatedAt}),j.set(m.id,m);e(c).set(o,g),n(c,new Map(e(c)),!0),e(p).set(o,j),n(p,new Map(e(p)),!0),n(l,e(l).slice(a),!0);const v=g.find(m=>m.id===h);v&&(v.messageCount=e(l).length,n(i,{...v},!0)),n(x,`Session split! Old messages moved to new session: ${u.newSessionId.slice(0,8)}...`)}else n(d,u.error??"Failed to split session",!0)}catch(u){n(d,String(u),!0)}finally{n(w,!1)}},ae=async(t,a)=>{var s;if(confirm(`Move session "${t.title}" to ${a.split("-").pop()}?`))try{n(w,!0);const r=await we(t.projectName,t.id,a);if(r.success){const o=e(c).get(t.projectName);o&&e(c).set(t.projectName,o.filter(g=>g.id!==t.id));const h=await ye(a);e(c).set(a,h),n(c,new Map(e(c)),!0);const u=e(M).find(g=>g.name===t.projectName),y=e(M).find(g=>g.name===a);u&&u.sessionCount--,y&&y.sessionCount++,n(M,[...e(M)],!0),((s=e(i))==null?void 0:s.id)===t.id&&(n(i,null),n(l,[],!0),N())}else n(d,r.error??"Failed to move session",!0)}catch(r){n(d,String(r),!0)}finally{n(w,!1)}},ne=async(t,a)=>{t.stopPropagation();try{const s=await he(a.projectName,a.id);s.success?n(x,`Claude session started (PID: ${s.pid})`):n(d,s.error??"Failed to resume session",!0)}catch(s){n(d,String(s),!0)}};pe(()=>(W().then(()=>D()),window.addEventListener("hashchange",D),()=>window.removeEventListener("hashchange",D)));var F=be(),$=me(F),U=O($);Pe(U,{get projects(){return e(M)},get projectSessions(){return e(c)},get projectSessionData(){return e(p)},get expandedProjects(){return e(S)},get selectedSession(){return e(i)},get loadingProject(){return e(I)},onToggleProject:X,onSelectSession:R,onRenameSession:Z,onDeleteSession:Y,onMoveSession:ae,onResumeSession:ne});var re=C(U,2);{let t=V(()=>{var s,r;return e(i)?(r=(s=e(p).get(e(i).projectName))==null?void 0:s.get(e(i).id))==null?void 0:r.customTitle:void 0}),a=V(()=>{var s,r;return e(i)?(r=(s=e(p).get(e(i).projectName))==null?void 0:s.get(e(i).id))==null?void 0:r.currentSummary:void 0});_e(re,{get session(){return e(i)},get messages(){return e(l)},get todos(){return e(P)},get agents(){return e(_)},get customTitle(){return e(t)},get currentSummary(){return e(a)},onMessagesChange:s=>n(l,s,!0),onDeleteMessage:ee,onEditTitle:te,onSplitSession:se})}q($);var k=C($,2);{var oe=t=>{var a=De();A(t,a)};z(k,t=>{e(w)&&t(oe)})}var H=C(k,2);{var ie=t=>{var a=$e(),s=O(a,!0);q(a),fe(()=>ue(s,e(d))),A(t,a)};z(H,t=>{e(d)&&t(ie)})}var ce=C(H,2);Ie(ce,{get message(){return e(x)},set message(t){n(x,t,!0)}}),A(J,F),ge()}export{Ue as component};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{f as N,a as T,c as H,s as J}from"../chunks/Di6YbRZt.js";import{p as K,s as i,a as I,o as Q,f as $,b as X,h as Y,c as Z,e as s,g as e,$ as ee,u as y,d as b,r as C,t as te}from"../chunks/CUTXPORg.js";import{i as E}from"../chunks/Bapp9IYO.js";import{h as se}from"../chunks/HouQR_BO.js";import{p as O}from"../chunks/CzuOkoRV.js";import{l as ae,a as oe,c as re,e as ne,s as ie,u as le}from"../chunks/IVrlObbe.js";import{T as ue,S as de}from"../chunks/DUNnSDh5.js";var ce=N('<div class="flex items-center justify-center h-full"><div class="text-gh-muted">Loading...</div></div>'),me=N('<div class="flex items-center justify-center h-full"><div class="text-gh-red"> </div></div>'),pe=N('<div class="h-screen bg-gh-bg"><!></div> <!>',1);function we(R,A){K(A,!0);let l=i(null),u=i(I([])),k=i(I([])),U=i(I([])),g=i(!0),m=i(null),w=i(null),D=i(""),_=i(void 0),f=i(void 0);const p=y(()=>decodeURIComponent(O.params.project??"")),v=y(()=>decodeURIComponent(O.params.id??"")),F=y(()=>{var t;return e(_)??(e(f)&&e(f).length>50?e(f).slice(0,47)+"...":e(f))??((t=e(l))==null?void 0:t.title)??"Untitled"}),L=y(()=>`/#project=${encodeURIComponent(e(p))}`),P=async()=>{var t,a,r;s(g,!0),s(m,null);try{const o=(await ae()).find(h=>h.name===e(p));s(D,(o==null?void 0:o.displayName)??e(p),!0);const c=await oe(e(p));s(l,c.find(h=>h.id===e(v))??{id:e(v),projectName:e(p),title:e(v),messageCount:0,updatedAt:new Date().toISOString()},!0),s(u,await re(e(p),e(v)),!0);const n=await ne(e(p),e(v)),S=((t=n.todos)==null?void 0:t.sessionTodos)??[],x=((r=(a=n.todos)==null?void 0:a.agentTodos)==null?void 0:r.flatMap(h=>h.todos))??[];s(k,[...S,...x],!0),s(U,n.agents??[],!0),s(_,n.customTitle,!0),s(f,n.currentSummary,!0)}catch(d){s(m,String(d),!0)}finally{s(g,!1)}},V=async t=>{if(!e(l))return;const a=t.customTitle??"",r=prompt("Enter new custom title:",a);if(!(r===null||r===a))try{await le(e(l).projectName,e(l).id,t.uuid,r),t.customTitle=r,s(u,[...e(u)],!0)}catch(d){s(m,String(d),!0)}},W=async t=>{if(!e(l))return;const a=e(u).findIndex(o=>o.uuid===t.uuid),r=a,d=e(u).length-a;if(confirm(`Split session at this message?
|
|
2
|
-
|
|
3
|
-
This session will keep ${d} messages (from here onwards).
|
|
4
|
-
Old messages (${r}) will be moved to a new session.`))try{s(g,!0);const o=await ie(e(l).projectName,e(l).id,t.uuid);o.success&&o.newSessionId?(s(u,e(u).slice(a),!0),s(w,`Session split! Old messages moved to new session: ${o.newSessionId.slice(0,8)}...`)):s(m,o.error??"Failed to split session",!0)}catch(o){s(m,String(o),!0)}finally{s(g,!1)}};Q(P);var M=pe();se("ik3mmh",t=>{Y(()=>{ee.title=`${e(F)??""} - Claude Sessions`})});var j=$(M),q=b(j);{var z=t=>{var a=ce();T(t,a)},B=t=>{var a=H(),r=$(a);{var d=c=>{var n=me(),S=b(n),x=b(S,!0);C(S),C(n),te(()=>J(x,e(m))),T(c,n)},o=c=>{de(c,{get session(){return e(l)},get messages(){return e(u)},get agents(){return e(U)},get todos(){return e(k)},get customTitle(){return e(_)},get currentSummary(){return e(f)},get projectDisplayName(){return e(D)},get backUrl(){return e(L)},onMessagesChange:n=>s(u,n,!0),onEditTitle:V,onSplitSession:W,enableScroll:!0,fullWidth:!0})};E(r,c=>{e(m)?c(d):c(o,!1)},!0)}T(t,a)};E(q,t=>{e(g)?t(z):t(B,!1)})}C(j);var G=Z(j,2);ue(G,{get message(){return e(w)},set message(t){s(w,t,!0)}}),T(R,M),X()}export{we as component};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const ssr = true;
|
|
2
|
-
|
|
3
|
-
var _layout_ts = /*#__PURE__*/Object.freeze({
|
|
4
|
-
__proto__: null,
|
|
5
|
-
ssr: ssr
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const index = 0;
|
|
9
|
-
let component_cache;
|
|
10
|
-
const component = async () => component_cache ??= (await import('./_layout.svelte-D9DyGgZM.js')).default;
|
|
11
|
-
const universal_id = "src/routes/+layout.ts";
|
|
12
|
-
const imports = ["_app/immutable/nodes/0.CAbelkQT.js","_app/immutable/chunks/Di6YbRZt.js","_app/immutable/chunks/CUTXPORg.js","_app/immutable/chunks/Bapp9IYO.js","_app/immutable/chunks/IVrlObbe.js","_app/immutable/chunks/HouQR_BO.js","_app/immutable/chunks/BzTxzCCu.js","_app/immutable/chunks/CzuOkoRV.js"];
|
|
13
|
-
const stylesheets = ["_app/immutable/assets/0.B2yA_bPQ.css"];
|
|
14
|
-
const fonts = [];
|
|
15
|
-
|
|
16
|
-
export { component, fonts, imports, index, stylesheets, _layout_ts as universal, universal_id };
|
|
17
|
-
//# sourceMappingURL=0-CWHakFRJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"0-CWHakFRJ.js","sources":["../../../.svelte-kit/adapter-node/entries/pages/_layout.ts.js","../../../.svelte-kit/adapter-node/nodes/0.js"],"sourcesContent":["const ssr = true;\nexport {\n ssr\n};\n","import * as universal from '../entries/pages/_layout.ts.js';\n\nexport const index = 0;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;\nexport { universal };\nexport const universal_id = \"src/routes/+layout.ts\";\nexport const imports = [\"_app/immutable/nodes/0.CAbelkQT.js\",\"_app/immutable/chunks/Di6YbRZt.js\",\"_app/immutable/chunks/CUTXPORg.js\",\"_app/immutable/chunks/Bapp9IYO.js\",\"_app/immutable/chunks/IVrlObbe.js\",\"_app/immutable/chunks/HouQR_BO.js\",\"_app/immutable/chunks/BzTxzCCu.js\",\"_app/immutable/chunks/CzuOkoRV.js\"];\nexport const stylesheets = [\"_app/immutable/assets/0.B2yA_bPQ.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAAA,MAAM,GAAG,GAAG,IAAI;;;;;;;ACEJ,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,8BAAoC,CAAC,EAAE;AAElG,MAAC,YAAY,GAAG;AAChB,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AAC5S,MAAC,WAAW,GAAG,CAAC,sCAAsC;AACtD,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const index = 1;
|
|
2
|
-
let component_cache;
|
|
3
|
-
const component = async () => component_cache ??= (await import('./error.svelte-DNhMU_b6.js')).default;
|
|
4
|
-
const imports = ["_app/immutable/nodes/1.DYaH4O8k.js","_app/immutable/chunks/Di6YbRZt.js","_app/immutable/chunks/CUTXPORg.js","_app/immutable/chunks/CzuOkoRV.js","_app/immutable/chunks/BzTxzCCu.js"];
|
|
5
|
-
const stylesheets = [];
|
|
6
|
-
const fonts = [];
|
|
7
|
-
|
|
8
|
-
export { component, fonts, imports, index, stylesheets };
|
|
9
|
-
//# sourceMappingURL=1-NzhdkXbT.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const index = 2;
|
|
2
|
-
let component_cache;
|
|
3
|
-
const component = async () => component_cache ??= (await import('./_page.svelte-Bgd-L7N_.js')).default;
|
|
4
|
-
const imports = ["_app/immutable/nodes/2.VvV6w9cZ.js","_app/immutable/chunks/Di6YbRZt.js","_app/immutable/chunks/CUTXPORg.js","_app/immutable/chunks/Bapp9IYO.js","_app/immutable/chunks/IVrlObbe.js","_app/immutable/chunks/DUNnSDh5.js","_app/immutable/chunks/DHCLGQT_.js"];
|
|
5
|
-
const stylesheets = ["_app/immutable/assets/Toast.CQSY_S6M.css"];
|
|
6
|
-
const fonts = [];
|
|
7
|
-
|
|
8
|
-
export { component, fonts, imports, index, stylesheets };
|
|
9
|
-
//# sourceMappingURL=2-DrysGJ9C.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"2-DrysGJ9C.js","sources":["../../../.svelte-kit/adapter-node/nodes/2.js"],"sourcesContent":["\n\nexport const index = 2;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/2.VvV6w9cZ.js\",\"_app/immutable/chunks/Di6YbRZt.js\",\"_app/immutable/chunks/CUTXPORg.js\",\"_app/immutable/chunks/Bapp9IYO.js\",\"_app/immutable/chunks/IVrlObbe.js\",\"_app/immutable/chunks/DUNnSDh5.js\",\"_app/immutable/chunks/DHCLGQT_.js\"];\nexport const stylesheets = [\"_app/immutable/assets/Toast.CQSY_S6M.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAkC,CAAC,EAAE;AAChG,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACxQ,MAAC,WAAW,GAAG,CAAC,0CAA0C;AAC1D,MAAC,KAAK,GAAG;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const index = 3;
|
|
2
|
-
let component_cache;
|
|
3
|
-
const component = async () => component_cache ??= (await import('./_page.svelte-C7sseaTW.js')).default;
|
|
4
|
-
const imports = ["_app/immutable/nodes/3.D_uYLiIh.js","_app/immutable/chunks/Di6YbRZt.js","_app/immutable/chunks/CUTXPORg.js","_app/immutable/chunks/Bapp9IYO.js","_app/immutable/chunks/HouQR_BO.js","_app/immutable/chunks/CzuOkoRV.js","_app/immutable/chunks/BzTxzCCu.js","_app/immutable/chunks/IVrlObbe.js","_app/immutable/chunks/DUNnSDh5.js","_app/immutable/chunks/DHCLGQT_.js"];
|
|
5
|
-
const stylesheets = ["_app/immutable/assets/Toast.CQSY_S6M.css"];
|
|
6
|
-
const fonts = [];
|
|
7
|
-
|
|
8
|
-
export { component, fonts, imports, index, stylesheets };
|
|
9
|
-
//# sourceMappingURL=3-D4BIPCPc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3-D4BIPCPc.js","sources":["../../../.svelte-kit/adapter-node/nodes/3.js"],"sourcesContent":["\n\nexport const index = 3;\nlet component_cache;\nexport const component = async () => component_cache ??= (await import('../entries/pages/session/_project_/_id_/_page.svelte.js')).default;\nexport const imports = [\"_app/immutable/nodes/3.D_uYLiIh.js\",\"_app/immutable/chunks/Di6YbRZt.js\",\"_app/immutable/chunks/CUTXPORg.js\",\"_app/immutable/chunks/Bapp9IYO.js\",\"_app/immutable/chunks/HouQR_BO.js\",\"_app/immutable/chunks/CzuOkoRV.js\",\"_app/immutable/chunks/BzTxzCCu.js\",\"_app/immutable/chunks/IVrlObbe.js\",\"_app/immutable/chunks/DUNnSDh5.js\",\"_app/immutable/chunks/DHCLGQT_.js\"];\nexport const stylesheets = [\"_app/immutable/assets/Toast.CQSY_S6M.css\"];\nexport const fonts = [];\n"],"names":[],"mappings":"AAEY,MAAC,KAAK,GAAG;AACrB,IAAI,eAAe;AACP,MAAC,SAAS,GAAG,YAAY,eAAe,KAAK,CAAC,MAAM,OAAO,4BAAyD,CAAC,EAAE;AACvH,MAAC,OAAO,GAAG,CAAC,oCAAoC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,mCAAmC;AACpX,MAAC,WAAW,GAAG,CAAC,0CAA0C;AAC1D,MAAC,KAAK,GAAG;;;;"}
|