@deslop/workbench 0.0.330 → 0.0.332

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.
Files changed (39) hide show
  1. package/dist/client/assets/agent-ksblBy0b.js +2 -0
  2. package/dist/client/assets/{agent-BAplunWJ.js → agent-qBUgLqez.js} +1 -1
  3. package/dist/client/assets/{button-DJfQFnBl.js → button-Cl3QGxsE.js} +11 -11
  4. package/dist/client/assets/{diff-5y5Ly0fZ.js → diff-DRdkZUfM.js} +2 -2
  5. package/dist/client/assets/{diff-Cu8yhVQs.js → diff-V_u66cov.js} +24 -24
  6. package/dist/client/assets/{external-link-DSkEzLiB.js → external-link-CHsqlplI.js} +1 -1
  7. package/dist/client/assets/{fallbacks-2XEEl4BI.js → fallbacks-DRWx0EQv.js} +1 -1
  8. package/dist/client/assets/{index-CU4FmmbE.js → index-COqgQoHe.js} +3 -3
  9. package/dist/client/assets/{input-group-tkTwlIFp.js → input-group-DfylGHnW.js} +2 -2
  10. package/dist/client/assets/loader-circle-G9WKrfSd.js +1 -0
  11. package/dist/client/assets/{portless-DRWo8KFX.js → portless-CIQUkBPx.js} +1 -1
  12. package/dist/client/assets/portless-M280rnul.js +2 -0
  13. package/dist/client/assets/{resizable-BICft2JP.js → resizable-bJdqT1JF.js} +1 -1
  14. package/dist/client/assets/route-CzD0EIT6.js +2 -0
  15. package/dist/client/assets/route-JiIT6ta2.js +45 -0
  16. package/dist/client/assets/{run-C08WVAIM.js → run-JZrpFZA0.js} +1 -1
  17. package/dist/client/assets/run-nZsFjagi.js +2 -0
  18. package/dist/client/assets/state-DG0Oc1Jw.js +2 -0
  19. package/dist/client/assets/{terminal-CPpKsotd.js → terminal-BehqmxVT.js} +2 -2
  20. package/dist/client/assets/{terminal-BTXMxFEq.js → terminal-CRGNH_jn.js} +1 -1
  21. package/dist/client/assets/terminal-DtCniSNL.js +2 -0
  22. package/dist/client/assets/{triangle-alert-DrGIVhEI.js → triangle-alert-D2wmXkyn.js} +1 -1
  23. package/dist/client/index.html +11 -11
  24. package/dist/{execAsync-Gqapz_ET.mjs → execAsync-CgtnVVso.mjs} +1 -1
  25. package/dist/{getMachineId-bsd-D2D8E0zh.mjs → getMachineId-bsd-DYUtJhPR.mjs} +2 -2
  26. package/dist/{getMachineId-darwin-DD7WkQgq.mjs → getMachineId-darwin-BYjMzwa2.mjs} +2 -2
  27. package/dist/{getMachineId-linux-NsJbNTda.mjs → getMachineId-linux-7FQ_TPIw.mjs} +1 -1
  28. package/dist/{getMachineId-unsupported-BdKw63O1.mjs → getMachineId-unsupported-CqYci84U.mjs} +1 -1
  29. package/dist/{getMachineId-win-CpX0o49t.mjs → getMachineId-win-BxTTz_Ds.mjs} +2 -2
  30. package/dist/server.js +239 -230
  31. package/package.json +3 -3
  32. package/dist/client/assets/agent-DORiXY9q.js +0 -2
  33. package/dist/client/assets/loader-circle-vwjgn9E1.js +0 -1
  34. package/dist/client/assets/portless-Cn_0jtX4.js +0 -2
  35. package/dist/client/assets/route-D-VRm0UM.js +0 -2
  36. package/dist/client/assets/route-DAzFV54O.js +0 -45
  37. package/dist/client/assets/run-Dx2tn3Qe.js +0 -2
  38. package/dist/client/assets/state-DrPxOHMO.js +0 -2
  39. package/dist/client/assets/terminal-BGn5gevX.js +0 -2
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-QTnfLwEv.js";import{r as t}from"./compiler-runtime-rGeCHUuX.js";import{$a as n,$i as r,$n as i,$o as a,$r as o,$t as s,Ai as c,An as l,Ao as u,Ar as d,At as f,B as p,Bi as m,Bn as h,Br as ee,Bt as g,Ci as te,Cn as _,Co as ne,Cr as re,Ct as ie,Da as ae,Di as oe,Dn as se,Do as ce,Dr as le,Dt as ue,Ea as de,Ei as fe,En as pe,Eo as me,Er as he,Et as ge,F as _e,Fi as ve,Fn as v,Fo as ye,Fr as be,Ft as xe,G as Se,Ga as Ce,Gi as we,Gn as Te,Go as Ee,Gr as De,Gt as Oe,H as ke,Ha as Ae,Hi as je,Hn as Me,Hr as Ne,Ht as Pe,I as Fe,Ia as Ie,Ii as Le,In as Re,Io as ze,Ir as Be,It as Ve,J as He,Ja as Ue,Ji as We,Jn as Ge,Jo as Ke,Jr as qe,Jt as Je,K as Ye,Ka as Xe,Ki as Ze,Kn as Qe,Kr as $e,Kt as y,L as b,La as et,Li as tt,Ln as x,Lo as nt,Lr as rt,Lt as it,Ma as at,Mi as ot,Mn as st,Mo as ct,Mr as lt,Mt as ut,Ni as dt,Nn as ft,No as pt,Nr as mt,Nt as ht,Oi as gt,On as _t,Oo as vt,Or as yt,P as S,Pa as bt,Pi as xt,Pn as St,Po as Ct,Pr as wt,Pt as Tt,Q as Et,Qa as Dt,Qi as Ot,Qn as kt,Qo as At,Qr as jt,Qt as Mt,R as Nt,Ra as Pt,Ri as Ft,Rn as C,Ro as It,Rr as Lt,Rt,Sa as zt,Si as Bt,Sn as Vt,So as Ht,Sr as Ut,St as Wt,Ti as Gt,Tn as Kt,To as qt,Tr as Jt,Tt as Yt,U as Xt,Ua as Zt,Ui as Qt,Un as $t,Uo as en,Ur as tn,Ut as nn,V as rn,Va as an,Vi as on,Vn as sn,Vo as cn,Vr as ln,Vt as un,W as dn,Wa as fn,Wi as pn,Wn as mn,Wo as hn,Wr as gn,Wt as _n,X as w,Xi as vn,Xn as T,Xo as yn,Xr as bn,Xt as xn,Y as E,Ya as Sn,Yi as Cn,Yn as wn,Yo as D,Yr as Tn,Yt as O,Z as En,Za as Dn,Zi as On,Zn as kn,Zo as k,Zr as An,Zt as jn,_i as Mn,_n as Nn,_o as Pn,_t as Fn,aa as In,ai as Ln,an as Rn,ao as zn,ar as Bn,bi as Vn,bn as Hn,bo as Un,br as Wn,bt as Gn,ca as Kn,ci as qn,cn as A,co as Jn,cr as Yn,ct as Xn,da as Zn,di as Qn,dn as $n,do as er,dr as tr,dt as nr,ea as rr,en as ir,eo as ar,er as or,et as sr,fi as cr,fn as lr,fo as ur,ft as dr,gi as fr,gn as pr,go as mr,gt as hr,ha as gr,hi as _r,hn as vr,ho as yr,ht as br,ia as xr,ii as Sr,in as Cr,io as wr,ir as Tr,it as Er,ji as Dr,jn as Or,jo as kr,jr as Ar,jt as jr,ka as Mr,ki as Nr,kn as Pr,ko as Fr,kr as Ir,kt as Lr,la as Rr,li as zr,ln as Br,lo as j,lt as Vr,mi as Hr,mn as Ur,mo as Wr,mt as M,na as Gr,ni as Kr,nn as qr,no as Jr,nr as Yr,nt as Xr,oa as Zr,oi as Qr,on as $r,oo as ei,or as ti,ot as ni,pa as ri,pi as ii,pn as ai,po as oi,pt as si,q as ci,qa as li,qi as ui,qn as di,qo as fi,qr as pi,qt as mi,ra as hi,rn as gi,ro as _i,rr as vi,rt as yi,sa as bi,si as xi,sn as Si,so as N,sr as Ci,ta as P,ti as wi,tn as Ti,to as Ei,tr as Di,ts as Oi,tt as ki,ua as Ai,ui as ji,un as Mi,uo as Ni,ut as Pi,va as Fi,vi as Ii,vn as Li,vo as Ri,vr as zi,wa as Bi,wi as Vi,wn as Hi,wo as Ui,wr as Wi,wt as Gi,xa as Ki,xi as qi,xn as Ji,xo as Yi,xr as Xi,xt as Zi,ya as Qi,yi as $i,yn as ea,yo as ta,yr as na,yt as ra,z as ia,za as aa,zi as oa,zn as sa,zo as ca,zr as la,zt as ua}from"./button-DJfQFnBl.js";var da=Vi,fa=Gt,pa=Bt,ma=te,ha=Nr,ga=fe,_a=Dr,va=Symbol.for(`effect/MutableList/Empty`),ya=()=>({head:void 0,tail:void 0,length:0}),ba=()=>({array:[],mutable:!0,offset:0,next:void 0}),xa=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=ba(),e.tail=e.tail.next):e.head=e.tail=ba(),e.tail.array.push(t),e.length++},Sa=(e,t)=>Ca(e,Bi(t),!Array.isArray(t)),Ca=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},wa=e=>{e.head=e.tail=void 0,e.length=0},Ta=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return wa(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&wa(e),n;i=i.next}return wa(e),n},Ea=e=>Ta(e,e.length),Da=e=>{if(!e.head)return va;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:wa(e)),t},Oa=(e,t)=>{let n=[],r=e.head;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],e)&&n.push(r.array[e]);r=r.next}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},ka=(e,t)=>Oa(e,e=>e!==t),Aa=`~effect/MutableRef`,ja={[Aa]:Aa,...ur,toJSON(){return{_id:`MutableRef`,current:Ht(this.current)}}},Ma=e=>{let t=Object.create(ja);return t.current=e,t},Na=D(2,(e,t)=>(e.current=t,e)),Pa=`~effect/PubSub/Subscription`,Fa=D(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Ia=e=>Qe(un(t=>{let n=xr(t,Ar),r=be(e.scope),i=Ba(e.pubsub,e.subscribers,e.strategy);return lt(r,La(i)).pipe(jr(mt(n,e=>wt(r,e))),ht(i))})),La=e=>Qe(i(t=>(Na(e.shutdownFlag,!0),xn(Ea(e.pollers),e=>Ne(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(sa(()=>C(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),kn(e.shutdownHook.open),Tt)))),Ra=e=>x(function t(n){if(e.shutdownFlag.current)return gi;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?v(e.replayWindow.takeAll().concat(r)):ae(r)?v(r):y(za(e),e=>t([e]))}),za=e=>{let t=gn(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),xa(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),pr(ee(t),()=>(ka(e.pollers,t),T))},Ba=(e,t,n)=>new Va(e,t,e.subscribe(),ya(),_a(!1),Ma(!1),n,e.replayWindow()),Va=class{[Pa]={_A:k};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(e,t,n,r,i,a,o,s){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s}pipe(){return a(this,arguments)}},Ha=`~effect/Queue`,Ua=`~effect/Queue/Enqueue`,Wa=`~effect/Queue/Dequeue`,Ga={_A:k,_E:k},Ka={[Ha]:Ga,[Ua]:Ga,[Wa]:Ga,...ur,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:so(this)}}},qa=e=>Ri(t=>{let n=Object.create(Ka);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=ya(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},dt(n)}),Ja=e=>qa({capacity:e}),Ya=(e,t)=>ve(()=>{if(e.state._tag!==`Open`)return co;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return co;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(xa(e.messages,t),po(e),lo):go(e,t);case`sliding`:return Da(e.messages),xa(e.messages,t),lo}return xa(e.messages,t),mo(e),lo}),Xa=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Da(e.messages),xa(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(xa(e.messages,t),po(e),!0):!1:(xa(e.messages,t),mo(e),!0):!1,Za=(e,t)=>ve(()=>{if(e.state._tag!==`Open`)return dt(Bi(t));let n=Qa(e,t);return n.length===0?mr([]):e.strategy===`dropping`?dt(n):_o(e,n)}),Qa=(e,t)=>{if(e.state._tag!==`Open`)return Bi(t);if(e.capacity===1/0||e.strategy===`sliding`)return Sa(e.messages,t),e.strategy===`sliding`&&Ta(e.messages,e.messages.length-e.capacity),mo(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return Bi(t);let r=[],i=0;for(let a of t)i<n?xa(e.messages,a):r.push(a),i++;return mo(e),r},$a=D(2,(e,t)=>Le(()=>eo(e,t))),eo=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=qi(yr(t),uo);return e.state.offers.size===0&&e.messages.length===0?(bo(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},to=e=>$a(e,oi(er())),no=e=>Le(()=>{if(e.state._tag===`Done`)return!0;wa(e.messages);let t=e.state.offers;if(bo(e,e.state._tag===`Open`?fo:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(co):e.resume(mr(e.remaining.slice(e.offset)));t.clear()}return!0}),ro=e=>io(e,1,1/0),io=(e,t,n)=>ve(()=>ho(e,t,n)??fr(yo(e),io(e,1,n))),ao=e=>ve(()=>oo(e)??fr(yo(e),ao(e))),oo=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Da(e.messages);return vo(e),mr(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,vo(e),e.capacity=0;let t=Da(e.messages);return vo(e),mr(t)}},so=e=>e.state._tag===`Done`?0:e.messages.length,co=mr(!1),lo=mr(!0),uo=Wr(er()),fo=$i(),po=e=>{if(e.scheduleRunning=!1,!(e.state._tag===`Done`||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(Vn),e.messages.length===0)break}},mo=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>po(e),0))},ho=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return mr([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,vo(e),e.capacity=0;let t=[Da(e.messages)];return vo(e),mr(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Ta(e.messages,n);return vo(e),mr(t)}},go=(e,t)=>Ii(n=>{if(e.state._tag!==`Open`)return n(co);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),Le(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),_o=(e,t)=>Ii(n=>{if(e.state._tag!==`Open`)return n(mr(t));let r={_tag:`Array`,remaining:t,offset:0,resume:n};return e.state.offers.add(r),Le(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),vo=e=>{if(e.state._tag===`Done`)return Yn(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(bo(e,e.state.exit),Yn(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)xa(e.messages,n.message),t--,n.resume(lo),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;xa(e.messages,n.remaining[n.offset]),t--}n.resume(mr([])),e.state.offers.delete(n)}return!1},yo=e=>Ii(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),Le(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),bo=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},xo=e=>new So(e),So=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=ve(()=>this.free<e?Ii(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),Le(()=>{this.waiters.delete(r)})}):(this.taken+=e,dt(e)));return t}updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},0),this.free}updateTaken(e){return Ri(t=>dt(this.updateTakenUnsafe(t,e)))}resize(e){return Ri(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),Ft))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>tt(n=>oe(n(this.take(e)),e=>ot(n(t),()=>{this.updateTakenUnsafe(Nr(),t=>t-e)},!0)))}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>tt(n=>this.free<e?xt:(this.taken+=e,ot(n(Mn(t)),()=>{this.updateTakenUnsafe(Nr(),t=>t-e)},!0)))}},Co=`~effect/Channel`,wo=e=>It(e,Co),To={[Co]:{_Env:k,_InErr:k,_InElem:k,_OutErr:k,_OutElem:k},pipe(){return a(this,arguments)}},Eo=e=>{let t=Object.create(To);return t.transform=(t,n)=>it(e(t,n),e=>v(Oe(e))),t},Do=(e,t)=>Eo((n,r)=>y(Ao(e)(n,r),e=>t(e,r))),Oo=e=>Eo((t,n)=>e),ko=e=>Eo(O(function*(t,n){let r=be(n),i=e=>wt(r,Ci(e));return Ur(yield*Ur(e(t,n,r),i),i)})),Ao=e=>e.transform,jo=(e,t,n)=>qa({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(sa(t=>lt(e,no(t))),sa(n=>s(rt(t(n),e),e))),Mo=(e,t)=>Eo((n,r)=>A(jo(r,e,t),ro)),No=e=>Eo((t,n)=>x(()=>Ao(e())(t,n))),Po=Oo(v(Sr())),Fo=e=>Oo(v(_n(e))),Io=e=>Oo(v(ro(e))),Lo=e=>Oo(v(pr(Ra(e),()=>Sr()))),Ro=e=>qo(A(Ia(e),Lo)),zo=D(2,(e,t)=>Do(e,e=>C(()=>{let n=0;return A(e,e=>t(e,n++))}))),Bo=e=>e===void 0||e!==`unbounded`&&e<=1,Vo=D(e=>wo(e[0]),(e,t,n)=>Bo(n?.concurrency)?Ho(e,t):Uo(e,t,n)),Ho=(e,t)=>Eo((n,r)=>{let i=0;return A(Ao(e)(n,r),y(e=>t(e,i++)))}),Uo=(e,t,n)=>ko(O(function*(r,i,a){let o=0,c=yield*Ao(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*Ja(0);yield*lt(a,no(u));let d=pe(yield*g()),f=ga(a);if(n.unordered){let e=xo(l),n=Ke(e.release(1)),r=lr({onFailure:e=>y($a(u,e),n),onSuccess:e=>y(Ya(u,e),n)});yield*e.take(1).pipe(y(()=>c),y(e=>(f(d(r(t(e,o++)))),T)),jn({disableYield:!0}),it(t=>e.withPermits(l-1)($a(u,t))),s(a))}else{let e=yield*Ja(l-2);yield*lt(a,no(u)),yield*ao(e).pipe(Je,y(e=>Ya(u,e)),jn({disableYield:!0}),it(e=>$a(u,e)),s(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,eo(u,e.cause))};yield*c.pipe(y(i=>{if(n)return Oe(n);let a=d(t(i,o++));return f(a),a.addObserver(r),Ya(e,da(a))}),jn({disableYield:!0}),it(t=>Ya(e,pi(t)).pipe(jr($a(e,t)))),s(a))}return ao(u)})),Wo=e=>Do(e,e=>{let t,n=0;return v(x(function r(){if(t===void 0)return y(e,e=>{switch(e.length){case 0:return r();case 1:return v(e[0]);default:return t=e,v(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),v(i)}))}),Go=D(2,(e,t)=>Do(e,e=>v(y(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Mr(i)?v(i):y(e,n)})))),Ko=D(e=>wo(e[0]),(e,t,n,r)=>Eo((i,a)=>A(Ao(e)(i,a),e=>{let i=t(),a,o=0,s,c=lr(e,{onFailure(e){s=e;let t=r?.onHalt&&r.onHalt(i);return t&&t.length>0?v([i,t]):Oe(e)},onSuccess(e){let t=n(i,e);return de(t)?v(t):t}});return x(function e(){if(a===void 0)return s?Oe(s):y(c,([t,n])=>(i=t,n.length===0?e():n.length===1?v(n[0]):(a=n,e())));let t=a[o++];return o>=a.length&&(a=void 0,o=0),v(t)})}))),qo=e=>Eo((t,n)=>{let r;return v(x(()=>r||e.pipe(rt(n),y(e=>Ao(e)(t,n)),y(e=>r=e))))}),Jo=D(2,(e,t)=>ko((n,r,i)=>mt(i,t).pipe(jr(Ao(e)(n,r))))),Yo=D(2,(e,t)=>Jo(e,e=>t)),Xo=(e,t,n)=>x(()=>{let r=Be();return ti(y(Ao(e)(Sr(),r),t),n||v).pipe(vr(e=>wt(r,e)))}),Zo=D(2,(e,t)=>Eo((n,r)=>A(Hn(Ao(e)(n,r),t),Hn(t)))),Qo=D(2,(e,t)=>Xo(e,e=>jn(y(e,t),{disableYield:!0}))),$o=O(function*(e){let t=xo(1),n=yield*g(),r=xr(n,Ar);return(yield*Ao(e)(Sr(),r)).pipe(Hn(n),t.withPermits(1))},it(e=>v(Oe(e)))),es=(e,t)=>Ao(e)(Sr(),t),ts=`~effect/Stream`,ns={_R:k,_E:k,_A:k},rs={[ts]:ns,pipe(){return a(this,arguments)}},is=e=>{let t=Object.create(rs);return t.channel=e,t},as=`~effect/Sink`,os={_A:k,_In:k,_L:k,_E:k,_R:k},ss={[as]:os,pipe(){return a(this,arguments)}},cs=e=>{let t=Object.create(ss);return t.transform=e,t},ls=e=>cs(t=>{let n=[];if(e<=0)return v([n]);let r;return t.pipe(y(t=>{if(n.length+t.length<=e)return n.push(...t),n.length===e?Sr():T;for(let i=0;i<t.length;i++)if(n.push(t[i]),n.length===e)return i+1<t.length&&(r=t.slice(i+1)),Sr();return T}),jn({disableYield:!0}),ti(()=>v([n,r])))}),us=`~effect/collections/MutableHashMap`,ds={[us]:us,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${Ui(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Ht(Array.from(this))}},[Yi](){return this.toJSON()},pipe(){return a(this,arguments)}},fs=()=>{let e=Object.create(ds);return e.backing=new Map,e.buckets=new Map,e},ps=D(2,(e,t)=>{if(e.backing.has(t))return j(e.backing.get(t));if(hs(t))return N();let n=ms.get(e);if(n!==void 0)return e.backing.has(n)?j(e.backing.get(n)):N();let r=Ct(t),i=e.buckets.get(r);return i===void 0?N():gs(e,i,t)}),ms=new WeakMap,hs=e=>typeof e!=`object`&&typeof e!=`function`,gs=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(u(n,t[r])){let i=t[r];return ms.set(n,i),j(e.backing.get(i))}return N()},_s=D(3,(e,t,n)=>{if(e.backing.has(t)||hs(t))return e.backing.set(t,n),e;let r=ms.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=Ct(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=vs(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),vs=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(u(t,e[n]))return ms.set(t,e[n]),e[n]},ys=D(2,(e,t)=>{if(hs(t))return e.backing.delete(t),e;let n=ms.get(e)??t,r=Ct(n),i=e.buckets.get(r);if(i===void 0)return e;for(let t=0,r=i.length;t<r;t++){let r=i[t];if(r===n||u(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),bs=`~effect/Stream`,xs=e=>It(e,bs),Ss=is,Cs=e=>e.channel,ws=(e,t)=>Ss(Mo(e,t)),Ts=Ss(Po),Es=e=>Ss(No(()=>e().channel)),Ds=e=>Ss(Fo(e)),Os=e=>Ss(Io(e)),ks=e=>Ss(Ro(e)),As=e=>Ss(Eo(O(function*(t,n){let r=e.evaluate().getReader();return yield*lt(n,e.releaseLockOnEnd?C(()=>r.releaseLock()):Li(()=>r.cancel())),y(mn({try:()=>r.read(),catch:t=>e.onError(t)}),({done:e,value:t})=>e?Sr():v(Ie(t)))}))),js=e=>Ss(qo(A(e,Cs))),Ms=D(e=>xs(e[0]),(e,t,n)=>e.channel.pipe(Wo,Vo(t,n),zo(Ie),Ss)),Ns=D(2,(e,t)=>Ss(Go(Cs(e),t))),Ps=D(3,(e,t,n)=>Es(()=>{let r=!0;return Ss(Ko(e.channel,Ke(t),(e,t)=>{let i=Fi();r&&(r=!1,i.push(e));for(let r=0;r<t.length;r++)e=n(e,t[r]),i.push(e);return[e,Ie(i)]}))})),Fs=D(3,(e,t,n)=>Is(e,ls(t),Tr(n))),Is=D(3,(e,t,n)=>Ss(ko(O(function*(r,i,a){let o=yield*es(e.channel,i),c=_a(!1),l=Symbol(),u=yield*qa({capacity:0});yield*o.pipe(c.whenOpen,y(e=>(c.closeUnsafe(),Ya(u,e))),jn,it(e=>$a(u,e)),s(a));let d=N(),f,p=!1,m=yield*Bn(n),h=x(function e(){return m(d).pipe(y(()=>p?Ya(u,l):e()),y(()=>ai),ti(()=>Sr()))}),ee=ao(u).pipe(y(e=>e===l?Sr():(p=!0,v(e)))),g=x(()=>{if(f!==void 0){let e=f;return f=void 0,p=!0,v(e)}return c.openUnsafe(),ee}),te=y(([e,t])=>!p&&u.state._tag===`Done`?Sr():(d=j(e),f=t,v(Ie(e))));return x(()=>u.state._tag===`Done`&&f===void 0?u.state.exit:(p=f!==void 0,v(x(()=>t.transform(g,a))))).pipe(y(e=>Vt(te(e),h)))})))),Ls=D(2,(e,t)=>Ss(Yo(e.channel,t))),Rs=D(2,(e,t)=>Ss(Zo(e.channel,t))),zs=D(2,(e,t)=>Qo(e.channel,t)),Bs=e=>$o(e.channel),Vs=D(e=>xs(e[0]),(e,t,n)=>{let r,i,a=_a(!1);return new ReadableStream({start(n){i=Kt(Hn(zs(e,e=>a.whenOpen(C(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Hr(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return se(Tt(pa(i)))}},n?.strategy)}),Hs=D(e=>xs(e[0]),(e,t)=>A(g(),n=>Vs(e,n,t))),Us=e(t(),1),Ws=e(Oi(),1);function Gs(e){return{_tag:`Value`,value:e}}function Ks(e,t){return{_tag:`Record`,keys:e,value:t}}function qs(e,t){return{_tag:`Array`,length:e,value:t}}wi(`SourceError`);var Js=rr(`effect/ConfigProvider`,{defaultValue:()=>tc()}),Ys={...ur,toJSON(){return{_id:`ConfigProvider`}}};function Xs(e,t,n){let r=Object.create(Ys);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}var Zs=e=>Rn(e)?Wn(Js)(e):Ir(Js)(e);function Qs(e){return Xs(t=>v($s(e,t)))}function $s(e,t){let n=e;for(let e of t){if(n==null)return;if(Array.isArray(n)){if(typeof e!=`number`||!Number.isInteger(e)||e<0||e>=n.length)return;n=n[e];continue}if(cn(n)){if(typeof e!=`string`||!Object.hasOwn(n,e))return;n=n[e];continue}return}return ec(n)}function ec(e){if(e!=null)return typeof e==`string`?Gs(e):typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?Gs(String(e)):Array.isArray(e)?qs(e.length):cn(e)?Ks(new Set(Object.keys(e))):Gs(Ui(e))}function tc(e){let t=e?.env??{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`},n=nc(t);return Xs(e=>v(ic(n,t,e)))}function nc(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e)i.children??={},i=i.children[t]??={};i.value=r}return t}var rc=/^(0|[1-9][0-9]*)$/;function ic(e,t,n){let r=t[n.map(String).join(`_`)],i=ac(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:Gs(r):a.every(e=>rc.test(e))?qs(Math.max(...a.map(e=>parseInt(e,10)))+1,r):Ks(new Set(a),r)}function ac(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}var oc=`~effect/Config`,sc=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},cc={...Ai({label:`Config`,evaluate(e){return this.parse(e.getRef(Js))}}),[oc]:oc,toJSON(){return{_id:`Config`}}};function lc(e){let t=Object.create(cc);return t.parse=e,t}var uc=D(2,(e,t)=>lc(n=>A(e.parse(n),t))),dc=D(2,(e,t)=>lc(n=>ua(e.parse(n),e=>t(e).parse(n))));function fc(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return _i(e.actual)||wr(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return _i(e.actual)||wr(e.actual)&&e.actual.value===void 0?!0:fc(e.issue);case`Pointer`:case`Filter`:return fc(e.issue);case`UnexpectedKey`:return!1;case`Forbidden`:return!1;case`Composite`:case`AnyOf`:return e.issues.every(fc)}}var pc=D(2,(e,t)=>dc(e,e=>{if(nr(e.cause)){let n=e.cause.issue;if(fc(n))return yc(t)}return vc(e.cause)})),mc=e=>e.pipe(uc(j),pc(N())),hc=O(function*(e,t){let n=yield*e.load(t);if(n!==void 0)switch(n._tag){case`Value`:return n.value;case`Record`:{if(n.value!==void 0)return n.value;let r={};for(let i of n.keys){let n=yield*hc(e,[...t,i]);n!==void 0&&(r[i]=n)}return r}case`Array`:{if(n.value!==void 0)return n.value;let r=[];for(let i=0;i<n.length;i++)r.push(yield*hc(e,[...t,i]));return r}}}),gc=O(function*(e,t,n){switch(e._tag){case`Objects`:{let r={};for(let i of e.propertySignatures){let e=i.name;if(typeof e==`string`){let a=yield*gc(i.type,t,[...n,e]);a!==void 0&&(r[e]=a)}}if(e.indexSignatures.length>0){let i=yield*t.load(n);if(i&&i._tag===`Record`)for(let a of e.indexSignatures){let e=Gn(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*gc(a.type,t,[...n,o]);e!==void 0&&(r[o]=e)}}}return r}case`Arrays`:{let r=yield*t.load(n);if(r&&r._tag===`Value`)return r.value;let i=[];for(let r=0;r<e.elements.length;r++)i.push(yield*gc(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*hc(t,n);case`Suspend`:return yield*gc(e.thunk(),t,n);default:{let e=yield*t.load(n);return e===void 0?void 0:e._tag===`Value`||e._tag===`Record`&&e.value!==void 0||e._tag===`Array`&&e.value!==void 0?e.value:void 0}}});function _c(e,t){let n=Fn(e),r=Zi(n),i=Wt(n.ast),a=typeof t==`string`?[t]:t??[];return lc(e=>{let t=e.prefix?[...e.prefix,...a]:a;return gc(i,e,a).pipe(mi(e=>r(e).pipe($n(e=>new ra(t.length>0?new ge(t,e):e)))),$n(e=>new sc(e)))})}function vc(e){return lc(()=>_n(new sc(e)))}function yc(e){return lc(()=>v(e))}function bc(e){return _c(E,e)}var xc=`~effect/SubscriptionRef`,Sc=e=>It(e,xc);({...ur});var Cc=e=>ks(e.pubsub),wc=e=>C(()=>e.value),Tc=(e,t)=>{e.value=t,Fa(e.pubsub,t)},Ec=D(2,(e,t)=>e.semaphore.withPermit(C(()=>Tc(e,t)))),Dc=class extends P()(`effect/reactivity/Reactivity`){},Oc=C(()=>{let e=new Map,t=t=>{Pc(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>un(n=>{let r=n.mapUnsafe.get(kc.key);return r?Pc(e,e=>{r.add(e)}):t(e),T}),r=(e,t)=>sa(t,n(e)),i=(t,n)=>{let r=[];return Pc(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i.delete(n),i.size===0&&e.delete(r[t])}}},a=(e,t)=>Ti(function*(){let n=yield*g(),r=xr(n,Ar),a=yield*qa(),o=yn(pe(n),ga(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?eo(a,e.cause):Xa(a,e.value),c?(c=!1,o(t).addObserver(l)):s=!1};function u(){if(s){c=!0;return}s=!0,o(t).addObserver(l)}return yield*lt(r,C(i(e,u))),u(),a});return Dc.of({mutation:r,query:a,stream:(e,t)=>a(e,t).pipe(A(Os),js),invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:t=>x(()=>{let n=new Set;return t.pipe(Ji(kc,n),vr(t=>C(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))})})}),kc=class extends P()(`effect/reactivity/Reactivity/PendingInvalidation`){},Ac=D(2,(e,t)=>Dc.use(n=>n.mutation(t,e))),jc=e=>Dc.use(t=>t.invalidate(e)),Mc=Wn(Dc)(Oc);function Nc(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return Ct(e)}}var Pc=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(Nc(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${Nc(r[e])}`)}},Fc=`~effect/reactivity/AsyncResult`,Ic=e=>It(e,Fc),Lc={[Fc]:{E:k,A:k},pipe(){return a(this,arguments)},[kr](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return u(this.value,e.value);case`Failure`:return u(this.cause,e.cause)}},[nt](){let e=ye(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:pt(e)(this._tag===`Success`?Ct(this.value):Ct(this.cause))}},Rc=(e,t)=>e._tag===`Success`?F(e.value):Kc(e.cause,{previous:t}),zc=e=>e._tag===`None`?Hc(!0):Jc(e.value),Bc=e=>e._tag===`Initial`,Vc=e=>e._tag!==`Initial`,Hc=(e=!1)=>{let t=Object.create(Lc);return t._tag=`Initial`,t.waiting=e,t},Uc=e=>e._tag===`Success`,F=(e,t)=>{let n=Object.create(Lc);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},Wc=e=>e._tag===`Failure`,Gc=(e,t)=>{let n=Object.create(Lc);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??N(),n.waiting=t?.waiting??!1,n},Kc=(e,t)=>Gc(e,{previousSuccess:Dn(t.previous,e=>Uc(e)?j(e):Wc(e)?e.previousSuccess:N()),waiting:t.waiting}),qc=(e,t)=>Kc(Ln(e),t),Jc=(e,t)=>{if(e.waiting)return t?.touch?Yc(e):e;let n=Object.assign(Object.create(Lc),e);return n.waiting=!0,t?.touch&&Uc(n)&&(n.timestamp=Date.now()),n},Yc=e=>Uc(e)?F(e.value,{waiting:e.waiting}):e,Xc=(e,t)=>e._tag===`Failure`?Kc(e.cause,{previous:t,waiting:e.waiting}):e,Zc=e=>e._tag===`Success`?j(e.value):e._tag===`Failure`?zn(e.previousSuccess,e=>e.value):N(),Qc=e=>Ei(Zc(e),()=>new Kr(`AsyncResult.getOrThrow: no value found`)),$c=e=>{switch(e._tag){case`Success`:return jt(e.value);case`Failure`:return pi(e.cause);default:return $e(new Kr)}},el=D(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return Gc(e.cause,{previousSuccess:zn(e.previousSuccess,e=>F(t(e.value),e)),waiting:e.waiting});case`Success`:return F(t(e.value),e)}}),tl=e=>{let t=e.success??Xt,n=e.error??Xt,r=yi()([t,Fe(n,Nt)],([e,t])=>(n,r,i)=>{if(!Ic(n))return _n(new Yt(r,j(n)));switch(n._tag){case`Initial`:return v(n);case`Success`:return Br(Zi(e)(n.value,i),{onSuccess:e=>F(e,n),onFailure:e=>new Gi(r,j(n),[new ge([`value`],e)])});case`Failure`:{let a=n.previousSuccess.pipe(zn(t=>Br(Zi(e)(t.value,i),{onSuccess:e=>j(F(e,t)),onFailure:e=>new Gi(r,j(n),[new ge([`previousSuccess`,`value`],e)])})),ar(()=>Re)),o=$n(Zi(t)(n.cause,i),e=>new Gi(r,j(n),[new ge([`cause`],e)]));return mi(a,e=>Mi(o,t=>Gc(t,{previousSuccess:e,waiting:n.waiting})))}}},{expected:`AsyncResult`,toCodec([e,t]){let n=Et(`Success`,{value:e,waiting:_e,timestamp:Ye});return dr()(sr([Et(`Initial`,{waiting:_e}),n,Et(`Failure`,{cause:t,previousSuccess:ci(n),waiting:_e})]),ie({decode:e=>{switch(e._tag){case`Initial`:return Hc(e.waiting);case`Success`:return F(e.value,{waiting:e.waiting,timestamp:e.timestamp});case`Failure`:return Gc(e.cause,{previousSuccess:zn(e.previousSuccess,e=>F(e.value,e)),waiting:e.waiting})}},encode(e){switch(e._tag){case`Initial`:return{_tag:`Initial`,waiting:e.waiting};case`Success`:return{_tag:`Success`,value:e.value,waiting:e.waiting,timestamp:e.timestamp};case`Failure`:return{_tag:`Failure`,cause:e.cause,previousSuccess:e.previousSuccess,waiting:e.waiting}}}}))},toEquivalence:Fr,toFormatter:([e,t])=>n=>{switch(n._tag){case`Success`:return`AsyncResult.Success(${e(n.value)}, ${n.waiting}, ${n.timestamp})`;case`Failure`:return`AsyncResult.Failure(${t(n.cause)}, ${n.waiting})`;case`Initial`:return`AsyncResult.Initial(${n.waiting}, ${n.waiting})`}}});return Object.assign(r,{success:t,error:n})},nl=`~effect/reactivity/AtomRegistry`,rl=e=>It(e,nl),il=e=>new dl(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),al=P(nl),ol=D(e=>rl(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Ve(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n($c(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n($c(e)),a())});return C(a)})}),sl={immediate:!0},cl=e=>{e()},ll=`~effect-atom/atom/Atom/Serializable`,ul=e=>ll in e?e[ll].key:e,dl=class{[nl];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[nl]=nl,this.scheduler=new pn(`sync`,t),this.schedulerAsync=new pn(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,n===void 0&&r!==void 0?this.timeoutResolution=Math.round(r/2):this.timeoutResolution=n??1e3,e!==void 0)for(let[t,n]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);n?.immediate&&t(r.value());let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,fi,sl)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=ul(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[ll].decode(r);n.setValue(i)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new ml(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(ul(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete(ul(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete(ul(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),t.forEach(e=>{this.nodeTimeoutBucket.delete(e),e.canBeRemoved&&(this.nodes.delete(ul(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL,e.remove(),this.#e=null)})}reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear(),this.nodes.forEach(e=>{e.remove(),this.onNodeRemoved?.(e)}),this.nodes.clear()}dispose(){this.disposed=!0,this.reset()}},fl={alive:1,initialized:2,waitingForValue:4},pl={uninitialized:fl.alive|fl.waitingForValue,stale:fl.alive|fl.initialized|fl.waitingForValue,valid:fl.alive|fl.initialized,removed:0},ml=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new vl(e,this)}registry;atom;state=pl.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;parents=[];previousParents;children=[];listeners=new Set;skipInvalidation=!1;currentState(){switch(this.state){case pl.uninitialized:return`uninitialized`;case pl.stale:return`stale`;case pl.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.length===0&&this.state!==0}_value=void 0;value(){if((this.state&fl.waitingForValue)!==0){this.lifetime=_l(this);let e=this.atom.read(this.lifetime);if((this.state&fl.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.state=pl.valid):this.setValue(e)),this.previousParents){let e=this.previousParents;this.previousParents=void 0;for(let t=0;t<e.length;t++)e[t].removeChild(this),e[t].canBeRemoved&&this.registry.scheduleNodeRemoval(e[t])}}return this._value}valueOption(){return(this.state&fl.initialized)===0?N():j(this._value)}setInitialValue(e){if((this.state&fl.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=pl.stale,this._value=e,I.phase===yl.collect?I.notify.add(this):this.notify();return}this.setValue(e)}setValue(e){if((this.state&fl.initialized)===0){this.state=pl.valid,this._value=e,I.phase===yl.collect?I.notify.add(this):this.notify();return}this.state=pl.valid,!Object.is(this._value,e)&&(this._value=e,this.skipInvalidation?this.skipInvalidation=!1:this.invalidateChildren(),this.listeners.size>0&&(I.phase===yl.collect?I.notify.add(this):this.notify()))}addParent(e){if(this.parents.push(e),this.previousParents!==void 0){let t=this.previousParents.indexOf(e);t!==-1&&(this.previousParents[t]=this.previousParents[this.previousParents.length-1],this.previousParents.pop()===void 0&&(this.previousParents=void 0))}e.children.indexOf(this)===-1&&(e.children.push(this),e.skipInvalidation&&=!1)}removeChild(e){let t=this.children.indexOf(e);t!==-1&&(this.children[t]=this.children[this.children.length-1],this.children.pop())}invalidate(){this.state===pl.valid&&(this.state=pl.stale,this.disposeLifetime()),I.phase===yl.collect?I.stale.push(this):this.atom.lazy&&this.listeners.size===0&&!hl(this.children)?(this.invalidateChildren(),this.skipInvalidation=!0):this.value()}invalidateChildren(){if(this.children.length===0)return;let e=this.children;this.children=[];for(let t=0;t<e.length;t++)e[t].invalidate()}notify(){this.listeners.forEach(cl),I.phase===yl.commit&&I.notify.delete(this)}disposeLifetime(){this.lifetime!==void 0&&(this.lifetime.dispose(),this.lifetime=void 0),this.parents.length!==0&&(this.previousParents=this.parents,this.parents=[])}remove(){if(this.state=pl.removed,this.listeners.clear(),this.lifetime===void 0||(this.disposeLifetime(),this.previousParents===void 0))return;let e=this.previousParents;this.previousParents=void 0;for(let t=0;t<e.length;t++)e[t].removeChild(this),e[t].canBeRemoved&&this.registry.removeNode(e[t])}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}};function hl(e){if(e.length===0)return!1;let t=e,n,r=0;for(;t!==void 0;){for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!r.atom.lazy||r.listeners.size>0)return!0;r.children.length>0&&(n===void 0?n=[r.children]:n.push(r.children))}t=n?.[r++]}return!1}var gl={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){if(this.disposed)return this.node.registry.get(e);let t=this.node.registry.ensureNode(e);return this.node.addParent(t),t.value()},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return ai;switch(n._tag){case`Initial`:return ai;case`Failure`:return pi(n.cause);case`Success`:return v(n.value)}},resultOnce(e,t){return Ve(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n($c(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n($c(e)))},{immediate:!1});return C(i)})},setResult(e,t){return this.disposed?ai:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?ai:v(t.value)},someOnce(e){return Ve(t=>{let n=this.once(e);if(wr(n))return t(v(n.value));let r=this.node.registry.subscribe(e,e=>{_i(e)||(r(),t(v(e.value)))},{immediate:!1});return C(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?N():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?Ts:ws(n=>C(()=>{this.subscribe(e,e=>Xa(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(Ns(Vc),Ms(e=>e._tag===`Success`?v(e.value):Oe(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0;for(let t=e.length-1;t>=0;t--)e[t]()}},_l=e=>{function t(n){if(t.disposed||t.isFn)return e.registry.get(n);let r=e.registry.ensureNode(n),i=r.value();return e.addParent(r),i}return Object.setPrototypeOf(t,gl),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t},vl=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},yl={disabled:0,collect:1,commit:2},I={phase:yl.disabled,depth:0,stale:[],notify:new Set};function bl(e){I.phase=yl.collect,I.depth++;try{if(e(),I.depth===1){for(let e=0;e<I.stale.length;e++)xl(I.stale[e]);I.phase=yl.commit;for(let e of I.notify)e.notify();I.notify.clear()}}finally{I.depth--,I.depth===0&&(I.phase=yl.disabled,I.stale=[])}}function xl(e){if(e.state!==pl.valid){for(let t=0;t<e.parents.length;t++){let n=e.parents[t];n.state!==pl.valid&&xl(n)}e.state!==pl.valid&&e.value()}}var Sl=`~effect/reactivity/Atom`,Cl=e=>It(e,Sl),wl=`~effect/reactivity/Atom/Writable`,Tl=D(2,(e,t)=>{let n=Cn(t),i=vn(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!i,idleTTL:i?r(n):void 0})}),El=Tl(0),Dl={[Sl]:Sl,...ur,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},Ol={...Dl,atom(e,t){let n=Il(e,t);return Ml(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):Xc(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>kl(this,e,t):kl(this,e,t)},pull(e,t){let n=El(zl(0));return eu(n,Ml(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?Vl(r,$l(r,n,e,t),Hc(!0),a.value):Xc(a,i)}))},subscriptionRef(e){return ql(El(Ml(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return Xc(r,n);let i=typeof e==`function`?e(t):e;return Sc(i)?i:Vl(t,i,Hc(!0),r.value)})),(e,t)=>Kl(e,t,Qc(e(this))))}},kl=(e,t,n)=>{let[r,i,a]=Ql(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Rn(i)?Ac(i,n.reactivityKeys):Ls(i,jc(n.reactivityKeys))}:t,n);return Nl(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):Xc(i,n)},i)},Al={...Dl,[wl]:wl},jl=e=>wl in e,Ml=(e,t)=>{let n=Object.create(Dl);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},Nl=(e,t,n)=>{let r=Object.create(Al);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function Pl(e,t){e.setSelf(t)}var Fl=(e,t)=>{let n=Il(e,t);return`~effect/reactivity/Atom`in n?n:Ml(n)},Il=(e,t)=>{if(typeof e==`function`&&!Rn(e)&&!xs(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:Ll in i?Bl(e,i,t,r):Rl in i?Wl(e,i,t,r):i;default:return i}}}else if(Rn(e))return function(n,r){return Bl(n,e,t,r)};else if(xs(e))return function(n,r){return Wl(n,e,t,r)};return zl(e)},Ll=`~effect/Effect`,Rl=`~effect/Stream`,zl=e=>Nl(function(t){return e},Pl),Bl=(e,t,n,r)=>Vl(e,t,n?.initialValue===void 0?Hc():F(n.initialValue),r,n?.uninterruptible);function Vl(e,t,n,r=hi(),i=!1){let a=e.self(),s=Be();e.addFinalizer(()=>{pe(r)(wt(s,o))});let c=new Map(r.mapUnsafe);c.set(Ar.key,s),c.set(al.key,e.registry),c.set(we.key,e.registry.scheduler);let l,u=!1,d=Hl(Kn(c),t,function(t){l=Rc(t,a),u&&e.setSelf(l)},i);return u=!0,d!==void 0&&e.addFinalizer(d),l===void 0?a._tag===`Some`?zc(a):Jc(n):l}function Hl(e,t,n,r=!1){if(Tn(t)){n(t);return}let i=pe(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}var Ul=(e=>{let t=Mc;function n(r){let i=Object.create(Ol);i.keepAlive=!1,i.lazy=!0,i.refresh=void 0,i.factory=n;let a=nu(Ml(typeof r==`function`?e=>yt(r(e),t):()=>yt(r,t)));return i.layer=a,i.read=function(t){let n=t(a);return Bl(t,y(Or,t=>na(n,e.memoMap,t)),{uninterruptible:!0})},i}n.memoMap=e.memoMap,n.addGlobalLayer=e=>{t=yt(t,le(e,Mc))};let r=El(Fl(un(t=>na(Mc,e.memoMap,xr(t,Ar))).pipe(A(xr(Dc)))));return n.withReactivity=e=>t=>iu(t,n=>{let i=Qc(n(r));return n.addFinalizer(i.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),n})({memoMap:Wi()});Ul.withReactivity;var Wl=(e,t,n,r)=>Gl(e,t,n?.initialValue===void 0?Hc():F(n.initialValue),r);function Gl(e,t,n,r=hi()){let i=e.self();r=Gr(r,al,e.registry);let a=st(n=>y(es(t.channel,n),t=>kt({while:Ee,body:()=>t,step(t){e.setSelf(F(at(t),{waiting:!0}))}}))).pipe(it(t=>(Yn(t)?At(e.self(),Dn(Zc),ei({onNone:()=>e.setSelf(qc(new Kr,{previous:e.self()})),onSome:t=>e.setSelf(F(t))})):e.setSelf(Kc(t,{previous:e.self()})),T))),o=new Map(r.mapUnsafe);o.set(al.key,e.registry),o.set(we.key,e.registry.scheduler);let s=Hl(Kn(o),a,fi,!1);return s!==void 0&&e.addFinalizer(s),i._tag===`Some`?zc(i):Jc(n)}var Kl=(e,t,n=hi())=>Sc(t)?(e.addFinalizer(Cc(t).pipe(zs(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return T}),Hi(n))),l(n)(wc(t))):t._tag===`Success`?Gl(e,Cc(t.value),Hc(!0),n):t,ql=(e,t)=>{function n(t,n){let r=t.get(e);Sc(r)?Pr(Ec(r,n)):Uc(r)&&Pr(Ec(r.value,n))}return Nl(n=>{let r=n(e);return Sc(r)||Uc(r)?t(n,r):r},n)},Jl=Symbol.for(`effect/reactivity/atom/Atom/Reset`),Yl=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),Xl=function(...e){return e.length===0?Zl:Zl(...e)},Zl=(e,t)=>{let[n,r]=Ql(e,t);return Nl(n,r)};function Ql(e,t){let n=El(zl([0,void 0])),r=t?.initialValue===void 0?Hc():F(t.initialValue),i=t?.concurrent?El(Ml(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===Yl)return Kc(ji(),{previous:t.self()});let l=e(c,t);return Ll in l?(o&&(l=y(Mt(l,{startImmediately:!0}),e=>(o.add(e),e.addObserver(()=>o.delete(e)),A(fa(o),e=>e[0])))),Vl(t,l,r,a,!1)):Gl(t,l,r,a)}function o(e,t){lu(()=>{t===Jl?e.set(n,[0,void 0]):t===Yl?e.set(n,[e.get(n)[0]+1,Yl]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var $l=(e,t,n,r)=>y(Bs(typeof n==`function`?n(e):n),n=>{let i=ha().context,a=Fi(),o=lr(n,{onFailure(e){return Yn(e)?Mr(a)?v({done:!0,items:a}):_n(new Kr(`Atom.pull: no items`)):Oe(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=ri(a,e),a=t),v({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(zc(e.self()));let t;t=Hl(i,o,n=>{t&&s.delete(t);let r=Rc(n,e.self()),i=s.size>0;e.setSelf(i?Jc(r):r)}),t&&s.add(t)}),o}),eu=(e,t)=>Nl(t.read,function(t,n){t.set(e,t.get(e)+1)}),tu=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=fs();return function(n){let r=ps(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return _s(t,n,i),i}}:e=>{let t=fs(),n=new FinalizationRegistry(e=>{ys(t,e)});return function(r){let i=ps(t,r).pipe(Dt(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return _s(t,r,new WeakRef(a)),n.register(a,r),a}},nu=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),ru=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!1}),iu=D(e=>Cl(e[0]),(e,t,n)=>{let r=El(jl(e)?Nl(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):Ml(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=au(n.initialValueTarget)),r}),au=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},ou=D(2,(e,t)=>iu(e,n=>t(n(e)))),su=e=>{let t=0,n=El(zl([t,void 0]));return Nl(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Ic(e))return t.setSelf(e);let n=Jr(t.self());switch(e._tag){case`Initial`:Bc(n)&&t.setSelf(e);return;case`Success`:Uc(n)?!e.waiting&&e.timestamp>=n.timestamp&&t.setSelf(e):t.setSelf(e);return;case`Failure`:return t.setSelf(e)}});let a=new Set,o=new Set;return t.subscribe(n,([,n])=>{if(a.has(n))return;a.add(n);let s;s=t.registry.subscribe(n,c=>{if(Uc(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!Wc(c)&&(i=!0),a.size===0&&(i?(i=!1,t.refresh(e)):t.setSelf(r))},{immediate:!0}),a.has(n)?o.add(s):s()}),t.addFinalizer(()=>{for(let e of o)e();a.clear(),o.clear()}),r},(e,r)=>e.set(n,[++t,r]),t=>t(e))},cu=D(2,(e,t)=>{let n=El(zl(Hc()));return Xl((r,i)=>{let a=t.reducer(i(e),r);Ic(a)&&(a=Jc(a,{touch:!0})),i.set(n,F(a,{waiting:!0})),i.set(e,n);let o=typeof t.fn==`function`?ru(t.fn(e=>i.set(n,F(Ic(e)?Jc(e):e,{waiting:!0})))):t.fn;return i.set(o,r),Ve(e=>{i.subscribe(o,t=>{t._tag===`Initial`||t.waiting||(i.set(n,el(t,()=>a)),e($c(t)))},{immediate:!0})})})}),lu=bl,uu=`~effect-atom/atom/Atom/Serializable`,du=D(2,(e,t)=>{let n=hr(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,Error().stack?.split(`
2
- `)[5]??``],[uu]:{key:t.key,encode:Vr(n),decode:Er(n)}})}),fu=`~effect-atom/atom/Atom/ServerValue`,pu=D(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[fu](e=>t.get(e)):t.get(e));function mu(e){let t=Ws.unstable_scheduleCallback(4,e);return()=>Ws.unstable_cancelCallback(t)}var hu=Us.createContext(il({scheduleTask:mu,defaultIdleTTL:400})),gu=new WeakMap;function _u(e,t){let n=gu.get(e);n===void 0&&(n=new WeakMap,gu.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i={subscribe(n){return e.subscribe(t,n)},snapshot(){return e.get(t)},getServerSnapshot(){return pu(t,e)}};return n.set(t,i),i}function vu(e,t){let n=_u(e,t);return Us.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var yu=(e,t)=>{let n=Us.useContext(hu);return t?vu(n,Us.useMemo(()=>ou(e,t),[e,t])):vu(n,e)};function bu(e,t){Us.useEffect(()=>e.mount(t),[t,e])}function xu(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Us.useCallback(r=>{e.set(t,r);let i=_t(ol(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(Su):i},[e,t,n.mode]):Us.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var Su=e=>{if(An(e))return e.value;throw Hr(e.cause)},Cu=(e,t)=>{let n=Us.useContext(hu);return bu(n,e),xu(n,e,t)},wu=e=>{let t=Us.useContext(hu);return bu(t,e),Us.useCallback(()=>{t.refresh(e)},[t,e])},Tu={suspendOnWaiting:new Map,default:new Map};function Eu(e,t,n){let r=n?Tu.suspendOnWaiting:Tu.default,i=r.get(t);return i===void 0?(i=new Promise(i=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),i(),r.delete(t))})}),r.set(t,i),i):i}function Du(e,t,n){let r=vu(e,t);if(r._tag===`Initial`||n&&r.waiting)throw Eu(e,t,n);return r}var Ou=(e,t)=>{let n=Du(Us.useContext(hu),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw Hr(n.cause);return n},ku=Symbol.for(`~effect/http/Headers`),Au=Object.create(null);Object.defineProperties(Au,{[ku]:{value:ku},[me]:{value(e){return Bu(this,xr(e,Vu))}},toJSON:{value(){return qt(this)}},[kr]:{value(e){return Mu(this,e)}},[nt]:{value(){return ze(this)}},toString:{value:ta.toString},[Yi]:{value:ta[Yi]}});var ju=e=>Object.assign(Object.create(Au),e),Mu=an(vt()),Nu=Object.create(Au),Pu=e=>{if(e===void 0)return Nu;if(Symbol.iterator in e){let t=Object.create(Au);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(Au);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},Fu=e=>Object.setPrototypeOf(e,Au),Iu=D(3,(e,t,n)=>{let r=ju(e);return r[t.toLowerCase()]=n,r}),Lu=D(2,(e,t)=>ju({...e,...Pu(t)})),Ru=D(2,(e,t)=>{let n=ju(e);return Object.assign(n,t),n}),zu=D(2,(e,t)=>{let n=ju(e);return delete n[t.toLowerCase()],n}),Bu=D(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=ue(e[r]))}else for(let r in e)t.test(r)&&(n[r]=ue(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Vu=rr(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Hu=`~effect/http/Cookies`,Uu=`~effect/http/Cookies/Cookie`;wi(`CookieError`);var Wu={[Hu]:Hu,...ta,toJSON(){return{_id:`effect/Cookies`,cookies:Ae(this.cookies,e=>e.toJSON())}},pipe(){return a(this,arguments)}},Gu=e=>{let t=Object.create(Wu);return t.cookies=e,t},Ku=e=>{let t={};for(let n of e)t[n.name]=n;return Gu(t)},qu=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=Ju(e.trim());t&&n.push(t)}return Ku(n)};function Ju(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``);if(t.length===0)return;let n=t[0].indexOf(`=`);if(n===-1)return;let r=t[0].slice(0,n);if(!Yu.test(r))return;let i=t[0].slice(n+1),a=Zu(i);if(t.length===1)return Object.assign(Object.create(Xu),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=Ot(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`;break}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`;break}break}}return Object.assign(Object.create(Xu),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var Yu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Xu={[Uu]:Uu,...ta,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},Zu=e=>{try{return decodeURIComponent(e)}catch{return e}},Qu=`~effect/http/HttpClientError`,$u=class extends wi(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[Qu]=Qu;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},ed=e=>e.endsWith(`Error`)?e.slice(0,-5):e,td=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,nd=class extends wi(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return td(ed(this._tag),this.description,this.methodAndUrl)}};wi(`EncodeError`);var rd=class extends wi(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return td(ed(this._tag),this.description,this.methodAndUrl)}};wi(`StatusCodeError`);var id=class extends wi(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return td(ed(this._tag),this.description,e)}},ad=class extends wi(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return td(ed(this._tag),this.description,e)}},od=class e extends ia(Qu)({_tag:br(`HttpError`),kind:ke([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:M(Nt)}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},sd=`~effect/http/UrlParams`,cd={...ur,[sd]:sd,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[kr](e){return fd(this,e)},[nt](){return ct(this.params.flat())}},ld=e=>{let t=Object.create(cd);return t.params=e,t},ud=e=>{let t=dd(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return ld(n)},dd=e=>{let t=typeof e[Symbol.iterator]==`function`?Bi(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`){let t=dd(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},fd=ce((e,t)=>pd(e.params,t.params)),pd=bt(fn([vt(),vt()])),md=ld([]),hd=D(2,(e,t)=>{let n=ud(t),r=n.params,i=new Set;for(let e=0;e<r.length;e++)i.add(r[e][0]);for(let t=0;t<e.params.length;t++)i.has(e.params[t][0])||r.push(e.params[t]);return n}),gd=class extends wi(`UrlParamsError`){},_d=(e,t,n)=>{try{let r=new URL(e,vd());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,i)}return n!==void 0&&(r.hash=n),Sn(r)}catch(e){return Ce(new gd({cause:e}))}},vd=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},yd=`~effect/http/HttpBody`;wi(`HttpBodyError`);var bd=class{[yd];constructor(){this[yd]=yd}[Yi](){return this.toJSON()}toString(){return Ui(this,{ignoreToString:!0})}},xd=new class extends bd{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},Sd=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],Cd=`~effect/http/HttpClientRequest`,wd={[Cd]:Cd,...ta,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:qt(this.headers),body:this.body.toJSON()}},pipe(){return a(this,arguments)}};function Td(e,t,n,r,i,a){let o=Object.create(wd);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var Ed=Td(`GET`,``,md,N(),Nu,xd),Dd=e=>(t,n)=>Od(Ed,{method:e,url:t,...n??void 0}),Od=D(2,(e,t)=>{let n=e;return t.method&&(n=kd(n,t.method)),t.url&&(n=Pd(n,t.url)),t.headers&&(n=jd(n,t.headers)),t.urlParams&&(n=Fd(n,t.urlParams)),t.hash&&(n=Id(n,t.hash)),t.body&&(n=Ld(n,t.body)),t.accept&&(n=Md(n,t.accept)),t.acceptJson&&(n=Nd(n)),n}),kd=D(2,(e,t)=>Td(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Ad=D(3,(e,t,n)=>Td(e.method,e.url,e.urlParams,e.hash,Iu(e.headers,t,n),e.body)),jd=D(2,(e,t)=>Td(e.method,e.url,e.urlParams,e.hash,Lu(e.headers,t),e.body)),Md=D(2,(e,t)=>Ad(e,`Accept`,t)),Nd=Md(`application/json`),Pd=D(2,(e,t)=>{if(typeof t==`string`)return Td(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),i=ud(r.searchParams),a=n(r.hash===``?void 0:r.hash.slice(1));return r.search=``,r.hash=``,Td(e.method,r.toString(),i,a,e.headers,e.body)}),Fd=D(2,(e,t)=>Td(e.method,e.url,hd(e.urlParams,t),e.hash,e.headers,e.body)),Id=D(2,(e,t)=>Td(e.method,e.url,e.urlParams,j(t),e.headers,e.body)),Ld=D(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=zu(zu(n,`Content-Type`),`Content-length`):(t.contentType&&(n=Iu(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=Iu(n,`content-length`,t.contentLength.toString()))),Td(e.method,e.url,e.urlParams,e.hash,n,t)}),Rd=`~effect/http/HttpIncomingMessage`,zd=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Pr(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Pr(e.text)}catch{}let i={...t,headers:qt(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},Bd=`~effect/http/HttpClientResponse`,Vd=(e,t)=>new Hd(e,t),Hd=class extends Un{[Rd];[Bd];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[Rd]=Rd,this[Bd]=Bd}toJSON(){return zd(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return Pu(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=qu(this.source.headers.getSetCookie())}get remoteAddress(){return N()}get stream(){return this.source.body?As({evaluate:()=>this.source.body,onError:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}):Ds(new $u({reason:new ad({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return y(this.text,e=>Te({try:()=>e===``?null:JSON.parse(e),catch:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody?this.textBody:(this.textBody=mn({try:()=>this.source.text(),catch:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}).pipe(xe,Pr),this.arrayBufferBody=A(this.textBody,e=>new TextEncoder().encode(e).buffer),this.textBody)}get urlParamsBody(){return y(this.text,e=>Te({try:()=>ud(new URLSearchParams(e)),catch:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=mn({try:()=>this.source.formData(),catch:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}).pipe(xe,Pr)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=mn({try:()=>this.source.arrayBuffer(),catch:e=>new $u({reason:new id({request:this.request,response:this,cause:e})})}).pipe(xe,Pr),this.textBody=A(this.arrayBufferBody,e=>new TextDecoder().decode(e)),this.arrayBufferBody)}pipe(){return a(this,arguments)}},Ud=e=>Fu({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${ei(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),Wd=`~effect/http/HttpClient`,Gd=P(`effect/HttpClient`),Kd=D(2,(e,t)=>qd(n=>t(e.postprocess(n)),e.preprocess)),qd=(e,t)=>{let n=Object.create(Jd);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},Jd={[Wd]:Wd,pipe(){return a(this,arguments)},...ta,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(Sd.map(([e,t])=>[t,function(t,n){return this.execute(Dd(e)(t,n))}]))},Yd=e=>qd(t=>y(t,t=>i(n=>{let r=tf.get(t),i=r??new AbortController,a=_d(t.url,t.urlParams,Jr(t.hash));if(li(a))return _n(new $u({reason:new rd({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(oa)||n.getRef(Xd)(t)){let a=e(t,o,i.signal,n);return r?a:di(e=>lr(e(a),{onSuccess(e){return ef.register(e,i),v(new nf(e,i))},onFailure(e){return qn(e)&&i.abort(),Oe(e)}}))}return wn(n.getRef(Qd)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method),a.attribute(`server.address`,o.origin),o.port!==``&&a.attribute(`server.port`,+o.port),a.attribute(`url.full`,o.toString()),a.attribute(`url.path`,o.pathname),a.attribute(`url.scheme`,o.protocol.slice(0,-1));let s=o.search.slice(1);s!==``&&a.attribute(`url.query`,s);let c=n.getRef(Vu),l=Bu(t.headers,c);for(let e in l)a.attribute(`http.request.header.${e}`,String(l[e]));return t=n.getRef(Zd)?jd(t,Ud(a)):t,di(s=>s(e(t,o,i.signal,n)).pipe(or(a,{captureStackTrace:!1}),lr({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);let t=Bu(e.headers,c);for(let e in t)a.attribute(`http.response.header.${e}`,String(t[e]));return r?v(e):(ef.register(e,i),v(new nf(e,i)))},onFailure(e){return!r&&qn(e)&&i.abort(),Oe(e)}})))})})),v),Xd=rr(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>hn}),Zd=rr(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:Ee}),Qd=rr(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),$d=e=>Wn(Gd)(un(t=>A(e,e=>Kd(e,Ge(e=>Rr(t,e)))))),ef=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),tf=new WeakMap,nf=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[Bd]=Bd;[Rd]=Rd;applyInterrupt(e){return x(()=>(ef.unregister(this.original),pr(e,()=>C(()=>{this.controller.abort()}))))}get request(){return this.original.request}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return Es(()=>(ef.unregister(this.original),Ls(this.original.stream,C(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Yi](){return this.original[Yi]()}pipe(){return a(this,arguments)}},rf=rr(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),af=class extends P()(`effect/http/FetchHttpClient/RequestInit`){},of=$d(v(Yd((e,t,n,r)=>{let i=r.getRef(rf),a=r.context.mapUnsafe.get(af.key)??{},o=a.headers?Ru(Pu(a.headers),e.headers):e.headers;o[`content-length`]&&(o=zu(o,`content-length`));let s=r=>A(mn({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:e.body._tag===`Stream`?`half`:void 0,signal:n}),catch:t=>new $u({reason:new nd({request:e,cause:t})})}),t=>Vd(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return y(Hs(e.body.stream),s)}return s(void 0)}))),sf=`~effect/FiberSet`,cf=e=>It(e,sf),lf={[sf]:sf,[Symbol.iterator](){return this.state._tag===`Closed`?Zt():this.state.backing[Symbol.iterator]()},...ur,toJSON(){return{_id:`FiberMap`,state:this.state}}},uf=(e,t)=>{let n=Object.create(lf);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},df=()=>Lr(C(()=>uf(new Set,gn())),e=>x(()=>{let t=e.state;if(t._tag===`Closed`)return T;e.state={_tag:`Closed`};let n=t.backing;return ma(n).pipe(tn(e.deferred))})),ff=-1,pf=We(Ze(Qr,ui(ff))),mf=D(e=>cf(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(ff);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),bn(r)&&(n?.propagateInterruption===!0?!pf(r.cause):!zr(r.cause))&&ln(e.deferred,r))})}),hf=function(){let e;return()=>(e===void 0&&(e=Kt(gi)),e)}(),gf=e=>()=>A(g(),t=>{let n=pe(t);return(t,r)=>{if(e.state._tag===`Closed`)return hf();let i=n(t,r);return mf(e,i),i}}),_f=e=>ee(e.deferred),vf=`~effect/socket/Socket`,yf=P(`effect/socket/Socket`),bf=e=>yf.of({[vf]:vf,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(e=>typeof e==`string`?t(xf.encode(e)):e instanceof Uint8Array?t(e):t(new Uint8Array(e)),n)),runString:e.runString??(e.run?(t,n)=>e.run(e=>t(Sf.decode(e)),n):(t,n)=>e.runRaw(e=>typeof e==`string`?t(e):e instanceof Uint8Array?t(Sf.decode(e)):t(Sf.decode(new Uint8Array(e))),n)),writer:e.writer}),xf=new TextEncoder,Sf=new TextDecoder,Cf=`~effect/socket/Socket/CloseEvent`,wf=e=>It(e,Cf),Tf=`~effect/socket/Socket/SocketError`,Ef=e=>It(e,Tf),Df=class extends ia(`effect/socket/Socket/SocketReadError`)({_tag:br(`SocketReadError`),cause:Nt}){message=`An error occurred during Read`},Of=class extends ia(`effect/socket/Socket/SocketWriteError`)({_tag:br(`SocketWriteError`),cause:Nt}){message=`An error occurred during Write`},kf=class extends ia(`effect/socket/Socket/SocketOpenError`)({_tag:br(`SocketOpenError`),kind:ke([`Unknown`,`Timeout`]),cause:Nt}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},Af=class extends ia(`effect/socket/Socket/SocketCloseError`)({_tag:br(`SocketCloseError`),code:Ye,closeReason:M(E)}){static filterClean(e){return function(t){return Mf.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?Sn(t.reason):Ce(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},jf=sr([Df,Of,kf,Af]),Mf=class extends En(Tf)(`SocketError`,{_tag:br(`SocketError`),reason:jf}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[Tf]=Tf;static is(e){return Ef(e)}message=this.reason.message},Nf=e=>!0,Pf=class extends P()(`~effect/socket/Socket/WebSocket`){},Ff=class extends P()(`@effect/platform/Socket/WebSocketConstructor`){},If=Ir(Ff)((e,t)=>new globalThis.WebSocket(e,t)),Lf=(e,t)=>Ff.use(n=>Rf(Lr((typeof e==`string`?v(e):e).pipe(A(e=>n(e,t?.protocols))),e=>C(()=>e.close(1e3))),t)),Rf=(e,t)=>i(n=>{let r,i=_a(!1),a=n.context,o=t?.closeCodeIsError??Nf;return v(bf({runRaw:(n,s)=>st(O(function*(a){let c=yield*df().pipe(rt(a)),l=yield*rt(e,a),u=yield*Ji(gf(c)(),Pf,l),d=!1;function f(e){if(e.data instanceof Blob)return u(y(Li(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return Rn(t)?t:T}));let t=n(e.data);Rn(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),ln(c.deferred,_n(new Mf({reason:d?new Df({cause:e}):new kf({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),ln(c.deferred,_n(new Mf({reason:new Af({code:t,closeReason:e.reason})})))}if(l.addEventListener(`close`,m,{once:!0}),l.addEventListener(`error`,p,{once:!0}),l.addEventListener(`message`,f),l.readyState!==1){let e=gn();l.addEventListener(`open`,()=>{d=!0,ln(e,T)},{once:!0}),yield*ee(e).pipe($t({duration:t?.openTimeout??1e4,orElse:()=>_n(new Mf({reason:new kf({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),Vt(_f(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*Rt(_f(c),Af.filterClean(e=>!o(e)),()=>T)})).pipe(Ge(e=>Rr(a,e)),nn(C(()=>{i.closeUnsafe(),r=void 0}))),writer:v(e=>i.whenOpen(C(()=>{let t=r;wf(e)?t.close(e.code,e.reason):t.send(e)})))}))}),zf=yn(Lf,Wn(yf)),Bf=class extends P()(`effect/workers/Transferable/Collector`){},Vf=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return Bf.of({addAllUnsafe:t,addAll:e=>C(()=>t(e)),readUnsafe:n,read:C(n),clearUnsafe:r,clear:C(r)})},Hf=`~effect/workers/WorkerError`,Uf=sr([class extends ia(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:br(`WorkerSpawnError`),message:E,cause:M(Nt)}){},class extends ia(`effect/workers/WorkerError/WorkerSendError`)({_tag:br(`WorkerSendError`),message:E,cause:M(Nt)}){},class extends ia(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:br(`WorkerReceiveError`),message:E,cause:M(Nt)}){},class extends ia(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:br(`WorkerUnknownError`),message:E,cause:M(Nt)}){}]);ia(Hf)({_tag:br(`WorkerError`),reason:Uf});var Wf=`~effect/interfaces/PrimaryKey`,Gf=`~effect/rpc/RpcSchema/StreamSchema`;function Kf(e){return It(e,Gf)}function qf(e){return Kf(e)?j({success:e.success,error:e.error}):N()}var Jf=Xr(xs);function Yf(e,t){return si(Jf.ast,{[Gf]:Gf,success:e,error:t})}P()(`effect/rpc/RpcSchema/ClientAbort`);var Xf=`~effect/rpc/Rpc`,Zf={[Xf]:Xf,pipe(){return a(this,arguments)},setSuccess(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return Qf({_tag:this._tag,payloadSchema:Pi(e)?e:w(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return Qf({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Gr(this.annotations,e,t)})},annotateMerge(e){return Qf({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Rr(this.annotations,e)})}},Qf=e=>{function t(){}return Object.setPrototypeOf(t,Zf),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},L=(e,t)=>{let n=t?.success??ki,r=t?.error??Xt,i=t?.defect??Nt,a;return a=t?.primaryKey?class extends b(`effect/rpc/Rpc/${e}`)(t.payload){[Wf](){return t.primaryKey(this)}}:Pi(t?.payload)?t?.payload:t?.payload?w(t?.payload):ki,Qf({_tag:e,payloadSchema:a,successSchema:t?.stream?Yf(n,r):n,errorSchema:t?.stream?Xt:r,defectSchema:i,annotations:hi(),middlewares:new Set})},$f=new WeakMap,ep=e=>{if($f.has(e))return $f.get(e);let t=e,n=new Set([t.errorSchema]),r=qf(t.successSchema);wr(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=p(wr(r)?ki:t.successSchema,sr([...n]),t.defectSchema);return $f.set(e,i),i},tp=`~effect/rpc/Rpc/Wrapper`,np=e=>tp in e,rp=`~effect/rpc/RpcClientError`,ip=class extends ia(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:br(`RpcClientDefect`),message:E,cause:Nt}){},ap=class extends ia(rp)({_tag:br(`RpcClientError`),reason:sr([Uf,jf,od,ip])}){[rp]=rp;get message(){return`${this.reason._tag}: ${this.reason.message}`}},op=e=>typeof e==`bigint`?e:BigInt(e),sp={_tag:`Ping`},cp;try{cp=new TextDecoder}catch{}var R,lp,z=0,up=[],dp=up,fp=0,B={},V,pp,mp=0,hp=0,H,gp,_p=[],U,vp={useRecords:!1,mapsAsObjects:!0},yp=class{},bp=new yp;bp.name=`MessagePack 0xC1`;var xp=!1,Sp=2,Cp=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(R)return Xp(()=>(Zp(),this?this.unpack(t,n):e.prototype.unpack.call(vp,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(lp=n.end||t.length,z=n.start||0):(z=0,lp=n>-1?n:t.length),fp=0,hp=0,pp=null,dp=up,H=null,R=t;try{U=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw R=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(B=this,this.structures)return V=this.structures,wp(n);(!V||V.length>0)&&(V=[])}else B=vp,(!V||V.length>0)&&(V=[]);return wp(n)}unpackMultiple(e,t){let n,r=0;try{xp=!0;let i=e.length,a=this?this.unpack(e,i):$p.unpack(e,i);if(t){if(t(a,r,z)===!1)return;for(;z<i;)if(r=z,t(wp(),r,z)===!1)return}else{for(n=[a];z<i;)r=z,n.push(wp());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{xp=!1,Zp()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function wp(e){try{if(!B.trusted&&!xp){let e=V.sharedLength||0;e<V.length&&(V.length=e)}let t;if(B._readStruct&&R[z]<64&&R[z]>=32?(t=B._readStruct(R,z,lp),R=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),z=lp):t=W(),H&&=(z=H.postBundlePosition,null),xp&&(V.restoreStructures=null),z==lp)V&&V.restoreStructures&&Tp(),V=null,R=null,gp&&=null;else if(z>lp)throw Error(`Unexpected end of MessagePack data`);else if(!xp){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw V&&V.restoreStructures&&Tp(),Zp(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||z>lp)&&(e.incomplete=!0),e}}function Tp(){for(let e in V.restoreStructures)V[e]=V.restoreStructures[e];V.restoreStructures=null}function W(){let e=R[z++];if(e<160)if(e<128){if(e<64)return e;{let t=V[e&63]||B.getStructures&&kp()[e&63];return t?(t.read||=Dp(t,e&63),t.read()):e}}else if(e<144)if(e-=128,B.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Up();e===`__proto__`&&(e=`__proto_`),t[e]=W()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(W(),W());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=W();return B.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(hp>=z)return pp.slice(z-mp,(z+=t)-mp);if(hp==0&&lp<140){let e=t<16?Rp(t):Lp(t);if(e!=null)return e}return Ap(t)}else{let t;switch(e){case 192:return null;case 193:return H?(t=W(),t>0?H[1].slice(H.position1,H.position1+=t):H[0].slice(H.position0,H.position0-=t)):bp;case 194:return!1;case 195:return!0;case 196:if(t=R[z++],t===void 0)throw Error(`Unexpected end of buffer`);return Bp(t);case 197:return t=U.getUint16(z),z+=2,Bp(t);case 198:return t=U.getUint32(z),z+=4,Bp(t);case 199:return Vp(R[z++]);case 200:return t=U.getUint16(z),z+=2,Vp(t);case 201:return t=U.getUint32(z),z+=4,Vp(t);case 202:if(t=U.getFloat32(z),B.useFloat32>2){let e=Qp[(R[z]&127)<<1|R[z+1]>>7];return z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return z+=4,t;case 203:return t=U.getFloat64(z),z+=8,t;case 204:return R[z++];case 205:return t=U.getUint16(z),z+=2,t;case 206:return t=U.getUint32(z),z+=4,t;case 207:return B.int64AsType===`number`?(t=U.getUint32(z)*4294967296,t+=U.getUint32(z+4)):B.int64AsType===`string`?t=U.getBigUint64(z).toString():B.int64AsType===`auto`?(t=U.getBigUint64(z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=U.getBigUint64(z),z+=8,t;case 208:return U.getInt8(z++);case 209:return t=U.getInt16(z),z+=2,t;case 210:return t=U.getInt32(z),z+=4,t;case 211:return B.int64AsType===`number`?(t=U.getInt32(z)*4294967296,t+=U.getUint32(z+4)):B.int64AsType===`string`?t=U.getBigInt64(z).toString():B.int64AsType===`auto`?(t=U.getBigInt64(z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=U.getBigInt64(z),z+=8,t;case 212:if(t=R[z++],t==114)return Gp(R[z++]&63);{let e=_p[t];if(e)return e.read?(z++,e.read(W())):e.noBuffer?(z++,e()):e(R.subarray(z,++z));throw Error(`Unknown extension `+t)}case 213:return t=R[z],t==114?(z++,Gp(R[z++]&63,R[z++])):Vp(2);case 214:return Vp(4);case 215:return Vp(8);case 216:return Vp(16);case 217:return t=R[z++],hp>=z?pp.slice(z-mp,(z+=t)-mp):jp(t);case 218:return t=U.getUint16(z),z+=2,hp>=z?pp.slice(z-mp,(z+=t)-mp):Mp(t);case 219:return t=U.getUint32(z),z+=4,hp>=z?pp.slice(z-mp,(z+=t)-mp):Np(t);case 220:return t=U.getUint16(z),z+=2,Fp(t);case 221:return t=U.getUint32(z),z+=4,Fp(t);case 222:return t=U.getUint16(z),z+=2,Ip(t);case 223:return t=U.getUint32(z),z+=4,Ip(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}var Ep=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Dp(e,t){function n(){if(n.count++>Sp){let r;try{r=e.read=Function(`r`,`return function(){return `+(B.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:Ep.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(W)}catch{return Sp=1/0,n()}return e.highByte===0&&(e.read=Op(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=W()}return B.freezeData?Object.freeze(r):r}return n.count=0,e.highByte===0?Op(t,n):n}var Op=(e,t)=>function(){let n=R[z++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=V[r]||kp()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=Dp(i,e),i.read()};function kp(){let e=Xp(()=>(R=null,B.getStructures()));return V=B._mergeStructures(e,V)}var Ap=Pp,jp=Pp,Mp=Pp,Np=Pp;function Pp(e){let t;if(e<16&&(t=Rp(e)))return t;if(e>64&&cp)return cp.decode(R.subarray(z,z+=e));let n=z+e,r=[];for(t=``;z<n;){let e=R[z++];if(!(e&128))r.push(e);else if((e&224)==192){let t=R[z++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=R[z++]&63,n=R[z++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=R[z++]&63,n=R[z++]&63,i=R[z++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=G.apply(String,r),r.length=0)}return r.length>0&&(t+=G.apply(String,r)),t}function Fp(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=W();return B.freezeData?Object.freeze(t):t}function Ip(e){if(B.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Up();e===`__proto__`&&(e=`__proto_`),t[e]=W()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(W(),W());return t}}var G=String.fromCharCode;function Lp(e){let t=z,n=Array(e);for(let r=0;r<e;r++){let e=R[z++];if((e&128)>0){z=t;return}n[r]=e}return G.apply(String,n)}function Rp(e){if(e<4)if(e<2){if(e===0)return``;{let e=R[z++];if((e&128)>1){--z;return}return G(e)}}else{let t=R[z++],n=R[z++];if((t&128)>0||(n&128)>0){z-=2;return}if(e<3)return G(t,n);let r=R[z++];if((r&128)>0){z-=3;return}return G(t,n,r)}else{let t=R[z++],n=R[z++],r=R[z++],i=R[z++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){z-=4;return}if(e<6){if(e===4)return G(t,n,r,i);{let e=R[z++];if((e&128)>0){z-=5;return}return G(t,n,r,i,e)}}else if(e<8){let a=R[z++],o=R[z++];if((a&128)>0||(o&128)>0){z-=6;return}if(e<7)return G(t,n,r,i,a,o);let s=R[z++];if((s&128)>0){z-=7;return}return G(t,n,r,i,a,o,s)}else{let a=R[z++],o=R[z++],s=R[z++],c=R[z++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){z-=8;return}if(e<10){if(e===8)return G(t,n,r,i,a,o,s,c);{let e=R[z++];if((e&128)>0){z-=9;return}return G(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=R[z++],u=R[z++];if((l&128)>0||(u&128)>0){z-=10;return}if(e<11)return G(t,n,r,i,a,o,s,c,l,u);let d=R[z++];if((d&128)>0){z-=11;return}return G(t,n,r,i,a,o,s,c,l,u,d)}else{let l=R[z++],u=R[z++],d=R[z++],f=R[z++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){z-=12;return}if(e<14){if(e===12)return G(t,n,r,i,a,o,s,c,l,u,d,f);{let e=R[z++];if((e&128)>0){z-=13;return}return G(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=R[z++],m=R[z++];if((p&128)>0||(m&128)>0){z-=14;return}if(e<15)return G(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=R[z++];if((h&128)>0){z-=15;return}return G(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function zp(){let e=R[z++],t;if(e<192)t=e-160;else switch(e){case 217:t=R[z++];break;case 218:t=U.getUint16(z),z+=2;break;case 219:t=U.getUint32(z),z+=4;break;default:throw Error(`Expected string`)}return Pp(t)}function Bp(e){return B.copyBuffers?Uint8Array.prototype.slice.call(R,z,z+=e):R.subarray(z,z+=e)}function Vp(e){let t=R[z++];if(_p[t]){let n;return _p[t](R.subarray(z,n=z+=e),e=>{z=e;try{return W()}finally{z=n}})}else throw Error(`Unknown extension type `+t)}var Hp=Array(4096);function Up(){let e=R[z++];if(e>=160&&e<192){if(e-=160,hp>=z)return pp.slice(z-mp,(z+=e)-mp);if(!(hp==0&&lp<180))return Ap(e)}else return z--,Wp(W());let t=(e<<5^(e>1?U.getUint16(z):e>0?R[z]:0))&4095,n=Hp[t],r=z,i=z+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=U.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=R[r++],a!=n[o++]){r=1879048192;break}if(r===i)return z=r,n.string;i-=3,r=z}for(n=[],Hp[t]=n,n.bytes=e;r<i;)a=U.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=R[r++],n.push(a);let s=e<16?Rp(e):Lp(e);return s==null?n.string=Ap(e):n.string=s}function Wp(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if(B.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var Gp=(e,t)=>{let n=W().map(Wp),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=V[e];return i&&(i.isShared||xp)&&((V.restoreStructures||=[])[e]=i),V[e]=n,n.read=Dp(n,r),n.read()};_p[0]=()=>{},_p[0].noBuffer=!0,_p[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};var Kp={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};_p[101]=()=>{let e=W();if(!Kp[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return Kp[e[0]](e[1],{cause:e[2]})},_p[105]=e=>{if(B.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=U.getUint32(z-4);gp||=new Map;let n=R[z],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&R[z+1]===115?new Set:{};let i={target:r};gp.set(t,i);let a=W();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},_p[112]=e=>{if(B.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=U.getUint32(z-4),n=gp.get(t);return n.used=!0,n.target},_p[115]=()=>new Set(W());var qp=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),Jp=typeof globalThis==`object`?globalThis:window;_p[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=qp[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new Jp[r](n)},_p[120]=()=>{let e=W();return new RegExp(e[0],e[1])};var Yp=[];_p[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=z;return z+=t-e.length,H=Yp,H=[zp(),zp()],H.position0=0,H.position1=0,H.postBundlePosition=z,z=n,W()},_p[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function Xp(e){B&&B._onSaveState&&B._onSaveState();let t=lp,n=z,r=fp,i=mp,a=hp,o=pp,s=dp,c=gp,l=H,u=new Uint8Array(R.slice(0,lp)),d=V,f=V.slice(0,V.length),p=B,m=xp,h=e();return lp=t,z=n,fp=r,mp=i,hp=a,pp=o,dp=s,gp=c,H=l,R=u,xp=m,V=d,V.splice(0,V.length,...f),B=p,U=new DataView(R.buffer,R.byteOffset,R.byteLength),h}function Zp(){R=null,gp=null,V=null}var Qp=Array(147);for(let e=0;e<256;e++)Qp[e]=+(`1e`+Math.floor(45.15-e*.30103));var $p=new Cp({useRecords:!1});$p.unpack,$p.unpackMultiple,$p.unpack;var em={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),Cp.SUPPORTS_STRUCT_HOOKS=!0;var tm;try{tm=new TextEncoder}catch{}var nm,rm,im=typeof Buffer<`u`,am=im?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,om=im?Buffer:Uint8Array,sm=im?4294967296:2144337920,K,cm,q,J=0,Y,X=null,lm=21760,um=/[\u0080-\uFFFF]/,dm=Symbol(`record-id`),fm=class extends Cp{constructor(e){super(e),this.offset=0;let t,n,r,i,a=om.prototype.utf8Write?function(e,t){return K.utf8Write(e,t,K.byteLength-t)}:tm&&tm.encodeInto?function(e,t){return tm.encodeInto(e,K.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,ee=0;this.pack=this.encode=function(e,a){if(K||(K=new am(8192),q=K.dataView||=new DataView(K.buffer,0,8192),J=0),Y=K.length-10,Y-J<2048?(K=new am(K.length),q=K.dataView||=new DataView(K.buffer,0,K.length),Y=K.length-10,J=0):J=J+7&2147483640,t=J,a&2048&&(J+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(X=[],X.size=1/0):X=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[dm]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?oe(e):e.constructor!==Map&&!Array.isArray(e)&&!rm.some(t=>e instanceof t)?oe(e.toJSON?e.toJSON():e):_(e):_(e);let n=X;if(X&&_m(t,_,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(q.setUint32(n.position+t,q.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&q.setUint32(n.position+t,q.getUint32(n.position+t)+a),J+=e.length*6,J>Y&&se(J),o.offset=J;let s=gm(K.subarray(t,J),e);return i=null,s}return o.offset=J,a&512?(K.start=t,K.end=J,K):K.subarray(t,J)}catch(e){throw c=e,e}finally{if(r&&(g(),n&&o.saveStructures)){let n=r.sharedLength||0,i=K.subarray(t,J),s=(o._prepareStructures||vm)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?o.pack(e,a):(o.lastNamedStructuresLength=n,K.length>1073741824&&(K=null),i)}K.length>1073741824&&(K=null),a&1024&&(J=t)}};let g=()=>{ee<10&&ee++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,ee=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][dm]=0;m=[]}},te=e=>{var t=e.length;t<16?K[J++]=144|t:t<65536?(K[J++]=220,K[J++]=t>>8,K[J++]=t&255):(K[J++]=221,q.setUint32(J,t),J+=4);for(let n=0;n<t;n++)_(e[n])},_=e=>{J>Y&&(K=se(J));var n=typeof e,r;if(n===`string`){let n=e.length;if(X&&n>=4&&n<4096){if((X.size+=n)>lm){let e,n=(X[0]?X[0].length*3+X[1].length:0)+10;J+n>Y&&(K=se(J+n));let r;X.position?(r=X,K[J]=200,J+=3,K[J++]=98,e=J-t,J+=4,_m(t,_,0),q.setUint16(e+t-3,J-t-e)):(K[J++]=214,K[J++]=98,e=J-t,J+=4),X=[``,``],X.previous=r,X.size=0,X.position=e}let r=um.test(e);X[+!r]+=e,K[J++]=193,_(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if(J+o>Y&&(K=se(J+o)),n<64||!a){let t,a,o,s=J+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?K[s++]=a:a<2048?(K[s++]=a>>6|192,K[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,K[s++]=a>>18|240,K[s++]=a>>12&63|128,K[s++]=a>>6&63|128,K[s++]=a&63|128):(K[s++]=a>>12|224,K[s++]=a>>6&63|128,K[s++]=a&63|128);r=s-J-i}else r=a(e,J+i);r<32?K[J++]=160|r:r<256?(i<2&&K.copyWithin(J+2,J+1,J+1+r),K[J++]=217,K[J++]=r):r<65536?(i<3&&K.copyWithin(J+3,J+2,J+2+r),K[J++]=218,K[J++]=r>>8,K[J++]=r&255):(i<5&&K.copyWithin(J+5,J+3,J+3+r),K[J++]=219,q.setUint32(J,r),J+=4),J+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?K[J++]=e:e<256?(K[J++]=204,K[J++]=e):e<65536?(K[J++]=205,K[J++]=e>>8,K[J++]=e&255):(K[J++]=206,q.setUint32(J,e),J+=4);else if(e>>0===e)e>=-32?K[J++]=256+e:e>=-128?(K[J++]=208,K[J++]=e+256):e>=-32768?(K[J++]=209,q.setInt16(J,e),J+=2):(K[J++]=210,q.setInt32(J,e),J+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){K[J++]=202,q.setFloat32(J,e);let n;if(t<4||(n=e*Qp[(K[J]&127)<<1|K[J+1]>>7])>>0===n){J+=4;return}else J--}K[J++]=203,q.setFloat64(J,e),J+=8}else if(n===`object`||n===`function`)if(!e)K[J++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),K[J++]=214,K[J++]=112,q.setUint32(J,n.id),J+=4;return}else i.set(e,{offset:J-t})}let a=e.constructor;if(a===Object)ae(e);else if(a===Array)te(e);else if(a===Map)if(this.mapAsEmptyObject)K[J++]=128;else{r=e.size,r<16?K[J++]=128|r:r<65536?(K[J++]=222,K[J++]=r>>8,K[J++]=r&255):(K[J++]=223,q.setUint32(J,r),J+=4);for(let[t,n]of e)_(t),_(n)}else{for(let t=0,n=nm.length;t<n;t++){let n=rm[t];if(e instanceof n){let n=nm[t];if(n.write){n.type&&(K[J++]=212,K[J++]=n.type,K[J++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?te(e):ae(e):_(t);return}let r=K,i=q,a=J;K=null;let o;try{o=n.pack.call(this,e,e=>(K=r,r=null,J+=e,J>Y&&se(J),{target:K,targetView:q,position:J-e}),_)}finally{r&&(K=r,q=i,J=a,Y=K.length-10)}o&&(o.length+J>Y&&se(o.length+J),J=hm(o,K,J,n.type));return}}if(Array.isArray(e))te(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return _(t)}if(n===`function`)return _(this.writeFunction&&this.writeFunction(e));ae(e)}}}else if(n===`boolean`)K[J++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)K[J++]=211,q.setBigInt64(J,e);else if(e<0x10000000000000000&&e>0)K[J++]=207,q.setBigUint64(J,e);else if(this.largeBigIntToFloat)K[J++]=203,q.setFloat64(J,Number(e));else if(this.largeBigIntToString)return _(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),im)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+J>Y&&se(n.length+J),J=hm(n,K,J,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);J+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?K[J++]=192:(K[J++]=212,K[J++]=0,K[J++]=0);else throw Error(`Unknown type: `+n)},ne=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?K[J++]=128|n:n<65536?(K[J++]=222,K[J++]=n>>8,K[J++]=n&255):(K[J++]=223,q.setUint32(J,n),J+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);_(isNaN(n)?r:n),_(e[r])}else for(let i=0;i<n;i++)_(r=t[i]),_(e[r])}:e=>{K[J++]=222;let n=J-t;J+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(_(t),_(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);K[n+++t]=r>>8,K[n+t]=r&255},re=this.useRecords===!1?ne:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=J++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==J?(J--,ce(i,c,u)):le(i,c,a,u),o=!0,i=l[s]}_(e[s])}if(!o){let n=i[dm];n?K[a+t]=n:le(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[dm];a?a>=96&&d?(K[J++]=((a-=96)&31)+96,K[J++]=a>>5):K[J++]=a:ce(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&_(e[t])},ie=typeof this.useRecords==`function`&&this.useRecords,ae=ie?e=>{ie(e)?re(e):ne(e)}:re,oe=e=>{let i=o._writeStruct(e,K,t,J,r,se,(e,t,r)=>{if(r)return n=!0;J=t;let i=K;return _(e),g(),i===K?J:{position:J,targetView:q,target:K}});if(i===0)return ae(e);J=i},se=e=>{let n;if(e>16777216){if(e-t>sm)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(sm,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,K.length-1)>>12)+1<<12;let r=new am(n);return q=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,K.length),K.copy?K.copy(r,0,t,e):r.set(K.slice(t,e)),J-=t,t=0,Y=r.length-10,K=r},ce=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[dm]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(K[J++]=(a&31)+96,K[J++]=o):K[J++]=a):(o>=0?(K[J++]=213,K[J++]=114,K[J++]=(a&31)+96,K[J++]=o):(K[J++]=212,K[J++]=114,K[J++]=a),i&&(h+=ee*i),m.length>=u&&(m.shift()[dm]=0),m.push(e),_(t))},le=(e,n,r,i)=>{let a=K,o=J,s=Y,c=t;K=cm,J=0,t=0,K||(cm=K=new am(8192)),Y=K.length-10,ce(e,n,i),cm=K;let l=J;if(K=a,J=o,Y=s,t=c,l>1){let e=J+l-1;e>Y&&se(e);let n=r+t;K.copyWithin(n+l,n+1,J),K.set(cm.slice(0,l),n),J=e}else K[r+t]=cm[0]}}useBuffer(e){K=e,K.dataView||=new DataView(K.buffer,K.byteOffset,K.byteLength),q=K.dataView,J=0}set position(e){J=e}get position(){return J}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};rm=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,yp],nm=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?pm(e,16,t):mm(im?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==om&&this.moreTypes?pm(e,qp.indexOf(n.name),t):mm(e,t)}},{pack(e,t){this.moreTypes?pm(e,17,t):mm(im?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function pm(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function mm(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function hm(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function gm(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function _m(e,t,n){if(X.length>0){q.setUint32(X.position+e,J+n-X.position-e),X.stringsPosition=J-e;let r=X;X=null,t(r[0]),t(r[1])}}function vm(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}fm.SUPPORTS_STRUCT_HOOKS=!0;var ym=new fm({useRecords:!1});ym.pack,ym.pack;var{NEVER:bm,ALWAYS:xm,DECIMAL_ROUND:Sm,DECIMAL_FIT:Cm}=em,wm=class extends P()(`effect/rpc/RpcSerialization`){},Tm=(e=>wm.of({contentType:`application/msgpack`,includesFraming:!0,makeUnsafe:()=>{let t=new Cp(e),n=new fm(e),r=new TextEncoder,i;return{decode(e){let n=typeof e==`string`?r.encode(e):e;if(i!==void 0){let t=n;e=new Uint8Array(i.length+n.length),e.set(i),e.set(t,i.length),n=e,i=void 0}try{return t.unpackMultiple(n)}catch(e){let t=e;if(t.incomplete)return i=n.subarray(t.lastPosition),t.values??[];throw e}},encode:e=>n.pack(e)}}}))({useRecords:!0}),Em=Ir(wm)(Tm),Dm=e=>x(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>un(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),T});return A(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return Ti(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*Hn(x(()=>i(e)),t)}return yield*vr(ai,()=>(t.delete(e),r.delete(e),T))})}}))}),Om=BigInt(0),km=O(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,a=t?.disableTracing??!1,o=t?.generateRequestId??(()=>Om++),c=yield*g(),l=xr(c,Ar),u=new Map,d=!1;yield*lt(l,i(e=>(d=!0,f(qe(e.id)))));let f=O(function*(e){for(let[t,n]of u)u.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?to(n.queue):$a(n.queue,e.cause):n.resume(e)}),p=e=>{let r=Kf(e.successSchema),i=ee(e);return(o,s)=>{let c=s?.headers?Pu(s.headers):Nu,l=s?.context??hi();if(!r){let r=t=>m(e,i,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return a?r(void 0):wn(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=h(e,i,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:js(A(u,Os))}},m=(e,n,r,a,s,c,l)=>i(i=>{if(d)return gi;let f=o(),p=n(e=>t.onFromClient({message:e,context:c,discard:l}),{_tag:`Request`,id:f,tag:e._tag,payload:a,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:Ru(i.getRef(Pm),s)});if(l)return p;let m;return pr(Ve(t=>{let n={_tag:`Effect`,rpc:e,context:c,resume(e){t(e),m&&!m.pollUnsafe()&&i.currentDispatcher.scheduleTask(()=>{m.interruptUnsafe(i.id)},0)}};u.set(f,n),m=p.pipe(r?or(r,{captureStackTrace:!1}):k,pe(i.context)),m.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(u.delete(f),jr(pa(m),te(f,Array.from(e),c))))}),h=O(function*(e,r,i,c,l,f){if(d)return yield*gi;let p=a?void 0:yield*Si(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=ha(),h=o(),ee=Zr(m.context,Ar);yield*mt(ee,e=>u.has(h)?(u.delete(h),te(h,bn(e)?Array.from(Qn(e.cause)):[],f)):T);let g=yield*Ja(l);return u.set(h,{_tag:`Queue`,rpc:e,queue:g,scope:ee,context:f}),yield*r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:i,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:Ru(m.getRef(Pm),c)}).pipe(p?or(p,{captureStackTrace:!1}):k,it(e=>$a(g,e)),Cr,s(ee,{startImmediately:!0})),g}),ee=e=>{let t=[];for(let n of e.middlewares.values()){let e=c.mapUnsafe.get(`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},te=(e,n,r)=>Ve(i=>{let a=ha();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(sn(1e3),pe(a.context)).addObserver(()=>{i(T)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=u.get(n);return!i||i._tag!==`Queue`?T:Za(i.queue,e.values).pipe(r?y(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):k,it(e=>$a(i.queue,e)))}case`Exit`:{let t=e.requestId,n=u.get(t);return n?(u.delete(t),n._tag===`Effect`?(n.resume(e.exit),T):e.exit._tag===`Success`?to(n.queue):$a(n.queue,e.exit.cause)):T}case`Defect`:return f(De(e.defect));case`ClientEnd`:return T}},ne;if(t.flatten){let t=new Map;ne=function(n,r,i){let a=t.get(n);return a||(a=p(e.requests.get(n)),t.set(n,a)),a(r,i)}}else ne={},e.requests.forEach(e=>{ne[e._tag]=p(e)});return{client:ne,write:_}}),Am=0,jm=O(function*(e,t){let n=Am++,{run:r,send:i,supportsAck:a,supportsTransferables:o}=yield*Fm,s=new Map,{client:c,write:l}=yield*km(e,{...t,supportsAck:a,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),a=o?Vf():void 0,c=ha(),l={rpc:r,context:a?Gr(c.context,Bf,a):c.context,schemas:Nm(r)};return s.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(Hn(l.context),Nn,y(e=>i(n,{...t,id:String(t.id),payload:e,headers:Object.entries(t.headers)},a&&a.readUnsafe())))}case`Ack`:return s.get(t.requestId)?i(n,{_tag:`Ack`,requestId:String(t.requestId)}):T;case`Interrupt`:return s.get(t.requestId)?(s.delete(t.requestId),i(n,{_tag:`Interrupt`,requestId:String(t.requestId)})):T;case`Eof`:return T}}});return yield*r(n,e=>{switch(e._tag){case`Chunk`:{let t=op(e.requestId),n=s.get(t);return!n||_i(n.schemas.decodeChunk)?T:n.schemas.decodeChunk.value(e.values).pipe(Hn(n.context),Nn,y(t=>l({_tag:`Chunk`,clientId:0,requestId:op(e.requestId),values:t})),Ur(t=>l({_tag:`Exit`,clientId:0,requestId:op(e.requestId),exit:pi(t)})))}case`Exit`:{let t=op(e.requestId),n=s.get(t);return n?(s.delete(t),n.schemas.decodeExit(e.exit).pipe(Hn(n.context),Nn,lr({onSuccess:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:pi(e)})}))):T}case`Defect`:return l({_tag:`Defect`,clientId:0,defect:Vm(e.defect)});case`ClientProtocolError`:{let t=$e(e.error);return xn(s.keys(),e=>l({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return T}}).pipe(it($r),Cr,ir),c}),Mm=new WeakMap,Nm=e=>{let t=Mm.get(e);return t===void 0?(t={decodeChunk:zn(qf(e.successSchema),e=>ni(hr(dn(e.success)))),encodePayload:Xn(hr(e.payloadSchema)),decodeExit:ni(hr(ep(e)))},Mm.set(e,t),t):t},Pm=rr(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Nu}),Fm=class extends P()(`effect/rpc/RpcClient/Protocol`){static make=Dm},Im=e=>Fm.make(O(function*(t,n){let r=yield*yf,i=yield*wm,a=yield*St(Bm),o=new Map,s=yield*r.writer,c=i.makeUnsafe(),l=yield*Rm(s(c.encode(sp))),u,d=x(()=>(u=void 0,wr(a)?a.value.onConnect:T)),f=e=>xn(n,n=>t(n,e));return yield*x(()=>(c=i.makeUnsafe(),l.reset(),r.runRaw(e=>{try{let n=c.decode(e);if(n.length===0)return;let r=0;return kt({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return l.onPong(),T;if(`requestId`in e){let n=o.get(e.requestId);if(n!==void 0)return e._tag===`Exit`&&o.delete(e.requestId),t(n,e)}return f(e)},step:fi})}catch(e){return f({_tag:`ClientProtocolError`,error:new ap({reason:new ip({message:`Error decoding message`,cause:e})})})}},{onOpen:d}).pipe(Vt(y(l.timeout,()=>_n(new Mf({reason:new kf({kind:`Timeout`,cause:Error(`ping timeout`)})}))))))).pipe(y(()=>_n(new Mf({reason:new Af({code:1e3})}))),wr(a)?nn(a.value.onDisconnect):k,h(t=>{let n=xi(t),r=Ue(n);return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?T:(u=new ap({reason:r?n.success.reason:new ip({message:`Unknown socket error`,cause:Hr(t)})}),f({_tag:`ClientProtocolError`,error:u}))}),_(e?.retryPolicy??Lm),ut({module:`RpcClient`,method:`makeProtocolSocket`}),ir),{send(e,t){if(u)return _n(u);t._tag===`Request`&&o.set(t.id,e);let n=c.encode(t);return n===void 0?T:Nn(s(n))},supportsAck:!0,supportsTransferables:!1}})),Lm=vi(500,1.5).pipe(Yr(Tr(5e3))),Rm=O(function*(e){let t=!0,n=_a();return yield*x(()=>t?(t=!1,e):n.open).pipe(Pe(`5 seconds`),qr,jn,Cr,ir),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),zm=e=>Wn(Fm)(Im(e)),Bm=class extends P()(`effect/rpc/RpcClient/ConnectionHooks`){},Vm=Er(Nt),Hm=()=>(e,t)=>{let n=P()(e),r=Wn(n,t.makeEffect??jm(t.group,{...t,flatten:!0}));n.runtime=(t.runtime??Ul)(typeof t.protocol==`function`?e=>le(r,he(t.protocol(e))):le(r,he(t.protocol))),n.mutation=tu(e=>{let r=t.group.requests.get(e);return n.runtime.fn()(O(function*({headers:t,payload:r,reactivityKeys:i}){let a=(yield*n)(e,r,{headers:t});return yield*i?Ac(a,i):a})).pipe(du({key:`AtomRpc:mutation:${e}`,schema:tl({success:r.successSchema,error:Um(r)})}))});let i=tu(e=>{let{headers:r,payload:i,reactivityKeys:a,tag:o,timeToLive:s}=e,c=t.group.requests.get(o),l=Kf(c.successSchema),u=l?n.runtime.pull(js(n.use(e=>v(e(o,i,{headers:r}))))):n.runtime.atom(n.use(e=>e(o,i,{headers:r})));return!l&&e.serializationKey&&(u=du(u,{key:`AtomRpc:${e.tag}:${e.serializationKey}`,schema:tl({success:c.successSchema,error:Um(c)})})),s&&(u=vn(s)?Tl(u,s):nu(u)),a?n.runtime.factory.withReactivity(a)(u):u});return n.query=(e,t,n)=>i({tag:e,payload:t,headers:n?.headers?Pu(n.headers):void 0,reactivityKeys:n?.reactivityKeys,timeToLive:n?.timeToLive?Cn(n.timeToLive):void 0,serializationKey:n?.serializationKey}),n},Um=e=>sr([e.errorSchema,...Array.from(e.middlewares,e=>e.error),ap]),Wm={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return Gm({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return Gm({requests:t,annotations:Kn(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return Gm({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return Gm({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return Ti(function*(){let n=yield*g(),r=Rn(e)?yield*e:e,i=new Map;for(let[e,a]of Object.entries(r)){let r=t.requests.get(e);i.set(r.key,{tag:r._tag,handler:a,context:n})}return Kn(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return Gm({requests:t,annotations:this.annotations})},toLayer(e){return Xi(this.toHandlers(e))},of:k,toLayerHandler(e,t){let n=this;return Xi(Ti(function*(){let r=yield*g(),i=Rn(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),Kn(a)}))},accessHandler(e){return un(t=>{let n=this.requests.get(e),{handler:r,context:i}=t.mapUnsafe.get(n.key);return v((e,t)=>{t.rpc=n;let a=r(e,t),o=np(a)?a.value:a;return Rn(o)?ea(o,i):Rs(o,i)})})},annotate(e,t){return Gm({requests:this.requests,annotations:Gr(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(bi(e,t))},annotateMerge(e){return Gm({requests:this.requests,annotations:Rr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(Rr(e,r.annotations)));return Gm({requests:t,annotations:this.annotations})}},Gm=e=>Object.assign(function(){},Wm,{requests:e.requests,annotations:e.annotations}),Km=(...e)=>Gm({requests:new Map(e.map(e=>[e._tag,e])),annotations:hi()}),Z=class extends En()(`GitError`,{cause:M(Nt),message:M(E)}){},qm=ke([`added`,`deleted`,`modified`,`renamed`]),Jm=class extends b(`GitDiffSegment`)({filePath:E,fingerprint:E,id:E,type:ke([`commit`,`worktree`])}){},Ym=class extends b(`GitDiff`)({filePath:E,patch:E,segments:S(Jm),status:qm}){},Xm=sr([w({ref:E,type:rn(`ref`)}),w({base:E,type:rn(`merge-base`)})]),Zm=sr([w({ref:E,type:rn(`ref`)}),w({type:rn(`worktree`)})]),Qm=class extends b(`GitCommit`)({hash:E,parents:S(E),shortHash:E,subject:E,wip:_e}){},$m=class extends b(`GitReviewMetadata`)({base:E,branch:E,commits:S(Qm),defaultBranch:E,dirty:_e,prUrl:M(E),unpushedCommits:_e}){},eh=class extends b(`GitHubReviewThread`)({body:E,filePath:E,id:E,lineNumber:Ye,resolved:_e,side:M(ke([`additions`,`deletions`])),url:M(E)}){};w({name:E,owner:w({login:E})}),w({data:M(w({repository:M(w({pullRequest:M(w({reviewThreads:M(w({nodes:S(w({comments:w({nodes:S(w({body:E,line:M(Se(Ye)),originalLine:M(Se(Ye)),path:E,url:M(E)}))}),diffSide:M(E),id:E,isResolved:_e}))}))}))}))}))});var th=class extends b(`GitRepository`)({gitDirectory:E,root:E}){},nh=class extends b(`GitBranch`)({name:E,remote:M(E),type:ke([`local`,`remote`])}){},rh=class extends b(`GitBranchesSnapshot`)({branches:S(nh),defaultBranch:E}){},ih=class extends b(`GitWorktreeStatus`)({ahead:Ye,behind:Ye,dirtyTracked:_e,unpushedCommits:_e,untracked:_e}){},ah=class extends b(`GitWorktree`)({branch:M(E),root:E,status:M(ih)}){},oh=class extends b(`GitProject`)({repository:th,worktrees:S(ah)}){},sh=class extends En()(`TerminalError`,{cause:M(Nt),message:M(E)}){},ch=w({data:E,sequence:Ye,type:rn(`data`)}),lh=w({runId:Ye,state:ke([`idle`,`starting`,`running`,`waiting`,`stopped`,`exited`,`failed`]),title:E});function uh(e){return e===`idle`||e===`starting`||e===`running`||e===`waiting`}var dh=sr([w({state:lh,type:rn(`state`)}),ch]),fh=w({args:M(S(E)),command:M(E),cwd:E,env:M(He(E,E)),sessionId:M(E)}),ph=w({baseOrigin:M(E),command:E,cwd:E,env:M(He(E,E)),name:E,origin:M(E),packageFolder:E,packagePath:E,portless:M(_e),service:M(E),sessionId:E}),mh=w({args:S(E),command:E,cwd:E,icon:ke([`opencode`,`codex`,`pi`]),label:E,uuid:E}),hh=class extends b(`ReviewMark`)({filePath:E,fingerprint:E,segmentId:E}){},gh=class extends b(`ReviewComment`)({body:E,filePath:E,lineNumber:Ye,resolved:M(_e),side:M(ke([`additions`,`deletions`]))}){},_h=class extends b(`ReviewState`)({comments:S(gh),marks:S(hh)}){},vh=class extends Km(L(`agents.create`,{error:sh,payload:w({args:S(E),command:E,cwd:E,icon:ke([`opencode`,`codex`,`pi`]),label:E}),success:mh}),L(`agents.remove`,{error:sh,payload:w({cwd:E,uuid:E})}),L(`agents.watch`,{error:sh,payload:w({cwd:E}),stream:!0,success:S(mh)}),L(`projects.watch`,{stream:!0,success:S(oh)}),L(`projects.branches`,{error:Z,payload:w({cwd:E}),success:rh}),L(`review.metadata`,{error:Z,payload:w({base:M(E),cwd:E}),success:$m}),L(`review.watchRange`,{error:Z,payload:w({cwd:E,from:Xm,to:Zm}),stream:!0,success:S(Ym)}),L(`review.state.watch`,{error:Z,payload:w({base:E,cwd:E}),stream:!0,success:_h}),L(`review.state.mark`,{error:Z,payload:w({base:E,cwd:E,marks:S(hh)})}),L(`review.state.unmark`,{error:Z,payload:w({base:E,cwd:E,marks:S(hh)})}),L(`review.comments.save`,{error:Z,payload:w({base:E,comment:gh,cwd:E})}),L(`review.comments.resolve`,{error:Z,payload:w({base:E,cwd:E,filePath:E,lineNumber:Ye,side:M(ke([`additions`,`deletions`]))})}),L(`review.createWipCommit`,{error:Z,payload:w({cwd:E,message:E})}),L(`review.commitAndPush`,{error:Z,payload:w({base:E,cwd:E,message:E})}),L(`review.githubThreads`,{error:Z,payload:w({cwd:E}),success:S(eh)}),L(`review.githubThreads.resolve`,{error:Z,payload:w({cwd:E,threadId:E})}),L(`review.stageFile`,{error:Z,payload:w({cwd:E,filePath:E})}),L(`review.unstageFile`,{error:Z,payload:w({cwd:E,filePath:E})}),L(`review.discardFile`,{error:Z,payload:w({cwd:E,filePath:E})}),L(`projects.createWorktree`,{error:Z,payload:w({baseBranch:E,branch:E,cwd:E,mode:ke([`existing-local`,`existing-remote`,`new-local`])}),success:E}),L(`projects.deleteWorktree`,{error:Z,payload:w({cwd:E,force:_e})}),L(`runs.portless`,{error:sh,payload:w({cwd:E}),success:S(ph)}),L(`terminal.write`,{error:sh,payload:w({args:M(S(E)),command:M(E),cwd:E,data:E,env:M(He(E,E)),sessionId:M(E)})}),L(`terminal.resize`,{error:sh,payload:w({args:M(S(E)),cols:Ye,command:M(E),cwd:E,env:M(He(E,E)),rows:Ye,sessionId:M(E)})}),L(`terminal.restart`,{error:sh,payload:fh,success:lh}),L(`terminal.state.watch`,{error:sh,payload:fh,stream:!0,success:lh}),L(`terminal.stop`,{error:sh,payload:fh,success:lh}),L(`terminal.watch`,{error:sh,payload:fh,stream:!0,success:dh})){},yh=`1.9.1`,bh=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function xh(e){let t=new Set([e]),n=new Set,r=e.match(bh);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(bh);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Sh=xh(yh),Ch=yh.split(`.`)[0],wh=Symbol.for(`opentelemetry.js.api.${Ch}`),Th=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function Eh(e,t,n,r=!1){let i=Th[wh]=Th[wh]??{version:yh};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${yh}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${yh}.`),!0}function Dh(e){let t=Th[wh]?.version;if(!(!t||!Sh(t)))return Th[wh]?.[e]}function Oh(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${yh}.`);let n=Th[wh];n&&delete n[e]}var kh=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ah(`debug`,this._namespace,e)}error(...e){return Ah(`error`,this._namespace,e)}info(...e){return Ah(`info`,this._namespace,e)}warn(...e){return Ah(`warn`,this._namespace,e)}verbose(...e){return Ah(`verbose`,this._namespace,e)}};function Ah(e,t,n){let r=Dh(`diag`);if(r)return r[e](t,...n)}var jh;(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(jh||={});function Mh(e,t){e<jh.NONE?e=jh.NONE:e>jh.ALL&&(e=jh.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,jh.ERROR),warn:n(`warn`,jh.WARN),info:n(`info`,jh.INFO),debug:n(`debug`,jh.DEBUG),verbose:n(`verbose`,jh.VERBOSE)}}var Nh=`diag`,Ph=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=Dh(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:jh.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=Dh(`diag`),i=Mh(n.logLevel??jh.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return Eh(`diag`,i,t,!0)},t.disable=()=>{Oh(Nh,t)},t.createComponentLogger=e=>new kh(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},Fh=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}},Ih=Symbol(`BaggageEntryMetadata`),Lh=Ph.instance();function Rh(e={}){return new Fh(new Map(Object.entries(e)))}function zh(e){return typeof e!=`string`&&(Lh.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:Ih,toString(){return e}}}function Bh(e){return Symbol.for(e)}var Vh=new class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Hh=class{constructor(){}createGauge(e,t){return eg}createHistogram(e,t){return tg}createCounter(e,t){return $h}createUpDownCounter(e,t){return ng}createObservableGauge(e,t){return ig}createObservableCounter(e,t){return rg}createObservableUpDownCounter(e,t){return ag}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},Uh=class{},Wh=class extends Uh{add(e,t){}},Gh=class extends Uh{add(e,t){}},Kh=class extends Uh{record(e,t){}},qh=class extends Uh{record(e,t){}},Jh=class{addCallback(e){}removeCallback(e){}},Yh=class extends Jh{},Xh=class extends Jh{},Zh=class extends Jh{},Qh=new Hh,$h=new Wh,eg=new Kh,tg=new qh,ng=new Gh,rg=new Yh,ig=new Xh,ag=new Zh;function og(){return Qh}var sg;(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(sg||={});var cg={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},lg={set(e,t,n){e!=null&&(e[t]=n)}},ug=class{active(){return Vh}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},dg=`context`,fg=new ug,pg=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return Eh(dg,e,Ph.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return Dh(dg)||fg}disable(){this._getContextManager().disable(),Oh(dg,Ph.instance())}},mg;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(mg||={});var hg={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:mg.NONE},gg=class{constructor(e=hg){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}},_g=Bh(`OpenTelemetry Context Key SPAN`);function vg(e){return e.getValue(_g)||void 0}function yg(){return vg(pg.getInstance().active())}function bg(e,t){return e.setValue(_g,t)}function xg(e){return e.deleteValue(_g)}function Sg(e,t){return bg(e,new gg(t))}function Cg(e){return vg(e)?.spanContext()}var wg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Tg(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(wg[e.charCodeAt(t)]|0)+(wg[e.charCodeAt(t+1)]|0)+(wg[e.charCodeAt(t+2)]|0)+(wg[e.charCodeAt(t+3)]|0);return n===t}function Eg(e){return Tg(e,32)&&e!==`00000000000000000000000000000000`}function Dg(e){return Tg(e,16)&&e!==`0000000000000000`}function Og(e){return Eg(e.traceId)&&Dg(e.spanId)}function kg(e){return new gg(e)}var Ag=pg.getInstance(),jg=class{startSpan(e,t,n=Ag.active()){if(t?.root)return new gg;let r=n&&Cg(n);return Mg(r)&&Og(r)?new gg(r):new gg}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Ag.active(),c=this.startSpan(e,i,s),l=bg(s,c);return Ag.with(l,o,void 0,c)}};function Mg(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Ng=new jg,Pg=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Ng}},Fg=new class{getTracer(e,t,n){return new jg}},Ig=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Pg(this,e,t,n)}getDelegate(){return this._delegate??Fg}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}},Lg;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Lg||={});var Rg;(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Rg||={});var zg;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(zg||={});var Bg=pg.getInstance(),Q=Ph.instance(),Vg=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},Hg=Bh(`OpenTelemetry Baggage Key`);function Ug(e){return e.getValue(Hg)||void 0}function Wg(){return Ug(pg.getInstance().active())}function Gg(e,t){return e.setValue(Hg,t)}function Kg(e){return e.deleteValue(Hg)}var qg=`propagation`,Jg=new Vg,Yg=class e{constructor(){this.createBaggage=Rh,this.getBaggage=Ug,this.getActiveBaggage=Wg,this.setBaggage=Gg,this.deleteBaggage=Kg}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return Eh(qg,e,Ph.instance())}inject(e,t,n=lg){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=cg){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){Oh(qg,Ph.instance())}_getGlobalPropagator(){return Dh(qg)||Jg}}.getInstance(),Xg=`trace`,$=class e{constructor(){this._proxyTracerProvider=new Ig,this.wrapSpanContext=kg,this.isSpanContextValid=Og,this.deleteSpan=xg,this.getSpan=vg,this.getActiveSpan=yg,this.getSpanContext=Cg,this.setSpan=bg,this.setSpanContext=Sg}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=Eh(Xg,this._proxyTracerProvider,Ph.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return Dh(Xg)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Oh(Xg,Ph.instance()),this._proxyTracerProvider=new Ig}}.getInstance(),Zg=Bh(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function Qg(e){return e.setValue(Zg,!0)}function $g(e){return e.getValue(Zg)===!0}var e_=`baggage`,t_=4096;function n_(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function r_(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function i_(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch{return}let c;return t!==-1&&t<e.length-1&&(c=zh(e.substring(t+1))),{key:o,value:s,metadata:c}}var a_=class{inject(e,t,n){let r=Yg.getBaggage(e);if(!r||$g(e))return;let i=n_(r_(r).filter(e=>e.length<=t_).slice(0,180));i.length>0&&n.set(t,e_,i)}extract(e,t,n){let r=n.get(t,e_),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=i_(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Yg.setBaggage(e,Yg.createBaggage(a))}fields(){return[e_]}};function o_(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!s_(n)){Q.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!c_(r)){Q.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function s_(e){return typeof e==`string`&&e!==``}function c_(e){return e==null?!0:Array.isArray(e)?l_(e):u_(typeof e)}function l_(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(u_(e)){t=e;continue}return!1}return!1}}return!0}function u_(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function d_(){return e=>{Q.error(f_(e))}}function f_(e){return typeof e==`string`?e:JSON.stringify(p_(e))}function p_(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var m_=d_();function h_(e){try{m_(e)}catch{}}var g_=`2.7.1`,__=`exception.message`,v_=`exception.stacktrace`,y_=`exception.type`,b_=`service.name`,x_=`service.version`,S_=`telemetry.sdk.language`,C_=`nodejs`,w_=`webjs`,T_=`telemetry.sdk.name`,E_=`telemetry.sdk.version`,D_=`process.runtime.name`,O_={[T_]:`opentelemetry`,[D_]:`browser`,[S_]:w_,[E_]:g_},k_=performance,A_=9,j_=10**6,M_=10**A_;function N_(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*j_)]}function P_(e){return B_(N_(k_.timeOrigin),N_(typeof e==`number`?e:k_.now()))}function F_(e){if(R_(e))return e;if(typeof e==`number`)return e<k_.timeOrigin?P_(e):N_(e);if(e instanceof Date)return N_(e.getTime());throw TypeError(`Invalid input type`)}function I_(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=M_),[n,r]}function L_(e){return e[0]*M_+e[1]}function R_(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function z_(e){return R_(e)||typeof e==`number`||e instanceof Date}function B_(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=M_&&(n[1]-=M_,n[0]+=1),n}var V_;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(V_||={});var H_=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let t=new Set;for(let e of this._propagators){let n=typeof e.fields==`function`?e.fields():[];for(let e of n)t.add(e)}this._fields=Array.from(t)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){Q.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){Q.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}},U_=`[_0-9a-z-*/]`,W_=RegExp(`^(?:${`[a-z]${U_}{0,255}`}|${`[a-z0-9]${U_}{0,240}@[a-z]${U_}{0,13}`})$`),G_=/^[ -~]{0,255}[!-~]$/,K_=/,|=/;function q_(e){return W_.test(e)}function J_(e){return G_.test(e)&&!K_.test(e)}var Y_=32,X_=512,Z_=`,`,Q_=`=`,$_=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!q_(e)||!J_(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>X_)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=Z_+e),e=`${n[0]}${Q_}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(Z_),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Q_);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!q_(a)||!J_(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>X_)&&(t.set(a,o),n=s,t.size>=Y_))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}},ev=`traceparent`,tv=`tracestate`,nv=`00`,rv=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function iv(e){let t=rv.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var av=class{inject(e,t,n){let r=$.getSpanContext(e);if(!r||$g(e)||!Og(r))return;let i=`${nv}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||mg.NONE).toString(16)}`;n.set(t,ev,i),r.traceState&&n.set(t,tv,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,ev);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=iv(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,tv);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new $_(typeof e==`string`?e:void 0)}return $.setSpanContext(e,a)}fields(){return[ev,tv]}},ov=`[object Object]`,sv=`[object Null]`,cv=`[object Undefined]`,lv=Function.prototype.toString,uv=lv.call(Object),dv=Object.getPrototypeOf,fv=Object.prototype,pv=fv.hasOwnProperty,mv=Symbol?Symbol.toStringTag:void 0,hv=fv.toString;function gv(e){if(!_v(e)||vv(e)!==ov)return!1;let t=dv(e);if(t===null)return!0;let n=pv.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&lv.call(n)===uv}function _v(e){return typeof e==`object`&&!!e}function vv(e){return e==null?e===void 0?cv:sv:mv&&mv in Object(e)?yv(e):bv(e)}function yv(e){let t=pv.call(e,mv),n=e[mv],r=!1;try{e[mv]=void 0,r=!0}catch{}let i=hv.call(e);return r&&(t?e[mv]=n:delete e[mv]),i}function bv(e){return hv.call(e)}var xv=20;function Sv(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=wv(t,e.shift(),0,n);return t}function Cv(e){return Ev(e)?e.slice():e}function wv(e,t,n=0,r){let i;if(!(n>xv)){if(n++,kv(e)||kv(t)||Dv(t))i=Cv(t);else if(Ev(e)){if(i=e.slice(),Ev(t))for(let e=0,n=t.length;e<n;e++)i.push(Cv(t[e]));else if(Ov(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=Cv(t[r]))}}}else if(Ov(e))if(Ov(t)){if(!Av(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(kv(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Tv(e,s,r)||Tv(t,s,r))delete i[s];else{if(Ov(a)&&Ov(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=wv(i[s],c,n,r)}}}}else i=t;return i}}function Tv(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function Ev(e){return Array.isArray(e)}function Dv(e){return typeof e==`function`}function Ov(e){return!kv(e)&&!Ev(e)&&!Dv(e)&&typeof e==`object`}function kv(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Av(e,t){return!(!gv(e)||!gv(t))}var jv=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Mv(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new jv(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Nv=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}},Pv=class{_isCalled=!1;_deferred=new Nv;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};function Fv(e,t){return new Promise(n=>{Bg.with(Qg(Bg.active()),()=>{e.export(t,n)})})}var Iv={_export:Fv},Lv;function Rv(){if(Lv===void 0)try{let e=globalThis.process.argv0;Lv=e?`unknown_service:${e}`:`unknown_service`}catch{Lv=`unknown_service`}return Lv}var zv=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Bv=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Uv(t),r._asyncAttributesPending=t.filter(([e,t])=>zv(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(zv(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Uv(this._rawAttributes),this._schemaUrl=Wv(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,zv(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Q.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(zv(n)){Q.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Gv(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Vv(e,t){return Bv.FromAttributeList(Object.entries(e),t)}function Hv(){return Vv({[b_]:Rv(),[S_]:O_[S_],[T_]:O_[T_],[E_]:O_[E_]})}function Uv(e){return e.map(([e,t])=>zv(t)?[e,t.catch(t=>{Q.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Wv(e){if(typeof e==`string`||e===void 0)return e;Q.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Gv(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;Q.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var Kv=`exception`,qv=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:zg.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=k_.now(),this._performanceOffset=t-(this._performanceStartTime+k_.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return Q.warn(`Invalid attribute key: ${e}`),this;if(!c_(t))return Q.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return Q.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&Q.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),z_(t)&&(z_(n)||(n=t),t=void 0);let i=o_(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&Q.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=o_(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===zg.UNSET||this.status.code===zg.OK)return this;let t={code:e.code};return e.code===zg.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&Q.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){Q.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=I_(this.startTime,this.endTime),this._duration[0]<0&&(Q.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&Q.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&Q.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=k_.now())return P_(e+this._performanceOffset);if(typeof e==`number`)return N_(e);if(e instanceof Date)return N_(e.getTime());if(R_(e))return e;if(this._startTimeProvided)return N_(Date.now());let t=k_.now()-this._performanceStartTime;return B_(this.startTime,N_(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[__]=e:e&&(e.code?n[y_]=e.code.toString():e.name&&(n[y_]=e.name),e.message&&(n[__]=e.message),e.stack&&(n[v_]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Kv,n,t):Q.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);Q.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(Q.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}},Jv;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Jv||={});var Yv=class{shouldSample(){return{decision:Jv.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Xv=class{shouldSample(){return{decision:Jv.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},Zv=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(h_(Error(`ParentBasedSampler must have a root sampler configured`)),new Xv),this._remoteParentSampled=e.remoteParentSampled??new Xv,this._remoteParentNotSampled=e.remoteParentNotSampled??new Yv,this._localParentSampled=e.localParentSampled??new Xv,this._localParentNotSampled=e.localParentNotSampled??new Yv}shouldSample(e,t,n,r,i,a){let o=$.getSpanContext(e);return!o||!Og(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&mg.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&mg.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}},Qv=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:Eg(t)&&this._accumulate(t)<this._upperBound?Jv.RECORD_AND_SAMPLED:Jv.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}},$v;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})($v||={});var ey=1;function ty(){return{sampler:ny(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function ny(){let e=$v.ParentBasedAlwaysOn;switch(e){case $v.AlwaysOn:return new Xv;case $v.AlwaysOff:return new Yv;case $v.ParentBasedAlwaysOn:return new Zv({root:new Xv});case $v.ParentBasedAlwaysOff:return new Zv({root:new Yv});case $v.TraceIdRatio:return new Qv(ry());case $v.ParentBasedTraceIdRatio:return new Zv({root:new Qv(ry())});default:return Q.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${$v.ParentBasedAlwaysOn}".`),new Zv({root:new Xv})}}function ry(){return Q.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${ey}.`),ey}function iy(e){let t={sampler:ny()},n=ty(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function ay(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??1/0,Object.assign({},e,{spanLimits:t})}var oy=16,sy=8,cy=new Uint8Array(oy),ly=new Uint8Array(sy),uy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function dy(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function fy(e){let t=``;for(let n=0;n<e.length;n++)t+=uy[e[n]];return t}var py=class{generateTraceId(){return dy(cy),fy(cy)}generateSpanId(){return dy(ly),fy(ly)}},my=`otel.span.parent.origin`,hy=`otel.span.sampling_result`,gy=`otel.sdk.span.live`,_y=`otel.sdk.span.started`,vy=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(_y,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(gy,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=by(t);if(this.startedSpans.add(1,{[my]:yy(e),[hy]:n}),t===Jv.NOT_RECORD)return()=>{};let r={[hy]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function yy(e){return e?e.isRemote?`remote`:`local`:`none`}function by(e){switch(e){case Jv.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Jv.RECORD:return`RECORD_ONLY`;case Jv.NOT_RECORD:return`DROP`}}var xy=`2.7.1`,Sy=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=iy(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new py,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,xy):og();this._tracerMetrics=new vy(a)}startSpan(e,t={},n=Bg.active()){t.root&&(n=$.deleteSpan(n));let r=$.getSpan(n);if($g(n))return Q.debug(`Instrumentation suppressed, returning Noop Span`),$.wrapSpanContext(hg);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!$.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??Rg.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:o_(e.attributes)})),d=o_(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===Lg.RECORD_AND_SAMPLED?mg.SAMPLED:mg.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===Lg.NOT_RECORD)return Q.debug(`Recording is off, propagating context in a non-recording span`),$.wrapSpanContext(h);let ee=o_(Object.assign(d,f.attributes));return new qv({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:ee,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Bg.active(),c=this.startSpan(e,i,s),l=$.setSpan(s,c);return Bg.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}},Cy=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{h_(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},wy;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(wy||={});var Ty=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=Sv({},ty(),ay(e));this._resource=t.resource??Hv(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new Cy(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Sy({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=wy.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==wy.timeout&&(r=wy.resolved,n(r))}).catch(e=>{clearTimeout(i),r=wy.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==wy.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}},Ey=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new Pv(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&mg.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>h_(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Iv._export(this._exporter,[e]);if(t.code!==V_.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},Dy=class{_enabled=!1;_currentContext=Vh;_bindFunction(e=Vh,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,"length",{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=Vh,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=Vh,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||Vh;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Oy(e){if(e!==null){if(e===void 0){let e=new Dy;e.enable(),Bg.setGlobalContextManager(e);return}e.enable(),Bg.setGlobalContextManager(e)}}function ky(e){if(e!==null){if(e===void 0){Yg.setGlobalPropagator(new H_({propagators:[new av,new a_]}));return}Yg.setGlobalPropagator(e)}}var Ay=class extends Ty{constructor(e={}){super(e)}register(e={}){$.setGlobalTracerProvider(this),ky(e.propagator),Oy(e.contextManager)}},jy=e=>e!==void 0&&!(Array.isArray(e)&&e.length===0),My;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(My||={});var Ny=new class{emit(e){}enabled(){return!1}};function Py(e){return Fy(e,new WeakSet)}function Fy(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Fy(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Fy(e,t))}return!1}var Iy=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=F_(r??f),this.hrTimeObserved=F_(i??f),d){let e=$.getSpanContext(d);e&&Og(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return Q.warn(`Invalid attribute key: ${e}`),this;if(!Py(t))return Q.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&Q.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return Q.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(__,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(y_,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(y_,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(__,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(v_,n.stack),t=!0)}t||Q.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&Q.warn(`Can not execute the operation on emitted log record`),this._isReadonly}},Ly=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=e.context||Bg.active();if(!this.enabled(e))return;let n=new Iy(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(n,t),n._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==My.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||Bg.active();if(t.traceBased){let e=$.getSpanContext(r);if(e&&Og(e)&&(e.traceFlags&mg.SAMPLED)!==mg.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},Ry=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}},zy=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Mv(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function By(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Vy=`otel.sdk.log.created`,Hy=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(Vy,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},Uy=`0.218.0`,Wy={disabled:!1,minimumSeverity:My.UNSPECIFIED,traceBased:!1},Gy=()=>({...Wy}),Ky=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new zy(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Ry,this._loggerConfigurator=i??Gy;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,Uy):og();this.loggerMetrics=new Hy(o)}getLoggerConfig(e){let t=By(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},qy=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Hv(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Gy,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Ky(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Pv(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return Q.warn(`A shutdown LoggerProvider cannot provide a Logger`),Ny;e||Q.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Ly({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(Q.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Q.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},Jy=_r,Yy=c,Xy=(e,t)=>Wn(Jy,Ri(gt(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(_r):[]);for(let t of e)r.add(Pn(t)?yield*t:t);return r}))),Zy=BigInt(1e9),Qy=e=>[Number(e/Zy),Number(e%Zy)],$y=e=>{let t={};for(let[n,r]of Object.entries(e))t[n]=eb(r);return t},eb=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`bigint`?e.toString():ne(e),tb=class extends P()(`@effect/opentelemetry/Resource`){},nb=e=>Ir(tb,Vv(rb(e))),rb=e=>{let t={...e.attributes??void 0,[b_]:e.serviceName,[T_]:`@effect/opentelemetry`,[S_]:globalThis.document===void 0?C_:w_};return e.serviceVersion&&(t[x_]=e.serviceVersion),t},ib=class extends P()(`@effect/opentelemetry/Logger/OtelLoggerProvider`){},ab=e=>{switch(e){case`Trace`:return My.TRACE;case`Debug`:return My.DEBUG;case`Info`:return My.INFO;case`Warn`:return My.WARN;case`Error`:return My.ERROR;case`Fatal`:return My.FATAL;default:return My.UNSPECIFIED}},ob=Ti(function*(){let e=yield*ib,t=yield*zi,n=e.getLogger(`@effect/opentelemetry`);return Yy(e=>{let r={fiberId:e.fiber.id},i=In(e.fiber.context,m);ca(i)&&(r.spanId=i.spanId,r.traceId=i.traceId);for(let[t,n]of Object.entries(e.fiber.getRef(Lt)))r[t]=eb(n);let a=e.date.getTime();for(let[t,n]of e.fiber.getRef(la))r[`logSpan.${t}`]=`${a-n}ms`;let o=Qi(e.message).map(eb),s=Qy(t.currentTimeNanosUnsafe());n.emit({body:o.length===1?o[0]:o,severityText:e.logLevel,severityNumber:ab(e.logLevel),timestamp:s,observedTimestamp:s,attributes:r})})}),sb=e=>Xy([ob],{mergeWithExisting:e.mergeWithExisting??!0}),cb=(e,t)=>Wn(ib,Ti(function*(){let n=yield*tb;return yield*Lr(C(()=>new qy({...t??void 0,processors:Qi(e),resource:n})),e=>Li(()=>e.forceFlush().then(()=>e.shutdown())).pipe(qr,Cr,Me(t?.shutdownTimeout??3e3)))})),lb;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(lb||={});var ub;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(ub||={});var db;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(db||={});var fb=`@effect/opentelemetry/Metrics`,pb=class{resource;context;temporality;startTimes;startTimeNanos;previousExportTimeNanos;previousCounterState;previousHistogramState;previousFrequencyState;previousSummaryState;constructor(e,t,n=`cumulative`){this.resource=e,this.context=t,this.temporality=n,this.startTimes=new Map,this.startTimeNanos=hb(),this.previousExportTimeNanos=this.startTimeNanos,this.previousCounterState=new Map,this.previousHistogramState=new Map,this.previousFrequencyState=new Map,this.previousSummaryState=new Map}startTimeFor(e,t){return this.startTimes.has(e)?this.startTimes.get(e):(this.startTimes.set(e,t),t)}collect(e){let t=Di(this.context),n=hb(),r=[],i=new Map,a=e=>{r.push(e),i.set(e.descriptor.name,e)},o=this.temporality===`delta`,s=o?lb.DELTA:lb.CUMULATIVE,c=o?this.previousExportTimeNanos:this.startTimeNanos;for(let e=0,r=t.length;e<r;e++){let r=t[e],l=r.attributes?et(Object.entries(r.attributes),{},(e,[t,n])=>(e[t]=String(n),e)):{},u=mb(r.id,r.attributes);switch(r.type){case`Counter`:{let e=r.state.count,t=e;if(o){let n=this.previousCounterState.get(u);if(n!==void 0)if(typeof e==`bigint`&&typeof n==`bigint`)t=e-n,t<BigInt(0)&&(t=e);else{let r=Number(e);t=r-Number(n),t<0&&(t=r)}this.previousCounterState.set(u,e)}let d=gb(r,l),f={startTime:this.startTimeFor(d.name,c),endTime:n,attributes:l,value:Number(t)};i.has(r.id)?i.get(r.id).dataPoints.push(f):a({dataPointType:db.SUM,descriptor:d,isMonotonic:r.state.incremental,aggregationTemporality:s,dataPoints:[f]});break}case`Gauge`:{let e=gb(r,l),t={startTime:this.startTimeFor(e.name,this.startTimeNanos),endTime:n,attributes:l,value:Number(r.state.value)};i.has(r.id)?i.get(r.id).dataPoints.push(t):a({dataPointType:db.GAUGE,descriptor:e,aggregationTemporality:lb.CUMULATIVE,dataPoints:[t]});break}case`Histogram`:{let e=r.state.buckets.length,t={boundaries:Zn(e-1),counts:Zn(e)},d=0,f=0;for(let[n,i]of r.state.buckets)d<e-1&&(t.boundaries[d]=n),t.counts[d]=i-f,f=i,d++;let p=r.state.count,m=r.state.sum,h=t.counts,ee=r.state.min,g=r.state.max;if(o){let e=this.previousHistogramState.get(u);e!==void 0&&(p=r.state.count-e.count,m=r.state.sum-e.sum,h=t.counts.map((t,n)=>Math.max(0,t-(e.bucketCounts[n]??0)))),this.previousHistogramState.set(u,{count:r.state.count,sum:r.state.sum,bucketCounts:t.counts.slice(),min:r.state.min,max:r.state.max})}let te=gb(r,l),_={startTime:this.startTimeFor(te.name,c),endTime:n,attributes:l,value:{buckets:{boundaries:t.boundaries,counts:h},count:p,min:ee,max:g,sum:m}};i.has(r.id)?i.get(r.id).dataPoints.push(_):a({dataPointType:db.HISTOGRAM,descriptor:te,aggregationTemporality:s,dataPoints:[_]});break}case`Frequency`:{let e=[],t=new Map;for(let[i,a]of r.state.occurrences){t.set(i,a);let s=a;if(o){let e=this.previousFrequencyState.get(u);if(e!==void 0){let t=e.get(i)??0;s=Math.max(0,a-t)}}let d=gb(r,l),f=this.startTimeFor(d.name,c);e.push({startTime:f,endTime:n,attributes:{...l,key:i},value:s})}if(o&&this.previousFrequencyState.set(u,t),i.has(r.id))i.get(r.id).dataPoints.push(...e);else{let t=gb(r,l);a({dataPointType:db.SUM,descriptor:t,aggregationTemporality:s,isMonotonic:!0,dataPoints:e})}break}case`Summary`:{let e=[{startTime:c,endTime:n,attributes:{...l,quantile:`min`},value:r.state.min}];for(let[t,i]of r.state.quantiles)e.push({startTime:c,endTime:n,attributes:{...l,quantile:t.toString()},value:i??0});e.push({startTime:c,endTime:n,attributes:{...l,quantile:`max`},value:r.state.max});let t=r.state.count,d=r.state.sum;if(o){let e=this.previousSummaryState.get(u);e!==void 0&&(t=r.state.count-e.count,d=r.state.sum-e.sum),this.previousSummaryState.set(u,{count:r.state.count,sum:r.state.sum})}let f={startTime:c,endTime:n,attributes:l,value:t},p={startTime:c,endTime:n,attributes:l,value:d};if(i.has(`${r.id}_quantiles`))i.get(`${r.id}_quantiles`).dataPoints.push(...e),i.get(`${r.id}_count`).dataPoints.push(f),i.get(`${r.id}_sum`).dataPoints.push(p);else{let t=gb(r,l);a({dataPointType:db.SUM,descriptor:{...t,name:`${t.name}_quantiles`},aggregationTemporality:s,isMonotonic:!1,dataPoints:e}),a({dataPointType:db.SUM,descriptor:{name:`${r.id}_count`,description:r.description??``,unit:`1`,type:ub.COUNTER,valueType:sg.INT,advice:{}},aggregationTemporality:s,isMonotonic:!0,dataPoints:[f]}),a({dataPointType:db.SUM,descriptor:{name:`${r.id}_sum`,description:r.description??``,unit:`1`,type:ub.COUNTER,valueType:sg.DOUBLE,advice:{}},aggregationTemporality:s,isMonotonic:!0,dataPoints:[p]})}break}}}return o&&(this.previousExportTimeNanos=n),Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:fb},metrics:r}]},errors:[]})}},mb=(e,t)=>{if(t===void 0||Object.keys(t).length===0)return e;let n=Object.entries(t).sort((e,t)=>e[0].localeCompare(t[0]));return`${e}:${JSON.stringify(n)}`},hb=()=>{let e=Date.now();return[Math.floor(e/1e3),e%1e3*1e6]},gb=(e,t)=>{let n=t.unit??t.time_unit??`1`;return{name:e.id,description:e.description??``,unit:n,type:_b(e),valueType:vb(e),advice:{}}},_b=e=>{switch(e.type){case`Histogram`:return ub.HISTOGRAM;case`Gauge`:return ub.OBSERVABLE_GAUGE;case`Frequency`:return ub.COUNTER;case`Counter`:return e.state.incremental?ub.COUNTER:ub.UP_DOWN_COUNTER;case`Summary`:return ub.COUNTER}},vb=e=>e.type===`Counter`?typeof e.state.count==`bigint`?sg.INT:sg.DOUBLE:e.type===`Gauge`&&typeof e.state.value==`bigint`?sg.INT:sg.DOUBLE,yb=e=>Ti(function*(){return new pb(yield*tb,yield*g(),e)}),bb=(e,t,n)=>Lr(C(()=>{let n=t(),r=Array.isArray(n)?n:[n];return r.forEach(t=>t.setMetricProducer(e)),r}),e=>Li(()=>Promise.all(e.map(e=>e.shutdown()))).pipe(qr,Cr,Me(n?.shutdownTimeout??3e3))),xb=(e,t)=>Ut(y(yb(t?.temporality),n=>bb(n,e,t))),Sb=class extends P()(`@effect/opentelemetry/Tracer`){},Cb=class extends P()(`@effect/opentelemetry/Tracer/OtelTracerProvider`){},wb=class extends P()(`@effect/opentelemetry/Tracer/OtelTraceFlags`){},Tb=class extends P()(`@effect/opentelemetry/Tracer/OtelTraceState`){},Eb=A(ft(Sb),e=>Qt({span(t){return new jb(Bg,$,e,t)},context(e,t){let n=t.currentSpan;return n===void 0?e[`~effect/Effect/evaluate`](t):Bg.with(Rb(Bg.active(),n),()=>e[`~effect/Effect/evaluate`](t))}})),Db=Wn(Sb,Ti(function*(){let e=yield*tb;return(yield*Cb).getTracer(e.attributes[b_],e.attributes[x_])})),Ob=Wn(on,Eb).pipe(yt(Db)),kb=`~@effect/opentelemetry/Tracer/OtelSpan`,Ab={internal:Rg.INTERNAL,client:Rg.CLIENT,server:Rg.SERVER,producer:Rg.PRODUCER,consumer:Rg.CONSUMER},jb=class{[kb];_tag=`Span`;name;kind;annotations;links;span;spanId;traceId;attributes=new Map;sampled;parent;status;constructor(e,t,n,r){this[kb]=kb,this.name=r.name,this.annotations=r.annotations,this.links=r.links,this.kind=r.kind;let i=e.active();this.parent=r.root===!0?r.parent:Jn(r.parent,()=>Nb(t,i,r.annotations)),this.span=n.startSpan(r.name,{startTime:Qy(r.startTime),links:r.links.length>0?r.links.map(e=>({context:Pb(e.span),attributes:$y(e.attributes)})):void 0,kind:Ab[this.kind]},wr(this.parent)?Rb(i,this.parent.value,r.annotations):$.deleteSpan(i));let a=this.span.spanContext();this.spanId=a.spanId,this.traceId=a.traceId,this.status={_tag:`Started`,startTime:r.startTime},this.sampled=Mb(a.traceFlags)}attribute(e,t){this.span.setAttribute(e,eb(t)),this.attributes.set(e,t)}addLinks(e){this.links.push(...e),this.span.addLinks(e.map(e=>({context:Pb(e.span),attributes:$y(e.attributes)})))}end(e,t){let n=Qy(e);if(this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime},t._tag===`Success`)this.span.setStatus({code:zg.OK});else if(zr(t.cause))this.span.setStatus({code:zg.OK,message:cr(t.cause)}),this.span.setAttribute(`span.label`,`⚠︎ Interrupted`),this.span.setAttribute(`status.interrupted`,!0);else{let e=ii(t.cause);if(e.length>0){for(let t of e)this.span.recordException(t,n);this.span.setStatus({code:zg.ERROR,message:e[0].message})}else this.span.setStatus({code:zg.OK})}this.span.end(n)}event(e,t,n){this.span.addEvent(e,n?$y(n):void 0,Qy(t))}},Mb=e=>(e&mg.SAMPLED)===mg.SAMPLED,Nb=(e,t,n)=>{let r=e.getSpan(t)?.spanContext();return r?j(je({spanId:r.spanId,traceId:r.traceId,sampled:(r.traceFlags&1)==1,annotations:n})):N()},Pb=(e,t)=>{let n=Fb(e,t),r=Ib(e,t);return{spanId:e.spanId,traceId:e.traceId,isRemote:e._tag===`ExternalSpan`,traceFlags:n,traceState:r}},Fb=(e,t)=>{let n;return ca(t)&&(n=Lb(e,t,wb),en(n)&&(n=In(e.annotations,wb))),n??mg.SAMPLED},Ib=(e,t)=>{let n;return ca(t)&&(n=Lb(e,t,Tb),en(n)&&(n=In(e.annotations,Tb))),n},Lb=(e,t,n)=>{let r=In(t,n);return ca(r)?r:In(e.annotations,n)},Rb=(e,t,n)=>t instanceof jb?$.setSpan(e,t.span):$.setSpanContext(e,Pb(t,n)),zb=(e,t)=>Wn(Cb,Ti(function*(){let n=yield*tb;return yield*Lr(C(()=>new Ay({...t??void 0,resource:n,spanProcessors:Array.isArray(e)?e:[e]})),e=>qr(Li(()=>e.forceFlush().then(()=>e.shutdown()))))})),Bb=e=>d(Ti(function*(){let t=yield*Rn(e)?e:C(e),n=nb(t.resource),r=jy(t.spanProcessor)?le(Ob,zb(t.spanProcessor,t.tracerConfig)):re,i=jy(t.logRecordProcessor)?le(sb({mergeWithExisting:t.loggerMergeWithExisting}),cb(t.logRecordProcessor,t.loggerProviderConfig)):re;return Jt(r,jy(t.metricReader)?xb(Ke(t.metricReader),{temporality:t.metricTemporality}):re,i).pipe(yt(n))})),Vb=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};function Hb(e,t){let n={attributes:Wb(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function Ub(e){return{name:e.name,version:e.version}}function Wb(e,t){return Object.keys(e).map(n=>Gb(n,e[n],t))}function Gb(e,t,n){return{key:e,value:Kb(t,n)}}function Kb(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=Kb(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:Kb(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var qb=256,Jb=512;function Yb(e,t){let n=e&255|qb;return t&&(n|=Jb),n}function Xb(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:Wb(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Qb(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>Zb(e,t)),droppedLinksCount:e.droppedLinksCount,flags:Yb(n.traceFlags,e.parentSpanContext?.isRemote)}}function Zb(e,t){return{attributes:e.attributes?Wb(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:Yb(e.context.traceFlags,e.context.isRemote)}}function Qb(e,t){return{attributes:e.attributes?Wb(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function $b(e,t){return{resourceSpans:tx(e,t)}}function ex(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function tx(e,t){let n=ex(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Xb(e,t));o.push({scope:Ub(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=Hb(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}function nx(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function rx(e){return nx(e).toString()}var ix=typeof BigInt<`u`?rx:L_;function ax(e){return e}var ox={encodeHrTime:ix,encodeSpanContext:ax,encodeOptionalSpanContext:ax,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}},sx={serializeRequest:e=>{let t=$b(e,ox);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return Q.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}},cx=5,lx=1e3,ux=5e3,dx=1.5,fx=.2;function px(){return 2*fx*Math.random()-fx}var mx=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=cx,r=lx,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+px()),ux),0);r*=dx;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return Q.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;Q.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?Q.verbose(`Export succeeded after ${cx-n} retry attempts.`):a.status===`retryable`?Q.info(`Export failed after maximum retry attempts (${cx}).`):Q.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function hx(e){return new mx(e.transport)}var gx=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function _x(e){return new gx(e.concurrencyLimit)}var vx=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function yx(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function bx(){return{handleResponse(e){e==null||!yx(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||Q.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var xx=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=Q.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:V_.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:V_.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:V_.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:V_.FAILED,error:e.error});return}else e.status===`retryable`?t({code:V_.FAILED,error:e.error??new vx(`Export failed with retryable status`)}):t({code:V_.FAILED,error:new vx(`Export failed with unknown error`)})},e=>t({code:V_.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function Sx(e,t){return new xx(e.transport,e.serializer,bx(),e.promiseHandler,t.timeout)}function Cx(e,t,n){return Sx({transport:n,serializer:t,promiseHandler:_x(e)},{timeout:e.timeoutMillis})}function wx(e){return e===429||e===502||e===503||e===504}function Tx(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var Ex=60*1024,Dx=9,Ox=0,kx=0,Ax=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=Ox+a>Ex,s=!o&&!(kx>=Dx);if(s)Ox+=a,kx++;else{let e=o?`size limit`:`count limit`;Q.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${kx} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(Q.debug(`export response success (status: ${r.status})`),{status:`success`}):wx(r.status)?(Q.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:Tx(r.headers.get(`Retry-After`))}):(Q.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return Mx(e)?(Q.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(Q.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(Ox-=a,kx--)}}shutdown(){}};function jx(e){return new Ax(e)}function Mx(e){return e instanceof TypeError&&!e.cause}function Nx(e,t){return Cx(e,t,hx({transport:jx(e)}))}function Px(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Fx(e){if(e!=null)return async()=>e}function Ix(e,t,n){return{timeoutMillis:Px(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Lx(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}function Rx(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?Q.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function zx(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,Rx(await e())),Object.assign(i,r)}}function Bx(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Vx(e,t,n){return{...Ix(e,t,n),headers:zx(e.headers,t.headers,n.headers),url:Bx(e.url)??t.url??n.url}}function Hx(e,t){return{...Lx(),headers:async()=>e,url:`http://localhost:4318/`+t}}function Ux(e){return typeof e.headers==`function`?e.headers:Fx(e.headers)}function Wx(e,t,n){return Vx({url:e.url,timeoutMillis:e.timeoutMillis,headers:Ux(e),concurrencyLimit:e.concurrencyLimit},{},Hx(n,t))}function Gx(e,t,n,r){return Nx(Wx(e,n,r),t)}var Kx=class extends Vb{constructor(e={}){super(Gx(e,sx,`v1/traces`,{"Content-Type":`application/json`}))}};function qx(e){return d(A(mc(bc(`VITE_OTEL_URL`)),ei({onNone:()=>re,onSome:t=>Bb(()=>({resource:{serviceName:e},spanProcessor:new Ey(new Kx({url:t}))}))})))}var Jx=At(re,yt(qx(`workbench-client`)),yt(of),yt(Em),yt(Zs(Qs({VITE_OTEL_URL:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_OTEL_URL,VITE_PORTLESS_BASE_ORIGIN:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_PORTLESS_BASE_ORIGIN,VITE_PORTLESS_ORIGIN:{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,TSS_INLINE_CSS_ENABLED:`false`}.VITE_PORTLESS_ORIGIN})))),Yx=class extends Hm()(`ApiClient`,{group:vh,protocol:At(zm({retryTransientErrors:!0}),yt(zf(At(f({base:mc(bc(`VITE_PORTLESS_BASE_ORIGIN`)),origin:mc(bc(`VITE_PORTLESS_ORIGIN`))}),A(e=>At(e.base,zn(e=>{let t=new URL(e);return t.hostname=`server.${t.hostname}`,t.origin}),Jn(()=>zn(e.origin,e=>{let t=new URL(e);return t.hostname=[`server`,...t.hostname.split(`.`).slice(1)].join(`.`),t.origin})),ei({onNone:()=>`${location.origin}/api/rpc`,onSome:e=>`${e}/api/rpc`}))),Nn))),yt(If),yt(Jx))}){};function Xx(e){return Math.abs(ye(e)).toString(36)}function Zx(e){return{runId:0,state:e.command===void 0&&e.sessionId===void 0?`starting`:`idle`,title:``}}function Qx(e){return{data:``,frame:0,state:Zx(e)}}function $x(e,t){let n=At(t,et({data:``,frame:e.frame,state:e.state},(e,t)=>{let n=e;return t.type===`state`?(n.state=t.state,n):(n.data+=t.data,n)}));return{data:n.data,frame:n.data===``?n.frame:n.frame+1,state:n.state}}var eS=tu(e=>Yx.runtime.atom(At(Yx,A(t=>t(`terminal.watch`,e,{streamBufferSize:256})),js,Fs(100,On(16)),Ps(Qx(e),$x)),{initialValue:Qx(e)})),tS=tu(e=>Yx.runtime.atom(At(Yx,A(t=>t(`terminal.state.watch`,e)),js),{initialValue:Zx(e)})),nS=tu(e=>nu(Yx.runtime.atom(y(Yx,t=>tr(e)?t(`runs.portless`,{cwd:e}):v([])),{initialValue:[]}))),rS=tu(e=>Fl(t=>At(t.result(nS(e)),A(e=>At(e,Ki(e=>e.origin===void 0?Xe:Sn(e.origin)),gr,aa(e=>e,Ni)))))),iS=nu(Yx.runtime.atom(At(Yx,A(e=>e(`projects.watch`,void 0)),js))),aS=tu(e=>nu(Fl(t=>At(t.result(iS),A(t=>{let n=zt(t,t=>Pt(t.worktrees,t=>Xx(t.root)===e)),r=At(n,Dn(t=>zt(t.worktrees,t=>Xx(t.root)===e)));return{activeProject:Jr(n),activeWorktree:Jr(r),projects:t}}))))),oS=tu(e=>Yx.runtime.atom(At(Yx,A(t=>t(`agents.watch`,{cwd:e})),js)));export{cu as C,su as S,js as T,yu as _,iS as a,Fl as b,Xx as c,_h as d,uh as f,Ou as g,Cu as h,nS as i,Yx as l,wu as m,oS as n,tS as o,rh as p,rS as r,eS as s,aS as t,gh as u,tu as v,Wc as w,ou as x,nu as y};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-BTXMxFEq.js","assets/state-DrPxOHMO.js","assets/chunk-QTnfLwEv.js","assets/button-DJfQFnBl.js","assets/compiler-runtime-rGeCHUuX.js","assets/terminal-CPpKsotd.js","assets/fallbacks-2XEEl4BI.js"])))=>i.map(i=>d[i]);
2
- import{ns as e,rs as t}from"./button-DJfQFnBl.js";import{t as n}from"./preload-helper-CjdClQve.js";var r=t(`/(home)/$worktree/terminal`)({component:e(()=>n(()=>import(`./terminal-BTXMxFEq.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{r as t};