@shivaedev/create-app 0.6.8 → 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,38 +1,38 @@
1
1
  #!/usr/bin/env node
2
- var cj=Object.defineProperty;var En=(e,t)=>{for(var r in t)cj(e,r,{get:t[r],enumerable:!0})};import{fileURLToPath as nj}from"node:url";var ri={};En(ri,{defaultTeardown:()=>MP,errorExitCode:()=>vl,errorReported:()=>Ys,getErrorExitCode:()=>UP,getErrorReported:()=>DP,makeRunMain:()=>ob});var re=(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}}},cy={pipe(){return re(this,arguments)}},Ps=(function(){function e(){}return e.prototype=cy,e})();var d=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 F=e=>e;var at=e=>()=>e,Dr=at(!0),uf=at(!1),uy=at(null),on=at(void 0),jo=on;function Zn(e,...t){return re(e,t)}function bn(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 Ta(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 ff=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},Gi=new WeakSet,lf=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var wa=0,ww=()=>{wa++};function In(e){return typeof e=="string"}function pf(e){return typeof e=="number"}function gd(e){return typeof e=="boolean"}function kw(e){return typeof e=="bigint"}function fy(e){return typeof e=="symbol"}function xd(e){return In(e)||pf(e)||fy(e)}function Cn(e){return typeof e=="function"}function Fs(e){return e===void 0}function pt(e){return e!==void 0}function df(e){return e!==null}function Aw(e){return e==null}function yd(e){return e!=null}function vw(e){return!1}function ly(e){return!0}function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mf(e){return typeof e=="object"&&e!==null||Cn(e)}var A=d(2,(e,t)=>mf(e)&&t in e),Br=d(2,(e,t)=>A(e,"_tag")&&e._tag===t);function Ow(e){return e instanceof Error}function Qn(e){return A(e,Symbol.iterator)||In(e)}var Y="~effect/Hash",q=e=>{switch(typeof e){case"number":return dt(e);case"bigint":return Ae(e.toString(10));case"string":return Ae(e);case"function":case"object":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Ae("Invalid Date"):Ae(e.toISOString());if(e instanceof RegExp)return Ae(e.toString());{if(Gi.has(e))return Sd(e);let t=Pw.get(e);if(t!==void 0)return t;if(my.has(e))return ww(),Ae("[Circular]");my.add(e);let r=wa,n;try{Y in e?n=e[Y]():typeof e=="function"?n=Sd(e):e instanceof DataView?n=Yn(lf(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=Yn(e):e instanceof Map?n=fj(e):e instanceof Set?n=lj(e):n=gf(e)}finally{my.delete(e)}return r===wa&&Pw.set(e,n),n}}}return Bt(Fw(Ae(String(e))))},Sd=e=>(dy.has(e)||dy.set(e,Bt(Math.random()*4294967296|0)),dy.get(e)),Fw=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),ie=d(2,(e,t)=>Fw(Math.imul(e,2654435761)+Math.imul(t,2246822507))),Bt=e=>e&3221225471|e>>>1&1073741824;var py=new DataView(new ArrayBuffer(8)),dt=e=>{let t=e|0;return t===e?Bt(t):(py.setFloat64(0,e!==e?NaN:e),Bt(ie(py.getInt32(0),py.getInt32(4))))},Ae=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return Bt(t)},hf=(e,t)=>{let r=12289;for(let n of t)r^=ie(q(n),q(e[n]));return Bt(r)},gf=e=>hf(e,ff(e)),Rw=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return Bt(n)},Yn=e=>{let t=6151;for(let r of e)t=ie(t,q(r));return Bt(t)},fj=Rw(Ae("Map"),([e,t])=>ie(q(e),q(t))),_w=Ae("Set"),lj=Rw(_w,e=>ie(_w,q(e))),dy=new WeakMap,Pw=new WeakMap,my=new WeakSet;var X="~effect/Equal";function W(){return arguments.length===1?e=>ka(e,arguments[0]):ka(arguments[0],arguments[1])}function ka(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"||Gi.has(e)||Gi.has(t)?!1:pj(e,t)}function pj(e,t){let r=Ed.length;for(let s=r;s-- >0;)if(Ed[s]===e&&hy[s]===t)return!0;if(r)return $w(e,t);let n=Nw.get(e);n||Nw.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=$w(e,t)),o}function $w(e,t){Ed.push(e),hy.push(t);try{return dj(e,t)}finally{Ed.pop(),hy.pop()}}var Ed=[],hy=[],Nw=new WeakMap;function dj(e,t){if(q(e)!==q(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=Uw(e);if(r!==Uw(t)||typeof e=="function"&&!r)return!1;if(r)return e[X](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:mj(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?Mw(lf(e),lf(t)):Mw(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:gy(e,t,gj,xj);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:gy(e,t,q,ka)}return hj(e,t)}function mj(e,t){for(let r=0;r<e.length;r++)if(!ka(e[r],t[r]))return!1;return!0}function Mw(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 hj(e,t){let r=ff(e),n=ff(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!ka(e[o],t[o]))return!1;return!0}function gy(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 gj=e=>q(e[0]),xj=(e,t)=>ka(e[0],t[0])&&ka(e[1],t[1]),yj=()=>0;function bd(e,t){return xf((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function xf(e){return function(r,n){return gy(r,n,yj,e)}}var Uw=e=>A(e,X);var Dw=e=>(Gi.add(e),e);var Aa=Symbol.for("~effect/Redactable"),Sj=e=>A(e,Aa);function zo(e){return Sj(e)?xy(e):e}function xy(e){return e[Aa](globalThis[Ki]?.context??Ej)}var Ki="~effect/Fiber/currentFiber",Lw=new Map,Ej={"~effect/Context":{},base:Lw,depth:0,mapUnsafe:Lw,pipe(){return re(this,arguments)}};function N(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r=="number"?" ".repeat(r):r:"",s=u=>o.repeat(u),a=(u,l)=>{let p=u?.constructor;return p&&p!==Object.prototype.constructor&&p.name?`${p.name}(${l})`:l},i=u=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){try{return f(u,l)}catch{return(typeof u=="object"&&u!==null||typeof u=="function")&&n.delete(u),"[inspection threw]"}}function f(u,l=0){if(typeof u=="string")return JSON.stringify(u);if(typeof u=="number"||u==null||typeof u=="boolean"||typeof u=="symbol")return String(u);if(typeof u=="bigint")return String(u)+"n";if(typeof u=="object"||typeof u=="function"){if(n.has(u))return bj;n.add(u);let p;if(Aa in u)p=c(xy(u),l);else if(Array.isArray(u))p=!o||u.length<=1?`[${u.map(h=>c(h,l)).join(",")}]`:`[
2
+ var cj=Object.defineProperty;var En=(e,t)=>{for(var r in t)cj(e,r,{get:t[r],enumerable:!0})};import{fileURLToPath as nj}from"node:url";var ri={};En(ri,{defaultTeardown:()=>UP,errorExitCode:()=>vl,errorReported:()=>Ys,getErrorExitCode:()=>DP,getErrorReported:()=>LP,makeRunMain:()=>ob});var re=(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}}},cy={pipe(){return re(this,arguments)}},Ps=(function(){function e(){}return e.prototype=cy,e})();var d=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 F=e=>e;var at=e=>()=>e,Dr=at(!0),uf=at(!1),uy=at(null),on=at(void 0),jo=on;function Zn(e,...t){return re(e,t)}function bn(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 Ta(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 ff=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},Gi=new WeakSet,lf=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var wa=0,kw=()=>{wa++};function In(e){return typeof e=="string"}function pf(e){return typeof e=="number"}function gd(e){return typeof e=="boolean"}function Aw(e){return typeof e=="bigint"}function fy(e){return typeof e=="symbol"}function xd(e){return In(e)||pf(e)||fy(e)}function Cn(e){return typeof e=="function"}function Fs(e){return e===void 0}function pt(e){return e!==void 0}function df(e){return e!==null}function vw(e){return e==null}function yd(e){return e!=null}function Ow(e){return!1}function ly(e){return!0}function Lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mf(e){return typeof e=="object"&&e!==null||Cn(e)}var A=d(2,(e,t)=>mf(e)&&t in e),Br=d(2,(e,t)=>A(e,"_tag")&&e._tag===t);function _w(e){return e instanceof Error}function Qn(e){return A(e,Symbol.iterator)||In(e)}var Y="~effect/Hash",q=e=>{switch(typeof e){case"number":return dt(e);case"bigint":return Ae(e.toString(10));case"string":return Ae(e);case"function":case"object":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Ae("Invalid Date"):Ae(e.toISOString());if(e instanceof RegExp)return Ae(e.toString());{if(Gi.has(e))return Sd(e);let t=Fw.get(e);if(t!==void 0)return t;if(my.has(e))return kw(),Ae("[Circular]");my.add(e);let r=wa,n;try{Y in e?n=e[Y]():typeof e=="function"?n=Sd(e):e instanceof DataView?n=Yn(lf(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=Yn(e):e instanceof Map?n=fj(e):e instanceof Set?n=lj(e):n=gf(e)}finally{my.delete(e)}return r===wa&&Fw.set(e,n),n}}}return Bt(Rw(Ae(String(e))))},Sd=e=>(dy.has(e)||dy.set(e,Bt(Math.random()*4294967296|0)),dy.get(e)),Rw=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),ie=d(2,(e,t)=>Rw(Math.imul(e,2654435761)+Math.imul(t,2246822507))),Bt=e=>e&3221225471|e>>>1&1073741824;var py=new DataView(new ArrayBuffer(8)),dt=e=>{let t=e|0;return t===e?Bt(t):(py.setFloat64(0,e!==e?NaN:e),Bt(ie(py.getInt32(0),py.getInt32(4))))},Ae=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return Bt(t)},hf=(e,t)=>{let r=12289;for(let n of t)r^=ie(q(n),q(e[n]));return Bt(r)},gf=e=>hf(e,ff(e)),$w=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return Bt(n)},Yn=e=>{let t=6151;for(let r of e)t=ie(t,q(r));return Bt(t)},fj=$w(Ae("Map"),([e,t])=>ie(q(e),q(t))),Pw=Ae("Set"),lj=$w(Pw,e=>ie(Pw,q(e))),dy=new WeakMap,Fw=new WeakMap,my=new WeakSet;var X="~effect/Equal";function W(){return arguments.length===1?e=>ka(e,arguments[0]):ka(arguments[0],arguments[1])}function ka(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"||Gi.has(e)||Gi.has(t)?!1:pj(e,t)}function pj(e,t){let r=Ed.length;for(let s=r;s-- >0;)if(Ed[s]===e&&hy[s]===t)return!0;if(r)return Nw(e,t);let n=Mw.get(e);n||Mw.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=Nw(e,t)),o}function Nw(e,t){Ed.push(e),hy.push(t);try{return dj(e,t)}finally{Ed.pop(),hy.pop()}}var Ed=[],hy=[],Mw=new WeakMap;function dj(e,t){if(q(e)!==q(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=Dw(e);if(r!==Dw(t)||typeof e=="function"&&!r)return!1;if(r)return e[X](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:mj(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?Uw(lf(e),lf(t)):Uw(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:gy(e,t,gj,xj);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:gy(e,t,q,ka)}return hj(e,t)}function mj(e,t){for(let r=0;r<e.length;r++)if(!ka(e[r],t[r]))return!1;return!0}function Uw(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 hj(e,t){let r=ff(e),n=ff(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!ka(e[o],t[o]))return!1;return!0}function gy(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 gj=e=>q(e[0]),xj=(e,t)=>ka(e[0],t[0])&&ka(e[1],t[1]),yj=()=>0;function bd(e,t){return xf((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function xf(e){return function(r,n){return gy(r,n,yj,e)}}var Dw=e=>A(e,X);var Lw=e=>(Gi.add(e),e);var Aa=Symbol.for("~effect/Redactable"),Sj=e=>A(e,Aa);function zo(e){return Sj(e)?xy(e):e}function xy(e){return e[Aa](globalThis[Ki]?.context??Ej)}var Ki="~effect/Fiber/currentFiber",Bw=new Map,Ej={"~effect/Context":{},base:Bw,depth:0,mapUnsafe:Bw,pipe(){return re(this,arguments)}};function N(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r=="number"?" ".repeat(r):r:"",s=u=>o.repeat(u),a=(u,l)=>{let p=u?.constructor;return p&&p!==Object.prototype.constructor&&p.name?`${p.name}(${l})`:l},i=u=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){try{return f(u,l)}catch{return(typeof u=="object"&&u!==null||typeof u=="function")&&n.delete(u),"[inspection threw]"}}function f(u,l=0){if(typeof u=="string")return JSON.stringify(u);if(typeof u=="number"||u==null||typeof u=="boolean"||typeof u=="symbol")return String(u);if(typeof u=="bigint")return String(u)+"n";if(typeof u=="object"||typeof u=="function"){if(n.has(u))return bj;n.add(u);let p;if(Aa in u)p=c(xy(u),l);else if(Array.isArray(u))p=!o||u.length<=1?`[${u.map(h=>c(h,l)).join(",")}]`:`[
3
3
  ${s(l+1)}${u.map(h=>c(h,l+1)).join(`,
4
4
  `+s(l+1))}
5
- ${s(l)}]`;else if(u instanceof Date)p=yy(u);else if(!t?.ignoreToString&&A(u,"toString")&&typeof u.toString=="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let h=Ij(u);p=u instanceof Error&&u.cause!==void 0?`${h} (cause: ${c(u.cause,l)})`:h}else if(Symbol.iterator in u)p=`${u.constructor.name}(${c(Array.from(u),l)})`;else{let h=i(u);if(!o||h.length<=1){let g=`{${h.map(x=>`${Xn(x)}:${c(jw(u,x),l)}`).join(",")}}`;p=a(u,g)}else{let g=`{
6
- ${h.map(x=>`${s(l+1)}${Xn(x)}: ${c(jw(u,x),l+1)}`).join(`,
5
+ ${s(l)}]`;else if(u instanceof Date)p=yy(u);else if(!t?.ignoreToString&&A(u,"toString")&&typeof u.toString=="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let h=Ij(u);p=u instanceof Error&&u.cause!==void 0?`${h} (cause: ${c(u.cause,l)})`:h}else if(Symbol.iterator in u)p=`${u.constructor.name}(${c(Array.from(u),l)})`;else{let h=i(u);if(!o||h.length<=1){let g=`{${h.map(x=>`${Xn(x)}:${c(zw(u,x),l)}`).join(",")}}`;p=a(u,g)}else{let g=`{
6
+ ${h.map(x=>`${s(l+1)}${Xn(x)}: ${c(zw(u,x),l+1)}`).join(`,
7
7
  `)}
8
- ${s(l)}}`;p=a(u,g)}}return n.delete(u),p}return String(u)}return c(e,0)}var bj="[Circular]";function Xn(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Id(e){return e.map(t=>`[${Xn(t)}]`).join("")}function yy(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Ij(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function jw(e,t){try{return e[t]}catch{return"[property access threw]"}}function va(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=A(s,Aa)?zo(s):zo(o);if(typeof a=="bigint")return N(a);if(typeof a!="object"||a===null)return a;let i=a instanceof Error&&!A(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),!Cj(i)||Tj(i))return i;let c=new Proxy(i,{get(f,u){let l=Reflect.get(f,u,f);return Object.getOwnPropertyDescriptor(f,u)?.get!==void 0?zo(l):l}});return r.push(c),c},t?.space)??"null"}function Cj(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function Tj(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 qe=Symbol.for("nodejs.util.inspect.custom"),Ot=e=>{try{return e=zo(e),A(e,"toJSON")&&Cn(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Ot):e}catch{return"[toJSON threw]"}},qw=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?va(e,{space:t}):N(e,{space:t})}catch{return String(e)}},mt={toJSON(){return Ot(this)},[qe](){return this.toJSON()},toString(){return N(this.toJSON())}},zw=class{[qe](){return this.toJSON()}toString(){return N(this.toJSON())}};var kj=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},Aj=kj(),Tn=()=>Error.stackTraceLimit,jt=e=>{Aj&&(Error.stackTraceLimit=e)};var Rs=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})}},vj=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Tn();if(n===0)return r[e];jt(2);let o=t[e](()=>new Error);return jt(n),o.stack?.includes(e)===!0?t[e]:r[e]},$s=vj();function U(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function Cd(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&U(e,r,t[r])}var no="~effect/Effect",Oa="~effect/Exit",_j={_A:F,_E:F,_R:F},Sy=`${no}/identifier`,fe=`${no}/args`,Ge=`${no}/evaluate`,_t=`${no}/successCont`,jr=`${no}/failureCont`,_a=`${no}/ensureCont`,Fa=Symbol.for("effect/Effect/Yield"),er={pipe(){return re(this,arguments)},toJSON(){return{...this}},toString(){return N(this.toJSON(),{ignoreToString:!0,space:2})},[qe](){return this.toJSON()}},Ww={[Y](){return hf(this,Object.keys(this))},[X](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]||!W(this[t[n]],e[t[n]]))return!1;return!0}},Pj={[no]:_j,...er,[Symbol.iterator](){return new Rs(this)},toJSON(){return{_id:"Effect",op:this[Sy],...fe in this?{args:this[fe]}:void 0}}},se=e=>A(e,no),Ef=e=>A(e,Oa),Td="~effect/Cause",yf="~effect/Cause/Reason",Qi=e=>A(e,Td),Vw=e=>A(e,yf),to=class{constructor(t){this[Td]=Td,this.reasons=t}pipe(){return re(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${N(this.reasons)})`}[qe](){return this.toJSON()}[X](t){return Qi(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>W(r,t.reasons[n]))}[Y](){return Yn(this.reasons)}},Hw=new WeakMap,Ji=class{[yf];annotations;_tag;constructor(t,r,n){if(this[yf]=yf,this._tag=t,r!==bf&&typeof n=="object"&&n!==null&&r.size>0){let o=Hw.get(n);o&&(r=new Map([...o,...r])),Hw.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 re(this,arguments)}toString(){return N(this)}[qe](){return this.toString()}},bf=new Map,Pa=class extends Ji{constructor(t,r=bf){super("Fail",r,t),this.error=t}toString(){return`Fail(${N(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[X](t){return oo(t)&&W(this.error,t.error)&&W(this.annotations,t.annotations)}[Y](){return ie(Ae(this._tag))(ie(q(this.error))(q(this.annotations)))}},qo=e=>new to(e),Fj=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=q(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>W(i,o)))continue;a.push(o)}n.push(o)}return n},Yi=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new to(Fj(e.reasons,t.reasons));return W(e,r)?e:r}),Ey=new to([]),If=e=>new to([new Pa(e)]),Sf=class extends Ji{constructor(t,r=bf){super("Die",r,t),this.defect=t}toString(){return`Die(${N(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[X](t){return Tf(t)&&W(this.defect,t.defect)&&W(this.annotations,t.annotations)}[Y](){return ie(Ae(this._tag))(ie(q(this.defect))(q(this.annotations)))}},by=e=>new to([new Sf(e)]),Cf=d(e=>Qi(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new to(e.reasons.map(n=>n.annotate(t,r)))),oo=e=>e._tag==="Fail",Tf=e=>e._tag==="Die",wf=e=>e._tag==="Interrupt";function Rj(e){return qr("Effect.evaluate: Not implemented")}var zr=e=>({...Pj,[Sy]:e.op,[Ge]:e[Ge]??Rj,[_t]:e[_t],[jr]:e[jr],[_a]:e[_a]}),sn=e=>{let t=zr(e),r=function(n){this[fe]=n};return r.prototype=t,function(n){return new r(n)}},Gw=e=>{let t={[Oa]:Oa,_tag:e.op,get[e.prop](){return this[fe]},...zr(e),toString(){return`${e.op}(${N(this[fe])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[fe]}},[X](n){return Ef(n)&&n._tag===this._tag&&W(this[fe],n[fe])},[Y](){return ie(Ae(e.op),q(this[fe]))}},r=function(n){this[fe]=n};return r.prototype=t,function(n){return new r(n)}},Fe=Gw({op:"Success",prop:"value",[Ge](e){let t=e.getCont(_t);return t?t[_t](this[fe],e,this):e.yieldWith(this)}}),kd={key:"effect/Cause/StackTrace"},Iy={key:"effect/Cause/InterruptorStackTrace"},ur=Gw({op:"Failure",prop:"cause",[Ge](e){let t=this[fe],r=!1;e.cache.stackFrame&&(t=Cf(t,{mapUnsafe:new Map([[kd.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(jr),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=Sy in n,n=e.getCont(jr);s&&(t=qo(t.reasons.filter(a=>a._tag!=="Fail"))),t=Yi(t,o),r=!0}return n?n[jr](t,e,r?void 0:this):e.yieldWith(r?ur(t):this)}}),an=e=>ur(If(e)),qr=e=>ur(by(e)),ce=sn({op:"WithFiber",[Ge](e){return this[fe](e)}}),Kw=sn({op:"WithFiberSucceed",[Ge](e){let t=this[fe](e),r=e.getCont(_t);return r?r[_t](t,e):e.yieldWith(Fe(t))}}),$j=(function(){class e extends globalThis.Error{}let t=zr({op:"YieldableError",[Ge](){return an(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),kf=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends $j{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Cd(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Ho=e=>{class t extends kf{_tag=e}return t.prototype.name=e,t},wd="~effect/Cause/NoSuchElementError",Cy=e=>A(e,wd),ro=class extends Ho("NoSuchElementError"){[wd]=wd;constructor(t){super({message:t})}},Zi="~effect/Cause/Done",Jw=e=>A(e,Zi),Zw={[Zi]:Zi,_tag:"Done",value:void 0},Xi=e=>e===void 0?Zw:{[Zi]:Zi,_tag:"Done",value:e},Nj=an(Zw),Qw=e=>e===void 0?Nj:an(Xi(e));var ao=e=>zr({op:e.label,[Ge]:e.evaluate});var yr=e=>(t,r)=>t===r||e(t,r),Mj=(e,t)=>e===t,Ra=()=>Mj;function Yw(e){return yr((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 Ad(e){return yr((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 Xw=e=>d(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),ek=e=>d(2,(t,r)=>e(t,n=>({[r]:n}))),tk=(e,t)=>d(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var rk="~effect/Option",nk={[rk]:{_A:e=>e},...er,[Symbol.iterator](){return new Rs(this)}},Dj=Object.defineProperty(Object.assign(Object.create(nk),{_tag:"Some",_op:"Some",[X](e){return vd(e)&&wy(e)&&W(this.value,e.value)},[Y](){return ie(q(this._tag))(q(this.value))},toString(){return`some(${N(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Ot(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Lj=q("None"),Bj=Object.assign(Object.create(nk),{_tag:"None",_op:"None",valueOrUndefined:void 0,[X](e){return vd(e)&&Ty(e)},[Y](){return Lj},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),vd=e=>A(e,rk),Ty=e=>e._tag==="None",wy=e=>e._tag==="Some",ok=Object.create(Bj),sk=function(e){this.value=e};sk.prototype=Dj;var ak=e=>new sk(e);var ik="~effect/Result",ck={[ik]:{_A:e=>e,_E:e=>e},...er,[Symbol.iterator](){return new Rs(this)}},zj=Object.assign(Object.create(ck),{_tag:"Success",_op:"Success",[X](e){return Od(e)&&Ay(e)&&W(this.success,e.success)},[Y](){return ie(q(this._tag))(q(this.success))},toString(){return`success(${N(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Ot(this.success)}}}),qj=Object.assign(Object.create(ck),{_tag:"Failure",_op:"Failure",[X](e){return Od(e)&&ky(e)&&W(this.failure,e.failure)},[Y](){return ie(q(this._tag))(q(this.failure))},toString(){return`failure(${N(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Ot(this.failure)}}}),Od=e=>A(e,ik),ky=e=>e._tag==="Failure",Ay=e=>e._tag==="Success",uk=function(e){this.failure=e};uk.prototype=qj;var fk=e=>new uk(e),lk=function(e){this.success=e};lk.prototype=zj;var pk=e=>new lk(e);function tc(e){return(t,r)=>t===r?0:e(t,r)}var dk=tc((e,t)=>e<t?-1:1),Vo=tc((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 rc=tc((e,t)=>e<t?-1:1);var vy=d(2,(e,t)=>tc((r,n)=>e(t(r),t(n)))),nc=vy(Vo,e=>e.getTime());var _d=e=>d(2,(t,r)=>e(t,r)===-1),oc=e=>d(2,(t,r)=>e(t,r)===1),Pd=e=>d(2,(t,r)=>e(t,r)!==1),Fd=e=>d(2,(t,r)=>e(t,r)!==-1);var v=()=>ok,R=ak,$d=vd,Ke=Ty,ve=wy,Re=d(2,(e,{onNone:t,onSome:r})=>Ke(e)?t():r(e.value));var bt=d(2,(e,t)=>Ke(e)?t():e.value);var $a=e=>e==null?v():R(e),Ns=e=>e===void 0?v():R(e),mk=e=>e===null?v():R(e);var Oy=bt(uy),tr=bt(on),io=e=>(...t)=>{try{return R(e(...t))}catch{return v()}};var sc=d(2,(e,t)=>Ke(e)?v():R(t(e.value)));var Nd=d(2,(e,t)=>Ke(e)?v():t(e.value));var ac=Nd(F);var ic=d(2,(e,t)=>Ke(e)?v():t(e.value)?R(e.value):v());var hk=d(2,(e,t)=>t(e)?R(e):v());var gk=d(2,(e,t)=>Ke(e)?!1:t(e.value));var xk="~effect/Context/Service",Ye=function(){function e(){}let t=e;Object.setPrototypeOf(t,Wj);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[Py]=Py,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&yk.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},Wj={[xk]:xk,...ao({label:"Service",evaluate(e){return Fe(ct(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Go(this,e)},use(e){return ce(t=>e(ct(t.context,this)))},useSync(e){return ce(t=>Fe(e(ct(t.context,this))))}},yk=new Set,Py="~effect/Context/Reference",Sk="~effect/Context",Vj=8,Gj=8,Fy=(e,t,r,n)=>{let o=Object.create(Jj);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},Ry=(e,t)=>{t&&(Ry(e,t.parent),e.set(t.key,t.value))},Ek=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Ry(t,e.overlay),e._flat=t},Kj=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),cc(r)},Md=Symbol(),$y=(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)?Md:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=Gj&&(r.base=Ek(r),r.overlay=void 0,r.depth=0),n)},cc=e=>Fy(void 0,e,void 0,0),Jj={get mapUnsafe(){return Ek(this)},...er,[Sk]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[X](e){if(!Ny(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)||!W(o,r.get(n)))return!1;return!0},[Y](){return dt(this.mapUnsafe.size)}},bk=(e,t)=>e.cacheRoot===t.cacheRoot,Ny=e=>A(e,Sk);var Ik=e=>!!e[Py],fr=()=>Zj,Zj=cc(new Map),Go=(e,t)=>cc(new Map([[e.key,t]])),rr=d(3,(e,t,r)=>Qj(e,t.key,r)),Qj=(e,t,r)=>{let n=e,o=yk.has(t)?void 0:n.cacheRoot;if(n.depth>=Vj){let s=new Map(n._flat??n.base);return n._flat||Ry(s,n.overlay),s.set(t,r),Fy(o,s,void 0,0)}return Fy(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Ud=d(2,(e,t)=>Af(e,t.key)),Af=(e,t)=>{let r=$y(e,t);return r===Md?void 0:r},co=d(2,(e,t)=>{let r=$y(e,t.key);if(r===Md){if(Ik(t))return Ck(t);throw Yj(t)}return r}),ct=co,_y="~effect/Context/defaultValue",Ck=e=>_y in e?e[_y]:e[_y]=e.defaultValue(),Yj=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
8
+ ${s(l)}}`;p=a(u,g)}}return n.delete(u),p}return String(u)}return c(e,0)}var bj="[Circular]";function Xn(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Id(e){return e.map(t=>`[${Xn(t)}]`).join("")}function yy(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Ij(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function zw(e,t){try{return e[t]}catch{return"[property access threw]"}}function va(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=A(s,Aa)?zo(s):zo(o);if(typeof a=="bigint")return N(a);if(typeof a!="object"||a===null)return a;let i=a instanceof Error&&!A(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),!Cj(i)||Tj(i))return i;let c=new Proxy(i,{get(f,u){let l=Reflect.get(f,u,f);return Object.getOwnPropertyDescriptor(f,u)?.get!==void 0?zo(l):l}});return r.push(c),c},t?.space)??"null"}function Cj(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function Tj(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 qe=Symbol.for("nodejs.util.inspect.custom"),Ot=e=>{try{return e=zo(e),A(e,"toJSON")&&Cn(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Ot):e}catch{return"[toJSON threw]"}},Hw=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?va(e,{space:t}):N(e,{space:t})}catch{return String(e)}},mt={toJSON(){return Ot(this)},[qe](){return this.toJSON()},toString(){return N(this.toJSON())}},qw=class{[qe](){return this.toJSON()}toString(){return N(this.toJSON())}};var kj=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},Aj=kj(),Tn=()=>Error.stackTraceLimit,jt=e=>{Aj&&(Error.stackTraceLimit=e)};var Rs=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})}},vj=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Tn();if(n===0)return r[e];jt(2);let o=t[e](()=>new Error);return jt(n),o.stack?.includes(e)===!0?t[e]:r[e]},$s=vj();function U(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function Cd(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&U(e,r,t[r])}var no="~effect/Effect",Oa="~effect/Exit",_j={_A:F,_E:F,_R:F},Sy=`${no}/identifier`,fe=`${no}/args`,Ge=`${no}/evaluate`,_t=`${no}/successCont`,jr=`${no}/failureCont`,_a=`${no}/ensureCont`,Fa=Symbol.for("effect/Effect/Yield"),er={pipe(){return re(this,arguments)},toJSON(){return{...this}},toString(){return N(this.toJSON(),{ignoreToString:!0,space:2})},[qe](){return this.toJSON()}},Vw={[Y](){return hf(this,Object.keys(this))},[X](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]||!W(this[t[n]],e[t[n]]))return!1;return!0}},Pj={[no]:_j,...er,[Symbol.iterator](){return new Rs(this)},toJSON(){return{_id:"Effect",op:this[Sy],...fe in this?{args:this[fe]}:void 0}}},se=e=>A(e,no),Ef=e=>A(e,Oa),Td="~effect/Cause",yf="~effect/Cause/Reason",Qi=e=>A(e,Td),Gw=e=>A(e,yf),to=class{constructor(t){this[Td]=Td,this.reasons=t}pipe(){return re(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${N(this.reasons)})`}[qe](){return this.toJSON()}[X](t){return Qi(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>W(r,t.reasons[n]))}[Y](){return Yn(this.reasons)}},Ww=new WeakMap,Ji=class{[yf];annotations;_tag;constructor(t,r,n){if(this[yf]=yf,this._tag=t,r!==bf&&typeof n=="object"&&n!==null&&r.size>0){let o=Ww.get(n);o&&(r=new Map([...o,...r])),Ww.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 re(this,arguments)}toString(){return N(this)}[qe](){return this.toString()}},bf=new Map,Pa=class extends Ji{constructor(t,r=bf){super("Fail",r,t),this.error=t}toString(){return`Fail(${N(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[X](t){return oo(t)&&W(this.error,t.error)&&W(this.annotations,t.annotations)}[Y](){return ie(Ae(this._tag))(ie(q(this.error))(q(this.annotations)))}},qo=e=>new to(e),Fj=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=q(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>W(i,o)))continue;a.push(o)}n.push(o)}return n},Yi=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new to(Fj(e.reasons,t.reasons));return W(e,r)?e:r}),Ey=new to([]),If=e=>new to([new Pa(e)]),Sf=class extends Ji{constructor(t,r=bf){super("Die",r,t),this.defect=t}toString(){return`Die(${N(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[X](t){return Tf(t)&&W(this.defect,t.defect)&&W(this.annotations,t.annotations)}[Y](){return ie(Ae(this._tag))(ie(q(this.defect))(q(this.annotations)))}},by=e=>new to([new Sf(e)]),Cf=d(e=>Qi(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new to(e.reasons.map(n=>n.annotate(t,r)))),oo=e=>e._tag==="Fail",Tf=e=>e._tag==="Die",wf=e=>e._tag==="Interrupt";function Rj(e){return qr("Effect.evaluate: Not implemented")}var zr=e=>({...Pj,[Sy]:e.op,[Ge]:e[Ge]??Rj,[_t]:e[_t],[jr]:e[jr],[_a]:e[_a]}),sn=e=>{let t=zr(e),r=function(n){this[fe]=n};return r.prototype=t,function(n){return new r(n)}},Kw=e=>{let t={[Oa]:Oa,_tag:e.op,get[e.prop](){return this[fe]},...zr(e),toString(){return`${e.op}(${N(this[fe])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[fe]}},[X](n){return Ef(n)&&n._tag===this._tag&&W(this[fe],n[fe])},[Y](){return ie(Ae(e.op),q(this[fe]))}},r=function(n){this[fe]=n};return r.prototype=t,function(n){return new r(n)}},Fe=Kw({op:"Success",prop:"value",[Ge](e){let t=e.getCont(_t);return t?t[_t](this[fe],e,this):e.yieldWith(this)}}),kd={key:"effect/Cause/StackTrace"},Iy={key:"effect/Cause/InterruptorStackTrace"},ur=Kw({op:"Failure",prop:"cause",[Ge](e){let t=this[fe],r=!1;e.cache.stackFrame&&(t=Cf(t,{mapUnsafe:new Map([[kd.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(jr),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=Sy in n,n=e.getCont(jr);s&&(t=qo(t.reasons.filter(a=>a._tag!=="Fail"))),t=Yi(t,o),r=!0}return n?n[jr](t,e,r?void 0:this):e.yieldWith(r?ur(t):this)}}),an=e=>ur(If(e)),qr=e=>ur(by(e)),ce=sn({op:"WithFiber",[Ge](e){return this[fe](e)}}),Jw=sn({op:"WithFiberSucceed",[Ge](e){let t=this[fe](e),r=e.getCont(_t);return r?r[_t](t,e):e.yieldWith(Fe(t))}}),$j=(function(){class e extends globalThis.Error{}let t=zr({op:"YieldableError",[Ge](){return an(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),kf=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends $j{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Cd(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Ho=e=>{class t extends kf{_tag=e}return t.prototype.name=e,t},wd="~effect/Cause/NoSuchElementError",Cy=e=>A(e,wd),ro=class extends Ho("NoSuchElementError"){[wd]=wd;constructor(t){super({message:t})}},Zi="~effect/Cause/Done",Zw=e=>A(e,Zi),Qw={[Zi]:Zi,_tag:"Done",value:void 0},Xi=e=>e===void 0?Qw:{[Zi]:Zi,_tag:"Done",value:e},Nj=an(Qw),Yw=e=>e===void 0?Nj:an(Xi(e));var ao=e=>zr({op:e.label,[Ge]:e.evaluate});var yr=e=>(t,r)=>t===r||e(t,r),Mj=(e,t)=>e===t,Ra=()=>Mj;function Xw(e){return yr((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 Ad(e){return yr((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 ek=e=>d(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),tk=e=>d(2,(t,r)=>e(t,n=>({[r]:n}))),rk=(e,t)=>d(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var nk="~effect/Option",ok={[nk]:{_A:e=>e},...er,[Symbol.iterator](){return new Rs(this)}},Dj=Object.defineProperty(Object.assign(Object.create(ok),{_tag:"Some",_op:"Some",[X](e){return vd(e)&&wy(e)&&W(this.value,e.value)},[Y](){return ie(q(this._tag))(q(this.value))},toString(){return`some(${N(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Ot(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Lj=q("None"),Bj=Object.assign(Object.create(ok),{_tag:"None",_op:"None",valueOrUndefined:void 0,[X](e){return vd(e)&&Ty(e)},[Y](){return Lj},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),vd=e=>A(e,nk),Ty=e=>e._tag==="None",wy=e=>e._tag==="Some",sk=Object.create(Bj),ak=function(e){this.value=e};ak.prototype=Dj;var ik=e=>new ak(e);var ck="~effect/Result",uk={[ck]:{_A:e=>e,_E:e=>e},...er,[Symbol.iterator](){return new Rs(this)}},zj=Object.assign(Object.create(uk),{_tag:"Success",_op:"Success",[X](e){return Od(e)&&Ay(e)&&W(this.success,e.success)},[Y](){return ie(q(this._tag))(q(this.success))},toString(){return`success(${N(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Ot(this.success)}}}),qj=Object.assign(Object.create(uk),{_tag:"Failure",_op:"Failure",[X](e){return Od(e)&&ky(e)&&W(this.failure,e.failure)},[Y](){return ie(q(this._tag))(q(this.failure))},toString(){return`failure(${N(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Ot(this.failure)}}}),Od=e=>A(e,ck),ky=e=>e._tag==="Failure",Ay=e=>e._tag==="Success",fk=function(e){this.failure=e};fk.prototype=qj;var lk=e=>new fk(e),pk=function(e){this.success=e};pk.prototype=zj;var dk=e=>new pk(e);function tc(e){return(t,r)=>t===r?0:e(t,r)}var mk=tc((e,t)=>e<t?-1:1),Vo=tc((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 rc=tc((e,t)=>e<t?-1:1);var vy=d(2,(e,t)=>tc((r,n)=>e(t(r),t(n)))),nc=vy(Vo,e=>e.getTime());var _d=e=>d(2,(t,r)=>e(t,r)===-1),oc=e=>d(2,(t,r)=>e(t,r)===1),Pd=e=>d(2,(t,r)=>e(t,r)!==1),Fd=e=>d(2,(t,r)=>e(t,r)!==-1);var v=()=>sk,R=ik,$d=vd,Ke=Ty,ve=wy,Re=d(2,(e,{onNone:t,onSome:r})=>Ke(e)?t():r(e.value));var bt=d(2,(e,t)=>Ke(e)?t():e.value);var $a=e=>e==null?v():R(e),Ns=e=>e===void 0?v():R(e),hk=e=>e===null?v():R(e);var Oy=bt(uy),tr=bt(on),io=e=>(...t)=>{try{return R(e(...t))}catch{return v()}};var sc=d(2,(e,t)=>Ke(e)?v():R(t(e.value)));var Nd=d(2,(e,t)=>Ke(e)?v():t(e.value));var ac=Nd(F);var ic=d(2,(e,t)=>Ke(e)?v():t(e.value)?R(e.value):v());var gk=d(2,(e,t)=>t(e)?R(e):v());var xk=d(2,(e,t)=>Ke(e)?!1:t(e.value));var yk="~effect/Context/Service",Ye=function(){function e(){}let t=e;Object.setPrototypeOf(t,Wj);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[Py]=Py,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&Sk.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},Wj={[yk]:yk,...ao({label:"Service",evaluate(e){return Fe(ct(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Go(this,e)},use(e){return ce(t=>e(ct(t.context,this)))},useSync(e){return ce(t=>Fe(e(ct(t.context,this))))}},Sk=new Set,Py="~effect/Context/Reference",Ek="~effect/Context",Vj=8,Gj=8,Fy=(e,t,r,n)=>{let o=Object.create(Jj);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},Ry=(e,t)=>{t&&(Ry(e,t.parent),e.set(t.key,t.value))},bk=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Ry(t,e.overlay),e._flat=t},Kj=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),cc(r)},Md=Symbol(),$y=(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)?Md:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=Gj&&(r.base=bk(r),r.overlay=void 0,r.depth=0),n)},cc=e=>Fy(void 0,e,void 0,0),Jj={get mapUnsafe(){return bk(this)},...er,[Ek]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[X](e){if(!Ny(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)||!W(o,r.get(n)))return!1;return!0},[Y](){return dt(this.mapUnsafe.size)}},Ik=(e,t)=>e.cacheRoot===t.cacheRoot,Ny=e=>A(e,Ek);var Ck=e=>!!e[Py],fr=()=>Zj,Zj=cc(new Map),Go=(e,t)=>cc(new Map([[e.key,t]])),rr=d(3,(e,t,r)=>Qj(e,t.key,r)),Qj=(e,t,r)=>{let n=e,o=Sk.has(t)?void 0:n.cacheRoot;if(n.depth>=Vj){let s=new Map(n._flat??n.base);return n._flat||Ry(s,n.overlay),s.set(t,r),Fy(o,s,void 0,0)}return Fy(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Ud=d(2,(e,t)=>Af(e,t.key)),Af=(e,t)=>{let r=$y(e,t);return r===Md?void 0:r},co=d(2,(e,t)=>{let r=$y(e,t.key);if(r===Md){if(Ck(t))return Tk(t);throw Yj(t)}return r}),ct=co,_y="~effect/Context/defaultValue",Tk=e=>_y in e?e[_y]:e[_y]=e.defaultValue(),Yj=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},Dd=d(2,(e,t)=>{let r=$y(e,t.key);return r!==Md?R(r):Ik(t)?R(Ck(t)):v()}),Na=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Kj(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),Tk=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return cc(t)};var ge=Ye;var My=e=>e.length>0;var vf=e=>e>0?Math.floor(e):0;var H=pk,Z=fk;var kk=Od,Se=ky,wt=Ay;var Ld=d(2,(e,t)=>Se(e)?Z(t(e.failure)):e),Mt=d(2,(e,t)=>wt(e)?H(t(e.success)):e),Sr=d(2,(e,{onFailure:t,onSuccess:r})=>Se(e)?t(e.failure):r(e.success));var Of=d(2,(e,t)=>Se(e)?t(e.failure):e.success);var ez=d(2,(e,t)=>{if(wt(e))return e.success;throw t(e.failure)}),Ms=ez(F);var Pt=d(2,(e,t)=>Se(e)?Z(e.failure):t(e.success));var Ak=Yw;var Ok=d(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(gd(o)){if(o)return R(n)}else if(ve(o))return o;r++}return v()});var _k=d(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 tz=d(2,(e,t)=>Object.hasOwn(e,t));var Bd=d(2,(e,t)=>{let r={...e};for(let n of Pk(e))U(r,n,t(e[n],n));return r});var Pk=e=>Object.keys(e);var rz=e=>d(2,(t,r)=>{for(let n of Pk(t))if(!tz(r,n)||!e(t[n],r[n]))return!1;return!0});var Fk=e=>{let t=rz(e);return(r,n)=>t(r,n)&&t(n,r)};var Dy=globalThis.Array;var nr=e=>Dy.isArray(e)?e:Dy.from(e);var _f=d(2,(e,{onEmpty:t,onNonEmpty:r})=>Us(e)?r(e):t());var zd=d(2,(e,t)=>[...e,t]);var nz=Dy.isArray;var Ma=My,Us=My;function uc(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}var qd=d(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return R(r);r++}return v()});var Pf=Ok;var Hd=d(2,(e,t)=>{let r=nr(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 R(o)}else if(ve(s))return s}return v()});var oz=(e,t)=>{let r=q(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(W(o,t))return!1;return n.push(t),!0};var Ua=()=>[],Da=e=>[e],Ft=d(2,(e,t)=>e.map(t));var Ly=d(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);wt(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var fc=d(3,(e,t,r)=>nr(e).reduce((n,o,s)=>r(n,o,s),t));var Rk=Ad;var Wd=e=>{let t=nr(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)oz(r,o)&&n.push(o);return n};var Gd="~effect/Duration",Ds=BigInt(0),Bk=BigInt(1),sz=BigInt(2),az=BigInt(10),$k=BigInt(24),Vd=BigInt(60),By=BigInt(1e3),Nk=BigInt(1e6);var jy=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),jk=e=>jy(e*1e6),Mk=e=>lr(Number.isFinite(e)?jy(e):e),Uk=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=az**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return iz(n?-a:a,s)},iz=(e,t)=>{let r=e<Ds?-e:e,n=r/t+(r%t*sz>=t?Bk:Ds);return e<Ds?-n:n};var cz=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ut=e=>{switch(typeof e){case"number":return dc(e);case"bigint":return uo(e);case"string":{if(e==="Infinity")return La;if(e==="-Infinity")return pc;let t=cz.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return uo(Uk(n,Bk));if(o==="micro"||o==="micros")return uo(Uk(n,By));let s=Number(n);switch(o){case"milli":case"millis":return dc(s);case"second":case"seconds":return Rf(s);case"minute":case"minutes":return hz(s);case"hour":case"hours":return gz(s);case"day":case"days":return xz(s);case"week":case"weeks":return yz(s)}break}case"object":{if(e===null)break;if(Gd in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(pf)?Dk(e):Number.isNaN(e[0])||Number.isNaN(e[1])?lc:e[0]===-1/0||e[1]===-1/0?pc:e[0]===1/0||e[1]===1/0?La:Mk(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?lr(r):Mk(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return Dk(e)},Dk=e=>{throw new Error(`Invalid Input: ${e}`)},zk=io(Ut),Lk={_tag:"Millis",millis:0},uz={_tag:"Infinity"},fz={_tag:"NegativeInfinity"},lz={[Gd]:Gd,[Y](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?q(jy(e)):dt(this.value.millis)}case"Nanos":return q(this.value.nanos);default:return gf(this.value)}},[X](e){return Ff(e)&&Ez(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"}}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},lr=e=>{let t=Object.create(lz);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=Lk:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:jk(e)}:t.value=e>0?uz:fz:e===Ds?t.value=Lk:t.value={_tag:"Nanos",nanos:e},t},Ff=e=>A(e,Gd),mc=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",pz=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Ds;case"Infinity":case"NegativeInfinity":return!1}},dz=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<Ds;case"NegativeInfinity":return!0;case"Infinity":return!1}};var mz=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return La;case"Millis":return e.value.millis<0?lr(-e.value.millis):e;case"Nanos":return e.value.nanos<Ds?lr(-e.value.nanos):e}};var lc=lr(0),La=lr(1/0),pc=lr(-1/0),uo=e=>lr(e);var dc=e=>lr(e),Rf=e=>lr(e*1e3),hz=e=>lr(e*6e4),gz=e=>lr(e*36e5),xz=e=>lr(e*864e5),yz=e=>lr(e*6048e5),Ko=e=>Hk(Ut(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),fo=e=>Hk(Ut(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Kd=e=>{let t=Ut(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 jk(t.value.millis)}},qk=io(Kd);var Hk=d(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)()}}),Wk=d(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(Kd(e),t.value.nanos):r.onNanos(e.value.nanos,Kd(t)));var Sz=(e,t)=>Wk(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag});var Vk=d(2,(e,t)=>Wk(e,t,{onMillis:(r,n)=>lr(r-n),onNanos:(r,n)=>lr(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?lc:La:o==="NegativeInfinity"?s==="NegativeInfinity"?lc:pc:s==="Infinity"?pc:La}}));var Ez=d(2,(e,t)=>Sz(e,t)),bz=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=Kd(e),r=t<Ds,n=r?-t:t,o=n/Nk,s=o/By,a=s/Vd,i=a/Vd,c=i/$k,f=r?-1:1;return{days:f*Number(c),hours:f*Number(i%$k),minutes:f*Number(a%Vd),seconds:f*Number(s%Vd),millis:f*Number(o%By),nanos:f*Number(n%Nk)}},zy=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(pz(e))return"0";if(dz(e))return"-"+zy(mz(e));let t=bz(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 $f=ge("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new Ba}),Gk=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Iz="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Kk=e=>{try{return Iz(e)}catch{return Gk(e)}},qy=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}},Ba=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?Gk:Kk)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new Hy(this.setImmediate)}},Hy=class{tasks=new qy;running=void 0;setImmediate;constructor(t=Kk){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()}},Jk=ge("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),Zk=ge("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var po={};En(po,{Class:()=>Jd,Error:()=>Nf,TaggedClass:()=>Cz,TaggedError:()=>cn,taggedEnum:()=>Vy});var Jd=class extends Ps{constructor(e){super(),e&&Cd(this,e)}},Cz=e=>class extends Jd{_tag=e},Vy=()=>new Proxy({},{get(e,t,r){return t==="$is"?Br:t==="$match"?Tz:n=>({...n,_tag:t})}});function Tz(){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 Nf=kf,cn=Ho;var Qk="~effect/encoding/EncodingError",un=class extends cn("EncodingError"){[Qk]=Qk};var Zd=e=>Yk(typeof e=="string"?vz.encode(e):e),Gy=e=>{switch(e){case 16:return kz();case 32:return Az();default:{let t="";for(let r=e>>>3;r>0;r--)t+=wz();return t}}},ee=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),ja=()=>Math.random()*4294967296>>>0,wz=()=>{let e=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15])},kz=()=>{let e=ja(),t=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15])},Az=()=>{let e=ja(),t=ja(),r=ja(),n=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15],ee[r>>>28],ee[r>>>24&15],ee[r>>>20&15],ee[r>>>16&15],ee[r>>>12&15],ee[r>>>8&15],ee[r>>>4&15],ee[r&15],ee[n>>>28],ee[n>>>24&15],ee[n>>>20&15],ee[n>>>16&15],ee[n>>>12&15],ee[n>>>8&15],ee[n>>>4&15],ee[n&15])},Ky=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Z(new un({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=Xk(t[o*2]),a=Xk(t[o*2+1]);n[o]=s<<4|a}return H(n)}catch(r){return Z(new un({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},eA=e=>Mt(Ky(e),t=>Oz.decode(t)),vz=new TextEncoder,Oz=new TextDecoder,_z=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Yk=e=>{let t="";for(let r=0;r<e.length;r++)t+=_z[e[r]];return t},Xk=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 Qy="effect/Tracer/ParentSpan",Mf=class extends Ye()(Qy,{fiberCached:!0}){},Pz=e=>e;var Qd=ge("effect/Tracer/DisablePropagation",{defaultValue:uf}),tA=ge("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),rA=ge("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),Yy="effect/Tracer",Xy=ge(Yy,{fiberCached:!0,defaultValue:()=>eS}),eS=Pz({span:e=>new Zy(e)}),Zy=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??=tr(this.parent)?.traceId??Gy(32)}get spanId(){return this._spanId??=Gy(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 oA="effect/Metric/FiberRuntimeMetrics";var sA=ge("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Uf=ge("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:on}),Yd=ge("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:Dr}),hc=ge("effect/References/TracerTimingEnabled",{defaultValue:Dr}),Df=ge("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Lf=ge("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Jo=ge("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),tS=ge("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Xd=ge("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var em=ge("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var tm=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Tn();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};jt(3);let r=new Error;return jt(t),{...e,captureStackTrace:$z(()=>r.stack)}},rS=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}},$z=rS(3);var rm=class extends Ji{constructor(t,r=bf){super("Interrupt",r,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[X](t){return wf(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[Y](){return ie(Ae(`${this._tag}:${this.fiberId}`))(Sd(this.annotations))}},dA=e=>new rm(e),Sc=e=>new to([new rm(e)]);var mA=e=>{let t=e.reasons.find(oo);return t?H(t):Z(e)},wn=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return H(r.error)}return Z(e)};var hA=e=>e.reasons.some(Tf);var SS=e=>{let t=e.reasons.find(Tf);return t?H(t.defect):Z(e)},ES=e=>e.reasons.some(wf);var gA=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?H(t):Z(e)};var fm=e=>e.reasons.length>0&&e.reasons.every(wf);var xA=d(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>oo(o)?(r=!0,new Pa(t(o.error),o.annotations)):o);return r?qo(n):e}),lm=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")},yA=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=Tn();o!==0&&jt(1);try{for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(oS(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=Dz(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(oS(a,n[0].annotations,t))}}finally{o!==0&&jt(o)}return r},oS=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(Nz(e),{cause:e.cause?oS(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=Uz(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?sS(s,t):s}r?.includeCauseInStack&&(o.stack=EA(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else{o=new globalThis.Error(e?n==="string"?e:va(e):`Unknown error: ${e}`);let s=`${o.name}: ${o.message}`;o.stack=t?sS(s,t):s}return o},Nz=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 va(e)},Mz=/\((.*)\)/g,Uz=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
10
+ `)}return t},Dd=d(2,(e,t)=>{let r=$y(e,t.key);return r!==Md?R(r):Ck(t)?R(Tk(t)):v()}),Na=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Kj(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),wk=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return cc(t)};var ge=Ye;var My=e=>e.length>0;var vf=e=>e>0?Math.floor(e):0;var H=dk,Z=lk;var Ak=Od,Se=ky,wt=Ay;var Ld=d(2,(e,t)=>Se(e)?Z(t(e.failure)):e),Mt=d(2,(e,t)=>wt(e)?H(t(e.success)):e),Sr=d(2,(e,{onFailure:t,onSuccess:r})=>Se(e)?t(e.failure):r(e.success));var Of=d(2,(e,t)=>Se(e)?t(e.failure):e.success);var ez=d(2,(e,t)=>{if(wt(e))return e.success;throw t(e.failure)}),Ms=ez(F);var Pt=d(2,(e,t)=>Se(e)?Z(e.failure):t(e.success));var vk=Xw;var _k=d(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(gd(o)){if(o)return R(n)}else if(ve(o))return o;r++}return v()});var Pk=d(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 tz=d(2,(e,t)=>Object.hasOwn(e,t));var Bd=d(2,(e,t)=>{let r={...e};for(let n of Fk(e))U(r,n,t(e[n],n));return r});var Fk=e=>Object.keys(e);var rz=e=>d(2,(t,r)=>{for(let n of Fk(t))if(!tz(r,n)||!e(t[n],r[n]))return!1;return!0});var Rk=e=>{let t=rz(e);return(r,n)=>t(r,n)&&t(n,r)};var Dy=globalThis.Array;var nr=e=>Dy.isArray(e)?e:Dy.from(e);var _f=d(2,(e,{onEmpty:t,onNonEmpty:r})=>Us(e)?r(e):t());var zd=d(2,(e,t)=>[...e,t]);var nz=Dy.isArray;var Ma=My,Us=My;function uc(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}var qd=d(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return R(r);r++}return v()});var Pf=_k;var Hd=d(2,(e,t)=>{let r=nr(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 R(o)}else if(ve(s))return s}return v()});var oz=(e,t)=>{let r=q(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(W(o,t))return!1;return n.push(t),!0};var Ua=()=>[],Da=e=>[e],Ft=d(2,(e,t)=>e.map(t));var Ly=d(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);wt(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var fc=d(3,(e,t,r)=>nr(e).reduce((n,o,s)=>r(n,o,s),t));var $k=Ad;var Wd=e=>{let t=nr(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)oz(r,o)&&n.push(o);return n};var Gd="~effect/Duration",Ds=BigInt(0),jk=BigInt(1),sz=BigInt(2),az=BigInt(10),Nk=BigInt(24),Vd=BigInt(60),By=BigInt(1e3),Mk=BigInt(1e6);var jy=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),zk=e=>jy(e*1e6),Uk=e=>lr(Number.isFinite(e)?jy(e):e),Dk=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=az**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return iz(n?-a:a,s)},iz=(e,t)=>{let r=e<Ds?-e:e,n=r/t+(r%t*sz>=t?jk:Ds);return e<Ds?-n:n};var cz=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ut=e=>{switch(typeof e){case"number":return dc(e);case"bigint":return uo(e);case"string":{if(e==="Infinity")return La;if(e==="-Infinity")return pc;let t=cz.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return uo(Dk(n,jk));if(o==="micro"||o==="micros")return uo(Dk(n,By));let s=Number(n);switch(o){case"milli":case"millis":return dc(s);case"second":case"seconds":return Rf(s);case"minute":case"minutes":return hz(s);case"hour":case"hours":return gz(s);case"day":case"days":return xz(s);case"week":case"weeks":return yz(s)}break}case"object":{if(e===null)break;if(Gd in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(pf)?Lk(e):Number.isNaN(e[0])||Number.isNaN(e[1])?lc:e[0]===-1/0||e[1]===-1/0?pc:e[0]===1/0||e[1]===1/0?La:Uk(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?lr(r):Uk(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return Lk(e)},Lk=e=>{throw new Error(`Invalid Input: ${e}`)},qk=io(Ut),Bk={_tag:"Millis",millis:0},uz={_tag:"Infinity"},fz={_tag:"NegativeInfinity"},lz={[Gd]:Gd,[Y](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?q(jy(e)):dt(this.value.millis)}case"Nanos":return q(this.value.nanos);default:return gf(this.value)}},[X](e){return Ff(e)&&Ez(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"}}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},lr=e=>{let t=Object.create(lz);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=Bk:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:zk(e)}:t.value=e>0?uz:fz:e===Ds?t.value=Bk:t.value={_tag:"Nanos",nanos:e},t},Ff=e=>A(e,Gd),mc=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",pz=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Ds;case"Infinity":case"NegativeInfinity":return!1}},dz=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<Ds;case"NegativeInfinity":return!0;case"Infinity":return!1}};var mz=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return La;case"Millis":return e.value.millis<0?lr(-e.value.millis):e;case"Nanos":return e.value.nanos<Ds?lr(-e.value.nanos):e}};var lc=lr(0),La=lr(1/0),pc=lr(-1/0),uo=e=>lr(e);var dc=e=>lr(e),Rf=e=>lr(e*1e3),hz=e=>lr(e*6e4),gz=e=>lr(e*36e5),xz=e=>lr(e*864e5),yz=e=>lr(e*6048e5),Ko=e=>Wk(Ut(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),fo=e=>Wk(Ut(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Kd=e=>{let t=Ut(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 zk(t.value.millis)}},Hk=io(Kd);var Wk=d(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)()}}),Vk=d(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(Kd(e),t.value.nanos):r.onNanos(e.value.nanos,Kd(t)));var Sz=(e,t)=>Vk(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag});var Gk=d(2,(e,t)=>Vk(e,t,{onMillis:(r,n)=>lr(r-n),onNanos:(r,n)=>lr(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?lc:La:o==="NegativeInfinity"?s==="NegativeInfinity"?lc:pc:s==="Infinity"?pc:La}}));var Ez=d(2,(e,t)=>Sz(e,t)),bz=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=Kd(e),r=t<Ds,n=r?-t:t,o=n/Mk,s=o/By,a=s/Vd,i=a/Vd,c=i/Nk,f=r?-1:1;return{days:f*Number(c),hours:f*Number(i%Nk),minutes:f*Number(a%Vd),seconds:f*Number(s%Vd),millis:f*Number(o%By),nanos:f*Number(n%Mk)}},zy=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(pz(e))return"0";if(dz(e))return"-"+zy(mz(e));let t=bz(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 $f=ge("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new Ba}),Kk=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Iz="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Jk=e=>{try{return Iz(e)}catch{return Kk(e)}},qy=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}},Ba=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?Kk:Jk)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new Hy(this.setImmediate)}},Hy=class{tasks=new qy;running=void 0;setImmediate;constructor(t=Jk){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()}},Zk=ge("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),Qk=ge("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var po={};En(po,{Class:()=>Jd,Error:()=>Nf,TaggedClass:()=>Cz,TaggedError:()=>cn,taggedEnum:()=>Vy});var Jd=class extends Ps{constructor(e){super(),e&&Cd(this,e)}},Cz=e=>class extends Jd{_tag=e},Vy=()=>new Proxy({},{get(e,t,r){return t==="$is"?Br:t==="$match"?Tz:n=>({...n,_tag:t})}});function Tz(){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 Nf=kf,cn=Ho;var Yk="~effect/encoding/EncodingError",un=class extends cn("EncodingError"){[Yk]=Yk};var Zd=e=>Xk(typeof e=="string"?vz.encode(e):e),Gy=e=>{switch(e){case 16:return kz();case 32:return Az();default:{let t="";for(let r=e>>>3;r>0;r--)t+=wz();return t}}},ee=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),ja=()=>Math.random()*4294967296>>>0,wz=()=>{let e=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15])},kz=()=>{let e=ja(),t=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15])},Az=()=>{let e=ja(),t=ja(),r=ja(),n=ja();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15],ee[r>>>28],ee[r>>>24&15],ee[r>>>20&15],ee[r>>>16&15],ee[r>>>12&15],ee[r>>>8&15],ee[r>>>4&15],ee[r&15],ee[n>>>28],ee[n>>>24&15],ee[n>>>20&15],ee[n>>>16&15],ee[n>>>12&15],ee[n>>>8&15],ee[n>>>4&15],ee[n&15])},Ky=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Z(new un({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=eA(t[o*2]),a=eA(t[o*2+1]);n[o]=s<<4|a}return H(n)}catch(r){return Z(new un({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},tA=e=>Mt(Ky(e),t=>Oz.decode(t)),vz=new TextEncoder,Oz=new TextDecoder,_z=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Xk=e=>{let t="";for(let r=0;r<e.length;r++)t+=_z[e[r]];return t},eA=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 Qy="effect/Tracer/ParentSpan",Mf=class extends Ye()(Qy,{fiberCached:!0}){},Pz=e=>e;var Qd=ge("effect/Tracer/DisablePropagation",{defaultValue:uf}),rA=ge("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),nA=ge("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),Yy="effect/Tracer",Xy=ge(Yy,{fiberCached:!0,defaultValue:()=>eS}),eS=Pz({span:e=>new Zy(e)}),Zy=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??=tr(this.parent)?.traceId??Gy(32)}get spanId(){return this._spanId??=Gy(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 sA="effect/Metric/FiberRuntimeMetrics";var aA=ge("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Uf=ge("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:on}),Yd=ge("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:Dr}),hc=ge("effect/References/TracerTimingEnabled",{defaultValue:Dr}),Df=ge("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Lf=ge("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Jo=ge("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),tS=ge("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Xd=ge("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var em=ge("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var tm=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Tn();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};jt(3);let r=new Error;return jt(t),{...e,captureStackTrace:$z(()=>r.stack)}},rS=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}},$z=rS(3);var rm=class extends Ji{constructor(t,r=bf){super("Interrupt",r,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[X](t){return wf(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[Y](){return ie(Ae(`${this._tag}:${this.fiberId}`))(Sd(this.annotations))}},mA=e=>new rm(e),Sc=e=>new to([new rm(e)]);var hA=e=>{let t=e.reasons.find(oo);return t?H(t):Z(e)},wn=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return H(r.error)}return Z(e)};var gA=e=>e.reasons.some(Tf);var SS=e=>{let t=e.reasons.find(Tf);return t?H(t.defect):Z(e)},ES=e=>e.reasons.some(wf);var xA=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?H(t):Z(e)};var fm=e=>e.reasons.length>0&&e.reasons.every(wf);var yA=d(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>oo(o)?(r=!0,new Pa(t(o.error),o.annotations)):o);return r?qo(n):e}),lm=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")},SA=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=Tn();o!==0&&jt(1);try{for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(oS(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=Dz(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(oS(a,n[0].annotations,t))}}finally{o!==0&&jt(o)}return r},oS=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(Nz(e),{cause:e.cause?oS(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=Uz(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?sS(s,t):s}r?.includeCauseInStack&&(o.stack=bA(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else{o=new globalThis.Error(e?n==="string"?e:va(e):`Unknown error: ${e}`);let s=`${o.name}: ${o.message}`;o.stack=t?sS(s,t):s}return o},Nz=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 va(e)},Mz=/\((.*)\)/g,Uz=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
12
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?sS(s.join(`
13
13
  `),r):s.join(`
14
14
  `)},sS=(e,t)=>{let r=t?.get(kd.key);return r&&(e=`${e}
15
- ${SA(r)}`),e},Dz=(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(Iy.key);r.push(` at fiber (${o})`),s&&r.push(SA(s))}return r.join(`
16
- `)},SA=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(Mz),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
- `)},pm=e=>yA(e).map(EA).join(`
18
- `),EA=e=>e.cause?`${e.stack} {
19
- ${bA(e.cause," ")}
20
- }`:e.stack,bA=(e,t)=>{let r=e.stack.split(`
15
+ ${EA(r)}`),e},Dz=(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(Iy.key);r.push(` at fiber (${o})`),s&&r.push(EA(s))}return r.join(`
16
+ `)},EA=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(Mz),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
+ `)},pm=e=>SA(e).map(bA).join(`
18
+ `),bA=e=>e.cause?`${e.stack} {
19
+ ${IA(e.cause," ")}
20
+ }`:e.stack,IA=(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
- ${bA(e.cause,`${t} `)}
24
- ${t}}`),n},bS="~effect/Fiber",Lz={_A:F,_E:F},Bz={id:0},aA=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),IA=()=>aA===void 0?void 0:new aA("effect/Fiber"),Ec=()=>globalThis[Ki],Bf=class{constructor(t,r=!0){this.setContext(t),this.id=++Bz.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[bS](){return Lz}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return ct(this.context,t)}addObserver(t){return this._exit?(t(this._exit),jo):(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=Sc(t);this.cache.stackFrame&&(n=Cf(n,Go(kd,this.cache.stackFrame))),r&&(n=Cf(n,r)),this._interruptedCause=this._interruptedCause?Yi(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ue(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===Fa){this._asyncContext=IA();return}let n=aS.interruptChildren&&aS.interruptChildren(this);if(n!==void 0)return this.evaluate(Q(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=fr()}runLoop(t){let r=globalThis[Ki];globalThis[Ki]=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=Ue(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=Q(Ic,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[Ge](this),s===Fa){let i=this._yielded;if(Oa in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Fa}}catch(a){if(!A(s,Ge))return qr(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=qr(a)}}finally{this._running=n,globalThis[Ki]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,zz;for(;;){let r=this._stack.pop();if(!r)return;let n=r[_a];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&qz-1)===0)return Fe(t);let r=this.getCont(_t);return r?r[_t](t,this):this.yieldWith(Fe(t))}yieldWith(t){return this._yielded=t,Fa}children(){return this._children??=new Set}pipe(){return re(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&bk(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=jz(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}},jz=e=>{let t=Af(e,Yy);return{scheduler:ct(e,$f),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:ct(e,Yd),span:Af(e,Qy),logLevel:ct(e,tS),minimumLogLevel:ct(e,Xd),stackFrame:ct(e,Uf),runtimeMetrics:Af(e,oA),maxOpsBeforeYield:ct(e,Jk),preventYield:ct(e,Zk)}},zz={[_t](e,t){return Ue(t._interruptedCause)},[jr](e,t){return Ue(t._interruptedCause)}},qz=32,aS={interruptChildren:void 0},dm=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Iy.key,e.cache.stackFrame),cc(t)},Hz=e=>{if(!(e._children===void 0||e._children.size===0))return gc(e._children)},CA=e=>{let t=e;return t._exit?D(t._exit):Ht(r=>t._exit?r(D(t._exit)):G(e.addObserver(n=>r(D(n)))))},mm=e=>Ht(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(D(n))}return s(),G(()=>o?.())}),nm=e=>{let t=e;return t._exit?t._exit:Ht(r=>t._exit?r(t._exit):G(e.addObserver(r)))};var qf=e=>ce(t=>TA(e,t.id)),TA=d(e=>A(e[0],bS),(e,t,r)=>ce(n=>{let o=dm(n);return o=o&&r?Na(o,r):o??r,e.interruptUnsafe(t,o),Wf(CA(e))})),gc=e=>ce(t=>{let r=dm(t),n=Ua();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Wf(mm(n))});var D=Fe,Ue=ur,Xe=an,G=sn({op:"Sync",[Ge](e){let t=this[fe](),r=e.getCont(_t);return r?r[_t](t,e):e.yieldWith(Fe(t))}}),ae=sn({op:"Suspend",[Ge](e){return this[fe]()}}),IS=d(e=>e.length>=2||$d(e[0]),(e,t)=>Ke(e)?Xe(t?t():new ro("Effect.fromOption: Option.none")):D(e.value)),bc=Sr({onFailure:Xe,onSuccess:D}),wA=e=>e==null?Xe(new ro):D(e),CS=sn({op:"Yield",[Ge](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(pr)},this[fe]??0),e.yieldWith(()=>{t=!0})}}),Ic=CS(0),TS=e=>D(R(e)),Hf=D(v()),kA=e=>Ke(e)?Hf:Oe(e.value,R),AA=e=>ae(()=>Ue(e())),Bs=e=>qr(e),hm=e=>ae(()=>Xe(e())),he=D(void 0);var vA=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new yc(n,"An error occurred in Effect.try"):e.catch;return ae(()=>{try{return D(t())}catch(n){return Xe(r(n))}})};var wS=e=>kS(function(t,r){e(r).then(n=>t(D(n)),n=>t(Bs(n)))},e.length!==0),OA=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new yc(n,"An error occurred in Effect.tryPromise"):e.catch;return kS(function(n,o){let s=a=>ae(()=>{try{return Xe($s(()=>r(a)))}catch(i){return Bs(i)}});try{t(o).then(a=>n(D(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},_A=e=>ce(t=>e(t.id)),PA=ce(D),FA=_A(D),kS=(function(){let e=zr({op:"Async",[Ge](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?Fa:(r._stack.push(Wz(()=>(n=!0,s?.abort(),a??pr))),Fa))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Wz=sn({op:"AsyncFinalizer",[_a](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Xf))},[jr](e,t){return ES(e)?Q(Rv(ur(e),this[fe]()),()=>Ue(e)):Ue(e)}}),Ht=e=>kS(e,e.length>=2),gm=Ht(jo),RA=(...e)=>{if(e.length===1){let n=e[0];return ae(()=>qa(n()))}let[t,r]=e;return ae(()=>qa(r.call(t.self)))},AS=(e,...t)=>{let r=t.length===0?function(){return ae(()=>qa(e.apply(this,arguments)))}:function(){let n=ae(()=>qa(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return vS(e.length,r)},vS=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),iA=rS(2),$A=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Tn(),o;return n!==0&&(jt(2),o=new globalThis.Error,jt(n)),e?(s,...a)=>cA(t,s,o,a,e,r):cA(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},cA=(e,t,r,n,o,s)=>{let a=typeof t=="function"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?iA(()=>r.stack):on;return vS(a.length,function(...f){let u=ae(()=>{let h=a.apply(this,arguments);return se(h)?h:qa(h)});for(let h=0;h<n.length;h++)u=n[h](u,...f);if(!se(u))return u;let l=Tn(),p;return l!==0&&(jt(2),p=new globalThis.Error,jt(l)),Qo(o?zf(e,s,h=>lS(u,h)):u,Uf,h=>({name:e,stack:p?iA(()=>p.stack):on,parent:{name:i,stack:c,parent:h}}))})},NA=(e,...t)=>vS(e.length,t.length===0?function(){return uA(()=>e.apply(this,arguments))}:function(){let r=uA(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),uA=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return D(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 ae(()=>s?(s=!1,Q(n.value,a=>qa(t,a))):ae(()=>qa(e())))}}}}catch(t){return Bs(t)}},qa=(function(){let e=zr({op:"Iterator",[_t](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return D(s.value);if($e(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[Ge](r){return this[_t](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)}})(),Er=d(2,(e,t)=>new Zo(e,OS,D(t))),xm=function(e){return e._stack.push(this),this[fe]},Vz=zr({op:"OnSuccess",[Ge]:xm}),Zo=function(e,t,r){this[fe]=e,this[_t]=t,this.payload=r};Zo.prototype=Vz;var OS=function(){return this.payload},MA=function(e,t){return t.succeedWith(this.payload)},ym=(()=>{let e=Tn();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};jt(1);let n=r[t]();return jt(e),n.stack?.includes("[as "+t+"]")===!0})(),Gz=function(e,t){let r=this.payload;return t.succeedWith(ym?r(e):$s(()=>r(e)))},UA=function(e){let t=this.payload;return t(e)},Kz=function(e){let t=this.payload;return new Zo(t(e),MA,e)},Jz=function(e){return new Zo(this.payload,MA,e)},Sm=e=>Oe(e,R),DA=e=>Tc(e,{onFailure:D,onSuccess:Xe}),go=d(2,(e,t)=>new Zo(e,se(t)?OS:UA,t)),Ha=d(2,(e,t)=>new Zo(e,se(t)?Jz:Kz,t)),Wf=e=>new Zo(e,OS,pr),LA=e=>Vr(e,Xe),_S=(e,t)=>ce(r=>{let n=new Set;return kc(r,()=>n.size===0?void 0:gc(n)),Ht(o=>{let s=nr(e),a=s.length,i=0,c=!1,f=[],u=(l,p,h)=>{if(i++,l._tag==="Failure"){f.push(...l.cause.reasons),i>=a&&o(Ue(qo(f)));return}let g=!c;c=!0,o(l),g&&t?.onWinner&&t.onWinner({fiber:p,index:h,parentFiber:r})};for(let l=0;l<a;l++){let p=Ga(r,s[l],!0,!0,!1);if(n.add(p),p.addObserver(h=>{n.delete(p),u(h,p,l)}),c)break}})}),PS=(e,t)=>ce(r=>{let n=new Set;return kc(r,()=>n.size===0?void 0:gc(n)),Ht(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,f=Ga(r,i,!0,!0,!1);n.add(f),f.addObserver(u=>{n.delete(f);let l=!s;s=!0,o(u),l&&t?.onWinner&&t.onWinner({fiber:f,index:c,parentFiber:r})})}})}),BA=d(e=>se(e[1]),(e,t,r)=>_S([e,t],r)),FS=d(e=>se(e[1]),(e,t,r)=>PS([e,t],r)),Q=d(2,(e,t)=>new Zo(e,UA,t)),jA=d(2,(e,t)=>$e(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):mo(e,t)),$e=e=>e[Oa]!==void 0,zA=d(2,(e,t)=>$e(e)?e._tag==="Success"?t(e.value):e:Q(e,t)),qA=e=>Q(e,F),Oe=d(2,(e,t)=>new Zo(e,Gz,t)),HA=d(2,(e,t)=>$e(e)?QA(e,t):Oe(e,t)),WA=d(2,(e,t)=>$e(e)?YA(e,t):LS(e,t)),VA=d(2,(e,t)=>$e(e)?XA(e,t):BS(e,t)),GA=d(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return e;let r=wn(e.cause);return Se(r)?e:t(r.success)}return Xo(e,t)}),Vf=e=>ur(Sc(e)),Gf=e=>e._tag==="Success";var KA=e=>e._tag==="Failure";var JA=e=>e._tag==="Failure"?H(e.cause):Z(e);var ZA=e=>e._tag==="Failure"&&ES(e.cause);var pr=Fe(void 0),QA=d(2,(e,t)=>e._tag==="Success"?Fe(t(e.value)):e),YA=d(2,(e,t)=>{if(e._tag==="Success")return e;let r=wn(e.cause);return Se(r)?e:an(t(r.success))}),XA=d(2,(e,t)=>{if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=wn(e.cause);return Se(r)?e:an(t.onFailure(r.success))});var ev=d(2,(e,t)=>Gf(e)?t:e);var tv=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?pr:ur(qo(t))};var rv=e=>e,nv=e=>ce(t=>D(Dd(t.context,e))),Zz=e=>ce(t=>IS(Dd(t.context,e))),Cc=d(2,(e,t)=>ce(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),kc(r,()=>{r.setContext(n)})),e})),Qo=d(3,(e,t,r)=>Cc(e,n=>{let o=co(n,t),s=r(o);return o===s?n:rr(n,t,s)})),ov=(e,t,r)=>Va(ce(n=>{let o=co(n.context,e),s=t(o);return n.setContext(rr(n.context,e,s)),qs(co(n.context,zs),a=>{let i=Dd(n.context,e);if(Ke(i))return he;let c=i.value,f;if(r?.reset===void 0){if(c!==s)return he;f=o}else f=r.reset(o,s,c);return n.setContext(rr(n.context,e,f)),he})})),RS=()=>Qz,Qz=ce(e=>D(e.context)),js=e=>ce(t=>e(t.context)),sv=d(2,(e,t)=>Cc(e,at(t))),Wr=d(2,(e,t)=>$e(e)?e:Cc(e,Na(t))),br=function(){return arguments.length===1?d(2,(e,t)=>fA(e,arguments[0],t)):d(3,(e,t,r)=>fA(e,t,r)).apply(this,arguments)},fA=(e,t,r)=>Cc(e,rr(t,r)),Em=d(3,(e,t,r)=>Q(r,n=>br(e,t,n))),av=d(e=>se(e[1]),(e,t,r)=>$S(e,t,(n,o)=>[n,o],r)),$S=d(e=>se(e[1]),(e,t,r,n)=>n?.concurrent?Oe(el([e,t],{concurrency:2}),([o,s])=>r(o,s)):Q(e,o=>Oe(t,s=>r(o,s)))),iv=d(e=>se(e[0]),(e,t,r)=>tE(e,t,r?n=>Xe(r(n)):()=>Xe(new ro))),cv=d(2,(e,t)=>Q(t,r=>r?Sm(e):Hf)),NS=d(2,(e,t)=>Array.from({length:t},()=>e)),uv=d(e=>se(e[0]),(e,t,r)=>el(NS(e,t),r)),bm=d(e=>se(e[0]),(e,t)=>xo({while:Dr,body:at(t?.disableYield?e:Q(e,r=>Ic)),step:jo})),Vr=d(2,(e,t)=>new fv(e,t.length!==1?r=>t(r):t)),Yz=zr({op:"OnFailure",[Ge]:xm}),fv=function(e,t){this[fe]=e,this[jr]=t};fv.prototype=Yz;var MS=d(3,(e,t,r)=>Vr(e,n=>t(n)?r(n):Ue(n))),Yo=d(3,(e,t,r)=>Vr(e,n=>{let o=t(n);return Se(o)?Ue(o.failure):r(o.success,n)})),Xo=d(2,(e,t)=>Yo(e,wn,r=>t(r))),lv=e=>Tc(e,{onFailure:t=>Cy(t)?Hf:Xe(t),onSuccess:TS}),pv=d(2,(e,t)=>Yo(e,SS,t)),dv=d(2,(e,t)=>Vr(e,r=>go(t(r),Ue(r)))),mv=d(3,(e,t,r)=>MS(e,t,n=>go(r(n),Ue(n)))),Im=d(3,(e,t,r)=>Vr(e,n=>{let o=t(n);return Se(o)?Ue(n):go(r(o.success,n),Ue(n))})),US=d(2,(e,t)=>Im(e,wn,r=>t(r))),hv=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>A(o,"_tag")&&t.includes(o._tag):Br(t);return US(e,o=>n(o)?r(o):he)}),gv=d(2,(e,t)=>Im(e,SS,r=>t(r))),Kf=d(e=>se(e[0]),(e,t,r,n)=>Vr(e,o=>{let s=wn(o);return Se(s)?Ue(s.failure):t(s.success)?r(s.success):n?n(s.success):Ue(o)})),Cm=d(e=>se(e[0]),(e,t,r,n)=>Vr(e,o=>{let s=wn(o);if(Se(s))return Ue(s.failure);let a=t(s.success);return Se(a)?n?n(a.failure):Ue(o):r(a.success)})),DS=d(e=>se(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>A(s,"_tag")&&t.includes(s._tag):Br(t);return Kf(e,o,r,n)}),xv=d(e=>se(e[0]),(e,t,r)=>{let n;return Cm(e,o=>(n??=Object.keys(t),A(o,"_tag")&&In(o._tag)&&n.includes(o._tag)?H(o):Z(o)),o=>t[o._tag](o),r)}),yv=d(e=>se(e[0]),(e,t,r,n,o)=>Kf(e,s=>Br(s,t)&&A(s,"reason")&&(o!==void 0||Br(s.reason,r)),s=>{let a=s.reason;return Br(a,r)?n(a,s):o?o(a,s):Xe(s)})),Sv=d(e=>se(e[0]),(e,t,r,n)=>{let o;return Kf(e,s=>Br(s,t)&&A(s,"reason")&&A(s.reason,"_tag")&&In(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):Xe(s)})}),Ev=d(2,(e,t)=>Cm(e,r=>Br(r,t)&&A(r,"reason")?H(r.reason):Z(r),Xe)),LS=d(2,(e,t)=>Xo(e,r=>hm(()=>t(r)))),BS=d(2,(e,t)=>Tc(e,{onFailure:r=>hm(()=>t.onFailure(r)),onSuccess:r=>G(()=>t.onSuccess(r))})),jS=e=>Xo(e,Bs),bv=d(2,(e,t)=>Xo(e,r=>G(()=>t(r)))),Iv=e=>ae(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return Bs(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:Xo(o.value,a=>n(s))}return n(r)}),zS=e=>Xo(e,t=>Q(Ic,()=>zS(e))),Cv=d(e=>se(e[0]),(e,t)=>{if(!t?.log)return Tc(e,{onFailure:n=>he,onSuccess:n=>he});let r=kn(t.log===!0?void 0:t.log);return mo(e,{onFailure(n){let o=mA(n);return Se(o)?Ue(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>he})}),Tm=d(e=>se(e[0]),(e,t)=>{if(!t?.log)return mo(e,{onFailure:n=>he,onSuccess:n=>he});let r=kn(t.log===!0?void 0:t.log);return mo(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>he})}),Tv=e=>wm(e,{onFailure:v,onSuccess:R}),Ls=e=>Jf(e,{onFailure:Z,onSuccess:H}),mo=d(2,(e,t)=>new wv(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),Xz=zr({op:"OnSuccessAndFailure",[Ge]:xm}),wv=function(e,t,r){this[fe]=e,this[_t]=t,this[jr]=r};wv.prototype=Xz;var eq=function(e,t){let r=this.payload;return t.succeedWith(ym?r.onSuccess(e):$s(()=>r.onSuccess(e)))},kv=(e,t)=>{let r=zr({op:e,[Ge]:xm,[_t]:eq,[jr]:t}),n=function(o,s){this[fe]=o,this.payload=s};return n.prototype=r,n},tq=kv("Match",function(e,t){let r=e.reasons.find(oo);if(r===void 0)return Ue(e);let n=this.payload;return t.succeedWith(ym?n.onFailure(r.error):$s(()=>n.onFailure(r.error)))}),rq=kv("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(ym?r.onFailure(e):$s(()=>r.onFailure(e)))}),qS=d(2,(e,t)=>new rq(e,t)),Tc=d(2,(e,t)=>mo(e,{onFailure:r=>{let n=r.reasons.find(oo);return n?t.onFailure(n.error):Ue(r)},onSuccess:t.onSuccess})),wm=d(2,(e,t)=>new tq(e,t)),Jf=d(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=wn(e.cause);return Se(r)?e:Fe(t.onFailure(r.success))}return wm(e,t)}),Av=d(2,(e,t)=>$e(e)?e._tag==="Success"?Fe(t.onSuccess(e.value)):Fe(t.onFailure(e.cause)):qS(e,t)),Zf=e=>$e(e)?Fe(e):nq(e),nq=sn({op:"Exit",[Ge](e){return e._stack.push(this),this[fe]},[_t](e,t,r){return t.succeedWith(r??Fe(e))},[jr](e,t,r){return t.succeedWith(r??ur(e))}}),vv=Jf({onFailure:()=>!0,onSuccess:()=>!1}),Ov=Jf({onFailure:()=>!1,onSuccess:()=>!0}),_v=d(2,(e,t)=>go(Ac(t),e)),HS=d(2,(e,t)=>Q(WS(e,t.duration),r=>Ke(r)?t.orElse():D(r.value))),oq=e=>new im(`Operation timed out after '${zy(e)}'`),Pv=d(2,(e,t)=>{let r=Ut(t);return HS(e,{duration:r,orElse:()=>Xe(oq(r))})}),WS=d(2,(e,t)=>FS(Sm(e),Er(Ac(t),v()))),Fv=e=>yo(t=>{let r=t.monotonicTimeNanosUnsafe();return Oe(e,n=>[uo(t.monotonicTimeNanosUnsafe()-r),n])}),iS="~effect/Scope",cS="~effect/Scope/Closeable",zs=Ye("effect/Scope"),VS=(e,t)=>ce(r=>(cq(r),km(e,t)??he)),km=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&sm(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return om(r.finalizer,t);let n=r.finalizers;return n.size===1?om(n.values().next().value,t):sq(e,n,t)},om=(e,t)=>{try{return e(t)}catch(r){return qr(r)}},Rv=(e,t)=>Gf(e)?t:Vr(t,r=>Ue(Yi(e.cause,r))),sq=AS(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=Ec();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?n.push(yield*Zf(om(c,r))):o.push(Ga(a,om(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*mm(o)),yield*tv(n)});var $v=(e,t)=>{let r=Mv(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(wc(e,r,n=>VS(r,n)),r)},qs=(e,t)=>ae(()=>e.state._tag==="Closed"?t(e.state.exit):(wc(e,{},t),he)),Nv=(e,t)=>qs(e,at(t)),wc=(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)}},sm=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=uS:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=uS))},Am=e=>Mv(e,void 0),Mv=(e="sequential",t)=>({[cS]:cS,[iS]:iS,strategy:e,parent:t,state:uS}),uS={_tag:"Empty"};var Qf=zs,Uv=br(zs),GS=e=>ce(t=>{let r=t.context,n=Am();return t.setContext(rr(t.context,zs,n)),kc(t,o=>(t.setContext(r),km(n,o))),e});var vm=e=>ae(()=>{let t=Am();return Gr(e(t),r=>ae(()=>km(t,r)??he))}),Wa=(e,t,r)=>js(n=>Ws(o=>Q(Qf,s=>Ha(r?.interruptible?o(e):e,a=>qs(s,i=>Wr(t(a,i),n)))))),KS=e=>Q(Qf,t=>js(r=>qs(t,n=>Wr(e(n),r)))),Dv=(function(){let e=zr({op:"OnExit",[Ge](r){return r._stack.push(this),this.effect},[_a](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Xf),r.interruptible=!1)},[_t](r,n,o){o??=Fe(r);let s;try{s=this.onExit(o)}catch(a){s=qr(a)}return s?Q(s,a=>o):o},[jr](r,n,o){o??=ur(r);let s;try{s=this.onExit(o)}catch(a){s=qr(a)}return s?Q(Rv(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),Hs=(e,t,r)=>new Dv(e,t,r),kc=(e,t)=>{e._stack.push(new Dv(void 0,t,void 0))},Gr=d(2,Hs),Lv=d(2,(e,t)=>Gr(e,r=>t)),JS=d(3,(e,t,r)=>Gr(e,n=>t(n)?r(n):he)),ZS=d(3,(e,t,r)=>Gr(e,n=>{let o=t(n);return Se(o)?he:r(o.success,n)})),QS=d(2,(e,t)=>ZS(e,JA,t)),Bv=d(3,(e,t,r)=>JS(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),YS=d(3,(e,t,r)=>Gr(e,n=>{if(n._tag!=="Failure")return he;let o=t(n.cause);return Se(o)?he:r(o.success,n.cause)})),jv=d(2,(e,t)=>YS(gA,t)(e)),Yf=(e,t,r)=>Ws(n=>Q(e,o=>Hs(ae(()=>n(t(o))),s=>r(o,s),!0))),zv=e=>Wa(e,t=>A(t,Symbol.asyncDispose)?wS(()=>t[Symbol.asyncDispose]()):G(()=>t[Symbol.dispose]())),XS=d(2,(e,t)=>G(()=>qv(e,typeof t=="function"?r=>Ko(Ut(t(r))):at(Ko(Ut(t)))))),aq=at(1/0),qv=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,kc(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,qf(i.fiber)}),nm(i.fiber));return[ce(a=>{if(o!==void 0)return a===o.fiber?nm(o.fiber):s(a,o);if(n!==void 0&&(r===1/0||a.getRef(ho).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(ho),c={fiber:new Bf(a.context),awaiters:0};o=c;let f=s(a,c);return c.fiber.evaluate(Hs(e,u=>{if(o!==c||(o=void 0,ZA(u)))return;let l=t(u);r=l===1/0?1/0:i.currentTimeMillisUnsafe()+l,n=u})),c.fiber._exit??f}),G(()=>{n=void 0})]},Hv=d(2,(e,t)=>Oe(XS(e,t),r=>r[0])),Wv=e=>G(()=>qv(e,aq)[0]),Vv=ce(e=>Ue(Sc(e.id))),Va=e=>ce(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Xf)),e)),Gv=sn({op:"SetInterruptible",[_a](e){if(e.interruptible=this[fe],e._interruptedCause&&e.interruptible)return()=>Ue(e._interruptedCause)}}),Xf=Gv(!0),iq=Gv(!1),Kv=e=>{if(e.interruptible=!0,e._stack.push(iq),e._interruptedCause)return Ue(e._interruptedCause)},cq=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Xf))};var Om=e=>ce(t=>t.interruptible?e:Kv(t)??e),Ws=e=>ce(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Xf),e(Om)):e(F)),Jv=e=>ce(t=>{if(t.interruptible)return e(F);let r=Kv(t),n=e(Va);return r??n}),Zv=Oe(Wa(G(()=>new AbortController),e=>G(()=>e.abort())),e=>e.signal),el=(e,t)=>Qn(e)?t?.mode==="result"?Hr(e,Ls,t):Hr(e,F,t):t?.discard?t.mode==="result"?Hr(Object.values(e),Ls,t):Hr(Object.values(e),F,t):ae(()=>{let r={};return Er(Hr(Object.entries(e),([n,o])=>Oe(t?.mode==="result"?Ls(o):o,s=>{U(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),eE=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>Oe(Hr(e,(n,o)=>Ls(t(n,o)),r),n=>Ly(n,F))),Qv=d(3,(e,t,r)=>{let n=nr(e);return n.length===0?G(t):ae(()=>{let o=0,s=t();return Oe(xo({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),Yv=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>Q(eE(e,t,{concurrency:r?.concurrency}),([n,o])=>Ma(o)?Xe(o):r?.discard?he:D(n))),Xv=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):eO(r,0,t,n.value)})),eO=(e,t,r,n)=>Q(r(n,t),o=>{if(o)return D(R(n));let s=e.next();return s.done?D(v()):eO(e,t+1,r,s.value)}),tO=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):rO(r,0,t,n.value)})),rO=(e,t,r,n)=>Q(r(n,t),o=>{if(wt(o))return D(R(o.success));let s=e.next();return s.done?D(v()):rO(e,t+1,r,s.value)}),xo=sn({op:"While",[_t](e,t){return this[fe].step(e),this[fe].while()?(t._stack.push(this),this[fe].body()):pr},[Ge](e){return this[fe].while()?(e._stack.push(this),this[fe].body()):pr}}),Hr=d(e=>typeof e[1]=="function",(e,t,r)=>ae(()=>{let n=tl(r?.concurrency);if(n===1)return uq(e,t,r);let o=nr(e),s=o.length;if(s===0)return r?.discard?he:D([]);let a=r?.discard?void 0:new Array(s),i=fq({f:t,out:a},o,{concurrency:n});return i?Er(i,a):D(a)})),nO=e=>Q(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Xe(new ro):D(r.value)}),uq=(e,t,r)=>ae(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return Er(xo({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),tl=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),_m=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,f)=>Q(Zf(f),u=>r(s,a[i],u,i)??o(s,a,i+1,c)??he),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let f=a[i],u=t(s,f,i);if(!$e(u))return n(s,a,i,c,u);let l=r(s,f,u,i);if(l)return l._tag==="Failure"?l:void 0}};return o},oO=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,f=!1,u,l,p,h,g,x=T=>{let w=qr(T);return h=w,f=!0,l&&l.size>0?Q(Va(gc(Array.from(l))),()=>h??w):w},b=()=>{let T=!1;for(;!h&&a<i;a++){let w=o[a],P=g??t(n,w,a);if($e(P)){if(h=r(n,w,P,a),h)break}else if(u){g=void 0;let O=Ga(u,P,!0,!0,"inherit");if(O._exit){if(h=r(n,w,O._exit,a),h)break;continue}l.add(O);let m=a;if(O.addObserver(S=>{l.delete(O);try{if(h){if(S._tag==="Failure"){let E=S.cause.reasons.filter(I=>I._tag!=="Interrupt");if(E.length>0){let I=qo(E);h=ur(h._tag==="Failure"?Yi(h.cause,I):I)}}}else{let E=r(n,w,S,m);E&&(h=E,b())}if(T){let E=b();E&&p(E)}else f&&l.size===0&&p(h??he)}catch(E){p(x(E))}}),l.size<c)continue;T=!0,a++;return}else return Ht(O=>{u=Ec(),l=new Set,g=P,p=O;let m;try{m=b()}catch(S){return O(x(S))}return m?O(m):ae(()=>(h??=pr,Q(l?gc(l):he,()=>h?._tag==="Failure"?h:he)))})}if(f=!0,h){if(l&&l.size>0){let w=dm(u);l.forEach(P=>P.interruptUnsafe(u.id,w));return}if(p||h._tag==="Failure")return h}else if(p)if(l)l.size===0&&p(he);else return pr};return b()}},Pm=()=>e=>oO(e),fq=oO({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)}}),tE=d(3,(e,t,r)=>Q(e,n=>t(n)?D(n):r(n))),rE=d(3,(e,t,r)=>Q(e,n=>{let o=t(n);return Se(o)?r(o.failure):D(o.success)})),sO=d(e=>se(e[0]),(e,t,r)=>rE(e,t,r?n=>Xe(r(n)):()=>Xe(new ro))),aO=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>ae(()=>{let n=[];return Er(Hr(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&n.push(o),he):Oe(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),iO=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=[];for(let n of e){let o=t(n);wt(o)&&r.push(o.success)}return D(r)})),cO=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>ae(()=>{let n=[];return Er(Hr(e,o=>Oe(t(o),s=>{wt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),uO=D({}),fO=ek(Oe),lO=tk(Oe,Q),pO=Xw(Oe);var dO=d(e=>se(e[0]),(e,t)=>ce(r=>(wq(),D(Ga(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Ga=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new Bf(s.context,a);return n||(s.children().add(i),i._parent=s),r?i.evaluate(t):(i._asyncContext=IA(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),i},mO=d(e=>se(e[0]),(e,t)=>ce(r=>D(Ga(r,e,t?.startImmediately,!0,t?.uninterruptible)))),hO=e=>ce(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return Hs(e,o=>{let s=t._children;if(s===void 0||s.size===0)return he;r&&(s=_k(s,i=>!r.has(i)));let a=Wf(mm(s));return n?Om(a):a})}),nE=d(e=>se(e[0]),(e,t,r)=>ce(n=>{let o=Ga(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};wc(t,s,()=>_A(i=>i===o.id?he:qf(o))),o.addObserver(()=>sm(t,s))}else o.interruptUnsafe(n.id,dm(n));return D(o)})),gO=d(e=>se(e[0]),(e,t)=>Q(Qf,r=>nE(e,r,t))),es=e=>(t,r)=>{let n=new Bf(r?.scheduler?rr(e,$f,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},xO=d(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(sm(t,e),wc(t,e,()=>qf(e)),e.addObserver(()=>sm(t,e)),e)),yO=es(fr()),oE=e=>{let t=es(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},SO=oE(fr()),Fm=e=>{let t=es(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},EO=Fm(fr()),sE=e=>{let t=Fm(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw lm(o.cause);return o.value})},bO=sE(fr()),Rm=e=>{let t=es(e);return r=>{if($e(r))return r;let n=new Ba("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??qr(new um(o))}},IO=Rm(fr()),aE=e=>{let t=Rm(e);return r=>{let n=t(r);if(n._tag==="Failure")throw lm(n.cause);return n.value}},CO=aE(fr()),lA=D(!0),pA=D(!1),fS=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return lA;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=[],lA}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](pr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](pr)}open=ce(t=>this._isOpen?pA:(this._isOpen=!0,this.scheduleUnsafe(t)));release=ce(t=>this._isOpen?pA:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Ht(t=>this._isOpen?t(he):(this.waiters.push(t),G(()=>{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=G(()=>this.closeUnsafe());whenOpen=t=>Q(this.await,()=>t);isOpen(){return this._isOpen}},TO=e=>new fS(e??!1);var wO=ce(e=>D(e.getRef(Xy))),kO=d(2,(e,t)=>br(e,Xy,t)),AO=br(Yd),vO=br(hc),am=BigInt(0),lq={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:am,endTime:am,exit:pr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},pq=e=>Object.assign(Object.create(lq),e),OO=e=>e?ct(e.annotations,Qd)?e._tag==="Span"?OO(tr(e.parent)):v():R(e):v(),iE=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&ct(r.annotations,Qd),o=r?.parent!==void 0?R(r.parent):r?.root?v():OO(e.cache.span),s;if(n)s=pq({name:t,parent:o,annotations:rr(r?.annotations??fr(),Qd,!0)});else{let a=e.cache.tracer??eS,i=e.getRef(ho),c=e.getRef(hc),f=e.getRef(Df),u=e.getRef(Lf),l=r?.level??e.getRef(tA),p=r?.links!==void 0?[...u,...r.links]:u.length===0?[]:u.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??fr(),links:p,startTime:c?i.currentTimeNanosUnsafe():am,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(ve(o)&&o.value.sampled===!1?!1:!HO(e.getRef(rA),l))});for(let h in f)s.attribute(h,f[h]);if(r?.attributes!==void 0)for(let h in r.attributes)s.attribute(h,r.attributes[h])}return s},_O=(e,t)=>ce(r=>D(iE(r,e,t))),jf=(e,t)=>Va(ce(r=>{let n=co(r.context,zs),o=iE(r,e,t??{}),s=r.getRef(ho),a=r.getRef(hc);return Er(qs(n,i=>NO(o,i,s,a)),o)})),PO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=tm(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return Q(jf(t,r),o=>xc(n,o,r))}return n=>Q(jf(t,r),o=>xc(n,o,r))},dq=(e,t)=>(t=typeof t=="function"?t:on,Qo(Uf,r=>({name:e,stack:t,parent:r}))),FO=Df,RO=Lf,$O=d(e=>se(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Qo(e,Lf,s=>[...s,...o])}),NO=(e,t,r,n)=>G(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():am,t)}),zf=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return ce(o=>{let s=iE(o,e,r),a=o.getRef(ho),i=o.getRef(hc);return kc(o,c=>NO(s,c,a,i)),n(s)})},lS=br(Mf),xc=function(){let e=se(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;return t._tag==="Span"&&(r=tm(r),n=dq(t.name,r?.captureStackTrace)),e?lS(n(arguments[0]),t):o=>lS(n(o),t)},MO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=tm(arguments[2]);if(e){let s=arguments[0];return zf(t,arguments[2],a=>xc(s,a,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>zf(t,n?n(...a):o,i=>xc(s,i,r))},UO=d(e=>se(e[0]),(e,...t)=>Qo(e,Df,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),DO=(...e)=>ce(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 he}),LO=ce(e=>{let t=e.currentSpanLocal;return t?D(t):Xe(new ro)}),BO=Zz(Mf),ho=ge("effect/Clock",{defaultValue:()=>new pS}),nS=2**31-1,pS=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=G(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return mq()}currentTimeNanos=G(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return zO()}monotonicTimeNanos=G(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Ko(t))}sleepMillis(t){return t<=0?Ic:Number.isFinite(t)?Ht(r=>{let n=t>nS?this.sleepMillis(t-nS):he,o=setTimeout(()=>r(n),Math.min(t,nS));return G(()=>clearTimeout(o))}):gm}},jO=BigInt(1e6),zO=(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())*jO;return r>t&&(t=r),t}})(),mq=(function(){let e=BigInt(1e9),t;return()=>{let r=zO(),n=BigInt(Date.now())*jO;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}})(),yo=e=>ce(t=>e(t.getRef(ho))),Ac=e=>yo(t=>t.sleep(Ut(e))),qO=yo(e=>e.currentTimeMillis);var dS="~effect/Cause/TimeoutError";var im=class extends Ho("TimeoutError"){[dS]=dS;constructor(t){super({message:t})}},mS="~effect/Cause/IllegalArgumentError";var cm=class extends Ho("IllegalArgumentError"){[mS]=mS;constructor(t){super({message:t})}},hS="~effect/Cause/ExceededCapacityError";var gS=class extends Ho("ExceededCapacityError"){[hS]=hS;constructor(t){super({message:t})}},xS="~effect/Cause/AsyncFiberError";var um=class extends Ho("AsyncFiberError"){[xS]=xS;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},yS="~effect/Cause/UnknownError";var yc=class extends Ho("UnknownError"){[yS]=yS;constructor(t,r){super({message:r,cause:t})}},cE=ge("effect/Console",{defaultValue:()=>globalThis.console}),hq=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}},gq=vy(Vo,hq),HO=oc(gq),uE=ge("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([Cq,Tq])}),xq=ge("effect/Logger/LogToStderr",{defaultValue:uf}),WO=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Va(ce(t=>{let r=t.getRef(Jo),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];U(n,s,a)}return t.setContext(rr(t.context,Jo,n)),qs(co(t.context,zs),o=>{let s=t.getRef(Jo),a={...s};for(let i=0;i<e.length;i++){let[c,f]=e[i];s[c]!==f&&!Object.is(s[c],f)||(Object.hasOwn(r,c)?U(a,c,r[c]):delete a[c])}return t.setContext(rr(t.context,Jo,a)),he})}))},yq="~effect/Logger",Sq={[yq]:{_Message:F,_Output:F},pipe(){return re(this,arguments)}},VO=e=>{let t=Object.create(Sq);return t.log=e,t},Eq=e=>e.replace(/[\s="]/g,"_"),bq=(e,t)=>`${Eq(e[0])}=${t-e[1]}ms`;var kn=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Qi(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?qo(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=Ey),ce(n=>{let o=e??n.cache.logLevel;if(HO(n.cache.minimumLogLevel,o))return he;let s=n.getRef(ho),a=n.getRef(uE);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 he})};var za={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},dne={None:[],All:[],Trace:[za.gray],Debug:[za.blue],Info:[za.green],Warn:[za.yellow],Error:[za.red],Fatal:[za.bgBrightRed,za.black]};var Iq=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 Cq=VO(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(pm(e));let a=t.getTime(),i=r.getRef(em),c="";for(let p of i)c+=` ${bq(p,a)}`;let f=r.getRef(Jo);Object.keys(f).length>0&&s.push(f);let u=r.getRef(cE);(r.getRef(xq)?u.error:u.log)(`[${Iq(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),Tq=VO(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(ho),s=t.getRef(Jo),a=t.cache.span;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,f]of Object.entries(s))U(i,c,f);i["effect.fiberId"]=t.id,i["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=pm(e)),a.event(qw(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function wq(){aS.interruptChildren??=Hz}var fE=D(void 0);var GO=d(e=>se(e[0]),(e,t)=>QS(e,r=>ce(n=>(kq(n,r,t?.defectsOnly),he)))),kq=(e,t,r)=>{let n=e.getRef(sA);if(n.size===0||r&&!hA(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(ho).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var KO=Qi,JO=Vw,$m=oo;var rl=qo;var ZO=If,nl=by;var lE=e=>new Pa(e),pE=e=>new Sf(e),QO=dA,Nm=fm,Vs=xA;var ol=lm;var YO=pm;var dE=Jw;var Mm=Xi,Rt=Qw;var Um=cm;var XO=yc;var te={};En(te,{Do:()=>_H,Transaction:()=>Nc,TypeId:()=>IH,abortSignal:()=>DW,acquireDisposable:()=>OW,acquireRelease:()=>ln,acquireUseRelease:()=>vP,addFinalizer:()=>ah,all:()=>mP,andThen:()=>rs,annotateCurrentSpan:()=>JW,annotateLogs:()=>kV,annotateLogsScoped:()=>AV,annotateSpans:()=>KW,as:()=>kr,asSome:()=>yP,asVoid:()=>GE,awaitAllChildren:()=>uV,bind:()=>RH,bindTo:()=>PH,cached:()=>tb,cachedInvalidateWithTTL:()=>NW,cachedWithTTL:()=>$W,callback:()=>sr,catch:()=>_n,catchCause:()=>Cr,catchCauseFilter:()=>GH,catchCauseIf:()=>VH,catchDefect:()=>bP,catchEager:()=>Al,catchFilter:()=>Il,catchIf:()=>HH,catchNoSuchElement:()=>WH,catchReason:()=>jH,catchReasons:()=>zH,catchTag:()=>ns,catchTags:()=>KE,clockWith:()=>Vc,context:()=>oh,contextWith:()=>kP,currentParentSpan:()=>QW,currentSpan:()=>ZW,delay:()=>CP,die:()=>ar,effectify:()=>et,ensuring:()=>Bc,eventually:()=>YH,exit:()=>Js,fail:()=>C,failCause:()=>Ya,failCauseSync:()=>Ks,failSync:()=>HE,fiber:()=>fV,fiberId:()=>lV,filter:()=>ZE,filterMap:()=>dW,filterMapEffect:()=>wP,filterMapOrElse:()=>hW,filterMapOrFail:()=>xW,filterOrElse:()=>mW,filterOrFail:()=>gW,findFirst:()=>kH,findFirstFilter:()=>AH,firstSuccessOf:()=>aW,flatMap:()=>B,flatMapEager:()=>$t,flatten:()=>xP,flip:()=>BH,fn:()=>yV,fnUntraced:()=>L,fnUntracedEager:()=>nb,forEach:()=>Qa,forever:()=>To,forkChild:()=>rb,forkDetach:()=>cV,forkIn:()=>qc,forkScoped:()=>Hc,fromNullishOr:()=>DH,fromOption:()=>MH,fromResult:()=>bl,gen:()=>Dt,head:()=>vH,ignore:()=>Lc,ignoreCause:()=>rW,interrupt:()=>ei,interruptible:()=>MW,interruptibleMask:()=>UW,isEffect:()=>wr,isFailure:()=>CW,isSuccess:()=>TW,let:()=>FH,linkSpans:()=>eV,log:()=>SV,logDebug:()=>CV,logError:()=>uh,logFatal:()=>EV,logInfo:()=>IV,logTrace:()=>TV,logWarning:()=>bV,logWithLevel:()=>$P,makeSpan:()=>PP,makeSpanScoped:()=>tV,map:()=>ne,mapBoth:()=>KH,mapBothEager:()=>Vt,mapEager:()=>ti,mapError:()=>kt,mapErrorEager:()=>kl,match:()=>Zs,matchCause:()=>EW,matchCauseEager:()=>bW,matchCauseEffect:()=>Cl,matchCauseEffectEager:()=>IW,matchEager:()=>SW,matchEffect:()=>QE,never:()=>th,onError:()=>jc,onErrorFilter:()=>PW,onErrorIf:()=>_W,onExit:()=>Co,onExitFilter:()=>RW,onExitIf:()=>FW,onExitPrimitive:()=>ih,onInterrupt:()=>OP,option:()=>LH,orDie:()=>os,orElseSucceed:()=>sW,partition:()=>CH,promise:()=>hP,provide:()=>YE,provideContext:()=>ss,provideService:()=>Io,provideServiceEffect:()=>XE,race:()=>pW,raceAll:()=>TP,raceAllFirst:()=>lW,raceFirst:()=>Xa,reduce:()=>TH,repeat:()=>LW,repeatOrElse:()=>BW,replicate:()=>jW,replicateEffect:()=>zW,request:()=>aV,requestUnsafe:()=>iV,result:()=>VE,retry:()=>XH,retryOrElse:()=>eW,runCallback:()=>dV,runCallbackWith:()=>pV,runFork:()=>wo,runForkWith:()=>Wc,runPromise:()=>FP,runPromiseExit:()=>ch,runPromiseExitWith:()=>mV,runPromiseWith:()=>RP,runSync:()=>hV,runSyncExit:()=>ko,runSyncExitWith:()=>xV,runSyncWith:()=>gV,sandbox:()=>tW,satisfiesErrorType:()=>LV,satisfiesServicesType:()=>BV,satisfiesSuccessType:()=>DV,schedule:()=>qW,scheduleFrom:()=>_P,scope:()=>Tl,scoped:()=>Qs,scopedWith:()=>eb,service:()=>AP,serviceOption:()=>sh,setContext:()=>wW,sleep:()=>nh,spanAnnotations:()=>YW,spanLinks:()=>XW,succeed:()=>y,succeedNone:()=>Sl,succeedSome:()=>gP,suspend:()=>Ie,sync:()=>le,tap:()=>Dc,tapCause:()=>rh,tapCauseFilter:()=>QH,tapCauseIf:()=>ZH,tapDefect:()=>IP,tapError:()=>JE,tapErrorTag:()=>JH,timed:()=>fW,timeout:()=>iW,timeoutOption:()=>cW,timeoutOrElse:()=>uW,tracer:()=>HW,track:()=>OV,trackDefects:()=>FV,trackDuration:()=>RV,trackErrors:()=>PV,trackSuccesses:()=>_V,transposeOption:()=>UH,try:()=>ht,tryPromise:()=>Uc,tx:()=>$V,txRetry:()=>UV,undefined:()=>OH,uninterruptible:()=>wl,uninterruptibleMask:()=>zc,unwrapReason:()=>qH,updateContext:()=>kW,updateService:()=>AW,updateServiceScoped:()=>vW,useSpan:()=>rV,validate:()=>wH,void:()=>xe,when:()=>yW,whileLoop:()=>Mc,withErrorReporting:()=>oW,withExecutionPlan:()=>nW,withFiber:()=>El,withFiberSucceed:()=>NH,withLogSpan:()=>vV,withLogger:()=>wV,withParentSpan:()=>sV,withSpan:()=>nV,withSpanScoped:()=>oV,withTracer:()=>WW,withTracerEnabled:()=>VW,withTracerTiming:()=>GW,yieldNow:()=>WE,yieldNowWith:()=>$H,zip:()=>SP,zipWith:()=>EP});var e_=Ef,ts=Fe,So=ur,An=an;var vn=pr;var ut=Gf,sl=KA;var Aq="~effect/Deferred";var vq={[Aq]:{_A:F,_E:F},pipe(){return re(this,arguments)}},t_=function(){this.resumes=void 0,this.effect=void 0};t_.prototype=vq;var Dm=()=>new t_;var vc=e=>Ht(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),G(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var mE=e=>G(()=>hE(e)),hE=e=>e.effect!==void 0;var Lm=(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 r_=Jo;var n_=em;var o_=Xd;var al=zs;var Oc=Am,il=Uv,Bm=qs,cl=Nv;var Gs=$v,fn=VS;var u_="~effect/Layer",a_="~effect/Layer/MemoMap",Oq=(e,t)=>{let r={observers:0,deferred:Dm(),scope:Oc(),finalizer:n=>ae(()=>--r.observers>0?he:(e.map.delete(t),fn(r.scope,n)))};return r},i_=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,wc(t,{},e.finalizer),!0),f_=e=>A(e,u_),_q={[u_]:{_ROut:F,_E:F,_RIn:F},pipe(){return re(this,arguments)}},l_=e=>{let t=Object.create(_q);return t.build=e,t},xE=e=>l_((t,r)=>{let n=Gs(r);return Gr(e(t,n),o=>o._tag==="Failure"?fn(n,o):he)}),Pq=e=>{let t=xE((r,n)=>r.getOrElseMemoize(t,n,e));return t},jm=class{get[a_](){return a_}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(i_(n,r),n.deferred.effect??vc(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return ae(()=>{let o;return Hs(ae(()=>{let s=this.get(t,r);if(s)return s;let a=Oq(this,t);return i_(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&Lm(o,s)})})}},yE=()=>new jm,Fq=e=>new jm(e);var fl=class e extends Ye()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Ud(t,e);return r?Fq(r):yE()}},SE=d(3,(e,t,r)=>br(Oe(ae(()=>e.build(t,r)),rr(fl,t)),fl,t));var p_=d(2,(e,t)=>ce(r=>SE(e,fl.forkOrCreate(r.context),t))),Eo=function(){return arguments.length===1?e=>zm(Go(arguments[0],e)):zm(Go(arguments[0],arguments[1]))},zm=e=>l_(at(D(e)));var _c=function(){return arguments.length===1?e=>c_(arguments[0],e):c_(arguments[0],arguments[1])},c_=(e,t)=>Rq(Oe(t,r=>Go(e,r))),Rq=e=>Pq((t,r)=>il(e,r));var d_=(e,t,r)=>{let n=Gs(r,"parallel");return Hr(e,o=>o.build(t,Gs(n,"sequential")),{concurrency:e.length}).pipe(Oe(o=>Tk(...o)))},qm=(...e)=>xE((t,r)=>d_(e,t,r));var m_=(e,t,r)=>xE((n,o)=>Q(Array.isArray(t)?d_(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Wr(s),Oe(a=>r(a,s))))),h_=d(2,(e,t)=>m_(e,t,F)),g_=d(2,(e,t)=>m_(e,t,(r,n)=>Na(n,r)));var Hm="~effect/DateTime",Wm="~effect/DateTime/TimeZone",y_={[Hm]:Hm,pipe(){return re(this,arguments)},[qe](){return this.toString()},toJSON(){return dl(this).toJSON()}},$q={...y_,_tag:"Utc",[Y](){return dt(this.epochMilliseconds)},[X](e){return Fc(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${dl(this).toJSON()})`}},Nq={...y_,_tag:"Zoned",[Y](){return ie(dt(this.epochMilliseconds))(q(this.zone))},[X](e){return Fc(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&W(this.zone,e.zone)},toString(){return`DateTime.Zoned(${PE(this)})`}},S_={[Wm]:Wm,[qe](){return this.toString()}},Mq={...S_,_tag:"Named",[Y](){return Ae(`Named:${this.id}`)},[X](e){return Ka(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},Uq={...S_,_tag:"Offset",[Y](){return Ae(`Offset:${this.offset}`)},[X](e){return Ka(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${vE(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},bo=(e,t,r)=>{let n=Object.create(Nq);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},Fc=e=>A(e,Hm);var Ka=e=>A(e,Wm),E_=e=>Ka(e)&&e._tag==="Offset",b_=e=>Ka(e)&&e._tag==="Named",I_=e=>e._tag==="Utc",IE=e=>e._tag==="Zoned",C_=yr((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var T_=e=>{let t=Object.create($q);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Pc=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Um("Invalid date");return T_(t)},Gm=e=>{if(Fc(e))return e;if(e instanceof Date)return Pc(e);if(typeof e=="object"){if("epochMilliseconds"in e)return Pc(new Date(e.epochMilliseconds));let t=new Date(0);return Wq(t,e),Pc(t)}else if(typeof e=="string"&&!Dq(e))return Pc(new Date(e+"Z"));return Pc(new Date(e))},Dq=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Lq=-864e13+720*60*1e3,Bq=864e13-840*60*1e3,CE=(e,t)=>{let r=t?.timeZone;if(r===void 0&&Fc(e)&&IE(e))return e;let n=Gm(e);if(n.epochMilliseconds<Lq||n.epochMilliseconds>Bq)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=pl(s)}else if(Ka(r))o=r;else if(typeof r=="number")o=pl(r);else{let s=kE(r);if(Ke(s))throw new Um(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?bo(n.epochMilliseconds,o,n.partsUtc):Vq(n.epochMilliseconds,o,t?.disambiguation??"compatible")},EE=io(CE),w_=io(Gm),jq=/^(.{17,35})\[(.+)\]$/,k_=e=>{let t=jq.exec(e);if(t===null){let o=_E(e);return o!==null?EE(e,{timeZone:o}):v()}let[,r,n]=t;return EE(r,{timeZone:n})};var A_=e=>T_(e.epochMilliseconds);var Vm=new Map,zq={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},qq=e=>{let t=e.resolvedOptions().timeZone,r=Vm.get(t);if(r!==void 0)return r;let n=Object.create(Mq);return n.id=t,n.format=e,Vm.set(t,n),n},TE=e=>{let t=Vm.get(e);if(t!==void 0)return t;try{let r=qq(new Intl.DateTimeFormat("en-US",{...zq,timeZone:e}));return Vm.set(e,r),r}catch{throw new Um(`Invalid time zone: ${e}`)}},pl=e=>{let t=Object.create(Uq);return t.offset=e,t},wE=io(TE);var Hq=/^(?:GMT|[+-])/,kE=e=>{if(Hq.test(e)){let t=_E(e);return t===null?v():R(pl(t))}return wE(e)},v_=e=>e._tag==="Offset"?vE(e.offset):e.id;var dl=e=>new Date(e.epochMilliseconds),Km=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},AE=e=>Km(e).getTime()-OE(e),vE=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")}`},O_=e=>vE(AE(e)),OE=e=>e.epochMilliseconds;var Wq=(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 x_=1440*60*1e3,Vq=(e,t,r)=>{if(t._tag==="Offset")return bo(e-t.offset,t);let n=ll(e-x_,e,t),o=ll(e+x_,e,t);if(n===o)return bo(e-n,t);let s=n<o,a=n-o;if(s){if(ll(e-o,e,t)===o)return bo(e-o,t);let f=bo(e-n,t),u=Km(f).getTime();if(e!==u)switch(r){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return bo(e-o,t);case"compatible":case"later":return f}return f}if(ll(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||ll(e-n+a,e+a,t)===n)return bo(e-n,t);if(r==="reject"){let f=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${f} occurs twice in time zone ${t.id}`)}}return bo(e-o,t)},Gq=/([+-])(\d{2}):(\d{2})$/,_E=e=>{let t=Gq.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},ll=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=_E(n);return o===null?AE(bo(t,r)):o};var __=e=>dl(e).toISOString();var bE=e=>{let t=Km(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${O_(e)}`},PE=e=>e.zone._tag==="Offset"?bE(e):`${bE(e)}[${e.zone.id}]`;var Zne=globalThis.Number;var F_=d(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]=P_(e),[o,s]=P_(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),f=i%c;if(f===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let u=globalThis.Number(`${f}e${a}`);return u===0?Math.sign(e)*globalThis.Number.MIN_VALUE:u});function P_(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 R_=d(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var Qne=globalThis.String;var N_=e=>e.trim();var U_=(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 Ir=d(2,(e,t)=>Yo(e,Zq,r=>t(r))),Rc=e=>e.reasons.some(FE),FE=e=>e._tag==="Fail"&&dE(e.error),Jm=e=>{let t,r=!1;for(let n of e.reasons)FE(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?Z(e):r?Z(rl(e.reasons.filter(n=>!FE(n)))):H(t)};var Zq=e=>{let t=Jm(e);return Se(t)?t:H(t.success.value)},RE=e=>{let t=Jm(e);return Se(t)?So(t.failure):ts(t.success.value)},Zm=d(2,(e,t)=>mo(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=Jm(r);return Se(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var D_="~effect/Schedule";var Za=ge("effect/Schedule/CurrentMetadata",{defaultValue:at({input:void 0,output:void 0,duration:lc,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Qq={[D_]:{_Out:F,_In:F,_Env:F},pipe(){return re(this,arguments)}},$E=e=>A(e,D_),ml=e=>{let t=Object.create(Qq);return t.step=e,t},NE=()=>{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}}},Yq=e=>ml(Oe(e,t=>{let r=NE();return(n,o)=>t(r(n,o))})),hl=e=>Vr(e.step,t=>D(()=>Ue(t))),Qm=e=>yo(t=>Oe(hl(e),r=>{let n=NE();return o=>ae(()=>{let s=t.currentTimeMillisUnsafe();return Q(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,Er(Ac(i),c)})})}));var ME=e=>ml(Oe(hl(e),t=>(r,n)=>Zm(t(r,n),{onSuccess:o=>D([n,o[1]]),onFailure:Ue,onDone:()=>Rt(n)}))),L_=e=>gl(UE,({attempt:t})=>D(t<=e)),Xq=e=>{let t=Ut(e);return Yq(D(r=>D([r.attempt-1,t])))};var gl=d(2,(e,t)=>ml(Oe(hl(e),r=>{let n=NE();return(o,s)=>Q(r(o,s),a=>{let[i,c]=a,f=t({...n(o,s),output:i,duration:c});return Q(se(f)?f:D(f),u=>u?D(a):Rt(i))})})));var UE=Xq(lc);var B_="~effect/ExecutionPlan";var eH={[B_]:B_,get captureRequirements(){let e=this;return js(t=>D(tH(e.steps.map(r=>({...r,while:r.while?n=>Wr(r.while(n),t):void 0,schedule:r.schedule?ml(Wr(Oe(hl(r.schedule),n=>(o,s)=>Wr(n(o,s),t)),t)):void 0,provide:f_(r.provide)?h_(r.provide,zm(t)):r.provide})))))},pipe(){return re(this,arguments)}},tH=e=>{let t=Object.create(eH);return t.steps=e,t};var j_=ge("effect/ExecutionPlan/CurrentMetadata",{defaultValue:at({attempt:0,stepIndex:0})});var rH=(e,t,r)=>vm(n=>Q(r?.local?SE(t,yE(),n):p_(t,n),o=>Wr(e,o))),Xm=d(e=>se(e[0]),(e,t,r)=>Ny(t)?Wr(e,t):rH(e,Array.isArray(t)?qm(...t):t,r));var H_=e=>e.reasons.every(oo)?wn(e):Z(e),DE=d(3,(e,t,r)=>Q(Qm(t),n=>{let o=Za.defaultValue();return Yo(Ir(bm(Ha(Q(ae(()=>br(e,Za,o)),n),s=>G(()=>{o=s})),{disableYield:!0}),s=>D(s)),H_,s=>r(s,o.attempt===0?v():R(o)))})),LE=d(3,(e,t,r)=>Q(Qm(t),n=>{let o=Za.defaultValue(),s,a=Yo(ae(()=>br(e,Za,o)),H_,i=>(s=i,Q(n(i),c=>(o=c,a))));return Ir(a,i=>$s(()=>r(s,i)))})),W_=d(2,(e,t)=>{let r=typeof t=="function"?t(F):$E(t)?t:yl(t);return DE(e,r,Xe)}),xl=d(2,(e,t)=>{let r=typeof t=="function"?t(F):$E(t)?t:yl(t);return LE(e,r,Xe)}),V_=d(3,(e,t,r)=>Q(Qm(r),n=>{let o=Za.defaultValue(),s=ae(()=>br(e,Za,o));return Ir(Q(n(t),a=>{o=a;let i=at(Q(s,n));return xo({while:Dr,body:i,step(c){o=c}})}),a=>D(a))})),nH=ME(UE),yl=e=>{let t=e.schedule?ME(e.schedule):nH;return e.while&&(t=gl(t,({input:r})=>{let n=e.while(r);return se(n)?n:D(n)})),e.until&&(t=gl(t,({input:r})=>{let n=e.until(r);return se(n)?Oe(n,o=>!o):D(!n)})),e.times!==void 0&&(t=gl(t,({attempt:r})=>D(r<=e.times))),t};var oH=(e,t)=>{let r=-1,n=0,o=s=>Tm(e(s));return{begin:yo(s=>ae(()=>{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 Er(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>yo(i=>{let c=uo(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})})}},J_=d(e=>se(e[0]),(e,t,r)=>ae(()=>{let n=0,o={attempt:0,stepIndex:0},s=Em(j_,G(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:oH(r.onEvent,()=>o),i=a===void 0?F:f=>Ws(u=>Q(a.begin,l=>Gr(u(f),p=>a.end(l,p)))),c;return Q(xo({while:()=>n<t.steps.length&&(c===void 0||Se(c)),body(){let f=t.steps[n],u=s(i(Xm(e,f.provide)));if(c){let l=!1,p=u;u=ae(()=>l?p:(l=!0,bc(c))),u=xl(u,K_(f,!1))}else{let l=K_(f,!0);u=l?xl(u,l):u}return Ls(u)},step(f){c=f,n++}}),()=>bc(c))})),K_=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return yl({schedule:e.schedule?e.schedule:e.attempts?void 0:sH,times:e.attempts,while:e.while});return yl({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},sH=L_(1);var Z_="~effect/MutableHashMap";var iH={[Z_]:Z_,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${N(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:Ot(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},Q_=()=>{let e=Object.create(iH);return e.backing=new Map,e.buckets=new Map,e};var BE=d(2,(e,t)=>{if(e.backing.has(t))return R(e.backing.get(t));if(jE(t))return v();let r=q(t),n=e.buckets.get(r);return n===void 0?v():cH(e,n,t)}),jE=e=>typeof e!="object"&&typeof e!="function";var cH=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(W(r,t[n])){let s=t[n];return R(e.backing.get(s))}return v()},Y_=d(2,(e,t)=>ve(BE(e,t))),X_=d(3,(e,t,r)=>{if(e.backing.has(t)||jE(t))return e.backing.set(t,r),e;let n=q(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=uH(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),uH=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(W(t,e[r]))return e[r]};var eP=d(2,(e,t)=>{if(jE(t))return e.backing.delete(t),e;let r=q(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||W(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e});var fH="~effect/Request",lH=Dw({_E:e=>e,_A:e=>e,_R:e=>e}),Soe={...Ww,[fH]:lH};var rP=e=>e;var oP=d(2,(e,t)=>{let r=n=>Ht(o=>{let s=aP(n,e,o,Ec());return hH(n,s)});return se(t)?Q(t,r):r(t)}),sP=(e,t)=>{let r=aP(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:ct(t.context,$f)}});return()=>iP(t.resolver,r)},dH=new WeakSet,mH=e=>{if(!dH.has(e.batchKey))return new Map;let t=Q_();return{get:r=>tr(BE(t,r)),has:r=>Y_(t,r),set:(r,n)=>X_(t,r,n),delete:r=>eP(t,r)}},eh=[],zE=new WeakMap,aP=(e,t,r,n)=>{let o=zE.get(e);o||(o=mH(e),zE.set(e,o));let s,a=!1,i=rP({request:t,context:n.context,uninterruptible:!1,completeUnsafe(f){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(f))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(eh.length>0)s=eh.pop(),s.key=c,s.resolver=e,s.map=o;else{let f={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:Q(ae(()=>f.resolver.delay),u=>nP(f)),run:Gr(ae(()=>f.resolver.runAll(Array.from(f.entries),f.key)),u=>{for(let l of f.entrySet)l.completeUnsafe(u._tag==="Success"?qr(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):u);return f.entries.clear(),eh.length<128&&(f.entrySet.clear(),f.key=void 0,f.fiber=void 0,f.resolver=void 0,f.map=void 0,eh.push(f)),he})};s=f}o.set(c,s),s.fiber=es(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=es(n.context)(nP(s),{scheduler:n.cache.scheduler})),i},iP=(e,t)=>{if(t.uninterruptible)return;let r=zE.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(Vf()),s?.interruptUnsafe()},hH=(e,t)=>G(()=>iP(e,t));function nP(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):he}var xH="effect/Metric/CurrentMetricAttributes",yH=ge(xH,{defaultValue:()=>({})}),SH="effect/Metric/MetricRegistry",EH=ge(SH,{defaultValue:()=>new Map}),cP="~effect/Metric",uP=class{[cP]=cP;#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=ct(t,yH);r!==this.#t&&(this.#t=r,this.#e=bH(this,fP(this.attributes,r)));let n=ct(t,EH),o=n.get(this.#e);return Fs(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?fP(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#e,o)),o.hooks}pipe(){return re(this,arguments)}};var $c=d(2,(e,t)=>js(r=>G(()=>e.updateUnsafe(t,r))));function bH(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 fP(e,t){return{...lP(e),...lP(t)}}function lP(e){return pt(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(U(t,r,n),t),{}):e}var IH=no,wr=se,mP=el,CH=eE,TH=Qv,wH=Yv,kH=Xv,AH=tO,Qa=Hr,vH=nO,Mc=xo,hP=wS,Uc=OA,y=D,Sl=Hf,gP=TS,Ie=ae,le=G,xe=he;var OH=fE;var sr=Ht,th=gm,_H=uO,PH=fO,FH=pO;var RH=lO,Dt=RA,C=Xe,HE=hm,Ya=Ue,Ks=AA,ar=Bs,ht=vA;var WE=Ic,$H=CS,El=ce,NH=Kw,bl=bc,MH=IS,UH=kA,DH=wA,B=Q,xP=qA,rs=go,Dc=Ha,VE=Ls,LH=Tv,Js=Zf,ne=Oe,kr=Er,yP=Sm,GE=Wf,BH=DA,SP=av,EP=$S,_n=Xo;var ns=DS,KE=xv,jH=yv,zH=Sv,qH=Ev,Cr=Vr,bP=pv,HH=Kf,Il=Cm,WH=lv,VH=MS,GH=Yo,kt=LS,KH=BS,os=jS,JE=US,JH=hv,rh=dv,ZH=mv,QH=Im,IP=gv,YH=zS,XH=xl,eW=LE,tW=LA,Lc=Cv,rW=Tm,nW=J_,oW=GO,sW=bv,aW=Iv,iW=Pv,cW=WS,uW=HS,CP=_v,nh=Ac,fW=Fv,TP=_S,lW=PS,pW=BA,Xa=FS,ZE=aO,dW=iO,wP=cO,mW=tE,hW=rE,gW=iv,xW=sO,yW=cv,Zs=wm,SW=Jf,EW=qS,bW=Av,IW=jA,Cl=mo,QE=Tc,CW=vv,TW=Ov,oh=RS,kP=js,YE=Xm,ss=Wr,wW=sv,AP=rv,sh=nv,kW=Cc,AW=Qo,vW=ov,Io=br,XE=Em,Tl=Qf,Qs=GS,eb=vm,ln=Wa,OW=zv,vP=Yf,ah=KS,Bc=Lv,jc=QS,_W=Bv,PW=YS,ih=Hs,Co=Gr,FW=JS,RW=ZS,tb=Wv,$W=Hv,NW=XS,ei=Vv,MW=Om,OP=jv,wl=Va,zc=Ws,UW=Jv,DW=Zv,To=bm,LW=W_,BW=DE,jW=NS,zW=uv,qW=d(2,(e,t)=>_P(e,void 0,t)),_P=V_,HW=wO,WW=kO,VW=AO,GW=vO,KW=UO,JW=DO,ZW=LO,QW=BO,YW=FO,XW=RO,eV=$O,PP=_O,tV=jf,rV=zf,nV=MO,oV=PO,sV=xc,aV=oP,iV=sP,rb=dO,qc=nE,Hc=gO,cV=mO,uV=hO,fV=PA,lV=FA,wo=yO,Wc=es,pV=oE,dV=SO,FP=bO,RP=sE,ch=EO,mV=Fm,hV=CO,gV=aE,ko=IO,xV=Rm,L=AS,yV=$A,Vc=yo,$P=kn,SV=kn(),EV=kn("Fatal"),bV=kn("Warn"),uh=kn("Error"),IV=kn("Info"),CV=kn("Debug"),TV=kn("Trace"),wV=d(2,(e,t)=>Qo(e,uE,r=>new Set([...r,t]))),kV=d(e=>wr(e[0]),(e,...t)=>Qo(e,r_,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),AV=WO,vV=d(2,(e,t)=>Q(qO,r=>Qo(e,n_,n=>[[t,r],...n]))),OV=d(e=>wr(e[0]),(e,t,r)=>Co(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),_V=d(e=>wr(e[0]),(e,t,r)=>Dc(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),PV=d(e=>wr(e[0]),(e,t,r)=>JE(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),FV=d(e=>wr(e[0]),(e,t,r)=>IP(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),RV=d(e=>wr(e[0]),(e,t,r)=>Vc(n=>{let o=n.monotonicTimeNanosUnsafe();return Co(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=Vk(Ut(s),Ut(o)),i=r===void 0?a:r(a);return $c(t,i)})})),Nc=class extends Ye()("effect/Effect/Transaction"){},$V=e=>El(t=>{let r=Ud(t.context,Nc);if(r&&!dP.has(r))return e;r={journal:new Map,retry:!1};let n;return zc(o=>B(Mc({while:()=>!n,body:at(o(e).pipe(Io(Nc,r),rh(s=>r.retry?fm(s)?o(NV(r)):le(()=>qE(r)):xe),Js)),step(s){if(r.retry||!NP(r))return qE(r);ut(s)&&MV(t,r),qE(r),dP.add(r),n=s}}),()=>n))}),dP=new WeakSet,NP=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},NV=e=>sr(t=>{if(!NP(e))return t(xe);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(xe)};for(let a of n)a.pending.set(r,s);return le(o)});function MV(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 qE(e){e.retry=!1,e.journal.clear()}var UV=B(Nc,e=>(e.retry=!0,ei)),et=(e,t,r)=>(...n)=>sr(o=>{try{e(...n,(s,a)=>{o(s?t?Ie(()=>C(t(s,n))):C(s):y(a))})}catch(s){o(r?C(r(s,n)):ar(s))}}),DV=()=>e=>e,LV=()=>e=>e,BV=()=>e=>e,ti=HA,kl=WA,Vt=VA,$t=zA,Al=GA,nb=NA;var MP=(e,t)=>ut(e)?t(0):Nm(e.cause)?t(130):t(UP(ol(e.cause))),ob=e=>d(t=>wr(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?wo(t):wo(rh(t,s=>Nm(s)?xe:DP(ol(s))?uh(s):xe));try{let s=globalThis.setInterval(jo,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??MP;return e({fiber:n,teardown:o})}),vl="~effect/Runtime/errorExitCode",UP=e=>{if(typeof e=="object"&&e!==null&&vl in e){let t=e[vl];if(typeof t=="number")return t}return 1},Ys="~effect/Runtime/errorReported",DP=e=>{if(typeof e=="object"&&e!==null&&Ys in e){let t=e[Ys];if(typeof t=="boolean")return t}return!0};var LP=ob(({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 BP=LP;var us={};En(us,{FileSystem:()=>Fn,FileTypeId:()=>eu,WatchBackend:()=>jl,isFile:()=>N4,layerNoop:()=>$4,make:()=>_b,makeNoop:()=>sR});var jP=globalThis.BigInt;var fh=e=>e>jP(Number.MAX_SAFE_INTEGER)||e<jP(Number.MIN_SAFE_INTEGER)?v():R(Number(e));var ab=BigInt(0),HV=BigInt(1),Ao=BigInt(1e3),Xs=BigInt(1024),zP=[{symbol:"B",factor:HV,names:["B","byte","bytes"]},{symbol:"kB",factor:Ao,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ao**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ao**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ao**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ao**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ao**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ao**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ao**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ao**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ao**BigInt(10),names:["QB","quettabyte","quettabytes"]}],WV=[zP[0],{symbol:"KiB",factor:Xs,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:Xs**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:Xs**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:Xs**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:Xs**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:Xs**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:Xs**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:Xs**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],VV=[...zP,...WV.slice(1)],GV=new Map(VV.flatMap(e=>e.names.map(t=>[t,e])));var ib=e=>e;var Gc=e=>{throw new Error(`Invalid ByteSize: ${e}`)},qP=e=>!Number.isSafeInteger(e)||e<0?Gc(`expected a non-negative safe integer, received ${e}`):ib(BigInt(e));var HP=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return Gc(`unsupported syntax ${JSON.stringify(e)}`);let r=GV.get(t[3]);if(r===void 0)return Gc(`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!==ab?Gc(`${JSON.stringify(e)} does not represent an integral number of bytes`):ib(s/o)},WP=io(HP),Ol=e=>{switch(typeof e){case"bigint":return e<ab?Gc(`expected a non-negative bigint, received ${e}`):ib(e);case"number":return qP(e);case"string":return HP(e)}return Gc(`unsupported input ${e}`)},cb=io(Ol),_l=e=>typeof e=="bigint"?Ol(e):qP(e);var VP=e=>typeof e=="bigint"&&e>=ab;var lh=e=>e,GP=fh;var KP="~effect/PlatformError",vo=class extends cn("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},ub=class extends Nf{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},ph=class extends cn("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[KP]=KP;get message(){return this.reason.message}};var Jr=e=>new ph(new ub(e)),pn=e=>new ph(new vo(e));var QP="~effect/Chunk";function JP(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 YP=[],lb=e=>yr((t,r)=>{if(t.length!==r.length)return!1;let n=ni(t),o=ni(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),KV=lb(W),JV={[QP]:{_A:e=>e},toString(){return`Chunk(${N(ni(this))})`},toJSON(){return{_id:"Chunk",values:Ot(ni(this))}},[qe](){return this.toJSON()},[X](e){return dh(e)&&KV(this,e)},[Y](){return Yn(ni(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return YP[Symbol.iterator]();default:return ni(this)[Symbol.iterator]()}},pipe(){return re(this,arguments)}},pb=e=>{let t=Object.create(JV);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=as,t.right=as;break}case"ISingleton":{t.length=1,t.depth=0,t.left=as,t.right=as;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=as,t.right=as;break}}return t},dh=e=>A(e,QP),as=pb({_tag:"IEmpty"}),ZV=()=>as;var QV=e=>pb({_tag:"ISingleton",a:e}),db=e=>dh(e)?e:XV(nr(e)),fb=(e,t,r)=>{switch(e.backing._tag){case"IArray":{JP(e.backing.array,0,t,r,e.length);break}case"IConcat":{fb(e.left,t,r),fb(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{JP(ni(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var YV=e=>{switch(e.backing._tag){case"IEmpty":return YP;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return fb(e,t,0),e.backing={_tag:"IArray",array:t},e.left=as,e.right=as,e.depth=0,t}}},ni=YV;var XV=e=>e.length===0?ZV():e.length===1?QV(e[0]):pb({_tag:"IArray",array:e});var XP=e=>e.length;var eF=nm;var mh=qf;var tF=Ec,rF=xO;var oF=TO;var aF="~effect/MutableRef",e4={[aF]:aF,...er,toJSON(){return{_id:"MutableRef",current:Ot(this.current)}}},iF=e=>{let t=Object.create(e4);return t.current=e,t};var t4=Symbol.for("effect/MutableList/Empty"),fF=()=>({head:void 0,tail:void 0,length:0}),lF=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})},uF=()=>({array:[],mutable:!0,offset:0,next:void 0}),Jc=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=uF(),e.tail=e.tail.next):e.head=e.tail=uF(),e.tail.array.push(t),e.length++};var Kc=e=>{e.head=e.tail=void 0,e.length=0},pF=(e,t)=>{if(t=vf(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 Kc(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?Kc(e):lF(e),r;o=o.next}return Kc(e),r};var hb=e=>{if(!e.head)return t4;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:Kc(e):lF(e),t};var r4="~effect/Queue",n4="~effect/Queue/Enqueue",o4="~effect/Queue/Dequeue";var gb={_A:F,_E:F},s4={[r4]:gb,[n4]:gb,[o4]:gb,...er,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:i4(this)}}},Zc=e=>ce(t=>{let r=Object.create(s4);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=fF(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},D(r)}),mF=e=>Zc({capacity:e});var Rl=d(2,(e,t)=>ae(()=>oi(e,t)?hh:e.state._tag==="Open"&&e.strategy==="suspend"?l4(e,t):SF)),oi=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(hb(e.messages),Jc(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Jc(e.messages,t),EF(e),!0):!1:(Jc(e.messages,t),bF(e),!0);var Qc=d(2,(e,t)=>G(()=>$l(e,t))),$l=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=ur(t),n=ev(r,c4);return e.state.offers.size===0&&e.messages.length===0?(gh(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},bF(e),!0)};var is=e=>$l(e,If(Xi()));var yb=e=>G(()=>a4(e)),a4=e=>{if(e.state._tag==="Done")return!1;Kc(e.messages);let t=e.state.offers;gh(e,e.state._tag==="Open"?u4:e.state.exit);for(let r of t)CF(r);return!0};var hF=e=>gF(e,1,Number.POSITIVE_INFINITY);var gF=d(3,(e,t,r)=>(t=vf(t),r=vf(r),Sb(()=>f4(e,t,r)??go(IF(e,()=>Eb(e,t)),gF(e,t,r))))),cs=e=>Sb(()=>yF(e)??go(IF(e,()=>Eb(e,1)),cs(e))),xF=e=>Sb(()=>{let t=yF(e);return t===void 0?D(v()):t._tag==="Success"?D(R(t.value)):D(v())});var yF=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=hb(e.messages);return xb(e),Fe(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=TF(e.state.offers);return xb(e),Fe(t)}};var i4=e=>e.state._tag==="Done"?0:e.messages.length;var SF=Fe(!1),hh=Fe(!0),c4=an(Xi()),u4=Vf(),EF=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(pr),e.messages.length===0))break}},bF=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,EF(e)},0))},f4=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return Fe([]);if(!Eb(e,t))return;let n=e.messages.length>0?pF(e.messages,r):[TF(e.state.offers)];return xb(e),Fe(n)},Sb=sn({op:"QueueTake",[Ge](e){let t=this[fe]();return Ef(t)?t[Ge](e):t}}),Eb=(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,IF=(e,t)=>Ht(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(pr);let n={ready:t,resume:r};return e.state.takers.add(n),G(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),l4=(e,t)=>Ht(r=>oi(e,t)?r(hh):p4(e,{_tag:"Single",message:t,resume:r})),p4=(e,t)=>{if(e.state._tag!=="Open")return CF(t);let r=e.state.offers;return r.add(t),G(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&gh(e,e.state.exit))})},CF=e=>e._tag==="Single"?e.resume(SF):e.resume(Fe(e.remaining.slice(e.offset))),TF=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(hh),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Fe([]))),r},xb=e=>{if(e.state._tag==="Done")return Rc(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(gh(e,e.state.exit),Rc(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")Jc(e.messages,t.message),e.state.offers.delete(t),t.resume(hh);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;Jc(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Fe([]))}let n=e.state;if(n._tag==="Done")return Rc(n.exit.cause)}return!1};var gh=(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 kF="~effect/Channel",wF=e=>A(e,kF),m4={[kF]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return re(this,arguments)}},dr=e=>{let t=Object.create(m4);return t.transform=(r,n)=>Cr(e(r,n),o=>y(Ya(o))),t},AF=(e,t)=>dr((r,n)=>B(Pn(e)(r,n),o=>t(o,n))),Ml=e=>dr((t,r)=>e),vF=e=>dr(L(function*(t,r){let n=Gs(r),o=a=>fn(n,RE(a)),s=yield*jc(e(t,r,n),o);return jc(s,o)})),Pn=e=>e.transform;var h4=(e,t,r)=>Zc({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Dc(n=>cl(e,yb(n))),Dc(n=>il(t(n),e).pipe(Cr(o=>Qc(n,o)),qc(e))));var OF=(e,t)=>dr((r,n)=>ne(h4(n,e,t),hF)),_F=e=>dr((t,r)=>Ie(()=>Pn(e())(t,r)));var PF=Ml(y(Rt()));var FF=e=>Ml(y(C(e)));var RF=d(2,(e,t)=>AF(e,r=>le(()=>{let n=0;return ne(r,o=>t(o,n++))}))),bb=d(2,(e,t)=>$F(e,r=>y(t(r)))),$F=d(2,(e,t)=>AF(e,r=>y(Ir(r,n=>B(t(n),Rt)))));var NF=d(e=>wF(e[0])&&wF(e[1]),(e,t,r)=>vF(L(function*(n,o,s){let a=r?.haltStrategy??"both",i=yield*mF(0);yield*cl(s,yb(i));let c=0;function f(l,p){if(c++,!Rc(p))return Qc(i,p);switch(a){case"both":return c===2?Qc(i,p):xe;case"left":case"right":return l===a?Qc(i,p):xe;case"either":return Qc(i,p)}}let u=(l,p,h)=>Pn(p)(n,h).pipe(B(g=>g.pipe(B(x=>Rl(i,x)),To)),jc(g=>ih(RE(g),x=>fn(h,x)).pipe(Cl({onFailure:x=>f(l,x),onSuccess:()=>f(l,g)}))),qc(s));return yield*u("left",e,Gs(s)),yield*u("right",t,Gs(s)),cs(i)})));var MF=()=>dr((e,t)=>le(()=>{let r="",n=!1,o=v();function s(c){let f=[];function u(l){r.length===0?f.push(l):(f.push(r+l),r="")}for(let l=0;l<c.length;l++){let p=c[l];if(p.length!==0){let h=0,g=p.indexOf("\r"),x=p.indexOf(`
23
+ ${IA(e.cause,`${t} `)}
24
+ ${t}}`),n},bS="~effect/Fiber",Lz={_A:F,_E:F},Bz={id:0},iA=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),CA=()=>iA===void 0?void 0:new iA("effect/Fiber"),Ec=()=>globalThis[Ki],Bf=class{constructor(t,r=!0){this.setContext(t),this.id=++Bz.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[bS](){return Lz}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return ct(this.context,t)}addObserver(t){return this._exit?(t(this._exit),jo):(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=Sc(t);this.cache.stackFrame&&(n=Cf(n,Go(kd,this.cache.stackFrame))),r&&(n=Cf(n,r)),this._interruptedCause=this._interruptedCause?Yi(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ue(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===Fa){this._asyncContext=CA();return}let n=aS.interruptChildren&&aS.interruptChildren(this);if(n!==void 0)return this.evaluate(Q(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=fr()}runLoop(t){let r=globalThis[Ki];globalThis[Ki]=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=Ue(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=Q(Ic,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[Ge](this),s===Fa){let i=this._yielded;if(Oa in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Fa}}catch(a){if(!A(s,Ge))return qr(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=qr(a)}}finally{this._running=n,globalThis[Ki]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,zz;for(;;){let r=this._stack.pop();if(!r)return;let n=r[_a];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&qz-1)===0)return Fe(t);let r=this.getCont(_t);return r?r[_t](t,this):this.yieldWith(Fe(t))}yieldWith(t){return this._yielded=t,Fa}children(){return this._children??=new Set}pipe(){return re(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&Ik(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=jz(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}},jz=e=>{let t=Af(e,Yy);return{scheduler:ct(e,$f),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:ct(e,Yd),span:Af(e,Qy),logLevel:ct(e,tS),minimumLogLevel:ct(e,Xd),stackFrame:ct(e,Uf),runtimeMetrics:Af(e,sA),maxOpsBeforeYield:ct(e,Zk),preventYield:ct(e,Qk)}},zz={[_t](e,t){return Ue(t._interruptedCause)},[jr](e,t){return Ue(t._interruptedCause)}},qz=32,aS={interruptChildren:void 0},dm=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Iy.key,e.cache.stackFrame),cc(t)},Hz=e=>{if(!(e._children===void 0||e._children.size===0))return gc(e._children)},TA=e=>{let t=e;return t._exit?D(t._exit):Ht(r=>t._exit?r(D(t._exit)):G(e.addObserver(n=>r(D(n)))))},mm=e=>Ht(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(D(n))}return s(),G(()=>o?.())}),nm=e=>{let t=e;return t._exit?t._exit:Ht(r=>t._exit?r(t._exit):G(e.addObserver(r)))};var qf=e=>ce(t=>wA(e,t.id)),wA=d(e=>A(e[0],bS),(e,t,r)=>ce(n=>{let o=dm(n);return o=o&&r?Na(o,r):o??r,e.interruptUnsafe(t,o),Wf(TA(e))})),gc=e=>ce(t=>{let r=dm(t),n=Ua();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Wf(mm(n))});var D=Fe,Ue=ur,Xe=an,G=sn({op:"Sync",[Ge](e){let t=this[fe](),r=e.getCont(_t);return r?r[_t](t,e):e.yieldWith(Fe(t))}}),ae=sn({op:"Suspend",[Ge](e){return this[fe]()}}),IS=d(e=>e.length>=2||$d(e[0]),(e,t)=>Ke(e)?Xe(t?t():new ro("Effect.fromOption: Option.none")):D(e.value)),bc=Sr({onFailure:Xe,onSuccess:D}),kA=e=>e==null?Xe(new ro):D(e),CS=sn({op:"Yield",[Ge](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(pr)},this[fe]??0),e.yieldWith(()=>{t=!0})}}),Ic=CS(0),TS=e=>D(R(e)),Hf=D(v()),AA=e=>Ke(e)?Hf:Oe(e.value,R),vA=e=>ae(()=>Ue(e())),Bs=e=>qr(e),hm=e=>ae(()=>Xe(e())),he=D(void 0);var OA=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new yc(n,"An error occurred in Effect.try"):e.catch;return ae(()=>{try{return D(t())}catch(n){return Xe(r(n))}})};var wS=e=>kS(function(t,r){e(r).then(n=>t(D(n)),n=>t(Bs(n)))},e.length!==0),_A=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new yc(n,"An error occurred in Effect.tryPromise"):e.catch;return kS(function(n,o){let s=a=>ae(()=>{try{return Xe($s(()=>r(a)))}catch(i){return Bs(i)}});try{t(o).then(a=>n(D(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},PA=e=>ce(t=>e(t.id)),FA=ce(D),RA=PA(D),kS=(function(){let e=zr({op:"Async",[Ge](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?Fa:(r._stack.push(Wz(()=>(n=!0,s?.abort(),a??pr))),Fa))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Wz=sn({op:"AsyncFinalizer",[_a](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Xf))},[jr](e,t){return ES(e)?Q($v(ur(e),this[fe]()),()=>Ue(e)):Ue(e)}}),Ht=e=>kS(e,e.length>=2),gm=Ht(jo),$A=(...e)=>{if(e.length===1){let n=e[0];return ae(()=>qa(n()))}let[t,r]=e;return ae(()=>qa(r.call(t.self)))},AS=(e,...t)=>{let r=t.length===0?function(){return ae(()=>qa(e.apply(this,arguments)))}:function(){let n=ae(()=>qa(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return vS(e.length,r)},vS=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),cA=rS(2),NA=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Tn(),o;return n!==0&&(jt(2),o=new globalThis.Error,jt(n)),e?(s,...a)=>uA(t,s,o,a,e,r):uA(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},uA=(e,t,r,n,o,s)=>{let a=typeof t=="function"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?cA(()=>r.stack):on;return vS(a.length,function(...f){let u=ae(()=>{let h=a.apply(this,arguments);return se(h)?h:qa(h)});for(let h=0;h<n.length;h++)u=n[h](u,...f);if(!se(u))return u;let l=Tn(),p;return l!==0&&(jt(2),p=new globalThis.Error,jt(l)),Qo(o?zf(e,s,h=>lS(u,h)):u,Uf,h=>({name:e,stack:p?cA(()=>p.stack):on,parent:{name:i,stack:c,parent:h}}))})},MA=(e,...t)=>vS(e.length,t.length===0?function(){return fA(()=>e.apply(this,arguments))}:function(){let r=fA(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),fA=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return D(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 ae(()=>s?(s=!1,Q(n.value,a=>qa(t,a))):ae(()=>qa(e())))}}}}catch(t){return Bs(t)}},qa=(function(){let e=zr({op:"Iterator",[_t](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return D(s.value);if($e(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[Ge](r){return this[_t](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)}})(),Er=d(2,(e,t)=>new Zo(e,OS,D(t))),xm=function(e){return e._stack.push(this),this[fe]},Vz=zr({op:"OnSuccess",[Ge]:xm}),Zo=function(e,t,r){this[fe]=e,this[_t]=t,this.payload=r};Zo.prototype=Vz;var OS=function(){return this.payload},UA=function(e,t){return t.succeedWith(this.payload)},ym=(()=>{let e=Tn();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};jt(1);let n=r[t]();return jt(e),n.stack?.includes("[as "+t+"]")===!0})(),Gz=function(e,t){let r=this.payload;return t.succeedWith(ym?r(e):$s(()=>r(e)))},DA=function(e){let t=this.payload;return t(e)},Kz=function(e){let t=this.payload;return new Zo(t(e),UA,e)},Jz=function(e){return new Zo(this.payload,UA,e)},Sm=e=>Oe(e,R),LA=e=>Tc(e,{onFailure:D,onSuccess:Xe}),go=d(2,(e,t)=>new Zo(e,se(t)?OS:DA,t)),Ha=d(2,(e,t)=>new Zo(e,se(t)?Jz:Kz,t)),Wf=e=>new Zo(e,OS,pr),BA=e=>Vr(e,Xe),_S=(e,t)=>ce(r=>{let n=new Set;return kc(r,()=>n.size===0?void 0:gc(n)),Ht(o=>{let s=nr(e),a=s.length,i=0,c=!1,f=[],u=(l,p,h)=>{if(i++,l._tag==="Failure"){f.push(...l.cause.reasons),i>=a&&o(Ue(qo(f)));return}let g=!c;c=!0,o(l),g&&t?.onWinner&&t.onWinner({fiber:p,index:h,parentFiber:r})};for(let l=0;l<a;l++){let p=Ga(r,s[l],!0,!0,!1);if(n.add(p),p.addObserver(h=>{n.delete(p),u(h,p,l)}),c)break}})}),PS=(e,t)=>ce(r=>{let n=new Set;return kc(r,()=>n.size===0?void 0:gc(n)),Ht(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,f=Ga(r,i,!0,!0,!1);n.add(f),f.addObserver(u=>{n.delete(f);let l=!s;s=!0,o(u),l&&t?.onWinner&&t.onWinner({fiber:f,index:c,parentFiber:r})})}})}),jA=d(e=>se(e[1]),(e,t,r)=>_S([e,t],r)),FS=d(e=>se(e[1]),(e,t,r)=>PS([e,t],r)),Q=d(2,(e,t)=>new Zo(e,DA,t)),zA=d(2,(e,t)=>$e(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):mo(e,t)),$e=e=>e[Oa]!==void 0,qA=d(2,(e,t)=>$e(e)?e._tag==="Success"?t(e.value):e:Q(e,t)),HA=e=>Q(e,F),Oe=d(2,(e,t)=>new Zo(e,Gz,t)),WA=d(2,(e,t)=>$e(e)?YA(e,t):Oe(e,t)),VA=d(2,(e,t)=>$e(e)?XA(e,t):LS(e,t)),GA=d(2,(e,t)=>$e(e)?ev(e,t):BS(e,t)),KA=d(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return e;let r=wn(e.cause);return Se(r)?e:t(r.success)}return Xo(e,t)}),Vf=e=>ur(Sc(e)),Gf=e=>e._tag==="Success";var JA=e=>e._tag==="Failure";var ZA=e=>e._tag==="Failure"?H(e.cause):Z(e);var QA=e=>e._tag==="Failure"&&ES(e.cause);var pr=Fe(void 0),YA=d(2,(e,t)=>e._tag==="Success"?Fe(t(e.value)):e),XA=d(2,(e,t)=>{if(e._tag==="Success")return e;let r=wn(e.cause);return Se(r)?e:an(t(r.success))}),ev=d(2,(e,t)=>{if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=wn(e.cause);return Se(r)?e:an(t.onFailure(r.success))});var tv=d(2,(e,t)=>Gf(e)?t:e);var rv=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?pr:ur(qo(t))};var nv=e=>e,ov=e=>ce(t=>D(Dd(t.context,e))),Zz=e=>ce(t=>IS(Dd(t.context,e))),Cc=d(2,(e,t)=>ce(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),kc(r,()=>{r.setContext(n)})),e})),Qo=d(3,(e,t,r)=>Cc(e,n=>{let o=co(n,t),s=r(o);return o===s?n:rr(n,t,s)})),sv=(e,t,r)=>Va(ce(n=>{let o=co(n.context,e),s=t(o);return n.setContext(rr(n.context,e,s)),qs(co(n.context,zs),a=>{let i=Dd(n.context,e);if(Ke(i))return he;let c=i.value,f;if(r?.reset===void 0){if(c!==s)return he;f=o}else f=r.reset(o,s,c);return n.setContext(rr(n.context,e,f)),he})})),RS=()=>Qz,Qz=ce(e=>D(e.context)),js=e=>ce(t=>e(t.context)),av=d(2,(e,t)=>Cc(e,at(t))),Wr=d(2,(e,t)=>$e(e)?e:Cc(e,Na(t))),br=function(){return arguments.length===1?d(2,(e,t)=>lA(e,arguments[0],t)):d(3,(e,t,r)=>lA(e,t,r)).apply(this,arguments)},lA=(e,t,r)=>Cc(e,rr(t,r)),Em=d(3,(e,t,r)=>Q(r,n=>br(e,t,n))),iv=d(e=>se(e[1]),(e,t,r)=>$S(e,t,(n,o)=>[n,o],r)),$S=d(e=>se(e[1]),(e,t,r,n)=>n?.concurrent?Oe(el([e,t],{concurrency:2}),([o,s])=>r(o,s)):Q(e,o=>Oe(t,s=>r(o,s)))),cv=d(e=>se(e[0]),(e,t,r)=>tE(e,t,r?n=>Xe(r(n)):()=>Xe(new ro))),uv=d(2,(e,t)=>Q(t,r=>r?Sm(e):Hf)),NS=d(2,(e,t)=>Array.from({length:t},()=>e)),fv=d(e=>se(e[0]),(e,t,r)=>el(NS(e,t),r)),bm=d(e=>se(e[0]),(e,t)=>xo({while:Dr,body:at(t?.disableYield?e:Q(e,r=>Ic)),step:jo})),Vr=d(2,(e,t)=>new lv(e,t.length!==1?r=>t(r):t)),Yz=zr({op:"OnFailure",[Ge]:xm}),lv=function(e,t){this[fe]=e,this[jr]=t};lv.prototype=Yz;var MS=d(3,(e,t,r)=>Vr(e,n=>t(n)?r(n):Ue(n))),Yo=d(3,(e,t,r)=>Vr(e,n=>{let o=t(n);return Se(o)?Ue(o.failure):r(o.success,n)})),Xo=d(2,(e,t)=>Yo(e,wn,r=>t(r))),pv=e=>Tc(e,{onFailure:t=>Cy(t)?Hf:Xe(t),onSuccess:TS}),dv=d(2,(e,t)=>Yo(e,SS,t)),mv=d(2,(e,t)=>Vr(e,r=>go(t(r),Ue(r)))),hv=d(3,(e,t,r)=>MS(e,t,n=>go(r(n),Ue(n)))),Im=d(3,(e,t,r)=>Vr(e,n=>{let o=t(n);return Se(o)?Ue(n):go(r(o.success,n),Ue(n))})),US=d(2,(e,t)=>Im(e,wn,r=>t(r))),gv=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>A(o,"_tag")&&t.includes(o._tag):Br(t);return US(e,o=>n(o)?r(o):he)}),xv=d(2,(e,t)=>Im(e,SS,r=>t(r))),Kf=d(e=>se(e[0]),(e,t,r,n)=>Vr(e,o=>{let s=wn(o);return Se(s)?Ue(s.failure):t(s.success)?r(s.success):n?n(s.success):Ue(o)})),Cm=d(e=>se(e[0]),(e,t,r,n)=>Vr(e,o=>{let s=wn(o);if(Se(s))return Ue(s.failure);let a=t(s.success);return Se(a)?n?n(a.failure):Ue(o):r(a.success)})),DS=d(e=>se(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>A(s,"_tag")&&t.includes(s._tag):Br(t);return Kf(e,o,r,n)}),yv=d(e=>se(e[0]),(e,t,r)=>{let n;return Cm(e,o=>(n??=Object.keys(t),A(o,"_tag")&&In(o._tag)&&n.includes(o._tag)?H(o):Z(o)),o=>t[o._tag](o),r)}),Sv=d(e=>se(e[0]),(e,t,r,n,o)=>Kf(e,s=>Br(s,t)&&A(s,"reason")&&(o!==void 0||Br(s.reason,r)),s=>{let a=s.reason;return Br(a,r)?n(a,s):o?o(a,s):Xe(s)})),Ev=d(e=>se(e[0]),(e,t,r,n)=>{let o;return Kf(e,s=>Br(s,t)&&A(s,"reason")&&A(s.reason,"_tag")&&In(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):Xe(s)})}),bv=d(2,(e,t)=>Cm(e,r=>Br(r,t)&&A(r,"reason")?H(r.reason):Z(r),Xe)),LS=d(2,(e,t)=>Xo(e,r=>hm(()=>t(r)))),BS=d(2,(e,t)=>Tc(e,{onFailure:r=>hm(()=>t.onFailure(r)),onSuccess:r=>G(()=>t.onSuccess(r))})),jS=e=>Xo(e,Bs),Iv=d(2,(e,t)=>Xo(e,r=>G(()=>t(r)))),Cv=e=>ae(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return Bs(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:Xo(o.value,a=>n(s))}return n(r)}),zS=e=>Xo(e,t=>Q(Ic,()=>zS(e))),Tv=d(e=>se(e[0]),(e,t)=>{if(!t?.log)return Tc(e,{onFailure:n=>he,onSuccess:n=>he});let r=kn(t.log===!0?void 0:t.log);return mo(e,{onFailure(n){let o=hA(n);return Se(o)?Ue(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>he})}),Tm=d(e=>se(e[0]),(e,t)=>{if(!t?.log)return mo(e,{onFailure:n=>he,onSuccess:n=>he});let r=kn(t.log===!0?void 0:t.log);return mo(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>he})}),wv=e=>wm(e,{onFailure:v,onSuccess:R}),Ls=e=>Jf(e,{onFailure:Z,onSuccess:H}),mo=d(2,(e,t)=>new kv(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),Xz=zr({op:"OnSuccessAndFailure",[Ge]:xm}),kv=function(e,t,r){this[fe]=e,this[_t]=t,this[jr]=r};kv.prototype=Xz;var eq=function(e,t){let r=this.payload;return t.succeedWith(ym?r.onSuccess(e):$s(()=>r.onSuccess(e)))},Av=(e,t)=>{let r=zr({op:e,[Ge]:xm,[_t]:eq,[jr]:t}),n=function(o,s){this[fe]=o,this.payload=s};return n.prototype=r,n},tq=Av("Match",function(e,t){let r=e.reasons.find(oo);if(r===void 0)return Ue(e);let n=this.payload;return t.succeedWith(ym?n.onFailure(r.error):$s(()=>n.onFailure(r.error)))}),rq=Av("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(ym?r.onFailure(e):$s(()=>r.onFailure(e)))}),qS=d(2,(e,t)=>new rq(e,t)),Tc=d(2,(e,t)=>mo(e,{onFailure:r=>{let n=r.reasons.find(oo);return n?t.onFailure(n.error):Ue(r)},onSuccess:t.onSuccess})),wm=d(2,(e,t)=>new tq(e,t)),Jf=d(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=wn(e.cause);return Se(r)?e:Fe(t.onFailure(r.success))}return wm(e,t)}),vv=d(2,(e,t)=>$e(e)?e._tag==="Success"?Fe(t.onSuccess(e.value)):Fe(t.onFailure(e.cause)):qS(e,t)),Zf=e=>$e(e)?Fe(e):nq(e),nq=sn({op:"Exit",[Ge](e){return e._stack.push(this),this[fe]},[_t](e,t,r){return t.succeedWith(r??Fe(e))},[jr](e,t,r){return t.succeedWith(r??ur(e))}}),Ov=Jf({onFailure:()=>!0,onSuccess:()=>!1}),_v=Jf({onFailure:()=>!1,onSuccess:()=>!0}),Pv=d(2,(e,t)=>go(Ac(t),e)),HS=d(2,(e,t)=>Q(WS(e,t.duration),r=>Ke(r)?t.orElse():D(r.value))),oq=e=>new im(`Operation timed out after '${zy(e)}'`),Fv=d(2,(e,t)=>{let r=Ut(t);return HS(e,{duration:r,orElse:()=>Xe(oq(r))})}),WS=d(2,(e,t)=>FS(Sm(e),Er(Ac(t),v()))),Rv=e=>yo(t=>{let r=t.monotonicTimeNanosUnsafe();return Oe(e,n=>[uo(t.monotonicTimeNanosUnsafe()-r),n])}),iS="~effect/Scope",cS="~effect/Scope/Closeable",zs=Ye("effect/Scope"),VS=(e,t)=>ce(r=>(cq(r),km(e,t)??he)),km=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&sm(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return om(r.finalizer,t);let n=r.finalizers;return n.size===1?om(n.values().next().value,t):sq(e,n,t)},om=(e,t)=>{try{return e(t)}catch(r){return qr(r)}},$v=(e,t)=>Gf(e)?t:Vr(t,r=>Ue(Yi(e.cause,r))),sq=AS(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=Ec();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?n.push(yield*Zf(om(c,r))):o.push(Ga(a,om(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*mm(o)),yield*rv(n)});var Nv=(e,t)=>{let r=Uv(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(wc(e,r,n=>VS(r,n)),r)},qs=(e,t)=>ae(()=>e.state._tag==="Closed"?t(e.state.exit):(wc(e,{},t),he)),Mv=(e,t)=>qs(e,at(t)),wc=(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)}},sm=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=uS:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=uS))},Am=e=>Uv(e,void 0),Uv=(e="sequential",t)=>({[cS]:cS,[iS]:iS,strategy:e,parent:t,state:uS}),uS={_tag:"Empty"};var Qf=zs,Dv=br(zs),GS=e=>ce(t=>{let r=t.context,n=Am();return t.setContext(rr(t.context,zs,n)),kc(t,o=>(t.setContext(r),km(n,o))),e});var vm=e=>ae(()=>{let t=Am();return Gr(e(t),r=>ae(()=>km(t,r)??he))}),Wa=(e,t,r)=>js(n=>Ws(o=>Q(Qf,s=>Ha(r?.interruptible?o(e):e,a=>qs(s,i=>Wr(t(a,i),n)))))),KS=e=>Q(Qf,t=>js(r=>qs(t,n=>Wr(e(n),r)))),Lv=(function(){let e=zr({op:"OnExit",[Ge](r){return r._stack.push(this),this.effect},[_a](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Xf),r.interruptible=!1)},[_t](r,n,o){o??=Fe(r);let s;try{s=this.onExit(o)}catch(a){s=qr(a)}return s?Q(s,a=>o):o},[jr](r,n,o){o??=ur(r);let s;try{s=this.onExit(o)}catch(a){s=qr(a)}return s?Q($v(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),Hs=(e,t,r)=>new Lv(e,t,r),kc=(e,t)=>{e._stack.push(new Lv(void 0,t,void 0))},Gr=d(2,Hs),Bv=d(2,(e,t)=>Gr(e,r=>t)),JS=d(3,(e,t,r)=>Gr(e,n=>t(n)?r(n):he)),ZS=d(3,(e,t,r)=>Gr(e,n=>{let o=t(n);return Se(o)?he:r(o.success,n)})),QS=d(2,(e,t)=>ZS(e,ZA,t)),jv=d(3,(e,t,r)=>JS(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),YS=d(3,(e,t,r)=>Gr(e,n=>{if(n._tag!=="Failure")return he;let o=t(n.cause);return Se(o)?he:r(o.success,n.cause)})),zv=d(2,(e,t)=>YS(xA,t)(e)),Yf=(e,t,r)=>Ws(n=>Q(e,o=>Hs(ae(()=>n(t(o))),s=>r(o,s),!0))),qv=e=>Wa(e,t=>A(t,Symbol.asyncDispose)?wS(()=>t[Symbol.asyncDispose]()):G(()=>t[Symbol.dispose]())),XS=d(2,(e,t)=>G(()=>Hv(e,typeof t=="function"?r=>Ko(Ut(t(r))):at(Ko(Ut(t)))))),aq=at(1/0),Hv=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,kc(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,qf(i.fiber)}),nm(i.fiber));return[ce(a=>{if(o!==void 0)return a===o.fiber?nm(o.fiber):s(a,o);if(n!==void 0&&(r===1/0||a.getRef(ho).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(ho),c={fiber:new Bf(a.context),awaiters:0};o=c;let f=s(a,c);return c.fiber.evaluate(Hs(e,u=>{if(o!==c||(o=void 0,QA(u)))return;let l=t(u);r=l===1/0?1/0:i.currentTimeMillisUnsafe()+l,n=u})),c.fiber._exit??f}),G(()=>{n=void 0})]},Wv=d(2,(e,t)=>Oe(XS(e,t),r=>r[0])),Vv=e=>G(()=>Hv(e,aq)[0]),Gv=ce(e=>Ue(Sc(e.id))),Va=e=>ce(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Xf)),e)),Kv=sn({op:"SetInterruptible",[_a](e){if(e.interruptible=this[fe],e._interruptedCause&&e.interruptible)return()=>Ue(e._interruptedCause)}}),Xf=Kv(!0),iq=Kv(!1),Jv=e=>{if(e.interruptible=!0,e._stack.push(iq),e._interruptedCause)return Ue(e._interruptedCause)},cq=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Xf))};var Om=e=>ce(t=>t.interruptible?e:Jv(t)??e),Ws=e=>ce(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Xf),e(Om)):e(F)),Zv=e=>ce(t=>{if(t.interruptible)return e(F);let r=Jv(t),n=e(Va);return r??n}),Qv=Oe(Wa(G(()=>new AbortController),e=>G(()=>e.abort())),e=>e.signal),el=(e,t)=>Qn(e)?t?.mode==="result"?Hr(e,Ls,t):Hr(e,F,t):t?.discard?t.mode==="result"?Hr(Object.values(e),Ls,t):Hr(Object.values(e),F,t):ae(()=>{let r={};return Er(Hr(Object.entries(e),([n,o])=>Oe(t?.mode==="result"?Ls(o):o,s=>{U(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),eE=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>Oe(Hr(e,(n,o)=>Ls(t(n,o)),r),n=>Ly(n,F))),Yv=d(3,(e,t,r)=>{let n=nr(e);return n.length===0?G(t):ae(()=>{let o=0,s=t();return Oe(xo({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),Xv=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>Q(eE(e,t,{concurrency:r?.concurrency}),([n,o])=>Ma(o)?Xe(o):r?.discard?he:D(n))),eO=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):tO(r,0,t,n.value)})),tO=(e,t,r,n)=>Q(r(n,t),o=>{if(o)return D(R(n));let s=e.next();return s.done?D(v()):tO(e,t+1,r,s.value)}),rO=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):nO(r,0,t,n.value)})),nO=(e,t,r,n)=>Q(r(n,t),o=>{if(wt(o))return D(R(o.success));let s=e.next();return s.done?D(v()):nO(e,t+1,r,s.value)}),xo=sn({op:"While",[_t](e,t){return this[fe].step(e),this[fe].while()?(t._stack.push(this),this[fe].body()):pr},[Ge](e){return this[fe].while()?(e._stack.push(this),this[fe].body()):pr}}),Hr=d(e=>typeof e[1]=="function",(e,t,r)=>ae(()=>{let n=tl(r?.concurrency);if(n===1)return uq(e,t,r);let o=nr(e),s=o.length;if(s===0)return r?.discard?he:D([]);let a=r?.discard?void 0:new Array(s),i=fq({f:t,out:a},o,{concurrency:n});return i?Er(i,a):D(a)})),oO=e=>Q(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Xe(new ro):D(r.value)}),uq=(e,t,r)=>ae(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return Er(xo({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),tl=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),_m=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,f)=>Q(Zf(f),u=>r(s,a[i],u,i)??o(s,a,i+1,c)??he),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let f=a[i],u=t(s,f,i);if(!$e(u))return n(s,a,i,c,u);let l=r(s,f,u,i);if(l)return l._tag==="Failure"?l:void 0}};return o},sO=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,f=!1,u,l,p,h,g,x=T=>{let w=qr(T);return h=w,f=!0,l&&l.size>0?Q(Va(gc(Array.from(l))),()=>h??w):w},b=()=>{let T=!1;for(;!h&&a<i;a++){let w=o[a],P=g??t(n,w,a);if($e(P)){if(h=r(n,w,P,a),h)break}else if(u){g=void 0;let O=Ga(u,P,!0,!0,"inherit");if(O._exit){if(h=r(n,w,O._exit,a),h)break;continue}l.add(O);let m=a;if(O.addObserver(S=>{l.delete(O);try{if(h){if(S._tag==="Failure"){let E=S.cause.reasons.filter(I=>I._tag!=="Interrupt");if(E.length>0){let I=qo(E);h=ur(h._tag==="Failure"?Yi(h.cause,I):I)}}}else{let E=r(n,w,S,m);E&&(h=E,b())}if(T){let E=b();E&&p(E)}else f&&l.size===0&&p(h??he)}catch(E){p(x(E))}}),l.size<c)continue;T=!0,a++;return}else return Ht(O=>{u=Ec(),l=new Set,g=P,p=O;let m;try{m=b()}catch(S){return O(x(S))}return m?O(m):ae(()=>(h??=pr,Q(l?gc(l):he,()=>h?._tag==="Failure"?h:he)))})}if(f=!0,h){if(l&&l.size>0){let w=dm(u);l.forEach(P=>P.interruptUnsafe(u.id,w));return}if(p||h._tag==="Failure")return h}else if(p)if(l)l.size===0&&p(he);else return pr};return b()}},Pm=()=>e=>sO(e),fq=sO({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)}}),tE=d(3,(e,t,r)=>Q(e,n=>t(n)?D(n):r(n))),rE=d(3,(e,t,r)=>Q(e,n=>{let o=t(n);return Se(o)?r(o.failure):D(o.success)})),aO=d(e=>se(e[0]),(e,t,r)=>rE(e,t,r?n=>Xe(r(n)):()=>Xe(new ro))),iO=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>ae(()=>{let n=[];return Er(Hr(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&n.push(o),he):Oe(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),cO=d(e=>Qn(e[0])&&!se(e[0]),(e,t)=>ae(()=>{let r=[];for(let n of e){let o=t(n);wt(o)&&r.push(o.success)}return D(r)})),uO=d(e=>Qn(e[0])&&!se(e[0]),(e,t,r)=>ae(()=>{let n=[];return Er(Hr(e,o=>Oe(t(o),s=>{wt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),fO=D({}),lO=tk(Oe),pO=rk(Oe,Q),dO=ek(Oe);var mO=d(e=>se(e[0]),(e,t)=>ce(r=>(wq(),D(Ga(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Ga=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new Bf(s.context,a);return n||(s.children().add(i),i._parent=s),r?i.evaluate(t):(i._asyncContext=CA(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),i},hO=d(e=>se(e[0]),(e,t)=>ce(r=>D(Ga(r,e,t?.startImmediately,!0,t?.uninterruptible)))),gO=e=>ce(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return Hs(e,o=>{let s=t._children;if(s===void 0||s.size===0)return he;r&&(s=Pk(s,i=>!r.has(i)));let a=Wf(mm(s));return n?Om(a):a})}),nE=d(e=>se(e[0]),(e,t,r)=>ce(n=>{let o=Ga(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};wc(t,s,()=>PA(i=>i===o.id?he:qf(o))),o.addObserver(()=>sm(t,s))}else o.interruptUnsafe(n.id,dm(n));return D(o)})),xO=d(e=>se(e[0]),(e,t)=>Q(Qf,r=>nE(e,r,t))),es=e=>(t,r)=>{let n=new Bf(r?.scheduler?rr(e,$f,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},yO=d(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(sm(t,e),wc(t,e,()=>qf(e)),e.addObserver(()=>sm(t,e)),e)),SO=es(fr()),oE=e=>{let t=es(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},EO=oE(fr()),Fm=e=>{let t=es(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},bO=Fm(fr()),sE=e=>{let t=Fm(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw lm(o.cause);return o.value})},IO=sE(fr()),Rm=e=>{let t=es(e);return r=>{if($e(r))return r;let n=new Ba("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??qr(new um(o))}},CO=Rm(fr()),aE=e=>{let t=Rm(e);return r=>{let n=t(r);if(n._tag==="Failure")throw lm(n.cause);return n.value}},TO=aE(fr()),pA=D(!0),dA=D(!1),fS=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return pA;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=[],pA}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](pr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](pr)}open=ce(t=>this._isOpen?dA:(this._isOpen=!0,this.scheduleUnsafe(t)));release=ce(t=>this._isOpen?dA:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Ht(t=>this._isOpen?t(he):(this.waiters.push(t),G(()=>{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=G(()=>this.closeUnsafe());whenOpen=t=>Q(this.await,()=>t);isOpen(){return this._isOpen}},wO=e=>new fS(e??!1);var kO=ce(e=>D(e.getRef(Xy))),AO=d(2,(e,t)=>br(e,Xy,t)),vO=br(Yd),OO=br(hc),am=BigInt(0),lq={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:am,endTime:am,exit:pr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},pq=e=>Object.assign(Object.create(lq),e),_O=e=>e?ct(e.annotations,Qd)?e._tag==="Span"?_O(tr(e.parent)):v():R(e):v(),iE=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&ct(r.annotations,Qd),o=r?.parent!==void 0?R(r.parent):r?.root?v():_O(e.cache.span),s;if(n)s=pq({name:t,parent:o,annotations:rr(r?.annotations??fr(),Qd,!0)});else{let a=e.cache.tracer??eS,i=e.getRef(ho),c=e.getRef(hc),f=e.getRef(Df),u=e.getRef(Lf),l=r?.level??e.getRef(rA),p=r?.links!==void 0?[...u,...r.links]:u.length===0?[]:u.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??fr(),links:p,startTime:c?i.currentTimeNanosUnsafe():am,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(ve(o)&&o.value.sampled===!1?!1:!WO(e.getRef(nA),l))});for(let h in f)s.attribute(h,f[h]);if(r?.attributes!==void 0)for(let h in r.attributes)s.attribute(h,r.attributes[h])}return s},PO=(e,t)=>ce(r=>D(iE(r,e,t))),jf=(e,t)=>Va(ce(r=>{let n=co(r.context,zs),o=iE(r,e,t??{}),s=r.getRef(ho),a=r.getRef(hc);return Er(qs(n,i=>MO(o,i,s,a)),o)})),FO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=tm(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return Q(jf(t,r),o=>xc(n,o,r))}return n=>Q(jf(t,r),o=>xc(n,o,r))},dq=(e,t)=>(t=typeof t=="function"?t:on,Qo(Uf,r=>({name:e,stack:t,parent:r}))),RO=Df,$O=Lf,NO=d(e=>se(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Qo(e,Lf,s=>[...s,...o])}),MO=(e,t,r,n)=>G(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():am,t)}),zf=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return ce(o=>{let s=iE(o,e,r),a=o.getRef(ho),i=o.getRef(hc);return kc(o,c=>MO(s,c,a,i)),n(s)})},lS=br(Mf),xc=function(){let e=se(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;return t._tag==="Span"&&(r=tm(r),n=dq(t.name,r?.captureStackTrace)),e?lS(n(arguments[0]),t):o=>lS(n(o),t)},UO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=tm(arguments[2]);if(e){let s=arguments[0];return zf(t,arguments[2],a=>xc(s,a,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>zf(t,n?n(...a):o,i=>xc(s,i,r))},DO=d(e=>se(e[0]),(e,...t)=>Qo(e,Df,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),LO=(...e)=>ce(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 he}),BO=ce(e=>{let t=e.currentSpanLocal;return t?D(t):Xe(new ro)}),jO=Zz(Mf),ho=ge("effect/Clock",{defaultValue:()=>new pS}),nS=2**31-1,pS=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=G(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return mq()}currentTimeNanos=G(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return qO()}monotonicTimeNanos=G(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Ko(t))}sleepMillis(t){return t<=0?Ic:Number.isFinite(t)?Ht(r=>{let n=t>nS?this.sleepMillis(t-nS):he,o=setTimeout(()=>r(n),Math.min(t,nS));return G(()=>clearTimeout(o))}):gm}},zO=BigInt(1e6),qO=(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())*zO;return r>t&&(t=r),t}})(),mq=(function(){let e=BigInt(1e9),t;return()=>{let r=qO(),n=BigInt(Date.now())*zO;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}})(),yo=e=>ce(t=>e(t.getRef(ho))),Ac=e=>yo(t=>t.sleep(Ut(e))),HO=yo(e=>e.currentTimeMillis);var dS="~effect/Cause/TimeoutError";var im=class extends Ho("TimeoutError"){[dS]=dS;constructor(t){super({message:t})}},mS="~effect/Cause/IllegalArgumentError";var cm=class extends Ho("IllegalArgumentError"){[mS]=mS;constructor(t){super({message:t})}},hS="~effect/Cause/ExceededCapacityError";var gS=class extends Ho("ExceededCapacityError"){[hS]=hS;constructor(t){super({message:t})}},xS="~effect/Cause/AsyncFiberError";var um=class extends Ho("AsyncFiberError"){[xS]=xS;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},yS="~effect/Cause/UnknownError";var yc=class extends Ho("UnknownError"){[yS]=yS;constructor(t,r){super({message:r,cause:t})}},cE=ge("effect/Console",{defaultValue:()=>globalThis.console}),hq=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}},gq=vy(Vo,hq),WO=oc(gq),uE=ge("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([Cq,Tq])}),xq=ge("effect/Logger/LogToStderr",{defaultValue:uf}),VO=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Va(ce(t=>{let r=t.getRef(Jo),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];U(n,s,a)}return t.setContext(rr(t.context,Jo,n)),qs(co(t.context,zs),o=>{let s=t.getRef(Jo),a={...s};for(let i=0;i<e.length;i++){let[c,f]=e[i];s[c]!==f&&!Object.is(s[c],f)||(Object.hasOwn(r,c)?U(a,c,r[c]):delete a[c])}return t.setContext(rr(t.context,Jo,a)),he})}))},yq="~effect/Logger",Sq={[yq]:{_Message:F,_Output:F},pipe(){return re(this,arguments)}},GO=e=>{let t=Object.create(Sq);return t.log=e,t},Eq=e=>e.replace(/[\s="]/g,"_"),bq=(e,t)=>`${Eq(e[0])}=${t-e[1]}ms`;var kn=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Qi(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?qo(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=Ey),ce(n=>{let o=e??n.cache.logLevel;if(WO(n.cache.minimumLogLevel,o))return he;let s=n.getRef(ho),a=n.getRef(uE);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 he})};var za={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},mne={None:[],All:[],Trace:[za.gray],Debug:[za.blue],Info:[za.green],Warn:[za.yellow],Error:[za.red],Fatal:[za.bgBrightRed,za.black]};var Iq=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 Cq=GO(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(pm(e));let a=t.getTime(),i=r.getRef(em),c="";for(let p of i)c+=` ${bq(p,a)}`;let f=r.getRef(Jo);Object.keys(f).length>0&&s.push(f);let u=r.getRef(cE);(r.getRef(xq)?u.error:u.log)(`[${Iq(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),Tq=GO(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(ho),s=t.getRef(Jo),a=t.cache.span;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,f]of Object.entries(s))U(i,c,f);i["effect.fiberId"]=t.id,i["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=pm(e)),a.event(Hw(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function wq(){aS.interruptChildren??=Hz}var fE=D(void 0);var KO=d(e=>se(e[0]),(e,t)=>QS(e,r=>ce(n=>(kq(n,r,t?.defectsOnly),he)))),kq=(e,t,r)=>{let n=e.getRef(aA);if(n.size===0||r&&!gA(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(ho).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var JO=Qi,ZO=Gw,$m=oo;var rl=qo;var QO=If,nl=by;var lE=e=>new Pa(e),pE=e=>new Sf(e),YO=mA,Nm=fm,Vs=yA;var ol=lm;var XO=pm;var dE=Zw;var Mm=Xi,Rt=Yw;var Um=cm;var e_=yc;var te={};En(te,{Do:()=>_H,Transaction:()=>Nc,TypeId:()=>IH,abortSignal:()=>DW,acquireDisposable:()=>OW,acquireRelease:()=>ln,acquireUseRelease:()=>OP,addFinalizer:()=>ah,all:()=>hP,andThen:()=>rs,annotateCurrentSpan:()=>JW,annotateLogs:()=>kV,annotateLogsScoped:()=>AV,annotateSpans:()=>KW,as:()=>kr,asSome:()=>SP,asVoid:()=>GE,awaitAllChildren:()=>uV,bind:()=>RH,bindTo:()=>PH,cached:()=>tb,cachedInvalidateWithTTL:()=>NW,cachedWithTTL:()=>$W,callback:()=>sr,catch:()=>_n,catchCause:()=>Cr,catchCauseFilter:()=>GH,catchCauseIf:()=>VH,catchDefect:()=>IP,catchEager:()=>Al,catchFilter:()=>Il,catchIf:()=>HH,catchNoSuchElement:()=>WH,catchReason:()=>jH,catchReasons:()=>zH,catchTag:()=>ns,catchTags:()=>KE,clockWith:()=>Vc,context:()=>oh,contextWith:()=>AP,currentParentSpan:()=>QW,currentSpan:()=>ZW,delay:()=>TP,die:()=>ar,effectify:()=>et,ensuring:()=>Bc,eventually:()=>YH,exit:()=>Js,fail:()=>C,failCause:()=>Ya,failCauseSync:()=>Ks,failSync:()=>HE,fiber:()=>fV,fiberId:()=>lV,filter:()=>ZE,filterMap:()=>dW,filterMapEffect:()=>kP,filterMapOrElse:()=>hW,filterMapOrFail:()=>xW,filterOrElse:()=>mW,filterOrFail:()=>gW,findFirst:()=>kH,findFirstFilter:()=>AH,firstSuccessOf:()=>aW,flatMap:()=>B,flatMapEager:()=>$t,flatten:()=>yP,flip:()=>BH,fn:()=>yV,fnUntraced:()=>L,fnUntracedEager:()=>nb,forEach:()=>Qa,forever:()=>To,forkChild:()=>rb,forkDetach:()=>cV,forkIn:()=>qc,forkScoped:()=>Hc,fromNullishOr:()=>DH,fromOption:()=>MH,fromResult:()=>bl,gen:()=>Dt,head:()=>vH,ignore:()=>Lc,ignoreCause:()=>rW,interrupt:()=>ei,interruptible:()=>MW,interruptibleMask:()=>UW,isEffect:()=>wr,isFailure:()=>CW,isSuccess:()=>TW,let:()=>FH,linkSpans:()=>eV,log:()=>SV,logDebug:()=>CV,logError:()=>uh,logFatal:()=>EV,logInfo:()=>IV,logTrace:()=>TV,logWarning:()=>bV,logWithLevel:()=>NP,makeSpan:()=>FP,makeSpanScoped:()=>tV,map:()=>ne,mapBoth:()=>KH,mapBothEager:()=>Vt,mapEager:()=>ti,mapError:()=>kt,mapErrorEager:()=>kl,match:()=>Zs,matchCause:()=>EW,matchCauseEager:()=>bW,matchCauseEffect:()=>Cl,matchCauseEffectEager:()=>IW,matchEager:()=>SW,matchEffect:()=>QE,never:()=>th,onError:()=>jc,onErrorFilter:()=>PW,onErrorIf:()=>_W,onExit:()=>Co,onExitFilter:()=>RW,onExitIf:()=>FW,onExitPrimitive:()=>ih,onInterrupt:()=>_P,option:()=>LH,orDie:()=>os,orElseSucceed:()=>sW,partition:()=>CH,promise:()=>gP,provide:()=>YE,provideContext:()=>ss,provideService:()=>Io,provideServiceEffect:()=>XE,race:()=>pW,raceAll:()=>wP,raceAllFirst:()=>lW,raceFirst:()=>Xa,reduce:()=>TH,repeat:()=>LW,repeatOrElse:()=>BW,replicate:()=>jW,replicateEffect:()=>zW,request:()=>aV,requestUnsafe:()=>iV,result:()=>VE,retry:()=>XH,retryOrElse:()=>eW,runCallback:()=>dV,runCallbackWith:()=>pV,runFork:()=>wo,runForkWith:()=>Wc,runPromise:()=>RP,runPromiseExit:()=>ch,runPromiseExitWith:()=>mV,runPromiseWith:()=>$P,runSync:()=>hV,runSyncExit:()=>ko,runSyncExitWith:()=>xV,runSyncWith:()=>gV,sandbox:()=>tW,satisfiesErrorType:()=>LV,satisfiesServicesType:()=>BV,satisfiesSuccessType:()=>DV,schedule:()=>qW,scheduleFrom:()=>PP,scope:()=>Tl,scoped:()=>Qs,scopedWith:()=>eb,service:()=>vP,serviceOption:()=>sh,setContext:()=>wW,sleep:()=>nh,spanAnnotations:()=>YW,spanLinks:()=>XW,succeed:()=>y,succeedNone:()=>Sl,succeedSome:()=>xP,suspend:()=>Ie,sync:()=>le,tap:()=>Dc,tapCause:()=>rh,tapCauseFilter:()=>QH,tapCauseIf:()=>ZH,tapDefect:()=>CP,tapError:()=>JE,tapErrorTag:()=>JH,timed:()=>fW,timeout:()=>iW,timeoutOption:()=>cW,timeoutOrElse:()=>uW,tracer:()=>HW,track:()=>OV,trackDefects:()=>FV,trackDuration:()=>RV,trackErrors:()=>PV,trackSuccesses:()=>_V,transposeOption:()=>UH,try:()=>ht,tryPromise:()=>Uc,tx:()=>$V,txRetry:()=>UV,undefined:()=>OH,uninterruptible:()=>wl,uninterruptibleMask:()=>zc,unwrapReason:()=>qH,updateContext:()=>kW,updateService:()=>AW,updateServiceScoped:()=>vW,useSpan:()=>rV,validate:()=>wH,void:()=>xe,when:()=>yW,whileLoop:()=>Mc,withErrorReporting:()=>oW,withExecutionPlan:()=>nW,withFiber:()=>El,withFiberSucceed:()=>NH,withLogSpan:()=>vV,withLogger:()=>wV,withParentSpan:()=>sV,withSpan:()=>nV,withSpanScoped:()=>oV,withTracer:()=>WW,withTracerEnabled:()=>VW,withTracerTiming:()=>GW,yieldNow:()=>WE,yieldNowWith:()=>$H,zip:()=>EP,zipWith:()=>bP});var t_=Ef,ts=Fe,So=ur,An=an;var vn=pr;var ut=Gf,sl=JA;var Aq="~effect/Deferred";var vq={[Aq]:{_A:F,_E:F},pipe(){return re(this,arguments)}},r_=function(){this.resumes=void 0,this.effect=void 0};r_.prototype=vq;var Dm=()=>new r_;var vc=e=>Ht(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),G(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var mE=e=>G(()=>hE(e)),hE=e=>e.effect!==void 0;var Lm=(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 n_=Jo;var o_=em;var s_=Xd;var al=zs;var Oc=Am,il=Dv,Bm=qs,cl=Mv;var Gs=Nv,fn=VS;var f_="~effect/Layer",i_="~effect/Layer/MemoMap",Oq=(e,t)=>{let r={observers:0,deferred:Dm(),scope:Oc(),finalizer:n=>ae(()=>--r.observers>0?he:(e.map.delete(t),fn(r.scope,n)))};return r},c_=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,wc(t,{},e.finalizer),!0),l_=e=>A(e,f_),_q={[f_]:{_ROut:F,_E:F,_RIn:F},pipe(){return re(this,arguments)}},p_=e=>{let t=Object.create(_q);return t.build=e,t},xE=e=>p_((t,r)=>{let n=Gs(r);return Gr(e(t,n),o=>o._tag==="Failure"?fn(n,o):he)}),Pq=e=>{let t=xE((r,n)=>r.getOrElseMemoize(t,n,e));return t},jm=class{get[i_](){return i_}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(c_(n,r),n.deferred.effect??vc(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return ae(()=>{let o;return Hs(ae(()=>{let s=this.get(t,r);if(s)return s;let a=Oq(this,t);return c_(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&Lm(o,s)})})}},yE=()=>new jm,Fq=e=>new jm(e);var fl=class e extends Ye()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Ud(t,e);return r?Fq(r):yE()}},SE=d(3,(e,t,r)=>br(Oe(ae(()=>e.build(t,r)),rr(fl,t)),fl,t));var d_=d(2,(e,t)=>ce(r=>SE(e,fl.forkOrCreate(r.context),t))),Eo=function(){return arguments.length===1?e=>zm(Go(arguments[0],e)):zm(Go(arguments[0],arguments[1]))},zm=e=>p_(at(D(e)));var _c=function(){return arguments.length===1?e=>u_(arguments[0],e):u_(arguments[0],arguments[1])},u_=(e,t)=>Rq(Oe(t,r=>Go(e,r))),Rq=e=>Pq((t,r)=>il(e,r));var m_=(e,t,r)=>{let n=Gs(r,"parallel");return Hr(e,o=>o.build(t,Gs(n,"sequential")),{concurrency:e.length}).pipe(Oe(o=>wk(...o)))},qm=(...e)=>xE((t,r)=>m_(e,t,r));var h_=(e,t,r)=>xE((n,o)=>Q(Array.isArray(t)?m_(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Wr(s),Oe(a=>r(a,s))))),g_=d(2,(e,t)=>h_(e,t,F)),x_=d(2,(e,t)=>h_(e,t,(r,n)=>Na(n,r)));var Hm="~effect/DateTime",Wm="~effect/DateTime/TimeZone",S_={[Hm]:Hm,pipe(){return re(this,arguments)},[qe](){return this.toString()},toJSON(){return dl(this).toJSON()}},$q={...S_,_tag:"Utc",[Y](){return dt(this.epochMilliseconds)},[X](e){return Fc(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${dl(this).toJSON()})`}},Nq={...S_,_tag:"Zoned",[Y](){return ie(dt(this.epochMilliseconds))(q(this.zone))},[X](e){return Fc(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&W(this.zone,e.zone)},toString(){return`DateTime.Zoned(${PE(this)})`}},E_={[Wm]:Wm,[qe](){return this.toString()}},Mq={...E_,_tag:"Named",[Y](){return Ae(`Named:${this.id}`)},[X](e){return Ka(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},Uq={...E_,_tag:"Offset",[Y](){return Ae(`Offset:${this.offset}`)},[X](e){return Ka(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${vE(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},bo=(e,t,r)=>{let n=Object.create(Nq);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},Fc=e=>A(e,Hm);var Ka=e=>A(e,Wm),b_=e=>Ka(e)&&e._tag==="Offset",I_=e=>Ka(e)&&e._tag==="Named",C_=e=>e._tag==="Utc",IE=e=>e._tag==="Zoned",T_=yr((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var w_=e=>{let t=Object.create($q);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Pc=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Um("Invalid date");return w_(t)},Gm=e=>{if(Fc(e))return e;if(e instanceof Date)return Pc(e);if(typeof e=="object"){if("epochMilliseconds"in e)return Pc(new Date(e.epochMilliseconds));let t=new Date(0);return Wq(t,e),Pc(t)}else if(typeof e=="string"&&!Dq(e))return Pc(new Date(e+"Z"));return Pc(new Date(e))},Dq=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Lq=-864e13+720*60*1e3,Bq=864e13-840*60*1e3,CE=(e,t)=>{let r=t?.timeZone;if(r===void 0&&Fc(e)&&IE(e))return e;let n=Gm(e);if(n.epochMilliseconds<Lq||n.epochMilliseconds>Bq)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=pl(s)}else if(Ka(r))o=r;else if(typeof r=="number")o=pl(r);else{let s=kE(r);if(Ke(s))throw new Um(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?bo(n.epochMilliseconds,o,n.partsUtc):Vq(n.epochMilliseconds,o,t?.disambiguation??"compatible")},EE=io(CE),k_=io(Gm),jq=/^(.{17,35})\[(.+)\]$/,A_=e=>{let t=jq.exec(e);if(t===null){let o=_E(e);return o!==null?EE(e,{timeZone:o}):v()}let[,r,n]=t;return EE(r,{timeZone:n})};var v_=e=>w_(e.epochMilliseconds);var Vm=new Map,zq={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},qq=e=>{let t=e.resolvedOptions().timeZone,r=Vm.get(t);if(r!==void 0)return r;let n=Object.create(Mq);return n.id=t,n.format=e,Vm.set(t,n),n},TE=e=>{let t=Vm.get(e);if(t!==void 0)return t;try{let r=qq(new Intl.DateTimeFormat("en-US",{...zq,timeZone:e}));return Vm.set(e,r),r}catch{throw new Um(`Invalid time zone: ${e}`)}},pl=e=>{let t=Object.create(Uq);return t.offset=e,t},wE=io(TE);var Hq=/^(?:GMT|[+-])/,kE=e=>{if(Hq.test(e)){let t=_E(e);return t===null?v():R(pl(t))}return wE(e)},O_=e=>e._tag==="Offset"?vE(e.offset):e.id;var dl=e=>new Date(e.epochMilliseconds),Km=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},AE=e=>Km(e).getTime()-OE(e),vE=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")}`},__=e=>vE(AE(e)),OE=e=>e.epochMilliseconds;var Wq=(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 y_=1440*60*1e3,Vq=(e,t,r)=>{if(t._tag==="Offset")return bo(e-t.offset,t);let n=ll(e-y_,e,t),o=ll(e+y_,e,t);if(n===o)return bo(e-n,t);let s=n<o,a=n-o;if(s){if(ll(e-o,e,t)===o)return bo(e-o,t);let f=bo(e-n,t),u=Km(f).getTime();if(e!==u)switch(r){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return bo(e-o,t);case"compatible":case"later":return f}return f}if(ll(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||ll(e-n+a,e+a,t)===n)return bo(e-n,t);if(r==="reject"){let f=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${f} occurs twice in time zone ${t.id}`)}}return bo(e-o,t)},Gq=/([+-])(\d{2}):(\d{2})$/,_E=e=>{let t=Gq.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},ll=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=_E(n);return o===null?AE(bo(t,r)):o};var P_=e=>dl(e).toISOString();var bE=e=>{let t=Km(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${__(e)}`},PE=e=>e.zone._tag==="Offset"?bE(e):`${bE(e)}[${e.zone.id}]`;var Qne=globalThis.Number;var R_=d(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]=F_(e),[o,s]=F_(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),f=i%c;if(f===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let u=globalThis.Number(`${f}e${a}`);return u===0?Math.sign(e)*globalThis.Number.MIN_VALUE:u});function F_(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 $_=d(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var Yne=globalThis.String;var M_=e=>e.trim();var D_=(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 Ir=d(2,(e,t)=>Yo(e,Zq,r=>t(r))),Rc=e=>e.reasons.some(FE),FE=e=>e._tag==="Fail"&&dE(e.error),Jm=e=>{let t,r=!1;for(let n of e.reasons)FE(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?Z(e):r?Z(rl(e.reasons.filter(n=>!FE(n)))):H(t)};var Zq=e=>{let t=Jm(e);return Se(t)?t:H(t.success.value)},RE=e=>{let t=Jm(e);return Se(t)?So(t.failure):ts(t.success.value)},Zm=d(2,(e,t)=>mo(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=Jm(r);return Se(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var L_="~effect/Schedule";var Za=ge("effect/Schedule/CurrentMetadata",{defaultValue:at({input:void 0,output:void 0,duration:lc,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Qq={[L_]:{_Out:F,_In:F,_Env:F},pipe(){return re(this,arguments)}},$E=e=>A(e,L_),ml=e=>{let t=Object.create(Qq);return t.step=e,t},NE=()=>{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}}},Yq=e=>ml(Oe(e,t=>{let r=NE();return(n,o)=>t(r(n,o))})),hl=e=>Vr(e.step,t=>D(()=>Ue(t))),Qm=e=>yo(t=>Oe(hl(e),r=>{let n=NE();return o=>ae(()=>{let s=t.currentTimeMillisUnsafe();return Q(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,Er(Ac(i),c)})})}));var ME=e=>ml(Oe(hl(e),t=>(r,n)=>Zm(t(r,n),{onSuccess:o=>D([n,o[1]]),onFailure:Ue,onDone:()=>Rt(n)}))),B_=e=>gl(UE,({attempt:t})=>D(t<=e)),Xq=e=>{let t=Ut(e);return Yq(D(r=>D([r.attempt-1,t])))};var gl=d(2,(e,t)=>ml(Oe(hl(e),r=>{let n=NE();return(o,s)=>Q(r(o,s),a=>{let[i,c]=a,f=t({...n(o,s),output:i,duration:c});return Q(se(f)?f:D(f),u=>u?D(a):Rt(i))})})));var UE=Xq(lc);var j_="~effect/ExecutionPlan";var eH={[j_]:j_,get captureRequirements(){let e=this;return js(t=>D(tH(e.steps.map(r=>({...r,while:r.while?n=>Wr(r.while(n),t):void 0,schedule:r.schedule?ml(Wr(Oe(hl(r.schedule),n=>(o,s)=>Wr(n(o,s),t)),t)):void 0,provide:l_(r.provide)?g_(r.provide,zm(t)):r.provide})))))},pipe(){return re(this,arguments)}},tH=e=>{let t=Object.create(eH);return t.steps=e,t};var z_=ge("effect/ExecutionPlan/CurrentMetadata",{defaultValue:at({attempt:0,stepIndex:0})});var rH=(e,t,r)=>vm(n=>Q(r?.local?SE(t,yE(),n):d_(t,n),o=>Wr(e,o))),Xm=d(e=>se(e[0]),(e,t,r)=>Ny(t)?Wr(e,t):rH(e,Array.isArray(t)?qm(...t):t,r));var W_=e=>e.reasons.every(oo)?wn(e):Z(e),DE=d(3,(e,t,r)=>Q(Qm(t),n=>{let o=Za.defaultValue();return Yo(Ir(bm(Ha(Q(ae(()=>br(e,Za,o)),n),s=>G(()=>{o=s})),{disableYield:!0}),s=>D(s)),W_,s=>r(s,o.attempt===0?v():R(o)))})),LE=d(3,(e,t,r)=>Q(Qm(t),n=>{let o=Za.defaultValue(),s,a=Yo(ae(()=>br(e,Za,o)),W_,i=>(s=i,Q(n(i),c=>(o=c,a))));return Ir(a,i=>$s(()=>r(s,i)))})),V_=d(2,(e,t)=>{let r=typeof t=="function"?t(F):$E(t)?t:yl(t);return DE(e,r,Xe)}),xl=d(2,(e,t)=>{let r=typeof t=="function"?t(F):$E(t)?t:yl(t);return LE(e,r,Xe)}),G_=d(3,(e,t,r)=>Q(Qm(r),n=>{let o=Za.defaultValue(),s=ae(()=>br(e,Za,o));return Ir(Q(n(t),a=>{o=a;let i=at(Q(s,n));return xo({while:Dr,body:i,step(c){o=c}})}),a=>D(a))})),nH=ME(UE),yl=e=>{let t=e.schedule?ME(e.schedule):nH;return e.while&&(t=gl(t,({input:r})=>{let n=e.while(r);return se(n)?n:D(n)})),e.until&&(t=gl(t,({input:r})=>{let n=e.until(r);return se(n)?Oe(n,o=>!o):D(!n)})),e.times!==void 0&&(t=gl(t,({attempt:r})=>D(r<=e.times))),t};var oH=(e,t)=>{let r=-1,n=0,o=s=>Tm(e(s));return{begin:yo(s=>ae(()=>{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 Er(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>yo(i=>{let c=uo(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})})}},Z_=d(e=>se(e[0]),(e,t,r)=>ae(()=>{let n=0,o={attempt:0,stepIndex:0},s=Em(z_,G(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:oH(r.onEvent,()=>o),i=a===void 0?F:f=>Ws(u=>Q(a.begin,l=>Gr(u(f),p=>a.end(l,p)))),c;return Q(xo({while:()=>n<t.steps.length&&(c===void 0||Se(c)),body(){let f=t.steps[n],u=s(i(Xm(e,f.provide)));if(c){let l=!1,p=u;u=ae(()=>l?p:(l=!0,bc(c))),u=xl(u,J_(f,!1))}else{let l=J_(f,!0);u=l?xl(u,l):u}return Ls(u)},step(f){c=f,n++}}),()=>bc(c))})),J_=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return yl({schedule:e.schedule?e.schedule:e.attempts?void 0:sH,times:e.attempts,while:e.while});return yl({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},sH=B_(1);var Q_="~effect/MutableHashMap";var iH={[Q_]:Q_,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${N(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:Ot(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},Y_=()=>{let e=Object.create(iH);return e.backing=new Map,e.buckets=new Map,e};var BE=d(2,(e,t)=>{if(e.backing.has(t))return R(e.backing.get(t));if(jE(t))return v();let r=q(t),n=e.buckets.get(r);return n===void 0?v():cH(e,n,t)}),jE=e=>typeof e!="object"&&typeof e!="function";var cH=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(W(r,t[n])){let s=t[n];return R(e.backing.get(s))}return v()},X_=d(2,(e,t)=>ve(BE(e,t))),eP=d(3,(e,t,r)=>{if(e.backing.has(t)||jE(t))return e.backing.set(t,r),e;let n=q(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=uH(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),uH=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(W(t,e[r]))return e[r]};var tP=d(2,(e,t)=>{if(jE(t))return e.backing.delete(t),e;let r=q(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||W(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e});var fH="~effect/Request",lH=Lw({_E:e=>e,_A:e=>e,_R:e=>e}),Eoe={...Vw,[fH]:lH};var nP=e=>e;var sP=d(2,(e,t)=>{let r=n=>Ht(o=>{let s=iP(n,e,o,Ec());return hH(n,s)});return se(t)?Q(t,r):r(t)}),aP=(e,t)=>{let r=iP(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:ct(t.context,$f)}});return()=>cP(t.resolver,r)},dH=new WeakSet,mH=e=>{if(!dH.has(e.batchKey))return new Map;let t=Y_();return{get:r=>tr(BE(t,r)),has:r=>X_(t,r),set:(r,n)=>eP(t,r,n),delete:r=>tP(t,r)}},eh=[],zE=new WeakMap,iP=(e,t,r,n)=>{let o=zE.get(e);o||(o=mH(e),zE.set(e,o));let s,a=!1,i=nP({request:t,context:n.context,uninterruptible:!1,completeUnsafe(f){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(f))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(eh.length>0)s=eh.pop(),s.key=c,s.resolver=e,s.map=o;else{let f={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:Q(ae(()=>f.resolver.delay),u=>oP(f)),run:Gr(ae(()=>f.resolver.runAll(Array.from(f.entries),f.key)),u=>{for(let l of f.entrySet)l.completeUnsafe(u._tag==="Success"?qr(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):u);return f.entries.clear(),eh.length<128&&(f.entrySet.clear(),f.key=void 0,f.fiber=void 0,f.resolver=void 0,f.map=void 0,eh.push(f)),he})};s=f}o.set(c,s),s.fiber=es(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=es(n.context)(oP(s),{scheduler:n.cache.scheduler})),i},cP=(e,t)=>{if(t.uninterruptible)return;let r=zE.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(Vf()),s?.interruptUnsafe()},hH=(e,t)=>G(()=>cP(e,t));function oP(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):he}var xH="effect/Metric/CurrentMetricAttributes",yH=ge(xH,{defaultValue:()=>({})}),SH="effect/Metric/MetricRegistry",EH=ge(SH,{defaultValue:()=>new Map}),uP="~effect/Metric",fP=class{[uP]=uP;#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=ct(t,yH);r!==this.#t&&(this.#t=r,this.#e=bH(this,lP(this.attributes,r)));let n=ct(t,EH),o=n.get(this.#e);return Fs(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?lP(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#e,o)),o.hooks}pipe(){return re(this,arguments)}};var $c=d(2,(e,t)=>js(r=>G(()=>e.updateUnsafe(t,r))));function bH(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 lP(e,t){return{...pP(e),...pP(t)}}function pP(e){return pt(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(U(t,r,n),t),{}):e}var IH=no,wr=se,hP=el,CH=eE,TH=Yv,wH=Xv,kH=eO,AH=rO,Qa=Hr,vH=oO,Mc=xo,gP=wS,Uc=_A,y=D,Sl=Hf,xP=TS,Ie=ae,le=G,xe=he;var OH=fE;var sr=Ht,th=gm,_H=fO,PH=lO,FH=dO;var RH=pO,Dt=$A,C=Xe,HE=hm,Ya=Ue,Ks=vA,ar=Bs,ht=OA;var WE=Ic,$H=CS,El=ce,NH=Jw,bl=bc,MH=IS,UH=AA,DH=kA,B=Q,yP=HA,rs=go,Dc=Ha,VE=Ls,LH=wv,Js=Zf,ne=Oe,kr=Er,SP=Sm,GE=Wf,BH=LA,EP=iv,bP=$S,_n=Xo;var ns=DS,KE=yv,jH=Sv,zH=Ev,qH=bv,Cr=Vr,IP=dv,HH=Kf,Il=Cm,WH=pv,VH=MS,GH=Yo,kt=LS,KH=BS,os=jS,JE=US,JH=gv,rh=mv,ZH=hv,QH=Im,CP=xv,YH=zS,XH=xl,eW=LE,tW=BA,Lc=Tv,rW=Tm,nW=Z_,oW=KO,sW=Iv,aW=Cv,iW=Fv,cW=WS,uW=HS,TP=Pv,nh=Ac,fW=Rv,wP=_S,lW=PS,pW=jA,Xa=FS,ZE=iO,dW=cO,kP=uO,mW=tE,hW=rE,gW=cv,xW=aO,yW=uv,Zs=wm,SW=Jf,EW=qS,bW=vv,IW=zA,Cl=mo,QE=Tc,CW=Ov,TW=_v,oh=RS,AP=js,YE=Xm,ss=Wr,wW=av,vP=nv,sh=ov,kW=Cc,AW=Qo,vW=sv,Io=br,XE=Em,Tl=Qf,Qs=GS,eb=vm,ln=Wa,OW=qv,OP=Yf,ah=KS,Bc=Bv,jc=QS,_W=jv,PW=YS,ih=Hs,Co=Gr,FW=JS,RW=ZS,tb=Vv,$W=Wv,NW=XS,ei=Gv,MW=Om,_P=zv,wl=Va,zc=Ws,UW=Zv,DW=Qv,To=bm,LW=V_,BW=DE,jW=NS,zW=fv,qW=d(2,(e,t)=>PP(e,void 0,t)),PP=G_,HW=kO,WW=AO,VW=vO,GW=OO,KW=DO,JW=LO,ZW=BO,QW=jO,YW=RO,XW=$O,eV=NO,FP=PO,tV=jf,rV=zf,nV=UO,oV=FO,sV=xc,aV=sP,iV=aP,rb=mO,qc=nE,Hc=xO,cV=hO,uV=gO,fV=FA,lV=RA,wo=SO,Wc=es,pV=oE,dV=EO,RP=IO,$P=sE,ch=bO,mV=Fm,hV=TO,gV=aE,ko=CO,xV=Rm,L=AS,yV=NA,Vc=yo,NP=kn,SV=kn(),EV=kn("Fatal"),bV=kn("Warn"),uh=kn("Error"),IV=kn("Info"),CV=kn("Debug"),TV=kn("Trace"),wV=d(2,(e,t)=>Qo(e,uE,r=>new Set([...r,t]))),kV=d(e=>wr(e[0]),(e,...t)=>Qo(e,n_,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),AV=VO,vV=d(2,(e,t)=>Q(HO,r=>Qo(e,o_,n=>[[t,r],...n]))),OV=d(e=>wr(e[0]),(e,t,r)=>Co(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),_V=d(e=>wr(e[0]),(e,t,r)=>Dc(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),PV=d(e=>wr(e[0]),(e,t,r)=>JE(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),FV=d(e=>wr(e[0]),(e,t,r)=>CP(e,n=>{let o=r===void 0?n:r(n);return $c(t,o)})),RV=d(e=>wr(e[0]),(e,t,r)=>Vc(n=>{let o=n.monotonicTimeNanosUnsafe();return Co(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=Gk(Ut(s),Ut(o)),i=r===void 0?a:r(a);return $c(t,i)})})),Nc=class extends Ye()("effect/Effect/Transaction"){},$V=e=>El(t=>{let r=Ud(t.context,Nc);if(r&&!mP.has(r))return e;r={journal:new Map,retry:!1};let n;return zc(o=>B(Mc({while:()=>!n,body:at(o(e).pipe(Io(Nc,r),rh(s=>r.retry?fm(s)?o(NV(r)):le(()=>qE(r)):xe),Js)),step(s){if(r.retry||!MP(r))return qE(r);ut(s)&&MV(t,r),qE(r),mP.add(r),n=s}}),()=>n))}),mP=new WeakSet,MP=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},NV=e=>sr(t=>{if(!MP(e))return t(xe);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(xe)};for(let a of n)a.pending.set(r,s);return le(o)});function MV(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 qE(e){e.retry=!1,e.journal.clear()}var UV=B(Nc,e=>(e.retry=!0,ei)),et=(e,t,r)=>(...n)=>sr(o=>{try{e(...n,(s,a)=>{o(s?t?Ie(()=>C(t(s,n))):C(s):y(a))})}catch(s){o(r?C(r(s,n)):ar(s))}}),DV=()=>e=>e,LV=()=>e=>e,BV=()=>e=>e,ti=WA,kl=VA,Vt=GA,$t=qA,Al=KA,nb=MA;var UP=(e,t)=>ut(e)?t(0):Nm(e.cause)?t(130):t(DP(ol(e.cause))),ob=e=>d(t=>wr(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?wo(t):wo(rh(t,s=>Nm(s)?xe:LP(ol(s))?uh(s):xe));try{let s=globalThis.setInterval(jo,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??UP;return e({fiber:n,teardown:o})}),vl="~effect/Runtime/errorExitCode",DP=e=>{if(typeof e=="object"&&e!==null&&vl in e){let t=e[vl];if(typeof t=="number")return t}return 1},Ys="~effect/Runtime/errorReported",LP=e=>{if(typeof e=="object"&&e!==null&&Ys in e){let t=e[Ys];if(typeof t=="boolean")return t}return!0};var BP=ob(({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 jP=BP;var us={};En(us,{FileSystem:()=>Fn,FileTypeId:()=>eu,WatchBackend:()=>jl,isFile:()=>N4,layerNoop:()=>$4,make:()=>_b,makeNoop:()=>aR});var zP=globalThis.BigInt;var fh=e=>e>zP(Number.MAX_SAFE_INTEGER)||e<zP(Number.MIN_SAFE_INTEGER)?v():R(Number(e));var ab=BigInt(0),HV=BigInt(1),Ao=BigInt(1e3),Xs=BigInt(1024),qP=[{symbol:"B",factor:HV,names:["B","byte","bytes"]},{symbol:"kB",factor:Ao,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ao**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ao**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ao**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ao**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ao**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ao**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ao**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ao**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ao**BigInt(10),names:["QB","quettabyte","quettabytes"]}],WV=[qP[0],{symbol:"KiB",factor:Xs,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:Xs**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:Xs**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:Xs**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:Xs**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:Xs**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:Xs**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:Xs**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],VV=[...qP,...WV.slice(1)],GV=new Map(VV.flatMap(e=>e.names.map(t=>[t,e])));var ib=e=>e;var Gc=e=>{throw new Error(`Invalid ByteSize: ${e}`)},HP=e=>!Number.isSafeInteger(e)||e<0?Gc(`expected a non-negative safe integer, received ${e}`):ib(BigInt(e));var WP=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return Gc(`unsupported syntax ${JSON.stringify(e)}`);let r=GV.get(t[3]);if(r===void 0)return Gc(`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!==ab?Gc(`${JSON.stringify(e)} does not represent an integral number of bytes`):ib(s/o)},VP=io(WP),Ol=e=>{switch(typeof e){case"bigint":return e<ab?Gc(`expected a non-negative bigint, received ${e}`):ib(e);case"number":return HP(e);case"string":return WP(e)}return Gc(`unsupported input ${e}`)},cb=io(Ol),_l=e=>typeof e=="bigint"?Ol(e):HP(e);var GP=e=>typeof e=="bigint"&&e>=ab;var lh=e=>e,KP=fh;var JP="~effect/PlatformError",vo=class extends cn("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},ub=class extends Nf{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},ph=class extends cn("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[JP]=JP;get message(){return this.reason.message}};var Jr=e=>new ph(new ub(e)),pn=e=>new ph(new vo(e));var YP="~effect/Chunk";function ZP(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 XP=[],lb=e=>yr((t,r)=>{if(t.length!==r.length)return!1;let n=ni(t),o=ni(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),KV=lb(W),JV={[YP]:{_A:e=>e},toString(){return`Chunk(${N(ni(this))})`},toJSON(){return{_id:"Chunk",values:Ot(ni(this))}},[qe](){return this.toJSON()},[X](e){return dh(e)&&KV(this,e)},[Y](){return Yn(ni(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return XP[Symbol.iterator]();default:return ni(this)[Symbol.iterator]()}},pipe(){return re(this,arguments)}},pb=e=>{let t=Object.create(JV);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=as,t.right=as;break}case"ISingleton":{t.length=1,t.depth=0,t.left=as,t.right=as;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=as,t.right=as;break}}return t},dh=e=>A(e,YP),as=pb({_tag:"IEmpty"}),ZV=()=>as;var QV=e=>pb({_tag:"ISingleton",a:e}),db=e=>dh(e)?e:XV(nr(e)),fb=(e,t,r)=>{switch(e.backing._tag){case"IArray":{ZP(e.backing.array,0,t,r,e.length);break}case"IConcat":{fb(e.left,t,r),fb(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{ZP(ni(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var YV=e=>{switch(e.backing._tag){case"IEmpty":return XP;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return fb(e,t,0),e.backing={_tag:"IArray",array:t},e.left=as,e.right=as,e.depth=0,t}}},ni=YV;var XV=e=>e.length===0?ZV():e.length===1?QV(e[0]):pb({_tag:"IArray",array:e});var eF=e=>e.length;var tF=nm;var mh=qf;var rF=Ec,nF=yO;var sF=wO;var iF="~effect/MutableRef",e4={[iF]:iF,...er,toJSON(){return{_id:"MutableRef",current:Ot(this.current)}}},cF=e=>{let t=Object.create(e4);return t.current=e,t};var t4=Symbol.for("effect/MutableList/Empty"),lF=()=>({head:void 0,tail:void 0,length:0}),pF=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})},fF=()=>({array:[],mutable:!0,offset:0,next:void 0}),Jc=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=fF(),e.tail=e.tail.next):e.head=e.tail=fF(),e.tail.array.push(t),e.length++};var Kc=e=>{e.head=e.tail=void 0,e.length=0},dF=(e,t)=>{if(t=vf(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 Kc(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?Kc(e):pF(e),r;o=o.next}return Kc(e),r};var hb=e=>{if(!e.head)return t4;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:Kc(e):pF(e),t};var r4="~effect/Queue",n4="~effect/Queue/Enqueue",o4="~effect/Queue/Dequeue";var gb={_A:F,_E:F},s4={[r4]:gb,[n4]:gb,[o4]:gb,...er,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:i4(this)}}},Zc=e=>ce(t=>{let r=Object.create(s4);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=lF(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},D(r)}),hF=e=>Zc({capacity:e});var Rl=d(2,(e,t)=>ae(()=>oi(e,t)?hh:e.state._tag==="Open"&&e.strategy==="suspend"?l4(e,t):EF)),oi=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(hb(e.messages),Jc(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Jc(e.messages,t),bF(e),!0):!1:(Jc(e.messages,t),IF(e),!0);var Qc=d(2,(e,t)=>G(()=>$l(e,t))),$l=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=ur(t),n=tv(r,c4);return e.state.offers.size===0&&e.messages.length===0?(gh(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},IF(e),!0)};var is=e=>$l(e,If(Xi()));var yb=e=>G(()=>a4(e)),a4=e=>{if(e.state._tag==="Done")return!1;Kc(e.messages);let t=e.state.offers;gh(e,e.state._tag==="Open"?u4:e.state.exit);for(let r of t)TF(r);return!0};var gF=e=>xF(e,1,Number.POSITIVE_INFINITY);var xF=d(3,(e,t,r)=>(t=vf(t),r=vf(r),Sb(()=>f4(e,t,r)??go(CF(e,()=>Eb(e,t)),xF(e,t,r))))),cs=e=>Sb(()=>SF(e)??go(CF(e,()=>Eb(e,1)),cs(e))),yF=e=>Sb(()=>{let t=SF(e);return t===void 0?D(v()):t._tag==="Success"?D(R(t.value)):D(v())});var SF=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=hb(e.messages);return xb(e),Fe(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=wF(e.state.offers);return xb(e),Fe(t)}};var i4=e=>e.state._tag==="Done"?0:e.messages.length;var EF=Fe(!1),hh=Fe(!0),c4=an(Xi()),u4=Vf(),bF=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(pr),e.messages.length===0))break}},IF=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,bF(e)},0))},f4=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return Fe([]);if(!Eb(e,t))return;let n=e.messages.length>0?dF(e.messages,r):[wF(e.state.offers)];return xb(e),Fe(n)},Sb=sn({op:"QueueTake",[Ge](e){let t=this[fe]();return Ef(t)?t[Ge](e):t}}),Eb=(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,CF=(e,t)=>Ht(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(pr);let n={ready:t,resume:r};return e.state.takers.add(n),G(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),l4=(e,t)=>Ht(r=>oi(e,t)?r(hh):p4(e,{_tag:"Single",message:t,resume:r})),p4=(e,t)=>{if(e.state._tag!=="Open")return TF(t);let r=e.state.offers;return r.add(t),G(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&gh(e,e.state.exit))})},TF=e=>e._tag==="Single"?e.resume(EF):e.resume(Fe(e.remaining.slice(e.offset))),wF=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(hh),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Fe([]))),r},xb=e=>{if(e.state._tag==="Done")return Rc(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(gh(e,e.state.exit),Rc(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")Jc(e.messages,t.message),e.state.offers.delete(t),t.resume(hh);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;Jc(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Fe([]))}let n=e.state;if(n._tag==="Done")return Rc(n.exit.cause)}return!1};var gh=(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 AF="~effect/Channel",kF=e=>A(e,AF),m4={[AF]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return re(this,arguments)}},dr=e=>{let t=Object.create(m4);return t.transform=(r,n)=>Cr(e(r,n),o=>y(Ya(o))),t},vF=(e,t)=>dr((r,n)=>B(Pn(e)(r,n),o=>t(o,n))),Ml=e=>dr((t,r)=>e),OF=e=>dr(L(function*(t,r){let n=Gs(r),o=a=>fn(n,RE(a)),s=yield*jc(e(t,r,n),o);return jc(s,o)})),Pn=e=>e.transform;var h4=(e,t,r)=>Zc({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Dc(n=>cl(e,yb(n))),Dc(n=>il(t(n),e).pipe(Cr(o=>Qc(n,o)),qc(e))));var _F=(e,t)=>dr((r,n)=>ne(h4(n,e,t),gF)),PF=e=>dr((t,r)=>Ie(()=>Pn(e())(t,r)));var FF=Ml(y(Rt()));var RF=e=>Ml(y(C(e)));var $F=d(2,(e,t)=>vF(e,r=>le(()=>{let n=0;return ne(r,o=>t(o,n++))}))),bb=d(2,(e,t)=>NF(e,r=>y(t(r)))),NF=d(2,(e,t)=>vF(e,r=>y(Ir(r,n=>B(t(n),Rt)))));var MF=d(e=>kF(e[0])&&kF(e[1]),(e,t,r)=>OF(L(function*(n,o,s){let a=r?.haltStrategy??"both",i=yield*hF(0);yield*cl(s,yb(i));let c=0;function f(l,p){if(c++,!Rc(p))return Qc(i,p);switch(a){case"both":return c===2?Qc(i,p):xe;case"left":case"right":return l===a?Qc(i,p):xe;case"either":return Qc(i,p)}}let u=(l,p,h)=>Pn(p)(n,h).pipe(B(g=>g.pipe(B(x=>Rl(i,x)),To)),jc(g=>ih(RE(g),x=>fn(h,x)).pipe(Cl({onFailure:x=>f(l,x),onSuccess:()=>f(l,g)}))),qc(s));return yield*u("left",e,Gs(s)),yield*u("right",t,Gs(s)),cs(i)})));var UF=()=>dr((e,t)=>le(()=>{let r="",n=!1,o=v();function s(c){let f=[];function u(l){r.length===0?f.push(l):(f.push(r+l),r="")}for(let l=0;l<c.length;l++){let p=c[l];if(p.length!==0){let h=0,g=p.indexOf("\r"),x=p.indexOf(`
25
25
  `);for(n&&(x===0&&(h=1,x=p.indexOf(`
26
26
  `,h)),n=!1);g!==-1||x!==-1;)g===-1||x!==-1&&x<g?(u(p.substring(h,x)),h=x+1,x=p.indexOf(`
27
27
  `,h)):(u(p.substring(h,g)),p.length===g+1?(n=!0,h=p.length,g=-1):(h=g+(x===g+1?2:1),g=p.indexOf("\r",h),x=p.indexOf(`
28
- `,h)));r=r+p.substring(h)}}return Us(f)?f:null}let a=Ie(()=>o._tag==="Some"?Rt(o.value):Zm(e,{onSuccess:i,onFailure:Ya,onDone:c=>{if(o=R(c),r.length>0){let f=r;return r="",n=!1,y([f])}return Rt(c)}}));function i(c){let f=s(c);return f!==null?y(f):a}return a}));var UF=d(2,(e,t)=>dr((r,n)=>B(Pn(e)(r,n),o=>Pn(t)(o,n))));var xh=e=>dr((t,r)=>{let n;return y(Ie(()=>n||e.pipe(il(r),B(o=>Pn(o)(t,r)),B(o=>n=o))))});var g4=(e,t,r)=>Ie(()=>{let n=Oc(),o=Pn(e)(Rt(),n);return Ir(B(o,t),r||y).pipe(Co(s=>fn(n,s)))});var Ib=d(3,(e,t,r)=>Ie(()=>{let n=t();return g4(e,o=>Mc({while:Dr,body:()=>o,step:s=>{n=r(n,s)}}),()=>y(n))}));var Cb=(e,t)=>Pn(e)(Rt(),t);var x4="~effect/Stream",y4={_R:F,_E:F,_A:F},DF=function(e){this.channel=e};DF.prototype={[x4]:y4,pipe(){return re(this,arguments)}};var LF=e=>new DF(e);var BF="~effect/Sink",jF=y([void 0]),E4={_A:F,_In:F,_L:F,_E:F,_R:F},b4={[BF]:E4,pipe(){return re(this,arguments)}},Dl=e=>A(e,BF),Tb=e=>yh((t,r)=>Pn(e)(t,r).pipe(B(To({disableYield:!0})),Ir(y)));var yh=e=>{let t=Object.create(b4);return t.transform=e,t},I4=e=>dr((t,r)=>y(B(e.transform(t,r),Rt)));var C4=e=>yh(()=>e);var zF=e=>C4(C(e));var Ll=yh(e=>Ir(To(e,{disableYield:!0}),()=>jF));var qF=e=>T4(Qa(t=>e(t),{discard:!0})),T4=e=>yh(t=>t.pipe(B(e),To({disableYield:!0}),Ir(()=>jF)));var HF=e=>Tb(xh(ne(e,I4)));var w4="~effect/RcRef",Bl={_tag:"Empty"},k4={_tag:"Closed"},A4={_A:F,_E:F},wb=class{[w4]=A4;pipe(){return re(this,arguments)}state=Bl;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},VF=e=>El(t=>{let r=t.context,n=ct(r,al),o=new wb(e.acquire,r,n,e.idleTimeToLive!==void 0?Ut(e.idleTimeToLive):void 0);return kr(Bm(n,()=>{let s=o.state;return o.state=k4,s._tag==="Acquired"?fn(s.scope,vn):s._tag==="Acquiring"?mh(s.fiber):xe}),o)}),v4=(e,t)=>{switch(e.state._tag){case"Closed":return ei;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?kr(mh(r.fiber),r):y(r)}case"Acquiring":{let r=e.state;return r.awaiters++,WF(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Oc(),o=ss(e.acquire,rr(e.context,al,n)).pipe(B(s=>{if(e.state!==r)return ei;let a={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,y(a)}),Co(s=>ut(s)?xe:(e.state===r&&(e.state=Bl),fn(n,s))));return r.fiber=Wc(tF().context)(o),WF(e,r,t)}}},WF=(e,t,r)=>Co(r(eF(t.fiber)),n=>{let o=t.acquired;return o!==void 0?sl(n)?KF(e,o):xe:--t.awaiters>0||e.state!==t?xe:(e.state=Bl,mh(t.fiber))}),GF=e=>{let t=e;return zc(r=>B(Tl,n=>B(v4(t,r),o=>kr(Bm(n,()=>KF(t,o)),o.value))))},KF=(e,t)=>{if(t.refCount--,t.refCount>0)return xe;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Bl),fn(t.scope,vn)):mc(r)?(t.fiber=zc(n=>B(n(nh(r)),()=>e.state===t&&t.refCount===0?(e.state=Bl,fn(t.scope,vn)):xe)).pipe(Bc(le(()=>{t.fiber=void 0})),Wc(e.context),rF(e.scope)),xe):xe};var JF=VF,kb=GF;var P4="~effect/Stream",si=e=>A(e,P4);var dn=LF;var QF=e=>dn(Ml(e)),F4=(e,t)=>dn(dr((r,n)=>B(Cb(e.channel,n),o=>t(o,n))));var Ab=e=>e.channel,YF=(e,t)=>dn(OF(e,t)),Yc=dn(PF);var XF=e=>dn(_F(()=>e().channel)),vb=e=>dn(FF(e));var ea=e=>dn(xh(ne(e,Ab)));var R4=d(2,(e,t)=>XF(()=>{let r=0;return dn(RF(e.channel,Ft(n=>t(n,r++))))}));var eR=d(e=>si(e[0])&&si(e[1]),(e,t,r)=>dn(NF(Ab(e),Ab(t),r)));var Eh=d(2,(e,t)=>F4(e,(r,n)=>le(()=>{let o,s,a=Ie(()=>{if(s!==void 0){let c=s;return s=void 0,y(c)}return r}).pipe(_n(c=>(o=An(c),Rt()))),i=ne(Ie(()=>t.transform(a,n)),([c,f])=>(s=f,Da(c)));return Ie(()=>o||i)})));var tR=d(e=>si(e[0]),(e,t)=>XF(()=>{let r=new TextDecoder(t?.encoding);return R4(e,n=>r.decode(n,{stream:!0}))}));var rR=e=>e.channel.pipe(UF(MF()),dn);var Ob=d(2,(e,t)=>eb(r=>Cb(e.channel,r).pipe(B(n=>t.transform(n,r)),ne(([n])=>n)))),nR=e=>Ib(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t});var oR=e=>Ib(e.channel,()=>"",(t,r)=>t+r.join(""));var bh="~effect/FileSystem",Fn=Ye("effect/FileSystem"),_b=e=>Fn.of({...e,[bh]:bh,exists:t=>Zn(e.access(t),kr(!0),ns("PlatformError",r=>r.reason._tag==="NotFound"?y(!1):C(r))),readFileString:(t,r)=>B(e.readFile(t),n=>ht({try:()=>new TextDecoder(r).decode(n),catch:o=>pn({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:L(function*(t,r){let n=yield*e.open(t,{flag:"r"}),o=r?.offset===void 0?void 0:Ol(r.offset);o&&(yield*n.seek(o,"start"));let s=r?.bytesToRead===void 0?void 0:Ol(r.bytesToRead),a=BigInt(0),i=Number(BigInt(r?.chunkSize??64*1024)),c=n.readAlloc(i);return QF(y(B(Ie(()=>s!==void 0&&s<=a?Rt():s!==void 0&&s-a<i?n.readAlloc(Number(s-a)):c),Re({onNone:()=>Rt(),onSome:f=>(a+=BigInt(f.length),y(Da(f)))}))))},ea),sink:(t,r)=>Zn(e.open(t,{...r,flag:r?.flag??"w"}),ne(n=>qF(o=>n.writeAll(o))),HF),writeFileString:(t,r,n)=>B(ht({try:()=>new TextEncoder().encode(r),catch:o=>pn({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),o=>e.writeFile(t,o,n))}),gt=(e,t)=>Jr({module:"FileSystem",method:e,_tag:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),sR=e=>Fn.of({[bh]:bh,access(t){return C(gt("access",t))},chmod(t){return C(gt("chmod",t))},chown(t){return C(gt("chown",t))},copy(t){return C(gt("copy",t))},copyFile(t){return C(gt("copyFile",t))},glob(t){return C(gt("glob",t))},exists(){return y(!1)},link(t){return C(gt("link",t))},makeDirectory(){return ar("not implemented")},makeTempDirectory(){return ar("not implemented")},makeTempDirectoryScoped(){return ar("not implemented")},makeTempFile(){return ar("not implemented")},makeTempFileScoped(){return ar("not implemented")},open(t){return C(gt("open",t))},readDirectory(t){return C(gt("readDirectory",t))},readFile(t){return C(gt("readFile",t))},readFileString(t){return C(gt("readFileString",t))},readLink(t){return C(gt("readLink",t))},realPath(t){return C(gt("realPath",t))},remove(){return xe},rename(t){return C(gt("rename",t))},sink(t){return zF(gt("sink",t))},stat(t){return C(gt("stat",t))},stream(t){return vb(gt("stream",t))},symlink(t){return C(gt("symlink",t))},truncate(t){return C(gt("truncate",t))},utimes(t){return C(gt("utimes",t))},watch(t){return vb(gt("watch",t))},writeFile(t){return C(gt("writeFile",t))},writeFileString(t){return C(gt("writeFileString",t))},...e}),$4=e=>Eo(Fn)(sR(e)),eu="~effect/FileSystem/File",N4=e=>A(e,eu),jl=class extends Ye()("effect/FileSystem/WatchBackend"){};var fs="~effect/Path",Oo=Ye("effect/Path");function aR(e,t){let r="",n=0,o=-1,s=0,a;for(let i=0;i<=e.length;++i){if(i<e.length)a=e.charCodeAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf("/");if(c!==r.length-1){c===-1?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),o=i,s=0;continue}}else if(r.length===2||r.length===1){r="",n=0,o=i,s=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(o+1,i):r=e.slice(o+1,i),n=i-o-1;o=i,s=0}else a===46&&s!==-1?++s:s=-1}return r}function M4(e,t){let r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}function U4(e){if(e.protocol!=="file:")return C(new vo({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));if(e.hostname!=="")return C(new vo({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)|32;if(t[r+1]==="2"&&n===102)return C(new vo({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return y(decodeURIComponent(t))}var iR=function(){let t="",r=!1,n;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let a=globalThis.process;n===void 0&&"process"in globalThis&&typeof a=="object"&&a!==null&&typeof a.cwd=="function"&&(n=a.cwd()),s=n}s.length!==0&&(t=s+"/"+t,r=s.charCodeAt(0)===47)}return t=aR(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},D4=47;function L4(e){let t=new URL("file://"),r=iR(e);return e.charCodeAt(e.length-1)===D4&&r[r.length-1]!=="/"&&(r+="/"),t.pathname=W4(r),y(t)}var B4=/%/g,j4=/\\/g,z4=/\n/g,q4=/\r/g,H4=/\t/g;function W4(e){return e.includes("%")&&(e=e.replace(B4,"%25")),e.includes("\\")&&(e=e.replace(j4,"%5C")),e.includes(`
29
- `)&&(e=e.replace(z4,"%0A")),e.includes("\r")&&(e=e.replace(q4,"%0D")),e.includes(" ")&&(e=e.replace(H4,"%09")),e}var Pb=Oo.of({[fs]:fs,resolve:iR,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;return e=aR(e,!t),e.length===0&&!t&&(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let e;for(let t=0;t<arguments.length;++t){let r=arguments[t];r.length>0&&(e===void 0?e=r:e+="/"+r)}return e===void 0?".":Pb.normalize(e)},relative(e,t){if(e===t||(e=Pb.resolve(e),t=Pb.resolve(t),e===t))return"";let r=1;for(;r<e.length&&e.charCodeAt(r)===47;++r);let n=e.length,o=n-r,s=1;for(;s<t.length&&t.charCodeAt(s)===47;++s);let i=t.length-s,c=o<i?o:i,f=-1,u=0;for(;u<=c;++u){if(u===c){if(i>c){if(t.charCodeAt(s+u)===47)return t.slice(s+u+1);if(u===0)return t.slice(s+u)}else o>c&&(e.charCodeAt(r+u)===47?f=u:u===0&&(f=0));break}let p=e.charCodeAt(r+u),h=t.charCodeAt(s+u);if(p!==h)break;p===47&&(f=u)}let l="";for(u=r+f+1;u<=n;++u)(u===n||e.charCodeAt(u)===47)&&(l.length===0?l+="..":l+="/..");return l.length>0?l+t.slice(s+f):(s+=f,t.charCodeAt(s)===47&&++s,t.slice(s))},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;return n===-1?r?"/":".":r&&n===1?"//":e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,i=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else i===-1&&(o=!1,i=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(n=s):(a=-1,n=i))}return r===n?n=i:n===-1&&(n=e.length),e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else n===-1&&(o=!1,n=s+1);return n===-1?"":e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let i=e.charCodeAt(a);if(i===47){if(!o){r=a+1;break}continue}n===-1&&(o=!1,n=a+1),i===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return M4("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;n?(t.root="/",o=1):o=0;let s=-1,a=0,i=-1,c=!0,f=e.length-1,u=0;for(;f>=o;--f){if(r=e.charCodeAt(f),r===47){if(!c){a=f+1;break}continue}i===-1&&(c=!1,i=f+1),r===46?s===-1?s=f:u!==1&&(u=1):s!==-1&&(u=-1)}return s===-1||i===-1||u===0||u===1&&s===i-1&&s===a+1?i!==-1&&(a===0&&n?t.base=t.name=e.slice(1,i):t.base=t.name=e.slice(a,i)):(a===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,i)):(t.name=e.slice(a,s),t.base=e.slice(a,i)),t.ext=e.slice(s,i)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir="/"),t},sep:"/",fromFileUrl:U4,toFileUrl:L4,toNamespacedPath:F});var hi={};En(hi,{fdName:()=>QI,isCommand:()=>Kh,isPipedCommand:()=>s3,isStandardCommand:()=>o3,make:()=>cp,parseFdName:()=>up,pipeTo:()=>a3,prefix:()=>i3,setCwd:()=>GI,setEnv:()=>KI});var Su={};En(Su,{ChildProcessSpawner:()=>aa,ExitCode:()=>zI,ProcessId:()=>qI,make:()=>HI,makeHandle:()=>Gh});function ls(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Ih(e){return t=>ls(t)?.[e]}var Ar="~structural",ai="~identifier",zl="~sentinels",Ch="~constructor",cR=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],tu=Ih("identifier"),Rb=Ih(ai),$b=Ih("title");var ql=bn(e=>{let t=ls(e)?.identifier;return typeof t=="string"?t:e.getExpected(ql)}),uR=new Set([zl,Ar,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var me=Symbol();var Gt=ts,vr=Gt(me),je=Gt(me),Hl=e=>e===me?v():R(e),Nb=e=>e._tag==="None"?vr:Gt(e.value);var Gl="~effect/SchemaIssue/Issue";function Ub(e){return A(e,Gl)&&e[Gl]===Gl}function V4(e){return Object.hasOwn(e,"input")}var Zr=class{[Gl]=Gl;constructor(t,r){r?.reportInput===!0&&t!==me&&(this.input=t)}},fR=class extends Zr{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},lR=class extends Zr{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},At=class extends Zr{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},na=class extends Zr{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Db=class extends Zr{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},vt=class extends Zr{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},xt=class extends Zr{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},ue=class extends Zr{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Or(e,t,r,n,o){return new vt(e,[new At([t],r)],n,o)}var Kl=class extends Zr{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Jl=class extends Zr{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},pR=class extends Zr{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function Mb(e,t,r){if(Ub(e))return e;if(typeof e=="string")return new ue({message:e},t,r);let n=typeof e.issue=="string"?new ue({message:e.issue},t,r):e.issue;return new At(e.path,n)}function dR(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new ue(void 0,t,r):Mb(e,t,r)}function mR(e,t,r,n){return Array.isArray(t)?Us(t)?t.length===1?Mb(t[0],r,n):new vt(e,Ft(t,o=>Mb(o,r,n)),r,n):void 0:dR(t,r,n)}var hR=e=>{let t=nu(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return ra(ql(e.ast),e);case"InvalidValue":{let r=Lb(e);if(r!==void 0)return ra(r,e);let n=Th(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=Th(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=Th(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},gR=e=>nu(e.issue)??nu(e);function xR(e){return t=>({issues:ru(t,[],e?.leafHook??hR,e?.checkHook??gR)})}function Th(e){return V4(e)?N(e.input):void 0}function Lb(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function ra(e,t){let r=Th(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function ru(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 ru(e.issue,t,r,n);let s=Lb(e.issue);return[{path:t,message:s===void 0?ra(Bb(e.filter),e):ra(s,e.issue)}]}case"Encoding":return ru(e.issue,t,r,n);case"Pointer":return ru(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>ru(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:nu(e)??ra(ql(e.ast),e)}]:e.issues.flatMap(o=>ru(o,t,r,n));default:return[{path:t,message:r(e)}]}}function Bb(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=>Bb(r)).join(" & ")}}function G4(){return e=>Vl(e,"")}var yR=G4();function Vl(e,t){let r;switch(e._tag){case"Filter":{let n=gR(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return Vl(e.issue,t);let o=Lb(e.issue);r=o===void 0?ra(Bb(e.filter),e):ra(o,e.issue)}break}case"Encoding":return Vl(e.issue,t);case"Pointer":return Vl(e.issue,t+Id(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>Vl(n,t)).join(`
30
- `);r=nu(e)??ra(ql(e.ast),e);break}default:r=hR(e);break}return t?`${r}
31
- at ${t}`:r}function nu(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return nu(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 Zl(e){let t;for(let r of e.reasons){if(!$m(r)||!Ub(r.error))return;t??=r.error}return t}function Qr(e,t){let r=Zl(e);if(r===void 0)throw new Error(t,{cause:e});return r}var jb=Fc,ER=Ka,bR=E_,IR=b_,CR=I_,TR=IE,wR=C_;var kR=Gm;var AR=CE;var zb=w_,vR=k_;var qb=A_;var Hb=TE,Wb=pl,OR=wE;var _R=kE,Ql=v_;var PR=dl;var FR=OE;var RR=__;var Vb=PE;var ou=e=>K4(typeof e=="string"?J4.encode(e):e),ii=e=>{let t=Q4(e),r=t.length;if(r%4!==0)return Z(new un({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 Z(new un({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=wh(t.charCodeAt(a))<<18|wh(t.charCodeAt(a+1))<<12|wh(t.charCodeAt(a+2))<<6|wh(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return H(s)}catch(o){return Z(new un({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},NR=e=>Mt(ii(e),t=>Z4.decode(t)),K4=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Rn[(e[n-1]&15)<<2|e[n]>>6],r+=Rn[e[n]&63];return n===t+1&&(r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Rn[(e[n-1]&15)<<2],r+="="),r},J4=new TextEncoder,Z4=new TextDecoder,Q4=e=>e.replace(/[\n\r]/g,""),Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yl=new Uint8Array(123).fill(255);for(let e=0;e<Rn.length;e++)Yl[Rn.charCodeAt(e)]=e;Yl[61]=0;var wh=e=>{if(e>=Yl.length||Yl[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return Yl[e]};var MR=e=>ou(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Kb=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return Z(new un({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 Z(new un({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,"/"),ii(n)},UR=e=>Mt(Kb(e),t=>Y4.decode(t)),Y4=new TextDecoder;var Xl=e=>Object.assign(Object.create(cy),e);function eG(e){return LR((t,r)=>C(e(t,r)))}function kh(e){return eG((t,r)=>{let n={message:e(t)};return ve(t)?new Kl(n,t.value,r):new Kl(n)})}var DR=kh(()=>"Encoding is not supported"),tG=Xl({_tag:"Passthrough"});function Po(){return tG}function pe(e){return Xl({_tag:"Transform",transform:e})}function ir(e){return Xl({_tag:"TransformEffect",transform:e})}function Ah(e){return Xl({_tag:"TransformOptional",transform:e})}function LR(e){return Xl({_tag:"TransformOptionalEffect",transform:e})}function Jb(){return Ah(()=>v())}function Zb(e){return LR(t=>{let r=ic(t,pt);return ve(r)?y(r):ti(e,R)})}function ci(){return pe(globalThis.String)}function vh(){return pe(globalThis.Number)}function BR(){return pe(globalThis.BigInt)}function Qb(){return pe(e=>new globalThis.Date(e))}function jR(){return pe(N_)}function zR(e){return ir((t,r)=>ht({try:()=>JSON.parse(t,e?.reviver),catch:()=>new ue({expected:"a valid JSON string"},t,r)}))}function qR(e){return ir((t,r)=>ht({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 ue({expected:"a JSON-serializable value"},t,r)}))}function Yb(){return pe(ou)}function Oh(){return pe(MR)}function _h(){return pe(Zd)}function HR(){return ir((e,t)=>kl(bl(ii(e)),()=>new ue({expected:"a valid Base64 string"},e,t)))}function WR(){return ir((e,t)=>Sr(NR(e),{onFailure:()=>C(new ue({expected:"a valid Base64 string"},e,t)),onSuccess:y}))}function VR(){return ir((e,t)=>Sr(Kb(e),{onFailure:()=>C(new ue({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function GR(){return ir((e,t)=>Sr(UR(e),{onFailure:()=>C(new ue({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function KR(){return ir((e,t)=>Sr(Ky(e),{onFailure:()=>C(new ue({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function JR(){return ir((e,t)=>Sr(eA(e),{onFailure:()=>C(new ue({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function ZR(){return pe(encodeURIComponent)}function QR(){return ir((e,t)=>{try{return y(globalThis.decodeURIComponent(e))}catch{return C(new ue({expected:"a valid URI component"},e,t))}})}function YR(){return pe(e=>r$(Array.from(e.entries())))}var rG=n$(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function XR(){return pe(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&rG(e).forEach(([n,o])=>{t.append(n,o)}),t})}function e$(){return pe(e=>r$(Array.from(e.entries())))}var nG=n$(In);function t$(){return pe(e=>typeof e=="object"&&e!==null?new URLSearchParams(nG(e)):new URLSearchParams)}function oG(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>uc(o)?globalThis.Number(o):o)}var sG=20;function r$(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,a])=>{let i=oG(s),c=t;for(let f=0;f<i.length;f++){let u=o.get(c),l=i[f]===""&&u!==void 0?u.length:i[f];u!==void 0&&typeof l=="number"&&(u.length=Math.max(u.length,l+1));let p=Object.hasOwn(c,l),h=p?c[l]:void 0;if(f===i.length-1){let g=o.get(h);if(g!==void 0)U(h,g.length++,a);else if(n.has(h))h.push(a);else if(p){let x=[h,a];n.add(x),U(c,l,x)}else U(c,l,a)}else{let g=i[f+1],x=typeof g=="number"||g==="";if(r.has(h)&&o.has(h)===x)c=h;else{let b={};r.add(b),x&&o.set(b,{parent:c,key:l,length:0}),U(c,l,b),c=b}}}});for(let[s,{key:a,length:i,parent:c}]of Array.from(o).reverse())c[a]===s&&i-Object.keys(s).length<=sG&&U(c,a,Object.assign(new Array(i),s));return t}function n$(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 o$=/^[+-]?\d+$/,eI="~effect/BigDecimal",aG={[eI]:eI,[Y](){let e=rI(this);return ie(Ae(String(e.value)),dt(e.scale))},[X](e){return tI(e)&&f$(this,e)===0},toString(){return`BigDecimal(${ps(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},tI=e=>A(e,eI),i$=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(aG);return r.value=e,r.scale=t,r},c$=(e,t)=>{let r=i$(e,t);return r.normalized=r,r};var $n=BigInt(0),iG=BigInt(1);var cG=BigInt(10),u$=c$($n,0);var rI=e=>{if(e.normalized===void 0)if(e.value===$n)e.normalized=u$;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=c$(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var uG=100,fG=[iG],Xb=(e,t)=>e===t?0:e<t?-1:1,s$=(e,t)=>{let r=`${e.value<$n?-e.value:e.value}`,n=`${t.value<$n?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==$n)return o<$n?-1:1;let s=Math.max(r.length,n.length);return dk(r.padEnd(s,"0"),n.padEnd(s,"0"))},f$=(e,t)=>{if(e.scale===t.scale)return Xb(e.value,t.value);let r=a$(e),n=a$(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>uG)return r===-1?s$(t,e):s$(e,t);let a=fG[s]??=cG**BigInt(s);return o>0?Xb(e.value,t.value*a):Xb(e.value*a,t.value)},su=tc(f$);var a$=e=>e.value===$n?0:e.value<$n?-1:1;var l$=e=>{if(e==="")return R(u$);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)||!o$.test(c))return v()}else t=e,r=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),f=t.slice(a+1);o=`${c}${f}`,s=f.length}else o=t,s=0;if(!o$.test(o))return v();let i=s-r;return Number.isSafeInteger(i)?R(i$(BigInt(o),i)):v()};var ps=e=>{let t=rI(e);if(Math.abs(t.scale)>=16)return lG(t);let r=t.value<$n,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},lG=e=>{if(pG(e))return"0e+0";let t=rI(e),r=`${t.value}`,n=t.value<$n?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 pG=e=>e.value===$n;var Ph=class extends Ps{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ph(this.encode,this.decode)}},tp="~effect/SchemaTransformation/Transformation",Ne=class extends Ps{[tp]=tp;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ne(this.encode,this.decode)}};function dG(e){return A(e,tp)&&e[tp]===tp}var Fh=e=>dG(e)?e:new Ne(e.decode,e.encode);function Nt(e){return new Ne(ir(e.decode),ir(e.encode))}function we(e){return new Ne(pe(e.decode),pe(e.encode))}function Rh(e){return new Ne(Ah(e.decode),Ah(e.encode))}function d$(){return new Ne(jR(),Po())}var mG=new Ne(Po(),Po());function au(){return mG}var iu=new Ne(vh(),ci()),$h=new Ne(BR(),ci()),nI=new Ne(Qb(),pe(yy)),m$=new Ne(Qb(),pe(e=>e.getTime()));var oI=Nt({decode:(e,t)=>Re(WP(e),{onNone:()=>C(new ue({expected:"a valid ByteSize string"},e,t)),onSome:y}),encode:e=>y(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),h$=Nt({decode:(e,t)=>Re(cb(e),{onNone:()=>C(new ue({expected:"a non-negative bigint byte count"},e,t)),onSome:y}),encode:e=>y(lh(e))}),g$=Nt({decode:(e,t)=>Re(cb(e),{onNone:()=>C(new ue({expected:"a non-negative safe-integer byte count"},e,t)),onSome:y}),encode:(e,t)=>Re(GP(e),{onNone:()=>C(new ue({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:y})}),hG=e=>Lr(e)&&typeof e.message=="string",x$=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:S$(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},gG=e=>{try{let t=va(e);return t===void 0?N(e):JSON.parse(t)}catch{return N(e)}},xG=(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},y$=e=>{let t=new WeakSet,r=n=>{if(Ow(n)){if(t.has(n))return"[Circular]";t.add(n);let o=xG(n,e,r);return t.delete(n),o}return gG(n)};return r},S$=e=>hG(e)?x$(e):e,E$=e=>we({decode:x$,encode:t=>y$(e)(t)}),b$=e=>we({decode:S$,encode:y$(e)});function I$(){return we({decode:mk,encode:Oy})}function C$(){return we({decode:Ns,encode:tr})}function T$(e){return we({decode:$a,encode:e?.onNoneEncoding===null?Oy:tr})}function w$(){return Rh({decode:R,encode:ac})}function k$(){return Rh({decode:e=>e.pipe(ic(pt),R),encode:ac})}var sI=Nt({decode:(e,t)=>URL.canParse(e)?y(new URL(e)):C(new ue({expected:"a valid URL string"},e,t)),encode:e=>y(e.href)});var aI=new Ne(HR(),Yb()),A$=new Ne(WR(),Yb()),v$=new Ne(GR(),Oh()),O$=new Ne(JR(),_h()),_$=new Ne(QR(),ZR());function P$(e){return new Ne(zR(e??{}),qR(e))}var F$=new Ne(YR(),XR()),R$=new Ne(e$(),t$());function sa(e){return t=>t._tag===e}var pu=sa("Declaration");var yG=sa("Never");var uu=sa("Literal"),cI=sa("UniqueSymbol");var gI=sa("Arrays"),SG=sa("Objects"),z$=sa("Union"),q$=sa("Suspend"),ft=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Ro={},Fo=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}},$$="~effect/Schema",yt=class{[$$]=$$;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}>`}},du=class extends yt{_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===me?vr:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=fi(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new du(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>"}},EG=class extends yt{_tag="Null";getParser(){return Wh(this,null)}getExpected(){return"null"}},xI=new EG;var bG=class extends yt{_tag="Undefined";getParser(){return Wh(this,void 0)}toCodecJson(){return Je(this,[H$])}getExpected(){return"undefined"}},H$=new ft(xI,new Ne(pe(()=>{}),pe(()=>null))),yI=new bG;var IG=class extends yt{_tag="Void";getParser(){let e=Gt(void 0);return t=>t===me?vr:e}toCodecJson(){return Je(this,[H$])}getExpected(){return"void"}},W$=new IG;var CG=class extends yt{_tag="Never";getParser(){return Un(this,vw)}getExpected(){return"never"}},SI=new CG,TG=class extends yt{_tag="Any";getParser(){return Un(this,ly)}getExpected(){return"any"}},V$=new TG,wG=class extends yt{_tag="Unknown";getParser(){return Un(this,ly)}getExpected(){return"unknown"}},ds=new wG,kG=class extends yt{_tag="ObjectKeyword";getParser(){return Un(this,mf)}getExpected(){return"object | array | function"}},G$=new kG,K$=class extends yt{_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 ${N(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Un(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 Je(this,[new ft(new _r(Object.keys(e).map(t=>new Xr(t))),new Ne(pe(t=>e[t]),ci()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function iI(e){return typeof e=="number"?`parts[${e}]`:e}function uI(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${iI(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=iI(t);n=!e.checks&&e.parts.every((s,a)=>uI(s,`${o}.parts[${a}]`,r));break}case"Union":{let o=iI(t);n=!e.checks&&e.types.every((s,a)=>uI(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var EI=class extends yt{_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 f=0;f<e.length;f++){let u=e[f];if(!uI(u,f,i))throw new Error(`Invalid TemplateLiteral part ${u._tag}`);s.push(u),a.push(u._tag==="Literal"?globalThis.String(u.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let f=s.length-1;f>=0;f--)c[f]=c[f+1]+(a[f]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new mn(!1,this.parts.map($I),[]),r=e(xu(Yr,t,Z$(this)));return(n,o)=>{if(n===me)return vr;let s=r(n,o);return s._tag==="Success"?je:Vt(s,{onSuccess:()=>n,onFailure:a=>new vt(this,[a],n,o)})}}getExpected(){return"string"}matchPart(e,t){return IN(this,e,t)===void 0?void 0:e}};function J$(e){let t=bn(o=>{if(o._tag!=="Union")return o;let s=fi(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new _r(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new EI(e.map(o=>t(Mn(o)))),n=new mn(!1,e.map($I),[]);return xu(r,n,Z$(r))}function Z$(e){return new Ne(ir((t,r)=>{let n=IN(e,t,r);return n?y(n):C(new ue({expected:"a string matching template literal parts"},t,r))}),pe(t=>t.join("")))}var Q$=class extends yt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return Wh(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return Je(this,[new ft(e===void 0?SI:new Xr(globalThis.String(this.symbol)),wN.transformation)])}getExpected(){return globalThis.String(this.symbol)}},Xr=class extends yt{_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 ${N(e)}`);this.literal=e}getParser(){return Wh(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?N$(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:N$(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function N$(e){let t=globalThis.String(e.literal);return Je(e,[new ft(new Xr(t),new Ne(pe(()=>e.literal),pe(()=>t)))])}var AG=class extends yt{_tag="String";getParser(){return Un(this,In)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Dn(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Yr=new AG,vG=class extends yt{_tag="Number";getParser(){return Un(this,pf)}matchKey(e,t){return this._match(VG,e,t)}matchPart(e,t){return this._match(dI,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:Dn(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(fI(this.checks,"effect/schema/isFinite")||fI(this.checks,"effect/schema/isInt"))?this:Je(this,[LG])}toCodecStringTree(){return this.toCodecJson()===this?Je(this,[GG]):Je(this,[KG])}getExpected(){return"number"}};function fI(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&fI(r.checks,t))}var bI=new vG,OG=class extends yt{_tag="Boolean";getParser(){return Un(this,gd)}getExpected(){return"boolean"}},Y$=new OG,_G=class extends yt{_tag="Symbol";getParser(){return Un(this,fy)}matchKey(e,t){return t.disableChecks||!this.checks?e:Dn(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Je(this,[wN])}getExpected(){return"symbol"}},X$=new _G,PG=class extends yt{_tag="BigInt";getParser(){return Un(this,kw)}matchPart(e,t){if(!mI.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:Dn(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return Je(this,[ZG])}getExpected(){return"bigint"}},eN=new PG,mn=class extends yt{_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 f=0;f<t.length;f++)if(Kt(t[f]))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 f=1;f<r.length;f++)if(Kt(r[f]))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(u,l){return l<s?n[l]:l>=u?o[l-u+1]:o[0]}let c=u=>{let{input:l,len:p,options:h}=u;if(r.rest.length===0&&p>s)for(let g=s;g<p;g++){let x=new Db(r,l[g],h),b=new At([g],x);if(h.errors==="all")u.issues?u.issues.push(b):u.issues=[b];else return C(new vt(r,[b],l,h))}return u.issues?C(new vt(r,u.issues,l,h)):Gt(u.output)},f=(u,l)=>{let p=u.length,h={ast:r,getParser:i,input:u,len:p,tailThreshold:Math.max(s,p-a),output:new globalThis.Array(p),issues:void 0,options:l},g=r.rest.length===0?s:Math.max(p,s+a),x=l.concurrency===void 0?1:tl(l.concurrency),b=x===1?RG(h,u,0,g):$G(h,u,{concurrency:x,end:g});if(!b)return c(h);if($e(b))return $t(b,()=>c(h));let T=!0;return Ie(()=>T?(T=!1,B(b,()=>c(h))):f(u,l))};return(u,l)=>{if(u===me)return vr;try{return Array.isArray(u)?(n||(n=r.elements.map(p=>({ast:p,parser:t(p)})),o=r.rest.map(p=>({ast:p,parser:t(p)}))),f(u,l)):C(new xt(r,u,l))}catch(p){return ar(p)}}}_rebuild(e,t,r){let n=fi(this.elements,e),o=fi(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new mn(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 FG(e,t,r,n){if(r._tag==="Failure")return Uh(e,e.ast,n,r);let o=r===je?t:r[fe];if(o!==me)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Kt(s.ast))return;let a=new At([n],new na(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return An(new vt(e.ast,[a],e.input,e.options))}}var tN={onItem(e,t,r){let n=r<e.len?t:me;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:FG},RG=_m()(tN),$G=Pm()(tN),Uh=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Zl(n.cause);if(o===void 0)return So(Vs(n.cause,a=>new vt(t,[new At([r],a)],e.input,e.options)));let s=new At([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return An(new vt(t,[s],e.input,e.options))},Lh="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function oa(e,t,r=Ro){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(RI(Mn(t)))}var II=class{name;type;constructor(e,t){this.name=e,this.type=t}};function rN(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(rN);default:return!1}}function nN(e){let t=hu(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(nN);default:return!1}}function NG(e){return rN(e)&&nN(e)}var CI=class{parameter;type;constructor(e,t){if(!NG(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Kt(t)&&!bN(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},rp=class extends yt{_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 Un(r,yd);let s,a,i=()=>(s||(s=r.propertySignatures.map(l=>({parser:t(l.type),name:l.name,type:l.type})),a=o?r.indexSignatures.map(l=>({is:l,parserKey:e(RI(l.parameter)),parserValue:t(l.type)})):void 0),s),c=()=>{let l=new Set(r.propertySignatures.map(b=>typeof b.name=="number"?globalThis.String(b.name):b.name)),p=(b,T,w,P,O)=>{if(O._tag==="Failure")return Uh(b,r,T,O)??vn;let m=O===je?P:O[fe];if(w!==me&&m!==me){if(n&&(l.has(T)||l.has(typeof w=="number"?globalThis.String(w):w)))return vn;U(b.out,w,m)}return vn},h=(b,T,w,P)=>{if(!P){let E=w.parserKey(T,b.options);if(!$e(E))return B(Js(E),I=>h(b,T,w,I));P=E}if(P._tag==="Failure")return Uh(b,r,T,P)??vn;let O=P===je?T:P[fe],m=b.input[T],S=w.parserValue(m,b.options);return $e(S)?p(b,T,O,m,S):B(Js(S),E=>p(b,T,O,m,E))},g=(b,T,w)=>{let P=b.input[T],O=w.parserValue(P,b.options);return $e(O)?p(b,T,T,P,O):B(Js(O),m=>p(b,T,T,P,m))},x=o?Pm()({onItem:(b,[T,w])=>w.is.parameter===Yr?g(b,T,w):h(b,T,w),step:(b,T,w)=>w._tag==="Failure"?w:void 0}):void 0;return nb(function*(b,T){if(b===me)return me;if(!(typeof b=="object"&&b!==null&&!Array.isArray(b)))return yield*C(new xt(r,b,T));i();let w=b,P={},O={ast:r,input:w,out:P,issues:void 0,options:T},m=T.errors==="all",S=T.onExcessProperty==="error",E=T.concurrency===void 0?1:tl(T.concurrency),I=o&&S?r.indexSignatures.map(k=>oa(w,k.parameter,T)):void 0;if(S){let k=I?new Set(l):l;if(I)for(let M of I)for(let z of M)k.add(z);let _=Reflect.ownKeys(w);for(let M=0;M<_.length;M++){let z=_[M];if(!k.has(z)&&Object.prototype.propertyIsEnumerable.call(w,z)){let de=new Db(r,w[z],T),oe=new At([z],de);if(m){O.issues?O.issues.push(oe):O.issues=[oe];continue}else return yield*C(new vt(r,[oe],b,T))}}}if(n){let k=E===1?M$(O,s):MG(O,s,{concurrency:E});k&&(yield*k)}if(o&&E===1)for(let k=0;k<o;k++){let _=a[k],M=_.is.parameter===Yr?g:h,z=I?.[k]??(_.is.parameter===Yr?Object.keys(w):oa(w,_.is.parameter,T));for(let de=0;de<z.length;de++){let oe=M(O,z[de],_);if(!$e(oe))yield*oe;else if(oe._tag==="Failure")return yield*oe}}else if(x){let k=Ua();for(let M=0;M<o;M++){let z=a[M],de=I?.[M]??(z.is.parameter===Yr?Object.keys(w):oa(w,z.is.parameter,T));for(let oe=0;oe<de.length;oe++)k.push([de[oe],z])}let _=x(O,k,{concurrency:E});_&&(yield*_)}return O.issues?yield*C(new vt(r,O.issues,b,T)):P})};if(o)return c();let f,u=(l,p,h)=>{let g=s[p];return B(Js(h),x=>{let b=lI(l,g,x);if(b)return b;let T=()=>Gt(l.out),w=M$(l,s.slice(p+1));return w?$t(w,T):T()})};return(l,p)=>{if(l===me)return vr;if(p.errors==="all"||p.onExcessProperty!==void 0||p.concurrency!==void 0&&tl(p.concurrency)!==1)return(f??=c())(l,p);if(!(typeof l=="object"&&l!==null&&!Array.isArray(l)))return C(new xt(r,l,p));let h=i(),g=l,x={},b={ast:r,input:g,out:x,issues:void 0,options:p};try{for(let T=0;T<h.length;T++){let w=h[T],P=w.name,O=cu(g,P),m=O?g[P]:me,S=w.parser(m,p);if(!$e(S))return u(b,T,S);if(S===je){O&&U(x,P,m);continue}let E=lI(b,w,S);if(E)return E}}catch(T){return ar(T)}return Gt(x)}}_rebuild(e,t,r,n){let o=fi(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new II(a.name,i)}),s=fi(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new CI(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new rp(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 lI(e,t,r){if(r._tag==="Failure")return Uh(e,e.ast,t.name,r);if(r===je)return;let n=r[fe];if(n!==me){U(e.out,t.name,n);return}if(delete e.out[t.name],!Kt(t.type)){let o=new At([t.name],new na(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return An(new vt(e.ast,[o],e.input,e.options))}}var oN={onItem(e,t){if(!cu(e.input,t.name))return t.parser(me,e.options);let r=e.input[t.name];return U(e.out,t.name,r),t.parser(r,e.options)},step:lI},M$=_m()(oN),MG=Pm()(oN);function TI(e,t){return e?t?[...e,...t]:e:t}function Bh(e,t,r){return new rp(Reflect.ownKeys(e).map(n=>new II(n,e[n].ast)),[],r,t)}function np(e){return e.ast}function wI(e,t=void 0){return new mn(!1,e.map(r=>r.ast),[],void 0,t)}function jh(e,t,r){return new _r(e.map(np),t,void 0,r)}function sN(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=TI(o,s.checks)}return new rp(r,n,void 0,o)}function aN(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new mn(e.isMutable,e.elements,t,void 0,e.checks)}function iN(e){if(e.encoding)throw new Error("mutable does not support encodings");return new mn(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var kI=Ta(e=>{for(;;){if(q$(e))return ds;let t=e.encoding;if(!t)return e.recur?.(kI,F)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==F))return ds;e=t[t.length-1].to}});function cN(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(cN)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function fu(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[zl];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Kt(r)){if(uu(r))return[{key:t.name,literal:r.literal}];if(cI(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Kt(t)){if(uu(t))return[{key:r,literal:t.literal}];if(cI(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>fu(kI(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return fu(e.thunk())}}var U$=new WeakMap,Mh=Object.freeze([]),D$=e=>e===null?"null":Array.isArray(e)?"array":typeof e,cu=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function op(e){let t=U$.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let u=0;u<e.length;u++){let l=e[u],p=kI(l);if(yG(p))continue;if(uu(p)||cI(p)){s??=new Map;let g=uu(p)?p.literal:p.symbol;i[u]=g;let x=s.get(g);x||s.set(g,x=[]),x.push(u)}else a=!1;let h=fu(p);if(h.length){r??=new Map,n++;for(let{key:g,literal:x}of h){let b=r.get(g);b||r.set(g,b=[new Map,new Set]),b[1].add(u);let T=b[0].get(x);T||b[0].set(x,T=new Set),T.add(u)}}else{o??={};let g=cN(p);for(let x of g)(o[x]??=[]).push(u)}}let c={},f=u=>c[u]??=Object.freeze(o?.[u]??Mh);if(a&&s)s.forEach(Object.freeze),t=u=>s.get(u)??Mh;else if(r?.size===1&&!o){let[u,[l]]=r.entries().next().value,p=new Map;for(let[g,x]of l)p.set(g,Object.freeze(Array.from(x)));let h=Object.freeze(e.map((g,x)=>x));t=(g,x)=>{if(mf(g)){let b=cu(g,u)?g[u]:void 0;if(b!==void 0)return p.get(b)??Mh;if(x)return h}return Mh}}else if(r){let u;for(let l of r)(!u||l[1][0].size>u[1][0].size)&&l[1][1].size===n&&(u=l);t=(l,p)=>{let h=D$(l);if(!mf(l))return f(h);let g=new Set(o?.[h]),x;if(u){let[b,[T]]=u,w=cu(l,b),P=w?l[b]:void 0;if(w&&(!p||P!==void 0)){let O=T.get(P);if(!O)return f(h);for(let m of O)g.add(m);x=b}}if(x===void 0)for(let[b,[T,w]]of r){let P=cu(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let m=T.get(O);if(m)for(let S of m)g.add(S)}else if(p)for(let m of w)g.add(m)}for(let[b,[T,w]]of r){if(b===x)continue;let P=cu(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let m=T.get(O);for(let S of g)w.has(S)&&!m?.has(S)&&g.delete(S)}}return Array.from(g).sort((b,T)=>b-T)}}else t=u=>{let l=f(D$(u));return s?l.filter(p=>i[p]===void 0||i[p]===u):l};return U$.set(e,t),t}var _r=class extends yt{_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===me)return vr;let f=(a??=op(r.types))(i,n);if(f.length===0)return C(new Jl(r,[],i,c));if(f.length===1){let u=s(f[0])(i,c);return u._tag==="Success"?u:$e(u)?uN(r,u.cause,i,c):UG(r,u,i,c)}return fN(r,s,f,i,c)}}_rebuild(e,t,r){let n=fi(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new _r(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=Mn(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(uu);if(s.length>0)return`${B$(o.isMutable)}[ ${s.map(a=>e(a)+j$(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(a=>uu(a.type));if(s.length>0)return`{ ${s.map(a=>`${B$(a.type.context?.isMutable)}${Xn(a.name)}${j$(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function uN(e,t,r,n){let o=Zl(t);return o?An(new Jl(e,[o],r,n)):So(t)}function UG(e,t,r,n){return Cr(t,o=>uN(e,o,r,n))}function fN(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=DG(s,r);if(!a)return s.out?s.out:C(new Jl(e,s.issues??[],n,o));if($e(a))return L$(a,s);let i=!0;return Ie(()=>i?(i=!1,L$(a,s)):fN(e,t,r,n,o))}function L$(e,t){return $t(e,r=>t.out===je?y(t.input):t.out?t.out:C(new Jl(t.ast,t.issues??[],t.input,t.options)))}var DG=_m()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Zl(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]),An(new pR(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return vn}}}),lN=new _r([new Xr("Infinity"),new Xr("-Infinity"),new Xr("NaN")]);function B$(e){return e?"":"readonly "}function j$(e){return e?"?":""}var AI=class extends yt{_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 AI(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Dh=class extends Ps{_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 Dh(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Dh(this.run,this.annotations,!0)}and(e,t){return new ui([this,e],t)}},ui=class extends Ps{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new ui(this.checks,{...this.annotations,...e})}and(e,t){return new ui([this,e],t)}};function zh(e,t,r=!1){return new Dh((n,o,s)=>mR(o,e(n,o,s),n,s),t,r)}function qh(e,t){return new Dh((r,n,o)=>e(r)?void 0:new ue(void 0,r,o),t,!0)}function vI(e){return zh(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 OI=$o(bI,[vI()]),LG=new ft(new _r([OI,lN]),new Ne(vh(),pe(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function sp(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return zh(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 pI=new WeakMap;function ap(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&pI.set(r,mu(e)),r}function mu(e){let t=pI.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 pI.set(e,r),r}function Je(e,t){return e.encoding===t?e:ap(e,{encoding:t})}function li(e,t){if(e.context===t)return e;let r=mu(e);return r.context===t&&r.encoding===e.encoding?r:ap(e,{context:t})}function hu(e){return e.encoding?hu(e.encoding[e.encoding.length-1].to):e}function Nn(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return pN(e,zd(e.checks.slice(0,-1),r.annotate(t)))}return ap(e,{annotations:{...e.annotations,...t}})}function pN(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:ap(e,{checks:t})}function $o(e,t){return pN(e,TI(e.checks,t))}function gu(e,t){let r=t(e.to);return r===e.to?e:new ft(r,e.transformation)}function dN(e,t){let r=e,n=r[r.length-1],o=gu(n,t);return o===n?e:zd(e.slice(0,e.length-1),o)}function _I(e){return t=>t.encoding?Je(t,dN(t.encoding,e)):t}function Hh(e,t){return _I(r=>li(r,t))(e)}function pi(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Je(n,dN(n.encoding,r))}return e(n)}return Ta(r)}function mN(e,t){return PI(e,t,It(e))}function hN(e,t){return PI(Mn(e),t,e)}function PI(e,t,r){let n=new ft(e,t);return Je(r,r.encoding?[...r.encoding,n]:[n])}function fi(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 ip(e,t){let r=e.context?new Fo(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Fo(!1,!1,void 0,t);return li(e,r)}var di=Ta(e=>{let t=e.context?e.context.isOptional===!1?new Fo(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Fo(!0,!1);return BG(li(e,t))}),BG=_I(di),gN=bn(e=>di(new _r([e,yI]))),FI=Ta(e=>{let t=e.context?e.context.isMutable===!1?new Fo(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Fo(!1,!0);return jG(li(e,t))}),jG=_I(FI);function xN(e,t){let r=e.context?new Fo(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Fo(!1,!1,t);return li(e,r)}function xu(e,t,r){return PI(e,r,t)}function zG(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":xd(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 yN(e,t){let{literals:r,parameters:n}=zG(e);return new rp(r.map(o=>new II(o,t)),n.map(o=>new CI(o,t)))}function Kt(e){return e.context?.isOptional??!1}function SN(e){return e.context?.isMutable??!1}function EN(e){return e.annotations?.[Ar]===!0||e._tag==="FilterGroup"&&e.checks.every(EN)}function qG(e){function t(n){return EN(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Ma(r)?r:void 0}function HG(e){let t=!0;function r(n){return t=t&&!n.encoding&&!q$(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var It=Ta(e=>{let t=mu(e);if(t!==e){let n=It(t);return n===t&&e.encoding===void 0?e:li(n,e.context)}let r="recur"in e?e.recur(It):e;if("encodingChecks"in r&&r.encodingChecks){let n=HG(e)?r.encodingChecks:gI(r)||SG(r)||pu(r)&&r.typeParameters.length>0?qG(r.encodingChecks):void 0;return ap(r,{encodingChecks:void 0,checks:TI(r.checks,n)})}return r}),Mn=Ta(e=>It(en(e)));function WG(e,t){let r=t,n=r.length,o=r[n-1],s=[new ft(en(Je(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new ft(en(r[i-1].to),r[i].transformation.flip()));let a=en(o.to);return a.encoding?Je(a,[...a.encoding,...s]):Je(a,s)}var en=bn(e=>{if(e.encoding)return WG(e,e.encoding);let t=mu(e);if(t!==e){let r=en(t);return r===t?e:li(r,e.context)}return"flip"in e?e.flip(en):"recur"in e?e.recur(en):e});function bN(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(bN);default:return!1}}function Wh(e,t){let r=t===0?je:Gt(t);return(n,o)=>n===me?vr:n===t?r:C(new xt(e,n,o))}function Un(e,t){return(r,n)=>r===me?vr:t(r)?je:C(new xt(e,r,n))}function IN(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let f=0;f<o.length;f++){let u=o[f];if(u&&!t.includes(u))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(f,u){if(f===n.length)return u===s;if(i?.has(f*(s+1)+u))return!1;let l=n[f];if(f===n.length-1){let p=t.slice(u);if(l.matchPart(p,r)!==void 0)return a[f]=p,!0}else if(l._tag==="Literal"){let p=o[f];if(t.startsWith(p,u)&&c(f+1,u+p.length))return a[f]=p,!0}else{let p=s-e.suffixLengths[f+1],h=o[f+1],g=h===void 0?p:t.lastIndexOf(h,p);for(;g>=u;){let x=t.slice(u,g);if(l.matchPart(x,r)!==void 0&&c(f+1,g))return a[f]=x,!0;if(g===0)break;g=h===void 0?g-1:t.lastIndexOf(h,g-1)}}return i??=new Set,i.add(f*(s+1)+u),!1}return c(0,0)?a:void 0}var RI=pi(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(RI)}}),Vh=pi(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Vh)}}),$I=pi(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur($I)}}),CN="[\\s\\S]*?",dI=new globalThis.RegExp(`^${Lh}$`),VG=new globalThis.RegExp(`^(?:${Lh}|Infinity|-Infinity|NaN)$`);function NI(e){return sp(dI,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:dI.source}),...e})}var TN=$o(Yr,[NI()]),GG=new ft(TN,iu),KG=new ft(new _r([TN,lN]),iu),JG="-?\\d+",mI=new globalThis.RegExp(`^${JG}$`);function MI(e){return sp(mI,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:mI.source}),...e})}var UI=$o(Yr,[MI({expected:"a string representing a bigint"})]),ZG=new ft(UI,$h),QG="Symbol\\(([\\s\\S]*)\\)",hI=new globalThis.RegExp(`^${QG}$`),YG=$o(Yr,[DI()]),wN=new ft(YG,new Ne(pe(e=>globalThis.Symbol.for(hI.exec(e)[1])),ir((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?y(globalThis.String(e)):C(new Kl({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function DI(e){return sp(hI,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:hI.source}),...e})}function Dn(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=Dn(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 fR(a,i,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||a.aborted)return r}}}return r}function kN(e,t){let r=Dn(e,t,void 0,ds,{errors:"all"});if(r){let n=new vt(ds,r);return Z(n)}return H(t)}function AN(e){if(!pu(e))return;let t=e.annotations?.[Ch];return Cn(t)?t(e.typeParameters):void 0}function XG(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function e3(e){return e===void 0||typeof e=="string"}function vN(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 yu(e){return vN(e,XG)}var lu=new du([],()=>(e,t,r)=>yu(e)?je:C(new xt(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>BI}),ON=Nn(lu,{representation:{id:"effect/schema/MutableJson",payload:null}}),LI=new ft(lu,au()),_N=new ft(new _r([new mn(!1,[],[lu]),new rp([],[new CI(Yr,lu)])]),au());function t3(e){return vN(e,e3)}var r3=new du([],()=>(e,t,r)=>t3(e)?je:C(new xt(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),BI=new ft(r3,au());function jI(){return Object.assign(e=>e,{option:e=>R(e),result:e=>H(e),is:e=>!0})}var zI=jI(),qI=jI(),FN="~effect/process/ChildProcessSpawner/ChildProcessHandle",n3={[FN]:FN,...mt,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},Gh=e=>Object.setPrototypeOf({...e},n3),HI=e=>{let t=(n,o)=>e(n).pipe(ne(s=>tR(o?.includeStderr===!0?s.all:s.stdout)),ea),r=(n,o)=>rR(t(n,o));return aa.of({spawn:e,exitCode:n=>Qs(B(e(n),o=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>nR(r(n,o)),string:(n,o)=>oR(t(n,o))})},aa=class extends Ye()("effect/process/ChildProcessSpawner"){};var WI="~effect/process/ChildProcess",UN={...ao({label:"Command",evaluate(e){return co(e.context,aa).spawn(this)}}),[WI]:WI},Kh=e=>A(e,WI),o3=e=>e._tag==="StandardCommand",s3=e=>e._tag==="PipedCommand",mi=(e,t,r)=>Object.assign(Object.create(UN),{_tag:"StandardCommand",command:e,args:t,options:r}),Jh=(e,t,r={})=>Object.assign(Object.create(UN),{_tag:"PipedCommand",left:e,right:t,options:r}),cp=function(...t){if(JI(t[0])){let[s,...a]=t,i=ZI(s,a);return mi(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!JI(t[0])){let s=t[0];return function(a,...i){let c=ZI(a,i);return mi(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return mi(s,[],a)}let[r,n=[],o={}]=t;return mi(r,n,o)},a3=d(e=>Kh(e[0])&&Kh(e[1]),(e,t,r)=>Jh(e,t,r??{})),i3=function(...t){if(Kh(t[0])&&t.length>1){let[n,...o]=t,s=RN(o);return VI(n,s)}let r=RN(t);return n=>VI(n,r)},RN=e=>{if(JI(e[0])){let[n,...o]=e,s=ZI(n,o);return{command:s[0]??"",args:s.slice(1)}}let[t,r=[]]=e;return{command:t,args:r}},VI=(e,t)=>{switch(e._tag){case"StandardCommand":return mi(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return Jh(VI(e.left,t),e.right,e.options)}},GI=d(2,(e,t)=>{switch(e._tag){case"StandardCommand":return mi(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return Jh(GI(e.left,t),GI(e.right,t),e.options)}}),KI=d(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let r=e.options.env===void 0?t:{...e.options.env,...t};return mi(e.command,e.args,{...e.options,env:r})}case"PipedCommand":return Jh(KI(e.left,t),KI(e.right,t),e.options)}}),JI=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),up=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},QI=e=>`fd${e}`,ZI=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=c3(e,t,r,o,n);return r},c3=(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}=f3(n,s),f=MN(r,c,a);if(o===t.length)return f;let u=t[o],l=Array.isArray(u)?u.map(p=>$N(p)):[$N(u)];return MN(f,l,i)},$N=e=>typeof e==="string"?e:String(e),NN=new Set([" "," ","\r",`
32
- `]),u3={x:3,u:5},f3=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let r=NN.has(t[0]),n=[],o=0;for(let a=0,i=0;a<e.length;a+=1,i+=1){let c=t[i];if(NN.has(c))o!==a&&n.push(e.slice(o,a)),o=a+1;else if(c==="\\"){let f=t[i+1];if(f===`
33
- `)a-=1,i+=1;else if(f==="u"&&t[i+2]==="{"){let u=t.indexOf("}",i+3);parseInt(t.slice(i+3,u),16)>65535&&(a+=1),i=u}else i+=u3[f]??1}}let s=o===e.length;return s||n.push(e.slice(o)),{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},MN=(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 Zh from"node:child_process";import{PassThrough as YI}from"node:stream";var DN=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var Be=(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 Jr({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var Eu=e=>Tb(bb(l3(e),t=>[t])),l3=e=>dr(t=>{let r=e.evaluate();return y(p3({...e,writable:r,pull:t}))}),p3=e=>e.pull.pipe(B(t=>{let r=0;return sr(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(xe)};return s(),le(()=>{o=!0,e.writable.off("drain",s)})})}),To({disableYield:!0}),e.endOnDone!==!1?Ir(t=>"closed"in e.writable&&e.writable.closed?Rt(t):sr(r=>{let n=()=>r(Rt(t));return e.writable.once("finish",n),e.writable.end(),le(()=>{e.writable.off("finish",n)})})):F,Xa(sr(t=>{let r=n=>t(C(e.onError(n)));return e.writable.once("error",r),le(()=>{e.writable.off("error",r)})})));var bu=e=>dn(m3(e)),m3=e=>dr((t,r)=>h3({scope:r,readable:e.evaluate(),onError:e.onError??g3,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var h3=e=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??iF(void 0),o=e.latch??oF(!1);function s(){o.openUnsafe()}function a(f){n.current=An(e.onError(f)),o.openUnsafe()}function i(){n.current=An(Mm()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=Ie(function f(){let u=e.readable.read(e.chunkSize);if(u===null)return n.current?n.current:t.readableEnded?C(Mm()):(o.closeUnsafe(),B(o.await,f));let l=Da(u);for(;u=e.readable.read(e.chunkSize),u!==null;)l.push(u);return y(l)});return kr(cl(e.scope,le(()=>{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 g3=e=>new XO(e);var gi=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),No=(e,t,r)=>{let{commands:n}=HN(r),o=n.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Be("ChildProcess",e)(t,[o])},LN=1e3,y3=10,BN=e=>{let t=()=>{};e.on("error",t),e.once("close",()=>e.off("error",t))},jN=(e,t)=>{if(!hE(t))return!0;if(globalThis.process.platform==="win32")return!1;try{return globalThis.process.kill(-e.pid,0),!0}catch{return!1}},zN=(e,t=()=>{})=>{if(e.exitCode!==null||e.signalCode!==null){t(null);return}Zh.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t)},S3=Dt(function*(){let e=yield*Fn,t=yield*Oo,r=L(function*(m){if(!Fs(m.cwd))return yield*e.access(m.cwd),t.resolve(m.cwd)}),n=m=>m.extendEnv?{...globalThis.process.env,...m.env}:m.env,o=m=>si(m)?"pipe":m,s=m=>Dl(m)?"pipe":m,a=m=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};return Fs(m.stdin)?S:typeof m.stdin=="string"?{...S,stream:m.stdin}:si(m.stdin)?{...S,stream:m.stdin}:{stream:m.stdin.stream,encoding:m.stdin.encoding??S.encoding,endOnDone:m.stdin.endOnDone??S.endOnDone}},i=(m,S)=>{let E=m[S];return Fs(E)?{stream:"pipe"}:typeof E=="string"?{stream:E}:Dl(E)?{stream:E}:{stream:E.stream}},c=m=>{if(Fs(m.additionalFds))return[];let S=[];for(let[E,I]of Object.entries(m.additionalFds)){let k=up(E);pt(k)&&S.push({fd:k,config:I})}return S.sort((E,I)=>E.fd-I.fd)},f=(m,S,E,I)=>{let k=[o(m.stream),s(S.stream),s(E.stream)];if(I.length===0)return k;let _=I.reduce((M,{fd:z})=>Math.max(M,z),2);for(let M=3;M<=_;M++)k[M]="ignore";for(let{fd:M}of I)k[M]="pipe";return k},u=L(function*(m,S,E){if(E.length===0)return{getInputFd:()=>Ll,getOutputFd:()=>Yc};let I=new Map,k=new Map;for(let{config:_,fd:M}of E){let z=S.stdio[M];switch(_.type){case"input":{let de=Ll;z&&"write"in z&&(BN(z),de=Eu({evaluate:()=>z,onError:oe=>No(`fromWritable(fd${M})`,gi(oe),m)})),_.stream&&(yield*Hc(Ob(_.stream,de))),I.set(M,de);break}case"output":{let de=Yc;if(z&&"read"in z){let oe=new YI;z.on("error",be=>oe.destroy(be)),z.pipe(oe),de=bu({evaluate:()=>oe,onError:be=>No(`fromReadable(fd${M})`,gi(be),m)})}_.sink&&(de=Eh(de,_.sink)),k.set(M,de);break}}}return{getInputFd:_=>I.get(_)??Ll,getOutputFd:_=>k.get(_)??Yc}}),l=(m,S,E)=>Ie(()=>{let I=Ll;return df(S.stdin)&&(BN(S.stdin),I=Eu({evaluate:()=>S.stdin,onError:k=>No("fromWritable(stdin)",gi(k),m),endOnDone:E.endOnDone,encoding:E.encoding})),si(E.stream)?kr(Hc(Ob(E.stream,I)),I):y(I)}),p=(m,S,E,I)=>{let k=S.stdout?(()=>{let z=new YI;return S.stdout.on("error",de=>z.destroy(de)),S.stdout.pipe(z),bu({evaluate:()=>z,onError:de=>No("fromReadable(stdout)",gi(de),m)})})():Yc,_=S.stderr?(()=>{let z=new YI;return S.stderr.on("error",de=>z.destroy(de)),S.stderr.pipe(z),bu({evaluate:()=>z,onError:de=>No("fromReadable(stderr)",gi(de),m)})})():Yc;Dl(E.stream)&&(k=Eh(k,E.stream)),Dl(I.stream)&&(_=Eh(_,I.stream));let M=eR(k,_);return{stdout:k,stderr:_,all:M}},h=(m,S)=>sr(E=>{let I=Dm(),k=Zh.spawn(m.command,m.args,S);return k.on("error",_=>{E(C(No("spawn",_,m)))}),k.on("exit",(..._)=>{Lm(I,ts(_))}),k.on("spawn",()=>{E(y([k,I]))}),le(()=>{k.kill("SIGTERM")})}),g=(m,S,E)=>globalThis.process.platform==="win32"?sr(I=>{zN(S,k=>{I(k?C(No("kill",gi(k),m)):xe)})}):ht({try:()=>{globalThis.process.kill(-S.pid,E)},catch:I=>No("kill",gi(I),m)}),x=(m,S)=>{if(globalThis.process.platform==="win32"){zN(m);return}try{globalThis.process.kill(-m.pid,S)}catch{}},b=(m,S,E)=>Ie(()=>{if(!S.kill(E)){let k=new globalThis.Error("Failed to kill child process");return C(No("kill",k,m))}return xe}),T=(m,S,E)=>sr(I=>{let k=Date.now()+E,_,M=()=>{clearTimeout(_),m.removeListener("exit",z)},z=()=>{if(clearTimeout(_),Date.now()>=k||!jN(m,S)){M(),I(xe);return}_=setTimeout(z,y3)};return m.on("exit",z),z(),le(M)}),w=L(function*(m,S,E,I){let k=_=>g(m,S,_).pipe(_n(()=>b(m,S,_)));yield*k(I?.killSignal??"SIGTERM"),Fs(I?.forceKillAfter)?yield*T(S,E,LN):(yield*T(S,E,Ko(I.forceKillAfter)),jN(S,E)&&(yield*k("SIGKILL"),yield*T(S,E,LN))),yield*vc(E)}),P=(m,S)=>{let E=S??"stdout";switch(E){case"stdout":return m.stdout;case"stderr":return m.stderr;case"all":return m.all;default:{let I=up(E);return pt(I)?m.getOutputFd(I):m.stdout}}},O=L(function*(m){switch(m._tag){case"StandardCommand":{let S=a(m.options),E=i(m.options,"stdout"),I=i(m.options,"stderr"),k=c(m.options),_=!0,M=yield*r(m.options),z=n(m.options),de=f(S,E,I,k),[oe,be]=yield*ln(h(m,DN(m.options,{cwd:M,env:z,stdio:de},process.platform)),L(function*([Ur,Ia]){if(yield*mE(Ia)){let[Tw]=yield*vc(Ia);Tw!==0&&df(Tw)?yield*Lc(w(m,Ur,Ia,m.options)):_&&process.platform!=="win32"&&m.options.detached!==!1&&(yield*Lc(w(m,Ur,Ia,m.options)));return}_&&(yield*Lc(w(m,Ur,Ia,m.options)))})),Le=qI(oe.pid);oe.on("exit",Ur=>{Ur!==0&&df(Ur)&&x(oe,m.options.killSignal??"SIGTERM")});let lt=le(()=>{_||(oe.ref(),_=!0)}),Et=le(()=>(_&&(oe.unref(),_=!1),lt)),Tr=yield*l(m,oe,S),{all:nn,stderr:Bo,stdout:cf}=p(m,oe,E,I),{getInputFd:oj,getOutputFd:sj}=yield*u(m,oe,k),aj=ne(mE(be),Ur=>!Ur),ij=B(vc(be),([Ur,Ia])=>{if(df(Ur))return y(zI(Ur));let Cw=new globalThis.Error(`Process interrupted due to receipt of signal: '${Ia}'`);return C(No("exitCode",Cw,m))});return Gh({pid:Le,exitCode:ij,isRunning:aj,kill:Ur=>w(m,oe,be,Ur),stdin:Tr,stdout:cf,stderr:Bo,all:nn,getInputFd:oj,getOutputFd:sj,unref:Et})}case"PipedCommand":{let{commands:S,pipeOptions:E}=HN(m),[I,...k]=S,_=[yield*O(I)];for(let oe=0;oe<k.length;oe++){let be=k[oe],Le=E[oe]??{},lt=a(be.options),Et=ea(y(P(_[_.length-1],Le.from))),Tr=Le.to??"stdin";if(Tr==="stdin")_.push(yield*O(cp(be.command,be.args,{...be.options,stdin:{...lt,stream:Et}})));else{let nn=up(Tr);if(pt(nn)){let Bo=QI(nn),cf=be.options.additionalFds??{};_.push(yield*O(cp(be.command,be.args,{...be.options,additionalFds:{...cf,[Bo]:{type:"input",stream:Et}}})))}else _.push(yield*O(cp(be.command,be.args,{...be.options,stdin:{...lt,stream:Et}})))}}let M=_[_.length-1],z=oe=>Qa([..._].reverse(),be=>Lc(be.kill(oe)),{discard:!0}),de=Dt(function*(){let oe=[];for(let be of _)oe.push(yield*be.unref);return Qa([...oe].reverse(),be=>be,{discard:!0})});return Gh({pid:M.pid,exitCode:M.exitCode,isRunning:M.isRunning,kill:z,stdin:_[0].stdin,stdout:M.stdout,stderr:M.stderr,all:M.all,getInputFd:M.getInputFd,getOutputFd:M.getOutputFd,unref:de})}}});return HI(O)}),qN=_c(aa,S3),HN=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 WN="0123456789ABCDEFGHJKMNPQRSTVWXYZ",VN=(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+=WN[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+=WN[o>>>s&31];o&=(1<<s)-1}return n};var b3=e=>e.toString(16).padStart(2,"0"),XI=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,b3).join("")).join("-"),GN=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function KN(e=GN()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var I3=2**48-1;function JN(e,t=GN()){let r=Math.min(Math.max(0,Math.trunc(e)),I3);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 ZN="~effect/Crypto",e0=Ye("effect/Crypto"),QN=e=>{let t=e.randomBytes,r=a=>ne(T3("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 e0.of({[ZN]:ZN,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:le(()=>o()),randomBoolean:le(()=>o()>.5),randomInt:le(()=>s()),randomBetween:(a,i)=>le(()=>U_(a,i,o())),randomIntBetween(a,i,c){let f=c?.halfOpen===!0?0:1;return le(()=>{let u=Math.ceil(a),l=Math.floor(i);return Math.floor(o()*(l-u+f))+u})},randomShuffle:a=>le(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let f=Math.min(c,Math.floor(o()*(c+1))),u=i[c];i[c]=i[f],i[f]=u}return i}),randomUUIDv4:a=>le(()=>{let i=KN(t(16));return a?.format==="bytes"?i:XI(i)}),randomUUIDv7:a=>Vc(i=>{let c=JN(i.currentTimeMillisUnsafe(),t(16));return y(a?.format==="bytes"?c:XI(c))}),randomULID:Vc(a=>y(VN(a.currentTimeMillisUnsafe(),t(10))))})},T3=(e,t)=>Number.isSafeInteger(t)&&t>=0?y(t):C(pn({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as Qh from"node:crypto";var w3=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},k3=(e,t)=>ht({try:()=>Uint8Array.from(Qh.createHash(w3(e)).update(t).digest()),catch:r=>Jr({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),A3=QN({randomBytes:Qh.randomBytes,digest:k3}),XN=Eo(e0,A3);var eM=XN;import*as nM from"node:crypto";import*as K from"node:fs";import*as oM from"node:os";import*as ms from"node:path";var ze=e=>t=>pn({module:"FileSystem",method:e,description:t.message??String(t)}),t0=(e,t)=>{let r=Number(e);if(!Number.isSafeInteger(r))throw new RangeError(`${t} exceeds the safe integer range: ${e}`);return r},Iu=e=>Nd($a(e),fh),tM=(e,t)=>ht({try:()=>t0(e,"position"),catch:ze(t)}),_3=(()=>{let e=et(K.access,Be("FileSystem","access"),ze("access"));return(t,r)=>{let n=K.constants.F_OK;return r?.readable&&(n|=K.constants.R_OK),r?.writable&&(n|=K.constants.W_OK),e(t,n)}})(),P3=(()=>{let e=et(K.cp,Be("FileSystem","copy"),ze("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),F3=(()=>{let e=et(K.copyFile,Be("FileSystem","copyFile"),ze("copyFile"));return(t,r)=>e(t,r)})(),R3=(()=>{let e=et(K.chmod,Be("FileSystem","chmod"),ze("chmod"));return(t,r)=>e(t,r)})(),$3=(()=>{let e=et(K.chown,Be("FileSystem","chown"),ze("chown"));return(t,r,n)=>e(t,r,n)})(),N3=(()=>{let e=et(K.glob,Be("FileSystem","glob"),ze("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),M3=(()=>{let e=et(K.link,Be("FileSystem","link"),ze("link"));return(t,r)=>e(t,r)})(),U3=(()=>{let e=et(K.mkdir,Be("FileSystem","makeDirectory"),ze("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),r0=e=>{let t=et(K.mkdtemp,Be("FileSystem",e),ze(e));return r=>Ie(()=>{let n=r?.prefix??"",o=typeof r?.directory=="string"?ms.join(r.directory,"."):oM.tmpdir();return t(n?ms.join(o,n):o+"/")})},D3=r0("makeTempDirectory"),n0=e=>{let t=et(K.rm,Be("FileSystem",e),ze(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},L3=n0("remove"),B3=(()=>{let e=r0("makeTempDirectoryScoped"),t=n0("makeTempDirectoryScoped");return r=>ln(e(r),n=>os(t(n,{recursive:!0})))})(),j3=e=>{let{O_APPEND:t,O_CREAT:r,O_EXCL:n,O_RDONLY:o,O_RDWR:s,O_TRUNC:a,O_WRONLY:i}=K.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}},z3=(e,t)=>Ie(()=>{let{O_NOFOLLOW:r}=K.constants;return process.platform==="win32"||typeof r!="number"||r===0?C(pn({module:"FileSystem",method:e,description:"noFollow is not supported on this platform"})):y(j3(t)|r)}),q3=e=>{let t=et(K.open,Be("FileSystem",e),ze(e)),r=et(K.close,Be("FileSystem",e),ze(e));return(n,o)=>Zn(ln(o?.noFollow===!0?B(z3(e,o.flag??"r"),s=>t(n,s,o.mode)):t(n,o?.flag??"r",o?.mode),s=>os(r(s))),ne(s=>W3(s,o?.flag?.startsWith("a")??!1)))},H3=q3("open"),rM=e=>pn({module:"FileSystem",method:e,description:"Cannot read before the start of the file"}),W3=(()=>{let e=u=>et(K.read,Be("FileSystem",u),ze(u)),t=e("read"),r=e("readAlloc"),n=et(K.fstat,Be("FileSystem","stat"),ze("stat")),o=et(K.ftruncate,Be("FileSystem","truncate"),ze("truncate")),s=et(K.fsync,Be("FileSystem","sync"),ze("sync")),a=u=>et(K.write,Be("FileSystem",u),ze(u)),i=a("write"),c=a("writeAll");class f{[eu];fd;append;position=BigInt(0);constructor(l,p){this[eu]=eu,this.fd=l,this.append=p}get stat(){return B(n(this.fd,{bigint:!0}),aM)}get sync(){return s(this.fd)}seek(l,p){return Ie(()=>{let h=p==="start"?l:this.position+l;return h<BigInt(0)?C(pn({module:"FileSystem",method:"seek",description:"Cannot seek before the start of the file"})):(this.position=h,y(h))})}read(l,p){return Ie(()=>{let h=p?.position;if(h!==void 0)return h<BigInt(0)?C(rM("read")):t(this.fd,{buffer:l,position:h});let g=this.position;return ne(t(this.fd,{buffer:l,position:g}),x=>(this.position=g+BigInt(x),x))})}readAlloc(l,p){return Ie(()=>{try{if(!Number.isInteger(l)||l<0)throw new RangeError("size must be a non-negative integer");let h=p?.position;if(h!==void 0&&h<BigInt(0))return C(rM("readAlloc"));let g=Buffer.allocUnsafeSlow(l),x=h??this.position;return ne(r(this.fd,{buffer:g,position:x}),b=>{if(b===0)return v();if(h===void 0&&(this.position=x+BigInt(b)),b===l)return R(g);let T=Buffer.allocUnsafeSlow(b);return g.copy(T,0,0,b),R(T)})}catch(h){return C(ze("readAlloc")(h))}})}truncate(l){return ne(o(this.fd,l||void 0),()=>{if(!this.append){let p=BigInt(l??0);this.position>p&&(this.position=p)}})}write(l){return Ie(()=>{let p=this.position;return B(this.append?y(void 0):tM(p,"write"),h=>ne(i(this.fd,l,void 0,void 0,h),g=>(this.append||(this.position=p+BigInt(g)),g)))})}writeAllChunk(l){return Ie(()=>{let p=this.position;return B(this.append?y(void 0):tM(p,"writeAll"),h=>B(c(this.fd,l,void 0,void 0,h),g=>g===0?C(Jr({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=p+BigInt(g)),g<l.length?this.writeAllChunk(l.subarray(g)):xe)))})}writeAll(l){return l.length===0?xe:this.writeAllChunk(l)}}return(u,l)=>new f(u,l)})(),sM=e=>{let t=r0(e);return L(function*(r){let n=yield*t(r),o=nM.randomBytes(6).toString("hex"),s=ms.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*iM(s,new Uint8Array(0)),s})},V3=sM("makeTempFile"),G3=(()=>{let e=sM("makeTempFileScoped"),t=n0("makeTempFileScoped");return r=>ln(e(r),n=>os(t(ms.dirname(n),{recursive:!0})))})(),K3=(e,t)=>Uc({try:()=>K.promises.readdir(e,t),catch:r=>Be("FileSystem","readDirectory")(r,[e])}),J3=e=>sr((t,r)=>{try{K.readFile(e,{signal:r},(n,o)=>{t(n?C(Be("FileSystem","readFile")(n,[e])):y(o))})}catch(n){t(C(ze("readFile")(n)))}}),Z3=(()=>{let e=et(K.readlink,Be("FileSystem","readLink"),ze("readLink"));return t=>e(t)})(),Q3=(()=>{let e=et(K.realpath,Be("FileSystem","realPath"),ze("realPath"));return t=>e(t)})(),Y3=(()=>{let e=et(K.rename,Be("FileSystem","rename"),ze("rename"));return(t,r)=>e(t,r)})(),aM=e=>ht({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:$a(e.mtime),atime:$a(e.atime),birthtime:$a(e.birthtime),dev:t0(e.dev,"dev"),rdev:Iu(e.rdev),ino:Iu(e.ino),mode:t0(e.mode,"mode"),nlink:Iu(e.nlink),uid:Iu(e.uid),gid:Iu(e.gid),size:_l(e.size),blksize:e.blksize!==void 0?R(_l(e.blksize)):v(),blocks:Iu(e.blocks)}),catch:ze("stat")}),o0=(()=>{let e=et(K.stat,Be("FileSystem","stat"),ze("stat"));return t=>B(e(t,{bigint:!0}),aM)})(),X3=(()=>{let e=et(K.symlink,Be("FileSystem","symlink"),ze("symlink"));return(t,r)=>e(t,r)})(),e6=(()=>{let e=et(K.truncate,Be("FileSystem","truncate"),ze("truncate"));return(t,r)=>e(t,r)})(),t6=(()=>{let e=et(K.utimes,Be("FileSystem","utime"),ze("utime"));return(t,r,n)=>e(t,r,n)})(),r6=(e,t,r)=>YF(n=>ln(le(()=>{let o=t.type==="Directory"?e:ms.dirname(e),s=K.watch(e,{recursive:r?.recursive??!1},(a,i)=>{if(i)switch(a){case"rename":{wo(QE(o0(ms.resolve(o,i)),{onSuccess:c=>Rl(n,{_tag:"Create",path:i}),onFailure:c=>Rl(n,{_tag:"Remove",path:i})}));return}case"change":{oi(n,{_tag:"Update",path:i});return}}});return s.on("error",a=>{$l(n,ZO(Jr({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:a})))}),s.on("close",()=>{is(n)}),s}),o=>le(()=>o.close()))),n6=(e,t,r)=>o0(t).pipe(ne(n=>e.pipe(Nd(o=>o.register(t,n,r)),bt(()=>r6(t,n,r)))),ea),iM=(e,t,r)=>sr((n,o)=>{try{K.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},s=>{n(s?C(Be("FileSystem","writeFile")(s,[e])):xe)})}catch(s){n(C(ze("writeFile")(s)))}}),o6=ne(sh(jl),e=>_b({access:_3,chmod:R3,chown:$3,copy:P3,copyFile:F3,glob:N3,link:M3,makeDirectory:U3,makeTempDirectory:D3,makeTempDirectoryScoped:B3,makeTempFile:V3,makeTempFileScoped:G3,open:H3,readDirectory:K3,readFile:J3,readLink:Z3,realPath:Q3,remove:L3,rename:Y3,stat:o0,symlink:X3,truncate:e6,utimes:t6,watch(t,r){return n6(e,t,r)},writeFile:iM})),cM=_c(Fn)(o6);var uM=cM;import*as fp from"node:path";import*as Yh from"node:url";var s0=e=>({fromFileUrl:t=>ht({try:()=>Yh.fileURLToPath(t,{windows:e}),catch:r=>new vo({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:t=>ht({try:()=>Yh.pathToFileURL(t,{windows:e}),catch:r=>new vo({module:"Path",method:"toFileUrl",cause:r})})}),i6=Eo(Oo)({[fs]:fs,...fp.posix,...s0(!1)}),c6=Eo(Oo)({[fs]:fs,...fp.win32,...s0(!0)}),fM=Eo(Oo)({[fs]:fs,...fp,...s0(void 0)});var lM=fM;var a0="~effect/Stdio",Xh=Ye(a0),pM=e=>({[a0]:a0,stdinIsTerminal:y(!1),stdoutIsTerminal:y(!1),stderrIsTerminal:y(!1),...e});var dM=Eo(Xh,pM({args:le(()=>process.argv.slice(2)),stdinIsTerminal:le(()=>process.stdin.isTTY===!0),stdoutIsTerminal:le(()=>process.stdout.isTTY===!0),stderrIsTerminal:le(()=>process.stderr.isTTY===!0),stdout:e=>Eu({evaluate:()=>process.stdout,onError:t=>Jr({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>Eu({evaluate:()=>process.stderr,onError:t=>Jr({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:bu({evaluate:()=>process.stdin,onError:e=>Jr({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var mM=dM;var Ee={};En(Ee,{Any:()=>qZ,Array:()=>Ce,ArrayEnsure:()=>e5,BigDecimal:()=>WD,BigDecimalFromString:()=>F8,BigInt:()=>ju,BigIntFromString:()=>x8,Boolean:()=>Vg,BooleanFromBit:()=>T8,BooleanLiterals:()=>ZC,ByteSize:()=>tx,ByteSizeFromBigInt:()=>$8,ByteSizeFromNumber:()=>N8,ByteSizeFromString:()=>R8,Cause:()=>HC,CauseReason:()=>qC,Char:()=>n8,Chunk:()=>M8,Class:()=>L2,Cookie:()=>N2,Cookies:()=>M2,Date:()=>Hu,DateFromMillis:()=>f8,DateFromString:()=>u8,DateTimeUtc:()=>rx,DateTimeUtcFromDate:()=>z8,DateTimeUtcFromMillis:()=>H8,DateTimeUtcFromString:()=>q8,DateTimeZoned:()=>c2,DateTimeZonedFromString:()=>K8,Defect:()=>oT,DnsARecord:()=>C2,DnsAaaaRecord:()=>T2,DnsCaaRecord:()=>w2,DnsCnameRecord:()=>k2,DnsMxRecord:()=>A2,DnsNaptrRecord:()=>v2,DnsNsRecord:()=>O2,DnsPtrRecord:()=>_2,DnsRecord:()=>HQ,DnsRecordType:()=>qQ,DnsSoaRecord:()=>P2,DnsSrvRecord:()=>F2,DnsTlsaRecord:()=>R2,DnsTxtRecord:()=>$2,DomainName:()=>Ts,DomainNameFromString:()=>y2,Duration:()=>Gp,DurationFromMillis:()=>zQ,DurationFromNanos:()=>jQ,DurationFromString:()=>BQ,Enum:()=>jZ,Error:()=>ox,ErrorInstance:()=>o8,Exit:()=>WQ,FalseLiterals:()=>Yg,File:()=>UD,Finite:()=>qu,FiniteFromString:()=>g8,FormData:()=>DD,Graph:()=>JQ,HashMap:()=>ZQ,HashSet:()=>QQ,Headers:()=>rY,Host:()=>FQ,HostFromString:()=>RQ,HostPort:()=>E2,HostPortFromString:()=>$Q,InetAddress:()=>g2,InetAddressFromString:()=>OQ,InetAddressV4:()=>AQ,InetAddressV6:()=>vQ,Int:()=>Rr,IpAddress:()=>ga,IpAddressFromString:()=>Ri,IpInterface:()=>p2,IpInterfaceFromString:()=>CQ,IpLinkLocalAddress:()=>uQ,IpLinkLocalAddressFromString:()=>fQ,IpLoopbackAddress:()=>iQ,IpLoopbackAddressFromString:()=>cQ,IpMulticastAddress:()=>J8,IpMulticastAddressFromString:()=>Z8,IpNetwork:()=>h2,IpNetworkFromString:()=>kQ,IpUnicastAddress:()=>X8,IpUnicastAddressFromString:()=>eQ,IpUnspecifiedAddress:()=>lQ,IpUnspecifiedAddressFromString:()=>pQ,Ipv4Address:()=>Vp,Ipv4AddressFromString:()=>iT,Ipv4BroadcastAddress:()=>nQ,Ipv4BroadcastAddressFromString:()=>oQ,Ipv4Interface:()=>f2,Ipv4InterfaceFromString:()=>bQ,Ipv4Network:()=>d2,Ipv4NetworkFromString:()=>TQ,Ipv4PrivateAddress:()=>dQ,Ipv4PrivateAddressFromString:()=>mQ,Ipv6Address:()=>nx,Ipv6AddressFromString:()=>u2,Ipv6Interface:()=>l2,Ipv6InterfaceFromString:()=>IQ,Ipv6Network:()=>m2,Ipv6NetworkFromString:()=>wQ,Ipv6UniqueLocalAddress:()=>hQ,Ipv6UniqueLocalAddressFromString:()=>gQ,Json:()=>sx,JsonFromUrlParamsField:()=>nY,JsonObject:()=>_Y,Literal:()=>Ct,Literals:()=>Cs,MacAddress:()=>Fi,MacAddressFromString:()=>Wu,MacBroadcastAddress:()=>sQ,MacBroadcastAddressFromString:()=>aQ,MacLocallyAdministeredAddress:()=>xQ,MacLocallyAdministeredAddressFromString:()=>yQ,MacMulticastAddress:()=>Q8,MacMulticastAddressFromString:()=>Y8,MacUnicastAddress:()=>tQ,MacUnicastAddressFromString:()=>rQ,MacUniversallyAdministeredAddress:()=>SQ,MacUniversallyAdministeredAddressFromString:()=>EQ,MutableJson:()=>FY,Natural:()=>vi,Never:()=>zZ,NonEmptyArray:()=>Kg,NonEmptyString:()=>nT,Null:()=>Wg,NullOr:()=>JC,NullishOr:()=>pD,Number:()=>Lp,NumberFromString:()=>h8,ObjectKeyword:()=>VZ,Opaque:()=>d5,Option:()=>$i,OptionFromNullOr:()=>YQ,OptionFromNullishOr:()=>eY,OptionFromOptional:()=>aY,OptionFromOptionalKey:()=>sY,OptionFromOptionalNullOr:()=>iY,OptionFromUndefinedOr:()=>XQ,Port:()=>NQ,PropertyKey:()=>zC,ReadonlyMap:()=>s8,ReadonlySet:()=>a8,Record:()=>_i,RecordFromCookies:()=>tY,RecordFromUrlParams:()=>oY,Redacted:()=>U2,RedactedFromValue:()=>cY,RegExp:()=>i8,Result:()=>uY,SchemaError:()=>Oi,ScopedIpv6Literal:()=>cT,ScopedIpv6LiteralFromString:()=>S2,SocketAddress:()=>PQ,StandardSchemaV1FailureResult:()=>C8,String:()=>$,StringForLiteralAutocomplete:()=>HZ,StringFromBase64:()=>S8,StringFromBase64Url:()=>E8,StringFromHex:()=>b8,StringFromUriComponent:()=>I8,Struct:()=>_e,StructWithRest:()=>YZ,Symbol:()=>uD,TaggedClass:()=>dY,TaggedError:()=>Vn,TaggedStruct:()=>Bp,TaggedUnion:()=>p5,TemplateLiteral:()=>LZ,TemplateLiteralParser:()=>BZ,TimeZone:()=>a2,TimeZoneFromString:()=>G8,TimeZoneNamed:()=>o2,TimeZoneNamedFromString:()=>V8,TimeZoneOffset:()=>W8,Tree:()=>OY,Trim:()=>y8,Trimmed:()=>BD,TrueLiterals:()=>Qg,Tuple:()=>Mo,TupleWithRest:()=>XZ,URL:()=>ND,URLFromString:()=>c8,URLSearchParams:()=>LD,Uint8Array:()=>ex,Uint8ArrayFromBase64:()=>w8,Uint8ArrayFromBase64Url:()=>k8,Uint8ArrayFromHex:()=>zD,Undefined:()=>GC,UndefinedOr:()=>Jg,Union:()=>Ze,UniqueArray:()=>t5,UniqueSymbol:()=>GZ,UnixPathAddress:()=>x2,UnixPathAddressFromString:()=>_Q,Unknown:()=>Dp,UnknownFromJsonString:()=>p8,UrlParams:()=>uT,Void:()=>WZ,annotate:()=>dZ,annotateEncoded:()=>mZ,annotateKey:()=>hZ,asserts:()=>SZ,brand:()=>Zg,catchDecoding:()=>s5,catchDecodingWithContext:()=>xD,catchEncoding:()=>a5,catchEncodingWithContext:()=>yD,check:()=>n5,declare:()=>Me,declareConstructor:()=>Pr,decode:()=>i5,decodeEffect:()=>EZ,decodeExit:()=>bZ,decodeOption:()=>CZ,decodePromise:()=>wZ,decodeResult:()=>TZ,decodeSync:()=>kZ,decodeTo:()=>J,decodeUnknownEffect:()=>bs,decodeUnknownExit:()=>eD,decodeUnknownOption:()=>IZ,decodeUnknownPromise:()=>rD,decodeUnknownResult:()=>tD,decodeUnknownSync:()=>nD,encode:()=>c5,encodeEffect:()=>AZ,encodeExit:()=>vZ,encodeKeys:()=>ZZ,encodeOption:()=>_Z,encodePromise:()=>FZ,encodeResult:()=>PZ,encodeSync:()=>RZ,encodeTo:()=>QC,encodeUnknownEffect:()=>qg,encodeUnknownExit:()=>oD,encodeUnknownOption:()=>OZ,encodeUnknownPromise:()=>aD,encodeUnknownResult:()=>sD,encodeUnknownSync:()=>iD,extendTo:()=>QZ,fieldsAssign:()=>KZ,flip:()=>jC,fromBrand:()=>o5,fromFormData:()=>d8,fromJsonString:()=>sT,fromURLSearchParams:()=>m8,instanceOf:()=>ma,is:()=>zg,isBase64:()=>TD,isBase64Url:()=>I5,isBetween:()=>ha,isBetweenBigDecimal:()=>P8,isBetweenBigInt:()=>V5,isBetweenCodePoints:()=>J5,isBetweenDate:()=>z5,isBetweenLength:()=>eT,isBetweenProperties:()=>t8,isBetweenSize:()=>Y5,isCapitalized:()=>v5,isEndingWith:()=>T5,isFinite:()=>_5,isGUID:()=>E5,isGreaterThan:()=>F5,isGreaterThanBigDecimal:()=>A8,isGreaterThanBigInt:()=>q5,isGreaterThanDate:()=>D5,isGreaterThanOrEqualTo:()=>wD,isGreaterThanOrEqualToBigDecimal:()=>v8,isGreaterThanOrEqualToBigInt:()=>kD,isGreaterThanOrEqualToDate:()=>L5,isIncluding:()=>w5,isInt:()=>Xg,isInt32:()=>M5,isLessThan:()=>R5,isLessThanBigDecimal:()=>O8,isLessThanBigInt:()=>H5,isLessThanDate:()=>B5,isLessThanOrEqualTo:()=>$5,isLessThanOrEqualToBigDecimal:()=>_8,isLessThanOrEqualToBigInt:()=>W5,isLessThanOrEqualToDate:()=>j5,isLowercased:()=>A5,isMaxCodePoints:()=>K5,isMaxLength:()=>_D,isMaxProperties:()=>e8,isMaxSize:()=>Q5,isMinCodePoints:()=>G5,isMinLength:()=>AD,isMinProperties:()=>X5,isMinSize:()=>Z5,isMultipleOf:()=>N5,isNonEmpty:()=>OD,isPattern:()=>Pi,isPropertyNames:()=>r8,isSchema:()=>Hg,isSchemaError:()=>JU,isStartingWith:()=>C5,isStringBigInt:()=>g5,isStringFinite:()=>h5,isStringSymbol:()=>x5,isTrimmed:()=>CD,isULID:()=>b5,isUUID:()=>S5,isUint32:()=>U5,isUncapitalized:()=>O5,isUnique:()=>rT,isUniqueKey:()=>PD,isUppercased:()=>k5,link:()=>Te,linkDecoding:()=>zu,make:()=>V,makeFilter:()=>ke,makeFilterGroup:()=>m5,makeIsBetween:()=>Wp,makeIsGreaterThan:()=>jp,makeIsGreaterThanOrEqualTo:()=>zp,makeIsLessThan:()=>qp,makeIsLessThanOrEqualTo:()=>Hp,makeIsMultipleOf:()=>P5,middlewareDecoding:()=>hD,middlewareEncoding:()=>gD,mutable:()=>r5,mutableKey:()=>MZ,optional:()=>Is,optionalKey:()=>Ss,overrideToCodecIso:()=>AY,overrideToEquivalence:()=>gY,overrideToFormatter:()=>mY,readonlyKey:()=>UZ,refine:()=>mD,required:()=>NZ,requiredKey:()=>$Z,resolveAnnotations:()=>RY,resolveAnnotationsKey:()=>$Y,revealBottom:()=>pZ,revealCodec:()=>gZ,suspend:()=>dD,tag:()=>Es,tagDefaultOmit:()=>l5,toCodecArrayFromSingle:()=>IY,toCodecIso:()=>bY,toCodecJson:()=>EY,toCodecStringTree:()=>lT,toDifferJsonPatch:()=>vY,toEncoded:()=>Bu,toEncoderXml:()=>CY,toEquivalence:()=>xY,toFormatter:()=>hY,toIso:()=>TY,toIsoFocus:()=>kY,toIsoSource:()=>wY,toJsonSchemaDocument:()=>SY,toRepresentation:()=>yY,toStandardJSONSchemaV1:()=>yZ,toStandardSchemaV1:()=>xZ,toTaggedUnion:()=>ID,toType:()=>Fr,withArrayLengthConstraints:()=>Gg,withConstructorDefault:()=>SD,withDecodingDefault:()=>bD,withDecodingDefaultKey:()=>YC,withDecodingDefaultType:()=>f5,withDecodingDefaultTypeKey:()=>u5});var tg="~effect/HashMap",Ln=5,pp=1<<Ln,d6=pp/4,hM=pp/2,m6=pp-1,h6=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),lp=(e,t)=>e>>>t&m6,ia=(e,t)=>1<<lp(e,t),eg=(e,t)=>h6(e&t-1);function gM(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=ia(r,t),i=ia(o,t);if(a===i){let u=gM(e,t+Ln,r,n,o,s);return new Si(e,a,[u])}let c=a|i,f=a>>>0<i>>>0?[n,s]:[s,n];return new Si(e,c,f)}var g6=Ae("HashMap"),xM=(e,t)=>ie(q(e),q(t)),yM=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},xi=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=wa;t=this.computeHash(),r===wa&&(this._hash=t)}return t}},c0=class extends xi{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return v()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new yi(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},yi=class e extends xi{_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&&W(this.key,n)?R(this.value):v()}has(t,r,n){return this.hash===r&&W(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&W(this.key,o))return W(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 u0(t,n,[[this.key,this.value],[o,s]]);let i=ia(n,r),c=ia(this.hash,r);if(i===c)return new Si(t,i,[this.set(t,r+Ln,n,o,s,a)]);let f=i|c,u=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new Si(t,f,u)}remove(t,r,n,o,s){if(this.hash===n&&W(this.key,o)){s.value=!0;return}return this}computeHash(){return xM(this.key,this.value)}},u0=class e extends xi{_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 v();for(let[o,s]of this.entries)if(W(o,n))return R(s);return v()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(W(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,gM(t,r,this.hash,this,n,new yi(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(W(this.entries[i][0],o)){if(W(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])=>W(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 yi(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^=xM(r[n][0],r[n][1]);return t}},Si=class e extends xi{_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=ia(r,t);if((this.bitmap&o)===0)return v();let s=eg(this.bitmap,o);return this.children[s].get(t+Ln,r,n)}has(t,r,n){let o=ia(r,t);if((this.bitmap&o)===0)return!1;let s=eg(this.bitmap,o);return this.children[s].has(t+Ln,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=ia(n,r),c=eg(this.bitmap,i);if((this.bitmap&i)!==0){let f=this.children[c],u=f.set(t,r+Ln,n,o,s,a);if(f===u)return this;if(this.canEdit(t))return this.children[c]=u,this;let l=[...this.children];return l[c]=u,new e(t,this.bitmap,l)}else{a.value=!0;let f=new yi(t,n,o,s),u=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,f),this.bitmap=u,this._size=void 0,this.children.length>hM?this.expand(t,u,this.children):this;let l=[...this.children];return l.splice(c,0,f),l.length>hM?this.expand(t,u,l):new e(t,u,l)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=ia(n,r);if((this.bitmap&a)===0)return this;let i=eg(this.bitmap,a),c=this.children[i],f=c.remove(t,r+Ln,n,o,s);if(!s.value)return this;if(f===void 0){let l=this.bitmap^a;if(l===0)return;if(this.children.length===2){let h=this.children[i===0?1:0];if(h._tag==="LeafNode")return h}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let p=[...this.children];return p.splice(i,1),new e(t,l,p)}if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.bitmap,u)}expand(t,r,n){let o=new globalThis.Array(pp),s=0;for(let a=0;a<pp;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new f0(t,n.length,o)}computeHash(){return yM(this.children)}},f0=class e extends xi{_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=lp(r,t),s=this.children[o];return s?s.get(t+Ln,r,n):v()}has(t,r,n){let o=lp(r,t),s=this.children[o];return s?s.has(t+Ln,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=lp(n,r),c=this.children[i];if(c){let f=c.set(t,r+Ln,n,o,s,a);if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.count,u)}else{a.value=!0;let f=new yi(t,n,o,s);if(this.canEdit(t))return this.children[i]=f,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=f,new e(t,this.count+1,u)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=lp(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+Ln,n,o,s);if(!s.value)return this;let f=this.count-(c?0:1);if(f<d6)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=f),this._size=void 0,this;let u=[...this.children];return u[a]=c,new e(t,f,u)}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 Si(t,s,o)}computeHash(){return yM(this.children)}},rg=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}},x6=(e,t)=>[e,t];var dp=class{[tg]=tg;_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 rg(this._root,x6)}[X](t){if(l0(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Zn(t,bM(n));if(Ke(s)||!W(o,s.value))return!1}return!0}return!1}[Y](){return Bt(g6^this._root.subtreeHash())}[qe](){return Ot(this)}toString(){return`HashMap(${N(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[Ot(t),Ot(r)])}}pipe(){return re(this,arguments)}},SM=new c0,l0=e=>A(e,tg),p0=()=>new dp(!1,0,SM,0);var EM=e=>{let t=SM,r=0,n={value:!1};for(let[o,s]of e){let a=q(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new dp(!1,0,t,r)};var bM=d(2,(e,t)=>e._root.get(0,q(t),t));var d0=d(2,(e,t)=>e._root.has(0,q(t),t));var y6=(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 dp(!1,o._edit,i,o._size+(s.value?1:0))},m0=d(3,(e,t,r)=>y6(e,t,q(t),r)),h0=e=>new rg(e._root,F);var IM=e=>e[Symbol.iterator](),ng=e=>e.size;var TM=l0;var g0=EM;var b6=IM,mp=e=>Array.from(b6(e)),wM=ng;var hp="~effect/HashSet",I6=Ae(hp),C6={[Y](){return Bt(ie(I6,q(og(this))))},[X](e){return y0(e)&&sg(this)===sg(e)&&vM(this,t=>AM(e,t))},[Symbol.iterator](){return h0(og(this))},toString(){return`HashSet(${N(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:Ot(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},T6=e=>{let t=Object.create(C6);return t[hp]=hp,t.keyMap=e,t},y0=e=>A(e,hp),og=e=>e.keyMap;var kM=e=>{let t=p0();for(let r of e)t=m0(t,r,!0);return T6(t)},AM=(e,t)=>d0(og(e),t);var sg=e=>ng(og(e));var vM=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var S0=kM,OM=y0;var _M=sg;var b0="~effect/http/Cookies",FM=e=>A(e,b0),I0="~effect/http/Cookies/Cookie",RM=e=>A(e,I0),PM="~effect/http/Cookies/CookieError",C0=class extends Nf{},Ei=class e extends cn("CookiesError"){static fromReason(t,r){return new e({reason:new C0({_tag:t,cause:r})})}[PM]=PM;get message(){return this.reason._tag}};var k6={[b0]:b0,...mt,toJSON(){return{_id:"effect/Cookies",cookies:Bd(this.cookies,e=>e.toJSON())}},pipe(){return re(this,arguments)}},w0=e=>{let t=Object.create(k6);return t.cookies=e,t},k0=e=>{let t={};for(let r of e)U(t,r.name,r);return w0(t)},$M=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=A6(n.trim());o&&r.push(o)}return k0(r)};function A6(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(!NM.test(n))return;let o=t[0].slice(r+1),s=R6(o);if(t.length===1)return Object.assign(Object.create(T0),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],f=c.indexOf("="),u=f===-1?c:c.slice(0,f).trim(),l=f===-1?void 0:c.slice(f+1).trim();switch(u.toLowerCase()){case"domain":{if(l===void 0)break;let p=l.trim().replace(/^\./,"");p&&(a.domain=p);break}case"expires":{if(l===void 0)break;let p=new Date(l);isNaN(p.getTime())||(a.expires=p);break}case"max-age":{if(l===void 0)break;let p=parseInt(l,10);isNaN(p)||(a.maxAge=Rf(p));break}case"path":{if(l===void 0)break;l[0]==="/"&&(a.path=l);break}case"priority":{if(l===void 0)break;switch(l.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(l===void 0)break;switch(l.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(T0),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var v6=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,NM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,O6=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,_6=/^[\u0020-\u003a\u003c-\u007e]+$/,T0={[I0]:I0,...mt,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function P6(e,t,r){let n=encodeURIComponent(t),o=MM(e,n,r);return o!==void 0?Z(o):H(Object.assign(Object.create(T0),{name:e,value:t,valueEncoded:n,options:r}))}function MM(e,t,r){if(!NM.test(e))return Ei.fromReason("InvalidCookieName");if(t&&!v6.test(t))return Ei.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!O6.test(r.domain))return Ei.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!_6.test(r.path))return Ei.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!mc(Ut(r.maxAge)))return Ei.fromReason("CookieInfinityMaxAge")}var UM=(e,t,r)=>Ms(P6(e,t,r));function F6(e){let t=MM(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=fo(Ut(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 DM=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];U(t,o.name,o.value)}return t},LM=e=>Object.values(e.cookies).map(F6);var R6=e=>{try{return decodeURIComponent(e)}catch{return e}};var bi=new WeakMap,BM=e=>{if(bi.has(e))return bi.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var jM="~effect/Redacted",A0=e=>A(e,jM),Bn=(e,t)=>{let r=Object.create(M6);return t?.label&&(r.label=t.label),bi.set(r,e),r},M6={[jM]:{_A:e=>e},label:void 0,...er,toJSON(){return this.toString()},toString(){return`<redacted${In(this.label)?":"+this.label:""}>`},[Y](){return q(bi.get(this))},[X](e){return A0(e)&&W(bi.get(this),bi.get(e))}},ca=BM;var zM=e=>yr((t,r)=>e(ca(t),ca(r)));var v0=Symbol.for("~effect/http/Headers"),qM=e=>A(e,v0),O0=Object.defineProperties(Object.create(null),{[v0]:{value:v0},[Aa]:{value(e){return D6(this,ct(e,L6))}},toJSON:{value(){return zo(this)}},[X]:{value(e){return _0(this,e)}},[Y]:{value(){return gf(this)}},toString:{value:mt.toString},[qe]:{value:mt[qe]}});var _0=Fk(Ra()),U6=Object.create(O0),HM=e=>{if(e===void 0)return U6;if(Symbol.iterator in e){let r=Object.create(O0);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(O0);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 D6=d(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=Bn(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Bn(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r});var L6=ge("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key","AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var P0="~effect/http/UrlParams",F0=e=>A(e,P0),j6={...er,[P0]:P0,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[X](e){return R0(this,e)},[Y](){return Yn(this.params.flat())}},ag=e=>{let t=Object.create(j6);return t.params=e,t},WM=e=>{if(F0(e))return e;let t=VM(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 ag(r)},VM=e=>{let t=typeof e[Symbol.iterator]=="function"?nr(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,String(o[s])]);else if(o!==null&&typeof o=="object"){let s=VM(o);for(let[a,i]of s)r.push([[n,...typeof a=="string"?[a]:a],i])}else o!==void 0&&r.push([n,String(o)]);return r},R0=yr((e,t)=>z6(e.params,t.params)),z6=Rk(Ak([Ra(),Ra()]));var GM=d(2,(e,t)=>Pf(e.params,([r])=>r===t).pipe(sc(([,r])=>r)));var q6=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))U(t,r,n);else{let o=t[r];typeof o=="string"?U(t,r,[o,n]):o.push(n)}return t},KM=q6;var $0="~effect/Graph",N0=e=>A(e,$0),JM=e=>e;var W6=(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)&&W(t.data,r.data),V6=(e,t)=>e==="directed"?q(t):Bt(ie(q(t.data),G6(t.source,t.target))),G6=(e,t)=>ie(0,q(e))+ie(0,q(t)),K6=Ae("Graph"),J6={[$0]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[qe](){return this.toJSON()},[X](e){if(A(e,$0)){let t=JM(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)||!W(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!W6(this.type,n,o))return!1}return!0}return!1},[Y](){let e=K6;e=e^Ae(this.type),e=e^dt(this.nodes.size),e=e^dt(this.edges.size);for(let[t,r]of this.nodes)e^=ie(q(t),q(r));for(let[t,r]of this.edges)e^=ie(q(t),V6(this.type,r));return Bt(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 re(this,arguments)}},Z6=(e,t)=>{let r=Object.create(J6);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=R(!0),r};var gp=e=>{let t=JM(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)}},ig=e=>{let t=Z6(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=v(),t};var cg=(e,t,r)=>e===je?r(t):$t(e,r);function QM(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===je?e.decode(Gt(Hl(n)),o):e.decode(ti(r,Hl),o);return ZM(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===je?Gt(n):r;case"Transform":{let r=n=>n===me?vr:Gt(t.transform(n));return(n,o)=>cg(n,o,r)}case"TransformOptional":{let r=n=>Nb(t.transform(Hl(n)));return(n,o)=>cg(n,o,r)}case"TransformEffect":return(r,n,o)=>cg(r,n,s=>s===me?vr:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>cg(r,n,s=>ZM(t.transform(Hl(s),o)))}}var ZM=e=>$t(e,Nb),YM=(e,t,r,n)=>Cr(n,o=>Ks(()=>Vs(o,s=>new lR(e,s,t,r))));function Y6(e,t){let r=QM(e.link.transformation),n;return(o,s)=>{if(o===me)return vr;if(e.isConstructed(o))return je;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function X6(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==me&&n!==void 0)return t(n,o);let s=r;if($e(s)&&s._tag==="Success"){let a=t(s[fe],o);return a===je?s:a}return $t(YM(e,n,o,s),a=>{let i=t(a,o);return i===je?Gt(a):i})}}function M0(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:X6(e,r)}function xp(e,t,r,n,o){if(e._tag==="Declaration")for(let g of e.typeParameters)t(g);let s=r?AN(e):void 0,a=s?Y6(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,f=c?.map(g=>QM(g.transformation)),u=e.encodingChecks;if(!c&&!i&&!u)return a;let l,p=(g,x)=>{let b=a(g,x);if(u&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[fe];if(g!==me&&T!==me){let w=Dn(u,g,void 0,e,x);w&&(b=C(new vt(e,w,g,x)))}}}else b=B(b,T=>{if(g!==me&&T!==me){let w=Dn(u,g,void 0,e,x);if(w)return C(new vt(e,w,g,x))}return y(T)});if(i&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[fe];if(T===me)return b;let w=Dn(i,T,void 0,e,x);w&&(b=C(new vt(e,w,T,x)))}}else b=B(b,T=>{if(T!==me){let w=Dn(i,T,void 0,e,x);if(w)return C(new vt(e,w,T,x))}return y(T)});return b},h=o===void 0?p:o(p);return c?(g,x)=>{let b=l??=c.map(P=>t(P.to)),T=g,w=b[b.length-1](g,x);for(let P=c.length-1;P>=0;P--)if(w=f[P](w,T,x),P!==0){let O=b[P-1];w._tag==="Success"?(T=w[fe],w=O(T,x)):w=$t(w,m=>{let S=O(m,x);return S===je?Gt(m):S})}if(w._tag==="Success"){let P=w[fe],O=h(P,x);return O===je?w:O}return w=YM(e,g,x,w),$t(w,P=>{let O=h(P,x);return O===je?Gt(P):O})}:h}var lg=Symbol(),XM=new WeakMap,e1,Tu=!1;var tK=e=>Tu?fg(tn,e,"parser"):tn(e).parser,t1=e=>Tu?fg(tn,e,"makeEffect"):tn(e).makeEffect,rK=e=>M0(e,t1),ug=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=xp(this.ast,tK)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=xp(this.ast,t1,rK)}},U0=class extends ug{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")??xp(this.ast,t=>fg(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",nK(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>fg(this.resolve,n,"makeEffect");return this.save("makeEffect",xp(this.ast,r,n=>M0(n,r)))}};function nK(e,t){let r;return(n,o)=>{if(n!==me)try{let s=e(n,o);if(s!==lg)return s===n?je:Gt(s)}catch(s){return ar(s)}return(r??=t())(n,o)}}function fg(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 tn(e){let t=XM.get(e);if(t!==void 0)return t;let r=e1===void 0?new ug(e):new U0(e,e1(e,tn),tn);return XM.set(e,r),r}function L0(e){let t=e.ast,r;return(n,o)=>(r??=V0(pK,It(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function dg(e){let t=L0(e);return(r,n)=>{let o=ko(t(r,n));return ut(o)?R(o.value):(Qr(o.cause,"Option adapter can only return none for schema issues"),v())}}function mg(e){return fK(It(e.ast))}function B0(e){return yp(e.ast)}function sK(e){if(!Tu){let o=wu(xg(e));return s=>{let a=o(s,Ro);return ut(a)?!0:(Qr(a.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=tn(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,Ro)}catch(s){return Qr(nl(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=ko(W0(n(o,Ro),o));return ut(s)?!0:(Qr(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function yp(e){let t=It(e),r=n=>(r=sK(t),r(n));return n=>r(n)}function r1(e){let t=xg(e);return(r,n)=>{let o=ko(t(r,n));if(!ut(o))return Qr(o.cause,"Issue adapter can only return schema issues")}}function n1(e,t){let r=It(e.ast),n=tn(r).parser(t,Ro),o=ko(W0(n,t));if(sl(o)){let s=Qr(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function St(e,t){let r=xg(e.ast);return t===void 0?r:(n,o)=>r(n,H0(t,o))}var j0=St;function o1(e,t){return wu(St(e,t))}function z0(e,t){return l1(St(e,t))}var s1=z0;function a1(e,t){return p1(St(e,t))}function aK(e,t){return Tu?d1(e.ast,t):G0(St(e,t))}var hg=aK;function Ii(e,t){let r=xg(en(e.ast));return t===void 0?r:(n,o)=>r(n,H0(t,o))}var i1=Ii;function c1(e,t){return wu(Ii(e,t))}function q0(e,t){return l1(Ii(e,t))}var u1=q0;function f1(e,t){return p1(Ii(e,t))}function iK(e,t){return Tu?d1(en(e.ast),t):G0(Ii(e,t))}var gg=iK,H0=(e,t)=>t?{...e,...t}:e,pg=e=>e===me?C(new ue):y(e);function xg(e){return V0(lK,e)}function W0(e,t){return e===je?y(t):$e(e)?e[fe]===me?pg(me):e:$t(e,pg)}function V0(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Ro);return s===je?y(n):$e(s)?s[fe]===me?pg(me):s:$t(s,pg)}}function wu(e){return(t,r)=>ko(e(t,r))}function l1(e){let t=wu(e);return(r,n)=>{let o=t(r,n);return ut(o)?R(o.value):(Qr(o.cause,"Option adapter can only return none for schema issues"),v())}}function p1(e){let t=wu(e);return(r,n)=>{let o=t(r,n);return ut(o)?H(o.value):Z(Qr(o.cause,"Result adapter can only return schema issues"))}}function d1(e,t){let r;return(n,o)=>(r??=cK(tn(e),t))(n,o)}function cK(e,t){let r=e.decode,n,o=r===void 0?(s,a=Ro)=>(n??=D0(e))(s,a):(s,a=Ro)=>{if(s===me)return(n??=D0(e))(s,a);let i;try{i=r(s,a)}catch(c){throw Qr(nl(c),"Sync adapter can only throw schema issues"),c}return i!==lg?i:(n??=D0(e))(s,a)};return t===void 0?o:(s,a)=>o(s,H0(t,a))}function D0(e){return G0(V0(()=>e.decodeEffect,e.ast))}function G0(e){let t=wu(e);return(r,n)=>{let o=t(r,n);if(ut(o))return o.value;let s=Qr(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function uK(e,t){let r=ko(e);if(ut(r))return r.value;let n=Qr(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function fK(e){let t,r;return(n,o)=>{t??=tn(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??Ro,a=t.make;if(a!==void 0&&n!==me){let c;try{c=a(n,s)}catch(f){throw Qr(nl(f),"Constructor adapter can only throw schema issues"),f}if(c!==lg&&c!==me)return c}let i=(r??=t.makeEffect)(n,s);return uK(W0(i,n),"Constructor adapter can only throw schema issues")}}var lK=e=>tn(e).parser,pK=e=>tn(e).makeEffect;var yg="~effect/Schema/Schema",m1=Symbol(),dK={[yg]:yg,get make(){let e=mg(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=L0(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=dg(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return re(this,arguments)},annotate(e){return this.rebuild(Nn(this.ast,e))},annotateKey(e){return this.rebuild(ip(this.ast,e))},check(...e){return this.rebuild($o(this.ast,e))},rebuild(e){return jn(e,this[m1])}};function jn(e,t){function r(){}let n=Object.setPrototypeOf(r,dK);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[m1]=t,n.ast=e,n}function K0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Sp(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function J0(e){return encodeURI(K0(e)).replace(/#/g,"%23")}function Z0(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 g1(e){let t=Z0(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Sp)}function x1(e){return e.reduce((t,r)=>`${t}/${J0(r)}`,"#")}var hK="http://json-schema.org/draft-07/schema#",y1="https://json-schema.org/draft/2020-12/schema";function S1(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function I1(e){return{dialect:"draft-07",...EK(e,_K)}}function gK(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Lr(n))return n;let a=o||!s&&w1(n.$id),i={};for(let c of Object.keys(n)){let f=n[c],u=f;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":u=Y0(f,l=>r(l,a))??f;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":u=Array.isArray(f)?f.map(l=>r(l,a)):f;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":u=r(f,a)}U(i,c,u)}return t(i,a),i}}function C1(e,t){return gK(e,r=>{xK(r,t)})}function xK(e,t){typeof e.$ref=="string"&&U(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&U(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function Y0(e,t){if(!Lr(e))return;let r={};for(let n of Object.keys(e))U(r,n,t(e[n],n));return r}function yK(e,t,r){let n=new Map,o=[],s=Q0;function a(p,h=[],g=[]){if(h.length===0&&t?.trackIds){let x=Lr(p)?u(p):void 0;s=E1(x,Q0)??Q0}return f(p,h,g,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[p,h,g]of o){let x=h,b=T1(h,g);if(b!==void 0){let T=g1(b.hash);if(b.hash="",T!==void 0){let w=n.get(b1(b.href,T));w!==void 0&&(x=SK(h,w))}}U(p,"$ref",x)}}let c=r(a);return i(),c;function f(p,h,g,x){if(typeof p=="boolean")return l(h,g,x),t?.booleanAdapter?.(p)??p;if(!Lr(p))return p;let b=x,T=u(p);if(h.length>0&&t?.trackIds&&w1(T)){let O=E1(T,x.uri);O!==void 0&&(b={parent:x,sourceRoot:h,targetRoot:g,uri:O})}l(h,g,b);let w=b.uri,P={isDocumentRoot:h.length===0,schema(O,m,S=m){return f(O,[...h,m],[...g,S],b)},schemaAt(O,m,S){return f(O,[...h,...m],[...g,...S],b)},schemaArray(O,m,S=m){return Array.isArray(O)?O.map((E,I)=>f(E,[...h,m,String(I)],[...g,S,String(I)],b)):O},schemaMap(O,m,S=m){return Lr(O)?Y0(O,(E,I)=>f(E,[...h,m,I],[...g,S,I],b)):O},reference(O,m){typeof m=="string"?o.push([O,m,w]):U(O,"$ref",m)}};return e(p,P)}function u(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function l(p,h,g){g.parent!==void 0&&l(p,h,g.parent),n.set(b1(g.uri,p.slice(g.sourceRoot.length)),h.slice(g.targetRoot.length))}}var Q0="https://effect.invalid/.json-schema/";function T1(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function E1(e,t){if(typeof e!="string")return;let r=T1(e,t);if(r!==void 0)return r.hash="",r.href}function SK(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${x1(t)}`}function b1(e,t){return`${e}\0${JSON.stringify(t)}`}function w1(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function EK(e,t,r){return yK(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:Y0(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var bK=new Set(["properties","patternProperties"]),IK=new Set(["allOf","anyOf","oneOf"]),CK=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function TK(e,t,r,n,o,s=bK){let a;if(s.has(t))a=n.schemaMap(r,t);else if(IK.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return U(e,t,a),!0}var k1=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],Ele=[...k1,"deprecated"],ble=[...k1,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],wK=/^[A-Za-z_][-A-Za-z0-9._]*$/,kK=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Ci(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function AK(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&Ci(o,r,`it is not active in ${n} but would become active in the target`)}var vK=["additionalItems","definitions","dependencies"];function OK(e,t,r,n,o){r.isDocumentRoot?U(e,"$schema",S1(t,y1)?n:t):S1(t,y1)||Ci("$schema",o,"an embedded resource cannot declare a different dialect")}function _K(e,t){AK(e,vK,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!TK(r,a,i,t,CK))switch(a){case"$ref":n=i;break;case"$schema":OK(r,i,t,hK,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":U(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":Ci(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;U(r,a,i);break;default:U(r,a,i)}}if(PK(r,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&Ci("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&U(r,"minContains",a)}else Object.hasOwn(e,"minContains")&&U(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&U(r,"maxContains",e.maxContains);return RK(e,r,t,"draft-07"),NK(e,r,"$id","Draft-07"),FK(r,n,t),r}function PK(e,t,r,n){if(t===void 0){r!==void 0&&U(e,"items",n.schema(r,"items"));return}U(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&U(e,"additionalItems",n.schema(r,"items","additionalItems"))}function FK(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),$K(e,n)}else r.reference(e,t)}function RK(e,t,r,n){let o=Lr(e.dependentRequired)?e.dependentRequired:void 0,s=Lr(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 f=o?.[c],u=s?.[c],l=n==="draft-04"&&Array.isArray(f)&&f.length===0;u===void 0?l||U(a,c,f):f===void 0||l?U(a,c,r.schemaAt(u,["dependentSchemas",c],["dependencies",c])):U(a,c,{allOf:[r.schemaAt(u,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:f}]})}Object.keys(a).length>0&&U(t,"dependencies",a)}function $K(e,t){Array.isArray(e.allOf)?e.allOf.push(t):U(e,"allOf",[t])}function NK(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&U(t,r,o);return}(typeof s!="string"||!wK.test(s))&&Ci("$anchor",n,"the anchor is not valid"),kK.test(s)||Ci("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?U(t,r,`#${s}`):Ci("$anchor",n,"it cannot be combined with the schema $id")}function Sg(e){return jn(ku(e.ast),{schema:e})}var ku=pi(e=>{let t=UK(e,ku),r=e.context;return t===e||r===void 0?t:Hh(t,X0(r))});function X0(e){return e.constructorDefault===void 0?e:new Fo(e.isOptional,e.isMutable,void 0,e.annotations)}function O1(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function _1(e){return t=>{let r=[...t].sort((o,s)=>e(Mn(o))-e(Mn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var MK=_1(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function UK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Cn(r))return Je(e,[LI]);let n=e.typeParameters.map(s=>jn(Mn(s))),o=r(n);return o===void 0?e:Je(e,[gu(o,t)])}case"Unknown":return Je(e,[LI]);case"ObjectKeyword":return Je(e,[_N]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return O1(e),e.recur(t,Vh);case"Union":{let r=MK(e.types);return r!==e.types?new _r(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 Eg(e){return jn(P1(It(e.ast)))}var P1=bn(e=>{let t=DK(e,P1);return t!==e&&e.context!==void 0?Hh(t,X0(e.context)):t});function DK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Cn(r)){let n=r(e.typeParameters.map(o=>jn(o)));return Je(e,[gu(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function bg(e){return jn(N1(e.ast),{schema:e})}function F1(e){return jn(M1(e.ast))}var LK=_1(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function BK(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(f=>jn(t(Mn(f)))),o=e.annotations?.toCodecStringTree;if(Cn(o)){let f=o(n);return f===void 0?e:Je(e,[gu(f,t)])}let s=e.annotations?.toCodecJson,a=Cn(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(Cn(i)?i(n):void 0);return c===void 0?r(e):Je(e,[gu(c,t)])}case"Null":return Je(e,[jK]);case"Boolean":return Je(e,[zK]);case"Unknown":case"ObjectKeyword":return Je(e,[BI]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return O1(e),e.recur(t,Vh);case"Union":{let n=LK(e.types);return n!==e.types?new _r(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 jK=new ft(new Xr("null"),new Ne(pe(()=>null),pe(()=>"null"))),zK=new ft(new _r([new Xr("true"),new Xr("false")]),new Ne(pe(e=>e==="true"),ci())),R1=new Ne(pe(e=>typeof e=="string"?[e]:e),Po()),$1=e=>e.transformation===R1,N1=pi(e=>{let t=BK(e,N1,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?Hh(t,X0(e.context)):t},{stopAt:$1}),v1=e=>Kt(e)?di(ds):ds,M1=pi(e=>{let t=qK(e);if(gI(t)){let r=xu(new _r([new mn(t.isMutable,t.elements.map(v1),t.rest.map(v1)),Yr],{mode:"anyOf"}),t,R1);return Kt(e)?di(r):r}return t},{stopAt:$1});function qK(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(M1):e}var Cle=globalThis.RegExp;var gs=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function ua(e,t){return t.length>0&&(e+=`
34
- at ${Id(t)}`),new Error(e)}function U1(e){return`#/$defs/${J0(e)}`}var HK=new Set([...uR,ai,...cR]);function bp(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;yu(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&yu(i)&&(r.examples=i);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let f=e.writeOnly;typeof f=="boolean"&&(r.writeOnly=f);let u=e.format;typeof u=="string"&&(r.format=u);let l=e.contentEncoding;typeof l=="string"&&(r.contentEncoding=l);let p=e.contentMediaType;typeof p=="string"&&(r.contentMediaType=p);let h=e.contentSchema;if(yu(h)&&(r.contentSchema=h),t?.includeAnnotationKey!==void 0)for(let[g,x]of Object.entries(e))HK.has(g)||!t.includeAnnotationKey(g)||yu(x)&&U(r,g,x);return Object.keys(r).length===0?void 0:r}function D1(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=D1(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 WK(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 L1="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function Ig(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function VK(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var GK="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",KK="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function JK(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(GK.includes(`|${o}|`))n[o]=Math.max(s,a);else if(KK.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 rC="|title|description|default|examples|readOnly|writeOnly|",ZK=L1+rC;function Ip(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=WK(e);if(o!==void 0||s){let i=D1(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",f={...e,type:c};s&&delete f.anyOf;let u=Object.keys(i.schema);return u.length===0?f:Ig(i.schema,rC)&&VK(f,u)?{...f,...i.schema}:Ip(f,i.schema,r)}}if(r){let i=JK(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 tC(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>tC(r,t)))}function QK(e){return Array.isArray(e)}function YK(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,f=Object.keys(r);for(let m of f)g(m,["references",m]);let u=Ft(e,(m,S)=>w(m,t[S],[]));for(let[m,S]of i.values())if(!tC(m))for(let E of S)Array.isArray(E.oneOf)&&(E.anyOf=E.oneOf,delete E.oneOf);for(let m of f){let S=r[m],E=b(S);if(E===void 0)continue;let I=o.get(m)[0],k=c.get(E),_=k?.find(M=>W(o.get(M)[0],I));_===void 0?k===void 0?c.set(E,[m]):k.push(m):s.set(m,_)}let l=Ft(u,x),p={};for(let m of f)s.has(m)||U(p,m,x(o.get(m)[0]));return{dialect:"draft-2020-12",schemas:l,definitions:p};function h(m){return Array.isArray(m.oneOf)&&i.get(m.oneOf)?.[1].push(m),m}function g(m,S){if(!Object.hasOwn(r,m))throw ua(`Invalid reference ${m}`,[...S,"$ref"]);let E=o.get(m);if(E!==void 0)return E;let I=[{},[]];return o.set(m,I),I[0]=w(r[m],["references",m],I[1]),I}function x(m){return C1(m,S=>{let E=Z0(S);if(E===void 0){if(/^#(?:\/|%2f)/i.test(S))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(S)}`);return S}if(!E.startsWith("/$defs/"))return S;let I=E.indexOf("/",7),k=s.get(Sp(E.slice(7,I<0?void 0:I)));return k===void 0?S:S.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,U1(k))})}function b(m){if(m._tag==="Reference")return;let S=m.checks.length===0?m.annotations:m.checks[m.checks.length-1].annotations;return typeof S?.identifier!="string"&&typeof S?.[ai]=="string"?S[ai]:void 0}function T(m,S,E,I){let k=m.annotations,_=k?.toJsonSchema;if(_!==void 0){let oe=m.representation?.schemas?.map((Bo,cf)=>w(Bo,[...E,"representation","schemas",cf],I))??[],be=_({type:S,schemas:oe}),Le=QK(be);Le&&I.push(!1);let lt=Le?be[0]:be,Et=bp(k,n),Tr=Et===void 0?lt:{...lt,...Et},nn=Et===void 0?L1:ZK;return[Tr,m._tag==="Filter"&&Ig(Tr,nn)&&(Et===void 0||Ig(Et,rC))?!0:void 0]}if(m._tag==="Filter"){I.push(!1);return}let M=m.checks.flatMap((oe,be)=>{let Le=T(oe,S,[...E,"checks",be],I);return Le===void 0?[]:[Le[0]]});if(M.length===0)return;let z=bp(k,n),de={allOf:M};return[z===void 0?de:{...de,...z}]}function w(m,S,E){if(m._tag==="Reference")return E.push(g(m.$ref,S)[1]),{$ref:U1(m.$ref)};let I=a.get(m);if(I!==void 0)return E.push(I[1]),I[0];let k=[];E.push(k);let _=P(m,S,k),M=bp(m.annotations,n);M!==void 0&&(_={..._,...M});for(let z=0;z<m.checks.length;z++){let de=typeof _.type=="string"&&XK(_.type)?_.type:void 0,oe=T(m.checks[z],de,[...S,"checks",z],k);oe!==void 0&&(_=Ip(_,...oe))}return a.set(m,[_,k]),h(_)}function P(m,S,E){switch(m._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(m.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(m.symbol)]};case"Declaration":return E.push(!1),{};case"Suspend":return w(m.thunk,[...S,"thunk"],E);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 I=m.literal;return typeof I=="bigint"?{type:"string",enum:[globalThis.String(I)]}:{type:typeof I,enum:[I]}}case"Enum":{let I=m.enums.map(([k,_],M)=>{if(typeof _=="number"&&!globalThis.Number.isFinite(_))throw ua(`Invalid numeric enum value ${globalThis.String(_)}`,[...S,"enums",M,1]);return{type:typeof _,enum:[_],title:k}});return I.length===0?{not:{}}:{anyOf:I}}case"TemplateLiteral":return{type:"string",pattern:`^${m.parts.map(Cg).join("")}$`};case"Arrays":{if(m.rest.length>1)throw ua("Invalid schema representation document",[...S,"rest"]);let I={type:"array"},k=m.elements.length,_=m.elements.map((M,z)=>{M.isOptional&&k--;let de=w(M.type,[...S,"elements",z,"type"],E),oe=bp(M.annotations,n);return oe===void 0?de:h(Ip(de,oe))});if(_.length>0?(I.prefixItems=_,I.maxItems=m.elements.length,k>0&&(I.minItems=k)):I.items=!1,m.rest.length===1){delete I.maxItems;let M=w(m.rest[0],[...S,"rest",0],E);Object.keys(M).length>0?I.items=M:delete I.items}return I}case"Objects":{if(m.propertySignatures.length===0&&m.indexSignatures.length===0)return{not:{type:"null"}};let I={type:"object"},k={},_=[];for(let Le=0;Le<m.propertySignatures.length;Le++){let lt=m.propertySignatures[Le];if(typeof lt.name!="string")throw ua("Invalid schema representation document",[...S,"propertySignatures",Le,"name"]);let Et=lt.name,Tr=w(lt.type,[...S,"propertySignatures",Le,"type"],E),nn=bp(lt.annotations,n);U(k,Et,nn===void 0?Tr:h(Ip(Tr,nn))),lt.isOptional||_.push(Et)}m.propertySignatures.length>0&&(I.properties=k),_.length>0&&(I.required=_);let M={},z=[],de=[],oe=!1;for(let Le=0;Le<m.indexSignatures.length;Le++){let lt=m.indexSignatures[Le],Et=w(lt.type,[...S,"indexSignatures",Le,"type"],E);W(Et,{not:{}})&&(Et=!1),de.push(Et);let Tr=O(lt.parameter,[...S,"indexSignatures",Le,"parameter"],new Set);if(Tr===void 0){oe=!0,E.push(!1);continue}if(Tr.length===0)z.push(Et);else for(let nn of Tr){let Bo=M[nn];U(M,nn,Bo===void 0?Et:Bo===!1||Et===!1?!1:h(Ip(Bo,Et)))}}let be=Object.keys(M).length>0;if(be&&(I.patternProperties=M),oe&&n?.onExcessProperty==="error"){let Le=[];m.propertySignatures.length>0&&Le.push({enum:Object.keys(k)});for(let lt=0;lt<m.indexSignatures.length;lt++)Le.push(w(m.indexSignatures[lt].parameter,[...S,"indexSignatures",lt,"parameter"],E));I.propertyNames=Le.length===1?Le[0]:{anyOf:Le},I.additionalProperties=de.length===1?de[0]:{anyOf:de},z.length>0&&(I.allOf=z.map(lt=>({type:"object",additionalProperties:lt})))}else z.length===0?I.additionalProperties=oe||n?.onExcessProperty!=="error":z.length===1&&m.propertySignatures.length===0&&!be?I.additionalProperties=z[0]:z.length>0&&(I.allOf=z.map(Le=>({type:"object",additionalProperties:Le})));return typeof I.additionalProperties=="object"&&I.additionalProperties!==null&&Object.keys(I.additionalProperties).length===0&&delete I.additionalProperties,I}case"Union":{let I=[],k=m.types.map((M,z)=>w(M,[...S,"types",z],I));if(E.push(I),k.length===0)return{not:{}};let _=m.options?.mode??"anyOf";if(_==="anyOf"&&k.length>1){let M=eJ(k);if(M!==void 0)return M}return _==="oneOf"&&i.set(k,[I,[]]),{[_]:k}}}}function O(m,S,E){switch(m._tag){case"Reference":{if(!Object.hasOwn(r,m.$ref))throw ua(`Invalid reference ${m.$ref}`,[...S,"$ref"]);if(g(m.$ref,S),E.has(m.$ref))return;let I=new Set(E).add(m.$ref);return O(r[m.$ref],["references",m.$ref],I)}case"String":{if(m.checks.length===0)return[];if(m.checks.length!==1||m.checks[0]._tag!=="Filter"||m.checks[0].annotations?.toJsonSchema===void 0)return;let I=[],k=w(m,S,I);return tC(I)&&k.type==="string"&&typeof k.pattern=="string"&&Ig(k,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[k.pattern]:void 0}case"TemplateLiteral":return m.checks.length===0?[`^${m.parts.map(Cg).join("")}$`]:void 0;case"Union":{if(m.types.length===0||m.checks.length>0||m.options?.mode==="oneOf")return;let I=[];for(let k=0;k<m.types.length;k++){let _=O(m.types[k],[...S,"types",k],E);if(_===void 0)return;if(_.length===0)return[];I.push(..._)}return I}default:throw ua("Invalid schema representation document",S)}}}function XK(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function eJ(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 Cg(e){switch(e._tag){case"Literal":return gs(globalThis.String(e.literal));case"String":return CN;case"Number":return Lh;case"TemplateLiteral":return e.parts.map(Cg).join("");case"Union":return`(?:${e.types.map(Cg).join("|")})`;default:throw ua("Invalid schema representation document",[])}}function Tg(e,t){let r=YK([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var tJ=({identifier:e})=>e;function zn(e){return e===void 0?void 0:{annotations:e}}function Cp(e,t){let{references:r,representations:n}=rJ([e],t);return{representation:n[0],references:r}}function rJ(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let m of e)h(m);let i=t?.referencePolicy??tJ;for(let m of s.values())for(let S of m.values()){let E=i({ast:S.ast,occurrences:S.occurrences,identifier:S.identifier});if(E!==void 0){let I=E===S.identifier||!E.endsWith("_")?"_":"";S.reference=f(E,S,I)}else S.isRecursive&&(S.reference=f(`${S.ast._tag}_`,S,""))}return{representations:Ft(e,m=>x(m)),references:r};function f(m,S,E="_"){let I=m,k=0;for(;n.has(I);){if(n.get(I)===S)return I;I=`${m}${E}${++k}`}return n.set(I,S),I}function u(m,S,E){let I=S.fallback;return I!==void 0?Rb(m)===I?m:Nn(m,{[ai]:I}):E===S.identifier?m:Nn(m,{identifier:E})}function l(m,S){if(!Object.hasOwn(r,m)&&!o.has(m)){o.add(m);let E=b(S);o.delete(m),U(r,m,E)}return{_tag:"Reference",$ref:m}}function p(m){let S=hu(m),E=mu(S),I=tu(S),k=I===void 0?(S!==m?tu(m):void 0)??Rb(S):void 0;k!==void 0&&(I=`${k}Encoded`);let _=s.get(E);_===void 0&&(_=new Map,s.set(E,_));let M=_.get(I);return M===void 0&&(M={ast:E,identifier:I,fallback:k,occurrences:0,isRecursive:!1,reference:void 0},_.set(I,M)),M}function h(m){let S=p(m),E=S.ast;if(S.occurrences++,a.has(S)){S.isRecursive=!0;return}if(!(S.occurrences>1)){switch(a.add(S),g(E.checks),E._tag){case"Declaration":case"Arrays":case"Objects":case"Union":E.recur(I=>(h(I),I));break;case"TemplateLiteral":E.parts.forEach(h);break;case"Suspend":h(E.thunk());break}a.delete(S)}}function g(m){m?.forEach(S=>{S.annotations?.representation?.schemas?.forEach(E=>h(It(E))),S._tag==="FilterGroup"&&g(S.checks)})}function x(m){let S=p(m),E=S.ast,I=S.reference;if(I!==void 0){let k=S.identifier===void 0?E:u(E,S,I);return l(I,k)}return b(E)}function b(m){let S=T(m.checks);switch(m._tag){case"Declaration":return{_tag:"Declaration",typeParameters:m.typeParameters.map(E=>x(E)),checks:S,...P(m.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:m._tag,checks:S,...zn(m.annotations)};case"Literal":return{_tag:"Literal",literal:m.literal,checks:S,...zn(m.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:m.symbol,checks:S,...zn(m.annotations)};case"Enum":return{_tag:"Enum",enums:m.enums,checks:S,...zn(m.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:m.parts.map(E=>x(E)),checks:S,...zn(m.annotations)};case"Arrays":return{_tag:"Arrays",elements:m.elements.map(E=>{let I=hu(E),k=I.context?.annotations;return{isOptional:Kt(I),type:x(E),...zn(k)}}),rest:m.rest.map(E=>x(E)),checks:S,...zn(m.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:m.propertySignatures.map(E=>{let I=hu(E.type),k=I.context?.annotations;return{name:E.name,type:x(E.type),isOptional:Kt(I),isMutable:SN(I),...zn(k)}}),indexSignatures:m.indexSignatures.map(E=>({parameter:x(E.parameter),type:x(E.type)})),checks:S,...zn(m.annotations)};case"Union":return{_tag:"Union",types:m.types.map(E=>x(E)),...m.options===void 0?{}:{options:m.options},checks:S,...zn(m.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:x(m.thunk()),...zn(m.annotations)}}}function T(m){return m?.map(w)??[]}function w(m){switch(m._tag){case"Filter":return{_tag:"Filter",aborted:m.aborted,...O(m.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Ft(m.checks,w),...O(m.annotations)}}}function P(m){if(m===void 0)return;let{representation:S,...E}=m;return{...S===void 0?void 0:{representation:S},...Object.keys(E).length===0?void 0:{annotations:E}}}function O(m){if(m===void 0)return;let{representation:S,...E}=m,I=S===void 0?void 0:S.schemas===void 0?S:{...S,schemas:S.schemas.map(k=>x(It(k)))};return{...I===void 0?void 0:{representation:I},...Object.keys(E).length===0?void 0:{annotations:E}}}}function z1(e){return ut(e)?e.value:{issues:[{message:YO(e.cause)}]}}function H1(e,t){let r=St(e),n={errors:"all",...t?.parseOptions},o=xR(t),s=a=>{let i=new Ba("sync"),c=wo(Zs(r(a,n),{onFailure:o,onSuccess:u=>({value:u})}),{scheduler:i});c.currentDispatcher?.flush();let f=c.pollUnsafe();return f?z1(f):new Promise(u=>{c.addObserver(l=>{u(z1(l))})})};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 nJ(e){let t=Cp(ku(e));return Tg(t)}function q1(e,t){let r=nJ(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=I1(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function W1(e){let t={input(r){return q1(e.ast,r.target)},output(r){return q1(It(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 G1(e,t){let r=[];return nC(e,t,"",r),r}function nC(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++)nC(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(wg(e)&&wg(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}/${K0(i)}`,f=Object.hasOwn(e,i),u=Object.hasOwn(t,i);f&&u?nC(e[i],t[i],c,n):!f&&u?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 K1(e,t){let r=t;for(let n of e)r=aJ(r,n);return r}function wg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sJ(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(Sp)}function J1(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function aJ(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=iJ(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:J1(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,V1(s,c)}if(wg(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]:U(a,n,t.value),V1(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function iJ(e,t){let r=sJ(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=J1(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(wg(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 V1(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};U(a,s,r),r=a}}return r}function Q1(e){let t=Sg(e),r=gg(t),n=hg(t);return{empty:[],diff:(o,s)=>G1(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=K1(s,a);return Object.is(i,a)?o:n(i)}}}function Y1(e,t){let r=tu(e.ast)??$b(e.ast),n=i1(bg(e));return o=>n(o).pipe(ne(s=>uJ(s,{rootName:r,...t})))}function uJ(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 u(r,e,0),c.join(o?`
35
- `:"");function f(l,p){c.push(o?s.repeat(l)+p:p)}function u(l,p,h,g){let{attrs:x,safe:b}=Au.tagInfo(l,g);if(p===void 0)f(h,`<${b}${x}/>`);else if(typeof p=="string")f(h,`<${b}${x}>${Au.escapeText(p)}</${b}>`);else if(typeof p!="object"||p===null)f(h,`<${b}${x}>${Au.escapeText(N(p))}</${b}>`);else{if(i.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});i.add(p);try{if(globalThis.Array.isArray(p)){if(p.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of p)u(n,P,h+1);f(h,`</${b}>`);return}let T=p,w=Object.keys(T);if(a&&w.sort(),w.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of w)u(Au.parseTagName(P).safe,T[P],h+1,P);f(h,`</${b}>`)}finally{i.delete(p)}}}}var Au={escapeText(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},escapeAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},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}=Au.parseTagName(e),s=r||t&&t!==e?` data-name="${Au.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var oC=bn(e=>fa(e));function fa(e){let t=ls(e)?.toEquivalence;if(t)return t(pu(e)?e.typeParameters.map(fa):[]);switch(e._tag){case"Never":return Ra();case"Declaration":return lJ(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 W;case"Arrays":{let r=e.elements.map(fa),n=e.rest.map(fa),[o,...s]=n,a=s.length;return yr((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let f=i.length;if(f!==c.length)return!1;let u=0;for(;u<Math.min(f,e.elements.length);u++)if(!r[u](i[u],c[u]))return!1;if(n.length>0){for(;u<f-a;u++)if(!o(i[u],c[u]))return!1;for(let l=0;l<a;l++)if(!s[l](i[u+l],c[u+l]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return W;let r=e.propertySignatures.map(o=>fa(o.type)),n=e.indexSignatures.map(o=>fa(o.type));return yr((o,s)=>{if(!Lr(o)||!Lr(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,f=Object.hasOwn(o,c),u=Object.hasOwn(s,c);if(Kt(i.type)&&f!==u||f&&u&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=oa(o,i.parameter),f=oa(s,i.parameter);if(c.length!==f.length)return!1;for(let u=0;u<c.length;u++){let l=c[u];if(!Object.hasOwn(s,l)||!n[a](o[l],s[l]))return!1}}return!0})}case"Union":{let r=It(e).types,n=op(r),o=r.map((s,a)=>[yp(s),fa(e.types[a])]);return yr((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[f,u]=o[i[c]];if(f(s)&&f(a))return u(s,a)}return!1})}case"Suspend":{let r;return yr((n,o)=>(r??=oC(e.thunk()))(n,o))}}}function lJ(e){let t=e.annotations?.representation;if(t===void 0)return W;switch(t.id){case"effect/schema/Option":{let[r]=Ti(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Ti(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]=Ti(e);return eU(r,n)}case"effect/schema/Cause":{let[r,n]=Ti(e);return X1(r,n)}case"effect/schema/Exit":{let[r,n,o]=Ti(e),s=X1(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]=Ti(e);return bd(r,n)}case"effect/schema/ReadonlySet":return xf(Ti(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 W}}function Ti(e){return e.typeParameters.map(fa)}function eU(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 X1(e,t){let r=Ad(eU(e,t));return(n,o)=>r(n.reasons,o.reasons)}function rU(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 tU(e,t){let r=rU(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function nU(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=ls(a)?.toFormatter;if(typeof i=="function")return i(pu(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 N;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let i=a.annotations?.representation;if(i===void 0)return N;let c=a.typeParameters.map(n);switch(i.id){case"effect/schema/Option":{let[f]=c;return Re({onNone:()=>"none()",onSome:u=>`some(${f(u)})`})}case"effect/schema/Result":{let[f,u]=c;return Sr({onSuccess:l=>`success(${f(l)})`,onFailure:l=>`failure(${u(l)})`})}case"effect/schema/CauseReason":return rU(c[0],c[1]);case"effect/schema/Cause":return tU(c[0],c[1]);case"effect/schema/Exit":{let[f,u,l]=c,p=tU(u,l);return h=>{switch(h._tag){case"Success":return`Exit.Success(${f(h.value)})`;case"Failure":return`Exit.Failure(${p(h.cause)})`}}}case"effect/schema/ReadonlyMap":{let[f,u]=c;return l=>{let p=l.size;if(p===0)return"ReadonlyMap(0) {}";let h=globalThis.Array.from(l.entries()).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`ReadonlyMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{let[f,u]=c;return l=>{let p=wM(l);if(p===0)return"HashMap(0) {}";let h=mp(l).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`HashMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[f]=c;return u=>{let l=u.size;if(l===0)return"ReadonlySet(0) {}";let p=globalThis.Array.from(u.values()).sort().map(h=>`${f(h)}`);return`ReadonlySet(${l}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{let[f]=c;return u=>{let l=_M(u);if(l===0)return"HashSet(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`HashSet(${l}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{let[f]=c;return u=>{let l=XP(u);if(l===0)return"Chunk(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`Chunk(${l}) { ${p.join(", ")} }`}}default:return N}}case"Arrays":{let i=a.elements.map(p=>n(p)),c=a.rest.map(n),[f,...u]=c,l=u.length;return p=>{let h=[],g=0;for(;g<i.length;g++)if(p.length<g+1){if(Kt(a.elements[g]))continue}else h.push(i[g](p[g]));if(c.length>0){for(;g<p.length-l;g++)h.push(f(p[g]));for(let x=0;x<l;x++)h.push(u[x](p[g+x]))}return"["+h.join(", ")+"]"}}case"Objects":{let i=a.propertySignatures.map(f=>n(f.type)),c=a.indexSignatures.map(f=>n(f.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?N:f=>{let u=[],l=new Set;for(let p=0;p<i.length;p++){let h=a.propertySignatures[p],g=h.name;l.add(g),!(Kt(h.type)&&!Object.hasOwn(f,g))&&u.push(`${Xn(g)}: ${i[p](f[g])}`)}for(let p=0;p<c.length;p++){let h=oa(f,a.indexSignatures[p].parameter);for(let g of h)l.has(g)||(l.add(g),u.push(`${Xn(g)}: ${c[p](f[g])}`))}return u.length>0?"{ "+u.join(", ")+" }":"{}"}}case"Union":{let i=It(a).types,c=op(i),f=i.map((u,l)=>[yp(u),n(a.types[l])]);return u=>{let l=c(u,!1);for(let p=0;p<l.length;p++){let[h,g]=f[l[p]];if(h(u))return g(u)}return N(u)}}case"Suspend":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var sC=d(2,(e,t)=>cC(e,(r,n)=>sU(t,r)?[r,n]:void 0)),aC=d(2,(e,t)=>cC(e,(r,n)=>sU(t,r)?void 0:[r,n])),oU=d(2,(e,t)=>({...e,...t}));var iC=d(2,(e,t)=>cC(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var mr=e=>e;function sU(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function cC(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;U(r,s,a)}}return r}function cU(e,t){return qn(vu("Iso",e,t))}function aU(e,t){return qn(vu("Lens",e,t))}function vu(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var mJ={kind:"Iso",get:F,set:F},kg=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=Ag(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];U(s,i,Ag(s[i])),s=s[i]}return U(s,t[a],r),o}}},Tp=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=r=>kN(t,r)}};function wi(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 kg([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new Tp([...s.checks,...o.checks]):r.push(o)}return r}function hJ(e,t){return qn(vu("Optional",e,t))}var Ou=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Of(this.replaceResult(t,r),()=>r)}modify(t){return r=>Of(Pt(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return qn(wi(this.node,t.node))}key(t){return qn(wi(this.node,[new kg([t])]))}optionalKey(t){return qn(wi(this.node,vu("Lens",r=>r[t],(r,n)=>{let o=Ag(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&uc(t))?o.splice(Number(t),1):delete o[t]:U(o,t,r),o})))}check(...t){return qn(wi(this.node,[new Tp(t)]))}refine(t,r){return qn(wi(this.node,[new Tp([qh(t,r)])]))}tag(t){let r=Z(new ue({expected:`${JSON.stringify(t)} tag`}));return qn(wi(this.node,vu("Prism",n=>n._tag===t?H(n):r,F)))}at(t,...r){let n=Z(new At([t],new na(void 0)));return qn(wi(this.node,vu("Optional",o=>Object.hasOwn(o,t)?H(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=Ag(s);return U(a,t,o),H(a)}else return n})))}pick(t){return this.compose(aU(sC(t),(r,n)=>({...aC(n,t),...r})))}omit(t){return this.compose(aU(aC(t),(r,n)=>({...sC(n,t),...r})))}notUndefined(){return this.refine(pt,{expected:"a value other than `undefined`"})}forEach(t){let r=t(vg());return hJ(n=>Mt(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);wt(i)&&s.push(i.success)}return s}),(n,o)=>Pt(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)wt(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return Z(new ue({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let f=a[c],u=r.replaceResult(n[c],s[f]);if(Se(u))return Z(new At([f],u.failure));i[f]=u.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Of(Pt(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},fC=class extends Ou{get;set;constructor(t,r,n){super(t,o=>H(r(o)),o=>H(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)))}},lC=class extends Ou{get;constructor(t,r,n){super(t,o=>H(r(o)),(o,s)=>H(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},pC=class extends Ou{set;constructor(t,r,n){super(t,r,(o,s)=>H(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Of(Mt(this.getResult(r),n=>this.set(t(n))),()=>r)}};function qn(e){let t=e[0]??mJ;if(e.length>1){let r=e.reduce((n,o)=>yJ(n,o.kind),"Iso");t={kind:r,get:gJ(e,r),set:xJ(e,r)}}switch(t.kind){case"Iso":return new fC(e,t.get,t.set);case"Lens":return new lC(e,t.get,t.set);case"Prism":return new pC(e,t.get,t.set);case"Optional":return new Ou(e,t.get,t.set)}}function Ag(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 gJ(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(dC(o.kind)){if(Se(s))return s;r=s.success}else r=s}return dC(t)?H(r):r}}function xJ(e,t){return iU(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(dC(i.kind)){let c=i.get(n);if(Se(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(iU(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(Se(c))return c;r=c.success}}return t==="Optional"?H(r):r}}function dC(e){return e==="Prism"||e==="Optional"}function iU(e){return e==="Iso"||e==="Prism"}function yJ(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var SJ=qn([]);function vg(){return SJ}function fU(e){let t=Eg(e);return cU(gg(t),hg(t))}function lU(e){return vg()}function pU(e){return vg()}var _u="~effect/Schema/SchemaError";function dU(e){return A(e,_u)&&e[_u]===_u}var rn="~effect/net/NetAddress";var Hn=e=>e.value,Wn=e=>e,xs=e=>e.bytes,gn=class extends cn("NetAddressError"){},Pu=e=>A(e,rn),Jt=e=>Pu(e)&&e._tag==="Ipv4Address",xn=e=>Pu(e)&&e._tag==="Ipv6Address",mC=e=>Jt(e)||xn(e),Fu=e=>Jt(e)?32:128;var Ru=e=>Pu(e)&&e._tag==="MacAddress",kp=e=>Pu(e)&&e._tag==="InetAddressV4",Ap=e=>Pu(e)&&e._tag==="InetAddressV6",hC=e=>kp(e)||Ap(e),Og=e=>Pu(e)&&e._tag==="UnixPathAddress",mU=e=>hC(e)||Og(e),bJ={...mt,_tag:"Ipv4Address",[rn]:rn,[X](e){return Jt(e)&&Hn(this)===Hn(e)},[Y](){return Bt(ie(wJ,Hn(this)|0))},toString(){return Zt(this)},toJSON(){return this.toString()}},IJ={...mt,_tag:"Ipv6Address",[rn]:rn,[X](e){if(!xn(e))return!1;let t=Wn(this),r=Wn(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[Y](){let e=Wn(this),t=ie(kJ,e.w0|0);return t=ie(t,e.w1|0),t=ie(t,e.w2|0),Bt(ie(t,e.w3|0))},toString(){return Zt(this)},toJSON(){return this.toString()}},CJ={...mt,_tag:"MacAddress",[rn]:rn,[X](e){return Ru(e)&&TJ(xs(this),xs(e))},[Y](){return ie(AJ,Yn(xs(this)))},toString(){return yC(this)},toJSON(){return this.toString()}},TJ=(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},wJ=Ae("Ipv4Address"),kJ=Ae("Ipv6Address"),AJ=Ae("MacAddress"),vJ=e=>{let t=Object.create(bJ);return t.value=e>>>0,Object.freeze(t)},OJ=(e,t,r,n)=>{let o=Object.create(IJ);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},_J=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var wp=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],PJ=e=>{let t=Object.assign(Object.create(CJ),{bytes:new Uint8Array(e)});return Object.freeze(t)};var st=(e,t)=>Z(new gn({input:e,message:t})),hU=(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},FJ=e=>hU(e,255)?H(vJ(_J(e[0],e[1],e[2],e[3]))):st(e,"octets must be integers from 0 through 255"),RJ=e=>hU(e,65535)?H(OJ(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):st(e,"segments must be integers from 0 through 65535");var gU=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?H(PJ(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):st(e,"expected six two-digit hexadecimal octets separated by colons");var ki=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return st(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return st(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?st(e,"octets must be at most 255"):FJ([r[0],r[1],r[2],r[3]])},$J=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return st(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return st(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(u=>u==="")||n.some(u=>u===""))return st(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 st(e,"embedded IPv4 syntax must be trailing");let u=Mt(ki(o),l=>{let p=Hn(l);return[p>>>16,p&65535]});if(Se(u))return u;s=u.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 st(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let i=u=>/^[0-9a-fA-F]{1,4}$/.test(u)?Number.parseInt(u,16):void 0,c=r.map(i),f=n.map(i);return c.some(u=>u===void 0)||f.some(u=>u===void 0)?st(e,"segments must contain one through four hexadecimal digits"):H([...c,...Array(8-a).fill(0),...f,...s??[]])},Ai=e=>Pt($J(e),t=>RJ(t)),la=e=>e.includes(":")?Ai(e):ki(e);var gC=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=vp(e);return wt(t)&&t.success===e},vp=e=>{let t=e.indexOf("%");if(t===-1)return st(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return st(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return Mt(Ai(e.slice(0,t)),n=>`${Zt(n)}%${r}`)};var _g=e=>wp(Hn(e)),NJ=e=>{let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},xC=e=>{let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return[...wp(t),...wp(r),...wp(n),...wp(o)]};var yC=e=>Array.from(xs(e),t=>t.toString(16).padStart(2,"0")).join(":"),Pg=e=>xs(e).every(t=>t===255),MJ=e=>(xs(e)[0]&1)!==0,Fg=e=>(xs(e)[0]&1)===0,SC=e=>(xs(e)[0]&2)!==0,EC=e=>(xs(e)[0]&2)===0;var Zt=e=>{if(Jt(e))return _g(e).join(".");let t=NJ(e);if(UJ(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}`},Rg=e=>{if(Jt(e))return Hn(e)===0;let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return t===0&&r===0&&n===0&&o===0},bC=e=>{if(Jt(e))return Hn(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return t===0&&r===0&&n===0&&o===1},$u=e=>Ru(e)?MJ(e):Jt(e)?Hn(e)>>>28===14:Wn(e).w0>>>24===255,$g=e=>Ru(e)?Pg(e):Hn(e)===4294967295,IC=e=>Ru(e)?Fg(e):!$u(e)&&!Rg(e)&&(!Jt(e)||!$g(e)),CC=e=>Jt(e)?Hn(e)>>>16===43518:(Wn(e).w0>>>16&65472)===65152,TC=e=>{let t=Hn(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},wC=e=>(Wn(e).w0>>>24&254)===252,UJ=e=>{let{w0:t,w1:r,w2:n}=Wn(e);return t===0&&r===0&&n===65535};var DJ={...mt,_tag:"InetAddressV4",[rn]:rn,[X](e){return kp(e)&&this.port===e.port&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.port))},toString(){return Ng(this)},toJSON(){return this.toString()}},LJ={...mt,_tag:"InetAddressV6",[rn]:rn,[X](e){return Ap(e)&&this.port===e.port&&this.scopeId===e.scopeId&&W(this.address,e.address)},[Y](){return ie(ie(q(this.address),dt(this.port)),dt(this.scopeId))},toString(){return Ng(this)},toJSON(){return this.toString()}},xU=e=>Number.isInteger(e)&&e>=0&&e<=65535,BJ=(e,t)=>{if(!xU(t))return st(e,"port must be an integer from 0 through 65535");let r=Object.create(DJ);return r.address=e,r.port=t,H(Object.freeze(r))},jJ=(e,t,r)=>{if(!xU(t))return st(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return st(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(LJ);return o.address=e,o.port=t,o.scopeId=n,H(Object.freeze(o))};var kC=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 st(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 st(e,"scope identifier must be decimal");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,a)}}else{let s=e.lastIndexOf(":");if(s<0)return st(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return st(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?Pt(la(t),s=>o!==xn(s)?st(e,"only IPv6 addresses use brackets"):xn(s)?jJ(s,Number(r),{scopeId:n}):BJ(s,Number(r))):st(e,"port must be an unpadded decimal integer")};var zJ=e=>Zt(e.address)+(Ap(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var Ng=e=>{let t=zJ(e);return kp(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var qJ={...mt,_tag:"UnixPathAddress",[rn]:rn,[X](e){return Og(e)&&this.path===e.path},[Y](){return ie(Ae("UnixPathAddress"),Ae(this.path))},toString(){return this.path},toJSON(){return this.toString()}},yU=e=>{let t=Object.create(qJ);return t.path=e,Object.freeze(t)};var AC="~effect/net/Host",pa=(e,t)=>Z(new gn({input:e,message:t})),HJ=/^[a-z0-9_.-]$/i,WJ=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,VJ=/^(?:\d+|0x[0-9a-f]*)$/,SU=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(!WJ.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(VJ.test(r[r.length-1]))return"the last domain name label must not be numeric"},GJ=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!HJ.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},ys=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&SU(e)===void 0;var OC=e=>A(e,AC),Mg=e=>{let t=GJ(e);if(t===void 0)return pa(e,"invalid domain name");let r=SU(t);return r===void 0?H(t):pa(e,r)};var KJ=e=>{if(e.includes("%"))return vp(e);if(e.includes(":"))return la(e);if(/^[\d.]+$/.test(e)){let t=la(e);if(wt(t))return t}return Mg(e)};var JJ=e=>typeof e=="string"?e:Zt(e);var ZJ={...mt,_tag:"HostPort",[AC]:AC,[X](e){return OC(e)&&this.port===e.port&&W(this.host,e.host)},[Y](){return ie(q(this.host),dt(this.port))},toString(){return _C(this)},toJSON(){return this.toString()}},QJ=e=>Number.isInteger(e)&&e>=0&&e<=65535,YJ=(e,t)=>{let r=Object.create(ZJ);return r.host=e,r.port=t,Object.freeze(r)};var EU=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return pa(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return pa(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return pa(e,"expected host:port");if(e.indexOf(":")!==o)return pa(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return pa(e,"port must be an unpadded decimal integer");let n=Number(r);return QJ(n)?Mt(KJ(t),o=>YJ(o,n)):pa(e,"port must be an integer from 0 through 65535")};var _C=e=>{let t=JJ(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var FC="~effect/net/Dns/DnsRecord",PC=e=>Number.isInteger(e)&&e>=0&&e<=255,Nu=e=>Number.isInteger(e)&&e>=0&&e<=65535,CU=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,da=e=>typeof e=="string",Ug=e=>Ff(e)&&mc(e)&&CU(fo(e)),TU={A:{address:Jt},AAAA:{address:xn},CAA:{critical:e=>typeof e=="boolean",tag:e=>da(e)&&/^[a-z0-9]+$/i.test(e),value:da},CNAME:{target:ys},MX:{exchange:ys,priority:Nu},NAPTR:{order:Nu,preference:Nu,flags:da,service:da,regexp:da,replacement:ys},NS:{host:ys},PTR:{host:e=>da(e)&&e.length>0},SOA:{primary:ys,admin:e=>da(e)&&e.length>0,serial:CU,refresh:Ug,retry:Ug,expire:Ug,minimum:Ug},SRV:{target:ys,port:Nu,priority:Nu,weight:Nu},TLSA:{certUsage:PC,selector:PC,matchingType:PC,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(da)}},RC=Object.keys(TU),XJ=e=>RC.includes(e),$C=e=>A(e,FC),eZ={...mt,[FC]:FC,[X](e){return $C(e)&&e._tag===this._tag&&Object.keys(this).every(t=>W(this[t],e[t]))},[Y](){return hf(this,Object.keys(this))},toString(){return rZ(this)},toJSON(){return{...this}}},wU=(e,t)=>{if(!XJ(e))return Z(new gn({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(eZ);n._tag=e;for(let[o,s]of Object.entries(TU[e])){let a=r[o];if(!s(a))return Z(new gn({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(a)?Object.freeze([...a]):a instanceof Uint8Array?new Uint8Array(a):a}return H(Object.freeze(n))};var kU=new TextEncoder,AU=e=>`\\${e.toString().padStart(3,"0")}`,_p=e=>{let t='"';for(let r of kU.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?AU(r):String.fromCharCode(r);return t+'"'},tZ=[34,36,40,41,59,64],IU=e=>{let t=kU.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+=AU(o):r+=tZ.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},rZ=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Zt(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${_p(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${_p(e.flags)} ${_p(e.service)} ${_p(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${IU(e.host)}`;case"SOA":return`SOA ${e.primary} ${IU(e.admin)} ${e.serial} ${fo(e.refresh)} ${fo(e.retry)} ${fo(e.expire)} ${fo(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Zd(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(_p).join(" ")}`}};var NC="~effect/net/IpInterface",vU=e=>Pp(e)&&Jt(e.address),OU=e=>Pp(e)&&xn(e.address),Pp=e=>A(e,NC),aZ={...mt,_tag:"IpInterface",[NC]:NC,[X](e){return Pp(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.prefixLength))},toString(){return Rp(this)},toJSON(){return this.toString()}},MC=(e,t)=>Z(new gn({input:e,message:t})),Fp=(e,t)=>{let r=Fu(e);if(!Number.isInteger(t)||t<0||t>r)return MC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(aZ),{address:e,prefixLength:t});return H(Object.freeze(n))},UC=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return H({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return MC(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)?H({address:e.slice(0,r),prefixLength:Number(n)}):MC(e,"prefix length must be an unpadded ASCII decimal integer")},Dg=(e,t)=>Pt(UC(e,t),r=>Pt(ki(r.address),n=>Fp(n,r.prefixLength??Fu(n)))),Lg=(e,t)=>Pt(UC(e,t),r=>Pt(Ai(r.address),n=>Fp(n,r.prefixLength??Fu(n)))),Bg=(e,t)=>Pt(UC(e,t),r=>Pt(la(r.address),n=>Fp(n,r.prefixLength??Fu(n))));var Rp=e=>`${Zt(e.address)}/${e.prefixLength}`;var DC="~effect/net/IpNetwork",PU=e=>$p(e)&&Jt(e.address),FU=e=>$p(e)&&xn(e.address),$p=e=>A(e,DC),iZ={...mt,_tag:"IpNetwork",[DC]:DC,[X](e){return $p(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.prefixLength))},toString(){return Np(this)},toJSON(){return this.toString()}},cZ=e=>{let t=Object.assign(Object.create(iZ),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},uZ=e=>Jt(e)?_g(e):xC(e);var fZ=(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)},LC=(e,t)=>Pt(Fp(e,t),r=>{let n=uZ(e),o=fZ(n,t);return n.some((s,a)=>s!==o[a])?Z(new gn({input:e,message:"address has non-zero host bits"})):H(cZ(r))});var RU=e=>Pt(Dg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength)),$U=e=>Pt(Lg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength)),NU=e=>Pt(Bg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength));var Np=e=>`${Zt(e.address)}/${e.prefixLength}`;var Mp=yg;function Pr(){return(e,t,r)=>V(new du(e.map(np),n=>t(n.map(o=>V(o))),r))}function Me(e,t){return Pr()([],()=>(r,n,o)=>e(r)?y(r):C(new xt(n,r,o)),t)}function pZ(e){return e}function dZ(e){return t=>t.annotate(e)}function mZ(e){return t=>jC(jC(t).annotate(e))}function hZ(e){return t=>t.rebuild(ip(t.ast,e))}function gZ(e){return e}var Oi=class extends cn("SchemaError"){[_u]=_u;constructor(t){let r=Tn();jt(0);try{super({issue:t})}finally{jt(r)}}get message(){return yR(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[qe](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function JU(e){return dU(e)}function ZU(e){return $e(e)?VC(e):Cr(e,t=>Ks(()=>Vs(t,r=>new Oi(r))))}function VC(e){return ut(e)?e:So(Vs(e.cause,t=>new Oi(t)))}function QU(e,t){let r;for(let n of e.reasons){if(!$m(n)||!JU(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 YU(e){return ch(e).then(t=>{if(ut(t))return t.value;throw QU(t.cause,"Promise adapter can only reject schema errors")})}function XU(e){let t=ko(e);if(ut(t))return t.value;throw QU(t.cause,"Sync adapter can only throw schema errors")}function xZ(e,t){return H1(e,t)}function yZ(e){return W1(e)}var zg=B0,SZ=n1;function bs(e,t){let r=St(e,t);return(n,o)=>ZU(r(n,o))}var EZ=bs;function eD(e,t){let r=o1(e,t);return(n,o)=>VC(r(n,o))}var bZ=eD,IZ=z0,CZ=s1;function tD(e,t){let r=a1(e,t);return(n,o)=>Ld(r(n,o),s=>new Oi(s))}var TZ=tD;function rD(e,t){let r=bs(e,t);return(n,o)=>YU(r(n,o))}var wZ=rD;function nD(e,t){let r=bs(e,t);return(n,o)=>XU(r(n,o))}var kZ=nD;function qg(e,t){let r=Ii(e,t);return(n,o)=>ZU(r(n,o))}var AZ=qg;function oD(e,t){let r=c1(e,t);return(n,o)=>VC(r(n,o))}var vZ=oD,OZ=q0,_Z=u1;function sD(e,t){let r=f1(e,t);return(n,o)=>Ld(r(n,o),s=>new Oi(s))}var PZ=sD;function aD(e,t){let r=qg(e,t);return(n,o)=>YU(r(n,o))}var FZ=aD;function iD(e,t){let r=qg(e,t);return(n,o)=>XU(r(n,o))}var RZ=iD,V=jn;function Hg(e){return A(e,Mp)&&e[Mp]===Mp}var Ss=mr(e=>V(di(e.ast),{schema:e})),$Z=mr(e=>e.schema),Is=mr(e=>{let t=Jg(e);return V(gN(e.ast),{schema:t})}),NZ=mr(e=>e.schema.members[0]),MZ=mr(e=>V(FI(e.ast),{schema:e})),UZ=mr(e=>e.schema),Fr=mr(e=>V(It(e.ast),{schema:e})),Bu=mr(e=>V(Mn(e.ast),{schema:e})),Up="~effect/Schema/flip";function DZ(e){return A(e,Up)&&e[Up]===Up}function jC(e){return DZ(e)?e.schema.rebuild(en(e.ast)):V(en(e.ast),{[Up]:Up,schema:e})}function Ct(e){let t=V(new Xr(e),{literal:e,transform(r){return t.pipe(J(Ct(r),{decode:pe(()=>r),encode:pe(()=>e)}))}});return t}function cD(e){return e.map(t=>Hg(t)?t.ast:new Xr(t))}function LZ(e){return V(new EI(cD(e)),{parts:e})}function BZ(e){return V(J$(cD(e)),{parts:e})}function jZ(e){return V(new K$(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var zZ=V(SI),qZ=V(V$),Dp=V(ds),Wg=V(xI),GC=V(yI),$=V(Yr),HZ=$,Lp=V(bI),Vg=V(Y$),uD=V(X$),ju=V(eN),WZ=V(W$),VZ=V(G$);function GZ(e){return V(new Q$(e))}function KC(e,t){return V(e,{fields:t,mapFields(r,n){let o=r(this.fields);return KC(Bh(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function _e(e){return KC(Bh(e,void 0),e)}function KZ(e){return mr(t=>t.mapFields(oU(e)))}var JZ=e=>typeof e=="symbol"?e:globalThis.String(e);function ZZ(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=Bu(t.fields[a]),c=Object.hasOwn(e,a),f=c?e[a]:a,u=JZ(f);if(s.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${Xn(f)}`);s.add(u),U(r,f,i),c&&(n[a]=f,o[f]=a)}return _e(r).pipe(J(t,we({decode:iC(o),encode:iC(n)})))}}function QZ(e,t){return r=>{let n=Bd(r.fields,Fr),o=_e({...n,...e});return r.pipe(J(o,we({decode:s=>{let a={...s};for(let i in e){let c=t[i],f=c(s);ve(f)&&U(a,i,f.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function _i(e,t){return V(yN(e.ast,t.ast),{key:e,value:t})}function YZ(e,t){return V(sN(e.ast,t.map(np)),{schema:e,records:t})}function fD(e,t){return V(e,{elements:t,mapElements(r,n){let o=r(this.elements);return fD(wI(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Mo(e){return fD(wI(e),e)}function XZ(e,t){return V(aN(e.ast,t.map(np)),{schema:e,rest:t})}var Ce=mr(e=>V(new mn(!1,[],[e.ast]),{value:e}));function Gg(e,t,r){return t!==void 0&&r!==void 0?e.check(eT(t,r)):t!==void 0?e.check(AD(t)):r!==void 0?e.check(_D(r)):e}var Kg=mr(e=>V(new mn(!1,[e.ast],[e.ast]),{value:e}));function e5(e){let t=Ce(e),r=Ce(Fr(e)),n=J(Mo([Dp]),we({decode:o=>[o],encode:([o])=>o}))(e);return V(Ze([n,t]).pipe(J(r)).ast,{from:Ze([e,t]),to:r})}function t5(e){return Ce(e).check(rT())}var r5=mr(e=>V(iN(e.ast),{schema:e}));function lD(e,t){return V(e,{members:t,mapMembers(r,n){let o=r(this.members);return lD(jh(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ze(e,t){return lD(jh(e,t,void 0),e)}function Cs(e){let t=e.map(Ct);return V(jh(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return Ze(r(this.members))},pick(r){return Cs(r)},transform(r){return Ze(t.map((n,o)=>n.transform(r[o])))}})}var JC=mr(e=>Ze([e,Wg])),Jg=mr(e=>Ze([e,GC])),pD=mr(e=>Ze([e,Wg,GC]));function dD(e){return V(new AI(()=>e().ast))}function n5(...e){return t=>t.check(...e)}function mD(e,t){return r=>V($o(r.ast,[qh(e,t)]),{schema:r})}function Zg(e){return t=>V(t.ast,{schema:t,identifier:e})}function o5(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(Zg(e))}function hD(e){return t=>V(mN(t.ast,new Ph(e,F)),{schema:t})}function gD(e){return t=>V(hN(t.ast,new Ph(F,e)),{schema:t})}function s5(e){return xD(e)}function xD(e){return t=>hD(Al(e))(t)}function a5(e){return yD(e)}function yD(e){return t=>gD(Al(e))(t)}function J(e,t){return r=>V(xu(r.ast,e.ast,t?Fh(t):au()),{from:r,to:e})}function zu(){return(e,t)=>Te()(e,{decode:t,encode:DR})}var Qg=Cs(["true","yes","on","1","y"]),Yg=Cs(["false","no","off","0","n"]),ZC=Cs([...Qg.literals,...Yg.literals]).pipe(J(Vg,we({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function i5(e){return t=>J(Fr(t),e)(t)}function QC(e,t){return r=>t?J(r,t)(e):J(r)(e)}function c5(e){return t=>J(t,e)(Bu(t))}function SD(e){return t=>V(xN(t.ast,e),{schema:t})}function ED(e){return Cr(e,t=>Ks(()=>Vs(t,r=>r.issue)))}function YC(e,t){let r=t?.encodingStrategy==="omit"?Jb():Po();return n=>Ss(Bu(n)).pipe(J(n,{decode:Zb(ED(e)),encode:r}))}function u5(e,t){return r=>Fr(r).pipe(YC(e,t),QC(Ss(r)))}function bD(e,t){let r=t?.encodingStrategy==="omit"?Jb():Po();return n=>Is(Bu(n)).pipe(J(n,{decode:Zb(ED(e)),encode:r}))}function f5(e,t){return r=>Fr(r).pipe(bD(e,t),QC(Is(r)))}function Es(e){return Ct(e).pipe(SD(y(e)))}function l5(e){return Es(e).pipe(YC(y(e),{encodingStrategy:"omit"}))}function Bp(e,t){return _e({_tag:Es(e),...t})}function ID(e){return t=>{let r={},n=[],o=new Set,s={},a=u=>l=>u.includes(l[e]);return i(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:f});function i(u){let l=u.ast;if(z$(l)&&"members"in u&&globalThis.Array.isArray(u.members)&&u.members.every(Hg))return u.members.forEach(i);let p=fu(l);if(p.length>0){let h=p.find(g=>g.key===e)?.literal;if(xd(h)){let g=typeof h=="number"?globalThis.String(h):h;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(g),n.push(h),U(r,h,u),U(s,h,B0(Fr(u)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(x){let b=x[e];return(Object.hasOwn(g,b)?g[b]:void 0)(x)}}let u=arguments[0],l=arguments[1],p=u[e];return(Object.hasOwn(l,p)?l[p]:void 0)(u)}function f(){if(arguments.length===2){let x=arguments[0],b=arguments[1];return function(T){let w=T[e];return(Object.hasOwn(x,w)?x[w]??b:b)(T)}}let u=arguments[0],l=arguments[1],p=arguments[2],h=u[e];return(Object.hasOwn(l,h)?l[h]??p:p)(u)}}}function p5(e){let t={},r=[];for(let f of Object.keys(e)){let u=Bp(f,e[f]);U(t,f,u),r.push(u)}let n=Ze(r),{tag:o,guards:s,isAnyOf:a,match:i,matchOrElse:c}=ID("_tag")(n);return V(n.ast,{tag:o,cases:t,isAnyOf:a,guards:s,match:i,matchOrElse:c})}function d5(){return e=>e}function ma(e,t){return Me(r=>r instanceof e,t)}function Te(){return(e,t)=>new ft(e.ast,Fh(t))}var ke=zh;function m5(e,t=void 0){return new ui(e,t)}var MU="^\\S[\\s\\S]*\\S$|^\\S$|^$";function CD(e){let t=new globalThis.RegExp(MU);return ke(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:MU,flags:""}]},...e})}function Pi(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${N(r)})`:`new RegExp(${N(r)}, ${N(n)})`;return sp(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function h5(e){return NI({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function g5(e){return MI({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function x5(e){return DI({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var y5=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 S5(e,t){let r=y5(e);return Pi(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 UU=/^([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 E5(e){return Pi(UU,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:UU.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function b5(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Pi(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function TD(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Pi(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function I5(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Pi(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function XC(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 C5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${gs(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return ke(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>XC(o,e,`^${gs(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function T5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${gs(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return ke(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>XC(o,e,`${gs(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function w5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(gs(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return ke(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>XC(o,e,gs(o)),toCode:()=>({runtime:`Schema.isIncluding(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var DU="^[^a-z]*$";function k5(e){let t=new globalThis.RegExp(DU);return ke(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:DU,flags:""}]},...e})}var LU="^[^A-Z]*$";function A5(e){let t=new globalThis.RegExp(LU);return ke(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:LU,flags:""}]},...e})}var BU="^(?:[^a-z][\\s\\S]*)?$";function v5(e){let t=new globalThis.RegExp(BU);return ke(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:BU,flags:""}]},...e})}var jU="^(?:[^A-Z][\\s\\S]*)?$";function O5(e){let t=new globalThis.RegExp(jU);return ke(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:jU,flags:""}]},...e})}var qu=V(OI),_5=vI;function jp(e){let t=oc(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function zp(e){let t=Fd(e.order),r=e.formatter??N;return(n,o)=>ke(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 qp(e){let t=_d(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function Hp(e){let t=Pd(e.order),r=e.formatter??N;return(n,o)=>ke(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 Wp(e){let t=Fd(e.order),r=oc(e.order),n=Pd(e.order),o=_d(e.order),s=e.formatter??N;return(a,i)=>{let c=a.exclusiveMinimum?r:t,f=a.exclusiveMaximum?o:n;return ke(u=>c(u,a.minimum)&&f(u,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 P5(e){return(t,r)=>{let n=e.formatter??N;return ke(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function Uu(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${N(e)}`);return e}var F5=jp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Uu(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${N(e)})`})})}),wD=zp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Uu(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${N(e)})`})})}),R5=qp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Uu(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${N(e)})`})})}),$5=Hp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Uu(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${N(e)})`})})}),ha=Wp({order:Vo,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Uu(e.minimum),maximum:Uu(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function N5(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),ke(r=>F_(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(${N(e)})`}),...t})}function Xg(e){return ke(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 Rr=Lp.check(Xg()),vi=Rr.check(wD(0));function M5(e){return new ui([Xg(),ha({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function U5(e){return new ui([Xg(),ha({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Du(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${N(e)}`);return e.toISOString()}function Lu(e){return`new Date(${N(e.getTime())})`}var D5=jp({order:nc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${Lu(e)})`})})}),L5=zp({order:nc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Lu(e)})`})})}),B5=qp({order:nc,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${Lu(e)})`})})}),j5=Hp({order:nc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Lu(e)})`})})}),z5=Wp({order:nc,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Du(e.minimum),maximum:Du(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Lu(e.minimum)}, maximum: ${Lu(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}}),q5=jp({order:rc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${N(e)})`})})}),kD=zp({order:rc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${N(e)})`})})}),H5=qp({order:rc,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${N(e)})`})})}),W5=Hp({order:rc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${N(e)})`})})}),V5=Wp({order:rc,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: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function AD(e,t){return e=hr(e),vD(e,Math.ceil(e/2),t)}function vD(e,t,r){return ke(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})`}),[Ar]:!0,arbitraryConstraint:{minLength:e},...r})}function OD(e){return vD(1,1,e)}function _D(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxLength:e},...t})}function eT(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function G5(e,t){return e=hr(e),ke(r=>tT(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 K5(e,t){return e=hr(e),ke(r=>tT(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 J5(e,t,r){return e=hr(e),t=hr(t),ke(n=>{let o=tT(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 tT(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function hr(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Z5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minSize:e},...t})}function Q5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxSize:e},...t})}function Y5(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function X5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minProperties:e},...t})}function e8(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxProperties:e},...t})}function t8(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function r8(e,t){let r=Bu(e),n=r1(r.ast);return ke((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let f of i){let u=n(f,a);if(u!==void 0&&(c.push(new At([f],u)),a.errors==="first"))break}return Ma(c)?new vt(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})`}),[Ar]:!0,...t})}function rT(e){return ke(t=>Wd(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:F},...e})}function PD(e){return ke(t=>Wd(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 nT=$.check(OD()),n8=$.check(eT(1,1)),FD=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),RD=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},zU=[];function o8(e){let t=FD(e),r=zU[t];if(r!==void 0)return r;let n=RD(t),o=ma(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${N(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Te()(PY,E$(n))});return zU[t]=o,o}var qU=[];function oT(e){let t=FD(e),r=qU[t];if(r!==void 0)return r;let n=sx.pipe(J(Dp,b$(RD(t))));return qU[t]=n,n}function s8(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(Mo([n,o]));return(a,i,c)=>a instanceof globalThis.Map?Vt(St(s)([...a],c),{onSuccess:f=>new globalThis.Map(f),onFailure:f=>Or(i,"entries",f,a,c)}):C(new xt(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])=>Te()(Ce(Mo([n,o])),we({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return V(r.ast,{key:e,value:t})}function a8(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>o instanceof globalThis.Set?Vt(St(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>Te()(Ce(r),we({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return V(t.ast,{value:e})}var i8=ma(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Te()(_e({source:$,flags:$}),Nt({decode:(e,t)=>ht({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ue({expected:"valid RegExp source and flags"},e,t)}),encode:e=>y({source:e.source,flags:e.flags})}))}),$D=$.annotate({expected:"a string that will be decoded as a URL"}),ND=ma(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Te()($D,sI)}),c8=$D.pipe(J(ND,sI)),MD=$.annotate({expected:"a string that will be decoded as a Date"}),Hu=Me(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:()=>Te()(MD,nI)}),u8=MD.pipe(J(Hu,nI)),f8=Rr.pipe(J(Hu,m$)),l8=$.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function sT(e,t){return l8.pipe(J(e,P$(t)))}var p8=sT(Dp),UD=ma(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Te()(_e({data:$.check(TD()),type:$,name:$,lastModified:Rr}),Nt({decode:(e,t)=>Sr(ii(e.data),{onFailure:()=>C(new ue({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return y(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Uc({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ou(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ue({expected:"a readable File"},e,t)})}))}),DD=ma(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Te()(Ce(Mo([$,Ze([_e({_tag:Es("String"),value:$}),_e({_tag:Es("File"),value:UD})])])),Nt({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return y(t)},encode:e=>y(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function d8(e){return DD.pipe(J(e,F$))}var LD=ma(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Te()($.annotate({expected:"a query string that will be decoded as URLSearchParams"}),we({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function m8(e){return LD.pipe(J(e,R$))}var h8=$.annotate({expected:"a string that will be decoded as a number"}).pipe(J(Lp,iu)),g8=$.annotate({expected:"a string that will be decoded as a finite number"}).pipe(J(qu,iu)),x8=V(UI).pipe(J(ju,$h)),BD=$.check(CD()),y8=$.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(J(BD,d$())),S8=$.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(J($,A$)),E8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(J($,v$)),b8=$.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(J($,O$)),I8=$.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(J($,_$)),zC=Ze([qu,uD,$]),C8=_e({issues:Ce(_e({message:$,path:Is(Ce(Ze([zC,_e({key:zC})])))}))}),T8=Cs([0,1]).pipe(J(Vg,we({decode:e=>e===1,encode:e=>e?1:0}))),jD=$.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),ex=ma(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Te()(jD,aI)}),w8=jD.pipe(J(ex,aI)),k8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(J(ex,{decode:VR(),encode:Oh()})),zD=$.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(J(ex,{decode:KR(),encode:_h()})),qD=Nt({decode:(e,t)=>{let r=l$(e);return Ke(r)?C(new ue({expected:"a valid BigDecimal string"},e,t)):y(r.value)},encode:e=>y(ps(e))}),A8=jp({order:su,formatter:e=>ps(e)}),v8=zp({order:su,formatter:e=>ps(e)}),O8=qp({order:su,formatter:e=>ps(e)}),_8=Hp({order:su,formatter:e=>ps(e)}),P8=Wp({order:su,formatter:e=>ps(e)}),HD=$.annotate({expected:"a string that will be decoded as a BigDecimal"}),WD=Me(tI,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Te()(HD,qD),toFormatter:()=>e=>ps(e)}),F8=HD.pipe(J(WD,qD)),tx=Me(VP,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Te()(ju.check(kD(globalThis.BigInt(0))),we({decode:_l,encode:lh})),toCodecStringTree:()=>Te()(VD,oI)}),VD=$.annotate({expected:"a string that will be decoded as a ByteSize"}),R8=VD.pipe(J(tx,oI)),$8=ju.pipe(J(tx,h$)),N8=Lp.pipe(J(tx,g$));function qC(e,t){let r=Pr()([e,t],([n,o])=>(s,a,i)=>{if(!JO(s))return C(new xt(a,s,i));switch(s._tag){case"Fail":return Vt(St(n)(s.error,i),{onSuccess:lE,onFailure:c=>Or(a,"error",c,s,i)});case"Die":return Vt(St(o)(s.defect,i),{onSuccess:pE,onFailure:c=>Or(a,"defect",c,s,i)});case"Interrupt":return y(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])=>Te()(Ze([_e({_tag:Ct("Fail"),error:n}),_e({_tag:Ct("Die"),defect:o}),_e({_tag:Ct("Interrupt"),fiberId:Jg(qu)})]),we({decode:s=>{switch(s._tag){case"Fail":return lE(s.error);case"Die":return pE(s.defect);case"Interrupt":return QO(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 V(r.ast,{error:e,defect:t})}function HC(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(qC(n,o));return(a,i,c)=>KO(a)?Vt(St(s)(a.reasons,c),{onSuccess:rl,onFailure:f=>Or(i,"failures",f,a,c)}):C(new xt(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])=>Te()(Ce(qC(n,o)),we({decode:rl,encode:({reasons:s})=>s}))});return V(r.ast,{error:e,defect:t})}function HU(e){return Te()(e,we({decode:db,encode:nr}))}function M8(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>dh(o)?Vt(St(n)(nr(o),a),{onSuccess:db,onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>HU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>HU(Gg(Ce(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>lb(r)});return V(t.ast,{value:e})}function GD(){return ir((e,t)=>Re(zb(e),{onNone:()=>C(new ue({message:"Invalid DateTime input"},e,t)),onSome:r=>y(qb(r))}))}var U8=we({decode:e=>Wb(e),encode:e=>e.offset}),KD=Nt({decode:(e,t)=>Re(OR(e),{onNone:()=>C(new ue({expected:"a valid IANA time zone"},e,t)),onSome:y}),encode:e=>y(e.id)}),JD=Nt({decode:(e,t)=>Re(_R(e),{onNone:()=>C(new ue({expected:"a valid time zone"},e,t)),onSome:y}),encode:e=>y(Ql(e))}),ZD=Nt({decode:(e,t)=>Re(zb(e),{onNone:()=>C(new ue({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>y(qb(r))}),encode:e=>y(RR(e))}),QD=Nt({decode:(e,t)=>Re(vR(e),{onNone:()=>C(new ue({expected:"a valid Zoned DateTime string"},e,t)),onSome:y}),encode:e=>y(Vb(e))}),YD=-864e13,XD=864e13,D8=YD+840*60*1e3,L8=XD-840*60*1e3,B8=-720*60*1e3,j8=840*60*1e3,e2=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function t2(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 aT(e,t){return Rr.check(ha({minimum:e,maximum:t}))}function r2(){return Ze([aT(B8,j8),Cs(e2)])}var rx=Me(e=>jb(e)&&CR(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]=t2(e,YD,XD);return zu()(aT(t,r),pe(kR))},toCodecJson:()=>Te()($,ZD),toFormatter:()=>e=>e.toString()}),z8=Hu.pipe(J(rx,{decode:GD(),encode:pe(PR)})),q8=$.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(J(rx,ZD)),H8=Rr.pipe(J(rx,{decode:GD(),encode:pe(FR)})),W8=Me(bR,{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:()=>Te()(Rr,U8),toFormatter:()=>e=>Ql(e)}),n2=$.annotate({expected:"an IANA time zone identifier"}),o2=Me(IR,{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:()=>zu()(Cs(e2),pe(Hb)),toCodecJson:()=>Te()(n2,KD),toFormatter:()=>e=>Ql(e)}),V8=n2.pipe(J(o2,KD)),s2=$.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),a2=Me(ER,{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:()=>zu()(r2(),pe(e=>typeof e=="number"?Wb(e):Hb(e))),toCodecJson:()=>Te()(s2,JD),toFormatter:()=>e=>Ql(e)}),G8=s2.pipe(J(a2,JD)),i2=$.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),c2=Me(e=>jb(e)&&TR(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]=t2(e,D8,L8);return zu()(_e({epochMilliseconds:aT(t,r),timeZone:r2()}),pe(({epochMilliseconds:n,timeZone:o})=>AR(n,{timeZone:o})))},toCodecJson:()=>Te()(i2,QD),toFormatter:()=>e=>Vb(e),toEquivalence:()=>wR}),K8=i2.pipe(J(c2,QD)),$r=(e,t,r,n)=>$.pipe(J(e,Nt({decode:(o,s)=>{let a=t(o);return wt(a)?y(a.success):C(new ue({message:a.failure.message},o,s))},encode:o=>y(r(o))}))).annotate({identifier:n}),Fi=Me(Ru,{identifier:"MacAddress"}),Wu=$r(Fi,gU,yC,"MacAddressFromString"),Vp=Me(Jt,{identifier:"Ipv4Address"}),iT=$r(Vp,ki,Zt,"Ipv4AddressFromString"),nx=Me(xn,{identifier:"Ipv6Address"}),u2=$r(nx,Ai,Zt,"Ipv6AddressFromString"),ga=Me(mC,{identifier:"IpAddress"}),Ri=$r(ga,la,Zt,"IpAddressFromString"),tt=(e,t,r,n)=>mD(t,{expected:r})(e).annotate({identifier:n}),J8=tt(ga,$u,"a multicast address","IpMulticastAddress"),Z8=tt(Ri,$u,"a multicast address","IpMulticastAddressFromString"),Q8=tt(Fi,$u,"a multicast address","MacMulticastAddress"),Y8=tt(Wu,$u,"a multicast address","MacMulticastAddressFromString"),X8=tt(ga,IC,"a unicast address","IpUnicastAddress"),eQ=tt(Ri,IC,"a unicast address","IpUnicastAddressFromString"),tQ=tt(Fi,Fg,"a unicast address","MacUnicastAddress"),rQ=tt(Wu,Fg,"a unicast address","MacUnicastAddressFromString"),nQ=tt(Vp,$g,"a broadcast address","Ipv4BroadcastAddress"),oQ=tt(iT,$g,"a broadcast address","Ipv4BroadcastAddressFromString"),sQ=tt(Fi,Pg,"a broadcast address","MacBroadcastAddress"),aQ=tt(Wu,Pg,"a broadcast address","MacBroadcastAddressFromString"),iQ=tt(ga,bC,"a loopback address","IpLoopbackAddress"),cQ=tt(Ri,bC,"a loopback address","IpLoopbackAddressFromString"),uQ=tt(ga,CC,"a link-local address","IpLinkLocalAddress"),fQ=tt(Ri,CC,"a link-local address","IpLinkLocalAddressFromString"),lQ=tt(ga,Rg,"an unspecified address","IpUnspecifiedAddress"),pQ=tt(Ri,Rg,"an unspecified address","IpUnspecifiedAddressFromString"),dQ=tt(Vp,TC,"a private address","Ipv4PrivateAddress"),mQ=tt(iT,TC,"a private address","Ipv4PrivateAddressFromString"),hQ=tt(nx,wC,"a unique-local address","Ipv6UniqueLocalAddress"),gQ=tt(u2,wC,"a unique-local address","Ipv6UniqueLocalAddressFromString"),xQ=tt(Fi,SC,"a locally administered address","MacLocallyAdministeredAddress"),yQ=tt(Wu,SC,"a locally administered address","MacLocallyAdministeredAddressFromString"),SQ=tt(Fi,EC,"a universally administered address","MacUniversallyAdministeredAddress"),EQ=tt(Wu,EC,"a universally administered address","MacUniversallyAdministeredAddressFromString"),f2=Me(vU,{identifier:"Ipv4Interface"}),bQ=$r(f2,Dg,Rp,"Ipv4InterfaceFromString"),l2=Me(OU,{identifier:"Ipv6Interface"}),IQ=$r(l2,Lg,Rp,"Ipv6InterfaceFromString"),p2=Me(Pp,{identifier:"IpInterface"}),CQ=$r(p2,Bg,Rp,"IpInterfaceFromString"),d2=Me(PU,{identifier:"Ipv4Network"}),TQ=$r(d2,RU,Np,"Ipv4NetworkFromString"),m2=Me(FU,{identifier:"Ipv6Network"}),wQ=$r(m2,$U,Np,"Ipv6NetworkFromString"),h2=Me($p,{identifier:"IpNetwork"}),kQ=$r(h2,NU,Np,"IpNetworkFromString"),AQ=Me(kp,{identifier:"InetAddressV4"}),vQ=Me(Ap,{identifier:"InetAddressV6"}),g2=Me(hC,{identifier:"InetAddress"}),OQ=$r(g2,kC,Ng,"InetAddressFromString"),x2=Me(Og,{identifier:"UnixPathAddress"}),_Q=$.pipe(J(x2,we({decode:yU,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),PQ=Me(mU,{identifier:"SocketAddress"}),Ts=$.check(ke(ys,{expected:"a normalized domain name"})).pipe(Zg("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),y2=$r(Ts,Mg,e=>e,"DomainNameFromString"),cT=$.check(ke(gC,{expected:"a canonical scoped IPv6 literal"})).pipe(Zg("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),S2=$r(cT,vp,e=>e,"ScopedIpv6LiteralFromString"),FQ=Ze([ga,cT,Ts]).annotate({identifier:"Host"}),RQ=Ze([Ri,S2,y2]).annotate({identifier:"HostFromString"}),E2=Me(OC,{identifier:"HostPort"}),$Q=$r(E2,EU,_C,"HostPortFromString"),NQ=Rr.check(ha({minimum:0,maximum:65535},{expected:"a port number"})),MQ=Nt({decode:(e,t)=>Re(zk(e),{onNone:()=>C(new ue({expected:"a valid Duration string"},e,t)),onSome:y}),encode:e=>y(globalThis.String(e))}),UQ=Nt({decode:e=>y(uo(e)),encode:(e,t)=>Re(qk(e),{onNone:()=>C(new ue({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>y(r)})}),DQ=we({decode:e=>dc(e),encode:e=>Ko(e)}),Gp=Me(Ff,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Te()(Ze([_e({_tag:Ct("Infinity")}),_e({_tag:Ct("NegativeInfinity")}),_e({_tag:Ct("Nanos"),value:ju}),_e({_tag:Ct("Millis"),value:Rr})]),we({decode:e=>{switch(e._tag){case"Infinity":return La;case"NegativeInfinity":return pc;case"Nanos":return uo(e.value);case"Millis":return dc(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}}}}))}),LQ=$.annotate({expected:"a string that will be decoded as a Duration"}),BQ=LQ.pipe(J(Gp,MQ)),jQ=ju.pipe(J(Gp,UQ)),zQ=Lp.pipe(J(Gp,DQ)),qQ=Cs(RC),b2=(e,t)=>$.pipe(J(e,Nt({decode:(r,n)=>{let o=t(r);return Se(o)?C(new ue({message:o.failure.message},r,n)):Zt(o.success)===r?y(o.success):C(new ue({message:"expected a canonical address"},r,n))},encode:r=>y(Zt(r))}))),BC=Rr.check(ha({minimum:0,maximum:255})),Mu=Rr.check(ha({minimum:0,maximum:65535})),I2=Rr.check(ha({minimum:0,maximum:4294967295})),jg=I2.pipe(J(Gp,we({decode:Rf,encode:fo}))),yn=(e,t)=>Me(r=>$C(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=Bp(e,t);return Te()(r,Nt({decode:(n,o)=>{let{_tag:s,...a}=n,i=wU(e,a);return wt(i)?y(i.success):C(new ue({message:i.failure.message},n,o))},encode:n=>y({...n})}))}}),C2=yn("A",{address:b2(Vp,ki)}),T2=yn("AAAA",{address:b2(nx,Ai)}),w2=yn("CAA",{critical:Vg,tag:$.check(Pi(/^[a-z0-9]+$/i)),value:$}),k2=yn("CNAME",{target:Ts}),A2=yn("MX",{exchange:Ts,priority:Mu}),v2=yn("NAPTR",{order:Mu,preference:Mu,flags:$,service:$,regexp:$,replacement:Ts}),O2=yn("NS",{host:Ts}),_2=yn("PTR",{host:nT}),P2=yn("SOA",{primary:Ts,admin:nT,serial:I2,refresh:jg,retry:jg,expire:jg,minimum:jg}),F2=yn("SRV",{target:Ts,port:Mu,priority:Mu,weight:Mu}),R2=yn("TLSA",{certUsage:BC,selector:BC,matchingType:BC,data:zD}),$2=yn("TXT",{chunks:Kg($)}),HQ=Ze([C2,T2,w2,k2,A2,v2,O2,_2,P2,F2,R2,$2]).annotate({identifier:"DnsRecord"});function WQ(e,t,r){let n=Pr()([e,t,r],([o,s,a])=>{let i=HC(s,a);return(c,f,u)=>{if(!e_(c))return C(new xt(f,c,u));switch(c._tag){case"Success":return Vt(St(o)(c.value,u),{onSuccess:ts,onFailure:l=>Or(f,"value",l,c,u)});case"Failure":return Vt(St(i)(c.cause,u),{onSuccess:So,onFailure:l=>Or(f,"cause",l,c,u)})}}},{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])=>Te()(Ze([_e({_tag:Ct("Success"),value:o}),_e({_tag:Ct("Failure"),cause:HC(s,a)})]),we({decode:i=>i._tag==="Success"?ts(i.value):So(i.cause),encode:i=>ut(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}}))});return V(n.ast,{value:e,error:t,defect:r})}function WU(e,t,r){return _e({type:Ct(e),nodes:Ce(_e({index:vi,data:t})),edges:Ce(_e({index:vi,source:vi,target:vi,data:r}))})}function VU(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 C(new At(["nodes",o,"index"],new ue({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 C(new At(["edges",o,"index"],new ue({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return C(new At(["edges",o,"source"],new ue({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return C(new At(["edges",o,"target"],new ue({expected:"an encoded node index"},s.target,t)))}return y(ig(e))}function VQ(e,t,r){return!N0(e)||e.mutable||e.type!==t?C(new ue({expected:`an immutable ${t} Graph`},e,r)):y(gp(e))}function GQ(e,t){return(r,n)=>{let o=gp(r),s=gp(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],f=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||!f||!t(i.data,c.data))return!1}return!0}}function KQ(e,t,r){return zu()(Ze([Wg,_e({nodes:Kg(t),edges:Ce(Mo([vi,vi,r]))})]),pe(n=>{if(n===null)return ig({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return ig({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 JQ(e,t,r){let n=Pr()([t,r],([o,s])=>{let a=WU(e,o,s);return(i,c,f)=>!N0(i)||i.mutable||i.type!==e?C(new xt(c,i,f)):B(St(a)(gp(i),f),u=>VU(u,f))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${N(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${N(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Te()(WU(e,o,s),Nt({decode:VU,encode:(a,i)=>VQ(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>KQ(e,o,s),toEquivalence:([o,s])=>GQ(o,s)});return V(n.ast,{type:e,node:t,edge:r})}function GU(e){return Te()(e,we({decode:g0,encode:mp}))}function ZQ(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(Mo([n,o]));return(a,i,c)=>TM(a)?Vt(St(s)(mp(a),c),{onSuccess:g0,onFailure:f=>Or(i,"entries",f,a,c)}):C(new xt(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])=>GU(Ce(Mo([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>GU(Gg(Ce(Mo([o,s])).check(PD()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>bd(n,o)});return V(r.ast,{key:e,value:t})}function KU(e){return Te()(e,we({decode:S0,encode:nr}))}function QQ(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>OM(o)?Vt(St(n)(nr(o),a),{onSuccess:S0,onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>KU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>KU(Gg(Ce(n).check(rT()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>xf(r)});return V(t.ast,{value:e})}function $i(e){let t=Pr()([e],([r])=>(n,o,s)=>$d(n)?Ke(n)?Sl:Vt(St(r)(n.value,s),{onSuccess:R,onFailure:a=>Or(o,"value",a,n,s)}):C(new xt(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])=>Te()(Ze([_e({_tag:Ct("Some"),value:r}),_e({_tag:Ct("None")})]),we({decode:n=>n._tag==="None"?v():R(n.value),encode:n=>ve(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return V(t.ast,{value:e})}function YQ(e){return JC(e).pipe(J($i(Fr(e)),I$()))}function XQ(e){return Jg(e).pipe(J($i(Fr(e)),C$()))}function eY(e,t){return pD(e).pipe(J($i(Fr(e)),T$(t)))}var N2=Me(RM,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),M2=Me(FM,{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:()=>Te()(Ce($),we({decode:$M,encode:LM})),toCodecIso:()=>Te()(_i($,N2),we({decode:w0,encode:e=>e.cookies}))}),tY=M2.pipe(J(_i($,$),we({decode:DM,encode:e=>k0(globalThis.Object.entries(e).map(([t,r])=>UM(t,r)))}))),rY=Me(qM,{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:()=>_0,toCodec:()=>Te()(_i($,$),we({decode:HM,encode:e=>({...e})}))}),uT=Me(F0,{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:()=>R0,toCodec:()=>Te()(Ce(Mo([$,$])),we({decode:ag,encode:e=>e.params}))}),nY=(e,t)=>uT.pipe(J(sT(Dp,t),Nt({decode:r=>Re(GM(r,e),{onNone:()=>C(new At([e],new na(void 0))),onSome:y}),encode:r=>y(ag([[e,r]]))}))),oY=uT.pipe(J(_i($,Ze([$,Kg($)])),we({decode:KM,encode:WM})));function sY(e){return Ss(e).pipe(J($i(Fr(e)),w$()))}function aY(e){return Is(e).pipe(J($i(Fr(e)),k$()))}function iY(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return Is(JC(e)).pipe(J($i(Fr(e)),Rh({decode:o=>o.pipe(ic(yd),R),encode:r==="omit"?ac:o=>R(bt(ac(o),()=>n))})))}function U2(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?St(Ct(r)):void 0,a=Pr()([e],([i])=>(c,f,u)=>{if(A0(c)){let l=s!==void 0?kl(s(c.label,u),p=>new At(["label"],p)):xe;return $t(l,()=>Vt(St(i)(ca(c),u),{onSuccess:p=>Bn(p,{label:c.label}),onFailure:()=>new vt(f,[new At(["value"],new ue(void 0,c,u))],c,u)}))}return C(new xt(f,c,u))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${N(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Te()(i,{decode:pe(c=>Bn(c,{label:r})),encode:n?kh(c=>"Cannot serialize Redacted"+(ve(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):pe(ca)}),toEquivalence:([i])=>zM(i)});return V(a.ast,{value:e})}function cY(e,t){return J(U2(Fr(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:pe(r=>Bn(r,{label:t?.label})),encode:t?.disallowEncode?kh(r=>"Cannot encode Redacted"+(ve(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):pe(ca)})(e)}function uY(e,t){let r=Pr()([e,t],([n,o])=>(s,a,i)=>{if(!kk(s))return C(new xt(a,s,i));switch(s._tag){case"Success":return Vt(j0(n)(s.success,i),{onSuccess:H,onFailure:c=>Or(a,"success",c,s,i)});case"Failure":return Vt(j0(o)(s.failure,i),{onSuccess:Z,onFailure:c=>Or(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])=>Te()(Ze([_e({_tag:Ct("Success"),success:n}),_e({_tag:Ct("Failure"),failure:o})]),we({decode:s=>s._tag==="Success"?H(s.success):Z(s.failure),encode:s=>wt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return V(r.ast,{success:e,failure:t})}var fY=globalThis.Symbol.for("immer-draftable"),WC={};function fT(e,t,r,n,o){let s=pY(r,t,n),a=D2(t),i=class extends e{constructor(...[c,f]){let l=f?.["~payload"],p=l?.token===WC?l.value:r.make(c??{},f);super(p,{...f,disableChecks:!0,"~payload":{token:WC,value:p}})}static[Mp]=Mp;get[a](){return a}static[fY]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return re(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,f){return mg(s(this))(c??{},f)}static makeOption(c,f){return dg(s(this))(c??{},f)}static makeEffect(c,f){return s(this).makeEffect(c??{},f)}static annotate(c){return this.rebuild(Nn(this.ast,c))}static annotateKey(c){return this.rebuild(ip(this.ast,c))}static check(...c){return this.rebuild($o(this.ast,c))}static extend(c){return(f,u)=>{let l=Kp(f)?f:_e(f),p={...r.fields,...l.fields},h=Bh(p,r.ast.checks,{identifier:c});return fT(this,c,KC($o(h,l.ast.checks),p),u,o)}}static mapFields(c,f){return r.mapFields(c,f)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function lY(e){return new Ne(pe(t=>new e(t,{"~payload":{token:WC,value:t}})),Po())}function D2(e){return`~effect/Schema/Class/${e}`}function pY(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=D2(t),a=f=>f instanceof o||A(f,s),i=lY(o),c=V(new du([e.ast],()=>(f,u,l)=>a(f)?y(f):C(new xt(u,f,l)),{identifier:t,[Ch]:([f])=>({isConstructed:a,link:new ft(f,i)}),toCodec:([f])=>new ft(f.ast,i),toEquivalence:([f])=>f,toFormatter:([f])=>u=>`${o.identifier}(${f(u)})`,[zl]:fu(e.ast),...r}));return n=J(c,i)(e)}}function Kp(e){return Hg(e)}var L2=e=>(t,r)=>{let n=Kp(t)?t:_e(t);return fT(Jd,e,n,r,o=>({toString(){return`${o}(${N({...this})})`}}))},dY=e=>(t,r,n)=>{let o=Kp(r)?r.mapFields(s=>({_tag:Es(t),...s}),{unsafePreserveChecks:!0}):Bp(t,r);return L2(e??t)(o,n)},ox=e=>(t,r)=>{let n=Kp(t)?t:_e(t);return fT(kf,e,n,r,s=>({name:s}))},Vn=e=>(t,r,n)=>{let o=Kp(r)?r.mapFields(s=>({_tag:Es(t),...s}),{unsafePreserveChecks:!0}):Bp(t,r);return ox(e??t)(o,n)};function mY(e){return t=>t.annotate({toFormatter:e})}function hY(e,t){return nU(e.ast,t)}function gY(e){return t=>t.annotate({toEquivalence:e})}function xY(e){return oC(e.ast)}function yY(e,t){return Cp(e.ast,t)}function SY(e,t){let r=Cp(ku(e.ast),t);return Tg(r,t)}var EY=Sg,bY=Eg,lT=bg,IY=F1;function CY(e,t){return Y1(e,t)}function TY(e){return fU(e)}function wY(e){return lU(e)}function kY(e){return pU(e)}function AY(e,t){return r=>V(Nn(r.ast,{toCodecIso:()=>new ft(e.ast,Fh(t))}),{schema:r})}function vY(e){return Q1(e)}function OY(e){let t=dD(()=>r),r=Ze([e,Ce(t),_i($,t)]);return r}var sx=V(Nn(lu,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),_Y=_i($,sx),PY=_e({message:$,name:Ss($),stack:Ss($),cause:Ss(sx)}),FY=V(Nn(ON,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function RY(e){return ls(e.ast)}function $Y(e){return e.ast.context?.annotations}var B2="~effect/Terminal",pT="~effect/Terminal/QuitError",Vu=class extends ox("QuitError")({_tag:Es("QuitError")}){[pT]=pT},j2=e=>A(e,pT),Gn=Ye("effect/Terminal"),z2=e=>Gn.of({...e,[B2]:B2});import*as ix from"node:readline";var q2=L(function*(e=W2){let t=process.stdin,r=process.stdout,n=yield*Zc(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||is(n)};t.once("end",a),yield*ah(()=>le(()=>t.off("end",a)));let i=yield*JF({acquire:ln(le(()=>{let h=ix.createInterface({input:t,escapeCodeTimeout:50}),g=b=>oi(n,b),x=()=>{s=!1,is(n)};return s=!0,ix.emitKeypressEvents(t,h),h.on("line",g),h.once("close",x),t.isTTY&&t.setRawMode(!0),{rl:h,onClose:x,onLine:g}}),({rl:h,onClose:g,onLine:x})=>le(()=>{s=!1,h.off("line",x),h.off("close",g),t.isTTY&&t.setRawMode(!1),h.close(),o&&is(n)})),idleTimeToLive:"10 millis"}),c=le(()=>r.columns??0),f=le(()=>r.rows??0),u=Dt(function*(){let h=yield*Zc(),g=(T,w)=>{let P={input:Ns(T),key:{name:w.name??"",ctrl:!!w.ctrl,meta:!!w.meta,shift:!!w.shift}};oi(h,P),e(P)&&is(h)},x=setInterval(()=>{},2147483647),b=()=>{clearInterval(x),is(h)};return yield*ah(()=>le(()=>{clearInterval(x),t.off("keypress",g),t.off("end",b)})),t.on("keypress",g),o?b():(yield*kb(i),t.once("end",b)),h}),l=Ie(()=>xF(n).pipe(B(Re({onNone:()=>Qs(rs(kb(i),cs(n))),onSome:y})),kt(()=>new Vu({}))));return z2({columns:c,rows:f,readInput:u,readLine:l,display:h=>wl(sr(g=>{r.write(h,x=>Aw(x)?g(xe):g(C(pn({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:x}))))}))})}),H2=_c(Gn,q2(W2));function W2(e){let t=e.key;return t.name==="escape"||t.ctrl&&(t.name==="c"||t.name==="d")}var V2=H2;var G2=g_(qN,qm(uM,eM,lM,mM,V2));function DY(e){return{_tag:"Value",value:e}}function LY(e,t){return{_tag:"Record",keys:e,value:t}}function BY(e,t){return{_tag:"Array",length:e,value:t}}var K2=ge("effect/ConfigProvider",{defaultValue:()=>GY()}),jY={...er,toJSON(){return{_id:"ConfigProvider"}}},zY=e=>e;function qY(e,t){let r=Object.create(jY);return r.load=e,r.mapInput=t,r}function J2(e,t){return qY(r=>e(t(r)),r=>J2(e,n=>r(t(n))))}function HY(e){return J2(e,zY)}function WY(e,t){return e===""&&!t?void 0:e}function VY(e,t){let r=t?.preserveEmptyStrings===!0,n=KY(e);return HY(o=>y(JY(n,e,o,r)))}function GY(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return VY(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function KY(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 JY(e,t,r,n){let o=r.map(String).join("_"),s=WY(Object.hasOwn(t,o)?t[o]:void 0,n),a=ZY(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:DY(s);if(i.every(uc)){let f=Math.max(...i.map(u=>parseInt(u,10)))+1;return BY(f,s)}return LY(new Set(i),s)}function ZY(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 Q2="~effect/Config";var QY={...ao({label:"Config",evaluate(e){return this.parse(e.getRef(K2))}}),[Q2]:Q2,toJSON(){return{_id:"Config"}}};function Y2(e){let t=Object.create(QY);return t.evaluator=e,t.parse=r=>$t(e(r,[]),bl),t}var X2=(e,t,r)=>e.evaluator(t,r),YY=d(2,(e,t)=>Y2((r,n)=>ne(X2(e,r,n),Mt(t))));var XY=d(2,(e,t)=>Y2((r,n)=>ti(X2(e,r,n),o=>Se(o)?H(t):o))),eL=e=>e.pipe(YY(R),XY(v()));var ws={};En(ws,{Console:()=>rL,assert:()=>e9,clear:()=>t9,consoleWith:()=>Lt,count:()=>r9,countReset:()=>n9,debug:()=>o9,dir:()=>s9,dirxml:()=>a9,error:()=>cx,group:()=>i9,info:()=>c9,log:()=>Qt,table:()=>u9,time:()=>f9,timeLog:()=>l9,trace:()=>p9,warn:()=>d9,withGroup:()=>m9,withTime:()=>h9});var rL=cE,Lt=e=>ce(t=>e(t.getRef(rL))),e9=(e,...t)=>Lt(r=>G(()=>{r.assert(e,...t)})),t9=Lt(e=>G(()=>{e.clear()})),r9=e=>Lt(t=>G(()=>{t.count(e)})),n9=e=>Lt(t=>G(()=>{t.countReset(e)})),o9=(...e)=>Lt(t=>G(()=>{t.debug(...e)})),s9=(e,t)=>Lt(r=>G(()=>{r.dir(e,t)})),a9=(...e)=>Lt(t=>G(()=>{t.dirxml(...e)})),cx=(...e)=>Lt(t=>G(()=>{t.error(...e)})),i9=e=>Lt(t=>Wa(G(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>G(()=>{t.groupEnd()}))),c9=(...e)=>Lt(t=>G(()=>{t.info(...e)})),Qt=(...e)=>Lt(t=>G(()=>{t.log(...e)})),u9=(e,t)=>Lt(r=>G(()=>{r.table(e,t)})),f9=e=>Lt(t=>Wa(G(()=>{t.time(e)}),()=>G(()=>{t.timeEnd(e)}))),l9=(e,...t)=>Lt(r=>G(()=>{r.timeLog(e,...t)})),p9=(...e)=>Lt(t=>G(()=>{t.trace(...e)})),d9=(...e)=>Lt(t=>G(()=>{t.warn(...e)})),m9=d(e=>se(e[0]),(e,t)=>Lt(r=>Yf(G(()=>{t?.collapsed?r.groupCollapsed(t.label):r.group(t?.label)}),()=>e,()=>G(()=>{r.groupEnd()})))),h9=d(e=>se(e[0]),(e,t)=>Lt(r=>Yf(G(()=>{r.time(t)}),()=>e,()=>G(()=>{r.timeEnd(t)}))));var qx={};En(qx,{ChoiceWithValue:()=>bX,Date:()=>eX,Directory:()=>Y7,File:()=>Q7,FileParse:()=>sX,FileSchema:()=>aX,FileText:()=>oX,Finite:()=>X7,Int:()=>Z7,Literals:()=>tX,Never:()=>iX,Path:()=>rX,Redacted:()=>nX,String:()=>J7,atLeast:()=>xX,atMost:()=>yX,between:()=>SX,filter:()=>CX,filterMap:()=>TX,map:()=>mX,mapEffect:()=>hX,mapTryCatch:()=>gX,optional:()=>cX,orElse:()=>wX,orElseResult:()=>kX,variadic:()=>dX,withDefault:()=>fX,withDescription:()=>uX,withFallbackConfig:()=>lX,withFallbackPrompt:()=>pX,withMetavar:()=>IX,withSchema:()=>EX});var We="~effect/cli/CliError",mT=e=>A(e,We),xa=class extends Vn(`${We}/UnrecognizedOption`)("UnrecognizedOption",{option:$,command:Is(Ce($)),suggestions:Ce($)}){[We]=We;get message(){let t=this.suggestions.length>0?`
28
+ `,h)));r=r+p.substring(h)}}return Us(f)?f:null}let a=Ie(()=>o._tag==="Some"?Rt(o.value):Zm(e,{onSuccess:i,onFailure:Ya,onDone:c=>{if(o=R(c),r.length>0){let f=r;return r="",n=!1,y([f])}return Rt(c)}}));function i(c){let f=s(c);return f!==null?y(f):a}return a}));var DF=d(2,(e,t)=>dr((r,n)=>B(Pn(e)(r,n),o=>Pn(t)(o,n))));var xh=e=>dr((t,r)=>{let n;return y(Ie(()=>n||e.pipe(il(r),B(o=>Pn(o)(t,r)),B(o=>n=o))))});var g4=(e,t,r)=>Ie(()=>{let n=Oc(),o=Pn(e)(Rt(),n);return Ir(B(o,t),r||y).pipe(Co(s=>fn(n,s)))});var Ib=d(3,(e,t,r)=>Ie(()=>{let n=t();return g4(e,o=>Mc({while:Dr,body:()=>o,step:s=>{n=r(n,s)}}),()=>y(n))}));var Cb=(e,t)=>Pn(e)(Rt(),t);var x4="~effect/Stream",y4={_R:F,_E:F,_A:F},LF=function(e){this.channel=e};LF.prototype={[x4]:y4,pipe(){return re(this,arguments)}};var BF=e=>new LF(e);var jF="~effect/Sink",zF=y([void 0]),E4={_A:F,_In:F,_L:F,_E:F,_R:F},b4={[jF]:E4,pipe(){return re(this,arguments)}},Dl=e=>A(e,jF),Tb=e=>yh((t,r)=>Pn(e)(t,r).pipe(B(To({disableYield:!0})),Ir(y)));var yh=e=>{let t=Object.create(b4);return t.transform=e,t},I4=e=>dr((t,r)=>y(B(e.transform(t,r),Rt)));var C4=e=>yh(()=>e);var qF=e=>C4(C(e));var Ll=yh(e=>Ir(To(e,{disableYield:!0}),()=>zF));var HF=e=>T4(Qa(t=>e(t),{discard:!0})),T4=e=>yh(t=>t.pipe(B(e),To({disableYield:!0}),Ir(()=>zF)));var WF=e=>Tb(xh(ne(e,I4)));var w4="~effect/RcRef",Bl={_tag:"Empty"},k4={_tag:"Closed"},A4={_A:F,_E:F},wb=class{[w4]=A4;pipe(){return re(this,arguments)}state=Bl;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},GF=e=>El(t=>{let r=t.context,n=ct(r,al),o=new wb(e.acquire,r,n,e.idleTimeToLive!==void 0?Ut(e.idleTimeToLive):void 0);return kr(Bm(n,()=>{let s=o.state;return o.state=k4,s._tag==="Acquired"?fn(s.scope,vn):s._tag==="Acquiring"?mh(s.fiber):xe}),o)}),v4=(e,t)=>{switch(e.state._tag){case"Closed":return ei;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?kr(mh(r.fiber),r):y(r)}case"Acquiring":{let r=e.state;return r.awaiters++,VF(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Oc(),o=ss(e.acquire,rr(e.context,al,n)).pipe(B(s=>{if(e.state!==r)return ei;let a={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,y(a)}),Co(s=>ut(s)?xe:(e.state===r&&(e.state=Bl),fn(n,s))));return r.fiber=Wc(rF().context)(o),VF(e,r,t)}}},VF=(e,t,r)=>Co(r(tF(t.fiber)),n=>{let o=t.acquired;return o!==void 0?sl(n)?JF(e,o):xe:--t.awaiters>0||e.state!==t?xe:(e.state=Bl,mh(t.fiber))}),KF=e=>{let t=e;return zc(r=>B(Tl,n=>B(v4(t,r),o=>kr(Bm(n,()=>JF(t,o)),o.value))))},JF=(e,t)=>{if(t.refCount--,t.refCount>0)return xe;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Bl),fn(t.scope,vn)):mc(r)?(t.fiber=zc(n=>B(n(nh(r)),()=>e.state===t&&t.refCount===0?(e.state=Bl,fn(t.scope,vn)):xe)).pipe(Bc(le(()=>{t.fiber=void 0})),Wc(e.context),nF(e.scope)),xe):xe};var ZF=GF,kb=KF;var P4="~effect/Stream",si=e=>A(e,P4);var dn=BF;var YF=e=>dn(Ml(e)),F4=(e,t)=>dn(dr((r,n)=>B(Cb(e.channel,n),o=>t(o,n))));var Ab=e=>e.channel,XF=(e,t)=>dn(_F(e,t)),Yc=dn(FF);var eR=e=>dn(PF(()=>e().channel)),vb=e=>dn(RF(e));var ea=e=>dn(xh(ne(e,Ab)));var R4=d(2,(e,t)=>eR(()=>{let r=0;return dn($F(e.channel,Ft(n=>t(n,r++))))}));var tR=d(e=>si(e[0])&&si(e[1]),(e,t,r)=>dn(MF(Ab(e),Ab(t),r)));var Eh=d(2,(e,t)=>F4(e,(r,n)=>le(()=>{let o,s,a=Ie(()=>{if(s!==void 0){let c=s;return s=void 0,y(c)}return r}).pipe(_n(c=>(o=An(c),Rt()))),i=ne(Ie(()=>t.transform(a,n)),([c,f])=>(s=f,Da(c)));return Ie(()=>o||i)})));var rR=d(e=>si(e[0]),(e,t)=>eR(()=>{let r=new TextDecoder(t?.encoding);return R4(e,n=>r.decode(n,{stream:!0}))}));var nR=e=>e.channel.pipe(DF(UF()),dn);var Ob=d(2,(e,t)=>eb(r=>Cb(e.channel,r).pipe(B(n=>t.transform(n,r)),ne(([n])=>n)))),oR=e=>Ib(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t});var sR=e=>Ib(e.channel,()=>"",(t,r)=>t+r.join(""));var bh="~effect/FileSystem",Fn=Ye("effect/FileSystem"),_b=e=>Fn.of({...e,[bh]:bh,exists:t=>Zn(e.access(t),kr(!0),ns("PlatformError",r=>r.reason._tag==="NotFound"?y(!1):C(r))),readFileString:(t,r)=>B(e.readFile(t),n=>ht({try:()=>new TextDecoder(r).decode(n),catch:o=>pn({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:L(function*(t,r){let n=yield*e.open(t,{flag:"r"}),o=r?.offset===void 0?void 0:Ol(r.offset);o&&(yield*n.seek(o,"start"));let s=r?.bytesToRead===void 0?void 0:Ol(r.bytesToRead),a=BigInt(0),i=Number(BigInt(r?.chunkSize??64*1024)),c=n.readAlloc(i);return YF(y(B(Ie(()=>s!==void 0&&s<=a?Rt():s!==void 0&&s-a<i?n.readAlloc(Number(s-a)):c),Re({onNone:()=>Rt(),onSome:f=>(a+=BigInt(f.length),y(Da(f)))}))))},ea),sink:(t,r)=>Zn(e.open(t,{...r,flag:r?.flag??"w"}),ne(n=>HF(o=>n.writeAll(o))),WF),writeFileString:(t,r,n)=>B(ht({try:()=>new TextEncoder().encode(r),catch:o=>pn({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),o=>e.writeFile(t,o,n))}),gt=(e,t)=>Jr({module:"FileSystem",method:e,_tag:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),aR=e=>Fn.of({[bh]:bh,access(t){return C(gt("access",t))},chmod(t){return C(gt("chmod",t))},chown(t){return C(gt("chown",t))},copy(t){return C(gt("copy",t))},copyFile(t){return C(gt("copyFile",t))},glob(t){return C(gt("glob",t))},exists(){return y(!1)},link(t){return C(gt("link",t))},makeDirectory(){return ar("not implemented")},makeTempDirectory(){return ar("not implemented")},makeTempDirectoryScoped(){return ar("not implemented")},makeTempFile(){return ar("not implemented")},makeTempFileScoped(){return ar("not implemented")},open(t){return C(gt("open",t))},readDirectory(t){return C(gt("readDirectory",t))},readFile(t){return C(gt("readFile",t))},readFileString(t){return C(gt("readFileString",t))},readLink(t){return C(gt("readLink",t))},realPath(t){return C(gt("realPath",t))},remove(){return xe},rename(t){return C(gt("rename",t))},sink(t){return qF(gt("sink",t))},stat(t){return C(gt("stat",t))},stream(t){return vb(gt("stream",t))},symlink(t){return C(gt("symlink",t))},truncate(t){return C(gt("truncate",t))},utimes(t){return C(gt("utimes",t))},watch(t){return vb(gt("watch",t))},writeFile(t){return C(gt("writeFile",t))},writeFileString(t){return C(gt("writeFileString",t))},...e}),$4=e=>Eo(Fn)(aR(e)),eu="~effect/FileSystem/File",N4=e=>A(e,eu),jl=class extends Ye()("effect/FileSystem/WatchBackend"){};var fs="~effect/Path",Oo=Ye("effect/Path");function iR(e,t){let r="",n=0,o=-1,s=0,a;for(let i=0;i<=e.length;++i){if(i<e.length)a=e.charCodeAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf("/");if(c!==r.length-1){c===-1?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),o=i,s=0;continue}}else if(r.length===2||r.length===1){r="",n=0,o=i,s=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(o+1,i):r=e.slice(o+1,i),n=i-o-1;o=i,s=0}else a===46&&s!==-1?++s:s=-1}return r}function M4(e,t){let r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}function U4(e){if(e.protocol!=="file:")return C(new vo({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));if(e.hostname!=="")return C(new vo({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)|32;if(t[r+1]==="2"&&n===102)return C(new vo({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return y(decodeURIComponent(t))}var cR=function(){let t="",r=!1,n;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let a=globalThis.process;n===void 0&&"process"in globalThis&&typeof a=="object"&&a!==null&&typeof a.cwd=="function"&&(n=a.cwd()),s=n}s.length!==0&&(t=s+"/"+t,r=s.charCodeAt(0)===47)}return t=iR(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},D4=47;function L4(e){let t=new URL("file://"),r=cR(e);return e.charCodeAt(e.length-1)===D4&&r[r.length-1]!=="/"&&(r+="/"),t.pathname=W4(r),y(t)}var B4=/%/g,j4=/\\/g,z4=/\n/g,q4=/\r/g,H4=/\t/g;function W4(e){return e.includes("%")&&(e=e.replace(B4,"%25")),e.includes("\\")&&(e=e.replace(j4,"%5C")),e.includes(`
29
+ `)&&(e=e.replace(z4,"%0A")),e.includes("\r")&&(e=e.replace(q4,"%0D")),e.includes(" ")&&(e=e.replace(H4,"%09")),e}var Pb=Oo.of({[fs]:fs,resolve:cR,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;return e=iR(e,!t),e.length===0&&!t&&(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let e;for(let t=0;t<arguments.length;++t){let r=arguments[t];r.length>0&&(e===void 0?e=r:e+="/"+r)}return e===void 0?".":Pb.normalize(e)},relative(e,t){if(e===t||(e=Pb.resolve(e),t=Pb.resolve(t),e===t))return"";let r=1;for(;r<e.length&&e.charCodeAt(r)===47;++r);let n=e.length,o=n-r,s=1;for(;s<t.length&&t.charCodeAt(s)===47;++s);let i=t.length-s,c=o<i?o:i,f=-1,u=0;for(;u<=c;++u){if(u===c){if(i>c){if(t.charCodeAt(s+u)===47)return t.slice(s+u+1);if(u===0)return t.slice(s+u)}else o>c&&(e.charCodeAt(r+u)===47?f=u:u===0&&(f=0));break}let p=e.charCodeAt(r+u),h=t.charCodeAt(s+u);if(p!==h)break;p===47&&(f=u)}let l="";for(u=r+f+1;u<=n;++u)(u===n||e.charCodeAt(u)===47)&&(l.length===0?l+="..":l+="/..");return l.length>0?l+t.slice(s+f):(s+=f,t.charCodeAt(s)===47&&++s,t.slice(s))},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;return n===-1?r?"/":".":r&&n===1?"//":e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,i=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else i===-1&&(o=!1,i=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(n=s):(a=-1,n=i))}return r===n?n=i:n===-1&&(n=e.length),e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else n===-1&&(o=!1,n=s+1);return n===-1?"":e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let i=e.charCodeAt(a);if(i===47){if(!o){r=a+1;break}continue}n===-1&&(o=!1,n=a+1),i===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return M4("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;n?(t.root="/",o=1):o=0;let s=-1,a=0,i=-1,c=!0,f=e.length-1,u=0;for(;f>=o;--f){if(r=e.charCodeAt(f),r===47){if(!c){a=f+1;break}continue}i===-1&&(c=!1,i=f+1),r===46?s===-1?s=f:u!==1&&(u=1):s!==-1&&(u=-1)}return s===-1||i===-1||u===0||u===1&&s===i-1&&s===a+1?i!==-1&&(a===0&&n?t.base=t.name=e.slice(1,i):t.base=t.name=e.slice(a,i)):(a===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,i)):(t.name=e.slice(a,s),t.base=e.slice(a,i)),t.ext=e.slice(s,i)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir="/"),t},sep:"/",fromFileUrl:U4,toFileUrl:L4,toNamespacedPath:F});var hi={};En(hi,{fdName:()=>QI,isCommand:()=>Kh,isPipedCommand:()=>s3,isStandardCommand:()=>o3,make:()=>cp,parseFdName:()=>up,pipeTo:()=>a3,prefix:()=>i3,setCwd:()=>GI,setEnv:()=>KI});var Su={};En(Su,{ChildProcessSpawner:()=>aa,ExitCode:()=>zI,ProcessId:()=>qI,make:()=>HI,makeHandle:()=>Gh});function ls(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Ih(e){return t=>ls(t)?.[e]}var Ar="~structural",ai="~identifier",zl="~sentinels",Ch="~constructor",uR=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],tu=Ih("identifier"),Rb=Ih(ai),$b=Ih("title");var ql=bn(e=>{let t=ls(e)?.identifier;return typeof t=="string"?t:e.getExpected(ql)}),fR=new Set([zl,Ar,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var me=Symbol();var Gt=ts,vr=Gt(me),je=Gt(me),Hl=e=>e===me?v():R(e),Nb=e=>e._tag==="None"?vr:Gt(e.value);var Gl="~effect/SchemaIssue/Issue";function Ub(e){return A(e,Gl)&&e[Gl]===Gl}function V4(e){return Object.hasOwn(e,"input")}var Zr=class{[Gl]=Gl;constructor(t,r){r?.reportInput===!0&&t!==me&&(this.input=t)}},lR=class extends Zr{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},pR=class extends Zr{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},At=class extends Zr{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},na=class extends Zr{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Db=class extends Zr{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},vt=class extends Zr{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},xt=class extends Zr{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},ue=class extends Zr{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Or(e,t,r,n,o){return new vt(e,[new At([t],r)],n,o)}var Kl=class extends Zr{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Jl=class extends Zr{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},dR=class extends Zr{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function Mb(e,t,r){if(Ub(e))return e;if(typeof e=="string")return new ue({message:e},t,r);let n=typeof e.issue=="string"?new ue({message:e.issue},t,r):e.issue;return new At(e.path,n)}function mR(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new ue(void 0,t,r):Mb(e,t,r)}function hR(e,t,r,n){return Array.isArray(t)?Us(t)?t.length===1?Mb(t[0],r,n):new vt(e,Ft(t,o=>Mb(o,r,n)),r,n):void 0:mR(t,r,n)}var gR=e=>{let t=nu(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return ra(ql(e.ast),e);case"InvalidValue":{let r=Lb(e);if(r!==void 0)return ra(r,e);let n=Th(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=Th(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=Th(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},xR=e=>nu(e.issue)??nu(e);function yR(e){return t=>({issues:ru(t,[],e?.leafHook??gR,e?.checkHook??xR)})}function Th(e){return V4(e)?N(e.input):void 0}function Lb(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function ra(e,t){let r=Th(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function ru(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 ru(e.issue,t,r,n);let s=Lb(e.issue);return[{path:t,message:s===void 0?ra(Bb(e.filter),e):ra(s,e.issue)}]}case"Encoding":return ru(e.issue,t,r,n);case"Pointer":return ru(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>ru(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:nu(e)??ra(ql(e.ast),e)}]:e.issues.flatMap(o=>ru(o,t,r,n));default:return[{path:t,message:r(e)}]}}function Bb(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=>Bb(r)).join(" & ")}}function G4(){return e=>Vl(e,"")}var SR=G4();function Vl(e,t){let r;switch(e._tag){case"Filter":{let n=xR(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return Vl(e.issue,t);let o=Lb(e.issue);r=o===void 0?ra(Bb(e.filter),e):ra(o,e.issue)}break}case"Encoding":return Vl(e.issue,t);case"Pointer":return Vl(e.issue,t+Id(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>Vl(n,t)).join(`
30
+ `);r=nu(e)??ra(ql(e.ast),e);break}default:r=gR(e);break}return t?`${r}
31
+ at ${t}`:r}function nu(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return nu(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 Zl(e){let t;for(let r of e.reasons){if(!$m(r)||!Ub(r.error))return;t??=r.error}return t}function Qr(e,t){let r=Zl(e);if(r===void 0)throw new Error(t,{cause:e});return r}var jb=Fc,bR=Ka,IR=b_,CR=I_,TR=C_,wR=IE,kR=T_;var AR=Gm;var vR=CE;var zb=k_,OR=A_;var qb=v_;var Hb=TE,Wb=pl,_R=wE;var PR=kE,Ql=O_;var FR=dl;var RR=OE;var $R=P_;var Vb=PE;var ou=e=>K4(typeof e=="string"?J4.encode(e):e),ii=e=>{let t=Q4(e),r=t.length;if(r%4!==0)return Z(new un({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 Z(new un({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=wh(t.charCodeAt(a))<<18|wh(t.charCodeAt(a+1))<<12|wh(t.charCodeAt(a+2))<<6|wh(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return H(s)}catch(o){return Z(new un({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},MR=e=>Mt(ii(e),t=>Z4.decode(t)),K4=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Rn[(e[n-1]&15)<<2|e[n]>>6],r+=Rn[e[n]&63];return n===t+1&&(r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=Rn[e[n-2]>>2],r+=Rn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Rn[(e[n-1]&15)<<2],r+="="),r},J4=new TextEncoder,Z4=new TextDecoder,Q4=e=>e.replace(/[\n\r]/g,""),Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yl=new Uint8Array(123).fill(255);for(let e=0;e<Rn.length;e++)Yl[Rn.charCodeAt(e)]=e;Yl[61]=0;var wh=e=>{if(e>=Yl.length||Yl[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return Yl[e]};var UR=e=>ou(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Kb=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return Z(new un({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 Z(new un({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,"/"),ii(n)},DR=e=>Mt(Kb(e),t=>Y4.decode(t)),Y4=new TextDecoder;var Xl=e=>Object.assign(Object.create(cy),e);function eG(e){return BR((t,r)=>C(e(t,r)))}function kh(e){return eG((t,r)=>{let n={message:e(t)};return ve(t)?new Kl(n,t.value,r):new Kl(n)})}var LR=kh(()=>"Encoding is not supported"),tG=Xl({_tag:"Passthrough"});function Po(){return tG}function pe(e){return Xl({_tag:"Transform",transform:e})}function ir(e){return Xl({_tag:"TransformEffect",transform:e})}function Ah(e){return Xl({_tag:"TransformOptional",transform:e})}function BR(e){return Xl({_tag:"TransformOptionalEffect",transform:e})}function Jb(){return Ah(()=>v())}function Zb(e){return BR(t=>{let r=ic(t,pt);return ve(r)?y(r):ti(e,R)})}function ci(){return pe(globalThis.String)}function vh(){return pe(globalThis.Number)}function jR(){return pe(globalThis.BigInt)}function Qb(){return pe(e=>new globalThis.Date(e))}function zR(){return pe(M_)}function qR(e){return ir((t,r)=>ht({try:()=>JSON.parse(t,e?.reviver),catch:()=>new ue({expected:"a valid JSON string"},t,r)}))}function HR(e){return ir((t,r)=>ht({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 ue({expected:"a JSON-serializable value"},t,r)}))}function Yb(){return pe(ou)}function Oh(){return pe(UR)}function _h(){return pe(Zd)}function WR(){return ir((e,t)=>kl(bl(ii(e)),()=>new ue({expected:"a valid Base64 string"},e,t)))}function VR(){return ir((e,t)=>Sr(MR(e),{onFailure:()=>C(new ue({expected:"a valid Base64 string"},e,t)),onSuccess:y}))}function GR(){return ir((e,t)=>Sr(Kb(e),{onFailure:()=>C(new ue({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function KR(){return ir((e,t)=>Sr(DR(e),{onFailure:()=>C(new ue({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function JR(){return ir((e,t)=>Sr(Ky(e),{onFailure:()=>C(new ue({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function ZR(){return ir((e,t)=>Sr(tA(e),{onFailure:()=>C(new ue({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function QR(){return pe(encodeURIComponent)}function YR(){return ir((e,t)=>{try{return y(globalThis.decodeURIComponent(e))}catch{return C(new ue({expected:"a valid URI component"},e,t))}})}function XR(){return pe(e=>n$(Array.from(e.entries())))}var rG=o$(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function e$(){return pe(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&rG(e).forEach(([n,o])=>{t.append(n,o)}),t})}function t$(){return pe(e=>n$(Array.from(e.entries())))}var nG=o$(In);function r$(){return pe(e=>typeof e=="object"&&e!==null?new URLSearchParams(nG(e)):new URLSearchParams)}function oG(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>uc(o)?globalThis.Number(o):o)}var sG=20;function n$(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,a])=>{let i=oG(s),c=t;for(let f=0;f<i.length;f++){let u=o.get(c),l=i[f]===""&&u!==void 0?u.length:i[f];u!==void 0&&typeof l=="number"&&(u.length=Math.max(u.length,l+1));let p=Object.hasOwn(c,l),h=p?c[l]:void 0;if(f===i.length-1){let g=o.get(h);if(g!==void 0)U(h,g.length++,a);else if(n.has(h))h.push(a);else if(p){let x=[h,a];n.add(x),U(c,l,x)}else U(c,l,a)}else{let g=i[f+1],x=typeof g=="number"||g==="";if(r.has(h)&&o.has(h)===x)c=h;else{let b={};r.add(b),x&&o.set(b,{parent:c,key:l,length:0}),U(c,l,b),c=b}}}});for(let[s,{key:a,length:i,parent:c}]of Array.from(o).reverse())c[a]===s&&i-Object.keys(s).length<=sG&&U(c,a,Object.assign(new Array(i),s));return t}function o$(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 s$=/^[+-]?\d+$/,eI="~effect/BigDecimal",aG={[eI]:eI,[Y](){let e=rI(this);return ie(Ae(String(e.value)),dt(e.scale))},[X](e){return tI(e)&&l$(this,e)===0},toString(){return`BigDecimal(${ps(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},tI=e=>A(e,eI),c$=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(aG);return r.value=e,r.scale=t,r},u$=(e,t)=>{let r=c$(e,t);return r.normalized=r,r};var $n=BigInt(0),iG=BigInt(1);var cG=BigInt(10),f$=u$($n,0);var rI=e=>{if(e.normalized===void 0)if(e.value===$n)e.normalized=f$;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=u$(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var uG=100,fG=[iG],Xb=(e,t)=>e===t?0:e<t?-1:1,a$=(e,t)=>{let r=`${e.value<$n?-e.value:e.value}`,n=`${t.value<$n?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==$n)return o<$n?-1:1;let s=Math.max(r.length,n.length);return mk(r.padEnd(s,"0"),n.padEnd(s,"0"))},l$=(e,t)=>{if(e.scale===t.scale)return Xb(e.value,t.value);let r=i$(e),n=i$(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>uG)return r===-1?a$(t,e):a$(e,t);let a=fG[s]??=cG**BigInt(s);return o>0?Xb(e.value,t.value*a):Xb(e.value*a,t.value)},su=tc(l$);var i$=e=>e.value===$n?0:e.value<$n?-1:1;var p$=e=>{if(e==="")return R(f$);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)||!s$.test(c))return v()}else t=e,r=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),f=t.slice(a+1);o=`${c}${f}`,s=f.length}else o=t,s=0;if(!s$.test(o))return v();let i=s-r;return Number.isSafeInteger(i)?R(c$(BigInt(o),i)):v()};var ps=e=>{let t=rI(e);if(Math.abs(t.scale)>=16)return lG(t);let r=t.value<$n,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},lG=e=>{if(pG(e))return"0e+0";let t=rI(e),r=`${t.value}`,n=t.value<$n?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 pG=e=>e.value===$n;var Ph=class extends Ps{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ph(this.encode,this.decode)}},tp="~effect/SchemaTransformation/Transformation",Ne=class extends Ps{[tp]=tp;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ne(this.encode,this.decode)}};function dG(e){return A(e,tp)&&e[tp]===tp}var Fh=e=>dG(e)?e:new Ne(e.decode,e.encode);function Nt(e){return new Ne(ir(e.decode),ir(e.encode))}function we(e){return new Ne(pe(e.decode),pe(e.encode))}function Rh(e){return new Ne(Ah(e.decode),Ah(e.encode))}function m$(){return new Ne(zR(),Po())}var mG=new Ne(Po(),Po());function au(){return mG}var iu=new Ne(vh(),ci()),$h=new Ne(jR(),ci()),nI=new Ne(Qb(),pe(yy)),h$=new Ne(Qb(),pe(e=>e.getTime()));var oI=Nt({decode:(e,t)=>Re(VP(e),{onNone:()=>C(new ue({expected:"a valid ByteSize string"},e,t)),onSome:y}),encode:e=>y(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),g$=Nt({decode:(e,t)=>Re(cb(e),{onNone:()=>C(new ue({expected:"a non-negative bigint byte count"},e,t)),onSome:y}),encode:e=>y(lh(e))}),x$=Nt({decode:(e,t)=>Re(cb(e),{onNone:()=>C(new ue({expected:"a non-negative safe-integer byte count"},e,t)),onSome:y}),encode:(e,t)=>Re(KP(e),{onNone:()=>C(new ue({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:y})}),hG=e=>Lr(e)&&typeof e.message=="string",y$=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:E$(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},gG=e=>{try{let t=va(e);return t===void 0?N(e):JSON.parse(t)}catch{return N(e)}},xG=(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},S$=e=>{let t=new WeakSet,r=n=>{if(_w(n)){if(t.has(n))return"[Circular]";t.add(n);let o=xG(n,e,r);return t.delete(n),o}return gG(n)};return r},E$=e=>hG(e)?y$(e):e,b$=e=>we({decode:y$,encode:t=>S$(e)(t)}),I$=e=>we({decode:E$,encode:S$(e)});function C$(){return we({decode:hk,encode:Oy})}function T$(){return we({decode:Ns,encode:tr})}function w$(e){return we({decode:$a,encode:e?.onNoneEncoding===null?Oy:tr})}function k$(){return Rh({decode:R,encode:ac})}function A$(){return Rh({decode:e=>e.pipe(ic(pt),R),encode:ac})}var sI=Nt({decode:(e,t)=>URL.canParse(e)?y(new URL(e)):C(new ue({expected:"a valid URL string"},e,t)),encode:e=>y(e.href)});var aI=new Ne(WR(),Yb()),v$=new Ne(VR(),Yb()),O$=new Ne(KR(),Oh()),_$=new Ne(ZR(),_h()),P$=new Ne(YR(),QR());function F$(e){return new Ne(qR(e??{}),HR(e))}var R$=new Ne(XR(),e$()),$$=new Ne(t$(),r$());function sa(e){return t=>t._tag===e}var pu=sa("Declaration");var yG=sa("Never");var uu=sa("Literal"),cI=sa("UniqueSymbol");var gI=sa("Arrays"),SG=sa("Objects"),q$=sa("Union"),H$=sa("Suspend"),ft=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Ro={},Fo=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}},N$="~effect/Schema",yt=class{[N$]=N$;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}>`}},du=class extends yt{_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===me?vr:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=fi(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new du(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>"}},EG=class extends yt{_tag="Null";getParser(){return Wh(this,null)}getExpected(){return"null"}},xI=new EG;var bG=class extends yt{_tag="Undefined";getParser(){return Wh(this,void 0)}toCodecJson(){return Je(this,[W$])}getExpected(){return"undefined"}},W$=new ft(xI,new Ne(pe(()=>{}),pe(()=>null))),yI=new bG;var IG=class extends yt{_tag="Void";getParser(){let e=Gt(void 0);return t=>t===me?vr:e}toCodecJson(){return Je(this,[W$])}getExpected(){return"void"}},V$=new IG;var CG=class extends yt{_tag="Never";getParser(){return Un(this,Ow)}getExpected(){return"never"}},SI=new CG,TG=class extends yt{_tag="Any";getParser(){return Un(this,ly)}getExpected(){return"any"}},G$=new TG,wG=class extends yt{_tag="Unknown";getParser(){return Un(this,ly)}getExpected(){return"unknown"}},ds=new wG,kG=class extends yt{_tag="ObjectKeyword";getParser(){return Un(this,mf)}getExpected(){return"object | array | function"}},K$=new kG,J$=class extends yt{_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 ${N(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Un(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 Je(this,[new ft(new _r(Object.keys(e).map(t=>new Xr(t))),new Ne(pe(t=>e[t]),ci()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function iI(e){return typeof e=="number"?`parts[${e}]`:e}function uI(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${iI(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=iI(t);n=!e.checks&&e.parts.every((s,a)=>uI(s,`${o}.parts[${a}]`,r));break}case"Union":{let o=iI(t);n=!e.checks&&e.types.every((s,a)=>uI(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var EI=class extends yt{_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 f=0;f<e.length;f++){let u=e[f];if(!uI(u,f,i))throw new Error(`Invalid TemplateLiteral part ${u._tag}`);s.push(u),a.push(u._tag==="Literal"?globalThis.String(u.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let f=s.length-1;f>=0;f--)c[f]=c[f+1]+(a[f]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new mn(!1,this.parts.map($I),[]),r=e(xu(Yr,t,Q$(this)));return(n,o)=>{if(n===me)return vr;let s=r(n,o);return s._tag==="Success"?je:Vt(s,{onSuccess:()=>n,onFailure:a=>new vt(this,[a],n,o)})}}getExpected(){return"string"}matchPart(e,t){return CN(this,e,t)===void 0?void 0:e}};function Z$(e){let t=bn(o=>{if(o._tag!=="Union")return o;let s=fi(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new _r(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new EI(e.map(o=>t(Mn(o)))),n=new mn(!1,e.map($I),[]);return xu(r,n,Q$(r))}function Q$(e){return new Ne(ir((t,r)=>{let n=CN(e,t,r);return n?y(n):C(new ue({expected:"a string matching template literal parts"},t,r))}),pe(t=>t.join("")))}var Y$=class extends yt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return Wh(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return Je(this,[new ft(e===void 0?SI:new Xr(globalThis.String(this.symbol)),kN.transformation)])}getExpected(){return globalThis.String(this.symbol)}},Xr=class extends yt{_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 ${N(e)}`);this.literal=e}getParser(){return Wh(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?M$(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:M$(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function M$(e){let t=globalThis.String(e.literal);return Je(e,[new ft(new Xr(t),new Ne(pe(()=>e.literal),pe(()=>t)))])}var AG=class extends yt{_tag="String";getParser(){return Un(this,In)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Dn(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Yr=new AG,vG=class extends yt{_tag="Number";getParser(){return Un(this,pf)}matchKey(e,t){return this._match(VG,e,t)}matchPart(e,t){return this._match(dI,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:Dn(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(fI(this.checks,"effect/schema/isFinite")||fI(this.checks,"effect/schema/isInt"))?this:Je(this,[LG])}toCodecStringTree(){return this.toCodecJson()===this?Je(this,[GG]):Je(this,[KG])}getExpected(){return"number"}};function fI(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&fI(r.checks,t))}var bI=new vG,OG=class extends yt{_tag="Boolean";getParser(){return Un(this,gd)}getExpected(){return"boolean"}},X$=new OG,_G=class extends yt{_tag="Symbol";getParser(){return Un(this,fy)}matchKey(e,t){return t.disableChecks||!this.checks?e:Dn(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Je(this,[kN])}getExpected(){return"symbol"}},eN=new _G,PG=class extends yt{_tag="BigInt";getParser(){return Un(this,Aw)}matchPart(e,t){if(!mI.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:Dn(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return Je(this,[ZG])}getExpected(){return"bigint"}},tN=new PG,mn=class extends yt{_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 f=0;f<t.length;f++)if(Kt(t[f]))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 f=1;f<r.length;f++)if(Kt(r[f]))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(u,l){return l<s?n[l]:l>=u?o[l-u+1]:o[0]}let c=u=>{let{input:l,len:p,options:h}=u;if(r.rest.length===0&&p>s)for(let g=s;g<p;g++){let x=new Db(r,l[g],h),b=new At([g],x);if(h.errors==="all")u.issues?u.issues.push(b):u.issues=[b];else return C(new vt(r,[b],l,h))}return u.issues?C(new vt(r,u.issues,l,h)):Gt(u.output)},f=(u,l)=>{let p=u.length,h={ast:r,getParser:i,input:u,len:p,tailThreshold:Math.max(s,p-a),output:new globalThis.Array(p),issues:void 0,options:l},g=r.rest.length===0?s:Math.max(p,s+a),x=l.concurrency===void 0?1:tl(l.concurrency),b=x===1?RG(h,u,0,g):$G(h,u,{concurrency:x,end:g});if(!b)return c(h);if($e(b))return $t(b,()=>c(h));let T=!0;return Ie(()=>T?(T=!1,B(b,()=>c(h))):f(u,l))};return(u,l)=>{if(u===me)return vr;try{return Array.isArray(u)?(n||(n=r.elements.map(p=>({ast:p,parser:t(p)})),o=r.rest.map(p=>({ast:p,parser:t(p)}))),f(u,l)):C(new xt(r,u,l))}catch(p){return ar(p)}}}_rebuild(e,t,r){let n=fi(this.elements,e),o=fi(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new mn(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 FG(e,t,r,n){if(r._tag==="Failure")return Uh(e,e.ast,n,r);let o=r===je?t:r[fe];if(o!==me)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Kt(s.ast))return;let a=new At([n],new na(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return An(new vt(e.ast,[a],e.input,e.options))}}var rN={onItem(e,t,r){let n=r<e.len?t:me;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:FG},RG=_m()(rN),$G=Pm()(rN),Uh=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Zl(n.cause);if(o===void 0)return So(Vs(n.cause,a=>new vt(t,[new At([r],a)],e.input,e.options)));let s=new At([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return An(new vt(t,[s],e.input,e.options))},Lh="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function oa(e,t,r=Ro){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(RI(Mn(t)))}var II=class{name;type;constructor(e,t){this.name=e,this.type=t}};function nN(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(nN);default:return!1}}function oN(e){let t=hu(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(oN);default:return!1}}function NG(e){return nN(e)&&oN(e)}var CI=class{parameter;type;constructor(e,t){if(!NG(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Kt(t)&&!IN(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},rp=class extends yt{_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 Un(r,yd);let s,a,i=()=>(s||(s=r.propertySignatures.map(l=>({parser:t(l.type),name:l.name,type:l.type})),a=o?r.indexSignatures.map(l=>({is:l,parserKey:e(RI(l.parameter)),parserValue:t(l.type)})):void 0),s),c=()=>{let l=new Set(r.propertySignatures.map(b=>typeof b.name=="number"?globalThis.String(b.name):b.name)),p=(b,T,w,P,O)=>{if(O._tag==="Failure")return Uh(b,r,T,O)??vn;let m=O===je?P:O[fe];if(w!==me&&m!==me){if(n&&(l.has(T)||l.has(typeof w=="number"?globalThis.String(w):w)))return vn;U(b.out,w,m)}return vn},h=(b,T,w,P)=>{if(!P){let E=w.parserKey(T,b.options);if(!$e(E))return B(Js(E),I=>h(b,T,w,I));P=E}if(P._tag==="Failure")return Uh(b,r,T,P)??vn;let O=P===je?T:P[fe],m=b.input[T],S=w.parserValue(m,b.options);return $e(S)?p(b,T,O,m,S):B(Js(S),E=>p(b,T,O,m,E))},g=(b,T,w)=>{let P=b.input[T],O=w.parserValue(P,b.options);return $e(O)?p(b,T,T,P,O):B(Js(O),m=>p(b,T,T,P,m))},x=o?Pm()({onItem:(b,[T,w])=>w.is.parameter===Yr?g(b,T,w):h(b,T,w),step:(b,T,w)=>w._tag==="Failure"?w:void 0}):void 0;return nb(function*(b,T){if(b===me)return me;if(!(typeof b=="object"&&b!==null&&!Array.isArray(b)))return yield*C(new xt(r,b,T));i();let w=b,P={},O={ast:r,input:w,out:P,issues:void 0,options:T},m=T.errors==="all",S=T.onExcessProperty==="error",E=T.concurrency===void 0?1:tl(T.concurrency),I=o&&S?r.indexSignatures.map(k=>oa(w,k.parameter,T)):void 0;if(S){let k=I?new Set(l):l;if(I)for(let M of I)for(let z of M)k.add(z);let _=Reflect.ownKeys(w);for(let M=0;M<_.length;M++){let z=_[M];if(!k.has(z)&&Object.prototype.propertyIsEnumerable.call(w,z)){let de=new Db(r,w[z],T),oe=new At([z],de);if(m){O.issues?O.issues.push(oe):O.issues=[oe];continue}else return yield*C(new vt(r,[oe],b,T))}}}if(n){let k=E===1?U$(O,s):MG(O,s,{concurrency:E});k&&(yield*k)}if(o&&E===1)for(let k=0;k<o;k++){let _=a[k],M=_.is.parameter===Yr?g:h,z=I?.[k]??(_.is.parameter===Yr?Object.keys(w):oa(w,_.is.parameter,T));for(let de=0;de<z.length;de++){let oe=M(O,z[de],_);if(!$e(oe))yield*oe;else if(oe._tag==="Failure")return yield*oe}}else if(x){let k=Ua();for(let M=0;M<o;M++){let z=a[M],de=I?.[M]??(z.is.parameter===Yr?Object.keys(w):oa(w,z.is.parameter,T));for(let oe=0;oe<de.length;oe++)k.push([de[oe],z])}let _=x(O,k,{concurrency:E});_&&(yield*_)}return O.issues?yield*C(new vt(r,O.issues,b,T)):P})};if(o)return c();let f,u=(l,p,h)=>{let g=s[p];return B(Js(h),x=>{let b=lI(l,g,x);if(b)return b;let T=()=>Gt(l.out),w=U$(l,s.slice(p+1));return w?$t(w,T):T()})};return(l,p)=>{if(l===me)return vr;if(p.errors==="all"||p.onExcessProperty!==void 0||p.concurrency!==void 0&&tl(p.concurrency)!==1)return(f??=c())(l,p);if(!(typeof l=="object"&&l!==null&&!Array.isArray(l)))return C(new xt(r,l,p));let h=i(),g=l,x={},b={ast:r,input:g,out:x,issues:void 0,options:p};try{for(let T=0;T<h.length;T++){let w=h[T],P=w.name,O=cu(g,P),m=O?g[P]:me,S=w.parser(m,p);if(!$e(S))return u(b,T,S);if(S===je){O&&U(x,P,m);continue}let E=lI(b,w,S);if(E)return E}}catch(T){return ar(T)}return Gt(x)}}_rebuild(e,t,r,n){let o=fi(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new II(a.name,i)}),s=fi(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new CI(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new rp(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 lI(e,t,r){if(r._tag==="Failure")return Uh(e,e.ast,t.name,r);if(r===je)return;let n=r[fe];if(n!==me){U(e.out,t.name,n);return}if(delete e.out[t.name],!Kt(t.type)){let o=new At([t.name],new na(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return An(new vt(e.ast,[o],e.input,e.options))}}var sN={onItem(e,t){if(!cu(e.input,t.name))return t.parser(me,e.options);let r=e.input[t.name];return U(e.out,t.name,r),t.parser(r,e.options)},step:lI},U$=_m()(sN),MG=Pm()(sN);function TI(e,t){return e?t?[...e,...t]:e:t}function Bh(e,t,r){return new rp(Reflect.ownKeys(e).map(n=>new II(n,e[n].ast)),[],r,t)}function np(e){return e.ast}function wI(e,t=void 0){return new mn(!1,e.map(r=>r.ast),[],void 0,t)}function jh(e,t,r){return new _r(e.map(np),t,void 0,r)}function aN(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=TI(o,s.checks)}return new rp(r,n,void 0,o)}function iN(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new mn(e.isMutable,e.elements,t,void 0,e.checks)}function cN(e){if(e.encoding)throw new Error("mutable does not support encodings");return new mn(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var kI=Ta(e=>{for(;;){if(H$(e))return ds;let t=e.encoding;if(!t)return e.recur?.(kI,F)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==F))return ds;e=t[t.length-1].to}});function uN(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(uN)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function fu(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[zl];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Kt(r)){if(uu(r))return[{key:t.name,literal:r.literal}];if(cI(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Kt(t)){if(uu(t))return[{key:r,literal:t.literal}];if(cI(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>fu(kI(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return fu(e.thunk())}}var D$=new WeakMap,Mh=Object.freeze([]),L$=e=>e===null?"null":Array.isArray(e)?"array":typeof e,cu=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function op(e){let t=D$.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let u=0;u<e.length;u++){let l=e[u],p=kI(l);if(yG(p))continue;if(uu(p)||cI(p)){s??=new Map;let g=uu(p)?p.literal:p.symbol;i[u]=g;let x=s.get(g);x||s.set(g,x=[]),x.push(u)}else a=!1;let h=fu(p);if(h.length){r??=new Map,n++;for(let{key:g,literal:x}of h){let b=r.get(g);b||r.set(g,b=[new Map,new Set]),b[1].add(u);let T=b[0].get(x);T||b[0].set(x,T=new Set),T.add(u)}}else{o??={};let g=uN(p);for(let x of g)(o[x]??=[]).push(u)}}let c={},f=u=>c[u]??=Object.freeze(o?.[u]??Mh);if(a&&s)s.forEach(Object.freeze),t=u=>s.get(u)??Mh;else if(r?.size===1&&!o){let[u,[l]]=r.entries().next().value,p=new Map;for(let[g,x]of l)p.set(g,Object.freeze(Array.from(x)));let h=Object.freeze(e.map((g,x)=>x));t=(g,x)=>{if(mf(g)){let b=cu(g,u)?g[u]:void 0;if(b!==void 0)return p.get(b)??Mh;if(x)return h}return Mh}}else if(r){let u;for(let l of r)(!u||l[1][0].size>u[1][0].size)&&l[1][1].size===n&&(u=l);t=(l,p)=>{let h=L$(l);if(!mf(l))return f(h);let g=new Set(o?.[h]),x;if(u){let[b,[T]]=u,w=cu(l,b),P=w?l[b]:void 0;if(w&&(!p||P!==void 0)){let O=T.get(P);if(!O)return f(h);for(let m of O)g.add(m);x=b}}if(x===void 0)for(let[b,[T,w]]of r){let P=cu(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let m=T.get(O);if(m)for(let S of m)g.add(S)}else if(p)for(let m of w)g.add(m)}for(let[b,[T,w]]of r){if(b===x)continue;let P=cu(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let m=T.get(O);for(let S of g)w.has(S)&&!m?.has(S)&&g.delete(S)}}return Array.from(g).sort((b,T)=>b-T)}}else t=u=>{let l=f(L$(u));return s?l.filter(p=>i[p]===void 0||i[p]===u):l};return D$.set(e,t),t}var _r=class extends yt{_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===me)return vr;let f=(a??=op(r.types))(i,n);if(f.length===0)return C(new Jl(r,[],i,c));if(f.length===1){let u=s(f[0])(i,c);return u._tag==="Success"?u:$e(u)?fN(r,u.cause,i,c):UG(r,u,i,c)}return lN(r,s,f,i,c)}}_rebuild(e,t,r){let n=fi(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new _r(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=Mn(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(uu);if(s.length>0)return`${j$(o.isMutable)}[ ${s.map(a=>e(a)+z$(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(a=>uu(a.type));if(s.length>0)return`{ ${s.map(a=>`${j$(a.type.context?.isMutable)}${Xn(a.name)}${z$(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function fN(e,t,r,n){let o=Zl(t);return o?An(new Jl(e,[o],r,n)):So(t)}function UG(e,t,r,n){return Cr(t,o=>fN(e,o,r,n))}function lN(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=DG(s,r);if(!a)return s.out?s.out:C(new Jl(e,s.issues??[],n,o));if($e(a))return B$(a,s);let i=!0;return Ie(()=>i?(i=!1,B$(a,s)):lN(e,t,r,n,o))}function B$(e,t){return $t(e,r=>t.out===je?y(t.input):t.out?t.out:C(new Jl(t.ast,t.issues??[],t.input,t.options)))}var DG=_m()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Zl(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]),An(new dR(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return vn}}}),pN=new _r([new Xr("Infinity"),new Xr("-Infinity"),new Xr("NaN")]);function j$(e){return e?"":"readonly "}function z$(e){return e?"?":""}var AI=class extends yt{_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 AI(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Dh=class extends Ps{_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 Dh(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Dh(this.run,this.annotations,!0)}and(e,t){return new ui([this,e],t)}},ui=class extends Ps{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new ui(this.checks,{...this.annotations,...e})}and(e,t){return new ui([this,e],t)}};function zh(e,t,r=!1){return new Dh((n,o,s)=>hR(o,e(n,o,s),n,s),t,r)}function qh(e,t){return new Dh((r,n,o)=>e(r)?void 0:new ue(void 0,r,o),t,!0)}function vI(e){return zh(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 OI=$o(bI,[vI()]),LG=new ft(new _r([OI,pN]),new Ne(vh(),pe(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function sp(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return zh(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 pI=new WeakMap;function ap(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&pI.set(r,mu(e)),r}function mu(e){let t=pI.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 pI.set(e,r),r}function Je(e,t){return e.encoding===t?e:ap(e,{encoding:t})}function li(e,t){if(e.context===t)return e;let r=mu(e);return r.context===t&&r.encoding===e.encoding?r:ap(e,{context:t})}function hu(e){return e.encoding?hu(e.encoding[e.encoding.length-1].to):e}function Nn(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return dN(e,zd(e.checks.slice(0,-1),r.annotate(t)))}return ap(e,{annotations:{...e.annotations,...t}})}function dN(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:ap(e,{checks:t})}function $o(e,t){return dN(e,TI(e.checks,t))}function gu(e,t){let r=t(e.to);return r===e.to?e:new ft(r,e.transformation)}function mN(e,t){let r=e,n=r[r.length-1],o=gu(n,t);return o===n?e:zd(e.slice(0,e.length-1),o)}function _I(e){return t=>t.encoding?Je(t,mN(t.encoding,e)):t}function Hh(e,t){return _I(r=>li(r,t))(e)}function pi(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Je(n,mN(n.encoding,r))}return e(n)}return Ta(r)}function hN(e,t){return PI(e,t,It(e))}function gN(e,t){return PI(Mn(e),t,e)}function PI(e,t,r){let n=new ft(e,t);return Je(r,r.encoding?[...r.encoding,n]:[n])}function fi(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 ip(e,t){let r=e.context?new Fo(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Fo(!1,!1,void 0,t);return li(e,r)}var di=Ta(e=>{let t=e.context?e.context.isOptional===!1?new Fo(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Fo(!0,!1);return BG(li(e,t))}),BG=_I(di),xN=bn(e=>di(new _r([e,yI]))),FI=Ta(e=>{let t=e.context?e.context.isMutable===!1?new Fo(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Fo(!1,!0);return jG(li(e,t))}),jG=_I(FI);function yN(e,t){let r=e.context?new Fo(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Fo(!1,!1,t);return li(e,r)}function xu(e,t,r){return PI(e,r,t)}function zG(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":xd(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 SN(e,t){let{literals:r,parameters:n}=zG(e);return new rp(r.map(o=>new II(o,t)),n.map(o=>new CI(o,t)))}function Kt(e){return e.context?.isOptional??!1}function EN(e){return e.context?.isMutable??!1}function bN(e){return e.annotations?.[Ar]===!0||e._tag==="FilterGroup"&&e.checks.every(bN)}function qG(e){function t(n){return bN(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Ma(r)?r:void 0}function HG(e){let t=!0;function r(n){return t=t&&!n.encoding&&!H$(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var It=Ta(e=>{let t=mu(e);if(t!==e){let n=It(t);return n===t&&e.encoding===void 0?e:li(n,e.context)}let r="recur"in e?e.recur(It):e;if("encodingChecks"in r&&r.encodingChecks){let n=HG(e)?r.encodingChecks:gI(r)||SG(r)||pu(r)&&r.typeParameters.length>0?qG(r.encodingChecks):void 0;return ap(r,{encodingChecks:void 0,checks:TI(r.checks,n)})}return r}),Mn=Ta(e=>It(en(e)));function WG(e,t){let r=t,n=r.length,o=r[n-1],s=[new ft(en(Je(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new ft(en(r[i-1].to),r[i].transformation.flip()));let a=en(o.to);return a.encoding?Je(a,[...a.encoding,...s]):Je(a,s)}var en=bn(e=>{if(e.encoding)return WG(e,e.encoding);let t=mu(e);if(t!==e){let r=en(t);return r===t?e:li(r,e.context)}return"flip"in e?e.flip(en):"recur"in e?e.recur(en):e});function IN(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(IN);default:return!1}}function Wh(e,t){let r=t===0?je:Gt(t);return(n,o)=>n===me?vr:n===t?r:C(new xt(e,n,o))}function Un(e,t){return(r,n)=>r===me?vr:t(r)?je:C(new xt(e,r,n))}function CN(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let f=0;f<o.length;f++){let u=o[f];if(u&&!t.includes(u))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(f,u){if(f===n.length)return u===s;if(i?.has(f*(s+1)+u))return!1;let l=n[f];if(f===n.length-1){let p=t.slice(u);if(l.matchPart(p,r)!==void 0)return a[f]=p,!0}else if(l._tag==="Literal"){let p=o[f];if(t.startsWith(p,u)&&c(f+1,u+p.length))return a[f]=p,!0}else{let p=s-e.suffixLengths[f+1],h=o[f+1],g=h===void 0?p:t.lastIndexOf(h,p);for(;g>=u;){let x=t.slice(u,g);if(l.matchPart(x,r)!==void 0&&c(f+1,g))return a[f]=x,!0;if(g===0)break;g=h===void 0?g-1:t.lastIndexOf(h,g-1)}}return i??=new Set,i.add(f*(s+1)+u),!1}return c(0,0)?a:void 0}var RI=pi(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(RI)}}),Vh=pi(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Vh)}}),$I=pi(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur($I)}}),TN="[\\s\\S]*?",dI=new globalThis.RegExp(`^${Lh}$`),VG=new globalThis.RegExp(`^(?:${Lh}|Infinity|-Infinity|NaN)$`);function NI(e){return sp(dI,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:dI.source}),...e})}var wN=$o(Yr,[NI()]),GG=new ft(wN,iu),KG=new ft(new _r([wN,pN]),iu),JG="-?\\d+",mI=new globalThis.RegExp(`^${JG}$`);function MI(e){return sp(mI,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:mI.source}),...e})}var UI=$o(Yr,[MI({expected:"a string representing a bigint"})]),ZG=new ft(UI,$h),QG="Symbol\\(([\\s\\S]*)\\)",hI=new globalThis.RegExp(`^${QG}$`),YG=$o(Yr,[DI()]),kN=new ft(YG,new Ne(pe(e=>globalThis.Symbol.for(hI.exec(e)[1])),ir((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?y(globalThis.String(e)):C(new Kl({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function DI(e){return sp(hI,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:hI.source}),...e})}function Dn(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=Dn(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 lR(a,i,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||a.aborted)return r}}}return r}function AN(e,t){let r=Dn(e,t,void 0,ds,{errors:"all"});if(r){let n=new vt(ds,r);return Z(n)}return H(t)}function vN(e){if(!pu(e))return;let t=e.annotations?.[Ch];return Cn(t)?t(e.typeParameters):void 0}function XG(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function e3(e){return e===void 0||typeof e=="string"}function ON(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 yu(e){return ON(e,XG)}var lu=new du([],()=>(e,t,r)=>yu(e)?je:C(new xt(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>BI}),_N=Nn(lu,{representation:{id:"effect/schema/MutableJson",payload:null}}),LI=new ft(lu,au()),PN=new ft(new _r([new mn(!1,[],[lu]),new rp([],[new CI(Yr,lu)])]),au());function t3(e){return ON(e,e3)}var r3=new du([],()=>(e,t,r)=>t3(e)?je:C(new xt(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),BI=new ft(r3,au());function jI(){return Object.assign(e=>e,{option:e=>R(e),result:e=>H(e),is:e=>!0})}var zI=jI(),qI=jI(),RN="~effect/process/ChildProcessSpawner/ChildProcessHandle",n3={[RN]:RN,...mt,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},Gh=e=>Object.setPrototypeOf({...e},n3),HI=e=>{let t=(n,o)=>e(n).pipe(ne(s=>rR(o?.includeStderr===!0?s.all:s.stdout)),ea),r=(n,o)=>nR(t(n,o));return aa.of({spawn:e,exitCode:n=>Qs(B(e(n),o=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>oR(r(n,o)),string:(n,o)=>sR(t(n,o))})},aa=class extends Ye()("effect/process/ChildProcessSpawner"){};var WI="~effect/process/ChildProcess",DN={...ao({label:"Command",evaluate(e){return co(e.context,aa).spawn(this)}}),[WI]:WI},Kh=e=>A(e,WI),o3=e=>e._tag==="StandardCommand",s3=e=>e._tag==="PipedCommand",mi=(e,t,r)=>Object.assign(Object.create(DN),{_tag:"StandardCommand",command:e,args:t,options:r}),Jh=(e,t,r={})=>Object.assign(Object.create(DN),{_tag:"PipedCommand",left:e,right:t,options:r}),cp=function(...t){if(JI(t[0])){let[s,...a]=t,i=ZI(s,a);return mi(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!JI(t[0])){let s=t[0];return function(a,...i){let c=ZI(a,i);return mi(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return mi(s,[],a)}let[r,n=[],o={}]=t;return mi(r,n,o)},a3=d(e=>Kh(e[0])&&Kh(e[1]),(e,t,r)=>Jh(e,t,r??{})),i3=function(...t){if(Kh(t[0])&&t.length>1){let[n,...o]=t,s=$N(o);return VI(n,s)}let r=$N(t);return n=>VI(n,r)},$N=e=>{if(JI(e[0])){let[n,...o]=e,s=ZI(n,o);return{command:s[0]??"",args:s.slice(1)}}let[t,r=[]]=e;return{command:t,args:r}},VI=(e,t)=>{switch(e._tag){case"StandardCommand":return mi(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return Jh(VI(e.left,t),e.right,e.options)}},GI=d(2,(e,t)=>{switch(e._tag){case"StandardCommand":return mi(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return Jh(GI(e.left,t),GI(e.right,t),e.options)}}),KI=d(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let r=e.options.env===void 0?t:{...e.options.env,...t};return mi(e.command,e.args,{...e.options,env:r})}case"PipedCommand":return Jh(KI(e.left,t),KI(e.right,t),e.options)}}),JI=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),up=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},QI=e=>`fd${e}`,ZI=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=c3(e,t,r,o,n);return r},c3=(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}=f3(n,s),f=UN(r,c,a);if(o===t.length)return f;let u=t[o],l=Array.isArray(u)?u.map(p=>NN(p)):[NN(u)];return UN(f,l,i)},NN=e=>typeof e==="string"?e:String(e),MN=new Set([" "," ","\r",`
32
+ `]),u3={x:3,u:5},f3=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let r=MN.has(t[0]),n=[],o=0;for(let a=0,i=0;a<e.length;a+=1,i+=1){let c=t[i];if(MN.has(c))o!==a&&n.push(e.slice(o,a)),o=a+1;else if(c==="\\"){let f=t[i+1];if(f===`
33
+ `)a-=1,i+=1;else if(f==="u"&&t[i+2]==="{"){let u=t.indexOf("}",i+3);parseInt(t.slice(i+3,u),16)>65535&&(a+=1),i=u}else i+=u3[f]??1}}let s=o===e.length;return s||n.push(e.slice(o)),{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},UN=(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 Zh from"node:child_process";import{PassThrough as YI}from"node:stream";var LN=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var Be=(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 Jr({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var Eu=e=>Tb(bb(l3(e),t=>[t])),l3=e=>dr(t=>{let r=e.evaluate();return y(p3({...e,writable:r,pull:t}))}),p3=e=>e.pull.pipe(B(t=>{let r=0;return sr(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(xe)};return s(),le(()=>{o=!0,e.writable.off("drain",s)})})}),To({disableYield:!0}),e.endOnDone!==!1?Ir(t=>"closed"in e.writable&&e.writable.closed?Rt(t):sr(r=>{let n=()=>r(Rt(t));return e.writable.once("finish",n),e.writable.end(),le(()=>{e.writable.off("finish",n)})})):F,Xa(sr(t=>{let r=n=>t(C(e.onError(n)));return e.writable.once("error",r),le(()=>{e.writable.off("error",r)})})));var bu=e=>dn(m3(e)),m3=e=>dr((t,r)=>h3({scope:r,readable:e.evaluate(),onError:e.onError??g3,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var h3=e=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??cF(void 0),o=e.latch??sF(!1);function s(){o.openUnsafe()}function a(f){n.current=An(e.onError(f)),o.openUnsafe()}function i(){n.current=An(Mm()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=Ie(function f(){let u=e.readable.read(e.chunkSize);if(u===null)return n.current?n.current:t.readableEnded?C(Mm()):(o.closeUnsafe(),B(o.await,f));let l=Da(u);for(;u=e.readable.read(e.chunkSize),u!==null;)l.push(u);return y(l)});return kr(cl(e.scope,le(()=>{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 g3=e=>new e_(e);var gi=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),No=(e,t,r)=>{let{commands:n}=WN(r),o=n.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Be("ChildProcess",e)(t,[o])},BN=1e3,y3=10,jN=e=>{let t=()=>{};e.on("error",t),e.once("close",()=>e.off("error",t))},zN=(e,t)=>{if(!hE(t))return!0;if(globalThis.process.platform==="win32")return!1;try{return globalThis.process.kill(-e.pid,0),!0}catch{return!1}},qN=(e,t=()=>{})=>{if(e.exitCode!==null||e.signalCode!==null){t(null);return}Zh.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t)},S3=Dt(function*(){let e=yield*Fn,t=yield*Oo,r=L(function*(m){if(!Fs(m.cwd))return yield*e.access(m.cwd),t.resolve(m.cwd)}),n=m=>m.extendEnv?{...globalThis.process.env,...m.env}:m.env,o=m=>si(m)?"pipe":m,s=m=>Dl(m)?"pipe":m,a=m=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};return Fs(m.stdin)?S:typeof m.stdin=="string"?{...S,stream:m.stdin}:si(m.stdin)?{...S,stream:m.stdin}:{stream:m.stdin.stream,encoding:m.stdin.encoding??S.encoding,endOnDone:m.stdin.endOnDone??S.endOnDone}},i=(m,S)=>{let E=m[S];return Fs(E)?{stream:"pipe"}:typeof E=="string"?{stream:E}:Dl(E)?{stream:E}:{stream:E.stream}},c=m=>{if(Fs(m.additionalFds))return[];let S=[];for(let[E,I]of Object.entries(m.additionalFds)){let k=up(E);pt(k)&&S.push({fd:k,config:I})}return S.sort((E,I)=>E.fd-I.fd)},f=(m,S,E,I)=>{let k=[o(m.stream),s(S.stream),s(E.stream)];if(I.length===0)return k;let _=I.reduce((M,{fd:z})=>Math.max(M,z),2);for(let M=3;M<=_;M++)k[M]="ignore";for(let{fd:M}of I)k[M]="pipe";return k},u=L(function*(m,S,E){if(E.length===0)return{getInputFd:()=>Ll,getOutputFd:()=>Yc};let I=new Map,k=new Map;for(let{config:_,fd:M}of E){let z=S.stdio[M];switch(_.type){case"input":{let de=Ll;z&&"write"in z&&(jN(z),de=Eu({evaluate:()=>z,onError:oe=>No(`fromWritable(fd${M})`,gi(oe),m)})),_.stream&&(yield*Hc(Ob(_.stream,de))),I.set(M,de);break}case"output":{let de=Yc;if(z&&"read"in z){let oe=new YI;z.on("error",be=>oe.destroy(be)),z.pipe(oe),de=bu({evaluate:()=>oe,onError:be=>No(`fromReadable(fd${M})`,gi(be),m)})}_.sink&&(de=Eh(de,_.sink)),k.set(M,de);break}}}return{getInputFd:_=>I.get(_)??Ll,getOutputFd:_=>k.get(_)??Yc}}),l=(m,S,E)=>Ie(()=>{let I=Ll;return df(S.stdin)&&(jN(S.stdin),I=Eu({evaluate:()=>S.stdin,onError:k=>No("fromWritable(stdin)",gi(k),m),endOnDone:E.endOnDone,encoding:E.encoding})),si(E.stream)?kr(Hc(Ob(E.stream,I)),I):y(I)}),p=(m,S,E,I)=>{let k=S.stdout?(()=>{let z=new YI;return S.stdout.on("error",de=>z.destroy(de)),S.stdout.pipe(z),bu({evaluate:()=>z,onError:de=>No("fromReadable(stdout)",gi(de),m)})})():Yc,_=S.stderr?(()=>{let z=new YI;return S.stderr.on("error",de=>z.destroy(de)),S.stderr.pipe(z),bu({evaluate:()=>z,onError:de=>No("fromReadable(stderr)",gi(de),m)})})():Yc;Dl(E.stream)&&(k=Eh(k,E.stream)),Dl(I.stream)&&(_=Eh(_,I.stream));let M=tR(k,_);return{stdout:k,stderr:_,all:M}},h=(m,S)=>sr(E=>{let I=Dm(),k=Zh.spawn(m.command,m.args,S);return k.on("error",_=>{E(C(No("spawn",_,m)))}),k.on("exit",(..._)=>{Lm(I,ts(_))}),k.on("spawn",()=>{E(y([k,I]))}),le(()=>{k.kill("SIGTERM")})}),g=(m,S,E)=>globalThis.process.platform==="win32"?sr(I=>{qN(S,k=>{I(k?C(No("kill",gi(k),m)):xe)})}):ht({try:()=>{globalThis.process.kill(-S.pid,E)},catch:I=>No("kill",gi(I),m)}),x=(m,S)=>{if(globalThis.process.platform==="win32"){qN(m);return}try{globalThis.process.kill(-m.pid,S)}catch{}},b=(m,S,E)=>Ie(()=>{if(!S.kill(E)){let k=new globalThis.Error("Failed to kill child process");return C(No("kill",k,m))}return xe}),T=(m,S,E)=>sr(I=>{let k=Date.now()+E,_,M=()=>{clearTimeout(_),m.removeListener("exit",z)},z=()=>{if(clearTimeout(_),Date.now()>=k||!zN(m,S)){M(),I(xe);return}_=setTimeout(z,y3)};return m.on("exit",z),z(),le(M)}),w=L(function*(m,S,E,I){let k=_=>g(m,S,_).pipe(_n(()=>b(m,S,_)));yield*k(I?.killSignal??"SIGTERM"),Fs(I?.forceKillAfter)?yield*T(S,E,BN):(yield*T(S,E,Ko(I.forceKillAfter)),zN(S,E)&&(yield*k("SIGKILL"),yield*T(S,E,BN))),yield*vc(E)}),P=(m,S)=>{let E=S??"stdout";switch(E){case"stdout":return m.stdout;case"stderr":return m.stderr;case"all":return m.all;default:{let I=up(E);return pt(I)?m.getOutputFd(I):m.stdout}}},O=L(function*(m){switch(m._tag){case"StandardCommand":{let S=a(m.options),E=i(m.options,"stdout"),I=i(m.options,"stderr"),k=c(m.options),_=!0,M=yield*r(m.options),z=n(m.options),de=f(S,E,I,k),[oe,be]=yield*ln(h(m,LN(m.options,{cwd:M,env:z,stdio:de},process.platform)),L(function*([Ur,Ia]){if(yield*mE(Ia)){let[ww]=yield*vc(Ia);ww!==0&&df(ww)?yield*Lc(w(m,Ur,Ia,m.options)):_&&process.platform!=="win32"&&m.options.detached!==!1&&(yield*Lc(w(m,Ur,Ia,m.options)));return}_&&(yield*Lc(w(m,Ur,Ia,m.options)))})),Le=qI(oe.pid);oe.on("exit",Ur=>{Ur!==0&&df(Ur)&&x(oe,m.options.killSignal??"SIGTERM")});let lt=le(()=>{_||(oe.ref(),_=!0)}),Et=le(()=>(_&&(oe.unref(),_=!1),lt)),Tr=yield*l(m,oe,S),{all:nn,stderr:Bo,stdout:cf}=p(m,oe,E,I),{getInputFd:oj,getOutputFd:sj}=yield*u(m,oe,k),aj=ne(mE(be),Ur=>!Ur),ij=B(vc(be),([Ur,Ia])=>{if(df(Ur))return y(zI(Ur));let Tw=new globalThis.Error(`Process interrupted due to receipt of signal: '${Ia}'`);return C(No("exitCode",Tw,m))});return Gh({pid:Le,exitCode:ij,isRunning:aj,kill:Ur=>w(m,oe,be,Ur),stdin:Tr,stdout:cf,stderr:Bo,all:nn,getInputFd:oj,getOutputFd:sj,unref:Et})}case"PipedCommand":{let{commands:S,pipeOptions:E}=WN(m),[I,...k]=S,_=[yield*O(I)];for(let oe=0;oe<k.length;oe++){let be=k[oe],Le=E[oe]??{},lt=a(be.options),Et=ea(y(P(_[_.length-1],Le.from))),Tr=Le.to??"stdin";if(Tr==="stdin")_.push(yield*O(cp(be.command,be.args,{...be.options,stdin:{...lt,stream:Et}})));else{let nn=up(Tr);if(pt(nn)){let Bo=QI(nn),cf=be.options.additionalFds??{};_.push(yield*O(cp(be.command,be.args,{...be.options,additionalFds:{...cf,[Bo]:{type:"input",stream:Et}}})))}else _.push(yield*O(cp(be.command,be.args,{...be.options,stdin:{...lt,stream:Et}})))}}let M=_[_.length-1],z=oe=>Qa([..._].reverse(),be=>Lc(be.kill(oe)),{discard:!0}),de=Dt(function*(){let oe=[];for(let be of _)oe.push(yield*be.unref);return Qa([...oe].reverse(),be=>be,{discard:!0})});return Gh({pid:M.pid,exitCode:M.exitCode,isRunning:M.isRunning,kill:z,stdin:_[0].stdin,stdout:M.stdout,stderr:M.stderr,all:M.all,getInputFd:M.getInputFd,getOutputFd:M.getOutputFd,unref:de})}}});return HI(O)}),HN=_c(aa,S3),WN=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 VN="0123456789ABCDEFGHJKMNPQRSTVWXYZ",GN=(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+=VN[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+=VN[o>>>s&31];o&=(1<<s)-1}return n};var b3=e=>e.toString(16).padStart(2,"0"),XI=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,b3).join("")).join("-"),KN=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function JN(e=KN()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var I3=2**48-1;function ZN(e,t=KN()){let r=Math.min(Math.max(0,Math.trunc(e)),I3);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 QN="~effect/Crypto",e0=Ye("effect/Crypto"),YN=e=>{let t=e.randomBytes,r=a=>ne(T3("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 e0.of({[QN]:QN,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:le(()=>o()),randomBoolean:le(()=>o()>.5),randomInt:le(()=>s()),randomBetween:(a,i)=>le(()=>D_(a,i,o())),randomIntBetween(a,i,c){let f=c?.halfOpen===!0?0:1;return le(()=>{let u=Math.ceil(a),l=Math.floor(i);return Math.floor(o()*(l-u+f))+u})},randomShuffle:a=>le(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let f=Math.min(c,Math.floor(o()*(c+1))),u=i[c];i[c]=i[f],i[f]=u}return i}),randomUUIDv4:a=>le(()=>{let i=JN(t(16));return a?.format==="bytes"?i:XI(i)}),randomUUIDv7:a=>Vc(i=>{let c=ZN(i.currentTimeMillisUnsafe(),t(16));return y(a?.format==="bytes"?c:XI(c))}),randomULID:Vc(a=>y(GN(a.currentTimeMillisUnsafe(),t(10))))})},T3=(e,t)=>Number.isSafeInteger(t)&&t>=0?y(t):C(pn({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as Qh from"node:crypto";var w3=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},k3=(e,t)=>ht({try:()=>Uint8Array.from(Qh.createHash(w3(e)).update(t).digest()),catch:r=>Jr({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),A3=YN({randomBytes:Qh.randomBytes,digest:k3}),eM=Eo(e0,A3);var tM=eM;import*as oM from"node:crypto";import*as K from"node:fs";import*as sM from"node:os";import*as ms from"node:path";var ze=e=>t=>pn({module:"FileSystem",method:e,description:t.message??String(t)}),t0=(e,t)=>{let r=Number(e);if(!Number.isSafeInteger(r))throw new RangeError(`${t} exceeds the safe integer range: ${e}`);return r},Iu=e=>Nd($a(e),fh),rM=(e,t)=>ht({try:()=>t0(e,"position"),catch:ze(t)}),_3=(()=>{let e=et(K.access,Be("FileSystem","access"),ze("access"));return(t,r)=>{let n=K.constants.F_OK;return r?.readable&&(n|=K.constants.R_OK),r?.writable&&(n|=K.constants.W_OK),e(t,n)}})(),P3=(()=>{let e=et(K.cp,Be("FileSystem","copy"),ze("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),F3=(()=>{let e=et(K.copyFile,Be("FileSystem","copyFile"),ze("copyFile"));return(t,r)=>e(t,r)})(),R3=(()=>{let e=et(K.chmod,Be("FileSystem","chmod"),ze("chmod"));return(t,r)=>e(t,r)})(),$3=(()=>{let e=et(K.chown,Be("FileSystem","chown"),ze("chown"));return(t,r,n)=>e(t,r,n)})(),N3=(()=>{let e=et(K.glob,Be("FileSystem","glob"),ze("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),M3=(()=>{let e=et(K.link,Be("FileSystem","link"),ze("link"));return(t,r)=>e(t,r)})(),U3=(()=>{let e=et(K.mkdir,Be("FileSystem","makeDirectory"),ze("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),r0=e=>{let t=et(K.mkdtemp,Be("FileSystem",e),ze(e));return r=>Ie(()=>{let n=r?.prefix??"",o=typeof r?.directory=="string"?ms.join(r.directory,"."):sM.tmpdir();return t(n?ms.join(o,n):o+"/")})},D3=r0("makeTempDirectory"),n0=e=>{let t=et(K.rm,Be("FileSystem",e),ze(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},L3=n0("remove"),B3=(()=>{let e=r0("makeTempDirectoryScoped"),t=n0("makeTempDirectoryScoped");return r=>ln(e(r),n=>os(t(n,{recursive:!0})))})(),j3=e=>{let{O_APPEND:t,O_CREAT:r,O_EXCL:n,O_RDONLY:o,O_RDWR:s,O_TRUNC:a,O_WRONLY:i}=K.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}},z3=(e,t)=>Ie(()=>{let{O_NOFOLLOW:r}=K.constants;return process.platform==="win32"||typeof r!="number"||r===0?C(pn({module:"FileSystem",method:e,description:"noFollow is not supported on this platform"})):y(j3(t)|r)}),q3=e=>{let t=et(K.open,Be("FileSystem",e),ze(e)),r=et(K.close,Be("FileSystem",e),ze(e));return(n,o)=>Zn(ln(o?.noFollow===!0?B(z3(e,o.flag??"r"),s=>t(n,s,o.mode)):t(n,o?.flag??"r",o?.mode),s=>os(r(s))),ne(s=>W3(s,o?.flag?.startsWith("a")??!1)))},H3=q3("open"),nM=e=>pn({module:"FileSystem",method:e,description:"Cannot read before the start of the file"}),W3=(()=>{let e=u=>et(K.read,Be("FileSystem",u),ze(u)),t=e("read"),r=e("readAlloc"),n=et(K.fstat,Be("FileSystem","stat"),ze("stat")),o=et(K.ftruncate,Be("FileSystem","truncate"),ze("truncate")),s=et(K.fsync,Be("FileSystem","sync"),ze("sync")),a=u=>et(K.write,Be("FileSystem",u),ze(u)),i=a("write"),c=a("writeAll");class f{[eu];fd;append;position=BigInt(0);constructor(l,p){this[eu]=eu,this.fd=l,this.append=p}get stat(){return B(n(this.fd,{bigint:!0}),iM)}get sync(){return s(this.fd)}seek(l,p){return Ie(()=>{let h=p==="start"?l:this.position+l;return h<BigInt(0)?C(pn({module:"FileSystem",method:"seek",description:"Cannot seek before the start of the file"})):(this.position=h,y(h))})}read(l,p){return Ie(()=>{let h=p?.position;if(h!==void 0)return h<BigInt(0)?C(nM("read")):t(this.fd,{buffer:l,position:h});let g=this.position;return ne(t(this.fd,{buffer:l,position:g}),x=>(this.position=g+BigInt(x),x))})}readAlloc(l,p){return Ie(()=>{try{if(!Number.isInteger(l)||l<0)throw new RangeError("size must be a non-negative integer");let h=p?.position;if(h!==void 0&&h<BigInt(0))return C(nM("readAlloc"));let g=Buffer.allocUnsafeSlow(l),x=h??this.position;return ne(r(this.fd,{buffer:g,position:x}),b=>{if(b===0)return v();if(h===void 0&&(this.position=x+BigInt(b)),b===l)return R(g);let T=Buffer.allocUnsafeSlow(b);return g.copy(T,0,0,b),R(T)})}catch(h){return C(ze("readAlloc")(h))}})}truncate(l){return ne(o(this.fd,l||void 0),()=>{if(!this.append){let p=BigInt(l??0);this.position>p&&(this.position=p)}})}write(l){return Ie(()=>{let p=this.position;return B(this.append?y(void 0):rM(p,"write"),h=>ne(i(this.fd,l,void 0,void 0,h),g=>(this.append||(this.position=p+BigInt(g)),g)))})}writeAllChunk(l){return Ie(()=>{let p=this.position;return B(this.append?y(void 0):rM(p,"writeAll"),h=>B(c(this.fd,l,void 0,void 0,h),g=>g===0?C(Jr({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=p+BigInt(g)),g<l.length?this.writeAllChunk(l.subarray(g)):xe)))})}writeAll(l){return l.length===0?xe:this.writeAllChunk(l)}}return(u,l)=>new f(u,l)})(),aM=e=>{let t=r0(e);return L(function*(r){let n=yield*t(r),o=oM.randomBytes(6).toString("hex"),s=ms.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*cM(s,new Uint8Array(0)),s})},V3=aM("makeTempFile"),G3=(()=>{let e=aM("makeTempFileScoped"),t=n0("makeTempFileScoped");return r=>ln(e(r),n=>os(t(ms.dirname(n),{recursive:!0})))})(),K3=(e,t)=>Uc({try:()=>K.promises.readdir(e,t),catch:r=>Be("FileSystem","readDirectory")(r,[e])}),J3=e=>sr((t,r)=>{try{K.readFile(e,{signal:r},(n,o)=>{t(n?C(Be("FileSystem","readFile")(n,[e])):y(o))})}catch(n){t(C(ze("readFile")(n)))}}),Z3=(()=>{let e=et(K.readlink,Be("FileSystem","readLink"),ze("readLink"));return t=>e(t)})(),Q3=(()=>{let e=et(K.realpath,Be("FileSystem","realPath"),ze("realPath"));return t=>e(t)})(),Y3=(()=>{let e=et(K.rename,Be("FileSystem","rename"),ze("rename"));return(t,r)=>e(t,r)})(),iM=e=>ht({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:$a(e.mtime),atime:$a(e.atime),birthtime:$a(e.birthtime),dev:t0(e.dev,"dev"),rdev:Iu(e.rdev),ino:Iu(e.ino),mode:t0(e.mode,"mode"),nlink:Iu(e.nlink),uid:Iu(e.uid),gid:Iu(e.gid),size:_l(e.size),blksize:e.blksize!==void 0?R(_l(e.blksize)):v(),blocks:Iu(e.blocks)}),catch:ze("stat")}),o0=(()=>{let e=et(K.stat,Be("FileSystem","stat"),ze("stat"));return t=>B(e(t,{bigint:!0}),iM)})(),X3=(()=>{let e=et(K.symlink,Be("FileSystem","symlink"),ze("symlink"));return(t,r)=>e(t,r)})(),e6=(()=>{let e=et(K.truncate,Be("FileSystem","truncate"),ze("truncate"));return(t,r)=>e(t,r)})(),t6=(()=>{let e=et(K.utimes,Be("FileSystem","utime"),ze("utime"));return(t,r,n)=>e(t,r,n)})(),r6=(e,t,r)=>XF(n=>ln(le(()=>{let o=t.type==="Directory"?e:ms.dirname(e),s=K.watch(e,{recursive:r?.recursive??!1},(a,i)=>{if(i)switch(a){case"rename":{wo(QE(o0(ms.resolve(o,i)),{onSuccess:c=>Rl(n,{_tag:"Create",path:i}),onFailure:c=>Rl(n,{_tag:"Remove",path:i})}));return}case"change":{oi(n,{_tag:"Update",path:i});return}}});return s.on("error",a=>{$l(n,QO(Jr({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:a})))}),s.on("close",()=>{is(n)}),s}),o=>le(()=>o.close()))),n6=(e,t,r)=>o0(t).pipe(ne(n=>e.pipe(Nd(o=>o.register(t,n,r)),bt(()=>r6(t,n,r)))),ea),cM=(e,t,r)=>sr((n,o)=>{try{K.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},s=>{n(s?C(Be("FileSystem","writeFile")(s,[e])):xe)})}catch(s){n(C(ze("writeFile")(s)))}}),o6=ne(sh(jl),e=>_b({access:_3,chmod:R3,chown:$3,copy:P3,copyFile:F3,glob:N3,link:M3,makeDirectory:U3,makeTempDirectory:D3,makeTempDirectoryScoped:B3,makeTempFile:V3,makeTempFileScoped:G3,open:H3,readDirectory:K3,readFile:J3,readLink:Z3,realPath:Q3,remove:L3,rename:Y3,stat:o0,symlink:X3,truncate:e6,utimes:t6,watch(t,r){return n6(e,t,r)},writeFile:cM})),uM=_c(Fn)(o6);var fM=uM;import*as fp from"node:path";import*as Yh from"node:url";var s0=e=>({fromFileUrl:t=>ht({try:()=>Yh.fileURLToPath(t,{windows:e}),catch:r=>new vo({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:t=>ht({try:()=>Yh.pathToFileURL(t,{windows:e}),catch:r=>new vo({module:"Path",method:"toFileUrl",cause:r})})}),i6=Eo(Oo)({[fs]:fs,...fp.posix,...s0(!1)}),c6=Eo(Oo)({[fs]:fs,...fp.win32,...s0(!0)}),lM=Eo(Oo)({[fs]:fs,...fp,...s0(void 0)});var pM=lM;var a0="~effect/Stdio",Xh=Ye(a0),dM=e=>({[a0]:a0,stdinIsTerminal:y(!1),stdoutIsTerminal:y(!1),stderrIsTerminal:y(!1),...e});var mM=Eo(Xh,dM({args:le(()=>process.argv.slice(2)),stdinIsTerminal:le(()=>process.stdin.isTTY===!0),stdoutIsTerminal:le(()=>process.stdout.isTTY===!0),stderrIsTerminal:le(()=>process.stderr.isTTY===!0),stdout:e=>Eu({evaluate:()=>process.stdout,onError:t=>Jr({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>Eu({evaluate:()=>process.stderr,onError:t=>Jr({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:bu({evaluate:()=>process.stdin,onError:e=>Jr({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var hM=mM;var Ee={};En(Ee,{Any:()=>qZ,Array:()=>Ce,ArrayEnsure:()=>e5,BigDecimal:()=>VD,BigDecimalFromString:()=>F8,BigInt:()=>ju,BigIntFromString:()=>x8,Boolean:()=>Vg,BooleanFromBit:()=>T8,BooleanLiterals:()=>ZC,ByteSize:()=>tx,ByteSizeFromBigInt:()=>$8,ByteSizeFromNumber:()=>N8,ByteSizeFromString:()=>R8,Cause:()=>HC,CauseReason:()=>qC,Char:()=>n8,Chunk:()=>M8,Class:()=>B2,Cookie:()=>M2,Cookies:()=>U2,Date:()=>Hu,DateFromMillis:()=>f8,DateFromString:()=>u8,DateTimeUtc:()=>rx,DateTimeUtcFromDate:()=>z8,DateTimeUtcFromMillis:()=>H8,DateTimeUtcFromString:()=>q8,DateTimeZoned:()=>u2,DateTimeZonedFromString:()=>K8,Defect:()=>oT,DnsARecord:()=>T2,DnsAaaaRecord:()=>w2,DnsCaaRecord:()=>k2,DnsCnameRecord:()=>A2,DnsMxRecord:()=>v2,DnsNaptrRecord:()=>O2,DnsNsRecord:()=>_2,DnsPtrRecord:()=>P2,DnsRecord:()=>HQ,DnsRecordType:()=>qQ,DnsSoaRecord:()=>F2,DnsSrvRecord:()=>R2,DnsTlsaRecord:()=>$2,DnsTxtRecord:()=>N2,DomainName:()=>Ts,DomainNameFromString:()=>S2,Duration:()=>Gp,DurationFromMillis:()=>zQ,DurationFromNanos:()=>jQ,DurationFromString:()=>BQ,Enum:()=>jZ,Error:()=>ox,ErrorInstance:()=>o8,Exit:()=>WQ,FalseLiterals:()=>Yg,File:()=>DD,Finite:()=>qu,FiniteFromString:()=>g8,FormData:()=>LD,Graph:()=>JQ,HashMap:()=>ZQ,HashSet:()=>QQ,Headers:()=>rY,Host:()=>FQ,HostFromString:()=>RQ,HostPort:()=>b2,HostPortFromString:()=>$Q,InetAddress:()=>x2,InetAddressFromString:()=>OQ,InetAddressV4:()=>AQ,InetAddressV6:()=>vQ,Int:()=>Rr,IpAddress:()=>ga,IpAddressFromString:()=>Ri,IpInterface:()=>d2,IpInterfaceFromString:()=>CQ,IpLinkLocalAddress:()=>uQ,IpLinkLocalAddressFromString:()=>fQ,IpLoopbackAddress:()=>iQ,IpLoopbackAddressFromString:()=>cQ,IpMulticastAddress:()=>J8,IpMulticastAddressFromString:()=>Z8,IpNetwork:()=>g2,IpNetworkFromString:()=>kQ,IpUnicastAddress:()=>X8,IpUnicastAddressFromString:()=>eQ,IpUnspecifiedAddress:()=>lQ,IpUnspecifiedAddressFromString:()=>pQ,Ipv4Address:()=>Vp,Ipv4AddressFromString:()=>iT,Ipv4BroadcastAddress:()=>nQ,Ipv4BroadcastAddressFromString:()=>oQ,Ipv4Interface:()=>l2,Ipv4InterfaceFromString:()=>bQ,Ipv4Network:()=>m2,Ipv4NetworkFromString:()=>TQ,Ipv4PrivateAddress:()=>dQ,Ipv4PrivateAddressFromString:()=>mQ,Ipv6Address:()=>nx,Ipv6AddressFromString:()=>f2,Ipv6Interface:()=>p2,Ipv6InterfaceFromString:()=>IQ,Ipv6Network:()=>h2,Ipv6NetworkFromString:()=>wQ,Ipv6UniqueLocalAddress:()=>hQ,Ipv6UniqueLocalAddressFromString:()=>gQ,Json:()=>sx,JsonFromUrlParamsField:()=>nY,JsonObject:()=>_Y,Literal:()=>Ct,Literals:()=>Cs,MacAddress:()=>Fi,MacAddressFromString:()=>Wu,MacBroadcastAddress:()=>sQ,MacBroadcastAddressFromString:()=>aQ,MacLocallyAdministeredAddress:()=>xQ,MacLocallyAdministeredAddressFromString:()=>yQ,MacMulticastAddress:()=>Q8,MacMulticastAddressFromString:()=>Y8,MacUnicastAddress:()=>tQ,MacUnicastAddressFromString:()=>rQ,MacUniversallyAdministeredAddress:()=>SQ,MacUniversallyAdministeredAddressFromString:()=>EQ,MutableJson:()=>FY,Natural:()=>vi,Never:()=>zZ,NonEmptyArray:()=>Kg,NonEmptyString:()=>nT,Null:()=>Wg,NullOr:()=>JC,NullishOr:()=>dD,Number:()=>Lp,NumberFromString:()=>h8,ObjectKeyword:()=>VZ,Opaque:()=>d5,Option:()=>$i,OptionFromNullOr:()=>YQ,OptionFromNullishOr:()=>eY,OptionFromOptional:()=>aY,OptionFromOptionalKey:()=>sY,OptionFromOptionalNullOr:()=>iY,OptionFromUndefinedOr:()=>XQ,Port:()=>NQ,PropertyKey:()=>zC,ReadonlyMap:()=>s8,ReadonlySet:()=>a8,Record:()=>_i,RecordFromCookies:()=>tY,RecordFromUrlParams:()=>oY,Redacted:()=>D2,RedactedFromValue:()=>cY,RegExp:()=>i8,Result:()=>uY,SchemaError:()=>Oi,ScopedIpv6Literal:()=>cT,ScopedIpv6LiteralFromString:()=>E2,SocketAddress:()=>PQ,StandardSchemaV1FailureResult:()=>C8,String:()=>$,StringForLiteralAutocomplete:()=>HZ,StringFromBase64:()=>S8,StringFromBase64Url:()=>E8,StringFromHex:()=>b8,StringFromUriComponent:()=>I8,Struct:()=>_e,StructWithRest:()=>YZ,Symbol:()=>fD,TaggedClass:()=>dY,TaggedError:()=>Vn,TaggedStruct:()=>Bp,TaggedUnion:()=>p5,TemplateLiteral:()=>LZ,TemplateLiteralParser:()=>BZ,TimeZone:()=>i2,TimeZoneFromString:()=>G8,TimeZoneNamed:()=>s2,TimeZoneNamedFromString:()=>V8,TimeZoneOffset:()=>W8,Tree:()=>OY,Trim:()=>y8,Trimmed:()=>jD,TrueLiterals:()=>Qg,Tuple:()=>Mo,TupleWithRest:()=>XZ,URL:()=>MD,URLFromString:()=>c8,URLSearchParams:()=>BD,Uint8Array:()=>ex,Uint8ArrayFromBase64:()=>w8,Uint8ArrayFromBase64Url:()=>k8,Uint8ArrayFromHex:()=>qD,Undefined:()=>GC,UndefinedOr:()=>Jg,Union:()=>Ze,UniqueArray:()=>t5,UniqueSymbol:()=>GZ,UnixPathAddress:()=>y2,UnixPathAddressFromString:()=>_Q,Unknown:()=>Dp,UnknownFromJsonString:()=>p8,UrlParams:()=>uT,Void:()=>WZ,annotate:()=>dZ,annotateEncoded:()=>mZ,annotateKey:()=>hZ,asserts:()=>SZ,brand:()=>Zg,catchDecoding:()=>s5,catchDecodingWithContext:()=>yD,catchEncoding:()=>a5,catchEncodingWithContext:()=>SD,check:()=>n5,declare:()=>Me,declareConstructor:()=>Pr,decode:()=>i5,decodeEffect:()=>EZ,decodeExit:()=>bZ,decodeOption:()=>CZ,decodePromise:()=>wZ,decodeResult:()=>TZ,decodeSync:()=>kZ,decodeTo:()=>J,decodeUnknownEffect:()=>bs,decodeUnknownExit:()=>tD,decodeUnknownOption:()=>IZ,decodeUnknownPromise:()=>nD,decodeUnknownResult:()=>rD,decodeUnknownSync:()=>oD,encode:()=>c5,encodeEffect:()=>AZ,encodeExit:()=>vZ,encodeKeys:()=>ZZ,encodeOption:()=>_Z,encodePromise:()=>FZ,encodeResult:()=>PZ,encodeSync:()=>RZ,encodeTo:()=>QC,encodeUnknownEffect:()=>qg,encodeUnknownExit:()=>sD,encodeUnknownOption:()=>OZ,encodeUnknownPromise:()=>iD,encodeUnknownResult:()=>aD,encodeUnknownSync:()=>cD,extendTo:()=>QZ,fieldsAssign:()=>KZ,flip:()=>jC,fromBrand:()=>o5,fromFormData:()=>d8,fromJsonString:()=>sT,fromURLSearchParams:()=>m8,instanceOf:()=>ma,is:()=>zg,isBase64:()=>wD,isBase64Url:()=>I5,isBetween:()=>ha,isBetweenBigDecimal:()=>P8,isBetweenBigInt:()=>V5,isBetweenCodePoints:()=>J5,isBetweenDate:()=>z5,isBetweenLength:()=>eT,isBetweenProperties:()=>t8,isBetweenSize:()=>Y5,isCapitalized:()=>v5,isEndingWith:()=>T5,isFinite:()=>_5,isGUID:()=>E5,isGreaterThan:()=>F5,isGreaterThanBigDecimal:()=>A8,isGreaterThanBigInt:()=>q5,isGreaterThanDate:()=>D5,isGreaterThanOrEqualTo:()=>kD,isGreaterThanOrEqualToBigDecimal:()=>v8,isGreaterThanOrEqualToBigInt:()=>AD,isGreaterThanOrEqualToDate:()=>L5,isIncluding:()=>w5,isInt:()=>Xg,isInt32:()=>M5,isLessThan:()=>R5,isLessThanBigDecimal:()=>O8,isLessThanBigInt:()=>H5,isLessThanDate:()=>B5,isLessThanOrEqualTo:()=>$5,isLessThanOrEqualToBigDecimal:()=>_8,isLessThanOrEqualToBigInt:()=>W5,isLessThanOrEqualToDate:()=>j5,isLowercased:()=>A5,isMaxCodePoints:()=>K5,isMaxLength:()=>PD,isMaxProperties:()=>e8,isMaxSize:()=>Q5,isMinCodePoints:()=>G5,isMinLength:()=>vD,isMinProperties:()=>X5,isMinSize:()=>Z5,isMultipleOf:()=>N5,isNonEmpty:()=>_D,isPattern:()=>Pi,isPropertyNames:()=>r8,isSchema:()=>Hg,isSchemaError:()=>ZU,isStartingWith:()=>C5,isStringBigInt:()=>g5,isStringFinite:()=>h5,isStringSymbol:()=>x5,isTrimmed:()=>TD,isULID:()=>b5,isUUID:()=>S5,isUint32:()=>U5,isUncapitalized:()=>O5,isUnique:()=>rT,isUniqueKey:()=>FD,isUppercased:()=>k5,link:()=>Te,linkDecoding:()=>zu,make:()=>V,makeFilter:()=>ke,makeFilterGroup:()=>m5,makeIsBetween:()=>Wp,makeIsGreaterThan:()=>jp,makeIsGreaterThanOrEqualTo:()=>zp,makeIsLessThan:()=>qp,makeIsLessThanOrEqualTo:()=>Hp,makeIsMultipleOf:()=>P5,middlewareDecoding:()=>gD,middlewareEncoding:()=>xD,mutable:()=>r5,mutableKey:()=>MZ,optional:()=>Is,optionalKey:()=>Ss,overrideToCodecIso:()=>AY,overrideToEquivalence:()=>gY,overrideToFormatter:()=>mY,readonlyKey:()=>UZ,refine:()=>hD,required:()=>NZ,requiredKey:()=>$Z,resolveAnnotations:()=>RY,resolveAnnotationsKey:()=>$Y,revealBottom:()=>pZ,revealCodec:()=>gZ,suspend:()=>mD,tag:()=>Es,tagDefaultOmit:()=>l5,toCodecArrayFromSingle:()=>IY,toCodecIso:()=>bY,toCodecJson:()=>EY,toCodecStringTree:()=>lT,toDifferJsonPatch:()=>vY,toEncoded:()=>Bu,toEncoderXml:()=>CY,toEquivalence:()=>xY,toFormatter:()=>hY,toIso:()=>TY,toIsoFocus:()=>kY,toIsoSource:()=>wY,toJsonSchemaDocument:()=>SY,toRepresentation:()=>yY,toStandardJSONSchemaV1:()=>yZ,toStandardSchemaV1:()=>xZ,toTaggedUnion:()=>CD,toType:()=>Fr,withArrayLengthConstraints:()=>Gg,withConstructorDefault:()=>ED,withDecodingDefault:()=>ID,withDecodingDefaultKey:()=>YC,withDecodingDefaultType:()=>f5,withDecodingDefaultTypeKey:()=>u5});var tg="~effect/HashMap",Ln=5,pp=1<<Ln,d6=pp/4,gM=pp/2,m6=pp-1,h6=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),lp=(e,t)=>e>>>t&m6,ia=(e,t)=>1<<lp(e,t),eg=(e,t)=>h6(e&t-1);function xM(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=ia(r,t),i=ia(o,t);if(a===i){let u=xM(e,t+Ln,r,n,o,s);return new Si(e,a,[u])}let c=a|i,f=a>>>0<i>>>0?[n,s]:[s,n];return new Si(e,c,f)}var g6=Ae("HashMap"),yM=(e,t)=>ie(q(e),q(t)),SM=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},xi=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=wa;t=this.computeHash(),r===wa&&(this._hash=t)}return t}},c0=class extends xi{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return v()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new yi(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},yi=class e extends xi{_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&&W(this.key,n)?R(this.value):v()}has(t,r,n){return this.hash===r&&W(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&W(this.key,o))return W(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 u0(t,n,[[this.key,this.value],[o,s]]);let i=ia(n,r),c=ia(this.hash,r);if(i===c)return new Si(t,i,[this.set(t,r+Ln,n,o,s,a)]);let f=i|c,u=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new Si(t,f,u)}remove(t,r,n,o,s){if(this.hash===n&&W(this.key,o)){s.value=!0;return}return this}computeHash(){return yM(this.key,this.value)}},u0=class e extends xi{_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 v();for(let[o,s]of this.entries)if(W(o,n))return R(s);return v()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(W(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,xM(t,r,this.hash,this,n,new yi(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(W(this.entries[i][0],o)){if(W(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])=>W(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 yi(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^=yM(r[n][0],r[n][1]);return t}},Si=class e extends xi{_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=ia(r,t);if((this.bitmap&o)===0)return v();let s=eg(this.bitmap,o);return this.children[s].get(t+Ln,r,n)}has(t,r,n){let o=ia(r,t);if((this.bitmap&o)===0)return!1;let s=eg(this.bitmap,o);return this.children[s].has(t+Ln,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=ia(n,r),c=eg(this.bitmap,i);if((this.bitmap&i)!==0){let f=this.children[c],u=f.set(t,r+Ln,n,o,s,a);if(f===u)return this;if(this.canEdit(t))return this.children[c]=u,this;let l=[...this.children];return l[c]=u,new e(t,this.bitmap,l)}else{a.value=!0;let f=new yi(t,n,o,s),u=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,f),this.bitmap=u,this._size=void 0,this.children.length>gM?this.expand(t,u,this.children):this;let l=[...this.children];return l.splice(c,0,f),l.length>gM?this.expand(t,u,l):new e(t,u,l)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=ia(n,r);if((this.bitmap&a)===0)return this;let i=eg(this.bitmap,a),c=this.children[i],f=c.remove(t,r+Ln,n,o,s);if(!s.value)return this;if(f===void 0){let l=this.bitmap^a;if(l===0)return;if(this.children.length===2){let h=this.children[i===0?1:0];if(h._tag==="LeafNode")return h}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let p=[...this.children];return p.splice(i,1),new e(t,l,p)}if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.bitmap,u)}expand(t,r,n){let o=new globalThis.Array(pp),s=0;for(let a=0;a<pp;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new f0(t,n.length,o)}computeHash(){return SM(this.children)}},f0=class e extends xi{_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=lp(r,t),s=this.children[o];return s?s.get(t+Ln,r,n):v()}has(t,r,n){let o=lp(r,t),s=this.children[o];return s?s.has(t+Ln,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=lp(n,r),c=this.children[i];if(c){let f=c.set(t,r+Ln,n,o,s,a);if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.count,u)}else{a.value=!0;let f=new yi(t,n,o,s);if(this.canEdit(t))return this.children[i]=f,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=f,new e(t,this.count+1,u)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=lp(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+Ln,n,o,s);if(!s.value)return this;let f=this.count-(c?0:1);if(f<d6)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=f),this._size=void 0,this;let u=[...this.children];return u[a]=c,new e(t,f,u)}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 Si(t,s,o)}computeHash(){return SM(this.children)}},rg=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}},x6=(e,t)=>[e,t];var dp=class{[tg]=tg;_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 rg(this._root,x6)}[X](t){if(l0(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Zn(t,IM(n));if(Ke(s)||!W(o,s.value))return!1}return!0}return!1}[Y](){return Bt(g6^this._root.subtreeHash())}[qe](){return Ot(this)}toString(){return`HashMap(${N(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[Ot(t),Ot(r)])}}pipe(){return re(this,arguments)}},EM=new c0,l0=e=>A(e,tg),p0=()=>new dp(!1,0,EM,0);var bM=e=>{let t=EM,r=0,n={value:!1};for(let[o,s]of e){let a=q(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new dp(!1,0,t,r)};var IM=d(2,(e,t)=>e._root.get(0,q(t),t));var d0=d(2,(e,t)=>e._root.has(0,q(t),t));var y6=(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 dp(!1,o._edit,i,o._size+(s.value?1:0))},m0=d(3,(e,t,r)=>y6(e,t,q(t),r)),h0=e=>new rg(e._root,F);var CM=e=>e[Symbol.iterator](),ng=e=>e.size;var wM=l0;var g0=bM;var b6=CM,mp=e=>Array.from(b6(e)),kM=ng;var hp="~effect/HashSet",I6=Ae(hp),C6={[Y](){return Bt(ie(I6,q(og(this))))},[X](e){return y0(e)&&sg(this)===sg(e)&&OM(this,t=>vM(e,t))},[Symbol.iterator](){return h0(og(this))},toString(){return`HashSet(${N(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:Ot(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return re(this,arguments)}},T6=e=>{let t=Object.create(C6);return t[hp]=hp,t.keyMap=e,t},y0=e=>A(e,hp),og=e=>e.keyMap;var AM=e=>{let t=p0();for(let r of e)t=m0(t,r,!0);return T6(t)},vM=(e,t)=>d0(og(e),t);var sg=e=>ng(og(e));var OM=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var S0=AM,_M=y0;var PM=sg;var b0="~effect/http/Cookies",RM=e=>A(e,b0),I0="~effect/http/Cookies/Cookie",$M=e=>A(e,I0),FM="~effect/http/Cookies/CookieError",C0=class extends Nf{},Ei=class e extends cn("CookiesError"){static fromReason(t,r){return new e({reason:new C0({_tag:t,cause:r})})}[FM]=FM;get message(){return this.reason._tag}};var k6={[b0]:b0,...mt,toJSON(){return{_id:"effect/Cookies",cookies:Bd(this.cookies,e=>e.toJSON())}},pipe(){return re(this,arguments)}},w0=e=>{let t=Object.create(k6);return t.cookies=e,t},k0=e=>{let t={};for(let r of e)U(t,r.name,r);return w0(t)},NM=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=A6(n.trim());o&&r.push(o)}return k0(r)};function A6(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(!MM.test(n))return;let o=t[0].slice(r+1),s=R6(o);if(t.length===1)return Object.assign(Object.create(T0),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],f=c.indexOf("="),u=f===-1?c:c.slice(0,f).trim(),l=f===-1?void 0:c.slice(f+1).trim();switch(u.toLowerCase()){case"domain":{if(l===void 0)break;let p=l.trim().replace(/^\./,"");p&&(a.domain=p);break}case"expires":{if(l===void 0)break;let p=new Date(l);isNaN(p.getTime())||(a.expires=p);break}case"max-age":{if(l===void 0)break;let p=parseInt(l,10);isNaN(p)||(a.maxAge=Rf(p));break}case"path":{if(l===void 0)break;l[0]==="/"&&(a.path=l);break}case"priority":{if(l===void 0)break;switch(l.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(l===void 0)break;switch(l.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(T0),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var v6=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,MM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,O6=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,_6=/^[\u0020-\u003a\u003c-\u007e]+$/,T0={[I0]:I0,...mt,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function P6(e,t,r){let n=encodeURIComponent(t),o=UM(e,n,r);return o!==void 0?Z(o):H(Object.assign(Object.create(T0),{name:e,value:t,valueEncoded:n,options:r}))}function UM(e,t,r){if(!MM.test(e))return Ei.fromReason("InvalidCookieName");if(t&&!v6.test(t))return Ei.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!O6.test(r.domain))return Ei.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!_6.test(r.path))return Ei.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!mc(Ut(r.maxAge)))return Ei.fromReason("CookieInfinityMaxAge")}var DM=(e,t,r)=>Ms(P6(e,t,r));function F6(e){let t=UM(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=fo(Ut(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 LM=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];U(t,o.name,o.value)}return t},BM=e=>Object.values(e.cookies).map(F6);var R6=e=>{try{return decodeURIComponent(e)}catch{return e}};var bi=new WeakMap,jM=e=>{if(bi.has(e))return bi.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var zM="~effect/Redacted",A0=e=>A(e,zM),Bn=(e,t)=>{let r=Object.create(M6);return t?.label&&(r.label=t.label),bi.set(r,e),r},M6={[zM]:{_A:e=>e},label:void 0,...er,toJSON(){return this.toString()},toString(){return`<redacted${In(this.label)?":"+this.label:""}>`},[Y](){return q(bi.get(this))},[X](e){return A0(e)&&W(bi.get(this),bi.get(e))}},ca=jM;var qM=e=>yr((t,r)=>e(ca(t),ca(r)));var v0=Symbol.for("~effect/http/Headers"),HM=e=>A(e,v0),O0=Object.defineProperties(Object.create(null),{[v0]:{value:v0},[Aa]:{value(e){return D6(this,ct(e,L6))}},toJSON:{value(){return zo(this)}},[X]:{value(e){return _0(this,e)}},[Y]:{value(){return gf(this)}},toString:{value:mt.toString},[qe]:{value:mt[qe]}});var _0=Rk(Ra()),U6=Object.create(O0),WM=e=>{if(e===void 0)return U6;if(Symbol.iterator in e){let r=Object.create(O0);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(O0);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 D6=d(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=Bn(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Bn(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r});var L6=ge("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key","AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var P0="~effect/http/UrlParams",F0=e=>A(e,P0),j6={...er,[P0]:P0,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[X](e){return R0(this,e)},[Y](){return Yn(this.params.flat())}},ag=e=>{let t=Object.create(j6);return t.params=e,t},VM=e=>{if(F0(e))return e;let t=GM(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 ag(r)},GM=e=>{let t=typeof e[Symbol.iterator]=="function"?nr(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,String(o[s])]);else if(o!==null&&typeof o=="object"){let s=GM(o);for(let[a,i]of s)r.push([[n,...typeof a=="string"?[a]:a],i])}else o!==void 0&&r.push([n,String(o)]);return r},R0=yr((e,t)=>z6(e.params,t.params)),z6=$k(vk([Ra(),Ra()]));var KM=d(2,(e,t)=>Pf(e.params,([r])=>r===t).pipe(sc(([,r])=>r)));var q6=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))U(t,r,n);else{let o=t[r];typeof o=="string"?U(t,r,[o,n]):o.push(n)}return t},JM=q6;var $0="~effect/Graph",N0=e=>A(e,$0),ZM=e=>e;var W6=(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)&&W(t.data,r.data),V6=(e,t)=>e==="directed"?q(t):Bt(ie(q(t.data),G6(t.source,t.target))),G6=(e,t)=>ie(0,q(e))+ie(0,q(t)),K6=Ae("Graph"),J6={[$0]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[qe](){return this.toJSON()},[X](e){if(A(e,$0)){let t=ZM(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)||!W(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!W6(this.type,n,o))return!1}return!0}return!1},[Y](){let e=K6;e=e^Ae(this.type),e=e^dt(this.nodes.size),e=e^dt(this.edges.size);for(let[t,r]of this.nodes)e^=ie(q(t),q(r));for(let[t,r]of this.edges)e^=ie(q(t),V6(this.type,r));return Bt(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 re(this,arguments)}},Z6=(e,t)=>{let r=Object.create(J6);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=R(!0),r};var gp=e=>{let t=ZM(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)}},ig=e=>{let t=Z6(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=v(),t};var cg=(e,t,r)=>e===je?r(t):$t(e,r);function YM(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===je?e.decode(Gt(Hl(n)),o):e.decode(ti(r,Hl),o);return QM(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===je?Gt(n):r;case"Transform":{let r=n=>n===me?vr:Gt(t.transform(n));return(n,o)=>cg(n,o,r)}case"TransformOptional":{let r=n=>Nb(t.transform(Hl(n)));return(n,o)=>cg(n,o,r)}case"TransformEffect":return(r,n,o)=>cg(r,n,s=>s===me?vr:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>cg(r,n,s=>QM(t.transform(Hl(s),o)))}}var QM=e=>$t(e,Nb),XM=(e,t,r,n)=>Cr(n,o=>Ks(()=>Vs(o,s=>new pR(e,s,t,r))));function Y6(e,t){let r=YM(e.link.transformation),n;return(o,s)=>{if(o===me)return vr;if(e.isConstructed(o))return je;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function X6(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==me&&n!==void 0)return t(n,o);let s=r;if($e(s)&&s._tag==="Success"){let a=t(s[fe],o);return a===je?s:a}return $t(XM(e,n,o,s),a=>{let i=t(a,o);return i===je?Gt(a):i})}}function M0(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:X6(e,r)}function xp(e,t,r,n,o){if(e._tag==="Declaration")for(let g of e.typeParameters)t(g);let s=r?vN(e):void 0,a=s?Y6(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,f=c?.map(g=>YM(g.transformation)),u=e.encodingChecks;if(!c&&!i&&!u)return a;let l,p=(g,x)=>{let b=a(g,x);if(u&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[fe];if(g!==me&&T!==me){let w=Dn(u,g,void 0,e,x);w&&(b=C(new vt(e,w,g,x)))}}}else b=B(b,T=>{if(g!==me&&T!==me){let w=Dn(u,g,void 0,e,x);if(w)return C(new vt(e,w,g,x))}return y(T)});if(i&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[fe];if(T===me)return b;let w=Dn(i,T,void 0,e,x);w&&(b=C(new vt(e,w,T,x)))}}else b=B(b,T=>{if(T!==me){let w=Dn(i,T,void 0,e,x);if(w)return C(new vt(e,w,T,x))}return y(T)});return b},h=o===void 0?p:o(p);return c?(g,x)=>{let b=l??=c.map(P=>t(P.to)),T=g,w=b[b.length-1](g,x);for(let P=c.length-1;P>=0;P--)if(w=f[P](w,T,x),P!==0){let O=b[P-1];w._tag==="Success"?(T=w[fe],w=O(T,x)):w=$t(w,m=>{let S=O(m,x);return S===je?Gt(m):S})}if(w._tag==="Success"){let P=w[fe],O=h(P,x);return O===je?w:O}return w=XM(e,g,x,w),$t(w,P=>{let O=h(P,x);return O===je?Gt(P):O})}:h}var lg=Symbol(),e1=new WeakMap,t1,Tu=!1;var tK=e=>Tu?fg(tn,e,"parser"):tn(e).parser,r1=e=>Tu?fg(tn,e,"makeEffect"):tn(e).makeEffect,rK=e=>M0(e,r1),ug=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=xp(this.ast,tK)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=xp(this.ast,r1,rK)}},U0=class extends ug{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")??xp(this.ast,t=>fg(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",nK(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>fg(this.resolve,n,"makeEffect");return this.save("makeEffect",xp(this.ast,r,n=>M0(n,r)))}};function nK(e,t){let r;return(n,o)=>{if(n!==me)try{let s=e(n,o);if(s!==lg)return s===n?je:Gt(s)}catch(s){return ar(s)}return(r??=t())(n,o)}}function fg(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 tn(e){let t=e1.get(e);if(t!==void 0)return t;let r=t1===void 0?new ug(e):new U0(e,t1(e,tn),tn);return e1.set(e,r),r}function L0(e){let t=e.ast,r;return(n,o)=>(r??=V0(pK,It(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function dg(e){let t=L0(e);return(r,n)=>{let o=ko(t(r,n));return ut(o)?R(o.value):(Qr(o.cause,"Option adapter can only return none for schema issues"),v())}}function mg(e){return fK(It(e.ast))}function B0(e){return yp(e.ast)}function sK(e){if(!Tu){let o=wu(xg(e));return s=>{let a=o(s,Ro);return ut(a)?!0:(Qr(a.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=tn(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,Ro)}catch(s){return Qr(nl(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=ko(W0(n(o,Ro),o));return ut(s)?!0:(Qr(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function yp(e){let t=It(e),r=n=>(r=sK(t),r(n));return n=>r(n)}function n1(e){let t=xg(e);return(r,n)=>{let o=ko(t(r,n));if(!ut(o))return Qr(o.cause,"Issue adapter can only return schema issues")}}function o1(e,t){let r=It(e.ast),n=tn(r).parser(t,Ro),o=ko(W0(n,t));if(sl(o)){let s=Qr(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function St(e,t){let r=xg(e.ast);return t===void 0?r:(n,o)=>r(n,H0(t,o))}var j0=St;function s1(e,t){return wu(St(e,t))}function z0(e,t){return p1(St(e,t))}var a1=z0;function i1(e,t){return d1(St(e,t))}function aK(e,t){return Tu?m1(e.ast,t):G0(St(e,t))}var hg=aK;function Ii(e,t){let r=xg(en(e.ast));return t===void 0?r:(n,o)=>r(n,H0(t,o))}var c1=Ii;function u1(e,t){return wu(Ii(e,t))}function q0(e,t){return p1(Ii(e,t))}var f1=q0;function l1(e,t){return d1(Ii(e,t))}function iK(e,t){return Tu?m1(en(e.ast),t):G0(Ii(e,t))}var gg=iK,H0=(e,t)=>t?{...e,...t}:e,pg=e=>e===me?C(new ue):y(e);function xg(e){return V0(lK,e)}function W0(e,t){return e===je?y(t):$e(e)?e[fe]===me?pg(me):e:$t(e,pg)}function V0(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Ro);return s===je?y(n):$e(s)?s[fe]===me?pg(me):s:$t(s,pg)}}function wu(e){return(t,r)=>ko(e(t,r))}function p1(e){let t=wu(e);return(r,n)=>{let o=t(r,n);return ut(o)?R(o.value):(Qr(o.cause,"Option adapter can only return none for schema issues"),v())}}function d1(e){let t=wu(e);return(r,n)=>{let o=t(r,n);return ut(o)?H(o.value):Z(Qr(o.cause,"Result adapter can only return schema issues"))}}function m1(e,t){let r;return(n,o)=>(r??=cK(tn(e),t))(n,o)}function cK(e,t){let r=e.decode,n,o=r===void 0?(s,a=Ro)=>(n??=D0(e))(s,a):(s,a=Ro)=>{if(s===me)return(n??=D0(e))(s,a);let i;try{i=r(s,a)}catch(c){throw Qr(nl(c),"Sync adapter can only throw schema issues"),c}return i!==lg?i:(n??=D0(e))(s,a)};return t===void 0?o:(s,a)=>o(s,H0(t,a))}function D0(e){return G0(V0(()=>e.decodeEffect,e.ast))}function G0(e){let t=wu(e);return(r,n)=>{let o=t(r,n);if(ut(o))return o.value;let s=Qr(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function uK(e,t){let r=ko(e);if(ut(r))return r.value;let n=Qr(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function fK(e){let t,r;return(n,o)=>{t??=tn(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??Ro,a=t.make;if(a!==void 0&&n!==me){let c;try{c=a(n,s)}catch(f){throw Qr(nl(f),"Constructor adapter can only throw schema issues"),f}if(c!==lg&&c!==me)return c}let i=(r??=t.makeEffect)(n,s);return uK(W0(i,n),"Constructor adapter can only throw schema issues")}}var lK=e=>tn(e).parser,pK=e=>tn(e).makeEffect;var yg="~effect/Schema/Schema",h1=Symbol(),dK={[yg]:yg,get make(){let e=mg(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=L0(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=dg(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return re(this,arguments)},annotate(e){return this.rebuild(Nn(this.ast,e))},annotateKey(e){return this.rebuild(ip(this.ast,e))},check(...e){return this.rebuild($o(this.ast,e))},rebuild(e){return jn(e,this[h1])}};function jn(e,t){function r(){}let n=Object.setPrototypeOf(r,dK);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[h1]=t,n.ast=e,n}function K0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Sp(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function J0(e){return encodeURI(K0(e)).replace(/#/g,"%23")}function Z0(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 x1(e){let t=Z0(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Sp)}function y1(e){return e.reduce((t,r)=>`${t}/${J0(r)}`,"#")}var hK="http://json-schema.org/draft-07/schema#",S1="https://json-schema.org/draft/2020-12/schema";function E1(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function C1(e){return{dialect:"draft-07",...EK(e,_K)}}function gK(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Lr(n))return n;let a=o||!s&&k1(n.$id),i={};for(let c of Object.keys(n)){let f=n[c],u=f;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":u=Y0(f,l=>r(l,a))??f;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":u=Array.isArray(f)?f.map(l=>r(l,a)):f;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":u=r(f,a)}U(i,c,u)}return t(i,a),i}}function T1(e,t){return gK(e,r=>{xK(r,t)})}function xK(e,t){typeof e.$ref=="string"&&U(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&U(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function Y0(e,t){if(!Lr(e))return;let r={};for(let n of Object.keys(e))U(r,n,t(e[n],n));return r}function yK(e,t,r){let n=new Map,o=[],s=Q0;function a(p,h=[],g=[]){if(h.length===0&&t?.trackIds){let x=Lr(p)?u(p):void 0;s=b1(x,Q0)??Q0}return f(p,h,g,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[p,h,g]of o){let x=h,b=w1(h,g);if(b!==void 0){let T=x1(b.hash);if(b.hash="",T!==void 0){let w=n.get(I1(b.href,T));w!==void 0&&(x=SK(h,w))}}U(p,"$ref",x)}}let c=r(a);return i(),c;function f(p,h,g,x){if(typeof p=="boolean")return l(h,g,x),t?.booleanAdapter?.(p)??p;if(!Lr(p))return p;let b=x,T=u(p);if(h.length>0&&t?.trackIds&&k1(T)){let O=b1(T,x.uri);O!==void 0&&(b={parent:x,sourceRoot:h,targetRoot:g,uri:O})}l(h,g,b);let w=b.uri,P={isDocumentRoot:h.length===0,schema(O,m,S=m){return f(O,[...h,m],[...g,S],b)},schemaAt(O,m,S){return f(O,[...h,...m],[...g,...S],b)},schemaArray(O,m,S=m){return Array.isArray(O)?O.map((E,I)=>f(E,[...h,m,String(I)],[...g,S,String(I)],b)):O},schemaMap(O,m,S=m){return Lr(O)?Y0(O,(E,I)=>f(E,[...h,m,I],[...g,S,I],b)):O},reference(O,m){typeof m=="string"?o.push([O,m,w]):U(O,"$ref",m)}};return e(p,P)}function u(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function l(p,h,g){g.parent!==void 0&&l(p,h,g.parent),n.set(I1(g.uri,p.slice(g.sourceRoot.length)),h.slice(g.targetRoot.length))}}var Q0="https://effect.invalid/.json-schema/";function w1(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function b1(e,t){if(typeof e!="string")return;let r=w1(e,t);if(r!==void 0)return r.hash="",r.href}function SK(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${y1(t)}`}function I1(e,t){return`${e}\0${JSON.stringify(t)}`}function k1(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function EK(e,t,r){return yK(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:Y0(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var bK=new Set(["properties","patternProperties"]),IK=new Set(["allOf","anyOf","oneOf"]),CK=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function TK(e,t,r,n,o,s=bK){let a;if(s.has(t))a=n.schemaMap(r,t);else if(IK.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return U(e,t,a),!0}var A1=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],ble=[...A1,"deprecated"],Ile=[...A1,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],wK=/^[A-Za-z_][-A-Za-z0-9._]*$/,kK=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Ci(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function AK(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&Ci(o,r,`it is not active in ${n} but would become active in the target`)}var vK=["additionalItems","definitions","dependencies"];function OK(e,t,r,n,o){r.isDocumentRoot?U(e,"$schema",E1(t,S1)?n:t):E1(t,S1)||Ci("$schema",o,"an embedded resource cannot declare a different dialect")}function _K(e,t){AK(e,vK,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!TK(r,a,i,t,CK))switch(a){case"$ref":n=i;break;case"$schema":OK(r,i,t,hK,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":U(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":Ci(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;U(r,a,i);break;default:U(r,a,i)}}if(PK(r,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&Ci("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&U(r,"minContains",a)}else Object.hasOwn(e,"minContains")&&U(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&U(r,"maxContains",e.maxContains);return RK(e,r,t,"draft-07"),NK(e,r,"$id","Draft-07"),FK(r,n,t),r}function PK(e,t,r,n){if(t===void 0){r!==void 0&&U(e,"items",n.schema(r,"items"));return}U(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&U(e,"additionalItems",n.schema(r,"items","additionalItems"))}function FK(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),$K(e,n)}else r.reference(e,t)}function RK(e,t,r,n){let o=Lr(e.dependentRequired)?e.dependentRequired:void 0,s=Lr(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 f=o?.[c],u=s?.[c],l=n==="draft-04"&&Array.isArray(f)&&f.length===0;u===void 0?l||U(a,c,f):f===void 0||l?U(a,c,r.schemaAt(u,["dependentSchemas",c],["dependencies",c])):U(a,c,{allOf:[r.schemaAt(u,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:f}]})}Object.keys(a).length>0&&U(t,"dependencies",a)}function $K(e,t){Array.isArray(e.allOf)?e.allOf.push(t):U(e,"allOf",[t])}function NK(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&U(t,r,o);return}(typeof s!="string"||!wK.test(s))&&Ci("$anchor",n,"the anchor is not valid"),kK.test(s)||Ci("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?U(t,r,`#${s}`):Ci("$anchor",n,"it cannot be combined with the schema $id")}function Sg(e){return jn(ku(e.ast),{schema:e})}var ku=pi(e=>{let t=UK(e,ku),r=e.context;return t===e||r===void 0?t:Hh(t,X0(r))});function X0(e){return e.constructorDefault===void 0?e:new Fo(e.isOptional,e.isMutable,void 0,e.annotations)}function _1(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function P1(e){return t=>{let r=[...t].sort((o,s)=>e(Mn(o))-e(Mn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var MK=P1(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function UK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Cn(r))return Je(e,[LI]);let n=e.typeParameters.map(s=>jn(Mn(s))),o=r(n);return o===void 0?e:Je(e,[gu(o,t)])}case"Unknown":return Je(e,[LI]);case"ObjectKeyword":return Je(e,[PN]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return _1(e),e.recur(t,Vh);case"Union":{let r=MK(e.types);return r!==e.types?new _r(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 Eg(e){return jn(F1(It(e.ast)))}var F1=bn(e=>{let t=DK(e,F1);return t!==e&&e.context!==void 0?Hh(t,X0(e.context)):t});function DK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Cn(r)){let n=r(e.typeParameters.map(o=>jn(o)));return Je(e,[gu(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function bg(e){return jn(M1(e.ast),{schema:e})}function R1(e){return jn(U1(e.ast))}var LK=P1(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function BK(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(f=>jn(t(Mn(f)))),o=e.annotations?.toCodecStringTree;if(Cn(o)){let f=o(n);return f===void 0?e:Je(e,[gu(f,t)])}let s=e.annotations?.toCodecJson,a=Cn(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(Cn(i)?i(n):void 0);return c===void 0?r(e):Je(e,[gu(c,t)])}case"Null":return Je(e,[jK]);case"Boolean":return Je(e,[zK]);case"Unknown":case"ObjectKeyword":return Je(e,[BI]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return _1(e),e.recur(t,Vh);case"Union":{let n=LK(e.types);return n!==e.types?new _r(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 jK=new ft(new Xr("null"),new Ne(pe(()=>null),pe(()=>"null"))),zK=new ft(new _r([new Xr("true"),new Xr("false")]),new Ne(pe(e=>e==="true"),ci())),$1=new Ne(pe(e=>typeof e=="string"?[e]:e),Po()),N1=e=>e.transformation===$1,M1=pi(e=>{let t=BK(e,M1,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?Hh(t,X0(e.context)):t},{stopAt:N1}),O1=e=>Kt(e)?di(ds):ds,U1=pi(e=>{let t=qK(e);if(gI(t)){let r=xu(new _r([new mn(t.isMutable,t.elements.map(O1),t.rest.map(O1)),Yr],{mode:"anyOf"}),t,$1);return Kt(e)?di(r):r}return t},{stopAt:N1});function qK(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(U1):e}var Tle=globalThis.RegExp;var gs=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function ua(e,t){return t.length>0&&(e+=`
34
+ at ${Id(t)}`),new Error(e)}function D1(e){return`#/$defs/${J0(e)}`}var HK=new Set([...fR,ai,...uR]);function bp(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;yu(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&yu(i)&&(r.examples=i);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let f=e.writeOnly;typeof f=="boolean"&&(r.writeOnly=f);let u=e.format;typeof u=="string"&&(r.format=u);let l=e.contentEncoding;typeof l=="string"&&(r.contentEncoding=l);let p=e.contentMediaType;typeof p=="string"&&(r.contentMediaType=p);let h=e.contentSchema;if(yu(h)&&(r.contentSchema=h),t?.includeAnnotationKey!==void 0)for(let[g,x]of Object.entries(e))HK.has(g)||!t.includeAnnotationKey(g)||yu(x)&&U(r,g,x);return Object.keys(r).length===0?void 0:r}function L1(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=L1(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 WK(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 B1="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function Ig(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function VK(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var GK="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",KK="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function JK(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(GK.includes(`|${o}|`))n[o]=Math.max(s,a);else if(KK.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 rC="|title|description|default|examples|readOnly|writeOnly|",ZK=B1+rC;function Ip(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=WK(e);if(o!==void 0||s){let i=L1(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",f={...e,type:c};s&&delete f.anyOf;let u=Object.keys(i.schema);return u.length===0?f:Ig(i.schema,rC)&&VK(f,u)?{...f,...i.schema}:Ip(f,i.schema,r)}}if(r){let i=JK(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 tC(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>tC(r,t)))}function QK(e){return Array.isArray(e)}function YK(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,f=Object.keys(r);for(let m of f)g(m,["references",m]);let u=Ft(e,(m,S)=>w(m,t[S],[]));for(let[m,S]of i.values())if(!tC(m))for(let E of S)Array.isArray(E.oneOf)&&(E.anyOf=E.oneOf,delete E.oneOf);for(let m of f){let S=r[m],E=b(S);if(E===void 0)continue;let I=o.get(m)[0],k=c.get(E),_=k?.find(M=>W(o.get(M)[0],I));_===void 0?k===void 0?c.set(E,[m]):k.push(m):s.set(m,_)}let l=Ft(u,x),p={};for(let m of f)s.has(m)||U(p,m,x(o.get(m)[0]));return{dialect:"draft-2020-12",schemas:l,definitions:p};function h(m){return Array.isArray(m.oneOf)&&i.get(m.oneOf)?.[1].push(m),m}function g(m,S){if(!Object.hasOwn(r,m))throw ua(`Invalid reference ${m}`,[...S,"$ref"]);let E=o.get(m);if(E!==void 0)return E;let I=[{},[]];return o.set(m,I),I[0]=w(r[m],["references",m],I[1]),I}function x(m){return T1(m,S=>{let E=Z0(S);if(E===void 0){if(/^#(?:\/|%2f)/i.test(S))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(S)}`);return S}if(!E.startsWith("/$defs/"))return S;let I=E.indexOf("/",7),k=s.get(Sp(E.slice(7,I<0?void 0:I)));return k===void 0?S:S.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,D1(k))})}function b(m){if(m._tag==="Reference")return;let S=m.checks.length===0?m.annotations:m.checks[m.checks.length-1].annotations;return typeof S?.identifier!="string"&&typeof S?.[ai]=="string"?S[ai]:void 0}function T(m,S,E,I){let k=m.annotations,_=k?.toJsonSchema;if(_!==void 0){let oe=m.representation?.schemas?.map((Bo,cf)=>w(Bo,[...E,"representation","schemas",cf],I))??[],be=_({type:S,schemas:oe}),Le=QK(be);Le&&I.push(!1);let lt=Le?be[0]:be,Et=bp(k,n),Tr=Et===void 0?lt:{...lt,...Et},nn=Et===void 0?B1:ZK;return[Tr,m._tag==="Filter"&&Ig(Tr,nn)&&(Et===void 0||Ig(Et,rC))?!0:void 0]}if(m._tag==="Filter"){I.push(!1);return}let M=m.checks.flatMap((oe,be)=>{let Le=T(oe,S,[...E,"checks",be],I);return Le===void 0?[]:[Le[0]]});if(M.length===0)return;let z=bp(k,n),de={allOf:M};return[z===void 0?de:{...de,...z}]}function w(m,S,E){if(m._tag==="Reference")return E.push(g(m.$ref,S)[1]),{$ref:D1(m.$ref)};let I=a.get(m);if(I!==void 0)return E.push(I[1]),I[0];let k=[];E.push(k);let _=P(m,S,k),M=bp(m.annotations,n);M!==void 0&&(_={..._,...M});for(let z=0;z<m.checks.length;z++){let de=typeof _.type=="string"&&XK(_.type)?_.type:void 0,oe=T(m.checks[z],de,[...S,"checks",z],k);oe!==void 0&&(_=Ip(_,...oe))}return a.set(m,[_,k]),h(_)}function P(m,S,E){switch(m._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(m.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(m.symbol)]};case"Declaration":return E.push(!1),{};case"Suspend":return w(m.thunk,[...S,"thunk"],E);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 I=m.literal;return typeof I=="bigint"?{type:"string",enum:[globalThis.String(I)]}:{type:typeof I,enum:[I]}}case"Enum":{let I=m.enums.map(([k,_],M)=>{if(typeof _=="number"&&!globalThis.Number.isFinite(_))throw ua(`Invalid numeric enum value ${globalThis.String(_)}`,[...S,"enums",M,1]);return{type:typeof _,enum:[_],title:k}});return I.length===0?{not:{}}:{anyOf:I}}case"TemplateLiteral":return{type:"string",pattern:`^${m.parts.map(Cg).join("")}$`};case"Arrays":{if(m.rest.length>1)throw ua("Invalid schema representation document",[...S,"rest"]);let I={type:"array"},k=m.elements.length,_=m.elements.map((M,z)=>{M.isOptional&&k--;let de=w(M.type,[...S,"elements",z,"type"],E),oe=bp(M.annotations,n);return oe===void 0?de:h(Ip(de,oe))});if(_.length>0?(I.prefixItems=_,I.maxItems=m.elements.length,k>0&&(I.minItems=k)):I.items=!1,m.rest.length===1){delete I.maxItems;let M=w(m.rest[0],[...S,"rest",0],E);Object.keys(M).length>0?I.items=M:delete I.items}return I}case"Objects":{if(m.propertySignatures.length===0&&m.indexSignatures.length===0)return{not:{type:"null"}};let I={type:"object"},k={},_=[];for(let Le=0;Le<m.propertySignatures.length;Le++){let lt=m.propertySignatures[Le];if(typeof lt.name!="string")throw ua("Invalid schema representation document",[...S,"propertySignatures",Le,"name"]);let Et=lt.name,Tr=w(lt.type,[...S,"propertySignatures",Le,"type"],E),nn=bp(lt.annotations,n);U(k,Et,nn===void 0?Tr:h(Ip(Tr,nn))),lt.isOptional||_.push(Et)}m.propertySignatures.length>0&&(I.properties=k),_.length>0&&(I.required=_);let M={},z=[],de=[],oe=!1;for(let Le=0;Le<m.indexSignatures.length;Le++){let lt=m.indexSignatures[Le],Et=w(lt.type,[...S,"indexSignatures",Le,"type"],E);W(Et,{not:{}})&&(Et=!1),de.push(Et);let Tr=O(lt.parameter,[...S,"indexSignatures",Le,"parameter"],new Set);if(Tr===void 0){oe=!0,E.push(!1);continue}if(Tr.length===0)z.push(Et);else for(let nn of Tr){let Bo=M[nn];U(M,nn,Bo===void 0?Et:Bo===!1||Et===!1?!1:h(Ip(Bo,Et)))}}let be=Object.keys(M).length>0;if(be&&(I.patternProperties=M),oe&&n?.onExcessProperty==="error"){let Le=[];m.propertySignatures.length>0&&Le.push({enum:Object.keys(k)});for(let lt=0;lt<m.indexSignatures.length;lt++)Le.push(w(m.indexSignatures[lt].parameter,[...S,"indexSignatures",lt,"parameter"],E));I.propertyNames=Le.length===1?Le[0]:{anyOf:Le},I.additionalProperties=de.length===1?de[0]:{anyOf:de},z.length>0&&(I.allOf=z.map(lt=>({type:"object",additionalProperties:lt})))}else z.length===0?I.additionalProperties=oe||n?.onExcessProperty!=="error":z.length===1&&m.propertySignatures.length===0&&!be?I.additionalProperties=z[0]:z.length>0&&(I.allOf=z.map(Le=>({type:"object",additionalProperties:Le})));return typeof I.additionalProperties=="object"&&I.additionalProperties!==null&&Object.keys(I.additionalProperties).length===0&&delete I.additionalProperties,I}case"Union":{let I=[],k=m.types.map((M,z)=>w(M,[...S,"types",z],I));if(E.push(I),k.length===0)return{not:{}};let _=m.options?.mode??"anyOf";if(_==="anyOf"&&k.length>1){let M=eJ(k);if(M!==void 0)return M}return _==="oneOf"&&i.set(k,[I,[]]),{[_]:k}}}}function O(m,S,E){switch(m._tag){case"Reference":{if(!Object.hasOwn(r,m.$ref))throw ua(`Invalid reference ${m.$ref}`,[...S,"$ref"]);if(g(m.$ref,S),E.has(m.$ref))return;let I=new Set(E).add(m.$ref);return O(r[m.$ref],["references",m.$ref],I)}case"String":{if(m.checks.length===0)return[];if(m.checks.length!==1||m.checks[0]._tag!=="Filter"||m.checks[0].annotations?.toJsonSchema===void 0)return;let I=[],k=w(m,S,I);return tC(I)&&k.type==="string"&&typeof k.pattern=="string"&&Ig(k,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[k.pattern]:void 0}case"TemplateLiteral":return m.checks.length===0?[`^${m.parts.map(Cg).join("")}$`]:void 0;case"Union":{if(m.types.length===0||m.checks.length>0||m.options?.mode==="oneOf")return;let I=[];for(let k=0;k<m.types.length;k++){let _=O(m.types[k],[...S,"types",k],E);if(_===void 0)return;if(_.length===0)return[];I.push(..._)}return I}default:throw ua("Invalid schema representation document",S)}}}function XK(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function eJ(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 Cg(e){switch(e._tag){case"Literal":return gs(globalThis.String(e.literal));case"String":return TN;case"Number":return Lh;case"TemplateLiteral":return e.parts.map(Cg).join("");case"Union":return`(?:${e.types.map(Cg).join("|")})`;default:throw ua("Invalid schema representation document",[])}}function Tg(e,t){let r=YK([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var tJ=({identifier:e})=>e;function zn(e){return e===void 0?void 0:{annotations:e}}function Cp(e,t){let{references:r,representations:n}=rJ([e],t);return{representation:n[0],references:r}}function rJ(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let m of e)h(m);let i=t?.referencePolicy??tJ;for(let m of s.values())for(let S of m.values()){let E=i({ast:S.ast,occurrences:S.occurrences,identifier:S.identifier});if(E!==void 0){let I=E===S.identifier||!E.endsWith("_")?"_":"";S.reference=f(E,S,I)}else S.isRecursive&&(S.reference=f(`${S.ast._tag}_`,S,""))}return{representations:Ft(e,m=>x(m)),references:r};function f(m,S,E="_"){let I=m,k=0;for(;n.has(I);){if(n.get(I)===S)return I;I=`${m}${E}${++k}`}return n.set(I,S),I}function u(m,S,E){let I=S.fallback;return I!==void 0?Rb(m)===I?m:Nn(m,{[ai]:I}):E===S.identifier?m:Nn(m,{identifier:E})}function l(m,S){if(!Object.hasOwn(r,m)&&!o.has(m)){o.add(m);let E=b(S);o.delete(m),U(r,m,E)}return{_tag:"Reference",$ref:m}}function p(m){let S=hu(m),E=mu(S),I=tu(S),k=I===void 0?(S!==m?tu(m):void 0)??Rb(S):void 0;k!==void 0&&(I=`${k}Encoded`);let _=s.get(E);_===void 0&&(_=new Map,s.set(E,_));let M=_.get(I);return M===void 0&&(M={ast:E,identifier:I,fallback:k,occurrences:0,isRecursive:!1,reference:void 0},_.set(I,M)),M}function h(m){let S=p(m),E=S.ast;if(S.occurrences++,a.has(S)){S.isRecursive=!0;return}if(!(S.occurrences>1)){switch(a.add(S),g(E.checks),E._tag){case"Declaration":case"Arrays":case"Objects":case"Union":E.recur(I=>(h(I),I));break;case"TemplateLiteral":E.parts.forEach(h);break;case"Suspend":h(E.thunk());break}a.delete(S)}}function g(m){m?.forEach(S=>{S.annotations?.representation?.schemas?.forEach(E=>h(It(E))),S._tag==="FilterGroup"&&g(S.checks)})}function x(m){let S=p(m),E=S.ast,I=S.reference;if(I!==void 0){let k=S.identifier===void 0?E:u(E,S,I);return l(I,k)}return b(E)}function b(m){let S=T(m.checks);switch(m._tag){case"Declaration":return{_tag:"Declaration",typeParameters:m.typeParameters.map(E=>x(E)),checks:S,...P(m.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:m._tag,checks:S,...zn(m.annotations)};case"Literal":return{_tag:"Literal",literal:m.literal,checks:S,...zn(m.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:m.symbol,checks:S,...zn(m.annotations)};case"Enum":return{_tag:"Enum",enums:m.enums,checks:S,...zn(m.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:m.parts.map(E=>x(E)),checks:S,...zn(m.annotations)};case"Arrays":return{_tag:"Arrays",elements:m.elements.map(E=>{let I=hu(E),k=I.context?.annotations;return{isOptional:Kt(I),type:x(E),...zn(k)}}),rest:m.rest.map(E=>x(E)),checks:S,...zn(m.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:m.propertySignatures.map(E=>{let I=hu(E.type),k=I.context?.annotations;return{name:E.name,type:x(E.type),isOptional:Kt(I),isMutable:EN(I),...zn(k)}}),indexSignatures:m.indexSignatures.map(E=>({parameter:x(E.parameter),type:x(E.type)})),checks:S,...zn(m.annotations)};case"Union":return{_tag:"Union",types:m.types.map(E=>x(E)),...m.options===void 0?{}:{options:m.options},checks:S,...zn(m.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:x(m.thunk()),...zn(m.annotations)}}}function T(m){return m?.map(w)??[]}function w(m){switch(m._tag){case"Filter":return{_tag:"Filter",aborted:m.aborted,...O(m.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Ft(m.checks,w),...O(m.annotations)}}}function P(m){if(m===void 0)return;let{representation:S,...E}=m;return{...S===void 0?void 0:{representation:S},...Object.keys(E).length===0?void 0:{annotations:E}}}function O(m){if(m===void 0)return;let{representation:S,...E}=m,I=S===void 0?void 0:S.schemas===void 0?S:{...S,schemas:S.schemas.map(k=>x(It(k)))};return{...I===void 0?void 0:{representation:I},...Object.keys(E).length===0?void 0:{annotations:E}}}}function q1(e){return ut(e)?e.value:{issues:[{message:XO(e.cause)}]}}function W1(e,t){let r=St(e),n={errors:"all",...t?.parseOptions},o=yR(t),s=a=>{let i=new Ba("sync"),c=wo(Zs(r(a,n),{onFailure:o,onSuccess:u=>({value:u})}),{scheduler:i});c.currentDispatcher?.flush();let f=c.pollUnsafe();return f?q1(f):new Promise(u=>{c.addObserver(l=>{u(q1(l))})})};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 nJ(e){let t=Cp(ku(e));return Tg(t)}function H1(e,t){let r=nJ(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=C1(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function V1(e){let t={input(r){return H1(e.ast,r.target)},output(r){return H1(It(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 K1(e,t){let r=[];return nC(e,t,"",r),r}function nC(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++)nC(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(wg(e)&&wg(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}/${K0(i)}`,f=Object.hasOwn(e,i),u=Object.hasOwn(t,i);f&&u?nC(e[i],t[i],c,n):!f&&u?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 J1(e,t){let r=t;for(let n of e)r=aJ(r,n);return r}function wg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sJ(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(Sp)}function Z1(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function aJ(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=iJ(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:Z1(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,G1(s,c)}if(wg(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]:U(a,n,t.value),G1(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function iJ(e,t){let r=sJ(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=Z1(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(wg(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 G1(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};U(a,s,r),r=a}}return r}function Y1(e){let t=Sg(e),r=gg(t),n=hg(t);return{empty:[],diff:(o,s)=>K1(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=J1(s,a);return Object.is(i,a)?o:n(i)}}}function X1(e,t){let r=tu(e.ast)??$b(e.ast),n=c1(bg(e));return o=>n(o).pipe(ne(s=>uJ(s,{rootName:r,...t})))}function uJ(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 u(r,e,0),c.join(o?`
35
+ `:"");function f(l,p){c.push(o?s.repeat(l)+p:p)}function u(l,p,h,g){let{attrs:x,safe:b}=Au.tagInfo(l,g);if(p===void 0)f(h,`<${b}${x}/>`);else if(typeof p=="string")f(h,`<${b}${x}>${Au.escapeText(p)}</${b}>`);else if(typeof p!="object"||p===null)f(h,`<${b}${x}>${Au.escapeText(N(p))}</${b}>`);else{if(i.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});i.add(p);try{if(globalThis.Array.isArray(p)){if(p.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of p)u(n,P,h+1);f(h,`</${b}>`);return}let T=p,w=Object.keys(T);if(a&&w.sort(),w.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of w)u(Au.parseTagName(P).safe,T[P],h+1,P);f(h,`</${b}>`)}finally{i.delete(p)}}}}var Au={escapeText(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},escapeAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},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}=Au.parseTagName(e),s=r||t&&t!==e?` data-name="${Au.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var oC=bn(e=>fa(e));function fa(e){let t=ls(e)?.toEquivalence;if(t)return t(pu(e)?e.typeParameters.map(fa):[]);switch(e._tag){case"Never":return Ra();case"Declaration":return lJ(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 W;case"Arrays":{let r=e.elements.map(fa),n=e.rest.map(fa),[o,...s]=n,a=s.length;return yr((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let f=i.length;if(f!==c.length)return!1;let u=0;for(;u<Math.min(f,e.elements.length);u++)if(!r[u](i[u],c[u]))return!1;if(n.length>0){for(;u<f-a;u++)if(!o(i[u],c[u]))return!1;for(let l=0;l<a;l++)if(!s[l](i[u+l],c[u+l]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return W;let r=e.propertySignatures.map(o=>fa(o.type)),n=e.indexSignatures.map(o=>fa(o.type));return yr((o,s)=>{if(!Lr(o)||!Lr(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,f=Object.hasOwn(o,c),u=Object.hasOwn(s,c);if(Kt(i.type)&&f!==u||f&&u&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=oa(o,i.parameter),f=oa(s,i.parameter);if(c.length!==f.length)return!1;for(let u=0;u<c.length;u++){let l=c[u];if(!Object.hasOwn(s,l)||!n[a](o[l],s[l]))return!1}}return!0})}case"Union":{let r=It(e).types,n=op(r),o=r.map((s,a)=>[yp(s),fa(e.types[a])]);return yr((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[f,u]=o[i[c]];if(f(s)&&f(a))return u(s,a)}return!1})}case"Suspend":{let r;return yr((n,o)=>(r??=oC(e.thunk()))(n,o))}}}function lJ(e){let t=e.annotations?.representation;if(t===void 0)return W;switch(t.id){case"effect/schema/Option":{let[r]=Ti(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Ti(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]=Ti(e);return tU(r,n)}case"effect/schema/Cause":{let[r,n]=Ti(e);return eU(r,n)}case"effect/schema/Exit":{let[r,n,o]=Ti(e),s=eU(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]=Ti(e);return bd(r,n)}case"effect/schema/ReadonlySet":return xf(Ti(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 W}}function Ti(e){return e.typeParameters.map(fa)}function tU(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 eU(e,t){let r=Ad(tU(e,t));return(n,o)=>r(n.reasons,o.reasons)}function nU(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 rU(e,t){let r=nU(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function oU(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=ls(a)?.toFormatter;if(typeof i=="function")return i(pu(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 N;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let i=a.annotations?.representation;if(i===void 0)return N;let c=a.typeParameters.map(n);switch(i.id){case"effect/schema/Option":{let[f]=c;return Re({onNone:()=>"none()",onSome:u=>`some(${f(u)})`})}case"effect/schema/Result":{let[f,u]=c;return Sr({onSuccess:l=>`success(${f(l)})`,onFailure:l=>`failure(${u(l)})`})}case"effect/schema/CauseReason":return nU(c[0],c[1]);case"effect/schema/Cause":return rU(c[0],c[1]);case"effect/schema/Exit":{let[f,u,l]=c,p=rU(u,l);return h=>{switch(h._tag){case"Success":return`Exit.Success(${f(h.value)})`;case"Failure":return`Exit.Failure(${p(h.cause)})`}}}case"effect/schema/ReadonlyMap":{let[f,u]=c;return l=>{let p=l.size;if(p===0)return"ReadonlyMap(0) {}";let h=globalThis.Array.from(l.entries()).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`ReadonlyMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{let[f,u]=c;return l=>{let p=kM(l);if(p===0)return"HashMap(0) {}";let h=mp(l).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`HashMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[f]=c;return u=>{let l=u.size;if(l===0)return"ReadonlySet(0) {}";let p=globalThis.Array.from(u.values()).sort().map(h=>`${f(h)}`);return`ReadonlySet(${l}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{let[f]=c;return u=>{let l=PM(u);if(l===0)return"HashSet(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`HashSet(${l}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{let[f]=c;return u=>{let l=eF(u);if(l===0)return"Chunk(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`Chunk(${l}) { ${p.join(", ")} }`}}default:return N}}case"Arrays":{let i=a.elements.map(p=>n(p)),c=a.rest.map(n),[f,...u]=c,l=u.length;return p=>{let h=[],g=0;for(;g<i.length;g++)if(p.length<g+1){if(Kt(a.elements[g]))continue}else h.push(i[g](p[g]));if(c.length>0){for(;g<p.length-l;g++)h.push(f(p[g]));for(let x=0;x<l;x++)h.push(u[x](p[g+x]))}return"["+h.join(", ")+"]"}}case"Objects":{let i=a.propertySignatures.map(f=>n(f.type)),c=a.indexSignatures.map(f=>n(f.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?N:f=>{let u=[],l=new Set;for(let p=0;p<i.length;p++){let h=a.propertySignatures[p],g=h.name;l.add(g),!(Kt(h.type)&&!Object.hasOwn(f,g))&&u.push(`${Xn(g)}: ${i[p](f[g])}`)}for(let p=0;p<c.length;p++){let h=oa(f,a.indexSignatures[p].parameter);for(let g of h)l.has(g)||(l.add(g),u.push(`${Xn(g)}: ${c[p](f[g])}`))}return u.length>0?"{ "+u.join(", ")+" }":"{}"}}case"Union":{let i=It(a).types,c=op(i),f=i.map((u,l)=>[yp(u),n(a.types[l])]);return u=>{let l=c(u,!1);for(let p=0;p<l.length;p++){let[h,g]=f[l[p]];if(h(u))return g(u)}return N(u)}}case"Suspend":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var sC=d(2,(e,t)=>cC(e,(r,n)=>aU(t,r)?[r,n]:void 0)),aC=d(2,(e,t)=>cC(e,(r,n)=>aU(t,r)?void 0:[r,n])),sU=d(2,(e,t)=>({...e,...t}));var iC=d(2,(e,t)=>cC(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var mr=e=>e;function aU(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function cC(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;U(r,s,a)}}return r}function uU(e,t){return qn(vu("Iso",e,t))}function iU(e,t){return qn(vu("Lens",e,t))}function vu(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var mJ={kind:"Iso",get:F,set:F},kg=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=Ag(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];U(s,i,Ag(s[i])),s=s[i]}return U(s,t[a],r),o}}},Tp=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=r=>AN(t,r)}};function wi(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 kg([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new Tp([...s.checks,...o.checks]):r.push(o)}return r}function hJ(e,t){return qn(vu("Optional",e,t))}var Ou=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Of(this.replaceResult(t,r),()=>r)}modify(t){return r=>Of(Pt(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return qn(wi(this.node,t.node))}key(t){return qn(wi(this.node,[new kg([t])]))}optionalKey(t){return qn(wi(this.node,vu("Lens",r=>r[t],(r,n)=>{let o=Ag(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&uc(t))?o.splice(Number(t),1):delete o[t]:U(o,t,r),o})))}check(...t){return qn(wi(this.node,[new Tp(t)]))}refine(t,r){return qn(wi(this.node,[new Tp([qh(t,r)])]))}tag(t){let r=Z(new ue({expected:`${JSON.stringify(t)} tag`}));return qn(wi(this.node,vu("Prism",n=>n._tag===t?H(n):r,F)))}at(t,...r){let n=Z(new At([t],new na(void 0)));return qn(wi(this.node,vu("Optional",o=>Object.hasOwn(o,t)?H(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=Ag(s);return U(a,t,o),H(a)}else return n})))}pick(t){return this.compose(iU(sC(t),(r,n)=>({...aC(n,t),...r})))}omit(t){return this.compose(iU(aC(t),(r,n)=>({...sC(n,t),...r})))}notUndefined(){return this.refine(pt,{expected:"a value other than `undefined`"})}forEach(t){let r=t(vg());return hJ(n=>Mt(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);wt(i)&&s.push(i.success)}return s}),(n,o)=>Pt(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)wt(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return Z(new ue({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let f=a[c],u=r.replaceResult(n[c],s[f]);if(Se(u))return Z(new At([f],u.failure));i[f]=u.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Of(Pt(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},fC=class extends Ou{get;set;constructor(t,r,n){super(t,o=>H(r(o)),o=>H(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)))}},lC=class extends Ou{get;constructor(t,r,n){super(t,o=>H(r(o)),(o,s)=>H(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},pC=class extends Ou{set;constructor(t,r,n){super(t,r,(o,s)=>H(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Of(Mt(this.getResult(r),n=>this.set(t(n))),()=>r)}};function qn(e){let t=e[0]??mJ;if(e.length>1){let r=e.reduce((n,o)=>yJ(n,o.kind),"Iso");t={kind:r,get:gJ(e,r),set:xJ(e,r)}}switch(t.kind){case"Iso":return new fC(e,t.get,t.set);case"Lens":return new lC(e,t.get,t.set);case"Prism":return new pC(e,t.get,t.set);case"Optional":return new Ou(e,t.get,t.set)}}function Ag(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 gJ(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(dC(o.kind)){if(Se(s))return s;r=s.success}else r=s}return dC(t)?H(r):r}}function xJ(e,t){return cU(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(dC(i.kind)){let c=i.get(n);if(Se(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(cU(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(Se(c))return c;r=c.success}}return t==="Optional"?H(r):r}}function dC(e){return e==="Prism"||e==="Optional"}function cU(e){return e==="Iso"||e==="Prism"}function yJ(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var SJ=qn([]);function vg(){return SJ}function lU(e){let t=Eg(e);return uU(gg(t),hg(t))}function pU(e){return vg()}function dU(e){return vg()}var _u="~effect/Schema/SchemaError";function mU(e){return A(e,_u)&&e[_u]===_u}var rn="~effect/net/NetAddress";var Hn=e=>e.value,Wn=e=>e,xs=e=>e.bytes,gn=class extends cn("NetAddressError"){},Pu=e=>A(e,rn),Jt=e=>Pu(e)&&e._tag==="Ipv4Address",xn=e=>Pu(e)&&e._tag==="Ipv6Address",mC=e=>Jt(e)||xn(e),Fu=e=>Jt(e)?32:128;var Ru=e=>Pu(e)&&e._tag==="MacAddress",kp=e=>Pu(e)&&e._tag==="InetAddressV4",Ap=e=>Pu(e)&&e._tag==="InetAddressV6",hC=e=>kp(e)||Ap(e),Og=e=>Pu(e)&&e._tag==="UnixPathAddress",hU=e=>hC(e)||Og(e),bJ={...mt,_tag:"Ipv4Address",[rn]:rn,[X](e){return Jt(e)&&Hn(this)===Hn(e)},[Y](){return Bt(ie(wJ,Hn(this)|0))},toString(){return Zt(this)},toJSON(){return this.toString()}},IJ={...mt,_tag:"Ipv6Address",[rn]:rn,[X](e){if(!xn(e))return!1;let t=Wn(this),r=Wn(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[Y](){let e=Wn(this),t=ie(kJ,e.w0|0);return t=ie(t,e.w1|0),t=ie(t,e.w2|0),Bt(ie(t,e.w3|0))},toString(){return Zt(this)},toJSON(){return this.toString()}},CJ={...mt,_tag:"MacAddress",[rn]:rn,[X](e){return Ru(e)&&TJ(xs(this),xs(e))},[Y](){return ie(AJ,Yn(xs(this)))},toString(){return yC(this)},toJSON(){return this.toString()}},TJ=(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},wJ=Ae("Ipv4Address"),kJ=Ae("Ipv6Address"),AJ=Ae("MacAddress"),vJ=e=>{let t=Object.create(bJ);return t.value=e>>>0,Object.freeze(t)},OJ=(e,t,r,n)=>{let o=Object.create(IJ);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},_J=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var wp=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],PJ=e=>{let t=Object.assign(Object.create(CJ),{bytes:new Uint8Array(e)});return Object.freeze(t)};var st=(e,t)=>Z(new gn({input:e,message:t})),gU=(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},FJ=e=>gU(e,255)?H(vJ(_J(e[0],e[1],e[2],e[3]))):st(e,"octets must be integers from 0 through 255"),RJ=e=>gU(e,65535)?H(OJ(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):st(e,"segments must be integers from 0 through 65535");var xU=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?H(PJ(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):st(e,"expected six two-digit hexadecimal octets separated by colons");var ki=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return st(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return st(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?st(e,"octets must be at most 255"):FJ([r[0],r[1],r[2],r[3]])},$J=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return st(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return st(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(u=>u==="")||n.some(u=>u===""))return st(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 st(e,"embedded IPv4 syntax must be trailing");let u=Mt(ki(o),l=>{let p=Hn(l);return[p>>>16,p&65535]});if(Se(u))return u;s=u.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 st(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let i=u=>/^[0-9a-fA-F]{1,4}$/.test(u)?Number.parseInt(u,16):void 0,c=r.map(i),f=n.map(i);return c.some(u=>u===void 0)||f.some(u=>u===void 0)?st(e,"segments must contain one through four hexadecimal digits"):H([...c,...Array(8-a).fill(0),...f,...s??[]])},Ai=e=>Pt($J(e),t=>RJ(t)),la=e=>e.includes(":")?Ai(e):ki(e);var gC=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=vp(e);return wt(t)&&t.success===e},vp=e=>{let t=e.indexOf("%");if(t===-1)return st(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return st(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return Mt(Ai(e.slice(0,t)),n=>`${Zt(n)}%${r}`)};var _g=e=>wp(Hn(e)),NJ=e=>{let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},xC=e=>{let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return[...wp(t),...wp(r),...wp(n),...wp(o)]};var yC=e=>Array.from(xs(e),t=>t.toString(16).padStart(2,"0")).join(":"),Pg=e=>xs(e).every(t=>t===255),MJ=e=>(xs(e)[0]&1)!==0,Fg=e=>(xs(e)[0]&1)===0,SC=e=>(xs(e)[0]&2)!==0,EC=e=>(xs(e)[0]&2)===0;var Zt=e=>{if(Jt(e))return _g(e).join(".");let t=NJ(e);if(UJ(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}`},Rg=e=>{if(Jt(e))return Hn(e)===0;let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return t===0&&r===0&&n===0&&o===0},bC=e=>{if(Jt(e))return Hn(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=Wn(e);return t===0&&r===0&&n===0&&o===1},$u=e=>Ru(e)?MJ(e):Jt(e)?Hn(e)>>>28===14:Wn(e).w0>>>24===255,$g=e=>Ru(e)?Pg(e):Hn(e)===4294967295,IC=e=>Ru(e)?Fg(e):!$u(e)&&!Rg(e)&&(!Jt(e)||!$g(e)),CC=e=>Jt(e)?Hn(e)>>>16===43518:(Wn(e).w0>>>16&65472)===65152,TC=e=>{let t=Hn(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},wC=e=>(Wn(e).w0>>>24&254)===252,UJ=e=>{let{w0:t,w1:r,w2:n}=Wn(e);return t===0&&r===0&&n===65535};var DJ={...mt,_tag:"InetAddressV4",[rn]:rn,[X](e){return kp(e)&&this.port===e.port&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.port))},toString(){return Ng(this)},toJSON(){return this.toString()}},LJ={...mt,_tag:"InetAddressV6",[rn]:rn,[X](e){return Ap(e)&&this.port===e.port&&this.scopeId===e.scopeId&&W(this.address,e.address)},[Y](){return ie(ie(q(this.address),dt(this.port)),dt(this.scopeId))},toString(){return Ng(this)},toJSON(){return this.toString()}},yU=e=>Number.isInteger(e)&&e>=0&&e<=65535,BJ=(e,t)=>{if(!yU(t))return st(e,"port must be an integer from 0 through 65535");let r=Object.create(DJ);return r.address=e,r.port=t,H(Object.freeze(r))},jJ=(e,t,r)=>{if(!yU(t))return st(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return st(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(LJ);return o.address=e,o.port=t,o.scopeId=n,H(Object.freeze(o))};var kC=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 st(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 st(e,"scope identifier must be decimal");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,a)}}else{let s=e.lastIndexOf(":");if(s<0)return st(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return st(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?Pt(la(t),s=>o!==xn(s)?st(e,"only IPv6 addresses use brackets"):xn(s)?jJ(s,Number(r),{scopeId:n}):BJ(s,Number(r))):st(e,"port must be an unpadded decimal integer")};var zJ=e=>Zt(e.address)+(Ap(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var Ng=e=>{let t=zJ(e);return kp(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var qJ={...mt,_tag:"UnixPathAddress",[rn]:rn,[X](e){return Og(e)&&this.path===e.path},[Y](){return ie(Ae("UnixPathAddress"),Ae(this.path))},toString(){return this.path},toJSON(){return this.toString()}},SU=e=>{let t=Object.create(qJ);return t.path=e,Object.freeze(t)};var AC="~effect/net/Host",pa=(e,t)=>Z(new gn({input:e,message:t})),HJ=/^[a-z0-9_.-]$/i,WJ=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,VJ=/^(?:\d+|0x[0-9a-f]*)$/,EU=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(!WJ.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(VJ.test(r[r.length-1]))return"the last domain name label must not be numeric"},GJ=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!HJ.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},ys=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&EU(e)===void 0;var OC=e=>A(e,AC),Mg=e=>{let t=GJ(e);if(t===void 0)return pa(e,"invalid domain name");let r=EU(t);return r===void 0?H(t):pa(e,r)};var KJ=e=>{if(e.includes("%"))return vp(e);if(e.includes(":"))return la(e);if(/^[\d.]+$/.test(e)){let t=la(e);if(wt(t))return t}return Mg(e)};var JJ=e=>typeof e=="string"?e:Zt(e);var ZJ={...mt,_tag:"HostPort",[AC]:AC,[X](e){return OC(e)&&this.port===e.port&&W(this.host,e.host)},[Y](){return ie(q(this.host),dt(this.port))},toString(){return _C(this)},toJSON(){return this.toString()}},QJ=e=>Number.isInteger(e)&&e>=0&&e<=65535,YJ=(e,t)=>{let r=Object.create(ZJ);return r.host=e,r.port=t,Object.freeze(r)};var bU=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return pa(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return pa(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return pa(e,"expected host:port");if(e.indexOf(":")!==o)return pa(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return pa(e,"port must be an unpadded decimal integer");let n=Number(r);return QJ(n)?Mt(KJ(t),o=>YJ(o,n)):pa(e,"port must be an integer from 0 through 65535")};var _C=e=>{let t=JJ(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var FC="~effect/net/Dns/DnsRecord",PC=e=>Number.isInteger(e)&&e>=0&&e<=255,Nu=e=>Number.isInteger(e)&&e>=0&&e<=65535,TU=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,da=e=>typeof e=="string",Ug=e=>Ff(e)&&mc(e)&&TU(fo(e)),wU={A:{address:Jt},AAAA:{address:xn},CAA:{critical:e=>typeof e=="boolean",tag:e=>da(e)&&/^[a-z0-9]+$/i.test(e),value:da},CNAME:{target:ys},MX:{exchange:ys,priority:Nu},NAPTR:{order:Nu,preference:Nu,flags:da,service:da,regexp:da,replacement:ys},NS:{host:ys},PTR:{host:e=>da(e)&&e.length>0},SOA:{primary:ys,admin:e=>da(e)&&e.length>0,serial:TU,refresh:Ug,retry:Ug,expire:Ug,minimum:Ug},SRV:{target:ys,port:Nu,priority:Nu,weight:Nu},TLSA:{certUsage:PC,selector:PC,matchingType:PC,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(da)}},RC=Object.keys(wU),XJ=e=>RC.includes(e),$C=e=>A(e,FC),eZ={...mt,[FC]:FC,[X](e){return $C(e)&&e._tag===this._tag&&Object.keys(this).every(t=>W(this[t],e[t]))},[Y](){return hf(this,Object.keys(this))},toString(){return rZ(this)},toJSON(){return{...this}}},kU=(e,t)=>{if(!XJ(e))return Z(new gn({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(eZ);n._tag=e;for(let[o,s]of Object.entries(wU[e])){let a=r[o];if(!s(a))return Z(new gn({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(a)?Object.freeze([...a]):a instanceof Uint8Array?new Uint8Array(a):a}return H(Object.freeze(n))};var AU=new TextEncoder,vU=e=>`\\${e.toString().padStart(3,"0")}`,_p=e=>{let t='"';for(let r of AU.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?vU(r):String.fromCharCode(r);return t+'"'},tZ=[34,36,40,41,59,64],CU=e=>{let t=AU.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+=vU(o):r+=tZ.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},rZ=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Zt(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${_p(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${_p(e.flags)} ${_p(e.service)} ${_p(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${CU(e.host)}`;case"SOA":return`SOA ${e.primary} ${CU(e.admin)} ${e.serial} ${fo(e.refresh)} ${fo(e.retry)} ${fo(e.expire)} ${fo(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Zd(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(_p).join(" ")}`}};var NC="~effect/net/IpInterface",OU=e=>Pp(e)&&Jt(e.address),_U=e=>Pp(e)&&xn(e.address),Pp=e=>A(e,NC),aZ={...mt,_tag:"IpInterface",[NC]:NC,[X](e){return Pp(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.prefixLength))},toString(){return Rp(this)},toJSON(){return this.toString()}},MC=(e,t)=>Z(new gn({input:e,message:t})),Fp=(e,t)=>{let r=Fu(e);if(!Number.isInteger(t)||t<0||t>r)return MC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(aZ),{address:e,prefixLength:t});return H(Object.freeze(n))},UC=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return H({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return MC(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)?H({address:e.slice(0,r),prefixLength:Number(n)}):MC(e,"prefix length must be an unpadded ASCII decimal integer")},Dg=(e,t)=>Pt(UC(e,t),r=>Pt(ki(r.address),n=>Fp(n,r.prefixLength??Fu(n)))),Lg=(e,t)=>Pt(UC(e,t),r=>Pt(Ai(r.address),n=>Fp(n,r.prefixLength??Fu(n)))),Bg=(e,t)=>Pt(UC(e,t),r=>Pt(la(r.address),n=>Fp(n,r.prefixLength??Fu(n))));var Rp=e=>`${Zt(e.address)}/${e.prefixLength}`;var DC="~effect/net/IpNetwork",FU=e=>$p(e)&&Jt(e.address),RU=e=>$p(e)&&xn(e.address),$p=e=>A(e,DC),iZ={...mt,_tag:"IpNetwork",[DC]:DC,[X](e){return $p(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ie(q(this.address),dt(this.prefixLength))},toString(){return Np(this)},toJSON(){return this.toString()}},cZ=e=>{let t=Object.assign(Object.create(iZ),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},uZ=e=>Jt(e)?_g(e):xC(e);var fZ=(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)},LC=(e,t)=>Pt(Fp(e,t),r=>{let n=uZ(e),o=fZ(n,t);return n.some((s,a)=>s!==o[a])?Z(new gn({input:e,message:"address has non-zero host bits"})):H(cZ(r))});var $U=e=>Pt(Dg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength)),NU=e=>Pt(Lg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength)),MU=e=>Pt(Bg(e,{prefix:"required"}),t=>LC(t.address,t.prefixLength));var Np=e=>`${Zt(e.address)}/${e.prefixLength}`;var Mp=yg;function Pr(){return(e,t,r)=>V(new du(e.map(np),n=>t(n.map(o=>V(o))),r))}function Me(e,t){return Pr()([],()=>(r,n,o)=>e(r)?y(r):C(new xt(n,r,o)),t)}function pZ(e){return e}function dZ(e){return t=>t.annotate(e)}function mZ(e){return t=>jC(jC(t).annotate(e))}function hZ(e){return t=>t.rebuild(ip(t.ast,e))}function gZ(e){return e}var Oi=class extends cn("SchemaError"){[_u]=_u;constructor(t){let r=Tn();jt(0);try{super({issue:t})}finally{jt(r)}}get message(){return SR(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[qe](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function ZU(e){return mU(e)}function QU(e){return $e(e)?VC(e):Cr(e,t=>Ks(()=>Vs(t,r=>new Oi(r))))}function VC(e){return ut(e)?e:So(Vs(e.cause,t=>new Oi(t)))}function YU(e,t){let r;for(let n of e.reasons){if(!$m(n)||!ZU(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 XU(e){return ch(e).then(t=>{if(ut(t))return t.value;throw YU(t.cause,"Promise adapter can only reject schema errors")})}function eD(e){let t=ko(e);if(ut(t))return t.value;throw YU(t.cause,"Sync adapter can only throw schema errors")}function xZ(e,t){return W1(e,t)}function yZ(e){return V1(e)}var zg=B0,SZ=o1;function bs(e,t){let r=St(e,t);return(n,o)=>QU(r(n,o))}var EZ=bs;function tD(e,t){let r=s1(e,t);return(n,o)=>VC(r(n,o))}var bZ=tD,IZ=z0,CZ=a1;function rD(e,t){let r=i1(e,t);return(n,o)=>Ld(r(n,o),s=>new Oi(s))}var TZ=rD;function nD(e,t){let r=bs(e,t);return(n,o)=>XU(r(n,o))}var wZ=nD;function oD(e,t){let r=bs(e,t);return(n,o)=>eD(r(n,o))}var kZ=oD;function qg(e,t){let r=Ii(e,t);return(n,o)=>QU(r(n,o))}var AZ=qg;function sD(e,t){let r=u1(e,t);return(n,o)=>VC(r(n,o))}var vZ=sD,OZ=q0,_Z=f1;function aD(e,t){let r=l1(e,t);return(n,o)=>Ld(r(n,o),s=>new Oi(s))}var PZ=aD;function iD(e,t){let r=qg(e,t);return(n,o)=>XU(r(n,o))}var FZ=iD;function cD(e,t){let r=qg(e,t);return(n,o)=>eD(r(n,o))}var RZ=cD,V=jn;function Hg(e){return A(e,Mp)&&e[Mp]===Mp}var Ss=mr(e=>V(di(e.ast),{schema:e})),$Z=mr(e=>e.schema),Is=mr(e=>{let t=Jg(e);return V(xN(e.ast),{schema:t})}),NZ=mr(e=>e.schema.members[0]),MZ=mr(e=>V(FI(e.ast),{schema:e})),UZ=mr(e=>e.schema),Fr=mr(e=>V(It(e.ast),{schema:e})),Bu=mr(e=>V(Mn(e.ast),{schema:e})),Up="~effect/Schema/flip";function DZ(e){return A(e,Up)&&e[Up]===Up}function jC(e){return DZ(e)?e.schema.rebuild(en(e.ast)):V(en(e.ast),{[Up]:Up,schema:e})}function Ct(e){let t=V(new Xr(e),{literal:e,transform(r){return t.pipe(J(Ct(r),{decode:pe(()=>r),encode:pe(()=>e)}))}});return t}function uD(e){return e.map(t=>Hg(t)?t.ast:new Xr(t))}function LZ(e){return V(new EI(uD(e)),{parts:e})}function BZ(e){return V(Z$(uD(e)),{parts:e})}function jZ(e){return V(new J$(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var zZ=V(SI),qZ=V(G$),Dp=V(ds),Wg=V(xI),GC=V(yI),$=V(Yr),HZ=$,Lp=V(bI),Vg=V(X$),fD=V(eN),ju=V(tN),WZ=V(V$),VZ=V(K$);function GZ(e){return V(new Y$(e))}function KC(e,t){return V(e,{fields:t,mapFields(r,n){let o=r(this.fields);return KC(Bh(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function _e(e){return KC(Bh(e,void 0),e)}function KZ(e){return mr(t=>t.mapFields(sU(e)))}var JZ=e=>typeof e=="symbol"?e:globalThis.String(e);function ZZ(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=Bu(t.fields[a]),c=Object.hasOwn(e,a),f=c?e[a]:a,u=JZ(f);if(s.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${Xn(f)}`);s.add(u),U(r,f,i),c&&(n[a]=f,o[f]=a)}return _e(r).pipe(J(t,we({decode:iC(o),encode:iC(n)})))}}function QZ(e,t){return r=>{let n=Bd(r.fields,Fr),o=_e({...n,...e});return r.pipe(J(o,we({decode:s=>{let a={...s};for(let i in e){let c=t[i],f=c(s);ve(f)&&U(a,i,f.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function _i(e,t){return V(SN(e.ast,t.ast),{key:e,value:t})}function YZ(e,t){return V(aN(e.ast,t.map(np)),{schema:e,records:t})}function lD(e,t){return V(e,{elements:t,mapElements(r,n){let o=r(this.elements);return lD(wI(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Mo(e){return lD(wI(e),e)}function XZ(e,t){return V(iN(e.ast,t.map(np)),{schema:e,rest:t})}var Ce=mr(e=>V(new mn(!1,[],[e.ast]),{value:e}));function Gg(e,t,r){return t!==void 0&&r!==void 0?e.check(eT(t,r)):t!==void 0?e.check(vD(t)):r!==void 0?e.check(PD(r)):e}var Kg=mr(e=>V(new mn(!1,[e.ast],[e.ast]),{value:e}));function e5(e){let t=Ce(e),r=Ce(Fr(e)),n=J(Mo([Dp]),we({decode:o=>[o],encode:([o])=>o}))(e);return V(Ze([n,t]).pipe(J(r)).ast,{from:Ze([e,t]),to:r})}function t5(e){return Ce(e).check(rT())}var r5=mr(e=>V(cN(e.ast),{schema:e}));function pD(e,t){return V(e,{members:t,mapMembers(r,n){let o=r(this.members);return pD(jh(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ze(e,t){return pD(jh(e,t,void 0),e)}function Cs(e){let t=e.map(Ct);return V(jh(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return Ze(r(this.members))},pick(r){return Cs(r)},transform(r){return Ze(t.map((n,o)=>n.transform(r[o])))}})}var JC=mr(e=>Ze([e,Wg])),Jg=mr(e=>Ze([e,GC])),dD=mr(e=>Ze([e,Wg,GC]));function mD(e){return V(new AI(()=>e().ast))}function n5(...e){return t=>t.check(...e)}function hD(e,t){return r=>V($o(r.ast,[qh(e,t)]),{schema:r})}function Zg(e){return t=>V(t.ast,{schema:t,identifier:e})}function o5(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(Zg(e))}function gD(e){return t=>V(hN(t.ast,new Ph(e,F)),{schema:t})}function xD(e){return t=>V(gN(t.ast,new Ph(F,e)),{schema:t})}function s5(e){return yD(e)}function yD(e){return t=>gD(Al(e))(t)}function a5(e){return SD(e)}function SD(e){return t=>xD(Al(e))(t)}function J(e,t){return r=>V(xu(r.ast,e.ast,t?Fh(t):au()),{from:r,to:e})}function zu(){return(e,t)=>Te()(e,{decode:t,encode:LR})}var Qg=Cs(["true","yes","on","1","y"]),Yg=Cs(["false","no","off","0","n"]),ZC=Cs([...Qg.literals,...Yg.literals]).pipe(J(Vg,we({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function i5(e){return t=>J(Fr(t),e)(t)}function QC(e,t){return r=>t?J(r,t)(e):J(r)(e)}function c5(e){return t=>J(t,e)(Bu(t))}function ED(e){return t=>V(yN(t.ast,e),{schema:t})}function bD(e){return Cr(e,t=>Ks(()=>Vs(t,r=>r.issue)))}function YC(e,t){let r=t?.encodingStrategy==="omit"?Jb():Po();return n=>Ss(Bu(n)).pipe(J(n,{decode:Zb(bD(e)),encode:r}))}function u5(e,t){return r=>Fr(r).pipe(YC(e,t),QC(Ss(r)))}function ID(e,t){let r=t?.encodingStrategy==="omit"?Jb():Po();return n=>Is(Bu(n)).pipe(J(n,{decode:Zb(bD(e)),encode:r}))}function f5(e,t){return r=>Fr(r).pipe(ID(e,t),QC(Is(r)))}function Es(e){return Ct(e).pipe(ED(y(e)))}function l5(e){return Es(e).pipe(YC(y(e),{encodingStrategy:"omit"}))}function Bp(e,t){return _e({_tag:Es(e),...t})}function CD(e){return t=>{let r={},n=[],o=new Set,s={},a=u=>l=>u.includes(l[e]);return i(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:f});function i(u){let l=u.ast;if(q$(l)&&"members"in u&&globalThis.Array.isArray(u.members)&&u.members.every(Hg))return u.members.forEach(i);let p=fu(l);if(p.length>0){let h=p.find(g=>g.key===e)?.literal;if(xd(h)){let g=typeof h=="number"?globalThis.String(h):h;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(g),n.push(h),U(r,h,u),U(s,h,B0(Fr(u)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(x){let b=x[e];return(Object.hasOwn(g,b)?g[b]:void 0)(x)}}let u=arguments[0],l=arguments[1],p=u[e];return(Object.hasOwn(l,p)?l[p]:void 0)(u)}function f(){if(arguments.length===2){let x=arguments[0],b=arguments[1];return function(T){let w=T[e];return(Object.hasOwn(x,w)?x[w]??b:b)(T)}}let u=arguments[0],l=arguments[1],p=arguments[2],h=u[e];return(Object.hasOwn(l,h)?l[h]??p:p)(u)}}}function p5(e){let t={},r=[];for(let f of Object.keys(e)){let u=Bp(f,e[f]);U(t,f,u),r.push(u)}let n=Ze(r),{tag:o,guards:s,isAnyOf:a,match:i,matchOrElse:c}=CD("_tag")(n);return V(n.ast,{tag:o,cases:t,isAnyOf:a,guards:s,match:i,matchOrElse:c})}function d5(){return e=>e}function ma(e,t){return Me(r=>r instanceof e,t)}function Te(){return(e,t)=>new ft(e.ast,Fh(t))}var ke=zh;function m5(e,t=void 0){return new ui(e,t)}var UU="^\\S[\\s\\S]*\\S$|^\\S$|^$";function TD(e){let t=new globalThis.RegExp(UU);return ke(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:UU,flags:""}]},...e})}function Pi(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${N(r)})`:`new RegExp(${N(r)}, ${N(n)})`;return sp(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function h5(e){return NI({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function g5(e){return MI({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function x5(e){return DI({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var y5=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 S5(e,t){let r=y5(e);return Pi(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 DU=/^([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 E5(e){return Pi(DU,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:DU.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function b5(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Pi(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function wD(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Pi(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function I5(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Pi(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function XC(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 C5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${gs(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return ke(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>XC(o,e,`^${gs(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function T5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${gs(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return ke(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>XC(o,e,`${gs(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function w5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(gs(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return ke(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>XC(o,e,gs(o)),toCode:()=>({runtime:`Schema.isIncluding(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var LU="^[^a-z]*$";function k5(e){let t=new globalThis.RegExp(LU);return ke(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:LU,flags:""}]},...e})}var BU="^[^A-Z]*$";function A5(e){let t=new globalThis.RegExp(BU);return ke(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:BU,flags:""}]},...e})}var jU="^(?:[^a-z][\\s\\S]*)?$";function v5(e){let t=new globalThis.RegExp(jU);return ke(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:jU,flags:""}]},...e})}var zU="^(?:[^A-Z][\\s\\S]*)?$";function O5(e){let t=new globalThis.RegExp(zU);return ke(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:zU,flags:""}]},...e})}var qu=V(OI),_5=vI;function jp(e){let t=oc(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function zp(e){let t=Fd(e.order),r=e.formatter??N;return(n,o)=>ke(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 qp(e){let t=_d(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function Hp(e){let t=Pd(e.order),r=e.formatter??N;return(n,o)=>ke(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 Wp(e){let t=Fd(e.order),r=oc(e.order),n=Pd(e.order),o=_d(e.order),s=e.formatter??N;return(a,i)=>{let c=a.exclusiveMinimum?r:t,f=a.exclusiveMaximum?o:n;return ke(u=>c(u,a.minimum)&&f(u,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 P5(e){return(t,r)=>{let n=e.formatter??N;return ke(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function Uu(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${N(e)}`);return e}var F5=jp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Uu(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${N(e)})`})})}),kD=zp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Uu(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${N(e)})`})})}),R5=qp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Uu(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${N(e)})`})})}),$5=Hp({order:Vo,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Uu(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${N(e)})`})})}),ha=Wp({order:Vo,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Uu(e.minimum),maximum:Uu(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function N5(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),ke(r=>R_(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(${N(e)})`}),...t})}function Xg(e){return ke(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 Rr=Lp.check(Xg()),vi=Rr.check(kD(0));function M5(e){return new ui([Xg(),ha({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function U5(e){return new ui([Xg(),ha({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Du(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${N(e)}`);return e.toISOString()}function Lu(e){return`new Date(${N(e.getTime())})`}var D5=jp({order:nc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${Lu(e)})`})})}),L5=zp({order:nc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Lu(e)})`})})}),B5=qp({order:nc,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${Lu(e)})`})})}),j5=Hp({order:nc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Du(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Lu(e)})`})})}),z5=Wp({order:nc,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Du(e.minimum),maximum:Du(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Lu(e.minimum)}, maximum: ${Lu(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}}),q5=jp({order:rc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${N(e)})`})})}),AD=zp({order:rc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${N(e)})`})})}),H5=qp({order:rc,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${N(e)})`})})}),W5=Hp({order:rc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${N(e)})`})})}),V5=Wp({order:rc,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: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function vD(e,t){return e=hr(e),OD(e,Math.ceil(e/2),t)}function OD(e,t,r){return ke(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})`}),[Ar]:!0,arbitraryConstraint:{minLength:e},...r})}function _D(e){return OD(1,1,e)}function PD(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxLength:e},...t})}function eT(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function G5(e,t){return e=hr(e),ke(r=>tT(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 K5(e,t){return e=hr(e),ke(r=>tT(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 J5(e,t,r){return e=hr(e),t=hr(t),ke(n=>{let o=tT(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 tT(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function hr(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Z5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minSize:e},...t})}function Q5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxSize:e},...t})}function Y5(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function X5(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minProperties:e},...t})}function e8(e,t){return e=hr(e),ke(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})`}),[Ar]:!0,arbitraryConstraint:{maxProperties:e},...t})}function t8(e,t,r){return e=hr(e),t=hr(t),ke(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})`}),[Ar]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function r8(e,t){let r=Bu(e),n=n1(r.ast);return ke((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let f of i){let u=n(f,a);if(u!==void 0&&(c.push(new At([f],u)),a.errors==="first"))break}return Ma(c)?new vt(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})`}),[Ar]:!0,...t})}function rT(e){return ke(t=>Wd(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:F},...e})}function FD(e){return ke(t=>Wd(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 nT=$.check(_D()),n8=$.check(eT(1,1)),RD=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),$D=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},qU=[];function o8(e){let t=RD(e),r=qU[t];if(r!==void 0)return r;let n=$D(t),o=ma(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${N(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Te()(PY,b$(n))});return qU[t]=o,o}var HU=[];function oT(e){let t=RD(e),r=HU[t];if(r!==void 0)return r;let n=sx.pipe(J(Dp,I$($D(t))));return HU[t]=n,n}function s8(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(Mo([n,o]));return(a,i,c)=>a instanceof globalThis.Map?Vt(St(s)([...a],c),{onSuccess:f=>new globalThis.Map(f),onFailure:f=>Or(i,"entries",f,a,c)}):C(new xt(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])=>Te()(Ce(Mo([n,o])),we({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return V(r.ast,{key:e,value:t})}function a8(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>o instanceof globalThis.Set?Vt(St(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>Te()(Ce(r),we({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return V(t.ast,{value:e})}var i8=ma(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Te()(_e({source:$,flags:$}),Nt({decode:(e,t)=>ht({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ue({expected:"valid RegExp source and flags"},e,t)}),encode:e=>y({source:e.source,flags:e.flags})}))}),ND=$.annotate({expected:"a string that will be decoded as a URL"}),MD=ma(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Te()(ND,sI)}),c8=ND.pipe(J(MD,sI)),UD=$.annotate({expected:"a string that will be decoded as a Date"}),Hu=Me(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:()=>Te()(UD,nI)}),u8=UD.pipe(J(Hu,nI)),f8=Rr.pipe(J(Hu,h$)),l8=$.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function sT(e,t){return l8.pipe(J(e,F$(t)))}var p8=sT(Dp),DD=ma(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Te()(_e({data:$.check(wD()),type:$,name:$,lastModified:Rr}),Nt({decode:(e,t)=>Sr(ii(e.data),{onFailure:()=>C(new ue({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return y(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Uc({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ou(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ue({expected:"a readable File"},e,t)})}))}),LD=ma(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Te()(Ce(Mo([$,Ze([_e({_tag:Es("String"),value:$}),_e({_tag:Es("File"),value:DD})])])),Nt({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return y(t)},encode:e=>y(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function d8(e){return LD.pipe(J(e,R$))}var BD=ma(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Te()($.annotate({expected:"a query string that will be decoded as URLSearchParams"}),we({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function m8(e){return BD.pipe(J(e,$$))}var h8=$.annotate({expected:"a string that will be decoded as a number"}).pipe(J(Lp,iu)),g8=$.annotate({expected:"a string that will be decoded as a finite number"}).pipe(J(qu,iu)),x8=V(UI).pipe(J(ju,$h)),jD=$.check(TD()),y8=$.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(J(jD,m$())),S8=$.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(J($,v$)),E8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(J($,O$)),b8=$.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(J($,_$)),I8=$.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(J($,P$)),zC=Ze([qu,fD,$]),C8=_e({issues:Ce(_e({message:$,path:Is(Ce(Ze([zC,_e({key:zC})])))}))}),T8=Cs([0,1]).pipe(J(Vg,we({decode:e=>e===1,encode:e=>e?1:0}))),zD=$.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),ex=ma(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Te()(zD,aI)}),w8=zD.pipe(J(ex,aI)),k8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(J(ex,{decode:GR(),encode:Oh()})),qD=$.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(J(ex,{decode:JR(),encode:_h()})),HD=Nt({decode:(e,t)=>{let r=p$(e);return Ke(r)?C(new ue({expected:"a valid BigDecimal string"},e,t)):y(r.value)},encode:e=>y(ps(e))}),A8=jp({order:su,formatter:e=>ps(e)}),v8=zp({order:su,formatter:e=>ps(e)}),O8=qp({order:su,formatter:e=>ps(e)}),_8=Hp({order:su,formatter:e=>ps(e)}),P8=Wp({order:su,formatter:e=>ps(e)}),WD=$.annotate({expected:"a string that will be decoded as a BigDecimal"}),VD=Me(tI,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Te()(WD,HD),toFormatter:()=>e=>ps(e)}),F8=WD.pipe(J(VD,HD)),tx=Me(GP,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Te()(ju.check(AD(globalThis.BigInt(0))),we({decode:_l,encode:lh})),toCodecStringTree:()=>Te()(GD,oI)}),GD=$.annotate({expected:"a string that will be decoded as a ByteSize"}),R8=GD.pipe(J(tx,oI)),$8=ju.pipe(J(tx,g$)),N8=Lp.pipe(J(tx,x$));function qC(e,t){let r=Pr()([e,t],([n,o])=>(s,a,i)=>{if(!ZO(s))return C(new xt(a,s,i));switch(s._tag){case"Fail":return Vt(St(n)(s.error,i),{onSuccess:lE,onFailure:c=>Or(a,"error",c,s,i)});case"Die":return Vt(St(o)(s.defect,i),{onSuccess:pE,onFailure:c=>Or(a,"defect",c,s,i)});case"Interrupt":return y(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])=>Te()(Ze([_e({_tag:Ct("Fail"),error:n}),_e({_tag:Ct("Die"),defect:o}),_e({_tag:Ct("Interrupt"),fiberId:Jg(qu)})]),we({decode:s=>{switch(s._tag){case"Fail":return lE(s.error);case"Die":return pE(s.defect);case"Interrupt":return YO(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 V(r.ast,{error:e,defect:t})}function HC(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(qC(n,o));return(a,i,c)=>JO(a)?Vt(St(s)(a.reasons,c),{onSuccess:rl,onFailure:f=>Or(i,"failures",f,a,c)}):C(new xt(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])=>Te()(Ce(qC(n,o)),we({decode:rl,encode:({reasons:s})=>s}))});return V(r.ast,{error:e,defect:t})}function WU(e){return Te()(e,we({decode:db,encode:nr}))}function M8(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>dh(o)?Vt(St(n)(nr(o),a),{onSuccess:db,onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>WU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>WU(Gg(Ce(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>lb(r)});return V(t.ast,{value:e})}function KD(){return ir((e,t)=>Re(zb(e),{onNone:()=>C(new ue({message:"Invalid DateTime input"},e,t)),onSome:r=>y(qb(r))}))}var U8=we({decode:e=>Wb(e),encode:e=>e.offset}),JD=Nt({decode:(e,t)=>Re(_R(e),{onNone:()=>C(new ue({expected:"a valid IANA time zone"},e,t)),onSome:y}),encode:e=>y(e.id)}),ZD=Nt({decode:(e,t)=>Re(PR(e),{onNone:()=>C(new ue({expected:"a valid time zone"},e,t)),onSome:y}),encode:e=>y(Ql(e))}),QD=Nt({decode:(e,t)=>Re(zb(e),{onNone:()=>C(new ue({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>y(qb(r))}),encode:e=>y($R(e))}),YD=Nt({decode:(e,t)=>Re(OR(e),{onNone:()=>C(new ue({expected:"a valid Zoned DateTime string"},e,t)),onSome:y}),encode:e=>y(Vb(e))}),XD=-864e13,e2=864e13,D8=XD+840*60*1e3,L8=e2-840*60*1e3,B8=-720*60*1e3,j8=840*60*1e3,t2=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function r2(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 aT(e,t){return Rr.check(ha({minimum:e,maximum:t}))}function n2(){return Ze([aT(B8,j8),Cs(t2)])}var rx=Me(e=>jb(e)&&TR(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]=r2(e,XD,e2);return zu()(aT(t,r),pe(AR))},toCodecJson:()=>Te()($,QD),toFormatter:()=>e=>e.toString()}),z8=Hu.pipe(J(rx,{decode:KD(),encode:pe(FR)})),q8=$.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(J(rx,QD)),H8=Rr.pipe(J(rx,{decode:KD(),encode:pe(RR)})),W8=Me(IR,{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:()=>Te()(Rr,U8),toFormatter:()=>e=>Ql(e)}),o2=$.annotate({expected:"an IANA time zone identifier"}),s2=Me(CR,{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:()=>zu()(Cs(t2),pe(Hb)),toCodecJson:()=>Te()(o2,JD),toFormatter:()=>e=>Ql(e)}),V8=o2.pipe(J(s2,JD)),a2=$.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),i2=Me(bR,{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:()=>zu()(n2(),pe(e=>typeof e=="number"?Wb(e):Hb(e))),toCodecJson:()=>Te()(a2,ZD),toFormatter:()=>e=>Ql(e)}),G8=a2.pipe(J(i2,ZD)),c2=$.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),u2=Me(e=>jb(e)&&wR(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]=r2(e,D8,L8);return zu()(_e({epochMilliseconds:aT(t,r),timeZone:n2()}),pe(({epochMilliseconds:n,timeZone:o})=>vR(n,{timeZone:o})))},toCodecJson:()=>Te()(c2,YD),toFormatter:()=>e=>Vb(e),toEquivalence:()=>kR}),K8=c2.pipe(J(u2,YD)),$r=(e,t,r,n)=>$.pipe(J(e,Nt({decode:(o,s)=>{let a=t(o);return wt(a)?y(a.success):C(new ue({message:a.failure.message},o,s))},encode:o=>y(r(o))}))).annotate({identifier:n}),Fi=Me(Ru,{identifier:"MacAddress"}),Wu=$r(Fi,xU,yC,"MacAddressFromString"),Vp=Me(Jt,{identifier:"Ipv4Address"}),iT=$r(Vp,ki,Zt,"Ipv4AddressFromString"),nx=Me(xn,{identifier:"Ipv6Address"}),f2=$r(nx,Ai,Zt,"Ipv6AddressFromString"),ga=Me(mC,{identifier:"IpAddress"}),Ri=$r(ga,la,Zt,"IpAddressFromString"),tt=(e,t,r,n)=>hD(t,{expected:r})(e).annotate({identifier:n}),J8=tt(ga,$u,"a multicast address","IpMulticastAddress"),Z8=tt(Ri,$u,"a multicast address","IpMulticastAddressFromString"),Q8=tt(Fi,$u,"a multicast address","MacMulticastAddress"),Y8=tt(Wu,$u,"a multicast address","MacMulticastAddressFromString"),X8=tt(ga,IC,"a unicast address","IpUnicastAddress"),eQ=tt(Ri,IC,"a unicast address","IpUnicastAddressFromString"),tQ=tt(Fi,Fg,"a unicast address","MacUnicastAddress"),rQ=tt(Wu,Fg,"a unicast address","MacUnicastAddressFromString"),nQ=tt(Vp,$g,"a broadcast address","Ipv4BroadcastAddress"),oQ=tt(iT,$g,"a broadcast address","Ipv4BroadcastAddressFromString"),sQ=tt(Fi,Pg,"a broadcast address","MacBroadcastAddress"),aQ=tt(Wu,Pg,"a broadcast address","MacBroadcastAddressFromString"),iQ=tt(ga,bC,"a loopback address","IpLoopbackAddress"),cQ=tt(Ri,bC,"a loopback address","IpLoopbackAddressFromString"),uQ=tt(ga,CC,"a link-local address","IpLinkLocalAddress"),fQ=tt(Ri,CC,"a link-local address","IpLinkLocalAddressFromString"),lQ=tt(ga,Rg,"an unspecified address","IpUnspecifiedAddress"),pQ=tt(Ri,Rg,"an unspecified address","IpUnspecifiedAddressFromString"),dQ=tt(Vp,TC,"a private address","Ipv4PrivateAddress"),mQ=tt(iT,TC,"a private address","Ipv4PrivateAddressFromString"),hQ=tt(nx,wC,"a unique-local address","Ipv6UniqueLocalAddress"),gQ=tt(f2,wC,"a unique-local address","Ipv6UniqueLocalAddressFromString"),xQ=tt(Fi,SC,"a locally administered address","MacLocallyAdministeredAddress"),yQ=tt(Wu,SC,"a locally administered address","MacLocallyAdministeredAddressFromString"),SQ=tt(Fi,EC,"a universally administered address","MacUniversallyAdministeredAddress"),EQ=tt(Wu,EC,"a universally administered address","MacUniversallyAdministeredAddressFromString"),l2=Me(OU,{identifier:"Ipv4Interface"}),bQ=$r(l2,Dg,Rp,"Ipv4InterfaceFromString"),p2=Me(_U,{identifier:"Ipv6Interface"}),IQ=$r(p2,Lg,Rp,"Ipv6InterfaceFromString"),d2=Me(Pp,{identifier:"IpInterface"}),CQ=$r(d2,Bg,Rp,"IpInterfaceFromString"),m2=Me(FU,{identifier:"Ipv4Network"}),TQ=$r(m2,$U,Np,"Ipv4NetworkFromString"),h2=Me(RU,{identifier:"Ipv6Network"}),wQ=$r(h2,NU,Np,"Ipv6NetworkFromString"),g2=Me($p,{identifier:"IpNetwork"}),kQ=$r(g2,MU,Np,"IpNetworkFromString"),AQ=Me(kp,{identifier:"InetAddressV4"}),vQ=Me(Ap,{identifier:"InetAddressV6"}),x2=Me(hC,{identifier:"InetAddress"}),OQ=$r(x2,kC,Ng,"InetAddressFromString"),y2=Me(Og,{identifier:"UnixPathAddress"}),_Q=$.pipe(J(y2,we({decode:SU,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),PQ=Me(hU,{identifier:"SocketAddress"}),Ts=$.check(ke(ys,{expected:"a normalized domain name"})).pipe(Zg("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),S2=$r(Ts,Mg,e=>e,"DomainNameFromString"),cT=$.check(ke(gC,{expected:"a canonical scoped IPv6 literal"})).pipe(Zg("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),E2=$r(cT,vp,e=>e,"ScopedIpv6LiteralFromString"),FQ=Ze([ga,cT,Ts]).annotate({identifier:"Host"}),RQ=Ze([Ri,E2,S2]).annotate({identifier:"HostFromString"}),b2=Me(OC,{identifier:"HostPort"}),$Q=$r(b2,bU,_C,"HostPortFromString"),NQ=Rr.check(ha({minimum:0,maximum:65535},{expected:"a port number"})),MQ=Nt({decode:(e,t)=>Re(qk(e),{onNone:()=>C(new ue({expected:"a valid Duration string"},e,t)),onSome:y}),encode:e=>y(globalThis.String(e))}),UQ=Nt({decode:e=>y(uo(e)),encode:(e,t)=>Re(Hk(e),{onNone:()=>C(new ue({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>y(r)})}),DQ=we({decode:e=>dc(e),encode:e=>Ko(e)}),Gp=Me(Ff,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Te()(Ze([_e({_tag:Ct("Infinity")}),_e({_tag:Ct("NegativeInfinity")}),_e({_tag:Ct("Nanos"),value:ju}),_e({_tag:Ct("Millis"),value:Rr})]),we({decode:e=>{switch(e._tag){case"Infinity":return La;case"NegativeInfinity":return pc;case"Nanos":return uo(e.value);case"Millis":return dc(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}}}}))}),LQ=$.annotate({expected:"a string that will be decoded as a Duration"}),BQ=LQ.pipe(J(Gp,MQ)),jQ=ju.pipe(J(Gp,UQ)),zQ=Lp.pipe(J(Gp,DQ)),qQ=Cs(RC),I2=(e,t)=>$.pipe(J(e,Nt({decode:(r,n)=>{let o=t(r);return Se(o)?C(new ue({message:o.failure.message},r,n)):Zt(o.success)===r?y(o.success):C(new ue({message:"expected a canonical address"},r,n))},encode:r=>y(Zt(r))}))),BC=Rr.check(ha({minimum:0,maximum:255})),Mu=Rr.check(ha({minimum:0,maximum:65535})),C2=Rr.check(ha({minimum:0,maximum:4294967295})),jg=C2.pipe(J(Gp,we({decode:Rf,encode:fo}))),yn=(e,t)=>Me(r=>$C(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=Bp(e,t);return Te()(r,Nt({decode:(n,o)=>{let{_tag:s,...a}=n,i=kU(e,a);return wt(i)?y(i.success):C(new ue({message:i.failure.message},n,o))},encode:n=>y({...n})}))}}),T2=yn("A",{address:I2(Vp,ki)}),w2=yn("AAAA",{address:I2(nx,Ai)}),k2=yn("CAA",{critical:Vg,tag:$.check(Pi(/^[a-z0-9]+$/i)),value:$}),A2=yn("CNAME",{target:Ts}),v2=yn("MX",{exchange:Ts,priority:Mu}),O2=yn("NAPTR",{order:Mu,preference:Mu,flags:$,service:$,regexp:$,replacement:Ts}),_2=yn("NS",{host:Ts}),P2=yn("PTR",{host:nT}),F2=yn("SOA",{primary:Ts,admin:nT,serial:C2,refresh:jg,retry:jg,expire:jg,minimum:jg}),R2=yn("SRV",{target:Ts,port:Mu,priority:Mu,weight:Mu}),$2=yn("TLSA",{certUsage:BC,selector:BC,matchingType:BC,data:qD}),N2=yn("TXT",{chunks:Kg($)}),HQ=Ze([T2,w2,k2,A2,v2,O2,_2,P2,F2,R2,$2,N2]).annotate({identifier:"DnsRecord"});function WQ(e,t,r){let n=Pr()([e,t,r],([o,s,a])=>{let i=HC(s,a);return(c,f,u)=>{if(!t_(c))return C(new xt(f,c,u));switch(c._tag){case"Success":return Vt(St(o)(c.value,u),{onSuccess:ts,onFailure:l=>Or(f,"value",l,c,u)});case"Failure":return Vt(St(i)(c.cause,u),{onSuccess:So,onFailure:l=>Or(f,"cause",l,c,u)})}}},{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])=>Te()(Ze([_e({_tag:Ct("Success"),value:o}),_e({_tag:Ct("Failure"),cause:HC(s,a)})]),we({decode:i=>i._tag==="Success"?ts(i.value):So(i.cause),encode:i=>ut(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}}))});return V(n.ast,{value:e,error:t,defect:r})}function VU(e,t,r){return _e({type:Ct(e),nodes:Ce(_e({index:vi,data:t})),edges:Ce(_e({index:vi,source:vi,target:vi,data:r}))})}function GU(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 C(new At(["nodes",o,"index"],new ue({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 C(new At(["edges",o,"index"],new ue({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return C(new At(["edges",o,"source"],new ue({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return C(new At(["edges",o,"target"],new ue({expected:"an encoded node index"},s.target,t)))}return y(ig(e))}function VQ(e,t,r){return!N0(e)||e.mutable||e.type!==t?C(new ue({expected:`an immutable ${t} Graph`},e,r)):y(gp(e))}function GQ(e,t){return(r,n)=>{let o=gp(r),s=gp(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],f=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||!f||!t(i.data,c.data))return!1}return!0}}function KQ(e,t,r){return zu()(Ze([Wg,_e({nodes:Kg(t),edges:Ce(Mo([vi,vi,r]))})]),pe(n=>{if(n===null)return ig({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return ig({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 JQ(e,t,r){let n=Pr()([t,r],([o,s])=>{let a=VU(e,o,s);return(i,c,f)=>!N0(i)||i.mutable||i.type!==e?C(new xt(c,i,f)):B(St(a)(gp(i),f),u=>GU(u,f))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${N(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${N(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Te()(VU(e,o,s),Nt({decode:GU,encode:(a,i)=>VQ(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>KQ(e,o,s),toEquivalence:([o,s])=>GQ(o,s)});return V(n.ast,{type:e,node:t,edge:r})}function KU(e){return Te()(e,we({decode:g0,encode:mp}))}function ZQ(e,t){let r=Pr()([e,t],([n,o])=>{let s=Ce(Mo([n,o]));return(a,i,c)=>wM(a)?Vt(St(s)(mp(a),c),{onSuccess:g0,onFailure:f=>Or(i,"entries",f,a,c)}):C(new xt(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])=>KU(Ce(Mo([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>KU(Gg(Ce(Mo([o,s])).check(FD()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>bd(n,o)});return V(r.ast,{key:e,value:t})}function JU(e){return Te()(e,we({decode:S0,encode:nr}))}function QQ(e){let t=Pr()([e],([r])=>{let n=Ce(r);return(o,s,a)=>_M(o)?Vt(St(n)(nr(o),a),{onSuccess:S0,onFailure:i=>Or(s,"values",i,o,a)}):C(new xt(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])=>JU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>JU(Gg(Ce(n).check(rT()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>xf(r)});return V(t.ast,{value:e})}function $i(e){let t=Pr()([e],([r])=>(n,o,s)=>$d(n)?Ke(n)?Sl:Vt(St(r)(n.value,s),{onSuccess:R,onFailure:a=>Or(o,"value",a,n,s)}):C(new xt(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])=>Te()(Ze([_e({_tag:Ct("Some"),value:r}),_e({_tag:Ct("None")})]),we({decode:n=>n._tag==="None"?v():R(n.value),encode:n=>ve(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return V(t.ast,{value:e})}function YQ(e){return JC(e).pipe(J($i(Fr(e)),C$()))}function XQ(e){return Jg(e).pipe(J($i(Fr(e)),T$()))}function eY(e,t){return dD(e).pipe(J($i(Fr(e)),w$(t)))}var M2=Me($M,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),U2=Me(RM,{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:()=>Te()(Ce($),we({decode:NM,encode:BM})),toCodecIso:()=>Te()(_i($,M2),we({decode:w0,encode:e=>e.cookies}))}),tY=U2.pipe(J(_i($,$),we({decode:LM,encode:e=>k0(globalThis.Object.entries(e).map(([t,r])=>DM(t,r)))}))),rY=Me(HM,{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:()=>_0,toCodec:()=>Te()(_i($,$),we({decode:WM,encode:e=>({...e})}))}),uT=Me(F0,{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:()=>R0,toCodec:()=>Te()(Ce(Mo([$,$])),we({decode:ag,encode:e=>e.params}))}),nY=(e,t)=>uT.pipe(J(sT(Dp,t),Nt({decode:r=>Re(KM(r,e),{onNone:()=>C(new At([e],new na(void 0))),onSome:y}),encode:r=>y(ag([[e,r]]))}))),oY=uT.pipe(J(_i($,Ze([$,Kg($)])),we({decode:JM,encode:VM})));function sY(e){return Ss(e).pipe(J($i(Fr(e)),k$()))}function aY(e){return Is(e).pipe(J($i(Fr(e)),A$()))}function iY(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return Is(JC(e)).pipe(J($i(Fr(e)),Rh({decode:o=>o.pipe(ic(yd),R),encode:r==="omit"?ac:o=>R(bt(ac(o),()=>n))})))}function D2(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?St(Ct(r)):void 0,a=Pr()([e],([i])=>(c,f,u)=>{if(A0(c)){let l=s!==void 0?kl(s(c.label,u),p=>new At(["label"],p)):xe;return $t(l,()=>Vt(St(i)(ca(c),u),{onSuccess:p=>Bn(p,{label:c.label}),onFailure:()=>new vt(f,[new At(["value"],new ue(void 0,c,u))],c,u)}))}return C(new xt(f,c,u))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${N(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Te()(i,{decode:pe(c=>Bn(c,{label:r})),encode:n?kh(c=>"Cannot serialize Redacted"+(ve(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):pe(ca)}),toEquivalence:([i])=>qM(i)});return V(a.ast,{value:e})}function cY(e,t){return J(D2(Fr(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:pe(r=>Bn(r,{label:t?.label})),encode:t?.disallowEncode?kh(r=>"Cannot encode Redacted"+(ve(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):pe(ca)})(e)}function uY(e,t){let r=Pr()([e,t],([n,o])=>(s,a,i)=>{if(!Ak(s))return C(new xt(a,s,i));switch(s._tag){case"Success":return Vt(j0(n)(s.success,i),{onSuccess:H,onFailure:c=>Or(a,"success",c,s,i)});case"Failure":return Vt(j0(o)(s.failure,i),{onSuccess:Z,onFailure:c=>Or(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])=>Te()(Ze([_e({_tag:Ct("Success"),success:n}),_e({_tag:Ct("Failure"),failure:o})]),we({decode:s=>s._tag==="Success"?H(s.success):Z(s.failure),encode:s=>wt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return V(r.ast,{success:e,failure:t})}var fY=globalThis.Symbol.for("immer-draftable"),WC={};function fT(e,t,r,n,o){let s=pY(r,t,n),a=L2(t),i=class extends e{constructor(...[c,f]){let l=f?.["~payload"],p=l?.token===WC?l.value:r.make(c??{},f);super(p,{...f,disableChecks:!0,"~payload":{token:WC,value:p}})}static[Mp]=Mp;get[a](){return a}static[fY]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return re(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,f){return mg(s(this))(c??{},f)}static makeOption(c,f){return dg(s(this))(c??{},f)}static makeEffect(c,f){return s(this).makeEffect(c??{},f)}static annotate(c){return this.rebuild(Nn(this.ast,c))}static annotateKey(c){return this.rebuild(ip(this.ast,c))}static check(...c){return this.rebuild($o(this.ast,c))}static extend(c){return(f,u)=>{let l=Kp(f)?f:_e(f),p={...r.fields,...l.fields},h=Bh(p,r.ast.checks,{identifier:c});return fT(this,c,KC($o(h,l.ast.checks),p),u,o)}}static mapFields(c,f){return r.mapFields(c,f)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function lY(e){return new Ne(pe(t=>new e(t,{"~payload":{token:WC,value:t}})),Po())}function L2(e){return`~effect/Schema/Class/${e}`}function pY(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=L2(t),a=f=>f instanceof o||A(f,s),i=lY(o),c=V(new du([e.ast],()=>(f,u,l)=>a(f)?y(f):C(new xt(u,f,l)),{identifier:t,[Ch]:([f])=>({isConstructed:a,link:new ft(f,i)}),toCodec:([f])=>new ft(f.ast,i),toEquivalence:([f])=>f,toFormatter:([f])=>u=>`${o.identifier}(${f(u)})`,[zl]:fu(e.ast),...r}));return n=J(c,i)(e)}}function Kp(e){return Hg(e)}var B2=e=>(t,r)=>{let n=Kp(t)?t:_e(t);return fT(Jd,e,n,r,o=>({toString(){return`${o}(${N({...this})})`}}))},dY=e=>(t,r,n)=>{let o=Kp(r)?r.mapFields(s=>({_tag:Es(t),...s}),{unsafePreserveChecks:!0}):Bp(t,r);return B2(e??t)(o,n)},ox=e=>(t,r)=>{let n=Kp(t)?t:_e(t);return fT(kf,e,n,r,s=>({name:s}))},Vn=e=>(t,r,n)=>{let o=Kp(r)?r.mapFields(s=>({_tag:Es(t),...s}),{unsafePreserveChecks:!0}):Bp(t,r);return ox(e??t)(o,n)};function mY(e){return t=>t.annotate({toFormatter:e})}function hY(e,t){return oU(e.ast,t)}function gY(e){return t=>t.annotate({toEquivalence:e})}function xY(e){return oC(e.ast)}function yY(e,t){return Cp(e.ast,t)}function SY(e,t){let r=Cp(ku(e.ast),t);return Tg(r,t)}var EY=Sg,bY=Eg,lT=bg,IY=R1;function CY(e,t){return X1(e,t)}function TY(e){return lU(e)}function wY(e){return pU(e)}function kY(e){return dU(e)}function AY(e,t){return r=>V(Nn(r.ast,{toCodecIso:()=>new ft(e.ast,Fh(t))}),{schema:r})}function vY(e){return Y1(e)}function OY(e){let t=mD(()=>r),r=Ze([e,Ce(t),_i($,t)]);return r}var sx=V(Nn(lu,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),_Y=_i($,sx),PY=_e({message:$,name:Ss($),stack:Ss($),cause:Ss(sx)}),FY=V(Nn(_N,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function RY(e){return ls(e.ast)}function $Y(e){return e.ast.context?.annotations}var j2="~effect/Terminal",pT="~effect/Terminal/QuitError",Vu=class extends ox("QuitError")({_tag:Es("QuitError")}){[pT]=pT},z2=e=>A(e,pT),Gn=Ye("effect/Terminal"),q2=e=>Gn.of({...e,[j2]:j2});import*as ix from"node:readline";var H2=L(function*(e=V2){let t=process.stdin,r=process.stdout,n=yield*Zc(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||is(n)};t.once("end",a),yield*ah(()=>le(()=>t.off("end",a)));let i=yield*ZF({acquire:ln(le(()=>{let h=ix.createInterface({input:t,escapeCodeTimeout:50}),g=b=>oi(n,b),x=()=>{s=!1,is(n)};return s=!0,ix.emitKeypressEvents(t,h),h.on("line",g),h.once("close",x),t.isTTY&&t.setRawMode(!0),{rl:h,onClose:x,onLine:g}}),({rl:h,onClose:g,onLine:x})=>le(()=>{s=!1,h.off("line",x),h.off("close",g),t.isTTY&&t.setRawMode(!1),h.close(),o&&is(n)})),idleTimeToLive:"10 millis"}),c=le(()=>r.columns??0),f=le(()=>r.rows??0),u=Dt(function*(){let h=yield*Zc(),g=(T,w)=>{let P={input:Ns(T),key:{name:w.name??"",ctrl:!!w.ctrl,meta:!!w.meta,shift:!!w.shift}};oi(h,P),e(P)&&is(h)},x=setInterval(()=>{},2147483647),b=()=>{clearInterval(x),is(h)};return yield*ah(()=>le(()=>{clearInterval(x),t.off("keypress",g),t.off("end",b)})),t.on("keypress",g),o?b():(yield*kb(i),t.once("end",b)),h}),l=Ie(()=>yF(n).pipe(B(Re({onNone:()=>Qs(rs(kb(i),cs(n))),onSome:y})),kt(()=>new Vu({}))));return q2({columns:c,rows:f,readInput:u,readLine:l,display:h=>wl(sr(g=>{r.write(h,x=>vw(x)?g(xe):g(C(pn({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:x}))))}))})}),W2=_c(Gn,H2(V2));function V2(e){let t=e.key;return t.name==="escape"||t.ctrl&&(t.name==="c"||t.name==="d")}var G2=W2;var K2=x_(HN,qm(fM,tM,pM,hM,G2));function DY(e){return{_tag:"Value",value:e}}function LY(e,t){return{_tag:"Record",keys:e,value:t}}function BY(e,t){return{_tag:"Array",length:e,value:t}}var J2=ge("effect/ConfigProvider",{defaultValue:()=>GY()}),jY={...er,toJSON(){return{_id:"ConfigProvider"}}},zY=e=>e;function qY(e,t){let r=Object.create(jY);return r.load=e,r.mapInput=t,r}function Z2(e,t){return qY(r=>e(t(r)),r=>Z2(e,n=>r(t(n))))}function HY(e){return Z2(e,zY)}function WY(e,t){return e===""&&!t?void 0:e}function VY(e,t){let r=t?.preserveEmptyStrings===!0,n=KY(e);return HY(o=>y(JY(n,e,o,r)))}function GY(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return VY(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function KY(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 JY(e,t,r,n){let o=r.map(String).join("_"),s=WY(Object.hasOwn(t,o)?t[o]:void 0,n),a=ZY(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:DY(s);if(i.every(uc)){let f=Math.max(...i.map(u=>parseInt(u,10)))+1;return BY(f,s)}return LY(new Set(i),s)}function ZY(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 Y2="~effect/Config";var QY={...ao({label:"Config",evaluate(e){return this.parse(e.getRef(J2))}}),[Y2]:Y2,toJSON(){return{_id:"Config"}}};function X2(e){let t=Object.create(QY);return t.evaluator=e,t.parse=r=>$t(e(r,[]),bl),t}var eL=(e,t,r)=>e.evaluator(t,r),YY=d(2,(e,t)=>X2((r,n)=>ne(eL(e,r,n),Mt(t))));var XY=d(2,(e,t)=>X2((r,n)=>ti(eL(e,r,n),o=>Se(o)?H(t):o))),tL=e=>e.pipe(YY(R),XY(v()));var ws={};En(ws,{Console:()=>nL,assert:()=>e9,clear:()=>t9,consoleWith:()=>Lt,count:()=>r9,countReset:()=>n9,debug:()=>o9,dir:()=>s9,dirxml:()=>a9,error:()=>cx,group:()=>i9,info:()=>c9,log:()=>Qt,table:()=>u9,time:()=>f9,timeLog:()=>l9,trace:()=>p9,warn:()=>d9,withGroup:()=>m9,withTime:()=>h9});var nL=cE,Lt=e=>ce(t=>e(t.getRef(nL))),e9=(e,...t)=>Lt(r=>G(()=>{r.assert(e,...t)})),t9=Lt(e=>G(()=>{e.clear()})),r9=e=>Lt(t=>G(()=>{t.count(e)})),n9=e=>Lt(t=>G(()=>{t.countReset(e)})),o9=(...e)=>Lt(t=>G(()=>{t.debug(...e)})),s9=(e,t)=>Lt(r=>G(()=>{r.dir(e,t)})),a9=(...e)=>Lt(t=>G(()=>{t.dirxml(...e)})),cx=(...e)=>Lt(t=>G(()=>{t.error(...e)})),i9=e=>Lt(t=>Wa(G(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>G(()=>{t.groupEnd()}))),c9=(...e)=>Lt(t=>G(()=>{t.info(...e)})),Qt=(...e)=>Lt(t=>G(()=>{t.log(...e)})),u9=(e,t)=>Lt(r=>G(()=>{r.table(e,t)})),f9=e=>Lt(t=>Wa(G(()=>{t.time(e)}),()=>G(()=>{t.timeEnd(e)}))),l9=(e,...t)=>Lt(r=>G(()=>{r.timeLog(e,...t)})),p9=(...e)=>Lt(t=>G(()=>{t.trace(...e)})),d9=(...e)=>Lt(t=>G(()=>{t.warn(...e)})),m9=d(e=>se(e[0]),(e,t)=>Lt(r=>Yf(G(()=>{t?.collapsed?r.groupCollapsed(t.label):r.group(t?.label)}),()=>e,()=>G(()=>{r.groupEnd()})))),h9=d(e=>se(e[0]),(e,t)=>Lt(r=>Yf(G(()=>{r.time(t)}),()=>e,()=>G(()=>{r.timeEnd(t)}))));var qx={};En(qx,{ChoiceWithValue:()=>bX,Date:()=>eX,Directory:()=>Y7,File:()=>Q7,FileParse:()=>sX,FileSchema:()=>aX,FileText:()=>oX,Finite:()=>X7,Int:()=>Z7,Literals:()=>tX,Never:()=>iX,Path:()=>rX,Redacted:()=>nX,String:()=>J7,atLeast:()=>xX,atMost:()=>yX,between:()=>SX,filter:()=>CX,filterMap:()=>TX,map:()=>mX,mapEffect:()=>hX,mapTryCatch:()=>gX,optional:()=>cX,orElse:()=>wX,orElseResult:()=>kX,variadic:()=>dX,withDefault:()=>fX,withDescription:()=>uX,withFallbackConfig:()=>lX,withFallbackPrompt:()=>pX,withMetavar:()=>IX,withSchema:()=>EX});var We="~effect/cli/CliError",mT=e=>A(e,We),xa=class extends Vn(`${We}/UnrecognizedOption`)("UnrecognizedOption",{option:$,command:Is(Ce($)),suggestions:Ce($)}){[We]=We;get message(){let t=this.suggestions.length>0?`
36
36
 
37
37
  Did you mean this?
38
38
  ${this.suggestions.join(`
@@ -40,20 +40,20 @@ ${t}}`),n},bS="~effect/Fiber",Lz={_A:F,_E:F},Bz={id:0},aA=(()=>{try{return globa
40
40
 
41
41
  Did you mean this?
42
42
  ${this.suggestions.join(`
43
- `)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},dT=class extends Vn(`${We}/UserError`)("UserError",{cause:oT(),userMessage:Ss($)}){[We]=We;[Ys]=!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"}},g9=Ze([xa,Jp,Gu,Ku,Zp,gr,Qp,dT]),ks=class extends Vn(`${We}/ShowHelp`)("ShowHelp",{commandPath:Ce($),errors:Ce(g9)}){[We]=We;[vl]=this.errors.length?1:0;[Ys]=!1;get message(){return"Help requested"}};var nL=Object.prototype.hasOwnProperty,x9=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},y9=e=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")),hT=e=>{let t=(e??"").trim();if(y9(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()},oL=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 g=hT(i[1]);g==="__proto__"?r=Object.create(null):r=t[g]??=Object.create(null);continue}let c=o.exec(a);if(c===null)continue;let f=hT(c[1]),u=f.length>2&&f.endsWith("[]"),l=u?f.slice(0,-2):f;if(l==="__proto__")continue;let p=c[2]===void 0?!0:hT(c[3]),h=p==="true"||p==="false"||p==="null"?JSON.parse(p):p;u&&(nL.call(r,l)?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]),Array.isArray(r[l])?r[l].push(h):r[l]=h}let s=[];for(let a of Object.keys(t)){if(typeof t[a]!="object"||t[a]===null||Array.isArray(t[a]))continue;let i=x9(a),c=i.pop(),f=c.replace(/\\\./g,".");r=t;for(let u of i)u!=="__proto__"&&((!nL.call(r,u)||typeof r[u]!="object"||r[u]===null)&&(r[u]=Object.create(null)),r=r[u]);r===t&&f===c||(r[f]=t[a],s.push(a))}for(let a of s)delete t[a];return t};var sL=Object.prototype.hasOwnProperty,Xp=()=>Object.create(null),aL=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date),gT=class{root=Xp();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=Xp();return i.push(c),c}i===void 0&&(i=Xp(),n[s]=i),Array.isArray(i)&&(i=i[i.length-1]),aL(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 f=Xp();o[i]=f,o=f}else aL(c)?o=c:this.fail(`Cannot redefine existing key '${r.slice(0,a+1).join(".")}'`)}let s=r[r.length-1];sL.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
+ `)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},dT=class extends Vn(`${We}/UserError`)("UserError",{cause:oT(),userMessage:Ss($)}){[We]=We;[Ys]=!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"}},g9=Ze([xa,Jp,Gu,Ku,Zp,gr,Qp,dT]),ks=class extends Vn(`${We}/ShowHelp`)("ShowHelp",{commandPath:Ce($),errors:Ce(g9)}){[We]=We;[vl]=this.errors.length?1:0;[Ys]=!1;get message(){return"Help requested"}};var oL=Object.prototype.hasOwnProperty,x9=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},y9=e=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")),hT=e=>{let t=(e??"").trim();if(y9(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()},sL=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 g=hT(i[1]);g==="__proto__"?r=Object.create(null):r=t[g]??=Object.create(null);continue}let c=o.exec(a);if(c===null)continue;let f=hT(c[1]),u=f.length>2&&f.endsWith("[]"),l=u?f.slice(0,-2):f;if(l==="__proto__")continue;let p=c[2]===void 0?!0:hT(c[3]),h=p==="true"||p==="false"||p==="null"?JSON.parse(p):p;u&&(oL.call(r,l)?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]),Array.isArray(r[l])?r[l].push(h):r[l]=h}let s=[];for(let a of Object.keys(t)){if(typeof t[a]!="object"||t[a]===null||Array.isArray(t[a]))continue;let i=x9(a),c=i.pop(),f=c.replace(/\\\./g,".");r=t;for(let u of i)u!=="__proto__"&&((!oL.call(r,u)||typeof r[u]!="object"||r[u]===null)&&(r[u]=Object.create(null)),r=r[u]);r===t&&f===c||(r[f]=t[a],s.push(a))}for(let a of s)delete t[a];return t};var aL=Object.prototype.hasOwnProperty,Xp=()=>Object.create(null),iL=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date),gT=class{root=Xp();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=Xp();return i.push(c),c}i===void 0&&(i=Xp(),n[s]=i),Array.isArray(i)&&(i=i[i.length-1]),iL(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 f=Xp();o[i]=f,o=f}else iL(c)?o=c:this.fail(`Cannot redefine existing key '${r.slice(0,a+1).join(".")}'`)}let s=r[r.length-1];aL.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
44
44
  `,this.index)?2:this.peek()===`
45
45
  `?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===`
46
46
  `||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()!==`
47
47
  `&&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:`
48
- `,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(sL.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
+ `,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(aL.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
49
49
  `,this.index)?2:this.peek()===`
50
50
  `?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()===`
51
51
  `||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=Xp();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()!==`
52
52
  `&&this.peek()!=="\r"&&this.fail("Expected the end of the line")}skipComment(){for(;!this.done&&this.peek()!==`
53
53
  `;)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]===`
54
- `?(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}`)}},iL=e=>new gT(e.replace(/^\uFEFF/,"")).parse();var ET=Object.prototype.hasOwnProperty,uL=(e,t,r)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r})},bT=(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},IT=(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=bT(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},b9=e=>{let t=IT(e,"#");return t===-1?e:e.slice(0,t).trimEnd()},xT=e=>IT(e,":"),ux=e=>e==="-"||e.startsWith("- "),cL=e=>e===0?" ":`
55
- `.repeat(e),fL=e=>/\\*$/.exec(e)[0].length%2===1,I9=(e,t)=>{let r=/[ \t]+$/.exec(e);if(r===null)return e;let n=t==='"'&&fL(e.slice(0,r.index));return e.slice(0,r.index+(n?1:0))},C9=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:`
56
- `,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(ET.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},ed=e=>{let t=e.trim();if(t.length===0)return null;if(t.startsWith('"')&&t.endsWith('"'))return C9(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},lL=e=>{let t=ed(e);return t==null?"":String(t)},yT=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 ed(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 ed(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(":"),ET.call(t,r)&&this.fail(`Duplicate key '${r}'`),uL(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==="'"?lL(this.readQuoted(t)):this.readUntil(/:/).trim()}readQuoted(t){let r=this.index,n=bT(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}`)}},ST=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`),ux(n.text)?this.parseSequence(t):xT(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=xT(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=lL(r.slice(0,n).trim()),i=r.slice(n+1).trimStart(),c=this.parseNodeValue(i,o,!0);ET.call(t,a)&&this.fail(s,`Duplicate key '${a}'`),uL(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`),!ux(n.text)))return r;this.index++;let o=n.text.slice(1).trimStart();ux(o)&&this.fail(n,"Compact nested block sequences are not supported");let s=xT(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&&ux(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 yT(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=IT(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),f=c.search(/(?:^|[ \t])#/),u=(f===-1?c:c.slice(0,f)).trimEnd();if(u.length===0||i.indent===0&&/^(?:---|\.\.\.)(?:\s|$)/.test(u))break;/:(?:\s|$)/.test(u)&&this.fail(i,"Invalid colon in plain scalar"),o+=cL(a)+u,this.index++,s=f!==-1}return ed(o)}parseQuotedValue(t,r){let n=t[0],o=n,s=t.slice(1);for(;;){let a=bT(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 ed(o+s.slice(0,a+1))}n==='"'&&fL(s)?o+=s.slice(0,-1):o+=I9(s,n)+cL(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 h=this.lines[i];if(h.raw.trim().length!==0&&h.indent<=r)break;h.raw.trim().length!==0&&(c=Math.min(c,h.indent)),i++}c===Number.POSITIVE_INFINITY&&(c=r+1);let f=[];for(let h=a;h<i;h++){let g=this.lines[h];g.raw.trim().length===0?f.push(""):g.indent<c?this.fail(g,`Expected block scalar indentation of ${c} spaces`):f.push(g.raw.slice(c))}this.index=i;let u=f.length;for(;u>0&&f[u-1].length===0;)u--;let l=Math.max(0,f.length-u-(i===this.lines.length?1:0))+(u>0&&a+u<this.lines.length?1:0);f.length=u;let p="";if(n==="|")p=f.join(`
54
+ `?(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}`)}},cL=e=>new gT(e.replace(/^\uFEFF/,"")).parse();var ET=Object.prototype.hasOwnProperty,fL=(e,t,r)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r})},bT=(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},IT=(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=bT(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},b9=e=>{let t=IT(e,"#");return t===-1?e:e.slice(0,t).trimEnd()},xT=e=>IT(e,":"),ux=e=>e==="-"||e.startsWith("- "),uL=e=>e===0?" ":`
55
+ `.repeat(e),lL=e=>/\\*$/.exec(e)[0].length%2===1,I9=(e,t)=>{let r=/[ \t]+$/.exec(e);if(r===null)return e;let n=t==='"'&&lL(e.slice(0,r.index));return e.slice(0,r.index+(n?1:0))},C9=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:`
56
+ `,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(ET.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},ed=e=>{let t=e.trim();if(t.length===0)return null;if(t.startsWith('"')&&t.endsWith('"'))return C9(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},pL=e=>{let t=ed(e);return t==null?"":String(t)},yT=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 ed(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 ed(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(":"),ET.call(t,r)&&this.fail(`Duplicate key '${r}'`),fL(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==="'"?pL(this.readQuoted(t)):this.readUntil(/:/).trim()}readQuoted(t){let r=this.index,n=bT(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}`)}},ST=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`),ux(n.text)?this.parseSequence(t):xT(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=xT(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=pL(r.slice(0,n).trim()),i=r.slice(n+1).trimStart(),c=this.parseNodeValue(i,o,!0);ET.call(t,a)&&this.fail(s,`Duplicate key '${a}'`),fL(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`),!ux(n.text)))return r;this.index++;let o=n.text.slice(1).trimStart();ux(o)&&this.fail(n,"Compact nested block sequences are not supported");let s=xT(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&&ux(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 yT(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=IT(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),f=c.search(/(?:^|[ \t])#/),u=(f===-1?c:c.slice(0,f)).trimEnd();if(u.length===0||i.indent===0&&/^(?:---|\.\.\.)(?:\s|$)/.test(u))break;/:(?:\s|$)/.test(u)&&this.fail(i,"Invalid colon in plain scalar"),o+=uL(a)+u,this.index++,s=f!==-1}return ed(o)}parseQuotedValue(t,r){let n=t[0],o=n,s=t.slice(1);for(;;){let a=bT(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 ed(o+s.slice(0,a+1))}n==='"'&&lL(s)?o+=s.slice(0,-1):o+=I9(s,n)+uL(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 h=this.lines[i];if(h.raw.trim().length!==0&&h.indent<=r)break;h.raw.trim().length!==0&&(c=Math.min(c,h.indent)),i++}c===Number.POSITIVE_INFINITY&&(c=r+1);let f=[];for(let h=a;h<i;h++){let g=this.lines[h];g.raw.trim().length===0?f.push(""):g.indent<c?this.fail(g,`Expected block scalar indentation of ${c} spaces`):f.push(g.raw.slice(c))}this.index=i;let u=f.length;for(;u>0&&f[u-1].length===0;)u--;let l=Math.max(0,f.length-u-(i===this.lines.length?1:0))+(u>0&&a+u<this.lines.length?1:0);f.length=u;let p="";if(n==="|")p=f.join(`
57
57
  `);else{let h=0,g;for(let x of f)if(x.length===0)h++;else{let b=x.startsWith(" "),T=b||g===!0;g===void 0?p+=`
58
58
  `.repeat(h):h===0?p+=T?`
59
59
  `:" ":p+=`
@@ -61,36 +61,36 @@ ${t}}`),n},bS="~effect/Fiber",Lz={_A:F,_E:F},Bz={id:0},aA=(()=>{try{return globa
61
61
  `.repeat(l):o==="clip"&&u>0&&l>0?`${p}
62
62
  `:p}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}`)}},CT=e=>{let r=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
63
63
  `).split(`
64
- `).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:b9(n.slice(s)),indent:s,number:o+1}});return new ST(r).parse()};var w9="~effect/cli/Primitive",k9={[w9]:{_A:F}},pL=zg(Qg),dL=zg(Yg),fx=e=>e._tag==="Boolean",Uo=(e,t)=>Object.assign(Object.create(k9),{_tag:e,parse:t}),lx=(e,t)=>{let r=lT(t),n=bs(r);return Uo(e,o=>kt(n(o),s=>s.message))},mL=lx("Boolean",ZC),hL=lx("Finite",qu),gL=lx("Int",Rr),xL=lx("Date",Hu),yL=Uo("String",e=>y(e)),SL=e=>{let t=new Map(e),r=e.map(([o])=>N(o)).join(" | "),n=Uo("Choice",o=>t.has(o)?y(t.get(o)):C(r));return Object.assign(n,{choiceKeys:e.map(([o])=>o)})},EL=(e,t)=>{let r=Uo("Path",L(function*(n){let o=yield*Fn,s=yield*Oo,a=s.isAbsolute(n)?n:s.resolve(n),i=yield*kt(o.exists(a),c=>`Failed to check path existence: ${c.message}`);if(t===!0&&!i)return yield*C(`Path does not exist: ${a}`);if(i&&e!=="either"){let c=yield*kt(o.stat(a),f=>`Failed to stat path: ${f.message}`);if(e==="file"&&c.type!=="File")return yield*C(`Path is not a file: ${a}`);if(e==="directory"&&c.type!=="Directory")return yield*C(`Path is not a directory: ${a}`)}return a}));return Object.assign(r,{pathType:e})},bL=Uo("Redacted",e=>y(Bn(e))),TT=Uo("FileText",L(function*(e){let t=yield*Fn,r=yield*Oo,n=r.isAbsolute(e)?e:r.resolve(e);return(yield*kt(t.exists(n),i=>`Failed to check file existence: ${i.message}`))?(yield*kt(t.stat(n),i=>`Failed to stat file: ${i.message}`)).type!=="File"?yield*C(`Path is not a file: ${n}`):yield*kt(t.readFileString(n),i=>`Failed to read file: ${i.message}`):yield*C(`File does not exist: ${n}`)})),A9={ini:e=>oL(e),json:e=>JSON.parse(e),toml:e=>iL(e),yml:e=>CT(e),yaml:e=>CT(e)},wT=e=>Uo("FileParse",L(function*(t){let r=e?.format??t.split(".").pop(),n=A9[r];if(n===void 0)return yield*C(`Unsupported file format: ${r}`);let o=yield*TT.parse(t);return yield*ht({try:()=>n(o),catch:s=>`Failed to parse '.${r}' file content: ${s}`})})),IL=(e,t)=>{let r=bs(e);return Uo("FileSchema",L(function*(n){let o=yield*wT(t).parse(n);return yield*kt(r(o),s=>t?.errorFormatter?.(s.issue)??s.toString())}))},CL=Uo("KeyValuePair",L(function*(e){let t=e.indexOf("=");if(t===-1)return yield*C(`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*C(`Invalid key=value format. Both key and value must be non-empty. Got: ${e}`):{[r]:n}})),TL=Uo("Never",()=>C("This option does not accept values")),td=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"}},As=e=>e._tag==="Choice"?e.choiceKeys:void 0,kT=e=>e._tag==="Path"?e.pathType:void 0;var v9="\x1B[0m",vs="\x1B[1m",wL="\x1B[3m",Ni="\x1B[4m",kL="\x1B[9m",AL="\x1B[?25h",rd="\x1B[?25l";var ya="\x1B[2K";var px="\x1B[31m",dx="\x1B[32m",vL="\x1B[35m",Mi="\x1B[37m",nd="\x1B[90m",Zu="\x1B[96m",rt=(e,t,...r)=>e?`${r.flat().join("")}${t}${v9}`:t,mx=()=>{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},Do=(...e)=>e,OL=(e,t)=>t===void 0?`\x1B[${Math.max(e+1,0)}G`:`\x1B[${t+1};${Math.max(e+1,0)}H`,_L=(e=1)=>`\x1B[${e}B`,PL=(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},FL=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 DL="~effect/cli/Prompt",LL=e=>A(e,DL),BL={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:Zu,mutedColor:nd,successColor:dx,errorColor:px,submittedColor:Mi},_9={...BL,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},P9=e=>({...process.platform==="win32"?_9:BL,...e,colors:e?.colors??mx()}),od=ge("effect/cli/Prompt/Theme",{defaultValue:P9}),Yt=e=>ne(od,t=>({...t,...e.theme}));var LT=(e,t)=>rt(e.colors,t,Do(wL,e.errorColor)),De=(e,t,...r)=>t.length===0?"":rt(e.colors,t,...r),Sa=(e,t)=>e.length===0?t:e+" "+t,F9=(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)},BT=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 Ui(r,{render:z9(t),process:n=>W9(n,t.initial),clear:L9(t)})},Ui=(e,...t)=>{let[r,n]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(qT);return o._tag="Loop",o.initialState=e,o.render=n.render,o.process=n.process,o.clear=n.clear,o.events=r,o},jL=e=>{let t={initial:new globalThis.Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:y,...e,locales:{...r7,...e.locales}},r=a7(t.dateMask,t.initial,t.locales),n=r.findIndex(s=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:v()};return Ui(o,{render:n7(t),process:o7(t),clear:V9(t)})};var R9=d(2,(e,t)=>{let r=Object.create(qT);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),zL=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?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ui(n,{render:d7(t),process:m7(t),clear:GL(t)})};var jT=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:o=>o<t.min?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ui(n,{render:l7(t),process:p7(t),clear:GL(t)})};var $9=d(2,(e,t)=>R9(e,r=>M9(t(r)))),qL=e=>rB(e,"password").pipe($9(Bn)),xr=L(function*(e){let t=yield*Gn,r=yield*tb(t.readInput);return yield*vT(e,t,r)},kt(()=>new Vu({})),Qs),N9=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},zT=e=>{let t={maxPerPage:10,...e},r=N9(t.choices);return Ui(r,{render:I7(t),process:T7(t),clear:C7(t)})};var M9=e=>{let t=Object.create(qT);return t._tag="Succeed",t.value=e,t},HL=e=>rB(e,"text"),WL=e=>{let t={initial:!1,active:"on",inactive:"off",...e};return Ui(t.initial,{render:j7(t),process:z7,clear:()=>D7(t)})},qT={...ao({label:"Prompt",evaluate(){return xr(this)}}),[DL]:{_Output:e=>e}};var vT=(e,t,r)=>Ie(()=>{let n=e;switch(n._tag){case"Loop":return B(r,o=>U9(n,t,o));case"OnSuccess":return B(vT(n.prompt,t,r),o=>vT(n.onSuccess(o),t,r));case"Succeed":return y(n.value)}}),U9=L(function*(e,t,r){let n=wr(e.initialState)?yield*e.initialState:e.initialState,o=j.NextFrame({state:n}),s="";for(;;){let a=yield*e.render(n,o);if(yield*os(t.display(s+a)),s="",e.events){let i=cs(r).pipe(ne(f=>({_tag:"Input",input:f}))),c=yield*Xa(i,cs(e.events).pipe(ne(f=>({_tag:"Event",value:f}))));o=yield*e.process(c,n)}else{let i=yield*cs(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*os(t.display(s+i)),o.value}}}},(e,t,r)=>Bc(e,os(r.display(AL)))),j=Vy(),Qu=(e,t)=>{if(t===0)return ya+OL(0);let r=0,n=e.split(Li);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return FL(r)},D9=(e,t)=>{let r=e.split(Li);return t===0?r.length:Zn(Ft(r,n=>Math.ceil(n.length/t)),fc(0,(n,o)=>n+o))},HT=(e,t,r)=>r!==void 0&&r.length>0?_L(D9(r,t))+Qu(`
64
+ `).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:b9(n.slice(s)),indent:s,number:o+1}});return new ST(r).parse()};var w9="~effect/cli/Primitive",k9={[w9]:{_A:F}},dL=zg(Qg),mL=zg(Yg),fx=e=>e._tag==="Boolean",Uo=(e,t)=>Object.assign(Object.create(k9),{_tag:e,parse:t}),lx=(e,t)=>{let r=lT(t),n=bs(r);return Uo(e,o=>kt(n(o),s=>s.message))},hL=lx("Boolean",ZC),gL=lx("Finite",qu),xL=lx("Int",Rr),yL=lx("Date",Hu),SL=Uo("String",e=>y(e)),EL=e=>{let t=new Map(e),r=e.map(([o])=>N(o)).join(" | "),n=Uo("Choice",o=>t.has(o)?y(t.get(o)):C(r));return Object.assign(n,{choiceKeys:e.map(([o])=>o)})},bL=(e,t)=>{let r=Uo("Path",L(function*(n){let o=yield*Fn,s=yield*Oo,a=s.isAbsolute(n)?n:s.resolve(n),i=yield*kt(o.exists(a),c=>`Failed to check path existence: ${c.message}`);if(t===!0&&!i)return yield*C(`Path does not exist: ${a}`);if(i&&e!=="either"){let c=yield*kt(o.stat(a),f=>`Failed to stat path: ${f.message}`);if(e==="file"&&c.type!=="File")return yield*C(`Path is not a file: ${a}`);if(e==="directory"&&c.type!=="Directory")return yield*C(`Path is not a directory: ${a}`)}return a}));return Object.assign(r,{pathType:e})},IL=Uo("Redacted",e=>y(Bn(e))),TT=Uo("FileText",L(function*(e){let t=yield*Fn,r=yield*Oo,n=r.isAbsolute(e)?e:r.resolve(e);return(yield*kt(t.exists(n),i=>`Failed to check file existence: ${i.message}`))?(yield*kt(t.stat(n),i=>`Failed to stat file: ${i.message}`)).type!=="File"?yield*C(`Path is not a file: ${n}`):yield*kt(t.readFileString(n),i=>`Failed to read file: ${i.message}`):yield*C(`File does not exist: ${n}`)})),A9={ini:e=>sL(e),json:e=>JSON.parse(e),toml:e=>cL(e),yml:e=>CT(e),yaml:e=>CT(e)},wT=e=>Uo("FileParse",L(function*(t){let r=e?.format??t.split(".").pop(),n=A9[r];if(n===void 0)return yield*C(`Unsupported file format: ${r}`);let o=yield*TT.parse(t);return yield*ht({try:()=>n(o),catch:s=>`Failed to parse '.${r}' file content: ${s}`})})),CL=(e,t)=>{let r=bs(e);return Uo("FileSchema",L(function*(n){let o=yield*wT(t).parse(n);return yield*kt(r(o),s=>t?.errorFormatter?.(s.issue)??s.toString())}))},TL=Uo("KeyValuePair",L(function*(e){let t=e.indexOf("=");if(t===-1)return yield*C(`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*C(`Invalid key=value format. Both key and value must be non-empty. Got: ${e}`):{[r]:n}})),wL=Uo("Never",()=>C("This option does not accept values")),td=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"}},As=e=>e._tag==="Choice"?e.choiceKeys:void 0,kT=e=>e._tag==="Path"?e.pathType:void 0;var v9="\x1B[0m",vs="\x1B[1m",kL="\x1B[3m",Ni="\x1B[4m",AL="\x1B[9m",vL="\x1B[?25h",rd="\x1B[?25l";var ya="\x1B[2K";var px="\x1B[31m",dx="\x1B[32m",OL="\x1B[35m",Mi="\x1B[37m",nd="\x1B[90m",Zu="\x1B[96m",rt=(e,t,...r)=>e?`${r.flat().join("")}${t}${v9}`:t,mx=()=>{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},Do=(...e)=>e,_L=(e,t)=>t===void 0?`\x1B[${Math.max(e+1,0)}G`:`\x1B[${t+1};${Math.max(e+1,0)}H`,PL=(e=1)=>`\x1B[${e}B`,FL=(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},RL=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 LL="~effect/cli/Prompt",BL=e=>A(e,LL),jL={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:Zu,mutedColor:nd,successColor:dx,errorColor:px,submittedColor:Mi},_9={...jL,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},P9=e=>({...process.platform==="win32"?_9:jL,...e,colors:e?.colors??mx()}),od=ge("effect/cli/Prompt/Theme",{defaultValue:P9}),Yt=e=>ne(od,t=>({...t,...e.theme}));var LT=(e,t)=>rt(e.colors,t,Do(kL,e.errorColor)),De=(e,t,...r)=>t.length===0?"":rt(e.colors,t,...r),Sa=(e,t)=>e.length===0?t:e+" "+t,F9=(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)},BT=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 Ui(r,{render:z9(t),process:n=>W9(n,t.initial),clear:L9(t)})},Ui=(e,...t)=>{let[r,n]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(qT);return o._tag="Loop",o.initialState=e,o.render=n.render,o.process=n.process,o.clear=n.clear,o.events=r,o},zL=e=>{let t={initial:new globalThis.Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:y,...e,locales:{...r7,...e.locales}},r=a7(t.dateMask,t.initial,t.locales),n=r.findIndex(s=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:v()};return Ui(o,{render:n7(t),process:o7(t),clear:V9(t)})};var R9=d(2,(e,t)=>{let r=Object.create(qT);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),qL=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?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ui(n,{render:d7(t),process:m7(t),clear:KL(t)})};var jT=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:o=>o<t.min?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ui(n,{render:l7(t),process:p7(t),clear:KL(t)})};var $9=d(2,(e,t)=>R9(e,r=>M9(t(r)))),HL=e=>nB(e,"password").pipe($9(Bn)),xr=L(function*(e){let t=yield*Gn,r=yield*tb(t.readInput);return yield*vT(e,t,r)},kt(()=>new Vu({})),Qs),N9=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},zT=e=>{let t={maxPerPage:10,...e},r=N9(t.choices);return Ui(r,{render:I7(t),process:T7(t),clear:C7(t)})};var M9=e=>{let t=Object.create(qT);return t._tag="Succeed",t.value=e,t},WL=e=>nB(e,"text"),VL=e=>{let t={initial:!1,active:"on",inactive:"off",...e};return Ui(t.initial,{render:j7(t),process:z7,clear:()=>D7(t)})},qT={...ao({label:"Prompt",evaluate(){return xr(this)}}),[LL]:{_Output:e=>e}};var vT=(e,t,r)=>Ie(()=>{let n=e;switch(n._tag){case"Loop":return B(r,o=>U9(n,t,o));case"OnSuccess":return B(vT(n.prompt,t,r),o=>vT(n.onSuccess(o),t,r));case"Succeed":return y(n.value)}}),U9=L(function*(e,t,r){let n=wr(e.initialState)?yield*e.initialState:e.initialState,o=j.NextFrame({state:n}),s="";for(;;){let a=yield*e.render(n,o);if(yield*os(t.display(s+a)),s="",e.events){let i=cs(r).pipe(ne(f=>({_tag:"Input",input:f}))),c=yield*Xa(i,cs(e.events).pipe(ne(f=>({_tag:"Event",value:f}))));o=yield*e.process(c,n)}else{let i=yield*cs(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*os(t.display(s+i)),o.value}}}},(e,t,r)=>Bc(e,os(r.display(vL)))),j=Vy(),Qu=(e,t)=>{if(t===0)return ya+_L(0);let r=0,n=e.split(Li);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return RL(r)},D9=(e,t)=>{let r=e.split(Li);return t===0?r.length:Zn(Ft(r,n=>Math.ceil(n.length/t)),fc(0,(n,o)=>n+o))},HT=(e,t,r)=>r!==void 0&&r.length>0?PL(D9(r,t))+Qu(`
65
65
  ${r}`,t)+Qu(e,t):Qu(e,t),Di="\x07",Li=/\r?\n/,L9=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=t.value?e.placeholder.defaultConfirm:e.placeholder.defaultDeny,i=Sn(a,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),c=Qu(i,o),f=ya+"\x1B[G";return c+f}),B9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,a=rt(r.colors,s,r.mutedColor),i=Sn(a,t.message,n,o,r);return rd+i}),j9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=e?t.label.confirm:t.label.deny;return Sn(s,t.message,n,o,r)+`
66
66
  `}),z9=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>B9(n,e),Submit:({value:n})=>j9(n,e)}),q9=/^y|t$/,H9=/^n|f$/,W9=(e,t)=>{let r=bt(e.input,()=>"");return e.key.name==="enter"||e.key.name==="return"?y(j.Submit({value:t})):q9.test(r.toLowerCase())?y(j.Submit({value:!0})):H9.test(r.toLowerCase())?y(j.Submit({value:!1})):y(j.Beep())},V9=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=ya+"\x1B[G",i=fc(t.dateParts,"",(l,p)=>l+p.toString()),c=Sn(i,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),f=ve(t.error)?_f(t.error.value.split(Li),{onEmpty:()=>"",onNonEmpty:l=>Sa(s.pointerSmall,l.join(`
67
67
  `))}):"";return HT(c,o,f)+a}),G9=(e,t,r)=>{if(ve(e.error)){let n=e.error.value.split(Li);if(Us(n)){let o=De(r,t,r.errorColor),s=Ft(n,a=>LT(r,a));return`\x1B[s
68
68
  `+Sa(o,s.join(`
69
- `))+"\x1B[u"}}return""},VL=(e,t,r=!1)=>fc(e.dateParts,"",(n,o,s)=>{let a=o.toString();if(s===e.cursor&&!r){let i=Do(Ni,t.primaryColor);return n+rt(t.colors,a,i)}return n+a}),K9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=VL(e,r),a=Sn(s,t.message,n,o,r),i=G9(e,r.pointerSmall,r);return rd+a+i}),J9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=VL(e,r,!0);return Sn(s,t.message,n,o,r)+`
70
- `}),Z9=e=>(e.dateParts[e.cursor].increment(),j.NextFrame({state:{...e,typed:""}})),Q9=e=>(e.dateParts[e.cursor].decrement(),j.NextFrame({state:{...e,typed:""}})),Y9=e=>{let t=e.dateParts[e.cursor].previousPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},X9=e=>{let t=e.dateParts[e.cursor].nextPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},e7=e=>{let t=e.dateParts[e.cursor].nextPart(),r=Re(t,{onNone:()=>e.dateParts.findIndex(n=>!n.isToken()),onSome:n=>e.dateParts.indexOf(n)});return j.NextFrame({state:{...e,typed:"",cursor:r}})},t7=(e,t)=>{if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),j.NextFrame({state:{...t,typed:r}})}return j.Beep()},r7={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"]},n7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>K9(n,e),Submit:()=>J9(t,e)}),o7=e=>(t,r)=>{switch(t.key.name){case"left":return y(Y9(r));case"right":return y(X9(r));case"k":case"up":return y(Z9(r));case"j":case"down":return y(Q9(r));case"tab":return y(e7(r));case"enter":case"return":return Zs(e.validate(r.value),{onFailure:n=>j.NextFrame({state:{...r,error:R(n)}}),onSuccess:n=>j.Submit({value:n})});default:return y(t7(bt(t.input,()=>""),r))}},s7=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,RL={1:({token:e,...t})=>new hx({token:e.replace(/\\(.)/g,"$1"),...t}),2:e=>new RT(e),3:e=>new $T(e),4:e=>new NT(e),5:e=>new MT(e),6:e=>new FT(e),7:e=>new PT(e),8:e=>new _T(e),9:e=>new OT(e)},a7=(e,t,r)=>{let n=[],o=null;for(;o=s7.exec(e);){let a=o.shift(),i=o.findIndex(c=>c!==void 0);if(i in RL){let c=o[i]||a;n.push(RL[i]({token:c,date:t,parts:n,locales:r}))}else n.push(new hx({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},Ua());return n.splice(0,n.length,...s),n},Kn=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=bt(qd(this.parts,r=>r===this),()=>0);return Pf(this.parts.slice(t+1),r=>!r.isToken())}previousPart(){let t=qd(this.parts,r=>r===this);return ve(t)?Hd(this.parts.slice(0,t.value),r=>!r.isToken()):v()}toString(){return globalThis.String(this.date)}},hx=class extends Kn{increment(){}decrement(){}setValue(t){this.token=this.token+t}isToken(){return!0}toString(){return this.token}},OT=class extends Kn{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)}},_T=class extends Kn{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}},PT=class extends Kn{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}},FT=class extends Kn{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}`}},RT=class extends Kn{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"}}},$T=class extends Kn{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}`}}},NT=class extends Kn{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}},MT=class extends Kn{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 Sn=(e,t,r,n,o,s)=>{let a=r.length===0?"":r+" ",i=c=>{let f=a+c;return n.length>0&&(f+=" "+n),e.length>0?f+=" "+e:n.length>0&&(f+=" "),f};return _f(t.split(Li),{onEmpty:()=>i(""),onNonEmpty:c=>{let f=s?.plain===!0?c:Ft(c,u=>rt(o.colors,u,vs));return i(f.join(`
71
- `))}})};var i7=(e,t,r,n)=>{if(!e.disabled&&e.description&&t){let o=r.descriptionSeparator+e.description;return n?.plain===!0?o:rt(r.colors,o,r.mutedColor)}return""};var GL=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=ya+"\x1B[G",i=KL(t,s.pointerSmall,s,{plain:!0}),c=WT(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return HT(c,o,i)+a}),c7=(e,t,r,n)=>{let o=e.value===""?"":`${e.value}`;if(t||n?.plain===!0)return o;let s=ve(e.error)?r.errorColor:Do(Ni,r.primaryColor);return rt(r.colors,o,s)},KL=(e,t,r,n)=>ve(e.error)?_f(e.error.value.split(Li),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return Sa(t,o.join(`
69
+ `))+"\x1B[u"}}return""},GL=(e,t,r=!1)=>fc(e.dateParts,"",(n,o,s)=>{let a=o.toString();if(s===e.cursor&&!r){let i=Do(Ni,t.primaryColor);return n+rt(t.colors,a,i)}return n+a}),K9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=GL(e,r),a=Sn(s,t.message,n,o,r),i=G9(e,r.pointerSmall,r);return rd+a+i}),J9=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=GL(e,r,!0);return Sn(s,t.message,n,o,r)+`
70
+ `}),Z9=e=>(e.dateParts[e.cursor].increment(),j.NextFrame({state:{...e,typed:""}})),Q9=e=>(e.dateParts[e.cursor].decrement(),j.NextFrame({state:{...e,typed:""}})),Y9=e=>{let t=e.dateParts[e.cursor].previousPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},X9=e=>{let t=e.dateParts[e.cursor].nextPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},e7=e=>{let t=e.dateParts[e.cursor].nextPart(),r=Re(t,{onNone:()=>e.dateParts.findIndex(n=>!n.isToken()),onSome:n=>e.dateParts.indexOf(n)});return j.NextFrame({state:{...e,typed:"",cursor:r}})},t7=(e,t)=>{if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),j.NextFrame({state:{...t,typed:r}})}return j.Beep()},r7={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"]},n7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>K9(n,e),Submit:()=>J9(t,e)}),o7=e=>(t,r)=>{switch(t.key.name){case"left":return y(Y9(r));case"right":return y(X9(r));case"k":case"up":return y(Z9(r));case"j":case"down":return y(Q9(r));case"tab":return y(e7(r));case"enter":case"return":return Zs(e.validate(r.value),{onFailure:n=>j.NextFrame({state:{...r,error:R(n)}}),onSuccess:n=>j.Submit({value:n})});default:return y(t7(bt(t.input,()=>""),r))}},s7=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,$L={1:({token:e,...t})=>new hx({token:e.replace(/\\(.)/g,"$1"),...t}),2:e=>new RT(e),3:e=>new $T(e),4:e=>new NT(e),5:e=>new MT(e),6:e=>new FT(e),7:e=>new PT(e),8:e=>new _T(e),9:e=>new OT(e)},a7=(e,t,r)=>{let n=[],o=null;for(;o=s7.exec(e);){let a=o.shift(),i=o.findIndex(c=>c!==void 0);if(i in $L){let c=o[i]||a;n.push($L[i]({token:c,date:t,parts:n,locales:r}))}else n.push(new hx({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},Ua());return n.splice(0,n.length,...s),n},Kn=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=bt(qd(this.parts,r=>r===this),()=>0);return Pf(this.parts.slice(t+1),r=>!r.isToken())}previousPart(){let t=qd(this.parts,r=>r===this);return ve(t)?Hd(this.parts.slice(0,t.value),r=>!r.isToken()):v()}toString(){return globalThis.String(this.date)}},hx=class extends Kn{increment(){}decrement(){}setValue(t){this.token=this.token+t}isToken(){return!0}toString(){return this.token}},OT=class extends Kn{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)}},_T=class extends Kn{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}},PT=class extends Kn{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}},FT=class extends Kn{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}`}},RT=class extends Kn{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"}}},$T=class extends Kn{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}`}}},NT=class extends Kn{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}},MT=class extends Kn{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 Sn=(e,t,r,n,o,s)=>{let a=r.length===0?"":r+" ",i=c=>{let f=a+c;return n.length>0&&(f+=" "+n),e.length>0?f+=" "+e:n.length>0&&(f+=" "),f};return _f(t.split(Li),{onEmpty:()=>i(""),onNonEmpty:c=>{let f=s?.plain===!0?c:Ft(c,u=>rt(o.colors,u,vs));return i(f.join(`
71
+ `))}})};var i7=(e,t,r,n)=>{if(!e.disabled&&e.description&&t){let o=r.descriptionSeparator+e.description;return n?.plain===!0?o:rt(r.colors,o,r.mutedColor)}return""};var KL=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=ya+"\x1B[G",i=JL(t,s.pointerSmall,s,{plain:!0}),c=WT(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return HT(c,o,i)+a}),c7=(e,t,r,n)=>{let o=e.value===""?"":`${e.value}`;if(t||n?.plain===!0)return o;let s=ve(e.error)?r.errorColor:Do(Ni,r.primaryColor);return rt(r.colors,o,s)},JL=(e,t,r,n)=>ve(e.error)?_f(e.error.value.split(Li),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return Sa(t,o.join(`
72
72
  `));let s=De(r,t,r.errorColor),a=Ft(o,i=>LT(r,i));return`\x1B[s
73
73
  `+Sa(s,a.join(`
74
- `))+"\x1B[u"}}):"",WT=(e,t,r,n,o,s,a=!1)=>{let i=c7(e,a,o,s);return Sn(i,n.message,t,r,o,s)},JL=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=KL(e,r.pointerSmall,r);return WT(e,n,o,t,r)+s}),ZL=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return WT(e,n,o,t,r,void 0,!0)+`
75
- `}),QL=e=>{if(e.value.length<=0)return y(j.Beep());let t=e.value.slice(0,e.value.length-1);return y(j.NextFrame({state:{...e,value:t,error:v()}}))},YL=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),u7=(e,t)=>{if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseInt(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:`${r}`,error:v()}}))},f7=(e,t)=>{if(e==="."&&t.value.includes("."))return y(j.Beep());if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseFloat(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:e==="."?`${r}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${r}`,error:v()}}))},l7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>JL(n,e),Submit:()=>ZL(t,e)}),p7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return YL(r);switch(t.key.name){case"backspace":return QL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseInt(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseInt(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseInt(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide an integer value")}})):Zs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}default:return u7(bt(t.input,()=>""),r)}},d7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>JL(n,e),Submit:()=>ZL(t,e)}),m7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return YL(r);switch(t.key.name){case"backspace":return QL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseFloat(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseFloat(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseFloat(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide a floating point value")}})):B(le(()=>R_(n,e.precision)),o=>Zs(e.validate(o),{onFailure:s=>j.NextFrame({state:{...r,error:R(s)}}),onSuccess:s=>j.Submit({value:s})}))}default:return f7(bt(t.input,()=>""),r)}};var VT=(e,t,r,n,o)=>r.message===void 0?void 0:Sn("",r.message,e,t,n,o),XL=(e,t)=>e===void 0?t:e+`
76
- `+t;var h7=(e,t,r,n,o,s)=>{let a=F9(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=Do(vs,o.mutedColor);return e===n?De(o,o.pointer,i)+a:a+" ".repeat(o.pointer.length)}return e===n?De(o,o.pointer,o.primaryColor)+a:a+" ".repeat(o.pointer.length)};var g7=(e,t,r,n)=>{if(n?.plain===!0)return e.title;let o=e.title;return t?e.disabled?rt(r.colors,o,Do(Ni,r.mutedColor)):rt(r.colors,o,Do(Ni,r.primaryColor)):e.disabled?rt(r.colors,o,Do(kL,r.mutedColor)):o},eB=(e,t,r,n)=>{let o=t.choices,s=q7(e,o.length,t.maxPerPage),a=[];for(let i=s.startIndex;i<s.endIndex;i++){let c=o[i],f=e===i,u=h7(e,o,s,i,r,n),l=g7(c,f,r,n),p=i7(c,f,r,n);a.push(u+l+" "+p)}return a.join(`
77
- `)};var x7=L(function*(e,t){let r=yield*Yt(t),n=eB(e,t,r),o=De(r,r.prefix,r.primaryColor),s=De(r,r.pointerSmall,r.mutedColor),a=VT(o,s,t,r);return rd+XL(a,n)});var y7=L(function*(e,t){let r=yield*Yt(t),n=t.choices[e].title,o=De(r,r.tick,r.successColor),s=De(r,r.ellipsis,r.mutedColor);return(VT(o,s,t,r)??o)+" "+rt(r.colors,n,r.submittedColor)+`
78
- `});var S7=(e,t)=>e===0?y(j.NextFrame({state:t.length-1})):y(j.NextFrame({state:e-1})),E7=(e,t)=>e===t.length-1?y(j.NextFrame({state:0})):y(j.NextFrame({state:e+1})),b7=(e,t)=>y(j.NextFrame({state:(e+1)%t.length}));var I7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>x7(n,e),Submit:()=>y7(t,e)});var C7=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=ya+"\x1B[G",i=VT(s.prefix,s.pointerSmall,e,s,{plain:!0}),c=eB(t,e,s,{plain:!0});return Qu(XL(i,c),o)+a});var T7=e=>(t,r)=>{switch(t.key.name){case"k":case"up":return S7(r,e.choices);case"j":case"down":return E7(r,e.choices);case"tab":return b7(r,e.choices);case"enter":case"return":{let n=e.choices[r];return n.disabled?y(j.Beep()):y(j.Submit({value:n.value}))}default:return y(j.Beep())}};var w7=L(function*(e,t){let n=yield*(yield*Gn).columns,o=yield*Yt(t),s=ya+"\x1B[G",a=tB(e,o.pointerSmall,o,{plain:!0});return HT(GT(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),n,a)+s}),k7=(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=ve(e.error)?r.errorColor:n?r.submittedColor:Do(Ni,r.primaryColor);switch(t.type){case"hidden":return"";case"password":return De(r,r.passwordMask.repeat(s.length),a);case"text":return rt(r.colors,s,a)}},tB=(e,t,r,n)=>ve(e.error)?_f(e.error.value.split(Li),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return Sa(t,o.join(`
74
+ `))+"\x1B[u"}}):"",WT=(e,t,r,n,o,s,a=!1)=>{let i=c7(e,a,o,s);return Sn(i,n.message,t,r,o,s)},ZL=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=JL(e,r.pointerSmall,r);return WT(e,n,o,t,r)+s}),QL=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return WT(e,n,o,t,r,void 0,!0)+`
75
+ `}),YL=e=>{if(e.value.length<=0)return y(j.Beep());let t=e.value.slice(0,e.value.length-1);return y(j.NextFrame({state:{...e,value:t,error:v()}}))},XL=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),u7=(e,t)=>{if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseInt(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:`${r}`,error:v()}}))},f7=(e,t)=>{if(e==="."&&t.value.includes("."))return y(j.Beep());if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseFloat(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:e==="."?`${r}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${r}`,error:v()}}))},l7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>ZL(n,e),Submit:()=>QL(t,e)}),p7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return XL(r);switch(t.key.name){case"backspace":return YL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseInt(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseInt(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseInt(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide an integer value")}})):Zs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}default:return u7(bt(t.input,()=>""),r)}},d7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>ZL(n,e),Submit:()=>QL(t,e)}),m7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return XL(r);switch(t.key.name){case"backspace":return YL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseFloat(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseFloat(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseFloat(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide a floating point value")}})):B(le(()=>$_(n,e.precision)),o=>Zs(e.validate(o),{onFailure:s=>j.NextFrame({state:{...r,error:R(s)}}),onSuccess:s=>j.Submit({value:s})}))}default:return f7(bt(t.input,()=>""),r)}};var VT=(e,t,r,n,o)=>r.message===void 0?void 0:Sn("",r.message,e,t,n,o),eB=(e,t)=>e===void 0?t:e+`
76
+ `+t;var h7=(e,t,r,n,o,s)=>{let a=F9(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=Do(vs,o.mutedColor);return e===n?De(o,o.pointer,i)+a:a+" ".repeat(o.pointer.length)}return e===n?De(o,o.pointer,o.primaryColor)+a:a+" ".repeat(o.pointer.length)};var g7=(e,t,r,n)=>{if(n?.plain===!0)return e.title;let o=e.title;return t?e.disabled?rt(r.colors,o,Do(Ni,r.mutedColor)):rt(r.colors,o,Do(Ni,r.primaryColor)):e.disabled?rt(r.colors,o,Do(AL,r.mutedColor)):o},tB=(e,t,r,n)=>{let o=t.choices,s=q7(e,o.length,t.maxPerPage),a=[];for(let i=s.startIndex;i<s.endIndex;i++){let c=o[i],f=e===i,u=h7(e,o,s,i,r,n),l=g7(c,f,r,n),p=i7(c,f,r,n);a.push(u+l+" "+p)}return a.join(`
77
+ `)};var x7=L(function*(e,t){let r=yield*Yt(t),n=tB(e,t,r),o=De(r,r.prefix,r.primaryColor),s=De(r,r.pointerSmall,r.mutedColor),a=VT(o,s,t,r);return rd+eB(a,n)});var y7=L(function*(e,t){let r=yield*Yt(t),n=t.choices[e].title,o=De(r,r.tick,r.successColor),s=De(r,r.ellipsis,r.mutedColor);return(VT(o,s,t,r)??o)+" "+rt(r.colors,n,r.submittedColor)+`
78
+ `});var S7=(e,t)=>e===0?y(j.NextFrame({state:t.length-1})):y(j.NextFrame({state:e-1})),E7=(e,t)=>e===t.length-1?y(j.NextFrame({state:0})):y(j.NextFrame({state:e+1})),b7=(e,t)=>y(j.NextFrame({state:(e+1)%t.length}));var I7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>x7(n,e),Submit:()=>y7(t,e)});var C7=e=>L(function*(t,r){let o=yield*(yield*Gn).columns,s=yield*Yt(e),a=ya+"\x1B[G",i=VT(s.prefix,s.pointerSmall,e,s,{plain:!0}),c=tB(t,e,s,{plain:!0});return Qu(eB(i,c),o)+a});var T7=e=>(t,r)=>{switch(t.key.name){case"k":case"up":return S7(r,e.choices);case"j":case"down":return E7(r,e.choices);case"tab":return b7(r,e.choices);case"enter":case"return":{let n=e.choices[r];return n.disabled?y(j.Beep()):y(j.Submit({value:n.value}))}default:return y(j.Beep())}};var w7=L(function*(e,t){let n=yield*(yield*Gn).columns,o=yield*Yt(t),s=ya+"\x1B[G",a=rB(e,o.pointerSmall,o,{plain:!0});return HT(GT(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),n,a)+s}),k7=(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=ve(e.error)?r.errorColor:n?r.submittedColor:Do(Ni,r.primaryColor);switch(t.type){case"hidden":return"";case"password":return De(r,r.passwordMask.repeat(s.length),a);case"text":return rt(r.colors,s,a)}},rB=(e,t,r,n)=>ve(e.error)?_f(e.error.value.split(Li),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return Sa(t,o.join(`
79
79
  `));let s=De(r,t,r.errorColor),a=Ft(o,i=>LT(r,i));return`\x1B[s
80
80
  `+Sa(s,a.join(`
81
- `))+"\x1B[u"}}):"",GT=(e,t,r,n,o,s,a=!1)=>{let i=k7(e,n,o,a,s);return Sn(i,n.message,t,r,o,s)},A7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=GT(e,n,o,t,r),a=tB(e,r.pointerSmall,r),i=t.type==="password"?r.passwordMask.length:1,c=(e.cursor-e.value.length)*i;return s+a+PL(c)}),v7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return GT(e,n,o,t,r,void 0,!0)+`
82
- `}),O7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return y(j.NextFrame({state:{...e,cursor:n,value:o,error:v()}}))},_7=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),P7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.cursor-1;return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},F7=e=>{if(e.cursor>=e.value.length)return y(j.Beep());let t=Math.min(e.cursor+1,e.value.length);return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},$L=e=>y(j.NextFrame({state:{...e,cursor:0,error:v()}})),NL=e=>y(j.NextFrame({state:{...e,cursor:e.value.length,error:v()}})),R7=(e,t)=>{if(e.value===t.default)return y(j.Beep());let r=e.value.length===0?t.default:e.value;return y(j.NextFrame({state:{...e,value:r,cursor:r.length,error:v()}}))},$7=(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 y(j.NextFrame({state:{...t,cursor:s,value:o,error:v()}}))},N7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>A7(n,e),Submit:()=>v7(t,e)}),M7=e=>(t,r)=>{if(t.key.ctrl)switch(t.key.name){case"u":return _7(r);case"a":return $L(r);case"e":return NL(r);default:return y(j.Beep())}switch(t.key.name){case"backspace":return O7(r);case"left":return P7(r);case"right":return F7(r);case"home":return $L(r);case"end":return NL(r);case"enter":case"return":{let n=r.value;return Zs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,value:n,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}case"tab":return R7(r,e);default:return $7(bt(t.input,()=>""),r)}},U7=e=>(t,r)=>w7(t,e),rB=(e,t)=>{let r={default:"",type:t,validate:y,...e},n={cursor:r.default.length,value:r.default,error:v()};return Ui(n,{render:N7(r),process:M7(r),clear:U7(r)})},D7=L(function*(e){let r=yield*(yield*Gn).columns,n=yield*Yt(e),o=ya+"\x1B[G",s=e.active+" "+Sa(n.toggleSeparator,e.inactive),a=Sn(s,e.message,n.prefix,n.pointerSmall,n,{plain:!0});return Qu(a,r)+o}),nB=(e,t,r,n=!1)=>{let o=De(r,r.toggleSeparator,r.mutedColor),s=Do(Ni,n?r.submittedColor:r.primaryColor),a=e?t.inactive:rt(r.colors,t.inactive,s);return(e?rt(r.colors,t.active,s):t.active)+" "+Sa(o,a)},L7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=nB(e,t,r),a=Sn(s,t.message,n,o,r);return rd+a}),B7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=nB(e,t,r,!0);return Sn(s,t.message,n,o,r)+`
83
- `}),ML=y(j.NextFrame({state:!0})),UL=y(j.NextFrame({state:!1})),j7=e=>(t,r)=>{switch(r._tag){case"Beep":return y(Di);case"NextFrame":return L7(t,e);case"Submit":return B7(t,e)}},z7=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return UL;case"1":case"k":case"left":case"up":return ML;case" ":case"tab":return t?UL:ML;case"enter":case"return":return y(j.Submit({value:t}));default:return y(j.Beep())}},q7=(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 oB="~effect/cli/Param",Xt="argument",Tt="flag",sd={[oB]:{_A:F},pipe(){return re(this,arguments)}},xx=e=>A(e,oB);var ji=e=>e.kind==="flag",cr=e=>{let t=r=>e.kind===Xt?W7(e.name,e.primitiveType,r):V7(e.name,e.primitiveType,r);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??v(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},sd)},yx=(e,t)=>cr({name:t,primitiveType:yL,kind:e}),sB=(e,t)=>cr({name:t,primitiveType:mL,kind:e}),Sx=(e,t)=>cr({name:t,primitiveType:gL,kind:e}),Ex=(e,t)=>cr({name:t,primitiveType:hL,kind:e}),bx=(e,t)=>cr({name:t,primitiveType:xL,kind:e}),ad=(e,t,r)=>cr({name:t,primitiveType:SL(r),kind:e}),Ix=(e,t,r)=>{let n=r.map(o=>[o,o]);return ad(e,t,n)},Xu=(e,t,r)=>cr({name:t,kind:e,primitiveType:EL(r?.pathType??"either",r?.mustExist),typeName:r?.typeName}),Cx=(e,t,r)=>Xu(e,t,{pathType:"directory",typeName:"directory",mustExist:r?.mustExist}),Tx=(e,t,r)=>Xu(e,t,{pathType:"file",typeName:"file",mustExist:r?.mustExist}),wx=(e,t)=>cr({name:t,primitiveType:bL,kind:e}),kx=(e,t)=>cr({name:t,primitiveType:TT,kind:e}),Ax=(e,t,r)=>cr({name:t,primitiveType:wT(r),kind:e}),vx=(e,t,r,n)=>cr({name:t,primitiveType:IL(r,n),kind:e}),aB=(e,t)=>zi(Wi(cr({name:t,primitiveType:CL,kind:e}),{min:1}),r=>Object.fromEntries(r.flatMap(Object.entries))),Ox=e=>cr({name:"__never__",primitiveType:TL,kind:e}),H7=/^-+/,iB=d(2,(e,t)=>Os(e,r=>cr({...r,aliases:[...r.aliases,t.replace(H7,"")]}))),_x=d(2,(e,t)=>Os(e,r=>cr({...r,description:R(t)}))),cB=e=>Os(e,t=>cr({...t,hidden:!0})),zi=d(2,(e,t)=>{let r=n=>ne(e.parse(n),([o,s])=>[o,t(s)]);return Object.assign(Object.create(sd),{_tag:"Map",kind:e.kind,param:e,f:t,parse:r})}),qi=(e,t,r=[])=>{let n=r.map(o=>()=>o().parse);return Object.assign(Object.create(sd),{_tag:"Transform",kind:e.kind,param:e,alternatives:r,f:t,parse:t(e.parse,n)})},Hi=d(2,(e,t)=>qi(e,r=>n=>B(r(n),([o,s])=>t(s).pipe(ne(a=>[o,a]))))),Px=d(3,(e,t,r)=>{let n=ef(e);return qi(e,o=>s=>B(o(s),([a,i])=>ht({try:()=>t(i),catch:c=>r(c)}).pipe(kt(c=>new gr({option:n.name,value:globalThis.String(i),expected:c,kind:n.kind})),ne(c=>[a,c]))))}),Bi=e=>{let t=r=>e.parse(r).pipe(ne(([n,o])=>[n,R(o)]),KE({MissingOption:()=>y([r.arguments,v()]),MissingArgument:()=>y([r.arguments,v()])}));return Object.assign(Object.create(sd),{_tag:"Optional",kind:e.kind,param:e,parse:t})},Fx=d(2,(e,t)=>wr(t)?Hi(Bi(e),Re({onNone:()=>t,onSome:y})):zi(Bi(e),bt(()=>t))),Rx=d(2,(e,t)=>{let r=(o,s)=>new gr({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),n=(o,s)=>eL(t).pipe(kt(a=>r(o,a)),B(Re({onNone:()=>C(o),onSome:a=>y([s.arguments,a])})));return qi(e,o=>s=>o(s).pipe(ns(["MissingOption","MissingArgument"],a=>n(a,s))))}),$x=d(2,(e,t)=>{let r=(n,o)=>B(LL(t)?y(t):t,xr).pipe(ne(s=>[o.arguments,s]),ns("QuitError",()=>C(n)));return qi(e,n=>o=>n(o).pipe(ns(["MissingOption","MissingArgument"],s=>r(s,o))))}),Wi=(e,t)=>{let r=ef(e),n=o=>r.kind==="argument"?G7(e,r,o,t):K7(e,r,o,t);return Object.assign(Object.create(sd),{_tag:"Variadic",kind:e.kind,param:e,min:Ns(t?.min),max:Ns(t?.max),parse:n})},Nx=d(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 Wi(e,{min:t,max:r})}),Mx=d(2,(e,t)=>{if(t<0)throw new Error("atMost: max must be non-negative");return Wi(e,{max:t})}),Ux=d(2,(e,t)=>{if(t<0)throw new Error("atLeast: min must be non-negative");return Wi(e,{min:t})}),id=d(3,(e,t,r)=>Hi(e,L(function*(n){let o=t(n);if(ve(o))return o.value;let s=ef(e);return yield*new gr({option:s.name,value:globalThis.String(n),expected:r(n),kind:s.kind})}))),Dx=d(3,(e,t,r)=>id(e,hk(t),r)),Lx=d(2,(e,t)=>Os(e,r=>cr({...r,typeName:t}))),Bx=d(2,(e,t)=>{let r=bs(t);return Hi(e,n=>kt(r(n),o=>{let s=ef(e);return new gr({option:s.name,value:globalThis.String(n),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),jx=d(2,(e,t)=>qi(e,(r,n)=>o=>_n(r(o),()=>n[0]()(o)),[t])),zx=d(2,(e,t)=>qi(e,(r,n)=>o=>_n(ne(r(o),([s,a])=>[s,H(a)]),()=>ne(n[0]()(o),([s,a])=>[s,Z(a)])),[t])),W7=L(function*(e,t,r){if(r.arguments.length===0)return yield*new Ku({argument:e});let n=r.arguments[0],o=yield*kt(t.parse(n),s=>new gr({option:e,value:n,expected:s,kind:"argument"}));return[r.arguments.slice(1),o]}),V7=L(function*(e,t,r){let n=r.flags[e];if(n===void 0||n.length===0)return yield*new Gu({option:e});let o=n[0],s=yield*kt(t.parse(o),a=>new gr({option:e,value:o,expected:a,kind:"flag"}));return[r.arguments,s]}),G7=L(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[f,u]=yield*e.parse({flags:r.flags,arguments:c});o.push(u),c=f,i++}return i<s?yield*i===0?new Ku({argument:t.name}):new gr({option:t.name,value:`${i} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind}):[c,o]}),K7=L(function*(e,t,r,n){let o=[],a=[t.name,...t.aliases].flatMap(c=>r.flags[c]??[]),i=a.length;if(pt(n?.min)&&i<n.min)return yield*i===0?new Gu({option:t.name}):new gr({option:t.name,value:`${i} occurrences`,expected:`at least ${n.min} value${n.min===1?"":"s"}`,kind:t.kind});if(pt(n?.max)&&i>n.max)return yield*new gr({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[,f]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(f)}return[r.arguments,o]}),KT=(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)}},Os=(e,t)=>KT(e,{Single:r=>t(r),Map:r=>zi(Os(r.param,t),r.f),Transform:r=>qi(Os(r.param,t),r.f,r.alternatives.map(n=>()=>Os(n(),t))),Optional:r=>Bi(Os(r.param,t)),Variadic:r=>Wi(Os(r.param,t),{min:tr(r.min),max:tr(r.max)})}),nt=e=>KT(e,{Single:t=>[t],Map:t=>nt(t.param),Transform:t=>[...nt(t.param),...t.alternatives.flatMap(r=>nt(r()))],Optional:t=>nt(t.param),Variadic:t=>nt(t.param)}),ef=e=>{let t=nt(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]},Nr=e=>KT(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:v(),variadicMax:v()}),Map:t=>Nr(t.param),Transform:t=>Nr(t.param),Optional:t=>({...Nr(t.param),isOptional:!0}),Variadic:t=>({...Nr(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var J7=e=>yx(Xt,e),Z7=e=>Sx(Xt,e),Q7=(e,t)=>Tx(Xt,e,t),Y7=(e,t)=>Cx(Xt,e,t),X7=e=>Ex(Xt,e),eX=e=>bx(Xt,e),tX=(e,t)=>Ix(Xt,e,t),rX=(e,t)=>Xu(Xt,e,t),nX=e=>wx(Xt,e),oX=e=>kx(Xt,e),sX=(e,t)=>Ax(Xt,e,t),aX=(e,t,r)=>vx(Xt,e,t,r),iX=Ox(Xt),cX=e=>Bi(e),uX=d(2,(e,t)=>_x(e,t)),fX=Fx,lX=d(2,(e,t)=>Rx(e,t)),pX=d(2,(e,t)=>$x(e,t)),dX=d(e=>xx(e[0]),(e,t)=>Wi(e,t)),mX=d(2,(e,t)=>zi(e,t)),hX=d(2,(e,t)=>Hi(e,t)),gX=d(3,(e,t,r)=>Px(e,t,r)),xX=d(2,(e,t)=>Ux(e,t)),yX=d(2,(e,t)=>Mx(e,t)),SX=d(3,(e,t,r)=>Nx(e,t,r)),EX=d(2,(e,t)=>Bx(e,t)),bX=(e,t)=>ad(Xt,e,t),IX=d(2,(e,t)=>Lx(e,t)),CX=d(3,(e,t,r)=>Dx(e,t,r)),TX=d(3,(e,t,r)=>id(e,t,r)),wX=d(2,(e,t)=>jx(e,t)),kX=d(2,(e,t)=>zx(e,t));var tf=ge("effect/cli/CliOutput",{defaultValue:()=>AX()});var Hx=e=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,t=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),AX=e=>{let t=e?.colors??mx(),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=>NX(a,r),formatCliError:a=>Hx(a.message),formatError:a=>`
81
+ `))+"\x1B[u"}}):"",GT=(e,t,r,n,o,s,a=!1)=>{let i=k7(e,n,o,a,s);return Sn(i,n.message,t,r,o,s)},A7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=GT(e,n,o,t,r),a=rB(e,r.pointerSmall,r),i=t.type==="password"?r.passwordMask.length:1,c=(e.cursor-e.value.length)*i;return s+a+FL(c)}),v7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return GT(e,n,o,t,r,void 0,!0)+`
82
+ `}),O7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return y(j.NextFrame({state:{...e,cursor:n,value:o,error:v()}}))},_7=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),P7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.cursor-1;return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},F7=e=>{if(e.cursor>=e.value.length)return y(j.Beep());let t=Math.min(e.cursor+1,e.value.length);return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},NL=e=>y(j.NextFrame({state:{...e,cursor:0,error:v()}})),ML=e=>y(j.NextFrame({state:{...e,cursor:e.value.length,error:v()}})),R7=(e,t)=>{if(e.value===t.default)return y(j.Beep());let r=e.value.length===0?t.default:e.value;return y(j.NextFrame({state:{...e,value:r,cursor:r.length,error:v()}}))},$7=(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 y(j.NextFrame({state:{...t,cursor:s,value:o,error:v()}}))},N7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Di),NextFrame:({state:n})=>A7(n,e),Submit:()=>v7(t,e)}),M7=e=>(t,r)=>{if(t.key.ctrl)switch(t.key.name){case"u":return _7(r);case"a":return NL(r);case"e":return ML(r);default:return y(j.Beep())}switch(t.key.name){case"backspace":return O7(r);case"left":return P7(r);case"right":return F7(r);case"home":return NL(r);case"end":return ML(r);case"enter":case"return":{let n=r.value;return Zs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,value:n,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}case"tab":return R7(r,e);default:return $7(bt(t.input,()=>""),r)}},U7=e=>(t,r)=>w7(t,e),nB=(e,t)=>{let r={default:"",type:t,validate:y,...e},n={cursor:r.default.length,value:r.default,error:v()};return Ui(n,{render:N7(r),process:M7(r),clear:U7(r)})},D7=L(function*(e){let r=yield*(yield*Gn).columns,n=yield*Yt(e),o=ya+"\x1B[G",s=e.active+" "+Sa(n.toggleSeparator,e.inactive),a=Sn(s,e.message,n.prefix,n.pointerSmall,n,{plain:!0});return Qu(a,r)+o}),oB=(e,t,r,n=!1)=>{let o=De(r,r.toggleSeparator,r.mutedColor),s=Do(Ni,n?r.submittedColor:r.primaryColor),a=e?t.inactive:rt(r.colors,t.inactive,s);return(e?rt(r.colors,t.active,s):t.active)+" "+Sa(o,a)},L7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=oB(e,t,r),a=Sn(s,t.message,n,o,r);return rd+a}),B7=L(function*(e,t){let r=yield*Yt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=oB(e,t,r,!0);return Sn(s,t.message,n,o,r)+`
83
+ `}),UL=y(j.NextFrame({state:!0})),DL=y(j.NextFrame({state:!1})),j7=e=>(t,r)=>{switch(r._tag){case"Beep":return y(Di);case"NextFrame":return L7(t,e);case"Submit":return B7(t,e)}},z7=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return DL;case"1":case"k":case"left":case"up":return UL;case" ":case"tab":return t?DL:UL;case"enter":case"return":return y(j.Submit({value:t}));default:return y(j.Beep())}},q7=(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 sB="~effect/cli/Param",Xt="argument",Tt="flag",sd={[sB]:{_A:F},pipe(){return re(this,arguments)}},xx=e=>A(e,sB);var ji=e=>e.kind==="flag",cr=e=>{let t=r=>e.kind===Xt?W7(e.name,e.primitiveType,r):V7(e.name,e.primitiveType,r);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??v(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},sd)},yx=(e,t)=>cr({name:t,primitiveType:SL,kind:e}),aB=(e,t)=>cr({name:t,primitiveType:hL,kind:e}),Sx=(e,t)=>cr({name:t,primitiveType:xL,kind:e}),Ex=(e,t)=>cr({name:t,primitiveType:gL,kind:e}),bx=(e,t)=>cr({name:t,primitiveType:yL,kind:e}),ad=(e,t,r)=>cr({name:t,primitiveType:EL(r),kind:e}),Ix=(e,t,r)=>{let n=r.map(o=>[o,o]);return ad(e,t,n)},Xu=(e,t,r)=>cr({name:t,kind:e,primitiveType:bL(r?.pathType??"either",r?.mustExist),typeName:r?.typeName}),Cx=(e,t,r)=>Xu(e,t,{pathType:"directory",typeName:"directory",mustExist:r?.mustExist}),Tx=(e,t,r)=>Xu(e,t,{pathType:"file",typeName:"file",mustExist:r?.mustExist}),wx=(e,t)=>cr({name:t,primitiveType:IL,kind:e}),kx=(e,t)=>cr({name:t,primitiveType:TT,kind:e}),Ax=(e,t,r)=>cr({name:t,primitiveType:wT(r),kind:e}),vx=(e,t,r,n)=>cr({name:t,primitiveType:CL(r,n),kind:e}),iB=(e,t)=>zi(Wi(cr({name:t,primitiveType:TL,kind:e}),{min:1}),r=>Object.fromEntries(r.flatMap(Object.entries))),Ox=e=>cr({name:"__never__",primitiveType:wL,kind:e}),H7=/^-+/,cB=d(2,(e,t)=>Os(e,r=>cr({...r,aliases:[...r.aliases,t.replace(H7,"")]}))),_x=d(2,(e,t)=>Os(e,r=>cr({...r,description:R(t)}))),uB=e=>Os(e,t=>cr({...t,hidden:!0})),zi=d(2,(e,t)=>{let r=n=>ne(e.parse(n),([o,s])=>[o,t(s)]);return Object.assign(Object.create(sd),{_tag:"Map",kind:e.kind,param:e,f:t,parse:r})}),qi=(e,t,r=[])=>{let n=r.map(o=>()=>o().parse);return Object.assign(Object.create(sd),{_tag:"Transform",kind:e.kind,param:e,alternatives:r,f:t,parse:t(e.parse,n)})},Hi=d(2,(e,t)=>qi(e,r=>n=>B(r(n),([o,s])=>t(s).pipe(ne(a=>[o,a]))))),Px=d(3,(e,t,r)=>{let n=ef(e);return qi(e,o=>s=>B(o(s),([a,i])=>ht({try:()=>t(i),catch:c=>r(c)}).pipe(kt(c=>new gr({option:n.name,value:globalThis.String(i),expected:c,kind:n.kind})),ne(c=>[a,c]))))}),Bi=e=>{let t=r=>e.parse(r).pipe(ne(([n,o])=>[n,R(o)]),KE({MissingOption:()=>y([r.arguments,v()]),MissingArgument:()=>y([r.arguments,v()])}));return Object.assign(Object.create(sd),{_tag:"Optional",kind:e.kind,param:e,parse:t})},Fx=d(2,(e,t)=>wr(t)?Hi(Bi(e),Re({onNone:()=>t,onSome:y})):zi(Bi(e),bt(()=>t))),Rx=d(2,(e,t)=>{let r=(o,s)=>new gr({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),n=(o,s)=>tL(t).pipe(kt(a=>r(o,a)),B(Re({onNone:()=>C(o),onSome:a=>y([s.arguments,a])})));return qi(e,o=>s=>o(s).pipe(ns(["MissingOption","MissingArgument"],a=>n(a,s))))}),$x=d(2,(e,t)=>{let r=(n,o)=>B(BL(t)?y(t):t,xr).pipe(ne(s=>[o.arguments,s]),ns("QuitError",()=>C(n)));return qi(e,n=>o=>n(o).pipe(ns(["MissingOption","MissingArgument"],s=>r(s,o))))}),Wi=(e,t)=>{let r=ef(e),n=o=>r.kind==="argument"?G7(e,r,o,t):K7(e,r,o,t);return Object.assign(Object.create(sd),{_tag:"Variadic",kind:e.kind,param:e,min:Ns(t?.min),max:Ns(t?.max),parse:n})},Nx=d(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 Wi(e,{min:t,max:r})}),Mx=d(2,(e,t)=>{if(t<0)throw new Error("atMost: max must be non-negative");return Wi(e,{max:t})}),Ux=d(2,(e,t)=>{if(t<0)throw new Error("atLeast: min must be non-negative");return Wi(e,{min:t})}),id=d(3,(e,t,r)=>Hi(e,L(function*(n){let o=t(n);if(ve(o))return o.value;let s=ef(e);return yield*new gr({option:s.name,value:globalThis.String(n),expected:r(n),kind:s.kind})}))),Dx=d(3,(e,t,r)=>id(e,gk(t),r)),Lx=d(2,(e,t)=>Os(e,r=>cr({...r,typeName:t}))),Bx=d(2,(e,t)=>{let r=bs(t);return Hi(e,n=>kt(r(n),o=>{let s=ef(e);return new gr({option:s.name,value:globalThis.String(n),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),jx=d(2,(e,t)=>qi(e,(r,n)=>o=>_n(r(o),()=>n[0]()(o)),[t])),zx=d(2,(e,t)=>qi(e,(r,n)=>o=>_n(ne(r(o),([s,a])=>[s,H(a)]),()=>ne(n[0]()(o),([s,a])=>[s,Z(a)])),[t])),W7=L(function*(e,t,r){if(r.arguments.length===0)return yield*new Ku({argument:e});let n=r.arguments[0],o=yield*kt(t.parse(n),s=>new gr({option:e,value:n,expected:s,kind:"argument"}));return[r.arguments.slice(1),o]}),V7=L(function*(e,t,r){let n=r.flags[e];if(n===void 0||n.length===0)return yield*new Gu({option:e});let o=n[0],s=yield*kt(t.parse(o),a=>new gr({option:e,value:o,expected:a,kind:"flag"}));return[r.arguments,s]}),G7=L(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[f,u]=yield*e.parse({flags:r.flags,arguments:c});o.push(u),c=f,i++}return i<s?yield*i===0?new Ku({argument:t.name}):new gr({option:t.name,value:`${i} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind}):[c,o]}),K7=L(function*(e,t,r,n){let o=[],a=[t.name,...t.aliases].flatMap(c=>r.flags[c]??[]),i=a.length;if(pt(n?.min)&&i<n.min)return yield*i===0?new Gu({option:t.name}):new gr({option:t.name,value:`${i} occurrences`,expected:`at least ${n.min} value${n.min===1?"":"s"}`,kind:t.kind});if(pt(n?.max)&&i>n.max)return yield*new gr({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[,f]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(f)}return[r.arguments,o]}),KT=(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)}},Os=(e,t)=>KT(e,{Single:r=>t(r),Map:r=>zi(Os(r.param,t),r.f),Transform:r=>qi(Os(r.param,t),r.f,r.alternatives.map(n=>()=>Os(n(),t))),Optional:r=>Bi(Os(r.param,t)),Variadic:r=>Wi(Os(r.param,t),{min:tr(r.min),max:tr(r.max)})}),nt=e=>KT(e,{Single:t=>[t],Map:t=>nt(t.param),Transform:t=>[...nt(t.param),...t.alternatives.flatMap(r=>nt(r()))],Optional:t=>nt(t.param),Variadic:t=>nt(t.param)}),ef=e=>{let t=nt(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]},Nr=e=>KT(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:v(),variadicMax:v()}),Map:t=>Nr(t.param),Transform:t=>Nr(t.param),Optional:t=>({...Nr(t.param),isOptional:!0}),Variadic:t=>({...Nr(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var J7=e=>yx(Xt,e),Z7=e=>Sx(Xt,e),Q7=(e,t)=>Tx(Xt,e,t),Y7=(e,t)=>Cx(Xt,e,t),X7=e=>Ex(Xt,e),eX=e=>bx(Xt,e),tX=(e,t)=>Ix(Xt,e,t),rX=(e,t)=>Xu(Xt,e,t),nX=e=>wx(Xt,e),oX=e=>kx(Xt,e),sX=(e,t)=>Ax(Xt,e,t),aX=(e,t,r)=>vx(Xt,e,t,r),iX=Ox(Xt),cX=e=>Bi(e),uX=d(2,(e,t)=>_x(e,t)),fX=Fx,lX=d(2,(e,t)=>Rx(e,t)),pX=d(2,(e,t)=>$x(e,t)),dX=d(e=>xx(e[0]),(e,t)=>Wi(e,t)),mX=d(2,(e,t)=>zi(e,t)),hX=d(2,(e,t)=>Hi(e,t)),gX=d(3,(e,t,r)=>Px(e,t,r)),xX=d(2,(e,t)=>Ux(e,t)),yX=d(2,(e,t)=>Mx(e,t)),SX=d(3,(e,t,r)=>Nx(e,t,r)),EX=d(2,(e,t)=>Bx(e,t)),bX=(e,t)=>ad(Xt,e,t),IX=d(2,(e,t)=>Lx(e,t)),CX=d(3,(e,t,r)=>Dx(e,t,r)),TX=d(3,(e,t,r)=>id(e,t,r)),wX=d(2,(e,t)=>jx(e,t)),kX=d(2,(e,t)=>zx(e,t));var tf=ge("effect/cli/CliOutput",{defaultValue:()=>AX()});var Hx=e=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,t=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),AX=e=>{let t=e?.colors??mx(),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=>NX(a,r),formatCliError:a=>Hx(a.message),formatError:a=>`
84
84
  ${s}${o}ERROR${n}
85
85
  ${Hx(a.message)}${n}`,formatErrors:a=>{if(a.length===0)return"";if(a.length===1)return`
86
86
  ${s}${o}ERROR${n}
87
87
  ${Hx(a[0].message)}${n}`;let i=new Map;for(let f of a){let u=f._tag??"Error",l=i.get(u)??[];l.push(f),i.set(u,l)}let c=[];c.push(`
88
88
  ${s}${o}ERRORS${n}`);for(let[,f]of i)for(let u of f)c.push(` ${Hx(u.message)}${n}`);return c.join(`
89
89
  `)},formatVersion:(a,i)=>`${r.bold(a)} ${r.dim("v")}${r.bold(i)}`}},vX=e=>e.replace(/\u001B\[[0-9;]*m/g,""),OX=new Intl.Segmenter(void 0,{granularity:"grapheme"}),_X=/[\p{Mark}\p{Control}\p{Default_Ignorable_Code_Point}]/gu,PX=new RegExp("\\p{Emoji_Presentation}","u"),FX=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,RX=e=>{let t=e.replace(_X,"");return t.length===0?0:PX.test(e)||e.includes("\uFE0F")||FX(t.codePointAt(0))?2:1},JT=e=>{let t=0;for(let{segment:r}of OX.segment(vX(e)))t+=RX(r);return t},$X=(e,t)=>{let r=JT(e),n=Math.max(0,t-r);return e+" ".repeat(n)},cd=(e,t)=>{let r=Math.max(...e.map(o=>JT(o.left)))+4,n=t===void 0?r:Math.min(r,t);return e.map(({left:o,right:s})=>` ${$X(o,Math.max(n,JT(o)+1))}${s}`).join(`
90
- `)},uB=(e,t)=>t?`${e}, ${t}`:e,NX=(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}`,f=o.required?"":t.dim(" (optional)"),u=bt(o.description,()=>"")+f;return{left:c,right:u}});r.push(cd(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:bt(o.description,()=>"")}});r.push(cd(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:bt(o.description,()=>"")}});r.push(cd(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(cd(n.commands.map(o=>({left:t.cyan(uB(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(cd(o.commands.map(s=>({left:t.cyan(uB(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(`
91
- `)};var ud=e=>e.replace(/'/g,"'\\''"),QT=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),YT=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},MX=(e,t)=>{if(e.length===0)return;let r=e.map(YT);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("")},UX=(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("")},fB=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map(r=>`'${ud(r)}'`).join(" ")}`,DX=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return fB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},LX=(e,t)=>{switch(e._tag){case"Choice":return fB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},lB=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(QT).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(c=>c.type._tag!=="Boolean");if(a.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of a){let f=[`--${c.name}`];for(let l of c.aliases)f.push(l.length===1?`-${l}`:`--${l}`);let u=DX(c.type,n);u&&(r.push(` ${f.join("|")})`),r.push(` ${u}`),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(c.type._tag==="Boolean")continue;let f=YT(c);r.push(` ${f.join("|")}) _skip_next=1 ;;`),r.push(` ${f.map(u=>`${u}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let f=`_${[...o,c.name].map(QT).join("_")}`;r.push(` ${c.name})`),r.push(` ${f} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}MX(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,f)=>{let u=LX(c.type,n);return u===void 0?[]:[{argument:c,completion:u,index:f}]});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 f of e.flags){let u=YT(f);f.type._tag==="Boolean"?r.push(` ${u.join("|")}) ;;`):(r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map(l=>`${l}=*`).join("|")}) ;;`))}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:f,completion:u,index:l}of i)f.variadic||(r.push(` ${l})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;"));r.push(" esac");let c=i.find(({argument:f})=>f.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(f=>f.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)lB(c,o,r,n)},pB=(e,t)=>{let r=[],n=QT(e),o=`_${n}--choices`;return r.push(`###-begin-${ud(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${ud(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(""),UX(o,r),lB(t,[],r,o),r.push(`complete -F _${n} ${ud(e)}`),r.push(`###-end-${ud(e)}-completions-###`),r.join(`
92
- `)};var Ea=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),dB=e=>Ea(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),jX=(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},XT=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(" ")}`},zX=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return`begin; ${XT(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},qX=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 '${Ea(e.description)}'`);let r=HX(e.type);return r&&t.push(r),t},HX=e=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(dB).join(" ")}'`;case"Path":return e.pathType==="directory","-r -F";default:return"-r -f"}},WX=e=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(dB).join(" ")}'`;case"Path":return"-r -F";default:return}},mB=(e,t,r,n)=>{let o=t.subcommands.map(c=>c.name),s=jX(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 f=[`complete -c ${e}`];a&&f.push(a),f.push(`-f -a '${Ea(c.name)}'`),c.description&&f.push(`-d '${Ea(c.description)}'`),n.push(f.join(" "))}for(let c of t.flags){let f=c.type._tag==="Boolean",u=f?XT(c):zX(c),l=s?`${s}; and ${u}`:u,p=l?`-n '${l}'`:"",h=[`complete -c ${e}`];if(p&&h.push(p),h.push(...qX(c)),n.push(h.join(" ")),f){let g=[`complete -c ${e}`];p&&g.push(p),g.push(`-l no-${c.name}`),c.description&&g.push(`-d '${Ea(`Disable ${c.name}`)}'`),n.push(g.join(" "))}}if(t.flags.length>0){let c='not string match -q -- "-*" (commandline -ct)',f=s?`${s}; and ${c}`:c;for(let u of t.flags){let l=`${f}; and ${XT(u)}`,p=u.type._tag==="Boolean",h=[`complete -c ${e}`];if(h.push(`-n '${l}'`),h.push(`-f -a '--${u.name}'`),u.description&&h.push(`-d '${Ea(u.description)}'`),n.push(h.join(" ")),p){let g=[`complete -c ${e}`];g.push(`-n '${l}'`),g.push(`-f -a '--no-${u.name}'`),u.description&&g.push(`-d '${Ea(`Disable ${u.name}`)}'`),n.push(g.join(" "))}}}for(let c of t.arguments){let f=WX(c.type);if(f){let u=[`complete -c ${e}`];a&&u.push(a),u.push(f),c.description&&u.push(`-d '${Ea(c.description)}'`),n.push(u.join(" "))}}for(let c of t.subcommands)mB(e,c,[...r,c.name],n)},hB=(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(""),mB(e,t,[],r),r.push(""),r.push(`###-end-${e}-completions-###`),r.join(`
93
- `)};var ba=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(" + ")})`},gB=e=>`@(${e.map(ba).join(", ")})`,tw=e=>e?ba(e):"$null",GX=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),KX=e=>[`--${e.name}`,...e.aliases.map(t=>t.length===1?`-${t}`:`--${t}`)],xB=e=>`values = ${gB(e._tag==="Choice"?e.values:[])}; pathType = ${e._tag==="Path"?ba(e.pathType):"$null"}`,JX=e=>`@{ name = ${ba(e.name)}; forms = ${gB(KX(e))}; takesValue = $${e.type._tag!=="Boolean"}; ${xB(e.type)}; description = ${tw(e.description)} }`,ZX=e=>`@{ name = ${ba(e.name)}; variadic = $${e.variadic}; ${xB(e.type)}; description = ${tw(e.description)} }`,ew=(e,t,r)=>{if(r.length===0){e.push(` ${t} = @()`);return}e.push(` ${t} = @(`);for(let n of r)e.push(` ${n}`);e.push(" )")},yB=(e,t,r,n,o)=>{let s=r.join(" ");if(!o.has(s)){o.add(s),n.push(`${e}[${ba(s)}] = @{`),ew(n,"subcommands",t.subcommands.map(a=>`@{ name = ${ba(a.name)}; description = ${tw(a.description)} }`)),ew(n,"flags",t.flags.map(JX)),ew(n,"arguments",t.arguments.map(ZX)),n.push("}");for(let a of t.subcommands)yB(e,a,[...r,a.name],n,o)}},QX=e=>String.raw` param($wordToComplete, $commandAst, $cursorPosition)
90
+ `)},fB=(e,t)=>t?`${e}, ${t}`:e,NX=(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}`,f=o.required?"":t.dim(" (optional)"),u=bt(o.description,()=>"")+f;return{left:c,right:u}});r.push(cd(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:bt(o.description,()=>"")}});r.push(cd(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:bt(o.description,()=>"")}});r.push(cd(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(cd(n.commands.map(o=>({left:t.cyan(fB(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(cd(o.commands.map(s=>({left:t.cyan(fB(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(`
91
+ `)};var ud=e=>e.replace(/'/g,"'\\''"),QT=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),YT=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},MX=(e,t)=>{if(e.length===0)return;let r=e.map(YT);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("")},UX=(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("")},lB=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map(r=>`'${ud(r)}'`).join(" ")}`,DX=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return lB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},LX=(e,t)=>{switch(e._tag){case"Choice":return lB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},pB=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(QT).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(c=>c.type._tag!=="Boolean");if(a.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of a){let f=[`--${c.name}`];for(let l of c.aliases)f.push(l.length===1?`-${l}`:`--${l}`);let u=DX(c.type,n);u&&(r.push(` ${f.join("|")})`),r.push(` ${u}`),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(c.type._tag==="Boolean")continue;let f=YT(c);r.push(` ${f.join("|")}) _skip_next=1 ;;`),r.push(` ${f.map(u=>`${u}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let f=`_${[...o,c.name].map(QT).join("_")}`;r.push(` ${c.name})`),r.push(` ${f} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}MX(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,f)=>{let u=LX(c.type,n);return u===void 0?[]:[{argument:c,completion:u,index:f}]});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 f of e.flags){let u=YT(f);f.type._tag==="Boolean"?r.push(` ${u.join("|")}) ;;`):(r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map(l=>`${l}=*`).join("|")}) ;;`))}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:f,completion:u,index:l}of i)f.variadic||(r.push(` ${l})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;"));r.push(" esac");let c=i.find(({argument:f})=>f.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(f=>f.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)pB(c,o,r,n)},dB=(e,t)=>{let r=[],n=QT(e),o=`_${n}--choices`;return r.push(`###-begin-${ud(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${ud(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(""),UX(o,r),pB(t,[],r,o),r.push(`complete -F _${n} ${ud(e)}`),r.push(`###-end-${ud(e)}-completions-###`),r.join(`
92
+ `)};var Ea=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),mB=e=>Ea(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),jX=(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},XT=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(" ")}`},zX=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return`begin; ${XT(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},qX=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 '${Ea(e.description)}'`);let r=HX(e.type);return r&&t.push(r),t},HX=e=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(mB).join(" ")}'`;case"Path":return e.pathType==="directory","-r -F";default:return"-r -f"}},WX=e=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(mB).join(" ")}'`;case"Path":return"-r -F";default:return}},hB=(e,t,r,n)=>{let o=t.subcommands.map(c=>c.name),s=jX(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 f=[`complete -c ${e}`];a&&f.push(a),f.push(`-f -a '${Ea(c.name)}'`),c.description&&f.push(`-d '${Ea(c.description)}'`),n.push(f.join(" "))}for(let c of t.flags){let f=c.type._tag==="Boolean",u=f?XT(c):zX(c),l=s?`${s}; and ${u}`:u,p=l?`-n '${l}'`:"",h=[`complete -c ${e}`];if(p&&h.push(p),h.push(...qX(c)),n.push(h.join(" ")),f){let g=[`complete -c ${e}`];p&&g.push(p),g.push(`-l no-${c.name}`),c.description&&g.push(`-d '${Ea(`Disable ${c.name}`)}'`),n.push(g.join(" "))}}if(t.flags.length>0){let c='not string match -q -- "-*" (commandline -ct)',f=s?`${s}; and ${c}`:c;for(let u of t.flags){let l=`${f}; and ${XT(u)}`,p=u.type._tag==="Boolean",h=[`complete -c ${e}`];if(h.push(`-n '${l}'`),h.push(`-f -a '--${u.name}'`),u.description&&h.push(`-d '${Ea(u.description)}'`),n.push(h.join(" ")),p){let g=[`complete -c ${e}`];g.push(`-n '${l}'`),g.push(`-f -a '--no-${u.name}'`),u.description&&g.push(`-d '${Ea(`Disable ${u.name}`)}'`),n.push(g.join(" "))}}}for(let c of t.arguments){let f=WX(c.type);if(f){let u=[`complete -c ${e}`];a&&u.push(a),u.push(f),c.description&&u.push(`-d '${Ea(c.description)}'`),n.push(u.join(" "))}}for(let c of t.subcommands)hB(e,c,[...r,c.name],n)},gB=(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(""),hB(e,t,[],r),r.push(""),r.push(`###-end-${e}-completions-###`),r.join(`
93
+ `)};var ba=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(" + ")})`},xB=e=>`@(${e.map(ba).join(", ")})`,tw=e=>e?ba(e):"$null",GX=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),KX=e=>[`--${e.name}`,...e.aliases.map(t=>t.length===1?`-${t}`:`--${t}`)],yB=e=>`values = ${xB(e._tag==="Choice"?e.values:[])}; pathType = ${e._tag==="Path"?ba(e.pathType):"$null"}`,JX=e=>`@{ name = ${ba(e.name)}; forms = ${xB(KX(e))}; takesValue = $${e.type._tag!=="Boolean"}; ${yB(e.type)}; description = ${tw(e.description)} }`,ZX=e=>`@{ name = ${ba(e.name)}; variadic = $${e.variadic}; ${yB(e.type)}; description = ${tw(e.description)} }`,ew=(e,t,r)=>{if(r.length===0){e.push(` ${t} = @()`);return}e.push(` ${t} = @(`);for(let n of r)e.push(` ${n}`);e.push(" )")},SB=(e,t,r,n,o)=>{let s=r.join(" ");if(!o.has(s)){o.add(s),n.push(`${e}[${ba(s)}] = @{`),ew(n,"subcommands",t.subcommands.map(a=>`@{ name = ${ba(a.name)}; description = ${tw(a.description)} }`)),ew(n,"flags",t.flags.map(JX)),ew(n,"arguments",t.arguments.map(ZX)),n.push("}");for(let a of t.subcommands)SB(e,a,[...r,a.name],n,o)}},QX=e=>String.raw` param($wordToComplete, $commandAst, $cursorPosition)
94
94
 
95
95
  $spec = ${e}
96
96
  $results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
@@ -273,17 +273,17 @@ ${s}${o}ERRORS${n}`);for(let[,f]of i)for(let u of f)c.push(` ${Hx(u.message)}${
273
273
  if (-not $endOfOptions) {
274
274
  & $addFlags $typed
275
275
  }
276
- return $results`,SB=(e,t)=>{let r=`$global:_${GX(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)`),yB(r,t,[],n,new Set),n.push(""),n.push(`Register-ArgumentCompleter -Native -CommandName ${ba(e)} -ScriptBlock {`),n.push(QX(r)),n.push("}"),n.push(""),n.push(`###-end-${e}-completions-###`),n.join(`
277
- `)};var nw=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),EB=e=>nw(e).replace(/]/g,"\\]"),CB=e=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),rw=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),XX=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},eee=e=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(CB).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:"}},tee=e=>{switch(e._tag){case"Choice":return`(${e.values.map(CB).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},bB=e=>{let t=[],r=e.description?`[${EB(e.description)}]`:"",n=eee(e.type),o=`(${XX(e).join(" ")})`;t.push(`'${o}--${e.name}${r}${n}'`);for(let s of e.aliases){let a=s.length===1?"-":"--";t.push(`'${o}${a}${s}${r}${n}'`)}if(e.type._tag==="Boolean"){let s=e.description?`[${EB(`Disable ${e.name}`)}]`:"";t.push(`'${o}--no-${e.name}${s}'`)}return t},IB=e=>{let t=e.description?nw(e.description):e.name,r=tee(e.type);return`'${e.variadic?"*":""}:${t}:${r}'`},TB=(e,t,r)=>{let n=[...t,e.name],o=`_${n.map(rw).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?nw(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 bB(s))r.push(` ${a}`);if(e.arguments.length>0){r.push(" -"),r.push(" parent-arguments");for(let s of e.arguments)r.push(` ${IB(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(rw).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(...bB(a));for(let a of e.arguments)s.push(IB(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)TB(s,n,r)},wB=(e,t)=>{let r=[],n=rw(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(""),TB(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 kB=(e,t,r)=>{switch(t){case"bash":return pB(e,r);case"zsh":return wB(e,r);case"fish":return hB(e,r);case"powershell":return SB(e,r)}};var rf={};En(rf,{Boolean:()=>fd,ChoiceWithValue:()=>Wx,Date:()=>aee,Directory:()=>fee,File:()=>uee,FileParse:()=>dee,FileSchema:()=>mee,FileText:()=>pee,Finite:()=>see,Int:()=>oee,KeyValuePair:()=>hee,Literals:()=>iee,Never:()=>gee,Path:()=>cee,Redacted:()=>lee,String:()=>nee,atLeast:()=>Cee,atMost:()=>Tee,between:()=>wee,filter:()=>Aee,filterMap:()=>kee,map:()=>Eee,mapEffect:()=>bee,mapTryCatch:()=>Iee,optional:()=>Kx,orElse:()=>vee,orElseResult:()=>Oee,withAlias:()=>Vx,withDefault:()=>ld,withDescription:()=>Vi,withFallbackConfig:()=>yee,withFallbackPrompt:()=>See,withHidden:()=>xee,withMetavar:()=>Gx,withSchema:()=>_ee});var nee=e=>yx(Tt,e),fd=e=>sB(Tt,e),oee=e=>Sx(Tt,e),see=e=>Ex(Tt,e),aee=e=>bx(Tt,e),Wx=(e,t)=>ad(Tt,e,t),iee=(e,t)=>Ix(Tt,e,t),cee=(e,t)=>Xu(Tt,e,t),uee=(e,t)=>Tx(Tt,e,t),fee=(e,t)=>Cx(Tt,e,t),lee=e=>wx(Tt,e),pee=e=>kx(Tt,e),dee=(e,t)=>Ax(Tt,e,t),mee=(e,t,r)=>vx(Tt,e,t,r),hee=e=>aB(Tt,e),gee=Ox(Tt),Vx=d(2,(e,t)=>iB(e,t)),Vi=d(2,(e,t)=>_x(e,t)),Gx=d(2,(e,t)=>Lx(e,t)),xee=e=>cB(e),Kx=e=>Bi(e),ld=Fx,yee=d(2,(e,t)=>Rx(e,t)),See=d(2,(e,t)=>$x(e,t)),Eee=d(2,(e,t)=>zi(e,t)),bee=d(2,(e,t)=>Hi(e,t)),Iee=d(3,(e,t,r)=>Px(e,t,r)),Cee=d(2,(e,t)=>Ux(e,t)),Tee=d(2,(e,t)=>Mx(e,t)),wee=d(3,(e,t,r)=>Nx(e,t,r)),kee=d(3,(e,t,r)=>id(e,t,r)),Aee=d(3,(e,t,r)=>Dx(e,t,r)),vee=d(2,(e,t)=>jx(e,t)),Oee=d(2,(e,t)=>zx(e,t)),_ee=d(2,(e,t)=>Bx(e,t));var Jx="~effect/cli/Command/Config/Internal",Zx=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(xx(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{[Jx]:Jx,flags:r,arguments:n,orderedParams:t,tree:o(e)}},vB=Zx({}),OB=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(r=>OB(r,t))};case"Nested":return{_tag:"Nested",tree:_B(e.tree,t)}}},_B=(e,t)=>{let r=Object.create(null);for(let n of Object.keys(e))r[n]=OB(e[n],t);return r},ow=(e,t)=>{let r=e.orderedParams.length;return{[Jx]:Jx,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,_B(t.tree,r))}},sw=(e,t)=>{let r={};for(let o of Object.keys(e))U(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 sw(o.tree,t)}}};var pd="~effect/cli/Command",Pe=e=>e,Pee={...ao({label:"Command",evaluate(){return Pe(this).service}})},Mr=e=>{let t=e.config,r=e.contextConfig??vB,n=e.service??Ye(`${pd}/${e.name}`),o=e.annotations??fr(),s=e.globalFlags??[],a=e.subcommands??[],i=(l,p)=>pt(e.handle)?e.handle(l,p):C(new ks({commandPath:p,errors:[]})),c=e.parse??Qx(t),f=e.parseContext??Qx(r,{allowLeftovers:!0}),u=l=>{let p=[],h=[];for(let T of t.arguments){let w=nt(T),P=Nr(T);for(let O of w)p.push({name:O.name,type:O.typeName??td(O.primitiveType),description:O.description,required:!P.isOptional&&(!P.isVariadic||gk(P.variadicMin,m=>m>0)),variadic:P.isVariadic})}let g=l.length>0?l.join(" "):e.name;a.some(T=>T.commands.some(w=>!w.unlisted))&&(g+=" <subcommand>"),g+=" [flags]";for(let T of p){let w=T.variadic?`<${T.name}...>`:`<${T.name}>`;g+=` ${T.required?w:`[${w}]`}`}for(let T of t.flags){let w=nt(T),P=Nr(T);for(let O of w)O.hidden||h.push(Yx(O,P))}let x=[];for(let T of a){let w=T.commands.filter(P=>!P.unlisted);w.length!==0&&x.push({group:T.group,commands:Ft(w,P=>({name:P.name,alias:P.alias,shortDescription:P.shortDescription,description:P.description??""}))})}let b=e.examples??[];return{description:e.description??"",usage:g,flags:h,annotations:o,...p.length>0&&{args:p},...x.length>0&&{subcommands:x},...b.length>0&&{examples:b}}};return Object.assign(Object.create(Pee),{[pd]:pd,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:f,handle:i,buildHelpDoc:u,...pt(e.description)?{description:e.description}:{},...pt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...pt(e.alias)?{alias:e.alias}:{}})},Yx=(e,t)=>{let r=e.aliases.map(n=>n.length===1?`-${n}`:`--${n}`);return{name:e.name,aliases:r,type:e.typeName??td(e.primitiveType),description:Fee(e.description,As(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},Fee=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return Re(e,{onNone:()=>R(r),onSome:n=>R(`${n} ${r}`)})},Qx=(e,t)=>L(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*Ree(n,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new Zp({arguments:o}):sw(e.tree,s)}),Ree=L(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]}),aw=(e,t,r)=>{let n=Pe(e),o=new Set;(a=>{for(let i of a){let c=nt(i);for(let f of c)o.add(f.name)}})((r?.contextConfig??n.contextConfig).flags);for(let a of t){let i=Pe(a);for(let c of i.config.flags){let f=nt(c);for(let u of f)if(o.has(u.name))throw new Jp({option:u.name,parentCommand:e.name,childCommand:a.name})}}};var $ee=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:As(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:kT(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},Nee=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:As(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:kT(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},iw=(e,t=[])=>{let r=Pe(e),n=r.config,o=[],s=new Set;for(let[f,u]of[...n.flags,...t].entries()){let l=nt(u);for(let p of l)p.kind==="flag"&&(p.hidden||f>=n.flags.length&&s.has(p.name)||(s.add(p.name),o.push({name:p.name,aliases:p.aliases,description:tr(p.description),type:$ee(p)})))}let a=[];for(let f of n.arguments){let u=nt(f),l=Nr(f);for(let p of u)p.kind==="argument"&&a.push({name:p.name,description:tr(p.description),required:!l.isOptional,variadic:l.isVariadic,type:Nee(p)})}let i=[],c=[...t,...r.contextConfig.flags];for(let f of e.subcommands)for(let u of f.commands){if(u.unlisted)continue;let l=iw(u,c);i.push(l),u.alias&&u.alias!==u.name&&i.push({...l,name:u.alias})}return{name:e.name,description:e.shortDescription??e.description,flags:o,arguments:a,subcommands:i}};var cw=e=>{let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r},PB=(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},uw=(e,t,r)=>{let o=PB(e,t).flatMap(s=>Pe(s).globalFlags);return cw([...r,...o])},Uee=e=>{let t=[],r=n=>{let o=Pe(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),cw(t)},Dee=(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=Pe(o);for(let a of s.contextConfig.flags){let i=nt(a),c=Nr(a);for(let f of i)r.has(f.name)||f.hidden||(r.add(f.name),n.push(Yx(f,c)))}}return n},FB=(e,t)=>cw([...t,...Uee(e)]),Xx=(e,t,r)=>Dt(function*(){let n=PB(e,t),o=n.length>0?n[n.length-1]:e,s=Pe(o).buildHelpDoc(t),a=Dee(n,s.flags),i=uw(e,t,r),c=[];for(let f of i){let u=nt(f.flag),l=Nr(f.flag);for(let p of u)p.hidden||c.push({...Yx(p,l),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var ey=e=>({_tag:"Action",flag:e.flag,run:e.run}),Bee=e=>t=>{RB+=1;let r=Ye(`effect/cli/GlobalFlag/${e}/${RB}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},RB=0,jee=ey({flag:fd("help").pipe(Vx("h"),Vi("Show help information"),ld(!1)),run:L(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*tf,s=yield*Xx(r,n,t);yield*Qt(o.formatHelpDoc(s))})}),zee=ey({flag:fd("version").pipe(Vx("v"),Vi("Show version information"),ld(!1)),run:L(function*(e,{command:t,version:r}){let n=yield*tf;yield*Qt(n.formatVersion(t.name,r))})}),fw=ey({flag:fd("wizard").pipe(Vi("Start wizard mode for a command"),ld(!1)),run:()=>xe}),qee=ey({flag:Wx("completions",[["bash","bash"],["zsh","zsh"],["fish","fish"],["powershell","powershell"],["sh","bash"],["pwsh","powershell"]]).pipe(Kx,Gx("<bash|zsh|fish|powershell|sh|pwsh>"),Vi("Print shell completion script")),run:L(function*(e,{command:t}){if(Ke(e))return;let r=iw(t);yield*Qt(kB(t.name,e.value,r))})}),nf=Bee("log-level")({flag:Wx("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(Kx,Vi("Sets the minimum log level"),Gx("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),$B=[jee,zee,fw,qee,nf];var dd=class extends ge("effect/cli/CliConfig",{defaultValue:()=>Hee}){},Hee={builtIns:$B};var af={};En(af,{annotate:()=>Ate,annotateMerge:()=>vte,isCommand:()=>Sw,make:()=>xte,provide:()=>_te,provideEffect:()=>Fte,provideEffectDiscard:()=>Rte,provideSync:()=>Pte,run:()=>Dte,runWith:()=>Ew,unlisted:()=>kte,withAlias:()=>wte,withDescription:()=>Cte,withExamples:()=>Ote,withGlobalFlags:()=>Ite,withHandler:()=>yte,withSharedFlags:()=>bte,withShortDescription:()=>Tte,withSubcommands:()=>Ete,wizard:()=>$te});function UB(e){let t=e.indexOf("--");return t===-1?{tokens:MB(e),trailingOperands:[]}:{tokens:MB(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var Wee=/^-(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,MB=e=>{let t=[];for(let r of e)if(!r.startsWith("-")||Wee.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 Gee=(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]},pw=(e,t)=>{let r=t.map(o=>[Gee(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 mw=e=>Re(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...mw(t.parsedInput)]}),hw=(e,t,r=[])=>Dt(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],a=Pe(t),c=a.config.flags.flatMap(nt).filter(ji),f=sf(c),l=a.contextConfig.flags.flatMap(nt).filter(ji),p=sf(l),h=new Set(l.map(P=>P.name)),g={command:t,commandPath:s,flagRegistry:f,inheritedFlagRegistry:p,localFlagNames:c.filter(P=>!h.has(P.name)).map(P=>P.name)},x=ate(n,g);if(x._tag==="Leaf")return{flags:x.flags,arguments:[...x.arguments,...o],subcommand:v(),...x.errors.length>0&&{errors:x.errors}};let b={tokens:x.childTokens,trailingOperands:o},T=yield*hw(b,x.sub,s),w=[...x.errors,...T.errors??[]];return{flags:x.flags,arguments:[],subcommand:R({name:x.sub.name,parsedInput:T}),...w.length>0&&{errors:w}}}),ty=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},sf=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}},BB=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},gw=e=>Object.fromEntries(e.map(t=>[t.name,[]])),Kee=e=>{let t=gw(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}},ry=e=>e._tag==="LongOption"||e._tag==="ShortOption",jB=e=>e._tag==="LongOption"?e.name:e.flag,of=(e,t)=>{let r=jB(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&&fx(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1}},DB=(e,t,r)=>new gr({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),Jee=e=>{let t=As(e.primitiveType);return new gr({option:e.name,value:"",expected:t===void 0?e.typeName??td(e.primitiveType):t.join(" | "),kind:"flag"})},LB=e=>e?._tag==="Value"&&(pL(e.value)||dL(e.value))?e.value:void 0,zB=(e,t,r,n=!1)=>{let o=md(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},md=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:DB(t,r,t.value),tokens:[]};let s=LB(e.peek());if(s!==void 0){let a=e.take();return{_tag:"Error",error:DB(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(fx(r.primitiveType)){let s=LB(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:Jee(r),tokens:[]}},Zee=(e,t)=>{let r=gw(t.params),n=[],o=[],s=ty(e);for(let a=s.take();a;a=s.take()){if(!ry(a)){n.push(a);continue}let i=of(a,t);if(!i){n.push(a);continue}let c=zB(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}},Qee=e=>Pe(e).config.flags.flatMap(nt).filter(ji),Yee=e=>Pe(e).contextConfig.flags.flatMap(nt).filter(ji),qB=(e,t)=>{for(let r of t){let n=of(e,r);if(n!==void 0)return n}},dw=(e,t,r,n)=>{e.push(r);let o=md(t,r,n.param,n.negated);e.push(...o.tokens)},Xee=(e,t,r,n,o)=>{let s=ty(t);md(s,e,r.param,r.negated);for(let a=s.take();a;a=s.take()){if(ry(a)){let i=qB(a,o);i!==void 0&&md(s,a,i.param,i.negated);continue}if(a._tag==="Value")return n.has(a.value)}return!1},HB=(e,t,r)=>{let n=gw(r.params),o=[],s=(a,i,c)=>{let f=sf(Qee(i)),u=sf(Yee(i)),l=BB(i.subcommands),p=ty(a),h=[],g=!0;for(let x=p.take();x;x=p.take()){if(ry(x)){let b=qB(x,c);if(b!==void 0){dw(h,p,x,b);continue}let T=of(x,u);if(T!==void 0){dw(h,p,x,T);continue}let w=of(x,f),P=of(x,r);if(w!==void 0&&(P===void 0||!g||!Xee(x,p.rest(),w,l,[f,u,r]))){dw(h,p,x,w);continue}if(P!==void 0){let O=md(p,x,P.param,P.negated);if(O._tag==="Error"){o.push(O.error);continue}O.value!==void 0&&n[P.param.name].push(O.value);continue}h.push(x);continue}if(x._tag==="Value"&&g){let b=l.get(x.value);if(b!==void 0)return h.push(x),h.push(...s(p.rest(),b,[...c,u])),h;g=!1}h.push(x)}return h};return{flagMap:n,remainder:s(e,t,[]),errors:o}},ete=(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),fx(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=pw(jB(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new xa({option:n,suggestions:s,command:r})},tte=e=>({flags:Kee(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),rte=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),nte=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=r,c=BB(o.subcommands),f=c.get(e);if(f){let l=[...s,f.name],p=n.flags.snapshot();for(let g of i){let x=p[g];x!==void 0&&x.length>0&&n.errors.push(new xa({option:`--${g}`,suggestions:[],command:l}))}let h=Zee(t.rest(),a);return n.flags.merge(h.flagMap),n.errors.push(...h.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:f,childTokens:h.remainder,errors:n.errors}}}if(!(Pe(o).config.arguments.length>0)&&c.size>0){let l=[];for(let[h,g]of c)g.unlisted||l.push(h);let p=pw(e,l);n.errors.push(new Qp({subcommand:e,parent:s,suggestions:p}))}return{_tag:"Argument"}},ote=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,a=of(e,s);if(!a){n.errors.push(ete(e,s.params,o));return}let i=zB(t,e,a.param,a.negated);if(i._tag==="Error"){n.errors.push(i.error);return}n.flags.add(a.param.name,i.value)},ste=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=nte(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e)},ate=(e,t)=>{let r=ty(e),n=tte(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(ry(o)){ote(o,r,t,n);continue}if(o._tag==="Value"){let s=ste(o.value,r,t,n);if(s)return s}}return rte(n)};var yw=L(function*(e,t){let r=t?.commandPath??[e.name],n=cte(e,r),o=(t?.prefix??r).map(a=>Jn(a)),{colors:s}=yield*od;return yield*ny(o,s),yield*GB(n,o,n===e?"ROOT":n.name,s),{args:o.map(a=>a.value),displayArgs:o.map(a=>a.displayValue)}}),cte=(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},GB=L(function*(e,t,r,n){let o=Pe(e),s=e.subcommands.flatMap(c=>c.commands.filter(f=>!f.unlisted)),a=s.length===0?o.config:o.contextConfig;if(a.flags.length>0){yield*Qt(VB(r,"FLAGS",n));for(let c of a.flags)t.push(...yield*WB(c));(a.arguments.length>0||s.length>0)&&(yield*ny(t,n))}if(a.arguments.length>0){yield*Qt(VB(r,"ARGUMENTS",n));for(let c of a.arguments)t.push(...yield*WB(c));s.length>0&&(yield*ny(t,n))}if(s.length===0)return;let i=yield*xr(zT({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*Qt(),t.push(Jn(i.name)),ute(i)&&(yield*ny(t,n)),yield*GB(i,t,i.name,n)}),ute=e=>e.subcommands.some(r=>r.commands.some(n=>!n.unlisted))||Pe(e).config.orderedParams.length>0,WB=L(function*(e){let t=ef(e),r=Nr(e);if(r.isOptional&&!(yield*xr(BT({message:`Set ${xw(t)}?`,initial:!1}))))return yield*Qt(),[];let n=r.isVariadic?yield*xr(jT({message:`${xw(t)} count`,default:bt(r.variadicMin,()=>0),min:bt(r.variadicMin,()=>0),...ve(r.variadicMax)?{max:r.variadicMax.value}:{}})):1,o=[];for(let a=0;a<n;a++)o.push(yield*fte(t));let s=t.kind===Tt?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Qt(),t.kind===Xt?o:o.flatMap(a=>a.value.startsWith("-")&&a.value.length>1?[Jn(`--${t.name}=${a.value}`,`--${t.name}=${a.displayValue}`)]:[Jn(`--${t.name}`),a])}),fte=e=>{let t=pte(e);switch(e.primitiveType._tag){case"Boolean":return ne(xr(BT({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),r=>Jn(String(r)));case"Choice":{let r=As(e.primitiveType)??[];return ne(xr(zT({message:t,choices:r.map(n=>({title:n,value:n}))})),Jn)}case"Date":return ne(xr(jL({message:t})),r=>Jn(r.toISOString()));case"Finite":return ne(xr(zL({message:t})),r=>Jn(String(r)));case"Int":return ne(xr(jT({message:t})),r=>Jn(String(r)));case"Redacted":return ne(xr(qL({message:t})),r=>Jn(ca(r),"<redacted>"));default:return ne(xr(HL({message:t})),Jn)}},Jn=(e,t=e)=>({value:e,displayValue:t}),lte=e=>e.kind===Tt?`--${e.name}`:e.name,pte=e=>xw(e),xw=e=>{let t=tr(e.description)?.trim(),r=e.kind===Tt&&t!==void 0&&t.length<=32?t:dte(e.name);return e.kind===Tt?`${r} (${lte(e)})`:r},dte=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(" ")},ny=(e,t)=>Qt(QB("Current command",e.map(r=>r.displayValue),t,vL)),VB=(e,t,r)=>`${rt(r,e.toUpperCase(),vs,Zu)} ${rt(r,"\xB7",nd)} ${rt(r,t,vs,Mi)}`,KB=(e,t,r,n)=>[`${rt(n,e,vs,Zu)} ${rt(n,`v${t}`,Mi)} ${rt(n,"\xB7 Command wizard",vs,Mi)}`,...r===void 0||r.length===0?[]:[r],rt(n,"Build a command interactively. Press Ctrl+C to cancel.",nd),""].join(`
279
- `),JB=(e,t)=>QB("Command ready",e,t,Zu,dx),ZB=e=>`
280
- ${rt(e,"Wizard cancelled.",px)}`,QB=(e,t,r,n,o=Mi)=>{let s=mte(t);return[rt(r,e,vs,o),...s.map(a=>rt(r,a,n)),""].join(`
281
- `)},mte=e=>{let r=" $ ",n=" ",o=e.map(hte),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},hte=e=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var Sw=e=>A(e,pd),xte=(e,t,r)=>{let n=Zx(t??{});return Mr({name:e,config:n,...pt(r)?{handle:r}:{}})},yte=d(2,(e,t)=>Mr({...Pe(e),handle:t})),Ste=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(Sw(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}},Ete=d(2,(e,t)=>{let r=Ste(t);aw(e,r.flat);let n=Pe(e),o=new Map(r.flat.map(c=>[c.name,Pe(c)])),s=Symbol("effect/cli/SubcommandState"),a=L(function*(c){if(Ke(c.subcommand))return yield*n.parse(c);let f=o.get(c.subcommand.value.name);if(!f)return yield*n.parse(c);let u=yield*n.parseContext(c),l=yield*f.parse(c.subcommand.value.parsedInput);return{...u,[s]:{name:f.name,result:l}}}),i=L(function*(c,f){let l=c[s];if(l){let p=o.get(l.name);return p?yield*p.handle(l.result,[...f,p.name]).pipe(Io(n.service,c)):yield*new ks({commandPath:f,errors:[]})}return yield*n.handle(c,f)});return Mr({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})}),bte=d(2,(e,t)=>{let r=Pe(e),n=Zx(t),o=ow(r.config,n),s=ow(r.contextConfig,n);if(r.subcommands.length>0){let u=r.subcommands.flatMap(l=>l.commands);aw(e,u,{contextConfig:s})}let a=Qx(n,{allowLeftovers:!0}),i=L(function*(u){let l=yield*r.parse(u),p=yield*a(u);return{...l,...p}}),c=L(function*(u){let l=yield*r.parseContext(u),p=yield*a(u);return{...l,...p}}),f=(u,l)=>r.handle(u,l);return Mr({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:f})}),Ite=d(2,(e,t)=>{let r=Pe(e),n=Array.from(new Set([...r.globalFlags,...t]));return Mr({...r,globalFlags:n})}),Cte=d(2,(e,t)=>Mr({...Pe(e),description:t})),Tte=d(2,(e,t)=>Mr({...Pe(e),shortDescription:t})),wte=d(2,(e,t)=>Mr({...Pe(e),alias:t})),kte=e=>Mr({...Pe(e),unlisted:!0}),Ate=d(3,(e,t,r)=>{let n=Pe(e);return Mr({...n,annotations:rr(n.annotations,t,r)})}),vte=d(2,(e,t)=>{let r=Pe(e);return Mr({...r,annotations:Na(r.annotations,t)})}),Ote=d(2,(e,t)=>Mr({...Pe(e),examples:t})),oy=(e,t)=>{let r=Pe(e);return Mr({...r,handle:(n,o)=>t(r.handle(n,o),n)})},_te=d(e=>Sw(e[0]),(e,t,r)=>oy(e,(n,o)=>YE(n,typeof t=="function"?t(o):t,r))),Pte=d(3,(e,t,r)=>oy(e,(n,o)=>Io(n,t,typeof r=="function"?r(o):r))),Fte=d(3,(e,t,r)=>oy(e,(n,o)=>XE(n,t,typeof r=="function"?r(o):r))),Rte=d(2,(e,t)=>oy(e,(r,n)=>rs(typeof t=="function"?t(n):t,r))),$te=(e,t)=>ne(yw(e,t),r=>r.args),Nte=(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=nt(i.flag);for(let f of c){let u=r[f.name];if(!u||u.length===0)continue;let l=`--${f.name}`;a.has(l)||(a.add(l),s.push(new xa({option:l,suggestions:[],command:n})))}}return s},Mte=(e,t,r)=>Dt(function*(){let{builtIns:n}=yield*dd,o=yield*tf,s=yield*Xx(e,t.commandPath,n);yield*Qt(o.formatHelpDoc(s)),r&&t.errors.length>0&&(yield*cx(o.formatErrors(t.errors)))}),Ute=e=>Dt(function*(){let t=yield*tf;yield*cx(t.formatError(e)),e[Ys]=!1}),Dte=d(2,(e,t)=>Xh.use(({args:r})=>B(r,n=>Ew(e,t)(n)))),Ew=(e,t)=>{let r=Pe(e);return L(function*(n){let{builtIns:o}=yield*dd,{tokens:s,trailingOperands:a}=UB(n),i=FB(e,o),c=i.flatMap(E=>nt(E.flag)),f=sf(c.filter(ji)),{flagMap:u,remainder:l,errors:p}=HB(s,e,f),h={flags:u,arguments:[]},g=yield*hw({tokens:l,trailingOperands:a},e),x=[e.name,...mw(g)],b={builtIns:o,command:e,commandPath:x,version:t.version},T=uw(e,x,o),w=Nte(i,T,u,x);if(w.length>0||p.length>0){let E=g.errors??[];return yield*new ks({commandPath:x,errors:[...p,...w,...E]})}for(let E of T){if(E._tag!=="Action"||!nt(E.flag).some(M=>{let z=u[M.name];return z!==void 0&&z.length>0}))continue;let[,_]=yield*E.flag.parse(h);if(E===fw){let{colors:M}=yield*od;return yield*Dt(function*(){yield*Qt(KB(e.name,t.version,e.description,M));let z=[e.name,...n.filter(be=>be!=="--wizard"&&!be.startsWith("--wizard="))],de=yield*yw(e,{commandPath:x,prefix:z});yield*Qt(JB(de.displayArgs,M)),(yield*xr(WL({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))&&(yield*Qt(),yield*Ew(e,{...t,renderErrors:!1})(de.args.slice(1)))}).pipe(ns("QuitError",()=>Qt(ZB(M))))}yield*E.run(_,b);return}if(g.errors&&g.errors.length>0)return yield*new ks({commandPath:x,errors:g.errors});let P=yield*VE(r.parse(g));if(P._tag==="Failure")return yield*new ks({commandPath:x,errors:[P.failure]});let O=r.handle(P.success,[e.name]),m=T.includes(nf)?(yield*nf.flag.parse(h))[1]:v();O=Io(O,nf,m);for(let E of T){if(E._tag!=="Setting"||E===nf)continue;let[,I]=yield*E.flag.parse(h);O=Io(O,E,I)}let S=Re(m,{onNone:()=>fr(),onSome:E=>Go(o_,E)});yield*ss(O,S)},Il(n=>mT(n)&&n._tag==="ShowHelp"?H(n):Z(n),n=>rs(Mte(e,n,t.renderErrors!==!1),C(n))),Il(n=>t.renderErrors!==!1&&mT(n)&&n._tag==="UserError"?H(n):Z(n),n=>rs(Ute(n),C(n))),Il(n=>j2(n)?H(n):Z(n),n=>ei))};import{Buffer as tj}from"node:buffer";import{randomBytes as jte}from"node:crypto";import{basename as zte,dirname as qte,join as iy,resolve as Hte}from"node:path";var Lte=Ee.decodeUnknownSync(Ee.fromJsonString(Ee.Record(Ee.String,Ee.Unknown)));function sy(e){return e.replaceAll(/[.-]/gu,"_").replace(/^[^a-z]/u,"app_$&").slice(0,58)}function YB(e,t,r){return e==="package.json"?`${JSON.stringify({...Lte(t),name:r},null," ")}
282
- `:e===".env.example"?t.replaceAll("starter_dev",`${sy(r)}_dev`).replaceAll("starter_test",`${sy(r)}_test`):["AGENTS.md","README.md"].includes(e)?t.replaceAll("{{appName}}",r):t}var _s=class extends po.TaggedError("CreateAppError"){[ri.errorReported]=!1};function ay(e,t,r=!1){return te.flatMap(Su.ChildProcessSpawner,n=>n.exitCode(hi.make("git",t,{cwd:e,stderr:r?"inherit":"pipe",stdout:r?"inherit":"pipe"})))}var bw=te.fn("CreateApp.checkedGit")(function*(e,t){let r=yield*ay(e,t,!0);if(r!==0)return yield*new _s({message:`git ${t.join(" ")} failed (exit ${r}). The generated files remain in ${e}.`})}),XB=te.fn("CreateApp.initializeGit")(function*(e){return(yield*ay(e,["--version"]).pipe(te.catch(r=>r.reason._tag==="NotFound"?te.succeed(-1):te.fail(r))))!==0||(yield*ay(e,["rev-parse","--git-dir"]))===0?!1:(yield*bw(e,["init","--initial-branch=main"]),!0)}),ej=te.fn("CreateApp.commitGit")(function*(e){let r=(yield*ay(e,["-c","user.useConfigOnly=true","var","GIT_AUTHOR_IDENT"]))===0?[]:["-c","user.name=Create App","-c","user.email=create-app@localhost"];yield*bw(e,["add","--all"]),yield*bw(e,[...r,"commit","-m","Initialize a generated app"])});var hd=Ee.Record(Ee.String,Ee.String),Iw=Ee.Array(Ee.Struct({content:Ee.String,path:Ee.String})),Qde=Ee.decodeUnknownSync(Ee.fromJsonString(Iw)),Bte=Ee.Struct({dependencies:hd,devDependencies:hd,engines:hd,imports:hd,name:Ee.String,packageManager:Ee.String,private:Ee.Boolean,scripts:hd,type:Ee.String,version:Ee.String}),Yde=Ee.decodeUnknownSync(Ee.fromJsonString(Bte));var rj=te.fn("CreateApp.createApp")(function*(e,t,r){let n=yield*us.FileSystem,o=Hte(e),s=zte(o);if(!/^[a-z0-9][a-z0-9._-]*$/u.test(s)||s.length>214||["node_modules","favicon.ico"].includes(s))return yield*new _s({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 _s({message:`Refusing to write into ${e}: the destination must be an empty folder.`});let a=yield*Ee.decodeUnknownEffect(Ee.fromJsonString(Iw))(yield*n.readFileString(t));yield*n.makeDirectory(o,{recursive:!0});for(let p of a){let h=iy(o,p.path),g=tj.from(p.content,"base64"),x=yield*te.try({catch:b=>new _s({message:String(b)}),try:()=>["package.json",".env.example","AGENTS.md","README.md"].includes(p.path)?tj.from(YB(p.path,g.toString(),s)):g});yield*n.makeDirectory(qte(h),{recursive:!0}),yield*n.writeFile(h,x,{mode:420}),yield*n.chmod(h,420)}yield*n.symlink("AGENTS.md",iy(o,"CLAUDE.md"));let i=sy(s);yield*n.writeFileString(iy(o,".env.local"),`DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${i}_dev
276
+ return $results`,EB=(e,t)=>{let r=`$global:_${GX(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)`),SB(r,t,[],n,new Set),n.push(""),n.push(`Register-ArgumentCompleter -Native -CommandName ${ba(e)} -ScriptBlock {`),n.push(QX(r)),n.push("}"),n.push(""),n.push(`###-end-${e}-completions-###`),n.join(`
277
+ `)};var nw=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),bB=e=>nw(e).replace(/]/g,"\\]"),TB=e=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),rw=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),XX=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},eee=e=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(TB).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:"}},tee=e=>{switch(e._tag){case"Choice":return`(${e.values.map(TB).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},IB=e=>{let t=[],r=e.description?`[${bB(e.description)}]`:"",n=eee(e.type),o=`(${XX(e).join(" ")})`;t.push(`'${o}--${e.name}${r}${n}'`);for(let s of e.aliases){let a=s.length===1?"-":"--";t.push(`'${o}${a}${s}${r}${n}'`)}if(e.type._tag==="Boolean"){let s=e.description?`[${bB(`Disable ${e.name}`)}]`:"";t.push(`'${o}--no-${e.name}${s}'`)}return t},CB=e=>{let t=e.description?nw(e.description):e.name,r=tee(e.type);return`'${e.variadic?"*":""}:${t}:${r}'`},wB=(e,t,r)=>{let n=[...t,e.name],o=`_${n.map(rw).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?nw(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 IB(s))r.push(` ${a}`);if(e.arguments.length>0){r.push(" -"),r.push(" parent-arguments");for(let s of e.arguments)r.push(` ${CB(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(rw).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(...IB(a));for(let a of e.arguments)s.push(CB(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)wB(s,n,r)},kB=(e,t)=>{let r=[],n=rw(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(""),wB(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 AB=(e,t,r)=>{switch(t){case"bash":return dB(e,r);case"zsh":return kB(e,r);case"fish":return gB(e,r);case"powershell":return EB(e,r)}};var rf={};En(rf,{Boolean:()=>fd,ChoiceWithValue:()=>Wx,Date:()=>aee,Directory:()=>fee,File:()=>uee,FileParse:()=>dee,FileSchema:()=>mee,FileText:()=>pee,Finite:()=>see,Int:()=>oee,KeyValuePair:()=>hee,Literals:()=>iee,Never:()=>gee,Path:()=>cee,Redacted:()=>lee,String:()=>nee,atLeast:()=>Cee,atMost:()=>Tee,between:()=>wee,filter:()=>Aee,filterMap:()=>kee,map:()=>Eee,mapEffect:()=>bee,mapTryCatch:()=>Iee,optional:()=>Kx,orElse:()=>vee,orElseResult:()=>Oee,withAlias:()=>Vx,withDefault:()=>ld,withDescription:()=>Vi,withFallbackConfig:()=>yee,withFallbackPrompt:()=>See,withHidden:()=>xee,withMetavar:()=>Gx,withSchema:()=>_ee});var nee=e=>yx(Tt,e),fd=e=>aB(Tt,e),oee=e=>Sx(Tt,e),see=e=>Ex(Tt,e),aee=e=>bx(Tt,e),Wx=(e,t)=>ad(Tt,e,t),iee=(e,t)=>Ix(Tt,e,t),cee=(e,t)=>Xu(Tt,e,t),uee=(e,t)=>Tx(Tt,e,t),fee=(e,t)=>Cx(Tt,e,t),lee=e=>wx(Tt,e),pee=e=>kx(Tt,e),dee=(e,t)=>Ax(Tt,e,t),mee=(e,t,r)=>vx(Tt,e,t,r),hee=e=>iB(Tt,e),gee=Ox(Tt),Vx=d(2,(e,t)=>cB(e,t)),Vi=d(2,(e,t)=>_x(e,t)),Gx=d(2,(e,t)=>Lx(e,t)),xee=e=>uB(e),Kx=e=>Bi(e),ld=Fx,yee=d(2,(e,t)=>Rx(e,t)),See=d(2,(e,t)=>$x(e,t)),Eee=d(2,(e,t)=>zi(e,t)),bee=d(2,(e,t)=>Hi(e,t)),Iee=d(3,(e,t,r)=>Px(e,t,r)),Cee=d(2,(e,t)=>Ux(e,t)),Tee=d(2,(e,t)=>Mx(e,t)),wee=d(3,(e,t,r)=>Nx(e,t,r)),kee=d(3,(e,t,r)=>id(e,t,r)),Aee=d(3,(e,t,r)=>Dx(e,t,r)),vee=d(2,(e,t)=>jx(e,t)),Oee=d(2,(e,t)=>zx(e,t)),_ee=d(2,(e,t)=>Bx(e,t));var Jx="~effect/cli/Command/Config/Internal",Zx=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(xx(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{[Jx]:Jx,flags:r,arguments:n,orderedParams:t,tree:o(e)}},OB=Zx({}),_B=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(r=>_B(r,t))};case"Nested":return{_tag:"Nested",tree:PB(e.tree,t)}}},PB=(e,t)=>{let r=Object.create(null);for(let n of Object.keys(e))r[n]=_B(e[n],t);return r},ow=(e,t)=>{let r=e.orderedParams.length;return{[Jx]:Jx,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,PB(t.tree,r))}},sw=(e,t)=>{let r={};for(let o of Object.keys(e))U(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 sw(o.tree,t)}}};var pd="~effect/cli/Command",Pe=e=>e,Pee={...ao({label:"Command",evaluate(){return Pe(this).service}})},Mr=e=>{let t=e.config,r=e.contextConfig??OB,n=e.service??Ye(`${pd}/${e.name}`),o=e.annotations??fr(),s=e.globalFlags??[],a=e.subcommands??[],i=(l,p)=>pt(e.handle)?e.handle(l,p):C(new ks({commandPath:p,errors:[]})),c=e.parse??Qx(t),f=e.parseContext??Qx(r,{allowLeftovers:!0}),u=l=>{let p=[],h=[];for(let T of t.arguments){let w=nt(T),P=Nr(T);for(let O of w)p.push({name:O.name,type:O.typeName??td(O.primitiveType),description:O.description,required:!P.isOptional&&(!P.isVariadic||xk(P.variadicMin,m=>m>0)),variadic:P.isVariadic})}let g=l.length>0?l.join(" "):e.name;a.some(T=>T.commands.some(w=>!w.unlisted))&&(g+=" <subcommand>"),g+=" [flags]";for(let T of p){let w=T.variadic?`<${T.name}...>`:`<${T.name}>`;g+=` ${T.required?w:`[${w}]`}`}for(let T of t.flags){let w=nt(T),P=Nr(T);for(let O of w)O.hidden||h.push(Yx(O,P))}let x=[];for(let T of a){let w=T.commands.filter(P=>!P.unlisted);w.length!==0&&x.push({group:T.group,commands:Ft(w,P=>({name:P.name,alias:P.alias,shortDescription:P.shortDescription,description:P.description??""}))})}let b=e.examples??[];return{description:e.description??"",usage:g,flags:h,annotations:o,...p.length>0&&{args:p},...x.length>0&&{subcommands:x},...b.length>0&&{examples:b}}};return Object.assign(Object.create(Pee),{[pd]:pd,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:f,handle:i,buildHelpDoc:u,...pt(e.description)?{description:e.description}:{},...pt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...pt(e.alias)?{alias:e.alias}:{}})},Yx=(e,t)=>{let r=e.aliases.map(n=>n.length===1?`-${n}`:`--${n}`);return{name:e.name,aliases:r,type:e.typeName??td(e.primitiveType),description:Fee(e.description,As(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},Fee=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return Re(e,{onNone:()=>R(r),onSome:n=>R(`${n} ${r}`)})},Qx=(e,t)=>L(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*Ree(n,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new Zp({arguments:o}):sw(e.tree,s)}),Ree=L(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]}),aw=(e,t,r)=>{let n=Pe(e),o=new Set;(a=>{for(let i of a){let c=nt(i);for(let f of c)o.add(f.name)}})((r?.contextConfig??n.contextConfig).flags);for(let a of t){let i=Pe(a);for(let c of i.config.flags){let f=nt(c);for(let u of f)if(o.has(u.name))throw new Jp({option:u.name,parentCommand:e.name,childCommand:a.name})}}};var $ee=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:As(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:kT(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},Nee=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:As(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:kT(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},iw=(e,t=[])=>{let r=Pe(e),n=r.config,o=[],s=new Set;for(let[f,u]of[...n.flags,...t].entries()){let l=nt(u);for(let p of l)p.kind==="flag"&&(p.hidden||f>=n.flags.length&&s.has(p.name)||(s.add(p.name),o.push({name:p.name,aliases:p.aliases,description:tr(p.description),type:$ee(p)})))}let a=[];for(let f of n.arguments){let u=nt(f),l=Nr(f);for(let p of u)p.kind==="argument"&&a.push({name:p.name,description:tr(p.description),required:!l.isOptional,variadic:l.isVariadic,type:Nee(p)})}let i=[],c=[...t,...r.contextConfig.flags];for(let f of e.subcommands)for(let u of f.commands){if(u.unlisted)continue;let l=iw(u,c);i.push(l),u.alias&&u.alias!==u.name&&i.push({...l,name:u.alias})}return{name:e.name,description:e.shortDescription??e.description,flags:o,arguments:a,subcommands:i}};var cw=e=>{let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r},FB=(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},uw=(e,t,r)=>{let o=FB(e,t).flatMap(s=>Pe(s).globalFlags);return cw([...r,...o])},Uee=e=>{let t=[],r=n=>{let o=Pe(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),cw(t)},Dee=(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=Pe(o);for(let a of s.contextConfig.flags){let i=nt(a),c=Nr(a);for(let f of i)r.has(f.name)||f.hidden||(r.add(f.name),n.push(Yx(f,c)))}}return n},RB=(e,t)=>cw([...t,...Uee(e)]),Xx=(e,t,r)=>Dt(function*(){let n=FB(e,t),o=n.length>0?n[n.length-1]:e,s=Pe(o).buildHelpDoc(t),a=Dee(n,s.flags),i=uw(e,t,r),c=[];for(let f of i){let u=nt(f.flag),l=Nr(f.flag);for(let p of u)p.hidden||c.push({...Yx(p,l),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var ey=e=>({_tag:"Action",flag:e.flag,run:e.run}),Bee=e=>t=>{$B+=1;let r=Ye(`effect/cli/GlobalFlag/${e}/${$B}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},$B=0,jee=ey({flag:fd("help").pipe(Vx("h"),Vi("Show help information"),ld(!1)),run:L(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*tf,s=yield*Xx(r,n,t);yield*Qt(o.formatHelpDoc(s))})}),zee=ey({flag:fd("version").pipe(Vx("v"),Vi("Show version information"),ld(!1)),run:L(function*(e,{command:t,version:r}){let n=yield*tf;yield*Qt(n.formatVersion(t.name,r))})}),fw=ey({flag:fd("wizard").pipe(Vi("Start wizard mode for a command"),ld(!1)),run:()=>xe}),qee=ey({flag:Wx("completions",[["bash","bash"],["zsh","zsh"],["fish","fish"],["powershell","powershell"],["sh","bash"],["pwsh","powershell"]]).pipe(Kx,Gx("<bash|zsh|fish|powershell|sh|pwsh>"),Vi("Print shell completion script")),run:L(function*(e,{command:t}){if(Ke(e))return;let r=iw(t);yield*Qt(AB(t.name,e.value,r))})}),nf=Bee("log-level")({flag:Wx("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(Kx,Vi("Sets the minimum log level"),Gx("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),NB=[jee,zee,fw,qee,nf];var dd=class extends ge("effect/cli/CliConfig",{defaultValue:()=>Hee}){},Hee={builtIns:NB};var af={};En(af,{annotate:()=>Ate,annotateMerge:()=>vte,isCommand:()=>Sw,make:()=>xte,provide:()=>_te,provideEffect:()=>Fte,provideEffectDiscard:()=>Rte,provideSync:()=>Pte,run:()=>Dte,runWith:()=>Ew,unlisted:()=>kte,withAlias:()=>wte,withDescription:()=>Cte,withExamples:()=>Ote,withGlobalFlags:()=>Ite,withHandler:()=>yte,withSharedFlags:()=>bte,withShortDescription:()=>Tte,withSubcommands:()=>Ete,wizard:()=>$te});function DB(e){let t=e.indexOf("--");return t===-1?{tokens:UB(e),trailingOperands:[]}:{tokens:UB(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var Wee=/^-(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,UB=e=>{let t=[];for(let r of e)if(!r.startsWith("-")||Wee.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 Gee=(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]},pw=(e,t)=>{let r=t.map(o=>[Gee(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 mw=e=>Re(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...mw(t.parsedInput)]}),hw=(e,t,r=[])=>Dt(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],a=Pe(t),c=a.config.flags.flatMap(nt).filter(ji),f=sf(c),l=a.contextConfig.flags.flatMap(nt).filter(ji),p=sf(l),h=new Set(l.map(P=>P.name)),g={command:t,commandPath:s,flagRegistry:f,inheritedFlagRegistry:p,localFlagNames:c.filter(P=>!h.has(P.name)).map(P=>P.name)},x=ate(n,g);if(x._tag==="Leaf")return{flags:x.flags,arguments:[...x.arguments,...o],subcommand:v(),...x.errors.length>0&&{errors:x.errors}};let b={tokens:x.childTokens,trailingOperands:o},T=yield*hw(b,x.sub,s),w=[...x.errors,...T.errors??[]];return{flags:x.flags,arguments:[],subcommand:R({name:x.sub.name,parsedInput:T}),...w.length>0&&{errors:w}}}),ty=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},sf=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}},jB=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},gw=e=>Object.fromEntries(e.map(t=>[t.name,[]])),Kee=e=>{let t=gw(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}},ry=e=>e._tag==="LongOption"||e._tag==="ShortOption",zB=e=>e._tag==="LongOption"?e.name:e.flag,of=(e,t)=>{let r=zB(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&&fx(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1}},LB=(e,t,r)=>new gr({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),Jee=e=>{let t=As(e.primitiveType);return new gr({option:e.name,value:"",expected:t===void 0?e.typeName??td(e.primitiveType):t.join(" | "),kind:"flag"})},BB=e=>e?._tag==="Value"&&(dL(e.value)||mL(e.value))?e.value:void 0,qB=(e,t,r,n=!1)=>{let o=md(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},md=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:LB(t,r,t.value),tokens:[]};let s=BB(e.peek());if(s!==void 0){let a=e.take();return{_tag:"Error",error:LB(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(fx(r.primitiveType)){let s=BB(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:Jee(r),tokens:[]}},Zee=(e,t)=>{let r=gw(t.params),n=[],o=[],s=ty(e);for(let a=s.take();a;a=s.take()){if(!ry(a)){n.push(a);continue}let i=of(a,t);if(!i){n.push(a);continue}let c=qB(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}},Qee=e=>Pe(e).config.flags.flatMap(nt).filter(ji),Yee=e=>Pe(e).contextConfig.flags.flatMap(nt).filter(ji),HB=(e,t)=>{for(let r of t){let n=of(e,r);if(n!==void 0)return n}},dw=(e,t,r,n)=>{e.push(r);let o=md(t,r,n.param,n.negated);e.push(...o.tokens)},Xee=(e,t,r,n,o)=>{let s=ty(t);md(s,e,r.param,r.negated);for(let a=s.take();a;a=s.take()){if(ry(a)){let i=HB(a,o);i!==void 0&&md(s,a,i.param,i.negated);continue}if(a._tag==="Value")return n.has(a.value)}return!1},WB=(e,t,r)=>{let n=gw(r.params),o=[],s=(a,i,c)=>{let f=sf(Qee(i)),u=sf(Yee(i)),l=jB(i.subcommands),p=ty(a),h=[],g=!0;for(let x=p.take();x;x=p.take()){if(ry(x)){let b=HB(x,c);if(b!==void 0){dw(h,p,x,b);continue}let T=of(x,u);if(T!==void 0){dw(h,p,x,T);continue}let w=of(x,f),P=of(x,r);if(w!==void 0&&(P===void 0||!g||!Xee(x,p.rest(),w,l,[f,u,r]))){dw(h,p,x,w);continue}if(P!==void 0){let O=md(p,x,P.param,P.negated);if(O._tag==="Error"){o.push(O.error);continue}O.value!==void 0&&n[P.param.name].push(O.value);continue}h.push(x);continue}if(x._tag==="Value"&&g){let b=l.get(x.value);if(b!==void 0)return h.push(x),h.push(...s(p.rest(),b,[...c,u])),h;g=!1}h.push(x)}return h};return{flagMap:n,remainder:s(e,t,[]),errors:o}},ete=(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),fx(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=pw(zB(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new xa({option:n,suggestions:s,command:r})},tte=e=>({flags:Kee(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),rte=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),nte=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=r,c=jB(o.subcommands),f=c.get(e);if(f){let l=[...s,f.name],p=n.flags.snapshot();for(let g of i){let x=p[g];x!==void 0&&x.length>0&&n.errors.push(new xa({option:`--${g}`,suggestions:[],command:l}))}let h=Zee(t.rest(),a);return n.flags.merge(h.flagMap),n.errors.push(...h.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:f,childTokens:h.remainder,errors:n.errors}}}if(!(Pe(o).config.arguments.length>0)&&c.size>0){let l=[];for(let[h,g]of c)g.unlisted||l.push(h);let p=pw(e,l);n.errors.push(new Qp({subcommand:e,parent:s,suggestions:p}))}return{_tag:"Argument"}},ote=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,a=of(e,s);if(!a){n.errors.push(ete(e,s.params,o));return}let i=qB(t,e,a.param,a.negated);if(i._tag==="Error"){n.errors.push(i.error);return}n.flags.add(a.param.name,i.value)},ste=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=nte(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e)},ate=(e,t)=>{let r=ty(e),n=tte(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(ry(o)){ote(o,r,t,n);continue}if(o._tag==="Value"){let s=ste(o.value,r,t,n);if(s)return s}}return rte(n)};var yw=L(function*(e,t){let r=t?.commandPath??[e.name],n=cte(e,r),o=(t?.prefix??r).map(a=>Jn(a)),{colors:s}=yield*od;return yield*ny(o,s),yield*KB(n,o,n===e?"ROOT":n.name,s),{args:o.map(a=>a.value),displayArgs:o.map(a=>a.displayValue)}}),cte=(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},KB=L(function*(e,t,r,n){let o=Pe(e),s=e.subcommands.flatMap(c=>c.commands.filter(f=>!f.unlisted)),a=s.length===0?o.config:o.contextConfig;if(a.flags.length>0){yield*Qt(GB(r,"FLAGS",n));for(let c of a.flags)t.push(...yield*VB(c));(a.arguments.length>0||s.length>0)&&(yield*ny(t,n))}if(a.arguments.length>0){yield*Qt(GB(r,"ARGUMENTS",n));for(let c of a.arguments)t.push(...yield*VB(c));s.length>0&&(yield*ny(t,n))}if(s.length===0)return;let i=yield*xr(zT({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*Qt(),t.push(Jn(i.name)),ute(i)&&(yield*ny(t,n)),yield*KB(i,t,i.name,n)}),ute=e=>e.subcommands.some(r=>r.commands.some(n=>!n.unlisted))||Pe(e).config.orderedParams.length>0,VB=L(function*(e){let t=ef(e),r=Nr(e);if(r.isOptional&&!(yield*xr(BT({message:`Set ${xw(t)}?`,initial:!1}))))return yield*Qt(),[];let n=r.isVariadic?yield*xr(jT({message:`${xw(t)} count`,default:bt(r.variadicMin,()=>0),min:bt(r.variadicMin,()=>0),...ve(r.variadicMax)?{max:r.variadicMax.value}:{}})):1,o=[];for(let a=0;a<n;a++)o.push(yield*fte(t));let s=t.kind===Tt?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Qt(),t.kind===Xt?o:o.flatMap(a=>a.value.startsWith("-")&&a.value.length>1?[Jn(`--${t.name}=${a.value}`,`--${t.name}=${a.displayValue}`)]:[Jn(`--${t.name}`),a])}),fte=e=>{let t=pte(e);switch(e.primitiveType._tag){case"Boolean":return ne(xr(BT({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),r=>Jn(String(r)));case"Choice":{let r=As(e.primitiveType)??[];return ne(xr(zT({message:t,choices:r.map(n=>({title:n,value:n}))})),Jn)}case"Date":return ne(xr(zL({message:t})),r=>Jn(r.toISOString()));case"Finite":return ne(xr(qL({message:t})),r=>Jn(String(r)));case"Int":return ne(xr(jT({message:t})),r=>Jn(String(r)));case"Redacted":return ne(xr(HL({message:t})),r=>Jn(ca(r),"<redacted>"));default:return ne(xr(WL({message:t})),Jn)}},Jn=(e,t=e)=>({value:e,displayValue:t}),lte=e=>e.kind===Tt?`--${e.name}`:e.name,pte=e=>xw(e),xw=e=>{let t=tr(e.description)?.trim(),r=e.kind===Tt&&t!==void 0&&t.length<=32?t:dte(e.name);return e.kind===Tt?`${r} (${lte(e)})`:r},dte=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(" ")},ny=(e,t)=>Qt(YB("Current command",e.map(r=>r.displayValue),t,OL)),GB=(e,t,r)=>`${rt(r,e.toUpperCase(),vs,Zu)} ${rt(r,"\xB7",nd)} ${rt(r,t,vs,Mi)}`,JB=(e,t,r,n)=>[`${rt(n,e,vs,Zu)} ${rt(n,`v${t}`,Mi)} ${rt(n,"\xB7 Command wizard",vs,Mi)}`,...r===void 0||r.length===0?[]:[r],rt(n,"Build a command interactively. Press Ctrl+C to cancel.",nd),""].join(`
279
+ `),ZB=(e,t)=>YB("Command ready",e,t,Zu,dx),QB=e=>`
280
+ ${rt(e,"Wizard cancelled.",px)}`,YB=(e,t,r,n,o=Mi)=>{let s=mte(t);return[rt(r,e,vs,o),...s.map(a=>rt(r,a,n)),""].join(`
281
+ `)},mte=e=>{let r=" $ ",n=" ",o=e.map(hte),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},hte=e=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var Sw=e=>A(e,pd),xte=(e,t,r)=>{let n=Zx(t??{});return Mr({name:e,config:n,...pt(r)?{handle:r}:{}})},yte=d(2,(e,t)=>Mr({...Pe(e),handle:t})),Ste=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(Sw(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}},Ete=d(2,(e,t)=>{let r=Ste(t);aw(e,r.flat);let n=Pe(e),o=new Map(r.flat.map(c=>[c.name,Pe(c)])),s=Symbol("effect/cli/SubcommandState"),a=L(function*(c){if(Ke(c.subcommand))return yield*n.parse(c);let f=o.get(c.subcommand.value.name);if(!f)return yield*n.parse(c);let u=yield*n.parseContext(c),l=yield*f.parse(c.subcommand.value.parsedInput);return{...u,[s]:{name:f.name,result:l}}}),i=L(function*(c,f){let l=c[s];if(l){let p=o.get(l.name);return p?yield*p.handle(l.result,[...f,p.name]).pipe(Io(n.service,c)):yield*new ks({commandPath:f,errors:[]})}return yield*n.handle(c,f)});return Mr({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})}),bte=d(2,(e,t)=>{let r=Pe(e),n=Zx(t),o=ow(r.config,n),s=ow(r.contextConfig,n);if(r.subcommands.length>0){let u=r.subcommands.flatMap(l=>l.commands);aw(e,u,{contextConfig:s})}let a=Qx(n,{allowLeftovers:!0}),i=L(function*(u){let l=yield*r.parse(u),p=yield*a(u);return{...l,...p}}),c=L(function*(u){let l=yield*r.parseContext(u),p=yield*a(u);return{...l,...p}}),f=(u,l)=>r.handle(u,l);return Mr({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:f})}),Ite=d(2,(e,t)=>{let r=Pe(e),n=Array.from(new Set([...r.globalFlags,...t]));return Mr({...r,globalFlags:n})}),Cte=d(2,(e,t)=>Mr({...Pe(e),description:t})),Tte=d(2,(e,t)=>Mr({...Pe(e),shortDescription:t})),wte=d(2,(e,t)=>Mr({...Pe(e),alias:t})),kte=e=>Mr({...Pe(e),unlisted:!0}),Ate=d(3,(e,t,r)=>{let n=Pe(e);return Mr({...n,annotations:rr(n.annotations,t,r)})}),vte=d(2,(e,t)=>{let r=Pe(e);return Mr({...r,annotations:Na(r.annotations,t)})}),Ote=d(2,(e,t)=>Mr({...Pe(e),examples:t})),oy=(e,t)=>{let r=Pe(e);return Mr({...r,handle:(n,o)=>t(r.handle(n,o),n)})},_te=d(e=>Sw(e[0]),(e,t,r)=>oy(e,(n,o)=>YE(n,typeof t=="function"?t(o):t,r))),Pte=d(3,(e,t,r)=>oy(e,(n,o)=>Io(n,t,typeof r=="function"?r(o):r))),Fte=d(3,(e,t,r)=>oy(e,(n,o)=>XE(n,t,typeof r=="function"?r(o):r))),Rte=d(2,(e,t)=>oy(e,(r,n)=>rs(typeof t=="function"?t(n):t,r))),$te=(e,t)=>ne(yw(e,t),r=>r.args),Nte=(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=nt(i.flag);for(let f of c){let u=r[f.name];if(!u||u.length===0)continue;let l=`--${f.name}`;a.has(l)||(a.add(l),s.push(new xa({option:l,suggestions:[],command:n})))}}return s},Mte=(e,t,r)=>Dt(function*(){let{builtIns:n}=yield*dd,o=yield*tf,s=yield*Xx(e,t.commandPath,n);yield*Qt(o.formatHelpDoc(s)),r&&t.errors.length>0&&(yield*cx(o.formatErrors(t.errors)))}),Ute=e=>Dt(function*(){let t=yield*tf;yield*cx(t.formatError(e)),e[Ys]=!1}),Dte=d(2,(e,t)=>Xh.use(({args:r})=>B(r,n=>Ew(e,t)(n)))),Ew=(e,t)=>{let r=Pe(e);return L(function*(n){let{builtIns:o}=yield*dd,{tokens:s,trailingOperands:a}=DB(n),i=RB(e,o),c=i.flatMap(E=>nt(E.flag)),f=sf(c.filter(ji)),{flagMap:u,remainder:l,errors:p}=WB(s,e,f),h={flags:u,arguments:[]},g=yield*hw({tokens:l,trailingOperands:a},e),x=[e.name,...mw(g)],b={builtIns:o,command:e,commandPath:x,version:t.version},T=uw(e,x,o),w=Nte(i,T,u,x);if(w.length>0||p.length>0){let E=g.errors??[];return yield*new ks({commandPath:x,errors:[...p,...w,...E]})}for(let E of T){if(E._tag!=="Action"||!nt(E.flag).some(M=>{let z=u[M.name];return z!==void 0&&z.length>0}))continue;let[,_]=yield*E.flag.parse(h);if(E===fw){let{colors:M}=yield*od;return yield*Dt(function*(){yield*Qt(JB(e.name,t.version,e.description,M));let z=[e.name,...n.filter(be=>be!=="--wizard"&&!be.startsWith("--wizard="))],de=yield*yw(e,{commandPath:x,prefix:z});yield*Qt(ZB(de.displayArgs,M)),(yield*xr(VL({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))&&(yield*Qt(),yield*Ew(e,{...t,renderErrors:!1})(de.args.slice(1)))}).pipe(ns("QuitError",()=>Qt(QB(M))))}yield*E.run(_,b);return}if(g.errors&&g.errors.length>0)return yield*new ks({commandPath:x,errors:g.errors});let P=yield*VE(r.parse(g));if(P._tag==="Failure")return yield*new ks({commandPath:x,errors:[P.failure]});let O=r.handle(P.success,[e.name]),m=T.includes(nf)?(yield*nf.flag.parse(h))[1]:v();O=Io(O,nf,m);for(let E of T){if(E._tag!=="Setting"||E===nf)continue;let[,I]=yield*E.flag.parse(h);O=Io(O,E,I)}let S=Re(m,{onNone:()=>fr(),onSome:E=>Go(s_,E)});yield*ss(O,S)},Il(n=>mT(n)&&n._tag==="ShowHelp"?H(n):Z(n),n=>rs(Mte(e,n,t.renderErrors!==!1),C(n))),Il(n=>t.renderErrors!==!1&&mT(n)&&n._tag==="UserError"?H(n):Z(n),n=>rs(Ute(n),C(n))),Il(n=>z2(n)?H(n):Z(n),n=>ei))};import{Buffer as jte}from"node:buffer";import{randomBytes as zte}from"node:crypto";import{basename as qte,dirname as Hte,join as iy,resolve as Wte}from"node:path";import{Buffer as bw}from"node:buffer";var Lte=Ee.decodeUnknownSync(Ee.fromJsonString(Ee.Record(Ee.String,Ee.Unknown)));function sy(e){return e.replaceAll(/[.-]/gu,"_").replace(/^[^a-z]/u,"app_$&").slice(0,58)}function XB(e,t,r){return e==="package.json"?bw.from(`${JSON.stringify({...Lte(t.toString()),name:r},null," ")}
282
+ `):e===".env.example"?bw.from(t.toString().replaceAll("starter_dev",`${sy(r)}_dev`).replaceAll("starter_test",`${sy(r)}_test`)):["AGENTS.md","README.md"].includes(e)?bw.from(t.toString().replaceAll("{{appName}}",r)):t}var _s=class extends po.TaggedError("CreateAppError"){[ri.errorReported]=!1};function ay(e,t,r=!1){return te.flatMap(Su.ChildProcessSpawner,n=>n.exitCode(hi.make("git",t,{cwd:e,stderr:r?"inherit":"pipe",stdout:r?"inherit":"pipe"})))}var Iw=te.fn("CreateApp.checkedGit")(function*(e,t){let r=yield*ay(e,t,!0);if(r!==0)return yield*new _s({message:`git ${t.join(" ")} failed (exit ${r}). The generated files remain in ${e}.`})}),ej=te.fn("CreateApp.initializeGit")(function*(e){return(yield*ay(e,["--version"]).pipe(te.catch(r=>r.reason._tag==="NotFound"?te.succeed(-1):te.fail(r))))!==0||(yield*ay(e,["rev-parse","--git-dir"]))===0?!1:(yield*Iw(e,["init","--initial-branch=main"]),!0)}),tj=te.fn("CreateApp.commitGit")(function*(e){let r=(yield*ay(e,["-c","user.useConfigOnly=true","var","GIT_AUTHOR_IDENT"]))===0?[]:["-c","user.name=Create App","-c","user.email=create-app@localhost"];yield*Iw(e,["add","--all"]),yield*Iw(e,[...r,"commit","-m","Initialize a generated app"])});var hd=Ee.Record(Ee.String,Ee.String),Cw=Ee.Array(Ee.Struct({content:Ee.String,path:Ee.String})),Xde=Ee.decodeUnknownSync(Ee.fromJsonString(Cw)),Bte=Ee.Struct({dependencies:hd,devDependencies:hd,engines:hd,imports:hd,name:Ee.String,packageManager:Ee.String,private:Ee.Boolean,scripts:hd,type:Ee.String,version:Ee.String}),eme=Ee.decodeUnknownSync(Ee.fromJsonString(Bte));var rj=te.fn("CreateApp.createApp")(function*(e,t,r){let n=yield*us.FileSystem,o=Wte(e),s=qte(o);if(!/^[a-z0-9][a-z0-9._-]*$/u.test(s)||s.length>214||["node_modules","favicon.ico"].includes(s))return yield*new _s({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 _s({message:`Refusing to write into ${e}: the destination must be an empty folder.`});let a=yield*Ee.decodeUnknownEffect(Ee.fromJsonString(Cw))(yield*n.readFileString(t));yield*n.makeDirectory(o,{recursive:!0});for(let p of a){let h=iy(o,p.path),g=jte.from(p.content,"base64"),x=yield*te.try({catch:b=>new _s({message:String(b)}),try:()=>XB(p.path,g,s)});yield*n.makeDirectory(Hte(h),{recursive:!0}),yield*n.writeFile(h,x,{mode:420}),yield*n.chmod(h,420)}yield*n.symlink("AGENTS.md",iy(o,"CLAUDE.md"));let i=sy(s);yield*n.writeFileString(iy(o,".env.local"),`DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${i}_dev
283
283
  TEST_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${i}_test
284
- BETTER_AUTH_SECRET=${jte(32).toString("base64url")}
285
- `,{flag:"wx",mode:384});let c=r.git&&(yield*XB(o)),u=yield*(yield*Su.ChildProcessSpawner).exitCode(hi.make("pnpm",["run","setup"],{cwd:o,stderr:"inherit",stdout:"inherit"}));for(let p of[...a.map(h=>h.path),"pnpm-lock.yaml"]){let h=iy(o,p);(yield*n.exists(h))&&(yield*n.chmod(h,420))}if(u!==0)return yield*new _s({message:`pnpm run setup failed (exit ${u}). Run pnpm run setup in ${e} to retry.`});c&&(yield*ej(o));let l=`'${e.replaceAll("'",`'"'"'`)}'`;yield*ws.log(`Created ${e}.
284
+ BETTER_AUTH_SECRET=${zte(32).toString("base64url")}
285
+ `,{flag:"wx",mode:384});let c=r.git&&(yield*ej(o)),u=yield*(yield*Su.ChildProcessSpawner).exitCode(hi.make("pnpm",["run","setup"],{cwd:o,stderr:"inherit",stdout:"inherit"}));for(let p of[...a.map(h=>h.path),"pnpm-lock.yaml"]){let h=iy(o,p);(yield*n.exists(h))&&(yield*n.chmod(h,420))}if(u!==0)return yield*new _s({message:`pnpm run setup failed (exit ${u}). Run pnpm run setup in ${e} to retry.`});c&&(yield*tj(o));let l=`'${e.replaceAll("'",`'"'"'`)}'`;yield*ws.log(`Created ${e}.
286
286
 
287
287
  Next steps:
288
288
  cd ${l}
289
- pnpm dev`)});var Wte=te.gen(function*(){let t=yield*(yield*us.FileSystem).readFileString(nj(new URL("../package.json",import.meta.url))),{version:r}=yield*Ee.decodeUnknownEffect(Ee.fromJsonString(Ee.Struct({version:Ee.String})))(t),n=af.make("create-app",{folder:qx.String("folder"),git:rf.Boolean("git").pipe(rf.withDefault(!0))},({folder:o,git:s})=>rj(o,nj(new URL("../template.json",import.meta.url)),{git:s})).pipe(af.withDescription("Create and install a Platform application from the maintained starter."));yield*af.run(n,{version:r})});Wte.pipe(te.tapErrorTag("CreateAppError",e=>ws.error(`create-app: ${e.message}`)),te.provide(G2),BP);
289
+ pnpm dev`)});var Vte=te.gen(function*(){let t=yield*(yield*us.FileSystem).readFileString(nj(new URL("../package.json",import.meta.url))),{version:r}=yield*Ee.decodeUnknownEffect(Ee.fromJsonString(Ee.Struct({version:Ee.String})))(t),n=af.make("create-app",{folder:qx.String("folder"),git:rf.Boolean("git").pipe(rf.withDefault(!0))},({folder:o,git:s})=>rj(o,nj(new URL("../template.json",import.meta.url)),{git:s})).pipe(af.withDescription("Create and install a Platform application from the maintained starter."));yield*af.run(n,{version:r})});Vte.pipe(te.tapErrorTag("CreateAppError",e=>ws.error(`create-app: ${e.message}`)),te.provide(K2),jP);