@shivaedev/create-app 0.13.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +2 -0
- package/dist/cli.js +70 -70
- package/dist/createApp.d.ts +1 -0
- package/dist/createApp.d.ts.map +1 -1
- package/dist/createApp.js +3 -2
- package/dist/createApp.js.map +1 -1
- package/dist/generation.d.ts +2 -0
- package/dist/generation.d.ts.map +1 -1
- package/dist/generation.js +1 -1
- package/dist/generation.js.map +1 -1
- package/dist/template.d.ts +1 -0
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js +17 -0
- package/dist/template.js.map +1 -1
- package/dist/updateApp.d.ts.map +1 -1
- package/dist/updateApp.js +2 -1
- package/dist/updateApp.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +7 -3
- package/src/createApp.ts +4 -3
- package/src/generation.ts +1 -1
- package/src/template.ts +19 -0
- package/src/updateApp.ts +8 -1
- package/template.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var XV=Object.defineProperty;var $n=(e,t)=>{for(var r in t)XV(e,r,{get:t[r],enumerable:!0})};import{fileURLToPath as KV}from"node:url";var Vc={};$n(Vc,{defaultTeardown:()=>$$,errorExitCode:()=>gd,errorReported:()=>Mi,getErrorExitCode:()=>N$,getErrorReported:()=>U$,makeRunMain:()=>hC});var ne=(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 r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},ab={pipe(){return ne(this,arguments)}},ii=(function(){function e(){}return e.prototype=ab,e})();var l=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(o){return t(o,r)}};case 3:return function(r,n,o){return arguments.length>=3?t(r,n,o):function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var D=e=>e;var ct=e=>()=>e,sn=ct(!0),Ql=ct(!1),ib=ct(null),ao=ct(void 0),yn=ao;function Is(e,...t){return ne(e,t)}function RO(e,t,r,n,o,s,a,i,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return i(a(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(i(a(s(o(n(r(t(e.apply(this,arguments)))))))))}}}function No(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function lc(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o!==r&&t.set(o,o),o}}var Yl=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");let r=Object.getPrototypeOf(e),n=r;for(;n!==null&&n!==Object.prototype;){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}return t.has("constructor")&&typeof e.constructor=="function"&&r===e.constructor.prototype&&t.delete("constructor"),t},Gu=new WeakSet,Xl=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var pc=0,$O=()=>{pc++};function Nn(e){return typeof e=="string"}function ep(e){return typeof e=="number"}function Eh(e){return typeof e=="boolean"}function NO(e){return typeof e=="bigint"}function cb(e){return typeof e=="symbol"}function bh(e){return Nn(e)||ep(e)||cb(e)}function Un(e){return typeof e=="function"}function ci(e){return e===void 0}function Tt(e){return e!==void 0}function tp(e){return e!==null}function UO(e){return e==null}function Ih(e){return e!=null}function DO(e){return!1}function ub(e){return!0}function Dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rp(e){return typeof e=="object"&&e!==null||Un(e)}var O=l(2,(e,t)=>rp(e)&&t in e),mr=l(2,(e,t)=>O(e,"_tag")&&e._tag===t);function LO(e){return e instanceof Error}function Cs(e){return O(e,Symbol.iterator)||Nn(e)}var ae="~effect/Hash",Y=e=>{switch(typeof e){case"number":return Wt(e);case"bigint":return De(e.toString(10));case"string":return De(e);case"function":case"object":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?De("Invalid Date"):De(e.toISOString());if(e instanceof RegExp)return De(e.toString());{if(Gu.has(e))return BO(e);let t=zO.get(e);if(t!==void 0)return t;if(pb.has(e))return $O(),De("[Circular]");pb.add(e);let r=pc,n;try{ae in e?n=e[ae]():typeof e=="function"?n=BO(e):e instanceof DataView?n=ws(Xl(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=ws(e):e instanceof Map?n=e4(e):e instanceof Set?n=t4(e):n=op(e)}finally{pb.delete(e)}return r===pc&&zO.set(e,n),n}}}return Er(HO(De(String(e))))},BO=e=>(lb.has(e)||lb.set(e,Er(Math.random()*4294967296|0)),lb.get(e)),HO=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),xe=l(2,(e,t)=>HO(Math.imul(e,2654435761)+Math.imul(t,2246822507))),Er=e=>e&3221225471|e>>>1&1073741824;var fb=new DataView(new ArrayBuffer(8)),Wt=e=>{let t=e|0;return t===e?Er(t):(fb.setFloat64(0,e!==e?NaN:e),Er(xe(fb.getInt32(0),fb.getInt32(4))))},De=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return Er(t)},np=(e,t)=>{let r=12289;for(let n of t)r^=xe(Y(n),Y(e[n]));return Er(r)},op=e=>np(e,Yl(e)),qO=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return Er(n)},ws=e=>{let t=6151;for(let r of e)t=xe(t,Y(r));return Er(t)},e4=qO(De("Map"),([e,t])=>xe(Y(e),Y(t))),jO=De("Set"),t4=qO(jO,e=>xe(jO,Y(e))),lb=new WeakMap,zO=new WeakMap,pb=new WeakSet;var ie="~effect/Equal";function Z(){return arguments.length===1?e=>dc(e,arguments[0]):dc(arguments[0],arguments[1])}function dc(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;return r!==typeof t?!1:r==="number"&&e!==e&&t!==t?!0:r!=="object"&&r!=="function"||Gu.has(e)||Gu.has(t)?!1:r4(e,t)}function r4(e,t){let r=Ch.length;for(let s=r;s-- >0;)if(Ch[s]===e&&db[s]===t)return!0;if(r)return WO(e,t);let n=VO.get(e);n||VO.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=WO(e,t)),o}function WO(e,t){Ch.push(e),db.push(t);try{return n4(e,t)}finally{Ch.pop(),db.pop()}}var Ch=[],db=[],VO=new WeakMap;function n4(e,t){if(Y(e)!==Y(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let r=KO(e);if(r!==KO(t)||typeof e=="function"&&!r)return!1;if(r)return e[ie](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:o4(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?GO(Xl(e),Xl(t)):GO(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:mb(e,t,a4,i4);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:mb(e,t,Y,dc)}return s4(e,t)}function o4(e,t){for(let r=0;r<e.length;r++)if(!dc(e[r],t[r]))return!1;return!0}function GO(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function s4(e,t){let r=Yl(e),n=Yl(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!dc(e[o],t[o]))return!1;return!0}function mb(e,t,r,n){let o=new Map,s=0;for(let a of t){let i=r(a),c=o.get(i);c?c.push(a):o.set(i,[a]),s++}e:for(let a of e){let i=o.get(r(a));if(i){for(let c=0;c<i.length;c++)if(n(a,i[c])){i[c]=i[i.length-1],i.pop(),s--;continue e}}return!1}return s===0}var a4=e=>Y(e[0]),i4=(e,t)=>dc(e[0],t[0])&&dc(e[1],t[1]),c4=()=>0;function wh(e,t){return sp((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function sp(e){return function(r,n){return mb(r,n,c4,e)}}var KO=e=>O(e,ie),ap=()=>Z;var JO=e=>(Gu.add(e),e);var pa=Symbol.for("~effect/Redactable"),u4=e=>O(e,pa);function Uo(e){return u4(e)?hb(e):e}function hb(e){return e[pa](globalThis[mc]?.context??f4)}var mc="~effect/Fiber/currentFiber",ZO=new Map,f4={"~effect/Context":{},base:ZO,depth:0,mapUnsafe:ZO,pipe(){return ne(this,arguments)}};function j(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r=="number"?" ".repeat(r):r:"",s=f=>o.repeat(f),a=(f,p)=>{let d=f?.constructor;return d&&d!==Object.prototype.constructor&&d.name?`${d.name}(${p})`:p},i=f=>{try{return Reflect.ownKeys(f)}catch{return["[ownKeys threw]"]}};function c(f,p=0){try{return u(f,p)}catch{return(typeof f=="object"&&f!==null||typeof f=="function")&&n.delete(f),"[inspection threw]"}}function u(f,p=0){if(typeof f=="string")return JSON.stringify(f);if(typeof f=="number"||f==null||typeof f=="boolean"||typeof f=="symbol")return String(f);if(typeof f=="bigint")return String(f)+"n";if(typeof f=="object"||typeof f=="function"){if(n.has(f))return l4;n.add(f);let d;if(pa in f)d=c(hb(f),p);else if(Array.isArray(f))d=!o||f.length<=1?`[${f.map(m=>c(m,p)).join(",")}]`:`[
|
|
3
3
|
${s(p+1)}${f.map(m=>c(m,p+1)).join(`,
|
|
4
4
|
`+s(p+1))}
|
|
5
|
-
${s(p)}]`;else if(f instanceof Date)d=
|
|
6
|
-
${m.map(y=>`${s(p+1)}${Ts(y)}: ${c(
|
|
5
|
+
${s(p)}]`;else if(f instanceof Date)d=xb(f);else if(!t?.ignoreToString&&O(f,"toString")&&typeof f.toString=="function"&&f.toString!==Object.prototype.toString&&f.toString!==Array.prototype.toString){let m=p4(f);d=f instanceof Error&&f.cause!==void 0?`${m} (cause: ${c(f.cause,p)})`:m}else if(Symbol.iterator in f)d=`${f.constructor.name}(${c(Array.from(f),p)})`;else{let m=i(f);if(!o||m.length<=1){let x=`{${m.map(y=>`${Ts(y)}:${c(QO(f,y),p)}`).join(",")}}`;d=a(f,x)}else{let x=`{
|
|
6
|
+
${m.map(y=>`${s(p+1)}${Ts(y)}: ${c(QO(f,y),p+1)}`).join(`,
|
|
7
7
|
`)}
|
|
8
|
-
${s(p)}}`;d=a(f,x)}}return n.delete(f),d}return String(f)}return c(e,0)}var u4="[Circular]";function Ts(e){return typeof e=="string"?JSON.stringify(e):String(e)}function wh(e){return e.map(t=>`[${Ts(t)}]`).join("")}function gb(e){try{return e.toISOString()}catch{return"Invalid Date"}}function f4(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function ZO(e,t){try{return e[t]}catch{return"[property access threw]"}}function mc(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=O(s,pa)?Uo(s):Uo(o);if(typeof a=="bigint")return j(a);if(typeof a!="object"||a===null)return a;let i=a instanceof Error&&!O(a,"toJSON")?{...a,name:a.name,message:a.message}:a;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(a))return;if(r.push(a),i!==a&&r.push(i),!l4(i)||p4(i))return i;let c=new Proxy(i,{get(u,f){let p=Reflect.get(u,f,u);return Object.getOwnPropertyDescriptor(u,f)?.get!==void 0?Uo(p):p}});return r.push(c),c},t?.space)??"null"}function l4(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function p4(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var ot=Symbol.for("nodejs.util.inspect.custom"),er=e=>{try{return e=Uo(e),O(e,"toJSON")&&Un(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(er):e}catch{return"[toJSON threw]"}},YO=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?mc(e,{space:t}):j(e,{space:t})}catch{return String(e)}},Pt={toJSON(){return er(this)},[ot](){return this.toJSON()},toString(){return j(this.toJSON())}},QO=class{[ot](){return this.toJSON()}toString(){return j(this.toJSON())}};var m4=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},h4=m4(),Do=()=>Error.stackTraceLimit,br=e=>{h4&&(Error.stackTraceLimit=e)};var ci=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},g4=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Do();if(n===0)return r[e];br(2);let o=t[e](()=>new Error);return br(n),o.stack?.includes(e)===!0?t[e]:r[e]},ui=g4();function z(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function Th(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&z(e,r,t[r])}var vs="~effect/Effect",hc="~effect/Exit",y4={_A:D,_E:D,_R:D},xb=`${vs}/identifier`,ge=`${vs}/args`,ft=`${vs}/evaluate`,tr=`${vs}/successCont`,Ln=`${vs}/failureCont`,gc=`${vs}/ensureCont`,Sc=Symbol.for("effect/Effect/Yield"),Nr={pipe(){return ne(this,arguments)},toJSON(){return{...this}},toString(){return j(this.toJSON(),{ignoreToString:!0,space:2})},[ot](){return this.toJSON()}},e_={[ae](){return np(this,Object.keys(this))},[ie](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!Z(this[t[n]],e[t[n]]))return!1;return!0}},S4={[vs]:y4,...Nr,[Symbol.iterator](){return new ci(this)},toJSON(){return{_id:"Effect",op:this[xb],...ge in this?{args:this[ge]}:void 0}}},de=e=>O(e,vs),up=e=>O(e,hc),kh="~effect/Cause",ip="~effect/Cause/Reason",Ju=e=>O(e,kh),t_=e=>O(e,ip),Lo=class{constructor(t){this[kh]=kh,this.reasons=t}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${j(this.reasons)})`}[ot](){return this.toJSON()}[ie](t){return Ju(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>Z(r,t.reasons[n]))}[ae](){return ws(this.reasons)}},XO=new WeakMap,Gu=class{[ip];annotations;_tag;constructor(t,r,n){if(this[ip]=ip,this._tag=t,r!==fp&&typeof n=="object"&&n!==null&&r.size>0){let o=XO.get(n);o&&(r=new Map([...o,...r])),XO.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{r?.overwrite!==!0&&n.has(a)||n.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return ne(this,arguments)}toString(){return j(this)}[ot](){return this.toString()}},fp=new Map,xc=class extends Gu{constructor(t,r=fp){super("Fail",r,t),this.error=t}toString(){return`Fail(${j(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[ie](t){return Bo(t)&&Z(this.error,t.error)&&Z(this.annotations,t.annotations)}[ae](){return xe(De(this._tag))(xe(Y(this.error))(Y(this.annotations)))}},da=e=>new Lo(e),E4=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=Y(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>Z(i,o)))continue;a.push(o)}n.push(o)}return n},vh=l(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new Lo(E4(e.reasons,t.reasons));return Z(e,r)?e:r}),yb=(e,t)=>{let r=e.reasons.slice();for(let n of t.reasons)yc(n)&&!r.some(o=>yc(o)&&o.fiberId===n.fiberId&&o.annotations===n.annotations)&&r.push(n);return r.length===e.reasons.length?e:new Lo(r)},Sb=new Lo([]),Zu=e=>new Lo([new xc(e)]),cp=class extends Gu{constructor(t,r=fp){super("Die",r,t),this.defect=t}toString(){return`Die(${j(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[ie](t){return pp(t)&&Z(this.defect,t.defect)&&Z(this.annotations,t.annotations)}[ae](){return xe(De(this._tag))(xe(Y(this.defect))(Y(this.annotations)))}},Eb=e=>new Lo([new cp(e)]),lp=l(e=>Ju(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new Lo(e.reasons.map(n=>n.annotate(t,r)))),Bo=e=>e._tag==="Fail",pp=e=>e._tag==="Die",yc=e=>e._tag==="Interrupt";function b4(e){return an("Effect.evaluate: Not implemented")}var Bn=e=>({...S4,[xb]:e.op,[ft]:e[ft]??b4,[tr]:e[tr],[Ln]:e[Ln],[gc]:e[gc]}),io=e=>{let t=Bn(e),r=function(n){this[ge]=n};return r.prototype=t,function(n){return new r(n)}},r_=e=>{let t={[hc]:hc,_tag:e.op,get[e.prop](){return this[ge]},...Bn(e),toString(){return`${e.op}(${j(this[ge])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ge]}},[ie](n){return up(n)&&n._tag===this._tag&&Z(this[ge],n[ge])},[ae](){return xe(De(e.op),Y(this[ge]))}},r=function(n){this[ge]=n};return r.prototype=t,function(n){return new r(n)}},Me=r_({op:"Success",prop:"value",[ft](e){let t=e.getCont(tr);return t?t[tr](this[ge],e,this):e.yieldWith(this)}}),Oh={key:"effect/Cause/StackTrace"},bb={key:"effect/Cause/InterruptorStackTrace"},Ir=r_({op:"Failure",prop:"cause",[ft](e){let t=this[ge],r=!1;e.cache.stackFrame&&(t=lp(t,{mapUnsafe:new Map([[Oh.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(Ln),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=xb in n,n=e.getCont(Ln);s&&(t=da(t.reasons.filter(a=>a._tag!=="Fail"))),t=yb(t,o),r=!0}return n?n[Ln](t,e,r?void 0:this):e.yieldWith(r?Ir(t):this)}}),jn=e=>Ir(Zu(e)),an=e=>Ir(Eb(e)),ue=io({op:"WithFiber",[ft](e){return this[ge](e)}}),n_=io({op:"WithFiberSucceed",[ft](e){let t=this[ge](e),r=e.getCont(tr);return r?r[tr](t,e):e.yieldWith(Me(t))}}),I4=(function(){class e extends globalThis.Error{}let t=Bn({op:"YieldableError",[ft](){return jn(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),dp=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends I4{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Th(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),ma=e=>{class t extends dp{_tag=e}return t.prototype.name=e,t},Ah="~effect/Cause/NoSuchElementError",Ib=e=>O(e,Ah),As=class extends ma("NoSuchElementError"){[Ah]=Ah;constructor(t){super({message:t})}},Ku="~effect/Cause/Done",o_=e=>O(e,Ku),s_={[Ku]:Ku,_tag:"Done",value:void 0},Ec=e=>e===void 0?s_:{[Ku]:Ku,_tag:"Done",value:e},C4=jn(s_),a_=e=>e===void 0?C4:jn(Ec(e));var Os=e=>Bn({op:e.label,[ft]:e.evaluate});var Ce={};$n(Ce,{Do:()=>rG,all:()=>W4,andThen:()=>L4,as:()=>C_,asVoid:()=>U4,bind:()=>tG,bindTo:()=>X4,composeK:()=>H4,contains:()=>Y4,containsWith:()=>v_,exists:()=>Fb,filter:()=>Ic,filterMap:()=>K4,firstSomeOf:()=>$4,flatMap:()=>Ps,flatMapNullishOr:()=>B4,flatten:()=>bc,fromIterable:()=>P4,fromNullOr:()=>Ob,fromNullishOr:()=>uo,fromUndefinedOr:()=>ga,gen:()=>nG,getFailure:()=>F4,getOrElse:()=>Ft,getOrNull:()=>zh,getOrThrow:()=>_b,getOrThrowWith:()=>Hh,getOrUndefined:()=>Cr,getSuccess:()=>I_,isNone:()=>me,isOption:()=>of,isSome:()=>fe,let:()=>eG,lift2:()=>Q4,liftNullishOr:()=>N4,liftPredicate:()=>Pb,liftThrowable:()=>jo,makeCombinerFailFast:()=>O_,makeEquivalence:()=>J4,makeOrder:()=>Z4,makeReducer:()=>oG,makeReducerFailFast:()=>sG,map:()=>rr,match:()=>Le,none:()=>A,orElse:()=>vb,orElseResult:()=>M4,orElseSome:()=>R4,partitionMap:()=>G4,product:()=>T_,productMany:()=>q4,reduceCompact:()=>V4,some:()=>v,tap:()=>w_,toArray:()=>A_,toRefinement:()=>_4,void:()=>D4,zipLeft:()=>z4,zipRight:()=>j4,zipWith:()=>k_});function i_(e){return{combine:e}}function Cb(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Ur=e=>(t,r)=>t===r||e(t,r),w4=(e,t)=>e===t,Yu=()=>w4;function f_(e){return Ur((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function _h(e){return Ur((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var Ph=e=>l(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Fh=e=>l(2,(t,r)=>e(t,n=>({[r]:n}))),Rh=(e,t)=>l(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var p_="~effect/Option",d_={[p_]:{_A:e=>e},...Nr,[Symbol.iterator](){return new ci(this)}},T4=Object.defineProperty(Object.assign(Object.create(d_),{_tag:"Some",_op:"Some",[ie](e){return Mh(e)&&wb(e)&&Z(this.value,e.value)},[ae](){return xe(Y(this._tag))(Y(this.value))},toString(){return`some(${j(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:er(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),k4=Y("None"),A4=Object.assign(Object.create(d_),{_tag:"None",_op:"None",valueOrUndefined:void 0,[ie](e){return Mh(e)&&$h(e)},[ae](){return k4},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Mh=e=>O(e,p_),$h=e=>e._tag==="None",wb=e=>e._tag==="Some",mp=Object.create(A4),m_=function(e){this.value=e};m_.prototype=T4;var hp=e=>new m_(e);var g_="~effect/Result",x_={[g_]:{_A:e=>e,_E:e=>e},...Nr,[Symbol.iterator](){return new ci(this)}},v4=Object.assign(Object.create(x_),{_tag:"Success",_op:"Success",[ie](e){return Nh(e)&&ef(e)&&Z(this.success,e.success)},[ae](){return xe(Y(this._tag))(Y(this.success))},toString(){return`success(${j(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:er(this.success)}}}),O4=Object.assign(Object.create(x_),{_tag:"Failure",_op:"Failure",[ie](e){return Nh(e)&&Xu(e)&&Z(this.failure,e.failure)},[ae](){return xe(Y(this._tag))(Y(this.failure))},toString(){return`failure(${j(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:er(this.failure)}}}),Nh=e=>O(e,g_),Xu=e=>e._tag==="Failure",ef=e=>e._tag==="Success",y_=function(e){this.failure=e};y_.prototype=O4;var Uh=e=>new y_(e),S_=function(e){this.success=e};S_.prototype=v4;var Dh=e=>new S_(e),Tb=e=>ef(e)?mp:hp(e.failure),kb=e=>Xu(e)?mp:hp(e.success);function fi(e){return(t,r)=>t===r?0:e(t,r)}var b_=fi((e,t)=>e<t?-1:1),ha=fi((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var tf=fi((e,t)=>e<t?-1:1);var Ab=l(2,(e,t)=>fi((r,n)=>e(t(r),t(n)))),rf=Ab(ha,e=>e.getTime());var Lh=e=>l(2,(t,r)=>e(t,r)===-1),nf=e=>l(2,(t,r)=>e(t,r)===1),Bh=e=>l(2,(t,r)=>e(t,r)!==1),jh=e=>l(2,(t,r)=>e(t,r)!==-1);var A=()=>mp,v=hp,of=Mh,me=$h,fe=wb,Le=l(2,(e,{onNone:t,onSome:r})=>me(e)?t():r(e.value)),_4=e=>t=>fe(e(t)),P4=e=>{for(let t of e)return v(t);return A()},I_=kb,F4=Tb,Ft=l(2,(e,t)=>me(e)?t():e.value),vb=l(2,(e,t)=>me(e)?t():e),R4=l(2,(e,t)=>me(e)?v(t()):e),M4=l(2,(e,t)=>me(e)?rr(t(),Dh):rr(e,Uh)),$4=e=>{let t=A();for(t of e)if(fe(t))return t;return t},uo=e=>e==null?A():v(e),ga=e=>e===void 0?A():v(e),Ob=e=>e===null?A():v(e),N4=e=>(...t)=>uo(e(...t)),zh=Ft(ab),Cr=Ft(ao),jo=e=>(...t)=>{try{return v(e(...t))}catch{return A()}},Hh=l(2,(e,t)=>{if(fe(e))return e.value;throw t()}),_b=Hh(()=>new Error("getOrThrow called on a None")),rr=l(2,(e,t)=>me(e)?A():v(t(e.value))),C_=l(2,(e,t)=>rr(e,()=>t)),U4=C_(void 0),D4=v(void 0);var Ps=l(2,(e,t)=>me(e)?A():t(e.value)),L4=l(2,(e,t)=>Ps(e,r=>{let n=Un(t)?t(r):t;return of(n)?n:v(n)})),B4=l(2,(e,t)=>me(e)?A():uo(t(e.value))),bc=Ps(D),j4=l(2,(e,t)=>Ps(e,()=>t)),z4=l(2,(e,t)=>w_(e,()=>t)),H4=l(2,(e,t)=>r=>Ps(e(r),t)),w_=l(2,(e,t)=>Ps(e,r=>rr(t(r),()=>r))),T_=l(2,(e,t)=>fe(e)&&fe(t)?v([e.value,t.value]):A()),q4=l(2,(e,t)=>{if(me(e))return A();let r=[e.value];for(let n of t){if(me(n))return A();r.push(n.value)}return v(r)}),W4=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(me(n))return A();r.push(n.value)}return v(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(me(n))return A();z(t,r,n.value)}return v(t)},k_=l(3,(e,t,r)=>rr(T_(e,t),([n,o])=>r(n,o))),V4=l(3,(e,t,r)=>{let n=t;for(let o of e)fe(o)&&(n=r(n,o.value));return n}),A_=e=>me(e)?[]:[e.value],G4=l(2,(e,t)=>{if(me(e))return[A(),A()];let r=t(e.value);return Xu(r)?[A(),v(r.failure)]:[v(r.success),A()]}),K4=l(2,(e,t)=>{if(me(e))return A();let r=t(e.value);return ef(r)?v(r.success):A()}),Ic=l(2,(e,t)=>me(e)?A():t(e.value)?v(e.value):A()),J4=e=>Ur((t,r)=>me(t)?me(r):me(r)?!1:e(t.value,r.value)),Z4=e=>fi((t,r)=>fe(t)?fe(r)?e(t.value,r.value):1:-1),Q4=e=>l(2,(t,r)=>k_(t,r,e)),Pb=l(2,(e,t)=>t(e)?v(e):A()),v_=e=>l(2,(t,r)=>me(t)?!1:e(t.value,r)),Y4=v_(ap()),Fb=l(2,(e,t)=>me(e)?!1:t(e.value)),X4=Fh(rr),eG=Ph(rr);var tG=Rh(rr,Ps),rG=v({}),nG=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(me(o))return o;n=r.next(o.value)}return v(n.value)};function oG(e){return Cb((t,r)=>me(t)?r:me(r)?t:v(e.combine(t.value,r.value)),A())}function O_(e){return i_((t,r)=>me(t)||me(r)?A():v(e.combine(t.value,r.value)))}function sG(e){let t=O_(e).combine,r=v(e.initialValue);return Cb(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),me(o))return o;return o})}var __="~effect/Context/Service",gt=function(){function e(){}let t=e;Object.setPrototypeOf(t,aG);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[Mb]=Mb,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&P_.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},aG={[__]:__,...Os({label:"Service",evaluate(e){return Me($e(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return xa(this,e)},use(e){return ue(t=>e($e(t.context,this)))},useSync(e){return ue(t=>Me(e($e(t.context,this))))}},P_=new Set,Mb="~effect/Context/Reference",F_="~effect/Context",iG=8,cG=8,$b=(e,t,r,n)=>{let o=Object.create(fG);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},Nb=(e,t)=>{t&&(Nb(e,t.parent),e.set(t.key,t.value))},R_=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Nb(t,e.overlay),e._flat=t},uG=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),li(r)},qh=Symbol(),Ub=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?qh:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=cG&&(r.base=R_(r),r.overlay=void 0,r.depth=0),n)},li=e=>$b(void 0,e,void 0,0),fG={get mapUnsafe(){return R_(this)},...Nr,[F_]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ie](e){if(!xp(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!Z(o,r.get(n)))return!1;return!0},[ae](){return Wt(this.mapUnsafe.size)}},M_=(e,t)=>e.cacheRoot===t.cacheRoot,xp=e=>O(e,F_);var $_=e=>!!e[Mb],nr=()=>lG,lG=li(new Map),xa=(e,t)=>li(new Map([[e.key,t]])),or=l(3,(e,t,r)=>pG(e,t.key,r)),pG=(e,t,r)=>{let n=e,o=P_.has(t)?void 0:n.cacheRoot;if(n.depth>=iG){let s=new Map(n._flat??n.base);return n._flat||Nb(s,n.overlay),s.set(t,r),$b(o,s,void 0,0)}return $b(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Wh=l(2,(e,t)=>yp(e,t.key)),yp=(e,t)=>{let r=Ub(e,t);return r===qh?void 0:r},fo=l(2,(e,t)=>{let r=Ub(e,t.key);if(r===qh){if($_(t))return N_(t);throw dG(t)}return r}),$e=fo,Rb="~effect/Context/defaultValue",N_=e=>Rb in e?e[Rb]:e[Rb]=e.defaultValue(),dG=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
8
|
+
${s(p)}}`;d=a(f,x)}}return n.delete(f),d}return String(f)}return c(e,0)}var l4="[Circular]";function Ts(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Th(e){return e.map(t=>`[${Ts(t)}]`).join("")}function xb(e){try{return e.toISOString()}catch{return"Invalid Date"}}function p4(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function QO(e,t){try{return e[t]}catch{return"[property access threw]"}}function hc(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=O(s,pa)?Uo(s):Uo(o);if(typeof a=="bigint")return j(a);if(typeof a!="object"||a===null)return a;let i=a instanceof Error&&!O(a,"toJSON")?{...a,name:a.name,message:a.message}:a;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(a))return;if(r.push(a),i!==a&&r.push(i),!d4(i)||m4(i))return i;let c=new Proxy(i,{get(u,f){let p=Reflect.get(u,f,u);return Object.getOwnPropertyDescriptor(u,f)?.get!==void 0?Uo(p):p}});return r.push(c),c},t?.space)??"null"}function d4(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function m4(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var ot=Symbol.for("nodejs.util.inspect.custom"),er=e=>{try{return e=Uo(e),O(e,"toJSON")&&Un(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(er):e}catch{return"[toJSON threw]"}},XO=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?hc(e,{space:t}):j(e,{space:t})}catch{return String(e)}},Pt={toJSON(){return er(this)},[ot](){return this.toJSON()},toString(){return j(this.toJSON())}},YO=class{[ot](){return this.toJSON()}toString(){return j(this.toJSON())}};var g4=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},x4=g4(),Do=()=>Error.stackTraceLimit,br=e=>{x4&&(Error.stackTraceLimit=e)};var ui=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},y4=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Do();if(n===0)return r[e];br(2);let o=t[e](()=>new Error);return br(n),o.stack?.includes(e)===!0?t[e]:r[e]},fi=y4();function z(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function kh(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&z(e,r,t[r])}var vs="~effect/Effect",gc="~effect/Exit",E4={_A:D,_E:D,_R:D},yb=`${vs}/identifier`,ge=`${vs}/args`,ft=`${vs}/evaluate`,tr=`${vs}/successCont`,Ln=`${vs}/failureCont`,xc=`${vs}/ensureCont`,Ec=Symbol.for("effect/Effect/Yield"),Nr={pipe(){return ne(this,arguments)},toJSON(){return{...this}},toString(){return j(this.toJSON(),{ignoreToString:!0,space:2})},[ot](){return this.toJSON()}},t_={[ae](){return np(this,Object.keys(this))},[ie](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!Z(this[t[n]],e[t[n]]))return!1;return!0}},b4={[vs]:E4,...Nr,[Symbol.iterator](){return new ui(this)},toJSON(){return{_id:"Effect",op:this[yb],...ge in this?{args:this[ge]}:void 0}}},de=e=>O(e,vs),up=e=>O(e,gc),Ah="~effect/Cause",ip="~effect/Cause/Reason",Zu=e=>O(e,Ah),r_=e=>O(e,ip),Lo=class{constructor(t){this[Ah]=Ah,this.reasons=t}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${j(this.reasons)})`}[ot](){return this.toJSON()}[ie](t){return Zu(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>Z(r,t.reasons[n]))}[ae](){return ws(this.reasons)}},e_=new WeakMap,Ku=class{[ip];annotations;_tag;constructor(t,r,n){if(this[ip]=ip,this._tag=t,r!==fp&&typeof n=="object"&&n!==null&&r.size>0){let o=e_.get(n);o&&(r=new Map([...o,...r])),e_.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{r?.overwrite!==!0&&n.has(a)||n.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return ne(this,arguments)}toString(){return j(this)}[ot](){return this.toString()}},fp=new Map,yc=class extends Ku{constructor(t,r=fp){super("Fail",r,t),this.error=t}toString(){return`Fail(${j(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[ie](t){return Bo(t)&&Z(this.error,t.error)&&Z(this.annotations,t.annotations)}[ae](){return xe(De(this._tag))(xe(Y(this.error))(Y(this.annotations)))}},da=e=>new Lo(e),I4=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=Y(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>Z(i,o)))continue;a.push(o)}n.push(o)}return n},Oh=l(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new Lo(I4(e.reasons,t.reasons));return Z(e,r)?e:r}),Sb=(e,t)=>{let r=e.reasons.slice();for(let n of t.reasons)Sc(n)&&!r.some(o=>Sc(o)&&o.fiberId===n.fiberId&&o.annotations===n.annotations)&&r.push(n);return r.length===e.reasons.length?e:new Lo(r)},Eb=new Lo([]),Qu=e=>new Lo([new yc(e)]),cp=class extends Ku{constructor(t,r=fp){super("Die",r,t),this.defect=t}toString(){return`Die(${j(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[ie](t){return pp(t)&&Z(this.defect,t.defect)&&Z(this.annotations,t.annotations)}[ae](){return xe(De(this._tag))(xe(Y(this.defect))(Y(this.annotations)))}},bb=e=>new Lo([new cp(e)]),lp=l(e=>Zu(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new Lo(e.reasons.map(n=>n.annotate(t,r)))),Bo=e=>e._tag==="Fail",pp=e=>e._tag==="Die",Sc=e=>e._tag==="Interrupt";function C4(e){return an("Effect.evaluate: Not implemented")}var Bn=e=>({...b4,[yb]:e.op,[ft]:e[ft]??C4,[tr]:e[tr],[Ln]:e[Ln],[xc]:e[xc]}),io=e=>{let t=Bn(e),r=function(n){this[ge]=n};return r.prototype=t,function(n){return new r(n)}},n_=e=>{let t={[gc]:gc,_tag:e.op,get[e.prop](){return this[ge]},...Bn(e),toString(){return`${e.op}(${j(this[ge])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ge]}},[ie](n){return up(n)&&n._tag===this._tag&&Z(this[ge],n[ge])},[ae](){return xe(De(e.op),Y(this[ge]))}},r=function(n){this[ge]=n};return r.prototype=t,function(n){return new r(n)}},Me=n_({op:"Success",prop:"value",[ft](e){let t=e.getCont(tr);return t?t[tr](this[ge],e,this):e.yieldWith(this)}}),_h={key:"effect/Cause/StackTrace"},Ib={key:"effect/Cause/InterruptorStackTrace"},Ir=n_({op:"Failure",prop:"cause",[ft](e){let t=this[ge],r=!1;e.cache.stackFrame&&(t=lp(t,{mapUnsafe:new Map([[_h.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(Ln),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=yb in n,n=e.getCont(Ln);s&&(t=da(t.reasons.filter(a=>a._tag!=="Fail"))),t=Sb(t,o),r=!0}return n?n[Ln](t,e,r?void 0:this):e.yieldWith(r?Ir(t):this)}}),jn=e=>Ir(Qu(e)),an=e=>Ir(bb(e)),ue=io({op:"WithFiber",[ft](e){return this[ge](e)}}),o_=io({op:"WithFiberSucceed",[ft](e){let t=this[ge](e),r=e.getCont(tr);return r?r[tr](t,e):e.yieldWith(Me(t))}}),w4=(function(){class e extends globalThis.Error{}let t=Bn({op:"YieldableError",[ft](){return jn(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),dp=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends w4{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(kh(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),ma=e=>{class t extends dp{_tag=e}return t.prototype.name=e,t},vh="~effect/Cause/NoSuchElementError",Cb=e=>O(e,vh),As=class extends ma("NoSuchElementError"){[vh]=vh;constructor(t){super({message:t})}},Ju="~effect/Cause/Done",s_=e=>O(e,Ju),a_={[Ju]:Ju,_tag:"Done",value:void 0},bc=e=>e===void 0?a_:{[Ju]:Ju,_tag:"Done",value:e},T4=jn(a_),i_=e=>e===void 0?T4:jn(bc(e));var Os=e=>Bn({op:e.label,[ft]:e.evaluate});var we={};$n(we,{Do:()=>oG,all:()=>G4,andThen:()=>j4,as:()=>w_,asVoid:()=>L4,bind:()=>nG,bindTo:()=>tG,composeK:()=>W4,contains:()=>eG,containsWith:()=>O_,exists:()=>Rb,filter:()=>Cc,filterMap:()=>Z4,firstSomeOf:()=>U4,flatMap:()=>Ps,flatMapNullishOr:()=>z4,flatten:()=>Ic,fromIterable:()=>R4,fromNullOr:()=>_b,fromNullishOr:()=>uo,fromUndefinedOr:()=>ga,gen:()=>sG,getFailure:()=>M4,getOrElse:()=>Ft,getOrNull:()=>Hh,getOrThrow:()=>Pb,getOrThrowWith:()=>qh,getOrUndefined:()=>Cr,getSuccess:()=>C_,isNone:()=>me,isOption:()=>sf,isSome:()=>fe,let:()=>rG,lift2:()=>X4,liftNullishOr:()=>D4,liftPredicate:()=>Fb,liftThrowable:()=>jo,makeCombinerFailFast:()=>__,makeEquivalence:()=>Q4,makeOrder:()=>Y4,makeReducer:()=>aG,makeReducerFailFast:()=>iG,map:()=>rr,match:()=>Le,none:()=>A,orElse:()=>Ob,orElseResult:()=>N4,orElseSome:()=>$4,partitionMap:()=>J4,product:()=>k_,productMany:()=>V4,reduceCompact:()=>K4,some:()=>v,tap:()=>T_,toArray:()=>v_,toRefinement:()=>F4,void:()=>B4,zipLeft:()=>q4,zipRight:()=>H4,zipWith:()=>A_});function c_(e){return{combine:e}}function wb(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Ur=e=>(t,r)=>t===r||e(t,r),k4=(e,t)=>e===t,Xu=()=>k4;function l_(e){return Ur((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function Ph(e){return Ur((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var Fh=e=>l(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Rh=e=>l(2,(t,r)=>e(t,n=>({[r]:n}))),Mh=(e,t)=>l(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var d_="~effect/Option",m_={[d_]:{_A:e=>e},...Nr,[Symbol.iterator](){return new ui(this)}},A4=Object.defineProperty(Object.assign(Object.create(m_),{_tag:"Some",_op:"Some",[ie](e){return $h(e)&&Tb(e)&&Z(this.value,e.value)},[ae](){return xe(Y(this._tag))(Y(this.value))},toString(){return`some(${j(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:er(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),v4=Y("None"),O4=Object.assign(Object.create(m_),{_tag:"None",_op:"None",valueOrUndefined:void 0,[ie](e){return $h(e)&&Nh(e)},[ae](){return v4},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),$h=e=>O(e,d_),Nh=e=>e._tag==="None",Tb=e=>e._tag==="Some",mp=Object.create(O4),h_=function(e){this.value=e};h_.prototype=A4;var hp=e=>new h_(e);var x_="~effect/Result",y_={[x_]:{_A:e=>e,_E:e=>e},...Nr,[Symbol.iterator](){return new ui(this)}},_4=Object.assign(Object.create(y_),{_tag:"Success",_op:"Success",[ie](e){return Uh(e)&&tf(e)&&Z(this.success,e.success)},[ae](){return xe(Y(this._tag))(Y(this.success))},toString(){return`success(${j(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:er(this.success)}}}),P4=Object.assign(Object.create(y_),{_tag:"Failure",_op:"Failure",[ie](e){return Uh(e)&&ef(e)&&Z(this.failure,e.failure)},[ae](){return xe(Y(this._tag))(Y(this.failure))},toString(){return`failure(${j(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:er(this.failure)}}}),Uh=e=>O(e,x_),ef=e=>e._tag==="Failure",tf=e=>e._tag==="Success",S_=function(e){this.failure=e};S_.prototype=P4;var Dh=e=>new S_(e),E_=function(e){this.success=e};E_.prototype=_4;var Lh=e=>new E_(e),kb=e=>tf(e)?mp:hp(e.failure),Ab=e=>ef(e)?mp:hp(e.success);function li(e){return(t,r)=>t===r?0:e(t,r)}var I_=li((e,t)=>e<t?-1:1),ha=li((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var rf=li((e,t)=>e<t?-1:1);var vb=l(2,(e,t)=>li((r,n)=>e(t(r),t(n)))),nf=vb(ha,e=>e.getTime());var Bh=e=>l(2,(t,r)=>e(t,r)===-1),of=e=>l(2,(t,r)=>e(t,r)===1),jh=e=>l(2,(t,r)=>e(t,r)!==1),zh=e=>l(2,(t,r)=>e(t,r)!==-1);var A=()=>mp,v=hp,sf=$h,me=Nh,fe=Tb,Le=l(2,(e,{onNone:t,onSome:r})=>me(e)?t():r(e.value)),F4=e=>t=>fe(e(t)),R4=e=>{for(let t of e)return v(t);return A()},C_=Ab,M4=kb,Ft=l(2,(e,t)=>me(e)?t():e.value),Ob=l(2,(e,t)=>me(e)?t():e),$4=l(2,(e,t)=>me(e)?v(t()):e),N4=l(2,(e,t)=>me(e)?rr(t(),Lh):rr(e,Dh)),U4=e=>{let t=A();for(t of e)if(fe(t))return t;return t},uo=e=>e==null?A():v(e),ga=e=>e===void 0?A():v(e),_b=e=>e===null?A():v(e),D4=e=>(...t)=>uo(e(...t)),Hh=Ft(ib),Cr=Ft(ao),jo=e=>(...t)=>{try{return v(e(...t))}catch{return A()}},qh=l(2,(e,t)=>{if(fe(e))return e.value;throw t()}),Pb=qh(()=>new Error("getOrThrow called on a None")),rr=l(2,(e,t)=>me(e)?A():v(t(e.value))),w_=l(2,(e,t)=>rr(e,()=>t)),L4=w_(void 0),B4=v(void 0);var Ps=l(2,(e,t)=>me(e)?A():t(e.value)),j4=l(2,(e,t)=>Ps(e,r=>{let n=Un(t)?t(r):t;return sf(n)?n:v(n)})),z4=l(2,(e,t)=>me(e)?A():uo(t(e.value))),Ic=Ps(D),H4=l(2,(e,t)=>Ps(e,()=>t)),q4=l(2,(e,t)=>T_(e,()=>t)),W4=l(2,(e,t)=>r=>Ps(e(r),t)),T_=l(2,(e,t)=>Ps(e,r=>rr(t(r),()=>r))),k_=l(2,(e,t)=>fe(e)&&fe(t)?v([e.value,t.value]):A()),V4=l(2,(e,t)=>{if(me(e))return A();let r=[e.value];for(let n of t){if(me(n))return A();r.push(n.value)}return v(r)}),G4=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(me(n))return A();r.push(n.value)}return v(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(me(n))return A();z(t,r,n.value)}return v(t)},A_=l(3,(e,t,r)=>rr(k_(e,t),([n,o])=>r(n,o))),K4=l(3,(e,t,r)=>{let n=t;for(let o of e)fe(o)&&(n=r(n,o.value));return n}),v_=e=>me(e)?[]:[e.value],J4=l(2,(e,t)=>{if(me(e))return[A(),A()];let r=t(e.value);return ef(r)?[A(),v(r.failure)]:[v(r.success),A()]}),Z4=l(2,(e,t)=>{if(me(e))return A();let r=t(e.value);return tf(r)?v(r.success):A()}),Cc=l(2,(e,t)=>me(e)?A():t(e.value)?v(e.value):A()),Q4=e=>Ur((t,r)=>me(t)?me(r):me(r)?!1:e(t.value,r.value)),Y4=e=>li((t,r)=>fe(t)?fe(r)?e(t.value,r.value):1:-1),X4=e=>l(2,(t,r)=>A_(t,r,e)),Fb=l(2,(e,t)=>t(e)?v(e):A()),O_=e=>l(2,(t,r)=>me(t)?!1:e(t.value,r)),eG=O_(ap()),Rb=l(2,(e,t)=>me(e)?!1:t(e.value)),tG=Rh(rr),rG=Fh(rr);var nG=Mh(rr,Ps),oG=v({}),sG=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(me(o))return o;n=r.next(o.value)}return v(n.value)};function aG(e){return wb((t,r)=>me(t)?r:me(r)?t:v(e.combine(t.value,r.value)),A())}function __(e){return c_((t,r)=>me(t)||me(r)?A():v(e.combine(t.value,r.value)))}function iG(e){let t=__(e).combine,r=v(e.initialValue);return wb(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),me(o))return o;return o})}var P_="~effect/Context/Service",gt=function(){function e(){}let t=e;Object.setPrototypeOf(t,cG);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[$b]=$b,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&F_.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},cG={[P_]:P_,...Os({label:"Service",evaluate(e){return Me($e(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return xa(this,e)},use(e){return ue(t=>e($e(t.context,this)))},useSync(e){return ue(t=>Me(e($e(t.context,this))))}},F_=new Set,$b="~effect/Context/Reference",R_="~effect/Context",uG=8,fG=8,Nb=(e,t,r,n)=>{let o=Object.create(pG);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},Ub=(e,t)=>{t&&(Ub(e,t.parent),e.set(t.key,t.value))},M_=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Ub(t,e.overlay),e._flat=t},lG=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),pi(r)},Wh=Symbol(),Db=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?Wh:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=fG&&(r.base=M_(r),r.overlay=void 0,r.depth=0),n)},pi=e=>Nb(void 0,e,void 0,0),pG={get mapUnsafe(){return M_(this)},...Nr,[R_]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ie](e){if(!xp(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!Z(o,r.get(n)))return!1;return!0},[ae](){return Wt(this.mapUnsafe.size)}},$_=(e,t)=>e.cacheRoot===t.cacheRoot,xp=e=>O(e,R_);var N_=e=>!!e[$b],nr=()=>dG,dG=pi(new Map),xa=(e,t)=>pi(new Map([[e.key,t]])),or=l(3,(e,t,r)=>mG(e,t.key,r)),mG=(e,t,r)=>{let n=e,o=F_.has(t)?void 0:n.cacheRoot;if(n.depth>=uG){let s=new Map(n._flat??n.base);return n._flat||Ub(s,n.overlay),s.set(t,r),Nb(o,s,void 0,0)}return Nb(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Vh=l(2,(e,t)=>yp(e,t.key)),yp=(e,t)=>{let r=Db(e,t);return r===Wh?void 0:r},fo=l(2,(e,t)=>{let r=Db(e,t.key);if(r===Wh){if(N_(t))return U_(t);throw hG(t)}return r}),$e=fo,Mb="~effect/Context/defaultValue",U_=e=>Mb in e?e[Mb]:e[Mb]=e.defaultValue(),hG=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
9
9
|
`);r.splice(1,3),t.stack=r.join(`
|
|
10
|
-
`)}return t},Vh=l(2,(e,t)=>{let r=Ub(e,t.key);return r!==qh?v(r):$_(t)?v(N_(t)):A()}),Cc=l(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:uG(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),U_=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return li(t)};var Te=gt;var Db=e=>e.length>0;var At=e=>e>0?Math.floor(e):0,lo=e=>Math.max(1,At(e));var G=Dh,X=Uh;var D_=Nh,be=Xu,xt=ef;var Gh=l(2,(e,t)=>be(e)?X(t(e.failure)):e),gr=l(2,(e,t)=>xt(e)?G(t(e.success)):e),cn=l(2,(e,{onFailure:t,onSuccess:r})=>be(e)?t(e.failure):r(e.success));var Sp=l(2,(e,t)=>be(e)?t(e.failure):e.success);var hG=l(2,(e,t)=>{if(xt(e))return e.success;throw t(e.failure)}),di=hG(D);var sr=l(2,(e,t)=>be(e)?X(e.failure):t(e.success));var L_=f_;var gG=(e,t)=>{let r=t?.length!==void 0?lo(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var xG=l(2,(e,t)=>yG(gG(()=>e,{length:t}))),j_=e=>xG(e,1/0);var z_=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error("headUnsafe: empty iterable");return r.value};var H_=l(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(Sh(o)){if(o)return v(n)}else if(fe(o))return o;r++}return A()});var yG=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var q_=l(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var SG=l(2,(e,t)=>Object.hasOwn(e,t));var Kh=l(2,(e,t)=>{let r={...e};for(let n of W_(e))z(r,n,t(e[n],n));return r});var W_=e=>Object.keys(e);var EG=e=>l(2,(t,r)=>{for(let n of W_(t))if(!SG(r,n)||!e(t[n],r[n]))return!1;return!0});var V_=e=>{let t=EG(e);return(r,n)=>t(r,n)&&t(n,r)};var Zh=globalThis.Array;var G_=l(2,(e,t)=>{let r=lo(e),n=new Zh(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),Lb=(e,t)=>e<=t?G_(t-e+1,r=>e+r):[e];var Xe=e=>Zh.isArray(e)?e:Zh.from(e);var bp=l(2,(e,{onEmpty:t,onNonEmpty:r})=>st(e)?r(e):t());var Qh=l(2,(e,t)=>[...e,t]),Bb=l(2,(e,t)=>Xe(e).concat(Xe(t)));var K_=Zh.isArray;var Dr=Db,st=Db;function sf(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function bG(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var J_=l(2,(e,t)=>{let r=Math.floor(t);if(bG(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var Yh=e=>e[e.length-1];var Xh=l(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return v(r);r++}return A()});var Ip=H_;var eg=l(2,(e,t)=>{let r=Xe(e);for(let n=r.length-1;n>=0;n--){let o=r[n],s=t(o,n);if(typeof s=="boolean"){if(s)return v(o)}else if(fe(s))return s}return A()});var IG=(e,t)=>{let r=Y(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(Z(o,t))return!1;return n.push(t),!0};var Lt=()=>[],Ae=e=>[e],ar=l(2,(e,t)=>e.map(t));var tg=l(2,(e,t)=>{let r=Xe(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),jb=l(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);xt(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var af=l(3,(e,t,r)=>Xe(e).reduce((n,o,s)=>r(n,o,s),t));var Z_=_h;var rg=e=>{let t=Xe(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)IG(r,o)&&n.push(o);return n};var og="~effect/Duration",mi=BigInt(0),rP=BigInt(1),CG=BigInt(2),wG=BigInt(10),Q_=BigInt(24),ng=BigInt(60),zb=BigInt(1e3),Hb=BigInt(1e6);var nP=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),qb=e=>Number.isInteger(e)?BigInt(e)*Hb:nP(e*1e6),Y_=e=>Gr(Number.isFinite(e)?nP(e):e),X_=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=wG**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return TG(n?-a:a,s)},TG=(e,t)=>{let r=e<mi?-e:e,n=r/t+(r%t*CG>=t?rP:mi);return e<mi?-n:n};var kG=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,pt=e=>{switch(typeof e){case"number":return gi(e);case"bigint":return Fs(e);case"string":{if(e==="Infinity")return ya;if(e==="-Infinity")return cf;let t=kG.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return Fs(X_(n,rP));if(o==="micro"||o==="micros")return Fs(X_(n,zb));let s=Number(n);switch(o){case"milli":case"millis":return gi(s);case"second":case"seconds":return wp(s);case"minute":case"minutes":return FG(s);case"hour":case"hours":return RG(s);case"day":case"days":return MG(s);case"week":case"weeks":return $G(s)}break}case"object":{if(e===null)break;if(og in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ep)?eP(e):Number.isNaN(e[0])||Number.isNaN(e[1])?hi:e[0]===-1/0||e[1]===-1/0?cf:e[0]===1/0||e[1]===1/0?ya:Y_(e[0]*1e9+e[1]);let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Gr(r):Y_(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return eP(e)},eP=e=>{throw new Error(`Invalid Input: ${e}`)},oP=jo(pt),tP={_tag:"Millis",millis:0},AG={_tag:"Infinity"},vG={_tag:"NegativeInfinity"},OG={[og]:og,[ae](){switch(this.value._tag){case"Millis":return Y(qb(this.value.millis));case"Nanos":return Y(this.value.nanos);default:return op(this.value)}},[ie](e){return Cp(e)&&UG(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},Gr=e=>{let t=Object.create(OG);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=tP:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:qb(e)}:t.value=e>0?AG:vG:e===mi?t.value=tP:t.value={_tag:"Nanos",nanos:e},t},Cp=e=>O(e,og),Rs=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",uf=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===mi;case"Infinity":case"NegativeInfinity":return!1}},_G=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<mi;case"NegativeInfinity":return!0;case"Infinity":return!1}};var PG=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return ya;case"Millis":return e.value.millis<0?Gr(-e.value.millis):e;case"Nanos":return e.value.nanos<mi?Gr(-e.value.nanos):e}};var hi=Gr(0),ya=Gr(1/0),cf=Gr(-1/0),Fs=e=>Gr(e);var gi=e=>Gr(e),wp=e=>Gr(e*1e3),FG=e=>Gr(e*6e4),RG=e=>Gr(e*36e5),MG=e=>Gr(e*864e5),$G=e=>Gr(e*6048e5),Lr=e=>aP(pt(e),{onMillis:D,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ms=e=>aP(pt(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var sg=e=>{let t=pt(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return qb(t.value.millis)}},sP=jo(sg);var aP=l(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),iP=l(3,(e,t,r)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?r.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(sg(e),t.value.nanos):r.onNanos(e.value.nanos,sg(t)));var NG=(e,t)=>iP(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag});var cP=l(2,(e,t)=>iP(e,t,{onMillis:(r,n)=>Gr(r-n),onNanos:(r,n)=>Gr(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?hi:ya:o==="NegativeInfinity"?s==="NegativeInfinity"?hi:cf:s==="Infinity"?cf:ya}}));var UG=l(2,(e,t)=>NG(e,t)),DG=e=>{if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag==="NegativeInfinity")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=sg(e),r=t<mi,n=r?-t:t,o=n/Hb,s=o/zb,a=s/ng,i=a/ng,c=i/Q_,u=r?-1:1;return{days:u*Number(c),hours:u*Number(i%Q_),minutes:u*Number(a%ng),seconds:u*Number(s%ng),millis:u*Number(o%zb),nanos:u*Number(n%Hb)}},Wb=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(uf(e))return"0";if(_G(e))return"-"+Wb(PG(e));let t=DG(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(" ")};var Tp=Te("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new wc}),uP=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},LG="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},fP=e=>{try{return LG(e)}catch{return uP(e)}},Vb=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,a=0;for(;a<o&&!(n[a][0]>r);a++)s=n[a];s&&s[0]===r?s[1].push(t):a===o?n.push([r,[t]]):n.splice(a,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},wc=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?uP:fP)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new Gb(this.setImmediate)}},Gb=class{tasks=new Vb;running=void 0;setImmediate;constructor(t=fP){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},lP=Te("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),pP=Te("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var $s={};$n($s,{Class:()=>ag,Error:()=>kp,TaggedClass:()=>BG,TaggedError:()=>mo,taggedEnum:()=>Jb});var ag=class extends ai{constructor(e){super(),e&&Th(this,e)}},BG=e=>class extends ag{_tag=e},Jb=()=>new Proxy({},{get(e,t,r){return t==="$is"?mr:t==="$match"?jG:n=>({...n,_tag:t})}});function jG(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var kp=dp,mo=ma;var dP="~effect/encoding/EncodingError",ho=class extends mo("EncodingError"){[dP]=dP};var ig=e=>mP(typeof e=="string"?WG.encode(e):e),Zb=e=>{switch(e){case 16:return HG();case 32:return qG();default:{let t="";for(let r=e>>>3;r>0;r--)t+=zG();return t}}},ce=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),Tc=()=>Math.random()*4294967296>>>0,zG=()=>{let e=Tc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15])},HG=()=>{let e=Tc(),t=Tc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15],ce[t>>>28],ce[t>>>24&15],ce[t>>>20&15],ce[t>>>16&15],ce[t>>>12&15],ce[t>>>8&15],ce[t>>>4&15],ce[t&15])},qG=()=>{let e=Tc(),t=Tc(),r=Tc(),n=Tc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15],ce[t>>>28],ce[t>>>24&15],ce[t>>>20&15],ce[t>>>16&15],ce[t>>>12&15],ce[t>>>8&15],ce[t>>>4&15],ce[t&15],ce[r>>>28],ce[r>>>24&15],ce[r>>>20&15],ce[r>>>16&15],ce[r>>>12&15],ce[r>>>8&15],ce[r>>>4&15],ce[r&15],ce[n>>>28],ce[n>>>24&15],ce[n>>>20&15],ce[n>>>16&15],ce[n>>>12&15],ce[n>>>8&15],ce[n>>>4&15],ce[n&15])},Qb=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return X(new ho({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=hP(t[o*2]),a=hP(t[o*2+1]);n[o]=s<<4|a}return G(n)}catch(r){return X(new ho({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},gP=e=>gr(Qb(e),t=>VG.decode(t)),WG=new TextEncoder,VG=new TextDecoder,GG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),mP=e=>{let t="";for(let r=0;r<e.length;r++)t+=GG[e[r]];return t},hP=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var eI="effect/Tracer/ParentSpan",kc=class extends gt()(eI,{fiberCached:!0}){},KG=e=>e;var cg=Te("effect/Tracer/DisablePropagation",{defaultValue:Ql}),xP=Te("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),yP=Te("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),tI="effect/Tracer",rI=Te(tI,{fiberCached:!0,defaultValue:()=>nI}),nI=KG({span:e=>new Xb(e)}),Xb=class{_tag="Span";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime}}get traceId(){return this._traceId??=Cr(this.parent)?.traceId??Zb(32)}get spanId(){return this._spanId??=Zb(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var EP="effect/Metric/FiberRuntimeMetrics";var bP=Te("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Ap=Te("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:ao}),ug=Te("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:sn}),Ac=Te("effect/References/TracerTimingEnabled",{defaultValue:sn}),vp=Te("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Op=Te("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Sa=Te("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),oI=Te("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),fg=Te("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var lg=Te("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var xi=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Do();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};br(3);let r=new Error;return br(t),{...e,captureStackTrace:QG(()=>r.stack)}},sI=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`
|
|
11
|
-
`);if(o[e]!==void 0)return r=o[e].trim(),r}},
|
|
12
|
-
`),s=[n];for(let a=1;a<o.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(o[a]);a++)s.push(o[a]);return r?
|
|
10
|
+
`)}return t},Gh=l(2,(e,t)=>{let r=Db(e,t.key);return r!==Wh?v(r):N_(t)?v(U_(t)):A()}),wc=l(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:lG(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),D_=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return pi(t)};var ke=gt;var Lb=e=>e.length>0;var At=e=>e>0?Math.floor(e):0,lo=e=>Math.max(1,At(e));var G=Lh,X=Dh;var L_=Uh,be=ef,xt=tf;var Kh=l(2,(e,t)=>be(e)?X(t(e.failure)):e),gr=l(2,(e,t)=>xt(e)?G(t(e.success)):e),cn=l(2,(e,{onFailure:t,onSuccess:r})=>be(e)?t(e.failure):r(e.success));var Sp=l(2,(e,t)=>be(e)?t(e.failure):e.success);var xG=l(2,(e,t)=>{if(xt(e))return e.success;throw t(e.failure)}),mi=xG(D);var sr=l(2,(e,t)=>be(e)?X(e.failure):t(e.success));var B_=l_;var yG=(e,t)=>{let r=t?.length!==void 0?lo(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var SG=l(2,(e,t)=>EG(yG(()=>e,{length:t}))),z_=e=>SG(e,1/0);var H_=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error("headUnsafe: empty iterable");return r.value};var q_=l(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(Eh(o)){if(o)return v(n)}else if(fe(o))return o;r++}return A()});var EG=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var W_=l(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var bG=l(2,(e,t)=>Object.hasOwn(e,t));var Jh=l(2,(e,t)=>{let r={...e};for(let n of V_(e))z(r,n,t(e[n],n));return r});var V_=e=>Object.keys(e);var IG=e=>l(2,(t,r)=>{for(let n of V_(t))if(!bG(r,n)||!e(t[n],r[n]))return!1;return!0});var G_=e=>{let t=IG(e);return(r,n)=>t(r,n)&&t(n,r)};var Qh=globalThis.Array;var K_=l(2,(e,t)=>{let r=lo(e),n=new Qh(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),Bb=(e,t)=>e<=t?K_(t-e+1,r=>e+r):[e];var Xe=e=>Qh.isArray(e)?e:Qh.from(e);var bp=l(2,(e,{onEmpty:t,onNonEmpty:r})=>st(e)?r(e):t());var Yh=l(2,(e,t)=>[...e,t]),jb=l(2,(e,t)=>Xe(e).concat(Xe(t)));var J_=Qh.isArray;var Dr=Lb,st=Lb;function af(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function CG(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var Z_=l(2,(e,t)=>{let r=Math.floor(t);if(CG(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var Xh=e=>e[e.length-1];var eg=l(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return v(r);r++}return A()});var Ip=q_;var tg=l(2,(e,t)=>{let r=Xe(e);for(let n=r.length-1;n>=0;n--){let o=r[n],s=t(o,n);if(typeof s=="boolean"){if(s)return v(o)}else if(fe(s))return s}return A()});var wG=(e,t)=>{let r=Y(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(Z(o,t))return!1;return n.push(t),!0};var Lt=()=>[],Ae=e=>[e],ar=l(2,(e,t)=>e.map(t));var rg=l(2,(e,t)=>{let r=Xe(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),zb=l(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);xt(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var cf=l(3,(e,t,r)=>Xe(e).reduce((n,o,s)=>r(n,o,s),t));var Q_=Ph;var ng=e=>{let t=Xe(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)wG(r,o)&&n.push(o);return n};var sg="~effect/Duration",hi=BigInt(0),nP=BigInt(1),TG=BigInt(2),kG=BigInt(10),Y_=BigInt(24),og=BigInt(60),Hb=BigInt(1e3),qb=BigInt(1e6);var oP=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),Wb=e=>Number.isInteger(e)?BigInt(e)*qb:oP(e*1e6),X_=e=>Gr(Number.isFinite(e)?oP(e):e),eP=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=kG**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return AG(n?-a:a,s)},AG=(e,t)=>{let r=e<hi?-e:e,n=r/t+(r%t*TG>=t?nP:hi);return e<hi?-n:n};var vG=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,pt=e=>{switch(typeof e){case"number":return xi(e);case"bigint":return Fs(e);case"string":{if(e==="Infinity")return ya;if(e==="-Infinity")return uf;let t=vG.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return Fs(eP(n,nP));if(o==="micro"||o==="micros")return Fs(eP(n,Hb));let s=Number(n);switch(o){case"milli":case"millis":return xi(s);case"second":case"seconds":return wp(s);case"minute":case"minutes":return MG(s);case"hour":case"hours":return $G(s);case"day":case"days":return NG(s);case"week":case"weeks":return UG(s)}break}case"object":{if(e===null)break;if(sg in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ep)?tP(e):Number.isNaN(e[0])||Number.isNaN(e[1])?gi:e[0]===-1/0||e[1]===-1/0?uf:e[0]===1/0||e[1]===1/0?ya:X_(e[0]*1e9+e[1]);let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Gr(r):X_(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return tP(e)},tP=e=>{throw new Error(`Invalid Input: ${e}`)},sP=jo(pt),rP={_tag:"Millis",millis:0},OG={_tag:"Infinity"},_G={_tag:"NegativeInfinity"},PG={[sg]:sg,[ae](){switch(this.value._tag){case"Millis":return Y(Wb(this.value.millis));case"Nanos":return Y(this.value.nanos);default:return op(this.value)}},[ie](e){return Cp(e)&&LG(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},Gr=e=>{let t=Object.create(PG);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=rP:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:Wb(e)}:t.value=e>0?OG:_G:e===hi?t.value=rP:t.value={_tag:"Nanos",nanos:e},t},Cp=e=>O(e,sg),Rs=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",ff=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===hi;case"Infinity":case"NegativeInfinity":return!1}},FG=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<hi;case"NegativeInfinity":return!0;case"Infinity":return!1}};var RG=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return ya;case"Millis":return e.value.millis<0?Gr(-e.value.millis):e;case"Nanos":return e.value.nanos<hi?Gr(-e.value.nanos):e}};var gi=Gr(0),ya=Gr(1/0),uf=Gr(-1/0),Fs=e=>Gr(e);var xi=e=>Gr(e),wp=e=>Gr(e*1e3),MG=e=>Gr(e*6e4),$G=e=>Gr(e*36e5),NG=e=>Gr(e*864e5),UG=e=>Gr(e*6048e5),Lr=e=>iP(pt(e),{onMillis:D,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ms=e=>iP(pt(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var ag=e=>{let t=pt(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return Wb(t.value.millis)}},aP=jo(ag);var iP=l(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),cP=l(3,(e,t,r)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?r.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(ag(e),t.value.nanos):r.onNanos(e.value.nanos,ag(t)));var DG=(e,t)=>cP(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag});var uP=l(2,(e,t)=>cP(e,t,{onMillis:(r,n)=>Gr(r-n),onNanos:(r,n)=>Gr(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?gi:ya:o==="NegativeInfinity"?s==="NegativeInfinity"?gi:uf:s==="Infinity"?uf:ya}}));var LG=l(2,(e,t)=>DG(e,t)),BG=e=>{if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag==="NegativeInfinity")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=ag(e),r=t<hi,n=r?-t:t,o=n/qb,s=o/Hb,a=s/og,i=a/og,c=i/Y_,u=r?-1:1;return{days:u*Number(c),hours:u*Number(i%Y_),minutes:u*Number(a%og),seconds:u*Number(s%og),millis:u*Number(o%Hb),nanos:u*Number(n%qb)}},Vb=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(ff(e))return"0";if(FG(e))return"-"+Vb(RG(e));let t=BG(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(" ")};var Tp=ke("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new Tc}),fP=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},jG="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},lP=e=>{try{return jG(e)}catch{return fP(e)}},Gb=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,a=0;for(;a<o&&!(n[a][0]>r);a++)s=n[a];s&&s[0]===r?s[1].push(t):a===o?n.push([r,[t]]):n.splice(a,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},Tc=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?fP:lP)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new Kb(this.setImmediate)}},Kb=class{tasks=new Gb;running=void 0;setImmediate;constructor(t=lP){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},pP=ke("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),dP=ke("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var $s={};$n($s,{Class:()=>ig,Error:()=>kp,TaggedClass:()=>zG,TaggedError:()=>mo,taggedEnum:()=>Zb});var ig=class extends ii{constructor(e){super(),e&&kh(this,e)}},zG=e=>class extends ig{_tag=e},Zb=()=>new Proxy({},{get(e,t,r){return t==="$is"?mr:t==="$match"?HG:n=>({...n,_tag:t})}});function HG(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var kp=dp,mo=ma;var mP="~effect/encoding/EncodingError",ho=class extends mo("EncodingError"){[mP]=mP};var cg=e=>hP(typeof e=="string"?GG.encode(e):e),Qb=e=>{switch(e){case 16:return WG();case 32:return VG();default:{let t="";for(let r=e>>>3;r>0;r--)t+=qG();return t}}},ce=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),kc=()=>Math.random()*4294967296>>>0,qG=()=>{let e=kc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15])},WG=()=>{let e=kc(),t=kc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15],ce[t>>>28],ce[t>>>24&15],ce[t>>>20&15],ce[t>>>16&15],ce[t>>>12&15],ce[t>>>8&15],ce[t>>>4&15],ce[t&15])},VG=()=>{let e=kc(),t=kc(),r=kc(),n=kc();return String.fromCharCode(ce[e>>>28],ce[e>>>24&15],ce[e>>>20&15],ce[e>>>16&15],ce[e>>>12&15],ce[e>>>8&15],ce[e>>>4&15],ce[e&15],ce[t>>>28],ce[t>>>24&15],ce[t>>>20&15],ce[t>>>16&15],ce[t>>>12&15],ce[t>>>8&15],ce[t>>>4&15],ce[t&15],ce[r>>>28],ce[r>>>24&15],ce[r>>>20&15],ce[r>>>16&15],ce[r>>>12&15],ce[r>>>8&15],ce[r>>>4&15],ce[r&15],ce[n>>>28],ce[n>>>24&15],ce[n>>>20&15],ce[n>>>16&15],ce[n>>>12&15],ce[n>>>8&15],ce[n>>>4&15],ce[n&15])},Yb=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return X(new ho({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=gP(t[o*2]),a=gP(t[o*2+1]);n[o]=s<<4|a}return G(n)}catch(r){return X(new ho({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},xP=e=>gr(Yb(e),t=>KG.decode(t)),GG=new TextEncoder,KG=new TextDecoder,JG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),hP=e=>{let t="";for(let r=0;r<e.length;r++)t+=JG[e[r]];return t},gP=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var tI="effect/Tracer/ParentSpan",Ac=class extends gt()(tI,{fiberCached:!0}){},ZG=e=>e;var ug=ke("effect/Tracer/DisablePropagation",{defaultValue:Ql}),yP=ke("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),SP=ke("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),rI="effect/Tracer",nI=ke(rI,{fiberCached:!0,defaultValue:()=>oI}),oI=ZG({span:e=>new eI(e)}),eI=class{_tag="Span";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime}}get traceId(){return this._traceId??=Cr(this.parent)?.traceId??Qb(32)}get spanId(){return this._spanId??=Qb(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var bP="effect/Metric/FiberRuntimeMetrics";var IP=ke("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Ap=ke("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:ao}),fg=ke("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:sn}),vc=ke("effect/References/TracerTimingEnabled",{defaultValue:sn}),vp=ke("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Op=ke("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Sa=ke("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),sI=ke("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),lg=ke("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var pg=ke("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var yi=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Do();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};br(3);let r=new Error;return br(t),{...e,captureStackTrace:XG(()=>r.stack)}},aI=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`
|
|
11
|
+
`);if(o[e]!==void 0)return r=o[e].trim(),r}},XG=aI(3);var dg=class extends Ku{constructor(t,r=fp){super("Interrupt",r,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[ie](t){return Sc(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[ae](){return De(`${this._tag}:${this.fiberId}`)}},_P=e=>new dg(e),Pc=e=>new Lo([new dg(e)]),PP=e=>e.reasons.some(Bo),FP=e=>{let t=e.reasons.find(Bo);return t?G(t):X(e)},go=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return G(r.error)}return X(e)};var RP=e=>e.reasons.some(pp);var Ig=e=>{let t=e.reasons.find(pp);return t?G(t.defect):X(e)},II=e=>e.reasons.some(Sc);var MP=e=>{let t;for(let r=0;r<e.reasons.length;r++){let n=e.reasons[r];n._tag==="Interrupt"&&(t??=new Set,n.fiberId!==void 0&&t.add(n.fiberId))}return t?G(t):X(e)};var Cg=e=>e.reasons.length>0&&e.reasons.every(Sc);var $P=l(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>Bo(o)?(r=!0,new yc(t(o.error),o.annotations)):o);return r?da(n):e}),wg=e=>{let t;for(let r of e.reasons){if(r._tag==="Fail")return r.error;r._tag==="Die"&&(t??=r)}return t!==void 0?t.defect:e.reasons.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},NP=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=Do();o!==0&&br(1);try{for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(cI(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=new Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=n3(s,n);let a=new globalThis.Error("All fibers interrupted without error",{cause:s});a.name="InterruptError",a.stack=`${a.name}: ${a.message}`,r.push(cI(a,n[0].annotations,t))}}finally{o!==0&&br(o)}return r},cI=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(e3(e),{cause:e.cause?cI(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=r3(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?uI(s,t):s}r?.includeCauseInStack&&(o.stack=DP(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else{o=new globalThis.Error(e?n==="string"?e:hc(e):`Unknown error: ${e}`);let s=`${o.name}: ${o.message}`;o.stack=t?uI(s,t):s}return o},e3=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return hc(e)},t3=/\((.*)\)/g,r3=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
|
|
12
|
+
`),s=[n];for(let a=1;a<o.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(o[a]);a++)s.push(o[a]);return r?uI(s.join(`
|
|
13
13
|
`),r):s.join(`
|
|
14
|
-
`)},
|
|
15
|
-
${
|
|
16
|
-
`)},
|
|
17
|
-
`)},
|
|
18
|
-
`),
|
|
19
|
-
${
|
|
20
|
-
}`:e.stack,
|
|
14
|
+
`)},uI=(e,t)=>{let r=t?.get(_h.key);return r&&(e=`${e}
|
|
15
|
+
${UP(r)}`),e},n3=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:"unknown",s=n.annotations.get(Ib.key);r.push(` at fiber (${o})`),s&&r.push(UP(s))}return r.join(`
|
|
16
|
+
`)},UP=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(t3),a=!1;for(let[,i]of s)a=!0,t.push(` at ${r.name} (${i})`);a||t.push(` at ${r.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${r.name}`);r=r.parent,n++}return t.join(`
|
|
17
|
+
`)},Tg=e=>NP(e).map(DP).join(`
|
|
18
|
+
`),DP=e=>e.cause?`${e.stack} {
|
|
19
|
+
${LP(e.cause," ")}
|
|
20
|
+
}`:e.stack,LP=(e,t)=>{let r=e.stack.split(`
|
|
21
21
|
`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`
|
|
22
22
|
${t}${r[o]}`;return e.cause&&(n+=` {
|
|
23
|
-
${
|
|
24
|
-
${t}}`),n},II="~effect/Fiber",r3={_A:D,_E:D},n3={id:0},IP=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),LP=()=>IP===void 0?void 0:new IP("effect/Fiber"),Ea=()=>globalThis[dc],_p=class{constructor(t,r=!0){this.setContext(t),this.id=++n3.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[II](){return r3}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return $e(this.context,t)}addObserver(t){return this._exit?(t(this._exit),yn):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=_c(t);this.cache.stackFrame&&(n=lp(n,xa(Oh,this.cache.stackFrame))),r&&(n=lp(n,r)),this._interruptedCause=this._interruptedCause?yb(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ge(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Sc){this._asyncContext=LP();return}let n=uI.interruptChildren&&uI.interruptChildren(this);if(n!==void 0)return this.evaluate(oe(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=nr()}runLoop(t){let r=globalThis[dc];globalThis[dc]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Ge(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=oe(mf,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[ft](this),s===Sc){let i=this._yielded;if(hc in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Sc}}catch(a){if(!O(s,ft))return an(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=an(a)}}finally{this._running=n,globalThis[dc]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,s3;for(;;){let r=this._stack.pop();if(!r)return;let n=r[gc];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&a3-1)===0)return Me(t);let r=this.getCont(tr);return r?r[tr](t,this):this.yieldWith(Me(t))}yieldWith(t){return this._yielded=t,Sc}children(){return this._children??=new Set}pipe(){return ne(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&M_(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=o3(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag==="Span"?t:void 0}},o3=e=>{let t=yp(e,tI);return{scheduler:$e(e,Tp),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:$e(e,ug),span:yp(e,eI),logLevel:$e(e,oI),minimumLogLevel:$e(e,fg),stackFrame:$e(e,Ap),runtimeMetrics:yp(e,EP),maxOpsBeforeYield:$e(e,lP),preventYield:$e(e,pP)}},s3={[tr](e,t){return Ge(t._interruptedCause)},[Ln](e,t){return Ge(t._interruptedCause)}},a3=32,uI={interruptChildren:void 0},Tg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(bb.key,e.cache.stackFrame),li(t)},i3=e=>{if(!(e._children===void 0||e._children.size===0))return ff(e._children)},CI=e=>{let t=e;return t._exit?q(t._exit):Bt(r=>t._exit?r(q(t._exit)):Q(e.addObserver(n=>r(q(n)))))},kg=e=>Bt(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let a=r.next();for(;!a.done;){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver(i=>{n.push(i),s()});return}t(q(n))}return s(),Q(()=>o?.())}),dg=e=>{let t=e;return t._exit?t._exit:Bt(r=>t._exit?r(t._exit):Q(e.addObserver(r)))},BP=e=>Bt(t=>{let r=Array.from(e);if(r.length===0)return t(q(Lt()));let n=new Array(r.length),o=Lt(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},a=0,i=!1;for(let c=0;c<r.length&&!i;c++){let u=f=>{if(a++,f._tag==="Failure")return i=!0,s(),t(f);n[c]=f.value,a===r.length&&t(q(n))};o.push(u),r[c].addObserver(u)}return Q(()=>{i=!0,s()})}),Rp=e=>ue(t=>jP(e,t.id)),jP=l(e=>O(e[0],II),(e,t,r)=>ue(n=>{let o=Tg(n);return o=o&&r?Cc(o,r):o??r,e.interruptUnsafe(t,o),Mp(CI(e))})),ff=e=>ue(t=>{let r=Tg(t),n=Lt();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Mp(kg(n))});var q=Me,Ge=Ir,yt=jn,Q=io({op:"Sync",[ft](e){let t=this[ge](),r=e.getCont(tr);return r?r[tr](t,e):e.yieldWith(Me(t))}}),le=io({op:"Suspend",[ft](e){return this[ge]()}}),wI=l(e=>e.length>=2||of(e[0]),(e,t)=>me(e)?yt(t?t():new As("Effect.fromOption: Option.none")):q(e.value)),df=cn({onFailure:yt,onSuccess:q}),zP=e=>e==null?yt(new As):q(e),TI=io({op:"Yield",[ft](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Kr)},this[ge]??0),e.yieldWith(()=>{t=!0})}}),mf=TI(0),kI=e=>q(v(e)),Pc=q(A()),HP=e=>me(e)?Pc:Re(e.value,v),qP=e=>le(()=>Ge(e())),Si=e=>an(e),Ag=e=>le(()=>yt(e())),ye=q(void 0);var WP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new pf(n,"An error occurred in Effect.try"):e.catch;return le(()=>{try{return q(t())}catch(n){return yt(r(n))}})};var AI=e=>vI(function(t,r){e(r).then(n=>t(q(n)),n=>t(Si(n)))},e.length!==0),VP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new pf(n,"An error occurred in Effect.tryPromise"):e.catch;return vI(function(n,o){let s=a=>le(()=>{try{return yt(ui(()=>r(a)))}catch(i){return Si(i)}});try{t(o).then(a=>n(q(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},GP=e=>ue(t=>e(t.id)),KP=ue(q),JP=GP(q),vI=(function(){let e=Bn({op:"Async",[ft](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,a=this.register.call(r.cache.scheduler,i=>{n||(n=!0,o?r.evaluate(i):o=i)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&a===void 0?Sc:(r._stack.push(c3(()=>(n=!0,s?.abort(),a??Kr))),Sc))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),c3=io({op:"AsyncFinalizer",[gc](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Bp))},[Ln](e,t){return bI(e)?oe(JF(Ir(e),this[ge]()),()=>Ge(e)):Ge(e)}}),Bt=e=>vI(e,e.length>=2),vg=Bt(yn),ZP=(...e)=>{if(e.length===1){let n=e[0];return le(()=>Oc(n()))}let[t,r]=e;return le(()=>Oc(r.call(t.self)))},OI=(e,...t)=>{let r=t.length===0?function(){return le(()=>Oc(e.apply(this,arguments)))}:function(){let n=le(()=>Oc(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return _I(e.length,r)},_I=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),CP=sI(2),QP=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Do(),o;return n!==0&&(br(2),o=new globalThis.Error,br(n)),e?(s,...a)=>wP(t,s,o,a,e,r):wP(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},wP=(e,t,r,n,o,s)=>{let a=typeof t=="function"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?CP(()=>r.stack):ao;return _I(a.length,function(...u){let f=le(()=>{let m=a.apply(this,arguments);return de(m)?m:Oc(m)});for(let m=0;m<n.length;m++)f=n[m](f,...u);if(!de(f))return f;let p=Do(),d;return p!==0&&(br(2),d=new globalThis.Error,br(p)),Ia(o?Fp(e,s,m=>mI(f,m)):f,Ap,m=>({name:e,stack:d?CP(()=>d.stack):ao,parent:{name:i,stack:c,parent:m}}))})},YP=(e,...t)=>_I(e.length,t.length===0?function(){return TP(()=>e.apply(this,arguments))}:function(){let r=TP(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),TP=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return q(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else{if(o&&o._tag==="Failure")return n.value;{let s=!0;return le(()=>s?(s=!1,oe(n.value,a=>Oc(t,a))):le(()=>Oc(e())))}}}}catch(t){return Si(t)}},Oc=(function(){let e=Bn({op:"Iterator",[tr](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return q(s.value);if(je(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[ft](r){return this[tr](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),un=l(2,(e,t)=>new ba(e,PI,q(t))),Og=function(e){return e._stack.push(this),this[ge]},u3=Bn({op:"OnSuccess",[ft]:Og}),ba=function(e,t,r){this[ge]=e,this[tr]=t,this.payload=r};ba.prototype=u3;var PI=function(){return this.payload},XP=function(e,t){return t.succeedWith(this.payload)},_g=(()=>{let e=Do();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};br(1);let n=r[t]();return br(e),n.stack?.includes("[as "+t+"]")===!0})(),f3=function(e,t){let r=this.payload;return t.succeedWith(_g?r(e):ui(()=>r(e)))},eF=function(e){let t=this.payload;return t(e)},l3=function(e){let t=this.payload;return new ba(t(e),XP,e)},p3=function(e){return new ba(this.payload,XP,e)},hf=e=>Re(e,v),tF=e=>Sf(e,{onFailure:q,onSuccess:yt}),Us=l(2,(e,t)=>new ba(e,de(t)?PI:eF,t)),Fc=l(2,(e,t)=>new ba(e,de(t)?p3:l3,t)),Mp=e=>new ba(e,PI,Kr),rF=e=>qn(e,yt),FI=(e,t)=>ue(r=>{let n=new Set;return bf(r,()=>n.size===0?void 0:ff(n)),Bt(o=>{let s=Xe(e),a=s.length,i=0,c=!1,u=[],f=(p,d,m)=>{if(i++,p._tag==="Failure"){u.push(...p.cause.reasons),i>=a&&o(Ge(da(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:d,index:m,parentFiber:r})};for(let p=0;p<a;p++){let d=$c(r,s[p],!0,!0,!1);if(n.add(d),d.addObserver(m=>{n.delete(d),f(m,d,p)}),c)break}})}),RI=(e,t)=>ue(r=>{let n=new Set;return bf(r,()=>n.size===0?void 0:ff(n)),Bt(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,u=$c(r,i,!0,!0,!1);n.add(u),u.addObserver(f=>{n.delete(u);let p=!s;s=!0,o(f),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),nF=l(e=>de(e[1]),(e,t,r)=>FI([e,t],r)),MI=l(e=>de(e[1]),(e,t,r)=>RI([e,t],r)),oe=l(2,(e,t)=>new ba(e,eF,t)),oF=l(2,(e,t)=>je(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):Ns(e,t)),je=e=>e[hc]!==void 0,sF=l(2,(e,t)=>je(e)?e._tag==="Success"?t(e.value):e:oe(e,t)),aF=e=>oe(e,D),Re=l(2,(e,t)=>new ba(e,f3,t)),iF=l(2,(e,t)=>je(e)?dF(e,t):Re(e,t)),cF=l(2,(e,t)=>je(e)?mF(e,t):HI(e,t)),uF=l(2,(e,t)=>je(e)?hF(e,t):qI(e,t)),fF=l(2,(e,t)=>{if(je(e)){if(e._tag==="Success")return e;let r=go(e.cause);return be(r)?e:t(r.success)}return wa(e,t)}),gf=e=>Ir(_c(e)),xf=e=>e._tag==="Success";var lF=e=>e._tag==="Failure";var pF=e=>e._tag==="Failure"?G(e.cause):X(e);var $I=e=>e._tag==="Failure"&&bI(e.cause);var Kr=Me(void 0),dF=l(2,(e,t)=>e._tag==="Success"?Me(t(e.value)):e),mF=l(2,(e,t)=>{if(e._tag==="Success")return e;let r=go(e.cause);return be(r)?e:jn(t(r.success))}),hF=l(2,(e,t)=>{if(e._tag==="Success")return Me(t.onSuccess(e.value));let r=go(e.cause);return be(r)?e:jn(t.onFailure(r.success))});var gF=l(2,(e,t)=>xf(e)?t:e),xF=l(2,(e,t)=>xf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var NI=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?Kr:Ir(da(t))};var yF=e=>e,SF=e=>ue(t=>q(Vh(t.context,e))),d3=e=>ue(t=>wI(Vh(t.context,e))),yf=l(2,(e,t)=>ue(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),bf(r,()=>{r.setContext(n)})),e})),Ia=l(3,(e,t,r)=>yf(e,n=>{let o=fo(n,t),s=r(o);return o===s?n:or(n,t,s)})),EF=(e,t,r)=>Mc(ue(n=>{let o=fo(n.context,e),s=t(o);return n.setContext(or(n.context,e,s)),Ii(fo(n.context,bi),a=>{let i=Vh(n.context,e);if(me(i))return ye;let c=i.value,u;if(r?.reset===void 0){if(c!==s)return ye;u=o}else u=r.reset(o,s,c);return n.setContext(or(n.context,e,u)),ye})})),UI=()=>m3,m3=ue(e=>q(e.context)),Ei=e=>ue(t=>e(t.context)),bF=l(2,(e,t)=>yf(e,ct(t))),Hn=l(2,(e,t)=>je(e)?e:yf(e,Cc(t))),fn=function(){return arguments.length===1?l(2,(e,t)=>kP(e,arguments[0],t)):l(3,(e,t,r)=>kP(e,t,r)).apply(this,arguments)},kP=(e,t,r)=>yf(e,or(t,r)),Pg=l(3,(e,t,r)=>oe(r,n=>fn(e,t,n))),IF=l(e=>de(e[1]),(e,t,r)=>DI(e,t,(n,o)=>[n,o],r)),DI=l(e=>de(e[1]),(e,t,r,n)=>n?.concurrent?Re(jp([e,t],{concurrency:2}),([o,s])=>r(o,s)):oe(e,o=>Re(t,s=>r(o,s)))),CF=l(e=>de(e[0]),(e,t,r)=>s0(e,t,r?n=>yt(r(n)):()=>yt(new As))),wF=l(2,(e,t)=>oe(t,r=>r?hf(e):Pc)),LI=l(2,(e,t)=>Array.from({length:t},()=>e)),TF=l(e=>de(e[0]),(e,t,r)=>jp(LI(e,t),r)),Fg=l(e=>de(e[0]),(e,t)=>Ds({while:sn,body:ct(t?.disableYield?e:oe(e,r=>mf)),step:yn})),qn=l(2,(e,t)=>new kF(e,t.length!==1?r=>t(r):t)),h3=Bn({op:"OnFailure",[ft]:Og}),kF=function(e,t){this[ge]=e,this[Ln]=t};kF.prototype=h3;var BI=l(3,(e,t,r)=>qn(e,n=>t(n)?r(n):Ge(n))),Ca=l(3,(e,t,r)=>qn(e,n=>{let o=t(n);return be(o)?Ge(o.failure):r(o.success,n)})),wa=l(2,(e,t)=>Ca(e,go,r=>t(r))),AF=e=>Sf(e,{onFailure:t=>Ib(t)?Pc:yt(t),onSuccess:kI}),vF=l(2,(e,t)=>Ca(e,bg,t)),OF=l(2,(e,t)=>qn(e,r=>Us(t(r),Ge(r)))),_F=l(3,(e,t,r)=>BI(e,t,n=>Us(r(n),Ge(n)))),Rg=l(3,(e,t,r)=>qn(e,n=>{let o=t(n);return be(o)?Ge(n):Us(r(o.success,n),Ge(n))})),jI=l(2,(e,t)=>Rg(e,go,r=>t(r))),PF=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):mr(t);return jI(e,o=>n(o)?r(o):ye)}),FF=l(2,(e,t)=>Rg(e,bg,r=>t(r))),$p=l(e=>de(e[0]),(e,t,r,n)=>qn(e,o=>{let s=go(o);return be(s)?Ge(s.failure):t(s.success)?r(s.success):n?n(s.success):Ge(o)})),Mg=l(e=>de(e[0]),(e,t,r,n)=>qn(e,o=>{let s=go(o);if(be(s))return Ge(s.failure);let a=t(s.success);return be(a)?n?n(a.failure):Ge(o):r(a.success)})),zI=l(e=>de(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):mr(t);return $p(e,o,r,n)}),RF=l(e=>de(e[0]),(e,t,r)=>{let n;return Mg(e,o=>(n??=Object.keys(t),O(o,"_tag")&&Nn(o._tag)&&n.includes(o._tag)?G(o):X(o)),o=>t[o._tag](o),r)}),MF=l(e=>de(e[0]),(e,t,r,n,o)=>$p(e,s=>mr(s,t)&&O(s,"reason")&&(o!==void 0||mr(s.reason,r)),s=>{let a=s.reason;return mr(a,r)?n(a,s):o?o(a,s):yt(s)})),$F=l(e=>de(e[0]),(e,t,r,n)=>{let o;return $p(e,s=>mr(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&Nn(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let a=s.reason;return o??=Object.keys(r),o.includes(a._tag)?r[a._tag](a,s):n?n(a,s):yt(s)})}),NF=l(2,(e,t)=>Mg(e,r=>mr(r,t)&&O(r,"reason")?G(r.reason):X(r),yt)),HI=l(2,(e,t)=>wa(e,r=>Ag(()=>t(r)))),qI=l(2,(e,t)=>Sf(e,{onFailure:r=>Ag(()=>t.onFailure(r)),onSuccess:r=>Q(()=>t.onSuccess(r))})),WI=e=>wa(e,Si),UF=l(2,(e,t)=>wa(e,r=>Q(()=>t(r)))),DF=e=>le(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return Si(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:wa(o.value,a=>n(s))}return n(r)}),VI=e=>wa(e,t=>oe(mf,()=>VI(e))),LF=l(e=>de(e[0]),(e,t)=>{if(!t?.log)return Sf(e,{onFailure:n=>ye,onSuccess:n=>ye});let r=Wo(t.log===!0?void 0:t.log);return Ns(e,{onFailure(n){let o=PP(n);return be(o)?Ge(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>ye})}),$g=l(e=>de(e[0]),(e,t)=>{if(!t?.log)return Ns(e,{onFailure:n=>ye,onSuccess:n=>ye});let r=Wo(t.log===!0?void 0:t.log);return Ns(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>ye})}),BF=e=>Ng(e,{onFailure:A,onSuccess:v}),yi=e=>Np(e,{onFailure:X,onSuccess:G}),Ns=l(2,(e,t)=>new jF(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),g3=Bn({op:"OnSuccessAndFailure",[ft]:Og}),jF=function(e,t,r){this[ge]=e,this[tr]=t,this[Ln]=r};jF.prototype=g3;var x3=function(e,t){let r=this.payload;return t.succeedWith(_g?r.onSuccess(e):ui(()=>r.onSuccess(e)))},zF=(e,t)=>{let r=Bn({op:e,[ft]:Og,[tr]:x3,[Ln]:t}),n=function(o,s){this[ge]=o,this.payload=s};return n.prototype=r,n},y3=zF("Match",function(e,t){let r=e.reasons.find(Bo);if(r===void 0)return Ge(e);let n=this.payload;return t.succeedWith(_g?n.onFailure(r.error):ui(()=>n.onFailure(r.error)))}),S3=zF("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(_g?r.onFailure(e):ui(()=>r.onFailure(e)))}),GI=l(2,(e,t)=>new S3(e,t)),Sf=l(2,(e,t)=>Ns(e,{onFailure:r=>{let n=r.reasons.find(Bo);return n?t.onFailure(n.error):Ge(r)},onSuccess:t.onSuccess})),Ng=l(2,(e,t)=>new y3(e,t)),Np=l(2,(e,t)=>{if(je(e)){if(e._tag==="Success")return Me(t.onSuccess(e.value));let r=go(e.cause);return be(r)?e:Me(t.onFailure(r.success))}return Ng(e,t)}),HF=l(2,(e,t)=>je(e)?e._tag==="Success"?Me(t.onSuccess(e.value)):Me(t.onFailure(e.cause)):GI(e,t)),Up=e=>je(e)?Me(e):E3(e),E3=io({op:"Exit",[ft](e){return e._stack.push(this),this[ge]},[tr](e,t,r){return t.succeedWith(r??Me(e))},[Ln](e,t,r){return t.succeedWith(r??Ir(e))}}),qF=Np({onFailure:()=>!0,onSuccess:()=>!1}),WF=Np({onFailure:()=>!1,onSuccess:()=>!0}),VF=l(2,(e,t)=>Us(If(t),e)),KI=l(2,(e,t)=>oe(JI(e,t.duration),r=>me(r)?t.orElse():q(r.value))),b3=e=>new xg(`Operation timed out after '${Wb(e)}'`),GF=l(2,(e,t)=>{let r=pt(t);return KI(e,{duration:r,orElse:()=>yt(b3(r))})}),JI=l(2,(e,t)=>MI(hf(e),un(If(t),A()))),KF=e=>qo(t=>{let r=t.monotonicTimeNanosUnsafe();return Re(e,n=>[Fs(t.monotonicTimeNanosUnsafe()-r),n])}),fI="~effect/Scope",lI="~effect/Scope/Closeable",bi=gt("effect/Scope"),ZI=(e,t)=>ue(r=>(T3(r),Ug(e,t)??ye)),Ug=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&hg(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return mg(r.finalizer,t);let n=r.finalizers;return n.size===1?mg(n.values().next().value,t):I3(e,n,t)},mg=(e,t)=>{try{return e(t)}catch(r){return an(r)}},JF=(e,t)=>xf(e)?t:qn(t,r=>Ge(vh(e.cause,r))),I3=OI(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=Ea();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?n.push(yield*Up(mg(c,r))):o.push($c(a,mg(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*kg(o)),yield*NI(n)});var ZF=(e,t)=>{let r=YF(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(Ef(e,r,n=>ZI(r,n)),r)},Ii=(e,t)=>le(()=>e.state._tag==="Closed"?t(e.state.exit):(Ef(e,{},t),ye)),QF=(e,t)=>Ii(e,ct(t)),Ef=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},hg=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=pI:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=pI))},Dg=e=>YF(e,void 0),YF=(e="sequential",t)=>({[lI]:lI,[fI]:fI,strategy:e,parent:t,state:pI}),pI={_tag:"Empty"};var Dp=bi,XF=fn(bi),QI=e=>ue(t=>{let r=t.context,n=Dg();return t.setContext(or(t.context,bi,n)),bf(t,o=>(t.setContext(r),Ug(n,o))),e});var Lg=e=>le(()=>{let t=Dg();return Wn(e(t),r=>le(()=>Ug(t,r)??ye))}),Rc=(e,t,r)=>Ei(n=>Ho(o=>oe(Dp,s=>Fc(r?.interruptible?o(e):e,a=>Ii(s,i=>Hn(t(a,i),n)))))),YI=e=>oe(Dp,t=>Ei(r=>Ii(t,n=>Hn(e(n),r)))),eR=(function(){let e=Bn({op:"OnExit",[ft](r){return r._stack.push(this),this.effect},[gc](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Bp),r.interruptible=!1)},[tr](r,n,o){o??=Me(r);let s;try{s=this.onExit(o)}catch(a){s=an(a)}return s?oe(s,a=>o):o},[Ln](r,n,o){o??=Ir(r);let s;try{s=this.onExit(o)}catch(a){s=an(a)}return s?oe(JF(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),zo=(e,t,r)=>new eR(e,t,r),bf=(e,t)=>{e._stack.push(new eR(void 0,t,void 0))},Wn=l(2,zo),tR=l(2,(e,t)=>Wn(e,r=>t)),XI=l(3,(e,t,r)=>Wn(e,n=>t(n)?r(n):ye)),e0=l(3,(e,t,r)=>Wn(e,n=>{let o=t(n);return be(o)?ye:r(o.success,n)})),t0=l(2,(e,t)=>e0(e,pF,t)),rR=l(3,(e,t,r)=>XI(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),r0=l(3,(e,t,r)=>Wn(e,n=>{if(n._tag!=="Failure")return ye;let o=t(n.cause);return be(o)?ye:r(o.success,n.cause)})),nR=l(2,(e,t)=>r0(RP,t)(e)),Lp=(e,t,r)=>Ho(n=>oe(e,o=>zo(le(()=>n(t(o))),s=>r(o,s),!0))),oR=e=>Rc(e,t=>O(t,Symbol.asyncDispose)?AI(()=>t[Symbol.asyncDispose]()):Q(()=>t[Symbol.dispose]())),n0=l(2,(e,t)=>Q(()=>sR(e,typeof t=="function"?r=>Lr(pt(t(r))):ct(Lr(pt(t)))))),C3=ct(1/0),sR=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,bf(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,Rp(i.fiber)}),dg(i.fiber));return[ue(a=>{if(o!==void 0)return a===o.fiber?dg(o.fiber):s(a,o);if(n!==void 0&&(r===1/0||a.getRef(Jr).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(Jr),c={fiber:new _p(a.context),awaiters:0};o=c;let u=s(a,c);return c.fiber.evaluate(zo(e,f=>{if(o!==c||(o=void 0,$I(f)))return;let p=t(f);r=p===1/0?1/0:i.currentTimeMillisUnsafe()+p,n=f})),c.fiber._exit??u}),Q(()=>{n=void 0})]},aR=l(2,(e,t)=>Re(n0(e,t),r=>r[0])),iR=e=>Q(()=>sR(e,C3)[0]),cR=ue(e=>Ge(_c(e.id))),Mc=e=>ue(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Bp)),e)),uR=io({op:"SetInterruptible",[gc](e){if(e.interruptible=this[ge],e._interruptedCause&&e.interruptible)return()=>Ge(e._interruptedCause)}}),Bp=uR(!0),w3=uR(!1),fR=e=>{if(e.interruptible=!0,e._stack.push(w3),e._interruptedCause)return Ge(e._interruptedCause)},T3=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Bp))};var Bg=e=>ue(t=>t.interruptible?e:fR(t)??e),Ho=e=>ue(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Bp),e(Bg)):e(D)),lR=e=>ue(t=>{if(t.interruptible)return e(D);let r=fR(t),n=e(Mc);return r??n}),pR=Re(Rc(Q(()=>new AbortController),e=>Q(()=>e.abort())),e=>e.signal),jp=(e,t)=>Cs(e)?t?.mode==="result"?zn(e,yi,t):zn(e,D,t):t?.discard?t.mode==="result"?zn(Object.values(e),yi,t):zn(Object.values(e),D,t):le(()=>{let r={};return un(zn(Object.entries(e),([n,o])=>Re(t?.mode==="result"?yi(o):o,s=>{z(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),o0=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>Re(zn(e,(n,o)=>yi(t(n,o)),r),n=>jb(n,D))),dR=l(3,(e,t,r)=>{let n=Xe(e);return n.length===0?Q(t):le(()=>{let o=0,s=t();return Re(Ds({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),mR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>oe(o0(e,t,{concurrency:r?.concurrency}),([n,o])=>Dr(o)?yt(o):r?.discard?ye:q(n))),hR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(A()):gR(r,0,t,n.value)})),gR=(e,t,r,n)=>oe(r(n,t),o=>{if(o)return q(v(n));let s=e.next();return s.done?q(A()):gR(e,t+1,r,s.value)}),xR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(A()):yR(r,0,t,n.value)})),yR=(e,t,r,n)=>oe(r(n,t),o=>{if(xt(o))return q(v(o.success));let s=e.next();return s.done?q(A()):yR(e,t+1,r,s.value)}),Ds=io({op:"While",[tr](e,t){return this[ge].step(e),this[ge].while()?(t._stack.push(this),this[ge].body()):Kr},[ft](e){return this[ge].while()?(e._stack.push(this),this[ge].body()):Kr}}),zn=l(e=>typeof e[1]=="function",(e,t,r)=>le(()=>{let n=zp(r?.concurrency);if(n===1)return k3(e,t,r);let o=Xe(e),s=o.length;if(s===0)return r?.discard?ye:q([]);let a=r?.discard?void 0:new Array(s),i=A3({f:t,out:a},o,{concurrency:n});return i?un(i,a):q(a)})),SR=e=>oe(e,t=>{let r=t[Symbol.iterator]().next();return r.done?yt(new As):q(r.value)}),k3=(e,t,r)=>le(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return un(Ds({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),zp=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),jg=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,u)=>oe(Up(u),f=>r(s,a[i],f,i)??o(s,a,i+1,c)??ye),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let u=a[i],f=t(s,u,i);if(!je(f))return n(s,a,i,c,f);let p=r(s,u,f,i);if(p)return p._tag==="Failure"?p:void 0}};return o},ER=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,u=!1,f,p,d,m,x,y=w=>{let T=an(w);return m=T,u=!0,p&&p.size>0?oe(Mc(ff(Array.from(p))),()=>m??T):T},E=()=>{let w=!1;for(;!m&&a<i;a++){let T=o[a],M=x??t(n,T,a);if(je(M)){if(m=r(n,T,M,a),m)break}else if(f){x=void 0;let P=$c(f,M,!0,!0,"inherit");if(P._exit){if(m=r(n,T,P._exit,a),m)break;continue}p.add(P);let h=a;if(P.addObserver(S=>{p.delete(P);try{if(m){if(S._tag==="Failure"){let b=S.cause.reasons.filter(C=>C._tag!=="Interrupt");if(b.length>0){let C=da(b);m=Ir(m._tag==="Failure"?vh(m.cause,C):C)}}}else{let b=r(n,T,S,h);b&&(m=b,E())}if(w){let b=E();b&&d(b)}else u&&p.size===0&&d(m??ye)}catch(b){d(y(b))}}),p.size<c)continue;w=!0,a++;return}else return Bt(P=>{f=Ea(),p=new Set,x=M,d=P;let h;try{h=E()}catch(S){return P(y(S))}return h?P(h):le(()=>(m??=Kr,oe(p?ff(p):ye,()=>m?._tag==="Failure"?m:ye)))})}if(u=!0,m){if(p&&p.size>0){let T=Tg(f);p.forEach(M=>M.interruptUnsafe(f.id,T));return}if(d||m._tag==="Failure")return m}else if(d)if(p)p.size===0&&d(ye);else return Kr};return E()}},zg=()=>e=>ER(e),A3=ER({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;e.out&&(e.out[n]=r.value)}}),s0=l(3,(e,t,r)=>oe(e,n=>t(n)?q(n):r(n))),a0=l(3,(e,t,r)=>oe(e,n=>{let o=t(n);return be(o)?r(o.failure):q(o.success)})),bR=l(e=>de(e[0]),(e,t,r)=>a0(e,t,r?n=>yt(r(n)):()=>yt(new As))),IR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>le(()=>{let n=[];return un(zn(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&n.push(o),ye):Re(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),CR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=[];for(let n of e){let o=t(n);xt(o)&&r.push(o.success)}return q(r)})),wR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>le(()=>{let n=[];return un(zn(e,o=>Re(t(o),s=>{xt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),TR=q({}),kR=Fh(Re),AR=Rh(Re,oe),vR=Ph(Re);var OR=l(e=>de(e[0]),(e,t)=>ue(r=>(z3(),q($c(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),$c=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new _p(s.context,a);return n||(s.children().add(i),i._parent=s),r?i.evaluate(t):(i._asyncContext=LP(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),i},_R=l(e=>de(e[0]),(e,t)=>ue(r=>q($c(r,e,t?.startImmediately,!0,t?.uninterruptible)))),PR=e=>ue(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return zo(e,o=>{let s=t._children;if(s===void 0||s.size===0)return ye;r&&(s=q_(s,i=>!r.has(i)));let a=Mp(kg(s));return n?Bg(a):a})}),i0=l(e=>de(e[0]),(e,t,r)=>ue(n=>{let o=$c(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};Ef(t,s,()=>GP(i=>i===o.id?ye:Rp(o))),o.addObserver(()=>hg(t,s))}else o.interruptUnsafe(n.id,Tg(n));return q(o)})),FR=l(e=>de(e[0]),(e,t)=>oe(Dp,r=>i0(e,r,t))),Ta=e=>(t,r)=>{let n=new _p(r?.scheduler?or(e,Tp,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}return r?.onFiberStart&&r.onFiberStart(n),n},RR=l(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(hg(t,e),Ef(t,e,()=>Rp(e)),e.addObserver(()=>hg(t,e)),e)),MR=Ta(nr()),c0=e=>{let t=Ta(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},$R=c0(nr()),Hg=e=>{let t=Ta(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},NR=Hg(nr()),u0=e=>{let t=Hg(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw Cg(o.cause);return o.value})},UR=u0(nr()),qg=e=>{let t=Ta(e);return r=>{if(je(r))return r;let n=new wc("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??an(new Eg(o))}},DR=qg(nr()),f0=e=>{let t=qg(e);return r=>{let n=t(r);if(n._tag==="Failure")throw Cg(n.cause);return n.value}},LR=f0(nr()),AP=q(!0),vP=q(!1),dI=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return AP;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],AP}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](Kr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](Kr)}open=ue(t=>this._isOpen?vP:(this._isOpen=!0,this.scheduleUnsafe(t)));release=ue(t=>this._isOpen?vP:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Bt(t=>this._isOpen?t(ye):(this.waiters.push(t),Q(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=Q(()=>this.closeUnsafe());whenOpen=t=>oe(this.await,()=>t);isOpen(){return this._isOpen}},l0=e=>new dI(e??!1),BR=e=>Q(()=>l0(e)),jR=ue(e=>q(e.getRef(rI))),zR=l(2,(e,t)=>fn(e,rI,t)),HR=fn(ug),qR=fn(Ac),gg=BigInt(0),v3={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:gg,endTime:gg,exit:Kr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},O3=e=>Object.assign(Object.create(v3),e),WR=e=>e?$e(e.annotations,cg)?e._tag==="Span"?WR(Cr(e.parent)):A():v(e):A(),p0=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&$e(r.annotations,cg),o=r?.parent!==void 0?v(r.parent):r?.root?A():WR(e.cache.span),s;if(n)s=O3({name:t,parent:o,annotations:or(r?.annotations??nr(),cg,!0)});else{let a=e.cache.tracer??nI,i=e.getRef(Jr),c=e.getRef(Ac),u=e.getRef(vp),f=e.getRef(Op),p=r?.level??e.getRef(xP),d=r?.links!==void 0?[...f,...r.links]:f.length===0?[]:f.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??nr(),links:d,startTime:c?i.currentTimeNanosUnsafe():gg,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(fe(o)&&o.value.sampled===!1?!1:!oM(e.getRef(yP),p))});for(let m in u)s.attribute(m,u[m]);if(r?.attributes!==void 0)for(let m in r.attributes)s.attribute(m,r.attributes[m])}return s},VR=(e,t)=>ue(r=>q(p0(r,e,t))),Pp=(e,t)=>Mc(ue(r=>{let n=fo(r.context,bi),o=p0(r,e,t??{}),s=r.getRef(Jr),a=r.getRef(Ac);return un(Ii(n,i=>Wg(o,i,s,a)),o)})),GR=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=xi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return oe(Pp(t,r),o=>lf(n,o,r))}return n=>oe(Pp(t,r),o=>lf(n,o,r))},_3=(e,t)=>(t=typeof t=="function"?t:ao,Ia(Ap,r=>({name:e,stack:t,parent:r}))),KR=vp,JR=Op,ZR=l(e=>de(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Ia(e,Op,s=>[...s,...o])}),Wg=(e,t,r,n)=>Q(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():gg,t)}),Fp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return ue(o=>{let s=p0(o,e,r),a=o.getRef(Jr),i=o.getRef(Ac);return bf(o,c=>Wg(s,c,a,i)),n(s)})},mI=fn(kc),lf=function(){let e=de(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=D;return t._tag==="Span"&&(r=xi(r),n=_3(t.name,r?.captureStackTrace)),e?mI(n(arguments[0]),t):o=>mI(n(o),t)},QR=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=xi(arguments[2]);if(e){let s=arguments[0];return Fp(t,arguments[2],a=>lf(s,a,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>Fp(t,n?n(...a):o,i=>lf(s,i,r))},YR=l(e=>de(e[0]),(e,...t)=>Ia(e,vp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||z(n,t[0],t[1]),n})),XR=(...e)=>ue(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return ye}),eM=ue(e=>{let t=e.currentSpanLocal;return t?q(t):yt(new As)}),tM=d3(kc),Jr=Te("effect/Clock",{defaultValue:()=>new hI}),aI=2**31-1,hI=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Q(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return P3()}currentTimeNanos=Q(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return nM()}monotonicTimeNanos=Q(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Lr(t))}sleepMillis(t){return t<=0?mf:Number.isFinite(t)?Bt(r=>{let n=t>aI?this.sleepMillis(t-aI):ye,o=setTimeout(()=>r(n),Math.min(t,aI));return Q(()=>clearTimeout(o))}):vg}},rM=BigInt(1e6),nM=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*rM;return r>t&&(t=r),t}})(),P3=(function(){let e=BigInt(1e9),t;return()=>{let r=nM(),n=BigInt(Date.now())*rM;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),qo=e=>ue(t=>e(t.getRef(Jr))),If=e=>qo(t=>t.sleep(pt(e))),d0=qo(e=>e.currentTimeMillis);var gI="~effect/Cause/TimeoutError";var xg=class extends ma("TimeoutError"){[gI]=gI;constructor(t){super({message:t})}},xI="~effect/Cause/IllegalArgumentError";var yg=class extends ma("IllegalArgumentError"){[xI]=xI;constructor(t){super({message:t})}},yI="~effect/Cause/ExceededCapacityError";var Sg=class extends ma("ExceededCapacityError"){[yI]=yI;constructor(t){super({message:t})}},SI="~effect/Cause/AsyncFiberError";var Eg=class extends ma("AsyncFiberError"){[SI]=SI;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},EI="~effect/Cause/UnknownError";var pf=class extends ma("UnknownError"){[EI]=EI;constructor(t,r){super({message:r,cause:t})}},m0=Te("effect/Console",{defaultValue:()=>globalThis.console}),F3=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},R3=Ab(ha,F3),oM=nf(R3),h0=Te("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([B3,j3])}),M3=Te("effect/Logger/LogToStderr",{defaultValue:Ql}),sM=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Mc(ue(t=>{let r=t.getRef(Sa),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];z(n,s,a)}return t.setContext(or(t.context,Sa,n)),Ii(fo(t.context,bi),o=>{let s=t.getRef(Sa),a={...s};for(let i=0;i<e.length;i++){let[c,u]=e[i];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?z(a,c,r[c]):delete a[c])}return t.setContext(or(t.context,Sa,a)),ye})}))},$3="~effect/Logger",N3={[$3]:{_Message:D,_Output:D},pipe(){return ne(this,arguments)}},aM=e=>{let t=Object.create(N3);return t.log=e,t},U3=e=>e.replace(/[\s="]/g,"_"),D3=(e,t)=>`${U3(e[0])}=${t-e[1]}ms`;var Wo=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Ju(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?da(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=Sb),ue(n=>{let o=e??n.cache.logLevel;if(oM(n.cache.minimumLogLevel,o))return ye;let s=n.getRef(Jr),a=n.getRef(h0);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:r,fiber:n,date:i,logLevel:o,message:t})}return ye})};var vc={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Fpe={None:[],All:[],Trace:[vc.gray],Debug:[vc.blue],Info:[vc.green],Warn:[vc.yellow],Error:[vc.red],Fatal:[vc.bgBrightRed,vc.black]};var L3=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var B3=aM(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(wg(e));let a=t.getTime(),i=r.getRef(lg),c="";for(let d of i)c+=` ${D3(d,a)}`;let u=r.getRef(Sa);Object.keys(u).length>0&&s.push(u);let f=r.getRef(m0);(r.getRef(M3)?f.error:f.log)(`[${L3(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),j3=aM(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Jr),s=t.getRef(Sa),a=t.cache.span;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,u]of Object.entries(s))z(i,c,u);i["effect.fiberId"]=t.id,i["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=wg(e)),a.event(YO(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function z3(){uI.interruptChildren??=i3}var g0=q(void 0);var iM=l(e=>de(e[0]),(e,t)=>t0(e,r=>ue(n=>(H3(n,r,t?.defectsOnly),ye)))),H3=(e,t,r)=>{let n=e.getRef(bP);if(n.size===0||r&&!FP(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Jr).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var cM=Ju,uM=t_,Vg=Bo;var Hp=da;var fM=Zu,Cf=Eb;var x0=e=>new xc(e),y0=e=>new cp(e),lM=OP,qp=Ig,Ci=MP;var Nc=Cg,pM=_P;var dM=go;var Gg=bg;var mM=wg;var Wp=o_;var Vp=Ec,ee=a_;var Kg=yg;var hM=Sg;var gM=pf;var V={};$n(V,{Do:()=>K6,Transaction:()=>_f,TypeId:()=>B6,abortSignal:()=>tJ,acquireDisposable:()=>VK,acquireRelease:()=>Qr,acquireUseRelease:()=>P$,addFinalizer:()=>Ix,all:()=>dx,andThen:()=>Kt,annotateCurrentSpan:()=>pJ,annotateLogs:()=>HJ,annotateLogsScoped:()=>qJ,annotateSpans:()=>lJ,as:()=>at,asSome:()=>gx,asVoid:()=>Oi,awaitAllChildren:()=>kJ,bind:()=>Q6,bindTo:()=>J6,cached:()=>cC,cachedInvalidateWithTTL:()=>YK,cachedWithTTL:()=>QK,callback:()=>fr,catch:()=>Jo,catchCause:()=>Ct,catchCauseFilter:()=>lK,catchCauseIf:()=>fK,catchDefect:()=>eC,catchEager:()=>hd,catchFilter:()=>fd,catchIf:()=>cK,catchNoSuchElement:()=>uK,catchReason:()=>sK,catchReasons:()=>aK,catchTag:()=>_a,catchTags:()=>X0,clockWith:()=>Gs,context:()=>Fi,contextWith:()=>ld,currentParentSpan:()=>mJ,currentSpan:()=>dJ,delay:()=>tC,die:()=>lr,effectify:()=>St,ensuring:()=>Ra,eventually:()=>gK,exit:()=>bo,fail:()=>k,failCause:()=>dt,failCauseSync:()=>Oa,failSync:()=>hx,fiber:()=>AJ,fiberId:()=>vJ,filter:()=>Sx,filterMap:()=>PK,filterMapEffect:()=>nC,filterMapOrElse:()=>RK,filterMapOrFail:()=>$K,filterOrElse:()=>FK,filterOrFail:()=>MK,findFirst:()=>q6,findFirstFilter:()=>W6,firstSuccessOf:()=>wK,flatMap:()=>I,flatMapEager:()=>Qt,flatten:()=>Z0,flip:()=>oK,fn:()=>$J,fnUntraced:()=>N,fnUntracedEager:()=>dC,forEach:()=>Eo,forever:()=>vt,forkChild:()=>Rf,forkDetach:()=>TJ,forkIn:()=>Zt,forkScoped:()=>Ma,fromNullishOr:()=>rK,fromOption:()=>eK,fromResult:()=>ud,gen:()=>tt,head:()=>V6,ignore:()=>Pf,ignoreCause:()=>EK,interrupt:()=>En,interruptible:()=>XK,interruptibleMask:()=>eJ,isEffect:()=>Sn,isFailure:()=>BK,isSuccess:()=>jK,let:()=>Z6,linkSpans:()=>xJ,log:()=>NJ,logDebug:()=>BJ,logError:()=>dd,logFatal:()=>UJ,logInfo:()=>LJ,logTrace:()=>jJ,logWarning:()=>DJ,logWithLevel:()=>wx,makeSpan:()=>fC,makeSpanScoped:()=>yJ,map:()=>F,mapBoth:()=>pK,mapBothEager:()=>Tr,mapEager:()=>qc,mapError:()=>Jt,mapErrorEager:()=>md,match:()=>Pi,matchCause:()=>UK,matchCauseEager:()=>DK,matchCauseEffect:()=>Fa,matchCauseEffectEager:()=>LK,matchEager:()=>NK,matchEffect:()=>oC,never:()=>zc,onError:()=>Zo,onErrorFilter:()=>KK,onErrorIf:()=>GK,onExit:()=>Jn,onExitFilter:()=>ZK,onExitIf:()=>JK,onExitPrimitive:()=>pd,onInterrupt:()=>uC,option:()=>nK,orDie:()=>Pa,orElseSucceed:()=>CK,partition:()=>j6,promise:()=>mx,provide:()=>sC,provideContext:()=>pn,provideService:()=>dn,provideServiceEffect:()=>iC,race:()=>_K,raceAll:()=>rC,raceAllFirst:()=>OK,raceFirst:()=>Hs,reduce:()=>z6,repeat:()=>rJ,repeatOrElse:()=>nJ,replicate:()=>oJ,replicateEffect:()=>sJ,request:()=>CJ,requestUnsafe:()=>wJ,result:()=>Q0,retry:()=>xK,retryOrElse:()=>yK,runCallback:()=>_J,runCallbackWith:()=>OJ,runFork:()=>Yo,runForkWith:()=>Io,runPromise:()=>lC,runPromiseExit:()=>Cx,runPromiseExitWith:()=>PJ,runPromiseWith:()=>pC,runSync:()=>FJ,runSyncExit:()=>Vs,runSyncExitWith:()=>MJ,runSyncWith:()=>RJ,sandbox:()=>SK,satisfiesErrorType:()=>nZ,satisfiesServicesType:()=>oZ,satisfiesSuccessType:()=>rZ,schedule:()=>aJ,scheduleFrom:()=>F$,scope:()=>Hc,scoped:()=>qs,scopedWith:()=>bx,service:()=>aC,serviceOption:()=>Ff,setContext:()=>zK,sleep:()=>_i,spanAnnotations:()=>hJ,spanLinks:()=>gJ,succeed:()=>g,succeedNone:()=>jc,succeedSome:()=>J0,suspend:()=>L,sync:()=>U,tap:()=>jr,tapCause:()=>yx,tapCauseFilter:()=>hK,tapCauseIf:()=>mK,tapDefect:()=>_$,tapError:()=>xx,tapErrorTag:()=>dK,timed:()=>vK,timeout:()=>TK,timeoutOption:()=>kK,timeoutOrElse:()=>AK,tracer:()=>iJ,track:()=>VJ,trackDefects:()=>JJ,trackDuration:()=>ZJ,trackErrors:()=>KJ,trackSuccesses:()=>GJ,transposeOption:()=>tK,try:()=>Rt,tryPromise:()=>vi,tx:()=>QJ,txRetry:()=>tZ,undefined:()=>G6,uninterruptible:()=>Qo,uninterruptibleMask:()=>Ws,unwrapReason:()=>iK,updateContext:()=>HK,updateService:()=>qK,updateServiceScoped:()=>WK,useSpan:()=>SJ,validate:()=>H6,void:()=>W,when:()=>Ex,whileLoop:()=>Ko,withErrorReporting:()=>IK,withExecutionPlan:()=>bK,withFiber:()=>Kn,withFiberSucceed:()=>X6,withLogSpan:()=>WJ,withLogger:()=>zJ,withParentSpan:()=>IJ,withSpan:()=>EJ,withSpanScoped:()=>bJ,withTracer:()=>cJ,withTracerEnabled:()=>uJ,withTracerTiming:()=>fJ,yieldNow:()=>cd,yieldNowWith:()=>Y6,zip:()=>Y0,zipWith:()=>O$});var Jg=up,Zr=Me,Vn=Ir,Vo=jn,xM=an,yM=gf,Gt=Kr;var et=xf,ka=lF;var SM=$I;var EM=xF;var bM=NI;var q3="~effect/Deferred";var W3={[q3]:{_A:D,_E:D},pipe(){return ne(this,arguments)}},IM=function(){this.resumes=void 0,this.effect=void 0};IM.prototype=W3;var Aa=()=>new IM;var wi=e=>Bt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),Q(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var V3=l(2,(e,t)=>Q(()=>xo(e,t))),G3=V3;var K3=l(2,(e,t)=>G3(e,Ir(t)));var S0=l(2,(e,t)=>K3(e,_c(t))),E0=e=>Q(()=>b0(e)),b0=e=>e.effect!==void 0;var xo=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var CM=Sa;var wM=lg;var TM=fg;var kM=Ac;var ln=bi;var yo=Dg,va=XF,Ls=Ii,cr=QF;var ur=ZF,Ze=ZI;var PM="~effect/Layer",vM="~effect/Layer/MemoMap",J3=(e,t)=>{let r={observers:0,deferred:Aa(),scope:yo(),finalizer:n=>le(()=>--r.observers>0?ye:(e.map.delete(t),Ze(r.scope,n)))};return r},OM=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,Ef(t,{},e.finalizer),!0),FM=e=>O(e,PM),Z3={[PM]:{_ROut:D,_E:D,_RIn:D},pipe(){return ne(this,arguments)}},RM=e=>{let t=Object.create(Z3);return t.build=e,t},I0=e=>RM((t,r)=>{let n=ur(r);return Wn(e(t,n),o=>o._tag==="Failure"?Ze(n,o):ye)}),Q3=e=>{let t=I0((r,n)=>r.getOrElseMemoize(t,n,e));return t},Zg=class{get[vM](){return vM}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(OM(n,r),n.deferred.effect??wi(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return le(()=>{let o;return zo(le(()=>{let s=this.get(t,r);if(s)return s;let a=J3(this,t);return OM(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&xo(o,s)})})}},Jp=()=>new Zg,Y3=e=>new Zg(e);var Kp=class e extends gt()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Wh(t,e);return r?Y3(r):Jp()}},Zp=l(3,(e,t,r)=>fn(Re(le(()=>e.build(t,r)),or(Kp,t)),Kp,t));var Yg=l(2,(e,t)=>ue(r=>Zp(e,Kp.forkOrCreate(r.context),t))),Bs=function(){return arguments.length===1?e=>Qg(xa(arguments[0],e)):Qg(xa(arguments[0],arguments[1]))},Qg=e=>RM(ct(q(e)));var wf=function(){return arguments.length===1?e=>_M(arguments[0],e):_M(arguments[0],arguments[1])},_M=(e,t)=>X3(Re(t,r=>xa(e,r))),X3=e=>Q3((t,r)=>va(e,r));var MM=(e,t,r)=>{let n=ur(r,"parallel");return zn(e,o=>o.build(t,ur(n,"sequential")),{concurrency:e.length}).pipe(Re(o=>U_(...o)))},Xg=(...e)=>I0((t,r)=>MM(e,t,r));var $M=(e,t,r)=>I0((n,o)=>oe(Array.isArray(t)?MM(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Hn(s),Re(a=>r(a,s))))),NM=l(2,(e,t)=>$M(e,t,D)),UM=l(2,(e,t)=>$M(e,t,(r,n)=>Cc(n,r)));var Tf=Jr;var ex="~effect/DateTime",tx="~effect/DateTime/TimeZone",LM={[ex]:ex,pipe(){return ne(this,arguments)},[ot](){return this.toString()},toJSON(){return Xp(this).toJSON()}},t6={...LM,_tag:"Utc",[ae](){return Wt(this.epochMilliseconds)},[ie](e){return Af(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Xp(this).toJSON()})`}},r6={...LM,_tag:"Zoned",[ae](){return xe(Wt(this.epochMilliseconds))(Y(this.zone))},[ie](e){return Af(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Z(this.zone,e.zone)},toString(){return`DateTime.Zoned(${M0(this)})`}},BM={[tx]:tx,[ot](){return this.toString()}},n6={...BM,_tag:"Named",[ae](){return De(`Named:${this.id}`)},[ie](e){return Uc(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},o6={...BM,_tag:"Offset",[ae](){return De(`Offset:${this.offset}`)},[ie](e){return Uc(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${P0(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},js=(e,t,r)=>{let n=Object.create(r6);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},Af=e=>O(e,ex);var Uc=e=>O(e,tx),jM=e=>Uc(e)&&e._tag==="Offset",zM=e=>Uc(e)&&e._tag==="Named",HM=e=>e._tag==="Utc",T0=e=>e._tag==="Zoned",qM=Ur((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var WM=e=>{let t=Object.create(t6);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},kf=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Kg("Invalid date");return WM(t)},nx=e=>{if(Af(e))return e;if(e instanceof Date)return kf(e);if(typeof e=="object"){if("epochMilliseconds"in e)return kf(new Date(e.epochMilliseconds));let t=new Date(0);return p6(t,e),kf(t)}else if(typeof e=="string"&&!s6(e))return kf(new Date(e+"Z"));return kf(new Date(e))},s6=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),a6=-864e13+720*60*1e3,i6=864e13-840*60*1e3,k0=(e,t)=>{let r=t?.timeZone;if(r===void 0&&Af(e)&&T0(e))return e;let n=nx(e);if(n.epochMilliseconds<a6||n.epochMilliseconds>i6)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e=="object"&&"timeZoneId"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Yp(s)}else if(Uc(r))o=r;else if(typeof r=="number")o=Yp(r);else{let s=O0(r);if(me(s))throw new Kg(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?js(n.epochMilliseconds,o,n.partsUtc):d6(n.epochMilliseconds,o,t?.disambiguation??"compatible")},C0=jo(k0),VM=jo(nx),c6=/^(.{17,35})\[(.+)\]$/,GM=e=>{let t=c6.exec(e);if(t===null){let o=R0(e);return o!==null?C0(e,{timeZone:o}):A()}let[,r,n]=t;return C0(r,{timeZone:n})};var KM=e=>WM(e.epochMilliseconds);var rx=new Map,u6={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},f6=e=>{let t=e.resolvedOptions().timeZone,r=rx.get(t);if(r!==void 0)return r;let n=Object.create(n6);return n.id=t,n.format=e,rx.set(t,n),n},A0=e=>{let t=rx.get(e);if(t!==void 0)return t;try{let r=f6(new Intl.DateTimeFormat("en-US",{...u6,timeZone:e}));return rx.set(e,r),r}catch{throw new Kg(`Invalid time zone: ${e}`)}},Yp=e=>{let t=Object.create(o6);return t.offset=e,t},v0=jo(A0);var l6=/^(?:GMT|[+-])/,O0=e=>{if(l6.test(e)){let t=R0(e);return t===null?A():v(Yp(t))}return v0(e)},JM=e=>e._tag==="Offset"?P0(e.offset):e.id;var Xp=e=>new Date(e.epochMilliseconds),ox=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(n=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type==="fractionalSecond"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},_0=e=>ox(e).getTime()-F0(e),P0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},ZM=e=>P0(_0(e)),F0=e=>e.epochMilliseconds;var p6=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var DM=1440*60*1e3,d6=(e,t,r)=>{if(t._tag==="Offset")return js(e-t.offset,t);let n=Qp(e-DM,e,t),o=Qp(e+DM,e,t);if(n===o)return js(e-n,t);let s=n<o,a=n-o;if(s){if(Qp(e-o,e,t)===o)return js(e-o,t);let u=js(e-n,t),f=ox(u).getTime();if(e!==f)switch(r){case"reject":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case"earlier":return js(e-o,t);case"compatible":case"later":return u}return u}if(Qp(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||Qp(e-n+a,e+a,t)===n)return js(e-n,t);if(r==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return js(e-o,t)},m6=/([+-])(\d{2}):(\d{2})$/,R0=e=>{let t=m6.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Qp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=R0(n);return o===null?_0(js(t,r)):o};var QM=e=>Xp(e).toISOString();var w0=e=>{let t=ox(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${ZM(e)}`},M0=e=>e.zone._tag==="Offset"?w0(e):`${w0(e)}[${e.zone.id}]`;var hde=globalThis.Number;var XM=l(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=YM(e),[o,s]=YM(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),u=i%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${a}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f});function YM(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf("e"),n=t.slice(0,r).replace(".","");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var e$=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var t$=l(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var xde=globalThis.String,sx=Nn;var n$=e=>e.trim();var o$=(e,t,r)=>{let n=r*(t-e)+e;if(n!==t||e>=t||!Number.isFinite(t))return n;if(t===0)return-Number.MIN_VALUE;let o=new DataView(new ArrayBuffer(8));o.setFloat64(0,t);let s=o.getBigUint64(0);return o.setBigUint64(0,t>0?s-BigInt(1):s+BigInt(1)),o.getFloat64(0)};var ze=l(2,(e,t)=>Ca(e,x6,r=>t(r))),zs=e=>e.reasons.some(N0),N0=e=>e._tag==="Fail"&&Wp(e.error),ed=e=>{let t,r=!1;for(let n of e.reasons)N0(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?X(e):r?X(Hp(e.reasons.filter(n=>!N0(n)))):G(t)};var x6=e=>{let t=ed(e);return be(t)?t:G(t.success.value)},ax=e=>{let t=ed(e);return be(t)?Vn(t.failure):Zr(t.success.value)},ix=l(2,(e,t)=>Ns(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=ed(r);return be(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var s$="~effect/Schedule";var wr=Te("effect/Schedule/CurrentMetadata",{defaultValue:ct({input:void 0,output:void 0,duration:hi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),y6={[s$]:{_Out:D,_In:D,_Env:D},pipe(){return ne(this,arguments)}},U0=e=>O(e,s$),td=e=>{let t=Object.create(y6);return t.step=e,t},D0=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,a=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:a}}},S6=e=>td(Re(e,t=>{let r=D0();return(n,o)=>t(r(n,o))})),Dc=e=>qn(e.step,t=>q(()=>Ge(t))),Go=e=>qo(t=>Re(Dc(e),r=>{let n=D0();return o=>le(()=>{let s=t.currentTimeMillisUnsafe();return oe(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,un(If(i),c)})})})),rd=e=>Re(Go(e),t=>r=>Re(t(r),n=>n.output));var L0=e=>td(Re(Dc(e),t=>(r,n)=>ix(t(r,n),{onSuccess:o=>q([n,o[1]]),onFailure:Ge,onDone:()=>ee(n)}))),a$=e=>nd(od,({attempt:t})=>q(t<=e)),B0=e=>{let t=pt(e);return S6(q(r=>q([r.attempt-1,t])))};var nd=l(2,(e,t)=>td(Re(Dc(e),r=>{let n=D0();return(o,s)=>oe(r(o,s),a=>{let[i,c]=a,u=t({...n(o,s),output:i,duration:c});return oe(de(u)?u:q(u),f=>f?q(a):ee(i))})})));var od=B0(hi);var i$="~effect/ExecutionPlan";var E6={[i$]:i$,get captureRequirements(){let e=this;return Ei(t=>q(b6(e.steps.map(r=>({...r,while:r.while?n=>Hn(r.while(n),t):void 0,schedule:r.schedule?td(Hn(Re(Dc(r.schedule),n=>(o,s)=>Hn(n(o,s),t)),t)):void 0,provide:FM(r.provide)?NM(r.provide,Qg(t)):r.provide})))))},pipe(){return ne(this,arguments)}},b6=e=>{let t=Object.create(E6);return t.steps=e,t};var cx=Te("effect/ExecutionPlan/CurrentMetadata",{defaultValue:ct({attempt:0,stepIndex:0})});var I6=(e,t,r)=>Lg(n=>oe(r?.local?Zp(t,Jp(),n):Yg(t,n),o=>Hn(e,o))),ux=l(e=>de(e[0]),(e,t,r)=>xp(t)?Hn(e,t):I6(e,Array.isArray(t)?Xg(...t):t,r));var u$=e=>e.reasons.every(Bo)?go(e):X(e),z0=l(3,(e,t,r)=>oe(Go(t),n=>{let o=wr.defaultValue();return Ca(ze(Fg(Fc(oe(le(()=>fn(e,wr,o)),n),s=>Q(()=>{o=s})),{disableYield:!0}),s=>q(s)),u$,s=>r(s,o.attempt===0?A():v(o)))})),H0=l(3,(e,t,r)=>oe(Go(t),n=>{let o=wr.defaultValue(),s,a=Ca(le(()=>fn(e,wr,o)),u$,i=>(s=i,oe(n(i),c=>(o=c,a))));return ze(a,i=>ui(()=>r(s,i)))})),f$=l(2,(e,t)=>{let r=typeof t=="function"?t(D):U0(t)?t:ad(t);return z0(e,r,yt)}),sd=l(2,(e,t)=>{let r=typeof t=="function"?t(D):U0(t)?t:ad(t);return H0(e,r,yt)}),l$=l(3,(e,t,r)=>oe(Go(r),n=>{let o=wr.defaultValue(),s=le(()=>fn(e,wr,o));return ze(oe(n(t),a=>{o=a;let i=ct(oe(s,n));return Ds({while:sn,body:i,step(c){o=c}})}),a=>q(a))})),C6=L0(od),ad=e=>{let t=e.schedule?L0(e.schedule):C6;return e.while&&(t=nd(t,({input:r})=>{let n=e.while(r);return de(n)?n:q(n)})),e.until&&(t=nd(t,({input:r})=>{let n=e.until(r);return de(n)?Re(n,o=>!o):q(!n)})),e.times!==void 0&&(t=nd(t,({attempt:r})=>q(r<=e.times))),t};var q0=(e,t)=>{let r=-1,n=0,o=s=>$g(e(s));return{begin:qo(s=>le(()=>{let a=t();a.stepIndex!==r&&(r=a.stepIndex,n=0),n++;let i={attempt:a.attempt,stepAttempt:n,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return un(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>qo(i=>{let c=Fs(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag==="Success"?{_tag:"AttemptSuccess",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:"AttemptFailure",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},d$=l(e=>de(e[0]),(e,t,r)=>le(()=>{let n=0,o={attempt:0,stepIndex:0},s=Pg(cx,Q(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:q0(r.onEvent,()=>o),i=a===void 0?D:u=>Ho(f=>oe(a.begin,p=>Wn(f(u),d=>a.end(p,d)))),c;return oe(Ds({while:()=>n<t.steps.length&&(c===void 0||be(c)),body(){let u=t.steps[n],f=s(i(ux(e,u.provide)));if(c){let p=!1,d=f;f=le(()=>p?d:(p=!0,df(c))),f=sd(f,id(u,!1))}else{let p=id(u,!0);f=p?sd(f,p):f}return yi(f)},step(u){c=u,n++}}),()=>df(c))})),id=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return ad({schedule:e.schedule?e.schedule:e.attempts?void 0:w6,times:e.attempts,while:e.while});return ad({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},w6=a$(1);var h$="~effect/MutableHashMap";var T6={[h$]:h$,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${j(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:er(Array.from(this))}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},Lc=()=>{let e=Object.create(T6);return e.backing=new Map,e.buckets=new Map,e};var Gn=l(2,(e,t)=>{if(e.backing.has(t))return v(e.backing.get(t));if(W0(t))return A();let r=Y(t),n=e.buckets.get(r);return n===void 0?A():k6(e,n,t)}),W0=e=>typeof e!="object"&&typeof e!="function";var k6=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(Z(r,t[n])){let s=t[n];return v(e.backing.get(s))}return A()},V0=l(2,(e,t)=>fe(Gn(e,t))),Bc=l(3,(e,t,r)=>{if(e.backing.has(t)||W0(t))return e.backing.set(t,r),e;let n=Y(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=A6(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),A6=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(Z(t,e[r]))return e[r]};var Ai=l(2,(e,t)=>{if(W0(t))return e.backing.delete(t),e;let r=Y(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a===t||Z(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),fx=e=>(e.backing.clear(),e.buckets.clear(),e),g$=e=>e.backing.size;var v6="~effect/Request",O6=KO({_E:e=>e,_A:e=>e,_R:e=>e}),Lde={...e_,[v6]:O6};var x$=e=>e;var S$=l(2,(e,t)=>{let r=n=>Bt(o=>{let s=b$(n,e,o,Ea());return R6(n,s)});return de(t)?oe(t,r):r(t)}),E$=(e,t)=>{let r=b$(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:$e(t.context,Tp)}});return()=>I$(t.resolver,r)},P6=new WeakSet,F6=e=>{if(!P6.has(e.batchKey))return new Map;let t=Lc();return{get:r=>Cr(Gn(t,r)),has:r=>V0(t,r),set:(r,n)=>Bc(t,r,n),delete:r=>Ai(t,r)}},px=[],G0=new WeakMap,b$=(e,t,r,n)=>{let o=G0.get(e);o||(o=F6(e),G0.set(e,o));let s,a=!1,i=x$({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(px.length>0)s=px.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:oe(le(()=>u.resolver.delay),f=>y$(u)),run:Wn(le(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let p of u.entrySet)p.completeUnsafe(f._tag==="Success"?an(new Error("Effect.request: RequestResolver did not complete request",{cause:p.request})):f);return u.entries.clear(),px.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,px.push(u)),ye})};s=u}o.set(c,s),s.fiber=Ta(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=Ta(n.context)(y$(s),{scheduler:n.cache.scheduler})),i},I$=(e,t)=>{if(t.uninterruptible)return;let r=G0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(gf()),s?.interruptUnsafe()},R6=(e,t)=>Q(()=>I$(e,t));function y$(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):ye}var $6="effect/Metric/CurrentMetricAttributes",N6=Te($6,{defaultValue:()=>({})}),U6="effect/Metric/MetricRegistry",D6=Te(U6,{defaultValue:()=>new Map}),C$="~effect/Metric",w$=class{[C$]=C$;#t;#e="";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=$e(t,N6);r!==this.#t&&(this.#t=r,this.#e=L6(this,T$(this.attributes,r)));let n=$e(t,D6),o=n.get(this.#e);return ii(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?T$(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#e,o)),o.hooks}pipe(){return ne(this,arguments)}};var Of=l(2,(e,t)=>Ei(r=>Q(()=>e.updateUnsafe(t,r))));function L6(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function T$(e,t){return{...k$(e),...k$(t)}}function k$(e){return Tt(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(z(t,r,n),t),{}):e}var B6=vs,Sn=de,dx=jp,j6=o0,z6=dR,H6=mR,q6=hR,W6=xR,Eo=zn,V6=SR,Ko=Ds,mx=AI,vi=VP,g=q,jc=Pc,J0=kI,L=le,U=Q,W=ye;var G6=g0;var fr=Bt,zc=vg,K6=TR,J6=kR,Z6=vR;var Q6=AR,tt=ZP,k=yt,hx=Ag,dt=Ge,Oa=qP,lr=Si,Rt=WP;var cd=mf,Y6=TI,Kn=ue,X6=n_,ud=df,eK=wI,tK=HP,rK=zP,I=oe,Z0=aF,Kt=Us,jr=Fc,Q0=yi,nK=BF,bo=Up,F=Re,at=un,gx=hf,Oi=Mp,oK=tF,Y0=IF,O$=DI,Jo=wa;var _a=zI,X0=RF,sK=MF,aK=$F,iK=NF,Ct=qn,eC=vF,cK=$p,fd=Mg,uK=AF,fK=BI,lK=Ca,Jt=HI,pK=qI,Pa=WI,xx=jI,dK=PF,yx=OF,mK=_F,hK=Rg,_$=FF,gK=VI,xK=sd,yK=H0,SK=rF,Pf=LF,EK=$g,bK=d$,IK=iM,CK=UF,wK=DF,TK=GF,kK=JI,AK=KI,tC=VF,_i=If,vK=KF,rC=FI,OK=RI,_K=nF,Hs=MI,Sx=IR,PK=CR,nC=wR,FK=s0,RK=a0,MK=CF,$K=bR,Ex=wF,Pi=Ng,NK=Np,UK=GI,DK=HF,LK=oF,Fa=Ns,oC=Sf,BK=qF,jK=WF,Fi=UI,ld=Ei,sC=ux,pn=Hn,zK=bF,aC=yF,Ff=SF,HK=yf,qK=Ia,WK=EF,dn=fn,iC=Pg,Hc=Dp,qs=QI,bx=Lg,Qr=Rc,VK=oR,P$=Lp,Ix=YI,Ra=tR,Zo=t0,GK=rR,KK=r0,pd=zo,Jn=Wn,JK=XI,ZK=e0,cC=iR,QK=aR,YK=n0,En=cR,XK=Bg,uC=nR,Qo=Mc,Ws=Ho,eJ=lR,tJ=pR,vt=Fg,rJ=f$,nJ=z0,oJ=LI,sJ=TF,aJ=l(2,(e,t)=>F$(e,void 0,t)),F$=l$,iJ=jR,cJ=zR,uJ=HR,fJ=qR,lJ=YR,pJ=XR,dJ=eM,mJ=tM,hJ=KR,gJ=JR,xJ=ZR,fC=VR,yJ=Pp,SJ=Fp,EJ=QR,bJ=GR,IJ=lf,CJ=S$,wJ=E$,Rf=OR,Zt=i0,Ma=FR,TJ=_R,kJ=PR,AJ=KP,vJ=JP,Yo=MR,Io=Ta,OJ=c0,_J=$R,lC=UR,pC=u0,Cx=NR,PJ=Hg,FJ=LR,RJ=f0,Vs=DR,MJ=qg,N=OI,$J=QP,Gs=qo,wx=Wo,NJ=Wo(),UJ=Wo("Fatal"),DJ=Wo("Warn"),dd=Wo("Error"),LJ=Wo("Info"),BJ=Wo("Debug"),jJ=Wo("Trace"),zJ=l(2,(e,t)=>Ia(e,h0,r=>new Set([...r,t]))),HJ=l(e=>Sn(e[0]),(e,...t)=>Ia(e,CM,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||z(n,t[0],t[1]),n})),qJ=sM,WJ=l(2,(e,t)=>oe(d0,r=>Ia(e,wM,n=>[[t,r],...n]))),VJ=l(e=>Sn(e[0]),(e,t,r)=>Jn(e,n=>{let o=r===void 0?n:r(n);return Of(t,o)})),GJ=l(e=>Sn(e[0]),(e,t,r)=>jr(e,n=>{let o=r===void 0?n:r(n);return Of(t,o)})),KJ=l(e=>Sn(e[0]),(e,t,r)=>xx(e,n=>{let o=r===void 0?n:r(n);return Of(t,o)})),JJ=l(e=>Sn(e[0]),(e,t,r)=>_$(e,n=>{let o=r===void 0?n:r(n);return Of(t,o)})),ZJ=l(e=>Sn(e[0]),(e,t,r)=>Gs(n=>{let o=n.monotonicTimeNanosUnsafe();return Jn(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=cP(pt(s),pt(o)),i=r===void 0?a:r(a);return Of(t,i)})})),_f=class extends gt()("effect/Effect/Transaction"){},QJ=e=>Kn(t=>{let r=Wh(t.context,_f);if(r&&!v$.has(r))return e;let n=t.getRef(Jr),o=n.currentTimeMillisUnsafe(),s={journal:new Map,retry:!1,attempt:1,retryReason:void 0,start:o,now:o,elapsed:0,elapsedSincePrevious:0},a;return Ws(i=>{let c=i(e).pipe(dn(_f,s),yx(u=>s.retry?Ig(u)?i(XJ(s)):U(()=>K0(s)):W),bo);return I(Ko({while:()=>!a,body:()=>(s.attempt>1&&YJ(s,n.currentTimeMillisUnsafe()),c),step(u){if(s.retry||!R$(s))return s.attempt++,s.retryReason=s.retry?"retry":"conflict",K0(s);et(u)&&eZ(t,s),K0(s),v$.add(s),a=u}}),()=>a)})}),v$=new WeakSet,YJ=(e,t)=>{e.elapsedSincePrevious=t-e.now,e.now=t,e.elapsed=t-e.start},R$=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},XJ=e=>fr(t=>{if(!R$(e))return t(W);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(W)};for(let a of n)a.pending.set(r,s);return U(o)});function eZ(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function K0(e){e.retry=!1,e.journal.clear()}var tZ=I(_f,e=>{let t=e;return t.retry=!0,En}),St=(e,t,r)=>(...n)=>fr(o=>{try{e(...n,(s,a)=>{o(s?t?L(()=>k(t(s,n))):k(s):g(a))})}catch(s){o(r?k(r(s,n)):lr(s))}}),rZ=()=>e=>e,nZ=()=>e=>e,oZ=()=>e=>e,qc=iF,md=cF,Tr=uF,Qt=sF,hd=fF,dC=YP;var M$=(e,t)=>et(e)?t(0):qp(e.cause)?t(130):t($$(Nc(e.cause))),mC=e=>l(t=>Sn(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?Yo(t):Yo(yx(t,s=>qp(s)?W:N$(Nc(s))?dd(s):W));try{let s=globalThis.setInterval(yn,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??M$;return e({fiber:n,teardown:o})}),gd="~effect/Runtime/errorExitCode",$$=e=>{if(typeof e=="object"&&e!==null&&gd in e){let t=e[gd];if(typeof t=="number")return t}return 1},Ri="~effect/Runtime/errorReported",N$=e=>{if(typeof e=="object"&&e!==null&&Ri in e){let t=e[Ri];if(typeof t=="boolean")return t}return!0};var U$=mC(({fiber:e,teardown:t})=>{let r=!1;e.addObserver(o=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,s=>{(r||s!==0)&&process.exit(s)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)});var D$=U$;var qr={};$n(qr,{FileSystem:()=>os,FileTypeId:()=>Wf,WatchBackend:()=>qf,isFile:()=>cY,layerNoop:()=>iY,make:()=>$w,makeNoop:()=>NU});var L$=globalThis.BigInt;var Tx=e=>e>L$(Number.MAX_SAFE_INTEGER)||e<L$(Number.MIN_SAFE_INTEGER)?A():v(Number(e));var gC=BigInt(0),iZ=BigInt(1),Ks=BigInt(1e3),Mi=BigInt(1024),B$=[{symbol:"B",factor:iZ,names:["B","byte","bytes"]},{symbol:"kB",factor:Ks,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ks**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ks**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ks**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ks**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ks**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ks**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ks**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ks**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ks**BigInt(10),names:["QB","quettabyte","quettabytes"]}],cZ=[B$[0],{symbol:"KiB",factor:Mi,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:Mi**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:Mi**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:Mi**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:Mi**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:Mi**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:Mi**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:Mi**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],uZ=[...B$,...cZ.slice(1)],fZ=new Map(uZ.flatMap(e=>e.names.map(t=>[t,e])));var xC=e=>e;var Mf=e=>{throw new Error(`Invalid ByteSize: ${e}`)},j$=e=>!Number.isSafeInteger(e)||e<0?Mf(`expected a non-negative safe integer, received ${e}`):xC(BigInt(e));var z$=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return Mf(`unsupported syntax ${JSON.stringify(e)}`);let r=fZ.get(t[3]);if(r===void 0)return Mf(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??"",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==gC?Mf(`${JSON.stringify(e)} does not represent an integral number of bytes`):xC(s/o)},H$=jo(z$),Vc=e=>{switch(typeof e){case"bigint":return e<gC?Mf(`expected a non-negative bigint, received ${e}`):xC(e);case"number":return j$(e);case"string":return z$(e)}return Mf(`unsupported input ${e}`)},yC=jo(Vc),xd=e=>typeof e=="bigint"?Vc(e):j$(e);var q$=e=>typeof e=="bigint"&&e>=gC;var kx=e=>e,W$=Tx;var V$="~effect/PlatformError",Nf=class extends mo("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},SC=class extends kp{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},Ax=class extends mo("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[V$]=V$;get message(){return this.reason.message}};var Zn=e=>new Ax(new SC(e)),Co=e=>new Ax(new Nf(e));var K$="~effect/Chunk";function G$(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var J$=[],bC=e=>Ur((t,r)=>{if(t.length!==r.length)return!1;let n=Gc(t),o=Gc(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),lZ=bC(Z),pZ={[K$]:{_A:e=>e},toString(){return`Chunk(${j(Gc(this))})`},toJSON(){return{_id:"Chunk",values:er(Gc(this))}},[ot](){return this.toJSON()},[ie](e){return vx(e)&&lZ(this,e)},[ae](){return ws(Gc(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return J$[Symbol.iterator]();default:return Gc(this)[Symbol.iterator]()}},pipe(){return ne(this,arguments)}},IC=e=>{let t=Object.create(pZ);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=$a,t.right=$a;break}case"ISingleton":{t.length=1,t.depth=0,t.left=$a,t.right=$a;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=$a,t.right=$a;break}}return t},vx=e=>O(e,K$),$a=IC({_tag:"IEmpty"}),dZ=()=>$a;var mZ=e=>IC({_tag:"ISingleton",a:e}),CC=e=>vx(e)?e:gZ(Xe(e)),EC=(e,t,r)=>{switch(e.backing._tag){case"IArray":{G$(e.backing.array,0,t,r,e.length);break}case"IConcat":{EC(e.left,t,r),EC(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{G$(Gc(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var hZ=e=>{switch(e.backing._tag){case"IEmpty":return J$;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return EC(e,t,0),e.backing={_tag:"IArray",array:t},e.left=$a,e.right=$a,e.depth=0,t}}},Gc=hZ;var gZ=e=>e.length===0?dZ():e.length===1?mZ(e[0]):IC({_tag:"IArray",array:e});var Z$=e=>e.length;var Q$=CI;var $i=dg,Y$=BP,Xo=Rp;var Uf=Ea,Ni=RR;var zr=l0,X$=BR;var eN="~effect/MutableRef",xZ={[eN]:eN,...Nr,toJSON(){return{_id:"MutableRef",current:er(this.current)}}},Ui=e=>{let t=Object.create(xZ);return t.current=e,t};var tN=e=>e.current;var Ox=l(2,(e,t)=>(e.current=t,e));var kr=Symbol.for("effect/MutableList/Empty"),Ua=()=>({head:void 0,tail:void 0,length:0}),TC=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},rN=()=>({array:[],mutable:!0,offset:0,next:void 0}),es=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=rN(),e.tail=e.tail.next):e.head=e.tail=rN(),e.tail.array.push(t),e.length++},kC=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var Px=(e,t)=>Fx(e,Xe(t),!Array.isArray(t)),Fx=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},Na=e=>{e.head=e.tail=void 0,e.length=0},Kc=(e,t)=>{if(t=At(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return Na(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?Na(e):TC(e),r;o=o.next}return Na(e),r},Rx=(e,t)=>{if(t=At(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){Na(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,TC(e);return}r+=o,n=n.next}Na(e)},Di=e=>Kc(e,e.length),Jc=e=>{if(!e.head)return kr;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:Na(e):TC(e),t},nN=(e,t)=>{if(t=At(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let a=s.offset;a<s.array.length;a++)if(n[o++]=s.array[a],o===r)return n;s=s.next}return n};var AC=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){Na(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},oN=(e,t)=>AC(e,r=>r!==t);var yZ="~effect/PubSub";var SZ="~effect/PubSub/Subscription",Dx=e=>U(()=>TZ(e.atomicPubSub(),new Map,yo(),zr(!1),Ui(!1),e.strategy(),Ui(A()))),Lx=e=>Dx({atomicPubSub:()=>LC(e),strategy:()=>new $x}),Bx=e=>Dx({atomicPubSub:()=>LC(e),strategy:()=>new Nx}),jx=e=>Dx({atomicPubSub:()=>LC(e),strategy:()=>new DC}),zx=e=>Dx({atomicPubSub:()=>sN(e),strategy:()=>new Nx}),LC=e=>{let t=typeof e=="number"?{capacity:e}:e;if(kZ(t.capacity),t.capacity===1/0)return sN(t);let r=t.replay&&t.replay>0?new Ux(Math.ceil(t.replay)):void 0;return t.capacity===1?new FC(r):e$(t.capacity)===t.capacity?new _C(t.capacity,r):new vC(t.capacity,r)},sN=e=>{let t=e?.replay;return new MC(t&&t>0?new Ux(Math.ceil(t)):void 0)};var bd=e=>Qo(Kn(t=>(Ox(e.shutdownFlag,!0),Ze(e.scope,yM(t.id)).pipe(Kt(e.strategy.shutdown),Ex(e.shutdownHook.open),Oi)))),Hx=l(2,(e,t)=>U(()=>EZ(e,t))),EZ=l(2,(e,t)=>{if(e.shutdownFlag.current||fe(e.ended.current))return!1;if(Ox(e.ended,v(t)),e.strategy instanceof $x)for(let[n,o,s]of Di(e.strategy.publishers))s&&xo(o,Zr(!1));let r=Zr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=Jc(o))!==kr;)xo(s,r)}return e.subscribers.clear(),!0});var qx=l(2,(e,t)=>L(()=>e.shutdownFlag.current||fe(e.ended.current)?g(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),g(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag,e.ended)));var aN=l(2,(e,t)=>L(()=>{if(e.shutdownFlag.current||fe(e.ended.current))return g(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?g(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag,e.ended)})),Id=e=>Qo(ld(t=>{let r=$e(t,ln),n=ur(e.scope),o=wZ(e.pubsub,e.subscribers,e.strategy,e.ended);return cr(n,bZ(o)).pipe(Kt(Ls(r,s=>Ze(n,s))),at(o))})),bZ=e=>Qo(Kn(t=>(Ox(e.shutdownFlag,!0),Eo(Di(e.pollers),r=>S0(r,t.id),{discard:!0,concurrency:"unbounded"}).pipe(jr(()=>U(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),Ex(e.shutdownHook.open),Oi)))),Wx=e=>L(()=>{if(e.shutdownFlag.current)return En;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return g(r)}let t=e.pollers.length===0?e.subscription.poll():kr;return t===kr?cN(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),g(t))}),iN=e=>L(function t(r){if(e.shutdownFlag.current)return En;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?g(e.replayWindow.takeAll().concat(n)):Dr(n)?g(n):I(cN(e),o=>t([o]))}),cN=e=>fr(t=>{if(e.shutdownFlag.current)return t(En);if(fe(e.ended.current)){let o=e.pollers.length===0?e.subscription.poll():kr;return o!==kr?(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),t(g(o))):t(g(e.ended.current.value))}let r=Aa(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),es(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],U(()=>oN(e.pollers,r)))});var jt=Symbol.for("effect/PubSub/AbsentValue"),IZ=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},CZ=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},wZ=(e,t,r,n)=>new NC(e,t,e.subscribe(),Ua(),zr(!1),Ui(!1),r,e.replayWindow(),n),vC=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Df(this.replayBuffer):Vx}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex%this.capacity;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=jt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new OC(this,this.publisherIndex,!1)}},OC=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return kr}pollUpTo(t){if(t=At(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex%this.self.capacity,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=jt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},_C=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Df(this.replayBuffer):Vx}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex&this.mask;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=jt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new PC(this,this.publisherIndex,!1)}},PC=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return kr}pollUpTo(t){if(t=At(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex&this.self.mask,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=jt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},FC=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=jt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Df(this.replayBuffer):Vx}pipe(){return ne(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=jt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new RC(this,this.publisherIndex,!1)}},RC=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return kr;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=jt),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return At(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=jt)))}},MC=class{publisherHead={value:jt,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Df(this.replayBuffer):Vx}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=jt,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new $C(this,this.publisherTail,this.publisherIndex,!1)}},$C=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==jt?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;let t=!0,r=kr;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==jt&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=jt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=At(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===kr?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==jt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=jt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},NC=class{[SZ]={_A:D};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,a,i,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=a,this.strategy=i,this.replayWindow=c,this.ended=u}pipe(){return ne(this,arguments)}},UC=class{[yZ]={_A:D};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,a,i){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=a,this.ended=i}pipe(){return ne(this,arguments)}},TZ=(e,t,r,n,o,s,a)=>new UC(e,t,r,n,o,s,a),kZ=e=>{if(e<=0||e!==1/0&&!Number.isInteger(e))throw new Error(`Cannot construct PubSub with capacity of ${e}`)},$x=class{publishers=Ua();get shutdown(){return Kn(t=>Eo(Di(this.publishers),([r,n,o])=>o?S0(n,t.id):W,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,r,n,o,s){return fr(a=>{if(fe(s.current))return a(g(!1));let i=Aa();return this.offerUnsafe(n,i),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),tN(o)?(this.removeUnsafe(i),a(En)):i.effect?a(i.effect):(i.resumes=[a],U(()=>this.removeUnsafe(i)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=Jc(this.publishers);if(o===kr)n=!1;else{let[s,a]=o,i=t.publish(s);i&&o[2]?xo(a,Zr(!0)):i||kC(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return BC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return jC(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){es(this.publishers,[s,r,!0]);break}es(this.publishers,[s,r,!1])}}removeUnsafe(t){AC(this.publishers,([r,n])=>n!==t)}},Nx=class{get shutdown(){return W}handleSurplus(t,r,n,o){return g(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return BC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return jC(this,t,r)}},DC=class{get shutdown(){return W}handleSurplus(t,r,n,o,s){return U(()=>fe(s.current)?!1:(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return BC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return jC(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,a=!0;for(;a;){t.slide();let i=t.publish(s);i&&(o=n.next())&&!o.done?s=o.value:i&&(a=!1)}}}},BC=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let a=Jc(o);if(a===kr)CZ(r,n,o),o.length===0?s=!1:IZ(r,n,o);else{let i=n.poll();i===kr?kC(o,a):(xo(a,Zr(i)),e.onPubSubEmptySpaceUnsafe(t,r))}}},jC=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},Ux=class{capacity;head={value:jt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:jt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},Df=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=jt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=At(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},Vx={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var AZ="~effect/Queue",vZ="~effect/Queue/Enqueue",OZ="~effect/Queue/Dequeue";var HC={_A:D,_E:D},_Z={[AZ]:HC,[vZ]:HC,[OZ]:HC,...Nr,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:FZ(this)}}},mn=e=>ue(t=>{let r=Object.create(_Z);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=Ua(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},q(r)}),Cd=e=>mn({capacity:e});var uN=()=>mn(),Yr=l(2,(e,t)=>le(()=>Da(e,t)?Jx:e.state._tag==="Open"&&e.strategy==="suspend"?NZ(e,t):dN)),Da=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(Jc(e.messages),es(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(es(e.messages,t),mN(e),!0):!1:(es(e.messages,t),Gx(e),!0),Zc=l(2,(e,t)=>Bt(r=>{let n=Kx(e,t);return n.length===0||e.strategy==="dropping"?r(Me(n)):gN(e,{_tag:"Array",remaining:n,offset:0,resume:r})})),Kx=(e,t)=>{if(e.state._tag!=="Open")return Xe(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return Px(e.messages,t),e.strategy==="sliding"&&Kc(e.messages,e.messages.length-e.capacity),Gx(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return Xe(t);let n=[],o=0;for(let s of t)o<r?es(e.messages,s):n.push(s),o++;return Gx(e),n};var yr=l(2,(e,t)=>Q(()=>Js(e,t))),Js=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=Ir(t),n=gF(r,RZ);return e.state.offers.size===0&&e.messages.length===0?(Zx(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},Gx(e),!0)},WC=e=>yr(e,Zu(Ec())),wo=e=>Js(e,Zu(Ec()));var To=e=>Q(()=>PZ(e)),PZ=e=>{if(e.state._tag==="Done")return!1;Na(e.messages);let t=e.state.offers;Zx(e,e.state._tag==="Open"?MZ:e.state.exit);for(let r of t)xN(r);return!0};var Qc=e=>fN(e,1,Number.POSITIVE_INFINITY);var fN=l(3,(e,t,r)=>(t=At(t),r=At(r),VC(()=>$Z(e,t,r)??Us(hN(e,()=>GC(e,t)),fN(e,t,r))))),hn=e=>VC(()=>pN(e)??Us(hN(e,()=>GC(e,1)),hn(e))),lN=e=>VC(()=>{let t=pN(e);return t===void 0?q(A()):t._tag==="Success"?q(v(t.value)):q(A())});var pN=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=Jc(e.messages);return qC(e),Me(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=yN(e.state.offers);return qC(e),Me(t)}};var FZ=e=>e.state._tag==="Done"?0:e.messages.length;var dN=Me(!1),Jx=Me(!0),RZ=jn(Ec()),MZ=gf(),mN=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(Kr),e.messages.length===0))break}},Gx=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,mN(e)},0))},$Z=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return Me([]);if(!GC(e,t))return;let n=e.messages.length>0?Kc(e.messages,r):[yN(e.state.offers)];return qC(e),Me(n)},VC=io({op:"QueueTake",[ft](e){let t=this[ge]();return up(t)?t[ft](e):t}}),GC=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,hN=(e,t)=>Bt(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(Kr);let n={ready:t,resume:r};return e.state.takers.add(n),Q(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),NZ=(e,t)=>Bt(r=>Da(e,t)?r(Jx):gN(e,{_tag:"Single",message:t,resume:r})),gN=(e,t)=>{if(e.state._tag!=="Open")return xN(t);let r=e.state.offers;return r.add(t),Q(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&Zx(e,e.state.exit))})},xN=e=>e._tag==="Single"?e.resume(dN):e.resume(Me(e.remaining.slice(e.offset))),yN=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(Jx),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Me([]))),r},qC=e=>{if(e.state._tag==="Done")return zs(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Zx(e,e.state.exit),zs(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag==="Single")es(e.messages,t.message),e.state.offers.delete(t),t.resume(Jx);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;es(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Me([]))}let n=e.state;if(n._tag==="Done")return zs(n.exit.cause)}return!1};var Zx=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var Qx=e=>new KC(e),SN=(e,t,r)=>Bt(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),Q(()=>{e.waiters.delete(o)})}),KC=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=le(()=>this.free<t?SN(this,t,r):(this.taken+=t,q(t)));return r}takeIfAvailable(t){return le(()=>this.free<t?q(!1):(this.taken+=t,q(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return ue(r=>(this.permits=t,this.free<0?ye:(this.releaseUnsafe(r,0),ye)))}release(t){return ue(r=>q(this.releaseUnsafe(r,t)))}get releaseAll(){return ue(t=>q(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Ho(n=>{let o=le(()=>{if(this.free<t){let s=SN(this,t,ye);return oe(n(s),()=>o)}return this.taken+=t,zo(n(r),()=>{this.releaseUnsafe(Ea(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Ho(n=>this.free<t?Pc:(this.taken+=t,zo(n(hf(r)),()=>{this.releaseUnsafe(Ea(),t)},!0)))}};var JC=e=>Jg(e)?et(e)?ee(e.value):e:g(e);var wN="~effect/Channel",Hr=e=>O(e,wN),UZ={[wN]:{_Env:D,_InErr:D,_InElem:D,_OutErr:D,_OutElem:D},pipe(){return ne(this,arguments)}},Oe=e=>{let t=Object.create(UZ);return t.transform=(r,n)=>Ct(e(r,n),o=>g(dt(o))),t},ko=(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>t(o,n))),Ar=e=>Oe((t,r)=>e),rs=e=>Oe(N(function*(t,r){let n=ur(r),o=a=>Ze(n,ax(a)),s=yield*Zo(e(t,r,n),o);return Zo(s,o)})),Se=e=>e.transform,wd=4096,DZ=(e,t,r)=>mn({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(jr(n=>cr(e,To(n))),jr(n=>va(t(n),e).pipe(Ct(o=>yr(n,o)),Zt(e))));var TN=(e,t)=>Oe((r,n)=>F(DZ(n,e,t),Qc)),Yx=e=>Oe((t,r)=>L(()=>Se(e())(t,r))),LZ=(e,t,r)=>rs(N(function*(n,o,s){let a=A();yield*Ls(s,c=>fe(a)?r(a.value,c):W);let i=yield*Qo(F(e,c=>(a=v(c),c)));return yield*Se(t(i))(n,o)}));var kN=e=>Ar(U(()=>{let t=e();return L(()=>{let r=t.next();return r.done?ee(r.value):g(r.value)})})),ZC=e=>Ar(U(()=>{let t=0;return L(()=>t>=e.length?ee():g(e[t++]))}));var QC=(e,t=wd)=>{let r=lo(t);return Ar(U(()=>{let n=e(),o=A();return L(()=>{if(o._tag==="Some")return ee(o.value);let s=[];for(;s.length<r;){let a=n.next();if(a.done){if(s.length===0)return ee(a.value);o=v(a.value);break}s.push(a.value)}return g(s)})}))};var AN=(e,t=wd)=>QC(()=>e[Symbol.iterator](),t),Xx=e=>ey(g(e));var vN=e=>ey(U(e)),Bf=Ar(g(ee())),ON=Ar(g(zc)),Zs=e=>Ar(g(k(e))),_N=e=>Ar(hx(e)),Td=e=>Ar(dt(e)),PN=e=>Ar(Oa(e)),YC=e=>Td(Cf(e)),ey=e=>Ar(U(()=>{let t=!1;return L(()=>t?ee():(t=!0,e))}));var FN=e=>Ar(I(e,()=>ee())),XC=e=>Ar(g(I(e,JC)));var RN=e=>Ar(g(Qc(e)));var ew=e=>Ar(g(uC(iN(e),()=>ee())));var MN=e=>La(F(Id(e),ew)),$N=e=>La(F(Id(e),t=>XC(Wx(t))));var NN=e=>Oe((t,r)=>BZ({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var BZ=e=>{let t=e.readable.getReader(),r=e.exit??Ui(void 0),n=L(()=>r.current?r.current:Fa(vi({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??dt(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?ee():g(Ae(s))}));return at(cr(e.scope,e.releaseLockOnEnd?U(()=>t.releaseLock()):mx(()=>t.cancel().catch(yn))),n)},jZ=(e,t)=>Oe(N(function*(r,n){let o=e[Symbol.asyncIterator](),s=!1;return o.return&&(yield*cr(n,L(()=>s?U(()=>{o.return().catch(yn)}):mx(()=>o.return())))),I(vi({try:()=>{let a=o.next();return s=!0,a.finally(()=>{s=!1})},catch:t}),a=>a.done?ee(a.value):g(a.value))})),UN=(e,t)=>ns(jZ(e,t),Ae),ns=l(2,(e,t)=>ko(e,r=>U(()=>{let n=0;return F(r,o=>t(o,n++))}))),tw=l(2,(e,t)=>rw(e,r=>g(t(r)))),rw=l(2,(e,t)=>ko(e,r=>g(ze(r,n=>I(t(n),ee))))),DN=e=>e===void 0||e!=="unbounded"&&e<=1,ty=l(e=>Hr(e[0]),(e,t,r)=>DN(r?.concurrency)?LN(e,t):zZ(e,t,r)),LN=(e,t)=>Oe((r,n)=>{let o=0;return F(Se(e)(r,n),I(s=>t(s,o++)))}),zZ=(e,t,r)=>rs(N(function*(n,o,s){let a=0,i=yield*Se(e)(n,o),c=r.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*Cd(0);yield*cr(s,To(u));let f=Io(yield*Fi()),p=Ni(s);if(r.unordered){let d=Qx(c),m=ct(d.release(1)),x=Fa({onFailure:y=>I(yr(u,y),m),onSuccess:y=>I(Yr(u,y),m)});yield*d.take(1).pipe(I(()=>i),I(y=>{let E=a++;return p(f(x(L(()=>t(y,E))))),W}),vt({disableYield:!0}),Ct(y=>d.withPermits(c-1)(yr(u,y))),Zt(s))}else{let d=yield*Cd(c-2);yield*cr(s,To(d)),yield*hn(d).pipe(Z0,I(y=>Yr(u,y)),vt({disableYield:!0}),Ct(y=>yr(u,y)),Zt(s));let m,x=y=>{y._tag!=="Success"&&(m=y.cause,Js(u,y.cause))};yield*i.pipe(I(y=>{if(m)return dt(m);let E=a++,w=f(L(()=>t(y,E)));return p(w),w.addObserver(x),Yr(d,$i(w))}),vt({disableYield:!0}),Ct(y=>Yr(d,Vn(y)).pipe(Kt(yr(d,y)))),Zt(s))}return hn(u)}));var nw=l(e=>Hr(e[0]),(e,t,r)=>DN(r?.concurrency)?HZ(e,t):qZ(e,t,r)),HZ=(e,t)=>Oe((r,n)=>F(Se(e)(r,n),o=>{let s,a,i=I(o,u=>(a??=ur(n),Qt(Se(t(u))(r,a),f=>(s=c(f),s)))),c=ze(u=>{if(s=void 0,a.state._tag==="Empty")return i;let f=Ze(a,Gt);return a=void 0,I(f,()=>i)});return L(()=>s??i)})),qZ=(e,t,r)=>e.pipe(ns(t),oy(r)),BN=l(2,(e,t)=>Oe((r,n)=>U(()=>{let o,s=ur(n),a=I(Se(e)(r,s),i=>(o=ze(i,c=>Ze(s,Gt).pipe(I(()=>Se(t(c))(r,n)),I(u=>(o=u,u)))),o));return L(()=>o??a)})));var ow=l(4,(e,t,r,n)=>Oe(N(function*(o,s){let a=yield*Se(e)(o,s),i=yield*Se(t)(o,s),c=r();return L(()=>{let u=n(c,a,i);return F(u,([f,p])=>(c=p,f))})}))),jN=l(2,(e,t)=>Oe((r,n)=>U(()=>{let o,s=ur(n),a=I(Se(e)(r,s),i=>{let c=i.pipe(jr(()=>(o=i,W)),ze(u=>Ze(s,Zr(u)).pipe(Kt(Se(t(u))(r,n)),I(f=>(o=f,f)))));return o=c,c});return L(()=>o??a)}))),zN=e=>nw(e,D),Xr=e=>ko(e,t=>{let r,n=0,o=L(function s(){if(r===void 0)return I(t,i=>{switch(i.length){case 0:return s();case 1:return g(i[0]);default:return r=i,g(i[n++])}});let a=r[n++];return n>=r.length&&(r=void 0,n=0),g(a)});return g(o)}),HN=e=>LN(e,JC),qN=e=>ko(e,t=>g(vt(t,{disableYield:!0}))),WN=l(2,(e,t)=>Go(typeof t=="function"?t(D):t).pipe(F(r=>{let n=wr.defaultValue();return VN(cy(e,wr,U(()=>n)),o=>r(o).pipe(F(s=>{n=s}),ze(()=>ee(o))))}),La)),VN=(e,t)=>Oe((r,n)=>U(()=>{let o,s=()=>{let a=ur(n);return I(Se(e)(r,a),i=>(o=ze(i,c=>Ze(a,Gt).pipe(I(()=>t(c)),I(s))),o))};return L(()=>o??s())})),GN=e=>VN(e,()=>W),KN=l(2,(e,t)=>ko(e,(r,n)=>F(rd(t),o=>jr(r,o)))),JN=l(2,(e,t)=>Oe((r,n)=>F(Se(e)(r,n),o=>I(o,function s(a){return t(a)?g(a):I(o,s)}))));var ZN=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){let s=[];for(let a=0;a<o.length;a++)t(o[a])&&s.push(o[a]);return st(s)?g(s):I(r,n)})))),QN=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){let s=[];for(let a=0;a<o.length;a++){let i=t(o[a]);xt(i)&&s.push(i.success)}return st(s)?g(s):I(r,n)})))),YN=l(2,(e,t)=>ko(e,r=>{let n=I(r,o=>Sx(o,t));return g(I(n,function o(s){return st(s)?g(s):I(n,o)}))})),XN=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){return I(nC(o,t),s=>st(s)?g(s):I(r,n))})))),jf=l(e=>Hr(e[0]),(e,t,r,n)=>Oe((o,s)=>F(Se(e)(o,s),a=>{let i=t(),c,u=0,f,p=Fa(a,{onFailure(m){f=m;let x=n?.onHalt&&n.onHalt(i);return x&&x.length>0?g([i,x]):dt(m)},onSuccess(m){let x=r(i,m);return K_(x)?g(x):x}});return L(function m(){if(c===void 0)return f?dt(f):I(p,([y,E])=>(i=y,E.length===0?m():E.length===1?g(E[0]):(c=E,m())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),g(x)})})));var e1=l(3,(e,t,r)=>Oe((n,o)=>F(Se(e)(n,o),s=>{let a=t,i=!0;return L(()=>i?(i=!1,g(a)):F(I(s,c=>r(a,c)),c=>(a=c,a)))}))),zf=l(2,(e,t)=>Oe((r,n)=>{let o=ur(n);return F(Se(e)(r,o),s=>{let a=s.pipe(Ct(i=>{if(zs(i))return dt(i);let c=o;return o=ur(n),Ze(c,Vn(i)).pipe(Kt(Se(t(i))(r,o)),I(u=>(a=u,u)))}));return L(()=>a)})})),t1=l(2,(e,t)=>ny(e,Gg,t)),ry=l(2,(e,t)=>zf(e,r=>FN(I(t(r),n=>dt(r))))),r1=l(3,(e,t,r)=>zf(e,n=>t(n)?r(n):Td(n))),ny=l(3,(e,t,r)=>zf(e,n=>{let o=t(n);return be(o)?Td(o.failure):r(o.success,n)})),ts=l(2,(e,t)=>ny(e,dM,r=>t(r)));var n1=l(2,(e,t)=>ko(e,r=>g(xx(r,n=>Wp(n)?W:Oi(t(n)))))),o1=l(e=>Hr(e[0]),(e,t,r,n)=>ts(e,o=>t(o)?r(o):n?n(o):Zs(o))),s1=l(e=>Hr(e[0]),(e,t,r,n)=>ts(e,o=>{let s=t(o);return be(s)?n?n(s.failure):Zs(s.failure):r(s.success)}));var a1=l(e=>Hr(e[0]),(e,t,r,n,o)=>ts(e,s=>{if(mr(s,t)&&O(s,"reason")){let a=s.reason;return mr(a,r)?n(a,s):o?o(a,s):Zs(s)}return Zs(s)})),i1=l(e=>Hr(e[0]),(e,t,r,n)=>{let o;return ts(e,s=>{if(mr(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&sx(s.reason._tag)){let a=s.reason;return o??=new Set(Object.keys(r)),o.has(a._tag)?r[a._tag](a,s):n?n(a,s):Zs(s)}return Zs(s)})});var c1=l(2,(e,t)=>ts(e,r=>Zs(t(r)))),u1=e=>ts(e,YC),f1=l(e=>Hr(e[0]),(e,t)=>{if(!t?.log)return ts(e,()=>Bf);let r=wx(t.log===!0?void 0:t.log);return ts(ry(e,n=>pM(n)?r(n):W),()=>Bf)}),IN=e=>zf(e,()=>Bf),l1=l(e=>Hr(e[0]),(e,t)=>{if(!t?.log)return IN(e);let r=wx(t.log===!0?void 0:t.log);return IN(ry(e,n=>r(n)))}),p1=l(2,(e,t)=>Yx(()=>{let r,n=wr.defaultValue(),o=cy(e,wr,U(()=>n)),s=cw(o,()=>(r=void 0,W)),a=typeof t=="function"?t(D):t,i=ts(s,N(function*(c){return r||(r=yield*Go(a)),n=yield*r(c),i},(c,u)=>ze(c,()=>g(Zs(u))),La));return i})),d1=l(e=>Hr(e[0]),(e,t,r)=>e.pipe(ns(t),oy({...r,concurrency:r?.concurrency??1,switch:!0}))),oy=l(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>rs(N(function*(o,s,a){let i=r==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:Qx(i),u=yield*X$(!0),f=new Set,p=yield*Cd(t);yield*cr(a,To(p));let d=yield*Se(e)(o,s);return yield*tt(function*(){for(;;){let m;c&&(f.size<i?yield*c.take(1):(m=yield*Rf(d),yield*Hs(c.take(1),Kt($i(m),zc))));let x=m===void 0?yield*d:yield*$i(m),y=ur(a),E=yield*Se(x)(o,y);for(;f.size>=i;){let T=z_(f);f.delete(T),f.size===0&&(yield*u.open),yield*Xo(T)}let w=yield*E.pipe(jr(()=>cd),I(T=>Yr(p,T)),vt({disableYield:!0}),Zo(N(function*(T){let M=ax(T),P=yield*bo(Ze(y,M));if(!f.has(w))return;let h=bM([M,P]);ka(h)&&(yield*yr(p,h.cause)),f.delete(w),c&&(yield*c.release(1)),f.size===0&&(yield*u.open)})),Rf);u.closeUnsafe(),f.add(w)}}).pipe(Ct(m=>{let x=ed(m);return xt(x)?u.whenOpen(yr(p,m)):yr(p,m)}),Zt(a)),hn(p)}))),sy=l(e=>Hr(e[0])&&Hr(e[1]),(e,t,r)=>rs(N(function*(n,o,s){let a=r?.haltStrategy??"both",i=yield*Cd(0);yield*cr(s,To(i));let c=0;function u(p,d){if(c++,!zs(d))return yr(i,d);switch(a){case"both":return c===2?yr(i,d):W;case"left":case"right":return p===a?yr(i,d):W;case"either":return yr(i,d)}}let f=(p,d,m)=>Se(d)(n,m).pipe(I(x=>x.pipe(I(y=>Yr(i,y)),vt)),Zo(x=>pd(ax(x),y=>Ze(m,y)).pipe(Fa({onFailure:y=>u(p,y),onSuccess:()=>u(p,x)}))),Zt(s));return yield*f("left",e,ur(s)),yield*f("right",t,ur(s)),hn(i)}))),m1=l(2,(e,t)=>sy(e,FN(t),{haltStrategy:"left"})),h1=()=>Oe((e,t)=>U(()=>{let r="",n=!1,o=A();function s(c){let u=[];function f(p){r.length===0?u.push(p):(u.push(r+p),r="")}for(let p=0;p<c.length;p++){let d=c[p];if(d.length!==0){let m=0,x=d.indexOf("\r"),y=d.indexOf(`
|
|
23
|
+
${LP(e.cause,`${t} `)}
|
|
24
|
+
${t}}`),n},CI="~effect/Fiber",o3={_A:D,_E:D},s3={id:0},CP=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),BP=()=>CP===void 0?void 0:new CP("effect/Fiber"),Ea=()=>globalThis[mc],_p=class{constructor(t,r=!0){this.setContext(t),this.id=++s3.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[CI](){return o3}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return $e(this.context,t)}addObserver(t){return this._exit?(t(this._exit),yn):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=Pc(t);this.cache.stackFrame&&(n=lp(n,xa(_h,this.cache.stackFrame))),r&&(n=lp(n,r)),this._interruptedCause=this._interruptedCause?Sb(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ge(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Ec){this._asyncContext=BP();return}let n=fI.interruptChildren&&fI.interruptChildren(this);if(n!==void 0)return this.evaluate(oe(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=nr()}runLoop(t){let r=globalThis[mc];globalThis[mc]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Ge(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=oe(hf,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[ft](this),s===Ec){let i=this._yielded;if(gc in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Ec}}catch(a){if(!O(s,ft))return an(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=an(a)}}finally{this._running=n,globalThis[mc]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,i3;for(;;){let r=this._stack.pop();if(!r)return;let n=r[xc];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&c3-1)===0)return Me(t);let r=this.getCont(tr);return r?r[tr](t,this):this.yieldWith(Me(t))}yieldWith(t){return this._yielded=t,Ec}children(){return this._children??=new Set}pipe(){return ne(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&$_(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=a3(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag==="Span"?t:void 0}},a3=e=>{let t=yp(e,rI);return{scheduler:$e(e,Tp),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:$e(e,fg),span:yp(e,tI),logLevel:$e(e,sI),minimumLogLevel:$e(e,lg),stackFrame:$e(e,Ap),runtimeMetrics:yp(e,bP),maxOpsBeforeYield:$e(e,pP),preventYield:$e(e,dP)}},i3={[tr](e,t){return Ge(t._interruptedCause)},[Ln](e,t){return Ge(t._interruptedCause)}},c3=32,fI={interruptChildren:void 0},kg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Ib.key,e.cache.stackFrame),pi(t)},u3=e=>{if(!(e._children===void 0||e._children.size===0))return lf(e._children)},wI=e=>{let t=e;return t._exit?q(t._exit):Bt(r=>t._exit?r(q(t._exit)):Q(e.addObserver(n=>r(q(n)))))},Ag=e=>Bt(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let a=r.next();for(;!a.done;){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver(i=>{n.push(i),s()});return}t(q(n))}return s(),Q(()=>o?.())}),mg=e=>{let t=e;return t._exit?t._exit:Bt(r=>t._exit?r(t._exit):Q(e.addObserver(r)))},jP=e=>Bt(t=>{let r=Array.from(e);if(r.length===0)return t(q(Lt()));let n=new Array(r.length),o=Lt(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},a=0,i=!1;for(let c=0;c<r.length&&!i;c++){let u=f=>{if(a++,f._tag==="Failure")return i=!0,s(),t(f);n[c]=f.value,a===r.length&&t(q(n))};o.push(u),r[c].addObserver(u)}return Q(()=>{i=!0,s()})}),Rp=e=>ue(t=>zP(e,t.id)),zP=l(e=>O(e[0],CI),(e,t,r)=>ue(n=>{let o=kg(n);return o=o&&r?wc(o,r):o??r,e.interruptUnsafe(t,o),Mp(wI(e))})),lf=e=>ue(t=>{let r=kg(t),n=Lt();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Mp(Ag(n))});var q=Me,Ge=Ir,yt=jn,Q=io({op:"Sync",[ft](e){let t=this[ge](),r=e.getCont(tr);return r?r[tr](t,e):e.yieldWith(Me(t))}}),le=io({op:"Suspend",[ft](e){return this[ge]()}}),TI=l(e=>e.length>=2||sf(e[0]),(e,t)=>me(e)?yt(t?t():new As("Effect.fromOption: Option.none")):q(e.value)),mf=cn({onFailure:yt,onSuccess:q}),HP=e=>e==null?yt(new As):q(e),kI=io({op:"Yield",[ft](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Kr)},this[ge]??0),e.yieldWith(()=>{t=!0})}}),hf=kI(0),AI=e=>q(v(e)),Fc=q(A()),qP=e=>me(e)?Fc:Re(e.value,v),WP=e=>le(()=>Ge(e())),Ei=e=>an(e),vg=e=>le(()=>yt(e())),ye=q(void 0);var VP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new df(n,"An error occurred in Effect.try"):e.catch;return le(()=>{try{return q(t())}catch(n){return yt(r(n))}})};var vI=e=>OI(function(t,r){e(r).then(n=>t(q(n)),n=>t(Ei(n)))},e.length!==0),GP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new df(n,"An error occurred in Effect.tryPromise"):e.catch;return OI(function(n,o){let s=a=>le(()=>{try{return yt(fi(()=>r(a)))}catch(i){return Ei(i)}});try{t(o).then(a=>n(q(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},KP=e=>ue(t=>e(t.id)),JP=ue(q),ZP=KP(q),OI=(function(){let e=Bn({op:"Async",[ft](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,a=this.register.call(r.cache.scheduler,i=>{n||(n=!0,o?r.evaluate(i):o=i)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&a===void 0?Ec:(r._stack.push(f3(()=>(n=!0,s?.abort(),a??Kr))),Ec))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),f3=io({op:"AsyncFinalizer",[xc](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Bp))},[Ln](e,t){return II(e)?oe(ZF(Ir(e),this[ge]()),()=>Ge(e)):Ge(e)}}),Bt=e=>OI(e,e.length>=2),Og=Bt(yn),QP=(...e)=>{if(e.length===1){let n=e[0];return le(()=>_c(n()))}let[t,r]=e;return le(()=>_c(r.call(t.self)))},_I=(e,...t)=>{let r=t.length===0?function(){return le(()=>_c(e.apply(this,arguments)))}:function(){let n=le(()=>_c(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return PI(e.length,r)},PI=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),wP=aI(2),YP=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Do(),o;return n!==0&&(br(2),o=new globalThis.Error,br(n)),e?(s,...a)=>TP(t,s,o,a,e,r):TP(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},TP=(e,t,r,n,o,s)=>{let a=typeof t=="function"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?wP(()=>r.stack):ao;return PI(a.length,function(...u){let f=le(()=>{let m=a.apply(this,arguments);return de(m)?m:_c(m)});for(let m=0;m<n.length;m++)f=n[m](f,...u);if(!de(f))return f;let p=Do(),d;return p!==0&&(br(2),d=new globalThis.Error,br(p)),Ia(o?Fp(e,s,m=>hI(f,m)):f,Ap,m=>({name:e,stack:d?wP(()=>d.stack):ao,parent:{name:i,stack:c,parent:m}}))})},XP=(e,...t)=>PI(e.length,t.length===0?function(){return kP(()=>e.apply(this,arguments))}:function(){let r=kP(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),kP=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return q(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else{if(o&&o._tag==="Failure")return n.value;{let s=!0;return le(()=>s?(s=!1,oe(n.value,a=>_c(t,a))):le(()=>_c(e())))}}}}catch(t){return Ei(t)}},_c=(function(){let e=Bn({op:"Iterator",[tr](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return q(s.value);if(je(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[ft](r){return this[tr](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),un=l(2,(e,t)=>new ba(e,FI,q(t))),_g=function(e){return e._stack.push(this),this[ge]},l3=Bn({op:"OnSuccess",[ft]:_g}),ba=function(e,t,r){this[ge]=e,this[tr]=t,this.payload=r};ba.prototype=l3;var FI=function(){return this.payload},eF=function(e,t){return t.succeedWith(this.payload)},Pg=(()=>{let e=Do();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};br(1);let n=r[t]();return br(e),n.stack?.includes("[as "+t+"]")===!0})(),p3=function(e,t){let r=this.payload;return t.succeedWith(Pg?r(e):fi(()=>r(e)))},tF=function(e){let t=this.payload;return t(e)},d3=function(e){let t=this.payload;return new ba(t(e),eF,e)},m3=function(e){return new ba(this.payload,eF,e)},gf=e=>Re(e,v),rF=e=>Ef(e,{onFailure:q,onSuccess:yt}),Us=l(2,(e,t)=>new ba(e,de(t)?FI:tF,t)),Rc=l(2,(e,t)=>new ba(e,de(t)?m3:d3,t)),Mp=e=>new ba(e,FI,Kr),nF=e=>qn(e,yt),RI=(e,t)=>ue(r=>{let n=new Set;return If(r,()=>n.size===0?void 0:lf(n)),Bt(o=>{let s=Xe(e),a=s.length,i=0,c=!1,u=[],f=(p,d,m)=>{if(i++,p._tag==="Failure"){u.push(...p.cause.reasons),i>=a&&o(Ge(da(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:d,index:m,parentFiber:r})};for(let p=0;p<a;p++){let d=Nc(r,s[p],!0,!0,!1);if(n.add(d),d.addObserver(m=>{n.delete(d),f(m,d,p)}),c)break}})}),MI=(e,t)=>ue(r=>{let n=new Set;return If(r,()=>n.size===0?void 0:lf(n)),Bt(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,u=Nc(r,i,!0,!0,!1);n.add(u),u.addObserver(f=>{n.delete(u);let p=!s;s=!0,o(f),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),oF=l(e=>de(e[1]),(e,t,r)=>RI([e,t],r)),$I=l(e=>de(e[1]),(e,t,r)=>MI([e,t],r)),oe=l(2,(e,t)=>new ba(e,tF,t)),sF=l(2,(e,t)=>je(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):Ns(e,t)),je=e=>e[gc]!==void 0,aF=l(2,(e,t)=>je(e)?e._tag==="Success"?t(e.value):e:oe(e,t)),iF=e=>oe(e,D),Re=l(2,(e,t)=>new ba(e,p3,t)),cF=l(2,(e,t)=>je(e)?mF(e,t):Re(e,t)),uF=l(2,(e,t)=>je(e)?hF(e,t):qI(e,t)),fF=l(2,(e,t)=>je(e)?gF(e,t):WI(e,t)),lF=l(2,(e,t)=>{if(je(e)){if(e._tag==="Success")return e;let r=go(e.cause);return be(r)?e:t(r.success)}return wa(e,t)}),xf=e=>Ir(Pc(e)),yf=e=>e._tag==="Success";var pF=e=>e._tag==="Failure";var dF=e=>e._tag==="Failure"?G(e.cause):X(e);var NI=e=>e._tag==="Failure"&&II(e.cause);var Kr=Me(void 0),mF=l(2,(e,t)=>e._tag==="Success"?Me(t(e.value)):e),hF=l(2,(e,t)=>{if(e._tag==="Success")return e;let r=go(e.cause);return be(r)?e:jn(t(r.success))}),gF=l(2,(e,t)=>{if(e._tag==="Success")return Me(t.onSuccess(e.value));let r=go(e.cause);return be(r)?e:jn(t.onFailure(r.success))});var xF=l(2,(e,t)=>yf(e)?t:e),yF=l(2,(e,t)=>yf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var UI=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?Kr:Ir(da(t))};var SF=e=>e,EF=e=>ue(t=>q(Gh(t.context,e))),h3=e=>ue(t=>TI(Gh(t.context,e))),Sf=l(2,(e,t)=>ue(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),If(r,()=>{r.setContext(n)})),e})),Ia=l(3,(e,t,r)=>Sf(e,n=>{let o=fo(n,t),s=r(o);return o===s?n:or(n,t,s)})),bF=(e,t,r)=>$c(ue(n=>{let o=fo(n.context,e),s=t(o);return n.setContext(or(n.context,e,s)),Ci(fo(n.context,Ii),a=>{let i=Gh(n.context,e);if(me(i))return ye;let c=i.value,u;if(r?.reset===void 0){if(c!==s)return ye;u=o}else u=r.reset(o,s,c);return n.setContext(or(n.context,e,u)),ye})})),DI=()=>g3,g3=ue(e=>q(e.context)),bi=e=>ue(t=>e(t.context)),IF=l(2,(e,t)=>Sf(e,ct(t))),Hn=l(2,(e,t)=>je(e)?e:Sf(e,wc(t))),fn=function(){return arguments.length===1?l(2,(e,t)=>AP(e,arguments[0],t)):l(3,(e,t,r)=>AP(e,t,r)).apply(this,arguments)},AP=(e,t,r)=>Sf(e,or(t,r)),Fg=l(3,(e,t,r)=>oe(r,n=>fn(e,t,n))),CF=l(e=>de(e[1]),(e,t,r)=>LI(e,t,(n,o)=>[n,o],r)),LI=l(e=>de(e[1]),(e,t,r,n)=>n?.concurrent?Re(jp([e,t],{concurrency:2}),([o,s])=>r(o,s)):oe(e,o=>Re(t,s=>r(o,s)))),wF=l(e=>de(e[0]),(e,t,r)=>a0(e,t,r?n=>yt(r(n)):()=>yt(new As))),TF=l(2,(e,t)=>oe(t,r=>r?gf(e):Fc)),BI=l(2,(e,t)=>Array.from({length:t},()=>e)),kF=l(e=>de(e[0]),(e,t,r)=>jp(BI(e,t),r)),Rg=l(e=>de(e[0]),(e,t)=>Ds({while:sn,body:ct(t?.disableYield?e:oe(e,r=>hf)),step:yn})),qn=l(2,(e,t)=>new AF(e,t.length!==1?r=>t(r):t)),x3=Bn({op:"OnFailure",[ft]:_g}),AF=function(e,t){this[ge]=e,this[Ln]=t};AF.prototype=x3;var jI=l(3,(e,t,r)=>qn(e,n=>t(n)?r(n):Ge(n))),Ca=l(3,(e,t,r)=>qn(e,n=>{let o=t(n);return be(o)?Ge(o.failure):r(o.success,n)})),wa=l(2,(e,t)=>Ca(e,go,r=>t(r))),vF=e=>Ef(e,{onFailure:t=>Cb(t)?Fc:yt(t),onSuccess:AI}),OF=l(2,(e,t)=>Ca(e,Ig,t)),_F=l(2,(e,t)=>qn(e,r=>Us(t(r),Ge(r)))),PF=l(3,(e,t,r)=>jI(e,t,n=>Us(r(n),Ge(n)))),Mg=l(3,(e,t,r)=>qn(e,n=>{let o=t(n);return be(o)?Ge(n):Us(r(o.success,n),Ge(n))})),zI=l(2,(e,t)=>Mg(e,go,r=>t(r))),FF=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):mr(t);return zI(e,o=>n(o)?r(o):ye)}),RF=l(2,(e,t)=>Mg(e,Ig,r=>t(r))),$p=l(e=>de(e[0]),(e,t,r,n)=>qn(e,o=>{let s=go(o);return be(s)?Ge(s.failure):t(s.success)?r(s.success):n?n(s.success):Ge(o)})),$g=l(e=>de(e[0]),(e,t,r,n)=>qn(e,o=>{let s=go(o);if(be(s))return Ge(s.failure);let a=t(s.success);return be(a)?n?n(a.failure):Ge(o):r(a.success)})),HI=l(e=>de(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):mr(t);return $p(e,o,r,n)}),MF=l(e=>de(e[0]),(e,t,r)=>{let n;return $g(e,o=>(n??=Object.keys(t),O(o,"_tag")&&Nn(o._tag)&&n.includes(o._tag)?G(o):X(o)),o=>t[o._tag](o),r)}),$F=l(e=>de(e[0]),(e,t,r,n,o)=>$p(e,s=>mr(s,t)&&O(s,"reason")&&(o!==void 0||mr(s.reason,r)),s=>{let a=s.reason;return mr(a,r)?n(a,s):o?o(a,s):yt(s)})),NF=l(e=>de(e[0]),(e,t,r,n)=>{let o;return $p(e,s=>mr(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&Nn(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let a=s.reason;return o??=Object.keys(r),o.includes(a._tag)?r[a._tag](a,s):n?n(a,s):yt(s)})}),UF=l(2,(e,t)=>$g(e,r=>mr(r,t)&&O(r,"reason")?G(r.reason):X(r),yt)),qI=l(2,(e,t)=>wa(e,r=>vg(()=>t(r)))),WI=l(2,(e,t)=>Ef(e,{onFailure:r=>vg(()=>t.onFailure(r)),onSuccess:r=>Q(()=>t.onSuccess(r))})),VI=e=>wa(e,Ei),DF=l(2,(e,t)=>wa(e,r=>Q(()=>t(r)))),LF=e=>le(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return Ei(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:wa(o.value,a=>n(s))}return n(r)}),GI=e=>wa(e,t=>oe(hf,()=>GI(e))),BF=l(e=>de(e[0]),(e,t)=>{if(!t?.log)return Ef(e,{onFailure:n=>ye,onSuccess:n=>ye});let r=Wo(t.log===!0?void 0:t.log);return Ns(e,{onFailure(n){let o=FP(n);return be(o)?Ge(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>ye})}),Ng=l(e=>de(e[0]),(e,t)=>{if(!t?.log)return Ns(e,{onFailure:n=>ye,onSuccess:n=>ye});let r=Wo(t.log===!0?void 0:t.log);return Ns(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>ye})}),jF=e=>Ug(e,{onFailure:A,onSuccess:v}),Si=e=>Np(e,{onFailure:X,onSuccess:G}),Ns=l(2,(e,t)=>new zF(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),y3=Bn({op:"OnSuccessAndFailure",[ft]:_g}),zF=function(e,t,r){this[ge]=e,this[tr]=t,this[Ln]=r};zF.prototype=y3;var S3=function(e,t){let r=this.payload;return t.succeedWith(Pg?r.onSuccess(e):fi(()=>r.onSuccess(e)))},HF=(e,t)=>{let r=Bn({op:e,[ft]:_g,[tr]:S3,[Ln]:t}),n=function(o,s){this[ge]=o,this.payload=s};return n.prototype=r,n},E3=HF("Match",function(e,t){let r=e.reasons.find(Bo);if(r===void 0)return Ge(e);let n=this.payload;return t.succeedWith(Pg?n.onFailure(r.error):fi(()=>n.onFailure(r.error)))}),b3=HF("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(Pg?r.onFailure(e):fi(()=>r.onFailure(e)))}),KI=l(2,(e,t)=>new b3(e,t)),Ef=l(2,(e,t)=>Ns(e,{onFailure:r=>{let n=r.reasons.find(Bo);return n?t.onFailure(n.error):Ge(r)},onSuccess:t.onSuccess})),Ug=l(2,(e,t)=>new E3(e,t)),Np=l(2,(e,t)=>{if(je(e)){if(e._tag==="Success")return Me(t.onSuccess(e.value));let r=go(e.cause);return be(r)?e:Me(t.onFailure(r.success))}return Ug(e,t)}),qF=l(2,(e,t)=>je(e)?e._tag==="Success"?Me(t.onSuccess(e.value)):Me(t.onFailure(e.cause)):KI(e,t)),Up=e=>je(e)?Me(e):I3(e),I3=io({op:"Exit",[ft](e){return e._stack.push(this),this[ge]},[tr](e,t,r){return t.succeedWith(r??Me(e))},[Ln](e,t,r){return t.succeedWith(r??Ir(e))}}),WF=Np({onFailure:()=>!0,onSuccess:()=>!1}),VF=Np({onFailure:()=>!1,onSuccess:()=>!0}),GF=l(2,(e,t)=>Us(Cf(t),e)),JI=l(2,(e,t)=>oe(ZI(e,t.duration),r=>me(r)?t.orElse():q(r.value))),C3=e=>new yg(`Operation timed out after '${Vb(e)}'`),KF=l(2,(e,t)=>{let r=pt(t);return JI(e,{duration:r,orElse:()=>yt(C3(r))})}),ZI=l(2,(e,t)=>$I(gf(e),un(Cf(t),A()))),JF=e=>qo(t=>{let r=t.monotonicTimeNanosUnsafe();return Re(e,n=>[Fs(t.monotonicTimeNanosUnsafe()-r),n])}),lI="~effect/Scope",pI="~effect/Scope/Closeable",Ii=gt("effect/Scope"),QI=(e,t)=>ue(r=>(A3(r),Dg(e,t)??ye)),Dg=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&gg(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return hg(r.finalizer,t);let n=r.finalizers;return n.size===1?hg(n.values().next().value,t):w3(e,n,t)},hg=(e,t)=>{try{return e(t)}catch(r){return an(r)}},ZF=(e,t)=>yf(e)?t:qn(t,r=>Ge(Oh(e.cause,r))),w3=_I(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=Ea();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?n.push(yield*Up(hg(c,r))):o.push(Nc(a,hg(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*Ag(o)),yield*UI(n)});var QF=(e,t)=>{let r=XF(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(bf(e,r,n=>QI(r,n)),r)},Ci=(e,t)=>le(()=>e.state._tag==="Closed"?t(e.state.exit):(bf(e,{},t),ye)),YF=(e,t)=>Ci(e,ct(t)),bf=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},gg=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=dI:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=dI))},Lg=e=>XF(e,void 0),XF=(e="sequential",t)=>({[pI]:pI,[lI]:lI,strategy:e,parent:t,state:dI}),dI={_tag:"Empty"};var Dp=Ii,eR=fn(Ii),YI=e=>ue(t=>{let r=t.context,n=Lg();return t.setContext(or(t.context,Ii,n)),If(t,o=>(t.setContext(r),Dg(n,o))),e});var Bg=e=>le(()=>{let t=Lg();return Wn(e(t),r=>le(()=>Dg(t,r)??ye))}),Mc=(e,t,r)=>bi(n=>Ho(o=>oe(Dp,s=>Rc(r?.interruptible?o(e):e,a=>Ci(s,i=>Hn(t(a,i),n)))))),XI=e=>oe(Dp,t=>bi(r=>Ci(t,n=>Hn(e(n),r)))),tR=(function(){let e=Bn({op:"OnExit",[ft](r){return r._stack.push(this),this.effect},[xc](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Bp),r.interruptible=!1)},[tr](r,n,o){o??=Me(r);let s;try{s=this.onExit(o)}catch(a){s=an(a)}return s?oe(s,a=>o):o},[Ln](r,n,o){o??=Ir(r);let s;try{s=this.onExit(o)}catch(a){s=an(a)}return s?oe(ZF(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),zo=(e,t,r)=>new tR(e,t,r),If=(e,t)=>{e._stack.push(new tR(void 0,t,void 0))},Wn=l(2,zo),rR=l(2,(e,t)=>Wn(e,r=>t)),e0=l(3,(e,t,r)=>Wn(e,n=>t(n)?r(n):ye)),t0=l(3,(e,t,r)=>Wn(e,n=>{let o=t(n);return be(o)?ye:r(o.success,n)})),r0=l(2,(e,t)=>t0(e,dF,t)),nR=l(3,(e,t,r)=>e0(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),n0=l(3,(e,t,r)=>Wn(e,n=>{if(n._tag!=="Failure")return ye;let o=t(n.cause);return be(o)?ye:r(o.success,n.cause)})),oR=l(2,(e,t)=>n0(MP,t)(e)),Lp=(e,t,r)=>Ho(n=>oe(e,o=>zo(le(()=>n(t(o))),s=>r(o,s),!0))),sR=e=>Mc(e,t=>O(t,Symbol.asyncDispose)?vI(()=>t[Symbol.asyncDispose]()):Q(()=>t[Symbol.dispose]())),o0=l(2,(e,t)=>Q(()=>aR(e,typeof t=="function"?r=>Lr(pt(t(r))):ct(Lr(pt(t)))))),T3=ct(1/0),aR=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,If(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,Rp(i.fiber)}),mg(i.fiber));return[ue(a=>{if(o!==void 0)return a===o.fiber?mg(o.fiber):s(a,o);if(n!==void 0&&(r===1/0||a.getRef(Jr).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(Jr),c={fiber:new _p(a.context),awaiters:0};o=c;let u=s(a,c);return c.fiber.evaluate(zo(e,f=>{if(o!==c||(o=void 0,NI(f)))return;let p=t(f);r=p===1/0?1/0:i.currentTimeMillisUnsafe()+p,n=f})),c.fiber._exit??u}),Q(()=>{n=void 0})]},iR=l(2,(e,t)=>Re(o0(e,t),r=>r[0])),cR=e=>Q(()=>aR(e,T3)[0]),uR=ue(e=>Ge(Pc(e.id))),$c=e=>ue(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Bp)),e)),fR=io({op:"SetInterruptible",[xc](e){if(e.interruptible=this[ge],e._interruptedCause&&e.interruptible)return()=>Ge(e._interruptedCause)}}),Bp=fR(!0),k3=fR(!1),lR=e=>{if(e.interruptible=!0,e._stack.push(k3),e._interruptedCause)return Ge(e._interruptedCause)},A3=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Bp))};var jg=e=>ue(t=>t.interruptible?e:lR(t)??e),Ho=e=>ue(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Bp),e(jg)):e(D)),pR=e=>ue(t=>{if(t.interruptible)return e(D);let r=lR(t),n=e($c);return r??n}),dR=Re(Mc(Q(()=>new AbortController),e=>Q(()=>e.abort())),e=>e.signal),jp=(e,t)=>Cs(e)?t?.mode==="result"?zn(e,Si,t):zn(e,D,t):t?.discard?t.mode==="result"?zn(Object.values(e),Si,t):zn(Object.values(e),D,t):le(()=>{let r={};return un(zn(Object.entries(e),([n,o])=>Re(t?.mode==="result"?Si(o):o,s=>{z(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),s0=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>Re(zn(e,(n,o)=>Si(t(n,o)),r),n=>zb(n,D))),mR=l(3,(e,t,r)=>{let n=Xe(e);return n.length===0?Q(t):le(()=>{let o=0,s=t();return Re(Ds({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),hR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>oe(s0(e,t,{concurrency:r?.concurrency}),([n,o])=>Dr(o)?yt(o):r?.discard?ye:q(n))),gR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(A()):xR(r,0,t,n.value)})),xR=(e,t,r,n)=>oe(r(n,t),o=>{if(o)return q(v(n));let s=e.next();return s.done?q(A()):xR(e,t+1,r,s.value)}),yR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(A()):SR(r,0,t,n.value)})),SR=(e,t,r,n)=>oe(r(n,t),o=>{if(xt(o))return q(v(o.success));let s=e.next();return s.done?q(A()):SR(e,t+1,r,s.value)}),Ds=io({op:"While",[tr](e,t){return this[ge].step(e),this[ge].while()?(t._stack.push(this),this[ge].body()):Kr},[ft](e){return this[ge].while()?(e._stack.push(this),this[ge].body()):Kr}}),zn=l(e=>typeof e[1]=="function",(e,t,r)=>le(()=>{let n=zp(r?.concurrency);if(n===1)return v3(e,t,r);let o=Xe(e),s=o.length;if(s===0)return r?.discard?ye:q([]);let a=r?.discard?void 0:new Array(s),i=O3({f:t,out:a},o,{concurrency:n});return i?un(i,a):q(a)})),ER=e=>oe(e,t=>{let r=t[Symbol.iterator]().next();return r.done?yt(new As):q(r.value)}),v3=(e,t,r)=>le(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return un(Ds({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),zp=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),zg=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,u)=>oe(Up(u),f=>r(s,a[i],f,i)??o(s,a,i+1,c)??ye),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let u=a[i],f=t(s,u,i);if(!je(f))return n(s,a,i,c,f);let p=r(s,u,f,i);if(p)return p._tag==="Failure"?p:void 0}};return o},bR=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,u=!1,f,p,d,m,x,y=w=>{let T=an(w);return m=T,u=!0,p&&p.size>0?oe($c(lf(Array.from(p))),()=>m??T):T},E=()=>{let w=!1;for(;!m&&a<i;a++){let T=o[a],M=x??t(n,T,a);if(je(M)){if(m=r(n,T,M,a),m)break}else if(f){x=void 0;let P=Nc(f,M,!0,!0,"inherit");if(P._exit){if(m=r(n,T,P._exit,a),m)break;continue}p.add(P);let h=a;if(P.addObserver(S=>{p.delete(P);try{if(m){if(S._tag==="Failure"){let b=S.cause.reasons.filter(C=>C._tag!=="Interrupt");if(b.length>0){let C=da(b);m=Ir(m._tag==="Failure"?Oh(m.cause,C):C)}}}else{let b=r(n,T,S,h);b&&(m=b,E())}if(w){let b=E();b&&d(b)}else u&&p.size===0&&d(m??ye)}catch(b){d(y(b))}}),p.size<c)continue;w=!0,a++;return}else return Bt(P=>{f=Ea(),p=new Set,x=M,d=P;let h;try{h=E()}catch(S){return P(y(S))}return h?P(h):le(()=>(m??=Kr,oe(p?lf(p):ye,()=>m?._tag==="Failure"?m:ye)))})}if(u=!0,m){if(p&&p.size>0){let T=kg(f);p.forEach(M=>M.interruptUnsafe(f.id,T));return}if(d||m._tag==="Failure")return m}else if(d)if(p)p.size===0&&d(ye);else return Kr};return E()}},Hg=()=>e=>bR(e),O3=bR({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;e.out&&(e.out[n]=r.value)}}),a0=l(3,(e,t,r)=>oe(e,n=>t(n)?q(n):r(n))),i0=l(3,(e,t,r)=>oe(e,n=>{let o=t(n);return be(o)?r(o.failure):q(o.success)})),IR=l(e=>de(e[0]),(e,t,r)=>i0(e,t,r?n=>yt(r(n)):()=>yt(new As))),CR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>le(()=>{let n=[];return un(zn(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&n.push(o),ye):Re(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),wR=l(e=>Cs(e[0])&&!de(e[0]),(e,t)=>le(()=>{let r=[];for(let n of e){let o=t(n);xt(o)&&r.push(o.success)}return q(r)})),TR=l(e=>Cs(e[0])&&!de(e[0]),(e,t,r)=>le(()=>{let n=[];return un(zn(e,o=>Re(t(o),s=>{xt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),kR=q({}),AR=Rh(Re),vR=Mh(Re,oe),OR=Fh(Re);var _R=l(e=>de(e[0]),(e,t)=>ue(r=>(q3(),q(Nc(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Nc=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new _p(s.context,a);return n||(s.children().add(i),i._parent=s),r?i.evaluate(t):(i._asyncContext=BP(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),i},PR=l(e=>de(e[0]),(e,t)=>ue(r=>q(Nc(r,e,t?.startImmediately,!0,t?.uninterruptible)))),FR=e=>ue(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return zo(e,o=>{let s=t._children;if(s===void 0||s.size===0)return ye;r&&(s=W_(s,i=>!r.has(i)));let a=Mp(Ag(s));return n?jg(a):a})}),c0=l(e=>de(e[0]),(e,t,r)=>ue(n=>{let o=Nc(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};bf(t,s,()=>KP(i=>i===o.id?ye:Rp(o))),o.addObserver(()=>gg(t,s))}else o.interruptUnsafe(n.id,kg(n));return q(o)})),RR=l(e=>de(e[0]),(e,t)=>oe(Dp,r=>c0(e,r,t))),Ta=e=>(t,r)=>{let n=new _p(r?.scheduler?or(e,Tp,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}return r?.onFiberStart&&r.onFiberStart(n),n},MR=l(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(gg(t,e),bf(t,e,()=>Rp(e)),e.addObserver(()=>gg(t,e)),e)),$R=Ta(nr()),u0=e=>{let t=Ta(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},NR=u0(nr()),qg=e=>{let t=Ta(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},UR=qg(nr()),f0=e=>{let t=qg(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw wg(o.cause);return o.value})},DR=f0(nr()),Wg=e=>{let t=Ta(e);return r=>{if(je(r))return r;let n=new Tc("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??an(new bg(o))}},LR=Wg(nr()),l0=e=>{let t=Wg(e);return r=>{let n=t(r);if(n._tag==="Failure")throw wg(n.cause);return n.value}},BR=l0(nr()),vP=q(!0),OP=q(!1),mI=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return vP;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],vP}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](Kr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](Kr)}open=ue(t=>this._isOpen?OP:(this._isOpen=!0,this.scheduleUnsafe(t)));release=ue(t=>this._isOpen?OP:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Bt(t=>this._isOpen?t(ye):(this.waiters.push(t),Q(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=Q(()=>this.closeUnsafe());whenOpen=t=>oe(this.await,()=>t);isOpen(){return this._isOpen}},p0=e=>new mI(e??!1),jR=e=>Q(()=>p0(e)),zR=ue(e=>q(e.getRef(nI))),HR=l(2,(e,t)=>fn(e,nI,t)),qR=fn(fg),WR=fn(vc),xg=BigInt(0),_3={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:xg,endTime:xg,exit:Kr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},P3=e=>Object.assign(Object.create(_3),e),VR=e=>e?$e(e.annotations,ug)?e._tag==="Span"?VR(Cr(e.parent)):A():v(e):A(),d0=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&$e(r.annotations,ug),o=r?.parent!==void 0?v(r.parent):r?.root?A():VR(e.cache.span),s;if(n)s=P3({name:t,parent:o,annotations:or(r?.annotations??nr(),ug,!0)});else{let a=e.cache.tracer??oI,i=e.getRef(Jr),c=e.getRef(vc),u=e.getRef(vp),f=e.getRef(Op),p=r?.level??e.getRef(yP),d=r?.links!==void 0?[...f,...r.links]:f.length===0?[]:f.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??nr(),links:d,startTime:c?i.currentTimeNanosUnsafe():xg,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(fe(o)&&o.value.sampled===!1?!1:!sM(e.getRef(SP),p))});for(let m in u)s.attribute(m,u[m]);if(r?.attributes!==void 0)for(let m in r.attributes)s.attribute(m,r.attributes[m])}return s},GR=(e,t)=>ue(r=>q(d0(r,e,t))),Pp=(e,t)=>$c(ue(r=>{let n=fo(r.context,Ii),o=d0(r,e,t??{}),s=r.getRef(Jr),a=r.getRef(vc);return un(Ci(n,i=>Vg(o,i,s,a)),o)})),KR=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=yi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return oe(Pp(t,r),o=>pf(n,o,r))}return n=>oe(Pp(t,r),o=>pf(n,o,r))},F3=(e,t)=>(t=typeof t=="function"?t:ao,Ia(Ap,r=>({name:e,stack:t,parent:r}))),JR=vp,ZR=Op,QR=l(e=>de(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Ia(e,Op,s=>[...s,...o])}),Vg=(e,t,r,n)=>Q(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():xg,t)}),Fp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return ue(o=>{let s=d0(o,e,r),a=o.getRef(Jr),i=o.getRef(vc);return If(o,c=>Vg(s,c,a,i)),n(s)})},hI=fn(Ac),pf=function(){let e=de(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=D;return t._tag==="Span"&&(r=yi(r),n=F3(t.name,r?.captureStackTrace)),e?hI(n(arguments[0]),t):o=>hI(n(o),t)},YR=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=yi(arguments[2]);if(e){let s=arguments[0];return Fp(t,arguments[2],a=>pf(s,a,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>Fp(t,n?n(...a):o,i=>pf(s,i,r))},XR=l(e=>de(e[0]),(e,...t)=>Ia(e,vp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||z(n,t[0],t[1]),n})),eM=(...e)=>ue(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return ye}),tM=ue(e=>{let t=e.currentSpanLocal;return t?q(t):yt(new As)}),rM=h3(Ac),Jr=ke("effect/Clock",{defaultValue:()=>new gI}),iI=2**31-1,gI=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Q(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return R3()}currentTimeNanos=Q(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return oM()}monotonicTimeNanos=Q(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Lr(t))}sleepMillis(t){return t<=0?hf:Number.isFinite(t)?Bt(r=>{let n=t>iI?this.sleepMillis(t-iI):ye,o=setTimeout(()=>r(n),Math.min(t,iI));return Q(()=>clearTimeout(o))}):Og}},nM=BigInt(1e6),oM=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*nM;return r>t&&(t=r),t}})(),R3=(function(){let e=BigInt(1e9),t;return()=>{let r=oM(),n=BigInt(Date.now())*nM;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),qo=e=>ue(t=>e(t.getRef(Jr))),Cf=e=>qo(t=>t.sleep(pt(e))),m0=qo(e=>e.currentTimeMillis);var xI="~effect/Cause/TimeoutError";var yg=class extends ma("TimeoutError"){[xI]=xI;constructor(t){super({message:t})}},yI="~effect/Cause/IllegalArgumentError";var Sg=class extends ma("IllegalArgumentError"){[yI]=yI;constructor(t){super({message:t})}},SI="~effect/Cause/ExceededCapacityError";var Eg=class extends ma("ExceededCapacityError"){[SI]=SI;constructor(t){super({message:t})}},EI="~effect/Cause/AsyncFiberError";var bg=class extends ma("AsyncFiberError"){[EI]=EI;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},bI="~effect/Cause/UnknownError";var df=class extends ma("UnknownError"){[bI]=bI;constructor(t,r){super({message:r,cause:t})}},h0=ke("effect/Console",{defaultValue:()=>globalThis.console}),M3=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},$3=vb(ha,M3),sM=of($3),g0=ke("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([z3,H3])}),N3=ke("effect/Logger/LogToStderr",{defaultValue:Ql}),aM=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return $c(ue(t=>{let r=t.getRef(Sa),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];z(n,s,a)}return t.setContext(or(t.context,Sa,n)),Ci(fo(t.context,Ii),o=>{let s=t.getRef(Sa),a={...s};for(let i=0;i<e.length;i++){let[c,u]=e[i];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?z(a,c,r[c]):delete a[c])}return t.setContext(or(t.context,Sa,a)),ye})}))},U3="~effect/Logger",D3={[U3]:{_Message:D,_Output:D},pipe(){return ne(this,arguments)}},iM=e=>{let t=Object.create(D3);return t.log=e,t},L3=e=>e.replace(/[\s="]/g,"_"),B3=(e,t)=>`${L3(e[0])}=${t-e[1]}ms`;var Wo=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Zu(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?da(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=Eb),ue(n=>{let o=e??n.cache.logLevel;if(sM(n.cache.minimumLogLevel,o))return ye;let s=n.getRef(Jr),a=n.getRef(g0);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:r,fiber:n,date:i,logLevel:o,message:t})}return ye})};var Oc={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Mpe={None:[],All:[],Trace:[Oc.gray],Debug:[Oc.blue],Info:[Oc.green],Warn:[Oc.yellow],Error:[Oc.red],Fatal:[Oc.bgBrightRed,Oc.black]};var j3=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var z3=iM(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(Tg(e));let a=t.getTime(),i=r.getRef(pg),c="";for(let d of i)c+=` ${B3(d,a)}`;let u=r.getRef(Sa);Object.keys(u).length>0&&s.push(u);let f=r.getRef(h0);(r.getRef(N3)?f.error:f.log)(`[${j3(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),H3=iM(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Jr),s=t.getRef(Sa),a=t.cache.span;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,u]of Object.entries(s))z(i,c,u);i["effect.fiberId"]=t.id,i["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=Tg(e)),a.event(XO(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function q3(){fI.interruptChildren??=u3}var x0=q(void 0);var cM=l(e=>de(e[0]),(e,t)=>r0(e,r=>ue(n=>(W3(n,r,t?.defectsOnly),ye)))),W3=(e,t,r)=>{let n=e.getRef(IP);if(n.size===0||r&&!RP(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Jr).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var uM=Zu,fM=r_,Gg=Bo;var Hp=da;var lM=Qu,wf=bb;var y0=e=>new yc(e),S0=e=>new cp(e),pM=_P,qp=Cg,wi=$P;var Uc=wg,dM=PP;var mM=go;var Kg=Ig;var hM=Tg;var Wp=s_;var Vp=bc,ee=i_;var Jg=Sg;var gM=Eg;var xM=df;var V={};$n(V,{Do:()=>Z6,Transaction:()=>Pf,TypeId:()=>z6,abortSignal:()=>nJ,acquireDisposable:()=>KK,acquireRelease:()=>Qr,acquireUseRelease:()=>F$,addFinalizer:()=>Cx,all:()=>mx,andThen:()=>Kt,annotateCurrentSpan:()=>mJ,annotateLogs:()=>WJ,annotateLogsScoped:()=>VJ,annotateSpans:()=>dJ,as:()=>at,asSome:()=>xx,asVoid:()=>_i,awaitAllChildren:()=>vJ,bind:()=>X6,bindTo:()=>Q6,cached:()=>uC,cachedInvalidateWithTTL:()=>eJ,cachedWithTTL:()=>XK,callback:()=>fr,catch:()=>Jo,catchCause:()=>Ct,catchCauseFilter:()=>dK,catchCauseIf:()=>pK,catchDefect:()=>tC,catchEager:()=>hd,catchFilter:()=>fd,catchIf:()=>fK,catchNoSuchElement:()=>lK,catchReason:()=>iK,catchReasons:()=>cK,catchTag:()=>_a,catchTags:()=>eC,clockWith:()=>Gs,context:()=>Ri,contextWith:()=>ld,currentParentSpan:()=>gJ,currentSpan:()=>hJ,delay:()=>rC,die:()=>lr,effectify:()=>St,ensuring:()=>Ra,eventually:()=>yK,exit:()=>bo,fail:()=>k,failCause:()=>dt,failCauseSync:()=>Oa,failSync:()=>gx,fiber:()=>OJ,fiberId:()=>_J,filter:()=>Ex,filterMap:()=>RK,filterMapEffect:()=>oC,filterMapOrElse:()=>$K,filterMapOrFail:()=>UK,filterOrElse:()=>MK,filterOrFail:()=>NK,findFirst:()=>V6,findFirstFilter:()=>G6,firstSuccessOf:()=>kK,flatMap:()=>I,flatMapEager:()=>Qt,flatten:()=>Q0,flip:()=>aK,fn:()=>UJ,fnUntraced:()=>N,fnUntracedEager:()=>mC,forEach:()=>Eo,forever:()=>vt,forkChild:()=>Mf,forkDetach:()=>AJ,forkIn:()=>Zt,forkScoped:()=>Ma,fromNullishOr:()=>oK,fromOption:()=>rK,fromResult:()=>ud,gen:()=>tt,head:()=>K6,ignore:()=>Ff,ignoreCause:()=>IK,interrupt:()=>En,interruptible:()=>tJ,interruptibleMask:()=>rJ,isEffect:()=>Sn,isFailure:()=>zK,isSuccess:()=>HK,let:()=>Y6,linkSpans:()=>SJ,log:()=>DJ,logDebug:()=>zJ,logError:()=>dd,logFatal:()=>LJ,logInfo:()=>jJ,logTrace:()=>HJ,logWarning:()=>BJ,logWithLevel:()=>Tx,makeSpan:()=>lC,makeSpanScoped:()=>EJ,map:()=>F,mapBoth:()=>mK,mapBothEager:()=>Tr,mapEager:()=>Wc,mapError:()=>Jt,mapErrorEager:()=>md,match:()=>Fi,matchCause:()=>LK,matchCauseEager:()=>BK,matchCauseEffect:()=>Fa,matchCauseEffectEager:()=>jK,matchEager:()=>DK,matchEffect:()=>sC,never:()=>Hc,onError:()=>Zo,onErrorFilter:()=>ZK,onErrorIf:()=>JK,onExit:()=>Jn,onExitFilter:()=>YK,onExitIf:()=>QK,onExitPrimitive:()=>pd,onInterrupt:()=>fC,option:()=>sK,orDie:()=>Pa,orElseSucceed:()=>TK,partition:()=>H6,promise:()=>hx,provide:()=>aC,provideContext:()=>pn,provideService:()=>dn,provideServiceEffect:()=>cC,race:()=>FK,raceAll:()=>nC,raceAllFirst:()=>PK,raceFirst:()=>Hs,reduce:()=>q6,repeat:()=>oJ,repeatOrElse:()=>sJ,replicate:()=>aJ,replicateEffect:()=>iJ,request:()=>TJ,requestUnsafe:()=>kJ,result:()=>Y0,retry:()=>SK,retryOrElse:()=>EK,runCallback:()=>FJ,runCallbackWith:()=>PJ,runFork:()=>Yo,runForkWith:()=>Io,runPromise:()=>pC,runPromiseExit:()=>wx,runPromiseExitWith:()=>RJ,runPromiseWith:()=>dC,runSync:()=>MJ,runSyncExit:()=>Vs,runSyncExitWith:()=>NJ,runSyncWith:()=>$J,sandbox:()=>bK,satisfiesErrorType:()=>sZ,satisfiesServicesType:()=>aZ,satisfiesSuccessType:()=>oZ,schedule:()=>cJ,scheduleFrom:()=>R$,scope:()=>qc,scoped:()=>qs,scopedWith:()=>Ix,service:()=>iC,serviceOption:()=>Rf,setContext:()=>qK,sleep:()=>Pi,spanAnnotations:()=>xJ,spanLinks:()=>yJ,succeed:()=>g,succeedNone:()=>zc,succeedSome:()=>Z0,suspend:()=>L,sync:()=>U,tap:()=>jr,tapCause:()=>Sx,tapCauseFilter:()=>xK,tapCauseIf:()=>gK,tapDefect:()=>P$,tapError:()=>yx,tapErrorTag:()=>hK,timed:()=>_K,timeout:()=>AK,timeoutOption:()=>vK,timeoutOrElse:()=>OK,tracer:()=>uJ,track:()=>KJ,trackDefects:()=>QJ,trackDuration:()=>YJ,trackErrors:()=>ZJ,trackSuccesses:()=>JJ,transposeOption:()=>nK,try:()=>Rt,tryPromise:()=>Oi,tx:()=>XJ,txRetry:()=>nZ,undefined:()=>J6,uninterruptible:()=>Qo,uninterruptibleMask:()=>Ws,unwrapReason:()=>uK,updateContext:()=>WK,updateService:()=>VK,updateServiceScoped:()=>GK,useSpan:()=>bJ,validate:()=>W6,void:()=>W,when:()=>bx,whileLoop:()=>Ko,withErrorReporting:()=>wK,withExecutionPlan:()=>CK,withFiber:()=>Kn,withFiberSucceed:()=>tK,withLogSpan:()=>GJ,withLogger:()=>qJ,withParentSpan:()=>wJ,withSpan:()=>IJ,withSpanScoped:()=>CJ,withTracer:()=>fJ,withTracerEnabled:()=>lJ,withTracerTiming:()=>pJ,yieldNow:()=>cd,yieldNowWith:()=>eK,zip:()=>X0,zipWith:()=>_$});var Zg=up,Zr=Me,Vn=Ir,Vo=jn,yM=an,SM=xf,Gt=Kr;var et=yf,ka=pF;var EM=NI;var bM=yF;var IM=UI;var V3="~effect/Deferred";var G3={[V3]:{_A:D,_E:D},pipe(){return ne(this,arguments)}},CM=function(){this.resumes=void 0,this.effect=void 0};CM.prototype=G3;var Aa=()=>new CM;var Ti=e=>Bt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),Q(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var K3=l(2,(e,t)=>Q(()=>xo(e,t))),J3=K3;var Z3=l(2,(e,t)=>J3(e,Ir(t)));var E0=l(2,(e,t)=>Z3(e,Pc(t))),b0=e=>Q(()=>I0(e)),I0=e=>e.effect!==void 0;var xo=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var wM=Sa;var TM=pg;var kM=lg;var AM=vc;var ln=Ii;var yo=Lg,va=eR,Ls=Ci,cr=YF;var ur=QF,Ze=QI;var FM="~effect/Layer",OM="~effect/Layer/MemoMap",Q3=(e,t)=>{let r={observers:0,deferred:Aa(),scope:yo(),finalizer:n=>le(()=>--r.observers>0?ye:(e.map.delete(t),Ze(r.scope,n)))};return r},_M=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,bf(t,{},e.finalizer),!0),RM=e=>O(e,FM),Y3={[FM]:{_ROut:D,_E:D,_RIn:D},pipe(){return ne(this,arguments)}},MM=e=>{let t=Object.create(Y3);return t.build=e,t},C0=e=>MM((t,r)=>{let n=ur(r);return Wn(e(t,n),o=>o._tag==="Failure"?Ze(n,o):ye)}),X3=e=>{let t=C0((r,n)=>r.getOrElseMemoize(t,n,e));return t},Qg=class{get[OM](){return OM}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(_M(n,r),n.deferred.effect??Ti(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return le(()=>{let o;return zo(le(()=>{let s=this.get(t,r);if(s)return s;let a=Q3(this,t);return _M(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&xo(o,s)})})}},Jp=()=>new Qg,e6=e=>new Qg(e);var Kp=class e extends gt()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Vh(t,e);return r?e6(r):Jp()}},Zp=l(3,(e,t,r)=>fn(Re(le(()=>e.build(t,r)),or(Kp,t)),Kp,t));var Xg=l(2,(e,t)=>ue(r=>Zp(e,Kp.forkOrCreate(r.context),t))),Bs=function(){return arguments.length===1?e=>Yg(xa(arguments[0],e)):Yg(xa(arguments[0],arguments[1]))},Yg=e=>MM(ct(q(e)));var Tf=function(){return arguments.length===1?e=>PM(arguments[0],e):PM(arguments[0],arguments[1])},PM=(e,t)=>t6(Re(t,r=>xa(e,r))),t6=e=>X3((t,r)=>va(e,r));var $M=(e,t,r)=>{let n=ur(r,"parallel");return zn(e,o=>o.build(t,ur(n,"sequential")),{concurrency:e.length}).pipe(Re(o=>D_(...o)))},ex=(...e)=>C0((t,r)=>$M(e,t,r));var NM=(e,t,r)=>C0((n,o)=>oe(Array.isArray(t)?$M(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Hn(s),Re(a=>r(a,s))))),UM=l(2,(e,t)=>NM(e,t,D)),DM=l(2,(e,t)=>NM(e,t,(r,n)=>wc(n,r)));var kf=Jr;var tx="~effect/DateTime",rx="~effect/DateTime/TimeZone",BM={[tx]:tx,pipe(){return ne(this,arguments)},[ot](){return this.toString()},toJSON(){return Xp(this).toJSON()}},n6={...BM,_tag:"Utc",[ae](){return Wt(this.epochMilliseconds)},[ie](e){return vf(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Xp(this).toJSON()})`}},o6={...BM,_tag:"Zoned",[ae](){return xe(Wt(this.epochMilliseconds))(Y(this.zone))},[ie](e){return vf(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Z(this.zone,e.zone)},toString(){return`DateTime.Zoned(${$0(this)})`}},jM={[rx]:rx,[ot](){return this.toString()}},s6={...jM,_tag:"Named",[ae](){return De(`Named:${this.id}`)},[ie](e){return Dc(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},a6={...jM,_tag:"Offset",[ae](){return De(`Offset:${this.offset}`)},[ie](e){return Dc(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${F0(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},js=(e,t,r)=>{let n=Object.create(o6);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},vf=e=>O(e,tx);var Dc=e=>O(e,rx),zM=e=>Dc(e)&&e._tag==="Offset",HM=e=>Dc(e)&&e._tag==="Named",qM=e=>e._tag==="Utc",k0=e=>e._tag==="Zoned",WM=Ur((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var VM=e=>{let t=Object.create(n6);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Af=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Jg("Invalid date");return VM(t)},ox=e=>{if(vf(e))return e;if(e instanceof Date)return Af(e);if(typeof e=="object"){if("epochMilliseconds"in e)return Af(new Date(e.epochMilliseconds));let t=new Date(0);return m6(t,e),Af(t)}else if(typeof e=="string"&&!i6(e))return Af(new Date(e+"Z"));return Af(new Date(e))},i6=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),c6=-864e13+720*60*1e3,u6=864e13-840*60*1e3,A0=(e,t)=>{let r=t?.timeZone;if(r===void 0&&vf(e)&&k0(e))return e;let n=ox(e);if(n.epochMilliseconds<c6||n.epochMilliseconds>u6)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e=="object"&&"timeZoneId"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Yp(s)}else if(Dc(r))o=r;else if(typeof r=="number")o=Yp(r);else{let s=_0(r);if(me(s))throw new Jg(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?js(n.epochMilliseconds,o,n.partsUtc):h6(n.epochMilliseconds,o,t?.disambiguation??"compatible")},w0=jo(A0),GM=jo(ox),f6=/^(.{17,35})\[(.+)\]$/,KM=e=>{let t=f6.exec(e);if(t===null){let o=M0(e);return o!==null?w0(e,{timeZone:o}):A()}let[,r,n]=t;return w0(r,{timeZone:n})};var JM=e=>VM(e.epochMilliseconds);var nx=new Map,l6={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},p6=e=>{let t=e.resolvedOptions().timeZone,r=nx.get(t);if(r!==void 0)return r;let n=Object.create(s6);return n.id=t,n.format=e,nx.set(t,n),n},v0=e=>{let t=nx.get(e);if(t!==void 0)return t;try{let r=p6(new Intl.DateTimeFormat("en-US",{...l6,timeZone:e}));return nx.set(e,r),r}catch{throw new Jg(`Invalid time zone: ${e}`)}},Yp=e=>{let t=Object.create(a6);return t.offset=e,t},O0=jo(v0);var d6=/^(?:GMT|[+-])/,_0=e=>{if(d6.test(e)){let t=M0(e);return t===null?A():v(Yp(t))}return O0(e)},ZM=e=>e._tag==="Offset"?F0(e.offset):e.id;var Xp=e=>new Date(e.epochMilliseconds),sx=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(n=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type==="fractionalSecond"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},P0=e=>sx(e).getTime()-R0(e),F0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},QM=e=>F0(P0(e)),R0=e=>e.epochMilliseconds;var m6=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var LM=1440*60*1e3,h6=(e,t,r)=>{if(t._tag==="Offset")return js(e-t.offset,t);let n=Qp(e-LM,e,t),o=Qp(e+LM,e,t);if(n===o)return js(e-n,t);let s=n<o,a=n-o;if(s){if(Qp(e-o,e,t)===o)return js(e-o,t);let u=js(e-n,t),f=sx(u).getTime();if(e!==f)switch(r){case"reject":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case"earlier":return js(e-o,t);case"compatible":case"later":return u}return u}if(Qp(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||Qp(e-n+a,e+a,t)===n)return js(e-n,t);if(r==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return js(e-o,t)},g6=/([+-])(\d{2}):(\d{2})$/,M0=e=>{let t=g6.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Qp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=M0(n);return o===null?P0(js(t,r)):o};var YM=e=>Xp(e).toISOString();var T0=e=>{let t=sx(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${QM(e)}`},$0=e=>e.zone._tag==="Offset"?T0(e):`${T0(e)}[${e.zone.id}]`;var xde=globalThis.Number;var e$=l(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=XM(e),[o,s]=XM(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),u=i%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${a}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f});function XM(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf("e"),n=t.slice(0,r).replace(".","");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var t$=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var r$=l(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var Sde=globalThis.String,ax=Nn;var o$=e=>e.trim();var s$=(e,t,r)=>{let n=r*(t-e)+e;if(n!==t||e>=t||!Number.isFinite(t))return n;if(t===0)return-Number.MIN_VALUE;let o=new DataView(new ArrayBuffer(8));o.setFloat64(0,t);let s=o.getBigUint64(0);return o.setBigUint64(0,t>0?s-BigInt(1):s+BigInt(1)),o.getFloat64(0)};var ze=l(2,(e,t)=>Ca(e,S6,r=>t(r))),zs=e=>e.reasons.some(U0),U0=e=>e._tag==="Fail"&&Wp(e.error),ed=e=>{let t,r=!1;for(let n of e.reasons)U0(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?X(e):r?X(Hp(e.reasons.filter(n=>!U0(n)))):G(t)};var S6=e=>{let t=ed(e);return be(t)?t:G(t.success.value)},ix=e=>{let t=ed(e);return be(t)?Vn(t.failure):Zr(t.success.value)},cx=l(2,(e,t)=>Ns(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=ed(r);return be(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var a$="~effect/Schedule";var wr=ke("effect/Schedule/CurrentMetadata",{defaultValue:ct({input:void 0,output:void 0,duration:gi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),E6={[a$]:{_Out:D,_In:D,_Env:D},pipe(){return ne(this,arguments)}},D0=e=>O(e,a$),td=e=>{let t=Object.create(E6);return t.step=e,t},L0=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,a=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:a}}},b6=e=>td(Re(e,t=>{let r=L0();return(n,o)=>t(r(n,o))})),Lc=e=>qn(e.step,t=>q(()=>Ge(t))),Go=e=>qo(t=>Re(Lc(e),r=>{let n=L0();return o=>le(()=>{let s=t.currentTimeMillisUnsafe();return oe(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,un(Cf(i),c)})})})),rd=e=>Re(Go(e),t=>r=>Re(t(r),n=>n.output));var B0=e=>td(Re(Lc(e),t=>(r,n)=>cx(t(r,n),{onSuccess:o=>q([n,o[1]]),onFailure:Ge,onDone:()=>ee(n)}))),i$=e=>nd(od,({attempt:t})=>q(t<=e)),j0=e=>{let t=pt(e);return b6(q(r=>q([r.attempt-1,t])))};var nd=l(2,(e,t)=>td(Re(Lc(e),r=>{let n=L0();return(o,s)=>oe(r(o,s),a=>{let[i,c]=a,u=t({...n(o,s),output:i,duration:c});return oe(de(u)?u:q(u),f=>f?q(a):ee(i))})})));var od=j0(gi);var c$="~effect/ExecutionPlan";var I6={[c$]:c$,get captureRequirements(){let e=this;return bi(t=>q(C6(e.steps.map(r=>({...r,while:r.while?n=>Hn(r.while(n),t):void 0,schedule:r.schedule?td(Hn(Re(Lc(r.schedule),n=>(o,s)=>Hn(n(o,s),t)),t)):void 0,provide:RM(r.provide)?UM(r.provide,Yg(t)):r.provide})))))},pipe(){return ne(this,arguments)}},C6=e=>{let t=Object.create(I6);return t.steps=e,t};var ux=ke("effect/ExecutionPlan/CurrentMetadata",{defaultValue:ct({attempt:0,stepIndex:0})});var w6=(e,t,r)=>Bg(n=>oe(r?.local?Zp(t,Jp(),n):Xg(t,n),o=>Hn(e,o))),fx=l(e=>de(e[0]),(e,t,r)=>xp(t)?Hn(e,t):w6(e,Array.isArray(t)?ex(...t):t,r));var f$=e=>e.reasons.every(Bo)?go(e):X(e),H0=l(3,(e,t,r)=>oe(Go(t),n=>{let o=wr.defaultValue();return Ca(ze(Rg(Rc(oe(le(()=>fn(e,wr,o)),n),s=>Q(()=>{o=s})),{disableYield:!0}),s=>q(s)),f$,s=>r(s,o.attempt===0?A():v(o)))})),q0=l(3,(e,t,r)=>oe(Go(t),n=>{let o=wr.defaultValue(),s,a=Ca(le(()=>fn(e,wr,o)),f$,i=>(s=i,oe(n(i),c=>(o=c,a))));return ze(a,i=>fi(()=>r(s,i)))})),l$=l(2,(e,t)=>{let r=typeof t=="function"?t(D):D0(t)?t:ad(t);return H0(e,r,yt)}),sd=l(2,(e,t)=>{let r=typeof t=="function"?t(D):D0(t)?t:ad(t);return q0(e,r,yt)}),p$=l(3,(e,t,r)=>oe(Go(r),n=>{let o=wr.defaultValue(),s=le(()=>fn(e,wr,o));return ze(oe(n(t),a=>{o=a;let i=ct(oe(s,n));return Ds({while:sn,body:i,step(c){o=c}})}),a=>q(a))})),T6=B0(od),ad=e=>{let t=e.schedule?B0(e.schedule):T6;return e.while&&(t=nd(t,({input:r})=>{let n=e.while(r);return de(n)?n:q(n)})),e.until&&(t=nd(t,({input:r})=>{let n=e.until(r);return de(n)?Re(n,o=>!o):q(!n)})),e.times!==void 0&&(t=nd(t,({attempt:r})=>q(r<=e.times))),t};var W0=(e,t)=>{let r=-1,n=0,o=s=>Ng(e(s));return{begin:qo(s=>le(()=>{let a=t();a.stepIndex!==r&&(r=a.stepIndex,n=0),n++;let i={attempt:a.attempt,stepAttempt:n,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return un(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>qo(i=>{let c=Fs(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag==="Success"?{_tag:"AttemptSuccess",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:"AttemptFailure",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},m$=l(e=>de(e[0]),(e,t,r)=>le(()=>{let n=0,o={attempt:0,stepIndex:0},s=Fg(ux,Q(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:W0(r.onEvent,()=>o),i=a===void 0?D:u=>Ho(f=>oe(a.begin,p=>Wn(f(u),d=>a.end(p,d)))),c;return oe(Ds({while:()=>n<t.steps.length&&(c===void 0||be(c)),body(){let u=t.steps[n],f=s(i(fx(e,u.provide)));if(c){let p=!1,d=f;f=le(()=>p?d:(p=!0,mf(c))),f=sd(f,id(u,!1))}else{let p=id(u,!0);f=p?sd(f,p):f}return Si(f)},step(u){c=u,n++}}),()=>mf(c))})),id=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return ad({schedule:e.schedule?e.schedule:e.attempts?void 0:k6,times:e.attempts,while:e.while});return ad({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},k6=i$(1);var g$="~effect/MutableHashMap";var A6={[g$]:g$,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${j(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:er(Array.from(this))}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},Bc=()=>{let e=Object.create(A6);return e.backing=new Map,e.buckets=new Map,e};var Gn=l(2,(e,t)=>{if(e.backing.has(t))return v(e.backing.get(t));if(V0(t))return A();let r=Y(t),n=e.buckets.get(r);return n===void 0?A():v6(e,n,t)}),V0=e=>typeof e!="object"&&typeof e!="function";var v6=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(Z(r,t[n])){let s=t[n];return v(e.backing.get(s))}return A()},G0=l(2,(e,t)=>fe(Gn(e,t))),jc=l(3,(e,t,r)=>{if(e.backing.has(t)||V0(t))return e.backing.set(t,r),e;let n=Y(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=O6(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),O6=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(Z(t,e[r]))return e[r]};var vi=l(2,(e,t)=>{if(V0(t))return e.backing.delete(t),e;let r=Y(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a===t||Z(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),lx=e=>(e.backing.clear(),e.buckets.clear(),e),x$=e=>e.backing.size;var _6="~effect/Request",P6=JO({_E:e=>e,_A:e=>e,_R:e=>e}),jde={...t_,[_6]:P6};var y$=e=>e;var E$=l(2,(e,t)=>{let r=n=>Bt(o=>{let s=I$(n,e,o,Ea());return $6(n,s)});return de(t)?oe(t,r):r(t)}),b$=(e,t)=>{let r=I$(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:$e(t.context,Tp)}});return()=>C$(t.resolver,r)},R6=new WeakSet,M6=e=>{if(!R6.has(e.batchKey))return new Map;let t=Bc();return{get:r=>Cr(Gn(t,r)),has:r=>G0(t,r),set:(r,n)=>jc(t,r,n),delete:r=>vi(t,r)}},dx=[],K0=new WeakMap,I$=(e,t,r,n)=>{let o=K0.get(e);o||(o=M6(e),K0.set(e,o));let s,a=!1,i=y$({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(dx.length>0)s=dx.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:oe(le(()=>u.resolver.delay),f=>S$(u)),run:Wn(le(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let p of u.entrySet)p.completeUnsafe(f._tag==="Success"?an(new Error("Effect.request: RequestResolver did not complete request",{cause:p.request})):f);return u.entries.clear(),dx.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,dx.push(u)),ye})};s=u}o.set(c,s),s.fiber=Ta(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=Ta(n.context)(S$(s),{scheduler:n.cache.scheduler})),i},C$=(e,t)=>{if(t.uninterruptible)return;let r=K0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(xf()),s?.interruptUnsafe()},$6=(e,t)=>Q(()=>C$(e,t));function S$(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):ye}var U6="effect/Metric/CurrentMetricAttributes",D6=ke(U6,{defaultValue:()=>({})}),L6="effect/Metric/MetricRegistry",B6=ke(L6,{defaultValue:()=>new Map}),w$="~effect/Metric",T$=class{[w$]=w$;#t;#e="";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=$e(t,D6);r!==this.#t&&(this.#t=r,this.#e=j6(this,k$(this.attributes,r)));let n=$e(t,B6),o=n.get(this.#e);return ci(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?k$(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#e,o)),o.hooks}pipe(){return ne(this,arguments)}};var _f=l(2,(e,t)=>bi(r=>Q(()=>e.updateUnsafe(t,r))));function j6(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function k$(e,t){return{...A$(e),...A$(t)}}function A$(e){return Tt(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(z(t,r,n),t),{}):e}var z6=vs,Sn=de,mx=jp,H6=s0,q6=mR,W6=hR,V6=gR,G6=yR,Eo=zn,K6=ER,Ko=Ds,hx=vI,Oi=GP,g=q,zc=Fc,Z0=AI,L=le,U=Q,W=ye;var J6=x0;var fr=Bt,Hc=Og,Z6=kR,Q6=AR,Y6=OR;var X6=vR,tt=QP,k=yt,gx=vg,dt=Ge,Oa=WP,lr=Ei,Rt=VP;var cd=hf,eK=kI,Kn=ue,tK=o_,ud=mf,rK=TI,nK=qP,oK=HP,I=oe,Q0=iF,Kt=Us,jr=Rc,Y0=Si,sK=jF,bo=Up,F=Re,at=un,xx=gf,_i=Mp,aK=rF,X0=CF,_$=LI,Jo=wa;var _a=HI,eC=MF,iK=$F,cK=NF,uK=UF,Ct=qn,tC=OF,fK=$p,fd=$g,lK=vF,pK=jI,dK=Ca,Jt=qI,mK=WI,Pa=VI,yx=zI,hK=FF,Sx=_F,gK=PF,xK=Mg,P$=RF,yK=GI,SK=sd,EK=q0,bK=nF,Ff=BF,IK=Ng,CK=m$,wK=cM,TK=DF,kK=LF,AK=KF,vK=ZI,OK=JI,rC=GF,Pi=Cf,_K=JF,nC=RI,PK=MI,FK=oF,Hs=$I,Ex=CR,RK=wR,oC=TR,MK=a0,$K=i0,NK=wF,UK=IR,bx=TF,Fi=Ug,DK=Np,LK=KI,BK=qF,jK=sF,Fa=Ns,sC=Ef,zK=WF,HK=VF,Ri=DI,ld=bi,aC=fx,pn=Hn,qK=IF,iC=SF,Rf=EF,WK=Sf,VK=Ia,GK=bF,dn=fn,cC=Fg,qc=Dp,qs=YI,Ix=Bg,Qr=Mc,KK=sR,F$=Lp,Cx=XI,Ra=rR,Zo=r0,JK=nR,ZK=n0,pd=zo,Jn=Wn,QK=e0,YK=t0,uC=cR,XK=iR,eJ=o0,En=uR,tJ=jg,fC=oR,Qo=$c,Ws=Ho,rJ=pR,nJ=dR,vt=Rg,oJ=l$,sJ=H0,aJ=BI,iJ=kF,cJ=l(2,(e,t)=>R$(e,void 0,t)),R$=p$,uJ=zR,fJ=HR,lJ=qR,pJ=WR,dJ=XR,mJ=eM,hJ=tM,gJ=rM,xJ=JR,yJ=ZR,SJ=QR,lC=GR,EJ=Pp,bJ=Fp,IJ=YR,CJ=KR,wJ=pf,TJ=E$,kJ=b$,Mf=_R,Zt=c0,Ma=RR,AJ=PR,vJ=FR,OJ=JP,_J=ZP,Yo=$R,Io=Ta,PJ=u0,FJ=NR,pC=DR,dC=f0,wx=UR,RJ=qg,MJ=BR,$J=l0,Vs=LR,NJ=Wg,N=_I,UJ=YP,Gs=qo,Tx=Wo,DJ=Wo(),LJ=Wo("Fatal"),BJ=Wo("Warn"),dd=Wo("Error"),jJ=Wo("Info"),zJ=Wo("Debug"),HJ=Wo("Trace"),qJ=l(2,(e,t)=>Ia(e,g0,r=>new Set([...r,t]))),WJ=l(e=>Sn(e[0]),(e,...t)=>Ia(e,wM,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||z(n,t[0],t[1]),n})),VJ=aM,GJ=l(2,(e,t)=>oe(m0,r=>Ia(e,TM,n=>[[t,r],...n]))),KJ=l(e=>Sn(e[0]),(e,t,r)=>Jn(e,n=>{let o=r===void 0?n:r(n);return _f(t,o)})),JJ=l(e=>Sn(e[0]),(e,t,r)=>jr(e,n=>{let o=r===void 0?n:r(n);return _f(t,o)})),ZJ=l(e=>Sn(e[0]),(e,t,r)=>yx(e,n=>{let o=r===void 0?n:r(n);return _f(t,o)})),QJ=l(e=>Sn(e[0]),(e,t,r)=>P$(e,n=>{let o=r===void 0?n:r(n);return _f(t,o)})),YJ=l(e=>Sn(e[0]),(e,t,r)=>Gs(n=>{let o=n.monotonicTimeNanosUnsafe();return Jn(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=uP(pt(s),pt(o)),i=r===void 0?a:r(a);return _f(t,i)})})),Pf=class extends gt()("effect/Effect/Transaction"){},XJ=e=>Kn(t=>{let r=Vh(t.context,Pf);if(r&&!O$.has(r))return e;let n=t.getRef(Jr),o=n.currentTimeMillisUnsafe(),s={journal:new Map,retry:!1,attempt:1,retryReason:void 0,start:o,now:o,elapsed:0,elapsedSincePrevious:0},a;return Ws(i=>{let c=i(e).pipe(dn(Pf,s),Sx(u=>s.retry?Cg(u)?i(tZ(s)):U(()=>J0(s)):W),bo);return I(Ko({while:()=>!a,body:()=>(s.attempt>1&&eZ(s,n.currentTimeMillisUnsafe()),c),step(u){if(s.retry||!M$(s))return s.attempt++,s.retryReason=s.retry?"retry":"conflict",J0(s);et(u)&&rZ(t,s),J0(s),O$.add(s),a=u}}),()=>a)})}),O$=new WeakSet,eZ=(e,t)=>{e.elapsedSincePrevious=t-e.now,e.now=t,e.elapsed=t-e.start},M$=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},tZ=e=>fr(t=>{if(!M$(e))return t(W);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(W)};for(let a of n)a.pending.set(r,s);return U(o)});function rZ(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function J0(e){e.retry=!1,e.journal.clear()}var nZ=I(Pf,e=>{let t=e;return t.retry=!0,En}),St=(e,t,r)=>(...n)=>fr(o=>{try{e(...n,(s,a)=>{o(s?t?L(()=>k(t(s,n))):k(s):g(a))})}catch(s){o(r?k(r(s,n)):lr(s))}}),oZ=()=>e=>e,sZ=()=>e=>e,aZ=()=>e=>e,Wc=cF,md=uF,Tr=fF,Qt=aF,hd=lF,mC=XP;var $$=(e,t)=>et(e)?t(0):qp(e.cause)?t(130):t(N$(Uc(e.cause))),hC=e=>l(t=>Sn(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?Yo(t):Yo(Sx(t,s=>qp(s)?W:U$(Uc(s))?dd(s):W));try{let s=globalThis.setInterval(yn,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??$$;return e({fiber:n,teardown:o})}),gd="~effect/Runtime/errorExitCode",N$=e=>{if(typeof e=="object"&&e!==null&&gd in e){let t=e[gd];if(typeof t=="number")return t}return 1},Mi="~effect/Runtime/errorReported",U$=e=>{if(typeof e=="object"&&e!==null&&Mi in e){let t=e[Mi];if(typeof t=="boolean")return t}return!0};var D$=hC(({fiber:e,teardown:t})=>{let r=!1;e.addObserver(o=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,s=>{(r||s!==0)&&process.exit(s)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)});var L$=D$;var qr={};$n(qr,{FileSystem:()=>os,FileTypeId:()=>Vf,WatchBackend:()=>Wf,isFile:()=>fY,layerNoop:()=>uY,make:()=>Nw,makeNoop:()=>UU});var B$=globalThis.BigInt;var kx=e=>e>B$(Number.MAX_SAFE_INTEGER)||e<B$(Number.MIN_SAFE_INTEGER)?A():v(Number(e));var xC=BigInt(0),uZ=BigInt(1),Ks=BigInt(1e3),$i=BigInt(1024),j$=[{symbol:"B",factor:uZ,names:["B","byte","bytes"]},{symbol:"kB",factor:Ks,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ks**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ks**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ks**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ks**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ks**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ks**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ks**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ks**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ks**BigInt(10),names:["QB","quettabyte","quettabytes"]}],fZ=[j$[0],{symbol:"KiB",factor:$i,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:$i**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:$i**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:$i**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:$i**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:$i**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:$i**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:$i**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],lZ=[...j$,...fZ.slice(1)],pZ=new Map(lZ.flatMap(e=>e.names.map(t=>[t,e])));var yC=e=>e;var $f=e=>{throw new Error(`Invalid ByteSize: ${e}`)},z$=e=>!Number.isSafeInteger(e)||e<0?$f(`expected a non-negative safe integer, received ${e}`):yC(BigInt(e));var H$=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return $f(`unsupported syntax ${JSON.stringify(e)}`);let r=pZ.get(t[3]);if(r===void 0)return $f(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??"",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==xC?$f(`${JSON.stringify(e)} does not represent an integral number of bytes`):yC(s/o)},q$=jo(H$),Gc=e=>{switch(typeof e){case"bigint":return e<xC?$f(`expected a non-negative bigint, received ${e}`):yC(e);case"number":return z$(e);case"string":return H$(e)}return $f(`unsupported input ${e}`)},SC=jo(Gc),xd=e=>typeof e=="bigint"?Gc(e):z$(e);var W$=e=>typeof e=="bigint"&&e>=xC;var Ax=e=>e,V$=kx;var G$="~effect/PlatformError",Uf=class extends mo("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},EC=class extends kp{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},vx=class extends mo("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[G$]=G$;get message(){return this.reason.message}};var Zn=e=>new vx(new EC(e)),Co=e=>new vx(new Uf(e));var J$="~effect/Chunk";function K$(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var Z$=[],IC=e=>Ur((t,r)=>{if(t.length!==r.length)return!1;let n=Kc(t),o=Kc(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),dZ=IC(Z),mZ={[J$]:{_A:e=>e},toString(){return`Chunk(${j(Kc(this))})`},toJSON(){return{_id:"Chunk",values:er(Kc(this))}},[ot](){return this.toJSON()},[ie](e){return Ox(e)&&dZ(this,e)},[ae](){return ws(Kc(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Z$[Symbol.iterator]();default:return Kc(this)[Symbol.iterator]()}},pipe(){return ne(this,arguments)}},CC=e=>{let t=Object.create(mZ);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=$a,t.right=$a;break}case"ISingleton":{t.length=1,t.depth=0,t.left=$a,t.right=$a;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=$a,t.right=$a;break}}return t},Ox=e=>O(e,J$),$a=CC({_tag:"IEmpty"}),hZ=()=>$a;var gZ=e=>CC({_tag:"ISingleton",a:e}),wC=e=>Ox(e)?e:yZ(Xe(e)),bC=(e,t,r)=>{switch(e.backing._tag){case"IArray":{K$(e.backing.array,0,t,r,e.length);break}case"IConcat":{bC(e.left,t,r),bC(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{K$(Kc(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var xZ=e=>{switch(e.backing._tag){case"IEmpty":return Z$;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return bC(e,t,0),e.backing={_tag:"IArray",array:t},e.left=$a,e.right=$a,e.depth=0,t}}},Kc=xZ;var yZ=e=>e.length===0?hZ():e.length===1?gZ(e[0]):CC({_tag:"IArray",array:e});var Q$=e=>e.length;var Y$=wI;var Ni=mg,X$=jP,Xo=Rp;var Df=Ea,Ui=MR;var zr=p0,eN=jR;var tN="~effect/MutableRef",SZ={[tN]:tN,...Nr,toJSON(){return{_id:"MutableRef",current:er(this.current)}}},Di=e=>{let t=Object.create(SZ);return t.current=e,t};var rN=e=>e.current;var _x=l(2,(e,t)=>(e.current=t,e));var kr=Symbol.for("effect/MutableList/Empty"),Ua=()=>({head:void 0,tail:void 0,length:0}),kC=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},nN=()=>({array:[],mutable:!0,offset:0,next:void 0}),es=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=nN(),e.tail=e.tail.next):e.head=e.tail=nN(),e.tail.array.push(t),e.length++},AC=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var Fx=(e,t)=>Rx(e,Xe(t),!Array.isArray(t)),Rx=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},Na=e=>{e.head=e.tail=void 0,e.length=0},Jc=(e,t)=>{if(t=At(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return Na(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?Na(e):kC(e),r;o=o.next}return Na(e),r},Mx=(e,t)=>{if(t=At(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){Na(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,kC(e);return}r+=o,n=n.next}Na(e)},Li=e=>Jc(e,e.length),Zc=e=>{if(!e.head)return kr;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:Na(e):kC(e),t},oN=(e,t)=>{if(t=At(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let a=s.offset;a<s.array.length;a++)if(n[o++]=s.array[a],o===r)return n;s=s.next}return n};var vC=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){Na(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},sN=(e,t)=>vC(e,r=>r!==t);var EZ="~effect/PubSub";var bZ="~effect/PubSub/Subscription",Lx=e=>U(()=>AZ(e.atomicPubSub(),new Map,yo(),zr(!1),Di(!1),e.strategy(),Di(A()))),Bx=e=>Lx({atomicPubSub:()=>BC(e),strategy:()=>new Nx}),jx=e=>Lx({atomicPubSub:()=>BC(e),strategy:()=>new Ux}),zx=e=>Lx({atomicPubSub:()=>BC(e),strategy:()=>new LC}),Hx=e=>Lx({atomicPubSub:()=>aN(e),strategy:()=>new Ux}),BC=e=>{let t=typeof e=="number"?{capacity:e}:e;if(vZ(t.capacity),t.capacity===1/0)return aN(t);let r=t.replay&&t.replay>0?new Dx(Math.ceil(t.replay)):void 0;return t.capacity===1?new RC(r):t$(t.capacity)===t.capacity?new PC(t.capacity,r):new OC(t.capacity,r)},aN=e=>{let t=e?.replay;return new $C(t&&t>0?new Dx(Math.ceil(t)):void 0)};var bd=e=>Qo(Kn(t=>(_x(e.shutdownFlag,!0),Ze(e.scope,SM(t.id)).pipe(Kt(e.strategy.shutdown),bx(e.shutdownHook.open),_i)))),qx=l(2,(e,t)=>U(()=>IZ(e,t))),IZ=l(2,(e,t)=>{if(e.shutdownFlag.current||fe(e.ended.current))return!1;if(_x(e.ended,v(t)),e.strategy instanceof Nx)for(let[n,o,s]of Li(e.strategy.publishers))s&&xo(o,Zr(!1));let r=Zr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=Zc(o))!==kr;)xo(s,r)}return e.subscribers.clear(),!0});var Wx=l(2,(e,t)=>L(()=>e.shutdownFlag.current||fe(e.ended.current)?g(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),g(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag,e.ended)));var iN=l(2,(e,t)=>L(()=>{if(e.shutdownFlag.current||fe(e.ended.current))return g(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?g(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag,e.ended)})),Id=e=>Qo(ld(t=>{let r=$e(t,ln),n=ur(e.scope),o=kZ(e.pubsub,e.subscribers,e.strategy,e.ended);return cr(n,CZ(o)).pipe(Kt(Ls(r,s=>Ze(n,s))),at(o))})),CZ=e=>Qo(Kn(t=>(_x(e.shutdownFlag,!0),Eo(Li(e.pollers),r=>E0(r,t.id),{discard:!0,concurrency:"unbounded"}).pipe(jr(()=>U(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),bx(e.shutdownHook.open),_i)))),Vx=e=>L(()=>{if(e.shutdownFlag.current)return En;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return g(r)}let t=e.pollers.length===0?e.subscription.poll():kr;return t===kr?uN(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),g(t))}),cN=e=>L(function t(r){if(e.shutdownFlag.current)return En;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?g(e.replayWindow.takeAll().concat(n)):Dr(n)?g(n):I(uN(e),o=>t([o]))}),uN=e=>fr(t=>{if(e.shutdownFlag.current)return t(En);if(fe(e.ended.current)){let o=e.pollers.length===0?e.subscription.poll():kr;return o!==kr?(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),t(g(o))):t(g(e.ended.current.value))}let r=Aa(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),es(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],U(()=>sN(e.pollers,r)))});var jt=Symbol.for("effect/PubSub/AbsentValue"),wZ=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},TZ=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},kZ=(e,t,r,n)=>new UC(e,t,e.subscribe(),Ua(),zr(!1),Di(!1),r,e.replayWindow(),n),OC=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Lf(this.replayBuffer):Gx}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex%this.capacity;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=jt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new _C(this,this.publisherIndex,!1)}},_C=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return kr}pollUpTo(t){if(t=At(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex%this.self.capacity,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=jt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},PC=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Lf(this.replayBuffer):Gx}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex&this.mask;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=jt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new FC(this,this.publisherIndex,!1)}},FC=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return kr}pollUpTo(t){if(t=At(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex&this.self.mask,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=jt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=jt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},RC=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=jt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Lf(this.replayBuffer):Gx}pipe(){return ne(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Xe(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=jt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new MC(this,this.publisherIndex,!1)}},MC=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return kr;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=jt),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return At(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=jt)))}},$C=class{publisherHead={value:jt,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Lf(this.replayBuffer):Gx}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=jt,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new NC(this,this.publisherTail,this.publisherIndex,!1)}},NC=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==jt?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return kr;let t=!0,r=kr;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==jt&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=jt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=At(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===kr?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==jt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=jt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},UC=class{[bZ]={_A:D};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,a,i,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=a,this.strategy=i,this.replayWindow=c,this.ended=u}pipe(){return ne(this,arguments)}},DC=class{[EZ]={_A:D};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,a,i){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=a,this.ended=i}pipe(){return ne(this,arguments)}},AZ=(e,t,r,n,o,s,a)=>new DC(e,t,r,n,o,s,a),vZ=e=>{if(e<=0||e!==1/0&&!Number.isInteger(e))throw new Error(`Cannot construct PubSub with capacity of ${e}`)},Nx=class{publishers=Ua();get shutdown(){return Kn(t=>Eo(Li(this.publishers),([r,n,o])=>o?E0(n,t.id):W,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,r,n,o,s){return fr(a=>{if(fe(s.current))return a(g(!1));let i=Aa();return this.offerUnsafe(n,i),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),rN(o)?(this.removeUnsafe(i),a(En)):i.effect?a(i.effect):(i.resumes=[a],U(()=>this.removeUnsafe(i)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=Zc(this.publishers);if(o===kr)n=!1;else{let[s,a]=o,i=t.publish(s);i&&o[2]?xo(a,Zr(!0)):i||AC(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return jC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return zC(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){es(this.publishers,[s,r,!0]);break}es(this.publishers,[s,r,!1])}}removeUnsafe(t){vC(this.publishers,([r,n])=>n!==t)}},Ux=class{get shutdown(){return W}handleSurplus(t,r,n,o){return g(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return jC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return zC(this,t,r)}},LC=class{get shutdown(){return W}handleSurplus(t,r,n,o,s){return U(()=>fe(s.current)?!1:(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return jC(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return zC(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,a=!0;for(;a;){t.slide();let i=t.publish(s);i&&(o=n.next())&&!o.done?s=o.value:i&&(a=!1)}}}},jC=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let a=Zc(o);if(a===kr)TZ(r,n,o),o.length===0?s=!1:wZ(r,n,o);else{let i=n.poll();i===kr?AC(o,a):(xo(a,Zr(i)),e.onPubSubEmptySpaceUnsafe(t,r))}}},zC=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},Dx=class{capacity;head={value:jt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:jt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},Lf=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=jt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=At(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},Gx={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var OZ="~effect/Queue",_Z="~effect/Queue/Enqueue",PZ="~effect/Queue/Dequeue";var qC={_A:D,_E:D},FZ={[OZ]:qC,[_Z]:qC,[PZ]:qC,...Nr,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:MZ(this)}}},mn=e=>ue(t=>{let r=Object.create(FZ);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=Ua(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},q(r)}),Cd=e=>mn({capacity:e});var fN=()=>mn(),Yr=l(2,(e,t)=>le(()=>Da(e,t)?Zx:e.state._tag==="Open"&&e.strategy==="suspend"?DZ(e,t):mN)),Da=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(Zc(e.messages),es(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(es(e.messages,t),hN(e),!0):!1:(es(e.messages,t),Kx(e),!0),Qc=l(2,(e,t)=>Bt(r=>{let n=Jx(e,t);return n.length===0||e.strategy==="dropping"?r(Me(n)):xN(e,{_tag:"Array",remaining:n,offset:0,resume:r})})),Jx=(e,t)=>{if(e.state._tag!=="Open")return Xe(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return Fx(e.messages,t),e.strategy==="sliding"&&Jc(e.messages,e.messages.length-e.capacity),Kx(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return Xe(t);let n=[],o=0;for(let s of t)o<r?es(e.messages,s):n.push(s),o++;return Kx(e),n};var yr=l(2,(e,t)=>Q(()=>Js(e,t))),Js=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=Ir(t),n=xF(r,$Z);return e.state.offers.size===0&&e.messages.length===0?(Qx(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},Kx(e),!0)},VC=e=>yr(e,Qu(bc())),wo=e=>Js(e,Qu(bc()));var To=e=>Q(()=>RZ(e)),RZ=e=>{if(e.state._tag==="Done")return!1;Na(e.messages);let t=e.state.offers;Qx(e,e.state._tag==="Open"?NZ:e.state.exit);for(let r of t)yN(r);return!0};var Yc=e=>lN(e,1,Number.POSITIVE_INFINITY);var lN=l(3,(e,t,r)=>(t=At(t),r=At(r),GC(()=>UZ(e,t,r)??Us(gN(e,()=>KC(e,t)),lN(e,t,r))))),hn=e=>GC(()=>dN(e)??Us(gN(e,()=>KC(e,1)),hn(e))),pN=e=>GC(()=>{let t=dN(e);return t===void 0?q(A()):t._tag==="Success"?q(v(t.value)):q(A())});var dN=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=Zc(e.messages);return WC(e),Me(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=SN(e.state.offers);return WC(e),Me(t)}};var MZ=e=>e.state._tag==="Done"?0:e.messages.length;var mN=Me(!1),Zx=Me(!0),$Z=jn(bc()),NZ=xf(),hN=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(Kr),e.messages.length===0))break}},Kx=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,hN(e)},0))},UZ=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return Me([]);if(!KC(e,t))return;let n=e.messages.length>0?Jc(e.messages,r):[SN(e.state.offers)];return WC(e),Me(n)},GC=io({op:"QueueTake",[ft](e){let t=this[ge]();return up(t)?t[ft](e):t}}),KC=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,gN=(e,t)=>Bt(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(Kr);let n={ready:t,resume:r};return e.state.takers.add(n),Q(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),DZ=(e,t)=>Bt(r=>Da(e,t)?r(Zx):xN(e,{_tag:"Single",message:t,resume:r})),xN=(e,t)=>{if(e.state._tag!=="Open")return yN(t);let r=e.state.offers;return r.add(t),Q(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&Qx(e,e.state.exit))})},yN=e=>e._tag==="Single"?e.resume(mN):e.resume(Me(e.remaining.slice(e.offset))),SN=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(Zx),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Me([]))),r},WC=e=>{if(e.state._tag==="Done")return zs(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Qx(e,e.state.exit),zs(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag==="Single")es(e.messages,t.message),e.state.offers.delete(t),t.resume(Zx);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;es(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Me([]))}let n=e.state;if(n._tag==="Done")return zs(n.exit.cause)}return!1};var Qx=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var Yx=e=>new JC(e),EN=(e,t,r)=>Bt(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),Q(()=>{e.waiters.delete(o)})}),JC=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=le(()=>this.free<t?EN(this,t,r):(this.taken+=t,q(t)));return r}takeIfAvailable(t){return le(()=>this.free<t?q(!1):(this.taken+=t,q(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return ue(r=>(this.permits=t,this.free<0?ye:(this.releaseUnsafe(r,0),ye)))}release(t){return ue(r=>q(this.releaseUnsafe(r,t)))}get releaseAll(){return ue(t=>q(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Ho(n=>{let o=le(()=>{if(this.free<t){let s=EN(this,t,ye);return oe(n(s),()=>o)}return this.taken+=t,zo(n(r),()=>{this.releaseUnsafe(Ea(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Ho(n=>this.free<t?Fc:(this.taken+=t,zo(n(gf(r)),()=>{this.releaseUnsafe(Ea(),t)},!0)))}};var ZC=e=>Zg(e)?et(e)?ee(e.value):e:g(e);var TN="~effect/Channel",Hr=e=>O(e,TN),LZ={[TN]:{_Env:D,_InErr:D,_InElem:D,_OutErr:D,_OutElem:D},pipe(){return ne(this,arguments)}},Oe=e=>{let t=Object.create(LZ);return t.transform=(r,n)=>Ct(e(r,n),o=>g(dt(o))),t},ko=(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>t(o,n))),Ar=e=>Oe((t,r)=>e),rs=e=>Oe(N(function*(t,r){let n=ur(r),o=a=>Ze(n,ix(a)),s=yield*Zo(e(t,r,n),o);return Zo(s,o)})),Se=e=>e.transform,wd=4096,BZ=(e,t,r)=>mn({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(jr(n=>cr(e,To(n))),jr(n=>va(t(n),e).pipe(Ct(o=>yr(n,o)),Zt(e))));var kN=(e,t)=>Oe((r,n)=>F(BZ(n,e,t),Yc)),Xx=e=>Oe((t,r)=>L(()=>Se(e())(t,r))),jZ=(e,t,r)=>rs(N(function*(n,o,s){let a=A();yield*Ls(s,c=>fe(a)?r(a.value,c):W);let i=yield*Qo(F(e,c=>(a=v(c),c)));return yield*Se(t(i))(n,o)}));var AN=e=>Ar(U(()=>{let t=e();return L(()=>{let r=t.next();return r.done?ee(r.value):g(r.value)})})),QC=e=>Ar(U(()=>{let t=0;return L(()=>t>=e.length?ee():g(e[t++]))}));var YC=(e,t=wd)=>{let r=lo(t);return Ar(U(()=>{let n=e(),o=A();return L(()=>{if(o._tag==="Some")return ee(o.value);let s=[];for(;s.length<r;){let a=n.next();if(a.done){if(s.length===0)return ee(a.value);o=v(a.value);break}s.push(a.value)}return g(s)})}))};var vN=(e,t=wd)=>YC(()=>e[Symbol.iterator](),t),ey=e=>ty(g(e));var ON=e=>ty(U(e)),jf=Ar(g(ee())),_N=Ar(g(Hc)),Zs=e=>Ar(g(k(e))),PN=e=>Ar(gx(e)),Td=e=>Ar(dt(e)),FN=e=>Ar(Oa(e)),XC=e=>Td(wf(e)),ty=e=>Ar(U(()=>{let t=!1;return L(()=>t?ee():(t=!0,e))}));var RN=e=>Ar(I(e,()=>ee())),ew=e=>Ar(g(I(e,ZC)));var MN=e=>Ar(g(Yc(e)));var tw=e=>Ar(g(fC(cN(e),()=>ee())));var $N=e=>La(F(Id(e),tw)),NN=e=>La(F(Id(e),t=>ew(Vx(t))));var UN=e=>Oe((t,r)=>zZ({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var zZ=e=>{let t=e.readable.getReader(),r=e.exit??Di(void 0),n=L(()=>r.current?r.current:Fa(Oi({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??dt(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?ee():g(Ae(s))}));return at(cr(e.scope,e.releaseLockOnEnd?U(()=>t.releaseLock()):hx(()=>t.cancel().catch(yn))),n)},HZ=(e,t)=>Oe(N(function*(r,n){let o=e[Symbol.asyncIterator](),s=!1;return o.return&&(yield*cr(n,L(()=>s?U(()=>{o.return().catch(yn)}):hx(()=>o.return())))),I(Oi({try:()=>{let a=o.next();return s=!0,a.finally(()=>{s=!1})},catch:t}),a=>a.done?ee(a.value):g(a.value))})),DN=(e,t)=>ns(HZ(e,t),Ae),ns=l(2,(e,t)=>ko(e,r=>U(()=>{let n=0;return F(r,o=>t(o,n++))}))),rw=l(2,(e,t)=>nw(e,r=>g(t(r)))),nw=l(2,(e,t)=>ko(e,r=>g(ze(r,n=>I(t(n),ee))))),LN=e=>e===void 0||e!=="unbounded"&&e<=1,ry=l(e=>Hr(e[0]),(e,t,r)=>LN(r?.concurrency)?BN(e,t):qZ(e,t,r)),BN=(e,t)=>Oe((r,n)=>{let o=0;return F(Se(e)(r,n),I(s=>t(s,o++)))}),qZ=(e,t,r)=>rs(N(function*(n,o,s){let a=0,i=yield*Se(e)(n,o),c=r.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*Cd(0);yield*cr(s,To(u));let f=Io(yield*Ri()),p=Ui(s);if(r.unordered){let d=Yx(c),m=ct(d.release(1)),x=Fa({onFailure:y=>I(yr(u,y),m),onSuccess:y=>I(Yr(u,y),m)});yield*d.take(1).pipe(I(()=>i),I(y=>{let E=a++;return p(f(x(L(()=>t(y,E))))),W}),vt({disableYield:!0}),Ct(y=>d.withPermits(c-1)(yr(u,y))),Zt(s))}else{let d=yield*Cd(c-2);yield*cr(s,To(d)),yield*hn(d).pipe(Q0,I(y=>Yr(u,y)),vt({disableYield:!0}),Ct(y=>yr(u,y)),Zt(s));let m,x=y=>{y._tag!=="Success"&&(m=y.cause,Js(u,y.cause))};yield*i.pipe(I(y=>{if(m)return dt(m);let E=a++,w=f(L(()=>t(y,E)));return p(w),w.addObserver(x),Yr(d,Ni(w))}),vt({disableYield:!0}),Ct(y=>Yr(d,Vn(y)).pipe(Kt(yr(d,y)))),Zt(s))}return hn(u)}));var ow=l(e=>Hr(e[0]),(e,t,r)=>LN(r?.concurrency)?WZ(e,t):VZ(e,t,r)),WZ=(e,t)=>Oe((r,n)=>F(Se(e)(r,n),o=>{let s,a,i=I(o,u=>(a??=ur(n),Qt(Se(t(u))(r,a),f=>(s=c(f),s)))),c=ze(u=>{if(s=void 0,a.state._tag==="Empty")return i;let f=Ze(a,Gt);return a=void 0,I(f,()=>i)});return L(()=>s??i)})),VZ=(e,t,r)=>e.pipe(ns(t),sy(r)),jN=l(2,(e,t)=>Oe((r,n)=>U(()=>{let o,s=ur(n),a=I(Se(e)(r,s),i=>(o=ze(i,c=>Ze(s,Gt).pipe(I(()=>Se(t(c))(r,n)),I(u=>(o=u,u)))),o));return L(()=>o??a)})));var sw=l(4,(e,t,r,n)=>Oe(N(function*(o,s){let a=yield*Se(e)(o,s),i=yield*Se(t)(o,s),c=r();return L(()=>{let u=n(c,a,i);return F(u,([f,p])=>(c=p,f))})}))),zN=l(2,(e,t)=>Oe((r,n)=>U(()=>{let o,s=ur(n),a=I(Se(e)(r,s),i=>{let c=i.pipe(jr(()=>(o=i,W)),ze(u=>Ze(s,Zr(u)).pipe(Kt(Se(t(u))(r,n)),I(f=>(o=f,f)))));return o=c,c});return L(()=>o??a)}))),HN=e=>ow(e,D),Xr=e=>ko(e,t=>{let r,n=0,o=L(function s(){if(r===void 0)return I(t,i=>{switch(i.length){case 0:return s();case 1:return g(i[0]);default:return r=i,g(i[n++])}});let a=r[n++];return n>=r.length&&(r=void 0,n=0),g(a)});return g(o)}),qN=e=>BN(e,ZC),WN=e=>ko(e,t=>g(vt(t,{disableYield:!0}))),VN=l(2,(e,t)=>Go(typeof t=="function"?t(D):t).pipe(F(r=>{let n=wr.defaultValue();return GN(uy(e,wr,U(()=>n)),o=>r(o).pipe(F(s=>{n=s}),ze(()=>ee(o))))}),La)),GN=(e,t)=>Oe((r,n)=>U(()=>{let o,s=()=>{let a=ur(n);return I(Se(e)(r,a),i=>(o=ze(i,c=>Ze(a,Gt).pipe(I(()=>t(c)),I(s))),o))};return L(()=>o??s())})),KN=e=>GN(e,()=>W),JN=l(2,(e,t)=>ko(e,(r,n)=>F(rd(t),o=>jr(r,o)))),ZN=l(2,(e,t)=>Oe((r,n)=>F(Se(e)(r,n),o=>I(o,function s(a){return t(a)?g(a):I(o,s)}))));var QN=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){let s=[];for(let a=0;a<o.length;a++)t(o[a])&&s.push(o[a]);return st(s)?g(s):I(r,n)})))),YN=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){let s=[];for(let a=0;a<o.length;a++){let i=t(o[a]);xt(i)&&s.push(i.success)}return st(s)?g(s):I(r,n)})))),XN=l(2,(e,t)=>ko(e,r=>{let n=I(r,o=>Ex(o,t));return g(I(n,function o(s){return st(s)?g(s):I(n,o)}))})),e1=l(2,(e,t)=>ko(e,r=>g(I(r,function n(o){return I(oC(o,t),s=>st(s)?g(s):I(r,n))})))),zf=l(e=>Hr(e[0]),(e,t,r,n)=>Oe((o,s)=>F(Se(e)(o,s),a=>{let i=t(),c,u=0,f,p=Fa(a,{onFailure(m){f=m;let x=n?.onHalt&&n.onHalt(i);return x&&x.length>0?g([i,x]):dt(m)},onSuccess(m){let x=r(i,m);return J_(x)?g(x):x}});return L(function m(){if(c===void 0)return f?dt(f):I(p,([y,E])=>(i=y,E.length===0?m():E.length===1?g(E[0]):(c=E,m())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),g(x)})})));var t1=l(3,(e,t,r)=>Oe((n,o)=>F(Se(e)(n,o),s=>{let a=t,i=!0;return L(()=>i?(i=!1,g(a)):F(I(s,c=>r(a,c)),c=>(a=c,a)))}))),Hf=l(2,(e,t)=>Oe((r,n)=>{let o=ur(n);return F(Se(e)(r,o),s=>{let a=s.pipe(Ct(i=>{if(zs(i))return dt(i);let c=o;return o=ur(n),Ze(c,Vn(i)).pipe(Kt(Se(t(i))(r,o)),I(u=>(a=u,u)))}));return L(()=>a)})})),r1=l(2,(e,t)=>oy(e,Kg,t)),ny=l(2,(e,t)=>Hf(e,r=>RN(I(t(r),n=>dt(r))))),n1=l(3,(e,t,r)=>Hf(e,n=>t(n)?r(n):Td(n))),oy=l(3,(e,t,r)=>Hf(e,n=>{let o=t(n);return be(o)?Td(o.failure):r(o.success,n)})),ts=l(2,(e,t)=>oy(e,mM,r=>t(r)));var o1=l(2,(e,t)=>ko(e,r=>g(yx(r,n=>Wp(n)?W:_i(t(n)))))),s1=l(e=>Hr(e[0]),(e,t,r,n)=>ts(e,o=>t(o)?r(o):n?n(o):Zs(o))),a1=l(e=>Hr(e[0]),(e,t,r,n)=>ts(e,o=>{let s=t(o);return be(s)?n?n(s.failure):Zs(s.failure):r(s.success)}));var i1=l(e=>Hr(e[0]),(e,t,r,n,o)=>ts(e,s=>{if(mr(s,t)&&O(s,"reason")){let a=s.reason;return mr(a,r)?n(a,s):o?o(a,s):Zs(s)}return Zs(s)})),c1=l(e=>Hr(e[0]),(e,t,r,n)=>{let o;return ts(e,s=>{if(mr(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&ax(s.reason._tag)){let a=s.reason;return o??=new Set(Object.keys(r)),o.has(a._tag)?r[a._tag](a,s):n?n(a,s):Zs(s)}return Zs(s)})});var u1=l(2,(e,t)=>ts(e,r=>Zs(t(r)))),f1=e=>ts(e,XC),l1=l(e=>Hr(e[0]),(e,t)=>{if(!t?.log)return ts(e,()=>jf);let r=Tx(t.log===!0?void 0:t.log);return ts(ny(e,n=>dM(n)?r(n):W),()=>jf)}),CN=e=>Hf(e,()=>jf),p1=l(e=>Hr(e[0]),(e,t)=>{if(!t?.log)return CN(e);let r=Tx(t.log===!0?void 0:t.log);return CN(ny(e,n=>r(n)))}),d1=l(2,(e,t)=>Xx(()=>{let r,n=wr.defaultValue(),o=uy(e,wr,U(()=>n)),s=uw(o,()=>(r=void 0,W)),a=typeof t=="function"?t(D):t,i=ts(s,N(function*(c){return r||(r=yield*Go(a)),n=yield*r(c),i},(c,u)=>ze(c,()=>g(Zs(u))),La));return i})),m1=l(e=>Hr(e[0]),(e,t,r)=>e.pipe(ns(t),sy({...r,concurrency:r?.concurrency??1,switch:!0}))),sy=l(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>rs(N(function*(o,s,a){let i=r==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:Yx(i),u=yield*eN(!0),f=new Set,p=yield*Cd(t);yield*cr(a,To(p));let d=yield*Se(e)(o,s);return yield*tt(function*(){for(;;){let m;c&&(f.size<i?yield*c.take(1):(m=yield*Mf(d),yield*Hs(c.take(1),Kt(Ni(m),Hc))));let x=m===void 0?yield*d:yield*Ni(m),y=ur(a),E=yield*Se(x)(o,y);for(;f.size>=i;){let T=H_(f);f.delete(T),f.size===0&&(yield*u.open),yield*Xo(T)}let w=yield*E.pipe(jr(()=>cd),I(T=>Yr(p,T)),vt({disableYield:!0}),Zo(N(function*(T){let M=ix(T),P=yield*bo(Ze(y,M));if(!f.has(w))return;let h=IM([M,P]);ka(h)&&(yield*yr(p,h.cause)),f.delete(w),c&&(yield*c.release(1)),f.size===0&&(yield*u.open)})),Mf);u.closeUnsafe(),f.add(w)}}).pipe(Ct(m=>{let x=ed(m);return xt(x)?u.whenOpen(yr(p,m)):yr(p,m)}),Zt(a)),hn(p)}))),ay=l(e=>Hr(e[0])&&Hr(e[1]),(e,t,r)=>rs(N(function*(n,o,s){let a=r?.haltStrategy??"both",i=yield*Cd(0);yield*cr(s,To(i));let c=0;function u(p,d){if(c++,!zs(d))return yr(i,d);switch(a){case"both":return c===2?yr(i,d):W;case"left":case"right":return p===a?yr(i,d):W;case"either":return yr(i,d)}}let f=(p,d,m)=>Se(d)(n,m).pipe(I(x=>x.pipe(I(y=>Yr(i,y)),vt)),Zo(x=>pd(ix(x),y=>Ze(m,y)).pipe(Fa({onFailure:y=>u(p,y),onSuccess:()=>u(p,x)}))),Zt(s));return yield*f("left",e,ur(s)),yield*f("right",t,ur(s)),hn(i)}))),h1=l(2,(e,t)=>ay(e,RN(t),{haltStrategy:"left"})),g1=()=>Oe((e,t)=>U(()=>{let r="",n=!1,o=A();function s(c){let u=[];function f(p){r.length===0?u.push(p):(u.push(r+p),r="")}for(let p=0;p<c.length;p++){let d=c[p];if(d.length!==0){let m=0,x=d.indexOf("\r"),y=d.indexOf(`
|
|
25
25
|
`);for(n&&(y===0&&(m=1,y=d.indexOf(`
|
|
26
26
|
`,m)),n=!1);x!==-1||y!==-1;)x===-1||y!==-1&&y<x?(f(d.substring(m,y)),m=y+1,y=d.indexOf(`
|
|
27
27
|
`,m)):(f(d.substring(m,x)),d.length===x+1?(n=!0,m=d.length,x=-1):(m=x+(y===x+1?2:1),x=d.indexOf("\r",m),y=d.indexOf(`
|
|
28
|
-
`,m)));r=r+d.substring(m)}}return st(u)?u:null}let a=L(()=>o._tag==="Some"?ee(o.value):ix(e,{onSuccess:i,onFailure:dt,onDone:c=>{if(o=v(c),r.length>0){let u=r;return r="",n=!1,g([u])}return ee(c)}}));function i(c){let u=s(c);return u!==null?g(u):a}return a}));var sw=l(2,(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>Se(t)(o,n)))),aw=l(2,(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>{let s=Ct(o,a=>zs(a)?dt(a):lr(Vp(a)));return F(Se(t)(s,n),a=>eC(a,i=>Wp(i)?dt(i.value):lr(i)))}))),La=e=>Oe((t,r)=>{let n;return g(L(()=>n||e.pipe(va(r),I(o=>Se(o)(t,r)),I(o=>n=o))))}),g1=e=>rs((t,r,n)=>F(va(Se(e)(t,r),n),va(n)));var x1=l(2,(e,t)=>Oe(N(function*(r,n){let o=yield*Se(e)(r,n),s=yield*mn({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*cr(n,To(s)),yield*o.pipe(I(a=>Yr(s,a)),vt({disableYield:!0}),Zo(a=>yr(s,a)),Zt(n)),hn(s)}))),y1=l(2,(e,t)=>Oe(N(function*(r,n){let o=yield*Se(e)(r,n),s=yield*mn({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*cr(n,To(s)),yield*o.pipe(I(a=>Zc(s,a)),vt({disableYield:!0}),Zo(a=>yr(s,a)),Zt(n)),Qc(s)}))),iw=l(2,(e,t)=>sy(e,Ar(g(I(t,ee))),{haltStrategy:"either"})),S1=l(2,(e,t)=>rs(N(function*(r,n,o){let s=yield*Se(e)(r,n),a=yield*Zt(t,o,{startImmediately:!0});return L(()=>{let i=a.pollUnsafe();return i===void 0?s:EM(i,{onFailure:dt,onSuccess:ee})})}))),E1=l(2,(e,t)=>kd(e,r=>ka(r)?t(r.cause):W)),kd=l(2,(e,t)=>rs((r,n,o)=>Ls(o,t).pipe(Kt(Se(e)(r,n))))),b1=l(2,(e,t)=>La(at(t,e))),cw=l(2,(e,t)=>ko(e,r=>U(()=>{let n=!0,o=jr(r,s=>(n=!1,t(s)));return L(()=>n?o:r)}))),I1=l(2,(e,t)=>ko(e,r=>g(ze(r,n=>I(t,()=>ee(n)))))),C1=l(2,(e,t)=>kd(e,r=>t)),Yc=(e,t,r)=>L(()=>{let n=yo(),o=Se(e)(ee(),n);return ze(I(o,t),r||g).pipe(Jn(s=>Ze(n,s)))});var ay=l(2,(e,t)=>Oe((r,n)=>F(pn(Se(e)(r,n),t),pn(t)))),iy=l(3,(e,t,r)=>Oe((n,o)=>F(dn(Se(e)(n,o),t,r),dn(t,r)))),cy=l(3,(e,t,r)=>Oe((n,o)=>I(r,s=>Se(iy(e,t,s))(n,o)))),w1=l(e=>Hr(e[0]),(e,t,r)=>xp(t)?ay(e,t):Oe((n,o)=>I(r?.local?Zp(t,Jp(),o):Yg(t,o),s=>F(pn(Se(e)(n,o),s),pn(s))))),T1=l(2,(e,t)=>Oe((r,n)=>ld(o=>{let s=t(o);return Se(ay(e,s))(r,n)})));var uw=function(){let e=Hr(arguments[0]),t=e?arguments[1]:arguments[0],r=xi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return CN(n,t,r)}return n=>CN(n,t,r)},CN=(e,t,r)=>LZ(fC(t,r),n=>iy(e,kc,n),(n,o)=>Kn(s=>{let a=s.getRef(Jr),i=s.getRef(kM);return Wg(n,o,a,i)}));var k1=e=>Yc(e,t=>vt(t,{disableYield:!0})),Xc=l(2,(e,t)=>Yc(e,r=>vt(I(r,t),{disableYield:!0}))),A1=l(2,(e,t)=>Yc(e,r=>r.pipe(I(t),I(n=>n?W:ee()),vt({disableYield:!0})))),fw=e=>F(eu(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let a=t[s];n.set(a,o),o+=a.length}return n});var v1=e=>L(()=>{let t=A();return Yc(e,r=>r.pipe(gx,I(n=>(t=n,ee()))),()=>g(t))}),O1=e=>L(()=>{let t=Symbol(),r=t;return Yc(e,n=>vt(I(n,o=>(r=o,W)),{disableYield:!0}),()=>r===t?jc:J0(r))}),eu=l(3,(e,t,r)=>L(()=>{let n=t();return Yc(e,o=>Ko({while:sn,body:()=>o,step:s=>{n=r(n,s)}}),()=>g(n))})),_1=l(3,(e,t,r)=>L(()=>{let n=t();return Yc(e,o=>Ko({while:sn,body:ct(o.pipe(I(s=>r(n,s)),F(s=>{n=s}))),step:yn}),()=>g(n))})),lw=N(function*(e){let t=Qx(1),r=yield*Fi(),n=$e(r,ln);return(yield*Se(e)(ee(),n)).pipe(pn(r),t.withPermits(1))},Ct(e=>g(dt(e)))),Qs=(e,t)=>Se(e)(ee(),t);var pw=l(e=>Hr(e[0]),(e,t)=>Ws(r=>Xc(e,n=>Zc(t,n)).pipe(r,bo,I(n=>(et(n)?wo(t):Js(t,n.cause),W)))));var P1=l(e=>Hr(e[0]),N(function*(e,t){let r=yield*Hc,n=yield*mn({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*cr(r,To(n)),yield*Zt(pw(e,n),r),n}));var F1=e=>Qr(e.capacity==="unbounded"?zx(e):e.strategy==="dropping"?Bx(e):e.strategy==="sliding"?jx(e):Lx(e),bd),R1=l(2,N(function*(e,t){let r=yield*F1(t);return yield*Ma(dw(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),dw=l(e=>Hr(e[0]),(e,t,r)=>Xc(e,n=>aN(t,n)).pipe(r?.shutdownOnEnd===!0?Ra(bd(t)):D)),M1=l(2,N(function*(e,t){let r=yield*F1(t);return yield*Xc(e,n=>qx(r,n)).pipe(Jn(n=>Hx(r,n)),Ma),r}));var WZ="~effect/Stream",VZ={_R:D,_E:D,_A:D},$1=function(e){this.channel=e};$1.prototype={[WZ]:VZ,pipe(){return ne(this,arguments)}};var N1=e=>new $1(e);var U1="~effect/Sink",D1=g([void 0]),KZ={_A:D,_In:D,_L:D,_E:D,_R:D},JZ={[U1]:KZ,pipe(){return ne(this,arguments)}},vd=e=>O(e,U1),mw=e=>Od((t,r)=>Se(e)(t,r).pipe(I(vt({disableYield:!0})),ze(g)));var Od=e=>{let t=Object.create(JZ);return t.transform=e,t},hw=e=>Oe((t,r)=>g(I(e.transform(t,r),ee)));var ZZ=e=>Od(()=>e);var L1=e=>ZZ(k(e));var _d=Od(e=>ze(vt(e,{disableYield:!0}),()=>D1));var B1=e=>{let t=At(e);return Od(r=>{let n=[];if(t===0)return g([n]);let o;return r.pipe(I(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?ee():W;for(let a=0;a<s.length;a++)if(n.push(s[a]),n.length===t)return a+1<s.length&&(o=s.slice(a+1)),ee();return W}),vt({disableYield:!0}),ze(()=>g([n,o])))})};var j1=e=>QZ(Eo(t=>e(t),{discard:!0})),QZ=e=>Od(t=>t.pipe(I(e),vt({disableYield:!0}),ze(()=>D1)));var z1=e=>mw(La(F(e,hw)));var Oo={};$n(Oo,{DefaultChunkSize:()=>Y1,Do:()=>UQ,TypeId:()=>Q1,accumulate:()=>IQ,aggregate:()=>hQ,aggregateWithin:()=>Aw,as:()=>F5,bind:()=>LQ,bindEffect:()=>BQ,bindTo:()=>jQ,broadcast:()=>TU,broadcastN:()=>gQ,buffer:()=>C8,bufferArray:()=>w8,callback:()=>ly,catch:()=>Ld,catchCause:()=>lU,catchCauseFilter:()=>M8,catchCauseIf:()=>R8,catchDefect:()=>T8,catchFilter:()=>Tw,catchIf:()=>dU,catchReason:()=>_8,catchReasons:()=>P8,catchTag:()=>v8,catchTags:()=>O8,changes:()=>CQ,changesWith:()=>AU,changesWithEffect:()=>wQ,chunks:()=>EU,collect:()=>bQ,combine:()=>X8,combineArray:()=>eQ,concat:()=>ru,cross:()=>r8,crossWith:()=>uU,debounce:()=>aQ,decodeText:()=>vw,die:()=>d5,drain:()=>j5,drainFork:()=>z5,drop:()=>kw,dropRight:()=>Z8,dropUntil:()=>G8,dropUntilEffect:()=>K8,dropWhile:()=>yU,dropWhileEffect:()=>SU,dropWhileFilter:()=>J8,empty:()=>gn,encodeText:()=>TQ,ensuring:()=>FQ,fail:()=>Ba,failCause:()=>tU,failCauseSync:()=>m5,failSync:()=>p5,filter:()=>h8,filterEffect:()=>x8,filterMap:()=>g8,filterMapEffect:()=>y8,flatMap:()=>Hf,flatten:()=>aU,flattenArray:()=>B5,flattenEffect:()=>M5,flattenIterable:()=>K5,flattenTake:()=>J5,forever:()=>G5,fromArray:()=>Nd,fromArrayEffect:()=>y5,fromArrays:()=>S5,fromAsyncIterable:()=>C5,fromChannel:()=>R,fromEffect:()=>fy,fromEffectDrain:()=>X1,fromEffectRepeat:()=>eU,fromEffectSchedule:()=>c5,fromEventListener:()=>k5,fromIterable:()=>nu,fromIterableEffect:()=>g5,fromIterableEffectRepeat:()=>x5,fromIteratorSucceed:()=>h5,fromPubSub:()=>b5,fromPubSubTake:()=>rU,fromPull:()=>vo,fromQueue:()=>E5,fromReadableStream:()=>I5,fromSchedule:()=>w5,fromSubscription:()=>T5,groupAdjacentBy:()=>mQ,groupBy:()=>pQ,groupByKey:()=>dQ,grouped:()=>fQ,groupedWithin:()=>lQ,haltWhen:()=>OQ,ignore:()=>D8,ignoreCause:()=>L8,interleave:()=>AQ,interleaveWith:()=>OU,interruptWhen:()=>vQ,intersperse:()=>vU,intersperseAffixes:()=>kQ,isStream:()=>ve,iterate:()=>v5,let:()=>DQ,limitBytes:()=>H8,make:()=>f5,map:()=>In,mapAccum:()=>tQ,mapAccumArray:()=>ou,mapAccumArrayEffect:()=>nQ,mapAccumEffect:()=>rQ,mapArray:()=>oU,mapArrayEffect:()=>$5,mapBoth:()=>R5,mapEffect:()=>Ud,mapError:()=>mU,merge:()=>Dd,mergeAll:()=>t8,mergeEffect:()=>py,mergeLeft:()=>X5,mergeResult:()=>Y5,mergeRight:()=>e8,mkArrayBuffer:()=>QQ,mkString:()=>Fw,mkUint8Array:()=>YQ,never:()=>_5,onEnd:()=>PQ,onError:()=>_Q,onExit:()=>_U,onFirst:()=>FU,onStart:()=>PU,orDie:()=>U8,orElseIfEmpty:()=>$8,orElseSucceed:()=>N8,paginate:()=>A5,partition:()=>E8,partitionEffect:()=>S8,partitionQueue:()=>Cw,peel:()=>I8,pipeThrough:()=>EQ,pipeThroughChannel:()=>SQ,pipeThroughChannelOrFail:()=>kU,prepend:()=>Q5,provide:()=>RU,provideContext:()=>RQ,provideService:()=>MQ,provideServiceEffect:()=>_w,race:()=>m8,raceAll:()=>fU,range:()=>O5,rechunk:()=>bU,repeat:()=>H5,repeatElements:()=>V5,result:()=>N5,retry:()=>B8,run:()=>my,runCollect:()=>hy,runCount:()=>zQ,runDrain:()=>gy,runFold:()=>qQ,runFoldEffect:()=>WQ,runForEach:()=>KQ,runForEachArray:()=>Pw,runForEachWhile:()=>JQ,runHead:()=>VQ,runIntoPubSub:()=>nY,runIntoQueue:()=>aY,runLast:()=>GQ,runSum:()=>HQ,scan:()=>oQ,scanEffect:()=>sQ,schedule:()=>q5,scoped:()=>P5,service:()=>a5,serviceOption:()=>i5,share:()=>yQ,sliding:()=>Q8,slidingSize:()=>IU,split:()=>Y8,splitLines:()=>Ow,succeed:()=>tu,suspend:()=>bn,switchMap:()=>L5,sync:()=>l5,take:()=>z8,takeRight:()=>q8,takeUntil:()=>hU,takeUntilEffect:()=>gU,takeWhile:()=>xU,takeWhileEffect:()=>V8,takeWhileFilter:()=>W8,tap:()=>sU,tapBoth:()=>U5,tapCause:()=>pU,tapDefect:()=>A8,tapError:()=>ww,tapErrorTag:()=>k8,tapSink:()=>D5,throttle:()=>uQ,throttleEffect:()=>CU,tick:()=>u5,timeout:()=>W5,timeoutOrElse:()=>iU,toAsyncIterable:()=>rY,toAsyncIterableEffect:()=>tY,toAsyncIterableWith:()=>Mw,toChannel:()=>Ao,toPubSub:()=>oY,toPubSubTake:()=>$U,toPull:()=>ZQ,toQueue:()=>sY,toReadableStream:()=>XQ,toReadableStreamEffect:()=>eY,toReadableStreamWith:()=>Rw,transduce:()=>Bd,transformPull:()=>pr,transformPullBracket:()=>Ew,unfold:()=>nU,unwrap:()=>en,unwrapReason:()=>F8,updateContext:()=>MU,updateService:()=>$Q,when:()=>b8,withExecutionPlan:()=>j8,withSpan:()=>NQ,zip:()=>o8,zipFlatten:()=>i8,zipLatest:()=>p8,zipLatestAll:()=>Iw,zipLatestWith:()=>d8,zipLeft:()=>s8,zipRight:()=>a8,zipWith:()=>bw,zipWithArray:()=>dy,zipWithIndex:()=>c8,zipWithNext:()=>u8,zipWithPrevious:()=>f8,zipWithPreviousAndNext:()=>l8});var H1="~effect/RcMap",YZ=e=>({[H1]:H1,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:Lc()},pipe(){return ne(this,arguments)}}),q1=e=>Kn(t=>{let r=t.context,n=$e(r,ln),o=YZ({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive=="function"?FO(e.idleTimeToLive,pt):ct(pt(e.idleTimeToLive??hi)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return at(Ls(n,()=>{if(o.state._tag==="Closed")return W;let s=o.state.map;return o.state={_tag:"Closed"},Eo(s,([,a])=>bo(Fd(a))).pipe(jr(()=>U(()=>{fx(s)})))}),o)}),gw=l(2,(e,t)=>Ws(r=>{if(e.state._tag==="Closed")return En;let n=e.state,o=Uf(),s=Gn(n.map,t),a;if(s._tag==="Some")a=s.value,a.refCount++;else{if(Number.isFinite(e.capacity)&&g$(e.state.map)>=e.capacity)return k(new hM(`RcMap attempted to exceed capacity of ${e.capacity}`));{a={deferred:Aa(),scope:yo(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},a.finalizer=e5(e,t,a),Bc(n.map,t,a);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((f,p)=>{c.set(p,f)}),c.set(ln.key,a.scope);let u=li(c);L(()=>e.lookup(t)).pipe(Io(u),Ni(a.scope)).addObserver(f=>{SM(f)&&XZ(e,t,a,u),xo(a.deferred,f)})}}let i=fo(o.context,ln);return cr(i,a.finalizer).pipe(Kt(r(wi(a.deferred))))}));var XZ=(e,t,r,n)=>{if(e.state._tag==="Closed")return;let o=Gn(e.state.map,t);o._tag==="None"||o.value!==r||(Ai(e.state.map,t),!(r.refCount>0)&&Fd(r).pipe(Io(n),Ni(e.scope)))},Fd=e=>e.fiber?Xo(e.fiber).pipe(Kt(Ze(e.scope,Gt))):Ze(e.scope,Gt),e5=(e,t,r)=>Kn(n=>{if(r.refCount--,r.refCount>0)return W;if(e.state._tag==="Closed")return Fd(r);let o=Gn(e.state.map,t);if(o._tag==="None"||o.value!==r)return Fd(r);if(uf(r.idleTimeToLive))return Ai(e.state.map,t),Fd(r);if(!Rs(r.idleTimeToLive))return W;let s=n.getRef(Tf);return r.expiresAt=s.currentTimeMillisUnsafe()+Lr(r.idleTimeToLive),r.fiber?W:(r.fiber=Ws(function a(i){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag==="Closed"||r.refCount>0)return W;let f=Gn(e.state.map,t);return f._tag==="None"||f.value!==r?W:(Ai(e.state.map,t),Ze(r.scope,Gt))}return I(i(s.sleep(gi(u))),()=>a(i))}).pipe(Ra(U(()=>{r.fiber=void 0})),Io(n.context),Ni(e.scope)),W)});var xw=l(2,(e,t)=>Gs(r=>{if(e.state._tag==="Closed")return W;let n=Gn(e.state.map,t);if(n._tag==="None"||uf(n.value.idleTimeToLive))return W;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+Lr(o.idleTimeToLive),W}));var t5="~effect/RcRef",Rd={_tag:"Empty"},r5={_tag:"Closed"},n5={_A:D,_E:D},yw=class{[t5]=n5;pipe(){return ne(this,arguments)}state=Rd;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},G1=e=>Kn(t=>{let r=t.context,n=$e(r,ln),o=new yw(e.acquire,r,n,e.idleTimeToLive!==void 0?pt(e.idleTimeToLive):void 0);return at(Ls(n,()=>{let s=o.state;return o.state=r5,s._tag==="Acquired"?Ze(s.scope,Gt):s._tag==="Acquiring"?Xo(s.fiber):W}),o)}),o5=(e,t)=>{switch(e.state._tag){case"Closed":return En;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?at(Xo(r.fiber),r):g(r)}case"Acquiring":{let r=e.state;return r.awaiters++,V1(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=yo(),o=pn(e.acquire,or(e.context,ln,n)).pipe(I(s=>{if(e.state!==r)return En;let a={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,g(a)}),Jn(s=>et(s)?W:(e.state===r&&(e.state=Rd),Ze(n,s))));return r.fiber=Io(Uf().context)(o),V1(e,r,t)}}},V1=(e,t,r)=>Jn(r($i(t.fiber)),n=>{let o=t.acquired;return o!==void 0?ka(n)?J1(e,o):W:--t.awaiters>0||e.state!==t?W:(e.state=Rd,Xo(t.fiber))}),K1=e=>{let t=e;return Ws(r=>I(Hc,n=>I(o5(t,r),o=>at(Ls(n,()=>J1(t,o)),o.value))))},J1=(e,t)=>{if(t.refCount--,t.refCount>0)return W;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Rd),Ze(t.scope,Gt)):Rs(r)?(t.fiber=Ws(n=>I(n(_i(r)),()=>e.state===t&&t.refCount===0?(e.state=Rd,Ze(t.scope,Gt)):W)).pipe(Ra(U(()=>{t.fiber=void 0})),Io(e.context),Ni(e.scope)),W):W};var uy=G1,Md=K1;var Q1="~effect/Stream",ve=e=>O(e,Q1),Y1=wd,R=N1,fy=e=>R(ey(F(e,Ae))),a5=e=>fy(aC(e)),i5=e=>fy(Ff(e)),X1=e=>vo(g(I(e,()=>ee()))),eU=e=>vo(g(F(e,Ae))),c5=(e,t)=>vo(tt(function*(){let r=yield*Go(t),n=yield*dn(e,wr,wr.defaultValue()),o=!0,s=L(()=>r(n)).pipe(I(a=>dn(e,wr,a)),F(a=>(n=a,Ae(a))));return L(()=>o?(o=!1,g(Ae(n))):s)})),u5=e=>vo(U(()=>{let t=!0,r=g(Ae(void 0)),n=tC(r,e);return L(()=>t?(t=!1,r):n)})),vo=e=>R(Ar(e)),pr=(e,t)=>R(Oe((r,n)=>I(Qs(e.channel,n),o=>t(o,n)))),Ew=(e,t)=>R(rs((r,n,o)=>I(Qs(e.channel,n),s=>t(s,n,o)))),Ao=e=>e.channel,ly=(e,t)=>R(TN(e,t)),gn=R(Bf),tu=e=>R(Xx(Ae(e))),f5=(...e)=>Nd(e),l5=e=>R(vN(()=>Ae(e()))),bn=e=>R(Yx(()=>e().channel)),Ba=e=>R(Zs(e)),p5=e=>R(_N(e)),tU=e=>R(Td(e)),d5=e=>R(YC(e)),m5=e=>R(PN(e)),h5=(e,t)=>R(QC(()=>e,t)),nu=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?Nd(e):R(AN(e,t?.chunkSize)),g5=e=>en(F(e,nu)),x5=e=>Hf(eU(e),nu),Nd=e=>st(e)?R(Xx(e)):gn,y5=e=>en(F(e,Nd)),S5=(...e)=>R(ZC(tg(e,st))),E5=e=>R(RN(e)),b5=e=>R(MN(e)),rU=e=>R($N(e)),I5=e=>R(NN(e)),C5=(e,t)=>R(UN(e,t)),w5=e=>vo(F(rd(e),t=>ze(F(t(void 0),Ae),()=>ee()))),T5=e=>R(ew(e)),k5=(e,t,r)=>ly(n=>{let o=typeof r=="object"&&r.once;function s(a){Da(n,a),o&&wo(n)}return Qr(U(()=>e.addEventListener(t,s,r)),()=>U(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r=="object"?r.bufferSize:void 0}),nU=(e,t)=>vo(U(()=>{let r=e;return I(L(()=>t(r)),n=>n===void 0?ee():(r=n[1],g(Ae(n[0]))))})),A5=(e,t)=>vo(U(()=>{let r=e,n=!1;return L(function o(){return n?ee():I(t(r),([s,a])=>(me(a)?n=!0:r=a.value,st(s)?g(s):o()))})})),v5=(e,t)=>nU(e,r=>g([r,t(r)])),O5=(e,t,r=wd)=>e>t?gn:vo(U(()=>{let n=lo(r),o=e,s=!1;return L(()=>{if(s)return ee();let a=t-o+1;if(a>n){let c=Lb(o,o+n-1);return o+=n,g(c)}let i=Lb(o,o+a-1);return s=!0,g(i)})})),_5=R(ON),en=e=>R(La(F(e,Ao))),P5=e=>R(g1(e.channel)),In=l(2,(e,t)=>bn(()=>{let r=0;return R(ns(e.channel,ar(n=>t(n,r++))))})),F5=l(2,(e,t)=>In(e,()=>t)),R5=l(2,(e,t)=>e.pipe(In(t.onElement),mU(t.onError))),oU=l(2,(e,t)=>R(ns(e.channel,t))),Ud=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,ty(t,r),ns(Ae),R)),M5=l(e=>ve(e[0]),(e,t)=>Ud(e,D,t)),$5=l(2,(e,t)=>R(ty(e.channel,t))),N5=e=>e.pipe(In(G),Ld(t=>tu(X(t)))),sU=l(e=>ve(e[0]),(e,t,r)=>Ud(e,n=>at(t(n),n),r)),U5=l(2,(e,t)=>e.pipe(ww(t.onError),sU(t.onElement,{concurrency:t.concurrency}))),D5=l(2,(e,t)=>Ew(e,N(function*(r,n,o){let s=zr(),a=zr(),i,c,u=!1,f=!1,p=s.whenOpen(L(()=>{if(i){let m=i;return i=void 0,f||s.closeUnsafe(),at(a.open,m)}return ee()}));yield*L(()=>t.transform(p,o)).pipe(m=>pd(m,x=>(u=!0,ka(x)&&(c=x.cause),a.open),!0),Zt(o));let d=r.pipe(I(m=>c?dt(c):u?g(m):(i=m,a.closeUnsafe(),s.openUnsafe(),at(a.await,m))),ze(()=>c?dt(c):u?ee():(f=!0,a.closeUnsafe(),s.openUnsafe(),I(a.await,()=>c?dt(c):ee()))));return L(()=>c?dt(c):u?r:d)}))),Hf=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,nw(n=>t(n).channel,r),R)),L5=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,d1(n=>t(n).channel,r),R)),aU=l(e=>ve(e[0]),(e,t)=>Hf(e,D,t)),B5=e=>R(Xr(e.channel)),j5=e=>R(qN(e.channel)),z5=l(2,(e,t)=>py(e,gy(t))),H5=l(2,(e,t)=>R(WN(e.channel,t))),q5=l(2,(e,t)=>e.channel.pipe(Xr,KN(t),ns(Ae),R)),W5=l(2,(e,t)=>iU(e,{duration:t,orElse:()=>gn})),iU=l(2,(e,t)=>{let r=pt(t.duration);if(!Rs(r))return e;if(uf(r))return bn(t.orElse);let n=Symbol();return lU(bn(()=>{let s=Uf().getRef(Tf),a=Lr(r),i,c=zr(!1);return Dd(pr(e,(u,f)=>L(()=>(i=s.currentTimeMillisUnsafe()+a,c.openUnsafe(),u)).pipe(F(p=>(c.closeUnsafe(),i=void 0,p)),g)),X1(tt(function*(){for(;;)if(yield*c.await,!(i===void 0||(yield*_i(i-s.currentTimeMillisUnsafe()),i===void 0)||i-s.currentTimeMillisUnsafe()>0))return yield*lr(n)})),{haltStrategy:"left"})}),o=>o.reasons.find(a=>a._tag==="Die"&&a.defect===n)?t.orElse():tU(o))}),V5=l(2,(e,t)=>R(Oe((r,n)=>F(Se(Xr(e.channel))(r,n),o=>{let s,a=tt(function*(){let i=yield*o,c=Ae(i);return s=(yield*rd(t))(i).pipe(at(c),ze(f=>(s=void 0,a))),c});return L(()=>s??a)})))),G5=e=>R(GN(e.channel)),K5=e=>Hf(e,nu),J5=e=>e.channel.pipe(Xr,HN,R),ru=l(2,(e,t)=>{let r=R(zN(kN(()=>Z5(e,t))));return cU.set(r,[e,t]),r}),cU=new WeakMap;function*Z5(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=cU.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var Q5=l(2,(e,t)=>ru(nu(t),e)),Dd=l(e=>ve(e[0])&&ve(e[1]),(e,t,r)=>R(sy(Ao(e),Ao(t),r))),py=l(2,(e,t)=>e.channel.pipe(m1(t),R)),Y5=l(2,(e,t)=>Dd(In(e,G),In(t,X))),X5=l(2,(e,t)=>py(e,gy(t))),e8=l(2,(e,t)=>py(t,gy(e))),t8=l(2,(e,t)=>aU(nu(e),t)),r8=l(2,(e,t)=>uU(e,t,(r,n)=>[r,n])),uU=l(3,(e,t,r)=>Hf(e,n=>In(t,o=>r(n,o)))),bw=l(3,(e,t,r)=>dy(e,t,n8(r))),n8=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},dy=l(3,(e,t,r)=>R(rs(N(function*(n,o){let s=yield*Qs(e.channel,o),a=yield*Qs(t.channel,o),i=tt(function*(){let f=yield*Zt(s,o),p=yield*Zt(a,o);return yield*Y$([f,p])}),c={_tag:"PullBoth"};return tt(function*(){let[f,p]=c._tag==="PullBoth"?yield*i:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*a],d=r(f,p);return st(d[1])?c={_tag:"PullRight",leftArray:d[1]}:st(d[2])?c={_tag:"PullLeft",rightArray:d[2]}:c={_tag:"PullBoth"},d[0]})})))),o8=l(2,(e,t)=>bw(e,t,(r,n)=>[r,n])),s8=l(2,(e,t)=>dy(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),a8=l(2,(e,t)=>dy(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),i8=l(2,(e,t)=>bw(e,t,(r,n)=>[...r,n])),c8=e=>In(e,(t,r)=>[t,r]),u8=e=>ou(e,A,(t,r)=>{let n=0;t._tag==="None"&&(n=1,t=v(r[0]));let o=Lt();for(;n<r.length;n++){let s=t.value;t=v(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,A()]]:[]}}),f8=e=>ou(e,A,(t,r)=>{let n=Lt();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=v(r[o])}return[t,n]}),l8=e=>ou(e,()=>({prev:A(),current:A()}),(t,r)=>{let n=0,o;t.current._tag==="None"?(n=1,o=r[0],t.current=v(o)):o=t.current.value;let s=Lt();for(;n<r.length;n++){let a=r[n];t.current=v(a),s.push([t.prev,o,t.current]),t.prev=v(o),o=a}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,A()]]:[]}}),Iw=(...e)=>R(Yx(()=>{let t=[],r=new Set,n=zr(),o=zr();return oy(ZC(e.map((s,a)=>s.channel.pipe(Xr,ty(i=>(t[a]=i,r.has(a)?g(Ae(t.slice())):(r.add(a),r.size<e.length?n.await:at(n.open,Ae(t.slice()))))),JN(Tt),rw(()=>r.has(a)?W:o.open)))),{concurrency:"unbounded",bufferSize:0}).pipe(iw(o.await))})),p8=l(2,(e,t)=>Iw(e,t)),d8=l(3,(e,t,r)=>In(Iw(e,t),([n,o])=>r(n,o))),fU=(...e)=>R(Oe((t,r)=>U(()=>{let n,o=rC(e.map(s=>{let a=ur(r);return Qs(s.channel,a).pipe(I(i=>Y0(g(i),i)),Jn(i=>i._tag==="Success"?n?Ze(a,i):(n=i.value[0],W):Ze(a,i)),F(([,i])=>i))}));return L(()=>n??o)}))),m8=l(2,(e,t)=>fU(e,t)),h8=l(2,(e,t)=>R(ZN(Ao(e),t))),g8=l(2,(e,t)=>R(QN(Ao(e),t))),x8=l(2,(e,t)=>R(YN(Ao(e),t))),y8=l(2,(e,t)=>R(XN(Ao(e),t))),Cw=l(e=>ve(e[0]),N(function*(e,t,r){let n=yield*Hc,o=yield*Qs(e.channel,n),s=r?.capacity==="unbounded"?void 0:r?.capacity??Y1,a=yield*mn({capacity:s}),i=yield*mn({capacity:s});return yield*tt(function*(){for(;;){let c=yield*o,u=[],f=[];for(let d=0;d<c.length;d++){let m=t(c[d]);be(m)?u.push(m.failure):f.push(m.success)}let p;if(f.length>0){let d=Kx(a,f);d.length>0&&(p=yield*Rf(Zc(a,d)))}if(u.length>0){let d=Kx(i,u);d.length>0&&(yield*Zc(i,d))}p&&(yield*$i(p))}}).pipe(Zo(c=>(Js(a,c),Js(i,c),W)),Zt(n)),[a,i]})),$d=e=>R(Oe((t,r)=>at(cr(r,To(e)),Qc(e)))),S8=l(e=>ve(e[0]),(e,t,r)=>F(Cw(Ud(e,n=>t(n),r),n=>n,r),([n,o])=>[$d(n),$d(o)])),E8=l(e=>ve(e[0]),(e,t,r)=>F(Cw(e,t,{capacity:r?.capacity??16}),([n,o])=>[$d(n),$d(o)])),b8=l(2,(e,t)=>t.pipe(F(r=>r?e:gn),en)),I8=l(2,N(function*(e,t){let r,n=yield*lw(e.channel),o=Ct(n,c=>(r=c,dt(c))),[s,a]=yield*bx(c=>t.transform(o,c)),i=r?gn:vo(g(n));return a&&(i=ru(Nd(a),i)),[s,i]})),C8=l(2,(e,t)=>R(y1(e.channel,t))),w8=l(2,(e,t)=>R(x1(e.channel,t))),lU=l(2,(e,t)=>e.channel.pipe(zf(r=>t(r).channel),R)),T8=l(2,(e,t)=>e.channel.pipe(t1(r=>t(r).channel),R)),pU=l(2,(e,t)=>e.channel.pipe(ry(t),R)),Ld=l(2,(e,t)=>R(ts(e.channel,r=>t(r).channel)));var ww=l(2,(e,t)=>e.channel.pipe(n1(t),R)),k8=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):mr(t);return ww(e,o=>n(o)?r(o):W)}),A8=l(2,(e,t)=>pU(e,r=>{let n=Gg(r);return xt(n)?t(n.success):W})),dU=l(e=>ve(e[0]),(e,t,r,n)=>R(o1(Ao(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Tw=l(e=>ve(e[0]),(e,t,r,n)=>R(s1(Ao(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),v8=l(e=>ve(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):mr(t);return dU(e,o,r,n)}),O8=l(e=>ve(e[0]),(e,t,r)=>{let n;return Tw(e,o=>(n??=Object.keys(t),O(o,"_tag")&&sx(o._tag)&&n.includes(o._tag)?G(o):X(o)),o=>t[o._tag](o),r)}),_8=l(e=>ve(e[0]),(e,t,r,n,o)=>R(a1(Ao(e),t,r,(s,a)=>n(s,a).channel,o&&((s,a)=>o(s,a).channel)))),P8=l(e=>ve(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let a of Object.keys(r)){let i=r[a];o[a]=(c,u)=>i(c,u).channel}let s=n&&((a,i)=>n(a,i).channel);return R(i1(e.channel,t,o,s))}),F8=l(2,(e,t)=>Tw(e,r=>mr(r,t)&&O(r,"reason")?G(r.reason):X(r),Ba)),mU=l(2,(e,t)=>R(c1(e.channel,t))),R8=l(3,(e,t,r)=>R(r1(e.channel,t,n=>r(n).channel))),M8=l(3,(e,t,r)=>R(ny(e.channel,t,(n,o)=>r(n,o).channel))),$8=l(2,(e,t)=>R(jN(e.channel,r=>Ao(t())))),N8=l(2,(e,t)=>Ld(e,r=>tu(t(r)))),U8=e=>R(u1(e.channel)),D8=l(e=>ve(e[0]),(e,t)=>R(f1(e.channel,t))),L8=l(e=>ve(e[0]),(e,t)=>R(l1(e.channel,t))),B8=l(2,(e,t)=>R(p1(e.channel,t))),Z1=(e,t)=>en(F(Go(t),r=>{let n=wr.defaultValue(),o=()=>Ld(_w(e,wr,U(()=>n)),s=>en(ze(F(r(s),a=>(n=a,en(at(cd,o())))),()=>g(Ba(s)))));return o()})),j8=l(e=>ve(e[0]),(e,t,r)=>bn(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},a=_w(cx,U(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),i=r?.onEvent===void 0?void 0:q0(r.onEvent,()=>s),c,u=i===void 0?D:d=>_U(PU(d,F(i.begin,m=>{c=m})),m=>L(()=>{if(c===void 0)return W;let x=c;return c=void 0,i.end(x,m)})),f=A(),p=bn(()=>{let d=t.steps[o];if(!d)return Ba(_b(f));let m=a(u(RU(e,d.provide))),x=!1;if(fe(f)){let y=f.value,E=!1,w=m;m=bn(()=>E?w:(E=!0,Ba(y))),m=Z1(m,id(d,!1))}else{let y=id(d,!0);m=y?Z1(m,y):m}return Ld(n?FU(m,y=>(x=!0,W)):m,y=>(o++,n&&x?Ba(y):(f=v(y),p)))});return p})),z8=l(2,(e,t)=>{let r=At(t);return r===0?gn:hU(e,(n,o)=>o===r-1)}),H8=l(3,(e,t,r)=>bn(()=>{let n=Vc(t),o=BigInt(0),s=!1;return ru(xU(e,a=>{let i=o+BigInt(a.length);return i>n?(s=!0,!1):(o=i,!0)}),bn(()=>s?r():gn))})),q8=l(2,(e,t)=>{let r=At(t);return r===0?gn:ou(e,Ua,(n,o)=>(Px(n,o),n.length>r&&Rx(n,n.length-r),[n,ja]),{onHalt(n){return Di(n)}})}),hU=l(e=>ve(e[0]),(e,t,r)=>pr(e,(n,o)=>U(()=>{let s=0,a=!1;return I(L(()=>a?ee():n),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){a=!0;let f=c.slice(0,r?.excludeLast?u:u+1);return st(f)?g(f):ee()}return g(c)})}))),gU=l(e=>ve(e[0]),(e,t,r)=>pr(e,(n,o)=>U(()=>{let s=0,a=!1;return tt(function*(){if(a)return yield*ee();let i=yield*n;for(let c=0;c<i.length;c++)if(yield*t(i[c],s++)){a=!0;let u=i.slice(0,r?.excludeLast?c:c+1);return st(u)?u:yield*ee()}return i})}))),xU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=0,s=!1,a=I(L(()=>s?ee():r),i=>{let c=[];for(let u=0;u<i.length;u++){if(!t(i[u],o++)){s=!0;break}c.push(i[u])}return st(c)?g(c):s?ee():a});return a}))),W8=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!1,s=I(L(()=>o?ee():r),a=>{let i=[];for(let c=0;c<a.length;c++){let u=t(a[c]);if(be(u)){o=!0;break}i.push(u.success)}return st(i)?g(i):o?ee():s});return s}))),V8=l(2,(e,t)=>gU(e,(r,n)=>F(t(r,n),o=>!o),{excludeLast:!0})),kw=l(2,(e,t)=>{let r=At(t);return r===0?e:pr(e,(n,o)=>U(()=>{let s=0,a=n.pipe(I(i=>s>=r?g(i):(s+=i.length,s<=r?a:g(i.slice(r-s)))));return a}))}),G8=l(2,(e,t)=>kw(yU(e,(r,n)=>!t(r,n)),1)),K8=l(2,(e,t)=>kw(SU(e,(r,n)=>F(t(r,n),o=>!o)),1)),yU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=0,a=I(r,i=>{let c=i.findIndex(u=>!t(u,s++));return c===-1?a:(o=!1,g(i.slice(c)))});return L(()=>o?a:r)}))),J8=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=I(r,a=>{let i=a.findIndex(c=>be(t(c)));return i===-1?s:(o=!1,g(a.slice(i)))});return L(()=>o?s:r)}))),SU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=0,a=tt(function*(){for(;;){let i=yield*r;for(let c=0;c<i.length;c++)if(!(yield*t(i[c],s++)))return o=!1,i.slice(c)}});return L(()=>o?a:r)}))),Z8=l(2,(e,t)=>{let r=At(t);return r===0?e:pr(e,(n,o)=>U(()=>{let s=Ua(),a=I(n,i=>{Fx(s,i);let c=s.length-r,u=Kc(s,c);return Dr(u)?g(u):a});return a}))}),EU=e=>e.channel.pipe(ns(Ae),R),bU=l(2,(e,t)=>(t=lo(t),pr(e,(r,n)=>U(()=>{let o=Lt(),s=0,a,i=!1;return L(function c(){if(i)return ee();if(a===void 0)return I(r,u=>{if(o.length===0&&u.length===t)return g(u);if(o.length+u.length<t){for(let f=0;f<u.length;f++)o.push(u[f]);return c()}return a=u,c()});for(;s<a.length;)if(o.push(a[s++]),o.length===t){let u=o;return o=[],g(u)}return s=0,a=void 0,c()}).pipe(ze(()=>{if(o.length===0)return ee();let c=o;return i=!0,o=[],g(c)}))})))),Q8=l(2,(e,t)=>IU(e,t,1)),IU=l(3,(e,t,r)=>{let n=lo(t),o=lo(r);return pr(e,(s,a)=>U(()=>{let i=null,c=Ua(),u=!1,f=0,p=Fa(s,{onSuccess(d){if(Fx(c,d),f>0){let x=c.length;Rx(c,f),f=Math.max(0,f-x)}if(c.length<n)return p;u=!0;let m=[];for(;c.length>=n;)if(n===o)m.push(Kc(c,n));else{m.push(nN(c,n));let x=c.length;Rx(c,o),f=Math.max(0,o-x)}return g(m)},onFailure(d){return c.length===0||u&&c.length<=n-o?dt(d):(i=d,g(Ae(Di(c))))}});return L(()=>i?dt(i):p)}))}),Y8=l(2,(e,t)=>ou(e,Lt,(r,n)=>{let o=Lt();for(let s=0;s<n.length;s++)t(n[s])?Dr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return Dr(r)?Ae(r):ja}})),X8=l(4,(e,t,r,n)=>ow(Xr(e.channel),Xr(t.channel),r,n).pipe(ns(Ae),R)),eQ=l(4,(e,t,r,n)=>R(ow(e.channel,t.channel,r,n))),tQ=l(e=>ve(e[0]),(e,t,r,n)=>R(jf(e.channel,t,(o,s)=>{let a=Lt();for(let i=0;i<s.length;i++){let[c,u]=r(o,s[i]);o=c,a.push(...u)}return[o,Dr(a)?Ae(a):ja]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0))),ou=l(e=>ve(e[0]),(e,t,r,n)=>R(jf(e.channel,t,(o,s)=>{let[a,i]=r(o,s);return o=a,[o,st(i)?Ae(i):ja]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0))),ja=Lt(),rQ=l(e=>ve(e[0]),(e,t,r,n)=>e.channel.pipe(Xr,jf(t,(o,s)=>F(r(o,s),([a,i])=>[a,st(i)?Ae(i):Lt()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0),R)),nQ=l(e=>ve(e[0]),(e,t,r,n)=>e.channel.pipe(jf(t,(o,s)=>F(r(o,s),([a,i])=>[a,st(i)?Ae(i):ja]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0),R)),oQ=l(3,(e,t,r)=>bn(()=>{let n=t();return ru(tu(n),R(jf(e.channel,()=>n,(o,s)=>{let a=Lt();for(let i=0;i<s.length;i++)o=r(o,s[i]),a.push(o);return[o,Ae(a)]})))})),sQ=l(3,(e,t,r)=>bn(()=>e.channel.pipe(Xr,e1(t(),r),ns(Ae),R))),aQ=l(2,(e,t)=>pr(e,N(function*(r,n){let o=yield*Tf,s=Lr(pt(t)),a,i,c=1/0,u=zr(),f=zr(),p=zr();yield*r.pipe(u.whenOpen,I(m=>(f.openUnsafe(),a=m,c=o.currentTimeMillisUnsafe()+s,W)),vt({disableYield:!0}),Zo(m=>(i=m,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),p.openUnsafe(),W)),Zt(n));let d=L(function m(){let x=o.currentTimeMillisUnsafe(),y=c<x?s:Math.min(s,c-x);return I(Hs(_i(y),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(a){f.closeUnsafe(),u.closeUnsafe();let w=g(Ae(Yh(a)));return a=void 0,w}else if(i)return dt(i);return m()})});return L(()=>{if(i){if(a){let m=g(Ae(Yh(a)));return a=void 0,m}return dt(i)}return u.openUnsafe(),f.whenOpen(d)})}))),CU=l(2,(e,t)=>{let r=t.burst??0;return t.strategy==="enforce"?iQ(e,t.cost,t.units,t.duration,r):cQ(e,t.cost,t.units,t.duration,r)}),iQ=(e,t,r,n,o)=>pr(e,s=>Gs(a=>{let i=Lr(pt(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.currentTimeMillisUnsafe();return g(I(s,function p(d){return I(t(d),m=>{let x=a.currentTimeMillisUnsafe(),E=(x-f)/i,w=u+E*r,T=w<0?c:Math.min(w,c);return m<=T?(u=T-m,f=x,g(d)):I(s,p)})}))})),cQ=(e,t,r,n,o)=>pr(e,s=>Gs(a=>{let i=Lr(pt(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.monotonicTimeNanosUnsafe();return g(I(s,p=>I(t(p),d=>{let m=a.monotonicTimeNanosUnsafe(),y=Number(m-f)/1e6/i,E=u+y*r,T=Math.min(E,c)-d;if(T>=0)return u=T,f=m,g(p);let M=-T/r,P=Math.max(0,M*i);return P>0?I(_i(P),()=>(u=T,f=m,g(p))):(u=T,f=m,g(p))})))})),uQ=l(2,(e,t)=>CU(e,{...t,cost:r=>g(t.cost(r))})),fQ=l(2,(e,t)=>EU(bU(e,t))),lQ=l(3,(e,t,r)=>Aw(e,B1(lo(t)),B0(r))),pQ=l(e=>ve(e[0]),(e,t,r)=>wU(e,N(function*(n,o,s){for(let a=0;a<n.length;a++){let[i,c]=yield*t(n[a]),u=Gn(s,i),f=fe(u)?u.value:yield*qs(gw(o,i));yield*xw(o,i),yield*Yr(f,c)}}),r)),dQ=l(e=>ve(e[0]),(e,t,r)=>bn(()=>{let n=Lc();return wU(e,N(function*(o,s,a){for(let i=0;i<o.length;i++){let c=t(o[i]),u=Gn(n,c);me(u)?Bc(n,c,[o[i]]):u.value.push(o[i])}for(let[i,c]of n){let u=Gn(a,i),f=fe(u)?u.value:yield*qs(gw(s,i));yield*xw(s,i),yield*Zc(f,c)}fx(n)}),r)})),wU=(e,t,r)=>Ew(e,N(function*(n,o,s){let a=yield*uN();yield*cr(o,To(a));let i=Lc(),c=yield*q1({lookup:u=>Qr(mn({capacity:r?.bufferSize??4096}).pipe(jr(f=>(Bc(i,u,f),Yr(a,[u,$d(f)])))),f=>(Ai(i,u),WC(f))),idleTimeToLive:r?.idleTimeToLive??ya}).pipe(va(s));return yield*Ko({while:sn,body:ct(I(n,u=>t(u,c,i))),step:yn}).pipe(Ct(u=>yr(a,u)),Zt(o)),Qc(a)})),mQ=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o,s,a=Lt(),i=r.pipe(I(u=>{for(let f=0;f<u.length;f++){let p=u[f],d=t(p);if(s===void 0){o=d,s=[p];continue}else if(Z(d,o)){s.push(p);continue}a.push([o,s]),o=d,s=[p]}if(Dr(a)){let f=a;return a=[],g(f)}return i})),c=!1;return ze(L(()=>c?ee():i),()=>{c=!0;let u=s;return s=void 0,u&&Dr(u)?g(Ae([o,u])):ee()})}))),Bd=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o,s,a=L(()=>{if(s!==void 0){let c=s;return s=void 0,g(c)}return r}).pipe(Jo(c=>(o=Vo(c),ee()))),i=F(L(()=>t.transform(a,n)),([c,u])=>(s=u,Ae(c)));return L(()=>o||i)}))),hQ=l(2,(e,t)=>Aw(e,t,od)),Aw=l(3,(e,t,r)=>R(rs(N(function*(n,o,s){let a=yield*Qs(e.channel,o),i=zr(!1),c=Symbol(),u=yield*mn({capacity:0});yield*a.pipe(i.whenOpen,I(h=>(i.closeUnsafe(),Yr(u,h))),vt,Ct(h=>yr(u,h)),Zt(s));let f=yield*Tf,p=yield*Dc(r),d=zr(!1),m=f.currentTimeMillisUnsafe(),x=0,y=A(),E,w=h=>(d.openUnsafe()&&(x=f.currentTimeMillisUnsafe()),g(h)),T=d.await.pipe(I(()=>p(m,y)),I(([,h])=>_i(h)),I(()=>Yr(u,c)),ze(()=>WC(u)),I(()=>zc)),M=L(()=>{if(E!==void 0){let h=E;return E=void 0,w(h)}return u.state._tag==="Open"&&i.openUnsafe(),I(hn(u),h=>h===c?ee():w(h))}),P=I(([h,S])=>{if(d.isOpen())m+=f.currentTimeMillisUnsafe()-x;else if(u.state._tag==="Done")return ee();return y=v(h),E=S,g(Ae(h))});return L(()=>{if(u.state._tag==="Done"&&E===void 0)return u.state.exit;d.closeUnsafe();let h=P(L(()=>t.transform(M,s)));return u.state._tag==="Open"?Hs(h,T):h})})))),gQ=l(2,N(function*(e,t){let r=At(t.n),n=yield*xQ(t),o=new Array(r),s=yield*ln;for(let a=0;a<r;a++){let i=ur(s),c=yield*Id(n).pipe(dn(ln,i));o[a]=XC(Wx(c)).pipe(kd(u=>Ze(i,u)),R)}return yield*Xc(e.channel,a=>qx(n,a)).pipe(Jn(a=>Hx(n,a)),Ma),o})),xQ=e=>Qr(e.capacity==="unbounded"?zx(e):e.strategy==="dropping"?Bx(e):e.strategy==="sliding"?jx(e):Lx(e),bd),TU=l(2,(e,t)=>F($U(e,t),rU)),yQ=l(2,(e,t)=>F(uy({acquire:TU(e,t),idleTimeToLive:t.idleTimeToLive}),r=>en(Md(r)))),SQ=l(2,(e,t)=>R(sw(e.channel,t))),kU=l(2,(e,t)=>R(aw(e.channel,t))),EQ=l(2,(e,t)=>e.channel.pipe(aw(hw(t)),BN(([r,n])=>n?Xx(n):Bf),R)),bQ=e=>fy(hy(e)),IQ=e=>ou(e,Lt,(t,r)=>{let n=Bb(t,r);return[n,[n]]}),CQ=e=>AU(e,Z),AU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s;return I(r,function a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];t(f,s)||(s=f,c.push(f))}return Dr(c)?g(c):I(r,a)})}))),wQ=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s;return I(r,N(function*a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];(yield*t(f,s))||(s=f,c.push(f))}return Dr(c)?c:yield*I(r,N(a))}))}))),vw=l(e=>ve(e[0]),(e,t)=>bn(()=>{let r=new TextDecoder(t?.encoding);return In(e,n=>r.decode(n,{stream:!0}))})),TQ=e=>bn(()=>{let t=new TextEncoder;return In(e,r=>t.encode(r))}),Ow=e=>e.channel.pipe(sw(h1()),R),vU=l(2,(e,t)=>oU(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let a=0;a<r.length;a++)a===s?o.push(r[a]):o.push(r[a],t);return o})),kQ=l(2,(e,t)=>tu(t.start).pipe(ru(vU(e,t.middle)),ru(tu(t.end)))),AQ=l(2,(e,t)=>OU(e,t,nu(j_([!0,!1])))),OU=l(3,(e,t,r)=>R(Oe(N(function*(n,o){let s=yield*Se(Xr(r.channel))(n,o),a=Symbol(),i=!1,c=!1,u=(yield*Se(Xr(e.channel))(n,o)).pipe(ze(()=>(i=!0,g(a)))),f=(yield*Se(Xr(t.channel))(n,o)).pipe(ze(()=>(c=!0,g(a))));return tt(function*(){for(;;){if(i&&c)return yield*ee();let p=yield*s;if(p&&i||!p&&c)continue;let d=yield*p?u:f;if(d!==a)return Ae(d)}})})))),vQ=l(2,(e,t)=>R(iw(e.channel,t))),OQ=l(2,(e,t)=>R(S1(e.channel,t))),_U=l(2,(e,t)=>R(kd(e.channel,t))),_Q=l(2,(e,t)=>R(E1(e.channel,t))),PU=l(2,(e,t)=>R(b1(e.channel,t))),FU=l(2,(e,t)=>R(cw(e.channel,r=>t(r[0])))),PQ=l(2,(e,t)=>R(I1(e.channel,t))),FQ=l(2,(e,t)=>R(C1(e.channel,t))),RU=l(e=>ve(e[0]),(e,t,r)=>R(w1(e.channel,t,r))),RQ=l(2,(e,t)=>R(ay(e.channel,t))),MQ=l(3,(e,t,r)=>R(iy(e.channel,t,r))),_w=l(3,(e,t,r)=>R(cy(e.channel,t,r))),MU=l(2,(e,t)=>R(T1(e.channel,t))),$Q=l(3,(e,t,r)=>MU(e,n=>or(n,t,r($e(n,t))))),NQ=function(){let e=ve(arguments[0]),t=e?arguments[1]:arguments[0],r=xi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return R(uw(n.channel,t,r))}return n=>R(uw(n.channel,t,r))},UQ=tu({}),DQ=l(3,(e,t,r)=>In(e,n=>({...n,[t]:r(n)})));var LQ=l(e=>ve(e[0]),(e,t,r,n)=>Hf(e,o=>In(r(o),s=>({...o,[t]:s})),n)),BQ=l(e=>ve(e[0]),(e,t,r,n)=>Ud(e,o=>F(r(o),s=>({...o,[t]:s})),n)),jQ=l(2,(e,t)=>In(e,r=>({[t]:r}))),my=l(2,(e,t)=>bx(r=>Qs(e.channel,r).pipe(I(n=>t.transform(n,r)),F(([n])=>n)))),hy=e=>eu(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),zQ=e=>eu(e.channel,()=>0,(t,r)=>t+r.length),HQ=e=>eu(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),qQ=l(3,(e,t,r)=>eu(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),WQ=l(3,(e,t,r)=>_1(e.channel,t,(n,o)=>{let s=0,a=n;return F(Ko({while:()=>s<o.length,body:()=>r(a,o[s]),step(i){a=i,s++}}),()=>a)})),VQ=e=>F(v1(e.channel),rr(J_(0))),GQ=e=>F(O1(e.channel),rr(Yh)),KQ=l(2,(e,t)=>Xc(e.channel,r=>{let n=0;return Ko({while:()=>n<r.length,body:()=>t(r[n++]),step:yn})})),JQ=l(2,(e,t)=>A1(e.channel,r=>{let n=!1,o=0;return F(Ko({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),Pw=l(2,(e,t)=>Xc(e.channel,t)),gy=e=>k1(e.channel),ZQ=e=>lw(e.channel),Fw=e=>eu(e.channel,()=>"",(t,r)=>t+r.join("")),QQ=e=>F(fw(e.channel),t=>t.buffer),YQ=e=>fw(e.channel),Rw=l(e=>ve(e[0]),(e,t,r)=>{let n,o,s=!1,a=zr(!1),i=r?.signal,c=()=>o.interruptUnsafe();return new ReadableStream({start(u){o=Yo(pn(Pw(e,f=>a.whenOpen(U(()=>{a.closeUnsafe();for(let p=0;p<f.length;p++)u.enqueue(f[p]);n(),n=void 0}))),t)),o.addObserver(f=>{i?.removeEventListener("abort",c),!s&&(f._tag==="Failure"&&i?.aborted!==!0?u.error(Nc(f.cause)):u.close())}),i!==void 0&&o.pollUnsafe()===void 0&&(i.aborted?c():i.addEventListener("abort",c,{once:!0}))},pull(){return new Promise(u=>{n=u,a.openUnsafe()})},cancel(){if(o)return s=!0,lC(Oi(Xo(o)))}},r?.strategy)}),XQ=l(e=>ve(e[0]),(e,t)=>Rw(e,nr(),t)),eY=l(e=>ve(e[0]),(e,t)=>F(Fi(),r=>Rw(e,r,t))),Mw=l(2,(e,t)=>({[Symbol.asyncIterator](){let r=pC(t),n=Io(t),o=yo(),s,a,i,c,u=p=>{if(c)return c;let d=i;return c=r(at(Kt(d?Xo(d):W,Ze(o,p)),{done:!0,value:void 0})),c},f=async p=>{try{await u(p)}catch(d){await r(dd("Suppressed error while closing Stream async iterator",d))}};return{async next(){if(c)return c;if(a){let m=a.next();if(!m.done)return m;a=void 0}let p=n(s??I(Qs(e.channel,o),m=>(s=m,m)));i=p;let d=await r(Q$(p));if(i===p&&(i=void 0),et(d))return a=d.value[Symbol.iterator](),a.next();if(zs(d.cause))return u(Gt);if(c&&qp(d.cause))return c;throw await f(d),Nc(d.cause)},return(){return u(Gt)},async throw(p){throw await f(xM(p)),p}}}})),tY=e=>F(Fi(),t=>Mw(e,t)),rY=e=>Mw(e,nr()),nY=l(e=>ve(e[0]),(e,t,r)=>dw(e.channel,t,r)),oY=l(2,(e,t)=>R1(e.channel,t)),$U=l(2,(e,t)=>M1(e.channel,t)),sY=l(2,(e,t)=>P1(e.channel,t)),aY=l(2,(e,t)=>pw(e.channel,t));var xy="~effect/FileSystem",os=gt("effect/FileSystem"),$w=e=>os.of({...e,[xy]:xy,exists:t=>Is(e.access(t),at(!0),_a("PlatformError",r=>r.reason._tag==="NotFound"?g(!1):k(r))),readFileString:(t,r)=>I(e.readFile(t),n=>Rt({try:()=>new TextDecoder(r).decode(n),catch:o=>Co({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:N(function*(t,r){let n=yield*e.open(t,{flag:"r"}),o=r?.offset===void 0?void 0:Vc(r.offset);o&&(yield*n.seek(o,"start"));let s=r?.bytesToRead===void 0?void 0:Vc(r.bytesToRead),a=BigInt(0),i=Number(BigInt(r?.chunkSize??64*1024)),c=n.readAlloc(i);return vo(g(I(L(()=>s!==void 0&&s<=a?ee():s!==void 0&&s-a<i?n.readAlloc(Number(s-a)):c),Le({onNone:()=>ee(),onSome:u=>(a+=BigInt(u.length),g(Ae(u)))}))))},en),sink:(t,r)=>Is(e.open(t,{...r,flag:r?.flag??"w"}),F(n=>j1(o=>n.writeAll(o))),z1),writeFileString:(t,r,n)=>I(Rt({try:()=>new TextEncoder().encode(r),catch:o=>Co({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),o=>e.writeFile(t,o,n))}),Mt=(e,t)=>Zn({module:"FileSystem",method:e,_tag:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),NU=e=>os.of({[xy]:xy,access(t){return k(Mt("access",t))},chmod(t){return k(Mt("chmod",t))},chown(t){return k(Mt("chown",t))},copy(t){return k(Mt("copy",t))},copyFile(t){return k(Mt("copyFile",t))},glob(t){return k(Mt("glob",t))},exists(){return g(!1)},link(t){return k(Mt("link",t))},makeDirectory(){return lr("not implemented")},makeTempDirectory(){return lr("not implemented")},makeTempDirectoryScoped(){return lr("not implemented")},makeTempFile(){return lr("not implemented")},makeTempFileScoped(){return lr("not implemented")},open(t){return k(Mt("open",t))},readDirectory(t){return k(Mt("readDirectory",t))},readFile(t){return k(Mt("readFile",t))},readFileString(t){return k(Mt("readFileString",t))},readLink(t){return k(Mt("readLink",t))},realPath(t){return k(Mt("realPath",t))},remove(){return W},rename(t){return k(Mt("rename",t))},sink(t){return L1(Mt("sink",t))},stat(t){return k(Mt("stat",t))},stream(t){return Ba(Mt("stream",t))},symlink(t){return k(Mt("symlink",t))},truncate(t){return k(Mt("truncate",t))},utimes(t){return k(Mt("utimes",t))},watch(t){return Ba(Mt("watch",t))},writeFile(t){return k(Mt("writeFile",t))},writeFileString(t){return k(Mt("writeFileString",t))},...e}),iY=e=>Bs(os)(NU(e)),Wf="~effect/FileSystem/File",cY=e=>O(e,Wf),qf=class extends gt()("effect/FileSystem/WatchBackend"){};var UU="~effect/Path",Ys=gt("effect/Path"),yy=e=>Ys.of({...e,[UU]:UU,resolveWithin(t,r){if(e.parse(r).root!=="")return A();let n=e.resolve(t),o=e.resolve(n,r),s=e.relative(n,o);return s===".."||s.startsWith(`..${e.sep}`)||e.isAbsolute(s)?A():v(o)}});var Wa={};$n(Wa,{fdName:()=>tk,isCommand:()=>Wy,isPipedCommand:()=>I9,isStandardCommand:()=>b9,make:()=>im,parseFdName:()=>cm,pipeTo:()=>C9,prefix:()=>w9,setCwd:()=>QT,setEnv:()=>YT});var Wi={};$n(Wi,{ChildProcessSpawner:()=>qi,ExitCode:()=>VT,ProcessId:()=>GT,make:()=>KT,makeHandle:()=>qy});function za(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Sy(e){return t=>za(t)?.[e]}var Cn="~structural",su="~identifier",jd="~sentinels",Ey="~constructor",DU=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],Vf=Sy("identifier"),Uw=Sy(su),Dw=Sy("title");var zd=No(e=>{let t=za(e)?.identifier;return typeof t=="string"?t:e.getExpected(zd)}),LU=new Set([jd,Cn,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var we=Symbol();var vr=Zr,wn=vr(we),rt=vr(we),Hd=e=>e===we?A():v(e),Lw=e=>e._tag==="None"?wn:vr(e.value);var Vd="~effect/SchemaIssue/Issue";function jw(e){return O(e,Vd)&&e[Vd]===Vd}function uY(e){return Object.hasOwn(e,"input")}var Qn=class{[Vd]=Vd;constructor(t,r){r?.reportInput===!0&&t!==we&&(this.input=t)}},BU=class extends Qn{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},jU=class extends Qn{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},Yt=class extends Qn{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ji=class extends Qn{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},zw=class extends Qn{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},Xt=class extends Qn{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},$t=class extends Qn{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},he=class extends Qn{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Tn(e,t,r,n,o){return new Xt(e,[new Yt([t],r)],n,o)}var Gd=class extends Qn{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Kd=class extends Qn{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},zU=class extends Qn{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function Bw(e,t,r){if(jw(e))return e;if(typeof e=="string")return new he({message:e},t,r);let n=typeof e.issue=="string"?new he({message:e.issue},t,r):e.issue;return new Yt(e.path,n)}function HU(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new he(void 0,t,r):Bw(e,t,r)}function qU(e,t,r,n){return Array.isArray(t)?st(t)?t.length===1?Bw(t[0],r,n):new Xt(e,ar(t,o=>Bw(o,r,n)),r,n):void 0:HU(t,r,n)}var WU=e=>{let t=Kf(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Bi(zd(e.ast),e);case"InvalidValue":{let r=Hw(e);if(r!==void 0)return Bi(r,e);let n=by(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=by(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=by(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},VU=e=>Kf(e.issue)??Kf(e);function GU(e){return t=>({issues:Gf(t,[],e?.leafHook??WU,e?.checkHook??VU)})}function by(e){return uY(e)?j(e.input):void 0}function Hw(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function Bi(e,t){let r=by(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Gf(e,t,r,n){switch(e._tag){case"Filter":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Gf(e.issue,t,r,n);let s=Hw(e.issue);return[{path:t,message:s===void 0?Bi(qw(e.filter),e):Bi(s,e.issue)}]}case"Encoding":return Gf(e.issue,t,r,n);case"Pointer":return Gf(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>Gf(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:Kf(e)??Bi(zd(e.ast),e)}]:e.issues.flatMap(o=>Gf(o,t,r,n));default:return[{path:t,message:r(e)}]}}function qw(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(r=>qw(r)).join(" & ")}}function fY(){return e=>Wd(e,"")}var KU=fY();function Wd(e,t){let r;switch(e._tag){case"Filter":{let n=VU(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return Wd(e.issue,t);let o=Hw(e.issue);r=o===void 0?Bi(qw(e.filter),e):Bi(o,e.issue)}break}case"Encoding":return Wd(e.issue,t);case"Pointer":return Wd(e.issue,t+wh(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>Wd(n,t)).join(`
|
|
29
|
-
`);r=
|
|
30
|
-
at ${t}`:r}function Kf(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Kf(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r=="string")return r}function Jd(e){let t;for(let r of e.reasons){if(!Vg(r)||!jw(r.error))return;t??=r.error}return t}function Yn(e,t){let r=Jd(e);if(r===void 0)throw new Error(t,{cause:e});return r}var Ww=Af,ZU=Uc,QU=jM,YU=zM,XU=HM,eD=T0,tD=qM;var rD=nx;var nD=k0;var Vw=VM,oD=GM;var Gw=KM;var Kw=A0,Jw=Yp,sD=v0;var aD=O0,Zd=JM;var iD=Xp;var cD=F0;var uD=QM;var Zw=M0;var Jf=e=>lY(typeof e=="string"?pY.encode(e):e),au=e=>{let t=mY(e),r=t.length;if(r%4!==0)return X(new ho({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return X(new ho({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let a=0,i=0;a<r;a+=4,i+=3){let c=Iy(t.charCodeAt(a))<<18|Iy(t.charCodeAt(a+1))<<12|Iy(t.charCodeAt(a+2))<<6|Iy(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return G(s)}catch(o){return X(new ho({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},lD=e=>gr(au(e),t=>dY.decode(t)),lY=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4|e[n-1]>>4],r+=ss[(e[n-1]&15)<<2|e[n]>>6],r+=ss[e[n]&63];return n===t+1&&(r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4|e[n-1]>>4],r+=ss[(e[n-1]&15)<<2],r+="="),r},pY=new TextEncoder,dY=new TextDecoder,mY=e=>e.replace(/[\n\r]/g,""),ss="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qd=new Uint8Array(123).fill(255);for(let e=0;e<ss.length;e++)Qd[ss.charCodeAt(e)]=e;Qd[61]=0;var Iy=e=>{if(e>=Qd.length||Qd[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return Qd[e]};var pD=e=>Jf(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Yw=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return X(new ho({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return X(new ho({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),au(n)},dD=e=>gr(Yw(e),t=>hY.decode(t)),hY=new TextDecoder;var Yd=e=>Object.assign(Object.create(sb),e);function xY(e){return hD((t,r)=>k(e(t,r)))}function Cy(e){return xY((t,r)=>{let n={message:e(t)};return fe(t)?new Gd(n,t.value,r):new Gd(n)})}var mD=Cy(()=>"Encoding is not supported"),yY=Yd({_tag:"Passthrough"});function ea(){return yY}function Ee(e){return Yd({_tag:"Transform",transform:e})}function Wr(e){return Yd({_tag:"TransformEffect",transform:e})}function wy(e){return Yd({_tag:"TransformOptional",transform:e})}function hD(e){return Yd({_tag:"TransformOptionalEffect",transform:e})}function Xw(){return wy(()=>A())}function eT(e){return hD(t=>{let r=Ic(t,Tt);return fe(r)?g(r):qc(e,v)})}function iu(){return Ee(globalThis.String)}function Ty(){return Ee(globalThis.Number)}function gD(){return Ee(globalThis.BigInt)}function tT(){return Ee(e=>new globalThis.Date(e))}function xD(){return Ee(n$)}function yD(e){return Wr((t,r)=>Rt({try:()=>JSON.parse(t,e?.reviver),catch:()=>new he({expected:"a valid JSON string"},t,r)}))}function SD(e){return Wr((t,r)=>Rt({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError("Value cannot be represented as JSON");return n},catch:()=>new he({expected:"a JSON-serializable value"},t,r)}))}function rT(){return Ee(Jf)}function ky(){return Ee(pD)}function Ay(){return Ee(ig)}function ED(){return Wr((e,t)=>md(ud(au(e)),()=>new he({expected:"a valid Base64 string"},e,t)))}function bD(){return Wr((e,t)=>cn(lD(e),{onFailure:()=>k(new he({expected:"a valid Base64 string"},e,t)),onSuccess:g}))}function ID(){return Wr((e,t)=>cn(Yw(e),{onFailure:()=>k(new he({expected:"a valid Base64Url string"},e,t)),onSuccess:g}))}function CD(){return Wr((e,t)=>cn(dD(e),{onFailure:()=>k(new he({expected:"a valid Base64Url string"},e,t)),onSuccess:g}))}function wD(){return Wr((e,t)=>cn(Qb(e),{onFailure:()=>k(new he({expected:"a valid hexadecimal string"},e,t)),onSuccess:g}))}function TD(){return Wr((e,t)=>cn(gP(e),{onFailure:()=>k(new he({expected:"a valid hexadecimal string"},e,t)),onSuccess:g}))}function kD(){return Ee(encodeURIComponent)}function AD(){return Wr((e,t)=>{try{return g(globalThis.decodeURIComponent(e))}catch{return k(new he({expected:"a valid URI component"},e,t))}})}function vD(){return Ee(e=>FD(Array.from(e.entries())))}var SY=RD(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function OD(){return Ee(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&SY(e).forEach(([n,o])=>{t.append(n,o)}),t})}function _D(){return Ee(e=>FD(Array.from(e.entries())))}var EY=RD(Nn);function PD(){return Ee(e=>typeof e=="object"&&e!==null?new URLSearchParams(EY(e)):new URLSearchParams)}function bY(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>sf(o)?globalThis.Number(o):o)}var IY=20;function FD(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,a])=>{let i=bY(s),c=t;for(let u=0;u<i.length;u++){let f=o.get(c),p=i[u]===""&&f!==void 0?f.length:i[u];f!==void 0&&typeof p=="number"&&(f.length=Math.max(f.length,p+1));let d=Object.hasOwn(c,p),m=d?c[p]:void 0;if(u===i.length-1){let x=o.get(m);if(x!==void 0)z(m,x.length++,a);else if(n.has(m))m.push(a);else if(d){let y=[m,a];n.add(y),z(c,p,y)}else z(c,p,a)}else{let x=i[u+1],y=typeof x=="number"||x==="";if(r.has(m)&&o.has(m)===y)c=m;else{let E={};r.add(E),y&&o.set(E,{parent:c,key:p,length:0}),z(c,p,E),c=E}}}});for(let[s,{key:a,length:i,parent:c}]of Array.from(o).reverse())c[a]===s&&i-Object.keys(s).length<=IY&&z(c,a,Object.assign(new Array(i),s));return t}function RD(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{r.push([o,i])}):s.forEach((i,c)=>{n(`${o}[${c}]`,i)});else if(typeof s=="object"&&s!==null)for(let[a,i]of Object.entries(s))n(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var MD=/^[+-]?\d+$/,oT="~effect/BigDecimal",CY={[oT]:oT,[ae](){let e=aT(this);return xe(De(String(e.value)),Wt(e.scale))},[ie](e){return sT(e)&&BD(this,e)===0},toString(){return`BigDecimal(${Ha(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},sT=e=>O(e,oT),UD=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(CY);return r.value=e,r.scale=t,r},DD=(e,t)=>{let r=UD(e,t);return r.normalized=r,r};var as=BigInt(0),wY=BigInt(1);var TY=BigInt(10),LD=DD(as,0);var aT=e=>{if(e.normalized===void 0)if(e.value===as)e.normalized=LD;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=DD(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var kY=100,AY=[wY],nT=(e,t)=>e===t?0:e<t?-1:1,$D=(e,t)=>{let r=`${e.value<as?-e.value:e.value}`,n=`${t.value<as?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==as)return o<as?-1:1;let s=Math.max(r.length,n.length);return b_(r.padEnd(s,"0"),n.padEnd(s,"0"))},BD=(e,t)=>{if(e.scale===t.scale)return nT(e.value,t.value);let r=ND(e),n=ND(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>kY)return r===-1?$D(t,e):$D(e,t);let a=AY[s]??=TY**BigInt(s);return o>0?nT(e.value,t.value*a):nT(e.value*a,t.value)},Zf=fi(BD);var ND=e=>e.value===as?0:e.value<as?-1:1;var jD=e=>{if(e==="")return v(LD);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!MD.test(c))return A()}else t=e,r=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),u=t.slice(a+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!MD.test(o))return A();let i=s-r;return Number.isSafeInteger(i)?v(UD(BigInt(o),i)):A()};var Ha=e=>{let t=aT(e);if(Math.abs(t.scale)>=16)return vY(t);let r=t.value<as,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,"0"):n.padEnd(n.length-t.scale,"0"),s=o.length-t.scale,a=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${a}`:a},vY=e=>{if(OY(e))return"0e+0";let t=aT(e),r=`${t.value}`,n=t.value<as?2:1,o=r.slice(0,n),s=r.slice(n),a=s.length-t.scale;return`${o}${s===""?"":`.${s}`}e${a>=0?"+":""}${a}`};var OY=e=>e.value===as;var vy=class extends ai{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new vy(this.encode,this.decode)}},em="~effect/SchemaTransformation/Transformation",We=class extends ai{[em]=em;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new We(this.encode,this.decode)}};function _Y(e){return O(e,em)&&e[em]===em}var Oy=e=>_Y(e)?e:new We(e.decode,e.encode);function dr(e){return new We(Wr(e.decode),Wr(e.encode))}function Ne(e){return new We(Ee(e.decode),Ee(e.encode))}function _y(e){return new We(wy(e.decode),wy(e.encode))}function HD(){return new We(xD(),ea())}var PY=new We(ea(),ea());function Qf(){return PY}var Yf=new We(Ty(),iu()),Py=new We(gD(),iu()),iT=new We(tT(),Ee(gb)),qD=new We(tT(),Ee(e=>e.getTime()));var cT=dr({decode:(e,t)=>Le(H$(e),{onNone:()=>k(new he({expected:"a valid ByteSize string"},e,t)),onSome:g}),encode:e=>g(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),WD=dr({decode:(e,t)=>Le(yC(e),{onNone:()=>k(new he({expected:"a non-negative bigint byte count"},e,t)),onSome:g}),encode:e=>g(kx(e))}),VD=dr({decode:(e,t)=>Le(yC(e),{onNone:()=>k(new he({expected:"a non-negative safe-integer byte count"},e,t)),onSome:g}),encode:(e,t)=>Le(W$(e),{onNone:()=>k(new he({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:g})}),FY=e=>Dn(e)&&typeof e.message=="string",GD=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:JD(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(r.name=e.name),typeof e.stack=="string"&&(r.stack=e.stack),r},RY=e=>{try{let t=mc(e);return t===void 0?j(e):JSON.parse(t)}catch{return j(e)}},MY=(e,t,r)=>{let n={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},KD=e=>{let t=new WeakSet,r=n=>{if(DO(n)){if(t.has(n))return"[Circular]";t.add(n);let o=MY(n,e,r);return t.delete(n),o}return RY(n)};return r},JD=e=>FY(e)?GD(e):e,ZD=e=>Ne({decode:GD,encode:t=>KD(e)(t)}),QD=e=>Ne({decode:JD,encode:KD(e)});function YD(){return Ne({decode:Ob,encode:zh})}function XD(){return Ne({decode:ga,encode:Cr})}function e2(e){return Ne({decode:uo,encode:e?.onNoneEncoding===null?zh:Cr})}function t2(){return _y({decode:v,encode:bc})}function r2(){return _y({decode:e=>e.pipe(Ic(Tt),v),encode:bc})}var uT=dr({decode:(e,t)=>URL.canParse(e)?g(new URL(e)):k(new he({expected:"a valid URL string"},e,t)),encode:e=>g(e.href)});var fT=new We(ED(),rT()),n2=new We(bD(),rT()),o2=new We(CD(),ky()),s2=new We(TD(),Ay()),a2=new We(AD(),kD());function i2(e){return new We(yD(e??{}),SD(e))}var c2=new We(vD(),OD()),u2=new We(_D(),PD());function Hi(e){return t=>t._tag===e}var nl=Hi("Declaration");var $Y=Hi("Never");var el=Hi("Literal"),pT=Hi("UniqueSymbol");var ET=Hi("Arrays"),NY=Hi("Objects"),y2=Hi("Union"),S2=Hi("Suspend"),Ot=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},ra={},ta=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},f2="~effect/Schema",Nt=class{[f2]=f2;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},ol=class extends Nt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,i){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=i}getParser(){let e;return(t,r)=>t===we?wn:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=uu(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new ol(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},UY=class extends Nt{_tag="Null";getParser(){return zy(this,null)}getExpected(){return"null"}},bT=new UY;var DY=class extends Nt{_tag="Undefined";getParser(){return zy(this,void 0)}toCodecJson(){return mt(this,[E2])}getExpected(){return"undefined"}},E2=new Ot(bT,new We(Ee(()=>{}),Ee(()=>null))),IT=new DY;var LY=class extends Nt{_tag="Void";getParser(){let e=vr(void 0);return t=>t===we?wn:e}toCodecJson(){return mt(this,[E2])}getExpected(){return"void"}},b2=new LY;var BY=class extends Nt{_tag="Never";getParser(){return us(this,UO)}getExpected(){return"never"}},CT=new BY,jY=class extends Nt{_tag="Any";getParser(){return us(this,cb)}getExpected(){return"any"}},I2=new jY,zY=class extends Nt{_tag="Unknown";getParser(){return us(this,cb)}getExpected(){return"unknown"}},qa=new zY,HY=class extends Nt{_tag="ObjectKeyword";getParser(){return us(this,rp)}getExpected(){return"object | array | function"}},C2=new HY,w2=class extends Nt{_tag="Enum";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s=="number"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${j(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return us(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return mt(this,[new Ot(new kn(Object.keys(e).map(t=>new eo(t))),new We(Ee(t=>e[t]),iu()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function lT(e){return typeof e=="number"?`parts[${e}]`:e}function dT(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${lT(t)}`);let n;switch(e._tag){case"String":case"Number":case"BigInt":n=!0;break;case"Literal":n=!e.checks;break;case"TemplateLiteral":{let o=lT(t);n=!e.checks&&e.parts.every((s,a)=>dT(s,`${o}.parts[${a}]`,r));break}case"Union":{let o=lT(t);n=!e.checks&&e.types.every((s,a)=>dT(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var wT=class extends Nt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],a=[],i=new Set;for(let u=0;u<e.length;u++){let f=e[u];if(!dT(f,u,i))throw new Error(`Invalid TemplateLiteral part ${f._tag}`);s.push(f),a.push(f._tag==="Literal"?globalThis.String(f.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new _o(!1,this.parts.map(DT),[]),r=e(cl(Xn,t,k2(this)));return(n,o)=>{if(n===we)return wn;let s=r(n,o);return s._tag==="Success"?rt:Tr(s,{onSuccess:()=>n,onFailure:a=>new Xt(this,[a],n,o)})}}getExpected(){return"string"}matchPart(e,t){return Y2(this,e,t)===void 0?void 0:e}};function T2(e){let t=No(o=>{if(o._tag!=="Union")return o;let s=uu(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new kn(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new wT(e.map(o=>t(cs(o)))),n=new _o(!1,e.map(DT),[]);return cl(r,n,k2(r))}function k2(e){return new We(Wr((t,r)=>{let n=Y2(e,t,r);return n?g(n):k(new he({expected:"a string matching template literal parts"},t,r))}),Ee(t=>t.join("")))}var A2=class extends Nt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return zy(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return mt(this,[new Ot(e===void 0?CT:new eo(globalThis.String(this.symbol)),tL.transformation)])}getExpected(){return globalThis.String(this.symbol)}},eo=class extends Nt{_tag="Literal";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${j(e)}`);this.literal=e}getParser(){return zy(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?l2(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:l2(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function l2(e){let t=globalThis.String(e.literal);return mt(e,[new Ot(new eo(t),new We(Ee(()=>e.literal),Ee(()=>t)))])}var qY=class extends Nt{_tag="String";getParser(){return us(this,Nn)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&fs(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Xn=new qY,WY=class extends Nt{_tag="Number";getParser(){return us(this,ep)}matchKey(e,t){return this._match(u9,e,t)}matchPart(e,t){return this._match(xT,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:fs(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(mT(this.checks,"effect/schema/isFinite")||mT(this.checks,"effect/schema/isInt"))?this:mt(this,[r9])}toCodecStringTree(){return this.toCodecJson()===this?mt(this,[f9]):mt(this,[l9])}getExpected(){return"number"}};function mT(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&mT(r.checks,t))}var TT=new WY,VY=class extends Nt{_tag="Boolean";getParser(){return us(this,Sh)}getExpected(){return"boolean"}},v2=new VY,GY=class extends Nt{_tag="Symbol";getParser(){return us(this,ib)}matchKey(e,t){return t.disableChecks||!this.checks?e:fs(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return mt(this,[tL])}getExpected(){return"symbol"}},O2=new GY,KY=class extends Nt{_tag="BigInt";getParser(){return us(this,$O)}matchPart(e,t){if(!yT.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:fs(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return mt(this,[d9])}getExpected(){return"bigint"}},_2=new KY,_o=class extends Nt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,i){super(n,o,s,a),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=i;let c=!1;for(let u=0;u<t.length;u++)if(Or(t[u]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<r.length;u++)if(Or(r[u]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,a=Math.max(0,r.rest.length-1);function i(f,p){return p<s?n[p]:p>=f?o[p-f+1]:o[0]}let c=f=>{let{input:p,len:d,options:m}=f;if(r.rest.length===0&&d>s)for(let x=s;x<d;x++){let y=new zw(r,p[x],m),E=new Yt([x],y);if(m.errors==="all")f.issues?f.issues.push(E):f.issues=[E];else return k(new Xt(r,[E],p,m))}return f.issues?k(new Xt(r,f.issues,p,m)):vr(f.output)},u=(f,p)=>{let d=f.length,m={ast:r,getParser:i,input:f,len:d,tailThreshold:Math.max(s,d-a),output:new globalThis.Array(d),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(d,s+a),y=p.concurrency===void 0?1:zp(p.concurrency),E=y===1?ZY(m,f,0,x):QY(m,f,{concurrency:y,end:x});if(!E)return c(m);if(je(E))return Qt(E,()=>c(m));let w=!0;return L(()=>w?(w=!1,I(E,()=>c(m))):u(f,p))};return(f,p)=>{if(f===we)return wn;try{return Array.isArray(f)?(n||(n=r.elements.map(d=>({ast:d,parser:t(d)})),o=r.rest.map(d=>({ast:d,parser:t(d)}))),u(f,p)):k(new $t(r,f,p))}catch(d){return lr(d)}}}_rebuild(e,t,r){let n=uu(this.elements,e),o=uu(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new _o(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function JY(e,t,r,n){if(r._tag==="Failure")return My(e,e.ast,n,r);let o=r===rt?t:r[ge];if(o!==we)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Or(s.ast))return;let a=new Yt([n],new ji(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return Vo(new Xt(e.ast,[a],e.input,e.options))}}var P2={onItem(e,t,r){let n=r<e.len?t:we;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:JY},ZY=jg()(P2),QY=zg()(P2),My=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Jd(n.cause);if(o===void 0)return Vn(Ci(n.cause,a=>new Xt(t,[new Yt([r],a)],e.input,e.options)));let s=new Yt([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Vo(new Xt(t,[s],e.input,e.options))},Ny="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function zi(e,t,r=ra){let n,o;function s(a){switch(a._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter(i=>a.matchPart(i,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter(i=>a.matchKey(i,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>Object.prototype.propertyIsEnumerable.call(e,i)&&a.matchKey(i,r)!==void 0);case"Union":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(UT(cs(t)))}var kT=class{name;type;constructor(e,t){this.name=e,this.type=t}};function F2(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(F2);default:return!1}}function R2(e){let t=al(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(R2);default:return!1}}function YY(e){return F2(e)&&R2(e)}var AT=class{parameter;type;constructor(e,t){if(!YY(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Or(t)&&!Q2(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},tm=class extends Nt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=a}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return us(r,bh);let s,a,i=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),a=o?r.indexSignatures.map(p=>({is:p,parserKey:e(UT(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(E=>typeof E.name=="number"?globalThis.String(E.name):E.name)),d=(E,w,T,M,P)=>{if(P._tag==="Failure")return My(E,r,w,P)??Gt;let h=P===rt?M:P[ge];if(T!==we&&h!==we){if(n&&(p.has(w)||p.has(typeof T=="number"?globalThis.String(T):T)))return Gt;z(E.out,T,h)}return Gt},m=(E,w,T,M)=>{if(!M){let b=T.parserKey(w,E.options);if(!je(b))return I(bo(b),C=>m(E,w,T,C));M=b}if(M._tag==="Failure")return My(E,r,w,M)??Gt;let P=M===rt?w:M[ge],h=E.input[w],S=T.parserValue(h,E.options);return je(S)?d(E,w,P,h,S):I(bo(S),b=>d(E,w,P,h,b))},x=(E,w,T)=>{let M=E.input[w],P=T.parserValue(M,E.options);return je(P)?d(E,w,w,M,P):I(bo(P),h=>d(E,w,w,M,h))},y=o?zg()({onItem:(E,[w,T])=>T.is.parameter===Xn?x(E,w,T):m(E,w,T),step:(E,w,T)=>T._tag==="Failure"?T:void 0}):void 0;return dC(function*(E,w){if(E===we)return we;if(!(typeof E=="object"&&E!==null&&!Array.isArray(E)))return yield*k(new $t(r,E,w));i();let T=E,M={},P={ast:r,input:T,out:M,issues:void 0,options:w},h=w.errors==="all",S=w.onExcessProperty==="error",b=w.concurrency===void 0?1:zp(w.concurrency),C=o&&S?r.indexSignatures.map(_=>zi(T,_.parameter,w)):void 0;if(S){let _=C?new Set(p):p;if(C)for(let H of C)for(let J of H)_.add(J);let $=Reflect.ownKeys(T);for(let H=0;H<$.length;H++){let J=$[H];if(!_.has(J)&&Object.prototype.propertyIsEnumerable.call(T,J)){let Ie=new zw(r,T[J],w),pe=new Yt([J],Ie);if(h){P.issues?P.issues.push(pe):P.issues=[pe];continue}else return yield*k(new Xt(r,[pe],E,w))}}}if(n){let _=b===1?p2(P,s):XY(P,s,{concurrency:b});_&&(yield*_)}if(o&&b===1)for(let _=0;_<o;_++){let $=a[_],H=$.is.parameter===Xn?x:m,J=C?.[_]??($.is.parameter===Xn?Object.keys(T):zi(T,$.is.parameter,w));for(let Ie=0;Ie<J.length;Ie++){let pe=H(P,J[Ie],$);if(!je(pe))yield*pe;else if(pe._tag==="Failure")return yield*pe}}else if(y){let _=Lt();for(let H=0;H<o;H++){let J=a[H],Ie=C?.[H]??(J.is.parameter===Xn?Object.keys(T):zi(T,J.is.parameter,w));for(let pe=0;pe<Ie.length;pe++)_.push([Ie[pe],J])}let $=y(P,_,{concurrency:b});$&&(yield*$)}return P.issues?yield*k(new Xt(r,P.issues,E,w)):M})};if(o)return c();let u,f=(p,d,m)=>{let x=s[d];return I(bo(m),y=>{let E=hT(p,x,y);if(E)return E;let w=()=>vr(p.out),T=p2(p,s.slice(d+1));return T?Qt(T,w):w()})};return(p,d)=>{if(p===we)return wn;if(d.errors==="all"||d.onExcessProperty!==void 0||d.concurrency!==void 0&&zp(d.concurrency)!==1)return(u??=c())(p,d);if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return k(new $t(r,p,d));let m=i(),x=p,y={},E={ast:r,input:x,out:y,issues:void 0,options:d};try{for(let w=0;w<m.length;w++){let T=m[w],M=T.name,P=Xf(x,M),h=P?x[M]:we,S=T.parser(h,d);if(!je(S))return f(E,w,S);if(S===rt){P&&z(y,M,h);continue}let b=hT(E,T,S);if(b)return b}}catch(w){return lr(w)}return vr(y)}}_rebuild(e,t,r,n){let o=uu(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new kT(a.name,i)}),s=uu(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new AT(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new tm(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function hT(e,t,r){if(r._tag==="Failure")return My(e,e.ast,t.name,r);if(r===rt)return;let n=r[ge];if(n!==we){z(e.out,t.name,n);return}if(delete e.out[t.name],!Or(t.type)){let o=new Yt([t.name],new ji(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Vo(new Xt(e.ast,[o],e.input,e.options))}}var M2={onItem(e,t){if(!Xf(e.input,t.name))return t.parser(we,e.options);let r=e.input[t.name];return z(e.out,t.name,r),t.parser(r,e.options)},step:hT},p2=jg()(M2),XY=zg()(M2);function vT(e,t){return e?t?[...e,...t]:e:t}function Uy(e,t,r){return new tm(Reflect.ownKeys(e).map(n=>new kT(n,e[n].ast)),[],r,t)}function rm(e){return e.ast}function OT(e,t=void 0){return new _o(!1,e.map(r=>r.ast),[],void 0,t)}function Dy(e,t,r){return new kn(e.map(rm),t,void 0,r)}function $2(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let a of s.propertySignatures)if(r.some(i=>i.name===a.name))throw new Error(`Duplicate identifier: ${JSON.stringify(a.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=vT(o,s.checks)}return new tm(r,n,void 0,o)}function N2(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new _o(e.isMutable,e.elements,t,void 0,e.checks)}function U2(e){if(e.encoding)throw new Error("mutable does not support encodings");return new _o(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var _T=fc(e=>{for(;;){if(S2(e))return qa;let t=e.encoding;if(!t)return e.recur?.(_T,D)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==D))return qa;e=t[t.length-1].to}});function D2(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(D2)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function tl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[jd];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Or(r)){if(el(r))return[{key:t.name,literal:r.literal}];if(pT(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Or(t)){if(el(t))return[{key:r,literal:t.literal}];if(pT(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>tl(_T(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return tl(e.thunk())}}var d2=new WeakMap,Ry=Object.freeze([]),m2=e=>e===null?"null":Array.isArray(e)?"array":typeof e,Xf=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function nm(e){let t=d2.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let f=0;f<e.length;f++){let p=e[f],d=_T(p);if($Y(d))continue;if(el(d)||pT(d)){s??=new Map;let x=el(d)?d.literal:d.symbol;i[f]=x;let y=s.get(x);y||s.set(x,y=[]),y.push(f)}else a=!1;let m=tl(d);if(m.length){r??=new Map,n++;for(let{key:x,literal:y}of m){let E=r.get(x);E||r.set(x,E=[new Map,new Set]),E[1].add(f);let w=E[0].get(y);w||E[0].set(y,w=new Set),w.add(f)}}else{o??={};let x=D2(d);for(let y of x)(o[y]??=[]).push(f)}}let c={},u=f=>c[f]??=Object.freeze(o?.[f]??Ry);if(a&&s)s.forEach(Object.freeze),t=f=>s.get(f)??Ry;else if(r?.size===1&&!o){let[f,[p]]=r.entries().next().value,d=new Map;for(let[x,y]of p)d.set(x,Object.freeze(Array.from(y)));let m=Object.freeze(e.map((x,y)=>y));t=(x,y)=>{if(rp(x)){let E=Xf(x,f)?x[f]:void 0;if(E!==void 0)return d.get(E)??Ry;if(y)return m}return Ry}}else if(r){let f;for(let p of r)(!f||p[1][0].size>f[1][0].size)&&p[1][1].size===n&&(f=p);t=(p,d)=>{let m=m2(p);if(!rp(p))return u(m);let x=new Set(o?.[m]),y;if(f){let[E,[w]]=f,T=Xf(p,E),M=T?p[E]:void 0;if(T&&(!d||M!==void 0)){let P=w.get(M);if(!P)return u(m);for(let h of P)x.add(h);y=E}}if(y===void 0)for(let[E,[w,T]]of r){let M=Xf(p,E),P=M?p[E]:void 0;if(M&&(!d||P!==void 0)){let h=w.get(P);if(h)for(let S of h)x.add(S)}else if(d)for(let h of T)x.add(h)}for(let[E,[w,T]]of r){if(E===y)continue;let M=Xf(p,E),P=M?p[E]:void 0;if(M&&(!d||P!==void 0)){let h=w.get(P);for(let S of x)T.has(S)&&!h?.has(S)&&x.delete(S)}}return Array.from(x).sort((E,w)=>E-w)}}else t=f=>{let p=u(m2(f));return s?p.filter(d=>i[d]===void 0||i[d]===f):p};return d2.set(e,t),t}var kn=class extends Nt{_tag="Union";types;options;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=a}getParser(e,t){let r=this,n=t!==void 0,o=[],s=i=>o[i]??=e(r.types[i]),a;return(i,c)=>{if(i===we)return wn;let u=(a??=nm(r.types))(i,n);if(u.length===0)return k(new Kd(r,[],i,c));if(u.length===1){let f=s(u[0])(i,c);return f._tag==="Success"?f:je(f)?L2(r,f.cause,i,c):e9(r,f,i,c)}return B2(r,s,u,i,c)}}_rebuild(e,t,r){let n=uu(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new kn(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let r=this.types.map(n=>{let o=cs(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(el);if(s.length>0)return`${g2(o.isMutable)}[ ${s.map(a=>e(a)+x2(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(a=>el(a.type));if(s.length>0)return`{ ${s.map(a=>`${g2(a.type.context?.isMutable)}${Ts(a.name)}${x2(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function L2(e,t,r,n){let o=Jd(t);return o?Vo(new Kd(e,[o],r,n)):Vn(t)}function e9(e,t,r,n){return Ct(t,o=>L2(e,o,r,n))}function B2(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=t9(s,r);if(!a)return s.out?s.out:k(new Kd(e,s.issues??[],n,o));if(je(a))return h2(a,s);let i=!0;return L(()=>i?(i=!1,h2(a,s)):B2(e,t,r,n,o))}function h2(e,t){return Qt(e,r=>t.out===rt?g(t.input):t.out?t.out:k(new Kd(t.ast,t.issues??[],t.input,t.options)))}var t9=jg()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Jd(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Vo(new zU(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return Gt}}}),j2=new kn([new eo("Infinity"),new eo("-Infinity"),new eo("NaN")]);function g2(e){return e?"":"readonly "}function x2(e){return e?"?":""}var PT=class extends Nt{_tag="Suspend";thunk;constructor(e,t,r,n,o){if(r)throw new Error("Cannot add checks to Suspend");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new PT(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},$y=class extends ai{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new $y(this.run,{...this.annotations,...e},this.aborted)}abort(){return new $y(this.run,this.annotations,!0)}and(e,t){return new cu([this,e],t)}},cu=class extends ai{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new cu(this.checks,{...this.annotations,...e})}and(e,t){return new cu([this,e],t)}};function Ly(e,t,r=!1){return new $y((n,o,s)=>qU(o,e(n,o,s),n,s),t,r)}function By(e,t){return new $y((r,n,o)=>e(r)?void 0:new he(void 0,r,o),t,!0)}function FT(e){return Ly(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}var RT=na(TT,[FT()]),r9=new Ot(new kn([RT,j2]),new We(Ty(),Ee(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function om(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return Ly(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:"effect/schema/isPattern",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var gT=new WeakMap;function sm(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&gT.set(r,sl(e)),r}function sl(e){let t=gT.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return gT.set(e,r),r}function mt(e,t){return e.encoding===t?e:sm(e,{encoding:t})}function fu(e,t){if(e.context===t)return e;let r=sl(e);return r.context===t&&r.encoding===e.encoding?r:sm(e,{context:t})}function al(e){return e.encoding?al(e.encoding[e.encoding.length-1].to):e}function is(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return z2(e,Qh(e.checks.slice(0,-1),r.annotate(t)))}return sm(e,{annotations:{...e.annotations,...t}})}function z2(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:sm(e,{checks:t})}function na(e,t){return z2(e,vT(e.checks,t))}function il(e,t){let r=t(e.to);return r===e.to?e:new Ot(r,e.transformation)}function H2(e,t){let r=e,n=r[r.length-1],o=il(n,t);return o===n?e:Qh(e.slice(0,e.length-1),o)}function MT(e){return t=>t.encoding?mt(t,H2(t.encoding,e)):t}function jy(e,t){return MT(r=>fu(r,t))(e)}function lu(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:mt(n,H2(n.encoding,r))}return e(n)}return fc(r)}function q2(e,t){return $T(e,t,zt(e))}function W2(e,t){return $T(cs(e),t,e)}function $T(e,t,r){let n=new Ot(e,t);return mt(r,r.encoding?[...r.encoding,n]:[n])}function uu(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let a=0;a<n;a++)r[a]=e[a];r[n]=s}}return r??e}function am(e,t){let r=e.context?new ta(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new ta(!1,!1,void 0,t);return fu(e,r)}var pu=fc(e=>{let t=e.context?e.context.isOptional===!1?new ta(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new ta(!0,!1);return n9(fu(e,t))}),n9=MT(pu),V2=No(e=>pu(new kn([e,IT]))),NT=fc(e=>{let t=e.context?e.context.isMutable===!1?new ta(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new ta(!1,!0);return o9(fu(e,t))}),o9=MT(NT);function G2(e,t){let r=e.context?new ta(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new ta(!1,!1,t);return fu(e,r)}function cl(e,t,r){return $T(e,r,t)}function s9(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":Eh(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function K2(e,t){let{literals:r,parameters:n}=s9(e);return new tm(r.map(o=>new kT(o,t)),n.map(o=>new AT(o,t)))}function Or(e){return e.context?.isOptional??!1}function J2(e){return e.context?.isMutable??!1}function Z2(e){return e.annotations?.[Cn]===!0||e._tag==="FilterGroup"&&e.checks.every(Z2)}function a9(e){function t(n){return Z2(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Dr(r)?r:void 0}function i9(e){let t=!0;function r(n){return t=t&&!n.encoding&&!S2(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var zt=fc(e=>{let t=sl(e);if(t!==e){let n=zt(t);return n===t&&e.encoding===void 0?e:fu(n,e.context)}let r="recur"in e?e.recur(zt):e;if("encodingChecks"in r&&r.encodingChecks){let n=i9(e)?r.encodingChecks:ET(r)||NY(r)||nl(r)&&r.typeParameters.length>0?a9(r.encodingChecks):void 0;return sm(r,{encodingChecks:void 0,checks:vT(r.checks,n)})}return r}),cs=fc(e=>zt(to(e)));function c9(e,t){let r=t,n=r.length,o=r[n-1],s=[new Ot(to(mt(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new Ot(to(r[i-1].to),r[i].transformation.flip()));let a=to(o.to);return a.encoding?mt(a,[...a.encoding,...s]):mt(a,s)}var to=No(e=>{if(e.encoding)return c9(e,e.encoding);let t=sl(e);if(t!==e){let r=to(t);return r===t?e:fu(r,e.context)}return"flip"in e?e.flip(to):"recur"in e?e.recur(to):e});function Q2(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Q2);default:return!1}}function zy(e,t){let r=t===0?rt:vr(t);return(n,o)=>n===we?wn:n===t?r:k(new $t(e,n,o))}function us(e,t){return(r,n)=>r===we?wn:t(r)?rt:k(new $t(e,r,n))}function Y2(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(u,f){if(u===n.length)return f===s;if(i?.has(u*(s+1)+f))return!1;let p=n[u];if(u===n.length-1){let d=t.slice(f);if(p.matchPart(d,r)!==void 0)return a[u]=d,!0}else if(p._tag==="Literal"){let d=o[u];if(t.startsWith(d,f)&&c(u+1,f+d.length))return a[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],x=m===void 0?d:t.lastIndexOf(m,d);for(;x>=f;){let y=t.slice(f,x);if(p.matchPart(y,r)!==void 0&&c(u+1,x))return a[u]=y,!0;if(x===0)break;x=m===void 0?x-1:t.lastIndexOf(m,x-1)}}return i??=new Set,i.add(u*(s+1)+f),!1}return c(0,0)?a:void 0}var UT=lu(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(UT)}}),Hy=lu(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Hy)}}),DT=lu(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(DT)}}),X2="[\\s\\S]*?",xT=new globalThis.RegExp(`^${Ny}$`),u9=new globalThis.RegExp(`^(?:${Ny}|Infinity|-Infinity|NaN)$`);function LT(e){return om(xT,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:xT.source}),...e})}var eL=na(Xn,[LT()]),f9=new Ot(eL,Yf),l9=new Ot(new kn([eL,j2]),Yf),p9="-?\\d+",yT=new globalThis.RegExp(`^${p9}$`);function BT(e){return om(yT,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:yT.source}),...e})}var jT=na(Xn,[BT({expected:"a string representing a bigint"})]),d9=new Ot(jT,Py),m9="Symbol\\(([\\s\\S]*)\\)",ST=new globalThis.RegExp(`^${m9}$`),h9=na(Xn,[zT()]),tL=new Ot(h9,new We(Ee(e=>globalThis.Symbol.for(ST.exec(e)[1])),Wr((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?g(globalThis.String(e)):k(new Gd({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function zT(e){return om(ST,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:ST.source}),...e})}function fs(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=fs(a.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let i=a.run(t,n,o);if(i){let c=new BU(a,i,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||a.aborted)return r}}}return r}function rL(e,t){let r=fs(e,t,void 0,qa,{errors:"all"});if(r){let n=new Xt(qa,r);return X(n)}return G(t)}function nL(e){if(!nl(e))return;let t=e.annotations?.[Ey];return Un(t)?t(e.typeParameters):void 0}function g9(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function x9(e){return e===void 0||typeof e=="string"}function oL(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}r.set(o,!1),n.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function ul(e){return oL(e,g9)}var rl=new ol([],()=>(e,t,r)=>ul(e)?rt:k(new $t(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>qT}),sL=is(rl,{representation:{id:"effect/schema/MutableJson",payload:null}}),HT=new Ot(rl,Qf()),aL=new Ot(new kn([new _o(!1,[],[rl]),new tm([],[new AT(Xn,rl)])]),Qf());function y9(e){return oL(e,x9)}var S9=new ol([],()=>(e,t,r)=>y9(e)?rt:k(new $t(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),qT=new Ot(S9,Qf());function WT(){return Object.assign(e=>e,{option:e=>v(e),result:e=>G(e),is:e=>!0})}var VT=WT(),GT=WT(),cL="~effect/process/ChildProcessSpawner/ChildProcessHandle",E9={[cL]:cL,...Pt,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},qy=e=>Object.setPrototypeOf({...e},E9),KT=e=>{let t=(n,o)=>e(n).pipe(F(s=>vw(o?.includeStderr===!0?s.all:s.stdout)),en),r=(n,o)=>Ow(t(n,o));return qi.of({spawn:e,exitCode:n=>qs(I(e(n),o=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>hy(r(n,o)),string:(n,o)=>Fw(t(n,o))})},qi=class extends gt()("effect/process/ChildProcessSpawner"){};var JT="~effect/process/ChildProcess",dL={...Os({label:"Command",evaluate(e){return fo(e.context,qi).spawn(this)}}),[JT]:JT},Wy=e=>O(e,JT),b9=e=>e._tag==="StandardCommand",I9=e=>e._tag==="PipedCommand",du=(e,t,r)=>Object.assign(Object.create(dL),{_tag:"StandardCommand",command:e,args:t,options:r}),Vy=(e,t,r={})=>Object.assign(Object.create(dL),{_tag:"PipedCommand",left:e,right:t,options:r}),im=function(...t){if(XT(t[0])){let[s,...a]=t,i=ek(s,a);return du(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!XT(t[0])){let s=t[0];return function(a,...i){let c=ek(a,i);return du(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return du(s,[],a)}let[r,n=[],o={}]=t;return du(r,n,o)},C9=l(e=>Wy(e[0])&&Wy(e[1]),(e,t,r)=>Vy(e,t,r??{})),w9=function(...t){if(Wy(t[0])&&t.length>1){let[n,...o]=t,s=uL(o);return ZT(n,s)}let r=uL(t);return n=>ZT(n,r)},uL=e=>{if(XT(e[0])){let[n,...o]=e,s=ek(n,o);return{command:s[0]??"",args:s.slice(1)}}let[t,r=[]]=e;return{command:t,args:r}},ZT=(e,t)=>{switch(e._tag){case"StandardCommand":return du(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return Vy(ZT(e.left,t),e.right,e.options)}},QT=l(2,(e,t)=>{switch(e._tag){case"StandardCommand":return du(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return Vy(QT(e.left,t),QT(e.right,t),e.options)}}),YT=l(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let r=e.options.env===void 0?t:{...e.options.env,...t};return du(e.command,e.args,{...e.options,env:r})}case"PipedCommand":return Vy(YT(e.left,t),YT(e.right,t),e.options)}}),XT=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),cm=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},tk=e=>`fd${e}`,ek=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=T9(e,t,r,o,n);return r},T9=(e,t,r,n,o)=>{let s=e.raw[o];if(s===void 0)throw new Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:a,hasTrailingWhitespace:i,tokens:c}=A9(n,s),u=pL(r,c,a);if(o===t.length)return u;let f=t[o],p=Array.isArray(f)?f.map(d=>fL(d)):[fL(f)];return pL(u,p,i)},fL=e=>typeof e==="string"?e:String(e),lL=new Set([" "," ","\r",`
|
|
31
|
-
`]),
|
|
32
|
-
`)a-=1,i+=1;else if(u==="u"&&t[i+2]==="{"){let f=t.indexOf("}",i+3);parseInt(t.slice(i+3,f),16)>65535&&(a+=1),i=f}else i+=k9[u]??1}}let s=o===e.length;return s||n.push(e.slice(o)),{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},pL=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];import*as Gy from"node:child_process";import{PassThrough as rk}from"node:stream";var mL=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var Qe=(e,t)=>(r,[n])=>{let o="Unknown";switch(r.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return Zn({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var fl=e=>mw(tw(v9(e),t=>[t])),v9=e=>Oe(t=>{let r=e.evaluate();return g(O9({...e,writable:r,pull:t}))}),O9=e=>e.pull.pipe(I(t=>{let r=0;return fr(n=>{let o=!1,s=()=>{for(;r<t.length;){if(o)return;if(!e.writable.write(t[r++],e.encoding)){o||e.writable.once("drain",s);return}}o||n(W)};return s(),U(()=>{o=!0,e.writable.off("drain",s)})})}),vt({disableYield:!0}),e.endOnDone!==!1?ze(t=>"closed"in e.writable&&e.writable.closed?ee(t):fr(r=>{let n=()=>r(ee(t));return e.writable.once("finish",n),e.writable.end(),U(()=>{e.writable.off("finish",n)})})):D,Hs(fr(t=>{let r=n=>t(k(e.onError(n)));return e.writable.once("error",r),U(()=>{e.writable.off("error",r)})})));var ll=e=>R(P9(e)),P9=e=>Oe((t,r)=>F9({scope:r,readable:e.evaluate(),onError:e.onError??R9,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var F9=e=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??Ui(void 0),o=e.latch??zr(!1);function s(){o.openUnsafe()}function a(u){n.current=Vo(e.onError(u)),o.openUnsafe()}function i(){n.current=Vo(Vp()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=L(function u(){let f=e.readable.read(e.chunkSize);if(f===null)return n.current?n.current:t.readableEnded?k(Vp()):(o.closeUnsafe(),I(o.await,u));let p=Ae(f);for(;f=e.readable.read(e.chunkSize),f!==null;)p.push(f);return g(p)});return at(cr(e.scope,U(()=>{t.off("readable",s),t.off("error",a),t.off("end",i),r&&"closed"in e.readable&&!e.readable.closed&&e.readable.destroy()})),c)};var R9=e=>new gM(e);var mu=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),oa=(e,t,r)=>{let{commands:n}=EL(r),o=n.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Qe("ChildProcess",e)(t,[o])},hL=1e3,$9=10,gL=e=>{let t=()=>{};e.on("error",t),e.once("close",()=>e.off("error",t))},xL=(e,t)=>{if(!b0(t))return!0;if(globalThis.process.platform==="win32")return!1;try{return globalThis.process.kill(-e.pid,0),!0}catch{return!1}},yL=(e,t=()=>{})=>{if(e.exitCode!==null||e.signalCode!==null){t(null);return}Gy.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t)},N9=tt(function*(){let e=yield*os,t=yield*Ys,r=N(function*(h){if(!ii(h.cwd))return yield*e.access(h.cwd),t.resolve(h.cwd)}),n=h=>h.extendEnv?{...globalThis.process.env,...h.env}:h.env,o=h=>ve(h)?"pipe":h,s=h=>vd(h)?"pipe":h,a=h=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};return ii(h.stdin)?S:typeof h.stdin=="string"?{...S,stream:h.stdin}:ve(h.stdin)?{...S,stream:h.stdin}:{stream:h.stdin.stream,encoding:h.stdin.encoding??S.encoding,endOnDone:h.stdin.endOnDone??S.endOnDone}},i=(h,S)=>{let b=h[S];return ii(b)?{stream:"pipe"}:typeof b=="string"?{stream:b}:vd(b)?{stream:b}:{stream:b.stream}},c=h=>{if(ii(h.additionalFds))return[];let S=[];for(let[b,C]of Object.entries(h.additionalFds)){let _=cm(b);Tt(_)&&S.push({fd:_,config:C})}return S.sort((b,C)=>b.fd-C.fd)},u=(h,S,b,C)=>{let _=[o(h.stream),s(S.stream),s(b.stream)];if(C.length===0)return _;let $=C.reduce((H,{fd:J})=>Math.max(H,J),2);for(let H=3;H<=$;H++)_[H]="ignore";for(let{fd:H}of C)_[H]="pipe";return _},f=N(function*(h,S,b){if(b.length===0)return{getInputFd:()=>_d,getOutputFd:()=>gn};let C=new Map,_=new Map;for(let{config:$,fd:H}of b){let J=S.stdio[H];switch($.type){case"input":{let Ie=_d;J&&"write"in J&&(gL(J),Ie=fl({evaluate:()=>J,onError:pe=>oa(`fromWritable(fd${H})`,mu(pe),h)})),$.stream&&(yield*Ma(my($.stream,Ie))),C.set(H,Ie);break}case"output":{let Ie=gn;if(J&&"read"in J){let pe=new rk;J.on("error",_e=>pe.destroy(_e)),J.pipe(pe),Ie=ll({evaluate:()=>pe,onError:_e=>oa(`fromReadable(fd${H})`,mu(_e),h)})}$.sink&&(Ie=Bd(Ie,$.sink)),_.set(H,Ie);break}}}return{getInputFd:$=>C.get($)??_d,getOutputFd:$=>_.get($)??gn}}),p=(h,S,b)=>L(()=>{let C=_d;return tp(S.stdin)&&(gL(S.stdin),C=fl({evaluate:()=>S.stdin,onError:_=>oa("fromWritable(stdin)",mu(_),h),endOnDone:b.endOnDone,encoding:b.encoding})),ve(b.stream)?at(Ma(my(b.stream,C)),C):g(C)}),d=(h,S,b,C)=>{let _=S.stdout?(()=>{let J=new rk;return S.stdout.on("error",Ie=>J.destroy(Ie)),S.stdout.pipe(J),ll({evaluate:()=>J,onError:Ie=>oa("fromReadable(stdout)",mu(Ie),h)})})():gn,$=S.stderr?(()=>{let J=new rk;return S.stderr.on("error",Ie=>J.destroy(Ie)),S.stderr.pipe(J),ll({evaluate:()=>J,onError:Ie=>oa("fromReadable(stderr)",mu(Ie),h)})})():gn;vd(b.stream)&&(_=Bd(_,b.stream)),vd(C.stream)&&($=Bd($,C.stream));let H=Dd(_,$);return{stdout:_,stderr:$,all:H}},m=(h,S)=>fr(b=>{let C=Aa(),_=Gy.spawn(h.command,h.args,S);return _.on("error",$=>{b(k(oa("spawn",$,h)))}),_.on("exit",(...$)=>{xo(C,Zr($))}),_.on("spawn",()=>{b(g([_,C]))}),U(()=>{_.kill("SIGTERM")})}),x=(h,S,b)=>globalThis.process.platform==="win32"?fr(C=>{yL(S,_=>{C(_?k(oa("kill",mu(_),h)):W)})}):Rt({try:()=>{globalThis.process.kill(-S.pid,b)},catch:C=>oa("kill",mu(C),h)}),y=(h,S)=>{if(globalThis.process.platform==="win32"){yL(h);return}try{globalThis.process.kill(-h.pid,S)}catch{}},E=(h,S,b)=>L(()=>{if(!S.kill(b)){let _=new globalThis.Error("Failed to kill child process");return k(oa("kill",_,h))}return W}),w=(h,S,b)=>fr(C=>{let _=Date.now()+b,$,H=()=>{clearTimeout($),h.removeListener("exit",J)},J=()=>{if(clearTimeout($),Date.now()>=_||!xL(h,S)){H(),C(W);return}$=setTimeout(J,$9)};return h.on("exit",J),J(),U(H)}),T=N(function*(h,S,b,C){let _=$=>x(h,S,$).pipe(Jo(()=>E(h,S,$)));yield*_(C?.killSignal??"SIGTERM"),ii(C?.forceKillAfter)?yield*w(S,b,hL):(yield*w(S,b,Lr(C.forceKillAfter)),xL(S,b)&&(yield*_("SIGKILL"),yield*w(S,b,hL))),yield*wi(b)}),M=(h,S)=>{let b=S??"stdout";switch(b){case"stdout":return h.stdout;case"stderr":return h.stderr;case"all":return h.all;default:{let C=cm(b);return Tt(C)?h.getOutputFd(C):h.stdout}}},P=N(function*(h){switch(h._tag){case"StandardCommand":{let S=a(h.options),b=i(h.options,"stdout"),C=i(h.options,"stderr"),_=c(h.options),$=!0,H=yield*r(h.options),J=n(h.options),Ie=u(S,b,C,_),[pe,_e]=yield*Qr(m(h,mL(h.options,{cwd:H,env:J,stdio:Ie},process.platform)),N(function*([Mn,cc]){if(yield*E0(cc)){let[PO]=yield*wi(cc);PO!==0&&tp(PO)?yield*Pf(T(h,Mn,cc,h.options)):$&&process.platform!=="win32"&&h.options.detached!==!1&&(yield*Pf(T(h,Mn,cc,h.options)));return}$&&(yield*Pf(T(h,Mn,cc,h.options)))})),Je=GT(pe.pid);pe.on("exit",Mn=>{Mn!==0&&tp(Mn)&&y(pe,h.options.killSignal??"SIGTERM")});let _t=U(()=>{$||(pe.ref(),$=!0)}),Dt=U(()=>($&&(pe.unref(),$=!1),_t)),xn=yield*p(h,pe,S),{all:so,stderr:la,stdout:Zl}=d(h,pe,b,C),{getInputFd:GV,getOutputFd:KV}=yield*f(h,pe,_),JV=F(E0(_e),Mn=>!Mn),ZV=I(wi(_e),([Mn,cc])=>{if(tp(Mn))return g(VT(Mn));let _O=new globalThis.Error(`Process interrupted due to receipt of signal: '${cc}'`);return k(oa("exitCode",_O,h))});return qy({pid:Je,exitCode:ZV,isRunning:JV,kill:Mn=>T(h,pe,_e,Mn),stdin:xn,stdout:Zl,stderr:la,all:so,getInputFd:GV,getOutputFd:KV,unref:Dt})}case"PipedCommand":{let{commands:S,pipeOptions:b}=EL(h),[C,..._]=S,$=[yield*P(C)];for(let pe=0;pe<_.length;pe++){let _e=_[pe],Je=b[pe]??{},_t=a(_e.options),Dt=en(g(M($[$.length-1],Je.from))),xn=Je.to??"stdin";if(xn==="stdin")$.push(yield*P(im(_e.command,_e.args,{..._e.options,stdin:{..._t,stream:Dt}})));else{let so=cm(xn);if(Tt(so)){let la=tk(so),Zl=_e.options.additionalFds??{};$.push(yield*P(im(_e.command,_e.args,{..._e.options,additionalFds:{...Zl,[la]:{type:"input",stream:Dt}}})))}else $.push(yield*P(im(_e.command,_e.args,{..._e.options,stdin:{..._t,stream:Dt}})))}}let H=$[$.length-1],J=pe=>Eo([...$].reverse(),_e=>Pf(_e.kill(pe)),{discard:!0}),Ie=tt(function*(){let pe=[];for(let _e of $)pe.push(yield*_e.unref);return Eo([...pe].reverse(),_e=>_e,{discard:!0})});return qy({pid:H.pid,exitCode:H.exitCode,isRunning:H.isRunning,kill:J,stdin:$[0].stdin,stdout:H.stdout,stderr:H.stderr,all:H.all,getInputFd:H.getInputFd,getOutputFd:H.getOutputFd,unref:Ie})}}});return KT(P)}),SL=wf(qi,N9),EL=e=>{let t=[],r=[],n=i=>{switch(i._tag){case"StandardCommand":{t.push(i);break}case"PipedCommand":{n(i.left),r.push(i.options),n(i.right);break}}};if(n(e),t.length===0)throw new Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:r}};var bL="0123456789ABCDEFGHJKMNPQRSTVWXYZ",IL=(e,t)=>{if(t.length!==10)throw new Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let r=Math.min(Math.max(0,Math.trunc(e)),0xffffffffffff),n="";for(let a=45;a>=0;a-=5)n+=bL[Math.floor(r/2**a)&31];let o=0,s=0;for(let a of t){for(o=o<<8|a,s+=8;s>=5;)s-=5,n+=bL[o>>>s&31];o&=(1<<s)-1}return n};var D9=e=>e.toString(16).padStart(2,"0"),nk=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(r=>Array.from(r,D9).join("")).join("-"),CL=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function wL(e=CL()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var L9=2**48-1;function TL(e,t=CL()){let r=Math.min(Math.max(0,Math.trunc(e)),L9);return t[0]=Math.floor(r/2**40),t[1]=Math.floor(r/2**32)&255,t[2]=Math.floor(r/2**24)&255,t[3]=Math.floor(r/2**16)&255,t[4]=Math.floor(r/2**8)&255,t[5]=r&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var kL="~effect/Crypto",ok=gt("effect/Crypto"),AL=e=>{let t=e.randomBytes,r=a=>F(j9("randomBytes",a),t),n=a=>(a[0]&31)*2**48+a[1]*2**40+a[2]*2**32+a[3]*2**24+a[4]*2**16+a[5]*2**8+a[6],o=()=>n(t(7))/2**53,s=()=>{for(;;){let a=t(7),i=n(a);if((a[0]&32)===0)return i+Number.MIN_SAFE_INTEGER;if(i<Number.MAX_SAFE_INTEGER)return i+1}};return ok.of({[kL]:kL,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:U(()=>o()),randomBoolean:U(()=>o()>.5),randomInt:U(()=>s()),randomBetween:(a,i)=>U(()=>o$(a,i,o())),randomIntBetween(a,i,c){let u=c?.halfOpen===!0?0:1;return U(()=>{let f=Math.ceil(a),p=Math.floor(i);return Math.floor(o()*(p-f+u))+f})},randomShuffle:a=>U(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let u=Math.min(c,Math.floor(o()*(c+1))),f=i[c];i[c]=i[u],i[u]=f}return i}),randomUUIDv4:a=>U(()=>{let i=wL(t(16));return a?.format==="bytes"?i:nk(i)}),randomUUIDv7:a=>Gs(i=>{let c=TL(i.currentTimeMillisUnsafe(),t(16));return g(a?.format==="bytes"?c:nk(c))}),randomULID:Gs(a=>g(IL(a.currentTimeMillisUnsafe(),t(10))))})},j9=(e,t)=>Number.isSafeInteger(t)&&t>=0?g(t):k(Co({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as Ky from"node:crypto";var z9=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},H9=(e,t)=>Rt({try:()=>Uint8Array.from(Ky.createHash(z9(e)).update(t).digest()),catch:r=>Zn({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),q9=AL({randomBytes:Ky.randomBytes,digest:H9}),OL=Bs(ok,q9);var _L=OL;import*as ML from"node:crypto";import*as re from"node:fs";import*as $L from"node:os";import*as Va from"node:path";var nt=e=>t=>Co({module:"FileSystem",method:e,description:t.message??String(t)}),NL=(e,t)=>{let r=Number(e);if(!Number.isSafeInteger(r))throw new RangeError(`${t} exceeds the safe integer range: ${e}`);return r},PL=e=>Ps(uo(e),Tx),UL=e=>BigInt.asUintN(64,e),sk=e=>rr(uo(e),UL),FL=(e,t)=>Rt({try:()=>NL(e,"position"),catch:nt(t)}),G9=(()=>{let e=St(re.access,Qe("FileSystem","access"),nt("access"));return(t,r)=>{let n=re.constants.F_OK;return r?.readable&&(n|=re.constants.R_OK),r?.writable&&(n|=re.constants.W_OK),e(t,n)}})(),K9=(()=>{let e=St(re.cp,Qe("FileSystem","copy"),nt("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),J9=(()=>{let e=St(re.copyFile,Qe("FileSystem","copyFile"),nt("copyFile"));return(t,r)=>e(t,r)})(),Z9=(()=>{let e=St(re.chmod,Qe("FileSystem","chmod"),nt("chmod"));return(t,r)=>e(t,r)})(),Q9=(()=>{let e=St(re.chown,Qe("FileSystem","chown"),nt("chown"));return(t,r,n)=>e(t,r,n)})(),Y9=(()=>{let e=St(re.glob,Qe("FileSystem","glob"),nt("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),X9=(()=>{let e=St(re.link,Qe("FileSystem","link"),nt("link"));return(t,r)=>e(t,r)})(),e7=(()=>{let e=St(re.mkdir,Qe("FileSystem","makeDirectory"),nt("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),ak=e=>{let t=St(re.mkdtemp,Qe("FileSystem",e),nt(e));return r=>L(()=>{let n=r?.prefix??"",o=typeof r?.directory=="string"?Va.join(r.directory,"."):$L.tmpdir();return t(n?Va.join(o,n):o+"/")})},t7=ak("makeTempDirectory"),ik=e=>{let t=St(re.rm,Qe("FileSystem",e),nt(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},r7=ik("remove"),n7=(()=>{let e=ak("makeTempDirectoryScoped"),t=ik("makeTempDirectoryScoped");return r=>Qr(e(r),n=>Pa(t(n,{recursive:!0})))})(),o7=e=>{let{O_APPEND:t,O_CREAT:r,O_EXCL:n,O_RDONLY:o,O_RDWR:s,O_TRUNC:a,O_WRONLY:i}=re.constants;switch(e){case"r":return o;case"r+":return s;case"w":return a|r|i;case"wx":return a|r|i|n;case"w+":return a|r|s;case"wx+":return a|r|s|n;case"a":return t|r|i;case"ax":return t|r|i|n;case"a+":return t|r|s;case"ax+":return t|r|s|n}},s7=(e,t)=>L(()=>{let{O_NOFOLLOW:r}=re.constants;return process.platform==="win32"||typeof r!="number"||r===0?k(Co({module:"FileSystem",method:e,description:"noFollow is not supported on this platform"})):g(o7(t)|r)}),a7=e=>{let t=St(re.open,Qe("FileSystem",e),nt(e)),r=St(re.close,Qe("FileSystem",e),nt(e));return(n,o)=>Is(Qr(o?.noFollow===!0?I(s7(e,o.flag??"r"),s=>t(n,s,o.mode)):t(n,o?.flag??"r",o?.mode),s=>Pa(r(s))),F(s=>c7(s,o?.flag?.startsWith("a")??!1)))},i7=a7("open"),RL=e=>Co({module:"FileSystem",method:e,description:"Cannot read before the start of the file"}),c7=(()=>{let e=f=>St(re.read,Qe("FileSystem",f),nt(f)),t=e("read"),r=e("readAlloc"),n=St(re.fstat,Qe("FileSystem","stat"),nt("stat")),o=St(re.ftruncate,Qe("FileSystem","truncate"),nt("truncate")),s=St(re.fsync,Qe("FileSystem","sync"),nt("sync")),a=f=>St(re.write,Qe("FileSystem",f),nt(f)),i=a("write"),c=a("writeAll");class u{[Wf];fd;append;position=BigInt(0);constructor(p,d){this[Wf]=Wf,this.fd=p,this.append=d}get stat(){return I(n(this.fd,{bigint:!0}),LL)}get sync(){return s(this.fd)}seek(p,d){return L(()=>{let m=d==="start"?p:this.position+p;return m<BigInt(0)?k(Co({module:"FileSystem",method:"seek",description:"Cannot seek before the start of the file"})):(this.position=m,g(m))})}read(p,d){return L(()=>{let m=d?.position;if(m!==void 0)return m<BigInt(0)?k(RL("read")):t(this.fd,{buffer:p,position:m});let x=this.position;return F(t(this.fd,{buffer:p,position:x}),y=>(this.position=x+BigInt(y),y))})}readAlloc(p,d){return L(()=>{try{if(!Number.isInteger(p)||p<0)throw new RangeError("size must be a non-negative integer");let m=d?.position;if(m!==void 0&&m<BigInt(0))return k(RL("readAlloc"));let x=Buffer.allocUnsafeSlow(p),y=m??this.position;return F(r(this.fd,{buffer:x,position:y}),E=>{if(E===0)return A();if(m===void 0&&(this.position=y+BigInt(E)),E===p)return v(x);let w=Buffer.allocUnsafeSlow(E);return x.copy(w,0,0,E),v(w)})}catch(m){return k(nt("readAlloc")(m))}})}truncate(p){return F(o(this.fd,p||void 0),()=>{if(!this.append){let d=BigInt(p??0);this.position>d&&(this.position=d)}})}write(p){return L(()=>{let d=this.position;return I(this.append?g(void 0):FL(d,"write"),m=>F(i(this.fd,p,void 0,void 0,m),x=>(this.append||(this.position=d+BigInt(x)),x)))})}writeAllChunk(p){return L(()=>{let d=this.position;return I(this.append?g(void 0):FL(d,"writeAll"),m=>I(c(this.fd,p,void 0,void 0,m),x=>x===0?k(Zn({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=d+BigInt(x)),x<p.length?this.writeAllChunk(p.subarray(x)):W)))})}writeAll(p){return p.length===0?W:this.writeAllChunk(p)}}return(f,p)=>new u(f,p)})(),DL=e=>{let t=ak(e);return N(function*(r){let n=yield*t(r),o=ML.randomBytes(6).toString("hex"),s=Va.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*BL(s,new Uint8Array(0)),s})},u7=DL("makeTempFile"),f7=(()=>{let e=DL("makeTempFileScoped"),t=ik("makeTempFileScoped");return r=>Qr(e(r),n=>Pa(t(Va.dirname(n),{recursive:!0})))})(),l7=(e,t)=>vi({try:()=>re.promises.readdir(e,t),catch:r=>Qe("FileSystem","readDirectory")(r,[e])}),p7=e=>fr((t,r)=>{try{re.readFile(e,{signal:r},(n,o)=>{t(n?k(Qe("FileSystem","readFile")(n,[e])):g(o))})}catch(n){t(k(nt("readFile")(n)))}}),d7=(()=>{let e=St(re.readlink,Qe("FileSystem","readLink"),nt("readLink"));return t=>e(t)})(),m7=(()=>{let e=St(re.realpath,Qe("FileSystem","realPath"),nt("realPath"));return t=>e(t)})(),h7=(()=>{let e=St(re.rename,Qe("FileSystem","rename"),nt("rename"));return(t,r)=>e(t,r)})(),LL=e=>Rt({try:()=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:uo(e.mtime),atime:uo(e.atime),birthtime:uo(e.birthtime),dev:UL(e.dev),rdev:sk(e.rdev),ino:sk(e.ino),mode:NL(e.mode,"mode"),nlink:sk(e.nlink),uid:PL(e.uid),gid:PL(e.gid),size:xd(e.size),blksize:e.blksize!==void 0?v(xd(e.blksize)):A(),blocks:uo(e.blocks)}),catch:nt("stat")}),ck=(()=>{let e=St(re.stat,Qe("FileSystem","stat"),nt("stat"));return t=>I(e(t,{bigint:!0}),LL)})(),g7=(()=>{let e=St(re.symlink,Qe("FileSystem","symlink"),nt("symlink"));return(t,r)=>e(t,r)})(),x7=(()=>{let e=St(re.truncate,Qe("FileSystem","truncate"),nt("truncate"));return(t,r)=>e(t,r)})(),y7=(()=>{let e=St(re.utimes,Qe("FileSystem","utime"),nt("utime"));return(t,r,n)=>e(t,r,n)})(),S7=(e,t,r)=>ly(n=>Qr(U(()=>{let o=t.type==="Directory"?e:Va.dirname(e),s=re.watch(e,{recursive:r?.recursive??!1},(a,i)=>{if(i)switch(a){case"rename":{Yo(oC(ck(Va.resolve(o,i)),{onSuccess:c=>Yr(n,{_tag:"Create",path:i}),onFailure:c=>Yr(n,{_tag:"Remove",path:i})}));return}case"change":{Da(n,{_tag:"Update",path:i});return}}});return s.on("error",a=>{Js(n,fM(Zn({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:a})))}),s.on("close",()=>{wo(n)}),s}),o=>U(()=>o.close())).pipe(jr(()=>U(()=>r?.onReady?.())))),E7=(e,t,r)=>dx([ck(t),Ff(qf)]).pipe(F(([n,o])=>vb(o,()=>e).pipe(Ps(s=>s.register(t,n,r)),Ft(()=>S7(t,n,r)))),en),BL=(e,t,r)=>fr((n,o)=>{try{re.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},s=>{n(s?k(Qe("FileSystem","writeFile")(s,[e])):W)})}catch(s){n(k(nt("writeFile")(s)))}}),b7=F(Ff(qf),e=>$w({access:G9,chmod:Z9,chown:Q9,copy:K9,copyFile:J9,glob:Y9,link:X9,makeDirectory:e7,makeTempDirectory:t7,makeTempDirectoryScoped:n7,makeTempFile:u7,makeTempFileScoped:f7,open:i7,readDirectory:l7,readFile:p7,readLink:d7,realPath:m7,remove:r7,rename:h7,stat:ck,symlink:g7,truncate:x7,utimes:y7,watch(t,r){return E7(e,t,r)},writeFile:BL})),jL=wf(os)(b7);var zL=jL;import*as um from"node:path";import*as Jy from"node:url";var uk=e=>({fromFileUrl:t=>Rt({try:()=>Jy.fileURLToPath(t,{windows:e}),catch:r=>new Nf({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:t=>Rt({try:()=>Jy.pathToFileURL(t,{windows:e}),catch:r=>new Nf({module:"Path",method:"toFileUrl",cause:r})})}),w7=Bs(Ys)(yy({...um.posix,...uk(!1)})),T7=Bs(Ys)(yy({...um.win32,...uk(!0)})),HL=Bs(Ys)(yy({...um,...uk(void 0)}));var qL=HL;var fk="~effect/Stdio",Zy=gt(fk),WL=e=>({[fk]:fk,stdinIsTerminal:g(!1),stdoutIsTerminal:g(!1),stderrIsTerminal:g(!1),...e});var VL=Bs(Zy,WL({args:U(()=>process.argv.slice(2)),stdinIsTerminal:U(()=>process.stdin.isTTY===!0),stdoutIsTerminal:U(()=>process.stdout.isTTY===!0),stderrIsTerminal:U(()=>process.stderr.isTTY===!0),stdout:e=>fl({evaluate:()=>process.stdout,onError:t=>Zn({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>fl({evaluate:()=>process.stderr,onError:t=>Zn({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:ll({evaluate:()=>process.stdin,onError:e=>Zn({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var GL=VL;var ke={};$n(ke,{Any:()=>cre,Array:()=>Pe,ArrayEnsure:()=>Sre,BigDecimal:()=>vH,BigDecimalFromString:()=>Qne,BigInt:()=>_l,BigIntFromString:()=>Nne,Boolean:()=>HS,BooleanFromBit:()=>Hne,BooleanLiterals:()=>XA,ByteSize:()=>YS,ByteSizeFromBigInt:()=>Xne,ByteSizeFromNumber:()=>eoe,ByteSizeFromString:()=>Yne,Cause:()=>GA,CauseReason:()=>VA,Char:()=>Ine,Chunk:()=>toe,Class:()=>Iq,Cookie:()=>yq,Cookies:()=>Sq,Date:()=>Rl,DateFromMillis:()=>One,DateFromString:()=>vne,DateTimeUtc:()=>XS,DateTimeUtcFromDate:()=>ioe,DateTimeUtcFromMillis:()=>uoe,DateTimeUtcFromString:()=>coe,DateTimeZoned:()=>WH,DateTimeZonedFromString:()=>doe,Defect:()=>iv,DnsARecord:()=>aq,DnsAaaaRecord:()=>iq,DnsCaaRecord:()=>cq,DnsCnameRecord:()=>uq,DnsMxRecord:()=>fq,DnsNaptrRecord:()=>lq,DnsNsRecord:()=>pq,DnsPtrRecord:()=>dq,DnsRecord:()=>use,DnsRecordType:()=>cse,DnsSoaRecord:()=>mq,DnsSrvRecord:()=>hq,DnsTlsaRecord:()=>gq,DnsTxtRecord:()=>xq,DomainName:()=>ri,DomainNameFromString:()=>tq,Duration:()=>Gm,DurationFromMillis:()=>ise,DurationFromNanos:()=>ase,DurationFromString:()=>sse,Enum:()=>are,Error:()=>tE,ErrorInstance:()=>Cne,Exit:()=>fse,FalseLiterals:()=>JS,File:()=>EH,Finite:()=>Fl,FiniteFromString:()=>$ne,FormData:()=>bH,Graph:()=>mse,HashMap:()=>hse,HashSet:()=>gse,Headers:()=>bse,Host:()=>Qoe,HostFromString:()=>Yoe,HostPort:()=>nq,HostPortFromString:()=>Xoe,InetAddress:()=>XH,InetAddressFromString:()=>Koe,InetAddressV4:()=>Voe,InetAddressV6:()=>Goe,Int:()=>On,IpAddress:()=>tc,IpAddressFromString:()=>Pu,IpInterface:()=>JH,IpInterfaceFromString:()=>zoe,IpLinkLocalAddress:()=>voe,IpLinkLocalAddressFromString:()=>Ooe,IpLoopbackAddress:()=>koe,IpLoopbackAddressFromString:()=>Aoe,IpMulticastAddress:()=>moe,IpMulticastAddressFromString:()=>hoe,IpNetwork:()=>YH,IpNetworkFromString:()=>Woe,IpUnicastAddress:()=>yoe,IpUnicastAddressFromString:()=>Soe,IpUnspecifiedAddress:()=>_oe,IpUnspecifiedAddressFromString:()=>Poe,Ipv4Address:()=>Vm,Ipv4AddressFromString:()=>fv,Ipv4BroadcastAddress:()=>Ioe,Ipv4BroadcastAddressFromString:()=>Coe,Ipv4Interface:()=>GH,Ipv4InterfaceFromString:()=>Boe,Ipv4Network:()=>ZH,Ipv4NetworkFromString:()=>Hoe,Ipv4PrivateAddress:()=>Foe,Ipv4PrivateAddressFromString:()=>Roe,Ipv6Address:()=>eE,Ipv6AddressFromString:()=>VH,Ipv6Interface:()=>KH,Ipv6InterfaceFromString:()=>joe,Ipv6Network:()=>QH,Ipv6NetworkFromString:()=>qoe,Ipv6UniqueLocalAddress:()=>Moe,Ipv6UniqueLocalAddressFromString:()=>$oe,Json:()=>rE,JsonFromUrlParamsField:()=>Ise,JsonObject:()=>Jse,Literal:()=>Ht,Literals:()=>ti,MacAddress:()=>_u,MacAddressFromString:()=>Ml,MacBroadcastAddress:()=>woe,MacBroadcastAddressFromString:()=>Toe,MacLocallyAdministeredAddress:()=>Noe,MacLocallyAdministeredAddressFromString:()=>Uoe,MacMulticastAddress:()=>goe,MacMulticastAddressFromString:()=>xoe,MacUnicastAddress:()=>Eoe,MacUnicastAddressFromString:()=>boe,MacUniversallyAdministeredAddress:()=>Doe,MacUniversallyAdministeredAddressFromString:()=>Loe,MutableJson:()=>Qse,Natural:()=>ku,Never:()=>ire,NonEmptyArray:()=>WS,NonEmptyString:()=>av,Null:()=>zS,NullOr:()=>YA,NullishOr:()=>Jz,Number:()=>Lm,NumberFromString:()=>Mne,ObjectKeyword:()=>lre,Opaque:()=>Fre,Option:()=>Fu,OptionFromNullOr:()=>xse,OptionFromNullishOr:()=>Sse,OptionFromOptional:()=>Tse,OptionFromOptionalKey:()=>wse,OptionFromOptionalNullOr:()=>kse,OptionFromUndefinedOr:()=>yse,Port:()=>ese,PropertyKey:()=>WA,ReadonlyMap:()=>wne,ReadonlySet:()=>Tne,Record:()=>vu,RecordFromCookies:()=>Ese,RecordFromUrlParams:()=>Cse,Redacted:()=>Eq,RedactedFromValue:()=>Ase,RegExp:()=>kne,Result:()=>vse,SchemaError:()=>Au,ScopedIpv6Literal:()=>lv,ScopedIpv6LiteralFromString:()=>rq,SocketAddress:()=>Zoe,StandardSchemaV1FailureResult:()=>zne,String:()=>B,StringForLiteralAutocomplete:()=>ure,StringFromBase64:()=>Dne,StringFromBase64Url:()=>Lne,StringFromHex:()=>Bne,StringFromUriComponent:()=>jne,Struct:()=>He,StructWithRest:()=>xre,Symbol:()=>Vz,TaggedClass:()=>Fse,TaggedError:()=>xs,TaggedStruct:()=>Bm,TaggedUnion:()=>Pre,TemplateLiteral:()=>ore,TemplateLiteralParser:()=>sre,TimeZone:()=>HH,TimeZoneFromString:()=>poe,TimeZoneNamed:()=>jH,TimeZoneNamedFromString:()=>loe,TimeZoneOffset:()=>foe,Tree:()=>Kse,Trim:()=>Une,Trimmed:()=>CH,TrueLiterals:()=>KS,Tuple:()=>aa,TupleWithRest:()=>yre,URL:()=>yH,URLFromString:()=>Ane,URLSearchParams:()=>IH,Uint8Array:()=>QS,Uint8ArrayFromBase64:()=>qne,Uint8ArrayFromBase64Url:()=>Wne,Uint8ArrayFromHex:()=>TH,Undefined:()=>ZA,UndefinedOr:()=>VS,Union:()=>ht,UniqueArray:()=>Ere,UniqueSymbol:()=>pre,UnixPathAddress:()=>eq,UnixPathAddressFromString:()=>Joe,Unknown:()=>Dm,UnknownFromJsonString:()=>Pne,UrlParams:()=>pv,Void:()=>fre,annotate:()=>Fte,annotateEncoded:()=>Rte,annotateKey:()=>Mte,asserts:()=>Dte,brand:()=>GS,catchDecoding:()=>wre,catchDecodingWithContext:()=>eH,catchEncoding:()=>Tre,catchEncodingWithContext:()=>tH,check:()=>Ire,declare:()=>Ve,declareConstructor:()=>An,decode:()=>kre,decodeEffect:()=>Lte,decodeExit:()=>Bte,decodeOption:()=>zte,decodePromise:()=>qte,decodeResult:()=>Hte,decodeSync:()=>Wte,decodeTo:()=>se,decodeUnknownEffect:()=>Xa,decodeUnknownExit:()=>Uz,decodeUnknownOption:()=>jte,decodeUnknownPromise:()=>Lz,decodeUnknownResult:()=>Dz,decodeUnknownSync:()=>Bz,encode:()=>Are,encodeEffect:()=>Vte,encodeExit:()=>Gte,encodeKeys:()=>hre,encodeOption:()=>Jte,encodePromise:()=>Qte,encodeResult:()=>Zte,encodeSync:()=>Yte,encodeTo:()=>ev,encodeUnknownEffect:()=>BS,encodeUnknownExit:()=>jz,encodeUnknownOption:()=>Kte,encodeUnknownPromise:()=>Hz,encodeUnknownResult:()=>zz,encodeUnknownSync:()=>qz,extendTo:()=>gre,fieldsAssign:()=>dre,flip:()=>qA,fromBrand:()=>Cre,fromFormData:()=>Fne,fromJsonString:()=>cv,fromURLSearchParams:()=>Rne,instanceOf:()=>Xi,is:()=>LS,isBase64:()=>iH,isBase64Url:()=>jre,isBetween:()=>ec,isBetweenBigDecimal:()=>Zne,isBetweenBigInt:()=>lne,isBetweenCodePoints:()=>mne,isBetweenDate:()=>ine,isBetweenLength:()=>nv,isBetweenProperties:()=>Ene,isBetweenSize:()=>xne,isCapitalized:()=>Gre,isEndingWith:()=>Hre,isFinite:()=>Jre,isGUID:()=>Lre,isGreaterThan:()=>Qre,isGreaterThanBigDecimal:()=>Vne,isGreaterThanBigInt:()=>cne,isGreaterThanDate:()=>nne,isGreaterThanOrEqualTo:()=>cH,isGreaterThanOrEqualToBigDecimal:()=>Gne,isGreaterThanOrEqualToBigInt:()=>uH,isGreaterThanOrEqualToDate:()=>one,isIncluding:()=>qre,isInt:()=>ZS,isInt32:()=>tne,isLessThan:()=>Yre,isLessThanBigDecimal:()=>Kne,isLessThanBigInt:()=>une,isLessThanDate:()=>sne,isLessThanOrEqualTo:()=>Xre,isLessThanOrEqualToBigDecimal:()=>Jne,isLessThanOrEqualToBigInt:()=>fne,isLessThanOrEqualToDate:()=>ane,isLowercased:()=>Vre,isMaxCodePoints:()=>dne,isMaxLength:()=>dH,isMaxProperties:()=>Sne,isMaxSize:()=>gne,isMinCodePoints:()=>pne,isMinLength:()=>fH,isMinProperties:()=>yne,isMinSize:()=>hne,isMultipleOf:()=>ene,isNonEmpty:()=>pH,isPattern:()=>Ou,isPropertyNames:()=>bne,isSchema:()=>jS,isSchemaError:()=>Fz,isStartingWith:()=>zre,isStringBigInt:()=>$re,isStringFinite:()=>Mre,isStringSymbol:()=>Nre,isTrimmed:()=>aH,isULID:()=>Bre,isUUID:()=>Dre,isUint32:()=>rne,isUncapitalized:()=>Kre,isUnique:()=>sv,isUniqueKey:()=>mH,isUppercased:()=>Wre,link:()=>Fe,linkDecoding:()=>Pl,make:()=>te,makeFilter:()=>Ue,makeFilterGroup:()=>Rre,makeIsBetween:()=>Wm,makeIsGreaterThan:()=>jm,makeIsGreaterThanOrEqualTo:()=>zm,makeIsLessThan:()=>Hm,makeIsLessThanOrEqualTo:()=>qm,makeIsMultipleOf:()=>Zre,middlewareDecoding:()=>Yz,middlewareEncoding:()=>Xz,mutable:()=>bre,mutableKey:()=>tre,optional:()=>ei,optionalKey:()=>Qa,overrideToCodecIso:()=>Vse,overrideToEquivalence:()=>$se,overrideToFormatter:()=>Rse,readonlyKey:()=>rre,refine:()=>Qz,required:()=>ere,requiredKey:()=>Xte,resolveAnnotations:()=>Yse,resolveAnnotationsKey:()=>Xse,revealBottom:()=>Pte,revealCodec:()=>$te,suspend:()=>Zz,tag:()=>Ya,tagDefaultOmit:()=>_re,toCodecArrayFromSingle:()=>jse,toCodecIso:()=>Bse,toCodecJson:()=>Lse,toCodecStringTree:()=>mv,toDifferJsonPatch:()=>Gse,toEncoded:()=>Ol,toEncoderXml:()=>zse,toEquivalence:()=>Nse,toFormatter:()=>Mse,toIso:()=>Hse,toIsoFocus:()=>Wse,toIsoSource:()=>qse,toJsonSchemaDocument:()=>Dse,toRepresentation:()=>Use,toStandardJSONSchemaV1:()=>Ute,toStandardSchemaV1:()=>Nte,toTaggedUnion:()=>sH,toType:()=>vn,withArrayLengthConstraints:()=>qS,withConstructorDefault:()=>rH,withDecodingDefault:()=>oH,withDecodingDefaultKey:()=>tv,withDecodingDefaultType:()=>Ore,withDecodingDefaultTypeKey:()=>vre});var Yy="~effect/HashMap",ls=5,lm=1<<ls,_7=lm/4,KL=lm/2,P7=lm-1,F7=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),fm=(e,t)=>e>>>t&P7,Vi=(e,t)=>1<<fm(e,t),Qy=(e,t)=>F7(e&t-1);function JL(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=Vi(r,t),i=Vi(o,t);if(a===i){let f=JL(e,t+ls,r,n,o,s);return new xu(e,a,[f])}let c=a|i,u=a>>>0<i>>>0?[n,s]:[s,n];return new xu(e,c,u)}var R7=De("HashMap"),ZL=(e,t)=>xe(Y(e),Y(t)),QL=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},hu=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=lc;t=this.computeHash(),r===lc&&(this._hash=t)}return t}},pk=class extends hu{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return A()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new gu(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},gu=class e extends hu{_tag="LeafNode";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&Z(this.key,n)?v(this.value):A()}has(t,r,n){return this.hash===r&&Z(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&Z(this.key,o))return Z(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(a.value=!0,this.hash===n)return new dk(t,n,[[this.key,this.value],[o,s]]);let i=Vi(n,r),c=Vi(this.hash,r);if(i===c)return new xu(t,i,[this.set(t,r+ls,n,o,s,a)]);let u=i|c,f=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new xu(t,u,f)}remove(t,r,n,o,s){if(this.hash===n&&Z(this.key,o)){s.value=!0;return}return this}computeHash(){return ZL(this.key,this.value)}},dk=class e extends hu{_tag="CollisionNode";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return A();for(let[o,s]of this.entries)if(Z(o,n))return v(s);return A()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(Z(o,n))return!0;return!1}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return a.value=!0,JL(t,r,this.hash,this,n,new gu(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(Z(this.entries[i][0],o)){if(Z(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let a=this.entries.findIndex(([c])=>Z(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new gu(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=ZL(r[n][0],r[n][1]);return t}},xu=class e extends hu{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=Vi(r,t);if((this.bitmap&o)===0)return A();let s=Qy(this.bitmap,o);return this.children[s].get(t+ls,r,n)}has(t,r,n){let o=Vi(r,t);if((this.bitmap&o)===0)return!1;let s=Qy(this.bitmap,o);return this.children[s].has(t+ls,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=Vi(n,r),c=Qy(this.bitmap,i);if((this.bitmap&i)!==0){let u=this.children[c],f=u.set(t,r+ls,n,o,s,a);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let p=[...this.children];return p[c]=f,new e(t,this.bitmap,p)}else{a.value=!0;let u=new gu(t,n,o,s),f=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>KL?this.expand(t,f,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>KL?this.expand(t,f,p):new e(t,f,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=Vi(n,r);if((this.bitmap&a)===0)return this;let i=Qy(this.bitmap,a),c=this.children[i],u=c.remove(t,r+ls,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^a;if(p===0)return;if(this.children.length===2){let m=this.children[i===0?1:0];if(m._tag==="LeafNode")return m}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=p,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new e(t,p,d)}if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.bitmap,f)}expand(t,r,n){let o=new globalThis.Array(lm),s=0;for(let a=0;a<lm;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new mk(t,n.length,o)}computeHash(){return QL(this.children)}},mk=class e extends hu{_tag="ArrayNode";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=fm(r,t),s=this.children[o];return s?s.get(t+ls,r,n):A()}has(t,r,n){let o=fm(r,t),s=this.children[o];return s?s.has(t+ls,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=fm(n,r),c=this.children[i];if(c){let u=c.set(t,r+ls,n,o,s,a);if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.count,f)}else{a.value=!0;let u=new gu(t,n,o,s);if(this.canEdit(t))return this.children[i]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[i]=u,new e(t,this.count+1,f)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=fm(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+ls,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<_7)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[a]=c,new e(t,u,f)}pack(t,r,n){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===r?n:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new xu(t,s,o)}computeHash(){return QL(this.children)}},Xy=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case"LeafNode":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case"CollisionNode":{this.entries=t.entries,this.index=0;break}case"IndexedNode":case"ArrayNode":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},M7=(e,t)=>[e,t];var pm=class{[Yy]=Yy;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new Xy(this._root,M7)}[ie](t){if(hk(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Is(t,eB(n));if(me(s)||!Z(o,s.value))return!1}return!0}return!1}[ae](){return Er(R7^this._root.subtreeHash())}[ot](){return er(this)}toString(){return`HashMap(${j(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[er(t),er(r)])}}pipe(){return ne(this,arguments)}},YL=new pk,hk=e=>O(e,Yy),gk=()=>new pm(!1,0,YL,0);var XL=e=>{let t=YL,r=0,n={value:!1};for(let[o,s]of e){let a=Y(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new pm(!1,0,t,r)};var eB=l(2,(e,t)=>e._root.get(0,Y(t),t));var xk=l(2,(e,t)=>e._root.has(0,Y(t),t));var $7=(e,t,r,n)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,r,t,n,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new pm(!1,o._edit,i,o._size+(s.value?1:0))},yk=l(3,(e,t,r)=>$7(e,t,Y(t),r)),Sk=e=>new Xy(e._root,D);var tB=e=>e[Symbol.iterator](),eS=e=>e.size;var nB=hk;var Ek=XL;var D7=tB,dm=e=>Array.from(D7(e)),oB=eS;var mm="~effect/HashSet",L7=De(mm),B7={[ae](){return Er(xe(L7,Y(tS(this))))},[ie](e){return Ik(e)&&rS(this)===rS(e)&&iB(this,t=>aB(e,t))},[Symbol.iterator](){return Sk(tS(this))},toString(){return`HashSet(${j(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:er(Array.from(this))}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},j7=e=>{let t=Object.create(B7);return t[mm]=mm,t.keyMap=e,t},Ik=e=>O(e,mm),tS=e=>e.keyMap;var sB=e=>{let t=gk();for(let r of e)t=yk(t,r,!0);return j7(t)},aB=(e,t)=>xk(tS(e),t);var rS=e=>eS(tS(e));var iB=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var Ck=sB,cB=Ik;var uB=rS;var Tk="~effect/http/Cookies",lB=e=>O(e,Tk),kk="~effect/http/Cookies/Cookie",pB=e=>O(e,kk),fB="~effect/http/Cookies/CookieError",Ak=class extends kp{},yu=class e extends mo("CookiesError"){static fromReason(t,r){return new e({reason:new Ak({_tag:t,cause:r})})}[fB]=fB;get message(){return this.reason._tag}};var H7={[Tk]:Tk,...Pt,toJSON(){return{_id:"effect/Cookies",cookies:Kh(this.cookies,e=>e.toJSON())}},pipe(){return ne(this,arguments)}},Ok=e=>{let t=Object.create(H7);return t.cookies=e,t},_k=e=>{let t={};for(let r of e)z(t,r.name,r);return Ok(t)},dB=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=q7(n.trim());o&&r.push(o)}return _k(r)};function q7(e){let t=e.split(";").map(i=>i.trim()).filter(i=>i!=="");if(t.length===0)return;let r=t[0].indexOf("=");if(r===-1)return;let n=t[0].slice(0,r);if(!mB.test(n))return;let o=t[0].slice(r+1),s=Z7(o);if(t.length===1)return Object.assign(Object.create(vk),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],u=c.indexOf("="),f=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(p===void 0)break;let d=p.trim().replace(/^\./,"");d&&(a.domain=d);break}case"expires":{if(p===void 0)break;let d=new Date(p);isNaN(d.getTime())||(a.expires=d);break}case"max-age":{if(p===void 0)break;let d=parseInt(p,10);isNaN(d)||(a.maxAge=wp(d));break}case"path":{if(p===void 0)break;p[0]==="/"&&(a.path=p);break}case"priority":{if(p===void 0)break;switch(p.toLowerCase()){case"low":a.priority="low";break;case"medium":a.priority="medium";break;case"high":a.priority="high";break}break}case"httponly":{a.httpOnly=!0;break}case"secure":{a.secure=!0;break}case"partitioned":{a.partitioned=!0;break}case"samesite":{if(p===void 0)break;switch(p.toLowerCase()){case"lax":a.sameSite="lax";break;case"strict":a.sameSite="strict";break;case"none":a.sameSite="none";break}break}}}return Object.assign(Object.create(vk),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var W7=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,mB=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,V7=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,G7=/^[\u0020-\u003a\u003c-\u007e]+$/,vk={[kk]:kk,...Pt,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function K7(e,t,r){let n=encodeURIComponent(t),o=hB(e,n,r);return o!==void 0?X(o):G(Object.assign(Object.create(vk),{name:e,value:t,valueEncoded:n,options:r}))}function hB(e,t,r){if(!mB.test(e))return yu.fromReason("InvalidCookieName");if(t&&!W7.test(t))return yu.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!V7.test(r.domain))return yu.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!G7.test(r.path))return yu.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!Rs(pt(r.maxAge)))return yu.fromReason("CookieInfinityMaxAge")}var gB=(e,t,r)=>di(K7(e,t,r));function J7(e){let t=hB(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+"="+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=Ms(pt(n.maxAge));r+="; Max-Age="+Math.trunc(o)}if(n.domain!==void 0&&(r+="; Domain="+n.domain),n.path!==void 0&&(r+="; Path="+n.path),n.priority!==void 0)switch(n.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break}if(n.expires!==void 0&&(r+="; Expires="+n.expires.toUTCString()),n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.partitioned&&(r+="; Partitioned"),n.sameSite!==void 0)switch(n.sameSite){case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break}return r}var xB=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];z(t,o.name,o.value)}return t},yB=e=>Object.values(e.cookies).map(J7);var Z7=e=>{try{return decodeURIComponent(e)}catch{return e}};var Su=new WeakMap,SB=e=>{if(Su.has(e))return Su.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var EB="~effect/Redacted",pl=e=>O(e,EB),ro=(e,t)=>{let r=Object.create(X7);return t?.label&&(r.label=t.label),Su.set(r,e),r},X7={[EB]:{_A:e=>e},label:void 0,...Nr,toJSON(){return this.toString()},toString(){return`<redacted${Nn(this.label)?":"+this.label:""}>`},[ae](){return Y(Su.get(this))},[ie](e){return pl(e)&&Z(Su.get(this),Su.get(e))}},sa=SB;var bB=e=>Ur((t,r)=>e(sa(t),sa(r)));var Pk=Symbol.for("~effect/http/Headers"),IB=e=>O(e,Pk),Fk=Object.defineProperties(Object.create(null),{[Pk]:{value:Pk},[pa]:{value(e){return tX(this,$e(e,rX))}},toJSON:{value(){return Uo(this)}},[ie]:{value(e){return Rk(this,e)}},[ae]:{value(){return op(this)}},toString:{value:Pt.toString},[ot]:{value:Pt[ot]}});var Rk=V_(Yu()),eX=Object.create(Fk),CB=e=>{if(e===void 0)return eX;if(Symbol.iterator in e){let r=Object.create(Fk);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(Fk);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(", "):n!==void 0&&(t[r.toLowerCase()]=n);return t};var tX=l(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=ro(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=ro(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),wB=(e,t)=>{let r=e.toLowerCase();for(let n=0;n<t.length;n++){let o=t[n];if(typeof o=="string"){if(o.toLowerCase()===r)return!0}else if(e.search(o)!==-1)return!0}return!1},rX=Te("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]});var hm=e=>typeof e=="string"?e:sa(e);var Mk="~effect/http/UrlParams",$k=e=>O(e,Mk),nX={...Nr,[Mk]:Mk,[Symbol.iterator](){return this.params[Symbol.iterator]()},[pa](e){return{_id:"UrlParams",params:Object.fromEntries(aX(this,$e(e,cX)))}},toJSON(){return Uo(this)},[ie](e){return Nk(this,e)},[ae](){return ws(this.params.flat())}},nS=e=>{let t=Object.create(nX);return t.params=e,t},vB=e=>{if($k(e))return e;let t=OB(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return nS(r)},OB=e=>{let t=typeof e[Symbol.iterator]=="function"?Xe(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,AB(o[s])]);else if(o!==null&&typeof o=="object"&&!pl(o)){let s=OB(o);for(let[a,i]of s)r.push([[n,...typeof a=="string"?[a]:a],i])}else o!==void 0&&r.push([n,AB(o)]);return r},AB=e=>pl(e)?e:String(e),Nk=Ur((e,t)=>oX(e.params,t.params)),oX=Z_(L_([Yu(),ap()]));var _B=l(2,(e,t)=>Ip(e.params,([r])=>r===t).pipe(rr(([,r])=>hm(r))));var sX=e=>{let t={};for(let[r,n]of e.params){let o=hm(n);if(!Object.hasOwn(t,r))z(t,r,o);else{let s=t[r];typeof s=="string"?z(t,r,[s,o]):s.push(o)}}return t},PB=sX,aX=l(2,(e,t)=>{let r=Array.isArray(t)?t:[t];return e.params.map(([n,o])=>[n,typeof o=="string"&&iX(n,r)?ro(o):o])}),iX=wB;var cX=Te("effect/http/UrlParams/CurrentRedactedNames",{defaultValue:()=>["AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var Uk="~effect/Graph",Dk=e=>O(e,Uk),FB=e=>e;var fX=(e,t,r)=>(e==="directed"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&Z(t.data,r.data),lX=(e,t)=>e==="directed"?Y(t):Er(xe(Y(t.data),pX(t.source,t.target))),pX=(e,t)=>xe(0,Y(e))+xe(0,Y(t)),dX=De("Graph"),mX={[Uk]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[ot](){return this.toJSON()},[ie](e){if(O(e,Uk)){let t=FB(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!Z(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!fX(this.type,n,o))return!1}return!0}return!1},[ae](){let e=dX;e=e^De(this.type),e=e^Wt(this.nodes.size),e=e^Wt(this.edges.size);for(let[t,r]of this.nodes)e^=xe(Y(t),Y(r));for(let[t,r]of this.edges)e^=xe(Y(t),lX(this.type,r));return Er(e)},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return ne(this,arguments)}},hX=(e,t)=>{let r=Object.create(mX);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=v(!0),r};var gm=e=>{let t=FB(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},oS=e=>{let t=hX(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type==="undirected"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=A(),t};var sS=(e,t,r)=>e===rt?r(t):Qt(e,r);function MB(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===rt?e.decode(vr(Hd(n)),o):e.decode(qc(r,Hd),o);return RB(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===rt?vr(n):r;case"Transform":{let r=n=>n===we?wn:vr(t.transform(n));return(n,o)=>sS(n,o,r)}case"TransformOptional":{let r=n=>Lw(t.transform(Hd(n)));return(n,o)=>sS(n,o,r)}case"TransformEffect":return(r,n,o)=>sS(r,n,s=>s===we?wn:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>sS(r,n,s=>RB(t.transform(Hd(s),o)))}}var RB=e=>Qt(e,Lw),$B=(e,t,r,n)=>Ct(n,o=>Oa(()=>Ci(o,s=>new jU(e,s,t,r))));function xX(e,t){let r=MB(e.link.transformation),n;return(o,s)=>{if(o===we)return wn;if(e.isConstructed(o))return rt;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function yX(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==we&&n!==void 0)return t(n,o);let s=r;if(je(s)&&s._tag==="Success"){let a=t(s[ge],o);return a===rt?s:a}return Qt($B(e,n,o,s),a=>{let i=t(a,o);return i===rt?vr(a):i})}}function Lk(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:yX(e,r)}function xm(e,t,r,n,o){if(e._tag==="Declaration")for(let x of e.typeParameters)t(x);let s=r?nL(e):void 0,a=s?xX(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,u=c?.map(x=>MB(x.transformation)),f=e.encodingChecks;if(!c&&!i&&!f)return a;let p,d=(x,y)=>{let E=a(x,y);if(f&&!y.disableChecks)if(je(E)){if(E._tag==="Success"){let w=E===rt?x:E[ge];if(x!==we&&w!==we){let T=fs(f,x,void 0,e,y);T&&(E=k(new Xt(e,T,x,y)))}}}else E=I(E,w=>{if(x!==we&&w!==we){let T=fs(f,x,void 0,e,y);if(T)return k(new Xt(e,T,x,y))}return g(w)});if(i&&!y.disableChecks)if(je(E)){if(E._tag==="Success"){let w=E===rt?x:E[ge];if(w===we)return E;let T=fs(i,w,void 0,e,y);T&&(E=k(new Xt(e,T,w,y)))}}else E=I(E,w=>{if(w!==we){let T=fs(i,w,void 0,e,y);if(T)return k(new Xt(e,T,w,y))}return g(w)});return E},m=o===void 0?d:o(d);return c?(x,y)=>{let E=p??=c.map(M=>t(M.to)),w=x,T=E[E.length-1](x,y);for(let M=c.length-1;M>=0;M--)if(T=u[M](T,w,y),M!==0){let P=E[M-1];T._tag==="Success"?(w=T[ge],T=P(w,y)):T=Qt(T,h=>{let S=P(h,y);return S===rt?vr(h):S})}if(T._tag==="Success"){let M=T[ge],P=m(M,y);return P===rt?T:P}return T=$B(e,x,y,T),Qt(T,M=>{let P=m(M,y);return P===rt?vr(M):P})}:m}var cS=Symbol(),NB=new WeakMap,UB,dl=!1;var EX=e=>dl?iS(no,e,"parser"):no(e).parser,DB=e=>dl?iS(no,e,"makeEffect"):no(e).makeEffect,bX=e=>Lk(e,DB),aS=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=xm(this.ast,EX)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=xm(this.ast,DB,bX)}},Bk=class extends aS{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r=="function"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??xm(this.ast,t=>iS(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",IX(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>iS(this.resolve,n,"makeEffect");return this.save("makeEffect",xm(this.ast,r,n=>Lk(n,r)))}};function IX(e,t){let r;return(n,o)=>{if(n!==we)try{let s=e(n,o);if(s!==cS)return s===n?rt:vr(s)}catch(s){return lr(s)}return(r??=t())(n,o)}}function iS(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,a)=>(o??=n[r])(s,a)}function no(e){let t=NB.get(e);if(t!==void 0)return t;let r=UB===void 0?new aS(e):new Bk(e,UB(e,no),no);return NB.set(e,r),r}function zk(e){let t=e.ast,r;return(n,o)=>(r??=Jk(PX,zt(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function fS(e){let t=zk(e);return(r,n)=>{let o=Vs(t(r,n));return et(o)?v(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),A())}}function lS(e){return OX(zt(e.ast))}function Hk(e){return ym(e.ast)}function wX(e){if(!dl){let o=ml(mS(e));return s=>{let a=o(s,ra);return et(a)?!0:(Yn(a.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=no(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,ra)}catch(s){return Yn(Cf(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=Vs(Kk(n(o,ra),o));return et(s)?!0:(Yn(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function ym(e){let t=zt(e),r=n=>(r=wX(t),r(n));return n=>r(n)}function LB(e){let t=mS(e);return(r,n)=>{let o=Vs(t(r,n));if(!et(o))return Yn(o.cause,"Issue adapter can only return schema issues")}}function BB(e,t){let r=zt(e.ast),n=no(r).parser(t,ra),o=Vs(Kk(n,t));if(ka(o)){let s=Yn(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function Ut(e,t){let r=mS(e.ast);return t===void 0?r:(n,o)=>r(n,Gk(t,o))}var qk=Ut;function jB(e,t){return ml(Ut(e,t))}function Wk(e,t){return KB(Ut(e,t))}var zB=Wk;function HB(e,t){return JB(Ut(e,t))}function TX(e,t){return dl?ZB(e.ast,t):Zk(Ut(e,t))}var pS=TX;function Eu(e,t){let r=mS(to(e.ast));return t===void 0?r:(n,o)=>r(n,Gk(t,o))}var qB=Eu;function WB(e,t){return ml(Eu(e,t))}function Vk(e,t){return KB(Eu(e,t))}var VB=Vk;function GB(e,t){return JB(Eu(e,t))}function kX(e,t){return dl?ZB(to(e.ast),t):Zk(Eu(e,t))}var dS=kX,Gk=(e,t)=>t?{...e,...t}:e,uS=e=>e===we?k(new he):g(e);function mS(e){return Jk(_X,e)}function Kk(e,t){return e===rt?g(t):je(e)?e[ge]===we?uS(we):e:Qt(e,uS)}function Jk(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??ra);return s===rt?g(n):je(s)?s[ge]===we?uS(we):s:Qt(s,uS)}}function ml(e){return(t,r)=>Vs(e(t,r))}function KB(e){let t=ml(e);return(r,n)=>{let o=t(r,n);return et(o)?v(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),A())}}function JB(e){let t=ml(e);return(r,n)=>{let o=t(r,n);return et(o)?G(o.value):X(Yn(o.cause,"Result adapter can only return schema issues"))}}function ZB(e,t){let r;return(n,o)=>(r??=AX(no(e),t))(n,o)}function AX(e,t){let r=e.decode,n,o=r===void 0?(s,a=ra)=>(n??=jk(e))(s,a):(s,a=ra)=>{if(s===we)return(n??=jk(e))(s,a);let i;try{i=r(s,a)}catch(c){throw Yn(Cf(c),"Sync adapter can only throw schema issues"),c}return i!==cS?i:(n??=jk(e))(s,a)};return t===void 0?o:(s,a)=>o(s,Gk(t,a))}function jk(e){return Zk(Jk(()=>e.decodeEffect,e.ast))}function Zk(e){let t=ml(e);return(r,n)=>{let o=t(r,n);if(et(o))return o.value;let s=Yn(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function vX(e,t){let r=Vs(e);if(et(r))return r.value;let n=Yn(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function OX(e){let t,r;return(n,o)=>{t??=no(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??ra,a=t.make;if(a!==void 0&&n!==we){let c;try{c=a(n,s)}catch(u){throw Yn(Cf(u),"Constructor adapter can only throw schema issues"),u}if(c!==cS&&c!==we)return c}let i=(r??=t.makeEffect)(n,s);return vX(Kk(i,n),"Constructor adapter can only throw schema issues")}}var _X=e=>no(e).parser,PX=e=>no(e).makeEffect;var hS="~effect/Schema/Schema",QB=Symbol(),FX={[hS]:hS,get make(){let e=lS(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=zk(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=fS(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return ne(this,arguments)},annotate(e){return this.rebuild(is(this.ast,e))},annotateKey(e){return this.rebuild(am(this.ast,e))},check(...e){return this.rebuild(na(this.ast,e))},rebuild(e){return ps(e,this[QB])}};function ps(e,t){function r(){}let n=Object.setPrototypeOf(r,FX);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[QB]=t,n.ast=e,n}function Qk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Sm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Yk(e){return encodeURI(Qk(e)).replace(/#/g,"%23")}function Xk(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let r=decodeURIComponent(t);return r.startsWith("/")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function XB(e){let t=Xk(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Sm)}function ej(e){return e.reduce((t,r)=>`${t}/${Yk(r)}`,"#")}var MX="http://json-schema.org/draft-07/schema#",tj="https://json-schema.org/draft/2020-12/schema";function rj(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function sj(e){return{dialect:"draft-07",...LX(e,JX)}}function $X(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Dn(n))return n;let a=o||!s&&cj(n.$id),i={};for(let c of Object.keys(n)){let u=n[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=tA(u,p=>r(p,a))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(p=>r(p,a)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":f=r(u,a)}z(i,c,f)}return t(i,a),i}}function aj(e,t){return $X(e,r=>{NX(r,t)})}function NX(e,t){typeof e.$ref=="string"&&z(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&z(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function tA(e,t){if(!Dn(e))return;let r={};for(let n of Object.keys(e))z(r,n,t(e[n],n));return r}function UX(e,t,r){let n=new Map,o=[],s=eA;function a(d,m=[],x=[]){if(m.length===0&&t?.trackIds){let y=Dn(d)?f(d):void 0;s=nj(y,eA)??eA}return u(d,m,x,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[d,m,x]of o){let y=m,E=ij(m,x);if(E!==void 0){let w=XB(E.hash);if(E.hash="",w!==void 0){let T=n.get(oj(E.href,w));T!==void 0&&(y=DX(m,T))}}z(d,"$ref",y)}}let c=r(a);return i(),c;function u(d,m,x,y){if(typeof d=="boolean")return p(m,x,y),t?.booleanAdapter?.(d)??d;if(!Dn(d))return d;let E=y,w=f(d);if(m.length>0&&t?.trackIds&&cj(w)){let P=nj(w,y.uri);P!==void 0&&(E={parent:y,sourceRoot:m,targetRoot:x,uri:P})}p(m,x,E);let T=E.uri,M={isDocumentRoot:m.length===0,schema(P,h,S=h){return u(P,[...m,h],[...x,S],E)},schemaAt(P,h,S){return u(P,[...m,...h],[...x,...S],E)},schemaArray(P,h,S=h){return Array.isArray(P)?P.map((b,C)=>u(b,[...m,h,String(C)],[...x,S,String(C)],E)):P},schemaMap(P,h,S=h){return Dn(P)?tA(P,(b,C)=>u(b,[...m,h,C],[...x,S,C],E)):P},reference(P,h){typeof h=="string"?o.push([P,h,T]):z(P,"$ref",h)}};return e(d,M)}function f(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref=="string"?void 0:d.$id}function p(d,m,x){x.parent!==void 0&&p(d,m,x.parent),n.set(oj(x.uri,d.slice(x.sourceRoot.length)),m.slice(x.targetRoot.length))}}var eA="https://effect.invalid/.json-schema/";function ij(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function nj(e,t){if(typeof e!="string")return;let r=ij(e,t);if(r!==void 0)return r.hash="",r.href}function DX(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${ej(t)}`}function oj(e,t){return`${e}\0${JSON.stringify(t)}`}function cj(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function LX(e,t,r){return UX(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:tA(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var BX=new Set(["properties","patternProperties"]),jX=new Set(["allOf","anyOf","oneOf"]),zX=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function HX(e,t,r,n,o,s=BX){let a;if(s.has(t))a=n.schemaMap(r,t);else if(jX.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return z(e,t,a),!0}var uj=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],rSe=[...uj,"deprecated"],nSe=[...uj,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],qX=/^[A-Za-z_][-A-Za-z0-9._]*$/,WX=/^[A-Za-z][-A-Za-z0-9._:]*$/;function bu(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function VX(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&bu(o,r,`it is not active in ${n} but would become active in the target`)}var GX=["additionalItems","definitions","dependencies"];function KX(e,t,r,n,o){r.isDocumentRoot?z(e,"$schema",rj(t,tj)?n:t):rj(t,tj)||bu("$schema",o,"an embedded resource cannot declare a different dialect")}function JX(e,t){VX(e,GX,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!HX(r,a,i,t,zX))switch(a){case"$ref":n=i;break;case"$schema":KX(r,i,t,MX,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":z(r,"definitions",t.schemaMap(i,a,"definitions"));break;case"prefixItems":o=i;break;case"items":s=i;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":bu(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;z(r,a,i);break;default:z(r,a,i)}}if(ZX(r,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&bu("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&z(r,"minContains",a)}else Object.hasOwn(e,"minContains")&&z(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&z(r,"maxContains",e.maxContains);return YX(e,r,t,"draft-07"),eee(e,r,"$id","Draft-07"),QX(r,n,t),r}function ZX(e,t,r,n){if(t===void 0){r!==void 0&&z(e,"items",n.schema(r,"items"));return}z(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&z(e,"additionalItems",n.schema(r,"items","additionalItems"))}function QX(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),XX(e,n)}else r.reference(e,t)}function YX(e,t,r,n){let o=Dn(e.dependentRequired)?e.dependentRequired:void 0,s=Dn(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let u=o?.[c],f=s?.[c],p=n==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?p||z(a,c,u):u===void 0||p?z(a,c,r.schemaAt(f,["dependentSchemas",c],["dependencies",c])):z(a,c,{allOf:[r.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(a).length>0&&z(t,"dependencies",a)}function XX(e,t){Array.isArray(e.allOf)?e.allOf.push(t):z(e,"allOf",[t])}function eee(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&z(t,r,o);return}(typeof s!="string"||!qX.test(s))&&bu("$anchor",n,"the anchor is not valid"),WX.test(s)||bu("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?z(t,r,`#${s}`):bu("$anchor",n,"it cannot be combined with the schema $id")}function gS(e){return ps(hl(e.ast),{schema:e})}var hl=lu(e=>{let t=ree(e,hl),r=e.context;return t===e||r===void 0?t:jy(t,rA(r))});function rA(e){return e.constructorDefault===void 0?e:new ta(e.isOptional,e.isMutable,void 0,e.annotations)}function pj(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function dj(e){return t=>{let r=[...t].sort((o,s)=>e(cs(o))-e(cs(s)));return r.some((o,s)=>o!==t[s])?r:t}}var tee=dj(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function ree(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Un(r))return mt(e,[HT]);let n=e.typeParameters.map(s=>ps(cs(s))),o=r(n);return o===void 0?e:mt(e,[il(o,t)])}case"Unknown":return mt(e,[HT]);case"ObjectKeyword":return mt(e,[aL]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return pj(e),e.recur(t,Hy);case"Union":{let r=tee(e.types);return r!==e.types?new kn(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function xS(e){return ps(mj(zt(e.ast)))}var mj=No(e=>{let t=nee(e,mj);return t!==e&&e.context!==void 0?jy(t,rA(e.context)):t});function nee(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Un(r)){let n=r(e.typeParameters.map(o=>ps(o)));return mt(e,[il(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function yS(e){return ps(yj(e.ast),{schema:e})}function hj(e){return ps(Sj(e.ast))}var oee=dj(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function see(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(u=>ps(t(cs(u)))),o=e.annotations?.toCodecStringTree;if(Un(o)){let u=o(n);return u===void 0?e:mt(e,[il(u,t)])}let s=e.annotations?.toCodecJson,a=Un(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(Un(i)?i(n):void 0);return c===void 0?r(e):mt(e,[il(c,t)])}case"Null":return mt(e,[aee]);case"Boolean":return mt(e,[iee]);case"Unknown":case"ObjectKeyword":return mt(e,[qT]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return pj(e),e.recur(t,Hy);case"Union":{let n=oee(e.types);return n!==e.types?new kn(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var aee=new Ot(new eo("null"),new We(Ee(()=>null),Ee(()=>"null"))),iee=new Ot(new kn([new eo("true"),new eo("false")]),new We(Ee(e=>e==="true"),iu())),gj=new We(Ee(e=>typeof e=="string"?[e]:e),ea()),xj=e=>e.transformation===gj,yj=lu(e=>{let t=see(e,yj,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?jy(t,rA(e.context)):t},{stopAt:xj}),lj=e=>Or(e)?pu(qa):qa,Sj=lu(e=>{let t=cee(e);if(ET(t)){let r=cl(new kn([new _o(t.isMutable,t.elements.map(lj),t.rest.map(lj)),Xn],{mode:"anyOf"}),t,gj);return Or(e)?pu(r):r}return t},{stopAt:xj});function cee(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(Sj):e}var sSe=globalThis.RegExp;var Ka=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function Ki(e,t){return t.length>0&&(e+=`
|
|
33
|
-
at ${wh(t)}`),new Error(e)}function Ej(e){return`#/$defs/${Yk(e)}`}var uee=new Set([...LU,su,...DU]);function bm(e,t){if(e===void 0)return;let r={},n=e.title;typeof n=="string"&&(r.title=n);let o=e.description,s=e.expected;typeof o=="string"?r.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(r.description=s);let a=e.default;ul(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&ul(i)&&(r.examples=i);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(r.writeOnly=u);let f=e.format;typeof f=="string"&&(r.format=f);let p=e.contentEncoding;typeof p=="string"&&(r.contentEncoding=p);let d=e.contentMediaType;typeof d=="string"&&(r.contentMediaType=d);let m=e.contentSchema;if(ul(m)&&(r.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[x,y]of Object.entries(e))uee.has(x)||!t.includeAnnotationKey(x)||ul(y)&&z(r,x,y);return Object.keys(r).length===0?void 0:r}function bj(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let a=bj(s);a.type!==void 0&&(o=!0,(t===void 0||a.type==="integer")&&(t=a.type)),Object.keys(a.schema).length>0&&n.push(a.schema)}if(o){let{allOf:s,...a}=r;r=n.length===0?a:{...a,allOf:n}}}return{type:t,schema:r}}function fee(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}var Ij="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function SS(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function lee(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var pee="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",dee="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function mee(e,t,r){if(typeof e.$ref=="string")return;let n={...e,...t};for(let o of r){if(!Object.hasOwn(e,o))continue;let s=e[o],a=t[o];if(typeof s!="number"||typeof a!="number")return;if(pee.includes(`|${o}|`))n[o]=Math.max(s,a);else if(dee.includes(`|${o}|`))n[o]=Math.min(s,a);else return}return typeof n.minimum=="number"&&typeof n.exclusiveMinimum=="number"&&delete n[n.exclusiveMinimum>=n.minimum?"minimum":"exclusiveMinimum"],typeof n.maximum=="number"&&typeof n.exclusiveMaximum=="number"&&delete n[n.exclusiveMaximum<=n.maximum?"maximum":"exclusiveMaximum"],n}var sA="|title|description|default|examples|readOnly|writeOnly|",hee=Ij+sA;function Im(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=fee(e);if(o!==void 0||s){let i=bj(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(i.schema);return f.length===0?u:SS(i.schema,sA)&&lee(u,f)?{...u,...i.schema}:Im(u,i.schema,r)}}if(r){let i=mee(e,t,n);if(i!==void 0)return i}let a=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref=="string"?{allOf:[e,...a]}:{...e,allOf:a}}function oA(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>oA(r,t)))}function gee(e){return Array.isArray(e)}function xee(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,u=Object.keys(r);for(let h of u)x(h,["references",h]);let f=ar(e,(h,S)=>T(h,t[S],[]));for(let[h,S]of i.values())if(!oA(h))for(let b of S)Array.isArray(b.oneOf)&&(b.anyOf=b.oneOf,delete b.oneOf);for(let h of u){let S=r[h],b=E(S);if(b===void 0)continue;let C=o.get(h)[0],_=c.get(b),$=_?.find(H=>Z(o.get(H)[0],C));$===void 0?_===void 0?c.set(b,[h]):_.push(h):s.set(h,$)}let p=ar(f,y),d={};for(let h of u)s.has(h)||z(d,h,y(o.get(h)[0]));return{dialect:"draft-2020-12",schemas:p,definitions:d};function m(h){return Array.isArray(h.oneOf)&&i.get(h.oneOf)?.[1].push(h),h}function x(h,S){if(!Object.hasOwn(r,h))throw Ki(`Invalid reference ${h}`,[...S,"$ref"]);let b=o.get(h);if(b!==void 0)return b;let C=[{},[]];return o.set(h,C),C[0]=T(r[h],["references",h],C[1]),C}function y(h){return aj(h,S=>{let b=Xk(S);if(b===void 0){if(/^#(?:\/|%2f)/i.test(S))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(S)}`);return S}if(!b.startsWith("/$defs/"))return S;let C=b.indexOf("/",7),_=s.get(Sm(b.slice(7,C<0?void 0:C)));return _===void 0?S:S.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,Ej(_))})}function E(h){if(h._tag==="Reference")return;let S=h.checks.length===0?h.annotations:h.checks[h.checks.length-1].annotations;return typeof S?.identifier!="string"&&typeof S?.[su]=="string"?S[su]:void 0}function w(h,S,b,C){let _=h.annotations,$=_?.toJsonSchema;if($!==void 0){let pe=h.representation?.schemas?.map((la,Zl)=>T(la,[...b,"representation","schemas",Zl],C))??[],_e=$({type:S,schemas:pe}),Je=gee(_e);Je&&C.push(!1);let _t=Je?_e[0]:_e,Dt=bm(_,n),xn=Dt===void 0?_t:{..._t,...Dt},so=Dt===void 0?Ij:hee;return[xn,h._tag==="Filter"&&SS(xn,so)&&(Dt===void 0||SS(Dt,sA))?!0:void 0]}if(h._tag==="Filter"){C.push(!1);return}let H=h.checks.flatMap((pe,_e)=>{let Je=w(pe,S,[...b,"checks",_e],C);return Je===void 0?[]:[Je[0]]});if(H.length===0)return;let J=bm(_,n),Ie={allOf:H};return[J===void 0?Ie:{...Ie,...J}]}function T(h,S,b){if(h._tag==="Reference")return b.push(x(h.$ref,S)[1]),{$ref:Ej(h.$ref)};let C=a.get(h);if(C!==void 0)return b.push(C[1]),C[0];let _=[];b.push(_);let $=M(h,S,_),H=bm(h.annotations,n);H!==void 0&&($={...$,...H});for(let J=0;J<h.checks.length;J++){let Ie=typeof $.type=="string"&&yee($.type)?$.type:void 0,pe=w(h.checks[J],Ie,[...S,"checks",J],_);pe!==void 0&&($=Im($,...pe))}return a.set(h,[$,_]),m($)}function M(h,S,b){switch(h._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(h.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(h.symbol)]};case"Declaration":return b.push(!1),{};case"Suspend":return T(h.thunk,[...S,"thunk"],b);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let C=h.literal;return typeof C=="bigint"?{type:"string",enum:[globalThis.String(C)]}:{type:typeof C,enum:[C]}}case"Enum":{let C=h.enums.map(([_,$],H)=>{if(typeof $=="number"&&!globalThis.Number.isFinite($))throw Ki(`Invalid numeric enum value ${globalThis.String($)}`,[...S,"enums",H,1]);return{type:typeof $,enum:[$],title:_}});return C.length===0?{not:{}}:{anyOf:C}}case"TemplateLiteral":return{type:"string",pattern:`^${h.parts.map(ES).join("")}$`};case"Arrays":{if(h.rest.length>1)throw Ki("Invalid schema representation document",[...S,"rest"]);let C={type:"array"},_=h.elements.length,$=h.elements.map((H,J)=>{H.isOptional&&_--;let Ie=T(H.type,[...S,"elements",J,"type"],b),pe=bm(H.annotations,n);return pe===void 0?Ie:m(Im(Ie,pe))});if($.length>0?(C.prefixItems=$,C.maxItems=h.elements.length,_>0&&(C.minItems=_)):C.items=!1,h.rest.length===1){delete C.maxItems;let H=T(h.rest[0],[...S,"rest",0],b);Object.keys(H).length>0?C.items=H:delete C.items}return C}case"Objects":{if(h.propertySignatures.length===0&&h.indexSignatures.length===0)return{not:{type:"null"}};let C={type:"object"},_={},$=[];for(let Je=0;Je<h.propertySignatures.length;Je++){let _t=h.propertySignatures[Je];if(typeof _t.name!="string")throw Ki("Invalid schema representation document",[...S,"propertySignatures",Je,"name"]);let Dt=_t.name,xn=T(_t.type,[...S,"propertySignatures",Je,"type"],b),so=bm(_t.annotations,n);z(_,Dt,so===void 0?xn:m(Im(xn,so))),_t.isOptional||$.push(Dt)}h.propertySignatures.length>0&&(C.properties=_),$.length>0&&(C.required=$);let H={},J=[],Ie=[],pe=!1;for(let Je=0;Je<h.indexSignatures.length;Je++){let _t=h.indexSignatures[Je],Dt=T(_t.type,[...S,"indexSignatures",Je,"type"],b);Z(Dt,{not:{}})&&(Dt=!1),Ie.push(Dt);let xn=P(_t.parameter,[...S,"indexSignatures",Je,"parameter"],new Set);if(xn===void 0){pe=!0,b.push(!1);continue}if(xn.length===0)J.push(Dt);else for(let so of xn){let la=H[so];z(H,so,la===void 0?Dt:la===!1||Dt===!1?!1:m(Im(la,Dt)))}}let _e=Object.keys(H).length>0;if(_e&&(C.patternProperties=H),pe&&n?.onExcessProperty==="error"){let Je=[];h.propertySignatures.length>0&&Je.push({enum:Object.keys(_)});for(let _t=0;_t<h.indexSignatures.length;_t++)Je.push(T(h.indexSignatures[_t].parameter,[...S,"indexSignatures",_t,"parameter"],b));C.propertyNames=Je.length===1?Je[0]:{anyOf:Je},C.additionalProperties=Ie.length===1?Ie[0]:{anyOf:Ie},J.length>0&&(C.allOf=J.map(_t=>({type:"object",additionalProperties:_t})))}else J.length===0?C.additionalProperties=pe||n?.onExcessProperty!=="error":J.length===1&&h.propertySignatures.length===0&&!_e?C.additionalProperties=J[0]:J.length>0&&(C.allOf=J.map(Je=>({type:"object",additionalProperties:Je})));return typeof C.additionalProperties=="object"&&C.additionalProperties!==null&&Object.keys(C.additionalProperties).length===0&&delete C.additionalProperties,C}case"Union":{let C=[],_=h.types.map((H,J)=>T(H,[...S,"types",J],C));if(b.push(C),_.length===0)return{not:{}};let $=h.options?.mode??"anyOf";if($==="anyOf"&&_.length>1){let H=See(_);if(H!==void 0)return H}return $==="oneOf"&&i.set(_,[C,[]]),{[$]:_}}}}function P(h,S,b){switch(h._tag){case"Reference":{if(!Object.hasOwn(r,h.$ref))throw Ki(`Invalid reference ${h.$ref}`,[...S,"$ref"]);if(x(h.$ref,S),b.has(h.$ref))return;let C=new Set(b).add(h.$ref);return P(r[h.$ref],["references",h.$ref],C)}case"String":{if(h.checks.length===0)return[];if(h.checks.length!==1||h.checks[0]._tag!=="Filter"||h.checks[0].annotations?.toJsonSchema===void 0)return;let C=[],_=T(h,S,C);return oA(C)&&_.type==="string"&&typeof _.pattern=="string"&&SS(_,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[_.pattern]:void 0}case"TemplateLiteral":return h.checks.length===0?[`^${h.parts.map(ES).join("")}$`]:void 0;case"Union":{if(h.types.length===0||h.checks.length>0||h.options?.mode==="oneOf")return;let C=[];for(let _=0;_<h.types.length;_++){let $=P(h.types[_],[...S,"types",_],b);if($===void 0)return;if($.length===0)return[];C.push(...$)}return C}default:throw Ki("Invalid schema representation document",S)}}}function yee(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function See(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function ES(e){switch(e._tag){case"Literal":return Ka(globalThis.String(e.literal));case"String":return X2;case"Number":return Ny;case"TemplateLiteral":return e.parts.map(ES).join("");case"Union":return`(?:${e.types.map(ES).join("|")})`;default:throw Ki("Invalid schema representation document",[])}}function bS(e,t){let r=xee([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var Eee=({identifier:e})=>e;function ds(e){return e===void 0?void 0:{annotations:e}}function Cm(e,t){let{references:r,representations:n}=bee([e],t);return{representation:n[0],references:r}}function bee(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let h of e)m(h);let i=t?.referencePolicy??Eee;for(let h of s.values())for(let S of h.values()){let b=i({ast:S.ast,occurrences:S.occurrences,identifier:S.identifier});if(b!==void 0){let C=b===S.identifier||!b.endsWith("_")?"_":"";S.reference=u(b,S,C)}else S.isRecursive&&(S.reference=u(`${S.ast._tag}_`,S,""))}return{representations:ar(e,h=>y(h)),references:r};function u(h,S,b="_"){let C=h,_=0;for(;n.has(C);){if(n.get(C)===S)return C;C=`${h}${b}${++_}`}return n.set(C,S),C}function f(h,S,b){let C=S.fallback;return C!==void 0?Uw(h)===C?h:is(h,{[su]:C}):b===S.identifier?h:is(h,{identifier:b})}function p(h,S){if(!Object.hasOwn(r,h)&&!o.has(h)){o.add(h);let b=E(S);o.delete(h),z(r,h,b)}return{_tag:"Reference",$ref:h}}function d(h){let S=al(h),b=sl(S),C=Vf(S),_=C===void 0?(S!==h?Vf(h):void 0)??Uw(S):void 0;_!==void 0&&(C=`${_}Encoded`);let $=s.get(b);$===void 0&&($=new Map,s.set(b,$));let H=$.get(C);return H===void 0&&(H={ast:b,identifier:C,fallback:_,occurrences:0,isRecursive:!1,reference:void 0},$.set(C,H)),H}function m(h){let S=d(h),b=S.ast;if(S.occurrences++,a.has(S)){S.isRecursive=!0;return}if(!(S.occurrences>1)){switch(a.add(S),x(b.checks),b._tag){case"Declaration":case"Arrays":case"Objects":case"Union":b.recur(C=>(m(C),C));break;case"TemplateLiteral":b.parts.forEach(m);break;case"Suspend":m(b.thunk());break}a.delete(S)}}function x(h){h?.forEach(S=>{S.annotations?.representation?.schemas?.forEach(b=>m(zt(b))),S._tag==="FilterGroup"&&x(S.checks)})}function y(h){let S=d(h),b=S.ast,C=S.reference;if(C!==void 0){let _=S.identifier===void 0?b:f(b,S,C);return p(C,_)}return E(b)}function E(h){let S=w(h.checks);switch(h._tag){case"Declaration":return{_tag:"Declaration",typeParameters:h.typeParameters.map(b=>y(b)),checks:S,...M(h.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:h._tag,checks:S,...ds(h.annotations)};case"Literal":return{_tag:"Literal",literal:h.literal,checks:S,...ds(h.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:h.symbol,checks:S,...ds(h.annotations)};case"Enum":return{_tag:"Enum",enums:h.enums,checks:S,...ds(h.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:h.parts.map(b=>y(b)),checks:S,...ds(h.annotations)};case"Arrays":return{_tag:"Arrays",elements:h.elements.map(b=>{let C=al(b),_=C.context?.annotations;return{isOptional:Or(C),type:y(b),...ds(_)}}),rest:h.rest.map(b=>y(b)),checks:S,...ds(h.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:h.propertySignatures.map(b=>{let C=al(b.type),_=C.context?.annotations;return{name:b.name,type:y(b.type),isOptional:Or(C),isMutable:J2(C),...ds(_)}}),indexSignatures:h.indexSignatures.map(b=>({parameter:y(b.parameter),type:y(b.type)})),checks:S,...ds(h.annotations)};case"Union":return{_tag:"Union",types:h.types.map(b=>y(b)),...h.options===void 0?{}:{options:h.options},checks:S,...ds(h.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:y(h.thunk()),...ds(h.annotations)}}}function w(h){return h?.map(T)??[]}function T(h){switch(h._tag){case"Filter":return{_tag:"Filter",aborted:h.aborted,...P(h.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:ar(h.checks,T),...P(h.annotations)}}}function M(h){if(h===void 0)return;let{representation:S,...b}=h;return{...S===void 0?void 0:{representation:S},...Object.keys(b).length===0?void 0:{annotations:b}}}function P(h){if(h===void 0)return;let{representation:S,...b}=h,C=S===void 0?void 0:S.schemas===void 0?S:{...S,schemas:S.schemas.map(_=>y(zt(_)))};return{...C===void 0?void 0:{representation:C},...Object.keys(b).length===0?void 0:{annotations:b}}}}function Tj(e){return et(e)?e.value:{issues:[{message:mM(e.cause)}]}}function Aj(e,t){let r=Ut(e),n={errors:"all",...t?.parseOptions},o=GU(t),s=a=>{let i=new wc("sync"),c=Yo(Pi(r(a,n),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:i});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?Tj(u):new Promise(f=>{c.addObserver(p=>{f(Tj(p))})})};if(Object.hasOwn(e,"~standard")){let a=e;return"validate"in a["~standard"]||Object.assign(a["~standard"],{validate:s}),a}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function Iee(e){let t=Cm(hl(e));return bS(t)}function kj(e,t){let r=Iee(e);if(t==="draft-2020-12"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t==="draft-07"){let n=sj(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function vj(e){let t={input(r){return kj(e.ast,r.target)},output(r){return kj(zt(e.ast),r.target)}};if(Object.hasOwn(e,"~standard")){let r=e;return"jsonSchema"in r["~standard"]||Object.assign(r["~standard"],{jsonSchema:t}),r}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function _j(e,t){let r=[];return aA(e,t,"",r),r}function aA(e,t,r,n){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)aA(e[i],t[i],`${r}/${i}`,n);for(let i=o-1;i>=s;i--)n.push({op:"remove",path:`${r}/${i}`});for(let i=o;i<s;i++)n.push({op:"add",path:`${r}/${i}`,value:t[i]});return}if(IS(e)&&IS(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${r}/${Qk(i)}`,u=Object.hasOwn(e,i),f=Object.hasOwn(t,i);u&&f?aA(e[i],t[i],c,n):!u&&f?n.push({op:"add",path:c,value:t[i]}):n.push({op:"remove",path:c})}return}n.push({op:"replace",path:r,value:t})}}function Pj(e,t){let r=t;for(let n of e)r=Tee(r,n);return r}function IS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wee(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Sm)}function Fj(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function Tee(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=kee(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let a=n==="-"?o.length:Fj(n),i=t.op==="add"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(a,0,t.value):t.op==="remove"?c.splice(a,1):c[a]=t.value,Oj(s,c)}if(IS(o)){if(t.op!=="add"&&!Object.hasOwn(o,n))throw new Error(`Property "${n}" does not exist at "${t.path}".`);let a={...o};return t.op==="remove"?delete a[n]:z(a,n,t.value),Oj(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function kee(e,t){let r=wee(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let a=0;a<r.length-1;a++){let i=r[a];if(Array.isArray(s)){let c=Fj(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(IS(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:n}}function Oj(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let a=o.slice();a[s]=r,r=a}else{let a={...o};z(a,s,r),r=a}}return r}function Mj(e){let t=gS(e),r=dS(t),n=pS(t);return{empty:[],diff:(o,s)=>_j(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=Pj(s,a);return Object.is(i,a)?o:n(i)}}}function $j(e,t){let r=Vf(e.ast)??Dw(e.ast),n=qB(yS(e));return o=>n(o).pipe(F(s=>vee(s,{rootName:r,...t})))}function vee(e,t){let r=t.rootName??"root",n=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",a=t.sortKeys??!0,i=new Set,c=[];return f(r,e,0),c.join(o?`
|
|
34
|
-
`:"");function u(p,d){c.push(o?s.repeat(p)+d:d)}function f(p,d,m,x){let{attrs:y,safe:E}=gl.tagInfo(p,x);if(d===void 0)u(m,`<${E}${y}/>`);else if(typeof d=="string")u(m,`<${E}${y}>${gl.escapeText(d)}</${E}>`);else if(typeof d!="object"||d===null)u(m,`<${E}${y}>${gl.escapeText(j(d))}</${E}>`);else{if(i.has(d))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:d});i.add(d);try{if(globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${E}${y}/>`);return}u(m,`<${E}${y}>`);for(let M of d)f(n,M,m+1);u(m,`</${E}>`);return}let w=d,T=Object.keys(w);if(a&&T.sort(),T.length===0){u(m,`<${E}${y}/>`);return}u(m,`<${E}${y}>`);for(let M of T)f(gl.parseTagName(M).safe,w[M],m+1,M);u(m,`</${E}>`)}finally{i.delete(d)}}}}var gl={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r="_"+r),r=r.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(r)&&(r="_"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=gl.parseTagName(e),s=r||t&&t!==e?` data-name="${gl.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var iA=No(e=>Ji(e));function Ji(e){let t=za(e)?.toEquivalence;if(t)return t(nl(e)?e.typeParameters.map(Ji):[]);switch(e._tag){case"Never":return Yu();case"Declaration":return _ee(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return Z;case"Arrays":{let r=e.elements.map(Ji),n=e.rest.map(Ji),[o,...s]=n,a=s.length;return Ur((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let u=i.length;if(u!==c.length)return!1;let f=0;for(;f<Math.min(u,e.elements.length);f++)if(!r[f](i[f],c[f]))return!1;if(n.length>0){for(;f<u-a;f++)if(!o(i[f],c[f]))return!1;for(let p=0;p<a;p++)if(!s[p](i[f+p],c[f+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Z;let r=e.propertySignatures.map(o=>Ji(o.type)),n=e.indexSignatures.map(o=>Ji(o.type));return Ur((o,s)=>{if(!Dn(o)||!Dn(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,u=Object.hasOwn(o,c),f=Object.hasOwn(s,c);if(Or(i.type)&&u!==f||u&&f&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=zi(o,i.parameter),u=zi(s,i.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let p=c[f];if(!Object.hasOwn(s,p)||!n[a](o[p],s[p]))return!1}}return!0})}case"Union":{let r=zt(e).types,n=nm(r),o=r.map((s,a)=>[ym(s),Ji(e.types[a])]);return Ur((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[u,f]=o[i[c]];if(u(s)&&u(a))return f(s,a)}return!1})}case"Suspend":{let r;return Ur((n,o)=>(r??=iA(e.thunk()))(n,o))}}}function _ee(e){let t=e.annotations?.representation;if(t===void 0)return Z;switch(t.id){case"effect/schema/Option":{let[r]=Iu(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Iu(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?r(o.success,s.success):n(o.failure,s.failure))}case"effect/schema/CauseReason":{let[r,n]=Iu(e);return Uj(r,n)}case"effect/schema/Cause":{let[r,n]=Iu(e);return Nj(r,n)}case"effect/schema/Exit":{let[r,n,o]=Iu(e),s=Nj(n,o);return(a,i)=>a._tag===i._tag&&(a._tag==="Success"?r(a.value,i.value):s(a.cause,i.cause))}case"effect/schema/ReadonlyMap":{let[r,n]=Iu(e);return Ch(r,n)}case"effect/schema/ReadonlySet":return sp(Iu(e)[0]);case"effect/schema/RegExp":return(r,n)=>r.source===n.source&&r.flags===n.flags;case"effect/schema/URL":return(r,n)=>r.toString()===n.toString();default:return Z}}function Iu(e){return e.typeParameters.map(Ji)}function Uj(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case"Fail":return e(r.error,n.error);case"Die":return t(r.defect,n.defect);case"Interrupt":return r.fiberId===n.fiberId}}}function Nj(e,t){let r=_h(Uj(e,t));return(n,o)=>r(n.reasons,o.reasons)}function Lj(e,t){return r=>{switch(r._tag){case"Fail":return`Fail(${e(r.error)})`;case"Die":return`Die(${t(r.defect)})`;case"Interrupt":return"Interrupt"}}}function Dj(e,t){let r=Lj(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function Bj(e,t){let r=new Map;return n(e);function n(a){let i=r.get(a);return i===void 0&&(i=o(a),r.set(a,i)),i}function o(a){let i=za(a)?.toFormatter;if(typeof i=="function")return i(nl(a)?a.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(a,n);if(c!==void 0)return c}return s(a)}function s(a){switch(a._tag){default:return j;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let i=a.annotations?.representation;if(i===void 0)return j;let c=a.typeParameters.map(n);switch(i.id){case"effect/schema/Option":{let[u]=c;return Le({onNone:()=>"none()",onSome:f=>`some(${u(f)})`})}case"effect/schema/Result":{let[u,f]=c;return cn({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${f(p)})`})}case"effect/schema/CauseReason":return Lj(c[0],c[1]);case"effect/schema/Cause":return Dj(c[0],c[1]);case"effect/schema/Exit":{let[u,f,p]=c,d=Dj(f,p);return m=>{switch(m._tag){case"Success":return`Exit.Success(${u(m.value)})`;case"Failure":return`Exit.Failure(${d(m.cause)})`}}}case"effect/schema/ReadonlyMap":{let[u,f]=c;return p=>{let d=p.size;if(d===0)return"ReadonlyMap(0) {}";let m=globalThis.Array.from(p.entries()).sort().map(([x,y])=>`${u(x)} => ${f(y)}`);return`ReadonlyMap(${d}) { ${m.join(", ")} }`}}case"effect/schema/HashMap":{let[u,f]=c;return p=>{let d=oB(p);if(d===0)return"HashMap(0) {}";let m=dm(p).sort().map(([x,y])=>`${u(x)} => ${f(y)}`);return`HashMap(${d}) { ${m.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[u]=c;return f=>{let p=f.size;if(p===0)return"ReadonlySet(0) {}";let d=globalThis.Array.from(f.values()).sort().map(m=>`${u(m)}`);return`ReadonlySet(${p}) { ${d.join(", ")} }`}}case"effect/schema/HashSet":{let[u]=c;return f=>{let p=uB(f);if(p===0)return"HashSet(0) {}";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`HashSet(${p}) { ${d.join(", ")} }`}}case"effect/schema/Chunk":{let[u]=c;return f=>{let p=Z$(f);if(p===0)return"Chunk(0) {}";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`Chunk(${p}) { ${d.join(", ")} }`}}default:return j}}case"Arrays":{let i=a.elements.map(d=>n(d)),c=a.rest.map(n),[u,...f]=c,p=f.length;return d=>{let m=[],x=0;for(;x<i.length;x++)if(d.length<x+1){if(Or(a.elements[x]))continue}else m.push(i[x](d[x]));if(c.length>0){for(;x<d.length-p;x++)m.push(u(d[x]));for(let y=0;y<p;y++)m.push(f[y](d[x+y]))}return"["+m.join(", ")+"]"}}case"Objects":{let i=a.propertySignatures.map(u=>n(u.type)),c=a.indexSignatures.map(u=>n(u.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?j:u=>{let f=[],p=new Set;for(let d=0;d<i.length;d++){let m=a.propertySignatures[d],x=m.name;p.add(x),!(Or(m.type)&&!Object.hasOwn(u,x))&&f.push(`${Ts(x)}: ${i[d](u[x])}`)}for(let d=0;d<c.length;d++){let m=zi(u,a.indexSignatures[d].parameter);for(let x of m)p.has(x)||(p.add(x),f.push(`${Ts(x)}: ${c[d](u[x])}`))}return f.length>0?"{ "+f.join(", ")+" }":"{}"}}case"Union":{let i=zt(a).types,c=nm(i),u=i.map((f,p)=>[ym(f),n(a.types[p])]);return f=>{let p=c(f,!1);for(let d=0;d<p.length;d++){let[m,x]=u[p[d]];if(m(f))return x(f)}return j(f)}}case"Suspend":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var cA=l(2,(e,t)=>lA(e,(r,n)=>zj(t,r)?[r,n]:void 0)),uA=l(2,(e,t)=>lA(e,(r,n)=>zj(t,r)?void 0:[r,n])),jj=l(2,(e,t)=>({...e,...t}));var fA=l(2,(e,t)=>lA(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var tn=e=>e;function zj(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function lA(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,a]=o;z(r,s,a)}}return r}function Wj(e,t){return ms(xl("Iso",e,t))}function Hj(e,t){return ms(xl("Lens",e,t))}function xl(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var Ree={kind:"Iso",get:D,set:D},CS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=wS(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];z(s,i,wS(s[i])),s=s[i]}return z(s,t[a],r),o}}},wm=class{_tag="CheckNode";kind="Prism";checks;get;set=D;constructor(t){this.checks=t,this.get=r=>rL(t,r)}};function Cu(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?r[r.length-1]=new CS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new wm([...s.checks,...o.checks]):r.push(o)}return r}function Mee(e,t){return ms(xl("Optional",e,t))}var yl=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Sp(this.replaceResult(t,r),()=>r)}modify(t){return r=>Sp(sr(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return ms(Cu(this.node,t.node))}key(t){return ms(Cu(this.node,[new CS([t])]))}optionalKey(t){return ms(Cu(this.node,xl("Lens",r=>r[t],(r,n)=>{let o=wS(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&sf(t))?o.splice(Number(t),1):delete o[t]:z(o,t,r),o})))}check(...t){return ms(Cu(this.node,[new wm(t)]))}refine(t,r){return ms(Cu(this.node,[new wm([By(t,r)])]))}tag(t){let r=X(new he({expected:`${JSON.stringify(t)} tag`}));return ms(Cu(this.node,xl("Prism",n=>n._tag===t?G(n):r,D)))}at(t,...r){let n=X(new Yt([t],new ji(void 0)));return ms(Cu(this.node,xl("Optional",o=>Object.hasOwn(o,t)?G(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=wS(s);return z(a,t,o),G(a)}else return n})))}pick(t){return this.compose(Hj(cA(t),(r,n)=>({...uA(n,t),...r})))}omit(t){return this.compose(Hj(uA(t),(r,n)=>({...cA(n,t),...r})))}notUndefined(){return this.refine(Tt,{expected:"a value other than `undefined`"})}forEach(t){let r=t(TS());return Mee(n=>gr(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);xt(i)&&s.push(i.success)}return s}),(n,o)=>sr(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)xt(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return X(new he({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let u=a[c],f=r.replaceResult(n[c],s[u]);if(be(f))return X(new Yt([u],f.failure));i[u]=f.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Sp(sr(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},dA=class extends yl{get;set;constructor(t,r,n){super(t,o=>G(r(o)),o=>G(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},mA=class extends yl{get;constructor(t,r,n){super(t,o=>G(r(o)),(o,s)=>G(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},hA=class extends yl{set;constructor(t,r,n){super(t,r,(o,s)=>G(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Sp(gr(this.getResult(r),n=>this.set(t(n))),()=>r)}};function ms(e){let t=e[0]??Ree;if(e.length>1){let r=e.reduce((n,o)=>Uee(n,o.kind),"Iso");t={kind:r,get:$ee(e,r),set:Nee(e,r)}}switch(t.kind){case"Iso":return new dA(e,t.get,t.set);case"Lens":return new mA(e,t.get,t.set);case"Prism":return new hA(e,t.get,t.set);case"Optional":return new yl(e,t.get,t.set)}}function wS(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function $ee(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(gA(o.kind)){if(be(s))return s;r=s.success}else r=s}return gA(t)?G(r):r}}function Nee(e,t){return qj(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=n;let i=e[a];if(gA(i.kind)){let c=i.get(n);if(be(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(qj(i.kind))r=i.set(r);else if(i.kind==="Lens")r=i.set(r,s[a]);else{let c=i.set(r,s[a]);if(be(c))return c;r=c.success}}return t==="Optional"?G(r):r}}function gA(e){return e==="Prism"||e==="Optional"}function qj(e){return e==="Iso"||e==="Prism"}function Uee(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var Dee=ms([]);function TS(){return Dee}function Gj(e){let t=xS(e);return Wj(dS(t),pS(t))}function Kj(e){return TS()}function Jj(e){return TS()}var Sl="~effect/Schema/SchemaError";function Zj(e){return O(e,Sl)&&e[Sl]===Sl}var oo="~effect/net/NetAddress";var hs=e=>e.value,gs=e=>e,Ja=e=>e.bytes,Fo=class extends mo("NetAddressError"){},El=e=>O(e,oo),_r=e=>El(e)&&e._tag==="Ipv4Address",Ro=e=>El(e)&&e._tag==="Ipv6Address",xA=e=>_r(e)||Ro(e),bl=e=>_r(e)?32:128;var Il=e=>El(e)&&e._tag==="MacAddress",km=e=>El(e)&&e._tag==="InetAddressV4",Am=e=>El(e)&&e._tag==="InetAddressV6",yA=e=>km(e)||Am(e),kS=e=>El(e)&&e._tag==="UnixPathAddress",Qj=e=>yA(e)||kS(e),Bee={...Pt,_tag:"Ipv4Address",[oo]:oo,[ie](e){return _r(e)&&hs(this)===hs(e)},[ae](){return Er(xe(qee,hs(this)|0))},toString(){return Pr(this)},toJSON(){return this.toString()}},jee={...Pt,_tag:"Ipv6Address",[oo]:oo,[ie](e){if(!Ro(e))return!1;let t=gs(this),r=gs(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ae](){let e=gs(this),t=xe(Wee,e.w0|0);return t=xe(t,e.w1|0),t=xe(t,e.w2|0),Er(xe(t,e.w3|0))},toString(){return Pr(this)},toJSON(){return this.toString()}},zee={...Pt,_tag:"MacAddress",[oo]:oo,[ie](e){return Il(e)&&Hee(Ja(this),Ja(e))},[ae](){return xe(Vee,ws(Ja(this)))},toString(){return bA(this)},toJSON(){return this.toString()}},Hee=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},qee=De("Ipv4Address"),Wee=De("Ipv6Address"),Vee=De("MacAddress"),Gee=e=>{let t=Object.create(Bee);return t.value=e>>>0,Object.freeze(t)},Kee=(e,t,r,n)=>{let o=Object.create(jee);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},Jee=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var Tm=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],Zee=e=>{let t=Object.assign(Object.create(zee),{bytes:new Uint8Array(e)});return Object.freeze(t)};var wt=(e,t)=>X(new Fo({input:e,message:t})),Yj=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(!Number.isInteger(n)||n<0||n>t)return!1}return!0},Qee=e=>Yj(e,255)?G(Gee(Jee(e[0],e[1],e[2],e[3]))):wt(e,"octets must be integers from 0 through 255"),Yee=e=>Yj(e,65535)?G(Kee(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):wt(e,"segments must be integers from 0 through 65535");var Xj=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?G(Zee(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):wt(e,"expected six two-digit hexadecimal octets separated by colons");var wu=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return wt(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return wt(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?wt(e,"octets must be at most 255"):Qee([r[0],r[1],r[2],r[3]])},Xee=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return wt(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return wt(e,"only one compression marker is allowed");let r=t[0]===""?[]:t[0].split(":"),n=t.length===2&&t[1]!==""?t[1].split(":"):[];if(r.some(f=>f==="")||n.some(f=>f===""))return wt(e,"empty segments are only valid in the compression marker");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:"",s;if(o.includes(".")){if(t.length===2&&n.length===0)return wt(e,"embedded IPv4 syntax must be trailing");let f=gr(wu(o),p=>{let d=hs(p);return[d>>>16,d&65535]});if(be(f))return f;s=f.success,n.length>0?n.pop():r.pop()}let a=r.length+n.length+(s?2:0);if(t.length===1?a!==8:a>=8)return wt(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let i=f=>/^[0-9a-fA-F]{1,4}$/.test(f)?Number.parseInt(f,16):void 0,c=r.map(i),u=n.map(i);return c.some(f=>f===void 0)||u.some(f=>f===void 0)?wt(e,"segments must contain one through four hexadecimal digits"):G([...c,...Array(8-a).fill(0),...u,...s??[]])},Tu=e=>sr(Xee(e),t=>Yee(t)),Zi=e=>e.includes(":")?Tu(e):wu(e);var SA=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=vm(e);return xt(t)&&t.success===e},vm=e=>{let t=e.indexOf("%");if(t===-1)return wt(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return wt(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return wt(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return gr(Tu(e.slice(0,t)),n=>`${Pr(n)}%${r}`)};var AS=e=>Tm(hs(e)),ete=e=>{let{w0:t,w1:r,w2:n,w3:o}=gs(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},EA=e=>{let{w0:t,w1:r,w2:n,w3:o}=gs(e);return[...Tm(t),...Tm(r),...Tm(n),...Tm(o)]};var bA=e=>Array.from(Ja(e),t=>t.toString(16).padStart(2,"0")).join(":"),vS=e=>Ja(e).every(t=>t===255),tte=e=>(Ja(e)[0]&1)!==0,OS=e=>(Ja(e)[0]&1)===0,IA=e=>(Ja(e)[0]&2)!==0,CA=e=>(Ja(e)[0]&2)===0;var Pr=e=>{if(_r(e))return AS(e).join(".");let t=ete(e);if(rte(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let i=0;i<=8;i++)i<8&&t[i]===0?o===-1&&(o=i):o!==-1&&(i-o>n&&(r=o,n=i-o),o=-1);if(n<2)return t.map(i=>i.toString(16)).join(":");let s=t.slice(0,r).map(i=>i.toString(16)).join(":"),a=t.slice(r+n).map(i=>i.toString(16)).join(":");return`${s}::${a}`},_S=e=>{if(_r(e))return hs(e)===0;let{w0:t,w1:r,w2:n,w3:o}=gs(e);return t===0&&r===0&&n===0&&o===0},wA=e=>{if(_r(e))return hs(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=gs(e);return t===0&&r===0&&n===0&&o===1},Cl=e=>Il(e)?tte(e):_r(e)?hs(e)>>>28===14:gs(e).w0>>>24===255,PS=e=>Il(e)?vS(e):hs(e)===4294967295,TA=e=>Il(e)?OS(e):!Cl(e)&&!_S(e)&&(!_r(e)||!PS(e)),kA=e=>_r(e)?hs(e)>>>16===43518:(gs(e).w0>>>16&65472)===65152,AA=e=>{let t=hs(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},vA=e=>(gs(e).w0>>>24&254)===252,rte=e=>{let{w0:t,w1:r,w2:n}=gs(e);return t===0&&r===0&&n===65535};var nte={...Pt,_tag:"InetAddressV4",[oo]:oo,[ie](e){return km(e)&&this.port===e.port&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.port))},toString(){return FS(this)},toJSON(){return this.toString()}},ote={...Pt,_tag:"InetAddressV6",[oo]:oo,[ie](e){return Am(e)&&this.port===e.port&&this.scopeId===e.scopeId&&Z(this.address,e.address)},[ae](){return xe(xe(Y(this.address),Wt(this.port)),Wt(this.scopeId))},toString(){return FS(this)},toJSON(){return this.toString()}},ez=e=>Number.isInteger(e)&&e>=0&&e<=65535,ste=(e,t)=>{if(!ez(t))return wt(e,"port must be an integer from 0 through 65535");let r=Object.create(nte);return r.address=e,r.port=t,G(Object.freeze(r))},ate=(e,t,r)=>{if(!ez(t))return wt(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return wt(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(ote);return o.address=e,o.port=t,o.scopeId=n,G(Object.freeze(o))};var OA=e=>{let t,r,n=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return wt(e,"expected [IPv6]:port");t=e.slice(1,s),r=e.slice(s+2);let a=t.indexOf("%");if(a!==-1){let i=t.slice(a+1);if(t.indexOf("%",a+1)!==-1||!/^\d+$/.test(i))return wt(e,"scope identifier must be decimal");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return wt(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,a)}}else{let s=e.lastIndexOf(":");if(s<0)return wt(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return wt(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?sr(Zi(t),s=>o!==Ro(s)?wt(e,"only IPv6 addresses use brackets"):Ro(s)?ate(s,Number(r),{scopeId:n}):ste(s,Number(r))):wt(e,"port must be an unpadded decimal integer")};var ite=e=>Pr(e.address)+(Am(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var FS=e=>{let t=ite(e);return km(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var cte={...Pt,_tag:"UnixPathAddress",[oo]:oo,[ie](e){return kS(e)&&this.path===e.path},[ae](){return xe(De("UnixPathAddress"),De(this.path))},toString(){return this.path},toJSON(){return this.toString()}},tz=e=>{let t=Object.create(cte);return t.path=e,Object.freeze(t)};var _A="~effect/net/Host",Qi=(e,t)=>X(new Fo({input:e,message:t})),ute=/^[a-z0-9_.-]$/i,fte=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,lte=/^(?:\d+|0x[0-9a-f]*)$/,rz=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let r=t.split(".");for(let n of r){if(n.length===0)return"domain name labels must not be empty";if(n.length>63)return"domain name labels must be at most 63 characters";if(!fte.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(lte.test(r[r.length-1]))return"the last domain name label must not be numeric"},pte=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!ute.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},Za=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&rz(e)===void 0;var FA=e=>O(e,_A),RS=e=>{let t=pte(e);if(t===void 0)return Qi(e,"invalid domain name");let r=rz(t);return r===void 0?G(t):Qi(e,r)};var dte=e=>{if(e.includes("%"))return vm(e);if(e.includes(":"))return Zi(e);if(/^[\d.]+$/.test(e)){let t=Zi(e);if(xt(t))return t}return RS(e)};var mte=e=>typeof e=="string"?e:Pr(e);var hte={...Pt,_tag:"HostPort",[_A]:_A,[ie](e){return FA(e)&&this.port===e.port&&Z(this.host,e.host)},[ae](){return xe(Y(this.host),Wt(this.port))},toString(){return RA(this)},toJSON(){return this.toString()}},gte=e=>Number.isInteger(e)&&e>=0&&e<=65535,xte=(e,t)=>{let r=Object.create(hte);return r.host=e,r.port=t,Object.freeze(r)};var nz=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return Qi(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return Qi(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return Qi(e,"expected host:port");if(e.indexOf(":")!==o)return Qi(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return Qi(e,"port must be an unpadded decimal integer");let n=Number(r);return gte(n)?gr(dte(t),o=>xte(o,n)):Qi(e,"port must be an integer from 0 through 65535")};var RA=e=>{let t=mte(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var $A="~effect/net/Dns/DnsRecord",MA=e=>Number.isInteger(e)&&e>=0&&e<=255,wl=e=>Number.isInteger(e)&&e>=0&&e<=65535,az=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,Yi=e=>typeof e=="string",MS=e=>Cp(e)&&Rs(e)&&az(Ms(e)),iz={A:{address:_r},AAAA:{address:Ro},CAA:{critical:e=>typeof e=="boolean",tag:e=>Yi(e)&&/^[a-z0-9]+$/i.test(e),value:Yi},CNAME:{target:Za},MX:{exchange:Za,priority:wl},NAPTR:{order:wl,preference:wl,flags:Yi,service:Yi,regexp:Yi,replacement:Za},NS:{host:Za},PTR:{host:e=>Yi(e)&&e.length>0},SOA:{primary:Za,admin:e=>Yi(e)&&e.length>0,serial:az,refresh:MS,retry:MS,expire:MS,minimum:MS},SRV:{target:Za,port:wl,priority:wl,weight:wl},TLSA:{certUsage:MA,selector:MA,matchingType:MA,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(Yi)}},NA=Object.keys(iz),yte=e=>NA.includes(e),UA=e=>O(e,$A),Ste={...Pt,[$A]:$A,[ie](e){return UA(e)&&e._tag===this._tag&&Object.keys(this).every(t=>Z(this[t],e[t]))},[ae](){return np(this,Object.keys(this))},toString(){return bte(this)},toJSON(){return{...this}}},cz=(e,t)=>{if(!yte(e))return X(new Fo({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(Ste);n._tag=e;for(let[o,s]of Object.entries(iz[e])){let a=r[o];if(!s(a))return X(new Fo({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(a)?Object.freeze([...a]):a instanceof Uint8Array?new Uint8Array(a):a}return G(Object.freeze(n))};var uz=new TextEncoder,fz=e=>`\\${e.toString().padStart(3,"0")}`,_m=e=>{let t='"';for(let r of uz.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?fz(r):String.fromCharCode(r);return t+'"'},Ete=[34,36,40,41,59,64],sz=e=>{let t=uz.encode(e),r="";for(let n=0;n<t.length;n++){let o=t[n];if(o===92){let s=t[n+1];s===46||s===92?(r+=`\\${String.fromCharCode(s)}`,n++):r+="\\\\"}else o<=32||o>126?r+=fz(o):r+=Ete.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},bte=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Pr(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${_m(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${_m(e.flags)} ${_m(e.service)} ${_m(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${sz(e.host)}`;case"SOA":return`SOA ${e.primary} ${sz(e.admin)} ${e.serial} ${Ms(e.refresh)} ${Ms(e.retry)} ${Ms(e.expire)} ${Ms(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${ig(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(_m).join(" ")}`}};var DA="~effect/net/IpInterface",lz=e=>Pm(e)&&_r(e.address),pz=e=>Pm(e)&&Ro(e.address),Pm=e=>O(e,DA),Tte={...Pt,_tag:"IpInterface",[DA]:DA,[ie](e){return Pm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.prefixLength))},toString(){return Rm(this)},toJSON(){return this.toString()}},LA=(e,t)=>X(new Fo({input:e,message:t})),Fm=(e,t)=>{let r=bl(e);if(!Number.isInteger(t)||t<0||t>r)return LA(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(Tte),{address:e,prefixLength:t});return G(Object.freeze(n))},BA=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return G({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return LA(e,"expected an address and prefix length separated by one slash");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?G({address:e.slice(0,r),prefixLength:Number(n)}):LA(e,"prefix length must be an unpadded ASCII decimal integer")},$S=(e,t)=>sr(BA(e,t),r=>sr(wu(r.address),n=>Fm(n,r.prefixLength??bl(n)))),NS=(e,t)=>sr(BA(e,t),r=>sr(Tu(r.address),n=>Fm(n,r.prefixLength??bl(n)))),US=(e,t)=>sr(BA(e,t),r=>sr(Zi(r.address),n=>Fm(n,r.prefixLength??bl(n))));var Rm=e=>`${Pr(e.address)}/${e.prefixLength}`;var jA="~effect/net/IpNetwork",mz=e=>Mm(e)&&_r(e.address),hz=e=>Mm(e)&&Ro(e.address),Mm=e=>O(e,jA),kte={...Pt,_tag:"IpNetwork",[jA]:jA,[ie](e){return Mm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.prefixLength))},toString(){return $m(this)},toJSON(){return this.toString()}},Ate=e=>{let t=Object.assign(Object.create(kte),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},vte=e=>_r(e)?AS(e):EA(e);var Ote=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},zA=(e,t)=>sr(Fm(e,t),r=>{let n=vte(e),o=Ote(n,t);return n.some((s,a)=>s!==o[a])?X(new Fo({input:e,message:"address has non-zero host bits"})):G(Ate(r))});var gz=e=>sr($S(e,{prefix:"required"}),t=>zA(t.address,t.prefixLength)),xz=e=>sr(NS(e,{prefix:"required"}),t=>zA(t.address,t.prefixLength)),yz=e=>sr(US(e,{prefix:"required"}),t=>zA(t.address,t.prefixLength));var $m=e=>`${Pr(e.address)}/${e.prefixLength}`;var Nm=hS;function An(){return(e,t,r)=>te(new ol(e.map(rm),n=>t(n.map(o=>te(o))),r))}function Ve(e,t){return An()([],()=>(r,n,o)=>e(r)?g(r):k(new $t(n,r,o)),t)}function Pte(e){return e}function Fte(e){return t=>t.annotate(e)}function Rte(e){return t=>qA(qA(t).annotate(e))}function Mte(e){return t=>t.rebuild(am(t.ast,e))}function $te(e){return e}var Au=class extends mo("SchemaError"){[Sl]=Sl;constructor(t){let r=Do();br(0);try{super({issue:t})}finally{br(r)}}get message(){return KU(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[ot](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function Fz(e){return Zj(e)}function Rz(e){return je(e)?JA(e):Ct(e,t=>Oa(()=>Ci(t,r=>new Au(r))))}function JA(e){return et(e)?e:Vn(Ci(e.cause,t=>new Au(t)))}function Mz(e,t){let r;for(let n of e.reasons){if(!Vg(n)||!Fz(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function $z(e){return Cx(e).then(t=>{if(et(t))return t.value;throw Mz(t.cause,"Promise adapter can only reject schema errors")})}function Nz(e){let t=Vs(e);if(et(t))return t.value;throw Mz(t.cause,"Sync adapter can only throw schema errors")}function Nte(e,t){return Aj(e,t)}function Ute(e){return vj(e)}var LS=Hk,Dte=BB;function Xa(e,t){let r=Ut(e,t);return(n,o)=>Rz(r(n,o))}var Lte=Xa;function Uz(e,t){let r=jB(e,t);return(n,o)=>JA(r(n,o))}var Bte=Uz,jte=Wk,zte=zB;function Dz(e,t){let r=HB(e,t);return(n,o)=>Gh(r(n,o),s=>new Au(s))}var Hte=Dz;function Lz(e,t){let r=Xa(e,t);return(n,o)=>$z(r(n,o))}var qte=Lz;function Bz(e,t){let r=Xa(e,t);return(n,o)=>Nz(r(n,o))}var Wte=Bz;function BS(e,t){let r=Eu(e,t);return(n,o)=>Rz(r(n,o))}var Vte=BS;function jz(e,t){let r=WB(e,t);return(n,o)=>JA(r(n,o))}var Gte=jz,Kte=Vk,Jte=VB;function zz(e,t){let r=GB(e,t);return(n,o)=>Gh(r(n,o),s=>new Au(s))}var Zte=zz;function Hz(e,t){let r=BS(e,t);return(n,o)=>$z(r(n,o))}var Qte=Hz;function qz(e,t){let r=BS(e,t);return(n,o)=>Nz(r(n,o))}var Yte=qz,te=ps;function jS(e){return O(e,Nm)&&e[Nm]===Nm}var Qa=tn(e=>te(pu(e.ast),{schema:e})),Xte=tn(e=>e.schema),ei=tn(e=>{let t=VS(e);return te(V2(e.ast),{schema:t})}),ere=tn(e=>e.schema.members[0]),tre=tn(e=>te(NT(e.ast),{schema:e})),rre=tn(e=>e.schema),vn=tn(e=>te(zt(e.ast),{schema:e})),Ol=tn(e=>te(cs(e.ast),{schema:e})),Um="~effect/Schema/flip";function nre(e){return O(e,Um)&&e[Um]===Um}function qA(e){return nre(e)?e.schema.rebuild(to(e.ast)):te(to(e.ast),{[Um]:Um,schema:e})}function Ht(e){let t=te(new eo(e),{literal:e,transform(r){return t.pipe(se(Ht(r),{decode:Ee(()=>r),encode:Ee(()=>e)}))}});return t}function Wz(e){return e.map(t=>jS(t)?t.ast:new eo(t))}function ore(e){return te(new wT(Wz(e)),{parts:e})}function sre(e){return te(T2(Wz(e)),{parts:e})}function are(e){return te(new w2(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var ire=te(CT),cre=te(I2),Dm=te(qa),zS=te(bT),ZA=te(IT),B=te(Xn),ure=B,Lm=te(TT),HS=te(v2),Vz=te(O2),_l=te(_2),fre=te(b2),lre=te(C2);function pre(e){return te(new A2(e))}function QA(e,t){return te(e,{fields:t,mapFields(r,n){let o=r(this.fields);return QA(Uy(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function He(e){return QA(Uy(e,void 0),e)}function dre(e){return tn(t=>t.mapFields(jj(e)))}var mre=e=>typeof e=="symbol"?e:globalThis.String(e);function hre(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=Ol(t.fields[a]),c=Object.hasOwn(e,a),u=c?e[a]:a,f=mre(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${Ts(u)}`);s.add(f),z(r,u,i),c&&(n[a]=u,o[u]=a)}return He(r).pipe(se(t,Ne({decode:fA(o),encode:fA(n)})))}}function gre(e,t){return r=>{let n=Kh(r.fields,vn),o=He({...n,...e});return r.pipe(se(o,Ne({decode:s=>{let a={...s};for(let i in e){let c=t[i],u=c(s);fe(u)&&z(a,i,u.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function vu(e,t){return te(K2(e.ast,t.ast),{key:e,value:t})}function xre(e,t){return te($2(e.ast,t.map(rm)),{schema:e,records:t})}function Gz(e,t){return te(e,{elements:t,mapElements(r,n){let o=r(this.elements);return Gz(OT(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function aa(e){return Gz(OT(e),e)}function yre(e,t){return te(N2(e.ast,t.map(rm)),{schema:e,rest:t})}var Pe=tn(e=>te(new _o(!1,[],[e.ast]),{value:e}));function qS(e,t,r){return t!==void 0&&r!==void 0?e.check(nv(t,r)):t!==void 0?e.check(fH(t)):r!==void 0?e.check(dH(r)):e}var WS=tn(e=>te(new _o(!1,[e.ast],[e.ast]),{value:e}));function Sre(e){let t=Pe(e),r=Pe(vn(e)),n=se(aa([Dm]),Ne({decode:o=>[o],encode:([o])=>o}))(e);return te(ht([n,t]).pipe(se(r)).ast,{from:ht([e,t]),to:r})}function Ere(e){return Pe(e).check(sv())}var bre=tn(e=>te(U2(e.ast),{schema:e}));function Kz(e,t){return te(e,{members:t,mapMembers(r,n){let o=r(this.members);return Kz(Dy(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function ht(e,t){return Kz(Dy(e,t,void 0),e)}function ti(e){let t=e.map(Ht);return te(Dy(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return ht(r(this.members))},pick(r){return ti(r)},transform(r){return ht(t.map((n,o)=>n.transform(r[o])))}})}var YA=tn(e=>ht([e,zS])),VS=tn(e=>ht([e,ZA])),Jz=tn(e=>ht([e,zS,ZA]));function Zz(e){return te(new PT(()=>e().ast))}function Ire(...e){return t=>t.check(...e)}function Qz(e,t){return r=>te(na(r.ast,[By(e,t)]),{schema:r})}function GS(e){return t=>te(t.ast,{schema:t,identifier:e})}function Cre(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(GS(e))}function Yz(e){return t=>te(q2(t.ast,new vy(e,D)),{schema:t})}function Xz(e){return t=>te(W2(t.ast,new vy(D,e)),{schema:t})}function wre(e){return eH(e)}function eH(e){return t=>Yz(hd(e))(t)}function Tre(e){return tH(e)}function tH(e){return t=>Xz(hd(e))(t)}function se(e,t){return r=>te(cl(r.ast,e.ast,t?Oy(t):Qf()),{from:r,to:e})}function Pl(){return(e,t)=>Fe()(e,{decode:t,encode:mD})}var KS=ti(["true","yes","on","1","y"]),JS=ti(["false","no","off","0","n"]),XA=ti([...KS.literals,...JS.literals]).pipe(se(HS,Ne({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function kre(e){return t=>se(vn(t),e)(t)}function ev(e,t){return r=>t?se(r,t)(e):se(r)(e)}function Are(e){return t=>se(t,e)(Ol(t))}function rH(e){return t=>te(G2(t.ast,e),{schema:t})}function nH(e){return je(e)&&e._tag==="Success"?e:Ct(e,t=>Oa(()=>Ci(t,r=>r.issue)))}function tv(e,t){let r=t?.encodingStrategy==="omit"?Xw():ea();return n=>Qa(Ol(n)).pipe(se(n,{decode:eT(nH(e)),encode:r}))}function vre(e,t){return r=>vn(r).pipe(tv(e,t),ev(Qa(r)))}function oH(e,t){let r=t?.encodingStrategy==="omit"?Xw():ea();return n=>ei(Ol(n)).pipe(se(n,{decode:eT(nH(e)),encode:r}))}function Ore(e,t){return r=>vn(r).pipe(oH(e,t),ev(ei(r)))}function Ya(e){return Ht(e).pipe(rH(g(e)))}function _re(e){return Ya(e).pipe(tv(g(e),{encodingStrategy:"omit"}))}function Bm(e,t){return He({_tag:Ya(e),...t})}function sH(e){return t=>{let r={},n=[],o=new Set,s={},a=f=>p=>f.includes(p[e]);return i(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:u});function i(f){let p=f.ast;if(y2(p)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(jS))return f.members.forEach(i);let d=tl(p);if(d.length>0){let m=d.find(x=>x.key===e)?.literal;if(Eh(m)){let x=typeof m=="number"?globalThis.String(m):m;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(x),n.push(m),z(r,m,f),z(s,m,Hk(vn(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let x=arguments[0];return function(y){let E=y[e];return(Object.hasOwn(x,E)?x[E]:void 0)(y)}}let f=arguments[0],p=arguments[1],d=f[e];return(Object.hasOwn(p,d)?p[d]:void 0)(f)}function u(){if(arguments.length===2){let y=arguments[0],E=arguments[1];return function(w){let T=w[e];return(Object.hasOwn(y,T)?y[T]??E:E)(w)}}let f=arguments[0],p=arguments[1],d=arguments[2],m=f[e];return(Object.hasOwn(p,m)?p[m]??d:d)(f)}}}function Pre(e){let t={},r=[];for(let u of Object.keys(e)){let f=Bm(u,e[u]);z(t,u,f),r.push(f)}let n=ht(r),{tag:o,guards:s,isAnyOf:a,match:i,matchOrElse:c}=sH("_tag")(n);return te(n.ast,{tag:o,cases:t,isAnyOf:a,guards:s,match:i,matchOrElse:c})}function Fre(){return e=>e}function Xi(e,t){return Ve(r=>r instanceof e,t)}function Fe(){return(e,t)=>new Ot(e.ast,Oy(t))}var Ue=Ly;function Rre(e,t=void 0){return new cu(e,t)}var Sz="^\\S[\\s\\S]*\\S$|^\\S$|^$";function aH(e){let t=new globalThis.RegExp(Sz);return Ue(r=>r.trim()===r,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitraryConstraint:{patterns:[{source:Sz,flags:""}]},...e})}function Ou(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${j(r)})`:`new RegExp(${j(r)}, ${j(n)})`;return om(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function Mre(e){return LT({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function $re(e){return BT({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function Nre(e){return zT({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var Ure=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function Dre(e,t){let r=Ure(e);return Ou(r,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var Ez=/^([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})$/;function Lre(e){return Ou(Ez,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:Ez.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function Bre(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Ou(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function iH(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Ou(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function jre(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Ou(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function rv(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function zre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${Ka(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return Ue(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>rv(o,e,`^${Ka(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function Hre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${Ka(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return Ue(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>rv(o,e,`${Ka(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function qre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(Ka(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return Ue(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>rv(o,e,Ka(o)),toCode:()=>({runtime:`Schema.isIncluding(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var bz="^[^a-z]*$";function Wre(e){let t=new globalThis.RegExp(bz);return Ue(r=>r.toUpperCase()===r,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:bz,flags:""}]},...e})}var Iz="^[^A-Z]*$";function Vre(e){let t=new globalThis.RegExp(Iz);return Ue(r=>r.toLowerCase()===r,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:Iz,flags:""}]},...e})}var Cz="^(?:[^a-z][\\s\\S]*)?$";function Gre(e){let t=new globalThis.RegExp(Cz);return Ue(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:Cz,flags:""}]},...e})}var wz="^(?:[^A-Z][\\s\\S]*)?$";function Kre(e){let t=new globalThis.RegExp(wz);return Ue(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:wz,flags:""}]},...e})}var Fl=te(RT),Jre=FT;function jm(e){let t=nf(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function zm(e){let t=jh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function Hm(e){let t=Lh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function qm(e){let t=Bh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function Wm(e){let t=jh(e.order),r=nf(e.order),n=Bh(e.order),o=Lh(e.order),s=e.formatter??j;return(a,i)=>{let c=a.exclusiveMinimum?r:t,u=a.exclusiveMaximum?o:n;return Ue(f=>c(f,a.minimum)&&u(f,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?" (excluded)":""} and ${s(a.maximum)}${a.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(a),...i})}}function Zre(e){return(t,r)=>{let n=e.formatter??j;return Ue(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function kl(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${j(e)}`);return e}var Qre=jm({order:ha,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:kl(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${j(e)})`})})}),cH=zm({order:ha,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:kl(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${j(e)})`})})}),Yre=Hm({order:ha,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:kl(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${j(e)})`})})}),Xre=qm({order:ha,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:kl(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${j(e)})`})})}),ec=Wm({order:ha,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:kl(e.minimum),maximum:kl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}});function ene(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Ue(r=>XM(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${j(e)})`}),...t})}function ZS(e){return Ue(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var On=Lm.check(ZS()),ku=On.check(cH(0));function tne(e){return new cu([ZS(),ec({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function rne(e){return new cu([ZS(),ec({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Al(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${j(e)}`);return e.toISOString()}function vl(e){return`new Date(${j(e.getTime())})`}var nne=jm({order:rf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Al(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${vl(e)})`})})}),one=zm({order:rf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Al(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${vl(e)})`})})}),sne=Hm({order:rf,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Al(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${vl(e)})`})})}),ane=qm({order:rf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Al(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${vl(e)})`})})}),ine=Wm({order:rf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Al(e.minimum),maximum:Al(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${vl(e.minimum)}, maximum: ${vl(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}}),cne=jm({order:tf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${j(e)})`})})}),uH=zm({order:tf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${j(e)})`})})}),une=Hm({order:tf,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${j(e)})`})})}),fne=qm({order:tf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${j(e)})`})})}),lne=Wm({order:tf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}});function fH(e,t){return e=rn(e),lH(e,Math.ceil(e/2),t)}function lH(e,t,r){return Ue(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:n==="array"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Cn]:!0,arbitraryConstraint:{minLength:e},...r})}function pH(e){return lH(1,1,e)}function dH(e,t){return e=rn(e),Ue(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:r==="array"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Cn]:!0,arbitraryConstraint:{maxLength:e},...t})}function nv(e,t,r){return e=rn(e),t=rn(t),Ue(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n==="array"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function pne(e,t){return e=rn(e),Ue(r=>ov(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function dne(e,t){return e=rn(e),Ue(r=>ov(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function mne(e,t,r){return e=rn(e),t=rn(t),Ue(n=>{let o=ov(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function ov(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function rn(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function hne(e,t){return e=rn(e),Ue(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Cn]:!0,arbitraryConstraint:{minSize:e},...t})}function gne(e,t){return e=rn(e),Ue(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Cn]:!0,arbitraryConstraint:{maxSize:e},...t})}function xne(e,t,r){return e=rn(e),t=rn(t),Ue(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function yne(e,t){return e=rn(e),Ue(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Cn]:!0,arbitraryConstraint:{minProperties:e},...t})}function Sne(e,t){return e=rn(e),Ue(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Cn]:!0,arbitraryConstraint:{maxProperties:e},...t})}function Ene(e,t,r){return e=rn(e),t=rn(t),Ue(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function bne(e,t){let r=Ol(e),n=LB(r.ast);return Ue((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let u of i){let f=n(u,a);if(f!==void 0&&(c.push(new Yt([u],f)),a.errors==="first"))break}return Dr(c)?new Xt(s,c,o,a):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Cn]:!0,...t})}function sv(e){return Ue(t=>rg(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:D},...e})}function mH(e){return Ue(t=>rg(t.map(([r])=>r)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var av=B.check(pH()),Ine=B.check(nv(1,1)),hH=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),gH=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},Tz=[];function Cne(e){let t=hH(e),r=Tz[t];if(r!==void 0)return r;let n=gH(t),o=Xi(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${j(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Fe()(Zse,ZD(n))});return Tz[t]=o,o}var kz=[];function iv(e){let t=hH(e),r=kz[t];if(r!==void 0)return r;let n=rE.pipe(se(Dm,QD(gH(t))));return kz[t]=n,n}function wne(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(aa([n,o]));return(a,i,c)=>a instanceof globalThis.Map?Tr(Ut(s)([...a],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Tn(i,"entries",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:"ReadonlyMap",toCodec:([n,o])=>Fe()(Pe(aa([n,o])),Ne({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return te(r.ast,{key:e,value:t})}function Tne(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>o instanceof globalThis.Set?Tr(Ut(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:"ReadonlySet",toCodec:([r])=>Fe()(Pe(r),Ne({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return te(t.ast,{value:e})}var kne=Xi(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Fe()(He({source:B,flags:B}),dr({decode:(e,t)=>Rt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new he({expected:"valid RegExp source and flags"},e,t)}),encode:e=>g({source:e.source,flags:e.flags})}))}),xH=B.annotate({expected:"a string that will be decoded as a URL"}),yH=Xi(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Fe()(xH,uT)}),Ane=xH.pipe(se(yH,uT)),SH=B.annotate({expected:"a string that will be decoded as a Date"}),Rl=Ve(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>Fe()(SH,iT)}),vne=SH.pipe(se(Rl,iT)),One=On.pipe(se(Rl,qD)),_ne=B.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function cv(e,t){return _ne.pipe(se(e,i2(t)))}var Pne=cv(Dm),EH=Xi(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Fe()(He({data:B.check(iH()),type:B,name:B,lastModified:On}),dr({decode:(e,t)=>cn(au(e.data),{onFailure:()=>k(new he({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return g(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>vi({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Jf(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new he({expected:"a readable File"},e,t)})}))}),bH=Xi(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Fe()(Pe(aa([B,ht([He({_tag:Ya("String"),value:B}),He({_tag:Ya("File"),value:EH})])])),dr({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return g(t)},encode:e=>g(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function Fne(e){return bH.pipe(se(e,c2))}var IH=Xi(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Fe()(B.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Ne({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function Rne(e){return IH.pipe(se(e,u2))}var Mne=B.annotate({expected:"a string that will be decoded as a number"}).pipe(se(Lm,Yf)),$ne=B.annotate({expected:"a string that will be decoded as a finite number"}).pipe(se(Fl,Yf)),Nne=te(jT).pipe(se(_l,Py)),CH=B.check(aH()),Une=B.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(se(CH,HD())),Dne=B.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,n2)),Lne=B.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,o2)),Bne=B.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,s2)),jne=B.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,a2)),WA=ht([Fl,Vz,B]),zne=He({issues:Pe(He({message:B,path:ei(Pe(ht([WA,He({key:WA})])))}))}),Hne=ti([0,1]).pipe(se(HS,Ne({decode:e=>e===1,encode:e=>e?1:0}))),wH=B.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),QS=Xi(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Fe()(wH,fT)}),qne=wH.pipe(se(QS,fT)),Wne=B.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(se(QS,{decode:ID(),encode:ky()})),TH=B.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(se(QS,{decode:wD(),encode:Ay()})),kH=dr({decode:(e,t)=>{let r=jD(e);return me(r)?k(new he({expected:"a valid BigDecimal string"},e,t)):g(r.value)},encode:e=>g(Ha(e))}),Vne=jm({order:Zf,formatter:e=>Ha(e)}),Gne=zm({order:Zf,formatter:e=>Ha(e)}),Kne=Hm({order:Zf,formatter:e=>Ha(e)}),Jne=qm({order:Zf,formatter:e=>Ha(e)}),Zne=Wm({order:Zf,formatter:e=>Ha(e)}),AH=B.annotate({expected:"a string that will be decoded as a BigDecimal"}),vH=Ve(sT,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Fe()(AH,kH),toFormatter:()=>e=>Ha(e)}),Qne=AH.pipe(se(vH,kH)),YS=Ve(q$,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Fe()(_l.check(uH(globalThis.BigInt(0))),Ne({decode:xd,encode:kx})),toCodecStringTree:()=>Fe()(OH,cT)}),OH=B.annotate({expected:"a string that will be decoded as a ByteSize"}),Yne=OH.pipe(se(YS,cT)),Xne=_l.pipe(se(YS,WD)),eoe=Lm.pipe(se(YS,VD));function VA(e,t){let r=An()([e,t],([n,o])=>(s,a,i)=>{if(!uM(s))return k(new $t(a,s,i));switch(s._tag){case"Fail":return Tr(Ut(n)(s.error,i),{onSuccess:x0,onFailure:c=>Tn(a,"error",c,s,i)});case"Die":return Tr(Ut(o)(s.defect,i),{onSuccess:y0,onFailure:c=>Tn(a,"defect",c,s,i)});case"Interrupt":return g(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([n,o])=>Fe()(ht([He({_tag:Ht("Fail"),error:n}),He({_tag:Ht("Die"),defect:o}),He({_tag:Ht("Interrupt"),fiberId:VS(Fl)})]),Ne({decode:s=>{switch(s._tag){case"Fail":return x0(s.error);case"Die":return y0(s.defect);case"Interrupt":return lM(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return te(r.ast,{error:e,defect:t})}function GA(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(VA(n,o));return(a,i,c)=>cM(a)?Tr(Ut(s)(a.reasons,c),{onSuccess:Hp,onFailure:u=>Tn(i,"failures",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([n,o])=>Fe()(Pe(VA(n,o)),Ne({decode:Hp,encode:({reasons:s})=>s}))});return te(r.ast,{error:e,defect:t})}function Az(e){return Fe()(e,Ne({decode:CC,encode:Xe}))}function toe(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>vx(o)?Tr(Ut(n)(Xe(o),a),{onSuccess:CC,onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:"Chunk",toCodec:([r])=>Az(Pe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>Az(qS(Pe(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>bC(r)});return te(t.ast,{value:e})}function _H(){return Wr((e,t)=>Le(Vw(e),{onNone:()=>k(new he({message:"Invalid DateTime input"},e,t)),onSome:r=>g(Gw(r))}))}var roe=Ne({decode:e=>Jw(e),encode:e=>e.offset}),PH=dr({decode:(e,t)=>Le(sD(e),{onNone:()=>k(new he({expected:"a valid IANA time zone"},e,t)),onSome:g}),encode:e=>g(e.id)}),FH=dr({decode:(e,t)=>Le(aD(e),{onNone:()=>k(new he({expected:"a valid time zone"},e,t)),onSome:g}),encode:e=>g(Zd(e))}),RH=dr({decode:(e,t)=>Le(Vw(e),{onNone:()=>k(new he({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>g(Gw(r))}),encode:e=>g(uD(e))}),MH=dr({decode:(e,t)=>Le(oD(e),{onNone:()=>k(new he({expected:"a valid Zoned DateTime string"},e,t)),onSome:g}),encode:e=>g(Zw(e))}),$H=-864e13,NH=864e13,noe=$H+840*60*1e3,ooe=NH-840*60*1e3,soe=-720*60*1e3,aoe=840*60*1e3,UH=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function DH(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function uv(e,t){return On.check(ec({minimum:e,maximum:t}))}function LH(){return ht([uv(soe,aoe),ti(UH)])}var XS=Ve(e=>Ww(e)&&XU(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{let[t,r]=DH(e,$H,NH);return Pl()(uv(t,r),Ee(rD))},toCodecJson:()=>Fe()(B,RH),toFormatter:()=>e=>e.toString()}),ioe=Rl.pipe(se(XS,{decode:_H(),encode:Ee(iD)})),coe=B.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(se(XS,RH)),uoe=On.pipe(se(XS,{decode:_H(),encode:Ee(cD)})),foe=Ve(QU,{representation:{id:"effect/schema/TimeZoneOffset",payload:null},toCode:()=>({runtime:"Schema.TimeZoneOffset",Type:"DateTime.TimeZone.Offset",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Offset",toCodecJson:()=>Fe()(On,roe),toFormatter:()=>e=>Zd(e)}),BH=B.annotate({expected:"an IANA time zone identifier"}),jH=Ve(YU,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>Pl()(ti(UH),Ee(Kw)),toCodecJson:()=>Fe()(BH,PH),toFormatter:()=>e=>Zd(e)}),loe=BH.pipe(se(jH,PH)),zH=B.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),HH=Ve(ZU,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>Pl()(LH(),Ee(e=>typeof e=="number"?Jw(e):Kw(e))),toCodecJson:()=>Fe()(zH,FH),toFormatter:()=>e=>Zd(e)}),poe=zH.pipe(se(HH,FH)),qH=B.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),WH=Ve(e=>Ww(e)&&eD(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{let[t,r]=DH(e,noe,ooe);return Pl()(He({epochMilliseconds:uv(t,r),timeZone:LH()}),Ee(({epochMilliseconds:n,timeZone:o})=>nD(n,{timeZone:o})))},toCodecJson:()=>Fe()(qH,MH),toFormatter:()=>e=>Zw(e),toEquivalence:()=>tD}),doe=qH.pipe(se(WH,MH)),_n=(e,t,r,n)=>B.pipe(se(e,dr({decode:(o,s)=>{let a=t(o);return xt(a)?g(a.success):k(new he({message:a.failure.message},o,s))},encode:o=>g(r(o))}))).annotate({identifier:n}),_u=Ve(Il,{identifier:"MacAddress"}),Ml=_n(_u,Xj,bA,"MacAddressFromString"),Vm=Ve(_r,{identifier:"Ipv4Address"}),fv=_n(Vm,wu,Pr,"Ipv4AddressFromString"),eE=Ve(Ro,{identifier:"Ipv6Address"}),VH=_n(eE,Tu,Pr,"Ipv6AddressFromString"),tc=Ve(xA,{identifier:"IpAddress"}),Pu=_n(tc,Zi,Pr,"IpAddressFromString"),Et=(e,t,r,n)=>Qz(t,{expected:r})(e).annotate({identifier:n}),moe=Et(tc,Cl,"a multicast address","IpMulticastAddress"),hoe=Et(Pu,Cl,"a multicast address","IpMulticastAddressFromString"),goe=Et(_u,Cl,"a multicast address","MacMulticastAddress"),xoe=Et(Ml,Cl,"a multicast address","MacMulticastAddressFromString"),yoe=Et(tc,TA,"a unicast address","IpUnicastAddress"),Soe=Et(Pu,TA,"a unicast address","IpUnicastAddressFromString"),Eoe=Et(_u,OS,"a unicast address","MacUnicastAddress"),boe=Et(Ml,OS,"a unicast address","MacUnicastAddressFromString"),Ioe=Et(Vm,PS,"a broadcast address","Ipv4BroadcastAddress"),Coe=Et(fv,PS,"a broadcast address","Ipv4BroadcastAddressFromString"),woe=Et(_u,vS,"a broadcast address","MacBroadcastAddress"),Toe=Et(Ml,vS,"a broadcast address","MacBroadcastAddressFromString"),koe=Et(tc,wA,"a loopback address","IpLoopbackAddress"),Aoe=Et(Pu,wA,"a loopback address","IpLoopbackAddressFromString"),voe=Et(tc,kA,"a link-local address","IpLinkLocalAddress"),Ooe=Et(Pu,kA,"a link-local address","IpLinkLocalAddressFromString"),_oe=Et(tc,_S,"an unspecified address","IpUnspecifiedAddress"),Poe=Et(Pu,_S,"an unspecified address","IpUnspecifiedAddressFromString"),Foe=Et(Vm,AA,"a private address","Ipv4PrivateAddress"),Roe=Et(fv,AA,"a private address","Ipv4PrivateAddressFromString"),Moe=Et(eE,vA,"a unique-local address","Ipv6UniqueLocalAddress"),$oe=Et(VH,vA,"a unique-local address","Ipv6UniqueLocalAddressFromString"),Noe=Et(_u,IA,"a locally administered address","MacLocallyAdministeredAddress"),Uoe=Et(Ml,IA,"a locally administered address","MacLocallyAdministeredAddressFromString"),Doe=Et(_u,CA,"a universally administered address","MacUniversallyAdministeredAddress"),Loe=Et(Ml,CA,"a universally administered address","MacUniversallyAdministeredAddressFromString"),GH=Ve(lz,{identifier:"Ipv4Interface"}),Boe=_n(GH,$S,Rm,"Ipv4InterfaceFromString"),KH=Ve(pz,{identifier:"Ipv6Interface"}),joe=_n(KH,NS,Rm,"Ipv6InterfaceFromString"),JH=Ve(Pm,{identifier:"IpInterface"}),zoe=_n(JH,US,Rm,"IpInterfaceFromString"),ZH=Ve(mz,{identifier:"Ipv4Network"}),Hoe=_n(ZH,gz,$m,"Ipv4NetworkFromString"),QH=Ve(hz,{identifier:"Ipv6Network"}),qoe=_n(QH,xz,$m,"Ipv6NetworkFromString"),YH=Ve(Mm,{identifier:"IpNetwork"}),Woe=_n(YH,yz,$m,"IpNetworkFromString"),Voe=Ve(km,{identifier:"InetAddressV4"}),Goe=Ve(Am,{identifier:"InetAddressV6"}),XH=Ve(yA,{identifier:"InetAddress"}),Koe=_n(XH,OA,FS,"InetAddressFromString"),eq=Ve(kS,{identifier:"UnixPathAddress"}),Joe=B.pipe(se(eq,Ne({decode:tz,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),Zoe=Ve(Qj,{identifier:"SocketAddress"}),ri=B.check(Ue(Za,{expected:"a normalized domain name"})).pipe(GS("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),tq=_n(ri,RS,e=>e,"DomainNameFromString"),lv=B.check(Ue(SA,{expected:"a canonical scoped IPv6 literal"})).pipe(GS("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),rq=_n(lv,vm,e=>e,"ScopedIpv6LiteralFromString"),Qoe=ht([tc,lv,ri]).annotate({identifier:"Host"}),Yoe=ht([Pu,rq,tq]).annotate({identifier:"HostFromString"}),nq=Ve(FA,{identifier:"HostPort"}),Xoe=_n(nq,nz,RA,"HostPortFromString"),ese=On.check(ec({minimum:0,maximum:65535},{expected:"a port number"})),tse=dr({decode:(e,t)=>Le(oP(e),{onNone:()=>k(new he({expected:"a valid Duration string"},e,t)),onSome:g}),encode:e=>g(globalThis.String(e))}),rse=dr({decode:e=>g(Fs(e)),encode:(e,t)=>Le(sP(e),{onNone:()=>k(new he({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>g(r)})}),nse=Ne({decode:e=>gi(e),encode:e=>Lr(e)}),Gm=Ve(Cp,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Fe()(ht([He({_tag:Ht("Infinity")}),He({_tag:Ht("NegativeInfinity")}),He({_tag:Ht("Nanos"),value:_l}),He({_tag:Ht("Millis"),value:On})]),Ne({decode:e=>{switch(e._tag){case"Infinity":return ya;case"NegativeInfinity":return cf;case"Nanos":return Fs(e.value);case"Millis":return gi(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}}))}),ose=B.annotate({expected:"a string that will be decoded as a Duration"}),sse=ose.pipe(se(Gm,tse)),ase=_l.pipe(se(Gm,rse)),ise=Lm.pipe(se(Gm,nse)),cse=ti(NA),oq=(e,t)=>B.pipe(se(e,dr({decode:(r,n)=>{let o=t(r);return be(o)?k(new he({message:o.failure.message},r,n)):Pr(o.success)===r?g(o.success):k(new he({message:"expected a canonical address"},r,n))},encode:r=>g(Pr(r))}))),HA=On.check(ec({minimum:0,maximum:255})),Tl=On.check(ec({minimum:0,maximum:65535})),sq=On.check(ec({minimum:0,maximum:4294967295})),DS=sq.pipe(se(Gm,Ne({decode:wp,encode:Ms}))),Mo=(e,t)=>Ve(r=>UA(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=Bm(e,t);return Fe()(r,dr({decode:(n,o)=>{let{_tag:s,...a}=n,i=cz(e,a);return xt(i)?g(i.success):k(new he({message:i.failure.message},n,o))},encode:n=>g({...n})}))}}),aq=Mo("A",{address:oq(Vm,wu)}),iq=Mo("AAAA",{address:oq(eE,Tu)}),cq=Mo("CAA",{critical:HS,tag:B.check(Ou(/^[a-z0-9]+$/i)),value:B}),uq=Mo("CNAME",{target:ri}),fq=Mo("MX",{exchange:ri,priority:Tl}),lq=Mo("NAPTR",{order:Tl,preference:Tl,flags:B,service:B,regexp:B,replacement:ri}),pq=Mo("NS",{host:ri}),dq=Mo("PTR",{host:av}),mq=Mo("SOA",{primary:ri,admin:av,serial:sq,refresh:DS,retry:DS,expire:DS,minimum:DS}),hq=Mo("SRV",{target:ri,port:Tl,priority:Tl,weight:Tl}),gq=Mo("TLSA",{certUsage:HA,selector:HA,matchingType:HA,data:TH}),xq=Mo("TXT",{chunks:WS(B)}),use=ht([aq,iq,cq,uq,fq,lq,pq,dq,mq,hq,gq,xq]).annotate({identifier:"DnsRecord"});function fse(e,t,r){let n=An()([e,t,r],([o,s,a])=>{let i=GA(s,a);return(c,u,f)=>{if(!Jg(c))return k(new $t(u,c,f));switch(c._tag){case"Success":return Tr(Ut(o)(c.value,f),{onSuccess:Zr,onFailure:p=>Tn(u,"value",p,c,f)});case"Failure":return Tr(Ut(i)(c.cause,f),{onSuccess:Vn,onFailure:p=>Tn(u,"cause",p,c,f)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,a])=>Fe()(ht([He({_tag:Ht("Success"),value:o}),He({_tag:Ht("Failure"),cause:GA(s,a)})]),Ne({decode:i=>i._tag==="Success"?Zr(i.value):Vn(i.cause),encode:i=>et(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}}))});return te(n.ast,{value:e,error:t,defect:r})}function vz(e,t,r){return He({type:Ht(e),nodes:Pe(He({index:ku,data:t})),edges:Pe(He({index:ku,source:ku,target:ku,data:r}))})}function Oz(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return k(new Yt(["nodes",o,"index"],new he({expected:"a strictly increasing node index"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return k(new Yt(["edges",o,"index"],new he({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return k(new Yt(["edges",o,"source"],new he({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return k(new Yt(["edges",o,"target"],new he({expected:"an encoded node index"},s.target,t)))}return g(oS(e))}function lse(e,t,r){return!Dk(e)||e.mutable||e.type!==t?k(new he({expected:`an immutable ${t} Graph`},e,r)):g(gm(e))}function pse(e,t){return(r,n)=>{let o=gm(r),s=gm(n);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],u=o.type==="directed"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!u||!t(i.data,c.data))return!1}return!0}}function dse(e,t,r){return Pl()(ht([zS,He({nodes:WS(t),edges:Pe(aa([ku,ku,r]))})]),Ee(n=>{if(n===null)return oS({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return oS({type:e,nodes:o,edges:n.edges.map(([s,a,i],c)=>({index:c,source:s%o.length,target:a%o.length,data:i}))})}))}function mse(e,t,r){let n=An()([t,r],([o,s])=>{let a=vz(e,o,s);return(i,c,u)=>!Dk(i)||i.mutable||i.type!==e?k(new $t(c,i,u)):I(Ut(a)(gm(i),u),f=>Oz(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${j(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${j(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Fe()(vz(e,o,s),dr({decode:Oz,encode:(a,i)=>lse(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>dse(e,o,s),toEquivalence:([o,s])=>pse(o,s)});return te(n.ast,{type:e,node:t,edge:r})}function _z(e){return Fe()(e,Ne({decode:Ek,encode:dm}))}function hse(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(aa([n,o]));return(a,i,c)=>nB(a)?Tr(Ut(s)(dm(a),c),{onSuccess:Ek,onFailure:u=>Tn(i,"entries",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([n,o])=>_z(Pe(aa([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>_z(qS(Pe(aa([o,s])).check(mH()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>Ch(n,o)});return te(r.ast,{key:e,value:t})}function Pz(e){return Fe()(e,Ne({decode:Ck,encode:Xe}))}function gse(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>cB(o)?Tr(Ut(n)(Xe(o),a),{onSuccess:Ck,onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:"HashSet",toCodec:([r])=>Pz(Pe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>Pz(qS(Pe(n).check(sv()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>sp(r)});return te(t.ast,{value:e})}function Fu(e){let t=An()([e],([r])=>(n,o,s)=>of(n)?me(n)?jc:Tr(Ut(r)(n.value,s),{onSuccess:v,onFailure:a=>Tn(o,"value",a,n,s)}):k(new $t(o,n,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([r])=>Fe()(ht([He({_tag:Ht("Some"),value:r}),He({_tag:Ht("None")})]),Ne({decode:n=>n._tag==="None"?A():v(n.value),encode:n=>fe(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return te(t.ast,{value:e})}function xse(e){return YA(e).pipe(se(Fu(vn(e)),YD()))}function yse(e){return VS(e).pipe(se(Fu(vn(e)),XD()))}function Sse(e,t){return Jz(e).pipe(se(Fu(vn(e)),e2(t)))}var yq=Ve(pB,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Sq=Ve(lB,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Fe()(Pe(B),Ne({decode:dB,encode:yB})),toCodecIso:()=>Fe()(vu(B,yq),Ne({decode:Ok,encode:e=>e.cookies}))}),Ese=Sq.pipe(se(vu(B,B),Ne({decode:xB,encode:e=>_k(globalThis.Object.entries(e).map(([t,r])=>gB(t,r)))}))),bse=Ve(IB,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>Rk,toCodec:()=>Fe()(vu(B,B),Ne({decode:CB,encode:e=>({...e})}))}),pv=Ve($k,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Nk,toCodec:()=>Fe()(Pe(aa([B,B])),Ne({decode:nS,encode:e=>e.params.map(([t,r])=>[t,hm(r)])}))}),Ise=(e,t)=>pv.pipe(se(cv(Dm,t),dr({decode:r=>Le(_B(r,e),{onNone:()=>k(new Yt([e],new ji(void 0))),onSome:g}),encode:r=>g(nS([[e,r]]))}))),Cse=pv.pipe(se(vu(B,ht([B,WS(B)])),Ne({decode:PB,encode:vB})));function wse(e){return Qa(e).pipe(se(Fu(vn(e)),t2()))}function Tse(e){return ei(e).pipe(se(Fu(vn(e)),r2()))}function kse(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return ei(YA(e)).pipe(se(Fu(vn(e)),_y({decode:o=>o.pipe(Ic(bh),v),encode:r==="omit"?bc:o=>v(Ft(bc(o),()=>n))})))}function Eq(e,t){let r=typeof t?.label=="string"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?Ut(Ht(r)):void 0,a=An()([e],([i])=>(c,u,f)=>{if(pl(c)){let p=s!==void 0?md(s(c.label,f),d=>new Yt(["label"],d)):W;return Qt(p,()=>Tr(Ut(i)(sa(c),f),{onSuccess:d=>ro(d,{label:c.label}),onFailure:()=>new Xt(u,[new Yt(["value"],new he(void 0,c,f))],c,f)}))}return k(new $t(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${j(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Fe()(i,{decode:Ee(c=>ro(c,{label:r})),encode:n?Cy(c=>"Cannot serialize Redacted"+(fe(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Ee(sa)}),toEquivalence:([i])=>bB(i)});return te(a.ast,{value:e})}function Ase(e,t){return se(Eq(vn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ee(r=>ro(r,{label:t?.label})),encode:t?.disallowEncode?Cy(r=>"Cannot encode Redacted"+(fe(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):Ee(sa)})(e)}function vse(e,t){let r=An()([e,t],([n,o])=>(s,a,i)=>{if(!D_(s))return k(new $t(a,s,i));switch(s._tag){case"Success":return Tr(qk(n)(s.success,i),{onSuccess:G,onFailure:c=>Tn(a,"success",c,s,i)});case"Failure":return Tr(qk(o)(s.failure,i),{onSuccess:X,onFailure:c=>Tn(a,"failure",c,s,i)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([n,o])=>Fe()(ht([He({_tag:Ht("Success"),success:n}),He({_tag:Ht("Failure"),failure:o})]),Ne({decode:s=>s._tag==="Success"?G(s.success):X(s.failure),encode:s=>xt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return te(r.ast,{success:e,failure:t})}var Ose=globalThis.Symbol.for("immer-draftable"),KA={};function dv(e,t,r,n,o){let s=Pse(r,t,n),a=bq(t),i=class extends e{constructor(...[c,u]){let p=u?.["~payload"],d=p?.token===KA?p.value:r.make(c??{},u);super(d,{...u,disableChecks:!0,"~payload":{token:KA,value:d}})}static[Nm]=Nm;get[a](){return a}static[Ose]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return ne(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return lS(s(this))(c??{},u)}static makeOption(c,u){return fS(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(is(this.ast,c))}static annotateKey(c){return this.rebuild(am(this.ast,c))}static check(...c){return this.rebuild(na(this.ast,c))}static extend(c){return(u,f)=>{let p=Km(u)?u:He(u),d={...r.fields,...p.fields},m=Uy(d,r.ast.checks,{identifier:c});return dv(this,c,QA(na(m,p.ast.checks),d),f,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function _se(e){return new We(Ee(t=>new e(t,{"~payload":{token:KA,value:t}})),ea())}function bq(e){return`~effect/Schema/Class/${e}`}function Pse(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=bq(t),a=u=>u instanceof o||O(u,s),i=_se(o),c=te(new ol([e.ast],()=>(u,f,p)=>a(u)?g(u):k(new $t(f,u,p)),{identifier:t,[Ey]:([u])=>({isConstructed:a,link:new Ot(u,i)}),toCodec:([u])=>new Ot(u.ast,i),toEquivalence:([u])=>u,toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[jd]:tl(e.ast),...r}));return n=se(c,i)(e)}}function Km(e){return jS(e)}var Iq=e=>(t,r)=>{let n=Km(t)?t:He(t);return dv(ag,e,n,r,o=>({toString(){return`${o}(${j({...this})})`}}))},Fse=e=>(t,r,n)=>{let o=Km(r)?r.mapFields(s=>({_tag:Ya(t),...s}),{unsafePreserveChecks:!0}):Bm(t,r);return Iq(e??t)(o,n)},tE=e=>(t,r)=>{let n=Km(t)?t:He(t);return dv(dp,e,n,r,s=>({name:s}))},xs=e=>(t,r,n)=>{let o=Km(r)?r.mapFields(s=>({_tag:Ya(t),...s}),{unsafePreserveChecks:!0}):Bm(t,r);return tE(e??t)(o,n)};function Rse(e){return t=>t.annotate({toFormatter:e})}function Mse(e,t){return Bj(e.ast,t)}function $se(e){return t=>t.annotate({toEquivalence:e})}function Nse(e){return iA(e.ast)}function Use(e,t){return Cm(e.ast,t)}function Dse(e,t){let r=Cm(hl(e.ast),t);return bS(r,t)}var Lse=gS,Bse=xS,mv=yS,jse=hj;function zse(e,t){return $j(e,t)}function Hse(e){return Gj(e)}function qse(e){return Kj(e)}function Wse(e){return Jj(e)}function Vse(e,t){return r=>te(is(r.ast,{toCodecIso:()=>new Ot(e.ast,Oy(t))}),{schema:r})}function Gse(e){return Mj(e)}function Kse(e){let t=Zz(()=>r),r=ht([e,Pe(t),vu(B,t)]);return r}var rE=te(is(rl,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),Jse=vu(B,rE),Zse=He({message:B,name:Qa(B),stack:Qa(B),cause:Qa(rE)}),Qse=te(is(sL,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function Yse(e){return za(e.ast)}function Xse(e){return e.ast.context?.annotations}var Cq="~effect/Terminal",hv="~effect/Terminal/QuitError",$l=class extends tE("QuitError")({_tag:Ya("QuitError")}){[hv]=hv},wq=e=>O(e,hv),ys=gt("effect/Terminal"),Tq=e=>ys.of({...e,[Cq]:Cq});import*as oE from"node:readline";var kq=N(function*(e=vq){let t=process.stdin,r=process.stdout,n=yield*mn(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||wo(n)};t.once("end",a),yield*Ix(()=>U(()=>t.off("end",a)));let i=yield*uy({acquire:Qr(U(()=>{let m=oE.createInterface({input:t,escapeCodeTimeout:50}),x=E=>Da(n,E),y=()=>{s=!1,wo(n)};return s=!0,oE.emitKeypressEvents(t,m),m.on("line",x),m.once("close",y),t.isTTY&&t.setRawMode(!0),{rl:m,onClose:y,onLine:x}}),({rl:m,onClose:x,onLine:y})=>U(()=>{s=!1,m.off("line",y),m.off("close",x),t.isTTY&&t.setRawMode(!1),m.close(),o&&wo(n)})),idleTimeToLive:"10 millis"}),c=U(()=>r.columns??0),u=U(()=>r.rows??0),f=tt(function*(){let m=yield*mn(),x=(w,T)=>{let M={input:ga(w),key:{name:T.name??"",ctrl:!!T.ctrl,meta:!!T.meta,shift:!!T.shift}};Da(m,M),e(M)&&wo(m)},y=setInterval(()=>{},2147483647),E=()=>{clearInterval(y),wo(m)};return yield*Ix(()=>U(()=>{clearInterval(y),t.off("keypress",x),t.off("end",E)})),t.on("keypress",x),o?E():(yield*Md(i),t.once("end",E)),m}),p=L(()=>lN(n).pipe(I(Le({onNone:()=>qs(Kt(Md(i),hn(n))),onSome:g})),Jt(()=>new $l({}))));return Tq({columns:c,rows:u,readInput:f,readLine:p,display:m=>Qo(fr(x=>{r.write(m,y=>NO(y)?x(W):x(k(Co({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:y}))))}))})}),Aq=wf(ys,kq(vq));function vq(e){let t=e.key;return t.name==="escape"||t.ctrl&&(t.name==="c"||t.name==="d")}var Oq=Aq;var _q=UM(SL,Xg(zL,_L,qL,GL,Oq));function nae(e){return{_tag:"Value",value:e}}function oae(e,t){return{_tag:"Record",keys:e,value:t}}function sae(e,t){return{_tag:"Array",length:e,value:t}}var Pq=Te("effect/ConfigProvider",{defaultValue:()=>pae()}),aae={...Nr,toJSON(){return{_id:"ConfigProvider"}}},iae=e=>e;function cae(e,t){let r=Object.create(aae);return r.load=e,r.mapInput=t,r}function Fq(e,t){return cae(r=>e(t(r)),r=>Fq(e,n=>r(t(n))))}function uae(e){return Fq(e,iae)}function fae(e,t){return e===""&&!t?void 0:e}function lae(e,t){let r=t?.preserveEmptyStrings===!0,n=dae(e);return uae(o=>g(mae(n,e,o,r)))}function pae(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return lae(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function dae(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split("_"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}function mae(e,t,r,n){let o=r.map(String).join("_"),s=fae(Object.hasOwn(t,o)?t[o]:void 0,n),a=hae(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:nae(s);if(i.every(sf)){let u=Math.max(...i.map(f=>parseInt(f,10)))+1;return sae(u,s)}return oae(new Set(i),s)}function hae(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var Mq="~effect/Config";var gae={...Os({label:"Config",evaluate(e){return this.parse(e.getRef(Pq))}}),[Mq]:Mq,toJSON(){return{_id:"Config"}}};function $q(e){let t=Object.create(gae);return t.evaluator=e,t.parse=r=>Qt(e(r,[]),ud),t}var Nq=(e,t,r)=>e.evaluator(t,r),xae=l(2,(e,t)=>$q((r,n)=>F(Nq(e,r,n),gr(t))));var yae=l(2,(e,t)=>$q((r,n)=>qc(Nq(e,r,n),o=>be(o)?G(t):o))),Uq=e=>e.pipe(xae(v),yae(A()));var Ss={};$n(Ss,{Console:()=>Lq,assert:()=>Sae,clear:()=>Eae,consoleWith:()=>Sr,count:()=>bae,countReset:()=>Iae,debug:()=>Cae,dir:()=>wae,dirxml:()=>Tae,error:()=>sE,group:()=>kae,info:()=>Aae,log:()=>Fr,table:()=>vae,time:()=>Oae,timeLog:()=>_ae,trace:()=>Pae,warn:()=>Fae,withGroup:()=>Rae,withTime:()=>Mae});var Lq=m0,Sr=e=>ue(t=>e(t.getRef(Lq))),Sae=(e,...t)=>Sr(r=>Q(()=>{r.assert(e,...t)})),Eae=Sr(e=>Q(()=>{e.clear()})),bae=e=>Sr(t=>Q(()=>{t.count(e)})),Iae=e=>Sr(t=>Q(()=>{t.countReset(e)})),Cae=(...e)=>Sr(t=>Q(()=>{t.debug(...e)})),wae=(e,t)=>Sr(r=>Q(()=>{r.dir(e,t)})),Tae=(...e)=>Sr(t=>Q(()=>{t.dirxml(...e)})),sE=(...e)=>Sr(t=>Q(()=>{t.error(...e)})),kae=e=>Sr(t=>Rc(Q(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>Q(()=>{t.groupEnd()}))),Aae=(...e)=>Sr(t=>Q(()=>{t.info(...e)})),Fr=(...e)=>Sr(t=>Q(()=>{t.log(...e)})),vae=(e,t)=>Sr(r=>Q(()=>{r.table(e,t)})),Oae=e=>Sr(t=>Rc(Q(()=>{t.time(e)}),()=>Q(()=>{t.timeEnd(e)}))),_ae=(e,...t)=>Sr(r=>Q(()=>{r.timeLog(e,...t)})),Pae=(...e)=>Sr(t=>Q(()=>{t.trace(...e)})),Fae=(...e)=>Sr(t=>Q(()=>{t.warn(...e)})),Rae=l(e=>de(e[0]),(e,t)=>Sr(r=>Lp(Q(()=>{t?.collapsed?r.groupCollapsed(t.label):r.group(t?.label)}),()=>e,()=>Q(()=>{r.groupEnd()})))),Mae=l(e=>de(e[0]),(e,t)=>Sr(r=>Lp(Q(()=>{r.time(t)}),()=>e,()=>Q(()=>{r.timeEnd(t)}))));var ch={};$n(ch,{ChoiceWithValue:()=>Bce,Date:()=>Sce,Directory:()=>xce,File:()=>gce,FileParse:()=>wce,FileSchema:()=>Tce,FileText:()=>Cce,Finite:()=>yce,Int:()=>hce,Literals:()=>Ece,Never:()=>kce,Path:()=>bce,Redacted:()=>Ice,String:()=>mce,atLeast:()=>Nce,atMost:()=>Uce,between:()=>Dce,filter:()=>zce,filterMap:()=>Hce,map:()=>Rce,mapEffect:()=>Mce,mapTryCatch:()=>$ce,optional:()=>Ace,orElse:()=>qce,orElseResult:()=>Wce,variadic:()=>Fce,withDefault:()=>Oce,withDescription:()=>vce,withFallbackConfig:()=>_ce,withFallbackPrompt:()=>Pce,withMetavar:()=>jce,withSchema:()=>Lce});var it="~effect/cli/CliError",xv=e=>O(e,it),rc=class extends xs(`${it}/UnrecognizedOption`)("UnrecognizedOption",{option:B,command:ei(Pe(B)),suggestions:Pe(B)}){[it]=it;get message(){let t=this.suggestions.length>0?`
|
|
28
|
+
`,m)));r=r+d.substring(m)}}return st(u)?u:null}let a=L(()=>o._tag==="Some"?ee(o.value):cx(e,{onSuccess:i,onFailure:dt,onDone:c=>{if(o=v(c),r.length>0){let u=r;return r="",n=!1,g([u])}return ee(c)}}));function i(c){let u=s(c);return u!==null?g(u):a}return a}));var aw=l(2,(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>Se(t)(o,n)))),iw=l(2,(e,t)=>Oe((r,n)=>I(Se(e)(r,n),o=>{let s=Ct(o,a=>zs(a)?dt(a):lr(Vp(a)));return F(Se(t)(s,n),a=>tC(a,i=>Wp(i)?dt(i.value):lr(i)))}))),La=e=>Oe((t,r)=>{let n;return g(L(()=>n||e.pipe(va(r),I(o=>Se(o)(t,r)),I(o=>n=o))))}),x1=e=>rs((t,r,n)=>F(va(Se(e)(t,r),n),va(n)));var y1=l(2,(e,t)=>Oe(N(function*(r,n){let o=yield*Se(e)(r,n),s=yield*mn({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*cr(n,To(s)),yield*o.pipe(I(a=>Yr(s,a)),vt({disableYield:!0}),Zo(a=>yr(s,a)),Zt(n)),hn(s)}))),S1=l(2,(e,t)=>Oe(N(function*(r,n){let o=yield*Se(e)(r,n),s=yield*mn({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*cr(n,To(s)),yield*o.pipe(I(a=>Qc(s,a)),vt({disableYield:!0}),Zo(a=>yr(s,a)),Zt(n)),Yc(s)}))),cw=l(2,(e,t)=>ay(e,Ar(g(I(t,ee))),{haltStrategy:"either"})),E1=l(2,(e,t)=>rs(N(function*(r,n,o){let s=yield*Se(e)(r,n),a=yield*Zt(t,o,{startImmediately:!0});return L(()=>{let i=a.pollUnsafe();return i===void 0?s:bM(i,{onFailure:dt,onSuccess:ee})})}))),b1=l(2,(e,t)=>kd(e,r=>ka(r)?t(r.cause):W)),kd=l(2,(e,t)=>rs((r,n,o)=>Ls(o,t).pipe(Kt(Se(e)(r,n))))),I1=l(2,(e,t)=>La(at(t,e))),uw=l(2,(e,t)=>ko(e,r=>U(()=>{let n=!0,o=jr(r,s=>(n=!1,t(s)));return L(()=>n?o:r)}))),C1=l(2,(e,t)=>ko(e,r=>g(ze(r,n=>I(t,()=>ee(n)))))),w1=l(2,(e,t)=>kd(e,r=>t)),Xc=(e,t,r)=>L(()=>{let n=yo(),o=Se(e)(ee(),n);return ze(I(o,t),r||g).pipe(Jn(s=>Ze(n,s)))});var iy=l(2,(e,t)=>Oe((r,n)=>F(pn(Se(e)(r,n),t),pn(t)))),cy=l(3,(e,t,r)=>Oe((n,o)=>F(dn(Se(e)(n,o),t,r),dn(t,r)))),uy=l(3,(e,t,r)=>Oe((n,o)=>I(r,s=>Se(cy(e,t,s))(n,o)))),T1=l(e=>Hr(e[0]),(e,t,r)=>xp(t)?iy(e,t):Oe((n,o)=>I(r?.local?Zp(t,Jp(),o):Xg(t,o),s=>F(pn(Se(e)(n,o),s),pn(s))))),k1=l(2,(e,t)=>Oe((r,n)=>ld(o=>{let s=t(o);return Se(iy(e,s))(r,n)})));var fw=function(){let e=Hr(arguments[0]),t=e?arguments[1]:arguments[0],r=yi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return wN(n,t,r)}return n=>wN(n,t,r)},wN=(e,t,r)=>jZ(lC(t,r),n=>cy(e,Ac,n),(n,o)=>Kn(s=>{let a=s.getRef(Jr),i=s.getRef(AM);return Vg(n,o,a,i)}));var A1=e=>Xc(e,t=>vt(t,{disableYield:!0})),eu=l(2,(e,t)=>Xc(e,r=>vt(I(r,t),{disableYield:!0}))),v1=l(2,(e,t)=>Xc(e,r=>r.pipe(I(t),I(n=>n?W:ee()),vt({disableYield:!0})))),lw=e=>F(tu(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let a=t[s];n.set(a,o),o+=a.length}return n});var O1=e=>L(()=>{let t=A();return Xc(e,r=>r.pipe(xx,I(n=>(t=n,ee()))),()=>g(t))}),_1=e=>L(()=>{let t=Symbol(),r=t;return Xc(e,n=>vt(I(n,o=>(r=o,W)),{disableYield:!0}),()=>r===t?zc:Z0(r))}),tu=l(3,(e,t,r)=>L(()=>{let n=t();return Xc(e,o=>Ko({while:sn,body:()=>o,step:s=>{n=r(n,s)}}),()=>g(n))})),P1=l(3,(e,t,r)=>L(()=>{let n=t();return Xc(e,o=>Ko({while:sn,body:ct(o.pipe(I(s=>r(n,s)),F(s=>{n=s}))),step:yn}),()=>g(n))})),pw=N(function*(e){let t=Yx(1),r=yield*Ri(),n=$e(r,ln);return(yield*Se(e)(ee(),n)).pipe(pn(r),t.withPermits(1))},Ct(e=>g(dt(e)))),Qs=(e,t)=>Se(e)(ee(),t);var dw=l(e=>Hr(e[0]),(e,t)=>Ws(r=>eu(e,n=>Qc(t,n)).pipe(r,bo,I(n=>(et(n)?wo(t):Js(t,n.cause),W)))));var F1=l(e=>Hr(e[0]),N(function*(e,t){let r=yield*qc,n=yield*mn({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*cr(r,To(n)),yield*Zt(dw(e,n),r),n}));var R1=e=>Qr(e.capacity==="unbounded"?Hx(e):e.strategy==="dropping"?jx(e):e.strategy==="sliding"?zx(e):Bx(e),bd),M1=l(2,N(function*(e,t){let r=yield*R1(t);return yield*Ma(mw(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),mw=l(e=>Hr(e[0]),(e,t,r)=>eu(e,n=>iN(t,n)).pipe(r?.shutdownOnEnd===!0?Ra(bd(t)):D)),$1=l(2,N(function*(e,t){let r=yield*R1(t);return yield*eu(e,n=>Wx(r,n)).pipe(Jn(n=>qx(r,n)),Ma),r}));var GZ="~effect/Stream",KZ={_R:D,_E:D,_A:D},N1=function(e){this.channel=e};N1.prototype={[GZ]:KZ,pipe(){return ne(this,arguments)}};var U1=e=>new N1(e);var D1="~effect/Sink",L1=g([void 0]),ZZ={_A:D,_In:D,_L:D,_E:D,_R:D},QZ={[D1]:ZZ,pipe(){return ne(this,arguments)}},vd=e=>O(e,D1),hw=e=>Od((t,r)=>Se(e)(t,r).pipe(I(vt({disableYield:!0})),ze(g)));var Od=e=>{let t=Object.create(QZ);return t.transform=e,t},gw=e=>Oe((t,r)=>g(I(e.transform(t,r),ee)));var YZ=e=>Od(()=>e);var B1=e=>YZ(k(e));var _d=Od(e=>ze(vt(e,{disableYield:!0}),()=>L1));var j1=e=>{let t=At(e);return Od(r=>{let n=[];if(t===0)return g([n]);let o;return r.pipe(I(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?ee():W;for(let a=0;a<s.length;a++)if(n.push(s[a]),n.length===t)return a+1<s.length&&(o=s.slice(a+1)),ee();return W}),vt({disableYield:!0}),ze(()=>g([n,o])))})};var z1=e=>XZ(Eo(t=>e(t),{discard:!0})),XZ=e=>Od(t=>t.pipe(I(e),vt({disableYield:!0}),ze(()=>L1)));var H1=e=>hw(La(F(e,gw)));var Oo={};$n(Oo,{DefaultChunkSize:()=>X1,Do:()=>LQ,TypeId:()=>Y1,accumulate:()=>wQ,aggregate:()=>xQ,aggregateWithin:()=>vw,as:()=>M5,bind:()=>jQ,bindEffect:()=>zQ,bindTo:()=>HQ,broadcast:()=>kU,broadcastN:()=>yQ,buffer:()=>T8,bufferArray:()=>k8,callback:()=>py,catch:()=>Ld,catchCause:()=>pU,catchCauseFilter:()=>N8,catchCauseIf:()=>$8,catchDefect:()=>A8,catchFilter:()=>kw,catchIf:()=>mU,catchReason:()=>F8,catchReasons:()=>R8,catchTag:()=>_8,catchTags:()=>P8,changes:()=>TQ,changesWith:()=>vU,changesWithEffect:()=>kQ,chunks:()=>bU,collect:()=>CQ,combine:()=>tQ,combineArray:()=>rQ,concat:()=>nu,cross:()=>o8,crossWith:()=>fU,debounce:()=>cQ,decodeText:()=>Ow,die:()=>h5,drain:()=>H5,drainFork:()=>q5,drop:()=>Aw,dropRight:()=>Y8,dropUntil:()=>J8,dropUntilEffect:()=>Z8,dropWhile:()=>SU,dropWhileEffect:()=>EU,dropWhileFilter:()=>Q8,empty:()=>gn,encodeText:()=>AQ,ensuring:()=>MQ,fail:()=>Ba,failCause:()=>rU,failCauseSync:()=>g5,failSync:()=>m5,filter:()=>x8,filterEffect:()=>S8,filterMap:()=>y8,filterMapEffect:()=>E8,flatMap:()=>qf,flatten:()=>iU,flattenArray:()=>z5,flattenEffect:()=>N5,flattenIterable:()=>Z5,flattenTake:()=>Q5,forever:()=>J5,fromArray:()=>Nd,fromArrayEffect:()=>E5,fromArrays:()=>b5,fromAsyncIterable:()=>T5,fromChannel:()=>R,fromEffect:()=>ly,fromEffectDrain:()=>eU,fromEffectRepeat:()=>tU,fromEffectSchedule:()=>f5,fromEventListener:()=>v5,fromIterable:()=>ou,fromIterableEffect:()=>y5,fromIterableEffectRepeat:()=>S5,fromIteratorSucceed:()=>x5,fromPubSub:()=>C5,fromPubSubTake:()=>nU,fromPull:()=>vo,fromQueue:()=>I5,fromReadableStream:()=>w5,fromSchedule:()=>k5,fromSubscription:()=>A5,groupAdjacentBy:()=>gQ,groupBy:()=>mQ,groupByKey:()=>hQ,grouped:()=>pQ,groupedWithin:()=>dQ,haltWhen:()=>PQ,ignore:()=>B8,ignoreCause:()=>j8,interleave:()=>OQ,interleaveWith:()=>_U,interruptWhen:()=>_Q,intersperse:()=>OU,intersperseAffixes:()=>vQ,isStream:()=>ve,iterate:()=>_5,let:()=>BQ,limitBytes:()=>W8,make:()=>p5,map:()=>In,mapAccum:()=>nQ,mapAccumArray:()=>su,mapAccumArrayEffect:()=>sQ,mapAccumEffect:()=>oQ,mapArray:()=>sU,mapArrayEffect:()=>U5,mapBoth:()=>$5,mapEffect:()=>Ud,mapError:()=>hU,merge:()=>Dd,mergeAll:()=>n8,mergeEffect:()=>dy,mergeLeft:()=>t8,mergeResult:()=>e8,mergeRight:()=>r8,mkArrayBuffer:()=>XQ,mkString:()=>Rw,mkUint8Array:()=>eY,never:()=>F5,onEnd:()=>RQ,onError:()=>FQ,onExit:()=>PU,onFirst:()=>RU,onStart:()=>FU,orDie:()=>L8,orElseIfEmpty:()=>U8,orElseSucceed:()=>D8,paginate:()=>O5,partition:()=>I8,partitionEffect:()=>b8,partitionQueue:()=>ww,peel:()=>w8,pipeThrough:()=>IQ,pipeThroughChannel:()=>bQ,pipeThroughChannelOrFail:()=>AU,prepend:()=>X5,provide:()=>MU,provideContext:()=>$Q,provideService:()=>NQ,provideServiceEffect:()=>Pw,race:()=>g8,raceAll:()=>lU,range:()=>P5,rechunk:()=>IU,repeat:()=>W5,repeatElements:()=>K5,result:()=>D5,retry:()=>z8,run:()=>hy,runCollect:()=>gy,runCount:()=>qQ,runDrain:()=>xy,runFold:()=>VQ,runFoldEffect:()=>GQ,runForEach:()=>ZQ,runForEachArray:()=>Fw,runForEachWhile:()=>QQ,runHead:()=>KQ,runIntoPubSub:()=>sY,runIntoQueue:()=>cY,runLast:()=>JQ,runSum:()=>WQ,scan:()=>aQ,scanEffect:()=>iQ,schedule:()=>V5,scoped:()=>R5,service:()=>c5,serviceOption:()=>u5,share:()=>EQ,sliding:()=>X8,slidingSize:()=>CU,split:()=>eQ,splitLines:()=>_w,succeed:()=>ru,suspend:()=>bn,switchMap:()=>j5,sync:()=>d5,take:()=>q8,takeRight:()=>V8,takeUntil:()=>gU,takeUntilEffect:()=>xU,takeWhile:()=>yU,takeWhileEffect:()=>K8,takeWhileFilter:()=>G8,tap:()=>aU,tapBoth:()=>L5,tapCause:()=>dU,tapDefect:()=>O8,tapError:()=>Tw,tapErrorTag:()=>v8,tapSink:()=>B5,throttle:()=>lQ,throttleEffect:()=>wU,tick:()=>l5,timeout:()=>G5,timeoutOrElse:()=>cU,toAsyncIterable:()=>oY,toAsyncIterableEffect:()=>nY,toAsyncIterableWith:()=>$w,toChannel:()=>Ao,toPubSub:()=>aY,toPubSubTake:()=>NU,toPull:()=>YQ,toQueue:()=>iY,toReadableStream:()=>tY,toReadableStreamEffect:()=>rY,toReadableStreamWith:()=>Mw,transduce:()=>Bd,transformPull:()=>pr,transformPullBracket:()=>bw,unfold:()=>oU,unwrap:()=>en,unwrapReason:()=>M8,updateContext:()=>$U,updateService:()=>UQ,when:()=>C8,withExecutionPlan:()=>H8,withSpan:()=>DQ,zip:()=>a8,zipFlatten:()=>u8,zipLatest:()=>m8,zipLatestAll:()=>Cw,zipLatestWith:()=>h8,zipLeft:()=>i8,zipRight:()=>c8,zipWith:()=>Iw,zipWithArray:()=>my,zipWithIndex:()=>f8,zipWithNext:()=>l8,zipWithPrevious:()=>p8,zipWithPreviousAndNext:()=>d8});var q1="~effect/RcMap",e5=e=>({[q1]:q1,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:Bc()},pipe(){return ne(this,arguments)}}),W1=e=>Kn(t=>{let r=t.context,n=$e(r,ln),o=e5({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive=="function"?RO(e.idleTimeToLive,pt):ct(pt(e.idleTimeToLive??gi)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return at(Ls(n,()=>{if(o.state._tag==="Closed")return W;let s=o.state.map;return o.state={_tag:"Closed"},Eo(s,([,a])=>bo(Fd(a))).pipe(jr(()=>U(()=>{lx(s)})))}),o)}),xw=l(2,(e,t)=>Ws(r=>{if(e.state._tag==="Closed")return En;let n=e.state,o=Df(),s=Gn(n.map,t),a;if(s._tag==="Some")a=s.value,a.refCount++;else{if(Number.isFinite(e.capacity)&&x$(e.state.map)>=e.capacity)return k(new gM(`RcMap attempted to exceed capacity of ${e.capacity}`));{a={deferred:Aa(),scope:yo(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},a.finalizer=r5(e,t,a),jc(n.map,t,a);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((f,p)=>{c.set(p,f)}),c.set(ln.key,a.scope);let u=pi(c);L(()=>e.lookup(t)).pipe(Io(u),Ui(a.scope)).addObserver(f=>{EM(f)&&t5(e,t,a,u),xo(a.deferred,f)})}}let i=fo(o.context,ln);return cr(i,a.finalizer).pipe(Kt(r(Ti(a.deferred))))}));var t5=(e,t,r,n)=>{if(e.state._tag==="Closed")return;let o=Gn(e.state.map,t);o._tag==="None"||o.value!==r||(vi(e.state.map,t),!(r.refCount>0)&&Fd(r).pipe(Io(n),Ui(e.scope)))},Fd=e=>e.fiber?Xo(e.fiber).pipe(Kt(Ze(e.scope,Gt))):Ze(e.scope,Gt),r5=(e,t,r)=>Kn(n=>{if(r.refCount--,r.refCount>0)return W;if(e.state._tag==="Closed")return Fd(r);let o=Gn(e.state.map,t);if(o._tag==="None"||o.value!==r)return Fd(r);if(ff(r.idleTimeToLive))return vi(e.state.map,t),Fd(r);if(!Rs(r.idleTimeToLive))return W;let s=n.getRef(kf);return r.expiresAt=s.currentTimeMillisUnsafe()+Lr(r.idleTimeToLive),r.fiber?W:(r.fiber=Ws(function a(i){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag==="Closed"||r.refCount>0)return W;let f=Gn(e.state.map,t);return f._tag==="None"||f.value!==r?W:(vi(e.state.map,t),Ze(r.scope,Gt))}return I(i(s.sleep(xi(u))),()=>a(i))}).pipe(Ra(U(()=>{r.fiber=void 0})),Io(n.context),Ui(e.scope)),W)});var yw=l(2,(e,t)=>Gs(r=>{if(e.state._tag==="Closed")return W;let n=Gn(e.state.map,t);if(n._tag==="None"||ff(n.value.idleTimeToLive))return W;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+Lr(o.idleTimeToLive),W}));var n5="~effect/RcRef",Rd={_tag:"Empty"},o5={_tag:"Closed"},s5={_A:D,_E:D},Sw=class{[n5]=s5;pipe(){return ne(this,arguments)}state=Rd;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},K1=e=>Kn(t=>{let r=t.context,n=$e(r,ln),o=new Sw(e.acquire,r,n,e.idleTimeToLive!==void 0?pt(e.idleTimeToLive):void 0);return at(Ls(n,()=>{let s=o.state;return o.state=o5,s._tag==="Acquired"?Ze(s.scope,Gt):s._tag==="Acquiring"?Xo(s.fiber):W}),o)}),a5=(e,t)=>{switch(e.state._tag){case"Closed":return En;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?at(Xo(r.fiber),r):g(r)}case"Acquiring":{let r=e.state;return r.awaiters++,G1(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=yo(),o=pn(e.acquire,or(e.context,ln,n)).pipe(I(s=>{if(e.state!==r)return En;let a={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,g(a)}),Jn(s=>et(s)?W:(e.state===r&&(e.state=Rd),Ze(n,s))));return r.fiber=Io(Df().context)(o),G1(e,r,t)}}},G1=(e,t,r)=>Jn(r(Ni(t.fiber)),n=>{let o=t.acquired;return o!==void 0?ka(n)?Z1(e,o):W:--t.awaiters>0||e.state!==t?W:(e.state=Rd,Xo(t.fiber))}),J1=e=>{let t=e;return Ws(r=>I(qc,n=>I(a5(t,r),o=>at(Ls(n,()=>Z1(t,o)),o.value))))},Z1=(e,t)=>{if(t.refCount--,t.refCount>0)return W;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Rd),Ze(t.scope,Gt)):Rs(r)?(t.fiber=Ws(n=>I(n(Pi(r)),()=>e.state===t&&t.refCount===0?(e.state=Rd,Ze(t.scope,Gt)):W)).pipe(Ra(U(()=>{t.fiber=void 0})),Io(e.context),Ui(e.scope)),W):W};var fy=K1,Md=J1;var Y1="~effect/Stream",ve=e=>O(e,Y1),X1=wd,R=U1,ly=e=>R(ty(F(e,Ae))),c5=e=>ly(iC(e)),u5=e=>ly(Rf(e)),eU=e=>vo(g(I(e,()=>ee()))),tU=e=>vo(g(F(e,Ae))),f5=(e,t)=>vo(tt(function*(){let r=yield*Go(t),n=yield*dn(e,wr,wr.defaultValue()),o=!0,s=L(()=>r(n)).pipe(I(a=>dn(e,wr,a)),F(a=>(n=a,Ae(a))));return L(()=>o?(o=!1,g(Ae(n))):s)})),l5=e=>vo(U(()=>{let t=!0,r=g(Ae(void 0)),n=rC(r,e);return L(()=>t?(t=!1,r):n)})),vo=e=>R(Ar(e)),pr=(e,t)=>R(Oe((r,n)=>I(Qs(e.channel,n),o=>t(o,n)))),bw=(e,t)=>R(rs((r,n,o)=>I(Qs(e.channel,n),s=>t(s,n,o)))),Ao=e=>e.channel,py=(e,t)=>R(kN(e,t)),gn=R(jf),ru=e=>R(ey(Ae(e))),p5=(...e)=>Nd(e),d5=e=>R(ON(()=>Ae(e()))),bn=e=>R(Xx(()=>e().channel)),Ba=e=>R(Zs(e)),m5=e=>R(PN(e)),rU=e=>R(Td(e)),h5=e=>R(XC(e)),g5=e=>R(FN(e)),x5=(e,t)=>R(YC(()=>e,t)),ou=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?Nd(e):R(vN(e,t?.chunkSize)),y5=e=>en(F(e,ou)),S5=e=>qf(tU(e),ou),Nd=e=>st(e)?R(ey(e)):gn,E5=e=>en(F(e,Nd)),b5=(...e)=>R(QC(rg(e,st))),I5=e=>R(MN(e)),C5=e=>R($N(e)),nU=e=>R(NN(e)),w5=e=>R(UN(e)),T5=(e,t)=>R(DN(e,t)),k5=e=>vo(F(rd(e),t=>ze(F(t(void 0),Ae),()=>ee()))),A5=e=>R(tw(e)),v5=(e,t,r)=>py(n=>{let o=typeof r=="object"&&r.once;function s(a){Da(n,a),o&&wo(n)}return Qr(U(()=>e.addEventListener(t,s,r)),()=>U(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r=="object"?r.bufferSize:void 0}),oU=(e,t)=>vo(U(()=>{let r=e;return I(L(()=>t(r)),n=>n===void 0?ee():(r=n[1],g(Ae(n[0]))))})),O5=(e,t)=>vo(U(()=>{let r=e,n=!1;return L(function o(){return n?ee():I(t(r),([s,a])=>(me(a)?n=!0:r=a.value,st(s)?g(s):o()))})})),_5=(e,t)=>oU(e,r=>g([r,t(r)])),P5=(e,t,r=wd)=>e>t?gn:vo(U(()=>{let n=lo(r),o=e,s=!1;return L(()=>{if(s)return ee();let a=t-o+1;if(a>n){let c=Bb(o,o+n-1);return o+=n,g(c)}let i=Bb(o,o+a-1);return s=!0,g(i)})})),F5=R(_N),en=e=>R(La(F(e,Ao))),R5=e=>R(x1(e.channel)),In=l(2,(e,t)=>bn(()=>{let r=0;return R(ns(e.channel,ar(n=>t(n,r++))))})),M5=l(2,(e,t)=>In(e,()=>t)),$5=l(2,(e,t)=>e.pipe(In(t.onElement),hU(t.onError))),sU=l(2,(e,t)=>R(ns(e.channel,t))),Ud=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,ry(t,r),ns(Ae),R)),N5=l(e=>ve(e[0]),(e,t)=>Ud(e,D,t)),U5=l(2,(e,t)=>R(ry(e.channel,t))),D5=e=>e.pipe(In(G),Ld(t=>ru(X(t)))),aU=l(e=>ve(e[0]),(e,t,r)=>Ud(e,n=>at(t(n),n),r)),L5=l(2,(e,t)=>e.pipe(Tw(t.onError),aU(t.onElement,{concurrency:t.concurrency}))),B5=l(2,(e,t)=>bw(e,N(function*(r,n,o){let s=zr(),a=zr(),i,c,u=!1,f=!1,p=s.whenOpen(L(()=>{if(i){let m=i;return i=void 0,f||s.closeUnsafe(),at(a.open,m)}return ee()}));yield*L(()=>t.transform(p,o)).pipe(m=>pd(m,x=>(u=!0,ka(x)&&(c=x.cause),a.open),!0),Zt(o));let d=r.pipe(I(m=>c?dt(c):u?g(m):(i=m,a.closeUnsafe(),s.openUnsafe(),at(a.await,m))),ze(()=>c?dt(c):u?ee():(f=!0,a.closeUnsafe(),s.openUnsafe(),I(a.await,()=>c?dt(c):ee()))));return L(()=>c?dt(c):u?r:d)}))),qf=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,ow(n=>t(n).channel,r),R)),j5=l(e=>ve(e[0]),(e,t,r)=>e.channel.pipe(Xr,m1(n=>t(n).channel,r),R)),iU=l(e=>ve(e[0]),(e,t)=>qf(e,D,t)),z5=e=>R(Xr(e.channel)),H5=e=>R(WN(e.channel)),q5=l(2,(e,t)=>dy(e,xy(t))),W5=l(2,(e,t)=>R(VN(e.channel,t))),V5=l(2,(e,t)=>e.channel.pipe(Xr,JN(t),ns(Ae),R)),G5=l(2,(e,t)=>cU(e,{duration:t,orElse:()=>gn})),cU=l(2,(e,t)=>{let r=pt(t.duration);if(!Rs(r))return e;if(ff(r))return bn(t.orElse);let n=Symbol();return pU(bn(()=>{let s=Df().getRef(kf),a=Lr(r),i,c=zr(!1);return Dd(pr(e,(u,f)=>L(()=>(i=s.currentTimeMillisUnsafe()+a,c.openUnsafe(),u)).pipe(F(p=>(c.closeUnsafe(),i=void 0,p)),g)),eU(tt(function*(){for(;;)if(yield*c.await,!(i===void 0||(yield*Pi(i-s.currentTimeMillisUnsafe()),i===void 0)||i-s.currentTimeMillisUnsafe()>0))return yield*lr(n)})),{haltStrategy:"left"})}),o=>o.reasons.find(a=>a._tag==="Die"&&a.defect===n)?t.orElse():rU(o))}),K5=l(2,(e,t)=>R(Oe((r,n)=>F(Se(Xr(e.channel))(r,n),o=>{let s,a=tt(function*(){let i=yield*o,c=Ae(i);return s=(yield*rd(t))(i).pipe(at(c),ze(f=>(s=void 0,a))),c});return L(()=>s??a)})))),J5=e=>R(KN(e.channel)),Z5=e=>qf(e,ou),Q5=e=>e.channel.pipe(Xr,qN,R),nu=l(2,(e,t)=>{let r=R(HN(AN(()=>Y5(e,t))));return uU.set(r,[e,t]),r}),uU=new WeakMap;function*Y5(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=uU.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var X5=l(2,(e,t)=>nu(ou(t),e)),Dd=l(e=>ve(e[0])&&ve(e[1]),(e,t,r)=>R(ay(Ao(e),Ao(t),r))),dy=l(2,(e,t)=>e.channel.pipe(h1(t),R)),e8=l(2,(e,t)=>Dd(In(e,G),In(t,X))),t8=l(2,(e,t)=>dy(e,xy(t))),r8=l(2,(e,t)=>dy(t,xy(e))),n8=l(2,(e,t)=>iU(ou(e),t)),o8=l(2,(e,t)=>fU(e,t,(r,n)=>[r,n])),fU=l(3,(e,t,r)=>qf(e,n=>In(t,o=>r(n,o)))),Iw=l(3,(e,t,r)=>my(e,t,s8(r))),s8=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},my=l(3,(e,t,r)=>R(rs(N(function*(n,o){let s=yield*Qs(e.channel,o),a=yield*Qs(t.channel,o),i=tt(function*(){let f=yield*Zt(s,o),p=yield*Zt(a,o);return yield*X$([f,p])}),c={_tag:"PullBoth"};return tt(function*(){let[f,p]=c._tag==="PullBoth"?yield*i:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*a],d=r(f,p);return st(d[1])?c={_tag:"PullRight",leftArray:d[1]}:st(d[2])?c={_tag:"PullLeft",rightArray:d[2]}:c={_tag:"PullBoth"},d[0]})})))),a8=l(2,(e,t)=>Iw(e,t,(r,n)=>[r,n])),i8=l(2,(e,t)=>my(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),c8=l(2,(e,t)=>my(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),u8=l(2,(e,t)=>Iw(e,t,(r,n)=>[...r,n])),f8=e=>In(e,(t,r)=>[t,r]),l8=e=>su(e,A,(t,r)=>{let n=0;t._tag==="None"&&(n=1,t=v(r[0]));let o=Lt();for(;n<r.length;n++){let s=t.value;t=v(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,A()]]:[]}}),p8=e=>su(e,A,(t,r)=>{let n=Lt();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=v(r[o])}return[t,n]}),d8=e=>su(e,()=>({prev:A(),current:A()}),(t,r)=>{let n=0,o;t.current._tag==="None"?(n=1,o=r[0],t.current=v(o)):o=t.current.value;let s=Lt();for(;n<r.length;n++){let a=r[n];t.current=v(a),s.push([t.prev,o,t.current]),t.prev=v(o),o=a}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,A()]]:[]}}),Cw=(...e)=>R(Xx(()=>{let t=[],r=new Set,n=zr(),o=zr();return sy(QC(e.map((s,a)=>s.channel.pipe(Xr,ry(i=>(t[a]=i,r.has(a)?g(Ae(t.slice())):(r.add(a),r.size<e.length?n.await:at(n.open,Ae(t.slice()))))),ZN(Tt),nw(()=>r.has(a)?W:o.open)))),{concurrency:"unbounded",bufferSize:0}).pipe(cw(o.await))})),m8=l(2,(e,t)=>Cw(e,t)),h8=l(3,(e,t,r)=>In(Cw(e,t),([n,o])=>r(n,o))),lU=(...e)=>R(Oe((t,r)=>U(()=>{let n,o=nC(e.map(s=>{let a=ur(r);return Qs(s.channel,a).pipe(I(i=>X0(g(i),i)),Jn(i=>i._tag==="Success"?n?Ze(a,i):(n=i.value[0],W):Ze(a,i)),F(([,i])=>i))}));return L(()=>n??o)}))),g8=l(2,(e,t)=>lU(e,t)),x8=l(2,(e,t)=>R(QN(Ao(e),t))),y8=l(2,(e,t)=>R(YN(Ao(e),t))),S8=l(2,(e,t)=>R(XN(Ao(e),t))),E8=l(2,(e,t)=>R(e1(Ao(e),t))),ww=l(e=>ve(e[0]),N(function*(e,t,r){let n=yield*qc,o=yield*Qs(e.channel,n),s=r?.capacity==="unbounded"?void 0:r?.capacity??X1,a=yield*mn({capacity:s}),i=yield*mn({capacity:s});return yield*tt(function*(){for(;;){let c=yield*o,u=[],f=[];for(let d=0;d<c.length;d++){let m=t(c[d]);be(m)?u.push(m.failure):f.push(m.success)}let p;if(f.length>0){let d=Jx(a,f);d.length>0&&(p=yield*Mf(Qc(a,d)))}if(u.length>0){let d=Jx(i,u);d.length>0&&(yield*Qc(i,d))}p&&(yield*Ni(p))}}).pipe(Zo(c=>(Js(a,c),Js(i,c),W)),Zt(n)),[a,i]})),$d=e=>R(Oe((t,r)=>at(cr(r,To(e)),Yc(e)))),b8=l(e=>ve(e[0]),(e,t,r)=>F(ww(Ud(e,n=>t(n),r),n=>n,r),([n,o])=>[$d(n),$d(o)])),I8=l(e=>ve(e[0]),(e,t,r)=>F(ww(e,t,{capacity:r?.capacity??16}),([n,o])=>[$d(n),$d(o)])),C8=l(2,(e,t)=>t.pipe(F(r=>r?e:gn),en)),w8=l(2,N(function*(e,t){let r,n=yield*pw(e.channel),o=Ct(n,c=>(r=c,dt(c))),[s,a]=yield*Ix(c=>t.transform(o,c)),i=r?gn:vo(g(n));return a&&(i=nu(Nd(a),i)),[s,i]})),T8=l(2,(e,t)=>R(S1(e.channel,t))),k8=l(2,(e,t)=>R(y1(e.channel,t))),pU=l(2,(e,t)=>e.channel.pipe(Hf(r=>t(r).channel),R)),A8=l(2,(e,t)=>e.channel.pipe(r1(r=>t(r).channel),R)),dU=l(2,(e,t)=>e.channel.pipe(ny(t),R)),Ld=l(2,(e,t)=>R(ts(e.channel,r=>t(r).channel)));var Tw=l(2,(e,t)=>e.channel.pipe(o1(t),R)),v8=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):mr(t);return Tw(e,o=>n(o)?r(o):W)}),O8=l(2,(e,t)=>dU(e,r=>{let n=Kg(r);return xt(n)?t(n.success):W})),mU=l(e=>ve(e[0]),(e,t,r,n)=>R(s1(Ao(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),kw=l(e=>ve(e[0]),(e,t,r,n)=>R(a1(Ao(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),_8=l(e=>ve(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):mr(t);return mU(e,o,r,n)}),P8=l(e=>ve(e[0]),(e,t,r)=>{let n;return kw(e,o=>(n??=Object.keys(t),O(o,"_tag")&&ax(o._tag)&&n.includes(o._tag)?G(o):X(o)),o=>t[o._tag](o),r)}),F8=l(e=>ve(e[0]),(e,t,r,n,o)=>R(i1(Ao(e),t,r,(s,a)=>n(s,a).channel,o&&((s,a)=>o(s,a).channel)))),R8=l(e=>ve(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let a of Object.keys(r)){let i=r[a];o[a]=(c,u)=>i(c,u).channel}let s=n&&((a,i)=>n(a,i).channel);return R(c1(e.channel,t,o,s))}),M8=l(2,(e,t)=>kw(e,r=>mr(r,t)&&O(r,"reason")?G(r.reason):X(r),Ba)),hU=l(2,(e,t)=>R(u1(e.channel,t))),$8=l(3,(e,t,r)=>R(n1(e.channel,t,n=>r(n).channel))),N8=l(3,(e,t,r)=>R(oy(e.channel,t,(n,o)=>r(n,o).channel))),U8=l(2,(e,t)=>R(zN(e.channel,r=>Ao(t())))),D8=l(2,(e,t)=>Ld(e,r=>ru(t(r)))),L8=e=>R(f1(e.channel)),B8=l(e=>ve(e[0]),(e,t)=>R(l1(e.channel,t))),j8=l(e=>ve(e[0]),(e,t)=>R(p1(e.channel,t))),z8=l(2,(e,t)=>R(d1(e.channel,t))),Q1=(e,t)=>en(F(Go(t),r=>{let n=wr.defaultValue(),o=()=>Ld(Pw(e,wr,U(()=>n)),s=>en(ze(F(r(s),a=>(n=a,en(at(cd,o())))),()=>g(Ba(s)))));return o()})),H8=l(e=>ve(e[0]),(e,t,r)=>bn(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},a=Pw(ux,U(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),i=r?.onEvent===void 0?void 0:W0(r.onEvent,()=>s),c,u=i===void 0?D:d=>PU(FU(d,F(i.begin,m=>{c=m})),m=>L(()=>{if(c===void 0)return W;let x=c;return c=void 0,i.end(x,m)})),f=A(),p=bn(()=>{let d=t.steps[o];if(!d)return Ba(Pb(f));let m=a(u(MU(e,d.provide))),x=!1;if(fe(f)){let y=f.value,E=!1,w=m;m=bn(()=>E?w:(E=!0,Ba(y))),m=Q1(m,id(d,!1))}else{let y=id(d,!0);m=y?Q1(m,y):m}return Ld(n?RU(m,y=>(x=!0,W)):m,y=>(o++,n&&x?Ba(y):(f=v(y),p)))});return p})),q8=l(2,(e,t)=>{let r=At(t);return r===0?gn:gU(e,(n,o)=>o===r-1)}),W8=l(3,(e,t,r)=>bn(()=>{let n=Gc(t),o=BigInt(0),s=!1;return nu(yU(e,a=>{let i=o+BigInt(a.length);return i>n?(s=!0,!1):(o=i,!0)}),bn(()=>s?r():gn))})),V8=l(2,(e,t)=>{let r=At(t);return r===0?gn:su(e,Ua,(n,o)=>(Fx(n,o),n.length>r&&Mx(n,n.length-r),[n,ja]),{onHalt(n){return Li(n)}})}),gU=l(e=>ve(e[0]),(e,t,r)=>pr(e,(n,o)=>U(()=>{let s=0,a=!1;return I(L(()=>a?ee():n),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){a=!0;let f=c.slice(0,r?.excludeLast?u:u+1);return st(f)?g(f):ee()}return g(c)})}))),xU=l(e=>ve(e[0]),(e,t,r)=>pr(e,(n,o)=>U(()=>{let s=0,a=!1;return tt(function*(){if(a)return yield*ee();let i=yield*n;for(let c=0;c<i.length;c++)if(yield*t(i[c],s++)){a=!0;let u=i.slice(0,r?.excludeLast?c:c+1);return st(u)?u:yield*ee()}return i})}))),yU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=0,s=!1,a=I(L(()=>s?ee():r),i=>{let c=[];for(let u=0;u<i.length;u++){if(!t(i[u],o++)){s=!0;break}c.push(i[u])}return st(c)?g(c):s?ee():a});return a}))),G8=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!1,s=I(L(()=>o?ee():r),a=>{let i=[];for(let c=0;c<a.length;c++){let u=t(a[c]);if(be(u)){o=!0;break}i.push(u.success)}return st(i)?g(i):o?ee():s});return s}))),K8=l(2,(e,t)=>xU(e,(r,n)=>F(t(r,n),o=>!o),{excludeLast:!0})),Aw=l(2,(e,t)=>{let r=At(t);return r===0?e:pr(e,(n,o)=>U(()=>{let s=0,a=n.pipe(I(i=>s>=r?g(i):(s+=i.length,s<=r?a:g(i.slice(r-s)))));return a}))}),J8=l(2,(e,t)=>Aw(SU(e,(r,n)=>!t(r,n)),1)),Z8=l(2,(e,t)=>Aw(EU(e,(r,n)=>F(t(r,n),o=>!o)),1)),SU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=0,a=I(r,i=>{let c=i.findIndex(u=>!t(u,s++));return c===-1?a:(o=!1,g(i.slice(c)))});return L(()=>o?a:r)}))),Q8=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=I(r,a=>{let i=a.findIndex(c=>be(t(c)));return i===-1?s:(o=!1,g(a.slice(i)))});return L(()=>o?s:r)}))),EU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s=0,a=tt(function*(){for(;;){let i=yield*r;for(let c=0;c<i.length;c++)if(!(yield*t(i[c],s++)))return o=!1,i.slice(c)}});return L(()=>o?a:r)}))),Y8=l(2,(e,t)=>{let r=At(t);return r===0?e:pr(e,(n,o)=>U(()=>{let s=Ua(),a=I(n,i=>{Rx(s,i);let c=s.length-r,u=Jc(s,c);return Dr(u)?g(u):a});return a}))}),bU=e=>e.channel.pipe(ns(Ae),R),IU=l(2,(e,t)=>(t=lo(t),pr(e,(r,n)=>U(()=>{let o=Lt(),s=0,a,i=!1;return L(function c(){if(i)return ee();if(a===void 0)return I(r,u=>{if(o.length===0&&u.length===t)return g(u);if(o.length+u.length<t){for(let f=0;f<u.length;f++)o.push(u[f]);return c()}return a=u,c()});for(;s<a.length;)if(o.push(a[s++]),o.length===t){let u=o;return o=[],g(u)}return s=0,a=void 0,c()}).pipe(ze(()=>{if(o.length===0)return ee();let c=o;return i=!0,o=[],g(c)}))})))),X8=l(2,(e,t)=>CU(e,t,1)),CU=l(3,(e,t,r)=>{let n=lo(t),o=lo(r);return pr(e,(s,a)=>U(()=>{let i=null,c=Ua(),u=!1,f=0,p=Fa(s,{onSuccess(d){if(Rx(c,d),f>0){let x=c.length;Mx(c,f),f=Math.max(0,f-x)}if(c.length<n)return p;u=!0;let m=[];for(;c.length>=n;)if(n===o)m.push(Jc(c,n));else{m.push(oN(c,n));let x=c.length;Mx(c,o),f=Math.max(0,o-x)}return g(m)},onFailure(d){return c.length===0||u&&c.length<=n-o?dt(d):(i=d,g(Ae(Li(c))))}});return L(()=>i?dt(i):p)}))}),eQ=l(2,(e,t)=>su(e,Lt,(r,n)=>{let o=Lt();for(let s=0;s<n.length;s++)t(n[s])?Dr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return Dr(r)?Ae(r):ja}})),tQ=l(4,(e,t,r,n)=>sw(Xr(e.channel),Xr(t.channel),r,n).pipe(ns(Ae),R)),rQ=l(4,(e,t,r,n)=>R(sw(e.channel,t.channel,r,n))),nQ=l(e=>ve(e[0]),(e,t,r,n)=>R(zf(e.channel,t,(o,s)=>{let a=Lt();for(let i=0;i<s.length;i++){let[c,u]=r(o,s[i]);o=c,a.push(...u)}return[o,Dr(a)?Ae(a):ja]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0))),su=l(e=>ve(e[0]),(e,t,r,n)=>R(zf(e.channel,t,(o,s)=>{let[a,i]=r(o,s);return o=a,[o,st(i)?Ae(i):ja]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0))),ja=Lt(),oQ=l(e=>ve(e[0]),(e,t,r,n)=>e.channel.pipe(Xr,zf(t,(o,s)=>F(r(o,s),([a,i])=>[a,st(i)?Ae(i):Lt()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0),R)),sQ=l(e=>ve(e[0]),(e,t,r,n)=>e.channel.pipe(zf(t,(o,s)=>F(r(o,s),([a,i])=>[a,st(i)?Ae(i):ja]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return st(s)?Ae(s):ja}}:void 0),R)),aQ=l(3,(e,t,r)=>bn(()=>{let n=t();return nu(ru(n),R(zf(e.channel,()=>n,(o,s)=>{let a=Lt();for(let i=0;i<s.length;i++)o=r(o,s[i]),a.push(o);return[o,Ae(a)]})))})),iQ=l(3,(e,t,r)=>bn(()=>e.channel.pipe(Xr,t1(t(),r),ns(Ae),R))),cQ=l(2,(e,t)=>pr(e,N(function*(r,n){let o=yield*kf,s=Lr(pt(t)),a,i,c=1/0,u=zr(),f=zr(),p=zr();yield*r.pipe(u.whenOpen,I(m=>(f.openUnsafe(),a=m,c=o.currentTimeMillisUnsafe()+s,W)),vt({disableYield:!0}),Zo(m=>(i=m,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),p.openUnsafe(),W)),Zt(n));let d=L(function m(){let x=o.currentTimeMillisUnsafe(),y=c<x?s:Math.min(s,c-x);return I(Hs(Pi(y),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(a){f.closeUnsafe(),u.closeUnsafe();let w=g(Ae(Xh(a)));return a=void 0,w}else if(i)return dt(i);return m()})});return L(()=>{if(i){if(a){let m=g(Ae(Xh(a)));return a=void 0,m}return dt(i)}return u.openUnsafe(),f.whenOpen(d)})}))),wU=l(2,(e,t)=>{let r=t.burst??0;return t.strategy==="enforce"?uQ(e,t.cost,t.units,t.duration,r):fQ(e,t.cost,t.units,t.duration,r)}),uQ=(e,t,r,n,o)=>pr(e,s=>Gs(a=>{let i=Lr(pt(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.currentTimeMillisUnsafe();return g(I(s,function p(d){return I(t(d),m=>{let x=a.currentTimeMillisUnsafe(),E=(x-f)/i,w=u+E*r,T=w<0?c:Math.min(w,c);return m<=T?(u=T-m,f=x,g(d)):I(s,p)})}))})),fQ=(e,t,r,n,o)=>pr(e,s=>Gs(a=>{let i=Lr(pt(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.monotonicTimeNanosUnsafe();return g(I(s,p=>I(t(p),d=>{let m=a.monotonicTimeNanosUnsafe(),y=Number(m-f)/1e6/i,E=u+y*r,T=Math.min(E,c)-d;if(T>=0)return u=T,f=m,g(p);let M=-T/r,P=Math.max(0,M*i);return P>0?I(Pi(P),()=>(u=T,f=m,g(p))):(u=T,f=m,g(p))})))})),lQ=l(2,(e,t)=>wU(e,{...t,cost:r=>g(t.cost(r))})),pQ=l(2,(e,t)=>bU(IU(e,t))),dQ=l(3,(e,t,r)=>vw(e,j1(lo(t)),j0(r))),mQ=l(e=>ve(e[0]),(e,t,r)=>TU(e,N(function*(n,o,s){for(let a=0;a<n.length;a++){let[i,c]=yield*t(n[a]),u=Gn(s,i),f=fe(u)?u.value:yield*qs(xw(o,i));yield*yw(o,i),yield*Yr(f,c)}}),r)),hQ=l(e=>ve(e[0]),(e,t,r)=>bn(()=>{let n=Bc();return TU(e,N(function*(o,s,a){for(let i=0;i<o.length;i++){let c=t(o[i]),u=Gn(n,c);me(u)?jc(n,c,[o[i]]):u.value.push(o[i])}for(let[i,c]of n){let u=Gn(a,i),f=fe(u)?u.value:yield*qs(xw(s,i));yield*yw(s,i),yield*Qc(f,c)}lx(n)}),r)})),TU=(e,t,r)=>bw(e,N(function*(n,o,s){let a=yield*fN();yield*cr(o,To(a));let i=Bc(),c=yield*W1({lookup:u=>Qr(mn({capacity:r?.bufferSize??4096}).pipe(jr(f=>(jc(i,u,f),Yr(a,[u,$d(f)])))),f=>(vi(i,u),VC(f))),idleTimeToLive:r?.idleTimeToLive??ya}).pipe(va(s));return yield*Ko({while:sn,body:ct(I(n,u=>t(u,c,i))),step:yn}).pipe(Ct(u=>yr(a,u)),Zt(o)),Yc(a)})),gQ=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o,s,a=Lt(),i=r.pipe(I(u=>{for(let f=0;f<u.length;f++){let p=u[f],d=t(p);if(s===void 0){o=d,s=[p];continue}else if(Z(d,o)){s.push(p);continue}a.push([o,s]),o=d,s=[p]}if(Dr(a)){let f=a;return a=[],g(f)}return i})),c=!1;return ze(L(()=>c?ee():i),()=>{c=!0;let u=s;return s=void 0,u&&Dr(u)?g(Ae([o,u])):ee()})}))),Bd=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o,s,a=L(()=>{if(s!==void 0){let c=s;return s=void 0,g(c)}return r}).pipe(Jo(c=>(o=Vo(c),ee()))),i=F(L(()=>t.transform(a,n)),([c,u])=>(s=u,Ae(c)));return L(()=>o||i)}))),xQ=l(2,(e,t)=>vw(e,t,od)),vw=l(3,(e,t,r)=>R(rs(N(function*(n,o,s){let a=yield*Qs(e.channel,o),i=zr(!1),c=Symbol(),u=yield*mn({capacity:0});yield*a.pipe(i.whenOpen,I(h=>(i.closeUnsafe(),Yr(u,h))),vt,Ct(h=>yr(u,h)),Zt(s));let f=yield*kf,p=yield*Lc(r),d=zr(!1),m=f.currentTimeMillisUnsafe(),x=0,y=A(),E,w=h=>(d.openUnsafe()&&(x=f.currentTimeMillisUnsafe()),g(h)),T=d.await.pipe(I(()=>p(m,y)),I(([,h])=>Pi(h)),I(()=>Yr(u,c)),ze(()=>VC(u)),I(()=>Hc)),M=L(()=>{if(E!==void 0){let h=E;return E=void 0,w(h)}return u.state._tag==="Open"&&i.openUnsafe(),I(hn(u),h=>h===c?ee():w(h))}),P=I(([h,S])=>{if(d.isOpen())m+=f.currentTimeMillisUnsafe()-x;else if(u.state._tag==="Done")return ee();return y=v(h),E=S,g(Ae(h))});return L(()=>{if(u.state._tag==="Done"&&E===void 0)return u.state.exit;d.closeUnsafe();let h=P(L(()=>t.transform(M,s)));return u.state._tag==="Open"?Hs(h,T):h})})))),yQ=l(2,N(function*(e,t){let r=At(t.n),n=yield*SQ(t),o=new Array(r),s=yield*ln;for(let a=0;a<r;a++){let i=ur(s),c=yield*Id(n).pipe(dn(ln,i));o[a]=ew(Vx(c)).pipe(kd(u=>Ze(i,u)),R)}return yield*eu(e.channel,a=>Wx(n,a)).pipe(Jn(a=>qx(n,a)),Ma),o})),SQ=e=>Qr(e.capacity==="unbounded"?Hx(e):e.strategy==="dropping"?jx(e):e.strategy==="sliding"?zx(e):Bx(e),bd),kU=l(2,(e,t)=>F(NU(e,t),nU)),EQ=l(2,(e,t)=>F(fy({acquire:kU(e,t),idleTimeToLive:t.idleTimeToLive}),r=>en(Md(r)))),bQ=l(2,(e,t)=>R(aw(e.channel,t))),AU=l(2,(e,t)=>R(iw(e.channel,t))),IQ=l(2,(e,t)=>e.channel.pipe(iw(gw(t)),jN(([r,n])=>n?ey(n):jf),R)),CQ=e=>ly(gy(e)),wQ=e=>su(e,Lt,(t,r)=>{let n=jb(t,r);return[n,[n]]}),TQ=e=>vU(e,Z),vU=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s;return I(r,function a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];t(f,s)||(s=f,c.push(f))}return Dr(c)?g(c):I(r,a)})}))),kQ=l(2,(e,t)=>pr(e,(r,n)=>U(()=>{let o=!0,s;return I(r,N(function*a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];(yield*t(f,s))||(s=f,c.push(f))}return Dr(c)?c:yield*I(r,N(a))}))}))),Ow=l(e=>ve(e[0]),(e,t)=>bn(()=>{let r=new TextDecoder(t?.encoding);return In(e,n=>r.decode(n,{stream:!0}))})),AQ=e=>bn(()=>{let t=new TextEncoder;return In(e,r=>t.encode(r))}),_w=e=>e.channel.pipe(aw(g1()),R),OU=l(2,(e,t)=>sU(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let a=0;a<r.length;a++)a===s?o.push(r[a]):o.push(r[a],t);return o})),vQ=l(2,(e,t)=>ru(t.start).pipe(nu(OU(e,t.middle)),nu(ru(t.end)))),OQ=l(2,(e,t)=>_U(e,t,ou(z_([!0,!1])))),_U=l(3,(e,t,r)=>R(Oe(N(function*(n,o){let s=yield*Se(Xr(r.channel))(n,o),a=Symbol(),i=!1,c=!1,u=(yield*Se(Xr(e.channel))(n,o)).pipe(ze(()=>(i=!0,g(a)))),f=(yield*Se(Xr(t.channel))(n,o)).pipe(ze(()=>(c=!0,g(a))));return tt(function*(){for(;;){if(i&&c)return yield*ee();let p=yield*s;if(p&&i||!p&&c)continue;let d=yield*p?u:f;if(d!==a)return Ae(d)}})})))),_Q=l(2,(e,t)=>R(cw(e.channel,t))),PQ=l(2,(e,t)=>R(E1(e.channel,t))),PU=l(2,(e,t)=>R(kd(e.channel,t))),FQ=l(2,(e,t)=>R(b1(e.channel,t))),FU=l(2,(e,t)=>R(I1(e.channel,t))),RU=l(2,(e,t)=>R(uw(e.channel,r=>t(r[0])))),RQ=l(2,(e,t)=>R(C1(e.channel,t))),MQ=l(2,(e,t)=>R(w1(e.channel,t))),MU=l(e=>ve(e[0]),(e,t,r)=>R(T1(e.channel,t,r))),$Q=l(2,(e,t)=>R(iy(e.channel,t))),NQ=l(3,(e,t,r)=>R(cy(e.channel,t,r))),Pw=l(3,(e,t,r)=>R(uy(e.channel,t,r))),$U=l(2,(e,t)=>R(k1(e.channel,t))),UQ=l(3,(e,t,r)=>$U(e,n=>or(n,t,r($e(n,t))))),DQ=function(){let e=ve(arguments[0]),t=e?arguments[1]:arguments[0],r=yi(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return R(fw(n.channel,t,r))}return n=>R(fw(n.channel,t,r))},LQ=ru({}),BQ=l(3,(e,t,r)=>In(e,n=>({...n,[t]:r(n)})));var jQ=l(e=>ve(e[0]),(e,t,r,n)=>qf(e,o=>In(r(o),s=>({...o,[t]:s})),n)),zQ=l(e=>ve(e[0]),(e,t,r,n)=>Ud(e,o=>F(r(o),s=>({...o,[t]:s})),n)),HQ=l(2,(e,t)=>In(e,r=>({[t]:r}))),hy=l(2,(e,t)=>Ix(r=>Qs(e.channel,r).pipe(I(n=>t.transform(n,r)),F(([n])=>n)))),gy=e=>tu(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),qQ=e=>tu(e.channel,()=>0,(t,r)=>t+r.length),WQ=e=>tu(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),VQ=l(3,(e,t,r)=>tu(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),GQ=l(3,(e,t,r)=>P1(e.channel,t,(n,o)=>{let s=0,a=n;return F(Ko({while:()=>s<o.length,body:()=>r(a,o[s]),step(i){a=i,s++}}),()=>a)})),KQ=e=>F(O1(e.channel),rr(Z_(0))),JQ=e=>F(_1(e.channel),rr(Xh)),ZQ=l(2,(e,t)=>eu(e.channel,r=>{let n=0;return Ko({while:()=>n<r.length,body:()=>t(r[n++]),step:yn})})),QQ=l(2,(e,t)=>v1(e.channel,r=>{let n=!1,o=0;return F(Ko({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),Fw=l(2,(e,t)=>eu(e.channel,t)),xy=e=>A1(e.channel),YQ=e=>pw(e.channel),Rw=e=>tu(e.channel,()=>"",(t,r)=>t+r.join("")),XQ=e=>F(lw(e.channel),t=>t.buffer),eY=e=>lw(e.channel),Mw=l(e=>ve(e[0]),(e,t,r)=>{let n,o,s=!1,a=zr(!1),i=r?.signal,c=()=>o.interruptUnsafe();return new ReadableStream({start(u){o=Yo(pn(Fw(e,f=>a.whenOpen(U(()=>{a.closeUnsafe();for(let p=0;p<f.length;p++)u.enqueue(f[p]);n(),n=void 0}))),t)),o.addObserver(f=>{i?.removeEventListener("abort",c),!s&&(f._tag==="Failure"&&i?.aborted!==!0?u.error(Uc(f.cause)):u.close())}),i!==void 0&&o.pollUnsafe()===void 0&&(i.aborted?c():i.addEventListener("abort",c,{once:!0}))},pull(){return new Promise(u=>{n=u,a.openUnsafe()})},cancel(){if(o)return s=!0,pC(_i(Xo(o)))}},r?.strategy)}),tY=l(e=>ve(e[0]),(e,t)=>Mw(e,nr(),t)),rY=l(e=>ve(e[0]),(e,t)=>F(Ri(),r=>Mw(e,r,t))),$w=l(2,(e,t)=>({[Symbol.asyncIterator](){let r=dC(t),n=Io(t),o=yo(),s,a,i,c,u=p=>{if(c)return c;let d=i;return c=r(at(Kt(d?Xo(d):W,Ze(o,p)),{done:!0,value:void 0})),c},f=async p=>{try{await u(p)}catch(d){await r(dd("Suppressed error while closing Stream async iterator",d))}};return{async next(){if(c)return c;if(a){let m=a.next();if(!m.done)return m;a=void 0}let p=n(s??I(Qs(e.channel,o),m=>(s=m,m)));i=p;let d=await r(Y$(p));if(i===p&&(i=void 0),et(d))return a=d.value[Symbol.iterator](),a.next();if(zs(d.cause))return u(Gt);if(c&&qp(d.cause))return c;throw await f(d),Uc(d.cause)},return(){return u(Gt)},async throw(p){throw await f(yM(p)),p}}}})),nY=e=>F(Ri(),t=>$w(e,t)),oY=e=>$w(e,nr()),sY=l(e=>ve(e[0]),(e,t,r)=>mw(e.channel,t,r)),aY=l(2,(e,t)=>M1(e.channel,t)),NU=l(2,(e,t)=>$1(e.channel,t)),iY=l(2,(e,t)=>F1(e.channel,t)),cY=l(2,(e,t)=>dw(e.channel,t));var yy="~effect/FileSystem",os=gt("effect/FileSystem"),Nw=e=>os.of({...e,[yy]:yy,exists:t=>Is(e.access(t),at(!0),_a("PlatformError",r=>r.reason._tag==="NotFound"?g(!1):k(r))),readFileString:(t,r)=>I(e.readFile(t),n=>Rt({try:()=>new TextDecoder(r).decode(n),catch:o=>Co({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:N(function*(t,r){let n=yield*e.open(t,{flag:"r"}),o=r?.offset===void 0?void 0:Gc(r.offset);o&&(yield*n.seek(o,"start"));let s=r?.bytesToRead===void 0?void 0:Gc(r.bytesToRead),a=BigInt(0),i=Number(BigInt(r?.chunkSize??64*1024)),c=n.readAlloc(i);return vo(g(I(L(()=>s!==void 0&&s<=a?ee():s!==void 0&&s-a<i?n.readAlloc(Number(s-a)):c),Le({onNone:()=>ee(),onSome:u=>(a+=BigInt(u.length),g(Ae(u)))}))))},en),sink:(t,r)=>Is(e.open(t,{...r,flag:r?.flag??"w"}),F(n=>z1(o=>n.writeAll(o))),H1),writeFileString:(t,r,n)=>I(Rt({try:()=>new TextEncoder().encode(r),catch:o=>Co({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),o=>e.writeFile(t,o,n))}),Mt=(e,t)=>Zn({module:"FileSystem",method:e,_tag:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),UU=e=>os.of({[yy]:yy,access(t){return k(Mt("access",t))},chmod(t){return k(Mt("chmod",t))},chown(t){return k(Mt("chown",t))},copy(t){return k(Mt("copy",t))},copyFile(t){return k(Mt("copyFile",t))},glob(t){return k(Mt("glob",t))},exists(){return g(!1)},link(t){return k(Mt("link",t))},makeDirectory(){return lr("not implemented")},makeTempDirectory(){return lr("not implemented")},makeTempDirectoryScoped(){return lr("not implemented")},makeTempFile(){return lr("not implemented")},makeTempFileScoped(){return lr("not implemented")},open(t){return k(Mt("open",t))},readDirectory(t){return k(Mt("readDirectory",t))},readFile(t){return k(Mt("readFile",t))},readFileString(t){return k(Mt("readFileString",t))},readLink(t){return k(Mt("readLink",t))},realPath(t){return k(Mt("realPath",t))},remove(){return W},rename(t){return k(Mt("rename",t))},sink(t){return B1(Mt("sink",t))},stat(t){return k(Mt("stat",t))},stream(t){return Ba(Mt("stream",t))},symlink(t){return k(Mt("symlink",t))},truncate(t){return k(Mt("truncate",t))},utimes(t){return k(Mt("utimes",t))},watch(t){return Ba(Mt("watch",t))},writeFile(t){return k(Mt("writeFile",t))},writeFileString(t){return k(Mt("writeFileString",t))},...e}),uY=e=>Bs(os)(UU(e)),Vf="~effect/FileSystem/File",fY=e=>O(e,Vf),Wf=class extends gt()("effect/FileSystem/WatchBackend"){};var DU="~effect/Path",Ys=gt("effect/Path"),Sy=e=>Ys.of({...e,[DU]:DU,resolveWithin(t,r){if(e.parse(r).root!=="")return A();let n=e.resolve(t),o=e.resolve(n,r),s=e.relative(n,o);return s===".."||s.startsWith(`..${e.sep}`)||e.isAbsolute(s)?A():v(o)}});var Wa={};$n(Wa,{fdName:()=>rk,isCommand:()=>Vy,isPipedCommand:()=>w9,isStandardCommand:()=>C9,make:()=>im,parseFdName:()=>cm,pipeTo:()=>T9,prefix:()=>k9,setCwd:()=>YT,setEnv:()=>XT});var Vi={};$n(Vi,{ChildProcessSpawner:()=>Wi,ExitCode:()=>GT,ProcessId:()=>KT,make:()=>JT,makeHandle:()=>Wy});function za(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Ey(e){return t=>za(t)?.[e]}var Cn="~structural",au="~identifier",jd="~sentinels",by="~constructor",LU=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],Gf=Ey("identifier"),Dw=Ey(au),Lw=Ey("title");var zd=No(e=>{let t=za(e)?.identifier;return typeof t=="string"?t:e.getExpected(zd)}),BU=new Set([jd,Cn,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var Te=Symbol();var vr=Zr,wn=vr(Te),rt=vr(Te),Hd=e=>e===Te?A():v(e),Bw=e=>e._tag==="None"?wn:vr(e.value);var Vd="~effect/SchemaIssue/Issue";function zw(e){return O(e,Vd)&&e[Vd]===Vd}function lY(e){return Object.hasOwn(e,"input")}var Qn=class{[Vd]=Vd;constructor(t,r){r?.reportInput===!0&&t!==Te&&(this.input=t)}},jU=class extends Qn{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},zU=class extends Qn{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},Yt=class extends Qn{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},zi=class extends Qn{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Hw=class extends Qn{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},Xt=class extends Qn{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},$t=class extends Qn{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},he=class extends Qn{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Tn(e,t,r,n,o){return new Xt(e,[new Yt([t],r)],n,o)}var Gd=class extends Qn{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Kd=class extends Qn{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},HU=class extends Qn{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function jw(e,t,r){if(zw(e))return e;if(typeof e=="string")return new he({message:e},t,r);let n=typeof e.issue=="string"?new he({message:e.issue},t,r):e.issue;return new Yt(e.path,n)}function qU(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new he(void 0,t,r):jw(e,t,r)}function WU(e,t,r,n){return Array.isArray(t)?st(t)?t.length===1?jw(t[0],r,n):new Xt(e,ar(t,o=>jw(o,r,n)),r,n):void 0:qU(t,r,n)}var VU=e=>{let t=Jf(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return ji(zd(e.ast),e);case"InvalidValue":{let r=qw(e);if(r!==void 0)return ji(r,e);let n=Iy(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=Iy(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=Iy(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},GU=e=>Jf(e.issue)??Jf(e);function KU(e){return t=>({issues:Kf(t,[],e?.leafHook??VU,e?.checkHook??GU)})}function Iy(e){return lY(e)?j(e.input):void 0}function qw(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function ji(e,t){let r=Iy(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Kf(e,t,r,n){switch(e._tag){case"Filter":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Kf(e.issue,t,r,n);let s=qw(e.issue);return[{path:t,message:s===void 0?ji(Ww(e.filter),e):ji(s,e.issue)}]}case"Encoding":return Kf(e.issue,t,r,n);case"Pointer":return Kf(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>Kf(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:Jf(e)??ji(zd(e.ast),e)}]:e.issues.flatMap(o=>Kf(o,t,r,n));default:return[{path:t,message:r(e)}]}}function Ww(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(r=>Ww(r)).join(" & ")}}function pY(){return e=>Wd(e,"")}var JU=pY();function Wd(e,t){let r;switch(e._tag){case"Filter":{let n=GU(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return Wd(e.issue,t);let o=qw(e.issue);r=o===void 0?ji(Ww(e.filter),e):ji(o,e.issue)}break}case"Encoding":return Wd(e.issue,t);case"Pointer":return Wd(e.issue,t+Th(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>Wd(n,t)).join(`
|
|
29
|
+
`);r=Jf(e)??ji(zd(e.ast),e);break}default:r=VU(e);break}return t?`${r}
|
|
30
|
+
at ${t}`:r}function Jf(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Jf(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r=="string")return r}function Jd(e){let t;for(let r of e.reasons){if(!Gg(r)||!zw(r.error))return;t??=r.error}return t}function Yn(e,t){let r=Jd(e);if(r===void 0)throw new Error(t,{cause:e});return r}var Vw=vf,QU=Dc,YU=zM,XU=HM,eD=qM,tD=k0,rD=WM;var nD=ox;var oD=A0;var Gw=GM,sD=KM;var Kw=JM;var Jw=v0,Zw=Yp,aD=O0;var iD=_0,Zd=ZM;var cD=Xp;var uD=R0;var fD=YM;var Qw=$0;var Zf=e=>dY(typeof e=="string"?mY.encode(e):e),iu=e=>{let t=gY(e),r=t.length;if(r%4!==0)return X(new ho({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return X(new ho({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let a=0,i=0;a<r;a+=4,i+=3){let c=Cy(t.charCodeAt(a))<<18|Cy(t.charCodeAt(a+1))<<12|Cy(t.charCodeAt(a+2))<<6|Cy(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return G(s)}catch(o){return X(new ho({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},pD=e=>gr(iu(e),t=>hY.decode(t)),dY=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4|e[n-1]>>4],r+=ss[(e[n-1]&15)<<2|e[n]>>6],r+=ss[e[n]&63];return n===t+1&&(r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=ss[e[n-2]>>2],r+=ss[(e[n-2]&3)<<4|e[n-1]>>4],r+=ss[(e[n-1]&15)<<2],r+="="),r},mY=new TextEncoder,hY=new TextDecoder,gY=e=>e.replace(/[\n\r]/g,""),ss="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qd=new Uint8Array(123).fill(255);for(let e=0;e<ss.length;e++)Qd[ss.charCodeAt(e)]=e;Qd[61]=0;var Cy=e=>{if(e>=Qd.length||Qd[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return Qd[e]};var dD=e=>Zf(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Xw=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return X(new ho({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return X(new ho({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),iu(n)},mD=e=>gr(Xw(e),t=>xY.decode(t)),xY=new TextDecoder;var Yd=e=>Object.assign(Object.create(ab),e);function SY(e){return gD((t,r)=>k(e(t,r)))}function wy(e){return SY((t,r)=>{let n={message:e(t)};return fe(t)?new Gd(n,t.value,r):new Gd(n)})}var hD=wy(()=>"Encoding is not supported"),EY=Yd({_tag:"Passthrough"});function ea(){return EY}function Ee(e){return Yd({_tag:"Transform",transform:e})}function Wr(e){return Yd({_tag:"TransformEffect",transform:e})}function Ty(e){return Yd({_tag:"TransformOptional",transform:e})}function gD(e){return Yd({_tag:"TransformOptionalEffect",transform:e})}function eT(){return Ty(()=>A())}function tT(e){return gD(t=>{let r=Cc(t,Tt);return fe(r)?g(r):Wc(e,v)})}function cu(){return Ee(globalThis.String)}function ky(){return Ee(globalThis.Number)}function xD(){return Ee(globalThis.BigInt)}function rT(){return Ee(e=>new globalThis.Date(e))}function yD(){return Ee(o$)}function SD(e){return Wr((t,r)=>Rt({try:()=>JSON.parse(t,e?.reviver),catch:()=>new he({expected:"a valid JSON string"},t,r)}))}function ED(e){return Wr((t,r)=>Rt({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError("Value cannot be represented as JSON");return n},catch:()=>new he({expected:"a JSON-serializable value"},t,r)}))}function nT(){return Ee(Zf)}function Ay(){return Ee(dD)}function vy(){return Ee(cg)}function bD(){return Wr((e,t)=>md(ud(iu(e)),()=>new he({expected:"a valid Base64 string"},e,t)))}function ID(){return Wr((e,t)=>cn(pD(e),{onFailure:()=>k(new he({expected:"a valid Base64 string"},e,t)),onSuccess:g}))}function CD(){return Wr((e,t)=>cn(Xw(e),{onFailure:()=>k(new he({expected:"a valid Base64Url string"},e,t)),onSuccess:g}))}function wD(){return Wr((e,t)=>cn(mD(e),{onFailure:()=>k(new he({expected:"a valid Base64Url string"},e,t)),onSuccess:g}))}function TD(){return Wr((e,t)=>cn(Yb(e),{onFailure:()=>k(new he({expected:"a valid hexadecimal string"},e,t)),onSuccess:g}))}function kD(){return Wr((e,t)=>cn(xP(e),{onFailure:()=>k(new he({expected:"a valid hexadecimal string"},e,t)),onSuccess:g}))}function AD(){return Ee(encodeURIComponent)}function vD(){return Wr((e,t)=>{try{return g(globalThis.decodeURIComponent(e))}catch{return k(new he({expected:"a valid URI component"},e,t))}})}function OD(){return Ee(e=>RD(Array.from(e.entries())))}var bY=MD(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function _D(){return Ee(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&bY(e).forEach(([n,o])=>{t.append(n,o)}),t})}function PD(){return Ee(e=>RD(Array.from(e.entries())))}var IY=MD(Nn);function FD(){return Ee(e=>typeof e=="object"&&e!==null?new URLSearchParams(IY(e)):new URLSearchParams)}function CY(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>af(o)?globalThis.Number(o):o)}var wY=20;function RD(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,a])=>{let i=CY(s),c=t;for(let u=0;u<i.length;u++){let f=o.get(c),p=i[u]===""&&f!==void 0?f.length:i[u];f!==void 0&&typeof p=="number"&&(f.length=Math.max(f.length,p+1));let d=Object.hasOwn(c,p),m=d?c[p]:void 0;if(u===i.length-1){let x=o.get(m);if(x!==void 0)z(m,x.length++,a);else if(n.has(m))m.push(a);else if(d){let y=[m,a];n.add(y),z(c,p,y)}else z(c,p,a)}else{let x=i[u+1],y=typeof x=="number"||x==="";if(r.has(m)&&o.has(m)===y)c=m;else{let E={};r.add(E),y&&o.set(E,{parent:c,key:p,length:0}),z(c,p,E),c=E}}}});for(let[s,{key:a,length:i,parent:c}]of Array.from(o).reverse())c[a]===s&&i-Object.keys(s).length<=wY&&z(c,a,Object.assign(new Array(i),s));return t}function MD(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{r.push([o,i])}):s.forEach((i,c)=>{n(`${o}[${c}]`,i)});else if(typeof s=="object"&&s!==null)for(let[a,i]of Object.entries(s))n(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var $D=/^[+-]?\d+$/,sT="~effect/BigDecimal",TY={[sT]:sT,[ae](){let e=iT(this);return xe(De(String(e.value)),Wt(e.scale))},[ie](e){return aT(e)&&jD(this,e)===0},toString(){return`BigDecimal(${Ha(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},aT=e=>O(e,sT),DD=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(TY);return r.value=e,r.scale=t,r},LD=(e,t)=>{let r=DD(e,t);return r.normalized=r,r};var as=BigInt(0),kY=BigInt(1);var AY=BigInt(10),BD=LD(as,0);var iT=e=>{if(e.normalized===void 0)if(e.value===as)e.normalized=BD;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=LD(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var vY=100,OY=[kY],oT=(e,t)=>e===t?0:e<t?-1:1,ND=(e,t)=>{let r=`${e.value<as?-e.value:e.value}`,n=`${t.value<as?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==as)return o<as?-1:1;let s=Math.max(r.length,n.length);return I_(r.padEnd(s,"0"),n.padEnd(s,"0"))},jD=(e,t)=>{if(e.scale===t.scale)return oT(e.value,t.value);let r=UD(e),n=UD(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>vY)return r===-1?ND(t,e):ND(e,t);let a=OY[s]??=AY**BigInt(s);return o>0?oT(e.value,t.value*a):oT(e.value*a,t.value)},Qf=li(jD);var UD=e=>e.value===as?0:e.value<as?-1:1;var zD=e=>{if(e==="")return v(BD);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!$D.test(c))return A()}else t=e,r=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),u=t.slice(a+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!$D.test(o))return A();let i=s-r;return Number.isSafeInteger(i)?v(DD(BigInt(o),i)):A()};var Ha=e=>{let t=iT(e);if(Math.abs(t.scale)>=16)return _Y(t);let r=t.value<as,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,"0"):n.padEnd(n.length-t.scale,"0"),s=o.length-t.scale,a=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${a}`:a},_Y=e=>{if(PY(e))return"0e+0";let t=iT(e),r=`${t.value}`,n=t.value<as?2:1,o=r.slice(0,n),s=r.slice(n),a=s.length-t.scale;return`${o}${s===""?"":`.${s}`}e${a>=0?"+":""}${a}`};var PY=e=>e.value===as;var Oy=class extends ii{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Oy(this.encode,this.decode)}},em="~effect/SchemaTransformation/Transformation",We=class extends ii{[em]=em;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new We(this.encode,this.decode)}};function FY(e){return O(e,em)&&e[em]===em}var _y=e=>FY(e)?e:new We(e.decode,e.encode);function dr(e){return new We(Wr(e.decode),Wr(e.encode))}function Ne(e){return new We(Ee(e.decode),Ee(e.encode))}function Py(e){return new We(Ty(e.decode),Ty(e.encode))}function qD(){return new We(yD(),ea())}var RY=new We(ea(),ea());function Yf(){return RY}var Xf=new We(ky(),cu()),Fy=new We(xD(),cu()),cT=new We(rT(),Ee(xb)),WD=new We(rT(),Ee(e=>e.getTime()));var uT=dr({decode:(e,t)=>Le(q$(e),{onNone:()=>k(new he({expected:"a valid ByteSize string"},e,t)),onSome:g}),encode:e=>g(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),VD=dr({decode:(e,t)=>Le(SC(e),{onNone:()=>k(new he({expected:"a non-negative bigint byte count"},e,t)),onSome:g}),encode:e=>g(Ax(e))}),GD=dr({decode:(e,t)=>Le(SC(e),{onNone:()=>k(new he({expected:"a non-negative safe-integer byte count"},e,t)),onSome:g}),encode:(e,t)=>Le(V$(e),{onNone:()=>k(new he({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:g})}),MY=e=>Dn(e)&&typeof e.message=="string",KD=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:ZD(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(r.name=e.name),typeof e.stack=="string"&&(r.stack=e.stack),r},$Y=e=>{try{let t=hc(e);return t===void 0?j(e):JSON.parse(t)}catch{return j(e)}},NY=(e,t,r)=>{let n={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},JD=e=>{let t=new WeakSet,r=n=>{if(LO(n)){if(t.has(n))return"[Circular]";t.add(n);let o=NY(n,e,r);return t.delete(n),o}return $Y(n)};return r},ZD=e=>MY(e)?KD(e):e,QD=e=>Ne({decode:KD,encode:t=>JD(e)(t)}),YD=e=>Ne({decode:ZD,encode:JD(e)});function XD(){return Ne({decode:_b,encode:Hh})}function e2(){return Ne({decode:ga,encode:Cr})}function t2(e){return Ne({decode:uo,encode:e?.onNoneEncoding===null?Hh:Cr})}function r2(){return Py({decode:v,encode:Ic})}function n2(){return Py({decode:e=>e.pipe(Cc(Tt),v),encode:Ic})}var fT=dr({decode:(e,t)=>URL.canParse(e)?g(new URL(e)):k(new he({expected:"a valid URL string"},e,t)),encode:e=>g(e.href)});var lT=new We(bD(),nT()),o2=new We(ID(),nT()),s2=new We(wD(),Ay()),a2=new We(kD(),vy()),i2=new We(vD(),AD());function c2(e){return new We(SD(e??{}),ED(e))}var u2=new We(OD(),_D()),f2=new We(PD(),FD());function qi(e){return t=>t._tag===e}var ol=qi("Declaration");var UY=qi("Never");var tl=qi("Literal"),dT=qi("UniqueSymbol");var bT=qi("Arrays"),DY=qi("Objects"),S2=qi("Union"),E2=qi("Suspend"),Ot=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},ra={},ta=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},l2="~effect/Schema",Nt=class{[l2]=l2;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},sl=class extends Nt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,i){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=i}getParser(){let e;return(t,r)=>t===Te?wn:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=fu(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new sl(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},LY=class extends Nt{_tag="Null";getParser(){return Hy(this,null)}getExpected(){return"null"}},IT=new LY;var BY=class extends Nt{_tag="Undefined";getParser(){return Hy(this,void 0)}toCodecJson(){return mt(this,[b2])}getExpected(){return"undefined"}},b2=new Ot(IT,new We(Ee(()=>{}),Ee(()=>null))),CT=new BY;var jY=class extends Nt{_tag="Void";getParser(){let e=vr(void 0);return t=>t===Te?wn:e}toCodecJson(){return mt(this,[b2])}getExpected(){return"void"}},I2=new jY;var zY=class extends Nt{_tag="Never";getParser(){return us(this,DO)}getExpected(){return"never"}},wT=new zY,HY=class extends Nt{_tag="Any";getParser(){return us(this,ub)}getExpected(){return"any"}},C2=new HY,qY=class extends Nt{_tag="Unknown";getParser(){return us(this,ub)}getExpected(){return"unknown"}},qa=new qY,WY=class extends Nt{_tag="ObjectKeyword";getParser(){return us(this,rp)}getExpected(){return"object | array | function"}},w2=new WY,T2=class extends Nt{_tag="Enum";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s=="number"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${j(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return us(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return mt(this,[new Ot(new kn(Object.keys(e).map(t=>new eo(t))),new We(Ee(t=>e[t]),cu()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function pT(e){return typeof e=="number"?`parts[${e}]`:e}function mT(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${pT(t)}`);let n;switch(e._tag){case"String":case"Number":case"BigInt":n=!0;break;case"Literal":n=!e.checks;break;case"TemplateLiteral":{let o=pT(t);n=!e.checks&&e.parts.every((s,a)=>mT(s,`${o}.parts[${a}]`,r));break}case"Union":{let o=pT(t);n=!e.checks&&e.types.every((s,a)=>mT(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var TT=class extends Nt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],a=[],i=new Set;for(let u=0;u<e.length;u++){let f=e[u];if(!mT(f,u,i))throw new Error(`Invalid TemplateLiteral part ${f._tag}`);s.push(f),a.push(f._tag==="Literal"?globalThis.String(f.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new _o(!1,this.parts.map(LT),[]),r=e(ul(Xn,t,A2(this)));return(n,o)=>{if(n===Te)return wn;let s=r(n,o);return s._tag==="Success"?rt:Tr(s,{onSuccess:()=>n,onFailure:a=>new Xt(this,[a],n,o)})}}getExpected(){return"string"}matchPart(e,t){return X2(this,e,t)===void 0?void 0:e}};function k2(e){let t=No(o=>{if(o._tag!=="Union")return o;let s=fu(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new kn(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new TT(e.map(o=>t(cs(o)))),n=new _o(!1,e.map(LT),[]);return ul(r,n,A2(r))}function A2(e){return new We(Wr((t,r)=>{let n=X2(e,t,r);return n?g(n):k(new he({expected:"a string matching template literal parts"},t,r))}),Ee(t=>t.join("")))}var v2=class extends Nt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return Hy(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return mt(this,[new Ot(e===void 0?wT:new eo(globalThis.String(this.symbol)),rL.transformation)])}getExpected(){return globalThis.String(this.symbol)}},eo=class extends Nt{_tag="Literal";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${j(e)}`);this.literal=e}getParser(){return Hy(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?p2(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:p2(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function p2(e){let t=globalThis.String(e.literal);return mt(e,[new Ot(new eo(t),new We(Ee(()=>e.literal),Ee(()=>t)))])}var VY=class extends Nt{_tag="String";getParser(){return us(this,Nn)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&fs(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Xn=new VY,GY=class extends Nt{_tag="Number";getParser(){return us(this,ep)}matchKey(e,t){return this._match(l9,e,t)}matchPart(e,t){return this._match(yT,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:fs(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(hT(this.checks,"effect/schema/isFinite")||hT(this.checks,"effect/schema/isInt"))?this:mt(this,[o9])}toCodecStringTree(){return this.toCodecJson()===this?mt(this,[p9]):mt(this,[d9])}getExpected(){return"number"}};function hT(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&hT(r.checks,t))}var kT=new GY,KY=class extends Nt{_tag="Boolean";getParser(){return us(this,Eh)}getExpected(){return"boolean"}},O2=new KY,JY=class extends Nt{_tag="Symbol";getParser(){return us(this,cb)}matchKey(e,t){return t.disableChecks||!this.checks?e:fs(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return mt(this,[rL])}getExpected(){return"symbol"}},_2=new JY,ZY=class extends Nt{_tag="BigInt";getParser(){return us(this,NO)}matchPart(e,t){if(!ST.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:fs(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return mt(this,[h9])}getExpected(){return"bigint"}},P2=new ZY,_o=class extends Nt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,i){super(n,o,s,a),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=i;let c=!1;for(let u=0;u<t.length;u++)if(Or(t[u]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<r.length;u++)if(Or(r[u]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,a=Math.max(0,r.rest.length-1);function i(f,p){return p<s?n[p]:p>=f?o[p-f+1]:o[0]}let c=f=>{let{input:p,len:d,options:m}=f;if(r.rest.length===0&&d>s)for(let x=s;x<d;x++){let y=new Hw(r,p[x],m),E=new Yt([x],y);if(m.errors==="all")f.issues?f.issues.push(E):f.issues=[E];else return k(new Xt(r,[E],p,m))}return f.issues?k(new Xt(r,f.issues,p,m)):vr(f.output)},u=(f,p)=>{let d=f.length,m={ast:r,getParser:i,input:f,len:d,tailThreshold:Math.max(s,d-a),output:new globalThis.Array(d),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(d,s+a),y=p.concurrency===void 0?1:zp(p.concurrency),E=y===1?YY(m,f,0,x):XY(m,f,{concurrency:y,end:x});if(!E)return c(m);if(je(E))return Qt(E,()=>c(m));let w=!0;return L(()=>w?(w=!1,I(E,()=>c(m))):u(f,p))};return(f,p)=>{if(f===Te)return wn;try{return Array.isArray(f)?(n||(n=r.elements.map(d=>({ast:d,parser:t(d)})),o=r.rest.map(d=>({ast:d,parser:t(d)}))),u(f,p)):k(new $t(r,f,p))}catch(d){return lr(d)}}}_rebuild(e,t,r){let n=fu(this.elements,e),o=fu(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new _o(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function QY(e,t,r,n){if(r._tag==="Failure")return $y(e,e.ast,n,r);let o=r===rt?t:r[ge];if(o!==Te)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Or(s.ast))return;let a=new Yt([n],new zi(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return Vo(new Xt(e.ast,[a],e.input,e.options))}}var F2={onItem(e,t,r){let n=r<e.len?t:Te;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:QY},YY=zg()(F2),XY=Hg()(F2),$y=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Jd(n.cause);if(o===void 0)return Vn(wi(n.cause,a=>new Xt(t,[new Yt([r],a)],e.input,e.options)));let s=new Yt([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Vo(new Xt(t,[s],e.input,e.options))},Uy="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function Hi(e,t,r=ra){let n,o;function s(a){switch(a._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter(i=>a.matchPart(i,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter(i=>a.matchKey(i,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>Object.prototype.propertyIsEnumerable.call(e,i)&&a.matchKey(i,r)!==void 0);case"Union":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(DT(cs(t)))}var AT=class{name;type;constructor(e,t){this.name=e,this.type=t}};function R2(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(R2);default:return!1}}function M2(e){let t=il(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(M2);default:return!1}}function e9(e){return R2(e)&&M2(e)}var vT=class{parameter;type;constructor(e,t){if(!e9(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Or(t)&&!Y2(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},tm=class extends Nt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=a}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return us(r,Ih);let s,a,i=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),a=o?r.indexSignatures.map(p=>({is:p,parserKey:e(DT(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(E=>typeof E.name=="number"?globalThis.String(E.name):E.name)),d=(E,w,T,M,P)=>{if(P._tag==="Failure")return $y(E,r,w,P)??Gt;let h=P===rt?M:P[ge];if(T!==Te&&h!==Te){if(n&&(p.has(w)||p.has(typeof T=="number"?globalThis.String(T):T)))return Gt;z(E.out,T,h)}return Gt},m=(E,w,T,M)=>{if(!M){let b=T.parserKey(w,E.options);if(!je(b))return I(bo(b),C=>m(E,w,T,C));M=b}if(M._tag==="Failure")return $y(E,r,w,M)??Gt;let P=M===rt?w:M[ge],h=E.input[w],S=T.parserValue(h,E.options);return je(S)?d(E,w,P,h,S):I(bo(S),b=>d(E,w,P,h,b))},x=(E,w,T)=>{let M=E.input[w],P=T.parserValue(M,E.options);return je(P)?d(E,w,w,M,P):I(bo(P),h=>d(E,w,w,M,h))},y=o?Hg()({onItem:(E,[w,T])=>T.is.parameter===Xn?x(E,w,T):m(E,w,T),step:(E,w,T)=>T._tag==="Failure"?T:void 0}):void 0;return mC(function*(E,w){if(E===Te)return Te;if(!(typeof E=="object"&&E!==null&&!Array.isArray(E)))return yield*k(new $t(r,E,w));i();let T=E,M={},P={ast:r,input:T,out:M,issues:void 0,options:w},h=w.errors==="all",S=w.onExcessProperty==="error",b=w.concurrency===void 0?1:zp(w.concurrency),C=o&&S?r.indexSignatures.map(_=>Hi(T,_.parameter,w)):void 0;if(S){let _=C?new Set(p):p;if(C)for(let H of C)for(let J of H)_.add(J);let $=Reflect.ownKeys(T);for(let H=0;H<$.length;H++){let J=$[H];if(!_.has(J)&&Object.prototype.propertyIsEnumerable.call(T,J)){let Ce=new Hw(r,T[J],w),pe=new Yt([J],Ce);if(h){P.issues?P.issues.push(pe):P.issues=[pe];continue}else return yield*k(new Xt(r,[pe],E,w))}}}if(n){let _=b===1?d2(P,s):t9(P,s,{concurrency:b});_&&(yield*_)}if(o&&b===1)for(let _=0;_<o;_++){let $=a[_],H=$.is.parameter===Xn?x:m,J=C?.[_]??($.is.parameter===Xn?Object.keys(T):Hi(T,$.is.parameter,w));for(let Ce=0;Ce<J.length;Ce++){let pe=H(P,J[Ce],$);if(!je(pe))yield*pe;else if(pe._tag==="Failure")return yield*pe}}else if(y){let _=Lt();for(let H=0;H<o;H++){let J=a[H],Ce=C?.[H]??(J.is.parameter===Xn?Object.keys(T):Hi(T,J.is.parameter,w));for(let pe=0;pe<Ce.length;pe++)_.push([Ce[pe],J])}let $=y(P,_,{concurrency:b});$&&(yield*$)}return P.issues?yield*k(new Xt(r,P.issues,E,w)):M})};if(o)return c();let u,f=(p,d,m)=>{let x=s[d];return I(bo(m),y=>{let E=gT(p,x,y);if(E)return E;let w=()=>vr(p.out),T=d2(p,s.slice(d+1));return T?Qt(T,w):w()})};return(p,d)=>{if(p===Te)return wn;if(d.errors==="all"||d.onExcessProperty!==void 0||d.concurrency!==void 0&&zp(d.concurrency)!==1)return(u??=c())(p,d);if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return k(new $t(r,p,d));let m=i(),x=p,y={},E={ast:r,input:x,out:y,issues:void 0,options:d};try{for(let w=0;w<m.length;w++){let T=m[w],M=T.name,P=el(x,M),h=P?x[M]:Te,S=T.parser(h,d);if(!je(S))return f(E,w,S);if(S===rt){P&&z(y,M,h);continue}let b=gT(E,T,S);if(b)return b}}catch(w){return lr(w)}return vr(y)}}_rebuild(e,t,r,n){let o=fu(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new AT(a.name,i)}),s=fu(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new vT(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new tm(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function gT(e,t,r){if(r._tag==="Failure")return $y(e,e.ast,t.name,r);if(r===rt)return;let n=r[ge];if(n!==Te){z(e.out,t.name,n);return}if(delete e.out[t.name],!Or(t.type)){let o=new Yt([t.name],new zi(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Vo(new Xt(e.ast,[o],e.input,e.options))}}var $2={onItem(e,t){if(!el(e.input,t.name))return t.parser(Te,e.options);let r=e.input[t.name];return z(e.out,t.name,r),t.parser(r,e.options)},step:gT},d2=zg()($2),t9=Hg()($2);function OT(e,t){return e?t?[...e,...t]:e:t}function Dy(e,t,r){return new tm(Reflect.ownKeys(e).map(n=>new AT(n,e[n].ast)),[],r,t)}function rm(e){return e.ast}function _T(e,t=void 0){return new _o(!1,e.map(r=>r.ast),[],void 0,t)}function Ly(e,t,r){return new kn(e.map(rm),t,void 0,r)}function N2(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let a of s.propertySignatures)if(r.some(i=>i.name===a.name))throw new Error(`Duplicate identifier: ${JSON.stringify(a.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=OT(o,s.checks)}return new tm(r,n,void 0,o)}function U2(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new _o(e.isMutable,e.elements,t,void 0,e.checks)}function D2(e){if(e.encoding)throw new Error("mutable does not support encodings");return new _o(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var PT=lc(e=>{for(;;){if(E2(e))return qa;let t=e.encoding;if(!t)return e.recur?.(PT,D)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==D))return qa;e=t[t.length-1].to}});function L2(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(L2)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function rl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[jd];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Or(r)){if(tl(r))return[{key:t.name,literal:r.literal}];if(dT(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Or(t)){if(tl(t))return[{key:r,literal:t.literal}];if(dT(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>rl(PT(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return rl(e.thunk())}}var m2=new WeakMap,My=Object.freeze([]),h2=e=>e===null?"null":Array.isArray(e)?"array":typeof e,el=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function nm(e){let t=m2.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let f=0;f<e.length;f++){let p=e[f],d=PT(p);if(UY(d))continue;if(tl(d)||dT(d)){s??=new Map;let x=tl(d)?d.literal:d.symbol;i[f]=x;let y=s.get(x);y||s.set(x,y=[]),y.push(f)}else a=!1;let m=rl(d);if(m.length){r??=new Map,n++;for(let{key:x,literal:y}of m){let E=r.get(x);E||r.set(x,E=[new Map,new Set]),E[1].add(f);let w=E[0].get(y);w||E[0].set(y,w=new Set),w.add(f)}}else{o??={};let x=L2(d);for(let y of x)(o[y]??=[]).push(f)}}let c={},u=f=>c[f]??=Object.freeze(o?.[f]??My);if(a&&s)s.forEach(Object.freeze),t=f=>s.get(f)??My;else if(r?.size===1&&!o){let[f,[p]]=r.entries().next().value,d=new Map;for(let[x,y]of p)d.set(x,Object.freeze(Array.from(y)));let m=Object.freeze(e.map((x,y)=>y));t=(x,y)=>{if(rp(x)){let E=el(x,f)?x[f]:void 0;if(E!==void 0)return d.get(E)??My;if(y)return m}return My}}else if(r){let f;for(let p of r)(!f||p[1][0].size>f[1][0].size)&&p[1][1].size===n&&(f=p);t=(p,d)=>{let m=h2(p);if(!rp(p))return u(m);let x=new Set(o?.[m]),y;if(f){let[E,[w]]=f,T=el(p,E),M=T?p[E]:void 0;if(T&&(!d||M!==void 0)){let P=w.get(M);if(!P)return u(m);for(let h of P)x.add(h);y=E}}if(y===void 0)for(let[E,[w,T]]of r){let M=el(p,E),P=M?p[E]:void 0;if(M&&(!d||P!==void 0)){let h=w.get(P);if(h)for(let S of h)x.add(S)}else if(d)for(let h of T)x.add(h)}for(let[E,[w,T]]of r){if(E===y)continue;let M=el(p,E),P=M?p[E]:void 0;if(M&&(!d||P!==void 0)){let h=w.get(P);for(let S of x)T.has(S)&&!h?.has(S)&&x.delete(S)}}return Array.from(x).sort((E,w)=>E-w)}}else t=f=>{let p=u(h2(f));return s?p.filter(d=>i[d]===void 0||i[d]===f):p};return m2.set(e,t),t}var kn=class extends Nt{_tag="Union";types;options;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=a}getParser(e,t){let r=this,n=t!==void 0,o=[],s=i=>o[i]??=e(r.types[i]),a;return(i,c)=>{if(i===Te)return wn;let u=(a??=nm(r.types))(i,n);if(u.length===0)return k(new Kd(r,[],i,c));if(u.length===1){let f=s(u[0])(i,c);return f._tag==="Success"?f:je(f)?B2(r,f.cause,i,c):r9(r,f,i,c)}return j2(r,s,u,i,c)}}_rebuild(e,t,r){let n=fu(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new kn(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let r=this.types.map(n=>{let o=cs(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(tl);if(s.length>0)return`${x2(o.isMutable)}[ ${s.map(a=>e(a)+y2(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(a=>tl(a.type));if(s.length>0)return`{ ${s.map(a=>`${x2(a.type.context?.isMutable)}${Ts(a.name)}${y2(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function B2(e,t,r,n){let o=Jd(t);return o?Vo(new Kd(e,[o],r,n)):Vn(t)}function r9(e,t,r,n){return Ct(t,o=>B2(e,o,r,n))}function j2(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=n9(s,r);if(!a)return s.out?s.out:k(new Kd(e,s.issues??[],n,o));if(je(a))return g2(a,s);let i=!0;return L(()=>i?(i=!1,g2(a,s)):j2(e,t,r,n,o))}function g2(e,t){return Qt(e,r=>t.out===rt?g(t.input):t.out?t.out:k(new Kd(t.ast,t.issues??[],t.input,t.options)))}var n9=zg()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Jd(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Vo(new HU(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return Gt}}}),z2=new kn([new eo("Infinity"),new eo("-Infinity"),new eo("NaN")]);function x2(e){return e?"":"readonly "}function y2(e){return e?"?":""}var FT=class extends Nt{_tag="Suspend";thunk;constructor(e,t,r,n,o){if(r)throw new Error("Cannot add checks to Suspend");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new FT(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Ny=class extends ii{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new Ny(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Ny(this.run,this.annotations,!0)}and(e,t){return new uu([this,e],t)}},uu=class extends ii{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new uu(this.checks,{...this.annotations,...e})}and(e,t){return new uu([this,e],t)}};function By(e,t,r=!1){return new Ny((n,o,s)=>WU(o,e(n,o,s),n,s),t,r)}function jy(e,t){return new Ny((r,n,o)=>e(r)?void 0:new he(void 0,r,o),t,!0)}function RT(e){return By(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}var MT=na(kT,[RT()]),o9=new Ot(new kn([MT,z2]),new We(ky(),Ee(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function om(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return By(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:"effect/schema/isPattern",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var xT=new WeakMap;function sm(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&xT.set(r,al(e)),r}function al(e){let t=xT.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return xT.set(e,r),r}function mt(e,t){return e.encoding===t?e:sm(e,{encoding:t})}function lu(e,t){if(e.context===t)return e;let r=al(e);return r.context===t&&r.encoding===e.encoding?r:sm(e,{context:t})}function il(e){return e.encoding?il(e.encoding[e.encoding.length-1].to):e}function is(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return H2(e,Yh(e.checks.slice(0,-1),r.annotate(t)))}return sm(e,{annotations:{...e.annotations,...t}})}function H2(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:sm(e,{checks:t})}function na(e,t){return H2(e,OT(e.checks,t))}function cl(e,t){let r=t(e.to);return r===e.to?e:new Ot(r,e.transformation)}function q2(e,t){let r=e,n=r[r.length-1],o=cl(n,t);return o===n?e:Yh(e.slice(0,e.length-1),o)}function $T(e){return t=>t.encoding?mt(t,q2(t.encoding,e)):t}function zy(e,t){return $T(r=>lu(r,t))(e)}function pu(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:mt(n,q2(n.encoding,r))}return e(n)}return lc(r)}function W2(e,t){return NT(e,t,zt(e))}function V2(e,t){return NT(cs(e),t,e)}function NT(e,t,r){let n=new Ot(e,t);return mt(r,r.encoding?[...r.encoding,n]:[n])}function fu(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let a=0;a<n;a++)r[a]=e[a];r[n]=s}}return r??e}function am(e,t){let r=e.context?new ta(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new ta(!1,!1,void 0,t);return lu(e,r)}var du=lc(e=>{let t=e.context?e.context.isOptional===!1?new ta(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new ta(!0,!1);return s9(lu(e,t))}),s9=$T(du),G2=No(e=>du(new kn([e,CT]))),UT=lc(e=>{let t=e.context?e.context.isMutable===!1?new ta(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new ta(!1,!0);return a9(lu(e,t))}),a9=$T(UT);function K2(e,t){let r=e.context?new ta(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new ta(!1,!1,t);return lu(e,r)}function ul(e,t,r){return NT(e,r,t)}function i9(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":bh(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function J2(e,t){let{literals:r,parameters:n}=i9(e);return new tm(r.map(o=>new AT(o,t)),n.map(o=>new vT(o,t)))}function Or(e){return e.context?.isOptional??!1}function Z2(e){return e.context?.isMutable??!1}function Q2(e){return e.annotations?.[Cn]===!0||e._tag==="FilterGroup"&&e.checks.every(Q2)}function c9(e){function t(n){return Q2(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Dr(r)?r:void 0}function u9(e){let t=!0;function r(n){return t=t&&!n.encoding&&!E2(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var zt=lc(e=>{let t=al(e);if(t!==e){let n=zt(t);return n===t&&e.encoding===void 0?e:lu(n,e.context)}let r="recur"in e?e.recur(zt):e;if("encodingChecks"in r&&r.encodingChecks){let n=u9(e)?r.encodingChecks:bT(r)||DY(r)||ol(r)&&r.typeParameters.length>0?c9(r.encodingChecks):void 0;return sm(r,{encodingChecks:void 0,checks:OT(r.checks,n)})}return r}),cs=lc(e=>zt(to(e)));function f9(e,t){let r=t,n=r.length,o=r[n-1],s=[new Ot(to(mt(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new Ot(to(r[i-1].to),r[i].transformation.flip()));let a=to(o.to);return a.encoding?mt(a,[...a.encoding,...s]):mt(a,s)}var to=No(e=>{if(e.encoding)return f9(e,e.encoding);let t=al(e);if(t!==e){let r=to(t);return r===t?e:lu(r,e.context)}return"flip"in e?e.flip(to):"recur"in e?e.recur(to):e});function Y2(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Y2);default:return!1}}function Hy(e,t){let r=t===0?rt:vr(t);return(n,o)=>n===Te?wn:n===t?r:k(new $t(e,n,o))}function us(e,t){return(r,n)=>r===Te?wn:t(r)?rt:k(new $t(e,r,n))}function X2(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(u,f){if(u===n.length)return f===s;if(i?.has(u*(s+1)+f))return!1;let p=n[u];if(u===n.length-1){let d=t.slice(f);if(p.matchPart(d,r)!==void 0)return a[u]=d,!0}else if(p._tag==="Literal"){let d=o[u];if(t.startsWith(d,f)&&c(u+1,f+d.length))return a[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],x=m===void 0?d:t.lastIndexOf(m,d);for(;x>=f;){let y=t.slice(f,x);if(p.matchPart(y,r)!==void 0&&c(u+1,x))return a[u]=y,!0;if(x===0)break;x=m===void 0?x-1:t.lastIndexOf(m,x-1)}}return i??=new Set,i.add(u*(s+1)+f),!1}return c(0,0)?a:void 0}var DT=pu(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(DT)}}),qy=pu(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(qy)}}),LT=pu(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(LT)}}),eL="[\\s\\S]*?",yT=new globalThis.RegExp(`^${Uy}$`),l9=new globalThis.RegExp(`^(?:${Uy}|Infinity|-Infinity|NaN)$`);function BT(e){return om(yT,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:yT.source}),...e})}var tL=na(Xn,[BT()]),p9=new Ot(tL,Xf),d9=new Ot(new kn([tL,z2]),Xf),m9="-?\\d+",ST=new globalThis.RegExp(`^${m9}$`);function jT(e){return om(ST,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:ST.source}),...e})}var zT=na(Xn,[jT({expected:"a string representing a bigint"})]),h9=new Ot(zT,Fy),g9="Symbol\\(([\\s\\S]*)\\)",ET=new globalThis.RegExp(`^${g9}$`),x9=na(Xn,[HT()]),rL=new Ot(x9,new We(Ee(e=>globalThis.Symbol.for(ET.exec(e)[1])),Wr((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?g(globalThis.String(e)):k(new Gd({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function HT(e){return om(ET,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:ET.source}),...e})}function fs(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=fs(a.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let i=a.run(t,n,o);if(i){let c=new jU(a,i,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||a.aborted)return r}}}return r}function nL(e,t){let r=fs(e,t,void 0,qa,{errors:"all"});if(r){let n=new Xt(qa,r);return X(n)}return G(t)}function oL(e){if(!ol(e))return;let t=e.annotations?.[by];return Un(t)?t(e.typeParameters):void 0}function y9(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function S9(e){return e===void 0||typeof e=="string"}function sL(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}r.set(o,!1),n.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function fl(e){return sL(e,y9)}var nl=new sl([],()=>(e,t,r)=>fl(e)?rt:k(new $t(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>WT}),aL=is(nl,{representation:{id:"effect/schema/MutableJson",payload:null}}),qT=new Ot(nl,Yf()),iL=new Ot(new kn([new _o(!1,[],[nl]),new tm([],[new vT(Xn,nl)])]),Yf());function E9(e){return sL(e,S9)}var b9=new sl([],()=>(e,t,r)=>E9(e)?rt:k(new $t(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),WT=new Ot(b9,Yf());function VT(){return Object.assign(e=>e,{option:e=>v(e),result:e=>G(e),is:e=>!0})}var GT=VT(),KT=VT(),uL="~effect/process/ChildProcessSpawner/ChildProcessHandle",I9={[uL]:uL,...Pt,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},Wy=e=>Object.setPrototypeOf({...e},I9),JT=e=>{let t=(n,o)=>e(n).pipe(F(s=>Ow(o?.includeStderr===!0?s.all:s.stdout)),en),r=(n,o)=>_w(t(n,o));return Wi.of({spawn:e,exitCode:n=>qs(I(e(n),o=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>gy(r(n,o)),string:(n,o)=>Rw(t(n,o))})},Wi=class extends gt()("effect/process/ChildProcessSpawner"){};var ZT="~effect/process/ChildProcess",mL={...Os({label:"Command",evaluate(e){return fo(e.context,Wi).spawn(this)}}),[ZT]:ZT},Vy=e=>O(e,ZT),C9=e=>e._tag==="StandardCommand",w9=e=>e._tag==="PipedCommand",mu=(e,t,r)=>Object.assign(Object.create(mL),{_tag:"StandardCommand",command:e,args:t,options:r}),Gy=(e,t,r={})=>Object.assign(Object.create(mL),{_tag:"PipedCommand",left:e,right:t,options:r}),im=function(...t){if(ek(t[0])){let[s,...a]=t,i=tk(s,a);return mu(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!ek(t[0])){let s=t[0];return function(a,...i){let c=tk(a,i);return mu(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return mu(s,[],a)}let[r,n=[],o={}]=t;return mu(r,n,o)},T9=l(e=>Vy(e[0])&&Vy(e[1]),(e,t,r)=>Gy(e,t,r??{})),k9=function(...t){if(Vy(t[0])&&t.length>1){let[n,...o]=t,s=fL(o);return QT(n,s)}let r=fL(t);return n=>QT(n,r)},fL=e=>{if(ek(e[0])){let[n,...o]=e,s=tk(n,o);return{command:s[0]??"",args:s.slice(1)}}let[t,r=[]]=e;return{command:t,args:r}},QT=(e,t)=>{switch(e._tag){case"StandardCommand":return mu(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return Gy(QT(e.left,t),e.right,e.options)}},YT=l(2,(e,t)=>{switch(e._tag){case"StandardCommand":return mu(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return Gy(YT(e.left,t),YT(e.right,t),e.options)}}),XT=l(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let r=e.options.env===void 0?t:{...e.options.env,...t};return mu(e.command,e.args,{...e.options,env:r})}case"PipedCommand":return Gy(XT(e.left,t),XT(e.right,t),e.options)}}),ek=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),cm=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},rk=e=>`fd${e}`,tk=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=A9(e,t,r,o,n);return r},A9=(e,t,r,n,o)=>{let s=e.raw[o];if(s===void 0)throw new Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:a,hasTrailingWhitespace:i,tokens:c}=O9(n,s),u=dL(r,c,a);if(o===t.length)return u;let f=t[o],p=Array.isArray(f)?f.map(d=>lL(d)):[lL(f)];return dL(u,p,i)},lL=e=>typeof e==="string"?e:String(e),pL=new Set([" "," ","\r",`
|
|
31
|
+
`]),v9={x:3,u:5},O9=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let r=pL.has(t[0]),n=[],o=0;for(let a=0,i=0;a<e.length;a+=1,i+=1){let c=t[i];if(pL.has(c))o!==a&&n.push(e.slice(o,a)),o=a+1;else if(c==="\\"){let u=t[i+1];if(u===`
|
|
32
|
+
`)a-=1,i+=1;else if(u==="u"&&t[i+2]==="{"){let f=t.indexOf("}",i+3);parseInt(t.slice(i+3,f),16)>65535&&(a+=1),i=f}else i+=v9[u]??1}}let s=o===e.length;return s||n.push(e.slice(o)),{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},dL=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];import*as Ky from"node:child_process";import{PassThrough as nk}from"node:stream";var hL=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var Qe=(e,t)=>(r,[n])=>{let o="Unknown";switch(r.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return Zn({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var ll=e=>hw(rw(_9(e),t=>[t])),_9=e=>Oe(t=>{let r=e.evaluate();return g(P9({...e,writable:r,pull:t}))}),P9=e=>e.pull.pipe(I(t=>{let r=0;return fr(n=>{let o=!1,s=()=>{for(;r<t.length;){if(o)return;if(!e.writable.write(t[r++],e.encoding)){o||e.writable.once("drain",s);return}}o||n(W)};return s(),U(()=>{o=!0,e.writable.off("drain",s)})})}),vt({disableYield:!0}),e.endOnDone!==!1?ze(t=>"closed"in e.writable&&e.writable.closed?ee(t):fr(r=>{let n=()=>r(ee(t));return e.writable.once("finish",n),e.writable.end(),U(()=>{e.writable.off("finish",n)})})):D,Hs(fr(t=>{let r=n=>t(k(e.onError(n)));return e.writable.once("error",r),U(()=>{e.writable.off("error",r)})})));var pl=e=>R(R9(e)),R9=e=>Oe((t,r)=>M9({scope:r,readable:e.evaluate(),onError:e.onError??$9,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var M9=e=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??Di(void 0),o=e.latch??zr(!1);function s(){o.openUnsafe()}function a(u){n.current=Vo(e.onError(u)),o.openUnsafe()}function i(){n.current=Vo(Vp()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=L(function u(){let f=e.readable.read(e.chunkSize);if(f===null)return n.current?n.current:t.readableEnded?k(Vp()):(o.closeUnsafe(),I(o.await,u));let p=Ae(f);for(;f=e.readable.read(e.chunkSize),f!==null;)p.push(f);return g(p)});return at(cr(e.scope,U(()=>{t.off("readable",s),t.off("error",a),t.off("end",i),r&&"closed"in e.readable&&!e.readable.closed&&e.readable.destroy()})),c)};var $9=e=>new xM(e);var hu=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),oa=(e,t,r)=>{let{commands:n}=bL(r),o=n.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Qe("ChildProcess",e)(t,[o])},gL=1e3,U9=10,xL=e=>{let t=()=>{};e.on("error",t),e.once("close",()=>e.off("error",t))},yL=(e,t)=>{if(!I0(t))return!0;if(globalThis.process.platform==="win32")return!1;try{return globalThis.process.kill(-e.pid,0),!0}catch{return!1}},SL=(e,t=()=>{})=>{if(e.exitCode!==null||e.signalCode!==null){t(null);return}Ky.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t)},D9=tt(function*(){let e=yield*os,t=yield*Ys,r=N(function*(h){if(!ci(h.cwd))return yield*e.access(h.cwd),t.resolve(h.cwd)}),n=h=>h.extendEnv?{...globalThis.process.env,...h.env}:h.env,o=h=>ve(h)?"pipe":h,s=h=>vd(h)?"pipe":h,a=h=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};return ci(h.stdin)?S:typeof h.stdin=="string"?{...S,stream:h.stdin}:ve(h.stdin)?{...S,stream:h.stdin}:{stream:h.stdin.stream,encoding:h.stdin.encoding??S.encoding,endOnDone:h.stdin.endOnDone??S.endOnDone}},i=(h,S)=>{let b=h[S];return ci(b)?{stream:"pipe"}:typeof b=="string"?{stream:b}:vd(b)?{stream:b}:{stream:b.stream}},c=h=>{if(ci(h.additionalFds))return[];let S=[];for(let[b,C]of Object.entries(h.additionalFds)){let _=cm(b);Tt(_)&&S.push({fd:_,config:C})}return S.sort((b,C)=>b.fd-C.fd)},u=(h,S,b,C)=>{let _=[o(h.stream),s(S.stream),s(b.stream)];if(C.length===0)return _;let $=C.reduce((H,{fd:J})=>Math.max(H,J),2);for(let H=3;H<=$;H++)_[H]="ignore";for(let{fd:H}of C)_[H]="pipe";return _},f=N(function*(h,S,b){if(b.length===0)return{getInputFd:()=>_d,getOutputFd:()=>gn};let C=new Map,_=new Map;for(let{config:$,fd:H}of b){let J=S.stdio[H];switch($.type){case"input":{let Ce=_d;J&&"write"in J&&(xL(J),Ce=ll({evaluate:()=>J,onError:pe=>oa(`fromWritable(fd${H})`,hu(pe),h)})),$.stream&&(yield*Ma(hy($.stream,Ce))),C.set(H,Ce);break}case"output":{let Ce=gn;if(J&&"read"in J){let pe=new nk;J.on("error",_e=>pe.destroy(_e)),J.pipe(pe),Ce=pl({evaluate:()=>pe,onError:_e=>oa(`fromReadable(fd${H})`,hu(_e),h)})}$.sink&&(Ce=Bd(Ce,$.sink)),_.set(H,Ce);break}}}return{getInputFd:$=>C.get($)??_d,getOutputFd:$=>_.get($)??gn}}),p=(h,S,b)=>L(()=>{let C=_d;return tp(S.stdin)&&(xL(S.stdin),C=ll({evaluate:()=>S.stdin,onError:_=>oa("fromWritable(stdin)",hu(_),h),endOnDone:b.endOnDone,encoding:b.encoding})),ve(b.stream)?at(Ma(hy(b.stream,C)),C):g(C)}),d=(h,S,b,C)=>{let _=S.stdout?(()=>{let J=new nk;return S.stdout.on("error",Ce=>J.destroy(Ce)),S.stdout.pipe(J),pl({evaluate:()=>J,onError:Ce=>oa("fromReadable(stdout)",hu(Ce),h)})})():gn,$=S.stderr?(()=>{let J=new nk;return S.stderr.on("error",Ce=>J.destroy(Ce)),S.stderr.pipe(J),pl({evaluate:()=>J,onError:Ce=>oa("fromReadable(stderr)",hu(Ce),h)})})():gn;vd(b.stream)&&(_=Bd(_,b.stream)),vd(C.stream)&&($=Bd($,C.stream));let H=Dd(_,$);return{stdout:_,stderr:$,all:H}},m=(h,S)=>fr(b=>{let C=Aa(),_=Ky.spawn(h.command,h.args,S);return _.on("error",$=>{b(k(oa("spawn",$,h)))}),_.on("exit",(...$)=>{xo(C,Zr($))}),_.on("spawn",()=>{b(g([_,C]))}),U(()=>{_.kill("SIGTERM")})}),x=(h,S,b)=>globalThis.process.platform==="win32"?fr(C=>{SL(S,_=>{C(_?k(oa("kill",hu(_),h)):W)})}):Rt({try:()=>{globalThis.process.kill(-S.pid,b)},catch:C=>oa("kill",hu(C),h)}),y=(h,S)=>{if(globalThis.process.platform==="win32"){SL(h);return}try{globalThis.process.kill(-h.pid,S)}catch{}},E=(h,S,b)=>L(()=>{if(!S.kill(b)){let _=new globalThis.Error("Failed to kill child process");return k(oa("kill",_,h))}return W}),w=(h,S,b)=>fr(C=>{let _=Date.now()+b,$,H=()=>{clearTimeout($),h.removeListener("exit",J)},J=()=>{if(clearTimeout($),Date.now()>=_||!yL(h,S)){H(),C(W);return}$=setTimeout(J,U9)};return h.on("exit",J),J(),U(H)}),T=N(function*(h,S,b,C){let _=$=>x(h,S,$).pipe(Jo(()=>E(h,S,$)));yield*_(C?.killSignal??"SIGTERM"),ci(C?.forceKillAfter)?yield*w(S,b,gL):(yield*w(S,b,Lr(C.forceKillAfter)),yL(S,b)&&(yield*_("SIGKILL"),yield*w(S,b,gL))),yield*Ti(b)}),M=(h,S)=>{let b=S??"stdout";switch(b){case"stdout":return h.stdout;case"stderr":return h.stderr;case"all":return h.all;default:{let C=cm(b);return Tt(C)?h.getOutputFd(C):h.stdout}}},P=N(function*(h){switch(h._tag){case"StandardCommand":{let S=a(h.options),b=i(h.options,"stdout"),C=i(h.options,"stderr"),_=c(h.options),$=!0,H=yield*r(h.options),J=n(h.options),Ce=u(S,b,C,_),[pe,_e]=yield*Qr(m(h,hL(h.options,{cwd:H,env:J,stdio:Ce},process.platform)),N(function*([Mn,uc]){if(yield*b0(uc)){let[FO]=yield*Ti(uc);FO!==0&&tp(FO)?yield*Ff(T(h,Mn,uc,h.options)):$&&process.platform!=="win32"&&h.options.detached!==!1&&(yield*Ff(T(h,Mn,uc,h.options)));return}$&&(yield*Ff(T(h,Mn,uc,h.options)))})),Je=KT(pe.pid);pe.on("exit",Mn=>{Mn!==0&&tp(Mn)&&y(pe,h.options.killSignal??"SIGTERM")});let _t=U(()=>{$||(pe.ref(),$=!0)}),Dt=U(()=>($&&(pe.unref(),$=!1),_t)),xn=yield*p(h,pe,S),{all:so,stderr:la,stdout:Zl}=d(h,pe,b,C),{getInputFd:JV,getOutputFd:ZV}=yield*f(h,pe,_),QV=F(b0(_e),Mn=>!Mn),YV=I(Ti(_e),([Mn,uc])=>{if(tp(Mn))return g(GT(Mn));let PO=new globalThis.Error(`Process interrupted due to receipt of signal: '${uc}'`);return k(oa("exitCode",PO,h))});return Wy({pid:Je,exitCode:YV,isRunning:QV,kill:Mn=>T(h,pe,_e,Mn),stdin:xn,stdout:Zl,stderr:la,all:so,getInputFd:JV,getOutputFd:ZV,unref:Dt})}case"PipedCommand":{let{commands:S,pipeOptions:b}=bL(h),[C,..._]=S,$=[yield*P(C)];for(let pe=0;pe<_.length;pe++){let _e=_[pe],Je=b[pe]??{},_t=a(_e.options),Dt=en(g(M($[$.length-1],Je.from))),xn=Je.to??"stdin";if(xn==="stdin")$.push(yield*P(im(_e.command,_e.args,{..._e.options,stdin:{..._t,stream:Dt}})));else{let so=cm(xn);if(Tt(so)){let la=rk(so),Zl=_e.options.additionalFds??{};$.push(yield*P(im(_e.command,_e.args,{..._e.options,additionalFds:{...Zl,[la]:{type:"input",stream:Dt}}})))}else $.push(yield*P(im(_e.command,_e.args,{..._e.options,stdin:{..._t,stream:Dt}})))}}let H=$[$.length-1],J=pe=>Eo([...$].reverse(),_e=>Ff(_e.kill(pe)),{discard:!0}),Ce=tt(function*(){let pe=[];for(let _e of $)pe.push(yield*_e.unref);return Eo([...pe].reverse(),_e=>_e,{discard:!0})});return Wy({pid:H.pid,exitCode:H.exitCode,isRunning:H.isRunning,kill:J,stdin:$[0].stdin,stdout:H.stdout,stderr:H.stderr,all:H.all,getInputFd:H.getInputFd,getOutputFd:H.getOutputFd,unref:Ce})}}});return JT(P)}),EL=Tf(Wi,D9),bL=e=>{let t=[],r=[],n=i=>{switch(i._tag){case"StandardCommand":{t.push(i);break}case"PipedCommand":{n(i.left),r.push(i.options),n(i.right);break}}};if(n(e),t.length===0)throw new Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:r}};var IL="0123456789ABCDEFGHJKMNPQRSTVWXYZ",CL=(e,t)=>{if(t.length!==10)throw new Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let r=Math.min(Math.max(0,Math.trunc(e)),0xffffffffffff),n="";for(let a=45;a>=0;a-=5)n+=IL[Math.floor(r/2**a)&31];let o=0,s=0;for(let a of t){for(o=o<<8|a,s+=8;s>=5;)s-=5,n+=IL[o>>>s&31];o&=(1<<s)-1}return n};var B9=e=>e.toString(16).padStart(2,"0"),ok=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(r=>Array.from(r,B9).join("")).join("-"),wL=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function TL(e=wL()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var j9=2**48-1;function kL(e,t=wL()){let r=Math.min(Math.max(0,Math.trunc(e)),j9);return t[0]=Math.floor(r/2**40),t[1]=Math.floor(r/2**32)&255,t[2]=Math.floor(r/2**24)&255,t[3]=Math.floor(r/2**16)&255,t[4]=Math.floor(r/2**8)&255,t[5]=r&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var AL="~effect/Crypto",sk=gt("effect/Crypto"),vL=e=>{let t=e.randomBytes,r=a=>F(H9("randomBytes",a),t),n=a=>(a[0]&31)*2**48+a[1]*2**40+a[2]*2**32+a[3]*2**24+a[4]*2**16+a[5]*2**8+a[6],o=()=>n(t(7))/2**53,s=()=>{for(;;){let a=t(7),i=n(a);if((a[0]&32)===0)return i+Number.MIN_SAFE_INTEGER;if(i<Number.MAX_SAFE_INTEGER)return i+1}};return sk.of({[AL]:AL,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:U(()=>o()),randomBoolean:U(()=>o()>.5),randomInt:U(()=>s()),randomBetween:(a,i)=>U(()=>s$(a,i,o())),randomIntBetween(a,i,c){let u=c?.halfOpen===!0?0:1;return U(()=>{let f=Math.ceil(a),p=Math.floor(i);return Math.floor(o()*(p-f+u))+f})},randomShuffle:a=>U(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let u=Math.min(c,Math.floor(o()*(c+1))),f=i[c];i[c]=i[u],i[u]=f}return i}),randomUUIDv4:a=>U(()=>{let i=TL(t(16));return a?.format==="bytes"?i:ok(i)}),randomUUIDv7:a=>Gs(i=>{let c=kL(i.currentTimeMillisUnsafe(),t(16));return g(a?.format==="bytes"?c:ok(c))}),randomULID:Gs(a=>g(CL(a.currentTimeMillisUnsafe(),t(10))))})},H9=(e,t)=>Number.isSafeInteger(t)&&t>=0?g(t):k(Co({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as Jy from"node:crypto";var q9=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},W9=(e,t)=>Rt({try:()=>Uint8Array.from(Jy.createHash(q9(e)).update(t).digest()),catch:r=>Zn({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),V9=vL({randomBytes:Jy.randomBytes,digest:W9}),_L=Bs(sk,V9);var PL=_L;import*as $L from"node:crypto";import*as re from"node:fs";import*as NL from"node:os";import*as Va from"node:path";var nt=e=>t=>Co({module:"FileSystem",method:e,description:t.message??String(t)}),UL=(e,t)=>{let r=Number(e);if(!Number.isSafeInteger(r))throw new RangeError(`${t} exceeds the safe integer range: ${e}`);return r},FL=e=>Ps(uo(e),kx),DL=e=>BigInt.asUintN(64,e),ak=e=>rr(uo(e),DL),RL=(e,t)=>Rt({try:()=>UL(e,"position"),catch:nt(t)}),J9=(()=>{let e=St(re.access,Qe("FileSystem","access"),nt("access"));return(t,r)=>{let n=re.constants.F_OK;return r?.readable&&(n|=re.constants.R_OK),r?.writable&&(n|=re.constants.W_OK),e(t,n)}})(),Z9=(()=>{let e=St(re.cp,Qe("FileSystem","copy"),nt("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),Q9=(()=>{let e=St(re.copyFile,Qe("FileSystem","copyFile"),nt("copyFile"));return(t,r)=>e(t,r)})(),Y9=(()=>{let e=St(re.chmod,Qe("FileSystem","chmod"),nt("chmod"));return(t,r)=>e(t,r)})(),X9=(()=>{let e=St(re.chown,Qe("FileSystem","chown"),nt("chown"));return(t,r,n)=>e(t,r,n)})(),e7=(()=>{let e=St(re.glob,Qe("FileSystem","glob"),nt("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),t7=(()=>{let e=St(re.link,Qe("FileSystem","link"),nt("link"));return(t,r)=>e(t,r)})(),r7=(()=>{let e=St(re.mkdir,Qe("FileSystem","makeDirectory"),nt("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),ik=e=>{let t=St(re.mkdtemp,Qe("FileSystem",e),nt(e));return r=>L(()=>{let n=r?.prefix??"",o=typeof r?.directory=="string"?Va.join(r.directory,"."):NL.tmpdir();return t(n?Va.join(o,n):o+"/")})},n7=ik("makeTempDirectory"),ck=e=>{let t=St(re.rm,Qe("FileSystem",e),nt(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},o7=ck("remove"),s7=(()=>{let e=ik("makeTempDirectoryScoped"),t=ck("makeTempDirectoryScoped");return r=>Qr(e(r),n=>Pa(t(n,{recursive:!0})))})(),a7=e=>{let{O_APPEND:t,O_CREAT:r,O_EXCL:n,O_RDONLY:o,O_RDWR:s,O_TRUNC:a,O_WRONLY:i}=re.constants;switch(e){case"r":return o;case"r+":return s;case"w":return a|r|i;case"wx":return a|r|i|n;case"w+":return a|r|s;case"wx+":return a|r|s|n;case"a":return t|r|i;case"ax":return t|r|i|n;case"a+":return t|r|s;case"ax+":return t|r|s|n}},i7=(e,t)=>L(()=>{let{O_NOFOLLOW:r}=re.constants;return process.platform==="win32"||typeof r!="number"||r===0?k(Co({module:"FileSystem",method:e,description:"noFollow is not supported on this platform"})):g(a7(t)|r)}),c7=e=>{let t=St(re.open,Qe("FileSystem",e),nt(e)),r=St(re.close,Qe("FileSystem",e),nt(e));return(n,o)=>Is(Qr(o?.noFollow===!0?I(i7(e,o.flag??"r"),s=>t(n,s,o.mode)):t(n,o?.flag??"r",o?.mode),s=>Pa(r(s))),F(s=>f7(s,o?.flag?.startsWith("a")??!1)))},u7=c7("open"),ML=e=>Co({module:"FileSystem",method:e,description:"Cannot read before the start of the file"}),f7=(()=>{let e=f=>St(re.read,Qe("FileSystem",f),nt(f)),t=e("read"),r=e("readAlloc"),n=St(re.fstat,Qe("FileSystem","stat"),nt("stat")),o=St(re.ftruncate,Qe("FileSystem","truncate"),nt("truncate")),s=St(re.fsync,Qe("FileSystem","sync"),nt("sync")),a=f=>St(re.write,Qe("FileSystem",f),nt(f)),i=a("write"),c=a("writeAll");class u{[Vf];fd;append;position=BigInt(0);constructor(p,d){this[Vf]=Vf,this.fd=p,this.append=d}get stat(){return I(n(this.fd,{bigint:!0}),BL)}get sync(){return s(this.fd)}seek(p,d){return L(()=>{let m=d==="start"?p:this.position+p;return m<BigInt(0)?k(Co({module:"FileSystem",method:"seek",description:"Cannot seek before the start of the file"})):(this.position=m,g(m))})}read(p,d){return L(()=>{let m=d?.position;if(m!==void 0)return m<BigInt(0)?k(ML("read")):t(this.fd,{buffer:p,position:m});let x=this.position;return F(t(this.fd,{buffer:p,position:x}),y=>(this.position=x+BigInt(y),y))})}readAlloc(p,d){return L(()=>{try{if(!Number.isInteger(p)||p<0)throw new RangeError("size must be a non-negative integer");let m=d?.position;if(m!==void 0&&m<BigInt(0))return k(ML("readAlloc"));let x=Buffer.allocUnsafeSlow(p),y=m??this.position;return F(r(this.fd,{buffer:x,position:y}),E=>{if(E===0)return A();if(m===void 0&&(this.position=y+BigInt(E)),E===p)return v(x);let w=Buffer.allocUnsafeSlow(E);return x.copy(w,0,0,E),v(w)})}catch(m){return k(nt("readAlloc")(m))}})}truncate(p){return F(o(this.fd,p||void 0),()=>{if(!this.append){let d=BigInt(p??0);this.position>d&&(this.position=d)}})}write(p){return L(()=>{let d=this.position;return I(this.append?g(void 0):RL(d,"write"),m=>F(i(this.fd,p,void 0,void 0,m),x=>(this.append||(this.position=d+BigInt(x)),x)))})}writeAllChunk(p){return L(()=>{let d=this.position;return I(this.append?g(void 0):RL(d,"writeAll"),m=>I(c(this.fd,p,void 0,void 0,m),x=>x===0?k(Zn({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=d+BigInt(x)),x<p.length?this.writeAllChunk(p.subarray(x)):W)))})}writeAll(p){return p.length===0?W:this.writeAllChunk(p)}}return(f,p)=>new u(f,p)})(),LL=e=>{let t=ik(e);return N(function*(r){let n=yield*t(r),o=$L.randomBytes(6).toString("hex"),s=Va.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*jL(s,new Uint8Array(0)),s})},l7=LL("makeTempFile"),p7=(()=>{let e=LL("makeTempFileScoped"),t=ck("makeTempFileScoped");return r=>Qr(e(r),n=>Pa(t(Va.dirname(n),{recursive:!0})))})(),d7=(e,t)=>Oi({try:()=>re.promises.readdir(e,t),catch:r=>Qe("FileSystem","readDirectory")(r,[e])}),m7=e=>fr((t,r)=>{try{re.readFile(e,{signal:r},(n,o)=>{t(n?k(Qe("FileSystem","readFile")(n,[e])):g(o))})}catch(n){t(k(nt("readFile")(n)))}}),h7=(()=>{let e=St(re.readlink,Qe("FileSystem","readLink"),nt("readLink"));return t=>e(t)})(),g7=(()=>{let e=St(re.realpath,Qe("FileSystem","realPath"),nt("realPath"));return t=>e(t)})(),x7=(()=>{let e=St(re.rename,Qe("FileSystem","rename"),nt("rename"));return(t,r)=>e(t,r)})(),BL=e=>Rt({try:()=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:uo(e.mtime),atime:uo(e.atime),birthtime:uo(e.birthtime),dev:DL(e.dev),rdev:ak(e.rdev),ino:ak(e.ino),mode:UL(e.mode,"mode"),nlink:ak(e.nlink),uid:FL(e.uid),gid:FL(e.gid),size:xd(e.size),blksize:e.blksize!==void 0?v(xd(e.blksize)):A(),blocks:uo(e.blocks)}),catch:nt("stat")}),uk=(()=>{let e=St(re.stat,Qe("FileSystem","stat"),nt("stat"));return t=>I(e(t,{bigint:!0}),BL)})(),y7=(()=>{let e=St(re.symlink,Qe("FileSystem","symlink"),nt("symlink"));return(t,r)=>e(t,r)})(),S7=(()=>{let e=St(re.truncate,Qe("FileSystem","truncate"),nt("truncate"));return(t,r)=>e(t,r)})(),E7=(()=>{let e=St(re.utimes,Qe("FileSystem","utime"),nt("utime"));return(t,r,n)=>e(t,r,n)})(),b7=(e,t,r)=>py(n=>Qr(U(()=>{let o=t.type==="Directory"?e:Va.dirname(e),s=re.watch(e,{recursive:r?.recursive??!1},(a,i)=>{if(i)switch(a){case"rename":{Yo(sC(uk(Va.resolve(o,i)),{onSuccess:c=>Yr(n,{_tag:"Create",path:i}),onFailure:c=>Yr(n,{_tag:"Remove",path:i})}));return}case"change":{Da(n,{_tag:"Update",path:i});return}}});return s.on("error",a=>{Js(n,lM(Zn({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:a})))}),s.on("close",()=>{wo(n)}),s}),o=>U(()=>o.close())).pipe(jr(()=>U(()=>r?.onReady?.())))),I7=(e,t,r)=>mx([uk(t),Rf(Wf)]).pipe(F(([n,o])=>Ob(o,()=>e).pipe(Ps(s=>s.register(t,n,r)),Ft(()=>b7(t,n,r)))),en),jL=(e,t,r)=>fr((n,o)=>{try{re.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},s=>{n(s?k(Qe("FileSystem","writeFile")(s,[e])):W)})}catch(s){n(k(nt("writeFile")(s)))}}),C7=F(Rf(Wf),e=>Nw({access:J9,chmod:Y9,chown:X9,copy:Z9,copyFile:Q9,glob:e7,link:t7,makeDirectory:r7,makeTempDirectory:n7,makeTempDirectoryScoped:s7,makeTempFile:l7,makeTempFileScoped:p7,open:u7,readDirectory:d7,readFile:m7,readLink:h7,realPath:g7,remove:o7,rename:x7,stat:uk,symlink:y7,truncate:S7,utimes:E7,watch(t,r){return I7(e,t,r)},writeFile:jL})),zL=Tf(os)(C7);var HL=zL;import*as um from"node:path";import*as Zy from"node:url";var fk=e=>({fromFileUrl:t=>Rt({try:()=>Zy.fileURLToPath(t,{windows:e}),catch:r=>new Uf({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:t=>Rt({try:()=>Zy.pathToFileURL(t,{windows:e}),catch:r=>new Uf({module:"Path",method:"toFileUrl",cause:r})})}),k7=Bs(Ys)(Sy({...um.posix,...fk(!1)})),A7=Bs(Ys)(Sy({...um.win32,...fk(!0)})),qL=Bs(Ys)(Sy({...um,...fk(void 0)}));var WL=qL;var lk="~effect/Stdio",Qy=gt(lk),VL=e=>({[lk]:lk,stdinIsTerminal:g(!1),stdoutIsTerminal:g(!1),stderrIsTerminal:g(!1),...e});var GL=Bs(Qy,VL({args:U(()=>process.argv.slice(2)),stdinIsTerminal:U(()=>process.stdin.isTTY===!0),stdoutIsTerminal:U(()=>process.stdout.isTTY===!0),stderrIsTerminal:U(()=>process.stderr.isTTY===!0),stdout:e=>ll({evaluate:()=>process.stdout,onError:t=>Zn({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>ll({evaluate:()=>process.stderr,onError:t=>Zn({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:pl({evaluate:()=>process.stdin,onError:e=>Zn({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var KL=GL;var Ie={};$n(Ie,{Any:()=>fre,Array:()=>Pe,ArrayEnsure:()=>bre,BigDecimal:()=>OH,BigDecimalFromString:()=>Xne,BigInt:()=>Pl,BigIntFromString:()=>Dne,Boolean:()=>qS,BooleanFromBit:()=>Wne,BooleanLiterals:()=>ev,ByteSize:()=>XS,ByteSizeFromBigInt:()=>toe,ByteSizeFromNumber:()=>roe,ByteSizeFromString:()=>eoe,Cause:()=>KA,CauseReason:()=>GA,Char:()=>wne,Chunk:()=>noe,Class:()=>Cq,Cookie:()=>Sq,Cookies:()=>Eq,Date:()=>Ml,DateFromMillis:()=>Pne,DateFromString:()=>_ne,DateTimeUtc:()=>eE,DateTimeUtcFromDate:()=>uoe,DateTimeUtcFromMillis:()=>loe,DateTimeUtcFromString:()=>foe,DateTimeZoned:()=>VH,DateTimeZonedFromString:()=>hoe,Defect:()=>cv,DnsARecord:()=>iq,DnsAaaaRecord:()=>cq,DnsCaaRecord:()=>uq,DnsCnameRecord:()=>fq,DnsMxRecord:()=>lq,DnsNaptrRecord:()=>pq,DnsNsRecord:()=>dq,DnsPtrRecord:()=>mq,DnsRecord:()=>lse,DnsRecordType:()=>fse,DnsSoaRecord:()=>hq,DnsSrvRecord:()=>gq,DnsTlsaRecord:()=>xq,DnsTxtRecord:()=>yq,DomainName:()=>ri,DomainNameFromString:()=>rq,Duration:()=>Gm,DurationFromMillis:()=>use,DurationFromNanos:()=>cse,DurationFromString:()=>ise,Enum:()=>cre,Error:()=>rE,ErrorInstance:()=>Tne,Exit:()=>pse,FalseLiterals:()=>ZS,File:()=>bH,Finite:()=>Rl,FiniteFromString:()=>Une,FormData:()=>IH,Graph:()=>gse,HashMap:()=>xse,HashSet:()=>yse,Headers:()=>Cse,Host:()=>Xoe,HostFromString:()=>ese,HostPort:()=>oq,HostPortFromString:()=>tse,InetAddress:()=>eq,InetAddressFromString:()=>Zoe,InetAddressV4:()=>Koe,InetAddressV6:()=>Joe,Int:()=>On,IpAddress:()=>rc,IpAddressFromString:()=>Fu,IpInterface:()=>ZH,IpInterfaceFromString:()=>qoe,IpLinkLocalAddress:()=>_oe,IpLinkLocalAddressFromString:()=>Poe,IpLoopbackAddress:()=>voe,IpLoopbackAddressFromString:()=>Ooe,IpMulticastAddress:()=>goe,IpMulticastAddressFromString:()=>xoe,IpNetwork:()=>XH,IpNetworkFromString:()=>Goe,IpUnicastAddress:()=>Eoe,IpUnicastAddressFromString:()=>boe,IpUnspecifiedAddress:()=>Foe,IpUnspecifiedAddressFromString:()=>Roe,Ipv4Address:()=>Vm,Ipv4AddressFromString:()=>lv,Ipv4BroadcastAddress:()=>woe,Ipv4BroadcastAddressFromString:()=>Toe,Ipv4Interface:()=>KH,Ipv4InterfaceFromString:()=>zoe,Ipv4Network:()=>QH,Ipv4NetworkFromString:()=>Woe,Ipv4PrivateAddress:()=>Moe,Ipv4PrivateAddressFromString:()=>$oe,Ipv6Address:()=>tE,Ipv6AddressFromString:()=>GH,Ipv6Interface:()=>JH,Ipv6InterfaceFromString:()=>Hoe,Ipv6Network:()=>YH,Ipv6NetworkFromString:()=>Voe,Ipv6UniqueLocalAddress:()=>Noe,Ipv6UniqueLocalAddressFromString:()=>Uoe,Json:()=>nE,JsonFromUrlParamsField:()=>wse,JsonObject:()=>Qse,Literal:()=>Ht,Literals:()=>ti,MacAddress:()=>Pu,MacAddressFromString:()=>$l,MacBroadcastAddress:()=>koe,MacBroadcastAddressFromString:()=>Aoe,MacLocallyAdministeredAddress:()=>Doe,MacLocallyAdministeredAddressFromString:()=>Loe,MacMulticastAddress:()=>yoe,MacMulticastAddressFromString:()=>Soe,MacUnicastAddress:()=>Ioe,MacUnicastAddressFromString:()=>Coe,MacUniversallyAdministeredAddress:()=>Boe,MacUniversallyAdministeredAddressFromString:()=>joe,MutableJson:()=>Xse,Natural:()=>Au,Never:()=>ure,NonEmptyArray:()=>VS,NonEmptyString:()=>iv,Null:()=>HS,NullOr:()=>XA,NullishOr:()=>Zz,Number:()=>Lm,NumberFromString:()=>Nne,ObjectKeyword:()=>dre,Opaque:()=>Mre,Option:()=>Ru,OptionFromNullOr:()=>Sse,OptionFromNullishOr:()=>bse,OptionFromOptional:()=>Ase,OptionFromOptionalKey:()=>kse,OptionFromOptionalNullOr:()=>vse,OptionFromUndefinedOr:()=>Ese,Port:()=>rse,PropertyKey:()=>VA,ReadonlyMap:()=>kne,ReadonlySet:()=>Ane,Record:()=>Ou,RecordFromCookies:()=>Ise,RecordFromUrlParams:()=>Tse,Redacted:()=>bq,RedactedFromValue:()=>Ose,RegExp:()=>vne,Result:()=>_se,SchemaError:()=>vu,ScopedIpv6Literal:()=>pv,ScopedIpv6LiteralFromString:()=>nq,SocketAddress:()=>Yoe,StandardSchemaV1FailureResult:()=>qne,String:()=>B,StringForLiteralAutocomplete:()=>lre,StringFromBase64:()=>Bne,StringFromBase64Url:()=>jne,StringFromHex:()=>zne,StringFromUriComponent:()=>Hne,Struct:()=>He,StructWithRest:()=>Sre,Symbol:()=>Gz,TaggedClass:()=>Mse,TaggedError:()=>xs,TaggedStruct:()=>Bm,TaggedUnion:()=>Rre,TemplateLiteral:()=>are,TemplateLiteralParser:()=>ire,TimeZone:()=>qH,TimeZoneFromString:()=>moe,TimeZoneNamed:()=>zH,TimeZoneNamedFromString:()=>doe,TimeZoneOffset:()=>poe,Tree:()=>Zse,Trim:()=>Lne,Trimmed:()=>wH,TrueLiterals:()=>JS,Tuple:()=>aa,TupleWithRest:()=>Ere,URL:()=>SH,URLFromString:()=>One,URLSearchParams:()=>CH,Uint8Array:()=>YS,Uint8ArrayFromBase64:()=>Vne,Uint8ArrayFromBase64Url:()=>Gne,Uint8ArrayFromHex:()=>kH,Undefined:()=>QA,UndefinedOr:()=>GS,Union:()=>ht,UniqueArray:()=>Ire,UniqueSymbol:()=>mre,UnixPathAddress:()=>tq,UnixPathAddressFromString:()=>Qoe,Unknown:()=>Dm,UnknownFromJsonString:()=>Rne,UrlParams:()=>dv,Void:()=>pre,annotate:()=>Mte,annotateEncoded:()=>$te,annotateKey:()=>Nte,asserts:()=>Bte,brand:()=>KS,catchDecoding:()=>kre,catchDecodingWithContext:()=>tH,catchEncoding:()=>Are,catchEncodingWithContext:()=>rH,check:()=>wre,declare:()=>Ve,declareConstructor:()=>An,decode:()=>vre,decodeEffect:()=>jte,decodeExit:()=>zte,decodeOption:()=>qte,decodePromise:()=>Vte,decodeResult:()=>Wte,decodeSync:()=>Gte,decodeTo:()=>se,decodeUnknownEffect:()=>Xa,decodeUnknownExit:()=>Dz,decodeUnknownOption:()=>Hte,decodeUnknownPromise:()=>Bz,decodeUnknownResult:()=>Lz,decodeUnknownSync:()=>jz,encode:()=>Ore,encodeEffect:()=>Kte,encodeExit:()=>Jte,encodeKeys:()=>xre,encodeOption:()=>Qte,encodePromise:()=>Xte,encodeResult:()=>Yte,encodeSync:()=>ere,encodeTo:()=>tv,encodeUnknownEffect:()=>jS,encodeUnknownExit:()=>zz,encodeUnknownOption:()=>Zte,encodeUnknownPromise:()=>qz,encodeUnknownResult:()=>Hz,encodeUnknownSync:()=>Wz,extendTo:()=>yre,fieldsAssign:()=>hre,flip:()=>WA,fromBrand:()=>Tre,fromFormData:()=>Mne,fromJsonString:()=>uv,fromURLSearchParams:()=>$ne,instanceOf:()=>ec,is:()=>BS,isBase64:()=>cH,isBase64Url:()=>Hre,isBetween:()=>tc,isBetweenBigDecimal:()=>Yne,isBetweenBigInt:()=>dne,isBetweenCodePoints:()=>gne,isBetweenDate:()=>une,isBetweenLength:()=>ov,isBetweenProperties:()=>Ine,isBetweenSize:()=>Sne,isCapitalized:()=>Jre,isEndingWith:()=>Wre,isFinite:()=>Qre,isGUID:()=>jre,isGreaterThan:()=>Xre,isGreaterThanBigDecimal:()=>Kne,isGreaterThanBigInt:()=>fne,isGreaterThanDate:()=>sne,isGreaterThanOrEqualTo:()=>uH,isGreaterThanOrEqualToBigDecimal:()=>Jne,isGreaterThanOrEqualToBigInt:()=>fH,isGreaterThanOrEqualToDate:()=>ane,isIncluding:()=>Vre,isInt:()=>QS,isInt32:()=>nne,isLessThan:()=>ene,isLessThanBigDecimal:()=>Zne,isLessThanBigInt:()=>lne,isLessThanDate:()=>ine,isLessThanOrEqualTo:()=>tne,isLessThanOrEqualToBigDecimal:()=>Qne,isLessThanOrEqualToBigInt:()=>pne,isLessThanOrEqualToDate:()=>cne,isLowercased:()=>Kre,isMaxCodePoints:()=>hne,isMaxLength:()=>mH,isMaxProperties:()=>bne,isMaxSize:()=>yne,isMinCodePoints:()=>mne,isMinLength:()=>lH,isMinProperties:()=>Ene,isMinSize:()=>xne,isMultipleOf:()=>rne,isNonEmpty:()=>dH,isPattern:()=>_u,isPropertyNames:()=>Cne,isSchema:()=>zS,isSchemaError:()=>Rz,isStartingWith:()=>qre,isStringBigInt:()=>Ure,isStringFinite:()=>Nre,isStringSymbol:()=>Dre,isTrimmed:()=>iH,isULID:()=>zre,isUUID:()=>Bre,isUint32:()=>one,isUncapitalized:()=>Zre,isUnique:()=>av,isUniqueKey:()=>hH,isUppercased:()=>Gre,link:()=>Fe,linkDecoding:()=>Fl,make:()=>te,makeFilter:()=>Ue,makeFilterGroup:()=>$re,makeIsBetween:()=>Wm,makeIsGreaterThan:()=>jm,makeIsGreaterThanOrEqualTo:()=>zm,makeIsLessThan:()=>Hm,makeIsLessThanOrEqualTo:()=>qm,makeIsMultipleOf:()=>Yre,middlewareDecoding:()=>Xz,middlewareEncoding:()=>eH,mutable:()=>Cre,mutableKey:()=>nre,optional:()=>ei,optionalKey:()=>Qa,overrideToCodecIso:()=>Kse,overrideToEquivalence:()=>Use,overrideToFormatter:()=>$se,readonlyKey:()=>ore,refine:()=>Yz,required:()=>rre,requiredKey:()=>tre,resolveAnnotations:()=>eae,resolveAnnotationsKey:()=>tae,revealBottom:()=>Rte,revealCodec:()=>Ute,suspend:()=>Qz,tag:()=>Ya,tagDefaultOmit:()=>Fre,toCodecArrayFromSingle:()=>Hse,toCodecIso:()=>zse,toCodecJson:()=>jse,toCodecStringTree:()=>hv,toDifferJsonPatch:()=>Jse,toEncoded:()=>_l,toEncoderXml:()=>qse,toEquivalence:()=>Dse,toFormatter:()=>Nse,toIso:()=>Wse,toIsoFocus:()=>Gse,toIsoSource:()=>Vse,toJsonSchemaDocument:()=>Bse,toRepresentation:()=>Lse,toStandardJSONSchemaV1:()=>Lte,toStandardSchemaV1:()=>Dte,toTaggedUnion:()=>aH,toType:()=>vn,withArrayLengthConstraints:()=>WS,withConstructorDefault:()=>nH,withDecodingDefault:()=>sH,withDecodingDefaultKey:()=>rv,withDecodingDefaultType:()=>Pre,withDecodingDefaultTypeKey:()=>_re});var Xy="~effect/HashMap",ls=5,lm=1<<ls,F7=lm/4,JL=lm/2,R7=lm-1,M7=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),fm=(e,t)=>e>>>t&R7,Gi=(e,t)=>1<<fm(e,t),Yy=(e,t)=>M7(e&t-1);function ZL(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=Gi(r,t),i=Gi(o,t);if(a===i){let f=ZL(e,t+ls,r,n,o,s);return new yu(e,a,[f])}let c=a|i,u=a>>>0<i>>>0?[n,s]:[s,n];return new yu(e,c,u)}var $7=De("HashMap"),QL=(e,t)=>xe(Y(e),Y(t)),YL=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},gu=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=pc;t=this.computeHash(),r===pc&&(this._hash=t)}return t}},dk=class extends gu{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return A()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new xu(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},xu=class e extends gu{_tag="LeafNode";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&Z(this.key,n)?v(this.value):A()}has(t,r,n){return this.hash===r&&Z(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&Z(this.key,o))return Z(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(a.value=!0,this.hash===n)return new mk(t,n,[[this.key,this.value],[o,s]]);let i=Gi(n,r),c=Gi(this.hash,r);if(i===c)return new yu(t,i,[this.set(t,r+ls,n,o,s,a)]);let u=i|c,f=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new yu(t,u,f)}remove(t,r,n,o,s){if(this.hash===n&&Z(this.key,o)){s.value=!0;return}return this}computeHash(){return QL(this.key,this.value)}},mk=class e extends gu{_tag="CollisionNode";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return A();for(let[o,s]of this.entries)if(Z(o,n))return v(s);return A()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(Z(o,n))return!0;return!1}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return a.value=!0,ZL(t,r,this.hash,this,n,new xu(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(Z(this.entries[i][0],o)){if(Z(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let a=this.entries.findIndex(([c])=>Z(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new xu(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=QL(r[n][0],r[n][1]);return t}},yu=class e extends gu{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=Gi(r,t);if((this.bitmap&o)===0)return A();let s=Yy(this.bitmap,o);return this.children[s].get(t+ls,r,n)}has(t,r,n){let o=Gi(r,t);if((this.bitmap&o)===0)return!1;let s=Yy(this.bitmap,o);return this.children[s].has(t+ls,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=Gi(n,r),c=Yy(this.bitmap,i);if((this.bitmap&i)!==0){let u=this.children[c],f=u.set(t,r+ls,n,o,s,a);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let p=[...this.children];return p[c]=f,new e(t,this.bitmap,p)}else{a.value=!0;let u=new xu(t,n,o,s),f=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>JL?this.expand(t,f,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>JL?this.expand(t,f,p):new e(t,f,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=Gi(n,r);if((this.bitmap&a)===0)return this;let i=Yy(this.bitmap,a),c=this.children[i],u=c.remove(t,r+ls,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^a;if(p===0)return;if(this.children.length===2){let m=this.children[i===0?1:0];if(m._tag==="LeafNode")return m}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=p,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new e(t,p,d)}if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.bitmap,f)}expand(t,r,n){let o=new globalThis.Array(lm),s=0;for(let a=0;a<lm;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new hk(t,n.length,o)}computeHash(){return YL(this.children)}},hk=class e extends gu{_tag="ArrayNode";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=fm(r,t),s=this.children[o];return s?s.get(t+ls,r,n):A()}has(t,r,n){let o=fm(r,t),s=this.children[o];return s?s.has(t+ls,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=fm(n,r),c=this.children[i];if(c){let u=c.set(t,r+ls,n,o,s,a);if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.count,f)}else{a.value=!0;let u=new xu(t,n,o,s);if(this.canEdit(t))return this.children[i]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[i]=u,new e(t,this.count+1,f)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=fm(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+ls,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<F7)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[a]=c,new e(t,u,f)}pack(t,r,n){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===r?n:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new yu(t,s,o)}computeHash(){return YL(this.children)}},eS=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case"LeafNode":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case"CollisionNode":{this.entries=t.entries,this.index=0;break}case"IndexedNode":case"ArrayNode":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},N7=(e,t)=>[e,t];var pm=class{[Xy]=Xy;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new eS(this._root,N7)}[ie](t){if(gk(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Is(t,tB(n));if(me(s)||!Z(o,s.value))return!1}return!0}return!1}[ae](){return Er($7^this._root.subtreeHash())}[ot](){return er(this)}toString(){return`HashMap(${j(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[er(t),er(r)])}}pipe(){return ne(this,arguments)}},XL=new dk,gk=e=>O(e,Xy),xk=()=>new pm(!1,0,XL,0);var eB=e=>{let t=XL,r=0,n={value:!1};for(let[o,s]of e){let a=Y(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new pm(!1,0,t,r)};var tB=l(2,(e,t)=>e._root.get(0,Y(t),t));var yk=l(2,(e,t)=>e._root.has(0,Y(t),t));var U7=(e,t,r,n)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,r,t,n,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new pm(!1,o._edit,i,o._size+(s.value?1:0))},Sk=l(3,(e,t,r)=>U7(e,t,Y(t),r)),Ek=e=>new eS(e._root,D);var rB=e=>e[Symbol.iterator](),tS=e=>e.size;var oB=gk;var bk=eB;var B7=rB,dm=e=>Array.from(B7(e)),sB=tS;var mm="~effect/HashSet",j7=De(mm),z7={[ae](){return Er(xe(j7,Y(rS(this))))},[ie](e){return Ck(e)&&nS(this)===nS(e)&&cB(this,t=>iB(e,t))},[Symbol.iterator](){return Ek(rS(this))},toString(){return`HashSet(${j(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:er(Array.from(this))}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},H7=e=>{let t=Object.create(z7);return t[mm]=mm,t.keyMap=e,t},Ck=e=>O(e,mm),rS=e=>e.keyMap;var aB=e=>{let t=xk();for(let r of e)t=Sk(t,r,!0);return H7(t)},iB=(e,t)=>yk(rS(e),t);var nS=e=>tS(rS(e));var cB=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var wk=aB,uB=Ck;var fB=nS;var kk="~effect/http/Cookies",pB=e=>O(e,kk),Ak="~effect/http/Cookies/Cookie",dB=e=>O(e,Ak),lB="~effect/http/Cookies/CookieError",vk=class extends kp{},Su=class e extends mo("CookiesError"){static fromReason(t,r){return new e({reason:new vk({_tag:t,cause:r})})}[lB]=lB;get message(){return this.reason._tag}};var W7={[kk]:kk,...Pt,toJSON(){return{_id:"effect/Cookies",cookies:Jh(this.cookies,e=>e.toJSON())}},pipe(){return ne(this,arguments)}},_k=e=>{let t=Object.create(W7);return t.cookies=e,t},Pk=e=>{let t={};for(let r of e)z(t,r.name,r);return _k(t)},mB=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=V7(n.trim());o&&r.push(o)}return Pk(r)};function V7(e){let t=e.split(";").map(i=>i.trim()).filter(i=>i!=="");if(t.length===0)return;let r=t[0].indexOf("=");if(r===-1)return;let n=t[0].slice(0,r);if(!hB.test(n))return;let o=t[0].slice(r+1),s=Y7(o);if(t.length===1)return Object.assign(Object.create(Ok),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],u=c.indexOf("="),f=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(p===void 0)break;let d=p.trim().replace(/^\./,"");d&&(a.domain=d);break}case"expires":{if(p===void 0)break;let d=new Date(p);isNaN(d.getTime())||(a.expires=d);break}case"max-age":{if(p===void 0)break;let d=parseInt(p,10);isNaN(d)||(a.maxAge=wp(d));break}case"path":{if(p===void 0)break;p[0]==="/"&&(a.path=p);break}case"priority":{if(p===void 0)break;switch(p.toLowerCase()){case"low":a.priority="low";break;case"medium":a.priority="medium";break;case"high":a.priority="high";break}break}case"httponly":{a.httpOnly=!0;break}case"secure":{a.secure=!0;break}case"partitioned":{a.partitioned=!0;break}case"samesite":{if(p===void 0)break;switch(p.toLowerCase()){case"lax":a.sameSite="lax";break;case"strict":a.sameSite="strict";break;case"none":a.sameSite="none";break}break}}}return Object.assign(Object.create(Ok),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var G7=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,hB=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,K7=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,J7=/^[\u0020-\u003a\u003c-\u007e]+$/,Ok={[Ak]:Ak,...Pt,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function Z7(e,t,r){let n=encodeURIComponent(t),o=gB(e,n,r);return o!==void 0?X(o):G(Object.assign(Object.create(Ok),{name:e,value:t,valueEncoded:n,options:r}))}function gB(e,t,r){if(!hB.test(e))return Su.fromReason("InvalidCookieName");if(t&&!G7.test(t))return Su.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!K7.test(r.domain))return Su.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!J7.test(r.path))return Su.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!Rs(pt(r.maxAge)))return Su.fromReason("CookieInfinityMaxAge")}var xB=(e,t,r)=>mi(Z7(e,t,r));function Q7(e){let t=gB(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+"="+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=Ms(pt(n.maxAge));r+="; Max-Age="+Math.trunc(o)}if(n.domain!==void 0&&(r+="; Domain="+n.domain),n.path!==void 0&&(r+="; Path="+n.path),n.priority!==void 0)switch(n.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break}if(n.expires!==void 0&&(r+="; Expires="+n.expires.toUTCString()),n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.partitioned&&(r+="; Partitioned"),n.sameSite!==void 0)switch(n.sameSite){case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break}return r}var yB=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];z(t,o.name,o.value)}return t},SB=e=>Object.values(e.cookies).map(Q7);var Y7=e=>{try{return decodeURIComponent(e)}catch{return e}};var Eu=new WeakMap,EB=e=>{if(Eu.has(e))return Eu.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var bB="~effect/Redacted",dl=e=>O(e,bB),ro=(e,t)=>{let r=Object.create(tX);return t?.label&&(r.label=t.label),Eu.set(r,e),r},tX={[bB]:{_A:e=>e},label:void 0,...Nr,toJSON(){return this.toString()},toString(){return`<redacted${Nn(this.label)?":"+this.label:""}>`},[ae](){return Y(Eu.get(this))},[ie](e){return dl(e)&&Z(Eu.get(this),Eu.get(e))}},sa=EB;var IB=e=>Ur((t,r)=>e(sa(t),sa(r)));var Fk=Symbol.for("~effect/http/Headers"),CB=e=>O(e,Fk),Rk=Object.defineProperties(Object.create(null),{[Fk]:{value:Fk},[pa]:{value(e){return nX(this,$e(e,oX))}},toJSON:{value(){return Uo(this)}},[ie]:{value(e){return Mk(this,e)}},[ae]:{value(){return op(this)}},toString:{value:Pt.toString},[ot]:{value:Pt[ot]}});var Mk=G_(Xu()),rX=Object.create(Rk),wB=e=>{if(e===void 0)return rX;if(Symbol.iterator in e){let r=Object.create(Rk);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(Rk);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(", "):n!==void 0&&(t[r.toLowerCase()]=n);return t};var nX=l(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=ro(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=ro(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),TB=(e,t)=>{let r=e.toLowerCase();for(let n=0;n<t.length;n++){let o=t[n];if(typeof o=="string"){if(o.toLowerCase()===r)return!0}else if(e.search(o)!==-1)return!0}return!1},oX=ke("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]});var hm=e=>typeof e=="string"?e:sa(e);var $k="~effect/http/UrlParams",Nk=e=>O(e,$k),sX={...Nr,[$k]:$k,[Symbol.iterator](){return this.params[Symbol.iterator]()},[pa](e){return{_id:"UrlParams",params:Object.fromEntries(cX(this,$e(e,fX)))}},toJSON(){return Uo(this)},[ie](e){return Uk(this,e)},[ae](){return ws(this.params.flat())}},oS=e=>{let t=Object.create(sX);return t.params=e,t},OB=e=>{if(Nk(e))return e;let t=_B(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return oS(r)},_B=e=>{let t=typeof e[Symbol.iterator]=="function"?Xe(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,vB(o[s])]);else if(o!==null&&typeof o=="object"&&!dl(o)){let s=_B(o);for(let[a,i]of s)r.push([[n,...typeof a=="string"?[a]:a],i])}else o!==void 0&&r.push([n,vB(o)]);return r},vB=e=>dl(e)?e:String(e),Uk=Ur((e,t)=>aX(e.params,t.params)),aX=Q_(B_([Xu(),ap()]));var PB=l(2,(e,t)=>Ip(e.params,([r])=>r===t).pipe(rr(([,r])=>hm(r))));var iX=e=>{let t={};for(let[r,n]of e.params){let o=hm(n);if(!Object.hasOwn(t,r))z(t,r,o);else{let s=t[r];typeof s=="string"?z(t,r,[s,o]):s.push(o)}}return t},FB=iX,cX=l(2,(e,t)=>{let r=Array.isArray(t)?t:[t];return e.params.map(([n,o])=>[n,typeof o=="string"&&uX(n,r)?ro(o):o])}),uX=TB;var fX=ke("effect/http/UrlParams/CurrentRedactedNames",{defaultValue:()=>["AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var Dk="~effect/Graph",Lk=e=>O(e,Dk),RB=e=>e;var pX=(e,t,r)=>(e==="directed"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&Z(t.data,r.data),dX=(e,t)=>e==="directed"?Y(t):Er(xe(Y(t.data),mX(t.source,t.target))),mX=(e,t)=>xe(0,Y(e))+xe(0,Y(t)),hX=De("Graph"),gX={[Dk]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[ot](){return this.toJSON()},[ie](e){if(O(e,Dk)){let t=RB(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!Z(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!pX(this.type,n,o))return!1}return!0}return!1},[ae](){let e=hX;e=e^De(this.type),e=e^Wt(this.nodes.size),e=e^Wt(this.edges.size);for(let[t,r]of this.nodes)e^=xe(Y(t),Y(r));for(let[t,r]of this.edges)e^=xe(Y(t),dX(this.type,r));return Er(e)},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return ne(this,arguments)}},xX=(e,t)=>{let r=Object.create(gX);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=v(!0),r};var gm=e=>{let t=RB(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},sS=e=>{let t=xX(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type==="undirected"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=A(),t};var aS=(e,t,r)=>e===rt?r(t):Qt(e,r);function $B(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===rt?e.decode(vr(Hd(n)),o):e.decode(Wc(r,Hd),o);return MB(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===rt?vr(n):r;case"Transform":{let r=n=>n===Te?wn:vr(t.transform(n));return(n,o)=>aS(n,o,r)}case"TransformOptional":{let r=n=>Bw(t.transform(Hd(n)));return(n,o)=>aS(n,o,r)}case"TransformEffect":return(r,n,o)=>aS(r,n,s=>s===Te?wn:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>aS(r,n,s=>MB(t.transform(Hd(s),o)))}}var MB=e=>Qt(e,Bw),NB=(e,t,r,n)=>Ct(n,o=>Oa(()=>wi(o,s=>new zU(e,s,t,r))));function SX(e,t){let r=$B(e.link.transformation),n;return(o,s)=>{if(o===Te)return wn;if(e.isConstructed(o))return rt;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function EX(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==Te&&n!==void 0)return t(n,o);let s=r;if(je(s)&&s._tag==="Success"){let a=t(s[ge],o);return a===rt?s:a}return Qt(NB(e,n,o,s),a=>{let i=t(a,o);return i===rt?vr(a):i})}}function Bk(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:EX(e,r)}function xm(e,t,r,n,o){if(e._tag==="Declaration")for(let x of e.typeParameters)t(x);let s=r?oL(e):void 0,a=s?SX(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,u=c?.map(x=>$B(x.transformation)),f=e.encodingChecks;if(!c&&!i&&!f)return a;let p,d=(x,y)=>{let E=a(x,y);if(f&&!y.disableChecks)if(je(E)){if(E._tag==="Success"){let w=E===rt?x:E[ge];if(x!==Te&&w!==Te){let T=fs(f,x,void 0,e,y);T&&(E=k(new Xt(e,T,x,y)))}}}else E=I(E,w=>{if(x!==Te&&w!==Te){let T=fs(f,x,void 0,e,y);if(T)return k(new Xt(e,T,x,y))}return g(w)});if(i&&!y.disableChecks)if(je(E)){if(E._tag==="Success"){let w=E===rt?x:E[ge];if(w===Te)return E;let T=fs(i,w,void 0,e,y);T&&(E=k(new Xt(e,T,w,y)))}}else E=I(E,w=>{if(w!==Te){let T=fs(i,w,void 0,e,y);if(T)return k(new Xt(e,T,w,y))}return g(w)});return E},m=o===void 0?d:o(d);return c?(x,y)=>{let E=p??=c.map(M=>t(M.to)),w=x,T=E[E.length-1](x,y);for(let M=c.length-1;M>=0;M--)if(T=u[M](T,w,y),M!==0){let P=E[M-1];T._tag==="Success"?(w=T[ge],T=P(w,y)):T=Qt(T,h=>{let S=P(h,y);return S===rt?vr(h):S})}if(T._tag==="Success"){let M=T[ge],P=m(M,y);return P===rt?T:P}return T=NB(e,x,y,T),Qt(T,M=>{let P=m(M,y);return P===rt?vr(M):P})}:m}var uS=Symbol(),UB=new WeakMap,DB,ml=!1;var IX=e=>ml?cS(no,e,"parser"):no(e).parser,LB=e=>ml?cS(no,e,"makeEffect"):no(e).makeEffect,CX=e=>Bk(e,LB),iS=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=xm(this.ast,IX)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=xm(this.ast,LB,CX)}},jk=class extends iS{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r=="function"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??xm(this.ast,t=>cS(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",wX(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>cS(this.resolve,n,"makeEffect");return this.save("makeEffect",xm(this.ast,r,n=>Bk(n,r)))}};function wX(e,t){let r;return(n,o)=>{if(n!==Te)try{let s=e(n,o);if(s!==uS)return s===n?rt:vr(s)}catch(s){return lr(s)}return(r??=t())(n,o)}}function cS(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,a)=>(o??=n[r])(s,a)}function no(e){let t=UB.get(e);if(t!==void 0)return t;let r=DB===void 0?new iS(e):new jk(e,DB(e,no),no);return UB.set(e,r),r}function Hk(e){let t=e.ast,r;return(n,o)=>(r??=Zk(RX,zt(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function lS(e){let t=Hk(e);return(r,n)=>{let o=Vs(t(r,n));return et(o)?v(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),A())}}function pS(e){return PX(zt(e.ast))}function qk(e){return ym(e.ast)}function kX(e){if(!ml){let o=hl(hS(e));return s=>{let a=o(s,ra);return et(a)?!0:(Yn(a.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=no(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,ra)}catch(s){return Yn(wf(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=Vs(Jk(n(o,ra),o));return et(s)?!0:(Yn(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function ym(e){let t=zt(e),r=n=>(r=kX(t),r(n));return n=>r(n)}function BB(e){let t=hS(e);return(r,n)=>{let o=Vs(t(r,n));if(!et(o))return Yn(o.cause,"Issue adapter can only return schema issues")}}function jB(e,t){let r=zt(e.ast),n=no(r).parser(t,ra),o=Vs(Jk(n,t));if(ka(o)){let s=Yn(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function Ut(e,t){let r=hS(e.ast);return t===void 0?r:(n,o)=>r(n,Kk(t,o))}var Wk=Ut;function zB(e,t){return hl(Ut(e,t))}function Vk(e,t){return JB(Ut(e,t))}var HB=Vk;function qB(e,t){return ZB(Ut(e,t))}function AX(e,t){return ml?QB(e.ast,t):Qk(Ut(e,t))}var dS=AX;function bu(e,t){let r=hS(to(e.ast));return t===void 0?r:(n,o)=>r(n,Kk(t,o))}var WB=bu;function VB(e,t){return hl(bu(e,t))}function Gk(e,t){return JB(bu(e,t))}var GB=Gk;function KB(e,t){return ZB(bu(e,t))}function vX(e,t){return ml?QB(to(e.ast),t):Qk(bu(e,t))}var mS=vX,Kk=(e,t)=>t?{...e,...t}:e,fS=e=>e===Te?k(new he):g(e);function hS(e){return Zk(FX,e)}function Jk(e,t){return e===rt?g(t):je(e)?e[ge]===Te?fS(Te):e:Qt(e,fS)}function Zk(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??ra);return s===rt?g(n):je(s)?s[ge]===Te?fS(Te):s:Qt(s,fS)}}function hl(e){return(t,r)=>Vs(e(t,r))}function JB(e){let t=hl(e);return(r,n)=>{let o=t(r,n);return et(o)?v(o.value):(Yn(o.cause,"Option adapter can only return none for schema issues"),A())}}function ZB(e){let t=hl(e);return(r,n)=>{let o=t(r,n);return et(o)?G(o.value):X(Yn(o.cause,"Result adapter can only return schema issues"))}}function QB(e,t){let r;return(n,o)=>(r??=OX(no(e),t))(n,o)}function OX(e,t){let r=e.decode,n,o=r===void 0?(s,a=ra)=>(n??=zk(e))(s,a):(s,a=ra)=>{if(s===Te)return(n??=zk(e))(s,a);let i;try{i=r(s,a)}catch(c){throw Yn(wf(c),"Sync adapter can only throw schema issues"),c}return i!==uS?i:(n??=zk(e))(s,a)};return t===void 0?o:(s,a)=>o(s,Kk(t,a))}function zk(e){return Qk(Zk(()=>e.decodeEffect,e.ast))}function Qk(e){let t=hl(e);return(r,n)=>{let o=t(r,n);if(et(o))return o.value;let s=Yn(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function _X(e,t){let r=Vs(e);if(et(r))return r.value;let n=Yn(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function PX(e){let t,r;return(n,o)=>{t??=no(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??ra,a=t.make;if(a!==void 0&&n!==Te){let c;try{c=a(n,s)}catch(u){throw Yn(wf(u),"Constructor adapter can only throw schema issues"),u}if(c!==uS&&c!==Te)return c}let i=(r??=t.makeEffect)(n,s);return _X(Jk(i,n),"Constructor adapter can only throw schema issues")}}var FX=e=>no(e).parser,RX=e=>no(e).makeEffect;var gS="~effect/Schema/Schema",YB=Symbol(),MX={[gS]:gS,get make(){let e=pS(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Hk(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=lS(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return ne(this,arguments)},annotate(e){return this.rebuild(is(this.ast,e))},annotateKey(e){return this.rebuild(am(this.ast,e))},check(...e){return this.rebuild(na(this.ast,e))},rebuild(e){return ps(e,this[YB])}};function ps(e,t){function r(){}let n=Object.setPrototypeOf(r,MX);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[YB]=t,n.ast=e,n}function Yk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Sm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Xk(e){return encodeURI(Yk(e)).replace(/#/g,"%23")}function eA(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let r=decodeURIComponent(t);return r.startsWith("/")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function ej(e){let t=eA(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Sm)}function tj(e){return e.reduce((t,r)=>`${t}/${Xk(r)}`,"#")}var NX="http://json-schema.org/draft-07/schema#",rj="https://json-schema.org/draft/2020-12/schema";function nj(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function aj(e){return{dialect:"draft-07",...jX(e,QX)}}function UX(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Dn(n))return n;let a=o||!s&&uj(n.$id),i={};for(let c of Object.keys(n)){let u=n[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=rA(u,p=>r(p,a))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(p=>r(p,a)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":f=r(u,a)}z(i,c,f)}return t(i,a),i}}function ij(e,t){return UX(e,r=>{DX(r,t)})}function DX(e,t){typeof e.$ref=="string"&&z(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&z(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function rA(e,t){if(!Dn(e))return;let r={};for(let n of Object.keys(e))z(r,n,t(e[n],n));return r}function LX(e,t,r){let n=new Map,o=[],s=tA;function a(d,m=[],x=[]){if(m.length===0&&t?.trackIds){let y=Dn(d)?f(d):void 0;s=oj(y,tA)??tA}return u(d,m,x,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[d,m,x]of o){let y=m,E=cj(m,x);if(E!==void 0){let w=ej(E.hash);if(E.hash="",w!==void 0){let T=n.get(sj(E.href,w));T!==void 0&&(y=BX(m,T))}}z(d,"$ref",y)}}let c=r(a);return i(),c;function u(d,m,x,y){if(typeof d=="boolean")return p(m,x,y),t?.booleanAdapter?.(d)??d;if(!Dn(d))return d;let E=y,w=f(d);if(m.length>0&&t?.trackIds&&uj(w)){let P=oj(w,y.uri);P!==void 0&&(E={parent:y,sourceRoot:m,targetRoot:x,uri:P})}p(m,x,E);let T=E.uri,M={isDocumentRoot:m.length===0,schema(P,h,S=h){return u(P,[...m,h],[...x,S],E)},schemaAt(P,h,S){return u(P,[...m,...h],[...x,...S],E)},schemaArray(P,h,S=h){return Array.isArray(P)?P.map((b,C)=>u(b,[...m,h,String(C)],[...x,S,String(C)],E)):P},schemaMap(P,h,S=h){return Dn(P)?rA(P,(b,C)=>u(b,[...m,h,C],[...x,S,C],E)):P},reference(P,h){typeof h=="string"?o.push([P,h,T]):z(P,"$ref",h)}};return e(d,M)}function f(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref=="string"?void 0:d.$id}function p(d,m,x){x.parent!==void 0&&p(d,m,x.parent),n.set(sj(x.uri,d.slice(x.sourceRoot.length)),m.slice(x.targetRoot.length))}}var tA="https://effect.invalid/.json-schema/";function cj(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function oj(e,t){if(typeof e!="string")return;let r=cj(e,t);if(r!==void 0)return r.hash="",r.href}function BX(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${tj(t)}`}function sj(e,t){return`${e}\0${JSON.stringify(t)}`}function uj(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function jX(e,t,r){return LX(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:rA(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var zX=new Set(["properties","patternProperties"]),HX=new Set(["allOf","anyOf","oneOf"]),qX=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function WX(e,t,r,n,o,s=zX){let a;if(s.has(t))a=n.schemaMap(r,t);else if(HX.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return z(e,t,a),!0}var fj=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],oSe=[...fj,"deprecated"],sSe=[...fj,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],VX=/^[A-Za-z_][-A-Za-z0-9._]*$/,GX=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Iu(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function KX(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&Iu(o,r,`it is not active in ${n} but would become active in the target`)}var JX=["additionalItems","definitions","dependencies"];function ZX(e,t,r,n,o){r.isDocumentRoot?z(e,"$schema",nj(t,rj)?n:t):nj(t,rj)||Iu("$schema",o,"an embedded resource cannot declare a different dialect")}function QX(e,t){KX(e,JX,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!WX(r,a,i,t,qX))switch(a){case"$ref":n=i;break;case"$schema":ZX(r,i,t,NX,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":z(r,"definitions",t.schemaMap(i,a,"definitions"));break;case"prefixItems":o=i;break;case"items":s=i;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":Iu(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;z(r,a,i);break;default:z(r,a,i)}}if(YX(r,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&Iu("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&z(r,"minContains",a)}else Object.hasOwn(e,"minContains")&&z(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&z(r,"maxContains",e.maxContains);return eee(e,r,t,"draft-07"),ree(e,r,"$id","Draft-07"),XX(r,n,t),r}function YX(e,t,r,n){if(t===void 0){r!==void 0&&z(e,"items",n.schema(r,"items"));return}z(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&z(e,"additionalItems",n.schema(r,"items","additionalItems"))}function XX(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),tee(e,n)}else r.reference(e,t)}function eee(e,t,r,n){let o=Dn(e.dependentRequired)?e.dependentRequired:void 0,s=Dn(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let u=o?.[c],f=s?.[c],p=n==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?p||z(a,c,u):u===void 0||p?z(a,c,r.schemaAt(f,["dependentSchemas",c],["dependencies",c])):z(a,c,{allOf:[r.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(a).length>0&&z(t,"dependencies",a)}function tee(e,t){Array.isArray(e.allOf)?e.allOf.push(t):z(e,"allOf",[t])}function ree(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&z(t,r,o);return}(typeof s!="string"||!VX.test(s))&&Iu("$anchor",n,"the anchor is not valid"),GX.test(s)||Iu("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?z(t,r,`#${s}`):Iu("$anchor",n,"it cannot be combined with the schema $id")}function xS(e){return ps(gl(e.ast),{schema:e})}var gl=pu(e=>{let t=oee(e,gl),r=e.context;return t===e||r===void 0?t:zy(t,nA(r))});function nA(e){return e.constructorDefault===void 0?e:new ta(e.isOptional,e.isMutable,void 0,e.annotations)}function dj(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function mj(e){return t=>{let r=[...t].sort((o,s)=>e(cs(o))-e(cs(s)));return r.some((o,s)=>o!==t[s])?r:t}}var nee=mj(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function oee(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Un(r))return mt(e,[qT]);let n=e.typeParameters.map(s=>ps(cs(s))),o=r(n);return o===void 0?e:mt(e,[cl(o,t)])}case"Unknown":return mt(e,[qT]);case"ObjectKeyword":return mt(e,[iL]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return dj(e),e.recur(t,qy);case"Union":{let r=nee(e.types);return r!==e.types?new kn(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function yS(e){return ps(hj(zt(e.ast)))}var hj=No(e=>{let t=see(e,hj);return t!==e&&e.context!==void 0?zy(t,nA(e.context)):t});function see(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Un(r)){let n=r(e.typeParameters.map(o=>ps(o)));return mt(e,[cl(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function SS(e){return ps(Sj(e.ast),{schema:e})}function gj(e){return ps(Ej(e.ast))}var aee=mj(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function iee(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(u=>ps(t(cs(u)))),o=e.annotations?.toCodecStringTree;if(Un(o)){let u=o(n);return u===void 0?e:mt(e,[cl(u,t)])}let s=e.annotations?.toCodecJson,a=Un(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(Un(i)?i(n):void 0);return c===void 0?r(e):mt(e,[cl(c,t)])}case"Null":return mt(e,[cee]);case"Boolean":return mt(e,[uee]);case"Unknown":case"ObjectKeyword":return mt(e,[WT]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return dj(e),e.recur(t,qy);case"Union":{let n=aee(e.types);return n!==e.types?new kn(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var cee=new Ot(new eo("null"),new We(Ee(()=>null),Ee(()=>"null"))),uee=new Ot(new kn([new eo("true"),new eo("false")]),new We(Ee(e=>e==="true"),cu())),xj=new We(Ee(e=>typeof e=="string"?[e]:e),ea()),yj=e=>e.transformation===xj,Sj=pu(e=>{let t=iee(e,Sj,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?zy(t,nA(e.context)):t},{stopAt:yj}),pj=e=>Or(e)?du(qa):qa,Ej=pu(e=>{let t=fee(e);if(bT(t)){let r=ul(new kn([new _o(t.isMutable,t.elements.map(pj),t.rest.map(pj)),Xn],{mode:"anyOf"}),t,xj);return Or(e)?du(r):r}return t},{stopAt:yj});function fee(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(Ej):e}var iSe=globalThis.RegExp;var Ka=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function Ji(e,t){return t.length>0&&(e+=`
|
|
33
|
+
at ${Th(t)}`),new Error(e)}function bj(e){return`#/$defs/${Xk(e)}`}var lee=new Set([...BU,au,...LU]);function bm(e,t){if(e===void 0)return;let r={},n=e.title;typeof n=="string"&&(r.title=n);let o=e.description,s=e.expected;typeof o=="string"?r.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(r.description=s);let a=e.default;fl(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&fl(i)&&(r.examples=i);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(r.writeOnly=u);let f=e.format;typeof f=="string"&&(r.format=f);let p=e.contentEncoding;typeof p=="string"&&(r.contentEncoding=p);let d=e.contentMediaType;typeof d=="string"&&(r.contentMediaType=d);let m=e.contentSchema;if(fl(m)&&(r.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[x,y]of Object.entries(e))lee.has(x)||!t.includeAnnotationKey(x)||fl(y)&&z(r,x,y);return Object.keys(r).length===0?void 0:r}function Ij(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let a=Ij(s);a.type!==void 0&&(o=!0,(t===void 0||a.type==="integer")&&(t=a.type)),Object.keys(a.schema).length>0&&n.push(a.schema)}if(o){let{allOf:s,...a}=r;r=n.length===0?a:{...a,allOf:n}}}return{type:t,schema:r}}function pee(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}var Cj="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function ES(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function dee(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var mee="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",hee="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function gee(e,t,r){if(typeof e.$ref=="string")return;let n={...e,...t};for(let o of r){if(!Object.hasOwn(e,o))continue;let s=e[o],a=t[o];if(typeof s!="number"||typeof a!="number")return;if(mee.includes(`|${o}|`))n[o]=Math.max(s,a);else if(hee.includes(`|${o}|`))n[o]=Math.min(s,a);else return}return typeof n.minimum=="number"&&typeof n.exclusiveMinimum=="number"&&delete n[n.exclusiveMinimum>=n.minimum?"minimum":"exclusiveMinimum"],typeof n.maximum=="number"&&typeof n.exclusiveMaximum=="number"&&delete n[n.exclusiveMaximum<=n.maximum?"maximum":"exclusiveMaximum"],n}var aA="|title|description|default|examples|readOnly|writeOnly|",xee=Cj+aA;function Im(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=pee(e);if(o!==void 0||s){let i=Ij(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(i.schema);return f.length===0?u:ES(i.schema,aA)&&dee(u,f)?{...u,...i.schema}:Im(u,i.schema,r)}}if(r){let i=gee(e,t,n);if(i!==void 0)return i}let a=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref=="string"?{allOf:[e,...a]}:{...e,allOf:a}}function sA(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>sA(r,t)))}function yee(e){return Array.isArray(e)}function See(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,u=Object.keys(r);for(let h of u)x(h,["references",h]);let f=ar(e,(h,S)=>T(h,t[S],[]));for(let[h,S]of i.values())if(!sA(h))for(let b of S)Array.isArray(b.oneOf)&&(b.anyOf=b.oneOf,delete b.oneOf);for(let h of u){let S=r[h],b=E(S);if(b===void 0)continue;let C=o.get(h)[0],_=c.get(b),$=_?.find(H=>Z(o.get(H)[0],C));$===void 0?_===void 0?c.set(b,[h]):_.push(h):s.set(h,$)}let p=ar(f,y),d={};for(let h of u)s.has(h)||z(d,h,y(o.get(h)[0]));return{dialect:"draft-2020-12",schemas:p,definitions:d};function m(h){return Array.isArray(h.oneOf)&&i.get(h.oneOf)?.[1].push(h),h}function x(h,S){if(!Object.hasOwn(r,h))throw Ji(`Invalid reference ${h}`,[...S,"$ref"]);let b=o.get(h);if(b!==void 0)return b;let C=[{},[]];return o.set(h,C),C[0]=T(r[h],["references",h],C[1]),C}function y(h){return ij(h,S=>{let b=eA(S);if(b===void 0){if(/^#(?:\/|%2f)/i.test(S))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(S)}`);return S}if(!b.startsWith("/$defs/"))return S;let C=b.indexOf("/",7),_=s.get(Sm(b.slice(7,C<0?void 0:C)));return _===void 0?S:S.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,bj(_))})}function E(h){if(h._tag==="Reference")return;let S=h.checks.length===0?h.annotations:h.checks[h.checks.length-1].annotations;return typeof S?.identifier!="string"&&typeof S?.[au]=="string"?S[au]:void 0}function w(h,S,b,C){let _=h.annotations,$=_?.toJsonSchema;if($!==void 0){let pe=h.representation?.schemas?.map((la,Zl)=>T(la,[...b,"representation","schemas",Zl],C))??[],_e=$({type:S,schemas:pe}),Je=yee(_e);Je&&C.push(!1);let _t=Je?_e[0]:_e,Dt=bm(_,n),xn=Dt===void 0?_t:{..._t,...Dt},so=Dt===void 0?Cj:xee;return[xn,h._tag==="Filter"&&ES(xn,so)&&(Dt===void 0||ES(Dt,aA))?!0:void 0]}if(h._tag==="Filter"){C.push(!1);return}let H=h.checks.flatMap((pe,_e)=>{let Je=w(pe,S,[...b,"checks",_e],C);return Je===void 0?[]:[Je[0]]});if(H.length===0)return;let J=bm(_,n),Ce={allOf:H};return[J===void 0?Ce:{...Ce,...J}]}function T(h,S,b){if(h._tag==="Reference")return b.push(x(h.$ref,S)[1]),{$ref:bj(h.$ref)};let C=a.get(h);if(C!==void 0)return b.push(C[1]),C[0];let _=[];b.push(_);let $=M(h,S,_),H=bm(h.annotations,n);H!==void 0&&($={...$,...H});for(let J=0;J<h.checks.length;J++){let Ce=typeof $.type=="string"&&Eee($.type)?$.type:void 0,pe=w(h.checks[J],Ce,[...S,"checks",J],_);pe!==void 0&&($=Im($,...pe))}return a.set(h,[$,_]),m($)}function M(h,S,b){switch(h._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(h.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(h.symbol)]};case"Declaration":return b.push(!1),{};case"Suspend":return T(h.thunk,[...S,"thunk"],b);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let C=h.literal;return typeof C=="bigint"?{type:"string",enum:[globalThis.String(C)]}:{type:typeof C,enum:[C]}}case"Enum":{let C=h.enums.map(([_,$],H)=>{if(typeof $=="number"&&!globalThis.Number.isFinite($))throw Ji(`Invalid numeric enum value ${globalThis.String($)}`,[...S,"enums",H,1]);return{type:typeof $,enum:[$],title:_}});return C.length===0?{not:{}}:{anyOf:C}}case"TemplateLiteral":return{type:"string",pattern:`^${h.parts.map(bS).join("")}$`};case"Arrays":{if(h.rest.length>1)throw Ji("Invalid schema representation document",[...S,"rest"]);let C={type:"array"},_=h.elements.length,$=h.elements.map((H,J)=>{H.isOptional&&_--;let Ce=T(H.type,[...S,"elements",J,"type"],b),pe=bm(H.annotations,n);return pe===void 0?Ce:m(Im(Ce,pe))});if($.length>0?(C.prefixItems=$,C.maxItems=h.elements.length,_>0&&(C.minItems=_)):C.items=!1,h.rest.length===1){delete C.maxItems;let H=T(h.rest[0],[...S,"rest",0],b);Object.keys(H).length>0?C.items=H:delete C.items}return C}case"Objects":{if(h.propertySignatures.length===0&&h.indexSignatures.length===0)return{not:{type:"null"}};let C={type:"object"},_={},$=[];for(let Je=0;Je<h.propertySignatures.length;Je++){let _t=h.propertySignatures[Je];if(typeof _t.name!="string")throw Ji("Invalid schema representation document",[...S,"propertySignatures",Je,"name"]);let Dt=_t.name,xn=T(_t.type,[...S,"propertySignatures",Je,"type"],b),so=bm(_t.annotations,n);z(_,Dt,so===void 0?xn:m(Im(xn,so))),_t.isOptional||$.push(Dt)}h.propertySignatures.length>0&&(C.properties=_),$.length>0&&(C.required=$);let H={},J=[],Ce=[],pe=!1;for(let Je=0;Je<h.indexSignatures.length;Je++){let _t=h.indexSignatures[Je],Dt=T(_t.type,[...S,"indexSignatures",Je,"type"],b);Z(Dt,{not:{}})&&(Dt=!1),Ce.push(Dt);let xn=P(_t.parameter,[...S,"indexSignatures",Je,"parameter"],new Set);if(xn===void 0){pe=!0,b.push(!1);continue}if(xn.length===0)J.push(Dt);else for(let so of xn){let la=H[so];z(H,so,la===void 0?Dt:la===!1||Dt===!1?!1:m(Im(la,Dt)))}}let _e=Object.keys(H).length>0;if(_e&&(C.patternProperties=H),pe&&n?.onExcessProperty==="error"){let Je=[];h.propertySignatures.length>0&&Je.push({enum:Object.keys(_)});for(let _t=0;_t<h.indexSignatures.length;_t++)Je.push(T(h.indexSignatures[_t].parameter,[...S,"indexSignatures",_t,"parameter"],b));C.propertyNames=Je.length===1?Je[0]:{anyOf:Je},C.additionalProperties=Ce.length===1?Ce[0]:{anyOf:Ce},J.length>0&&(C.allOf=J.map(_t=>({type:"object",additionalProperties:_t})))}else J.length===0?C.additionalProperties=pe||n?.onExcessProperty!=="error":J.length===1&&h.propertySignatures.length===0&&!_e?C.additionalProperties=J[0]:J.length>0&&(C.allOf=J.map(Je=>({type:"object",additionalProperties:Je})));return typeof C.additionalProperties=="object"&&C.additionalProperties!==null&&Object.keys(C.additionalProperties).length===0&&delete C.additionalProperties,C}case"Union":{let C=[],_=h.types.map((H,J)=>T(H,[...S,"types",J],C));if(b.push(C),_.length===0)return{not:{}};let $=h.options?.mode??"anyOf";if($==="anyOf"&&_.length>1){let H=bee(_);if(H!==void 0)return H}return $==="oneOf"&&i.set(_,[C,[]]),{[$]:_}}}}function P(h,S,b){switch(h._tag){case"Reference":{if(!Object.hasOwn(r,h.$ref))throw Ji(`Invalid reference ${h.$ref}`,[...S,"$ref"]);if(x(h.$ref,S),b.has(h.$ref))return;let C=new Set(b).add(h.$ref);return P(r[h.$ref],["references",h.$ref],C)}case"String":{if(h.checks.length===0)return[];if(h.checks.length!==1||h.checks[0]._tag!=="Filter"||h.checks[0].annotations?.toJsonSchema===void 0)return;let C=[],_=T(h,S,C);return sA(C)&&_.type==="string"&&typeof _.pattern=="string"&&ES(_,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[_.pattern]:void 0}case"TemplateLiteral":return h.checks.length===0?[`^${h.parts.map(bS).join("")}$`]:void 0;case"Union":{if(h.types.length===0||h.checks.length>0||h.options?.mode==="oneOf")return;let C=[];for(let _=0;_<h.types.length;_++){let $=P(h.types[_],[...S,"types",_],b);if($===void 0)return;if($.length===0)return[];C.push(...$)}return C}default:throw Ji("Invalid schema representation document",S)}}}function Eee(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function bee(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function bS(e){switch(e._tag){case"Literal":return Ka(globalThis.String(e.literal));case"String":return eL;case"Number":return Uy;case"TemplateLiteral":return e.parts.map(bS).join("");case"Union":return`(?:${e.types.map(bS).join("|")})`;default:throw Ji("Invalid schema representation document",[])}}function IS(e,t){let r=See([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var Iee=({identifier:e})=>e;function ds(e){return e===void 0?void 0:{annotations:e}}function Cm(e,t){let{references:r,representations:n}=Cee([e],t);return{representation:n[0],references:r}}function Cee(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let h of e)m(h);let i=t?.referencePolicy??Iee;for(let h of s.values())for(let S of h.values()){let b=i({ast:S.ast,occurrences:S.occurrences,identifier:S.identifier});if(b!==void 0){let C=b===S.identifier||!b.endsWith("_")?"_":"";S.reference=u(b,S,C)}else S.isRecursive&&(S.reference=u(`${S.ast._tag}_`,S,""))}return{representations:ar(e,h=>y(h)),references:r};function u(h,S,b="_"){let C=h,_=0;for(;n.has(C);){if(n.get(C)===S)return C;C=`${h}${b}${++_}`}return n.set(C,S),C}function f(h,S,b){let C=S.fallback;return C!==void 0?Dw(h)===C?h:is(h,{[au]:C}):b===S.identifier?h:is(h,{identifier:b})}function p(h,S){if(!Object.hasOwn(r,h)&&!o.has(h)){o.add(h);let b=E(S);o.delete(h),z(r,h,b)}return{_tag:"Reference",$ref:h}}function d(h){let S=il(h),b=al(S),C=Gf(S),_=C===void 0?(S!==h?Gf(h):void 0)??Dw(S):void 0;_!==void 0&&(C=`${_}Encoded`);let $=s.get(b);$===void 0&&($=new Map,s.set(b,$));let H=$.get(C);return H===void 0&&(H={ast:b,identifier:C,fallback:_,occurrences:0,isRecursive:!1,reference:void 0},$.set(C,H)),H}function m(h){let S=d(h),b=S.ast;if(S.occurrences++,a.has(S)){S.isRecursive=!0;return}if(!(S.occurrences>1)){switch(a.add(S),x(b.checks),b._tag){case"Declaration":case"Arrays":case"Objects":case"Union":b.recur(C=>(m(C),C));break;case"TemplateLiteral":b.parts.forEach(m);break;case"Suspend":m(b.thunk());break}a.delete(S)}}function x(h){h?.forEach(S=>{S.annotations?.representation?.schemas?.forEach(b=>m(zt(b))),S._tag==="FilterGroup"&&x(S.checks)})}function y(h){let S=d(h),b=S.ast,C=S.reference;if(C!==void 0){let _=S.identifier===void 0?b:f(b,S,C);return p(C,_)}return E(b)}function E(h){let S=w(h.checks);switch(h._tag){case"Declaration":return{_tag:"Declaration",typeParameters:h.typeParameters.map(b=>y(b)),checks:S,...M(h.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:h._tag,checks:S,...ds(h.annotations)};case"Literal":return{_tag:"Literal",literal:h.literal,checks:S,...ds(h.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:h.symbol,checks:S,...ds(h.annotations)};case"Enum":return{_tag:"Enum",enums:h.enums,checks:S,...ds(h.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:h.parts.map(b=>y(b)),checks:S,...ds(h.annotations)};case"Arrays":return{_tag:"Arrays",elements:h.elements.map(b=>{let C=il(b),_=C.context?.annotations;return{isOptional:Or(C),type:y(b),...ds(_)}}),rest:h.rest.map(b=>y(b)),checks:S,...ds(h.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:h.propertySignatures.map(b=>{let C=il(b.type),_=C.context?.annotations;return{name:b.name,type:y(b.type),isOptional:Or(C),isMutable:Z2(C),...ds(_)}}),indexSignatures:h.indexSignatures.map(b=>({parameter:y(b.parameter),type:y(b.type)})),checks:S,...ds(h.annotations)};case"Union":return{_tag:"Union",types:h.types.map(b=>y(b)),...h.options===void 0?{}:{options:h.options},checks:S,...ds(h.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:y(h.thunk()),...ds(h.annotations)}}}function w(h){return h?.map(T)??[]}function T(h){switch(h._tag){case"Filter":return{_tag:"Filter",aborted:h.aborted,...P(h.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:ar(h.checks,T),...P(h.annotations)}}}function M(h){if(h===void 0)return;let{representation:S,...b}=h;return{...S===void 0?void 0:{representation:S},...Object.keys(b).length===0?void 0:{annotations:b}}}function P(h){if(h===void 0)return;let{representation:S,...b}=h,C=S===void 0?void 0:S.schemas===void 0?S:{...S,schemas:S.schemas.map(_=>y(zt(_)))};return{...C===void 0?void 0:{representation:C},...Object.keys(b).length===0?void 0:{annotations:b}}}}function kj(e){return et(e)?e.value:{issues:[{message:hM(e.cause)}]}}function vj(e,t){let r=Ut(e),n={errors:"all",...t?.parseOptions},o=KU(t),s=a=>{let i=new Tc("sync"),c=Yo(Fi(r(a,n),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:i});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?kj(u):new Promise(f=>{c.addObserver(p=>{f(kj(p))})})};if(Object.hasOwn(e,"~standard")){let a=e;return"validate"in a["~standard"]||Object.assign(a["~standard"],{validate:s}),a}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function wee(e){let t=Cm(gl(e));return IS(t)}function Aj(e,t){let r=wee(e);if(t==="draft-2020-12"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t==="draft-07"){let n=aj(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function Oj(e){let t={input(r){return Aj(e.ast,r.target)},output(r){return Aj(zt(e.ast),r.target)}};if(Object.hasOwn(e,"~standard")){let r=e;return"jsonSchema"in r["~standard"]||Object.assign(r["~standard"],{jsonSchema:t}),r}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function Pj(e,t){let r=[];return iA(e,t,"",r),r}function iA(e,t,r,n){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)iA(e[i],t[i],`${r}/${i}`,n);for(let i=o-1;i>=s;i--)n.push({op:"remove",path:`${r}/${i}`});for(let i=o;i<s;i++)n.push({op:"add",path:`${r}/${i}`,value:t[i]});return}if(CS(e)&&CS(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${r}/${Yk(i)}`,u=Object.hasOwn(e,i),f=Object.hasOwn(t,i);u&&f?iA(e[i],t[i],c,n):!u&&f?n.push({op:"add",path:c,value:t[i]}):n.push({op:"remove",path:c})}return}n.push({op:"replace",path:r,value:t})}}function Fj(e,t){let r=t;for(let n of e)r=Aee(r,n);return r}function CS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kee(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Sm)}function Rj(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function Aee(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=vee(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let a=n==="-"?o.length:Rj(n),i=t.op==="add"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(a,0,t.value):t.op==="remove"?c.splice(a,1):c[a]=t.value,_j(s,c)}if(CS(o)){if(t.op!=="add"&&!Object.hasOwn(o,n))throw new Error(`Property "${n}" does not exist at "${t.path}".`);let a={...o};return t.op==="remove"?delete a[n]:z(a,n,t.value),_j(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function vee(e,t){let r=kee(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let a=0;a<r.length-1;a++){let i=r[a];if(Array.isArray(s)){let c=Rj(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(CS(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:n}}function _j(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let a=o.slice();a[s]=r,r=a}else{let a={...o};z(a,s,r),r=a}}return r}function $j(e){let t=xS(e),r=mS(t),n=dS(t);return{empty:[],diff:(o,s)=>Pj(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=Fj(s,a);return Object.is(i,a)?o:n(i)}}}function Nj(e,t){let r=Gf(e.ast)??Lw(e.ast),n=WB(SS(e));return o=>n(o).pipe(F(s=>_ee(s,{rootName:r,...t})))}function _ee(e,t){let r=t.rootName??"root",n=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",a=t.sortKeys??!0,i=new Set,c=[];return f(r,e,0),c.join(o?`
|
|
34
|
+
`:"");function u(p,d){c.push(o?s.repeat(p)+d:d)}function f(p,d,m,x){let{attrs:y,safe:E}=xl.tagInfo(p,x);if(d===void 0)u(m,`<${E}${y}/>`);else if(typeof d=="string")u(m,`<${E}${y}>${xl.escapeText(d)}</${E}>`);else if(typeof d!="object"||d===null)u(m,`<${E}${y}>${xl.escapeText(j(d))}</${E}>`);else{if(i.has(d))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:d});i.add(d);try{if(globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${E}${y}/>`);return}u(m,`<${E}${y}>`);for(let M of d)f(n,M,m+1);u(m,`</${E}>`);return}let w=d,T=Object.keys(w);if(a&&T.sort(),T.length===0){u(m,`<${E}${y}/>`);return}u(m,`<${E}${y}>`);for(let M of T)f(xl.parseTagName(M).safe,w[M],m+1,M);u(m,`</${E}>`)}finally{i.delete(d)}}}}var xl={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r="_"+r),r=r.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(r)&&(r="_"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=xl.parseTagName(e),s=r||t&&t!==e?` data-name="${xl.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var cA=No(e=>Zi(e));function Zi(e){let t=za(e)?.toEquivalence;if(t)return t(ol(e)?e.typeParameters.map(Zi):[]);switch(e._tag){case"Never":return Xu();case"Declaration":return Fee(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return Z;case"Arrays":{let r=e.elements.map(Zi),n=e.rest.map(Zi),[o,...s]=n,a=s.length;return Ur((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let u=i.length;if(u!==c.length)return!1;let f=0;for(;f<Math.min(u,e.elements.length);f++)if(!r[f](i[f],c[f]))return!1;if(n.length>0){for(;f<u-a;f++)if(!o(i[f],c[f]))return!1;for(let p=0;p<a;p++)if(!s[p](i[f+p],c[f+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Z;let r=e.propertySignatures.map(o=>Zi(o.type)),n=e.indexSignatures.map(o=>Zi(o.type));return Ur((o,s)=>{if(!Dn(o)||!Dn(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,u=Object.hasOwn(o,c),f=Object.hasOwn(s,c);if(Or(i.type)&&u!==f||u&&f&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=Hi(o,i.parameter),u=Hi(s,i.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let p=c[f];if(!Object.hasOwn(s,p)||!n[a](o[p],s[p]))return!1}}return!0})}case"Union":{let r=zt(e).types,n=nm(r),o=r.map((s,a)=>[ym(s),Zi(e.types[a])]);return Ur((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[u,f]=o[i[c]];if(u(s)&&u(a))return f(s,a)}return!1})}case"Suspend":{let r;return Ur((n,o)=>(r??=cA(e.thunk()))(n,o))}}}function Fee(e){let t=e.annotations?.representation;if(t===void 0)return Z;switch(t.id){case"effect/schema/Option":{let[r]=Cu(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Cu(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?r(o.success,s.success):n(o.failure,s.failure))}case"effect/schema/CauseReason":{let[r,n]=Cu(e);return Dj(r,n)}case"effect/schema/Cause":{let[r,n]=Cu(e);return Uj(r,n)}case"effect/schema/Exit":{let[r,n,o]=Cu(e),s=Uj(n,o);return(a,i)=>a._tag===i._tag&&(a._tag==="Success"?r(a.value,i.value):s(a.cause,i.cause))}case"effect/schema/ReadonlyMap":{let[r,n]=Cu(e);return wh(r,n)}case"effect/schema/ReadonlySet":return sp(Cu(e)[0]);case"effect/schema/RegExp":return(r,n)=>r.source===n.source&&r.flags===n.flags;case"effect/schema/URL":return(r,n)=>r.toString()===n.toString();default:return Z}}function Cu(e){return e.typeParameters.map(Zi)}function Dj(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case"Fail":return e(r.error,n.error);case"Die":return t(r.defect,n.defect);case"Interrupt":return r.fiberId===n.fiberId}}}function Uj(e,t){let r=Ph(Dj(e,t));return(n,o)=>r(n.reasons,o.reasons)}function Bj(e,t){return r=>{switch(r._tag){case"Fail":return`Fail(${e(r.error)})`;case"Die":return`Die(${t(r.defect)})`;case"Interrupt":return"Interrupt"}}}function Lj(e,t){let r=Bj(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function jj(e,t){let r=new Map;return n(e);function n(a){let i=r.get(a);return i===void 0&&(i=o(a),r.set(a,i)),i}function o(a){let i=za(a)?.toFormatter;if(typeof i=="function")return i(ol(a)?a.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(a,n);if(c!==void 0)return c}return s(a)}function s(a){switch(a._tag){default:return j;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let i=a.annotations?.representation;if(i===void 0)return j;let c=a.typeParameters.map(n);switch(i.id){case"effect/schema/Option":{let[u]=c;return Le({onNone:()=>"none()",onSome:f=>`some(${u(f)})`})}case"effect/schema/Result":{let[u,f]=c;return cn({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${f(p)})`})}case"effect/schema/CauseReason":return Bj(c[0],c[1]);case"effect/schema/Cause":return Lj(c[0],c[1]);case"effect/schema/Exit":{let[u,f,p]=c,d=Lj(f,p);return m=>{switch(m._tag){case"Success":return`Exit.Success(${u(m.value)})`;case"Failure":return`Exit.Failure(${d(m.cause)})`}}}case"effect/schema/ReadonlyMap":{let[u,f]=c;return p=>{let d=p.size;if(d===0)return"ReadonlyMap(0) {}";let m=globalThis.Array.from(p.entries()).sort().map(([x,y])=>`${u(x)} => ${f(y)}`);return`ReadonlyMap(${d}) { ${m.join(", ")} }`}}case"effect/schema/HashMap":{let[u,f]=c;return p=>{let d=sB(p);if(d===0)return"HashMap(0) {}";let m=dm(p).sort().map(([x,y])=>`${u(x)} => ${f(y)}`);return`HashMap(${d}) { ${m.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[u]=c;return f=>{let p=f.size;if(p===0)return"ReadonlySet(0) {}";let d=globalThis.Array.from(f.values()).sort().map(m=>`${u(m)}`);return`ReadonlySet(${p}) { ${d.join(", ")} }`}}case"effect/schema/HashSet":{let[u]=c;return f=>{let p=fB(f);if(p===0)return"HashSet(0) {}";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`HashSet(${p}) { ${d.join(", ")} }`}}case"effect/schema/Chunk":{let[u]=c;return f=>{let p=Q$(f);if(p===0)return"Chunk(0) {}";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`Chunk(${p}) { ${d.join(", ")} }`}}default:return j}}case"Arrays":{let i=a.elements.map(d=>n(d)),c=a.rest.map(n),[u,...f]=c,p=f.length;return d=>{let m=[],x=0;for(;x<i.length;x++)if(d.length<x+1){if(Or(a.elements[x]))continue}else m.push(i[x](d[x]));if(c.length>0){for(;x<d.length-p;x++)m.push(u(d[x]));for(let y=0;y<p;y++)m.push(f[y](d[x+y]))}return"["+m.join(", ")+"]"}}case"Objects":{let i=a.propertySignatures.map(u=>n(u.type)),c=a.indexSignatures.map(u=>n(u.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?j:u=>{let f=[],p=new Set;for(let d=0;d<i.length;d++){let m=a.propertySignatures[d],x=m.name;p.add(x),!(Or(m.type)&&!Object.hasOwn(u,x))&&f.push(`${Ts(x)}: ${i[d](u[x])}`)}for(let d=0;d<c.length;d++){let m=Hi(u,a.indexSignatures[d].parameter);for(let x of m)p.has(x)||(p.add(x),f.push(`${Ts(x)}: ${c[d](u[x])}`))}return f.length>0?"{ "+f.join(", ")+" }":"{}"}}case"Union":{let i=zt(a).types,c=nm(i),u=i.map((f,p)=>[ym(f),n(a.types[p])]);return f=>{let p=c(f,!1);for(let d=0;d<p.length;d++){let[m,x]=u[p[d]];if(m(f))return x(f)}return j(f)}}case"Suspend":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var uA=l(2,(e,t)=>pA(e,(r,n)=>Hj(t,r)?[r,n]:void 0)),fA=l(2,(e,t)=>pA(e,(r,n)=>Hj(t,r)?void 0:[r,n])),zj=l(2,(e,t)=>({...e,...t}));var lA=l(2,(e,t)=>pA(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var tn=e=>e;function Hj(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function pA(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,a]=o;z(r,s,a)}}return r}function Vj(e,t){return ms(yl("Iso",e,t))}function qj(e,t){return ms(yl("Lens",e,t))}function yl(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var $ee={kind:"Iso",get:D,set:D},wS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=TS(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];z(s,i,TS(s[i])),s=s[i]}return z(s,t[a],r),o}}},wm=class{_tag="CheckNode";kind="Prism";checks;get;set=D;constructor(t){this.checks=t,this.get=r=>nL(t,r)}};function wu(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?r[r.length-1]=new wS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new wm([...s.checks,...o.checks]):r.push(o)}return r}function Nee(e,t){return ms(yl("Optional",e,t))}var Sl=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Sp(this.replaceResult(t,r),()=>r)}modify(t){return r=>Sp(sr(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return ms(wu(this.node,t.node))}key(t){return ms(wu(this.node,[new wS([t])]))}optionalKey(t){return ms(wu(this.node,yl("Lens",r=>r[t],(r,n)=>{let o=TS(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&af(t))?o.splice(Number(t),1):delete o[t]:z(o,t,r),o})))}check(...t){return ms(wu(this.node,[new wm(t)]))}refine(t,r){return ms(wu(this.node,[new wm([jy(t,r)])]))}tag(t){let r=X(new he({expected:`${JSON.stringify(t)} tag`}));return ms(wu(this.node,yl("Prism",n=>n._tag===t?G(n):r,D)))}at(t,...r){let n=X(new Yt([t],new zi(void 0)));return ms(wu(this.node,yl("Optional",o=>Object.hasOwn(o,t)?G(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=TS(s);return z(a,t,o),G(a)}else return n})))}pick(t){return this.compose(qj(uA(t),(r,n)=>({...fA(n,t),...r})))}omit(t){return this.compose(qj(fA(t),(r,n)=>({...uA(n,t),...r})))}notUndefined(){return this.refine(Tt,{expected:"a value other than `undefined`"})}forEach(t){let r=t(kS());return Nee(n=>gr(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);xt(i)&&s.push(i.success)}return s}),(n,o)=>sr(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)xt(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return X(new he({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let u=a[c],f=r.replaceResult(n[c],s[u]);if(be(f))return X(new Yt([u],f.failure));i[u]=f.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Sp(sr(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},mA=class extends Sl{get;set;constructor(t,r,n){super(t,o=>G(r(o)),o=>G(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},hA=class extends Sl{get;constructor(t,r,n){super(t,o=>G(r(o)),(o,s)=>G(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},gA=class extends Sl{set;constructor(t,r,n){super(t,r,(o,s)=>G(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Sp(gr(this.getResult(r),n=>this.set(t(n))),()=>r)}};function ms(e){let t=e[0]??$ee;if(e.length>1){let r=e.reduce((n,o)=>Lee(n,o.kind),"Iso");t={kind:r,get:Uee(e,r),set:Dee(e,r)}}switch(t.kind){case"Iso":return new mA(e,t.get,t.set);case"Lens":return new hA(e,t.get,t.set);case"Prism":return new gA(e,t.get,t.set);case"Optional":return new Sl(e,t.get,t.set)}}function TS(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function Uee(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(xA(o.kind)){if(be(s))return s;r=s.success}else r=s}return xA(t)?G(r):r}}function Dee(e,t){return Wj(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=n;let i=e[a];if(xA(i.kind)){let c=i.get(n);if(be(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(Wj(i.kind))r=i.set(r);else if(i.kind==="Lens")r=i.set(r,s[a]);else{let c=i.set(r,s[a]);if(be(c))return c;r=c.success}}return t==="Optional"?G(r):r}}function xA(e){return e==="Prism"||e==="Optional"}function Wj(e){return e==="Iso"||e==="Prism"}function Lee(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var Bee=ms([]);function kS(){return Bee}function Kj(e){let t=yS(e);return Vj(mS(t),dS(t))}function Jj(e){return kS()}function Zj(e){return kS()}var El="~effect/Schema/SchemaError";function Qj(e){return O(e,El)&&e[El]===El}var oo="~effect/net/NetAddress";var hs=e=>e.value,gs=e=>e,Ja=e=>e.bytes,Fo=class extends mo("NetAddressError"){},bl=e=>O(e,oo),_r=e=>bl(e)&&e._tag==="Ipv4Address",Ro=e=>bl(e)&&e._tag==="Ipv6Address",yA=e=>_r(e)||Ro(e),Il=e=>_r(e)?32:128;var Cl=e=>bl(e)&&e._tag==="MacAddress",km=e=>bl(e)&&e._tag==="InetAddressV4",Am=e=>bl(e)&&e._tag==="InetAddressV6",SA=e=>km(e)||Am(e),AS=e=>bl(e)&&e._tag==="UnixPathAddress",Yj=e=>SA(e)||AS(e),zee={...Pt,_tag:"Ipv4Address",[oo]:oo,[ie](e){return _r(e)&&hs(this)===hs(e)},[ae](){return Er(xe(Vee,hs(this)|0))},toString(){return Pr(this)},toJSON(){return this.toString()}},Hee={...Pt,_tag:"Ipv6Address",[oo]:oo,[ie](e){if(!Ro(e))return!1;let t=gs(this),r=gs(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ae](){let e=gs(this),t=xe(Gee,e.w0|0);return t=xe(t,e.w1|0),t=xe(t,e.w2|0),Er(xe(t,e.w3|0))},toString(){return Pr(this)},toJSON(){return this.toString()}},qee={...Pt,_tag:"MacAddress",[oo]:oo,[ie](e){return Cl(e)&&Wee(Ja(this),Ja(e))},[ae](){return xe(Kee,ws(Ja(this)))},toString(){return IA(this)},toJSON(){return this.toString()}},Wee=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},Vee=De("Ipv4Address"),Gee=De("Ipv6Address"),Kee=De("MacAddress"),Jee=e=>{let t=Object.create(zee);return t.value=e>>>0,Object.freeze(t)},Zee=(e,t,r,n)=>{let o=Object.create(Hee);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},Qee=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var Tm=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],Yee=e=>{let t=Object.assign(Object.create(qee),{bytes:new Uint8Array(e)});return Object.freeze(t)};var wt=(e,t)=>X(new Fo({input:e,message:t})),Xj=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(!Number.isInteger(n)||n<0||n>t)return!1}return!0},Xee=e=>Xj(e,255)?G(Jee(Qee(e[0],e[1],e[2],e[3]))):wt(e,"octets must be integers from 0 through 255"),ete=e=>Xj(e,65535)?G(Zee(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):wt(e,"segments must be integers from 0 through 65535");var ez=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?G(Yee(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):wt(e,"expected six two-digit hexadecimal octets separated by colons");var Tu=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return wt(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return wt(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?wt(e,"octets must be at most 255"):Xee([r[0],r[1],r[2],r[3]])},tte=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return wt(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return wt(e,"only one compression marker is allowed");let r=t[0]===""?[]:t[0].split(":"),n=t.length===2&&t[1]!==""?t[1].split(":"):[];if(r.some(f=>f==="")||n.some(f=>f===""))return wt(e,"empty segments are only valid in the compression marker");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:"",s;if(o.includes(".")){if(t.length===2&&n.length===0)return wt(e,"embedded IPv4 syntax must be trailing");let f=gr(Tu(o),p=>{let d=hs(p);return[d>>>16,d&65535]});if(be(f))return f;s=f.success,n.length>0?n.pop():r.pop()}let a=r.length+n.length+(s?2:0);if(t.length===1?a!==8:a>=8)return wt(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let i=f=>/^[0-9a-fA-F]{1,4}$/.test(f)?Number.parseInt(f,16):void 0,c=r.map(i),u=n.map(i);return c.some(f=>f===void 0)||u.some(f=>f===void 0)?wt(e,"segments must contain one through four hexadecimal digits"):G([...c,...Array(8-a).fill(0),...u,...s??[]])},ku=e=>sr(tte(e),t=>ete(t)),Qi=e=>e.includes(":")?ku(e):Tu(e);var EA=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=vm(e);return xt(t)&&t.success===e},vm=e=>{let t=e.indexOf("%");if(t===-1)return wt(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return wt(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return wt(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return gr(ku(e.slice(0,t)),n=>`${Pr(n)}%${r}`)};var vS=e=>Tm(hs(e)),rte=e=>{let{w0:t,w1:r,w2:n,w3:o}=gs(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},bA=e=>{let{w0:t,w1:r,w2:n,w3:o}=gs(e);return[...Tm(t),...Tm(r),...Tm(n),...Tm(o)]};var IA=e=>Array.from(Ja(e),t=>t.toString(16).padStart(2,"0")).join(":"),OS=e=>Ja(e).every(t=>t===255),nte=e=>(Ja(e)[0]&1)!==0,_S=e=>(Ja(e)[0]&1)===0,CA=e=>(Ja(e)[0]&2)!==0,wA=e=>(Ja(e)[0]&2)===0;var Pr=e=>{if(_r(e))return vS(e).join(".");let t=rte(e);if(ote(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let i=0;i<=8;i++)i<8&&t[i]===0?o===-1&&(o=i):o!==-1&&(i-o>n&&(r=o,n=i-o),o=-1);if(n<2)return t.map(i=>i.toString(16)).join(":");let s=t.slice(0,r).map(i=>i.toString(16)).join(":"),a=t.slice(r+n).map(i=>i.toString(16)).join(":");return`${s}::${a}`},PS=e=>{if(_r(e))return hs(e)===0;let{w0:t,w1:r,w2:n,w3:o}=gs(e);return t===0&&r===0&&n===0&&o===0},TA=e=>{if(_r(e))return hs(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=gs(e);return t===0&&r===0&&n===0&&o===1},wl=e=>Cl(e)?nte(e):_r(e)?hs(e)>>>28===14:gs(e).w0>>>24===255,FS=e=>Cl(e)?OS(e):hs(e)===4294967295,kA=e=>Cl(e)?_S(e):!wl(e)&&!PS(e)&&(!_r(e)||!FS(e)),AA=e=>_r(e)?hs(e)>>>16===43518:(gs(e).w0>>>16&65472)===65152,vA=e=>{let t=hs(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},OA=e=>(gs(e).w0>>>24&254)===252,ote=e=>{let{w0:t,w1:r,w2:n}=gs(e);return t===0&&r===0&&n===65535};var ste={...Pt,_tag:"InetAddressV4",[oo]:oo,[ie](e){return km(e)&&this.port===e.port&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.port))},toString(){return RS(this)},toJSON(){return this.toString()}},ate={...Pt,_tag:"InetAddressV6",[oo]:oo,[ie](e){return Am(e)&&this.port===e.port&&this.scopeId===e.scopeId&&Z(this.address,e.address)},[ae](){return xe(xe(Y(this.address),Wt(this.port)),Wt(this.scopeId))},toString(){return RS(this)},toJSON(){return this.toString()}},tz=e=>Number.isInteger(e)&&e>=0&&e<=65535,ite=(e,t)=>{if(!tz(t))return wt(e,"port must be an integer from 0 through 65535");let r=Object.create(ste);return r.address=e,r.port=t,G(Object.freeze(r))},cte=(e,t,r)=>{if(!tz(t))return wt(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return wt(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(ate);return o.address=e,o.port=t,o.scopeId=n,G(Object.freeze(o))};var _A=e=>{let t,r,n=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return wt(e,"expected [IPv6]:port");t=e.slice(1,s),r=e.slice(s+2);let a=t.indexOf("%");if(a!==-1){let i=t.slice(a+1);if(t.indexOf("%",a+1)!==-1||!/^\d+$/.test(i))return wt(e,"scope identifier must be decimal");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return wt(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,a)}}else{let s=e.lastIndexOf(":");if(s<0)return wt(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return wt(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?sr(Qi(t),s=>o!==Ro(s)?wt(e,"only IPv6 addresses use brackets"):Ro(s)?cte(s,Number(r),{scopeId:n}):ite(s,Number(r))):wt(e,"port must be an unpadded decimal integer")};var ute=e=>Pr(e.address)+(Am(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var RS=e=>{let t=ute(e);return km(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var fte={...Pt,_tag:"UnixPathAddress",[oo]:oo,[ie](e){return AS(e)&&this.path===e.path},[ae](){return xe(De("UnixPathAddress"),De(this.path))},toString(){return this.path},toJSON(){return this.toString()}},rz=e=>{let t=Object.create(fte);return t.path=e,Object.freeze(t)};var PA="~effect/net/Host",Yi=(e,t)=>X(new Fo({input:e,message:t})),lte=/^[a-z0-9_.-]$/i,pte=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,dte=/^(?:\d+|0x[0-9a-f]*)$/,nz=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let r=t.split(".");for(let n of r){if(n.length===0)return"domain name labels must not be empty";if(n.length>63)return"domain name labels must be at most 63 characters";if(!pte.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(dte.test(r[r.length-1]))return"the last domain name label must not be numeric"},mte=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!lte.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},Za=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&nz(e)===void 0;var RA=e=>O(e,PA),MS=e=>{let t=mte(e);if(t===void 0)return Yi(e,"invalid domain name");let r=nz(t);return r===void 0?G(t):Yi(e,r)};var hte=e=>{if(e.includes("%"))return vm(e);if(e.includes(":"))return Qi(e);if(/^[\d.]+$/.test(e)){let t=Qi(e);if(xt(t))return t}return MS(e)};var gte=e=>typeof e=="string"?e:Pr(e);var xte={...Pt,_tag:"HostPort",[PA]:PA,[ie](e){return RA(e)&&this.port===e.port&&Z(this.host,e.host)},[ae](){return xe(Y(this.host),Wt(this.port))},toString(){return MA(this)},toJSON(){return this.toString()}},yte=e=>Number.isInteger(e)&&e>=0&&e<=65535,Ste=(e,t)=>{let r=Object.create(xte);return r.host=e,r.port=t,Object.freeze(r)};var oz=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return Yi(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return Yi(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return Yi(e,"expected host:port");if(e.indexOf(":")!==o)return Yi(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return Yi(e,"port must be an unpadded decimal integer");let n=Number(r);return yte(n)?gr(hte(t),o=>Ste(o,n)):Yi(e,"port must be an integer from 0 through 65535")};var MA=e=>{let t=gte(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var NA="~effect/net/Dns/DnsRecord",$A=e=>Number.isInteger(e)&&e>=0&&e<=255,Tl=e=>Number.isInteger(e)&&e>=0&&e<=65535,iz=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,Xi=e=>typeof e=="string",$S=e=>Cp(e)&&Rs(e)&&iz(Ms(e)),cz={A:{address:_r},AAAA:{address:Ro},CAA:{critical:e=>typeof e=="boolean",tag:e=>Xi(e)&&/^[a-z0-9]+$/i.test(e),value:Xi},CNAME:{target:Za},MX:{exchange:Za,priority:Tl},NAPTR:{order:Tl,preference:Tl,flags:Xi,service:Xi,regexp:Xi,replacement:Za},NS:{host:Za},PTR:{host:e=>Xi(e)&&e.length>0},SOA:{primary:Za,admin:e=>Xi(e)&&e.length>0,serial:iz,refresh:$S,retry:$S,expire:$S,minimum:$S},SRV:{target:Za,port:Tl,priority:Tl,weight:Tl},TLSA:{certUsage:$A,selector:$A,matchingType:$A,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(Xi)}},UA=Object.keys(cz),Ete=e=>UA.includes(e),DA=e=>O(e,NA),bte={...Pt,[NA]:NA,[ie](e){return DA(e)&&e._tag===this._tag&&Object.keys(this).every(t=>Z(this[t],e[t]))},[ae](){return np(this,Object.keys(this))},toString(){return Cte(this)},toJSON(){return{...this}}},uz=(e,t)=>{if(!Ete(e))return X(new Fo({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(bte);n._tag=e;for(let[o,s]of Object.entries(cz[e])){let a=r[o];if(!s(a))return X(new Fo({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(a)?Object.freeze([...a]):a instanceof Uint8Array?new Uint8Array(a):a}return G(Object.freeze(n))};var fz=new TextEncoder,lz=e=>`\\${e.toString().padStart(3,"0")}`,_m=e=>{let t='"';for(let r of fz.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?lz(r):String.fromCharCode(r);return t+'"'},Ite=[34,36,40,41,59,64],az=e=>{let t=fz.encode(e),r="";for(let n=0;n<t.length;n++){let o=t[n];if(o===92){let s=t[n+1];s===46||s===92?(r+=`\\${String.fromCharCode(s)}`,n++):r+="\\\\"}else o<=32||o>126?r+=lz(o):r+=Ite.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},Cte=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Pr(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${_m(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${_m(e.flags)} ${_m(e.service)} ${_m(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${az(e.host)}`;case"SOA":return`SOA ${e.primary} ${az(e.admin)} ${e.serial} ${Ms(e.refresh)} ${Ms(e.retry)} ${Ms(e.expire)} ${Ms(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${cg(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(_m).join(" ")}`}};var LA="~effect/net/IpInterface",pz=e=>Pm(e)&&_r(e.address),dz=e=>Pm(e)&&Ro(e.address),Pm=e=>O(e,LA),Ate={...Pt,_tag:"IpInterface",[LA]:LA,[ie](e){return Pm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.prefixLength))},toString(){return Rm(this)},toJSON(){return this.toString()}},BA=(e,t)=>X(new Fo({input:e,message:t})),Fm=(e,t)=>{let r=Il(e);if(!Number.isInteger(t)||t<0||t>r)return BA(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(Ate),{address:e,prefixLength:t});return G(Object.freeze(n))},jA=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return G({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return BA(e,"expected an address and prefix length separated by one slash");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?G({address:e.slice(0,r),prefixLength:Number(n)}):BA(e,"prefix length must be an unpadded ASCII decimal integer")},NS=(e,t)=>sr(jA(e,t),r=>sr(Tu(r.address),n=>Fm(n,r.prefixLength??Il(n)))),US=(e,t)=>sr(jA(e,t),r=>sr(ku(r.address),n=>Fm(n,r.prefixLength??Il(n)))),DS=(e,t)=>sr(jA(e,t),r=>sr(Qi(r.address),n=>Fm(n,r.prefixLength??Il(n))));var Rm=e=>`${Pr(e.address)}/${e.prefixLength}`;var zA="~effect/net/IpNetwork",hz=e=>Mm(e)&&_r(e.address),gz=e=>Mm(e)&&Ro(e.address),Mm=e=>O(e,zA),vte={...Pt,_tag:"IpNetwork",[zA]:zA,[ie](e){return Mm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ae](){return xe(Y(this.address),Wt(this.prefixLength))},toString(){return $m(this)},toJSON(){return this.toString()}},Ote=e=>{let t=Object.assign(Object.create(vte),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},_te=e=>_r(e)?vS(e):bA(e);var Pte=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},HA=(e,t)=>sr(Fm(e,t),r=>{let n=_te(e),o=Pte(n,t);return n.some((s,a)=>s!==o[a])?X(new Fo({input:e,message:"address has non-zero host bits"})):G(Ote(r))});var xz=e=>sr(NS(e,{prefix:"required"}),t=>HA(t.address,t.prefixLength)),yz=e=>sr(US(e,{prefix:"required"}),t=>HA(t.address,t.prefixLength)),Sz=e=>sr(DS(e,{prefix:"required"}),t=>HA(t.address,t.prefixLength));var $m=e=>`${Pr(e.address)}/${e.prefixLength}`;var Nm=gS;function An(){return(e,t,r)=>te(new sl(e.map(rm),n=>t(n.map(o=>te(o))),r))}function Ve(e,t){return An()([],()=>(r,n,o)=>e(r)?g(r):k(new $t(n,r,o)),t)}function Rte(e){return e}function Mte(e){return t=>t.annotate(e)}function $te(e){return t=>WA(WA(t).annotate(e))}function Nte(e){return t=>t.rebuild(am(t.ast,e))}function Ute(e){return e}var vu=class extends mo("SchemaError"){[El]=El;constructor(t){let r=Do();br(0);try{super({issue:t})}finally{br(r)}}get message(){return JU(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[ot](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function Rz(e){return Qj(e)}function Mz(e){return je(e)?ZA(e):Ct(e,t=>Oa(()=>wi(t,r=>new vu(r))))}function ZA(e){return et(e)?e:Vn(wi(e.cause,t=>new vu(t)))}function $z(e,t){let r;for(let n of e.reasons){if(!Gg(n)||!Rz(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function Nz(e){return wx(e).then(t=>{if(et(t))return t.value;throw $z(t.cause,"Promise adapter can only reject schema errors")})}function Uz(e){let t=Vs(e);if(et(t))return t.value;throw $z(t.cause,"Sync adapter can only throw schema errors")}function Dte(e,t){return vj(e,t)}function Lte(e){return Oj(e)}var BS=qk,Bte=jB;function Xa(e,t){let r=Ut(e,t);return(n,o)=>Mz(r(n,o))}var jte=Xa;function Dz(e,t){let r=zB(e,t);return(n,o)=>ZA(r(n,o))}var zte=Dz,Hte=Vk,qte=HB;function Lz(e,t){let r=qB(e,t);return(n,o)=>Kh(r(n,o),s=>new vu(s))}var Wte=Lz;function Bz(e,t){let r=Xa(e,t);return(n,o)=>Nz(r(n,o))}var Vte=Bz;function jz(e,t){let r=Xa(e,t);return(n,o)=>Uz(r(n,o))}var Gte=jz;function jS(e,t){let r=bu(e,t);return(n,o)=>Mz(r(n,o))}var Kte=jS;function zz(e,t){let r=VB(e,t);return(n,o)=>ZA(r(n,o))}var Jte=zz,Zte=Gk,Qte=GB;function Hz(e,t){let r=KB(e,t);return(n,o)=>Kh(r(n,o),s=>new vu(s))}var Yte=Hz;function qz(e,t){let r=jS(e,t);return(n,o)=>Nz(r(n,o))}var Xte=qz;function Wz(e,t){let r=jS(e,t);return(n,o)=>Uz(r(n,o))}var ere=Wz,te=ps;function zS(e){return O(e,Nm)&&e[Nm]===Nm}var Qa=tn(e=>te(du(e.ast),{schema:e})),tre=tn(e=>e.schema),ei=tn(e=>{let t=GS(e);return te(G2(e.ast),{schema:t})}),rre=tn(e=>e.schema.members[0]),nre=tn(e=>te(UT(e.ast),{schema:e})),ore=tn(e=>e.schema),vn=tn(e=>te(zt(e.ast),{schema:e})),_l=tn(e=>te(cs(e.ast),{schema:e})),Um="~effect/Schema/flip";function sre(e){return O(e,Um)&&e[Um]===Um}function WA(e){return sre(e)?e.schema.rebuild(to(e.ast)):te(to(e.ast),{[Um]:Um,schema:e})}function Ht(e){let t=te(new eo(e),{literal:e,transform(r){return t.pipe(se(Ht(r),{decode:Ee(()=>r),encode:Ee(()=>e)}))}});return t}function Vz(e){return e.map(t=>zS(t)?t.ast:new eo(t))}function are(e){return te(new TT(Vz(e)),{parts:e})}function ire(e){return te(k2(Vz(e)),{parts:e})}function cre(e){return te(new T2(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var ure=te(wT),fre=te(C2),Dm=te(qa),HS=te(IT),QA=te(CT),B=te(Xn),lre=B,Lm=te(kT),qS=te(O2),Gz=te(_2),Pl=te(P2),pre=te(I2),dre=te(w2);function mre(e){return te(new v2(e))}function YA(e,t){return te(e,{fields:t,mapFields(r,n){let o=r(this.fields);return YA(Dy(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function He(e){return YA(Dy(e,void 0),e)}function hre(e){return tn(t=>t.mapFields(zj(e)))}var gre=e=>typeof e=="symbol"?e:globalThis.String(e);function xre(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=_l(t.fields[a]),c=Object.hasOwn(e,a),u=c?e[a]:a,f=gre(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${Ts(u)}`);s.add(f),z(r,u,i),c&&(n[a]=u,o[u]=a)}return He(r).pipe(se(t,Ne({decode:lA(o),encode:lA(n)})))}}function yre(e,t){return r=>{let n=Jh(r.fields,vn),o=He({...n,...e});return r.pipe(se(o,Ne({decode:s=>{let a={...s};for(let i in e){let c=t[i],u=c(s);fe(u)&&z(a,i,u.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function Ou(e,t){return te(J2(e.ast,t.ast),{key:e,value:t})}function Sre(e,t){return te(N2(e.ast,t.map(rm)),{schema:e,records:t})}function Kz(e,t){return te(e,{elements:t,mapElements(r,n){let o=r(this.elements);return Kz(_T(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function aa(e){return Kz(_T(e),e)}function Ere(e,t){return te(U2(e.ast,t.map(rm)),{schema:e,rest:t})}var Pe=tn(e=>te(new _o(!1,[],[e.ast]),{value:e}));function WS(e,t,r){return t!==void 0&&r!==void 0?e.check(ov(t,r)):t!==void 0?e.check(lH(t)):r!==void 0?e.check(mH(r)):e}var VS=tn(e=>te(new _o(!1,[e.ast],[e.ast]),{value:e}));function bre(e){let t=Pe(e),r=Pe(vn(e)),n=se(aa([Dm]),Ne({decode:o=>[o],encode:([o])=>o}))(e);return te(ht([n,t]).pipe(se(r)).ast,{from:ht([e,t]),to:r})}function Ire(e){return Pe(e).check(av())}var Cre=tn(e=>te(D2(e.ast),{schema:e}));function Jz(e,t){return te(e,{members:t,mapMembers(r,n){let o=r(this.members);return Jz(Ly(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function ht(e,t){return Jz(Ly(e,t,void 0),e)}function ti(e){let t=e.map(Ht);return te(Ly(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return ht(r(this.members))},pick(r){return ti(r)},transform(r){return ht(t.map((n,o)=>n.transform(r[o])))}})}var XA=tn(e=>ht([e,HS])),GS=tn(e=>ht([e,QA])),Zz=tn(e=>ht([e,HS,QA]));function Qz(e){return te(new FT(()=>e().ast))}function wre(...e){return t=>t.check(...e)}function Yz(e,t){return r=>te(na(r.ast,[jy(e,t)]),{schema:r})}function KS(e){return t=>te(t.ast,{schema:t,identifier:e})}function Tre(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(KS(e))}function Xz(e){return t=>te(W2(t.ast,new Oy(e,D)),{schema:t})}function eH(e){return t=>te(V2(t.ast,new Oy(D,e)),{schema:t})}function kre(e){return tH(e)}function tH(e){return t=>Xz(hd(e))(t)}function Are(e){return rH(e)}function rH(e){return t=>eH(hd(e))(t)}function se(e,t){return r=>te(ul(r.ast,e.ast,t?_y(t):Yf()),{from:r,to:e})}function Fl(){return(e,t)=>Fe()(e,{decode:t,encode:hD})}var JS=ti(["true","yes","on","1","y"]),ZS=ti(["false","no","off","0","n"]),ev=ti([...JS.literals,...ZS.literals]).pipe(se(qS,Ne({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function vre(e){return t=>se(vn(t),e)(t)}function tv(e,t){return r=>t?se(r,t)(e):se(r)(e)}function Ore(e){return t=>se(t,e)(_l(t))}function nH(e){return t=>te(K2(t.ast,e),{schema:t})}function oH(e){return je(e)&&e._tag==="Success"?e:Ct(e,t=>Oa(()=>wi(t,r=>r.issue)))}function rv(e,t){let r=t?.encodingStrategy==="omit"?eT():ea();return n=>Qa(_l(n)).pipe(se(n,{decode:tT(oH(e)),encode:r}))}function _re(e,t){return r=>vn(r).pipe(rv(e,t),tv(Qa(r)))}function sH(e,t){let r=t?.encodingStrategy==="omit"?eT():ea();return n=>ei(_l(n)).pipe(se(n,{decode:tT(oH(e)),encode:r}))}function Pre(e,t){return r=>vn(r).pipe(sH(e,t),tv(ei(r)))}function Ya(e){return Ht(e).pipe(nH(g(e)))}function Fre(e){return Ya(e).pipe(rv(g(e),{encodingStrategy:"omit"}))}function Bm(e,t){return He({_tag:Ya(e),...t})}function aH(e){return t=>{let r={},n=[],o=new Set,s={},a=f=>p=>f.includes(p[e]);return i(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:u});function i(f){let p=f.ast;if(S2(p)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(zS))return f.members.forEach(i);let d=rl(p);if(d.length>0){let m=d.find(x=>x.key===e)?.literal;if(bh(m)){let x=typeof m=="number"?globalThis.String(m):m;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(x),n.push(m),z(r,m,f),z(s,m,qk(vn(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let x=arguments[0];return function(y){let E=y[e];return(Object.hasOwn(x,E)?x[E]:void 0)(y)}}let f=arguments[0],p=arguments[1],d=f[e];return(Object.hasOwn(p,d)?p[d]:void 0)(f)}function u(){if(arguments.length===2){let y=arguments[0],E=arguments[1];return function(w){let T=w[e];return(Object.hasOwn(y,T)?y[T]??E:E)(w)}}let f=arguments[0],p=arguments[1],d=arguments[2],m=f[e];return(Object.hasOwn(p,m)?p[m]??d:d)(f)}}}function Rre(e){let t={},r=[];for(let u of Object.keys(e)){let f=Bm(u,e[u]);z(t,u,f),r.push(f)}let n=ht(r),{tag:o,guards:s,isAnyOf:a,match:i,matchOrElse:c}=aH("_tag")(n);return te(n.ast,{tag:o,cases:t,isAnyOf:a,guards:s,match:i,matchOrElse:c})}function Mre(){return e=>e}function ec(e,t){return Ve(r=>r instanceof e,t)}function Fe(){return(e,t)=>new Ot(e.ast,_y(t))}var Ue=By;function $re(e,t=void 0){return new uu(e,t)}var Ez="^\\S[\\s\\S]*\\S$|^\\S$|^$";function iH(e){let t=new globalThis.RegExp(Ez);return Ue(r=>r.trim()===r,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitraryConstraint:{patterns:[{source:Ez,flags:""}]},...e})}function _u(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${j(r)})`:`new RegExp(${j(r)}, ${j(n)})`;return om(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function Nre(e){return BT({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function Ure(e){return jT({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function Dre(e){return HT({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var Lre=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function Bre(e,t){let r=Lre(e);return _u(r,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var bz=/^([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})$/;function jre(e){return _u(bz,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:bz.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function zre(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return _u(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function cH(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return _u(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function Hre(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return _u(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function nv(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function qre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${Ka(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return Ue(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>nv(o,e,`^${Ka(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function Wre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${Ka(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return Ue(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>nv(o,e,`${Ka(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function Vre(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(Ka(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return Ue(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>nv(o,e,Ka(o)),toCode:()=>({runtime:`Schema.isIncluding(${j(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var Iz="^[^a-z]*$";function Gre(e){let t=new globalThis.RegExp(Iz);return Ue(r=>r.toUpperCase()===r,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:Iz,flags:""}]},...e})}var Cz="^[^A-Z]*$";function Kre(e){let t=new globalThis.RegExp(Cz);return Ue(r=>r.toLowerCase()===r,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:Cz,flags:""}]},...e})}var wz="^(?:[^a-z][\\s\\S]*)?$";function Jre(e){let t=new globalThis.RegExp(wz);return Ue(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:wz,flags:""}]},...e})}var Tz="^(?:[^A-Z][\\s\\S]*)?$";function Zre(e){let t=new globalThis.RegExp(Tz);return Ue(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:Tz,flags:""}]},...e})}var Rl=te(MT),Qre=RT;function jm(e){let t=of(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function zm(e){let t=zh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function Hm(e){let t=Bh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function qm(e){let t=jh(e.order),r=e.formatter??j;return(n,o)=>Ue(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function Wm(e){let t=zh(e.order),r=of(e.order),n=jh(e.order),o=Bh(e.order),s=e.formatter??j;return(a,i)=>{let c=a.exclusiveMinimum?r:t,u=a.exclusiveMaximum?o:n;return Ue(f=>c(f,a.minimum)&&u(f,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?" (excluded)":""} and ${s(a.maximum)}${a.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(a),...i})}}function Yre(e){return(t,r)=>{let n=e.formatter??j;return Ue(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function Al(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${j(e)}`);return e}var Xre=jm({order:ha,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Al(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${j(e)})`})})}),uH=zm({order:ha,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Al(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${j(e)})`})})}),ene=Hm({order:ha,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Al(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${j(e)})`})})}),tne=qm({order:ha,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Al(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${j(e)})`})})}),tc=Wm({order:ha,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Al(e.minimum),maximum:Al(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}});function rne(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Ue(r=>e$(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${j(e)})`}),...t})}function QS(e){return Ue(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var On=Lm.check(QS()),Au=On.check(uH(0));function nne(e){return new uu([QS(),tc({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function one(e){return new uu([QS(),tc({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function vl(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${j(e)}`);return e.toISOString()}function Ol(e){return`new Date(${j(e.getTime())})`}var sne=jm({order:nf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:vl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${Ol(e)})`})})}),ane=zm({order:nf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:vl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Ol(e)})`})})}),ine=Hm({order:nf,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:vl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${Ol(e)})`})})}),cne=qm({order:nf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:vl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Ol(e)})`})})}),une=Wm({order:nf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:vl(e.minimum),maximum:vl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Ol(e.minimum)}, maximum: ${Ol(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}}),fne=jm({order:rf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${j(e)})`})})}),fH=zm({order:rf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${j(e)})`})})}),lne=Hm({order:rf,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${j(e)})`})})}),pne=qm({order:rf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${j(e)})`})})}),dne=Wm({order:rf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(r)} })`})}}});function lH(e,t){return e=rn(e),pH(e,Math.ceil(e/2),t)}function pH(e,t,r){return Ue(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:n==="array"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Cn]:!0,arbitraryConstraint:{minLength:e},...r})}function dH(e){return pH(1,1,e)}function mH(e,t){return e=rn(e),Ue(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:r==="array"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Cn]:!0,arbitraryConstraint:{maxLength:e},...t})}function ov(e,t,r){return e=rn(e),t=rn(t),Ue(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n==="array"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function mne(e,t){return e=rn(e),Ue(r=>sv(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function hne(e,t){return e=rn(e),Ue(r=>sv(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function gne(e,t,r){return e=rn(e),t=rn(t),Ue(n=>{let o=sv(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function sv(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function rn(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function xne(e,t){return e=rn(e),Ue(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Cn]:!0,arbitraryConstraint:{minSize:e},...t})}function yne(e,t){return e=rn(e),Ue(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Cn]:!0,arbitraryConstraint:{maxSize:e},...t})}function Sne(e,t,r){return e=rn(e),t=rn(t),Ue(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function Ene(e,t){return e=rn(e),Ue(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Cn]:!0,arbitraryConstraint:{minProperties:e},...t})}function bne(e,t){return e=rn(e),Ue(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Cn]:!0,arbitraryConstraint:{maxProperties:e},...t})}function Ine(e,t,r){return e=rn(e),t=rn(t),Ue(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[Cn]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function Cne(e,t){let r=_l(e),n=BB(r.ast);return Ue((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let u of i){let f=n(u,a);if(f!==void 0&&(c.push(new Yt([u],f)),a.errors==="first"))break}return Dr(c)?new Xt(s,c,o,a):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Cn]:!0,...t})}function av(e){return Ue(t=>ng(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:D},...e})}function hH(e){return Ue(t=>ng(t.map(([r])=>r)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var iv=B.check(dH()),wne=B.check(ov(1,1)),gH=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),xH=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},kz=[];function Tne(e){let t=gH(e),r=kz[t];if(r!==void 0)return r;let n=xH(t),o=ec(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${j(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Fe()(Yse,QD(n))});return kz[t]=o,o}var Az=[];function cv(e){let t=gH(e),r=Az[t];if(r!==void 0)return r;let n=nE.pipe(se(Dm,YD(xH(t))));return Az[t]=n,n}function kne(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(aa([n,o]));return(a,i,c)=>a instanceof globalThis.Map?Tr(Ut(s)([...a],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Tn(i,"entries",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:"ReadonlyMap",toCodec:([n,o])=>Fe()(Pe(aa([n,o])),Ne({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return te(r.ast,{key:e,value:t})}function Ane(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>o instanceof globalThis.Set?Tr(Ut(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:"ReadonlySet",toCodec:([r])=>Fe()(Pe(r),Ne({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return te(t.ast,{value:e})}var vne=ec(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Fe()(He({source:B,flags:B}),dr({decode:(e,t)=>Rt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new he({expected:"valid RegExp source and flags"},e,t)}),encode:e=>g({source:e.source,flags:e.flags})}))}),yH=B.annotate({expected:"a string that will be decoded as a URL"}),SH=ec(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Fe()(yH,fT)}),One=yH.pipe(se(SH,fT)),EH=B.annotate({expected:"a string that will be decoded as a Date"}),Ml=Ve(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>Fe()(EH,cT)}),_ne=EH.pipe(se(Ml,cT)),Pne=On.pipe(se(Ml,WD)),Fne=B.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function uv(e,t){return Fne.pipe(se(e,c2(t)))}var Rne=uv(Dm),bH=ec(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Fe()(He({data:B.check(cH()),type:B,name:B,lastModified:On}),dr({decode:(e,t)=>cn(iu(e.data),{onFailure:()=>k(new he({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return g(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Oi({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Zf(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new he({expected:"a readable File"},e,t)})}))}),IH=ec(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Fe()(Pe(aa([B,ht([He({_tag:Ya("String"),value:B}),He({_tag:Ya("File"),value:bH})])])),dr({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return g(t)},encode:e=>g(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function Mne(e){return IH.pipe(se(e,u2))}var CH=ec(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Fe()(B.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Ne({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function $ne(e){return CH.pipe(se(e,f2))}var Nne=B.annotate({expected:"a string that will be decoded as a number"}).pipe(se(Lm,Xf)),Une=B.annotate({expected:"a string that will be decoded as a finite number"}).pipe(se(Rl,Xf)),Dne=te(zT).pipe(se(Pl,Fy)),wH=B.check(iH()),Lne=B.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(se(wH,qD())),Bne=B.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,o2)),jne=B.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,s2)),zne=B.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,a2)),Hne=B.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(se(B,i2)),VA=ht([Rl,Gz,B]),qne=He({issues:Pe(He({message:B,path:ei(Pe(ht([VA,He({key:VA})])))}))}),Wne=ti([0,1]).pipe(se(qS,Ne({decode:e=>e===1,encode:e=>e?1:0}))),TH=B.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),YS=ec(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Fe()(TH,lT)}),Vne=TH.pipe(se(YS,lT)),Gne=B.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(se(YS,{decode:CD(),encode:Ay()})),kH=B.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(se(YS,{decode:TD(),encode:vy()})),AH=dr({decode:(e,t)=>{let r=zD(e);return me(r)?k(new he({expected:"a valid BigDecimal string"},e,t)):g(r.value)},encode:e=>g(Ha(e))}),Kne=jm({order:Qf,formatter:e=>Ha(e)}),Jne=zm({order:Qf,formatter:e=>Ha(e)}),Zne=Hm({order:Qf,formatter:e=>Ha(e)}),Qne=qm({order:Qf,formatter:e=>Ha(e)}),Yne=Wm({order:Qf,formatter:e=>Ha(e)}),vH=B.annotate({expected:"a string that will be decoded as a BigDecimal"}),OH=Ve(aT,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Fe()(vH,AH),toFormatter:()=>e=>Ha(e)}),Xne=vH.pipe(se(OH,AH)),XS=Ve(W$,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Fe()(Pl.check(fH(globalThis.BigInt(0))),Ne({decode:xd,encode:Ax})),toCodecStringTree:()=>Fe()(_H,uT)}),_H=B.annotate({expected:"a string that will be decoded as a ByteSize"}),eoe=_H.pipe(se(XS,uT)),toe=Pl.pipe(se(XS,VD)),roe=Lm.pipe(se(XS,GD));function GA(e,t){let r=An()([e,t],([n,o])=>(s,a,i)=>{if(!fM(s))return k(new $t(a,s,i));switch(s._tag){case"Fail":return Tr(Ut(n)(s.error,i),{onSuccess:y0,onFailure:c=>Tn(a,"error",c,s,i)});case"Die":return Tr(Ut(o)(s.defect,i),{onSuccess:S0,onFailure:c=>Tn(a,"defect",c,s,i)});case"Interrupt":return g(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([n,o])=>Fe()(ht([He({_tag:Ht("Fail"),error:n}),He({_tag:Ht("Die"),defect:o}),He({_tag:Ht("Interrupt"),fiberId:GS(Rl)})]),Ne({decode:s=>{switch(s._tag){case"Fail":return y0(s.error);case"Die":return S0(s.defect);case"Interrupt":return pM(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return te(r.ast,{error:e,defect:t})}function KA(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(GA(n,o));return(a,i,c)=>uM(a)?Tr(Ut(s)(a.reasons,c),{onSuccess:Hp,onFailure:u=>Tn(i,"failures",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([n,o])=>Fe()(Pe(GA(n,o)),Ne({decode:Hp,encode:({reasons:s})=>s}))});return te(r.ast,{error:e,defect:t})}function vz(e){return Fe()(e,Ne({decode:wC,encode:Xe}))}function noe(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>Ox(o)?Tr(Ut(n)(Xe(o),a),{onSuccess:wC,onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:"Chunk",toCodec:([r])=>vz(Pe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>vz(WS(Pe(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>IC(r)});return te(t.ast,{value:e})}function PH(){return Wr((e,t)=>Le(Gw(e),{onNone:()=>k(new he({message:"Invalid DateTime input"},e,t)),onSome:r=>g(Kw(r))}))}var ooe=Ne({decode:e=>Zw(e),encode:e=>e.offset}),FH=dr({decode:(e,t)=>Le(aD(e),{onNone:()=>k(new he({expected:"a valid IANA time zone"},e,t)),onSome:g}),encode:e=>g(e.id)}),RH=dr({decode:(e,t)=>Le(iD(e),{onNone:()=>k(new he({expected:"a valid time zone"},e,t)),onSome:g}),encode:e=>g(Zd(e))}),MH=dr({decode:(e,t)=>Le(Gw(e),{onNone:()=>k(new he({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>g(Kw(r))}),encode:e=>g(fD(e))}),$H=dr({decode:(e,t)=>Le(sD(e),{onNone:()=>k(new he({expected:"a valid Zoned DateTime string"},e,t)),onSome:g}),encode:e=>g(Qw(e))}),NH=-864e13,UH=864e13,soe=NH+840*60*1e3,aoe=UH-840*60*1e3,ioe=-720*60*1e3,coe=840*60*1e3,DH=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function LH(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function fv(e,t){return On.check(tc({minimum:e,maximum:t}))}function BH(){return ht([fv(ioe,coe),ti(DH)])}var eE=Ve(e=>Vw(e)&&eD(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{let[t,r]=LH(e,NH,UH);return Fl()(fv(t,r),Ee(nD))},toCodecJson:()=>Fe()(B,MH),toFormatter:()=>e=>e.toString()}),uoe=Ml.pipe(se(eE,{decode:PH(),encode:Ee(cD)})),foe=B.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(se(eE,MH)),loe=On.pipe(se(eE,{decode:PH(),encode:Ee(uD)})),poe=Ve(YU,{representation:{id:"effect/schema/TimeZoneOffset",payload:null},toCode:()=>({runtime:"Schema.TimeZoneOffset",Type:"DateTime.TimeZone.Offset",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Offset",toCodecJson:()=>Fe()(On,ooe),toFormatter:()=>e=>Zd(e)}),jH=B.annotate({expected:"an IANA time zone identifier"}),zH=Ve(XU,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>Fl()(ti(DH),Ee(Jw)),toCodecJson:()=>Fe()(jH,FH),toFormatter:()=>e=>Zd(e)}),doe=jH.pipe(se(zH,FH)),HH=B.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),qH=Ve(QU,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>Fl()(BH(),Ee(e=>typeof e=="number"?Zw(e):Jw(e))),toCodecJson:()=>Fe()(HH,RH),toFormatter:()=>e=>Zd(e)}),moe=HH.pipe(se(qH,RH)),WH=B.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),VH=Ve(e=>Vw(e)&&tD(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{let[t,r]=LH(e,soe,aoe);return Fl()(He({epochMilliseconds:fv(t,r),timeZone:BH()}),Ee(({epochMilliseconds:n,timeZone:o})=>oD(n,{timeZone:o})))},toCodecJson:()=>Fe()(WH,$H),toFormatter:()=>e=>Qw(e),toEquivalence:()=>rD}),hoe=WH.pipe(se(VH,$H)),_n=(e,t,r,n)=>B.pipe(se(e,dr({decode:(o,s)=>{let a=t(o);return xt(a)?g(a.success):k(new he({message:a.failure.message},o,s))},encode:o=>g(r(o))}))).annotate({identifier:n}),Pu=Ve(Cl,{identifier:"MacAddress"}),$l=_n(Pu,ez,IA,"MacAddressFromString"),Vm=Ve(_r,{identifier:"Ipv4Address"}),lv=_n(Vm,Tu,Pr,"Ipv4AddressFromString"),tE=Ve(Ro,{identifier:"Ipv6Address"}),GH=_n(tE,ku,Pr,"Ipv6AddressFromString"),rc=Ve(yA,{identifier:"IpAddress"}),Fu=_n(rc,Qi,Pr,"IpAddressFromString"),Et=(e,t,r,n)=>Yz(t,{expected:r})(e).annotate({identifier:n}),goe=Et(rc,wl,"a multicast address","IpMulticastAddress"),xoe=Et(Fu,wl,"a multicast address","IpMulticastAddressFromString"),yoe=Et(Pu,wl,"a multicast address","MacMulticastAddress"),Soe=Et($l,wl,"a multicast address","MacMulticastAddressFromString"),Eoe=Et(rc,kA,"a unicast address","IpUnicastAddress"),boe=Et(Fu,kA,"a unicast address","IpUnicastAddressFromString"),Ioe=Et(Pu,_S,"a unicast address","MacUnicastAddress"),Coe=Et($l,_S,"a unicast address","MacUnicastAddressFromString"),woe=Et(Vm,FS,"a broadcast address","Ipv4BroadcastAddress"),Toe=Et(lv,FS,"a broadcast address","Ipv4BroadcastAddressFromString"),koe=Et(Pu,OS,"a broadcast address","MacBroadcastAddress"),Aoe=Et($l,OS,"a broadcast address","MacBroadcastAddressFromString"),voe=Et(rc,TA,"a loopback address","IpLoopbackAddress"),Ooe=Et(Fu,TA,"a loopback address","IpLoopbackAddressFromString"),_oe=Et(rc,AA,"a link-local address","IpLinkLocalAddress"),Poe=Et(Fu,AA,"a link-local address","IpLinkLocalAddressFromString"),Foe=Et(rc,PS,"an unspecified address","IpUnspecifiedAddress"),Roe=Et(Fu,PS,"an unspecified address","IpUnspecifiedAddressFromString"),Moe=Et(Vm,vA,"a private address","Ipv4PrivateAddress"),$oe=Et(lv,vA,"a private address","Ipv4PrivateAddressFromString"),Noe=Et(tE,OA,"a unique-local address","Ipv6UniqueLocalAddress"),Uoe=Et(GH,OA,"a unique-local address","Ipv6UniqueLocalAddressFromString"),Doe=Et(Pu,CA,"a locally administered address","MacLocallyAdministeredAddress"),Loe=Et($l,CA,"a locally administered address","MacLocallyAdministeredAddressFromString"),Boe=Et(Pu,wA,"a universally administered address","MacUniversallyAdministeredAddress"),joe=Et($l,wA,"a universally administered address","MacUniversallyAdministeredAddressFromString"),KH=Ve(pz,{identifier:"Ipv4Interface"}),zoe=_n(KH,NS,Rm,"Ipv4InterfaceFromString"),JH=Ve(dz,{identifier:"Ipv6Interface"}),Hoe=_n(JH,US,Rm,"Ipv6InterfaceFromString"),ZH=Ve(Pm,{identifier:"IpInterface"}),qoe=_n(ZH,DS,Rm,"IpInterfaceFromString"),QH=Ve(hz,{identifier:"Ipv4Network"}),Woe=_n(QH,xz,$m,"Ipv4NetworkFromString"),YH=Ve(gz,{identifier:"Ipv6Network"}),Voe=_n(YH,yz,$m,"Ipv6NetworkFromString"),XH=Ve(Mm,{identifier:"IpNetwork"}),Goe=_n(XH,Sz,$m,"IpNetworkFromString"),Koe=Ve(km,{identifier:"InetAddressV4"}),Joe=Ve(Am,{identifier:"InetAddressV6"}),eq=Ve(SA,{identifier:"InetAddress"}),Zoe=_n(eq,_A,RS,"InetAddressFromString"),tq=Ve(AS,{identifier:"UnixPathAddress"}),Qoe=B.pipe(se(tq,Ne({decode:rz,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),Yoe=Ve(Yj,{identifier:"SocketAddress"}),ri=B.check(Ue(Za,{expected:"a normalized domain name"})).pipe(KS("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),rq=_n(ri,MS,e=>e,"DomainNameFromString"),pv=B.check(Ue(EA,{expected:"a canonical scoped IPv6 literal"})).pipe(KS("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),nq=_n(pv,vm,e=>e,"ScopedIpv6LiteralFromString"),Xoe=ht([rc,pv,ri]).annotate({identifier:"Host"}),ese=ht([Fu,nq,rq]).annotate({identifier:"HostFromString"}),oq=Ve(RA,{identifier:"HostPort"}),tse=_n(oq,oz,MA,"HostPortFromString"),rse=On.check(tc({minimum:0,maximum:65535},{expected:"a port number"})),nse=dr({decode:(e,t)=>Le(sP(e),{onNone:()=>k(new he({expected:"a valid Duration string"},e,t)),onSome:g}),encode:e=>g(globalThis.String(e))}),ose=dr({decode:e=>g(Fs(e)),encode:(e,t)=>Le(aP(e),{onNone:()=>k(new he({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>g(r)})}),sse=Ne({decode:e=>xi(e),encode:e=>Lr(e)}),Gm=Ve(Cp,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Fe()(ht([He({_tag:Ht("Infinity")}),He({_tag:Ht("NegativeInfinity")}),He({_tag:Ht("Nanos"),value:Pl}),He({_tag:Ht("Millis"),value:On})]),Ne({decode:e=>{switch(e._tag){case"Infinity":return ya;case"NegativeInfinity":return uf;case"Nanos":return Fs(e.value);case"Millis":return xi(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}}))}),ase=B.annotate({expected:"a string that will be decoded as a Duration"}),ise=ase.pipe(se(Gm,nse)),cse=Pl.pipe(se(Gm,ose)),use=Lm.pipe(se(Gm,sse)),fse=ti(UA),sq=(e,t)=>B.pipe(se(e,dr({decode:(r,n)=>{let o=t(r);return be(o)?k(new he({message:o.failure.message},r,n)):Pr(o.success)===r?g(o.success):k(new he({message:"expected a canonical address"},r,n))},encode:r=>g(Pr(r))}))),qA=On.check(tc({minimum:0,maximum:255})),kl=On.check(tc({minimum:0,maximum:65535})),aq=On.check(tc({minimum:0,maximum:4294967295})),LS=aq.pipe(se(Gm,Ne({decode:wp,encode:Ms}))),Mo=(e,t)=>Ve(r=>DA(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=Bm(e,t);return Fe()(r,dr({decode:(n,o)=>{let{_tag:s,...a}=n,i=uz(e,a);return xt(i)?g(i.success):k(new he({message:i.failure.message},n,o))},encode:n=>g({...n})}))}}),iq=Mo("A",{address:sq(Vm,Tu)}),cq=Mo("AAAA",{address:sq(tE,ku)}),uq=Mo("CAA",{critical:qS,tag:B.check(_u(/^[a-z0-9]+$/i)),value:B}),fq=Mo("CNAME",{target:ri}),lq=Mo("MX",{exchange:ri,priority:kl}),pq=Mo("NAPTR",{order:kl,preference:kl,flags:B,service:B,regexp:B,replacement:ri}),dq=Mo("NS",{host:ri}),mq=Mo("PTR",{host:iv}),hq=Mo("SOA",{primary:ri,admin:iv,serial:aq,refresh:LS,retry:LS,expire:LS,minimum:LS}),gq=Mo("SRV",{target:ri,port:kl,priority:kl,weight:kl}),xq=Mo("TLSA",{certUsage:qA,selector:qA,matchingType:qA,data:kH}),yq=Mo("TXT",{chunks:VS(B)}),lse=ht([iq,cq,uq,fq,lq,pq,dq,mq,hq,gq,xq,yq]).annotate({identifier:"DnsRecord"});function pse(e,t,r){let n=An()([e,t,r],([o,s,a])=>{let i=KA(s,a);return(c,u,f)=>{if(!Zg(c))return k(new $t(u,c,f));switch(c._tag){case"Success":return Tr(Ut(o)(c.value,f),{onSuccess:Zr,onFailure:p=>Tn(u,"value",p,c,f)});case"Failure":return Tr(Ut(i)(c.cause,f),{onSuccess:Vn,onFailure:p=>Tn(u,"cause",p,c,f)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,a])=>Fe()(ht([He({_tag:Ht("Success"),value:o}),He({_tag:Ht("Failure"),cause:KA(s,a)})]),Ne({decode:i=>i._tag==="Success"?Zr(i.value):Vn(i.cause),encode:i=>et(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}}))});return te(n.ast,{value:e,error:t,defect:r})}function Oz(e,t,r){return He({type:Ht(e),nodes:Pe(He({index:Au,data:t})),edges:Pe(He({index:Au,source:Au,target:Au,data:r}))})}function _z(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return k(new Yt(["nodes",o,"index"],new he({expected:"a strictly increasing node index"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return k(new Yt(["edges",o,"index"],new he({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return k(new Yt(["edges",o,"source"],new he({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return k(new Yt(["edges",o,"target"],new he({expected:"an encoded node index"},s.target,t)))}return g(sS(e))}function dse(e,t,r){return!Lk(e)||e.mutable||e.type!==t?k(new he({expected:`an immutable ${t} Graph`},e,r)):g(gm(e))}function mse(e,t){return(r,n)=>{let o=gm(r),s=gm(n);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],u=o.type==="directed"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!u||!t(i.data,c.data))return!1}return!0}}function hse(e,t,r){return Fl()(ht([HS,He({nodes:VS(t),edges:Pe(aa([Au,Au,r]))})]),Ee(n=>{if(n===null)return sS({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return sS({type:e,nodes:o,edges:n.edges.map(([s,a,i],c)=>({index:c,source:s%o.length,target:a%o.length,data:i}))})}))}function gse(e,t,r){let n=An()([t,r],([o,s])=>{let a=Oz(e,o,s);return(i,c,u)=>!Lk(i)||i.mutable||i.type!==e?k(new $t(c,i,u)):I(Ut(a)(gm(i),u),f=>_z(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${j(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${j(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Fe()(Oz(e,o,s),dr({decode:_z,encode:(a,i)=>dse(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>hse(e,o,s),toEquivalence:([o,s])=>mse(o,s)});return te(n.ast,{type:e,node:t,edge:r})}function Pz(e){return Fe()(e,Ne({decode:bk,encode:dm}))}function xse(e,t){let r=An()([e,t],([n,o])=>{let s=Pe(aa([n,o]));return(a,i,c)=>oB(a)?Tr(Ut(s)(dm(a),c),{onSuccess:bk,onFailure:u=>Tn(i,"entries",u,a,c)}):k(new $t(i,a,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([n,o])=>Pz(Pe(aa([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>Pz(WS(Pe(aa([o,s])).check(hH()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>wh(n,o)});return te(r.ast,{key:e,value:t})}function Fz(e){return Fe()(e,Ne({decode:wk,encode:Xe}))}function yse(e){let t=An()([e],([r])=>{let n=Pe(r);return(o,s,a)=>uB(o)?Tr(Ut(n)(Xe(o),a),{onSuccess:wk,onFailure:i=>Tn(s,"values",i,o,a)}):k(new $t(s,o,a))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:"HashSet",toCodec:([r])=>Fz(Pe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>Fz(WS(Pe(n).check(av()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>sp(r)});return te(t.ast,{value:e})}function Ru(e){let t=An()([e],([r])=>(n,o,s)=>sf(n)?me(n)?zc:Tr(Ut(r)(n.value,s),{onSuccess:v,onFailure:a=>Tn(o,"value",a,n,s)}):k(new $t(o,n,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([r])=>Fe()(ht([He({_tag:Ht("Some"),value:r}),He({_tag:Ht("None")})]),Ne({decode:n=>n._tag==="None"?A():v(n.value),encode:n=>fe(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return te(t.ast,{value:e})}function Sse(e){return XA(e).pipe(se(Ru(vn(e)),XD()))}function Ese(e){return GS(e).pipe(se(Ru(vn(e)),e2()))}function bse(e,t){return Zz(e).pipe(se(Ru(vn(e)),t2(t)))}var Sq=Ve(dB,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Eq=Ve(pB,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Fe()(Pe(B),Ne({decode:mB,encode:SB})),toCodecIso:()=>Fe()(Ou(B,Sq),Ne({decode:_k,encode:e=>e.cookies}))}),Ise=Eq.pipe(se(Ou(B,B),Ne({decode:yB,encode:e=>Pk(globalThis.Object.entries(e).map(([t,r])=>xB(t,r)))}))),Cse=Ve(CB,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>Mk,toCodec:()=>Fe()(Ou(B,B),Ne({decode:wB,encode:e=>({...e})}))}),dv=Ve(Nk,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Uk,toCodec:()=>Fe()(Pe(aa([B,B])),Ne({decode:oS,encode:e=>e.params.map(([t,r])=>[t,hm(r)])}))}),wse=(e,t)=>dv.pipe(se(uv(Dm,t),dr({decode:r=>Le(PB(r,e),{onNone:()=>k(new Yt([e],new zi(void 0))),onSome:g}),encode:r=>g(oS([[e,r]]))}))),Tse=dv.pipe(se(Ou(B,ht([B,VS(B)])),Ne({decode:FB,encode:OB})));function kse(e){return Qa(e).pipe(se(Ru(vn(e)),r2()))}function Ase(e){return ei(e).pipe(se(Ru(vn(e)),n2()))}function vse(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return ei(XA(e)).pipe(se(Ru(vn(e)),Py({decode:o=>o.pipe(Cc(Ih),v),encode:r==="omit"?Ic:o=>v(Ft(Ic(o),()=>n))})))}function bq(e,t){let r=typeof t?.label=="string"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?Ut(Ht(r)):void 0,a=An()([e],([i])=>(c,u,f)=>{if(dl(c)){let p=s!==void 0?md(s(c.label,f),d=>new Yt(["label"],d)):W;return Qt(p,()=>Tr(Ut(i)(sa(c),f),{onSuccess:d=>ro(d,{label:c.label}),onFailure:()=>new Xt(u,[new Yt(["value"],new he(void 0,c,f))],c,f)}))}return k(new $t(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${j(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Fe()(i,{decode:Ee(c=>ro(c,{label:r})),encode:n?wy(c=>"Cannot serialize Redacted"+(fe(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Ee(sa)}),toEquivalence:([i])=>IB(i)});return te(a.ast,{value:e})}function Ose(e,t){return se(bq(vn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ee(r=>ro(r,{label:t?.label})),encode:t?.disallowEncode?wy(r=>"Cannot encode Redacted"+(fe(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):Ee(sa)})(e)}function _se(e,t){let r=An()([e,t],([n,o])=>(s,a,i)=>{if(!L_(s))return k(new $t(a,s,i));switch(s._tag){case"Success":return Tr(Wk(n)(s.success,i),{onSuccess:G,onFailure:c=>Tn(a,"success",c,s,i)});case"Failure":return Tr(Wk(o)(s.failure,i),{onSuccess:X,onFailure:c=>Tn(a,"failure",c,s,i)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([n,o])=>Fe()(ht([He({_tag:Ht("Success"),success:n}),He({_tag:Ht("Failure"),failure:o})]),Ne({decode:s=>s._tag==="Success"?G(s.success):X(s.failure),encode:s=>xt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return te(r.ast,{success:e,failure:t})}var Pse=globalThis.Symbol.for("immer-draftable"),JA={};function mv(e,t,r,n,o){let s=Rse(r,t,n),a=Iq(t),i=class extends e{constructor(...[c,u]){let p=u?.["~payload"],d=p?.token===JA?p.value:r.make(c??{},u);super(d,{...u,disableChecks:!0,"~payload":{token:JA,value:d}})}static[Nm]=Nm;get[a](){return a}static[Pse]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return ne(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return pS(s(this))(c??{},u)}static makeOption(c,u){return lS(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(is(this.ast,c))}static annotateKey(c){return this.rebuild(am(this.ast,c))}static check(...c){return this.rebuild(na(this.ast,c))}static extend(c){return(u,f)=>{let p=Km(u)?u:He(u),d={...r.fields,...p.fields},m=Dy(d,r.ast.checks,{identifier:c});return mv(this,c,YA(na(m,p.ast.checks),d),f,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function Fse(e){return new We(Ee(t=>new e(t,{"~payload":{token:JA,value:t}})),ea())}function Iq(e){return`~effect/Schema/Class/${e}`}function Rse(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=Iq(t),a=u=>u instanceof o||O(u,s),i=Fse(o),c=te(new sl([e.ast],()=>(u,f,p)=>a(u)?g(u):k(new $t(f,u,p)),{identifier:t,[by]:([u])=>({isConstructed:a,link:new Ot(u,i)}),toCodec:([u])=>new Ot(u.ast,i),toEquivalence:([u])=>u,toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[jd]:rl(e.ast),...r}));return n=se(c,i)(e)}}function Km(e){return zS(e)}var Cq=e=>(t,r)=>{let n=Km(t)?t:He(t);return mv(ig,e,n,r,o=>({toString(){return`${o}(${j({...this})})`}}))},Mse=e=>(t,r,n)=>{let o=Km(r)?r.mapFields(s=>({_tag:Ya(t),...s}),{unsafePreserveChecks:!0}):Bm(t,r);return Cq(e??t)(o,n)},rE=e=>(t,r)=>{let n=Km(t)?t:He(t);return mv(dp,e,n,r,s=>({name:s}))},xs=e=>(t,r,n)=>{let o=Km(r)?r.mapFields(s=>({_tag:Ya(t),...s}),{unsafePreserveChecks:!0}):Bm(t,r);return rE(e??t)(o,n)};function $se(e){return t=>t.annotate({toFormatter:e})}function Nse(e,t){return jj(e.ast,t)}function Use(e){return t=>t.annotate({toEquivalence:e})}function Dse(e){return cA(e.ast)}function Lse(e,t){return Cm(e.ast,t)}function Bse(e,t){let r=Cm(gl(e.ast),t);return IS(r,t)}var jse=xS,zse=yS,hv=SS,Hse=gj;function qse(e,t){return Nj(e,t)}function Wse(e){return Kj(e)}function Vse(e){return Jj(e)}function Gse(e){return Zj(e)}function Kse(e,t){return r=>te(is(r.ast,{toCodecIso:()=>new Ot(e.ast,_y(t))}),{schema:r})}function Jse(e){return $j(e)}function Zse(e){let t=Qz(()=>r),r=ht([e,Pe(t),Ou(B,t)]);return r}var nE=te(is(nl,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),Qse=Ou(B,nE),Yse=He({message:B,name:Qa(B),stack:Qa(B),cause:Qa(nE)}),Xse=te(is(aL,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function eae(e){return za(e.ast)}function tae(e){return e.ast.context?.annotations}var wq="~effect/Terminal",gv="~effect/Terminal/QuitError",Nl=class extends rE("QuitError")({_tag:Ya("QuitError")}){[gv]=gv},Tq=e=>O(e,gv),ys=gt("effect/Terminal"),kq=e=>ys.of({...e,[wq]:wq});import*as sE from"node:readline";var Aq=N(function*(e=Oq){let t=process.stdin,r=process.stdout,n=yield*mn(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||wo(n)};t.once("end",a),yield*Cx(()=>U(()=>t.off("end",a)));let i=yield*fy({acquire:Qr(U(()=>{let m=sE.createInterface({input:t,escapeCodeTimeout:50}),x=E=>Da(n,E),y=()=>{s=!1,wo(n)};return s=!0,sE.emitKeypressEvents(t,m),m.on("line",x),m.once("close",y),t.isTTY&&t.setRawMode(!0),{rl:m,onClose:y,onLine:x}}),({rl:m,onClose:x,onLine:y})=>U(()=>{s=!1,m.off("line",y),m.off("close",x),t.isTTY&&t.setRawMode(!1),m.close(),o&&wo(n)})),idleTimeToLive:"10 millis"}),c=U(()=>r.columns??0),u=U(()=>r.rows??0),f=tt(function*(){let m=yield*mn(),x=(w,T)=>{let M={input:ga(w),key:{name:T.name??"",ctrl:!!T.ctrl,meta:!!T.meta,shift:!!T.shift}};Da(m,M),e(M)&&wo(m)},y=setInterval(()=>{},2147483647),E=()=>{clearInterval(y),wo(m)};return yield*Cx(()=>U(()=>{clearInterval(y),t.off("keypress",x),t.off("end",E)})),t.on("keypress",x),o?E():(yield*Md(i),t.once("end",E)),m}),p=L(()=>pN(n).pipe(I(Le({onNone:()=>qs(Kt(Md(i),hn(n))),onSome:g})),Jt(()=>new Nl({}))));return kq({columns:c,rows:u,readInput:f,readLine:p,display:m=>Qo(fr(x=>{r.write(m,y=>UO(y)?x(W):x(k(Co({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:y}))))}))})}),vq=Tf(ys,Aq(Oq));function Oq(e){let t=e.key;return t.name==="escape"||t.ctrl&&(t.name==="c"||t.name==="d")}var _q=vq;var Pq=DM(EL,ex(HL,PL,WL,KL,_q));function sae(e){return{_tag:"Value",value:e}}function aae(e,t){return{_tag:"Record",keys:e,value:t}}function iae(e,t){return{_tag:"Array",length:e,value:t}}var Fq=ke("effect/ConfigProvider",{defaultValue:()=>mae()}),cae={...Nr,toJSON(){return{_id:"ConfigProvider"}}},uae=e=>e;function fae(e,t){let r=Object.create(cae);return r.load=e,r.mapInput=t,r}function Rq(e,t){return fae(r=>e(t(r)),r=>Rq(e,n=>r(t(n))))}function lae(e){return Rq(e,uae)}function pae(e,t){return e===""&&!t?void 0:e}function dae(e,t){let r=t?.preserveEmptyStrings===!0,n=hae(e);return lae(o=>g(gae(n,e,o,r)))}function mae(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return dae(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function hae(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split("_"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}function gae(e,t,r,n){let o=r.map(String).join("_"),s=pae(Object.hasOwn(t,o)?t[o]:void 0,n),a=xae(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:sae(s);if(i.every(af)){let u=Math.max(...i.map(f=>parseInt(f,10)))+1;return iae(u,s)}return aae(new Set(i),s)}function xae(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var $q="~effect/Config";var yae={...Os({label:"Config",evaluate(e){return this.parse(e.getRef(Fq))}}),[$q]:$q,toJSON(){return{_id:"Config"}}};function Nq(e){let t=Object.create(yae);return t.evaluator=e,t.parse=r=>Qt(e(r,[]),ud),t}var Uq=(e,t,r)=>e.evaluator(t,r),Sae=l(2,(e,t)=>Nq((r,n)=>F(Uq(e,r,n),gr(t))));var Eae=l(2,(e,t)=>Nq((r,n)=>Wc(Uq(e,r,n),o=>be(o)?G(t):o))),Dq=e=>e.pipe(Sae(v),Eae(A()));var Ss={};$n(Ss,{Console:()=>Bq,assert:()=>bae,clear:()=>Iae,consoleWith:()=>Sr,count:()=>Cae,countReset:()=>wae,debug:()=>Tae,dir:()=>kae,dirxml:()=>Aae,error:()=>aE,group:()=>vae,info:()=>Oae,log:()=>Fr,table:()=>_ae,time:()=>Pae,timeLog:()=>Fae,trace:()=>Rae,warn:()=>Mae,withGroup:()=>$ae,withTime:()=>Nae});var Bq=h0,Sr=e=>ue(t=>e(t.getRef(Bq))),bae=(e,...t)=>Sr(r=>Q(()=>{r.assert(e,...t)})),Iae=Sr(e=>Q(()=>{e.clear()})),Cae=e=>Sr(t=>Q(()=>{t.count(e)})),wae=e=>Sr(t=>Q(()=>{t.countReset(e)})),Tae=(...e)=>Sr(t=>Q(()=>{t.debug(...e)})),kae=(e,t)=>Sr(r=>Q(()=>{r.dir(e,t)})),Aae=(...e)=>Sr(t=>Q(()=>{t.dirxml(...e)})),aE=(...e)=>Sr(t=>Q(()=>{t.error(...e)})),vae=e=>Sr(t=>Mc(Q(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>Q(()=>{t.groupEnd()}))),Oae=(...e)=>Sr(t=>Q(()=>{t.info(...e)})),Fr=(...e)=>Sr(t=>Q(()=>{t.log(...e)})),_ae=(e,t)=>Sr(r=>Q(()=>{r.table(e,t)})),Pae=e=>Sr(t=>Mc(Q(()=>{t.time(e)}),()=>Q(()=>{t.timeEnd(e)}))),Fae=(e,...t)=>Sr(r=>Q(()=>{r.timeLog(e,...t)})),Rae=(...e)=>Sr(t=>Q(()=>{t.trace(...e)})),Mae=(...e)=>Sr(t=>Q(()=>{t.warn(...e)})),$ae=l(e=>de(e[0]),(e,t)=>Sr(r=>Lp(Q(()=>{t?.collapsed?r.groupCollapsed(t.label):r.group(t?.label)}),()=>e,()=>Q(()=>{r.groupEnd()})))),Nae=l(e=>de(e[0]),(e,t)=>Sr(r=>Lp(Q(()=>{r.time(t)}),()=>e,()=>Q(()=>{r.timeEnd(t)}))));var ch={};$n(ch,{ChoiceWithValue:()=>zce,Date:()=>bce,Directory:()=>Sce,File:()=>yce,FileParse:()=>kce,FileSchema:()=>Ace,FileText:()=>Tce,Finite:()=>Ece,Int:()=>xce,Literals:()=>Ice,Never:()=>vce,Path:()=>Cce,Redacted:()=>wce,String:()=>gce,atLeast:()=>Dce,atMost:()=>Lce,between:()=>Bce,filter:()=>qce,filterMap:()=>Wce,map:()=>$ce,mapEffect:()=>Nce,mapTryCatch:()=>Uce,optional:()=>Oce,orElse:()=>Vce,orElseResult:()=>Gce,variadic:()=>Mce,withDefault:()=>Pce,withDescription:()=>_ce,withFallbackConfig:()=>Fce,withFallbackPrompt:()=>Rce,withMetavar:()=>Hce,withSchema:()=>jce});var it="~effect/cli/CliError",yv=e=>O(e,it),nc=class extends xs(`${it}/UnrecognizedOption`)("UnrecognizedOption",{option:B,command:ei(Pe(B)),suggestions:Pe(B)}){[it]=it;get message(){let t=this.suggestions.length>0?`
|
|
35
35
|
|
|
36
36
|
Did you mean this?
|
|
37
37
|
${this.suggestions.join(`
|
|
38
|
-
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+t}},Jm=class extends xs(`${it}/DuplicateOption`)("DuplicateOption",{option:B,parentCommand:B,childCommand:B}){[it]=it;get message(){return`Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`}},
|
|
38
|
+
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+t}},Jm=class extends xs(`${it}/DuplicateOption`)("DuplicateOption",{option:B,parentCommand:B,childCommand:B}){[it]=it;get message(){return`Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`}},Ul=class extends xs(`${it}/MissingOption`)("MissingOption",{option:B}){[it]=it;get message(){return`Missing required flag: --${this.option}`}},Dl=class extends xs(`${it}/MissingArgument`)("MissingArgument",{argument:B}){[it]=it;get message(){return`Missing required argument: ${this.argument}`}},Zm=class extends xs(`${it}/UnexpectedArgument`)("UnexpectedArgument",{arguments:Pe(B)}){[it]=it;get message(){return`Unexpected positional ${this.arguments.length===1?"argument":"arguments"}: ${this.arguments.map(r=>JSON.stringify(r)).join(", ")}`}},nn=class extends xs(`${it}/InvalidValue`)("InvalidValue",{option:B,value:B,expected:B,kind:ht([Ht("flag"),Ht("argument")])}){[it]=it;get message(){let t=this.expected.startsWith("Expected ")||this.expected.startsWith("Expected:")?this.expected:`Expected: ${this.expected}`;return this.kind==="argument"?`Invalid value for argument <${this.option}>: "${this.value}". ${t}`:this.value.length===0?`Missing value for flag --${this.option}. ${t}`:`Invalid value for flag --${this.option}: "${this.value}". ${t}`}},Qm=class extends xs(`${it}/UnknownSubcommand`)("UnknownSubcommand",{subcommand:B,parent:ei(Pe(B)),suggestions:Pe(B)}){[it]=it;get message(){let t=this.suggestions.length>0?`
|
|
39
39
|
|
|
40
40
|
Did you mean this?
|
|
41
41
|
${this.suggestions.join(`
|
|
42
|
-
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},
|
|
42
|
+
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},xv=class extends xs(`${it}/UserError`)("UserError",{cause:cv(),userMessage:Qa(B)}){[it]=it;[Mi]=!0;get message(){return this.userMessage?this.userMessage:typeof this.cause=="string"&&this.cause?this.cause:this.cause instanceof Error&&this.cause.message?this.cause.message:"An error occurred"}},Uae=ht([nc,Jm,Ul,Dl,Zm,nn,Qm,xv]),ni=class extends xs(`${it}/ShowHelp`)("ShowHelp",{commandPath:Pe(B),errors:Pe(Uae)}){[it]=it;[gd]=this.errors.length?1:0;[Mi]=!1;get message(){return"Help requested"}};var jq=Object.prototype.hasOwnProperty,Dae=e=>{let t=[],r=0,n=0;for(;(n=e.indexOf(".",n))!==-1;)(n===0||e[n-1]!=="\\")&&(t.push(e.slice(r,n)),r=n+1),n++;return t.push(e.slice(r)),t},Lae=e=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")),Sv=e=>{let t=(e??"").trim();if(Lae(t)){t[0]==="'"&&(t=t.slice(1,-1));try{return JSON.parse(t)}catch{return t}}let r=!1,n="";for(let o of t)if(r)n+=o===";"||o==="#"||o==="\\"?o:`\\${o}`,r=!1;else{if(o===";"||o==="#")break;o==="\\"?r=!0:n+=o}return n.trim()},zq=e=>{let t=Object.create(null),r=t,n=/^\[([^\]]*)\]\s*$/,o=/^([^=]+)(=(.*))?$/;for(let a of e.split(/[\r\n]+/g)){if(a.length===0||/^\s*(?:[;#]|$)/.test(a))continue;let i=n.exec(a);if(i!==null){let x=Sv(i[1]);x==="__proto__"?r=Object.create(null):r=t[x]??=Object.create(null);continue}let c=o.exec(a);if(c===null)continue;let u=Sv(c[1]),f=u.length>2&&u.endsWith("[]"),p=f?u.slice(0,-2):u;if(p==="__proto__")continue;let d=c[2]===void 0?!0:Sv(c[3]),m=d==="true"||d==="false"||d==="null"?JSON.parse(d):d;f&&(jq.call(r,p)?Array.isArray(r[p])||(r[p]=[r[p]]):r[p]=[]),Array.isArray(r[p])?r[p].push(m):r[p]=m}let s=[];for(let a of Object.keys(t)){if(typeof t[a]!="object"||t[a]===null||Array.isArray(t[a]))continue;let i=Dae(a),c=i.pop(),u=c.replace(/\\\./g,".");r=t;for(let f of i)f!=="__proto__"&&((!jq.call(r,f)||typeof r[f]!="object"||r[f]===null)&&(r[f]=Object.create(null)),r=r[f]);r===t&&u===c||(r[u]=t[a],s.push(a))}for(let a of s)delete t[a];return t};var Hq=Object.prototype.hasOwnProperty,Xm=()=>Object.create(null),qq=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date),Ev=class{root=Xm();input;current=this.root;index=0;line=1;column=1;explicitTables=new Set;constructor(t){this.input=t}parse(){for(;;){if(this.skipDocumentWhitespace(),this.done)return this.root;if(this.peek()==="[")this.parseHeader();else{let t=this.parseKeyPath("=");this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(this.current,t,this.parseValue()),this.finishStatement()}}}parseHeader(){this.expect("[");let t=this.peek()==="[";t&&this.advance(),this.skipInlineWhitespace();let r=this.parseKeyPath("]");this.skipInlineWhitespace(),this.expect("]"),t&&this.expect("]"),this.finishStatement();let n=this.resolveTable(r,t);!t&&this.explicitTables.has(n)&&this.fail(`Cannot redefine table '${r.join(".")}'`),t||this.explicitTables.add(n),this.current=n}resolveTable(t,r){let n=this.root;for(let o=0;o<t.length;o++){let s=t[o],a=o===t.length-1,i=n[s];if(a&&r){i===void 0&&(i=[],n[s]=i),Array.isArray(i)||this.fail(`Cannot redefine existing key '${t.slice(0,o+1).join(".")}'`);let c=Xm();return i.push(c),c}i===void 0&&(i=Xm(),n[s]=i),Array.isArray(i)&&(i=i[i.length-1]),qq(i)||this.fail(`Cannot redefine existing key '${t.slice(0,o+1).join(".")}'`),n=i}return n}assign(t,r,n){let o=t;for(let a=0;a<r.length-1;a++){let i=r[a],c=o[i];if(c===void 0){let u=Xm();o[i]=u,o=u}else qq(c)?o=c:this.fail(`Cannot redefine existing key '${r.slice(0,a+1).join(".")}'`)}let s=r[r.length-1];Hq.call(o,s)&&this.fail(`Cannot redefine existing key '${r.join(".")}'`),o[s]=n}parseKeyPath(t){let r=[];for(;;){this.skipInlineWhitespace();let n=this.peek(),o;if(n==='"')o=this.parseBasicString(!1);else if(n==="'")o=this.parseLiteralString(!1);else{let s=this.index;for(;/[A-Za-z0-9_-]/.test(this.peek());)this.advance();o=this.input.slice(s,this.index)}if(o.length===0&&this.fail("Expected a key"),r.push(o),this.skipInlineWhitespace(),this.peek()==="."){this.advance();continue}return this.peek()!==t&&this.fail(`Expected '${t}'`),r}}parseValue(){let t=this.peek();if(t==='"')return this.parseBasicString(this.input.startsWith('"""',this.index));if(t==="'")return this.parseLiteralString(this.input.startsWith("'''",this.index));if(t==="[")return this.parseArray();if(t==="{")return this.parseInlineTable();let r=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})?)/.exec(this.input.slice(this.index));if(r!==null)return this.advance(r[0].length),this.parseDate(`${r[1]}T${r[2]}`);let n=this.index;for(;!this.done&&!/[\s,#\]}]/.test(this.peek());)this.advance();let o=this.input.slice(n,this.index);if(o==="true")return!0;if(o==="false")return!1;o.length===0&&this.fail("Expected a value");let s=this.parseDate(o);if(s!==void 0)return s;let a=this.parseNumber(o);if(a!==void 0)return a;this.fail(`Invalid value '${o}'`)}parseDate(t){let r="\\d{4}-\\d{2}-\\d{2}",n="\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?";if(new RegExp(`^${r}[Tt]${n}(?:[Zz]|[+-]\\d{2}:\\d{2})$`).test(t)){let o=new Date(t.replace("t","T").replace("z","Z"));return Number.isNaN(o.getTime())&&this.fail(`Invalid date-time '${t}'`),o}if(new RegExp(`^${r}[Tt]${n}$`).test(t)||new RegExp(`^${r}$`).test(t)||new RegExp(`^${n}$`).test(t))return t.replace("t","T")}parseNumber(t){let r=t.replace(/_/g,"");if(/^[+-]?(?:inf|nan)$/.test(t))return r.endsWith("nan")?Number.NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;if(/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/.test(t))return Number.parseInt(r.slice(2),16);if(/^0o[0-7](?:_?[0-7])*$/.test(t))return Number.parseInt(r.slice(2),8);if(/^0b[01](?:_?[01])*$/.test(t))return Number.parseInt(r.slice(2),2);if(/^[+-]?(?:0|[1-9](?:_?\d)*)$/.test(t)||/^[+-]?(?:(?:0|[1-9](?:_?\d)*)\.\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?|(?:0|[1-9](?:_?\d)*)[eE][+-]?\d(?:_?\d)*)$/.test(t))return Number(r)}parseBasicString(t){this.expect('"'),t&&(this.expect('"'),this.expect('"'),this.advance(this.input.startsWith(`\r
|
|
43
43
|
`,this.index)?2:this.peek()===`
|
|
44
44
|
`?1:0));let r="";for(;!this.done;){if(t&&this.input.startsWith('"""',this.index))return this.advance(3),r;let n=this.peek();if(!t&&n==='"')return this.advance(),r;if(!t&&(n===`
|
|
45
45
|
`||n==="\r")&&this.fail("Basic strings cannot contain newlines"),n!=="\\"){r+=n,this.advance();continue}if(this.advance(),t&&/[ \t\r\n]/.test(this.peek())){for(;/[ \t]/.test(this.peek());)this.advance();for(this.peek()!==`
|
|
46
46
|
`&&this.peek()!=="\r"&&this.fail("Invalid multiline string continuation");/[ \t\r\n]/.test(this.peek());)this.advance();continue}let o=this.peek();this.advance();let s={b:"\b",t:" ",n:`
|
|
47
|
-
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(
|
|
47
|
+
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(Hq.call(s,o))r+=s[o];else if(o==="u"||o==="U"){let a=o==="u"?4:8,i=this.input.slice(this.index,this.index+a);new RegExp(`^[0-9A-Fa-f]{${a}}$`).test(i)||this.fail("Invalid unicode escape"),r+=String.fromCodePoint(Number.parseInt(i,16)),this.advance(a)}else this.fail(`Invalid escape '\\${o}'`)}this.fail("Unterminated basic string")}parseLiteralString(t){this.expect("'"),t&&(this.expect("'"),this.expect("'"),this.advance(this.input.startsWith(`\r
|
|
48
48
|
`,this.index)?2:this.peek()===`
|
|
49
49
|
`?1:0));let r=this.index;for(;!this.done;){if(t&&this.input.startsWith("'''",this.index)){let n=this.input.slice(r,this.index);return this.advance(3),n}if(!t&&this.peek()==="'"){let n=this.input.slice(r,this.index);return this.advance(),n}!t&&(this.peek()===`
|
|
50
50
|
`||this.peek()==="\r")&&this.fail("Literal strings cannot contain newlines"),this.advance()}this.fail("Unterminated literal string")}parseArray(){this.expect("[");let t=[];for(;;){if(this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),t;if(t.push(this.parseValue()),this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),t;this.expect(",")}}parseInlineTable(){this.expect("{");let t=Xm();if(this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),t;for(;;){let r=this.parseKeyPath("=");if(this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(t,r,this.parseValue()),this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),t;this.expect(","),this.skipInlineWhitespace(),this.peek()==="}"&&this.fail("Inline tables cannot end with a trailing comma")}}skipDocumentWhitespace(){for(;!this.done;)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}skipInlineWhitespace(){for(;this.peek()===" "||this.peek()===" ";)this.advance()}skipArrayWhitespace(){for(;!this.done;)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}finishStatement(){this.skipInlineWhitespace(),this.peek()==="#"&&this.skipComment(),!this.done&&this.peek()!==`
|
|
51
51
|
`&&this.peek()!=="\r"&&this.fail("Expected the end of the line")}skipComment(){for(;!this.done&&this.peek()!==`
|
|
52
52
|
`;)this.advance()}expect(t){this.peek()!==t&&this.fail(`Expected '${t}'`),this.advance()}advance(t=1){for(let r=0;r<t;r++)this.input[this.index]===`
|
|
53
|
-
`?(this.line++,this.column=1):this.column++,this.index++}peek(){return this.input[this.index]??""}get done(){return this.index>=this.input.length}fail(t){throw new SyntaxError(`${t} at line ${this.line}, column ${this.column}`)}},
|
|
54
|
-
`.repeat(e),
|
|
55
|
-
`,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(
|
|
53
|
+
`?(this.line++,this.column=1):this.column++,this.index++}peek(){return this.input[this.index]??""}get done(){return this.index>=this.input.length}fail(t){throw new SyntaxError(`${t} at line ${this.line}, column ${this.column}`)}},Wq=e=>new Ev(e.replace(/^\uFEFF/,"")).parse();var wv=Object.prototype.hasOwnProperty,Gq=(e,t,r)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r})},Tv=(e,t,r)=>{for(let n=r;n<e.length;n++){let o=e[n];if(t==='"'&&o==="\\")n++;else if(o===t)if(t==="'"&&e[n+1]===t)n++;else return n}return-1},kv=(e,t)=>{let r=0,n=!0;for(let o=0;o<e.length;o++){let s=e[o];if(n&&(s==="'"||s==='"')){if(o=Tv(e,s,o+1),o===-1)return-1;n=!1}else if(n&&s==="&")for(;o+1<e.length&&!/[\s,[\]{}]/.test(e[o+1]);)o++;else{if(s==="#"&&(o===0||/\s/.test(e[o-1])))return t==="#"?o:-1;if(n&&(s==="["||s==="{"))r++;else if(r>0&&(s==="]"||s==="}"))r--,n=!1;else if(r>0&&s===",")n=!0;else if(s===":"&&(r>0||e[o+1]===void 0||/\s/.test(e[o+1]))){if(r===0&&t===":")return o;n=!0}else{if(n&&s==="-"&&/\s/.test(e[o+1]??""))continue;/\s/.test(s)||(n=!1)}}}return-1},zae=e=>{let t=kv(e,"#");return t===-1?e:e.slice(0,t).trimEnd()},bv=e=>kv(e,":"),iE=e=>e==="-"||e.startsWith("- "),Vq=e=>e===0?" ":`
|
|
54
|
+
`.repeat(e),Kq=e=>/\\*$/.exec(e)[0].length%2===1,Hae=(e,t)=>{let r=/[ \t]+$/.exec(e);if(r===null)return e;let n=t==='"'&&Kq(e.slice(0,r.index));return e.slice(0,r.index+(n?1:0))},qae=e=>{if(!e.endsWith('"')||e.length<2)throw new SyntaxError("Unterminated double-quoted YAML string");let t="";for(let r=1;r<e.length-1;r++){let n=e[r];if(n!=="\\"){t+=n;continue}let o=e[++r],s={0:"\0",a:"\x07",b:"\b",t:" ",n:`
|
|
55
|
+
`,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(wv.call(s,o)){t+=s[o];continue}if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8,i=e.slice(r+1,r+1+a);if(!new RegExp(`^[0-9A-Fa-f]{${a}}$`).test(i))throw new SyntaxError("Invalid unicode escape in YAML string");t+=String.fromCodePoint(Number.parseInt(i,16)),r+=a;continue}throw new SyntaxError(`Invalid YAML escape '\\${o}'`)}return t},eh=e=>{let t=e.trim();if(t.length===0)return null;if(t.startsWith('"')&&t.endsWith('"'))return qae(t);if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1).replace(/''/g,"'");if(/^(?:null|~)$/i.test(t))return null;if(/^true$/i.test(t))return!0;if(/^false$/i.test(t))return!1;if(/^[+-]?\.inf$/i.test(t))return t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;if(/^\.nan$/i.test(t))return Number.NaN;let r=t.replace(/_/g,"");return/^[+-]?0x[0-9a-f]+$/i.test(r)?(r[0]==="-"?-1:1)*Number.parseInt(r.replace(/^[+-]?0x/i,""),16):/^[+-]?0o[0-7]+$/i.test(r)?(r[0]==="-"?-1:1)*Number.parseInt(r.replace(/^[+-]?0o/i,""),8):/^[+-]?(?:0|[1-9]\d*)$/.test(r)||/^[+-]?(?:(?:0|[1-9]\d*)?\.\d+|(?:0|[1-9]\d*)\.?\d*[eE][+-]?\d+)$/.test(r)?Number(r):t},Jq=e=>{let t=eh(e);return t==null?"":String(t)},Iv=class{input;anchors;index=0;constructor(t,r){this.input=t,this.anchors=r}parse(){let t=this.parseValue();return this.skipWhitespace(),this.index!==this.input.length&&this.fail("Unexpected flow collection content"),t}parseValue(){this.skipWhitespace();let t=this.peek();if(t==="[")return this.parseSequence();if(t==="{")return this.parseMapping();if(t==='"'||t==="'")return eh(this.readQuoted(t));if(t==="*"){this.index++;let r=this.readUntil(/[,\]}\s]/);return this.anchors.has(r)||this.fail(`Unknown alias '*${r}'`),this.anchors.get(r)}return eh(this.readUntil(/[,\]}]/).trim())}parseSequence(){this.expect("[");let t=[];if(this.skipWhitespace(),this.peek()==="]")return this.index++,t;for(;;){if(t.push(this.parseValue()),this.skipWhitespace(),this.peek()==="]")return this.index++,t;if(this.expect(","),this.skipWhitespace(),this.peek()==="]")return this.index++,t}}parseMapping(){this.expect("{");let t={};if(this.skipWhitespace(),this.peek()==="}")return this.index++,t;for(;;){let r=this.parseKey();if(this.skipWhitespace(),this.expect(":"),wv.call(t,r)&&this.fail(`Duplicate key '${r}'`),Gq(t,r,this.parseValue()),this.skipWhitespace(),this.peek()==="}")return this.index++,t;if(this.expect(","),this.skipWhitespace(),this.peek()==="}")return this.index++,t}}parseKey(){this.skipWhitespace();let t=this.peek();return t==='"'||t==="'"?Jq(this.readQuoted(t)):this.readUntil(/:/).trim()}readQuoted(t){let r=this.index,n=Tv(this.input,t,r+1);return n===-1&&this.fail("Unterminated quoted scalar"),this.index=n+1,this.input.slice(r,this.index)}readUntil(t){let r=this.index;for(;this.index<this.input.length&&!t.test(this.peek());)this.index++;return this.input.slice(r,this.index)}skipWhitespace(){for(;/\s/.test(this.peek());)this.index++}expect(t){this.peek()!==t&&this.fail(`Expected '${t}'`),this.index++}peek(){return this.input[this.index]??""}fail(t){throw new SyntaxError(`${t} at flow offset ${this.index}`)}},Cv=class{lines;index=0;documentStarted=!1;anchors=new Map;constructor(t){this.lines=t}parse(){if(this.skipIgnored(),this.index>=this.lines.length)return null;this.documentStarted=!0;let t=this.parseNode(this.lines[this.index].indent);return this.skipIgnored(),this.index<this.lines.length&&this.fail(this.lines[this.index],"Unexpected content"),t}parseNode(t,r=t-1){this.skipIgnored();let n=this.lines[this.index];return n===void 0?null:(n.indent!==t&&this.fail(n,`Expected indentation of ${t} spaces`),iE(n.text)?this.parseSequence(t):bv(n.text)!==-1?this.parseMapping(t):(this.index++,this.parseNodeValue(n.text,r)))}parseMapping(t,r={}){for(;;){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<t)return r;n.indent>t&&this.fail(n,`Unexpected indentation of ${n.indent} spaces`);let o=bv(n.text);if(o===-1)return r;this.index++,this.parseMappingEntry(r,n.text,o,t,n)}}parseMappingEntry(t,r,n,o,s){let a=Jq(r.slice(0,n).trim()),i=r.slice(n+1).trimStart(),c=this.parseNodeValue(i,o,!0);wv.call(t,a)&&this.fail(s,`Duplicate key '${a}'`),Gq(t,a,c)}parseSequence(t){let r=[];for(;;){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<t||(n.indent>t&&this.fail(n,`Unexpected indentation of ${n.indent} spaces`),!iE(n.text)))return r;this.index++;let o=n.text.slice(1).trimStart();iE(o)&&this.fail(n,"Compact nested block sequences are not supported");let s=bv(o);if(s===-1)r.push(this.parseNodeValue(o,t));else{let a={};this.parseMappingEntry(a,o,s,t+2,n),r.push(this.parseMapping(t+2,a))}}}parseNodeValue(t,r,n=!1){let o=/^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(t);if(o===null)return this.parseValue(t,r,n);let s=this.parseValue(o[2]??"",r,n);return this.anchors.set(o[1],s),s}parseValue(t,r,n){let o=t.trimEnd();if(o.length===0){this.skipIgnored();let s=this.lines[this.index];return s===void 0?null:s.indent>r?this.parseNode(s.indent,r):n&&s.indent===r&&iE(s.text)?this.parseSequence(r):null}if(/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(o))return this.parseBlockScalar(o,r);if(t.startsWith('"')||t.startsWith("'"))return this.parseQuotedValue(t,r);if(o.startsWith("*")){let s=o.slice(1).trim();if(!this.anchors.has(s))throw new SyntaxError(`Unknown YAML alias '*${s}'`);return this.anchors.get(s)}return o.startsWith("[")||o.startsWith("{")?new Iv(o,this.anchors).parse():this.parsePlainValue(o,r)}parsePlainValue(t,r){let n=this.lines[this.index-1];/:(?:\s|$)/.test(t)&&this.fail(n,"Invalid colon in plain scalar");let o=t,s=kv(n.raw,"#")!==-1;for(;!s;){let a=this.skipBlankLines(),i=this.lines[this.index];if(i===void 0||i.indent<=r)break;let c=i.raw.slice(i.indent),u=c.search(/(?:^|[ \t])#/),f=(u===-1?c:c.slice(0,u)).trimEnd();if(f.length===0||i.indent===0&&/^(?:---|\.\.\.)(?:\s|$)/.test(f))break;/:(?:\s|$)/.test(f)&&this.fail(i,"Invalid colon in plain scalar"),o+=Vq(a)+f,this.index++,s=u!==-1}return eh(o)}parseQuotedValue(t,r){let n=t[0],o=n,s=t.slice(1);for(;;){let a=Tv(s,n,0);if(a!==-1){let c=s.slice(a+1);if(c.trim().length>0&&!/^[ \t]+#/.test(c))throw new SyntaxError("Unexpected content after quoted YAML scalar");return eh(o+s.slice(0,a+1))}n==='"'&&Kq(s)?o+=s.slice(0,-1):o+=Hae(s,n)+Vq(this.skipBlankLines());let i=this.lines[this.index++];if(i===void 0)throw new SyntaxError("Unterminated quoted YAML scalar");i.raw.trim().length>0&&i.indent<=r&&this.fail(i,"Invalid quoted scalar indentation"),s=i.raw.trimStart()}}parseBlockScalar(t,r){let n=t[0],o=t.includes("-")?"strip":t.includes("+")?"keep":"clip",s=Number.parseInt(t.replace(/[^1-9]/g,""),10),a=this.index,i=a,c=Number.isNaN(s)?Number.POSITIVE_INFINITY:r+s;for(;i<this.lines.length;){let m=this.lines[i];if(m.raw.trim().length!==0&&m.indent<=r)break;m.raw.trim().length!==0&&(c=Math.min(c,m.indent)),i++}c===Number.POSITIVE_INFINITY&&(c=r+1);let u=[];for(let m=a;m<i;m++){let x=this.lines[m];x.raw.trim().length===0?u.push(""):x.indent<c?this.fail(x,`Expected block scalar indentation of ${c} spaces`):u.push(x.raw.slice(c))}this.index=i;let f=u.length;for(;f>0&&u[f-1].length===0;)f--;let p=Math.max(0,u.length-f-(i===this.lines.length?1:0))+(f>0&&a+f<this.lines.length?1:0);u.length=f;let d="";if(n==="|")d=u.join(`
|
|
56
56
|
`);else{let m=0,x;for(let y of u)if(y.length===0)m++;else{let E=y.startsWith(" "),w=E||x===!0;x===void 0?d+=`
|
|
57
57
|
`.repeat(m):m===0?d+=w?`
|
|
58
58
|
`:" ":d+=`
|
|
59
59
|
`.repeat(m+(w?1:0)),d+=y,m=0,x=E}}return o==="keep"?d+`
|
|
60
60
|
`.repeat(p):o==="clip"&&f>0&&p>0?`${d}
|
|
61
|
-
`:d}skipBlankLines(){let t=this.index;for(;this.index<this.lines.length&&this.lines[this.index].raw.trim().length===0;)this.index++;return this.index-t}skipIgnored(){for(;this.index<this.lines.length;){let t=this.lines[this.index],r=t.text.trimEnd();if(r.length===0||r.startsWith("%"))this.index++;else if(t.indent===0&&r==="---")this.documentStarted&&this.fail(t,"Multiple YAML documents are not supported"),this.documentStarted=!0,this.index++;else if(t.indent===0&&r==="..."){for(this.index++;this.index<this.lines.length&&this.lines[this.index].text.trimEnd().length===0;)this.index++;this.index<this.lines.length&&this.fail(this.lines[this.index],"Multiple YAML documents are not supported")}else return}}fail(t,r){throw new SyntaxError(`${r} at line ${t.number}`)}},
|
|
61
|
+
`:d}skipBlankLines(){let t=this.index;for(;this.index<this.lines.length&&this.lines[this.index].raw.trim().length===0;)this.index++;return this.index-t}skipIgnored(){for(;this.index<this.lines.length;){let t=this.lines[this.index],r=t.text.trimEnd();if(r.length===0||r.startsWith("%"))this.index++;else if(t.indent===0&&r==="---")this.documentStarted&&this.fail(t,"Multiple YAML documents are not supported"),this.documentStarted=!0,this.index++;else if(t.indent===0&&r==="..."){for(this.index++;this.index<this.lines.length&&this.lines[this.index].text.trimEnd().length===0;)this.index++;this.index<this.lines.length&&this.fail(this.lines[this.index],"Multiple YAML documents are not supported")}else return}}fail(t,r){throw new SyntaxError(`${r} at line ${t.number}`)}},Av=e=>{let r=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
|
|
62
62
|
`).split(`
|
|
63
|
-
`).map((n,o)=>{let s=/^( *)/.exec(n)[1].length;if(n.slice(0,s+1).includes(" "))throw new SyntaxError(`Tabs cannot be used for YAML indentation at line ${o+1}`);return{raw:n,text:
|
|
64
|
-
${r}`,t)+
|
|
65
|
-
`}),
|
|
66
|
-
`))}):"";return
|
|
67
|
-
`+
|
|
68
|
-
`))+"\x1B[u"}}return""},
|
|
69
|
-
`}),
|
|
70
|
-
`))}})};var
|
|
71
|
-
`));let s=Ke(r,t,r.errorColor),a=ar(o,i=>
|
|
72
|
-
`+
|
|
73
|
-
`))+"\x1B[u"}}):"",
|
|
74
|
-
`})
|
|
75
|
-
`+t;var
|
|
76
|
-
`)};var
|
|
77
|
-
`});var
|
|
78
|
-
`));let s=Ke(r,t,r.errorColor),a=ar(o,i=>
|
|
79
|
-
`+
|
|
80
|
-
`))+"\x1B[u"}}):"",
|
|
81
|
-
`}),
|
|
82
|
-
`}),
|
|
63
|
+
`).map((n,o)=>{let s=/^( *)/.exec(n)[1].length;if(n.slice(0,s+1).includes(" "))throw new SyntaxError(`Tabs cannot be used for YAML indentation at line ${o+1}`);return{raw:n,text:zae(n.slice(s)),indent:s,number:o+1}});return new Cv(r).parse()};var Vae="~effect/cli/Primitive",Gae={[Vae]:{_A:D}},Zq=BS(JS),Qq=BS(ZS),cE=e=>e._tag==="Boolean",ia=(e,t)=>Object.assign(Object.create(Gae),{_tag:e,parse:t}),uE=(e,t)=>{let r=hv(t),n=Xa(r);return ia(e,o=>Jt(n(o),s=>s.message))},Yq=uE("Boolean",ev),Xq=uE("Finite",Rl),eW=uE("Int",On),tW=uE("Date",Ml),rW=ia("String",e=>g(e)),nW=e=>{let t=new Map(e),r=e.map(([o])=>j(o)).join(" | "),n=ia("Choice",o=>t.has(o)?g(t.get(o)):k(r));return Object.assign(n,{choiceKeys:e.map(([o])=>o)})},oW=(e,t)=>{let r=ia("Path",N(function*(n){let o=yield*os,s=yield*Ys,a=s.isAbsolute(n)?n:s.resolve(n),i=yield*Jt(o.exists(a),c=>`Failed to check path existence: ${c.message}`);if(t===!0&&!i)return yield*k(`Path does not exist: ${a}`);if(i&&e!=="either"){let c=yield*Jt(o.stat(a),u=>`Failed to stat path: ${u.message}`);if(e==="file"&&c.type!=="File")return yield*k(`Path is not a file: ${a}`);if(e==="directory"&&c.type!=="Directory")return yield*k(`Path is not a directory: ${a}`)}return a}));return Object.assign(r,{pathType:e})},sW=ia("Redacted",e=>g(ro(e))),vv=ia("FileText",N(function*(e){let t=yield*os,r=yield*Ys,n=r.isAbsolute(e)?e:r.resolve(e);return(yield*Jt(t.exists(n),i=>`Failed to check file existence: ${i.message}`))?(yield*Jt(t.stat(n),i=>`Failed to stat file: ${i.message}`)).type!=="File"?yield*k(`Path is not a file: ${n}`):yield*Jt(t.readFileString(n),i=>`Failed to read file: ${i.message}`):yield*k(`File does not exist: ${n}`)})),Kae={ini:e=>zq(e),json:e=>JSON.parse(e),toml:e=>Wq(e),yml:e=>Av(e),yaml:e=>Av(e)},Ov=e=>ia("FileParse",N(function*(t){let r=e?.format??t.split(".").pop(),n=Kae[r];if(n===void 0)return yield*k(`Unsupported file format: ${r}`);let o=yield*vv.parse(t);return yield*Rt({try:()=>n(o),catch:s=>`Failed to parse '.${r}' file content: ${s}`})})),aW=(e,t)=>{let r=Xa(e);return ia("FileSchema",N(function*(n){let o=yield*Ov(t).parse(n);return yield*Jt(r(o),s=>t?.errorFormatter?.(s.issue)??s.toString())}))},iW=ia("KeyValuePair",N(function*(e){let t=e.indexOf("=");if(t===-1)return yield*k(`Invalid key=value format. Expected format: key=value, got: ${e}`);let r=e.slice(0,t),n=e.slice(t+1);return!r||!n?yield*k(`Invalid key=value format. Both key and value must be non-empty. Got: ${e}`):{[r]:n}})),cW=ia("Never",()=>k("This option does not accept values")),th=e=>{switch(e._tag){case"Boolean":return"boolean";case"String":return"string";case"Int":return"integer";case"Finite":return"number";case"Date":return"date";case"Path":return"path";case"Choice":return"choice";case"Redacted":return"string";case"FileText":return"file";case"FileParse":return"file";case"FileSchema":return"file";case"KeyValuePair":return"key=value";case"Never":return"none";default:return"value"}},oi=e=>e._tag==="Choice"?e.choiceKeys:void 0,_v=e=>e._tag==="Path"?e.pathType:void 0;var Jae="\x1B[0m",si="\x1B[1m",uW="\x1B[3m",Mu="\x1B[4m",fW="\x1B[9m",lW="\x1B[?25h",rh="\x1B[?25l";var oc="\x1B[2K";var fE="\x1B[31m",lE="\x1B[32m",pW="\x1B[35m",$u="\x1B[37m",nh="\x1B[90m",Bl="\x1B[96m",bt=(e,t,...r)=>e?`${r.flat().join("")}${t}${Jae}`:t,pE=()=>{let e=globalThis.process;return typeof e=="object"&&e!==null&&typeof e.stdout=="object"&&e.stdout!==null&&e.stdout.isTTY===!0&&!e.env?.NO_COLOR},ca=(...e)=>e,dW=(e,t)=>t===void 0?`\x1B[${Math.max(e+1,0)}G`:`\x1B[${t+1};${Math.max(e+1,0)}H`,mW=(e=1)=>`\x1B[${e}B`,hW=(e,t=0)=>{let r="";return t<0&&(r+=`\x1B[${-t}A`),t>0&&(r+=`\x1B[${t}B`),e>0&&(r+=`\x1B[${e}C`),e<0&&(r+=`\x1B[${-e}D`),r},gW=e=>{let t="";for(let r=0;r<e;r++)t+="\x1B[2K"+(r<e-1?"\x1B[1A":"");return e>0&&(t+="\x1B[G"),t};var IW="~effect/cli/Prompt",CW=e=>O(e,IW),wW={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:Bl,mutedColor:nh,successColor:lE,errorColor:fE,submittedColor:$u},Qae={...wW,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},Yae=e=>({...process.platform==="win32"?Qae:wW,...e,colors:e?.colors??pE()}),oh=ke("effect/cli/Prompt/Theme",{defaultValue:Yae}),Rr=e=>F(oh,t=>({...t,...e.theme}));var Hv=(e,t)=>bt(e.colors,t,ca(uW,e.errorColor)),Ke=(e,t,...r)=>t.length===0?"":bt(e.colors,t,...r),sc=(e,t)=>e.length===0?t:e+" "+t,Xae=(e,t,r)=>{let n=Math.max(e.arrowUp.length,e.arrowDown.length);return t?e.arrowUp.padEnd(n):r?e.arrowDown.padEnd(n):" ".repeat(n)},qv=e=>{let t={initial:!1,...e,label:{confirm:"yes",deny:"no",...e.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...e.placeholder}},r={value:t.initial};return Nu(r,{render:uie(t),process:n=>pie(n,t.initial),clear:aie(t)})},Nu=(e,...t)=>{let[r,n]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(Gv);return o._tag="Loop",o.initialState=e,o.render=n.render,o.process=n.process,o.clear=n.clear,o.events=r,o},TW=e=>{let t={initial:new globalThis.Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:g,...e,locales:{...Cie,...e.locales}},r=Aie(t.dateMask,t.initial,t.locales),n=r.findIndex(s=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:A()};return Nu(o,{render:wie(t),process:Tie(t),clear:die(t)})};var eie=l(2,(e,t)=>{let r=Object.create(Gv);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),kW=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:o=>o<t.min?k(`${o} must be greater than or equal to ${t.min}`):o>t.max?k(`${o} must be less than or equal to ${t.max}`):g(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:A()};return Nu(n,{render:Mie(t),process:$ie(t),clear:PW(t)})};var Wv=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:o=>o<t.min?k(`${o} must be greater than or equal to ${t.min}`):o>t.max?k(`${o} must be less than or equal to ${t.max}`):g(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:A()};return Nu(n,{render:Fie(t),process:Rie(t),clear:PW(t)})};var tie=l(2,(e,t)=>eie(e,r=>nie(t(r)))),AW=e=>BW(e,"password").pipe(tie(ro)),on=N(function*(e){let t=yield*ys,r=yield*uC(t.readInput);return yield*Fv(e,t,r)},Jt(()=>new Nl({})),qs),rie=e=>{let t=0,r=-1;for(let n=0;n<e.length;n++)if(e[n].selected===!0){if(r!==-1)throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.Select");r=n}return r!==-1&&(t=r),t},Vv=e=>{let t={maxPerPage:10,...e},r=rie(t.choices);return Nu(r,{render:Hie(t),process:Wie(t),clear:qie(t)})};var nie=e=>{let t=Object.create(Gv);return t._tag="Succeed",t.value=e,t},vW=e=>BW(e,"text"),OW=e=>{let t={initial:!1,active:"on",inactive:"off",...e};return Nu(t.initial,{render:cce(t),process:uce,clear:()=>sce(t)})},Gv={...Os({label:"Prompt",evaluate(){return on(this)}}),[IW]:{_Output:e=>e}};var Fv=(e,t,r)=>L(()=>{let n=e;switch(n._tag){case"Loop":return I(r,o=>oie(n,t,o));case"OnSuccess":return I(Fv(n.prompt,t,r),o=>Fv(n.onSuccess(o),t,r));case"Succeed":return g(n.value)}}),oie=N(function*(e,t,r){let n=Sn(e.initialState)?yield*e.initialState:e.initialState,o=K.NextFrame({state:n}),s="";for(;;){let a=yield*e.render(n,o);if(yield*Pa(t.display(s+a)),s="",e.events){let i=hn(r).pipe(F(u=>({_tag:"Input",input:u}))),c=yield*Hs(i,hn(e.events).pipe(F(u=>({_tag:"Event",value:u}))));o=yield*e.process(c,n)}else{let i=yield*hn(r);o=yield*e.process(i,n)}switch(o._tag){case"Beep":continue;case"NextFrame":{s=yield*e.clear(n,o),n=o.state;continue}case"Submit":{s=yield*e.clear(n,o);let i=yield*e.render(n,o);return yield*Pa(t.display(s+i)),o.value}}}},(e,t,r)=>Ra(e,Pa(r.display(lW)))),K=Zb(),jl=(e,t)=>{if(t===0)return oc+dW(0);let r=0,n=e.split(Du);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return gW(r)},sie=(e,t)=>{let r=e.split(Du);return t===0?r.length:Is(ar(r,n=>Math.ceil(n.length/t)),cf(0,(n,o)=>n+o))},Kv=(e,t,r)=>r!==void 0&&r.length>0?mW(sie(r,t))+jl(`
|
|
64
|
+
${r}`,t)+jl(e,t):jl(e,t),Uu="\x07",Du=/\r?\n/,aie=e=>N(function*(t,r){let o=yield*(yield*ys).columns,s=yield*Rr(e),a=t.value?e.placeholder.defaultConfirm:e.placeholder.defaultDeny,i=$o(a,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),c=jl(i,o),u=oc+"\x1B[G";return c+u}),iie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.prefix,r.primaryColor),o=Ke(r,r.pointerSmall,r.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,a=bt(r.colors,s,r.mutedColor),i=$o(a,t.message,n,o,r);return rh+i}),cie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.tick,r.successColor),o=Ke(r,r.ellipsis,r.mutedColor),s=e?t.label.confirm:t.label.deny;return $o(s,t.message,n,o,r)+`
|
|
65
|
+
`}),uie=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>iie(n,e),Submit:({value:n})=>cie(n,e)}),fie=/^y|t$/,lie=/^n|f$/,pie=(e,t)=>{let r=Ft(e.input,()=>"");return e.key.name==="enter"||e.key.name==="return"?g(K.Submit({value:t})):fie.test(r.toLowerCase())?g(K.Submit({value:!0})):lie.test(r.toLowerCase())?g(K.Submit({value:!1})):g(K.Beep())},die=e=>N(function*(t,r){let o=yield*(yield*ys).columns,s=yield*Rr(e),a=oc+"\x1B[G",i=cf(t.dateParts,"",(p,d)=>p+d.toString()),c=$o(i,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),u=fe(t.error)?bp(t.error.value.split(Du),{onEmpty:()=>"",onNonEmpty:p=>sc(s.pointerSmall,p.join(`
|
|
66
|
+
`))}):"";return Kv(c,o,u)+a}),mie=(e,t,r)=>{if(fe(e.error)){let n=e.error.value.split(Du);if(st(n)){let o=Ke(r,t,r.errorColor),s=ar(n,a=>Hv(r,a));return`\x1B[s
|
|
67
|
+
`+sc(o,s.join(`
|
|
68
|
+
`))+"\x1B[u"}}return""},_W=(e,t,r=!1)=>cf(e.dateParts,"",(n,o,s)=>{let a=o.toString();if(s===e.cursor&&!r){let i=ca(Mu,t.primaryColor);return n+bt(t.colors,a,i)}return n+a}),hie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.prefix,r.primaryColor),o=Ke(r,r.pointerSmall,r.mutedColor),s=_W(e,r),a=$o(s,t.message,n,o,r),i=mie(e,r.pointerSmall,r);return rh+a+i}),gie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.tick,r.successColor),o=Ke(r,r.ellipsis,r.mutedColor),s=_W(e,r,!0);return $o(s,t.message,n,o,r)+`
|
|
69
|
+
`}),xie=e=>(e.dateParts[e.cursor].increment(),K.NextFrame({state:{...e,typed:""}})),yie=e=>(e.dateParts[e.cursor].decrement(),K.NextFrame({state:{...e,typed:""}})),Sie=e=>{let t=e.dateParts[e.cursor].previousPart();return fe(t)?K.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):K.Beep()},Eie=e=>{let t=e.dateParts[e.cursor].nextPart();return fe(t)?K.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):K.Beep()},bie=e=>{let t=e.dateParts[e.cursor].nextPart(),r=Le(t,{onNone:()=>e.dateParts.findIndex(n=>!n.isToken()),onSome:n=>e.dateParts.indexOf(n)});return K.NextFrame({state:{...e,typed:"",cursor:r}})},Iie=(e,t)=>{if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),K.NextFrame({state:{...t,typed:r}})}return K.Beep()},Cie={months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},wie=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>hie(n,e),Submit:()=>gie(t,e)}),Tie=e=>(t,r)=>{switch(t.key.name){case"left":return g(Sie(r));case"right":return g(Eie(r));case"k":case"up":return g(xie(r));case"j":case"down":return g(yie(r));case"tab":return g(bie(r));case"enter":case"return":return Fi(e.validate(r.value),{onFailure:n=>K.NextFrame({state:{...r,error:v(n)}}),onSuccess:n=>K.Submit({value:n})});default:return g(Iie(Ft(t.input,()=>""),r))}},kie=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,xW={1:({token:e,...t})=>new dE({token:e.replace(/\\(.)/g,"$1"),...t}),2:e=>new Uv(e),3:e=>new Dv(e),4:e=>new Lv(e),5:e=>new Bv(e),6:e=>new Nv(e),7:e=>new $v(e),8:e=>new Mv(e),9:e=>new Rv(e)},Aie=(e,t,r)=>{let n=[],o=null;for(;o=kie.exec(e);){let a=o.shift(),i=o.findIndex(c=>c!==void 0);if(i in xW){let c=o[i]||a;n.push(xW[i]({token:c,date:t,parts:n,locales:r}))}else n.push(new dE({token:o[i]||a,date:t,parts:n,locales:r}))}let s=n.reduce((a,i)=>{let c=a[a.length-1];return i.isToken()&&c!==void 0&&c.isToken()?c.setValue(i.token):a.push(i),a},Lt());return n.splice(0,n.length,...s),n},Es=class{token;date;parts;locales;constructor(t){this.token=t.token,this.locales=t.locales,this.date=t.date||new globalThis.Date,this.parts=t.parts||[this]}isToken(){return!1}nextPart(){let t=Ft(eg(this.parts,r=>r===this),()=>0);return Ip(this.parts.slice(t+1),r=>!r.isToken())}previousPart(){let t=eg(this.parts,r=>r===this);return fe(t)?tg(this.parts.slice(0,t.value),r=>!r.isToken()):A()}toString(){return globalThis.String(this.date)}},dE=class extends Es{increment(){}decrement(){}setValue(t){this.token=this.token+t}isToken(){return!0}toString(){return this.token}},Rv=class extends Es{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(t){this.date.setMilliseconds(globalThis.Number.parseInt(t.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}},Mv=class extends Es{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(t){this.date.setSeconds(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=`${this.date.getSeconds()}`;return this.token.length>1?t.padStart(2,"0"):t}},$v=class extends Es{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(t){this.date.setMinutes(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=`${this.date.getMinutes()}`;return this.token.length>1?t.padStart(2,"0"):t}},Nv=class extends Es{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(t){this.date.setHours(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${t}`.padStart(2,"0"):`${t}`}},Uv=class extends Es{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(t){this.date.setDate(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();switch(this.token){case"DD":return`${t}`.padStart(2,"0");case"Do":return`${t}${this.ordinalIndicator(t)}`;case"d":return`${r+1}`;case"ddd":return this.locales.weekdaysShort[r];case"dddd":return this.locales.weekdays[r];default:return`${t}`}}ordinalIndicator(t){if(t>=11&&t<=13)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},Dv=class extends Es{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(t){let r=globalThis.Number.parseInt(t.slice(-2))-1;this.date.setMonth(r<0?0:r)}toString(){let t=this.date.getMonth();switch(this.token.length){case 2:return`${t+1}`.padStart(2,"0");case 3:return this.locales.monthsShort[t];case 4:return this.locales.months[t];default:return`${t+1}`}}},Lv=class extends Es{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(t){this.date.setFullYear(globalThis.Number.parseInt(t.slice(-4)))}toString(){let t=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?t.slice(-2):t}},Bv=class extends Es{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(t){}toString(){let t=this.date.getHours()>=12?"pm":"am";return/A/.test(this.token)?t.toUpperCase():t}};var $o=(e,t,r,n,o,s)=>{let a=r.length===0?"":r+" ",i=c=>{let u=a+c;return n.length>0&&(u+=" "+n),e.length>0?u+=" "+e:n.length>0&&(u+=" "),u};return bp(t.split(Du),{onEmpty:()=>i(""),onNonEmpty:c=>{let u=s?.plain===!0?c:ar(c,f=>bt(o.colors,f,si));return i(u.join(`
|
|
70
|
+
`))}})};var vie=(e,t,r,n)=>{if(!e.disabled&&e.description&&t){let o=r.descriptionSeparator+e.description;return n?.plain===!0?o:bt(r.colors,o,r.mutedColor)}return""};var PW=e=>N(function*(t,r){let o=yield*(yield*ys).columns,s=yield*Rr(e),a=oc+"\x1B[G",i=FW(t,s.pointerSmall,s,{plain:!0}),c=Jv(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return Kv(c,o,i)+a}),Oie=(e,t,r,n)=>{let o=e.value===""?"":`${e.value}`;if(t||n?.plain===!0)return o;let s=fe(e.error)?r.errorColor:ca(Mu,r.primaryColor);return bt(r.colors,o,s)},FW=(e,t,r,n)=>fe(e.error)?bp(e.error.value.split(Du),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return sc(t,o.join(`
|
|
71
|
+
`));let s=Ke(r,t,r.errorColor),a=ar(o,i=>Hv(r,i));return`\x1B[s
|
|
72
|
+
`+sc(s,a.join(`
|
|
73
|
+
`))+"\x1B[u"}}):"",Jv=(e,t,r,n,o,s,a=!1)=>{let i=Oie(e,a,o,s);return $o(i,n.message,t,r,o,s)},RW=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.prefix,r.primaryColor),o=Ke(r,r.pointerSmall,r.mutedColor),s=FW(e,r.pointerSmall,r);return Jv(e,n,o,t,r)+s}),MW=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.tick,r.successColor),o=Ke(r,r.ellipsis,r.mutedColor);return Jv(e,n,o,t,r,void 0,!0)+`
|
|
74
|
+
`}),$W=e=>{if(e.value.length<=0)return g(K.Beep());let t=e.value.slice(0,e.value.length-1);return g(K.NextFrame({state:{...e,value:t,error:A()}}))},NW=e=>g(K.NextFrame({state:{...e,cursor:0,value:"",error:A()}})),_ie=(e,t)=>{if(t.value.length===0&&e==="-")return g(K.NextFrame({state:{...t,value:"-",error:A()}}));let r=globalThis.Number.parseInt(t.value+e);return globalThis.Number.isNaN(r)?g(K.Beep()):g(K.NextFrame({state:{...t,value:`${r}`,error:A()}}))},Pie=(e,t)=>{if(e==="."&&t.value.includes("."))return g(K.Beep());if(t.value.length===0&&e==="-")return g(K.NextFrame({state:{...t,value:"-",error:A()}}));let r=globalThis.Number.parseFloat(t.value+e);return globalThis.Number.isNaN(r)?g(K.Beep()):g(K.NextFrame({state:{...t,value:e==="."?`${r}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${r}`,error:A()}}))},Fie=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>RW(n,e),Submit:()=>MW(t,e)}),Rie=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return NW(r);switch(t.key.name){case"backspace":return $W(r);case"k":case"up":return g(K.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseInt(r.value)+e.incrementBy}`,error:A()}}));case"j":case"down":return g(K.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseInt(r.value)-e.decrementBy}`,error:A()}}));case"enter":case"return":{let n=globalThis.Number.parseInt(r.value);return globalThis.Number.isNaN(n)?g(K.NextFrame({state:{...r,error:v("Must provide an integer value")}})):Fi(e.validate(n),{onFailure:o=>K.NextFrame({state:{...r,error:v(o)}}),onSuccess:o=>K.Submit({value:o})})}default:return _ie(Ft(t.input,()=>""),r)}},Mie=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>RW(n,e),Submit:()=>MW(t,e)}),$ie=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return NW(r);switch(t.key.name){case"backspace":return $W(r);case"k":case"up":return g(K.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseFloat(r.value)+e.incrementBy}`,error:A()}}));case"j":case"down":return g(K.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseFloat(r.value)-e.decrementBy}`,error:A()}}));case"enter":case"return":{let n=globalThis.Number.parseFloat(r.value);return globalThis.Number.isNaN(n)?g(K.NextFrame({state:{...r,error:v("Must provide a floating point value")}})):I(U(()=>r$(n,e.precision)),o=>Fi(e.validate(o),{onFailure:s=>K.NextFrame({state:{...r,error:v(s)}}),onSuccess:s=>K.Submit({value:s})}))}default:return Pie(Ft(t.input,()=>""),r)}};var Zv=(e,t,r,n,o)=>r.message===void 0?void 0:$o("",r.message,e,t,n,o),UW=(e,t)=>e===void 0?t:e+`
|
|
75
|
+
`+t;var Nie=(e,t,r,n,o,s)=>{let a=Xae(o,n===r.startIndex&&r.startIndex>0,n===r.endIndex-1&&r.endIndex<t.length);if(s?.plain===!0)return e===n?o.pointer+a:a+" ".repeat(o.pointer.length);if(t[n].disabled){let i=ca(si,o.mutedColor);return e===n?Ke(o,o.pointer,i)+a:a+" ".repeat(o.pointer.length)}return e===n?Ke(o,o.pointer,o.primaryColor)+a:a+" ".repeat(o.pointer.length)};var Uie=(e,t,r,n)=>{if(n?.plain===!0)return e.title;let o=e.title;return t?e.disabled?bt(r.colors,o,ca(Mu,r.mutedColor)):bt(r.colors,o,ca(Mu,r.primaryColor)):e.disabled?bt(r.colors,o,ca(fW,r.mutedColor)):o},DW=(e,t,r,n)=>{let o=t.choices,s=fce(e,o.length,t.maxPerPage),a=[];for(let i=s.startIndex;i<s.endIndex;i++){let c=o[i],u=e===i,f=Nie(e,o,s,i,r,n),p=Uie(c,u,r,n),d=vie(c,u,r,n);a.push(f+p+" "+d)}return a.join(`
|
|
76
|
+
`)};var Die=N(function*(e,t){let r=yield*Rr(t),n=DW(e,t,r),o=Ke(r,r.prefix,r.primaryColor),s=Ke(r,r.pointerSmall,r.mutedColor),a=Zv(o,s,t,r);return rh+UW(a,n)});var Lie=N(function*(e,t){let r=yield*Rr(t),n=t.choices[e].title,o=Ke(r,r.tick,r.successColor),s=Ke(r,r.ellipsis,r.mutedColor);return(Zv(o,s,t,r)??o)+" "+bt(r.colors,n,r.submittedColor)+`
|
|
77
|
+
`});var Bie=(e,t)=>e===0?g(K.NextFrame({state:t.length-1})):g(K.NextFrame({state:e-1})),jie=(e,t)=>e===t.length-1?g(K.NextFrame({state:0})):g(K.NextFrame({state:e+1})),zie=(e,t)=>g(K.NextFrame({state:(e+1)%t.length}));var Hie=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>Die(n,e),Submit:()=>Lie(t,e)});var qie=e=>N(function*(t,r){let o=yield*(yield*ys).columns,s=yield*Rr(e),a=oc+"\x1B[G",i=Zv(s.prefix,s.pointerSmall,e,s,{plain:!0}),c=DW(t,e,s,{plain:!0});return jl(UW(i,c),o)+a});var Wie=e=>(t,r)=>{switch(t.key.name){case"k":case"up":return Bie(r,e.choices);case"j":case"down":return jie(r,e.choices);case"tab":return zie(r,e.choices);case"enter":case"return":{let n=e.choices[r];return n.disabled?g(K.Beep()):g(K.Submit({value:n.value}))}default:return g(K.Beep())}};var Vie=N(function*(e,t){let n=yield*(yield*ys).columns,o=yield*Rr(t),s=oc+"\x1B[G",a=LW(e,o.pointerSmall,o,{plain:!0});return Kv(Qv(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),n,a)+s}),Gie=(e,t,r,n,o)=>{let s=e.value;if(o?.plain===!0)switch(t.type){case"hidden":return"";case"password":return r.passwordMask.repeat(s.length);case"text":return s}if(s.length===0)return"";let a=fe(e.error)?r.errorColor:n?r.submittedColor:ca(Mu,r.primaryColor);switch(t.type){case"hidden":return"";case"password":return Ke(r,r.passwordMask.repeat(s.length),a);case"text":return bt(r.colors,s,a)}},LW=(e,t,r,n)=>fe(e.error)?bp(e.error.value.split(Du),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return sc(t,o.join(`
|
|
78
|
+
`));let s=Ke(r,t,r.errorColor),a=ar(o,i=>Hv(r,i));return`\x1B[s
|
|
79
|
+
`+sc(s,a.join(`
|
|
80
|
+
`))+"\x1B[u"}}):"",Qv=(e,t,r,n,o,s,a=!1)=>{let i=Gie(e,n,o,a,s);return $o(i,n.message,t,r,o,s)},Kie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.prefix,r.primaryColor),o=Ke(r,r.pointerSmall,r.mutedColor),s=Qv(e,n,o,t,r),a=LW(e,r.pointerSmall,r),i=t.type==="password"?r.passwordMask.length:1,c=(e.cursor-e.value.length)*i;return s+a+hW(c)}),Jie=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.tick,r.successColor),o=Ke(r,r.ellipsis,r.mutedColor);return Qv(e,n,o,t,r,void 0,!0)+`
|
|
81
|
+
`}),Zie=e=>{if(e.cursor<=0)return g(K.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return g(K.NextFrame({state:{...e,cursor:n,value:o,error:A()}}))},Qie=e=>g(K.NextFrame({state:{...e,cursor:0,value:"",error:A()}})),Yie=e=>{if(e.cursor<=0)return g(K.Beep());let t=e.cursor-1;return g(K.NextFrame({state:{...e,cursor:t,error:A()}}))},Xie=e=>{if(e.cursor>=e.value.length)return g(K.Beep());let t=Math.min(e.cursor+1,e.value.length);return g(K.NextFrame({state:{...e,cursor:t,error:A()}}))},yW=e=>g(K.NextFrame({state:{...e,cursor:0,error:A()}})),SW=e=>g(K.NextFrame({state:{...e,cursor:e.value.length,error:A()}})),ece=(e,t)=>{if(e.value===t.default)return g(K.Beep());let r=e.value.length===0?t.default:e.value;return g(K.NextFrame({state:{...e,value:r,cursor:r.length,error:A()}}))},tce=(e,t)=>{let r=t.value.slice(0,t.cursor),n=t.value.slice(t.cursor),o=`${r}${e}${n}`,s=t.cursor+e.length;return g(K.NextFrame({state:{...t,cursor:s,value:o,error:A()}}))},rce=e=>(t,r)=>K.$match(r,{Beep:()=>g(Uu),NextFrame:({state:n})=>Kie(n,e),Submit:()=>Jie(t,e)}),nce=e=>(t,r)=>{if(t.key.ctrl)switch(t.key.name){case"u":return Qie(r);case"a":return yW(r);case"e":return SW(r);default:return g(K.Beep())}switch(t.key.name){case"backspace":return Zie(r);case"left":return Yie(r);case"right":return Xie(r);case"home":return yW(r);case"end":return SW(r);case"enter":case"return":{let n=r.value;return Fi(e.validate(n),{onFailure:o=>K.NextFrame({state:{...r,value:n,error:v(o)}}),onSuccess:o=>K.Submit({value:o})})}case"tab":return ece(r,e);default:return tce(Ft(t.input,()=>""),r)}},oce=e=>(t,r)=>Vie(t,e),BW=(e,t)=>{let r={default:"",type:t,validate:g,...e},n={cursor:r.default.length,value:r.default,error:A()};return Nu(n,{render:rce(r),process:nce(r),clear:oce(r)})},sce=N(function*(e){let r=yield*(yield*ys).columns,n=yield*Rr(e),o=oc+"\x1B[G",s=e.active+" "+sc(n.toggleSeparator,e.inactive),a=$o(s,e.message,n.prefix,n.pointerSmall,n,{plain:!0});return jl(a,r)+o}),jW=(e,t,r,n=!1)=>{let o=Ke(r,r.toggleSeparator,r.mutedColor),s=ca(Mu,n?r.submittedColor:r.primaryColor),a=e?t.inactive:bt(r.colors,t.inactive,s);return(e?bt(r.colors,t.active,s):t.active)+" "+sc(o,a)},ace=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.prefix,r.primaryColor),o=Ke(r,r.pointerSmall,r.mutedColor),s=jW(e,t,r),a=$o(s,t.message,n,o,r);return rh+a}),ice=N(function*(e,t){let r=yield*Rr(t),n=Ke(r,r.tick,r.successColor),o=Ke(r,r.ellipsis,r.mutedColor),s=jW(e,t,r,!0);return $o(s,t.message,n,o,r)+`
|
|
82
|
+
`}),EW=g(K.NextFrame({state:!0})),bW=g(K.NextFrame({state:!1})),cce=e=>(t,r)=>{switch(r._tag){case"Beep":return g(Uu);case"NextFrame":return ace(t,e);case"Submit":return ice(t,e)}},uce=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return bW;case"1":case"k":case"left":case"up":return EW;case" ":case"tab":return t?bW:EW;case"enter":case"return":return g(K.Submit({value:t}));default:return g(K.Beep())}},fce=(e,t,r)=>{let n=r===void 0?t:r,o=Math.min(t-n,e-Math.floor(n/2));o<0&&(o=0);let s=Math.min(o+n,t);return{startIndex:o,endIndex:s}};var zW="~effect/cli/Param",Mr="argument",qt="flag",sh={[zW]:{_A:D},pipe(){return ne(this,arguments)}},hE=e=>O(e,zW);var Bu=e=>e.kind==="flag",$r=e=>{let t=r=>e.kind===Mr?pce(e.name,e.primitiveType,r):dce(e.name,e.primitiveType,r);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??A(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},sh)},gE=(e,t)=>$r({name:t,primitiveType:rW,kind:e}),HW=(e,t)=>$r({name:t,primitiveType:Yq,kind:e}),xE=(e,t)=>$r({name:t,primitiveType:eW,kind:e}),yE=(e,t)=>$r({name:t,primitiveType:Xq,kind:e}),SE=(e,t)=>$r({name:t,primitiveType:tW,kind:e}),ah=(e,t,r)=>$r({name:t,primitiveType:nW(r),kind:e}),EE=(e,t,r)=>{let n=r.map(o=>[o,o]);return ah(e,t,n)},Hl=(e,t,r)=>$r({name:t,kind:e,primitiveType:oW(r?.pathType??"either",r?.mustExist),typeName:r?.typeName}),bE=(e,t,r)=>Hl(e,t,{pathType:"directory",typeName:"directory",mustExist:r?.mustExist}),IE=(e,t,r)=>Hl(e,t,{pathType:"file",typeName:"file",mustExist:r?.mustExist}),CE=(e,t)=>$r({name:t,primitiveType:sW,kind:e}),wE=(e,t)=>$r({name:t,primitiveType:vv,kind:e}),TE=(e,t,r)=>$r({name:t,primitiveType:Ov(r),kind:e}),kE=(e,t,r,n)=>$r({name:t,primitiveType:aW(r,n),kind:e}),qW=(e,t)=>ju(qu($r({name:t,primitiveType:iW,kind:e}),{min:1}),r=>Object.fromEntries(r.flatMap(Object.entries))),AE=e=>$r({name:"__never__",primitiveType:cW,kind:e}),lce=/^-+/,WW=l(2,(e,t)=>ua(e,r=>$r({...r,aliases:[...r.aliases,t.replace(lce,"")]}))),vE=l(2,(e,t)=>ua(e,r=>$r({...r,description:v(t)}))),VW=e=>ua(e,t=>$r({...t,hidden:!0})),ju=l(2,(e,t)=>{let r=n=>F(e.parse(n),([o,s])=>[o,t(s)]);return Object.assign(Object.create(sh),{_tag:"Map",kind:e.kind,param:e,f:t,parse:r})}),zu=(e,t,r=[])=>{let n=r.map(o=>()=>o().parse);return Object.assign(Object.create(sh),{_tag:"Transform",kind:e.kind,param:e,alternatives:r,f:t,parse:t(e.parse,n)})},Hu=l(2,(e,t)=>zu(e,r=>n=>I(r(n),([o,s])=>t(s).pipe(F(a=>[o,a]))))),OE=l(3,(e,t,r)=>{let n=ql(e);return zu(e,o=>s=>I(o(s),([a,i])=>Rt({try:()=>t(i),catch:c=>r(c)}).pipe(Jt(c=>new nn({option:n.name,value:globalThis.String(i),expected:c,kind:n.kind})),F(c=>[a,c]))))}),Lu=e=>{let t=r=>e.parse(r).pipe(F(([n,o])=>[n,v(o)]),eC({MissingOption:()=>g([r.arguments,A()]),MissingArgument:()=>g([r.arguments,A()])}));return Object.assign(Object.create(sh),{_tag:"Optional",kind:e.kind,param:e,parse:t})},_E=l(2,(e,t)=>Sn(t)?Hu(Lu(e),Le({onNone:()=>t,onSome:g})):ju(Lu(e),Ft(()=>t))),PE=l(2,(e,t)=>{let r=(o,s)=>new nn({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),n=(o,s)=>Dq(t).pipe(Jt(a=>r(o,a)),I(Le({onNone:()=>k(o),onSome:a=>g([s.arguments,a])})));return zu(e,o=>s=>o(s).pipe(_a(["MissingOption","MissingArgument"],a=>n(a,s))))}),FE=l(2,(e,t)=>{let r=(n,o)=>I(CW(t)?g(t):t,on).pipe(F(s=>[o.arguments,s]),_a("QuitError",()=>k(n)));return zu(e,n=>o=>n(o).pipe(_a(["MissingOption","MissingArgument"],s=>r(s,o))))}),qu=(e,t)=>{let r=ql(e),n=o=>r.kind==="argument"?mce(e,r,o,t):hce(e,r,o,t);return Object.assign(Object.create(sh),{_tag:"Variadic",kind:e.kind,param:e,min:ga(t?.min),max:ga(t?.max),parse:n})},RE=l(3,(e,t,r)=>{if(t<0)throw new Error("between: min must be non-negative");if(r<t)throw new Error("between: max must be greater than or equal to min");return qu(e,{min:t,max:r})}),ME=l(2,(e,t)=>{if(t<0)throw new Error("atMost: max must be non-negative");return qu(e,{max:t})}),$E=l(2,(e,t)=>{if(t<0)throw new Error("atLeast: min must be non-negative");return qu(e,{min:t})}),ih=l(3,(e,t,r)=>Hu(e,N(function*(n){let o=t(n);if(fe(o))return o.value;let s=ql(e);return yield*new nn({option:s.name,value:globalThis.String(n),expected:r(n),kind:s.kind})}))),NE=l(3,(e,t,r)=>ih(e,Fb(t),r)),UE=l(2,(e,t)=>ua(e,r=>$r({...r,typeName:t}))),GW=l(2,(e,t)=>ua(e,r=>$r({...r,optionalValue:t}))),DE=l(2,(e,t)=>{let r=Xa(t);return Hu(e,n=>Jt(r(n),o=>{let s=ql(e);return new nn({option:s.name,value:globalThis.String(n),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),LE=l(2,(e,t)=>zu(e,(r,n)=>o=>Jo(r(o),()=>n[0]()(o)),[t])),BE=l(2,(e,t)=>zu(e,(r,n)=>o=>Jo(F(r(o),([s,a])=>[s,G(a)]),()=>F(n[0]()(o),([s,a])=>[s,X(a)])),[t])),pce=N(function*(e,t,r){if(r.arguments.length===0)return yield*new Dl({argument:e});let n=r.arguments[0],o=yield*Jt(t.parse(n),s=>new nn({option:e,value:n,expected:s,kind:"argument"}));return[r.arguments.slice(1),o]}),dce=N(function*(e,t,r){let n=r.flags[e];if(n===void 0||n.length===0)return yield*new Ul({option:e});let o=n[0],s=yield*Jt(t.parse(o),a=>new nn({option:e,value:o,expected:a,kind:"flag"}));return[r.arguments,s]}),mce=N(function*(e,t,r,n){let o=[],s=n?.min??0,a=n?.max??Number.POSITIVE_INFINITY,i=0,c=r.arguments;for(;c.length>0&&i<a;){let[u,f]=yield*e.parse({flags:r.flags,arguments:c});o.push(f),c=u,i++}return i<s?yield*i===0?new Dl({argument:t.name}):new nn({option:t.name,value:`${i} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind}):[c,o]}),hce=N(function*(e,t,r,n){let o=[],a=[t.name,...t.aliases].flatMap(c=>r.flags[c]??[]),i=a.length;if(Tt(n?.min)&&i<n.min)return yield*i===0?new Ul({option:t.name}):new nn({option:t.name,value:`${i} occurrences`,expected:`at least ${n.min} value${n.min===1?"":"s"}`,kind:t.kind});if(Tt(n?.max)&&i>n.max)return yield*new nn({option:t.name,value:`${i} occurrences`,expected:`at most ${n.max} value${n.max===1?"":"s"}`,kind:t.kind});for(let c of a){let[,u]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(u)}return[r.arguments,o]}),Yv=(e,t)=>{let r=e;switch(r._tag){case"Single":return t.Single(r);case"Map":return t.Map(r);case"Transform":return t.Transform(r);case"Optional":return t.Optional(r);case"Variadic":return t.Variadic(r)}},ua=(e,t)=>Yv(e,{Single:r=>t(r),Map:r=>ju(ua(r.param,t),r.f),Transform:r=>zu(ua(r.param,t),r.f,r.alternatives.map(n=>()=>ua(n(),t))),Optional:r=>Lu(ua(r.param,t)),Variadic:r=>qu(ua(r.param,t),{min:Cr(r.min),max:Cr(r.max)})}),It=e=>Yv(e,{Single:t=>[t],Map:t=>It(t.param),Transform:t=>[...It(t.param),...t.alternatives.flatMap(r=>It(r()))],Optional:t=>It(t.param),Variadic:t=>It(t.param)}),ql=e=>{let t=It(e);if(t.length===0)throw new Error("No Single param found in param structure");if(t.length>1)throw new Error(`Multiple Single params found: ${t.map(r=>r.name).join(", ")}`);return t[0]},Pn=e=>Yv(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:A(),variadicMax:A()}),Map:t=>Pn(t.param),Transform:t=>Pn(t.param),Optional:t=>({...Pn(t.param),isOptional:!0}),Variadic:t=>({...Pn(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var gce=e=>gE(Mr,e),xce=e=>xE(Mr,e),yce=(e,t)=>IE(Mr,e,t),Sce=(e,t)=>bE(Mr,e,t),Ece=e=>yE(Mr,e),bce=e=>SE(Mr,e),Ice=(e,t)=>EE(Mr,e,t),Cce=(e,t)=>Hl(Mr,e,t),wce=e=>CE(Mr,e),Tce=e=>wE(Mr,e),kce=(e,t)=>TE(Mr,e,t),Ace=(e,t,r)=>kE(Mr,e,t,r),vce=AE(Mr),Oce=e=>Lu(e),_ce=l(2,(e,t)=>vE(e,t)),Pce=_E,Fce=l(2,(e,t)=>PE(e,t)),Rce=l(2,(e,t)=>FE(e,t)),Mce=l(e=>hE(e[0]),(e,t)=>qu(e,t)),$ce=l(2,(e,t)=>ju(e,t)),Nce=l(2,(e,t)=>Hu(e,t)),Uce=l(3,(e,t,r)=>OE(e,t,r)),Dce=l(2,(e,t)=>$E(e,t)),Lce=l(2,(e,t)=>ME(e,t)),Bce=l(3,(e,t,r)=>RE(e,t,r)),jce=l(2,(e,t)=>DE(e,t)),zce=(e,t)=>ah(Mr,e,t),Hce=l(2,(e,t)=>UE(e,t)),qce=l(3,(e,t,r)=>NE(e,t,r)),Wce=l(3,(e,t,r)=>ih(e,t,r)),Vce=l(2,(e,t)=>LE(e,t)),Gce=l(2,(e,t)=>BE(e,t));var Wl=ke("effect/cli/CliOutput",{defaultValue:()=>Kce()});var jE=e=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,t=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),Kce=e=>{let t=e?.colors??pE(),r=t?{bold:a=>`\x1B[1m${a}\x1B[0m`,dim:a=>`\x1B[2m${a}\x1B[0m`,cyan:a=>`\x1B[36m${a}\x1B[0m`,green:a=>`\x1B[32m${a}\x1B[0m`,blue:a=>`\x1B[34m${a}\x1B[0m`,yellow:a=>`\x1B[33m${a}\x1B[0m`,magenta:a=>`\x1B[35m${a}\x1B[0m`}:{bold:a=>a,dim:a=>a,cyan:a=>a,green:a=>a,blue:a=>a,yellow:a=>a,magenta:a=>a},n=t?"\x1B[0m":"",o=t?"\x1B[31m":"",s=t?"\x1B[1m":"";return{formatHelpDoc:a=>rue(a,r),formatCliError:a=>jE(a.message),formatError:a=>`
|
|
83
83
|
${s}${o}ERROR${n}
|
|
84
|
-
${
|
|
84
|
+
${jE(a.message)}${n}`,formatErrors:a=>{if(a.length===0)return"";if(a.length===1)return`
|
|
85
85
|
${s}${o}ERROR${n}
|
|
86
|
-
${
|
|
87
|
-
${s}${o}ERRORS${n}`);for(let[,u]of i)for(let f of u)c.push(` ${
|
|
88
|
-
`)},formatVersion:(a,i)=>`${r.bold(a)} ${r.dim("v")}${r.bold(i)}`}},
|
|
89
|
-
`)},
|
|
90
|
-
`)};var jE="~effect/cli/Command/Config/Internal",zE=e=>{let t=[],r=[],n=[];function o(a){let i=Object.create(null);for(let c of Object.keys(a))i[c]=s(a[c]);return i}function s(a){if(Array.isArray(a))return{_tag:"Array",children:a.map(i=>s(i))};if(mE(a)){let i=t.length;return t.push(a),a.kind==="argument"?n.push(a):r.push(a),{_tag:"Param",index:i}}else return{_tag:"Nested",tree:o(a)}}return{[jE]:jE,flags:r,arguments:n,orderedParams:t,tree:o(e)}},KW=zE({}),JW=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(r=>JW(r,t))};case"Nested":return{_tag:"Nested",tree:ZW(e.tree,t)}}},ZW=(e,t)=>{let r=Object.create(null);for(let n of Object.keys(e))r[n]=JW(e[n],t);return r},eO=(e,t)=>{let r=e.orderedParams.length;return{[jE]:jE,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,ZW(t.tree,r))}},tO=(e,t)=>{let r={};for(let o of Object.keys(e))z(r,o,n(e[o]));return r;function n(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map(s=>n(s));case"Nested":return tO(o.tree,t)}}};var fh="~effect/cli/Command",qe=e=>e,tue={...Os({label:"Command",evaluate(){return qe(this).service}})},Fn=e=>{let t=e.config,r=e.contextConfig??KW,n=e.service??gt(`${fh}/${e.name}`),o=e.annotations??nr(),s=e.globalFlags??[],a=e.subcommands??[],i=(p,d)=>Tt(e.handle)?e.handle(p,d):k(new ni({commandPath:d,errors:[]})),c=e.parse??HE(t),u=e.parseContext??HE(r,{allowLeftovers:!0}),f=p=>{let d=[],m=[];for(let w of t.arguments){let T=It(w),M=Pn(w);for(let P of T)d.push({name:P.name,type:P.typeName??th(P.primitiveType),description:P.description,required:!M.isOptional&&(!M.isVariadic||Fb(M.variadicMin,h=>h>0)),variadic:M.isVariadic})}let x=p.length>0?p.join(" "):e.name;a.some(w=>w.commands.some(T=>!T.unlisted))&&(x+=" <subcommand>"),x+=" [flags]";for(let w of d){let T=w.variadic?`<${w.name}...>`:`<${w.name}>`;x+=` ${w.required?T:`[${T}]`}`}for(let w of t.flags){let T=It(w),M=Pn(w);for(let P of T)P.hidden||m.push(qE(P,M))}let y=[];for(let w of a){let T=w.commands.filter(M=>!M.unlisted);T.length!==0&&y.push({group:w.group,commands:ar(T,M=>({name:M.name,alias:M.alias,shortDescription:M.shortDescription,description:M.description??""}))})}let E=e.examples??[];return{description:e.description??"",usage:x,flags:m,annotations:o,...d.length>0&&{args:d},...y.length>0&&{subcommands:y},...E.length>0&&{examples:E}}};return Object.assign(Object.create(tue),{[fh]:fh,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:a,unlisted:e.unlisted??!1,config:t,contextConfig:r,service:n,parse:c,parseContext:u,handle:i,buildHelpDoc:f,...Tt(e.description)?{description:e.description}:{},...Tt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...Tt(e.alias)?{alias:e.alias}:{}})},qE=(e,t)=>{let r=e.aliases.map(o=>o.length===1?`-${o}`:`--${o}`),n=e.typeName??th(e.primitiveType);return{name:e.name,aliases:r,type:e.optionalValue===void 0?n:`[=${n}]`,description:rue(e.description,oi(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},rue=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return Le(e,{onNone:()=>v(r),onSome:n=>v(`${n} ${r}`)})},HE=(e,t)=>N(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*nue(n,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new Zm({arguments:o}):tO(e.tree,s)}),nue=N(function*(e,t){let r=[],n=e.arguments;for(let o of t){let[s,a]=yield*o.parse({flags:e.flags,arguments:n});r.push(a),n=s}return[n,r]}),rO=(e,t,r)=>{let n=qe(e),o=new Set;(a=>{for(let i of a){let c=It(i);for(let u of c)o.add(u.name)}})((r?.contextConfig??n.contextConfig).flags);for(let a of t){let i=qe(a);for(let c of i.config.flags){let u=It(c);for(let f of u)if(o.has(f.name))throw new Jm({option:f.name,parentCommand:e.name,childCommand:a.name})}}};var oue=e=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:oi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:Ov(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},sue=e=>{switch(e.primitiveType._tag){case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:oi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:Ov(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},nO=(e,t=[])=>{let r=qe(e),n=r.config,o=[],s=new Set;for(let[u,f]of[...n.flags,...t].entries()){let p=It(f);for(let d of p)d.kind==="flag"&&(d.hidden||u>=n.flags.length&&s.has(d.name)||(s.add(d.name),o.push({name:d.name,aliases:d.aliases,description:Cr(d.description),type:oue(d),optionalValue:d.optionalValue!==void 0})))}let a=[];for(let u of n.arguments){let f=It(u),p=Pn(u);for(let d of f)d.kind==="argument"&&a.push({name:d.name,description:Cr(d.description),required:!p.isOptional,variadic:p.isVariadic,type:sue(d)})}let i=[],c=[...t,...r.contextConfig.flags];for(let u of e.subcommands)for(let f of u.commands){if(f.unlisted)continue;let p=nO(f,c);i.push(p),f.alias&&f.alias!==f.name&&i.push({...p,name:f.alias})}return{name:e.name,description:e.shortDescription??e.description,flags:o,arguments:a,subcommands:i}},qu=e=>e.type._tag!=="Boolean"&&e.optionalValue!==!0;var lh=e=>e.replace(/'/g,"'\\''"),oO=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),sO=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return e.type._tag==="Boolean"&&t.push(`--no-${e.name}`),t},iue=(e,t)=>{if(e.length===0)return;let r=e.map(sO);t.push(` local ${r.map((n,o)=>`_used_${o}=""`).join(" ")}`),t.push(" for ((i = 1; i < cword; i++)); do"),t.push(' case "${words[i]%%=*}" in'),r.forEach((n,o)=>{t.push(` ${n.join("|")}) _used_${o}=1 ;;`)}),t.push(" esac"),t.push(" done"),t.push(' local _filtered_flags=""'),r.forEach((n,o)=>{t.push(` [[ -n "$_used_${o}" ]] || _filtered_flags+=" ${n.join(" ")}"`)}),t.push("")},cue=(e,t)=>{t.push(`${e}()`),t.push("{"),t.push(' local _cur="$1" _word="$2"; shift 2'),t.push(""),t.push(' local _head="${_cur%"$_word"}"'),t.push(' local _open=""'),t.push(' case "$_head" in'),t.push(` *\\') _open="'" ;;`),t.push(` *\\") _open='"' ;;`),t.push(" esac"),t.push(""),t.push(' local _prefix="$_cur" _committed="$_head"'),t.push(" _prefix=${_prefix//\\\\/}; _prefix=${_prefix//\\\"/}; _prefix=${_prefix//\\'/}"),t.push(" _committed=${_committed//\\\\/}; _committed=${_committed//\\\"/}; _committed=${_committed//\\'/}"),t.push(""),t.push(" COMPREPLY=()"),t.push(" local _choice _rest _match"),t.push(' for _choice in "$@"; do'),t.push(' [[ "$_choice" == "$_prefix"* ]] || continue'),t.push(' _rest="${_choice#"$_committed"}"'),t.push(' case "$_open" in'),t.push(` "'")`),t.push(` if [[ "$_head" == "'" ]]; then`),t.push(" _match=${_rest//\\'/\\'\\\\\\'\\'}"),t.push(" else"),t.push(` [[ "$_rest" == *\\'* ]] && continue`),t.push(' _match="$_rest"'),t.push(" fi"),t.push(" ;;"),t.push(` '"')`),t.push(' _match="${_rest//\\\\/\\\\\\\\}"'),t.push(' _match="${_match//\\$/\\\\$}"'),t.push(' _match="${_match//\\`/\\\\\\`}"'),t.push(' _match="${_match//\\"/\\\\\\"}"'),t.push(" ;;"),t.push(" *)"),t.push(` printf -v _match '%q' "$_rest"`),t.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`),t.push(" ;;"),t.push(" esac"),t.push(' [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"'),t.push(' COMPREPLY+=("$_match")'),t.push(" done"),t.push("}"),t.push("")},QW=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map(r=>`'${lh(r)}'`).join(" ")}`,uue=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return QW(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},fue=(e,t)=>{switch(e._tag){case"Choice":return QW(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},YW=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(oO).join("_")}`;r.push(`${s}()`),r.push("{"),r.push(" local cur prev words cword i"),r.push(t.length===0?" local _command_index=0":' local _command_index="$1"'),r.push(' _init_completion -n "$COMP_WORDBREAKS" || return'),t.length===0&&r.push(' local _comp_word="$2"'),r.push("");let a=e.flags.filter(qu);if(a.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of a){let u=[`--${c.name}`];for(let p of c.aliases)u.push(p.length===1?`-${p}`:`--${p}`);let f=uue(c.type,n);f&&(r.push(` ${u.join("|")})`),r.push(` ${f}`),r.push(" return"),r.push(" ;;"))}r.push(" esac"),r.push("")}if(e.subcommands.length>0){r.push(" # Subcommand dispatch"),r.push(" local cmd _skip_next=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in');for(let c of e.flags){if(!qu(c))continue;let u=sO(c);r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map(f=>`${f}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let u=`_${[...o,c.name].map(oO).join("_")}`;r.push(` ${c.name})`),r.push(` ${u} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}iue(e.flags,r),(e.flags.length>0||e.subcommands.length>0)&&(r.push(" # Complete flags (filtered) and subcommands"),r.push(' if [[ "$cur" == -* ]]; then'),e.flags.length>0&&r.push(' COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )'),r.push(" return"),r.push(" fi"),r.push(""));let i=e.arguments.flatMap((c,u)=>{let f=fue(c.type,n);return f===void 0?[]:[{argument:c,completion:f,index:u}]});if(i.length>0){r.push(" # Positional argument completions"),r.push(" local _position=0 _skip_next=0 _end_of_options=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(" if (( _end_of_options )); then"),r.push(" ((_position += 1))"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in'),r.push(" --) _end_of_options=1 ;;");for(let u of e.flags){let f=sO(u);qu(u)?(r.push(` ${f.join("|")}) _skip_next=1 ;;`),r.push(` ${f.map(p=>`${p}=*`).join("|")}) ;;`)):r.push(` ${f.join("|")}) ;;`)}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:u,completion:f,index:p}of i)u.variadic||(r.push(` ${p})`),r.push(` ${f}`),r.push(" return"),r.push(" ;;"));r.push(" esac");let c=i.find(({argument:u})=>u.variadic);c!==void 0&&(r.push(` if (( _position >= ${c.index} )); then`),r.push(` ${c.completion}`),r.push(" return"),r.push(" fi"))}else if(e.subcommands.length>0){let c=e.subcommands.map(u=>u.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)YW(c,o,r,n)},XW=(e,t)=>{let r=[],n=oO(e),o=`_${n}--choices`;return r.push(`###-begin-${lh(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${lh(e)} --completions bash >> ~/.bashrc`),r.push("#"),r.push(""),r.push("if ! type _init_completion &>/dev/null; then"),r.push(" _init_completion()"),r.push(" {"),r.push(" COMPREPLY=()"),r.push(' local _i _j=0 _piece _line="$COMP_LINE"'),r.push(' words=("${COMP_WORDS[0]}")'),r.push(" cword=0"),r.push(' _line="${_line#*"${COMP_WORDS[0]}"}"'),r.push(" for ((_i = 1; _i < ${#COMP_WORDS[@]}; _i++)); do"),r.push(' _piece="${COMP_WORDS[_i]}"'),r.push(' if [[ "$_line" == [[:blank:]]* ]]; then'),r.push(" ((_j++))"),r.push(' words[_j]="$_piece"'),r.push(" else"),r.push(' words[_j]="${words[_j]}$_piece"'),r.push(" fi"),r.push(" ((_i == COMP_CWORD)) && cword=$_j"),r.push(' _line="${_line#*"$_piece"}"'),r.push(" done"),r.push(' cur="${words[cword]}"'),r.push(' prev=""'),r.push(' ((cword > 0)) && prev="${words[cword-1]}"'),r.push(" return 0"),r.push(" }"),r.push("fi"),r.push(""),cue(o,r),YW(t,[],r,o),r.push(`complete -F _${n} ${lh(e)}`),r.push(`###-end-${lh(e)}-completions-###`),r.join(`
|
|
91
|
-
`)};var
|
|
92
|
-
`)};var
|
|
86
|
+
${jE(a[0].message)}${n}`;let i=new Map;for(let u of a){let f=u._tag??"Error",p=i.get(f)??[];p.push(u),i.set(f,p)}let c=[];c.push(`
|
|
87
|
+
${s}${o}ERRORS${n}`);for(let[,u]of i)for(let f of u)c.push(` ${jE(f.message)}${n}`);return c.join(`
|
|
88
|
+
`)},formatVersion:(a,i)=>`${r.bold(a)} ${r.dim("v")}${r.bold(i)}`}},Jce=e=>e.replace(/\u001B\[[0-9;]*m/g,""),Zce=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Qce=/[\p{Mark}\p{Control}\p{Default_Ignorable_Code_Point}]/gu,Yce=new RegExp("\\p{Emoji_Presentation}","u"),Xce=e=>e<4352?!1:e<=4447||e===9001||e===9002||e>=11904&&e<=12350||e>=12352&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=111359||e>=127488&&e<=127569||e>=131072&&e<=262141,eue=e=>{let t=e.replace(Qce,"");return t.length===0?0:Yce.test(e)||e.includes("\uFE0F")||Xce(t.codePointAt(0))?2:1},Xv=e=>{let t=0;for(let{segment:r}of Zce.segment(Jce(e)))t+=eue(r);return t},tue=(e,t)=>{let r=Xv(e),n=Math.max(0,t-r);return e+" ".repeat(n)},uh=(e,t)=>{let r=Math.max(...e.map(o=>Xv(o.left)))+4,n=t===void 0?r:Math.min(r,t);return e.map(({left:o,right:s})=>` ${tue(o,Math.max(n,Xv(o)+1))}${s}`).join(`
|
|
89
|
+
`)},KW=(e,t)=>t?`${e}, ${t}`:e,rue=(e,t)=>{let r=[];if(e.description&&(r.push(t.bold("DESCRIPTION")),r.push(` ${e.description}`),r.push("")),r.push(t.bold("USAGE")),r.push(` ${t.cyan(e.usage)}`),r.push(""),e.args&&e.args.length>0){r.push(t.bold("ARGUMENTS"));let n=e.args.map(o=>{let s=o.name;o.variadic&&(s+="...");let a=t.green(s),i=t.dim(o.type),c=`${a} ${i}`,u=o.required?"":t.dim(" (optional)"),f=Ft(o.description,()=>"")+u;return{left:c,right:f}});r.push(uh(n,25)),r.push("")}if(e.flags.length>0){r.push(t.bold("FLAGS"));let n=e.flags.map(o=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let a=s.join(", "),i=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:a+i,right:Ft(o.description,()=>"")}});r.push(uh(n)),r.push("")}if(e.globalFlags&&e.globalFlags.length>0){r.push(t.bold("GLOBAL FLAGS"));let n=e.globalFlags.map(o=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let a=s.join(", "),i=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:a+i,right:Ft(o.description,()=>"")}});r.push(uh(n)),r.push("")}if(e.subcommands&&e.subcommands.length>0){let n=e.subcommands.find(o=>o.group===void 0);n&&(r.push(t.bold("SUBCOMMANDS")),r.push(uh(n.commands.map(o=>({left:t.cyan(KW(o.name,o.alias)),right:o.shortDescription??o.description})),20)),e.subcommands.length>1&&r.push(""));for(let o of e.subcommands)o.group!==void 0&&(r.push(t.bold(`${o.group}:`)),r.push(uh(o.commands.map(s=>({left:t.cyan(KW(s.name,s.alias)),right:s.shortDescription??s.description})),20)),r.push(""))}if(e.examples&&e.examples.length>0){r.push(t.bold("EXAMPLES"));let n=!0,o=!1;for(let s of e.examples)s.description?(n||r.push(""),r.push(` ${t.dim(`# ${s.description}`)}`)):o&&r.push(""),r.push(` ${t.cyan(s.command)}`),n=!1,o=!!s.description;r.push("")}return r[r.length-1]===""&&r.pop(),r.join(`
|
|
90
|
+
`)};var zE="~effect/cli/Command/Config/Internal",HE=e=>{let t=[],r=[],n=[];function o(a){let i=Object.create(null);for(let c of Object.keys(a))i[c]=s(a[c]);return i}function s(a){if(Array.isArray(a))return{_tag:"Array",children:a.map(i=>s(i))};if(hE(a)){let i=t.length;return t.push(a),a.kind==="argument"?n.push(a):r.push(a),{_tag:"Param",index:i}}else return{_tag:"Nested",tree:o(a)}}return{[zE]:zE,flags:r,arguments:n,orderedParams:t,tree:o(e)}},JW=HE({}),ZW=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(r=>ZW(r,t))};case"Nested":return{_tag:"Nested",tree:QW(e.tree,t)}}},QW=(e,t)=>{let r=Object.create(null);for(let n of Object.keys(e))r[n]=ZW(e[n],t);return r},tO=(e,t)=>{let r=e.orderedParams.length;return{[zE]:zE,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,QW(t.tree,r))}},rO=(e,t)=>{let r={};for(let o of Object.keys(e))z(r,o,n(e[o]));return r;function n(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map(s=>n(s));case"Nested":return rO(o.tree,t)}}};var fh="~effect/cli/Command",qe=e=>e,nue={...Os({label:"Command",evaluate(){return qe(this).service}})},Fn=e=>{let t=e.config,r=e.contextConfig??JW,n=e.service??gt(`${fh}/${e.name}`),o=e.annotations??nr(),s=e.globalFlags??[],a=e.subcommands??[],i=(p,d)=>Tt(e.handle)?e.handle(p,d):k(new ni({commandPath:d,errors:[]})),c=e.parse??qE(t),u=e.parseContext??qE(r,{allowLeftovers:!0}),f=p=>{let d=[],m=[];for(let w of t.arguments){let T=It(w),M=Pn(w);for(let P of T)d.push({name:P.name,type:P.typeName??th(P.primitiveType),description:P.description,required:!M.isOptional&&(!M.isVariadic||Rb(M.variadicMin,h=>h>0)),variadic:M.isVariadic})}let x=p.length>0?p.join(" "):e.name;a.some(w=>w.commands.some(T=>!T.unlisted))&&(x+=" <subcommand>"),x+=" [flags]";for(let w of d){let T=w.variadic?`<${w.name}...>`:`<${w.name}>`;x+=` ${w.required?T:`[${T}]`}`}for(let w of t.flags){let T=It(w),M=Pn(w);for(let P of T)P.hidden||m.push(WE(P,M))}let y=[];for(let w of a){let T=w.commands.filter(M=>!M.unlisted);T.length!==0&&y.push({group:w.group,commands:ar(T,M=>({name:M.name,alias:M.alias,shortDescription:M.shortDescription,description:M.description??""}))})}let E=e.examples??[];return{description:e.description??"",usage:x,flags:m,annotations:o,...d.length>0&&{args:d},...y.length>0&&{subcommands:y},...E.length>0&&{examples:E}}};return Object.assign(Object.create(nue),{[fh]:fh,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:a,unlisted:e.unlisted??!1,config:t,contextConfig:r,service:n,parse:c,parseContext:u,handle:i,buildHelpDoc:f,...Tt(e.description)?{description:e.description}:{},...Tt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...Tt(e.alias)?{alias:e.alias}:{}})},WE=(e,t)=>{let r=e.aliases.map(o=>o.length===1?`-${o}`:`--${o}`),n=e.typeName??th(e.primitiveType);return{name:e.name,aliases:r,type:e.optionalValue===void 0?n:`[=${n}]`,description:oue(e.description,oi(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},oue=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return Le(e,{onNone:()=>v(r),onSome:n=>v(`${n} ${r}`)})},qE=(e,t)=>N(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*sue(n,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new Zm({arguments:o}):rO(e.tree,s)}),sue=N(function*(e,t){let r=[],n=e.arguments;for(let o of t){let[s,a]=yield*o.parse({flags:e.flags,arguments:n});r.push(a),n=s}return[n,r]}),nO=(e,t,r)=>{let n=qe(e),o=new Set;(a=>{for(let i of a){let c=It(i);for(let u of c)o.add(u.name)}})((r?.contextConfig??n.contextConfig).flags);for(let a of t){let i=qe(a);for(let c of i.config.flags){let u=It(c);for(let f of u)if(o.has(f.name))throw new Jm({option:f.name,parentCommand:e.name,childCommand:a.name})}}};var aue=e=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:oi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:_v(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},iue=e=>{switch(e.primitiveType._tag){case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:oi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:_v(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},oO=(e,t=[])=>{let r=qe(e),n=r.config,o=[],s=new Set;for(let[u,f]of[...n.flags,...t].entries()){let p=It(f);for(let d of p)d.kind==="flag"&&(d.hidden||u>=n.flags.length&&s.has(d.name)||(s.add(d.name),o.push({name:d.name,aliases:d.aliases,description:Cr(d.description),type:aue(d),optionalValue:d.optionalValue!==void 0})))}let a=[];for(let u of n.arguments){let f=It(u),p=Pn(u);for(let d of f)d.kind==="argument"&&a.push({name:d.name,description:Cr(d.description),required:!p.isOptional,variadic:p.isVariadic,type:iue(d)})}let i=[],c=[...t,...r.contextConfig.flags];for(let u of e.subcommands)for(let f of u.commands){if(f.unlisted)continue;let p=oO(f,c);i.push(p),f.alias&&f.alias!==f.name&&i.push({...p,name:f.alias})}return{name:e.name,description:e.shortDescription??e.description,flags:o,arguments:a,subcommands:i}},Wu=e=>e.type._tag!=="Boolean"&&e.optionalValue!==!0;var lh=e=>e.replace(/'/g,"'\\''"),sO=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),aO=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return e.type._tag==="Boolean"&&t.push(`--no-${e.name}`),t},uue=(e,t)=>{if(e.length===0)return;let r=e.map(aO);t.push(` local ${r.map((n,o)=>`_used_${o}=""`).join(" ")}`),t.push(" for ((i = 1; i < cword; i++)); do"),t.push(' case "${words[i]%%=*}" in'),r.forEach((n,o)=>{t.push(` ${n.join("|")}) _used_${o}=1 ;;`)}),t.push(" esac"),t.push(" done"),t.push(' local _filtered_flags=""'),r.forEach((n,o)=>{t.push(` [[ -n "$_used_${o}" ]] || _filtered_flags+=" ${n.join(" ")}"`)}),t.push("")},fue=(e,t)=>{t.push(`${e}()`),t.push("{"),t.push(' local _cur="$1" _word="$2"; shift 2'),t.push(""),t.push(' local _head="${_cur%"$_word"}"'),t.push(' local _open=""'),t.push(' case "$_head" in'),t.push(` *\\') _open="'" ;;`),t.push(` *\\") _open='"' ;;`),t.push(" esac"),t.push(""),t.push(' local _prefix="$_cur" _committed="$_head"'),t.push(" _prefix=${_prefix//\\\\/}; _prefix=${_prefix//\\\"/}; _prefix=${_prefix//\\'/}"),t.push(" _committed=${_committed//\\\\/}; _committed=${_committed//\\\"/}; _committed=${_committed//\\'/}"),t.push(""),t.push(" COMPREPLY=()"),t.push(" local _choice _rest _match"),t.push(' for _choice in "$@"; do'),t.push(' [[ "$_choice" == "$_prefix"* ]] || continue'),t.push(' _rest="${_choice#"$_committed"}"'),t.push(' case "$_open" in'),t.push(` "'")`),t.push(` if [[ "$_head" == "'" ]]; then`),t.push(" _match=${_rest//\\'/\\'\\\\\\'\\'}"),t.push(" else"),t.push(` [[ "$_rest" == *\\'* ]] && continue`),t.push(' _match="$_rest"'),t.push(" fi"),t.push(" ;;"),t.push(` '"')`),t.push(' _match="${_rest//\\\\/\\\\\\\\}"'),t.push(' _match="${_match//\\$/\\\\$}"'),t.push(' _match="${_match//\\`/\\\\\\`}"'),t.push(' _match="${_match//\\"/\\\\\\"}"'),t.push(" ;;"),t.push(" *)"),t.push(` printf -v _match '%q' "$_rest"`),t.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`),t.push(" ;;"),t.push(" esac"),t.push(' [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"'),t.push(' COMPREPLY+=("$_match")'),t.push(" done"),t.push("}"),t.push("")},YW=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map(r=>`'${lh(r)}'`).join(" ")}`,lue=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return YW(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},pue=(e,t)=>{switch(e._tag){case"Choice":return YW(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},XW=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(sO).join("_")}`;r.push(`${s}()`),r.push("{"),r.push(" local cur prev words cword i"),r.push(t.length===0?" local _command_index=0":' local _command_index="$1"'),r.push(' _init_completion -n "$COMP_WORDBREAKS" || return'),t.length===0&&r.push(' local _comp_word="$2"'),r.push("");let a=e.flags.filter(Wu);if(a.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of a){let u=[`--${c.name}`];for(let p of c.aliases)u.push(p.length===1?`-${p}`:`--${p}`);let f=lue(c.type,n);f&&(r.push(` ${u.join("|")})`),r.push(` ${f}`),r.push(" return"),r.push(" ;;"))}r.push(" esac"),r.push("")}if(e.subcommands.length>0){r.push(" # Subcommand dispatch"),r.push(" local cmd _skip_next=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in');for(let c of e.flags){if(!Wu(c))continue;let u=aO(c);r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map(f=>`${f}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let u=`_${[...o,c.name].map(sO).join("_")}`;r.push(` ${c.name})`),r.push(` ${u} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}uue(e.flags,r),(e.flags.length>0||e.subcommands.length>0)&&(r.push(" # Complete flags (filtered) and subcommands"),r.push(' if [[ "$cur" == -* ]]; then'),e.flags.length>0&&r.push(' COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )'),r.push(" return"),r.push(" fi"),r.push(""));let i=e.arguments.flatMap((c,u)=>{let f=pue(c.type,n);return f===void 0?[]:[{argument:c,completion:f,index:u}]});if(i.length>0){r.push(" # Positional argument completions"),r.push(" local _position=0 _skip_next=0 _end_of_options=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(" if (( _end_of_options )); then"),r.push(" ((_position += 1))"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in'),r.push(" --) _end_of_options=1 ;;");for(let u of e.flags){let f=aO(u);Wu(u)?(r.push(` ${f.join("|")}) _skip_next=1 ;;`),r.push(` ${f.map(p=>`${p}=*`).join("|")}) ;;`)):r.push(` ${f.join("|")}) ;;`)}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:u,completion:f,index:p}of i)u.variadic||(r.push(` ${p})`),r.push(` ${f}`),r.push(" return"),r.push(" ;;"));r.push(" esac");let c=i.find(({argument:u})=>u.variadic);c!==void 0&&(r.push(` if (( _position >= ${c.index} )); then`),r.push(` ${c.completion}`),r.push(" return"),r.push(" fi"))}else if(e.subcommands.length>0){let c=e.subcommands.map(u=>u.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)XW(c,o,r,n)},eV=(e,t)=>{let r=[],n=sO(e),o=`_${n}--choices`;return r.push(`###-begin-${lh(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${lh(e)} --completions bash >> ~/.bashrc`),r.push("#"),r.push(""),r.push("if ! type _init_completion &>/dev/null; then"),r.push(" _init_completion()"),r.push(" {"),r.push(" COMPREPLY=()"),r.push(' local _i _j=0 _piece _line="$COMP_LINE"'),r.push(' words=("${COMP_WORDS[0]}")'),r.push(" cword=0"),r.push(' _line="${_line#*"${COMP_WORDS[0]}"}"'),r.push(" for ((_i = 1; _i < ${#COMP_WORDS[@]}; _i++)); do"),r.push(' _piece="${COMP_WORDS[_i]}"'),r.push(' if [[ "$_line" == [[:blank:]]* ]]; then'),r.push(" ((_j++))"),r.push(' words[_j]="$_piece"'),r.push(" else"),r.push(' words[_j]="${words[_j]}$_piece"'),r.push(" fi"),r.push(" ((_i == COMP_CWORD)) && cword=$_j"),r.push(' _line="${_line#*"$_piece"}"'),r.push(" done"),r.push(' cur="${words[cword]}"'),r.push(' prev=""'),r.push(' ((cword > 0)) && prev="${words[cword-1]}"'),r.push(" return 0"),r.push(" }"),r.push("fi"),r.push(""),fue(o,r),XW(t,[],r,o),r.push(`complete -F _${n} ${lh(e)}`),r.push(`###-end-${lh(e)}-completions-###`),r.join(`
|
|
91
|
+
`)};var ac=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),tV=e=>ac(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),mue=(e,t)=>{if(e.length===0)return t.length>0?"__fish_use_subcommand":"";let r=e.map(n=>`__fish_seen_subcommand_from ${n}`).join("; and ");return t.length>0?`${r}; and not __fish_seen_subcommand_from ${t.join(" ")}`:r},iO=e=>{let t=[];for(let r of e.aliases)r.length===1&&t.push(`-s ${r}`);t.push(e.name);for(let r of e.aliases)r.length>1&&t.push(r);return e.type._tag==="Boolean"&&t.push(`no-${e.name}`),`not __fish_contains_opt ${t.join(" ")}`},hue=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return`begin; ${iO(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},gue=e=>{let t=[`-l ${e.name}`];for(let n of e.aliases)n.length===1?t.push(`-s ${n}`):t.push(`-l ${n}`);e.description&&t.push(`-d '${ac(e.description)}'`);let r=Wu(e)?xue(e.type):void 0;return r&&t.push(r),t},xue=e=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(tV).join(" ")}'`;case"Path":return e.pathType==="directory","-r -F";default:return"-r -f"}},yue=e=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(tV).join(" ")}'`;case"Path":return"-r -F";default:return}},rV=(e,t,r,n)=>{let o=t.subcommands.map(c=>c.name),s=mue(r,o),a=s?`-n '${s}'`:"";if(!t.arguments.some(c=>c.type._tag==="Path")){let c=[`complete -c ${e}`];a&&c.push(a),c.push("-f"),n.push(c.join(" "))}for(let c of t.subcommands){let u=[`complete -c ${e}`];a&&u.push(a),u.push(`-f -a '${ac(c.name)}'`),c.description&&u.push(`-d '${ac(c.description)}'`),n.push(u.join(" "))}for(let c of t.flags){let u=Wu(c)?hue(c):iO(c),f=s?`${s}; and ${u}`:u,p=f?`-n '${f}'`:"",d=[`complete -c ${e}`];if(p&&d.push(p),d.push(...gue(c)),n.push(d.join(" ")),c.type._tag==="Boolean"){let m=[`complete -c ${e}`];p&&m.push(p),m.push(`-l no-${c.name}`),c.description&&m.push(`-d '${ac(`Disable ${c.name}`)}'`),n.push(m.join(" "))}}if(t.flags.length>0){let c='not string match -q -- "-*" (commandline -ct)',u=s?`${s}; and ${c}`:c;for(let f of t.flags){let p=`${u}; and ${iO(f)}`,d=f.type._tag==="Boolean",m=[`complete -c ${e}`];if(m.push(`-n '${p}'`),m.push(`-f -a '--${f.name}'`),f.description&&m.push(`-d '${ac(f.description)}'`),n.push(m.join(" ")),d){let x=[`complete -c ${e}`];x.push(`-n '${p}'`),x.push(`-f -a '--no-${f.name}'`),f.description&&x.push(`-d '${ac(`Disable ${f.name}`)}'`),n.push(x.join(" "))}}}for(let c of t.arguments){let u=yue(c.type);if(u){let f=[`complete -c ${e}`];a&&f.push(a),f.push(u),c.description&&f.push(`-d '${ac(c.description)}'`),n.push(f.join(" "))}}for(let c of t.subcommands)rV(e,c,[...r,c.name],n)},nV=(e,t)=>{let r=[];return r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Fish"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions fish > ~/.config/fish/completions/${e}.fish`),r.push("#"),r.push(""),rV(e,t,[],r),r.push(""),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
92
|
+
`)};var ic=e=>{let t=[],r="";for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o>=32&&o<128){r+=e[n]==="'"?"''":e[n];continue}(r!==""||t.length===0)&&t.push(`'${r}'`),r="",t.push(`[char]0x${o.toString(16).toUpperCase().padStart(4,"0")}`)}return(r!==""||t.length===0)&&t.push(`'${r}'`),t.length===1?t[0]:`(${t.join(" + ")})`},oV=e=>`@(${e.map(ic).join(", ")})`,uO=e=>e?ic(e):"$null",Eue=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),bue=e=>[`--${e.name}`,...e.aliases.map(t=>t.length===1?`-${t}`:`--${t}`)],sV=e=>`values = ${oV(e._tag==="Choice"?e.values:[])}; pathType = ${e._tag==="Path"?ic(e.pathType):"$null"}`,Iue=e=>`@{ name = ${ic(e.name)}; forms = ${oV(bue(e))}; takesValue = $${e.type._tag!=="Boolean"}; `+(e.optionalValue===!0?"optionalValue = $true; ":"")+`${sV(e.type)}; description = ${uO(e.description)} }`,Cue=e=>`@{ name = ${ic(e.name)}; variadic = $${e.variadic}; ${sV(e.type)}; description = ${uO(e.description)} }`,cO=(e,t,r)=>{if(r.length===0){e.push(` ${t} = @()`);return}e.push(` ${t} = @(`);for(let n of r)e.push(` ${n}`);e.push(" )")},aV=(e,t,r,n,o)=>{let s=r.join(" ");if(!o.has(s)){o.add(s),n.push(`${e}[${ic(s)}] = @{`),cO(n,"subcommands",t.subcommands.map(a=>`@{ name = ${ic(a.name)}; description = ${uO(a.description)} }`)),cO(n,"flags",t.flags.map(Iue)),cO(n,"arguments",t.arguments.map(Cue)),n.push("}");for(let a of t.subcommands)aV(e,a,[...r,a.name],n,o)}},wue=e=>String.raw` param($wordToComplete, $commandAst, $cursorPosition)
|
|
93
93
|
|
|
94
94
|
$spec = ${e}
|
|
95
95
|
$results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
|
|
@@ -273,20 +273,20 @@ ${s}${o}ERRORS${n}`);for(let[,u]of i)for(let f of u)c.push(` ${BE(f.message)}${
|
|
|
273
273
|
if (-not $endOfOptions) {
|
|
274
274
|
& $addFlags $typed
|
|
275
275
|
}
|
|
276
|
-
return $results`,
|
|
277
|
-
`)};var
|
|
278
|
-
`)};var mV=(e,t,r)=>{switch(t){case"bash":return XW(e,r);case"zsh":return dV(e,r);case"fish":return rV(e,r);case"powershell":return aV(e,r)}};var Wl={};$n(Wl,{Boolean:()=>ph,ChoiceWithValue:()=>WE,Date:()=>_ue,Directory:()=>Mue,File:()=>Rue,FileParse:()=>Uue,FileSchema:()=>Due,FileText:()=>Nue,Finite:()=>Oue,Int:()=>vue,KeyValuePair:()=>Lue,Literals:()=>Pue,Never:()=>Bue,Path:()=>Fue,Redacted:()=>$ue,String:()=>Aue,atLeast:()=>Kue,atMost:()=>Jue,between:()=>Zue,filter:()=>Yue,filterMap:()=>Que,map:()=>Wue,mapEffect:()=>Vue,mapTryCatch:()=>Gue,optional:()=>KE,orElse:()=>Xue,orElseResult:()=>efe,withAlias:()=>VE,withDefault:()=>dh,withDescription:()=>Wu,withFallbackConfig:()=>Hue,withFallbackPrompt:()=>que,withHidden:()=>zue,withMetavar:()=>GE,withOptionalValue:()=>jue,withSchema:()=>tfe});var Aue=e=>hE(qt,e),ph=e=>zW(qt,e),vue=e=>gE(qt,e),Oue=e=>xE(qt,e),_ue=e=>yE(qt,e),WE=(e,t)=>ah(qt,e,t),Pue=(e,t)=>SE(qt,e,t),Fue=(e,t)=>zl(qt,e,t),Rue=(e,t)=>bE(qt,e,t),Mue=(e,t)=>EE(qt,e,t),$ue=e=>IE(qt,e),Nue=e=>CE(qt,e),Uue=(e,t)=>wE(qt,e,t),Due=(e,t,r)=>TE(qt,e,t,r),Lue=e=>HW(qt,e),Bue=kE(qt),VE=l(2,(e,t)=>qW(e,t)),Wu=l(2,(e,t)=>AE(e,t)),jue=l(2,(e,t)=>VW(e,t)),GE=l(2,(e,t)=>NE(e,t)),zue=e=>WW(e),KE=e=>Du(e),dh=OE,Hue=l(2,(e,t)=>_E(e,t)),que=l(2,(e,t)=>PE(e,t)),Wue=l(2,(e,t)=>Bu(e,t)),Vue=l(2,(e,t)=>zu(e,t)),Gue=l(3,(e,t,r)=>vE(e,t,r)),Kue=l(2,(e,t)=>ME(e,t)),Jue=l(2,(e,t)=>RE(e,t)),Zue=l(3,(e,t,r)=>FE(e,t,r)),Que=l(3,(e,t,r)=>ih(e,t,r)),Yue=l(3,(e,t,r)=>$E(e,t,r)),Xue=l(2,(e,t)=>DE(e,t)),efe=l(2,(e,t)=>LE(e,t)),tfe=l(2,(e,t)=>UE(e,t));var lO=e=>{let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r},gV=(e,t)=>{let r=[e],n=e;for(let o=1;o<t.length;o++){let s=t[o],a;for(let i of n.subcommands)if(a=i.commands.find(c=>c.name===s),a)break;if(!a)break;r.push(a),n=a}return r},pO=(e,t,r)=>{let o=gV(e,t).flatMap(s=>qe(s).globalFlags);return lO([...r,...o])},rfe=e=>{let t=[],r=n=>{let o=qe(n);for(let s of o.globalFlags)t.push(s);for(let s of n.subcommands)for(let a of s.commands)r(a)};return r(e),lO(t)},nfe=(e,t)=>{if(e.length<=1)return[];let r=new Set(t.map(o=>o.name)),n=[];for(let o of e.slice(0,-1)){let s=qe(o);for(let a of s.contextConfig.flags){let i=It(a),c=Pn(a);for(let u of i)r.has(u.name)||u.hidden||(r.add(u.name),n.push(qE(u,c)))}}return n},xV=(e,t)=>lO([...t,...rfe(e)]),JE=(e,t,r)=>tt(function*(){let n=gV(e,t),o=n.length>0?n[n.length-1]:e,s=qe(o).buildHelpDoc(t),a=nfe(n,s.flags),i=pO(e,t,r),c=[];for(let u of i){let f=It(u.flag),p=Pn(u.flag);for(let d of f)d.hidden||c.push({...qE(d,p),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var ZE=e=>({_tag:"Action",flag:e.flag,run:e.run}),sfe=e=>t=>{yV+=1;let r=gt(`effect/cli/GlobalFlag/${e}/${yV}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},yV=0,afe=ZE({flag:ph("help").pipe(VE("h"),Wu("Show help information"),dh(!1)),run:N(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*ql,s=yield*JE(r,n,t);yield*Fr(o.formatHelpDoc(s))})}),ife=ZE({flag:ph("version").pipe(VE("v"),Wu("Show version information"),dh(!1)),run:N(function*(e,{command:t,version:r}){let n=yield*ql;yield*Fr(n.formatVersion(t.name,r))})}),dO=ZE({flag:ph("wizard").pipe(Wu("Start wizard mode for a command"),dh(!1)),run:()=>W}),cfe=ZE({flag:WE("completions",[["bash","bash"],["zsh","zsh"],["fish","fish"],["powershell","powershell"],["sh","bash"],["pwsh","powershell"]]).pipe(KE,GE("<bash|zsh|fish|powershell|sh|pwsh>"),Wu("Print shell completion script")),run:N(function*(e,{command:t}){if(me(e))return;let r=nO(t);yield*Fr(mV(t.name,e.value,r))})}),Vl=sfe("log-level")({flag:WE("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(KE,Wu("Sets the minimum log level"),GE("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),SV=[afe,ife,dO,cfe,Vl];var mh=class extends Te("effect/cli/CliConfig",{defaultValue:()=>ufe}){},ufe={builtIns:SV};var ic={};$n(ic,{annotate:()=>Vfe,annotateMerge:()=>Gfe,isCommand:()=>IO,make:()=>Nfe,provide:()=>Jfe,provideEffect:()=>Qfe,provideEffectDiscard:()=>Yfe,provideSync:()=>Zfe,run:()=>nle,runWith:()=>CO,unlisted:()=>Wfe,withAlias:()=>qfe,withDescription:()=>zfe,withExamples:()=>Kfe,withGlobalFlags:()=>jfe,withHandler:()=>Ufe,withSharedFlags:()=>Bfe,withShortDescription:()=>Hfe,withSubcommands:()=>Lfe,wizard:()=>Xfe});function IV(e){let t=e.indexOf("--");return t===-1?{tokens:bV(e),trailingOperands:[]}:{tokens:bV(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var ffe=/^-(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,bV=e=>{let t=[];for(let r of e)if(!r.startsWith("-")||ffe.test(r))t.push({_tag:"Value",value:r});else if(r.startsWith("--")){let n=r.indexOf("=");if(n!==-1){let o=r.slice(2,n),s=r.slice(n+1);t.push({_tag:"LongOption",name:o,raw:r,value:s})}else t.push({_tag:"LongOption",name:r.slice(2),raw:r})}else if(r.length>1){let n=r.slice(1),o=n.indexOf("=");if(o!==-1){let s=n.slice(0,o),a=n.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:a})}else for(let s of n)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:r});return t};var pfe=(e,t)=>{let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let s=0;s<=r;s++)o[s][0]=s;for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let a=1;a<=n;a++){let i=e[s-1]===t[a-1]?0:1;o[s][a]=Math.min(o[s-1][a]+1,o[s][a-1]+1,o[s-1][a-1]+i)}return o[r][n]},hO=(e,t)=>{let r=t.map(o=>[pfe(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(r.length===0)return[];let n=r[0][0];return r.filter(([o])=>o===n).map(([,o])=>o)};var xO=e=>Le(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...xO(t.parsedInput)]}),yO=(e,t,r=[])=>tt(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],a=qe(t),c=a.config.flags.flatMap(It).filter(Lu),u=Kl(c),p=a.contextConfig.flags.flatMap(It).filter(Lu),d=Kl(p),m=new Set(p.map(M=>M.name)),x={command:t,commandPath:s,flagRegistry:u,inheritedFlagRegistry:d,localFlagNames:c.filter(M=>!m.has(M.name)).map(M=>M.name)},y=Tfe(n,x);if(y._tag==="Leaf")return{flags:y.flags,arguments:[...y.arguments,...o],subcommand:A(),...y.errors.length>0&&{errors:y.errors}};let E={tokens:y.childTokens,trailingOperands:o},w=yield*yO(E,y.sub,s),T=[...y.errors,...w.errors??[]];return{flags:y.flags,arguments:[],subcommand:v({name:y.sub.name,parsedInput:w}),...T.length>0&&{errors:T}}}),QE=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},Kl=e=>{let t=new Map;for(let r of e){if(t.has(r.name))throw new Error(`Duplicate flag name "${r.name}" in command definition`);t.set(r.name,r);for(let n of r.aliases){if(t.has(n))throw new Error(`Duplicate flag/alias "${n}" in command definition (conflicts with "${t.get(n).name}")`);t.set(n,r)}}return{params:e,index:t}},TV=e=>{let t=new Map,r=(n,o)=>{let s=t.get(n);if(s&&s!==o)throw new Error(`Duplicate subcommand name/alias "${n}" in command definition (conflicts with "${s.name}")`);t.set(n,o)};for(let n of e)for(let o of n.commands)r(o.name,o),o.alias&&o.alias!==o.name&&r(o.alias,o);return t},SO=e=>Object.fromEntries(e.map(t=>[t.name,[]])),dfe=e=>{let t=SO(e);return{add:(r,n)=>{n!==void 0&&t[r].push(n)},merge:r=>{for(let n in r){let o=r[n];if(o?.length)for(let s=0;s<o.length;s++)t[n].push(o[s])}},snapshot:()=>t}},YE=e=>e._tag==="LongOption"||e._tag==="ShortOption",kV=e=>e._tag==="LongOption"?e.name:e.flag,Gl=(e,t)=>{let r=kV(e),n=t.index.get(r);if(n&&n.name===r)return{param:n,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&iE(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1}},CV=(e,t,r)=>new nn({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),mfe=e=>{let t=oi(e.primitiveType);return new nn({option:e.name,value:"",expected:t===void 0?e.typeName??th(e.primitiveType):t.join(" | "),kind:"flag"})},wV=e=>e?._tag==="Value"&&(Jq(e.value)||Zq(e.value))?e.value:void 0,AV=(e,t,r,n=!1)=>{let o=hh(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},hh=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:CV(t,r,t.value),tokens:[]};let s=r.optionalValue===void 0?wV(e.peek()):void 0;if(s!==void 0){let a=e.take();return{_tag:"Error",error:CV(t,r,s),tokens:a===void 0?[]:[a]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(r.optionalValue!==void 0)return{_tag:"Value",value:r.optionalValue,tokens:[]};if(iE(r.primitiveType)){let s=wV(e.peek()),a=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:a===void 0?[]:[a]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:mfe(r),tokens:[]}},hfe=(e,t)=>{let r=SO(t.params),n=[],o=[],s=QE(e);for(let a=s.take();a;a=s.take()){if(!YE(a)){n.push(a);continue}let i=Gl(a,t);if(!i){n.push(a);continue}let c=AV(s,a,i.param,i.negated);if(c._tag==="Error"){o.push(c.error);continue}c.value!==void 0&&r[i.param.name].push(c.value)}return{flagMap:r,remainder:n,errors:o}},gfe=e=>qe(e).config.flags.flatMap(It).filter(Lu),xfe=e=>qe(e).contextConfig.flags.flatMap(It).filter(Lu),vV=(e,t)=>{for(let r of t){let n=Gl(e,r);if(n!==void 0)return n}},gO=(e,t,r,n)=>{e.push(r);let o=hh(t,r,n.param,n.negated);e.push(...o.tokens)},yfe=(e,t,r,n,o)=>{let s=QE(t);hh(s,e,r.param,r.negated);for(let a=s.take();a;a=s.take()){if(YE(a)){let i=vV(a,o);i!==void 0&&hh(s,a,i.param,i.negated);continue}if(a._tag==="Value")return n.has(a.value)}return!1},OV=(e,t,r)=>{let n=SO(r.params),o=[],s=(a,i,c)=>{let u=Kl(gfe(i)),f=Kl(xfe(i)),p=TV(i.subcommands),d=QE(a),m=[],x=!0;for(let y=d.take();y;y=d.take()){if(YE(y)){let E=vV(y,c);if(E!==void 0){gO(m,d,y,E);continue}let w=Gl(y,f);if(w!==void 0){gO(m,d,y,w);continue}let T=Gl(y,u),M=Gl(y,r);if(T!==void 0&&(M===void 0||!x||!yfe(y,d.rest(),T,p,[u,f,r]))){gO(m,d,y,T);continue}if(M!==void 0){let P=hh(d,y,M.param,M.negated);if(P._tag==="Error"){o.push(P.error);continue}P.value!==void 0&&n[M.param.name].push(P.value);continue}m.push(y);continue}if(y._tag==="Value"&&x){let E=p.get(y.value);if(E!==void 0)return m.push(y),m.push(...s(d.rest(),E,[...c,f])),m;x=!1}m.push(y)}return m};return{flagMap:n,remainder:s(e,t,[]),errors:o}},Sfe=(e,t,r)=>{let n=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let a of t)if(!a.hidden){o.push(a.name),iE(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=hO(kV(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new rc({option:n,suggestions:s,command:r})},Efe=e=>({flags:dfe(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),bfe=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),Ife=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=r,c=TV(o.subcommands),u=c.get(e);if(u){let p=[...s,u.name],d=n.flags.snapshot();for(let x of i){let y=d[x];y!==void 0&&y.length>0&&n.errors.push(new rc({option:`--${x}`,suggestions:[],command:p}))}let m=hfe(t.rest(),a);return n.flags.merge(m.flagMap),n.errors.push(...m.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:u,childTokens:m.remainder,errors:n.errors}}}if(!(qe(o).config.arguments.length>0)&&c.size>0){let p=[];for(let[m,x]of c)x.unlisted||p.push(m);let d=hO(e,p);n.errors.push(new Qm({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},Cfe=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,a=Gl(e,s);if(!a){n.errors.push(Sfe(e,s.params,o));return}let i=AV(t,e,a.param,a.negated);if(i._tag==="Error"){n.errors.push(i.error);return}n.flags.add(a.param.name,i.value)},wfe=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=Ife(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e)},Tfe=(e,t)=>{let r=QE(e),n=Efe(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(YE(o)){Cfe(o,r,t,n);continue}if(o._tag==="Value"){let s=wfe(o.value,r,t,n);if(s)return s}}return bfe(n)};var bO=N(function*(e,t){let r=t?.commandPath??[e.name],n=Afe(e,r),o=(t?.prefix??r).map(a=>bs(a)),{colors:s}=yield*oh;return yield*XE(o,s),yield*FV(n,o,n===e?"ROOT":n.name,s),{args:o.map(a=>a.value),displayArgs:o.map(a=>a.displayValue)}}),Afe=(e,t)=>{let r=e;for(let n of t.slice(1)){let o=r.subcommands.flatMap(s=>s.commands).find(s=>s.name===n||s.alias===n);if(o===void 0)break;r=o}return r},FV=N(function*(e,t,r,n){let o=qe(e),s=e.subcommands.flatMap(c=>c.commands.filter(u=>!u.unlisted)),a=s.length===0?o.config:o.contextConfig;if(a.flags.length>0){yield*Fr(PV(r,"FLAGS",n));for(let c of a.flags)t.push(...yield*_V(c));(a.arguments.length>0||s.length>0)&&(yield*XE(t,n))}if(a.arguments.length>0){yield*Fr(PV(r,"ARGUMENTS",n));for(let c of a.arguments)t.push(...yield*_V(c));s.length>0&&(yield*XE(t,n))}if(s.length===0)return;let i=yield*on(Wv({message:"Command",choices:s.map(c=>({title:c.name,value:c,...c.shortDescription!==void 0?{description:c.shortDescription}:c.description!==void 0?{description:c.description}:{}}))}));yield*Fr(),t.push(bs(i.name)),vfe(i)&&(yield*XE(t,n)),yield*FV(i,t,i.name,n)}),vfe=e=>e.subcommands.some(r=>r.commands.some(n=>!n.unlisted))||qe(e).config.orderedParams.length>0,_V=N(function*(e){let t=Hl(e),r=Pn(e);if(r.isOptional&&!(yield*on(Hv({message:`Set ${EO(t)}?`,initial:!1}))))return yield*Fr(),[];let n=r.isVariadic?yield*on(qv({message:`${EO(t)} count`,default:Ft(r.variadicMin,()=>0),min:Ft(r.variadicMin,()=>0),...fe(r.variadicMax)?{max:r.variadicMax.value}:{}})):1,o=[];for(let a=0;a<n;a++)o.push(yield*Ofe(t));let s=t.kind===qt?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Fr(),t.kind===Mr?o:o.flatMap(a=>t.optionalValue!==void 0||a.value.startsWith("-")&&a.value.length>1?[bs(`--${t.name}=${a.value}`,`--${t.name}=${a.displayValue}`)]:[bs(`--${t.name}`),a])}),Ofe=e=>{let t=Pfe(e);switch(e.primitiveType._tag){case"Boolean":return F(on(Hv({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),r=>bs(String(r)));case"Choice":{let r=oi(e.primitiveType)??[];return F(on(Wv({message:t,choices:r.map(n=>({title:n,value:n}))})),bs)}case"Date":return F(on(wW({message:t})),r=>bs(r.toISOString()));case"Finite":return F(on(TW({message:t})),r=>bs(String(r)));case"Int":return F(on(qv({message:t})),r=>bs(String(r)));case"Redacted":return F(on(kW({message:t})),r=>bs(sa(r),"<redacted>"));default:return F(on(AW({message:t})),bs)}},bs=(e,t=e)=>({value:e,displayValue:t}),_fe=e=>e.kind===qt?`--${e.name}`:e.name,Pfe=e=>EO(e),EO=e=>{let t=Cr(e.description)?.trim(),r=e.kind===qt&&t!==void 0&&t.length<=32?t:Ffe(e.name);return e.kind===qt?`${r} (${_fe(e)})`:r},Ffe=e=>{let t=e.split(/[-_]+/).filter(r=>r.length>0);return t.length===0?e:[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},XE=(e,t)=>Fr(NV("Current command",e.map(r=>r.displayValue),t,lW)),PV=(e,t,r)=>`${bt(r,e.toUpperCase(),si,Ll)} ${bt(r,"\xB7",nh)} ${bt(r,t,si,Mu)}`,RV=(e,t,r,n)=>[`${bt(n,e,si,Ll)} ${bt(n,`v${t}`,Mu)} ${bt(n,"\xB7 Command wizard",si,Mu)}`,...r===void 0||r.length===0?[]:[r],bt(n,"Build a command interactively. Press Ctrl+C to cancel.",nh),""].join(`
|
|
279
|
-
`)
|
|
280
|
-
${bt(e,"Wizard cancelled.",
|
|
281
|
-
`)}
|
|
282
|
-
`):e===".env.example"?
|
|
283
|
-
`,{mode:420}),yield*r.chmod(
|
|
276
|
+
return $results`,iV=(e,t)=>{let r=`$global:_${Eue(e)}_Completions`,n=[];return n.push(`###-begin-${e}-completions-###`),n.push("#"),n.push("# Static completion script for PowerShell"),n.push("#"),n.push("# Installation:"),n.push(`# ${e} --completions powershell > ${e}-completion.ps1`),n.push("# then add this line to your $PROFILE (use the full path to the file):"),n.push(`# . <PATH>\\${e}-completion.ps1`),n.push("#"),n.push(""),n.push(`${r} = [hashtable]::new([System.StringComparer]::Ordinal)`),aV(r,t,[],n,new Set),n.push(""),n.push(`Register-ArgumentCompleter -Native -CommandName ${ic(e)} -ScriptBlock {`),n.push(wue(r)),n.push("}"),n.push(""),n.push(`###-end-${e}-completions-###`),n.join(`
|
|
277
|
+
`)};var lO=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),cV=e=>lO(e).replace(/]/g,"\\]"),pV=e=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),fO=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),kue=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return e.type._tag==="Boolean"&&t.push(`--no-${e.name}`),t},uV=e=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(pV).join(" ")})`;case"Path":return e.pathType==="directory"?":directory:_directories":":file:_files";case"Int":return":integer:";case"Finite":return":float:";case"Date":return":date:";default:return":value:"}},Aue=e=>{switch(e._tag){case"Choice":return`(${e.values.map(pV).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},fV=e=>{let t=[],r=e.description?`[${cV(e.description)}]`:"",n=e.optionalValue===!0&&e.type._tag!=="Boolean",o=n?"=-":"",s=n?`:${uV(e.type)}`:uV(e.type),a=`(${kue(e).join(" ")})`;t.push(`'${a}--${e.name}${o}${r}${s}'`);for(let i of e.aliases){let c=i.length===1?"-":"--";t.push(`'${a}${c}${i}${o}${r}${s}'`)}if(e.type._tag==="Boolean"){let i=e.description?`[${cV(`Disable ${e.name}`)}]`:"";t.push(`'${a}--no-${e.name}${i}'`)}return t},lV=e=>{let t=e.description?lO(e.description):e.name,r=Aue(e.type);return`'${e.variadic?"*":""}:${t}:${r}'`},dV=(e,t,r)=>{let n=[...t,e.name],o=`_${n.map(fO).join("_")}`;if(r.push(`${o}() {`),e.subcommands.length>0){r.push(" local context state state_descr line"),r.push(" typeset -A opt_args"),r.push(""),r.push(" local -a commands"),r.push(" commands=(");for(let s of e.subcommands){let a=s.description?lO(s.description):"";r.push(` '${s.name}:${a}'`)}r.push(" )"),r.push(""),r.push(" local -a specs"),r.push(" specs=(");for(let s of e.flags)for(let a of fV(s))r.push(` ${a}`);if(e.arguments.length>0){r.push(" -"),r.push(" parent-arguments");for(let s of e.arguments)r.push(` ${lV(s)}`);r.push(" -"),r.push(" subcommands")}r.push(" '1:command:->command'"),r.push(" '*::arg:->args'"),r.push(" )"),r.push(""),r.push(' _arguments -C "${specs[@]}"'),r.push(""),r.push(' case "$state" in'),r.push(" command)"),r.push(" _describe -t commands 'commands' commands"),r.push(" ;;"),r.push(" args)"),r.push(' case "$words[1]" in');for(let s of e.subcommands){let a=`_${[...n,s.name].map(fO).join("_")}`;r.push(` ${s.name})`),r.push(` ${a}`),r.push(" ;;")}r.push(" esac"),r.push(" ;;"),r.push(" esac")}else{let s=[];for(let a of e.flags)s.push(...fV(a));for(let a of e.arguments)s.push(lV(a));if(s.length>0){r.push(" local -a specs"),r.push(" specs=(");for(let a of s)r.push(` ${a}`);r.push(" )"),r.push(' _arguments "${specs[@]}"')}}r.push("}"),r.push("");for(let s of e.subcommands)dV(s,n,r)},mV=(e,t)=>{let r=[],n=fO(e);return r.push(`#compdef ${e}`),r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Zsh"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions zsh > ~/.zsh/completions/_${e}`),r.push("# then add ~/.zsh/completions to your fpath"),r.push("#"),r.push(""),dV(t,[],r),r.push("# Handle both direct invocation and autoload"),r.push('if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then'),r.push(` _${n} "$@"`),r.push("else"),r.push(` compdef _${n} ${e}`),r.push("fi"),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
278
|
+
`)};var hV=(e,t,r)=>{switch(t){case"bash":return eV(e,r);case"zsh":return mV(e,r);case"fish":return nV(e,r);case"powershell":return iV(e,r)}};var ai={};$n(ai,{Boolean:()=>ph,ChoiceWithValue:()=>VE,Date:()=>Fue,Directory:()=>Nue,File:()=>$ue,FileParse:()=>Lue,FileSchema:()=>Bue,FileText:()=>Due,Finite:()=>Pue,Int:()=>_ue,KeyValuePair:()=>jue,Literals:()=>Rue,Never:()=>zue,Path:()=>Mue,Redacted:()=>Uue,String:()=>Oue,atLeast:()=>Zue,atMost:()=>Que,between:()=>Yue,filter:()=>efe,filterMap:()=>Xue,map:()=>Gue,mapEffect:()=>Kue,mapTryCatch:()=>Jue,optional:()=>JE,orElse:()=>tfe,orElseResult:()=>rfe,withAlias:()=>GE,withDefault:()=>dh,withDescription:()=>Vu,withFallbackConfig:()=>Wue,withFallbackPrompt:()=>Vue,withHidden:()=>que,withMetavar:()=>KE,withOptionalValue:()=>Hue,withSchema:()=>nfe});var Oue=e=>gE(qt,e),ph=e=>HW(qt,e),_ue=e=>xE(qt,e),Pue=e=>yE(qt,e),Fue=e=>SE(qt,e),VE=(e,t)=>ah(qt,e,t),Rue=(e,t)=>EE(qt,e,t),Mue=(e,t)=>Hl(qt,e,t),$ue=(e,t)=>IE(qt,e,t),Nue=(e,t)=>bE(qt,e,t),Uue=e=>CE(qt,e),Due=e=>wE(qt,e),Lue=(e,t)=>TE(qt,e,t),Bue=(e,t,r)=>kE(qt,e,t,r),jue=e=>qW(qt,e),zue=AE(qt),GE=l(2,(e,t)=>WW(e,t)),Vu=l(2,(e,t)=>vE(e,t)),Hue=l(2,(e,t)=>GW(e,t)),KE=l(2,(e,t)=>UE(e,t)),que=e=>VW(e),JE=e=>Lu(e),dh=_E,Wue=l(2,(e,t)=>PE(e,t)),Vue=l(2,(e,t)=>FE(e,t)),Gue=l(2,(e,t)=>ju(e,t)),Kue=l(2,(e,t)=>Hu(e,t)),Jue=l(3,(e,t,r)=>OE(e,t,r)),Zue=l(2,(e,t)=>$E(e,t)),Que=l(2,(e,t)=>ME(e,t)),Yue=l(3,(e,t,r)=>RE(e,t,r)),Xue=l(3,(e,t,r)=>ih(e,t,r)),efe=l(3,(e,t,r)=>NE(e,t,r)),tfe=l(2,(e,t)=>LE(e,t)),rfe=l(2,(e,t)=>BE(e,t)),nfe=l(2,(e,t)=>DE(e,t));var pO=e=>{let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r},xV=(e,t)=>{let r=[e],n=e;for(let o=1;o<t.length;o++){let s=t[o],a;for(let i of n.subcommands)if(a=i.commands.find(c=>c.name===s),a)break;if(!a)break;r.push(a),n=a}return r},dO=(e,t,r)=>{let o=xV(e,t).flatMap(s=>qe(s).globalFlags);return pO([...r,...o])},ofe=e=>{let t=[],r=n=>{let o=qe(n);for(let s of o.globalFlags)t.push(s);for(let s of n.subcommands)for(let a of s.commands)r(a)};return r(e),pO(t)},sfe=(e,t)=>{if(e.length<=1)return[];let r=new Set(t.map(o=>o.name)),n=[];for(let o of e.slice(0,-1)){let s=qe(o);for(let a of s.contextConfig.flags){let i=It(a),c=Pn(a);for(let u of i)r.has(u.name)||u.hidden||(r.add(u.name),n.push(WE(u,c)))}}return n},yV=(e,t)=>pO([...t,...ofe(e)]),ZE=(e,t,r)=>tt(function*(){let n=xV(e,t),o=n.length>0?n[n.length-1]:e,s=qe(o).buildHelpDoc(t),a=sfe(n,s.flags),i=dO(e,t,r),c=[];for(let u of i){let f=It(u.flag),p=Pn(u.flag);for(let d of f)d.hidden||c.push({...WE(d,p),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var QE=e=>({_tag:"Action",flag:e.flag,run:e.run}),ife=e=>t=>{SV+=1;let r=gt(`effect/cli/GlobalFlag/${e}/${SV}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},SV=0,cfe=QE({flag:ph("help").pipe(GE("h"),Vu("Show help information"),dh(!1)),run:N(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*Wl,s=yield*ZE(r,n,t);yield*Fr(o.formatHelpDoc(s))})}),ufe=QE({flag:ph("version").pipe(GE("v"),Vu("Show version information"),dh(!1)),run:N(function*(e,{command:t,version:r}){let n=yield*Wl;yield*Fr(n.formatVersion(t.name,r))})}),mO=QE({flag:ph("wizard").pipe(Vu("Start wizard mode for a command"),dh(!1)),run:()=>W}),ffe=QE({flag:VE("completions",[["bash","bash"],["zsh","zsh"],["fish","fish"],["powershell","powershell"],["sh","bash"],["pwsh","powershell"]]).pipe(JE,KE("<bash|zsh|fish|powershell|sh|pwsh>"),Vu("Print shell completion script")),run:N(function*(e,{command:t}){if(me(e))return;let r=oO(t);yield*Fr(hV(t.name,e.value,r))})}),Vl=ife("log-level")({flag:VE("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(JE,Vu("Sets the minimum log level"),KE("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),EV=[cfe,ufe,mO,ffe,Vl];var mh=class extends ke("effect/cli/CliConfig",{defaultValue:()=>lfe}){},lfe={builtIns:EV};var cc={};$n(cc,{annotate:()=>Kfe,annotateMerge:()=>Jfe,isCommand:()=>CO,make:()=>Dfe,provide:()=>Qfe,provideEffect:()=>Xfe,provideEffectDiscard:()=>ele,provideSync:()=>Yfe,run:()=>sle,runWith:()=>wO,unlisted:()=>Gfe,withAlias:()=>Vfe,withDescription:()=>qfe,withExamples:()=>Zfe,withGlobalFlags:()=>Hfe,withHandler:()=>Lfe,withSharedFlags:()=>zfe,withShortDescription:()=>Wfe,withSubcommands:()=>jfe,wizard:()=>tle});function CV(e){let t=e.indexOf("--");return t===-1?{tokens:IV(e),trailingOperands:[]}:{tokens:IV(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var pfe=/^-(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,IV=e=>{let t=[];for(let r of e)if(!r.startsWith("-")||pfe.test(r))t.push({_tag:"Value",value:r});else if(r.startsWith("--")){let n=r.indexOf("=");if(n!==-1){let o=r.slice(2,n),s=r.slice(n+1);t.push({_tag:"LongOption",name:o,raw:r,value:s})}else t.push({_tag:"LongOption",name:r.slice(2),raw:r})}else if(r.length>1){let n=r.slice(1),o=n.indexOf("=");if(o!==-1){let s=n.slice(0,o),a=n.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:a})}else for(let s of n)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:r});return t};var mfe=(e,t)=>{let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let s=0;s<=r;s++)o[s][0]=s;for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let a=1;a<=n;a++){let i=e[s-1]===t[a-1]?0:1;o[s][a]=Math.min(o[s-1][a]+1,o[s][a-1]+1,o[s-1][a-1]+i)}return o[r][n]},gO=(e,t)=>{let r=t.map(o=>[mfe(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(r.length===0)return[];let n=r[0][0];return r.filter(([o])=>o===n).map(([,o])=>o)};var yO=e=>Le(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...yO(t.parsedInput)]}),SO=(e,t,r=[])=>tt(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],a=qe(t),c=a.config.flags.flatMap(It).filter(Bu),u=Kl(c),p=a.contextConfig.flags.flatMap(It).filter(Bu),d=Kl(p),m=new Set(p.map(M=>M.name)),x={command:t,commandPath:s,flagRegistry:u,inheritedFlagRegistry:d,localFlagNames:c.filter(M=>!m.has(M.name)).map(M=>M.name)},y=Afe(n,x);if(y._tag==="Leaf")return{flags:y.flags,arguments:[...y.arguments,...o],subcommand:A(),...y.errors.length>0&&{errors:y.errors}};let E={tokens:y.childTokens,trailingOperands:o},w=yield*SO(E,y.sub,s),T=[...y.errors,...w.errors??[]];return{flags:y.flags,arguments:[],subcommand:v({name:y.sub.name,parsedInput:w}),...T.length>0&&{errors:T}}}),YE=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},Kl=e=>{let t=new Map;for(let r of e){if(t.has(r.name))throw new Error(`Duplicate flag name "${r.name}" in command definition`);t.set(r.name,r);for(let n of r.aliases){if(t.has(n))throw new Error(`Duplicate flag/alias "${n}" in command definition (conflicts with "${t.get(n).name}")`);t.set(n,r)}}return{params:e,index:t}},kV=e=>{let t=new Map,r=(n,o)=>{let s=t.get(n);if(s&&s!==o)throw new Error(`Duplicate subcommand name/alias "${n}" in command definition (conflicts with "${s.name}")`);t.set(n,o)};for(let n of e)for(let o of n.commands)r(o.name,o),o.alias&&o.alias!==o.name&&r(o.alias,o);return t},EO=e=>Object.fromEntries(e.map(t=>[t.name,[]])),hfe=e=>{let t=EO(e);return{add:(r,n)=>{n!==void 0&&t[r].push(n)},merge:r=>{for(let n in r){let o=r[n];if(o?.length)for(let s=0;s<o.length;s++)t[n].push(o[s])}},snapshot:()=>t}},XE=e=>e._tag==="LongOption"||e._tag==="ShortOption",AV=e=>e._tag==="LongOption"?e.name:e.flag,Gl=(e,t)=>{let r=AV(e),n=t.index.get(r);if(n&&n.name===r)return{param:n,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&cE(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1}},wV=(e,t,r)=>new nn({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),gfe=e=>{let t=oi(e.primitiveType);return new nn({option:e.name,value:"",expected:t===void 0?e.typeName??th(e.primitiveType):t.join(" | "),kind:"flag"})},TV=e=>e?._tag==="Value"&&(Zq(e.value)||Qq(e.value))?e.value:void 0,vV=(e,t,r,n=!1)=>{let o=hh(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},hh=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:wV(t,r,t.value),tokens:[]};let s=r.optionalValue===void 0?TV(e.peek()):void 0;if(s!==void 0){let a=e.take();return{_tag:"Error",error:wV(t,r,s),tokens:a===void 0?[]:[a]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(r.optionalValue!==void 0)return{_tag:"Value",value:r.optionalValue,tokens:[]};if(cE(r.primitiveType)){let s=TV(e.peek()),a=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:a===void 0?[]:[a]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:gfe(r),tokens:[]}},xfe=(e,t)=>{let r=EO(t.params),n=[],o=[],s=YE(e);for(let a=s.take();a;a=s.take()){if(!XE(a)){n.push(a);continue}let i=Gl(a,t);if(!i){n.push(a);continue}let c=vV(s,a,i.param,i.negated);if(c._tag==="Error"){o.push(c.error);continue}c.value!==void 0&&r[i.param.name].push(c.value)}return{flagMap:r,remainder:n,errors:o}},yfe=e=>qe(e).config.flags.flatMap(It).filter(Bu),Sfe=e=>qe(e).contextConfig.flags.flatMap(It).filter(Bu),OV=(e,t)=>{for(let r of t){let n=Gl(e,r);if(n!==void 0)return n}},xO=(e,t,r,n)=>{e.push(r);let o=hh(t,r,n.param,n.negated);e.push(...o.tokens)},Efe=(e,t,r,n,o)=>{let s=YE(t);hh(s,e,r.param,r.negated);for(let a=s.take();a;a=s.take()){if(XE(a)){let i=OV(a,o);i!==void 0&&hh(s,a,i.param,i.negated);continue}if(a._tag==="Value")return n.has(a.value)}return!1},_V=(e,t,r)=>{let n=EO(r.params),o=[],s=(a,i,c)=>{let u=Kl(yfe(i)),f=Kl(Sfe(i)),p=kV(i.subcommands),d=YE(a),m=[],x=!0;for(let y=d.take();y;y=d.take()){if(XE(y)){let E=OV(y,c);if(E!==void 0){xO(m,d,y,E);continue}let w=Gl(y,f);if(w!==void 0){xO(m,d,y,w);continue}let T=Gl(y,u),M=Gl(y,r);if(T!==void 0&&(M===void 0||!x||!Efe(y,d.rest(),T,p,[u,f,r]))){xO(m,d,y,T);continue}if(M!==void 0){let P=hh(d,y,M.param,M.negated);if(P._tag==="Error"){o.push(P.error);continue}P.value!==void 0&&n[M.param.name].push(P.value);continue}m.push(y);continue}if(y._tag==="Value"&&x){let E=p.get(y.value);if(E!==void 0)return m.push(y),m.push(...s(d.rest(),E,[...c,f])),m;x=!1}m.push(y)}return m};return{flagMap:n,remainder:s(e,t,[]),errors:o}},bfe=(e,t,r)=>{let n=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let a of t)if(!a.hidden){o.push(a.name),cE(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=gO(AV(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new nc({option:n,suggestions:s,command:r})},Ife=e=>({flags:hfe(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),Cfe=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),wfe=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=r,c=kV(o.subcommands),u=c.get(e);if(u){let p=[...s,u.name],d=n.flags.snapshot();for(let x of i){let y=d[x];y!==void 0&&y.length>0&&n.errors.push(new nc({option:`--${x}`,suggestions:[],command:p}))}let m=xfe(t.rest(),a);return n.flags.merge(m.flagMap),n.errors.push(...m.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:u,childTokens:m.remainder,errors:n.errors}}}if(!(qe(o).config.arguments.length>0)&&c.size>0){let p=[];for(let[m,x]of c)x.unlisted||p.push(m);let d=gO(e,p);n.errors.push(new Qm({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},Tfe=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,a=Gl(e,s);if(!a){n.errors.push(bfe(e,s.params,o));return}let i=vV(t,e,a.param,a.negated);if(i._tag==="Error"){n.errors.push(i.error);return}n.flags.add(a.param.name,i.value)},kfe=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=wfe(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e)},Afe=(e,t)=>{let r=YE(e),n=Ife(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(XE(o)){Tfe(o,r,t,n);continue}if(o._tag==="Value"){let s=kfe(o.value,r,t,n);if(s)return s}}return Cfe(n)};var IO=N(function*(e,t){let r=t?.commandPath??[e.name],n=Ofe(e,r),o=(t?.prefix??r).map(a=>bs(a)),{colors:s}=yield*oh;return yield*eb(o,s),yield*RV(n,o,n===e?"ROOT":n.name,s),{args:o.map(a=>a.value),displayArgs:o.map(a=>a.displayValue)}}),Ofe=(e,t)=>{let r=e;for(let n of t.slice(1)){let o=r.subcommands.flatMap(s=>s.commands).find(s=>s.name===n||s.alias===n);if(o===void 0)break;r=o}return r},RV=N(function*(e,t,r,n){let o=qe(e),s=e.subcommands.flatMap(c=>c.commands.filter(u=>!u.unlisted)),a=s.length===0?o.config:o.contextConfig;if(a.flags.length>0){yield*Fr(FV(r,"FLAGS",n));for(let c of a.flags)t.push(...yield*PV(c));(a.arguments.length>0||s.length>0)&&(yield*eb(t,n))}if(a.arguments.length>0){yield*Fr(FV(r,"ARGUMENTS",n));for(let c of a.arguments)t.push(...yield*PV(c));s.length>0&&(yield*eb(t,n))}if(s.length===0)return;let i=yield*on(Vv({message:"Command",choices:s.map(c=>({title:c.name,value:c,...c.shortDescription!==void 0?{description:c.shortDescription}:c.description!==void 0?{description:c.description}:{}}))}));yield*Fr(),t.push(bs(i.name)),_fe(i)&&(yield*eb(t,n)),yield*RV(i,t,i.name,n)}),_fe=e=>e.subcommands.some(r=>r.commands.some(n=>!n.unlisted))||qe(e).config.orderedParams.length>0,PV=N(function*(e){let t=ql(e),r=Pn(e);if(r.isOptional&&!(yield*on(qv({message:`Set ${bO(t)}?`,initial:!1}))))return yield*Fr(),[];let n=r.isVariadic?yield*on(Wv({message:`${bO(t)} count`,default:Ft(r.variadicMin,()=>0),min:Ft(r.variadicMin,()=>0),...fe(r.variadicMax)?{max:r.variadicMax.value}:{}})):1,o=[];for(let a=0;a<n;a++)o.push(yield*Pfe(t));let s=t.kind===qt?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Fr(),t.kind===Mr?o:o.flatMap(a=>t.optionalValue!==void 0||a.value.startsWith("-")&&a.value.length>1?[bs(`--${t.name}=${a.value}`,`--${t.name}=${a.displayValue}`)]:[bs(`--${t.name}`),a])}),Pfe=e=>{let t=Rfe(e);switch(e.primitiveType._tag){case"Boolean":return F(on(qv({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),r=>bs(String(r)));case"Choice":{let r=oi(e.primitiveType)??[];return F(on(Vv({message:t,choices:r.map(n=>({title:n,value:n}))})),bs)}case"Date":return F(on(TW({message:t})),r=>bs(r.toISOString()));case"Finite":return F(on(kW({message:t})),r=>bs(String(r)));case"Int":return F(on(Wv({message:t})),r=>bs(String(r)));case"Redacted":return F(on(AW({message:t})),r=>bs(sa(r),"<redacted>"));default:return F(on(vW({message:t})),bs)}},bs=(e,t=e)=>({value:e,displayValue:t}),Ffe=e=>e.kind===qt?`--${e.name}`:e.name,Rfe=e=>bO(e),bO=e=>{let t=Cr(e.description)?.trim(),r=e.kind===qt&&t!==void 0&&t.length<=32?t:Mfe(e.name);return e.kind===qt?`${r} (${Ffe(e)})`:r},Mfe=e=>{let t=e.split(/[-_]+/).filter(r=>r.length>0);return t.length===0?e:[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},eb=(e,t)=>Fr(UV("Current command",e.map(r=>r.displayValue),t,pW)),FV=(e,t,r)=>`${bt(r,e.toUpperCase(),si,Bl)} ${bt(r,"\xB7",nh)} ${bt(r,t,si,$u)}`,MV=(e,t,r,n)=>[`${bt(n,e,si,Bl)} ${bt(n,`v${t}`,$u)} ${bt(n,"\xB7 Command wizard",si,$u)}`,...r===void 0||r.length===0?[]:[r],bt(n,"Build a command interactively. Press Ctrl+C to cancel.",nh),""].join(`
|
|
279
|
+
`),$V=(e,t)=>UV("Command ready",e,t,Bl,lE),NV=e=>`
|
|
280
|
+
${bt(e,"Wizard cancelled.",fE)}`,UV=(e,t,r,n,o=$u)=>{let s=$fe(t);return[bt(r,e,si,o),...s.map(a=>bt(r,a,n)),""].join(`
|
|
281
|
+
`)},$fe=e=>{let r=" $ ",n=" ",o=e.map(Nfe),s=[],a=r;for(let i of o){let c=a===r||a===n?"":" ";a.length+c.length+i.length>88&&a!==r?(s.push(`${a} \\`),a=`${n}${i}`):a+=`${c}${i}`}return a!==r&&s.push(a),s},Nfe=e=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var CO=e=>O(e,fh),Dfe=(e,t,r)=>{let n=HE(t??{});return Fn({name:e,config:n,...Tt(r)?{handle:r}:{}})},Lfe=l(2,(e,t)=>Fn({...qe(e),handle:t})),Bfe=e=>{let t=[],r=new Map,n=(a,i)=>{t.push(i);let c=r.get(a);c?c.push(i):r.set(a,[i])};for(let a of e){if(CO(a)){n(void 0,a);continue}for(let i of a.commands)n(a.group,i)}let o=[],s=r.get(void 0);s&&s.length>0&&o.push({group:void 0,commands:s});for(let[a,i]of r)a!==void 0&&o.push({group:a,commands:i});return{flat:t,groups:o}},jfe=l(2,(e,t)=>{let r=Bfe(t);nO(e,r.flat);let n=qe(e),o=new Map(r.flat.map(c=>[c.name,qe(c)])),s=Symbol("effect/cli/SubcommandState"),a=N(function*(c){if(me(c.subcommand))return yield*n.parse(c);let u=o.get(c.subcommand.value.name);if(!u)return yield*n.parse(c);let f=yield*n.parseContext(c),p=yield*u.parse(c.subcommand.value.parsedInput);return{...f,[s]:{name:u.name,result:p}}}),i=N(function*(c,u){let p=c[s];if(p){let d=o.get(p.name);return d?yield*d.handle(p.result,[...u,d.name]).pipe(dn(n.service,c)):yield*new ni({commandPath:u,errors:[]})}return yield*n.handle(c,u)});return Fn({name:n.name,config:n.config,contextConfig:n.contextConfig,description:n.description,shortDescription:n.shortDescription,alias:n.alias,unlisted:n.unlisted,annotations:n.annotations,globalFlags:n.globalFlags,examples:n.examples,service:n.service,subcommands:r.groups,parse:a,parseContext:n.parseContext,handle:i})}),zfe=l(2,(e,t)=>{let r=qe(e),n=HE(t),o=tO(r.config,n),s=tO(r.contextConfig,n);if(r.subcommands.length>0){let f=r.subcommands.flatMap(p=>p.commands);nO(e,f,{contextConfig:s})}let a=qE(n,{allowLeftovers:!0}),i=N(function*(f){let p=yield*r.parse(f),d=yield*a(f);return{...p,...d}}),c=N(function*(f){let p=yield*r.parseContext(f),d=yield*a(f);return{...p,...d}}),u=(f,p)=>r.handle(f,p);return Fn({name:r.name,config:o,contextConfig:s,description:r.description,shortDescription:r.shortDescription,alias:r.alias,unlisted:r.unlisted,annotations:r.annotations,globalFlags:r.globalFlags,examples:r.examples,service:r.service,subcommands:r.subcommands,parse:i,parseContext:c,handle:u})}),Hfe=l(2,(e,t)=>{let r=qe(e),n=Array.from(new Set([...r.globalFlags,...t]));return Fn({...r,globalFlags:n})}),qfe=l(2,(e,t)=>Fn({...qe(e),description:t})),Wfe=l(2,(e,t)=>Fn({...qe(e),shortDescription:t})),Vfe=l(2,(e,t)=>Fn({...qe(e),alias:t})),Gfe=e=>Fn({...qe(e),unlisted:!0}),Kfe=l(3,(e,t,r)=>{let n=qe(e);return Fn({...n,annotations:or(n.annotations,t,r)})}),Jfe=l(2,(e,t)=>{let r=qe(e);return Fn({...r,annotations:wc(r.annotations,t)})}),Zfe=l(2,(e,t)=>Fn({...qe(e),examples:t})),tb=(e,t)=>{let r=qe(e);return Fn({...r,handle:(n,o)=>t(r.handle(n,o),n)})},Qfe=l(e=>CO(e[0]),(e,t,r)=>tb(e,(n,o)=>aC(n,typeof t=="function"?t(o):t,r))),Yfe=l(3,(e,t,r)=>tb(e,(n,o)=>dn(n,t,typeof r=="function"?r(o):r))),Xfe=l(3,(e,t,r)=>tb(e,(n,o)=>cC(n,t,typeof r=="function"?r(o):r))),ele=l(2,(e,t)=>tb(e,(r,n)=>Kt(typeof t=="function"?t(n):t,r))),tle=(e,t)=>F(IO(e,t),r=>r.args),rle=(e,t,r,n)=>{let o=new Set(t),s=[],a=new Set;for(let i of e){if(o.has(i))continue;let c=It(i.flag);for(let u of c){let f=r[u.name];if(!f||f.length===0)continue;let p=`--${u.name}`;a.has(p)||(a.add(p),s.push(new nc({option:p,suggestions:[],command:n})))}}return s},nle=(e,t,r)=>tt(function*(){let{builtIns:n}=yield*mh,o=yield*Wl,s=yield*ZE(e,t.commandPath,n);yield*Fr(o.formatHelpDoc(s)),r&&t.errors.length>0&&(yield*aE(o.formatErrors(t.errors)))}),ole=e=>tt(function*(){let t=yield*Wl;yield*aE(t.formatError(e)),e[Mi]=!1}),sle=l(2,(e,t)=>Qy.use(({args:r})=>I(r,n=>wO(e,t)(n)))),wO=(e,t)=>{let r=qe(e);return N(function*(n){let{builtIns:o}=yield*mh,{tokens:s,trailingOperands:a}=CV(n),i=yV(e,o),c=i.flatMap(b=>It(b.flag)),u=Kl(c.filter(Bu)),{flagMap:f,remainder:p,errors:d}=_V(s,e,u),m={flags:f,arguments:[]},x=yield*SO({tokens:p,trailingOperands:a},e),y=[e.name,...yO(x)],E={builtIns:o,command:e,commandPath:y,version:t.version},w=dO(e,y,o),T=rle(i,w,f,y);if(T.length>0||d.length>0){let b=x.errors??[];return yield*new ni({commandPath:y,errors:[...d,...T,...b]})}for(let b of w){if(b._tag!=="Action"||!It(b.flag).some(H=>{let J=f[H.name];return J!==void 0&&J.length>0}))continue;let[,$]=yield*b.flag.parse(m);if(b===mO){let{colors:H}=yield*oh;return yield*tt(function*(){yield*Fr(MV(e.name,t.version,e.description,H));let J=[e.name,...n.filter(_e=>_e!=="--wizard"&&!_e.startsWith("--wizard="))],Ce=yield*IO(e,{commandPath:y,prefix:J});yield*Fr($V(Ce.displayArgs,H)),(yield*on(OW({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))&&(yield*Fr(),yield*wO(e,{...t,renderErrors:!1})(Ce.args.slice(1)))}).pipe(_a("QuitError",()=>Fr(NV(H))))}yield*b.run($,E);return}if(x.errors&&x.errors.length>0)return yield*new ni({commandPath:y,errors:x.errors});let M=yield*Y0(r.parse(x));if(M._tag==="Failure")return yield*new ni({commandPath:y,errors:[M.failure]});let P=r.handle(M.success,[e.name]),h=w.includes(Vl)?(yield*Vl.flag.parse(m))[1]:A();P=dn(P,Vl,h);for(let b of w){if(b._tag!=="Setting"||b===Vl)continue;let[,C]=yield*b.flag.parse(m);P=dn(P,b,C)}let S=Le(h,{onNone:()=>nr(),onSome:b=>xa(kM,b)});yield*pn(P,S)},fd(n=>yv(n)&&n._tag==="ShowHelp"?G(n):X(n),n=>Kt(nle(e,n,t.renderErrors!==!1),k(n))),fd(n=>t.renderErrors!==!1&&yv(n)&&n._tag==="UserError"?G(n):X(n),n=>Kt(ole(n),k(n))),fd(n=>Tq(n)?G(n):X(n),n=>En))};var Vr=class extends $s.TaggedError("CreateAppError"){[Vc.errorReported]=!1};import{randomBytes as fle}from"node:crypto";import{basename as lle,join as OO,resolve as ple}from"node:path";import{Buffer as TO}from"node:buffer";var ale=Ie.decodeUnknownSync(Ie.fromJsonString(Ie.Record(Ie.String,Ie.Unknown)));function rb(e){return e.replaceAll(/[.-]/gu,"_").replace(/^[^a-z]/u,"app_$&").slice(0,58)}function DV(e,t,r){return e==="package.json"?TO.from(`${JSON.stringify({...ale(t.toString()),name:r},null," ")}
|
|
282
|
+
`):e===".env.example"?TO.from(t.toString().replaceAll("starter_dev",`${rb(r)}_dev`).replaceAll("starter_test",`${rb(r)}_test`)):["AGENTS.md","README.md"].includes(e)?TO.from(t.toString().replaceAll("{{appName}}",r)):t}import{Buffer as cle}from"node:buffer";import{dirname as ule,join as AO}from"node:path";import{Buffer as LV}from"node:buffer";var gh=Ie.Record(Ie.String,Ie.String),kO=Ie.Array(Ie.Struct({content:Ie.String,path:Ie.String})),vbe=Ie.decodeUnknownSync(Ie.fromJsonString(kO));function xh(e,t=!1){return t?e.filter(r=>!r.path.startsWith("src/modules/notes/")).map(r=>{if(!["src/server/modules.ts","src/server/workerModules.ts","src/server/migrations.ts","src/client/modules.ts"].includes(r.path))return r;let n=LV.from(r.content,"base64").toString().replace(/^import .* from "#modules\/notes\/.*";\n/gmu,"").replace(/,?\s*\b(?:notesRegistration|notesWorker|notesMigrations)\b/gu,"");return{...r,content:LV.from(n).toString("base64")}}):e}var ile=Ie.Struct({dependencies:gh,devDependencies:gh,engines:gh,imports:gh,name:Ie.String,packageManager:Ie.String,private:Ie.Boolean,scripts:gh,type:Ie.String,version:Ie.String}),Obe=Ie.decodeUnknownSync(Ie.fromJsonString(ile));var BV=Ie.Struct({minimal:Ie.optional(Ie.Boolean),name:Ie.String,version:Ie.String}),nb=".create-app.json",Jl=V.fn("CreateApp.readTemplate")(function*(e){let t=yield*qr.FileSystem;return yield*Ie.decodeUnknownEffect(Ie.fromJsonString(kO))(yield*t.readFileString(e))}),ob=V.fn("CreateApp.writeGeneration")(function*(e,t){let r=yield*qr.FileSystem;yield*r.writeFileString(AO(e,nb),`${JSON.stringify(t,null," ")}
|
|
283
|
+
`,{mode:420}),yield*r.chmod(AO(e,nb),420)}),yh=V.fn("CreateApp.renderTemplate")(function*(e,t,r){let n=yield*qr.FileSystem;for(let o of t){let s=AO(e,o.path),a=yield*V.try({catch:i=>new Vr({message:String(i)}),try:()=>DV(o.path,cle.from(o.content,"base64"),r)});yield*n.makeDirectory(ule(s),{recursive:!0}),yield*n.writeFile(s,a,{mode:420}),yield*n.chmod(s,420)}});function sb(e,t,r=!1){return V.flatMap(Vi.ChildProcessSpawner,n=>n.exitCode(Wa.make("git",t,{cwd:e,stderr:r?"inherit":"pipe",stdout:r?"inherit":"pipe"})))}var vO=V.fn("CreateApp.checkedGit")(function*(e,t){let r=yield*sb(e,t,!0);if(r!==0)return yield*new Vr({message:`git ${t.join(" ")} failed (exit ${r}). The generated files remain in ${e}.`})}),jV=V.fn("CreateApp.initializeGit")(function*(e){return(yield*sb(e,["--version"]).pipe(V.catch(r=>r.reason._tag==="NotFound"?V.succeed(-1):V.fail(r))))!==0||(yield*sb(e,["rev-parse","--git-dir"]))===0?!1:(yield*vO(e,["init","--initial-branch=main"]),!0)}),zV=V.fn("CreateApp.commitGit")(function*(e){let r=(yield*sb(e,["-c","user.useConfigOnly=true","var","GIT_AUTHOR_IDENT"]))===0?[]:["-c","user.name=Create App","-c","user.email=create-app@localhost"];yield*vO(e,["add","--all"]),yield*vO(e,[...r,"commit","-m","Initialize a generated app"])});var HV=V.fn("CreateApp.createApp")(function*(e,t,r){let n=yield*qr.FileSystem,o=ple(e),s=lle(o);if(!/^[a-z0-9][a-z0-9._-]*$/u.test(s)||s.length>214||["node_modules","favicon.ico"].includes(s))return yield*new Vr({message:"The final folder name must be a lowercase npm package name."});if((yield*n.exists(o))&&((yield*n.stat(o)).type!=="Directory"||(yield*n.readDirectory(o)).length>0))return yield*new Vr({message:`Refusing to write into ${e}: the destination must be an empty folder.`});let a=xh(yield*Jl(t),r.minimal);yield*n.makeDirectory(o,{recursive:!0}),yield*yh(o,a,s),yield*ob(o,{...r.minimal?{minimal:!0}:{},name:s,version:r.version}),yield*n.symlink("AGENTS.md",OO(o,"CLAUDE.md"));let i=rb(s);yield*n.writeFileString(OO(o,".env.local"),`DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${i}_dev
|
|
284
284
|
TEST_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${i}_test
|
|
285
|
-
BETTER_AUTH_SECRET=${
|
|
286
|
-
`,{flag:"wx",mode:384});let c=r.git&&(yield*
|
|
285
|
+
BETTER_AUTH_SECRET=${fle(32).toString("base64url")}
|
|
286
|
+
`,{flag:"wx",mode:384});let c=r.git&&(yield*jV(o)),f=yield*(yield*Vi.ChildProcessSpawner).exitCode(Wa.make("pnpm",["run","setup"],{cwd:o,stderr:"inherit",stdout:"inherit"}));for(let d of[...a.map(m=>m.path),"pnpm-lock.yaml"]){let m=OO(o,d);(yield*n.exists(m))&&(yield*n.chmod(m,420))}if(f!==0)return yield*new Vr({message:`pnpm run setup failed (exit ${f}). Run pnpm run setup in ${e} to retry.`});c&&(yield*zV(o));let p=`'${e.replaceAll("'",`'"'"'`)}'`;yield*Ss.log(`Created ${e}.
|
|
287
287
|
|
|
288
288
|
Next steps:
|
|
289
289
|
cd ${p}
|
|
290
|
-
pnpm dev`)});import{join as
|
|
290
|
+
pnpm dev`)});import{join as dle,resolve as mle}from"node:path";import{join as qV}from"node:path";var _O=V.fn("CreateApp.runProcess")(function*(e,t,r){return yield*V.scoped(V.gen(function*(){let o=yield*(yield*Vi.ChildProcessSpawner).spawn(Wa.make(t,r,{cwd:e,stdin:"ignore"})),[s,a,i]=yield*V.all([Oo.mkString(Oo.decodeText(o.stdout)),Oo.mkString(Oo.decodeText(o.stderr)),o.exitCode],{concurrency:"unbounded"});return{code:Number(i),stderr:a,stdout:s}}))}),Rn=V.fn("CreateApp.checkedProcess")(function*(e,t,r){let n=yield*_O(e,t,r);return n.code!==0?yield*new Vr({message:`${t} ${r[0]} failed: ${n.stderr.trim()}`}):n.stdout});var WV=V.fn("CreateApp.historicalTemplate")(function*(e,t){let r=(yield*Rn(e,"npm",["pack",`@shivaedev/create-app@${t}`,"--ignore-scripts","--loglevel=error","--pack-destination",e])).trim();return yield*Rn(e,"tar",["-xzf",qV(e,r),"-C",e]),yield*Jl(qV(e,"package/template.json"))});import{join as Sh}from"node:path";var VV=V.fn("CreateApp.starterPatch")(function*(e,t,r,n,o){let s=yield*qr.FileSystem,a=new Set;for(let m of n)(yield*s.exists(Sh(e,m.path)))||a.add(m.path);let i=n.filter(m=>!a.has(m.path)),c=o.filter(m=>!a.has(m.path)),u=Sh(t,"merge");yield*s.makeDirectory(u),yield*Rn(u,"git",["init","--quiet"]),yield*yh(u,i,r),yield*Rn(u,"git",["add","--all"]);let f=(yield*Rn(u,"git",["write-tree"])).trim();for(let m of i)yield*Rn(e,"git",["hash-object","-w","--",Sh(u,m.path)]);for(let m of yield*s.readDirectory(u))m!==".git"&&(yield*s.remove(Sh(u,m),{recursive:!0}));yield*yh(u,c,r),yield*Rn(u,"git",["add","--all"]);let p=yield*Rn(u,"git",["diff","--cached","--binary","--full-index","--no-renames",f]),d=Sh(t,"starter.patch");return yield*s.writeFileString(d,p),{empty:p.length===0,path:d}});var GV=V.fn("CreateApp.updateApp")(function*(e,t,r){return yield*V.scoped(V.gen(function*(){let n=yield*qr.FileSystem,o=mle(e);if(yield*Rn(o,"git",["rev-parse","--show-toplevel"]),(yield*Rn(o,"git",["status","--porcelain"])).trim()!=="")return yield*new Vr({message:"Refusing to update a dirty working tree. Commit or stash your changes first."});let s=yield*Ie.decodeUnknownEffect(Ie.fromJsonString(BV))(yield*n.readFileString(dle(o,nb))),a=yield*n.makeTempDirectoryScoped({prefix:"create-app-update-"}),i=yield*Jl(t),c=s.version===r?i:yield*WV(a,s.version),u=yield*VV(o,a,s.name,xh(c,s.minimal),xh(i,s.minimal));if(!u.empty){let f=yield*_O(o,"git",["apply","--3way",u.path]);if(f.code!==0){let p=(yield*Rn(o,"git",["diff","--name-only","--diff-filter=U"])).trim();return yield*new Vr({message:p?`Resolve these conflicts, then commit your changes:
|
|
291
291
|
${p}
|
|
292
|
-
The recorded version remains ${s.version}.`:f.stderr.trim()})}}yield*
|
|
292
|
+
The recorded version remains ${s.version}.`:f.stderr.trim()})}}yield*ob(o,{...s,version:r}),yield*Ss.log(`Applied create-app ${r}. Review the changes, run pnpm install and commit when ready.`)}))});var hle=V.gen(function*(){let t=yield*(yield*qr.FileSystem).readFileString(KV(new URL("../package.json",import.meta.url))),{version:r}=yield*Ie.decodeUnknownEffect(Ie.fromJsonString(Ie.Struct({version:Ie.String})))(t),n=KV(new URL("../template.json",import.meta.url)),o=cc.make("update",{},()=>GV(".",n,r)),s=cc.make("create-app",{folder:ch.String("folder").pipe(ch.optional),git:ai.Boolean("git").pipe(ai.withDefault(!0)),minimal:ai.Boolean("minimal").pipe(ai.withDefault(!1),ai.withDescription("Create the starter without the notes example module."))},({folder:a,git:i,minimal:c})=>we.match(a,{onNone:()=>V.fail(new Vr({message:"Provide an app folder or use create-app update."})),onSome:u=>HV(u,n,{git:i,minimal:c,version:r})})).pipe(cc.withSubcommands([o]),cc.withDescription("Create and install a Platform application from the maintained starter."));yield*cc.run(s,{version:r})});hle.pipe(V.tapErrorTag("CreateAppError",e=>Ss.error(`create-app: ${e.message}`)),V.provide(Pq),L$);
|