@deslop/workbench 0.0.401 → 0.0.407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/{anthropic-DcE0yHBZ.mjs → anthropic-messages--JAnb97W.mjs} +38 -51
  2. package/dist/{azure-openai-responses-ecGypQVA.mjs → azure-openai-responses-g-awH_uA.mjs} +9 -16
  3. package/dist/client/assets/{-workbench-terminal-Af-sz4R6.js → -workbench-terminal-C3m5o50g.js} +8 -8
  4. package/dist/client/assets/agent-BXm8Dnfe.js +2 -0
  5. package/dist/client/assets/agent-DWi_bAGy.js +1 -0
  6. package/dist/client/assets/{dialog-CTIcy8Vy.js → dialog-CpMhdP-y.js} +1 -1
  7. package/dist/client/assets/{diff-MiGOu0DY.js → diff-BDdajfz3.js} +2 -2
  8. package/dist/client/assets/{diff-_Gk9o1mg.js → diff-mRZ3PeyD.js} +9 -9
  9. package/dist/client/assets/{external-link-BxixiKaa.js → external-link-Bw3Ptvfw.js} +1 -1
  10. package/dist/client/assets/{fallbacks-D21cBTdH.js → fallbacks-f8E4aL2c.js} +3 -3
  11. package/dist/client/assets/{index-DW7dKhgZ.js → index-D53pFEJY.js} +1 -1
  12. package/dist/client/assets/index-YmJ_EbaF.css +2 -0
  13. package/dist/client/assets/{input-DW9ssWUO.js → input-BVvU6Eiy.js} +1 -1
  14. package/dist/client/assets/portless-BYTEgoik.js +1 -0
  15. package/dist/client/assets/portless-Cke08ZHX.js +2 -0
  16. package/dist/client/assets/{resizable-CZjAW7-J.js → resizable-CYsJ6Kg2.js} +1 -1
  17. package/dist/client/assets/{route-DwWgYFyk.js → route-BzHtbTaZ.js} +2 -2
  18. package/dist/client/assets/route-DD4r__Zm.js +45 -0
  19. package/dist/client/assets/{run-CeqkWWtZ.js → run-C8QYJmux.js} +1 -1
  20. package/dist/client/assets/run-CW5YhyWI.js +2 -0
  21. package/dist/client/assets/{sonner-BKURESHO.js → sonner-CrB5PaMX.js} +1 -1
  22. package/dist/client/assets/state-CvX-YRlC.js +2 -0
  23. package/dist/client/assets/terminal-DJzGIrES.js +2 -0
  24. package/dist/client/assets/{terminal-CcfbU9tU.js → terminal-Dj-VWVHI.js} +1 -1
  25. package/dist/client/assets/{triangle-alert-DLHVemGQ.js → triangle-alert-llGGn6BK.js} +1 -1
  26. package/dist/client/index.html +11 -11
  27. package/dist/github-copilot-headers-BB6z1RAk.mjs +23 -0
  28. package/dist/{google-Jzn1v4-q.mjs → google-generative-ai-r4Wb8Eaq.mjs} +15 -20
  29. package/dist/{google-shared-DNNqX1gf.mjs → google-shared-DN1OvwJM.mjs} +4 -4
  30. package/dist/{google-vertex-z0Cbw7eq.mjs → google-vertex-Clcq7cAd.mjs} +15 -20
  31. package/dist/{hash-CScAQ-b_.mjs → hash-wSEYO-QF.mjs} +1 -1
  32. package/dist/headers-SFoLwUHv.mjs +15 -0
  33. package/dist/{mistral-CxEIkz4y.mjs → mistral-conversations-Bnpuiv3e.mjs} +12 -19
  34. package/dist/{openai-codex-responses-7ZUsVcbT.mjs → openai-codex-responses-4Te8RbRb.mjs} +62 -46
  35. package/dist/{openai-completions-CaGFVr3X.mjs → openai-completions-B4nInzTS.mjs} +69 -96
  36. package/dist/{openai-responses-Vjw8-3qm.mjs → openai-responses-GeDULmTh.mjs} +28 -31
  37. package/dist/{openai-responses-shared-DtEshy-7.mjs → openai-responses-shared-CG93Thoy.mjs} +37 -32
  38. package/dist/{openrouter-CZ-H_QwG.mjs → openrouter-images-CgbIytYQ.mjs} +7 -14
  39. package/dist/{sanitize-unicode-BbVojtka.mjs → sanitize-unicode-Ga8nHda1.mjs} +1 -1
  40. package/dist/server.js +27722 -24346
  41. package/dist/{transform-messages-CLmkH5Gu.mjs → transform-messages-D9fZ7fnU.mjs} +2 -2
  42. package/package.json +3 -2
  43. package/dist/client/assets/agent-BnkD1Glf.js +0 -2
  44. package/dist/client/assets/agent-DQPX2IZb.js +0 -1
  45. package/dist/client/assets/index-B2S_w1d1.css +0 -2
  46. package/dist/client/assets/portless-3KC81g42.js +0 -2
  47. package/dist/client/assets/portless-CxovsEbp.js +0 -1
  48. package/dist/client/assets/route-te6-VkZE.js +0 -45
  49. package/dist/client/assets/run-B-qmimXV.js +0 -2
  50. package/dist/client/assets/state-a4d_PikB.js +0 -2
  51. package/dist/client/assets/terminal-BHNxWKc6.js +0 -2
  52. package/dist/github-copilot-headers-P0xZolzq.mjs +0 -39
  53. package/dist/headers-oksLmLNC.mjs +0 -9
@@ -0,0 +1,2 @@
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,$t as c,Aa as l,Ai as u,An as d,Ao as f,Ar as p,As as m,At as h,B as g,Bi as ee,Bn as te,Ca as _,Ci as ne,Cn as v,Co as re,Cr as ie,Cs as ae,Ct as oe,Da as se,Di as ce,Dn as le,Do as ue,Dr as de,Ds as fe,Dt as pe,Ea as me,Ei as he,En as ge,Er as _e,Es as ve,Et as ye,Fa as be,Fi as xe,Fn as Se,Fo as Ce,Fr as we,Fs as Te,Ft as Ee,G as y,Ga as De,Gi as Oe,Gn as ke,Go as Ae,H as je,Hi as Me,Hn as Ne,Ho as Pe,Ia as Fe,Ii as Ie,In as b,Io as Le,It as Re,J as ze,Ja as Be,Ji as Ve,Jn as He,Jo as Ue,Jr as We,Jt as Ge,K as Ke,Ki as qe,Kn as Je,Ko as Ye,La as Xe,Li as Ze,Ln as Qe,Lo as $e,Lt as et,Ma as tt,Mn as nt,Mo as rt,Mr as it,Ms as at,Mt as ot,Na as st,Ni as ct,Nn as lt,No as ut,Nr as dt,Oa as ft,Oi as pt,On as mt,Oo as ht,Or as gt,Os as x,Ot as _t,Pa as vt,Pi as yt,Pn as bt,Po as xt,Pr as St,Pt as Ct,Q as wt,Qa as Tt,Qi as Et,Qn as Dt,Qo as Ot,Qr as kt,Qt as At,Ra as jt,Ri as Mt,Rn as Nt,Ro as Pt,Rt as Ft,Sa as It,Si as Lt,So as Rt,Sr as zt,Ss as Bt,St as Vt,Ta as Ht,Ti as Ut,Tn as Wt,To as Gt,Tr as Kt,Tt as qt,U as Jt,Ua as Yt,Ui as Xt,Un as Zt,Uo as Qt,Ur as $t,Ut as en,V as tn,Va as nn,Vi as rn,Vn as an,Vo as on,W as sn,Wi as cn,Wn as ln,Wo as un,X as S,Xa as dn,Xi as fn,Xn as pn,Xo as mn,Xr as hn,Xt as gn,Y as C,Ya as _n,Yi as vn,Yn as yn,Yo as bn,Yr as xn,Yt as Sn,Z 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,_s as Pn,_t as Fn,aa as In,ai as Ln,an as Rn,ao as zn,ar as Bn,as as Vn,at as Hn,ba as Un,bi as Wn,bn as Gn,bo as Kn,br as qn,bs as Jn,bt as Yn,ca as Xn,ci as Zn,cn as Qn,co as $n,cr as er,cs as tr,ct as nr,da as rr,di as ir,dn as ar,dr as or,ds as sr,dt as w,ea as cr,ei as lr,eo as ur,er as dr,es as fr,et as T,fa as pr,fi as mr,fn as hr,fo as gr,fr as E,fs as _r,ft as vr,ga as yr,gi as br,gn as xr,go as Sr,gr as Cr,gt as wr,ha as Tr,hi as Er,hn as Dr,hr as Or,hs as kr,ht as Ar,ia as jr,ii as Mr,in as Nr,io as Pr,ir as Fr,is as Ir,it as D,ja as Lr,ji as Rr,jn as zr,jo as Br,jr as Vr,js as O,jt as Hr,ka as k,kn as Ur,ko as Wr,kr as Gr,ks as Kr,kt as A,la as qr,li as Jr,ln as Yr,lo as Xr,lr as j,ls as Zr,lt as Qr,ma as $r,mi as ei,mn as ti,mr as ni,ms as ri,mt as ii,na as ai,ni as oi,nn as si,no as ci,nr as li,ns as ui,nt as di,oa as fi,oi as pi,on as mi,oo as hi,or as gi,os as _i,ot as vi,pa as yi,pi as bi,pn as xi,po as Si,pr as Ci,ps as wi,pt as Ti,q as Ei,qa as Di,qi as Oi,qn as ki,qo as Ai,qr as ji,ra as Mi,ri as Ni,rn as Pi,rr as Fi,rs as Ii,rt as M,sa as Li,si as Ri,sn as zi,so as Bi,sr as Vi,ss as Hi,ta as Ui,ti as Wi,to as Gi,tr as Ki,ts as qi,tt as Ji,ua as Yi,ui as Xi,un as Zi,uo as Qi,ur as $i,us as ea,ut as ta,va as na,vi as ra,vn as ia,vo as aa,vr as oa,vt as sa,wa as ca,wi as la,wn as ua,wo as da,wr as N,ws as fa,wt as pa,xa as ma,xi as ha,xn as ga,xo as _a,xr as va,ya,yi as ba,yn as P,yo as xa,yr as Sa,yt as Ca,za as wa,zi as Ta,zn as Ea,zo as Da,zr as Oa,zt as ka}from"./fallbacks-f8E4aL2c.js";var Aa=i,ja=cr,Ma=wn,Na=Et,Pa=jr,Fa=Ui,Ia=fi,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,Tt(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,...Qt,toJSON(){return{_id:`MutableRef`,current:o(this.current)}}},Za=e=>{let t=Object.create(Xa);return t.current=e,t},Qa=x(2,(e,t)=>(e.current=t,e)),$a=`~effect/PubSub/Subscription`,eo=x(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),to=e=>qn(ti(t=>{let n=tt(t,pi),r=Xi(e.scope),i=ao(e.pubsub,e.subscribers,e.strategy);return Ri(r,no(i)).pipe(Nr(Zn(n,e=>Jr(r,e))),mi(i))})),no=e=>qn(de(t=>(Qa(e.shutdownFlag,!0),ua(Ga(e.pollers),e=>An(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Ci(()=>E(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),Kt(e.shutdownHook.open),zi)))),ro=e=>or(function t(n){if(e.shutdownFlag.current)return zr;let i=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(i=n.concat(i)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?j(e.replayWindow.takeAll().concat(i)):r(i)?j(i):P(io(e),e=>t([e]))}),io=e=>{let t=ba(),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),ln(Er(t),()=>(Ja(e.pollers,t),N))},ao=(e,t,n)=>new oo(e,t,e.subscribe(),Ra(),Ia(!1),Za(!1),n,e.replayWindow()),oo=class{[$a]={_A:m};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 at(this,arguments)}},so=`~effect/Queue`,co=`~effect/Queue/Enqueue`,lo=`~effect/Queue/Dequeue`,uo={_A:m,_E:m},fo={[so]:uo,[co]:uo,[lo]:uo,...Qt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:Do(this)}}},po=e=>bn(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},Xn(n)}),mo=e=>po({capacity:e}),ho=(e,t)=>Yi(()=>{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)=>Yi(()=>{if(e.state._tag!==`Open`)return Xn(Tt(t));let n=vo(e,t);return n.length===0?Ai([]):e.strategy===`dropping`?Xn(n):Io(e,n)}),vo=(e,t)=>{if(e.state._tag!==`Open`)return Tt(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 Tt(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=x(2,(e,t)=>rr(()=>bo(e,t))),bo=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=fn(Ye(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,un(Pe())),So=e=>rr(()=>{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(Ai(e.remaining.slice(e.offset)));t.clear()}return!0}),Co=e=>wo(e,1,1/0),wo=(e,t,n)=>Yi(()=>Po(e,t,n)??Oe(Ro(e),wo(e,1,n))),To=e=>Yi(()=>Eo(e)??Oe(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),Ai(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),Ai(t)}},Do=e=>e.state._tag===`Done`?0:e.messages.length,Oo=Ai(!1),ko=Ai(!0),Ao=Ae(Pe()),jo=Ve(),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(vn),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 Ai([]);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),Ai(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Wa(e.messages,n);return Lo(e),Ai(t)}},Fo=(e,t)=>Oi(n=>{if(e.state._tag!==`Open`)return n(Oo);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),rr(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Io=(e,t)=>Oi(n=>{if(e.state._tag!==`Open`)return n(Ai(t));let r={_tag:`Array`,remaining:t,offset:0,resume:n};return e.state.offers.add(r),rr(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Lo=e=>{if(e.state._tag===`Done`)return we(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(zo(e,e.state.exit),we(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(Ai([])),e.state.offers.delete(n)}return!1},Ro=e=>Oi(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),rr(()=>{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=Yi(()=>this.free<e?Oi(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),rr(()=>{this.waiters.delete(r)})}):(this.taken+=e,Xn(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 bn(t=>Xn(this.updateTakenUnsafe(t,e)))}resize(e){return bn(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),yi))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>pr(n=>ai(n(this.take(e)),e=>Li(n(t),()=>{this.updateTakenUnsafe(jr(),t=>t-e)},!0)))}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>pr(n=>this.free<e?qr:(this.taken+=e,Li(n(qe(t)),()=>{this.updateTakenUnsafe(jr(),t=>t-e)},!0)))}},Ho=`~effect/Channel`,Uo=e=>kr(e,Ho),Wo={[Ho]:{_Env:m,_InErr:m,_InElem:m,_OutErr:m,_OutElem:m},pipe(){return at(this,arguments)}},Go=e=>{let t=Object.create(Wo);return t.transform=(t,n)=>Zi(e(t,n),e=>j(ia(e))),t},Ko=(e,t)=>Go((n,r)=>P(Yo(e)(n,r),e=>t(e,r))),qo=e=>Go((t,n)=>e),Jo=e=>Go(v(function*(t,n){let r=Xi(n),i=e=>Jr(r,St(e));return Ne(yield*Ne(e(t,n,r),i),i)})),Yo=e=>e.transform,Xo=(e,t,n)=>po({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Ci(t=>Ri(e,So(t))),Ci(n=>le(mr(t(n),e),e))),Zo=(e,t)=>Go((n,r)=>b(Xo(r,e,t),Co)),Qo=e=>Go((t,n)=>or(()=>Yo(e())(t,n))),$o=qo(j(ct())),es=e=>qo(j(jn(e))),ts=e=>qo(j(Co(e))),ns=e=>qo(j(ln(ro(e),()=>ct()))),rs=e=>ds(b(to(e),ns)),is=x(2,(e,t)=>Ko(e,e=>E(()=>{let n=0;return b(e,e=>t(e,n++))}))),as=e=>e===void 0||e!==`unbounded`&&e<=1,os=x(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),P(e=>t(e,i++)))}),cs=(e,t,n)=>Jo(v(function*(r,i,a){let o=0,s=yield*Yo(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*mo(0);yield*Ri(a,So(l));let u=dr(yield*xi()),d=Fa(a);if(n.unordered){let e=Bo(c),n=fe(e.release(1)),r=te({onFailure:e=>P(yo(l,e),n),onSuccess:e=>P(ho(l,e),n)});yield*e.take(1).pipe(P(()=>s),P(e=>(d(u(r(t(e,o++)))),N)),Wt({disableYield:!0}),Zi(t=>e.withPermits(c-1)(yo(l,t))),le(a))}else{let e=yield*mo(c-2);yield*Ri(a,So(l)),yield*To(e).pipe(ga,P(e=>ho(l,e)),Wt({disableYield:!0}),Zi(e=>yo(l,e)),le(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,bo(l,e.cause))};yield*s.pipe(P(i=>{if(n)return ia(n);let a=u(t(i,o++));return d(a),a.addObserver(r),ho(e,Aa(a))}),Wt({disableYield:!0}),Zi(t=>ho(e,Lt(t)).pipe(Nr(yo(e,t)))),le(a))}return To(l)})),ls=e=>Ko(e,e=>{let t,n=0;return j(or(function r(){if(t===void 0)return P(e,e=>{switch(e.length){case 0:return r();case 1:return j(e[0]);default:return t=e,j(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),j(i)}))}),us=x(2,(e,t)=>Ko(e,e=>j(P(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Gi(i)?j(i):P(e,n)})))),ds=e=>Go((t,n)=>{let r;return j(or(()=>r||e.pipe(mr(n),P(e=>Yo(e)(t,n)),P(e=>r=e))))}),fs=x(2,(e,t)=>Jo((n,r,i)=>Zn(i,t).pipe(Nr(Yo(e)(n,r))))),ps=x(2,(e,t)=>fs(e,e=>t)),ms=(e,t,n)=>or(()=>{let r=ir();return dt(P(Yo(e)(ct(),r),t),n||j).pipe(Zt(e=>Jr(r,e)))}),hs=x(2,(e,t)=>Go((n,r)=>b(He(Yo(e)(n,r),t),He(t)))),gs=x(2,(e,t)=>ms(e,e=>Wt(P(e,t),{disableYield:!0}))),_s=v(function*(e){let t=Bo(1),n=yield*xi(),r=tt(n,pi);return(yield*Yo(e)(ct(),r)).pipe(He(n),t.withPermits(1))},Zi(e=>j(ia(e)))),vs=(e,t)=>Yo(e)(ct(),t),ys=`~effect/Stream`,bs={_R:m,_E:m,_A:m},xs={[ys]:bs,pipe(){return at(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(${qi(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:o(Array.from(this))}},[Ot](){return this.toJSON()},pipe(){return at(this,arguments)}},Ts=()=>{let e=Object.create(ws);return e.backing=new Map,e.buckets=new Map,e},Es=x(2,(e,t)=>{if(e.backing.has(t))return Da(e.backing.get(t));if(Os(t))return $e();let n=Ds.get(e);if(n!==void 0)return e.backing.has(n)?Da(e.backing.get(n)):$e();let r=sr(t),i=e.buckets.get(r);return i===void 0?$e():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(Hi(n,t[r])){let i=t[r];return Ds.set(n,i),Da(e.backing.get(i))}return $e()},As=x(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=sr(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(Hi(t,e[n]))return Ds.set(t,e[n]),e[n]},Ms=x(2,(e,t)=>{if(Os(t))return e.backing.delete(t),e;let n=Ds.get(e)??t,r=sr(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||Hi(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=>kr(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(v(function*(t,n){let r=e.evaluate().getReader();return yield*Ri(n,e.releaseLockOnEnd?E(()=>r.releaseLock()):Je(()=>r.cancel())),P(oa({try:()=>r.read(),catch:t=>e.onError(t)}),({done:e,value:t})=>e?ct():j($n(t)))}))),Ws=e=>Fs(ds(b(e,Is))),Gs=x(e=>Ps(e[0]),(e,t,n)=>e.channel.pipe(ls,os(t,n),is($n),Fs)),Ks=x(2,(e,t)=>Fs(us(Is(e),t))),qs=x(2,(e,t)=>Fs(ps(e.channel,t))),Js=x(2,(e,t)=>Fs(hs(e.channel,t))),Ys=x(2,(e,t)=>gs(e.channel,t)),Xs=e=>_s(e.channel),Zs=x(e=>Ps(e[0]),(e,t,n)=>{let r,i,o=Ia(!1);return new ReadableStream({start(n){i=a(He(Ys(e,e=>o.whenOpen(E(()=>{o.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(Xt(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,o.openUnsafe()})},cancel(){if(i)return Ki(zi(Ma(i)))}},n?.strategy)}),Qs=x(e=>Ps(e[0]),(e,t)=>b(xi(),n=>Zs(e,n,t))),$s=e(t(),1),ec=e(Te(),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}}u(`SourceError`);var ic=ft(`effect/ConfigProvider`,{defaultValue:()=>dc()}),ac={...Qt,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=>lt(e)?xn(ic)(e):Mr(ic)(e);function cc(e){return oc(t=>j(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(Jn(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):Jn(e)?nc(new Set(Object.keys(e))):tc(qi(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=>j(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={...jt({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=x(2,(e,t)=>yc(n=>b(e.parse(n),t))),xc=x(2,(e,t)=>yc(n=>hr(e.parse(n),e=>t(e).parse(n))));function Sc(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return ut(e.actual)||xt(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return ut(e.actual)||xt(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=x(2,(e,t)=>xc(e,e=>{if(ye(e.cause)){let n=e.cause.issue;if(Sc(n))return kc(t)}return Oc(e.cause)})),wc=e=>e.pipe(bc(Da),Cc($e())),Tc=v(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=v(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=Ft(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=ot(e),r=ka(n),i=Ge(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(Gn(e=>r(e).pipe(Ea(e=>new et(t.length>0?new At(t,e):e)))),Ea(e=>new _c(e)))})}function Oc(e){return yc(()=>jn(new _c(e)))}function kc(e){return yc(()=>j(e))}function Ac(e){return Dc(M,e)}var jc=`~effect/SubscriptionRef`,Mc=e=>kr(e,jc);({...Qt});var Nc=e=>Hs(e.pubsub),Pc=e=>E(()=>e.value),Fc=(e,t)=>{e.value=t,eo(e.pubsub,t)},Ic=x(2,(e,t)=>e.semaphore.withPermit(E(()=>Fc(e,t)))),Lc=class extends k()(`effect/reactivity/Reactivity`){},Rc=E(()=>{let e=new Map,t=t=>{Wc(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>ti(n=>{let r=n.mapUnsafe.get(zc.key);return r?Wc(e,e=>{r.add(e)}):t(e),N}),r=(e,t)=>Ci(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])}}},a=(e,t)=>Ur(function*(){let n=yield*xi(),r=tt(n,pi),a=yield*po(),o=Kr(dr(n),Fa(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?bo(a,e.cause):go(a,e.value),c?(c=!1,o(t).addObserver(l)):s=!1};function u(){if(s){c=!0;return}s=!0,o(t).addObserver(l)}return yield*Ri(r,E(i(e,u))),u(),a});return Lc.of({mutation:r,query:a,stream:(e,t)=>a(e,t).pipe(b(Vs),Ws),invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:t=>or(()=>{let n=new Set;return t.pipe(yn(zc,n),Zt(t=>E(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))})})}),zc=class extends k()(`effect/reactivity/Reactivity/PendingInvalidation`){},Bc=x(2,(e,t)=>Lc.use(n=>n.mutation(t,e))),Vc=e=>Lc.use(t=>t.invalidate(e)),Hc=xn(Lc)(Rc);function Uc(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return sr(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=>kr(e,Gc),qc={[Gc]:{E:m,A:m},pipe(){return at(this,arguments)},[tr](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return Hi(this.value,e.value);case`Failure`:return Hi(this.cause,e.cause)}},[ri](){let e=_r(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:ea(e)(this._tag===`Success`?sr(this.value):sr(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??$e(),n.waiting=t?.waiting??!1,n},nl=(e,t)=>tl(e,{previousSuccess:ue(t.previous,e=>$c(e)?Da(e):el(e)?e.previousSuccess:$e()),waiting:t.waiting}),rl=(e,t)=>nl(yt(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`?Da(e.value):e._tag===`Failure`?Ce(e.previousSuccess,e=>e.value):$e(),cl=e=>Br(sl(e),()=>new Rr(`AsyncResult.getOrThrow: no value found`)),ll=e=>{switch(e._tag){case`Success`:return ce(e.value);case`Failure`:return Lt(e.cause);default:return ha(new Rr)}},ul=x(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return tl(e.cause,{previousSuccess:Ce(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??Cn,n=e.error??Cn,r=Fn()([t,je(n,y)],([e,t])=>(n,r,i)=>{if(!Kc(n))return jn(new On(r,Da(n)));switch(n._tag){case`Initial`:return j(n);case`Success`:return Qe(ka(e)(n.value,i),{onSuccess:e=>F(e,n),onFailure:e=>new gn(r,Da(n),[new At([`value`],e)])});case`Failure`:{let a=n.previousSuccess.pipe(Ce(t=>Qe(ka(e)(t.value,i),{onSuccess:e=>Da(F(e,t)),onFailure:e=>new gn(r,Da(n),[new At([`previousSuccess`,`value`],e)])})),f(()=>$i)),o=Ea(ka(t)(n.cause,i),e=>new gn(r,Da(n),[new At([`cause`],e)]));return Gn(a,e=>Nt(o,t=>tl(t,{previousSuccess:e,waiting:n.waiting})))}}},{expected:`AsyncResult`,toCodec([e,t]){let n=vi(`Success`,{value:e,waiting:tn,timestamp:T});return pe()(w([vi(`Initial`,{waiting:tn}),n,vi(`Failure`,{cause:t,previousSuccess:Ji(n),waiting:tn})]),Sn({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:Ce(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:_i,toFormatter:([e,t])=>n=>{switch(n._tag){case`Success`:return`AsyncResult.Success(${e(n.value)}, ${n.waiting}, ${n.timestamp})`;case`Failure`:return`AsyncResult.Failure(${t(n.cause)}, ${n.waiting})`;case`Initial`:return`AsyncResult.Initial(${n.waiting}, ${n.waiting})`}}});return Object.assign(r,{success:t,error:n})},fl=`~effect/reactivity/AtomRegistry`,pl=e=>kr(e,fl),ml=e=>new xl(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),hl=k(fl),gl=x(e=>pl(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Yr(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 E(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 ya(`sync`,t),this.schedulerAsync=new ya(`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,ve,_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?$e():Da(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 an;switch(n._tag){case`Initial`:return an;case`Failure`:return Lt(n.cause);case`Success`:return j(n.value)}},resultOnce(e,t){return Yr(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 E(i)})},setResult(e,t){return this.disposed?an:(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`?an:j(t.value)},someOnce(e){return Yr(t=>{let n=this.once(e);if(xt(n))return t(j(n.value));let r=this.node.registry.subscribe(e,e=>{ut(e)||(r(),t(j(e.value)))},{immediate:!1});return E(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?$e():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=>E(()=>{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`?j(e.value):ia(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=>kr(e,Ml),Pl=`~effect/reactivity/Atom/Writable`,Fl=x(2,(e,t)=>{let n=ca(t),r=Ht(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?se(n):void 0})}),Il=Fl(0),Ll={[Ml]:Ml,...Qt,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 lt(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`&&!lt(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(lt(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=Lr(),i=!1){let a=e.self(),o=ir();e.addFinalizer(()=>{dr(r)(Jr(o,pt))});let s=new Map(r.mapUnsafe);s.set(pi.key,o),s.set(hl.key,e.registry),s.set(Un.key,e.registry.scheduler);let c,l=!1,u=Ql(Fe(s),t,function(t){c=Jc(t,a),l&&e.setSelf(c)},i);return l=!0,u!==void 0&&e.addFinalizer(u),c===void 0?a._tag===`Some`?Yc(a):il(n):c}function Ql(e,t,n,r=!1){if(la(t)){n(t);return}let i=dr(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}var $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=>Ni(r(e),t):()=>Ni(r,t)));return i.layer=a,i.read=function(t){let n=t(a);return Xl(t,P(Bn,t=>We(n,e.memoMap,t)),{uninterruptible:!0})},i}n.memoMap=e.memoMap,n.addGlobalLayer=e=>{t=Ni(t,oi(e,Hc))};let r=Il(Gl(ti(t=>We(Hc,e.memoMap,tt(t,pi))).pipe(b(tt(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:s()});$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=Lr()){let i=e.self();r=l(r,hl,e.registry);let a=gi(n=>P(vs(t.channel,n),t=>_e({while:fa,body:()=>t,step(t){e.setSelf(F(Pr(t),{waiting:!0}))}}))).pipe(Zi(t=>(we(t)?O(e.self(),ue(sl),Le({onNone:()=>e.setSelf(rl(new Rr,{previous:e.self()})),onSome:t=>e.setSelf(F(t))})):e.setSelf(nl(t,{previous:e.self()})),N))),o=new Map(r.mapUnsafe);o.set(hl.key,e.registry),o.set(Un.key,e.registry.scheduler);let s=Ql(Fe(o),a,ve,!1);return s!==void 0&&e.addFinalizer(s),i._tag===`Some`?Yc(i):il(n)}var nu=(e,t,n=Lr())=>Mc(t)?(e.addFinalizer(Nc(t).pipe(Ys(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return N}),Dt(n))),Fr(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)?Fi(Ic(r,n)):$c(r)&&Fi(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(Ta(),{previous:t.self()});let l=e(c,t);return ql in l?(o&&(l=P(ge(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)=>P(Xs(typeof n==`function`?n(e):n),n=>{let i=Pa().context,a=Di(),o=te(n,{onFailure(e){return we(e)?Gi(a)?j({done:!0,items:a}):jn(new Rr(`Atom.pull: no items`)):ia(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=nn(a,e),a=t),j({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(ht(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=x(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=x(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=rt(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=x(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),Yr(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=x(2,(e,t)=>{let n=Hr(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,Error().stack?.split(`
2
+ `)[5]??``],[xu]:{key:t.key,encode:oe(n),decode:sa(n)}})}),Cu=`~effect-atom/atom/Atom/ServerValue`,wu=x(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=li(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(he(e))return e.value;throw Xt(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 Xt(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},[Ii]:{value(e){return Qu(this,tt(e,$u))}},toJSON:{value(){return ui(this)}},[tr]:{value(e){return Wu(this,e)}},[ri]:{value(){return wi(this)}},toString:{value:mn.toString},[Ot]:{value:mn[Ot]}});var Uu=e=>Object.assign(Object.create(Hu),e),Wu=Mn(Vn()),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=x(3,(e,t,n)=>{let r=Uu(e);return r[t.toLowerCase()]=n,r}),Yu=x(2,(e,t)=>Uu({...e,...Ku(t)})),Xu=x(2,(e,t)=>{let n=Uu(e);return Object.assign(n,t),n}),Zu=x(2,(e,t)=>{let n=Uu(e);return delete n[t.toLowerCase()],n}),Qu=x(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=c(e[r]))}else for(let r in e)t.test(r)&&(n[r]=c(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),$u=ft(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),ed=`~effect/http/UrlParams`,td={...Qt,[ed]:ed,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[tr](e){return ad(this,e)},[ri](){return Zr(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`?Tt(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=Ir((e,t)=>od(e.params,t.params)),od=hi(_a([Vn(),Vn()])),sd=nd([]),cd=x(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 u(`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),Gt(r)}catch(e){return Rt(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`;u(`HttpBodyError`);var pd=class{[fd];constructor(){this[fd]=fd}[Ot](){return this.toJSON()}toString(){return qi(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`;u(`CookieError`);var _d={[hd]:hd,...mn,toJSON(){return{_id:`effect/Cookies`,cookies:aa(this.cookies,e=>e.toJSON())}},pipe(){return at(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=me(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,...mn,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 u(`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 u(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Od(Dd(this._tag),this.description,this.methodAndUrl)}};u(`EncodeError`);var Ad=class extends u(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Od(Dd(this._tag),this.description,this.methodAndUrl)}};u(`StatusCodeError`);var jd=class extends u(`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 u(`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 Ke(Td)({_tag:h(`HttpError`),kind:S([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:A(y)}){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,...mn,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ui(this.headers),body:this.body.toJSON()}},pipe(){return at(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,$e(),Gu,md),zd=e=>(t,n)=>Bd(Rd,{method:e,url:t,...n??void 0}),Bd=x(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=x(2,(e,t)=>Ld(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Hd=x(3,(e,t,n)=>Ld(e.method,e.url,e.urlParams,e.hash,Ju(e.headers,t,n),e.body)),Ud=x(2,(e,t)=>Ld(e.method,e.url,e.urlParams,e.hash,Yu(e.headers,t),e.body)),Wd=x(2,(e,t)=>Hd(e,`Accept`,t)),Gd=Wd(`application/json`),Kd=x(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=Wr(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=x(2,(e,t)=>Ld(e.method,e.url,cd(e.urlParams,t),e.hash,e.headers,e.body)),Jd=x(2,(e,t)=>Ld(e.method,e.url,e.urlParams,Da(t),e.headers,e.body)),Yd=x(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=Fi(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Fi(e.text)}catch{}let i={...t,headers:ui(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 En{[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 $e()}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 P(this.text,e=>Sa({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=oa({try:()=>this.source.text(),catch:e=>new Ed({reason:new jd({request:this.request,response:this,cause:e})})}).pipe(Qn,Fi),this.arrayBufferBody=b(this.textBody,e=>new TextEncoder().encode(e).buffer),this.textBody)}get urlParamsBody(){return P(this.text,e=>Sa({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??=oa({try:()=>this.source.formData(),catch:e=>new Ed({reason:new jd({request:this.request,response:this,cause:e})})}).pipe(Qn,Fi)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=oa({try:()=>this.source.arrayBuffer(),catch:e=>new Ed({reason:new jd({request:this.request,response:this,cause:e})})}).pipe(Qn,Fi),this.textBody=b(this.arrayBufferBody,e=>new TextDecoder().decode(e)),this.arrayBufferBody)}pipe(){return at(this,arguments)}},tf=e=>qu({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Le(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),nf=`~effect/http/HttpClient`,rf=k(`effect/HttpClient`),af=x(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 at(this,arguments)},...mn,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=>P(t,t=>de(n=>{let r=mf.get(t),i=r??new AbortController,a=ud(t.url,t.urlParams,rt(t.hash));if(re(a))return jn(new Ed({reason:new Ad({request:t,cause:a.failure})}));let o=a.success;if(n.getRef($r)||n.getRef(lf)(t)){let a=e(t,o,i.signal,n);return r?a:va(e=>te(e(a),{onSuccess(e){return pf.register(e,i),j(new hf(e,i))},onFailure(e){return Ze(e)&&i.abort(),ia(e)}}))}return ie(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,va(s=>s(e(t,o,i.signal,n)).pipe(gt(a,{captureStackTrace:!1}),te({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?j(e):(pf.register(e,i),j(new hf(e,i)))},onFailure(e){return!r&&Ze(e)&&i.abort(),ia(e)}})))})})),j),lf=ft(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>ae}),uf=ft(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:fa}),df=ft(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),ff=e=>xn(rf)(ti(t=>b(e,e=>af(e,zt(e=>Xe(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 or(()=>(pf.unregister(this.original),ln(e,()=>E(()=>{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,E(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Ot](){return this.original[Ot]()}pipe(){return at(this,arguments)}},gf=`~effect/FiberSet`,_f=e=>kr(e,gf),vf={[gf]:gf,[Symbol.iterator](){return this.state._tag===`Closed`?Kn():this.state.backing[Symbol.iterator]()},...Qt,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=()=>si(E(()=>yf(new Set,ba())),e=>or(()=>{let t=e.state;if(t._tag===`Closed`)return N;e.state={_tag:`Closed`};let n=t.backing;return Na(n).pipe(ra(e.deferred))})),xf=-1,Sf=_(ma(xe,It(xf))),Cf=x(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),Ut(r)&&(n?.propagateInterruption===!0?!Sf(r.cause):!Mt(r.cause))&&br(e.deferred,r))})}),wf=function(){let e;return()=>(e===void 0&&(e=a(zr)),e)}(),Tf=e=>()=>b(xi(),t=>{let n=dr(t);return(t,r)=>{if(e.state._tag===`Closed`)return wf();let i=n(t,r);return Cf(e,i),i}}),Ef=e=>Er(e.deferred),Df=`~effect/socket/Socket`,Of=k(`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=>kr(e,Mf),Pf=`~effect/socket/Socket/SocketError`,Ff=e=>kr(e,Pf),If=class extends Ke(`effect/socket/Socket/SocketReadError`)({_tag:h(`SocketReadError`),cause:y}){message=`An error occurred during Read`},Lf=class extends Ke(`effect/socket/Socket/SocketWriteError`)({_tag:h(`SocketWriteError`),cause:y}){message=`An error occurred during Write`},Rf=class extends Ke(`effect/socket/Socket/SocketOpenError`)({_tag:h(`SocketOpenError`),kind:S([`Unknown`,`Timeout`]),cause:y}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},zf=class extends Ke(`effect/socket/Socket/SocketCloseError`)({_tag:h(`SocketCloseError`),code:T,closeReason:A(M)}){static filterClean(e){return function(t){return Vf.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?Gt(t.reason):Rt(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},Bf=w([If,Lf,Rf,zf]),Vf=class extends Hn(Pf)(`SocketError`,{_tag:h(`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 k()(`~effect/socket/Socket/WebSocket`){},Wf=class extends k()(`@effect/platform/Socket/WebSocketConstructor`){},Gf=Mr(Wf)((e,t)=>new globalThis.WebSocket(e,t)),Kf=(e,t)=>Wf.use(n=>qf(si((typeof e==`string`?j(e):e).pipe(b(e=>n(e,t?.protocols))),e=>E(()=>e.close(1e3))),t)),qf=(e,t)=>de(n=>{let r,i=Ia(!1),a=n.context,o=t?.closeCodeIsError??Hf;return j(kf({runRaw:(n,s)=>gi(v(function*(a){let c=yield*bf().pipe(mr(a)),l=yield*mr(e,a),u=yield*yn(Tf(c)(),Uf,l),d=!1;function f(e){if(e.data instanceof Blob)return u(P(Je(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return lt(t)?t:N}));let t=n(e.data);lt(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),br(c.deferred,jn(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),br(c.deferred,jn(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=ba();l.addEventListener(`open`,()=>{d=!0,br(e,N)},{once:!0}),yield*Er(e).pipe(Nn({duration:t?.openTimeout??1e4,orElse:()=>jn(new Vf({reason:new Rf({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),pn(Ef(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*ar(Ef(c),zf.filterClean(e=>!o(e)),()=>N)})).pipe(zt(e=>Xe(a,e)),xr(E(()=>{i.closeUnsafe(),r=void 0}))),writer:j(e=>i.whenOpen(E(()=>{let t=r;Nf(e)?t.close(e.code,e.reason):t.send(e)})))}))}),Jf=Kr(Kf,xn(Of)),Yf=class extends k()(`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=>E(()=>t(e)),readUnsafe:n,read:E(n),clearUnsafe:r,clear:E(r)})},Zf=`~effect/workers/WorkerError`,Qf=w([class extends Ke(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:h(`WorkerSpawnError`),message:M,cause:A(y)}){},class extends Ke(`effect/workers/WorkerError/WorkerSendError`)({_tag:h(`WorkerSendError`),message:M,cause:A(y)}){},class extends Ke(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:h(`WorkerReceiveError`),message:M,cause:A(y)}){},class extends Ke(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:h(`WorkerUnknownError`),message:M,cause:A(y)}){}]);Ke(Zf)({_tag:h(`WorkerError`),reason:Qf});var $f=`~effect/interfaces/PrimaryKey`,ep=`~effect/rpc/RpcSchema/StreamSchema`;function tp(e){return kr(e,ep)}function np(e){return tp(e)?Da({success:e.success,error:e.error}):$e()}var rp=wr(Ps);function ip(e,t){return _t(rp.ast,{[ep]:ep,success:e,error:t})}k()(`effect/rpc/RpcSchema/ClientAbort`);var ap=`~effect/rpc/Rpc`,op={[ap]:ap,pipe(){return at(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:qt(e)?e:D(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:l(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:Xe(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??ii,r=t?.error??Cn,i=t?.defect??y,a;return a=t?.primaryKey?class extends Jt(`effect/rpc/Rpc/${e}`)(t.payload){[$f](){return t.primaryKey(this)}}:qt(t?.payload)?t?.payload:t?.payload?D(t?.payload):ii,sp({_tag:e,payloadSchema:a,successSchema:t?.stream?ip(n,r):n,errorSchema:t?.stream?Cn:r,defectSchema:i,annotations:Lr(),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);xt(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Ei(xt(r)?ii:t.successSchema,w([...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 Ke(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:h(`RpcClientDefect`),message:M,cause:y}){},mp=class extends Ke(fp)({_tag:h(`RpcClientError`),reason:w([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?ae(e):e.constructor!==Map&&!Array.isArray(e)&&!fm.some(t=>e instanceof t)?ae(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)ie(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):ie(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));ie(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},v=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])},re=typeof this.useRecords==`function`&&this.useRecords,ie=re?e=>{re(e)?v(e):ne(e)}:v,ae=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 ie(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 k()(`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=Mr(Nm)(Pm),Im=e=>or(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>ti(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),N});return b(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return Ur(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*He(or(()=>i(e)),t)}return yield*Zt(an,()=>(t.delete(e),r.delete(e),N))})}}))}),Lm=BigInt(0),Rm=v(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>Lm++),o=yield*xi(),s=tt(o,pi),c=new Map,l=!1;yield*Ri(s,de(e=>(l=!0,u(ne(e.id)))));let u=v(function*(e){for(let[t,n]of c)c.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?xo(n.queue):yo(n.queue,e.cause):n.resume(e)}),d=e=>{let r=tp(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?Ku(s.headers):Gu,l=s?.context??Lr();if(!r){let r=t=>f(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):ie(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=p(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:Ws(b(u,Vs))}},f=(e,n,r,i,o,s,u)=>de(d=>{if(l)return zr;let f=a(),p=n(e=>t.onFromClient({message:e,context:s,discard:u}),{_tag:`Request`,id:f,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:Xu(d.getRef(Um),o)});if(u)return p;let h;return ln(Yr(t=>{let n={_tag:`Effect`,rpc:e,context:s,resume(e){t(e),h&&!h.pollUnsafe()&&d.currentDispatcher.scheduleTask(()=>{h.interruptUnsafe(d.id)},0)}};c.set(f,n),h=p.pipe(r?gt(r,{captureStackTrace:!1}):m,dr(d.context)),h.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>(c.delete(f),Nr(Ma(h),g(f,Array.from(e),s))))}),p=v(function*(e,r,o,s,u,d){if(l)return yield*zr;let f=i?void 0:yield*Se(`${n}.${e._tag}`,{attributes:t.spanAttributes}),p=Pa(),h=a(),te=vt(p.context,pi);yield*Zn(te,e=>c.has(h)?(c.delete(h),g(h,Ut(e)?Array.from(ee(e.cause)):[],d)):N);let _=yield*mo(u);return c.set(h,{_tag:`Queue`,rpc:e,queue:_,scope:te,context:d}),yield*r(e=>t.onFromClient({message:e,context:d,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:o,...f?{traceId:f.traceId,spanId:f.spanId,sampled:f.sampled}:{},headers:Xu(p.getRef(Um),s)}).pipe(f?gt(f,{captureStackTrace:!1}):m,Zi(e=>yo(_,e)),nt,le(te,{startImmediately:!0})),_}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=o.mapUnsafe.get(`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r)=>Yr(i=>{let a=Pa();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(Or(1e3),dr(a.context)).addObserver(()=>{i(N)})}),te=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=c.get(n);return!i||i._tag!==`Queue`?N:_o(i.queue,e.values).pipe(r?P(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):m,Zi(e=>yo(i.queue,e)))}case`Exit`:{let t=e.requestId,n=c.get(t);return n?(c.delete(t),n._tag===`Effect`?(n.resume(e.exit),N):e.exit._tag===`Success`?xo(n.queue):yo(n.queue,e.exit.cause)):N}case`Defect`:return u(Wn(e.defect));case`ClientEnd`:return N}},_;if(t.flatten){let t=new Map;_=function(n,r,i){let a=t.get(n);return a||(a=d(e.requests.get(n)),t.set(n,a)),a(r,i)}}else _={},e.requests.forEach(e=>{_[e._tag]=d(e)});return{client:_,write:te}}),zm=0,Bm=v(function*(e,t){let n=zm++,{run:r,send:i,supportsAck:a,supportsTransferables:o}=yield*Wm,s=new Map,{client:c,write:u}=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(),u={rpc:r,context:a?l(c.context,Yf,a):c.context,schemas:Hm(r)};return s.set(t.id,u),u.schemas.encodePayload(t.payload).pipe(He(u.context),ke,P(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)}):N;case`Interrupt`:return s.get(t.requestId)?(s.delete(t.requestId),i(n,{_tag:`Interrupt`,requestId:String(t.requestId)})):N;case`Eof`:return N}}});return yield*r(n,e=>{switch(e._tag){case`Chunk`:{let t=hp(e.requestId),n=s.get(t);return!n||ut(n.schemas.decodeChunk)?N:n.schemas.decodeChunk.value(e.values).pipe(He(n.context),ke,P(t=>u({_tag:`Chunk`,clientId:0,requestId:hp(e.requestId),values:t})),Ne(t=>u({_tag:`Exit`,clientId:0,requestId:hp(e.requestId),exit:Lt(t)})))}case`Exit`:{let t=hp(e.requestId),n=s.get(t);return n?(s.delete(t),n.schemas.decodeExit(e.exit).pipe(He(n.context),ke,te({onSuccess:e=>u({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>u({_tag:`Exit`,clientId:0,requestId:t,exit:Lt(e)})}))):N}case`Defect`:return u({_tag:`Defect`,clientId:0,defect:Xm(e.defect)});case`ClientProtocolError`:{let t=ha(e.error);return ua(s.keys(),e=>u({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return N}}).pipe(Zi(bt),nt,mt),c}),Vm=new WeakMap,Hm=e=>{let t=Vm.get(e);return t===void 0?(t={decodeChunk:Ce(np(e.successSchema),e=>Yn(Hr(wt(e.success)))),encodePayload:Vt(Hr(e.payloadSchema)),decodeExit:Yn(Hr(lp(e)))},Vm.set(e,t),t):t},Um=ft(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>Gu}),Wm=class extends k()(`effect/rpc/RpcClient/Protocol`){static make=Im},Gm=e=>Wm.make(v(function*(t,n){let r=yield*Of,i=yield*Nm,a=yield*er(Ym),o=new Map,s=yield*r.writer,c=i.makeUnsafe(),l=yield*qm(s(c.encode(gp))),u,d=or(()=>(u=void 0,xt(a)?a.value.onConnect:N)),f=e=>ua(n,n=>t(n,e));return yield*or(()=>(c=i.makeUnsafe(),l.reset(),r.runRaw(e=>{try{let n=c.decode(e);if(n.length===0)return;let r=0;return _e({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return l.onPong(),N;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:ve})}catch(e){return f({_tag:`ClientProtocolError`,error:new mp({reason:new pp({message:`Error decoding message`,cause:e})})})}},{onOpen:d}).pipe(pn(P(l.timeout,()=>jn(new Vf({reason:new Rf({kind:`Timeout`,cause:Error(`ping timeout`)})}))))))).pipe(P(()=>jn(new Vf({reason:new zf({code:1e3})}))),xt(a)?xr(a.value.onDisconnect):m,ni(t=>{let n=Ie(t),r=da(n);return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?N:(u=new mp({reason:r?n.success.reason:new pp({message:`Unknown socket error`,cause:Xt(t)})}),f({_tag:`ClientProtocolError`,error:u}))}),Tn(e?.retryPolicy??Km),Rn({module:`RpcClient`,method:`makeProtocolSocket`}),mt),{send(e,t){if(u)return jn(u);t._tag===`Request`&&o.set(t.id,e);let n=c.encode(t);return n===void 0?N:ke(s(n))},supportsAck:!0,supportsTransferables:!1}})),Km=Vr(500,1.5).pipe(p(it(5e3))),qm=v(function*(e){let t=!0,n=Ia();return yield*or(()=>t?(t=!1,e):n.open).pipe(Dr(`5 seconds`),d,Wt,nt,mt),{timeout:n.await,reset:()=>{t=!0,n.closeUnsafe()},onPong:()=>{t=!0}}}),Jm=e=>xn(Wm)(Gm(e)),Ym=class extends k()(`effect/rpc/RpcClient/ConnectionHooks`){},Xm=sa(y),Zm=()=>(e,t)=>{let n=k()(e),r=xn(n,t.makeEffect??Bm(t.group,{...t,flatten:!0}));n.runtime=(t.runtime??$l)(typeof t.protocol==`function`?e=>oi(r,Wi(t.protocol(e))):oi(r,Wi(t.protocol))),n.mutation=fu(e=>{let r=t.group.requests.get(e);return n.runtime.fn()(v(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=>j(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=Ht(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?ca(n.timeToLive):void 0,serializationKey:n?.serializationKey}),n},Qm=e=>w([e.errorSchema,...Array.from(e.middlewares,e=>e.error),mp]),$m=ft(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),eh=class extends k()(`effect/http/FetchHttpClient/RequestInit`){},th=ff(j(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(oa({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 P(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:Fe(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 Ur(function*(){let n=yield*xi(),r=lt(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 Fe(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 hn(this.toHandlers(e))},of:m,toLayerHandler(e,t){let n=this;return hn(Ur(function*(){let r=yield*xi(),i=lt(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),Fe(a)}))},accessHandler(e){return ti(t=>{let n=this.requests.get(e),{handler:r,context:i}=t.mapUnsafe.get(n.key);return j((e,t)=>{t.rpc=n;let a=r(e,t),o=dp(a)?a.value:a;return lt(o)?ki(o,i):Js(o,i)})})},annotate(e,t){return rh({requests:this.requests,annotations:l(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(be(e,t))},annotateMerge(e){return rh({requests:this.requests,annotations:Xe(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(Xe(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:Lr()}),ah=class extends Hn()(`AgentError`,{cause:A(y),message:A(M)}){},oh=S([`codex`,`claude`]);D({cwd:M,provider:oh});var sh=M.pipe(Ar(`AgentSubscription`)),ch=D({resetsAt:A(M),utilization:T}),lh=D({fiveHour:ch,tokens:D({cached:T,input:T,output:T}),weekly:ch}),uh=di(M,n(ze)),dh=`~effect/ai/Prompt/Part`,fh=D({[dh]:C(dh).pipe(Re(j(dh),{encodingStrategy:`omit`})),options:uh.pipe(Ee(j({})))}),ph=(e,t)=>({...t,[dh]:dh,type:e,options:t.options??{}}),mh=D({...fh.fields,type:C(`text`),text:M}).annotate({identifier:`TextPart`}),hh=D({...fh.fields,type:C(`reasoning`),text:M}).annotate({identifier:`ReasoningPart`}),gh=D({...fh.fields,type:C(`file`),mediaType:M,fileName:A(M),data:w([M,Qr,nr])}).annotate({identifier:`FilePart`}),_h=D({...fh.fields,type:C(`tool-call`),id:M,name:M,params:vr,providerExecuted:tn.pipe(Ee(j(!1)))}).annotate({identifier:`ToolCallPart`}),vh=D({...fh.fields,type:C(`tool-result`),id:M,name:M,isFailure:tn,result:vr}).annotate({identifier:`ToolResultPart`}),yh=D({...fh.fields,type:C(`tool-approval-response`),approvalId:M,approved:tn,reason:A(M)}).annotate({identifier:`ToolApprovalResponsePart`}),bh=D({...fh.fields,type:C(`tool-approval-request`),approvalId:M,toolCallId:M}).annotate({identifier:`ToolApprovalRequestPart`}),xh=`~effect/ai/Prompt/Message`,Sh=D({[xh]:C(xh).pipe(Re(j(xh),{encodingStrategy:`omit`})),options:uh.pipe(Ee(j({})))}),Ch=M.pipe(Ca(wt(Ct(mh)),Sn({decode:e=>$n(ph(`text`,{text:e})),encode:e=>e[0].text}))),wh=D({...Sh.fields,role:C(`system`),content:M}).annotate({identifier:`SystemMessage`}),Th=w([wh,D({...Sh.fields,role:C(`user`),content:w([Ch,g(w([mh,gh]))])}).annotate({identifier:`UserMessage`}),D({...Sh.fields,role:C(`assistant`),content:w([Ch,g(w([mh,gh,hh,_h,vh,bh]))])}).annotate({identifier:`AssistantMessage`}),D({...Sh.fields,role:C(`tool`),content:g(w([vh,yh]))}).annotate({identifier:`ToolMessage`})]),Eh=class extends Hn()(`AiError`,{cause:A(y),message:M}){};D({state:S([`idle`,`running`,`retrying`,`stopping`,`awaiting_input`,`error`]),updatedAt:sn});var Dh=S([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`]),Oh=S([`pi`]),kh=S([`openai-codex`]),Ah=S([`gpt-5.5`]);D({messages:g(Th),model:Ah,provider:kh,thinkingLevel:A(Dh)}),D({agent:Oh,cwd:M,systemPrompt:wh});var jh=class extends Hn()(`GitError`,{cause:A(y),message:A(M)}){},Mh=S([`added`,`deleted`,`modified`,`renamed`]),Nh=D({filePath:M,fingerprint:M,id:M,type:S([`commit`,`worktree`])}),Ph=D({fileContent:A(M),filePath:M,patch:M,segments:g(Nh),status:Mh}),Fh=vi(`changes`,{}),Ih=vi(`local`,{}),Lh=vi(`branch`,{}),Rh=vi(`commit`,{hash:M}),zh=w([Fh,Ih,Lh,Rh]),Bh=D({hash:M,shortHash:M,subject:M}),Vh=D({url:M}),Hh=D({branchCommits:g(Bh),dirty:tn,localCommits:g(Bh),prUrl:A(M),unpushedCommits:tn,upstream:A(D({ahead:T,behind:T}))}),Uh=D({filePath:M,fingerprint:M,segmentId:M}),Wh=D({body:M,filePath:M,lineNumber:T,resolved:tn,side:A(S([`additions`,`deletions`])),source:A(S([`local`,`github`])),threadId:A(M),url:A(M)}),Gh=D({comments:g(Wh),marks:g(Uh)}),Kh=D({gitDirectory:M,root:M}),qh=D({branches:g(D({name:M,remote:A(M),type:S([`local`,`remote`])})),defaultBranch:M}),Jh=vi(`local`,{}),Yh=vi(`remote`,{remote:M}),Xh=vi(`new`,{}),Zh=w([Jh,Yh,Xh]),Qh=D({repository:Kh,worktrees:g(D({branch:A(M),root:M}))});function $h(e){return Bi(e.segments,e=>Uh.make({filePath:e.filePath,fingerprint:e.fingerprint,segmentId:e.id}))}function eg(e,t){let n=_n(e,e=>en(t,e));return ur(e)||ur(n)?`unchecked`:zn(n)===zn(e)?`checked`:`indeterminate`}var tg=class extends Hn()(`OsError`,{cause:A(y),message:A(M)}){},ng=D({cpu:T,memory:T,nodeHeap:T}),rg=D({state:S([`idle`,`prepared`,`running`,`stopped`,`exited`,`failed`])}),ig=D({baseOrigin:A(M),command:A(M),cwd:M,env:di(M,M),origin:A(M),packageName:A(M),portless:tn,scriptName:A(M),sessionId:M,taskId:M}),ag=D({origin:D({base:A(M),host:M,origin:M,port:T,sessionId:M,taskId:M}),script:ig,status:rg});D({deslop:A(D({portless:A(g(M))})),name:A(M),scripts:A(di(M,M))});var og=class extends Hn()(`TerminalError`,{cause:A(y),message:A(M)}){},sg=D({state:S([`idle`,`starting`,`running`,`waiting`,`stopped`,`exited`,`failed`]),title:M});function cg(e){return e===`idle`||e===`starting`||e===`running`||e===`waiting`}D({cols:T,rows:T});var lg=w([D({data:M,type:C(`text`)}),D({data:ta,type:C(`bytes`)})]),ug=w([D({sequence:T,type:C(`reset`)}),D({data:M,sequence:T,type:C(`output`)})]),dg=D({cwd:M}),fg={args:A(g(M)),command:A(M),cwd:M,env:A(di(M,M)),sessionId:A(M)},pg=D(fg),mg=D(sg.fields),hg=D({args:g(M),command:M,cwd:M,icon:oh,label:M,profileId:oh,state:mg,uuid:M}),gg=D({icon:oh,id:oh,label:M}),_g=D({command:M,scriptName:M,sessionId:M,taskId:M});D({scripts:di(M,M).pipe(A,Ee(j({})))});var vg=D({agents:g(hg),branch:A(M),portlessRuns:g(ag),root:M,runStatuses:di(M,mg),scriptRuns:g(_g)}),yg=D({repository:Qh.fields.repository,worktrees:g(vg)}),bg=D({agentProfiles:g(gg),projects:g(yg)}),xg=w([jh,Eh]),Sg=class extends ih(L(`agents.create`,{error:og,payload:D({cwd:M,provider:oh}),success:hg}),L(`agents.profiles`,{error:ah,success:g(gg)}),L(`agents.remove`,{error:og,payload:D({cwd:M,uuid:M})}),L(`agents`,{error:og,payload:dg,stream:!0,success:g(hg)}),L(`home.sidebar`,{error:w([jh,og,Eh]),stream:!0,success:bg}),L(`projects`,{error:jh,stream:!0,success:g(Qh)}),L(`projects.branches`,{error:jh,payload:dg,success:qh}),L(`review.metadata`,{error:jh,payload:dg,stream:!0,success:Hh}),L(`review.diffs`,{error:jh,payload:D({cwd:M,target:zh}),stream:!0,success:g(Ph)}),L(`review.state`,{error:jh,payload:dg,stream:!0,success:Gh}),L(`review.state.mark`,{error:jh,payload:D({cwd:M,marks:g(Uh)})}),L(`review.state.unmark`,{error:jh,payload:D({cwd:M,marks:g(Uh)})}),L(`review.comments.save`,{error:jh,payload:D({comment:Wh,cwd:M})}),L(`review.comments.resolve`,{error:jh,payload:D({cwd:M,filePath:M,lineNumber:T,side:A(S([`additions`,`deletions`])),threadId:A(M)})}),L(`publish.approve`,{error:jh,payload:D({cwd:M,message:M}),success:A(Vh)}),L(`publish.message.generate`,{error:xg,payload:dg,success:M}),L(`projects.createWorktree`,{error:jh,payload:D({branch:M,cwd:M,source:Zh}),success:M}),L(`projects.deleteWorktree`,{error:jh,payload:dg}),L(`projects.fix`,{error:jh,payload:dg}),L(`runs.portless`,{error:og,payload:dg,success:g(ag)}),L(`runs.scripts`,{error:og,payload:dg,success:g(_g)}),L(`terminal.write`,{error:og,payload:D({...fg,data:lg})}),L(`terminal.resize`,{error:og,payload:D({...fg,cols:T,rows:T})}),L(`terminal.restart`,{error:og,payload:pg,success:sg}),L(`terminal.status`,{error:og,payload:pg,stream:!0,success:sg}),L(`terminal.stop`,{error:og,payload:pg,success:sg}),L(`terminal.attach`,{error:og,payload:D({...fg,cols:A(T),rows:A(T)}),stream:!0,success:ug}),L(`usage`,{error:ah,payload:D({provider:oh}),stream:!0,success:lh}),L(`usage.subscription`,{error:ah,payload:D({provider:oh}),success:sh}),L(`usage.system`,{error:tg,stream:!0,success:ng})){},Cg=`1.9.1`,wg=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Tg(e){let t=new Set([e]),n=new Set,r=e.match(wg);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(wg);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 Eg=Tg(Cg),Dg=Cg.split(`.`)[0],Og=Symbol.for(`opentelemetry.js.api.${Dg}`),kg=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{};function Ag(e,t,n,r=!1){let i=kg[Og]=kg[Og]??{version:Cg};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${Cg}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Cg}.`),!0}function jg(e){let t=kg[Og]?.version;if(!(!t||!Eg(t)))return kg[Og]?.[e]}function Mg(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Cg}.`);let n=kg[Og];n&&delete n[e]}var Ng=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Pg(`debug`,this._namespace,e)}error(...e){return Pg(`error`,this._namespace,e)}info(...e){return Pg(`info`,this._namespace,e)}warn(...e){return Pg(`warn`,this._namespace,e)}verbose(...e){return Pg(`verbose`,this._namespace,e)}};function Pg(e,t,n){let r=jg(`diag`);if(r)return r[e](t,...n)}var Fg;(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`})(Fg||={});function Ig(e,t){e<Fg.NONE?e=Fg.NONE:e>Fg.ALL&&(e=Fg.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,Fg.ERROR),warn:n(`warn`,Fg.WARN),info:n(`info`,Fg.INFO),debug:n(`debug`,Fg.DEBUG),verbose:n(`verbose`,Fg.VERBOSE)}}var Lg=`diag`,Rg=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=jg(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:Fg.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=jg(`diag`),i=Ig(n.logLevel??Fg.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 Ag(`diag`,i,t,!0)},t.disable=()=>{Mg(Lg,t)},t.createComponentLogger=e=>new Ng(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}},zg=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}},Bg=Symbol(`BaggageEntryMetadata`),Vg=Rg.instance();function Hg(e={}){return new zg(new Map(Object.entries(e)))}function Ug(e){return typeof e!=`string`&&(Vg.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:Bg,toString(){return e}}}function Wg(e){return Symbol.for(e)}var Gg=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}}},Kg=class{constructor(){}createGauge(e,t){return i_}createHistogram(e,t){return a_}createCounter(e,t){return r_}createUpDownCounter(e,t){return o_}createObservableGauge(e,t){return c_}createObservableCounter(e,t){return s_}createObservableUpDownCounter(e,t){return l_}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},qg=class{},Jg=class extends qg{add(e,t){}},Yg=class extends qg{add(e,t){}},Xg=class extends qg{record(e,t){}},Zg=class extends qg{record(e,t){}},Qg=class{addCallback(e){}removeCallback(e){}},$g=class extends Qg{},e_=class extends Qg{},t_=class extends Qg{},n_=new Kg,r_=new Jg,i_=new Xg,a_=new Zg,o_=new Yg,s_=new $g,c_=new e_,l_=new t_;function u_(){return n_}var d_;(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(d_||={});var f_={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},p_={set(e,t,n){e!=null&&(e[t]=n)}},m_=class{active(){return Gg}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}},h_=`context`,g_=new m_,__=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return Ag(h_,e,Rg.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 jg(h_)||g_}disable(){this._getContextManager().disable(),Mg(h_,Rg.instance())}},v_;(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(v_||={});var y_={traceId:`00000000000000000000000000000000`,spanId:`0000000000000000`,traceFlags:v_.NONE},b_=class{constructor(e=y_){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){}},x_=Wg(`OpenTelemetry Context Key SPAN`);function S_(e){return e.getValue(x_)||void 0}function C_(){return S_(__.getInstance().active())}function w_(e,t){return e.setValue(x_,t)}function T_(e){return e.deleteValue(x_)}function E_(e,t){return w_(e,new b_(t))}function D_(e){return S_(e)?.spanContext()}var O_=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 k_(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(O_[e.charCodeAt(t)]|0)+(O_[e.charCodeAt(t+1)]|0)+(O_[e.charCodeAt(t+2)]|0)+(O_[e.charCodeAt(t+3)]|0);return n===t}function A_(e){return k_(e,32)&&e!==`00000000000000000000000000000000`}function j_(e){return k_(e,16)&&e!==`0000000000000000`}function M_(e){return A_(e.traceId)&&j_(e.spanId)}function N_(e){return new b_(e)}var P_=__.getInstance(),F_=class{startSpan(e,t,n=P_.active()){if(t?.root)return new b_;let r=n&&D_(n);return I_(r)&&M_(r)?new b_(r):new b_}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??P_.active(),c=this.startSpan(e,i,s),l=w_(s,c);return P_.with(l,o,void 0,c)}};function I_(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 L_=new F_,R_=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):L_}},z_=new class{getTracer(e,t,n){return new F_}},B_=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new R_(this,e,t,n)}getDelegate(){return this._delegate??z_}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}},V_;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(V_||={});var H_;(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`})(H_||={});var U_;(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(U_||={});var W_=__.getInstance(),Z=Rg.instance(),G_=class{inject(e,t){}extract(e,t){return e}fields(){return[]}},K_=Wg(`OpenTelemetry Baggage Key`);function q_(e){return e.getValue(K_)||void 0}function J_(){return q_(__.getInstance().active())}function Y_(e,t){return e.setValue(K_,t)}function X_(e){return e.deleteValue(K_)}var Z_=`propagation`,Q_=new G_,$_=class e{constructor(){this.createBaggage=Hg,this.getBaggage=q_,this.getActiveBaggage=J_,this.setBaggage=Y_,this.deleteBaggage=X_}static getInstance(){return this._instance||=new e,this._instance}setGlobalPropagator(e){return Ag(Z_,e,Rg.instance())}inject(e,t,n=p_){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=f_){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){Mg(Z_,Rg.instance())}_getGlobalPropagator(){return jg(Z_)||Q_}}.getInstance(),ev=`trace`,Q=class e{constructor(){this._proxyTracerProvider=new B_,this.wrapSpanContext=N_,this.isSpanContextValid=M_,this.deleteSpan=T_,this.getSpan=S_,this.getActiveSpan=C_,this.getSpanContext=D_,this.setSpan=w_,this.setSpanContext=E_}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=Ag(ev,this._proxyTracerProvider,Rg.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return jg(ev)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Mg(ev,Rg.instance()),this._proxyTracerProvider=new B_}}.getInstance(),tv=Wg(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function nv(e){return e.setValue(tv,!0)}function rv(e){return e.getValue(tv)===!0}var iv=`baggage`,av=4096;function ov(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function sv(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 cv(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=Ug(e.substring(t+1))),{key:o,value:s,metadata:c}}function lv(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=cv(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 uv=class{inject(e,t,n){let r=$_.getBaggage(e);if(!r||rv(e))return;let i=ov(sv(r).filter(e=>e.length<=av).slice(0,180));i.length>0&&n.set(t,iv,i)}extract(e,t,n){let r=n.get(t,iv);if(!r)return e;let i={},a=0,o=0;if(Array.isArray(r))for(let e=0;e<r.length;e++)[a,o]=lv(r[e],i,a,o);else[a]=lv(r,i,a,o);return a===0?e:$_.setBaggage(e,$_.createBaggage(i))}fields(){return[iv]}};function dv(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!fv(n)){Z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!pv(r)){Z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function fv(e){return typeof e==`string`&&e!==``}function pv(e){return e==null?!0:Array.isArray(e)?mv(e):hv(typeof e)}function mv(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(hv(e)){t=e;continue}return!1}return!1}}return!0}function hv(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}function gv(){return e=>{Z.error(_v(e))}}function _v(e){return typeof e==`string`?e:JSON.stringify(vv(e))}function vv(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 yv=gv();function bv(e){try{yv(e)}catch{}}var xv=`2.8.0`,Sv=`exception.message`,Cv=`exception.stacktrace`,wv=`exception.type`,Tv=`service.name`,Ev=`service.version`,Dv=`telemetry.sdk.language`,Ov=`nodejs`,kv=`webjs`,Av=`telemetry.sdk.name`,jv=`telemetry.sdk.version`,Mv=`process.runtime.name`,Nv={[Av]:`opentelemetry`,[Mv]:`browser`,[Dv]:kv,[jv]:xv},Pv=performance,Fv=9,Iv=10**6,Lv=10**Fv;function Rv(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Iv)]}function zv(e){return Gv(Rv(Pv.timeOrigin),Rv(typeof e==`number`?e:Pv.now()))}function Bv(e){if(Uv(e))return e;if(typeof e==`number`)return e<Pv.timeOrigin?zv(e):Rv(e);if(e instanceof Date)return Rv(e.getTime());throw TypeError(`Invalid input type`)}function Vv(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Lv),[n,r]}function Hv(e){return e[0]*Lv+e[1]}function Uv(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Wv(e){return Uv(e)||typeof e==`number`||e instanceof Date}function Gv(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Lv&&(n[1]-=Lv,n[0]+=1),n}var Kv;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(Kv||={});var qv=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()}},Jv=`[_0-9a-z-*/]`,Yv=RegExp(`^(?:${`[a-z]${Jv}{0,255}`}|${`[a-z0-9]${Jv}{0,240}@[a-z]${Jv}{0,13}`})$`),Xv=/^[ -~]{0,255}[!-~]$/,Zv=/,|=/;function Qv(e){return Yv.test(e)}function $v(e){return Xv.test(e)&&!Zv.test(e)}var ey=32,ty=512,ny=`,`,ry=`=`,iy=class e{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!Qv(e)||!$v(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>ty)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=ny+e),e=`${n[0]}${ry}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(ny),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(ry);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!Qv(a)||!$v(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>ty)&&(t.set(a,o),n=s,t.size>=ey))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}},ay=`traceparent`,oy=`tracestate`,sy=`00`,cy=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`);function ly(e){let t=cy.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var uy=class{inject(e,t,n){let r=Q.getSpanContext(e);if(!r||rv(e)||!M_(r))return;let i=`${sy}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||v_.NONE).toString(16)}`;n.set(t,ay,i),r.traceState&&n.set(t,oy,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,ay);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=ly(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,oy);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new iy(typeof e==`string`?e:void 0)}return Q.setSpanContext(e,a)}fields(){return[ay,oy]}},dy=`[object Object]`,fy=`[object Null]`,py=`[object Undefined]`,my=Function.prototype.toString,hy=my.call(Object),gy=Object.getPrototypeOf,_y=Object.prototype,vy=_y.hasOwnProperty,yy=Symbol?Symbol.toStringTag:void 0,by=_y.toString;function xy(e){if(!Sy(e)||Cy(e)!==dy)return!1;let t=gy(e);if(t===null)return!0;let n=vy.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&my.call(n)===hy}function Sy(e){return typeof e==`object`&&!!e}function Cy(e){return e==null?e===void 0?py:fy:yy&&yy in Object(e)?wy(e):Ty(e)}function wy(e){let t=vy.call(e,yy),n=e[yy],r=!1;try{e[yy]=void 0,r=!0}catch{}let i=by.call(e);return r&&(t?e[yy]=n:delete e[yy]),i}function Ty(e){return by.call(e)}var Ey=20;function Dy(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ky(t,e.shift(),0,n);return t}function Oy(e){return jy(e)?e.slice():e}function ky(e,t,n=0,r){let i;if(!(n>Ey)){if(n++,Py(e)||Py(t)||My(t))i=Oy(t);else if(jy(e)){if(i=e.slice(),jy(t))for(let e=0,n=t.length;e<n;e++)i.push(Oy(t[e]));else if(Ny(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]=Oy(t[r]))}}}else if(Ny(e))if(Ny(t)){if(!Fy(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(Py(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Ay(e,s,r)||Ay(t,s,r))delete i[s];else{if(Ny(a)&&Ny(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]=ky(i[s],c,n,r)}}}}else i=t;return i}}function Ay(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 jy(e){return Array.isArray(e)}function My(e){return typeof e==`function`}function Ny(e){return!Py(e)&&!jy(e)&&!My(e)&&typeof e==`object`}function Py(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Fy(e,t){return!(!xy(e)||!xy(t))}var Iy=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Ly(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Iy(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var Ry=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)}},zy=class{_isCalled=!1;_deferred=new Ry;_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 By(e,t){return new Promise(n=>{W_.with(nv(W_.active()),()=>{e.export(t,n)})})}var Vy={_export:By},Hy;function Uy(){if(Hy===void 0)try{let e=globalThis.process.argv0;Hy=e?`unknown_service:${e}`:`unknown_service`}catch{Hy=`unknown_service`}return Hy}var Wy=e=>typeof e==`object`&&!!e&&typeof e.then==`function`,Gy=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Jy(t),r._asyncAttributesPending=t.filter(([e,t])=>Wy(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Wy(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Jy(this._rawAttributes),this._schemaUrl=Yy(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,Wy(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(Wy(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=Xy(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function Ky(e,t){return Gy.FromAttributeList(Object.entries(e),t)}function qy(){return Ky({[Tv]:Uy(),[Dv]:Nv[Dv],[Av]:Nv[Av],[jv]:Nv[jv]})}function Jy(e){return e.map(([e,t])=>Wy(t)?[e,t.catch(t=>{Z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Yy(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 Xy(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 Zy=`exception`,Qy=Symbol.for(`nodejs.util.inspect.custom`);function $y(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??=r);return t}function eb(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 tb=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:U_.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=Pv.now(),this._performanceOffset=t-(this._performanceStartTime+Pv.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(!pv(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++),Wv(t)&&(Wv(n)||(n=t),t=void 0);let i=dv(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=dv(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===U_.UNSET||this.status.code===U_.OK)return this;let t={code:e.code};return e.code===U_.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=Vv(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<=Pv.now())return zv(e+this._performanceOffset);if(typeof e==`number`)return Rv(e);if(e instanceof Date)return Rv(e.getTime());if(Uv(e))return e;if(this._startTimeProvided)return Rv(Date.now());let t=Pv.now()-this._performanceStartTime;return Gv(this.startTime,Rv(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Sv]=e:e&&(e.code?n[wv]=e.code.toString():e.name&&(n[wv]=e.name),e.message&&(n[Sv]=e.message),e.stack&&(n[Cv]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Zy,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}[Qy](e,t,n){return eb(`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:$y(this.resource)}},e,t,n)}},nb;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(nb||={});var rb=class{shouldSample(){return{decision:nb.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},ib=class{shouldSample(){return{decision:nb.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}},ab=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(bv(Error(`ParentBasedSampler must have a root sampler configured`)),new ib),this._remoteParentSampled=e.remoteParentSampled??new ib,this._remoteParentNotSampled=e.remoteParentNotSampled??new rb,this._localParentSampled=e.localParentSampled??new ib,this._localParentNotSampled=e.localParentNotSampled??new rb}shouldSample(e,t,n,r,i,a){let o=Q.getSpanContext(e);return!o||!M_(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&v_.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&v_.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()}}`}},ob=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:A_(t)&&this._accumulate(t)<this._upperBound?nb.RECORD_AND_SAMPLED:nb.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}},sb;(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`})(sb||={});var cb=1;function lb(){return{sampler:ub(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function ub(){let e=sb.ParentBasedAlwaysOn;switch(e){case sb.AlwaysOn:return new ib;case sb.AlwaysOff:return new rb;case sb.ParentBasedAlwaysOn:return new ab({root:new ib});case sb.ParentBasedAlwaysOff:return new ab({root:new rb});case sb.TraceIdRatio:return new ob(db());case sb.ParentBasedTraceIdRatio:return new ab({root:new ob(db())});default:return Z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${sb.ParentBasedAlwaysOn}".`),new ab({root:new ib})}}function db(){return Z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${cb}.`),cb}function fb(e){let t={sampler:ub()},n=lb(),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 pb(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 mb=16,hb=8,gb=new Uint8Array(mb),_b=new Uint8Array(hb),vb=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function yb(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 bb(e){let t=``;for(let n=0;n<e.length;n++)t+=vb[e[n]];return t}var xb=class{generateTraceId(){return yb(gb),bb(gb)}generateSpanId(){return yb(_b),bb(_b)}},Sb=`otel.span.parent.origin`,Cb=`otel.span.sampling_result`,wb=`otel.sdk.span.live`,Tb=`otel.sdk.span.started`,Eb=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(Tb,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(wb,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Ob(t);if(this.startedSpans.add(1,{[Sb]:Db(e),[Cb]:n}),t===nb.NOT_RECORD)return()=>{};let r={[Cb]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Db(e){return e?e.isRemote?`remote`:`local`:`none`}function Ob(e){switch(e){case nb.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case nb.RECORD:return`RECORD_ONLY`;case nb.NOT_RECORD:return`DROP`}}var kb=`2.8.0`,Ab=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=fb(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new xb,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,kb):u_();this._tracerMetrics=new Eb(a)}startSpan(e,t={},n=W_.active()){t.root&&(n=Q.deleteSpan(n));let r=Q.getSpan(n);if(rv(n))return Z.debug(`Instrumentation suppressed, returning Noop Span`),Q.wrapSpanContext(y_);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??H_.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:dv(e.attributes)})),d=dv(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===V_.RECORD_AND_SAMPLED?v_.SAMPLED:v_.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===V_.NOT_RECORD)return Z.debug(`Recording is off, propagating context in a non-recording span`),Q.wrapSpanContext(h);let g=dv(Object.assign(d,f.attributes));return new tb({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??W_.active(),c=this.startSpan(e,i,s),l=Q.setSpan(s,c);return W_.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}[Qy](e,t,n){return eb(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:$y(this._resource)},spanLimits:this._spanLimits,generalLimits:this._generalLimits},e,t,n)}},jb=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=>{bv(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)})}},Mb;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Mb||={});var Nb=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=Dy({},lb(),pb(e));this._resource=t.resource??qy(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new jb(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Ab({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=Mb.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Mb.timeout&&(r=Mb.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Mb.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Mb.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Qy](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return eb(`BasicTracerProvider`,{resource:{attributes:$y(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Pb=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new zy(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&v_.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>bv(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Vy._export(this._exporter,[e]);if(t.code!==Kv.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},Fb=class{_enabled=!1;_currentContext=Gg;_bindFunction(e=Gg,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=Gg,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=Gg,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||Gg;try{return t.call(n,...r)}finally{this._currentContext=i}}};function Ib(e){if(e!==null){if(e===void 0){let e=new Fb;e.enable(),W_.setGlobalContextManager(e);return}e.enable(),W_.setGlobalContextManager(e)}}function Lb(e){if(e!==null){if(e===void 0){$_.setGlobalPropagator(new qv({propagators:[new uy,new uv]}));return}$_.setGlobalPropagator(e)}}var Rb=class extends Nb{constructor(e={}){super(e)}register(e={}){Q.setGlobalTracerProvider(this),Lb(e.propagator),Ib(e.contextManager)}},zb=e=>e!==void 0&&!(Array.isArray(e)&&e.length===0),Bb;(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`})(Bb||={});var Vb=new class{emit(e){}enabled(){return!1}};function Hb(){return Vb}function Ub(e){return Wb(e,new WeakSet)}function Wb(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(!Wb(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)&&!Wb(n[e],t))return!1;return!0}return!1}var Gb;(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`})(Gb||={});function Kb(e,t,n,r,i){if(r.length===0)return Z.warn(`Invalid attribute key: ${r}`),Gb.DROP_INVALID;if(!Ub(i))return Z.warn(`Invalid attribute value set for key: ${r}`),Gb.DROP_INVALID;let a=!Object.prototype.hasOwnProperty.call(e,r);return a&&n>=t.attributeCountLimit?Gb.DROP_LIMIT_REACHED:(e[r]=qb(i,t.attributeValueLengthLimit),a?Gb.ADD_NEW:Gb.ADD_OVERWRITE_EXISTING)}function qb(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=>qb(e,t));if(typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))n[r]=qb(i,t);return n}return e}function Jb(e,t){if(t==null)return{};let n={},r=0,i=0;for(let[a,o]of Object.entries(t)){let t=Kb(n,e,r,a,o);t===Gb.ADD_NEW?r+=1:(t===Gb.DROP_INVALID||t===Gb.DROP_LIMIT_REACHED)&&(i+=1)}return{attributes:r>0?n:void 0,droppedAttributesCount:i}}var Yb=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=Bv(r??f),this.hrTimeObserved=Bv(i??f),d){let e=Q.getSpanContext(d);e&&M_(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=Kb(this.attributes,this._logRecordLimits,this._attributesCount,e,t);return n===Gb.DROP_LIMIT_REACHED?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&Z.warn(`Dropping extra attributes.`)):n===Gb.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(Sv,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(wv,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(wv,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Sv,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Cv,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}},Xb=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||W_.active();if(!this.enabled(e))return;let n=new Yb(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!==Bb.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||W_.active();if(t.traceBased){let e=Q.getSpanContext(r);if(e&&M_(e)&&(e.traceFlags&v_.SAMPLED)!==v_.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}},Zb=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}},Qb=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=>Ly(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 $b(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($b)]:[`map`,Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,$b(t)])]}function ex(e){return JSON.stringify([e.name,e.version||``,e.schemaUrl||``,$b(e.attributes),e.droppedAttributesCount??0])}var tx=`otel.sdk.log.created`,nx=class{createdLogs;constructor(e){this.createdLogs=e.createCounter(tx,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},rx=`0.219.0`,ix={disabled:!1,minimumSeverity:Bb.UNSPECIFIED,traceBased:!1},ax=()=>({...ix}),ox=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 Qb(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Zb,this._loggerConfigurator=i??ax;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,rx):u_();this.loggerMetrics=new nx(o)}getLoggerConfig(e){let t=ex(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}},sx=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??qy(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??ax,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new ox(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new zy(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return Z.warn(`A shutdown LoggerProvider cannot provide a Logger`),Hb();e||Z.warn(`Logger requested without instrumentation scope name.`);let r={name:e||`unknown`,version:t,schemaUrl:n?.schemaUrl,...Jb(this._sharedState.logRecordLimits,n?.attributes)},i=ex(r);return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Xb(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()}},cx=cn,lx=In,ux=(e,t)=>xn(cx,bn(Mi(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(cn):[]);for(let t of e)r.add(Ue(t)?yield*t:t);return r}))),dx=BigInt(1e9),fx=e=>[Number(e/dx),Number(e%dx)],px=e=>{let t={};for(let[n,r]of Object.entries(e))t[n]=mx(r);return t},mx=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`bigint`?e.toString():fr(e),hx=class extends k()(`@effect/opentelemetry/Resource`){},gx=e=>Mr(hx,Ky(_x(e))),_x=e=>{let t={...e.attributes??void 0,[Tv]:e.serviceName,[Av]:`@effect/opentelemetry`,[Dv]:globalThis.document===void 0?Ov:kv};return e.serviceVersion&&(t[Ev]=e.serviceVersion),t},vx=class extends k()(`@effect/opentelemetry/Logger/OtelLoggerProvider`){},yx=e=>{switch(e){case`Trace`:return Bb.TRACE;case`Debug`:return Bb.DEBUG;case`Info`:return Bb.INFO;case`Warn`:return Bb.WARN;case`Error`:return Bb.ERROR;case`Fatal`:return Bb.FATAL;default:return Bb.UNSPECIFIED}},bx=Ur(function*(){let e=yield*vx,t=yield*ji,n=e.getLogger(`@effect/opentelemetry`);return lx(e=>{let r={fiberId:e.fiber.id},i=st(e.fiber.context,Tr);Pn(i)&&(r.spanId=i.spanId,r.traceId=i.traceId);for(let[t,n]of Object.entries(e.fiber.getRef(bi)))r[t]=mx(n);let a=e.date.getTime();for(let[t,n]of e.fiber.getRef(ei))r[`logSpan.${t}`]=`${a-n}ms`;let o=Be(e.message).map(mx),s=fx(t.currentTimeNanosUnsafe());n.emit({body:o.length===1?o[0]:o,severityText:e.logLevel,severityNumber:yx(e.logLevel),timestamp:s,observedTimestamp:s,attributes:r})})}),xx=e=>ux([bx],{mergeWithExisting:e.mergeWithExisting??!0}),Sx=(e,t)=>xn(vx,Ur(function*(){let n=yield*hx;return yield*si(E(()=>new sx({...t??void 0,processors:Be(e),resource:n})),e=>Je(()=>e.forceFlush().then(()=>e.shutdown())).pipe(d,nt,Cr(t?.shutdownTimeout??3e3)))})),Cx;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Cx||={});var wx;(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`})(wx||={});var Tx;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Tx||={});var Ex=`@effect/opentelemetry/Metrics`,Dx=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=kx(),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=Gr(this.context),n=kx(),r=[],i=new Map,a=e=>{r.push(e),i.set(e.descriptor.name,e)},o=this.temporality===`delta`,s=o?Cx.DELTA:Cx.CUMULATIVE,c=o?this.previousExportTimeNanos:this.startTimeNanos;for(let e=0,r=t.length;e<r;e++){let r=t[e],l=r.attributes?Qi(Object.entries(r.attributes),{},(e,[t,n])=>(e[t]=String(n),e)):{},u=Ox(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=Ax(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:Tx.SUM,descriptor:d,isMonotonic:r.state.incremental,aggregationTemporality:s,dataPoints:[f]});break}case`Gauge`:{let e=Ax(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:Tx.GAUGE,descriptor:e,aggregationTemporality:Cx.CUMULATIVE,dataPoints:[t]});break}case`Histogram`:{let e=r.state.buckets.length,t={boundaries:wa(e-1),counts:wa(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=Ax(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:Tx.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=Ax(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=Ax(r,l);a({dataPointType:Tx.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=Ax(r,l);a({dataPointType:Tx.SUM,descriptor:{...t,name:`${t.name}_quantiles`},aggregationTemporality:s,isMonotonic:!1,dataPoints:e}),a({dataPointType:Tx.SUM,descriptor:{name:`${r.id}_count`,description:r.description??``,unit:`1`,type:wx.COUNTER,valueType:d_.INT,advice:{}},aggregationTemporality:s,isMonotonic:!0,dataPoints:[f]}),a({dataPointType:Tx.SUM,descriptor:{name:`${r.id}_sum`,description:r.description??``,unit:`1`,type:wx.COUNTER,valueType:d_.DOUBLE,advice:{}},aggregationTemporality:s,isMonotonic:!0,dataPoints:[p]})}break}}}return o&&(this.previousExportTimeNanos=n),Promise.resolve({resourceMetrics:{resource:this.resource,scopeMetrics:[{scope:{name:Ex},metrics:r}]},errors:[]})}},Ox=(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)}`},kx=()=>{let e=Date.now();return[Math.floor(e/1e3),e%1e3*1e6]},Ax=(e,t)=>{let n=t.unit??t.time_unit??`1`;return{name:e.id,description:e.description??``,unit:n,type:jx(e),valueType:Mx(e),advice:{}}},jx=e=>{switch(e.type){case`Histogram`:return wx.HISTOGRAM;case`Gauge`:return wx.OBSERVABLE_GAUGE;case`Frequency`:return wx.COUNTER;case`Counter`:return e.state.incremental?wx.COUNTER:wx.UP_DOWN_COUNTER;case`Summary`:return wx.COUNTER}},Mx=e=>e.type===`Counter`?typeof e.state.count==`bigint`?d_.INT:d_.DOUBLE:e.type===`Gauge`&&typeof e.state.value==`bigint`?d_.INT:d_.DOUBLE,Nx=e=>Ur(function*(){return new Dx(yield*hx,yield*xi(),e)}),Px=(e,t,n)=>si(E(()=>{let n=t(),r=Array.isArray(n)?n:[n];return r.forEach(t=>t.setMetricProducer(e)),r}),e=>Je(()=>Promise.all(e.map(e=>e.shutdown()))).pipe(d,nt,Cr(n?.shutdownTimeout??3e3))),Fx=(e,t)=>Dn(P(Nx(t?.temporality),n=>Px(n,e,t))),Ix=class extends k()(`@effect/opentelemetry/Tracer`){},Lx=class extends k()(`@effect/opentelemetry/Tracer/OtelTracerProvider`){},Rx=class extends k()(`@effect/opentelemetry/Tracer/OtelTraceFlags`){},zx=class extends k()(`@effect/opentelemetry/Tracer/OtelTraceState`){},Bx=b(Vi(Ix),e=>na({span(t){return new Gx(W_,Q,e,t)},context(e,t){let n=t.currentSpan;return n===void 0?e[`~effect/Effect/evaluate`](t):W_.with(Qx(W_.active(),n),()=>e[`~effect/Effect/evaluate`](t))}})),Vx=xn(Ix,Ur(function*(){let e=yield*hx;return(yield*Lx).getTracer(e.attributes[Tv],e.attributes[Ev])})),Hx=xn(yr,Bx).pipe(Ni(Vx)),Ux=`~@effect/opentelemetry/Tracer/OtelSpan`,Wx={internal:H_.INTERNAL,client:H_.CLIENT,server:H_.SERVER,producer:H_.PRODUCER,consumer:H_.CONSUMER},Gx=class{[Ux];_tag=`Span`;name;kind;annotations;links;span;spanId;traceId;attributes=new Map;sampled;parent;status;constructor(e,t,n,r){this[Ux]=Ux,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:Pt(r.parent,()=>qx(t,i,r.annotations)),this.span=n.startSpan(r.name,{startTime:fx(r.startTime),links:r.links.length>0?r.links.map(e=>({context:Jx(e.span),attributes:px(e.attributes)})):void 0,kind:Wx[this.kind]},xt(this.parent)?Qx(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=Kx(a.traceFlags)}attribute(e,t){this.span.setAttribute(e,mx(t)),this.attributes.set(e,t)}addLinks(e){this.links.push(...e),this.span.addLinks(e.map(e=>({context:Jx(e.span),attributes:px(e.attributes)})))}end(e,t){let n=fx(e);if(this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime},t._tag===`Success`)this.span.setStatus({code:U_.OK});else if(Mt(t.cause))this.span.setStatus({code:U_.OK,message:rn(t.cause)}),this.span.setAttribute(`span.label`,`⚠︎ Interrupted`),this.span.setAttribute(`status.interrupted`,!0);else{let e=Me(t.cause);if(e.length>0){for(let t of e)this.span.recordException(t,n);this.span.setStatus({code:U_.ERROR,message:e[0].message})}else this.span.setStatus({code:U_.OK})}this.span.end(n)}event(e,t,n){this.span.addEvent(e,n?px(n):void 0,fx(t))}},Kx=e=>(e&v_.SAMPLED)===v_.SAMPLED,qx=(e,t,n)=>{let r=e.getSpan(t)?.spanContext();return r?Da(kn({spanId:r.spanId,traceId:r.traceId,sampled:(r.traceFlags&1)==1,annotations:n})):$e()},Jx=(e,t)=>{let n=Yx(e,t),r=Xx(e,t);return{spanId:e.spanId,traceId:e.traceId,isRemote:e._tag===`ExternalSpan`,traceFlags:n,traceState:r}},Yx=(e,t)=>{let n;return Pn(t)&&(n=Zx(e,t,Rx),Bt(n)&&(n=st(e.annotations,Rx))),n??v_.SAMPLED},Xx=(e,t)=>{let n;return Pn(t)&&(n=Zx(e,t,zx),Bt(n)&&(n=st(e.annotations,zx))),n},Zx=(e,t,n)=>{let r=st(t,n);return Pn(r)?r:st(e.annotations,n)},Qx=(e,t,n)=>t instanceof Gx?Q.setSpan(e,t.span):Q.setSpanContext(e,Jx(t,n)),$x=(e,t)=>xn(Lx,Ur(function*(){let n=yield*hx;return yield*si(E(()=>new Rb({...t??void 0,resource:n,spanProcessors:Array.isArray(e)?e:[e]})),e=>d(Je(()=>e.forceFlush().then(()=>e.shutdown()))))})),eS=e=>Ln(Ur(function*(){let t=yield*lt(e)?e:E(e),n=gx(t.resource),r=zb(t.spanProcessor)?oi(Hx,$x(t.spanProcessor,t.tracerConfig)):kt,i=zb(t.logRecordProcessor)?oi(xx({mergeWithExisting:t.loggerMergeWithExisting}),Sx(t.logRecordProcessor,t.loggerProviderConfig)):kt;return lr(r,zb(t.metricReader)?Fx(fe(t.metricReader),{temporality:t.metricTemporality}):kt,i).pipe(Ni(n))})),tS=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 nS(e,t){let n={attributes:iS(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function rS(e,t){let n={name:e.name,version:e.version};return e.attributes&&Object.keys(e.attributes).length>0&&(n.attributes=iS(e.attributes,t),n.droppedAttributesCount=e.droppedAttributesCount??0),n}function iS(e,t){return Object.keys(e).map(n=>aS(n,e[n],t))}function aS(e,t,n){return{key:e,value:oS(t,n)}}function oS(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]=oS(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:oS(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var sS=256,cS=512;function lS(e,t){let n=e&255|sS;return t&&(n|=cS),n}function uS(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:iS(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>fS(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>dS(e,t)),droppedLinksCount:e.droppedLinksCount,flags:lS(n.traceFlags,e.parentSpanContext?.isRemote)}}function dS(e,t){return{attributes:e.attributes?iS(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:lS(e.context.traceFlags,e.context.isRemote)}}function fS(e,t){return{attributes:e.attributes?iS(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function pS(e,t){return{resourceSpans:hS(e,t)}}function mS(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 hS(e,t){let n=mS(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=>uS(e,t));o.push({scope:rS(e[0].instrumentationScope,t),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=nS(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}function gS(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function _S(e){return gS(e).toString()}var vS=typeof BigInt<`u`?_S:Hv;function yS(e){return e}var bS={encodeHrTime:vS,encodeSpanContext:yS,encodeOptionalSpanContext:yS,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(``))}},xS={serializeRequest:e=>{let t=pS(e,bS);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`),{}}}},SS=5,CS=1e3,wS=5e3,TS=1.5,ES=.2;function DS(){return 2*ES*Math.random()-ES}var OS=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=SS,r=CS,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+DS()),wS),0);r*=TS;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 ${SS-n} retry attempts.`):a.status===`retryable`?Z.info(`Export failed after maximum retry attempts (${SS}).`):Z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}};function kS(e){return new OS(e.transport)}var AS=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 jS(e){return new AS(e.concurrencyLimit)}var MS=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}};function NS(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function PS(){return{handleResponse(e){e==null||!NS(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||Z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var FS=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:Kv.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:Kv.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:Kv.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:Kv.FAILED,error:e.error});return}else e.status===`retryable`?t({code:Kv.FAILED,error:e.error??new MS(`Export failed with retryable status`)}):t({code:Kv.FAILED,error:new MS(`Export failed with unknown error`)})},e=>t({code:Kv.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function IS(e,t){return new FS(e.transport,e.serializer,PS(),e.promiseHandler,t.timeout)}function LS(e,t,n){return IS({transport:n,serializer:t,promiseHandler:jS(e)},{timeout:e.timeoutMillis})}function RS(e){return e===429||e===502||e===503||e===504}function zS(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 BS=60*1024,VS=9,HS=0,US=0,WS=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=HS+a>BS,s=!o&&!(US>=VS);if(s)HS+=a,US++;else{let e=o?`size limit`:`count limit`;Z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${US} 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`}):RS(r.status)?(Z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:zS(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 KS(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&&(HS-=a,US--)}}shutdown(){}};function GS(e){return new WS(e)}function KS(e){return e instanceof TypeError&&!e.cause}function qS(e,t){return LS(e,t,kS({transport:GS(e)}))}function JS(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function YS(e){if(e!=null)return async()=>e}function XS(e,t,n){return{timeoutMillis:JS(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function ZS(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}function QS(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 $S(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,QS(await e())),Object.assign(i,r)}}function eC(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 tC(e,t,n){return{...XS(e,t,n),headers:$S(e.headers,t.headers,n.headers),url:eC(e.url)??t.url??n.url}}function nC(e,t){return{...ZS(),headers:async()=>e,url:`http://localhost:4318/`+t}}function rC(e){return typeof e.headers==`function`?e.headers:YS(e.headers)}function iC(e,t,n){return tC({url:e.url,timeoutMillis:e.timeoutMillis,headers:rC(e),concurrencyLimit:e.concurrencyLimit},{},nC(n,t))}function aC(e,t,n,r){return qS(iC(e,n,r),t)}var oC=class extends tS{constructor(e={}){super(aC(e,xS,`v1/traces`,{"Content-Type":`application/json`}))}};function sC(e){return Ln(b(wc(Ac(`VITE_OTEL_URL`)),Le({onNone:()=>kt,onSome:t=>eS(E(()=>({resource:{serviceName:e},spanProcessor:[new Pb(new oC({url:t}))]})))})))}var cC=O(kt,Ni(sC(`workbench-client`)),Ni(th),Ni(Fm),Ni(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:Sg,protocol:O(Jm({retryTransientErrors:!0}),Ni(Jf(O(Pi({base:wc(Ac(`VITE_PORTLESS_BASE_ORIGIN`)),origin:wc(Ac(`VITE_PORTLESS_ORIGIN`))}),b(e=>O(e.base,Ce(e=>{let t=new URL(e);return t.hostname=`server.${t.hostname}`,t.origin}),Pt(()=>Ce(e.origin,e=>{let t=new URL(e);return t.hostname=O(t.hostname,$t(`.`),De(1),Xr(`server`),ci(`.`)),t.origin})),Le({onNone:()=>`${location.origin}/api/rpc`,onSome:e=>`${e}/api/rpc`}))),ke))),Ni(Gf),Ni(cC))}){},lC=D({args:A(g(M)),command:A(M),cwd:M,env:A(di(M,M)),sessionId:A(M)}),uC=D({args:A(g(M)),command:A(M),cwd:M,env:A(di(M,M)),sessionId:A(M)}),dC=D({attachId:T,session:lC,size:D({cols:T,rows:T})});function fC(e){if(!Bt(e))return O(e,xa,Si(e=>e[0],on),Sr)}function pC(e){let t=fC(e.env);return{...Bt(e.args)?{}:{args:[...e.args]},...Bt(e.command)?{}:{command:e.command},cwd:e.cwd,...Bt(t)?{}:{env:t},...Bt(e.sessionId)?{}:{sessionId:e.sessionId}}}function mC(e){return pa(Ti)(pC(e))}function hC(e){return Math.abs(_r(e)).toString(36)}var gC=fu(e=>$.runtime.atom(O($,P(t=>t(`terminal.attach`,{...pC(e.session),...e.size},{asQueue:!0}))))),_C=fu(e=>lu(t=>O(t.result(gC(e),{suspendOnWaiting:!0}),b(Vs),Ws),{disableAccumulation:!0})),vC=fu(e=>$.runtime.atom(O($,b(t=>t(`terminal.status`,pC(e))),Ws),{initialValue:{state:`idle`,title:``}})),yC=fu(e=>pu($.runtime.atom(P($,t=>Oa(e)?t(`runs.portless`,{cwd:e}):j([])),{initialValue:[]}))),bC=fu(e=>Gl(t=>O(t.result(yC(e)),b(e=>O(e,Bi(e=>e.origin.origin),Yt,Si(m,on)))))),xC=pu($.runtime.atom(O($,b(e=>e(`projects`,void 0)),Ws))),SC=pu($.runtime.atom(O($,b(e=>e(`home.sidebar`,void 0)),Ws))),CC=fu(e=>pu(Gl(t=>O(t.result(xC),b(t=>{let n=dn(t,t=>gr(t.worktrees,t=>hC(t.root)===e)),r=O(n,ue(t=>dn(t.worktrees,t=>hC(t.root)===e)));return{activeProject:rt(n),activeWorktree:rt(r),projects:t}}))))),wC=fu(e=>pu(Gl(t=>O(t.result(SC),b(t=>{let n=dn(t.projects,t=>gr(t.worktrees,t=>hC(t.root)===e)),r=O(n,ue(t=>dn(t.worktrees,t=>hC(t.root)===e)));return{activeProject:rt(n),activeWorktree:rt(r),agentProfiles:t.agentProfiles,projects:t.projects}}))))),TC=fu(e=>$.runtime.atom(O($,b(t=>t(`agents`,{cwd:e})),Ws))),EC=fu(e=>pu($.runtime.atom(O($,b(t=>t(`usage`,{provider:e})),Ws)))),DC=fu(e=>pu($.runtime.atom(P($,t=>t(`usage.subscription`,{provider:e}))))),OC=pu($.runtime.atom(O($,b(e=>e(`usage.system`,void 0)),Ws)));export{Pu as A,el as B,Gh as C,$h as D,Yh as E,pu as F,Ws as H,Gl as I,_u as L,zu as M,Au as N,eg as O,fu as P,vu as R,Ih as S,Xh as T,$c as V,qh as _,TC as a,Wh as b,_C as c,vC as d,EC as f,cg as g,$ as h,wC as i,Bu as j,Fu as k,pC as l,hC as m,uC as n,bC as o,DC as p,CC as r,OC as s,dC as t,mC as u,Lh as v,Jh as w,Rh as x,Fh as y,yu as z};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-Dj-VWVHI.js","assets/compiler-runtime-CLAvuQ-D.js","assets/rolldown-runtime-QTnfLwEv.js","assets/state-CvX-YRlC.js","assets/fallbacks-f8E4aL2c.js","assets/-workbench-terminal-C3m5o50g.js"])))=>i.map(i=>d[i]);
2
+ import{Is as e,Ls as t}from"./fallbacks-f8E4aL2c.js";import{t as n}from"./preload-helper-CjdClQve.js";var r=t(`/(home)/$worktree/terminal`)({component:e(()=>n(()=>import(`./terminal-Dj-VWVHI.js`),__vite__mapDeps([0,1,2,3,4,5])),`component`)});export{r as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./compiler-runtime-CLAvuQ-D.js";import{j as n,r}from"./state-a4d_PikB.js";import{t as i}from"./terminal-BHNxWKc6.js";import{t as a}from"./-workbench-terminal-Af-sz4R6.js";var o=t(),s=e();function c(){let e=(0,o.c)(7),t=i.useParams(),c;e[0]===t.worktree?c=e[1]:(c=r(t.worktree),e[0]=t.worktree,e[1]=c);let l=n(c);if(!l.value.activeWorktree)return;let u;e[2]===l.value.activeWorktree.root?u=e[3]:(u=(0,s.jsx)(a,{session:{cwd:l.value.activeWorktree.root}}),e[2]=l.value.activeWorktree.root,e[3]=u);let d;return e[4]!==l.value.activeWorktree.root||e[5]!==u?(d=(0,s.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0`,children:u},l.value.activeWorktree.root),e[4]=l.value.activeWorktree.root,e[5]=u,e[6]=d):d=e[6],d}export{c as component};
1
+ import{n as e,t}from"./compiler-runtime-CLAvuQ-D.js";import{M as n,r}from"./state-CvX-YRlC.js";import{t as i}from"./terminal-DJzGIrES.js";import{t as a}from"./-workbench-terminal-C3m5o50g.js";var o=t(),s=e();function c(){let e=(0,o.c)(7),t=i.useParams(),c;e[0]===t.worktree?c=e[1]:(c=r(t.worktree),e[0]=t.worktree,e[1]=c);let l=n(c);if(!l.value.activeWorktree)return;let u;e[2]===l.value.activeWorktree.root?u=e[3]:(u=(0,s.jsx)(a,{session:{cwd:l.value.activeWorktree.root}}),e[2]=l.value.activeWorktree.root,e[3]=u);let d;return e[4]!==l.value.activeWorktree.root||e[5]!==u?(d=(0,s.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0`,children:u},l.value.activeWorktree.root),e[4]=l.value.activeWorktree.root,e[5]=u,e[6]=d):d=e[6],d}export{c as component};
@@ -1 +1 @@
1
- import{Ps as e}from"./fallbacks-D21cBTdH.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
1
+ import{Ps as e}from"./fallbacks-f8E4aL2c.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
@@ -6,20 +6,20 @@
6
6
 
7
7
  <title>@deslop/workbench</title>
8
8
  <link rel="icon" href="/assets/icon-CNwYPYVD.png" />
9
- <script type="module" crossorigin src="/assets/index-DW7dKhgZ.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-D53pFEJY.js"></script>
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/compiler-runtime-CLAvuQ-D.js">
12
- <link rel="modulepreload" crossorigin href="/assets/fallbacks-D21cBTdH.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/fallbacks-f8E4aL2c.js">
13
13
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-CjdClQve.js">
14
- <link rel="modulepreload" crossorigin href="/assets/route-DwWgYFyk.js">
15
- <link rel="modulepreload" crossorigin href="/assets/triangle-alert-DLHVemGQ.js">
16
- <link rel="modulepreload" crossorigin href="/assets/sonner-BKURESHO.js">
17
- <link rel="modulepreload" crossorigin href="/assets/terminal-BHNxWKc6.js">
18
- <link rel="modulepreload" crossorigin href="/assets/run-B-qmimXV.js">
19
- <link rel="modulepreload" crossorigin href="/assets/portless-3KC81g42.js">
20
- <link rel="modulepreload" crossorigin href="/assets/diff-MiGOu0DY.js">
21
- <link rel="modulepreload" crossorigin href="/assets/agent-BnkD1Glf.js">
22
- <link rel="stylesheet" crossorigin href="/assets/index-B2S_w1d1.css">
14
+ <link rel="modulepreload" crossorigin href="/assets/route-BzHtbTaZ.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/triangle-alert-llGGn6BK.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/sonner-CrB5PaMX.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/terminal-DJzGIrES.js">
18
+ <link rel="modulepreload" crossorigin href="/assets/run-CW5YhyWI.js">
19
+ <link rel="modulepreload" crossorigin href="/assets/portless-Cke08ZHX.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/diff-BDdajfz3.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/agent-BXm8Dnfe.js">
22
+ <link rel="stylesheet" crossorigin href="/assets/index-YmJ_EbaF.css">
23
23
  </head>
24
24
  <body>
25
25
  <div id="root"></div>
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
2
+ //#region ../../node_modules/.pnpm/@earendil-works+pi-ai@0.80.1_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__ws@8.21.0_zod@4.4.3/node_modules/@earendil-works/pi-ai/dist/api/github-copilot-headers.js
3
+ function inferCopilotInitiator(messages) {
4
+ const last = messages[messages.length - 1];
5
+ return last && last.role !== "user" ? "agent" : "user";
6
+ }
7
+ function hasCopilotVisionInput(messages) {
8
+ return messages.some((msg) => {
9
+ if (msg.role === "user" && Array.isArray(msg.content)) return msg.content.some((c) => c.type === "image");
10
+ if (msg.role === "toolResult" && Array.isArray(msg.content)) return msg.content.some((c) => c.type === "image");
11
+ return false;
12
+ });
13
+ }
14
+ function buildCopilotDynamicHeaders(params) {
15
+ const headers = {
16
+ "X-Initiator": inferCopilotInitiator(params.messages),
17
+ "Openai-Intent": "conversation-edits"
18
+ };
19
+ if (params.hasImages) headers["Copilot-Vision-Request"] = "true";
20
+ return headers;
21
+ }
22
+ //#endregion
23
+ export { hasCopilotVisionInput as n, buildCopilotDynamicHeaders as t };