@systemfsoftware/omp-claude-compat 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cause-BpHZgZuR.js +1 -0
- package/dist/Effect-fMAnbW-8.js +14 -0
- package/dist/Exit-BhYZ1Mg3.js +1 -0
- package/dist/core-C1FEy4nD.js +13 -0
- package/dist/dist-opjiVExE.js +26 -0
- package/dist/hook-dispatcher.executor-VKMzdbhh.js +8 -0
- package/dist/hook-dispatcher.handler-DoauiNPI.js +1 -0
- package/dist/hook-runtime.state-DnCEYjpv.js +1 -0
- package/dist/index.js +1 -1
- package/dist/inject-instructions.executor-RzZpGK-N.js +3 -0
- package/dist/inject-instructions.handler-B7iXvfzB.js +1 -0
- package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/package.json +7 -7
- package/dist/dist-uv-To51R.js +0 -49
- package/dist/hook-dispatcher.executor-DiQf8RVY.js +0 -8
- package/dist/hook-dispatcher.handler-5RAESf9m.js +0 -1
- package/dist/hook-runtime.state-B1tGHImx.js +0 -1
- package/dist/inject-instructions.executor-kXP1_aBg.js +0 -3
- package/dist/inject-instructions.handler-w_nq7Y3G.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{$c as e,$i as t,$o as n,$s as r,Ac as i,Ao as a,As as o,Bc as s,Bs as c,Cl as l,Co as u,Cr as d,Cs as f,Dc as p,Dn as m,Ds as h,El as g,Eo as _,Es as ee,Fc as te,Fi as ne,Gi as re,Go as ie,Gs as ae,Hc as oe,Hi as se,Hs as v,Ii as ce,Io as le,Is as ue,Ji as de,Jo as fe,Jr as pe,Js as me,Ko as he,Ks as ge,Lc as _e,Lo as ve,Lr as ye,Ls as be,Mi as xe,Ms as Se,Ni as Ce,Nr as we,Ns as Te,Oo as Ee,Os as De,Pi as Oe,Pr as ke,Ps as Ae,Qc as je,Qi as Me,Qs as Ne,Ro as Pe,Rs as y,So as Fe,Ss as Ie,Tc as Le,Tl as b,Tr as Re,Uc as ze,Ui as Be,Uo as Ve,Us as He,Vc as Ue,Vo as We,Wc as Ge,Wi as Ke,Ws as qe,Xi as Je,Xn as Ye,Xs as Xe,Yi as Ze,Yo as Qe,Ys as x,Zc as $e,Zs as et,_l as tt,_o as nt,al as rt,b as it,bo as at,ci as ot,cl as st,cr as ct,ct as lt,dl as ut,dt,el as ft,es as pt,fl as mt,fs as ht,ft as gt,gl as _t,hl as vt,ia as yt,il as bt,in as xt,jc as St,jo as Ct,js as wt,k as Tt,kc as Et,ko as Dt,kr as Ot,ks as kt,lc as At,li as jt,ll as Mt,ml as Nt,ms as Pt,na as Ft,nc as It,oa as Lt,ol as Rt,pt as zt,qs as Bt,rl as Vt,ro as Ht,rt as Ut,sl as Wt,ss as Gt,ta as Kt,tc as S,ts as qt,ul as Jt,ut as Yt,vl as Xt,vn as Zt,w as Qt,wl as C,wr as $t,ws as en,xl as tn,xo as nn,xs as rn,yl as an,yo as on,zc as sn,zs as w}from"./core-C1FEy4nD.js";import{$ as cn,A as ln,An as un,At as dn,B as fn,Bt as pn,C as mn,Cn as hn,Ct as gn,D as _n,Dt as vn,E as yn,En as bn,Et as xn,F as Sn,Ft as Cn,G as wn,Gn as Tn,Gt as En,I as T,In as Dn,It as E,J as On,Kn as kn,Kt as An,L as jn,M as Mn,Mn as Nn,Mt as Pn,N as Fn,Nn as In,Nt as Ln,O as Rn,On as zn,Ot as Bn,Pn as Vn,Pt as Hn,Q as Un,R as Wn,Rt as Gn,S as Kn,Sn as qn,St as Jn,T as Yn,Tn as Xn,Tt as Zn,Ut as Qn,V as $n,Vt as er,W as tr,Wn as nr,Wt as rr,X as ir,Y as ar,Z as or,_ as D,_n as sr,_t as cr,b as lr,bn as ur,bt as dr,c as fr,cn as pr,ct as mr,d as hr,dn as gr,et as _r,f as vr,fn as yr,g as br,gn as xr,gt as Sr,h as Cr,hn as wr,ht as Tr,i as Er,it as Dr,j as Or,jt as kr,k as Ar,kn as jr,kt as Mr,ln as Nr,lt as Pr,m as Fr,mn as Ir,n as O,nn as Lr,nt as Rr,o as zr,ot as k,p as Br,pt as Vr,q as Hr,qn as Ur,qt as Wr,r as Gr,s as Kr,st as A,tt as qr,u as Jr,un as Yr,ut as Xr,v as Zr,vn as Qr,w as $r,wn as ei,wt as j,x as M,xt as ti,y as ni,yn as ri,z as ii,zt as ai}from"./Effect-fMAnbW-8.js";import{a as oi,c as si,d as ci,h as li,i as ui,l as di,m as fi,n as pi,o as mi,p as hi,r as gi,s as _i,u as vi}from"./Cause-BpHZgZuR.js";import{a as yi,c as bi,d as xi,f as Si,h as Ci,i as wi,l as Ti,m as Ei,n as Di,p as Oi,r as ki,s as Ai,u as ji}from"./Exit-BhYZ1Mg3.js";import Mi from"node:os";const Ni=jt,Pi=e=>t=>{let n=t===void 0?Object.create(At):Ni(t);return n._tag=e,n},Fi=ot,Ii=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends it{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError}(),Li=e=>{let t={BaseEffectError:class extends Ii{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Ri=Symbol.for(`effect/DateTime`),zi=Symbol.for(`effect/DateTime/TimeZone`),Bi={[Ri]:Ri,pipe(){return Le(this,arguments)},[p](){return this.toString()},toJSON(){return _a(this).toJSON()}},Vi={...Bi,_tag:`Utc`,[Ge](){return sn(this,oe(this.epochMillis))},[_e](e){return qi(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${_a(this).toJSON()})`}},Hi={...Bi,_tag:`Zoned`,[Ge](){return g(oe(this.epochMillis),s(Ue(this.zone)),sn(this))},[_e](e){return qi(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&te(this.zone,e.zone)},toString(){return`DateTime.Zoned(${ja(this)})`}},Ui={[zi]:zi,[p](){return this.toString()}},Wi={...Ui,_tag:`Named`,[Ge](){return sn(this,ze(`Named:${this.id}`))},[_e](e){return Ji(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},Gi={...Ui,_tag:`Offset`,[Ge](){return sn(this,ze(`Offset:${this.offset}`))},[_e](e){return Ji(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${ba(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},Ki=(e,t,n)=>{let r=Object.create(Hi);return r.epochMillis=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},qi=e=>$e(e,Ri),Ji=e=>$e(e,zi),Yi=e=>Ji(e)&&e._tag===`Offset`,Xi=e=>Ji(e)&&e._tag===`Named`,Zi=e=>e._tag===`Utc`,Qi=e=>e._tag===`Zoned`,$i=an((e,t)=>e.epochMillis===t.epochMillis),ea=e=>{let t=Object.create(Vi);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ta=e=>{let t=e.getTime();if(Number.isNaN(t))throw new pi(`Invalid date`);return ea(t)},na=e=>{if(qi(e))return e;if(e instanceof Date)return ta(e);if(typeof e==`object`){let t=new Date(0);return Ca(t,e),ta(t)}else if(typeof e==`string`&&!ra(e))return ta(new Date(e+`Z`));return ta(new Date(e))},ra=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),ia=(e,t)=>{if(t?.timeZone===void 0&&qi(e)&&Qi(e))return e;let n=na(e);if(n.epochMillis<-86399999568e5||n.epochMillis>86399999496e5)throw RangeError(`Epoch millis out of range: ${n.epochMillis}`);let r;if(t?.timeZone===void 0){let e=new Date(n.epochMillis).getTimezoneOffset()*-60*1e3;r=fa(e)}else if(Ji(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=fa(t.timeZone);else{let e=ha(t.timeZone);if(Se(e))throw new pi(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?Ta(n.epochMillis,r,t?.disambiguation??`compatible`):Ki(n.epochMillis,r,n.partsUtc)},aa=ue(ia),oa=/^(.{17,35})\[(.+)\]$/,sa=e=>{let t=oa.exec(e);if(t===null){let t=Da(e);return t===null?w():aa(e,{timeZone:t})}let[,n,r]=t;return aa(n,{timeZone:r})},ca=tt(`effect/DateTime/validZoneCache`,()=>new Map),la={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ua=e=>{let t=e.resolvedOptions().timeZone;if(ca.has(t))return ca.get(t);let n=Object.create(Wi);return n.id=t,n.format=e,ca.set(t,n),n},da=e=>{if(ca.has(e))return ca.get(e);try{return ua(new Intl.DateTimeFormat(`en-US`,{...la,timeZone:e}))}catch{throw new pi(`Invalid time zone: ${e}`)}},fa=e=>{let t=Object.create(Gi);return t.offset=e,t},pa=ue(da),ma=/^(?:GMT|[+-])/,ha=e=>{if(ma.test(e)){let t=Da(e);return t===null?w():v(fa(t))}return pa(e)},ga=e=>e._tag===`Offset`?ba(e.offset):e.id,_a=e=>new Date(e.epochMillis),va=e=>{if(e._tag===`Utc`)return new Date(e.epochMillis);if(e.zone._tag===`Offset`)return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},ya=e=>va(e).getTime()-Sa(e),ba=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},xa=e=>ba(ya(e)),Sa=e=>e.epochMillis,Ca=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},wa=1440*60*1e3,Ta=(e,t,n)=>{if(t._tag===`Offset`)return Ki(e-t.offset,t);let r=Oa(e-wa,e,t),i=Oa(e+wa,e,t);if(r===i)return Ki(e-r,t);let a=r<i,o=r-i;if(a){if(Oa(e-i,e,t)===i)return Ki(e-i,t);let a=Ki(e-r,t);if(e!==va(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return Ki(e-i,t);case`compatible`:case`later`:return a}return a}if(Oa(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Oa(e-r+o,e+o,t)===r)return Ki(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return Ki(e-i,t)},Ea=/([+-])(\d{2}):(\d{2})$/,Da=e=>{let t=Ea.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Oa=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Da(r);return i===null?ya(Ki(t,n)):i},ka=e=>_a(e).toISOString(),Aa=e=>{let t=va(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${xa(e)}`},ja=e=>e.zone._tag===`Offset`?Aa(e):`${Aa(e)}[${e.zone.id}]`,Ma=e=>e.toUpperCase(),Na=e=>e.toLowerCase(),Pa=e=>e.length===0?e:Ma(e[0])+e.slice(1),Fa=e=>e.length===0?e:Na(e[0])+e.slice(1),Ia=e=>e.length>0,La=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return La(e,t.from)}},Ra=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},za=e=>Array.isArray(e),Ba=e=>!Array.isArray(e),Va=e=>`[${i(e)}]`,Ha=e=>za(e)?e.map(Va).join(``):Va(e),Ua=(e,t,n,r)=>{let i=e;return n&&qt(n)&&(i+=`\nat path: ${Ha(n)}`),t!==void 0&&(i+=`\ndetails: ${t}`),r&&(i+=`\nschema (${r._tag}): ${r}`),i},Wa=e=>Ua(`Invalid Argument`,e),Ga=(e,t,n)=>Ua(`Unsupported schema or overlapping types`,`cannot extend ${e} with ${t}`,n),Ka=e=>Ua(`Unsupported key schema`,void 0,void 0,e),qa=e=>Ua(`Unsupported literal`,`literal value: ${St(e)}`),Ja=e=>Ua(`Duplicate index signature`,`${e} index signature`),Ya=Ua(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),Xa=Ua(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),Za=e=>Ua(`Duplicate property signature transformation`,`Duplicate key ${St(e)}`),Qa=e=>Ua(`Duplicate property signature`,`Duplicate key ${St(e)}`),$a=Symbol.for(`effect/SchemaId/DateFromSelf`),eo=Symbol.for(`effect/SchemaId/GreaterThan`),to=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),no=Symbol.for(`effect/SchemaId/LessThan`),ro=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),io=Symbol.for(`effect/SchemaId/Int`),ao=Symbol.for(`effect/SchemaId/NonNaN`),oo=Symbol.for(`effect/SchemaId/Finite`),so=Symbol.for(`effect/SchemaId/JsonNumber`),co=Symbol.for(`effect/SchemaId/Between`),lo=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),uo=Symbol.for(`effect/SchemaId/BetweenBigint`),fo=Symbol.for(`effect/SchemaId/MinLength`),po=Symbol.for(`effect/SchemaId/Length`),mo=Symbol.for(`effect/SchemaId/MinItems`),ho=Symbol.for(`effect/annotation/TypeConstructor`),go=Symbol.for(`effect/annotation/Brand`),_o=Symbol.for(`effect/annotation/SchemaId`),vo=Symbol.for(`effect/annotation/Message`),yo=Symbol.for(`effect/annotation/MissingMessage`),bo=Symbol.for(`effect/annotation/Identifier`),xo=Symbol.for(`effect/annotation/Title`),So=Symbol.for(`effect/annotation/AutoTitle`),Co=Symbol.for(`effect/annotation/Description`),wo=Symbol.for(`effect/annotation/Examples`),To=Symbol.for(`effect/annotation/Default`),Eo=Symbol.for(`effect/annotation/JSONSchema`),Do=Symbol.for(`effect/annotation/Arbitrary`),Oo=Symbol.for(`effect/annotation/Pretty`),ko=Symbol.for(`effect/annotation/Equivalence`),Ao=Symbol.for(`effect/annotation/Documentation`),jo=Symbol.for(`effect/annotation/Concurrency`),Mo=Symbol.for(`effect/annotation/Batching`),No=Symbol.for(`effect/annotation/ParseIssueTitle`),Po=Symbol.for(`effect/annotation/ParseOptions`),Fo=Symbol.for(`effect/annotation/DecodingFallback`),Io=Symbol.for(`effect/annotation/Surrogate`),Lo=Symbol.for(`effect/annotation/StableFilter`),Ro=C(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?v(e.annotations[t]):w()),zo=Ro(go),Bo=Ro(vo),Vo=Ro(yo),Ho=Ro(xo),Uo=Ro(So),Wo=Ro(bo),Go=Ro(Co),Ko=Ro(jo),qo=Ro(Mo),Jo=Ro(No),Yo=Ro(Po),Xo=Ro(Fo),Zo=Ro(Io),Qo=Ro(Lo),$o=e=>rn(Qo(e),e=>e===!0),es=Symbol.for(`effect/annotation/JSONIdentifier`),ts=Ro(es),ns=e=>c(ts(e),()=>Wo(e)),rs=Symbol.for(`effect/schema/ParseJson`);var is=class{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag=`Declaration`;constructor(e,t,n,r={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=n,this.annotations=r}toString(){return h(yc(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const as=e=>t=>t._tag===e;var os=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.literal))}toJSON(){return{_tag:this._tag,literal:je(this.literal)?String(this.literal):this.literal,annotations:F(this.annotations)}}};const ss=as(`Literal`),cs=new os(null);var ls=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:F(this.annotations)}}};const us=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`undefined`}),ds=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`never`}),fs=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`unknown`}),ps=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`any`}),ms=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`string`,[Co]:`a string`}),hs=as(`StringKeyword`),gs=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`number`,[Co]:`a number`}),_s=as(`NumberKeyword`),vs=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`boolean`,[Co]:`a boolean`}),ys=as(`BooleanKeyword`),bs=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`bigint`,[Co]:`a bigint`}),xs=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`symbol`,[Co]:`a symbol`}),Ss=as(`SymbolKeyword`);var Cs=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:F(this.annotations)}}toString(){return String(this.type)}},ws=class extends Cs{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:F(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}};const Ts=e=>e.map(e=>e.type);var Es=class{elements;rest;isReadonly;annotations;_tag=`TupleType`;constructor(e,t,n,r={}){this.elements=e,this.rest=t,this.isReadonly=n,this.annotations=r;let i=!1,a=!1;for(let t of e)if(t.isOptional)i=!0;else if(i){a=!0;break}if(a||i&&t.length>1)throw Error(Xa)}toString(){return h(yc(this),()=>Ds(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Ds=e=>{let t=e.elements.map(String).join(`, `);return Gt(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{let i=String(n),a=i.includes(` | `)?`(${i})`:i;if(r.length>0){let n=r.map(String).join(`, `);return e.elements.length>0?`readonly [${t}, ...${a}[], ${n}]`:`readonly [...${a}[], ${n}]`}else if(e.elements.length>0)return`readonly [${t}, ...${a}[]]`;else return`ReadonlyArray<${i}>`}})};var N=class extends ws{name;isReadonly;constructor(e,t,n,r,i){super(t,n,i),this.name=e,this.isReadonly=r}toString(){return(this.isReadonly?`readonly `:``)+String(this.name)+(this.isOptional?`?`:``)+`: `+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Os=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return Os(e.from)}return!1};var ks=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,Os(e))this.parameter=e;else throw Error(Ya)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},As=class{annotations;_tag=`TypeLiteral`;propertySignatures;indexSignatures;constructor(e,t,n={}){this.annotations=n;let r={};for(let t=0;t<e.length;t++){let n=e[t].name;if(Object.prototype.hasOwnProperty.call(r,n))throw Error(Qa(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=mc(t[e].parameter);if(hs(n)){if(i.string)throw Error(Ja(`string`));i.string=!0}else if(Ss(n)){if(i.symbol)throw Error(Ja(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return h(yc(this),()=>Ms(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const js=e=>e.map(String).join(`; `),Ms=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${js(e.indexSignatures)} }`:`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${js(e.indexSignatures)} }`;else return`{}`},Ns=as(`TypeLiteral`),Ps=ht(Ur(Tn,e=>{switch(e._tag){case`AnyKeyword`:return 0;case`UnknownKeyword`:return 1;case`ObjectKeyword`:return 2;case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:return 3}return 4})),Fs={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},Is=e=>he(e,e=>Vs(e)?Is(e.types):[e]),Ls=e=>{let t=Ps(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[ps];case`UnknownKeyword`:return[fs];case`ObjectKeyword`:case`UndefinedKeyword`:case`VoidKeyword`:case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:r[e._tag]||(r[e._tag]=e,n.push(e));break;case`Literal`:{let t=typeof e.literal;switch(t){case`string`:case`number`:case`bigint`:case`boolean`:!r[Fs[t]]&&!i.includes(e.literal)&&(i.push(e.literal),n.push(e));break;case`object`:i.includes(e.literal)||(i.push(e.literal),n.push(e));break}break}case`UniqueSymbol`:!r.SymbolKeyword&&!i.includes(e.symbol)&&(i.push(e.symbol),n.push(e));break;case`TupleType`:r.ObjectKeyword||n.push(e);break;case`TypeLiteral`:e.propertySignatures.length===0&&e.indexSignatures.length===0?r[`{}`]||(r[`{}`]=e,n.push(e)):r.ObjectKeyword||n.push(e);break;default:n.push(e)}return n};var Rs=class e{types;annotations;static make=(t,n)=>Bs(t)?new e(t,n):t.length===1?t[0]:ds;static unify=(t,n)=>e.make(Ls(Is(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return h(yc(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const zs=(e,t)=>e.map(t),Bs=e=>e.length>1,Vs=as(`Union`),Hs=tt(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap);var Us=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=Ra(e)}toString(){return yc(this).pipe(c(()=>f(ue(this.f)(),e=>yc(e))),h(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=Hs.get(e);return t||(Hs.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:F(this.annotations)},Hs.set(e,t),t)}},Ws=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return Wo(this).pipe(h(()=>y(vc(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>Gs(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:F(this.annotations)}}};const Gs=as(`Refinement`),Ks={};var qs=class{from;to;transformation;annotations;_tag=`Transformation`;constructor(e,t,n,r={}){this.from=e,this.to=t,this.transformation=n,this.annotations=r}toString(){return h(yc(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:F(this.annotations)}}};const Js=as(`Transformation`);var Ys=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}};const Xs=e=>t=>t._tag===e,Zs=new class{_tag=`ComposeTransformation`};var Qs=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},$s=class{propertySignatureTransformations;_tag=`TypeLiteralTransformation`;constructor(e){this.propertySignatureTransformations=e;let t={},n={};for(let r of e){let e=r.from;if(t[e])throw Error(Za(e));t[e]=!0;let i=r.to;if(n[i])throw Error(Za(i));n[i]=!0}}};const ec=Xs(`TypeLiteralTransformation`),tc=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[bo];let i={...r,...t},a=Zo(e);return Ae(a)&&(i[Io]=tc(a.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},nc=(e,t)=>{switch(e._tag){case`Literal`:return nr(String(e.literal));case`StringKeyword`:return`[\\s\\S]*?`;case`NumberKeyword`:return`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;case`TemplateLiteral`:return ic(e,t,!1);case`Union`:return e.types.map(e=>nc(e,t)).join(`|`)}},rc=(e,t,n,r)=>{if(Vs(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},ic=(e,t,n)=>{let r=``;if(e.head!==``){let i=nr(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=nc(i.type,t);if(r+=rc(i.type,e,t,n),i.literal!==``){let e=nr(i.literal);r+=t&&n?`(${e})`:e}}return r},ac=e=>RegExp(`^${ic(e,!1,!0)}$`),oc=(e,t)=>{let n=[],r=[],i=e=>{switch(e._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:r.push(new ks(e,t,!0));break;case`Literal`:if(ut(e.literal)||Wt(e.literal))n.push(new N(e.literal,t,!1,!0));else throw Error(qa(e.literal));break;case`Enums`:for(let[r,i]of e.enums)n.push(new N(i,t,!1,!0));break;case`UniqueSymbol`:n.push(new N(e.symbol,t,!1,!0));break;case`Union`:e.types.forEach(i);break;default:throw Error(Ka(e))}};return i(e),{propertySignatures:n,indexSignatures:r}},sc=e=>t=>{let n;for(let r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},cc=e=>t=>{let n={...t.annotations};for(let t of e)delete n[t];return n},lc=sc([wo,To,Eo,Do,Oo,ko]),P=e=>{switch(e._tag){case`Declaration`:{let t=uc(e.typeParameters,P);return t===e.typeParameters?e:new is(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=uc(e.elements,e=>{let t=P(e.type);return t===e.type?e:new ws(t,e.isOptional)}),n=Ts(e.rest),r=uc(n,P);return t===e.elements&&r===n?e:new Es(t,r.map(e=>new Cs(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=uc(e.propertySignatures,e=>{let t=P(e.type);return t===e.type?e:new N(e.name,t,e.isOptional,e.isReadonly)}),n=uc(e.indexSignatures,e=>{let t=P(e.type);return t===e.type?e:new ks(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new As(t,n,e.annotations)}case`Union`:{let t=uc(e.types,P);return t===e.types?e:Rs.make(t,e.annotations)}case`Suspend`:return new Us(()=>P(e.f()),e.annotations);case`Refinement`:{let t=P(e.from);return t===e.from?e:new Ws(t,e.filter,e.annotations)}case`Transformation`:{let t=lc(e);return P(t===void 0?e.to:tc(e.to,t))}}return e};function uc(e,t){let n=!1,r=Pe(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}const dc=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return dc(e.from);case`Suspend`:return dc(e.f())}},fc=(e,t)=>{switch(e._tag){case`Declaration`:{let n=uc(e.typeParameters,e=>fc(e,t));return n===e.typeParameters?e:new is(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=uc(e.elements,e=>{let n=fc(e.type,t);return n===e.type?e:new ws(n,e.isOptional)}),r=Ts(e.rest),i=uc(r,e=>fc(e,t));return n===e.elements&&i===r?e:new Es(n,i.map(e=>new Cs(e)),e.isReadonly)}case`TypeLiteral`:{let n=uc(e.propertySignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new N(e.name,n,e.isOptional,e.isReadonly)}),r=uc(e.indexSignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new ks(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new As(n,r)}case`Union`:{let n=uc(e.types,e=>fc(e,t));return n===e.types?e:Rs.make(n)}case`Suspend`:{let n,r=ns(e);if(Ae(r)){let e=t?`Bound`:``;n={[es]:`${r.value}Encoded${e}`}}return new Us(()=>fc(e.f(),t),n)}case`Refinement`:{let n=fc(e.from,t);return t?n===e.from?e:dc(e.from)===void 0&&$o(e)?new Ws(n,e.filter,e.annotations):n:n}case`Transformation`:return fc(e.from,t)}return e},pc=e=>fc(e,!1),F=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},mc=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return mc(e.from)}},hc=(e,t)=>new qs(e,t,Zs),gc=e=>h(yc(e),()=>e._tag);function _c(e){return y(zo(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${St(e)}>`).join(``)})}const vc=e=>Ho(e).pipe(c(()=>Go(e)),c(()=>Uo(e)),be(t=>t+_c(e))),yc=e=>c(Wo(e),()=>vc(e)),bc=/^[+-]?\d+$/,xc=Symbol.for(`effect/BigDecimal`),Sc={[xc]:xc,[Ge](){let e=kc(this);return g(Ue(e.value),s(oe(e.scale)),sn(this))},[_e](e){return Cc(e)&&Nc(this,e)},toString(){return`BigDecimal(${Lc(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[p](){return this.toJSON()},pipe(){return Le(this,arguments)}},Cc=e=>$e(e,xc),wc=(e,t)=>{let n=Object.create(Sc);return n.value=e,n.scale=t,n},Tc=(e,t)=>{if(e!==Ec&&e%Dc===Ec)throw RangeError(`Value must be normalized`);let n=wc(e,t);return n.normalized=n,n},Ec=BigInt(0),Dc=BigInt(10),Oc=Tc(Ec,0),kc=e=>{if(e.normalized===void 0)if(e.value===Ec)e.normalized=Oc;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=Tc(r,i)}return e.normalized},Ac=C(2,(e,t)=>t>e.scale?wc(e.value*Dc**BigInt(t-e.scale),t):t<e.scale?wc(e.value/Dc**BigInt(e.scale-t),t):e),jc=e=>e.value<Ec?wc(-e.value,e.scale):e,Mc=an((e,t)=>e.scale>t.scale?Ac(t,e.scale).value===e.value:e.scale<t.scale?Ac(e,t.scale).value===t.value:e.value===t.value),Nc=C(2,(e,t)=>Mc(e,t)),Pc=e=>kt(Fc(e),()=>RangeError(`Number must be finite, got ${e}`)),Fc=e=>{if(!Number.isFinite(e))return w();let t=`${e}`;if(t.includes(`e`))return Ic(t);let[n,r=``]=t.split(`.`);return v(wc(BigInt(`${n}${r}`),r.length))},Ic=e=>{if(e===``)return v(Oc);let t,n,r=e.search(/[eE]/);if(r!==-1){let i=e.slice(r+1);if(t=e.slice(0,r),n=Number(i),t===``||!Number.isSafeInteger(n)||!bc.test(i))return w()}else t=e,n=0;let i,a,o=t.search(/\./);if(o!==-1){let e=t.slice(0,o),n=t.slice(o+1);i=`${e}${n}`,a=n.length}else i=t,a=0;if(!bc.test(i))return w();let s=a-n;return Number.isSafeInteger(s)?v(wc(BigInt(i),s)):w()},Lc=e=>{let t=kc(e);if(Math.abs(t.scale)>=16)return Rc(t);let n=t.value<Ec,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},Rc=e=>{if(Bc(e))return`0e+0`;let t=kc(e),n=`${jc(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Vc(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},zc=e=>Number(Lc(e)),Bc=e=>e.value===Ec,Vc=e=>e.value<Ec,Hc=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?w():v(Number(e)),Uc=e=>{try{return e.trim()===``?w():v(BigInt(e))}catch{return w()}},Wc=e=>{if(e>2**53-1||e<-(2**53-1))return w();try{return v(BigInt(e))}catch{return w()}},Gc=Symbol.for(`effect/Brand/Refined`),Kc=()=>Object.assign(e=>e,{[Gc]:Gc,option:e=>v(e),either:e=>S(e),is:e=>!0}),qc=Qn,Jc=rr,Yc=An,Xc=Wr,Zc=En,Qc=Symbol.for(`effect/QueueEnqueue`),$c=Symbol.for(`effect/QueueDequeue`),el=Symbol.for(`effect/QueueStrategy`),tl=Symbol.for(`effect/BackingQueue`),nl={_A:e=>e},rl={_A:e=>e},il={_In:e=>e},al={_Out:e=>e};var ol=class extends Vn{queue;takers;shutdownHook;shutdownFlag;strategy;[Qc]=il;[$c]=al;constructor(e,t,n,r,i){super(),this.queue=e,this.takers=t,this.shutdownHook=n,this.shutdownFlag=r,this.strategy=i}pipe(){return Le(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return $t(()=>Tt(this.unsafeSize(),()=>m))}unsafeSize(){return se(this.shutdownFlag)?w():v(this.queue.length()-dn(this.takers)+this.strategy.surplusSize())}get isEmpty(){return Ye(this.size,e=>e<=0)}get isFull(){return Ye(this.size,e=>e>=this.capacity())}get shutdown(){return Ot(ye(e=>(g(this.shutdownFlag,Ke(!0)),g(ur(kl(this.takers),t=>lt(t,e.id()),!1,!1),pe(this.strategy.shutdown),ke(dt(this.shutdownHook,void 0)),Qt))))}get isShutdown(){return Re(()=>se(this.shutdownFlag))}get awaitShutdown(){return Ut(this.shutdownHook)}isActive(){return!se(this.shutdownFlag)}unsafeOffer(e){if(se(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return!0;let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n}offer(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return d(!0);let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n?d(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t=fe(e),n=this.queue.length()===0?fe(Al(this.takers,t.length)):Ve,[r,i]=g(t,Pt(n.length));for(let e=0;e<n.length;e++){let t=n[e],i=r[e];Dl(t,i)}if(i.length===0)return d(!0);let a=this.queue.offerAll(i);return Ml(this.strategy,this.queue,this.takers),_(a)?d(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return ye(e=>{if(se(this.shutdownFlag))return m;let t=this.queue.poll(xn);if(t!==xn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),d(t);{let t=zt(e.id());return g($t(()=>(g(this.takers,kr(t)),Ml(this.strategy,this.queue,this.takers),se(this.shutdownFlag)?m:Ut(t))),ct(()=>Re(()=>jl(this.takers,t))))}})}get takeAll(){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let e=this.queue.pollUpTo(1/0);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(e)}))}takeUpTo(e){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(t)}))}takeBetween(e,t){return $t(()=>sl(this,e,t,nn()))}};const sl=(e,t,n,r)=>n<t?d(r):g(bl(e,n),Zt(i=>{let a=t-i.length;return a===1?g(yl(e),Ye(e=>g(r,at(i),on(e)))):a>1?g(yl(e),Zt(t=>sl(e,a-1,n-i.length-1,g(r,at(i),on(t))))):d(g(r,at(i)))})),cl=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),xl()))),ll=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Sl()))),ul=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Cl()))),dl=()=>g(Re(()=>Cn()),Zt(e=>pl(hl(e),Sl()))),fl=(e,t,n,r,i)=>new ol(e,t,n,r,i),pl=(e,t)=>g(Yt(),Ye(n=>fl(e,Cn(),n,Be(!1),t)));var ml=class{mutable;[tl]=rl;constructor(e){this.mutable=e}poll(e){return Ln(this.mutable,e)}pollUpTo(e){return Hn(this.mutable,e)}offerAll(e){return Pn(this.mutable,e)}offer(e){return kr(this.mutable,e)}capacity(){return Bn(this.mutable)}length(){return dn(this.mutable)}};const hl=e=>new ml(e),gl=e=>e.size,_l=e=>e.shutdown,vl=C(2,(e,t)=>e.offer(t)),yl=e=>e.take,bl=C(2,(e,t)=>e.takeUpTo(t)),xl=()=>new wl,Sl=()=>new Tl,Cl=()=>new El;var wl=class{[el]=nl;putters=Cn();surplusSize(){return dn(this.putters)}onCompleteTakersWithEmptyQueue(e){for(;!Mr(this.putters)&&!Mr(e);){let t=Ln(e,void 0),n=Ln(this.putters,void 0);n[2]&&Dl(n[1],!0),Dl(t,n[0])}}get shutdown(){return g(xt,Zt(e=>g(Re(()=>kl(this.putters)),Zt(t=>ur(t,([t,n,r])=>r?g(lt(n,e),Qt):we,!1,!1)))))}handleSurplus(e,t,n,r){return ye(i=>{let a=zt(i.id());return g($t(()=>(this.unsafeOffer(e,a),this.unsafeOnQueueEmptySpace(t,n),Ml(this,t,n),se(r)?m:Ut(a))),ct(()=>Re(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(e,t){let n=!0;for(;n&&(e.capacity()===1/0||e.length()<e.capacity());){let r=g(this.putters,Ln(xn));if(r===xn)n=!1;else{let n=e.offer(r[0]);n&&r[2]?Dl(r[1],!0):n||Ol(this.putters,g(kl(this.putters),a(r))),Ml(this,e,t)}}}unsafeOffer(e,t){let n=fe(e);for(let e=0;e<n.length;e++){let r=n[e];e===n.length-1?g(this.putters,kr([r,t,!0])):g(this.putters,kr([r,t,!1]))}}unsafeRemove(e){Ol(this.putters,g(kl(this.putters),Fe(([,t])=>t!==e)))}},Tl=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return d(!1)}unsafeOnQueueEmptySpace(e,t){}},El=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return Re(()=>(this.unsafeOffer(t,e),Ml(this,t,n),!0))}unsafeOnQueueEmptySpace(e,t){}unsafeOffer(e,t){let n=t[Symbol.iterator](),r,i=!0;for(;!(r=n.next()).done&&i;){if(e.capacity()===0)return;e.poll(xn),i=e.offer(r.value)}}};const Dl=(e,t)=>gt(e,d(t)),Ol=(e,t)=>g(e,Pn(t)),kl=e=>g(e,Hn(1/0)),Al=(e,t)=>g(e,Hn(t)),jl=(e,t)=>{Ol(e,g(kl(e),Fe(e=>t!==e)))},Ml=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){let i=g(n,Ln(xn));if(i!==xn){let o=t.poll(xn);o===xn?Ol(n,g(kl(n),a(i))):(Dl(i,o),e.unsafeOnQueueEmptySpace(t,n)),r=!0}else r=!1}r&&t.length()===0&&!Mr(n)&&e.onCompleteTakersWithEmptyQueue(n)},Nl=cl,Pl=ll,Fl=ul,Il=dl,Ll=gl,Rl=_l,zl=vl,Bl=yl,Vl=`Continue`,Hl=Symbol.for(`effect/ChannelChildExecutorDecision`),Ul={[Hl]:Hl},Wl=e=>{let t=Object.create(Ul);return t._tag=Vl,t},Gl=Symbol.for(`effect/ChannelContinuation`),Kl={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};var ql=class{onSuccess;onHalt;_tag=`ContinuationK`;[Gl]=Kl;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return Ai(e)?this.onHalt(e.cause):this.onSuccess(e.value)}},Jl=class{finalizer;_tag=`ContinuationFinalizer`;[Gl]=Kl;constructor(e){this.finalizer=e}};const Yl=`PullAfterNext`,Xl=Symbol.for(`effect/ChannelUpstreamPullStrategy`),Zl={_A:e=>e},Ql={[Xl]:Zl},$l=e=>{let t=Object.create(Ql);return t._tag=Yl,t.emitSeparator=e,t},eu=`BracketOut`,tu=`Bridge`,nu=`ConcatAll`,ru=`Emit`,iu=`Ensuring`,au=`Fail`,ou=`Fold`,su=`FromEffect`,cu=`PipeTo`,lu=`Read`,uu=`Succeed`,du=`SucceedNow`,fu=`Suspend`,pu=Symbol.for(`effect/Channel`),mu={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},hu={[pu]:mu,pipe(){return Le(this,arguments)}},gu=e=>$e(e,pu)||Fn(e),_u=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=eu,n.acquire=()=>e,n.finalizer=t,n}),vu=e=>Au(()=>{let t=[];return L(z(e,yu(t)),e=>ju(()=>[u(t),e]))}),yu=e=>Eu({onInput:t=>L(ju(()=>{e.push(t)}),()=>yu(e)),onFailure:wu,onDone:ku}),bu=(e,t,n)=>{let r=Object.create(hu);return r._tag=nu,r.combineInners=t,r.combineAll=n,r.onPull=()=>$l(w()),r.onEmit=()=>Wl,r.value=()=>e,r.k=b,r},xu=C(4,(e,t,n,r)=>{let i=Object.create(hu);return i._tag=nu,i.combineInners=n,i.combineAll=r,i.onPull=()=>$l(w()),i.onEmit=()=>Wl,i.value=()=>e,i.k=t,i}),Su=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=tu,n.input=t,n.channel=e,n}),Cu=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=iu,n.channel=e,n.finalizer=t,n}),wu=e=>I(ui(e)),I=e=>Tu(()=>e),Tu=e=>{let t=Object.create(hu);return t._tag=au,t.error=e,t},L=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=ou,n.channel=e,n.k=new ql(t,I),n}),R=e=>{let t=Object.create(hu);return t._tag=su,t.effect=()=>e,t},z=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=cu,n.left=()=>e,n.right=()=>t,n}),Eu=e=>Du({onInput:e.onInput,onFailure:t=>r(oi(t),{onLeft:e.onFailure,onRight:I}),onDone:e.onDone}),Du=e=>{let t=Object.create(hu);return t._tag=lu,t.more=e.onInput,t.done=new ql(e.onDone,e.onFailure),t},Ou=e=>ju(()=>e),ku=e=>{let t=Object.create(hu);return t._tag=du,t.terminal=e,t},Au=e=>{let t=Object.create(hu);return t._tag=fu,t.channel=e,t},ju=e=>{let t=Object.create(hu);return t._tag=uu,t.evaluate=e,t},Mu=ku(void 0),B=e=>{let t=Object.create(hu);return t._tag=ru,t.out=e,t},Nu=`Done`,Pu=`Emit`,Fu=`FromEffect`,Iu=`Read`,Lu=Symbol.for(`effect/ChannelState`),Ru={_E:e=>e,_R:e=>e},zu={[Lu]:Ru},Bu=()=>{let e=Object.create(zu);return e._tag=Nu,e},Vu=()=>{let e=Object.create(zu);return e._tag=Pu,e},Hu=e=>{let t=Object.create(zu);return t._tag=Fu,t.effect=e,t},Uu=(e,t,n,r)=>{let i=Object.create(zu);return i._tag=Iu,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},Wu=e=>e._tag===Fu,Gu=e=>Wu(e)?e.effect:O,Ku=e=>Wu(e)?Ar(e.effect):void 0,qu=`PullFromChild`,Ju=`PullFromUpstream`,Yu=`DrainChildExecutors`,Xu=`Emit`;var Zu=class{childExecutor;parentSubexecutor;onEmit;_tag=qu;constructor(e,t,n){this.childExecutor=e,this.parentSubexecutor=t,this.onEmit=n}close(e){let t=this.childExecutor.close(e),n=this.parentSubexecutor.close(e);if(t!==void 0&&n!==void 0)return Zn(D(t),D(n),(e,t)=>g(e,Ci(t)));if(t!==void 0)return t;if(n!==void 0)return n}enqueuePullFromChild(e){return this}},Qu=class e{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=Ju;constructor(e,t,n,r,i,a,o,s){this.upstreamExecutor=e,this.createChild=t,this.lastDone=n,this.activeChildExecutors=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o,this.onEmit=s}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}},$u=class e{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Yu;constructor(e,t,n,r,i,a,o){this.upstreamExecutor=e,this.lastDone=t,this.activeChildExecutors=n,this.upstreamDone=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}},ed=class{value;next;_tag=Xu;constructor(e,t){this.value=e,this.next=t}close(e){return this.next.close(e)}enqueuePullFromChild(e){return this}};const td=Symbol.for(`effect/ChannelUpstreamPullRequest`),nd={_A:e=>e},rd={[td]:nd},id=e=>{let t=Object.create(rd);return t._tag=`Pulled`,t.value=e,t},ad=e=>{let t=Object.create(rd);return t._tag=`NoUpstream`,t.activeDownstreamCount=e,t};var od=class e{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(e,t,n){this._currentChannel=e,this._executeCloseLastSubstream=n,this._providedEnv=t}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=Bu();else switch(Fn(this._currentChannel)&&(this._currentChannel=R(this._currentChannel)),this._currentChannel._tag){case eu:t=this.runBracketOut(this._currentChannel);break;case tu:{let e=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let n=this._input;this._input=void 0;let r=()=>M(e.awaitRead(),()=>A(()=>{let t=n.run();switch(t._tag){case Nu:return xi(n.getDone(),{onFailure:t=>e.error(t),onSuccess:t=>e.done(t)});case Pu:return M(e.emit(n.getEmit()),()=>r());case Fu:return $n(t.effect,{onFailure:t=>e.error(t),onSuccess:()=>r()});case Iu:return ld(t,()=>r(),t=>e.error(t))}}));t=Hu(M(Yn(Or(r())),e=>mr(()=>this.addFinalizer(t=>M(Yr(e),()=>A(()=>{let e=this.restorePipe(t,n);return e===void 0?O:e}))))))}break}case nu:{let t=new e(this._currentChannel.value(),this._providedEnv,e=>mr(()=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;this._closeLastSubstream=g(t,j(e))}));t._input=this._input;let n=this._currentChannel;this._activeSubexecutor=new Qu(t,e=>n.k(e),void 0,[],(e,t)=>n.combineInners(e,t),(e,t)=>n.combineAll(e,t),e=>n.onPull(e),e=>n.onEmit(e)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case ru:this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor===void 0?Mu:void 0,t=Vu();break;case iu:this.runEnsuring(this._currentChannel);break;case au:t=this.doneHalt(this._currentChannel.error());break;case ou:this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break;case su:{let e=this._providedEnv===void 0?this._currentChannel.effect():g(this._currentChannel.effect(),On(this._providedEnv));t=Hu($n(e,{onFailure:e=>{let t=this.doneHalt(e);return t!==void 0&&Wu(t)?t.effect:O},onSuccess:e=>{let t=this.doneSucceed(e);return t!==void 0&&Wu(t)?t.effect:O}}));break}case cu:{let t=this._input,n=new e(this._currentChannel.left(),this._providedEnv,e=>this._executeCloseLastSubstream(e));n._input=t,this._input=n,this.addFinalizer(e=>{let n=this.restorePipe(e,t);return n===void 0?O:n}),this._currentChannel=this._currentChannel.right();break}case`Provide`:{let e=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>mr(()=>{this._providedEnv=e}));break}case lu:{let e=this._currentChannel;t=Uu(this._input,b,t=>{try{this._currentChannel=e.more(t)}catch(t){this._currentChannel=e.done.onExit(ki(t))}},t=>{let n=t=>e.done.onExit(t);this._currentChannel=n(t)});break}case uu:t=this.doneSucceed(this._currentChannel.evaluate());break;case du:t=this.doneSucceed(this._currentChannel.terminal);break;case fu:this._currentChannel=this._currentChannel.channel();break}}catch(e){this._currentChannel=I(gi(e))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(e){this._cancelled=e}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(e){this._inProgressFinalizer=e}popAllFinalizers(e){let t=[],n=this._doneStack.pop();for(;n;)n._tag===`ContinuationFinalizer`&&t.push(n.finalizer),n=this._doneStack.pop();let r=t.length===0?O:cd(t,e);return this.storeInProgressFinalizer(r),r}popNextFinalizers(){let e=[];for(;this._doneStack.length!==0;){let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`)return e;e.push(t),this._doneStack.pop()}return e}restorePipe(e,t){let n=this._input;return this._input=t,n===void 0?O:n.close(e)}close(e){let t,n=this._inProgressFinalizer;n!==void 0&&(t=g(n,br(mr(()=>this.clearInProgressFinalizer()))));let r,i=this.popAllFinalizers(e);i!==void 0&&(r=g(i,br(mr(()=>this.clearInProgressFinalizer()))));let a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(e);if(a!==void 0||t!==void 0||r!==void 0)return g(D(sd(a)),Jn(D(sd(t))),Jn(D(sd(r))),T(([[e,t],n])=>g(e,Ci(t),Ci(n))),Sr,M(e=>A(()=>e)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=Si(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop(),this._currentChannel=t.onSuccess(e);return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=Si(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),Si(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneSucceed(e))));return Hu(i)}doneHalt(e){if(this._doneStack.length===0)return this._done=yi(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop();try{this._currentChannel=t.onHalt(e)}catch(e){this._currentChannel=I(gi(e))}return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=yi(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),yi(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneHalt(e))));return Hu(i)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,Bu()}runBracketOut(e){let t=Sr($n(this.provide(e.acquire()),{onFailure:e=>mr(()=>{this._currentChannel=I(e)}),onSuccess:t=>mr(()=>{this.addFinalizer(n=>this.provide(e.finalizer(t,n))),this._currentChannel=B(t)})}));return Hu(t)}provide(e){return this._providedEnv===void 0?e:g(e,On(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new Jl(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case qu:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case Ju:return this.pullFromUpstream(e);case Yu:return this.drainChildExecutors(e);case Xu:return this._emitted=e.value,this._activeSubexecutor=e.next,Vu()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=xi(e,{onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)});return this._activeSubexecutor=void 0,t===void 0?O:Gu(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>g(t,$r(t=>g(mr(()=>t(e)),M(e=>e===void 0?O:e)),{discard:!0})));let n=g(e,xi({onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)}));return this._activeSubexecutor=void 0,n}applyUpstreamPullStrategy(e,t,n){switch(n._tag){case Yl:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[void 0,...t]:t]}case`PullAfterAllEnqueued`:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[...t,void 0]:t]}}}pullFromChild(e,t,n,r){return Uu(e,b,i=>{let a=n(i);switch(a._tag){case Vl:break;case`Close`:this.finishWithDoneValue(e,t,a.value);break;case`Yield`:{let e=t.enqueuePullFromChild(r);this.replaceSubexecutor(e);break}}this._activeSubexecutor=new ed(i,this._activeSubexecutor)},xi({onFailure:n=>{let r=this.handleSubexecutorFailure(e,t,n);return r===void 0?void 0:Ku(r)},onSuccess:n=>{this.finishWithDoneValue(e,t,n)}}))}finishWithDoneValue(e,t,n){let r=t;switch(r._tag){case Ju:{let t=new Qu(r.upstreamExecutor,r.createChild,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.combineChildResults,r.combineWithChildResult,r.onPull,r.onEmit);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}case Yu:{let t=new $u(r.upstreamExecutor,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.upstreamDone,r.combineChildResults,r.combineWithChildResult,r.onPull);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}default:break}}handleSubexecutorFailure(e,t,n){return this.finishSubexecutorWithCloseEffect(yi(n),e=>t.close(e),t=>e.close(t))}pullFromUpstream(e){if(e.activeChildExecutors.length===0)return this.performPullFromUpstream(e);let t=e.activeChildExecutors[0],n=new Qu(e.upstreamExecutor,e.createChild,e.lastDone,e.activeChildExecutors.slice(1),e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit);if(t===void 0)return this.performPullFromUpstream(n);this.replaceSubexecutor(new Zu(t.childExecutor,n,t.onEmit))}performPullFromUpstream(t){return Uu(t.upstreamExecutor,e=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),j(e))},n=>{if(this._closeLastSubstream!==void 0){let r=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(r),T(()=>{let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))}))}let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))},e=>{if(t.activeChildExecutors.some(e=>e!==void 0)){let e=new $u(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){let t=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),T(()=>this.replaceSubexecutor(e)))}this.replaceSubexecutor(e);return}let n=this._closeLastSubstream,r=this.finishSubexecutorWithCloseEffect(g(e,Ti(e=>t.combineWithChildResult(t.lastDone,e))),()=>n,e=>t.upstreamExecutor.close(e));return r===void 0?void 0:Ku(r)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let t=this._closeLastSubstream;return t!==void 0&&this.addFinalizer(()=>k(t)),this.finishSubexecutorWithCloseEffect(e.upstreamDone,()=>t,t=>e.upstreamExecutor.close(t))}let t=e.activeChildExecutors[0],n=e.activeChildExecutors.slice(1);if(t===void 0){let[t,r]=this.applyUpstreamPullStrategy(!0,n,e.onPull(ad(n.reduce((e,t)=>t===void 0?e:e+1,0))));return this.replaceSubexecutor(new $u(e.upstreamExecutor,e.lastDone,r,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),Ae(t)?(this._emitted=t.value,Vu()):void 0}let r=new $u(e.upstreamExecutor,e.lastDone,n,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new Zu(t.childExecutor,r,t.onEmit))}};const sd=e=>e===void 0?O:e,cd=(e,t)=>g($r(e,e=>D(e(t))),T(e=>g(Di(e),h(()=>Oi))),M(e=>A(()=>e))),ld=(e,t,n)=>{let r=[e],i=()=>{let e=r.pop();if(e===void 0||e.upstream===void 0)return Fr(`Unexpected end of input for channel execution`);let a=e.upstream.run();switch(a._tag){case Pu:{let a=e.onEmit(e.upstream.getEmit());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Nu:{let a=e.onDone(e.upstream.getDone());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Fu:return r.push(e),g(e.onEffect(a.effect),hr(t=>A(()=>{let n=e.onDone(yi(t));return n===void 0?O:n})),$n({onFailure:n,onSuccess:()=>i()}));case Iu:return r.push(e),r.push(a),A(()=>i())}};return i()},ud=C(2,(e,t)=>{let n=(t,n,r)=>Er(mr(()=>new od(e,void 0,b)),e=>A(()=>dd(e.run(),e).pipe(Mn(t),j(E(t)),gn(E(n)))),(e,t)=>{let n=e.close(t);return n===void 0?O:Xr(n,e=>Ir(r,ni(e)))});return cr(e=>zr([Qr(t,In),pn(),pn()]).pipe(M(([r,i,a])=>e(n(i,a,r)).pipe(yn(t),M(n=>t.addFinalizer(e=>{let t=Ai(e)?si(e.cause):void 0;return ai(i).pipe(M(e=>e?er(a,void 0).pipe(j(pr(n)),j(Nr(n))):er(a,void 0).pipe(j(t&&nt(t)>0?gr(n,xe(t)):Yr(n)),j(Nr(n)))))}).pipe(j(e(E(i)))))))))}),dd=(e,t)=>{let n=e;switch(n._tag){case Fu:return g(n.effect,M(()=>dd(t.run(),t)));case Pu:return dd(t.run(),t);case Nu:return A(()=>t.getDone());case Iu:return ld(n,()=>dd(t.run(),t),ni)}},fd={[Symbol.for(`effect/ChannelMergeDecision`)]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},pd=e=>{let t=Object.create(fd);return t._tag=`Await`,t.f=e,t},md=`BothRunning`,hd=`LeftDone`,gd=`RightDone`,_d=Symbol.for(`effect/ChannelMergeState`),vd={[_d]:_d},yd=(e,t)=>{let n=Object.create(vd);return n._tag=md,n.left=e,n.right=t,n},bd=e=>{let t=Object.create(vd);return t._tag=hd,t.f=e,t},xd=e=>{let t=Object.create(vd);return t._tag=gd,t.f=e,t},Sd=`BackPressure`,Cd=`BufferSliding`,wd=Symbol.for(`effect/ChannelMergeStrategy`),Td={[wd]:wd},Ed=e=>{let t=Object.create(Td);return t._tag=Sd,t},Dd=e=>{let t=Object.create(Td);return t._tag=Cd,t},Od=C(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case Sd:return t();case Cd:return n()}}),kd=`Empty`,Ad=`Emit`,jd=`Error`,Md=`Done`,Nd=e=>({_tag:kd,notifyProducer:e}),Pd=e=>({_tag:Ad,notifyConsumers:e}),Fd=e=>({_tag:jd,cause:e}),Id=e=>({_tag:Md,done:e});var Ld=class{ref;constructor(e){this.ref=e}awaitRead(){return Kn(jr(this.ref,e=>e._tag===kd?[E(e.notifyProducer),e]:[O,e]))}get close(){return lr(e=>this.error(_i(e)))}done(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>er(t,x(e)),{discard:!0}),Id(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}emit(e){return M(pn(),t=>Kn(jr(this.ref,n=>{switch(n._tag){case kd:return[E(n.notifyProducer),n];case Ad:{let r=n.notifyConsumers[0],i=n.notifyConsumers.slice(1);if(r!==void 0)return[er(r,S(e)),i.length===0?Nd(t):Pd(i)];throw Error(`Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues`)}case jd:return[ln,n];case Md:return[ln,n]}})))}error(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>Gn(t,e),{discard:!0}),Fd(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}get take(){return this.takeWith(e=>yi(hi(e,x)),e=>Si(e),e=>wi(S(e)))}takeWith(e,t,n){return M(pn(),i=>Kn(jr(this.ref,a=>{switch(a._tag){case kd:return[j(er(a.notifyProducer,void 0),fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})})),Pd([i])];case Ad:return[fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})}),Pd([...a.notifyConsumers,i])];case jd:return[k(e(a.cause)),a];case Md:return[k(n(a.done)),a]}})))}};const Rd=()=>g(pn(),M(e=>zn(Nd(e))),T(e=>new Ld(e))),zd=C(2,(e,t)=>xu(e,t,()=>void 0,()=>void 0)),Bd=e=>{let t=Du({onInput:()=>t,onFailure:I,onDone:Ou});return z(e,t)},Vd=C(2,(e,t)=>Cu(e,()=>t)),Hd=e=>L(e,b),Ud=e=>cf(e.takeWith(I,t=>L(B(t),()=>Ud(e)),Ou)),Wd=()=>Eu({onInput:e=>L(B(e),()=>Wd()),onFailure:wu,onDone:ku}),Gd=C(2,(e,t)=>L(e,e=>ju(()=>t(e)))),Kd=C(2,(e,t)=>{let n=Eu({onInput:e=>L(B(t(e)),()=>n),onFailure:wu,onDone:ku});return z(e,n)}),qd=C(2,(e,t)=>{let n=Du({onInput:e=>g(R(t(e)),L(B),L(()=>n)),onFailure:I,onDone:ku});return z(e,n)}),Jd=e=>t=>Yd(e)(t,l),Yd=({bufferSize:e=16,concurrency:t,mergeStrategy:n=Ed()})=>(i,a)=>uf(o=>Rn(function*(){let s=t===`unbounded`?2**53-1:t,c=yield*Rd(),l=Ud(c),u=yield*Nl(e);yield*Ir(o,Rl(u));let d=yield*Il();yield*Ir(o,Rl(d));let f=yield*zn(w()),p=yield*pn(),m=(yield*Sn(s)).withPermits,h=yield*of(z(l,i),o);function _(e){return e.pipe(M(r({onLeft:e=>k(v(e)),onRight:e=>Kr(zl(u,k(S(e))),w())})),or({until:e=>Ae(e)}),M(e=>Nn(f,y({onNone:()=>v(e.value),onSome:t=>v(a(t,e.value))}))),hr(e=>ci(e)?ni(e):zl(u,ni(e)).pipe(j(er(p,void 0)),fr)))}yield*h.pipe($n({onFailure:e=>zl(u,ni(e)).pipe(j(k(!1))),onSuccess:r({onLeft:e=>ir(Or(E(p)),Or(m(s)(O)),{onSelfDone:(e,t)=>Kr(Yr(t),!1),onOtherDone:(t,n)=>j(Yr(n),bn(f).pipe(M(y({onNone:()=>zl(u,k(x(e))),onSome:t=>zl(u,k(x(a(t,e))))})),Kr(!1)))}),onRight:e=>Od(n,{onBackPressure:()=>Rn(function*(){let t=yield*pn(),n=Dr(t=>of(z(l,e),t).pipe(M(e=>ar(D(_(e)),D(Or(E(p))))),M(b)));return yield*er(t,void 0).pipe(j(n),m(1),yn(o)),yield*E(t),!(yield*ai(p))}),onBufferSliding:()=>Rn(function*(){let t=yield*pn(),n=yield*pn(),r=yield*Ll(d);yield*Bl(d).pipe(M(e=>er(e,void 0)),dr(()=>r>=s)),yield*zl(d,t);let i=Dr(n=>of(z(l,e),n).pipe(M(e=>D(_(e)).pipe(ar(D(Or(E(p)))),ar(D(Or(E(t)))))),M(b)));return yield*er(n,void 0).pipe(j(i),m(1),yn(o)),yield*E(n),!(yield*ai(p))})})})}),or({while:e=>e}),yn(o));let ee=g(Bl(u),Kn,fn({onFailure:I,onSuccess:r({onLeft:ku,onRight:e=>L(B(e),()=>ee)})}),cf);return Su(ee,c)})),Xd=C(3,(e,t,n)=>Jd(n)(Kd(e,t))),Zd=C(2,(e,t)=>{function n(n){return Rn(function*(){let i=yield*Rd(),a=Ud(i),o=yield*of(z(a,e),n),s=yield*of(z(a,t.other),n);function c(e,t,i){return(a,o,s)=>{function c(e){let n=e;return n._tag===`Done`?k(R(j(Yr(t),n.effect))):T(pr(t),xi({onFailure:e=>R(n.f(yi(e))),onSuccess:r({onLeft:e=>R(n.f(Si(e))),onRight:e=>mf(B(e),l(s(n.f)))})}))}return xi(e,{onFailure:e=>c(a(yi(e))),onSuccess:r({onLeft:e=>c(a(Si(e))),onRight:e=>k(L(B(e),()=>L(R(yn(Or(i),n)),e=>l(o(e,t)))))})})}}function l(e){switch(e._tag){case md:{let n=Or(yr(e.left)),r=Or(yr(e.right));return cf(ir(n,r,{onSelfDone:(n,r)=>j(Yr(r),c(n,e.right,o)(t.onSelfDone,yd,e=>bd(e))),onOtherDone:(n,r)=>j(Yr(r),c(n,e.left,s)(t.onOtherDone,(e,t)=>yd(t,e),e=>xd(e)))}))}case hd:return cf(T(D(s),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(bd(e.f)))})})));case gd:return cf(T(D(o),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(xd(e.f)))})})))}}return R(ti(e=>{let t=ti(t=>(t.transferChildren(e.scope()),O));return Zn(Or(o).pipe(br(t),yn(n)),Or(s).pipe(br(t),yn(n)),(e,t)=>yd(e,t))})).pipe(L(l),Su(i))})}return uf(n)}),Qd=C(2,(e,t)=>Au(()=>{let n,r=Eu({onInput:e=>L(B(e),()=>r),onFailure:e=>(n=gf(e),I(gi(n))),onDone:ku}),i=Du({onInput:e=>g(B(e),L(()=>i)),onFailure:e=>di(e)&&_f(e.defect)&&te(e.defect,n)?wu(e.defect.error):I(e),onDone:ku});return z(z(z(e,r),t),i)})),$d=e=>Dr(t=>ud(e,t)),ef=e=>$d(Bd(e)),tf=e=>Rr(t=>ud(e,t)),nf=e=>cf(cr(t=>T(ri(),n=>_u(Xr(t(sr(e,n)),e=>xr(n,yi(e))),(e,t)=>xr(n,t))))),rf=e=>lf(T(qr,t=>L(R(e(t)),B))),af=()=>Au(()=>{let e=``,t=!1,n=n=>{let r=[];return Ee(n,n=>{if(n.length!==0){let i=0,a=n.indexOf(`\r`),o=n.indexOf(`
|
|
2
|
+
`);for(t&&=(o===0?(r.push(e),e=``,i=1,o=n.indexOf(`
|
|
3
|
+
`,i)):e+=`\r`,!1);a!==-1||o!==-1;)a===-1||o!==-1&&o<a?(e.length===0?r.push(n.substring(i,o)):(r.push(e+n.substring(i,o)),e=``),i=o+1,o=n.indexOf(`
|
|
4
|
+
`,i)):n.length===a+1?(t=!0,a=-1):o===a+1?(e.length===0?r.push(n.substring(i,a)):(e+=n.substring(i,a),r.push(e),e=``),i=a+2,a=n.indexOf(`\r`,i),o=n.indexOf(`
|
|
5
|
+
`,i)):a=n.indexOf(`\r`,a+1);t?e+=n.substring(i,n.length-1):e+=n.substring(i,n.length)}}),le(r)},r=Du({onInput:e=>{let t=n(e);return _(t)?r:L(B(t),()=>r)},onFailure:t=>e.length===0?I(t):L(B(Dt(e)),()=>I(t)),onDone:t=>e.length===0?Ou(t):L(B(Dt(e)),()=>Ou(t))});return r}),of=C(2,(e,t)=>Jn(mr(()=>new od(e,void 0,b)),_r()).pipe(Pr(([e,n])=>wr(t,t=>{let r=e.close(t);return r===void 0?O:On(r,n)})),Sr,T(([e])=>A(()=>sf(e.run(),e))))),sf=(e,t)=>{let n=e;switch(n._tag){case Nu:return xi(t.getDone(),{onFailure:ni,onSuccess:e=>k(x(e))});case Pu:return k(S(t.getEmit()));case Fu:return g(n.effect,M(()=>sf(t.run(),t)));case Iu:return ld(n,()=>sf(t.run(),t),e=>ni(e))}},cf=e=>Hd(R(e)),lf=e=>bu(nf(e),(e,t)=>e,(e,t)=>e),uf=e=>bu(rf(e),(e,t)=>e,(e,t)=>e),df=e=>ff(0,e.length,e),ff=(e,t,n)=>e===t?Mu:g(B(g(n,ve(e))),L(()=>ff(e+1,t,n))),pf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Zd(e,{other:t,onSelfDone:e=>pd(t=>A(()=>Ei(e,t))),onOtherDone:e=>pd(t=>A(()=>Ei(t,e)))}):L(e,e=>Gd(t,t=>[e,t]))),mf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Gd(pf(e,t,{concurrent:!0}),e=>e[1]):L(e,()=>t)),hf=Symbol.for(`effect/Channel/ChannelException`),gf=e=>({_tag:`ChannelException`,[hf]:hf,error:e}),_f=e=>$e(e,hf),vf=Symbol.for(`effect/Sink`),yf={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};var bf=class{channel;[vf]=yf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const xf=e=>new bf(Au(()=>Mf(e()))),Sf=()=>new bf(Cf(nn())),Cf=e=>Du({onInput:t=>Cf(g(e,at(t))),onFailure:I,onDone:()=>Ou(e)}),wf=new bf(Bd(Wd())),Tf=(e,t,n)=>xf(()=>new bf(Ef(e,t,n))),Ef=(e,t,n)=>t(e)?Eu({onInput:r=>Ef(n(e,r),t,n),onFailure:wu,onDone:()=>ku(e)}):ku(e),Df=(e,t)=>Tf(e,tn,t),Of=e=>{let t=Du({onInput:n=>g(R($r(n,t=>e(t),{discard:!0})),L(()=>t)),onFailure:I,onDone:()=>Mu});return new bf(t)},kf=e=>new bf(e),Af=e=>new bf(R(e)),jf=C(2,(e,t)=>new bf(g(Mf(e),Gd(t)))),Mf=e=>Fn(e)?Mf(Af(e)):e.channel,Nf=e=>new bf(lf(e.pipe(T(e=>Mf(e))))),Pf=xf(()=>{let e=[];return g(Df(void 0,(t,n)=>Ee(n,t=>{e.push(String(t))})),jf(()=>e.join(``)))}),Ff=Lr,If=e=>Object.assign(e,{chunk(e){return this(k(e))},die(e){return this(Br(e))},dieMessage(e){return this(Fr(e))},done(e){return this(A(()=>ji(e,{onFailure:v,onSuccess:Dt})))},end(){return this(Zr(w()))},fail(e){return this(Zr(v(e)))},fromEffect(e){return this(jn(e,{onFailure:v,onSuccess:Dt}))},fromEffectChunk(e){return this(g(e,Wn(v)))},halt(e){return this(ni(g(e,hi(v))))},single(e){return this(k(Dt(e)))}}),Lf=Symbol.for(`effect/Take`),Rf={_A:e=>e,_E:e=>e};var zf=class{exit;[Lf]=Rf;constructor(e){this.exit=e}pipe(){return Le(this,arguments)}};const Bf=e=>new zf(Si(e)),Vf=e=>A(()=>e.exit),Hf=new zf(wi(w())),Uf=e=>new zf(yi(g(e,hi(v)))),Wf=e=>fn(e,{onFailure:e=>y(mi(e),{onNone:()=>Hf,onSome:Uf}),onSuccess:Bf}),Gf=C(2,(e,{onEnd:t,onFailure:n,onSuccess:r})=>xi(e.exit,{onFailure:e=>y(mi(e),{onNone:t,onSome:n}),onSuccess:r})),Kf=()=>Zr(w()),qf=Symbol.for(`effect/Stream`),Jf={_R:e=>e,_E:e=>e,_A:e=>e};var Yf=class{channel;[qf]=Jf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const Xf=e=>$e(e,qf)||Fn(e),Zf=e=>{if(e===`unbounded`)return Il();if(typeof e==`number`||e===void 0)return Nl(e??16);switch(e.strategy){case`dropping`:return Pl(e.bufferSize??16);case`sliding`:return Fl(e.bufferSize??16);default:return Nl(e.bufferSize??16)}},Qf=(e,t)=>g(Gr(Zf(t),e=>Rl(e)),M(t=>g(_r(),M(n=>g(e(If(e=>g(Wf(e),M(e=>zl(t,e)),fr,Ff(n)).then(e=>{if(Ai(e)&&!ci(e.cause))throw li(e.cause)}))),j(zn(!1)),M(e=>g(bn(e),T(n=>n?Kf():g(Bl(t),M(Vf),tr(()=>g(un(e,!0),j(Rl(t)))))))))))),bp,rp(gp)),$f=C(2,(e,t)=>{if(t.strategy===`dropping`)return ep(e,t.capacity);if(t.strategy===`sliding`)return tp(e,t.capacity);let n=Cp(e,t);return new Yf(lf(T(n,e=>{let t=g(R(Bl(e)),L(Gf({onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))})));return t})))}),ep=C(2,(e,t)=>{let n=Gr(Pl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),tp=C(2,(e,t)=>{let n=Gr(Fl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),np=(e,t)=>{let n=(e,t)=>{let r=n=>g(bn(t),Pr(E),j(pn()),M(r=>g(zl(e,[n,r]),j(un(t,r)),j(E(r)))),fr,R);return Du({onInput:r=>g(pn(),M(n=>g(zl(e,[Bf(r),n]),M(e=>g(un(t,n),dr(()=>e))))),fr,R,L(()=>n(e,t))),onFailure:e=>r(Uf(e)),onDone:()=>r(Hf)})},r=e=>{let t=g(R(Bl(e)),L(([e,n])=>mf(R(er(n,void 0)),Gf(e,{onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))}))));return t};return lf(g(e,M(e=>g(pn(),Pr(e=>er(e,void 0)),M(i=>g(zn(i),M(r=>g(t,z(n(e,r)),tf,_n)),Kr(r(e))))))))},rp=C(e=>Xf(e[0]),(e,t,n)=>{let r=n?.bufferSize??16;return n?.switch?ip(n?.concurrency,()=>ap(e,1,r,t),n=>ap(e,n,r,t)):ip(n?.concurrency,()=>new Yf(zd(cp(e),e=>g(e,Ee(e=>cp(t(e))),Ct(Mu,(e,t)=>g(e,mf(t)))))),r=>new Yf(g(cp(e),zd(df),Xd(e=>cp(t(e)),n))))}),ip=(e,t,n)=>{switch(e){case void 0:return t();case`unbounded`:return n(2**53-1);default:return e>1?n(e):t()}},ap=C(4,(e,t,n,r)=>new Yf(g(cp(e),zd(df),Xd(e=>cp(r(e)),{concurrency:t,mergeStrategy:Dd(),bufferSize:n})))),op=C(e=>Xf(e[0]),(e,t)=>rp(e,b,t)),sp=e=>new Yf(e),cp=e=>{if(`channel`in e)return e.channel;if(Fn(e))return cp(up(e));throw TypeError(`Expected a Stream.`)},lp=e=>new Yf(_(e)?Mu:B(e)),up=e=>g(e,Wn(v),dp),dp=e=>new Yf(cf(ii(e,{onFailure:y({onNone:()=>Mu,onSome:wu}),onSuccess:e=>B(Dt(e))}))),fp=C(2,(e,t)=>new Yf(g(cp(e),Kd(Ee(t))))),pp=C(2,(e,t)=>new Yf(g(cp(e),Kd(t)))),mp=e=>_p(e,Pf),hp=C(2,(e,t)=>new Yf(z(cp(e),t))),gp=e=>Tp(e,e=>g(T(e,t=>v([t,e])),Jr(y({onNone:()=>k(w()),onSome:Zr})))),_p=C(2,(e,t)=>cp(e).pipe(Qd(Mf(t)),ef)),vp=e=>_p(e,Sf()),yp=C(2,(e,t)=>{let n=Du({onInput:e=>L(B(Bf(e)),()=>n),onFailure:e=>B(Uf(e)),onDone:()=>B(Hf)});return g(z(cp(e),n),qd(e=>zl(t,e)),Bd,tf,fr)}),bp=e=>new Yf(Vd(nf(g(e,T(Dt))),O)),xp=e=>hp(e,af()),Sp=e=>new Yf(Au(()=>cp(e()))),Cp=C(e=>Xf(e[0]),(e,t)=>Pr(Gr(t?.strategy===`unbounded`?Il():t?.strategy===`dropping`?Pl(t.capacity??2):t?.strategy===`sliding`?Fl(t.capacity??2):Nl(t?.capacity??2),e=>Rl(e)),t=>_n(yp(e,t)))),wp=C(2,(e,t)=>new Yf(Au(()=>{let n={ref:nn()},r={ref:!1},i=Au(()=>{let e=n.ref;return _(e)?Eu({onInput:e=>g(B(e),L(()=>i)),onFailure:wu,onDone:ku}):(n.ref=nn(),g(df(e),L(()=>i)))}),a=e=>{let t=n.ref,r=at(t,Fe(e,e=>e.length!==0));return n.ref=r,r},o=Eu({onInput:e=>L(B(e),()=>o),onFailure:wu,onDone:e=>mf(ju(()=>{r.ref=!0}),ku(e))}),s=g(t,Mf,vu,L(([e,t])=>g(Ou([r.ref,a(e)]),L(([e,n])=>{let r=e&&_(n)?Mu:s;return g(B(Dt(t)),L(()=>r))}))));return g(cp(e),z(o),z(i),Qd(s))}))),Tp=(e,t)=>Sp(()=>{let n=e=>cf(T(t(e),y({onNone:()=>Mu,onSome:([e,t])=>L(B(e),()=>n(t))})));return new Yf(n(e))}),Ep=e=>op(up(e)),Dp=e=>op(bp(e)),Op=C(e=>Xf(e[0]),(e,t=`utf-8`)=>Sp(()=>{let n=new TextDecoder(t);return fp(e,e=>n.decode(e,{stream:!0}))})),kp=Su,Ap=Vd,jp=L,Mp=R,Np=Au,Pp=Mu,Fp=B,Ip=qi,Lp=Yi,Rp=Xi,zp=Zi,Bp=Qi,Vp=$i,Hp=ta,Up=na,Wp=ia,Gp=sa,Kp=da,qp=fa,Jp=ha,Yp=ga,Xp=_a,Zp=Sa;Lt(`effect/DateTime/CurrentTimeZone`)();const Qp=ka,$p=ja;var V=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},em=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},tm=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},H=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},nm=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},rm=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},U=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},im=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}};const am=Symbol.for(`effect/Schema/ParseErrorTypeId`);var om=class extends Li(`ParseError`){[am]=am;get message(){return this.toString()}toString(){return Km.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[p](){return this.toJSON()}};const sm=e=>new om({issue:e}),W=S,cm=x,lm=It,um=He,dm=ge,fm=C(2,(e,t)=>dm(e)?r(e,{onLeft:x,onRight:t}):M(e,t)),pm=C(2,(e,t)=>dm(e)?Xe(e,t):T(e,t)),mm=C(2,(e,t)=>dm(e)?Ne(e,t):Wn(e,t)),hm=C(2,(e,t)=>dm(e)?et(e,{onLeft:t.onFailure,onRight:t.onSuccess}):jn(e,t)),gm=C(2,(e,t)=>dm(e)?r(e,{onLeft:t,onRight:S}):Jr(e,t)),_m=(e,t)=>t===void 0||Wt(t)?e:e===void 0?t:{...e,...t},vm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,_m(n,t))},ym=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>ae(r(e,t),sm)},bm=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>wt(r(e,t))},xm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,{..._m(n,t),isEffectAllowed:!0})},Sm=(e,t)=>ym(e.ast,!0,t),Cm=(e,t)=>bm(e.ast,!0,t),wm=(e,t)=>vm(e.ast,!0,t),Tm=(e,t)=>xm(e.ast,!0,t),Em=(e,t)=>ym(e.ast,!1,t),Dm=(e,t)=>xm(e.ast,!1,t),Om=Sm,km=(e,t)=>ym(P(e.ast),!0,t),Am=(e,t)=>{let n=G(P(e.ast),!0);return(e,r)=>me(n(e,{exact:!0,..._m(t,r)}))},jm=Em,Mm=tt(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),Nm=tt(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),G=(e,t)=>{let n=t?Mm:Nm,r=n.get(e);if(r)return r;let i=Im(e,t),a=Yo(e),o=Ae(a)?(e,t)=>i(e,_m(t,a.value)):i,s=Xo(e),c=t&&Ae(s)?(t,n)=>Vm(gm(o(t,n),s.value),e,t,n):o;return n.set(e,c),c},Pm=e=>o(Ko(e)),Fm=e=>o(qo(e)),Im=(t,r)=>{switch(t._tag){case`Refinement`:if(r){let e=G(t.from,!0);return(n,r)=>{r??=Ks;let i=r?.errors===`all`,a=fm(gm(e(n,r),e=>{let a=new nm(t,n,`From`,e);return i&&$o(t)&&th(e)?y(t.filter(n,r,t),{onNone:()=>x(a),onSome:e=>x(new H(t,n,[a,new nm(t,n,`Predicate`,e)]))}):x(a)}),e=>y(t.filter(e,r,t),{onNone:()=>S(e),onSome:e=>x(new nm(t,n,`Predicate`,e))}));return Vm(a,t,n,r)}}else{let e=G(P(t),!0),n=G(Bm(t.from),!1);return(r,i)=>Vm(fm(e(r,i),e=>n(e,i)),t,r,i)}case`Transformation`:{let e=Wm(t.transformation,r),n=r?G(t.from,!0):G(t.to,!1),i=r?G(t.to,!0):G(t.from,!1);return(a,o)=>Vm(fm(mm(n(a,o),e=>new rm(t,a,r?`Encoded`:`Type`,e)),n=>fm(mm(e(n,o??Ks,t,a),e=>new rm(t,a,`Transformation`,e)),e=>mm(i(e,o),e=>new rm(t,a,r?`Type`:`Encoded`,e)))),t,a,o)}case`Declaration`:{let e=r?t.decodeUnknown(...t.typeParameters):t.encodeUnknown(...t.typeParameters);return(n,r)=>Vm(e(n,r??Ks,t),t,n,r)}case`Literal`:return Lm(t,e=>e===t.literal);case`UniqueSymbol`:return Lm(t,e=>e===t.symbol);case`UndefinedKeyword`:return Lm(t,_t);case`NeverKeyword`:return Lm(t,Vt);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return S;case`StringKeyword`:return Lm(t,ut);case`NumberKeyword`:return Lm(t,Wt);case`BooleanKeyword`:return Lm(t,e);case`BigIntKeyword`:return Lm(t,je);case`SymbolKeyword`:return Lm(t,mt);case`ObjectKeyword`:return Lm(t,st);case`Enums`:return Lm(t,e=>t.enums.some(([t,n])=>n===e));case`TemplateLiteral`:{let e=ac(t);return Lm(t,t=>ut(t)&&e.test(t))}case`TupleType`:{let e=t.elements.map(e=>G(e.type,r)),i=t.rest.map(e=>G(e.type,r)),a=t.elements.filter(e=>!e.isOptional);t.rest.length>0&&(a=a.concat(t.rest.slice(1)));let o=a.length,s=t.elements.length>0?t.elements.map((e,t)=>t).join(` | `):`never`,c=Pm(t),l=Fm(t);return(r,u)=>{if(!n(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=[],h=r.length;for(let e=h;e<=o-1;e++){let n=new V(e,r,new tm(a[e-h]));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,m))}if(t.rest.length===0)for(let e=t.elements.length;e<=h-1;e++){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${s}`));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,m))}let g=0,_;for(;g<e.length;g++)if(h<g+1){if(t.elements[g].isOptional)continue}else{let n=e[g],i=n(r[g],u);if(dm(i)){if(Bt(i)){let e=new V(g,r,i.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}m.push([p++,i.right])}else{let e=p++,n=g;_||=[],_.push(({es:a,output:o})=>M(Cr(i),i=>{if(Bt(i)){let s=new V(n,r,i.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,i.right]),O}))}}if(qt(i)){let[e,...n]=i;for(;g<h-n.length;g++){let n=e(r[g],u);if(dm(n))if(Bt(n)){let e=new V(g,r,n.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}else m.push([p++,n.right]);else{let e=p++,i=g;_||=[],_.push(({es:a,output:o})=>M(Cr(n),n=>{if(Bt(n)){let s=new V(i,r,n.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}else return o.push([e,n.right]),O}))}}for(let e=0;e<n.length;e++){let i=g+e;if(!(h<i+1)){let a=n[e](r[i],u);if(dm(a)){if(Bt(a)){let e=new V(i,r,a.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}m.push([p++,a.right])}else{let e=p++;_||=[],_.push(({es:n,output:o})=>M(Cr(a),a=>{if(Bt(a)){let s=new V(i,r,a.left);return d?(n.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,a.right]),O}))}}}}let ee=({es:e,output:n})=>pt(e)?x(new H(t,r,Um(e),Um(n))):S(Um(n));if(_&&_.length>0){let e=_;return A(()=>{let t={es:We(f),output:We(m)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ee(t))})}return ee({output:m,es:f})}}case`TypeLiteral`:{if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return Lm(t,rt);let e=[],n={},i=[];for(let a of t.propertySignatures)e.push([G(a.type,r),a]),n[a.name]=null,i.push(a.name);let a=t.indexSignatures.map(e=>[G(e.parameter,r),G(e.type,r),e.parameter]),o=Rs.make(t.indexSignatures.map(e=>e.parameter).concat(i.map(e=>mt(e)?new ls(e):new os(e)))),s=G(o,r),c=Pm(t),l=Fm(t);return(r,u)=>{if(!Mt(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=u?.onExcessProperty===`error`,h=u?.onExcessProperty===`preserve`,g={},_;if(m||h){_=Reflect.ownKeys(r);for(let e of _){let n=s(e,u);if(dm(n)&&Bt(n))if(m){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${String(o)}`));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,g))}else g[e]=r[e]}}let ee,te=u?.exact===!0;for(let n=0;n<e.length;n++){let i=e[n][1],a=i.name,o=Object.prototype.hasOwnProperty.call(r,a);if(!o){if(i.isOptional)continue;if(te){let e=new V(a,r,new tm(i));if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,g))}}let s=e[n][0],c=s(r[a],u);if(dm(c)){if(Bt(c)){let e=new V(a,r,o?c.left:new tm(i));if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,g))}g[a]=c.right}else{let e=p++,n=a;ee||=[],ee.push(({es:a,output:s})=>M(Cr(c),c=>{if(Bt(c)){let l=new V(n,r,o?c.left:new tm(i));return d?(a.push([e,l]),O):x(new H(t,r,l,s))}return s[n]=c.right,O}))}}for(let e=0;e<a.length;e++){let i=a[e],o=i[0],s=i[1],c=La(r,i[2]);for(let e of c){let i=o(e,u);if(dm(i)&&me(i)){let i=s(r[e],u);if(dm(i))if(Bt(i)){let n=new V(e,r,i.left);if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,g))}else Object.prototype.hasOwnProperty.call(n,e)||(g[e]=i.right);else{let a=p++,o=e;ee||=[],ee.push(({es:s,output:c})=>M(Cr(i),i=>{if(Bt(i)){let e=new V(o,r,i.left);return d?(s.push([a,e]),O):x(new H(t,r,e,c))}else return Object.prototype.hasOwnProperty.call(n,e)||(c[e]=i.right),O}))}}}}let ne=({es:e,output:n})=>{if(pt(e))return x(new H(t,r,Um(e),n));if(u?.propertyOrder===`original`){let e=_||Reflect.ownKeys(r);for(let t of i)e.indexOf(t)===-1&&e.push(t);let t={};for(let r of e)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return S(t)}return S(n)};if(ee&&ee.length>0){let e=ee;return A(()=>{let t={es:We(f),output:Object.assign({},g)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ne(t))})}return ne({es:f,output:g})}}case`Union`:{let e=zm(t.types,r),n=Reflect.ownKeys(e.keys),i=n.length,a=t.types.length,o=new Map;for(let e=0;e<a;e++)o.set(t.types[e],G(t.types[e],r));let s=Pm(t)??1,c=Fm(t);return(r,l)=>{let u=[],d=0,f=[];if(i>0)if(Jt(r))for(let t=0;t<i;t++){let i=n[t],o=e.keys[i].buckets;if(Object.prototype.hasOwnProperty.call(r,i)){let t=String(r[i]);if(Object.prototype.hasOwnProperty.call(o,t))f=f.concat(o[t]);else{let{candidates:t,literals:n}=e.keys[i],o=Rs.make(n),s=t.length===a?new As([new N(i,o,!1,!0)],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new U(o,r[i])))])}}else{let{candidates:t,literals:n}=e.keys[i],o=new N(i,Rs.make(n),!1,!0),s=t.length===a?new As([o],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new tm(o)))])}}else{let n=e.candidates.length===a?t:Rs.make(e.candidates);u.push([d++,new U(n,r)])}e.otherwise.length>0&&(f=f.concat(e.otherwise));let p;for(let e=0;e<f.length;e++){let t=f[e],n=o.get(t)(r,l);if(dm(n)&&(!p||p.length===0)){if(me(n))return n;u.push([d++,n.left])}else{let e=d++;p||=[],p.push(t=>A(()=>`finalResult`in t?O:M(Cr(n),n=>(me(n)?t.finalResult=n:t.es.push([e,n.left]),O))))}}let m=e=>pt(e)?e.length===1&&e[0][1]._tag===`Type`?x(e[0][1]):x(new H(t,r,Um(e))):x(new U(t,r));if(p&&p.length>0){let e=p;return A(()=>{let t={es:We(u)};return M($r(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>`finalResult`in t?t.finalResult:m(t.es))})}return m(u)}}case`Suspend`:{let e=Ra(()=>G(t.f(),r));return(t,n)=>e()(t,n)}}},Lm=(e,t)=>n=>t(n)?S(n):x(new U(e,n)),Rm=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Zo(e);if(Ae(n))return Rm(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([i.name,a])}return n}case`TupleType`:{let n=[];for(let r=0;r<e.elements.length;r++){let i=e.elements[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return Rm(e.from,t);case`Suspend`:return Rm(e.f(),t);case`Transformation`:return Rm(t?e.from:e.to,t)}return[]},zm=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=Rm(o,t);if(s.length>0){i.push(o);for(let e=0;e<s.length;e++){let[t,r]=s[e],i=String(r.literal);n[t]=n[t]||{buckets:{},literals:[],candidates:[]};let a=n[t].buckets;if(Object.prototype.hasOwnProperty.call(a,i)){if(e<s.length-1)continue;a[i].push(o),n[t].literals.push(r),n[t].candidates.push(o)}else{a[i]=[o],n[t].literals.push(r),n[t].candidates.push(o);break}}}else r.push(o)}return{keys:n,otherwise:r,candidates:i}},Bm=e=>Gs(e)?Bm(e.from):e,Vm=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||dm(e))return e;let i=new Xn,a=Un(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(bi(o))return S(o.value);let e=o.cause;return vi(e)?x(e.error):x(new im(t,n,fi(e)))}return x(new im(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},Hm=([e],[t])=>e>t?1:e<t?-1:0;function Um(e){return e.sort(Hm).map(e=>e[1])}const Wm=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return S;case`TypeLiteralTransformation`:return n=>{let r=S(n);for(let n of e.propertySignatureTransformations){let[e,i]=t?[n.from,n.to]:[n.to,n.from],a=t?n.decode:n.encode;r=pm(r,t=>{let n=a(Object.prototype.hasOwnProperty.call(t,e)?v(t[e]):w());return delete t[e],Ae(n)&&(t[i]=n.value),t})}return r}}},Gm=(e,t=[])=>({value:e,forest:t}),Km={formatIssue:e=>pm(ph(e),qm),formatIssueSync:e=>{let t=Km.formatIssue(e);return dm(t)?qe(t):cn(t)},formatError:e=>Km.formatIssue(e.issue),formatErrorSync:e=>Km.formatIssueSync(e.issue)},qm=e=>e.value+Jm(`
|
|
6
|
+
`,e.forest),Jm=(e,t)=>{let n=``,r=t.length,i;for(let a=0;a<r;a++){i=t[a];let o=a===r-1;n+=e+(o?`└`:`├`)+`─ `+i.value,n+=Jm(e+(r>1&&!o?`│ `:` `),i.forest)}return n},Ym=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},Xm=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},Zm=e=>`ast`in e?v(e.ast):w(),Qm=S(void 0),$m=e=>Zm(e).pipe(f(Bo),y({onNone:()=>Qm,onSome:t=>{let n=t(e);return ut(n)?S({message:n,override:!1}):Fn(n)?T(n,e=>({message:e,override:!1})):ut(n.message)?S({message:n.message,override:n.override}):T(n.message,e=>({message:e,override:n.override}))}})),eh=e=>t=>t._tag===e,th=eh(`Composite`),nh=eh(`Refinement`),rh=eh(`Transformation`),ih=e=>fm($m(e),t=>t===void 0?Qm:!t.override&&(th(e)||nh(e)&&e.kind===`From`||rh(e)&&e.kind!==`Transformation`)?rh(e)||nh(e)?ih(e.issue):Qm:S(t.message)),ah=e=>Zm(e).pipe(f(Jo),en(t=>t(e)),o);function oh(e){return Go(e).pipe(c(()=>Ho(e)),c(()=>Uo(e)),c(()=>Wo(e)),h(()=>`{ ${e.from} | filter }`))}function sh(e){return e.message===void 0?`Expected ${Gs(e.ast)?oh(e.ast):String(e.ast)}, actual ${St(e.actual)}`:e.message}const ch=e=>pm(ih(e),t=>t??ah(e)??sh(e)),lh=e=>ah(e)??String(e.ast),uh=e=>e.message??`is forbidden`,dh=e=>e.message??`is unexpected`,fh=e=>{let t=Vo(e.ast);if(Ae(t)){let e=t.value();return ut(e)?S(e):e}return S(e.message??`is missing`)},ph=e=>{switch(e._tag){case`Type`:return pm(ch(e),Gm);case`Forbidden`:return S(Gm(lh(e),[Gm(uh(e))]));case`Unexpected`:return S(Gm(dh(e)));case`Missing`:return pm(fh(e),Gm);case`Transformation`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Ym(e.kind),[t])])):S(Gm(t)));case`Refinement`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Xm(e.kind),[t])])):S(Gm(t)));case`Pointer`:return pm(ph(e.issue),t=>Gm(Ha(e.path),[t]));case`Composite`:return fm(ih(e),t=>{if(t!==void 0)return S(Gm(t));let n=lh(e);return za(e.issues)?pm($r(e.issues,ph),e=>Gm(n,e)):pm(ph(e.issues),e=>Gm(n,[e]))})}},mh=C(e=>st(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),hh=C(e=>st(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),gh=Symbol.for(`effect/Schema`);function K(e){return class{[gh]=_h;static ast=e;static annotations(e){return K(bh(this.ast,e))}static pipe(){return Le(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[gh]=_h}}const _h={_A:e=>e,_I:e=>e,_R:e=>e},vh={typeConstructor:ho,schemaId:_o,message:vo,missingMessage:yo,identifier:bo,title:xo,description:Co,examples:wo,default:To,documentation:Ao,jsonSchema:Eo,arbitrary:Do,pretty:Oo,equivalence:ko,concurrency:jo,batching:Mo,parseIssueTitle:No,parseOptions:Po,decodingFallback:Fo},yh=e=>{if(!e)return{};let t={...e};for(let n in vh)if(n in e){let r=vh[n];t[r]=e[n],delete t[n]}return t},bh=(e,t)=>tc(e,yh(t)),xh=e=>String(e.ast),Sh=e=>K(pc(e.ast)),Ch=e=>K(P(e.ast)),wh=(e,t)=>{let n=Tm(e,t);return(e,t)=>mm(n(e,t),sm)},Th=(e,t)=>{let n=wm(e,t);return(e,t)=>Ne(n(e,t),sm)},Eh=wh,Dh=e=>$e(e,gh)&&st(e[gh]);function Oh(e){return Bs(e)?Rs.make(zs(e,e=>new os(e))):new os(e[0])}function kh(e,t=Oh(e)){return class extends K(t){static annotations(e){return kh(this.literals,bh(this.ast,e))}static literals=[...e]}}function Ah(...e){return qt(e)?kh(e):zh}const jh=(e,t,n)=>Nh(e,new is(e.map(e=>e.ast),(...e)=>t.decode(...e.map(K)),(...e)=>t.encode(...e.map(K)),yh(n))),Mh=(e,t)=>{let n=()=>(t,n,r)=>e(t)?W(t):cm(new U(r,t));return Nh([],new is([],n,n,yh(t)))};function Nh(e,t){return class extends K(t){static annotations(e){return Nh(this.typeParameters,bh(this.ast,e))}static typeParameters=[...e]}}const Ph=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return jh(e,t,n)}let e=arguments[0],t=arguments[1];return Mh(e,t)},Fh=Symbol.for(`effect/SchemaId/InstanceOf`),Ih=(e,t)=>Ph(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Fh,[Fh]:{constructor:e},...t});var Lh=class extends K(us){},Rh=class extends K(cs){},zh=class extends K(ds){},Bh=class extends K(fs){},Vh=class extends K(bs){},Hh=class extends K(xs){},q=class extends K(ms){},J=class extends K(gs){},Uh=class extends K(vs){};const Wh=e=>Rs.make(e.map(e=>e.ast));function Gh(e,t=Wh(e)){return class extends K(t){static annotations(e){return Gh(this.members,bh(this.ast,e))}static members=[...e]}}function Kh(...e){return Bs(e)?Gh(e):qt(e)?e[0]:zh}const qh=e=>Kh(e,Rh),Jh=e=>Kh(e,Lh),Yh=e=>Kh(e,Rh,Lh),Xh=e=>new Zh(new ws(e.ast,!1),e);var Zh=class e{ast;from;[gh];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ws(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...yh(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}};const Qh=(e,t)=>new Es(e.map(e=>Dh(e)?new ws(e.ast,!1):e.ast),t.map(e=>Dh(e)?new Cs(e.ast):e.ast),!0);function $h(e,t,n=Qh(e,t)){return class extends K(n){static annotations(e){return $h(this.elements,this.rest,bh(this.ast,e))}static elements=[...e];static rest=[...t]}}function eg(...e){return Array.isArray(e[0])?$h(e[0],e.slice(1)):$h(e,[])}function tg(e,t){return class extends $h([],[e],t){static annotations(e){return tg(this.value,bh(this.ast,e))}static value=e}}const ng=e=>tg(e),rg=e=>e?`"?:"`:`":"`;var ig=class extends ws{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=rg(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}},ag=class extends ws{isReadonly;fromKey;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.fromKey=i}},og=class extends ws{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}};const sg=e=>e===void 0?`never`:ut(e)?JSON.stringify(e):String(e);var cg=class{from;to;decode;encode;_tag=`PropertySignatureTransformation`;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}toString(){return`PropertySignature<${rg(this.to.isOptional)}, ${this.to.type}, ${sg(this.from.fromKey)}, ${rg(this.from.isOptional)}, ${this.from.type}>`}};const lg=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new ig(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new cg(e.from,new og(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},ug=Symbol.for(`effect/PropertySignature`),dg=e=>$e(e,ug);var fg=class e{ast;[gh];[ug]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return Le(this,arguments)}annotations(t){return new e(lg(this.ast,yh(t)))}toString(){return String(this.ast)}};const pg=e=>new fg(e);var mg=class e extends fg{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(lg(this.ast,yh(t)),this.from)}};const hg=e=>new mg(new ig(e.ast,!1,!0,{},void 0),e),gg=C(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return pg(new ig(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return pg(new cg(n.from,new og(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),_g=(e,t,n)=>pg(new cg(new ag(e.ast,!0,!0,{},void 0),new og(t.ast,!1,!0,{},void 0),e=>v(n.decode(e)),f(n.encode))),vg=(e,t,n)=>pg(new cg(new ag(e.ast,!0,!0,{},void 0),new og(t.ast,!0,!0,{},void 0),n.decode,n.encode)),yg=(e,t)=>{let n=t?.exact,r=t?.default,i=t?.nullable,a=t?.as==`Option`,o=t?.onNoneEncoding?c(t.onNoneEncoding):b;if(n){if(r)return i?gg(_g(qh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===null?r():e}),encode:v}),r).ast:gg(_g(e,Ch(e),{decode:y({onNone:r,onSome:b}),encode:v}),r).ast;if(a){let t=Mv(Ch(e));return i?_g(qh(e),t,{decode:Ie(bt),encode:o}).ast:_g(e,t,{decode:b,encode:b}).ast}else if(i)return vg(qh(e),Ch(e),{decode:Ie(bt),encode:b}).ast;else return new ig(e.ast,!0,!0,{},void 0)}else if(r)return i?gg(_g(Yh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e??r()}),encode:v}),r).ast:gg(_g(Jh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===void 0?r():e}),encode:v}),r).ast;else if(a){let t=Mv(Ch(e));return i?_g(Yh(e),t,{decode:Ie(e=>e!=null),encode:o}).ast:_g(Jh(e),t,{decode:Ie(Rt),encode:o}).ast}else if(i)return vg(Yh(e),Jh(Ch(e)),{decode:Ie(bt),encode:b}).ast;else return new ig(Jh(e).ast,!0,!0,{},void 0)},bg=e=>new mg(new ig(e.ast===us||e.ast===ds?us:Jh(e).ast,!0,!0,{},void 0),e),xg=C(e=>Dh(e[0]),(e,t)=>new mg(yg(e,t),e)),Sg=sc([yo]),Cg=(e,t)=>{let n=Reflect.ownKeys(e),r=[];if(n.length>0){let i=[],a=[],o=[];for(let t=0;t<n.length;t++){let s=n[t],c=e[s];if(dg(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,n=e.isOptional,o=e.annotations;i.push(new N(s,t,n,!0,Sg(e))),a.push(new N(s,P(t),n,!0,o)),r.push(new N(s,t,n,!0,o));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??s;i.push(new N(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),a.push(new N(s,e.to.type,e.to.isOptional,!0,e.to.annotations)),o.push(new Qs(t,s,e.decode,e.encode));break}}}else i.push(new N(s,c.ast,!1,!0)),a.push(new N(s,P(c.ast),!1,!0)),r.push(new N(s,c.ast,!1,!0))}if(qt(o)){let e=[],n=[];for(let r of t){let{indexSignatures:t,propertySignatures:o}=oc(r.key.ast,r.value.ast);o.forEach(e=>{i.push(e),a.push(new N(e.name,P(e.type),e.isOptional,e.isReadonly,e.annotations))}),t.forEach(t=>{e.push(t),n.push(new ks(t.parameter,P(t.type),t.isReadonly))})}return new qs(new As(i,e,{[So]:`Struct (Encoded side)`}),new As(a,n,{[So]:`Struct (Type side)`}),new $s(o))}}let i=[];for(let e of t){let{indexSignatures:t,propertySignatures:n}=oc(e.key.ast,e.value.ast);n.forEach(e=>r.push(e)),t.forEach(e=>i.push(e))}return new As(r,i)},wg=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&dg(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function Tg(e,t,n=Cg(e,t)){return class extends K(n){static annotations(e){return Tg(this.fields,this.records,bh(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=wg(e,{...t});return Gv(n)?r:km(this)(r)};static pick(...t){return Eg(mh(e,...t))}static omit(...t){return Eg(hh(e,...t))}}}function Eg(e,...t){return Tg(e,t)}const Dg=e=>Ah(e).pipe(hg,gg(()=>e)),Og=(e,t)=>Eg({_tag:Dg(e),...t});function kg(e,t,n){return class extends Tg({},[{key:e,value:t}],n){static annotations(n){return kg(e,t,bh(this.ast,n))}static key=e;static value=t}}const Ag=e=>kg(e.key,e.value);function jg(e,t){return class extends K(t){static annotations(e){return jg(this.from,bh(this.ast,e))}static make=(e,t)=>Gv(t)?e:km(this)(e);static from=e}}const Mg=(e,t)=>n=>{let r=y(zo(n.ast),{onNone:()=>[e],onSome:t=>[...t,e]});return jg(n,tc(n.ast,yh({[go]:r,...t})))},Ng=(e,t,n)=>{if(Ns(e)&&Ns(t)){let r=[...e.propertySignatures];for(let e of t.propertySignatures){let t=e.name,i=r.findIndex(e=>e.name===t);if(i===-1)r.push(e);else{let{isOptional:a,type:o}=r[i];r[i]=new N(t,Ig(o,e.type,n.concat(t)),a,!0)}}return new As(r,e.indexSignatures.concat(t.indexSignatures))}throw Error(Ga(e,t,n))},Pg=cc([bo]),Fg=(e,t)=>t.map(t=>new Ws(t,e.filter,Pg(e))),Ig=(e,t,n)=>Rs.make(Rg([e],[t],n)),Lg=e=>Vs(e)?e.types:[e],Rg=(t,n,r)=>he(t,t=>he(n,n=>{switch(n._tag){case`Literal`:if(ut(n.literal)&&hs(t)||Wt(n.literal)&&_s(t)||e(n.literal)&&ys(t))return[n];break;case`StringKeyword`:if(n===ms){if(hs(t)||ss(t)&&ut(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===ms)return[n];break;case`NumberKeyword`:if(n===gs){if(_s(t)||ss(t)&&Wt(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===gs)return[n];break;case`BooleanKeyword`:if(n===vs){if(ys(t)||ss(t)&&e(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===vs)return[n];break;case`Union`:return Rg(Lg(t),n.types,r);case`Suspend`:return[new Us(()=>Ig(t,n.f(),r))];case`Refinement`:return Fg(n,Rg(Lg(t),Lg(n.from),r));case`TypeLiteral`:switch(t._tag){case`Union`:return Rg(t.types,[n],r);case`Suspend`:return[new Us(()=>Ig(t.f(),n,r))];case`Refinement`:return Fg(t,Rg(Lg(t.from),[n],r));case`TypeLiteral`:return[Ng(t,n,r)];case`Transformation`:{let e=t.transformation,i=Ng(t.from,n,r),a=Ng(t.to,P(n),r);switch(e._tag){case`TypeLiteralTransformation`:return[new qs(i,a,new $s(e.propertySignatureTransformations))];case`ComposeTransformation`:return[new qs(i,a,Zs)];case`FinalTransformation`:return[new qs(i,a,new Ys((t,n,r,i)=>pm(e.decode(t,n,r,i),e=>({...t,...e})),(t,n,r,i)=>pm(e.encode(t,n,r,i),e=>({...t,...e}))))]}}}break;case`Transformation`:if(Js(t)){if(ec(n.transformation)&&ec(t.transformation))return[new qs(Ng(t.from,n.from,r),Ng(t.to,n.to,r),new $s(n.transformation.propertySignatureTransformations.concat(t.transformation.propertySignatureTransformations)))]}else return Rg([n],[t],r);break}throw Error(Ga(t,n,r))})),zg=C(2,(e,t)=>K(Ig(e.ast,t.ast,[]))),Bg=C(e=>Dh(e[1]),(e,t)=>Kg(e,t,hc(e.ast,t.ast))),Vg=e=>K(new Us(()=>e().ast)),Hg=Symbol.for(`effect/SchemaId/Refine`);function Ug(e,t,n){return class extends K(n){static annotations(e){return Ug(this.from,this.filter,bh(this.ast,e))}static[Hg]=e;static from=e;static filter=t;static make=(e,t)=>Gv(t)?e:km(this)(e)}}const Wg=(t,n,r)=>{if(e(t))return t?w():v(new U(n,r));if(ut(t))return v(new U(n,r,t));if(t!==void 0){if(`_tag`in t)return v(t);let e=new U(n,r,t.message);return v(qt(t.path)?new V(t.path,r,e):e)}return w()},Gg=(e,t,n)=>{if(Ba(e))return Wg(e,t,n);if(qt(e)){let r=ie(e,e=>Wg(e,t,n));if(qt(r))return v(r.length===1?r[0]:new H(t,n,r))}return w()};function Y(e,t){return n=>{function r(t,n,r){return Gg(e(t,n,r),r,t)}return Ug(n,r,new Ws(n.ast,r,yh(t)))}}function Kg(e,t,n){return class extends K(n){static annotations(e){return Kg(this.from,this.to,bh(this.ast,e))}static from=e;static to=t}}const X=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>Kg(e,t,new qs(e.ast,t.ast,new Ys(n.decode,n.encode)))),Z=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>X(e,t,{strict:!0,decode:(e,t,r,i)=>W(n.decode(e,i)),encode:(e,t,r,i)=>W(n.encode(e,i))})),qg=Symbol.for(`effect/SchemaId/Trimmed`),Jg=e=>t=>t.pipe(Y(e=>e===e.trim(),{schemaId:qg,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),Yg=fo,Xg=(e,t)=>n=>n.pipe(Y(t=>t.length>=e,{schemaId:Yg,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Zg=po,Qg=(e,t)=>n=>{let r=st(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=st(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Y(e=>e.length===r,{schemaId:Zg,title:`length(${r})`,description:r===1?`a single character`:`a string ${r} character(s) long`,jsonSchema:{minLength:r,maxLength:r},...t})):n.pipe(Y(e=>e.length>=r&&e.length<=i,{schemaId:Zg,title:`length({ min: ${r}, max: ${i})`,description:`a string at least ${r} character(s) and at most ${i} character(s) long`,jsonSchema:{minLength:r,maxLength:i},...t}))},$g=Symbol.for(`effect/SchemaId/Pattern`),e_=(e,t)=>n=>{let r=e.source;return n.pipe(Y(t=>(e.lastIndex=0,e.test(t)),{schemaId:$g,[$g]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},t_=Symbol.for(`effect/SchemaId/Lowercased`),n_=e=>t=>t.pipe(Y(e=>e===e.toLowerCase(),{schemaId:t_,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e}));var r_=class extends q.pipe(n_({identifier:`Lowercased`})){};const i_=Symbol.for(`effect/SchemaId/Uppercased`),a_=e=>t=>t.pipe(Y(e=>e===e.toUpperCase(),{schemaId:i_,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e}));var o_=class extends q.pipe(a_({identifier:`Uppercased`})){};const s_=Symbol.for(`effect/SchemaId/Capitalized`),c_=e=>t=>t.pipe(Y(e=>e[0]?.toUpperCase()===e[0],{schemaId:s_,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e}));var l_=class extends q.pipe(c_({identifier:`Capitalized`})){};const u_=Symbol.for(`effect/SchemaId/Uncapitalized`),d_=e=>t=>t.pipe(Y(e=>e[0]?.toLowerCase()===e[0],{schemaId:u_,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e}));var f_=class extends q.pipe(d_({identifier:`Uncapitalized`})){};q.pipe(Qg(1,{identifier:`Char`}));const p_=e=>Xg(1,{title:`nonEmptyString`,description:`a non empty string`,...e});Z(q.annotations({description:`a string that will be converted to lowercase`}),r_,{strict:!0,decode:e=>e.toLowerCase(),encode:b}).annotations({identifier:`Lowercase`}),Z(q.annotations({description:`a string that will be converted to uppercase`}),o_,{strict:!0,decode:e=>e.toUpperCase(),encode:b}).annotations({identifier:`Uppercase`}),Z(q.annotations({description:`a string that will be converted to a capitalized format`}),l_,{strict:!0,decode:e=>Pa(e),encode:b}).annotations({identifier:`Capitalize`}),Z(q.annotations({description:`a string that will be converted to an uncapitalized format`}),f_,{strict:!0,decode:e=>Fa(e),encode:b}).annotations({identifier:`Uncapitalize`});var m_=class extends q.pipe(Jg({identifier:`Trimmed`})){},h_=class extends m_.pipe(p_({identifier:`NonEmptyTrimmedString`})){};Z(q.annotations({description:`a string that will be trimmed`}),m_,{strict:!0,decode:e=>e.trim(),encode:b}).annotations({identifier:`Trim`});const g_=e=>e instanceof Error?e.message:String(e),__=e=>X(q.annotations({description:`a string to be decoded into JSON`}),Bh,{strict:!0,decode:(t,n,r)=>lm({try:()=>JSON.parse(t,e?.reviver),catch:e=>new U(r,t,g_(e))}),encode:(t,n,r)=>lm({try:()=>JSON.stringify(t,e?.replacer,e?.space),catch:e=>new U(r,t,g_(e))})}).annotations({title:`parseJson`,schemaId:rs}),v_=(e,t)=>Dh(e)?Bg(v_(t),e):__(e);q.pipe(p_({identifier:`NonEmptyString`}));const y_=Symbol.for(`effect/SchemaId/UUID`),b_=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;q.pipe(e_(b_,{schemaId:y_,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:b_.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));const x_=Symbol.for(`effect/SchemaId/ULID`);q.pipe(e_(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:x_,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var S_=class extends Ih(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};X(q.annotations({description:`a string to be decoded into a URL`}),S_,{strict:!0,decode:(e,t,n)=>lm({try:()=>new URL(e),catch:t=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${g_(t)}`)}),encode:e=>W(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});const C_=oo,w_=e=>t=>t.pipe(Y(Number.isFinite,{schemaId:C_,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),T_=eo,E_=(e,t)=>n=>n.pipe(Y(t=>t>e,{schemaId:T_,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),D_=to,O_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:D_,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),k_=io,A_=e=>t=>t.pipe(Y(e=>Number.isSafeInteger(e),{schemaId:k_,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),j_=no,M_=(e,t)=>n=>n.pipe(Y(t=>t<e,{schemaId:j_,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),N_=ro,P_=(e,t)=>n=>n.pipe(Y(t=>t<=e,{schemaId:N_,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),F_=co,I_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:F_,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),L_=ao,R_=e=>t=>t.pipe(Y(e=>!Number.isNaN(e),{schemaId:L_,title:`nonNaN`,description:`a number excluding NaN`,...e})),z_=e=>E_(0,{title:`positive`,...e}),B_=e=>M_(0,{title:`negative`,...e}),V_=e=>P_(0,{title:`nonPositive`,...e}),H_=e=>O_(0,{title:`nonNegative`,...e});function U_(e){return X(e,J,{strict:!1,decode:(e,t,n)=>um(kn(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>W(String(e))})}U_(q.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),J.pipe(w_({identifier:`Finite`}));var W_=class extends J.pipe(A_({identifier:`Int`})){};J.pipe(R_({identifier:`NonNaN`})),J.pipe(z_({identifier:`Positive`})),J.pipe(B_({identifier:`Negative`})),J.pipe(V_({identifier:`NonPositive`}));var G_=class extends J.pipe(H_({identifier:`NonNegative`})){};const K_=so;J.pipe(w_({schemaId:K_,identifier:`JsonNumber`})),Z(Uh.annotations({description:`a boolean that will be negated`}),Uh,{strict:!0,decode:e=>Dn(e),encode:e=>Dn(e)});const q_=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?cm(new U(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):W(n)},J_=e=>W(Symbol.for(e));X(q.annotations({description:`a string to be decoded into a globally shared symbol`}),Hh,{strict:!1,decode:e=>J_(e),encode:(e,t,n)=>q_(e,n)}).annotations({identifier:`Symbol`});const Y_=lo,X_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:Y_,[Y_]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),Z_=uo,Q_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Z_,[Z_]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),$_=e=>X_(0n,{title:`nonNegativeBigInt`,...e});var ev=class extends X(q.annotations({description:`a string to be decoded into a bigint`}),Vh,{strict:!0,decode:(e,t,n)=>um(Uc(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>W(String(e))}).annotations({identifier:`BigInt`}){};const tv=Vh.pipe($_({identifier:`NonNegativeBigintFromSelf`}));X(J.annotations({description:`a number to be decoded into a bigint`}),Vh.pipe(Q_(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>um(Wc(e),()=>new U(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>um(Hc(e),()=>new U(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});const nv=(e,t,n,r)=>hm(e,{onFailure:e=>new H(n,r,e),onSuccess:t});var rv=class extends Ph(Ze,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(de),e.bigInt({min:0n}).map(e=>t(e)),e.maxSafeNat().map(e=>Me(e))),equivalence:()=>re}){};X(tv.annotations({description:`a bigint to be decoded into a Duration`}),rv.pipe(Y(e=>Je(e),{description:`a finite duration`})),{strict:!0,decode:e=>W(t(e)),encode:(e,t,n)=>y(Ft(e),{onNone:()=>cm(new U(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>W(e)})}).annotations({identifier:`DurationFromNanos`});const iv=G_.pipe(A_()).annotations({identifier:`NonNegativeInt`});Z(G_.annotations({description:`a non-negative number to be decoded into a Duration`}),rv,{strict:!0,decode:e=>Me(e),encode:e=>Kt(e)}).annotations({identifier:`DurationFromMillis`});const av=Og(`Millis`,{millis:iv}),ov=Og(`Nanos`,{nanos:ev}),sv=Og(`Infinity`,{}),cv=sv.make({}),lv=Kh(av,ov,sv).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),uv=Kh(eg(Xh(iv).annotations({title:`seconds`}),Xh(iv).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),eg(Ah(-1),Ah(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),dv=e=>typeof e==`object`;Z(Kh(lv,uv),rv,{strict:!0,decode:e=>{if(dv(e))switch(e._tag){case`Millis`:return Me(e.millis);case`Nanos`:return t(e.nanos);case`Infinity`:return de}let[n,r]=e;return n===-1?de:t(BigInt(n)*BigInt(1e9)+BigInt(r))},encode:e=>{switch(e.value._tag){case`Millis`:return av.make({millis:e.value.millis});case`Nanos`:return ov.make({nanos:e.value.nanos});case`Infinity`:return cv}}}).annotations({identifier:`Duration`});var fv=class extends Ph(vt,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>Qe(te)}){};Z(ng(class extends J.pipe(I_(0,255,{identifier:`Uint8`,description:`a 8-bit unsigned integer`})){}).annotations({description:`an array of 8-bit unsigned integers to be decoded into a Uint8Array`}),fv,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});const pv=mo,mv=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(Wa(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Y(e=>e.length>=r,{schemaId:pv,title:`minItems(${r})`,description:`an array of at least ${r} item(s)`,jsonSchema:{minItems:r},[Lo]:!0,...t}))},hv=Symbol.for(`effect/SchemaId/ValidDate`),gv=e=>t=>t.pipe(Y(e=>!Number.isNaN(e.getTime()),{schemaId:hv,[hv]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),_v=$a;var vv=class extends Ph(ft,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:_v,[_v]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>Xt}){};vv.pipe(gv({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends Z(q.annotations({description:`a string to be decoded into a Date`}),vv,{strict:!0,decode:e=>new Date(e),encode:e=>Et(e)}).annotations({identifier:`DateFromString`}){}.pipe(gv({identifier:`Date`})),Z(J.annotations({description:`a number to be decoded into a Date`}),vv,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var yv=class extends Ph(e=>Ip(e)&&zp(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},identifier:`DateTimeUtcFromSelf`,description:`a DateTime.Utc instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.date({noInvalidDate:!0}).map(e=>Hp(e)),equivalence:()=>Vp}){};const bv=(e,t)=>lm({try:()=>Up(e),catch:()=>new U(t,e,`Unable to decode ${St(e)} into a DateTime.Utc`)});X(J.annotations({description:`a number to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Zp(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),X(vv.annotations({description:`a Date to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Xp(e))}).annotations({identifier:`DateTimeUtcFromDate`}),X(q.annotations({description:`a string to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Qp(e))}).annotations({identifier:`DateTimeUtc`});const xv=()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(qp);var Sv=class extends Ph(Lp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:xv}){};Z(J.annotations({description:`a number to be decoded into a TimeZone.Offset`}),Sv,{strict:!0,decode:e=>qp(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});const Cv=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map(Kp);var wv=class extends Ph(Rp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:Cv}){};X(q.annotations({description:`a string to be decoded into a TimeZone.Named`}),wv,{strict:!0,decode:(e,t,n)=>lm({try:()=>Kp(e),catch:()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>W(e.id)}).annotations({identifier:`TimeZoneNamed`});var Tv=class extends Kh(Sv,wv){};X(q.annotations({description:`a string to be decoded into a TimeZone`}),Tv,{strict:!0,decode:(e,t,n)=>y(Jp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:W}),encode:e=>W(Yp(e))}).annotations({identifier:`TimeZone`});const Ev=e=>e.oneof(xv()(e),Cv()(e));var Dv=class extends Ph(e=>Ip(e)&&Bp(e),{typeConstructor:{_tag:`effect/DateTime.Zoned`},identifier:`DateTimeZonedFromSelf`,description:`a DateTime.Zoned instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.tuple(e.integer({min:-31536e9,max:31536e9}),Ev(e)).map(([e,t])=>Wp(e,{timeZone:t})),equivalence:()=>Vp}){};X(q.annotations({description:`a string to be decoded into a DateTime.Zoned`}),Dv,{strict:!0,decode:(e,t,n)=>y(Gp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:W}),encode:e=>W($p(e))}).annotations({identifier:`DateTimeZoned`});const Ov=e=>e._tag===`None`?w():v(e.value),kv=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(Ov),Av=e=>y({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),jv=e=>(t,n,r)=>Te(t)?Se(t)?W(w()):nv(e(t.value,n),v,r,t):cm(new U(r,t)),Mv=e=>Ph([e],{decode:e=>jv(Tm(e)),encode:e=>jv(Dm(e))},{typeConstructor:{_tag:`effect/Option`},pretty:Av,arbitrary:kv,equivalence:ee});Z(q,(e=>Mv(e).annotations({description:`Option<${xh(e)}>`}))(h_),{strict:!0,decode:e=>Ie(v(e.trim()),Ia),encode:e=>h(e,()=>``)});const Nv=()=>e=>`BigDecimal(${Lc(kc(e))})`,Pv=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>wc(e,t));var Fv=class extends Ph(Cc,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:Nv,arbitrary:Pv,equivalence:()=>Mc}){};X(q.annotations({description:`a string to be decoded into a BigDecimal`}),Fv,{strict:!0,decode:(e,t,n)=>Ic(e).pipe(y({onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>W(kc(e))})),encode:e=>W(Lc(kc(e)))}).annotations({identifier:`BigDecimal`}),Z(J.annotations({description:`a number to be decoded into a BigDecimal`}),Fv,{strict:!0,decode:e=>Pc(e),encode:e=>zc(e)}).annotations({identifier:`BigDecimalFromNumber`});const Iv=e=>Dh(e)||dg(e),Lv=e=>Reflect.ownKeys(e).every(t=>Iv(e[t])),Rv=e=>`fields`in e?e.fields:Rv(e[Hg]),zv=e=>Lv(e)?Eg(e):Dh(e)?e:Eg(Rv(e)),Bv=e=>Lv(e)?e:Rv(e),Vv=e=>gg(hg(Ah(e)),()=>e),Hv=e=>(t,n,r)=>{let i=Bv(n),a=zv(n),o={_tag:Vv(t)},s=Wv(o,i);return class extends Jv({kind:`TaggedClass`,identifier:e??t,schema:zg(a,Eg(o)),fields:s,Base:Fi,annotations:r}){static _tag=t}},Uv=e=>(t,n,r)=>{class a extends Ii{}a.prototype.name=t;let o=Bv(n),s=zv(n),c={_tag:Vv(t)},l=Wv(c,o),u=`message`in l;class d extends Jv({kind:`TaggedError`,identifier:e??t,schema:zg(s,Eg(c)),fields:l,Base:a,annotations:r,disableToString:!0}){static _tag=t}return u||Object.defineProperty(d.prototype,"message",{get(){return`{ ${Reflect.ownKeys(o).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} }`},enumerable:!1,configurable:!0}),d},Wv=(e,t)=>{let n={...e};for(let r of Reflect.ownKeys(t)){if(r in e)throw Error(Qa(r));n[r]=t[r]}return n};function Gv(t){return e(t)?t:t?.disableValidation??!1}const Kv=tt(`effect/Schema/astCache`,()=>new WeakMap),qv=e=>e===void 0?[]:Array.isArray(e)?e:[e],Jv=({Base:e,annotations:t,disableToString:n,fields:r,identifier:a,kind:o,schema:s})=>{let c=Symbol.for(`effect/Schema/${o}/${a}`),[l,u,d]=qv(t),f=Ch(s),p=f.annotations({identifier:a,...l}),m=f.annotations({[So]:`${a} (Type side)`,...l}),h=s.annotations({[So]:`${a} (Constructor)`,...l}),g=s.annotations({[So]:`${a} (Encoded side)`,...d}),_=s.annotations({...d,...l,...u}),ee=e=>$e(e,c)&&Am(m)(e),te=class extends e{constructor(e={},t=!1){e={...e},o!==`Class`&&delete e._tag,e=wg(r,e),Gv(t)||(e=km(h)(e)),super(e,!0)}static[gh]=_h;static get ast(){let e=Kv.get(this);if(e)return e;let t=Ph([s],{decode:()=>(e,t,n)=>e instanceof this||ee(e)?W(e):cm(new U(n,e)),encode:()=>(e,t)=>e instanceof this?W(e):pm(Dm(m)(e,t),e=>new this(e,!0))},{identifier:a,pretty:e=>t=>`${a}(${e(t)})`,arbitrary:e=>t=>e(t).map(e=>new this(e)),equivalence:b,[Io]:p.ast,...l});return e=Z(g,t,{strict:!0,decode:e=>new this(e,!0),encode:b}).annotations({[Io]:_.ast,...u}).ast,Kv.set(this,e),e}static pipe(){return Le(this,arguments)}static annotations(e){return K(this.ast).annotations(e)}static toString(){return`(${String(g)} <-> ${a})`}static make(...e){return new this(...e)}static fields={...r};static identifier=a;static extend(e){return(t,n)=>{let i=Bv(t),a=zv(t),c=Wv(r,i);return Jv({kind:o,identifier:e,schema:zg(s,a),fields:c,Base:this,annotations:n})}}static transformOrFail(e){return(t,n,i)=>{let a=Wv(r,t);return Jv({kind:o,identifier:e,schema:X(s,Ch(Eg(a)),n),fields:a,Base:this,annotations:i})}}static transformOrFailFrom(e){return(t,n,i)=>{let a=Wv(r,t);return Jv({kind:o,identifier:e,schema:X(Sh(s),Eg(a),n),fields:a,Base:this,annotations:i})}}get[c](){return c}};return n!==!0&&Object.defineProperty(te.prototype,"toString",{value(){return`${a}({ ${Reflect.ownKeys(r).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} })`},configurable:!0,writable:!0}),te},Yv=Kh(Eg({_tag:Ah(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),Eg({_tag:Ah(`Runtime`),id:W_,startTimeMillis:W_}).annotations({identifier:`FiberIdRuntimeEncoded`}),Eg({_tag:Ah(`Composite`),left:Vg(()=>Yv),right:Vg(()=>Yv)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),Xv=e=>e.letrec(t=>({None:e.record({_tag:e.constant(`None`)}),Runtime:e.record({_tag:e.constant(`Runtime`),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant(`Composite`),left:t(`FiberId`),right:t(`FiberId`)}),FiberId:e.oneof(t(`None`),t(`Runtime`),t(`Composite`))})).FiberId.map($v),Zv=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${Zv(e.right)}, ${Zv(e.left)})`}};var Qv=class extends Ph(Oe,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>Zv,arbitrary:()=>Xv}){};const $v=e=>{switch(e._tag){case`None`:return ne;case`Runtime`:return ce(e.id,e.startTimeMillis);case`Composite`:return Ce($v(e.left),$v(e.right))}},ey=e=>{switch(e._tag){case`None`:return{_tag:`None`};case`Runtime`:return{_tag:`Runtime`,id:e.id,startTimeMillis:e.startTimeMillis};case`Composite`:return{_tag:`Composite`,left:ey(e.left),right:ey(e.right)}}};Z(Yv,Qv,{strict:!0,decode:e=>$v(e),encode:e=>ey(e)}).annotations({identifier:`FiberId`});var ty=class extends Z(Bh,Bh,{strict:!0,decode:e=>{if(st(e)&&`message`in e&&typeof e.message==`string`){let t=Error(e.message,{cause:e});return`name`in e&&typeof e.name==`string`&&(t.name=e.name),t.stack=`stack`in e&&typeof e.stack==`string`?e.stack:``,t}return Ht(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Ht(e)}).annotations({identifier:`Defect`}){};Z(Bh,Uh,{strict:!0,decode:e=>Nt(e),encode:b}).annotations({identifier:`BooleanFromUnknown`}),Z(Ah(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Uh,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});const ny=Og(`symbol`,{key:q}).annotations({description:`an object to be decoded into a globally shared symbol`}),ry=X(ny,Hh,{strict:!0,decode:e=>J_(e.key),encode:(e,t,n)=>pm(q_(e,n),e=>ny.make({key:e}))});var iy=class extends Kh(q,J,ry).annotations({identifier:`PropertyKey`}){};Eg({_tag:hg(Ah(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:hg(ng(iy)).annotations({description:`The path to the property where the issue occurred`}),message:hg(q).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});const ay=wf,oy=Df,sy=Of,cy=kf,ly=Nf,uy=Qf,dy=$f,fy=sp,py=lp,my=pp,hy=mp,gy=_p,_y=vp,vy=xp,yy=wp,by=Ep,xy=Dp,Sy=Op,Cy=Symbol.for(`@effect/platform/Error`),wy=Ah(`Clipboard`,`Command`,`FileSystem`,`KeyValueStore`,`Path`,`Stream`,`Terminal`);var Ty=class extends Uv(`@effect/platform/Error/BadArgument`)(`BadArgument`,{module:wy,method:q,description:bg(q),cause:bg(ty)}){[Cy]=Cy;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}};const Ey=Ah(`AlreadyExists`,`BadResource`,`Busy`,`InvalidData`,`NotFound`,`PermissionDenied`,`TimedOut`,`UnexpectedEof`,`Unknown`,`WouldBlock`,`WriteZero`);var Dy=class extends Uv(`@effect/platform/Error/SystemError`)(`SystemError`,{reason:Ey,module:wy,method:q,description:bg(q),syscall:bg(q),pathOrDescriptor:bg(Kh(q,J)),cause:bg(ty)}){[Cy]=Cy;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}};const Oy=yt(`@effect/platform/FileSystem`),ky=e=>typeof e==`bigint`?e:BigInt(e),Ay=BigInt(1024);Ay*Ay*Ay*Ay*Ay;const jy=e=>Oy.of({...e,exists:t=>g(e.access(t),Kr(!0),vr(`SystemError`,e=>e.reason===`NotFound`?k(!1):Zr(e))),readFileString:(t,n)=>Vr(e.readFile(t),{try:e=>new TextDecoder(n).decode(e),catch:e=>new Ty({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})}),stream:(t,n)=>g(e.open(t,{flag:`r`}),n?.offset?Pr(e=>e.seek(n.offset,`start`)):b,T(e=>My(e,n)),xy),sink:(t,n)=>g(e.open(t,{flag:`w`,...n}),T(e=>sy(t=>e.writeAll(t))),ly),writeFileString:(t,n,r)=>M(Tr({try:()=>new TextEncoder().encode(n),catch:e=>new Ty({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),My=(e,{bufferSize:t=16,bytesToRead:n,chunkSize:r=ky(64*1024)}={})=>{let i=n===void 0?void 0:ky(n),a=ky(r);function o(t){if(i!==void 0&&i<=t)return Pp;let n=i!==void 0&&i-t<a?i-t:a;return jp(e.readAlloc(n),y({onNone:()=>Pp,onSome:e=>jp(Fp(Dt(e)),n=>o(t+BigInt(e.length)))}))}return dy(fy(o(BigInt(0))),{capacity:t})},Ny=ky,Py=Oy,Fy=jy,Iy=Symbol.for(`@effect/platform/FileSystem/File`),Ly=Kc(),Ry=Pi(`Create`),zy=Pi(`Update`),By=Pi(`Remove`);var Vy=class extends Lt(`@effect/platform/FileSystem/WatchBackend`)(){};const Hy=Symbol.for(`@effect/platform/Path`),Uy=yt(`@effect/platform/Path`);function Wy(e,t){let n=``,r=0,i=-1,a=0,o;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(i!==s-1&&a!==1)if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function Gy(e,t){let n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}function Ky(e){if(e.protocol!==`file:`)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`Invalid file URL host`}));let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return k(decodeURIComponent(t))}const qy=function(){let e=``,t=!1,n;for(let r=arguments.length-1;r>=-1&&!t;r--){let i;if(r>=0)i=arguments[r];else{let e=globalThis.process;n===void 0&&`process`in globalThis&&typeof e==`object`&&e&&typeof e.cwd==`function`&&(n=e.cwd()),i=n}i.length!==0&&(e=i+`/`+e,t=i.charCodeAt(0)===47)}return e=Wy(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function Jy(e){let t=new URL(`file://`),n=qy(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=eb(n),k(t)}const Yy=/%/g,Xy=/\\/g,Zy=/\n/g,Qy=/\r/g,$y=/\t/g;function eb(e){return e.includes(`%`)&&(e=e.replace(Yy,`%25`)),e.includes(`\\`)&&(e=e.replace(Xy,`%5C`)),e.includes(`
|
|
7
|
+
`)&&(e=e.replace(Zy,`%0A`)),e.includes(`\r`)&&(e=e.replace(Qy,`%0D`)),e.includes(` `)&&(e=e.replace($y,`%09`)),e}const tb=Uy.of({[Hy]:Hy,resolve:qy,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Wy(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&n&&(e+=`/`),t?`/`+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return`.`;let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];n.length>0&&(e===void 0?e=n:e+=`/`+n)}return e===void 0?`.`:tb.normalize(e)},relative(e,t){if(e===t||(e=tb.resolve(e),t=tb.resolve(t),e===t))return``;let n=1;for(;n<e.length&&e.charCodeAt(n)===47;++n);let r=e.length,i=r-n,a=1;for(;a<t.length&&t.charCodeAt(a)===47;++a);let o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(n+l)===47?c=l:l===0&&(c=0));break}let r=e.charCodeAt(n+l);if(r!==t.charCodeAt(a+l))break;r===47&&(c=l)}let u=``;for(l=n+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},dirname(e){if(e.length===0)return`.`;let t=e.charCodeAt(0),n=t===47,r=-1,i=!0;for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:`.`:n&&r===1?`//`:e.slice(0,r)},basename(e,t){let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)}},extname(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return Gy(`/`,e)},parse(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t},sep:`/`,fromFileUrl:Ky,toFileUrl:Jy,toNamespacedPath:b}),nb=Xc(Uy,tb),rb=Uy,ib=nb,ab={arrays:`merge`,sets:`merge`,maps:`merge`};function ob(e,t,n){return sb(e,t,new Set,n??ab)}function sb(e,t,n,r){let i={},a=new Set([...fb(e),...fb(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(db(a)&&db(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=cb(a,s,n,r);continue}i[o]=s}return i}function cb(e,t,n,r){if(lb(e)&&lb(t))return sb(e,t,n,r);if(ub(e)&&ub(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 lb(e){return Object.getPrototypeOf(e)===Object.prototype}function ub(e){return typeof e[Symbol.iterator]==`function`}function db(e){return typeof e==`object`&&!!e}function fb(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 pb(e){return e%4==0&&e%100!=0||e%400==0}var mb=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 hb(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function gb(e){return typeof e==`object`&&!!e}function _b(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 vb(e,t){let{keys:n,type:r,value:i}=t,a=_b(e,n);if(a===void 0)return Object.assign(e,hb(n,i));if(Array.isArray(a))return bb(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(gb(a))return bb(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function yb(e,t){let{type:n,keys:r,value:i}=t,a=_b(e,r);if(a===void 0)return Object.assign(e,hb(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):bb(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(gb(a))return bb(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function bb(e,t){switch(t.type){case`Block`:return ob(e,t.value);case`Table`:return vb(e,t);case`TableArray`:return yb(e,t)}}function xb(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function Sb(e,t){let n=Ob(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 Cb(e,t){let n=Ob(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 wb(e,t,n){let r=Ob(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(hb(o.body,s.body))}}function Tb(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=ob(r,e));return Q(r)}}function Eb(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 Db(e,t,n){let r=Ob(e),i=Ob(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 Ob(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const kb=/[A-Za-z0-9_-]+/y;function Ab(e){e.skipWhitespaces();let t=e.match(kb)?.[0];return t?(e.next(t.length),Q(t)):$()}function jb(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 Mb(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=jb(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 Nb(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 Pb(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}else if(e.startsWith(`\\\r
|
|
17
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=jb(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 Fb(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 Ib=/(?:true|false)\b/y;function Lb(e){e.skipWhitespaces();let t=e.match(Ib);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const Rb=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),zb=/[+-]?inf\b/y;function Bb(e){e.skipWhitespaces();let t=e.match(zb);if(!t)return $();let n=t[0];return e.next(n.length),Q(Rb.get(n))}const Vb=/[+-]?nan\b/y;function Hb(e){e.skipWhitespaces();let t=e.match(Vb);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const Ub=Cb(xb([Ab,Mb,Nb]),`.`),Wb=/0b[01]+(?:_[01]+)*\b/y;function Gb(e){e.skipWhitespaces();let t=e.match(Wb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const Kb=/0o[0-7]+(?:_[0-7]+)*\b/y;function qb(e){e.skipWhitespaces();let t=e.match(Kb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const Jb=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Yb(e){e.skipWhitespaces();let t=e.match(Jb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Xb=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Zb(e){e.skipWhitespaces();let t=e.match(Xb)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const Qb=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function $b(e){e.skipWhitespaces();let t=e.match(Qb)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const ex=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function tx(e){e.skipWhitespaces();let t=e.match(ex);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&&!pb(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 nx=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function rx(e){e.skipWhitespaces();let t=e.match(nx)?.[0];return t?(e.next(t.length),Q(t)):$()}function ix(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=ox(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 ax(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=Db(`{`,Sb(sx,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=ob(n,e);return Q(n)}const ox=xb([Pb,Fb,Mb,Nb,Lb,Bb,Hb,tx,rx,Gb,qb,Yb,$b,Zb,ix,ax]),sx=wb(Ub,`=`,ox);function cx(e){e.nextUntilChar();let t=Tb(Eb(sx))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const lx=Db(`[`,Ub,`]`);function ux(e){e.nextUntilChar();let t=lx(e);if(!t.ok)return $();e.nextUntilChar();let n=cx(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const dx=Db(`[[`,Ub,`]]`);function fx(e){e.nextUntilChar();let t=dx(e);if(!t.ok)return $();e.nextUntilChar();let n=cx(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function px(e){let t=Eb(xb([cx,fx,ux]))(e);return t.ok?Q(t.body.reduce(bb,{__proto__:null})):Q({__proto__:null})}function mx(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 hx(e){return t=>{let n=new mb(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(mx(n,r))}catch(e){throw e instanceof Error?SyntaxError(mx(n,e.message)):SyntaxError(mx(n,`Invalid error type caught`))}}}function gx(e){return hx(px)(e)}const _x={ctx_execute:!0,ctx_batch_execute:!0};function vx(e,t){return _x[e]?e!==`ctx_execute`||t.language===`shell`:!1}function yx(e,t){if(vx(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 bx=/#[0-9a-fA-F]{4}$/u,xx=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,Sx=/^\*\*\* Move to:\s*(.+)$/,Cx={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function wx(e){let t=e.trim(),n=bx.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 Tx(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=wx(t.slice(1,n));return r.length>0?r:void 0}function Ex(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
|
|
22
|
+
`)){let n=Tx(e);if(n!==void 0){t.push(n),r=!0;continue}let i=xx.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=Sx.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=wx(o.slice(3));e.length>0&&t.push(e)}}return t}function Dx(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function Ox(e,t){if(Cx[e]!==!0)return[];let n=t.input,r=typeof n==`string`?Ex(n):[];if(r.length>0)return Array.from(new Set(r));let i=Dx(t,`file_path`)??Dx(t,`path`);return i===void 0?[]:[i]}const kx=new Map;function Ax(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=kx.get(n);if(r!==void 0)return r===!0||r.test(e);let i=jx(n);return kx.size>=256&&kx.clear(),kx.set(n,i),i===!0||i.test(e)}function jx(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const Mx=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,Nx=/\$\(|`|\$\{?\w/,Px=/\$\(([^()]*)\)|`([^`]*)`/g,Fx=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,Ix=/&&|\|\||[;|]/,Lx=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Rx(e,t,n,r){let i=Mx.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`?zx(o,n.command):Ux(o,n.file_path,r)}function zx(e,t){if(typeof t!=`string`)return!0;let n=Bx(t);return n.length===0||n.some(t=>Hx(e,t))?!0:Vx(e)&&Nx.test(t)}function Bx(e){let t=[...e.matchAll(Px)].map(e=>e[1]??e[2]??``);return[e.replace(Px,` `),...t].flatMap(e=>e.split(Ix)).map(e=>e.trim().replace(Fx,``)).filter(e=>e.length>0)}function Vx(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function Hx(e,t){return RegExp(`^${e.split(`*`).map(Lx).join(`.*`)}$`).test(t)}function Ux(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:Wx(r);return RegExp(`^${Gx(i)}$`).test(a)}const Wx=e=>e.slice(e.lastIndexOf(`/`)+1);function Gx(e){let t=Kx(e);return e.endsWith(`/**`)?`(?:${Kx(e.slice(0,-3))}|${t})`:t}function Kx(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:Lx(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 qx(e){return{session_id:e(),agent_id:null}}const Jx=Ag({key:q,value:ng(q)}).pipe(Mg(`TomlConfig`));X(q,Ch(Jx),{strict:!0,decode:e=>lm({try:()=>gx(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Jx)(e))),encode:(e,t,n)=>cm(new im(n,e,`TomlConfigFromText is decode-only`))});const Yx=`systemfsoftware.toml`,Xx=Om(Jx)({});var Zx=class extends Lt(`@systemfsoftware/omp-utils/toml-loader.adapter/TomlLoader`)(){};const Qx=e=>{let t={};for(let n of e)for(let[e,r]of Object.entries(n))t[e]=r;return t},$x=e=>lm({try:()=>gx(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Jx)(e))),eS=(e,t,n)=>e.exists(n).pipe(M(t=>t?e.readFileString(n).pipe(M($x),Hr(()=>Xx)):k(Xx))),tS=qc(Zx,M(mr(()=>{let e=process.env.OMP_USER_CONFIG_HOME;return typeof e==`string`&&e.length>0?e:Mi.homedir()}),e=>Rn(function*(){let t=yield*zn(qn()),n=yield*Py,r=yield*rb,i=r.join(e,`.config/systemfsoftware`,Yx);return Zx.of({load:mn(`TomlLoader.load`)(function*(e){let a=hn(yield*bn(t),e);if(Ae(a))return a.value;let o=r.join(e,Yx),s=r.join(e,`systemfsoftware.local.toml`),c=yield*eS(n,r,i),l=yield*eS(n,r,o),u=yield*eS(n,r,s),d=yield*Eh(Jx)(Qx([c,l,u])).pipe(wn);return yield*Nn(t,t=>(ei(t,e,d),t)),d})})}))),nS={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},rS={Edit:!0,MultiEdit:!0,Update:!0},iS=Am(ng(Eg({old_text:bg(Bh),new_text:bg(Bh)}).pipe(Y(e=>`old_text`in e||`new_text`in e))).pipe(mv(1))),aS=(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 oS(e,t){let n=t;if(nS[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(rS[e]===!0&&`edits`in n&&iS(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(rS[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=aS(n.input,`+`),t=aS(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const sS=Am(ng(Eg({old_string:bg(Bh),new_string:bg(Bh)}).pipe(Y(e=>`old_string`in e||`new_string`in e)))),cS=Cm(Ag({key:q,value:Bh}));function lS(e,t){let n=De(cS(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`&&sS(a)&&iS(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 uS={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function dS(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=uS[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{bg as $,gy as A,Uh as B,Dy as C,py as D,fy as E,xy as F,q as G,zh as H,ay as I,Uv as J,Eg as K,oy as L,vy as M,yy as N,my as O,by as P,Th as Q,cy as R,Ty as S,Sy as T,J as U,Ah as V,Ag as W,Bh as X,Kh as Y,wh as Z,Vy as _,Jc as _t,yx as a,Sm as at,zy as b,Kc as bt,oS as c,W as ct,rb as d,jp as dt,xg as et,ib as f,Mp as ft,Ny as g,qc as gt,Iy as h,Fp as ht,Ox as i,Cm as it,_y as j,hy as k,dS as l,kp as lt,Py as m,Pp as mt,tS as n,X as nt,Ax as o,jm as ot,Ly as p,Np as pt,Hv as q,lS as r,im as rt,Rx as s,cm as st,Zx as t,v_ as tt,qx as u,Ap as ut,Ry as v,Zc as vt,uy as w,Fy as x,By as y,Yc as yt,ng as z};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{$s as e,Ai as t,Ds as n,Ec as r,El as i,Fs as a,Hs as o,Js as s,Ks as c,Ls as l,Oo as u,Po as d,Ps as f,Rs as p,Tc as ee,Tl as m,Ts as te,Ys as h,bo as ne,ia as re,jo as ie,ko as ae,oa as g,qs as _,tc as v,wl as y,ws as oe,xi as se,yi as ce,zs as b}from"./core-C1FEy4nD.js";import{$ as le,B as ue,C as x,Dn as de,E as fe,I as S,Mn as pe,O as C,P as me,R as he,T as ge,_t as _e,a as ve,dt as ye,f as be,fn as xe,ft as Se,j as Ce,jn as we,k as Te,o as Ee,ot as De,q as Oe,rt as ke,ut as Ae,x as je}from"./Effect-fMAnbW-8.js";import{f as Me,m as Ne}from"./Cause-BpHZgZuR.js";import{$ as w,A as Pe,B as T,D as Fe,F as Ie,G as E,H as Le,J as Re,K as D,L as ze,M as Be,O as Ve,Q as O,T as He,U as Ue,V as We,W as k,X as A,Y as j,Z as Ge,a as Ke,at as qe,bt as Je,c as Ye,ct as Xe,et as M,i as Ze,it as N,j as Qe,k as $e,l as et,m as tt,nt,o as rt,ot as it,q as P,r as at,rt as ot,s as st,st as ct,tt as lt,u as F,z as I}from"./dist-opjiVExE.js";import{homedir as L}from"node:os";const ut={[Symbol.for(`@effect/matcher/Matcher`)]:{_input:m,_filters:m,_remaining:m,_result:m,_provided:m,_return:m},_tag:`ValueMatcher`,add(e){return this.value._tag===`Right`?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?dt(this.provided,v(e.evaluate(this.provided))):this},pipe(){return ee(this,arguments)}};function dt(e,t){let n=Object.create(ut);return n.provided=e,n.value=t,n}const ft=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),pt=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(pt),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}}else if(typeof e==`object`&&e){let t=Object.entries(e).map(([e,t])=>[e,pt(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},mt=e=>dt(e,h(e)),ht=(e,t)=>n=>n.add(ft(pt(e),t)),gt=(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(ft(i,n))})(`_tag`),_t=e=>t=>{let n=vt(t);return c(n)?n._tag===`Right`?n.right:e(n.left):t=>{let r=n(t);return r._tag===`Right`?r.right:e(r.left)}},vt=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return e=>t._tag===`When`&&t.guard(e)===!0||t._tag===`Not`&&t.guard(e)===!1?v(t.evaluate(e)):h(e)}return n=>{for(let r=0;r<t;r++){let t=e.cases[r];if(t._tag===`When`&&t.guard(n)===!0||t._tag===`Not`&&t.guard(n)===!1)return v(t.evaluate(n))}return h(n)}},yt=`effect/Match/exhaustive: absurd`,bt=e=>{let t=vt(e);if(c(t)){if(t._tag===`Right`)return t.right;throw Error(yt)}return e=>{let n=t(e);if(n._tag===`Right`)return n.right;throw Error(yt)}},R=mt,z=ht,B=gt,xt=_t,V=bt,St=`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(`.`),Ct=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],wt={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.`},Tt=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],Et={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."},Dt={SessionStart:{startup:{_tag:`Reachable`},compact:{_tag:`Reachable`},fork:{_tag:`Reachable`},resume:{_tag:`Partial`,reason:'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:{_tag:`Unreachable`,reason:`OMP emits no signal when a session is cleared.`}}},Ot=j(D({type:We(`command`),command:E,args:w(I(E)),async:w(T),asyncRewake:w(T),shell:w(We(`bash`,`powershell`)),timeout:w(Ue),if:w(E),statusMessage:w(E),once:w(T)}),D({type:We(`http`,`mcp_tool`,`prompt`,`agent`)})),H=D({matcher:w(E),hooks:I(Ot)}),kt=D({PreToolUse:M(I(H),{exact:!0,default:()=>[]}),PostToolUse:M(I(H),{exact:!0,default:()=>[]}),PostToolUseFailure:M(I(H),{exact:!0,default:()=>[]}),UserPromptSubmit:M(I(H),{exact:!0,default:()=>[]}),Stop:M(I(H),{exact:!0,default:()=>[]}),SessionStart:M(I(H),{exact:!0,default:()=>[]}),SessionEnd:M(I(H),{exact:!0,default:()=>[]}),PreCompact:M(I(H),{exact:!0,default:()=>[]}),PostCompact:M(I(H),{exact:!0,default:()=>[]})}),At=D({hooks:kt,disableAllHooks:w(T)}),U=D({event:E,reason:E}),jt=D({unrecognized:I(U),notCarried:I(U),matcherNotEvaluable:I(U),matcherOutOfReach:I(U),shadowed:I(U),disabled:I(U)}),Mt=O(j(At,nt(D({...kt.fields,disableAllHooks:w(T),hooks:w(Le)}),At,{strict:!0,decode:({disableAllHooks:e,...t})=>Xe(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e}),encode:(e,t,n)=>ct(new ot(n,e,`Decode-only`))}))),Nt=Ct,Pt=N(k({key:E,value:A})),Ft=[],It=N(I(D({matcher:w(E),hooks:M(I(D({type:w(E)})),{exact:!0,default:()=>[]})})));function Lt(e){return l(Pt(e),e=>p(Pt(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const W=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Rt={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},zt=St,Bt=wt,Vt=Et,Ht=Tt,Ut=Dt,Wt=e=>n(It(e),()=>Ft).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),Gt=e=>Wt(e).length>0,Kt=e=>R(e).pipe(B(`Reachable`,()=>b()),B(`Partial`,e=>o(e.reason)),B(`Unreachable`,e=>o(e.reason)),V);function qt(e){return p(Lt(e),{onNone:()=>Rt,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=Bt[n];if(s!==void 0){i.push({event:W(n),reason:s});continue}if(!zt.includes(n)){r.push({event:W(n),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let c=Vt[n];c!==void 0&&Gt(t[n])&&a.push({event:W(n),reason:c});let l=Ut[n];l!==void 0&&o.push(...Wt(t[n]).flatMap(e=>{let t=l[e];return t===void 0?[]:p(Kt(t),{onNone:()=>[],onSome:t=>[{event:`${W(n)} (matcher "${W(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(n))zt.includes(e)&&s.push({event:W(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 Jt(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${W(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>Nt.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function Yt(e){return p(Lt(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let r of Nt){let i=n(It(e[r]),()=>Ft);for(let e of i)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(W(n.type))}return Array.from(t)}})}function Xt(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 Nt)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}function Zt(e){return R(e).pipe(B(`Merge`,({sources:e})=>Xt(e)),B(`Coverage`,({json:e})=>qt(e)),B(`DisabledCoverage`,({sources:e})=>Jt(e)),B(`UnsupportedHookTypes`,({json:e})=>Yt(e)),B(`MatcherUnreadable`,({event:e})=>Vt[e]!==void 0),B(`IfEvaluatingEvent`,({event:e})=>Ht.includes(e)),V)}function G(e,t){return qe(t)(Zt(e))}const Qt=`/etc/claude-code/managed-settings.json`,K=(e,t)=>[`${e}/.claude/settings.json`,`${t}/.claude/settings.json`,`${t}/.claude/settings.local.json`,Qt];var $t=class extends g(`CollectSettingsGapsExecutorDeps`)(){};const q=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),en=x(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*tt,n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=[];for(let u of e){let e=yield*t.readFileString(u).pipe(Oe(()=>``));if(e===``)continue;let d=O(lt(k({key:E,value:A})))(e);if(_(d)){l.push(u);continue}let f=G({_tag:`Coverage`,json:d.right},jt);n.push(...f.unrecognized),r.push(...f.notCarried),i.push(...f.matcherNotEvaluable),a.push(...f.matcherOutOfReach),o.push(...f.shadowed),c.push(...G({_tag:`UnsupportedHookTypes`,json:d.right},I(E)));let p=Mt(d.right);_(p)?l.push(u):s.push({settings:p.right,managed:u===Qt,label:u})}return{coverage:{unrecognized:q(n),notCarried:q(r),matcherNotEvaluable:q(i),matcherOutOfReach:q(a),shadowed:q(o),disabled:q(G({_tag:`DisabledCoverage`,sources:s},I(U)))},unsupportedHookTypes:Array.from(new Set(c)),malformedFiles:Array.from(new Set(l))}});var tn=class extends g(`LoadSettingsExecutorDeps`)(){};const nn=x(`loadSettingsFile`)(function*(e){let t=yield*(yield*tt).readFileString(e).pipe(Oe(()=>``));if(t===``)return null;let n=O(lt(k({key:E,value:A})))(t);if(_(n))return null;let r=n.right,i=Mt(r);return _(i)?null:i.right}),J=x(`loadSettingsWithPaths`)(function*(e,t=Qt){let n=[];for(let r of e){let e=yield*nn(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:G({_tag:`Merge`,sources:n},At)}),rn=Symbol.for(`@effect/platform/CommandExecutor`),an=Symbol.for(`@effect/platform/Process`),on=Je(),sn=Je(),cn=re(`@effect/platform/CommandExecutor`),ln=e=>{let t=t=>Ie(S(e(t),e=>e.stdout)),n=(e,n)=>{let r=new TextDecoder(n);return Be(Ve(t(e),u(e=>r.decode(e))))};return{[rn]:rn,start:e,exitCode:t=>ke(je(e(t),e=>e.exitCode)),stream:t,string:(t,n=`utf-8`)=>{let r=new TextDecoder(n);return i(e(t),je(e=>Pe(e.stdout,un)),S(e=>r.decode(e)),ke)},lines:(e,t=`utf-8`)=>i(n(e,t),Qe,S(d)),streamLines:n}},un=ze(new Uint8Array,(e,t)=>ie(t,e,(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n})),dn=Symbol.for(`@effect/platform/Command`),fn=y(2,(e,n)=>{switch(e._tag){case`StandardCommand`:return Y({...e,env:t(e.env,se(Object.entries(n).filter(([e])=>e!==void 0)))});case`PipedCommand`:return bn(fn(e.left,n),fn(e.right,n))}}),pn=y(2,(e,t)=>Sn(e,Fe(ae(new TextEncoder().encode(t))))),mn=e=>Array.from(hn(e)),hn=e=>{switch(e._tag){case`StandardCommand`:return ae(e);case`PipedCommand`:return ne(hn(e.left),hn(e.right))}},gn={[dn]:dn,pipe(){return ee(this,arguments)},...r},_n={...gn,_tag:`StandardCommand`,toJSON(){return{_id:`@effect/platform/Command`,_tag:this._tag,command:this.command,args:this.args,env:Object.fromEntries(this.env),cwd:this.cwd.toJSON(),shell:this.shell,gid:this.gid.toJSON(),uid:this.uid.toJSON()}}},Y=e=>Object.assign(Object.create(_n),e),vn={...gn,_tag:`PipedCommand`,toJSON(){return{_id:`@effect/platform/Command`,_tag:this._tag,left:this.left.toJSON(),right:this.right.toJSON()}}},X=e=>Object.assign(Object.create(vn),e),yn=(e,...t)=>Y({command:e,args:t,env:ce(),cwd:b(),shell:!1,stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,gid:b(),uid:b()}),bn=y(2,(e,t)=>X({left:e,right:t})),xn=y(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return Y({...e,stderr:t});case`PipedCommand`:return X({...e,right:xn(e.right,t)})}}),Sn=y(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return Y({...e,stdin:t});case`PipedCommand`:return X({...e,left:Sn(e.left,t)})}}),Cn=y(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return Y({...e,stdout:t});case`PipedCommand`:return X({...e,right:Cn(e.right,t)})}}),wn=y(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return Y({...e,cwd:o(t)});case`PipedCommand`:return bn(wn(e.left,t),wn(e.right,t))}}),Tn=fn,En=pn,Dn=mn,On=yn,kn=xn,An=Sn,jn=Cn,Mn=wn,Nn=cn,Pn=an,Fn=on,In=sn,Ln=ln,Rn=(e,t,r)=>fe(e,t).pipe(je(e=>xe(e)),Se(r.deadline),S(e=>n(e,r.onDeadline))),zn={UserPromptSubmit:30},Bn=(e,t)=>(e??zn[t]??600)*1e3,Vn=24e3,Hn=(e,t,n)=>{let r=Bn(e,t);return!n||r<=Vn?{timeoutMs:r,capNote:``}:{timeoutMs:Vn,capNote:` (capped from ${r}ms by the extension handler budget)`}},Un={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Wn=it(lt(k({key:E,value:A})));var Gn=class extends g(`RunHookScriptExecutorDeps`)(){};const Z=x(`runHookScript`)(function*(e,t,n,r,i=!0){let a=yield*Nn,{timeoutMs:o,capNote:s}=Hn(e.timeout,r,i),c=Wn(t),[l,u]=Un[e.shell??`sh`],d=(e.args===void 0?On(l,u,e.command):On(e.command,...e.args)).pipe(Mn(n),Tn({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),En(c),jn(`pipe`),kn(`pipe`)),f=yield*Gn;return yield*Rn(ke(_e(e=>C(function*(){let t=yield*a.start(d);yield*ve(()=>Ce(t.kill(`SIGKILL`)).pipe(ye(2e3),Te));let[n,r,i]=yield*e(Ee([t.stdout.pipe(He(),$e),t.stderr.pipe(He(),$e),t.exitCode.pipe(S(Number),Oe(()=>-1))],{concurrency:`unbounded`}));return{code:i,stdout:n,stderr:r}}))).pipe(Ae(t=>me(`hook ${e.command} failed`,t))),f,{deadline:o,onDeadline:()=>({code:-1,stdout:``,stderr:`timeout after ${o}ms${s}`})})}),Kn=D({code:Ue,stdout:E,stderr:E});var qn=class extends P()(`Block`,{reason:E}){},Jn=class extends P()(`Allow`,{updatedInput:w(k({key:E,value:A}))}){},Yn=class extends P()(`Warning`,{message:E}){};j(qn,Jn,Yn);var Xn=class extends P()(`Blocked`,{reason:E}){},Zn=class extends P()(`Continue`,{warning:w(E),updatedInput:w(k({key:E,value:A}))}){};j(Xn,Zn);const Qn=D({decision:w(E),reason:w(E),hookSpecificOutput:w(D({permissionDecision:w(E),permissionDecisionReason:w(E),updatedInput:w(k({key:E,value:A})),additionalContext:w(E)}))}),$n=O(nt(E,Qn,{strict:!0,decode:e=>he(Ge(lt(Qn))(e),e=>e.issue),encode:(e,t,n)=>ct(new ot(n,e,`Decode-only: hook stdout is never encoded`))})),er=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var tr=class extends P()(`InterpretHookCommand`,{result:Kn,event:E}){[er]=er};const nr=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var rr=class extends Re()(`HookVerdictError`,{raw:E}){[nr]=nr};const Q=Symbol.for(`@systemfsoftware/omp-claude-compat/ExitKind`);var ir=class extends P()(`ExitBlock`,{}){[Q]=Q},ar=class extends P()(`ExitDecisionJson`,{}){[Q]=Q},or=class extends P()(`ExitNoDecision`,{}){[Q]=Q},sr=class extends P()(`ExitOther`,{}){[Q]=Q};j(ir,ar,or,sr);const cr=e=>a(e=>e.startsWith(`{`))(e.trim()),lr=e=>R(cr(e)).pipe(B(`Some`,()=>new ar({})),B(`None`,()=>new or({})),V),ur={0:e=>lr(e.stdout),2:()=>new ir({})},dr=e=>R(te(ur[e.code])).pipe(B(`Some`,t=>t.value(e)),B(`None`,()=>new sr({})),V),fr=e=>a(e=>e!==``)(e.trim()),pr=(e,t)=>R(fr(e)).pipe(B(`Some`,e=>e.value),B(`None`,()=>`Blocked by ${t} hook`),V),mr={deny:(e,t)=>e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`,block:(e,t)=>e.reason??`Blocked by ${t} hook`},hr=(e,t)=>R(te(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(oe(e=>mr[e]))).pipe(B(`Some`,n=>new qn({reason:n.value(e,t)})),B(`None`,()=>new Jn({updatedInput:e.hookSpecificOutput?.updatedInput})),V),gr=e=>R(fr(e)).pipe(B(`Some`,e=>new Yn({message:e.value})),B(`None`,()=>new Jn({})),V),_r=t=>R(dr(t.result)).pipe(B(`ExitBlock`,()=>v(new qn({reason:pr(t.result.stderr,t.event)}))),B(`ExitNoDecision`,()=>v(new Jn({}))),B(`ExitDecisionJson`,()=>e($n(t.result.stdout),{onLeft:()=>h(new rr({raw:t.result.stdout})),onRight:e=>v(hr(e,t.event))})),B(`ExitOther`,()=>v(gr(t.result.stderr))),V),vr={},yr=N(k({key:E,value:A})),br=we([]);g(`@systemfsoftware/omp-claude-compat/AsyncHookContextState`)();function xr(e){let t=e.trim();t.length!==0&&le(pe(br,e=>e.length>=64?[...e.slice(1),t]:[...e,t]))}function Sr(){return le(de(br,[]))}var Cr=class extends g(`SuperviseForkExecutorDeps`)(){};const wr=(e,t,n)=>e.pipe(ue({onSuccess:e=>{let t=$n(e.stdout);if(s(t)){let e=t.right.hookSpecificOutput?.additionalContext;e!==void 0&&xr(e)}},onFailure:e=>{Me(e)||t.ui.notify(`Background hook failed: ${n}: ${Ne(e).split(`
|
|
2
|
+
`)[0]}`,`error`)}}));var Tr=class extends g(`RunHooksForEventExecutorDeps`)(){};const Er=x(`runHooksForEventUnbounded`)(function*(t,r,i,a,s){let c=a.cwd,l=n(yr(i.tool_input),()=>vr),u,d=i,p=G({_tag:`MatcherUnreadable`,event:s},T);for(let n of t)if(!(p&&n.matcher!==void 0)&&rt(r,n.matcher))for(let t of n.hooks){if(t.type!==`command`||t.if!==void 0&&(!G({_tag:`IfEvaluatingEvent`,event:s},T)||!st(t.if,r,l,c)))continue;if(t.async===!0||t.asyncRewake===!0){yield*ge(wr(Z(t,d,c,s,!1),a,t.command));continue}let n=e(_r(new tr({result:yield*Z(t,d,c,s),event:s})),{onLeft:e=>R(e).pipe(B(`HookVerdictError`,e=>new Yn({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`})),V),onRight:e=>e}),i=R(n).pipe(B(`Block`,e=>new Xn({reason:e.reason})),B(`Warning`,e=>new Zn({warning:e.message})),B(`Allow`,e=>new Zn({updatedInput:e.updatedInput})),V),p=R(i).pipe(B(`Blocked`,e=>o({block:!0,reason:e.reason})),B(`Continue`,e=>(e.warning!==void 0&&u===void 0&&(u=e.warning),e.updatedInput!==void 0&&(d={...d,...e.updatedInput}),b())),V);if(f(p))return p.value}return{...d===i?{}:{updatedInput:d},...u===void 0?{}:{warning:u}}}),$=x(`runHooksForEvent`)(function*(e,t,n,r,i){return yield*Er(e,t,n,r,i).pipe(ye(26e3),be(`TimeoutException`,()=>De({})))});var Dr=class extends g(`RunLifecycleHooksExecutorDeps`)(){};const Or=x(`runLifecycleHooks`)(function*(e,t,n){if(e.length===0)return;let r=t.cwd,i={...F(()=>t.sessionManager.getSessionId())},a=G({_tag:`MatcherUnreadable`,event:n},T);for(let o of e)if(!(a&&o.matcher!==void 0))for(let e of o.hooks)e.type===`command`&&e.if===void 0&&(e.async===!0||e.asyncRewake===!0?yield*ge(wr(Z(e,i,r,n,!1),t,e.command)):yield*Z(e,i,r,n))});var kr=class extends g(`RunPostToolUseFailureHooksExecutorDeps`)(){};const Ar=N(I(D({text:w(E)}))),jr=N(E),Mr=e=>p(Ar(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
|
|
3
|
+
`),onNone:()=>n(jr(e),()=>``)}),Nr=x(`runPostToolUseFailureHooks`)(function*(e,t,r){let i=et(t.toolName),a=Ye(i,n(yr(t.input),()=>vr)),o={...F(()=>r.sessionManager.getSessionId()),tool_name:i,tool_input:a,tool_use_id:t.toolCallId,error:Mr(t.content)},s=yield*$(e.hooks.PostToolUseFailure,i,o,r,`PostToolUseFailure`);return s.block===!0?s.reason===void 0?{}:{warning:s.reason}:s});var Pr=class extends g(`RunPostToolUseHooksExecutorDeps`)(){};const Fr=x(`runPostToolUseHooks`)(function*(e,t,r){let i=et(t.toolName),a=F(()=>r.sessionManager.getSessionId()),o=Ye(i,n(yr(t.input),()=>vr)),s=Ze(i,o),c=s.length===0?[o]:s.map(e=>({...o,file_path:e})),l,u={};for(let n of c){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1},s=yield*$(e.hooks.PostToolUse,i,o,r,`PostToolUse`);if(s.block===!0)return s;l===void 0&&(l=s.warning),u=s}return l===void 0?u:{...u,warning:l}});var Ir=class extends g(`RunPreCompactHooksExecutorDeps`)(){};const Lr=x(`runPreCompactHooks`)(function*(e,t){let n={...F(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)});var Rr=class extends g(`RunPreToolUseHooksExecutorDeps`)(){};const zr=x(`runPreToolUseHooks`)(function*(e,t,r){let i=et(t.toolName),a=F(()=>r.sessionManager.getSessionId()),o=n(yr(t.input),()=>vr),s=Ye(i,o),c=Ke(t.toolName,o);if(c!==void 0&&c.length>0){let n={...a,tool_name:`Bash`,tool_input:{command:c},tool_call_id:t.toolCallId},i=yield*$(e.hooks.PreToolUse,`Bash`,n,r,`PreToolUse`);if(i.block===!0)return i.reason===void 0?{block:!0}:{block:!0,reason:i.reason}}let l=Ze(i,s),u=l.length===0?[s]:l.map(e=>({...s,file_path:e})),d={};for(let n of u){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId},s=yield*$(e.hooks.PreToolUse,i,o,r,`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,at(o,f))});var Br=class extends g(`RunSessionStartHooksExecutorDeps`)(){};const Vr=x(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...F(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!rt(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*ge(wr(Z(t,a,i,`SessionStart`,!1),n,t.command));continue}yield*Z(t,a,i,`SessionStart`)}}});var Hr=class extends g(`RunSessionSwitchHooksExecutorDeps`)(){};const Ur=x(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*Vr(e,t,n))});var Wr=class extends g(`RunToolResultHooksExecutorDeps`)(){};const Gr=x(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Nr(e,t,n):yield*Fr(e,t,n)}),Kr=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
|
|
4
|
+
`,`$\r`,`$$ `,`$$ `,`$$
|
|
5
|
+
`,`$$\r`],qr=e=>Kr.some(t=>`${e.trimStart()} `.startsWith(t));var Jr=class extends g(`RunUserPromptSubmitHooksExecutorDeps`)(){};const Yr=x(`runUserPromptSubmitHooks`)(function*(t,n,r){let i=t.hooks.UserPromptSubmit,a=r.cwd,o=qr(n.text),s=R(o).pipe(z(!0,()=>[]),z(!1,()=>Sr()),V),c=[],l={...F(()=>r.sessionManager.getSessionId()),prompt:n.text,source:n.source};for(let t of i)for(let n of t.hooks){if(n.type!==`command`||n.if!==void 0)continue;let t=yield*Z(n,l,a,`UserPromptSubmit`),i=e(_r(new tr({result:t,event:`UserPromptSubmit`})),{onLeft:()=>void 0,onRight:e=>R(e).pipe(B(`Block`,e=>e.reason),xt(()=>void 0))});if(i!==void 0)return r.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${i}`,`error`),{handled:!0};if(t.code!==0)continue;let o=t.stdout.trim();o.length>0&&c.push(o)}return R(o).pipe(z(!0,()=>void 0),z(!1,()=>{let e=[...s,...c].join(`
|
|
6
|
+
|
|
7
|
+
`);if(e.length===0)return;let t={text:`${e}\n\n${n.text}`};return n.images!==void 0&&(t.images=n.images),t}),V)});var Xr=class extends g(`HookDispatcherExecutorDeps`)(){};const Zr=e=>C(function*(){return yield*R(e).pipe(B(`ToolCall`,({event:e,ctx:t})=>C(function*(){let n=yield*J(K(L(),t.cwd));if(n)return yield*zr(n,e,t)})),B(`ToolResult`,({event:e,ctx:t})=>C(function*(){let n=yield*J(K(L(),t.cwd));if(!n)return;let r=yield*Gr(n,e,t);if(r.block===!0)return{isError:!0,content:[{type:`text`,text:r.reason??`Blocked by PostToolUse hook`}]};if(r.warning!==void 0)return{content:[...e.content,{type:`text`,text:r.warning}],isError:e.isError}})),B(`Prompt`,({event:e,ctx:t})=>C(function*(){let n=yield*J(K(L(),t.cwd));if(n)return yield*Yr(n,e,t)})),B(`SessionStart`,({reason:e,ctx:t})=>C(function*(){let n=yield*en(K(L(),t.cwd)),r=[...n.coverage.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...n.coverage.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...n.coverage.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.shadowed.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.disabled.map(e=>` ${e.event}: ${e.reason}`)];r.length>0&&t.ui.notify(`Hook coverage — configured hooks this bridge will not run:\n${r.join(`
|
|
8
|
+
`)}`,`warning`),n.unsupportedHookTypes.length>0&&t.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${n.unsupportedHookTypes.join(`, `)}`,`warning`),n.malformedFiles.length>0&&t.ui.notify(`Hooks are NOT running from malformed settings file(s): ${n.malformedFiles.join(`, `)}`,`error`);let i=yield*J(K(L(),t.cwd));i&&(yield*Vr(i,e,t))})),B(`SessionCompact`,({ctx:e})=>C(function*(){let t=yield*J(K(L(),e.cwd));t&&(yield*Vr(t,`compact`,e),yield*Or(t.hooks.PostCompact,e,`PostCompact`))})),B(`PreCompact`,({ctx:e})=>C(function*(){let t=yield*J(K(L(),e.cwd));if(!t)return;let n=yield*Lr(t,e);if(n.block===!0)return e.ui.notify(`Compaction cancelled by a PreCompact hook: ${n.reason??`no reason given`}`,`warning`),{cancel:!0}})),B(`SessionSwitch`,({reason:e,ctx:t})=>C(function*(){let n=yield*J(K(L(),t.cwd));n&&(yield*Ur(n,e,t))})),B(`SessionShutdown`,({ctx:e})=>C(function*(){let t=yield*J(K(L(),e.cwd));t&&(yield*Or(t.hooks.SessionEnd,e,`SessionEnd`))})),B(`SessionStop`,({ctx:e})=>C(function*(){let t=yield*J(K(L(),e.cwd));t&&(yield*Or(t.hooks.Stop,e,`Stop`))})),V)});export{$t as C,tn as S,In as _,Hr as a,Dn as b,Ir as c,Dr as d,Tr as f,Fn as g,Nn as h,Wr as i,Pr as l,Gn as m,Zr as n,Br as o,Cr as p,Jr as r,Rr as s,Xr as t,kr as u,Pn as v,An as x,Ln as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{As as e,qs as t}from"./core-C1FEy4nD.js";import{O as n,ft as r,h as i}from"./Effect-fMAnbW-8.js";import{n as a}from"./hook-dispatcher.executor-VKMzdbhh.js";const o=(o,s)=>{async function c(o){let c=n(function*(){let e=yield*i(a(o));if(t(e))throw e.left;return e.right}).pipe(r(28e3));return e(await s.runSafe(c))}o.on(`tool_call`,(e,t)=>c({_tag:`ToolCall`,event:e,ctx:t})),o.on(`tool_result`,(e,t)=>c({_tag:`ToolResult`,event:e,ctx:t})),o.on(`input`,(e,t)=>c({_tag:`Prompt`,event:e,ctx:t})),o.on(`session_start`,(e,t)=>c({_tag:`SessionStart`,reason:`startup`,ctx:t})),o.on(`session_compact`,(e,t)=>c({_tag:`SessionCompact`,ctx:t})),o.on(`session_before_compact`,(e,t)=>c({_tag:`PreCompact`,ctx:t})),o.on(`session_switch`,(e,t)=>c({_tag:`SessionSwitch`,reason:e.reason,ctx:t})),o.on(`session_shutdown`,async(e,t)=>{try{return await c({_tag:`SessionShutdown`,ctx:t})}finally{await s.dispose()}}),o.on(`session_stop`,(e,t)=>c({_tag:`SessionStop`,ctx:t}))};export{o as HookDispatcherTask};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cs as e,Ds as t,Ec as n,El as r,Er as i,Hs as a,Io as o,Kt as s,Lr as c,Rs as l,Sl as u,Tc as d,Tl as ee,Ts as f,Ui as te,mr as ne,mt as re,vn as ie,wr as ae,yn as oe,zs as se}from"./core-C1FEy4nD.js";import{$t as ce,Bt as le,Fn as ue,G as p,H as de,Ht as m,I as h,It as g,Jt as fe,K as pe,Lt as me,O as he,Qt as ge,Rt as _e,St as ve,T as ye,Tn as be,U as xe,Xt as Se,Yt as Ce,Zt as we,_n as Te,an as Ee,at as De,c as Oe,ct as _,en as ke,g as Ae,gn as je,ht as Me,in as Ne,k as Pe,l as v,lt as Fe,mt as Ie,n as y,nn as Le,on as Re,ot as b,p as ze,pn as Be,r as x,rn as Ve,rt as He,sn as Ue,st as S,tn as C,tt as w,v as T,vt as We,wt as E,x as D,xn as Ge,yt as Ke,zt as O}from"./Effect-fMAnbW-8.js";import{i as qe,p as Je}from"./Exit-BhYZ1Mg3.js";import{A as Ye,C as k,E as Xe,F as A,I as Ze,N as Qe,P as $e,R as et,S as tt,_ as nt,_t as rt,b as it,d as at,dt as j,f as ot,ft as st,g as M,gt as N,h as P,ht as ct,lt,m as F,mt as ut,n as dt,p as ft,pt,t as mt,ut as ht,v as gt,vt as I,w as _t,x as vt,y as yt,yt as L}from"./dist-opjiVExE.js";import{C as bt,S as xt,_ as St,a as Ct,b as R,c as wt,d as Tt,f as Et,g as Dt,h as Ot,i as kt,l as At,m as jt,o as Mt,p as Nt,r as Pt,s as Ft,t as It,u as Lt,v as z,x as B,y as Rt}from"./hook-dispatcher.executor-VKMzdbhh.js";import{t as zt}from"./inject-instructions.executor-RzZpGK-N.js";import*as Bt from"node:os";import*as Vt from"node:crypto";import*as V from"node:path";import*as H from"node:fs";import*as U from"node:child_process";function W(e,t){return ie(e.runtimeEffect,e=>c(n=>(n.setFiberRefs(e.fiberRefs),n.currentRuntimeFlags=e.runtimeFlags,ne(t,e.context))))}const Ht={...ue,[Be]:Be,pipe(){return d(this,arguments)},commit(){return this.runtimeEffect}},Ut=(e,t)=>{t??=Ce();let n=Ee(Ge()),r,a=ae(()=>{if(!r){let a=new be;r=ge(i(Te(fe(e,t),n),e=>{o.cachedRuntime=e}),{scope:n,scheduler:a}),a.flush()}return oe(r.await)}),o=Object.assign(Object.create(Ht),{memoMap:t,scope:n,runtimeEffect:a,cachedRuntime:void 0,runtime(){return o.cachedRuntime===void 0?C(o.runtimeEffect):Promise.resolve(o.cachedRuntime)},dispose(){return C(o.disposeEffect)},disposeEffect:ae(()=>(o.runtimeEffect=re(`ManagedRuntime disposed`),o.cachedRuntime=void 0,je(o.scope,s))),runFork(e,t){return o.cachedRuntime===void 0?ge(W(o,e),t):we(o.cachedRuntime)(e,t)},runSyncExit(e){return o.cachedRuntime===void 0?Ue(W(o,e)):Re(o.cachedRuntime)(e)},runSync(e){return o.cachedRuntime===void 0?Ee(W(o,e)):Ne(o.cachedRuntime)(e)},runPromiseExit(e,t){return o.cachedRuntime===void 0?Ve(W(o,e),t):Le(o.cachedRuntime)(e,t)},runCallback(e,t){return o.cachedRuntime===void 0?ce(Se)(W(o,e),t):ce(o.cachedRuntime)(e,t)},runPromise(e,t){return o.cachedRuntime===void 0?C(W(o,e),t):ke(o.cachedRuntime)(e,t)}});return o},G=(e,t,n)=>(...r)=>v(i=>{try{e(...r,(e,n)=>{i(e?T(t?t(e,r):e):b(n))})}catch(e){i(n?T(n(e,r)):ze(e))}}),Wt=(e,t,n)=>Xe(Gt(e,t,n)),Gt=(e,t,n)=>pt(()=>Jt(e(),t,te(void 0),n)),Kt=(e,t,{encoding:n,endOnDone:r=!0}={},i=y)=>{let a=qt(e,n),o=r?v(t=>{`closed`in e&&e.closed?t(y):(e.once(`finish`,()=>t(y)),e.end())}):y;return{awaitRead:()=>y,emit:a,error:e=>E(o,t(e)),done:e=>E(o,i)}},qt=(e,t)=>n=>n.length===0?y:v(r=>{let i=n[Symbol.iterator](),a=i.next();function o(){let n=a;a=i.next();let s=e.write(n.value,t);a.done?r(y):s?o():e.once(`drain`,o)}o()}),Jt=(e,t,n,r)=>{if(!e.readable)return ut;let i=We(!1);function a(){i.unsafeOpen()}function s(e){n.current=qe(t(e)),i.unsafeOpen()}function c(){n.current=Je,i.unsafeOpen()}e.on(`readable`,a),e.on(`error`,s),e.on(`end`,c);let l=r?.chunkSize?Number(r.chunkSize):void 0;return ht(pt(function t(){let r=e.read(l);if(r===null)return n.current?st(n.current):(i.unsafeClose(),j(i.await,t));let a=[r];for(;;){if(r=e.read(l),r===null)return j(ct(o(a)),t);a.push(r)}}),_(()=>{e.off(`readable`,a),e.off(`error`,s),e.off(`end`,c),r?.closeOnDone!==!1&&`closed`in e&&!e.closed&&e.destroy()}))},Yt=(e,t,n)=>et(Xt(e,t,n)),Xt=(e,t,n)=>j(ve(_(()=>e()),le()),([e,r])=>lt(Zt(e,r,t),Kt(e,e=>_e(r,e),n,me(r,y)))),Zt=(e,t,n)=>S(()=>{function r(e){m(t,T(n(e)))}return e.on(`error`,r),Ae(g(t),_(()=>{e.removeListener(`error`,r)}))}),K=(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`;break}return new k({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},Qt=e=>typeof e==`string`?e:`pipe`,$t=e=>typeof e==`string`?e:`pipe`,q=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),J=(e,t,n)=>{let r=R(n).reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return K(`Command`,e)(t,[r])},en={[z]:z,...n,toJSON(){return{_id:`@effect/platform/CommandExecutor/Process`,pid:this.pid}}},Y=e=>n=>{switch(n._tag){case`StandardCommand`:{let i=D(le(),e=>v(r=>{let i=U.spawn(n.command,n.args,{stdio:[Qt(n.stdin),$t(n.stdout),$t(n.stderr)],cwd:t(n.cwd,u),shell:n.shell,env:{...process.env,...Object.fromEntries(n.env)},detached:process.platform!==`win32`});return i.on(`error`,e=>{r(T(J(`spawn`,e,n)))}),i.on(`exit`,(...t)=>{m(e,b(t))}),i.on(`spawn`,()=>{r(b([i,e]))}),_(()=>{i.kill(`SIGTERM`)})})),a=process.platform===`win32`?(e,t)=>v(t=>{U.exec(`taskkill /pid ${e.pid} /T /F`,e=>{t(e?T(J(`kill`,q(e),n)):y)})}):(e,t)=>Me({try:()=>process.kill(-e.pid,t),catch:e=>J(`kill`,q(e),n)}),o=(e,t)=>S(()=>e.kill(t)?y:T(J(`kill`,new globalThis.Error(`Failed to kill process`),n)));return r(l(n.cwd,{onNone:()=>y,onSome:t=>e.access(t)}),E(x(i,([e,t])=>D(O(t),n=>n?D(g(t),([t])=>t!==0&&t!==null?a(e,`SIGTERM`).pipe(Pe):y):a(e,`SIGTERM`).pipe(pe(()=>o(e,`SIGTERM`)),E(g(t)),Pe)))),h(([e,t])=>{let r=Ze;e.stdin!==null&&(r=Yt(()=>e.stdin,e=>J(`toWritable`,q(e),n)));let i=D(g(t),([e,t])=>e===null?T(J(`exitCode`,new globalThis.Error(`Process interrupted due to receipt of signal: ${t}`),n)):b(Dt(e))),s=xe(O(t)),c=(n=`SIGTERM`)=>a(e,n).pipe(pe(()=>o(e,n)),E(Oe(g(t)))),l=St(e.pid),u=Wt(()=>e.stderr,e=>J(`fromReadable(stderr)`,q(e),n)),d=Wt(()=>e.stdout,e=>J(`fromReadable(stdout)`,q(e),n));return typeof n.stdout!=`string`&&(d=Qe(d,n.stdout)),Object.assign(Object.create(en),{pid:l,exitCode:i,isRunning:s,kill:c,stdin:r,stderr:u,stdout:d})}),typeof n.stdin==`string`?ee:Fe(e=>ye(Ye(n.stdin,e.stdin))))}case`PipedCommand`:{let t=R(n);if(t.length===1)return r(t[0],Y(e));let i=t[0],a=t.slice(1),o=a.slice(0,a.length-1),s=a[a.length-1];return r(B(s,o.reduce((t,n)=>r(B(n,t),Y(e),h(e=>e.stdout),A),r(Y(e)(i),h(e=>e.stdout),A))),Y(e))}}},tn=N(Ot,r(F,h(e=>Rt(Y(e))))),X=e=>t=>new tt({module:`FileSystem`,method:e,cause:t}),nn=(()=>{let e=G(H.access,K(`FileSystem`,`access`),X(`access`));return(t,n)=>{let r=H.constants.F_OK;return n?.readable&&(r|=H.constants.R_OK),n?.writable&&(r|=H.constants.W_OK),e(t,r)}})(),rn=(()=>{let e=G(H.cp,K(`FileSystem`,`copy`),X(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),an=(()=>{let e=G(H.copyFile,K(`FileSystem`,`copyFile`),X(`copyFile`));return(t,n)=>e(t,n)})(),on=(()=>{let e=G(H.chmod,K(`FileSystem`,`chmod`),X(`chmod`));return(t,n)=>e(t,n)})(),sn=(()=>{let e=G(H.chown,K(`FileSystem`,`chown`),X(`chown`));return(t,n,r)=>e(t,n,r)})(),cn=(()=>{let e=G(H.link,K(`FileSystem`,`link`),X(`link`));return(t,n)=>e(t,n)})(),ln=(()=>{let e=G(H.mkdir,K(`FileSystem`,`makeDirectory`),X(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),Z=e=>{let t=G(H.mkdtemp,K(`FileSystem`,e),X(e));return e=>S(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?V.join(e.directory,`.`):Bt.tmpdir();return t(n?V.join(r,n):r+`/`)})},un=Z(`makeTempDirectory`),Q=e=>{let t=G(H.rm,K(`FileSystem`,e),X(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},dn=Q(`remove`),fn=(()=>{let e=Z(`makeTempDirectoryScoped`),t=Q(`makeTempDirectoryScoped`);return n=>x(e(n),e=>p(t(e,{recursive:!0})))})(),pn=e=>{let t=G(H.open,K(`FileSystem`,e),X(e)),n=G(H.close,K(`FileSystem`,e),X(e));return(e,i)=>r(x(t(e,i?.flag??`r`,i?.mode),e=>p(n(e))),h(e=>hn(ft(e),i?.flag?.startsWith(`a`)??!1)))},mn=pn(`open`),hn=(()=>{let e=e=>G(H.read,K(`FileSystem`,e),X(e)),t=e(`read`),n=e(`readAlloc`),r=G(H.fstat,K(`FileSystem`,`stat`),X(`stat`)),i=G(H.ftruncate,K(`FileSystem`,`truncate`),X(`truncate`)),o=G(H.fsync,K(`FileSystem`,`sync`),X(`sync`)),s=e=>G(H.write,K(`FileSystem`,e),X(e)),c=s(`write`),l=s(`writeAll`);class u{fd;append;[P];semaphore=Ke(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[P]=P}get stat(){return h(r(this.fd),wn)}get sync(){return o(this.fd)}seek(e,t){let n=M(e);return this.semaphore.withPermits(1)(_(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(h(S(()=>t(this.fd,{buffer:e,position:this.position})),e=>{let t=M(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(D(_(()=>Buffer.allocUnsafeSlow(t)),e=>h(n(this.fd,{buffer:e,position:this.position}),n=>{if(n===0)return se();if(this.position+=BigInt(n),n===t)return a(e);let r=Buffer.allocUnsafeSlow(n);return e.copy(r,0,0,n),a(r)})))}truncate(e){return this.semaphore.withPermits(1)(h(i(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}}))}write(e){return this.semaphore.withPermits(1)(h(S(()=>c(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=M(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return D(S(()=>l(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?T(new k({module:`FileSystem`,method:`writeAll`,reason:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position+=BigInt(t)),t<e.length?this.writeAllChunk(e.subarray(t)):y))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new u(e,t)})(),gn=e=>{let t=Z(e),n=pn(e),i=e=>_(()=>Vt.randomBytes(e).toString(`hex`));return e=>r(ve(t(e),i(6)),h(([t,n])=>V.join(t,n+(e?.suffix??``))),Fe(e=>He(n(e,{flag:`w+`}))))},_n=gn(`makeTempFile`),vn=(()=>{let e=gn(`makeTempFileScoped`),t=Q(`makeTempFileScoped`);return n=>x(e(n),e=>p(t(V.dirname(e),{recursive:!0})))})(),yn=(e,t)=>Ie({try:()=>H.promises.readdir(e,t),catch:t=>K(`FileSystem`,`readDirectory`)(t,[e])}),bn=e=>v((t,n)=>{try{H.readFile(e,{signal:n},(n,r)=>{t(n?T(K(`FileSystem`,`readFile`)(n,[e])):b(r))})}catch(e){t(T(X(`readFile`)(e)))}}),xn=(()=>{let e=G(H.readlink,K(`FileSystem`,`readLink`),X(`readLink`));return t=>e(t)})(),Sn=(()=>{let e=G(H.realpath,K(`FileSystem`,`realPath`),X(`realPath`));return t=>e(t)})(),Cn=(()=>{let e=G(H.rename,K(`FileSystem`,`rename`),X(`rename`));return(t,n)=>e(t,n)})(),wn=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:f(e.mtime),atime:f(e.atime),birthtime:f(e.birthtime),dev:e.dev,rdev:f(e.rdev),ino:f(e.ino),mode:e.mode,nlink:f(e.nlink),uid:f(e.uid),gid:f(e.gid),size:M(e.size),blksize:f(M(e.blksize)),blocks:f(e.blocks)}),$=(()=>{let e=G(H.stat,K(`FileSystem`,`stat`),X(`stat`));return t=>h(e(t),wn)})(),Tn=(()=>{let e=G(H.symlink,K(`FileSystem`,`symlink`),X(`symlink`));return(t,n)=>e(t,n)})(),En=(()=>{let e=G(H.truncate,K(`FileSystem`,`truncate`),X(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),Dn=(()=>{let e=G(H.utimes,K(`FileSystem`,`utime`),X(`utime`));return(t,n,r)=>e(t,n,r)})(),On=(e,t)=>_t(n=>x(_(()=>{let r=H.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(de($(t),{onSuccess:e=>b(gt({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?b(yt({path:t})):T(e)}));return;case`change`:n.single(it({path:t}));return}});return r.on(`error`,t=>{n.fail(new k({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>_(()=>e.close()))),kn=(n,r,i)=>$(r).pipe(h(a=>n.pipe(e(e=>e.register(r,a,i)),t(()=>On(r,i)))),$e),An=(e,t,n)=>v((r,i)=>{try{H.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?T(K(`FileSystem`,`writeFile`)(t,[e])):y)})}catch(e){r(T(X(`writeFile`)(e)))}}),jn=N(F,h(De(nt),e=>vt({access:nn,chmod:on,chown:sn,copy:rn,copyFile:an,link:cn,makeDirectory:ln,makeTempDirectory:un,makeTempDirectoryScoped:fn,makeTempFile:_n,makeTempFileScoped:vn,open:mn,readDirectory:yn,readFile:bn,readLink:xn,realPath:Sn,remove:dn,rename:Cn,stat:$,symlink:Tn,truncate:En,utimes:Dn,watch(t,n){return kn(e,t,n)},writeFile:An}))),Mn=tn,Nn=rt(L(It,w),L(xt,w),L(bt,w),L(jt,w),L(Et,w),L(Ft,w),L(At,w),L(Lt,w),L(kt,w),L(wt,w),L(Pt,w),L(Mt,w),L(Ct,w),L(Tt,w),L(Nt,w)),Pn=N(zt,he(function*(){return{fileSystem:yield*F,path:yield*at,tomlLoader:yield*mt}})),Fn=Mn.pipe(I(jn),I(ot)),In=Ut(Nn.pipe(I(Pn),I(dt),I(Fn)));export{Nn as HookScopeLive,Pn as InjectInstructionsDepsLive,In as default};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=(e,t)=>{e(e=>{e.setTimeout(()=>{t()},0)});let n=()=>{t().then(({default:e})=>e.dispose())};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)};async function
|
|
1
|
+
const e=(e,t)=>{e(e=>{e.setTimeout(()=>{t()},0)});let n=()=>{t().then(({default:e})=>e.dispose())};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)},t=()=>import(`./hook-runtime.state-DnCEYjpv.js`).then(e=>e.default),n={runSafe:async e=>{let[n,r,i,a]=await Promise.all([t(),import(`./Cause-BpHZgZuR.js`).then(e=>e.t),import(`./Effect-fMAnbW-8.js`).then(e=>e.t),import(`./Exit-BhYZ1Mg3.js`).then(e=>e.t)]),o=await n.runPromise(e.pipe(i.exit));if(a.isFailure(o))throw r.squash(o.cause);return o.value},dispose:async()=>{await(await t()).dispose()}};async function r(t){let[{HookDispatcherTask:r},{InjectInstructionsTask:i}]=await Promise.all([import(`./hook-dispatcher.handler-DoauiNPI.js`),import(`./inject-instructions.handler-B7iXvfzB.js`)]);r(t,n),i(t,n),e(e=>t.on(`session_start`,(t,n)=>e(n)),()=>import(`./hook-runtime.state-DnCEYjpv.js`))}export{r as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{Js as e,oa as t,qs as n}from"./core-C1FEy4nD.js";import{C as r,h as i,q as a}from"./Effect-fMAnbW-8.js";import"./dist-opjiVExE.js";var o=class extends t(`InjectInstructionsExecutorDeps`)(){};const s=[`AGENTS.md`],c=r(`extractRefs`)(function*(t,n,r){let{fileSystem:a,path:s}=yield*o,c=[];for(let o of t.split(`
|
|
2
|
+
`)){let t=o.trim().replace(/^[-*+]\s+/,``);if(!t.startsWith(`@`))continue;let l=t.slice(1).trim();if(!l||l.includes(` `)||s.isAbsolute(l))continue;let u=s.resolve(n,l);if(u.startsWith(r+`/`)||u===r){let t=yield*i(a.exists(u));if(e(t)&&t.right){c.push({sourcePath:n,resolvedPath:u});continue}}let d=s.resolve(r,l);(d.startsWith(r+`/`)||d===r)&&d!==u&&c.push({sourcePath:r,resolvedPath:d})}return c}),l=r(`loadReferencedContent`)(function*(t){let{fileSystem:r,path:l,tomlLoader:u}=yield*o,d=[l.resolve(t,`CLAUDE.md`),l.resolve(t,`.claude`,`CLAUDE.md`)],f=[];for(let n of d){let a=yield*i(r.readFileString(n,`utf-8`));if(e(a)){let e=yield*c(a.right,l.dirname(n),t);f.push(...e)}}let p=new Set,m=[];for(let e of f)p.has(e.resolvedPath)||(p.add(e.resolvedPath),m.push(e));let h=(yield*u.load(t).pipe(a(()=>void 0)))?.no_inject_refs??s,g=[];for(let e of m){let a=e.resolvedPath.slice(t.length+1);if(h.includes(a))continue;let o=yield*i(r.readFileString(e.resolvedPath,`utf-8`));n(o)||g.push(`## ${a}\n${o.right}\n`)}return g.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...g].join(`
|
|
3
|
+
`)});export{l as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ws as e,sc as t,tc as n,wl as r}from"./core-C1FEy4nD.js";import{Bn as i,Hn as a,Ln as o,O as s,Rn as c,Un as l,Vn as u,h as d,zn as f}from"./Effect-fMAnbW-8.js";import{n as p}from"./inject-instructions.executor-RzZpGK-N.js";const m=l,h=Symbol.for(`effect/Config`),g={_A:e=>e},_={...t,[h]:g,commit(){return o(this)}},v=r(2,(e,t)=>{let n=Object.create(_);return n._tag=u,n.name=t,n.config=e,n}),y=r(2,(e,t)=>{let n=Object.create(_);return n._tag=f,n.first=e,n.second=C(t.orElse),n.condition=t.if,n}),b=(e,t)=>{let n=Object.create(_);return n._tag=a,n.description=e,n.parse=t,n},x=e=>{let t=b(`a text property`,n);return e===void 0?t:v(t,e)},S=e=>{let t=Object.create(_);return t._tag=c,t.value=e,t.parse=()=>n(e),t},C=e=>{let t=Object.create(_);return t._tag=i,t.config=e,t},w=r(2,(e,t)=>y(e,{orElse:()=>S(t),if:m})),T=x,E=w,D=(t,n)=>{t.on(`before_agent_start`,async(t,r)=>{let i=await n.runSafe(s(function*(){return e(yield*d(p(yield*T(`CLAUDE_PROJECT_DIR`).pipe(E(process.cwd())))))}));if(i!==``)return{systemPrompt:[...t.systemPrompt,``,i]}})};export{D as InjectInstructionsTask};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/omp-claude-compat",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.2",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"description": "OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references",
|
|
7
7
|
"type": "module",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"tsdown": "^0.22.9",
|
|
33
33
|
"typescript": "^7",
|
|
34
34
|
"vitest": "^4",
|
|
35
|
-
"@systemfsoftware/effect-gherkin-spec": "^0.
|
|
35
|
+
"@systemfsoftware/effect-gherkin-spec": "^0.5.1",
|
|
36
36
|
"@systemfsoftware/omp-utils": "^0.0.0",
|
|
37
|
-
"@systemfsoftware/
|
|
37
|
+
"@systemfsoftware/stryker-js-core": "^1.2.4",
|
|
38
38
|
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
39
|
-
"@systemfsoftware/
|
|
40
|
-
"@systemfsoftware/stryker-js-typescript-checker": "^1.
|
|
41
|
-
"@systemfsoftware/
|
|
42
|
-
"@systemfsoftware/
|
|
39
|
+
"@systemfsoftware/effect-memfs": "^1.1.1",
|
|
40
|
+
"@systemfsoftware/stryker-js-typescript-checker": "^1.2.3",
|
|
41
|
+
"@systemfsoftware/tsconfig": "^1.3.1",
|
|
42
|
+
"@systemfsoftware/stryker-plugins": "^0.11.0"
|
|
43
43
|
},
|
|
44
44
|
"omp": {
|
|
45
45
|
"extensions": [
|