@systemfsoftware/omp-agent-discipline 1.0.6 → 1.0.7
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-AGt2deue.js → Cause-CZtsWHWd.js} +1 -1
- package/dist/Effect-DthArEC0.js +14 -0
- package/dist/{Exit-SvLE99lR.js → Exit-BqcpPwcB.js} +1 -1
- package/dist/core-8rEJ9Vjy.js +13 -0
- package/dist/dist-UFhZvM5a.js +16 -0
- package/dist/{esm-Dv-ifW0J.js → esm-_eaOigyE.js} +1 -1
- package/dist/helpers-YYsPcedt.js +1 -0
- package/dist/index.js +2 -2
- package/dist/no-skill-delegation.executor-Dwikf8lt.js +2 -0
- package/dist/runtime-CQdDwUnD.js +1 -0
- package/package.json +5 -5
- package/dist/Effect-92Od3962.js +0 -14
- package/dist/core-CanocZlS.js +0 -13
- package/dist/dist-aXTLYR81.js +0 -16
- package/dist/helpers-DXMuv8Tv.js +0 -1
- package/dist/no-skill-delegation.executor-DnZwOO4-.js +0 -2
- package/dist/runtime-KkPFPF3a.js +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{$c as e,$o as t,Ac as n,Ao as r,As as i,Bs as a,Cr as o,Dn as s,Do as c,Ds as l,Ec as u,Es as d,Fc as f,Fi as p,Fo as m,Fs as h,Gs as g,Hi as _,Hs as v,Ic as ee,Io as te,Is as ne,Jc as re,Ji as ie,Jr as ae,Js as oe,Kc as se,Ko as ce,Ks as le,Lc as ue,Lr as de,Mc as fe,Mi as pe,Ms as me,Ni as he,Nr as ge,Ns as _e,Oo as ve,Os as ye,Pc as be,Pi as xe,Pr as Se,Ps as y,Qc as Ce,Qi as we,Qo as Te,Qs as Ee,Rc as De,Rs as b,Sc as Oe,So as ke,Ss as Ae,Tc as je,To as Me,Tr as Ne,Ts as Pe,Ui as Fe,Uo as Ie,Us as Le,Vi as Re,Vo as ze,Vs as Be,Wi as Ve,Wo as He,Ws as Ue,Xn as We,Yc as Ge,Yi as Ke,Ys as qe,Zi as Je,Zo as Ye,Zs as x,_l as S,aa as Xe,ac as Ze,al as Qe,as as $e,b as et,bo as tt,bs as nt,ci as rt,cl as it,cr as at,ct as ot,dl as st,dt as ct,ea as lt,el as ut,fl as dt,fs as ft,ft as pt,gl as C,go as mt,hl as ht,il as gt,in as _t,ji as vt,js as yt,k as bt,ko as xt,kr as St,ks as Ct,li as wt,ll as Tt,nl as Et,no as Dt,pt as Ot,qc as kt,qi as At,qo as jt,qs as Mt,ra as Nt,rl as Pt,rt as Ft,sl as It,ta as Lt,tl as Rt,ul as zt,us as Bt,ut as Vt,vl as w,vn as Ht,vo as Ut,w as Wt,wc as Gt,wr as Kt,ws as qt,xc as Jt,xo as Yt,xs as Xt,yo as Zt,ys as Qt,zc as $t,zo as en,zs as tn}from"./core-8rEJ9Vjy.js";import{$ as nn,$t as rn,A as an,At as on,C as sn,Cn as cn,Ct as ln,D as un,Dn as dn,Dt as fn,E as pn,En as mn,Et as hn,F as gn,Ft as _n,G as vn,Gt as yn,I as bn,It as xn,J as Sn,K as Cn,L as wn,M as Tn,Mt as En,N as Dn,Nt as On,O as kn,Ot as T,P as E,Pt as An,Qt as jn,R as Mn,S as Nn,St as Pn,T as Fn,Tn as In,Tt as Ln,U as Rn,V as zn,W as Bn,X as Vn,Y as Hn,Z as Un,Zt as Wn,_ as Gn,_n as Kn,_t as qn,a as Jn,an as Yn,at as Xn,b as D,bn as Zn,bt as Qn,cn as $n,ct as er,d as tr,dn as nr,en as rr,f as ir,fn as ar,ft as or,g as O,gn as sr,gt as k,h as cr,hn as lr,ht as ur,i as dr,in as fr,it as pr,j as mr,jt as hr,k as gr,kt as _r,l as vr,ln as yr,lt as br,m as xr,mn as Sr,mt as Cr,n as A,nt as j,o as wr,on as Tr,ot as Er,p as Dr,pn as Or,pt as kr,q as Ar,r as jr,rn as Mr,rt as Nr,s as Pr,sn as Fr,tn as Ir,tt as M,u as Lr,ut as Rr,v as zr,vn as Br,vt as Vr,w as Hr,wn as Ur,wt as Wr,x as Gr,xn as Kr,xt as qr,y as Jr,yn as Yr,yt as Xr,z as Zr}from"./Effect-DthArEC0.js";import{a as Qr,c as $r,d as ei,f as ti,i as ni,l as ri,n as ii,o as ai,p as oi,r as si,s as ci,u as li}from"./Cause-CZtsWHWd.js";import{a as ui,c as di,d as fi,f as pi,h as mi,i as hi,l as gi,m as _i,n as vi,p as yi,r as bi,s as xi,u as Si}from"./Exit-BqcpPwcB.js";const Ci=wt,wi=e=>t=>{let n=t===void 0?Object.create(Ze):Ci(t);return n._tag=e,n},Ti=rt,Ei=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends et{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}(),Di=e=>{let t={BaseEffectError:class extends Ei{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Oi=Symbol.for(`effect/DateTime`),ki=Symbol.for(`effect/DateTime/TimeZone`),Ai={[Oi]:Oi,pipe(){return Jt(this,arguments)},[Oe](){return this.toString()},toJSON(){return sa(this).toJSON()}},ji={...Ai,_tag:`Utc`,[$t](){return be(this,ue(this.epochMillis))},[fe](e){return Li(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${sa(this).toJSON()})`}},Mi={...Ai,_tag:`Zoned`,[$t](){return w(ue(this.epochMillis),f(ee(this.zone)),be(this))},[fe](e){return Li(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&n(this.zone,e.zone)},toString(){return`DateTime.Zoned(${xa(this)})`}},Ni={[ki]:ki,[Oe](){return this.toString()}},Pi={...Ni,_tag:`Named`,[$t](){return be(this,De(`Named:${this.id}`))},[fe](e){return Ri(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},Fi={...Ni,_tag:`Offset`,[$t](){return be(this,De(`Offset:${this.offset}`))},[fe](e){return Ri(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${ua(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},Ii=(e,t,n)=>{let r=Object.create(Mi);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},Li=e=>se(e,Oi),Ri=e=>se(e,ki),zi=e=>Ri(e)&&e._tag===`Offset`,Bi=e=>Ri(e)&&e._tag===`Named`,Vi=e=>e._tag===`Utc`,Hi=e=>e._tag===`Zoned`,Ui=dt((e,t)=>e.epochMillis===t.epochMillis),Wi=e=>{let t=Object.create(ji);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Gi=e=>{let t=e.getTime();if(Number.isNaN(t))throw new ii(`Invalid date`);return Wi(t)},Ki=e=>{if(Li(e))return e;if(e instanceof Date)return Gi(e);if(typeof e==`object`){let t=new Date(0);return pa(t,e),Gi(t)}else if(typeof e==`string`&&!qi(e))return Gi(new Date(e+`Z`));return Gi(new Date(e))},qi=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Ji=(e,t)=>{if(t?.timeZone===void 0&&Li(e)&&Hi(e))return e;let n=Ki(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=na(e)}else if(Ri(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=na(t.timeZone);else{let e=aa(t.timeZone);if(Ct(e))throw new ii(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?ha(n.epochMillis,r,t?.disambiguation??`compatible`):Ii(n.epochMillis,r,n.partsUtc)},Yi=me(Ji),Xi=/^(.{17,35})\[(.+)\]$/,Zi=e=>{let t=Xi.exec(e);if(t===null){let t=_a(e);return t===null?h():Yi(e,{timeZone:t})}let[,n,r]=t;return Yi(n,{timeZone:r})},Qi=zt(`effect/DateTime/validZoneCache`,()=>new Map),$i={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ea=e=>{let t=e.resolvedOptions().timeZone;if(Qi.has(t))return Qi.get(t);let n=Object.create(Pi);return n.id=t,n.format=e,Qi.set(t,n),n},ta=e=>{if(Qi.has(e))return Qi.get(e);try{return ea(new Intl.DateTimeFormat(`en-US`,{...$i,timeZone:e}))}catch{throw new ii(`Invalid time zone: ${e}`)}},na=e=>{let t=Object.create(Fi);return t.offset=e,t},ra=me(ta),ia=/^(?:GMT|[+-])/,aa=e=>{if(ia.test(e)){let t=_a(e);return t===null?h():b(na(t))}return ra(e)},oa=e=>e._tag===`Offset`?ua(e.offset):e.id,sa=e=>new Date(e.epochMillis),ca=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},la=e=>ca(e).getTime()-fa(e),ua=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`)}`},da=e=>ua(la(e)),fa=e=>e.epochMillis,pa=(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)},ma=1440*60*1e3,ha=(e,t,n)=>{if(t._tag===`Offset`)return Ii(e-t.offset,t);let r=va(e-ma,e,t),i=va(e+ma,e,t);if(r===i)return Ii(e-r,t);let a=r<i,o=r-i;if(a){if(va(e-i,e,t)===i)return Ii(e-i,t);let a=Ii(e-r,t);if(e!==ca(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 Ii(e-i,t);case`compatible`:case`later`:return a}return a}if(va(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||va(e-r+o,e+o,t)===r)return Ii(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 Ii(e-i,t)},ga=/([+-])(\d{2}):(\d{2})$/,_a=e=>{let t=ga.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},va=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=_a(r);return i===null?la(Ii(t,n)):i},ya=e=>sa(e).toISOString(),ba=e=>{let t=ca(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${da(e)}`},xa=e=>e.zone._tag===`Offset`?ba(e):`${ba(e)}[${e.zone.id}]`,Sa=e=>e.toUpperCase(),Ca=e=>e.toLowerCase(),wa=e=>e.length===0?e:Sa(e[0])+e.slice(1),Ta=e=>e.length===0?e:Ca(e[0])+e.slice(1),Ea=e=>e.length>0,Da=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return Da(e,t.from)}},Oa=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},ka=e=>Array.isArray(e),Aa=e=>!Array.isArray(e),ja=e=>`[${je(e)}]`,Ma=e=>ka(e)?e.map(ja).join(``):ja(e),Na=(e,n,r,i)=>{let a=e;return r&&t(r)&&(a+=`\nat path: ${Ma(r)}`),n!==void 0&&(a+=`\ndetails: ${n}`),i&&(a+=`\nschema (${i._tag}): ${i}`),a},Pa=e=>Na(`Invalid Argument`,e),Fa=(e,t,n)=>Na(`Unsupported schema or overlapping types`,`cannot extend ${e} with ${t}`,n),Ia=e=>Na(`Unsupported key schema`,void 0,void 0,e),La=e=>Na(`Unsupported literal`,`literal value: ${u(e)}`),Ra=e=>Na(`Duplicate index signature`,`${e} index signature`),za=Na(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),Ba=Na(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),Va=e=>Na(`Duplicate property signature transformation`,`Duplicate key ${u(e)}`),Ha=e=>Na(`Duplicate property signature`,`Duplicate key ${u(e)}`),Ua=Symbol.for(`effect/SchemaId/DateFromSelf`),Wa=Symbol.for(`effect/SchemaId/GreaterThan`),Ga=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),Ka=Symbol.for(`effect/SchemaId/LessThan`),qa=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),Ja=Symbol.for(`effect/SchemaId/Int`),Ya=Symbol.for(`effect/SchemaId/NonNaN`),Xa=Symbol.for(`effect/SchemaId/Finite`),Za=Symbol.for(`effect/SchemaId/JsonNumber`),Qa=Symbol.for(`effect/SchemaId/Between`),$a=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),eo=Symbol.for(`effect/SchemaId/BetweenBigint`),to=Symbol.for(`effect/SchemaId/MinLength`),no=Symbol.for(`effect/SchemaId/Length`),ro=Symbol.for(`effect/SchemaId/MinItems`),io=Symbol.for(`effect/annotation/TypeConstructor`),ao=Symbol.for(`effect/annotation/Brand`),oo=Symbol.for(`effect/annotation/SchemaId`),so=Symbol.for(`effect/annotation/Message`),co=Symbol.for(`effect/annotation/MissingMessage`),lo=Symbol.for(`effect/annotation/Identifier`),uo=Symbol.for(`effect/annotation/Title`),fo=Symbol.for(`effect/annotation/AutoTitle`),po=Symbol.for(`effect/annotation/Description`),mo=Symbol.for(`effect/annotation/Examples`),ho=Symbol.for(`effect/annotation/Default`),go=Symbol.for(`effect/annotation/JSONSchema`),_o=Symbol.for(`effect/annotation/Arbitrary`),vo=Symbol.for(`effect/annotation/Pretty`),yo=Symbol.for(`effect/annotation/Equivalence`),bo=Symbol.for(`effect/annotation/Documentation`),xo=Symbol.for(`effect/annotation/Concurrency`),So=Symbol.for(`effect/annotation/Batching`),Co=Symbol.for(`effect/annotation/ParseIssueTitle`),wo=Symbol.for(`effect/annotation/ParseOptions`),To=Symbol.for(`effect/annotation/DecodingFallback`),Eo=Symbol.for(`effect/annotation/Surrogate`),Do=Symbol.for(`effect/annotation/StableFilter`),N=C(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?b(e.annotations[t]):h()),Oo=N(ao),ko=N(so),Ao=N(co),jo=N(uo),Mo=N(fo),No=N(lo),Po=N(po),Fo=N(xo),Io=N(So),Lo=N(Co),Ro=N(wo),zo=N(To),Bo=N(Eo),Vo=N(Do),Ho=e=>Qt(Vo(e),e=>e===!0),Uo=Symbol.for(`effect/annotation/JSONIdentifier`),Wo=N(Uo),Go=e=>ne(Wo(e),()=>No(e));var Ko=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 Pe(ac(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:I(this.annotations)}}};const qo=e=>t=>t._tag===e;var Jo=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return Pe(ac(this),()=>u(this.literal))}toJSON(){return{_tag:this._tag,literal:kt(this.literal)?String(this.literal):this.literal,annotations:I(this.annotations)}}};const Yo=qo(`Literal`);var Xo=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return Pe(ac(this),()=>u(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:I(this.annotations)}}};const Zo=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`undefined`}),Qo=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`never`}),$o=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`unknown`}),es=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`any`}),ts=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`string`,[po]:`a string`}),ns=qo(`StringKeyword`),rs=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`number`,[po]:`a number`}),is=qo(`NumberKeyword`),as=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`boolean`,[po]:`a boolean`}),os=qo(`BooleanKeyword`),ss=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`bigint`,[po]:`a bigint`}),cs=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return nc(this)}toJSON(){return{_tag:this._tag,annotations:I(this.annotations)}}}({[uo]:`symbol`,[po]:`a symbol`}),ls=qo(`SymbolKeyword`);var us=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:I(this.annotations)}}toString(){return String(this.type)}},ds=class extends us{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:I(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}};const fs=e=>e.map(e=>e.type);var ps=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(Ba)}toString(){return Pe(ac(this),()=>ms(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:I(this.annotations)}}};const ms=e=>{let t=e.elements.map(String).join(`, `);return $e(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 P=class extends ds{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:I(this.annotations)}}};const hs=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return hs(e.from)}return!1};var gs=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,hs(e))this.parameter=e;else throw Error(za)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},_s=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(Ha(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=tc(t[e].parameter);if(ns(n)){if(i.string)throw Error(Ra(`string`));i.string=!0}else if(ls(n)){if(i.symbol)throw Error(Ra(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return Pe(ac(this),()=>ys(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:I(this.annotations)}}};const vs=e=>e.map(String).join(`; `),ys=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${vs(e.indexSignatures)} }`:`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${vs(e.indexSignatures)} }`;else return`{}`},bs=qo(`TypeLiteral`),xs=Bt(dn(In,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})),Ss={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},Cs=e=>He(e,e=>Os(e)?Cs(e.types):[e]),ws=e=>{let t=xs(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[es];case`UnknownKeyword`:return[$o];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[Ss[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 Ts=class e{types;annotations;static make=(t,n)=>Ds(t)?new e(t,n):t.length===1?t[0]:Qo;static unify=(t,n)=>e.make(ws(Cs(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return Pe(ac(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:I(this.annotations)}}};const Es=(e,t)=>e.map(t),Ds=e=>e.length>1,Os=qo(`Union`),ks=zt(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap);var As=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=Oa(e)}toString(){return ac(this).pipe(ne(()=>Xt(me(this.f)(),e=>ac(e))),Pe(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=ks.get(e);return t||(ks.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:I(this.annotations)},ks.set(e,t),t)}},js=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return No(this).pipe(Pe(()=>y(ic(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>Ms(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:I(this.annotations)}}};const Ms=qo(`Refinement`),Ns={};var Ps=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 Pe(ac(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:I(this.annotations)}}};const Fs=qo(`Transformation`);var Is=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}};const Ls=e=>t=>t._tag===e,Rs=new class{_tag=`ComposeTransformation`};var zs=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},Bs=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(Va(e));t[e]=!0;let i=r.to;if(n[i])throw Error(Va(i));n[i]=!0}}};const Vs=Ls(`TypeLiteralTransformation`),Hs=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[lo];let i={...r,...t},a=Bo(e);return yt(a)&&(i[Eo]=Hs(a.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},Us=(e,t)=>{switch(e._tag){case`Literal`:return Ur(String(e.literal));case`StringKeyword`:return`[\\s\\S]*?`;case`NumberKeyword`:return`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;case`TemplateLiteral`:return Gs(e,t,!1);case`Union`:return e.types.map(e=>Us(e,t)).join(`|`)}},Ws=(e,t,n,r)=>{if(Os(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},Gs=(e,t,n)=>{let r=``;if(e.head!==``){let i=Ur(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=Us(i.type,t);if(r+=Ws(i.type,e,t,n),i.literal!==``){let e=Ur(i.literal);r+=t&&n?`(${e})`:e}}return r},Ks=e=>RegExp(`^${Gs(e,!1,!0)}$`),qs=(e,t)=>{let n=[],r=[],i=e=>{switch(e._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:r.push(new gs(e,t,!0));break;case`Literal`:if(gt(e.literal)||ut(e.literal))n.push(new P(e.literal,t,!1,!0));else throw Error(La(e.literal));break;case`Enums`:for(let[r,i]of e.enums)n.push(new P(i,t,!1,!0));break;case`UniqueSymbol`:n.push(new P(e.symbol,t,!1,!0));break;case`Union`:e.types.forEach(i);break;default:throw Error(Ia(e))}};return i(e),{propertySignatures:n,indexSignatures:r}},Js=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},Ys=e=>t=>{let n={...t.annotations};for(let t of e)delete n[t];return n},Xs=Js([mo,ho,go,_o,vo,yo]),F=e=>{switch(e._tag){case`Declaration`:{let t=Zs(e.typeParameters,F);return t===e.typeParameters?e:new Ko(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=Zs(e.elements,e=>{let t=F(e.type);return t===e.type?e:new ds(t,e.isOptional)}),n=fs(e.rest),r=Zs(n,F);return t===e.elements&&r===n?e:new ps(t,r.map(e=>new us(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=Zs(e.propertySignatures,e=>{let t=F(e.type);return t===e.type?e:new P(e.name,t,e.isOptional,e.isReadonly)}),n=Zs(e.indexSignatures,e=>{let t=F(e.type);return t===e.type?e:new gs(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new _s(t,n,e.annotations)}case`Union`:{let t=Zs(e.types,F);return t===e.types?e:Ts.make(t,e.annotations)}case`Suspend`:return new As(()=>F(e.f()),e.annotations);case`Refinement`:{let t=F(e.from);return t===e.from?e:new js(t,e.filter,e.annotations)}case`Transformation`:{let t=Xs(e);return F(t===void 0?e.to:Hs(e.to,t))}}return e};function Zs(e,t){let n=!1,r=te(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 Qs=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return Qs(e.from);case`Suspend`:return Qs(e.f())}},$s=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Zs(e.typeParameters,e=>$s(e,t));return n===e.typeParameters?e:new Ko(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=Zs(e.elements,e=>{let n=$s(e.type,t);return n===e.type?e:new ds(n,e.isOptional)}),r=fs(e.rest),i=Zs(r,e=>$s(e,t));return n===e.elements&&i===r?e:new ps(n,i.map(e=>new us(e)),e.isReadonly)}case`TypeLiteral`:{let n=Zs(e.propertySignatures,e=>{let n=$s(e.type,t);return n===e.type?e:new P(e.name,n,e.isOptional,e.isReadonly)}),r=Zs(e.indexSignatures,e=>{let n=$s(e.type,t);return n===e.type?e:new gs(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new _s(n,r)}case`Union`:{let n=Zs(e.types,e=>$s(e,t));return n===e.types?e:Ts.make(n)}case`Suspend`:{let n,r=Go(e);if(yt(r)){let e=t?`Bound`:``;n={[Uo]:`${r.value}Encoded${e}`}}return new As(()=>$s(e.f(),t),n)}case`Refinement`:{let n=$s(e.from,t);return t?n===e.from?e:Qs(e.from)===void 0&&Ho(e)?new js(n,e.filter,e.annotations):n:n}case`Transformation`:return $s(e.from,t)}return e},ec=e=>$s(e,!1),I=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},tc=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return tc(e.from)}},nc=e=>Pe(ac(e),()=>e._tag);function rc(e){return y(Oo(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${u(e)}>`).join(``)})}const ic=e=>jo(e).pipe(ne(()=>Po(e)),ne(()=>Mo(e)),_e(t=>t+rc(e))),ac=e=>ne(No(e),()=>ic(e)),oc=/^[+-]?\d+$/,sc=Symbol.for(`effect/BigDecimal`),cc={[sc]:sc,[$t](){let e=hc(this);return w(ee(e.value),f(ue(e.scale)),be(this))},[fe](e){return lc(e)&&yc(this,e)},toString(){return`BigDecimal(${Cc(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Oe](){return this.toJSON()},pipe(){return Jt(this,arguments)}},lc=e=>se(e,sc),uc=(e,t)=>{let n=Object.create(cc);return n.value=e,n.scale=t,n},dc=(e,t)=>{if(e!==fc&&e%pc===fc)throw RangeError(`Value must be normalized`);let n=uc(e,t);return n.normalized=n,n},fc=BigInt(0),pc=BigInt(10),mc=dc(fc,0),hc=e=>{if(e.normalized===void 0)if(e.value===fc)e.normalized=mc;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=dc(r,i)}return e.normalized},gc=C(2,(e,t)=>t>e.scale?uc(e.value*pc**BigInt(t-e.scale),t):t<e.scale?uc(e.value/pc**BigInt(e.scale-t),t):e),_c=e=>e.value<fc?uc(-e.value,e.scale):e,vc=dt((e,t)=>e.scale>t.scale?gc(t,e.scale).value===e.value:e.scale<t.scale?gc(e,t.scale).value===t.value:e.value===t.value),yc=C(2,(e,t)=>vc(e,t)),bc=e=>d(xc(e),()=>RangeError(`Number must be finite, got ${e}`)),xc=e=>{if(!Number.isFinite(e))return h();let t=`${e}`;if(t.includes(`e`))return Sc(t);let[n,r=``]=t.split(`.`);return b(uc(BigInt(`${n}${r}`),r.length))},Sc=e=>{if(e===``)return b(mc);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)||!oc.test(i))return h()}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(!oc.test(i))return h();let s=a-n;return Number.isSafeInteger(s)?b(uc(BigInt(i),s)):h()},Cc=e=>{let t=hc(e);if(Math.abs(t.scale)>=16)return wc(t);let n=t.value<fc,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},wc=e=>{if(Ec(e))return`0e+0`;let t=hc(e),n=`${_c(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Dc(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Tc=e=>Number(Cc(e)),Ec=e=>e.value===fc,Dc=e=>e.value<fc,Oc=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?h():b(Number(e)),kc=e=>{try{return e.trim()===``?h():b(BigInt(e))}catch{return h()}},Ac=e=>{if(e>2**53-1||e<-(2**53-1))return h();try{return b(BigInt(e))}catch{return h()}},jc=Symbol.for(`effect/Brand/Refined`),Mc=()=>Object.assign(e=>e,{[jc]:jc,option:e=>b(e),either:e=>x(e),is:e=>!0}),Nc=On,Pc=An,Fc=xn,Ic=_n,Lc=Symbol.for(`effect/QueueEnqueue`),Rc=Symbol.for(`effect/QueueDequeue`),zc=Symbol.for(`effect/QueueStrategy`),Bc=Symbol.for(`effect/BackingQueue`),Vc={_A:e=>e},Hc={_A:e=>e},Uc={_In:e=>e},Wc={_Out:e=>e};var Gc=class extends Kr{queue;takers;shutdownHook;shutdownFlag;strategy;[Lc]=Uc;[Rc]=Wc;constructor(e,t,n,r,i){super(),this.queue=e,this.takers=t,this.shutdownHook=n,this.shutdownFlag=r,this.strategy=i}pipe(){return Jt(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return Kt(()=>bt(this.unsafeSize(),()=>s))}unsafeSize(){return Re(this.shutdownFlag)?h():b(this.queue.length()-Pn(this.takers)+this.strategy.surplusSize())}get isEmpty(){return We(this.size,e=>e<=0)}get isFull(){return We(this.size,e=>e>=this.capacity())}get shutdown(){return St(de(e=>(w(this.shutdownFlag,Fe(!0)),w(yr(ml(this.takers),t=>ot(t,e.id()),!1,!1),ae(this.strategy.shutdown),Se(ct(this.shutdownHook,void 0)),Wt))))}get isShutdown(){return Ne(()=>Re(this.shutdownFlag))}get awaitShutdown(){return Ft(this.shutdownHook)}isActive(){return!Re(this.shutdownFlag)}unsafeOffer(e){if(Re(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=w(this.takers,Ln(Vr));n===Vr?t=!1:(fl(n,e),t=!0)}else t=!1;if(t)return!0;let n=this.queue.offer(e);return _l(this.strategy,this.queue,this.takers),n}offer(e){return Kt(()=>{if(Re(this.shutdownFlag))return s;let t;if(this.queue.length()===0){let n=w(this.takers,Ln(Vr));n===Vr?t=!1:(fl(n,e),t=!0)}else t=!1;if(t)return o(!0);let n=this.queue.offer(e);return _l(this.strategy,this.queue,this.takers),n?o(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return Kt(()=>{if(Re(this.shutdownFlag))return s;let t=ce(e),n=this.queue.length()===0?ce(hl(this.takers,t.length)):ze,[r,i]=w(t,ft(n.length));for(let e=0;e<n.length;e++){let t=n[e],i=r[e];fl(t,i)}if(i.length===0)return o(!0);let a=this.queue.offerAll(i);return _l(this.strategy,this.queue,this.takers),Me(a)?o(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return de(e=>{if(Re(this.shutdownFlag))return s;let t=this.queue.poll(Vr);if(t!==Vr)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),o(t);{let t=Ot(e.id());return w(Kt(()=>(w(this.takers,ln(t)),_l(this.strategy,this.queue,this.takers),Re(this.shutdownFlag)?s:Ft(t))),at(()=>Ne(()=>gl(this.takers,t))))}})}get takeAll(){return Kt(()=>Re(this.shutdownFlag)?s:Ne(()=>{let e=this.queue.pollUpTo(1/0);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),ke(e)}))}takeUpTo(e){return Kt(()=>Re(this.shutdownFlag)?s:Ne(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),ke(t)}))}takeBetween(e,t){return Kt(()=>Kc(this,e,t,tt()))}};const Kc=(e,t,n,r)=>n<t?o(r):w(al(e,n),Ht(i=>{let a=t-i.length;return a===1?w(il(e),We(e=>w(r,Zt(i),Ut(e)))):a>1?w(il(e),Ht(t=>Kc(e,a-1,n-i.length-1,w(r,Zt(i),Ut(t))))):o(w(r,Zt(i)))})),qc=e=>w(Ne(()=>Xr(e)),Ht(e=>Qc(el(e),ol()))),Jc=e=>w(Ne(()=>Xr(e)),Ht(e=>Qc(el(e),sl()))),Yc=e=>w(Ne(()=>Xr(e)),Ht(e=>Qc(el(e),cl()))),Xc=()=>w(Ne(()=>fn()),Ht(e=>Qc(el(e),sl()))),Zc=(e,t,n,r,i)=>new Gc(e,t,n,r,i),Qc=(e,t)=>w(Vt(),We(n=>Zc(e,fn(),n,_(!1),t)));var $c=class{mutable;[Bc]=Hc;constructor(e){this.mutable=e}poll(e){return Ln(this.mutable,e)}pollUpTo(e){return hn(this.mutable,e)}offerAll(e){return Wr(this.mutable,e)}offer(e){return ln(this.mutable,e)}capacity(){return Qn(this.mutable)}length(){return Pn(this.mutable)}};const el=e=>new $c(e),tl=e=>e.size,nl=e=>e.shutdown,rl=C(2,(e,t)=>e.offer(t)),il=e=>e.take,al=C(2,(e,t)=>e.takeUpTo(t)),ol=()=>new ll,sl=()=>new ul,cl=()=>new dl;var ll=class{[zc]=Vc;putters=fn();surplusSize(){return Pn(this.putters)}onCompleteTakersWithEmptyQueue(e){for(;!qr(this.putters)&&!qr(e);){let t=Ln(e,void 0),n=Ln(this.putters,void 0);n[2]&&fl(n[1],!0),fl(t,n[0])}}get shutdown(){return w(_t,Ht(e=>w(Ne(()=>ml(this.putters)),Ht(t=>yr(t,([t,n,r])=>r?w(ot(n,e),Wt):ge,!1,!1)))))}handleSurplus(e,t,n,r){return de(i=>{let a=Ot(i.id());return w(Kt(()=>(this.unsafeOffer(e,a),this.unsafeOnQueueEmptySpace(t,n),_l(this,t,n),Re(r)?s:Ft(a))),at(()=>Ne(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(e,t){let n=!0;for(;n&&(e.capacity()===1/0||e.length()<e.capacity());){let r=w(this.putters,Ln(Vr));if(r===Vr)n=!1;else{let n=e.offer(r[0]);n&&r[2]?fl(r[1],!0):n||pl(this.putters,w(ml(this.putters),xt(r))),_l(this,e,t)}}}unsafeOffer(e,t){let n=ce(e);for(let e=0;e<n.length;e++){let r=n[e];e===n.length-1?w(this.putters,ln([r,t,!0])):w(this.putters,ln([r,t,!1]))}}unsafeRemove(e){pl(this.putters,w(ml(this.putters),Yt(([,t])=>t!==e)))}},ul=class{[zc]=Vc;surplusSize(){return 0}get shutdown(){return ge}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return o(!1)}unsafeOnQueueEmptySpace(e,t){}},dl=class{[zc]=Vc;surplusSize(){return 0}get shutdown(){return ge}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return Ne(()=>(this.unsafeOffer(t,e),_l(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(Vr),i=e.offer(r.value)}}};const fl=(e,t)=>pt(e,o(t)),pl=(e,t)=>w(e,Wr(t)),ml=e=>w(e,hn(1/0)),hl=(e,t)=>w(e,hn(t)),gl=(e,t)=>{pl(e,w(ml(e),Yt(e=>t!==e)))},_l=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){let i=w(n,Ln(Vr));if(i!==Vr){let a=t.poll(Vr);a===Vr?pl(n,w(ml(n),xt(i))):(fl(i,a),e.unsafeOnQueueEmptySpace(t,n)),r=!0}else r=!1}r&&t.length()===0&&!qr(n)&&e.onCompleteTakersWithEmptyQueue(n)},vl=qc,yl=Jc,bl=Yc,xl=Xc,Sl=tl,Cl=nl,wl=rl,Tl=il,El=`Continue`,Dl=Symbol.for(`effect/ChannelChildExecutorDecision`),Ol={[Dl]:Dl},kl=e=>{let t=Object.create(Ol);return t._tag=El,t},Al=Symbol.for(`effect/ChannelContinuation`),jl={_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 Ml=class{onSuccess;onHalt;_tag=`ContinuationK`;[Al]=jl;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return xi(e)?this.onHalt(e.cause):this.onSuccess(e.value)}},Nl=class{finalizer;_tag=`ContinuationFinalizer`;[Al]=jl;constructor(e){this.finalizer=e}};const Pl=`PullAfterNext`,Fl=Symbol.for(`effect/ChannelUpstreamPullStrategy`),Il={_A:e=>e},Ll={[Fl]:Il},Rl=e=>{let t=Object.create(Ll);return t._tag=Pl,t.emitSeparator=e,t},zl=`BracketOut`,Bl=`Bridge`,Vl=`ConcatAll`,Hl=`Emit`,Ul=`Ensuring`,Wl=`Fail`,Gl=`Fold`,Kl=`FromEffect`,ql=`PipeTo`,Jl=`Read`,Yl=`Succeed`,Xl=`SucceedNow`,Zl=`Suspend`,Ql=Symbol.for(`effect/Channel`),$l={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},eu={[Ql]:$l,pipe(){return Jt(this,arguments)}},tu=e=>se(e,Ql)||Tn(e),nu=C(2,(e,t)=>{let n=Object.create(eu);return n._tag=zl,n.acquire=()=>e,n.finalizer=t,n}),ru=(e,t,n)=>{let r=Object.create(eu);return r._tag=Vl,r.combineInners=t,r.combineAll=n,r.onPull=()=>Rl(h()),r.onEmit=()=>kl,r.value=()=>e,r.k=S,r},iu=C(4,(e,t,n,r)=>{let i=Object.create(eu);return i._tag=Vl,i.combineInners=n,i.combineAll=r,i.onPull=()=>Rl(h()),i.onEmit=()=>kl,i.value=()=>e,i.k=t,i}),au=C(2,(e,t)=>{let n=Object.create(eu);return n._tag=Bl,n.input=t,n.channel=e,n}),ou=C(2,(e,t)=>{let n=Object.create(eu);return n._tag=Ul,n.channel=e,n.finalizer=t,n}),su=e=>cu(ni(e)),cu=e=>lu(()=>e),lu=e=>{let t=Object.create(eu);return t._tag=Wl,t.error=e,t},L=C(2,(e,t)=>{let n=Object.create(eu);return n._tag=Gl,n.channel=e,n.k=new Ml(t,cu),n}),R=e=>{let t=Object.create(eu);return t._tag=Kl,t.effect=()=>e,t},uu=C(2,(e,t)=>{let n=Object.create(eu);return n._tag=ql,n.left=()=>e,n.right=()=>t,n}),du=e=>fu({onInput:e.onInput,onFailure:t=>qe(Qr(t),{onLeft:e.onFailure,onRight:cu}),onDone:e.onDone}),fu=e=>{let t=Object.create(eu);return t._tag=Jl,t.more=e.onInput,t.done=new Ml(e.onDone,e.onFailure),t},pu=e=>gu(()=>e),mu=e=>{let t=Object.create(eu);return t._tag=Xl,t.terminal=e,t},hu=e=>{let t=Object.create(eu);return t._tag=Zl,t.channel=e,t},gu=e=>{let t=Object.create(eu);return t._tag=Yl,t.evaluate=e,t},_u=mu(void 0),z=e=>{let t=Object.create(eu);return t._tag=Hl,t.out=e,t},vu=`Done`,yu=`Emit`,bu=`FromEffect`,xu=`Read`,Su=Symbol.for(`effect/ChannelState`),Cu={_E:e=>e,_R:e=>e},wu={[Su]:Cu},Tu=()=>{let e=Object.create(wu);return e._tag=vu,e},Eu=()=>{let e=Object.create(wu);return e._tag=yu,e},Du=e=>{let t=Object.create(wu);return t._tag=bu,t.effect=e,t},Ou=(e,t,n,r)=>{let i=Object.create(wu);return i._tag=xu,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},ku=e=>e._tag===bu,Au=e=>ku(e)?e.effect:A,ju=e=>ku(e)?kn(e.effect):void 0,Mu=`PullFromChild`,Nu=`PullFromUpstream`,Pu=`DrainChildExecutors`,Fu=`Emit`;var Iu=class{childExecutor;parentSubexecutor;onEmit;_tag=Mu;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 qn(O(t),O(n),(e,t)=>w(e,mi(t)));if(t!==void 0)return t;if(n!==void 0)return n}enqueuePullFromChild(e){return this}},Lu=class e{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=Nu;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 qn(e,O(t),(e,t)=>mi(e,t));if(e!==void 0)return e;if(t!==void 0)return O(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)}},Ru=class e{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Pu;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 qn(e,O(t),(e,t)=>mi(e,t));if(e!==void 0)return e;if(t!==void 0)return O(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}},zu=class{value;next;_tag=Fu;constructor(e,t){this.value=e,this.next=t}close(e){return this.next.close(e)}enqueuePullFromChild(e){return this}};const Bu=Symbol.for(`effect/ChannelUpstreamPullRequest`),Vu={_A:e=>e},Hu={[Bu]:Vu},Uu=e=>{let t=Object.create(Hu);return t._tag=`Pulled`,t.value=e,t},Wu=e=>{let t=Object.create(Hu);return t._tag=`NoUpstream`,t.activeDownstreamCount=e,t};var Gu=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=Tu();else switch(Tn(this._currentChannel)&&(this._currentChannel=R(this._currentChannel)),this._currentChannel._tag){case zl:t=this.runBracketOut(this._currentChannel);break;case Bl:{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=()=>D(e.awaitRead(),()=>j(()=>{let t=n.run();switch(t._tag){case vu:return fi(n.getDone(),{onFailure:t=>e.error(t),onSuccess:t=>e.done(t)});case yu:return D(e.emit(n.getEmit()),()=>r());case bu:return Zr(t.effect,{onFailure:t=>e.error(t),onSuccess:()=>r()});case xu:return Ju(t,()=>r(),t=>e.error(t))}}));t=Du(D(Hr(an(r())),e=>Nr(()=>this.addFinalizer(t=>D(rn(e),()=>j(()=>{let e=this.restorePipe(t,n);return e===void 0?A:e}))))))}break}case Vl:{let t=new e(this._currentChannel.value(),this._providedEnv,e=>Nr(()=>{let t=this._closeLastSubstream===void 0?A:this._closeLastSubstream;this._closeLastSubstream=w(t,k(e))}));t._input=this._input;let n=this._currentChannel;this._activeSubexecutor=new Lu(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 Hl:this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor===void 0?_u:void 0,t=Eu();break;case Ul:this.runEnsuring(this._currentChannel);break;case Wl:t=this.doneHalt(this._currentChannel.error());break;case Gl:this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break;case Kl:{let e=this._providedEnv===void 0?this._currentChannel.effect():w(this._currentChannel.effect(),Rn(this._providedEnv));t=Du(Zr(e,{onFailure:e=>{let t=this.doneHalt(e);return t!==void 0&&ku(t)?t.effect:A},onSuccess:e=>{let t=this.doneSucceed(e);return t!==void 0&&ku(t)?t.effect:A}}));break}case ql:{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?A: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(()=>Nr(()=>{this._providedEnv=e}));break}case Jl:{let e=this._currentChannel;t=Ou(this._input,S,t=>{try{this._currentChannel=e.more(t)}catch(t){this._currentChannel=e.done.onExit(bi(t))}},t=>{let n=t=>e.done.onExit(t);this._currentChannel=n(t)});break}case Yl:t=this.doneSucceed(this._currentChannel.evaluate());break;case Xl:t=this.doneSucceed(this._currentChannel.terminal);break;case Zl:this._currentChannel=this._currentChannel.channel();break}}catch(e){this._currentChannel=cu(si(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?A:qu(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?A:n.close(e)}close(e){let t,n=this._inProgressFinalizer;n!==void 0&&(t=w(n,cr(Nr(()=>this.clearInProgressFinalizer()))));let r,i=this.popAllFinalizers(e);i!==void 0&&(r=w(i,cr(Nr(()=>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 w(O(Ku(a)),Cr(O(Ku(t))),Cr(O(Ku(r))),E(([[e,t],n])=>w(e,mi(t),mi(n))),br,D(e=>j(()=>e)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=pi(e),this._currentChannel=void 0,Tu();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=pi(e),this._currentChannel=void 0,Tu();let r=qu(n.map(e=>e.finalizer),pi(e));this.storeInProgressFinalizer(r);let i=w(r,cr(Nr(()=>this.clearInProgressFinalizer())),br,D(()=>Nr(()=>this.doneSucceed(e))));return Du(i)}doneHalt(e){if(this._doneStack.length===0)return this._done=ui(e),this._currentChannel=void 0,Tu();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=cu(si(e))}return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=ui(e),this._currentChannel=void 0,Tu();let r=qu(n.map(e=>e.finalizer),ui(e));this.storeInProgressFinalizer(r);let i=w(r,cr(Nr(()=>this.clearInProgressFinalizer())),br,D(()=>Nr(()=>this.doneHalt(e))));return Du(i)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,Tu()}runBracketOut(e){let t=br(Zr(this.provide(e.acquire()),{onFailure:e=>Nr(()=>{this._currentChannel=cu(e)}),onSuccess:t=>Nr(()=>{this.addFinalizer(n=>this.provide(e.finalizer(t,n))),this._currentChannel=z(t)})}));return Du(t)}provide(e){return this._providedEnv===void 0?e:w(e,Rn(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new Nl(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case Mu:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case Nu:return this.pullFromUpstream(e);case Pu:return this.drainChildExecutors(e);case Fu:return this._emitted=e.value,this._activeSubexecutor=e.next,Eu()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=fi(e,{onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)});return this._activeSubexecutor=void 0,t===void 0?A:Au(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>w(t,sn(t=>w(Nr(()=>t(e)),D(e=>e===void 0?A:e)),{discard:!0})));let n=w(e,fi({onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)}));return this._activeSubexecutor=void 0,n}applyUpstreamPullStrategy(e,t,n){switch(n._tag){case Pl:{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 Ou(e,S,i=>{let a=n(i);switch(a._tag){case El:break;case`Close`:this.finishWithDoneValue(e,t,a.value);break;case`Yield`:{let e=t.enqueuePullFromChild(r);this.replaceSubexecutor(e);break}}this._activeSubexecutor=new zu(i,this._activeSubexecutor)},fi({onFailure:n=>{let r=this.handleSubexecutorFailure(e,t,n);return r===void 0?void 0:ju(r)},onSuccess:n=>{this.finishWithDoneValue(e,t,n)}}))}finishWithDoneValue(e,t,n){let r=t;switch(r._tag){case Nu:{let t=new Lu(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(pi(n)),this.replaceSubexecutor(t);break}case Pu:{let t=new Ru(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(pi(n)),this.replaceSubexecutor(t);break}default:break}}handleSubexecutorFailure(e,t,n){return this.finishSubexecutorWithCloseEffect(ui(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 Lu(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 Iu(t.childExecutor,n,t.onEmit))}performPullFromUpstream(t){return Ou(t.upstreamExecutor,e=>{let t=this._closeLastSubstream===void 0?A:this._closeLastSubstream;return this._closeLastSubstream=void 0,w(this._executeCloseLastSubstream(t),k(e))},n=>{if(this._closeLastSubstream!==void 0){let r=this._closeLastSubstream;return this._closeLastSubstream=void 0,w(this._executeCloseLastSubstream(r),E(()=>{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(Uu(n)));this._activeSubexecutor=new Iu(r,new Lu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),yt(i)&&(this._activeSubexecutor=new zu(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(Uu(n)));this._activeSubexecutor=new Iu(r,new Lu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),yt(i)&&(this._activeSubexecutor=new zu(i.value,this._activeSubexecutor))},e=>{if(t.activeChildExecutors.some(e=>e!==void 0)){let e=new Ru(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,w(this._executeCloseLastSubstream(t),E(()=>this.replaceSubexecutor(e)))}this.replaceSubexecutor(e);return}let n=this._closeLastSubstream,r=this.finishSubexecutorWithCloseEffect(w(e,gi(e=>t.combineWithChildResult(t.lastDone,e))),()=>n,e=>t.upstreamExecutor.close(e));return r===void 0?void 0:ju(r)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let t=this._closeLastSubstream;return t!==void 0&&this.addFinalizer(()=>M(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(Wu(n.reduce((e,t)=>t===void 0?e:e+1,0))));return this.replaceSubexecutor(new Ru(e.upstreamExecutor,e.lastDone,r,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),yt(t)?(this._emitted=t.value,Eu()):void 0}let r=new Ru(e.upstreamExecutor,e.lastDone,n,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new Iu(t.childExecutor,r,t.onEmit))}};const Ku=e=>e===void 0?A:e,qu=(e,t)=>w(sn(e,e=>O(e(t))),E(e=>w(vi(e),Pe(()=>yi))),D(e=>j(()=>e))),Ju=(e,t,n)=>{let r=[e],i=()=>{let e=r.pop();if(e===void 0||e.upstream===void 0)return Dr(`Unexpected end of input for channel execution`);let a=e.upstream.run();switch(a._tag){case yu:{let a=e.onEmit(e.upstream.getEmit());return r.length===0?a===void 0?j(t):w(a,Zr({onFailure:n,onSuccess:t})):a===void 0?j(()=>i()):w(a,Zr({onFailure:n,onSuccess:()=>i()}))}case vu:{let a=e.onDone(e.upstream.getDone());return r.length===0?a===void 0?j(t):w(a,Zr({onFailure:n,onSuccess:t})):a===void 0?j(()=>i()):w(a,Zr({onFailure:n,onSuccess:()=>i()}))}case bu:return r.push(e),w(e.onEffect(a.effect),Lr(t=>j(()=>{let n=e.onDone(ui(t));return n===void 0?A:n})),Zr({onFailure:n,onSuccess:()=>i()}));case xu:return r.push(e),r.push(a),j(()=>i())}};return i()},Yu=C(2,(e,t)=>{let n=(t,n,r)=>dr(Nr(()=>new Gu(e,void 0,S)),e=>j(()=>Xu(e.run(),e).pipe(mr(t),k(T(t)),ur(T(n)))),(e,t)=>{let n=e.close(t);return n===void 0?A:Xn(n,e=>Mr(r,zr(e)))});return Rr(e=>Jn([Fr(t,Zn),hr(),hr()]).pipe(D(([r,i,a])=>e(n(i,a,r)).pipe(Fn(t),D(n=>t.addFinalizer(e=>{let t=xi(e)?$r(e.cause):void 0;return on(i).pipe(D(e=>e?En(a,void 0).pipe(k(Wn(n)),k(jn(n))):En(a,void 0).pipe(k(t&&mt(t)>0?rr(n,vt(t)):rn(n)),k(jn(n)))))}).pipe(k(e(T(i)))))))))}),Xu=(e,t)=>{let n=e;switch(n._tag){case bu:return w(n.effect,D(()=>Xu(t.run(),t)));case yu:return Xu(t.run(),t);case vu:return j(()=>t.getDone());case xu:return Ju(n,()=>Xu(t.run(),t),zr)}},Zu={[Symbol.for(`effect/ChannelMergeDecision`)]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},Qu=e=>{let t=Object.create(Zu);return t._tag=`Await`,t.f=e,t},$u=`BothRunning`,ed=`LeftDone`,td=`RightDone`,nd=Symbol.for(`effect/ChannelMergeState`),rd={[nd]:nd},id=(e,t)=>{let n=Object.create(rd);return n._tag=$u,n.left=e,n.right=t,n},ad=e=>{let t=Object.create(rd);return t._tag=ed,t.f=e,t},od=e=>{let t=Object.create(rd);return t._tag=td,t.f=e,t},sd=`BackPressure`,cd=`BufferSliding`,ld=Symbol.for(`effect/ChannelMergeStrategy`),ud={[ld]:ld},dd=e=>{let t=Object.create(ud);return t._tag=sd,t},fd=e=>{let t=Object.create(ud);return t._tag=cd,t},pd=C(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case sd:return t();case cd:return n()}}),md=`Empty`,hd=`Emit`,gd=`Error`,_d=`Done`,vd=e=>({_tag:md,notifyProducer:e}),yd=e=>({_tag:hd,notifyConsumers:e}),bd=e=>({_tag:gd,cause:e}),xd=e=>({_tag:_d,done:e});var Sd=class{ref;constructor(e){this.ref=e}awaitRead(){return Gr(Kn(this.ref,e=>e._tag===md?[T(e.notifyProducer),e]:[A,e]))}get close(){return Jr(e=>this.error(ci(e)))}done(e){return Gr(Kn(this.ref,t=>{switch(t._tag){case md:return[T(t.notifyProducer),t];case hd:return[sn(t.notifyConsumers,t=>En(t,g(e)),{discard:!0}),xd(e)];case gd:return[gr,t];case _d:return[gr,t]}}))}emit(e){return D(hr(),t=>Gr(Kn(this.ref,n=>{switch(n._tag){case md:return[T(n.notifyProducer),n];case hd:{let r=n.notifyConsumers[0],i=n.notifyConsumers.slice(1);if(r!==void 0)return[En(r,x(e)),i.length===0?vd(t):yd(i)];throw Error(`Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues`)}case gd:return[gr,n];case _d:return[gr,n]}})))}error(e){return Gr(Kn(this.ref,t=>{switch(t._tag){case md:return[T(t.notifyProducer),t];case hd:return[sn(t.notifyConsumers,t=>_r(t,e),{discard:!0}),bd(e)];case gd:return[gr,t];case _d:return[gr,t]}}))}get take(){return this.takeWith(e=>ui(ei(e,g)),e=>pi(e),e=>hi(x(e)))}takeWith(e,t,n){return D(hr(),r=>Gr(Kn(this.ref,i=>{switch(i._tag){case md:return[k(En(i.notifyProducer,void 0),Mn(T(r),{onFailure:e,onSuccess:qe({onLeft:n,onRight:t})})),yd([r])];case hd:return[Mn(T(r),{onFailure:e,onSuccess:qe({onLeft:n,onRight:t})}),yd([...i.notifyConsumers,r])];case gd:return[M(e(i.cause)),i];case _d:return[M(n(i.done)),i]}})))}};const Cd=()=>w(hr(),D(e=>sr(vd(e))),E(e=>new Sd(e))),wd=C(2,(e,t)=>iu(e,t,()=>void 0,()=>void 0)),Td=e=>{let t=fu({onInput:()=>t,onFailure:cu,onDone:pu});return uu(e,t)},Ed=C(2,(e,t)=>ou(e,()=>t)),Dd=e=>L(e,S),Od=e=>Vd(e.takeWith(cu,t=>L(z(t),()=>Od(e)),pu)),kd=C(2,(e,t)=>L(e,e=>gu(()=>t(e)))),Ad=C(2,(e,t)=>{let n=du({onInput:e=>L(z(t(e)),()=>n),onFailure:su,onDone:mu});return uu(e,n)}),jd=C(2,(e,t)=>{let n=fu({onInput:e=>w(R(t(e)),L(z),L(()=>n)),onFailure:cu,onDone:mu});return uu(e,n)}),Md=e=>t=>Nd(e)(t,ht),Nd=({bufferSize:e=16,concurrency:t,mergeStrategy:n=dd()})=>(r,i)=>Ud(a=>un(function*(){let o=t===`unbounded`?2**53-1:t,s=yield*Cd(),c=Od(s),l=yield*vl(e);yield*Mr(a,Cl(l));let u=yield*xl();yield*Mr(a,Cl(u));let d=yield*sr(h()),f=yield*hr(),p=(yield*Dn(o)).withPermits,m=yield*zd(uu(c,r),a);function _(e){return e.pipe(D(qe({onLeft:e=>M(b(e)),onRight:e=>wr(wl(l,M(x(e))),h())})),Cn({until:e=>yt(e)}),D(e=>Yr(d,y({onNone:()=>b(e.value),onSome:t=>b(i(t,e.value))}))),Lr(e=>li(e)?zr(e):wl(l,zr(e)).pipe(k(En(f,void 0)),Pr)))}yield*m.pipe(Zr({onFailure:e=>wl(l,zr(e)).pipe(k(M(!1))),onSuccess:qe({onLeft:e=>vn(an(T(f)),an(p(o)(A)),{onSelfDone:(e,t)=>wr(rn(t),!1),onOtherDone:(t,n)=>k(rn(n),lr(d).pipe(D(y({onNone:()=>wl(l,M(g(e))),onSome:t=>wl(l,M(g(i(t,e))))})),wr(!1)))}),onRight:e=>pd(n,{onBackPressure:()=>un(function*(){let t=yield*hr(),n=nn(t=>zd(uu(c,e),t).pipe(D(e=>Bn(O(_(e)),O(an(T(f))))),D(S)));return yield*En(t,void 0).pipe(k(n),p(1),Fn(a)),yield*T(t),!(yield*on(f))}),onBufferSliding:()=>un(function*(){let t=yield*hr(),n=yield*hr(),r=yield*Sl(u);yield*Tl(u).pipe(D(e=>En(e,void 0)),or(()=>r>=o)),yield*wl(u,t);let i=nn(n=>zd(uu(c,e),n).pipe(D(e=>O(_(e)).pipe(Bn(O(an(T(f)))),Bn(O(an(T(t)))))),D(S)));return yield*En(n,void 0).pipe(k(i),p(1),Fn(a)),yield*T(n),!(yield*on(f))})})})}),Cn({while:e=>e}),Fn(a));let v=w(Tl(l),Gr,Mn({onFailure:cu,onSuccess:qe({onLeft:mu,onRight:e=>L(z(e),()=>v)})}),Vd);return au(v,s)})),Pd=C(3,(e,t,n)=>Md(n)(Ad(e,t))),Fd=C(2,(e,t)=>{function n(n){return un(function*(){let r=yield*Cd(),i=Od(r),a=yield*zd(uu(i,e),n),o=yield*zd(uu(i,t.other),n);function s(e,t,r){return(i,a,o)=>{function s(e){let n=e;return n._tag===`Done`?M(R(k(rn(t),n.effect))):E(Wn(t),fi({onFailure:e=>R(n.f(ui(e))),onSuccess:qe({onLeft:e=>R(n.f(pi(e))),onRight:e=>qd(z(e),c(o(n.f)))})}))}return fi(e,{onFailure:e=>s(i(ui(e))),onSuccess:qe({onLeft:e=>s(i(pi(e))),onRight:e=>M(L(z(e),()=>L(R(Fn(an(r),n)),e=>c(a(e,t)))))})})}}function c(e){switch(e._tag){case $u:{let n=an(Ir(e.left)),r=an(Ir(e.right));return Vd(vn(n,r,{onSelfDone:(n,r)=>k(rn(r),s(n,e.right,a)(t.onSelfDone,id,e=>ad(e))),onOtherDone:(n,r)=>k(rn(r),s(n,e.left,o)(t.onOtherDone,(e,t)=>id(t,e),e=>od(e)))}))}case ed:return Vd(E(O(o),fi({onFailure:t=>R(e.f(ui(t))),onSuccess:qe({onLeft:t=>R(e.f(pi(t))),onRight:t=>L(z(t),()=>c(ad(e.f)))})})));case td:return Vd(E(O(a),fi({onFailure:t=>R(e.f(ui(t))),onSuccess:qe({onLeft:t=>R(e.f(pi(t))),onRight:t=>L(z(t),()=>c(od(e.f)))})})))}}return R(kr(e=>{let t=kr(t=>(t.transferChildren(e.scope()),A));return qn(an(a).pipe(cr(t),Fn(n)),an(o).pipe(cr(t),Fn(n)),(e,t)=>id(e,t))})).pipe(L(c),au(r))})}return Ud(n)}),Id=e=>Un(t=>Yu(e,t)),Ld=e=>Vd(Rr(t=>E($n(),n=>nu(Xn(t(Tr(e,n)),e=>Yn(n,ui(e))),(e,t)=>Yn(n,t))))),Rd=e=>Hd(E(Vn,t=>L(R(e(t)),z))),zd=C(2,(e,t)=>Cr(Nr(()=>new Gu(e,void 0,S)),Hn()).pipe(pr(([e,n])=>fr(t,t=>{let r=e.close(t);return r===void 0?A:Rn(r,n)})),br,E(([e])=>j(()=>Bd(e.run(),e))))),Bd=(e,t)=>{let n=e;switch(n._tag){case vu:return fi(t.getDone(),{onFailure:zr,onSuccess:e=>M(g(e))});case yu:return M(x(t.getEmit()));case bu:return w(n.effect,D(()=>Bd(t.run(),t)));case xu:return Ju(n,()=>Bd(t.run(),t),e=>zr(e))}},Vd=e=>Dd(R(e)),Hd=e=>ru(Ld(e),(e,t)=>e,(e,t)=>e),Ud=e=>ru(Rd(e),(e,t)=>e,(e,t)=>e),Wd=e=>Gd(0,e.length,e),Gd=(e,t,n)=>e===t?_u:w(z(w(n,m(e))),L(()=>Gd(e+1,t,n))),Kd=C(e=>tu(e[1]),(e,t,n)=>n?.concurrent?Fd(e,{other:t,onSelfDone:e=>Qu(t=>j(()=>_i(e,t))),onOtherDone:e=>Qu(t=>j(()=>_i(t,e)))}):L(e,e=>kd(t,t=>[e,t]))),qd=C(e=>tu(e[1]),(e,t,n)=>n?.concurrent?kd(Kd(e,t,{concurrent:!0}),e=>e[1]):L(e,()=>t)),Jd=Symbol.for(`effect/Sink`),Yd={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};var Xd=class{channel;[Jd]=Yd;constructor(e){this.channel=e}pipe(){return Jt(this,arguments)}};const Zd=e=>{let t=fu({onInput:n=>w(R(sn(n,t=>e(t),{discard:!0})),L(()=>t)),onFailure:cu,onDone:()=>_u});return new Xd(t)},Qd=e=>new Xd(R(e)),$d=e=>Tn(e)?$d(Qd(e)):e.channel,ef=e=>new Xd(Hd(e.pipe(E(e=>$d(e))))),tf=yn,nf=e=>Object.assign(e,{chunk(e){return this(M(e))},die(e){return this(ir(e))},dieMessage(e){return this(Dr(e))},done(e){return this(j(()=>Si(e,{onFailure:b,onSuccess:ve})))},end(){return this(Gn(h()))},fail(e){return this(Gn(b(e)))},fromEffect(e){return this(gn(e,{onFailure:b,onSuccess:ve}))},fromEffectChunk(e){return this(w(e,bn(b)))},halt(e){return this(zr(w(e,ei(b))))},single(e){return this(M(ve(e)))}}),rf=Symbol.for(`effect/Take`),af={_A:e=>e,_E:e=>e};var of=class{exit;[rf]=af;constructor(e){this.exit=e}pipe(){return Jt(this,arguments)}};const sf=e=>new of(pi(e)),cf=e=>j(()=>e.exit),lf=new of(hi(h())),uf=e=>new of(ui(w(e,ei(b)))),df=e=>Mn(e,{onFailure:e=>y(ai(e),{onNone:()=>lf,onSome:uf}),onSuccess:sf}),ff=C(2,(e,{onEnd:t,onFailure:n,onSuccess:r})=>fi(e.exit,{onFailure:e=>y(ai(e),{onNone:t,onSome:n}),onSuccess:r})),pf=()=>Gn(h()),mf=Symbol.for(`effect/Stream`),hf={_R:e=>e,_E:e=>e,_A:e=>e};var gf=class{channel;[mf]=hf;constructor(e){this.channel=e}pipe(){return Jt(this,arguments)}};const _f=e=>se(e,mf)||Tn(e),vf=e=>{if(e===`unbounded`)return xl();if(typeof e==`number`||e===void 0)return vl(e??16);switch(e.strategy){case`dropping`:return yl(e.bufferSize??16);case`sliding`:return bl(e.bufferSize??16);default:return vl(e.bufferSize??16)}},yf=(e,t)=>w(jr(vf(t),e=>Cl(e)),D(t=>w(Hn(),D(n=>w(e(nf(e=>w(df(e),D(e=>wl(t,e)),Pr,tf(n)).then(e=>{if(xi(e)&&!li(e.cause))throw oi(e.cause)}))),k(sr(!1)),D(e=>w(lr(e),E(n=>n?pf():w(Tl(t),D(cf),zn(()=>w(Br(e,!0),k(Cl(t)))))))))))),Pf,wf(Mf)),bf=C(2,(e,t)=>{if(t.strategy===`dropping`)return xf(e,t.capacity);if(t.strategy===`sliding`)return Sf(e,t.capacity);let n=If(e,t);return new gf(Hd(E(n,e=>{let t=w(R(Tl(e)),L(ff({onEnd:()=>_u,onFailure:cu,onSuccess:e=>w(z(e),L(()=>t))})));return t})))}),xf=C(2,(e,t)=>{let n=jr(yl(t),e=>Cl(e));return new gf(Cf(n,kf(e)))}),Sf=C(2,(e,t)=>{let n=jr(bl(t),e=>Cl(e));return new gf(Cf(n,kf(e)))}),Cf=(e,t)=>{let n=(e,t)=>{let r=n=>w(lr(t),pr(T),k(hr()),D(r=>w(wl(e,[n,r]),k(Br(t,r)),k(T(r)))),Pr,R);return fu({onInput:r=>w(hr(),D(n=>w(wl(e,[sf(r),n]),D(e=>w(Br(t,n),or(()=>e))))),Pr,R,L(()=>n(e,t))),onFailure:e=>r(uf(e)),onDone:()=>r(lf)})},r=e=>{let t=w(R(Tl(e)),L(([e,n])=>qd(R(En(n,void 0)),ff(e,{onEnd:()=>_u,onFailure:cu,onSuccess:e=>w(z(e),L(()=>t))}))));return t};return Hd(w(e,D(e=>w(hr(),pr(e=>En(e,void 0)),D(i=>w(sr(i),D(r=>w(t,uu(n(e,r)),Id,pn)),wr(r(e))))))))},wf=C(e=>_f(e[0]),(e,t,n)=>{let i=n?.bufferSize??16;return n?.switch?Tf(n?.concurrency,()=>Ef(e,1,i,t),n=>Ef(e,n,i,t)):Tf(n?.concurrency,()=>new gf(wd(kf(e),e=>w(e,c(e=>kf(t(e))),r(_u,(e,t)=>w(e,qd(t)))))),r=>new gf(w(kf(e),wd(Wd),Pd(e=>kf(t(e)),n))))}),Tf=(e,t,n)=>{switch(e){case void 0:return t();case`unbounded`:return n(2**53-1);default:return e>1?n(e):t()}},Ef=C(4,(e,t,n,r)=>new gf(w(kf(e),wd(Wd),Pd(e=>kf(r(e)),{concurrency:t,mergeStrategy:fd(),bufferSize:n})))),Df=C(e=>_f(e[0]),(e,t)=>wf(e,S,t)),Of=e=>new gf(e),kf=e=>{if(`channel`in e)return e.channel;if(Tn(e))return kf(Af(e));throw TypeError(`Expected a Stream.`)},Af=e=>w(e,bn(b),jf),jf=e=>new gf(Vd(wn(e,{onFailure:y({onNone:()=>_u,onSome:su}),onSuccess:e=>z(ve(e))}))),Mf=e=>Lf(e,e=>w(E(e,t=>b([t,e])),vr(y({onNone:()=>M(h()),onSome:Gn})))),Nf=C(2,(e,t)=>{let n=fu({onInput:e=>L(z(sf(e)),()=>n),onFailure:e=>z(uf(e)),onDone:()=>z(lf)});return w(uu(kf(e),n),jd(e=>wl(t,e)),Td,Id,Pr)}),Pf=e=>new gf(Ed(Ld(w(e,E(ve))),A)),Ff=e=>new gf(hu(()=>kf(e()))),If=C(e=>_f(e[0]),(e,t)=>pr(jr(t?.strategy===`unbounded`?xl():t?.strategy===`dropping`?yl(t.capacity??2):t?.strategy===`sliding`?bl(t.capacity??2):vl(t?.capacity??2),e=>Cl(e)),t=>pn(Nf(e,t)))),Lf=(e,t)=>Ff(()=>{let n=e=>Vd(E(t(e),y({onNone:()=>_u,onSome:([e,t])=>L(z(e),()=>n(t))})));return new gf(n(e))}),Rf=e=>Df(Af(e)),zf=e=>Df(Pf(e)),Bf=L,Vf=_u,Hf=z,Uf=Li,Wf=zi,Gf=Bi,Kf=Vi,qf=Hi,Jf=Ui,Yf=Gi,Xf=Ki,Zf=Ji,Qf=Zi,$f=ta,ep=na,tp=aa,np=oa,rp=sa,ip=fa;Xe(`effect/DateTime/CurrentTimeZone`)();const ap=ya,op=xa;var B=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},sp=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},cp=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},V=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},lp=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},up=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},H=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},dp=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}};const fp=Symbol.for(`effect/Schema/ParseErrorTypeId`);var pp=class extends Di(`ParseError`){[fp]=fp;get message(){return this.toString()}toString(){return Xp.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[Oe](){return this.toJSON()}};const mp=e=>new pp({issue:e}),U=x,hp=g,gp=Ee,_p=tn,vp=v,yp=C(2,(e,t)=>vp(e)?qe(e,{onLeft:g,onRight:t}):D(e,t)),bp=C(2,(e,t)=>vp(e)?le(e,t):E(e,t)),xp=C(2,(e,t)=>vp(e)?oe(e,t):bn(e,t)),Sp=C(2,(e,t)=>vp(e)?Mt(e,{onLeft:t.onFailure,onRight:t.onSuccess}):gn(e,t)),Cp=C(2,(e,t)=>vp(e)?qe(e,{onLeft:t,onRight:x}):vr(e,t)),wp=(e,t)=>t===void 0||ut(t)?e:e===void 0?t:{...e,...t},Tp=(e,t,n)=>{let r=W(e,t);return(e,t)=>r(e,wp(n,t))},Ep=(e,t,n)=>{let r=Tp(e,t,n);return(e,t)=>Be(r(e,t),mp)},Dp=(e,t,n)=>{let r=Tp(e,t,n);return(e,t)=>ye(r(e,t))},Op=(e,t,n)=>{let r=W(e,t);return(e,t)=>r(e,{...wp(n,t),isEffectAllowed:!0})},kp=(e,t)=>Ep(e.ast,!0,t),Ap=(e,t)=>Dp(e.ast,!0,t),jp=(e,t)=>Op(e.ast,!0,t),Mp=(e,t)=>Op(e.ast,!1,t),Np=kp,Pp=(e,t)=>Ep(F(e.ast),!0,t),Fp=(e,t)=>{let n=W(F(e.ast),!0);return(e,r)=>Ue(n(e,{exact:!0,...wp(t,r)}))},Ip=zt(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),Lp=zt(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),W=(e,t)=>{let n=t?Ip:Lp,r=n.get(e);if(r)return r;let i=Bp(e,t),a=Ro(e),o=yt(a)?(e,t)=>i(e,wp(t,a.value)):i,s=zo(e),c=t&&yt(s)?(t,n)=>Gp(Cp(o(t,n),s.value),e,t,n):o;return n.set(e,c),c},Rp=e=>l(Fo(e)),zp=e=>l(Io(e)),Bp=(n,r)=>{switch(n._tag){case`Refinement`:if(r){let e=W(n.from,!0);return(t,r)=>{r??=Ns;let i=r?.errors===`all`,a=yp(Cp(e(t,r),e=>{let a=new lp(n,t,`From`,e);return i&&Ho(n)&&am(e)?y(n.filter(t,r,n),{onNone:()=>g(a),onSome:e=>g(new V(n,t,[a,new lp(n,t,`Predicate`,e)]))}):g(a)}),e=>y(n.filter(e,r,n),{onNone:()=>x(e),onSome:e=>g(new lp(n,t,`Predicate`,e))}));return Gp(a,n,t,r)}}else{let e=W(F(n),!0),t=W(Wp(n.from),!1);return(r,i)=>Gp(yp(e(r,i),e=>t(e,i)),n,r,i)}case`Transformation`:{let e=Jp(n.transformation,r),t=r?W(n.from,!0):W(n.to,!1),i=r?W(n.to,!0):W(n.from,!1);return(a,o)=>Gp(yp(xp(t(a,o),e=>new up(n,a,r?`Encoded`:`Type`,e)),t=>yp(xp(e(t,o??Ns,n,a),e=>new up(n,a,`Transformation`,e)),e=>xp(i(e,o),e=>new up(n,a,r?`Type`:`Encoded`,e)))),n,a,o)}case`Declaration`:{let e=r?n.decodeUnknown(...n.typeParameters):n.encodeUnknown(...n.typeParameters);return(t,r)=>Gp(e(t,r??Ns,n),n,t,r)}case`Literal`:return Vp(n,e=>e===n.literal);case`UniqueSymbol`:return Vp(n,e=>e===n.symbol);case`UndefinedKeyword`:return Vp(n,Tt);case`NeverKeyword`:return Vp(n,Ce);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return x;case`StringKeyword`:return Vp(n,gt);case`NumberKeyword`:return Vp(n,ut);case`BooleanKeyword`:return Vp(n,re);case`BigIntKeyword`:return Vp(n,kt);case`SymbolKeyword`:return Vp(n,Qe);case`ObjectKeyword`:return Vp(n,Rt);case`Enums`:return Vp(n,e=>n.enums.some(([t,n])=>n===e));case`TemplateLiteral`:{let e=Ks(n);return Vp(n,t=>gt(t)&&e.test(t))}case`TupleType`:{let e=n.elements.map(e=>W(e.type,r)),i=n.rest.map(e=>W(e.type,r)),a=n.elements.filter(e=>!e.isOptional);n.rest.length>0&&(a=a.concat(n.rest.slice(1)));let o=a.length,s=n.elements.length>0?n.elements.map((e,t)=>t).join(` | `):`never`,c=Rp(n),l=zp(n);return(r,u)=>{if(!Ye(r))return g(new H(n,r));let d=u?.errors===`all`,f=[],p=0,m=[],h=r.length;for(let e=h;e<=o-1;e++){let t=new B(e,r,new cp(a[e-h]));if(d){f.push([p++,t]);continue}else return g(new V(n,r,t,m))}if(n.rest.length===0)for(let e=n.elements.length;e<=h-1;e++){let t=new B(e,r,new sp(r[e],`is unexpected, expected: ${s}`));if(d){f.push([p++,t]);continue}else return g(new V(n,r,t,m))}let _=0,v;for(;_<e.length;_++)if(h<_+1){if(n.elements[_].isOptional)continue}else{let t=e[_],i=t(r[_],u);if(vp(i)){if(Le(i)){let e=new B(_,r,i.left);if(d){f.push([p++,e]);continue}else return g(new V(n,r,e,qp(m)))}m.push([p++,i.right])}else{let e=p++,t=_;v||=[],v.push(({es:a,output:o})=>D(xr(i),i=>{if(Le(i)){let s=new B(t,r,i.left);return d?(a.push([e,s]),A):g(new V(n,r,s,qp(o)))}return o.push([e,i.right]),A}))}}if(t(i)){let[e,...t]=i;for(;_<h-t.length;_++){let t=e(r[_],u);if(vp(t))if(Le(t)){let e=new B(_,r,t.left);if(d){f.push([p++,e]);continue}else return g(new V(n,r,e,qp(m)))}else m.push([p++,t.right]);else{let e=p++,i=_;v||=[],v.push(({es:a,output:o})=>D(xr(t),t=>{if(Le(t)){let s=new B(i,r,t.left);return d?(a.push([e,s]),A):g(new V(n,r,s,qp(o)))}else return o.push([e,t.right]),A}))}}for(let e=0;e<t.length;e++){let i=_+e;if(!(h<i+1)){let a=t[e](r[i],u);if(vp(a)){if(Le(a)){let e=new B(i,r,a.left);if(d){f.push([p++,e]);continue}else return g(new V(n,r,e,qp(m)))}m.push([p++,a.right])}else{let e=p++;v||=[],v.push(({es:t,output:o})=>D(xr(a),a=>{if(Le(a)){let s=new B(i,r,a.left);return d?(t.push([e,s]),A):g(new V(n,r,s,qp(o)))}return o.push([e,a.right]),A}))}}}}let ee=({es:e,output:t})=>Te(e)?g(new V(n,r,qp(e),qp(t))):x(qp(t));if(v&&v.length>0){let e=v;return j(()=>{let t={es:en(f),output:en(m)};return D(sn(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ee(t))})}return ee({output:m,es:f})}}case`TypeLiteral`:{if(n.propertySignatures.length===0&&n.indexSignatures.length===0)return Vp(n,e);let t=[],i={},a=[];for(let e of n.propertySignatures)t.push([W(e.type,r),e]),i[e.name]=null,a.push(e.name);let o=n.indexSignatures.map(e=>[W(e.parameter,r),W(e.type,r),e.parameter]),s=Ts.make(n.indexSignatures.map(e=>e.parameter).concat(a.map(e=>Qe(e)?new Xo(e):new Jo(e)))),c=W(s,r),l=Rp(n),u=zp(n);return(e,r)=>{if(!Et(e))return g(new H(n,e));let d=r?.errors===`all`,f=[],p=0,m=r?.onExcessProperty===`error`,h=r?.onExcessProperty===`preserve`,_={},v;if(m||h){v=Reflect.ownKeys(e);for(let t of v){let i=c(t,r);if(vp(i)&&Le(i))if(m){let r=new B(t,e,new sp(e[t],`is unexpected, expected: ${String(s)}`));if(d){f.push([p++,r]);continue}else return g(new V(n,e,r,_))}else _[t]=e[t]}}let ee,te=r?.exact===!0;for(let i=0;i<t.length;i++){let a=t[i][1],o=a.name,s=Object.prototype.hasOwnProperty.call(e,o);if(!s){if(a.isOptional)continue;if(te){let t=new B(o,e,new cp(a));if(d){f.push([p++,t]);continue}else return g(new V(n,e,t,_))}}let c=t[i][0],l=c(e[o],r);if(vp(l)){if(Le(l)){let t=new B(o,e,s?l.left:new cp(a));if(d){f.push([p++,t]);continue}else return g(new V(n,e,t,_))}_[o]=l.right}else{let t=p++,r=o;ee||=[],ee.push(({es:i,output:o})=>D(xr(l),c=>{if(Le(c)){let l=new B(r,e,s?c.left:new cp(a));return d?(i.push([t,l]),A):g(new V(n,e,l,o))}return o[r]=c.right,A}))}}for(let t=0;t<o.length;t++){let a=o[t],s=a[0],c=a[1],l=Da(e,a[2]);for(let t of l){let a=s(t,r);if(vp(a)&&Ue(a)){let a=c(e[t],r);if(vp(a))if(Le(a)){let r=new B(t,e,a.left);if(d){f.push([p++,r]);continue}else return g(new V(n,e,r,_))}else Object.prototype.hasOwnProperty.call(i,t)||(_[t]=a.right);else{let r=p++,o=t;ee||=[],ee.push(({es:s,output:c})=>D(xr(a),a=>{if(Le(a)){let t=new B(o,e,a.left);return d?(s.push([r,t]),A):g(new V(n,e,t,c))}else return Object.prototype.hasOwnProperty.call(i,t)||(c[t]=a.right),A}))}}}}let ne=({es:t,output:i})=>{if(Te(t))return g(new V(n,e,qp(t),i));if(r?.propertyOrder===`original`){let t=v||Reflect.ownKeys(e);for(let e of a)t.indexOf(e)===-1&&t.push(e);let n={};for(let e of t)Object.prototype.hasOwnProperty.call(i,e)&&(n[e]=i[e]);return x(n)}return x(i)};if(ee&&ee.length>0){let e=ee;return j(()=>{let t={es:en(f),output:Object.assign({},_)};return D(sn(e,e=>e(t),{concurrency:l,batching:u,discard:!0}),()=>ne(t))})}return ne({es:f,output:_})}}case`Union`:{let e=Up(n.types,r),t=Reflect.ownKeys(e.keys),i=t.length,a=n.types.length,o=new Map;for(let e=0;e<a;e++)o.set(n.types[e],W(n.types[e],r));let s=Rp(n)??1,c=zp(n);return(r,l)=>{let u=[],d=0,f=[];if(i>0)if(Pt(r))for(let n=0;n<i;n++){let i=t[n],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=Ts.make(n),s=t.length===a?new _s([new P(i,o,!1,!0)],[]):Ts.make(t);u.push([d++,new V(s,r,new B(i,r,new H(o,r[i])))])}}else{let{candidates:t,literals:n}=e.keys[i],o=new P(i,Ts.make(n),!1,!0),s=t.length===a?new _s([o],[]):Ts.make(t);u.push([d++,new V(s,r,new B(i,r,new cp(o)))])}}else{let t=e.candidates.length===a?n:Ts.make(e.candidates);u.push([d++,new H(t,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(vp(n)&&(!p||p.length===0)){if(Ue(n))return n;u.push([d++,n.left])}else{let e=d++;p||=[],p.push(t=>j(()=>`finalResult`in t?A:D(xr(n),n=>(Ue(n)?t.finalResult=n:t.es.push([e,n.left]),A))))}}let m=e=>Te(e)?e.length===1&&e[0][1]._tag===`Type`?g(e[0][1]):g(new V(n,r,qp(e))):g(new H(n,r));if(p&&p.length>0){let e=p;return j(()=>{let t={es:en(u)};return D(sn(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=Oa(()=>W(n.f(),r));return(t,n)=>e()(t,n)}}},Vp=(e,t)=>n=>t(n)?x(n):g(new H(e,n)),Hp=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Bo(e);if(yt(n))return Hp(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?ec(i.type):F(i.type);Yo(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?ec(i.type):F(i.type);Yo(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return Hp(e.from,t);case`Suspend`:return Hp(e.f(),t);case`Transformation`:return Hp(t?e.from:e.to,t)}return[]},Up=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=Hp(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}},Wp=e=>Ms(e)?Wp(e.from):e,Gp=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||vp(e))return e;let i=new Sr,a=Ar(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(di(o))return x(o.value);let e=o.cause;return ri(e)?g(e.error):g(new dp(t,n,ti(e)))}return g(new dp(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},Kp=([e],[t])=>e>t?1:e<t?-1:0;function qp(e){return e.sort(Kp).map(e=>e[1])}const Jp=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return x;case`TypeLiteralTransformation`:return n=>{let r=x(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=bp(r,t=>{let n=a(Object.prototype.hasOwnProperty.call(t,e)?b(t[e]):h());return delete t[e],yt(n)&&(t[i]=n.value),t})}return r}}},Yp=(e,t=[])=>({value:e,forest:t}),Xp={formatIssue:e=>bp(_m(e),Zp),formatIssueSync:e=>{let t=Xp.formatIssue(e);return vp(t)?a(t):Sn(t)},formatError:e=>Xp.formatIssue(e.issue),formatErrorSync:e=>Xp.formatIssueSync(e.issue)},Zp=e=>e.value+Qp(`
|
|
2
|
+
`,e.forest),Qp=(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+=Qp(e+(r>1&&!o?`│ `:` `),i.forest)}return n},$p=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},em=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},tm=e=>`ast`in e?b(e.ast):h(),nm=x(void 0),rm=e=>tm(e).pipe(Xt(ko),y({onNone:()=>nm,onSome:t=>{let n=t(e);return gt(n)?x({message:n,override:!1}):Tn(n)?E(n,e=>({message:e,override:!1})):gt(n.message)?x({message:n.message,override:n.override}):E(n.message,e=>({message:e,override:n.override}))}})),im=e=>t=>t._tag===e,am=im(`Composite`),om=im(`Refinement`),sm=im(`Transformation`),cm=e=>yp(rm(e),t=>t===void 0?nm:!t.override&&(am(e)||om(e)&&e.kind===`From`||sm(e)&&e.kind!==`Transformation`)?sm(e)||om(e)?cm(e.issue):nm:x(t.message)),lm=e=>tm(e).pipe(Xt(Lo),Ae(t=>t(e)),l);function um(e){return Po(e).pipe(ne(()=>jo(e)),ne(()=>Mo(e)),ne(()=>No(e)),Pe(()=>`{ ${e.from} | filter }`))}function dm(e){return e.message===void 0?`Expected ${Ms(e.ast)?um(e.ast):String(e.ast)}, actual ${u(e.actual)}`:e.message}const fm=e=>bp(cm(e),t=>t??lm(e)??dm(e)),pm=e=>lm(e)??String(e.ast),mm=e=>e.message??`is forbidden`,hm=e=>e.message??`is unexpected`,gm=e=>{let t=Ao(e.ast);if(yt(t)){let e=t.value();return gt(e)?x(e):e}return x(e.message??`is missing`)},_m=e=>{switch(e._tag){case`Type`:return bp(fm(e),Yp);case`Forbidden`:return x(Yp(pm(e),[Yp(mm(e))]));case`Unexpected`:return x(Yp(hm(e)));case`Missing`:return bp(gm(e),Yp);case`Transformation`:return yp(cm(e),t=>t===void 0?bp(_m(e.issue),t=>Yp(pm(e),[Yp($p(e.kind),[t])])):x(Yp(t)));case`Refinement`:return yp(cm(e),t=>t===void 0?bp(_m(e.issue),t=>Yp(pm(e),[Yp(em(e.kind),[t])])):x(Yp(t)));case`Pointer`:return bp(_m(e.issue),t=>Yp(Ma(e.path),[t]));case`Composite`:return yp(cm(e),t=>{if(t!==void 0)return x(Yp(t));let n=pm(e);return ka(e.issues)?bp(sn(e.issues,_m),e=>Yp(n,e)):bp(_m(e.issues),e=>Yp(n,[e]))})}},vm=C(e=>Rt(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),ym=C(e=>Rt(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),bm=Symbol.for(`effect/Schema`);function G(e){return class{[bm]=xm;static ast=e;static annotations(e){return G(wm(this.ast,e))}static pipe(){return Jt(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[bm]=xm}}const xm={_A:e=>e,_I:e=>e,_R:e=>e},Sm={typeConstructor:io,schemaId:oo,message:so,missingMessage:co,identifier:lo,title:uo,description:po,examples:mo,default:ho,documentation:bo,jsonSchema:go,arbitrary:_o,pretty:vo,equivalence:yo,concurrency:xo,batching:So,parseIssueTitle:Co,parseOptions:wo,decodingFallback:To},Cm=e=>{if(!e)return{};let t={...e};for(let n in Sm)if(n in e){let r=Sm[n];t[r]=e[n],delete t[n]}return t},wm=(e,t)=>Hs(e,Cm(t)),Tm=e=>String(e.ast),Em=e=>G(ec(e.ast)),Dm=e=>G(F(e.ast)),Om=(e,t)=>{let n=jp(e,t);return(e,t)=>xp(n(e,t),mp)},km=e=>se(e,bm)&&Rt(e[bm]);function Am(e){return Ds(e)?Ts.make(Es(e,e=>new Jo(e))):new Jo(e[0])}function jm(e,t=Am(e)){return class extends G(t){static annotations(e){return jm(this.literals,wm(this.ast,e))}static literals=[...e]}}function Mm(...e){return t(e)?jm(e):Bm}const Nm=(e,t,n)=>Fm(e,new Ko(e.map(e=>e.ast),(...e)=>t.decode(...e.map(G)),(...e)=>t.encode(...e.map(G)),Cm(n))),Pm=(e,t)=>{let n=()=>(t,n,r)=>e(t)?U(t):hp(new H(r,t));return Fm([],new Ko([],n,n,Cm(t)))};function Fm(e,t){return class extends G(t){static annotations(e){return Fm(this.typeParameters,wm(this.ast,e))}static typeParameters=[...e]}}const Im=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return Nm(e,t,n)}let e=arguments[0],t=arguments[1];return Pm(e,t)},Lm=Symbol.for(`effect/SchemaId/InstanceOf`),Rm=(e,t)=>Im(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Lm,[Lm]:{constructor:e},...t});var zm=class extends G(Zo){},Bm=class extends G(Qo){},Vm=class extends G($o){},Hm=class extends G(ss){},Um=class extends G(cs){},K=class extends G(ts){},q=class extends G(rs){},Wm=class extends G(as){};const Gm=e=>Ts.make(e.map(e=>e.ast));function Km(e,t=Gm(e)){return class extends G(t){static annotations(e){return Km(this.members,wm(this.ast,e))}static members=[...e]}}function qm(...e){return Ds(e)?Km(e):t(e)?e[0]:Bm}const Jm=e=>qm(e,zm),Ym=e=>new Xm(new ds(e.ast,!1),e);var Xm=class e{ast;from;[bm];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ds(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...Cm(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}};const Zm=(e,t)=>new ps(e.map(e=>km(e)?new ds(e.ast,!1):e.ast),t.map(e=>km(e)?new us(e.ast):e.ast),!0);function Qm(e,t,n=Zm(e,t)){return class extends G(n){static annotations(e){return Qm(this.elements,this.rest,wm(this.ast,e))}static elements=[...e];static rest=[...t]}}function $m(...e){return Array.isArray(e[0])?Qm(e[0],e.slice(1)):Qm(e,[])}function eh(e,t){return class extends Qm([],[e],t){static annotations(e){return eh(this.value,wm(this.ast,e))}static value=e}}const th=e=>eh(e),nh=e=>e?`"?:"`:`":"`;var rh=class extends ds{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=nh(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}};(class extends ds{isReadonly;fromKey;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.fromKey=i}});var ih=class extends ds{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}};const ah=e=>e===void 0?`never`:gt(e)?JSON.stringify(e):String(e);var oh=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<${nh(this.to.isOptional)}, ${this.to.type}, ${ah(this.from.fromKey)}, ${nh(this.from.isOptional)}, ${this.from.type}>`}};const sh=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new rh(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new oh(e.from,new ih(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},ch=Symbol.for(`effect/PropertySignature`),lh=e=>se(e,ch);var uh=class e{ast;[bm];[ch]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return Jt(this,arguments)}annotations(t){return new e(sh(this.ast,Cm(t)))}toString(){return String(this.ast)}};const dh=e=>new uh(e);var fh=class e extends uh{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(sh(this.ast,Cm(t)),this.from)}};const ph=e=>new fh(new rh(e.ast,!1,!0,{},void 0),e),mh=C(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return dh(new rh(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return dh(new oh(n.from,new ih(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),hh=e=>new fh(new rh(e.ast===Zo||e.ast===Qo?Zo:Jm(e).ast,!0,!0,{},void 0),e),gh=Js([co]),_h=(e,n)=>{let r=Reflect.ownKeys(e),i=[];if(r.length>0){let a=[],o=[],s=[];for(let t=0;t<r.length;t++){let n=r[t],c=e[n];if(lh(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,r=e.isOptional,s=e.annotations;a.push(new P(n,t,r,!0,gh(e))),o.push(new P(n,F(t),r,!0,s)),i.push(new P(n,t,r,!0,s));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??n;a.push(new P(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),o.push(new P(n,e.to.type,e.to.isOptional,!0,e.to.annotations)),s.push(new zs(t,n,e.decode,e.encode));break}}}else a.push(new P(n,c.ast,!1,!0)),o.push(new P(n,F(c.ast),!1,!0)),i.push(new P(n,c.ast,!1,!0))}if(t(s)){let e=[],t=[];for(let r of n){let{indexSignatures:n,propertySignatures:i}=qs(r.key.ast,r.value.ast);i.forEach(e=>{a.push(e),o.push(new P(e.name,F(e.type),e.isOptional,e.isReadonly,e.annotations))}),n.forEach(n=>{e.push(n),t.push(new gs(n.parameter,F(n.type),n.isReadonly))})}return new Ps(new _s(a,e,{[fo]:`Struct (Encoded side)`}),new _s(o,t,{[fo]:`Struct (Type side)`}),new Bs(s))}}let a=[];for(let e of n){let{indexSignatures:t,propertySignatures:n}=qs(e.key.ast,e.value.ast);n.forEach(e=>i.push(e)),t.forEach(e=>a.push(e))}return new _s(i,a)},vh=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&lh(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function yh(e,t,n=_h(e,t)){return class extends G(n){static annotations(e){return yh(this.fields,this.records,wm(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=vh(e,{...t});return I_(n)?r:Pp(this)(r)};static pick(...t){return J(vm(e,...t))}static omit(...t){return J(ym(e,...t))}}}function J(e,...t){return yh(e,t)}const bh=e=>Mm(e).pipe(ph,mh(()=>e)),xh=(e,t)=>J({_tag:bh(e),...t});function Sh(e,t,n){return class extends yh({},[{key:e,value:t}],n){static annotations(n){return Sh(e,t,wm(this.ast,n))}static key=e;static value=t}}const Ch=e=>Sh(e.key,e.value);function wh(e,t){return class extends G(t){static annotations(e){return wh(this.from,wm(this.ast,e))}static make=(e,t)=>I_(t)?e:Pp(this)(e);static from=e}}const Th=(e,t)=>n=>{let r=y(Oo(n.ast),{onNone:()=>[e],onSome:t=>[...t,e]});return wh(n,Hs(n.ast,Cm({[ao]:r,...t})))},Eh=(e,t,n)=>{if(bs(e)&&bs(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 P(t,kh(o,e.type,n.concat(t)),a,!0)}}return new _s(r,e.indexSignatures.concat(t.indexSignatures))}throw Error(Fa(e,t,n))},Dh=Ys([lo]),Oh=(e,t)=>t.map(t=>new js(t,e.filter,Dh(e))),kh=(e,t,n)=>Ts.make(jh([e],[t],n)),Ah=e=>Os(e)?e.types:[e],jh=(e,t,n)=>He(e,e=>He(t,t=>{switch(t._tag){case`Literal`:if(gt(t.literal)&&ns(e)||ut(t.literal)&&is(e)||re(t.literal)&&os(e))return[t];break;case`StringKeyword`:if(t===ts){if(ns(e)||Yo(e)&>(e.literal))return[e];if(Ms(e))return Oh(e,jh(Ah(e.from),[t],n))}else if(e===ts)return[t];break;case`NumberKeyword`:if(t===rs){if(is(e)||Yo(e)&&ut(e.literal))return[e];if(Ms(e))return Oh(e,jh(Ah(e.from),[t],n))}else if(e===rs)return[t];break;case`BooleanKeyword`:if(t===as){if(os(e)||Yo(e)&&re(e.literal))return[e];if(Ms(e))return Oh(e,jh(Ah(e.from),[t],n))}else if(e===as)return[t];break;case`Union`:return jh(Ah(e),t.types,n);case`Suspend`:return[new As(()=>kh(e,t.f(),n))];case`Refinement`:return Oh(t,jh(Ah(e),Ah(t.from),n));case`TypeLiteral`:switch(e._tag){case`Union`:return jh(e.types,[t],n);case`Suspend`:return[new As(()=>kh(e.f(),t,n))];case`Refinement`:return Oh(e,jh(Ah(e.from),[t],n));case`TypeLiteral`:return[Eh(e,t,n)];case`Transformation`:{let r=e.transformation,i=Eh(e.from,t,n),a=Eh(e.to,F(t),n);switch(r._tag){case`TypeLiteralTransformation`:return[new Ps(i,a,new Bs(r.propertySignatureTransformations))];case`ComposeTransformation`:return[new Ps(i,a,Rs)];case`FinalTransformation`:return[new Ps(i,a,new Is((e,t,n,i)=>bp(r.decode(e,t,n,i),t=>({...e,...t})),(e,t,n,i)=>bp(r.encode(e,t,n,i),t=>({...e,...t}))))]}}}break;case`Transformation`:if(Fs(e)){if(Vs(t.transformation)&&Vs(e.transformation))return[new Ps(Eh(e.from,t.from,n),Eh(e.to,t.to,n),new Bs(t.transformation.propertySignatureTransformations.concat(e.transformation.propertySignatureTransformations)))]}else return jh([t],[e],n);break}throw Error(Fa(e,t,n))})),Mh=C(2,(e,t)=>G(kh(e.ast,t.ast,[]))),Nh=e=>G(new As(()=>e().ast)),Ph=Symbol.for(`effect/SchemaId/Refine`);function Fh(e,t,n){return class extends G(n){static annotations(e){return Fh(this.from,this.filter,wm(this.ast,e))}static[Ph]=e;static from=e;static filter=t;static make=(e,t)=>I_(t)?e:Pp(this)(e)}}const Ih=(e,n,r)=>{if(re(e))return e?h():b(new H(n,r));if(gt(e))return b(new H(n,r,e));if(e!==void 0){if(`_tag`in e)return b(e);let i=new H(n,r,e.message);return b(t(e.path)?new B(e.path,r,i):i)}return h()},Lh=(e,n,r)=>{if(Aa(e))return Ih(e,n,r);if(t(e)){let i=Ie(e,e=>Ih(e,n,r));if(t(i))return b(i.length===1?i[0]:new V(n,r,i))}return h()};function Y(e,t){return n=>{function r(t,n,r){return Lh(e(t,n,r),r,t)}return Fh(n,r,new js(n.ast,r,Cm(t)))}}function Rh(e,t,n){return class extends G(n){static annotations(e){return Rh(this.from,this.to,wm(this.ast,e))}static from=e;static to=t}}const X=C(e=>km(e[0])&&km(e[1]),(e,t,n)=>Rh(e,t,new Ps(e.ast,t.ast,new Is(n.decode,n.encode)))),Z=C(e=>km(e[0])&&km(e[1]),(e,t,n)=>X(e,t,{strict:!0,decode:(e,t,r,i)=>U(n.decode(e,i)),encode:(e,t,r,i)=>U(n.encode(e,i))})),zh=C(2,(e,t)=>e.annotations(t)),Bh=Symbol.for(`effect/SchemaId/Trimmed`),Vh=e=>t=>t.pipe(Y(e=>e===e.trim(),{schemaId:Bh,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),Hh=to,Uh=(e,t)=>n=>n.pipe(Y(t=>t.length>=e,{schemaId:Hh,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Wh=no,Gh=(e,t)=>n=>{let r=Rt(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=Rt(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Y(e=>e.length===r,{schemaId:Wh,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:Wh,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}))},Kh=Symbol.for(`effect/SchemaId/Pattern`),qh=(e,t)=>n=>{let r=e.source;return n.pipe(Y(t=>(e.lastIndex=0,e.test(t)),{schemaId:Kh,[Kh]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},Jh=Symbol.for(`effect/SchemaId/Lowercased`),Yh=e=>t=>t.pipe(Y(e=>e===e.toLowerCase(),{schemaId:Jh,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e}));var Xh=class extends K.pipe(Yh({identifier:`Lowercased`})){};const Zh=Symbol.for(`effect/SchemaId/Uppercased`),Qh=e=>t=>t.pipe(Y(e=>e===e.toUpperCase(),{schemaId:Zh,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e}));var $h=class extends K.pipe(Qh({identifier:`Uppercased`})){};const eg=Symbol.for(`effect/SchemaId/Capitalized`),tg=e=>t=>t.pipe(Y(e=>e[0]?.toUpperCase()===e[0],{schemaId:eg,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e}));var ng=class extends K.pipe(tg({identifier:`Capitalized`})){};const rg=Symbol.for(`effect/SchemaId/Uncapitalized`),ig=e=>t=>t.pipe(Y(e=>e[0]?.toLowerCase()===e[0],{schemaId:rg,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e}));var ag=class extends K.pipe(ig({identifier:`Uncapitalized`})){};K.pipe(Gh(1,{identifier:`Char`}));const og=e=>Uh(1,{title:`nonEmptyString`,description:`a non empty string`,...e});Z(K.annotations({description:`a string that will be converted to lowercase`}),Xh,{strict:!0,decode:e=>e.toLowerCase(),encode:S}).annotations({identifier:`Lowercase`}),Z(K.annotations({description:`a string that will be converted to uppercase`}),$h,{strict:!0,decode:e=>e.toUpperCase(),encode:S}).annotations({identifier:`Uppercase`}),Z(K.annotations({description:`a string that will be converted to a capitalized format`}),ng,{strict:!0,decode:e=>wa(e),encode:S}).annotations({identifier:`Capitalize`}),Z(K.annotations({description:`a string that will be converted to an uncapitalized format`}),ag,{strict:!0,decode:e=>Ta(e),encode:S}).annotations({identifier:`Uncapitalize`});var sg=class extends K.pipe(Vh({identifier:`Trimmed`})){},cg=class extends sg.pipe(og({identifier:`NonEmptyTrimmedString`})){};Z(K.annotations({description:`a string that will be trimmed`}),sg,{strict:!0,decode:e=>e.trim(),encode:S}).annotations({identifier:`Trim`});const lg=e=>e instanceof Error?e.message:String(e);K.pipe(og({identifier:`NonEmptyString`}));const ug=Symbol.for(`effect/SchemaId/UUID`),dg=/^[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;K.pipe(qh(dg,{schemaId:ug,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:dg.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));const fg=Symbol.for(`effect/SchemaId/ULID`);K.pipe(qh(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:fg,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var pg=class extends Rm(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};X(K.annotations({description:`a string to be decoded into a URL`}),pg,{strict:!0,decode:(e,t,n)=>gp({try:()=>new URL(e),catch:t=>new H(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${lg(t)}`)}),encode:e=>U(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});const mg=Xa,hg=e=>t=>t.pipe(Y(Number.isFinite,{schemaId:mg,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),gg=Wa,_g=(e,t)=>n=>n.pipe(Y(t=>t>e,{schemaId:gg,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),vg=Ga,yg=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:vg,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),bg=Ja,xg=e=>t=>t.pipe(Y(e=>Number.isSafeInteger(e),{schemaId:bg,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),Sg=Ka,Cg=(e,t)=>n=>n.pipe(Y(t=>t<e,{schemaId:Sg,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),wg=qa,Tg=(e,t)=>n=>n.pipe(Y(t=>t<=e,{schemaId:wg,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),Eg=Qa,Dg=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Eg,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),Og=Ya,kg=e=>t=>t.pipe(Y(e=>!Number.isNaN(e),{schemaId:Og,title:`nonNaN`,description:`a number excluding NaN`,...e})),Ag=e=>_g(0,{title:`positive`,...e}),jg=e=>Cg(0,{title:`negative`,...e}),Mg=e=>Tg(0,{title:`nonPositive`,...e}),Ng=e=>yg(0,{title:`nonNegative`,...e});function Pg(e){return X(e,q,{strict:!1,decode:(e,t,n)=>_p(mn(e),()=>new H(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>U(String(e))})}Pg(K.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),q.pipe(hg({identifier:`Finite`}));var Fg=class extends q.pipe(xg({identifier:`Int`})){};q.pipe(kg({identifier:`NonNaN`})),q.pipe(Ag({identifier:`Positive`})),q.pipe(jg({identifier:`Negative`})),q.pipe(Mg({identifier:`NonPositive`}));var Ig=class extends q.pipe(Ng({identifier:`NonNegative`})){};const Lg=Za;q.pipe(hg({schemaId:Lg,identifier:`JsonNumber`})),Z(Wm.annotations({description:`a boolean that will be negated`}),Wm,{strict:!0,decode:e=>cn(e),encode:e=>cn(e)});const Rg=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?hp(new H(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):U(n)},zg=e=>U(Symbol.for(e));X(K.annotations({description:`a string to be decoded into a globally shared symbol`}),Um,{strict:!1,decode:e=>zg(e),encode:(e,t,n)=>Rg(e,n)}).annotations({identifier:`Symbol`});const Bg=$a,Vg=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:Bg,[Bg]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),Hg=eo,Ug=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Hg,[Hg]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),Wg=e=>Vg(0n,{title:`nonNegativeBigInt`,...e});var Gg=class extends X(K.annotations({description:`a string to be decoded into a bigint`}),Hm,{strict:!0,decode:(e,t,n)=>_p(kc(e),()=>new H(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>U(String(e))}).annotations({identifier:`BigInt`}){};const Kg=Hm.pipe(Wg({identifier:`NonNegativeBigintFromSelf`}));X(q.annotations({description:`a number to be decoded into a bigint`}),Hm.pipe(Ug(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>_p(Ac(e),()=>new H(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>_p(Oc(e),()=>new H(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});const qg=(e,t,n,r)=>Sp(e,{onFailure:e=>new V(n,r,e),onSuccess:t});var Jg=class extends Im(ie,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(At),e.bigInt({min:0n}).map(e=>we(e)),e.maxSafeNat().map(e=>Je(e))),equivalence:()=>Ve}){};X(Kg.annotations({description:`a bigint to be decoded into a Duration`}),Jg.pipe(Y(e=>Ke(e),{description:`a finite duration`})),{strict:!0,decode:e=>U(we(e)),encode:(e,t,n)=>y(Lt(e),{onNone:()=>hp(new H(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>U(e)})}).annotations({identifier:`DurationFromNanos`});const Yg=Ig.pipe(xg()).annotations({identifier:`NonNegativeInt`});Z(Ig.annotations({description:`a non-negative number to be decoded into a Duration`}),Jg,{strict:!0,decode:e=>Je(e),encode:e=>lt(e)}).annotations({identifier:`DurationFromMillis`});const Xg=xh(`Millis`,{millis:Yg}),Zg=xh(`Nanos`,{nanos:Gg}),Qg=xh(`Infinity`,{}),$g=Qg.make({}),e_=qm(Xg,Zg,Qg).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),t_=qm($m(Ym(Yg).annotations({title:`seconds`}),Ym(Yg).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),$m(Mm(-1),Mm(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),n_=e=>typeof e==`object`;Z(qm(e_,t_),Jg,{strict:!0,decode:e=>{if(n_(e))switch(e._tag){case`Millis`:return Je(e.millis);case`Nanos`:return we(e.nanos);case`Infinity`:return At}let[t,n]=e;return t===-1?At:we(BigInt(t)*BigInt(1e9)+BigInt(n))},encode:e=>{switch(e.value._tag){case`Millis`:return Xg.make({millis:e.value.millis});case`Nanos`:return Zg.make({nanos:e.value.nanos});case`Infinity`:return $g}}}).annotations({identifier:`Duration`});var r_=class extends Im(it,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>jt(n)}){};Z(th(class extends q.pipe(Dg(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`}),r_,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});const i_=ro,a_=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(Pa(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Y(e=>e.length>=r,{schemaId:i_,title:`minItems(${r})`,description:`an array of at least ${r} item(s)`,jsonSchema:{minItems:r},[Do]:!0,...t}))},o_=Symbol.for(`effect/SchemaId/ValidDate`),s_=e=>t=>t.pipe(Y(e=>!Number.isNaN(e.getTime()),{schemaId:o_,[o_]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),c_=Ua;var l_=class extends Im(Ge,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:c_,[c_]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>st}){};l_.pipe(s_({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends Z(K.annotations({description:`a string to be decoded into a Date`}),l_,{strict:!0,decode:e=>new Date(e),encode:e=>Gt(e)}).annotations({identifier:`DateFromString`}){}.pipe(s_({identifier:`Date`})),Z(q.annotations({description:`a number to be decoded into a Date`}),l_,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var u_=class extends Im(e=>Uf(e)&&Kf(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=>Yf(e)),equivalence:()=>Jf}){};const d_=(e,t)=>gp({try:()=>Xf(e),catch:()=>new H(t,e,`Unable to decode ${u(e)} into a DateTime.Utc`)});X(q.annotations({description:`a number to be decoded into a DateTime.Utc`}),u_,{strict:!0,decode:(e,t,n)=>d_(e,n),encode:e=>U(ip(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),X(l_.annotations({description:`a Date to be decoded into a DateTime.Utc`}),u_,{strict:!0,decode:(e,t,n)=>d_(e,n),encode:e=>U(rp(e))}).annotations({identifier:`DateTimeUtcFromDate`}),X(K.annotations({description:`a string to be decoded into a DateTime.Utc`}),u_,{strict:!0,decode:(e,t,n)=>d_(e,n),encode:e=>U(ap(e))}).annotations({identifier:`DateTimeUtc`});const f_=()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(ep);var p_=class extends Im(Wf,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:f_}){};Z(q.annotations({description:`a number to be decoded into a TimeZone.Offset`}),p_,{strict:!0,decode:e=>ep(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});const m_=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map($f);var h_=class extends Im(Gf,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:m_}){};X(K.annotations({description:`a string to be decoded into a TimeZone.Named`}),h_,{strict:!0,decode:(e,t,n)=>gp({try:()=>$f(e),catch:()=>new H(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>U(e.id)}).annotations({identifier:`TimeZoneNamed`});var g_=class extends qm(p_,h_){};X(K.annotations({description:`a string to be decoded into a TimeZone`}),g_,{strict:!0,decode:(e,t,n)=>y(tp(e),{onNone:()=>hp(new H(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:U}),encode:e=>U(np(e))}).annotations({identifier:`TimeZone`});const __=e=>e.oneof(f_()(e),m_()(e));var v_=class extends Im(e=>Uf(e)&&qf(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}),__(e)).map(([e,t])=>Zf(e,{timeZone:t})),equivalence:()=>Jf}){};X(K.annotations({description:`a string to be decoded into a DateTime.Zoned`}),v_,{strict:!0,decode:(e,t,n)=>y(Qf(e),{onNone:()=>hp(new H(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:U}),encode:e=>U(op(e))}).annotations({identifier:`DateTimeZoned`});const y_=e=>e._tag===`None`?h():b(e.value),b_=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(y_),x_=e=>y({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),S_=e=>(t,n,r)=>i(t)?Ct(t)?U(h()):qg(e(t.value,n),b,r,t):hp(new H(r,t)),C_=e=>Im([e],{decode:e=>S_(jp(e)),encode:e=>S_(Mp(e))},{typeConstructor:{_tag:`effect/Option`},pretty:x_,arbitrary:b_,equivalence:qt});Z(K,(e=>C_(e).annotations({description:`Option<${Tm(e)}>`}))(cg),{strict:!0,decode:e=>nt(b(e.trim()),Ea),encode:e=>Pe(e,()=>``)});const w_=()=>e=>`BigDecimal(${Cc(hc(e))})`,T_=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>uc(e,t));var E_=class extends Im(lc,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:w_,arbitrary:T_,equivalence:()=>vc}){};X(K.annotations({description:`a string to be decoded into a BigDecimal`}),E_,{strict:!0,decode:(e,t,n)=>Sc(e).pipe(y({onNone:()=>hp(new H(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>U(hc(e))})),encode:e=>U(Cc(hc(e)))}).annotations({identifier:`BigDecimal`}),Z(q.annotations({description:`a number to be decoded into a BigDecimal`}),E_,{strict:!0,decode:e=>bc(e),encode:e=>Tc(e)}).annotations({identifier:`BigDecimalFromNumber`});const D_=e=>km(e)||lh(e),O_=e=>Reflect.ownKeys(e).every(t=>D_(e[t])),k_=e=>`fields`in e?e.fields:k_(e[Ph]),A_=e=>O_(e)?J(e):km(e)?e:J(k_(e)),j_=e=>O_(e)?e:k_(e),M_=e=>mh(ph(Mm(e)),()=>e),N_=e=>(t,n,r)=>{let i=j_(n),a=A_(n),o={_tag:M_(t)},s=F_(o,i);return class extends z_({kind:`TaggedClass`,identifier:e??t,schema:Mh(a,J(o)),fields:s,Base:Ti,annotations:r}){static _tag=t}},P_=e=>(t,n,r)=>{class i extends Ei{}i.prototype.name=t;let a=j_(n),o=A_(n),s={_tag:M_(t)},c=F_(s,a),l=`message`in c;class d extends z_({kind:`TaggedError`,identifier:e??t,schema:Mh(o,J(s)),fields:c,Base:i,annotations:r,disableToString:!0}){static _tag=t}return l||Object.defineProperty(d.prototype,"message",{get(){return`{ ${Reflect.ownKeys(a).map(e=>`${je(e)}: ${u(this[e])}`).join(`, `)} }`},enumerable:!1,configurable:!0}),d},F_=(e,t)=>{let n={...e};for(let r of Reflect.ownKeys(t)){if(r in e)throw Error(Ha(r));n[r]=t[r]}return n};function I_(e){return re(e)?e:e?.disableValidation??!1}const L_=zt(`effect/Schema/astCache`,()=>new WeakMap),R_=e=>e===void 0?[]:Array.isArray(e)?e:[e],z_=({Base:e,annotations:t,disableToString:n,fields:r,identifier:i,kind:a,schema:o})=>{let s=Symbol.for(`effect/Schema/${a}/${i}`),[c,l,d]=R_(t),f=Dm(o),p=f.annotations({identifier:i,...c}),m=f.annotations({[fo]:`${i} (Type side)`,...c}),h=o.annotations({[fo]:`${i} (Constructor)`,...c}),g=o.annotations({[fo]:`${i} (Encoded side)`,...d}),_=o.annotations({...d,...c,...l}),v=e=>se(e,s)&&Fp(m)(e),ee=class extends e{constructor(e={},t=!1){e={...e},a!==`Class`&&delete e._tag,e=vh(r,e),I_(t)||(e=Pp(h)(e)),super(e,!0)}static[bm]=xm;static get ast(){let e=L_.get(this);if(e)return e;let t=Im([o],{decode:()=>(e,t,n)=>e instanceof this||v(e)?U(e):hp(new H(n,e)),encode:()=>(e,t)=>e instanceof this?U(e):bp(Mp(m)(e,t),e=>new this(e,!0))},{identifier:i,pretty:e=>t=>`${i}(${e(t)})`,arbitrary:e=>t=>e(t).map(e=>new this(e)),equivalence:S,[Eo]:p.ast,...c});return e=Z(g,t,{strict:!0,decode:e=>new this(e,!0),encode:S}).annotations({[Eo]:_.ast,...l}).ast,L_.set(this,e),e}static pipe(){return Jt(this,arguments)}static annotations(e){return G(this.ast).annotations(e)}static toString(){return`(${String(g)} <-> ${i})`}static make(...e){return new this(...e)}static fields={...r};static identifier=i;static extend(e){return(t,n)=>{let i=j_(t),s=A_(t),c=F_(r,i);return z_({kind:a,identifier:e,schema:Mh(o,s),fields:c,Base:this,annotations:n})}}static transformOrFail(e){return(t,n,i)=>{let s=F_(r,t);return z_({kind:a,identifier:e,schema:X(o,Dm(J(s)),n),fields:s,Base:this,annotations:i})}}static transformOrFailFrom(e){return(t,n,i)=>{let s=F_(r,t);return z_({kind:a,identifier:e,schema:X(Em(o),J(s),n),fields:s,Base:this,annotations:i})}}get[s](){return s}};return n!==!0&&Object.defineProperty(ee.prototype,"toString",{value(){return`${i}({ ${Reflect.ownKeys(r).map(e=>`${je(e)}: ${u(this[e])}`).join(`, `)} })`},configurable:!0,writable:!0}),ee},B_=qm(J({_tag:Mm(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),J({_tag:Mm(`Runtime`),id:Fg,startTimeMillis:Fg}).annotations({identifier:`FiberIdRuntimeEncoded`}),J({_tag:Mm(`Composite`),left:Nh(()=>B_),right:Nh(()=>B_)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),V_=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(W_),H_=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${H_(e.right)}, ${H_(e.left)})`}};var U_=class extends Im(he,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>H_,arbitrary:()=>V_}){};const W_=e=>{switch(e._tag){case`None`:return xe;case`Runtime`:return p(e.id,e.startTimeMillis);case`Composite`:return pe(W_(e.left),W_(e.right))}},G_=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:G_(e.left),right:G_(e.right)}}};Z(B_,U_,{strict:!0,decode:e=>W_(e),encode:e=>G_(e)}).annotations({identifier:`FiberId`});var K_=class extends Z(Vm,Vm,{strict:!0,decode:e=>{if(Rt(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 Dt(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Dt(e)}).annotations({identifier:`Defect`}){};Z(Vm,Wm,{strict:!0,decode:e=>It(e),encode:S}).annotations({identifier:`BooleanFromUnknown`}),Z(Mm(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Wm,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});const q_=xh(`symbol`,{key:K}).annotations({description:`an object to be decoded into a globally shared symbol`}),J_=X(q_,Um,{strict:!0,decode:e=>zg(e.key),encode:(e,t,n)=>bp(Rg(e,n),e=>q_.make({key:e}))});var Y_=class extends qm(K,q,J_).annotations({identifier:`PropertyKey`}){};J({_tag:ph(Mm(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:ph(th(Y_)).annotations({description:`The path to the property where the issue occurred`}),message:ph(K).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});const X_=Zd,Z_=ef,Q_=yf,$_=bf,ev=Of,tv=Rf,nv=zf,rv={arrays:`merge`,sets:`merge`,maps:`merge`};function iv(e,t,n){return av(e,t,new Set,n??rv)}function av(e,t,n,r){let i={},a=new Set([...uv(e),...uv(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(lv(a)&&lv(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=ov(a,s,n,r);continue}i[o]=s}return i}function ov(e,t,n,r){if(sv(e)&&sv(t))return av(e,t,n,r);if(cv(e)&&cv(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 sv(e){return Object.getPrototypeOf(e)===Object.prototype}function cv(e){return typeof e[Symbol.iterator]==`function`}function lv(e){return typeof e==`object`&&!!e}function uv(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 dv(e){return e%4==0&&e%100!=0||e%400==0}var fv=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()===`
|
|
3
|
+
`||this.startsWith(`\r
|
|
4
|
+
`)}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 pv(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function mv(e){return typeof e==`object`&&!!e}function hv(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 gv(e,t){let{keys:n,type:r,value:i}=t,a=hv(e,n);if(a===void 0)return Object.assign(e,pv(n,i));if(Array.isArray(a))return vv(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(mv(a))return vv(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function _v(e,t){let{type:n,keys:r,value:i}=t,a=hv(e,r);if(a===void 0)return Object.assign(e,pv(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):vv(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(mv(a))return vv(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function vv(e,t){switch(t.type){case`Block`:return iv(e,t.value);case`Table`:return gv(e,t);case`TableArray`:return _v(e,t)}}function yv(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function bv(e,t){let n=Ev(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 xv(e,t){let n=Ev(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 Sv(e,t,n){let r=Ev(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(`
|
|
5
|
+
`,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(pv(o.body,s.body))}}function Cv(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=iv(r,e));return Q(r)}}function wv(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 Tv(e,t,n){let r=Ev(e),i=Ev(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 Ev(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const Dv=/[A-Za-z0-9_-]+/y;function Ov(e){e.skipWhitespaces();let t=e.match(Dv)?.[0];return t?(e.next(t.length),Q(t)):$()}function kv(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(`
|
|
6
|
+
`);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 Av(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
|
|
7
|
+
`)throw SyntaxError(`Single-line string cannot contain EOL`);let n=kv(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 jv(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
|
|
8
|
+
`)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 Mv(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
|
|
9
|
+
`?e.next():e.startsWith(`\r
|
|
10
|
+
`)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
|
|
11
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}else if(e.startsWith(`\\\r
|
|
12
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=kv(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 Nv(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
|
|
13
|
+
`?e.next():e.startsWith(`\r
|
|
14
|
+
`)&&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 Pv=/(?:true|false)\b/y;function Fv(e){e.skipWhitespaces();let t=e.match(Pv);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const Iv=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),Lv=/[+-]?inf\b/y;function Rv(e){e.skipWhitespaces();let t=e.match(Lv);if(!t)return $();let n=t[0];return e.next(n.length),Q(Iv.get(n))}const zv=/[+-]?nan\b/y;function Bv(e){e.skipWhitespaces();let t=e.match(zv);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const Vv=xv(yv([Ov,Av,jv]),`.`),Hv=/0b[01]+(?:_[01]+)*\b/y;function Uv(e){e.skipWhitespaces();let t=e.match(Hv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const Wv=/0o[0-7]+(?:_[0-7]+)*\b/y;function Gv(e){e.skipWhitespaces();let t=e.match(Wv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const Kv=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function qv(e){e.skipWhitespaces();let t=e.match(Kv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Jv=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Yv(e){e.skipWhitespaces();let t=e.match(Jv)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const Xv=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function Zv(e){e.skipWhitespaces();let t=e.match(Xv)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const Qv=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function $v(e){e.skipWhitespaces();let t=e.match(Qv);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&&!dv(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 ey=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function ty(e){e.skipWhitespaces();let t=e.match(ey)?.[0];return t?(e.next(t.length),Q(t)):$()}function ny(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=iy(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 ry(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=Tv(`{`,bv(ay,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=iv(n,e);return Q(n)}const iy=yv([Mv,Nv,Av,jv,Fv,Rv,Bv,$v,ty,Uv,Gv,qv,Zv,Yv,ny,ry]),ay=Sv(Vv,`=`,iy);function oy(e){e.nextUntilChar();let t=Cv(wv(ay))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const sy=Tv(`[`,Vv,`]`);function cy(e){e.nextUntilChar();let t=sy(e);if(!t.ok)return $();e.nextUntilChar();let n=oy(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const ly=Tv(`[[`,Vv,`]]`);function uy(e){e.nextUntilChar();let t=ly(e);if(!t.ok)return $();e.nextUntilChar();let n=oy(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function dy(e){let t=wv(yv([oy,uy,cy]))(e);return t.ok?Q(t.body.reduce(vv,{__proto__:null})):Q({__proto__:null})}function fy(e,t){let n=e.source.slice(0,e.position).split(`
|
|
15
|
+
`);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function py(e){return t=>{let n=new fv(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(fy(n,r))}catch(e){throw e instanceof Error?SyntaxError(fy(n,e.message)):SyntaxError(fy(n,`Invalid error type caught`))}}}function my(e){return py(dy)(e)}const hy=Symbol.for(`@effect/platform/Error`),gy=Mm(`Clipboard`,`Command`,`FileSystem`,`KeyValueStore`,`Path`,`Stream`,`Terminal`);var _y=class extends P_(`@effect/platform/Error/BadArgument`)(`BadArgument`,{module:gy,method:K,description:hh(K),cause:hh(K_)}){[hy]=hy;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}};const vy=Mm(`AlreadyExists`,`BadResource`,`Busy`,`InvalidData`,`NotFound`,`PermissionDenied`,`TimedOut`,`UnexpectedEof`,`Unknown`,`WouldBlock`,`WriteZero`);var yy=class extends P_(`@effect/platform/Error/SystemError`)(`SystemError`,{reason:vy,module:gy,method:K,description:hh(K),syscall:hh(K),pathOrDescriptor:hh(qm(K,q)),cause:hh(K_)}){[hy]=hy;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}};const by=Nt(`@effect/platform/FileSystem`),xy=e=>typeof e==`bigint`?e:BigInt(e),Sy=BigInt(1024);Sy*Sy*Sy*Sy*Sy;const Cy=e=>by.of({...e,exists:t=>w(e.access(t),wr(!0),tr(`SystemError`,e=>e.reason===`NotFound`?M(!1):Gn(e))),readFileString:(t,n)=>Er(e.readFile(t),{try:e=>new TextDecoder(n).decode(e),catch:e=>new _y({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})}),stream:(t,n)=>w(e.open(t,{flag:`r`}),n?.offset?pr(e=>e.seek(n.offset,`start`)):S,E(e=>wy(e,n)),nv),sink:(t,n)=>w(e.open(t,{flag:`w`,...n}),E(e=>X_(t=>e.writeAll(t))),Z_),writeFileString:(t,n,r)=>D(er({try:()=>new TextEncoder().encode(n),catch:e=>new _y({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),wy=(e,{bufferSize:t=16,bytesToRead:n,chunkSize:r=xy(64*1024)}={})=>{let i=n===void 0?void 0:xy(n),a=xy(r);function o(t){if(i!==void 0&&i<=t)return Vf;let n=i!==void 0&&i-t<a?i-t:a;return Bf(e.readAlloc(n),y({onNone:()=>Vf,onSome:e=>Bf(Hf(ve(e)),n=>o(t+BigInt(e.length)))}))}return $_(ev(o(BigInt(0))),{capacity:t})},Ty=xy,Ey=by,Dy=Cy,Oy=Symbol.for(`@effect/platform/FileSystem/File`),ky=Mc(),Ay=wi(`Create`),jy=wi(`Update`),My=wi(`Remove`);var Ny=class extends Xe(`@effect/platform/FileSystem/WatchBackend`)(){};const Py=Symbol.for(`@effect/platform/Path`),Fy=Nt(`@effect/platform/Path`);function Iy(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 Ly(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 Ry(e){if(e.protocol!==`file:`)return Gn(new _y({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return Gn(new _y({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 Gn(new _y({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return M(decodeURIComponent(t))}const zy=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=Iy(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function By(e){let t=new URL(`file://`),n=zy(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=Ky(n),M(t)}const Vy=/%/g,Hy=/\\/g,Uy=/\n/g,Wy=/\r/g,Gy=/\t/g;function Ky(e){return e.includes(`%`)&&(e=e.replace(Vy,`%25`)),e.includes(`\\`)&&(e=e.replace(Hy,`%5C`)),e.includes(`
|
|
16
|
+
`)&&(e=e.replace(Uy,`%0A`)),e.includes(`\r`)&&(e=e.replace(Wy,`%0D`)),e.includes(` `)&&(e=e.replace(Gy,`%09`)),e}const qy=Fy.of({[Py]:Py,resolve:zy,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Iy(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?`.`:qy.normalize(e)},relative(e,t){if(e===t||(e=qy.resolve(e),t=qy.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 Ly(`/`,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:Ry,toFileUrl:By,toNamespacedPath:S}),Jy=Fc(Fy,qy),Yy=Fy,Xy=Jy,Zy=Ch({key:K,value:th(K)}).pipe(Th(`TomlConfig`)),Qy=X(K,Dm(Zy),{strict:!0,decode:e=>gp({try:()=>my(e),catch:e=>new sp(e,`TOML parse error`)}).pipe(yp(e=>jp(Zy)(e))),encode:(e,t,n)=>hp(new dp(n,e,`TomlConfigFromText is decode-only`))}),$y=Np(Zy)({});var eb=class extends Xe(`TomlLoader`)(){};const tb=Nc(eb,un(function*(){let e=yield*sr(nr()),t=yield*Ey,n=yield*Yy;return eb.of({load:Nn(`TomlLoader.load`)(function*(r){let i=ar(yield*lr(e),r);if(yt(i))return i.value;let a=n.join(r,`systemfsoftware.toml`);if(!(yield*t.exists(a)))return yield*Yr(e,e=>(Or(e,r,$y),e)),$y;let o=yield*t.readFileString(a).pipe(D(Om(Qy)),vr(()=>M($y)));return yield*Yr(e,e=>(Or(e,r,o),e)),o})})}));Fp(th(J({old_text:hh(Vm),new_text:hh(Vm)}).pipe(Y(e=>`old_text`in e||`new_text`in e))).pipe(a_(1))),Fp(th(J({old_string:hh(Vm),new_string:hh(Vm)}).pipe(Y(e=>`old_string`in e||`new_string`in e)))),Ap(Ch({key:K,value:Vm}));export{qm as C,Ic as D,Pc as E,N_ as S,Nc as T,th as _,Ey as a,K as b,Ny as c,jy as d,Dy as f,tv as g,Q_ as h,ky as i,Ay as l,yy as m,tb as n,Oy as o,_y as p,Xy as r,Ty as s,eb as t,My as u,Mm as v,zh as w,J as x,Ch as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./Effect-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./Effect-DthArEC0.js";var n=e({Effect:()=>t});export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=async e=>{let[t,n,r,i]=await Promise.all([import(`./runtime-CQdDwUnD.js`).then(e=>e.default),import(`./Cause-CZtsWHWd.js`).then(e=>e.t),import(`./Effect-DthArEC0.js`).then(e=>e.t),import(`./Exit-BqcpPwcB.js`).then(e=>e.t)]),a=e.pipe(r.exit),o=await t.runPromise(a);if(i.isFailure(o))throw n.squash(o.cause);return o.value};export{e as runSafe};
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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)};function t(e,...t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.length>0)return t}return``}function n(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}const r=e=>{e.on(`tool_call`,async(e,r)=>{let{runSafe:i}=await import(`./helpers-
|
|
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)};function t(e,...t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.length>0)return t}return``}function n(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}const r=e=>{e.on(`tool_call`,async(e,r)=>{let{runSafe:i}=await import(`./helpers-YYsPcedt.js`),{runNoSkillDelegation:a}=await import(`./no-skill-delegation.executor-Dwikf8lt.js`),{Effect:o}=await import(`./esm-_eaOigyE.js`).then(e=>e.t);return i(o.gen(function*(){let i=n(e.input),o=t(i,`subagent_type`,`agent`),s=t(i,`prompt`,`task`,`description`);return yield*a(r.cwd,e.toolName,o,s)}))})},i=/Tool ([A-Za-z0-9_:-]+) not found/i,a=new Map;function o(e){return typeof e==`object`&&!!e&&`text`in e&&typeof e.text==`string`}function s(e){if(typeof e!=`object`||!e||!(`content`in e))return``;let t=e.content;return Array.isArray(t)?t.filter(o).map(e=>e.text).join(`
|
|
2
2
|
`):``}function c(e){return[``,`---`,`### ⚠️ Unresolved Tool Calls`,``,"The following xd:// tools were not found but have NOT yet been retried via `write` to `xd://`:",``,...e.map((e,t)=>`${t+1}. **\`${e.tool}\`** — failed ${e.failures} time${e.failures>1?`s`:``}. Your first attempt to use \`${e.tool}\` returned \`Tool not found\`. Write to \`xd://${e.tool}\` (JSON args) to retry — do NOT concede the tool is unavailable.`),``,"Each unresolved entry will repeat here until you retry by writing to the `xd://` device.",`---`].join(`
|
|
3
|
-
`)}const l=e=>{e.on(`tool_execution_end`,(e,t)=>{if(!e.isError)return;let n=i.exec(s(e.result));if(!n)return;let r=n[1];if(r===void 0)return;let o=a.get(r);if(o)o.failures+=1;else{if(a.size>=50){let e=a.keys().next().value;e!==void 0&&a.delete(e)}a.set(r,{tool:r,failures:1,remindedAtFailure:0})}}),e.on(`tool_execution_start`,(e,t)=>{if(e.toolName!==`write`||typeof e.args!=`object`||e.args===null||!(`path`in e.args))return;let n=e.args.path;if(typeof n!=`string`||!n.startsWith(`xd://`))return;let r=n.slice(5).split(/[/?#]/)[0];r!==void 0&&r.length!==0&&a.delete(r)}),e.on(`context`,e=>{if(a.size===0)return;let t=[...a.values()].filter(e=>e.failures>e.remindedAtFailure);if(t.length===0)return;let n=c(t);for(let e of t)e.remindedAtFailure=e.failures;return{messages:[...e.messages,{role:`user`,content:[{type:`text`,text:n}],timestamp:Date.now()}]}})};function u(t){r(t),l(t),e(e=>t.on(`session_start`,(t,n)=>e(n)),()=>import(`./runtime-
|
|
3
|
+
`)}const l=e=>{e.on(`tool_execution_end`,(e,t)=>{if(!e.isError)return;let n=i.exec(s(e.result));if(!n)return;let r=n[1];if(r===void 0)return;let o=a.get(r);if(o)o.failures+=1;else{if(a.size>=50){let e=a.keys().next().value;e!==void 0&&a.delete(e)}a.set(r,{tool:r,failures:1,remindedAtFailure:0})}}),e.on(`tool_execution_start`,(e,t)=>{if(e.toolName!==`write`||typeof e.args!=`object`||e.args===null||!(`path`in e.args))return;let n=e.args.path;if(typeof n!=`string`||!n.startsWith(`xd://`))return;let r=n.slice(5).split(/[/?#]/)[0];r!==void 0&&r.length!==0&&a.delete(r)}),e.on(`context`,e=>{if(a.size===0)return;let t=[...a.values()].filter(e=>e.failures>e.remindedAtFailure);if(t.length===0)return;let n=c(t);for(let e of t)e.remindedAtFailure=e.failures;return{messages:[...e.messages,{role:`user`,content:[{type:`text`,text:n}],timestamp:Date.now()}]}})};function u(t){r(t),l(t),e(e=>t.on(`session_start`,(t,n)=>e(n)),()=>import(`./runtime-CQdDwUnD.js`))}export{u as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Gs as e,Hs as t,Zs as n,_l as r,xc as i}from"./core-8rEJ9Vjy.js";import{D as a}from"./Effect-DthArEC0.js";import{C as o,S as s,_ as c,b as l,t as u,v as d,w as f,x as p,y as ee}from"./dist-UFhZvM5a.js";const m={[Symbol.for(`@effect/matcher/Matcher`)]:{_input:r,_filters:r,_remaining:r,_result:r,_provided:r,_return:r},_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?h(this.provided,n(e.evaluate(this.provided))):this},pipe(){return i(this,arguments)}};function h(e,t){let n=Object.create(m);return n.provided=e,n.value=t,n}const g=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),_=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(_),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,_(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},v=t=>h(t,e(t)),y=(e,t)=>n=>n.add(g(_(e),t)),b=(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(g(i,n))})(`_tag`),x=e=>n=>{let r=S(n);return t(r)?r._tag===`Right`?r.right:e(r.left):t=>{let n=r(t);return n._tag===`Right`?n.right:e(n.left)}},S=t=>{if(t._tag===`ValueMatcher`)return t.value;let r=t.cases.length;if(r===1){let r=t.cases[0];return t=>r._tag===`When`&&r.guard(t)===!0||r._tag===`Not`&&r.guard(t)===!1?n(r.evaluate(t)):e(t)}return i=>{for(let e=0;e<r;e++){let r=t.cases[e];if(r._tag===`When`&&r.guard(i)===!0||r._tag===`Not`&&r.guard(i)===!1)return n(r.evaluate(i))}return e(i)}},C=`effect/Match/exhaustive: absurd`,w=e=>{let n=S(e);if(t(n)){if(n._tag===`Right`)return n.right;throw Error(C)}return e=>{let t=n(e);if(t._tag===`Right`)return t.right;throw Error(C)}},T=v,E=y,D=b,O=x,k=w,A=d(`subagent_type`,`prompt`),j=Symbol.for(`@systemfsoftware/omp-agent-discipline/DelegationVerdict`);var M=class extends s()(`Allow`,{}){[j]=j},N=class extends s()(`Block`,{reason:l,how:A,skill:l}){[j]=j};o(M,N);const P=p({protectedSkills:c(l),delegationVerbs:c(l),referenceVerbs:c(l),mentionPatterns:ee({key:l,value:l})}).pipe(f({arbitrary:()=>e=>e.constant({protectedSkills:[`ce-work`],delegationVerbs:["\\binvoke\\s+(?:the\\s+)?[`/]?ce-work\\b","\\bdispatch\\s+(?:to\\s+)?(?:the\\s+)?[`/]?ce-work\\b","\\buse\\s+(?:the\\s+)?[`/]?ce-work\\b","\\bspawn\\s+(?:a\\s+)?(?:task|agent|subagent|worker)\\s+(?:with|using)\\s+(?:the\\s+)?[`/]?ce-work\\b","\\bcall\\s+(?:the\\s+)?[`/]?ce-work\\b","\\brun\\s+(?:the\\s+)?[`/]?ce-work\\b"],referenceVerbs:["\\bsee\\s+(?:the\\s+)?[`/]?ce-work\\b","\\bread\\s+(?:the\\s+)?[`/]?ce-work\\b"],mentionPatterns:{"ce-work":'(?:^|[\\s/.`"])ce-work(?=$|[\\s/.`"]|\\b)'}})})),F=o(P,d(null)),I=Symbol.for(`@systemfsoftware/omp-agent-discipline/CheckDelegationCommand`);var L=class extends s()(`CheckDelegationCommand`,{toolName:l,subagentType:l,prompt:l,guard:F}){[I]=I};const R=Symbol.for(`@systemfsoftware/omp-agent-discipline/ClassifiedInput`);var z=class extends s()(`NoGuard`,{}){[R]=R},B=class extends s()(`NonDelegatedTool`,{}){[R]=R},V=class extends s()(`ProtectedSubagent`,{skill:l}){[R]=R},H=class extends s()(`EmptyPrompt`,{}){[R]=R},U=class extends s()(`Prompted`,{guard:P,prompt:l}){[R]=R};o(z,B,V,H,U);const W=Symbol.for(`@systemfsoftware/omp-agent-discipline/PromptAnalysis`);var G=class extends s()(`Delegated`,{skill:l,excerpt:l}){[W]=W},K=class extends s()(`Referenced`,{}){[W]=W},q=class extends s()(`NoDelegation`,{}){[W]=W};o(G,K,q);function J(e,t,n){return[`⛔ BLOCKED: "`+e+`" must not be delegated to a subagent.`,`Detected in `+t+`: `+n,``,`REQUIRED: invoke `+e+` directly in THIS session via the host Skill / Tool call,`,`then pass its return envelope to the next step. Do NOT wrap it in a task / Agent dispatch.`,``,`WHY: a subagent reproduces the shape but loses the skill protocol — plan-path gate,`,`headless review contract, and pipeline-vs-chat mode. The contract does not survive the hop.`,``,`RULE: root AGENTS.md §"Skill invocations" (SK1/SK2).`].join(`
|
|
2
|
+
`)}function Y(e,t){return new RegExp(e,`i`).test(t)}function X(e,t){return e.map(e=>new RegExp(e,`i`).exec(t)).find(e=>e!==null)??null}const Z=(e,t)=>T(e.subagentType).pipe(E(e=>e!==``&&t.protectedSkills.includes(e),e=>new V({skill:e})),O(()=>T(e.prompt).pipe(E(``,()=>new H),O(e=>new U({guard:t,prompt:e}))))),Q=e=>T(e.guard).pipe(E(null,()=>new z),O(t=>T(e.toolName.toLowerCase()).pipe(E(`task`,()=>Z(e,t)),E(`agent`,()=>Z(e,t)),O(()=>new B)))),te=(e,t)=>{let n=Object.entries(e.mentionPatterns).filter(([,e])=>Y(e,t)).map(([e])=>e);return T(n).pipe(E(e=>e.length>0,([n])=>{let r=e.referenceVerbs.some(e=>Y(e,t)),i=e.delegationVerbs.some(e=>Y(e,t));return T({hasReference:r,hasDelegation:i}).pipe(E({hasReference:!0},()=>new K),E({hasDelegation:!1},()=>new q),O(()=>{let r=X(e.delegationVerbs,t);return new G({skill:n,excerpt:r===null?t.slice(0,120):r[0]})}))}),O(()=>new q))},ne=e=>T(Q(e)).pipe(D(`NoGuard`,()=>new M),D(`NonDelegatedTool`,()=>new M),D(`ProtectedSubagent`,({skill:e})=>new N({reason:J(e,`subagent_type`,e),how:`subagent_type`,skill:e})),D(`EmptyPrompt`,()=>new M),D(`Prompted`,({guard:e,prompt:t})=>T(te(e,t)).pipe(D(`Delegated`,({skill:e,excerpt:t})=>new N({reason:J(e,`prompt`,t),how:`prompt`,skill:e})),D(`Referenced`,()=>new M),D(`NoDelegation`,()=>new M),k)),k);function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function re(e){if(e.length===0)return null;let t=`(?:`+e.map($).join(`|`)+`)`;return{protectedSkills:e.slice(),delegationVerbs:["\\binvoke\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bdispatch\\s+(?:to\\s+)?(?:the\\s+)?[`/]?"+t+`\\b`,"\\bwrap\\s+(?:the\\s+)?[`/]?"+t+`\\s+in\\s+(?:a\\s+)?(?:task|agent|subagent)\\b`,"\\bdelegate\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\brun\\s+(?:the\\s+)?[`/]?"+t+`\\s+(?:via|in)\\s+(?:a\\s+)?(?:subagent|task|agent)\\b`,"\\b(?:run|execute|launch)\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bskill:\\s*[`/]?"+t+`\\b`,`\\bskill:\\/\\/`+t+`\\b`,`(?:^|\\W)/`+t+`(?=$|\\b|\\W)`,"\\buse\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bload\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bspawn\\s+(?:a\\s+)?(?:task|agent|subagent|worker)\\s+(?:with|using)\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bcall\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bsend\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bcreate\\s+(?:a\\s+)?(?:task|agent|subagent)\\s+(?:with|using)\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bstart\\s+(?:the\\s+)?[`/]?"+t+`\\b`],referenceVerbs:["\\bsee\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bper\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\bread\\s+(?:the\\s+)?[`/]?"+t+`\\b`,"\\baccording\\s+to\\s+(?:the\\s+)?[`/]?"+t+`\\b`],mentionPatterns:Object.fromEntries(e.map(e=>[e,'(?:^|[\\s/.`"])'+$(e)+'(?=$|[\\s/.`"]|\\b)']))}}function ie(e){return T(e).pipe(D(`Block`,e=>({block:!0,reason:e.reason,how:e.how,skill:e.skill})),D(`Allow`,()=>void 0),k)}function ae(e){return a(function*(){return re((yield*(yield*u).load(e)).no_delegate_skills??[])})}function oe(e,t,n,r){return a(function*(){return ie(ne(new L({toolName:t,subagentType:n,prompt:r,guard:yield*ae(e)})))})}export{oe as runNoSkillDelegation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cs as e,Er as t,Fs as n,Kt as r,Lr as i,Rs as a,Ts as o,mr as s,mt as c,vl as l,vn as u,wr as d,xc as ee,xs as te,yn as ne}from"./core-8rEJ9Vjy.js";import{B as re,Bt as ie,Gt as ae,H as f,Ht as p,Jt as m,Kt as oe,Lt as se,P as h,Q as g,Rt as _,Sn as v,Ut as y,Vt as b,Wt as x,Xt as ce,Yt as le,_ as S,an as ue,b as C,c as w,dt as de,et as fe,f as pe,it as me,mn as he,mt as ge,n as T,nn as E,nt as D,on as _e,qt as ve,r as O,rt as k,st as A,tt as j,un as M,zt as N}from"./Effect-DthArEC0.js";import{D as P,E as F,T as ye,a as be,c as xe,d as Se,f as Ce,g as we,h as Te,i as Ee,l as De,m as I,n as Oe,o as L,p as ke,r as R,s as z,u as Ae}from"./dist-UFhZvM5a.js";import*as je from"node:crypto";import*as B from"node:path";import*as V from"node:fs";import*as Me from"node:os";function H(e,t){return u(e.runtimeEffect,e=>i(n=>(n.setFiberRefs(e.fiberRefs),n.currentRuntimeFlags=e.runtimeFlags,s(t,e.context))))}const Ne={...v,[E]:E,pipe(){return ee(this,arguments)},commit(){return this.runtimeEffect}},Pe=(e,n)=>{n??=_();let i=m(M()),a,o=d(()=>{if(!a){let r=new he;a=b(t(_e(se(e,n),i),e=>{s.cachedRuntime=e}),{scope:i,scheduler:r}),r.flush()}return ne(a.await)}),s=Object.assign(Object.create(Ne),{memoMap:n,scope:i,runtimeEffect:o,cachedRuntime:void 0,runtime(){return s.cachedRuntime===void 0?x(s.runtimeEffect):Promise.resolve(s.cachedRuntime)},dispose(){return x(s.disposeEffect)},disposeEffect:d(()=>(s.runtimeEffect=c(`ManagedRuntime disposed`),s.cachedRuntime=void 0,ue(s.scope,r))),runFork(e,t){return s.cachedRuntime===void 0?b(H(s,e),t):ie(s.cachedRuntime)(e,t)},runSyncExit(e){return s.cachedRuntime===void 0?ce(H(s,e)):le(s.cachedRuntime)(e)},runSync(e){return s.cachedRuntime===void 0?m(H(s,e)):ve(s.cachedRuntime)(e)},runPromiseExit(e,t){return s.cachedRuntime===void 0?oe(H(s,e),t):ae(s.cachedRuntime)(e,t)},runCallback(e,t){return s.cachedRuntime===void 0?p(N)(H(s,e),t):p(s.cachedRuntime)(e,t)},runPromise(e,t){return s.cachedRuntime===void 0?x(H(s,e),t):y(s.cachedRuntime)(e,t)}});return s},U=(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 I({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},W=(e,t,n)=>(...r)=>w(i=>{try{e(...r,(e,n)=>{i(e?S(t?t(e,r):e):j(n))})}catch(e){i(n?S(n(e,r)):pe(e))}}),G=e=>t=>new ke({module:`FileSystem`,method:e,cause:t}),Fe=(()=>{let e=W(V.access,U(`FileSystem`,`access`),G(`access`));return(t,n)=>{let r=V.constants.F_OK;return n?.readable&&(r|=V.constants.R_OK),n?.writable&&(r|=V.constants.W_OK),e(t,r)}})(),Ie=(()=>{let e=W(V.cp,U(`FileSystem`,`copy`),G(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),Le=(()=>{let e=W(V.copyFile,U(`FileSystem`,`copyFile`),G(`copyFile`));return(t,n)=>e(t,n)})(),Re=(()=>{let e=W(V.chmod,U(`FileSystem`,`chmod`),G(`chmod`));return(t,n)=>e(t,n)})(),ze=(()=>{let e=W(V.chown,U(`FileSystem`,`chown`),G(`chown`));return(t,n,r)=>e(t,n,r)})(),Be=(()=>{let e=W(V.link,U(`FileSystem`,`link`),G(`link`));return(t,n)=>e(t,n)})(),Ve=(()=>{let e=W(V.mkdir,U(`FileSystem`,`makeDirectory`),G(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),K=e=>{let t=W(V.mkdtemp,U(`FileSystem`,e),G(e));return e=>D(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?B.join(e.directory,`.`):Me.tmpdir();return t(n?B.join(r,n):r+`/`)})},He=K(`makeTempDirectory`),q=e=>{let t=W(V.rm,U(`FileSystem`,e),G(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},Ue=q(`remove`),We=(()=>{let e=K(`makeTempDirectoryScoped`),t=q(`makeTempDirectoryScoped`);return n=>O(e(n),e=>f(t(e,{recursive:!0})))})(),J=e=>{let t=W(V.open,U(`FileSystem`,e),G(e)),n=W(V.close,U(`FileSystem`,e),G(e));return(e,r)=>l(O(t(e,r?.flag??`r`,r?.mode),e=>f(n(e))),h(e=>Ke(Ee(e),r?.flag?.startsWith(`a`)??!1)))},Ge=J(`open`),Ke=(()=>{let e=e=>W(V.read,U(`FileSystem`,e),G(e)),t=e(`read`),r=e(`readAlloc`),i=W(V.fstat,U(`FileSystem`,`stat`),G(`stat`)),o=W(V.ftruncate,U(`FileSystem`,`truncate`),G(`truncate`)),s=W(V.fsync,U(`FileSystem`,`sync`),G(`sync`)),c=e=>W(V.write,U(`FileSystem`,e),G(e)),l=c(`write`),u=c(`writeAll`);class d{fd;append;[L];semaphore=de(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[L]=L}get stat(){return h(i(this.fd),Z)}get sync(){return s(this.fd)}seek(e,t){let n=z(e);return this.semaphore.withPermits(1)(k(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(h(D(()=>t(this.fd,{buffer:e,position:this.position})),e=>{let t=z(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(C(k(()=>Buffer.allocUnsafeSlow(t)),e=>h(r(this.fd,{buffer:e,position:this.position}),r=>{if(r===0)return n();if(this.position+=BigInt(r),r===t)return a(e);let i=Buffer.allocUnsafeSlow(r);return e.copy(i,0,0,r),a(i)})))}truncate(e){return this.semaphore.withPermits(1)(h(o(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(D(()=>l(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=z(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return C(D(()=>u(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?S(new I({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)):T))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new d(e,t)})(),Y=e=>{let t=K(e),n=J(e),r=e=>k(()=>je.randomBytes(e).toString(`hex`));return e=>l(ge(t(e),r(6)),h(([t,n])=>B.join(t,n+(e?.suffix??``))),me(e=>g(n(e,{flag:`w+`}))))},qe=Y(`makeTempFile`),Je=(()=>{let e=Y(`makeTempFileScoped`),t=q(`makeTempFileScoped`);return n=>O(e(n),e=>f(t(B.dirname(e),{recursive:!0})))})(),Ye=(e,t)=>A({try:()=>V.promises.readdir(e,t),catch:t=>U(`FileSystem`,`readDirectory`)(t,[e])}),Xe=e=>w((t,n)=>{try{V.readFile(e,{signal:n},(n,r)=>{t(n?S(U(`FileSystem`,`readFile`)(n,[e])):j(r))})}catch(e){t(S(G(`readFile`)(e)))}}),Ze=(()=>{let e=W(V.readlink,U(`FileSystem`,`readLink`),G(`readLink`));return t=>e(t)})(),X=(()=>{let e=W(V.realpath,U(`FileSystem`,`realPath`),G(`realPath`));return t=>e(t)})(),Qe=(()=>{let e=W(V.rename,U(`FileSystem`,`rename`),G(`rename`));return(t,n)=>e(t,n)})(),Z=t=>({type:t.isFile()?`File`:t.isDirectory()?`Directory`:t.isSymbolicLink()?`SymbolicLink`:t.isBlockDevice()?`BlockDevice`:t.isCharacterDevice()?`CharacterDevice`:t.isFIFO()?`FIFO`:t.isSocket()?`Socket`:`Unknown`,mtime:e(t.mtime),atime:e(t.atime),birthtime:e(t.birthtime),dev:t.dev,rdev:e(t.rdev),ino:e(t.ino),mode:t.mode,nlink:e(t.nlink),uid:e(t.uid),gid:e(t.gid),size:z(t.size),blksize:e(z(t.blksize)),blocks:e(t.blocks)}),Q=(()=>{let e=W(V.stat,U(`FileSystem`,`stat`),G(`stat`));return t=>h(e(t),Z)})(),$e=(()=>{let e=W(V.symlink,U(`FileSystem`,`symlink`),G(`symlink`));return(t,n)=>e(t,n)})(),et=(()=>{let e=W(V.truncate,U(`FileSystem`,`truncate`),G(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),tt=(()=>{let e=W(V.utimes,U(`FileSystem`,`utime`),G(`utime`));return(t,n,r)=>e(t,n,r)})(),nt=(e,t)=>Te(n=>O(k(()=>{let r=V.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(re(Q(t),{onSuccess:e=>j(De({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?j(Ae({path:t})):S(e)}));return;case`change`:n.single(Se({path:t}));return}});return r.on(`error`,t=>{n.fail(new I({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>k(()=>e.close()))),rt=(e,t,n)=>Q(t).pipe(h(r=>e.pipe(te(e=>e.register(t,r,n)),o(()=>nt(t,n)))),we),it=(e,t,n)=>w((r,i)=>{try{V.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?S(U(`FileSystem`,`writeFile`)(t,[e])):T)})}catch(e){r(S(G(`writeFile`)(e)))}}),$=ye(be,h(fe(xe),e=>Ce({access:Fe,chmod:Re,chown:ze,copy:Ie,copyFile:Le,link:Be,makeDirectory:Ve,makeTempDirectory:He,makeTempDirectoryScoped:We,makeTempFile:qe,makeTempFileScoped:Je,open:Ge,readDirectory:Ye,readFile:Xe,readLink:Ze,realPath:X,remove:Ue,rename:Qe,stat:Q,symlink:$e,truncate:et,utimes:tt,watch(t,n){return rt(e,t,n)},writeFile:it}))),at=Pe(F($,R,Oe.pipe(P($),P(R))));export{at as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/omp-agent-discipline",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"description": "OMP agent discipline: mechanical enforcement of rules prose can't hold (xd:// retry guard, ...)",
|
|
7
7
|
"type": "module",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"tsdown": "^0.22.9",
|
|
30
30
|
"typescript": "^7",
|
|
31
31
|
"vitest": "^4",
|
|
32
|
-
"@systemfsoftware/effect-gherkin-spec": "^0.
|
|
33
|
-
"@systemfsoftware/
|
|
34
|
-
"@systemfsoftware/tsconfig": "^1.2.5",
|
|
32
|
+
"@systemfsoftware/effect-gherkin-spec": "^0.4.0",
|
|
33
|
+
"@systemfsoftware/effect-memfs": "^1.0.8",
|
|
35
34
|
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
36
|
-
"@systemfsoftware/
|
|
35
|
+
"@systemfsoftware/omp-utils": "^0.0.0",
|
|
36
|
+
"@systemfsoftware/tsconfig": "^1.2.6"
|
|
37
37
|
},
|
|
38
38
|
"omp": {
|
|
39
39
|
"extensions": [
|