@deslop/workbench 0.0.302 → 0.0.305

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