@systemfsoftware/omp-claude-compat 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +0,0 @@
1
- const e=e=>typeof e==`function`,t=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};case 4:return function(e,n,r,i){return arguments.length>=4?t(e,n,r,i):function(i){return t(i,e,n,r)}};case 5:return function(e,n,r,i,a){return arguments.length>=5?t(e,n,r,i,a):function(a){return t(a,e,n,r,i)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},n=e=>e,r=e=>()=>e,i=r(!0),a=r(!1),o=r(null),s=r(void 0),c=s;function l(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return a(i(r(n(t(e)))));case 7:return o(a(i(r(n(t(e))))));case 8:return s(o(a(i(r(n(t(e)))))));case 9:return c(s(o(a(i(r(n(t(e))))))));default:{let e=arguments[0];for(let t=1;t<arguments.length;t++)e=arguments[t](e);return e}}}const u=e=>(t,n)=>t===n||e(t,n),d=(e,t)=>e===t,ee=t(2,(e,t)=>u((n,r)=>e(t(n),t(r)))),f=ee(d,e=>e.getTime()),te=e=>u((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),ne=`effect/GlobalValue`;let re;const p=(e,t)=>(re||=(globalThis[ne]??=new Map,globalThis[ne]),re.has(e)||re.set(e,t()),re.get(e)),ie=e=>!!e,ae=e=>typeof e==`string`,oe=e=>typeof e==`number`,se=e=>typeof e==`boolean`,ce=e=>typeof e==`bigint`,le=e=>typeof e==`symbol`,ue=e,de=e=>e===void 0,fe=e=>e!==void 0,pe=e=>e!==null,me=e=>!1,he=e=>typeof e==`object`&&!!e,ge=e=>he(e)||ue(e),m=t(2,(e,t)=>ge(e)&&t in e),_e=t(2,(e,t)=>m(e,`_tag`)&&e._tag===t),ve=e=>e==null,ye=e=>e!=null,be=e=>e instanceof Uint8Array,xe=e=>e instanceof Date,Se=e=>typeof e==`string`||m(e,Symbol.iterator),Ce=e=>he(e)&&!Array.isArray(e),we=e=>m(e,`then`)&&ue(e.then),Te=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`;var Ee=class e{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new e(this.self)}},De=class{_state;constructor(e,t,n,r){return ve(t)&&ve(e)?(t=Math.random()*4294967295>>>0,e=0):ve(t)&&(t=e,e=0),ve(r)&&ve(n)?(r=this._state?this._state[3]:4150755663,n=this._state?this._state[2]:335903614):ve(r)&&(r=n,n=0),this._state=new Int32Array([0,0,n>>>0,((r||0)|1)>>>0]),this._next(),ke(this._state,this._state[0],this._state[1],e>>>0,t>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(e){this._state[0]=e[0],this._state[1]=e[1],this._state[2]=e[2],this._state[3]=e[3]|1}integer(e){return Math.round(this.number()*(2**53-1))%e}number(){let e=(this._next()&67108863)*1,t=(this._next()&134217727)*1;return(e*134217728+t)/9007199254740992}_next(){let e=this._state[0]>>>0,t=this._state[1]>>>0;Oe(this._state,e,t,1481765933,1284865837),ke(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let n=e>>>18,r=(t>>>18|e<<14)>>>0;n=(n^e)>>>0,r=(r^t)>>>0;let i=(r>>>27|n<<5)>>>0,a=e>>>27,o=(-a>>>0&31)>>>0;return(i>>>a|i<<o)>>>0}};function Oe(e,t,n,r,i){let a=(n>>>16)*(i&65535)>>>0,o=(n&65535)*(i>>>16)>>>0,s=(n&65535)*(i&65535)>>>0,c=(n>>>16)*(i>>>16)+((o>>>16)+(a>>>16))>>>0;o=o<<16>>>0,s=s+o>>>0,s>>>0<o>>>0&&(c=c+1>>>0),a=a<<16>>>0,s=s+a>>>0,s>>>0<a>>>0&&(c=c+1>>>0),c=c+Math.imul(n,r)>>>0,c=c+Math.imul(t,i)>>>0,e[0]=c,e[1]=s}function ke(e,t,n,r,i){let a=t+r>>>0,o=n+i>>>0;o>>>0<n>>>0&&(a=a+1|0),e[0]=a,e[1]=o}const Ae=Symbol.for(`effect/Utils/YieldWrap`);var je=class{#e;constructor(e){this.#e=e}[Ae](){return this.#e}};function Me(e){if(typeof e==`object`&&e&&Ae in e)return e[Ae]();throw Error(Te(`yieldWrapGet`))}const h=p(`effect/Utils/isStructuralRegion`,()=>({enabled:!1,tester:void 0})),Ne={effect_internal_function:e=>e()},Pe=Ne.effect_internal_function(()=>Error().stack)?.includes(`effect_internal_function`)===!0?Ne.effect_internal_function:{effect_internal_function:e=>{try{return e()}finally{}}}.effect_internal_function,Fe=function*(){}.constructor,Ie=e=>ge(e)&&e.constructor===Fe,Le=p(Symbol.for(`effect/Hash/randomHashCache`),()=>new WeakMap),g=Symbol.for(`effect/Hash`),_=e=>{if(h.enabled===!0)return 0;switch(typeof e){case`number`:return Ve(e);case`bigint`:return y(e.toString(10));case`boolean`:return y(String(e));case`symbol`:return y(String(e));case`string`:return y(e);case`undefined`:return y(`undefined`);case`function`:case`object`:return e===null?y(`null`):e instanceof Date?Number.isNaN(e.getTime())?y(`Invalid Date`):_(e.toISOString()):e instanceof URL?_(e.href):Be(e)?e[g]():Re(e);default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Re=e=>(Le.has(e)||Le.set(e,Ve(Math.floor(Math.random()*(2**53-1)))),Le.get(e)),v=e=>t=>t*53^e,ze=e=>e&3221225471|e>>>1&1073741824,Be=e=>m(e,g),Ve=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return ze(t)},y=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ze(t)},He=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=l(y(t[r]),v(_(e[t[r]])));return ze(n)},Ue=e=>He(e,Object.keys(e)),We=e=>{let t=6151;for(let n=0;n<e.length;n++)t=l(t,v(_(e[n])));return ze(t)},b=function(){if(arguments.length===1){let e=arguments[0];return function(t){return Object.defineProperty(e,g,{value(){return t},enumerable:!1}),t}}let e=arguments[0],t=arguments[1];return Object.defineProperty(e,g,{value(){return t},enumerable:!1}),t},x=Symbol.for(`effect/Equal`);function S(){return arguments.length===1?e=>Ge(e,arguments[0]):Ge(arguments[0],arguments[1])}function Ge(e,t){if(e===t)return!0;let n=typeof e;if(n!==typeof t)return!1;if(n===`object`||n===`function`){if(e!==null&&t!==null){if(Ke(e)&&Ke(t))return _(e)===_(t)&&e[x](t)?!0:h.enabled&&h.tester?h.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(h.enabled){if(e===null||t===null)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>Ge(e,t[n]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let n=Object.keys(e),r=Object.keys(t);if(n.length===r.length){for(let r of n)if(!(r in t&&Ge(e[r],t[r])))return h.tester?h.tester(e,t):!1;return!0}}return h.tester?h.tester(e,t):!1}}return h.enabled&&h.tester?h.tester(e,t):!1}const Ke=e=>m(e,x),qe=()=>S,C=Symbol.for(`nodejs.util.inspect.custom`),w=e=>{try{if(m(e,`toJSON`)&&ue(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(w)}catch{return{}}return ot(e)},Je=`[Circular]`;function Ye(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Xe(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Ze(e){return ae(e)?JSON.stringify(e):String(e)}function Qe(e,t){let n=t?.space??0,r=new WeakSet,i=n?oe(n)?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return Je;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
2
- `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(xe(e))return Ye(e);if(!t?.ignoreToString&&m(e,`toString`)&&ue(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Xe(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(ae(e))return JSON.stringify(e);if(oe(e)||e==null||se(e)||le(e))return String(e);if(ce(e))return String(e)+`n`;if(e instanceof Set||e instanceof Map)return r.has(e)?Je:(r.add(e),`${e.constructor.name}(${c(Array.from(e),n)})`);if(ge(e)){if(r.has(e))return Je;r.add(e);let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Ze(t)}:${c(e[t],n)}`).join(`,`)}}`;return o(e,r)}let l=`{\n${t.map(t=>`${a(n+1)}${Ze(t)}: ${c(e[t],n+1)}`).join(`,
3
- `)}\n${a(n)}}`;return o(e,l)}return String(e)}return c(e,0)}const T=e=>JSON.stringify(e,null,2),$e={toJSON(){return w(this)},[C](){return this.toJSON()},toString(){return T(this.toJSON())}},et=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?tt(e,t):String(e)}catch{return String(e)}},tt=(e,t)=>{let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&(it.fiberRefs!==void 0&&rt(t)?t[nt](it.fiberRefs):t):t,t);return n=void 0,r},nt=Symbol.for(`effect/Inspectable/Redactable`),rt=e=>typeof e==`object`&&!!e&&nt in e,it=p(`effect/Inspectable/redactableState`,()=>({fiberRefs:void 0})),at=(e,t)=>{let n=it.fiberRefs;it.fiberRefs=e;try{return t()}finally{it.fiberRefs=n}},ot=e=>rt(e)&&it.fiberRefs!==void 0?e[nt](it.fiberRefs):e,E=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},st=`Async`,ct=`Commit`,D=`Failure`,lt=`OnFailure`,ut=`OnSuccess`,dt=`OnSuccessAndFailure`,O=`Success`,ft=`Sync`,pt=`UpdateRuntimeFlags`,mt=`While`,ht=`Iterator`,gt=`WithRuntime`,_t=`Yield`,vt=`RevertFlags`,yt=()=>`3.22.0`,bt=Symbol.for(`effect/Effect`),xt=Symbol.for(`effect/Stream`),St=Symbol.for(`effect/Sink`),Ct=Symbol.for(`effect/Channel`),wt={_R:e=>e,_E:e=>e,_A:e=>e,_V:yt()},Tt={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},Et={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Dt={[bt]:wt,[xt]:wt,[St]:Tt,[Ct]:Et,[x](e){return this===e},[g](){return b(this,Re(this))},[Symbol.iterator](){return new Ee(new je(this))},pipe(){return E(this,arguments)}},Ot={[g](){return b(this,Ue(this))},[x](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let n of t)if(!(n in e&&S(this[n],e[n])))return!1;return!0}},kt={...Dt,_op:ct},At={...kt,...Ot},jt=function(){function e(){}return e.prototype=kt,e}(),Mt=Symbol.for(`effect/Option`),Nt={...Dt,[Mt]:{_A:e=>e},[C](){return this.toJSON()},toString(){return T(this.toJSON())}},Pt=Object.assign(Object.create(Nt),{_tag:`Some`,_op:`Some`,[x](e){return Lt(e)&&zt(e)&&S(this.value,e.value)},[g](){return b(this,v(_(this._tag))(_(this.value)))},toJSON(){return{_id:`Option`,_tag:this._tag,value:w(this.value)}}}),Ft=_(`None`),It=Object.assign(Object.create(Nt),{_tag:`None`,_op:`None`,[x](e){return Lt(e)&&Rt(e)},[g](){return Ft},toJSON(){return{_id:`Option`,_tag:this._tag}}}),Lt=e=>m(e,Mt),Rt=e=>e._tag===`None`,zt=e=>e._tag===`Some`,Bt=Object.create(It),Vt=e=>{let t=Object.create(Pt);return t.value=e,t},Ht=Symbol.for(`effect/Either`),Ut={...Dt,[Ht]:{_R:e=>e},[C](){return this.toJSON()},toString(){return T(this.toJSON())}},Wt=Object.assign(Object.create(Ut),{_tag:`Right`,_op:`Right`,[x](e){return Kt(e)&&Jt(e)&&S(this.right,e.right)},[g](){return v(_(this._tag))(_(this.right))},toJSON(){return{_id:`Either`,_tag:this._tag,right:w(this.right)}}}),Gt=Object.assign(Object.create(Ut),{_tag:`Left`,_op:`Left`,[x](e){return Kt(e)&&qt(e)&&S(this.left,e.left)},[g](){return v(_(this._tag))(_(this.left))},toJSON(){return{_id:`Either`,_tag:this._tag,left:w(this.left)}}}),Kt=e=>m(e,Ht),qt=e=>e._tag===`Left`,Jt=e=>e._tag===`Right`,Yt=e=>{let t=Object.create(Gt);return t.left=e,t},Xt=e=>{let t=Object.create(Wt);return t.right=e,t},Zt=e=>qt(e)?Bt:Vt(e.right),Qt=t(2,(e,t)=>Rt(e)?Yt(t()):Xt(e.value)),k=Xt,$t=Yt,en=Qt,tn=e=>{if(ue(e))try{return k(e())}catch(e){return $t(e)}else try{return k(e.try())}catch(t){return $t(e.catch(t))}},nn=Kt,rn=qt,an=Jt,on=t(2,(e,{onLeft:t,onRight:n})=>rn(e)?$t(t(e.left)):k(n(e.right))),sn=t(2,(e,t)=>rn(e)?$t(t(e.left)):k(e.right)),cn=t(2,(e,t)=>an(e)?k(t(e.right)):$t(e.left)),ln=t(2,(e,{onLeft:t,onRight:n})=>rn(e)?t(e.left):n(e.right)),un=ln({onLeft:n,onRight:n}),dn=t(2,(e,t)=>{if(an(e))return e.right;throw t(e.left)}),fn=dn(()=>Error(`getOrThrow called on a Left`)),pn=e=>e.length>0,A=()=>Bt,j=Vt,mn=Lt,M=Rt,N=zt,hn=t(2,(e,{onNone:t,onSome:n})=>M(e)?t():n(e.value)),gn=Zt,_n=t(2,(e,t)=>M(e)?t():e.value),vn=t(2,(e,t)=>M(e)?t():e),yn=t(2,(e,t)=>M(e)?j(t()):e),bn=e=>e==null?A():j(e),xn=_n(o),Sn=_n(s),Cn=e=>(...t)=>{try{return j(e(...t))}catch{return A()}},wn=t(2,(e,t)=>{if(N(e))return e.value;throw t()}),Tn=wn(()=>Error(`getOrThrow called on a None`)),En=t(2,(e,t)=>M(e)?A():j(t(e.value))),Dn=t(2,(e,t)=>M(e)?A():t(e.value)),On=t(2,(e,t)=>M(e)?A():bn(t(e.value))),kn=Dn,An=t(2,(e,t)=>kn(e,e=>t(e)?Vt(e):Bt)),jn=e=>u((t,n)=>M(t)?M(n):!M(n)&&e(t.value,n.value)),Mn=t(2,(e,t)=>t(e)?j(e):A()),Nn=(e=>t(2,(t,n)=>!M(t)&&e(t.value,n)))(qe()),Pn=t(2,(e,t)=>!M(e)&&t(e.value)),Fn=e=>(t,n)=>M(t)?n:M(n)?t:j(e(t.value,n.value)),In=(...e)=>e,Ln=e=>Array(e),Rn=t(2,(e,t)=>{let n=Math.max(1,Math.floor(e)),r=Array(n);for(let e=0;e<n;e++)r[e]=t(e);return r}),P=e=>Array.isArray(e)?e:Array.from(e),zn=e=>Array.isArray(e)?e:[e],Bn=t(2,(e,{onEmpty:t,onNonEmpty:n})=>qn(e)?n($n(e),nr(e)):t()),Vn=t(2,(e,t)=>[t,...e]),Hn=t(2,(e,t)=>[...e,t]),Un=t(2,(e,t)=>P(e).concat(P(t))),Wn=Array.isArray,Gn=e=>e.length===0,Kn=pn,qn=pn,Jn=(e,t)=>e<0||e>=t.length,Yn=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),Xn=t(2,(e,t)=>{let n=Math.floor(t);return Jn(n,e)?A():j(e[n])}),Zn=t(2,(e,t)=>{let n=Math.floor(t);if(Jn(n,e))throw Error(`Index ${n} out of bounds`);return e[n]}),Qn=Xn(0),$n=Zn(0),er=e=>qn(e)?j(tr(e)):A(),tr=e=>e[e.length-1],nr=e=>e.slice(1),rr=(e,t)=>{let n=0;for(let r of e){if(!t(r,n))break;n++}return n},ir=t(2,(e,t)=>dr(e,rr(e,t))),ar=t(2,(e,t)=>{let n=P(e);return n.slice(Yn(t,n),n.length)}),or=e=>Array.from(e).reverse(),sr=t(2,(e,t)=>{let n=Array.from(e);return n.sort(t),n}),cr=t(2,(e,t)=>lr(e,t,In)),lr=t(3,(e,t,n)=>{let r=P(e),i=P(t);if(qn(r)&&qn(i)){let e=[n($n(r),$n(i))],t=Math.min(r.length,i.length);for(let a=1;a<t;a++)e[a]=n(r[a],i[a]);return e}return[]}),ur=qe(),dr=t(2,(e,t)=>{let n=Array.from(e),r=Math.floor(t);return qn(n)?r>=1?fr(n,r):[[],n]:[n,[]]}),fr=t(2,(e,t)=>{let n=Math.max(1,Math.floor(t));return n>=e.length?[pr(e),[]]:[Vn(e.slice(1,n),$n(e)),e.slice(n)]}),pr=e=>e.slice(),mr=t(3,(e,t,n)=>{let r=P(e),i=P(t);return qn(r)?qn(i)?kr(n)(Un(r,i)):r:i}),hr=t(2,(e,t)=>mr(e,t,ur)),gr=()=>[],_r=e=>[e],vr=t(2,(e,t)=>e.map(t)),yr=t(2,(e,t)=>{if(Gn(e))return[];let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r);for(let e=0;e<i.length;e++)n.push(i[e])}return n}),br=yr(n),xr=t(2,(e,t)=>{let n=P(e),r=[];for(let e=0;e<n.length;e++){let i=t(n[e],e);N(i)&&r.push(i.value)}return r}),Sr=t(2,(e,t)=>{let n=[],r=[],i=P(e);for(let e=0;e<i.length;e++){let a=t(i[e],e);rn(a)?n.push(a.left):r.push(a.right)}return[n,r]}),Cr=xr(n),wr=t(2,(e,t)=>{let n=P(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),Tr=t(3,(e,t,n)=>P(e).reduce((e,t,r)=>n(e,t,r),t)),Er=t(3,(e,t,n)=>P(e).reduceRight((e,t,r)=>n(e,t,r),t)),Dr=(e,t)=>{let n=[],r=e,i;for(;N(i=t(r));){let[e,t]=i.value;n.push(e),r=t}return n},Or=te,kr=t(2,(e,t)=>{let n=P(e);if(qn(n)){let e=[$n(n)],r=nr(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),Ar=e=>kr(e,qe()),jr=t(2,(e,t)=>P(e).join(t)),Mr=Symbol.for(`effect/Chunk`);function Nr(e,t,n,r,i){for(let a=t;a<Math.min(e.length,t+i);a++)n[r+a-t]=e[a];return n}const Pr=[],Fr=(e=>u((t,n)=>t.length===n.length&&Ur(t).every((t,r)=>e(t,Jr(n,r)))))(S),Ir={[Mr]:{_A:e=>e},toString(){return T(this.toJSON())},toJSON(){return{_id:`Chunk`,values:Ur(this).map(w)}},[C](){return this.toJSON()},[x](e){return Lr(e)&&Fr(this,e)},[g](){return b(this,We(Ur(this)))},[Symbol.iterator](){switch(this.backing._tag){case`IArray`:return this.backing.array[Symbol.iterator]();case`IEmpty`:return Pr[Symbol.iterator]();default:return Ur(this)[Symbol.iterator]()}},pipe(){return E(this,arguments)}},F=e=>{let t=Object.create(Ir);switch(t.backing=e,e._tag){case`IEmpty`:t.length=0,t.depth=0,t.left=t,t.right=t;break;case`IConcat`:t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break;case`IArray`:t.length=e.array.length,t.depth=0,t.left=Rr,t.right=Rr;break;case`ISingleton`:t.length=1,t.depth=0,t.left=Rr,t.right=Rr;break;case`ISlice`:t.length=e.length,t.depth=e.chunk.depth+1,t.left=Rr,t.right=Rr;break}return t},Lr=e=>m(e,Mr),Rr=F({_tag:`IEmpty`}),I=()=>Rr,zr=(...e)=>qr(e),L=e=>F({_tag:`ISingleton`,a:e}),Br=e=>Lr(e)?e:Kr(P(e)),Vr=(e,t,n)=>{switch(e.backing._tag){case`IArray`:Nr(e.backing.array,0,t,n,e.length);break;case`IConcat`:Vr(e.left,t,n),Vr(e.right,t,n+e.left.length);break;case`ISingleton`:t[n]=e.backing.a;break;case`ISlice`:{let r=0,i=n;for(;r<e.length;)t[i]=Jr(e,r),r+=1,i+=1;break}}},Hr=e=>Ur(e).slice(),Ur=e=>{switch(e.backing._tag){case`IEmpty`:return Pr;case`IArray`:return e.backing.array;default:{let t=Array(e.length);return Vr(e,t,0),e.backing={_tag:`IArray`,array:t},e.left=Rr,e.right=Rr,e.depth=0,t}}},Wr=e=>{switch(e.backing._tag){case`IEmpty`:case`ISingleton`:return e;case`IArray`:return F({_tag:`IArray`,array:or(e.backing.array)});case`IConcat`:return F({_tag:`IConcat`,left:Wr(e.backing.right),right:Wr(e.backing.left)});case`ISlice`:return Kr(or(Ur(e)))}},Gr=t(2,(e,t)=>t<0||t>=e.length?A():j(Jr(e,t))),Kr=e=>e.length===0?I():e.length===1?L(e[0]):F({_tag:`IArray`,array:e}),qr=e=>Kr(e),Jr=t(2,(e,t)=>{switch(e.backing._tag){case`IEmpty`:throw Error(`Index out of bounds`);case`ISingleton`:if(t!==0)throw Error(`Index out of bounds`);return e.backing.a;case`IArray`:if(t>=e.length||t<0)throw Error(`Index out of bounds`);return e.backing.array[t];case`IConcat`:return t<e.left.length?Jr(e.left,t):Jr(e.right,t-e.left.length);case`ISlice`:return Jr(e.backing.chunk,t+e.backing.offset)}}),Yr=t(2,(e,t)=>Qr(e,L(t))),Xr=t(2,(e,t)=>Qr(L(t),e)),Zr=t(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Rr;switch(e.backing._tag){case`ISlice`:return F({_tag:`ISlice`,chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case`IConcat`:return t>e.left.length?Zr(e.right,t-e.left.length):F({_tag:`IConcat`,left:Zr(e.left,t),right:e.right});default:return F({_tag:`ISlice`,chunk:e,offset:t,length:e.length-t})}}),Qr=t(2,(e,t)=>{if(e.backing._tag===`IEmpty`)return t;if(t.backing._tag===`IEmpty`)return e;let n=t.depth-e.depth;if(Math.abs(n)<=1)return F({_tag:`IConcat`,left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){let n=Qr(e.right,t);return F({_tag:`IConcat`,left:e.left,right:n})}else{let n=Qr(e.right.right,t);if(n.depth===e.depth-3){let t=F({_tag:`IConcat`,left:e.right.left,right:n});return F({_tag:`IConcat`,left:e.left,right:t})}else{let t=F({_tag:`IConcat`,left:e.left,right:e.right.left});return F({_tag:`IConcat`,left:t,right:n})}}else if(t.right.depth>=t.left.depth){let n=Qr(e,t.left);return F({_tag:`IConcat`,left:n,right:t.right})}else{let n=Qr(e,t.left.left);if(n.depth===t.depth-3){let e=F({_tag:`IConcat`,left:n,right:t.left.right});return F({_tag:`IConcat`,left:e,right:t.right})}else{let e=F({_tag:`IConcat`,left:t.left.right,right:t.right});return F({_tag:`IConcat`,left:n,right:e})}}}),$r=t(2,(e,t)=>Kr(wr(e,t))),ei=e=>e.length===0,ti=e=>e.length>0,ni=Gr(0),ri=e=>Jr(e,0),ii=ri,ai=t(2,(e,t)=>e.backing._tag===`ISingleton`?L(t(e.backing.a,0)):Kr(l(Ur(e),vr((e,n)=>t(e,n))))),oi=e=>Zr(e,1),si=Tr;function ci(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function li(e,t){return t>>>e&31}function ui(e){return 1<<e}function di(e,t){return ci(e&t-1)}const fi=(e,t)=>({value:e,previous:t});function pi(e,t,n,r){let i=r;if(!e){let e=r.length;i=Array(e);for(let t=0;t<e;++t)i[t]=r[t]}return i[t]=n,i}function mi(e,t,n){let r=n.length-1,i=0,a=0,o=n;if(e)i=a=t;else for(o=Array(r);i<t;)o[a++]=n[i++];for(++i;i<=r;)o[a++]=n[i++];return e&&(o.length=r),o}function hi(e,t,n,r){let i=r.length;if(e){let e=i;for(;e>=t;)r[e--]=r[e];return r[t]=n,r}let a=0,o=0,s=Array(i+1);for(;a<t;)s[o++]=r[a++];for(s[t]=n;a<i;)s[++o]=r[a++];return s}var gi=class e{_tag=`EmptyNode`;modify(t,n,r,i,a,o){let s=r(A());return M(s)?new e:(++o.value,new yi(t,i,a,s))}};function R(e){return _e(e,`EmptyNode`)}function _i(e){return R(e)||e._tag===`LeafNode`||e._tag===`CollisionNode`}function vi(e,t){return!R(e)&&t===e.edit}var yi=class e{edit;hash;key;value;_tag=`LeafNode`;constructor(e,t,n,r){this.edit=e,this.hash=t,this.key=n,this.value=r}modify(t,n,r,i,a,o){if(S(a,this.key)){let n=r(this.value);return n===this.value?this:M(n)?(--o.value,new gi):vi(this,t)?(this.value=n,this):new e(t,i,a,n)}let s=r(A());return M(s)?this:(++o.value,Ei(t,n,this.hash,this,i,new e(t,i,a,s)))}},bi=class e{edit;hash;children;_tag=`CollisionNode`;constructor(e,t,n){this.edit=e,this.hash=t,this.children=n}modify(t,n,r,i,a,o){if(i===this.hash){let n=vi(this,t),i=this.updateCollisionList(n,t,this.hash,this.children,r,a,o);return i===this.children?this:i.length>1?new e(t,this.hash,i):i[0]}let s=r(A());return M(s)?this:(++o.value,Ei(t,n,this.hash,this,i,new yi(t,i,a,s)))}updateCollisionList(e,t,n,r,i,a,o){let s=r.length;for(let c=0;c<s;++c){let s=r[c];if(`key`in s&&S(a,s.key)){let l=s.value,u=i(l);return u===l?r:M(u)?(--o.value,mi(e,c,r)):pi(e,c,new yi(t,n,a,u),r)}}let c=i(A());return M(c)?r:(++o.value,pi(e,s,new yi(t,n,a,c),r))}},xi=class e{edit;mask;children;_tag=`IndexedNode`;constructor(e,t,n){this.edit=e,this.mask=t,this.children=n}modify(t,n,r,i,a,o){let s=this.mask,c=this.children,l=li(n,i),u=ui(l),d=di(s,u),ee=s&u,f=vi(this,t);if(!ee){let ee=new gi().modify(t,n+5,r,i,a,o);return ee?c.length>=16?wi(t,l,ee,s,c):new e(t,s|u,hi(f,d,ee,c)):this}let te=c[d],ne=te.modify(t,n+5,r,i,a,o);if(te===ne)return this;let re=s,p;if(R(ne)){if(re&=~u,!re)return new gi;if(c.length<=2&&_i(c[d^1]))return c[d^1];p=mi(f,d,c)}else p=pi(f,d,ne,c);return f?(this.mask=re,this.children=p,this):new e(t,re,p)}},Si=class e{edit;size;children;_tag=`ArrayNode`;constructor(e,t,n){this.edit=e,this.size=t,this.children=n}modify(t,n,r,i,a,o){let s=this.size,c=this.children,l=li(n,i),u=c[l],d=(u||new gi).modify(t,n+5,r,i,a,o);if(u===d)return this;let ee=vi(this,t),f;if(R(u)&&!R(d))++s,f=pi(ee,l,d,c);else if(!R(u)&&R(d)){if(--s,s<=8)return Ci(t,s,l,c);f=pi(ee,l,new gi,c)}else f=pi(ee,l,d,c);return ee?(this.size=s,this.children=f,this):new e(t,s,f)}};function Ci(e,t,n,r){let i=Array(t-1),a=0,o=0;for(let e=0,t=r.length;e<t;++e)if(e!==n){let t=r[e];t&&!R(t)&&(i[a++]=t,o|=1<<e)}return new xi(e,o,i)}function wi(e,t,n,r,i){let a=[],o=r,s=0;for(let e=0;o;++e)o&1&&(a[e]=i[s++]),o>>>=1;return a[t]=n,new Si(e,s+1,a)}function Ti(e,t,n,r,i,a){if(n===i)return new bi(e,n,[a,r]);let o=li(t,n),s=li(t,i);if(o===s)return t=>new xi(e,ui(o)|ui(s),[t]);{let t=o<s?[r,a]:[a,r];return new xi(e,ui(o)|ui(s),t)}}function Ei(e,t,n,r,i,a){let o,s=t;for(;;){let t=Ti(e,s,n,r,i,a);if(typeof t==`function`)o=fi(t,o),s+=5;else{let e=t;for(;o!=null;)e=o.value(e),o=o.previous;return e}}}const Di=`effect/HashMap`,Oi=Symbol.for(Di),ki={[Oi]:Oi,[Symbol.iterator](){return new ji(this,(e,t)=>[e,t])},[g](){let e=_(Di);for(let t of this)e^=l(_(t[0]),v(_(t[1])));return b(this,e)},[x](e){if(Ri(e)){if(e._size!==this._size)return!1;for(let t of this){let n=l(e,Vi(t[0],_(t[0])));if(M(n)||!S(t[1],n.value))return!1}return!0}return!1},toString(){return T(this.toJSON())},toJSON(){return{_id:`HashMap`,values:Array.from(this).map(w)}},[C](){return this.toJSON()},pipe(){return E(this,arguments)}},Ai=(e,t,n,r)=>{let i=Object.create(ki);return i._editable=e,i._edit=t,i._root=n,i._size=r,i};var ji=class e{map;f;v;constructor(e,t){this.map=e,this.f=t,this.v=Ni(this.map._root,this.f,void 0)}next(){if(M(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=Mi(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new e(this.map,this.f)}};const Mi=e=>e?Pi(e[0],e[1],e[2],e[3],e[4]):A(),Ni=(e,t,n=void 0)=>{switch(e._tag){case`LeafNode`:return N(e.value)?j({value:t(e.key,e.value.value),cont:n}):Mi(n);case`CollisionNode`:case`ArrayNode`:case`IndexedNode`:{let r=e.children;return Pi(r.length,r,0,t,n)}default:return Mi(n)}},Pi=(e,t,n,r,i)=>{for(;n<e;){let a=t[n++];if(a&&!R(a))return Ni(a,r,[e,t,n,r,i])}return Mi(i)},Fi=Ai(!1,0,new gi,0),Ii=()=>Fi,Li=e=>{let t=qi(Ii());for(let n of e)Ui(t,n[0],n[1]);return Ji(t)},Ri=e=>m(e,Oi),zi=e=>e&&R(e._root),Bi=t(2,(e,t)=>Vi(e,t,_(t))),Vi=t(3,(e,t,n)=>{let r=e._root,i=0;for(;;)switch(r._tag){case`LeafNode`:return S(t,r.key)?r.value:A();case`CollisionNode`:if(n===r.hash){let e=r.children;for(let n=0,r=e.length;n<r;++n){let r=e[n];if(`key`in r&&S(t,r.key))return r.value}}return A();case`IndexedNode`:{let e=ui(li(i,n));if(r.mask&e){r=r.children[di(r.mask,e)],i+=5;break}return A()}case`ArrayNode`:if(r=r.children[li(i,n)],r){i+=5;break}return A();default:return A()}}),Hi=t(2,(e,t)=>N(Vi(e,t,_(t)))),Ui=t(3,(e,t,n)=>Xi(e,t,()=>j(n))),Wi=t(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:Ai(e._editable,e._edit,t,n)),Gi=e=>new ji(e,e=>e),Ki=e=>e._size,qi=e=>Ai(!0,e._edit+1,e._root,e._size),Ji=e=>(e._editable=!1,e),Yi=t(2,(e,t)=>{let n=qi(e);return t(n),Ji(n)}),Xi=t(3,(e,t,n)=>Zi(e,t,_(t),n)),Zi=t(4,(e,t,n,r)=>{let i={value:e._size},a=e._root.modify(e._editable?e._edit:NaN,0,r,n,t,i);return l(e,Wi(a,i.value))}),Qi=t(2,(e,t)=>{let n=qi(e);return ta(t,(e,t)=>Ui(n,t,e)),Ji(n)}),$i=t(2,(e,t)=>Xi(e,t,A)),ea=t(2,(e,t)=>na(e,Ii(),(e,n,r)=>Ui(e,r,t(n,r)))),ta=t(2,(e,t)=>na(e,void 0,(e,n,r)=>t(n,r))),na=t(3,(e,t,n)=>{let r=e._root;if(r._tag===`LeafNode`)return N(r.value)?n(t,r.value.value,r.key):t;if(r._tag===`EmptyNode`)return t;let i=[r.children],a;for(;a=i.pop();)for(let e=0,r=a.length;e<r;){let r=a[e++];r&&!R(r)&&(r._tag===`LeafNode`?N(r.value)&&(t=n(t,r.value.value,r.key)):i.push(r.children))}return t}),ra=`effect/HashSet`,ia=Symbol.for(ra),aa={[ia]:ia,[Symbol.iterator](){return Gi(this._keyMap)},[g](){return b(this,v(_(this._keyMap))(_(ra)))},[x](e){return sa(e)?Ki(this._keyMap)===Ki(e._keyMap)&&S(this._keyMap,e._keyMap):!1},toString(){return T(this.toJSON())},toJSON(){return{_id:`HashSet`,values:Array.from(this).map(w)}},[C](){return this.toJSON()},pipe(){return E(this,arguments)}},oa=e=>{let t=Object.create(aa);return t._keyMap=e,t},sa=e=>m(e,ia),ca=oa(Ii()),la=()=>ca,ua=e=>{let t=ma(la());for(let n of e)_a(t,n);return ha(t)},da=(...e)=>{let t=ma(la());for(let n of e)_a(t,n);return ha(t)},fa=t(2,(e,t)=>Hi(e._keyMap,t)),pa=e=>Ki(e._keyMap),ma=e=>oa(qi(e._keyMap)),ha=e=>(e._keyMap._editable=!1,e),ga=t(2,(e,t)=>{let n=ma(e);return t(n),ha(n)}),_a=t(2,(e,t)=>e._keyMap._editable?(Ui(t,!0)(e._keyMap),e):oa(Ui(t,!0)(e._keyMap))),va=t(2,(e,t)=>e._keyMap._editable?($i(t)(e._keyMap),e):oa($i(t)(e._keyMap))),ya=t(2,(e,t)=>ga(e,e=>{for(let n of t)va(e,n)})),ba=t(2,(e,t)=>ga(la(),n=>{Ca(e,e=>_a(n,e));for(let e of t)_a(n,e)})),xa=t(2,(e,t)=>ga(la(),n=>{Ca(e,e=>{let r=t(e);fa(n,r)||_a(n,r)})})),Sa=t(2,(e,t)=>ga(la(),n=>{Ca(e,e=>{for(let r of t(e))fa(n,r)||_a(n,r)})})),Ca=t(2,(e,t)=>ta(e._keyMap,(e,n)=>t(n))),wa=t(3,(e,t,n)=>na(e._keyMap,t,(e,t,r)=>n(e,r))),Ta=la,Ea=ua,Da=da,Oa=fa,ka=pa,Aa=_a,ja=va,Ma=ya,Na=ba,Pa=xa,Fa=Sa,Ia=wa,La=`Empty`,Ra=`Fail`,za=`Interrupt`,Ba=`Parallel`,Va=`Sequential`,Ha=`effect/Cause`,Ua=Symbol.for(Ha),Wa={_E:e=>e},Ga={[Ua]:Wa,[g](){return l(_(Ha),v(_(ko(this))),b(this))},[x](e){return Ja(e)&&Oo(this,e)},pipe(){return E(this,arguments)},toJSON(){switch(this._tag){case`Empty`:return{_id:`Cause`,_tag:this._tag};case`Die`:return{_id:`Cause`,_tag:this._tag,defect:w(this.defect)};case`Interrupt`:return{_id:`Cause`,_tag:this._tag,fiberId:this.fiberId.toJSON()};case`Fail`:return{_id:`Cause`,_tag:this._tag,failure:w(this.error)};case`Sequential`:case`Parallel`:return{_id:`Cause`,_tag:this._tag,left:w(this.left),right:w(this.right)}}},toString(){return Ho(this)},[C](){return this.toJSON()}},z=(()=>{let e=Object.create(Ga);return e._tag=La,e})(),Ka=e=>{let t=Object.create(Ga);return t._tag=Ra,t.error=e,t},B=e=>{let t=Object.create(Ga);return t._tag=`Die`,t.defect=e,t},qa=e=>{let t=Object.create(Ga);return t._tag=za,t.fiberId=e,t},V=(e,t)=>{let n=Object.create(Ga);return n._tag=Ba,n.left=e,n.right=t,n},H=(e,t)=>{let n=Object.create(Ga);return n._tag=Va,n.left=e,n.right=t,n},Ja=e=>m(e,Ua),Ya=e=>e._tag===La,Xa=e=>e._tag===Ra,Za=e=>e._tag===`Die`,Qa=e=>e._tag===za,$a=e=>e._tag===Va,eo=e=>e._tag===Ba,to=e=>Vo(e,void 0,Po),no=e=>e._tag===`Empty`||Bo(e,!0,(e,t)=>{switch(t._tag){case La:return j(e);case`Die`:case Ra:case za:return j(!1);default:return A()}}),ro=e=>N(uo(e)),io=e=>N(po(e)),ao=e=>N(ho(e)),oo=e=>Vo(void 0,Fo)(e),so=e=>Wr(Bo(e,I(),(e,t)=>t._tag===`Fail`?j(l(e,Xr(t.error))):A())),co=e=>Wr(Bo(e,I(),(e,t)=>t._tag===`Die`?j(l(e,Xr(t.defect))):A())),lo=e=>Bo(e,Ta(),(e,t)=>t._tag===`Interrupt`?j(l(e,Aa(t.fiberId))):A()),uo=e=>jo(e,e=>e._tag===`Fail`?j(e.error):A()),fo=e=>{let t=uo(e);switch(t._tag){case`None`:return k(e);case`Some`:return $t(t.value)}},po=e=>jo(e,e=>e._tag===`Die`?j(e.defect):A()),mo=e=>zo(e,{onEmpty:j(z),onFail:En(Ka),onDie:e=>j(B(e)),onInterrupt:e=>j(qa(e)),onSequential:Fn(H),onParallel:Fn(V)}),ho=e=>jo(e,e=>e._tag===`Interrupt`?j(e.fiberId):A()),go=e=>zo(e,{onEmpty:A(),onFail:()=>A(),onDie:e=>j(B(e)),onInterrupt:()=>A(),onSequential:Fn(H),onParallel:Fn(V)}),_o=e=>zo(e,{onEmpty:A(),onFail:e=>j(B(e)),onDie:e=>j(B(e)),onInterrupt:()=>A(),onSequential:Fn(H),onParallel:Fn(V)}),vo=e=>zo(e,{onEmpty:Ta(),onFail:e=>Da(Ka(e)),onDie:e=>Da(B(e)),onInterrupt:e=>Da(qa(e)),onSequential:(e,t)=>Fa(e,e=>Pa(t,t=>H(e,t))),onParallel:(e,t)=>Fa(e,e=>Pa(t,t=>V(e,t)))}),yo=e=>zo(e,{onEmpty:z,onFail:()=>z,onDie:B,onInterrupt:qa,onSequential:H,onParallel:V}),bo=e=>zo(e,{onEmpty:z,onFail:B,onDie:B,onInterrupt:qa,onSequential:H,onParallel:V}),xo=t(2,(e,t)=>zo(e,{onEmpty:j(z),onFail:e=>j(Ka(e)),onDie:e=>{let n=t(e);return N(n)?A():j(B(e))},onInterrupt:e=>j(qa(e)),onSequential:Fn(H),onParallel:Fn(V)})),So=t(2,(e,t)=>Co(e,()=>t)),Co=t(2,(e,t)=>wo(e,e=>Ka(t(e)))),wo=t(2,(e,t)=>zo(e,{onEmpty:z,onFail:e=>t(e),onDie:e=>B(e),onInterrupt:e=>qa(e),onSequential:(e,t)=>H(e,t),onParallel:(e,t)=>V(e,t)})),To=e=>wo(e,n),Eo=t(2,(e,t)=>ue(t)?wo(e,t):wo(e,()=>t)),Do=t(2,(e,t)=>t._tag===`Empty`||e===t||Bo(e,!1,(e,n)=>j(e||Oo(n,t)))),Oo=(e,t)=>{let n=L(e),r=L(t);for(;ti(n)&&ti(r);){let[e,t]=l(ii(n),Bo([Ta(),I()],([e,t],n)=>{let[r,i]=No(n);return j([l(e,Na(r)),l(t,Qr(i))])})),[i,a]=l(ii(r),Bo([Ta(),I()],([e,t],n)=>{let[r,i]=No(n);return j([l(e,Na(r)),l(t,Qr(i))])}));if(!S(e,i))return!1;n=t,r=a}return!0},ko=e=>Ao(L(e),I()),Ao=(e,t)=>{for(;;){let[n,r]=l(e,Tr([Ta(),I()],([e,t],n)=>{let[r,i]=No(n);return[l(e,Na(r)),l(t,Qr(i))]})),i=ka(n)>0?l(t,Xr(n)):t;if(ei(r))return Wr(i);e=r,t=i}throw Error(Te(`Cause.flattenCauseLoop`))},jo=t(2,(e,t)=>{let n=[e];for(;n.length>0;){let e=n.pop(),r=t(e);switch(r._tag){case`None`:switch(e._tag){case Va:case Ba:n.push(e.right),n.push(e.left);break}break;case`Some`:return r}}return A()}),Mo=t(2,(e,t)=>Vo(e,void 0,Io(t))),No=e=>{let t=e,n=[],r=Ta(),i=I();for(;t!==void 0;)switch(t._tag){case La:if(n.length===0)return[r,i];t=n.pop();break;case Ra:if(r=Aa(r,zr(t._tag,t.error)),n.length===0)return[r,i];t=n.pop();break;case`Die`:if(r=Aa(r,zr(t._tag,t.defect)),n.length===0)return[r,i];t=n.pop();break;case za:if(r=Aa(r,zr(t._tag,t.fiberId)),n.length===0)return[r,i];t=n.pop();break;case Va:switch(t.left._tag){case La:t=t.right;break;case Va:t=H(t.left.left,H(t.left.right,t.right));break;case Ba:t=V(H(t.left.left,t.right),H(t.left.right,t.right));break;default:i=Xr(i,t.right),t=t.left;break}break;case Ba:n.push(t.right),t=t.left;break}throw Error(Te(`Cause.evaluateCauseLoop`))},Po={emptyCase:()=>0,failCase:()=>1,dieCase:()=>1,interruptCase:()=>1,sequentialCase:(e,t,n)=>t+n,parallelCase:(e,t,n)=>t+n},Fo={emptyCase:i,failCase:a,dieCase:a,interruptCase:i,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},Io=e=>({emptyCase:()=>z,failCase:(e,t)=>Ka(t),dieCase:(e,t)=>B(t),interruptCase:(e,t)=>qa(t),sequentialCase:(t,n,r)=>e(n)?e(r)?H(n,r):n:e(r)?r:z,parallelCase:(t,n,r)=>e(n)?e(r)?V(n,r):n:e(r)?r:z}),Lo=`SequentialCase`,Ro=`ParallelCase`,zo=t(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:i,onParallel:a,onSequential:o})=>Vo(e,void 0,{emptyCase:()=>n,failCase:(e,t)=>r(t),dieCase:(e,n)=>t(n),interruptCase:(e,t)=>i(t),sequentialCase:(e,t,n)=>o(t,n),parallelCase:(e,t,n)=>a(t,n)})),Bo=t(3,(e,t,n)=>{let r=t,i=e,a=[];for(;i!==void 0;){let e=n(r,i);switch(r=N(e)?e.value:r,i._tag){case Va:a.push(i.right),i=i.left;break;case Ba:a.push(i.right),i=i.left;break;default:i=void 0;break}i===void 0&&a.length>0&&(i=a.pop())}return r}),Vo=t(3,(e,t,n)=>{let r=[e],i=[];for(;r.length>0;){let e=r.pop();switch(e._tag){case La:i.push(k(n.emptyCase(t)));break;case Ra:i.push(k(n.failCase(t,e.error)));break;case`Die`:i.push(k(n.dieCase(t,e.defect)));break;case za:i.push(k(n.interruptCase(t,e.fiberId)));break;case Va:r.push(e.right),r.push(e.left),i.push($t({_tag:Lo}));break;case Ba:r.push(e.right),r.push(e.left),i.push($t({_tag:Ro}));break}}let a=[];for(;i.length>0;){let e=i.pop();switch(e._tag){case`Left`:switch(e.left._tag){case Lo:{let e=a.pop(),r=a.pop(),i=n.sequentialCase(t,e,r);a.push(i);break}case Ro:{let e=a.pop(),r=a.pop(),i=n.parallelCase(t,e,r);a.push(i);break}}break;case`Right`:a.push(e.right);break}}if(a.length===0)throw Error(`BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues`);return a.pop()}),Ho=(e,t)=>oo(e)?`All fibers interrupted without errors.`:Xo(e).map(function(e){return t?.renderErrorCause!==!0||e.cause===void 0?e.stack:`${e.stack} {\n${Uo(e.cause,` `)}\n}`}).join(`
4
- `),Uo=(e,t)=>{let n=e.stack.split(`
5
- `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Uo(e.cause,`${t} `)}\n${t}}`),r},Wo=e=>{let t=typeof e==`object`&&!!e,n=Error.stackTraceLimit;Error.stackTraceLimit=1;let r=Error(Go(e),t&&`cause`in e&&e.cause!==void 0?{cause:Wo(e.cause)}:void 0);return Error.stackTraceLimit=n,r.message===``&&(r.message=`An error has occurred`),Error.stackTraceLimit=n,r.name=e instanceof Error?e.name:`Error`,t&&(Yo in e&&(r.span=e[Yo]),Object.keys(e).forEach(t=>{t in r||(r[t]=e[t])})),r.stack=Jo(`${r.name}: ${r.message}`,e instanceof Error&&e.stack?e.stack:``,r.span),r},Go=e=>{if(typeof e==`string`)return e;if(typeof e==`object`&&e&&e instanceof Error)return e.message;try{if(m(e,`toString`)&&ue(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return tt(e)},Ko=/\((.*)\)/g,qo=p(`effect/Tracer/spanToTrace`,()=>new WeakMap),Jo=(e,t,n)=>{let r=[e],i=t.startsWith(e)?t.slice(e.length).split(`
6
- `):t.split(`
7
- `);for(let e=1;e<i.length;e++){if(i[e].includes(` at new BaseEffectError`)||i[e].includes(` at new YieldableError`)){e++;continue}if(i[e].includes(`Generator.next`)||i[e].includes(`effect_internal_function`))break;r.push(i[e].replace(/at .*effect_instruction_i.*\((.*)\)/,`at $1`).replace(/EffectPrimitive\.\w+/,`<anonymous>`))}if(n){let e=n,t=0;for(;e&&e._tag===`Span`&&t<10;){let n=qo.get(e);if(typeof n==`function`){let t=n();if(typeof t==`string`){let n=t.matchAll(Ko),i=!1;for(let[,t]of n)i=!0,r.push(` at ${e.name} (${t})`);i||r.push(` at ${e.name} (${t.replace(/^at /,``)})`)}else r.push(` at ${e.name}`)}else r.push(` at ${e.name}`);e=Sn(e.parent),t++}}return r.join(`
8
- `)},Yo=Symbol.for(`effect/SpanAnnotation`),Xo=e=>Vo(e,void 0,{emptyCase:()=>[],dieCase:(e,t)=>[Wo(t)],failCase:(e,t)=>[Wo(t)],interruptCase:()=>[],parallelCase:(e,t,n)=>[...t,...n],sequentialCase:(e,t,n)=>[...t,...n]}),Zo=Symbol.for(`effect/Context/Tag`),Qo=Symbol.for(`effect/Context/Reference`),$o=Symbol.for(`effect/STM`),es={...Dt,_op:`Tag`,[$o]:wt,[Zo]:{_Service:e=>e,_Identifier:e=>e},toString(){return T(this.toJSON())},toJSON(){return{_id:`Tag`,key:this.key,stack:this.stack}},[C](){return this.toJSON()},of(e){return e},context(e){return ms(this,e)}},ts={...es,[Qo]:Qo},ns=e=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=t;let r=Object.create(es);return Object.defineProperty(r,"stack",{get(){return n.stack}}),r.key=e,r},rs=e=>()=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=t;function r(){}return Object.setPrototypeOf(r,es),r.key=e,Object.defineProperty(r,"stack",{get(){return n.stack}}),r},is=()=>(e,t)=>{let n=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=Error();Error.stackTraceLimit=n;function i(){}return Object.setPrototypeOf(i,ts),i.key=e,i.defaultValue=t.defaultValue,Object.defineProperty(i,"stack",{get(){return r.stack}}),i},as=Symbol.for(`effect/Context`),os={[as]:{_Services:e=>e},[x](e){if(ls(e)&&this.unsafeMap.size===e.unsafeMap.size){for(let t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!S(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[g](){return b(this,Ve(this.unsafeMap.size))},pipe(){return E(this,arguments)},toString(){return T(this.toJSON())},toJSON(){return{_id:`Context`,services:Array.from(this.unsafeMap).map(w)}},[C](){return this.toJSON()}},ss=e=>{let t=Object.create(os);return t.unsafeMap=e,t},cs=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
9
- `);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
10
- `);e.splice(1,3),t.stack=e.join(`
11
- `)}return t},ls=e=>m(e,as),us=e=>m(e,Zo),ds=e=>m(e,Qo),fs=ss(new Map),ps=()=>fs,ms=(e,t)=>ss(new Map([[e.key,t]])),hs=t(3,(e,t,n)=>{let r=new Map(e.unsafeMap);return r.set(t.key,n),ss(r)}),gs=p(`effect/Context/defaultValueCache`,()=>new Map),_s=e=>{if(gs.has(e.key))return gs.get(e.key);let t=e.defaultValue();return gs.set(e.key,t),t},vs=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):_s(t),ys=t(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(Qo in t)return _s(t);throw cs(t)}return e.unsafeMap.get(t.key)}),bs=ys,xs=t(2,(e,t)=>e.unsafeMap.has(t.key)?Vt(e.unsafeMap.get(t.key)):ds(t)?Vt(_s(t)):Bt),Ss=t(2,(e,t)=>{let n=new Map(e.unsafeMap);for(let[e,r]of t.unsafeMap)n.set(e,r);return ss(n)}),Cs=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].unsafeMap.forEach((e,n)=>{t.set(n,e)});return ss(t)},ws=ns,Ts=ls,Es=us,Ds=ps,Os=ms,ks=hs,As=bs,js=ys,Ms=xs,Ns=Ss,Ps=Cs,Fs=rs,Is=is,Ls=Symbol.for(`effect/Duration`),Rs=BigInt(0),zs=BigInt(24),Bs=BigInt(60),Vs=BigInt(1e3),Hs=BigInt(1e6),Us=BigInt(1e9),Ws=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,U=e=>{if(Ys(e))return e;if(oe(e))return nc(e);if(ce(e))return ec(e);if(Array.isArray(e)&&e.length===2&&e.every(oe))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Qs:e[0]===1/0||e[1]===1/0?$s:ec(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(ae(e)){let t=Ws.exec(e);if(t){let[e,n,r]=t,i=Number(n);switch(r){case`nano`:case`nanos`:return ec(BigInt(n));case`micro`:case`micros`:return tc(BigInt(n));case`milli`:case`millis`:return nc(i);case`second`:case`seconds`:return rc(i);case`minute`:case`minutes`:return ic(i);case`hour`:case`hours`:return ac(i);case`day`:case`days`:return oc(i);case`week`:case`weeks`:return sc(i)}}}throw Error(`Invalid DurationInput`)},Gs={_tag:`Millis`,millis:0},Ks={_tag:`Infinity`},qs={[Ls]:Ls,[g](){return b(this,Ue(this.value))},[x](e){return Ys(e)&&_c(this,e)},toString(){return`Duration(${yc(this)})`},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,hrtime:dc(this)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`}}},[C](){return this.toJSON()},pipe(){return E(this,arguments)}},Js=e=>{let t=Object.create(qs);return oe(e)?isNaN(e)||e<=0?t.value=Gs:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:BigInt(Math.round(e*1e6))}:t.value=Ks:e<=Rs?t.value=Gs:t.value={_tag:`Nanos`,nanos:e},t},Ys=e=>m(e,Ls),Xs=e=>e.value._tag!==`Infinity`,Zs=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===Rs;case`Infinity`:return!1}},Qs=Js(0),$s=Js(1/0),ec=e=>Js(e),tc=e=>Js(e*Vs),nc=e=>Js(e),rc=e=>Js(e*1e3),ic=e=>Js(e*6e4),ac=e=>Js(e*36e5),oc=e=>Js(e*864e5),sc=e=>Js(e*6048e5),cc=e=>fc(e,{onMillis:e=>e,onNanos:e=>Number(e)/1e6}),lc=e=>{let t=U(e);switch(t.value._tag){case`Infinity`:return A();case`Nanos`:return j(t.value.nanos);case`Millis`:return j(BigInt(Math.round(t.value.millis*1e6)))}},uc=e=>{let t=U(e);switch(t.value._tag){case`Infinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return BigInt(Math.round(t.value.millis*1e6))}},dc=e=>{let t=U(e);switch(t.value._tag){case`Infinity`:return[1/0,0];case`Nanos`:return[Number(t.value.nanos/Us),Number(t.value.nanos%Us)];case`Millis`:return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},fc=t(2,(e,t)=>{let n=U(e);switch(n.value._tag){case`Nanos`:return t.onNanos(n.value.nanos);case`Infinity`:return t.onMillis(1/0);case`Millis`:return t.onMillis(n.value.millis)}}),pc=t(3,(e,t,n)=>{let r=U(e),i=U(t);if(r.value._tag===`Infinity`||i.value._tag===`Infinity`)return n.onMillis(cc(r),cc(i));if(r.value._tag===`Nanos`||i.value._tag===`Nanos`){let e=r.value._tag===`Nanos`?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),t=i.value._tag===`Nanos`?i.value.nanos:BigInt(Math.round(i.value.millis*1e6));return n.onNanos(e,t)}return n.onMillis(r.value.millis,i.value.millis)}),mc=(e,t)=>pc(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t}),hc=t(2,(e,t)=>pc(e,t,{onMillis:(e,t)=>e<=t,onNanos:(e,t)=>e<=t})),gc=t(2,(e,t)=>pc(e,t,{onMillis:(e,t)=>e>=t,onNanos:(e,t)=>e>=t})),_c=t(2,(e,t)=>mc(U(e),U(t))),vc=e=>{let t=U(e);if(t.value._tag===`Infinity`)return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};let n=uc(t),r=n/Hs,i=r/Vs,a=i/Bs,o=a/Bs,s=o/zs;return{days:Number(s),hours:Number(o%zs),minutes:Number(a%Bs),seconds:Number(i%Bs),millis:Number(r%Vs),nanos:Number(n%Hs)}},yc=e=>{let t=U(e);if(t.value._tag===`Infinity`)return`Infinity`;if(Zs(t))return`0`;let n=vc(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(` `)},bc=Symbol.for(`effect/MutableRef`),xc={[bc]:bc,toString(){return T(this.toJSON())},toJSON(){return{_id:`MutableRef`,current:w(this.current)}},[C](){return this.toJSON()},pipe(){return E(this,arguments)}},Sc=e=>{let t=Object.create(xc);return t.current=e,t},Cc=t(3,(e,t,n)=>S(t,e.current)?(e.current=n,!0):!1),wc=e=>e.current,Tc=t(2,(e,t)=>(e.current=t,e)),Ec=`effect/FiberId`,Dc=Symbol.for(Ec),Oc=`None`,kc=`Runtime`,Ac=`Composite`,jc=y(`${Ec}-${Oc}`);var Mc=class{[Dc]=Dc;_tag=Oc;id=-1;startTimeMillis=-1;[g](){return jc}[x](e){return Rc(e)&&e._tag===Oc}toString(){return T(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag}}[C](){return this.toJSON()}},Nc=class{id;startTimeMillis;[Dc]=Dc;_tag=kc;constructor(e,t){this.id=e,this.startTimeMillis=t}[g](){return b(this,y(`${Ec}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[x](e){return Rc(e)&&e._tag===kc&&this.id===e.id&&this.startTimeMillis===e.startTimeMillis}toString(){return T(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[C](){return this.toJSON()}},Pc=class{left;right;[Dc]=Dc;_tag=Ac;constructor(e,t){this.left=e,this.right=t}_hash;[g](){return l(y(`${Ec}-${this._tag}`),v(_(this.left)),v(_(this.right)),b(this))}[x](e){return Rc(e)&&e._tag===Ac&&S(this.left,e.left)&&S(this.right,e.right)}toString(){return T(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag,left:w(this.left),right:w(this.right)}}[C](){return this.toJSON()}};const Fc=new Mc,Ic=(e,t)=>new Nc(e,t),Lc=(e,t)=>new Pc(e,t),Rc=e=>m(e,Dc),zc=t(2,(e,t)=>e._tag===Oc?t:t._tag===Oc?e:new Pc(e,t)),Bc=e=>l(e,Ia(Fc,(e,t)=>zc(t)(e))),Vc=e=>{switch(e._tag){case Oc:return Ta();case kc:return Da(e.id);case Ac:return l(Vc(e.left),Na(Vc(e.right)))}},Hc=p(Symbol.for(`effect/Fiber/Id/_fiberCounter`),()=>Sc(0)),Uc=e=>Array.from(Vc(e)).map(e=>`#${e}`).join(`,`),Wc=()=>{let e=wc(Hc);return l(Hc,Tc(e+1)),new Nc(e,Date.now())},Gc=Fc,Kc=Ic,qc=Lc,Jc=Rc,Yc=zc,Xc=Bc,Zc=Vc,Qc=Uc,$c=Wc,el=Ii,tl=Li,nl=zi,rl=Bi,il=Ui,al=Gi,ol=Yi,sl=Xi,cl=Qi,ll=ea,ul=ta,dl=na,fl=Symbol.for(`effect/List`),pl=e=>P(e),ml=(e=>ee(Or(e),pl))(S),hl={[fl]:fl,_tag:`Cons`,toString(){return T(this.toJSON())},toJSON(){return{_id:`List`,_tag:`Cons`,values:pl(this).map(w)}},[C](){return this.toJSON()},[x](e){return yl(e)&&this._tag===e._tag&&ml(this,e)},[g](){return b(this,We(pl(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag===`Nil`)return e=!0,this.return();let n=t.head;return t=t.tail,{done:e,value:n}},return(t){return e||=!0,{done:!0,value:t}}}},pipe(){return E(this,arguments)}},gl=(e,t)=>{let n=Object.create(hl);return n.head=e,n.tail=t,n},_l=y(`Nil`),vl=Object.create({[fl]:fl,_tag:`Nil`,toString(){return T(this.toJSON())},toJSON(){return{_id:`List`,_tag:`Nil`}},[C](){return this.toJSON()},[g](){return _l},[x](e){return yl(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return E(this,arguments)}}),yl=e=>m(e,fl),bl=e=>e._tag===`Nil`,xl=e=>e._tag===`Cons`,Sl=()=>vl,Cl=(e,t)=>gl(e,t),wl=Sl,Tl=e=>gl(e,vl),El=t(2,(e,t)=>Ol(t,e)),Dl=t(2,(e,t)=>Cl(t,e)),Ol=t(2,(e,t)=>{if(bl(e))return t;if(bl(t))return e;{let n=gl(t.head,e),r=n,i=t.tail;for(;!bl(i);){let t=gl(i.head,e);r.tail=t,r=t,i=i.tail}return n}}),kl=t(3,(e,t,n)=>{let r=t,i=e;for(;!bl(i);)r=n(r,i.head),i=i.tail;return r}),Al=e=>{let t=wl(),n=e;for(;!bl(n);)t=Dl(t,n.head),n=n.tail;return t};Array.prototype;const jl=function(){function e(e){e&&Object.assign(this,e)}return e.prototype=Ot,e}(),Ml=e=>Object.assign(Object.create(Ot),e),Nl=Symbol.for(`effect/DifferContextPatch`);function Pl(e){return e}const Fl={...jl.prototype,[Nl]:{_Value:Pl,_Patch:Pl}},Il=Object.create(Object.assign(Object.create(Fl),{_tag:`Empty`})),Ll=()=>Il,Rl=Object.assign(Object.create(Fl),{_tag:`AndThen`}),zl=(e,t)=>{let n=Object.create(Rl);return n.first=e,n.second=t,n},Bl=Object.assign(Object.create(Fl),{_tag:`AddService`}),Vl=(e,t)=>{let n=Object.create(Bl);return n.key=e,n.service=t,n},Hl=Object.assign(Object.create(Fl),{_tag:`RemoveService`}),Ul=e=>{let t=Object.create(Hl);return t.key=e,t},Wl=Object.assign(Object.create(Fl),{_tag:`UpdateService`}),Gl=(e,t)=>{let n=Object.create(Wl);return n.key=e,n.update=t,n},Kl=(e,t)=>{let n=new Map(e.unsafeMap),r=Ll();for(let[e,i]of t.unsafeMap.entries())if(n.has(e)){let t=n.get(e);n.delete(e),S(t,i)||(r=ql(Gl(e,()=>i))(r))}else n.delete(e),r=ql(Vl(e,i))(r);for(let[e]of n.entries())r=ql(Ul(e))(r);return r},ql=t(2,(e,t)=>zl(e,t)),Jl=t(2,(e,t)=>{if(e._tag===`Empty`)return t;let n=!1,r=L(e),i=new Map(t.unsafeMap);for(;ti(r);){let e=ii(r),t=oi(r);switch(e._tag){case`Empty`:r=t;break;case`AddService`:i.set(e.key,e.service),r=t;break;case`AndThen`:r=Xr(Xr(t,e.second),e.first);break;case`RemoveService`:i.delete(e.key),r=t;break;case`UpdateService`:i.set(e.key,e.update(i.get(e.key))),n=!0,r=t;break}}if(!n)return ss(i);let a=new Map;for(let[e]of t.unsafeMap)i.has(e)&&(a.set(e,i.get(e)),i.delete(e));for(let[e,t]of i)a.set(e,t);return ss(a)}),Yl=Symbol.for(`effect/DifferHashSetPatch`);function Xl(e){return e}const Zl={...jl.prototype,[Yl]:{_Value:Xl,_Key:Xl,_Patch:Xl}},Ql=Object.create(Object.assign(Object.create(Zl),{_tag:`Empty`})),$l=()=>Ql,eu=Object.assign(Object.create(Zl),{_tag:`AndThen`}),tu=(e,t)=>{let n=Object.create(eu);return n.first=e,n.second=t,n},nu=Object.assign(Object.create(Zl),{_tag:`Add`}),ru=e=>{let t=Object.create(nu);return t.value=e,t},iu=Object.assign(Object.create(Zl),{_tag:`Remove`}),au=e=>{let t=Object.create(iu);return t.value=e,t},ou=(e,t)=>{let[n,r]=Ia([e,$l()],([e,t],n)=>Oa(n)(e)?[ja(n)(e),t]:[e,su(ru(n))(t)])(t);return Ia(r,(e,t)=>su(au(t))(e))(n)},su=t(2,(e,t)=>tu(e,t)),cu=t(2,(e,t)=>{if(e._tag===`Empty`)return t;let n=t,r=L(e);for(;ti(r);){let e=ii(r),t=oi(r);switch(e._tag){case`Empty`:r=t;break;case`AndThen`:r=Xr(e.first)(Xr(e.second)(t));break;case`Add`:n=Aa(e.value)(n),r=t;break;case`Remove`:n=ja(e.value)(n),r=t}}return n}),lu=Symbol.for(`effect/DifferReadonlyArrayPatch`);function uu(e){return e}const du={...jl.prototype,[lu]:{_Value:uu,_Patch:uu}},fu=Object.create(Object.assign(Object.create(du),{_tag:`Empty`})),pu=()=>fu,mu=Object.assign(Object.create(du),{_tag:`AndThen`}),hu=(e,t)=>{let n=Object.create(mu);return n.first=e,n.second=t,n},gu=Object.assign(Object.create(du),{_tag:`Append`}),_u=e=>{let t=Object.create(gu);return t.values=e,t},vu=Object.assign(Object.create(du),{_tag:`Slice`}),yu=(e,t)=>{let n=Object.create(vu);return n.from=e,n.until=t,n},bu=Object.assign(Object.create(du),{_tag:`Update`}),xu=(e,t)=>{let n=Object.create(bu);return n.index=e,n.patch=t,n},Su=e=>{let t=0,n=pu();for(;t<e.oldValue.length&&t<e.newValue.length;){let r=e.oldValue[t],i=e.newValue[t],a=e.differ.diff(r,i);S(a,e.differ.empty)||(n=Cu(n,xu(t,a))),t+=1}return t<e.oldValue.length&&(n=Cu(n,yu(0,t))),t<e.newValue.length&&(n=Cu(n,_u(ar(t)(e.newValue)))),n},Cu=t(2,(e,t)=>hu(e,t)),wu=t(3,(e,t,n)=>{if(e._tag===`Empty`)return t;let r=t.slice(),i=_r(e);for(;Kn(i);){let e=$n(i),t=nr(i);switch(e._tag){case`Empty`:i=t;break;case`AndThen`:t.unshift(e.first,e.second),i=t;break;case`Append`:for(let t of e.values)r.push(t);i=t;break;case`Slice`:r=r.slice(e.from,e.until),i=t;break;case`Update`:r[e.index]=n.patch(e.patch,r[e.index]),i=t;break}}return r}),Tu={[Symbol.for(`effect/Differ`)]:{_P:n,_V:n},pipe(){return E(this,arguments)}},Eu=e=>{let t=Object.create(Tu);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},Du=()=>Eu({empty:Ll(),combine:(e,t)=>ql(t)(e),diff:(e,t)=>Kl(e,t),patch:(e,t)=>Jl(t)(e)}),Ou=()=>Eu({empty:$l(),combine:(e,t)=>su(t)(e),diff:(e,t)=>ou(e,t),patch:(e,t)=>cu(t)(e)}),ku=e=>Eu({empty:pu(),combine:(e,t)=>Cu(e,t),diff:(t,n)=>Su({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>wu(t,n,e)}),Au=()=>ju((e,t)=>t),ju=e=>Eu({empty:n,combine:(e,t)=>e===n?t:t===n?e:n=>t(e(n)),diff:(e,t)=>S(e,t)?n:r(t),patch:(t,n)=>e(n,t(n))}),Mu=e=>e&255,Nu=e=>e>>8&255,Pu=(e,t)=>(e&255)+((t&e&255)<<8),Fu=Pu(0,0),Iu=e=>Pu(e,e),Lu=e=>Pu(e,0),Ru=t(2,(e,t)=>Pu(Mu(e)&~t,Nu(e))),zu=t(2,(e,t)=>e|t),Bu=e=>~e>>>0&255,Vu=e=>Ku(e,32),Hu=t(2,(e,t)=>e&~t),Uu=t(2,(e,t)=>e|t),Wu=e=>Gu(e)&&!Xu(e),Gu=e=>Ku(e,1),Ku=t(2,(e,t)=>(e&t)!==0),qu=(...e)=>e.reduce((e,t)=>e|t,0),Ju=qu(0),Yu=e=>Ku(e,4),Xu=e=>Ku(e,16),Zu=t(2,(e,t)=>Pu(e^t,t)),Qu=t(2,(e,t)=>e&(Bu(Mu(t))|Nu(t))|Mu(t)&Nu(t)),$u=Eu({empty:Fu,diff:(e,t)=>Zu(e,t),combine:(e,t)=>zu(t)(e),patch:(e,t)=>Qu(t,e)}),ed=Fu,td=Iu,nd=Lu,rd=Ru,id=`Pending`,ad=`Done`,od=Symbol.for(`effect/Deferred`),sd={_E:e=>e,_A:e=>e},cd=e=>({_tag:id,joiners:e}),ld=e=>({_tag:ad,effect:e});var ud=class e{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new e(this.self)}};const dd=(e,t)=>{let n=new W(`Blocked`);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},fd=e=>{let t=new W(`RunBlocked`);return t.effect_instruction_i0=e,t},pd=Symbol.for(`effect/Effect`);var md=class{patch;op;_op=vt;constructor(e,t){this.patch=e,this.op=t}},W=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[pd]=wt;constructor(e){this._op=e}[x](e){return this===e}[g](){return b(this,Re(this))}pipe(){return E(this,arguments)}toJSON(){return{_id:`Effect`,_op:this._op,effect_instruction_i0:w(this.effect_instruction_i0),effect_instruction_i1:w(this.effect_instruction_i1),effect_instruction_i2:w(this.effect_instruction_i2)}}toString(){return T(this.toJSON())}[C](){return this.toJSON()}[Symbol.iterator](){return new ud(new je(this))}},hd=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[pd]=wt;constructor(e){this._op=e,this._tag=e}[x](e){return cm(e)&&e._op===`Failure`&&S(this.effect_instruction_i0,e.effect_instruction_i0)}[g](){return l(y(this._tag),v(_(this.effect_instruction_i0)),b(this))}get cause(){return this.effect_instruction_i0}pipe(){return E(this,arguments)}toJSON(){return{_id:`Exit`,_tag:this._op,cause:this.cause.toJSON()}}toString(){return T(this.toJSON())}[C](){return this.toJSON()}[Symbol.iterator](){return new ud(new je(this))}},gd=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[pd]=wt;constructor(e){this._op=e,this._tag=e}[x](e){return cm(e)&&e._op===`Success`&&S(this.effect_instruction_i0,e.effect_instruction_i0)}[g](){return l(y(this._tag),v(_(this.effect_instruction_i0)),b(this))}get value(){return this.effect_instruction_i0}pipe(){return E(this,arguments)}toJSON(){return{_id:`Exit`,_tag:this._op,value:w(this.value)}}toString(){return T(this.toJSON())}[C](){return this.toJSON()}[Symbol.iterator](){return new ud(new je(this))}};const _d=e=>m(e,pd),G=e=>{let t=new W(gt);return t.effect_instruction_i0=e,t},vd=t(3,(e,t,n)=>xf(r=>q(e,e=>q(Ld(gf(()=>r(t(e)))),t=>gf(()=>n(e,t)).pipe(Jd({onFailure:e=>{switch(t._tag){case D:return K(H(t.effect_instruction_i0,e));case O:return K(e)}},onSuccess:()=>t})))))),yd=t(2,(e,t)=>q(e,()=>J(t))),bd=e=>yd(e,void 0),xd=function(){let e=new W(ct);switch(arguments.length){case 2:e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break;case 3:e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break;case 4:e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break;default:throw Error(Te(`you're not supposed to end up here`))}return e},Sd=(e,t=Gc)=>{let n=new W(st),r;return n.effect_instruction_i0=t=>{r=e(t)},n.effect_instruction_i1=t,uf(n,e=>_d(r)?r:Sf)},Cd=(e,t=Gc)=>gf(()=>Sd(e,t)),wd=(e,t=Gc)=>xd(e,function(){let e,n;function r(t){e?e(t):n===void 0&&(n=t)}let i=new W(st);i.effect_instruction_i0=t=>{e=t,n&&t(n)},i.effect_instruction_i1=t;let a,o;return this.effect_instruction_i0.length===1?a=Pe(()=>this.effect_instruction_i0(r)):(o=new AbortController,a=Pe(()=>this.effect_instruction_i0(r,o.signal))),a||o?uf(i,e=>(o&&o.abort(),a??Sf)):i}),Td=t(2,(e,t)=>{let n=new W(lt);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),Ed=t(2,(e,t)=>Yd(e,{onFailure:t,onSuccess:J})),Dd=t(3,(e,t,n)=>Td(e,e=>{let r=fo(e);switch(r._tag){case`Left`:return t(r.left)?n(r.left):K(e);case`Right`:return K(r.right)}})),Od=t(2,(e,t)=>Td(e,e=>{let n=fo(e);switch(n._tag){case`Left`:return l(t(n.left),_n(()=>K(e)));case`Right`:return K(n.right)}})),kd=e=>G((t,n)=>e(Gu(n.runtimeFlags))),Ad=Symbol.for(`effect/OriginalAnnotation`),jd=e=>m(e,Ad)?e[Ad]:e,Md=(e,t)=>N(t)?new Proxy(e,{has(e,t){return t===Yo||t===Ad||t in e},get(n,r){return r===Yo?t.value:r===Ad?e:n[r]}}):e,Nd=e=>ge(e)&&!(Yo in e)?G(t=>K(B(Md(e,uh(t))))):K(B(e)),Pd=e=>Bd(()=>B(new Bp(e))),Fd=e=>q(Y(e),Nd),Id=e=>Yd(e,{onFailure:e=>J($t(e)),onSuccess:e=>J(k(e))}),Ld=e=>qd(e,{onFailure:Q,onSuccess:$}),Rd=e=>ge(e)&&!(Yo in e)?G(t=>K(Ka(Md(e,uh(t))))):K(Ka(e)),zd=e=>q(Y(e),Rd),K=e=>{let t=new hd(D);return t.effect_instruction_i0=e,t},Bd=e=>q(Y(e),K),Vd=G(e=>J(e.id())),Hd=e=>G(t=>e(t.id())),q=t(2,(e,t)=>{let n=new W(ut);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),Ud=t(2,(e,t)=>q(e,e=>{let n=typeof t==`function`?t(e):t;return _d(n)?n:we(n)?Sd(e=>{n.then(t=>e(J(t)),t=>e(Rd(new om(t,`An unknown error occurred in Effect.andThen`))))}):J(n)})),Wd=e=>{let t=new W(`OnStep`);return t.effect_instruction_i0=e,t},Gd=e=>q(e,n),Kd=e=>Yd(e,{onFailure:J,onSuccess:Rd}),qd=t(2,(e,t)=>Jd(e,{onFailure:e=>J(t.onFailure(e)),onSuccess:e=>J(t.onSuccess(e))})),Jd=t(2,(e,t)=>{let n=new W(dt);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Yd=t(2,(e,t)=>Jd(e,{onFailure:e=>{if(co(e).length>0)return K(bo(e));let n=so(e);return n.length>0?t.onFailure(ri(n)):K(e)},onSuccess:t.onSuccess})),Xd=t(2,(e,t)=>gf(()=>{let n=P(e),r=Ln(n.length),i=0;return yd(Tf({while:()=>i<n.length,body:()=>t(n[i],i),step:e=>{r[i++]=e}}),r)})),Zd=t(2,(e,t)=>gf(()=>{let n=P(e),r=0;return Tf({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),Qd=t(e=>typeof e[0]==`boolean`||_d(e[0]),(e,t)=>_d(e)?q(e,e=>e?t.onTrue():t.onFalse()):e?t.onTrue():t.onFalse()),$d=q(Vd,e=>ef(e)),ef=e=>K(qa(e)),tf=e=>{let t=new W(pt);return t.effect_instruction_i0=td(1),t.effect_instruction_i1=()=>e,t},nf=e=>xd(e,function(){let e=new W(pt);return e.effect_instruction_i0=td(1),e.effect_instruction_i1=e=>Gu(e)?Pe(()=>this.effect_instruction_i0(tf)):Pe(()=>this.effect_instruction_i0(bf)),e}),rf=t(2,(e,t)=>xf(n=>q(Ld(n(e)),e=>Jm(t,e)))),af=t(2,(e,t)=>q(e,e=>Y(()=>t(e)))),of=t(2,(e,t)=>Yd(e,{onFailure:e=>zd(()=>t.onFailure(e)),onSuccess:e=>Y(()=>t.onSuccess(e))})),sf=t(2,(e,t)=>Jd(e,{onFailure:e=>{let n=fo(e);switch(n._tag){case`Left`:return zd(()=>t(n.left));case`Right`:return K(n.right)}},onSuccess:J})),cf=t(2,(e,t)=>lf(e,e=>um(e)?Sf:t(e.effect_instruction_i0))),lf=t(2,(e,t)=>xf(n=>Jd(n(e),{onFailure:e=>{let n=Q(e);return Jd(t(n),{onFailure:t=>Q(H(e,t)),onSuccess:()=>n})},onSuccess:e=>{let n=$(e);return Lf(t(n),n)}}))),uf=t(2,(e,t)=>lf(e,jm({onFailure:e=>oo(e)?bd(t(lo(e))):Sf,onSuccess:()=>Sf}))),df=t(2,(e,t)=>yf(e,t,J)),ff=e=>pf(e,n),pf=t(2,(e,t)=>Yd(e,{onFailure:e=>Nd(t(e)),onSuccess:J})),mf=Sr,hf=G((e,t)=>J(t.runtimeFlags)),J=e=>{let t=new gd(O);return t.effect_instruction_i0=e,t},gf=e=>{let t=new W(ct);return t.commit=e,t},Y=e=>{let t=new W(ft);return t.effect_instruction_i0=e,t},_f=t(e=>e.length===3||e.length===2&&!(ge(e[1])&&`onlyEffect`in e[1]),(e,t)=>q(e,e=>{let n=typeof t==`function`?t(e):t;return _d(n)?yd(n,e):we(n)?Sd(t=>{n.then(n=>t(J(e)),e=>t(Rd(new om(e,`An unknown error occurred in Effect.tap`))))}):J(e)})),vf=e=>G(t=>{let n=l(t.getFiberRef(Cp),_n(()=>t.scope()));return e(X(Cp,j(n)))}),yf=t(3,(e,t,n)=>Jd(e,{onFailure:e=>co(e).length>0?K(Tn(_o(e))):t(),onSuccess:n})),bf=e=>{let t=new W(pt);return t.effect_instruction_i0=nd(1),t.effect_instruction_i1=()=>e,t},xf=e=>xd(e,function(){let e=new W(pt);return e.effect_instruction_i0=nd(1),e.effect_instruction_i1=e=>Gu(e)?Pe(()=>this.effect_instruction_i0(tf)):Pe(()=>this.effect_instruction_i0(bf)),e}),Sf=J(void 0),Cf=e=>{let t=new W(pt);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},wf=t(2,(e,t)=>q(t,t=>t?l(e,af(j)):J(A()))),Tf=e=>{let t=new W(mt);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},Ef=e=>gf(()=>{let t=new W(ht);return t.effect_instruction_i0=e(),t}),Df=function(){let e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return Ef(()=>e(l))},Of=(e,...t)=>Object.defineProperty(t.length===0?function(...t){return Ef(()=>e.apply(this,t))}:function(...n){let r=Ef(()=>e.apply(this,n));for(let e of t)r=e(r,...n);return r},"length",{value:e.length,configurable:!0}),kf=t(2,(e,t)=>X(e,gp,t)),Af=t(2,(e,t)=>X(e,_p,t)),jf=t(2,(e,t)=>{let n=new W(pt);return n.effect_instruction_i0=t,n.effect_instruction_i1=()=>e,n}),Mf=t(2,(e,t)=>X(e,Tp,t)),Nf=t(2,(e,t)=>X(e,Ep,t)),Pf=e=>{let t=new W(_t);return e?.priority===void 0?t:mp(t,e.priority)},Ff=t(2,(e,t)=>q(e,e=>af(t,t=>[e,t]))),If=t(2,(e,t)=>q(e,e=>yd(t,e))),Lf=t(2,(e,t)=>q(e,()=>t)),Rf=t(3,(e,t,n)=>q(e,e=>af(t,t=>n(e,t)))),zf=Cd(()=>{let e=setInterval(()=>{},2**31-1);return Y(()=>clearInterval(e))}),Bf=e=>q(Vd,t=>l(e,Vf(t))),Vf=t(2,(e,t)=>q(e.interruptAsFork(t),()=>e.await)),Hf={_tag:`All`,syslog:0,label:`ALL`,ordinal:-(2**53-1),pipe(){return E(this,arguments)}},Uf={_tag:`Fatal`,syslog:2,label:`FATAL`,ordinal:5e4,pipe(){return E(this,arguments)}},Wf={_tag:`Error`,syslog:3,label:`ERROR`,ordinal:4e4,pipe(){return E(this,arguments)}},Gf={_tag:`Warning`,syslog:4,label:`WARN`,ordinal:3e4,pipe(){return E(this,arguments)}},Kf={_tag:`Info`,syslog:6,label:`INFO`,ordinal:2e4,pipe(){return E(this,arguments)}},qf={_tag:`Debug`,syslog:7,label:`DEBUG`,ordinal:1e4,pipe(){return E(this,arguments)}},Jf={_tag:`Trace`,syslog:7,label:`TRACE`,ordinal:0,pipe(){return E(this,arguments)}},Yf={_tag:`None`,syslog:7,label:`OFF`,ordinal:2**53-1,pipe(){return E(this,arguments)}},Xf=Symbol.for(`effect/FiberRef`),Zf={_A:e=>e},Qf=e=>G(t=>$(t.getFiberRef(e))),$f=t(2,(e,t)=>q(Qf(e),t)),ep=t(2,(e,t)=>tp(e,()=>[void 0,t])),tp=t(2,(e,t)=>G(n=>{let[r,i]=t(n.getFiberRef(e));return n.setFiberRef(e,i),J(r)})),X=t(3,(e,t,n)=>vd(If(Qf(t),ep(t,n)),()=>e,e=>ep(t,e))),np=t(3,(e,t,n)=>$f(t,r=>X(e,t,n(r)))),Z=(e,t)=>op(e,{differ:Au(),fork:t?.fork??n,join:t?.join}),rp=e=>{let t=Ou();return op(e,{differ:t,fork:t.empty})},ip=e=>{let t=ku(Au());return op(e,{differ:t,fork:t.empty})},ap=e=>{let t=Du();return op(e,{differ:t,fork:t.empty})},op=(e,t)=>({...kt,[Xf]:Zf,initial:e,commit(){return Qf(this)},diff:(e,n)=>t.differ.diff(e,n),combine:(e,n)=>t.differ.combine(e,n),patch:e=>n=>t.differ.patch(e,n),fork:t.fork,join:t.join??((e,t)=>t)}),sp=e=>op(e,{differ:$u,fork:$u.empty}),cp=p(Symbol.for(`effect/FiberRef/currentContext`),()=>ap(Ds())),lp=p(Symbol.for(`effect/FiberRef/currentSchedulingPriority`),()=>Z(0)),up=p(Symbol.for(`effect/FiberRef/currentMaxOpsBeforeYield`),()=>Z(2048)),dp=p(Symbol.for(`effect/FiberRef/currentLogAnnotation`),()=>Z(el())),fp=p(Symbol.for(`effect/FiberRef/currentLogLevel`),()=>Z(Kf)),pp=p(Symbol.for(`effect/FiberRef/currentLogSpan`),()=>Z(wl())),mp=t(2,(e,t)=>X(e,lp,t)),hp=t(2,(e,t)=>X(e,up,t)),gp=p(Symbol.for(`effect/FiberRef/currentConcurrency`),()=>Z(`unbounded`)),_p=p(Symbol.for(`effect/FiberRef/currentRequestBatching`),()=>Z(!0)),vp=p(Symbol.for(`effect/FiberRef/currentUnhandledErrorLogLevel`),()=>Z(j(qf))),yp=p(Symbol.for(`effect/FiberRef/versionMismatchErrorLogLevel`),()=>Z(j(Gf))),bp=t(2,(e,t)=>X(e,vp,t)),xp=p(Symbol.for(`effect/FiberRef/currentMetricLabels`),()=>ip(gr())),Sp=Qf(xp),Cp=p(Symbol.for(`effect/FiberRef/currentForkScopeOverride`),()=>Z(A(),{fork:()=>A(),join:(e,t)=>e})),wp=p(Symbol.for(`effect/FiberRef/currentInterruptedCause`),()=>Z(z,{fork:()=>z,join:(e,t)=>e})),Tp=p(Symbol.for(`effect/FiberRef/currentTracerEnabled`),()=>Z(!0)),Ep=p(Symbol.for(`effect/FiberRef/currentTracerTiming`),()=>Z(!0)),Dp=p(Symbol.for(`effect/FiberRef/currentTracerSpanAnnotations`),()=>Z(el())),Op=p(Symbol.for(`effect/FiberRef/currentTracerSpanLinks`),()=>Z(I())),kp=Symbol.for(`effect/Scope`),Ap=Symbol.for(`effect/CloseableScope`),jp=(e,t)=>e.addFinalizer(()=>bd(t)),Mp=(e,t)=>e.addFinalizer(t),Np=(e,t)=>e.close(t),Pp=(e,t)=>e.fork(t),Fp=e=>Ip(n)(e),Ip=t(2,(e,t)=>{let r=l(e,uo,En(t));switch(r._tag){case`None`:return l(co(e),ni,hn({onNone:()=>{let t=P(lo(e)).flatMap(e=>P(Zc(e)).map(e=>`#${e}`));return new Up(t?`Interrupted by fibers: ${t.join(`, `)}`:void 0)},onSome:n}));case`Some`:return r.value}}),Lp=function(){class e extends globalThis.Error{commit(){return Rd(this)}toJSON(){let e={...this};return this.message&&(e.message=this.message),this.cause&&(e.cause=this.cause),e}[C](){return this.toString===globalThis.Error.prototype.toString?`Bun`in globalThis?Ho(Ka(this),{renderErrorCause:!0}):this:this.stack?`${this.toString()}\n${this.stack.split(`
12
- `).slice(1).join(`
13
- `)}`:this.toString()}}return Object.assign(e.prototype,At),e}(),Rp=(e,t)=>{class n extends Lp{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},zp=Symbol.for(`effect/Cause/errors/RuntimeException`),Bp=Rp({[zp]:zp},`RuntimeException`),Vp=e=>m(e,zp),Hp=Symbol.for(`effect/Cause/errors/InterruptedException`),Up=Rp({[Hp]:Hp},`InterruptedException`),Wp=e=>m(e,Hp),Gp=Symbol.for(`effect/Cause/errors/IllegalArgument`),Kp=Rp({[Gp]:Gp},`IllegalArgumentException`),qp=e=>m(e,Gp),Jp=Symbol.for(`effect/Cause/errors/NoSuchElement`),Yp=Rp({[Jp]:Jp},`NoSuchElementException`),Xp=e=>m(e,Jp),Zp=Symbol.for(`effect/Cause/errors/InvalidPubSubCapacityException`),Qp=Symbol.for(`effect/Cause/errors/ExceededCapacityException`),$p=Rp({[Qp]:Qp},`ExceededCapacityException`),em=e=>m(e,Qp),tm=Symbol.for(`effect/Cause/errors/Timeout`),nm=Rp({[tm]:tm},`TimeoutException`),rm=e=>new nm(`Operation timed out after '${yc(e)}'`),im=e=>m(e,tm),am=Symbol.for(`effect/Cause/errors/UnknownException`),om=function(){class e extends Lp{_tag=`UnknownException`;error;constructor(e,t){super(t??`An unknown error occurred`,{cause:e}),this.error=e}}return Object.assign(e.prototype,{[am]:am,name:`UnknownException`}),e}(),sm=e=>m(e,am),cm=e=>_d(e)&&`_tag`in e&&(e._tag===`Success`||e._tag===`Failure`),lm=e=>e._tag===`Failure`,um=e=>e._tag===`Success`,dm=e=>{switch(e._tag){case D:return ao(e.effect_instruction_i0);case O:return!1}},fm=t(2,(e,t)=>{switch(e._tag){case D:return Q(e.effect_instruction_i0);case O:return $(t)}}),pm=e=>fm(e,void 0),mm=e=>{switch(e._tag){case D:return j(e.effect_instruction_i0);case O:return A()}},hm=(e,t)=>Vm(e,t?.parallel?V:H),gm=e=>Q(B(e)),_m=t(2,(e,t)=>{switch(e._tag){case D:return!1;case O:return t(e.effect_instruction_i0)}}),vm=e=>Q(Ka(e)),Q=e=>{let t=new hd(D);return t.effect_instruction_i0=e,t},ym=t(2,(e,t)=>{switch(e._tag){case D:return Q(e.effect_instruction_i0);case O:return t(e.effect_instruction_i0)}}),bm=t(2,(e,t)=>{switch(e._tag){case D:return J(Q(e.effect_instruction_i0));case O:return t(e.effect_instruction_i0)}}),xm=e=>l(e,ym(n)),Sm=t(2,(e,t)=>{switch(e._tag){case D:return J(Q(e.effect_instruction_i0));case O:return Ld(t(e.effect_instruction_i0))}}),Cm=e=>{switch(e._tag){case`Left`:return vm(e.left);case`Right`:return $(e.right)}},wm=e=>{switch(e._tag){case`None`:return vm(void 0);case`Some`:return $(e.value)}},Tm=t(2,(e,t)=>{switch(e._tag){case D:return t(e.effect_instruction_i0);case O:return e.effect_instruction_i0}}),Em=e=>Q(qa(e)),Dm=t(2,(e,t)=>{switch(e._tag){case D:return Q(e.effect_instruction_i0);case O:return $(t(e.effect_instruction_i0))}}),Om=t(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case D:return Q(l(e.effect_instruction_i0,Co(t)));case O:return $(n(e.effect_instruction_i0))}}),km=t(2,(e,t)=>{switch(e._tag){case D:return Q(l(e.effect_instruction_i0,Co(t)));case O:return $(e.effect_instruction_i0)}}),Am=t(2,(e,t)=>{switch(e._tag){case D:return Q(t(e.effect_instruction_i0));case O:return $(e.effect_instruction_i0)}}),jm=t(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case D:return t(e.effect_instruction_i0);case O:return n(e.effect_instruction_i0)}}),Mm=t(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case D:return t(e.effect_instruction_i0);case O:return n(e.effect_instruction_i0)}}),$=e=>{let t=new gd(O);return t.effect_instruction_i0=e,t},Nm=$(void 0),Pm=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>[e,t],onFailure:H})),Fm=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>e,onFailure:H})),Im=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>t,onFailure:H})),Lm=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>[e,t],onFailure:V})),Rm=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>e,onFailure:V})),zm=t(2,(e,t)=>Bm(e,t,{onSuccess:(e,t)=>t,onFailure:V})),Bm=t(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case D:switch(t._tag){case O:return Q(e.effect_instruction_i0);case D:return Q(n(e.effect_instruction_i0,t.effect_instruction_i0))}case O:switch(t._tag){case O:return $(r(e.effect_instruction_i0,t.effect_instruction_i0));case D:return Q(t.effect_instruction_i0)}}}),Vm=(e,t)=>{let n=Br(e);return ti(n)?l(oi(n),Tr(l(ii(n),Dm(L)),(e,n)=>l(e,Bm(n,{onSuccess:(e,t)=>l(e,Xr(t)),onFailure:t}))),Dm(Wr),Dm(e=>Ur(e)),j):A()},Hm=e=>({...kt,[od]:sd,state:Sc(cd([])),commit(){return Gm(this)},blockingOn:e}),Um=()=>q(Vd,e=>Wm(e)),Wm=e=>Y(()=>Hm(e)),Gm=e=>Cd(t=>{let n=wc(e.state);switch(n._tag){case ad:return t(n.effect);case id:return n.joiners.push(t),th(e,t)}},e.blockingOn),Km=t(2,(e,t)=>rf(t,e)),qm=t(2,(e,t)=>Y(()=>{let n=wc(e.state);switch(n._tag){case ad:return!1;case id:Tc(e.state,ld(t));for(let e=0,r=n.joiners.length;e<r;e++)n.joiners[e](t);return!0}})),Jm=t(2,(e,t)=>qm(e,t)),Ym=t(2,(e,t)=>qm(e,K(t))),Xm=e=>q(Vd,t=>qm(e,ef(t))),Zm=t(2,(e,t)=>qm(e,ef(t))),Qm=e=>Y(()=>wc(e.state)._tag===ad),$m=t(2,(e,t)=>qm(e,J(t))),eh=(e,t)=>{let n=wc(e.state);if(n._tag===`Pending`){Tc(e.state,ld(t));for(let e=0,r=n.joiners.length;e<r;e++)n.joiners[e](t)}},th=(e,t)=>Y(()=>{let n=wc(e.state);if(n._tag===`Pending`){let e=n.joiners.indexOf(t);e>=0&&n.joiners.splice(e,1)}}),nh=G(e=>$(e.currentContext)),rh=()=>nh,ih=e=>q(rh(),e),ah=t(2,(e,t)=>X(cp,t)(e)),oh=t(2,(e,t)=>np(cp,e=>Ns(e,t))(e)),sh=t(2,(e,t)=>ih(n=>ah(e,t(n)))),ch=t(2,(e,t)=>q(e,e=>q(t.predicate(e),n=>n?J(e):t.orElse(e)))),lh=t(2,(e,t)=>ch(e,{predicate:t.predicate,orElse:e=>Rd(t.orFailWith(e))})),uh=e=>{let t=e.currentSpan;return t!==void 0&&t._tag===`Span`?j(t):A()},dh={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:BigInt(0),endTime:BigInt(0),exit:Nm},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},fh=e=>Object.assign(Object.create(dh),e);export{Ep as $,Co as $a,se as $c,ec as $i,sh as $n,Wn as $o,Zu as $r,ln as $s,Bm as $t,Td as A,so as Aa,Ze as Ac,cl as Ai,ef as An,Xr as Ao,xf as Ar,Sn as As,Sm as At,Cp as B,io as Ba,v as Bc,Uc as Bi,im as Bn,Un as Bo,jf as Br,vn as Bs,Om as Bt,yd as C,co as Ca,gt as Cc,nl as Ci,c as Cl,Zd as Cn,Br as Co,J as Cr,Dn as Cs,gm as Ct,dd as D,Ka as Da,C as Dc,ol as Di,$d as Dn,ti as Do,rm as Dr,_n as Ds,ym as Dt,wd as E,z as Ea,$e as Ec,sl as Ei,l as El,Qd as En,ei as Eo,_f as Er,jn as Es,Q as Et,kd as F,mo as Fa,S as Fc,Gc as Fi,em as Fn,Ur as Fo,Tf as Fr,Mn as Fs,cm as Ft,up as G,ro as Ga,De as Gc,mc as Gi,Uf as Gn,xr as Go,Pf as Gr,dn as Gs,$ as Gt,dp as H,no as Ha,Ve as Hc,wc as Hi,Hf as Hn,Ar as Ho,Mf as Hr,j as Hs,Am as Ht,rh as I,qa as Ia,Ke as Ic,Kc as Ii,qp as In,Kr as Io,kf as Ir,Cn as Is,lm as It,lp as J,oo as Ja,Pe as Jc,$s as Ji,Jf as Jn,P as Jo,Lf as Jr,an as Js,Fm as Jt,xp as K,Qa as Ka,Ee as Kc,U as Ki,Kf as Kn,yr as Ko,Ff as Kr,nn as Ks,Nm as Kt,ih as L,ho as La,x as Lc,Qc as Li,Wp as Ln,Jr as Lo,G as Lr,En as Ls,dm as Lt,Od as M,jo as Ma,w as Mc,Xc as Mi,nf as Mn,Wr as Mo,Cf as Mr,M as Ms,wm as Mt,Fp as N,wo as Na,et as Nc,qc as Ni,rf as Nn,oi as No,Sf as Nr,mn as Ns,Tm as Nt,Md as O,uo as Oa,T as Oc,dl as Oi,Vf as On,ai as Oo,vf as Or,xn as Os,bm as Ot,Ip as P,To as Pa,at as Pc,Jc as Pi,_d as Pn,Hr as Po,wf as Pr,N as Ps,Em as Pt,Op as Q,vo as Qa,ce as Qc,nc as Qi,sf as Qn,$n as Qo,Vu as Qr,sn as Qs,Im as Qt,gp as R,lo as Ra,We as Rc,$c as Ri,Xp as Rn,Ln as Ro,hp as Rr,hn as Rs,um as Rt,Ud as S,Do as Sa,mt as Sc,rl as Si,s as Sl,Xd as Sn,$r as So,Wd as Sr,An as Ss,hm as St,Cd as T,po as Ta,E as Tc,ll as Ti,n as Tl,Df as Tn,ii as To,Y as Tr,bn as Ts,vm as Tt,fp as U,Ya as Ua,y as Uc,Sc as Ui,qf as Un,gr as Uo,Nf as Ur,en as Us,jm as Ut,wp as V,Za as Va,_ as Vc,Cc as Vi,sm as Vn,pr as Vo,mp as Vr,yn as Vs,km as Vt,pp as W,Xa as Wa,g as Wc,Tc as Wi,Wf as Wn,zn as Wo,bp as Wr,fn as Ws,Mm as Wt,Tp as X,$a as Xa,Me as Xc,Xs as Xi,af as Xn,Cr as Xo,ed as Xr,cn as Xs,Rm as Xt,uh as Y,eo as Ya,Ie as Yc,Ys as Yi,Gf as Yn,Or as Yo,Rf as Yr,$t as Ys,Lm as Yt,Dp as Z,go as Za,m as Zc,hc as Zi,of as Zn,Qn as Zo,rd as Zr,on as Zs,zm as Zt,tm as _,es as _a,dt as _c,kl as _i,p as _l,lh as _n,ka as _o,hf as _r,hr as _s,Id as _t,Kp as a,Is as aa,Vt as ac,Qu as ai,ye as al,Hd as an,Bo as ao,fh as ar,Rn as as,Jm as at,Lp as b,Eo as ba,ft as bc,ul as bi,a as bl,Kd as bn,Qr as bo,Np as br,Nn as bs,pm as bt,Hp as c,Ds as ca,Dt as cc,jl as ci,ge as cl,X as cn,to as co,uf as cr,_r as cs,Zm as ct,Jp as d,Ts as da,st as dc,Cl as di,ae as dl,Z as dn,xo as do,df as dr,Er as ds,$m as dt,rc as ea,un as ec,Hu as ei,xe as el,Rd as en,zo as eo,qd as er,Kn as es,vp as et,md as f,Es as fa,ct as fc,wl as fi,le as fl,ap as fn,Ma as fo,jd as fr,sr as fs,eh as ft,nm as g,js as ga,ut as gc,Dl as gi,de as gl,ch as gn,Ia as go,fd as gr,Dr as gs,Fd as gt,kp as h,Ps as ha,lt as hc,Tl as hi,be as hl,sp as hn,Da as ho,oh as hr,nr as hs,Pd as ht,Qp as i,ws as ia,Bt as ic,Ju as ii,pe as il,Vd as in,Xo as io,zf as ir,tr as is,Km as it,Dd as j,Mo as ja,Qe as jc,Yc as ji,tf as jn,si as jo,Sd as jr,gn as js,Cm as jt,Ed as k,fo as ka,Ye as kc,il as ki,Bf as kn,L as ko,bf as kr,wn as ks,xm as kt,Zp as l,As as la,Ot as lc,Ml as li,Ce as ll,np as ln,qo as lo,ff as lr,Vn as ls,Qm as lt,zp as m,Ns as ma,ht as mc,bl as mi,ie as ml,op as mn,Ea as mo,ah as mr,dr as ms,Nd as mt,pd as n,lc as na,tn as nc,Wu as ni,Se as nl,Bd as nn,Ho as no,Yd as nr,jr as ns,xd as nt,Gp as o,Fs as oa,jt as oc,Yu as oi,fe as ol,Qf as on,Vo as oo,cf as or,vr as os,Ym as ot,Bp as p,Os as pa,D as pc,xl as pi,_e as pl,rp as pn,Ta as po,mf as pr,ir as ps,Hm as pt,_p as q,ao as qa,je as qc,gc as qi,Yf as qn,br as qo,If as qr,rn as qs,Pm as qt,$p as r,Qs as ra,Rt as rc,qu as ri,me as rl,zd as rn,Go as ro,Sp as rr,er as rs,Gm as rt,Up as s,ks as sa,kt as sc,Eu as si,oe as sl,$f as sn,H as so,lf as sr,Bn as ss,Xm as st,Ap as t,cc as ta,k as tc,Uu as ti,ue as tl,K as tn,V as to,Jd as tr,qn as ts,yp as tt,Yp as u,Ms as ua,yt as uc,El as ui,he as ul,ep as un,yo as uo,pf as ur,Tr as us,Um as ut,om as v,vs as va,vt as vc,Al as vi,f as vl,q as vn,Na as vo,jp as vr,Zn as vs,Ld as vt,bd as w,B as wa,_t as wc,al as wi,t as wl,Ef as wn,ni as wo,gf as wr,On as ws,_m as wt,vd as x,So as xa,pt as xc,tl as xi,i as xl,Of as xn,I as xo,Pp as xr,Pn as xs,mm as xt,am as y,Ua as ya,O as yc,el as yi,u as yl,Gd as yn,Yr as yo,Mp as yr,cr as ys,fm as yt,cp as z,Ja as za,b as zc,Fc as zi,Vp as zn,Hn as zo,Af as zr,A as zs,Dm as zt};
@@ -1,26 +0,0 @@
1
- import{$c as e,$i as t,$o as n,$s as r,Ac as i,Ao as a,As as o,Bc as s,Bs as c,Cl as l,Co as u,Cr as d,Cs as f,Dc as p,Dn as m,Ds as h,El as g,Eo as _,Es as ee,Fc as te,Fi as ne,Gi as re,Go as ie,Gs as ae,Hc as oe,Hi as se,Hs as v,Ii as ce,Io as le,Is as ue,Ji as de,Jo as fe,Jr as pe,Js as me,Ko as he,Ks as ge,Lc as _e,Lo as ve,Lr as ye,Ls as be,Mi as xe,Ms as Se,Ni as Ce,Nr as we,Ns as Te,Oo as Ee,Os as De,Pi as Oe,Pr as ke,Ps as Ae,Qc as je,Qi as Me,Qs as Ne,Ro as Pe,Rs as y,So as Fe,Ss as Ie,Tc as Le,Tl as b,Tr as Re,Uc as ze,Ui as Be,Uo as Ve,Us as He,Vc as Ue,Vo as We,Wc as Ge,Wi as Ke,Ws as qe,Xi as Je,Xn as Ye,Xs as Xe,Yi as Ze,Yo as Qe,Ys as x,Zc as $e,Zs as et,_l as tt,_o as nt,al as rt,b as it,bo as at,ci as ot,cl as st,cr as ct,ct as lt,dl as ut,dt,el as ft,es as pt,fl as mt,fs as ht,ft as gt,gl as _t,hl as vt,ia as yt,il as bt,in as xt,jc as St,jo as Ct,js as wt,k as Tt,kc as Et,ko as Dt,kr as Ot,ks as kt,lc as At,li as jt,ll as Mt,ml as Nt,ms as Pt,na as Ft,nc as It,oa as Lt,ol as Rt,pt as zt,qs as Bt,rl as Vt,ro as Ht,rt as Ut,sl as Wt,ss as Gt,ta as Kt,tc as S,ts as qt,ul as Jt,ut as Yt,vl as Xt,vn as Zt,w as Qt,wl as C,wr as $t,ws as en,xl as tn,xo as nn,xs as rn,yl as an,yo as on,zc as sn,zs as w}from"./core-C1FEy4nD.js";import{$ as cn,A as ln,An as un,At as dn,B as fn,Bt as pn,C as mn,Cn as hn,Ct as gn,D as _n,Dt as vn,E as yn,En as bn,Et as xn,F as Sn,Ft as Cn,G as wn,Gn as Tn,Gt as En,I as T,In as Dn,It as E,J as On,Kn as kn,Kt as An,L as jn,M as Mn,Mn as Nn,Mt as Pn,N as Fn,Nn as In,Nt as Ln,O as Rn,On as zn,Ot as Bn,Pn as Vn,Pt as Hn,Q as Un,R as Wn,Rt as Gn,S as Kn,Sn as qn,St as Jn,T as Yn,Tn as Xn,Tt as Zn,Ut as Qn,V as $n,Vt as er,W as tr,Wn as nr,Wt as rr,X as ir,Y as ar,Z as or,_ as D,_n as sr,_t as cr,b as lr,bn as ur,bt as dr,c as fr,cn as pr,ct as mr,d as hr,dn as gr,et as _r,f as vr,fn as yr,g as br,gn as xr,gt as Sr,h as Cr,hn as wr,ht as Tr,i as Er,it as Dr,j as Or,jt as kr,k as Ar,kn as jr,kt as Mr,ln as Nr,lt as Pr,m as Fr,mn as Ir,n as O,nn as Lr,nt as Rr,o as zr,ot as k,p as Br,pt as Vr,q as Hr,qn as Ur,qt as Wr,r as Gr,s as Kr,st as A,tt as qr,u as Jr,un as Yr,ut as Xr,v as Zr,vn as Qr,w as $r,wn as ei,wt as j,x as M,xt as ti,y as ni,yn as ri,z as ii,zt as ai}from"./Effect-fMAnbW-8.js";import{a as oi,c as si,d as ci,h as li,i as ui,l as di,m as fi,n as pi,o as mi,p as hi,r as gi,s as _i,u as vi}from"./Cause-BpHZgZuR.js";import{a as yi,c as bi,d as xi,f as Si,h as Ci,i as wi,l as Ti,m as Ei,n as Di,p as Oi,r as ki,s as Ai,u as ji}from"./Exit-BhYZ1Mg3.js";import Mi from"node:os";const Ni=jt,Pi=e=>t=>{let n=t===void 0?Object.create(At):Ni(t);return n._tag=e,n},Fi=ot,Ii=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends it{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError}(),Li=e=>{let t={BaseEffectError:class extends Ii{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Ri=Symbol.for(`effect/DateTime`),zi=Symbol.for(`effect/DateTime/TimeZone`),Bi={[Ri]:Ri,pipe(){return Le(this,arguments)},[p](){return this.toString()},toJSON(){return _a(this).toJSON()}},Vi={...Bi,_tag:`Utc`,[Ge](){return sn(this,oe(this.epochMillis))},[_e](e){return qi(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${_a(this).toJSON()})`}},Hi={...Bi,_tag:`Zoned`,[Ge](){return g(oe(this.epochMillis),s(Ue(this.zone)),sn(this))},[_e](e){return qi(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&te(this.zone,e.zone)},toString(){return`DateTime.Zoned(${ja(this)})`}},Ui={[zi]:zi,[p](){return this.toString()}},Wi={...Ui,_tag:`Named`,[Ge](){return sn(this,ze(`Named:${this.id}`))},[_e](e){return Ji(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},Gi={...Ui,_tag:`Offset`,[Ge](){return sn(this,ze(`Offset:${this.offset}`))},[_e](e){return Ji(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${ba(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},Ki=(e,t,n)=>{let r=Object.create(Hi);return r.epochMillis=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},qi=e=>$e(e,Ri),Ji=e=>$e(e,zi),Yi=e=>Ji(e)&&e._tag===`Offset`,Xi=e=>Ji(e)&&e._tag===`Named`,Zi=e=>e._tag===`Utc`,Qi=e=>e._tag===`Zoned`,$i=an((e,t)=>e.epochMillis===t.epochMillis),ea=e=>{let t=Object.create(Vi);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ta=e=>{let t=e.getTime();if(Number.isNaN(t))throw new pi(`Invalid date`);return ea(t)},na=e=>{if(qi(e))return e;if(e instanceof Date)return ta(e);if(typeof e==`object`){let t=new Date(0);return Ca(t,e),ta(t)}else if(typeof e==`string`&&!ra(e))return ta(new Date(e+`Z`));return ta(new Date(e))},ra=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),ia=(e,t)=>{if(t?.timeZone===void 0&&qi(e)&&Qi(e))return e;let n=na(e);if(n.epochMillis<-86399999568e5||n.epochMillis>86399999496e5)throw RangeError(`Epoch millis out of range: ${n.epochMillis}`);let r;if(t?.timeZone===void 0){let e=new Date(n.epochMillis).getTimezoneOffset()*-60*1e3;r=fa(e)}else if(Ji(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=fa(t.timeZone);else{let e=ha(t.timeZone);if(Se(e))throw new pi(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?Ta(n.epochMillis,r,t?.disambiguation??`compatible`):Ki(n.epochMillis,r,n.partsUtc)},aa=ue(ia),oa=/^(.{17,35})\[(.+)\]$/,sa=e=>{let t=oa.exec(e);if(t===null){let t=Da(e);return t===null?w():aa(e,{timeZone:t})}let[,n,r]=t;return aa(n,{timeZone:r})},ca=tt(`effect/DateTime/validZoneCache`,()=>new Map),la={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ua=e=>{let t=e.resolvedOptions().timeZone;if(ca.has(t))return ca.get(t);let n=Object.create(Wi);return n.id=t,n.format=e,ca.set(t,n),n},da=e=>{if(ca.has(e))return ca.get(e);try{return ua(new Intl.DateTimeFormat(`en-US`,{...la,timeZone:e}))}catch{throw new pi(`Invalid time zone: ${e}`)}},fa=e=>{let t=Object.create(Gi);return t.offset=e,t},pa=ue(da),ma=/^(?:GMT|[+-])/,ha=e=>{if(ma.test(e)){let t=Da(e);return t===null?w():v(fa(t))}return pa(e)},ga=e=>e._tag===`Offset`?ba(e.offset):e.id,_a=e=>new Date(e.epochMillis),va=e=>{if(e._tag===`Utc`)return new Date(e.epochMillis);if(e.zone._tag===`Offset`)return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},ya=e=>va(e).getTime()-Sa(e),ba=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},xa=e=>ba(ya(e)),Sa=e=>e.epochMillis,Ca=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},wa=1440*60*1e3,Ta=(e,t,n)=>{if(t._tag===`Offset`)return Ki(e-t.offset,t);let r=Oa(e-wa,e,t),i=Oa(e+wa,e,t);if(r===i)return Ki(e-r,t);let a=r<i,o=r-i;if(a){if(Oa(e-i,e,t)===i)return Ki(e-i,t);let a=Ki(e-r,t);if(e!==va(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return Ki(e-i,t);case`compatible`:case`later`:return a}return a}if(Oa(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Oa(e-r+o,e+o,t)===r)return Ki(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return Ki(e-i,t)},Ea=/([+-])(\d{2}):(\d{2})$/,Da=e=>{let t=Ea.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Oa=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Da(r);return i===null?ya(Ki(t,n)):i},ka=e=>_a(e).toISOString(),Aa=e=>{let t=va(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${xa(e)}`},ja=e=>e.zone._tag===`Offset`?Aa(e):`${Aa(e)}[${e.zone.id}]`,Ma=e=>e.toUpperCase(),Na=e=>e.toLowerCase(),Pa=e=>e.length===0?e:Ma(e[0])+e.slice(1),Fa=e=>e.length===0?e:Na(e[0])+e.slice(1),Ia=e=>e.length>0,La=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return La(e,t.from)}},Ra=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},za=e=>Array.isArray(e),Ba=e=>!Array.isArray(e),Va=e=>`[${i(e)}]`,Ha=e=>za(e)?e.map(Va).join(``):Va(e),Ua=(e,t,n,r)=>{let i=e;return n&&qt(n)&&(i+=`\nat path: ${Ha(n)}`),t!==void 0&&(i+=`\ndetails: ${t}`),r&&(i+=`\nschema (${r._tag}): ${r}`),i},Wa=e=>Ua(`Invalid Argument`,e),Ga=(e,t,n)=>Ua(`Unsupported schema or overlapping types`,`cannot extend ${e} with ${t}`,n),Ka=e=>Ua(`Unsupported key schema`,void 0,void 0,e),qa=e=>Ua(`Unsupported literal`,`literal value: ${St(e)}`),Ja=e=>Ua(`Duplicate index signature`,`${e} index signature`),Ya=Ua(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),Xa=Ua(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),Za=e=>Ua(`Duplicate property signature transformation`,`Duplicate key ${St(e)}`),Qa=e=>Ua(`Duplicate property signature`,`Duplicate key ${St(e)}`),$a=Symbol.for(`effect/SchemaId/DateFromSelf`),eo=Symbol.for(`effect/SchemaId/GreaterThan`),to=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),no=Symbol.for(`effect/SchemaId/LessThan`),ro=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),io=Symbol.for(`effect/SchemaId/Int`),ao=Symbol.for(`effect/SchemaId/NonNaN`),oo=Symbol.for(`effect/SchemaId/Finite`),so=Symbol.for(`effect/SchemaId/JsonNumber`),co=Symbol.for(`effect/SchemaId/Between`),lo=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),uo=Symbol.for(`effect/SchemaId/BetweenBigint`),fo=Symbol.for(`effect/SchemaId/MinLength`),po=Symbol.for(`effect/SchemaId/Length`),mo=Symbol.for(`effect/SchemaId/MinItems`),ho=Symbol.for(`effect/annotation/TypeConstructor`),go=Symbol.for(`effect/annotation/Brand`),_o=Symbol.for(`effect/annotation/SchemaId`),vo=Symbol.for(`effect/annotation/Message`),yo=Symbol.for(`effect/annotation/MissingMessage`),bo=Symbol.for(`effect/annotation/Identifier`),xo=Symbol.for(`effect/annotation/Title`),So=Symbol.for(`effect/annotation/AutoTitle`),Co=Symbol.for(`effect/annotation/Description`),wo=Symbol.for(`effect/annotation/Examples`),To=Symbol.for(`effect/annotation/Default`),Eo=Symbol.for(`effect/annotation/JSONSchema`),Do=Symbol.for(`effect/annotation/Arbitrary`),Oo=Symbol.for(`effect/annotation/Pretty`),ko=Symbol.for(`effect/annotation/Equivalence`),Ao=Symbol.for(`effect/annotation/Documentation`),jo=Symbol.for(`effect/annotation/Concurrency`),Mo=Symbol.for(`effect/annotation/Batching`),No=Symbol.for(`effect/annotation/ParseIssueTitle`),Po=Symbol.for(`effect/annotation/ParseOptions`),Fo=Symbol.for(`effect/annotation/DecodingFallback`),Io=Symbol.for(`effect/annotation/Surrogate`),Lo=Symbol.for(`effect/annotation/StableFilter`),Ro=C(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?v(e.annotations[t]):w()),zo=Ro(go),Bo=Ro(vo),Vo=Ro(yo),Ho=Ro(xo),Uo=Ro(So),Wo=Ro(bo),Go=Ro(Co),Ko=Ro(jo),qo=Ro(Mo),Jo=Ro(No),Yo=Ro(Po),Xo=Ro(Fo),Zo=Ro(Io),Qo=Ro(Lo),$o=e=>rn(Qo(e),e=>e===!0),es=Symbol.for(`effect/annotation/JSONIdentifier`),ts=Ro(es),ns=e=>c(ts(e),()=>Wo(e)),rs=Symbol.for(`effect/schema/ParseJson`);var is=class{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag=`Declaration`;constructor(e,t,n,r={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=n,this.annotations=r}toString(){return h(yc(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const as=e=>t=>t._tag===e;var os=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.literal))}toJSON(){return{_tag:this._tag,literal:je(this.literal)?String(this.literal):this.literal,annotations:F(this.annotations)}}};const ss=as(`Literal`),cs=new os(null);var ls=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:F(this.annotations)}}};const us=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`undefined`}),ds=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`never`}),fs=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`unknown`}),ps=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`any`}),ms=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`string`,[Co]:`a string`}),hs=as(`StringKeyword`),gs=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`number`,[Co]:`a number`}),_s=as(`NumberKeyword`),vs=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`boolean`,[Co]:`a boolean`}),ys=as(`BooleanKeyword`),bs=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`bigint`,[Co]:`a bigint`}),xs=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`symbol`,[Co]:`a symbol`}),Ss=as(`SymbolKeyword`);var Cs=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:F(this.annotations)}}toString(){return String(this.type)}},ws=class extends Cs{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:F(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}};const Ts=e=>e.map(e=>e.type);var Es=class{elements;rest;isReadonly;annotations;_tag=`TupleType`;constructor(e,t,n,r={}){this.elements=e,this.rest=t,this.isReadonly=n,this.annotations=r;let i=!1,a=!1;for(let t of e)if(t.isOptional)i=!0;else if(i){a=!0;break}if(a||i&&t.length>1)throw Error(Xa)}toString(){return h(yc(this),()=>Ds(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Ds=e=>{let t=e.elements.map(String).join(`, `);return Gt(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{let i=String(n),a=i.includes(` | `)?`(${i})`:i;if(r.length>0){let n=r.map(String).join(`, `);return e.elements.length>0?`readonly [${t}, ...${a}[], ${n}]`:`readonly [...${a}[], ${n}]`}else if(e.elements.length>0)return`readonly [${t}, ...${a}[]]`;else return`ReadonlyArray<${i}>`}})};var N=class extends ws{name;isReadonly;constructor(e,t,n,r,i){super(t,n,i),this.name=e,this.isReadonly=r}toString(){return(this.isReadonly?`readonly `:``)+String(this.name)+(this.isOptional?`?`:``)+`: `+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Os=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return Os(e.from)}return!1};var ks=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,Os(e))this.parameter=e;else throw Error(Ya)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},As=class{annotations;_tag=`TypeLiteral`;propertySignatures;indexSignatures;constructor(e,t,n={}){this.annotations=n;let r={};for(let t=0;t<e.length;t++){let n=e[t].name;if(Object.prototype.hasOwnProperty.call(r,n))throw Error(Qa(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=mc(t[e].parameter);if(hs(n)){if(i.string)throw Error(Ja(`string`));i.string=!0}else if(Ss(n)){if(i.symbol)throw Error(Ja(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return h(yc(this),()=>Ms(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const js=e=>e.map(String).join(`; `),Ms=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${js(e.indexSignatures)} }`:`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${js(e.indexSignatures)} }`;else return`{}`},Ns=as(`TypeLiteral`),Ps=ht(Ur(Tn,e=>{switch(e._tag){case`AnyKeyword`:return 0;case`UnknownKeyword`:return 1;case`ObjectKeyword`:return 2;case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:return 3}return 4})),Fs={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},Is=e=>he(e,e=>Vs(e)?Is(e.types):[e]),Ls=e=>{let t=Ps(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[ps];case`UnknownKeyword`:return[fs];case`ObjectKeyword`:case`UndefinedKeyword`:case`VoidKeyword`:case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:r[e._tag]||(r[e._tag]=e,n.push(e));break;case`Literal`:{let t=typeof e.literal;switch(t){case`string`:case`number`:case`bigint`:case`boolean`:!r[Fs[t]]&&!i.includes(e.literal)&&(i.push(e.literal),n.push(e));break;case`object`:i.includes(e.literal)||(i.push(e.literal),n.push(e));break}break}case`UniqueSymbol`:!r.SymbolKeyword&&!i.includes(e.symbol)&&(i.push(e.symbol),n.push(e));break;case`TupleType`:r.ObjectKeyword||n.push(e);break;case`TypeLiteral`:e.propertySignatures.length===0&&e.indexSignatures.length===0?r[`{}`]||(r[`{}`]=e,n.push(e)):r.ObjectKeyword||n.push(e);break;default:n.push(e)}return n};var Rs=class e{types;annotations;static make=(t,n)=>Bs(t)?new e(t,n):t.length===1?t[0]:ds;static unify=(t,n)=>e.make(Ls(Is(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return h(yc(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const zs=(e,t)=>e.map(t),Bs=e=>e.length>1,Vs=as(`Union`),Hs=tt(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap);var Us=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=Ra(e)}toString(){return yc(this).pipe(c(()=>f(ue(this.f)(),e=>yc(e))),h(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=Hs.get(e);return t||(Hs.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:F(this.annotations)},Hs.set(e,t),t)}},Ws=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return Wo(this).pipe(h(()=>y(vc(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>Gs(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:F(this.annotations)}}};const Gs=as(`Refinement`),Ks={};var qs=class{from;to;transformation;annotations;_tag=`Transformation`;constructor(e,t,n,r={}){this.from=e,this.to=t,this.transformation=n,this.annotations=r}toString(){return h(yc(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:F(this.annotations)}}};const Js=as(`Transformation`);var Ys=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}};const Xs=e=>t=>t._tag===e,Zs=new class{_tag=`ComposeTransformation`};var Qs=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},$s=class{propertySignatureTransformations;_tag=`TypeLiteralTransformation`;constructor(e){this.propertySignatureTransformations=e;let t={},n={};for(let r of e){let e=r.from;if(t[e])throw Error(Za(e));t[e]=!0;let i=r.to;if(n[i])throw Error(Za(i));n[i]=!0}}};const ec=Xs(`TypeLiteralTransformation`),tc=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[bo];let i={...r,...t},a=Zo(e);return Ae(a)&&(i[Io]=tc(a.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},nc=(e,t)=>{switch(e._tag){case`Literal`:return nr(String(e.literal));case`StringKeyword`:return`[\\s\\S]*?`;case`NumberKeyword`:return`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;case`TemplateLiteral`:return ic(e,t,!1);case`Union`:return e.types.map(e=>nc(e,t)).join(`|`)}},rc=(e,t,n,r)=>{if(Vs(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},ic=(e,t,n)=>{let r=``;if(e.head!==``){let i=nr(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=nc(i.type,t);if(r+=rc(i.type,e,t,n),i.literal!==``){let e=nr(i.literal);r+=t&&n?`(${e})`:e}}return r},ac=e=>RegExp(`^${ic(e,!1,!0)}$`),oc=(e,t)=>{let n=[],r=[],i=e=>{switch(e._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:r.push(new ks(e,t,!0));break;case`Literal`:if(ut(e.literal)||Wt(e.literal))n.push(new N(e.literal,t,!1,!0));else throw Error(qa(e.literal));break;case`Enums`:for(let[r,i]of e.enums)n.push(new N(i,t,!1,!0));break;case`UniqueSymbol`:n.push(new N(e.symbol,t,!1,!0));break;case`Union`:e.types.forEach(i);break;default:throw Error(Ka(e))}};return i(e),{propertySignatures:n,indexSignatures:r}},sc=e=>t=>{let n;for(let r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},cc=e=>t=>{let n={...t.annotations};for(let t of e)delete n[t];return n},lc=sc([wo,To,Eo,Do,Oo,ko]),P=e=>{switch(e._tag){case`Declaration`:{let t=uc(e.typeParameters,P);return t===e.typeParameters?e:new is(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=uc(e.elements,e=>{let t=P(e.type);return t===e.type?e:new ws(t,e.isOptional)}),n=Ts(e.rest),r=uc(n,P);return t===e.elements&&r===n?e:new Es(t,r.map(e=>new Cs(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=uc(e.propertySignatures,e=>{let t=P(e.type);return t===e.type?e:new N(e.name,t,e.isOptional,e.isReadonly)}),n=uc(e.indexSignatures,e=>{let t=P(e.type);return t===e.type?e:new ks(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new As(t,n,e.annotations)}case`Union`:{let t=uc(e.types,P);return t===e.types?e:Rs.make(t,e.annotations)}case`Suspend`:return new Us(()=>P(e.f()),e.annotations);case`Refinement`:{let t=P(e.from);return t===e.from?e:new Ws(t,e.filter,e.annotations)}case`Transformation`:{let t=lc(e);return P(t===void 0?e.to:tc(e.to,t))}}return e};function uc(e,t){let n=!1,r=Pe(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}const dc=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return dc(e.from);case`Suspend`:return dc(e.f())}},fc=(e,t)=>{switch(e._tag){case`Declaration`:{let n=uc(e.typeParameters,e=>fc(e,t));return n===e.typeParameters?e:new is(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=uc(e.elements,e=>{let n=fc(e.type,t);return n===e.type?e:new ws(n,e.isOptional)}),r=Ts(e.rest),i=uc(r,e=>fc(e,t));return n===e.elements&&i===r?e:new Es(n,i.map(e=>new Cs(e)),e.isReadonly)}case`TypeLiteral`:{let n=uc(e.propertySignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new N(e.name,n,e.isOptional,e.isReadonly)}),r=uc(e.indexSignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new ks(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new As(n,r)}case`Union`:{let n=uc(e.types,e=>fc(e,t));return n===e.types?e:Rs.make(n)}case`Suspend`:{let n,r=ns(e);if(Ae(r)){let e=t?`Bound`:``;n={[es]:`${r.value}Encoded${e}`}}return new Us(()=>fc(e.f(),t),n)}case`Refinement`:{let n=fc(e.from,t);return t?n===e.from?e:dc(e.from)===void 0&&$o(e)?new Ws(n,e.filter,e.annotations):n:n}case`Transformation`:return fc(e.from,t)}return e},pc=e=>fc(e,!1),F=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},mc=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return mc(e.from)}},hc=(e,t)=>new qs(e,t,Zs),gc=e=>h(yc(e),()=>e._tag);function _c(e){return y(zo(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${St(e)}>`).join(``)})}const vc=e=>Ho(e).pipe(c(()=>Go(e)),c(()=>Uo(e)),be(t=>t+_c(e))),yc=e=>c(Wo(e),()=>vc(e)),bc=/^[+-]?\d+$/,xc=Symbol.for(`effect/BigDecimal`),Sc={[xc]:xc,[Ge](){let e=kc(this);return g(Ue(e.value),s(oe(e.scale)),sn(this))},[_e](e){return Cc(e)&&Nc(this,e)},toString(){return`BigDecimal(${Lc(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[p](){return this.toJSON()},pipe(){return Le(this,arguments)}},Cc=e=>$e(e,xc),wc=(e,t)=>{let n=Object.create(Sc);return n.value=e,n.scale=t,n},Tc=(e,t)=>{if(e!==Ec&&e%Dc===Ec)throw RangeError(`Value must be normalized`);let n=wc(e,t);return n.normalized=n,n},Ec=BigInt(0),Dc=BigInt(10),Oc=Tc(Ec,0),kc=e=>{if(e.normalized===void 0)if(e.value===Ec)e.normalized=Oc;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=Tc(r,i)}return e.normalized},Ac=C(2,(e,t)=>t>e.scale?wc(e.value*Dc**BigInt(t-e.scale),t):t<e.scale?wc(e.value/Dc**BigInt(e.scale-t),t):e),jc=e=>e.value<Ec?wc(-e.value,e.scale):e,Mc=an((e,t)=>e.scale>t.scale?Ac(t,e.scale).value===e.value:e.scale<t.scale?Ac(e,t.scale).value===t.value:e.value===t.value),Nc=C(2,(e,t)=>Mc(e,t)),Pc=e=>kt(Fc(e),()=>RangeError(`Number must be finite, got ${e}`)),Fc=e=>{if(!Number.isFinite(e))return w();let t=`${e}`;if(t.includes(`e`))return Ic(t);let[n,r=``]=t.split(`.`);return v(wc(BigInt(`${n}${r}`),r.length))},Ic=e=>{if(e===``)return v(Oc);let t,n,r=e.search(/[eE]/);if(r!==-1){let i=e.slice(r+1);if(t=e.slice(0,r),n=Number(i),t===``||!Number.isSafeInteger(n)||!bc.test(i))return w()}else t=e,n=0;let i,a,o=t.search(/\./);if(o!==-1){let e=t.slice(0,o),n=t.slice(o+1);i=`${e}${n}`,a=n.length}else i=t,a=0;if(!bc.test(i))return w();let s=a-n;return Number.isSafeInteger(s)?v(wc(BigInt(i),s)):w()},Lc=e=>{let t=kc(e);if(Math.abs(t.scale)>=16)return Rc(t);let n=t.value<Ec,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Rc=e=>{if(Bc(e))return`0e+0`;let t=kc(e),n=`${jc(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Vc(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},zc=e=>Number(Lc(e)),Bc=e=>e.value===Ec,Vc=e=>e.value<Ec,Hc=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?w():v(Number(e)),Uc=e=>{try{return e.trim()===``?w():v(BigInt(e))}catch{return w()}},Wc=e=>{if(e>2**53-1||e<-(2**53-1))return w();try{return v(BigInt(e))}catch{return w()}},Gc=Symbol.for(`effect/Brand/Refined`),Kc=()=>Object.assign(e=>e,{[Gc]:Gc,option:e=>v(e),either:e=>S(e),is:e=>!0}),qc=Qn,Jc=rr,Yc=An,Xc=Wr,Zc=En,Qc=Symbol.for(`effect/QueueEnqueue`),$c=Symbol.for(`effect/QueueDequeue`),el=Symbol.for(`effect/QueueStrategy`),tl=Symbol.for(`effect/BackingQueue`),nl={_A:e=>e},rl={_A:e=>e},il={_In:e=>e},al={_Out:e=>e};var ol=class extends Vn{queue;takers;shutdownHook;shutdownFlag;strategy;[Qc]=il;[$c]=al;constructor(e,t,n,r,i){super(),this.queue=e,this.takers=t,this.shutdownHook=n,this.shutdownFlag=r,this.strategy=i}pipe(){return Le(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return $t(()=>Tt(this.unsafeSize(),()=>m))}unsafeSize(){return se(this.shutdownFlag)?w():v(this.queue.length()-dn(this.takers)+this.strategy.surplusSize())}get isEmpty(){return Ye(this.size,e=>e<=0)}get isFull(){return Ye(this.size,e=>e>=this.capacity())}get shutdown(){return Ot(ye(e=>(g(this.shutdownFlag,Ke(!0)),g(ur(kl(this.takers),t=>lt(t,e.id()),!1,!1),pe(this.strategy.shutdown),ke(dt(this.shutdownHook,void 0)),Qt))))}get isShutdown(){return Re(()=>se(this.shutdownFlag))}get awaitShutdown(){return Ut(this.shutdownHook)}isActive(){return!se(this.shutdownFlag)}unsafeOffer(e){if(se(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return!0;let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n}offer(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return d(!0);let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n?d(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t=fe(e),n=this.queue.length()===0?fe(Al(this.takers,t.length)):Ve,[r,i]=g(t,Pt(n.length));for(let e=0;e<n.length;e++){let t=n[e],i=r[e];Dl(t,i)}if(i.length===0)return d(!0);let a=this.queue.offerAll(i);return Ml(this.strategy,this.queue,this.takers),_(a)?d(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return ye(e=>{if(se(this.shutdownFlag))return m;let t=this.queue.poll(xn);if(t!==xn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),d(t);{let t=zt(e.id());return g($t(()=>(g(this.takers,kr(t)),Ml(this.strategy,this.queue,this.takers),se(this.shutdownFlag)?m:Ut(t))),ct(()=>Re(()=>jl(this.takers,t))))}})}get takeAll(){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let e=this.queue.pollUpTo(1/0);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(e)}))}takeUpTo(e){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(t)}))}takeBetween(e,t){return $t(()=>sl(this,e,t,nn()))}};const sl=(e,t,n,r)=>n<t?d(r):g(bl(e,n),Zt(i=>{let a=t-i.length;return a===1?g(yl(e),Ye(e=>g(r,at(i),on(e)))):a>1?g(yl(e),Zt(t=>sl(e,a-1,n-i.length-1,g(r,at(i),on(t))))):d(g(r,at(i)))})),cl=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),xl()))),ll=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Sl()))),ul=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Cl()))),dl=()=>g(Re(()=>Cn()),Zt(e=>pl(hl(e),Sl()))),fl=(e,t,n,r,i)=>new ol(e,t,n,r,i),pl=(e,t)=>g(Yt(),Ye(n=>fl(e,Cn(),n,Be(!1),t)));var ml=class{mutable;[tl]=rl;constructor(e){this.mutable=e}poll(e){return Ln(this.mutable,e)}pollUpTo(e){return Hn(this.mutable,e)}offerAll(e){return Pn(this.mutable,e)}offer(e){return kr(this.mutable,e)}capacity(){return Bn(this.mutable)}length(){return dn(this.mutable)}};const hl=e=>new ml(e),gl=e=>e.size,_l=e=>e.shutdown,vl=C(2,(e,t)=>e.offer(t)),yl=e=>e.take,bl=C(2,(e,t)=>e.takeUpTo(t)),xl=()=>new wl,Sl=()=>new Tl,Cl=()=>new El;var wl=class{[el]=nl;putters=Cn();surplusSize(){return dn(this.putters)}onCompleteTakersWithEmptyQueue(e){for(;!Mr(this.putters)&&!Mr(e);){let t=Ln(e,void 0),n=Ln(this.putters,void 0);n[2]&&Dl(n[1],!0),Dl(t,n[0])}}get shutdown(){return g(xt,Zt(e=>g(Re(()=>kl(this.putters)),Zt(t=>ur(t,([t,n,r])=>r?g(lt(n,e),Qt):we,!1,!1)))))}handleSurplus(e,t,n,r){return ye(i=>{let a=zt(i.id());return g($t(()=>(this.unsafeOffer(e,a),this.unsafeOnQueueEmptySpace(t,n),Ml(this,t,n),se(r)?m:Ut(a))),ct(()=>Re(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(e,t){let n=!0;for(;n&&(e.capacity()===1/0||e.length()<e.capacity());){let r=g(this.putters,Ln(xn));if(r===xn)n=!1;else{let n=e.offer(r[0]);n&&r[2]?Dl(r[1],!0):n||Ol(this.putters,g(kl(this.putters),a(r))),Ml(this,e,t)}}}unsafeOffer(e,t){let n=fe(e);for(let e=0;e<n.length;e++){let r=n[e];e===n.length-1?g(this.putters,kr([r,t,!0])):g(this.putters,kr([r,t,!1]))}}unsafeRemove(e){Ol(this.putters,g(kl(this.putters),Fe(([,t])=>t!==e)))}},Tl=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return d(!1)}unsafeOnQueueEmptySpace(e,t){}},El=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return Re(()=>(this.unsafeOffer(t,e),Ml(this,t,n),!0))}unsafeOnQueueEmptySpace(e,t){}unsafeOffer(e,t){let n=t[Symbol.iterator](),r,i=!0;for(;!(r=n.next()).done&&i;){if(e.capacity()===0)return;e.poll(xn),i=e.offer(r.value)}}};const Dl=(e,t)=>gt(e,d(t)),Ol=(e,t)=>g(e,Pn(t)),kl=e=>g(e,Hn(1/0)),Al=(e,t)=>g(e,Hn(t)),jl=(e,t)=>{Ol(e,g(kl(e),Fe(e=>t!==e)))},Ml=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){let i=g(n,Ln(xn));if(i!==xn){let o=t.poll(xn);o===xn?Ol(n,g(kl(n),a(i))):(Dl(i,o),e.unsafeOnQueueEmptySpace(t,n)),r=!0}else r=!1}r&&t.length()===0&&!Mr(n)&&e.onCompleteTakersWithEmptyQueue(n)},Nl=cl,Pl=ll,Fl=ul,Il=dl,Ll=gl,Rl=_l,zl=vl,Bl=yl,Vl=`Continue`,Hl=Symbol.for(`effect/ChannelChildExecutorDecision`),Ul={[Hl]:Hl},Wl=e=>{let t=Object.create(Ul);return t._tag=Vl,t},Gl=Symbol.for(`effect/ChannelContinuation`),Kl={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};var ql=class{onSuccess;onHalt;_tag=`ContinuationK`;[Gl]=Kl;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return Ai(e)?this.onHalt(e.cause):this.onSuccess(e.value)}},Jl=class{finalizer;_tag=`ContinuationFinalizer`;[Gl]=Kl;constructor(e){this.finalizer=e}};const Yl=`PullAfterNext`,Xl=Symbol.for(`effect/ChannelUpstreamPullStrategy`),Zl={_A:e=>e},Ql={[Xl]:Zl},$l=e=>{let t=Object.create(Ql);return t._tag=Yl,t.emitSeparator=e,t},eu=`BracketOut`,tu=`Bridge`,nu=`ConcatAll`,ru=`Emit`,iu=`Ensuring`,au=`Fail`,ou=`Fold`,su=`FromEffect`,cu=`PipeTo`,lu=`Read`,uu=`Succeed`,du=`SucceedNow`,fu=`Suspend`,pu=Symbol.for(`effect/Channel`),mu={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},hu={[pu]:mu,pipe(){return Le(this,arguments)}},gu=e=>$e(e,pu)||Fn(e),_u=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=eu,n.acquire=()=>e,n.finalizer=t,n}),vu=e=>Au(()=>{let t=[];return L(z(e,yu(t)),e=>ju(()=>[u(t),e]))}),yu=e=>Eu({onInput:t=>L(ju(()=>{e.push(t)}),()=>yu(e)),onFailure:wu,onDone:ku}),bu=(e,t,n)=>{let r=Object.create(hu);return r._tag=nu,r.combineInners=t,r.combineAll=n,r.onPull=()=>$l(w()),r.onEmit=()=>Wl,r.value=()=>e,r.k=b,r},xu=C(4,(e,t,n,r)=>{let i=Object.create(hu);return i._tag=nu,i.combineInners=n,i.combineAll=r,i.onPull=()=>$l(w()),i.onEmit=()=>Wl,i.value=()=>e,i.k=t,i}),Su=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=tu,n.input=t,n.channel=e,n}),Cu=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=iu,n.channel=e,n.finalizer=t,n}),wu=e=>I(ui(e)),I=e=>Tu(()=>e),Tu=e=>{let t=Object.create(hu);return t._tag=au,t.error=e,t},L=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=ou,n.channel=e,n.k=new ql(t,I),n}),R=e=>{let t=Object.create(hu);return t._tag=su,t.effect=()=>e,t},z=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=cu,n.left=()=>e,n.right=()=>t,n}),Eu=e=>Du({onInput:e.onInput,onFailure:t=>r(oi(t),{onLeft:e.onFailure,onRight:I}),onDone:e.onDone}),Du=e=>{let t=Object.create(hu);return t._tag=lu,t.more=e.onInput,t.done=new ql(e.onDone,e.onFailure),t},Ou=e=>ju(()=>e),ku=e=>{let t=Object.create(hu);return t._tag=du,t.terminal=e,t},Au=e=>{let t=Object.create(hu);return t._tag=fu,t.channel=e,t},ju=e=>{let t=Object.create(hu);return t._tag=uu,t.evaluate=e,t},Mu=ku(void 0),B=e=>{let t=Object.create(hu);return t._tag=ru,t.out=e,t},Nu=`Done`,Pu=`Emit`,Fu=`FromEffect`,Iu=`Read`,Lu=Symbol.for(`effect/ChannelState`),Ru={_E:e=>e,_R:e=>e},zu={[Lu]:Ru},Bu=()=>{let e=Object.create(zu);return e._tag=Nu,e},Vu=()=>{let e=Object.create(zu);return e._tag=Pu,e},Hu=e=>{let t=Object.create(zu);return t._tag=Fu,t.effect=e,t},Uu=(e,t,n,r)=>{let i=Object.create(zu);return i._tag=Iu,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},Wu=e=>e._tag===Fu,Gu=e=>Wu(e)?e.effect:O,Ku=e=>Wu(e)?Ar(e.effect):void 0,qu=`PullFromChild`,Ju=`PullFromUpstream`,Yu=`DrainChildExecutors`,Xu=`Emit`;var Zu=class{childExecutor;parentSubexecutor;onEmit;_tag=qu;constructor(e,t,n){this.childExecutor=e,this.parentSubexecutor=t,this.onEmit=n}close(e){let t=this.childExecutor.close(e),n=this.parentSubexecutor.close(e);if(t!==void 0&&n!==void 0)return Zn(D(t),D(n),(e,t)=>g(e,Ci(t)));if(t!==void 0)return t;if(n!==void 0)return n}enqueuePullFromChild(e){return this}},Qu=class e{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=Ju;constructor(e,t,n,r,i,a,o,s){this.upstreamExecutor=e,this.createChild=t,this.lastDone=n,this.activeChildExecutors=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o,this.onEmit=s}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}},$u=class e{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Yu;constructor(e,t,n,r,i,a,o){this.upstreamExecutor=e,this.lastDone=t,this.activeChildExecutors=n,this.upstreamDone=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}},ed=class{value;next;_tag=Xu;constructor(e,t){this.value=e,this.next=t}close(e){return this.next.close(e)}enqueuePullFromChild(e){return this}};const td=Symbol.for(`effect/ChannelUpstreamPullRequest`),nd={_A:e=>e},rd={[td]:nd},id=e=>{let t=Object.create(rd);return t._tag=`Pulled`,t.value=e,t},ad=e=>{let t=Object.create(rd);return t._tag=`NoUpstream`,t.activeDownstreamCount=e,t};var od=class e{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(e,t,n){this._currentChannel=e,this._executeCloseLastSubstream=n,this._providedEnv=t}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=Bu();else switch(Fn(this._currentChannel)&&(this._currentChannel=R(this._currentChannel)),this._currentChannel._tag){case eu:t=this.runBracketOut(this._currentChannel);break;case tu:{let e=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let n=this._input;this._input=void 0;let r=()=>M(e.awaitRead(),()=>A(()=>{let t=n.run();switch(t._tag){case Nu:return xi(n.getDone(),{onFailure:t=>e.error(t),onSuccess:t=>e.done(t)});case Pu:return M(e.emit(n.getEmit()),()=>r());case Fu:return $n(t.effect,{onFailure:t=>e.error(t),onSuccess:()=>r()});case Iu:return ld(t,()=>r(),t=>e.error(t))}}));t=Hu(M(Yn(Or(r())),e=>mr(()=>this.addFinalizer(t=>M(Yr(e),()=>A(()=>{let e=this.restorePipe(t,n);return e===void 0?O:e}))))))}break}case nu:{let t=new e(this._currentChannel.value(),this._providedEnv,e=>mr(()=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;this._closeLastSubstream=g(t,j(e))}));t._input=this._input;let n=this._currentChannel;this._activeSubexecutor=new Qu(t,e=>n.k(e),void 0,[],(e,t)=>n.combineInners(e,t),(e,t)=>n.combineAll(e,t),e=>n.onPull(e),e=>n.onEmit(e)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case ru:this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor===void 0?Mu:void 0,t=Vu();break;case iu:this.runEnsuring(this._currentChannel);break;case au:t=this.doneHalt(this._currentChannel.error());break;case ou:this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break;case su:{let e=this._providedEnv===void 0?this._currentChannel.effect():g(this._currentChannel.effect(),On(this._providedEnv));t=Hu($n(e,{onFailure:e=>{let t=this.doneHalt(e);return t!==void 0&&Wu(t)?t.effect:O},onSuccess:e=>{let t=this.doneSucceed(e);return t!==void 0&&Wu(t)?t.effect:O}}));break}case cu:{let t=this._input,n=new e(this._currentChannel.left(),this._providedEnv,e=>this._executeCloseLastSubstream(e));n._input=t,this._input=n,this.addFinalizer(e=>{let n=this.restorePipe(e,t);return n===void 0?O:n}),this._currentChannel=this._currentChannel.right();break}case`Provide`:{let e=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>mr(()=>{this._providedEnv=e}));break}case lu:{let e=this._currentChannel;t=Uu(this._input,b,t=>{try{this._currentChannel=e.more(t)}catch(t){this._currentChannel=e.done.onExit(ki(t))}},t=>{let n=t=>e.done.onExit(t);this._currentChannel=n(t)});break}case uu:t=this.doneSucceed(this._currentChannel.evaluate());break;case du:t=this.doneSucceed(this._currentChannel.terminal);break;case fu:this._currentChannel=this._currentChannel.channel();break}}catch(e){this._currentChannel=I(gi(e))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(e){this._cancelled=e}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(e){this._inProgressFinalizer=e}popAllFinalizers(e){let t=[],n=this._doneStack.pop();for(;n;)n._tag===`ContinuationFinalizer`&&t.push(n.finalizer),n=this._doneStack.pop();let r=t.length===0?O:cd(t,e);return this.storeInProgressFinalizer(r),r}popNextFinalizers(){let e=[];for(;this._doneStack.length!==0;){let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`)return e;e.push(t),this._doneStack.pop()}return e}restorePipe(e,t){let n=this._input;return this._input=t,n===void 0?O:n.close(e)}close(e){let t,n=this._inProgressFinalizer;n!==void 0&&(t=g(n,br(mr(()=>this.clearInProgressFinalizer()))));let r,i=this.popAllFinalizers(e);i!==void 0&&(r=g(i,br(mr(()=>this.clearInProgressFinalizer()))));let a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(e);if(a!==void 0||t!==void 0||r!==void 0)return g(D(sd(a)),Jn(D(sd(t))),Jn(D(sd(r))),T(([[e,t],n])=>g(e,Ci(t),Ci(n))),Sr,M(e=>A(()=>e)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=Si(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop(),this._currentChannel=t.onSuccess(e);return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=Si(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),Si(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneSucceed(e))));return Hu(i)}doneHalt(e){if(this._doneStack.length===0)return this._done=yi(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop();try{this._currentChannel=t.onHalt(e)}catch(e){this._currentChannel=I(gi(e))}return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=yi(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),yi(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneHalt(e))));return Hu(i)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,Bu()}runBracketOut(e){let t=Sr($n(this.provide(e.acquire()),{onFailure:e=>mr(()=>{this._currentChannel=I(e)}),onSuccess:t=>mr(()=>{this.addFinalizer(n=>this.provide(e.finalizer(t,n))),this._currentChannel=B(t)})}));return Hu(t)}provide(e){return this._providedEnv===void 0?e:g(e,On(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new Jl(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case qu:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case Ju:return this.pullFromUpstream(e);case Yu:return this.drainChildExecutors(e);case Xu:return this._emitted=e.value,this._activeSubexecutor=e.next,Vu()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=xi(e,{onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)});return this._activeSubexecutor=void 0,t===void 0?O:Gu(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>g(t,$r(t=>g(mr(()=>t(e)),M(e=>e===void 0?O:e)),{discard:!0})));let n=g(e,xi({onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)}));return this._activeSubexecutor=void 0,n}applyUpstreamPullStrategy(e,t,n){switch(n._tag){case Yl:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[void 0,...t]:t]}case`PullAfterAllEnqueued`:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[...t,void 0]:t]}}}pullFromChild(e,t,n,r){return Uu(e,b,i=>{let a=n(i);switch(a._tag){case Vl:break;case`Close`:this.finishWithDoneValue(e,t,a.value);break;case`Yield`:{let e=t.enqueuePullFromChild(r);this.replaceSubexecutor(e);break}}this._activeSubexecutor=new ed(i,this._activeSubexecutor)},xi({onFailure:n=>{let r=this.handleSubexecutorFailure(e,t,n);return r===void 0?void 0:Ku(r)},onSuccess:n=>{this.finishWithDoneValue(e,t,n)}}))}finishWithDoneValue(e,t,n){let r=t;switch(r._tag){case Ju:{let t=new Qu(r.upstreamExecutor,r.createChild,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.combineChildResults,r.combineWithChildResult,r.onPull,r.onEmit);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}case Yu:{let t=new $u(r.upstreamExecutor,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.upstreamDone,r.combineChildResults,r.combineWithChildResult,r.onPull);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}default:break}}handleSubexecutorFailure(e,t,n){return this.finishSubexecutorWithCloseEffect(yi(n),e=>t.close(e),t=>e.close(t))}pullFromUpstream(e){if(e.activeChildExecutors.length===0)return this.performPullFromUpstream(e);let t=e.activeChildExecutors[0],n=new Qu(e.upstreamExecutor,e.createChild,e.lastDone,e.activeChildExecutors.slice(1),e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit);if(t===void 0)return this.performPullFromUpstream(n);this.replaceSubexecutor(new Zu(t.childExecutor,n,t.onEmit))}performPullFromUpstream(t){return Uu(t.upstreamExecutor,e=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),j(e))},n=>{if(this._closeLastSubstream!==void 0){let r=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(r),T(()=>{let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))}))}let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))},e=>{if(t.activeChildExecutors.some(e=>e!==void 0)){let e=new $u(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){let t=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),T(()=>this.replaceSubexecutor(e)))}this.replaceSubexecutor(e);return}let n=this._closeLastSubstream,r=this.finishSubexecutorWithCloseEffect(g(e,Ti(e=>t.combineWithChildResult(t.lastDone,e))),()=>n,e=>t.upstreamExecutor.close(e));return r===void 0?void 0:Ku(r)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let t=this._closeLastSubstream;return t!==void 0&&this.addFinalizer(()=>k(t)),this.finishSubexecutorWithCloseEffect(e.upstreamDone,()=>t,t=>e.upstreamExecutor.close(t))}let t=e.activeChildExecutors[0],n=e.activeChildExecutors.slice(1);if(t===void 0){let[t,r]=this.applyUpstreamPullStrategy(!0,n,e.onPull(ad(n.reduce((e,t)=>t===void 0?e:e+1,0))));return this.replaceSubexecutor(new $u(e.upstreamExecutor,e.lastDone,r,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),Ae(t)?(this._emitted=t.value,Vu()):void 0}let r=new $u(e.upstreamExecutor,e.lastDone,n,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new Zu(t.childExecutor,r,t.onEmit))}};const sd=e=>e===void 0?O:e,cd=(e,t)=>g($r(e,e=>D(e(t))),T(e=>g(Di(e),h(()=>Oi))),M(e=>A(()=>e))),ld=(e,t,n)=>{let r=[e],i=()=>{let e=r.pop();if(e===void 0||e.upstream===void 0)return Fr(`Unexpected end of input for channel execution`);let a=e.upstream.run();switch(a._tag){case Pu:{let a=e.onEmit(e.upstream.getEmit());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Nu:{let a=e.onDone(e.upstream.getDone());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Fu:return r.push(e),g(e.onEffect(a.effect),hr(t=>A(()=>{let n=e.onDone(yi(t));return n===void 0?O:n})),$n({onFailure:n,onSuccess:()=>i()}));case Iu:return r.push(e),r.push(a),A(()=>i())}};return i()},ud=C(2,(e,t)=>{let n=(t,n,r)=>Er(mr(()=>new od(e,void 0,b)),e=>A(()=>dd(e.run(),e).pipe(Mn(t),j(E(t)),gn(E(n)))),(e,t)=>{let n=e.close(t);return n===void 0?O:Xr(n,e=>Ir(r,ni(e)))});return cr(e=>zr([Qr(t,In),pn(),pn()]).pipe(M(([r,i,a])=>e(n(i,a,r)).pipe(yn(t),M(n=>t.addFinalizer(e=>{let t=Ai(e)?si(e.cause):void 0;return ai(i).pipe(M(e=>e?er(a,void 0).pipe(j(pr(n)),j(Nr(n))):er(a,void 0).pipe(j(t&&nt(t)>0?gr(n,xe(t)):Yr(n)),j(Nr(n)))))}).pipe(j(e(E(i)))))))))}),dd=(e,t)=>{let n=e;switch(n._tag){case Fu:return g(n.effect,M(()=>dd(t.run(),t)));case Pu:return dd(t.run(),t);case Nu:return A(()=>t.getDone());case Iu:return ld(n,()=>dd(t.run(),t),ni)}},fd={[Symbol.for(`effect/ChannelMergeDecision`)]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},pd=e=>{let t=Object.create(fd);return t._tag=`Await`,t.f=e,t},md=`BothRunning`,hd=`LeftDone`,gd=`RightDone`,_d=Symbol.for(`effect/ChannelMergeState`),vd={[_d]:_d},yd=(e,t)=>{let n=Object.create(vd);return n._tag=md,n.left=e,n.right=t,n},bd=e=>{let t=Object.create(vd);return t._tag=hd,t.f=e,t},xd=e=>{let t=Object.create(vd);return t._tag=gd,t.f=e,t},Sd=`BackPressure`,Cd=`BufferSliding`,wd=Symbol.for(`effect/ChannelMergeStrategy`),Td={[wd]:wd},Ed=e=>{let t=Object.create(Td);return t._tag=Sd,t},Dd=e=>{let t=Object.create(Td);return t._tag=Cd,t},Od=C(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case Sd:return t();case Cd:return n()}}),kd=`Empty`,Ad=`Emit`,jd=`Error`,Md=`Done`,Nd=e=>({_tag:kd,notifyProducer:e}),Pd=e=>({_tag:Ad,notifyConsumers:e}),Fd=e=>({_tag:jd,cause:e}),Id=e=>({_tag:Md,done:e});var Ld=class{ref;constructor(e){this.ref=e}awaitRead(){return Kn(jr(this.ref,e=>e._tag===kd?[E(e.notifyProducer),e]:[O,e]))}get close(){return lr(e=>this.error(_i(e)))}done(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>er(t,x(e)),{discard:!0}),Id(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}emit(e){return M(pn(),t=>Kn(jr(this.ref,n=>{switch(n._tag){case kd:return[E(n.notifyProducer),n];case Ad:{let r=n.notifyConsumers[0],i=n.notifyConsumers.slice(1);if(r!==void 0)return[er(r,S(e)),i.length===0?Nd(t):Pd(i)];throw Error(`Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues`)}case jd:return[ln,n];case Md:return[ln,n]}})))}error(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>Gn(t,e),{discard:!0}),Fd(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}get take(){return this.takeWith(e=>yi(hi(e,x)),e=>Si(e),e=>wi(S(e)))}takeWith(e,t,n){return M(pn(),i=>Kn(jr(this.ref,a=>{switch(a._tag){case kd:return[j(er(a.notifyProducer,void 0),fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})})),Pd([i])];case Ad:return[fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})}),Pd([...a.notifyConsumers,i])];case jd:return[k(e(a.cause)),a];case Md:return[k(n(a.done)),a]}})))}};const Rd=()=>g(pn(),M(e=>zn(Nd(e))),T(e=>new Ld(e))),zd=C(2,(e,t)=>xu(e,t,()=>void 0,()=>void 0)),Bd=e=>{let t=Du({onInput:()=>t,onFailure:I,onDone:Ou});return z(e,t)},Vd=C(2,(e,t)=>Cu(e,()=>t)),Hd=e=>L(e,b),Ud=e=>cf(e.takeWith(I,t=>L(B(t),()=>Ud(e)),Ou)),Wd=()=>Eu({onInput:e=>L(B(e),()=>Wd()),onFailure:wu,onDone:ku}),Gd=C(2,(e,t)=>L(e,e=>ju(()=>t(e)))),Kd=C(2,(e,t)=>{let n=Eu({onInput:e=>L(B(t(e)),()=>n),onFailure:wu,onDone:ku});return z(e,n)}),qd=C(2,(e,t)=>{let n=Du({onInput:e=>g(R(t(e)),L(B),L(()=>n)),onFailure:I,onDone:ku});return z(e,n)}),Jd=e=>t=>Yd(e)(t,l),Yd=({bufferSize:e=16,concurrency:t,mergeStrategy:n=Ed()})=>(i,a)=>uf(o=>Rn(function*(){let s=t===`unbounded`?2**53-1:t,c=yield*Rd(),l=Ud(c),u=yield*Nl(e);yield*Ir(o,Rl(u));let d=yield*Il();yield*Ir(o,Rl(d));let f=yield*zn(w()),p=yield*pn(),m=(yield*Sn(s)).withPermits,h=yield*of(z(l,i),o);function _(e){return e.pipe(M(r({onLeft:e=>k(v(e)),onRight:e=>Kr(zl(u,k(S(e))),w())})),or({until:e=>Ae(e)}),M(e=>Nn(f,y({onNone:()=>v(e.value),onSome:t=>v(a(t,e.value))}))),hr(e=>ci(e)?ni(e):zl(u,ni(e)).pipe(j(er(p,void 0)),fr)))}yield*h.pipe($n({onFailure:e=>zl(u,ni(e)).pipe(j(k(!1))),onSuccess:r({onLeft:e=>ir(Or(E(p)),Or(m(s)(O)),{onSelfDone:(e,t)=>Kr(Yr(t),!1),onOtherDone:(t,n)=>j(Yr(n),bn(f).pipe(M(y({onNone:()=>zl(u,k(x(e))),onSome:t=>zl(u,k(x(a(t,e))))})),Kr(!1)))}),onRight:e=>Od(n,{onBackPressure:()=>Rn(function*(){let t=yield*pn(),n=Dr(t=>of(z(l,e),t).pipe(M(e=>ar(D(_(e)),D(Or(E(p))))),M(b)));return yield*er(t,void 0).pipe(j(n),m(1),yn(o)),yield*E(t),!(yield*ai(p))}),onBufferSliding:()=>Rn(function*(){let t=yield*pn(),n=yield*pn(),r=yield*Ll(d);yield*Bl(d).pipe(M(e=>er(e,void 0)),dr(()=>r>=s)),yield*zl(d,t);let i=Dr(n=>of(z(l,e),n).pipe(M(e=>D(_(e)).pipe(ar(D(Or(E(p)))),ar(D(Or(E(t)))))),M(b)));return yield*er(n,void 0).pipe(j(i),m(1),yn(o)),yield*E(n),!(yield*ai(p))})})})}),or({while:e=>e}),yn(o));let ee=g(Bl(u),Kn,fn({onFailure:I,onSuccess:r({onLeft:ku,onRight:e=>L(B(e),()=>ee)})}),cf);return Su(ee,c)})),Xd=C(3,(e,t,n)=>Jd(n)(Kd(e,t))),Zd=C(2,(e,t)=>{function n(n){return Rn(function*(){let i=yield*Rd(),a=Ud(i),o=yield*of(z(a,e),n),s=yield*of(z(a,t.other),n);function c(e,t,i){return(a,o,s)=>{function c(e){let n=e;return n._tag===`Done`?k(R(j(Yr(t),n.effect))):T(pr(t),xi({onFailure:e=>R(n.f(yi(e))),onSuccess:r({onLeft:e=>R(n.f(Si(e))),onRight:e=>mf(B(e),l(s(n.f)))})}))}return xi(e,{onFailure:e=>c(a(yi(e))),onSuccess:r({onLeft:e=>c(a(Si(e))),onRight:e=>k(L(B(e),()=>L(R(yn(Or(i),n)),e=>l(o(e,t)))))})})}}function l(e){switch(e._tag){case md:{let n=Or(yr(e.left)),r=Or(yr(e.right));return cf(ir(n,r,{onSelfDone:(n,r)=>j(Yr(r),c(n,e.right,o)(t.onSelfDone,yd,e=>bd(e))),onOtherDone:(n,r)=>j(Yr(r),c(n,e.left,s)(t.onOtherDone,(e,t)=>yd(t,e),e=>xd(e)))}))}case hd:return cf(T(D(s),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(bd(e.f)))})})));case gd:return cf(T(D(o),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(xd(e.f)))})})))}}return R(ti(e=>{let t=ti(t=>(t.transferChildren(e.scope()),O));return Zn(Or(o).pipe(br(t),yn(n)),Or(s).pipe(br(t),yn(n)),(e,t)=>yd(e,t))})).pipe(L(l),Su(i))})}return uf(n)}),Qd=C(2,(e,t)=>Au(()=>{let n,r=Eu({onInput:e=>L(B(e),()=>r),onFailure:e=>(n=gf(e),I(gi(n))),onDone:ku}),i=Du({onInput:e=>g(B(e),L(()=>i)),onFailure:e=>di(e)&&_f(e.defect)&&te(e.defect,n)?wu(e.defect.error):I(e),onDone:ku});return z(z(z(e,r),t),i)})),$d=e=>Dr(t=>ud(e,t)),ef=e=>$d(Bd(e)),tf=e=>Rr(t=>ud(e,t)),nf=e=>cf(cr(t=>T(ri(),n=>_u(Xr(t(sr(e,n)),e=>xr(n,yi(e))),(e,t)=>xr(n,t))))),rf=e=>lf(T(qr,t=>L(R(e(t)),B))),af=()=>Au(()=>{let e=``,t=!1,n=n=>{let r=[];return Ee(n,n=>{if(n.length!==0){let i=0,a=n.indexOf(`\r`),o=n.indexOf(`
2
- `);for(t&&=(o===0?(r.push(e),e=``,i=1,o=n.indexOf(`
3
- `,i)):e+=`\r`,!1);a!==-1||o!==-1;)a===-1||o!==-1&&o<a?(e.length===0?r.push(n.substring(i,o)):(r.push(e+n.substring(i,o)),e=``),i=o+1,o=n.indexOf(`
4
- `,i)):n.length===a+1?(t=!0,a=-1):o===a+1?(e.length===0?r.push(n.substring(i,a)):(e+=n.substring(i,a),r.push(e),e=``),i=a+2,a=n.indexOf(`\r`,i),o=n.indexOf(`
5
- `,i)):a=n.indexOf(`\r`,a+1);t?e+=n.substring(i,n.length-1):e+=n.substring(i,n.length)}}),le(r)},r=Du({onInput:e=>{let t=n(e);return _(t)?r:L(B(t),()=>r)},onFailure:t=>e.length===0?I(t):L(B(Dt(e)),()=>I(t)),onDone:t=>e.length===0?Ou(t):L(B(Dt(e)),()=>Ou(t))});return r}),of=C(2,(e,t)=>Jn(mr(()=>new od(e,void 0,b)),_r()).pipe(Pr(([e,n])=>wr(t,t=>{let r=e.close(t);return r===void 0?O:On(r,n)})),Sr,T(([e])=>A(()=>sf(e.run(),e))))),sf=(e,t)=>{let n=e;switch(n._tag){case Nu:return xi(t.getDone(),{onFailure:ni,onSuccess:e=>k(x(e))});case Pu:return k(S(t.getEmit()));case Fu:return g(n.effect,M(()=>sf(t.run(),t)));case Iu:return ld(n,()=>sf(t.run(),t),e=>ni(e))}},cf=e=>Hd(R(e)),lf=e=>bu(nf(e),(e,t)=>e,(e,t)=>e),uf=e=>bu(rf(e),(e,t)=>e,(e,t)=>e),df=e=>ff(0,e.length,e),ff=(e,t,n)=>e===t?Mu:g(B(g(n,ve(e))),L(()=>ff(e+1,t,n))),pf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Zd(e,{other:t,onSelfDone:e=>pd(t=>A(()=>Ei(e,t))),onOtherDone:e=>pd(t=>A(()=>Ei(t,e)))}):L(e,e=>Gd(t,t=>[e,t]))),mf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Gd(pf(e,t,{concurrent:!0}),e=>e[1]):L(e,()=>t)),hf=Symbol.for(`effect/Channel/ChannelException`),gf=e=>({_tag:`ChannelException`,[hf]:hf,error:e}),_f=e=>$e(e,hf),vf=Symbol.for(`effect/Sink`),yf={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};var bf=class{channel;[vf]=yf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const xf=e=>new bf(Au(()=>Mf(e()))),Sf=()=>new bf(Cf(nn())),Cf=e=>Du({onInput:t=>Cf(g(e,at(t))),onFailure:I,onDone:()=>Ou(e)}),wf=new bf(Bd(Wd())),Tf=(e,t,n)=>xf(()=>new bf(Ef(e,t,n))),Ef=(e,t,n)=>t(e)?Eu({onInput:r=>Ef(n(e,r),t,n),onFailure:wu,onDone:()=>ku(e)}):ku(e),Df=(e,t)=>Tf(e,tn,t),Of=e=>{let t=Du({onInput:n=>g(R($r(n,t=>e(t),{discard:!0})),L(()=>t)),onFailure:I,onDone:()=>Mu});return new bf(t)},kf=e=>new bf(e),Af=e=>new bf(R(e)),jf=C(2,(e,t)=>new bf(g(Mf(e),Gd(t)))),Mf=e=>Fn(e)?Mf(Af(e)):e.channel,Nf=e=>new bf(lf(e.pipe(T(e=>Mf(e))))),Pf=xf(()=>{let e=[];return g(Df(void 0,(t,n)=>Ee(n,t=>{e.push(String(t))})),jf(()=>e.join(``)))}),Ff=Lr,If=e=>Object.assign(e,{chunk(e){return this(k(e))},die(e){return this(Br(e))},dieMessage(e){return this(Fr(e))},done(e){return this(A(()=>ji(e,{onFailure:v,onSuccess:Dt})))},end(){return this(Zr(w()))},fail(e){return this(Zr(v(e)))},fromEffect(e){return this(jn(e,{onFailure:v,onSuccess:Dt}))},fromEffectChunk(e){return this(g(e,Wn(v)))},halt(e){return this(ni(g(e,hi(v))))},single(e){return this(k(Dt(e)))}}),Lf=Symbol.for(`effect/Take`),Rf={_A:e=>e,_E:e=>e};var zf=class{exit;[Lf]=Rf;constructor(e){this.exit=e}pipe(){return Le(this,arguments)}};const Bf=e=>new zf(Si(e)),Vf=e=>A(()=>e.exit),Hf=new zf(wi(w())),Uf=e=>new zf(yi(g(e,hi(v)))),Wf=e=>fn(e,{onFailure:e=>y(mi(e),{onNone:()=>Hf,onSome:Uf}),onSuccess:Bf}),Gf=C(2,(e,{onEnd:t,onFailure:n,onSuccess:r})=>xi(e.exit,{onFailure:e=>y(mi(e),{onNone:t,onSome:n}),onSuccess:r})),Kf=()=>Zr(w()),qf=Symbol.for(`effect/Stream`),Jf={_R:e=>e,_E:e=>e,_A:e=>e};var Yf=class{channel;[qf]=Jf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const Xf=e=>$e(e,qf)||Fn(e),Zf=e=>{if(e===`unbounded`)return Il();if(typeof e==`number`||e===void 0)return Nl(e??16);switch(e.strategy){case`dropping`:return Pl(e.bufferSize??16);case`sliding`:return Fl(e.bufferSize??16);default:return Nl(e.bufferSize??16)}},Qf=(e,t)=>g(Gr(Zf(t),e=>Rl(e)),M(t=>g(_r(),M(n=>g(e(If(e=>g(Wf(e),M(e=>zl(t,e)),fr,Ff(n)).then(e=>{if(Ai(e)&&!ci(e.cause))throw li(e.cause)}))),j(zn(!1)),M(e=>g(bn(e),T(n=>n?Kf():g(Bl(t),M(Vf),tr(()=>g(un(e,!0),j(Rl(t)))))))))))),bp,rp(gp)),$f=C(2,(e,t)=>{if(t.strategy===`dropping`)return ep(e,t.capacity);if(t.strategy===`sliding`)return tp(e,t.capacity);let n=Cp(e,t);return new Yf(lf(T(n,e=>{let t=g(R(Bl(e)),L(Gf({onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))})));return t})))}),ep=C(2,(e,t)=>{let n=Gr(Pl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),tp=C(2,(e,t)=>{let n=Gr(Fl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),np=(e,t)=>{let n=(e,t)=>{let r=n=>g(bn(t),Pr(E),j(pn()),M(r=>g(zl(e,[n,r]),j(un(t,r)),j(E(r)))),fr,R);return Du({onInput:r=>g(pn(),M(n=>g(zl(e,[Bf(r),n]),M(e=>g(un(t,n),dr(()=>e))))),fr,R,L(()=>n(e,t))),onFailure:e=>r(Uf(e)),onDone:()=>r(Hf)})},r=e=>{let t=g(R(Bl(e)),L(([e,n])=>mf(R(er(n,void 0)),Gf(e,{onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))}))));return t};return lf(g(e,M(e=>g(pn(),Pr(e=>er(e,void 0)),M(i=>g(zn(i),M(r=>g(t,z(n(e,r)),tf,_n)),Kr(r(e))))))))},rp=C(e=>Xf(e[0]),(e,t,n)=>{let r=n?.bufferSize??16;return n?.switch?ip(n?.concurrency,()=>ap(e,1,r,t),n=>ap(e,n,r,t)):ip(n?.concurrency,()=>new Yf(zd(cp(e),e=>g(e,Ee(e=>cp(t(e))),Ct(Mu,(e,t)=>g(e,mf(t)))))),r=>new Yf(g(cp(e),zd(df),Xd(e=>cp(t(e)),n))))}),ip=(e,t,n)=>{switch(e){case void 0:return t();case`unbounded`:return n(2**53-1);default:return e>1?n(e):t()}},ap=C(4,(e,t,n,r)=>new Yf(g(cp(e),zd(df),Xd(e=>cp(r(e)),{concurrency:t,mergeStrategy:Dd(),bufferSize:n})))),op=C(e=>Xf(e[0]),(e,t)=>rp(e,b,t)),sp=e=>new Yf(e),cp=e=>{if(`channel`in e)return e.channel;if(Fn(e))return cp(up(e));throw TypeError(`Expected a Stream.`)},lp=e=>new Yf(_(e)?Mu:B(e)),up=e=>g(e,Wn(v),dp),dp=e=>new Yf(cf(ii(e,{onFailure:y({onNone:()=>Mu,onSome:wu}),onSuccess:e=>B(Dt(e))}))),fp=C(2,(e,t)=>new Yf(g(cp(e),Kd(Ee(t))))),pp=C(2,(e,t)=>new Yf(g(cp(e),Kd(t)))),mp=e=>_p(e,Pf),hp=C(2,(e,t)=>new Yf(z(cp(e),t))),gp=e=>Tp(e,e=>g(T(e,t=>v([t,e])),Jr(y({onNone:()=>k(w()),onSome:Zr})))),_p=C(2,(e,t)=>cp(e).pipe(Qd(Mf(t)),ef)),vp=e=>_p(e,Sf()),yp=C(2,(e,t)=>{let n=Du({onInput:e=>L(B(Bf(e)),()=>n),onFailure:e=>B(Uf(e)),onDone:()=>B(Hf)});return g(z(cp(e),n),qd(e=>zl(t,e)),Bd,tf,fr)}),bp=e=>new Yf(Vd(nf(g(e,T(Dt))),O)),xp=e=>hp(e,af()),Sp=e=>new Yf(Au(()=>cp(e()))),Cp=C(e=>Xf(e[0]),(e,t)=>Pr(Gr(t?.strategy===`unbounded`?Il():t?.strategy===`dropping`?Pl(t.capacity??2):t?.strategy===`sliding`?Fl(t.capacity??2):Nl(t?.capacity??2),e=>Rl(e)),t=>_n(yp(e,t)))),wp=C(2,(e,t)=>new Yf(Au(()=>{let n={ref:nn()},r={ref:!1},i=Au(()=>{let e=n.ref;return _(e)?Eu({onInput:e=>g(B(e),L(()=>i)),onFailure:wu,onDone:ku}):(n.ref=nn(),g(df(e),L(()=>i)))}),a=e=>{let t=n.ref,r=at(t,Fe(e,e=>e.length!==0));return n.ref=r,r},o=Eu({onInput:e=>L(B(e),()=>o),onFailure:wu,onDone:e=>mf(ju(()=>{r.ref=!0}),ku(e))}),s=g(t,Mf,vu,L(([e,t])=>g(Ou([r.ref,a(e)]),L(([e,n])=>{let r=e&&_(n)?Mu:s;return g(B(Dt(t)),L(()=>r))}))));return g(cp(e),z(o),z(i),Qd(s))}))),Tp=(e,t)=>Sp(()=>{let n=e=>cf(T(t(e),y({onNone:()=>Mu,onSome:([e,t])=>L(B(e),()=>n(t))})));return new Yf(n(e))}),Ep=e=>op(up(e)),Dp=e=>op(bp(e)),Op=C(e=>Xf(e[0]),(e,t=`utf-8`)=>Sp(()=>{let n=new TextDecoder(t);return fp(e,e=>n.decode(e,{stream:!0}))})),kp=Su,Ap=Vd,jp=L,Mp=R,Np=Au,Pp=Mu,Fp=B,Ip=qi,Lp=Yi,Rp=Xi,zp=Zi,Bp=Qi,Vp=$i,Hp=ta,Up=na,Wp=ia,Gp=sa,Kp=da,qp=fa,Jp=ha,Yp=ga,Xp=_a,Zp=Sa;Lt(`effect/DateTime/CurrentTimeZone`)();const Qp=ka,$p=ja;var V=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},em=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},tm=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},H=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},nm=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},rm=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},U=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},im=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}};const am=Symbol.for(`effect/Schema/ParseErrorTypeId`);var om=class extends Li(`ParseError`){[am]=am;get message(){return this.toString()}toString(){return Km.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[p](){return this.toJSON()}};const sm=e=>new om({issue:e}),W=S,cm=x,lm=It,um=He,dm=ge,fm=C(2,(e,t)=>dm(e)?r(e,{onLeft:x,onRight:t}):M(e,t)),pm=C(2,(e,t)=>dm(e)?Xe(e,t):T(e,t)),mm=C(2,(e,t)=>dm(e)?Ne(e,t):Wn(e,t)),hm=C(2,(e,t)=>dm(e)?et(e,{onLeft:t.onFailure,onRight:t.onSuccess}):jn(e,t)),gm=C(2,(e,t)=>dm(e)?r(e,{onLeft:t,onRight:S}):Jr(e,t)),_m=(e,t)=>t===void 0||Wt(t)?e:e===void 0?t:{...e,...t},vm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,_m(n,t))},ym=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>ae(r(e,t),sm)},bm=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>wt(r(e,t))},xm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,{..._m(n,t),isEffectAllowed:!0})},Sm=(e,t)=>ym(e.ast,!0,t),Cm=(e,t)=>bm(e.ast,!0,t),wm=(e,t)=>vm(e.ast,!0,t),Tm=(e,t)=>xm(e.ast,!0,t),Em=(e,t)=>ym(e.ast,!1,t),Dm=(e,t)=>xm(e.ast,!1,t),Om=Sm,km=(e,t)=>ym(P(e.ast),!0,t),Am=(e,t)=>{let n=G(P(e.ast),!0);return(e,r)=>me(n(e,{exact:!0,..._m(t,r)}))},jm=Em,Mm=tt(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),Nm=tt(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),G=(e,t)=>{let n=t?Mm:Nm,r=n.get(e);if(r)return r;let i=Im(e,t),a=Yo(e),o=Ae(a)?(e,t)=>i(e,_m(t,a.value)):i,s=Xo(e),c=t&&Ae(s)?(t,n)=>Vm(gm(o(t,n),s.value),e,t,n):o;return n.set(e,c),c},Pm=e=>o(Ko(e)),Fm=e=>o(qo(e)),Im=(t,r)=>{switch(t._tag){case`Refinement`:if(r){let e=G(t.from,!0);return(n,r)=>{r??=Ks;let i=r?.errors===`all`,a=fm(gm(e(n,r),e=>{let a=new nm(t,n,`From`,e);return i&&$o(t)&&th(e)?y(t.filter(n,r,t),{onNone:()=>x(a),onSome:e=>x(new H(t,n,[a,new nm(t,n,`Predicate`,e)]))}):x(a)}),e=>y(t.filter(e,r,t),{onNone:()=>S(e),onSome:e=>x(new nm(t,n,`Predicate`,e))}));return Vm(a,t,n,r)}}else{let e=G(P(t),!0),n=G(Bm(t.from),!1);return(r,i)=>Vm(fm(e(r,i),e=>n(e,i)),t,r,i)}case`Transformation`:{let e=Wm(t.transformation,r),n=r?G(t.from,!0):G(t.to,!1),i=r?G(t.to,!0):G(t.from,!1);return(a,o)=>Vm(fm(mm(n(a,o),e=>new rm(t,a,r?`Encoded`:`Type`,e)),n=>fm(mm(e(n,o??Ks,t,a),e=>new rm(t,a,`Transformation`,e)),e=>mm(i(e,o),e=>new rm(t,a,r?`Type`:`Encoded`,e)))),t,a,o)}case`Declaration`:{let e=r?t.decodeUnknown(...t.typeParameters):t.encodeUnknown(...t.typeParameters);return(n,r)=>Vm(e(n,r??Ks,t),t,n,r)}case`Literal`:return Lm(t,e=>e===t.literal);case`UniqueSymbol`:return Lm(t,e=>e===t.symbol);case`UndefinedKeyword`:return Lm(t,_t);case`NeverKeyword`:return Lm(t,Vt);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return S;case`StringKeyword`:return Lm(t,ut);case`NumberKeyword`:return Lm(t,Wt);case`BooleanKeyword`:return Lm(t,e);case`BigIntKeyword`:return Lm(t,je);case`SymbolKeyword`:return Lm(t,mt);case`ObjectKeyword`:return Lm(t,st);case`Enums`:return Lm(t,e=>t.enums.some(([t,n])=>n===e));case`TemplateLiteral`:{let e=ac(t);return Lm(t,t=>ut(t)&&e.test(t))}case`TupleType`:{let e=t.elements.map(e=>G(e.type,r)),i=t.rest.map(e=>G(e.type,r)),a=t.elements.filter(e=>!e.isOptional);t.rest.length>0&&(a=a.concat(t.rest.slice(1)));let o=a.length,s=t.elements.length>0?t.elements.map((e,t)=>t).join(` | `):`never`,c=Pm(t),l=Fm(t);return(r,u)=>{if(!n(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=[],h=r.length;for(let e=h;e<=o-1;e++){let n=new V(e,r,new tm(a[e-h]));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,m))}if(t.rest.length===0)for(let e=t.elements.length;e<=h-1;e++){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${s}`));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,m))}let g=0,_;for(;g<e.length;g++)if(h<g+1){if(t.elements[g].isOptional)continue}else{let n=e[g],i=n(r[g],u);if(dm(i)){if(Bt(i)){let e=new V(g,r,i.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}m.push([p++,i.right])}else{let e=p++,n=g;_||=[],_.push(({es:a,output:o})=>M(Cr(i),i=>{if(Bt(i)){let s=new V(n,r,i.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,i.right]),O}))}}if(qt(i)){let[e,...n]=i;for(;g<h-n.length;g++){let n=e(r[g],u);if(dm(n))if(Bt(n)){let e=new V(g,r,n.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}else m.push([p++,n.right]);else{let e=p++,i=g;_||=[],_.push(({es:a,output:o})=>M(Cr(n),n=>{if(Bt(n)){let s=new V(i,r,n.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}else return o.push([e,n.right]),O}))}}for(let e=0;e<n.length;e++){let i=g+e;if(!(h<i+1)){let a=n[e](r[i],u);if(dm(a)){if(Bt(a)){let e=new V(i,r,a.left);if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,Um(m)))}m.push([p++,a.right])}else{let e=p++;_||=[],_.push(({es:n,output:o})=>M(Cr(a),a=>{if(Bt(a)){let s=new V(i,r,a.left);return d?(n.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,a.right]),O}))}}}}let ee=({es:e,output:n})=>pt(e)?x(new H(t,r,Um(e),Um(n))):S(Um(n));if(_&&_.length>0){let e=_;return A(()=>{let t={es:We(f),output:We(m)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ee(t))})}return ee({output:m,es:f})}}case`TypeLiteral`:{if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return Lm(t,rt);let e=[],n={},i=[];for(let a of t.propertySignatures)e.push([G(a.type,r),a]),n[a.name]=null,i.push(a.name);let a=t.indexSignatures.map(e=>[G(e.parameter,r),G(e.type,r),e.parameter]),o=Rs.make(t.indexSignatures.map(e=>e.parameter).concat(i.map(e=>mt(e)?new ls(e):new os(e)))),s=G(o,r),c=Pm(t),l=Fm(t);return(r,u)=>{if(!Mt(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=u?.onExcessProperty===`error`,h=u?.onExcessProperty===`preserve`,g={},_;if(m||h){_=Reflect.ownKeys(r);for(let e of _){let n=s(e,u);if(dm(n)&&Bt(n))if(m){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${String(o)}`));if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,g))}else g[e]=r[e]}}let ee,te=u?.exact===!0;for(let n=0;n<e.length;n++){let i=e[n][1],a=i.name,o=Object.prototype.hasOwnProperty.call(r,a);if(!o){if(i.isOptional)continue;if(te){let e=new V(a,r,new tm(i));if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,g))}}let s=e[n][0],c=s(r[a],u);if(dm(c)){if(Bt(c)){let e=new V(a,r,o?c.left:new tm(i));if(d){f.push([p++,e]);continue}else return x(new H(t,r,e,g))}g[a]=c.right}else{let e=p++,n=a;ee||=[],ee.push(({es:a,output:s})=>M(Cr(c),c=>{if(Bt(c)){let l=new V(n,r,o?c.left:new tm(i));return d?(a.push([e,l]),O):x(new H(t,r,l,s))}return s[n]=c.right,O}))}}for(let e=0;e<a.length;e++){let i=a[e],o=i[0],s=i[1],c=La(r,i[2]);for(let e of c){let i=o(e,u);if(dm(i)&&me(i)){let i=s(r[e],u);if(dm(i))if(Bt(i)){let n=new V(e,r,i.left);if(d){f.push([p++,n]);continue}else return x(new H(t,r,n,g))}else Object.prototype.hasOwnProperty.call(n,e)||(g[e]=i.right);else{let a=p++,o=e;ee||=[],ee.push(({es:s,output:c})=>M(Cr(i),i=>{if(Bt(i)){let e=new V(o,r,i.left);return d?(s.push([a,e]),O):x(new H(t,r,e,c))}else return Object.prototype.hasOwnProperty.call(n,e)||(c[e]=i.right),O}))}}}}let ne=({es:e,output:n})=>{if(pt(e))return x(new H(t,r,Um(e),n));if(u?.propertyOrder===`original`){let e=_||Reflect.ownKeys(r);for(let t of i)e.indexOf(t)===-1&&e.push(t);let t={};for(let r of e)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return S(t)}return S(n)};if(ee&&ee.length>0){let e=ee;return A(()=>{let t={es:We(f),output:Object.assign({},g)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ne(t))})}return ne({es:f,output:g})}}case`Union`:{let e=zm(t.types,r),n=Reflect.ownKeys(e.keys),i=n.length,a=t.types.length,o=new Map;for(let e=0;e<a;e++)o.set(t.types[e],G(t.types[e],r));let s=Pm(t)??1,c=Fm(t);return(r,l)=>{let u=[],d=0,f=[];if(i>0)if(Jt(r))for(let t=0;t<i;t++){let i=n[t],o=e.keys[i].buckets;if(Object.prototype.hasOwnProperty.call(r,i)){let t=String(r[i]);if(Object.prototype.hasOwnProperty.call(o,t))f=f.concat(o[t]);else{let{candidates:t,literals:n}=e.keys[i],o=Rs.make(n),s=t.length===a?new As([new N(i,o,!1,!0)],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new U(o,r[i])))])}}else{let{candidates:t,literals:n}=e.keys[i],o=new N(i,Rs.make(n),!1,!0),s=t.length===a?new As([o],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new tm(o)))])}}else{let n=e.candidates.length===a?t:Rs.make(e.candidates);u.push([d++,new U(n,r)])}e.otherwise.length>0&&(f=f.concat(e.otherwise));let p;for(let e=0;e<f.length;e++){let t=f[e],n=o.get(t)(r,l);if(dm(n)&&(!p||p.length===0)){if(me(n))return n;u.push([d++,n.left])}else{let e=d++;p||=[],p.push(t=>A(()=>`finalResult`in t?O:M(Cr(n),n=>(me(n)?t.finalResult=n:t.es.push([e,n.left]),O))))}}let m=e=>pt(e)?e.length===1&&e[0][1]._tag===`Type`?x(e[0][1]):x(new H(t,r,Um(e))):x(new U(t,r));if(p&&p.length>0){let e=p;return A(()=>{let t={es:We(u)};return M($r(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>`finalResult`in t?t.finalResult:m(t.es))})}return m(u)}}case`Suspend`:{let e=Ra(()=>G(t.f(),r));return(t,n)=>e()(t,n)}}},Lm=(e,t)=>n=>t(n)?S(n):x(new U(e,n)),Rm=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Zo(e);if(Ae(n))return Rm(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([i.name,a])}return n}case`TupleType`:{let n=[];for(let r=0;r<e.elements.length;r++){let i=e.elements[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return Rm(e.from,t);case`Suspend`:return Rm(e.f(),t);case`Transformation`:return Rm(t?e.from:e.to,t)}return[]},zm=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=Rm(o,t);if(s.length>0){i.push(o);for(let e=0;e<s.length;e++){let[t,r]=s[e],i=String(r.literal);n[t]=n[t]||{buckets:{},literals:[],candidates:[]};let a=n[t].buckets;if(Object.prototype.hasOwnProperty.call(a,i)){if(e<s.length-1)continue;a[i].push(o),n[t].literals.push(r),n[t].candidates.push(o)}else{a[i]=[o],n[t].literals.push(r),n[t].candidates.push(o);break}}}else r.push(o)}return{keys:n,otherwise:r,candidates:i}},Bm=e=>Gs(e)?Bm(e.from):e,Vm=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||dm(e))return e;let i=new Xn,a=Un(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(bi(o))return S(o.value);let e=o.cause;return vi(e)?x(e.error):x(new im(t,n,fi(e)))}return x(new im(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},Hm=([e],[t])=>e>t?1:e<t?-1:0;function Um(e){return e.sort(Hm).map(e=>e[1])}const Wm=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return S;case`TypeLiteralTransformation`:return n=>{let r=S(n);for(let n of e.propertySignatureTransformations){let[e,i]=t?[n.from,n.to]:[n.to,n.from],a=t?n.decode:n.encode;r=pm(r,t=>{let n=a(Object.prototype.hasOwnProperty.call(t,e)?v(t[e]):w());return delete t[e],Ae(n)&&(t[i]=n.value),t})}return r}}},Gm=(e,t=[])=>({value:e,forest:t}),Km={formatIssue:e=>pm(ph(e),qm),formatIssueSync:e=>{let t=Km.formatIssue(e);return dm(t)?qe(t):cn(t)},formatError:e=>Km.formatIssue(e.issue),formatErrorSync:e=>Km.formatIssueSync(e.issue)},qm=e=>e.value+Jm(`
6
- `,e.forest),Jm=(e,t)=>{let n=``,r=t.length,i;for(let a=0;a<r;a++){i=t[a];let o=a===r-1;n+=e+(o?`└`:`├`)+`─ `+i.value,n+=Jm(e+(r>1&&!o?`│ `:` `),i.forest)}return n},Ym=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},Xm=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},Zm=e=>`ast`in e?v(e.ast):w(),Qm=S(void 0),$m=e=>Zm(e).pipe(f(Bo),y({onNone:()=>Qm,onSome:t=>{let n=t(e);return ut(n)?S({message:n,override:!1}):Fn(n)?T(n,e=>({message:e,override:!1})):ut(n.message)?S({message:n.message,override:n.override}):T(n.message,e=>({message:e,override:n.override}))}})),eh=e=>t=>t._tag===e,th=eh(`Composite`),nh=eh(`Refinement`),rh=eh(`Transformation`),ih=e=>fm($m(e),t=>t===void 0?Qm:!t.override&&(th(e)||nh(e)&&e.kind===`From`||rh(e)&&e.kind!==`Transformation`)?rh(e)||nh(e)?ih(e.issue):Qm:S(t.message)),ah=e=>Zm(e).pipe(f(Jo),en(t=>t(e)),o);function oh(e){return Go(e).pipe(c(()=>Ho(e)),c(()=>Uo(e)),c(()=>Wo(e)),h(()=>`{ ${e.from} | filter }`))}function sh(e){return e.message===void 0?`Expected ${Gs(e.ast)?oh(e.ast):String(e.ast)}, actual ${St(e.actual)}`:e.message}const ch=e=>pm(ih(e),t=>t??ah(e)??sh(e)),lh=e=>ah(e)??String(e.ast),uh=e=>e.message??`is forbidden`,dh=e=>e.message??`is unexpected`,fh=e=>{let t=Vo(e.ast);if(Ae(t)){let e=t.value();return ut(e)?S(e):e}return S(e.message??`is missing`)},ph=e=>{switch(e._tag){case`Type`:return pm(ch(e),Gm);case`Forbidden`:return S(Gm(lh(e),[Gm(uh(e))]));case`Unexpected`:return S(Gm(dh(e)));case`Missing`:return pm(fh(e),Gm);case`Transformation`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Ym(e.kind),[t])])):S(Gm(t)));case`Refinement`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Xm(e.kind),[t])])):S(Gm(t)));case`Pointer`:return pm(ph(e.issue),t=>Gm(Ha(e.path),[t]));case`Composite`:return fm(ih(e),t=>{if(t!==void 0)return S(Gm(t));let n=lh(e);return za(e.issues)?pm($r(e.issues,ph),e=>Gm(n,e)):pm(ph(e.issues),e=>Gm(n,[e]))})}},mh=C(e=>st(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),hh=C(e=>st(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),gh=Symbol.for(`effect/Schema`);function K(e){return class{[gh]=_h;static ast=e;static annotations(e){return K(bh(this.ast,e))}static pipe(){return Le(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[gh]=_h}}const _h={_A:e=>e,_I:e=>e,_R:e=>e},vh={typeConstructor:ho,schemaId:_o,message:vo,missingMessage:yo,identifier:bo,title:xo,description:Co,examples:wo,default:To,documentation:Ao,jsonSchema:Eo,arbitrary:Do,pretty:Oo,equivalence:ko,concurrency:jo,batching:Mo,parseIssueTitle:No,parseOptions:Po,decodingFallback:Fo},yh=e=>{if(!e)return{};let t={...e};for(let n in vh)if(n in e){let r=vh[n];t[r]=e[n],delete t[n]}return t},bh=(e,t)=>tc(e,yh(t)),xh=e=>String(e.ast),Sh=e=>K(pc(e.ast)),Ch=e=>K(P(e.ast)),wh=(e,t)=>{let n=Tm(e,t);return(e,t)=>mm(n(e,t),sm)},Th=(e,t)=>{let n=wm(e,t);return(e,t)=>Ne(n(e,t),sm)},Eh=wh,Dh=e=>$e(e,gh)&&st(e[gh]);function Oh(e){return Bs(e)?Rs.make(zs(e,e=>new os(e))):new os(e[0])}function kh(e,t=Oh(e)){return class extends K(t){static annotations(e){return kh(this.literals,bh(this.ast,e))}static literals=[...e]}}function Ah(...e){return qt(e)?kh(e):zh}const jh=(e,t,n)=>Nh(e,new is(e.map(e=>e.ast),(...e)=>t.decode(...e.map(K)),(...e)=>t.encode(...e.map(K)),yh(n))),Mh=(e,t)=>{let n=()=>(t,n,r)=>e(t)?W(t):cm(new U(r,t));return Nh([],new is([],n,n,yh(t)))};function Nh(e,t){return class extends K(t){static annotations(e){return Nh(this.typeParameters,bh(this.ast,e))}static typeParameters=[...e]}}const Ph=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return jh(e,t,n)}let e=arguments[0],t=arguments[1];return Mh(e,t)},Fh=Symbol.for(`effect/SchemaId/InstanceOf`),Ih=(e,t)=>Ph(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Fh,[Fh]:{constructor:e},...t});var Lh=class extends K(us){},Rh=class extends K(cs){},zh=class extends K(ds){},Bh=class extends K(fs){},Vh=class extends K(bs){},Hh=class extends K(xs){},q=class extends K(ms){},J=class extends K(gs){},Uh=class extends K(vs){};const Wh=e=>Rs.make(e.map(e=>e.ast));function Gh(e,t=Wh(e)){return class extends K(t){static annotations(e){return Gh(this.members,bh(this.ast,e))}static members=[...e]}}function Kh(...e){return Bs(e)?Gh(e):qt(e)?e[0]:zh}const qh=e=>Kh(e,Rh),Jh=e=>Kh(e,Lh),Yh=e=>Kh(e,Rh,Lh),Xh=e=>new Zh(new ws(e.ast,!1),e);var Zh=class e{ast;from;[gh];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ws(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...yh(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}};const Qh=(e,t)=>new Es(e.map(e=>Dh(e)?new ws(e.ast,!1):e.ast),t.map(e=>Dh(e)?new Cs(e.ast):e.ast),!0);function $h(e,t,n=Qh(e,t)){return class extends K(n){static annotations(e){return $h(this.elements,this.rest,bh(this.ast,e))}static elements=[...e];static rest=[...t]}}function eg(...e){return Array.isArray(e[0])?$h(e[0],e.slice(1)):$h(e,[])}function tg(e,t){return class extends $h([],[e],t){static annotations(e){return tg(this.value,bh(this.ast,e))}static value=e}}const ng=e=>tg(e),rg=e=>e?`"?:"`:`":"`;var ig=class extends ws{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=rg(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}},ag=class extends ws{isReadonly;fromKey;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.fromKey=i}},og=class extends ws{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}};const sg=e=>e===void 0?`never`:ut(e)?JSON.stringify(e):String(e);var cg=class{from;to;decode;encode;_tag=`PropertySignatureTransformation`;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}toString(){return`PropertySignature<${rg(this.to.isOptional)}, ${this.to.type}, ${sg(this.from.fromKey)}, ${rg(this.from.isOptional)}, ${this.from.type}>`}};const lg=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new ig(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new cg(e.from,new og(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},ug=Symbol.for(`effect/PropertySignature`),dg=e=>$e(e,ug);var fg=class e{ast;[gh];[ug]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return Le(this,arguments)}annotations(t){return new e(lg(this.ast,yh(t)))}toString(){return String(this.ast)}};const pg=e=>new fg(e);var mg=class e extends fg{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(lg(this.ast,yh(t)),this.from)}};const hg=e=>new mg(new ig(e.ast,!1,!0,{},void 0),e),gg=C(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return pg(new ig(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return pg(new cg(n.from,new og(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),_g=(e,t,n)=>pg(new cg(new ag(e.ast,!0,!0,{},void 0),new og(t.ast,!1,!0,{},void 0),e=>v(n.decode(e)),f(n.encode))),vg=(e,t,n)=>pg(new cg(new ag(e.ast,!0,!0,{},void 0),new og(t.ast,!0,!0,{},void 0),n.decode,n.encode)),yg=(e,t)=>{let n=t?.exact,r=t?.default,i=t?.nullable,a=t?.as==`Option`,o=t?.onNoneEncoding?c(t.onNoneEncoding):b;if(n){if(r)return i?gg(_g(qh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===null?r():e}),encode:v}),r).ast:gg(_g(e,Ch(e),{decode:y({onNone:r,onSome:b}),encode:v}),r).ast;if(a){let t=Mv(Ch(e));return i?_g(qh(e),t,{decode:Ie(bt),encode:o}).ast:_g(e,t,{decode:b,encode:b}).ast}else if(i)return vg(qh(e),Ch(e),{decode:Ie(bt),encode:b}).ast;else return new ig(e.ast,!0,!0,{},void 0)}else if(r)return i?gg(_g(Yh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e??r()}),encode:v}),r).ast:gg(_g(Jh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===void 0?r():e}),encode:v}),r).ast;else if(a){let t=Mv(Ch(e));return i?_g(Yh(e),t,{decode:Ie(e=>e!=null),encode:o}).ast:_g(Jh(e),t,{decode:Ie(Rt),encode:o}).ast}else if(i)return vg(Yh(e),Jh(Ch(e)),{decode:Ie(bt),encode:b}).ast;else return new ig(Jh(e).ast,!0,!0,{},void 0)},bg=e=>new mg(new ig(e.ast===us||e.ast===ds?us:Jh(e).ast,!0,!0,{},void 0),e),xg=C(e=>Dh(e[0]),(e,t)=>new mg(yg(e,t),e)),Sg=sc([yo]),Cg=(e,t)=>{let n=Reflect.ownKeys(e),r=[];if(n.length>0){let i=[],a=[],o=[];for(let t=0;t<n.length;t++){let s=n[t],c=e[s];if(dg(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,n=e.isOptional,o=e.annotations;i.push(new N(s,t,n,!0,Sg(e))),a.push(new N(s,P(t),n,!0,o)),r.push(new N(s,t,n,!0,o));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??s;i.push(new N(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),a.push(new N(s,e.to.type,e.to.isOptional,!0,e.to.annotations)),o.push(new Qs(t,s,e.decode,e.encode));break}}}else i.push(new N(s,c.ast,!1,!0)),a.push(new N(s,P(c.ast),!1,!0)),r.push(new N(s,c.ast,!1,!0))}if(qt(o)){let e=[],n=[];for(let r of t){let{indexSignatures:t,propertySignatures:o}=oc(r.key.ast,r.value.ast);o.forEach(e=>{i.push(e),a.push(new N(e.name,P(e.type),e.isOptional,e.isReadonly,e.annotations))}),t.forEach(t=>{e.push(t),n.push(new ks(t.parameter,P(t.type),t.isReadonly))})}return new qs(new As(i,e,{[So]:`Struct (Encoded side)`}),new As(a,n,{[So]:`Struct (Type side)`}),new $s(o))}}let i=[];for(let e of t){let{indexSignatures:t,propertySignatures:n}=oc(e.key.ast,e.value.ast);n.forEach(e=>r.push(e)),t.forEach(e=>i.push(e))}return new As(r,i)},wg=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&dg(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function Tg(e,t,n=Cg(e,t)){return class extends K(n){static annotations(e){return Tg(this.fields,this.records,bh(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=wg(e,{...t});return Gv(n)?r:km(this)(r)};static pick(...t){return Eg(mh(e,...t))}static omit(...t){return Eg(hh(e,...t))}}}function Eg(e,...t){return Tg(e,t)}const Dg=e=>Ah(e).pipe(hg,gg(()=>e)),Og=(e,t)=>Eg({_tag:Dg(e),...t});function kg(e,t,n){return class extends Tg({},[{key:e,value:t}],n){static annotations(n){return kg(e,t,bh(this.ast,n))}static key=e;static value=t}}const Ag=e=>kg(e.key,e.value);function jg(e,t){return class extends K(t){static annotations(e){return jg(this.from,bh(this.ast,e))}static make=(e,t)=>Gv(t)?e:km(this)(e);static from=e}}const Mg=(e,t)=>n=>{let r=y(zo(n.ast),{onNone:()=>[e],onSome:t=>[...t,e]});return jg(n,tc(n.ast,yh({[go]:r,...t})))},Ng=(e,t,n)=>{if(Ns(e)&&Ns(t)){let r=[...e.propertySignatures];for(let e of t.propertySignatures){let t=e.name,i=r.findIndex(e=>e.name===t);if(i===-1)r.push(e);else{let{isOptional:a,type:o}=r[i];r[i]=new N(t,Ig(o,e.type,n.concat(t)),a,!0)}}return new As(r,e.indexSignatures.concat(t.indexSignatures))}throw Error(Ga(e,t,n))},Pg=cc([bo]),Fg=(e,t)=>t.map(t=>new Ws(t,e.filter,Pg(e))),Ig=(e,t,n)=>Rs.make(Rg([e],[t],n)),Lg=e=>Vs(e)?e.types:[e],Rg=(t,n,r)=>he(t,t=>he(n,n=>{switch(n._tag){case`Literal`:if(ut(n.literal)&&hs(t)||Wt(n.literal)&&_s(t)||e(n.literal)&&ys(t))return[n];break;case`StringKeyword`:if(n===ms){if(hs(t)||ss(t)&&ut(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===ms)return[n];break;case`NumberKeyword`:if(n===gs){if(_s(t)||ss(t)&&Wt(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===gs)return[n];break;case`BooleanKeyword`:if(n===vs){if(ys(t)||ss(t)&&e(t.literal))return[t];if(Gs(t))return Fg(t,Rg(Lg(t.from),[n],r))}else if(t===vs)return[n];break;case`Union`:return Rg(Lg(t),n.types,r);case`Suspend`:return[new Us(()=>Ig(t,n.f(),r))];case`Refinement`:return Fg(n,Rg(Lg(t),Lg(n.from),r));case`TypeLiteral`:switch(t._tag){case`Union`:return Rg(t.types,[n],r);case`Suspend`:return[new Us(()=>Ig(t.f(),n,r))];case`Refinement`:return Fg(t,Rg(Lg(t.from),[n],r));case`TypeLiteral`:return[Ng(t,n,r)];case`Transformation`:{let e=t.transformation,i=Ng(t.from,n,r),a=Ng(t.to,P(n),r);switch(e._tag){case`TypeLiteralTransformation`:return[new qs(i,a,new $s(e.propertySignatureTransformations))];case`ComposeTransformation`:return[new qs(i,a,Zs)];case`FinalTransformation`:return[new qs(i,a,new Ys((t,n,r,i)=>pm(e.decode(t,n,r,i),e=>({...t,...e})),(t,n,r,i)=>pm(e.encode(t,n,r,i),e=>({...t,...e}))))]}}}break;case`Transformation`:if(Js(t)){if(ec(n.transformation)&&ec(t.transformation))return[new qs(Ng(t.from,n.from,r),Ng(t.to,n.to,r),new $s(n.transformation.propertySignatureTransformations.concat(t.transformation.propertySignatureTransformations)))]}else return Rg([n],[t],r);break}throw Error(Ga(t,n,r))})),zg=C(2,(e,t)=>K(Ig(e.ast,t.ast,[]))),Bg=C(e=>Dh(e[1]),(e,t)=>Kg(e,t,hc(e.ast,t.ast))),Vg=e=>K(new Us(()=>e().ast)),Hg=Symbol.for(`effect/SchemaId/Refine`);function Ug(e,t,n){return class extends K(n){static annotations(e){return Ug(this.from,this.filter,bh(this.ast,e))}static[Hg]=e;static from=e;static filter=t;static make=(e,t)=>Gv(t)?e:km(this)(e)}}const Wg=(t,n,r)=>{if(e(t))return t?w():v(new U(n,r));if(ut(t))return v(new U(n,r,t));if(t!==void 0){if(`_tag`in t)return v(t);let e=new U(n,r,t.message);return v(qt(t.path)?new V(t.path,r,e):e)}return w()},Gg=(e,t,n)=>{if(Ba(e))return Wg(e,t,n);if(qt(e)){let r=ie(e,e=>Wg(e,t,n));if(qt(r))return v(r.length===1?r[0]:new H(t,n,r))}return w()};function Y(e,t){return n=>{function r(t,n,r){return Gg(e(t,n,r),r,t)}return Ug(n,r,new Ws(n.ast,r,yh(t)))}}function Kg(e,t,n){return class extends K(n){static annotations(e){return Kg(this.from,this.to,bh(this.ast,e))}static from=e;static to=t}}const X=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>Kg(e,t,new qs(e.ast,t.ast,new Ys(n.decode,n.encode)))),Z=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>X(e,t,{strict:!0,decode:(e,t,r,i)=>W(n.decode(e,i)),encode:(e,t,r,i)=>W(n.encode(e,i))})),qg=Symbol.for(`effect/SchemaId/Trimmed`),Jg=e=>t=>t.pipe(Y(e=>e===e.trim(),{schemaId:qg,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),Yg=fo,Xg=(e,t)=>n=>n.pipe(Y(t=>t.length>=e,{schemaId:Yg,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Zg=po,Qg=(e,t)=>n=>{let r=st(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=st(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Y(e=>e.length===r,{schemaId:Zg,title:`length(${r})`,description:r===1?`a single character`:`a string ${r} character(s) long`,jsonSchema:{minLength:r,maxLength:r},...t})):n.pipe(Y(e=>e.length>=r&&e.length<=i,{schemaId:Zg,title:`length({ min: ${r}, max: ${i})`,description:`a string at least ${r} character(s) and at most ${i} character(s) long`,jsonSchema:{minLength:r,maxLength:i},...t}))},$g=Symbol.for(`effect/SchemaId/Pattern`),e_=(e,t)=>n=>{let r=e.source;return n.pipe(Y(t=>(e.lastIndex=0,e.test(t)),{schemaId:$g,[$g]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},t_=Symbol.for(`effect/SchemaId/Lowercased`),n_=e=>t=>t.pipe(Y(e=>e===e.toLowerCase(),{schemaId:t_,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e}));var r_=class extends q.pipe(n_({identifier:`Lowercased`})){};const i_=Symbol.for(`effect/SchemaId/Uppercased`),a_=e=>t=>t.pipe(Y(e=>e===e.toUpperCase(),{schemaId:i_,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e}));var o_=class extends q.pipe(a_({identifier:`Uppercased`})){};const s_=Symbol.for(`effect/SchemaId/Capitalized`),c_=e=>t=>t.pipe(Y(e=>e[0]?.toUpperCase()===e[0],{schemaId:s_,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e}));var l_=class extends q.pipe(c_({identifier:`Capitalized`})){};const u_=Symbol.for(`effect/SchemaId/Uncapitalized`),d_=e=>t=>t.pipe(Y(e=>e[0]?.toLowerCase()===e[0],{schemaId:u_,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e}));var f_=class extends q.pipe(d_({identifier:`Uncapitalized`})){};q.pipe(Qg(1,{identifier:`Char`}));const p_=e=>Xg(1,{title:`nonEmptyString`,description:`a non empty string`,...e});Z(q.annotations({description:`a string that will be converted to lowercase`}),r_,{strict:!0,decode:e=>e.toLowerCase(),encode:b}).annotations({identifier:`Lowercase`}),Z(q.annotations({description:`a string that will be converted to uppercase`}),o_,{strict:!0,decode:e=>e.toUpperCase(),encode:b}).annotations({identifier:`Uppercase`}),Z(q.annotations({description:`a string that will be converted to a capitalized format`}),l_,{strict:!0,decode:e=>Pa(e),encode:b}).annotations({identifier:`Capitalize`}),Z(q.annotations({description:`a string that will be converted to an uncapitalized format`}),f_,{strict:!0,decode:e=>Fa(e),encode:b}).annotations({identifier:`Uncapitalize`});var m_=class extends q.pipe(Jg({identifier:`Trimmed`})){},h_=class extends m_.pipe(p_({identifier:`NonEmptyTrimmedString`})){};Z(q.annotations({description:`a string that will be trimmed`}),m_,{strict:!0,decode:e=>e.trim(),encode:b}).annotations({identifier:`Trim`});const g_=e=>e instanceof Error?e.message:String(e),__=e=>X(q.annotations({description:`a string to be decoded into JSON`}),Bh,{strict:!0,decode:(t,n,r)=>lm({try:()=>JSON.parse(t,e?.reviver),catch:e=>new U(r,t,g_(e))}),encode:(t,n,r)=>lm({try:()=>JSON.stringify(t,e?.replacer,e?.space),catch:e=>new U(r,t,g_(e))})}).annotations({title:`parseJson`,schemaId:rs}),v_=(e,t)=>Dh(e)?Bg(v_(t),e):__(e);q.pipe(p_({identifier:`NonEmptyString`}));const y_=Symbol.for(`effect/SchemaId/UUID`),b_=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;q.pipe(e_(b_,{schemaId:y_,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:b_.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));const x_=Symbol.for(`effect/SchemaId/ULID`);q.pipe(e_(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:x_,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var S_=class extends Ih(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};X(q.annotations({description:`a string to be decoded into a URL`}),S_,{strict:!0,decode:(e,t,n)=>lm({try:()=>new URL(e),catch:t=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${g_(t)}`)}),encode:e=>W(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});const C_=oo,w_=e=>t=>t.pipe(Y(Number.isFinite,{schemaId:C_,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),T_=eo,E_=(e,t)=>n=>n.pipe(Y(t=>t>e,{schemaId:T_,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),D_=to,O_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:D_,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),k_=io,A_=e=>t=>t.pipe(Y(e=>Number.isSafeInteger(e),{schemaId:k_,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),j_=no,M_=(e,t)=>n=>n.pipe(Y(t=>t<e,{schemaId:j_,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),N_=ro,P_=(e,t)=>n=>n.pipe(Y(t=>t<=e,{schemaId:N_,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),F_=co,I_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:F_,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),L_=ao,R_=e=>t=>t.pipe(Y(e=>!Number.isNaN(e),{schemaId:L_,title:`nonNaN`,description:`a number excluding NaN`,...e})),z_=e=>E_(0,{title:`positive`,...e}),B_=e=>M_(0,{title:`negative`,...e}),V_=e=>P_(0,{title:`nonPositive`,...e}),H_=e=>O_(0,{title:`nonNegative`,...e});function U_(e){return X(e,J,{strict:!1,decode:(e,t,n)=>um(kn(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>W(String(e))})}U_(q.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),J.pipe(w_({identifier:`Finite`}));var W_=class extends J.pipe(A_({identifier:`Int`})){};J.pipe(R_({identifier:`NonNaN`})),J.pipe(z_({identifier:`Positive`})),J.pipe(B_({identifier:`Negative`})),J.pipe(V_({identifier:`NonPositive`}));var G_=class extends J.pipe(H_({identifier:`NonNegative`})){};const K_=so;J.pipe(w_({schemaId:K_,identifier:`JsonNumber`})),Z(Uh.annotations({description:`a boolean that will be negated`}),Uh,{strict:!0,decode:e=>Dn(e),encode:e=>Dn(e)});const q_=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?cm(new U(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):W(n)},J_=e=>W(Symbol.for(e));X(q.annotations({description:`a string to be decoded into a globally shared symbol`}),Hh,{strict:!1,decode:e=>J_(e),encode:(e,t,n)=>q_(e,n)}).annotations({identifier:`Symbol`});const Y_=lo,X_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:Y_,[Y_]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),Z_=uo,Q_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Z_,[Z_]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),$_=e=>X_(0n,{title:`nonNegativeBigInt`,...e});var ev=class extends X(q.annotations({description:`a string to be decoded into a bigint`}),Vh,{strict:!0,decode:(e,t,n)=>um(Uc(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>W(String(e))}).annotations({identifier:`BigInt`}){};const tv=Vh.pipe($_({identifier:`NonNegativeBigintFromSelf`}));X(J.annotations({description:`a number to be decoded into a bigint`}),Vh.pipe(Q_(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>um(Wc(e),()=>new U(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>um(Hc(e),()=>new U(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});const nv=(e,t,n,r)=>hm(e,{onFailure:e=>new H(n,r,e),onSuccess:t});var rv=class extends Ph(Ze,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(de),e.bigInt({min:0n}).map(e=>t(e)),e.maxSafeNat().map(e=>Me(e))),equivalence:()=>re}){};X(tv.annotations({description:`a bigint to be decoded into a Duration`}),rv.pipe(Y(e=>Je(e),{description:`a finite duration`})),{strict:!0,decode:e=>W(t(e)),encode:(e,t,n)=>y(Ft(e),{onNone:()=>cm(new U(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>W(e)})}).annotations({identifier:`DurationFromNanos`});const iv=G_.pipe(A_()).annotations({identifier:`NonNegativeInt`});Z(G_.annotations({description:`a non-negative number to be decoded into a Duration`}),rv,{strict:!0,decode:e=>Me(e),encode:e=>Kt(e)}).annotations({identifier:`DurationFromMillis`});const av=Og(`Millis`,{millis:iv}),ov=Og(`Nanos`,{nanos:ev}),sv=Og(`Infinity`,{}),cv=sv.make({}),lv=Kh(av,ov,sv).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),uv=Kh(eg(Xh(iv).annotations({title:`seconds`}),Xh(iv).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),eg(Ah(-1),Ah(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),dv=e=>typeof e==`object`;Z(Kh(lv,uv),rv,{strict:!0,decode:e=>{if(dv(e))switch(e._tag){case`Millis`:return Me(e.millis);case`Nanos`:return t(e.nanos);case`Infinity`:return de}let[n,r]=e;return n===-1?de:t(BigInt(n)*BigInt(1e9)+BigInt(r))},encode:e=>{switch(e.value._tag){case`Millis`:return av.make({millis:e.value.millis});case`Nanos`:return ov.make({nanos:e.value.nanos});case`Infinity`:return cv}}}).annotations({identifier:`Duration`});var fv=class extends Ph(vt,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>Qe(te)}){};Z(ng(class extends J.pipe(I_(0,255,{identifier:`Uint8`,description:`a 8-bit unsigned integer`})){}).annotations({description:`an array of 8-bit unsigned integers to be decoded into a Uint8Array`}),fv,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});const pv=mo,mv=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(Wa(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Y(e=>e.length>=r,{schemaId:pv,title:`minItems(${r})`,description:`an array of at least ${r} item(s)`,jsonSchema:{minItems:r},[Lo]:!0,...t}))},hv=Symbol.for(`effect/SchemaId/ValidDate`),gv=e=>t=>t.pipe(Y(e=>!Number.isNaN(e.getTime()),{schemaId:hv,[hv]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),_v=$a;var vv=class extends Ph(ft,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:_v,[_v]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>Xt}){};vv.pipe(gv({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends Z(q.annotations({description:`a string to be decoded into a Date`}),vv,{strict:!0,decode:e=>new Date(e),encode:e=>Et(e)}).annotations({identifier:`DateFromString`}){}.pipe(gv({identifier:`Date`})),Z(J.annotations({description:`a number to be decoded into a Date`}),vv,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var yv=class extends Ph(e=>Ip(e)&&zp(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},identifier:`DateTimeUtcFromSelf`,description:`a DateTime.Utc instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.date({noInvalidDate:!0}).map(e=>Hp(e)),equivalence:()=>Vp}){};const bv=(e,t)=>lm({try:()=>Up(e),catch:()=>new U(t,e,`Unable to decode ${St(e)} into a DateTime.Utc`)});X(J.annotations({description:`a number to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Zp(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),X(vv.annotations({description:`a Date to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Xp(e))}).annotations({identifier:`DateTimeUtcFromDate`}),X(q.annotations({description:`a string to be decoded into a DateTime.Utc`}),yv,{strict:!0,decode:(e,t,n)=>bv(e,n),encode:e=>W(Qp(e))}).annotations({identifier:`DateTimeUtc`});const xv=()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(qp);var Sv=class extends Ph(Lp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:xv}){};Z(J.annotations({description:`a number to be decoded into a TimeZone.Offset`}),Sv,{strict:!0,decode:e=>qp(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});const Cv=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map(Kp);var wv=class extends Ph(Rp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:Cv}){};X(q.annotations({description:`a string to be decoded into a TimeZone.Named`}),wv,{strict:!0,decode:(e,t,n)=>lm({try:()=>Kp(e),catch:()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>W(e.id)}).annotations({identifier:`TimeZoneNamed`});var Tv=class extends Kh(Sv,wv){};X(q.annotations({description:`a string to be decoded into a TimeZone`}),Tv,{strict:!0,decode:(e,t,n)=>y(Jp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:W}),encode:e=>W(Yp(e))}).annotations({identifier:`TimeZone`});const Ev=e=>e.oneof(xv()(e),Cv()(e));var Dv=class extends Ph(e=>Ip(e)&&Bp(e),{typeConstructor:{_tag:`effect/DateTime.Zoned`},identifier:`DateTimeZonedFromSelf`,description:`a DateTime.Zoned instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.tuple(e.integer({min:-31536e9,max:31536e9}),Ev(e)).map(([e,t])=>Wp(e,{timeZone:t})),equivalence:()=>Vp}){};X(q.annotations({description:`a string to be decoded into a DateTime.Zoned`}),Dv,{strict:!0,decode:(e,t,n)=>y(Gp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:W}),encode:e=>W($p(e))}).annotations({identifier:`DateTimeZoned`});const Ov=e=>e._tag===`None`?w():v(e.value),kv=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(Ov),Av=e=>y({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),jv=e=>(t,n,r)=>Te(t)?Se(t)?W(w()):nv(e(t.value,n),v,r,t):cm(new U(r,t)),Mv=e=>Ph([e],{decode:e=>jv(Tm(e)),encode:e=>jv(Dm(e))},{typeConstructor:{_tag:`effect/Option`},pretty:Av,arbitrary:kv,equivalence:ee});Z(q,(e=>Mv(e).annotations({description:`Option<${xh(e)}>`}))(h_),{strict:!0,decode:e=>Ie(v(e.trim()),Ia),encode:e=>h(e,()=>``)});const Nv=()=>e=>`BigDecimal(${Lc(kc(e))})`,Pv=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>wc(e,t));var Fv=class extends Ph(Cc,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:Nv,arbitrary:Pv,equivalence:()=>Mc}){};X(q.annotations({description:`a string to be decoded into a BigDecimal`}),Fv,{strict:!0,decode:(e,t,n)=>Ic(e).pipe(y({onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>W(kc(e))})),encode:e=>W(Lc(kc(e)))}).annotations({identifier:`BigDecimal`}),Z(J.annotations({description:`a number to be decoded into a BigDecimal`}),Fv,{strict:!0,decode:e=>Pc(e),encode:e=>zc(e)}).annotations({identifier:`BigDecimalFromNumber`});const Iv=e=>Dh(e)||dg(e),Lv=e=>Reflect.ownKeys(e).every(t=>Iv(e[t])),Rv=e=>`fields`in e?e.fields:Rv(e[Hg]),zv=e=>Lv(e)?Eg(e):Dh(e)?e:Eg(Rv(e)),Bv=e=>Lv(e)?e:Rv(e),Vv=e=>gg(hg(Ah(e)),()=>e),Hv=e=>(t,n,r)=>{let i=Bv(n),a=zv(n),o={_tag:Vv(t)},s=Wv(o,i);return class extends Jv({kind:`TaggedClass`,identifier:e??t,schema:zg(a,Eg(o)),fields:s,Base:Fi,annotations:r}){static _tag=t}},Uv=e=>(t,n,r)=>{class a extends Ii{}a.prototype.name=t;let o=Bv(n),s=zv(n),c={_tag:Vv(t)},l=Wv(c,o),u=`message`in l;class d extends Jv({kind:`TaggedError`,identifier:e??t,schema:zg(s,Eg(c)),fields:l,Base:a,annotations:r,disableToString:!0}){static _tag=t}return u||Object.defineProperty(d.prototype,"message",{get(){return`{ ${Reflect.ownKeys(o).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} }`},enumerable:!1,configurable:!0}),d},Wv=(e,t)=>{let n={...e};for(let r of Reflect.ownKeys(t)){if(r in e)throw Error(Qa(r));n[r]=t[r]}return n};function Gv(t){return e(t)?t:t?.disableValidation??!1}const Kv=tt(`effect/Schema/astCache`,()=>new WeakMap),qv=e=>e===void 0?[]:Array.isArray(e)?e:[e],Jv=({Base:e,annotations:t,disableToString:n,fields:r,identifier:a,kind:o,schema:s})=>{let c=Symbol.for(`effect/Schema/${o}/${a}`),[l,u,d]=qv(t),f=Ch(s),p=f.annotations({identifier:a,...l}),m=f.annotations({[So]:`${a} (Type side)`,...l}),h=s.annotations({[So]:`${a} (Constructor)`,...l}),g=s.annotations({[So]:`${a} (Encoded side)`,...d}),_=s.annotations({...d,...l,...u}),ee=e=>$e(e,c)&&Am(m)(e),te=class extends e{constructor(e={},t=!1){e={...e},o!==`Class`&&delete e._tag,e=wg(r,e),Gv(t)||(e=km(h)(e)),super(e,!0)}static[gh]=_h;static get ast(){let e=Kv.get(this);if(e)return e;let t=Ph([s],{decode:()=>(e,t,n)=>e instanceof this||ee(e)?W(e):cm(new U(n,e)),encode:()=>(e,t)=>e instanceof this?W(e):pm(Dm(m)(e,t),e=>new this(e,!0))},{identifier:a,pretty:e=>t=>`${a}(${e(t)})`,arbitrary:e=>t=>e(t).map(e=>new this(e)),equivalence:b,[Io]:p.ast,...l});return e=Z(g,t,{strict:!0,decode:e=>new this(e,!0),encode:b}).annotations({[Io]:_.ast,...u}).ast,Kv.set(this,e),e}static pipe(){return Le(this,arguments)}static annotations(e){return K(this.ast).annotations(e)}static toString(){return`(${String(g)} <-> ${a})`}static make(...e){return new this(...e)}static fields={...r};static identifier=a;static extend(e){return(t,n)=>{let i=Bv(t),a=zv(t),c=Wv(r,i);return Jv({kind:o,identifier:e,schema:zg(s,a),fields:c,Base:this,annotations:n})}}static transformOrFail(e){return(t,n,i)=>{let a=Wv(r,t);return Jv({kind:o,identifier:e,schema:X(s,Ch(Eg(a)),n),fields:a,Base:this,annotations:i})}}static transformOrFailFrom(e){return(t,n,i)=>{let a=Wv(r,t);return Jv({kind:o,identifier:e,schema:X(Sh(s),Eg(a),n),fields:a,Base:this,annotations:i})}}get[c](){return c}};return n!==!0&&Object.defineProperty(te.prototype,"toString",{value(){return`${a}({ ${Reflect.ownKeys(r).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} })`},configurable:!0,writable:!0}),te},Yv=Kh(Eg({_tag:Ah(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),Eg({_tag:Ah(`Runtime`),id:W_,startTimeMillis:W_}).annotations({identifier:`FiberIdRuntimeEncoded`}),Eg({_tag:Ah(`Composite`),left:Vg(()=>Yv),right:Vg(()=>Yv)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),Xv=e=>e.letrec(t=>({None:e.record({_tag:e.constant(`None`)}),Runtime:e.record({_tag:e.constant(`Runtime`),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant(`Composite`),left:t(`FiberId`),right:t(`FiberId`)}),FiberId:e.oneof(t(`None`),t(`Runtime`),t(`Composite`))})).FiberId.map($v),Zv=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${Zv(e.right)}, ${Zv(e.left)})`}};var Qv=class extends Ph(Oe,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>Zv,arbitrary:()=>Xv}){};const $v=e=>{switch(e._tag){case`None`:return ne;case`Runtime`:return ce(e.id,e.startTimeMillis);case`Composite`:return Ce($v(e.left),$v(e.right))}},ey=e=>{switch(e._tag){case`None`:return{_tag:`None`};case`Runtime`:return{_tag:`Runtime`,id:e.id,startTimeMillis:e.startTimeMillis};case`Composite`:return{_tag:`Composite`,left:ey(e.left),right:ey(e.right)}}};Z(Yv,Qv,{strict:!0,decode:e=>$v(e),encode:e=>ey(e)}).annotations({identifier:`FiberId`});var ty=class extends Z(Bh,Bh,{strict:!0,decode:e=>{if(st(e)&&`message`in e&&typeof e.message==`string`){let t=Error(e.message,{cause:e});return`name`in e&&typeof e.name==`string`&&(t.name=e.name),t.stack=`stack`in e&&typeof e.stack==`string`?e.stack:``,t}return Ht(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Ht(e)}).annotations({identifier:`Defect`}){};Z(Bh,Uh,{strict:!0,decode:e=>Nt(e),encode:b}).annotations({identifier:`BooleanFromUnknown`}),Z(Ah(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Uh,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});const ny=Og(`symbol`,{key:q}).annotations({description:`an object to be decoded into a globally shared symbol`}),ry=X(ny,Hh,{strict:!0,decode:e=>J_(e.key),encode:(e,t,n)=>pm(q_(e,n),e=>ny.make({key:e}))});var iy=class extends Kh(q,J,ry).annotations({identifier:`PropertyKey`}){};Eg({_tag:hg(Ah(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:hg(ng(iy)).annotations({description:`The path to the property where the issue occurred`}),message:hg(q).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});const ay=wf,oy=Df,sy=Of,cy=kf,ly=Nf,uy=Qf,dy=$f,fy=sp,py=lp,my=pp,hy=mp,gy=_p,_y=vp,vy=xp,yy=wp,by=Ep,xy=Dp,Sy=Op,Cy=Symbol.for(`@effect/platform/Error`),wy=Ah(`Clipboard`,`Command`,`FileSystem`,`KeyValueStore`,`Path`,`Stream`,`Terminal`);var Ty=class extends Uv(`@effect/platform/Error/BadArgument`)(`BadArgument`,{module:wy,method:q,description:bg(q),cause:bg(ty)}){[Cy]=Cy;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}};const Ey=Ah(`AlreadyExists`,`BadResource`,`Busy`,`InvalidData`,`NotFound`,`PermissionDenied`,`TimedOut`,`UnexpectedEof`,`Unknown`,`WouldBlock`,`WriteZero`);var Dy=class extends Uv(`@effect/platform/Error/SystemError`)(`SystemError`,{reason:Ey,module:wy,method:q,description:bg(q),syscall:bg(q),pathOrDescriptor:bg(Kh(q,J)),cause:bg(ty)}){[Cy]=Cy;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}};const Oy=yt(`@effect/platform/FileSystem`),ky=e=>typeof e==`bigint`?e:BigInt(e),Ay=BigInt(1024);Ay*Ay*Ay*Ay*Ay;const jy=e=>Oy.of({...e,exists:t=>g(e.access(t),Kr(!0),vr(`SystemError`,e=>e.reason===`NotFound`?k(!1):Zr(e))),readFileString:(t,n)=>Vr(e.readFile(t),{try:e=>new TextDecoder(n).decode(e),catch:e=>new Ty({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})}),stream:(t,n)=>g(e.open(t,{flag:`r`}),n?.offset?Pr(e=>e.seek(n.offset,`start`)):b,T(e=>My(e,n)),xy),sink:(t,n)=>g(e.open(t,{flag:`w`,...n}),T(e=>sy(t=>e.writeAll(t))),ly),writeFileString:(t,n,r)=>M(Tr({try:()=>new TextEncoder().encode(n),catch:e=>new Ty({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),My=(e,{bufferSize:t=16,bytesToRead:n,chunkSize:r=ky(64*1024)}={})=>{let i=n===void 0?void 0:ky(n),a=ky(r);function o(t){if(i!==void 0&&i<=t)return Pp;let n=i!==void 0&&i-t<a?i-t:a;return jp(e.readAlloc(n),y({onNone:()=>Pp,onSome:e=>jp(Fp(Dt(e)),n=>o(t+BigInt(e.length)))}))}return dy(fy(o(BigInt(0))),{capacity:t})},Ny=ky,Py=Oy,Fy=jy,Iy=Symbol.for(`@effect/platform/FileSystem/File`),Ly=Kc(),Ry=Pi(`Create`),zy=Pi(`Update`),By=Pi(`Remove`);var Vy=class extends Lt(`@effect/platform/FileSystem/WatchBackend`)(){};const Hy=Symbol.for(`@effect/platform/Path`),Uy=yt(`@effect/platform/Path`);function Wy(e,t){let n=``,r=0,i=-1,a=0,o;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(i!==s-1&&a!==1)if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function Gy(e,t){let n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}function Ky(e){if(e.protocol!==`file:`)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`Invalid file URL host`}));let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)return Zr(new Ty({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return k(decodeURIComponent(t))}const qy=function(){let e=``,t=!1,n;for(let r=arguments.length-1;r>=-1&&!t;r--){let i;if(r>=0)i=arguments[r];else{let e=globalThis.process;n===void 0&&`process`in globalThis&&typeof e==`object`&&e&&typeof e.cwd==`function`&&(n=e.cwd()),i=n}i.length!==0&&(e=i+`/`+e,t=i.charCodeAt(0)===47)}return e=Wy(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function Jy(e){let t=new URL(`file://`),n=qy(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=eb(n),k(t)}const Yy=/%/g,Xy=/\\/g,Zy=/\n/g,Qy=/\r/g,$y=/\t/g;function eb(e){return e.includes(`%`)&&(e=e.replace(Yy,`%25`)),e.includes(`\\`)&&(e=e.replace(Xy,`%5C`)),e.includes(`
7
- `)&&(e=e.replace(Zy,`%0A`)),e.includes(`\r`)&&(e=e.replace(Qy,`%0D`)),e.includes(` `)&&(e=e.replace($y,`%09`)),e}const tb=Uy.of({[Hy]:Hy,resolve:qy,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Wy(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&n&&(e+=`/`),t?`/`+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return`.`;let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];n.length>0&&(e===void 0?e=n:e+=`/`+n)}return e===void 0?`.`:tb.normalize(e)},relative(e,t){if(e===t||(e=tb.resolve(e),t=tb.resolve(t),e===t))return``;let n=1;for(;n<e.length&&e.charCodeAt(n)===47;++n);let r=e.length,i=r-n,a=1;for(;a<t.length&&t.charCodeAt(a)===47;++a);let o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(n+l)===47?c=l:l===0&&(c=0));break}let r=e.charCodeAt(n+l);if(r!==t.charCodeAt(a+l))break;r===47&&(c=l)}let u=``;for(l=n+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},dirname(e){if(e.length===0)return`.`;let t=e.charCodeAt(0),n=t===47,r=-1,i=!0;for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:`.`:n&&r===1?`//`:e.slice(0,r)},basename(e,t){let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)}},extname(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return Gy(`/`,e)},parse(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t},sep:`/`,fromFileUrl:Ky,toFileUrl:Jy,toNamespacedPath:b}),nb=Xc(Uy,tb),rb=Uy,ib=nb,ab={arrays:`merge`,sets:`merge`,maps:`merge`};function ob(e,t,n){return sb(e,t,new Set,n??ab)}function sb(e,t,n,r){let i={},a=new Set([...fb(e),...fb(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(db(a)&&db(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=cb(a,s,n,r);continue}i[o]=s}return i}function cb(e,t,n,r){if(lb(e)&&lb(t))return sb(e,t,n,r);if(ub(e)&&ub(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function lb(e){return Object.getPrototypeOf(e)===Object.prototype}function ub(e){return typeof e[Symbol.iterator]==`function`}function db(e){return typeof e==`object`&&!!e}function fb(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function pb(e){return e%4==0&&e%100!=0||e%400==0}var mb=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
8
- `||this.startsWith(`\r
9
- `)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function Q(e){return{ok:!0,body:e}}function $(){return{ok:!1}}function hb(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function gb(e){return typeof e==`object`&&!!e}function _b(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function vb(e,t){let{keys:n,type:r,value:i}=t,a=_b(e,n);if(a===void 0)return Object.assign(e,hb(n,i));if(Array.isArray(a))return bb(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(gb(a))return bb(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function yb(e,t){let{type:n,keys:r,value:i}=t,a=_b(e,r);if(a===void 0)return Object.assign(e,hb(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):bb(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(gb(a))return bb(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function bb(e,t){switch(t.type){case`Block`:return ob(e,t.value);case`Table`:return vb(e,t);case`TableArray`:return yb(e,t)}}function xb(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function Sb(e,t){let n=Ob(t);return r=>{let i=[],a=e(r);if(!a.ok)return Q(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return Q(i)}}function Cb(e,t){let n=Ob(t);return r=>{let i=e(r);if(!i.ok)return $();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return Q(a)}}function wb(e,t,n){let r=Ob(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return $();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
10
- `,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return Q(hb(o.body,s.body))}}function Tb(e){return t=>{let n=e(t);if(!n.ok)return $();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=ob(r,e));return Q(r)}}function Eb(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?$():Q(n)}}function Db(e,t,n){let r=Ob(e),i=Ob(n);return a=>{if(!r(a).ok)return $();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return Q(o.body)}}function Ob(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const kb=/[A-Za-z0-9_-]+/y;function Ab(e){e.skipWhitespaces();let t=e.match(kb)?.[0];return t?(e.next(t.length),Q(t)):$()}function jb(e){if(e.char()!==`\\`)return $();switch(e.next(),e.char()){case`b`:return e.next(),Q(`\b`);case`t`:return e.next(),Q(` `);case`n`:return e.next(),Q(`
11
- `);case`f`:return e.next(),Q(`\f`);case`r`:return e.next(),Q(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),Q(r)}case`"`:return e.next(),Q(`"`);case`\\`:return e.next(),Q(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function Mb(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
12
- `)throw SyntaxError(`Single-line string cannot contain EOL`);let n=jb(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Nb(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
13
- `)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Pb(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
14
- `?e.next():e.startsWith(`\r
15
- `)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
16
- `)){e.next(),e.nextUntilChar({skipComments:!1});continue}else if(e.startsWith(`\\\r
17
- `)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=jb(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),Q(t.join(``))}function Fb(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
18
- `?e.next():e.startsWith(`\r
19
- `)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),Q(t.join(``))}const Ib=/(?:true|false)\b/y;function Lb(e){e.skipWhitespaces();let t=e.match(Ib);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const Rb=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),zb=/[+-]?inf\b/y;function Bb(e){e.skipWhitespaces();let t=e.match(zb);if(!t)return $();let n=t[0];return e.next(n.length),Q(Rb.get(n))}const Vb=/[+-]?nan\b/y;function Hb(e){e.skipWhitespaces();let t=e.match(Vb);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const Ub=Cb(xb([Ab,Mb,Nb]),`.`),Wb=/0b[01]+(?:_[01]+)*\b/y;function Gb(e){e.skipWhitespaces();let t=e.match(Wb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const Kb=/0o[0-7]+(?:_[0-7]+)*\b/y;function qb(e){e.skipWhitespaces();let t=e.match(Kb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const Jb=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Yb(e){e.skipWhitespaces();let t=e.match(Jb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Xb=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Zb(e){e.skipWhitespaces();let t=e.match(Xb)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const Qb=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function $b(e){e.skipWhitespaces();let t=e.match(Qb)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const ex=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function tx(e){e.skipWhitespaces();let t=e.match(ex);if(!t)return $();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!pb(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return Q(i)}const nx=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function rx(e){e.skipWhitespaces();let t=e.match(nx)?.[0];return t?(e.next(t.length),Q(t)):$()}function ix(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=ox(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),Q(t)}function ax(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=Db(`{`,Sb(sx,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=ob(n,e);return Q(n)}const ox=xb([Pb,Fb,Mb,Nb,Lb,Bb,Hb,tx,rx,Gb,qb,Yb,$b,Zb,ix,ax]),sx=wb(Ub,`=`,ox);function cx(e){e.nextUntilChar();let t=Tb(Eb(sx))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const lx=Db(`[`,Ub,`]`);function ux(e){e.nextUntilChar();let t=lx(e);if(!t.ok)return $();e.nextUntilChar();let n=cx(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const dx=Db(`[[`,Ub,`]]`);function fx(e){e.nextUntilChar();let t=dx(e);if(!t.ok)return $();e.nextUntilChar();let n=cx(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function px(e){let t=Eb(xb([cx,fx,ux]))(e);return t.ok?Q(t.body.reduce(bb,{__proto__:null})):Q({__proto__:null})}function mx(e,t){let n=e.source.slice(0,e.position).split(`
20
- `);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function hx(e){return t=>{let n=new mb(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(mx(n,r))}catch(e){throw e instanceof Error?SyntaxError(mx(n,e.message)):SyntaxError(mx(n,`Invalid error type caught`))}}}function gx(e){return hx(px)(e)}const _x={ctx_execute:!0,ctx_batch_execute:!0};function vx(e,t){return _x[e]?e!==`ctx_execute`||t.language===`shell`:!1}function yx(e,t){if(vx(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e&&`command`in e&&typeof e.command==`string`?e.command:``).filter(e=>typeof e==`string`).join(`
21
- `)}}const bx=/#[0-9a-fA-F]{4}$/u,xx=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,Sx=/^\*\*\* Move to:\s*(.+)$/,Cx={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function wx(e){let t=e.trim(),n=bx.exec(t)?.index,r=n===void 0?t:t.slice(0,n);if(r.length<2)return r;let i=r[0],a=r[r.length-1];return(i===`"`||i===`'`)&&i===a?r.slice(1,-1):r}function Tx(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=wx(t.slice(1,n));return r.length>0?r:void 0}function Ex(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
22
- `)){let n=Tx(e);if(n!==void 0){t.push(n),r=!0;continue}let i=xx.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=Sx.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=wx(o.slice(3));e.length>0&&t.push(e)}}return t}function Dx(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function Ox(e,t){if(Cx[e]!==!0)return[];let n=t.input,r=typeof n==`string`?Ex(n):[];if(r.length>0)return Array.from(new Set(r));let i=Dx(t,`file_path`)??Dx(t,`path`);return i===void 0?[]:[i]}const kx=new Map;function Ax(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=kx.get(n);if(r!==void 0)return r===!0||r.test(e);let i=jx(n);return kx.size>=256&&kx.clear(),kx.set(n,i),i===!0||i.test(e)}function jx(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const Mx=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,Nx=/\$\(|`|\$\{?\w/,Px=/\$\(([^()]*)\)|`([^`]*)`/g,Fx=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,Ix=/&&|\|\||[;|]/,Lx=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Rx(e,t,n,r){let i=Mx.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?zx(o,n.command):Ux(o,n.file_path,r)}function zx(e,t){if(typeof t!=`string`)return!0;let n=Bx(t);return n.length===0||n.some(t=>Hx(e,t))?!0:Vx(e)&&Nx.test(t)}function Bx(e){let t=[...e.matchAll(Px)].map(e=>e[1]??e[2]??``);return[e.replace(Px,` `),...t].flatMap(e=>e.split(Ix)).map(e=>e.trim().replace(Fx,``)).filter(e=>e.length>0)}function Vx(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function Hx(e,t){return RegExp(`^${e.split(`*`).map(Lx).join(`.*`)}$`).test(t)}function Ux(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:Wx(r);return RegExp(`^${Gx(i)}$`).test(a)}const Wx=e=>e.slice(e.lastIndexOf(`/`)+1);function Gx(e){let t=Kx(e);return e.endsWith(`/**`)?`(?:${Kx(e.slice(0,-3))}|${t})`:t}function Kx(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:Lx(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function qx(e){return{session_id:e(),agent_id:null}}const Jx=Ag({key:q,value:ng(q)}).pipe(Mg(`TomlConfig`));X(q,Ch(Jx),{strict:!0,decode:e=>lm({try:()=>gx(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Jx)(e))),encode:(e,t,n)=>cm(new im(n,e,`TomlConfigFromText is decode-only`))});const Yx=`systemfsoftware.toml`,Xx=Om(Jx)({});var Zx=class extends Lt(`@systemfsoftware/omp-utils/toml-loader.adapter/TomlLoader`)(){};const Qx=e=>{let t={};for(let n of e)for(let[e,r]of Object.entries(n))t[e]=r;return t},$x=e=>lm({try:()=>gx(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Jx)(e))),eS=(e,t,n)=>e.exists(n).pipe(M(t=>t?e.readFileString(n).pipe(M($x),Hr(()=>Xx)):k(Xx))),tS=qc(Zx,M(mr(()=>{let e=process.env.OMP_USER_CONFIG_HOME;return typeof e==`string`&&e.length>0?e:Mi.homedir()}),e=>Rn(function*(){let t=yield*zn(qn()),n=yield*Py,r=yield*rb,i=r.join(e,`.config/systemfsoftware`,Yx);return Zx.of({load:mn(`TomlLoader.load`)(function*(e){let a=hn(yield*bn(t),e);if(Ae(a))return a.value;let o=r.join(e,Yx),s=r.join(e,`systemfsoftware.local.toml`),c=yield*eS(n,r,i),l=yield*eS(n,r,o),u=yield*eS(n,r,s),d=yield*Eh(Jx)(Qx([c,l,u])).pipe(wn);return yield*Nn(t,t=>(ei(t,e,d),t)),d})})}))),nS={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},rS={Edit:!0,MultiEdit:!0,Update:!0},iS=Am(ng(Eg({old_text:bg(Bh),new_text:bg(Bh)}).pipe(Y(e=>`old_text`in e||`new_text`in e))).pipe(mv(1))),aS=(e,t)=>{let n=e.split(`
23
- `).filter(e=>e.startsWith(t));return n.length===0?void 0:n.map(e=>e.slice(t.length)).join(`
24
- `)};function oS(e,t){let n=t;if(nS[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(rS[e]===!0&&`edits`in n&&iS(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
25
- `),new_string:e.map(e=>e.new_string).join(`
26
- `)}}if(rS[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=aS(n.input,`+`),t=aS(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const sS=Am(ng(Eg({old_string:bg(Bh),new_string:bg(Bh)}).pipe(Y(e=>`old_string`in e||`new_string`in e)))),cS=Cm(Ag({key:q,value:Bh}));function lS(e,t){let n=De(cS(t));if(n===null)return{};let r=`file_path`in e||!(`path`in e)?`file_path`:`path`,i={};for(let[t,a]of Object.entries(n)){if(t===`file_path`){i[r]=a;continue}if(!((t===`old_string`||t===`new_string`)&&!(t in e))){if(t===`edits`&&sS(a)&&iS(e.edits)){i.edits=a.map(e=>({old_text:typeof e.old_string==`string`?e.old_string:``,new_text:typeof e.new_string==`string`?e.new_string:``}));continue}i[t]=a}}return i}const uS={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function dS(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=uS[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{bg as $,gy as A,Uh as B,Dy as C,py as D,fy as E,xy as F,q as G,zh as H,ay as I,Uv as J,Eg as K,oy as L,vy as M,yy as N,my as O,by as P,Th as Q,cy as R,Ty as S,Sy as T,J as U,Ah as V,Ag as W,Bh as X,Kh as Y,wh as Z,Vy as _,Jc as _t,yx as a,Sm as at,zy as b,Kc as bt,oS as c,W as ct,rb as d,jp as dt,xg as et,ib as f,Mp as ft,Ny as g,qc as gt,Iy as h,Fp as ht,Ox as i,Cm as it,_y as j,hy as k,dS as l,kp as lt,Py as m,Pp as mt,tS as n,X as nt,Ax as o,jm as ot,Ly as p,Np as pt,Hv as q,lS as r,im as rt,Rx as s,cm as st,Zx as t,v_ as tt,qx as u,Ap as ut,Ry as v,Zc as vt,uy as w,Fy as x,By as y,Yc as yt,ng as z};