@systemfsoftware/omp-claude-compat 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @systemfsoftware/omp-claude-compat
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The packages now publish an `/api` entry with the named handlers and constants that tests and other in-process callers import. The host entry stays the default export only, so startup still pays only for registration.
8
+
9
+ ### Patch Changes
10
+
11
+ - The peer requirements for `effect` and for the Effect test-runner integration now accept any compatible `4.0.0-rc` release, instead of demanding one exact release candidate.
12
+
13
+ Installing alongside a newer release candidate no longer reports an unmet peer dependency or resolves a second copy of `effect` into the dependency tree.
14
+
15
+ - Updated dependencies:
16
+ - @systemfsoftware/effect-cell-types@4.0.0
17
+
3
18
  ## 2.0.1
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -1,23 +1,42 @@
1
1
  # @systemfsoftware/omp-claude-compat
2
2
 
3
- OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references
3
+ Claude Code compatibility layer for Oh My Pi.
4
4
 
5
- ## Install
5
+ Allows Oh My Pi agents to seamlessly execute `.claude/settings.json` hook configurations and resolve `CLAUDE.md` `@-references`.
6
6
 
7
- ```sh
8
- pnpm add @systemfsoftware/omp-claude-compat '@effect/platform-node@catalog:' '@oh-my-pi/pi-coding-agent@catalog:' 'effect@4.0.0-rc.108'
7
+ ## Features
8
+
9
+ - **Hook Dispatcher:** Executes user-defined pre/post command lifecycle hooks from `.claude/settings.json`.
10
+ - **Instruction Injection:** Dynamically parses and injects linked markdown references directly into prompt context.
11
+ - **Non-Blocking Runtime:** Integrates with Effect's execution loop while keeping initial plugin registration instantaneous.
12
+
13
+ ## Installation
14
+
15
+ Add the extension to your Oh My Pi configuration:
16
+
17
+ ```json
18
+ {
19
+ "plugins": [
20
+ "@systemfsoftware/omp-claude-compat"
21
+ ]
22
+ }
9
23
  ```
10
24
 
11
- Those are peer dependencies: this package declares them but does not install them, so one copy is shared with the rest of your project.
25
+ Or install manually via package manager:
26
+
27
+ ```bash
28
+ pnpm add @systemfsoftware/omp-claude-compat
29
+ ```
12
30
 
13
- ## Entry points
31
+ ## How It Works
14
32
 
15
- - `@systemfsoftware/omp-claude-compat`
33
+ - **Configuration Discovery:** Automatically locates `.claude/settings.json` at project root and binds relevant hook handlers to corresponding agent lifecycle events.
34
+ - **File Reference Resolving:** Matches `@path/to/file` directives in instructions and substitutes live file contents at execution time.
16
35
 
17
- ## API
36
+ ## API Reference
18
37
 
19
- The public surface is generated from the source and versioned with the package: [`etc/omp-claude-compat.api.md`](./etc/omp-claude-compat.api.md).
38
+ The exported TypeScript definitions are published with the package: [`etc/omp-claude-compat.api.md`](./etc/omp-claude-compat.api.md).
20
39
 
21
40
  ## License
22
41
 
23
- Apache-2.0. Part of [systemfsoftware](https://github.com/systemfsoftware/systemfsoftware).
42
+ Apache-2.0
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$ as ee,$t as t,Bn as te,Co as ne,Dn as re,En as ie,Eo as ae,Fn as oe,In as se,J as ce,K as le,Kn as ue,Lo as de,Mo as fe,No as n,On as r,Po as i,Q as a,Qt as o,Rn as s,Ro as c,So as l,Tn as u,To as d,Vn as f,X as p,Y as m,Z as h,_o as g,a as _,an as v,c as y,co as b,d as x,do as S,en as C,et as w,f as T,fa as E,fo as D,go as O,ho as k,jo as A,jr as j,l as M,lo as N,n as P,nn as F,o as I,q as L,s as R,t as z,tn as B,u as V,uo as pe,wo as me,xo as he,zo as ge}from"./effect-CKgkjFOq.js";var _e=e({AsyncFiberError:()=>rt,AsyncFiberErrorTypeId:()=>tt,Done:()=>X,DoneTypeId:()=>Ke,ExceededCapacityError:()=>et,ExceededCapacityErrorTypeId:()=>$e,IllegalArgumentError:()=>Q,IllegalArgumentErrorTypeId:()=>Xe,InterruptorStackTrace:()=>ut,NoSuchElementError:()=>Ge,NoSuchElementErrorTypeId:()=>We,ReasonTypeId:()=>ve,StackTrace:()=>lt,TimeoutError:()=>Ye,TimeoutErrorTypeId:()=>qe,TypeId:()=>H,UnknownError:()=>$,UnknownErrorTypeId:()=>it,annotate:()=>ot,annotations:()=>ct,combine:()=>ke,die:()=>we,done:()=>Z,empty:()=>Ce,fail:()=>G,filterInterruptors:()=>Ve,findDefect:()=>Le,findDie:()=>Ie,findError:()=>Ne,findErrorOption:()=>Pe,findFail:()=>Me,findInterrupt:()=>ze,fromReasons:()=>W,hasDies:()=>Fe,hasFails:()=>je,hasInterrupts:()=>Re,hasInterruptsOnly:()=>K,interrupt:()=>Te,interruptors:()=>Be,isAsyncFiberError:()=>nt,isCause:()=>ye,isDieReason:()=>xe,isDone:()=>Y,isExceededCapacityError:()=>Qe,isFailReason:()=>U,isIllegalArgumentError:()=>Ze,isInterruptReason:()=>Se,isNoSuchElementError:()=>Ue,isReason:()=>be,isTimeoutError:()=>Je,isUnknownError:()=>at,makeDieReason:()=>De,makeFailReason:()=>Ee,makeInterruptReason:()=>Oe,map:()=>q,pretty:()=>J,prettyErrors:()=>He,reasonAnnotations:()=>st,squash:()=>Ae});const H=N,ve=b,ye=A,be=fe,U=de,xe=n,Se=c,W=d,Ce=ne,G=me,we=l,Te=m,Ee=e=>new k(e),De=e=>new pe(e),Oe=ue,K=r,q=h,ke=L,Ae=w,je=ie,Me=F,Ne=C,Pe=B,Fe=u,Ie=t,Le=o,Re=re,ze=v,Be=p,Ve=ce,He=ee,J=a,Ue=ge,We=g,Ge=O,Y=i,Ke=D,X=S,Z=ae,qe=V,Je=te,Ye=M,Xe=y,Ze=s,Q=R,Qe=se,$e=I,et=_,tt=P,nt=oe,rt=z,it=T,at=f,$=x,ot=he,st=j,ct=le;var lt=class extends E()(`effect/Cause/StackTrace`){},ut=class extends E()(`effect/Cause/InterruptorStackTrace`){};export{Z as a,K as c,q as d,J as f,$ as i,Y as l,X as n,G as o,Q as r,W as s,_e as t,U as u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$a as t,$i as n,$n as r,$r as i,A as a,Ai as o,An as s,Ar as c,B as ee,Bi as te,Bo as ne,Br as re,Bt as ie,C as l,Ci as ae,Cn as oe,Cr as u,Cs as d,D as se,Di as ce,Do as le,Dr as ue,E as de,Ei as fe,Er as pe,F as me,Fi as f,Fo as p,Fr as he,G as m,Gi as ge,Gn as h,Gr as _e,Gt as ve,H as ye,Hi as be,Hr as xe,Ht as Se,I as Ce,Ii as we,Ir as Te,It as g,Ji as Ee,Jn as De,Jr as Oe,Jt as ke,Ki as Ae,Kr as je,Kt as Me,L as Ne,Li as Pe,Ln as Fe,Lr as Ie,Lt as Le,M as _,Mi as Re,Mn as ze,Mr as Be,N as Ve,Na as v,Ni as He,Nn as Ue,Nr as We,O as Ge,Oi as Ke,Or as qe,Os as y,P as Je,Pi as Ye,Pn as Xe,Po as Ze,Pr as Qe,Qa as $e,Qi as et,Qn as tt,Qr as nt,R as rt,Ra as it,Ri as at,Rr as ot,Rt as st,S as ct,Si as lt,Sn as ut,Sr as dt,T as ft,Ti as pt,Tr as b,U as mt,Ui as ht,Un as gt,Ur as _t,V as vt,Vi as yt,Vo as x,Vr as bt,W as xt,Wi as St,Wn as Ct,Wr as wt,Xi as Tt,Xn as S,Xr as Et,Xt as Dt,Yi as Ot,Yn as kt,Yo as At,Yr as jt,Yt as Mt,Zi as Nt,Zn as Pt,Zr as Ft,Zt as It,_ as Lt,_a as Rt,_i as zt,_n as Bt,_r as Vt,ai as Ht,ar as Ut,as as Wt,at as Gt,b as Kt,ba as qt,bi as Jt,bn as Yt,br as Xt,bs as C,ca as Zt,ci as Qt,cn as $t,cr as en,ct as tn,da as nn,di as rn,dn as an,dr as on,dt as sn,ea as cn,ei as ln,er as un,fa as dn,fi as fn,fn as pn,fr as mn,ft as hn,g as gn,gi as _n,gn as vn,gr as yn,h as bn,ha as xn,hi as Sn,hn as Cn,hr as wn,i as Tn,ii as En,in as Dn,ir as On,it as kn,j as An,ja as jn,ji as Mn,jn as Nn,k as Pn,ki as Fn,kn as In,kr as Ln,la as Rn,li as zn,ln as Bn,lr as Vn,m as Hn,ma as Un,mi as w,mn as Wn,mr as Gn,ni as Kn,nr as qn,nt as Jn,oa as Yn,oi as Xn,on as Zn,or as Qn,ot as $n,p as er,pa as tr,pi as T,pn as nr,po as rr,pr as E,qi as ir,qr as ar,qt as or,r as sr,ri as cr,rn as lr,rr as ur,rt as dr,sa as D,si as fr,sn as O,sr as pr,st as mr,ti as hr,tr as gr,tt as k,ua as _r,ui as A,un as vr,ur as yr,ut as br,v as xr,va as Sr,vi as Cr,vn as wr,vr as Tr,w as Er,wi as Dr,wn as Or,wr as kr,x as Ar,xi as jr,xn as Mr,xr as Nr,xs as j,y as Pr,ya as Fr,yi as Ir,yn as Lr,yo as Rr,yr as zr,ys as Br,z as Vr,zi as M,zn as Hr,zr as Ur,zt as Wr}from"./effect-CKgkjFOq.js";import{a as Gr,l as Kr,s as qr}from"./Cause-C0nAfay4.js";import{a as Jr,r as Yr,s as Xr}from"./Exit-BNubcB4u.js";const Zr={"~effect/Deferred":{_A:d,_E:d},pipe(){return y(this,arguments)}},Qr=()=>{let e=Object.create(Zr);return e.resumes=void 0,e.effect=void 0,e},$r=e=>_(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),w(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),ei=j(2,(e,t)=>w(()=>ri(e,t))),ti=e=>w(()=>ni(e)),ni=e=>e.effect!==void 0,ri=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let e=0;e<n.length;e++)n[e](t)}return!0},ii=n,ai=cn,oi=hr,si=ln,ci=kr,li=Et,N=i,ui=nt,di=`~effect/Layer/MemoMap`,fi=(e,t)=>(e.observers++,Pr(Ft(t,t=>e.finalizer(t)),e.effect)),pi={"~effect/Layer":{_ROut:d,_E:d,_RIn:d},pipe(){return y(this,arguments)}},mi=e=>{let t=Object.create(pi);return t.build=e,t},hi=e=>mi((t,n)=>{let r=N(n);return E(e(t,r),e=>e._tag===`Failure`?ui(r,e):M)}),gi=e=>{let t=hi((n,r)=>n.getOrElseMemoize(t,r,e));return t},_i=(e,t,n,r)=>{let i=si(),a=Qr(),o={observers:1,effect:$r(a),finalizer:n=>T(()=>(o.observers--,o.observers===0?(e.map.delete(t),ui(i,n)):M))};return e.map.set(t,o),Ft(n,o.finalizer).pipe(O(()=>r(e,i)),E(e=>(o.effect=e,ei(a,e))))};var vi=class{get[di](){return di}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?fi(n,t):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return T(()=>this.get(e,t)||_i(this,e,t,n))}};const yi=()=>new vi,bi=e=>new vi(e);var xi=class e extends dn()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=xn(t,e);return n?bi(n):yi()}};const Si=j(3,(e,t,n)=>b(S(e.build(t,n),tr(xi,t)),xi,t)),Ci=j(2,(e,t)=>ne(n=>Si(e,xi.forkOrCreate(n.context),t))),wi=function(){return arguments.length===1?e=>Ti(Sr(arguments[0],e)):Ti(Sr(arguments[0],arguments[1]))},Ti=e=>mi(C(A(e))),Ei=function(){return arguments.length===1?e=>Di(arguments[0],e):Di(arguments[0],arguments[1])},Di=(e,t)=>Oi(S(t,t=>Sr(e,t))),Oi=e=>gi((t,n)=>ci(e,n)),ki=(e,t,n)=>{let r=N(n,`parallel`);return Wn(e,e=>e.build(t,N(r,`sequential`)),{concurrency:e.length}).pipe(S(e=>qt(...e)))},Ai=(...e)=>hi((t,n)=>ki(e,t,n)),ji=(e,t,n)=>hi((r,i)=>O(Array.isArray(t)?ki(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(u(t),S(e=>n(e,t))))),Mi=j(2,(e,t)=>ji(e,t,(e,t)=>Fr(t,e))),Ni=nn(`effect/ExecutionPlan/CurrentMetadata`,{defaultValue:C({attempt:0,stepIndex:0})}),Pi=j(2,(e,t)=>Je(e,Li,e=>t(e))),Fi=e=>e.reasons.some(Ii),Ii=e=>e._tag===`Fail`&&Kr(e.error),P=e=>{let t,n=!1;for(let r of e.reasons)Ii(r)?t??=r.error:r._tag!==`Interrupt`&&(n=!0);return t===void 0?jn(e):n?jn(qr(e.reasons.filter(e=>!Ii(e)))):it(t)},Li=e=>{let t=P(e);return v(t)?t:it(t.success.value)},Ri=e=>{let t=P(e);return v(t)?Yr(t.failure):Xr(t.success.value)},zi=j(2,(e,t)=>Ut(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=P(e);return v(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Bi=`~effect/Schedule`,F=nn(`effect/Schedule/CurrentMetadata`,{defaultValue:C({input:void 0,output:void 0,duration:_r,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Vi={[Bi]:{_Out:d,_In:d,_Env:d},pipe(){return y(this,arguments)}},Hi=e=>Wt(e,Bi),I=e=>{let t=Object.create(Vi);return t.step=e,t},L=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},Ui=e=>I(S(e,e=>{let t=L();return(n,r)=>e(t(n,r))})),R=e=>Ve(e.step,e=>A(()=>Le(e))),z=e=>k(t=>S(R(e),e=>{let n=L();return r=>T(()=>{let i=t.currentTimeMillisUnsafe();return O(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,l(fr(t),a)})})})),Wi=e=>I(S(R(e),e=>(t,n)=>zi(e(t,n),{onSuccess:e=>A([n,e[1]]),onFailure:Le,onDone:()=>Gr(n)}))),Gi=e=>B(qi,({attempt:t})=>A(t<=e)),Ki=e=>{let t=D(e);return Ui(A(e=>A([e.attempt-1,t])))},B=j(2,(e,t)=>I(S(R(e),e=>{let n=L();return(r,i)=>O(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return O(p(s)?s:A(s),t=>t?A(e):Gr(a))})}))),qi=Ki(_r),Ji=(e,t,n)=>cr(r=>O(n?.local?Si(t,yi(),r):Ci(t,r),t=>u(e,t))),Yi=j(e=>p(e[0]),(e,t,n)=>Rt(t)?u(e,t):Ji(e,Array.isArray(t)?Ai(...t):t,n)),Xi=j(3,(e,n,r)=>O(z(n),n=>{let i=F.defaultValue();return m(Cn(Sn(O(T(()=>b(e,F,i)),n),e=>w(()=>{i=e})),{disableYield:!0}),e=>Ze(e)?A(e.value):r(e,i.attempt===0?$e():t(i)))})),Zi=j(3,(e,t,n)=>O(z(t),t=>{let r=F.defaultValue(),i,a=m(T(()=>b(e,F,r)),e=>(i=e,O(t(e),e=>(r=e,a))));return Pi(a,e=>x(()=>n(i,e)))})),Qi=j(2,(e,t)=>{let n=typeof t==`function`?t(d):Hi(t)?t:H(t);return Xi(e,n,g)}),V=j(2,(e,t)=>{let n=typeof t==`function`?t(d):Hi(t)?t:H(t);return Zi(e,n,g)}),$i=j(3,(e,t,n)=>O(z(n),n=>{let r=F.defaultValue(),i=T(()=>b(e,F,r));return m(O(n(t),e=>{r=e;let t=C(O(i,n));return yt({while:Br,body:t,step(e){r=e}})}),e=>Ze(e)?A(e.value):g(e))})),ea=Wi(qi),H=e=>{let t=e.schedule?Wi(e.schedule):ea;return e.while&&(t=B(t,({input:t})=>{let n=e.while(t);return p(n)?n:A(n)})),e.until&&(t=B(t,({input:t})=>{let n=e.until(t);return p(n)?S(n,e=>!e):A(!n)})),e.times!==void 0&&(t=B(t,({attempt:t})=>A(t<=e.times))),t},ta=(e,t)=>{let n=-1,r=0,i=t=>Nn(e(t));return{begin:k(e=>T(()=>{let a=t();a.stepIndex!==n&&(n=a.stepIndex,r=0),r++;let o={attempt:a.attempt,stepAttempt:r,stepIndex:a.stepIndex,startNanos:e.monotonicTimeNanosUnsafe()};return l(i({_tag:`AttemptStart`,attempt:o.attempt,stepAttempt:o.stepAttempt,stepIndex:o.stepIndex}),o)})),end:(e,t)=>k(n=>{let r=Zt(n.monotonicTimeNanosUnsafe()-e.startNanos);return i(t._tag===`Success`?{_tag:`AttemptSuccess`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r}:{_tag:`AttemptFailure`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r,cause:t.cause})})}},na=j(e=>p(e[0]),(e,t,n)=>T(()=>{let r=0,i={attempt:0,stepIndex:0},a=pe(Ni,w(()=>(i={attempt:i.attempt+1,stepIndex:r},i))),o=n?.onEvent===void 0?void 0:ta(n.onEvent,()=>i),s=o===void 0?d:e=>Re(t=>O(o.begin,n=>E(t(e),e=>o.end(n,e)))),c;return O(yt({while:()=>r<t.steps.length&&(c===void 0||v(c)),body(){let n=t.steps[r],i=a(s(Yi(e,n.provide)));if(c){let e=!1,t=i;i=T(()=>e?t:(e=!0,ut(c))),i=V(i,ra(n,!1))}else{let e=ra(n,!0);i=e?V(i,e):i}return he(i)},step(e){c=e,r++}}),()=>ut(c))})),ra=(e,t)=>t?e.attempts===1||!(e.schedule||e.attempts)?void 0:H({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0}):H({schedule:e.schedule?e.schedule:e.attempts?void 0:ia,times:e.attempts,while:e.while}),ia=Gi(1);({...Rr});const aa=e=>e,oa=j(2,(e,t)=>{let n=t=>_(n=>{let r=ca(t,e,n,Or());return ua(t,r)});return p(t)?O(t,n):n(t)}),sa=(e,t)=>{let n=ca(t.resolver,e,t.onExit,{context:t.context,currentScheduler:Un(t.context,Yn)});return()=>la(t.resolver,n)},U=[],W=new WeakMap,ca=(e,t,n,r)=>{let i=W.get(e);i||(i=new Map,W.set(e,i));let a,o=!1,s=aa({request:t,context:r.context,uninterruptible:!1,completeUnsafe(e){o||(o=!0,n(e),a?.entrySet.delete(s))}});if(e.preCheck!==void 0&&!e.preCheck(s))return s;let c=e.batchKey(s);if(a=i.get(c),!a){if(U.length>0)a=U.pop(),a.key=c,a.resolver=e,a.map=i;else{let t={key:c,resolver:e,map:i,entrySet:new Set,entries:new Set,delayEffect:O(T(()=>t.resolver.delay),e=>da(t)),run:E(T(()=>t.resolver.runAll(Array.from(t.entries),t.key)),e=>{for(let n of t.entrySet)n.completeUnsafe(e._tag===`Success`?le(Error(`Effect.request: RequestResolver did not complete request`,{cause:n.request})):e);return t.entries.clear(),U.length<128&&(t.entrySet.clear(),t.key=void 0,t.fiber=void 0,t.resolver=void 0,t.map=void 0,U.push(t)),M})};a=t}i.set(c,a),a.fiber=Ur(r.context)(a.delayEffect,{scheduler:r.currentScheduler})}return a.entrySet.add(s),a.entries.add(s),a.resolver.collectWhile(a.entries)?s:(a.fiber.interruptUnsafe(r.id),a.fiber=Ur(r.context)(da(a),{scheduler:r.currentScheduler}),s)},la=(e,t)=>{if(t.uninterruptible)return;let n=W.get(e);if(!n)return;let r=e.batchKey(t),i=n.get(r);i&&(i.entries.delete(t),i.entrySet.delete(t),i.entries.size===0&&(n.delete(r),i.fiber?.interruptUnsafe()))},ua=(e,t)=>w(()=>la(e,t));function da(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):M}const G=j(2,(e,t)=>dr(n=>w(()=>e.updateUnsafe(t,n))));var fa=e({Do:()=>Ma,Transaction:()=>$,TypeId:()=>pa,abortSignal:()=>Js,acquireDisposable:()=>ks,acquireRelease:()=>Os,acquireUseRelease:()=>As,addFinalizer:()=>js,all:()=>ma,andThen:()=>Xa,annotateCurrentSpan:()=>sc,annotateLogs:()=>Qc,annotateLogsScoped:()=>$c,annotateSpans:()=>oc,as:()=>to,asSome:()=>no,asVoid:()=>ro,awaitAllChildren:()=>Tc,bind:()=>Fa,bindTo:()=>Na,cached:()=>zs,cachedInvalidateWithTTL:()=>Vs,cachedWithTTL:()=>Bs,callback:()=>J,catch:()=>so,catchCause:()=>mo,catchCauseFilter:()=>bo,catchCauseIf:()=>yo,catchDefect:()=>ho,catchEager:()=>bl,catchFilter:()=>_o,catchIf:()=>go,catchNoSuchElement:()=>vo,catchReason:()=>uo,catchReasons:()=>fo,catchTag:()=>co,catchTags:()=>lo,clockWith:()=>Hc,context:()=>ps,contextWith:()=>ms,currentParentSpan:()=>lc,currentSpan:()=>cc,delay:()=>Uo,die:()=>Ba,effectify:()=>fl,ensuring:()=>Ms,eventually:()=>Ao,exit:()=>Z,fail:()=>Y,failCause:()=>Ra,failCauseSync:()=>za,failSync:()=>La,fiber:()=>Ec,fiberId:()=>Dc,filter:()=>Xo,filterMap:()=>Zo,filterMapEffect:()=>Qo,filterMapOrElse:()=>es,filterMapOrFail:()=>ns,filterOrElse:()=>$o,filterOrFail:()=>ts,findFirst:()=>va,findFirstFilter:()=>ya,firstSuccessOf:()=>zo,flatMap:()=>X,flatMapEager:()=>yl,flatten:()=>Ya,flip:()=>io,fn:()=>Vc,fnUntraced:()=>Bc,fnUntracedEager:()=>xl,forEach:()=>ba,forever:()=>Ys,forkChild:()=>xc,forkDetach:()=>wc,forkIn:()=>Sc,forkScoped:()=>Cc,fromNullishOr:()=>Ja,fromOption:()=>Ka,fromResult:()=>Ga,gen:()=>Ia,head:()=>xa,ignore:()=>Po,ignoreCause:()=>Fo,interrupt:()=>Hs,interruptible:()=>Us,interruptibleMask:()=>qs,isEffect:()=>K,isFailure:()=>ds,isSuccess:()=>fs,let:()=>Pa,linkSpans:()=>fc,log:()=>Wc,logDebug:()=>Yc,logError:()=>qc,logFatal:()=>Gc,logInfo:()=>Jc,logTrace:()=>Xc,logWarning:()=>Kc,logWithLevel:()=>Uc,makeSpan:()=>pc,makeSpanScoped:()=>mc,map:()=>eo,mapBoth:()=>So,mapBothEager:()=>vl,mapEager:()=>gl,mapError:()=>xo,mapErrorEager:()=>_l,match:()=>is,matchCause:()=>os,matchCauseEager:()=>ss,matchCauseEffect:()=>ls,matchCauseEffectEager:()=>cs,matchEager:()=>as,matchEffect:()=>us,never:()=>ja,onError:()=>Ns,onErrorFilter:()=>Fs,onErrorIf:()=>Ps,onExit:()=>Q,onExitFilter:()=>Rs,onExitIf:()=>Ls,onExitPrimitive:()=>Is,onInterrupt:()=>Ws,option:()=>$a,orDie:()=>Co,orElseSucceed:()=>Ro,partition:()=>ha,promise:()=>Ca,provide:()=>hs,provideContext:()=>gs,provideService:()=>Cs,provideServiceEffect:()=>ws,race:()=>Jo,raceAll:()=>Ko,raceAllFirst:()=>qo,raceFirst:()=>Yo,reduce:()=>ga,repeat:()=>Xs,repeatOrElse:()=>Zs,replicate:()=>Qs,replicateEffect:()=>$s,request:()=>yc,requestUnsafe:()=>bc,result:()=>Qa,retry:()=>jo,retryOrElse:()=>Mo,runCallback:()=>jc,runCallbackWith:()=>Ac,runFork:()=>Oc,runForkWith:()=>kc,runPromise:()=>Mc,runPromiseExit:()=>Pc,runPromiseExitWith:()=>Fc,runPromiseWith:()=>Nc,runSync:()=>Ic,runSyncExit:()=>Rc,runSyncExitWith:()=>zc,runSyncWith:()=>Lc,sandbox:()=>No,satisfiesErrorType:()=>ml,satisfiesServicesType:()=>hl,satisfiesSuccessType:()=>pl,schedule:()=>ec,scheduleFrom:()=>tc,scope:()=>Ts,scoped:()=>Es,scopedWith:()=>Ds,service:()=>vs,serviceOption:()=>ys,setContext:()=>_s,sleep:()=>Wo,spanAnnotations:()=>uc,spanLinks:()=>dc,succeed:()=>Ta,succeedNone:()=>Ea,succeedSome:()=>Da,suspend:()=>Oa,sync:()=>ka,tap:()=>Za,tapCause:()=>Eo,tapCauseFilter:()=>Oo,tapCauseIf:()=>Do,tapDefect:()=>ko,tapError:()=>wo,tapErrorTag:()=>To,timed:()=>Go,timeout:()=>Bo,timeoutOption:()=>Vo,timeoutOrElse:()=>Ho,tracer:()=>nc,track:()=>tl,trackDefects:()=>il,trackDuration:()=>al,trackErrors:()=>rl,trackSuccesses:()=>nl,transposeOption:()=>qa,try:()=>Va,tryPromise:()=>wa,tx:()=>ol,txRetry:()=>dl,undefined:()=>Aa,uninterruptible:()=>Gs,uninterruptibleMask:()=>Ks,unwrapReason:()=>po,updateContext:()=>bs,updateService:()=>xs,updateServiceScoped:()=>Ss,useSpan:()=>hc,validate:()=>_a,void:()=>q,when:()=>rs,whileLoop:()=>Sa,withErrorReporting:()=>Lo,withExecutionPlan:()=>Io,withFiber:()=>Wa,withLogSpan:()=>el,withLogger:()=>Zc,withParentSpan:()=>vc,withSpan:()=>gc,withSpanScoped:()=>_c,withTracer:()=>rc,withTracerEnabled:()=>ic,withTracerTiming:()=>ac,yieldNow:()=>Ha,yieldNowWith:()=>Ua,zip:()=>ao,zipWith:()=>oo});const pa=rr,K=p,ma=xr,ha=Nr,ga=Be,_a=at,va=lr,ya=Dn,ba=Wn,xa=In,Sa=yt,Ca=dt,wa=Ke,Ta=A,Ea=rn,Da=fn,Oa=T,ka=w,q=M,Aa=o,J=_,ja=Vn,Ma=Tn,Na=Ge,Pa=gt,Fa=se,Ia=oe,Y=g,La=Wr,Ra=Le,za=st,Ba=tn,Va=Fn,Ha=Ot,Ua=Tt,Wa=ne,Ga=ut,Ka=Mr,qa=ce,Ja=Yt,X=O,Ya=Bn,Xa=Pr,Za=Sn,Qa=he,$a=Tr,Z=hn,eo=S,to=l,no=Er,ro=ft,io=vr,ao=Nt,oo=et,so=m,co=mt,lo=xt,uo=vt,fo=ye,po=He,mo=Ve,ho=Ce,go=Vr,_o=rt,vo=ee,yo=me,bo=Je,xo=un,So=Pt,Co=zr,wo=Jt,To=jr,Eo=_n,Do=Cr,Oo=zt,ko=Ir,Ao=sn,jo=V,Mo=Zi,No=Oe,Po=s,Fo=Nn,Io=na,Lo=be,Ro=Xt,zo=Zn,Bo=ae,Vo=Dr,Ho=pt,Uo=mr,Wo=fr,Go=lt,Ko=qe,qo=Ln,Jo=ue,Yo=c,Xo=ve,Zo=Me,Qo=or,$o=Dt,es=ke,ts=It,ns=Mt,rs=te,is=qn,as=pr,os=ur,ss=On,cs=Qn,ls=Ut,us=en,ds=Fe,fs=Hr,ps=Jn,ms=dr,hs=Yi,gs=u,_s=Xn,vs=En,ys=Ht,bs=Ye,xs=f,Ss=we,Cs=b,ws=pe,Ts=jt,Es=Kn,Ds=cr,Os=bn,ks=Hn,As=gn,js=Lt,Ms=br,Ns=yr,Ps=mn,Fs=on,Is=yn,Q=E,Ls=wn,Rs=Gn,zs=Pn,Bs=An,Vs=a,Hs=ze,Us=Ue,Ws=Vt,Gs=Mn,Ks=Re,qs=Xe,Js=er,Ys=Cn,Xs=Qi,Zs=Xi,Qs=We,$s=Qe,ec=j(2,(e,t)=>tc(e,void 0,t)),tc=$i,nc=fe,rc=Ae,ic=ir,ac=Ee,oc=ct,sc=Kt,cc=Gt,lc=kn,uc=Qt,dc=zn,fc=Ct,pc=De,mc=kt,hc=Pe,gc=St,_c=ge,vc=ht,yc=oa,bc=sa,xc=vn,Sc=wr,Cc=Lr,wc=Bt,Tc=de,Ec=ie,Dc=Se,Oc=ot,kc=Ur,Ac=Ie,jc=Te,Mc=re,Nc=_t,Pc=bt,Fc=xe,Ic=wt,Lc=ar,Rc=_e,zc=je,Bc=pn,Vc=an,Hc=k,Uc=h,Wc=h(),Gc=h(`Fatal`),Kc=h(`Warn`),qc=h(`Error`),Jc=h(`Info`),Yc=h(`Debug`),Xc=h(`Trace`),Zc=j(2,(e,t)=>f(e,sr,e=>new Set([...e,t]))),Qc=j(e=>K(e[0]),(e,...t)=>f(e,ii,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||At(n,t[0],t[1]),n})),$c=Ar,el=j(2,(e,t)=>O($n,n=>f(e,ai,e=>[[t,n],...e]))),tl=j(e=>K(e[0]),(e,t,n)=>Q(e,e=>{let r=n===void 0?e:x(()=>n(e));return G(t,r)})),nl=j(e=>K(e[0]),(e,t,n)=>Za(e,e=>{let r=n===void 0?e:n(e);return G(t,r)})),rl=j(e=>K(e[0]),(e,t,n)=>wo(e,e=>{let r=n===void 0?e:x(()=>n(e));return G(t,r)})),il=j(e=>K(e[0]),(e,t,n)=>ko(e,e=>{let r=n===void 0?e:x(()=>n(e));return G(t,r)})),al=j(e=>K(e[0]),(e,t,n)=>Hc(r=>{let i=r.monotonicTimeNanosUnsafe();return Q(e,()=>{let e=r.monotonicTimeNanosUnsafe(),a=Rn(D(e),D(i)),o=n===void 0?a:x(()=>n(a));return G(t,o)})}));var $=class extends dn()(`effect/Effect/Transaction`){};const ol=e=>Wa(t=>{let n=xn(t.context,$);if(n)return e;n={journal:new Map,retry:!1};let r;return Ks(i=>X(Sa({while:()=>!r,body:C(i(e).pipe(Cs($,n),Eo(()=>n.retry?i(cl(n)):q),Z)),step(e){if(n.retry||!sl(n))return ul(n);Jr(e)?ll(t,n):ul(n),r=e}}),()=>r))}),sl=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},cl=e=>Oa(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let e of n)e.pending.delete(t)};return J(e=>{let i=()=>{r(),e(q)};for(let e of n)e.pending.set(t,i);return ka(r)})});function ll(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version+=1,n.value=r);for(let t of n.pending.values())e.currentDispatcher.scheduleTask(t,0);n.pending.clear()}}function ul(e){e.retry=!1,e.journal.clear()}const dl=X($,e=>(e.retry=!0,Hs)),fl=(e,t,n)=>(...r)=>J(i=>{try{e(...r,(e,n)=>{i(e?Y(t?t(e,r):e):Ta(n))})}catch(e){i(n?Y(n(e,r)):Ba(e))}}),pl=()=>e=>e,ml=()=>e=>e,hl=()=>e=>e,gl=r,_l=gr,vl=tt,yl=$t,bl=Ne,xl=nr;export{kc as $,Cc as A,zi as At,_l as B,N as Bt,Vc as C,Ks as Ct,Ys as D,Pi as Dt,ba as E,Wa as Et,Kc as F,Mi as Ft,Co as G,ti as Gt,us as H,ci as Ht,eo as I,wi as It,Yo as J,Ro as K,Qr as Kt,vl as L,oi as Lt,Ia as M,Ei as Mt,Po as N,yi as Nt,wc as O,Ri as Ot,Us as P,Ai as Pt,Oc as Q,gl as R,li as Rt,Ya as S,Va as St,xl as T,Sa as Tt,Ns as U,$r as Ut,os as V,si as Vt,Q as W,ri as Wt,jc as X,Qa as Y,Ac as Z,Y as _,Eo as _t,Xa as a,Rc as at,X as b,Ho as bt,J as c,Ts as ct,bl as d,ys as dt,Mc as et,co as f,Ta as ft,Z as g,Za as gt,fl as h,ka as ht,ma as i,Ic as it,Ga as j,Si as jt,Sc as k,Fi as kt,mo as l,Es as lt,Ba as m,Oa as mt,Os as n,Fc as nt,to as o,zc as ot,so as p,Ea as pt,gs as q,js as r,Nc as rt,ro as s,Lc as st,fa as t,Pc as tt,ho as u,Ds as ut,Ra as v,Bo as vt,Bc as w,q as wt,yl as x,wa as xt,za as y,Vo as yt,xo as z,ui as zt};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{Ao as t,At as n,Ct as r,Do as ee,Dt as i,Et as a,Io as o,Mt as s,Nt as c,Oo as l,Ot as u,Pt as d,St as f,Tt as p,_t as m,bt as h,gt as g,ht as _,jt as v,ko as y,kt as b,mt as x,pt as S,vt as C,wt as w,xt as T,yt as E}from"./effect-CKgkjFOq.js";var D=e({asVoid:()=>X,asVoidAll:()=>Z,die:()=>M,fail:()=>j,failCause:()=>A,filterCause:()=>U,filterFailure:()=>H,filterSuccess:()=>B,filterValue:()=>V,findDefect:()=>G,findError:()=>W,findErrorOption:()=>te,getCause:()=>$,getSuccess:()=>Q,hasDies:()=>R,hasFails:()=>L,hasInterrupts:()=>z,interrupt:()=>N,isExit:()=>O,isFailure:()=>I,isSuccess:()=>F,map:()=>q,mapBoth:()=>Y,mapError:()=>J,match:()=>K,succeed:()=>k,void:()=>P});const O=o,k=t,A=y,j=l,M=ee,N=i,P=d,F=b,I=u,L=p,R=w,z=a,B=m,V=C,H=g,U=_,W=h,G=E,K=c,q=n,J=s,Y=v,X=S,Z=x,Q=r,$=f,te=T;export{F as a,P as c,I as i,j as n,K as o,A as r,k as s,D as t};
@@ -0,0 +1,2 @@
1
+ import{M as e}from"./Effect-B9bZOysK.js";import{M as t,c as n,f as r,g as i,i as a,j as o,k as s,n as c,o as l,u}from"./RunUserPromptSubmitHooksExecutor-Blzp-S0j.js";import{homedir as d}from"node:os";const f=(n,r)=>e(function*(){let e=yield*s(t(d(),r.cwd));if(e)return yield*u(e,n,r)}),p=(n,r)=>e(function*(){let e=yield*s(t(d(),r.cwd));if(!e)return;let i=yield*a(e,n,r);if(i.warning!==void 0)return{content:[...n.content,{type:`text`,text:i.warning}],isError:n.isError}}),m=(n,r)=>e(function*(){let e=yield*s(t(d(),r.cwd));if(e)return yield*c(e,n,r)}),h=(r,i)=>e(function*(){let e=yield*o(t(d(),i.cwd)),a=[...e.coverage.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...e.coverage.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...e.coverage.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...e.coverage.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...e.coverage.shadowed.map(e=>` ${e.event}: ${e.reason}`),...e.coverage.disabled.map(e=>` ${e.event}: ${e.reason}`)];a.length>0&&i.ui.notify(`Hook coverage — configured hooks this bridge will not run:\n${a.join(`
2
+ `)}`,`warning`),e.unsupportedHookTypes.length>0&&i.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${e.unsupportedHookTypes.join(`, `)}`,`warning`),e.malformedFiles.length>0&&i.ui.notify(`Hooks are NOT running from malformed settings file(s): ${e.malformedFiles.join(`, `)}`,`error`);let c=yield*s(t(d(),i.cwd));c&&(yield*n(c,r,i))}),g=r=>e(function*(){let e=yield*s(t(d(),r.cwd));e&&(yield*n(e,`compact`,r),yield*i(e.hooks.PostCompact,r,`PostCompact`))}),_=n=>e(function*(){let e=yield*s(t(d(),n.cwd));if(!e)return;let i=yield*r(e,n);if(i.block===!0)return n.ui.notify(`Compaction cancelled by a PreCompact hook: ${i.reason??`no reason given`}`,`warning`),{cancel:!0}}),v=(n,r)=>e(function*(){let e=yield*s(t(d(),r.cwd));e&&(yield*l(e,n,r))}),y=n=>e(function*(){let e=yield*s(t(d(),n.cwd));e&&(yield*i(e.hooks.SessionEnd,n,`SessionEnd`))}),b=n=>e(function*(){let e=yield*s(t(d(),n.cwd));e&&(yield*i(e.hooks.Stop,n,`Stop`))});export{h as a,f as c,y as i,p as l,m as n,b as o,g as r,v as s,_ as t};
@@ -0,0 +1 @@
1
+ import{Na as e,Wa as t}from"./effect-CKgkjFOq.js";import{M as n,Y as r,yt as i}from"./Effect-B9bZOysK.js";import{a,c as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p}from"./HookDispatcherExecutor-BNRem4ll.js";const m=(m,h)=>{let g=async a=>{let o=n(function*(){let t=yield*r(a);if(e(t))throw t.failure;return t.success}).pipe(i(28e3));return t(await h.runSafe(o))};m.on(`tool_call`,(e,t)=>g(o(e,t))),m.on(`tool_result`,(e,t)=>g(c(e,t))),m.on(`input`,(e,t)=>g(l(e,t))),m.on(`session_start`,(e,t)=>g(a(`startup`,t))),m.on(`session_compact`,(e,t)=>g(d(t))),m.on(`session_before_compact`,(e,t)=>g(p(t))),m.on(`session_switch`,(e,t)=>g(f(e.reason,t))),m.on(`session_shutdown`,(e,t)=>g(s(t))),m.on(`session_stop`,(e,t)=>g(u(t)))};export{m as HookDispatcherTask};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$a as t,Aa as n,Ba as r,Cs as i,Es as a,Ha as o,Qa as s,Va as c,_s as l,ds as u,ls as d,qn as ee}from"./effect-CKgkjFOq.js";import{C as f,Ct as p,D as te,E as m,F as ne,I as h,L as g,M as _,N as re,P as v,R as ie,St as y,Tt as ae,_ as b,b as oe,bt as x,g as se,h as S,k as C,m as w,n as ce,v as T,w as le,wt as ue,x as de,xt as fe,y as pe,yt as me,z as E}from"./dist-tiPF5e4h.js";import{a as he,i as ge,n as _e,o as ve}from"./Cause-C0nAfay4.js";import{c as ye,n as be,s as xe}from"./Exit-BNubcB4u.js";import{$ as Se,A as Ce,Bt as we,D as Te,Dt as Ee,E as De,Et as Oe,Ft as D,G as O,Gt as ke,H as Ae,I as k,It as je,J as Me,Kt as Ne,Lt as Pe,M as Fe,Mt as A,N as Ie,Nt as Le,Pt as Re,Q as ze,Rt as Be,S as Ve,St as j,Ut as M,Vt as He,Wt as Ue,X as We,Z as Ge,_ as N,a as Ke,at as qe,b as P,bt as Je,c as F,ct as I,dt as Ye,et as Xe,ft as L,gt as Ze,h as R,ht as z,it as Qe,jt as $e,m as et,mt as B,n as V,nt as tt,o as nt,ot as rt,p as it,q as at,rt as ot,s as st,st as ct,tt as lt,w as H,wt as U,xt as ut,zt as dt}from"./Effect-B9bZOysK.js";import{A as ft,C as pt,D as mt,E as ht,N as gt,O as _t,P as vt,S as W,T as yt,_ as bt,a as xt,b as St,d as Ct,h as wt,l as Tt,m as Et,p as Dt,r as Ot,s as kt,t as At,v as jt,w as Mt,x as G,y as Nt}from"./RunUserPromptSubmitHooksExecutor-Blzp-S0j.js";import*as Pt from"node:os";import*as Ft from"node:child_process";import{PassThrough as K}from"node:stream";import*as It from"node:crypto";import*as q from"node:fs";import*as J from"node:path";import*as Lt from"node:url";const Rt=ee,zt=`~effect/ManagedRuntime`,Bt=(e,t)=>{let n=t?.memoMap??Le(),r=He(`parallel`),i=we(r,`sequential`),a={onFiberStart:vt(r)},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=Oe(t=>(s||=ze(Ze($e(e,n,i),e=>z(()=>{l.cachedContext=e})),{...a,scheduler:t.currentScheduler}),Ve(gt(s)))),l={[zt]:zt,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?Xe(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return Xe(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:B(()=>(l.contextEffect=et(`ManagedRuntime disposed`),l.cachedContext=void 0,dt(l.scope,ye))),runFork(e,t){return l.cachedContext===void 0?ze(Y(l,e),o(t)):Se(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?We(Y(l,e),o(t)):Ge(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?qe(Y(l,e)):rt(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Qe(Y(l,e)):ct(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?lt(Y(l,e),o(t)):tt(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Xe(Y(l,e),o(t)):ot(l.cachedContext)(e,o(t))}};return l};function Y(e,t){return P(e.contextEffect,e=>at(t,e))}const Vt=(e,t,n)=>{let r=e.detached??n!==`win32`;return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}},X=(e,t)=>(n,[r])=>{let i=`Unknown`;switch(n.code){case`ENOENT`:i=`NotFound`;break;case`EACCES`:i=`PermissionDenied`;break;case`EEXIST`:i=`AlreadyExists`;break;case`EISDIR`:i=`BadResource`;break;case`ENOTDIR`:i=`BadResource`;break;case`EBUSY`:i=`Busy`;break;case`ELOOP`:i=`BadResource`}return E({_tag:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})},Ht=e=>ne(x(Ut(e),e=>[e])),Ut=e=>me(t=>{let n=e.evaluate();return L(Wt({...e,writable:n,pull:t}))}),Wt=e=>e.pull.pipe(P(t=>{let n=0;return F(function r(i){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once(`drain`,()=>r(i));return}i(U)})}),Te({disableYield:!0}),Me(F(t=>{let n=n=>t(N(e.onError(n)));return e.writable.once(`error`,n),z(()=>{e.writable.off(`error`,n)})})),e.endOnDone===!1?i:Ee(t=>`closed`in e.writable&&e.writable.closed?he(t):F(n=>{e.writable.once(`finish`,()=>n(he(t))),e.writable.end()}))),Gt=e=>le(Kt(e)),Kt=e=>me((t,n)=>qt({scope:n,readable:e.evaluate(),onError:e.onError??Jt,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),qt=e=>{let t=e.readable,r=e.closeOnDone??!0,i=e.exit??ae(void 0),a=Rt(!1);function o(){a.openUnsafe()}function s(t){i.current=be(e.onError(t)),a.openUnsafe()}function c(){i.current=be(_e()),a.openUnsafe()}t.on(`readable`,o),t.once(`error`,s),t.once(`end`,c);let l=B(function r(){let o=e.readable.read(e.chunkSize);if(o===null)return i.current?i.current:t.readableEnded?N(_e()):(a.closeUnsafe(),P(a.await,r));let s=n(o);for(;o=e.readable.read(e.chunkSize),o!==null;)s.push(o);return L(s)});return nt(Be(e.scope,z(()=>{t.off(`readable`,o),t.off(`error`,s),t.off(`end`,c),r&&`closed`in e.readable&&!e.readable.closed&&e.readable.destroy()})),l)},Jt=e=>new ge(e),Z=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Q=(e,t,n)=>{let{commands:r}=Zt(n),i=r.reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return X(`ChildProcess`,e)(t,[i])},Yt=(e,t=()=>{})=>Ft.execFile(`taskkill`,[`/pid`,String(e.pid),`/T`,`/F`],{windowsHide:!0},t),Xt=A(pt,Fe(function*(){let e=yield*se,t=yield*w,n=H(function*(n){if(!l(n.cwd))return yield*e.access(n.cwd),t.resolve(n.cwd)}),r=e=>e.extendEnv?{...globalThis.process.env,...e.env}:e.env,i=e=>m(e)?`pipe`:e,a=e=>h(e)?`pipe`:e,o=e=>{let t={stream:`pipe`,encoding:`utf-8`,endOnDone:!0};return l(e.stdin)?t:typeof e.stdin==`string`||m(e.stdin)?{...t,stream:e.stdin}:{stream:e.stdin.stream,encoding:e.stdin.encoding??t.encoding,endOnDone:e.stdin.endOnDone??t.endOnDone}},s=(e,t)=>{let n=e[t];return l(n)?{stream:`pipe`}:typeof n==`string`||h(n)?{stream:n}:{stream:n.stream}},c=e=>{if(l(e.additionalFds))return[];let t=[];for(let[n,r]of Object.entries(e.additionalFds)){let e=W(n);u(e)&&t.push({fd:e,config:r})}return t.sort((e,t)=>e.fd-t.fd)},ee=(e,t,n,r)=>{let o=[i(e.stream),a(t.stream),a(n.stream)];if(r.length===0)return o;let s=r.reduce((e,{fd:t})=>Math.max(e,t),2);for(let e=3;e<=s;e++)o[e]=`ignore`;for(let{fd:e}of r)o[e]=`pipe`;return o},p=H(function*(e,t,n){if(n.length===0)return{getInputFd:()=>v,getOutputFd:()=>f};let r=new Map,i=new Map;for(let{config:a,fd:o}of n){let n=t.stdio[o];switch(a.type){case`input`:{let t=v;n&&`write`in n&&(t=Ht({evaluate:()=>n,onError:t=>Q(`fromWritable(fd${o})`,Z(t),e)})),a.stream&&(yield*Ce(C(a.stream,t))),r.set(o,t);break}case`output`:{let t=f;if(n&&`read`in n){let r=new K;n.on(`error`,e=>r.destroy(e)),n.pipe(r),t=Gt({evaluate:()=>r,onError:t=>Q(`fromReadable(fd${o})`,Z(t),e)})}a.sink&&(t=_(t,a.sink)),i.set(o,t);break}}}return{getInputFd:e=>r.get(e)??v,getOutputFd:e=>i.get(e)??f}}),ne=(e,t,n)=>B(()=>{let r=v;return d(t.stdin)&&(r=Ht({evaluate:()=>t.stdin,onError:t=>Q(`fromWritable(stdin)`,Z(t),e),endOnDone:n.endOnDone,encoding:n.encoding})),m(n.stream)?nt(Ce(C(n.stream,r)),r):L(r)}),g=(e,t,n,r)=>{let i=t.stdout?(()=>{let n=new K;return t.stdout.on(`error`,e=>n.destroy(e)),t.stdout.pipe(n),Gt({evaluate:()=>n,onError:t=>Q(`fromReadable(stdout)`,Z(t),e)})})():f,a=t.stderr?(()=>{let n=new K;return t.stderr.on(`error`,e=>n.destroy(e)),t.stderr.pipe(n),Gt({evaluate:()=>n,onError:t=>Q(`fromReadable(stderr)`,Z(t),e)})})():f;h(n.stream)&&(i=_(i,n.stream)),h(r.stream)&&(a=_(a,r.stream));let o=te(i,a);return{stdout:i,stderr:a,all:o}},ie=(e,t)=>F(n=>{let r=Ne(),i=Ft.spawn(e.command,e.args,t);return i.on(`error`,t=>{n(N(Q(`spawn`,t,e)))}),i.on(`exit`,(...e)=>{Ue(r,xe(e))}),i.on(`spawn`,()=>{n(L([i,r]))}),z(()=>{i.kill(`SIGTERM`)})}),y=(e,t,n)=>globalThis.process.platform===`win32`?F(n=>{Yt(t,t=>{n(t?N(Q(`kill`,Z(t),e)):U)})}):j({try:()=>{globalThis.process.kill(-t.pid,n)},catch:t=>Q(`kill`,Z(t),e)}),ae=(e,t)=>{if(globalThis.process.platform===`win32`){Yt(e);return}try{globalThis.process.kill(-e.pid,t)}catch{}},b=(e,t,n)=>B(()=>{if(!t.kill(n)){let t=new globalThis.Error(`Failed to kill child process`);return N(Q(`kill`,t,e))}return U}),oe=(e,t,n)=>r=>{let i=n?.killSignal??`SIGTERM`;return l(n?.forceKillAfter)?r(t,e,i):Je(r(t,e,i),{duration:n.forceKillAfter,orElse:()=>r(t,e,`SIGKILL`)})},x=(e,t)=>{let n=t??`stdout`;switch(n){case`stdout`:return e.stdout;case`stderr`:return e.stderr;case`all`:return e.all;default:{let t=W(n);return u(t)?e.getOutputFd(t):e.stdout}}},S=H(function*(e){switch(e._tag){case`StandardCommand`:{let t=o(e.options),i=s(e.options,`stdout`),a=s(e.options,`stderr`),l=c(e.options),u=!0,f=yield*n(e.options),te=r(e.options),m=ee(t,i,a,l),[h,_]=yield*V(ie(e,Vt(e.options,{cwd:f,env:te,stdio:m},process.platform)),H(function*([t,n]){let r=yield*ke(n),i=oe(t,e,e.options);if(r){let[e]=yield*M(n);return e!==0&&d(e)?yield*Ie(i(y)):yield*U}return u?yield*i((e,t,r)=>y(e,t,r).pipe(it(()=>b(e,t,r)),Ke(M(n)))).pipe(Ie):yield*U})),re=yt(h.pid);h.on(`exit`,t=>{t!==0&&d(t)&&ae(h,e.options.killSignal??`SIGTERM`)});let v=z(()=>{u||=(h.ref(),!0)}),x=z(()=>(u&&=(h.unref(),!1),v)),se=yield*ne(e,h,t),{all:S,stderr:C,stdout:w}=g(e,h,i,a),{getInputFd:ce,getOutputFd:T}=yield*p(e,h,l),le=k(ke(_),e=>!e),ue=P(M(_),([t,n])=>{if(d(t))return L(Mt(t));let r=new globalThis.Error(`Process interrupted due to receipt of signal: '${n}'`);return N(Q(`exitCode`,r,e))});return mt({pid:re,exitCode:ue,isRunning:le,kill:t=>oe(h,e,t)((e,t,n)=>y(e,t,n).pipe(it(()=>b(e,t,n)),Ke(M(_)))).pipe(st),stdin:se,stdout:w,stderr:C,all:S,getInputFd:ce,getOutputFd:T,unref:x})}case`PipedCommand`:{let{commands:t,pipeOptions:n}=Zt(e),[r,...i]=t,a=[yield*S(r)];for(let e=0;e<i.length;e++){let t=i[e],r=n[e]??{},s=o(t.options),c=re(L(x(a[a.length-1],r.from))),l=r.to??`stdin`;if(l===`stdin`)a.push(yield*S(G(t.command,t.args,{...t.options,stdin:{...s,stream:c}})));else{let e=W(l);if(u(e)){let n=St(e),r=t.options.additionalFds??{};a.push(yield*S(G(t.command,t.args,{...t.options,additionalFds:{...r,[n]:{type:`input`,stream:c}}})))}else a.push(yield*S(G(t.command,t.args,{...t.options,stdin:{...s,stream:c}})))}}let s=a[a.length-1],c=e=>De([...a].reverse(),t=>Ie(t.kill(e)),{discard:!0}),l=Fe(function*(){let e=[];for(let t of a)e.push(yield*t.unref);return De([...e].reverse(),e=>e,{discard:!0})});return mt({pid:s.pid,exitCode:s.exitCode,isRunning:s.isRunning,kill:c,stdin:s.stdin,stdout:s.stdout,stderr:s.stderr,all:s.all,getInputFd:s.getInputFd,getOutputFd:s.getOutputFd,unref:l})}}});return ht(S)})),Zt=e=>{let t=[],n=[],r=e=>{switch(e._tag){case`StandardCommand`:t.push(e);break;case`PipedCommand`:r(e.left),n.push(e.options),r(e.right)}};if(r(e),t.length===0)throw Error(`flattenCommand produced empty commands array`);let[i,...a]=t;return{commands:[i,...a],pipeOptions:n}},$=e=>t=>ie({module:`FileSystem`,method:e,description:t.message??String(t)}),Qt=(()=>{let e=R(q.access,X(`FileSystem`,`access`),$(`access`));return(t,n)=>{let r=q.constants.F_OK;return n?.readable&&(r|=q.constants.R_OK),n?.writable&&(r|=q.constants.W_OK),e(t,r)}})(),$t=(()=>{let e=R(q.cp,X(`FileSystem`,`copy`),$(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),en=(()=>{let e=R(q.copyFile,X(`FileSystem`,`copyFile`),$(`copyFile`));return(t,n)=>e(t,n)})(),tn=(()=>{let e=R(q.chmod,X(`FileSystem`,`chmod`),$(`chmod`));return(t,n)=>e(t,n)})(),nn=(()=>{let e=R(q.chown,X(`FileSystem`,`chown`),$(`chown`));return(t,n,r)=>e(t,n,r)})(),rn=(()=>{let e=R(q.glob,X(`FileSystem`,`glob`),$(`glob`));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),an=(()=>{let e=R(q.link,X(`FileSystem`,`link`),$(`link`));return(t,n)=>e(t,n)})(),on=(()=>{let e=R(q.mkdir,X(`FileSystem`,`makeDirectory`),$(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),sn=e=>{let t=R(q.mkdtemp,X(`FileSystem`,e),$(e));return e=>B(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?J.join(e.directory,`.`):Pt.tmpdir();return t(n?J.join(r,n):r+`/`)})},cn=sn(`makeTempDirectory`),ln=e=>{let t=R(q.rm,X(`FileSystem`,e),$(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},un=ln(`remove`),dn=(()=>{let e=sn(`makeTempDirectoryScoped`),t=ln(`makeTempDirectoryScoped`);return n=>V(e(n),e=>O(t(e,{recursive:!0})))})(),fn=(e=>{let t=R(q.open,X(`FileSystem`,e),$(e)),n=R(q.close,X(`FileSystem`,e),$(e));return(e,r)=>a(V(t(e,r?.flag??`r`,r?.mode),e=>O(n(e))),k(e=>pn(e,r?.flag?.startsWith(`a`)??!1)))})(`open`),pn=(()=>{let e=e=>R(q.read,X(`FileSystem`,e),$(e)),n=e(`read`),r=e(`readAlloc`),i=R(q.fstat,X(`FileSystem`,`stat`),$(`stat`)),a=R(q.ftruncate,X(`FileSystem`,`truncate`),$(`truncate`)),o=R(q.fsync,X(`FileSystem`,`sync`),$(`sync`)),c=e=>R(q.write,X(`FileSystem`,e),$(e)),l=c(`write`),u=c(`writeAll`);class d{[b];fd;append;position=BigInt(0);constructor(e,t){this[b]=b,this.fd=e,this.append=t}get stat(){return k(i(this.fd),Sn)}get sync(){return o(this.fd)}seek(e,t){let n=T(e);return z(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),T(this.position)))}read(e){return B(()=>{let t=this.position;return k(n(this.fd,{buffer:e,position:t}),e=>{let n=T(e);return this.position=t+n,n})})}readAlloc(e){let n=Number(e);return B(()=>{let e=Buffer.allocUnsafeSlow(n),i=this.position;return k(r(this.fd,{buffer:e,position:i}),r=>{if(r===0)return s();if(this.position=i+BigInt(r),r===n)return t(e);let a=Buffer.allocUnsafeSlow(r);return e.copy(a,0,0,r),t(a)})})}truncate(e){return k(a(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}})}write(e){return B(()=>{let t=this.position;return k(l(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),e=>{let n=T(e);return this.append||(this.position=t+n),n})})}writeAllChunk(e){return B(()=>{let t=this.position;return P(u(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),n=>n===0?N(E({module:`FileSystem`,method:`writeAll`,_tag:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position=t+BigInt(n)),n<e.length?this.writeAllChunk(e.subarray(n)):U))})}writeAll(e){return this.writeAllChunk(e)}}return(e,t)=>new d(e,t)})(),mn=e=>{let t=sn(e);return H(function*(e){let n=yield*t(e),r=It.randomBytes(6).toString(`hex`),i=J.join(n,e?.suffix?`${r}${e.suffix}`:r);return yield*kn(i,new Uint8Array),i})},hn=mn(`makeTempFile`),gn=(()=>{let e=mn(`makeTempFileScoped`),t=ln(`makeTempFileScoped`);return n=>V(e(n),e=>O(t(J.dirname(e),{recursive:!0})))})(),_n=(e,t)=>ut({try:()=>q.promises.readdir(e,t),catch:t=>X(`FileSystem`,`readDirectory`)(t,[e])}),vn=e=>F((t,n)=>{try{q.readFile(e,{signal:n},(n,r)=>{t(n?N(X(`FileSystem`,`readFile`)(n,[e])):L(r))})}catch(e){t(N($(`readFile`)(e)))}}),yn=(()=>{let e=R(q.readlink,X(`FileSystem`,`readLink`),$(`readLink`));return t=>e(t)})(),bn=(()=>{let e=R(q.realpath,X(`FileSystem`,`realPath`),$(`realPath`));return t=>e(t)})(),xn=(()=>{let e=R(q.rename,X(`FileSystem`,`rename`),$(`rename`));return(t,n)=>e(t,n)})(),Sn=e=>({type:e.isFile()?`File`:e.isDirectory()?`Directory`:e.isSymbolicLink()?`SymbolicLink`:e.isBlockDevice()?`BlockDevice`:e.isCharacterDevice()?`CharacterDevice`:e.isFIFO()?`FIFO`:e.isSocket()?`Socket`:`Unknown`,mtime:c(e.mtime),atime:c(e.atime),birthtime:c(e.birthtime),dev:e.dev,rdev:c(e.rdev),ino:c(e.ino),mode:e.mode,nlink:c(e.nlink),uid:c(e.uid),gid:c(e.gid),size:T(e.size),blksize:e.blksize===void 0?s():t(T(e.blksize)),blocks:c(e.blocks)}),Cn=(()=>{let e=R(q.stat,X(`FileSystem`,`stat`),$(`stat`));return t=>k(e(t),Sn)})(),wn=(()=>{let e=R(q.symlink,X(`FileSystem`,`symlink`),$(`symlink`));return(t,n)=>e(t,n)})(),Tn=(()=>{let e=R(q.truncate,X(`FileSystem`,`truncate`),$(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),En=(()=>{let e=R(q.utimes,X(`FileSystem`,`utime`),$(`utime`));return(t,n,r)=>e(t,n,r)})(),Dn=(e,t)=>de(n=>V(z(()=>{let r=q.watch(e,{recursive:t?.recursive??!1},(e,t)=>{if(t)switch(e){case`rename`:ze(Ae(Cn(t),{onSuccess:e=>p(n,{_tag:`Create`,path:t}),onFailure:e=>p(n,{_tag:`Remove`,path:t})}));return;case`change`:ue(n,{_tag:`Update`,path:t});return}});return r.on(`error`,t=>{y(n,ve(E({module:`FileSystem`,_tag:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t})))}),r.on(`close`,()=>{fe(n)}),r}),e=>z(()=>e.close()))),On=(e,t,n)=>Cn(t).pipe(k(i=>e.pipe(r(e=>e.register(t,i,n)),o(()=>Dn(t,n)))),re),kn=(e,t,n)=>F((r,i)=>{try{q.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?N(X(`FileSystem`,`writeFile`)(t,[e])):U)})}catch(e){r(N($(`writeFile`)(e)))}}),An=k(Ye(pe),e=>oe({access:Qt,chmod:tn,chown:nn,copy:$t,copyFile:en,glob:rn,link:an,makeDirectory:on,makeTempDirectory:cn,makeTempDirectoryScoped:dn,makeTempFile:hn,makeTempFileScoped:gn,open:fn,readDirectory:_n,readFile:vn,readLink:yn,realPath:bn,remove:un,rename:xn,stat:Cn,symlink:wn,truncate:Tn,utimes:En,watch(t,n){return On(e,t,n)},writeFile:kn})),jn=A(se)(An),Mn=e=>({fromFileUrl:t=>j({try:()=>Lt.fileURLToPath(t,{windows:e}),catch:e=>new g({module:`Path`,method:`fromFileUrl`,cause:e})}),toFileUrl:t=>j({try:()=>Lt.pathToFileURL(t,{windows:e}),catch:e=>new g({module:`Path`,method:`toFileUrl`,cause:e})})});({...J.posix,...Mn(!1)}),{...J.win32,...Mn(!0)};const Nn=je(w)({[S]:S,...J,...Mn(void 0)});var Pn=e({HookScopeLive:()=>Fn,default:()=>Ln});const Fn=Re(A(Pe,I),A(_t,I),A(ft,I),A(Nt,I),A(bt,I),A(Tt,I),A(Dt,I),A(Et,I),A(Ot,I),A(Ct,I),A(At,I),A(kt,I),A(xt,I),A(wt,I),A(jt,I)),In=Xt.pipe(D(jn),D(Nn)),Ln=Bt(Fn.pipe(D(ce),D(In))),Rn=()=>{Ln.dispose()};process.once(`SIGINT`,Rn),process.once(`SIGTERM`,Rn);export{Fn as n,Pn as t};
@@ -0,0 +1,3 @@
1
+ import{Fa as e,Na as t}from"./effect-CKgkjFOq.js";import{g as n,m as r,t as i}from"./dist-tiPF5e4h.js";import{C as a,K as o,Y as s}from"./Effect-B9bZOysK.js";const c=[`AGENTS.md`],l=a(`extractRefs`)(function*(t,i,a){let o=yield*n,c=yield*r,l=[];for(let n of t.split(`
2
+ `)){let t=n.trim().replace(/^[-*+]\s+/,``);if(!t.startsWith(`@`))continue;let r=t.slice(1).trim();if(!r||r.includes(` `)||c.isAbsolute(r))continue;let u=c.resolve(i,r);if(u.startsWith(a+`/`)||u===a){let t=yield*s(o.exists(u));if(e(t)&&t.success){l.push({sourcePath:i,resolvedPath:u});continue}}let d=c.resolve(a,r);(d.startsWith(a+`/`)||d===a)&&d!==u&&l.push({sourcePath:a,resolvedPath:d})}return l}),u=a(`loadReferencedContent`)(function*(a){let u=yield*n,d=yield*r,f=yield*i,p=[d.resolve(a,`CLAUDE.md`),d.resolve(a,`.claude`,`CLAUDE.md`)],m=[];for(let t of p){let n=yield*s(u.readFileString(t,`utf-8`));if(e(n)){let e=yield*l(n.success,d.dirname(t),a);m.push(...e)}}let h=new Set,g=[];for(let e of m)h.has(e.resolvedPath)||(h.add(e.resolvedPath),g.push(e));let _=(yield*f.load(a).pipe(o(()=>void 0)))?.no_inject_refs??c,v=[];for(let e of g){let n=e.resolvedPath.slice(a.length+1);if(_.includes(n))continue;let r=yield*s(u.readFileString(e.resolvedPath,`utf-8`));t(r)||v.push(`## ${n}\n${r.success}\n`)}return v.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...v].join(`
3
+ `)});export{u as t};
@@ -0,0 +1 @@
1
+ import{Ma as e,Ss as t,Yo as n,aa as r,da as i,gs as a,vo as o,ws as s,xa as c,xs as ee}from"./effect-CKgkjFOq.js";import{At as te,Dt as l,Et as u,Ft as ne,Mt as d,Ot as f,Pt as p,X as m,Z as h,_t as g,ft as re,kt as ie,mt as ae,vt as oe}from"./dist-tiPF5e4h.js";import{B as se,G as ce,M as le,R as _,Y as v,_ as y,d as b,ft as x,m as S,u as C,w,x as T}from"./Effect-B9bZOysK.js";import{t as E}from"./InjectInstructionsExecutor-Hwi0pEWf.js";function D(e){return{_tag:`Value`,value:e}}function O(e,t){return{_tag:`Record`,keys:e,value:t}}function k(e,t){return{_tag:`Array`,length:e,value:t}}r(`SourceError`);const A=i(`effect/ConfigProvider`,{defaultValue:()=>R()}),j={...o,toJSON(){return{_id:`ConfigProvider`}}},M=e=>e;function N(e,t){let n=Object.create(j);return n.load=e,n.mapInput=t,n}function P(e,n){return N(t=>e(n(t)),r=>P(e,t(n,r)))}function F(e){return P(e,M)}function I(e,t){return e===``&&!t?void 0:e}function L(e,t){let n=t?.preserveEmptyStrings===!0,r=z(e);return F(t=>x(ue(r,e,t,n)))}function R(e){return L(e?.env??{...globalThis.process?.env,...import.meta.env},{preserveEmptyStrings:e?.preserveEmptyStrings})}function z(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){let e=i.children??=Object.create(null);i=e[t]??={}}}return t}const B=/^(0|[1-9][0-9]*)$/;function ue(e,t,n,r){let i=n.map(String).join(`_`),a=I(Object.hasOwn(t,i)?t[i]:void 0,r),o=V(e,n),s=o?.children?Object.keys(o.children):[];return s.length===0?a===void 0?void 0:D(a):s.every(e=>B.test(e))?k(Math.max(...s.map(e=>parseInt(e,10)))+1,a):O(new Set(s),a)}function V(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}const H=`~effect/Config`;var U=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const de={...c({label:`Config`,evaluate(e){return this.parse(e.getRef(A))}}),[H]:H,toJSON(){return{_id:`Config`}}};function W(e){let t=Object.create(de);return t.evaluator=e,t.parse=t=>e(t,[]).pipe(se(e=>e.error),T(e=>e._tag===`Resolved`?x(e.value):y(e.error))),t}const fe=(e,t,n)=>e.evaluator(t,n),G=(e,t)=>({_tag:`Resolved`,value:e,hasInput:t}),pe=e=>({_tag:`Absent`,error:e}),K=(e,t)=>({error:e,hasInput:t}),me=e=>a(e,`SourceError`),q=(e,t)=>e.pipe(C(e=>me(e)?y(K(new U(e),t)):S(e))),he=ee(2,(e,t)=>W((n,r)=>_(fe(e,n,r),e=>e._tag===`Absent`?G(t,!1):e))),ge=()=>`<configuration>`,J=(e,t)=>e.load(t).pipe(ce,_(n=>({provider:e,path:t,node:n,toString:ge}))),Y=(e,t)=>J(e.provider,[...e.path,t]),X=e=>e?.value,Z=(e,t)=>l(ie,e,new te(p(e=>t(e)),d())),Q=e=>{switch(e._tag){case`Union`:return e.types.every(Q);case`Objects`:case`Arrays`:case`Suspend`:return!1;default:return!0}},$=(e,t)=>{switch(e._tag){case`Objects`:return t?._tag===`Record`;case`Arrays`:return t?._tag===`Array`;case`Union`:return e.types.some(e=>$(e,t));case`Suspend`:return $(e.thunk(),t);default:return X(t)!==void 0}},_e=s(e=>{let t=new WeakSet,r=u(e=>{switch(t.add(e),e._tag){case`Objects`:{let t=e.indexSignatures.map(e=>g(e.parameter)),i=w(function*(r){if(r.node?._tag!==`Record`)return;let i=r.node,a=new Set;for(let t of e.propertySignatures)typeof t.name==`string`&&a.add(t.name);if(t.length>0)for(let e of i.keys)t.some(t=>t(e))&&a.add(e);let o={};for(let e of a){let t=yield*Y(r,e);t.node!==void 0&&n(o,e,t)}return o});return Z(e.recur(r,e=>e),i)}case`Arrays`:{let t=w(function*(e){if(e.node?._tag!==`Array`)return;let t=[];for(let n=0;n<e.node.length;n++)t.push(yield*Y(e,n));return t});return Z(e.recur(r),t)}case`Union`:for(let t of e.types)r(t);return Q(e)?Z(e,e=>x(X(e.node))):e.recur(r);case`Suspend`:{let n=e.thunk();return t.has(n)||r(n),e.recur(r)}case`Declaration`:case`Any`:throw new globalThis.Error(`Config.schema does not support opaque StringTree encodings`,{cause:e});default:return Z(e,e=>x(X(e.node)))}});return r(e)});function ve(e,t){let n=ae(e),r=f(n.ast),i=oe(re(_e(n.ast))),a=typeof t==`string`?[t]:t??[];return W((e,t)=>{let n=[...t,...a];return q(J(e,n),!1).pipe(T(e=>{let t=$(r,e.node);return q(i(e).pipe(_(e=>G(e,t)),b(e=>{let r=new U(new m(n.length>0?new ne(n,e):e));return t?y(K(r,!0)):x(pe(r))})),t)}))})}function ye(e){return ve(h,e)}const be=(t,n)=>{t.on(`before_agent_start`,async(t,r)=>{let i=await n.runSafe(le(function*(){let t=yield*ye(`CLAUDE_PROJECT_DIR`).pipe(he(process.cwd())),n=yield*v(E(t));return e(n)}));if(i!==``)return{systemPrompt:[...t.systemPrompt,``,i]}})};export{be as InjectInstructionsTask};
@@ -0,0 +1,9 @@
1
+ import{$a as e,Cs as t,Es as n,Fa as r,Ha as i,Ho as a,Ia as o,La as s,Oa as c,Os as l,Pa as u,Qa as d,Ra as f,Ta as p,Ut as m,Vt as ee,Wt as te,Xa as ne,Za as h,fa as g,ga as re,ja as _,qa as ie,wa as ae,xa as oe,xs as v}from"./effect-CKgkjFOq.js";import{$ as y,A as se,B as b,G as ce,H as le,J as ue,K as de,N as fe,Nt as pe,O as me,Pt as he,Q as x,S as ge,T as _e,V as S,W as ve,Y as C,Z as w,a as ye,at as be,c as xe,ct as T,d as Se,dt as Ce,et as we,f as Te,g as Ee,gt as E,ht as De,i as Oe,it as ke,j as Ae,jt as je,l as Me,lt as Ne,nt as D,o as Pe,ot as Fe,p as Ie,pt as O,q as Le,r as Re,rt as k,s as ze,st as A,tt as Be,u as j,ut as M}from"./dist-tiPF5e4h.js";import{c as Ve,f as He}from"./Cause-C0nAfay4.js";import{a as Ue,i as N,o as We}from"./Exit-BNubcB4u.js";import{C as P,Ct as Ge,E as Ke,F as qe,I as Je,K as Ye,M as Xe,N as Ze,O as Qe,P as $e,V as et,_ as tt,_t as nt,b as rt,f as it,ft as F,ht as at,i as ot,it as st,k as ct,lt,m as I,r as ut,s as dt,vt as ft,wt as pt,yt as mt,z as ht}from"./Effect-B9bZOysK.js";function gt(){return Object.assign(e=>e,{option:t=>e(t),result:e=>f(e),is:e=>!0})}const _t=ee,vt=m,yt=te,bt={"~effect/match/Match/Matcher":{_input:t,_filters:t,_result:t,_return:t,_flavor:t},_tag:`ValueMatcher`,add(e){return r(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?xt(this.provided,f(e.evaluate(this.provided))):this},pipe(){return l(this,arguments)}};function xt(e,t){let n=Object.create(bt);return n.provided=e,n.value=t,n}const St=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),Ct=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(Ct),n=t.length;return e=>{if(!Array.isArray(e))return!1;for(let r=0;r<n;r++)if(t[r](e[r])===!1)return!1;return!0}}if(typeof e==`object`&&e){let t=Reflect.ownKeys(e).map(t=>[t,Ct(e[t])]),n=t.length;return e=>{if(typeof e!=`object`||!e)return!1;for(let r=0;r<n;r++){let[n,i]=t[r];if(!(n in e)||i(e[n])===!1)return!1}return!0}}return t=>t===e},wt=e=>xt(e,_(e)),Tt=(e,t)=>n=>n.add(St(Ct(e),t)),Et=(e=>(...t)=>{let n=t[t.length-1],r=t.slice(0,-1),i=r.length===1?t=>t!=null&&t[e]===r[0]:t=>t!=null&&r.includes(t[e]);return e=>e.add(St(i,n))})(`_tag`),Dt=e=>t=>{let n=Ot(t);return u(n)?n._tag===`Success`?n.success:e(n.failure):(...t)=>{let i=n(...t);return r(i)?i.success:e(i.failure,...t)}},Ot=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return(...n)=>{let r=e.select(...n);return t._tag===`When`&&t.guard(r)===!0||t._tag===`Not`&&t.guard(r)===!1?f(t.evaluate(r,...n)):_(r)}}return(...n)=>{let r=e.select(...n);for(let i=0;i<t;i++){let t=e.cases[i];if(t._tag===`When`&&t.guard(r)===!0||t._tag===`Not`&&t.guard(r)===!1)return f(t.evaluate(r,...n))}return _(r)}},kt=`effect/match/Match/exhaustive: absurd`,At=e=>{let t=Ot(e);if(u(t)){if(r(t))return t.success;throw Error(kt)}return(...e)=>{let n=t(...e);if(r(n))return n.success;throw Error(kt)}},L=wt,R=Tt,z=Et,jt=Dt,B=At,Mt=`PreToolUse.PostToolUse.PostToolUseFailure.PostToolBatch.UserPromptSubmit.UserPromptExpansion.SessionStart.SessionEnd.Stop.StopFailure.PreCompact.PostCompact.PermissionRequest.PermissionDenied.SubagentStart.SubagentStop.MessageDisplay.Notification.Setup.TaskCreated.TaskCompleted.TeammateIdle.InstructionsLoaded.ConfigChange.CwdChanged.FileChanged.WorktreeCreate.WorktreeRemove.Elicitation.ElicitationResult`.split(`.`),Nt=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Pt={PermissionRequest:"OMP emits `tool_approval_requested`, but the event exists to allow or deny and OMP ignores the handler return. Express approval policy through OMP native approval configuration instead.",PermissionDenied:"OMP emits `tool_approval_resolved` with `approved: false`, which reports a manual decline by the user — the case Claude Code explicitly excludes, since this event fires only for auto-classifier denials.",SubagentStart:"OMP emits `agent_start`, but its payload carries no agent identity and it fires for the main agent turn loop too, so a bridge would fabricate subagent events that never happened.",SubagentStop:'OMP emits `agent_end` with the same identity gap, so a "subagent stopped" hook would fire on every main-agent turn end.',MessageDisplay:"The event exists to rewrite what Claude Code renders via `displayContent`; OMP `message_update` / `message_end` expose no equivalent control over rendering.",PostToolBatch:`OMP dispatches tool calls individually and exposes no end-of-batch signal.`,UserPromptExpansion:"OMP has no signal for a typed command expanding before it reaches the model; its `input` event fires after expansion would already have happened.",StopFailure:`OMP exposes no signal distinguishing a failed stop from an ordinary one.`,Notification:`Notifications are OMP-side UI; no extension event is emitted when one is raised.`,Setup:`OMP has no first-run setup lifecycle event.`,TaskCreated:`The OMP todo surface emits no per-task creation event to extensions.`,TaskCompleted:`The OMP todo surface emits no per-task completion event to extensions.`,TeammateIdle:`OMP has no teammate concept and emits no idle signal for one.`,InstructionsLoaded:`OMP loads instruction files without emitting an extension event.`,ConfigChange:`OMP does not notify extensions when its configuration changes.`,CwdChanged:`OMP exposes no working-directory change event.`,FileChanged:`OMP has no file-watch surface exposed to extensions.`,WorktreeCreate:`OMP emits no worktree lifecycle events.`,WorktreeRemove:`OMP emits no worktree lifecycle events.`,Elicitation:`MCP elicitation is not surfaced to OMP extensions.`,ElicitationResult:`MCP elicitation is not surfaced to OMP extensions.`},Ft=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],It={PreCompact:"OMP `session_before_compact` does not say whether the compaction was manual or automatic, so a `trigger` matcher cannot be evaluated.",PostCompact:"OMP `session_compact` reports only whether an extension requested the compaction, not whether it was manual or automatic, so a `trigger` matcher cannot be evaluated.",SessionEnd:"OMP `session_shutdown` fires on process exit and carries no reason, so a `reason` matcher cannot be evaluated."},Lt={SessionStart:{resume:'covers a mid-session resume, which arrives as `session_switch` with `reason: "resume"`. A cold start under `--resume` never emits that signal — it reaches extensions through a bare `session_start` — so it presents as `startup` and a resume-scoped hook does not run there.',clear:`OMP emits no signal when a session is cleared.`}},Rt=x({type:ve(`command`),command:w,args:O(b(w)),async:O(S),asyncRewake:O(S),shell:O(ce([`bash`,`powershell`])),timeout:O(Le),if:O(w),statusMessage:O(w),once:O(S)}),zt=x({type:ce([`http`,`mcp_tool`,`prompt`,`agent`])}),Bt=D([Rt,zt]),V=x({matcher:O(w),hooks:b(Bt)}),Vt=x({PreToolUse:b(V).pipe(E(F([]))),PostToolUse:b(V).pipe(E(F([]))),PostToolUseFailure:b(V).pipe(E(F([]))),UserPromptSubmit:b(V).pipe(E(F([]))),Stop:b(V).pipe(E(F([]))),SessionStart:b(V).pipe(E(F([]))),SessionEnd:b(V).pipe(E(F([]))),PreCompact:b(V).pipe(E(F([]))),PostCompact:b(V).pipe(E(F([])))}),Ht=x({hooks:Vt,disableAllHooks:O(S)}),H=x({event:w,reason:w});x({unrecognized:b(H),notCarried:b(H),matcherNotEvaluable:b(H),matcherOutOfReach:b(H),shadowed:b(H),disabled:b(H)});const Ut=x({...Vt.fields,disableAllHooks:O(S),hooks:O(de)}).pipe(be(De(Ht),{decode:he(({disableAllHooks:e,...t})=>F(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e})),encode:je(()=>`Decode-only: settings are never encoded`)})),Wt=D([Ht,Ut]),Gt=A(Wt),Kt=Nt,qt=T(C(w,k)),Jt=[],Yt=T(b(x({matcher:O(w),hooks:b(x({type:O(w)})).pipe(E(F([])))})));function Xt(e){return ne(qt(e),e=>h(qt(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const U=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Zt={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},Qt=Mt,$t=Pt,en=It,tn=Ft,nn=Lt,rn=e=>i(Yt(e),()=>Jt).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),an=e=>rn(e).length>0;function on(e){return h(Xt(e),{onNone:()=>Zt,onSome:({isWrapped:e,namespace:t,outer:n})=>{let r=[],i=[],a=[],o=[],s=[];for(let n of Object.keys(t)){if(!e&&n===`disableAllHooks`)continue;let s=$t[n];if(s!==void 0){i.push({event:U(n),reason:s});continue}if(!Qt.includes(n)){r.push({event:U(n),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let c=en[n];c!==void 0&&an(t[n])&&a.push({event:U(n),reason:c});let l=nn[n];l!==void 0&&o.push(...rn(t[n]).flatMap(e=>{let t=l[e];return t===void 0?[]:[{event:`${U(n)} (matcher "${U(e)}")`,reason:t}]}))}if(e)for(let e of Object.keys(n))Qt.includes(e)&&s.push({event:U(e),reason:"ignored: this file wraps its hooks under `hooks`, so a group repeated at the top level is never read"});return{unrecognized:r,notCarried:i,matcherNotEvaluable:a,matcherOutOfReach:o,shadowed:s,disabled:[]}}})}function sn(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${U(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>Kt.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function cn(e){return h(Xt(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let n of Kt){let r=i(Yt(e[n]),()=>Jt);for(let e of r)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(U(n.type))}return Array.from(t)}})}function ln(e){let t={PreToolUse:[],PostToolUse:[],PostToolUseFailure:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[],PreCompact:[],PostCompact:[]};if(e.some(e=>e.managed&&e.settings.disableAllHooks===!0))return{hooks:t};let n=e.some(e=>!e.managed&&e.settings.disableAllHooks===!0);for(let r of e)if(!(n&&!r.managed))for(let e of Kt)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}function un(e){return en[e]!==void 0}function dn(e){return tn.includes(e)}const fn=`/etc/claude-code/managed-settings.json`,pn=(e,t)=>[`${e}/.claude/settings.json`,`${t}/.claude/settings.json`,`${t}/.claude/settings.local.json`,fn];var mn=class extends g()(`CollectSettingsGapsExecutorDeps`){};const W=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),hn=P(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*Ee,n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=[];for(let u of e){let e=yield*t.readFileString(u).pipe(Ye(()=>``));if(e===``)continue;let d=A(M(C(w,k)))(e);if(N(d)){l.push(u);continue}let f=on(d.value);n.push(...f.unrecognized),r.push(...f.notCarried),i.push(...f.matcherNotEvaluable),a.push(...f.matcherOutOfReach),o.push(...f.shadowed),c.push(...cn(d.value));let p=Gt(d.value);N(p)?l.push(u):s.push({settings:p.value,managed:u===fn,label:u})}return{coverage:{unrecognized:W(n),notCarried:W(r),matcherNotEvaluable:W(i),matcherOutOfReach:W(a),shadowed:W(o),disabled:W(sn(s))},unsupportedHookTypes:Array.from(new Set(c)),malformedFiles:Array.from(new Set(l))}});var gn=class extends g()(`LoadSettingsExecutorDeps`){};const _n=P(`loadSettingsFile`)(function*(e){let t=yield*(yield*Ee).readFileString(e).pipe(Ye(()=>``));if(t===``)return null;let n=A(M(C(w,k)))(t);if(N(n))return null;let r=n.value,i=Gt(r);return N(i)?null:i.value}),vn=P(`loadSettingsWithPaths`)(function*(e,t=fn){let n=[];for(let r of e){let e=yield*_n(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:ln(n)}),yn=gt(),bn=gt(),xn=`~effect/ChildProcessSpawner/ChildProcessHandle`,Sn={[xn]:xn,...a,toJSON(){return{_id:`ChildProcessHandle`,pid:this.pid}}},Cn=e=>Object.setPrototypeOf({...e},Sn),wn=e=>{let t=(t,n)=>e(t).pipe(Je(e=>ge(n?.includeStderr===!0?e.all:e.stdout)),fe),n=(e,n)=>Ae(t(e,n));return G.of({spawn:e,exitCode:t=>lt(rt(e(t),e=>e.exitCode)),streamString:t,streamLines:n,lines:(e,t)=>se(n(e,t)),string:(e,n)=>me(t(e,n))})};var G=class extends g()(`effect/process/ChildProcessSpawner`){};const Tn=`~effect/unstable/process/ChildProcess`,En={...oe({label:`Command`,evaluate(e){return re(e.context,G).spawn(this)}}),[Tn]:Tn},K=(e,t,n)=>Object.assign(Object.create(En),{_tag:`StandardCommand`,command:e,args:t,options:n}),Dn=function(...e){if(On(e[0])){let[t,...n]=e,r=jn(t,n);return K(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!On(e[0])){let t=e[0];return function(e,...n){let r=jn(e,n);return K(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return K(t,[],n)}let[t,n=[],r={}]=e;return K(t,n,r)},On=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),kn=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},An=e=>`fd${e}`,jn=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Mn(e,t,n,i,r);return n},Mn=(e,t,n,r,i)=>{let a=e.raw[i];if(a===void 0)throw Error(`Invalid backslash sequence: ${e.raw[i]}`);let{hasLeadingWhitespace:o,hasTrailingWhitespace:s,tokens:c}=In(r,a),l=Ln(n,c,o);if(i===t.length)return l;let u=t[i],d=Array.isArray(u)?u.map(e=>Nn(e)):[Nn(u)];return Ln(l,d,s)},Nn=e=>typeof e==`string`?e:String(e),Pn=new Set([` `,` `,`\r`,`
2
+ `]),Fn={x:3,u:5},In=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=Pn.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(Pn.has(o))i!==n&&r.push(e.slice(i,n)),i=n+1;else if(o===`\\`){let e=t[a+1];e===`
3
+ `?(--n,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=Fn[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},Ln=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)],Rn=(e,t,n)=>ct(e,t).pipe(rt(e=>vt(e)),mt(n.deadline),Je(e=>i(e,n.onDeadline))),zn=C(w,k),Bn={UserPromptSubmit:30},Vn=(e,t)=>(e??Bn[t]??600)*1e3,Hn=24e3,Un=(e,t,n)=>{let r=Vn(e,t);return!n||r<=Hn?{timeoutMs:r,capNote:``}:{timeoutMs:Hn,capNote:` (capped from ${r}ms by the extension handler budget)`}},Wn={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Gn=Ne(M(zn));var Kn=class extends g()(`RunHookScriptExecutorDeps`){};const q=P(`runHookScript`)(function*(e,t,n,r,i=!0){let a=yield*G,{timeoutMs:o,capNote:s}=Un(e.timeout,r,i),c=Gn(t),[l,u]=Wn[e.shell??`sh`],d={cwd:n,env:{OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n},stdin:_e([new TextEncoder().encode(c)]),stdout:`pipe`,stderr:`pipe`},f=e.args===void 0?Dn(l,[u,e.command],d):Dn(e.command,e.args,d),p=yield*Kn,m=lt(Ge(e=>Xe(function*(){let t=yield*a.spawn(f);yield*ut(()=>$e(t.kill({killSignal:`SIGKILL`})).pipe(ft(2e3),Ze));let[n,r,i]=yield*e(ot([me(ge(t.stdout)),me(ge(t.stderr)),t.exitCode.pipe(Je(Number),Ye(()=>-1))],{concurrency:`unbounded`}));return{code:i,stdout:n,stderr:r}}))).pipe(nt(t=>qe(`hook ${e.command} failed`,t)));return yield*Rn(m,p,{deadline:o,onDeadline:()=>({code:-1,stdout:``,stderr:`timeout after ${o}ms${s}`})})});var qn=Object.defineProperty,Jn=(e,t)=>{let n={};for(var r in e)qn(n,r,{get:e[r],enumerable:!0});return t||qn(n,Symbol.toStringTag,{value:`Module`}),n};we()(`CanonicalDecideError`,{});var Yn=Jn({make:()=>Xn});const Xn=(e,t)=>t;var Zn=class extends y()(`CanonicalCommand`,{}){};const Qn=Xn(Zn,e=>f(void 0));var J=Jn({DESCRIPTION_MODULE:()=>$n,IO_CELLS:()=>er,apply:()=>cr,canonical:()=>X,decide:()=>rr,decode:()=>nr,encode:()=>ir,read:()=>tr,vocabulary:()=>ur,write:()=>ar});const $n=`@systemfsoftware/effect-cell-types`,er={cells:[`store`,`adapter`],sources:[`effect/Clock`,`effect/System`]},Y=(e,t)=>{let n=e.layers,r=n[n.length-1];return{module:e.module,ioCells:e.ioCells,layers:[...n.slice(0,-1),{...r,phases:[...r?.phases??[],t]}]}},tr=(e,t)=>({"call read(command) before decode(raw)":!0,module:$n,ioCells:er,layers:[...t?.layers??[],{phases:[{name:`read`,kind:`impure`,convention:`effect`,run:e}]}]}),nr=v(2,(e,t)=>({"call decode(raw) before decide(decoded)":!0,...Y(e,{name:`decode`,kind:`pure`,convention:`either-fail`,run:t})})),rr=v(2,(e,t)=>({"call decide(decoded) before encode(decision)":!0,...Y(e,{name:`decide`,kind:`pure`,convention:`either-pass`,run:t})})),ir=v(2,(e,t)=>({"call encode(decision) before write(output)":!0,...Y(e,{name:`encode`,kind:`pure`,convention:`total`,run:t})})),ar=v(2,(e,t)=>({"call write(output) before applying the description":!0,...Y(e,{name:`write`,kind:`impure`,convention:`effect`,run:t})})),or=e=>u(e),sr=(e,t)=>Xe(function*(){let n=e.phases,r=n[n.length-1];if(!r||r.name!==`write`)return yield*I(Error(`effect-cell-types: a layer reached the interpreter without a write phase closing it`));let i=t;for(let e of n.slice(0,-1))switch(e.convention){case`effect`:i=yield*e.run(i);break;case`either-fail`:i=yield*s(e.run(i),{onFailure:tt,onSuccess:F});break;case`either-pass`:i=e.run(i);break;case`total`:if(!or(i))return yield*I(Error(`effect-cell-types: an encode phase received a value that is not the decide outcome`));i=e.run(i);break;default:return yield*I(Error(`effect-cell-types: unknown phase convention ${String(e)}`))}return yield*r.run(i)}),cr=(e,t)=>Xe(function*(){let n=yield*Ke(e.layers,e=>sr(e,t));return yield*h(c(n),{onNone:()=>I(Error(`effect-cell-types: a description reached the interpreter with no layers`)),onSome:F})}),X=ar(ir(rr(nr(tr(()=>pt),()=>f(Zn.make({}))),Qn),()=>void 0),()=>pt),lr=p(X.layers,e=>e.phases.map(({convention:e,kind:t,name:n})=>({convention:e,kind:t,name:n}))),ur={module:X.module,ioCells:X.ioCells,phases:lr,byKind:{pure:lr.filter(e=>e.kind===`pure`).map(e=>e.name),impure:lr.filter(e=>e.kind===`impure`).map(e=>e.name)},applier:`apply`},dr=x({code:Le,stdout:w,stderr:w});var fr=class extends y()(`Blocked`,{reason:w}){},pr=class extends y()(`Continue`,{warning:O(w),updatedInput:O(C(w,k))}){};D([fr,pr]);const mr=x({decision:O(w),reason:O(w),hookSpecificOutput:O(x({permissionDecision:O(w),permissionDecisionReason:O(w),updatedInput:O(C(w,k)),additionalContext:O(w)}))}).pipe(ke({toArbitrary:()=>e=>e.record({decision:e.string(),reason:e.string(),hookSpecificOutput:e.record({permissionDecision:e.string(),permissionDecisionReason:e.string(),updatedInput:e.dictionary(e.string(),e.jsonValue()),additionalContext:e.string()})})})),hr=w.pipe(be(De(mr),{decode:he(e=>Fe(M(De(mr)))(e).pipe(ht(e=>Ce(e)?e.issue:e))),encode:pe(e=>JSON.stringify(e))})),gr=A(hr),_r=(e,t)=>e===2?`ExitBlock`:e===0?t.trim().startsWith(`{`)?`ExitDecisionJson`:`ExitNoDecision`:`ExitOther`,vr=(e,t)=>{let n=e.trim();return n===``?`Blocked by ${t} hook`:n},yr=e=>e.trim()===``?`allow`:`warning`,br=e=>e.trim(),xr=(e,t)=>{let n=e??t;return n===`deny`||n===`block`?`block`:`allow`},Sr=(e,t,n,r)=>{let i=e===`deny`?t:n;return i===void 0||i.trim()===``?`Blocked by ${r} hook`:i};var Cr=class extends y()(`Block`,{reason:w}){},Z=class extends y()(`Allow`,{updatedInput:O(C(w,k))}){},wr=class extends y()(`Warning`,{message:w}){};D([Cr,Z,wr]);const Tr=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var Er=class extends y()(`InterpretHookCommand`,{result:dr,event:w,parsed:ue(mr)}){[Tr]=Tr};const Dr=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var Or=class extends we()(`HookVerdictError`,{raw:w}){[Dr]=Dr};const kr=e=>L(_r(e.result.code,e.result.stdout)).pipe(R(`ExitBlock`,()=>f(new Cr({reason:vr(e.result.stderr,e.event)}))),R(`ExitNoDecision`,()=>f(new Z({}))),R(`ExitDecisionJson`,()=>h(e.parsed,{onNone:()=>_(new Or({raw:e.result.stdout})),onSome:t=>L(xr(t.hookSpecificOutput?.permissionDecision,t.decision)).pipe(R(`block`,()=>f(new Cr({reason:Sr(t.hookSpecificOutput?.permissionDecision,t.hookSpecificOutput?.permissionDecisionReason,t.reason,e.event)}))),R(`allow`,()=>f(new Z({updatedInput:t.hookSpecificOutput?.updatedInput}))),B)})),R(`ExitOther`,()=>L(yr(e.result.stderr)).pipe(R(`warning`,()=>f(new wr({message:br(e.result.stderr)}))),R(`allow`,()=>f(new Z({}))),B)),B);var Ar=class extends y()(`SubmitVerdictCommand`,{cmd:Er,code:le,stdout:w}){};const jr=Be(`SubmitHookVerdictError`,{error:Or,code:le,stdout:w}),Mr=Yn.make(Ar,({cmd:e,code:t,stdout:n})=>o(kr(e),{onFailure:e=>jr.make({error:e,code:t,stdout:n}),onSuccess:e=>({verdict:e,code:t,stdout:n})})),Q={},Nr=T(zn),Pr=Te([]);g()(`@systemfsoftware/omp-claude-compat/AsyncHookContextState`);function Fr(e){let t=e.trim();t.length!==0&&st(Ie(Pr,e=>e.length>=64?[...e.slice(1),t]:[...e,t]))}function Ir(){return st(Se(Pr,[]))}var Lr=class extends g()(`SuperviseForkExecutorDeps`){};const Rr=(e,t,n)=>e.pipe(et({onSuccess:e=>{let t=gr(e.stdout);if(Ue(t)){let e=t.value.hookSpecificOutput?.additionalContext;e!==void 0&&Fr(e)}},onFailure:e=>{Ve(e)||t.ui.notify(`Background hook failed: ${n}: ${He(e).split(`
4
+ `)[0]}`,`error`)}}));var zr=class extends g()(`RunHooksForEventExecutorDeps`){};const Br=P(`runHooksForEventUnbounded`)(function*(t,r,a,o,c){let l=o.cwd,u=i(Nr(a.tool_input),()=>Q),p,m=a,ee=un(c),te=n(J.read(({hook:e,input:t})=>q(e,t,l,c)),J.decode(t=>f(new Ar({cmd:new Er({result:t,event:c,parsed:We(gr(t.stdout),{onFailure:()=>d(),onSuccess:e})}),code:t.code,stdout:t.stdout}))),J.decide(Mr),J.encode(e=>L(s(e,{onFailure:({error:e})=>new wr({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`}),onSuccess:({verdict:e})=>e})).pipe(z(`Block`,e=>new fr({reason:e.reason})),z(`Warning`,e=>new pr({warning:e.message})),z(`Allow`,e=>new pr({updatedInput:e.updatedInput})),B)),J.write(t=>at(()=>L(t).pipe(z(`Blocked`,t=>e({block:!0,reason:t.reason})),z(`Continue`,e=>(e.warning!==void 0&&p===void 0&&(p=e.warning),e.updatedInput!==void 0&&(m={...m,...e.updatedInput}),d())),B))));for(let e of t)if(!(ee&&e.matcher!==void 0)&&Pe(r,e.matcher))for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0&&(!dn(c)||!ze(t.if,r,u,l)))continue;if(t.async===!0||t.asyncRewake===!0){yield*Qe(Rr(q(t,m,l,c,!1),o,t.command));continue}let e=yield*J.apply(te,{hook:t,input:m});if(ie(e))return e.value}return{...m===a?{}:{updatedInput:m},...p===void 0?{}:{warning:p}}}),$=P(`runHooksForEvent`)(function*(e,t,n,r,i){return yield*Br(e,t,n,r,i).pipe(ft(26e3),it(`TimeoutError`,()=>F({})))});var Vr=class extends g()(`RunLifecycleHooksExecutorDeps`){};const Hr=P(`runLifecycleHooks`)(function*(e,t,n){let r=t.cwd,i={...j(()=>t.sessionManager.getSessionId())},a=un(n);yield*Ke(ae(e,e=>!(a&&e.matcher!==void 0)),e=>Ke(ae(e.hooks,e=>e.type===`command`&&e.if===void 0),e=>e.async===!0||e.asyncRewake===!0?Qe(Rr(q(e,i,r,n,!1),t,e.command)).pipe(dt):q(e,i,r,n).pipe(dt),{discard:!0}),{discard:!0})}),Ur=e=>e.reason===void 0?{}:{warning:e.reason};var Wr=class extends g()(`RunPostToolUseFailureHooksExecutorDeps`){};const Gr=T(b(x({text:O(w)}))),Kr=T(w),qr=e=>h(Gr(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
5
+ `),onNone:()=>i(Kr(e),()=>``)}),Jr=P(`runPostToolUseFailureHooks`)(function*(e,t,n){let r=Me(t.toolName),a=xe(r,i(Nr(t.input),()=>Q)),o={...j(()=>n.sessionManager.getSessionId()),tool_name:r,tool_input:a,tool_use_id:t.toolCallId,error:qr(t.content)},s=yield*$(e.hooks.PostToolUseFailure,r,o,n,`PostToolUseFailure`);return s.block===!0?Ur(s):s});var Yr=class extends g()(`RunPostToolUseHooksExecutorDeps`){};const Xr=P(`runPostToolUseHooks`)(function*(e,t,n){let r=Me(t.toolName),a=j(()=>n.sessionManager.getSessionId()),o=xe(r,i(Nr(t.input),()=>Q)),s=Oe(r,o),c=s.length===0?[o]:s.map(e=>({...o,file_path:e})),l,u={};for(let i of c){let o={...a,tool_name:r,tool_input:i,tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1},s=yield*$(e.hooks.PostToolUse,r,o,n,`PostToolUse`);if(s.block===!0)return Ur(s);l===void 0&&(l=s.warning),u=s}return l===void 0?u:{...u,warning:l}});var Zr=class extends g()(`RunPreCompactHooksExecutorDeps`){};const Qr=P(`runPreCompactHooks`)(function*(e,t){let n={...j(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)});var $r=class extends g()(`RunPreToolUseHooksExecutorDeps`){};const ei=P(`runPreToolUseHooks`)(function*(e,t,n){let r=Me(t.toolName),a=j(()=>n.sessionManager.getSessionId()),o=i(Nr(t.input),()=>Q),s=xe(r,o),c=ye(t.toolName,o);if(c!==void 0&&c.length>0){let r={...a,tool_name:`Bash`,tool_input:{command:c},tool_call_id:t.toolCallId},i=yield*$(e.hooks.PreToolUse,`Bash`,r,n,`PreToolUse`);if(i.block===!0)return i.reason===void 0?{block:!0}:{block:!0,reason:i.reason}}let l=Oe(r,s),u=l.length===0?[s]:l.map(e=>({...s,file_path:e})),d={};for(let i of u){let o={...a,tool_name:r,tool_input:i,tool_call_id:t.toolCallId},s=yield*$(e.hooks.PreToolUse,r,o,n,`PreToolUse`);if(s.block===!0)return s.reason===void 0?{block:!0}:{block:!0,reason:s.reason};d=s}let f=u.length===1?d.updatedInput?.tool_input:void 0;Object.assign(t.input,Re(o,f))});var ti=class extends g()(`RunSessionStartHooksExecutorDeps`){};const ni=P(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...j(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!Pe(t,e.matcher))){for(let t of e.hooks)if(t.type===`command`&&t.if===void 0){if(t.async===!0||t.asyncRewake===!0){yield*Qe(Rr(q(t,a,i,`SessionStart`,!1),n,t.command));continue}yield*q(t,a,i,`SessionStart`)}}});var ri=class extends g()(`RunSessionSwitchHooksExecutorDeps`){};const ii=P(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*ni(e,t,n))});var ai=class extends g()(`RunToolResultHooksExecutorDeps`){};const oi=P(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Jr(e,t,n):yield*Xr(e,t,n)}),si=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
6
+ `,`$\r`,`$$ `,`$$ `,`$$
7
+ `,`$$\r`],ci=e=>si.some(t=>`${e.trimStart()} `.startsWith(t));var li=class extends g()(`RunUserPromptSubmitHooksExecutorDeps`){};const ui=P(`runUserPromptSubmitHooks`)(function*(t,r,i){let a=t.hooks.UserPromptSubmit,o=i.cwd,c=ci(r.text),l=L(c).pipe(R(!0,()=>[]),R(!1,()=>Ir()),B),u=[],p={...j(()=>i.sessionManager.getSessionId()),prompt:r.text,source:r.source},m=n(J.read(({hook:e,input:t})=>q(e,t,o,`UserPromptSubmit`)),J.decode(t=>f(new Ar({cmd:new Er({result:t,event:`UserPromptSubmit`,parsed:We(gr(t.stdout),{onFailure:()=>d(),onSuccess:e})}),code:t.code,stdout:t.stdout}))),J.decide(Mr),J.encode(e=>s(e,{onFailure:({code:e,stdout:t})=>({blockReason:void 0,code:e,stdout:t}),onSuccess:({verdict:e,code:t,stdout:n})=>({blockReason:L(e).pipe(z(`Block`,e=>e.reason),jt(()=>void 0)),code:t,stdout:n})})),J.write(({blockReason:t,code:n,stdout:r})=>at(()=>{if(t!==void 0)return i.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${t}`,`error`),e({handled:!0});if(n!==0)return d();let a=r.trim();return a.length>0&&u.push(a),d()})));for(let e of a)for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0)continue;let e=yield*J.apply(m,{hook:t,input:p});if(ie(e))return e.value}return L(c).pipe(R(!0,()=>void 0),R(!1,()=>{let e=[...l,...u].join(`
8
+
9
+ `);if(e.length===0)return;let t={text:`${e}\n\n${r.text}`};return r.images!==void 0&&(t.images=r.images),t}),B)});export{mn as A,G as C,Cn as D,wn as E,pn as M,_t as N,gn as O,yt as P,kn as S,bn as T,zr as _,ri as a,An as b,ni as c,Zr as d,Qr as f,Hr as g,Vr as h,oi as i,hn as j,vn as k,$r as l,Wr as m,ui as n,ii as o,Yr as p,ai as r,ti as s,li as t,ei as u,Lr as v,yn as w,Dn as x,Kn as y};
package/dist/api.js ADDED
@@ -0,0 +1 @@
1
+ import{n as e}from"./HookRuntime-CyLjP9es.js";import{l as t}from"./HookDispatcherExecutor-BNRem4ll.js";export{e as HookScopeLive,t as onToolResult};
@@ -0,0 +1,26 @@
1
+ import{$a as e,$o as t,Aa as n,Ao as r,Bo as i,Ca as a,Cs as o,Da as s,Ds as c,Dt as l,Ea as u,Es as d,Ft as ee,Ga as te,Go as f,Hn as p,Jo as ne,Ka as m,M as re,Oo as ie,Os as h,Pt as ae,Qa as g,Qo as oe,Sa as se,Ts as ce,Ua as le,Uo as ue,Wo as de,Xa as fe,Xo as pe,Ya as me,Yo as he,Za as ge,aa as _e,as as _,bo as v,cs as ve,do as ye,ds as be,es as xe,fa as Se,fs as Ce,hs as we,ia as Te,is as Ee,ka as De,ko as Oe,lt as y,mi as ke,mo as Ae,ms as je,ns as Me,os as Ne,pi as Pe,ps as Fe,qa as Ie,qo as Le,ra as Re,ss as ze,ts as Be,ui as Ve,us as He,vo as Ue,vs as We,wo as Ge,ws as Ke,xs as b,y as qe,ys as Je,za as Ye}from"./effect-CKgkjFOq.js";import{a as x,d as Xe,u as Ze}from"./Cause-C0nAfay4.js";import{a as Qe,c as $e,n as et,r as tt,s as nt}from"./Exit-BNubcB4u.js";import{At as rt,Bt as it,C as at,D as ot,Dt as st,E as ct,G as lt,Ht as ut,I as S,K as dt,L as ft,M as pt,Mt as mt,Ot as ht,R as gt,Rt as _t,St as vt,T as yt,Tt as bt,U as xt,Vt as St,W as Ct,_ as C,a as wt,at as Tt,b as w,f as Et,ft as T,g as Dt,gt as Ot,ht as E,k as kt,kt as At,l as jt,mt as D,o as Mt,p as Nt,pt as Pt,ut as Ft,v as It,w as Lt,wt as Rt,x as O,y as zt,z as Bt,zt as Vt}from"./Effect-B9bZOysK.js";import Ht from"node:os";const Ut=`~effect/BigDecimal`,Wt={[Ut]:Ut,[Ee](){let e=Xt(this);return xe(Be(e.value),Me(e.scale))},[t](e){return Gt(e)&&en(this,e)},toString(){return`BigDecimal(${tn(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[ue](){return this.toJSON()},pipe(){return h(this,arguments)}},Gt=e=>_(e,Ut),Kt=(e,t)=>{let n=Object.create(Wt);return n.value=e,n.scale=t,n},qt=(e,t)=>{if(e!==k&&e%Jt===k)throw RangeError(`Value must be normalized`);let n=Kt(e,t);return n.normalized=n,n},k=BigInt(0),Jt=BigInt(10),Yt=qt(k,0),Xt=e=>{if(e.normalized===void 0){if(e.value===k)e.normalized=Yt;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=qt(r,i)}}return e.normalized},Zt=b(2,(e,t)=>t>e.scale?Kt(e.value*Jt**BigInt(t-e.scale),t):t<e.scale?Kt(e.value/Jt**BigInt(e.scale-t),t):e),Qt=e=>e.value<k?Kt(-e.value,e.scale):e,$t=pe((e,t)=>e.scale>t.scale?Zt(t,e.scale).value===e.value:e.scale<t.scale?Zt(e,t.scale).value===t.value:e.value===t.value),en=b(2,(e,t)=>$t(e,t)),tn=e=>{let t=Xt(e);if(Math.abs(t.scale)>=16)return nn(t);let n=t.value<k,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},nn=e=>{if(rn(e))return`0e+0`;let t=Xt(e),n=`${Qt(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${an(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},rn=e=>e.value===k,an=e=>e.value<k,on=`~effect/time/DateTime`,sn=`~effect/time/DateTime/TimeZone`,cn={[on]:on,pipe(){return h(this,arguments)},[ue](){return this.toString()},toJSON(){return un(this).toJSON()}};({...cn}),{...cn};const ln={[sn]:sn,[ue](){return this.toString()}};({...ln}),{...ln};const un=e=>new Date(e.epochMilliseconds);function dn(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function fn(e){return t=>dn(t)?.[e]}const pn=`~sentinels`,mn=`~constructor`,hn=fn(`brands`),gn=Ke(e=>{let t=dn(e)?.identifier;return typeof t==`string`?t:e.getExpected(gn)}),A=Symbol(),_n=nt,vn=_n(A),j=_n(A),yn=t=>t===A?g():e(t),bn=e=>e._tag===`None`?vn:_n(e.value),xn=`~effect/SchemaIssue/Issue`;function Sn(e){return _(e,xn)&&e[xn]===xn}function Cn(e){return Object.hasOwn(e,`input`)}var M=class{[xn]=xn;constructor(e,t){t?.reportInput===!0&&e!==A&&(this.input=e)}},wn=class extends M{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},Tn=class extends M{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},N=class extends M{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},En=class extends M{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Dn=class extends M{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},P=class extends M{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},On=class extends M{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},F=class extends M{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}};function kn(e,t,n,r,i){return new P(e,[new N([t],n)],r,i)}var An=class extends M{_tag=`Forbidden`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},jn=class extends M{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},Mn=class extends M{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function Nn(e,t,n){if(Sn(e))return e;if(typeof e==`string`)return new F({message:e},t,n);let r=typeof e.issue==`string`?new F({message:e.issue},t,n):e.issue;return new N(e.path,r)}function Pn(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new F(void 0,t,n):Nn(e,t,n)}function Fn(e,t,n,r){return Array.isArray(t)?s(t)?t.length===1?Nn(t[0],n,r):new P(e,De(t,e=>Nn(e,n,r)),n,r):void 0:Pn(t,n,r)}const In=e=>{let t=Gn(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Bn(gn(e.ast),e);case`InvalidValue`:{let t=zn(e);if(t!==void 0)return Bn(t,e);let n=Rn(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Rn(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Rn(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},Ln=e=>Gn(e.issue)??Gn(e);function Rn(e){return Cn(e)?f(e.input):void 0}function zn(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Bn(e,t){let n=Rn(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Vn(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Vn(e)).join(` & `)}}function Hn(){return e=>Wn(e,``)}const Un=Hn();function Wn(e,t){let n;switch(e._tag){case`Filter`:{let r=Ln(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Wn(e.issue,t);let r=zn(e.issue);n=r===void 0?Bn(Vn(e.filter),e):Bn(r,e.issue)}break}case`Encoding`:return Wn(e.issue,t);case`Pointer`:return Wn(e.issue,t+Le(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Wn(e,t)).join(`
2
+ `);n=Gn(e)??Bn(gn(e.ast),e);break;default:n=In(e)}return t?`${n}\n at ${t}`:n}function Gn(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Gn(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function Kn(e){let t;for(let n of e.reasons){if(!Ze(n)||!Sn(n.error))return;t??=n.error}return t}function qn(e,t){let n=Kn(e);if(n===void 0)throw Error(t,{cause:e});return n}Se()(`effect/DateTime/CurrentTimeZone`);var Jn=class e extends c{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(gt(fe(t))))}compose(t){return Qn(this)?t:Qn(t)?this:new e((e,n)=>this.run(e,n).pipe(O(e=>t.run(e,n))))}};function Yn(e){return new Jn((t,n)=>C(e(t,n)))}function Xn(e){return Yn((t,n)=>{let r={message:e(t)};return Ie(t)?new An(r,t.value,n):new An(r)})}const Zn=new Jn(T);function Qn(e){return e.run===Zn.run}function $n(){return Zn}function er(e){return new Jn((t,n)=>te(t)?Pt:e(t.value,n))}function I(e){return nr(fe(e))}function tr(t){return er((n,r)=>t(n,r).pipe(gt(e)))}function nr(e){return new Jn(t=>T(e(t)))}function rr(){return new Jn(()=>Pt)}function ir(t){return new Jn(n=>{let r=Ye(n,be);return Ie(r)?T(r):gt(t,e)})}function ar(){return I(globalThis.String)}function or(){return I(globalThis.Number)}function sr(t){return er((n,r)=>vt({try:()=>e(JSON.parse(n,t?.reviver)),catch:()=>new F({expected:`a valid JSON string`},n,r)}))}function cr(t){return er((n,r)=>vt({try:()=>{let r=JSON.stringify(n,t?.replacer,t?.space);if(r===void 0)throw TypeError(`Value cannot be represented as JSON`);return e(r)},catch:()=>new F({expected:`a JSON-serializable value`},n,r)}))}const lr=`~effect/SchemaTransformation/Transformation`;var L=class e{[lr]=lr;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function ur(e){return _(e,lr)&&e[lr]===lr}const dr=e=>ur(e)?e:new L(e.decode,e.encode);function fr(e){return new L(I(e.decode),I(e.encode))}const pr=new L($n(),$n());function mr(){return pr}const hr=new L(or(),ar());function gr(e){return new L(sr(e??{}),cr(e))}function R(e){return t=>t._tag===e}const _r=R(`Declaration`),vr=R(`Never`),yr=R(`Literal`),br=R(`UniqueSymbol`),xr=R(`Arrays`),Sr=R(`Objects`),Cr=R(`Suspend`);var z=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const wr={};var B=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}};const Tr=`~effect/Schema`;var V=class{[Tr]=Tr;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Er=class e extends V{_tag=`Declaration`;typeParameters;run;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o}getParser(){let e;return(t,n)=>t===A?vn:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(t,n,r){let i=Li(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.run,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}};const Dr=new class extends V{_tag=`Null`;getParser(){return $i(this,null)}getExpected(){return`null`}};var Or=class extends V{_tag=`Undefined`;getParser(){return $i(this,void 0)}toCodecJson(){return U(this,[kr])}getExpected(){return`undefined`}};const kr=new z(Dr,new L(I(()=>void 0),I(()=>null))),Ar=new Or,jr=new class extends V{_tag=`Never`;getParser(){return ea(this,ve)}getExpected(){return`never`}},Mr=new class extends V{_tag=`Unknown`;getParser(){return ea(this,We)}getExpected(){return`unknown`}};var H=class extends V{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${f(e)}`);this.literal=e}getParser(){return $i(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Nr(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Nr(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Nr(e){let t=globalThis.String(e.literal);return U(e,[new z(new H(t),new L(I(()=>e.literal),I(()=>t)))])}const Pr=new class extends V{_tag=`String`;getParser(){return ea(this,we)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&la(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}};var Fr=class extends V{_tag=`Number`;getParser(){return ea(this,Ce)}matchKey(e,t){return this._match(ia,e,t)}matchPart(e,t){return this._match(ra,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:la(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(Ir(this.checks,`effect/schema/isFinite`)||Ir(this.checks,`effect/schema/isInt`))?this:U(this,[bi])}toCodecStringTree(){return this.toCodecJson()===this?U(this,[sa]):U(this,[ca])}getExpected(){return`number`}};function Ir(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&Ir(e.checks,t))}const Lr=new Fr,Rr=new class extends V{_tag=`Boolean`;getParser(){return ea(this,Ne)}getExpected(){return`boolean`}};var zr=class e extends V{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(Ki(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(Ki(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}return yt(function*(e,c){if(e===A)return A;if(!Array.isArray(e))return yield*C(new On(n,e,c));r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)})));let l=e.length,u={ast:n,getParser:s,input:e,len:l,tailThreshold:Math.max(a,l-o),output:new globalThis.Array(l),issues:void 0,options:c},d=Vr(c?.concurrency),ee=Br(u,e,{concurrency:d?.concurrency,end:n.rest.length===0?a:Math.max(l,a+o)});if(ee&&(yield*ee),n.rest.length===0&&l>a)for(let t=a;t<=l-1;t++){let r=new Dn(n,e[t],c),i=new N([t],r);if(c.errors===`all`)u.issues?u.issues.push(i):u.issues=[i];else return yield*C(new P(n,[i],e,c))}return u.issues?yield*C(new P(n,u.issues,e,c)):u.output})}_rebuild(t,n,r){let i=Li(this.elements,t),a=Li(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};const Br=p()({onItem(e,t,n){let r=n<e.len?t:A;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Hr(e,e.ast,r,n);let i=n===j?t:n[v];if(i!==A)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Ki(t.ast))return;let n=new N([r],new En(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return et(new P(e.ast,[n],e.input,e.options))}}}),Vr=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Hr=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Kn(r.cause);if(i===void 0)return tt(Xe(r.cause,r=>new P(t,[new N([n],r)],e.input,e.options)));let a=new N([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return et(new P(t,[a],e.input,e.options))},Ur=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function Wr(e,t,n=wr){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(ta(W(t)))}var Gr=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Kr(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Kr);default:return!1}}function qr(e){return Kr(e)&&Kr(W(e))}var Jr=class{parameter;type;constructor(e,t){if(!qr(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Ki(t)&&!Qi(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Yr=class e extends V{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let e of n.propertySignatures)r.push(e.name);let i=r.length,o=n.indexSignatures.length,s=i&&o?new Set(r):void 0;if(!i&&!o)return ea(n,He);let c,l,u=(e,t,r,a,o)=>{if(o._tag===`Failure`)return Hr(e,n,t,o)??$e;let c=o===j?a:o[v];if(r!==A&&c!==A){if(i&&(s.has(t)||s.has(r)))return $e;he(e.out,r,c)}return $e},d=(e,t,r,i)=>{if(!i){let n=r.parserKey(t,e.options);if(!y(n))return w(Dt(n),n=>d(e,t,r,n));i=n}if(i._tag===`Failure`)return Hr(e,n,t,i)??$e;let a=i===j?t:i[v],o=e.input[t],s=r.parserValue(o,e.options);return y(s)?u(e,t,a,o,s):w(Dt(s),n=>u(e,t,a,o,n))},ee=(e,t,n)=>{let r=e.input[t],i=n.parserValue(r,e.options);return y(i)?u(e,t,t,r,i):w(Dt(i),n=>u(e,t,t,r,n))},te=o?p()({onItem:(e,[t,n])=>d(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return yt(function*(u,f){if(u===A)return A;if(!(typeof u==`object`&&u&&!Array.isArray(u)))return yield*C(new On(n,u,f));c||(c=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),l=o?n.indexSignatures.map(n=>({is:n,parserKey:e(ta(n.parameter)),parserValue:t(n.type)})):void 0);let p=u,ne={},m={ast:n,input:p,out:ne,issues:void 0,options:f},re=f.errors===`all`,ie=f.onExcessProperty===`error`,h=f.onExcessProperty===`preserve`,ae;if(!o&&(ie||h)){s??=new Set(r),ae=Reflect.ownKeys(p);for(let e=0;e<ae.length;e++){let t=ae[e];if(!s.has(t)){if(ie){let e=new Dn(n,p[t],f),r=new N([t],e);if(re){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*C(new P(n,[r],u,f))}he(ne,t,p[t])}}}let g=Vr(f?.concurrency);if(i){let e=Xr(m,c,g);e&&(yield*e)}if(o&&!g)for(let e=0;e<o;e++){let t=l[e],n=t.is.parameter===Pr?ee:d,r=t.is.parameter===Pr?Object.keys(p):Wr(p,t.is.parameter,f);for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!y(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(te){let e=a();for(let t=0;t<o;t++){let n=l[t],r=Wr(p,n.is.parameter,f);for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=te(m,e,g);t&&(yield*t)}if(m.issues)return yield*C(new P(n,m.issues,u,f));if(f.propertyOrder===`original`){let e=(ae??Reflect.ownKeys(p)).concat(r),t={};for(let n of e)Object.hasOwn(ne,n)&&he(t,n,ne[n]);return t}return ne})}_rebuild(t,n,r,i){let a=Li(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Gr(e.name,n)}),o=Li(this.indexSignatures,e=>{let r=n(e.parameter),i=t(e.type);return r===e.parameter&&i===e.type?e:new Jr(r,i)});return a===this.propertySignatures&&o===this.indexSignatures&&r===this.checks&&i===this.encodingChecks?this:new e(a,o,this.annotations,r,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const Xr=p()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(A,e.options);let n=e.input[t.name];return he(e.out,t.name,n),t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return Hr(e,e.ast,t.name,n);if(n===j)return;let r=n[v];if(r!==A){he(e.out,t.name,r);return}if(delete e.out[t.name],!Ki(t.type)){let n=new N([t.name],new En(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return et(new P(e.ast,[n],e.input,e.options))}}});function Zr(e,t){return e?t?[...e,...t]:e:t}function Qr(e,t,n){return new Yr(Reflect.ownKeys(e).map(t=>new Gr(t,e[t].ast)),[],n,t)}function $r(e){return e.ast}function ei(e,t,n){return new li(e.map($r),t,void 0,n)}const ti=ce(e=>{for(;;){if(Cr(e))return Mr;let t=e.encoding;if(!t)return e.recur?.(ti,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return Mr;e=t[t.length-1].to}});function ni(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(ni)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function ri(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[pn];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Ki(t)){if(yr(t))return[{key:e.name,literal:t.literal}];if(br(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Ki(e)){if(yr(e))return[{key:t,literal:e.literal}];if(br(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>ri(ti(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return ri(e.thunk())}}const ii=new WeakMap,ai=Object.freeze([]);function oi(e){let t=ii.get(e);if(t)return t;let n,r=0,i,a,o=!0;for(let t=0;t<e.length;t++){let s=e[t],c=ti(s);if(vr(c))continue;if(o){if(yr(c)||br(c)){a??=new Map;let e=yr(c)?c.literal:c.symbol,t=a.get(e);t||a.set(e,t=[]),t.push(s)}else o=!1}let l=ri(c);if(l.length){n??=new Map,r++;for(let{key:e,literal:r}of l){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=ni(c);for(let n of e)(i[n]??=[]).push(t)}}if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??ai;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=i;for(let[t,n]of i)a.set(t,Object.freeze(Array.from(n,t=>e[t])));t=(t,n)=>{if(Fe(t)){let i=Object.hasOwn(t,r)?t[r]:void 0;if(i!==void 0)return a.get(i)??ai;if(n)return e}return ai}}else if(n){let a;for(let e of n)(!a||e[1][0].size>a[1][0].size)&&e[1][1].size===r&&(a=e);t=(t,r)=>{let o=i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??ai;if(!Fe(t))return o.map(t=>e[t]);let s=new Set(o),c;if(a){let[n,[i]]=a,l=Object.hasOwn(t,n),u=l?t[n]:void 0;if(l&&(!r||u!==void 0)){let t=i.get(u);if(!t)return o.map(t=>e[t]);for(let e of t)s.add(e);c=n}}if(c===void 0)for(let[e,[i,a]]of n){let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);if(e)for(let t of e)s.add(t)}else if(r)for(let e of a)s.add(e)}for(let[e,[i,a]]of n){if(e===c)continue;let n=Object.hasOwn(t,e),o=n?t[e]:void 0;if(n&&(!r||o!==void 0)){let e=i.get(o);for(let t of s)a.has(t)&&!e?.has(t)&&s.delete(t)}}return Array.from(s).sort((e,t)=>e-t).map(t=>e[t])}}else t=t=>(i?.[t===null?`null`:Array.isArray(t)?`array`:typeof t]??ai).map(t=>e[t]).filter(si(t));return ii.set(e,t),t}function si(e){return t=>{let n=ti(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function ci(e,t,n=!1){return oi(t)(e,n)}var li=class e extends V{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e,t){let n=this;return(r,i)=>{if(r===A)return vn;let a=ci(r,n.types,t!==void 0);if(a.length===1){let t=e(a[0])(r,i);return t._tag===`Success`?t:y(t)?ui(n,t.cause,r,i):jt(t,e=>ui(n,e,r,i))}let o={ast:n,compile:e,input:r,out:void 0,successes:n.mode===`oneOf`?[]:void 0,issues:void 0,options:i},s=Vr(i?.concurrency),c=di(o,a,s?{...s,orderedStep:!0}:void 0);return c?O(c,e=>o.out===j?T(r):o.out?o.out:C(new jn(n,o.issues??[],r,i))):o.out?o.out:C(new jn(n,o.issues??[],r,i))}}_rebuild(t,n,r){let i=Li(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=W(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(yr);if(t.length>0)return`${pi(n.isMutable)}[ ${t.map(t=>e(t)+mi(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>yr(e.type));if(t.length>0)return`{ ${t.map(t=>`${pi(t.type.context?.isMutable)}${ne(t.name)}${mi(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function ui(e,t,n,r){let i=Kn(t);return i?et(new jn(e,[i],n,r)):tt(t)}const di=p()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Kn(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(t),et(new Mn(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return $e}}}),fi=new li([new H(`Infinity`),new H(`-Infinity`),new H(`NaN`)],`anyOf`);function pi(e){return e?``:`readonly `}function mi(e){return e?`?`:``}var hi=class e extends c{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new gi([this,e],t)}},gi=class e extends c{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function _i(e,t,n=!1){return new hi((t,n,r)=>Fn(n,e(t,n,r),t,r),t,n)}function vi(e){return _i(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}const yi=Oi(Lr,[vi()]),bi=new z(new li([yi,fi],`anyOf`),new L(or(),I(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function xi(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return _i(e=>(r.lastIndex=0,r.test(e)),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Si(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}const Ci=new WeakMap;function wi(e){return Ci.get(e)??e}function U(e,t){return e.encoding===t?e:Si(e,e=>{e.encoding.value=t})}function Ti(e,t){if(e.context===t)return e;let n=wi(e);if(n.context===t)return n;let r=Si(e,e=>{e.context.value=t});return Ci.set(r,n),r}function Ei(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Di(e,se(e.checks.slice(0,-1),n.annotate(t)))}return Si(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Di(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Si(e,e=>{e.checks.value=t})}function Oi(e,t){return Di(e,Zr(e.checks,t))}function ki(e,t){let n=t(e.to);return n===e.to?e:new z(n,e.transformation)}function Ai(e,t){let n=e,r=n[n.length-1],i=ki(r,t);return i===r?e:se(e.slice(0,e.length-1),i)}function ji(e){return t=>t.encoding?U(t,Ai(t.encoding,e)):t}function Mi(e,t){return ji(e=>Ti(e,t))(e)}function Ni(e){function t(n){return n.encoding?U(n,Ai(n.encoding,t)):e(n)}return Ke(t)}function Pi(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:U(r,Ai(r.encoding,n))}return e(r)}return ce(n)}function Fi(e,t,n){let r=new z(e,t);return U(n,n.encoding?[...n.encoding,r]:[r])}function Ii(e,t){let n=hn(e);return Ei(e,{brands:n?[...n,t]:[t]})}function Li(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Ri(e,t){return Ti(e,e.context?new B(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new B(!1,!1,void 0,t))}const zi=ce(e=>{let t=e.context?e.context.isOptional===!1?new B(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new B(!0,!1);return Bi(Ti(e,t))}),Bi=ji(zi),Vi=Ke(e=>zi(new li([e,Ar],`anyOf`)));function Hi(e,t){let n=new L(ir(t),$n()),r=new z(Mr,n);return Ti(e,e.context?new B(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new B(!1,!1,r))}function Ui(e,t,n){return Fi(e,n,t)}function Wi(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:je(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function Gi(e,t){let{literals:n,parameters:r}=Wi(e);return new Yr(n.map(e=>new Gr(e,t)),r.map(e=>new Jr(e,t)))}function Ki(e){return e.context?.isOptional??!1}function qi(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(qi)}function Ji(e){function t(e){return qi(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return u(n)?n:void 0}const Yi=ce(e=>{if(e.encoding)return Yi(U(e,void 0));let t=e,n=t.recur?.(Yi)??t,r=n.encodingChecks;if(r){let t=n===e?r:xr(n)||Sr(n)||_r(n)&&n.typeParameters.length>0?Ji(r):void 0;return Si(n,e=>{e.encodingChecks.value=void 0,e.checks.value=Zr(n.checks,t)})}return n}),W=ce(e=>Yi(Zi(e)));function Xi(e,t){let n=t,r=n.length,i=n[r-1],a=[new z(Zi(U(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new z(Zi(n[e-1].to),n[e].transformation.flip()));let o=Zi(i.to);return o.encoding?U(o,[...o.encoding,...a]):U(o,a)}const Zi=Ke(e=>{if(e.encoding)return Xi(e,e.encoding);let t=e;return t.flip?.(Zi)??t.recur?.(Zi)??t});function Qi(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Qi);default:return!1}}function $i(e,t){let n=_n(t);return(r,i)=>r===A?vn:r===t?n:C(new On(e,r,i))}function ea(e,t){return(n,r)=>n===A?vn:t(n)?j:C(new On(e,n,r))}const ta=Pi(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(ta)}}),na=Pi(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(na)}}),ra=new globalThis.RegExp(`^${Ur}$`),ia=new globalThis.RegExp(`^(?:${Ur}|Infinity|-Infinity|NaN)$`);function aa(e){return xi(ra,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:ra.source}),...e})}const oa=Oi(Pr,[aa()]),sa=new z(oa,hr),ca=new z(new li([oa,fi],`anyOf`),hr);function la(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=la(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new wn(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function ua(e){if(!_r(e))return;let t=e.annotations?.[mn];return ze(t)?t(e.typeParameters):void 0}function da(e){return e===void 0||typeof e==`string`}function fa(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function pa(e){return fa(e,da)}const ma=new z(new Er([],()=>(e,t,n)=>pa(e)?j:C(new On(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),mr()),ha=`~effect/collections/MutableHashMap`,ga={[ha]:ha,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${f(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:de(Array.from(this))}},[ue](){return this.toJSON()},pipe(){return h(this,arguments)}},_a=()=>{let e=Object.create(ga);return e.backing=new Map,e.buckets=new Map,e},va=b(2,(t,n)=>{if(t.backing.has(n))return e(t.backing.get(n));if(ba(n))return g();let r=ya.get(t);if(r!==void 0)return t.backing.has(r)?e(t.backing.get(r)):g();let i=Be(n),a=t.buckets.get(i);return a===void 0?g():xa(t,a,n)}),ya=new WeakMap,ba=e=>typeof e!=`object`&&typeof e!=`function`,xa=(t,n,r)=>{for(let i=0,a=n.length;i<a;i++)if(oe(r,n[i])){let a=n[i];return ya.set(r,a),e(t.backing.get(a))}return g()},Sa=b(3,(e,t,n)=>{if(e.backing.has(t)||ba(t))return e.backing.set(t,n),e;let r=ya.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=Be(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=Ca(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),Ca=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(oe(t,e[n]))return ya.set(t,e[n]),e[n]},wa=`~effect/MutableRef`,Ta={[wa]:wa,...Ue,toJSON(){return{_id:`MutableRef`,current:de(this.current)}}},Ea=e=>{let t=Object.create(Ta);return t.current=e,t},Da=Symbol.for(`effect/MutableList/Empty`),Oa=()=>({head:void 0,tail:void 0,length:0}),ka=()=>({array:[],mutable:!0,offset:0,next:void 0}),G=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=ka(),e.tail=e.tail.next):e.head=e.tail=ka(),e.tail.array.push(t),e.length++},Aa=e=>{e.head=e.tail=void 0,e.length=0},ja=(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 Aa(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&&Aa(e),n;i=i.next}return Aa(e),n},Ma=e=>{if(!e.head)return Da;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Aa(e)),t},Na={_A:o,_E:o},Pa={"~effect/Queue":Na,"~effect/Queue/Enqueue":Na,"~effect/Queue/Dequeue":Na,...Ue,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:qa(this)}}},Fa=e=>i(t=>{let n=Object.create(Pa);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=Oa(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},Ve(n)}),Ia=e=>Fa({capacity:e}),La=(e,t)=>Pe(()=>{if(e.state._tag!==`Open`)return Ja;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Ja;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(G(e.messages,t),Qa(e),Ya):to(e,t);case`sliding`:return Ma(e.messages),G(e.messages,t),Ya}return G(e.messages,t),$a(e),Ya}),Ra=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Ma(e.messages),G(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(G(e.messages,t),Qa(e),!0):(G(e.messages,t),$a(e),!0):!1,za=b(2,(e,t)=>ke(()=>Ba(e,t))),Ba=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Oe(t),r=ee(n,Xa);return e.state.offers.size===0&&e.messages.length===0?(io(e,r),!0):(e.state={...e.state,_tag:`Closing`,exit:r},!0)},Va=e=>Ba(e,Ge(ye())),Ha=e=>ke(()=>{if(e.state._tag===`Done`)return!0;Aa(e.messages);let t=e.state.offers;if(io(e,e.state._tag===`Open`?Za:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Ja):e.resume(r(e.remaining.slice(e.offset)));t.clear()}return!0}),Ua=e=>Wa(e,1,1/0),Wa=(e,t,n)=>Pe(()=>eo(e,t,n)??qe(ro(e),Wa(e,1,n))),Ga=e=>Pe(()=>Ka(e)??qe(ro(e),Ga(e))),Ka=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Ma(e.messages);return no(e),r(t)}if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,no(e),e.capacity=0;let t=Ma(e.messages);return no(e),r(t)}},qa=e=>e.state._tag===`Done`?0:e.messages.length,Ja=r(!1),Ya=r(!0),Xa=ie(ye()),Za=l(),Qa=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(ae),e.messages.length===0)break}},$a=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>Qa(e),0))},eo=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return r([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,no(e),e.capacity=0;let t=[Ma(e.messages)];return no(e),r(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=ja(e.messages,n);return no(e),r(t)}},to=(e,t)=>re(n=>{if(e.state._tag!==`Open`)return n(Ja);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),ke(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),no=e=>{if(e.state._tag===`Done`)return At(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(io(e,e.state.exit),At(e.state.exit.cause));let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)G(e.messages,n.message),t--,n.resume(Ya),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;G(e.messages,n.remaining[n.offset]),t--}n.resume(r([])),e.state.offers.delete(n)}return!1},ro=e=>re(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),ke(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),io=(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()},ao=`~effect/Channel`,oo=e=>_(e,ao),so={[ao]:{_Env:o,_InErr:o,_InElem:o,_OutErr:o,_OutElem:o},pipe(){return h(this,arguments)}},K=e=>{let t=Object.create(so);return t.transform=(t,n)=>jt(e(t,n),e=>T(It(e))),t},co=(e,t)=>K((n,r)=>w(q(e)(n,r),e=>t(e,r))),lo=e=>K((t,n)=>e),uo=e=>K(Lt(function*(t,n){let r=it(n),i=e=>Vt(r,ht(e)),a=yield*xt(e(t,n,r),i);return xt(a,i)})),q=e=>e.transform,fo=4096,po=(e,t,n)=>Fa({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Ot(t=>_t(e,Ha(t))),Ot(n=>kt(ut(t(n),e),e))),mo=(e,t)=>K((n,r)=>S(po(r,e,t),Ua)),ho=e=>K((t,n)=>D(()=>q(e())(t,n))),go=(t,n=fo)=>lo(E(()=>{let r=t(),i=g();return D(()=>{if(i._tag===`Some`)return x(i.value);let t=[];for(;t.length<n;){let n=r.next();if(n.done){if(t.length===0)return x(n.value);i=e(n.value);break}t.push(n.value)}return T(t)})})),_o=(e,t=fo)=>go(()=>e[Symbol.iterator](),t),vo=e=>bo(T(e)),yo=lo(T(x())),bo=e=>lo(E(()=>{let t=!1;return D(()=>t?x():(t=!0,e))})),xo=b(2,(e,t)=>co(e,e=>E(()=>{let n=0;return S(e,e=>t(e,n++))}))),So=b(2,(e,t)=>Co(e,e=>T(t(e)))),Co=b(2,(e,t)=>co(e,e=>T(st(e,e=>w(t(e),x))))),wo=b(e=>oo(e[0])&&oo(e[1]),(e,t,n)=>uo(Lt(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*Ia(0);yield*_t(a,Ha(s));let c=0;function l(e,t){if(c++,!At(t))return za(s,t);switch(o){case`both`:return c===2?za(s,t):Rt;case`left`:case`right`:return e===o?za(s,t):Rt;case`either`:return za(s,t)}}let u=(e,t,n)=>q(t)(r,n).pipe(w(e=>e.pipe(w(e=>La(s,e)),ot)),xt(t=>wt(Vt(n,ht(t)),l(e,t))),kt(a));return yield*u(`left`,e,it(a)),yield*u(`right`,t,it(a)),Ga(s)}))),To=()=>K((t,n)=>E(()=>{let n=``,r=!1,i=g();function a(e){let t=[];function i(e){n.length===0?t.push(e):(t.push(n+e),n=``)}for(let t=0;t<e.length;t++){let a=e[t];if(a.length!==0){let e=0,t=a.indexOf(`\r`),o=a.indexOf(`
3
+ `);for(r&&=(o===0?(i(``),e=1,o=a.indexOf(`
4
+ `,e)):i(``),!1);t!==-1||o!==-1;)t===-1||o!==-1&&o<t?(i(a.substring(e,o)),e=o+1,o=a.indexOf(`
5
+ `,e)):a.length===t+1?(r=!0,t=-1):(i(a.substring(e,t)),e=t+(o===t+1?2:1),t=a.indexOf(`\r`,e),o=a.indexOf(`
6
+ `,e));n+=a.substring(e,a.length-+!!r)}}return s(t)?t:null}let o=D(()=>i._tag===`Some`?x(i.value):rt(t,{onSuccess:c,onFailure:It,onDone:t=>{if(i=e(t),n.length>0||r){let e=n;return n=``,r=!1,T([e])}return x(t)}}));function c(e){let t=a(e);return t===null?o:T(t)}return o})),Eo=b(2,(e,t)=>K((n,r)=>w(q(e)(n,r),e=>q(t)(e,r)))),Do=e=>K((t,n)=>{let r;return T(D(()=>r||e.pipe(ut(n),w(e=>q(e)(t,n)),w(e=>r=e))))}),Oo=(e,t,n)=>D(()=>{let r=St(),i=q(e)(x(),r);return st(w(i,t),n||T).pipe(Ct(e=>Vt(r,e)))}),ko=b(3,(e,t,n)=>D(()=>{let r=t();return Oo(e,e=>bt({while:Je,body:()=>e,step:e=>{r=n(r,e)}}),()=>T(r))})),Ao=(e,t)=>q(e)(x(),t);function jo(e){let t=Uo(qo,Yi(e.ast));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Mo(t){let n=jo(t);return(t,r)=>{let i=Tt(n(t,r));return Qe(i)?e(i.value):(qn(i.cause,`Option adapter can only return none for schema issues`),g())}}function No(e){let t=jo(e);return(e,n)=>{let r=Tt(t(e,n));if(Qe(r))return r.value;let i=qn(r.cause,`Constructor adapter can only throw schema issues`);throw Error(`Schema validation failed`,{cause:i})}}function Po(e){return Fo(e.ast)}function Fo(e){let t=Wo(Ho(Yi(e)));return e=>{let n=t(e,wr);return Qe(n)?!0:(qn(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}function Io(e,t){let n=Ho(e.ast);return t===void 0?n:(e,r)=>n(e,Bo(t,r))}function Lo(e,t){return Wo(Io(e,t))}function Ro(e,t){return Go(Io(e,t))}function zo(e,t){let n=Ho(Zi(e.ast));return t===void 0?n:(e,r)=>n(e,Bo(t,r))}const Bo=(e,t)=>t?{...e,...t}:e,Vo=e=>e===A?C(new F):T(e);function Ho(e){return Uo(Ko,e)}function Uo(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??wr);return a===j?T(r):y(a)?a[v]===A?Vo(A):a:O(a,Vo)}}function Wo(e){return(t,n)=>Tt(e(t,n))}function Go(t){let n=Wo(t);return(t,r)=>{let i=n(t,r);return Qe(i)?e(i.value):(qn(i.cause,`Option adapter can only return none for schema issues`),g())}}const Ko=Ke(e=>Qo(e,Ko)),qo=Ke(e=>Qo(e,qo,Yo)),Jo=Ke(e=>Qo(e,qo,Yo,e.context?.constructorDefault));function Yo(e){return e.context?.constructorDefault?Jo(e):qo(e)}function Xo(e,t,n,r){let i;if(y(e)&&e._tag===`Success`){let a=yn(e===j?t:e[v]);i=n._tag===`Transformation`?n.decode.run(a,r):n.decode(_n(a),r)}else i=n._tag===`Transformation`?O(e,e=>n.decode.run(yn(e),r)):n.decode(gt(e,yn),r);return y(i)&&i._tag===`Success`?bn(i[v]):O(i,bn)}function Zo(e,t){let n;return(r,i)=>r===A?vn:e.isConstructed(r)?j:Xo((n??=t(e.link.to))(r,i),r,e.link.transformation,i)}function Qo(e,t,n,r){let i=n?ua(e):void 0,a=i?Zo(i,t):e.getParser(t,n),o=e.checks,s=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,l=(o?o[o.length-1].annotations:e.annotations)?.parseOptions;if(!s&&!o&&!c)return l?(e,t)=>a(e,Bo(t,l)):a;let u,d=(t,n)=>{let r=a(t,n);if(c&&!n.disableChecks){if(y(r)){if(r._tag===`Success`){let i=r===j?t:r[v];if(t!==A&&i!==A){let i=la(c,t,void 0,e,n);i&&(r=C(new P(e,i,t,n)))}}}else r=w(r,r=>{if(t!==A&&r!==A){let r=la(c,t,void 0,e,n);if(r)return C(new P(e,r,t,n))}return T(r)})}if(o&&!n.disableChecks){if(y(r)){if(r._tag===`Success`){let i=r===j?t:r[v];if(i===A)return r;let a=la(o,i,void 0,e,n);a&&(r=C(new P(e,a,i,n)))}}else r=w(r,t=>{if(t!==A){let r=la(o,t,void 0,e,n);if(r)return C(new P(e,r,t,n))}return T(t)})}return r};return s?(n,r)=>{l&&(r=Bo(r,l));let i=u??=s.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=s.length-1;e>=0;e--)if(o=Xo(o,a,s[e].transformation,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[v],o=t(a,r)):o=O(o,e=>{let n=t(e,r);return n===j?_n(e):n})}if(o._tag===`Success`){let e=o[v],t=d(e,r);return t===j?o:t}return o=jt(o,t=>zt(()=>Xe(t,t=>new Tn(e,t,n,r)))),O(o,e=>{let t=d(e,r);return t===j?_n(e):t})}:l?(e,t)=>d(e,Bo(t,l)):d}const $o=`~effect/Schema/Schema`,es={[$o]:$o,pipe(){return h(this,arguments)},annotate(e){return this.rebuild(Ei(this.ast,e))},annotateKey(e){return this.rebuild(Ri(this.ast,e))},check(...e){return this.rebuild(Oi(this.ast,e))}};function ts(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,es),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=e=>ts(e,t),r.makeEffect=jo(r),r.make=No(r),r.makeOption=Mo(r),r}const ns=e=>e,rs=$o;function is(){return(e,t,n)=>J(new Er(e.map($r),e=>t(e.map(e=>J(e))),n))}function as(e){return t=>t.annotate(e)}const os=`~effect/SchemaError/SchemaError`;var ss=class extends _e(`SchemaError`){[os]=os;constructor(e){super({issue:e})}get message(){return Un(this.issue)}toString(){return`SchemaError(${this.message})`}};function cs(e){return _(e,os)&&e[os]===os}const ls=Po;function us(e,t){let n=Io(e,t);return(e,t)=>ds(n(e,t))}function ds(e){return jt(e,e=>zt(()=>Xe(e,e=>new ss(e))))}const fs=us;function ps(e,t){let n;for(let r of e.reasons){if(!Ze(r)||!cs(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function ms(e){let t=Tt(e);if(Qe(t))return t.value;throw ps(t.cause,`Sync adapter can only throw schema errors`)}function hs(e,t){let n=Lo(e,t);return(e,t)=>gs(n(e,t))}function gs(e){return Qe(e)?e:tt(Xe(e.cause,e=>new ss(e)))}const _s=Ro;function vs(e,t){let n=us(e,t);return(e,t)=>ms(n(e,t))}const ys=vs;function bs(e,t){let n=zo(e,t);return(e,t)=>ds(n(e,t))}function xs(e,t){let n=bs(e,t);return(e,t)=>ms(n(e,t))}const Ss=xs,J=ts;function Cs(e){return _(e,rs)&&e[rs]===rs}const ws=ns(e=>J(zi(e.ast),{schema:e})),Ts=ns(e=>{let t=Vs(e);return J(Vi(e.ast),{schema:t})}),Es=ns(e=>J(Yi(e.ast),{schema:e})),Ds=ns(e=>J(W(e.ast),{schema:e}));function Os(e){let t=J(new H(e),{literal:e,transform(n){return t.pipe(X(Os(n),{decode:I(()=>n),encode:I(()=>e)}))}});return t}const ks=J(jr),As=J(Mr),js=J(Ar),Ms=J(Pr),Ns=J(Lr),Ps=J(Rr);function Fs(e,t){return J(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Fs(Qr(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Y(e){return Fs(Qr(e,void 0),e)}function Is(e,t){return J(Gi(e.ast,t.ast),{key:e,value:t})}const Ls=ns(e=>J(new zr(!1,[],[e.ast]),{value:e}));function Rs(e,t){return J(e,{members:t,mapMembers(e,t){let n=e(this.members);return Rs(ei(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function zs(e,t){return Rs(ei(e,t?.mode??`anyOf`,void 0),e)}function Bs(e){let t=e.map(Os);return J(ei(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return zs(e(this.members))},pick(e){return Bs(e)},transform(e){return zs(t.map((t,n)=>t.transform(e[n])))}})}const Vs=ns(e=>zs([e,js]));function Hs(...e){return t=>t.check(...e)}function Us(e){return t=>J(Ii(t.ast,e),{schema:t,identifier:e})}function X(e,t){return n=>J(Ui(n.ast,e.ast,t?dr(t):mr()),{from:n,to:e})}function Ws(e,t){return n=>t?X(n,t)(e):X(n)(e)}function Gs(e){return t=>J(Hi(t.ast,e),{schema:t})}function Ks(e){return jt(e,e=>zt(()=>Xe(e,e=>e.issue)))}function qs(e,t){let n=t?.encodingStrategy===`omit`?rr():$n();return t=>ws(Ds(t)).pipe(X(t,{decode:ir(Ks(e)),encode:n}))}function Js(e,t){return n=>Es(n).pipe(qs(e,t),Ws(ws(n)))}function Ys(e){return Os(e).pipe(Gs(T(e)))}function Xs(e,t){return Y({_tag:Ys(e),...t})}function Zs(){return(e,t)=>new z(e.ast,dr(t))}const Qs=_i,$s=J(yi);function ec(e){return Qs(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}const tc=Ns.check(ec());function nc(e,t){return e=Math.max(0,Math.floor(e)),Qs(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:t})=>t===`array`?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),"~structural":!0,arbitrary:{constraint:{minLength:e}},...t})}function rc(e){return nc(1,e)}function ic(t){let n=is()([t],([t])=>(n,r,i)=>m(n)?te(n)?Pt:ft(Io(t)(n.value,i),{onSuccess:e,onFailure:e=>kn(r,`value`,e,n,i)}):C(new On(r,n,i)),{representation:{id:`effect/schema/Option`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Option(${e[0].runtime})`,Type:`Option.Option<${e[0].Type}>`,importDeclarations:[`import * as Option from "effect/Option"`]}),expected:`Option`,toCodec:([t])=>Zs()(zs([Y({_tag:Os(`Some`),value:t}),Y({_tag:Os(`None`)})]),fr({decode:t=>t._tag===`None`?g():e(t.value),encode:e=>Ie(e)?{_tag:`Some`,value:e.value}:{_tag:`None`}})),toArbitrary:([t])=>(n,r)=>{let i=n.constant(g());return ac(n,r,i,n.oneof(i,t.arbitrary.map(e)))},toEquivalence:([e])=>me(e),toFormatter:([e])=>ge({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})});return J(n.ast,{value:t})}function ac(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}globalThis.RegExp,globalThis.URL;const oc=Ms.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function sc(e,t){return oc.pipe(X(e,gr(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const cc=globalThis.Symbol.for(`immer-draftable`),lc={};function uc(e,t,n,r,i){let a=pc(n,t,r),o=fc(t),s=class extends e{constructor(...[e,t]){let r=t?.[`~payload`],i=r?.token===lc?r.value:n.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:lc,value:i}})}static[rs]=rs;get[o](){return o}static[cc]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return h(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return Mo(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(Ei(this.ast,e))}static annotateKey(e){return this.rebuild(Ri(this.ast,e))}static check(...e){return this.rebuild(Oi(this.ast,e))}static extend(e){return(t,r)=>{let a=mc(t)?t:Y(t),o={...n.fields,...a.fields},s=Qr(o,n.ast.checks,{identifier:e});return uc(this,e,Fs(Oi(s,a.ast.checks),o),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function dc(e){return new L(I(t=>new e(t,{"~payload":{token:lc,value:t}})),$n())}function fc(e){return`~effect/Schema/Class/${e}`}function pc(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=fc(t),o=e=>e instanceof i||_(e,a),s=dc(i);return r=X(J(new Er([e.ast],()=>(e,t,n)=>o(e)?T(e):C(new On(t,e,n)),{identifier:t,[mn]:([e])=>({isConstructed:o,link:new z(e,s)}),toCodec:([e])=>new z(e.ast,s),toArbitrary:([e])=>()=>({arbitrary:e.arbitrary.map(e=>new i(e)),terminal:e.terminal?.map(e=>new i(e))}),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[pn]:ri(e.ast),...n})),s)(e)}}function mc(e){return Cs(e)}const hc=e=>(t,n)=>{let r=mc(t)?t:Y(t);return uc(Re,e,r,n,e=>({toString(){return`${e}(${f({...this})})`}}))},gc=e=>(t,n,r)=>{let i=mc(n)?n.mapFields(e=>({_tag:Ys(t),...e}),{unsafePreserveChecks:!0}):Xs(t,n);return hc(e??t)(i,r)},_c=e=>(t,n)=>{let r=mc(t)?t:Y(t);return uc(Ae,e,r,n,e=>({name:e}))},vc=e=>(t,n,r)=>{let i=mc(n)?n.mapFields(e=>({_tag:Ys(t),...e}),{unsafePreserveChecks:!0}):Xs(t,n);return _c(e??t)(i,r)};function yc(e){return e.constructorDefault===void 0?e:new B(e.isOptional,e.isMutable,void 0,e.annotations)}function bc(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function xc(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(W(t[e]),e);let r=[...t].sort((t,r)=>{t=W(t),r=W(r);let i=e(t),a=e(r);return i===a?n.get(t)-n.get(r):i-a});return r.some((e,n)=>e!==t[n])?r:t}}function Sc(e){return J(Oc(e.ast),{schema:e})}const Cc=xc(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function wc(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>J(t(W(e)))),i=e.annotations?.toCodecStringTree;if(ze(i)){let n=i(r);return n===void 0?e:U(e,[ki(n,t)])}let a=e.annotations?.toCodecJson,o=ze(a)?a(r):void 0,s=o===void 0?e.annotations?.toCodec:void 0,c=o??(ze(s)?s(r):void 0);return c===void 0?n(e):U(e,[ki(c,t)])}case`Null`:return U(e,[Tc]);case`Boolean`:return U(e,[Ec]);case`Unknown`:case`ObjectKeyword`:return U(e,[ma]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return bc(e),e.recur(t,na);case`Union`:{let n=Cc(e.types);return n===e.types?e.recur(t):new li(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}const Tc=new z(new H(`null`),new L(I(()=>null),I(()=>`null`))),Ec=new z(new li([new H(`true`),new H(`false`)],`anyOf`),new L(I(e=>e===`true`),ar())),Dc=new L(I(e=>typeof e==`string`?[e]:e),$n()),Oc=Pi(e=>{let t=wc(e,Oc,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?Mi(t,yc(e.context)):t},{stopAt:e=>e.transformation===Dc}),kc=`~effect/platform/PlatformError`;var Ac=class extends _e(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},jc=class extends Te{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},Mc=class extends _e(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[kc]=kc;get message(){return this.reason.message}};const Nc=e=>new Mc(new jc(e)),Pc=e=>new Mc(new Ac(e)),Fc={"~effect/Stream":{_R:o,_E:o,_A:o},pipe(){return h(this,arguments)}},Ic=e=>{let t=Object.create(Fc);return t.channel=e,t},Lc=`~effect/Sink`,Rc=T([void 0]),zc={_A:o,_In:o,_L:o,_E:o,_R:o},Bc={[Lc]:zc,pipe(){return h(this,arguments)}},Vc=e=>_(e,Lc),Hc=e=>Uc((t,n)=>q(e)(t,n).pipe(w(ot({disableYield:!0})),st(T))),Uc=e=>{let t=Object.create(Bc);return t.transform=e,t},Wc=e=>K((t,n)=>T(w(e.transform(t,n),x))),Gc=Uc(e=>st(ot(e,{disableYield:!0}),()=>Rc)),Kc=e=>qc(ct(t=>e(t),{discard:!0})),qc=e=>Uc(t=>t.pipe(w(e),ot({disableYield:!0}),st(()=>Rc))),Jc=e=>Hc(Do(S(e,Wc))),Yc=e=>_(e,`~effect/Stream`),Z=Ic,Xc=e=>Z(lo(e)),Zc=(e,t)=>Z(K((n,r)=>w(Ao(e.channel,r),e=>t(e,r)))),Qc=e=>e.channel,$c=(e,t)=>Z(mo(e,t)),el=Z(yo),tl=e=>Z(ho(()=>e().channel)),nl=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?rl(e):Z(_o(e,t?.chunkSize)),rl=e=>s(e)?Z(vo(e)):el,il=e=>Z(Do(S(e,Qc))),al=b(2,(e,t)=>tl(()=>{let n=0;return Z(xo(e.channel,De(e=>t(e,n++))))})),ol=b(e=>Yc(e[0])&&Yc(e[1]),(e,t,n)=>Z(wo(Qc(e),Qc(t),n))),sl=b(2,(e,t)=>Zc(e,(e,r)=>E(()=>{let i,a,o=D(()=>{if(a!==void 0){let e=a;return a=void 0,T(e)}return e}).pipe(Nt(e=>(i=et(e),x()))),s=S(D(()=>t.transform(o,r)),([e,t])=>(a=t,n(e)));return D(()=>i||s)}))),cl=b(e=>Yc(e[0]),(e,t)=>tl(()=>{let n=new TextDecoder(t?.encoding);return al(e,e=>n.decode(e,{stream:!0}))})),ll=e=>e.channel.pipe(Eo(To()),Z),ul=b(2,(e,t)=>Ft(n=>Ao(e.channel,n).pipe(w(e=>t.transform(e,n)),S(([e])=>e)))),dl=e=>ko(e.channel,()=>[],(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n]);return e}),fl=e=>ko(e.channel,()=>``,(e,t)=>e+t.join(``)),pl=`~effect/platform/FileSystem`,ml=e=>typeof e==`bigint`?e:BigInt(e),hl=BigInt(1024);hl*hl*hl*hl*hl;const gl=Se(`effect/platform/FileSystem`),_l=e=>gl.of({...e,[pl]:pl,exists:t=>d(e.access(t),Mt(!0),Et(`PlatformError`,e=>e.reason._tag===`NotFound`?T(!1):C(e))),readFileString:(t,n)=>w(e.readFile(t),e=>vt({try:()=>new TextDecoder(n).decode(e),catch:e=>Pc({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})})),stream:Lt(function*(t,r){let i=yield*e.open(t,{flag:`r`});r?.offset&&(yield*i.seek(r.offset,`start`));let a=r?.bytesToRead===void 0?void 0:ml(r.bytesToRead),o=BigInt(0),s=ml(r?.chunkSize??65536),c=i.readAlloc(s);return Xc(T(w(D(()=>a!==void 0&&a<=o?x():a!==void 0&&a-o<s?i.readAlloc(a-o):c),ge({onNone:()=>x(),onSome:e=>(o+=BigInt(e.length),T(n(e)))}))))},il),sink:(t,n)=>d(e.open(t,{flag:`w`,...n}),S(e=>Kc(t=>e.writeAll(t))),Jc),writeFileString:(t,n,r)=>w(vt({try:()=>new TextEncoder().encode(n),catch:e=>Pc({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),vl=`~effect/platform/FileSystem/File`;var yl=class extends Se()(`effect/platform/FileSystem/WatchBackend`){};const bl=`~effect/platform/Path`,xl=Se(`effect/Path`),Sl={"~effect/Ref":{_A:o},...Ue,toJSON(){return{_id:`Ref`,ref:this.ref}}},Cl=e=>{let t=Object.create(Sl);return t.ref=Ea(e),t},wl=e=>E(()=>Cl(e)),Tl=e=>E(()=>e.ref.current),El=b(2,(e,t)=>E(()=>{let n=e.ref.current;return e.ref.current=t,n})),Dl=b(2,(e,t)=>E(()=>{e.ref.current=t(e.ref.current)}));function Ol(e){return e.map(e=>e.length===0||e.match(/[^A-Za-z0-9_-]/)?JSON.stringify(e):e).join(`.`)}var kl=class{maxPad=0;srcObject;output=[];#e=new Map;constructor(e){this.srcObject=e}dump(e={}){return this.output=this.#t(this.srcObject),this.output=this.#g(e),this.output}#t(e,t=[]){let n=[],r=Object.keys(e),i=[],a=[];for(let t of r)this.#o(e[t])?i.push(t):a.push(t);let o=i.concat(a);for(let r of o){let i=e[r];if(i instanceof Date)n.push(this.#h([r],i));else if(typeof i==`string`||i instanceof RegExp)n.push(this.#d([r],i.toString()));else if(typeof i==`number`)n.push(this.#f([r],i));else if(typeof i==`boolean`)n.push(this.#p([r],i));else if(i instanceof Array){let e=this.#r(i);if(e===`ONLY_PRIMITIVE`)n.push(this.#u([r],i));else if(e===`ONLY_OBJECT_EXCLUDING_ARRAY`)for(let e=0;e<i.length;e++)n.push(``),n.push(this.#c([...t,r])),n.push(...this.#t(i[e],[...t,r]));else{let e=i.map(e=>this.#a(e)).join(`,`);n.push(`${this.#l([r])}[${e}]`)}}else if(typeof i==`object`&&(n.push(``),n.push(this.#s([...t,r])),i)){let e=i;n.push(...this.#t(e,[...t,r]))}}return n.push(``),n}#n(e){return e instanceof Date||e instanceof RegExp||[`string`,`number`,`boolean`].includes(typeof e)}#r(e){if(this.#e.has(e))return this.#e.get(e);let t=this.#i(e);return this.#e.set(e,t),t}#i(e){if(!e.length)return`ONLY_PRIMITIVE`;let t=this.#n(e[0]);if(e[0]instanceof Array)return`MIXED`;for(let n=1;n<e.length;n++)if(t!==this.#n(e[n])||e[n]instanceof Array)return`MIXED`;return t?`ONLY_PRIMITIVE`:`ONLY_OBJECT_EXCLUDING_ARRAY`}#a(e){if(e instanceof Date)return`"${this.#m(e)}"`;if(typeof e==`string`||e instanceof RegExp)return JSON.stringify(e.toString());if(typeof e==`number`)return e;if(typeof e==`boolean`)return e.toString();if(e instanceof Array)return`[${e.map(e=>this.#a(e)).join(`,`)}]`;if(typeof e==`object`){if(!e)throw Error(`Should never reach`);return`{${Object.keys(e).map(t=>`${Ol([t])} = ${this.#a(e[t])}`).join(`,`)}}`}throw Error(`Should never reach`)}#o(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof RegExp||e instanceof Date||e instanceof Array&&this.#r(e)!==`ONLY_OBJECT_EXCLUDING_ARRAY`}#s(e){return`[${Ol(e)}]`}#c(e){return`[[${Ol(e)}]]`}#l(e){let t=Ol(e);return t.length>this.maxPad&&(this.maxPad=t.length),`${t} = `}#u(e,t){return`${this.#l(e)}${JSON.stringify(t)}`}#d(e,t){return`${this.#l(e)}${JSON.stringify(t)}`}#f(e,t){if(Number.isNaN(t))return`${this.#l(e)}nan`;switch(t){case 1/0:return`${this.#l(e)}inf`;case-1/0:return`${this.#l(e)}-inf`;default:return`${this.#l(e)}${t}`}}#p(e,t){return`${this.#l(e)}${t}`}#m(e){function t(e,t=2){return e.padStart(t,`0`)}let n=t((e.getUTCMonth()+1).toString()),r=t(e.getUTCDate().toString()),i=t(e.getUTCHours().toString()),a=t(e.getUTCMinutes().toString()),o=t(e.getUTCSeconds().toString()),s=t(e.getUTCMilliseconds().toString(),3);return`${e.getUTCFullYear()}-${n}-${r}T${i}:${a}:${o}.${s}`}#h(e,t){return`${this.#l(e)}${this.#m(t)}`}#g(e={}){let{keyAlignment:t=!1}=e,n=/^(\".*\"|[^=]*)\s=/,r=[];for(let e=0;e<this.output.length;e++){let i=this.output[e];if(i[0]===`[`&&i[1]!==`[`){if(this.output[e+1]===``&&this.output[e+2]?.slice(0,i.length)===i.slice(0,-1)+`.`){e+=1;continue}r.push(i)}else if(t){let e=n.exec(i);e&&e[1]?r.push(i.replace(e[1],e[1].padEnd(this.maxPad))):r.push(i)}else r.push(i)}let i=[];for(let e=0;e<r.length;e++){let t=r[e];(t!==``||r[e+1]!==``)&&i.push(t)}return i}};function Al(e,t){return new kl(e).dump(t).join(`
7
+ `)}const jl={arrays:`merge`,sets:`merge`,maps:`merge`};function Ml(e,t,n){return Nl(e,t,new Set,n??jl)}function Nl(e,t,n,r){let i={},a=new Set([...Rl(e),...Rl(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(Ll(a)&&Ll(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=Pl(a,s,n,r);continue}i[o]=s}return i}function Pl(e,t,n,r){if(Fl(e)&&Fl(t))return Nl(e,t,n,r);if(Il(e)&&Il(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function Fl(e){return Object.getPrototypeOf(e)===Object.prototype}function Il(e){return typeof e[Symbol.iterator]==`function`}function Ll(e){return typeof e==`object`&&!!e}function Rl(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function zl(e){return e%4==0&&e%100!=0||e%400==0}var Bl=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
8
+ `||this.startsWith(`\r
9
+ `)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function Q(e){return{ok:!0,body:e}}function $(){return{ok:!1}}function Vl(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function Hl(e){return typeof e==`object`&&!!e}function Ul(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function Wl(e,t){let{keys:n,type:r,value:i}=t,a=Ul(e,n);if(a===void 0)return Object.assign(e,Vl(n,i));if(Array.isArray(a))return Kl(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(Hl(a))return Kl(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function Gl(e,t){let{type:n,keys:r,value:i}=t,a=Ul(e,r);if(a===void 0)return Object.assign(e,Vl(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):Kl(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(Hl(a))return Kl(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function Kl(e,t){switch(t.type){case`Block`:return Ml(e,t.value);case`Table`:return Wl(e,t);case`TableArray`:return Gl(e,t)}}function ql(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function Jl(e,t){let n=eu(t);return r=>{let i=[],a=e(r);if(!a.ok)return Q(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return Q(i)}}function Yl(e,t){let n=eu(t);return r=>{let i=e(r);if(!i.ok)return $();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return Q(a)}}function Xl(e,t,n){let r=eu(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return $();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
10
+ `,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return Q(Vl(o.body,s.body))}}function Zl(e){return t=>{let n=e(t);if(!n.ok)return $();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=Ml(r,e));return Q(r)}}function Ql(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?$():Q(n)}}function $l(e,t,n){let r=eu(e),i=eu(n);return a=>{if(!r(a).ok)return $();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return Q(o.body)}}function eu(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const tu=/[A-Za-z0-9_-]+/y;function nu(e){e.skipWhitespaces();let t=e.match(tu)?.[0];return t?(e.next(t.length),Q(t)):$()}function ru(e){if(e.char()!==`\\`)return $();switch(e.next(),e.char()){case`b`:return e.next(),Q(`\b`);case`t`:return e.next(),Q(` `);case`n`:return e.next(),Q(`
11
+ `);case`f`:return e.next(),Q(`\f`);case`r`:return e.next(),Q(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),Q(r)}case`"`:return e.next(),Q(`"`);case`\\`:return e.next(),Q(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function iu(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
12
+ `)throw SyntaxError(`Single-line string cannot contain EOL`);let n=ru(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function au(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
13
+ `)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function ou(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
14
+ `?e.next():e.startsWith(`\r
15
+ `)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
16
+ `)){e.next(),e.nextUntilChar({skipComments:!1});continue}if(e.startsWith(`\\\r
17
+ `)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=ru(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),Q(t.join(``))}function su(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
18
+ `?e.next():e.startsWith(`\r
19
+ `)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),Q(t.join(``))}const cu=/(?:true|false)\b/y;function lu(e){e.skipWhitespaces();let t=e.match(cu);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const uu=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),du=/[+-]?inf\b/y;function fu(e){e.skipWhitespaces();let t=e.match(du);if(!t)return $();let n=t[0];return e.next(n.length),Q(uu.get(n))}const pu=/[+-]?nan\b/y;function mu(e){e.skipWhitespaces();let t=e.match(pu);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const hu=Yl(ql([nu,iu,au]),`.`),gu=/0b[01]+(?:_[01]+)*\b/y;function _u(e){e.skipWhitespaces();let t=e.match(gu)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const vu=/0o[0-7]+(?:_[0-7]+)*\b/y;function yu(e){e.skipWhitespaces();let t=e.match(vu)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const bu=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function xu(e){e.skipWhitespaces();let t=e.match(bu)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Su=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Cu(e){e.skipWhitespaces();let t=e.match(Su)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const wu=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function Tu(e){e.skipWhitespaces();let t=e.match(wu)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const Eu=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function Du(e){e.skipWhitespaces();let t=e.match(Eu);if(!t)return $();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!zl(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return Q(i)}const Ou=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function ku(e){e.skipWhitespaces();let t=e.match(Ou)?.[0];return t?(e.next(t.length),Q(t)):$()}function Au(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=Mu(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),Q(t)}function ju(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=$l(`{`,Jl(Nu,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=Ml(n,e);return Q(n)}const Mu=ql([ou,su,iu,au,lu,fu,mu,Du,ku,_u,yu,xu,Tu,Cu,Au,ju]),Nu=Xl(hu,`=`,Mu);function Pu(e){e.nextUntilChar();let t=Zl(Ql(Nu))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const Fu=$l(`[`,hu,`]`);function Iu(e){e.nextUntilChar();let t=Fu(e);if(!t.ok)return $();e.nextUntilChar();let n=Pu(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const Lu=$l(`[[`,hu,`]]`);function Ru(e){e.nextUntilChar();let t=Lu(e);if(!t.ok)return $();e.nextUntilChar();let n=Pu(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function zu(e){let t=Ql(ql([Pu,Ru,Iu]))(e);return t.ok?Q(t.body.reduce(Kl,{__proto__:null})):Q({__proto__:null})}function Bu(e,t){let n=e.source.slice(0,e.position).split(`
20
+ `);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function Vu(e){return t=>{let n=new Bl(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(Bu(n,r))}catch(e){throw e instanceof Error?SyntaxError(Bu(n,e.message)):SyntaxError(Bu(n,`Invalid error type caught`))}}}function Hu(e){return Vu(zu)(e)}const Uu={ctx_execute:!0,ctx_batch_execute:!0};function Wu(e,t){return Uu[e]?e!==`ctx_execute`||t.language===`shell`:!1}function Gu(e,t){if(Wu(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e&&`command`in e&&typeof e.command==`string`?e.command:``).filter(e=>typeof e==`string`).join(`
21
+ `)}}const Ku=/#[0-9a-fA-F]{4}$/u,qu=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,Ju=/^\*\*\* Move to:\s*(.+)$/,Yu={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function Xu(e){let t=e.trim(),n=Ku.exec(t)?.index,r=n===void 0?t:t.slice(0,n);if(r.length<2)return r;let i=r[0],a=r[r.length-1];return(i===`"`||i===`'`)&&i===a?r.slice(1,-1):r}function Zu(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=Xu(t.slice(1,n));return r.length>0?r:void 0}function Qu(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
22
+ `)){let n=Zu(e);if(n!==void 0){t.push(n),r=!0;continue}let i=qu.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=Ju.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=Xu(o.slice(3));e.length>0&&t.push(e)}}return t}function $u(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function ed(e,t){if(Yu[e]!==!0)return[];let n=t.input,r=typeof n==`string`?Qu(n):[];if(r.length>0)return Array.from(new Set(r));let i=$u(t,`file_path`)??$u(t,`path`);return i===void 0?[]:[i]}const td=new Map;function nd(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=td.get(n);if(r!==void 0)return r===!0||r.test(e);let i=rd(n);return td.size>=256&&td.clear(),td.set(n,i),i===!0||i.test(e)}function rd(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const id=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,ad=/\$\(|`|\$\{?\w/,od=/\$\(([^()]*)\)|`([^`]*)`/g,sd=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,cd=/&&|\|\||[;|]/,ld=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function ud(e,t,n,r){let i=id.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?dd(o,n.command):hd(o,n.file_path,r)}function dd(e,t){if(typeof t!=`string`)return!0;let n=fd(t);return n.length===0||n.some(t=>md(e,t))?!0:pd(e)&&ad.test(t)}function fd(e){let t=[...e.matchAll(od)].map(e=>e[1]??e[2]??``);return[e.replace(od,` `),...t].flatMap(e=>e.split(cd)).map(e=>e.trim().replace(sd,``)).filter(e=>e.length>0)}function pd(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function md(e,t){return RegExp(`^${e.split(`*`).map(ld).join(`.*`)}$`).test(t)}function hd(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:gd(r);return RegExp(`^${_d(i)}$`).test(a)}const gd=e=>e.slice(e.lastIndexOf(`/`)+1);function _d(e){let t=vd(e);return e.endsWith(`/**`)?`(?:${vd(e.slice(0,-3))}|${t})`:t}function vd(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:ld(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function yd(e){return{session_id:e(),agent_id:null}}const bd=Is(Ms.pipe(Hs(Qs(e=>e!==`__proto__`))),Ls(Ms)).pipe(Us(`TomlConfig`)),xd=e=>new F({message:e instanceof Error?`TOML parse error: ${e.message}`:`TOML parse error`});Ms.pipe(X(Es(bd),{decode:tr(e=>vt({try:()=>Hu(e),catch:xd}).pipe(w(e=>us(bd)(e)),Bt(e=>cs(e)?e.issue:e))),encode:I(e=>Al(e))}));const Sd=`systemfsoftware.toml`,Cd=ys(bd)({});var wd=class extends Se()(`@systemfsoftware/omp-utils/TomlLoader`){};const Td=e=>{let t={};for(let n of e)for(let[e,r]of Object.entries(n))t[e]=r;return t},Ed=e=>vt({try:()=>Hu(e),catch:e=>new F({message:e instanceof Error?`TOML parse error: ${e.message}`:`TOML parse error`})}).pipe(w(e=>us(bd)(e))),Dd=(e,t,n)=>e.exists(n).pipe(w(t=>t?e.readFileString(n).pipe(w(Ed),dt(()=>Cd)):T(Cd))),Od=mt(wd,w(E(()=>{let e=process.env.OMP_USER_CONFIG_HOME;return typeof e==`string`&&e.length>0?e:Ht.homedir()}),e=>pt(function*(){let t=yield*wl(_a()),n=yield*gl,r=yield*xl,i=r.join(e,`.config/systemfsoftware`,Sd);return wd.of({load:at(`TomlLoader.load`)(function*(e){let a=yield*Tl(t),o=va(a,e);if(Ie(o))return o.value;let s=r.join(e,Sd),c=r.join(e,`systemfsoftware.local.toml`),l=yield*Dd(n,r,i),u=yield*Dd(n,r,s),d=yield*Dd(n,r,c),ee=yield*fs(bd)(Td([l,u,d])).pipe(lt);return yield*Dl(t,t=>(Sa(t,e,ee),t)),ee})})}))),kd=Ls(Y({old_text:Ts(As),new_text:Ts(As)}).pipe(Hs(Qs(e=>`old_text`in e||`new_text`in e)))).pipe(Hs(rc())),Ad=Ls(Y({old_string:Ts(As),new_string:Ts(As)}).pipe(Hs(Qs(e=>`old_string`in e||`new_string`in e)))),jd=ls(kd),Md=ls(Ad),Nd={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},Pd={Edit:!0,MultiEdit:!0,Update:!0},Fd=(e,t)=>{let n=e.split(`
23
+ `).filter(e=>e.startsWith(t));return n.length===0?void 0:n.map(e=>e.slice(t.length)).join(`
24
+ `)};function Id(e,t){let n=t;if(Nd[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(Pd[e]===!0&&`edits`in n&&jd(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
25
+ `),new_string:e.map(e=>e.new_string).join(`
26
+ `)}}if(Pd[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=Fd(n.input,`+`),t=Fd(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const Ld=_s(Is(Ms,As));function Rd(e,t){let n=le(Ld(t));if(n===null)return{};let r=`file_path`in e||!(`path`in e)?`file_path`:`path`,i={};for(let[t,a]of Object.entries(n)){if(t===`file_path`){i[r]=a;continue}if(!((t===`old_string`||t===`new_string`)&&!(t in e))){if(t===`edits`&&Md(a)&&jd(e.edits)){i.edits=a.map(e=>({old_text:typeof e.old_string==`string`?e.old_string:``,new_text:typeof e.new_string==`string`?e.new_string:``}));continue}i[t]=a}}return i}const zd={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function Bd(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=zd[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{gc as $,dl as A,L as At,Ls as B,el as C,La as Ct,ol as D,Ui as Dt,Yc as E,Ni as Et,Hc as F,N as Ft,Bs as G,$s as H,Vc as I,ic as J,ks as K,Ac as L,sl as M,$n as Mt,il as N,I as Nt,fl as O,W as Ot,Gc as P,tr as Pt,Y as Q,Pc as R,cl as S,Ba as St,nl as T,Ea as Tt,tc as U,Ps as V,Os as W,ss as X,Is as Y,Ms as Z,vl as _,Fo as _t,Gu as a,X as at,_l as b,So as bt,Id as c,_s as ct,El as d,cs as dt,vc as et,Cl as f,J as ft,gl as g,Js as gt,bl as h,Es as ht,ed as i,as as it,ll as j,Xn as jt,ul as k,Mr as kt,Bd as l,Ss as lt,xl as m,Sc as mt,Od as n,zs as nt,nd as o,us as ot,Dl as p,Ts as pt,Ns as q,Rd as r,As as rt,ud as s,hs as st,wd as t,Xs as tt,yd as u,sc as ut,ml as v,Io as vt,Z as w,Ra as wt,$c as x,Va as xt,yl as y,K as yt,Nc as z};