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