@seanmozeik/tripwire 0.7.0 → 0.7.1

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.
Files changed (57) hide show
  1. package/README.md +16 -14
  2. package/dist/index.js +35 -0
  3. package/dist/tripwire-cli.js +3 -0
  4. package/dist/tripwire-hook.js +3 -0
  5. package/dist/tripwire-pi.js +4 -4
  6. package/dist/tripwire.js +141 -0
  7. package/dist/types/dispatch.d.ts +18 -0
  8. package/dist/types/index.d.ts +6 -0
  9. package/dist/types/lib/bash.d.ts +27 -0
  10. package/dist/types/lib/config.d.ts +110 -0
  11. package/dist/types/lib/cursor.d.ts +16 -0
  12. package/dist/types/lib/decision.d.ts +13 -0
  13. package/dist/types/lib/diff.d.ts +3 -0
  14. package/dist/types/lib/event.d.ts +45 -0
  15. package/dist/types/lib/log.d.ts +2 -0
  16. package/dist/types/lib/secrets.d.ts +41 -0
  17. package/dist/types/rules/bash-deny.d.ts +5 -0
  18. package/dist/types/rules/bash-git.d.ts +5 -0
  19. package/dist/types/rules/bash-network-install.d.ts +4 -0
  20. package/dist/types/rules/bash-redirect.d.ts +4 -0
  21. package/dist/types/rules/bash-scoped-rm.d.ts +5 -0
  22. package/dist/types/rules/bash-tar-explosion.d.ts +4 -0
  23. package/dist/types/rules/config-custom.d.ts +6 -0
  24. package/dist/types/rules/lazy-code.d.ts +4 -0
  25. package/dist/types/rules/path-protect.d.ts +12 -0
  26. package/dist/types/rules/post-secret-scrub.d.ts +12 -0
  27. package/dist/types/rules/read-protect.d.ts +4 -0
  28. package/dist/types/rules/tool-policy.d.ts +5 -0
  29. package/package.json +16 -13
  30. package/dist/tripwire +0 -0
  31. package/scripts/tripwire-cli +0 -12
  32. package/src/cli.ts +0 -271
  33. package/src/dispatch.ts +0 -562
  34. package/src/index.ts +0 -6
  35. package/src/lib/bash.ts +0 -1328
  36. package/src/lib/config.ts +0 -174
  37. package/src/lib/cursor.ts +0 -336
  38. package/src/lib/decision.ts +0 -36
  39. package/src/lib/diff.ts +0 -29
  40. package/src/lib/event.ts +0 -105
  41. package/src/lib/install.ts +0 -610
  42. package/src/lib/log.ts +0 -23
  43. package/src/lib/secrets.ts +0 -184
  44. package/src/main.ts +0 -31
  45. package/src/pi-extension.ts +0 -337
  46. package/src/rules/bash-deny.ts +0 -404
  47. package/src/rules/bash-git.ts +0 -590
  48. package/src/rules/bash-network-install.ts +0 -75
  49. package/src/rules/bash-redirect.ts +0 -91
  50. package/src/rules/bash-scoped-rm.ts +0 -84
  51. package/src/rules/bash-tar-explosion.ts +0 -77
  52. package/src/rules/config-custom.ts +0 -166
  53. package/src/rules/lazy-code.ts +0 -95
  54. package/src/rules/path-protect.ts +0 -131
  55. package/src/rules/post-secret-scrub.ts +0 -49
  56. package/src/rules/read-protect.ts +0 -57
  57. package/src/rules/tool-policy.ts +0 -54
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ var Pq=Object.defineProperty;var U0=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fq=(e)=>e;function Mq(e,t){this[e]=Fq.bind(null,t)}var Un=(e,t)=>{for(var n in t)Pq(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Mq.bind(t,n)})};var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cp;var ky=w(()=>{Cp={name:"@seanmozeik/tripwire",version:"0.7.1",description:"Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",keywords:["ai-agents","bun","claude-code","codex","cursor","hooks","safety"],homepage:"https://github.com/seanmozeik/tripwire#readme",bugs:{url:"https://github.com/seanmozeik/tripwire/issues"},license:"MIT",author:"Sean Mozeik",repository:{type:"git",url:"git+https://github.com/seanmozeik/tripwire.git"},bin:{tripwire:"./dist/tripwire-cli.js","tripwire-hook":"./dist/tripwire-hook.js"},workspaces:["packages/*"],files:["dist","LICENSE","package.json","README.md"],type:"module",types:"./dist/types/index.d.ts",exports:{".":{types:"./dist/types/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"}},publishConfig:{access:"public"},scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun run verify",check:"bun run format && bun run lint:fix && bun run typecheck",format:"oxfmt --write .","format:check":"oxfmt --check .",lint:"oxlint .","lint:fix":"oxlint --format agent --fix .",prepare:"bunx effect-tsgo patch",test:"bun test",typecheck:"tsc --noEmit",verify:"bun run format:check && bun run lint && bun run typecheck && bun test && bun run build"},dependencies:{"shell-quote":"1.10.0"},devDependencies:{"@effect/platform-bun":"4.0.0-rc.112","@effect/tsgo":"0.38.0","@seanmozeik/de-clank":"0.1.7","bun-types":"1.4.0",effect:"4.0.0-rc.112",oxfmt:"0.65.0",oxlint:"1.80.0","oxlint-tsgolint":"7.0.2001",typescript:"7.0.2"},peerDependencies:{"@effect/platform-bun":"4.0.0-rc.112",effect:"4.0.0-rc.112"},optionalDependencies:{"@seanmozeik/tripwire-darwin-arm64":"0.7.1"},engines:{bun:">=1.4"}}});var le=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},Dq,Gi;var Qe=w(()=>{Dq={pipe(){return le(this,arguments)}},Gi=function(){function e(){}return e.prototype=Dq,e}()});function zr(e,...t){return le(e,t)}function L0(e,t,n,r,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}return}function Qt(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function Ji(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var p=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,r){if(arguments.length>=2)return t(n,r);return function(o){return t(o,n)}};case 3:return function(n,r,o){if(arguments.length>=3)return t(n,r,o);return function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}},D=(e)=>e,gt=(e)=>()=>e,nr,Sl,Tp,qr,Vo;var X=w(()=>{Qe();nr=gt(!0),Sl=gt(!1),Tp=gt(null),qr=gt(void 0),Vo=qr});var El=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),r=n;while(r!==null&&r!==Object.prototype){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},wc;var Iy=w(()=>{wc=new WeakSet});function Wr(e){return typeof e==="string"}function bl(e){return typeof e==="number"}function Op(e){return typeof e==="boolean"}function j0(e){return typeof e==="bigint"}function Cy(e){return typeof e==="symbol"}function Ap(e){return Wr(e)||bl(e)||Cy(e)}function ln(e){return typeof e==="function"}function Gs(e){return e===void 0}function Le(e){return e!==void 0}function wl(e){return e!==null}function B0(e){return e===null||e===void 0}function _p(e){return e!=null}function H0(e){return!1}function Ty(e){return!0}function fn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function vl(e){return typeof e==="object"&&e!==null||ln(e)}function q0(e){return e instanceof Error}function go(e){return M(e,Symbol.iterator)||Wr(e)}var M,br;var he=w(()=>{X();M=p(2,(e,t)=>vl(e)&&(t in e)),br=p(2,(e,t)=>M(e,"_tag")&&e._tag===t)});function jq(e,t){if(_y.has(e))return qe("[Circular]");_y.add(e);let n=t();return _y.delete(e),n}var Ie="~effect/interfaces/Hash",re=(e)=>{switch(typeof e){case"number":return Ln(e);case"bigint":return qe(e.toString(10));case"boolean":return qe(String(e));case"symbol":return qe(String(e));case"string":return qe(e);case"undefined":return qe("undefined");case"function":case"object":if(e===null)return qe("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return qe("Invalid Date");return qe(e.toISOString())}else if(e instanceof RegExp)return qe(e.toString());else{if(wc.has(e))return Rp(e);if(Ay.has(e))return Ay.get(e);let t=jq(e,()=>{if($q(e))return e[Ie]();else if(typeof e==="function")return Rp(e);else if(e instanceof DataView)return vc(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return vc(e);else if(e instanceof Map)return Uq(e);else if(e instanceof Set)return Lq(e);return Py(e)});return Ay.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Rp=(e)=>{if(!Oy.has(e))Oy.set(e,Ln(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return Oy.get(e)},xt,Js=(e)=>e&3221225471|e>>>1&1073741824,$q=(e)=>M(e,Ie),Ln=(e)=>{if(e!==e)return qe("NaN");if(e===1/0)return qe("Infinity");if(e===-1/0)return qe("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return Js(t)},qe=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return Js(t)},Ry=(e,t)=>{let n=12289;for(let r of t)n^=xt(re(r),re(e[r]));return Js(n)},Py=(e)=>Ry(e,El(e)),Fy=(e,t)=>(n)=>{let r=e;for(let o of n)r^=t(o);return Js(r)},vc,Uq,Lq,Oy,Ay,_y;var Xt=w(()=>{X();Iy();he();xt=p(2,(e,t)=>e*53^t),vc=Fy(6151,re),Uq=Fy(qe("Map"),([e,t])=>xt(re(e),re(t))),Lq=Fy(qe("Set"),re),Oy=new WeakMap,Ay=new WeakMap,_y=new WeakSet});function Y(){if(arguments.length===1)return(e)=>Zi(e,arguments[0]);return Zi(arguments[0],arguments[1])}function Zi(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(wc.has(e)||wc.has(t))return!1;return qq(e,t,Hq)}function Bq(e,t,n){let r=My.has(e),o=Ny.has(t);if(r&&o)return!0;if(r||o)return!1;My.add(e),Ny.add(t);let s=n();return My.delete(e),Ny.delete(t),s}function Hq(e,t){if(re(e)!==re(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=W0(e),r=W0(t);if(n!==r)return!1;let o=n&&r;if(typeof e==="function"&&!o)return!1;return Bq(e,t,()=>{if(o)return e[Ce](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return zq(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return z0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return z0(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return Kq(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return Vq(e,t)}return Wq(e,t)})}function qq(e,t,n){let r=Pp.get(e);if(!r)r=new WeakMap,Pp.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=Pp.get(t);if(!s)s=new WeakMap,Pp.set(t,s);return s.set(e,o),o}function zq(e,t){for(let n=0;n<e.length;n++)if(!Zi(e[n],t[n]))return!1;return!0}function z0(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wq(e,t){let n=El(e),r=El(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!Zi(e[o],t[o]))return!1;return!0}function Fp(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[l,f]=s[u];if(e(i,l)&&t(a,f)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}function Mp(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var Ce="~effect/interfaces/Equal",My,Ny,Pp,Kq,Vq,W0=(e)=>M(e,Ce),Dy=()=>Y,$y=(e)=>(wc.add(e),e);var yt=w(()=>{Xt();Iy();he();My=new WeakSet,Ny=new WeakSet;Pp=new WeakMap;Kq=Fp(Zi,Zi);Vq=Mp(Zi)});function kc(e){if(Gq(e))return Uy(e);return e}function Uy(e){return e[kl](globalThis[Ic]?.context??Jq)}var kl,Gq=(e)=>M(e,kl),Ic="~effect/Fiber/currentFiber",K0,Jq;var Np=w(()=>{Qe();he();kl=Symbol.for("~effect/Redactable");K0=new Map,Jq={"~effect/Context":{},base:K0,depth:0,mapUnsafe:K0,pipe(){return le(this,arguments)}}});function B(e,t){let n=t?.space??0,r=new WeakSet,o=!n?"":typeof n==="number"?" ".repeat(n):n,s=(u)=>o.repeat(u),i=(u,l)=>{let f=u?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${l})`:l},a=(u)=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(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(r.has(u))return Zq;r.add(u);let f;if(kl in u)f=c(Uy(u),l);else if(Array.isArray(u))f=!o||u.length<=1?`[${u.map((d)=>c(d,l)).join(",")}]`:`[
4
+ ${s(l+1)}${u.map((d)=>c(d,l+1)).join(`,
5
+ `+s(l+1))}
6
+ ${s(l)}]`;else if(u instanceof Date)f=Ly(u);else if(!t?.ignoreToString&&M(u,"toString")&&typeof u.toString==="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let d=Yq(u);f=u instanceof Error&&u.cause?`${d} (cause: ${c(u.cause,l)})`:d}else if(Symbol.iterator in u)f=`${u.constructor.name}(${c(Array.from(u),l)})`;else{let d=a(u);if(!o||d.length<=1){let m=`{${d.map((g)=>`${Go(g)}:${c(u[g],l)}`).join(",")}}`;f=i(u,m)}else{let m=`{
7
+ ${d.map((g)=>`${s(l+1)}${Go(g)}: ${c(u[g],l+1)}`).join(`,
8
+ `)}
9
+ ${s(l)}}`;f=i(u,m)}}return r.delete(u),f}return String(u)}return c(e,0)}function Go(e){return typeof e==="string"?JSON.stringify(e):String(e)}function Dp(e){return e.map((t)=>`[${Go(t)}]`).join("")}function Ly(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Yq(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Yi(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,i=M(s,kl)?kc(s):kc(o);if(typeof i==="bigint")return B(i);if(typeof i!=="object"||i===null)return i;while(n.length>0&&n[n.length-1]!==this)n.pop();if(n.includes(i))return;return n.push(i),i},t?.space)??"null"}var Zq="[Circular]";var kn=w(()=>{he();Np()});var At,Wt=(e)=>{try{if(e=kc(e),M(e,"toJSON")&&ln(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(Wt);return e}catch{return"[toJSON threw]"}},V0=(e,t=2)=>{if(typeof e==="string")return e;try{return typeof e==="object"?Yi(e,{space:t}):B(e,{space:t})}catch{return String(e)}},G0,Qq;var jn=w(()=>{kn();he();Np();At=Symbol.for("nodejs.util.inspect.custom"),G0={toJSON(){return Wt(this)},[At](){return this.toJSON()},toString(){return B(this.toJSON())}};Qq=class Qq{[At](){return this.toJSON()}toString(){return B(this.toJSON())}}});var Zs,Xq=()=>{let t={["~effect/Utils/internal"]:(o)=>o()},n={["~effect/Utils/internal"]:(o)=>{try{return o()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:n["~effect/Utils/internal"]},Ae;var Qi=w(()=>{Zs=class Zs{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new Zs(this.self)}};Ae=Xq()});function U(e,t,n){if(t==="__proto__")Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});else e[t]=n}function $p(e,t){for(let n of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,n))U(e,n,t[n])}function nz(e){return Kr("Effect.evaluate: Not implemented")}var xo="~effect/Effect",Xi="~effect/Exit",ez,Y0,ie,St,In,wr,Ys,ta,Cn,Q0,tz,fe=(e)=>M(e,xo),jy=(e)=>M(e,Xi),Cc="~effect/Cause",Tc="~effect/Cause/Reason",Oc=(e)=>M(e,Cc),X0=(e)=>M(e,Tc),Jo,Z0,Cl,Tl,Ac,Zo=(e)=>new Jo(e),Up,Ol=(e)=>new Jo([new Ac(e)]),Lp,By=(e)=>new Jo([new Lp(e)]),_c,Qs=(e)=>e._tag==="Fail",na=(e)=>e._tag==="Die",ra=(e)=>e._tag==="Interrupt",Yo=(e)=>({...tz,[Y0]:e.op,[St]:e[St]??nz,[In]:e[In],[wr]:e[wr],[Ys]:e[Ys]}),vr=(e)=>{let t=Yo(e);return function(){let n=Object.create(t);return n[ie]=e.single===!1?arguments:arguments[0],n}},eC=(e)=>{let t={[Xi]:Xi,_tag:e.op,get[e.prop](){return this[ie]},...Yo(e),toString(){return`${e.op}(${B(this[ie])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ie]}},[Ce](n){return jy(n)&&n._tag===this._tag&&Y(this[ie],n[ie])},[Ie](){return xt(qe(e.op),re(this[ie]))}};return function(n){let r=Object.create(t);return r[ie]=n,r}},je,jp,Hy,pn,kr=(e)=>pn(Ol(e)),Kr=(e)=>pn(By(e)),ce,rz,Al,Qo=(e)=>{class t extends Al{_tag=e}return t.prototype.name=e,t},Il="~effect/Cause/NoSuchElementError",Bp=(e)=>M(e,Il),yo,ea="~effect/Cause/Done",_l=(e)=>M(e,ea),tC,Rc=(e)=>{if(e===void 0)return tC;return{[ea]:ea,_tag:"Done",value:e}},oz,nC=(e)=>{if(e===void 0)return oz;return kr(Rc(e))};var rt=w(()=>{yt();kn();X();Xt();jn();Qe();he();Qi();ez={_A:D,_E:D,_R:D},Y0=`${xo}/identifier`,ie=`${xo}/args`,St=`${xo}/evaluate`,In=`${xo}/successCont`,wr=`${xo}/failureCont`,Ys=`${xo}/ensureCont`,ta=Symbol.for("effect/Effect/Yield"),Cn={pipe(){return le(this,arguments)},toJSON(){return{...this}},toString(){return B(this.toJSON(),{ignoreToString:!0,space:2})},[At](){return this.toJSON()}},Q0={[Ie](){return Ry(this,Object.keys(this))},[Ce](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]||!Y(this[t[r]],e[t[r]]))return!1;return!0}},tz={[xo]:ez,...Cn,[Symbol.iterator](){return new Zs(this)},toJSON(){return{_id:"Effect",op:this[Y0],...ie in this?{args:this[ie]}:void 0}}};Jo=class Jo{[Cc];reasons;constructor(e){this[Cc]=Cc,this.reasons=e}pipe(){return le(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${B(this.reasons)})`}[At](){return this.toJSON()}[Ce](e){return Oc(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>Y(t,e.reasons[n]))}[Ie](){return vc(this.reasons)}};Z0=new WeakMap;Cl=class Cl{[Tc];annotations;_tag;constructor(e,t,n){if(this[Tc]=Tc,this._tag=e,t!==Tl&&typeof n==="object"&&n!==null&&t.size>0){let r=Z0.get(n);if(r)t=new Map([...r,...t]);Z0.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((o,s)=>{if(t?.overwrite!==!0&&n.has(s))return;n.set(s,o)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return le(this,arguments)}toString(){return B(this)}[At](){return this.toString()}};Tl=new Map;Ac=class Ac extends Cl{error;constructor(e,t=Tl){super("Fail",t,e);this.error=e}toString(){return`Fail(${B(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Ce](e){return Qs(e)&&Y(this.error,e.error)&&Y(this.annotations,e.annotations)}[Ie](){return xt(qe(this._tag))(xt(re(this.error))(re(this.annotations)))}};Up=new Jo([]);Lp=class Lp extends Cl{defect;constructor(e,t=Tl){super("Die",t,e);this.defect=e}toString(){return`Die(${B(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Ce](e){return na(e)&&Y(this.defect,e.defect)&&Y(this.annotations,e.annotations)}[Ie](){return xt(qe(this._tag))(xt(re(this.defect))(re(this.annotations)))}};_c=p((e)=>Oc(e[0]),(e,t,n)=>{if(t.mapUnsafe.size===0)return e;return new Jo(e.reasons.map((r)=>r.annotate(t,n)))});je=eC({op:"Success",prop:"value",[St](e){let t=e.getCont(In);return t?t[In](this[ie],e,this):e.yieldWith(this)}}),jp={key:"effect/Cause/StackTrace"},Hy={key:"effect/Cause/InterruptorStackTrace"},pn=eC({op:"Failure",prop:"cause",[St](e){let t=this[ie],n=!1;if(e.currentStackFrame)t=_c(t,{mapUnsafe:new Map([[jp.key,e.currentStackFrame]])}),n=!0;let r=e.getCont(wr);while(e.interruptible&&e._interruptedCause&&r)r=e.getCont(wr);return r?r[wr](t,e,n?void 0:this):e.yieldWith(n?pn(t):this)}}),ce=vr({op:"WithFiber",[St](e){return this[ie](e)}}),rz=function(){class e extends globalThis.Error{}let t=Yo({op:"YieldableError",[St](){return kr(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Al=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends rz{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0);if(n)$p(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1})}toJSON(){return{...this[e],...this}}}}();yo=class yo extends Qo("NoSuchElementError"){[Il]=Il;constructor(e){super({message:e})}};tC={[ea]:ea,_tag:"Done",value:void 0},oz=kr(tC)});var So=(e)=>Yo({op:e.label,[St]:e.evaluate});var Pc=w(()=>{rt()});function Hp(e){return{combine:e}}function Ir(e,t,n){return{combine:e,initialValue:t,combineAll:n??((r)=>{let o=t;for(let s of r)o=e(o,s);return o})}}function sC(e){return Kt((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var Kt=(e)=>(t,n)=>t===n||e(t,n),sz=(e,t)=>e===t,oC=()=>sz;var Xo=()=>{};var Fc=(e)=>p(3,(t,n,r)=>e(t,(o)=>({...o,[n]:r(o)}))),Mc=(e)=>p(2,(t,n)=>e(t,(r)=>({[n]:r}))),Nc=(e,t)=>p(3,(n,r,o)=>t(n,(s)=>e(o(s),(i)=>({...s,[r]:i}))));var qp=w(()=>{X()});var iC="~effect/data/Option",aC,iz,az,cz,zp=(e)=>M(e,iC),ei=(e)=>e._tag==="None",zy=(e)=>e._tag==="Some",oa,es=(e)=>{let t=Object.create(iz);return t.value=e,t};var Wp=w(()=>{yt();kn();Xt();jn();he();Qi();rt();aC={[iC]:{_A:(e)=>e},...Cn,[Symbol.iterator](){return new Zs(this)}},iz=Object.defineProperty(Object.assign(Object.create(aC),{_tag:"Some",_op:"Some",[Ce](e){return zp(e)&&zy(e)&&Y(this.value,e.value)},[Ie](){return xt(re(this._tag))(re(this.value))},toString(){return`some(${B(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Wt(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),az=re("None"),cz=Object.assign(Object.create(aC),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Ce](e){return zp(e)&&ei(e)},[Ie](){return az},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),oa=Object.create(cz)});var cC="~effect/data/Result",uC,uz,lz,Kp=(e)=>M(e,cC),Dc=(e)=>e._tag==="Failure",$c=(e)=>e._tag==="Success",Fl=(e)=>{let t=Object.create(lz);return t.failure=e,t},Ml=(e)=>{let t=Object.create(uz);return t.success=e,t},Vp=(e)=>$c(e)?oa:es(e.failure),Gp=(e)=>Dc(e)?oa:es(e.success),lC;var Ky=w(()=>{yt();kn();X();Xt();jn();he();Qi();rt();Wp();uC={[cC]:{_A:(e)=>e,_E:(e)=>e},...Cn,[Symbol.iterator](){return new Zs(this)}},uz=Object.assign(Object.create(uC),{_tag:"Success",_op:"Success",[Ce](e){return Kp(e)&&$c(e)&&Y(this.success,e.success)},[Ie](){return xt(re(this._tag))(re(this.success))},toString(){return`success(${B(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Wt(this.success)}}}),lz=Object.assign(Object.create(uC),{_tag:"Failure",_op:"Failure",[Ce](e){return Kp(e)&&Dc(e)&&Y(this.failure,e.failure)},[Ie](){return xt(re(this._tag))(re(this.failure))},toString(){return`failure(${B(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Wt(this.failure)}}}),lC=p(2,(e,t)=>ei(e)?Fl(t()):Ml(e.value))});function ts(e){return(t,n)=>t===n?0:e(t,n)}var rr,Cr,Vy,sa,Uc=(e)=>p(2,(t,n)=>e(t,n)===-1),ti=(e)=>p(2,(t,n)=>e(t,n)===1),Nl=(e)=>p(2,(t,n)=>e(t,n)!==1),Dl=(e)=>p(2,(t,n)=>e(t,n)!==-1);var ia=w(()=>{X();rr=ts((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1}),Cr=ts((e,t)=>e<t?-1:1),Vy=p(2,(e,t)=>ts((n,r)=>e(t(n),t(r)))),sa=Vy(rr,(e)=>e.getTime())});var be={};Un(be,{Do:()=>Uz,all:()=>Oz,andThen:()=>wz,as:()=>pC,asVoid:()=>Ez,bind:()=>$z,bindTo:()=>Nz,composeK:()=>Cz,contains:()=>Mz,containsWith:()=>yC,exists:()=>Qy,filter:()=>ca,filterMap:()=>Rz,firstSomeOf:()=>xz,flatMap:()=>rs,flatMapNullishOr:()=>vz,flatten:()=>aa,fromIterable:()=>dz,fromNullOr:()=>Gy,fromNullishOr:()=>Tn,fromUndefinedOr:()=>ns,gen:()=>Lz,getFailure:()=>pz,getOrElse:()=>mt,getOrNull:()=>Jp,getOrThrow:()=>Sz,getOrThrowWith:()=>Jy,getOrUndefined:()=>mn,getSuccess:()=>dC,isNone:()=>me,isOption:()=>jc,isSome:()=>Ee,let:()=>Dz,lift2:()=>Fz,liftNullishOr:()=>yz,liftPredicate:()=>Yy,liftThrowable:()=>ni,makeCombinerFailFast:()=>SC,makeEquivalence:()=>Zy,makeOrder:()=>Pz,makeReducer:()=>jz,makeReducerFailFast:()=>Bz,map:()=>en,match:()=>et,none:()=>O,orElse:()=>mz,orElseResult:()=>gz,orElseSome:()=>hz,partitionMap:()=>_z,product:()=>hC,productMany:()=>Tz,reduceCompact:()=>Az,some:()=>_,tap:()=>mC,toArray:()=>xC,toRefinement:()=>fz,void:()=>bz,zipLeft:()=>Iz,zipRight:()=>kz,zipWith:()=>gC});function jz(e){return Ir((t,n)=>{if(me(t))return n;if(me(n))return t;return _(e.combine(t.value,n.value))},O())}function SC(e){return Hp((t,n)=>{if(me(t)||me(n))return O();return _(e.combine(t.value,n.value))})}function Bz(e){let t=SC(e).combine,n=_(e.initialValue);return Ir(t,n,(r)=>{let o=n;for(let s of r)if(o=t(o,s),me(o))return o;return o})}var O=()=>oa,_,jc,me,Ee,et,fz=(e)=>(t)=>Ee(e(t)),dz=(e)=>{for(let t of e)return _(t);return O()},dC,pz,mt,mz,hz,gz,xz=(e)=>{let t=O();for(t of e)if(Ee(t))return t;return t},Tn=(e)=>e==null?O():_(e),ns=(e)=>e===void 0?O():_(e),Gy=(e)=>e===null?O():_(e),yz=(e)=>(...t)=>Tn(e(...t)),Jp,mn,ni=(e)=>(...t)=>{try{return _(e(...t))}catch{return O()}},Jy,Sz,en,pC,Ez,bz,rs,wz,vz,aa,kz,Iz,Cz,mC,hC=(e,t)=>Ee(e)&&Ee(t)?_([e.value,t.value]):O(),Tz=(e,t)=>{if(me(e))return O();let n=[e.value];for(let r of t){if(me(r))return O();n.push(r.value)}return _(n)},Oz=(e)=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(me(r))return O();n.push(r.value)}return _(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(me(r))return O();U(t,n,r.value)}return _(t)},gC,Az,xC=(e)=>me(e)?[]:[e.value],_z,Rz,ca,Zy=(e)=>Kt((t,n)=>me(t)?me(n):me(n)?!1:e(t.value,n.value)),Pz=(e)=>ts((t,n)=>Ee(t)?Ee(n)?e(t.value,n.value):1:-1),Fz=(e)=>p(2,(t,n)=>gC(t,n,e)),Yy,yC=(e)=>p(2,(t,n)=>me(t)?!1:e(t.value,n)),Mz,Qy,Nz,Dz,$z,Uz,Lz=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();while(!r.done){let o=r.value;if(me(o))return o;r=n.next(o.value)}return _(r.value)};var _e=w(()=>{yt();Xo();X();qp();Wp();Ky();ia();he();_=es,jc=zp,me=ei,Ee=zy,et=p(2,(e,{onNone:t,onSome:n})=>me(e)?t():n(e.value)),dC=Gp,pz=Vp,mt=p(2,(e,t)=>me(e)?t():e.value),mz=p(2,(e,t)=>me(e)?t():e),hz=p(2,(e,t)=>me(e)?_(t()):e),gz=p(2,(e,t)=>me(e)?en(t(),Ml):en(e,Fl)),Jp=mt(Tp),mn=mt(qr),Jy=p(2,(e,t)=>{if(Ee(e))return e.value;throw t()}),Sz=Jy(()=>Error("getOrThrow called on a None")),en=p(2,(e,t)=>me(e)?O():_(t(e.value))),pC=p(2,(e,t)=>en(e,()=>t)),Ez=pC(void 0),bz=_(void 0),rs=p(2,(e,t)=>me(e)?O():t(e.value)),wz=p(2,(e,t)=>rs(e,(n)=>{let r=ln(t)?t(n):t;return jc(r)?r:_(r)})),vz=p(2,(e,t)=>me(e)?O():Tn(t(e.value))),aa=rs(D),kz=p(2,(e,t)=>rs(e,()=>t)),Iz=p(2,(e,t)=>mC(e,()=>t)),Cz=p(2,(e,t)=>(n)=>rs(e(n),t)),mC=p(2,(e,t)=>rs(e,(n)=>en(t(n),()=>n))),gC=p(3,(e,t,n)=>en(hC(e,t),([r,o])=>n(r,o))),Az=p(3,(e,t,n)=>{let r=t;for(let o of e)if(Ee(o))r=n(r,o.value);return r}),_z=p(2,(e,t)=>{if(me(e))return[O(),O()];let n=t(e.value);return Dc(n)?[_(n.failure),O()]:[O(),_(n.success)]}),Rz=p(2,(e,t)=>{if(me(e))return O();let n=t(e.value);return $c(n)?_(n.success):O()}),ca=p(2,(e,t)=>me(e)?O():t(e.value)?_(e.value):O()),Yy=p(2,(e,t)=>t(e)?_(e):O()),Mz=yC(Dy()),Qy=p(2,(e,t)=>me(e)?!1:t(e.value)),Nz=Mc(en),Dz=Fc(en),$z=Nc(en,rs),Uz=_({})});var EC="~effect/Context/Service",ze=function(){function e(){}let t=e;Object.setPrototypeOf(t,Hz);let n=(r,o)=>{if(t.key=r,o?.defaultValue)t[eS]=eS,t.defaultValue=o.defaultValue;if(o?.make)t.make=o.make;if(o?.fiberCached)bC.add(r);return t};return arguments.length>0?n(arguments[0],arguments[1]):n},Hz,bC,eS="~effect/Context/Reference",wC="~effect/Context",qz=8,zz=8,tS=(e,t,n,r)=>{let o=Object.create(Kz);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},vC=(e,t)=>{if(!t)return;vC(e,t.parent),e.set(t.key,t.value)},kC=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return vC(t,e.overlay),e._flat=t},Wz=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),ri(n)},Zp,nS=(e,t)=>{let n=e;for(let o=n.overlay;o;o=o.parent)if(o.key===t)return o.value;let r=n.base.get(t);if(r===void 0&&!n.base.has(t))return Zp;if(n.overlay&&++n.baseHits>=zz)n.base=kC(n),n.overlay=void 0,n.depth=0;return r},ri=(e)=>tS(void 0,e,void 0,0),Kz,IC=(e,t)=>e.cacheRoot===t.cacheRoot,rS=(e)=>M(e,wC),CC=(e)=>!!e[eS],hn=()=>Vz,Vz,os=(e,t)=>ri(new Map([[e.key,t]])),tn,Gz=(e,t,n)=>{let r=e,o=bC.has(t)?void 0:r.cacheRoot;if(r.depth>=qz){let s=new Map(r.mapUnsafe);return s.set(t,n),tS(o,s,void 0,0)}return tS(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Yp,$l=(e,t)=>{let n=nS(e,t);return n===Zp?void 0:n},Gr,On,Xy="~effect/Context/defaultValue",TC=(e)=>{if(Xy in e)return e[Xy];return e[Xy]=e.defaultValue()},Jz=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
10
+ `);n.splice(1,3),t.stack=n.join(`
11
+ `)}return t},oS,ua,OC=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((r,o)=>{t.set(o,r)});return ri(t)},ke;var Ve=w(()=>{Pc();yt();X();Xt();rt();_e();he();Hz={[EC]:EC,...So({label:"Service",evaluate(e){return je(On(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return os(this,e)},use(e){return ce((t)=>e(On(t.context,this)))},useSync(e){return ce((t)=>je(e(On(t.context,this))))}},bC=new Set,Zp=Symbol(),Kz={get mapUnsafe(){return kC(this)},...Cn,[wC]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ce](e){if(!rS(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[r,o]of t)if(!n.has(r)||!Y(o,n.get(r)))return!1;return!0},[Ie](){return Ln(this.mapUnsafe.size)}},Vz=ri(new Map),tn=p(3,(e,t,n)=>Gz(e,t.key,n)),Yp=p(2,(e,t)=>$l(e,t.key)),Gr=p(2,(e,t)=>{let n=nS(e,t.key);if(n===Zp){if(CC(t))return TC(t);throw Jz(t)}return n}),On=Gr,oS=p(2,(e,t)=>{let n=nS(e,t.key);if(n!==Zp)return _(n);return CC(t)?_(TC(t)):O()}),ua=p(2,(e,t)=>{if(e.mapUnsafe.size===0)return t;if(t.mapUnsafe.size===0)return e;return Wz(e,(n)=>t.mapUnsafe.forEach((r,o)=>n.set(o,r)))}),ke=ze});var sS=(e)=>e.length>0;var Vt={};Un(Vt,{Do:()=>mW,all:()=>fW,andThen:()=>lW,bind:()=>hW,bindTo:()=>gW,fail:()=>te,failVoid:()=>Qz,filterOrFail:()=>sW,flatMap:()=>si,flip:()=>dW,fromNullishOr:()=>Xz,fromOption:()=>eW,gen:()=>pW,getFailure:()=>nW,getOrElse:()=>oi,getOrNull:()=>aW,getOrThrow:()=>_C,getOrThrowWith:()=>AC,getOrUndefined:()=>cW,getSuccess:()=>tW,isFailure:()=>xe,isResult:()=>Qp,isSuccess:()=>Ut,let:()=>xW,liftPredicate:()=>oW,makeEquivalence:()=>aS,map:()=>or,mapBoth:()=>rW,mapError:()=>Bc,match:()=>Bn,merge:()=>iW,orElse:()=>uW,succeed:()=>G,succeedNone:()=>cS,succeedSome:()=>EW,tap:()=>bW,transposeMapOption:()=>SW,transposeOption:()=>yW,try:()=>iS,void:()=>Yz});var G,te,Yz,Qz,Xz,eW,iS=(e)=>{if(ln(e))try{return G(e())}catch(t){return te(t)}else try{return G(e.try())}catch(t){return te(e.catch(t))}},Qp,xe,Ut,tW,nW,aS=(e,t)=>Kt((n,r)=>xe(n)?xe(r)&&t(n.failure,r.failure):Ut(r)&&e(n.success,r.success)),rW,Bc,or,Bn,oW,sW,iW,oi,aW,cW,AC,_C,uW,si,lW,fW=(e)=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(xe(r))return r;n.push(r.success)}return G(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(xe(r))return r;U(t,n,r.success)}return G(t)},dW=(e)=>xe(e)?G(e.failure):te(e.success),pW=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();while(!r.done){let o=r.value;if(xe(o))return o;r=n.next(o.success)}return G(r.value)},mW,hW,gW,xW,yW=(e)=>ei(e)?cS:or(e.value,es),SW,cS,EW=(e)=>G(es(e)),bW;var gn=w(()=>{Xo();X();qp();Wp();Ky();he();G=Ml,te=Fl,Yz=G(void 0),Qz=te(void 0),Xz=p(2,(e,t)=>e==null?te(t(e)):G(e)),eW=lC,Qp=Kp,xe=Dc,Ut=$c,tW=Gp,nW=Vp,rW=p(2,(e,{onFailure:t,onSuccess:n})=>xe(e)?te(t(e.failure)):G(n(e.success))),Bc=p(2,(e,t)=>xe(e)?te(t(e.failure)):e),or=p(2,(e,t)=>Ut(e)?G(t(e.success)):e),Bn=p(2,(e,{onFailure:t,onSuccess:n})=>xe(e)?t(e.failure):n(e.success)),oW=p(3,(e,t,n)=>t(e)?G(e):te(n(e))),sW=p(3,(e,t,n)=>si(e,(r)=>t(r)?G(r):te(n(r)))),iW=Bn({onFailure:D,onSuccess:D}),oi=p(2,(e,t)=>xe(e)?t(e.failure):e.success),aW=oi(Tp),cW=oi(qr),AC=p(2,(e,t)=>{if(Ut(e))return e.success;throw t(e.failure)}),_C=AC(D),uW=p(2,(e,t)=>xe(e)?t(e.failure):G(e.success)),si=p(2,(e,t)=>xe(e)?te(e.failure):t(e.success)),lW=p(2,(e,t)=>si(e,(n)=>{let r=ln(t)?t(n):t;return Qp(r)?r:G(r)})),mW=G({}),hW=Nc(or,si),gW=Mc(or),xW=Fc(or),SW=p(2,(e,t)=>ei(e)?cS:or(t(e.value),es)),cS=G(oa),bW=p(2,(e,t)=>{if(Ut(e))t(e.success);return e})});var RC,nce,wW,PC;var uS=w(()=>{X();_e();he();RC=p(2,(e,t)=>{let n=0;for(let r of e){let o=t(r,n);if(Op(o)){if(o)return _(r)}else if(Ee(o))return o;n++}return O()}),nce={[Symbol.iterator](){return wW}},wW={next(){return{done:!0,value:void 0}}},PC=p(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let o=n.next();while(!o.done){if(t(o.value,r++))return{done:!1,value:o.value};o=n.next()}return{done:!0,value:void 0}}}}}))});var MC,vW=(e)=>Object.keys(e);var NC=w(()=>{X();MC=p(2,(e,t)=>{let n={...e};for(let r of vW(e))U(n,r,t(e[r],r));return n})});function LC(){return TW}var Xp,Lt=(e)=>Xp.isArray(e)?e:Xp.from(e),DC=(e)=>Xp.isArray(e)?e:[e],Ul,lS,$C,IW,la,Hn,UC,em,fS,dS,CW=(e,t)=>{let n=re(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(Y(o,t))return!1;return r.push(t),!0},pS,fa=()=>[],da=(e)=>[e],jt,mS=(e)=>{let t=[];for(let n of e)if(Ee(n))t.push(n.value);return t},hS,Ll,tm=(e)=>{let t=Lt(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)if(CW(n,o))r.push(o);return r},TW;var An=w(()=>{yt();X();Xt();uS();_e();gn();Xp=globalThis.Array,Ul=p(2,(e,{onEmpty:t,onNonEmpty:n})=>Hn(e)?n(e):t()),lS=p(2,(e,t)=>[...e,t]),$C=p(2,(e,t)=>Lt(e).concat(Lt(t))),IW=Xp.isArray,la=sS,Hn=sS,UC=p(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r}),em=p(2,(e,t)=>{let n=0;for(let r of e){if(t(r,n))return _(n);n++}return O()}),fS=RC,dS=p(2,(e,t)=>{let n=Lt(e);for(let r=n.length-1;r>=0;r--){let o=n[r],s=t(o,r);if(typeof s==="boolean"){if(s)return _(o)}else if(Ee(s))return s}return O()}),pS=p(2,(e,t)=>{let n=Lt(e),r=Lt(t);if(Hn(n))return Hn(r)?tm($C(n,r)):n;return r}),jt=p(2,(e,t)=>e.map(t)),hS=p(2,(e,t)=>{let n=[],r=[],o=0;for(let s of e){let i=t(s,o++);if(Ut(i))r.push(i.success);else n.push(i.failure)}return[n,r]}),Ll=p(3,(e,t,n)=>Lt(e).reduce((r,o,s)=>n(r,o,s),t)),TW=Ir((e,t)=>e.concat(t),[])});var nm="~effect/time/Duration",qC,zC,OW,AW,_W,rm=(e)=>BigInt(e<0?Math.ceil(e-0.5):Math.floor(e+0.5)),WC=(e)=>rm(e*1e6),jC=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=AW**BigInt(o.length),i=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,a=i/s+(i%s*OW>=s?zC:qC);return r?-a:a},RW,sr=(e)=>{switch(typeof e){case"number":return ii(e);case"bigint":return Tr(e);case"string":{if(e==="Infinity")return ss;if(e==="-Infinity")return pa;let t=RW.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return Tr(jC(r,zC));if(o==="micro"||o==="micros")return Tr(jC(r,_W));let s=Number(r);switch(o){case"milli":case"millis":return ii(s);case"second":case"seconds":return NW(s);case"minute":case"minutes":return DW(s);case"hour":case"hours":return $W(s);case"day":case"days":return UW(s);case"week":case"weeks":return LW(s)}break}case"object":{if(e===null)break;if(nm in e)return e;if(Array.isArray(e)){if(e.length!==2||!e.every(bl))return BC(e);if(Number.isNaN(e[0])||Number.isNaN(e[1]))return Hc;if(e[0]===-1/0||e[1]===-1/0)return pa;if(e[0]===1/0||e[1]===1/0)return ss;return _n(rm(e[0]*1e9+e[1]))}let t=e,n=0;if(t.weeks)n+=t.weeks*604800000;if(t.days)n+=t.days*86400000;if(t.hours)n+=t.hours*3600000;if(t.minutes)n+=t.minutes*60000;if(t.seconds)n+=t.seconds*1000;if(t.milliseconds)n+=t.milliseconds;if(!t.microseconds&&!t.nanoseconds)return _n(n);return _n(rm(n*1e6+(t.microseconds??0)*1000+(t.nanoseconds??0)))}}return BC(e)},BC=(e)=>{throw Error(`Invalid Input: ${e}`)},KC,HC,PW,FW,MW,_n=(e)=>{let t=Object.create(MW);if(typeof e==="number")if(isNaN(e)||e===0||Object.is(e,-0))t.value=HC;else if(!Number.isFinite(e))t.value=e>0?PW:FW;else if(!Number.isInteger(e))t.value={_tag:"Nanos",nanos:WC(e)};else t.value={_tag:"Millis",millis:e};else if(e===qC)t.value=HC;else t.value={_tag:"Nanos",nanos:e};return t},xS=(e)=>M(e,nm),VC=(e)=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",Hc,ss,pa,Tr=(e)=>_n(e),ii=(e)=>_n(e),NW=(e)=>_n(e*1000),DW=(e)=>_n(e*60000),$W=(e)=>_n(e*3600000),UW=(e)=>_n(e*86400000),LW=(e)=>_n(e*604800000),qc=(e)=>jW(sr(e),{onMillis:D,onNanos:(t)=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),gS=(e)=>{let t=sr(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return WC(t.value.millis)}},GC,jW,JC,yS=(e,t)=>JC(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag}),ZC,BW;var ai=w(()=>{yt();X();Xt();jn();_e();Qe();he();qC=BigInt(0),zC=BigInt(1),OW=BigInt(2),AW=BigInt(10),_W=BigInt(1000),RW=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,KC=ni(sr),HC={_tag:"Millis",millis:0},PW={_tag:"Infinity"},FW={_tag:"NegativeInfinity"},MW={[nm]:nm,[Ie](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?re(rm(e)):Ln(this.value.millis)}case"Nanos":return re(this.value.nanos);default:return Py(this.value)}},[Ce](e){return xS(e)&&BW(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"}}},[At](){return this.toJSON()},pipe(){return le(this,arguments)}},Hc=_n(0),ss=_n(1/0),pa=_n(-1/0),GC=ni(gS),jW=p(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)()}}),JC=p(3,(e,t,n)=>{if(e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity")return n.onInfinity(e,t);if(e.value._tag==="Millis")return t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(gS(e),t.value.nanos);else return n.onNanos(e.value.nanos,gS(t))}),ZC=p(2,(e,t)=>JC(e,t,{onMillis:(n,r)=>_n(n-r),onNanos:(n,r)=>_n(n-r),onInfinity:(n,r)=>{let o=n.value._tag,s=r.value._tag;if(o==="Infinity")return s==="Infinity"?Hc:ss;if(o==="NegativeInfinity")return s==="NegativeInfinity"?Hc:pa;return s==="Infinity"?pa:ss}})),BW=p(2,(e,t)=>yS(e,t))});var SS,YC=(e)=>(t)=>{let n=e(t);return xe(n)?O():_(n.success)};var QC=w(()=>{X();_e();gn();SS=p(2,(e,t)=>(n)=>{let r=e(n);if(xe(r))return te(n);let o=t(r.success);if(xe(o))return te(n);return o})});class eT{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,o,s=0;for(;s<r;s++){if(n[s][0]>t)break;o=n[s]}if(o&&o[0]===t)o[1].push(e);else if(s===r)n.push([t,[e]]);else n.splice(s,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class zc{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?qW:XC)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new tT(this.setImmediate)}}class tT{tasks=new eT;running=void 0;setImmediate;constructor(e=XC){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let r=0;r<n.length;r++)n[r]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var jl,XC,qW=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}},nT,rT;var om=w(()=>{Ve();jl=ke("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new zc}),XC="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};nT=ke("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),rT=ke("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1})});var Or={};Un(Or,{Class:()=>sm,Error:()=>bS,TaggedClass:()=>zW,TaggedError:()=>ci,taggedEnum:()=>ES});function WW(){if(arguments.length===1){let n=arguments[0];return function(r){return n[r._tag](r)}}let e=arguments[0];return arguments[1][e._tag](e)}var sm,zW=(e)=>class extends sm{_tag=e},ES=()=>new Proxy({},{get(e,t,n){if(t==="$is")return br;else if(t==="$match")return WW;return(r)=>({...r,_tag:t})}}),bS,ci;var Wc=w(()=>{rt();Qe();he();sm=class extends Gi{constructor(e){super();if(e)$p(this,e)}};bS=Al,ci=Qo});function im(e){if(e>=iT.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=iT[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var sT="~effect/encoding/EncodingError",ui,am=(e)=>typeof e==="string"?wS(CS.encode(e)):wS(e),Vc=(e)=>{let t=hT(e),n=t.length;if(n%4!==0)return te(new ui({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf("=");if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!=="="))return te(new ui({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*(n/4)-o);for(let i=0,a=0;i<n;i+=4,a+=3){let c=im(t.charCodeAt(i))<<18|im(t.charCodeAt(i+1))<<12|im(t.charCodeAt(i+2))<<6|im(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return G(s)}catch(o){return te(new ui({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},lT=(e)=>or(Vc(e),(t)=>TS.decode(t)),fT=(e)=>typeof e==="string"?aT(CS.encode(e)):aT(e),vS=(e)=>{let t=hT(e),n=t.length;if(n%4===1)return te(new ui({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${n}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return te(new ui({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let r=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return r=r.replace(/-/g,"+").replace(/_/g,"/"),Vc(r)},dT=(e)=>or(vS(e),(t)=>TS.decode(t)),pT=(e)=>typeof e==="string"?cT(CS.encode(e)):cT(e),kS=(e)=>{let t="";for(let n=e>>>3;n>0;n--){let r=Math.random()*4294967296>>>0;t+=Kc[r>>>24]+Kc[r>>>16&255]+Kc[r>>>8&255]+Kc[r&255]}return t},IS=(e)=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return te(new ui({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let n=t.length/2,r=new Uint8Array(n);for(let o=0;o<n;o++){let s=uT(t[o*2]),i=uT(t[o*2+1]);r[o]=s<<4|i}return G(r)}catch(n){return te(new ui({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},mT=(e)=>or(IS(e),(t)=>TS.decode(t)),CS,TS,hT=(e)=>e.replace(/[\n\r]/g,""),wS=(e)=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=is[e[r-2]>>2],n+=is[(e[r-2]&3)<<4|e[r-1]>>4],n+=is[(e[r-1]&15)<<2|e[r]>>6],n+=is[e[r]&63];if(r===t+1)n+=is[e[r-2]>>2],n+=is[(e[r-2]&3)<<4],n+="==";if(r===t)n+=is[e[r-2]>>2],n+=is[(e[r-2]&3)<<4|e[r-1]>>4],n+=is[(e[r-1]&15)<<2],n+="=";return n},is,iT,aT=(e)=>wS(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Kc,cT=(e)=>{let t="";for(let n=0;n<e.length;n++)t+=Kc[e[n]];return t},uT=(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 TypeError("Invalid input")};var cm=w(()=>{Wc();gn();ui=class ui extends ci("EncodingError"){[sT]=sT};CS=new TextEncoder,TS=new TextDecoder;is=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],iT=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Kc=[];for(let e=0;e<256;e++)Kc.push(e.toString(16).padStart(2,"0"))});class yT{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:"Started",startTime:e.startTime},this.attributes=new Map,this.traceId=mn(e.parent)?.traceId??kS(32),this.spanId=kS(16)}end(e,t){this.status={_tag:"Ended",endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}}var AS="effect/Tracer/ParentSpan",um,KW=(e)=>e,lm,gT,xT,_S="effect/Tracer",fm;var ST=w(()=>{Ve();cm();X();_e();um=class um extends ze()(AS,{fiberCached:!0}){};lm=ke("effect/Tracer/DisablePropagation",{defaultValue:Sl}),gT=ke("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),xT=ke("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),fm=ke(_S,{fiberCached:!0,defaultValue:()=>KW({span:(e)=>new yT(e)})})});var ET="effect/observability/Metric/FiberRuntimeMetricsKey";var bT,Bl,dm,Gc,Hl,ql,as,RS,pm,mm;var PS=w(()=>{Ve();X();bT=ke("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Bl=ke("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:qr}),dm=ke("effect/References/TracerEnabled",{defaultValue:nr}),Gc=ke("effect/References/TracerTimingEnabled",{defaultValue:nr}),Hl=ke("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),ql=ke("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),as=ke("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),RS=ke("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),pm=ke("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),mm=ke("effect/References/CurrentLogSpans",{defaultValue:()=>[]})});var ZW=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(e===void 0)return Object.isExtensible(Error);return Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},YW,li=()=>Error.stackTraceLimit,ir=(e)=>{if(YW)Error.stackTraceLimit=e};var hm=w(()=>{YW=ZW()});var gm=(e)=>{if(e?.captureStackTrace===!1)return e;else if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=="boolean")return e;let t=li();ir(3);let n=Error();return ir(t),{...e,captureStackTrace:QW(()=>n.stack)}},FS=(e)=>(t)=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let o=r.split(`
12
+ `);if(o[e]!==void 0)return n=o[e].trim(),n}},QW;var wT=w(()=>{hm();QW=FS(3)});class LA{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return TT;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let t=0;t<this.waiters.length;t++)this.scheduled.push(this.waiters[t]);return this.waiters=[],TT}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](Rn)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](Rn)}open=ce((e)=>{if(this._isOpen)return OT;return this._isOpen=!0,this.scheduleUnsafe(e)});release=ce((e)=>this._isOpen?OT:this.scheduleUnsafe(e));openUnsafe(){if(this._isOpen)return!1;return this._isOpen=!0,this.flushWaiters(),!0}await=Bt((e)=>{if(this._isOpen)return e(ye);return this.waiters.push(e),pe(()=>{let t=this.waiters.indexOf(e);if(t!==-1)this.waiters.splice(t,1);else if(this.scheduled!==void 0){if(t=this.scheduled.indexOf(e),t!==-1)this.scheduled.splice(t,1)}})});closeUnsafe(){if(!this._isOpen)return!1;return this._isOpen=!1,!0}close=pe(()=>this.closeUnsafe());whenOpen=(e)=>K(this.await,()=>e);isOpen(){return this._isOpen}}class n_{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=pe(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return CK()}currentTimeNanos=pe(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return o_()}monotonicTimeNanos=pe(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(qc(e))}sleepMillis(e){if(e<=0)return Qc;else if(!Number.isFinite(e))return Om;return Bt((t)=>{let n=e>MS?this.sleepMillis(e-MS):ye,r=setTimeout(()=>t(n),Math.min(e,MS));return pe(()=>clearTimeout(r))})}}function $K(){DS.interruptChildren??=cK}var BS,AT=(e)=>new BS(e),ga=(e)=>new Jo([new BS(e)]),HS=(e)=>e.reasons.some(Qs),qS=(e)=>{let t=e.reasons.find(Qs);return t?G(t):te(e)},Ar=(e)=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return G(n.error)}return te(e)},_T,ym=(e)=>e.reasons.some(na),RT=(e)=>{let t=e.reasons.find(na);return t?G(t):te(e)},Ql=(e)=>{let t=e.reasons.find(na);return t?G(t.defect):te(e)},Sm=(e)=>e.reasons.some(ra),PT=(e)=>{let t=e.reasons.find(ra);return t?G(t):te(e)},Em=(e)=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];if(r._tag!=="Interrupt")continue;if(t??=new Set,r.fiberId!==void 0)t.add(r.fiberId)}return t?G(t):te(e)},FT=(e)=>{let t=Em(e);return xe(t)?XW:t.success},XW,MT=(e)=>e.reasons.length>0&&e.reasons.every(ra),NT=(e)=>ri(e.annotations),DT=(e)=>{let t=new Map;for(let n of e.reasons)if(n.annotations.size>0)for(let[r,o]of n.annotations)t.set(r,o);return ri(t)},bm,$T,eK=(e)=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},wm=(e)=>{let t=eK(e);if(t.Fail.length>0)return t.Fail[0].error;else if(t.Die.length>0)return t.Die[0].defect;else if(t.Interrupt.length>0)return new globalThis.Error("All fibers interrupted without error");return new globalThis.Error("Empty cause")},zS=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let o=li();ir(1);for(let s of e.reasons){if(s._tag==="Interrupt"){r.push(s);continue}n.push(NS(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(n.length===0){let s=Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=oK(s,r);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,n.push(NS(i,r[0].annotations,t))}return ir(o),n},NS=(e,t,n)=>{let r=typeof e,o;if(e&&r==="object"){if(o=new globalThis.Error(tK(e),{cause:e.cause?NS(e.cause):void 0}),typeof e.name==="string")o.name=e.name;if(typeof e.stack==="string")o.stack=rK(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?UT(s,t):s}if(n?.includeCauseInStack)o.stack=jT(o);for(let s of Object.keys(e))if(!(s in o))o[s]=e[s]}else o=new globalThis.Error(!e?`Unknown error: ${e}`:r==="string"?e:Yi(e));return o},tK=(e)=>{if(typeof e.message==="string")return e.message;else if(typeof e.toString==="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Yi(e)},nK,rK=(e,t,n)=>{let r=`${t.name}: ${t.message}`,o=(e.startsWith(r)?e.slice(r.length):e).split(`
13
+ `),s=[r];for(let i=1;i<o.length;i++){if(/(?:Generator\.next|~effect\/Effect)/.test(o[i]))break;s.push(o[i])}return n?UT(s.join(`
14
+ `),n):s.join(`
15
+ `)},UT=(e,t)=>{let n=t?.get(jp.key);if(n)e=`${e}
16
+ ${LT(n)}`;return e},oK=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let r of t){let o=r.fiberId!==void 0?`#${r.fiberId}`:"unknown",s=r.annotations.get(Hy.key);if(n.push(` at fiber (${o})`),s)n.push(LT(s))}return n.join(`
17
+ `)},LT=(e)=>{let t=[],n=e,r=0;while(n&&r<10){let o=n.stack();if(o){let s=o.matchAll(nK),i=!1;for(let[,a]of s)i=!0,t.push(` at ${n.name} (${a})`);if(!i)t.push(` at ${n.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
18
+ `)},vm=(e)=>zS(e).map(jT).join(`
19
+ `),jT=(e)=>e.cause?`${e.stack} {
20
+ ${BT(e.cause," ")}
21
+ }`:e.stack,BT=(e,t)=>{let n=e.stack.split(`
22
+ `),r=`${t}[cause]: ${n[0]}`;for(let o=1,s=n.length;o<s;o++)r+=`
23
+ ${t}${n[o]}`;if(e.cause)r+=` {
24
+ ${BT(e.cause,`${t} `)}
25
+ ${t}}`;return r},xm="~effect/Fiber",sK,iK,pi=()=>globalThis[Ic],WS,aK,DS,km=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Hy.key,e.currentStackFrame),ri(t)},cK=(e)=>{if(e._children===void 0||e._children.size===0)return;return di(e._children)},HT=(e)=>{let t=e;if(t._exit)return L(t._exit);return Bt((n)=>{if(t._exit)return n(L(t._exit));return pe(e.addObserver((r)=>n(L(r))))})},Im=(e)=>Bt((t)=>{let n=e[Symbol.iterator](),r=[],o=void 0;function s(){let i=n.next();while(!i.done){if(i.value._exit){r.push(i.value._exit),i=n.next();continue}o=i.value.addObserver((a)=>{r.push(a),s()});return}t(L(r))}return s(),pe(()=>o?.())}),Cm=(e)=>ce((t)=>qT(e,t.id)),qT,di=(e)=>ce((t)=>{let n=km(t),r=fa();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return Xl(Im(r))}),L,Be,nt,pe,ae,KS,Yc,zT=(e)=>e==null?nt(new yo):L(e),VS,Qc,GS=(e)=>L(_(e)),xa,WT=(e)=>me(e)?xa:De(e.value,_),KT=(e)=>ae(()=>Be(Ae(e))),mi=(e)=>Kr(e),Tm=(e)=>ae(()=>nt(Ae(e))),ye,VT=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new lf(r,"An error occurred in Effect.try"):e.catch;return ae(()=>{try{return L(Ae(t))}catch(r){return nt(Ae(()=>n(r)))}})},JS=(e)=>ZS(function(t,n){Ae(()=>e(n)).then((r)=>t(L(r)),(r)=>t(mi(r)))},e.length!==0),GT=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new lf(r,"An error occurred in Effect.tryPromise"):e.catch;return ZS(function(r,o){let s=(i)=>{try{r(nt(Ae(()=>n(i))))}catch(a){r(mi(a))}};try{Ae(()=>t(o)).then((i)=>r(L(i)),s)}catch(i){s(i)}},t.length!==0)},JT=(e)=>ce((t)=>e(t.id)),ZT,YT,ZS,uK,Bt=(e)=>ZS(e,e.length>=2),Om,QT=(...e)=>ae(()=>Jc(e.length===1?e[0]():e[1].call(e[0].self))),YS=(e,...t)=>{let n=t.length===0?function(){return ae(()=>Jc(e.apply(this,arguments)))}:function(){let r=ae(()=>Jc(e.apply(this,arguments)));for(let o=0;o<t.length;o++)r=t[o](r,...arguments);return r};return QS(e.length,n)},QS=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),vT,XT=function(){let e=typeof arguments[0]==="string",t=e?arguments[0]:"Effect.fn",n=e?arguments[1]:void 0,r=li();ir(2);let o=new globalThis.Error;if(ir(r),e)return(s,...i)=>kT(t,s,o,i,e,n);return kT(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,n)},kT=(e,t,n,r,o,s)=>{let i=typeof t==="function"?t:r.shift().bind(t.self);return QS(i.length,function(...a){let c=ae(()=>{let f=i.apply(this,arguments);return fe(f)?f:Jc(f)});for(let f=0;f<r.length;f++)c=r[f](c,...a);if(!fe(c))return c;let u=li();ir(2);let l=new globalThis.Error;return ir(u),cs(o?Kl(e,s,(f)=>jS(c,f)):c,Bl,(f)=>({name:e,stack:vT(()=>l.stack),parent:{name:`${e} (definition)`,stack:vT(()=>n.stack),parent:f}}))})},eO=(e,...t)=>QS(e.length,t.length===0?function(){return IT(()=>e.apply(this,arguments))}:function(){let n=IT(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),IT=(e)=>{try{let t=e(),n=void 0;while(!0){let r=t.next(n);if(r.done)return L(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else if(o&&o._tag==="Failure")return r.value;else{let s=!0;return ae(()=>{if(s)return s=!1,K(r.value,(i)=>Jc(t,i));else return ae(()=>Jc(e()))})}}}catch(t){return mi(t)}},Jc,xn,Xc=(e)=>De(e,_),tO=(e)=>Sa(e,{onFailure:L,onSuccess:nt}),Zr,ya,Xl=(e)=>K(e,(t)=>Rn),nO=(e)=>cr(e,nt),XS=(e,t)=>ce((n)=>Bt((r)=>{let o=Lt(e),s=o.length,i=0,a=!1,c=new Set,u=[],l=(f,d,m)=>{if(i++,f._tag==="Failure"){if(u.push(...f.cause.reasons),i>=s)r(Be(Zo(u)));return}let g=!a;if(a=!0,r(c.size===0?f:K(fs(di(c)),()=>f)),g&&t?.onWinner)t.onWinner({fiber:d,index:m,parentFiber:n})};for(let f=0;f<s;f++){let d=Ea(n,o[f],!0,!0,!1);if(c.add(d),d.addObserver((m)=>{c.delete(d),l(m,d,f)}),a)break}return di(c)})),eE=(e,t)=>ce((n)=>Bt((r)=>{let o=!1,s=new Set,i=(c)=>{o=!0,r(s.size===0?c:K(fs(di(s)),()=>c))},a=0;for(let c of e){if(o)break;let u=a++,l=Ea(n,c,!0,!0,!1);s.add(l),l.addObserver((f)=>{s.delete(l);let d=!o;if(i(f),d&&t?.onWinner)t.onWinner({fiber:l,index:u,parentFiber:n})})}return di(s)})),rO,Am,K,lK,oO,We=(e)=>(Xi in e),sO,iO=(e)=>K(e,D),De,aO,cO,uO,lO,_m=(e)=>pn(ga(e)),hi=(e)=>e._tag==="Success",fO=(e)=>e._tag==="Success"?G(e):te(e),dO=(e)=>e._tag==="Success"?G(e.value):te(e),tE=(e)=>e._tag==="Failure",pO=(e)=>e._tag==="Failure"?G(e):te(e),ef=(e)=>e._tag==="Failure"?G(e.cause):te(e),nE,mO,hO=(e)=>e._tag==="Failure"&&Sm(e.cause),gO=(e)=>e._tag==="Failure"&&ym(e.cause),xO=(e)=>e._tag==="Failure"&&HS(e.cause),Rn,rE,oE,sE,fK,yO,SO,EO,iE=(e)=>{let t=[];for(let n of e)if(n._tag==="Failure")t.push(...n.cause.reasons);return t.length===0?Rn:pn(Zo(t))},bO=(e)=>hi(e)?_(e.value):O(),wO=(e)=>tE(e)?_(e.cause):O(),vO=(e)=>{let t=nE(e);return xe(t)?O():_(t.success)},kO=(e)=>e,IO=(e)=>ce((t)=>L(oS(t.context,e))),dK=(e)=>ce((t)=>KS(oS(t.context,e))),eu,cs,CO=(e,t,n)=>fs(ce((r)=>{let o=Gr(r.context,e),s=t(o);return r.setContext(tn(r.context,e,s)),Yr(Gr(r.context,xi),(i)=>{let a=Gr(r.context,e),c;if(n?.reset===void 0){if(a!==s)return ye;c=o}else c=n.reset(o,s,a);return r.setContext(tn(r.context,e,c)),ye})})),aE=()=>pK,pK,gi=(e)=>ce((t)=>e(t.context)),TO,us,Pn=function(){if(arguments.length===1)return p(2,(e,t)=>CT(e,arguments[0],t));return p(3,(e,t,n)=>CT(e,t,n)).apply(this,arguments)},CT=(e,t,n)=>eu(e,tn(t,n)),Rm,OO,cE,AO,_O,uE,RO,Pm,cr,mK,lE,tu,ur,PO=(e)=>Sa(e,{onFailure:(t)=>Bp(t)?xa:nt(t),onSuccess:GS}),FO,MO,NO,Fm,fE,DO,$O,tf,Mm,dE,UO,LO,jO,BO,pE,mE,hE=(e)=>ur(e,mi),HO,qO=(e)=>ae(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return mi(Error("Received an empty collection of effects"));function r(o){let s=t.next();if(s.done)return o.value;return ur(o.value,(i)=>r(s))}return r(n)}),gE=(e)=>ur(e,(t)=>K(Qc,()=>gE(e))),zO,Nm,WO=(e)=>Dm(e,{onFailure:O,onSuccess:_}),fi=(e)=>nf(e,{onFailure:te,onSuccess:G}),Jr,hK,xE,Sa,Dm,nf,KO,rf=(e)=>We(e)?je(e):gK(e),gK,VO,GO,JO,yE,ZO,YO,QO=(e)=>bo((t)=>{let n=t.monotonicTimeNanosUnsafe();return De(e,(r)=>[Tr(t.monotonicTimeNanosUnsafe()-n),r])}),$S="~effect/Scope",US="~effect/Scope/Closeable",xi,SE=(e,t)=>ae(()=>$m(e,t)??ye),$m=(e,t)=>{if(e.state._tag==="Closed")return;let n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}let r=e.state;if(e.state=n,r.finalizer!==void 0)return r.finalizer(t);let o=r.finalizers;if(o===void 0||o.size===0)return;else if(o.size===1)return o.values().next().value(t);return yK(e,o,t)},xK=(e,t)=>hi(e)?t:cr(t,(n)=>Be(bm(e.cause,n))),yK,XO=(e,t)=>{let n=of(t);if(e.state._tag==="Closed")return n.state=e.state,n;let r={};return zl(e,r,(o)=>SE(n,o)),zl(n,r,(o)=>pe(()=>EE(e,r))),n},Yr=(e,t)=>ae(()=>{if(e.state._tag==="Closed")return t(e.state.exit);return zl(e,{},t),ye}),eA=(e,t)=>Yr(e,gt(t)),zl=(e,t,n)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag==="Open"){let r=e.state;if(r.finalizer!==void 0)r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n);else if(r.finalizers===void 0)r.finalizerKey=t,r.finalizer=n;else r.finalizers.set(t,n)}},EE=(e,t)=>{if(e.state._tag==="Open"){let n=e.state;if(n.finalizerKey===t)n.finalizerKey=void 0,n.finalizer=void 0;else if(n.finalizers!==void 0)n.finalizers.delete(t)}},of=(e="sequential")=>({[US]:US,[$S]:$S,strategy:e,state:SK}),SK,sf,tA,bE=(e)=>ce((t)=>{let n=t.context,r=of();return t.setContext(tn(t.context,xi,r)),ls(e,(o)=>(t.setContext(n),$m(r,o)))}),Um=(e)=>ae(()=>{let t=of();return nn(e(t),(n)=>ae(()=>$m(t,n)??ye))}),af=(e,t,n)=>gi((r)=>Qr((o)=>K(sf,(s)=>ya(n?.interruptible?o(e):e,(i)=>Yr(s,(a)=>us(t(i,a),r)))))),wE=(e)=>K(sf,(t)=>gi((n)=>Yr(t,(r)=>us(e(r),n)))),ls,nn,nA,vE,kE,IE,rA,CE,oA,TE=(e,t,n)=>Qr((r)=>K(e,(o)=>ls(r(t(o)),(s)=>n(o,s),!0))),sA=(e)=>af(e,(t)=>M(t,Symbol.asyncDispose)?JS(()=>t[Symbol.asyncDispose]()):pe(()=>t[Symbol.dispose]())),OE,AE,iA=(e)=>AE(e,ss),aA,fs=(e)=>ce((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(Lm),e}),cA,Lm,EK,uA=(e)=>{if(e.interruptible=!0,e._stack.push(EK),e._interruptedCause)return Be(e._interruptedCause)},_E=(e)=>ce((t)=>{if(t.interruptible)return e;return uA(t)??e}),Qr=(e)=>ce((t)=>{if(!t.interruptible)return e(D);return t.interruptible=!1,t._stack.push(Lm),e(_E)}),lA=(e)=>ce((t)=>{if(t.interruptible)return e(D);let n=uA(t),r=e(fs);return n??r}),fA,cf=(e,t)=>{if(go(e))return t?.mode==="result"?ar(e,fi,t):ar(e,D,t);else if(t?.discard)return t.mode==="result"?ar(Object.values(e),fi,t):ar(Object.values(e),D,t);return ae(()=>{let n={};return xn(ar(Object.entries(e),([r,o])=>De(t?.mode==="result"?fi(o):o,(s)=>{U(n,r,s)}),{discard:!0,concurrency:t?.concurrency}),n)})},RE,dA,pA,mA,hA=(e,t,n,r)=>K(n(r,t),(o)=>{if(o)return L(_(r));let s=e.next();if(!s.done)return hA(e,t+1,n,s.value);return L(O())}),gA,xA=(e,t,n,r)=>K(n(r,t),(o)=>{if(Ut(o))return L(_(o.success));let s=e.next();if(!s.done)return xA(e,t+1,n,s.value);return L(O())}),Eo,ar,yA=(e)=>K(e,(t)=>{let n=t[Symbol.iterator]().next();return n.done?nt(new yo):L(n.value)}),bK=(e,t,n)=>ae(()=>{let r=n?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return xn(Eo({while:()=>!s.done,body:()=>t(s.value,i++),step:(a)=>{if(r)r.push(a);s=o.next()}}),r)}),SA=(e)=>{let{onItem:t,step:n}=e,r=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],u=t(o,c,i);if(!We(u))return K(rf(u),(f)=>n(o,c,f,i)??r(o,s,i+1,a)??ye);let l=n(o,c,u,i);if(l)return l._tag==="Failure"?l:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,u=i?.concurrency??1;if(u===1)return r(o,s,0,c);let l=i?.orderedStep===!0,f=!1,d,m,g,b=!1,x,I,C=a,S=l?Array(c):void 0,y=(k)=>{let T=Kr(k);return x=T,f=!0,b=!0,m&&m.size>0?K(fs(di(Array.from(m))),()=>T):T},h=(k,T,F)=>{if(!l)return n(o,k,T,F);if(x)return x;S[F]=T;while(C<c){let N=S[C];if(N===void 0)return;S[C]=void 0;let R=C++,z=n(o,s[R],N,R);if(z)return z}},E=()=>{let k=!1;for(;!x&&a<c;a++){let T=s[a],F=I??t(o,T,a);if(We(F)){if(x=h(T,F,a),x)break}else if(!d)return Bt((N)=>{d=pi(),m=new Set,I=F,g=N;let R;try{R=E()}catch(z){return N(y(z))}if(R)return N(R);return ae(()=>(x=Rn,b=!0,m?di(m):ye))});else{I=void 0;let N=Ea(d,F,!0,!0,"inherit");if(N._exit){if(x=h(T,N._exit,a),x)break;continue}m.add(N);let R=a;if(N.addObserver((z)=>{m.delete(N);try{if(x){if(!b&&z._tag==="Failure")for(let q of z.cause.reasons)if(q._tag==="Interrupt")continue;else if(x._tag==="Failure")x.cause.reasons.push(q);else x=pn(Zo([q]))}else{let q=h(T,z,R);if(q)x=q._tag==="Failure"?pn(Zo(q.cause.reasons.slice())):q,E()}if(k){let q=E();if(q)g(q)}else if(f&&m.size===0)g(x??ye)}catch(q){g(y(q))}}),m.size<u)continue;k=!0,a++;return}}if(f=!0,x){if(m&&m.size>0){let T=km(d);m.forEach((F)=>F.interruptUnsafe(d.id,T));return}if(g||x._tag==="Failure")return x}else if(g){if(!m)return Rn;else if(m.size===0)g(ye)}};return E()}},uf=()=>SA,wK,PE,FE,EA,bA,wA,vA,kA,IA,CA,TA,OA,Ea=(e,t,n=!1,r=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new WS(s.context,i);if(n)a.evaluate(t);else s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!r&&!a._exit)s.children().add(a),a.addObserver(()=>s._children.delete(a));return a},AA,_A=(e)=>ce((t)=>{let n=t._children&&new Set(t._children);return nn(e,(r)=>{let o=t._children;if(o===void 0||o.size===0)return ye;else if(n)o=PC(o,(s)=>!n.has(s));return Xl(Im(o))})}),ME,RA,ds=(e)=>(t,n)=>{let r=new WS(n?.scheduler?tn(e,jl,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();n.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>n.signal.removeEventListener("abort",o))}if(n?.onFiberStart)n.onFiberStart(r);return r},PA,FA,NE=(e)=>{let t=ds(e);return(n,r)=>{let o=t(n,r);if(r?.onExit)o.addObserver(r.onExit);return(s)=>o.interruptUnsafe(s)}},MA,jm=(e)=>{let t=ds(e);return(n,r)=>{let o=t(n,r);return new Promise((s)=>{o.addObserver((i)=>s(i))})}},NA,DE=(e)=>{let t=jm(e);return(n,r)=>t(n,r).then((o)=>{if(o._tag==="Failure")throw wm(o.cause);return o.value})},DA,Bm=(e)=>{let t=ds(e);return(n)=>{if(We(n))return n;let r=new zc("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??Kr(new qm(o))}},$A,$E=(e)=>{let t=Bm(e);return(n)=>{let r=t(n);if(r._tag==="Failure")throw wm(r.cause);return r.value}},UA,TT,OT,UE=(e)=>new LA(e??!1),jA,BA,HA,qA,LS,vK,kK=(e)=>Object.assign(Object.create(vK),e),zA=(e)=>{if(!e)return O();return On(e.annotations,lm)?e._tag==="Span"?zA(mn(e.parent)):O():_(e)},LE=(e,t,n)=>{let r=!e.getRef(dm)||n?.annotations&&On(n.annotations,lm),o=n?.parent!==void 0?_(n.parent):n?.root?O():zA(e.currentSpan),s;if(r)s=kK({name:t,parent:o,annotations:tn(n?.annotations??hn(),lm,!0)});else{let i=e.getRef(fm),a=e.getRef(ps),c=e.getRef(Gc),u=e.getRef(Hl),l=e.getRef(ql),f=n?.level??e.getRef(gT),d=n?.links!==void 0?[...l,...n.links]:l.length===0?[]:l.slice();s=i.span({name:t,parent:o,annotations:n?.annotations??hn(),links:d,startTime:c?a.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??"internal",root:n?.root??me(o),sampled:n?.sampled??(Ee(o)&&o.value.sampled===!1?!1:!f_(e.getRef(xT),f))});for(let m in u)s.attribute(m,u[m]);if(n?.attributes!==void 0)for(let m in n.attributes)s.attribute(m,n.attributes[m])}return s},WA=(e,t)=>ce((n)=>L(LE(n,e,t))),Wl=(e,t)=>fs(ce((n)=>{let r=Gr(n.context,xi),o=LE(n,e,t??{}),s=n.getRef(ps),i=n.getRef(Gc);return xn(Yr(r,(a)=>ZA(o,a,s,i)),o)})),KA=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],n=gm(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return K(Wl(t,n),(o)=>Zc(r,o,n))}return(r)=>K(Wl(t,n),(o)=>Zc(r,o,n))},IK=(e,t)=>(t=typeof t==="function"?t:qr,cs(Bl,(n)=>({name:e,stack:t,parent:n}))),VA,GA,JA,ZA=(e,t,n,r)=>pe(()=>{if(e.status._tag==="Ended")return;e.end(r?n.currentTimeNanosUnsafe():LS,t)}),Kl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return ce((o)=>{let s=LE(o,e,n),i=o.getRef(ps),a=o.getRef(Gc);return nn(Ae(()=>r(s)),(c)=>ZA(s,c,i,a))})},jS,Zc=function(){let e=fe(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=D;if(t._tag==="Span")n=gm(n),r=IK(t.name,n?.captureStackTrace);if(e)return jS(r(arguments[0]),t);return(o)=>jS(r(o),t)},YA=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],n=gm(arguments[2]);if(e){let s=arguments[0];return Kl(t,arguments[2],(i)=>Zc(s,i,n))}let r=typeof arguments[1]==="function"?arguments[1]:void 0,o=r?void 0:arguments[1];return(s,...i)=>Kl(t,r?r(...i):o,(a)=>Zc(s,a,n))},QA,XA=(...e)=>ce((t)=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[r,o]of Object.entries(e[0]))n.attribute(r,o);else n.attribute(e[0],e[1]);return ye}),e_,t_,ps,MS=2147483647,r_,o_,CK,bo=(e)=>ce((t)=>e(t.getRef(ps))),ba=(e)=>bo((t)=>t.sleep(sr(e))),s_,Vl="~effect/Cause/TimeoutError",i_=(e)=>M(e,Vl),Hm,Gl="~effect/Cause/IllegalArgumentError",a_=(e)=>M(e,Gl),jE,Jl="~effect/Cause/ExceededCapacityError",c_=(e)=>M(e,Jl),BE,Zl="~effect/Cause/AsyncFiberError",u_=(e)=>M(e,Zl),qm,Yl="~effect/Cause/UnknownError",l_=(e)=>M(e,Yl),lf,HE,TK=(e)=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 50000;case"Error":return 40000;case"Warn":return 30000;case"Info":return 20000;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},OK,f_,qE,AK,d_=function(){let e=typeof arguments[0]==="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return fs(ce((t)=>{let n=t.getRef(as),r={...n};for(let o=0;o<e.length;o++){let[s,i]=e[o];U(r,s,i)}return t.setContext(tn(t.context,as,r)),Yr(Gr(t.context,xi),(o)=>{let s=t.getRef(as),i={...s};for(let a=0;a<e.length;a++){let[c,u]=e[a];if(s[c]!==u)continue;if(Object.hasOwn(n,c))U(i,c,n[c]);else delete i[c]}return t.setContext(tn(t.context,as,i)),ye})}))},_K="~effect/Logger",RK,p_=(e)=>{let t=Object.create(RK);return t.log=e,t},PK=(e)=>e.replace(/[\s="]/g,"_"),FK=(e,t)=>`${PK(e[0])}=${t-e[1]}ms`,Xr=(e)=>(...t)=>{let n=void 0;for(let r=0,o=t.length;r<o;r++){let s=t[r];if(Oc(s)){if(n)t.splice(r,1);else t=t.slice(0,r).concat(t.slice(r+1));n=n?Zo(n.reasons.concat(s.reasons)):s,r--}}if(n===void 0)n=Up;return ce((r)=>{let o=e??r.currentLogLevel;if(f_(r.minimumLogLevel,o))return ye;let s=r.getRef(ps),i=r.getRef(qE);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:n,fiber:r,date:a,logLevel:o,message:t})}return ye})},ha,Oce,MK=(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")}`,NK,DK,zE,m_,UK=(e,t,n)=>{let r=e.getRef(bT);if(r.size===0)return;if(n&&!ym(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(ps).currentTimeNanosUnsafe()};r.forEach((s)=>s.report(o))};var ht=w(()=>{An();Ve();ai();yt();QC();kn();X();Xt();jn();uS();_e();ia();Qe();he();Np();gn();om();ST();Qi();rt();qp();PS();hm();wT();BS=class BS extends Cl{fiberId;constructor(e,t=Tl){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Ce](e){return ra(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Ie](){return xt(qe(`${this._tag}:${this.fiberId}`))(Rp(this.annotations))}};_T=YC(Ar),XW=new Set,bm=p(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let n=new Jo(pS(e.reasons,t.reasons));return Y(e,n)?e:n}),$T=p(2,(e,t)=>{let n=!1,r=e.reasons.map((o)=>{if(Qs(o))return n=!0,new Ac(t(o.error),o.annotations);return o});return n?Zo(r):e}),nK=/\((.*)\)/g,sK={_A:D,_E:D},iK={id:0};WS=class WS{constructor(e,t=!0){this[xm]=sK,this.setContext(e),this.id=++iK.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[xm];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return On(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),Vo;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let n=ga(e);if(this.currentStackFrame)n=_c(n,os(jp,this.currentStackFrame));if(t)n=_c(n,t);if(this._interruptedCause=this._interruptedCause?bm(this._interruptedCause,n):n,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(Be(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let r=this._yielded;this._yielded=void 0,r()}let t=this.runLoop(e);if(t===ta)return;let n=DS.interruptChildren&&DS.interruptChildren(this);if(n!==void 0)return this.evaluate(K(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let r=0;r<this._observers.length;r++)this._observers[r](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=hn()}runLoop(e){let t=globalThis[Ic];globalThis[Ic]=this;let n=this._running;this._running=!0;let r=!1,o=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,o=Be(this._interruptedCause);if(this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let s=o;o=K(Qc,()=>s)}if(o=this.currentTracerContext?this.currentTracerContext(o,this):o[St](this),o===ta){let s=this._yielded;if(Xi in s)return this._deferredInterrupt=!1,this._yielded=void 0,s;else if(this._deferredInterrupt){this._yielded=void 0,s();continue}return ta}}}catch(s){if(!M(o,St))return Kr(`Fiber.runLoop: Not a valid effect: ${String(o)}`);return this.runLoop(Kr(s))}finally{this._running=n,globalThis[Ic]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,aK;while(!0){let t=this._stack.pop();if(!t)return;let n=t[Ys]&&t[Ys](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,ta}children(){return this._children??=new Set}pipe(){return le(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&IC(t,e))return;let n=this.getRef(jl);if(n!==this.currentScheduler)this.currentScheduler=n,this._dispatcher=void 0;this.currentSpan=$l(e,AS),this.currentLogLevel=this.getRef(RS),this.minimumLogLevel=this.getRef(pm),this.currentStackFrame=this.getRef(Bl),this.maxOpsBeforeYield=this.getRef(nT),this.currentPreventYield=this.getRef(rT),this.runtimeMetrics=$l(e,ET);let r=$l(e,_S);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}};aK={[In](e,t){return Be(t._interruptedCause)},[wr](e,t){return Be(t._interruptedCause)}},DS={interruptChildren:void 0},qT=p((e)=>M(e[0],xm),(e,t,n)=>ce((r)=>{let o=km(r);return o=o&&n?ua(o,n):o??n,e.interruptUnsafe(t,o),Xl(HT(e))})),L=je,Be=pn,nt=kr,pe=vr({op:"Sync",[St](e){let t=this[ie](),n=e.getCont(In);return n?n[In](t,e):e.yieldWith(je(t))}}),ae=vr({op:"Suspend",[St](e){return this[ie]()}}),KS=p((e)=>e.length>=2||jc(e[0]),(e,t)=>me(e)?nt(t?t():new yo("Effect.fromOption: Option.none")):L(e.value)),Yc=Bn({onFailure:nt,onSuccess:L}),VS=vr({op:"Yield",[St](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(Rn)},this[ie]??0),e.yieldWith(()=>{t=!0})}}),Qc=VS(0),xa=L(O()),ye=L(void 0),ZT=ce(L),YT=JT(L),ZS=vr({op:"Async",single:!1,[St](e){let t=Ae(()=>this[ie][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[ie][1]?new AbortController:void 0,s=t((i)=>{if(n)return;if(n=!0,r)e.evaluate(i);else r=i},o?.signal);if(r!==!1)return r;if(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0)return ta;return e._stack.push(uK(()=>(n=!0,o?.abort(),s??Rn))),ta}}),uK=vr({op:"AsyncFinalizer",[Ys](e){if(e.interruptible)e.interruptible=!1,e._stack.push(Lm)},[wr](e,t){return Sm(e)?K(this[ie](),()=>Be(e)):Be(e)}}),Om=Bt(Vo),vT=FS(2),Jc=vr({op:"Iterator",single:!1,[In](e,t){let n=this[ie][0];while(!0){let r=n.next(e);if(r.done)return L(r.value);if(!We(r.value))return t._stack.push(this),r.value;else if(r.value._tag==="Failure")return r.value;e=r.value.value}},[St](e){return this[In](this[ie][1],e)}}),xn=p(2,(e,t)=>{let n=L(t);return K(e,(r)=>n)}),Zr=p(2,(e,t)=>K(e,(n)=>fe(t)?t:Ae(()=>t(n)))),ya=p(2,(e,t)=>K(e,(n)=>xn(fe(t)?t:Ae(()=>t(n)),n))),rO=p((e)=>fe(e[1]),(e,t,n)=>XS([e,t],n)),Am=p((e)=>fe(e[1]),(e,t,n)=>eE([e,t],n)),K=p(2,(e,t)=>{let n=Object.create(lK);return n[ie]=e,n[In]=t.length!==1?(r)=>t(r):t,n}),lK=Yo({op:"OnSuccess",[St](e){return e._stack.push(this),this[ie]}}),oO=p(2,(e,t)=>{if(We(e))return e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause);return Jr(e,t)}),sO=p(2,(e,t)=>{if(We(e))return e._tag==="Success"?t(e.value):e;return K(e,t)}),De=p(2,(e,t)=>K(e,(n)=>L(Ae(()=>t(n))))),aO=p(2,(e,t)=>We(e)?rE(e,t):De(e,t)),cO=p(2,(e,t)=>We(e)?oE(e,t):pE(e,t)),uO=p(2,(e,t)=>We(e)?sE(e,t):mE(e,t)),lO=p(2,(e,t)=>{if(We(e)){if(e._tag==="Success")return e;let n=Ar(e.cause);if(xe(n))return e;return t(n.success)}return ur(e,t)}),nE=SS(ef,Ar),mO=SS(ef,Ql),Rn=je(void 0),rE=p(2,(e,t)=>e._tag==="Success"?je(t(e.value)):e),oE=p(2,(e,t)=>{if(e._tag==="Success")return e;let n=Ar(e.cause);if(xe(n))return e;return kr(t(n.success))}),sE=p(2,(e,t)=>{if(e._tag==="Success")return je(t.onSuccess(e.value));let n=Ar(e.cause);if(xe(n))return e;return kr(t.onFailure(n.success))}),fK=p(2,(e,t)=>hi(e)?je(t):e),yO=p(2,(e,t)=>hi(e)?t:e),SO=p(2,(e,t)=>hi(e)?t.onSuccess(e.value):t.onFailure(e.cause)),EO=fK(void 0),eu=p(2,(e,t)=>ce((n)=>{let r=n.context,o=t(r);if(r===o)return e;return n.setContext(o),ls(e,()=>{n.setContext(r);return})})),cs=p(3,(e,t,n)=>eu(e,(r)=>{let o=Gr(r,t),s=n(o);if(o===s)return r;return tn(r,t,s)})),pK=ce((e)=>L(e.context)),TO=p(2,(e,t)=>eu(e,gt(t))),us=p(2,(e,t)=>{if(We(e))return e;return eu(e,ua(t))}),Rm=p(3,(e,t,n)=>K(n,(r)=>Pn(e,t,r))),OO=p((e)=>fe(e[1]),(e,t,n)=>cE(e,t,(r,o)=>[r,o],n)),cE=p((e)=>fe(e[1]),(e,t,n,r)=>r?.concurrent?De(cf([e,t],{concurrency:2}),([o,s])=>Ae(()=>n(o,s))):K(e,(o)=>De(t,(s)=>Ae(()=>n(o,s))))),AO=p((e)=>fe(e[0]),(e,t,n)=>PE(e,t,n?(r)=>nt(n(r)):()=>nt(new yo))),_O=p(2,(e,t)=>K(t,(n)=>n?Xc(e):xa)),uE=p(2,(e,t)=>Array.from({length:t},()=>e)),RO=p((e)=>fe(e[0]),(e,t,n)=>cf(uE(e,t),n)),Pm=p((e)=>fe(e[0]),(e,t)=>Eo({while:nr,body:gt(t?.disableYield?e:K(e,(n)=>Qc)),step:Vo})),cr=p(2,(e,t)=>{let n=Object.create(mK);return n[ie]=e,n[wr]=t.length!==1?(r)=>t(r):t,n}),mK=Yo({op:"OnFailure",[St](e){return e._stack.push(this),this[ie]}}),lE=p(3,(e,t,n)=>cr(e,(r)=>{if(!t(r))return Be(r);return Ae(()=>n(r))})),tu=p(3,(e,t,n)=>cr(e,(r)=>{let o=t(r);return xe(o)?Be(o.failure):Ae(()=>n(o.success,r))})),ur=p(2,(e,t)=>tu(e,Ar,(n)=>t(n))),FO=p(2,(e,t)=>tu(e,Ql,t)),MO=p(2,(e,t)=>cr(e,(n)=>Zr(Ae(()=>t(n)),Be(n)))),NO=p(3,(e,t,n)=>lE(e,t,(r)=>Zr(Ae(()=>n(r)),Be(r)))),Fm=p(3,(e,t,n)=>cr(e,(r)=>{let o=t(r);if(xe(o))return Be(r);return Zr(Ae(()=>n(o.success,r)),Be(r))})),fE=p(2,(e,t)=>Fm(e,Ar,(n)=>t(n))),DO=p(3,(e,t,n)=>{let r=Array.isArray(t)?(o)=>M(o,"_tag")&&t.includes(o._tag):br(t);return fE(e,(o)=>r(o)?n(o):ye)}),$O=p(2,(e,t)=>Fm(e,Ql,(n)=>t(n))),tf=p((e)=>fe(e[0]),(e,t,n,r)=>cr(e,(o)=>{let s=Ar(o);if(xe(s))return Be(s.failure);if(!t(s.success))return r?Ae(()=>r(s.success)):Be(o);return Ae(()=>n(s.success))})),Mm=p((e)=>fe(e[0]),(e,t,n,r)=>cr(e,(o)=>{let s=Ar(o);if(xe(s))return Be(s.failure);let i=t(s.success);if(xe(i))return r?Ae(()=>r(i.failure)):Be(o);return Ae(()=>n(i.success))})),dE=p((e)=>fe(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?(s)=>M(s,"_tag")&&t.includes(s._tag):br(t);return tf(e,o,n,r)}),UO=p((e)=>fe(e[0]),(e,t,n)=>{let r;return Mm(e,(o)=>(r??=Object.keys(t),M(o,"_tag")&&Wr(o._tag)&&r.includes(o._tag)?G(o):te(o)),(o)=>Ae(()=>t[o._tag](o)),n)}),LO=p((e)=>fe(e[0]),(e,t,n,r,o)=>tf(e,(s)=>br(s,t)&&M(s,"reason"),(s)=>{let i=s.reason;if(br(i,n))return r(i,s);return o?Ae(()=>o(i,s)):nt(s)})),jO=p((e)=>fe(e[0]),(e,t,n,r)=>{let o;return tf(e,(s)=>br(s,t)&&M(s,"reason")&&M(s.reason,"_tag")&&Wr(s.reason._tag),(s)=>{let i=s.reason;if(o??=Object.keys(n),o.includes(i._tag))return Ae(()=>n[i._tag](i,s));return r?Ae(()=>r(i,s)):nt(s)})}),BO=p(2,(e,t)=>Mm(e,(n)=>{if(br(n,t)&&M(n,"reason"))return G(n.reason);return te(n)},nt)),pE=p(2,(e,t)=>ur(e,(n)=>Tm(()=>t(n)))),mE=p(2,(e,t)=>Sa(e,{onFailure:(n)=>Tm(()=>t.onFailure(n)),onSuccess:(n)=>pe(()=>t.onSuccess(n))})),HO=p(2,(e,t)=>ur(e,(n)=>pe(t))),zO=p((e)=>fe(e[0]),(e,t)=>{if(!t?.log)return Sa(e,{onFailure:(r)=>ye,onSuccess:(r)=>ye});let n=Xr(t.log===!0?void 0:t.log);return Jr(e,{onFailure(r){let o=qS(r);return xe(o)?Be(o.failure):t.message===void 0?n(r):n(t.message,r)},onSuccess:(r)=>ye})}),Nm=p((e)=>fe(e[0]),(e,t)=>{if(!t?.log)return Jr(e,{onFailure:(r)=>ye,onSuccess:(r)=>ye});let n=Xr(t.log===!0?void 0:t.log);return Jr(e,{onFailure:(r)=>t.message===void 0?n(r):n(t.message,r),onSuccess:(r)=>ye})}),Jr=p(2,(e,t)=>{let n=Object.create(hK);return n[ie]=e,n[In]=t.onSuccess.length!==1?(r)=>t.onSuccess(r):t.onSuccess,n[wr]=t.onFailure.length!==1?(r)=>t.onFailure(r):t.onFailure,n}),hK=Yo({op:"OnSuccessAndFailure",[St](e){return e._stack.push(this),this[ie]}}),xE=p(2,(e,t)=>Jr(e,{onFailure:(n)=>pe(()=>t.onFailure(n)),onSuccess:(n)=>pe(()=>t.onSuccess(n))})),Sa=p(2,(e,t)=>Jr(e,{onFailure:(n)=>{let r=n.reasons.find(Qs);return r?Ae(()=>t.onFailure(r.error)):Be(n)},onSuccess:t.onSuccess})),Dm=p(2,(e,t)=>Sa(e,{onFailure:(n)=>pe(()=>t.onFailure(n)),onSuccess:(n)=>pe(()=>t.onSuccess(n))})),nf=p(2,(e,t)=>{if(We(e)){if(e._tag==="Success")return je(t.onSuccess(e.value));let n=Ar(e.cause);if(xe(n))return e;return je(t.onFailure(n.success))}return Dm(e,t)}),KO=p(2,(e,t)=>{if(We(e)){if(e._tag==="Success")return je(t.onSuccess(e.value));return je(t.onFailure(e.cause))}return xE(e,t)}),gK=vr({op:"Exit",[St](e){return e._stack.push(this),this[ie]},[In](e,t,n){return L(n??je(e))},[wr](e,t,n){return L(n??pn(e))}}),VO=nf({onFailure:()=>!0,onSuccess:()=>!1}),GO=nf({onFailure:()=>!1,onSuccess:()=>!0}),JO=p(2,(e,t)=>Zr(ba(t),e)),yE=p(2,(e,t)=>Am(e,K(ba(t.duration),t.orElse))),ZO=p(2,(e,t)=>yE(e,{duration:t,orElse:()=>nt(new Hm)})),YO=p(2,(e,t)=>Am(Xc(e),xn(ba(t),O()))),xi=ze("effect/Scope"),yK=YS(function*(e,t,n){let r=[],o=[],s=Array.from(t.values()),i=pi();for(let a=s.length-1;a>=0;a--){let c=s[a];if(e.strategy==="sequential")r.push(yield*rf(c(n)));else o.push(Ea(i,c(n),!0,!0,"inherit"))}if(o.length>0)r=yield*Im(o);return yield*iE(r)}),SK={_tag:"Empty"},sf=xi,tA=Pn(xi),ls=vr({op:"OnExit",single:!1,[St](e){return e._stack.push(this),this[ie][0]},[Ys](e){if(e.interruptible&&this[ie][2]!==!0)e._stack.push(Lm),e.interruptible=!1},[In](e,t,n){n??=je(e);let r=this[ie][1](n);return r?K(r,(o)=>n):n},[wr](e,t,n){n??=pn(e);let r=this[ie][1](n);return r?K(xK(n,r),(o)=>n):n}}),nn=p(2,ls),nA=p(2,(e,t)=>nn(e,(n)=>t)),vE=p(3,(e,t,n)=>nn(e,(r)=>{if(!t(r))return ye;return n(r)})),kE=p(3,(e,t,n)=>nn(e,(r)=>{let o=t(r);return xe(o)?ye:n(o.success,r)})),IE=p(2,(e,t)=>kE(e,ef,t)),rA=p(3,(e,t,n)=>vE(e,(r)=>{if(r._tag!=="Failure")return!1;return t(r.cause)},(r)=>n(r.cause))),CE=p(3,(e,t,n)=>nn(e,(r)=>{if(r._tag!=="Failure")return ye;let o=t(r.cause);return xe(o)?ye:n(o.success,r.cause)})),oA=p(2,(e,t)=>CE(Em,t)(e)),OE=p(2,(e,t)=>pe(()=>{let n=qc(sr(t)),r=Number.isFinite(n),o=UE(!1),s=0,i=!1,a,c=K(o.await,()=>a);return[ce((u)=>{let l=u.getRef(ps),f=r?l.currentTimeMillisUnsafe():0;if(i||f<s)return a??c;return i=!0,o.closeUnsafe(),a=void 0,nn(e,(d)=>pe(()=>{i=!1,s=l.currentTimeMillisUnsafe()+n,a=d,o.openUnsafe()}))}),pe(()=>{s=0,o.closeUnsafe(),a=void 0})]})),AE=p(2,(e,t)=>De(OE(e,t),(n)=>n[0])),aA=ce((e)=>Be(ga(e.id))),cA=vr({op:"SetInterruptible",[Ys](e){if(e.interruptible=this[ie],e._interruptedCause&&e.interruptible)return()=>Be(e._interruptedCause)}}),Lm=cA(!0),EK=cA(!1),fA=De(af(pe(()=>new AbortController),(e)=>pe(()=>e.abort())),(e)=>e.signal),RE=p((e)=>go(e[0])&&!fe(e[0]),(e,t,n)=>De(ar(e,(r,o)=>fi(t(r,o)),n),(r)=>hS(r,D))),dA=p(3,(e,t,n)=>{let r=Lt(e);if(r.length===0)return pe(t);return ae(()=>{let o=0,s=t();return De(Eo({while:()=>o<r.length,body:()=>n(s,r[o],o),step(i){s=i,o++}}),()=>s)})}),pA=p((e)=>go(e[0])&&!fe(e[0]),(e,t,n)=>K(RE(e,t,{concurrency:n?.concurrency}),([r,o])=>{if(la(r))return nt(r);return n?.discard?ye:L(o)})),mA=p((e)=>go(e[0])&&!fe(e[0]),(e,t)=>ae(()=>{let n=e[Symbol.iterator](),r=n.next();if(!r.done)return hA(n,0,t,r.value);return L(O())})),gA=p((e)=>go(e[0])&&!fe(e[0]),(e,t)=>ae(()=>{let n=e[Symbol.iterator](),r=n.next();if(!r.done)return xA(n,0,t,r.value);return L(O())})),Eo=vr({op:"While",[In](e,t){if(this[ie].step(e),this[ie].while())return t._stack.push(this),this[ie].body();return Rn},[St](e){if(this[ie].while())return e._stack.push(this),this[ie].body();return Rn}}),ar=p((e)=>typeof e[1]==="function",(e,t,n)=>ae(()=>{let r=n?.concurrency??1,o=r==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,r);if(o===1)return bK(e,t,n);let s=Lt(e),i=s.length;if(i===0)return n?.discard?ye:L([]);let a=n?.discard?void 0:Array(i),c=wK({f:t,out:a},s,{concurrency:o});return c?xn(c,a):L(a)})),wK=SA({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag==="Failure")return n;else if(e.out)e.out[r]=n.value}}),PE=p(3,(e,t,n)=>K(e,(r)=>t(r)?L(r):n(r))),FE=p(3,(e,t,n)=>K(e,(r)=>{let o=t(r);return xe(o)?n(o.failure):L(o.success)})),EA=p((e)=>fe(e[0]),(e,t,n)=>FE(e,t,n?(r)=>nt(n(r)):()=>nt(new yo))),bA=p((e)=>go(e[0])&&!fe(e[0]),(e,t,n)=>ae(()=>{let r=[];return xn(ar(e,(o,s)=>{let i=t(o,s);if(typeof i==="boolean"){if(i)r.push(o);return ye}return De(i,(a)=>{if(a)r.push(o)})},{discard:!0,concurrency:n?.concurrency}),r)})),wA=p((e)=>go(e[0])&&!fe(e[0]),(e,t)=>ae(()=>{let n=[];for(let r of e){let o=t(r);if(Ut(o))n.push(o.success)}return L(n)})),vA=p((e)=>go(e[0])&&!fe(e[0]),(e,t,n)=>ae(()=>{let r=[];return xn(ar(e,(o)=>De(t(o),(s)=>{if(Ut(s))r.push(s.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),kA=L({}),IA=Mc(De),CA=Nc(De,K),TA=Fc(De),OA=p((e)=>fe(e[0]),(e,t)=>ce((n)=>($K(),L(Ea(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),AA=p((e)=>fe(e[0]),(e,t)=>ce((n)=>L(Ea(n,e,t?.startImmediately,!0,t?.uninterruptible)))),ME=p((e)=>fe(e[0]),(e,t,n)=>ce((r)=>{let o=Ea(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};zl(t,s,()=>JT((a)=>a===o.id?ye:Cm(o))),o.addObserver(()=>EE(t,s))}else o.interruptUnsafe(r.id,km(r));return L(o)})),RA=p((e)=>fe(e[0]),(e,t)=>K(sf,(n)=>ME(e,n,t))),PA=p(2,(e,t)=>{if(e._exit)return e;else if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let n={};return zl(t,n,()=>Cm(e)),e.addObserver(()=>EE(t,n)),e}),FA=ds(hn()),MA=NE(hn()),NA=jm(hn()),DA=DE(hn()),$A=Bm(hn()),UA=$E(hn()),TT=L(!0),OT=L(!1);jA=ce((e)=>L(e.getRef(fm))),BA=p(2,(e,t)=>Pn(e,fm,t)),HA=Pn(dm),qA=Pn(Gc),LS=BigInt(0),vK={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:LS,endTime:LS,exit:Rn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},VA=Hl,GA=ql,JA=p((e)=>fe(e[0]),(e,t,n={})=>{let o=(Array.isArray(t)?t:[t]).map((s)=>({span:s,attributes:n}));return cs(e,ql,(s)=>[...s,...o])}),jS=Pn(um),QA=p((e)=>fe(e[0]),(e,...t)=>cs(e,Hl,(n)=>{let r=t.length===1?{...n,...t[0]}:{...n};if(t.length===1)return r;else U(r,t[0],t[1]);return r})),e_=ce((e)=>{let t=e.currentSpanLocal;return t?L(t):nt(new yo)}),t_=dK(um),ps=ke("effect/Clock",{defaultValue:()=>new n_});r_=BigInt(1e6),o_=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 n=BigInt(Date.now())*r_;if(n>t)t=n;return t}}(),CK=function(){let e=BigInt(1e9),t;return()=>{let n=o_(),r=BigInt(Date.now())*r_;if(t===void 0)t=r-n;else{let o=t+n;if((r>o?r-o:o-r)>e)t=r-n}return t+n}}(),s_=bo((e)=>e.currentTimeMillis);Hm=class Hm extends Qo("TimeoutError"){[Vl]=Vl;constructor(e){super({message:e})}};jE=class jE extends Qo("IllegalArgumentError"){[Gl]=Gl;constructor(e){super({message:e})}};BE=class BE extends Qo("ExceededCapacityError"){[Jl]=Jl;constructor(e){super({message:e})}};qm=class qm extends Qo("AsyncFiberError"){[Zl]=Zl;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}};lf=class lf extends Qo("UnknownError"){[Yl]=Yl;constructor(e,t){super({message:t,cause:e})}};HE=ke("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),OK=Vy(rr,TK),f_=ti(OK),qE=ke("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([NK,DK])}),AK=ke("effect/Logger/LogToStderr",{defaultValue:Sl}),RK={[_K]:{_Message:D,_Output:D},pipe(){return le(this,arguments)}},ha={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Oce={None:[],All:[],Trace:[ha.gray],Debug:[ha.blue],Info:[ha.green],Warn:[ha.yellow],Error:[ha.red],Fatal:[ha.bgBrightRed,ha.black]},NK=p_(({cause:e,date:t,fiber:n,logLevel:r,message:o})=>{let s=Array.isArray(o)?o.slice():[o];if(e.reasons.length>0)s.push(vm(e));let i=t.getTime(),a=n.getRef(mm),c="";for(let d of a)c+=` ${FK(d,i)}`;let u=n.getRef(as);if(Object.keys(u).length>0)s.push(u);let l=n.getRef(HE);(n.getRef(AK)?l.error:l.log)(`[${MK(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...s)}),DK=p_(({cause:e,fiber:t,logLevel:n,message:r})=>{let o=t.getRef(ps),s=t.getRef(as),i=t.currentSpan;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))U(a,c,u);if(a["effect.fiberId"]=t.id,a["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0)a["effect.cause"]=vm(e);i.event(V0(Array.isArray(r)&&r.length===1?r[0]:r),o.currentTimeNanosUnsafe(),a)});zE=L(void 0),m_=p((e)=>fe(e[0]),(e,t)=>IE(e,(n)=>ce((r)=>(UK(r,n,t?.defectsOnly),ye))))});var lt={};Un(lt,{AsyncFiberError:()=>hV,AsyncFiberErrorTypeId:()=>pV,Done:()=>gf,DoneTypeId:()=>oV,ExceededCapacityError:()=>dV,ExceededCapacityErrorTypeId:()=>fV,IllegalArgumentError:()=>xf,IllegalArgumentErrorTypeId:()=>cV,InterruptorStackTrace:()=>S_,NoSuchElementError:()=>rV,NoSuchElementErrorTypeId:()=>nV,ReasonTypeId:()=>jK,StackTrace:()=>y_,TimeoutError:()=>aV,TimeoutErrorTypeId:()=>sV,TypeId:()=>LK,UnknownError:()=>ZE,UnknownErrorTypeId:()=>gV,annotate:()=>yV,annotations:()=>EV,combine:()=>zK,die:()=>h_,done:()=>_t,empty:()=>VE,fail:()=>GE,filterInterruptors:()=>XK,findDefect:()=>JK,findDie:()=>GK,findError:()=>x_,findErrorOption:()=>KK,findFail:()=>WK,findInterrupt:()=>YK,fromReasons:()=>wa,hasDies:()=>VK,hasFails:()=>g_,hasInterrupts:()=>ZK,hasInterruptsOnly:()=>hf,interrupt:()=>qK,interruptors:()=>QK,isAsyncFiberError:()=>mV,isCause:()=>WE,isDieReason:()=>BK,isDone:()=>zm,isExceededCapacityError:()=>lV,isFailReason:()=>ff,isIllegalArgumentError:()=>uV,isInterruptReason:()=>HK,isNoSuchElementError:()=>tV,isReason:()=>KE,isTimeoutError:()=>iV,isUnknownError:()=>xV,makeDieReason:()=>pf,makeFailReason:()=>df,makeInterruptReason:()=>mf,map:()=>ms,pretty:()=>JE,prettyErrors:()=>eV,reasonAnnotations:()=>SV,squash:()=>nu});var LK,jK,WE,KE,ff,BK,HK,wa,VE,GE,h_,qK,df=(e)=>new Ac(e),pf=(e)=>new Lp(e),mf,hf,ms,zK,nu,g_,WK,x_,KK,VK,GK,JK,ZK,YK,QK,XK,eV,JE,tV,nV,rV,zm,oV,gf,_t,sV,iV,aV,cV,uV,xf,lV,fV,dV,pV,mV,hV,gV,xV,ZE,yV,SV,EV,y_,S_;var rn=w(()=>{Ve();rt();ht();LK=Cc,jK=Tc,WE=Oc,KE=X0,ff=Qs,BK=na,HK=ra,wa=Zo,VE=Up,GE=Ol,h_=By,qK=ga,mf=AT,hf=MT,ms=$T,zK=bm,nu=wm,g_=HS,WK=qS,x_=Ar,KK=_T,VK=ym,GK=RT,JK=Ql,ZK=Sm,YK=PT,QK=FT,XK=Em,eV=zS,JE=vm,tV=Bp,nV=Il,rV=yo,zm=_l,oV=ea,gf=Rc,_t=nC,sV=Vl,iV=i_,aV=Hm,cV=Gl,uV=a_,xf=jE,lV=c_,fV=Jl,dV=BE,pV=Zl,mV=u_,hV=qm,gV=Yl,xV=l_,ZE=lf,yV=_c,SV=NT,EV=DT;y_=class y_ extends ze()("effect/Cause/StackTrace"){};S_=class S_ extends ze()("effect/Cause/InterruptorStackTrace"){}});var Gt={};Un(Gt,{asVoid:()=>NV,asVoidAll:()=>DV,die:()=>E_,fail:()=>Rr,failCause:()=>lr,filterCause:()=>OV,filterFailure:()=>TV,filterSuccess:()=>IV,filterValue:()=>CV,findDefect:()=>_V,findError:()=>AV,findErrorOption:()=>LV,getCause:()=>UV,getSuccess:()=>$V,hasDies:()=>vV,hasFails:()=>wV,hasInterrupts:()=>kV,interrupt:()=>bV,isExit:()=>YE,isFailure:()=>ru,isSuccess:()=>Rt,map:()=>PV,mapBoth:()=>MV,mapError:()=>FV,match:()=>RV,succeed:()=>_r,void:()=>fr});var YE,_r,lr,Rr,E_,bV,fr,Rt,ru,wV,vV,kV,IV,CV,TV,OV,AV,_V,RV,PV,FV,MV,NV,DV,$V,UV,LV;var dr=w(()=>{rt();ht();YE=jy,_r=je,lr=pn,Rr=kr,E_=Kr,bV=_m,fr=Rn,Rt=hi,ru=tE,wV=xO,vV=gO,kV=hO,IV=fO,CV=dO,TV=pO,OV=ef,AV=nE,_V=mO,RV=SO,PV=rE,FV=oE,MV=sE,NV=EO,DV=iE,$V=bO,UV=wO,LV=vO});var jV="~effect/Deferred",BV,Wm=()=>{let e=Object.create(BV);return e.resumes=void 0,e.effect=void 0,e},va=(e)=>Bt((t)=>{if(e.effect)return t(e.effect);return e.resumes??=[],e.resumes.push(t),pe(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);if(r>=0)n.splice(r,1)})}),HV,b_,QE=(e)=>pe(()=>qV(e)),qV=(e)=>e.effect!==void 0,XE=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let r=0;r<n.length;r++)n[r](t)}return!0};var eb=w(()=>{X();ht();Qe();BV={[jV]:{_A:D,_E:D},pipe(){return le(this,arguments)}},HV=p(2,(e,t)=>pe(()=>XE(e,t))),b_=HV});var v_,k_,I_;var tb=w(()=>{PS();v_=as,k_=mm,I_=pm});var yf,ou,Sf,Km,Ef,yi,pr;var bf=w(()=>{ht();yf=xi,ou=of,Sf=tA,Km=Yr,Ef=eA,yi=XO,pr=SE});var O_="~effect/Layer",C_="~effect/Layer/MemoMap",WV=(e,t)=>(e.observers++,Zr(Yr(t,(n)=>e.finalizer(n)),e.effect)),A_=(e)=>M(e,O_),KV,__=(e)=>{let t=Object.create(KV);return t.build=e,t},nb=(e)=>__((t,n)=>{let r=yi(n);return nn(e(t,r),(o)=>o._tag==="Failure"?pr(r,o):ye)}),VV=(e)=>{let t=nb((n,r)=>n.getOrElseMemoize(t,r,e));return t},GV=(e,t,n,r)=>{let o=ou(),s=Wm(),i={observers:1,effect:va(s),finalizer:(a)=>ae(()=>{if(i.observers--,i.observers===0)return e.map.delete(t),pr(o,a);return ye})};return e.map.set(t,i),Yr(n,i.finalizer).pipe(K(()=>r(e,o)),nn((a)=>(i.effect=a,b_(s,a))))},rb,ob=()=>new rb,JV=(e)=>new rb(e),wf,sb,R_,Si=function(){if(arguments.length===1)return(e)=>Gm(os(arguments[0],e));return Gm(os(arguments[0],arguments[1]))},Gm=(e)=>__(gt(L(e))),su=function(){if(arguments.length===1)return(e)=>T_(arguments[0],e);return T_(arguments[0],arguments[1])},T_=(e,t)=>ZV(De(t,(n)=>os(e,n))),ZV=(e)=>VV((t,n)=>Sf(e,n)),P_=(e,t,n)=>{let r=yi(n,"parallel");return ar(e,(o)=>o.build(t,yi(r,"sequential")),{concurrency:e.length}).pipe(De((o)=>OC(...o)))},Jm=(...e)=>nb((t,n)=>P_(e,t,n)),F_=(e,t,n)=>nb((r,o)=>K(Array.isArray(t)?P_(t,r,o):t.build(r,o),(s)=>e.build(r,o).pipe(us(s),De((i)=>n(i,s))))),M_,N_;var wo=w(()=>{Ve();eb();X();rt();ht();Qe();he();bf();KV={[O_]:{_ROut:D,_E:D,_RIn:D},pipe(){return le(this,arguments)}};rb=class rb{get[C_](){return C_}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);if(n)return WV(n,t);return this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return ae(()=>{let r=this.get(e,t);if(r)return r;return GV(this,e,t,n)})}};wf=class wf extends ze()("effect/Layer/CurrentMemoMap"){static forkOrCreate(e){let t=Yp(e,wf);return t?JV(t):ob()}};sb=p(3,(e,t,n)=>Pn(De(e.build(t,n),tn(wf,t)),wf,t)),R_=p(2,(e,t)=>ce((n)=>sb(e,wf.forkOrCreate(n.context),t))),M_=p(2,(e,t)=>F_(e,t,D)),N_=p(2,(e,t)=>F_(e,t,(n,r)=>ua(r,n)))});var D_="~effect/ExecutionPlan",YV,QV=(e)=>{let t=Object.create(YV);return t.steps=e,t},$_;var U_=w(()=>{Ve();X();ht();wo();Qe();YV={[D_]:D_,get captureRequirements(){let e=this;return gi((t)=>L(QV(e.steps.map((n)=>({...n,provide:A_(n.provide)?M_(n.provide,Gm(t)):n.provide})))))},pipe(){return le(this,arguments)}},$_=ke("effect/ExecutionPlan/CurrentMetadata",{defaultValue:gt({attempt:0,stepIndex:0})})});var Zm="~effect/time/DateTime",Ym="~effect/time/DateTime/TimeZone",j_,o3,s3,B_,i3,a3,vo=(e,t,n)=>{let r=Object.create(s3);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},iu=(e)=>M(e,Zm),Ia=(e)=>M(e,Ym),H_=(e)=>Ia(e)&&e._tag==="Offset",q_=(e)=>Ia(e)&&e._tag==="Named",z_=(e)=>e._tag==="Utc",cb=(e)=>e._tag==="Zoned",W_,K_,V_=(e)=>{let t=Object.create(o3);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ka=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new xf("Invalid date");return V_(t)},ub=(e)=>{if(iu(e))return e;else if(e instanceof Date)return ka(e);else if(typeof e==="object"){if("epochMilliseconds"in e)return ka(new Date(e.epochMilliseconds));let t=new Date(0);return h3(t,e),ka(t)}else if(typeof e==="string"&&!c3(e))return ka(new Date(e+"Z"));return ka(new Date(e))},c3=(e)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),u3=-8639999956800000,l3=8639999949600000,lb=(e,t)=>{let n=t?.timeZone;if(n===void 0&&iu(e)&&cb(e))return e;let r=ub(e);if(r.epochMilliseconds<u3||r.epochMilliseconds>l3)throw RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);if(n===void 0&&typeof e==="object"&&"timeZoneId"in e)n=e.timeZoneId;let o;if(n===void 0){let s=new Date(r.epochMilliseconds).getTimezoneOffset()*-60*1000;o=If(s)}else if(Ia(n))o=n;else if(typeof n==="number")o=If(n);else{let s=pb(n);if(me(s))throw new xf(`Invalid time zone: ${n}`);o=s.value}if(t?.adjustForTimeZone!==!0)return vo(r.epochMilliseconds,o,r.partsUtc);return g3(r.epochMilliseconds,o,t?.disambiguation??"compatible")},ib,G_,f3,J_=(e)=>{let t=f3.exec(e);if(t===null){let o=xb(e);return o!==null?ib(e,{timeZone:o}):O()}let[,n,r]=t;return ib(n,{timeZone:r})},Z_=(e)=>V_(e.epochMilliseconds),kf,d3,p3=(e)=>{let t=e.resolvedOptions().timeZone;if(kf.has(t))return kf.get(t);let n=Object.create(i3);return n.id=t,n.format=e,kf.set(t,n),n},fb=(e)=>{if(kf.has(e))return kf.get(e);try{return p3(new Intl.DateTimeFormat("en-US",{...d3,timeZone:e}))}catch{throw new xf(`Invalid time zone: ${e}`)}},If=(e)=>{let t=Object.create(a3);return t.offset=e,t},db,m3,pb=(e)=>{if(m3.test(e)){let t=xb(e);return t===null?O():_(If(t))}return db(e)},Y_=(e)=>{if(e._tag==="Offset")return hb(e.offset);return e.id},Cf=(e)=>new Date(e.epochMilliseconds),Qm=(e)=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);else if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);else if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter((r)=>r.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},mb=(e)=>Qm(e).getTime()-gb(e),hb=(e)=>{let t=Math.abs(e),n=Math.floor(t/3600000),r=Math.round(t%3600000/60000);if(r===60)n+=1,r=0;return`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},Q_=(e)=>hb(mb(e)),gb=(e)=>e.epochMilliseconds,h3=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}if(t.hour!==void 0)e.setUTCHours(t.hour);if(t.minute!==void 0)e.setUTCMinutes(t.minute);if(t.second!==void 0)e.setUTCSeconds(t.second);if(t.millisecond!==void 0)e.setUTCMilliseconds(t.millisecond)},L_=86400000,g3=(e,t,n)=>{if(t._tag==="Offset")return vo(e-t.offset,t);let r=vf(e-L_,e,t),o=vf(e+L_,e,t);if(r===o)return vo(e-r,t);let s=r<o,i=r-o;if(s){if(vf(e-o,e,t)===o)return vo(e-o,t);let u=vo(e-r,t),l=Qm(u).getTime();if(e!==l)switch(n){case"reject":{let f=new Date(e).toISOString();throw RangeError(`Gap time: ${f} does not exist in time zone ${t.id}`)}case"earlier":return vo(e-o,t);case"compatible":case"later":return u}return u}if(vf(e-r,e,t)===r){if(n==="earlier"||n==="compatible")return vo(e-r,t);if(vf(e-r+i,e+i,t)===r)return vo(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return vo(e-o,t)},x3,xb=(e)=>{let t=x3.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1000},vf=(e,t,n)=>{let r=n.format.formatToParts(e).find((s)=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=xb(r);if(o===null)return mb(vo(t,n));return o},X_=(e)=>Cf(e).toISOString(),ab=(e)=>{let t=Qm(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${Q_(e)}`},yb=(e)=>e.zone._tag==="Offset"?ab(e):`${ab(e)}[${e.zone.id}]`;var eR=w(()=>{rn();yt();Xo();Xt();jn();_e();ia();Qe();he();j_={[Zm]:Zm,pipe(){return le(this,arguments)},[At](){return this.toString()},toJSON(){return Cf(this).toJSON()}},o3={...j_,_tag:"Utc",[Ie](){return Ln(this.epochMilliseconds)},[Ce](e){return iu(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Cf(this).toJSON()})`}},s3={...j_,_tag:"Zoned",[Ie](){return xt(Ln(this.epochMilliseconds))(re(this.zone))},[Ce](e){return iu(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Y(this.zone,e.zone)},toString(){return`DateTime.Zoned(${yb(this)})`}},B_={[Ym]:Ym,[At](){return this.toString()}},i3={...B_,_tag:"Named",[Ie](){return qe(`Named:${this.id}`)},[Ce](e){return Ia(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},a3={...B_,_tag:"Offset",[Ie](){return qe(`Offset:${this.offset}`)},[Ce](e){return Ia(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${hb(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},W_=Kt((e,t)=>e.epochMilliseconds===t.epochMilliseconds),K_=ts((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0),ib=ni(lb),G_=ni(ub),f3=/^(.{17,35})\[(.+)\]$/,kf=new Map,d3={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},db=ni(fb),m3=/^(?:GMT|[+-])/,x3=/([+-])(\d{2}):(\d{2})$/});function S3(e,t){let[n,r]=tR(e),[o,s]=tR(t),i=Math.min(r,s),a=n*BigInt(10)**BigInt(r-i),c=o*BigInt(10)**BigInt(s-i),u=a%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let l=globalThis.Number(`${u}e${i}`);return l===0?Math.sign(e)*globalThis.Number.MIN_VALUE:l}function tR(e){let t=Math.abs(e).toExponential(),n=t.indexOf("e"),r=t.slice(0,n).replace(".","");return[BigInt(r)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(n+1))-r.length+1]}var qce,nR,rR,oR,sR;var Xm=w(()=>{X();qce=globalThis.Number,nR=p(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e")){if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;return S3(e,t)}let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,i=o>s?o:s,a=parseInt(e.toFixed(i).replace(".","")),c=parseInt(t.toFixed(i).replace(".",""));return a%c/Math.pow(10,i)});rR=p(2,(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n}),oR=Ir((e,t)=>Math.max(e,t),-1/0),sR=Ir((e,t)=>Math.min(e,t),1/0)});var zce,aR=(e)=>e.trim(),cR=13,uR=10,lR,E3=(e)=>{let t=e.charCodeAt(0);return t===cR||t===uR},b3=(e,t)=>e.charCodeAt(0)===cR&&t.charCodeAt(0)===uR;var fR=w(()=>{zce=globalThis.String;lR=class lR{index;length;s;stripped;constructor(e,t=!1){this.s=e,this.stripped=t,this.index=0,this.length=e.length}next(){if(this.done)return{done:!0,value:void 0};let e=this.index;while(!this.done&&!E3(this.s[this.index]))this.index=this.index+1;let t=this.index;if(!this.done){let n=this.s[this.index];if(this.index=this.index+1,!this.done&&b3(n,this.s[this.index]))this.index=this.index+1;if(!this.stripped)t=this.index}return{done:!1,value:this.s.substring(e,t)}}[Symbol.iterator](){return new lR(this.s,this.stripped)}get done(){return this.index>=this.length}}});var mr,Tf=(e)=>e.reasons.some(Sb),Sb=(e)=>e._tag==="Fail"&&zm(e.error),eh=(e)=>{let t,n=!1;for(let r of e.reasons)if(Sb(r))t??=r.error;else if(r._tag!=="Interrupt")n=!0;if(t===void 0)return te(e);return n?te(wa(e.reasons.filter((r)=>!Sb(r)))):G(t)},v3=(e)=>{let t=eh(e);return xe(t)?t:G(t.success.value)},Eb=(e)=>{let t=eh(e);return!xe(t)?_r(t.success.value):lr(t.failure)},th;var Ca=w(()=>{rn();dr();X();ht();gn();mr=p(2,(e,t)=>tu(e,v3,(n)=>t(n))),th=p(2,(e,t)=>Jr(e,{onSuccess:t.onSuccess,onFailure:(n)=>{let r=eh(n);return!xe(r)?t.onDone(r.success.value):t.onFailure(r.failure)}}))});var dR="~effect/Schedule",Ta,k3,bb=(e)=>M(e,dR),wb=(e)=>{let t=Object.create(k3);return t.step=e,t},vb=()=>{let e=0,t,n;return(r,o)=>{if(n===void 0)n=r;let s=r-n,i=t===void 0?0:r-t;return t=r,{input:o,attempt:++e,start:n,now:r,elapsed:s,elapsedSincePrevious:i}}},I3=(e)=>wb(De(e,(t)=>{let n=vb();return(r,o)=>t(n(r,o))})),kb=(e)=>cr(e.step,(t)=>L(()=>Be(t))),nh=(e)=>bo((t)=>De(kb(e),(n)=>{let r=vb();return(o)=>ae(()=>{let s=t.currentTimeMillisUnsafe();return K(n(s,o),([i,a])=>{let c=r(s,o);return c.output=i,c.duration=a,xn(ba(a),c)})})})),Ib=(e)=>wb(De(kb(e),(t)=>(n,r)=>th(t(n,r),{onSuccess:(o)=>L([r,o[1]]),onFailure:Be,onDone:()=>_t(r)}))),pR=(e)=>Of(Cb,({attempt:t})=>L(t<=e)),C3=(e)=>{let t=sr(e);return I3(L((n)=>L([n.attempt-1,t])))},Of,Cb;var Tb=w(()=>{rn();Ve();ai();X();rt();ht();Qe();he();Ca();Ta=ke("effect/Schedule/CurrentMetadata",{defaultValue:gt({input:void 0,output:void 0,duration:Hc,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),k3={[dR]:{_Out:D,_In:D,_Env:D},pipe(){return le(this,arguments)}},Of=p(2,(e,t)=>wb(De(kb(e),(n)=>{let r=vb();return(o,s)=>K(n(o,s),(i)=>{let[a,c]=i,u=t({...r(o,s),output:a,duration:c});return K(fe(u)?u:L(u),(l)=>l?L(i):_t(a))})}))),Cb=C3(Hc)});var T3=(e,t,n)=>Um((r)=>K(n?.local?sb(t,ob(),r):R_(t,r),(o)=>us(e,o))),rh;var Ob=w(()=>{Ve();X();wo();rt();ht();rh=p((e)=>fe(e[0]),(e,t,n)=>rS(t)?us(e,t):T3(e,Array.isArray(t)?Jm(...t):t,n))});var Ab,_b,gR,Af,xR,O3,_f=(e)=>{let t=e.schedule?Ib(e.schedule):O3;if(e.while)t=Of(t,({input:n})=>{let r=e.while(n);return fe(r)?r:L(r)});if(e.until)t=Of(t,({input:n})=>{let r=e.until(n);return fe(r)?De(r,(o)=>!o):L(!r)});if(e.times!==void 0)t=Of(t,({attempt:n})=>L(n<=e.times));return t};var Rb=w(()=>{X();_e();Ca();Tb();Qi();rt();ht();Ab=p(3,(e,t,n)=>K(nh(t),(r)=>{let o=Ta.defaultValue();return ur(Pm(ya(K(ae(()=>Pn(e,Ta,o)),r),(s)=>pe(()=>{o=s})),{disableYield:!0}),(s)=>_l(s)?L(s.value):n(s,o.attempt===0?O():_(o)))})),_b=p(3,(e,t,n)=>K(nh(t),(r)=>{let o=Ta.defaultValue(),s,i=ur(ae(()=>Pn(e,Ta,o)),(a)=>(s=a,K(r(a),(c)=>(o=c,i))));return mr(i,(a)=>Ae(()=>n(s,a)))})),gR=p(2,(e,t)=>{let n=typeof t==="function"?t(D):bb(t)?t:_f(t);return Ab(e,n,nt)}),Af=p(2,(e,t)=>{let n=typeof t==="function"?t(D):bb(t)?t:_f(t);return _b(e,n,nt)}),xR=p(3,(e,t,n)=>K(nh(n),(r)=>{let o=Ta.defaultValue(),s=ae(()=>Pn(e,Ta,o));return ur(K(r(t),(i)=>{o=i;let a=gt(K(s,r));return Eo({while:nr,body:a,step(c){o=c}})}),(i)=>_l(i)?L(i.value):nt(i))})),O3=Ib(Cb)});var A3=(e,t)=>{let n=-1,r=0,o=(s)=>Nm(e(s));return{begin:bo((s)=>ae(()=>{let i=t();if(i.stepIndex!==n)n=i.stepIndex,r=0;r++;let a={attempt:i.attempt,stepAttempt:r,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return xn(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>bo((a)=>{let c=Tr(a.monotonicTimeNanosUnsafe()-s.startNanos);return o(i._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:i.cause})})}},ER,SR=(e,t)=>{if(!t)return _f({schedule:e.schedule?e.schedule:e.attempts?void 0:_3,times:e.attempts,while:e.while});else if(e.attempts===1||!(e.schedule||e.attempts))return;return _f({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},_3;var bR=w(()=>{ai();U_();X();gn();Tb();rt();ht();Ob();Rb();ER=p((e)=>fe(e[0]),(e,t,n)=>ae(()=>{let r=0,o={attempt:0,stepIndex:0},s=Rm($_,pe(()=>(o={attempt:o.attempt+1,stepIndex:r},o))),i=n?.onEvent===void 0?void 0:A3(n.onEvent,()=>o),a=i===void 0?D:(u)=>Qr((l)=>K(i.begin,(f)=>nn(l(u),(d)=>i.end(f,d)))),c;return K(Eo({while:()=>r<t.steps.length&&(c===void 0||xe(c)),body(){let u=t.steps[r],l=s(a(rh(e,u.provide)));if(c){let f=!1,d=l;l=ae(()=>{if(f)return d;return f=!0,Yc(c)}),l=Af(l,SR(u,!1))}else{let f=SR(u,!0);l=f?Af(l,f):l}return fi(l)},step(u){c=u,r++}}),()=>Yc(c))})),_3=pR(1)});var P3="~effect/Request",F3,iue,wR=(e)=>e;var vR=w(()=>{yt();rt();F3=$y({_E:(e)=>e,_A:(e)=>e,_R:(e)=>e}),iue={...Q0,[P3]:F3}});function kR(e){if(!e.map.has(e.key))return ye;return e.map.delete(e.key),e.run}var IR,CR=(e,t)=>{let n=TR(t.resolver,e,t.onExit,{context:t.context,currentScheduler:On(t.context,jl)});return()=>OR(t.resolver,n)},oh,Pb,TR=(e,t,n,r)=>{let o=Pb.get(e);if(!o)o=new Map,Pb.set(e,o);let s,i=!1,a=wR({request:t,context:r.context,uninterruptible:!1,completeUnsafe(u){if(i)return;i=!0,n(u),s?.entrySet.delete(a)}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(oh.length>0)s=oh.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:K(ae(()=>u.resolver.delay),(l)=>kR(u)),run:nn(ae(()=>u.resolver.runAll(Array.from(u.entries),u.key)),(l)=>{for(let f of u.entrySet)f.completeUnsafe(l._tag==="Success"?Kr(Error("Effect.request: RequestResolver did not complete request",{cause:f.request})):l);if(u.entries.clear(),oh.length<128)u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,oh.push(u);return ye})};s=u}o.set(c,s),s.fiber=ds(r.context)(s.delayEffect,{scheduler:r.currentScheduler})}if(s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries))return a;return s.fiber.interruptUnsafe(r.id),s.fiber=ds(r.context)(kR(s),{scheduler:r.currentScheduler}),a},OR=(e,t)=>{if(t.uninterruptible)return;let n=Pb.get(e);if(!n)return;let r=e.batchKey(t),o=n.get(r);if(!o)return;if(o.entries.delete(t),o.entrySet.delete(t),o.entries.size===0)n.delete(r),o.fiber?.interruptUnsafe()},M3=(e,t)=>pe(()=>OR(e,t));var AR=w(()=>{Ve();X();vR();om();rt();ht();IR=p(2,(e,t)=>{let n=(r)=>Bt((o)=>{let s=TR(r,e,o,pi());return M3(r,s)});return fe(t)?K(t,n):n(t)}),oh=[],Pb=new WeakMap});function B3(e,t){let n=`${e.type}:${e.id}`;if(Le(e.description))n+=`:${e.description}`;if(Le(t))n+=`:${H3(t)}`;return n}function H3(e){return JSON.stringify(Array.isArray(e)?e:Object.entries(e))}function q3(e,t){return{...Fb(e),...Fb(t)}}function Fb(e){if(Le(e)&&Array.isArray(e))return e.reduce((t,[n,r])=>(U(t,n,r),t),{});return e}var D3="effect/Metric/CurrentMetricAttributes",$3,U3="~effect/observability/Metric/MetricRegistryKey",L3,_R="~effect/observability/Metric",j3,cu;var RR=w(()=>{Ve();X();ht();Qe();he();$3=ke(D3,{defaultValue:()=>({})}),L3=ke(U3,{defaultValue:()=>new Map});j3=class j3{[_R]=_R;#t=new WeakMap;#e;id;description;attributes;constructor(e,t,n){this.id=e,this.description=t,this.attributes=n}valueUnsafe(e){return this.hook(e).get(e)}modifyUnsafe(e,t){return this.hook(t).modify(e,t)}updateUnsafe(e,t){return this.hook(t).update(e,t)}hook(e){let t=On(e,$3);if(Object.keys(t).length===0){if(Le(this.#e))return this.#e.hooks;return this.#e=this.getOrCreate(e,this.attributes),this.#e.hooks}let n=q3(this.attributes,t),r=this.#t.get(n);if(Le(r))return r.hooks;return r=this.getOrCreate(e,n),this.#t.set(n,r),r.hooks}getOrCreate(e,t){let n=B3(this,t),r=On(e,L3);if(r.has(n))return r.get(n);let o=this.createHooks(),s={id:this.id,type:this.type,description:this.description,attributes:Fb(t),hooks:o};return r.set(n,s),s}pipe(){return le(this,arguments)}};cu=p(2,(e,t)=>gi((n)=>pe(()=>e.updateUnsafe(t,n))))});var j={};Un(j,{Do:()=>X3,Transaction:()=>Rf,TypeId:()=>W3,abortSignal:()=>iJ,acquireDisposable:()=>ZG,acquireRelease:()=>Mr,acquireUseRelease:()=>WR,addFinalizer:()=>dh,all:()=>FR,andThen:()=>hr,annotateCurrentSpan:()=>xJ,annotateLogs:()=>GJ,annotateLogsScoped:()=>JJ,annotateSpans:()=>gJ,as:()=>gr,asSome:()=>DR,asVoid:()=>Ff,awaitAllChildren:()=>RJ,bind:()=>nG,bindTo:()=>eG,cached:()=>tJ,cachedInvalidateWithTTL:()=>rJ,cachedWithTTL:()=>nJ,callback:()=>yn,catch:()=>Pr,catchCause:()=>xr,catchCauseFilter:()=>hG,catchCauseIf:()=>mG,catchDefect:()=>Lb,catchEager:()=>Bf,catchFilter:()=>Mf,catchIf:()=>dG,catchNoSuchElement:()=>pG,catchReason:()=>uG,catchReasons:()=>lG,catchTag:()=>gs,catchTags:()=>Ub,clockWith:()=>jf,context:()=>lh,contextWith:()=>qR,currentParentSpan:()=>SJ,currentSpan:()=>yJ,delay:()=>jR,die:()=>ko,effectify:()=>ot,ensuring:()=>pu,eventually:()=>EG,exit:()=>bi,fail:()=>A,failCause:()=>fu,failCauseSync:()=>Ei,failSync:()=>Nb,fiber:()=>PJ,fiberId:()=>FJ,filter:()=>Hb,filterMap:()=>MG,filterMapEffect:()=>HR,filterMapOrElse:()=>DG,filterMapOrFail:()=>UG,filterOrElse:()=>NG,filterOrFail:()=>$G,findFirst:()=>J3,findFirstFilter:()=>Z3,firstSuccessOf:()=>OG,flatMap:()=>ne,flatMapEager:()=>on,flatten:()=>NR,flip:()=>cG,fn:()=>jJ,fnUntraced:()=>H,fnUntracedEager:()=>hh,forEach:()=>Oa,forever:()=>Co,forkChild:()=>Vb,forkDetach:()=>_J,forkIn:()=>gu,forkScoped:()=>xu,fromNullishOr:()=>iG,fromOption:()=>oG,fromResult:()=>$b,gen:()=>qt,head:()=>Y3,ignore:()=>Nf,ignoreCause:()=>kG,interrupt:()=>hu,interruptible:()=>oJ,interruptibleMask:()=>sJ,isEffect:()=>zn,isFailure:()=>zG,isSuccess:()=>WG,let:()=>tG,linkSpans:()=>wJ,log:()=>BJ,logDebug:()=>WJ,logError:()=>mh,logFatal:()=>HJ,logInfo:()=>zJ,logTrace:()=>KJ,logWarning:()=>qJ,logWithLevel:()=>QR,makeSpan:()=>JR,makeSpanScoped:()=>vJ,map:()=>oe,mapBoth:()=>gG,mapBothEager:()=>Jt,mapEager:()=>Ss,mapError:()=>Pt,mapErrorEager:()=>Ra,match:()=>wi,matchCause:()=>BG,matchCauseEager:()=>HG,matchCauseEffect:()=>qb,matchCauseEffectEager:()=>qG,matchEager:()=>jG,matchEffect:()=>uh,never:()=>sh,onError:()=>mu,onErrorFilter:()=>QG,onErrorIf:()=>YG,onExit:()=>ys,onExitFilter:()=>eJ,onExitIf:()=>XG,onExitPrimitive:()=>KR,onInterrupt:()=>VR,option:()=>aG,orDie:()=>Fr,orElseSucceed:()=>TG,partition:()=>K3,promise:()=>MR,provide:()=>zb,provideContext:()=>xs,provideService:()=>Io,provideServiceEffect:()=>Wb,race:()=>FG,raceAll:()=>BR,raceAllFirst:()=>PG,raceFirst:()=>_a,reduce:()=>V3,repeat:()=>aJ,repeatOrElse:()=>cJ,replicate:()=>uJ,replicateEffect:()=>lJ,request:()=>OJ,requestUnsafe:()=>AJ,result:()=>ih,retry:()=>bG,retryOrElse:()=>wG,runCallback:()=>NJ,runCallbackWith:()=>MJ,runFork:()=>To,runForkWith:()=>Lf,runPromise:()=>ZR,runPromiseExit:()=>ph,runPromiseExitWith:()=>DJ,runPromiseWith:()=>YR,runSync:()=>$J,runSyncExit:()=>ki,runSyncExitWith:()=>LJ,runSyncWith:()=>UJ,sandbox:()=>vG,satisfiesErrorType:()=>c4,satisfiesServicesType:()=>u4,satisfiesSuccessType:()=>a4,schedule:()=>fJ,scheduleFrom:()=>GR,scope:()=>Df,scoped:()=>vi,scopedWith:()=>Kb,service:()=>zR,serviceOption:()=>fh,setContext:()=>KG,sleep:()=>ch,spanAnnotations:()=>EJ,spanLinks:()=>bJ,succeed:()=>v,succeedNone:()=>Aa,succeedSome:()=>Mb,suspend:()=>Ne,sync:()=>Se,tap:()=>du,tapCause:()=>ah,tapCauseFilter:()=>SG,tapCauseIf:()=>yG,tapDefect:()=>LR,tapError:()=>jb,tapErrorTag:()=>xG,timed:()=>RG,timeout:()=>AG,timeoutOption:()=>_G,timeoutOrElse:()=>Bb,tracer:()=>dJ,track:()=>YJ,trackDefects:()=>e4,trackDuration:()=>t4,trackErrors:()=>XJ,trackSuccesses:()=>QJ,transposeOption:()=>sG,try:()=>Nt,tryPromise:()=>lu,tx:()=>n4,txRetry:()=>i4,undefined:()=>Q3,uninterruptible:()=>$f,uninterruptibleMask:()=>Uf,unwrapReason:()=>fG,updateContext:()=>VG,updateService:()=>GG,updateServiceScoped:()=>JG,useSpan:()=>kJ,validate:()=>G3,void:()=>Te,when:()=>LG,whileLoop:()=>uu,withErrorReporting:()=>CG,withExecutionPlan:()=>IG,withFiber:()=>Pf,withLogSpan:()=>ZJ,withLogger:()=>VJ,withParentSpan:()=>TJ,withSpan:()=>IJ,withSpanScoped:()=>CJ,withTracer:()=>pJ,withTracerEnabled:()=>mJ,withTracerTiming:()=>hJ,yieldNow:()=>Db,yieldNowWith:()=>rG,zip:()=>$R,zipWith:()=>UR});function s4(e,t){for(let[n,{value:r}]of t.journal){if(r!==n.value)n.version=n.version+1,n.value=r;for(let o of n.pending.values())e.currentDispatcher.scheduleTask(o,0);n.pending.clear()}}function PR(e){e.retry=!1,e.journal.clear()}var W3,zn,FR,K3,V3,G3,J3,Z3,Oa,Y3,uu,MR,lu,v,Aa,Mb,Ne,Se,Te,Q3,yn,sh,X3,eG,tG,nG,qt,A,Nb,fu,Ei,ko,Nt,Db,rG,Pf,$b,oG,sG,iG,ne,NR,hr,du,ih,aG,bi,oe,gr,DR,Ff,cG,$R,UR,Pr,gs,Ub,uG,lG,fG,xr,Lb,dG,Mf,pG,mG,hG,Pt,gG,Fr,jb,xG,ah,yG,SG,LR,EG,bG,wG,vG,Nf,kG,IG,CG,TG,OG,AG,_G,Bb,jR,ch,RG,BR,PG,FG,_a,Hb,MG,HR,NG,DG,$G,UG,LG,wi,jG,BG,HG,qG,qb,uh,zG,WG,lh,qR,zb,xs,KG,zR,fh,VG,GG,JG,Io,Wb,Df,vi,Kb,Mr,ZG,WR,dh,pu,mu,YG,QG,KR,ys,XG,eJ,tJ,nJ,rJ,hu,oJ,VR,$f,Uf,sJ,iJ,Co,aJ,cJ,uJ,lJ,fJ,GR,dJ,pJ,mJ,hJ,gJ,xJ,yJ,SJ,EJ,bJ,wJ,JR,vJ,kJ,IJ,CJ,TJ,OJ,AJ,Vb,gu,xu,_J,RJ,PJ,FJ,To,Lf,MJ,NJ,ZR,YR,ph,DJ,$J,UJ,ki,LJ,H,jJ,jf,QR,BJ,HJ,qJ,mh,zJ,WJ,KJ,VJ,GJ,JJ,ZJ,YJ,QJ,XJ,e4,t4,Rf,n4=(e)=>Pf((t)=>{let n=Yp(t.context,Rf);if(n)return e;n={journal:new Map,retry:!1};let r;return Uf((o)=>ne(uu({while:()=>!r,body:gt(o(e).pipe(Io(Rf,n),ah(()=>{if(!n.retry)return Te;return o(o4(n))}),bi)),step(s){if(n.retry||!r4(n))return PR(n);if(Rt(s))s4(t,n);else PR(n);r=s}}),()=>r))}),r4=(e)=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},o4=(e)=>Ne(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let o of n)o.pending.delete(t)};return yn((o)=>{let s=()=>{r(),o(Te)};for(let i of n)i.pending.set(t,s);return Se(r)})}),i4,ot=(e,t,n)=>(...r)=>yn((o)=>{try{e(...r,(s,i)=>{if(s)o(A(t?t(s,r):s));else o(v(i))})}catch(s){o(n?A(n(s,r)):ko(s))}}),a4=()=>(e)=>e,c4=()=>(e)=>e,u4=()=>(e)=>e,Ss,Ra,Jt,on,Bf,hh;var Oe=w(()=>{Ve();ai();dr();X();rt();ht();bR();Ob();AR();Rb();RR();tb();Qi();W3=xo,zn=fe,FR=cf,K3=RE,V3=dA,G3=pA,J3=mA,Z3=gA,Oa=ar,Y3=yA,uu=Eo,MR=JS,lu=GT,v=L,Aa=xa,Mb=GS,Ne=ae,Se=pe,Te=ye,Q3=zE,yn=Bt,sh=Om,X3=kA,eG=IA,tG=TA,nG=CA,qt=QT,A=nt,Nb=Tm,fu=Be,Ei=KT,ko=mi,Nt=VT,Db=Qc,rG=VS,Pf=ce,$b=Yc,oG=KS,sG=WT,iG=zT,ne=K,NR=iO,hr=Zr,du=ya,ih=fi,aG=WO,bi=rf,oe=De,gr=xn,DR=Xc,Ff=Xl,cG=tO,$R=OO,UR=cE,Pr=ur,gs=dE,Ub=UO,uG=LO,lG=jO,fG=BO,xr=cr,Lb=FO,dG=tf,Mf=Mm,pG=PO,mG=lE,hG=tu,Pt=pE,gG=mE,Fr=hE,jb=fE,xG=DO,ah=MO,yG=NO,SG=Fm,LR=$O,EG=gE,bG=Af,wG=_b,vG=nO,Nf=zO,kG=Nm,IG=ER,CG=m_,TG=HO,OG=qO,AG=ZO,_G=YO,Bb=yE,jR=JO,ch=ba,RG=QO,BR=XS,PG=eE,FG=rO,_a=Am,Hb=bA,MG=wA,HR=vA,NG=PE,DG=FE,$G=AO,UG=EA,LG=_O,wi=Dm,jG=nf,BG=xE,HG=KO,qG=oO,qb=Jr,uh=Sa,zG=VO,WG=GO,lh=aE,qR=gi,zb=rh,xs=us,KG=TO,zR=kO,fh=IO,VG=eu,GG=cs,JG=CO,Io=Pn,Wb=Rm,Df=sf,vi=bE,Kb=Um,Mr=af,ZG=sA,WR=TE,dh=wE,pu=nA,mu=IE,YG=rA,QG=CE,KR=ls,ys=nn,XG=vE,eJ=kE,tJ=iA,nJ=AE,rJ=OE,hu=aA,oJ=_E,VR=oA,$f=fs,Uf=Qr,sJ=lA,iJ=fA,Co=Pm,aJ=gR,cJ=Ab,uJ=uE,lJ=RO,fJ=p(2,(e,t)=>GR(e,void 0,t)),GR=xR,dJ=jA,pJ=BA,mJ=HA,hJ=qA,gJ=QA,xJ=XA,yJ=e_,SJ=t_,EJ=VA,bJ=GA,wJ=JA,JR=WA,vJ=Wl,kJ=Kl,IJ=YA,CJ=KA,TJ=Zc,OJ=IR,AJ=CR,Vb=OA,gu=ME,xu=RA,_J=AA,RJ=_A,PJ=ZT,FJ=YT,To=FA,Lf=ds,MJ=NE,NJ=MA,ZR=DA,YR=DE,ph=NA,DJ=jm,$J=UA,UJ=$E,ki=$A,LJ=Bm,H=YS,jJ=XT,jf=bo,QR=Xr,BJ=Xr(),HJ=Xr("Fatal"),qJ=Xr("Warn"),mh=Xr("Error"),zJ=Xr("Info"),WJ=Xr("Debug"),KJ=Xr("Trace"),VJ=p(2,(e,t)=>cs(e,qE,(n)=>new Set([...n,t]))),GJ=p((e)=>zn(e[0]),(e,...t)=>cs(e,v_,(n)=>{let r=t.length===1?{...n,...t[0]}:{...n};if(t.length===1)return r;else U(r,t[0],t[1]);return r})),JJ=d_,ZJ=p(2,(e,t)=>K(s_,(n)=>cs(e,k_,(r)=>[[t,n],...r]))),YJ=p((e)=>zn(e[0]),(e,t,n)=>ys(e,(r)=>{let o=n===void 0?r:Ae(()=>n(r));return cu(t,o)})),QJ=p((e)=>zn(e[0]),(e,t,n)=>du(e,(r)=>{let o=n===void 0?r:n(r);return cu(t,o)})),XJ=p((e)=>zn(e[0]),(e,t,n)=>jb(e,(r)=>{let o=n===void 0?r:Ae(()=>n(r));return cu(t,o)})),e4=p((e)=>zn(e[0]),(e,t,n)=>LR(e,(r)=>{let o=n===void 0?r:Ae(()=>n(r));return cu(t,o)})),t4=p((e)=>zn(e[0]),(e,t,n)=>jf((r)=>{let o=r.monotonicTimeNanosUnsafe();return ys(e,()=>{let s=r.monotonicTimeNanosUnsafe(),i=ZC(sr(s),sr(o)),a=n===void 0?i:Ae(()=>n(i));return cu(t,a)})}));Rf=class Rf extends ze()("effect/Effect/Transaction"){};i4=ne(Rf,(e)=>(e.retry=!0,hu)),Ss=aO,Ra=cO,Jt=uO,on=sO,Bf=lO,hh=eO});var l4=(e,t)=>{if(Rt(e))return t(0);if(hf(e.cause))return t(130);return t(f4(nu(e.cause)))},XR=(e)=>p((t)=>zn(t[0]),(t,n)=>{let r=n?.disableErrorReporting===!0?To(t):To(ah(t,(s)=>{if(hf(s))return Te;return d4(nu(s))?mh(s):Te}));try{let s=globalThis.setInterval(Vo,2147483647);r.addObserver(()=>{clearInterval(s)})}catch{}let o=n?.teardown??l4;return e({fiber:r,teardown:o})}),gh="~effect/Runtime/errorExitCode",f4=(e)=>{if(typeof e==="object"&&e!==null&&gh in e){let t=e[gh];if(typeof t==="number")return t}return 1},Pa="~effect/Runtime/errorReported",d4=(e)=>{if(typeof e==="object"&&e!==null&&Pa in e){let t=e[Pa];if(typeof t==="boolean")return t}return!0};var xh=w(()=>{rn();Oe();dr();X()});var eP;var tP=w(()=>{xh();eP=XR(({fiber:e,teardown:t})=>{let n=!1;e.addObserver((o)=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r),t(o,(s)=>{if(n||s!==0)process.exit(s)})});function r(){n=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",r),process.on("SIGTERM",r)})});var yh={};Un(yh,{runMain:()=>m4});var m4;var nP=w(()=>{tP();m4=eP});var rP="~effect/platform/PlatformError",Es,oP,Jb,Nr=(e)=>new Jb(new oP(e)),bs=(e)=>new Jb(new Es(e));var Oo=w(()=>{Wc();Es=class Es extends ci("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}};oP=class oP extends bS{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}};Jb=class Jb extends ci("PlatformError"){constructor(e){if("cause"in e)super({reason:e,cause:e.cause});else super({reason:e})}[rP]=rP;get message(){return this.reason.message}}});function g4(e,t,n,r,o){for(let s=t;s<Math.min(e.length,t+o);s++)n[r+s-t]=e[s];return n}var sP="~effect/collections/Chunk",iP,Yb=(e)=>Kt((t,n)=>t.length===n.length&&Hf(t).every((r,o)=>e(r,qf(n,o)))),x4,y4,Qb=(e)=>{let t=Object.create(y4);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=ws,t.right=ws;break}case"ISingleton":{t.length=1,t.depth=0,t.left=ws,t.right=ws;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=ws,t.right=ws;break}}return t},Eh=(e)=>M(e,sP),ws,S4=()=>ws,E4=(e)=>Qb({_tag:"ISingleton",a:e}),bh=(e)=>Eh(e)?e:w4(Lt(e)),Zb=(e,t,n)=>{switch(e.backing._tag){case"IArray":{g4(e.backing.array,0,t,n,e.length);break}case"IConcat":{Zb(e.left,t,n),Zb(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;while(r<e.length)t[o]=qf(e,r),r+=1,o+=1;break}}},b4=(e)=>{switch(e.backing._tag){case"IEmpty":return iP;case"IArray":return e.backing.array;default:{let t=Array(e.length);return Zb(e,t,0),e.backing={_tag:"IArray",array:t},e.left=ws,e.right=ws,e.depth=0,t}}},Hf,w4=(e)=>e.length===0?S4():e.length===1?E4(e[0]):Qb({_tag:"IArray",array:e}),qf,aP=(e)=>e.length;var cP=w(()=>{An();yt();Xo();kn();X();Xt();jn();Qe();he();iP=[],x4=Yb(Y),y4={[sP]:{_A:(e)=>e},toString(){return`Chunk(${B(Hf(this))})`},toJSON(){return{_id:"Chunk",values:Wt(Hf(this))}},[At](){return this.toJSON()},[Ce](e){return Eh(e)&&x4(this,e)},[Ie](){return vc(Hf(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return iP[Symbol.iterator]();default:return Hf(this)[Symbol.iterator]()}},pipe(){return le(this,arguments)}},ws=Qb({_tag:"IEmpty"}),Hf=b4,qf=p(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?qf(e.left,n):qf(e.right,n-e.left.length);case"ISlice":return qf(e.backing.chunk,n+e.backing.offset)}})});var uP,lP;var fP=w(()=>{ht();uP=Cm,lP=PA});var dP;var pP=w(()=>{ht();dP=UE});var mP="~effect/MutableRef",C4,hP=(e)=>{let t=Object.create(C4);return t.current=e,t};var gP=w(()=>{jn();rt();C4={[mP]:mP,...Cn,toJSON(){return{_id:"MutableRef",current:Wt(this.current)}}}});var O4,yP=()=>({head:void 0,tail:void 0,length:0}),xP=()=>({array:[],mutable:!0,offset:0,next:void 0}),vs=(e,t)=>{if(!e.tail)e.head=e.tail=xP();else if(!e.tail.mutable)e.tail.next=xP(),e.tail=e.tail.next;e.tail.array.push(t),e.length++},yu=(e)=>{e.head=e.tail=void 0,e.length=0},SP=(e,t)=>{if(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 yu(e),s}let n=Array(t),r=0,o=e.head;while(o){while(o.offset<o.array.length){if(n[r++]=o.array[o.offset],o.mutable)o.array[o.offset]=void 0;if(o.offset++,r===t){if(e.head=o,e.length-=t,e.length===0)yu(e);return n}}o=o.next}return yu(e),n},Su=(e)=>{if(!e.head)return O4;let t=e.head.array[e.head.offset];if(e.head.mutable)e.head.array[e.head.offset]=void 0;if(e.head.offset++,e.length--,e.head.offset===e.head.array.length)if(e.head.next)e.head=e.head.next;else yu(e);return t};var EP=w(()=>{O4=Symbol.for("effect/MutableList/Empty")});var _4="~effect/Queue",R4="~effect/Queue/Enqueue",P4="~effect/Queue/Dequeue",Xb,F4,bu=(e)=>ce((t)=>{let n=Object.create(F4);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=yP(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},L(n)}),bP=(e)=>bu({capacity:e}),zf=(e,t)=>ae(()=>{if(e.state._tag!=="Open")return vh;else if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return vh;case"suspend":if(e.capacity<=0&&e.state.takers.size>0)return vs(e.messages,t),tw(e),wh;return U4(e,t);case"sliding":return Su(e.messages),vs(e.messages,t),wh}return vs(e.messages,t),CP(e),wh}),Wf=(e,t)=>{if(e.state._tag!=="Open")return!1;else if(e.messages.length>=e.capacity){if(e.strategy==="sliding")return Su(e.messages),vs(e.messages,t),!0;else if(e.capacity<=0&&e.state.takers.size>0)return vs(e.messages,t),tw(e),!0;return!1}return vs(e.messages,t),CP(e),!0},Kf,Vf=(e,t)=>{if(e.state._tag!=="Open")return!1;let n=pn(t),r=yO(n,N4);if(e.state.offers.size===0&&e.messages.length===0)return nw(e,r),!0;return e.state={...e.state,_tag:"Closing",exit:r},!0},ks=(e)=>Vf(e,Ol(Rc())),ew=(e)=>pe(()=>{if(e.state._tag==="Done")return!0;yu(e.messages);let t=e.state.offers;if(nw(e,e.state._tag==="Open"?D4:e.state.exit),t.size>0){for(let n of t)if(n._tag==="Single")n.resume(vh);else n.resume(je(n.remaining.slice(n.offset)));t.clear()}return!0}),wP=(e)=>vP(e,1,Number.POSITIVE_INFINITY),vP=(e,t,n)=>ae(()=>$4(e,t,n)??Zr(TP(e),vP(e,1,n))),Is=(e)=>ae(()=>IP(e)??Zr(TP(e),Is(e))),kP=(e)=>ae(()=>{let t=IP(e);if(t===void 0)return L(O());if(t._tag==="Success")return L(_(t.value));return L(O())}),IP=(e)=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=Su(e.messages);return Eu(e),je(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Eu(e),e.capacity=0;let t=Su(e.messages);return Eu(e),je(t)}return},M4=(e)=>e.state._tag==="Done"?0:e.messages.length,vh,wh,N4,D4,tw=(e)=>{if(e.scheduleRunning=!1,e.state._tag==="Done"||e.state.takers.size===0)return;for(let t of e.state.takers)if(e.state.takers.delete(t),t(Rn),e.messages.length===0)break},CP=(e)=>{if(e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0)return;e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>tw(e),0)},$4=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;else if(n<=0||t<=0)return je([]);else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Eu(e),e.capacity=0;let r=[Su(e.messages)];return Eu(e),je(r)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let r=SP(e.messages,n);return Eu(e),je(r)}},U4=(e,t)=>Bt((n)=>{if(e.state._tag!=="Open")return n(vh);let r={_tag:"Single",message:t,resume:n};return e.state.offers.add(r),pe(()=>{if(e.state._tag==="Open")e.state.offers.delete(r)})}),Eu=(e)=>{if(e.state._tag==="Done")return Tf(e.state.exit.cause);else if(e.state.offers.size===0){if(e.state._tag==="Closing"&&e.messages.length===0)return nw(e,e.state.exit),Tf(e.state.exit.cause);return!1}let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag==="Single")vs(e.messages,n.message),t--,n.resume(wh),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;vs(e.messages,n.remaining[n.offset]),t--}n.resume(je([])),e.state.offers.delete(n)}return!1},TP=(e)=>Bt((t)=>{if(e.state._tag==="Done")return t(e.state.exit);return e.state.takers.add(t),pe(()=>{if(e.state._tag!=="Done")e.state.takers.delete(t)})}),nw=(e,t)=>{if(e.state._tag==="Done")return;let n=e.state;e.state={_tag:"Done",exit:t};for(let r of n.takers)r(t);n.takers.clear();for(let r of n.awaiters)r(t);n.awaiters.clear()};var Gf=w(()=>{X();rt();rt();ht();EP();_e();Ca();Xb={_A:D,_E:D},F4={[_4]:Xb,[R4]:Xb,[P4]:Xb,...Cn,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:M4(this)}}},Kf=p(2,(e,t)=>pe(()=>Vf(e,t))),vh=je(!1),wh=je(!0),N4=kr(Rc()),D4=_m()});class _P{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=ae(()=>{if(this.free<e)return OP(this,e,t);return this.taken+=e,L(e)});return t}takeIfAvailable(e){return ae(()=>{if(this.free<e)return L(!1);return this.taken+=e,L(!0)})}releaseUnsafe(e,t){if(this.taken-=t,this.waiters.size>0)e.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0);return this.free}resize(e){return ce((t)=>{if(this.permits=e,this.free<0)return ye;return this.releaseUnsafe(t,0),ye})}release(e){return ce((t)=>L(this.releaseUnsafe(t,e)))}get releaseAll(){return ce((e)=>L(this.releaseUnsafe(e,this.taken)))}withPermits(e){return(t)=>Qr((n)=>{let r=ae(()=>{if(this.free<e){let o=OP(this,e,ye);return K(n(o),()=>r)}return this.taken+=e,ls(n(t),()=>{this.releaseUnsafe(pi(),e);return},!0)});return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return(t)=>Qr((n)=>{if(this.free<e)return xa;return this.taken+=e,ls(n(Xc(t)),()=>{this.releaseUnsafe(pi(),e);return},!0)})}}var AP=(e)=>new _P(e),OP=(e,t,n)=>Bt((r)=>{if(e.free>=t)return r(n);let o=()=>{if(e.free<t)return;e.waiters.delete(o),r(n)};return e.waiters.add(o),pe(()=>{e.waiters.delete(o)})});var RP=w(()=>{rt();ht()});var FP="~effect/Channel",PP=(e)=>M(e,FP),j4,Sn=(e)=>{let t=Object.create(j4);return t.transform=(n,r)=>xr(e(n,r),(o)=>v(fu(o))),t},MP=(e,t)=>Sn((n,r)=>ne(eo(e)(n,r),(o)=>t(o,r))),Ih=(e)=>Sn((t,n)=>e),NP=(e)=>Sn(H(function*(t,n){let r=yi(n),o=(i)=>pr(r,Eb(i)),s=yield*mu(e(t,n,r),o);return mu(s,o)})),eo=(e)=>e.transform,B4=(e,t,n)=>bu({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(du((r)=>Ef(e,ew(r))),du((r)=>gu(Sf(t(r),e),e))),DP=(e,t)=>Sn((n,r)=>oe(B4(r,e,t),wP)),$P=(e)=>Sn((t,n)=>Ne(()=>eo(e())(t,n))),UP,LP,rw,H4,jP,BP=()=>Sn((e,t)=>Se(()=>{let n="",r=!1,o=O();function s(c){let u=[];function l(f){if(n.length===0)u.push(f);else u.push(n+f),n=""}for(let f=0;f<c.length;f++){let d=c[f];if(d.length!==0){let m=0,g=d.indexOf("\r"),b=d.indexOf(`
26
+ `);if(r){if(b===0)l(""),m=1,b=d.indexOf(`
27
+ `,m);else l("");r=!1}while(g!==-1||b!==-1)if(g===-1||b!==-1&&b<g)l(d.substring(m,b)),m=b+1,b=d.indexOf(`
28
+ `,m);else if(d.length===g+1)r=!0,g=-1;else l(d.substring(m,g)),m=g+(b===g+1?2:1),g=d.indexOf("\r",m),b=d.indexOf(`
29
+ `,m);n=n+d.substring(m,d.length-(r?1:0))}}return Hn(u)?u:null}let i=Ne(()=>{if(o._tag==="Some")return _t(o.value);return th(e,{onSuccess:a,onFailure:fu,onDone:(c)=>{if(o=_(c),n.length>0||r){let u=n;return n="",r=!1,v([u])}return _t(c)}})});function a(c){let u=s(c);return u!==null?v(u):i}return i})),HP,Ch=(e)=>Sn((t,n)=>{let r;return v(Ne(()=>{if(r)return r;return e.pipe(Sf(n),ne((o)=>eo(o)(t,n)),ne((o)=>r=o))}))}),q4=(e,t,n)=>Ne(()=>{let r=ou(),o=eo(e)(_t(),r);return mr(ne(o,t),n?n:v).pipe(ys((s)=>pr(r,s)))}),ow,sw=(e,t)=>eo(e)(_t(),t);var Jf=w(()=>{An();rn();Oe();X();_e();Qe();he();Ca();Gf();bf();j4={[FP]:{_Env:D,_InErr:D,_InElem:D,_OutErr:D,_OutElem:D},pipe(){return le(this,arguments)}},UP=Ih(v(_t())),LP=p(2,(e,t)=>MP(e,(n)=>Se(()=>{let r=0;return oe(n,(o)=>t(o,r++))}))),rw=p(2,(e,t)=>H4(e,(n)=>v(t(n)))),H4=p(2,(e,t)=>MP(e,(n)=>v(mr(n,(r)=>ne(t(r),_t))))),jP=p((e)=>PP(e[0])&&PP(e[1]),(e,t,n)=>NP(H(function*(r,o,s){let i=n?.haltStrategy??"both",a=yield*bP(0);yield*Ef(s,ew(a));let c=0;function u(f,d){if(c++,!Tf(d))return Kf(a,d);switch(i){case"both":return c===2?Kf(a,d):Te;case"left":case"right":return f===i?Kf(a,d):Te;case"either":return Kf(a,d)}}let l=(f,d,m)=>eo(d)(r,m).pipe(ne((g)=>g.pipe(ne((b)=>zf(a,b)),Co)),mu((g)=>hr(pr(m,Eb(g)),u(f,g))),gu(s));return yield*l("left",e,yi(s)),yield*l("right",t,yi(s)),Is(a)}))),HP=p(2,(e,t)=>Sn((n,r)=>ne(eo(e)(n,r),(o)=>eo(t)(o,r)))),ow=p(3,(e,t,n)=>Ne(()=>{let r=t();return q4(e,(o)=>uu({while:nr,body:()=>o,step:(s)=>{r=n(r,s)}}),()=>v(r))}))});var z4="~effect/Stream",W4,K4,qP=(e)=>{let t=Object.create(K4);return t.channel=e,t};var zP=w(()=>{X();Qe();W4={_R:D,_E:D,_A:D},K4={[z4]:W4,pipe(){return le(this,arguments)}}});var WP="~effect/Sink",KP,G4,J4,Zf=(e)=>M(e,WP),iw=(e)=>aw((t,n)=>eo(e)(t,n).pipe(ne(Co({disableYield:!0})),mr(v))),aw=(e)=>{let t=Object.create(J4);return t.transform=e,t},Z4=(e)=>Sn((t,n)=>v(ne(e.transform(t,n),_t))),Yf,VP=(e)=>Y4(Oa((t)=>e(t),{discard:!0})),Y4=(e)=>aw((t)=>t.pipe(ne(e),Co({disableYield:!0}),mr(()=>KP))),GP=(e)=>iw(Ch(oe(e,Z4)));var Oh=w(()=>{rn();Jf();Oe();X();Qe();he();Ca();KP=v([void 0]),G4={_A:D,_In:D,_L:D,_E:D,_R:D},J4={[WP]:G4,pipe(){return le(this,arguments)}},Yf=aw((e)=>mr(Co(e,{disableYield:!0}),()=>KP))});var Q4="~effect/RcRef",uw,X4,e6,JP,ZP=(e)=>Pf((t)=>{let n=t.context,r=On(n,yf),o=new JP(e.acquire,n,r,e.idleTimeToLive?sr(e.idleTimeToLive):void 0);return gr(Km(r,()=>{let s=o.state._tag==="Acquired"?pr(o.state.scope,fr):Te;return o.state=X4,s}),o)}),t6=(e)=>Uf(function t(n){switch(e.state._tag){case"Closed":return hu;case"Acquired":return e.state.refCount++,e.state.fiber?gr(uP(e.state.fiber),e.state):v(e.state);case"Empty":{let r=ou();return e.semaphore.withPermit(Ne(()=>{if(e.state._tag!=="Empty")return t(n);return n(xs(e.acquire,tn(e.context,yf,r))).pipe(oe((o)=>{let s={_tag:"Acquired",value:o,scope:r,fiber:void 0,refCount:1,invalidated:!1};return e.state=s,s}),ys((o)=>ru(o)?pr(r,o):Te))}))}}}),YP;var QP=w(()=>{Ve();ai();Oe();dr();fP();X();Qe();bf();RP();uw={_tag:"Empty"},X4={_tag:"Closed"},e6={_A:D,_E:D};JP=class JP{[Q4]=e6;pipe(){return le(this,arguments)}state=uw;semaphore=AP(1);acquire;context;scope;idleTimeToLive;constructor(e,t,n,r){this.acquire=e,this.context=t,this.scope=n,this.idleTimeToLive=r}};YP=H(function*(e){let t=e,n=yield*t6(t),r=yield*Df,o=t.idleTimeToLive!==void 0&&VC(t.idleTimeToLive);return yield*Km(r,()=>{if(n.refCount--,n.refCount>0)return Te;if(t.idleTimeToLive===void 0)return t.state=uw,pr(n.scope,fr);else if(n.invalidated)return pr(n.scope,fr);else if(!o)return Te;return n.fiber=ch(t.idleTimeToLive).pipe(ne(()=>{if(t.state._tag==="Acquired"&&t.state.refCount===0)return t.state=uw,pr(n.scope,fr);return Te}),pu(Se(()=>{n.fiber=void 0})),Lf(t.context),lP(t.scope)),Te}),n.value})});var XP,lw;var eF=w(()=>{QP();XP=ZP,lw=YP});var o6="~effect/Stream",Fa=(e)=>M(e,o6),to,tF=(e)=>to(Ih(e)),s6=(e,t)=>to(Sn((n,r)=>ne(sw(e.channel,r),(o)=>t(o,r)))),fw=(e)=>e.channel,nF=(e,t)=>to(DP(e,t)),wu,rF=(e)=>to($P(()=>e().channel)),Ii=(e)=>to(Ch(oe(e,fw))),i6,oF,Ah,sF,iF=(e)=>e.channel.pipe(HP(BP()),to),dw,aF=(e)=>ow(e.channel,()=>[],(t,n)=>{for(let r=0;r<n.length;r++)t.push(n[r]);return t}),cF=(e)=>ow(e.channel,()=>"",(t,n)=>t+n.join(""));var vu=w(()=>{An();rn();Jf();Oe();dr();X();zP();he();to=qP,wu=to(UP),i6=p(2,(e,t)=>rF(()=>{let n=0;return to(LP(e.channel,jt((r)=>t(r,n++))))})),oF=p((e)=>Fa(e[0])&&Fa(e[1]),(e,t,n)=>to(jP(fw(e),fw(t),n))),Ah=p(2,(e,t)=>s6(e,(n,r)=>Se(()=>{let o,s,i=Ne(()=>{if(s!==void 0){let c=s;return s=void 0,v(c)}return n}).pipe(Pr((c)=>(o=Rr(c),_t()))),a=oe(Ne(()=>t.transform(i,r)),([c,u])=>(s=u,da(c)));return Ne(()=>o?o:a)}))),sF=p((e)=>Fa(e[0]),(e,t)=>rF(()=>{let n=new TextDecoder(t?.encoding);return i6(e,(r)=>n.decode(r,{stream:!0}))})),dw=p(2,(e,t)=>Kb((n)=>sw(e.channel,n).pipe(ne((r)=>t.transform(r,n)),oe(([r])=>r))))});var uF="~effect/platform/FileSystem",Cs=(e)=>typeof e==="bigint"?e:BigInt(e),Xf,Qfe,Ci,lF=(e)=>Ci.of({...e,[uF]:uF,exists:(t)=>zr(e.access(t),gr(!0),gs("PlatformError",(n)=>n.reason._tag==="NotFound"?v(!1):A(n))),readFileString:(t,n)=>ne(e.readFile(t),(r)=>Nt({try:()=>new TextDecoder(n).decode(r),catch:(o)=>bs({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:H(function*(t,n){let r=yield*e.open(t,{flag:"r"});if(n?.offset)yield*r.seek(n.offset,"start");let o=n?.bytesToRead!==void 0?Cs(n.bytesToRead):void 0,s=BigInt(0),i=Cs(n?.chunkSize??65536),a=r.readAlloc(i);return tF(v(ne(Ne(()=>{if(o!==void 0&&o<=s)return _t();return o!==void 0&&o-s<i?r.readAlloc(o-s):a}),et({onNone:()=>_t(),onSome:(c)=>(s+=BigInt(c.length),v(da(c)))}))))},Ii),sink:(t,n)=>zr(e.open(t,{flag:"w",...n}),oe((r)=>VP((o)=>r.writeAll(o))),GP),writeFileString:(t,n,r)=>ne(Nt({try:()=>new TextEncoder().encode(n),catch:(o)=>bs({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),(o)=>e.writeFile(t,o,r))}),_h="~effect/platform/FileSystem/File",pw;var Rh=w(()=>{An();rn();Ve();Oe();X();_e();Oo();Oh();vu();Xf=BigInt(1024),Qfe=Xf*Xf*Xf*Xf*Xf,Ci=ze("effect/platform/FileSystem");pw=class pw extends ze()("effect/platform/FileSystem/WatchBackend"){}});function fF(e,t){let n="",r=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else if(i===47)break;else i=47;if(i===47){if(o===a-1||s===1);else if(o!==a-1&&s===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let c=n.lastIndexOf("/");if(c!==n.length-1){if(c===-1)n="",r=0;else n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/");o=a,s=0;continue}}else if(n.length===2||n.length===1){n="",r=0,o=a,s=0;continue}}if(t){if(n.length>0)n+="/..";else n="..";r=2}}else{if(n.length>0)n+="/"+e.slice(o+1,a);else n=e.slice(o+1,a);r=a-o-1}o=a,s=0}else if(i===46&&s!==-1)++s;else s=-1}return n}function a6(e,t){let n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");if(!n)return r;if(n===t.root)return n+r;return n+e+r}function c6(e){if(e.protocol!=="file:")return A(new Es({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));else if(e.hostname!=="")return A(new Es({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let n=0;n<t.length;n++)if(t[n]==="%"){let r=t.codePointAt(n+2)|32;if(t[n+1]==="2"&&r===102)return A(new Es({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return v(decodeURIComponent(t))}function l6(e){let t=new URL("file://"),n=dF(e);if(e.charCodeAt(e.length-1)===u6&&n[n.length-1]!=="/")n+="/";return t.pathname=g6(n),v(t)}function g6(e){if(e.includes("%"))e=e.replace(f6,"%25");if(e.includes("\\"))e=e.replace(d6,"%5C");if(e.includes(`
30
+ `))e=e.replace(p6,"%0A");if(e.includes("\r"))e=e.replace(m6,"%0D");if(e.includes("\t"))e=e.replace(h6,"%09");return e}var Ts="~effect/platform/Path",Ao,dF=function(){let t="",n=!1,r=void 0;for(let o=arguments.length-1;o>=-1&&!n;o--){let s;if(o>=0)s=arguments[o];else{let i=globalThis.process;if(r===void 0&&"process"in globalThis&&typeof i==="object"&&i!==null&&typeof i.cwd==="function")r=i.cwd();s=r}if(s.length===0)continue;t=s+"/"+t,n=s.charCodeAt(0)===47}if(t=fF(t,!n),n)if(t.length>0)return"/"+t;else return"/";else if(t.length>0)return t;else return"."},u6=47,f6,d6,p6,m6,h6,hw;var Ph=w(()=>{Ve();Oe();X();Oo();Ao=ze("effect/Path");f6=/%/g,d6=/\\/g,p6=/\n/g,m6=/\r/g,h6=/\t/g;hw=Ao.of({[Ts]:Ts,resolve:dF,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;if(e=fF(e,!t),e.length===0&&!t)e=".";if(e.length>0&&n)e+="/";if(t)return"/"+e;return e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];if(n.length>0)if(e===void 0)e=n;else e+="/"+n}if(e===void 0)return".";return hw.normalize(e)},relative(e,t){if(e===t)return"";if(e=hw.resolve(e),t=hw.resolve(t),e===t)return"";let n=1;for(;n<e.length;++n)if(e.charCodeAt(n)!==47)break;let r=e.length,o=r-n,s=1;for(;s<t.length;++s)if(t.charCodeAt(s)!==47)break;let a=t.length-s,c=o<a?o:a,u=-1,l=0;for(;l<=c;++l){if(l===c){if(a>c){if(t.charCodeAt(s+l)===47)return t.slice(s+l+1);else if(l===0)return t.slice(s+l)}else if(o>c){if(e.charCodeAt(n+l)===47)u=l;else if(l===0)u=0}break}let d=e.charCodeAt(n+l),m=t.charCodeAt(s+l);if(d!==m)break;else if(d===47)u=l}let f="";for(l=n+u+1;l<=r;++l)if(l===r||e.charCodeAt(l)===47)if(f.length===0)f+="..";else f+="/..";if(f.length>0)return f+t.slice(s+u);else{if(s+=u,t.charCodeAt(s)===47)++s;return t.slice(s)}},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),n=t===47,r=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){r=s;break}}else o=!1;if(r===-1)return n?"/":".";if(n&&r===1)return"//";return e.slice(0,r)},basename(e,t){let n=0,r=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let i=t.length-1,a=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){n=s+1;break}}else{if(a===-1)o=!1,a=s+1;if(i>=0)if(c===t.charCodeAt(i)){if(--i===-1)r=s}else i=-1,r=a}}if(n===r)r=a;else if(r===-1)r=e.length;return e.slice(n,r)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){n=s+1;break}}else if(r===-1)o=!1,r=s+1;if(r===-1)return"";return e.slice(n,r)}},extname(e){let t=-1,n=0,r=-1,o=!0,s=0;for(let i=e.length-1;i>=0;--i){let a=e.charCodeAt(i);if(a===47){if(!o){n=i+1;break}continue}if(r===-1)o=!1,r=i+1;if(a===46){if(t===-1)t=i;else if(s!==1)s=1}else if(t!==-1)s=-1}if(t===-1||r===-1||s===0||s===1&&t===r-1&&t===n+1)return"";return e.slice(t,r)},format:function(t){if(t===null||typeof t!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return a6("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,o;if(r)t.root="/",o=1;else o=0;let s=-1,i=0,a=-1,c=!0,u=e.length-1,l=0;for(;u>=o;--u){if(n=e.charCodeAt(u),n===47){if(!c){i=u+1;break}continue}if(a===-1)c=!1,a=u+1;if(n===46){if(s===-1)s=u;else if(l!==1)l=1}else if(s!==-1)l=-1}if(s===-1||a===-1||l===0||l===1&&s===a-1&&s===i+1){if(a!==-1)if(i===0&&r)t.base=t.name=e.slice(1,a);else t.base=t.name=e.slice(i,a)}else{if(i===0&&r)t.name=e.slice(1,s),t.base=e.slice(1,a);else t.name=e.slice(i,s),t.base=e.slice(i,a);t.ext=e.slice(s,a)}if(i>0)t.dir=e.slice(0,i-1);else if(r)t.dir="/";return t},sep:"/",fromFileUrl:c6,toFileUrl:l6,toNamespacedPath:D})});function _o(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function ed(e){return(t)=>_o(t)?.[e]}var Wn="~structural",Ma="~identifier",td="~sentinels",Fh="~constructor",mF,ku,gw,xw,hF,nd,gF;var Ti=w(()=>{X();mF=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],ku=ed("identifier"),gw=ed(Ma),xw=ed("title"),hF=ed("brands"),nd=Qt((e)=>{let t=_o(e)?.identifier;if(typeof t==="string")return t;return e.getExpected(nd)}),gF=new Set([td,Wn,"representation","arbitrary","brands","toJsonSchema","toCode","toArbitrary","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso"])});var Re,Dr,no,Dt,Mh=(e)=>e===Re?O():_(e),yw=(e)=>e._tag==="None"?no:Dr(e.value);var Nh=w(()=>{dr();_e();rt();Re=Symbol(),Dr=_r,no=Dr(Re),Dt=Dr(Re)});function bw(e){return M(e,od)&&e[od]===od}function x6(e){return Object.hasOwn(e,"input")}function Kn(e,t,n,r,o){return new Et(e,[new Ft([t],n)],r,o)}function Ew(e,t,n){if(bw(e))return e;if(typeof e==="string")return new we({message:e},t,n);let r=typeof e.issue==="string"?new we({message:e.issue},t,n):e.issue;return new Ft(e.path,r)}function xF(e,t,n){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new we(void 0,t,n);return Ew(e,t,n)}function yF(e,t,n,r){if(Array.isArray(t)){if(!Hn(t))return;return t.length===1?Ew(t[0],n,r):new Et(e,jt(t,(o)=>Ew(o,n,r)),n,r)}return xF(t,n,r)}function bF(e){return(t)=>({issues:Iu(t,[],e?.leafHook??SF,e?.checkHook??EF)})}function Dh(e){return x6(e)?B(e.input):void 0}function Iw(e){let t=e.annotations?.expected;return typeof t==="string"?t:void 0}function Oi(e,t){let n=Dh(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Iu(e,t,n,r){switch(e._tag){case"Filter":{let o=r(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Iu(e.issue,t,n,r);let s=Iw(e.issue);return[{path:t,message:s===void 0?Oi(Cw(e.filter),e):Oi(s,e.issue)}]}case"Encoding":return Iu(e.issue,t,n,r);case"Pointer":return Iu(e.issue,[...t,...e.path],n,r);case"Composite":return e.issues.flatMap((o)=>Iu(o,t,n,r));case"AnyOf":{if(e.issues.length===0)return[{path:t,message:Cu(e)??Oi(nd(e.ast),e)}];return e.issues.flatMap((o)=>Iu(o,t,n,r))}default:return[{path:t,message:n(e)}]}}function Cw(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((n)=>Cw(n)).join(" & ")}}function y6(){return(e)=>rd(e,"")}function rd(e,t){let n;switch(e._tag){case"Filter":{let r=EF(e);if(r!==void 0)n=r;else{if(e.issue._tag!=="InvalidValue")return rd(e.issue,t);let o=Iw(e.issue);n=o===void 0?Oi(Cw(e.filter),e):Oi(o,e.issue)}break}case"Encoding":return rd(e.issue,t);case"Pointer":return rd(e.issue,t+Dp(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map((r)=>rd(r,t)).join(`
31
+ `);n=Cu(e)??Oi(nd(e.ast),e);break}default:n=SF(e);break}return t?`${n}
32
+ at ${t}`:n}function Cu(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Cu(e.issue);let n=(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 n==="string")return n}var od="~effect/SchemaIssue/Issue",$r,ww,vw,Ft,Da,$h,Et,ft,we,Tu,sd,kw,SF=(e)=>{let t=Cu(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Oi(nd(e.ast),e);case"InvalidValue":{let n=Iw(e);if(n!==void 0)return Oi(n,e);let r=Dh(e);return r===void 0?"Expected a valid value":`Invalid data ${r}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let n=Dh(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let n=Dh(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},EF=(e)=>Cu(e.issue)??Cu(e),wF;var Ai=w(()=>{An();kn();Ti();Nh();he();$r=class $r{[od]=od;constructor(e,t){if(t?.reportInput===!0&&e!==Re)this.input=e}};ww=class ww extends $r{_tag="Filter";filter;issue;constructor(e,t,n,r){super(n,r);this.filter=e,this.issue=t}};vw=class vw extends $r{_tag="Encoding";ast;issue;constructor(e,t,n,r){super(n,r);this.ast=e,this.issue=t}};Ft=class Ft extends $r{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}};Da=class Da extends $r{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}};$h=class $h extends $r{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n);this.ast=e}};Et=class Et extends $r{_tag="Composite";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}};ft=class ft extends $r{_tag="InvalidType";ast;constructor(e,t,n){super(t,n);this.ast=e}};we=class we extends $r{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n);this.annotations=e}};Tu=class Tu extends $r{_tag="Forbidden";annotations;constructor(e,t,n){super(t,n);this.annotations=e}};sd=class sd extends $r{_tag="AnyOf";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}};kw=class kw extends $r{_tag="OneOf";ast;successes;constructor(e,t,n,r){super(n,r);this.ast=e,this.successes=t}};wF=y6()});function id(e){let t;for(let n of e.reasons){if(!ff(n)||!bw(n.error))return;t??=n.error}return t}function Os(e,t){let n=id(e);if(n===void 0)throw Error(t,{cause:e});return n}var Tw=w(()=>{rn();Ai()});var Ow,kF,IF,CF,TF,OF,Aw,_w,AF,_F,Uh,RF,Lh,Rw,ad,PF,FF,_i,jh,MF,NF,Bh;var Hh=w(()=>{eR();Ow=iu,kF=Ia,IF=H_,CF=q_,TF=z_,OF=cb,Aw=W_,_w=K_,AF=ka,_F=lb,Uh=G_,RF=J_,Lh=Z_,Rw=fb,ad=If,PF=db,FF=pb,_i=Y_,jh=Cf,MF=gb,NF=X_,Bh=yb});function S6(e){return new As((t,n)=>A(e(t,n)))}function Fw(e){return S6((t,n)=>{let r={message:e(t)};return Ee(t)?new Tu(r,t.value,n):new Tu(r)})}function DF(e){return e.run===$F.run}function ro(){return $F}function Mw(e){return new As((t,n)=>me(t)?Aa:e(t.value,n))}function ve(e){return qh(en(e))}function Vn(e){return Mw((t,n)=>e(t,n).pipe(Ss(_)))}function qh(e){return new As((t)=>v(e(t)))}function Nw(){return new As(()=>Aa)}function cd(e){return new As((t)=>{let n=ca(t,Le);return Ee(n)?v(n):Ss(e,_)})}function Ua(){return ve(globalThis.String)}function zh(){return ve(globalThis.Number)}function UF(){return ve(globalThis.BigInt)}function Dw(){return ve((e)=>new globalThis.Date(e))}function LF(){return ve(aR)}function jF(e){return Mw((t,n)=>Nt({try:()=>_(JSON.parse(t,e?.reviver)),catch:()=>new we({expected:"a valid JSON string"},t,n)}))}function BF(e){return Mw((t,n)=>Nt({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw TypeError("Value cannot be represented as JSON");return _(r)},catch:()=>new we({expected:"a JSON-serializable value"},t,n)}))}function $w(){return ve(am)}function Wh(){return ve(fT)}function Kh(){return ve(pT)}function HF(){return Vn((e,t)=>Ra($b(Vc(e)),()=>new we({expected:"a valid Base64 string"},e,t)))}function qF(){return Vn((e,t)=>Bn(lT(e),{onFailure:()=>A(new we({expected:"a valid Base64 string"},e,t)),onSuccess:v}))}function zF(){return Vn((e,t)=>Bn(vS(e),{onFailure:()=>A(new we({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function WF(){return Vn((e,t)=>Bn(dT(e),{onFailure:()=>A(new we({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function KF(){return Vn((e,t)=>Bn(IS(e),{onFailure:()=>A(new we({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function VF(){return Vn((e,t)=>Bn(mT(e),{onFailure:()=>A(new we({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function GF(){return ve(encodeURIComponent)}function JF(){return Vn((e,t)=>{try{return v(globalThis.decodeURIComponent(e))}catch{return A(new we({expected:"a valid URI component"},e,t))}})}function Uw(){return Vn((e,t)=>et(Uh(e),{onNone:()=>A(new we({message:"Invalid DateTime input"},e,t)),onSome:(n)=>v(Lh(n))}))}function ZF(){return ve((e)=>eM(Array.from(e.entries())))}function YF(){return ve((e)=>{let t=new FormData;if(typeof e==="object"&&e!==null)E6(e).forEach(([r,o])=>{t.append(r,o)});return t})}function QF(){return ve((e)=>eM(Array.from(e.entries())))}function XF(){return ve((e)=>{if(typeof e==="object"&&e!==null)return new URLSearchParams(b6(e));return new URLSearchParams})}function v6(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map((o)=>w6.test(o)?globalThis.Number(o):o)}function eM(e){let t={},n=new WeakSet;function r(o,s,i){let a=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(a)&&Array.isArray(a)===i)return a;let c=i?[]:{};return n.add(c),U(o,s,c),c}return e.forEach(([o,s])=>{let i=v6(o),a=t;i.forEach((c,u)=>{let l=u===i.length-1;if(Array.isArray(a)&&c==="")if(l)a.push(s);else{let f=i[u+1],d=typeof f==="number"||f==="",m=a.length;a=r(a,m,d)}else if(l){let f=Object.hasOwn(a,c);if(f&&Array.isArray(a[c]))a[c].push(s);else if(f)U(a,c,[a[c],s]);else U(a,c,s)}else{let f=i[u+1];a=r(a,c,typeof f==="number"||f==="")}})}),t}function tM(e){return(t)=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))if(s.every(e))s.forEach((a)=>{n.push([o,a])});else s.forEach((a,c)=>{r(`${o}[${c}]`,a)});else if(typeof s==="object"&&s!==null)for(let[i,a]of Object.entries(s))r(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))r(o,s);return n}}var As,$F,E6,b6,w6;var Vh=w(()=>{Hh();Oe();cm();_e();Qe();he();gn();Ai();fR();As=class As extends Gi{run;constructor(e){super();this.run=e}map(e){return new As((t,n)=>this.run(t,n).pipe(Ss(en(e))))}compose(e){if(DF(this))return e;if(DF(e))return this;return new As((t,n)=>this.run(t,n).pipe(on((r)=>e.run(r,n))))}};$F=new As(v);E6=tM((e)=>typeof e==="string"||typeof Blob<"u"&&e instanceof Blob);b6=tM(Wr);w6=/^\d+$/});var nM,jw="~effect/BigDecimal",k6,Jh=(e)=>M(e,jw),Gn=(e,t)=>{let n=Object.create(k6);return n.value=e,n.scale=t,n},oM=(e,t)=>{if(e!==yr&&e%Gh===yr)throw RangeError("Value must be normalized");let n=Gn(e,t);return n.normalized=n,n},yr,I6,C6,Gh,sM,Bw=(e)=>{if(e.normalized===void 0)if(e.value===yr)e.normalized=sM;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0;s--)if(t[s]==="0")n++;else break;if(n===0)e.normalized=e;let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=oM(r,o)}return e.normalized},Ri,iM,_s,T6,O6,rM=(e)=>e.value===yr?0:e.value<yr?-1:1,A6=(e)=>e.value<yr?Gn(-e.value,e.scale):e,Hw,_6,aM=(e)=>{if(e==="")return _(sM);let t,n,r=e.search(/[eE]/);if(r!==-1){let c=e.slice(r+1);if(t=e.slice(0,r),n=Number(c),t===""||!Number.isSafeInteger(n)||!nM.test(c))return O()}else t=e,n=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),u=t.slice(i+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!nM.test(o))return O();let a=s-n;if(!Number.isSafeInteger(a))return O();return _(Gn(BigInt(o),a))},Ro=(e)=>{let t=Bw(e);if(Math.abs(t.scale)>=16)return R6(t);let n=t.value<yr,r=n?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=r.length)o="0",s="0".repeat(t.scale-r.length)+r;else{let a=r.length-t.scale;if(a>r.length){let c=a-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(a),o=r.slice(0,a)}let i=s===""?o:`${o}.${s}`;return n?`-${i}`:i},R6=(e)=>{if(P6(e))return"0e+0";let t=Bw(e),n=`${A6(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${cM(t)?"-":""}${r}`;if(o!=="")s+=`.${o}`;let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`},P6=(e)=>e.value===yr,cM=(e)=>e.value<yr,F6=(e)=>e.value>yr,qw=(e)=>Jh(e[0]),uM,zw,Ww;var Kw=w(()=>{yt();Xo();X();Xt();jn();_e();ia();Qe();he();nM=/^[+-]?\d+$/,k6={[jw]:jw,[Ie](){let e=Bw(this);return xt(re(e.value),Ln(e.scale))},[Ce](e){return Jh(e)&&_6(this,e)},toString(){return`BigDecimal(${Ro(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[At](){return this.toJSON()},pipe(){return le(this,arguments)}},yr=BigInt(0),I6=BigInt(1),C6=BigInt(-1),Gh=BigInt(10),sM=oM(yr,0),Ri=p(2,(e,t)=>{if(t>e.scale)return Gn(e.value*Gh**BigInt(t-e.scale),t);if(t<e.scale)return Gn(e.value/Gh**BigInt(e.scale-t),t);return e}),iM=p(2,(e,t)=>{if(t.value===yr)return e;if(e.value===yr)return t;if(e.scale>t.scale)return Gn(Ri(t,e.scale).value+e.value,e.scale);if(e.scale<t.scale)return Gn(Ri(e,t.scale).value+t.value,t.scale);return Gn(e.value+t.value,e.scale)}),_s=ts((e,t)=>{let n=rr(rM(e),rM(t));if(n!==0)return n;if(e.scale>t.scale)return Cr(e.value,Ri(t,e.scale).value);if(e.scale<t.scale)return Cr(Ri(e,t.scale).value,t.value);return Cr(e.value,t.value)}),T6=Uc(_s),O6=ti(_s),Hw=Kt((e,t)=>{if(e.scale>t.scale)return Ri(t,e.scale).value===e.value;if(e.scale<t.scale)return Ri(e,t.scale).value===t.value;return e.value===t.value}),_6=p(2,(e,t)=>Hw(e,t)),uM=p(qw,(e,t=0)=>{if(e.scale<=t)return e;return Gn(e.value/Gh**BigInt(e.scale-t),t)}),zw=p(qw,(e,t=0)=>{let n=uM(e,t);if(F6(e)&&T6(n,e))return iM(n,Gn(I6,t));return n}),Ww=p(qw,(e,t=0)=>{let n=uM(e,t);if(cM(e)&&O6(n,e))return iM(n,Gn(C6,t));return n})});class ld{_tag="Middleware";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new ld(this.encode,this.decode)}}function M6(e){return M(e,ud)&&e[ud]===ud}function Sr(e){return new Pe(Vn(e.decode),Vn(e.encode))}function st(e){return new Pe(ve(e.decode),ve(e.encode))}function Yh(e){return new Pe(qh(e.decode),qh(e.encode))}function fM(){return new Pe(LF(),ro())}function Ou(){return N6}function bM(){return st({decode:Gy,encode:Jp})}function wM(){return st({decode:ns,encode:mn})}function vM(e){return st({decode:Tn,encode:e?.onNoneEncoding===null?Jp:mn})}function kM(){return Yh({decode:_,encode:aa})}function IM(){return Yh({decode:(e)=>e.pipe(ca(Le),_),encode:aa})}function _M(e){return new Pe(jF(e??{}),BF(e))}var ud="~effect/SchemaTransformation/Transformation",Pe,Zh=(e)=>{if(M6(e))return e;return new Pe(e.decode,e.encode)},N6,Au,Qh,Vw,dM,pM,mM,hM,D6=(e)=>fn(e)&&typeof e.message==="string",gM=(e)=>{let n=Object.hasOwn(e,"cause")?Error(e.message,{cause:yM(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")n.name=e.name;if(typeof e.stack==="string")n.stack=e.stack;return n},$6=(e)=>{try{let t=Yi(e);return t===void 0?B(e):JSON.parse(t)}catch{return B(e)}},U6=(e,t,n)=>{let r={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")r.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)r.cause=n(e.cause);return r},xM=(e)=>{let t=new WeakSet,n=(r)=>{if(q0(r)){if(t.has(r))return"[Circular]";t.add(r);let o=U6(r,e,n);return t.delete(r),o}return $6(r)};return n},yM=(e)=>D6(e)?gM(e):e,SM=(e)=>st({decode:gM,encode:(t)=>xM(e)(t)}),EM=(e)=>st({decode:yM,encode:xM(e)}),Gw,Jw,Zw,CM,TM,OM,AM,RM,PM,FM,Yw,Qw,Xw,ev;var Xh=w(()=>{Kw();Hh();ai();Oe();kn();_e();he();Vh();Ai();Pe=class Pe{[ud]=ud;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new Pe(this.encode,this.decode)}compose(e){return new Pe(this.decode.compose(e.decode),e.encode.compose(this.encode))}};N6=new Pe(ro(),ro());Au=new Pe(zh(),Ua()),Qh=new Pe(UF(),Ua()),Vw=new Pe(Dw(),ve(Ly)),dM=new Pe(Dw(),ve((e)=>e.getTime())),pM=Sr({decode:(e,t)=>et(KC(e),{onNone:()=>A(new we({expected:"a valid Duration string"},e,t)),onSome:v}),encode:(e)=>v(globalThis.String(e))}),mM=Sr({decode:(e)=>v(Tr(e)),encode:(e,t)=>et(GC(e),{onNone:()=>A(new we({expected:"a Duration representable as a bigint"},e,t)),onSome:(n)=>v(n)})}),hM=st({decode:(e)=>ii(e),encode:(e)=>qc(e)});Gw=Sr({decode:(e,t)=>URL.canParse(e)?v(new URL(e)):A(new we({expected:"a valid URL string"},e,t)),encode:(e)=>v(e.href)}),Jw=Sr({decode:(e,t)=>{let n=aM(e);return me(n)?A(new we({expected:"a valid BigDecimal string"},e,t)):v(n.value)},encode:(e)=>v(Ro(e))}),Zw=new Pe(HF(),$w()),CM=new Pe(qF(),$w()),TM=new Pe(WF(),Wh()),OM=new Pe(VF(),Kh()),AM=new Pe(JF(),GF());RM=new Pe(ZF(),YF()),PM=new Pe(QF(),XF()),FM=st({decode:(e)=>ad(e),encode:(e)=>e.offset}),Yw=Sr({decode:(e,t)=>et(PF(e),{onNone:()=>A(new we({expected:"a valid IANA time zone"},e,t)),onSome:v}),encode:(e)=>v(e.id)}),Qw=Sr({decode:(e,t)=>et(FF(e),{onNone:()=>A(new we({expected:"a valid time zone"},e,t)),onSome:v}),encode:(e)=>v(_i(e))}),Xw=Sr({decode:(e,t)=>et(Uh(e),{onNone:()=>A(new we({expected:"a valid UTC DateTime string"},e,t)),onSome:(n)=>v(Lh(n))}),encode:(e)=>v(NF(e))}),ev=Sr({decode:(e,t)=>et(RF(e),{onNone:()=>A(new we({expected:"a valid Zoned DateTime string"},e,t)),onSome:v}),encode:(e)=>v(Bh(e))})});function Fi(e){return(t)=>t._tag===e}class dt{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}class so{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}}function t1(e){switch(e._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return!e.checks;case"Union":return!e.checks&&e.types.every(t1);default:return!1}}function NM(e){let t=globalThis.String(e.literal);return Ge(e,[new dt(new Er(t),new Pe(ve(()=>e.literal),ve(()=>t)))])}function rv(e,t){return e.some((n)=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&rv(n.checks,t))}function La(e,t,n=ja){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter((a)=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(Iv(Jn(t)))}class ng{name;type;constructor(e,t){this.name=e,this.type=t}}function ov(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(ov);default:return!1}}function q6(e){return ov(e)&&ov(Jn(e))}class rg{parameter;type;constructor(e,t){if(!q6(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,bt(t)&&!k1(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}function sv(e,t,n){if(n._tag==="Failure")return eg(e,e.ast,t.name,n);if(n===Dt)return;let r=n[ie];if(r!==Re){U(e.out,t.name,r);return}if(delete e.out[t.name],!bt(t.type)){let o=new Ft([t.name],new Da(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(o);else e.issues=[o];return}else return Rr(new Et(e.ast,[o],e.input,e.options))}}function xv(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function og(e,t,n){return new Mu(Reflect.ownKeys(e).map((r)=>new ng(r,e[r].ast)),[],n,t)}function pd(e){return e.ast}function yv(e,t=void 0){return new io(!1,e.map((n)=>n.ast),[],void 0,t)}function sg(e,t,n){return new Fn(e.map(pd),t,void 0,n)}function l1(e,t){if(e.encoding||t.some((s)=>s.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:n,indexSignatures:r,checks:o}=e;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=xv(o,s.checks);return new Mu(n,r,void 0,o)}function f1(e,t){if(e.encoding)throw Error("TupleWithRest does not support encodings");return new io(e.isMutable,e.elements,t,void 0,e.checks)}function d1(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(d1)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function Ru(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[td];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let n=t.type;if(!bt(n)){if(_u(n))return[{key:t.name,literal:n.literal}];if(nv(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!bt(t)){if(_u(t))return[{key:n,literal:t.literal}];if(nv(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((n)=>Ru(ig(n)));return t[0].filter((n)=>t.every((r)=>r.some((o)=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return Ru(e.thunk())}}function z6(e){let t=$M.get(e);if(t)return t;let n,r=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],u=ig(c);if(L6(u))continue;if(i)if(_u(u)||nv(u)){s??=new Map;let f=_u(u)?u.literal:u.symbol,d=s.get(f);if(!d)s.set(f,d=[]);d.push(c)}else i=!1;let l=Ru(u);if(l.length){n??=new Map,r++;for(let{key:f,literal:d}of l){let m=n.get(f);if(!m)n.set(f,m=[new Map,new Set]);m[1].add(a);let g=m[0].get(d);if(!g)m[0].set(d,g=new Set);g.add(a)}}else{o??={};let f=d1(u);for(let d of f)(o[d]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=(a)=>s.get(a)??fd;else if(n?.size===1&&!o){let[a,[c]]=n.entries().next().value,u=c;for(let[l,f]of c)u.set(l,Object.freeze(Array.from(f,(d)=>e[d])));t=(l,f)=>{if(vl(l)){let d=Object.hasOwn(l,a)?l[a]:void 0;if(d!==void 0)return u.get(d)??fd;if(f)return e}return fd}}else if(n){let a;for(let c of n)if((!a||c[1][0].size>a[1][0].size)&&c[1][1].size===r)a=c;t=(c,u)=>{let l=c===null?"null":Array.isArray(c)?"array":typeof c,f=o?.[l]??fd;if(!vl(c))return f.map((g)=>e[g]);let d=new Set(f),m;if(a){let[g,[b]]=a,x=Object.hasOwn(c,g),I=x?c[g]:void 0;if(x&&(!u||I!==void 0)){let C=b.get(I);if(!C)return f.map((S)=>e[S]);for(let S of C)d.add(S);m=g}}if(m===void 0)for(let[g,[b,x]]of n){let I=Object.hasOwn(c,g),C=I?c[g]:void 0;if(I&&(!u||C!==void 0)){let S=b.get(C);if(S)for(let y of S)d.add(y)}else if(u)for(let S of x)d.add(S)}for(let[g,[b,x]]of n){if(g===m)continue;let I=Object.hasOwn(c,g),C=I?c[g]:void 0;if(I&&(!u||C!==void 0)){let S=b.get(C);for(let y of d)if(x.has(y)&&!S?.has(y))d.delete(y)}}return Array.from(d).sort((g,b)=>g-b).map((g)=>e[g])}}else t=(a)=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??fd).map((u)=>e[u]).filter(W6(a))};return $M.set(e,t),t}function W6(e){return(t)=>{let n=ig(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function md(e,t,n=!1){return z6(t)(e,n)}function UM(e,t,n,r){let o=id(t);if(!o)return lr(t);return Rr(new sd(e,[o],n,r))}function LM(e){return e?"":"readonly "}function jM(e){return e?"?":""}function Ha(e){let t=!1,n;return()=>{if(t)return n;return n=e(),t=!0,n}}function cg(e,t,n=!1){return new dd((r,o,s)=>yF(o,e(r,o,s),r,s),t,n)}function ug(e,t){return new dd((n,r,o)=>e(n)?void 0:new we(void 0,n,o),t,!0)}function Sv(e){return cg((t)=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}function hd(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return cg((o)=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function gd(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function bv(e){return m1.get(e)??e}function Ge(e,t){if(e.encoding===t)return e;return gd(e,(n)=>{n.encoding.value=t})}function xd(e,t){if(e.context===t)return e;let n=bv(e);if(n.context===t)return n;let r=gd(e,(o)=>{o.context.value=t});return m1.set(r,n),r}function yd(e){return e.encoding?yd(e.encoding[e.encoding.length-1].to):e}function Ur(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return lg(e,lS(e.checks.slice(0,-1),n.annotate(t)))}return gd(e,(n)=>{n.annotations.value={...n.annotations.value,...t}})}function lg(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return gd(e,(n)=>{n.checks.value=t})}function Fo(e,t){return lg(e,xv(e.checks,t))}function Nu(e,t){let n=t(e.to);return n===e.to?e:new dt(n,e.transformation)}function h1(e,t){let n=e,r=n[n.length-1],o=Nu(r,t);return o===r?e:lS(e.slice(0,e.length-1),o)}function wv(e){return(t)=>t.encoding?Ge(t,h1(t.encoding,e)):t}function fg(e,t){return wv((n)=>xd(n,t))(e)}function qa(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:Ge(r,h1(r.encoding,n))}return e(r)}return Ji(n)}function g1(e,t){return vv(e,t,sn(e))}function x1(e,t){return vv(Jn(e),t,e)}function vv(e,t,n){let r=new dt(e,t);return Ge(n,n.encoding?[...n.encoding,r]:[r])}function y1(e,t){let n=hF(e),r=n?[...n,t]:[t];return Ur(e,{brands:r})}function Pu(e,t){let n=!1,r=Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);if(i!==s)n=!0;r[o]=i}return n?r:e}function Sd(e,t){let n=e.context?new so(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new so(!1,!1,void 0,t);return xd(e,n)}function E1(e,t){let n=new Pe(cd(t),ro()),r=new dt(Rs,n),o=e.context?new so(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new so(!1,!1,r);return xd(e,o)}function dg(e,t,n){return vv(e,n,t)}function Z6(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":if(Ap(o.literal))t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)r(o.types[s]);return;default:n.push(o)}}return r(e),{literals:t,parameters:n}}function b1(e,t){let{literals:n,parameters:r}=Z6(e);return new Mu(n.map((o)=>new ng(o,t)),r.map((o)=>new rg(o,t)))}function bt(e){return e.context?.isOptional??!1}function w1(e){return e.context?.isMutable??!1}function v1(e){return e.annotations?.[Wn]===!0||e._tag==="FilterGroup"&&e.checks.every(v1)}function Y6(e){function t(r){if(v1(r))return[r];return r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return la(n)?n:void 0}function Q6(e,t){let n=t,r=n.length,o=n[r-1],s=[new dt(oo(Ge(e,void 0)),n[0].transformation.flip())];for(let a=1;a<r;a++)s.unshift(new dt(oo(n[a-1].to),n[a].transformation.flip()));let i=oo(o.to);if(i.encoding)return Ge(i,[...i.encoding,...s]);else return Ge(i,s)}function k1(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(k1);default:return!1}}function pg(e,t){let n=Dr(t);return(r,o)=>{if(r===Re)return no;if(r===t)return n;return A(new ft(e,r,o))}}function ao(e,t){return(n,r)=>{if(n===Re)return no;if(t(n))return Dt;return A(new ft(e,n,r))}}function BM(e,t,n){let{encodedParts:r,literals:o}=e,s=t.length;for(let u=0;u<o.length;u++){let l=o[u];if(l&&!t.includes(l))return}if(e.suffixLengths[0]>s)return;let i=Array(r.length),a;function c(u,l){if(u===r.length)return l===s;if(a?.has(u*(s+1)+l))return!1;let f=r[u];if(u===r.length-1){let d=t.slice(l);if(f.matchPart(d,n)!==void 0)return i[u]=d,!0}else if(f._tag==="Literal"){let d=o[u];if(t.startsWith(d,l)&&c(u+1,l+d.length))return i[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],g=m===void 0?d:t.lastIndexOf(m,d);while(g>=l){let b=t.slice(l,g);if(f.matchPart(b,n)!==void 0&&c(u+1,g))return i[u]=b,!0;if(g===0)break;g=m===void 0?g-1:t.lastIndexOf(m,g-1)}}return a??=new Set,a.add(u*(s+1)+l),!1}return c(0,0)?i:void 0}function Cv(e){return hd(iv,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:iv.source}),...e})}function Tv(e){return hd(av,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:av.source}),...e})}function Av(e){return hd(cv,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:cv.source}),...e})}function co(e,t,n,r,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(n=co(i.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=i.run(t,r,o);if(a){let c=new ww(i,a,t,o);if(n)n.push(c);else n=[c];if(o.errors!=="all"||i.aborted)return n}}}return n}function _1(e,t){let n=co(e,t,void 0,Rs,{errors:"all"});if(n){let r=new Et(Rs,n);return te(r)}return G(t)}function R1(e){if(!Mi(e))return;let t=e.annotations?.[Fh];return ln(t)?t(e.typeParameters):void 0}function i5(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function a5(e){return e===void 0||typeof e==="string"}function P1(e,t){let n=new WeakMap,r=[];e:while(!0){if(typeof e!=="object"||e===null){if(!t(e))return!1}else{let o=e,s=n.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(o,!1),r.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}while(r.length>0){let o=r[r.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}n.set(o.value,!0),r.pop()}return!0}}function $u(e){return P1(e,i5)}function c5(e){return P1(e,a5)}var Mi,L6,_u,nv,uv,j6,HM,B6,ja,MM="~effect/Schema",wt,Ba,qM,lv,zM,WM,fv,KM,VM,GM,JM,ZM,YM,QM,Rs,XM,e1,dv,pv,mv,Er,n1,Po,r1,hv,o1,s1,i1,a1,c1,u1,io,H6,gv=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),eg=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=id(r.cause);if(o===void 0)return lr(ms(r.cause,(i)=>new Et(t,[new Ft([n],i)],e.input,e.options)));let s=new Ft([n],o);if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return Rr(new Et(t,[s],e.input,e.options))},tg="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",Mu,DM,ig,$M,fd,Fn,K6,p1,ag,dd,Pi,Ev,V6,m1,Du,G6,S1,kv,J6,sn,Jn,oo,I1,Iv,mg,C1,T1="[\\s\\S]*?",iv,X6,O1,e5,t5,n5="-?\\d+",av,Ov,r5,o5="Symbol\\((.*)\\)",cv,s5,A1,Fu,F1,_v,M1,u5,Rv;var Ps=w(()=>{An();rn();Oe();dr();kn();X();ht();Ti();Tw();Nh();Qe();he();gn();Vh();Ai();Xh();Mi=Fi("Declaration"),L6=Fi("Never"),_u=Fi("Literal"),nv=Fi("UniqueSymbol"),uv=Fi("Arrays"),j6=Fi("Objects"),HM=Fi("Union"),B6=Fi("Suspend");ja={};wt=class wt{[MM]=MM;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}};Ba=class Ba extends wt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,o,s,i,a){super(n,r,o,s);this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,n)=>{if(t===Re)return no;return(e??=this.run(this.typeParameters))(t,this,n)}}_rebuild(e,t,n,r,o){let s=Pu(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&o===this.encodingRun?this:new Ba(s,r,this.annotations,t,void 0,this.context,n,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;if(typeof e==="string")return e;return"<Declaration>"}};qM=class qM extends wt{_tag="Null";getParser(){return pg(this,null)}getExpected(){return"null"}};lv=new qM;zM=class zM extends wt{_tag="Undefined";getParser(){return pg(this,void 0)}toCodecJson(){return Ge(this,[WM])}getExpected(){return"undefined"}};WM=new dt(lv,new Pe(ve(()=>{return}),ve(()=>null))),fv=new zM;KM=class KM extends wt{_tag="Void";getParser(){let e=Dr(void 0);return(t)=>t===Re?no:e}toCodecJson(){return Ge(this,[WM])}getExpected(){return"void"}};VM=new KM;GM=class GM extends wt{_tag="Never";getParser(){return ao(this,H0)}getExpected(){return"never"}};JM=new GM;ZM=class ZM extends wt{_tag="Any";getParser(){return ao(this,Ty)}getExpected(){return"any"}};YM=new ZM;QM=class QM extends wt{_tag="Unknown";getParser(){return ao(this,Ty)}getExpected(){return"unknown"}};Rs=new QM;XM=class XM extends wt{_tag="ObjectKeyword";getParser(){return ao(this,vl)}getExpected(){return"object | array | function"}};e1=new XM;dv=class dv extends wt{_tag="Enum";enums;constructor(e,t,n,r,o){super(t,n,r,o);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return ao(this,(t)=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t==="number")){let e=Object.fromEntries(this.enums.map(([t,n])=>[globalThis.String(n),n]));return Ge(this,[new dt(new Fn(Object.keys(e).map((t)=>new Er(t)),"anyOf"),new Pe(ve((t)=>e[t]),Ua()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};pv=class pv extends wt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,n,r,o){super(t,n,r,o);let s=[],i=[];for(let c of e){let u=Jn(c);if(t1(u))s.push(u),i.push(u._tag==="Literal"?globalThis.String(u.literal):void 0);else throw Error(`Invalid TemplateLiteral part ${u._tag}`)}let a=Array(s.length+1);a[s.length]=0;for(let c=s.length-1;c>=0;c--)a[c]=a[c+1]+(i[c]?.length??0);this.parts=e,this.encodedParts=s,this.literals=i,this.suffixLengths=a}getParser(e){let t=e(this.asTemplateLiteralParser());return(n,r)=>{if(n===Re)return no;let o=t(n,r);if(o._tag==="Success")return Dt;return Jt(o,{onSuccess:()=>n,onFailure:(s)=>new Et(this,[s],n,r)})}}getExpected(){return"string"}matchPart(e,t){return BM(this,e,t)===void 0?void 0:e}asTemplateLiteralParser(){let e=new io(!1,this.parts.map(C1),[]);return dg(Po,e,new Pe(Vn((t,n)=>{let r=BM(this,t,n);if(r)return v(r);return A(new we({expected:"a string matching template literal parts"},t,n))}),ve((t)=>t.join(""))))}};mv=class mv extends wt{_tag="UniqueSymbol";symbol;constructor(e,t,n,r,o){super(t,n,r,o);this.symbol=e}getParser(){return pg(this,this.symbol)}toCodecStringTree(){return Ge(this,[A1])}getExpected(){return globalThis.String(this.symbol)}};Er=class Er extends wt{_tag="Literal";literal;constructor(e,t,n,r,o){super(t,n,r,o);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${B(e)}`);this.literal=e}getParser(){return pg(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?NM(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:NM(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};n1=class n1 extends wt{_tag="String";getParser(){return ao(this,Wr)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&co(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}};Po=new n1;r1=class r1 extends wt{_tag="Number";getParser(){return ao(this,bl)}matchKey(e,t){return this._match(X6,e,t)}matchPart(e,t){return this._match(iv,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);if(n.disableChecks||!this.checks)return r;return co(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){if(this.checks&&(rv(this.checks,"effect/schema/isFinite")||rv(this.checks,"effect/schema/isInt")))return this;return Ge(this,[V6])}toCodecStringTree(){if(this.toCodecJson()===this)return Ge(this,[e5]);return Ge(this,[t5])}getExpected(){return"number"}};hv=new r1;o1=class o1 extends wt{_tag="Boolean";getParser(){return ao(this,Op)}getExpected(){return"boolean"}};s1=new o1;i1=class i1 extends wt{_tag="Symbol";getParser(){return ao(this,Cy)}matchKey(e,t){if(t.disableChecks||!this.checks)return e;return co(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Ge(this,[A1])}getExpected(){return"symbol"}};a1=new i1;c1=class c1 extends wt{_tag="BigInt";getParser(){return ao(this,j0)}matchPart(e,t){if(!av.test(e))return;let n=globalThis.BigInt(e);if(t.disableChecks||!this.checks)return n;return co(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return Ge(this,[r5])}getExpected(){return"bigint"}};u1=new c1;io=class io extends wt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,o,s,i,a){super(r,o,s,i);this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(bt(t[u]))c=!0;else if(c)throw Error("A required element cannot follow an optional element. ts(1257)");if(c&&n.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<n.length;u++)if(bt(n[u]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let n=this,r,o,s=n.elements.length,i=Math.max(0,n.rest.length-1);function a(c,u){if(u<s)return r[u];else if(u>=c)return o[u-c+1];return o[0]}return hh(function*(c,u){if(c===Re)return Re;if(!Array.isArray(c))return yield*A(new ft(n,c,u));if(!r)r=n.elements.map((g)=>({ast:g,parser:t(g)})),o=n.rest.map((g)=>({ast:g,parser:t(g)}));let l=c.length,f={ast:n,getParser:a,input:c,len:l,tailThreshold:Math.max(s,l-i),output:new globalThis.Array(l),issues:void 0,options:u},d=gv(u?.concurrency),m=H6(f,c,{concurrency:d?.concurrency,end:n.rest.length===0?s:Math.max(l,s+i)});if(m)yield*m;if(n.rest.length===0&&l>s)for(let g=s;g<=l-1;g++){let b=new $h(n,c[g],u),x=new Ft([g],b);if(u.errors==="all")if(f.issues)f.issues.push(x);else f.issues=[x];else return yield*A(new Et(n,[x],c,u))}if(f.issues)return yield*A(new Et(n,f.issues,c,u));return f.output})}_rebuild(e,t,n){let r=Pu(this.elements,e),o=Pu(this.rest,e);return r===this.elements&&o===this.rest&&t===this.checks&&n===this.encodingChecks?this:new io(this.isMutable,r,o,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};H6=uf()({onItem(e,t,n){let r=n<e.len?t:Re;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return eg(e,e.ast,r,n);let o=n===Dt?t:n[ie];if(o!==Re)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(bt(s.ast))return;let i=new Ft([r],new Da(s.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return Rr(new Et(e.ast,[i],e.input,e.options))}}});Mu=class Mu extends wt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i;let a=e.map((c)=>c.name).filter((c,u,l)=>l.indexOf(c)!==u);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let x of n.propertySignatures)r.push(x.name);let o=r.length,s=n.indexSignatures.length,i=o&&s?new Set(r):void 0;if(!o&&!s)return ao(n,_p);let a,c,u=(x,I,C,S,y)=>{if(y._tag==="Failure")return eg(x,n,I,y)??fr;let h=y===Dt?S:y[ie];if(C!==Re&&h!==Re){if(o&&(i.has(I)||i.has(C)))return fr;U(x.out,C,h)}return fr},l=(x,I,C,S)=>{if(!S){let k=C.parserKey(I,x.options);if(!We(k))return ne(bi(k),(T)=>l(x,I,C,T));S=k}if(S._tag==="Failure")return eg(x,n,I,S)??fr;let y=S===Dt?I:S[ie],h=x.input[I],E=C.parserValue(h,x.options);return We(E)?u(x,I,y,h,E):ne(bi(E),(k)=>u(x,I,y,h,k))},f=(x,I,C)=>{let S=x.input[I],y=C.parserValue(S,x.options);return We(y)?u(x,I,I,S,y):ne(bi(y),(h)=>u(x,I,I,S,h))},d=s?uf()({onItem:(x,[I,C])=>l(x,I,C),step:(x,I,C)=>C._tag==="Failure"?C:void 0}):void 0,m=()=>{if(!a)a=n.propertySignatures.map((x)=>({parser:t(x.type),name:x.name,type:x.type})),c=s?n.indexSignatures.map((x)=>({is:x,parserKey:e(Iv(x.parameter)),parserValue:t(x.type)})):void 0;return a},g=hh(function*(x,I){if(x===Re)return Re;if(!(typeof x==="object"&&x!==null&&!Array.isArray(x)))return yield*A(new ft(n,x,I));m();let C=x,S={},y={ast:n,input:C,out:S,issues:void 0,options:I},h=I.errors==="all",E=I.onExcessProperty==="error",k=I.onExcessProperty==="preserve",T;if(!s&&(E||k)){i??=new Set(r),T=Reflect.ownKeys(C);for(let N=0;N<T.length;N++){let R=T[N];if(!i.has(R))if(E){let z=new $h(n,C[R],I),q=new Ft([R],z);if(h){if(y.issues)y.issues.push(q);else y.issues=[q];continue}else return yield*A(new Et(n,[q],x,I))}else U(S,R,C[R])}}let F=gv(I?.concurrency);if(o){let N=DM(y,a,F);if(N)yield*N}if(s&&!F)for(let N=0;N<s;N++){let R=c[N],z=R.is.parameter===Po?f:l,q=R.is.parameter===Po?Object.keys(C):La(C,R.is.parameter,I);for(let ue=0;ue<q.length;ue++){let ut=z(y,q[ue],R);if(!We(ut))yield*ut;else if(ut._tag==="Failure")return yield*ut}}else if(d){let N=fa();for(let z=0;z<s;z++){let q=c[z],ue=La(C,q.is.parameter,I);for(let ut=0;ut<ue.length;ut++)N.push([ue[ut],q])}let R=d(y,N,F);if(R)yield*R}if(y.issues)return yield*A(new Et(n,y.issues,x,I));if(I.propertyOrder==="original"){let N=(T??Reflect.ownKeys(C)).concat(r),R={};for(let z of N)if(Object.hasOwn(S,z))U(R,z,S[z]);return R}return S});if(s)return g;let b=(x,I,C)=>{let S=a[I];return ne(bi(C),(y)=>{let h=sv(x,S,y);if(h)return h;let E=()=>Dr(x.out),k=DM(x,a.slice(I+1));return k?on(k,E):E()})};return(x,I)=>{if(x===Re)return no;if(I.errors==="all"||I.onExcessProperty!==void 0||I.propertyOrder==="original"||I.concurrency!==void 0)return g(x,I);if(!(typeof x==="object"&&x!==null&&!Array.isArray(x)))return A(new ft(n,x,I));let C=m(),S=x,y={},h={ast:n,input:S,out:y,issues:void 0,options:I};try{for(let E=0;E<C.length;E++){let k=C[E],T=k.name,F=Object.hasOwn(S,T),N=F?S[T]:Re,R=k.parser(N,I);if(!We(R))return b(h,E,R);if(R===Dt){if(F)U(y,T,N);continue}let z=sv(h,k,R);if(z)return z}}catch(E){return ko(E)}return Dr(y)}}_rebuild(e,t,n,r){let o=Pu(this.propertySignatures,(i)=>{let a=e(i.type);return a===i.type?i:new ng(i.name,a)}),s=Pu(this.indexSignatures,(i)=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new rg(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new Mu(o,s,this.annotations,n,void 0,this.context,r)}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(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}};DM=uf()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(Re,e.options);let n=e.input[t.name];return U(e.out,t.name,n),t.parser(n,e.options)},step:sv});ig=Ji((e)=>{while(!0){if(B6(e))return Rs;let t=e.encoding;if(!t)return e.recur?.(ig,D)??e;if(t.some((n)=>n.transformation._tag==="Middleware"&&n.transformation.decode!==D))return Rs;e=t[t.length-1].to}});$M=new WeakMap,fd=Object.freeze([]);Fn=class Fn extends wt{_tag="Union";types;mode;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.types=e,this.mode=t,this.encodingChecks=i}getParser(e,t){let n=this;return(r,o)=>{if(r===Re)return no;let s=md(r,n.types,t!==void 0);if(s.length===1){let u=e(s[0])(r,o);if(u._tag==="Success")return u;return We(u)?UM(n,u.cause,r,o):xr(u,(l)=>UM(n,l,r,o))}let i={ast:n,compile:e,input:r,out:void 0,successes:n.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=gv(o?.concurrency),c=K6(i,s,a?{...a,orderedStep:!0}:void 0);if(!c){if(i.out)return i.out;return A(new sd(n,i.issues??[],r,o))}return on(c,(u)=>{if(i.out===Dt)return v(r);if(i.out)return i.out;return A(new sd(n,i.issues??[],r,o))})}}_rebuild(e,t,n){let r=Pu(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Fn(r,this.mode,this.annotations,t,void 0,this.context,n)}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 n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let n=this.types.map((r)=>{let o=Jn(r);switch(o._tag){case"Arrays":{let s=o.elements.filter(_u);if(s.length>0)return`${LM(o.isMutable)}[ ${s.map((i)=>e(i)+jM(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter((i)=>_u(i.type));if(s.length>0)return`{ ${s.map((i)=>`${LM(i.type.context?.isMutable)}${Go(i.name)}${jM(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(n)).join(" | ")}};K6=uf()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=id(n.cause);if(r===void 0)return n;if(e.issues)e.issues.push(r);else e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),Rr(new kw(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return fr}}}),p1=new Fn([new Er("Infinity"),new Er("-Infinity"),new Er("NaN")],"anyOf");ag=class ag extends wt{_tag="Suspend";thunk;constructor(e,t,n,r,o){if(n)throw Error("Cannot add checks to Suspend");super(t,void 0,r,o);this.thunk=Ha(e)}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(e){return new ag(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}};dd=class dd extends Gi{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,n=!1){super();this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new dd(this.run,{...this.annotations,...e},this.aborted)}abort(){return new dd(this.run,this.annotations,!0)}and(e,t){return new Pi([this,e],t)}};Pi=class Pi extends Gi{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new Pi(this.checks,{...this.annotations,...e})}and(e,t){return new Pi([this,e],t)}};Ev=Fo(hv,[Sv()]),V6=new dt(new Fn([Ev,p1],"anyOf"),new Pe(zh(),ve((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));m1=new WeakMap;Du=Ji((e)=>{let t=e.context?e.context.isOptional===!1?new so(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new so(!0,!1);return G6(xd(e,t))}),G6=wv(Du),S1=Qt((e)=>Du(new Fn([e,fv],"anyOf"))),kv=Ji((e)=>{let t=e.context?e.context.isMutable===!1?new so(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new so(!1,!0);return J6(xd(e,t))}),J6=wv(kv);sn=Ji((e)=>{if(e.encoding)return sn(Ge(e,void 0));let t=e,n=t.recur?.(sn)??t,r=n.encodingChecks;if(r){let o=n===e?r:uv(n)||j6(n)||Mi(n)&&n.typeParameters.length>0?Y6(r):void 0;return gd(n,(s)=>{s.encodingChecks.value=void 0,s.checks.value=xv(n.checks,o)})}return n}),Jn=Ji((e)=>sn(oo(e)));oo=Qt((e)=>{if(e.encoding)return Q6(e,e.encoding);let t=e;return t.flip?.(oo)??t.recur?.(oo)??t});I1=Qt((e)=>new Fn(e.enums.map((t)=>new Er(t[1],{title:t[0]})),"anyOf")),Iv=qa((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Iv)}}),mg=qa((e)=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(mg)}}),C1=qa((e)=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(C1)}}),iv=new globalThis.RegExp(`^${tg}$`),X6=new globalThis.RegExp(`^(?:${tg}|Infinity|-Infinity|NaN)$`);O1=Fo(Po,[Cv()]),e5=new dt(O1,Au),t5=new dt(new Fn([O1,p1],"anyOf"),Au),av=new globalThis.RegExp(`^${n5}$`);Ov=Fo(Po,[Tv({expected:"a string representing a bigint"})]),r5=new dt(Ov,Qh),cv=new globalThis.RegExp(`^${o5}$`),s5=Fo(Po,[Av()]),A1=new dt(s5,new Pe(ve((e)=>globalThis.Symbol.for(cv.exec(e)[1])),Vn((e,t)=>{if(globalThis.Symbol.keyFor(e)!==void 0)return v(globalThis.String(e));return A(new Tu({message:"cannot serialize to string, Symbol is not registered"},e,t))})));Fu=new Ba([],()=>(e,t,n)=>$u(e)?Dt:A(new ft(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>Rv,toArbitrary:()=>(e)=>e.jsonValue()}),F1=Ur(Fu,{representation:{id:"effect/schema/MutableJson",payload:null}}),_v=new dt(Fu,Ou()),M1=new dt(new Fn([new io(!1,[],[Fu]),new Mu([],[new rg(Po,Fu)])],"anyOf"),Ou());u5=new Ba([],()=>(e,t,n)=>c5(e)?Dt:A(new ft(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{return}}),Rv=new dt(u5,Ou())});function Pv(){return Object.assign((e)=>e,{option:(e)=>_(e),result:(e)=>G(e),is:(e)=>!0})}var N1=w(()=>{_e();gn()});var $1,U1,D1="~effect/ChildProcessSpawner/ChildProcessHandle",f5,Fv=(e)=>Object.setPrototypeOf({...e},f5),L1=(e)=>{let t=(r,o)=>e(r).pipe(oe((s)=>sF(o?.includeStderr===!0?s.all:s.stdout)),Ii),n=(r,o)=>iF(t(r,o));return Uu.of({spawn:e,exitCode:(r)=>vi(ne(e(r),(o)=>o.exitCode)),streamString:t,streamLines:n,lines:(r,o)=>aF(n(r,o)),string:(r,o)=>cF(t(r,o))})},Uu;var Mv=w(()=>{N1();Ve();Oe();jn();vu();$1=Pv(),U1=Pv(),f5={[D1]:D1,...G0,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}};Uu=class Uu extends ze()("effect/process/ChildProcessSpawner"){}});var j1="~effect/unstable/process/ChildProcess",d5,hg=(e,t,n)=>Object.assign(Object.create(d5),{_tag:"StandardCommand",command:e,args:t,options:n}),gg=function(...t){if(B1(t[0])){let[s,...i]=t,a=H1(s,i);return hg(a[0]??"",a.slice(1),{})}if(typeof t[0]==="object"&&!Array.isArray(t[0])&&!B1(t[0])){let s=t[0];return function(i,...a){let c=H1(i,a);return hg(c[0]??"",c.slice(1),s)}}if(typeof t[0]==="string"&&!Array.isArray(t[1])){let[s,i={}]=t;return hg(s,[],i)}let[n,r=[],o={}]=t;return hg(n,r,o)},B1=(e)=>Array.isArray(e)&&("raw"in e)&&Array.isArray(e.raw),xg=(e)=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},K1=(e)=>`fd${e}`,H1=(e,t)=>{let n=[];for(let[r,o]of e.entries())n=p5(e,t,n,o,r);return n},p5=(e,t,n,r,o)=>{let s=e.raw[o];if(s===void 0)throw Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:i,hasTrailingWhitespace:a,tokens:c}=h5(r,s),u=W1(n,c,i);if(o===t.length)return u;let l=t[o],f=Array.isArray(l)?l.map((d)=>q1(d)):[q1(l)];return W1(u,f,a)},q1=(e)=>{if(typeof e==="string")return e;return String(e)},z1,m5,h5=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=z1.has(t[0]),r=[],o=0;for(let i=0,a=0;i<e.length;i+=1,a+=1){let c=t[a];if(z1.has(c)){if(o!==i)r.push(e.slice(o,i));o=i+1}else if(c==="\\"){let u=t[a+1];if(u===`
33
+ `)i-=1,a+=1;else if(u==="u"&&t[a+2]==="{")a=t.indexOf("}",a+3);else a+=m5[u]??1}}let s=o===e.length;if(!s)r.push(e.slice(o));return{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:s}},W1=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];var V1=w(()=>{Ve();Pc();Mv();d5={...So({label:"Command",evaluate(e){return Gr(e.context,Uu).spawn(this)}}),[j1]:j1},z1=new Set([" ","\t","\r",`
34
+ `]),m5={x:3,u:5}});var G1=(e,t,n)=>{let r=e.detached??n!=="win32";return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}};var He=(e,t)=>(n,[r])=>{let o="Unknown";switch(n.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 Nr({_tag:o,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})};var Nv=w(()=>{Oo()});var Lu=(e)=>iw(rw(x5(e),(t)=>[t])),x5=(e)=>Sn((t)=>{let n=e.evaluate();return v(y5({...e,writable:n,pull:t}))}),y5=(e)=>e.pull.pipe(ne((t)=>{let n=0;return yn(function r(o){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once("drain",()=>r(o));return}o(Te)})}),Co({disableYield:!0}),_a(yn((t)=>{let n=(r)=>t(A(e.onError(r)));return e.writable.once("error",n),Se(()=>{e.writable.off("error",n)})})),e.endOnDone!==!1?mr((t)=>{if("closed"in e.writable&&e.writable.closed)return _t(t);return yn((n)=>{e.writable.once("finish",()=>n(_t(t))),e.writable.end()})}):D);var Dv=w(()=>{rn();Jf();Oe();X();Ca();Oh()});var ju=(e)=>to(E5(e)),E5=(e)=>Sn((t,n)=>b5({scope:n,readable:e.evaluate(),onError:e.onError??w5,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),b5=(e)=>{let t=e.readable,n=e.closeOnDone??!0,r=e.exit??hP(void 0),o=dP(!1);function s(){o.openUnsafe()}function i(u){r.current=Rr(e.onError(u)),o.openUnsafe()}function a(){r.current=Rr(gf()),o.openUnsafe()}t.on("readable",s),t.once("error",i),t.once("end",a);let c=Ne(function u(){let l=e.readable.read(e.chunkSize);if(l===null){if(r.current)return r.current;if(t.readableEnded)return A(gf());return o.closeUnsafe(),ne(o.await,u)}let f=da(l);while(!0){if(l=e.readable.read(e.chunkSize),l===null)break;f.push(l)}return v(f)});return gr(Ef(e.scope,Se(()=>{if(t.off("readable",s),t.off("error",i),t.off("end",a),n&&"closed"in e.readable&&!e.readable.closed)e.readable.destroy()})),c)},w5=(e)=>new ZE(e);var $v=w(()=>{An();rn();Jf();Oe();dr();pP();gP();bf();vu()});import*as yg from"child_process";import{PassThrough as Uv}from"stream";var za=(e)=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Mo=(e,t,n)=>{let{commands:r}=Y1(n),o=r.reduce((s,i)=>{let a=`${i.command} ${i.args.join(" ")}`;return s.length===0?a:`${s} | ${a}`},"");return He("ChildProcess",e)(t,[o])},J1=(e,t=()=>{})=>yg.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t),k5,Z1,Y1=(e)=>{let t=[],n=[],r=(a)=>{switch(a._tag){case"StandardCommand":{t.push(a);break}case"PipedCommand":{r(a.left),n.push(a.options),r(a.right);break}}};if(r(e),t.length===0)throw Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:n}};var Q1=w(()=>{eb();Oe();dr();Rh();wo();Ph();he();Oh();vu();V1();Mv();Nv();Dv();$v();k5=qt(function*(){let e=yield*Ci,t=yield*Ao,n=H(function*(y){if(Gs(y.cwd))return;return yield*e.access(y.cwd),t.resolve(y.cwd)}),r=(y)=>y.extendEnv?{...globalThis.process.env,...y.env}:y.env,o=(y)=>Fa(y)?"pipe":y,s=(y)=>Zf(y)?"pipe":y,i=(y)=>{let h={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(Gs(y.stdin))return h;if(typeof y.stdin==="string")return{...h,stream:y.stdin};if(Fa(y.stdin))return{...h,stream:y.stdin};return{stream:y.stdin.stream,encoding:y.stdin.encoding??h.encoding,endOnDone:y.stdin.endOnDone??h.endOnDone}},a=(y,h)=>{let E=y[h];if(Gs(E))return{stream:"pipe"};if(typeof E==="string")return{stream:E};if(Zf(E))return{stream:E};return{stream:E.stream}},c=(y)=>{if(Gs(y.additionalFds))return[];let h=[];for(let[E,k]of Object.entries(y.additionalFds)){let T=xg(E);if(Le(T))h.push({fd:T,config:k})}return h.sort((E,k)=>E.fd-k.fd)},u=(y,h,E,k)=>{let T=[o(y.stream),s(h.stream),s(E.stream)];if(k.length===0)return T;let F=k.reduce((N,{fd:R})=>Math.max(N,R),2);for(let N=3;N<=F;N++)T[N]="ignore";for(let{fd:N}of k)T[N]="pipe";return T},l=H(function*(y,h,E){if(E.length===0)return{getInputFd:()=>Yf,getOutputFd:()=>wu};let k=new Map,T=new Map;for(let{config:F,fd:N}of E){let R=h.stdio[N];switch(F.type){case"input":{let z=Yf;if(R&&"write"in R)z=Lu({evaluate:()=>R,onError:(q)=>Mo(`fromWritable(fd${N})`,za(q),y)});if(F.stream)yield*xu(dw(F.stream,z));k.set(N,z);break}case"output":{let z=wu;if(R&&"read"in R){let q=new Uv;R.on("error",(ue)=>q.destroy(ue)),R.pipe(q),z=ju({evaluate:()=>q,onError:(ue)=>Mo(`fromReadable(fd${N})`,za(ue),y)})}if(F.sink)z=Ah(z,F.sink);T.set(N,z);break}}}return{getInputFd:(F)=>k.get(F)??Yf,getOutputFd:(F)=>T.get(F)??wu}}),f=(y,h,E)=>Ne(()=>{let k=Yf;if(wl(h.stdin))k=Lu({evaluate:()=>h.stdin,onError:(T)=>Mo("fromWritable(stdin)",za(T),y),endOnDone:E.endOnDone,encoding:E.encoding});if(Fa(E.stream))return gr(xu(dw(E.stream,k)),k);return v(k)}),d=(y,h,E,k)=>{let T=h.stdout?(()=>{let R=new Uv;return h.stdout.on("error",(z)=>R.destroy(z)),h.stdout.pipe(R),ju({evaluate:()=>R,onError:(z)=>Mo("fromReadable(stdout)",za(z),y)})})():wu,F=h.stderr?(()=>{let R=new Uv;return h.stderr.on("error",(z)=>R.destroy(z)),h.stderr.pipe(R),ju({evaluate:()=>R,onError:(z)=>Mo("fromReadable(stderr)",za(z),y)})})():wu;if(Zf(E.stream))T=Ah(T,E.stream);if(Zf(k.stream))F=Ah(F,k.stream);let N=oF(T,F);return{stdout:T,stderr:F,all:N}},m=(y,h)=>yn((E)=>{let k=Wm(),T=yg.spawn(y.command,y.args,h);return T.on("error",(F)=>{E(A(Mo("spawn",F,y)))}),T.on("exit",(...F)=>{XE(k,_r(F))}),T.on("spawn",()=>{E(v([T,k]))}),Se(()=>{T.kill("SIGTERM")})}),g=(y,h,E)=>{if(globalThis.process.platform==="win32")return yn((k)=>{J1(h,(T)=>{if(T)k(A(Mo("kill",za(T),y)));else k(Te)})});return Nt({try:()=>{globalThis.process.kill(-h.pid,E)},catch:(k)=>Mo("kill",za(k),y)})},b=(y,h)=>{if(globalThis.process.platform==="win32"){J1(y);return}try{globalThis.process.kill(-y.pid,h)}catch{}},x=(y,h,E)=>Ne(()=>{if(!h.kill(E)){let T=new globalThis.Error("Failed to kill child process");return A(Mo("kill",T,y))}return Te}),I=(y,h,E)=>(k)=>{let T=E?.killSignal??"SIGTERM";return Gs(E?.forceKillAfter)?k(h,y,T):Bb(k(h,y,T),{duration:E.forceKillAfter,orElse:()=>k(h,y,"SIGKILL")})},C=(y,h)=>{let E=h??"stdout";switch(E){case"stdout":return y.stdout;case"stderr":return y.stderr;case"all":return y.all;default:{let k=xg(E);if(Le(k))return y.getOutputFd(k);return y.stdout}}},S=H(function*(y){switch(y._tag){case"StandardCommand":{let h=i(y.options),E=a(y.options,"stdout"),k=a(y.options,"stderr"),T=c(y.options),F=!0,N=yield*n(y.options),R=r(y.options),z=u(h,E,k,T),[q,ue]=yield*Mr(m(y,G1(y.options,{cwd:N,env:R,stdio:z},process.platform)),H(function*([Hr,Ec]){let bc=yield*QE(Ec),xl=I(Hr,y,y.options);if(bc){let[Vs]=yield*va(Ec);if(Vs!==0&&wl(Vs))return yield*Nf(xl(g));return yield*Te}if(!F)return yield*Te;return yield*xl((Vs,D0,$0)=>g(Vs,D0,$0).pipe(Pr(()=>x(Vs,D0,$0)),hr(va(Ec)))).pipe(Nf)})),ut=U1(q.pid);q.on("exit",(Hr)=>{if(Hr!==0&&wl(Hr))b(q,y.options.killSignal??"SIGTERM")});let Ks=Se(()=>{if(!F)q.ref(),F=!0}),gl=Se(()=>{if(F)q.unref(),F=!1;return Ks}),kp=yield*f(y,q,h),{all:Ip,stderr:wy,stdout:vy}=d(y,q,E,k),{getInputFd:Oq,getOutputFd:Aq}=yield*l(y,q,T),_q=oe(QE(ue),(Hr)=>!Hr),Rq=ne(va(ue),([Hr,Ec])=>{if(wl(Hr))return v($1(Hr));let bc=new globalThis.Error(`Process interrupted due to receipt of signal: '${Ec}'`);return A(Mo("exitCode",bc,y))});return Fv({pid:ut,exitCode:Rq,isRunning:_q,kill:(Hr)=>I(q,y,Hr)((bc,xl,Vs)=>g(bc,xl,Vs).pipe(Pr(()=>x(bc,xl,Vs)),hr(va(ue)))).pipe(Ff),stdin:kp,stdout:vy,stderr:wy,all:Ip,getInputFd:Oq,getOutputFd:Aq,unref:gl})}case"PipedCommand":{let{commands:h,pipeOptions:E}=Y1(y),[k,...T]=h,F=[yield*S(k)];for(let q=0;q<T.length;q++){let ue=T[q],ut=E[q]??{},Ks=i(ue.options),gl=Ii(v(C(F[F.length-1],ut.from))),kp=ut.to??"stdin";if(kp==="stdin")F.push(yield*S(gg(ue.command,ue.args,{...ue.options,stdin:{...Ks,stream:gl}})));else{let Ip=xg(kp);if(Le(Ip)){let wy=K1(Ip),vy=ue.options.additionalFds??{};F.push(yield*S(gg(ue.command,ue.args,{...ue.options,additionalFds:{...vy,[wy]:{type:"input",stream:gl}}})))}else F.push(yield*S(gg(ue.command,ue.args,{...ue.options,stdin:{...Ks,stream:gl}})))}}let N=F[F.length-1],R=(q)=>Oa([...F].reverse(),(ue)=>Nf(ue.kill(q)),{discard:!0}),z=qt(function*(){let q=[];for(let ue of F)q.push(yield*ue.unref);return Oa([...q].reverse(),(ue)=>ue,{discard:!0})});return Fv({pid:N.pid,exitCode:N.exitCode,isRunning:N.isRunning,kill:R,stdin:N.stdin,stdout:N.stdout,stderr:N.stderr,all:N.all,getInputFd:N.getInputFd,getOutputFd:N.getOutputFd,unref:z})}}});return L1(S)}),Z1=su(Uu,k5)});var X1=w(()=>{Q1()});function eN(e=rN()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function tN(e,t=rN()){let n=Math.min(Math.max(0,Math.trunc(e)),T5);return t[0]=Math.floor(n/1099511627776),t[1]=Math.floor(n/4294967296)&255,t[2]=Math.floor(n/16777216)&255,t[3]=Math.floor(n/65536)&255,t[4]=Math.floor(n/256)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var C5=(e)=>e.toString(16).padStart(2,"0"),nN=(e)=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map((n)=>Array.from(n,C5).join("")).join("-"),rN=()=>globalThis.crypto.getRandomValues(new Uint8Array(16)),oN=(e)=>nN(e===void 0?eN():eN(e)),T5=281474976710655,sN=(e,t)=>nN(t===void 0?tN(e):tN(e,t));var iN="~effect/platform/Crypto",Lv,aN=(e)=>{let t=e.randomBytes,n=(i)=>oe(A5("randomBytes",i),t),r=(i)=>(i[0]&31)*281474976710656+i[1]*1099511627776+i[2]*4294967296+i[3]*16777216+i[4]*65536+i[5]*256+i[6],o=()=>r(t(7))/9007199254740992,s=()=>{while(!0){let i=t(7),a=r(i);if((i[0]&32)===0)return a+Number.MIN_SAFE_INTEGER;if(a<Number.MAX_SAFE_INTEGER)return a+1}};return Lv.of({[iN]:iN,randomBytes:n,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:Se(()=>o()),randomBoolean:Se(()=>o()>0.5),randomInt:Se(()=>s()),randomBetween:(i,a)=>Se(()=>o()*(a-i)+i),randomIntBetween(i,a,c){let u=c?.halfOpen===!0?0:1;return Se(()=>{let l=Math.ceil(i),f=Math.floor(a);return Math.floor(o()*(f-l+u))+l})},randomShuffle:(i)=>Se(()=>{let a=Array.from(i);for(let c=a.length-1;c>=1;c=c-1){let u=Math.min(c,Math.floor(o()*(c+1))),l=a[c];a[c]=a[u],a[u]=l}return a}),randomUUIDv4:Se(()=>oN(t(16))),randomUUIDv7:jf((i)=>v(sN(i.currentTimeMillisUnsafe(),t(16))))})},A5=(e,t)=>Number.isSafeInteger(t)&&t>=0?v(t):A(bs({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));var cN=w(()=>{Ve();Oe();Oo();Lv=ze("effect/Crypto")});import*as Sg from"crypto";var R5=(e)=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},P5=(e,t)=>Nt({try:()=>Uint8Array.from(Sg.createHash(R5(e)).update(t).digest()),catch:(n)=>Nr({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:n})}),F5,uN;var lN=w(()=>{cN();Oe();wo();Oo();F5=aN({randomBytes:Sg.randomBytes,digest:P5}),uN=Si(Lv,F5)});var fN;var dN=w(()=>{lN();fN=uN});import*as pN from"crypto";import*as ee from"fs";import*as mN from"os";import*as Bu from"path";var it=(e)=>(t)=>bs({module:"FileSystem",method:e,description:t.message??String(t)}),D5,$5,U5,L5,j5,B5,H5,q5,jv=(e)=>{let t=ot(ee.mkdtemp,He("FileSystem",e),it(e));return(n)=>Ne(()=>{let r=n?.prefix??"",o=typeof n?.directory==="string"?Bu.join(n.directory,"."):mN.tmpdir();return t(r?Bu.join(o,r):o+"/")})},z5,Bv=(e)=>{let t=ot(ee.rm,He("FileSystem",e),it(e));return(n,r)=>t(n,{recursive:r?.recursive??!1,force:r?.force??!1})},W5,K5,V5=(e)=>{let t=ot(ee.open,He("FileSystem",e),it(e)),n=ot(ee.close,He("FileSystem",e),it(e));return(r,o)=>zr(Mr(t(r,o?.flag??"r",o?.mode),(s)=>Fr(n(s))),oe((s)=>J5(s,o?.flag?.startsWith("a")??!1)))},G5,J5,hN=(e)=>{let t=jv(e);return H(function*(n){let r=yield*t(n),o=pN.randomBytes(6).toString("hex"),s=Bu.join(r,n?.suffix?`${o}${n.suffix}`:o);return yield*xN(s,new Uint8Array(0)),s})},Z5,Y5,Q5=(e,t)=>lu({try:()=>ee.promises.readdir(e,t),catch:(n)=>He("FileSystem","readDirectory")(n,[e])}),X5=(e)=>yn((t,n)=>{try{ee.readFile(e,{signal:n},(r,o)=>{if(r)t(A(He("FileSystem","readFile")(r,[e])));else t(v(o))})}catch(r){t(A(it("readFile")(r)))}}),eZ,tZ,nZ,gN=(e)=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:Tn(e.mtime),atime:Tn(e.atime),birthtime:Tn(e.birthtime),dev:e.dev,rdev:Tn(e.rdev),ino:Tn(e.ino),mode:e.mode,nlink:Tn(e.nlink),uid:Tn(e.uid),gid:Tn(e.gid),size:Cs(e.size),blksize:e.blksize!==void 0?_(Cs(e.blksize)):O(),blocks:Tn(e.blocks)}),Hv,rZ,oZ,sZ,iZ=(e,t)=>nF((n)=>Mr(Se(()=>{let r=ee.watch(e,{recursive:t?.recursive??!1},(o,s)=>{if(!s)return;switch(o){case"rename":{To(uh(Hv(s),{onSuccess:(i)=>zf(n,{_tag:"Create",path:s}),onFailure:(i)=>zf(n,{_tag:"Remove",path:s})}));return}case"change":{Wf(n,{_tag:"Update",path:s});return}}});return r.on("error",(o)=>{Vf(n,GE(Nr({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:o})))}),r.on("close",()=>{ks(n)}),r}),(r)=>Se(()=>r.close()))),aZ=(e,t,n)=>Hv(t).pipe(oe((r)=>e.pipe(rs((o)=>o.register(t,r,n)),mt(()=>iZ(t,n)))),Ii),xN=(e,t,n)=>yn((r,o)=>{try{ee.writeFile(e,t,{signal:o,flag:n?.flag,mode:n?.mode},(s)=>{if(s)r(A(He("FileSystem","writeFile")(s,[e])));else r(Te)})}catch(s){r(A(it("writeFile")(s)))}}),cZ,yN;var SN=w(()=>{rn();Oe();Oe();Rh();X();wo();_e();Oo();Gf();vu();Nv();D5=(()=>{let e=ot(ee.access,He("FileSystem","access"),it("access"));return(t,n)=>{let r=ee.constants.F_OK;if(n?.readable)r|=ee.constants.R_OK;if(n?.writable)r|=ee.constants.W_OK;return e(t,r)}})(),$5=(()=>{let e=ot(ee.cp,He("FileSystem","copy"),it("copy"));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),U5=(()=>{let e=ot(ee.copyFile,He("FileSystem","copyFile"),it("copyFile"));return(t,n)=>e(t,n)})(),L5=(()=>{let e=ot(ee.chmod,He("FileSystem","chmod"),it("chmod"));return(t,n)=>e(t,n)})(),j5=(()=>{let e=ot(ee.chown,He("FileSystem","chown"),it("chown"));return(t,n,r)=>e(t,n,r)})(),B5=(()=>{let e=ot(ee.glob,He("FileSystem","glob"),it("glob"));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),H5=(()=>{let e=ot(ee.link,He("FileSystem","link"),it("link"));return(t,n)=>e(t,n)})(),q5=(()=>{let e=ot(ee.mkdir,He("FileSystem","makeDirectory"),it("makeDirectory"));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),z5=jv("makeTempDirectory"),W5=Bv("remove"),K5=(()=>{let e=jv("makeTempDirectoryScoped"),t=Bv("makeTempDirectoryScoped");return(n)=>Mr(e(n),(r)=>Fr(t(r,{recursive:!0})))})(),G5=V5("open"),J5=(()=>{let e=(l)=>ot(ee.read,He("FileSystem",l),it(l)),t=e("read"),n=e("readAlloc"),r=ot(ee.fstat,He("FileSystem","stat"),it("stat")),o=ot(ee.ftruncate,He("FileSystem","truncate"),it("truncate")),s=ot(ee.fsync,He("FileSystem","sync"),it("sync")),i=(l)=>ot(ee.write,He("FileSystem",l),it(l)),a=i("write"),c=i("writeAll");class u{[_h];fd;append;position=BigInt(0);constructor(l,f){this[_h]=_h,this.fd=l,this.append=f}get stat(){return oe(r(this.fd),gN)}get sync(){return s(this.fd)}seek(l,f){let d=Cs(l);return Se(()=>{if(f==="start")this.position=d;else if(f==="current")this.position=this.position+d;return Cs(this.position)})}read(l){return Ne(()=>{let f=this.position;return oe(t(this.fd,{buffer:l,position:f}),(d)=>{let m=Cs(d);return this.position=f+m,m})})}readAlloc(l){let f=Number(l);return Ne(()=>{let d=Buffer.allocUnsafeSlow(f),m=this.position;return oe(n(this.fd,{buffer:d,position:m}),(g)=>{if(g===0)return O();if(this.position=m+BigInt(g),g===f)return _(d);let b=Buffer.allocUnsafeSlow(g);return d.copy(b,0,0,g),_(b)})})}truncate(l){return oe(o(this.fd,l?Number(l):void 0),()=>{if(!this.append){let f=BigInt(l??0);if(this.position>f)this.position=f}})}write(l){return Ne(()=>{let f=this.position;return oe(a(this.fd,l,void 0,void 0,this.append?void 0:Number(f)),(d)=>{let m=Cs(d);if(!this.append)this.position=f+m;return m})})}writeAllChunk(l){return Ne(()=>{let f=this.position;return ne(c(this.fd,l,void 0,void 0,this.append?void 0:Number(f)),(d)=>{if(d===0)return A(Nr({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"}));if(!this.append)this.position=f+BigInt(d);return d<l.length?this.writeAllChunk(l.subarray(d)):Te})})}writeAll(l){return this.writeAllChunk(l)}}return(l,f)=>new u(l,f)})(),Z5=hN("makeTempFile"),Y5=(()=>{let e=hN("makeTempFileScoped"),t=Bv("makeTempFileScoped");return(n)=>Mr(e(n),(r)=>Fr(t(Bu.dirname(r),{recursive:!0})))})(),eZ=(()=>{let e=ot(ee.readlink,He("FileSystem","readLink"),it("readLink"));return(t)=>e(t)})(),tZ=(()=>{let e=ot(ee.realpath,He("FileSystem","realPath"),it("realPath"));return(t)=>e(t)})(),nZ=(()=>{let e=ot(ee.rename,He("FileSystem","rename"),it("rename"));return(t,n)=>e(t,n)})(),Hv=(()=>{let e=ot(ee.stat,He("FileSystem","stat"),it("stat"));return(t)=>oe(e(t),gN)})(),rZ=(()=>{let e=ot(ee.symlink,He("FileSystem","symlink"),it("symlink"));return(t,n)=>e(t,n)})(),oZ=(()=>{let e=ot(ee.truncate,He("FileSystem","truncate"),it("truncate"));return(t,n)=>e(t,n!==void 0?Number(n):void 0)})(),sZ=(()=>{let e=ot(ee.utimes,He("FileSystem","utime"),it("utime"));return(t,n,r)=>e(t,n,r)})(),cZ=oe(fh(pw),(e)=>lF({access:D5,chmod:L5,chown:j5,copy:$5,copyFile:U5,glob:B5,link:H5,makeDirectory:q5,makeTempDirectory:z5,makeTempDirectoryScoped:K5,makeTempFile:Z5,makeTempFileScoped:Y5,open:G5,readDirectory:Q5,readFile:X5,readLink:eZ,realPath:tZ,remove:W5,rename:nZ,stat:Hv,symlink:rZ,truncate:oZ,utimes:sZ,watch(t,n){return aZ(e,t,n)},writeFile:xN})),yN=su(Ci)(cZ)});var EN;var bN=w(()=>{SN();EN=yN});import*as Ed from"path";import*as Eg from"url";var qv=(e)=>({fromFileUrl:(t)=>Nt({try:()=>Eg.fileURLToPath(t,{windows:e}),catch:(n)=>new Es({module:"Path",method:"fromFileUrl",cause:n})}),toFileUrl:(t)=>Nt({try:()=>Eg.pathToFileURL(t,{windows:e}),catch:(n)=>new Es({module:"Path",method:"toFileUrl",cause:n})})}),fZ,dZ,wN;var vN=w(()=>{Oe();wo();Ph();Oo();fZ=Si(Ao)({[Ts]:Ts,...Ed.posix,...qv(!1)}),dZ=Si(Ao)({[Ts]:Ts,...Ed.win32,...qv(!0)}),wN=Si(Ao)({[Ts]:Ts,...Ed,...qv(void 0)})});var kN;var IN=w(()=>{vN();kN=wN});var zv="~effect/Stdio",bg,CN=(e)=>({[zv]:zv,stdinIsTerminal:v(!1),stdoutIsTerminal:v(!1),...e});var Wv=w(()=>{Ve();Oe();bg=ze(zv)});var ON;var AN=w(()=>{Oe();wo();Oo();Wv();Dv();$v();ON=Si(bg,CN({args:Se(()=>process.argv.slice(2)),stdinIsTerminal:Se(()=>process.stdin.isTTY===!0),stdoutIsTerminal:Se(()=>process.stdout.isTTY===!0),stdout:(e)=>Lu({evaluate:()=>process.stdout,onError:(t)=>Nr({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:(e)=>Lu({evaluate:()=>process.stderr,onError:(t)=>Nr({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:ju({evaluate:()=>process.stdin,onError:(e)=>Nr({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}))});var _N;var RN=w(()=>{AN();_N=ON});var wg="~effect/collections/Graph",Kv=(e)=>e,xZ=(e,t,n)=>(e==="directed"?t.source===n.source&&t.target===n.target:t.source===n.source&&t.target===n.target||t.source===n.target&&t.target===n.source)&&Y(t.data,n.data),yZ=(e,t)=>e==="directed"?re(t):Js(re(t.data)^re(t.source)+re(t.target)),SZ,PN=(e,t)=>{let n=Object.create(SZ);return n.type=e,n.mutable=t,n.transforming=!1,n.nodes=new Map,n.edges=new Map,n.adjacency=new Map,n.reverseAdjacency=new Map,n.nextNodeIndex=0,n.nextEdgeIndex=0,n.acyclic=_(!0),n},bd=(e)=>{let t=Kv(e);return{type:e.type,nodes:Array.from(t.nodes,([n,r])=>({index:n,data:r})).sort((n,r)=>n.index-r.index),edges:Array.from(t.edges,([n,r])=>({index:n,source:r.source,target:r.target,data:r.data})).sort((n,r)=>n.index-r.index)}},wd=(e)=>{let t=PN(e.type,!1);for(let n of e.nodes)t.nodes.set(n.index,n.data),t.adjacency.set(n.index,[]),t.reverseAdjacency.set(n.index,[]);for(let n of e.edges)if(t.edges.set(n.index,{source:n.source,target:n.target,data:n.data}),t.adjacency.get(n.source).push(n.index),t.reverseAdjacency.get(n.target).push(n.index),e.type==="undirected")t.adjacency.get(n.target).push(n.index),t.reverseAdjacency.get(n.source).push(n.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=O(),t};var Vv=w(()=>{yt();Xt();jn();_e();Qe();he();SZ={[wg]:{_N:(e)=>e,_E:(e)=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[At](){return this.toJSON()},[Ce](e){if(M(e,wg)){let t=Kv(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[n,r]of this.nodes)if(!t.nodes.has(n)||!Y(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!xZ(this.type,r,o))return!1}return!0}return!1},[Ie](){let e=qe("Graph");e=e^qe(this.type),e=e^Ln(this.nodes.size),e=e^Ln(this.edges.size);for(let[t,n]of this.nodes)e=e^re(t)+re(n);for(let[t,n]of this.edges)e=e^re(t)+yZ(this.type,n);return 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 le(this,arguments)}}});var EZ,Gv=(e)=>M(e,EZ),MN,bZ;var NN=w(()=>{yt();Xt();Vv();he();EZ=wg;MN=class MN{type;source;target;identity;constructor(e,t,n,r){this.type=e,this.source=t,this.target=n,this.identity=r}[Ce](e){if(!(e instanceof MN)||this.type!==e.type||!Y(this.identity,e.identity))return!1;if(this.type==="directed")return Y(this.source,e.source)&&Y(this.target,e.target);return Y(this.source,e.source)&&Y(this.target,e.target)||Y(this.source,e.target)&&Y(this.target,e.source)}[Ie](){let e=re(this.identity);return this.type==="directed"?xt(re(this.target))(xt(re(this.source))(e)):Js(e^re(this.source)+re(this.target))}};bZ=class bZ{[Symbol.iterator];visit;constructor(e){this.visit=e,this[Symbol.iterator]=()=>e((t,n)=>[t,n])[Symbol.iterator]()}}});function $N(e,t,n,r,o,s){if(t>32)throw Error("HashMap: max depth exceeded");let i=Di(n,t),a=Di(o,t);if(i===a){let l=$N(e,t+uo,n,r,o,s);return new No(e,i,[l])}let c=i|a,u=i>>>0<a>>>0?[r,s]:[s,r];return new No(e,c,u)}class Hu{canEdit(e){return this.edit===e}}var kg="~effect/collections/HashMap",uo=5,Cd,vZ,DN,kZ,IZ=(e)=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),vd=(e,t)=>e>>>t&kZ,Di=(e,t)=>1<<vd(e,t),vg=(e,t)=>IZ(e&t-1),UN,Fs,kd,No,Id,Ig,LN,Jv=(e)=>M(e,kg),Zv=()=>new Ig(!1,0,LN,0),jN=(e)=>{let t=LN,n=0,r={value:!1};for(let[o,s]of e){let i=re(o);if(r.value=!1,t=t.set(NaN,0,i,o,s,r),r.value)n++}return new Ig(!1,0,t,n)},BN,Yv,CZ=(e,t,n,r)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,n,t,r,s);if(o._editable){if(o._root=a,s.value)o._size++;return e}if(o._root===a)return e;return new Ig(!1,o._edit,a,o._size+(s.value?1:0))},Qv,Xv=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();if(n.done)return{done:!0,value:void 0};return{done:!1,value:n.value[0]}}}},HN=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},Cg=(e)=>e.size;var ek=w(()=>{yt();kn();X();Xt();jn();_e();Qe();he();Cd=1<<uo,vZ=Cd/4,DN=Cd/2,kZ=Cd-1;UN=class UN extends Hu{_tag="EmptyNode";edit=0;get size(){return 0}get(e,t,n){return O()}has(e,t,n){return!1}set(e,t,n,r,o,s){return s.value=!0,new Fs(e,n,r,o)}remove(e,t,n,r,o){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(e){return!1}};Fs=class Fs extends Hu{_tag="LeafNode";edit;hash;key;value;constructor(e,t,n,r){super();this.edit=e,this.hash=t,this.key=n,this.value=r}get size(){return 1}get(e,t,n){if(this.hash===t&&Y(this.key,n))return _(this.value);return O()}has(e,t,n){return this.hash===t&&Y(this.key,n)}set(e,t,n,r,o,s){if(this.hash===n&&Y(this.key,r)){if(Y(this.value,o))return this;if(this.canEdit(e))return this.value=o,this;return new Fs(e,n,r,o)}if(s.value=!0,this.hash===n)return new kd(e,n,[[this.key,this.value],[r,o]]);let i=Di(n,t),a=Di(this.hash,t);if(i===a)return new No(e,i,[this.set(e,t+uo,n,r,o,s)]);let c=i|a,u=i>>>0<a>>>0?[new Fs(e,n,r,o),this]:[this,new Fs(e,n,r,o)];return new No(e,c,u)}remove(e,t,n,r,o){if(this.hash===n&&Y(this.key,r)){o.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}};kd=class kd extends Hu{_tag="CollisionNode";edit;hash;entries;constructor(e,t,n){super();this.edit=e,this.hash=t,this.entries=n}get size(){return this.entries.length}get(e,t,n){if(this.hash!==t)return O();for(let[r,o]of this.entries)if(Y(r,n))return _(o);return O()}has(e,t,n){if(this.hash!==t)return!1;for(let[r]of this.entries)if(Y(r,n))return!0;return!1}set(e,t,n,r,o,s){if(this.hash!==n)return s.value=!0,$N(e,t,this.hash,this,n,new Fs(e,n,r,o));for(let i=0;i<this.entries.length;i++)if(Y(this.entries[i][0],r)){if(Y(this.entries[i][1],o))return this;if(this.canEdit(e))return this.entries[i]=[r,o],this;let a=[...this.entries];return a[i]=[r,o],new kd(e,this.hash,a)}if(s.value=!0,this.canEdit(e))return this.entries.push([r,o]),this;return new kd(e,this.hash,[...this.entries,[r,o]])}remove(e,t,n,r,o){if(this.hash!==n)return this;let s=this.entries.findIndex(([a])=>Y(a,r));if(s===-1)return this;if(o.value=!0,this.entries.length===1)return;if(this.entries.length===2){let a=this.entries[s===0?1:0];return new Fs(e,this.hash,a[0],a[1])}if(this.canEdit(e))return this.entries.splice(s,1),this;let i=[...this.entries];return i.splice(s,1),new kd(e,this.hash,i)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}};No=class No extends Hu{_tag="IndexedNode";edit;_size;bitmap;children;constructor(e,t,n){super();this.edit=e,this.bitmap=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+t.size,0);return this._size}get(e,t,n){let r=Di(t,e);if((this.bitmap&r)===0)return O();let o=vg(this.bitmap,r);return this.children[o].get(e+uo,t,n)}has(e,t,n){let r=Di(t,e);if((this.bitmap&r)===0)return!1;let o=vg(this.bitmap,r);return this.children[o].has(e+uo,t,n)}set(e,t,n,r,o,s){let i=Di(n,t),a=vg(this.bitmap,i);if((this.bitmap&i)!==0){let c=this.children[a],u=c.set(e,t+uo,n,r,o,s);if(c===u)return this;if(this.canEdit(e))return this.children[a]=u,this;let l=[...this.children];return l[a]=u,new No(e,this.bitmap,l)}else{s.value=!0;let c=new Fs(e,n,r,o),u=this.bitmap|i;if(this.canEdit(e)){if(this.children.splice(a,0,c),this.bitmap=u,this._size=void 0,this.children.length>DN)return this.expand(e,u,this.children);return this}let l=[...this.children];if(l.splice(a,0,c),l.length>DN)return this.expand(e,u,l);return new No(e,u,l)}}remove(e,t,n,r,o){let s=Di(n,t);if((this.bitmap&s)===0)return this;let i=vg(this.bitmap,s),a=this.children[i],c=a.remove(e,t+uo,n,r,o);if(!o.value)return this;if(c===void 0){let l=this.bitmap^s;if(l===0)return;if(this.children.length===2){let d=this.children[i===0?1:0];if(d._tag==="LeafNode")return d}if(this.canEdit(e))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let f=[...this.children];return f.splice(i,1),new No(e,l,f)}if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new No(e,this.bitmap,u)}expand(e,t,n){let r=new globalThis.Array(Cd),o=0;for(let s=0;s<Cd;s++)if((t&1<<s)!==0)r[s]=n[o++];return new Id(e,n.length,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){if(!t)t=this.children[e].iterator();let n=t.next();if(!n.done)return n;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}};Id=class Id extends Hu{_tag="ArrayNode";edit;_size;count;children;constructor(e,t,n){super();this.edit=e,this.count=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+(t?.size??0),0);return this._size}get(e,t,n){let r=vd(t,e),o=this.children[r];return o?o.get(e+uo,t,n):O()}has(e,t,n){let r=vd(t,e),o=this.children[r];return o?o.has(e+uo,t,n):!1}set(e,t,n,r,o,s){let i=vd(n,t),a=this.children[i];if(a){let c=a.set(e,t+uo,n,r,o,s);if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new Id(e,this.count,u)}else{s.value=!0;let c=new Fs(e,n,r,o);if(this.canEdit(e))return this.children[i]=c,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=c,new Id(e,this.count+1,u)}}remove(e,t,n,r,o){let s=vd(n,t),i=this.children[s];if(!i)return this;let a=i.remove(e,t+uo,n,r,o);if(!o.value)return this;let c=this.count-(a?0:1);if(c<vZ)return this.pack(e,s,a);if(i===a)return this;if(this.canEdit(e)){if(this.children[s]=a,!a)this.count=c;return this._size=void 0,this}let u=[...this.children];return u[s]=a,new Id(e,c,u)}pack(e,t,n){let r=[],o=0,s=1;for(let i=0;i<this.children.length;i++){let a=i===t?n:this.children[i];if(a)r.push(a),o|=s;s<<=1}return new No(e,o,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){let n=this.children[e];if(!n){e++;continue}if(!t)t=n.iterator();let r=t.next();if(!r.done)return r;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}};Ig=class Ig{[kg]=kg;_editable;_edit;_root;_size;constructor(e,t,n,r){this._editable=e,this._edit=t,this._root=n,this._size=r}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[Ce](e){if(Jv(e)){let t=e;if(this.size!==t.size)return!1;for(let[n,r]of this){let o=zr(e,BN(n));if(me(o)||!Y(r,o.value))return!1}return!0}return!1}[Ie](){let e=qe("HashMap");for(let[t,n]of this)e=e^re(t)+re(n);return e}[At](){return Wt(this)}toString(){return`HashMap(${B(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([e,t])=>[Wt(e),Wt(t)])}}pipe(){return le(this,arguments)}};LN=new UN,BN=p(2,(e,t)=>e._root.get(0,re(t),t)),Yv=p(2,(e,t)=>e._root.has(0,re(t),t)),Qv=p(3,(e,t,n)=>CZ(e,t,re(t),n))});var zN,Tg,AZ,Og=(e)=>Array.from(AZ(e)),WN;var KN=w(()=>{ek();zN=Jv,Tg=jN,AZ=HN,WN=Cg});var Td="~effect/collections/HashSet",RZ,PZ=(e)=>{let t=Object.create(RZ);return t[Td]=Td,t.keyMap=e,t},tk=(e)=>M(e,Td),nk=(e)=>e.keyMap,VN=(e)=>{let t=Zv();for(let n of e)t=Qv(t,n,!0);return PZ(t)},GN=(e,t)=>Yv(nk(e),t),Ag=(e)=>Cg(nk(e)),JN=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var ZN=w(()=>{yt();kn();Xt();jn();Qe();he();ek();RZ={[Ie](){return re(Td)},[Ce](e){return tk(e)&&Ag(this)===Ag(e)&&JN(this,(t)=>GN(e,t))},[Symbol.iterator](){return Xv(nk(this))},toString(){return`HashSet(${B(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:Wt(Array.from(this))}},[At](){return this.toJSON()},pipe(){return le(this,arguments)}}});var _g,YN,QN;var XN=w(()=>{ZN();_g=VN,YN=tk,QN=Ag});function Rg(e){let t=fD(Fg,sn(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Pg(e){let t=Rg(e);return(n,r)=>{let o=ki(t(n,r));if(Rt(o))return _(o.value);return Os(o.cause,"Option adapter can only return none for schema issues"),O()}}function tD(e){let t=Rg(e);return(n,r)=>{let o=ki(t(n,r));if(Rt(o))return o.value;let s=Os(o.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function nD(e){return Ad(e.ast)}function Ad(e){let t=Wa(_d(sn(e)));return(n)=>{let r=t(n,ja);if(Rt(r))return!0;return Os(r.cause,"Type guard adapter can only return false for schema issues"),!1}}function rD(e){let t=_d(e);return(n,r)=>{let o=ki(t(n,r));if(Rt(o))return;return Os(o.cause,"Issue adapter can only return schema issues")}}function oD(e,t){let r=Wa(_d(sn(e.ast)))(t,ja);if(ru(r)){let o=Os(r.cause,"Assertion adapter can only throw schema issues");throw Error("Schema validation failed",{cause:o})}}function vt(e,t){let n=_d(e.ast);return t===void 0?n:(r,o)=>n(r,Od(t,o))}function sD(e,t){return Wa(vt(e,t))}function ok(e,t){return dD(vt(e,t))}function aD(e,t){return pD(vt(e,t))}function NZ(e,t){return mD(vt(e,t))}function qu(e,t){let n=_d(oo(e.ast));return t===void 0?n:(r,o)=>n(r,Od(t,o))}function cD(e,t){return Wa(qu(e,t))}function ik(e,t){return dD(qu(e,t))}function lD(e,t){return pD(qu(e,t))}function DZ(e,t){return mD(qu(e,t))}function _d(e){return fD(hD,e)}function fD(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??ja);if(s===Dt)return v(r);if(!We(s))return on(s,eD);return s[ie]===Re?eD(Re):s}}function Wa(e){return(t,n)=>ki(e(t,n))}function dD(e){let t=Wa(e);return(n,r)=>{let o=t(n,r);if(Rt(o))return _(o.value);return Os(o.cause,"Option adapter can only return none for schema issues"),O()}}function pD(e){let t=Wa(e);return(n,r)=>{let o=t(n,r);if(Rt(o))return G(o.value);return te(Os(o.cause,"Result adapter can only return schema issues"))}}function mD(e){let t=Wa(e);return(n,r)=>{let o=t(n,r);if(Rt(o))return o.value;let s=Os(o.cause,"Sync adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function gD(e){return e.context?.constructorDefault?$Z(e):Fg(e)}function xD(e,t,n,r){let o;if(We(e)&&e._tag==="Success"){let s=Mh(e===Dt?t:e[ie]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(Dr(s),r)}else if(n._tag==="Transformation")o=on(e,(s)=>n.decode.run(Mh(s),r));else o=n.decode(Ss(e,Mh),r);return We(o)&&o._tag==="Success"?yw(o[ie]):on(o,yw)}function UZ(e,t){let n;return(r,o)=>{if(r===Re)return no;if(e.isConstructed(r))return Dt;let s=(n??=t(e.link.to))(r,o);return xD(s,r,e.link.transformation,o)}}function ck(e,t,n,r){let o=n?R1(e):void 0,s=o?UZ(o,t):e.getParser(t,n),i=e.checks,a=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c){if(!u)return s;return(d,m)=>s(d,Od(m,u))}let l,f=(d,m)=>{let g=s(d,m);if(c&&!m.disableChecks)if(We(g)){if(g._tag==="Success"){let b=g===Dt?d:g[ie];if(d!==Re&&b!==Re){let x=co(c,d,void 0,e,m);if(x)g=A(new Et(e,x,d,m))}}}else g=ne(g,(b)=>{if(d!==Re&&b!==Re){let x=co(c,d,void 0,e,m);if(x)return A(new Et(e,x,d,m))}return v(b)});if(i&&!m.disableChecks)if(We(g)){if(g._tag==="Success"){let b=g===Dt?d:g[ie];if(b===Re)return g;let x=co(i,b,void 0,e,m);if(x)g=A(new Et(e,x,b,m))}}else g=ne(g,(b)=>{if(b!==Re){let x=co(i,b,void 0,e,m);if(x)return A(new Et(e,x,b,m))}return v(b)});return g};if(!a)return u?(d,m)=>f(d,Od(m,u)):f;return(d,m)=>{if(u)m=Od(m,u);let g=l??=a.map((I)=>t(I.to)),b=d,x=g[g.length-1](d,m);for(let I=a.length-1;I>=0;I--)if(x=xD(x,b,a[I].transformation,m),I!==0){let C=g[I-1];if(x._tag==="Success")b=x[ie],x=C(b,m);else x=on(x,(S)=>{let y=C(S,m);return y===Dt?Dr(S):y})}if(x._tag==="Success"){let I=x[ie],C=f(I,m);return C===Dt?x:C}return x=xr(x,(I)=>Ei(()=>ms(I,(C)=>new vw(e,C,d,m)))),on(x,(I)=>{let C=f(I,m);return C===Dt?Dr(I):C})}}var rk,iD,sk,uD,ak,Od=(e,t)=>t?{...e,...t}:e,eD=(e)=>{if(e===Re)return A(new we);return v(e)},hD,Fg,$Z;var Mg=w(()=>{rn();Oe();dr();X();ht();Tw();Nh();_e();gn();Ps();Ai();rk=vt;iD=ok;sk=NZ;uD=ik;ak=DZ;hD=Qt((e)=>ck(e,hD)),Fg=Qt((e)=>ck(e,Fg,gD)),$Z=Qt((e)=>ck(e,Fg,gD,e.context?.constructorDefault))});function Mn(e,t,n){return{id:e,payloadSchema:t,revive:n}}function ge(e,t,n){return{id:e,payloadSchema:t,revive:n}}function Rd(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,LZ),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=(o)=>Rd(o,t),r.makeEffect=Rg(r),r.make=tD(r),r.makeOption=Pg(r),r}var Ng="~effect/Schema/Schema",LZ;var yD=w(()=>{Qe();Ps();Mg();LZ={[Ng]:Ng,pipe(){return le(this,arguments)},annotate(e){return this.rebuild(Ur(this.ast,e))},annotateKey(e){return this.rebuild(Sd(this.ast,e))},check(...e){return this.rebuild(Fo(this.ast,e))}}});var Gme,SD;var ED=w(()=>{Gme=globalThis.Boolean,SD=Ir((e,t)=>e||t,!1)});function fk(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,i]=o;U(n,s,i)}}return n}function kD(e,t){let n=t?.omitKeyWhen??(()=>!1);return Hp((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);if(n(c))continue;U(i,a,c)}return i})}var bD,wD,vD,lk,En=(e)=>e;var Dg=w(()=>{X();bD=p(2,(e,t)=>fk(e,(n,r)=>t.includes(n)?[n,r]:void 0)),wD=p(2,(e,t)=>fk(e,(n,r)=>!t.includes(n)?[n,r]:void 0)),vD=p(2,(e,t)=>({...e,...t})),lk=p(2,(e,t)=>fk(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]))});function Pd(e){return Ir((t,n)=>{if(t===void 0)return n;if(n===void 0)return t;return e.combine(t,n)},void 0)}var ID=()=>{};function Do(e,t){if(t.length>0)e+=`
35
+ at ${Dp(t)}`;return Error(e)}var pk=w(()=>{kn()});function Ms(e){return Error(`Unable to derive an arbitrary for ${e}`)}function qZ(e,t,n){return t.reduce((r,o)=>r.filter((s)=>o.run(s,e,ja)===void 0),n)}function LD(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw Ms(`${t} constraints`)}function jD(e){return e===void 0||e.minLength===void 0&&e.maxLength===void 0?void 0:{...e.minLength!==void 0?{minLength:e.minLength}:{},...e.maxLength!==void 0?{maxLength:e.maxLength}:{}}}function mk(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function _D(e,t,n,r=!1){let o=t.constraint,s=jD(o);return LD(s,"array"),mk(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?Y:void 0)}function $g(e,t,n,r){return t.chain((o)=>o.length<n?e.constant(o):r.map((s)=>[...o,...s]))}function RD(e,t){return e.chain((n)=>t.map((r)=>({...Object.fromEntries(r),...n})))}function PD(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function GZ(e,t){if(e===void 0)return t;if(e.order!==t.order)throw Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=PD(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=PD(e.order,e.maximum,e.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1);return{order:e.order,...n!==void 0?{minimum:n}:{},...r!==void 0?{exclusiveMinimum:r}:{},...o!==void 0?{maximum:o}:{},...s!==void 0?{exclusiveMaximum:s}:{}}}function JZ(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,i=o===void 0?n:GZ(n,o);return{...VZ.combine(r,s),...i===void 0?{}:{ordered:i}}}function FD(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary)n.push(o.annotations.arbitrary);if(o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function ZZ(e){let t=e.map(({constraint:n})=>n).filter(Le);return(n)=>{let r=t.reduce((o,s)=>JZ(o,s),n.constraint);return{...n,constraint:r}}}function Fd(e){return{...e,constraint:void 0}}function MD(e,t,n){if(t===void 0||t.minLength===void 0&&t.maxLength===void 0)return;if(t.minLength!==void 0&&e.indexSignatures.length===0&&t.minLength>e.propertySignatures.length)throw Ms("object property constraints");let r={};if(t.minLength!==void 0)r.minLength=Math.max(0,t.minLength-n);if(t.maxLength!==void 0){if(r.maxLength=t.maxLength-n,r.maxLength<0)throw Ms("object property constraints")}return LD(r,"object property"),r}function YZ(e,t,n,r,o,s){let i=r.length;if(s.maxLength!==void 0&&s.maxLength<i)throw Ms("object property constraints");let a=s.minLength===void 0?0:Math.max(0,s.minLength-i),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-i);if(a>c)throw Ms("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),l=e.shuffledSubarray([...o],{minLength:a,maxLength:c});return e.tuple(u,l).map(([f,d])=>{let m=new Set([...r,...d]),g={};for(let b of n)if(m.has(b))U(g,b,f[b]);return g})}function BD(e,t,n,r){let o={};if(e?.minimum!==void 0)o.min=t(e.minimum,e.exclusiveMinimum===!0);if(e?.maximum!==void 0)o.max=n(e.maximum,e.exclusiveMaximum===!0);if(o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw Ms(r);return o}function QZ(e){return BD(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function XZ(e,t){let n={...e?.noInfinity?{noDefaultInfinity:!0}:{},...e?.noNaN?{noNaN:!0}:{},...t?.minimum!==void 0?{min:t.minimum}:{},...t?.exclusiveMinimum!==void 0?{minExcluded:t.exclusiveMinimum}:{},...t?.maximum!==void 0?{max:t.maximum}:{},...t?.exclusiveMaximum!==void 0?{maxExcluded:t.exclusiveMaximum}:{}};if(n.min!==void 0&&n.max!==void 0&&(n.min>n.max||n.min===n.max&&(n.minExcluded||n.maxExcluded)))throw Ms("number constraints");return n}function eY(e){return BD(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function zu(e,t){let n=(r,o,s=OD)=>e(r,o,s);return n.terminal=(r,o,s=OD)=>t(r,o,s),n}function Lr(e){return zu(e,e)}function ND(e,t){let n=TD.get(t)??e.createDepthIdentifier();return TD.set(t,n),{maxDepth:2,depthIdentifier:n}}function DD(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}function nY(e){return{...e,constraint:tY}}function rY(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let i=s.make(e,t);if(i===void 0)continue;let a=s.weight??1;if(!globalThis.Number.isInteger(a)||a<=0)throw Ms("a candidate with an invalid weight");o.push({arbitrary:i,weight:a})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function $D(e,t,n,r,o){let s=rY(n,r,t.arbitraries,o);return s===void 0?void 0:qZ(e,t.filters,s)}function oY(e,t){if(!(typeof e==="object"&&e!==null&&("arbitrary"in e)))return{arbitrary:e,terminal:t?void 0:e};let n="terminal"in e?e.terminal:t?void 0:e.arbitrary;return{arbitrary:e.arbitrary,terminal:n}}function sY(e,t,n,r,o){return e.map((s)=>({arbitrary:o?t.constant(null).chain(()=>s(t,n,r)):s(t,n,r),terminal:s.terminal(t,n,r)}))}function UD(e,t,n,r){let o=ZZ(t.arbitraries);return zu((s,i,a)=>{let c=o(i);return $D(e,t,s,c,n(s,i,c,a))},(s,i,a)=>{let c=o(i);return $D(e,t,s,c,r(s,i,c,a))})}function jr(e,t){let n=_o(e)?.toArbitrary;if(n){let r=Mi(e)?e.typeParameters.map((i)=>jr(i,t)):[],o=FD(e.checks),s=(i)=>(a,c,u,l)=>oY(n(sY(r,a,Fd(c),l,i))(a,u),r.length>0)[i?"terminal":"arbitrary"];return UD(e,o,s(!1),s(!0))}if(e.checks){let r=FD(e.checks),o=jr(lg(e,void 0),t);return UD(e,r,(s,i,a,c)=>o(s,a,c),(s,i,a,c)=>o.terminal(s,a,c))}return iY(e,t)}function iY(e,t){switch(e._tag){case"Never":case"Declaration":throw Do(`Unsupported AST ${e._tag}`,t);case"Null":return Lr((n)=>n.constant(null));case"Void":case"Undefined":return Lr((n)=>n.constant(void 0));case"Unknown":case"Any":return Lr((n)=>n.anything());case"String":return Lr((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map((i)=>n.stringMatching(new RegExp(i)))):n.string(jD(o))});case"Number":return Lr((n,r)=>{let o=r.constraint,s=o?.ordered?.order===rr?o.ordered:void 0;return o?.integer?n.integer(QZ(s)):n.float(XZ(o,s))});case"Boolean":return Lr((n)=>n.boolean());case"BigInt":return Lr((n,r)=>{let o=r.constraint?.ordered?.order===Cr?r.constraint.ordered:void 0;return n.bigInt(eY(o))});case"Symbol":return Lr((n)=>n.string().map(Symbol.for));case"Literal":return Lr((n)=>n.constant(e.literal));case"UniqueSymbol":return Lr((n)=>n.constant(e.symbol));case"ObjectKeyword":return Lr((n)=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return jr(I1(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>jr(Jn(r),[...t,o]));return Lr((r,o,s)=>r.tuple(...n.map((i)=>i(r,nY(o),s))).map((i)=>i.map((a)=>globalThis.String(a)).join("")))}case"Arrays":{let n=e.elements.map((i,a)=>({ast:i,arbitrary:jr(i,[...t,a])})),r=e.elements.length,o=e.rest.map((i,a)=>({ast:i,arbitrary:jr(i,[...t,r+a])})),s=(i,a,c)=>{let u=Fd(a),l=[],f=[],d=0;for(let C of n){let S=C.arbitrary.terminal(i,u,c);if(bt(C.ast)){f.push(S);continue}if(S===void 0)return;d++,l.push(S.map(_))}let m=a.constraint?.minLength??0,b=Hn(o)&&m>d+f.length?f.length:Math.max(0,m-d),x=0;for(let C of f){if(x>=b||C===void 0){l.push(i.constant(O()));continue}x++,d++,l.push(C.map(_))}if(x<b)return;let I=i.tuple(...l).map(mS);if(Hn(o)){let[C,...S]=o,y=e.elements.length===0?a:u,h=Math.max(0,m-d-S.length),E=h===0?void 0:C.arbitrary.terminal(i,u,c);if(h>0&&E===void 0)return;let k=h===0?i.constant([]):_D(i,{...y,constraint:{...y.constraint,minLength:h}},E,!0);if(I=$g(i,I,r,k),S.length>0){let T=[];for(let N of S){let R=N.arbitrary.terminal(i,u,c);if(R===void 0)return;T.push(R)}let F=i.tuple(...T);I=$g(i,I,r,F)}}return I};return zu((i,a,c)=>{let u=Fd(a),l=n.map(({ast:d,arbitrary:m})=>{let g=m(i,u,c);return bt(d)?g.chain((b)=>i.boolean().map((x)=>x?_(b):O())):g.map(_)}),f=i.tuple(...l).map((d)=>mS(UC(d,Ee)));if(Hn(o)){let[d,...m]=o.map(({arbitrary:b})=>b(i,u,c)),g=_D(i,e.elements.length===0?a:u,d);if(f=$g(i,f,r,g),m.length>0){let b=i.tuple(...m);f=$g(i,f,r,b)}}if(a.recursion){let d=s(i,a,c);if(d!==void 0)return i.oneof(a.recursion,d,f)}return f},s)}case"Objects":{let n=e.propertySignatures.map((s)=>({ps:s,arbitrary:jr(s.type,[...t,s.name])})),r=e.indexSignatures.map((s)=>({is:s,parameter:jr(s.parameter,t),type:jr(s.type,t)}));return zu((s,i,a)=>{let c=Fd(i),u={},l=[],f=[],d=[];for(let{ps:x,arbitrary:I}of n){let C=x.name;if(l.push(C),bt(x.type))d.push(C);else f.push(C);U(u,C,I(s,c,a))}let m=i.constraint;if(d.length>0&&r.length===0&&m!==void 0&&(m.minLength!==void 0||m.maxLength!==void 0))return YZ(s,u,l,f,d,m);let g=s.record(u,{requiredKeys:f}),b=MD(e,i.constraint,f.length);for(let{parameter:x,type:I}of r){let C=s.tuple(x(s,c,a),I(s,c,a)),S=mk(s,C,b,AD);g=RD(g,S)}return g},(s,i,a)=>{let c=Fd(i),u={},l=[],f=[];for(let{ps:x,arbitrary:I}of n){let C=x.name,S=I.terminal(s,c,a);if(bt(x.type)){if(S!==void 0)f.push([C,S]);continue}if(S===void 0)return;l.push(C),U(u,C,S)}let d=Math.max(0,(i.constraint?.minLength??0)-l.length);for(let[x,I]of f){if(d===0)break;d--,l.push(x),U(u,x,I)}if(d>0&&e.indexSignatures.length===0)return;let m=s.record(u,{requiredKeys:l}),g=MD(e,i.constraint,l.length),b=g?.minLength??0;for(let{parameter:x,type:I}of r){let C;if(b===0)C=s.constant([]);else{let S=x.terminal(s,c,a),y=I.terminal(s,c,a);if(S===void 0||y===void 0)return;C=mk(s,s.tuple(S,y),{...g,maxLength:b},AD)}m=RD(m,C)}return m})}case"Union":{let n=e.types.map((o)=>jr(o,t)),r=(o,s,i)=>DD(o,n.map((a)=>a.terminal(o,s,i)).filter(Le));return zu((o,s,i)=>{let a=n.map((u)=>u(o,s,i));if(s.recursion){let u=r(o,s,i);if(u!==void 0)return o.oneof(s.recursion,u,...a)}let c=DD(o,a);if(c===void 0)throw Ms("a union with no members");return c},r)}case"Suspend":{let n=CD.get(e);if(n)return n;let r=Ha(()=>jr(e.thunk(),t)),o=zu((s,i,a)=>{let c=ND(s,e),u={...i,recursion:c},l=a.includes(e)?a:[...a,e],f=r().terminal(s,u,l);if(f===void 0)throw Do("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,f,s.constant(null).chain(()=>r()(s,u,l)))},(s,i,a)=>{if(a.includes(e))return;let c=ND(s,e);return r().terminal(s,{...i,recursion:c},[...a,e])});return CD.set(e,o),o}}}var CD,TD,OD,AD=([e],[t])=>Y(e,t),zZ,WZ,Ug,KZ,VZ,tY,HD;var qD=w(()=>{An();ED();yt();X();Xm();_e();ia();he();Ps();Dg();ID();pk();Ti();CD=new WeakMap,TD=new WeakMap,OD=[];zZ=Pd(oR),WZ=Pd(sR),Ug=Pd(SD),KZ=Pd(LC()),VZ=kD({integer:Ug,maxLength:WZ,minLength:zZ,noInfinity:Ug,noNaN:Ug,patterns:KZ,unique:Ug},{omitKeyWhen:Gs});tY={noInfinity:!0,noNaN:!0};HD=Qt((e)=>jr(e,[]))});function $i(e,t){let n=_o(e)?.toEquivalence;if(n)return n(Mi(e)?e.typeParameters.map((r)=>$i(r,t)):[]);switch(e._tag){case"Never":return oC();case"Declaration":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 Y;case"Arrays":{let r=e.elements.map((i,a)=>$i(i,[...t,a])),o=e.elements.length,s=e.rest.map((i,a)=>$i(i,[...t,o+a]));return Kt((i,a)=>{if(!Array.isArray(i)||!Array.isArray(a))return!1;let c=i.length;if(c!==a.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](i[u],a[u]))return!1;if(s.length>0){let[l,...f]=s;for(;u<c-f.length;u++)if(!l(i[u],a[u]))return!1;for(let d=0;d<f.length;d++)if(!f[d](i[u+d],a[u+d]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Y;let r=e.propertySignatures.map((s)=>$i(s.type,[...t,s.name])),o=e.indexSignatures.map((s)=>$i(s.type,t));return Kt((s,i)=>{if(!fn(s)||!fn(i))return!1;for(let a=0;a<r.length;a++){let c=e.propertySignatures[a],u=c.name,l=Object.hasOwn(s,u),f=Object.hasOwn(i,u);if(bt(c.type)){if(l!==f)return!1}if(l&&f&&!r[a](s[u],i[u]))return!1}for(let a=0;a<o.length;a++){let c=e.indexSignatures[a],u=La(s,c.parameter),l=La(i,c.parameter);if(u.length!==l.length)return!1;for(let f=0;f<u.length;f++){let d=u[f];if(!Object.hasOwn(i,d)||!o[a](s[d],i[d]))return!1}}return!0})}case"Union":{let r=sn(e).types,o=new Map(r.map((s,i)=>[s,[Ad(s),$i(e.types[i],t)]]));return Kt((s,i)=>{let a=md(s,r);for(let c=0;c<a.length;c++){let[u,l]=o.get(a[c]);if(u(s)&&u(i))return l(s,i)}return!1})}case"Suspend":{let r=Ha(()=>$i(e.thunk(),t));return Kt((o,s)=>r()(o,s))}}}var zD;var WD=w(()=>{yt();Xo();X();he();Ps();Mg();Ti();zD=Qt((e)=>$i(e,[]))});function Ka(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Wu(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function VD(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function ZD(e){return{dialect:"draft-07",...gY(e,CY)}}function lY(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!fn(r))return r;let i=o||!s&&XD(r.$id),a={};for(let c of Object.keys(r)){let u=r[c],l=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":l=gk(u,(f)=>n(f,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":l=Array.isArray(u)?u.map((f)=>n(f,i)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":l=n(u,i)}U(a,c,l)}return t(a,i),a}}function YD(e,t){return lY(e,(n)=>{fY(n,t)})}function fY(e,t){if(typeof e.$ref==="string")U(e,"$ref",t(e.$ref,"$ref"));if(typeof e.$dynamicRef==="string")U(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function gk(e,t){if(!fn(e))return;let n={};for(let r of Object.keys(e))U(n,r,t(e[r],r));return n}function dY(e,t,n){let r=new Map,o=[],s=hk;function i(d,m=[],g=[]){if(m.length===0&&t?.trackIds){let b=fn(d)?l(d):void 0;s=GD(b,hk)??hk}return u(d,m,g,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[d,m,g]of o){let b=m,x=QD(m,g);if(x!==void 0){let I=pY(x.hash);if(x.hash="",I!==void 0){let C=r.get(JD(x.href,I));if(C!==void 0)b=mY(m,C)}}U(d,"$ref",b)}}let c=n(i);return a(),c;function u(d,m,g,b){if(typeof d==="boolean")return f(m,g,b),t?.booleanAdapter?.(d)??d;if(!fn(d))return d;let x=b,I=l(d);if(m.length>0&&t?.trackIds&&XD(I)){let y=GD(I,b.uri);if(y!==void 0)x={parent:b,sourceRoot:m,targetRoot:g,uri:y}}f(m,g,x);let C=x.uri,S={isDocumentRoot:m.length===0,schema(y,h,E=h){return u(y,[...m,h],[...g,E],x)},schemaAt(y,h,E){return u(y,[...m,...h],[...g,...E],x)},schemaArray(y,h,E=h){return Array.isArray(y)?y.map((k,T)=>u(k,[...m,h,String(T)],[...g,E,String(T)],x)):y},schemaMap(y,h,E=h){if(!fn(y))return y;return gk(y,(k,T)=>u(k,[...m,h,T],[...g,E,T],x))},reference(y,h){if(typeof h==="string")o.push([y,h,C]);else U(y,"$ref",h)}};return e(d,S)}function l(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref==="string"?void 0:d.$id}function f(d,m,g){if(g.parent!==void 0)f(d,m,g.parent);r.set(JD(g.uri,d.slice(g.sourceRoot.length)),m.slice(g.targetRoot.length))}}function QD(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function GD(e,t){if(typeof e!=="string")return;let n=QD(e,t);if(n===void 0)return;return n.hash="",n.href}function pY(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(!t.startsWith("/"))return;return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(Wu)}function mY(e,t){let n=e.indexOf("#");if(n===-1&&t.length===0)return e;return`${n===-1?e:e.slice(0,n)}${hY(t)}`}function hY(e){return e.length===0?"#":`#/${e.map((t)=>encodeURI(Ka(t)).replace(/#/g,"%23")).join("/")}`}function JD(e,t){return`${e}\x00${JSON.stringify(t)}`}function XD(e){return typeof e==="string"&&e.length>0&&e[0]!=="#"}function gY(e,t,n){return dY(t,{...n,trackIds:!0},(r)=>({schema:r(e.schema),definitions:gk(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}function EY(e,t,n,r,o,s=xY){let i;if(s.has(t))i=r.schemaMap(n,t);else if(yY.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return U(e,t,i),!0}function Va(e,t,n){throw Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function vY(e,t,n,r){for(let o of t)if(Object.hasOwn(e,o))Va(o,n,`it is not active in ${r} but would become active in the target`)}function IY(e,t,n,r,o){if(n.isDocumentRoot)U(e,"$schema",VD(t,KD)?r:t);else if(!VD(t,KD))Va("$schema",o,"an embedded resource cannot declare a different dialect")}function CY(e,t){vY(e,kY,"Draft-07","Draft 2020-12");let n={},r=void 0,o=void 0,s=void 0;for(let i of Object.keys(e)){let a=e[i];if(EY(n,i,a,t,SY))continue;switch(i){case"$ref":r=a;break;case"$schema":IY(n,a,t,uY,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":U(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":Va(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;U(n,i,a);break;default:U(n,i,a)}}if(TY(n,o,s,t),Object.hasOwn(e,"contains")){let{minContains:i,maxContains:a}=e;if(i!==void 0&&i!==1||a!==void 0)Va("minContains/maxContains","Draft-07","contains cardinality cannot be represented");if(Object.hasOwn(e,"minContains"))U(n,"minContains",i)}else{if(Object.hasOwn(e,"minContains"))U(n,"minContains",e.minContains);if(Object.hasOwn(e,"maxContains"))U(n,"maxContains",e.maxContains)}return AY(e,n,t,"draft-07"),RY(e,n,"$id","Draft-07"),OY(n,r,t),n}function TY(e,t,n,r){if(t===void 0){if(n!==void 0)U(e,"items",r.schema(n,"items"));return}if(U(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0)U(e,"additionalItems",r.schema(n,"items","additionalItems"))}function OY(e,t,n){if(t===void 0)return;if(typeof t==="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),_Y(e,r)}else n.reference(e,t)}function AY(e,t,n,r){let o=fn(e.dependentRequired)?e.dependentRequired:void 0,s=fn(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let i={},a=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of a){let u=o?.[c],l=s?.[c],f=r==="draft-04"&&Array.isArray(u)&&u.length===0;if(l===void 0){if(!f)U(i,c,u)}else if(u===void 0||f)U(i,c,n.schemaAt(l,["dependentSchemas",c],["dependencies",c]));else U(i,c,{allOf:[n.schemaAt(l,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}if(Object.keys(i).length>0)U(t,"dependencies",i)}function _Y(e,t){if(Array.isArray(e.allOf))e.allOf.push(t);else U(e,"allOf",[t])}function RY(e,t,n,r){let{$id:o,$anchor:s}=e;if(s===void 0){if(o!==void 0)U(t,n,o);return}if(typeof s!=="string"||!bY.test(s))Va("$anchor",r,"the anchor is not valid");if(!wY.test(s))Va("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier");if(o===void 0)U(t,n,`#${s}`);else Va("$anchor",r,"it cannot be combined with the schema $id")}var uY="http://json-schema.org/draft-07/schema#",KD="https://json-schema.org/draft/2020-12/schema",hk="https://effect.invalid/.json-schema/",xY,yY,SY,e$,rhe,ohe,bY,wY,kY;var xk=w(()=>{he();xY=new Set(["properties","patternProperties"]),yY=new Set(["allOf","anyOf","oneOf"]),SY=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);e$=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],rhe=[...e$,"deprecated"],ohe=[...e$,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],bY=/^[A-Za-z_][-A-Za-z0-9._]*$/,wY=/^[A-Za-z][-A-Za-z0-9._:]*$/;kY=["additionalItems","definitions","dependencies"]});var she,Ku=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var yk=w(()=>{she=globalThis.RegExp});function Md(e,t){if(e===void 0)return;let n={},r=e.title;if(typeof r==="string")n.title=r;let{description:o,expected:s}=e;if(typeof o==="string")n.description=o;else if(t?.generateDescriptions===!0&&typeof s==="string")n.description=s;let i=e.default;if($u(i))n.default=i;let a=e.examples;if(Array.isArray(a)&&$u(a))n.examples=a;let c=e.readOnly;if(typeof c==="boolean")n.readOnly=c;let u=e.writeOnly;if(typeof u==="boolean")n.writeOnly=u;let l=e.format;if(typeof l==="string")n.format=l;let f=e.contentEncoding;if(typeof f==="string")n.contentEncoding=f;let d=e.contentMediaType;if(typeof d==="string")n.contentMediaType=d;let m=e.contentSchema;if($u(m))n.contentSchema=m;if(t?.includeAnnotationKey!==void 0)for(let[g,b]of Object.entries(e)){if(FY.has(g)||!t.includeAnnotationKey(g))continue;if($u(b))U(n,g,b)}return Object.keys(n).length===0?void 0:n}function r$(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0)n={...e},delete n.type;if(Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let i=r$(s);if(i.type!==void 0){if(o=!0,t===void 0||i.type==="integer")t=i.type}if(Object.keys(i.schema).length>0)r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function MY(e){return Array.isArray(e.anyOf)&&e.anyOf.length===4&&e.anyOf[0]?.type==="number"&&e.anyOf.slice(1).every((t)=>t.type==="string")}function Sk(e,t){return Object.keys(e).every((n)=>t.includes(`|${n}|`))}function n$(e,t){return typeof e.$ref!=="string"&&t.every((n)=>!Object.hasOwn(e,n))}function Nd(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=MY(e);if(o!==void 0||s){let a=r$(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};if(s)delete u.anyOf;let l=Object.keys(a.schema);if(l.length===0)return u;return Sk(a.schema,Ek)&&n$(u,l)?{...u,...a.schema}:Nd(u,a.schema,n)}}if(n&&n$(e,r))return{...e,...t};let i=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];if(Array.isArray(e.allOf))return{...e,allOf:[...e.allOf,...i]};if(typeof e.$ref==="string")return{allOf:[e,...i]};return{...e,allOf:i}}function DY(e,t,n,r){let o=new Map,s=new WeakMap,i=new Map,a=!1,c=Object.keys(n);for(let S of c)f(S,["references",S]);let u=jt(e,(S,y)=>d(x(S,t[y]))),l={};for(let S of c){let y=o.get(S);if(typeof y!=="string")U(l,S,d(y))}return{dialect:"draft-2020-12",schemas:u,definitions:l};function f(S,y){let h=o.get(S);if(h!==void 0)return typeof h==="string"?h:S;if(!Object.hasOwn(n,S))throw Do(`Invalid reference ${S}`,[...y,"$ref"]);o.set(S,null);let E=n[S],k=x(E,["references",S]),T=m(E);if(T!==void 0){let F=i.get(T),N=F?.find((R)=>Y(o.get(R),k));if(N===void 0)if(F===void 0)i.set(T,[S]);else F.push(S);else return a=!0,o.set(S,N),N}return o.set(S,k),S}function d(S){if(!a)return S;return YD(S,(y)=>y.replace(/^#\/\$defs\/([^/]*)/,(h,E)=>{let k=o.get(Wu(E));return typeof k==="string"?`#/$defs/${Ka(k)}`:h}))}function m(S){if(S._tag==="Reference")return;let y=S.checks.length===0?S.annotations:S.checks[S.checks.length-1].annotations;return typeof y?.identifier!=="string"&&typeof y?.[Ma]==="string"?y[Ma]:void 0}function g(S,y){return S?.schemas?.map((h,E)=>x(h,[...y,"schemas",E]))??[]}function b(S,y,h){let E=S.annotations,k=E?.toJsonSchema;if(k!==void 0){let R=g(S.representation,[...h,"representation"]),z=k({type:y,schemas:R}),q=Md(E,r),ue=q===void 0?z:{...z,...q},ut=q===void 0?o$:NY;return S._tag==="Filter"&&Sk(ue,ut)&&(q===void 0||Sk(q,Ek))?[ue,!0]:[ue]}if(S._tag==="Filter")return;let T=S.checks.map((R,z)=>b(R,y,[...h,"checks",z])).filter((R)=>R!==void 0);if(T.length===0)return;let F=Md(E,r),N=T.map(([R])=>R);return[F===void 0?{allOf:N}:{allOf:N,...F}]}function x(S,y){if(S._tag==="Reference"){let T=f(S.$ref,y);return{$ref:`#/$defs/${Ka(T)}`}}let h=s.get(S);if(h!==void 0)return h;let E=I(S,y),k=Md(S.annotations,r);if(k!==void 0)E={...E,...k};for(let T=0;T<S.checks.length;T++){let F=typeof E.type==="string"&&$Y(E.type)?E.type:void 0,N=b(S.checks[T],F,[...y,"checks",T]);if(N!==void 0)E=Nd(E,...N)}return s.set(S,E),E}function I(S,y){switch(S._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":case"UniqueSymbol":return{type:"string",allOf:[{pattern:"^Symbol\\((.*)\\)$"}]};case"Declaration":return{};case"Suspend":return x(S.thunk,[...y,"thunk"]);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN"]},{type:"string",enum:["Infinity"]},{type:"string",enum:["-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let h=S.literal;return typeof h==="bigint"?{type:"string",enum:[globalThis.String(h)]}:{type:typeof h,enum:[h]}}case"Enum":{let h=S.enums.map(([E,k])=>typeof k==="number"&&!globalThis.Number.isFinite(k)?{type:"string",enum:[globalThis.String(k)],title:E}:{type:typeof k,enum:[k],title:E});return h.length===0?{not:{}}:{anyOf:h}}case"TemplateLiteral":return{type:"string",pattern:`^${S.parts.map(Lg).join("")}$`};case"Arrays":{if(S.rest.length>1)throw Do("Invalid schema representation document",[...y,"rest"]);let h={type:"array"},E=S.elements.length,k=S.elements.map((T,F)=>{if(T.isOptional)E--;let N=x(T.type,[...y,"elements",F,"type"]),R=Md(T.annotations,r);return R===void 0?N:Nd(N,R)});if(k.length>0){if(h.prefixItems=k,h.maxItems=S.elements.length,E>0)h.minItems=E}else h.items=!1;if(S.rest.length===1){delete h.maxItems;let T=x(S.rest[0],[...y,"rest",0]);if(Object.keys(T).length>0)h.items=T;else delete h.items}return h}case"Objects":{if(S.propertySignatures.length===0&&S.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let h={type:"object"},E={},k=[];for(let R=0;R<S.propertySignatures.length;R++){let z=S.propertySignatures[R];if(typeof z.name!=="string")throw Do("Invalid schema representation document",[...y,"propertySignatures",R,"name"]);let q=z.name,ue=x(z.type,[...y,"propertySignatures",R,"type"]),ut=Md(z.annotations,r);if(U(E,q,ut===void 0?ue:Nd(ue,ut)),!z.isOptional)k.push(q)}if(S.propertySignatures.length>0)h.properties=E;if(k.length>0)h.required=k;let T={},F=[];for(let R=0;R<S.indexSignatures.length;R++){let z=S.indexSignatures[R],q=x(z.type,[...y,"indexSignatures",R,"type"]);if(Object.keys(q).length===1&&"not"in q)q=!1;let ue=C(z.parameter,[...y,"indexSignatures",R,"parameter"],new Set);if(ue.length===0)F.push(q);else for(let ut of ue){let Ks=T[ut];U(T,ut,Ks===void 0?q:Ks===!1||q===!1?!1:Nd(Ks,q))}}let N=Object.keys(T).length>0;if(N)h.patternProperties=T;if(S.indexSignatures.length===0)h.additionalProperties=r?.additionalProperties??!1;else if(F.length===1&&S.propertySignatures.length===0&&!N)h.additionalProperties=F[0];else if(F.length>0)h.allOf=F.map((R)=>({type:"object",additionalProperties:R}));if(typeof h.additionalProperties==="object"&&h.additionalProperties!==null&&Object.keys(h.additionalProperties).length===0)delete h.additionalProperties;return h}case"Union":{let h=S.types.map((E,k)=>x(E,[...y,"types",k]));if(h.length===0)return{not:{}};if(S.mode==="anyOf"&&h.length>1){let E=UY(h);if(E!==void 0)return E}return S.mode==="anyOf"?{anyOf:h}:{oneOf:h}}}}function C(S,y,h){switch(S._tag){case"Reference":{if(!Object.hasOwn(n,S.$ref))throw Do(`Invalid reference ${S.$ref}`,[...y,"$ref"]);if(f(S.$ref,y),h.has(S.$ref))return[];let E=new Set(h).add(S.$ref);return C(n[S.$ref],["references",S.$ref],E)}case"String":return s$(x(S,y));case"TemplateLiteral":return[`^${S.parts.map(Lg).join("")}$`];case"Union":return S.types.flatMap((E,k)=>C(E,[...y,"types",k],h));default:throw Do("Invalid schema representation document",y)}}}function $Y(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function UY(e){let t=void 0,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;n.push(...r.enum)}return{type:t,enum:n}}function s$(e){let t=[];if(typeof e.pattern==="string")t.push(e.pattern);for(let n of["allOf","anyOf","oneOf"]){let r=e[n];if(Array.isArray(r)){for(let o of r)if(typeof o==="object"&&o!==null&&!Array.isArray(o))t.push(...s$(o))}}return t}function Lg(e){switch(e._tag){case"Literal":return Ku(globalThis.String(e.literal));case"String":return T1;case"Number":return tg;case"TemplateLiteral":return e.parts.map(Lg).join("");case"Union":return e.types.map(Lg).join("|");default:throw Do("Invalid schema representation document",[])}}function i$(e,t){let n=DY([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var FY,o$="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|",Ek="|title|description|default|examples|readOnly|writeOnly|",NY;var a$=w(()=>{An();yt();xk();yk();Ps();pk();Ti();FY=new Set([...gF,Ma,...mF]);NY=o$+Ek});function lo(e){return e===void 0?void 0:{annotations:e}}function bk(e,t){let{references:n,representations:r}=BY([e],t);return{representation:r[0],references:n}}function BY(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let h of e)m(h);let a=t?.referencePolicy??jY;for(let h of s.values())for(let E of h.values()){let k=a({ast:E.ast,occurrences:E.occurrences,identifier:E.identifier});if(k!==void 0){let T=k===E.identifier||!k.endsWith("_")?"_":"";E.reference=u(k,E,T)}else if(E.isRecursive)E.reference=u(`${E.ast._tag}_`,E,"")}return{representations:jt(e,(h)=>b(h)),references:n};function u(h,E,k="_"){let T=h,F=0;while(r.has(T)){if(r.get(T)===E)return T;T=`${h}${k}${++F}`}return r.set(T,E),T}function l(h,E,k){let T=E.fallback;if(T!==void 0)return gw(h)===T?h:Ur(h,{[Ma]:T});return k===E.identifier?h:Ur(h,{identifier:k})}function f(h,E){if(!Object.hasOwn(n,h)&&!o.has(h)){o.add(h);let k=x(E);o.delete(h),U(n,h,k)}return{_tag:"Reference",$ref:h}}function d(h){let E=yd(h),k=bv(E),T=ku(E),F=T===void 0?(E!==h?ku(h):void 0)??gw(E):void 0;if(F!==void 0)T=`${F}Encoded`;let N=s.get(k);if(N===void 0)N=new Map,s.set(k,N);let R=N.get(T);if(R===void 0)R={ast:k,identifier:T,fallback:F,occurrences:0,isRecursive:!1,reference:void 0},N.set(T,R);return R}function m(h){let E=d(h),k=E.ast;if(E.occurrences++,i.has(E)){E.isRecursive=!0;return}if(E.occurrences>1)return;switch(i.add(E),g(k.checks),k._tag){case"Declaration":case"Arrays":case"Objects":case"Union":k.recur((T)=>(m(T),T));break;case"TemplateLiteral":k.parts.forEach(m);break;case"Suspend":m(k.thunk());break}i.delete(E)}function g(h){h?.forEach((E)=>{if(E.annotations?.representation?.schemas?.forEach((k)=>m(sn(k))),E._tag==="FilterGroup")g(E.checks)})}function b(h){let E=d(h),k=E.ast,T=E.reference;if(T!==void 0){let F=E.identifier===void 0?k:l(k,E,T);return f(T,F)}return x(k)}function x(h){let E=I(h.checks);switch(h._tag){case"Declaration":return{_tag:"Declaration",typeParameters:h.typeParameters.map((k)=>b(k)),checks:E,...S(h.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:h._tag,checks:E,...lo(h.annotations)};case"Literal":return{_tag:"Literal",literal:h.literal,checks:E,...lo(h.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:h.symbol,checks:E,...lo(h.annotations)};case"Enum":return{_tag:"Enum",enums:h.enums,checks:E,...lo(h.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:h.parts.map((k)=>b(k)),checks:E,...lo(h.annotations)};case"Arrays":return{_tag:"Arrays",elements:h.elements.map((k)=>{let T=yd(k),F=T.context?.annotations;return{isOptional:bt(T),type:b(k),...lo(F)}}),rest:h.rest.map((k)=>b(k)),checks:E,...lo(h.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:h.propertySignatures.map((k)=>{let T=yd(k.type),F=T.context?.annotations;return{name:k.name,type:b(k.type),isOptional:bt(T),isMutable:w1(T),...lo(F)}}),indexSignatures:h.indexSignatures.map((k)=>({parameter:b(k.parameter),type:b(k.type)})),checks:E,...lo(h.annotations)};case"Union":return{_tag:"Union",types:h.types.map((k)=>b(k)),mode:h.mode,checks:E,...lo(h.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:b(h.thunk()),...lo(h.annotations)}}}function I(h){return h?.map(C)??[]}function C(h){switch(h._tag){case"Filter":return{_tag:"Filter",aborted:h.aborted,...y(h.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:jt(h.checks,C),...y(h.annotations)}}}function S(h){if(h===void 0)return;let{representation:E,...k}=h;return{...E===void 0?void 0:{representation:E},...Object.keys(k).length===0?void 0:{annotations:k}}}function y(h){if(h===void 0)return;let{representation:E,...k}=h,T=E===void 0?void 0:E.schemas===void 0?E:{...E,schemas:E.schemas.map((F)=>b(sn(F)))};return{...T===void 0?void 0:{representation:T},...Object.keys(k).length===0?void 0:{annotations:k}}}}var jY=({identifier:e})=>e;var c$=w(()=>{An();Ps();Ti()});function l$(e,t){let n=[];return wk(e,t,"",n),n}function wk(e,t,n,r){if(Object.is(e,t))return;if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,i=Math.min(o,s);for(let a=0;a<i;a++)wk(e[a],t[a],`${n}/${a}`,r);for(let a=o-1;a>=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;a<s;a++)r.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(jg(e)&&jg(t)){let o=Object.keys(e),s=Object.keys(t),i=Array.from(new Set([...o,...s])).sort();for(let a of i){let c=`${n}/${Ka(a)}`,u=Object.hasOwn(e,a),l=Object.hasOwn(t,a);if(u&&l)wk(e[a],t[a],c,r);else if(!u&&l)r.push({op:"add",path:c,value:t[a]});else r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}function f$(e,t){let n=t;for(let r of e)n=zY(n,r);return n}function jg(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qY(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Wu)}function d$(e){if(!/^(0|[1-9]\d*)$/.test(e))throw Error(`Invalid array index: "${e}"`);return Number(e)}function zY(e,t){if(t.path===""){if(t.op==="remove")throw Error("Unsupported operation at the root");return t.value}let n=WY(e,t.path);if(n===null)throw Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:r,parent:o,stack:s}=n;if(Array.isArray(o)){if(r==="-"&&t.op!=="add")throw Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=r==="-"?o.length:d$(r),a=t.op==="add"?o.length:o.length-1;if(i>a)throw Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();if(t.op==="add")c.splice(i,0,t.value);else if(t.op==="remove")c.splice(i,1);else c[i]=t.value;return u$(s,c)}if(jg(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};if(t.op==="remove")delete i[r];else U(i,r,t.value);return u$(s,i)}throw Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function WY(e,t){let n=qY(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i<n.length-1;i++){let a=n[i];if(Array.isArray(s)){let c=d$(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(jg(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function u$(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let i=o.slice();i[s]=n,n=i}else{let i={...o};U(i,s,n),n=i}}return n}var p$=()=>{};function g$(e,t){return fo(Vu("Iso",e,t))}function m$(e,t){return fo(Vu("Lens",e,t))}function Vu(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}class kk{_tag="PathNode";kind="Lens";path;get;set;constructor(e){this.path=e,this.get=(t)=>{let n=t;for(let r=0;r<e.length;r++)n=n[e[r]];return n},this.set=(t,n)=>{let r=Hg(n),o=r,s=0;for(;s<e.length-1;s++){let i=e[s];U(o,i,Hg(o[i])),o=o[i]}return U(o,e[s],t),r}}}class Bg{_tag="CheckNode";kind="Prism";checks;get;set=D;constructor(e){this.checks=e,this.get=(t)=>_1(e,t)}}function Ga(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;r<t.length;r++){let o=t[r],s=n[n.length-1];if(s._tag==="PathNode"&&o._tag==="PathNode")n[n.length-1]=new kk([...s.path,...o.path]);else if(s._tag==="CheckNode"&&o._tag==="CheckNode")n[n.length-1]=new Bg([...s.checks,...o.checks]);else n.push(o)}return n}function GY(e,t){return fo(Vu("Optional",e,t))}class Dd{node;getResult;replaceResult;constructor(e,t,n){this.node=e,this.getResult=t,this.replaceResult=n}replace(e,t){return oi(this.replaceResult(e,t),()=>t)}modify(e){return(t)=>oi(si(this.getResult(t),(n)=>this.replaceResult(e(n),t)),()=>t)}compose(e){return fo(Ga(this.node,e.node))}key(e){return fo(Ga(this.node,[new kk([e])]))}optionalKey(e){return fo(Ga(this.node,Vu("Lens",(t)=>t[e],(t,n)=>{let r=Hg(n);if(t===void 0)if(Array.isArray(r)&&typeof e==="number")r.splice(e,1);else delete r[e];else U(r,e,t);return r})))}check(...e){return fo(Ga(this.node,[new Bg(e)]))}refine(e,t){return fo(Ga(this.node,[new Bg([ug(e,t)])]))}tag(e){let t=te(new we({expected:`${JSON.stringify(e)} tag`}));return fo(Ga(this.node,Vu("Prism",(n)=>n._tag===e?G(n):t,D)))}at(e,...t){let n=te(new Ft([e],new Da(void 0)));return fo(Ga(this.node,Vu("Optional",(r)=>Object.hasOwn(r,e)?G(r[e]):n,(r,o)=>{if(Object.hasOwn(o,e)){let s=Hg(o);return U(s,e,r),G(s)}else return n})))}pick(e){return this.compose(m$(bD(e),(t,n)=>({...n,...t})))}omit(e){return this.compose(m$(wD(e),(t,n)=>({...n,...t})))}notUndefined(){return this.refine(Le,{expected:"a value other than `undefined`"})}forEach(e){let t=e(qg());return GY((n)=>or(this.getResult(n),(r)=>{let o=[];for(let s=0;s<r.length;s++){let i=t.getResult(r[s]);if(Ut(i))o.push(i.success)}return o}),(n,r)=>si(this.getResult(r),(o)=>{let s=[];for(let a=0;a<o.length;a++)if(Ut(t.getResult(o[a])))s.push(a);if(n.length!==s.length)return te(new we({message:`each: replacement length mismatch: ${n.length} !== ${s.length}`}));let i=o.slice();for(let a=0;a<s.length;a++){let c=s[a],u=t.replaceResult(n[a],o[c]);if(xe(u))return te(new Ft([c],u.failure));i[c]=u.success}return this.replaceResult(i,r)}))}modifyAll(e){return(t)=>oi(si(this.getResult(t),(n)=>this.replaceResult(n.map(e),t)),()=>t)}}function fo(e){let t=e[0]??VY;if(e.length>1){let n=e.reduce((r,o)=>YY(r,o.kind),"Iso");t={kind:n,get:JY(e,n),set:ZY(e,n)}}switch(t.kind){case"Iso":return new x$(e,t.get,t.set);case"Lens":return new y$(e,t.get,t.set);case"Prism":return new S$(e,t.get,t.set);case"Optional":return new Dd(e,t.get,t.set)}}function Hg(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 Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function JY(e,t){return(n)=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if(vk(o.kind)){if(xe(s))return s;n=s.success}else n=s}return vk(t)?G(n):n}}function ZY(e,t){if(h$(t))return(n)=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n};return(n,r)=>{let o=e.length,s=Array(o);for(let i=0;i<o;i++){s[i]=r;let a=e[i];if(vk(a.kind)){let c=a.get(r);if(xe(c))return c;r=c.success}else r=a.get(r)}for(let i=o-1;i>=0;i--){let a=e[i];if(h$(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(xe(c))return c;n=c.success}}return t==="Optional"?G(n):n}}function vk(e){return e==="Prism"||e==="Optional"}function h$(e){return e==="Iso"||e==="Prism"}function YY(e,t){if(e==="Iso")return t;if(t==="Iso"||e===t)return e;return"Optional"}function qg(){return QY}var VY,x$,y$,S$,QY;var E$=w(()=>{X();he();gn();Ps();Ai();Dg();VY={kind:"Iso",get:D,set:D};x$=class x$ extends Dd{get;set;constructor(e,t,n){super(e,(r)=>G(t(r)),(r)=>G(n(r)));this.get=t,this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>this.set(e(this.get(t)))}};y$=class y$ extends Dd{get;constructor(e,t,n){super(e,(r)=>G(t(r)),(r,o)=>G(n(r,o)));this.get=t,this.replace=n}modify(e){return(t)=>this.replace(e(this.get(t)),t)}};S$=class S$ extends Dd{set;constructor(e,t,n){super(e,t,(r,o)=>G(n(r)));this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>oi(or(this.getResult(t),(n)=>this.set(e(n))),()=>t)}};QY=fo([])});var Ja,b$=(e)=>{if(Ja.has(e))return Ja.get(e);else throw Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var w$=w(()=>{Ja=new WeakMap});var v$="~effect/data/Redacted",Ik=(e)=>M(e,v$),Ns=(e,t)=>{let n=Object.create(tQ);if(t?.label)n.label=t.label;return Ja.set(n,e),n},tQ,Ui,k$=(e)=>Kt((t,n)=>e(Ui(t),Ui(n)));var $d=w(()=>{yt();Xo();Xt();rt();w$();he();tQ={[v$]:{_A:(e)=>e},label:void 0,...Cn,toJSON(){return this.toString()},toString(){return`<redacted${Wr(this.label)?":"+this.label:""}>`},[Ie](){return re(Ja.get(this))},[Ce](e){return Ik(e)&&Y(Ja.get(this),Ja.get(e))}},Ui=b$});var P={};Un(P,{Any:()=>PQ,Array:()=>$e,ArrayEnsure:()=>qQ,BigDecimal:()=>Wk,BigDecimalFromString:()=>L9,BigDecimalReviver:()=>U9,BigInt:()=>$o,BigIntFromString:()=>J9,Boolean:()=>Zg,BooleanFromBit:()=>n7,Cause:()=>Kg,CauseReason:()=>Wg,CauseReasonReviver:()=>u9,CauseReviver:()=>l9,Char:()=>Z8,Chunk:()=>y2,ChunkReviver:()=>v9,Class:()=>M2,Date:()=>Yn,DateFromMillis:()=>A9,DateFromString:()=>O9,DateReviver:()=>T9,DateTimeUtc:()=>Qd,DateTimeUtcFromDate:()=>c7,DateTimeUtcFromMillis:()=>l7,DateTimeUtcFromString:()=>u7,DateTimeUtcReviver:()=>a7,DateTimeZoned:()=>Yk,DateTimeZonedFromString:()=>x7,DateTimeZonedReviver:()=>g7,Defect:()=>qk,Duration:()=>Zd,DurationFromMillis:()=>F9,DurationFromNanos:()=>P9,DurationFromString:()=>w2,DurationReviver:()=>_9,Enum:()=>_Q,Error:()=>rx,ErrorInstance:()=>u2,ErrorInstanceReviver:()=>p9,Exit:()=>l2,ExitReviver:()=>m9,File:()=>Kk,FileReviver:()=>H9,Finite:()=>Zn,FiniteFromString:()=>G9,FormData:()=>Vk,FormDataReviver:()=>q9,Graph:()=>m2,GraphReviver:()=>S9,HashMap:()=>h2,HashMapReviver:()=>E9,HashSet:()=>x2,HashSetReviver:()=>w9,Int:()=>Uo,Json:()=>tp,JsonObject:()=>tX,JsonReviver:()=>nX,Literal:()=>Ke,Literals:()=>Ls,MutableJson:()=>W2,MutableJsonReviver:()=>oX,Natural:()=>an,Never:()=>RQ,NonEmptyArray:()=>HQ,NonEmptyString:()=>XU,Null:()=>Fe,NullOr:()=>Mk,NullishOr:()=>rU,Number:()=>Hd,NumberFromString:()=>V9,ObjectKeyword:()=>MQ,Opaque:()=>r8,Option:()=>ji,OptionFromNullOr:()=>Q8,OptionFromNullishOr:()=>e9,OptionFromOptional:()=>n9,OptionFromOptionalKey:()=>t9,OptionFromOptionalNullOr:()=>r9,OptionFromUndefinedOr:()=>X8,OptionReviver:()=>Y8,PropertyKey:()=>Ok,ReadonlyMap:()=>p2,ReadonlyMapReviver:()=>h9,ReadonlySet:()=>g2,ReadonlySetReviver:()=>b9,Record:()=>Yg,Redacted:()=>ex,RedactedFromValue:()=>c9,RedactedReviver:()=>a9,RegExp:()=>S2,RegExpReviver:()=>k9,Result:()=>e2,ResultReviver:()=>o9,SchemaError:()=>Za,StandardSchemaV1FailureResult:()=>t7,String:()=>J,StringFromBase64:()=>Y9,StringFromBase64Url:()=>Q9,StringFromHex:()=>X9,StringFromUriComponent:()=>e7,Struct:()=>Q,StructWithRest:()=>jQ,Symbol:()=>eU,TaggedClass:()=>b7,TaggedError:()=>po,TaggedStruct:()=>Xg,TaggedUnion:()=>n8,TemplateLiteral:()=>OQ,TemplateLiteralParser:()=>AQ,TimeZone:()=>Zk,TimeZoneFromString:()=>h7,TimeZoneNamed:()=>Jk,TimeZoneNamedFromString:()=>p7,TimeZoneNamedReviver:()=>d7,TimeZoneOffset:()=>A2,TimeZoneOffsetReviver:()=>f7,TimeZoneReviver:()=>m7,Tree:()=>eX,Trim:()=>Z9,Trimmed:()=>T2,Tuple:()=>Ju,TupleWithRest:()=>BQ,URL:()=>nx,URLFromString:()=>C9,URLReviver:()=>I9,URLSearchParams:()=>Gk,URLSearchParamsReviver:()=>W9,Uint8Array:()=>Yd,Uint8ArrayFromBase64:()=>o7,Uint8ArrayFromBase64Url:()=>s7,Uint8ArrayFromHex:()=>i7,Uint8ArrayReviver:()=>r7,Undefined:()=>Pk,UndefinedOr:()=>Qg,Union:()=>pt,UniqueArray:()=>zQ,UniqueSymbol:()=>NQ,Unknown:()=>Rk,UnknownFromJsonString:()=>B9,Void:()=>FQ,annotate:()=>rQ,annotateEncoded:()=>oQ,annotateKey:()=>sQ,asserts:()=>uQ,brand:()=>sU,catchDecoding:()=>JQ,catchDecodingWithContext:()=>cU,catchEncoding:()=>ZQ,catchEncodingWithContext:()=>uU,check:()=>KQ,declare:()=>Br,declareConstructor:()=>Qn,decode:()=>YQ,decodeEffect:()=>lQ,decodeExit:()=>fQ,decodeOption:()=>pQ,decodePromise:()=>hQ,decodeResult:()=>mQ,decodeSync:()=>gQ,decodeTo:()=>de,decodeUnknownEffect:()=>Us,decodeUnknownExit:()=>z$,decodeUnknownOption:()=>dQ,decodeUnknownPromise:()=>K$,decodeUnknownResult:()=>W$,decodeUnknownSync:()=>V$,encode:()=>QQ,encodeEffect:()=>G$,encodeExit:()=>xQ,encodeKeys:()=>UQ,encodeOption:()=>SQ,encodePromise:()=>bQ,encodeResult:()=>EQ,encodeSync:()=>wQ,encodeTo:()=>Nk,encodeUnknownEffect:()=>Gg,encodeUnknownExit:()=>J$,encodeUnknownOption:()=>yQ,encodeUnknownPromise:()=>Y$,encodeUnknownResult:()=>Z$,encodeUnknownSync:()=>Q$,extendTo:()=>LQ,fieldsAssign:()=>DQ,flip:()=>Ck,fromBrand:()=>GQ,fromFormData:()=>z9,fromJsonString:()=>C2,fromURLSearchParams:()=>K9,instanceOf:()=>Li,is:()=>Bd,isBase64:()=>Uk,isBase64Reviver:()=>h8,isBase64Url:()=>EU,isBase64UrlReviver:()=>g8,isBetween:()=>Gd,isBetweenBigDecimal:()=>U8,isBetweenBigInt:()=>qU,isBetweenBigIntReviver:()=>G7,isBetweenDate:()=>UU,isBetweenDateReviver:()=>q7,isBetweenReviver:()=>A8,isCapitalized:()=>CU,isCapitalizedReviver:()=>w8,isEndsWith:()=>wU,isEndsWithReviver:()=>y8,isFinite:()=>OU,isFiniteReviver:()=>k8,isGUID:()=>yU,isGUIDReviver:()=>p8,isGreaterThan:()=>_U,isGreaterThanBigDecimal:()=>M8,isGreaterThanBigInt:()=>LU,isGreaterThanBigIntReviver:()=>z7,isGreaterThanDate:()=>MU,isGreaterThanDateReviver:()=>L7,isGreaterThanOrEqualTo:()=>Lk,isGreaterThanOrEqualToBigDecimal:()=>N8,isGreaterThanOrEqualToBigInt:()=>jU,isGreaterThanOrEqualToBigIntReviver:()=>W7,isGreaterThanOrEqualToDate:()=>NU,isGreaterThanOrEqualToDateReviver:()=>j7,isGreaterThanOrEqualToReviver:()=>C8,isGreaterThanReviver:()=>I8,isIncludes:()=>vU,isIncludesReviver:()=>S8,isInt:()=>Jd,isInt32:()=>P8,isIntReviver:()=>R8,isLengthBetween:()=>Bk,isLengthBetweenReviver:()=>B8,isLessThan:()=>RU,isLessThanBigDecimal:()=>D8,isLessThanBigInt:()=>BU,isLessThanBigIntReviver:()=>K7,isLessThanDate:()=>DU,isLessThanDateReviver:()=>B7,isLessThanOrEqualTo:()=>PU,isLessThanOrEqualToBigDecimal:()=>$8,isLessThanOrEqualToBigInt:()=>HU,isLessThanOrEqualToBigIntReviver:()=>V7,isLessThanOrEqualToDate:()=>$U,isLessThanOrEqualToDateReviver:()=>H7,isLessThanOrEqualToReviver:()=>O8,isLessThanReviver:()=>T8,isLowercased:()=>IU,isLowercasedReviver:()=>b8,isMaxLength:()=>WU,isMaxLengthReviver:()=>j8,isMaxProperties:()=>ZU,isMaxPropertiesReviver:()=>K8,isMaxSize:()=>VU,isMaxSizeReviver:()=>q8,isMinLength:()=>jk,isMinLengthReviver:()=>L8,isMinProperties:()=>JU,isMinPropertiesReviver:()=>W8,isMinSize:()=>KU,isMinSizeReviver:()=>H8,isMultipleOf:()=>FU,isMultipleOfReviver:()=>_8,isNonEmpty:()=>zU,isPattern:()=>Ya,isPatternReviver:()=>a8,isPropertiesLengthBetween:()=>YU,isPropertiesLengthBetweenReviver:()=>V8,isPropertyNames:()=>QU,isPropertyNamesReviver:()=>G8,isSchema:()=>Jg,isSchemaError:()=>L$,isSizeBetween:()=>GU,isSizeBetweenReviver:()=>z8,isStartsWith:()=>bU,isStartsWithReviver:()=>x8,isStringBigInt:()=>hU,isStringBigIntReviver:()=>u8,isStringFinite:()=>mU,isStringFiniteReviver:()=>c8,isStringSymbol:()=>gU,isStringSymbolReviver:()=>l8,isTrimmed:()=>$k,isTrimmedReviver:()=>s8,isULID:()=>SU,isULIDReviver:()=>m8,isUUID:()=>xU,isUUIDReviver:()=>d8,isUint32:()=>F8,isUncapitalized:()=>TU,isUncapitalizedReviver:()=>v8,isUnique:()=>Hk,isUniqueReviver:()=>J8,isUppercased:()=>kU,isUppercasedReviver:()=>E8,link:()=>Je,make:()=>V,makeFilter:()=>Ze,makeFilterGroup:()=>o8,makeIsBetween:()=>Vd,makeIsGreaterThan:()=>qd,makeIsGreaterThanOrEqualTo:()=>zd,makeIsLessThan:()=>Wd,makeIsLessThanOrEqualTo:()=>Kd,makeIsMultipleOf:()=>AU,middlewareDecoding:()=>iU,middlewareEncoding:()=>aU,mutable:()=>WQ,mutableKey:()=>IQ,optional:()=>Nn,optionalKey:()=>Ds,overrideToCodecIso:()=>Q7,overrideToEquivalence:()=>I7,overrideToFormatter:()=>v7,readonlyKey:()=>CQ,refine:()=>VQ,required:()=>kQ,requiredKey:()=>vQ,resolveAnnotations:()=>sX,resolveAnnotationsKey:()=>iX,revealBottom:()=>nQ,revealCodec:()=>iQ,suspend:()=>oU,tag:()=>$s,tagDefaultOmit:()=>t8,toArbitrary:()=>w7,toCodecArrayFromSingle:()=>R7,toCodecIso:()=>L2,toCodecJson:()=>D2,toCodecJsonAST:()=>ox,toCodecStringTree:()=>ep,toDifferJsonPatch:()=>X7,toEncoded:()=>Xu,toEncoderXml:()=>P7,toEquivalence:()=>C7,toFormatter:()=>k7,toIso:()=>J7,toIsoFocus:()=>Y7,toIsoSource:()=>Z7,toJsonSchemaDocument:()=>N2,toRepresentation:()=>T7,toStandardJSONSchemaV1:()=>cQ,toStandardSchemaV1:()=>aQ,toTaggedUnion:()=>pU,toType:()=>Dn,withConstructorDefault:()=>lU,withDecodingDefault:()=>dU,withDecodingDefaultKey:()=>Dk,withDecodingDefaultType:()=>e8,withDecodingDefaultTypeKey:()=>XQ});function Qn(){return(e,t,n)=>V(new Ba(e.map(pd),(r)=>t(r.map((o)=>V(o))),n))}function Br(e,t){return Qn()([],()=>(n,r,o)=>e(n)?v(n):A(new ft(r,n,o)),t)}function nQ(e){return e}function rQ(e){return(t)=>t.annotate(e)}function oQ(e){return(t)=>Ck(Ck(t).annotate(e))}function sQ(e){return(t)=>t.rebuild(Sd(t.ast,e))}function iQ(e){return e}function L$(e){return M(e,Ld)&&e[Ld]===Ld}function I$(e){return Rt(e)?e.value:{issues:[{message:JE(e.cause)}]}}function aQ(e,t){let n=vt(e),r={errors:"all",...t?.parseOptions},o=bF(t),s=(i)=>{let a=new zc("sync"),c=To(wi(n(i,r),{onFailure:o,onSuccess:(l)=>({value:l})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();if(u)return I$(u);return new Promise((l)=>{c.addObserver((f)=>{l(I$(f))})})};if("~standard"in e){let i=e;if("validate"in i["~standard"])return i;return Object.assign(i["~standard"],{validate:s}),i}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function C$(e,t){let n=N2(e);if(t==="draft-2020-12"){let r=n.schema;if(Object.keys(n.definitions).length>0)r.$defs=n.definitions;return r}else if(t==="draft-07"){let r=ZD(n),o=r.schema;if(Object.keys(r.definitions).length>0)o.definitions=r.definitions;return o}throw new globalThis.Error(`Unsupported target: ${t}`)}function cQ(e){let t={input(n){return C$(e,n.target)},output(n){return C$(Dn(e),n.target)}};if("~standard"in e){let n=e;if("jsonSchema"in n["~standard"])return n;return Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function Us(e,t){let n=vt(e,t);return(r,o)=>j$(n(r,o))}function j$(e){if(We(e))return _k(e);return xr(e,(t)=>Ei(()=>ms(t,(n)=>new Za(n))))}function B$(e,t){let n;for(let r of e.reasons){if(!ff(r)||!L$(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function H$(e){return ph(e).then((t)=>{if(Rt(t))return t.value;throw B$(t.cause,"Promise adapter can only reject schema errors")})}function q$(e){let t=ki(e);if(Rt(t))return t.value;throw B$(t.cause,"Sync adapter can only throw schema errors")}function z$(e,t){let n=sD(e,t);return(r,o)=>_k(n(r,o))}function _k(e){return Rt(e)?e:lr(ms(e.cause,(t)=>new Za(t)))}function W$(e,t){let n=aD(e,t);return(r,o)=>Bc(n(r,o),(s)=>new Za(s))}function K$(e,t){let n=Us(e,t);return(r,o)=>H$(n(r,o))}function V$(e,t){let n=Us(e,t);return(r,o)=>q$(n(r,o))}function Gg(e,t){let n=qu(e,t);return(r,o)=>j$(n(r,o))}function J$(e,t){let n=cD(e,t);return(r,o)=>_k(n(r,o))}function Z$(e,t){let n=lD(e,t);return(r,o)=>Bc(n(r,o),(s)=>new Za(s))}function Y$(e,t){let n=Gg(e,t);return(r,o)=>H$(n(r,o))}function Q$(e,t){let n=Gg(e,t);return(r,o)=>q$(n(r,o))}function Jg(e){return M(e,Ud)&&e[Ud]===Ud}function TQ(e){return M(e,jd)&&e[jd]===jd}function Ck(e){if(TQ(e))return e.schema.rebuild(oo(e.ast));return V(oo(e.ast),{[jd]:jd,schema:e})}function Ke(e){let t=V(new Er(e),{literal:e,transform(n){return t.pipe(de(Ke(n),{decode:ve(()=>n),encode:ve(()=>e)}))}});return t}function X$(e){return new pv(e.map((t)=>Jg(t)?t.ast:new Er(t)))}function OQ(e){return V(X$(e),{parts:e})}function AQ(e){return V(X$(e).asTemplateLiteralParser(),{parts:e})}function _Q(e){return V(new dv(Object.keys(e).filter((t)=>typeof e[e[t]]!=="number").map((t)=>[t,e[t]])),{enums:e})}function NQ(e){return V(new mv(e))}function Fk(e,t){return V(e,{fields:t,mapFields(n,r){let o=n(this.fields);return Fk(og(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Q(e){return Fk(og(e,void 0),e)}function DQ(e){return En((t)=>t.mapFields(vD(e)))}function UQ(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=Xu(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,l=$Q(u);if(s.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${Go(u)}`);if(s.add(l),U(n,u,a),c)r[i]=u,o[u]=i}return Q(n).pipe(de(t,st({decode:lk(o),encode:lk(r)})))}}function LQ(e,t){return(n)=>{let r=MC(n.fields,Dn),o=Q({...r,...e});return n.pipe(de(o,st({decode:(s)=>{let i={...s};for(let a in e){let c=t[a],u=c(s);if(Ee(u))U(i,a,u.value)}return i},encode:(s)=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function Yg(e,t){return V(b1(e.ast,t.ast),{key:e,value:t})}function jQ(e,t){return V(l1(e.ast,t.map(pd)),{schema:e,records:t})}function tU(e,t){return V(e,{elements:t,mapElements(n,r){let o=n(this.elements);return tU(yv(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ju(e){return tU(yv(e),e)}function BQ(e,t){return V(f1(e.ast,t.map(pd)),{schema:e,rest:t})}function qQ(e){return pt([e,$e(e)]).pipe(de($e(Dn(e)),st({decode:DC,encode:(t)=>t.length===1?t[0]:t})))}function zQ(e){return $e(e).check(Hk())}function nU(e,t){return V(e,{members:t,mapMembers(n,r){let o=n(this.members);return nU(sg(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function pt(e,t){return nU(sg(e,t?.mode??"anyOf",void 0),e)}function Ls(e){let t=e.map(Ke);return V(sg(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return pt(n(this.members))},pick(n){return Ls(n)},transform(n){return pt(t.map((r,o)=>r.transform(n[o])))}})}function oU(e){return V(new ag(()=>e().ast))}function KQ(...e){return(t)=>t.check(...e)}function VQ(e,t){return(n)=>V(Fo(n.ast,[ug(e,t)]),{schema:n})}function sU(e){return(t)=>V(y1(t.ast,e),{schema:t,identifier:e})}function GQ(e,t){return(n)=>(t.checks?n.check(...t.checks):n).pipe(sU(e))}function iU(e){return(t)=>V(g1(t.ast,new ld(e,D)),{schema:t})}function aU(e){return(t)=>V(x1(t.ast,new ld(D,e)),{schema:t})}function JQ(e){return cU(e)}function cU(e){return(t)=>iU(Bf(e))(t)}function ZQ(e){return uU(e)}function uU(e){return(t)=>aU(Bf(e))(t)}function de(e,t){return(n)=>V(dg(n.ast,e.ast,t?Zh(t):Ou()),{from:n,to:e})}function YQ(e){return(t)=>de(Dn(t),e)(t)}function Nk(e,t){return(n)=>t?de(n,t)(e):de(n)(e)}function QQ(e){return(t)=>de(t,e)(Xu(t))}function lU(e){return(t)=>V(E1(t.ast,e),{schema:t})}function fU(e){return xr(e,(t)=>Ei(()=>ms(t,(n)=>n.issue)))}function Dk(e,t){let n=t?.encodingStrategy==="omit"?Nw():ro();return(r)=>Ds(Xu(r)).pipe(de(r,{decode:cd(fU(e)),encode:n}))}function XQ(e,t){return(n)=>Dn(n).pipe(Dk(e,t),Nk(Ds(n)))}function dU(e,t){let n=t?.encodingStrategy==="omit"?Nw():ro();return(r)=>Nn(Xu(r)).pipe(de(r,{decode:cd(fU(e)),encode:n}))}function e8(e,t){return(n)=>Dn(n).pipe(dU(e,t),Nk(Nn(n)))}function $s(e){return Ke(e).pipe(lU(v(e)))}function t8(e){return $s(e).pipe(Dk(v(e),{encodingStrategy:"omit"}))}function Xg(e,t){return Q({_tag:$s(e),...t})}function pU(e){return(t)=>{let n={},r=[],o=new Set,s={},i=(l)=>(f)=>l.includes(f[e]);return a(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(l){let f=l.ast;if(HM(f)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(Jg))return l.members.forEach(a);let d=Ru(f);if(d.length>0){let m=d.find((g)=>g.key===e)?.literal;if(Ap(m)){let g=typeof m==="number"?globalThis.String(m):m;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(g),r.push(m),U(n,m,l),U(s,m,Bd(Dn(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(b){let x=b[e];return(Object.hasOwn(g,x)?g[x]:void 0)(b)}}let l=arguments[0],f=arguments[1],d=l[e];return(Object.hasOwn(f,d)?f[d]:void 0)(l)}function u(){if(arguments.length===2){let b=arguments[0],x=arguments[1];return function(I){let C=I[e];return(Object.hasOwn(b,C)?b[C]??x:x)(I)}}let l=arguments[0],f=arguments[1],d=arguments[2],m=l[e];return(Object.hasOwn(f,m)?f[m]??d:d)(l)}}}function n8(e){let t={},n=[];for(let c of Object.keys(e)){let u=Xg(c,e[c]);U(t,c,u),n.push(u)}let r=pt(n),{guards:o,isAnyOf:s,match:i,matchOrElse:a}=pU("_tag")(r);return V(r.ast,{cases:t,isAnyOf:s,guards:o,match:i,matchOrElse:a})}function r8(){return(e)=>e}function Li(e,t){return Br((n)=>n instanceof e,t)}function Je(){return(e,t)=>new dt(e.ast,Zh(t))}function o8(e,t=void 0){return new Pi(e,t)}function bn(e,t){return Mn(e,Fe,({annotations:n})=>n===void 0?t:t.annotate(n))}function $k(e){let t=new globalThis.RegExp(T$);return Ze((n)=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[T$]}},...e})}function Ya(e,t){let{source:n,flags:r}=e,o=r===""?`new RegExp(${B(n)})`:`new RegExp(${B(n)}, ${B(r)})`;return hd(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function mU(e){return Cv({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function hU(e){return Tv({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function gU(e){return Av({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}function xU(e,t){let n=f8(e);return Ya(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}function yU(e){return Ya(O$,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:O$.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function SU(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Ya(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function Uk(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Ya(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function EU(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Ya(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function bU(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${Ku(e)}`);return Ze((o)=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isStartsWith(${B(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function wU(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${Ku(e)}$`);return Ze((o)=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isEndsWith(${B(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function vU(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(Ku(e));return Ze((o)=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncludes",payload:{includes:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isIncludes(${B(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function kU(e){let t=new globalThis.RegExp(A$);return Ze((n)=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[A$]}},...e})}function IU(e){let t=new globalThis.RegExp(_$);return Ze((n)=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[_$]}},...e})}function CU(e){let t=new globalThis.RegExp(R$);return Ze((n)=>n.charAt(0).toUpperCase()===n.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[R$]}},...e})}function TU(e){let t=new globalThis.RegExp(P$);return Ze((n)=>n.charAt(0).toLowerCase()===n.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[P$]}},...e})}function qd(e){let t=ti(e.order),n=e.formatter??B;return(r,o)=>Ze((s)=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...o})}function zd(e){let t=Dl(e.order),n=e.formatter??B;return(r,o)=>Ze((s)=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function Wd(e){let t=Uc(e.order),n=e.formatter??B;return(r,o)=>Ze((s)=>t(s,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...o})}function Kd(e){let t=Nl(e.order),n=e.formatter??B;return(r,o)=>Ze((s)=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...o})}function Vd(e){let t=Dl(e.order),n=ti(e.order),r=Nl(e.order),o=Uc(e.order),s=e.formatter??B;return(i,a)=>{let c=i.exclusiveMinimum?n:t,u=i.exclusiveMaximum?o:r;return Ze((l)=>c(l,i.minimum)&&u(l,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(i),...a})}}function AU(e){return(t,n)=>{let r=e.formatter??B;return Ze((o)=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function Zu(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${B(e)}`);return e}function Jd(e){return Ze((t)=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}function P8(e){return new Pi([Jd(),Gd({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function F8(e){return new Pi([Jd(),Gd({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Yu(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${B(e)}`);return e.toISOString()}function Qu(e){return`new Date(${B(e.getTime())})`}function jk(e,t){return e=Math.max(0,Math.floor(e)),Ze((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==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e}},...t})}function zU(e){return jk(1,e)}function WU(e,t){return e=Math.max(0,Math.floor(e)),Ze((n)=>n.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:n})=>n==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Wn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function Bk(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Ze((r)=>r.length>=e&&r.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/isLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="array"?{allOf:[{minItems:e},{maxItems:t}]}:{allOf:[{minLength:e},{maxLength:t}]},toCode:()=>({runtime:`Schema.isLengthBetween(${e}, ${t})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function KU(e,t){return e=Math.max(0,Math.floor(e)),Ze((n)=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e}},...t})}function VU(e,t){return e=Math.max(0,Math.floor(e)),Ze((n)=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Wn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function GU(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Ze((r)=>r.size>=e&&r.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/isSizeBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${e}, ${t})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function JU(e,t){return e=Math.max(0,Math.floor(e)),Ze((n)=>Reflect.ownKeys(n).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:()=>({minProperties:e}),toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e}},...t})}function ZU(e,t){return e=Math.max(0,Math.floor(e)),Ze((n)=>Reflect.ownKeys(n).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Wn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function YU(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Ze((r)=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).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/isPropertiesLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({minProperties:e,maxProperties:t}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${e}, ${t})`}),[Wn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function QU(e,t){let n=Xu(e),r=rD(n.ast);return Ze((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let l=r(u,i);if(l!==void 0){if(c.push(new Ft([u],l)),i.errors==="first")break}}if(la(c))return new Et(s,c,o,i);return!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o})=>({propertyNames:o[0]}),toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Wn]:!0,...t})}function Hk(e){return Ze((t)=>tm(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitrary:{constraint:{unique:!0}},...e})}function ji(e){let t=Qn()([e],([n])=>(r,o,s)=>{if(jc(r)){if(me(r))return Aa;return Jt(vt(n)(r.value,s),{onSuccess:_,onFailure:(i)=>Kn(o,"value",i,r,s)})}return A(new ft(o,r,s))},{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>Je()(pt([Q({_tag:Ke("Some"),value:n}),Q({_tag:Ke("None")})]),st({decode:(r)=>r._tag==="None"?O():_(r.value),encode:(r)=>Ee(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(O()),i=r.oneof(s,n.arbitrary.map(_));return Qa(r,o,s,i)},toEquivalence:([n])=>Zy(n),toFormatter:([n])=>et({onNone:()=>"none()",onSome:(r)=>`some(${n(r)})`})});return V(t.ast,{value:e})}function Q8(e){return Mk(e).pipe(de(ji(Dn(e)),bM()))}function X8(e){return Qg(e).pipe(de(ji(Dn(e)),wM()))}function e9(e,t){return rU(e).pipe(de(ji(Dn(e)),vM(t)))}function t9(e){return Ds(e).pipe(de(ji(Dn(e)),kM()))}function n9(e){return Nn(e).pipe(de(ji(Dn(e)),IM()))}function r9(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return Nn(Mk(e)).pipe(de(ji(Dn(e)),Yh({decode:(o)=>o.pipe(ca(_p),_),encode:n==="omit"?aa:(o)=>_(mt(aa(o),()=>r))})))}function e2(e,t){let n=Qn()([e,t],([r,o])=>(s,i,a)=>{if(!Qp(s))return A(new ft(i,s,a));switch(s._tag){case"Success":return Jt(rk(r)(s.success,a),{onSuccess:G,onFailure:(c)=>Kn(i,"success",c,s,a)});case"Failure":return Jt(rk(o)(s.failure,a),{onSuccess:te,onFailure:(c)=>Kn(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>Je()(pt([Q({_tag:Ke("Success"),success:r}),Q({_tag:Ke("Failure"),failure:o})]),st({decode:(s)=>s._tag==="Success"?G(s.success):te(s.failure),encode:(s)=>Ut(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,i)=>{let a=f2(s,r.terminal?.map((u)=>G(u)),o.terminal?.map((u)=>te(u))),c=s.oneof(r.arbitrary.map((u)=>G(u)),o.arbitrary.map((u)=>te(u)));return Qa(s,i,a,c)},toEquivalence:([r,o])=>aS(r,o),toFormatter:([r,o])=>Bn({onSuccess:(s)=>`success(${r(s)})`,onFailure:(s)=>`failure(${o(s)})`})});return V(n.ast,{success:e,failure:t})}function ex(e,t){let n=typeof t?.label==="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?vt(Ke(n)):void 0,i=Qn()([e],([a])=>(c,u,l)=>{if(Ik(c)){let f=s!==void 0?Ra(s(c.label,l),(d)=>new Ft(["label"],d)):Te;return on(f,()=>Jt(vt(a)(Ui(c),l),{onSuccess:()=>c,onFailure:()=>new Et(u,[new Ft(["value"],new we(void 0,c,l))],c,l)}))}return A(new ft(u,c,l))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${B(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Je()(a,{decode:ve((c)=>Ns(c,{label:n})),encode:r?Fw((c)=>"Cannot serialize Redacted"+(Ee(c)&&typeof c.value.label==="string"?` with label: "${c.value.label}"`:"")):ve(Ui)}),toArbitrary:([a])=>()=>({arbitrary:a.arbitrary.map((c)=>Ns(c,{label:n})),terminal:a.terminal?.map((c)=>Ns(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([a])=>k$(a)});return V(i.ast,{value:e})}function c9(e,t){return de(ex(Dn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:ve((n)=>Ns(n,{label:t?.label})),encode:t?.disallowEncode?Fw((n)=>"Cannot encode Redacted"+(Ee(n)&&typeof n.value.label==="string"?` with label: "${n.value.label}"`:"")):ve(Ui)})(e)}function Wg(e,t){let n=Qn()([e,t],([r,o])=>(s,i,a)=>{if(!KE(s))return A(new ft(i,s,a));switch(s._tag){case"Fail":return Jt(vt(r)(s.error,a),{onSuccess:df,onFailure:(c)=>Kn(i,"error",c,s,a)});case"Die":return Jt(vt(o)(s.defect,a),{onSuccess:pf,onFailure:(c)=>Kn(i,"defect",c,s,a)});case"Interrupt":return v(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>Je()(pt([Q({_tag:Ke("Fail"),error:r}),Q({_tag:Ke("Die"),defect:o}),Q({_tag:Ke("Interrupt"),fiberId:Qg(Zn)})]),st({decode:(s)=>{switch(s._tag){case"Fail":return df(s.error);case"Die":return pf(s.defect);case"Interrupt":return mf(s.fiberId)}},encode:D})),toArbitrary:([r,o])=>t2(r,o),toEquivalence:([r,o])=>n2(r,o),toFormatter:([r,o])=>r2(r,o)});return V(n.ast,{error:e,defect:t})}function t2(e,t){return(n,r)=>{let o=n.constant(mf()),s=n.oneof(o,n.integer({min:1}).map(mf),e.arbitrary.map((i)=>df(i)),t.arbitrary.map((i)=>pf(i)));return Qa(n,r,o,s)}}function n2(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function r2(e,t){return(n)=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function Kg(e,t){let n=Qn()([e,t],([r,o])=>{let s=$e(Wg(r,o));return(i,a,c)=>{if(!WE(i))return A(new ft(a,i,c));return Jt(vt(s)(i.reasons,c),{onSuccess:wa,onFailure:(u)=>Kn(a,"failures",u,i,c)})}},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>Je()($e(Wg(r,o)),st({decode:wa,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>o2(r,o),toEquivalence:([r,o])=>s2(r,o),toFormatter:([r,o])=>i2(r,o)});return V(n.ast,{error:e,defect:t})}function o2(e,t){return(n,r)=>{let o=t2(e,t)(n,r),s=n.constant(VE),i=n.array(o.arbitrary).map(wa);return Qa(n,r,s,i)}}function s2(e,t){let n=sC(n2(e,t));return(r,o)=>n(r.reasons,o.reasons)}function i2(e,t){let n=r2(e,t);return(r)=>`Cause([${r.reasons.map(n).join(", ")}])`}function u2(e){let t=a2(e),n=F$[t];if(n!==void 0)return n;let r=c2(t),o=Li(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${B(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Je()(rX,SM(r)),toArbitrary:()=>(s)=>s.string().map((i)=>new globalThis.Error(i))});return F$[t]=o,o}function qk(e){let t=a2(e),n=M$[t];if(n!==void 0)return n;let r=tp.pipe(de(Rk,EM(c2(t))));return M$[t]=r,r}function l2(e,t,n){let r=Qn()([e,t,n],([o,s,i])=>{let a=Kg(s,i);return(c,u,l)=>{if(!YE(c))return A(new ft(u,c,l));switch(c._tag){case"Success":return Jt(vt(o)(c.value,l),{onSuccess:_r,onFailure:(f)=>Kn(u,"value",f,c,l)});case"Failure":return Jt(vt(a)(c.cause,l),{onSuccess:lr,onFailure:(f)=>Kn(u,"cause",f,c,l)})}}},{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,i])=>Je()(pt([Q({_tag:Ke("Success"),value:o}),Q({_tag:Ke("Failure"),cause:Kg(s,i)})]),st({decode:(a)=>a._tag==="Success"?_r(a.value):lr(a.cause),encode:(a)=>Rt(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}})),toArbitrary:([o,s,i])=>(a,c)=>{let u=o2(s,i)(a,c),l=f2(a,o.terminal?.map((d)=>_r(d)),u.terminal?.map((d)=>lr(d))),f=a.oneof(o.arbitrary.map((d)=>_r(d)),u.arbitrary.map((d)=>lr(d)));return Qa(a,c,l,f)},toEquivalence:([o,s,i])=>{let a=s2(s,i);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return a(c.cause,u.cause)}}},toFormatter:([o,s,i])=>{let a=i2(s,i);return(c)=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${a(c.cause)})`}}}});return V(r.ast,{value:e,error:t,defect:n})}function f2(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function Qa(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function N$(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function tx(e,t,n,r,o,s){let i=t.constraint,a=i===void 0||i.minLength===void 0&&i.maxLength===void 0?void 0:{...i.minLength!==void 0?{minLength:i.minLength}:{},...i.maxLength!==void 0?{maxLength:i.maxLength}:{}};if(a?.minLength!==void 0&&a.maxLength!==void 0&&a.minLength>a.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=a?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:N$(e,r,{...a,maxLength:c},s),l=Qa(e,t,u,N$(e,n,a,s));return{arbitrary:l.arbitrary.map(o),terminal:l.terminal?.map(o)}}function d2(e,t,n,r,o){return tx(e,t,e.tuple(n.arbitrary,r.arbitrary),n.terminal===void 0||r.terminal===void 0?void 0:e.tuple(n.terminal,r.terminal),o,([s],[i])=>Y(s,i))}function p2(e,t){let n=Qn()([e,t],([r,o])=>{let s=$e(Ju([r,o]));return(i,a,c)=>{if(i instanceof globalThis.Map)return Jt(vt(s)([...i],c),{onSuccess:(u)=>new globalThis.Map(u),onFailure:(u)=>Kn(a,"entries",u,i,c)});return A(new ft(a,i,c))}},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>Je()($e(Ju([r,o])),st({decode:(s)=>new globalThis.Map(s),encode:(s)=>[...s.entries()]})),toArbitrary:([r,o])=>(s,i)=>d2(s,i,r,o,(a)=>new globalThis.Map(a)),toEquivalence:([r,o])=>Fp(r,o),toFormatter:([r,o])=>(s)=>{let i=s.size;if(i===0)return"ReadonlyMap(0) {}";let a=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${i}) { ${a.join(", ")} }`}});return V(n.ast,{key:e,value:t})}function D$(e,t,n){return Q({type:Ke(e),nodes:$e(Q({index:an,data:t})),edges:$e(Q({index:an,source:an,target:an,data:n}))})}function $$(e,t){let n=-1,r=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=n)return A(new Ft(["nodes",o,"index"],new we({expected:"a strictly increasing node index"},s,t)));n=s,r.add(s)}n=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=n)return A(new Ft(["edges",o,"index"],new we({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return A(new Ft(["edges",o,"source"],new we({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return A(new Ft(["edges",o,"target"],new we({expected:"an encoded node index"},s.target,t)))}return v(wd(e))}function g9(e,t,n){if(!Gv(e)||e.mutable||e.type!==t)return A(new we({expected:`an immutable ${t} Graph`},e,n));return v(bd(e))}function x9(e,t){return(n,r)=>{let o=bd(n),s=bd(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i<o.nodes.length;i++)if(o.nodes[i].index!==s.nodes[i].index||!e(o.nodes[i].data,s.nodes[i].data))return!1;for(let i=0;i<o.edges.length;i++){let a=o.edges[i],c=s.edges[i],u=o.type==="directed"?a.source===c.source&&a.target===c.target:a.source===c.source&&a.target===c.target||a.source===c.target&&a.target===c.source;if(a.index!==c.index||!u||!t(a.data,c.data))return!1}return!0}}function y9(e,t,n){return(r,o)=>{let s=wd({type:e,nodes:[],edges:[]}),i=r.constant(s),a=r.array(t.arbitrary).chain((c)=>{let u=c.map((f,d)=>({index:d,data:f}));if(u.length===0)return i;let l=r.integer({min:0,max:u.length-1});return r.array(r.tuple(l,l,n.arbitrary)).map((f)=>wd({type:e,nodes:u,edges:f.map(([d,m,g],b)=>({index:b,source:d,target:m,data:g}))}))});return Qa(r,o,i,a)}}function m2(e,t,n){let r=Qn()([t,n],([o,s])=>{let i=D$(e,o,s);return(a,c,u)=>{if(!Gv(a)||a.mutable||a.type!==e)return A(new ft(c,a,u));return ne(vt(i)(bd(a),u),(l)=>$$(l,u))}},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${B(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${B(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Je()(D$(e,o,s),Sr({decode:$$,encode:(i,a)=>g9(i,e,a)})),toArbitrary:([o,s])=>y9(e,o,s),toEquivalence:([o,s])=>x9(o,s),toFormatter:()=>globalThis.String});return V(r.ast,{type:e,node:t,edge:n})}function h2(e,t){let n=Qn()([e,t],([r,o])=>{let s=$e(Ju([r,o]));return(i,a,c)=>{if(zN(i))return Jt(vt(s)(Og(i),c),{onSuccess:Tg,onFailure:(u)=>Kn(a,"entries",u,i,c)});return A(new ft(a,i,c))}},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>Je()($e(Ju([r,o])),st({decode:Tg,encode:Og})),toArbitrary:([r,o])=>(s,i)=>d2(s,i,r,o,Tg),toEquivalence:([r,o])=>Fp(r,o),toFormatter:([r,o])=>(s)=>{let i=WN(s);if(i===0)return"HashMap(0) {}";let a=Og(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${i}) { ${a.join(", ")} }`}});return V(n.ast,{key:e,value:t})}function g2(e){let t=Qn()([e],([n])=>{let r=$e(n);return(o,s,i)=>{if(o instanceof globalThis.Set)return Jt(vt(r)([...o],i),{onSuccess:(a)=>new globalThis.Set(a),onFailure:(a)=>Kn(s,"values",a,o,i)});return A(new ft(s,o,i))}},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>Je()($e(n),st({decode:(r)=>new globalThis.Set(r),encode:(r)=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>tx(r,o,n.arbitrary,n.terminal,(s)=>new globalThis.Set(s),Y),toEquivalence:([n])=>Mp(n),toFormatter:([n])=>(r)=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map((i)=>`${n(i)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return V(t.ast,{value:e})}function x2(e){let t=Qn()([e],([n])=>{let r=$e(n);return(o,s,i)=>{if(YN(o))return Jt(vt(r)(Lt(o),i),{onSuccess:_g,onFailure:(a)=>Kn(s,"values",a,o,i)});return A(new ft(s,o,i))}},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>Je()($e(n),st({decode:_g,encode:Lt})),toArbitrary:([n])=>(r,o)=>tx(r,o,n.arbitrary,n.terminal,_g,Y),toEquivalence:([n])=>Mp(n),toFormatter:([n])=>(r)=>{let o=QN(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return V(t.ast,{value:e})}function y2(e){let t=Qn()([e],([n])=>{let r=$e(n);return(o,s,i)=>{if(Eh(o))return Jt(vt(r)(Lt(o),i),{onSuccess:bh,onFailure:(a)=>Kn(s,"values",a,o,i)});return A(new ft(s,o,i))}},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>Je()($e(n),st({decode:bh,encode:Lt})),toArbitrary:([n])=>(r,o)=>tx(r,o,n.arbitrary,n.terminal,bh),toEquivalence:([n])=>Yb(n),toFormatter:([n])=>(r)=>{let o=aP(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return V(t.ast,{value:e})}function zk(e,t,n){let r={...t};if(e?.minimum!==void 0){let o=n===void 0?e.minimum:n(e.minimum),s=e.exclusiveMinimum?new globalThis.Date(o.getTime()+1):o;if(r.min===void 0||s.getTime()>r.min.getTime())r.min=s}if(e?.maximum!==void 0){let o=n===void 0?e.maximum:n(e.maximum),s=e.exclusiveMaximum?new globalThis.Date(o.getTime()-1):o;if(r.max===void 0||s.getTime()<r.max.getTime())r.max=s}return r}function Vg(e,t){return Ri(e,t).value}function M9(e,t,n){return n?Vg(Ww(e,t),t)+globalThis.BigInt(1):Vg(zw(e,t),t)}function N9(e,t,n){return n?Vg(zw(e,t),t)-globalThis.BigInt(1):Vg(Ww(e,t),t)}function D9(e){return Math.max(k2,e.minimum?.scale??0,e.maximum?.scale??0,e.exclusiveMinimum&&e.minimum!==void 0?e.minimum.scale+1:0,e.exclusiveMaximum&&e.maximum!==void 0?e.maximum.scale+1:0)}function Tk(e,t){let n={};if(e.minimum!==void 0)n.min=M9(e.minimum,t,e.exclusiveMinimum===!0);if(e.maximum!==void 0)n.max=N9(e.maximum,t,e.exclusiveMaximum===!0);if(n.min!==void 0&&n.max!==void 0&&n.min>n.max)return;return n}function $9(e){let t=D9(e);if(Tk(e,t)===void 0)throw new globalThis.Error(I2);let n=0,r=t;while(n<r){let o=n+Math.floor((r-n)/2);if(Tk(e,o)===void 0)n=o+1;else r=o}return{min:n,max:t}}function C2(e,t){return j9.pipe(de(e,_M(t)))}function z9(e){return Vk.pipe(de(e,RM))}function K9(e){return Gk.pipe(de(e,PM))}function Qk(e,t,n,r,o){let s=E7(n,t,r),i=F2(t),a=class extends e{constructor(...[c,u]){let f=u?.["~payload"],d=f?.token===Ak?f.value:n.make(c??{},u);super(d,{...u,disableChecks:!0,"~payload":{token:Ak,value:d}})}static[Ud]=Ud;get[i](){return i}static[y7]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return le(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return Pg(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Ur(this.ast,c))}static annotateKey(c){return this.rebuild(Sd(this.ast,c))}static check(...c){return this.rebuild(Fo(this.ast,c))}static extend(c){return(u,l)=>{let f=Xd(u)?u:Q(u),d={...n.fields,...f.fields},m=og(d,n.ast.checks,{identifier:c});return Qk(this,c,Fk(Fo(m,f.ast.checks),d),l,o)}}static mapFields(c,u){return n.mapFields(c,u)}};if(o!==void 0)Object.assign(a.prototype,o(t));return a}function S7(e){return new Pe(ve((t)=>new e(t,{"~payload":{token:Ak,value:t}})),ro())}function F2(e){return`~effect/Schema/Class/${e}`}function E7(e,t,n){let r;return(o)=>{if(r!==void 0)return r;let s=F2(t),i=(u)=>u instanceof o||M(u,s),a=S7(o),c=V(new Ba([e.ast],()=>(u,l,f)=>i(u)?v(u):A(new ft(l,u,f)),{identifier:t,[Fh]:([u])=>({isConstructed:i,link:new dt(u,a)}),toCodec:([u])=>new dt(u.ast,a),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map((l)=>new o(l)),terminal:u.terminal?.map((l)=>new o(l))}),toFormatter:([u])=>(l)=>`${o.identifier}(${u(l)})`,[td]:Ru(e.ast),...n}));return r=de(c,a)(e)}}function Xd(e){return Jg(e)}function w7(e){let t=HD(e.ast);return(n)=>t(n,{})}function v7(e){return(t)=>t.annotate({toFormatter:e})}function k7(e,t){return n(e.ast);function n(o){let s=_o(o)?.toFormatter;if(typeof s==="function")return s(Mi(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let i=t.onBefore(o,n);if(i!==void 0)return i}return r(o)}function r(o){switch(o._tag){default:return B;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),i=o.rest.map(n);return(a)=>{let c=[],u=0;for(;u<s.length;u++)if(a.length<u+1){if(bt(o.elements[u]))continue}else c.push(s[u](a[u]));if(i.length>0){let[l,...f]=i;for(;u<a.length-f.length;u++)c.push(l(a[u]));for(let d=0;d<f.length;d++)c.push(f[d](a[u+d]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map((a)=>n(a.type)),i=o.indexSignatures.map((a)=>n(a.type));if(o.propertySignatures.length===0&&o.indexSignatures.length===0)return B;return(a)=>{let c=[],u=new Set;for(let l=0;l<s.length;l++){let f=o.propertySignatures[l],d=f.name;if(u.add(d),bt(f.type)&&!Object.hasOwn(a,d))continue;c.push(`${Go(d)}: ${s[l](a[d])}`)}for(let l=0;l<i.length;l++){let f=La(a,o.indexSignatures[l].parameter);for(let d of f){if(u.has(d))continue;u.add(d),c.push(`${Go(d)}: ${i[l](a[d])}`)}}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=sn(o).types,i=(c)=>md(c,s),a=new Map(s.map((c,u)=>[c,[Ad(c),n(o.types[u])]]));return(c)=>{let u=i(c);for(let l=0;l<u.length;l++){let[f,d]=a.get(u[l]);if(f(c))return d(c)}return B(c)}}case"Suspend":{let s=Ha(()=>n(o.thunk()));return(i)=>s()(i)}}}}function I7(e){return(t)=>t.annotate({toEquivalence:e})}function C7(e){return zD(e.ast)}function T7(e,t){return bk(e.ast,t)}function N2(e,t){let n=bk(ox(e.ast),t);return i$(n,t)}function D2(e){return V(ox(e.ast),{schema:e})}function Xk(e){return e.constructorDefault===void 0?e:new so(e.isOptional,e.isMutable,void 0,e.annotations)}function $2(e){if(e.propertySignatures.some((t)=>typeof t.name!=="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function U2(e){return(t)=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(Jn(t[s]),s);let r=[...t].sort((s,i)=>{s=Jn(s),i=Jn(i);let a=e(s),c=e(i);if(a!==c)return a-c;return n.get(s)-n.get(i)});if(!r.some((s,i)=>s!==t[i]))return t;return r}}function A7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!ln(n))return Ge(e,[_v]);let r=e.typeParameters.map((s)=>Rd(Jn(s))),o=n(r);return o===void 0?e:Ge(e,[Nu(o,t)])}case"Unknown":return Ge(e,[_v]);case"ObjectKeyword":return Ge(e,[M1]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return $2(e),e.recur(t,mg);case"Union":{let n=O7(e.types);if(n!==e.types)return new Fn(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function L2(e){return V(j2(sn(e.ast)))}function _7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(ln(n)){let r=n(e.typeParameters.map((o)=>Rd(o)));return Ge(e,[Nu(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function ep(e){return V(q2(e.ast),{schema:e})}function R7(e){return V(z2(e.ast))}function P7(e,t){let n=ku(e.ast)??xw(e.ast),r=G$(ep(e));return(o)=>r(o).pipe(oe((s)=>F7(s,{rootName:n,...t})))}function F7(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return l(n,e,0),c.join(o?`
36
+ `:"");function u(f,d){c.push(o?s.repeat(f)+d:d)}function l(f,d,m,g){let{attrs:b,safe:x}=Gu.tagInfo(f,g);if(d===void 0)u(m,`<${x}${b}/>`);else if(typeof d==="string")u(m,`<${x}${b}>${Gu.escapeText(d)}</${x}>`);else if(typeof d!=="object"||d===null)u(m,`<${x}${b}>${Gu.escapeText(B(d))}</${x}>`);else{if(a.has(d))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:d});a.add(d);try{if(globalThis.globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${x}${b}/>`);return}u(m,`<${x}${b}>`);for(let S of d)l(r,S,m+1);u(m,`</${x}>`);return}let I=d,C=Object.keys(I);if(i)C.sort();if(C.length===0){u(m,`<${x}${b}/>`);return}u(m,`<${x}${b}>`);for(let S of C)l(Gu.parseTagName(S).safe,I[S],m+1,S);u(m,`</${x}>`)}finally{a.delete(d)}}}}function N7(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map((u)=>V(t(Jn(u)))),o=e.annotations?.toCodecStringTree;if(ln(o)){let u=o(r);if(u===void 0)return e;return Ge(e,[Nu(u,t)])}let s=e.annotations?.toCodecJson,i=ln(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(ln(a)?a(r):void 0);return c===void 0?n(e):Ge(e,[Nu(c,t)])}case"Null":return Ge(e,[D7]);case"Boolean":return Ge(e,[$7]);case"Unknown":case"ObjectKeyword":return Ge(e,[Rv]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return $2(e),e.recur(t,mg);case"Union":{let r=M7(e.types);if(r!==e.types)return new Fn(r,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function U7(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(z2):e}function J7(e){let t=L2(e);return g$(ak(t),sk(t))}function Z7(e){return qg()}function Y7(e){return qg()}function Q7(e,t){return(n)=>V(Ur(n.ast,{toCodecIso:()=>new dt(e.ast,Zh(t))}),{schema:n})}function X7(e){let t=D2(e),n=ak(t),r=sk(t);return{empty:[],diff:(o,s)=>l$(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=f$(s,i);return Object.is(a,i)?o:r(a)}}}function eX(e){let t=oU(()=>n),n=pt([e,$e(t),Yg(J,t)]);return n}function sX(e){return _o(e.ast)}function iX(e){return e.ast.context?.annotations}var Ud,Ld="~effect/SchemaError/SchemaError",Za,Bd,uQ,lQ,fQ,dQ,pQ,mQ,hQ,gQ,G$,xQ,yQ,SQ,EQ,bQ,wQ,V,Ds,vQ,Nn,kQ,IQ,CQ,Dn,Xu,jd="~effect/Schema/flip",RQ,PQ,Rk,Fe,Pk,J,Hd,Zg,eU,$o,FQ,MQ,$Q=(e)=>typeof e==="symbol"?e:globalThis.String(e),$e,HQ,WQ,Mk,Qg,rU,Ze,T$="^\\S[\\s\\S]*\\S$|^\\S$|^$",s8,i8,a8,c8,u8,l8,f8=(e)=>{if(e)return 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})$`);return/^([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})$/},d8,O$,p8,m8,h8,g8,x8,y8,S8,A$="^[^a-z]*$",E8,_$="^[^A-Z]*$",b8,R$="^[^a-z]?.*$",w8,P$="^[^A-Z]?.*$",v8,Zn,OU,k8,_U,I8,Lk,C8,RU,T8,PU,O8,Gd,A8,FU,_8,R8,Uo,an,MU,NU,DU,$U,UU,LU,jU,BU,HU,qU,M8,N8,D8,$8,U8,L8,j8,B8,H8,q8,z8,W8,K8,V8,G8,J8,XU,Z8,Y8,o9,s9,i9,a9,u9,l9,f9,d9,a2=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),c2=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},F$,p9,M$,m9,h9,S9,E9,b9,w9,v9,S2,k9,E2,nx,I9,C9,b2,Yn,T9,O9,A9,Zd,_9,R9,w2,P9,F9,v2,k2=20,I2="Unable to derive an arbitrary for the ordered BigDecimal constraints",Wk,U9,L9,j9,B9,Kk,H9,Vk,q9,Gk,W9,V9,G9,J9,T2,Z9,Y9,Q9,X9,e7,Ok,t7,n7,O2,Yd,r7,o7,s7,i7,Qd,a7,c7,u7,l7,A2,f7,_2,Jk,d7,p7,R2,Zk,m7,h7,P2,Yk,g7,x7,y7,Ak,M2=(e)=>(t,n)=>{let r=Xd(t)?t:Q(t);return Qk(sm,e,r,n,(o)=>({toString(){return`${o}(${B({...this})})`}}))},b7=(e)=>(t,n,r)=>{let o=Xd(n)?n.mapFields((s)=>({_tag:$s(t),...s}),{unsafePreserveChecks:!0}):Xg(t,n);return M2(e??t)(o,r)},rx=(e)=>(t,n)=>{let r=Xd(t)?t:Q(t);return Qk(Al,e,r,n,(s)=>({name:s}))},po=(e)=>(t,n,r)=>{let o=Xd(n)?n.mapFields((s)=>({_tag:$s(t),...s}),{unsafePreserveChecks:!0}):Xg(t,n);return rx(e??t)(o,r)},ox,O7,j2,Gu,M7,D7,$7,B2,H2=(e)=>e.transformation===B2,q2,U$=(e)=>bt(e)?Du(Rs):Rs,z2,L7,j7,B7,H7,q7,z7,W7,K7,V7,G7,tp,tX,nX,rX,W2,oX;var Xa=w(()=>{An();Kw();rn();cP();Wc();Hh();ai();Oe();cm();yt();Xo();dr();kn();X();NN();KN();XN();rt();ht();Vv();Ti();yD();qD();WD();a$();c$();hm();p$();xk();Xm();E$();_e();ia();Qe();he();NC();$d();yk();gn();om();Ps();Vh();Ai();Mg();Xh();Dg();Ud=Ng;Za=class Za extends ci("SchemaError"){[Ld]=Ld;constructor(e){let t=li();ir(0);try{super({issue:e})}finally{ir(t)}}get message(){return wF(this.issue)}toString(){return`SchemaError(${this.message})`}};Bd=nD,uQ=oD;lQ=Us;fQ=z$,dQ=ok,pQ=iD;mQ=W$;hQ=K$;gQ=V$;G$=Gg;xQ=J$,yQ=ik,SQ=uD;EQ=Z$;bQ=Y$;wQ=Q$,V=Rd;Ds=En((e)=>V(Du(e.ast),{schema:e})),vQ=En((e)=>e.schema),Nn=En((e)=>{let t=Qg(e);return V(S1(e.ast),{schema:t})}),kQ=En((e)=>e.schema.members[0]),IQ=En((e)=>V(kv(e.ast),{schema:e})),CQ=En((e)=>e.schema),Dn=En((e)=>V(sn(e.ast),{schema:e})),Xu=En((e)=>V(Jn(e.ast),{schema:e}));RQ=V(JM),PQ=V(YM),Rk=V(Rs),Fe=V(lv),Pk=V(fv),J=V(Po),Hd=V(hv),Zg=V(s1),eU=V(a1),$o=V(u1),FQ=V(VM),MQ=V(e1);$e=En((e)=>V(new io(!1,[],[e.ast]),{value:e})),HQ=En((e)=>V(new io(!1,[e.ast],[e.ast]),{value:e}));WQ=En((e)=>V(new io(!0,e.ast.elements,e.ast.rest),{schema:e}));Mk=En((e)=>pt([e,Fe])),Qg=En((e)=>pt([e,Pk])),rU=En((e)=>pt([e,Fe,Pk]));Ze=cg;s8=ge("effect/schema/isTrimmed",Fe,({annotations:e})=>$k(e));i8=Q({source:J,flags:J}).check(Ze((e)=>{let t=iS(()=>new globalThis.RegExp(e.source,e.flags));return Ut(t)&&t.success.source===e.source&&t.success.flags===e.flags})),a8={id:"effect/schema/isPattern",payloadSchema:i8,revive:({annotations:e,payload:t})=>Ya(new globalThis.RegExp(t.source,t.flags),e)};c8=ge("effect/schema/isStringFinite",Fe,({annotations:e})=>mU(e));u8=ge("effect/schema/isStringBigInt",Fe,({annotations:e})=>hU(e));l8=ge("effect/schema/isStringSymbol",Fe,({annotations:e})=>gU(e));d8=ge("effect/schema/isUUID",Q({version:pt([Ls([1,2,3,4,5,6,7,8]),Fe])}),({annotations:e,payload:t})=>xU(t.version??void 0,e)),O$=/^([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})$/;p8=ge("effect/schema/isGUID",Fe,({annotations:e})=>yU(e));m8=ge("effect/schema/isULID",Fe,({annotations:e})=>SU(e));h8=ge("effect/schema/isBase64",Fe,({annotations:e})=>Uk(e));g8=ge("effect/schema/isBase64Url",Fe,({annotations:e})=>EU(e));x8=ge("effect/schema/isStartsWith",Q({startsWith:J}),({annotations:e,payload:t})=>bU(t.startsWith,e));y8=ge("effect/schema/isEndsWith",Q({endsWith:J}),({annotations:e,payload:t})=>wU(t.endsWith,e));S8=ge("effect/schema/isIncludes",Q({includes:J}),({annotations:e,payload:t})=>vU(t.includes,e));E8=ge("effect/schema/isUppercased",Fe,({annotations:e})=>kU(e));b8=ge("effect/schema/isLowercased",Fe,({annotations:e})=>IU(e));w8=ge("effect/schema/isCapitalized",Fe,({annotations:e})=>CU(e));v8=ge("effect/schema/isUncapitalized",Fe,({annotations:e})=>TU(e)),Zn=V(Ev),OU=Sv,k8=ge("effect/schema/isFinite",Fe,({annotations:e})=>OU(e));_U=qd({order:rr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Zu(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${B(e)})`})})}),I8=ge("effect/schema/isGreaterThan",Q({exclusiveMinimum:Zn}),({annotations:e,payload:t})=>_U(t.exclusiveMinimum,e)),Lk=zd({order:rr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Zu(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${B(e)})`})})}),C8=ge("effect/schema/isGreaterThanOrEqualTo",Q({minimum:Zn}),({annotations:e,payload:t})=>Lk(t.minimum,e)),RU=Wd({order:rr,annotate:(e)=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Zu(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${B(e)})`})})}),T8=ge("effect/schema/isLessThan",Q({exclusiveMaximum:Zn}),({annotations:e,payload:t})=>RU(t.exclusiveMaximum,e)),PU=Kd({order:rr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Zu(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${B(e)})`})})}),O8=ge("effect/schema/isLessThanOrEqualTo",Q({maximum:Zn}),({annotations:e,payload:t})=>PU(t.maximum,e)),Gd=Vd({order:rr,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Zu(e.minimum),maximum:Zu(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${B(e.minimum)}, maximum: ${B(e.maximum)}, exclusiveMinimum: ${B(t)}, exclusiveMaximum: ${B(n)} })`})}}}),A8=ge("effect/schema/isBetween",Q({minimum:Zn,maximum:Zn,exclusiveMinimum:Nn(Ke(!0)),exclusiveMaximum:Nn(Ke(!0))}),({annotations:e,payload:t})=>Gd(t,e)),FU=AU({remainder:nR,zero:0,annotate:(e)=>({expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${B(e)})`})})}),_8=ge("effect/schema/isMultipleOf",Q({divisor:Zn}),({annotations:e,payload:t})=>FU(t.divisor,e));R8=ge("effect/schema/isInt",Fe,({annotations:e})=>Jd(e)),Uo=Hd.check(Jd()),an=Uo.check(Lk(0));MU=qd({order:sa,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Yu(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${Qu(e)})`})})}),NU=zd({order:sa,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Yu(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Qu(e)})`})})}),DU=Wd({order:sa,annotate:(e)=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Yu(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${Qu(e)})`})})}),$U=Kd({order:sa,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Yu(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Qu(e)})`})})}),UU=Vd({order:sa,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Yu(e.minimum),maximum:Yu(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Qu(e.minimum)}, maximum: ${Qu(e.maximum)}, exclusiveMinimum: ${B(t)}, exclusiveMaximum: ${B(n)} })`})}}}),LU=qd({order:Cr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${B(e)})`})})}),jU=zd({order:Cr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${B(e)})`})})}),BU=Wd({order:Cr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${B(e)})`})})}),HU=Kd({order:Cr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${B(e)})`})})}),qU=Vd({order:Cr,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=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},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${B(e.minimum)}, maximum: ${B(e.maximum)}, exclusiveMinimum: ${B(t)}, exclusiveMaximum: ${B(n)} })`})}}}),M8=qd({order:_s,formatter:(e)=>Ro(e)}),N8=zd({order:_s,formatter:(e)=>Ro(e)}),D8=Wd({order:_s,formatter:(e)=>Ro(e)}),$8=Kd({order:_s,formatter:(e)=>Ro(e)}),U8=Vd({order:_s,formatter:(e)=>Ro(e)});L8=ge("effect/schema/isMinLength",Q({minLength:an}),({annotations:e,payload:t})=>jk(t.minLength,e));j8=ge("effect/schema/isMaxLength",Q({maxLength:an}),({annotations:e,payload:t})=>WU(t.maxLength,e));B8=ge("effect/schema/isLengthBetween",Q({minimum:an,maximum:an}),({annotations:e,payload:t})=>Bk(t.minimum,t.maximum,e));H8=ge("effect/schema/isMinSize",Q({minSize:an}),({annotations:e,payload:t})=>KU(t.minSize,e));q8=ge("effect/schema/isMaxSize",Q({maxSize:an}),({annotations:e,payload:t})=>VU(t.maxSize,e));z8=ge("effect/schema/isSizeBetween",Q({minimum:an,maximum:an}),({annotations:e,payload:t})=>GU(t.minimum,t.maximum,e));W8=ge("effect/schema/isMinProperties",Q({minProperties:an}),({annotations:e,payload:t})=>JU(t.minProperties,e));K8=ge("effect/schema/isMaxProperties",Q({maxProperties:an}),({annotations:e,payload:t})=>ZU(t.maxProperties,e));V8=ge("effect/schema/isPropertiesLengthBetween",Q({minimum:an,maximum:an}),({annotations:e,payload:t})=>YU(t.minimum,t.maximum,e));G8=ge("effect/schema/isPropertyNames",Fe,({annotations:e,schemas:t})=>QU(t[0],e));J8=ge("effect/schema/isUnique",Fe,({annotations:e})=>Hk(e)),XU=J.check(zU()),Z8=J.check(Bk(1,1));Y8=Mn("effect/schema/Option",Fe,({annotations:e,typeParameters:t})=>{let n=ji(t[0]);return e===void 0?n:n.annotate(e)});o9=Mn("effect/schema/Result",Fe,({annotations:e,typeParameters:t})=>{let n=e2(t[0],t[1]);return e===void 0?n:n.annotate(e)}),s9=Br((e)=>{if(!fn(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every((n)=>{switch(n){case"label":return typeof e[n]==="string";case"disallowJsonEncode":return e[n]===!0;default:return!1}})}),i9=pt([Fe,s9]);a9=Mn("effect/schema/Redacted",i9,({annotations:e,payload:t,typeParameters:n})=>{let r=ex(n[0],t??void 0);return e===void 0?r:r.annotate(e)});u9=Mn("effect/schema/CauseReason",Fe,({annotations:e,typeParameters:t})=>{let n=Wg(t[0],t[1]);return e===void 0?n:n.annotate(e)});l9=Mn("effect/schema/Cause",Fe,({annotations:e,typeParameters:t})=>{let n=Kg(t[0],t[1]);return e===void 0?n:n.annotate(e)});f9=Br((e)=>{if(!fn(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every((n)=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),d9=pt([Fe,f9]),F$=[];p9=Mn("effect/schema/Error",d9,({annotations:e,payload:t})=>{let n=u2(t??void 0);return e===void 0?n:n.annotate(e)}),M$=[];m9=Mn("effect/schema/Exit",Fe,({annotations:e,typeParameters:t})=>{let n=l2(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});h9=Mn("effect/schema/ReadonlyMap",Fe,({annotations:e,typeParameters:t})=>{let n=p2(t[0],t[1]);return e===void 0?n:n.annotate(e)});S9=Mn("effect/schema/Graph",Ls(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=m2(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});E9=Mn("effect/schema/HashMap",Fe,({annotations:e,typeParameters:t})=>{let n=h2(t[0],t[1]);return e===void 0?n:n.annotate(e)});b9=Mn("effect/schema/ReadonlySet",Fe,({annotations:e,typeParameters:t})=>{let n=g2(t[0]);return e===void 0?n:n.annotate(e)});w9=Mn("effect/schema/HashSet",Fe,({annotations:e,typeParameters:t})=>{let n=x2(t[0]);return e===void 0?n:n.annotate(e)});v9=Mn("effect/schema/Chunk",Fe,({annotations:e,typeParameters:t})=>{let n=y2(t[0]);return e===void 0?n:n.annotate(e)}),S2=Li(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Je()(Q({source:J,flags:J}),Sr({decode:(e,t)=>Nt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new we({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>v({source:e.source,flags:e.flags})})),toArbitrary:()=>(e)=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((t)=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),k9=bn("effect/schema/RegExp",S2),E2=J.annotate({expected:"a string that will be decoded as a URL"}),nx=Li(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Je()(E2,Gw),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),I9=bn("effect/schema/URL",nx),C9=E2.pipe(de(nx,Gw));b2=J.annotate({expected:"a string that will be decoded as a Date"}),Yn=Br((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:()=>Je()(b2,Vw),toArbitrary:()=>(e,t)=>e.date(zk(t?.constraint?.ordered?.order===sa?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),T9=bn("effect/schema/Date",Yn),O9=b2.pipe(de(Yn,Vw)),A9=Uo.pipe(de(Yn,dM)),Zd=Br(xS,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Je()(pt([Q({_tag:Ke("Infinity")}),Q({_tag:Ke("NegativeInfinity")}),Q({_tag:Ke("Nanos"),value:$o}),Q({_tag:Ke("Millis"),value:Uo})]),st({decode:(e)=>{switch(e._tag){case"Infinity":return ss;case"NegativeInfinity":return pa;case"Nanos":return Tr(e.value);case"Millis":return ii(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}}}})),toArbitrary:()=>(e)=>e.oneof(e.constant(ss),e.constant(pa),e.bigInt().map(Tr),e.maxSafeInteger().map(ii)),toFormatter:()=>globalThis.String,toEquivalence:()=>yS}),_9=bn("effect/schema/Duration",Zd),R9=J.annotate({expected:"a string that will be decoded as a Duration"}),w2=R9.pipe(de(Zd,pM)),P9=$o.pipe(de(Zd,mM)),F9=Hd.pipe(de(Zd,hM)),v2=J.annotate({expected:"a string that will be decoded as a BigDecimal"});Wk=Br(Jh,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Je()(v2,Jw),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===_s?t.constraint.ordered:void 0;if(n===void 0)return e.tuple(e.bigInt(),e.integer({min:0,max:k2})).map(([r,o])=>Gn(r,o));return e.integer($9(n)).chain((r)=>{let o=Tk(n,r);if(o===void 0)throw new globalThis.Error(I2);return e.bigInt(o).map((s)=>Gn(s,r))})},toFormatter:()=>(e)=>Ro(e),toEquivalence:()=>Hw}),U9=bn("effect/schema/BigDecimal",Wk),L9=v2.pipe(de(Wk,Jw)),j9=J.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});B9=C2(Rk),Kk=Li(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Je()(Q({data:J.check(Uk()),type:J,name:J,lastModified:Uo}),Sr({decode:(e,t)=>Bn(Vc(e.data),{onFailure:()=>A(new we({expected:"a valid Base64 string"},e.data,t)),onSuccess:(n)=>{let r=new globalThis.Uint8Array(n);return v(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>lu({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:am(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new we({expected:"a readable File"},e,t)})}))}),H9=bn("effect/schema/File",Kk),Vk=Li(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Je()($e(Ju([J,pt([Q({_tag:$s("String"),value:J}),Q({_tag:$s("File"),value:Kk})])])),Sr({decode:(e)=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return v(t)},encode:(e)=>v(globalThis.Array.from(e.entries()).map(([t,n])=>{if(typeof n==="string")return[t,{_tag:"String",value:n}];else return[t,{_tag:"File",value:n}]}))}))}),q9=bn("effect/schema/FormData",Vk);Gk=Li(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Je()(J.annotate({expected:"a query string that will be decoded as URLSearchParams"}),st({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))}),W9=bn("effect/schema/URLSearchParams",Gk);V9=J.annotate({expected:"a string that will be decoded as a number"}).pipe(de(Hd,Au)),G9=J.annotate({expected:"a string that will be decoded as a finite number"}).pipe(de(Zn,Au)),J9=V(Ov).pipe(de($o,Qh)),T2=J.check($k()),Z9=J.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(de(T2,fM())),Y9=J.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(de(J,CM)),Q9=J.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(de(J,TM)),X9=J.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(de(J,OM)),e7=J.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(de(J,AM)),Ok=pt([Zn,eU,J]),t7=Q({issues:$e(Q({message:J,path:Nn($e(pt([Ok,Q({key:Ok})])))}))}),n7=Ls([0,1]).pipe(de(Zg,st({decode:(e)=>e===1,encode:(e)=>e?1:0}))),O2=J.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Yd=Li(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Je()(O2,Zw),toArbitrary:()=>(e)=>e.uint8Array()}),r7=bn("effect/schema/Uint8Array",Yd),o7=O2.pipe(de(Yd,Zw)),s7=J.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(de(Yd,{decode:zF(),encode:Wh()})),i7=J.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(de(Yd,{decode:KF(),encode:Kh()})),Qd=Br((e)=>Ow(e)&&TF(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",toCodecJson:()=>Je()(J,Xw),toArbitrary:()=>(e,t)=>e.date(zk(t?.constraint?.ordered?.order===_w?t.constraint.ordered:void 0,{noInvalidDate:!0},jh)).map((n)=>AF(n)),toFormatter:()=>(e)=>e.toString(),toEquivalence:()=>Aw}),a7=bn("effect/schema/DateTimeUtc",Qd),c7=Yn.pipe(de(Qd,{decode:Uw(),encode:ve(jh)})),u7=J.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(de(Qd,Xw)),l7=Uo.pipe(de(Qd,{decode:Uw(),encode:ve(MF)})),A2=Br(IF,{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:()=>Je()(Uo,FM),toArbitrary:()=>(e)=>e.integer({min:-43200000,max:50400000}).map((t)=>ad(t)),toFormatter:()=>(e)=>_i(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),f7=bn("effect/schema/TimeZoneOffset",A2),_2=J.annotate({expected:"an IANA time zone identifier"}),Jk=Br(CF,{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",toCodecJson:()=>Je()(_2,Yw),toArbitrary:()=>(e)=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(Rw)),toFormatter:()=>(e)=>_i(e),toEquivalence:()=>(e,t)=>e.id===t.id}),d7=bn("effect/schema/TimeZoneNamed",Jk),p7=_2.pipe(de(Jk,Yw)),R2=J.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),Zk=Br(kF,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecJson:()=>Je()(R2,Qw),toArbitrary:()=>(e)=>e.oneof(e.integer({min:-43200000,max:50400000}).map((t)=>ad(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(Rw))),toFormatter:()=>(e)=>_i(e),toEquivalence:()=>(e,t)=>_i(e)===_i(t)}),m7=bn("effect/schema/TimeZone",Zk),h7=R2.pipe(de(Zk,Qw)),P2=J.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),Yk=Br((e)=>Ow(e)&&OF(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",toCodecJson:()=>Je()(P2,ev),toArbitrary:()=>(e,t)=>e.tuple(e.date(zk(t?.constraint?.ordered?.order===_w?t.constraint.ordered:void 0,{max:new globalThis.Date(8639999949600000),min:new globalThis.Date(-8639999949600000),noInvalidDate:!0},jh)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>_F(n,{timeZone:r})),toFormatter:()=>(e)=>Bh(e),toEquivalence:()=>Aw}),g7=bn("effect/schema/DateTimeZoned",Yk),x7=P2.pipe(de(Yk,ev)),y7=globalThis.Symbol.for("immer-draftable"),Ak={};ox=qa((e)=>{let t=A7(e,ox),n=e.context;if(t===e||n===void 0)return t;return fg(t,Xk(n))});O7=U2((e)=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});j2=Qt((e)=>{let t=_7(e,j2);return t!==e&&e.context!==void 0?fg(t,Xk(e.context)):t});Gu={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,n=e;if(!/^[A-Za-z_]/.test(n))n="_"+n;if(n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n))n="_"+n;return{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=Gu.parseTagName(e),s=n||t&&t!==e?` data-name="${Gu.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},M7=U2((e)=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});D7=new dt(new Er("null"),new Pe(ve(()=>null),ve(()=>"null"))),$7=new dt(new Fn([new Er("true"),new Er("false")],"anyOf"),new Pe(ve((e)=>e==="true"),Ua())),B2=new Pe(ve((e)=>typeof e==="string"?[e]:e),ro()),q2=qa((e)=>{let t=N7(e,q2,(n)=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});if(t!==e&&e.context!==void 0)return fg(t,Xk(e.context));return t},{stopAt:H2}),z2=qa((e)=>{let t=U7(e);if(uv(t)){let n=dg(new Fn([new io(t.isMutable,t.elements.map(U$),t.rest.map(U$)),Po],"anyOf"),t,B2);return bt(e)?Du(n):n}return t},{stopAt:H2});L7=ge("effect/schema/isGreaterThanDate",Q({exclusiveMinimum:Yn}),({annotations:e,payload:t})=>MU(t.exclusiveMinimum,e)),j7=ge("effect/schema/isGreaterThanOrEqualToDate",Q({minimum:Yn}),({annotations:e,payload:t})=>NU(t.minimum,e)),B7=ge("effect/schema/isLessThanDate",Q({exclusiveMaximum:Yn}),({annotations:e,payload:t})=>DU(t.exclusiveMaximum,e)),H7=ge("effect/schema/isLessThanOrEqualToDate",Q({maximum:Yn}),({annotations:e,payload:t})=>$U(t.maximum,e)),q7=ge("effect/schema/isBetweenDate",Q({minimum:Yn,maximum:Yn,exclusiveMinimum:Nn(Ke(!0)),exclusiveMaximum:Nn(Ke(!0))}),({annotations:e,payload:t})=>UU(t,e)),z7=ge("effect/schema/isGreaterThanBigInt",Q({exclusiveMinimum:$o}),({annotations:e,payload:t})=>LU(t.exclusiveMinimum,e)),W7=ge("effect/schema/isGreaterThanOrEqualToBigInt",Q({minimum:$o}),({annotations:e,payload:t})=>jU(t.minimum,e)),K7=ge("effect/schema/isLessThanBigInt",Q({exclusiveMaximum:$o}),({annotations:e,payload:t})=>BU(t.exclusiveMaximum,e)),V7=ge("effect/schema/isLessThanOrEqualToBigInt",Q({maximum:$o}),({annotations:e,payload:t})=>HU(t.maximum,e)),G7=ge("effect/schema/isBetweenBigInt",Q({minimum:$o,maximum:$o,exclusiveMinimum:Nn(Ke(!0)),exclusiveMaximum:Nn(Ke(!0))}),({annotations:e,payload:t})=>qU(t,e));tp=V(Ur(Fu,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),tX=Yg(J,tp),nX=bn("effect/schema/Json",tp),rX=Q({message:J,name:Ds(J),stack:Ds(J),cause:Ds(tp)}),W2=V(Ur(F1,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),oX=bn("effect/schema/MutableJson",W2)});var K2="~effect/platform/Terminal",eI="effect/platform/Terminal/QuitError",np,V2=(e)=>M(e,eI),mo,G2=(e)=>mo.of({...e,[K2]:K2});var sx=w(()=>{Ve();he();Xa();np=class np extends rx("QuitError")({_tag:$s("QuitError")}){[eI]=eI};mo=ze("effect/platform/Terminal")});import*as ix from"readline";function Y2(e){return e.key.ctrl&&(e.key.name==="c"||e.key.name==="d")}var J2,Z2;var Q2=w(()=>{Oe();wo();_e();Oo();he();Gf();eF();sx();J2=H(function*(e=Y2){let{stdin:t,stdout:n}=process,r=yield*bu(),o=t.readableEnded,s=!1,i=()=>{if(o=!0,!s)ks(r)};t.once("end",i),yield*dh(()=>Se(()=>t.off("end",i)));let a=yield*XP({acquire:Mr(Se(()=>{let m=ix.createInterface({input:t,escapeCodeTimeout:50}),g=(x)=>Wf(r,x),b=()=>{s=!1,ks(r)};if(s=!0,ix.emitKeypressEvents(t,m),m.on("line",g),m.once("close",b),t.isTTY)t.setRawMode(!0);return{rl:m,onClose:b,onLine:g}}),({rl:m,onClose:g,onLine:b})=>Se(()=>{if(s=!1,m.off("line",b),m.off("close",g),t.isTTY)t.setRawMode(!1);if(m.close(),o)ks(r)})),idleTimeToLive:"10 millis"}),c=Se(()=>n.columns??0),u=Se(()=>n.rows??0),l=qt(function*(){let m=yield*bu(),g=(I,C)=>{let S={input:ns(I),key:{name:C.name??"",ctrl:!!C.ctrl,meta:!!C.meta,shift:!!C.shift}};if(Wf(m,S),e(S))ks(m)},b=setInterval(()=>{},2147483647),x=()=>{clearInterval(b),ks(m)};if(yield*dh(()=>Se(()=>{clearInterval(b),t.off("keypress",g),t.off("end",x)})),t.on("keypress",g),o)x();else yield*lw(a),t.once("end",x);return m}),f=Ne(()=>kP(r).pipe(ne(et({onNone:()=>vi(hr(lw(a),Is(r))),onSome:v})),Pt(()=>new np({}))));return G2({columns:c,rows:u,readInput:l,readLine:f,display:(m)=>$f(yn((g)=>{n.write(m,(b)=>B0(b)?g(Te):g(A(bs({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:b}))))}))})}),Z2=su(mo,J2(Y2))});var X2;var eL=w(()=>{Q2();X2=Z2});var ax={};Un(ax,{layer:()=>uX});var uX;var tL=w(()=>{wo();X1();dN();bN();IN();RN();eL();uX=Z1.pipe(N_(Jm(EN,fN,kN,_N,X2)))});var nI=w(()=>{nP();tL()});var el=w(()=>{rn();Wc();Oe();dr();_e();gn();Xa()});var oL=U0(function(xye,rL){var lX=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],nL=/[\n\r\u2028\u2029]/,fX=/[\s#!"$&'():;<=>@\\^`|]/g;rL.exports=function(t){return t.map(function(n){if(n==="")return"''";if(n&&typeof n==="object"){if("op"in n&&n.op==="glob"){if(typeof n.pattern!=="string")throw TypeError("glob token requires a string `pattern`");if(nL.test(n.pattern))throw TypeError("glob `pattern` must not contain line terminators");return n.pattern.replace(fX,"\\$&")}if("op"in n&&typeof n.op==="string"){if(lX.indexOf(n.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(n.op));return n.op.replace(/[\s\S]/g,"\\$&")}if("comment"in n&&typeof n.comment==="string"){if(nL.test(n.comment))throw TypeError("`comment` must not contain line terminators");return"#"+n.comment}throw TypeError("unrecognized object token shape")}if(/["\s\\]/.test(n)&&!/'/.test(n))return"'"+n.replace(/(['])/g,"\\$1")+"'";if(/["'\s]/.test(n))return'"'+n.replace(/(["\\$`!])/g,"\\$1")+'"';return String(n).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,"$1\\$2")}).join(" ")}});var fL=U0(function(yye,lL){var uL="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",sL=new RegExp("^"+uL+"$"),iL="|&;()<> \\t",dX="'([^']*?)'",pX='"((\\\\"|[^"])*?)"',mX=/^#$/,aL="'",cL='"',cx="$",ec="",hX=4294967296;for(ux=0;ux<4;ux++)ec+=(hX*Math.random()).toString(16);var ux,gX=new RegExp("^"+ec);function xX(e,t){var n=t.lastIndex,r=[],o;while(o=t.exec(e))if(r[r.length]=o,t.lastIndex===o.index)t.lastIndex+=1;return t.lastIndex=n,r}function yX(e,t,n){var r=typeof e==="function"?e(n):e[n];if(typeof r>"u"&&n!="")r="";else if(typeof r>"u")r="$";if(typeof r==="object")return t+ec+JSON.stringify(r)+ec;return t+r}function SX(e,t,n){if(!n)n={};var r=n.escape||"\\",o=n.splitUnquoted===!0?`
37
+ `:typeof n.splitUnquoted==="string"?n.splitUnquoted:"",s="(\\"+r+`['"`+iL+`]|[^\\s'"`+iL+"])+",i=new RegExp(["("+uL+")","("+s+"|"+pX+"|"+dX+")+"].join("|"),"g"),a=xX(e,i);if(a.length===0)return[];if(!t)t={};var c=!1;return a.map(function(u){var l=u[0];if(!l||c)return;if(sL.test(l))return{op:l};var f=!1,d=!1,m="",g=[],b=!1,x=null,I=!1,C;function S(){C+=1;var R,z,q=l.charAt(C);if(q==="{"){if(C+=1,l.charAt(C)==="}")throw Error("Bad substitution: "+l.slice(C-2,C+1));var ue=1;R=C;while(ue>0&&R<l.length){if(l.charAt(R)==="{"&&l.charAt(R-1)==="$")ue+=1;else if(l.charAt(R)==="}")ue-=1;R+=1}if(ue!==0)throw Error("Bad substitution: "+l.slice(C));R-=1,z=l.slice(C,R),C=R}else if(/[*@#?$!_-]/.test(q))z=q,C+=1;else{var ut=l.slice(C);if(R=ut.match(/[^\w\d_]/),!R)z=ut,C=l.length;else z=ut.slice(0,R.index),C+=R.index-1}return yX(t,"",z)}function y(){if(x===null)return;if(x===0){if(m!=="")g[g.length]=m,m=""}else{g[g.length]=m,m="";for(var R=1;R<x;R+=1)g[g.length]=""}x=null}for(C=0;C<l.length;C++){var h=l.charAt(C);if(o&&h!==cx)y();if(I=I||!f&&(h==="*"||h==="?"),d)m+=h,d=!1;else if(f)if(h===f)f=!1;else if(f==aL)m+=h;else if(h===r)if(C+=1,h=l.charAt(C),h===cL||h===r||h===cx)m+=h;else m+=r+h;else if(h===cx)m+=S();else m+=h;else if(h===cL||h===aL)f=h,b=!0;else if(sL.test(h))return{op:l};else if(mX.test(h)){c=!0;var E={comment:e.slice(u.index+C+1)};if(m.length)return[m,E];return[E]}else if(h===r)d=!0;else if(h===cx){var k=S();if(!o)m+=k;else for(var T=0;T<k.length;T+=1){var F=k.charAt(T);if(o.indexOf(F)<0)y(),m+=F;else if(x===null)x=F===" "||F==="\t"||F===`
38
+ `?0:1;else if(F!==" "&&F!=="\t"&&F!==`
39
+ `)x+=1}}else m+=h}if(I)return{op:"glob",pattern:m};if(o){if(x!==null&&x>0){g[g.length]=m,m="";for(var N=1;N<x;N+=1)g[g.length]=""}if(m!==""||b&&g.length===0)g[g.length]=m;return g}return m}).reduce(function(u,l){if(typeof l>"u")return u;return[].concat(l).forEach(function(f){u[u.length]=f}),u},[])}lL.exports=function(t,n,r){var o=SX(t,n,r);if(typeof n!=="function")return o;return o.reduce(function(s,i){if(typeof i==="object")return s[s.length]=i,s;var a=i.split(RegExp("("+ec+".*?"+ec+")","g"));if(a.length===1)return s[s.length]=a[0],s;return a.filter(Boolean).forEach(function(c){s[s.length]=gX.test(c)?JSON.parse(c.split(ec)[1]):c}),s},[])}});var js,rI;var dL=w(()=>{js=oL(),rI=fL()});var EX,xL,yL,SL,EL=(e)=>typeof e==="string",Bs=(e)=>{if(typeof e==="object"&&"op"in e&&typeof e.op==="string")return e.op;return null},bX=(e)=>typeof e==="object"&&("comment"in e),wX=(e)=>{try{let t=[...new Bun.Glob(e).scanSync({onlyFiles:!1,dot:!0})];if(t.length>0)return t}catch{}return[e]},vX=(e)=>{if(EL(e))return[e];if(typeof e==="object"&&"op"in e&&e.op==="glob"&&"pattern"in e)return wX(String(e.pattern));let t=Bs(e);if(t!==null){if(yL.has(t)||SL.has(t))return[];return[`__op_${t}__`]}if(bX(e))return[];return["__tripwire_cmd_sub__"]},pL=(e,t)=>{let n=[],r=[],o=[],s=[],i=0;while(i<e.length){let l=e[i],f=Bs(l);if(f!==null&&yL.has(f)){let d=n.at(-1);if(d!==void 0&&/^[0-9]+$/.test(d)&&t.remaining>0)n.pop(),t.remaining-=1;let m=e[i+1];if(m!==void 0&&EL(m)){s.push({op:f,target:m}),i+=2;continue}i+=1;continue}for(let d of vX(l))n.push(d);i+=1}if(n.length===0)return null;for(let l=1;l<n.length;l+=1){let f=n[l];if(f.startsWith("-")&&f!=="-")o.push(f);else r.push(f)}let a=n[0],c=a.lastIndexOf("/");return{head:c===-1?a:a.slice(c+1),tokens:n,args:r,flags:o,redirects:s,raw:n.join(" ")}},kX=(e)=>`$${e}`,IX=(e)=>{let t=[];for(let n=0;n<e.length;n+=1){let r=e[n],o=e[n+1];if(Bs(r)==="&"&&o!==void 0&&(Bs(o)===">"||Bs(o)===">>")){let s={op:Bs(o)===">"?"&>":"&>>"};t.push(s),n+=1;continue}if(Bs(r)===">"&&o!==void 0&&Bs(o)==="|"){t.push({op:">"}),n+=1;continue}t.push(r)}return t},CX=(e)=>e.match(/(?<![\w$])\d+(?=[<>])/g)?.length??0,oI=(e)=>{let t=/<<-?\s*(?:"(?<quoted>[^"]+)"|'(?<single>[^']+)'|(?<unquoted>[A-Za-z_][A-Za-z0-9_]*))/u.exec(e);return t?.groups?.quoted??t?.groups?.single??t?.groups?.unquoted??null},TX,sI=(e)=>TX.test(e),bL=(e)=>{let t=e.split(`
40
+ `),n=[];for(let r=0;r<t.length;r+=1){let o=t[r];n.push(o);let s=oI(o);if(s===null||sI(o))continue;r+=1;while(r<t.length&&t[r].trim()!==s)r+=1;if(r<t.length)n.push("__HEREDOC_BODY__",t[r])}return n.join(`
41
+ `)},wL=(e)=>{let t=new Map,n=e.split(`
42
+ `);for(let r=0;r<n.length;r+=1){let o=n[r],s=oI(o);if(s===null||sI(o))continue;let i=[];r+=1;while(r<n.length&&n[r].trim()!==s)i.push(n[r]),r+=1;if(!t.has(s))t.set(s,i.join(`
43
+ `))}return t},OX=(e)=>{let t=e.split(`
44
+ `),n=[];for(let r=0;r<t.length;r+=1){let o=t[r],s=oI(o);if(s===null||!sI(o))continue;let i=[];r+=1;while(r<t.length&&t[r].trim()!==s)i.push(t[r]),r+=1;if(i.length>0)n.push(i.join(`
45
+ `))}return n},AX=(e,t)=>{for(let n=t;n<e.length;n+=1){let r=e[n];if(r==="\\"){n+=1;continue}if(r==="`")return n}return null},_X=(e,t)=>{let n=1,r=null;for(let o=t;o<e.length;o+=1){let s=e[o];if(s==="\\"){o+=1;continue}if(r==="single"){if(s==="'")r=null;continue}if(s==="'"){r??="single";continue}if(s==='"'){r=r==="double"?null:"double";continue}if(s==="("){n+=1;continue}if(s===")"){if(n-=1,n===0)return o}}return null},RX=(e)=>{let t=[],n=null;for(let r=0;r<e.length;r+=1){let o=e[r];if(o==="\\"){r+=1;continue}if(n==="single"){if(o==="'")n=null;continue}if(o==="'"){n??="single";continue}if(o==='"'){n=n==="double"?null:"double";continue}if(o==="`"){let u=AX(e,r+1);if(u!==null)t.push(e.slice(r+1,u)),r=u;continue}let s=e[r+1];if(!(o==="$"&&s==="(")&&!(n===null&&(o==="<"||o===">")&&s==="("))continue;let c=_X(e,r+2);if(c!==null)t.push(e.slice(r+2,c)),r=c}return t},vL,kL=(e)=>{if(e===""||e==="-")return!1;if(e==="/"||e==="~"||e==="."||e==="..")return!0;if(e.startsWith("/")||e.startsWith("~")||e.startsWith("./")||e.startsWith("../")||vL.test(e))return!0;return!1},lx=(e)=>{if(e==="/")return 100;if(e==="~"||vL.test(e))return 90;if(/^\/(?<dir>etc|usr|bin|sbin|System|Library|var|boot|root|home)(?<suffix>\/|$)/.test(e))return 80;if(e.startsWith("/Users/"))return 70;if(e.startsWith("/")||e.startsWith("~"))return 60;if(e.startsWith("../"))return 40;if(e===".."||e==="."||e.startsWith("./"))return 10;return 50},PX,FX=(e,t)=>{let n=[],r=1;while(r<t){let o=e[r];if(PX.has(o)){r+=2;continue}if(o.startsWith("-")){r+=1;continue}if(kL(o))n.push(o);r+=1}if(n.length===0)return".";return n.sort((o,s)=>lx(s)-lx(o)),n[0]},MX=(e,t)=>{let n=[];for(let r=1;r<t;r+=1){let o=e[r];if(o.startsWith("-"))break;if(kL(o))n.push(o)}if(n.length===0)return".";return n.sort((r,o)=>lx(o)-lx(r)),n[0]},mL,hL,NX,DX=(e,t,n)=>e.map((r)=>t.placeholders.has(r)?n:r),$X=(e)=>{let t=NX[e.head];if(t===void 0)return[];let n=[],{tokens:r}=e;for(let o=1;o<r.length;o+=1){if(!t.execFlags.has(r[o]))continue;let s=[],i=o+1;while(i<r.length){let u=r[i];if(u===";"||u==="+")break;s.push(u),i+=1}if(s.length===0)continue;let a=s[0];if(t.placeholders.has(a))continue;let c=t.pickRoot(r,o);n.push(js(DX(s,t,c))),o=i}return n},UX,LX,dx=(e,t)=>{let n=UX.exec(e);if(n!==null){let o=n.groups?.body??e;if(t!==void 0&&o.trim()==="__HEREDOC_BODY__"){let s=n.groups?.delimiter,i=s===void 0?void 0:t.get(s);if(i!==void 0)return i}return o}let r=LX.exec(e);if(r!==null)return r.groups?.content??e;return e},jX,BX=(e)=>{if(!jX.has(e.head))return[];let{tokens:t}=e;for(let n=1;n<t.length;n+=1){let r=t[n];if(r==="-c"&&n+1<t.length)return[t[n+1]];if(r.startsWith("-")&&!r.startsWith("--")&&r.endsWith("c")&&r.length>2&&n+1<t.length)return[t[n+1]]}return[]},HX,qX,zX=(e)=>/^[A-Za-z_][A-Za-z0-9_]*=.*/u.test(e),WX=(e)=>{let t=e[0],n=qX[t]??new Set,r=1;while(r<e.length){let o=e[r];if(t==="env"&&zX(o)){r+=1;continue}if(n.has(o)){r+=2;continue}if(o.includes("=")&&n.has(o.slice(0,o.indexOf("=")))){r+=1;continue}if(o.startsWith("--")&&o!=="--"){r+=1;continue}if(o.startsWith("-")&&o!=="-"){r+=1;continue}break}return r},KX=(e)=>{if(!HX.has(e.head))return[];if(e.head==="script")for(let r=1;r<e.tokens.length-1;r+=1){let o=e.tokens[r];if(o==="-c"||o==="--command")return[e.tokens[r+1]];if(o.startsWith("--command="))return[o.slice(10)]}let t=WX(e.tokens),n=js(e.tokens.slice(t));return n===""?[]:[n]},VX,GX=(e)=>{if(!VX.has(e.head))return[];if(e.tokens.length===2)return[e.tokens[1]];let t=js(e.tokens.slice(1));return t===""?[]:[t]},JX,ZX=(e)=>e==="rtk",YX=(e)=>{let t=1;while(t<e.length){let n=e[t];if(n.startsWith("-")&&n!=="-"&&n!=="--"){t+=1;continue}break}return t},IL=(e,t)=>{for(let n=t;n<e.length;n+=1){let r=e[n];if((r==="-c"||r==="--command")&&n+1<e.length)return e[n+1];if(r.startsWith("--command="))return r.slice(10)}return null},QX=(e)=>{if(!ZX(e.head))return[];let t=YX(e.tokens),n=e.tokens[t];if(n===void 0)return[];if(JX.has(n)){let o=IL(e.tokens,t+1);if(o!==null)return o===""?[]:[o];let s=t+1;while(s<e.tokens.length){let a=e.tokens[s];if(a==="--"){s+=1;break}if(a.startsWith("-")&&a!=="-"){s+=1;continue}break}let i=js(e.tokens.slice(s));return i===""?[]:[i]}let r=js(e.tokens.slice(t));return r===""?[]:[r]},XX,eee=(e)=>{let t=XX[e.head];if(t===void 0)return[];if(t.dashCommand){let o=IL(e.tokens,1);if(o!==null)return o===""?[]:[o]}let n=1;while(n<e.tokens.length){let o=e.tokens[n];if(t.valueFlags.has(o)){n+=2;continue}if(o.includes("=")&&t.valueFlags.has(o.slice(0,o.indexOf("=")))){n+=1;continue}if(o==="--"){n+=1;break}if(o.startsWith("-")&&o!=="-"){n+=1;continue}break}n+=t.skipPositionals;let r=js(e.tokens.slice(n));return r===""?[]:[r]},CL,tee=(e)=>{if(!CL.has(e.head)||e.tokens.length<2)return[];return[js(e.tokens.slice(1))]},nee,fx="__tripwire_unsupported_shell__",gL=(e)=>({head:fx,tokens:[fx],args:[],flags:[],redirects:[],raw:e}),ree=(e)=>e.some((t)=>{if(t.head==="case"||t.head==="function"||t.head==="{")return!0;if(t.tokens.includes("__op_(__")||t.tokens.includes("__op_)__"))return!0;return CL.has(t.head)&&t.tokens[1]==="{"}),oee=(e)=>{let t="",n=!1,r=!1,o=!1;for(let s of e){if(o){t+=s,o=!1;continue}if(s==="\\"){t+=s,o=!0;continue}if(s==="'"&&!r){n=!n,t+=s;continue}if(s==='"'&&!n){r=!r,t+=s;continue}t+=s===`
46
+ `&&!n&&!r?" ; ":s}return t},tl=(e)=>{let t,n=oee(bL(e));try{t=rI(n,kX)}catch{return[gL(n)]}t=IX(t);let r={remaining:CX(n)},o=[],s=[];for(let c of t){let u=Bs(c);if(u!==null&&SL.has(u)){let l=pL(s,r);if(l!==null)o.push(l);s=[];continue}s.push(c)}let i=pL(s,r);if(i!==null)o.push(i);if(ree(o))o.push(gL(n));for(let c of[...RX(e),...OX(e)])for(let u of tl(c))o.push(u);let a=o.length;for(let c=0;c<a;c+=1){let u=o[c];for(let l of nee)for(let f of l(u))for(let d of tl(f))o.push(d)}return o},see=(e)=>e.startsWith("./")?e.slice(2):e,iI=(e,t=[],n=[])=>{if(e==="")return!1;let r=see(e);if(r===".."||r.startsWith("../")||r.includes("/../"))return!1;for(let o of[...xL,...n])if(r===o||r.startsWith(`${o}/`))return!0;for(let o of[...EX,...t])if(r===o||r.startsWith(`${o}/`))return!0;return!1},TL=(e=[],t=[])=>{let n={"build outputs":["dist","build","_build","out","target"],"js framework outputs":[".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless"],"tests / coverage":["coverage",".nyc_output"],caches:[".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox"],"language / package":["__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target"],"tmp / state":["tmp",".tmp",".state",...xL],iac:[".terraform"],"bundler dev":[".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"]};if(e.length>0)n["custom relative"]=e;if(t.length>0)n["custom absolute"]=t;return Object.entries(n).map(([r,o])=>` ${r}: ${o.join(", ")}`).join(`
47
+ `)},wn=(e)=>/(?<prefix>^|\s)#\s*tripwire-allow:[ \t]*\S[^\r\n]*/.test(bL(e));var Lo=w(()=>{dL();EX=["dist","build","_build","out","target",".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless","coverage",".nyc_output",".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox","__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target","tmp",".tmp",".state",".terraform",".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"],xL=["/tmp","/var/tmp","/var/folders","/private/tmp","/private/var/tmp","/private/var/folders"],yL=new Set([">",">>","<","<<","<<<","<>",">&","<&","&>","&>>"]),SL=new Set([";","&&","||","|","|&","&"]),TX=/(?:^|[|;&]\s*)(?:\/(?:usr\/bin|bin|usr\/local\/bin|opt\/homebrew\/bin)\/)?(?:sh|bash|zsh|dash|ksh|ash)(?:\s|$)/u,vL=/^\$\{?HOME\}?(?:\/|$)/,PX=new Set(["-e","--extension","-t","--type","-E","--exclude","-d","--max-depth","--min-depth","--exact-depth","-c","--color","--changed-within","--changed-before","-S","--size","-o","--owner","-j","--threads","-g","--glob","--format","--max-results","--ignore-file","--search-path","--base-directory","--path-separator","--and"]),mL={execFlags:new Set(["-x","-X","--exec","--exec-batch"]),placeholders:new Set(["{}","{/}","{//}","{.}","{/.}"]),pickRoot:FX},hL={execFlags:new Set(["-exec","-execdir","-ok","-okdir"]),placeholders:new Set(["{}"]),pickRoot:MX},NX=Object.assign(Object.create(null),{fd:mL,fdfind:mL,find:hL,gfind:hL}),UX=/\$\(\s*cat\s+<<-?\s*['"]?(?<delimiter>\w+)['"]?\s*\n(?<body>[\s\S]*?)\n\s*\k<delimiter>\s*\)/u,LX=/\$\(\s*(?:printf|echo)\s+(?:-[a-zA-Z]+\s+)*'(?<content>[^']*)'/u,jX=new Set(["sh","bash","zsh","dash","ksh","ash"]),HX=new Set(["command","exec","env","time","nohup","setsid","nice","ionice","chronic","stdbuf","unbuffer","script","taskset","sudo","doas","xargs","watch"]),qX={command:new Set,env:new Set(["-u","--unset","-C","--chdir","-S","--split-string","--block-signal"]),time:new Set(["-f","--format","-o","--output"]),nice:new Set(["-n","--adjustment"]),ionice:new Set(["-c","--class","-n","--classdata","-p","--pid"]),stdbuf:new Set(["-i","--input","-o","--output","-e","--error"]),script:new Set(["-c","--command"]),taskset:new Set,sudo:new Set(["-u","--user","-g","--group","-C","--close-from","-D","--chdir","-h","--host","-p","--prompt","-r","--role","-t","--type","-U","--other-user","-R","--chroot","-T","--command-timeout"]),doas:new Set(["-a","-C","-u"]),xargs:new Set(["-I","-i","-J","-n","--max-args","-P","--max-procs","-s","--max-chars","-L","--max-lines","-E","--eof","-d","--delimiter","-a","--arg-file","--replace"]),watch:new Set(["-n","--interval"])},VX=new Set(["eval"]),JX=new Set(["run","proxy","err","test","summary"]),XX={timeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,dashCommand:!1},gtimeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,dashCommand:!1},chroot:{valueFlags:new Set(["--userspec","--groups"]),skipPositionals:1,dashCommand:!1},flock:{valueFlags:new Set(["-w","--wait","--timeout","-E","--conflict-exit-code"]),skipPositionals:1,dashCommand:!0},su:{valueFlags:new Set,skipPositionals:0,dashCommand:!0}},CL=new Set(["!","if","elif","then","else","while","until","do"]),nee=[$X,BX,KX,GX,QX,eee,tee]});import{readFileSync as iee}from"fs";import{homedir as aee}from"os";var OL,cee,uee,lee,fee,dee,pee,aI,AL,_L,mee=(e)=>e instanceof Error&&("code"in e)&&e.code==="ENOENT",hee=(e)=>j.try({try:()=>iee(e,"utf8"),catch:(t)=>new AL({cause:t})}).pipe(j.catchTag("ConfigReadError",(t)=>mee(t.cause)?j.succeed(null):j.fail(t))),gee=(e)=>j.try({try:()=>JSON.parse(e),catch:(t)=>new _L({cause:t})}),xee=(e)=>P.decodeUnknownEffect(pee)(e,{onExcessProperty:"error"}),px=()=>({git:{protectedBranches:[],enforceConventionalCommits:!1},safePaths:{},toolPolicies:[],blockedCommands:[],allowedCommands:[],secretScanner:{executable:"betterleaks",timeoutMs:5000}}),cI=(e)=>{let t=px();return{git:{protectedBranches:e.git?.protectedBranches??t.git.protectedBranches,enforceConventionalCommits:e.git?.enforceConventionalCommits??t.git.enforceConventionalCommits},safePaths:{...t.safePaths,...e.safePaths},toolPolicies:e.toolPolicies??t.toolPolicies,blockedCommands:e.blockedCommands??t.blockedCommands,allowedCommands:e.allowedCommands??t.allowedCommands,secretScanner:e.secretScanner??t.secretScanner}},RL=(e=aI)=>j.gen(function*(){let n=yield*hee(e);if(n===null)return{ok:!0,config:px()};let r=yield*gee(n),o=yield*xee(r);return{ok:!0,config:cI(o)}}).pipe(j.timeout(1000),j.catchCause((t)=>{let n={ok:!1,error:lt.pretty(t)};return j.succeed(n)}));var PL=w(()=>{el();OL=P.Struct({pattern:P.String,message:P.String,action:P.optional(P.Union([P.Literal("deny"),P.Literal("ask")])),requiresFlags:P.optional(P.Array(P.String)),forbidsFlagValues:P.optional(P.Array(P.Struct({flag:P.String,values:P.Array(P.String)})))}),cee=P.Struct({protectedBranches:P.optional(P.Array(P.String)),enforceConventionalCommits:P.optional(P.Boolean)}),uee=P.Struct({relative:P.optional(P.Array(P.String)),absolute:P.optional(P.Array(P.String))}),lee=P.Struct({argumentsIncludeAll:P.optional(P.Array(P.String)),argumentsStartWith:P.optional(P.Array(P.String)),shortFlagsIncludeAll:P.optional(P.Array(P.String))}),fee=P.Struct({rule:P.String,executables:P.Array(P.String),action:P.Union([P.Literal("deny"),P.Literal("warn")]),message:P.String,match:P.optional(lee)}),dee=P.Struct({executable:P.String,timeoutMs:P.Finite.check(P.isGreaterThan(0))}),pee=P.Struct({git:P.optional(cee),safePaths:P.optional(uee),toolPolicies:P.optional(P.Array(fee)),blockedCommands:P.optional(P.Array(OL)),allowedCommands:P.optional(P.Array(OL)),secretScanner:P.optional(dee)}),aI=`${aee()}/.config/tripwire/config.json`;AL=class AL extends Or.TaggedError("ConfigReadError"){};_L=class _L extends Or.TaggedError("ConfigParseError"){}});var DL,fI,dI=(e)=>({kind:"cursor",eventName:e,post:fI.has(e)}),yee=(e)=>DL.has(e)||fI.has(e),tc=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),Mt=(e,...t)=>{for(let n of t){let r=e[n];if(typeof r==="string")return r}return},pI=(e,...t)=>{for(let n of t)if(n in e)return e[n];return},lI=(e,t,...n)=>{let r=Mt(e,...n);if(r!==void 0)return r;if(typeof t==="string"&&n.includes("command"))return t;return tc(t)?Mt(t,...n):void 0},FL=(e,t)=>{if(e===void 0)throw Error(`Cursor hook payload missing ${t}`);return e},See=(e)=>{let t=e.toLowerCase();if(t==="bash"||t==="exec"||t==="shell"||t==="run_command")return"Bash";if(t==="read"||t==="read_file")return"Read";if(t==="write"||t==="write_file")return"Write";if(t==="edit"||t==="edit_file"||t==="multiedit"||t==="apply_patch")return"Edit";return e},Eee=(e)=>e==="Read"||e==="Write"||e==="Edit",bee=(e,t)=>{let n;if(typeof e==="string")n=e;else if(tc(e))n=Mt(e,"command","cmd");if(t&&n===void 0)throw Error("Cursor hook payload missing command");if(typeof e==="string")return{command:e};if(!tc(e)||n===void 0)return e;return{...e,command:n}},wee=(e,t,n)=>{let r=Mt(t,"file_path","filePath","path");if(n&&r===void 0)throw Error(`Cursor ${e} hook payload missing file path`);if(e==="Read")return{...t,file_path:r??""};if(e==="Write"){let o=Mt(t,"content","fileText","text");if(n&&o===void 0)throw Error("Cursor Write hook payload missing content");return{...t,file_path:r??"",content:o??""}}if(e==="Edit"){let o=Mt(t,"old_string","oldString"),s=Mt(t,"new_string","newString");if(n&&(o===void 0||s===void 0))throw Error("Cursor Edit hook payload missing oldString or newString");return{...t,file_path:r??"",old_string:o??"",new_string:s??""}}return t},uI=(e,t,n=!0)=>{if(e==="Bash")return bee(t,n);if(!Eee(e))return t;if(!tc(t)){if(n)throw Error(`Cursor ${e} hook payload is missing tool input`);return t}return wee(e,t,n)},ML=(e,t)=>{if(typeof t!=="string")return t;if(e==="Bash")return{stdout:t,stderr:""};if(e==="Read")return{content:t};return{content:t}},vee=(e,t)=>{if(e==="beforeShellExecution"||e==="afterShellExecution")return"Bash";if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit")return e.startsWith("before")?"Read":"Edit";let n=Mt(t,"tool_name","toolName");if(n!==void 0)return See(n);let r=pI(t,"tool_input","toolInput");if(Mt(t,"command","cmd")!==void 0||typeof r==="string"||tc(r)&&Mt(r,"command","cmd")!==void 0)return"Bash";if(Mt(t,"file_path","filePath","path")!==void 0||tc(r)&&Mt(r,"file_path","filePath","path")!==void 0)return"Read";return""},kee=(e,t)=>{if(e==="Bash")return{command:lI(t,void 0,"command","cmd")};let n={file_path:Mt(t,"file_path","filePath","path")};if(e==="Write")n.content=Mt(t,"content","fileText","text");if(e==="Edit")n.old_string=Mt(t,"old_string","oldString"),n.new_string=Mt(t,"new_string","newString");return n},Iee=(e,t,n,r)=>{let o=pI(n,"tool_input","toolInput"),s=!r;if(e==="beforeShellExecution"||e==="afterShellExecution"){let i=lI(n,o,"command","cmd");return{command:s?FL(i,"command"):i??""}}if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit"){let i=lI(n,o,"file_path","filePath","path");return uI(t,{file_path:s?FL(i,"file path"):i??"",...Array.isArray(n.edits)&&{edits:n.edits}},s)}if(o===void 0&&["Bash","Read","Write","Edit"].includes(t))return uI(t,kee(t,n),s);return uI(t,o,s)},Cee=(e,t,n)=>{if(e==="afterShellExecution")return ML(t,Mt(n,"output")??"");let r=pI(n,"tool_response","toolResponse","tool_output","toolOutput","result","result_json");return ML(t,r)},NL=(e,t,n)=>{let r=vee(t,e),o=Iee(t,r,e,n),s=n?Cee(t,r,e):void 0,i=Mt(e,"cwd"),a=Mt(e,"conversation_id","session_id"),c=Mt(e,"tool_use_id");return{event:{hook_event_name:n?"PostToolUse":"PreToolUse",...r.length>0&&{tool_name:r},...o!==void 0&&{tool_input:o},...s!==void 0&&{tool_response:s},...i!==void 0&&{cwd:i},...a!==void 0&&{session_id:a},...c!==void 0&&{tool_use_id:c}},host:dI(t)}},$L=(e,t)=>{if(t!==void 0&&!yee(t))throw Error(`Unknown Cursor hook event "${t}"`);if(!tc(e)){if(t!==void 0)throw Error(`Cursor ${t} hook payload must be a JSON object`);return{event:e,host:{kind:"native"}}}let n=t??Mt(e,"hook_event_name");if(n!==void 0&&DL.has(n))return NL(e,n,!1);if(n!==void 0&&fI.has(n))return NL(e,n,!0);return{event:e,host:{kind:"native"}}};var UL=w(()=>{DL=new Set(["preToolUse","beforeShellExecution","beforeMCPExecution","beforeReadFile","beforeTabFileRead"]),fI=new Set(["postToolUse","postToolUseFailure","afterShellExecution","afterMCPExecution","afterFileEdit","afterTabFileEdit"])});var LL,Z=(e)=>({kind:"allow",rule:e,message:""}),Bi=(e,t)=>({kind:"warn",rule:e,message:t}),zt=(e,t)=>({kind:"ask",rule:e,message:t}),se=(e,t)=>({kind:"deny",rule:e,message:t}),nl=(e)=>{let t=Z("none");for(let n of e)if(LL[n.kind]>LL[t.kind])t=n;return t};var Xn=w(()=>{LL={allow:0,warn:1,ask:2,deny:3}});var mI,rl=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),jL=(e)=>rl(e)&&typeof e.command==="string",BL=(e)=>rl(e)&&typeof e.file_path==="string"&&typeof e.old_string==="string"&&typeof e.new_string==="string",HL=(e)=>rl(e)&&typeof e.file_path==="string"&&typeof e.content==="string",qL=(e)=>rl(e)&&typeof e.file_path==="string",zL=(e,t)=>{if(!rl(t))return"";if(e==="Bash"){let n=typeof t.stdout==="string"?t.stdout:"",r=typeof t.stderr==="string"?t.stderr:"";return[n,r].filter((o)=>o.length>0).join(`
48
+ `)}if(e==="Read"){if(typeof t.content==="string")return t.content;let{file:n}=t;return rl(n)&&typeof n.content==="string"?n.content:""}return typeof t.content==="string"?t.content:""};var hI=w(()=>{el();mI=P.Struct({hook_event_name:P.String,tool_name:P.optional(P.String),tool_input:P.optional(P.Unknown),tool_response:P.optional(P.Unknown),cwd:P.optional(P.String),session_id:P.optional(P.String),turn_id:P.optional(P.String),tool_use_id:P.optional(P.String)})});import{appendFileSync as Tee,mkdirSync as Oee}from"fs";import{homedir as Aee}from"os";import _ee from"path";var WL,jo=(e,t)=>{let n=new Date().toISOString(),r=t instanceof Error?t.stack??t.message:String(t);try{Tee(WL,`[${n}] [${e}] ${r}
49
+ `)}catch{}};var KL=w(()=>{WL=`${Aee()}/.claude/tripwire.log`;try{Oee(_ee.dirname(WL),{recursive:!0})}catch{}});var Ree=(e)=>e.tokens.slice(1).join(" "),VL=(e,...t)=>{let n=new Set(e.flags);return t.some((r)=>n.has(r))},Pee,Fee,GL=(e,t)=>{let n=wn(t),r=[];for(let o of e)for(let s of Pee){if(!s.match(o,t))continue;if(n&&!Fee.has(s.rule))continue;r.push(s.action==="deny"?se(s.rule,s.message):zt(s.rule,s.message));break}return r.length===0?Z("bash-deny"):nl(r)};var JL=w(()=>{Lo();Xn();Pee=[{rule:"unsupported-shell-structure",action:"deny",message:"Tripwire cannot inspect every executable branch in this shell structure. Rewrite it as simple commands joined with `;`, `&&`, or `||` so each command can be checked.",match:(e)=>e.head===fx},{rule:"rm-rf-root",action:"deny",message:"rm -rf / is catastrophic. If the goal is cleaning a subdirectory, scope the path inside the project (e.g. ./dist).",match:(e)=>e.head==="rm"&&VL(e,"-rf","-fr","-Rf","-fR")&&e.tokens.includes("/")},{rule:"rm-rf-home",action:"deny",message:"rm -rf on $HOME / ~ would erase the home directory. Refuse.",match:(e)=>e.head==="rm"&&VL(e,"-rf","-fr","-Rf","-fR")&&e.tokens.some((t)=>/^(?<home>~|\$HOME|\$\{HOME\})$/.test(t))},{rule:"fork-bomb",action:"deny",message:"Fork bomb pattern detected. Refuse.",match:(e,t)=>/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/.test(t)},{rule:"source-script",action:"deny",message:"`source` / `.` executes a file in the current shell. Refuse arbitrary sourced scripts.",match:(e)=>(e.head==="source"||e.head===".")&&e.tokens.length>1},{rule:"dd-raw-device",action:"deny",message:"dd writing to a raw block device wipes the disk. Refuse.",match:(e)=>e.head==="dd"&&/\bof=\/dev\/(?<type>disk|sd|nvme|rdisk)/i.test(Ree(e))},{rule:"mkfs",action:"deny",message:"mkfs formats a filesystem. Refuse.",match:(e)=>/^mkfs(?<ext>\.[a-z0-9]+)?$/i.test(e.head)},{rule:"kill-all",action:"deny",message:"kill -9 -1 kills every process you own. Refuse.",match:(e)=>e.head==="kill"&&e.tokens.includes("-9")&&e.tokens.includes("-1")},{rule:"chmod-777-recursive",action:"deny",message:"Recursive chmod 777 makes everything world-writable. Use 755 for directories, 644 for files, scoped narrowly.",match:(e)=>e.head==="chmod"&&e.flags.some((t)=>t.includes("R"))&&e.tokens.includes("777")},{rule:"no-verify",action:"deny",message:"--no-verify skips git hooks. Per policy: never skip hooks. Fix the underlying issue.",match:(e)=>e.tokens.includes("--no-verify")},{rule:"no-gpg-sign",action:"deny",message:"Bypassing GPG signing is off-limits unless explicitly requested.",match:(e,t)=>/--no-gpg-sign\b|-c\s+commit\.gpgsign=false/.test(t)},{rule:"sudo",action:"ask",message:"sudo escalates privileges and is almost never needed in a coding session. If genuinely required, explain why; otherwise find a non-sudo path.",match:(e)=>e.head==="sudo"},{rule:"shutdown",action:"deny",message:"shutdown / reboot / halt control the machine. Refuse \u2014 system control should be done manually.",match:(e)=>["shutdown","reboot","halt","poweroff"].includes(e.head)},{rule:"launchctl-mutation",action:"deny",message:"launchctl load/unload/bootstrap/bootout/kickstart mutates system services. Refuse \u2014 surface the intent instead.",match:(e)=>e.head==="launchctl"&&typeof e.tokens[1]==="string"&&["load","unload","bootstrap","bootout","kickstart","enable","disable"].includes(e.tokens[1])},{rule:"defaults-write",action:"deny",message:"`defaults write` mutates macOS preferences. Refuse \u2014 surface the intent.",match:(e)=>e.head==="defaults"&&e.tokens[1]==="write"},{rule:"csrutil",action:"deny",message:"csrutil controls System Integrity Protection. Refuse.",match:(e)=>e.head==="csrutil"},{rule:"nvram",action:"deny",message:"nvram modifies firmware variables. Refuse.",match:(e)=>e.head==="nvram"},{rule:"diskutil-destructive",action:"deny",message:"diskutil eraseDisk / reformat / partitionDisk wipes disks. Refuse.",match:(e)=>e.head==="diskutil"&&typeof e.tokens[1]==="string"&&["eraseDisk","reformat","partitionDisk","eraseVolume","secureErase"].includes(e.tokens[1])},{rule:"tmutil-destructive",action:"deny",message:"tmutil delete / disablelocal touches Time Machine. Refuse.",match:(e)=>e.head==="tmutil"&&typeof e.tokens[1]==="string"&&["delete","disablelocal"].includes(e.tokens[1])},{rule:"osascript",action:"ask",message:"osascript runs arbitrary AppleScript and can do almost anything (move files, send emails, drive apps). Confirm with the user what you want done before running it.",match:(e)=>e.head==="osascript"},{rule:"topgrade",action:"deny",message:"topgrade upgrades everything (brew, mas, npm globals, rust, mise). System upgrades should be done manually.",match:(e)=>e.head==="topgrade"},{rule:"rsync-delete",action:"deny",message:"rsync --delete removes files at the destination. High blast radius \u2014 surface the intent instead.",match:(e)=>e.head==="rsync"&&e.flags.includes("--delete")},{rule:"softwareupdate-install",action:"deny",message:"`softwareupdate --install / -i / -d` triggers macOS system updates. Refuse \u2014 system updates should be done manually.",match:(e)=>e.head==="softwareupdate"&&e.flags.some((t)=>t==="--install"||t==="-i"||t==="-d"||t.startsWith("--download"))},{rule:"pmset-write",action:"deny",message:"`pmset` (with arguments) writes power-management settings. Read-only `pmset -g` is fine; mutations need the user.",match:(e)=>e.head==="pmset"&&e.tokens.length>1&&!e.tokens.includes("-g")&&!e.tokens.includes("-G")},{rule:"dscl-mutate",action:"deny",message:"`dscl . -create / -delete / -append / -change / -merge` modifies the local directory service (your user account, groups, etc.). Refuse.",match:(e)=>e.head==="dscl"&&e.tokens.some((t)=>["-create","-delete","-append","-change","-merge","-passwd"].includes(t))},{rule:"xattr-quarantine-bypass",action:"deny",message:"`xattr -d com.apple.quarantine` removes Gatekeeper's quarantine bit \u2014 the macOS protection against running untrusted binaries. Refuse.",match:(e)=>e.head==="xattr"&&e.tokens.includes("-d")&&e.tokens.some((t)=>t.includes("com.apple.quarantine"))},{rule:"spctl-disable",action:"deny",message:"`spctl --master-disable` / `--global-disable` disables Gatekeeper system-wide. Refuse.",match:(e)=>e.head==="spctl"&&e.flags.some((t)=>t==="--master-disable"||t==="--global-disable"||t==="--disable")},{rule:"kextload",action:"deny",message:"Loading a kernel extension (`kextload`, `kmutil load`) is a system-level mutation. Refuse \u2014 the user handles this manually.",match:(e)=>e.head==="kextload"||e.head==="kextunload"||e.head==="kmutil"&&(e.tokens[1]==="load"||e.tokens[1]==="unload")},{rule:"security-keychain-destructive",action:"deny",message:"`security delete-keychain / delete-generic-password / delete-internet-password / set-keychain-settings` mutates your Keychain (where CLIs store their secrets). Refuse \u2014 Keychain should be managed manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["delete-keychain","delete-generic-password","delete-internet-password","delete-certificate","delete-identity","set-keychain-settings","unlock-keychain","lock-keychain","create-keychain"].includes(e.tokens[1])},{rule:"security-keychain-add-write",action:"ask",message:"`security add-generic-password / add-internet-password / add-certificate` writes to your Keychain. Other tools manage their own entries \u2014 confirm this is the right path before adding anything else manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["add-generic-password","add-internet-password","add-certificate"].includes(e.tokens[1])},{rule:"systemsetup",action:"deny",message:"`systemsetup -set...` writes machine-wide settings (timezone, sleep, network time, restart-on-power-failure). Refuse.",match:(e)=>e.head==="systemsetup"&&e.tokens.some((t)=>t.startsWith("-set"))},{rule:"scutil-set",action:"deny",message:"`scutil --set` writes system configuration (computer name, hostname, LocalHostName). Refuse \u2014 read-only `scutil --get` is fine.",match:(e)=>e.head==="scutil"&&e.tokens.includes("--set")},{rule:"brew-mutation",action:"ask",message:"`brew install/uninstall/upgrade/untap` modifies the machine globally. Confirm before running.",match:(e)=>e.head==="brew"&&typeof e.tokens[1]==="string"&&["install","uninstall","upgrade","reinstall","untap","tap"].includes(e.tokens[1])},{rule:"mas-mutation",action:"ask",message:"`mas install/uninstall` changes installed Mac App Store apps. Confirm.",match:(e)=>e.head==="mas"&&typeof e.tokens[1]==="string"&&["install","uninstall","purchase"].includes(e.tokens[1])},{rule:"gh-destructive",action:"deny",message:"gh repo/release/issue delete is destructive on shared state. Refuse.",match:(e)=>e.head==="gh"&&typeof e.tokens[1]==="string"&&typeof e.tokens[2]==="string"&&["repo","release","issue","pr"].includes(e.tokens[1])&&["delete","destroy","remove"].includes(e.tokens[2])},{rule:"flyctl-destroy",action:"deny",message:"flyctl apps destroy / volumes destroy nukes deployed infra. Refuse.",match:(e)=>e.head==="flyctl"&&e.tokens.some((t)=>t==="destroy"||t==="delete")},{rule:"gcloud-delete",action:"deny",message:"`gcloud ... delete` affects cloud resources. Refuse.",match:(e)=>e.head==="gcloud"&&e.tokens.includes("delete")}],Fee=new Set(["unsupported-shell-structure","rm-rf-root","rm-rf-home","fork-bomb","dd-raw-device","mkfs","kill-all","diskutil-destructive","tmutil-destructive","shutdown","csrutil","nvram","kextload","spctl-disable","xattr-quarantine-bypass","topgrade","softwareupdate-install","systemsetup","scutil-set","security-keychain-destructive","no-verify","no-gpg-sign"])});var gI=(e)=>e.protectedBranches??[],Mee,Nee,Dee,$ee=(e)=>{if(e.head!=="git")return null;let t=e.tokens.slice(1),n=0;while(n<t.length){let r=t[n];if(r===void 0)break;if(Nee.has(r)){n+=2;continue}if(Dee.has(r)){n+=1;continue}if(r.startsWith("--git-dir=")||r.startsWith("--work-tree=")||r.startsWith("--namespace=")||r.startsWith("--super-prefix=")||r.startsWith("--exec-path=")){n+=1;continue}if(r.startsWith("-")){n+=1;continue}return{subcommand:r,subArgs:t.slice(n+1)}}return null},Uee=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)break;if(r==="-m"||r==="--message"){let o=e[n+1];return o===void 0?null:dx(o,t)}if(r.startsWith("--message="))return dx(r.slice(10),t);if(/^-[a-zA-Z]*m[a-zA-Z]*$/.test(r)){let o=e[n+1];return o===void 0?null:dx(o,t)}}return null},Lee=(e,t)=>{let n=gI(t);for(let r of e)for(let o of n)if(r===o||r.endsWith(`:${o}`)||r.endsWith(`/${o}`))return o;return null},jee=(e)=>e.filter((t)=>!t.startsWith("-")),Bee=(e)=>e.filter((t)=>t.startsWith("-")),kt=(e,...t)=>{let n=new Set(e);return t.some((r)=>n.has(r))},Hee=({subArgs:e,positional:t})=>{if(kt(e,"--global","--system"))return se("git-config-global","Modifying global / system git config is off-limits \u2014 that is your personal identity. Read-only `git config --get` is fine.");if(!kt(e,"--get","-l","--list","--get-all","--get-regexp")&&t.length>=2)return se("git-config-write","Local git config writes should be done explicitly. To read a value, use `git config --get <key>`.");return Z("bash-git")},qee=({subArgs:e})=>{if(kt(e,"--cached"))return Z("bash-git");return zt("git-rm","`git rm <path>` removes from the index AND the working tree. To untrack-only, use `git rm --cached <path>`. To delete the file separately, use `trash` / `rip`. Confirm intent.")},zee=({subArgs:e,positional:t})=>{if(kt(e,"--staged","-S")&&!kt(e,"--worktree","-W"))return Z("bash-git");if(t.length>0)return se("git-restore-discard","`git restore <path>` discards uncommitted changes in the working tree. Refuse \u2014 `git diff <path>` to inspect first, or `git stash push <path>` to preserve.");return Z("bash-git")},Wee=({subArgs:e,positional:t})=>{if(kt(e,"-b","-B"))return Z("bash-git");if(kt(e,"-f","--force"))return se("git-checkout-force","`git checkout -f` overwrites the working tree without preserving uncommitted changes. Refuse.");if(e.includes("--"))return se("git-checkout-discard","`git checkout -- <path>` discards uncommitted working-tree changes. Refuse \u2014 use `git stash push <path>` to preserve, or `git diff <path>` to inspect first.");let[n]=t;if(n!==void 0&&t.length===1&&(n==="."||n.startsWith("./")))return se("git-checkout-discard-all","`git checkout .` discards ALL uncommitted working-tree changes. Refuse \u2014 `git stash` to preserve, or `git diff` to inspect first.");return Z("bash-git")},Kee=({subArgs:e})=>{if(kt(e,"-f","--force","--discard-changes"))return se("git-switch-force","`git switch -f / --discard-changes` throws away uncommitted working-tree changes. Refuse.");return Z("bash-git")},Vee=({subArgs:e,flags:t,positional:n})=>{if(kt(e,"--hard"))return se("git-reset-hard","`git reset --hard` discards all uncommitted changes AND moves HEAD. Refuse \u2014 describe the intent in chat. If undoing a published commit, `git revert <sha>` is safer.");if(kt(e,"--keep"))return zt("git-reset-keep","`git reset --keep` resets HEAD but preserves uncommitted local changes. Confirm intent.");if(n.length===0&&t.length===0)return Z("bash-git");return zt("git-reset-mixed","`git reset` moves HEAD. Confirm intent \u2014 if undoing a commit, `git revert` is usually safer.")},Gee=({flags:e})=>{if(e.some((t)=>/^-[a-zA-Z]*[df]/.test(t)||t==="--force"))return se("git-clean-fd","`git clean -fd` deletes untracked files (often your in-progress work). Refuse \u2014 inspect with `git clean -dn` (dry run) first. If genuinely needed, append ` # tripwire-allow: <reason>`.");return Z("bash-git")},Jee=({subArgs:e,positional:t,config:n})=>{if(kt(e,"--abort","--quit","--continue","--skip","--edit-todo"))return Z("bash-git");if(kt(e,"-i","--interactive"))return se("git-rebase-interactive","`git rebase -i` rewrites history interactively. Refuse \u2014 too easy to lose commits in the agent loop. If this is genuinely required, do it manually outside the agent.");let[r]=t,o=gI(n);if(r!==void 0&&o.includes(r))return zt("git-rebase-onto-protected",`Rebasing onto \`${r}\` rewrites history of the current branch. \`git merge ${r}\` is usually safer. Confirm intent.`);return zt("git-rebase","`git rebase` rewrites commit history. `git merge` is usually safer. Confirm intent.")},Zee=({subArgs:e})=>{if(kt(e,"--abort","--quit","--continue","--skip"))return Z("bash-git");return zt("git-cherry-pick","`git cherry-pick` applies commits onto the current branch and can create conflicts. Confirm intent.")},Yee=({subArgs:e})=>{if(kt(e,"--abort","--continue","--quit"))return Z("bash-git");return zt("git-merge","`git merge <branch>` may create merge conflicts. Confirm intent.")},Qee=({subArgs:e,config:t,heredocBodies:n})=>{if(kt(e,"--amend"))return se("git-commit-amend","`git commit --amend` rewrites the last commit. If it has been pushed, this causes upstream divergence. Refuse \u2014 surface the intent.");let r=Uee(e,n),o=kt(e,"-F","--file","-c","-C","--reuse-message","--reedit-message"),s=kt(e,"--no-edit");if(r===null&&!o&&!s)return se("git-commit-no-message",'`git commit` without `-m "..."` opens an editor and hangs the agent. Use `git commit -m "<conventional message>"`.');if(r!==null&&t.enforceConventionalCommits===!0&&!Mee.test(r))return se("git-commit-non-conventional",["Commit message must follow Conventional Commits format:"," `<type>(<scope>)?(!)?: <description>`","Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.","Examples:"," `fix(auth): handle expired token refresh`"," `feat: add bash-git rule`"," `chore: bump deps`",`Got: ${JSON.stringify(r)}`].join(`
50
+ `));if(kt(e,"-a","--all")||e.some((i)=>/^-[a-zA-Z]*a[a-zA-Z]*$/.test(i)))return zt("git-commit-auto-stage","`git commit -a / --all` auto-stages every tracked change. Explicit `git add <files>` first is usually clearer about what is being committed. Confirm.");return Z("bash-git")},Xee=({subArgs:e,flags:t,positional:n,config:r})=>{if(t.some((s)=>s==="--force"||s==="-f"||s.startsWith("--force-with-lease")))return se("git-force-push","Force push is forbidden. If a branch needs to be reset upstream, surface the intent \u2014 there is almost always a non-force path.");if(kt(e,"--delete","--mirror")||e.some((s)=>s.startsWith(":")))return se("git-push-delete","Refusing to delete a remote branch via push. If genuinely needed, surface the intent.");let o=Lee(n,r);if(o!==null)return se("git-push-protected",`Refusing to push directly to protected branch \`${o}\`. Open a PR instead: \`gh pr create\`.`);return Z("bash-git")},ete=({subArgs:e,flags:t,positional:n,config:r})=>{let o=t.find((s)=>s==="-D"||s==="-d"||s==="--delete"||/^-[a-zA-Z]*D/.test(s)||/^-[a-zA-Z]*d/.test(s));if(o!==void 0){let s=n,i=new Set(gI(r)),a=s.find((c)=>i.has(c));if(a!==void 0)return se("git-branch-delete-protected",`Refusing to delete protected branch \`${a}\`.`);if(o==="-D"||o.includes("D"))return se("git-branch-force-delete",`\`git branch -D ${s.join(" ")}\` force-deletes branches even if unmerged (potential data loss). To delete a merged branch, use \`-d\`. To force, append \` # tripwire-allow: <reason>\`.`);return zt("git-branch-delete",`\`git branch -d ${s.join(" ")}\` deletes a branch (merged-only check). Confirm intent.`)}if(kt(e,"-m","-M","--move"))return zt("git-branch-move","Renaming a branch can confuse pushed remotes. Confirm intent.");return Z("bash-git")},tte=({subArgs:e})=>{if(kt(e,"-d","--delete"))return se("git-tag-delete","`git tag -d` deletes a tag. Refuse \u2014 surface intent.");return Z("bash-git")},nte=({subArgs:e})=>{let t=e[0]??"push";if(t==="drop"||t==="clear")return se("git-stash-drop",`\`git stash ${t}\` discards stashed work. Refuse \u2014 \`git stash list\` and \`git stash show\` to inspect first.`);return Z("bash-git")},rte=({flags:e})=>{if(e.some((t)=>t.startsWith("--prune=")||t==="--aggressive"))return se("git-gc-prune","`git gc --prune=now` / `--aggressive` destroys reflog recovery options. Refuse.");return Z("bash-git")},ote=({subArgs:e})=>{let[t]=e;if(t==="add"||t==="remove"||t==="rm"||t==="set-url"||t==="rename")return zt("git-remote-mutate",`\`git remote ${t}\` changes which remote you're pushing to. Confirm \u2014 accidentally pointing at the wrong remote is high blast-radius.`);return Z("bash-git")},ZL=({subcommand:e,subArgs:t})=>{let n=t[0]??"";if(["add","remove","rm","deinit","sync","set-url"].includes(n))return zt("git-submodule-worktree-mutate",`\`git ${e} ${n}\` modifies repo structure. Confirm intent.`);return Z("bash-git")},ste,ite=(e,t,n)=>{let{subcommand:r,subArgs:o}=e,s=Bee(o),i=jee(o);if(new Set(["status","diff","log","show","blame","rev-parse","rev-list","ls-files","ls-tree","cat-file","reflog","describe","shortlog","whatchanged","archive","bundle","fsck","fetch","ls-remote","help","version","grep","name-rev","merge-base","symbolic-ref","check-ignore","count-objects","verify-commit","verify-tag"]).has(r)){if(r==="reflog"&&(o[0]==="expire"||kt(o,"--expire")))return se("git-reflog-expire","`git reflog expire` destroys git's recovery history. Refuse \u2014 surface the intent.");if(r==="symbolic-ref"&&i.length>=2)return se("git-symbolic-ref-write","`git symbolic-ref <name> <ref>` rewrites a symbolic ref. Refuse.");return Z("bash-git")}let c=ste.get(r);if(c!==void 0)return c({subcommand:r,subArgs:o,flags:s,positional:i,config:t,heredocBodies:n});return Bi("git-unknown-subcommand",`\`git ${r}\` is not classified by tripwire. Allowing \u2014 flag if this looks like history-rewriting or data-loss territory.`)},YL=(e,t,n)=>{if(wn(t))return Z("bash-git");let r=wL(t);for(let o of e){let s=$ee(o);if(s===null)continue;let i=ite(s,n,r);if(i!==null&&i.kind!=="allow")return i}return Z("bash-git")};var QL=w(()=>{Lo();Xn();Mee=/^(?<type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?<scope>\([\w./\- ]+\))?!?:\s+\S/,Nee=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--super-prefix"]),Dee=new Set(["--bare","--paginate","-p","--no-pager","--no-replace-objects","--literal-pathspecs","--glob-pathspecs","--noglob-pathspecs","--icase-pathspecs","--no-optional-locks","--exec-path","--html-path","--man-path","--info-path"]),ste=new Map([["config",Hee],["add",()=>Z("bash-git")],["mv",()=>Z("bash-git")],["rm",qee],["restore",zee],["checkout",Wee],["switch",Kee],["reset",Vee],["clean",Gee],["rebase",Jee],["cherry-pick",Zee],["merge",Yee],["commit",Qee],["push",Xee],["branch",ete],["tag",tte],["stash",nte],["filter-branch",({subcommand:e})=>se("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["filter-repo",({subcommand:e})=>se("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["gc",rte],["update-ref",()=>se("git-update-ref","`git update-ref` directly mutates refs and bypasses normal git operations. Refuse.")],["remote",ote],["submodule",ZL],["worktree",ZL],["init",({subcommand:e})=>Bi(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)],["clone",({subcommand:e})=>Bi(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)]])});var ate,cte,ute=(e)=>{for(let t=0;t<e.length-1;t+=1){let n=e[t],r=e[t+1];if(n===void 0||r===void 0)continue;if(ate.has(n.head)&&cte.has(r.head))return!0}return!1},lte,XL=(e,t)=>{if(wn(t))return Z("bash-network-install");if(ute(e))return se("curl-pipe-shell","Piping `curl` / `wget` directly into a shell runs whatever the remote URL serves. Refuse \u2014 download to a file, inspect, then run if appropriate. If you genuinely need this, append ` # tripwire-allow: <reason>` (and explain to the user what you're running).");for(let n of e)for(let r of lte)if(n.head===r.head&&n.tokens[1]===r.subcommand)return zt(r.rule,r.message);return Z("bash-network-install")};var ej=w(()=>{Lo();Xn();ate=new Set(["curl","wget","wget2","aria2c","xh"]),cte=new Set(["bash","sh","zsh","fish"]),lte=[{head:"cargo",subcommand:"install",rule:"cargo-install",message:"Confirm before `cargo install <crate>`: this builds and installs arbitrary code from crates.io into ~/.cargo/bin globally."},{head:"go",subcommand:"install",rule:"go-install",message:"Confirm before `go install`: this fetches and installs arbitrary Go code globally."},{head:"gem",subcommand:"install",rule:"gem-install",message:"Confirm before `gem install`: pulls arbitrary code from rubygems.org."}]});import{lstatSync as fte,readlinkSync as dte,realpathSync as pte}from"fs";import ol from"path";var mte,tj=(e)=>{try{return pte(e)}catch{return null}},xI=(e,t=new Set)=>{if(t.has(e))return e;t.add(e);let n=tj(e);if(n!==null)return n;try{if(fte(e).isSymbolicLink()){let o=dte(e);return xI(ol.resolve(ol.dirname(e),o),t)}}catch{}let r=ol.dirname(e);if(r===e)return e;return ol.join(xI(r,t),ol.basename(e))},rp=(e,t,n)=>{let r=ol.resolve(e),o=t==="write"?xI(r):tj(r),s=[e,r];if(o!==null&&!s.includes(o))s.push(o);for(let i of s)for(let a of n)if(a.pattern.test(i))return a;return null},yI=(e)=>{let t=rp(e.file_path,"write",mte);if(t!==null)return se(t.rule,t.message);return Z("path-protect")};var mx=w(()=>{Xn();mte=[{pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,rule:"env-file",message:".env files hold secrets that should never be sent to the model. Refuse to write or edit. If an example is needed, create .env.example with redacted placeholders."},{pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,rule:"dev-vars",message:".dev.vars holds Cloudflare/Wrangler secrets. Do not modify."},{pattern:/(?<prefix>^|\/)\.ssh\//,rule:"ssh-dir",message:"Never write into ~/.ssh/. Refuse."},{pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)(?<pub>\.pub)?$/,rule:"ssh-key",message:"SSH key file. Refuse."},{pattern:/\.(?<ext>pem|key|p12|pfx)$/i,rule:"private-key",message:"Private key file. Refuse to overwrite. If generating a new key, use a different filename and let the user review."},{pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/i,rule:"secrets-file",message:"Secrets file. Refuse."},{pattern:/(?<prefix>^|\/)\.aws\/credentials$/,rule:"aws-credentials",message:"AWS credentials file. Refuse."},{pattern:/(?<prefix>^|\/)\.netrc$/,rule:"netrc",message:".netrc holds host credentials. Refuse."}]});var hte,SI=(e)=>{let t=rp(e,"write",hte);if(t!==null)return se(t.rule,t.message);return null},nj=(e,t)=>{if(wn(t))return Z("bash-redirect");for(let n of e){for(let r of n.redirects)if(r.op===">"||r.op===">>"){let o=SI(r.target);if(o!==null)return o}if(n.head==="tee")for(let r of n.args){let o=SI(r);if(o!==null)return o}if(n.head==="cp"||n.head==="mv"){let r=n.args.at(-1);if(r!==void 0){let o=SI(r);if(o!==null)return o}}}return Z("bash-redirect")};var rj=w(()=>{Lo();Xn();mx();hte=[{rule:"redirect-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,message:"Refusing to write into a .env file via shell redirect / tee / cp / mv. .env files hold secrets \u2014 never overwrite from a tool call."},{rule:"redirect-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,message:"Refusing to write into .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"redirect-ssh",pattern:/(?<prefix>^|\/)\.ssh\//,message:"Refusing to write into ~/.ssh/ via shell."},{rule:"redirect-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/i,message:"Refusing to overwrite a private-key-shaped file via shell."},{rule:"redirect-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/,message:"Refusing to write into ~/.aws/credentials via shell."},{rule:"redirect-netrc",pattern:/(?<prefix>^|\/)\.netrc$/,message:"Refusing to write into ~/.netrc via shell."},{rule:"redirect-block-device",pattern:/^\/dev\/(?<type>sd|disk|nvme|rdisk)/i,message:"Redirecting into a raw block device wipes the disk. Refuse."}]});var gte=(e,t)=>{let n=!1,r=[];for(let i of e.tokens.slice(1)){if(!n&&i==="--"){n=!0;continue}if(!n&&i.startsWith("-")&&i!=="-")continue;r.push(i)}let o=t.relative??[],s=t.absolute??[];return r.filter((i)=>!iI(i,o,s))},xte=(e,t)=>{if(!e.tokens.includes("-delete"))return null;let n=[];for(let i of e.tokens.slice(1)){if(i.startsWith("-"))break;n.push(i)}let r=n.length===0?["."]:n,o=t.relative??[],s=t.absolute??[];return r.filter((i)=>!iI(i,o,s))},oj=(e,t,n)=>{if(wn(t))return Z("bash-scoped-rm");let r=[];for(let a of e){if(a.head==="rm"){let c=gte(a,n);if(c.length>0)r.push({kind:"rm",targets:c});continue}if(a.head==="find"){let c=xte(a,n);if(c!==null&&c.length>0)r.push({kind:"find -delete",targets:c})}}if(r.length===0)return Z("bash-scoped-rm");let o=n.relative??[],s=n.absolute??[],i=r.map((a)=>` \u2022 ${a.kind} on: ${a.targets.map((c)=>JSON.stringify(c)).join(", ")}`).join(`
51
+ `);return se("destructive-outside-safe-paths",`Destructive deletion outside known-safe scopes is blocked. Use a recoverable deletion tool or limit the target to an ephemeral build, cache, state, or temporary directory:
52
+ ${TL(o,s)}
53
+
54
+ Flagged targets:
55
+ ${i}
56
+
57
+ If raw deletion is genuinely needed, append \` # tripwire-allow: <reason>\` to the command.`)};var sj=w(()=>{Lo();Xn()});var yte=(e)=>e==="--extract"||e.startsWith("-")&&!e.startsWith("--")&&e.slice(1).includes("x"),Ste=(e)=>{for(let t=0;t<e.tokens.length;t+=1){let n=e.tokens[t];if(n===void 0)continue;if(n==="-C"||n==="--directory")return e.tokens[t+1]??null;if(n.startsWith("--directory="))return n.slice(12)}return null},ij=(e)=>e==="/"||/^(?<home>~|\$HOME|\$\{HOME\})$/.test(e),aj=(e,t)=>{if(wn(t))return Z("bash-tar-explosion");for(let n of e){if(n.head!=="tar")continue;let[,r]=n.tokens;if(!(n.flags.some(yte)||n.tokens.includes("--extract")||r!==void 0&&/^[a-zA-Z]+$/.test(r)&&r.includes("x")))continue;let s=Ste(n);if(s!==null&&ij(s))return se("tar-extract-to-root",`tar -x with -C ${s} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory (e.g. ./tmp/extract) and inspect before moving anything elsewhere.`)}for(let n of e){if(n.head!=="unzip")continue;for(let r=0;r<n.tokens.length;r+=1)if(n.tokens[r]==="-d"){let o=n.tokens[r+1];if(o!==void 0&&ij(o))return se("unzip-to-root",`unzip -d ${o} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory.`)}}return Z("bash-tar-explosion")};var cj=w(()=>{Lo();Xn()});var Ete="If this is intentional, append ` # tripwire-allow: <reason>` to the command.",bte,uj=(e)=>bte.get(e)??e,lj=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},wte=(e,t)=>e.some((n)=>n===t||n.startsWith(`${t}=`)),vte=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;if(r===t)return e[n+1]??"";if(r.startsWith(`${t}=`))return r.slice(t.length+1)}return null},kte=(e)=>{let t=[],n=e.tokens.slice(1);for(let r=0;r<n.length;r+=1){let o=n[r];if(o===void 0)continue;if(o.startsWith("-")){let s=n[r+1];if(!o.includes("=")&&s!==void 0&&!s.startsWith("-"))r+=1;continue}t.push(o)}return t},fj=(e,t)=>{let{pattern:n}=t,r=tl(n);if(r.length===0)return!1;let[o]=r;if(o===void 0)return!1;let[s,...i]=o.tokens;if(s===void 0)return!1;for(let a of e){if(lj(a.head)!==lj(s))continue;if(i.length>0){let l=kte(a);if(!i.every((d,m)=>l[m]!==void 0&&uj(l[m])===uj(d)))continue}if((t.requiresFlags??[]).some((l)=>!wte(a.tokens,l)))continue;if(!(t.forbidsFlagValues??[]).every((l)=>{let f=vte(a.tokens,l.flag);return f!==null&&l.values.includes(f)}))continue;if(i.length===0&&t.requiresFlags===void 0&&t.forbidsFlagValues===void 0)return!0;return!0}return!1},dj=(e,t,n,r)=>{if(wn(t))return Z("config-custom");for(let o of r)if(fj(e,o))return Z("config-custom");for(let o of n)if(fj(e,o)){let s=o.message.includes("tripwire-allow")?o.message:`${o.message} ${Ete}`;return o.action==="ask"?zt("config-custom",s):se("config-custom",s)}return Z("config-custom")};var pj=w(()=>{Lo();Xn();bte=new Map([["add","create"],["new","create"],["edit","update"],["set","update"],["rm","delete"],["del","delete"],["remove","delete"]])});import{readFileSync as Ite}from"fs";var mj=(e,t)=>{let n=new Set(e.split(`
58
+ `).map((r)=>r.trim()).filter((r)=>r.length>0));return t.split(`
59
+ `).filter((r)=>r.trim().length>0).filter((r)=>!n.has(r.trim()))},hj=(e)=>{try{return Ite(e,"utf8")}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return"";throw t}};var gj=()=>{};var Cte,Tte,Ote,Ate,_te=(e)=>{if(Ate.test(e))return!1;for(let t of Cte)if(t.test(e))return!0;return!1},EI=(e)=>{let t=e.file_path;if(!Tte.test(t)||Ote.test(t))return Z("lazy-code");let n="content"in e?e.content:e.new_string,r="content"in e?hj(t):e.old_string,o=[];for(let a of mj(r,n))if(_te(a))o.push(a.slice(0,200));if(o.length===0)return Z("lazy-code");let s=o.slice(0,3).map((a)=>` \u2022 ${a}`).join(`
60
+ `),i=o.length>3?`
61
+ \u2026and ${o.length-3} more`:"";return Bi("lazy-code-marker",["Heads up: line(s) you just added contain words that often signal incomplete or deferred work. The write went through \u2014 this is a flag, not a block.","",'Why this exists: AI coding agents have a strong pull toward stubbing things, deferring "for now," and shipping half-built fallbacks instead of finishing the work in the same turn. The point of this warning is to push back on that pull on every iteration. If you stubbed something out for time, finish it this turn rather than leaving deferred work for later.',"",'If the marker is genuinely permanent \u2014 a real product term ("auth fallback flow", "retry fallback chain", an HTML input placeholder, a public API field literally named "placeholder"), a logging tag, or a comment intentionally left for a human reader \u2014 no action needed. To silence the flag on subsequent edits of that line, append `tripwire-allow: <one-line reason>` (any comment syntax: `//`, `#`, `--`, etc.).',"","Flagged additions:",s+i].join(`
62
+ `))};var xj=w(()=>{Xn();gj();Cte=[/\bTODO\s*:/i,/\bFIXME\s*:/i,/\bXXX\s*:/i,/\bHACK\s*:/i,/\bfor now\b/i,/\bnot implemented\b/i,/\bNotImplementedError\b/,/\btemp fix\b/i,/\bfallback\b/i,/\bplaceholder\b/i,/\bbackwards?[ -]?compat(?<ibility>ibility)?\b/i,/\bfor later\b/i,/\blater on\b/i,/\bget back to\b/i,/\bI'?ll fix\b/i,/\bto be implemented\b/i,/\bnot yet (?<state>implemented|done)\b/i,/\bstubbed\b/i],Tte=/\.(?<ext>ts|tsx|js|jsx|mjs|cjs|py|rs|go|rb|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|zsh|bash|lua|ex|exs|clj|scala|dart)$/i,Ote=/(?<prefix>^|\/)(?<dir>__tests__|tests?|spec|fixtures?|mocks?|__mocks__|stories)(?<suffix>\/|$)|\.(?<ext>test|spec|fixture|mock|stories)\.[^/]+$/i,Ate=/tripwire-allow:[ \t]*\S/});import{spawnSync as Rte}from"child_process";var Pte,Fte,Mte,Nte=({executable:e,args:t,input:n,timeoutMs:r})=>{let o=Rte(e,t,{encoding:"utf8",input:n,maxBuffer:67108864,stdio:["pipe","pipe","ignore"],timeout:r}),s={status:o.status,stdout:typeof o.stdout==="string"?o.stdout:""};return o.error===void 0?s:{...s,error:o.error}},Dte=(e)=>{if(typeof e!=="object"||e===null||!("code"in e))return;return typeof e.code==="string"?e.code:void 0},$te=(e)=>{let t=Dte(e);if(t==="ENOENT")return"missing-executable";if(t==="ETIMEDOUT")return"timeout";return"non-zero-exit"},Ute=(e)=>{let t=new Map;for(let n of e)t.set(n.RuleID,(t.get(n.RuleID)??0)+1);return[...t.entries()].map(([n,r])=>({rule:n,count:r}))},Lte=(e,t)=>{let n=e,r=[...t].toSorted((o,s)=>s.Secret.length-o.Secret.length);for(let o of r){if(o.Secret==="")continue;n=n.replaceAll(o.Secret,`[REDACTED:${o.RuleID}]`)}return n},yj=(e,t,n=Nte)=>{if(e.length===0)return{ok:!0,hits:[],redacted:e};let r;try{r=n({executable:t.executable,args:Mte,input:e,timeoutMs:t.timeoutMs})}catch{return{ok:!1,category:"non-zero-exit"}}if(r.error!==void 0)return{ok:!1,category:$te(r.error)};if(r.status!==0)return{ok:!1,category:"non-zero-exit"};let o;try{o=JSON.parse(r.stdout)}catch{return{ok:!1,category:"malformed-json"}}let s=P.decodeUnknownResult(Fte)(o);if(Vt.isFailure(s))return{ok:!1,category:"malformed-json"};let i=s.success;return{ok:!0,hits:Ute(i),redacted:Lte(e,i)}};var Sj=w(()=>{el();Pte=P.Struct({RuleID:P.String,Description:P.String,StartLine:P.Finite,EndLine:P.Finite,Secret:P.String,Match:P.String}),Fte=P.Array(Pte),Mte=["stdin","--report-format","json","--report-path","-","--exit-code","0","--no-banner","--no-color","--log-level","error"]});var jte=(e)=>`Tripwire could not verify this tool output because the configured secret scanner failed (${e}). The original output was withheld. Install Betterleaks 1.5.0 or later, check secretScanner.executable and secretScanner.timeoutMs, then run the original tool again.`,Ej=(e)=>{let t=zL(e.toolName,e.response);if(t.length===0)return Z("post-secret-scrub");let n=yj(t,e.secretScanner,e.scannerRunner);if(!n.ok)return se("secret-scanner-failed",jte(n.category));if(n.hits.length===0)return Z("post-secret-scrub");let r=n.hits.map((o)=>`${o.rule}\xD7${o.count}`).join(", ");return se("secrets-in-output",[`tripwire intercepted ${n.hits.length} secret pattern(s) in this tool's output (${r}). The original output was withheld so the secret never enters the model context. A redacted form is below \u2014 work from this, do not re-run the same command in a way that re-fetches the underlying secret.`,"","Redacted output:",n.redacted.slice(0,16000)+(n.redacted.length>16000?`
63
+ \u2026[truncated]`:"")].join(`
64
+ `))};var bj=w(()=>{Xn();hI();Sj()});var Bte,wj=(e)=>{let t=rp(e.file_path,"read",Bte);if(t!==null)return se(t.rule,t.message);return Z("read-protect")};var vj=w(()=>{Xn();mx();Bte=[{rule:"read-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,message:".env files hold secrets that should never enter the model context. Refuse to read. If the goal is documenting required env vars, look at .env.example or describe the schema from memory."},{rule:"read-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,message:"Refuse to read .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"read-ssh",pattern:/(?<prefix>^|\/)\.ssh\//,message:"Refuse to read files inside ~/.ssh/."},{rule:"read-ssh-key",pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)$/,message:"Refuse to read SSH private key files."},{rule:"read-private-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/i,message:"Refuse to read private-key-shaped files."},{rule:"read-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/,message:"Refuse to read ~/.aws/credentials."},{rule:"read-netrc",pattern:/(?<prefix>^|\/)\.netrc$/,message:"Refuse to read ~/.netrc (host credentials)."},{rule:"read-secrets-file",pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/i,message:"Refuse to read a file named secrets.{json,yaml,toml,env}."}]});var Hte=(e,t)=>e.some((n)=>n.startsWith("-")&&!n.startsWith("--")&&n.slice(1).includes(t)),qte=(e,t)=>{if(!t.executables.includes(e.head))return!1;let n=e.tokens.slice(1),r=new Set(n);if(!(t.match?.argumentsIncludeAll??[]).every((o)=>r.has(o)))return!1;if(!(t.match?.argumentsStartWith??[]).every((o,s)=>n[s]===o))return!1;return(t.match?.shortFlagsIncludeAll??[]).every((o)=>Hte(e.flags,o))},kj=(e,t,n)=>{if(wn(t))return Z("tool-policy");for(let r of e)for(let o of n)if(qte(r,o))return o.action==="deny"?se(o.rule,o.message):Bi(o.rule,o.message);return Z("tool-policy")};var Ij=w(()=>{Lo();Xn()});var Dj={};Un(Dj,{collectPostToolUseRules:()=>TI,collectPreToolUseRules:()=>CI,decide:()=>Jte,normalizeToolName:()=>op,runHook:()=>nne,runRules:()=>vI,runRulesSync:()=>kI});var zte=async()=>{let e=[];for await(let t of process.stdin){let n=t;if(n instanceof Uint8Array)e.push(Buffer.from(n));else throw TypeError("Tripwire received a non-byte stdin chunk")}return Buffer.concat(e).toString("utf8")},II,Cj=250,Wte="--tripwire-hook",Kte,sl=(e=II)=>{if(e.kind==="cursor"&&!e.post){process.stdout.write(`{"continue":true,"permission":"allow"}
65
+ `);return}process.stdout.write(`{"continue": true}
66
+ `)},bI=(e)=>`[tripwire:${e.rule}] ${e.message}`,_j=(e)=>{let t=e.kind==="ask"?`${bI(e)} This unattended Cursor run cannot ask a human, so the action is denied.`:bI(e);process.stdout.write(`${JSON.stringify({continue:!0,permission:"deny",user_message:t,agent_message:t})}
67
+ `)},Rj=(e)=>e.turn_id!==void 0,Tj=(e,t,n)=>{if(n.kind==="cursor"){process.stdout.write(`${JSON.stringify({continue:!0,permission:"allow",agent_message:bI(t)})}
68
+ `);return}let r=e.hook_event_name,o=`[tripwire:${t.rule}] ${t.message}`;if(Rj(e)){process.stdout.write(`${JSON.stringify({continue:!0,systemMessage:o})}
69
+ `);return}let s={hookEventName:r,additionalContext:o};process.stdout.write(`${JSON.stringify({continue:!0,hookSpecificOutput:s})}
70
+ `)},wI=(e,t,n=II)=>{if(n.kind==="cursor"){_j(t);return}let r={hookSpecificOutput:{hookEventName:e,permissionDecision:t.kind==="deny"?"deny":"ask",permissionDecisionReason:`[tripwire:${t.rule}] ${t.message}`}};process.stdout.write(`${JSON.stringify(r)}
71
+ `)},Vte=(e,t)=>{if(t.kind==="cursor"){sl(t);return}let n={continue:!0,decision:"block",reason:`[tripwire:${e.rule}] ${e.message}`};process.stdout.write(`${JSON.stringify(n)}
72
+ `)},op=(e)=>{let t=e.toLowerCase();if(t==="bash"||t==="exec"||t==="shell"||t==="run_command")return"Bash";if(t==="read"||t==="read_file")return"Read";if(t==="write"||t==="write_file")return"Write";if(t==="edit"||t==="edit_file"||t==="multiedit"||t==="apply_patch")return"Edit";if(t==="webfetch"||t==="web_fetch"||t==="fetch")return"WebFetch";if(t==="powershell")return"PowerShell";return e},Pj,Fj,Gte=(e,t,n)=>j.gen(function*(){let o=yield*j.exit(j.try({try:t,catch:(s)=>new Pj({cause:s})}).pipe(j.timeout(n)));if(Gt.isSuccess(o))return o.value;return jo(e,lt.pretty(o.cause)),Z(e)}),CI=(e,t,n)=>{let r=[];if(e==="PowerShell")return r.push({name:"powershell-unsupported",fn:()=>se("powershell-unsupported","PowerShell commands are blocked because Tripwire cannot parse PowerShell grammar. Use the Bash tool, or add a PowerShell parser before you enable this tool.")}),r;if(e==="Bash"&&jL(t)){let i=t,a=tl(i.command);return r.push({name:"bash-deny",fn:()=>GL(a,i.command)},{name:"bash-git",fn:()=>YL(a,i.command,n.git)},{name:"bash-scoped-rm",fn:()=>oj(a,i.command,n.safePaths)},{name:"bash-redirect",fn:()=>nj(a,i.command)},{name:"bash-network-install",fn:()=>XL(a,i.command)},{name:"bash-tar-explosion",fn:()=>aj(a,i.command)},{name:"tool-policy",fn:()=>kj(a,i.command,n.toolPolicies)},{name:"config-custom",fn:()=>dj(a,i.command,n.blockedCommands,n.allowedCommands)}),r}if(e==="Read"&&qL(t)){let i=t;return r.push({name:"read-protect",fn:()=>wj(i)}),r}let o=(e==="Edit"||e==="MultiEdit")&&BL(t),s=e==="Write"&&HL(t);if(o){let i=t;r.push({name:"path-protect",fn:()=>yI(i)},{name:"lazy-code",fn:()=>EI(i)})}else if(s){let i=t;r.push({name:"path-protect",fn:()=>yI(i)},{name:"lazy-code",fn:()=>EI(i)})}return r},TI=(e,t,n)=>{if(e==="Bash"||e==="PowerShell"||e==="Read"||e==="WebFetch"){let r=e==="PowerShell"?"Bash":e;return[{name:"post-secret-scrub",fn:()=>Ej({toolName:r,response:t,secretScanner:n})}]}return[]},vI=(e,t)=>j.gen(function*(){if(e.length===0)return Z("no-rules");let r=[];for(let o of e)r.push(yield*Gte(o.name,o.fn,t));return nl(r)}),kI=(e)=>{if(e.length===0)return Z("no-rules");let t=[];for(let n of e)try{t.push(n.fn())}catch(r){jo(n.name,r),t.push(Z(n.name))}return nl(t)},Jte=(e,t={})=>{let n=cI(t),r=op(e.tool_name??"");if(e.hook_event_name==="PreToolUse")return kI(CI(r,e.tool_input,n));if(e.hook_event_name==="PostToolUse")return kI(TI(r,e.tool_response,n.secretScanner));return Z("no-rules")},Zte=(e,t,n)=>{let r=e.hook_event_name,o=op(e.tool_name??"");if(r==="PreToolUse"&&o==="Bash"){if(t.kind==="warn"){Tj(e,t,n);return}sl(n);return}if(t.kind==="warn"){Tj(e,t,n);return}sl(n)},Yte=(e)=>`tripwire config at ${aI} failed to load, so ALL custom safety policy is inactive. Failing closed until it is fixed. Fix the JSON, then this clears on the next hook call. Restart any long-running consumer that caches the loaded config. Error: ${e}`,Mj=()=>{let e=process.argv.indexOf("--cursor-event");if(e!==-1)return process.argv[e+1]??"";return process.argv.find((n)=>n.startsWith("--cursor-event="))?.slice(15)},Qte=()=>process.argv.includes(Wte),Nj=()=>{let e=Mj();return e===void 0?II:dI(e)},Hi=(e,t=!1)=>{let n=Nj();if(t){wI("PreToolUse",se("tripwire-batch-error",`Tripwire batch input could not be processed (${e}). Failing closed.`),n);return}if(n.kind==="cursor"&&!n.post){_j(se("cursor-hook-error",`Cursor hook input could not be processed (${e}). Failing closed.`));return}sl(n)},Oj=(e,t)=>{if(t.kind==="cursor")return`cursor:${t.eventName}`;return Rj(e)?"codex":"native"},Aj=(e)=>e.length===1?e[0]??Z("no-rules"):nl(e),Xte=(e)=>j.gen(function*(){let n=Array.isArray(e);if(n&&!Qte())return jo("decode","Batch hook input is only available through --tripwire-hook"),Hi("unsupported batch input"),{ok:!1};let r,o;if(n){let c=yield*j.exit(P.decodeEffect(Kte)(e));if(Gt.isFailure(c))return jo("decode",lt.pretty(c.cause)),Hi("unsupported batch event shape",!0),{ok:!1};r=c.value,o=Nj()}else{let c=$L(e,Mj()),u=yield*j.exit(P.decodeUnknownEffect(mI)(c.event));if(Gt.isFailure(u))return jo("decode",lt.pretty(u.cause)),Hi("unsupported event shape"),{ok:!1};r=[u.value],{host:o}=c}let[s]=r;if(s===void 0)return Hi("empty batch",!0),{ok:!1};let i=s.hook_event_name,a=Oj(s,o);if(r.some((c)=>c.hook_event_name!==i))return jo("decode","Batch hook input mixes event phases"),Hi("mixed event phases",!0),{ok:!1};if(r.some((c)=>Oj(c,o)!==a))return jo("decode","Batch hook input mixes hosts"),Hi("mixed hosts",!0),{ok:!1};return{ok:!0,events:r,firstEvent:s,host:o,phase:i}}),ene,tne,nne=()=>{yh.runMain(tne)};var $j=w(()=>{nI();el();Lo();PL();UL();Xn();hI();KL();JL();QL();ej();rj();sj();cj();pj();xj();mx();bj();vj();Ij();II={kind:"native"},Kte=P.Array(mI).check(P.isMinLength(1));Pj=class Pj extends Or.TaggedError("RuleExecutionError"){};Fj=class Fj extends Or.TaggedError("HookInputParseError"){};ene=j.gen(function*(){let t=yield*RL(),n=yield*j.promise(zte),r=yield*j.exit(j.try({try:()=>JSON.parse(n),catch:(u)=>new Fj({cause:u})}));if(Gt.isFailure(r)){jo("parse",lt.pretty(r.cause)),Hi("invalid JSON");return}let o=yield*Xte(r.value);if(!o.ok)return;let{events:s,firstEvent:i,host:a,phase:c}=o;if(c==="PreToolUse"){if(!t.ok){wI(c,se("config-error",Yte(t.error)),a);return}let u=[];for(let f of s){let d=op(f.tool_name??"");u.push(yield*vI(CI(d,f.tool_input,t.config),Cj))}let l=Aj(u);if(l.kind==="deny"||l.kind==="ask"){wI(c,l,a);return}Zte(i,l,a);return}if(c==="PostToolUse"){let u=t.ok?t.config.secretScanner:px().secretScanner,l=[];for(let d of s){let m=op(d.tool_name??"");l.push(yield*vI(TI(m,d.tool_response,u),Cj))}let f=Aj(l);if(f.kind==="deny"){Vte(f,a);return}sl(a);return}sl(a)}),tne=ene.pipe(j.catchCause((e)=>(jo("dispatch-fatal",lt.pretty(e)),Hi("dispatcher failure"),j.void)))});function rne(e){return{_tag:"Value",value:e}}function one(e,t){return{_tag:"Record",keys:e,value:t}}function sne(e,t){return{_tag:"Array",length:e,value:t}}function cne(e,t){let n=Object.create(ine);return n.load=e,n.mapInput=t,n}function Lj(e,t){return cne((n)=>e(t(n)),(n)=>Lj(e,L0(t,n)))}function une(e){return Lj(e,ane)}function lne(e,t){return e===""&&!t?void 0:e}function fne(e,t){let n=t?.preserveEmptyStrings===!0,r=pne(e);return une((o)=>v(hne(r,e,o,n)))}function dne(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return fne(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function pne(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=n.split("_"),s=t;for(let i of o){let a=s.children??=Object.create(null);s=a[i]??={}}}return t}function hne(e,t,n,r){let o=n.map(String).join("_"),s=lne(Object.hasOwn(t,o)?t[o]:void 0,r),i=gne(e,n),a=i?.children?Object.keys(i.children):[];if(a.length===0)return s===void 0?void 0:rne(s);if(a.every((u)=>mne.test(u))){let u=Math.max(...a.map((l)=>parseInt(l,10)))+1;return sne(u,s)}return one(new Set(a),s)}function gne(e,t){if(t.length===0)return e;let n=e;for(let r of t)if(n=n?.children?.[String(r)],!n)return;return n}var Uj,ine,ane=(e)=>e,mne;var jj=w(()=>{Ve();Oe();X();rt();Uj=ke("effect/ConfigProvider",{defaultValue:()=>dne()}),ine={...Cn,toJSON(){return{_id:"ConfigProvider"}}};mne=/^(0|[1-9][0-9]*)$/});function Hj(e){let t=Object.create(yne);return t.evaluator=e,t.parse=(n)=>e(n,[]).pipe(Ra((r)=>r.error),on((r)=>r._tag==="Resolved"?v(r.value):A(r.error))),t}var Bj="~effect/Config",yne,qj=(e,t,n)=>e.evaluator(t,n),zj=(e,t)=>({_tag:"Resolved",value:e,hasInput:t}),Sne,Ene,Wj=(e)=>e.pipe(Sne(_),Ene(O())),OI,AI,Kj;var _I=w(()=>{jj();Oe();Pc();X();_e();Xa();Xh();yne={...So({label:"Config",evaluate(e){return this.parse(e.getRef(Uj))}}),[Bj]:Bj,toJSON(){return{_id:"Config"}}};Sne=p(2,(e,t)=>Hj((n,r)=>oe(qj(e,n,r),(o)=>o._tag==="Resolved"?zj(t(o.value),o.hasInput):o))),Ene=p(2,(e,t)=>Hj((n,r)=>Ss(qj(e,n,r),(o)=>o._tag==="Absent"?zj(t,!1):o))),OI=Ls(["true","yes","on","1","y"]),AI=Ls(["false","no","off","0","n"]),Kj=Ls([...OI.literals,...AI.literals]).pipe(de(Zg,st({decode:(e)=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:(e)=>e?"true":"false"})))});var Ye="~effect/cli/CliError",RI=(e)=>M(e,Ye),nc,hx,sp,gx,xx,$n,yx,Gj,bne,qi;var ip=w(()=>{he();xh();Xa();nc=class nc extends po(`${Ye}/UnrecognizedOption`)("UnrecognizedOption",{option:J,command:Nn($e(J)),suggestions:$e(J)}){[Ye]=Ye;get message(){let e=this.suggestions.length>0?`
73
+
74
+ Did you mean this?
75
+ ${this.suggestions.join(`
76
+ `)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+e}};hx=class hx extends po(`${Ye}/DuplicateOption`)("DuplicateOption",{option:J,parentCommand:J,childCommand:J}){[Ye]=Ye;get message(){return`Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`}};sp=class sp extends po(`${Ye}/MissingOption`)("MissingOption",{option:J}){[Ye]=Ye;get message(){return`Missing required flag: --${this.option}`}};gx=class gx extends po(`${Ye}/MissingArgument`)("MissingArgument",{argument:J}){[Ye]=Ye;get message(){return`Missing required argument: ${this.argument}`}};xx=class xx extends po(`${Ye}/UnexpectedArgument`)("UnexpectedArgument",{arguments:$e(J)}){[Ye]=Ye;get message(){return`Unexpected positional ${this.arguments.length===1?"argument":"arguments"}: ${this.arguments.map((t)=>JSON.stringify(t)).join(", ")}`}};$n=class $n extends po(`${Ye}/InvalidValue`)("InvalidValue",{option:J,value:J,expected:J,kind:pt([Ke("flag"),Ke("argument")])}){[Ye]=Ye;get message(){let e=this.expected.startsWith("Expected ")||this.expected.startsWith("Expected:")?this.expected:`Expected: ${this.expected}`;if(this.kind==="argument")return`Invalid value for argument <${this.option}>: "${this.value}". ${e}`;if(this.value.length===0)return`Missing value for flag --${this.option}. ${e}`;return`Invalid value for flag --${this.option}: "${this.value}". ${e}`}};yx=class yx extends po(`${Ye}/UnknownSubcommand`)("UnknownSubcommand",{subcommand:J,parent:Nn($e(J)),suggestions:$e(J)}){[Ye]=Ye;get message(){let e=this.suggestions.length>0?`
77
+
78
+ Did you mean this?
79
+ ${this.suggestions.join(`
80
+ `)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${e}`:`Unknown subcommand "${this.subcommand}"${e}`}};Gj=class Gj extends po(`${Ye}/UserError`)("UserError",{cause:qk(),userMessage:Ds(J)}){[Ye]=Ye;[Pa]=!0;get message(){if(this.userMessage)return this.userMessage;if(typeof this.cause==="string"&&this.cause)return this.cause;if(this.cause instanceof Error&&this.cause.message)return this.cause.message;return"An error occurred"}};bne=pt([nc,hx,sp,gx,xx,$n,yx,Gj]);qi=class qi extends po(`${Ye}/ShowHelp`)("ShowHelp",{commandPath:$e(J),errors:$e(bne)}){[Ye]=Ye;[gh]=this.errors.length?1:0;[Pa]=!1;get message(){return"Help requested"}}});var Jj,wne=(e)=>{let t=[],n=0,r=0;while((r=e.indexOf(".",r))!==-1){if(r===0||e[r-1]!=="\\")t.push(e.slice(n,r)),n=r+1;r++}return t.push(e.slice(n)),t},vne=(e)=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")),PI=(e)=>{let t=(e??"").trim();if(vne(t)){if(t[0]==="'")t=t.slice(1,-1);try{return JSON.parse(t)}catch{return t}}let n=!1,r="";for(let o of t)if(n)r+=o===";"||o==="#"||o==="\\"?o:`\\${o}`,n=!1;else if(o===";"||o==="#")break;else if(o==="\\")n=!0;else r+=o;return r.trim()},Zj=(e)=>{let t=Object.create(null),n=t,r=/^\[([^\]]*)\]\s*$/,o=/^([^=]+)(=(.*))?$/;for(let i of e.split(/[\r\n]+/g)){if(i.length===0||/^\s*(?:[;#]|$)/.test(i))continue;let a=r.exec(i);if(a!==null){let g=PI(a[1]);if(g==="__proto__")n=Object.create(null);else n=t[g]??=Object.create(null);continue}let c=o.exec(i);if(c===null)continue;let u=PI(c[1]),l=u.length>2&&u.endsWith("[]"),f=l?u.slice(0,-2):u;if(f==="__proto__")continue;let d=c[2]===void 0?!0:PI(c[3]),m=d==="true"||d==="false"||d==="null"?JSON.parse(d):d;if(l){if(!Jj.call(n,f))n[f]=[];else if(!Array.isArray(n[f]))n[f]=[n[f]]}if(Array.isArray(n[f]))n[f].push(m);else n[f]=m}let s=[];for(let i of Object.keys(t)){if(typeof t[i]!=="object"||t[i]===null||Array.isArray(t[i]))continue;let a=wne(i),c=a.pop(),u=c.replace(/\\\./g,".");n=t;for(let l of a){if(l==="__proto__")continue;if(!Jj.call(n,l)||typeof n[l]!=="object"||n[l]===null)n[l]=Object.create(null);n=n[l]}if(n===t&&u===c)continue;n[u]=t[i],s.push(i)}for(let i of s)delete t[i];return t};var Yj=w(()=>{Jj=Object.prototype.hasOwnProperty});class eB{root=ap();input;current=this.root;index=0;line=1;column=1;explicitTables=new Set;constructor(e){this.input=e}parse(){while(!0){if(this.skipDocumentWhitespace(),this.done)return this.root;if(this.peek()==="[")this.parseHeader();else{let e=this.parseKeyPath("=");this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(this.current,e,this.parseValue()),this.finishStatement()}}}parseHeader(){this.expect("[");let e=this.peek()==="[";if(e)this.advance();this.skipInlineWhitespace();let t=this.parseKeyPath("]");if(this.skipInlineWhitespace(),this.expect("]"),e)this.expect("]");this.finishStatement();let n=JSON.stringify(t);if(!e&&this.explicitTables.has(n))this.fail(`Cannot redefine table '${t.join(".")}'`);if(!e)this.explicitTables.add(n);this.current=this.resolveTable(t,e)}resolveTable(e,t){let n=this.root;for(let r=0;r<e.length;r++){let o=e[r],s=r===e.length-1,i=n[o];if(s&&t){if(i===void 0)i=[],n[o]=i;if(!Array.isArray(i))this.fail(`Cannot redefine existing key '${e.slice(0,r+1).join(".")}'`);let a=ap();return i.push(a),a}if(i===void 0)i=ap(),n[o]=i;if(Array.isArray(i))i=i[i.length-1];if(!Xj(i))this.fail(`Cannot redefine existing key '${e.slice(0,r+1).join(".")}'`);n=i}return n}assign(e,t,n){let r=e;for(let s=0;s<t.length-1;s++){let i=t[s],a=r[i];if(a===void 0){let c=ap();r[i]=c,r=c}else if(Xj(a))r=a;else this.fail(`Cannot redefine existing key '${t.slice(0,s+1).join(".")}'`)}let o=t[t.length-1];if(Qj.call(r,o))this.fail(`Cannot redefine existing key '${t.join(".")}'`);r[o]=n}parseKeyPath(e){let t=[];while(!0){this.skipInlineWhitespace();let n=this.peek(),r;if(n==='"')r=this.parseBasicString(!1);else if(n==="'")r=this.parseLiteralString(!1);else{let o=this.index;while(/[A-Za-z0-9_-]/.test(this.peek()))this.advance();r=this.input.slice(o,this.index)}if(r.length===0)this.fail("Expected a key");if(t.push(r),this.skipInlineWhitespace(),this.peek()==="."){this.advance();continue}if(this.peek()!==e)this.fail(`Expected '${e}'`);return t}}parseValue(){let e=this.peek();if(e==='"')return this.parseBasicString(this.input.startsWith('"""',this.index));if(e==="'")return this.parseLiteralString(this.input.startsWith("'''",this.index));if(e==="[")return this.parseArray();if(e==="{")return this.parseInlineTable();let t=/^(\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(t!==null)return this.advance(t[0].length),this.parseDate(`${t[1]}T${t[2]}`);let n=this.index;while(!this.done&&!/[\s,#\]}]/.test(this.peek()))this.advance();let r=this.input.slice(n,this.index);if(r==="true")return!0;if(r==="false")return!1;if(r.length===0)this.fail("Expected a value");let o=this.parseDate(r);if(o!==void 0)return o;let s=this.parseNumber(r);if(s!==void 0)return s;this.fail(`Invalid value '${r}'`)}parseDate(e){if(new RegExp("^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:[Zz]|[+-]\\d{2}:\\d{2})$").test(e)){let r=new Date(e.replace("t","T").replace("z","Z"));if(Number.isNaN(r.getTime()))this.fail(`Invalid date-time '${e}'`);return r}if(new RegExp("^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?$").test(e)||new RegExp("^\\d{4}-\\d{2}-\\d{2}$").test(e)||new RegExp("^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?$").test(e))return e.replace("t","T");return}parseNumber(e){let t=e.replace(/_/g,"");if(/^[+-]?(?:inf|nan)$/.test(e)){if(t.endsWith("nan"))return Number.NaN;return t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}if(/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/.test(e))return Number.parseInt(t.slice(2),16);if(/^0o[0-7](?:_?[0-7])*$/.test(e))return Number.parseInt(t.slice(2),8);if(/^0b[01](?:_?[01])*$/.test(e))return Number.parseInt(t.slice(2),2);if(/^[+-]?(?:0|[1-9](?:_?\d)*)$/.test(e))return Number(t);if(/^[+-]?(?:(?:0|[1-9](?:_?\d)*)\.\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?|(?:0|[1-9](?:_?\d)*)[eE][+-]?\d(?:_?\d)*)$/.test(e))return Number(t);return}parseBasicString(e){if(this.expect('"'),e){if(this.expect('"'),this.expect('"'),this.peek()===`
81
+ `)this.advance()}let t="";while(!this.done){if(e&&this.input.startsWith('"""',this.index))return this.advance(3),t;let n=this.peek();if(!e&&n==='"')return this.advance(),t;if(!e&&(n===`
82
+ `||n==="\r"))this.fail("Basic strings cannot contain newlines");if(n!=="\\"){t+=n,this.advance();continue}if(this.advance(),e&&/[ \t\r\n]/.test(this.peek())){while(/[ \t]/.test(this.peek()))this.advance();if(this.peek()!==`
83
+ `&&this.peek()!=="\r")this.fail("Invalid multiline string continuation");while(/[ \t\r\n]/.test(this.peek()))this.advance();continue}let r=this.peek();this.advance();let o={b:"\b",t:"\t",n:`
84
+ `,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(Qj.call(o,r))t+=o[r];else if(r==="u"||r==="U"){let s=r==="u"?4:8,i=this.input.slice(this.index,this.index+s);if(!new RegExp(`^[0-9A-Fa-f]{${s}}$`).test(i))this.fail("Invalid unicode escape");t+=String.fromCodePoint(Number.parseInt(i,16)),this.advance(s)}else this.fail(`Invalid escape '\\${r}'`)}this.fail("Unterminated basic string")}parseLiteralString(e){if(this.expect("'"),e){if(this.expect("'"),this.expect("'"),this.peek()===`
85
+ `)this.advance()}let t=this.index;while(!this.done){if(e&&this.input.startsWith("'''",this.index)){let n=this.input.slice(t,this.index);return this.advance(3),n}if(!e&&this.peek()==="'"){let n=this.input.slice(t,this.index);return this.advance(),n}if(!e&&(this.peek()===`
86
+ `||this.peek()==="\r"))this.fail("Literal strings cannot contain newlines");this.advance()}this.fail("Unterminated literal string")}parseArray(){this.expect("[");let e=[];while(!0){if(this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),e;if(e.push(this.parseValue()),this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),e;this.expect(",")}}parseInlineTable(){this.expect("{");let e=ap();if(this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),e;while(!0){let t=this.parseKeyPath("=");if(this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(e,t,this.parseValue()),this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),e;if(this.expect(","),this.skipInlineWhitespace(),this.peek()==="}")this.fail("Inline tables cannot end with a trailing comma")}}skipDocumentWhitespace(){while(!this.done)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}skipInlineWhitespace(){while(this.peek()===" "||this.peek()==="\t")this.advance()}skipArrayWhitespace(){while(!this.done)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}finishStatement(){if(this.skipInlineWhitespace(),this.peek()==="#")this.skipComment();if(!this.done&&this.peek()!==`
87
+ `&&this.peek()!=="\r")this.fail("Expected the end of the line")}skipComment(){while(!this.done&&this.peek()!==`
88
+ `)this.advance()}expect(e){if(this.peek()!==e)this.fail(`Expected '${e}'`);this.advance()}advance(e=1){for(let t=0;t<e;t++){if(this.input[this.index]===`
89
+ `)this.line++,this.column=1;else this.column++;this.index++}}peek(){return this.input[this.index]??""}get done(){return this.index>=this.input.length}fail(e){throw SyntaxError(`${e} at line ${this.line}, column ${this.column}`)}}var Qj,ap=()=>Object.create(null),Xj=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date),tB=(e)=>new eB(e.replace(/^\uFEFF/,"")).parse();var nB=w(()=>{Qj=Object.prototype.hasOwnProperty});class sB{input;anchors;index=0;constructor(e,t){this.input=e,this.anchors=t}parse(){let e=this.parseValue();if(this.skipWhitespace(),this.index!==this.input.length)this.fail("Unexpected flow collection content");return e}parseValue(){this.skipWhitespace();let e=this.peek();if(e==="[")return this.parseSequence();if(e==="{")return this.parseMapping();if(e==='"'||e==="'")return bx(this.readQuoted(e));if(e==="*"){this.index++;let t=this.readUntil(/[,\]}\s]/);if(!this.anchors.has(t))this.fail(`Unknown alias '*${t}'`);return this.anchors.get(t)}return bx(this.readUntil(/[,\]}]/).trim())}parseSequence(){this.expect("[");let e=[];if(this.skipWhitespace(),this.peek()==="]")return this.index++,e;while(!0){if(e.push(this.parseValue()),this.skipWhitespace(),this.peek()==="]")return this.index++,e;if(this.expect(","),this.skipWhitespace(),this.peek()==="]")return this.index++,e}}parseMapping(){this.expect("{");let e={};if(this.skipWhitespace(),this.peek()==="}")return this.index++,e;while(!0){let t=this.parseKey();if(this.skipWhitespace(),this.expect(":"),FI.call(e,t))this.fail(`Duplicate key '${t}'`);if(rB(e,t,this.parseValue()),this.skipWhitespace(),this.peek()==="}")return this.index++,e;if(this.expect(","),this.skipWhitespace(),this.peek()==="}")return this.index++,e}}parseKey(){this.skipWhitespace();let e=this.peek();if(e==='"'||e==="'")return oB(this.readQuoted(e));return this.readUntil(/:/).trim()}readQuoted(e){let t=this.index++,n=!1;while(this.index<this.input.length){let r=this.input[this.index++];if(e==='"'&&n)n=!1;else if(e==='"'&&r==="\\")n=!0;else if(e==="'"&&r===e&&this.input[this.index]===e)this.index++;else if(r===e)return this.input.slice(t,this.index)}this.fail("Unterminated quoted scalar")}readUntil(e){let t=this.index;while(this.index<this.input.length&&!e.test(this.peek()))this.index++;return this.input.slice(t,this.index)}skipWhitespace(){while(/\s/.test(this.peek()))this.index++}expect(e){if(this.peek()!==e)this.fail(`Expected '${e}'`);this.index++}peek(){return this.input[this.index]??""}fail(e){throw SyntaxError(`${e} at flow offset ${this.index}`)}}class iB{lines;index=0;anchors=new Map;constructor(e){this.lines=e}parse(){if(this.skipIgnored(),this.index>=this.lines.length)return null;let e=this.parseNode(this.lines[this.index].indent);if(this.skipIgnored(),this.index<this.lines.length)this.fail(this.lines[this.index],"Unexpected content");return e}parseNode(e){this.skipIgnored();let t=this.lines[this.index];if(t===void 0)return null;if(t.indent!==e)this.fail(t,`Expected indentation of ${e} spaces`);if(t.text==="-"||t.text.startsWith("- "))return this.parseSequence(e);if(Ex(t.text)!==-1)return this.parseMapping(e);return this.index++,this.parseInlineValue(t.text)}parseMapping(e){let t={};while(!0){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<e)return t;if(n.indent>e)this.fail(n,`Unexpected indentation of ${n.indent} spaces`);let r=Ex(n.text);if(r===-1)return t;this.index++,this.parseMappingEntry(t,n.text,r,e,n)}}parseMappingEntry(e,t,n,r,o){let s=oB(t.slice(0,n).trim()),i=t.slice(n+1).trim(),a=this.parseNodeValue(i,r);if(FI.call(e,s))this.fail(o,`Duplicate key '${s}'`);rB(e,s,a)}parseSequence(e){let t=[];while(!0){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<e)return t;if(n.indent>e)this.fail(n,`Unexpected indentation of ${n.indent} spaces`);if(n.text!=="-"&&!n.text.startsWith("- "))return t;this.index++;let r=n.text.slice(1).trimStart(),o=Ex(r);if(o===-1){t.push(this.parseNodeValue(r,e));continue}let s={};this.parseMappingEntry(s,r,o,e+2,n);while(!0){this.skipIgnored();let i=this.lines[this.index];if(i===void 0||i.indent<=e)break;if(i.indent!==e+2)this.fail(i,`Expected indentation of ${e+2} spaces`);let a=Ex(i.text);if(a===-1)this.fail(i,"Expected a mapping entry");this.index++,this.parseMappingEntry(s,i.text,a,e+2,i)}t.push(s)}}parseNodeValue(e,t){let n=e,r,o=/^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(n);if(o!==null)r=o[1],n=o[2]??"";let s;if(n.length===0){this.skipIgnored();let i=this.lines[this.index];s=i!==void 0&&i.indent>t?this.parseNode(i.indent):null}else if(/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(n))s=this.parseBlockScalar(n,t);else s=this.parseInlineValue(n);if(r!==void 0)this.anchors.set(r,s);return s}parseInlineValue(e){if(e.startsWith("*")){let t=e.slice(1).trim();if(!this.anchors.has(t))throw SyntaxError(`Unknown YAML alias '*${t}'`);return this.anchors.get(t)}if(e.startsWith("[")||e.startsWith("{"))return new sB(e,this.anchors).parse();return bx(e)}parseBlockScalar(e,t){let n=e[0],r=e.includes("-")?"strip":e.includes("+")?"keep":"clip",o=Number.parseInt(e.replace(/[^1-9]/g,""),10),s=this.index,i=s,a=Number.isNaN(o)?Number.POSITIVE_INFINITY:t+o;while(i<this.lines.length){let l=this.lines[i];if(l.raw.trim().length!==0&&l.indent<=t)break;if(l.raw.trim().length!==0)a=Math.min(a,l.indent);i++}if(a===Number.POSITIVE_INFINITY)a=t+1;let c=[];for(let l=s;l<i;l++){let f=this.lines[l];if(f.raw.trim().length===0)c.push("");else if(f.indent<a)this.fail(f,`Expected block scalar indentation of ${a} spaces`);else c.push(f.raw.slice(a))}this.index=i;let u="";if(n==="|")u=c.join(`
90
+ `);else for(let l=0;l<c.length;l++)if(u+=c[l],l<c.length-1)u+=c[l].length===0||c[l+1].length===0?`
91
+ `:" ";if(r==="keep")return`${u}
92
+ `;return u=u.replace(/\n+$/,""),r==="strip"?u:`${u}
93
+ `}skipIgnored(){while(this.index<this.lines.length){let e=this.lines[this.index];if(e.text.length===0||e.text.startsWith("%")||e.text==="---")this.index++;else if(e.text==="..."){this.index++;while(this.index<this.lines.length&&this.lines[this.index].text.length===0)this.index++;if(this.index<this.lines.length)this.fail(this.lines[this.index],"Multiple YAML documents are not supported")}else return}}fail(e,t){throw SyntaxError(`${t} at line ${e.number}`)}}var FI,rB=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n})},Cne=(e)=>{let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(t==='"'){if(n)n=!1;else if(o==="\\")n=!0;else if(o===t)t=void 0}else if(t==="'"){if(o===t&&e[r+1]===t)r++;else if(o===t)t=void 0}else if(o==="'"||o==='"')t=o;else if(o==="#"&&(r===0||/\s/.test(e[r-1])))return e.slice(0,r).trimEnd()}return e.trimEnd()},Ex=(e)=>{let t,n=!1,r=0;for(let o=0;o<e.length;o++){let s=e[o];if(t==='"'){if(n)n=!1;else if(s==="\\")n=!0;else if(s===t)t=void 0}else if(t==="'"){if(s===t&&e[o+1]===t)o++;else if(s===t)t=void 0}else if(s==="'"||s==='"')t=s;else if(s==="["||s==="{")r++;else if(s==="]"||s==="}")r--;else if(s===":"&&r===0&&(e[o+1]===void 0||/\s/.test(e[o+1])))return o}return-1},Tne=(e)=>{if(!e.endsWith('"')||e.length<2)throw SyntaxError("Unterminated double-quoted YAML string");let t="";for(let n=1;n<e.length-1;n++){let r=e[n];if(r!=="\\"){t+=r;continue}let o=e[++n],s={"0":"\x00",a:"\x07",b:"\b",t:"\t",n:`
94
+ `,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(FI.call(s,o)){t+=s[o];continue}if(o==="x"||o==="u"||o==="U"){let i=o==="x"?2:o==="u"?4:8,a=e.slice(n+1,n+1+i);if(!new RegExp(`^[0-9A-Fa-f]{${i}}$`).test(a))throw SyntaxError("Invalid unicode escape in YAML string");t+=String.fromCodePoint(Number.parseInt(a,16)),n+=i;continue}throw SyntaxError(`Invalid YAML escape '\\${o}'`)}return t},bx=(e)=>{let t=e.trim();if(t.length===0)return null;if(t.startsWith('"')&&t.endsWith('"'))return Tne(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 n=t.replace(/_/g,"");if(/^[+-]?0x[0-9a-f]+$/i.test(n))return(n[0]==="-"?-1:1)*Number.parseInt(n.replace(/^[+-]?0x/i,""),16);if(/^[+-]?0o[0-7]+$/i.test(n))return(n[0]==="-"?-1:1)*Number.parseInt(n.replace(/^[+-]?0o/i,""),8);if(/^[+-]?(?:0|[1-9]\d*)$/.test(n)||/^[+-]?(?:(?:0|[1-9]\d*)?\.\d+|(?:0|[1-9]\d*)\.?\d*[eE][+-]?\d+)$/.test(n))return Number(n);return t},oB=(e)=>{let t=bx(e);return t===null||t===void 0?"":String(t)},MI=(e)=>{let n=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
95
+ `).split(`
96
+ `).map((r,o)=>{let s=/^( *)/.exec(r)[1].length;if(r.slice(0,s+1).includes("\t"))throw SyntaxError(`Tabs cannot be used for YAML indentation at line ${o+1}`);return{raw:r,text:Cne(r.slice(s)),indent:s,number:o+1}});return new iB(n).parse()};var aB=w(()=>{FI=Object.prototype.hasOwnProperty});var Ane="~effect/cli/Primitive",_ne,cB,uB,wx=(e)=>e._tag==="Boolean",Bo=(e,t)=>Object.assign(Object.create(_ne),{_tag:e,parse:t}),vx=(e,t)=>{let n=ep(t),r=Us(n);return Bo(e,(o)=>Pt(r(o),(s)=>s.message))},lB,fB,dB,pB,mB,hB=(e)=>{let t=new Map(e),n=e.map(([o])=>B(o)).join(" | "),r=Bo("Choice",(o)=>{if(t.has(o))return v(t.get(o));return A(n)});return Object.assign(r,{choiceKeys:e.map(([o])=>o)})},gB=(e,t)=>{let n=Bo("Path",H(function*(r){let o=yield*Ci,s=yield*Ao,i=s.isAbsolute(r)?r:s.resolve(r),a=yield*Pt(o.exists(i),(c)=>`Failed to check path existence: ${c.message}`);if(t===!0&&!a)return yield*A(`Path does not exist: ${i}`);if(a&&e!=="either"){let c=yield*Pt(o.stat(i),(u)=>`Failed to stat path: ${u.message}`);if(e==="file"&&c.type!=="File")return yield*A(`Path is not a file: ${i}`);if(e==="directory"&&c.type!=="Directory")return yield*A(`Path is not a directory: ${i}`)}return i}));return Object.assign(n,{pathType:e})},xB,NI,Rne,DI=(e)=>Bo("FileParse",H(function*(t){let n=e?.format??t.split(".").pop(),r=Rne[n];if(r===void 0)return yield*A(`Unsupported file format: ${n}`);let o=yield*NI.parse(t);return yield*Nt({try:()=>r(o),catch:(s)=>`Failed to parse '.${n}' file content: ${s}`})})),yB=(e,t)=>{let n=Us(e);return Bo("FileSchema",H(function*(r){let o=yield*DI(t).parse(r);return yield*Pt(n(o),(s)=>t?.errorFormatter?.(s.issue)??s.toString())}))},SB,EB,cp=(e)=>{switch(e._tag){case"Boolean":return"boolean";case"String":return"string";case"Integer":return"integer";case"Float":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"None":return"none";default:return"value"}},Hs=(e)=>e._tag==="Choice"?e.choiceKeys:void 0,$I=(e)=>e._tag==="Path"?e.pathType:void 0;var il=w(()=>{_I();Oe();Rh();kn();X();Ph();$d();Xa();Yj();nB();aB();_ne={[Ane]:{_A:D}},cB=Bd(OI),uB=Bd(AI),lB=vx("Boolean",Kj),fB=vx("Float",Zn),dB=vx("Integer",Uo),pB=vx("Date",Yn),mB=Bo("String",(e)=>v(e)),xB=Bo("Redacted",(e)=>v(Ns(e))),NI=Bo("FileText",H(function*(e){let t=yield*Ci,n=yield*Ao,r=n.isAbsolute(e)?e:n.resolve(e);if(!(yield*Pt(t.exists(r),(a)=>`Failed to check file existence: ${a.message}`)))return yield*A(`File does not exist: ${r}`);if((yield*Pt(t.stat(r),(a)=>`Failed to stat file: ${a.message}`)).type!=="File")return yield*A(`Path is not a file: ${r}`);return yield*Pt(t.readFileString(r),(a)=>`Failed to read file: ${a.message}`)})),Rne={ini:(e)=>Zj(e),json:(e)=>JSON.parse(e),toml:(e)=>tB(e),yml:(e)=>MI(e),yaml:(e)=>MI(e)},SB=Bo("KeyValuePair",H(function*(e){let t=e.split("=");if(t.length!==2)return yield*A(`Invalid key=value format. Expected format: key=value, got: ${e}`);let[n,r]=t;if(!n||!r)return yield*A(`Invalid key=value format. Both key and value must be non-empty. Got: ${e}`);return{[n]:r}})),EB=Bo("None",()=>A("This option does not accept values"))});var qs="\x1B[1m",bB="\x1B[3m",rc="\x1B[4m",wB="\x1B[9m",vB="\x1B[?25h",lp="\x1B[?25l",oc="\x1B[G",kx="\x1B[s",Ix="\x1B[u",zi="\x1B[2K",kB="\x07",Cx="\x1B[31m",Tx="\x1B[32m",IB="\x1B[35m",sc="\x1B[37m",fp="\x1B[90m",al="\x1B[96m",at=(e,...t)=>`${t.flat().join("")}${e}\x1B[0m`,Ho=(...e)=>e,CB=(e,t)=>{if(t===void 0)return`\x1B[${Math.max(e+1,0)}G`;return`\x1B[${t+1};${Math.max(e+1,0)}H`},TB=(e=1)=>`\x1B[${e}B`,OB=(e,t=0)=>{let n="";if(t<0)n+=`\x1B[${-t}A`;if(t>0)n+=`\x1B[${t}B`;if(e>0)n+=`\x1B[${e}C`;if(e<0)n+=`\x1B[${-e}D`;return n},AB=(e)=>{let t="";for(let n=0;n<e;n++)t+="\x1B[2K"+(n<e-1?"\x1B[1A":"");if(e>0)t+="\x1B[G";return t};class qo{token;date;parts;locales;constructor(e){this.token=e.token,this.locales=e.locales,this.date=e.date||new Date,this.parts=e.parts||[this]}isToken(){return!1}nextPart(){let e=mt(em(this.parts,(t)=>t===this),()=>0);return fS(this.parts.slice(e+1),(t)=>!t.isToken())}previousPart(){let e=em(this.parts,(t)=>t===this);if(Ee(e))return dS(this.parts.slice(0,e.value),(t)=>!t.isToken());return O()}toString(){return String(this.date)}}var DB="~effect/cli/Prompt",$B=(e)=>M(e,DB),UB,Pne,Fne=(e)=>({...process.platform==="win32"?Pne:UB,...e}),Mne,Zt=(e)=>oe(Mne,(t)=>({...t,...e.theme})),Nne=(e)=>at(e,qs),LI=(e,t)=>at(e,Ho(bB,t)),Ue=(e,...t)=>e.length===0?"":at(e,...t),Wi=(e,t)=>e.length===0?t:e+" "+t,Dne=(e,t,n)=>{let r=Math.max(e.arrowUp.length,e.arrowDown.length);if(t)return e.arrowUp.padEnd(r);if(n)return e.arrowDown.padEnd(r);return" ".repeat(r)},jI=(e)=>{let t={initial:!1,...e,label:{confirm:"yes",deny:"no",...e.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...e.placeholder}},n={value:t.initial};return ic(n,{render:Kne(t),process:(r)=>Jne(r,t.initial),clear:qne(t)})},ic=(e,...t)=>{let[n,r]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(qI);return o._tag="Loop",o.initialState=e,o.render=r.render,o.process=r.process,o.clear=r.clear,o.events=n,o},LB=(e)=>{let t={initial:new Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:v,...e,locales:{...ire,...e.locales}},n=lre(t.dateMask,t.initial,t.locales),r=n.findIndex((s)=>!s.isToken()),o={dateParts:n,typed:"",cursor:r,value:t.initial,error:O()};return ic(o,{render:are(t),process:cre(t),clear:Zne(t)})},$ne,jB=(e)=>{let t={default:0,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:(o)=>{if(o<t.min)return A(`${o} must be greater than or equal to ${t.min}`);if(o>t.max)return A(`${o} must be less than or equal to ${t.max}`);return v(o)},...e},n=e.default===void 0?"":`${t.default}`,r={cursor:n.length,value:n,error:O()};return ic(r,{render:xre(t),process:yre(t),clear:XB(t)})},BI=(e)=>{let t={default:0,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:(o)=>{if(o<t.min)return A(`${o} must be greater than or equal to ${t.min}`);if(o>t.max)return A(`${o} must be less than or equal to ${t.max}`);return v(o)},...e},n=e.default===void 0?"":`${t.default}`,r={cursor:n.length,value:n,error:O()};return ic(r,{render:hre(t),process:gre(t),clear:XB(t)})},Une,BB=(e)=>aH(e,"password").pipe(Une(Ns)),vn,Lne=(e)=>{let t=0,n=-1;for(let r=0;r<e.length;r++)if(e[r].selected===!0){if(n!==-1)throw Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.select");n=r}if(n!==-1)t=n;return t},HI=(e)=>{let t={maxPerPage:10,...e},n=Lne(t.choices);return ic(n,{render:Cre(t),process:Ore(t),clear:Tre(t)})},jne=(e)=>{let t=Object.create(qI);return t._tag="Succeed",t.value=e,t},HB=(e)=>aH(e,"text"),qB=(e)=>{let t={initial:!1,active:"on",inactive:"off",...e};return ic(t.initial,{render:Wre(t),process:Kre,clear:()=>Hre(t)})},qI,UI=(e,t,n)=>Ne(()=>{let r=e;switch(r._tag){case"Loop":return Bne(r,t,n);case"OnSuccess":return ne(UI(r.prompt,t,n),(o)=>UI(r.onSuccess(o),t,n));case"Succeed":return v(r.value)}}),Bne,W,cl=(e,t)=>{if(t===0)return zi+CB(0);let n=0,r=e.split(cc);for(let o of r)n+=1+Math.floor(Math.max(o.length-1,0)/t);return AB(n)},Hne=(e,t)=>{let n=e.split(cc);return t===0?n.length:zr(jt(n,(r)=>Math.ceil(r.length/t)),Ll(0,(r,o)=>r+o))},zI=(e,t,n)=>{if(n!==void 0&&n.length>0)return TB(Hne(n,t))+cl(`
97
+ ${n}`,t)+cl(e,t);return cl(e,t)},ac,cc,qne=(e)=>H(function*(t,n){let o=yield*(yield*mo).columns,s=yield*Zt(e),i=t.value?e.placeholder.defaultConfirm:e.placeholder.defaultDeny,a=WI(i,s.prefix,s.pointerSmall,e,{plain:!0}),c=cl(a,o),u=zi+oc;return c+u}),WI=(e,t,n,r,o)=>uc(e,r.message,t,n,o),zne,Wne,Kne=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>zne(r,e),Submit:({value:r})=>Wne(r,e)}),Vne,Gne,Jne=(e,t)=>{let n=mt(e.input,()=>"");if(e.key.name==="enter"||e.key.name==="return")return v(W.Submit({value:t}));if(Vne.test(n.toLowerCase()))return v(W.Submit({value:!0}));if(Gne.test(n.toLowerCase()))return v(W.Submit({value:!1}));return v(W.Beep())},Zne=(e)=>H(function*(t,n){let o=yield*(yield*mo).columns,s=yield*Zt(e),i=zi+oc,a=Ll(t.dateParts,"",(f,d)=>f+d.toString()),c=KI(s.prefix,s.pointerSmall,a,e,{plain:!0}),u=Ee(t.error)?Ul(t.error.value.split(cc),{onEmpty:()=>"",onNonEmpty:(f)=>Wi(s.pointerSmall,f.join(`
98
+ `))}):"";return zI(c,o,u)+i}),Yne=(e,t,n)=>{if(Ee(e.error)){let r=e.error.value.split(cc);if(Hn(r)){let o=Ue(t,n.errorColor),s=jt(r,(i)=>LI(i,n.errorColor));return kx+`
99
+ `+Wi(o,s.join(`
100
+ `))+Ix}}return""},zB=(e,t,n=!1)=>Ll(e.dateParts,"",(r,o,s)=>{let i=o.toString();if(s===e.cursor&&!n){let a=Ho(rc,t.primaryColor);return r+at(i,a)}return r+i}),KI=(e,t,n,r,o)=>uc(n,r.message,e,t,o),Qne,Xne,ere=(e)=>(e.dateParts[e.cursor].increment(),W.NextFrame({state:{...e,typed:""}})),tre=(e)=>(e.dateParts[e.cursor].decrement(),W.NextFrame({state:{...e,typed:""}})),nre=(e)=>{let t=e.dateParts[e.cursor].previousPart();if(Ee(t))return W.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}});return W.Beep()},rre=(e)=>{let t=e.dateParts[e.cursor].nextPart();if(Ee(t))return W.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}});return W.Beep()},ore=(e)=>{let t=e.dateParts[e.cursor].nextPart(),n=et(t,{onNone:()=>e.dateParts.findIndex((r)=>!r.isToken()),onSome:(r)=>e.dateParts.indexOf(r)});return W.NextFrame({state:{...e,cursor:n}})},sre=(e,t)=>{if(/\d/.test(e)){let n=t.typed+e;return t.dateParts[t.cursor].setValue(n),W.NextFrame({state:{...t,typed:n}})}return W.Beep()},ire,are=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>Qne(r,e),Submit:()=>Xne(t,e)}),cre=(e)=>(t,n)=>{switch(t.key.name){case"left":return v(nre(n));case"right":return v(rre(n));case"k":case"up":return v(ere(n));case"j":case"down":return v(tre(n));case"tab":return v(ore(n));case"enter":case"return":return wi(e.validate(n.value),{onFailure:(r)=>W.NextFrame({state:{...n,error:_(r)}}),onSuccess:(r)=>W.Submit({value:r})});default:return v(sre(mt(t.input,()=>""),n))}},ure,RB,lre=(e,t,n)=>{let r=[],o=null;while(o=ure.exec(e)){let i=o.shift(),a=o.findIndex((c)=>c!==void 0);if(a in RB){let c=o[a]||i;r.push(RB[a]({token:c,date:t,parts:r,locales:n}))}else r.push(new VI({token:o[a]||i,date:t,parts:r,locales:n}))}let s=r.reduce((i,a)=>{let c=i[i.length-1];if(a.isToken()&&c!==void 0&&c.isToken())c.setValue(a.token);else i.push(a);return i},fa());return r.splice(0,r.length,...s),r},VI,WB,KB,VB,GB,JB,ZB,YB,QB,uc=(e,t,n,r,o)=>{let s=n.length===0?"":n+" ",i=(c)=>{let u=s+c;if(r.length>0)u+=" "+r;if(e.length>0)u+=" "+e;else if(r.length>0)u+=" ";return u},a=o?.plain===!0?(c)=>c:Nne;return Ul(t.split(cc),{onEmpty:()=>i(""),onNonEmpty:(c)=>{let u=jt(c,(l)=>a(l));return i(u.join(`
101
+ `))}})},fre=(e,t,n,r)=>{if(!e.disabled&&e.description&&t){let o=n.descriptionSeparator+e.description;return r?.plain===!0?o:at(o,n.mutedColor)}return""},XB=(e)=>H(function*(t,n){let o=yield*(yield*mo).columns,s=yield*Zt(e),i=zi+oc,a=eH(t,s.pointerSmall,s,{plain:!0}),c=GI(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return zI(c,o,a)+i}),dre=(e,t,n,r)=>{let o=e.value===""?"":`${e.value}`;if(t||r?.plain===!0)return o;let s=Ee(e.error)?n.errorColor:Ho(rc,n.primaryColor);return at(o,s)},eH=(e,t,n,r)=>{if(Ee(e.error))return Ul(e.error.value.split(cc),{onEmpty:()=>"",onNonEmpty:(o)=>{if(r?.plain===!0)return Wi(t,o.join(`
102
+ `));let s=Ue(t,n.errorColor),i=jt(o,(a)=>LI(a,n.errorColor));return kx+`
103
+ `+Wi(s,i.join(`
104
+ `))+Ix}});return""},GI=(e,t,n,r,o,s,i=!1)=>{let a=dre(e,i,o,s);return uc(a,r.message,t,n,s)},tH,nH,rH=(e)=>{if(e.value.length<=0)return v(W.Beep());let t=e.value.slice(0,e.value.length-1);return v(W.NextFrame({state:{...e,value:t,error:O()}}))},oH=(e)=>v(W.NextFrame({state:{...e,cursor:0,value:"",error:O()}})),pre=(e,t)=>{if(t.value.length===0&&e==="-")return v(W.NextFrame({state:{...t,value:"-",error:O()}}));let n=Number.parseInt(t.value+e);if(Number.isNaN(n))return v(W.Beep());else return v(W.NextFrame({state:{...t,value:`${n}`,error:O()}}))},mre=(e,t)=>{if(e==="."&&t.value.includes("."))return v(W.Beep());if(t.value.length===0&&e==="-")return v(W.NextFrame({state:{...t,value:"-",error:O()}}));let n=Number.parseFloat(t.value+e);if(Number.isNaN(n))return v(W.Beep());else return v(W.NextFrame({state:{...t,value:e==="."?`${n}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${n}`,error:O()}}))},hre=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>tH(r,e),Submit:()=>nH(t,e)}),gre=(e)=>(t,n)=>{if(t.key.ctrl&&t.key.name==="u")return oH(n);switch(t.key.name){case"backspace":return rH(n);case"k":case"up":return v(W.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`${e.incrementBy}`:`${Number.parseInt(n.value)+e.incrementBy}`,error:O()}}));case"j":case"down":return v(W.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`-${e.decrementBy}`:`${Number.parseInt(n.value)-e.decrementBy}`,error:O()}}));case"enter":case"return":{let r=Number.parseInt(n.value);if(Number.isNaN(r))return v(W.NextFrame({state:{...n,error:_("Must provide an integer value")}}));else return wi(e.validate(r),{onFailure:(o)=>W.NextFrame({state:{...n,error:_(o)}}),onSuccess:(o)=>W.Submit({value:o})})}default:return pre(mt(t.input,()=>""),n)}},xre=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>tH(r,e),Submit:()=>nH(t,e)}),yre=(e)=>(t,n)=>{if(t.key.ctrl&&t.key.name==="u")return oH(n);switch(t.key.name){case"backspace":return rH(n);case"k":case"up":return v(W.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`${e.incrementBy}`:`${Number.parseFloat(n.value)+e.incrementBy}`,error:O()}}));case"j":case"down":return v(W.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`-${e.decrementBy}`:`${Number.parseFloat(n.value)-e.decrementBy}`,error:O()}}));case"enter":case"return":{let r=Number.parseFloat(n.value);if(Number.isNaN(r))return v(W.NextFrame({state:{...n,error:_("Must provide a floating point value")}}));else return ne(Se(()=>rR(r,e.precision)),(o)=>wi(e.validate(o),{onFailure:(s)=>W.NextFrame({state:{...n,error:_(s)}}),onSuccess:(s)=>W.Submit({value:s})}))}default:return mre(mt(t.input,()=>""),n)}},JI=(e,t,n,r)=>uc("",n.message,e,t,r),Sre=(e,t,n,r,o,s)=>{let i=Dne(o,r===n.startIndex&&n.startIndex>0,r===n.endIndex-1&&n.endIndex<t.length);if(s?.plain===!0)return e===r?o.pointer+i:i+" ".repeat(o.pointer.length);if(t[r].disabled){let a=Ho(qs,o.mutedColor);return e===r?Ue(o.pointer,a)+i:i+" ".repeat(o.pointer.length)}return e===r?Ue(o.pointer,o.primaryColor)+i:i+" ".repeat(o.pointer.length)},Ere=(e,t,n,r)=>{if(r?.plain===!0)return e.title;let o=e.title;if(t)return e.disabled?at(o,Ho(rc,n.mutedColor)):at(o,Ho(rc,n.primaryColor));return e.disabled?at(o,Ho(wB,n.mutedColor)):o},sH=(e,t,n,r)=>{let o=t.choices,s=Vre(e,o.length,t.maxPerPage),i=[];for(let a=s.startIndex;a<s.endIndex;a++){let c=o[a],u=e===a,l=Sre(e,o,s,a,n,r),f=Ere(c,u,n,r),d=fre(c,u,n,r);i.push(l+f+" "+d)}return i.join(`
105
+ `)},bre,wre,vre=(e,t)=>{if(e===0)return v(W.NextFrame({state:t.length-1}));return v(W.NextFrame({state:e-1}))},kre=(e,t)=>{if(e===t.length-1)return v(W.NextFrame({state:0}));return v(W.NextFrame({state:e+1}))},Ire=(e,t)=>v(W.NextFrame({state:(e+1)%t.length})),Cre=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>bre(r,e),Submit:()=>wre(t,e)}),Tre=(e)=>H(function*(t,n){let o=yield*(yield*mo).columns,s=yield*Zt(e),i=zi+oc,a=JI(s.prefix,s.pointerSmall,e,{plain:!0}),c=sH(t,e,s,{plain:!0});return cl(`${a}
106
+ ${c}`,o)+i}),Ore=(e)=>(t,n)=>{switch(t.key.name){case"k":case"up":return vre(n,e.choices);case"j":case"down":return kre(n,e.choices);case"tab":return Ire(n,e.choices);case"enter":case"return":{let r=e.choices[n];if(r.disabled)return v(W.Beep());return v(W.Submit({value:r.value}))}default:return v(W.Beep())}},Are,_re=(e,t,n,r,o)=>{let s=e.value;if(o?.plain===!0)switch(t.type){case"hidden":return"";case"password":return n.passwordMask.repeat(s.length);case"text":return s}if(s.length===0)return"";let i=Ee(e.error)?n.errorColor:r?n.submittedColor:Ho(rc,n.primaryColor);switch(t.type){case"hidden":return"";case"password":return Ue(n.passwordMask.repeat(s.length),i);case"text":return at(s,i)}},iH=(e,t,n,r)=>{if(Ee(e.error))return Ul(e.error.value.split(cc),{onEmpty:()=>"",onNonEmpty:(o)=>{if(r?.plain===!0)return Wi(t,o.join(`
107
+ `));let s=Ue(t,n.errorColor),i=jt(o,(a)=>LI(a,n.errorColor));return kx+`
108
+ `+Wi(s,i.join(`
109
+ `))+Ix}});return""},ZI=(e,t,n,r,o,s,i=!1)=>{let a=_re(e,r,o,i,s);return uc(a,r.message,t,n,s)},Rre,Pre,Fre=(e)=>{if(e.cursor<=0)return v(W.Beep());let t=e.value.slice(0,e.cursor-1),n=e.value.slice(e.cursor),r=e.cursor-1,o=`${t}${n}`;return v(W.NextFrame({state:{...e,cursor:r,value:o,error:O()}}))},Mre=(e)=>v(W.NextFrame({state:{...e,cursor:0,value:"",error:O()}})),Nre=(e)=>{if(e.cursor<=0)return v(W.Beep());let t=e.cursor-1;return v(W.NextFrame({state:{...e,cursor:t,error:O()}}))},Dre=(e)=>{if(e.cursor>=e.value.length)return v(W.Beep());let t=Math.min(e.cursor+1,e.value.length);return v(W.NextFrame({state:{...e,cursor:t,error:O()}}))},PB=(e)=>v(W.NextFrame({state:{...e,cursor:0,error:O()}})),FB=(e)=>v(W.NextFrame({state:{...e,cursor:e.value.length,error:O()}})),$re=(e,t)=>{if(e.value===t.default)return v(W.Beep());let n=e.value.length===0?t.default:e.value;return v(W.NextFrame({state:{...e,value:n,cursor:n.length,error:O()}}))},Ure=(e,t)=>{let n=t.value.slice(0,t.cursor),r=t.value.slice(t.cursor),o=`${n}${e}${r}`,s=t.cursor+e.length;return v(W.NextFrame({state:{...t,cursor:s,value:o,error:O()}}))},Lre=(e)=>(t,n)=>W.$match(n,{Beep:()=>v(ac),NextFrame:({state:r})=>Rre(r,e),Submit:()=>Pre(t,e)}),jre=(e)=>(t,n)=>{if(t.key.ctrl)switch(t.key.name){case"u":return Mre(n);case"a":return PB(n);case"e":return FB(n);default:return v(W.Beep())}switch(t.key.name){case"backspace":return Fre(n);case"left":return Nre(n);case"right":return Dre(n);case"home":return PB(n);case"end":return FB(n);case"enter":case"return":{let r=n.value;return wi(e.validate(r),{onFailure:(o)=>W.NextFrame({state:{...n,value:r,error:_(o)}}),onSuccess:(o)=>W.Submit({value:o})})}case"tab":return $re(n,e);default:return Ure(mt(t.input,()=>""),n)}},Bre=(e)=>(t,n)=>Are(t,e),aH=(e,t)=>{let n={default:"",type:t,validate:v,...e},r={cursor:n.default.length,value:n.default,error:O()};return ic(r,{render:Lre(n),process:jre(n),clear:Bre(n)})},Hre,cH=(e,t,n,r=!1)=>{let o=Ue(n.toggleSeparator,n.mutedColor),s=Ho(rc,r?n.submittedColor:n.primaryColor),i=e?t.inactive:at(t.inactive,s);return(e?at(t.active,s):t.active)+" "+Wi(o,i)},uH=(e,t,n,r)=>uc(e,r.message,t,n),qre,zre,MB,NB,Wre=(e)=>(t,n)=>{switch(n._tag){case"Beep":return v(ac);case"NextFrame":return qre(t,e);case"Submit":return zre(t,e)}},Kre=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return NB;case"1":case"k":case"left":case"up":return MB;case" ":case"tab":return t?NB:MB;case"enter":case"return":return v(W.Submit({value:t}));default:return v(W.Beep())}},Vre=(e,t,n)=>{let r=n===void 0?t:n,o=Math.min(t-r,e-Math.floor(r/2));if(o<0)o=0;let s=Math.min(o+r,t);return{startIndex:o,endIndex:s}};var Ox=w(()=>{An();Ve();Wc();Oe();Pc();X();Xm();_e();he();Gf();$d();sx();UB={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:al,mutedColor:fp,successColor:Tx,errorColor:Cx,submittedColor:sc},Pne={...UB,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},Mne=ke("effect/unstable/cli/Prompt/Theme",{defaultValue:Fne}),$ne=p(2,(e,t)=>{let n=Object.create(qI);return n._tag="OnSuccess",n.prompt=e,n.onSuccess=t,n}),Une=p(2,(e,t)=>$ne(e,(n)=>jne(t(n)))),vn=H(function*(e){let t=yield*mo,n=yield*t.readInput;return yield*UI(e,t,n)},Pt(()=>new np({})),vi),qI={...So({label:"Prompt",evaluate(){return vn(this)}}),[DB]:{_Output:(e)=>e}},Bne=H(function*(e,t,n){let r=zn(e.initialState)?yield*e.initialState:e.initialState,o=W.NextFrame({state:r});while(!0){let s=yield*e.render(r,o);if(yield*Fr(t.display(s)),e.events){let i=Is(n).pipe(oe((c)=>({_tag:"Input",input:c}))),a=yield*_a(i,Is(e.events).pipe(oe((c)=>({_tag:"Event",value:c}))));o=yield*e.process(a,r)}else{let i=yield*Is(n);o=yield*e.process(i,r)}switch(o._tag){case"Beep":continue;case"NextFrame":{yield*Fr(t.display(yield*e.clear(r,o))),r=o.state;continue}case"Submit":{yield*Fr(t.display(yield*e.clear(r,o)));let i=yield*e.render(r,o);return yield*Fr(t.display(i)),o.value}}}},(e,t,n)=>pu(e,Fr(n.display(vB)))),W=ES(),ac=kB,cc=/\r?\n/,zne=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.prefix,n.primaryColor),o=Ue(n.pointerSmall,n.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,i=at(s,n.mutedColor),a=WI(i,r,o,t);return lp+a}),Wne=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.tick,n.successColor),o=Ue(n.ellipsis,n.mutedColor),s=e?t.label.confirm:t.label.deny;return WI(s,r,o,t)+`
110
+ `}),Vne=/^y|t$/,Gne=/^n|f$/,Qne=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.prefix,n.primaryColor),o=Ue(n.pointerSmall,n.mutedColor),s=zB(e,n),i=KI(r,o,s,t),a=Yne(e,n.pointerSmall,n);return lp+i+a}),Xne=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.tick,n.successColor),o=Ue(n.ellipsis,n.mutedColor),s=zB(e,n,!0);return KI(r,o,s,t)+`
111
+ `}),ire={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"]},ure=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,RB={1:({token:e,...t})=>new VI({token:e.replace(/\\(.)/g,"$1"),...t}),2:(e)=>new JB(e),3:(e)=>new ZB(e),4:(e)=>new YB(e),5:(e)=>new QB(e),6:(e)=>new GB(e),7:(e)=>new VB(e),8:(e)=>new KB(e),9:(e)=>new WB(e)};VI=class VI extends qo{increment(){}decrement(){}setValue(e){this.token=this.token+e}isToken(){return!0}toString(){return this.token}};WB=class WB extends qo{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(e){this.date.setMilliseconds(Number.parseInt(e.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}};KB=class KB extends qo{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(e){this.date.setSeconds(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getSeconds()}`;return this.token.length>1?e.padStart(2,"0"):e}};VB=class VB extends qo{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(e){this.date.setMinutes(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getMinutes()}`;return this.token.length>1?e.padStart(2,"0"):e}};GB=class GB extends qo{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(e){this.date.setHours(Number.parseInt(e.slice(-2)))}toString(){let e=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${e}`.padStart(2,"0"):`${e}`}};JB=class JB extends qo{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(e){this.date.setDate(Number.parseInt(e.slice(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();switch(this.token){case"DD":return`${e}`.padStart(2,"0");case"Do":return`${e}${this.ordinalIndicator(e)}`;case"d":return`${t+1}`;case"ddd":return this.locales.weekdaysShort[t];case"dddd":return this.locales.weekdays[t];default:return`${e}`}}ordinalIndicator(e){if(e>=11&&e<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}};ZB=class ZB extends qo{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(e){let t=Number.parseInt(e.slice(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let e=this.date.getMonth();switch(this.token.length){case 2:return`${e+1}`.padStart(2,"0");case 3:return this.locales.monthsShort[e];case 4:return this.locales.months[e];default:return`${e+1}`}}};YB=class YB extends qo{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(e){this.date.setFullYear(Number.parseInt(e.slice(-4)))}toString(){let e=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?e.slice(-2):e}};QB=class QB extends qo{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(e){}toString(){let e=this.date.getHours()>=12?"pm":"am";return/A/.test(this.token)?e.toUpperCase():e}};tH=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.prefix,n.primaryColor),o=Ue(n.pointerSmall,n.mutedColor),s=eH(e,n.pointerSmall,n);return GI(e,r,o,t,n)+s}),nH=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.tick,n.successColor),o=Ue(n.ellipsis,n.mutedColor);return GI(e,r,o,t,n,void 0,!0)+`
112
+ `}),bre=H(function*(e,t){let n=yield*Zt(t),r=sH(e,t,n),o=Ue(n.prefix,n.primaryColor),s=Ue(n.pointerSmall,n.mutedColor),i=JI(o,s,t);return lp+i+`
113
+ `+r}),wre=H(function*(e,t){let n=yield*Zt(t),r=t.choices[e].title,o=Ue(n.tick,n.successColor),s=Ue(n.ellipsis,n.mutedColor);return JI(o,s,t)+" "+at(r,n.submittedColor)+`
114
+ `}),Are=H(function*(e,t){let r=yield*(yield*mo).columns,o=yield*Zt(t),s=zi+oc,i=iH(e,o.pointerSmall,o,{plain:!0});return zI(ZI(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),r,i)+s}),Rre=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.prefix,n.primaryColor),o=Ue(n.pointerSmall,n.mutedColor),s=ZI(e,r,o,t,n),i=iH(e,n.pointerSmall,n),a=t.type==="password"?n.passwordMask.length:1,c=(e.cursor-e.value.length)*a;return s+i+OB(c)}),Pre=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.tick,n.successColor),o=Ue(n.ellipsis,n.mutedColor);return ZI(e,r,o,t,n,void 0,!0)+`
115
+ `}),Hre=H(function*(e){let n=yield*(yield*mo).columns,r=yield*Zt(e),o=zi+oc,s=e.active+" "+Wi(r.toggleSeparator,e.inactive),i=uc(s,e.message,r.prefix,r.pointerSmall,{plain:!0});return cl(i,n)+o}),qre=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.prefix,n.primaryColor),o=Ue(n.pointerSmall,n.mutedColor),s=cH(e,t,n),i=uH(s,r,o,t);return lp+i}),zre=H(function*(e,t){let n=yield*Zt(t),r=Ue(n.tick,n.successColor),o=Ue(n.ellipsis,n.mutedColor),s=cH(e,t,n,!0);return uH(s,r,o,t)+`
116
+ `}),MB=v(W.NextFrame({state:!0})),NB=v(W.NextFrame({state:!1}))});var lH="~effect/cli/Param",Yt="argument",It="flag",dp,Ax=(e)=>M(e,lH),fc=(e)=>e.kind==="flag",cn=(e)=>{let t=(n)=>e.kind===Yt?Jre(e.name,e.primitiveType,n):Zre(e.name,e.primitiveType,n);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??O(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},dp)},_x=(e,t)=>cn({name:t,primitiveType:mB,kind:e}),fH=(e,t)=>cn({name:t,primitiveType:lB,kind:e}),Rx=(e,t)=>cn({name:t,primitiveType:dB,kind:e}),Px=(e,t)=>cn({name:t,primitiveType:fB,kind:e}),Fx=(e,t)=>cn({name:t,primitiveType:pB,kind:e}),pp=(e,t,n)=>cn({name:t,primitiveType:hB(n),kind:e}),Mx=(e,t,n)=>{let r=n.map((o)=>[o,o]);return pp(e,t,r)},ul=(e,t,n)=>cn({name:t,kind:e,primitiveType:gB(n?.pathType??"either",n?.mustExist),typeName:n?.typeName}),Nx=(e,t,n)=>ul(e,t,{pathType:"directory",typeName:"directory",mustExist:n?.mustExist}),Dx=(e,t,n)=>ul(e,t,{pathType:"file",typeName:"file",mustExist:n?.mustExist}),$x=(e,t)=>cn({name:t,primitiveType:xB,kind:e}),Ux=(e,t)=>cn({name:t,primitiveType:NI,kind:e}),Lx=(e,t,n)=>cn({name:t,primitiveType:DI(n),kind:e}),jx=(e,t,n,r)=>cn({name:t,primitiveType:yB(n,r),kind:e}),dH=(e,t)=>dc(hc(cn({name:t,primitiveType:SB,kind:e}),{min:1}),(n)=>Object.fromEntries(n.flatMap(Object.entries))),Bx=(e)=>cn({name:"__none__",primitiveType:EB,kind:e}),Gre,pH,Hx,mH=(e)=>zs(e,(t)=>cn({...t,hidden:!0})),dc,pc=(e,t,n=[])=>{let r=n.map((o)=>()=>o().parse);return Object.assign(Object.create(dp),{_tag:"Transform",kind:e.kind,param:e,alternatives:n,f:t,parse:t(e.parse,r)})},mc,qx,lc=(e)=>{let t=H(function*(n){return gc(e),yield*e.parse(n).pipe(oe(([r,o])=>[r,_(o)]),Ub({MissingOption:()=>v([n.arguments,O()]),MissingArgument:()=>v([n.arguments,O()])}))});return Object.assign(Object.create(dp),{_tag:"Optional",kind:e.kind,param:e,parse:t})},zx,Wx,Kx,hc=(e,t)=>{let n=gc(e),r=(o)=>{if(n.kind==="argument")return Yre(e,n,o,t);else return Qre(e,n,o,t)};return Object.assign(Object.create(dp),{_tag:"Variadic",kind:e.kind,param:e,min:ns(t?.min),max:ns(t?.max),parse:r})},Vx,Gx,Jx,mp,Zx,Yx,Qx,Xx,ey,Jre,Zre,Yre,Qre,QI=(e,t)=>{let n=e;switch(n._tag){case"Single":return t.Single(n);case"Map":return t.Map(n);case"Transform":return t.Transform(n);case"Optional":return t.Optional(n);case"Variadic":return t.Variadic(n)}},zs=(e,t)=>QI(e,{Single:(n)=>t(n),Map:(n)=>dc(zs(n.param,t),n.f),Transform:(n)=>pc(zs(n.param,t),n.f,n.alternatives.map((r)=>()=>zs(r(),t))),Optional:(n)=>lc(zs(n.param,t)),Variadic:(n)=>hc(zs(n.param,t),{min:mn(n.min),max:mn(n.max)})}),ct=(e)=>QI(e,{Single:(t)=>[t],Map:(t)=>ct(t.param),Transform:(t)=>[...ct(t.param),...t.alternatives.flatMap((n)=>ct(n()))],Optional:(t)=>ct(t.param),Variadic:(t)=>ct(t.param)}),gc=(e)=>{let t=ct(e);if(t.length===0)throw Error("No Single param found in param structure");if(t.length>1)throw Error(`Multiple Single params found: ${t.map((n)=>n.name).join(", ")}`);return t[0]},er=(e)=>QI(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:O(),variadicMax:O()}),Map:(t)=>er(t.param),Transform:(t)=>er(t.param),Optional:(t)=>({...er(t.param),isOptional:!0}),Variadic:(t)=>({...er(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var zo=w(()=>{_I();Oe();X();_e();Qe();he();gn();Xa();ip();il();Ox();dp={[lH]:{_A:D},pipe(){return le(this,arguments)}},Gre=/^-+/,pH=p(2,(e,t)=>zs(e,(n)=>cn({...n,aliases:[...n.aliases,t.replace(Gre,"")]}))),Hx=p(2,(e,t)=>zs(e,(n)=>cn({...n,description:_(t)}))),dc=p(2,(e,t)=>{let n=(r)=>oe(e.parse(r),([o,s])=>[o,t(s)]);return Object.assign(Object.create(dp),{_tag:"Map",kind:e.kind,param:e,f:t,parse:n})}),mc=p(2,(e,t)=>pc(e,(n)=>(r)=>ne(n(r),([o,s])=>t(s).pipe(oe((i)=>[o,i]))))),qx=p(3,(e,t,n)=>{let r=gc(e);return pc(e,(o)=>(s)=>ne(o(s),([i,a])=>Nt({try:()=>t(a),catch:(c)=>n(c)}).pipe(Pt((c)=>new $n({option:r.name,value:String(a),expected:c,kind:r.kind})),oe((c)=>[i,c]))))}),zx=p(2,(e,t)=>{if(!zn(t))return dc(lc(e),mt(()=>t));return mc(lc(e),et({onNone:()=>t,onSome:v}))}),Wx=p(2,(e,t)=>{let n=(o,s)=>new $n({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),r=(o,s)=>Wj(t).pipe(Pt((i)=>n(o,i)),ne(et({onNone:()=>A(o),onSome:(i)=>v([s.arguments,i])})));return pc(e,(o)=>(s)=>o(s).pipe(gs(["MissingOption","MissingArgument"],(i)=>r(i,s))))}),Kx=p(2,(e,t)=>{let n=(r,o)=>ne($B(t)?v(t):t,vn).pipe(oe((s)=>[o.arguments,s]),gs("QuitError",()=>A(r)));return pc(e,(r)=>(o)=>r(o).pipe(gs(["MissingOption","MissingArgument"],(s)=>n(s,o))))}),Vx=p(3,(e,t,n)=>{if(t<0)throw Error("between: min must be non-negative");if(n<t)throw Error("between: max must be greater than or equal to min");return hc(e,{min:t,max:n})}),Gx=p(2,(e,t)=>{if(t<0)throw Error("atMost: max must be non-negative");return hc(e,{max:t})}),Jx=p(2,(e,t)=>{if(t<0)throw Error("atLeast: min must be non-negative");return hc(e,{min:t})}),mp=p(3,(e,t,n)=>mc(e,H(function*(r){let o=t(r);if(Ee(o))return o.value;let s=gc(e);return yield*new $n({option:s.name,value:String(r),expected:n(r),kind:s.kind})}))),Zx=p(3,(e,t,n)=>mp(e,Yy(t),n)),Yx=p(2,(e,t)=>zs(e,(n)=>cn({...n,typeName:t}))),Qx=p(2,(e,t)=>{let n=Us(t);return mc(e,(r)=>Pt(n(r),(o)=>{let s=gc(e);return new $n({option:s.name,value:String(r),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),Xx=p(2,(e,t)=>pc(e,(n,r)=>(o)=>Pr(n(o),()=>r[0]()(o)),[t])),ey=p(2,(e,t)=>pc(e,(n,r)=>(o)=>Pr(oe(n(o),([s,i])=>[s,G(i)]),()=>oe(r[0]()(o),([s,i])=>[s,te(i)])),[t])),Jre=H(function*(e,t,n){if(n.arguments.length===0)return yield*new gx({argument:e});let r=n.arguments[0],o=yield*Pt(t.parse(r),(s)=>new $n({option:e,value:r,expected:s,kind:"argument"}));return[n.arguments.slice(1),o]}),Zre=H(function*(e,t,n){let r=n.flags[e];if(r===void 0||r.length===0)return yield*new sp({option:e});let o=r[0],s=yield*Pt(t.parse(o),(i)=>new $n({option:e,value:o,expected:i,kind:"flag"}));return[n.arguments,s]}),Yre=H(function*(e,t,n,r){let o=[],s=r?.min??0,i=r?.max??Number.POSITIVE_INFINITY,a=0,c=n.arguments;while(c.length>0&&a<i){let[u,l]=yield*e.parse({flags:n.flags,arguments:c});o.push(l),c=u,a++}if(a<s)return yield*new $n({option:t.name,value:`${a} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind});return[c,o]}),Qre=H(function*(e,t,n,r){let o=[],i=[t.name,...t.aliases].flatMap((c)=>n.flags[c]??[]),a=i.length;if(Le(r?.min)&&a<r.min)return yield*a===0?new sp({option:t.name}):new $n({option:t.name,value:`${a} occurrences`,expected:`at least ${r.min} value${r.min===1?"":"s"}`,kind:t.kind});if(Le(r?.max)&&a>r.max)return yield*new $n({option:t.name,value:`${a} occurrences`,expected:`at most ${r.max} value${r.max===1?"":"s"}`,kind:t.kind});for(let c of i){let[,u]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(u)}return[n.arguments,o]})});var Ki={};Un(Ki,{atLeast:()=>boe,atMost:()=>woe,between:()=>voe,choice:()=>soe,choiceWithValue:()=>Ioe,date:()=>ooe,directory:()=>noe,file:()=>toe,fileParse:()=>uoe,fileSchema:()=>loe,fileText:()=>coe,filter:()=>Toe,filterMap:()=>Ooe,float:()=>roe,integer:()=>eoe,map:()=>yoe,mapEffect:()=>Soe,mapTryCatch:()=>Eoe,none:()=>foe,optional:()=>doe,orElse:()=>Aoe,orElseResult:()=>_oe,path:()=>ioe,redacted:()=>aoe,string:()=>Xre,variadic:()=>xoe,withDefault:()=>moe,withDescription:()=>poe,withFallbackConfig:()=>hoe,withFallbackPrompt:()=>goe,withMetavar:()=>Coe,withSchema:()=>koe});var Xre=(e)=>_x(Yt,e),eoe=(e)=>Rx(Yt,e),toe=(e,t)=>Dx(Yt,e,t),noe=(e,t)=>Nx(Yt,e,t),roe=(e)=>Px(Yt,e),ooe=(e)=>Fx(Yt,e),soe=(e,t)=>Mx(Yt,e,t),ioe=(e,t)=>ul(Yt,e,t),aoe=(e)=>$x(Yt,e),coe=(e)=>Ux(Yt,e),uoe=(e,t)=>Lx(Yt,e,t),loe=(e,t,n)=>jx(Yt,e,t,n),foe,doe=(e)=>lc(e),poe,moe,hoe,goe,xoe,yoe,Soe,Eoe,boe,woe,voe,koe,Ioe=(e,t)=>pp(Yt,e,t),Coe,Toe,Ooe,Aoe,_oe;var hH=w(()=>{X();zo();foe=Bx(Yt),poe=p(2,(e,t)=>Hx(e,t)),moe=zx,hoe=p(2,(e,t)=>Wx(e,t)),goe=p(2,(e,t)=>Kx(e,t)),xoe=p((e)=>Ax(e[0]),(e,t)=>hc(e,t)),yoe=p(2,(e,t)=>dc(e,t)),Soe=p(2,(e,t)=>mc(e,t)),Eoe=p(3,(e,t,n)=>qx(e,t,n)),boe=p(2,(e,t)=>Jx(e,t)),woe=p(2,(e,t)=>Gx(e,t)),voe=p(3,(e,t,n)=>Vx(e,t,n)),koe=p(2,(e,t)=>Qx(e,t)),Coe=p(2,(e,t)=>Yx(e,t)),Toe=p(3,(e,t,n)=>Zx(e,t,n)),Ooe=p(3,(e,t,n)=>mp(e,t,n)),Aoe=p(2,(e,t)=>Xx(e,t)),_oe=p(2,(e,t)=>ey(e,t))});var Roe,gH=(e)=>ce((t)=>e(t.getRef(Roe))),XI=(...e)=>gH((t)=>pe(()=>{t.error(...e)})),un=(...e)=>gH((t)=>pe(()=>{t.log(...e)}));var ty=w(()=>{rt();ht();Roe=HE});var ll,ny=(e)=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,(t)=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),Poe=(e)=>{let t=globalThis.process,n=typeof t==="object"&&t!==null,r=e?.colors!==void 0?e.colors:n&&typeof t.stdout==="object"&&t.stdout!==null&&t.stdout.isTTY===!0&&t.env?.NO_COLOR!=="1",o=r?{bold:(c)=>`\x1B[1m${c}\x1B[0m`,dim:(c)=>`\x1B[2m${c}\x1B[0m`,cyan:(c)=>`\x1B[36m${c}\x1B[0m`,green:(c)=>`\x1B[32m${c}\x1B[0m`,blue:(c)=>`\x1B[34m${c}\x1B[0m`,yellow:(c)=>`\x1B[33m${c}\x1B[0m`,magenta:(c)=>`\x1B[35m${c}\x1B[0m`}:{bold:(c)=>c,dim:(c)=>c,cyan:(c)=>c,green:(c)=>c,blue:(c)=>c,yellow:(c)=>c,magenta:(c)=>c},s=r?"\x1B[0m":"",i=r?"\x1B[31m":"",a=r?"\x1B[1m":"";return{formatHelpDoc:(c)=>Noe(c,o),formatCliError:(c)=>ny(c.message),formatError:(c)=>`
117
+ ${a}${i}ERROR${s}
118
+ ${ny(c.message)}${s}`,formatErrors:(c)=>{if(c.length===0)return"";if(c.length===1)return`
119
+ ${a}${i}ERROR${s}
120
+ ${ny(c[0].message)}${s}`;let u=new Map;for(let f of c){let d=f._tag??"Error",m=u.get(d)??[];m.push(f),u.set(d,m)}let l=[];l.push(`
121
+ ${a}${i}ERRORS${s}`);for(let[,f]of u)for(let d of f)l.push(` ${ny(d.message)}${s}`);return l.join(`
122
+ `)},formatVersion:(c,u)=>`${o.bold(c)} ${o.dim("v")}${o.bold(u)}`}},Foe=(e)=>e.replace(/\u001B\[[0-9;]*m/g,""),t0=(e)=>Foe(e).length,Moe=(e,t)=>{let n=t0(e),r=Math.max(0,t-n);return e+" ".repeat(r)},hp=(e,t)=>{let n=Math.max(...e.map((o)=>t0(o.left)))+4,r=t===void 0?n:Math.min(n,t);return e.map(({left:o,right:s})=>` ${Moe(o,Math.max(r,t0(o)+1))}${s}`).join(`
123
+ `)},xH=(e,t)=>t?`${e}, ${t}`:e,Noe=(e,t)=>{let n=[];if(e.description)n.push(t.bold("DESCRIPTION")),n.push(` ${e.description}`),n.push("");if(n.push(t.bold("USAGE")),n.push(` ${t.cyan(e.usage)}`),n.push(""),e.args&&e.args.length>0){n.push(t.bold("ARGUMENTS"));let r=e.args.map((o)=>{let s=o.name;if(o.variadic)s+="...";let i=t.green(s),a=t.dim(o.type),c=`${i} ${a}`,u=o.required?"":t.dim(" (optional)"),l=mt(o.description,()=>"")+u;return{left:c,right:l}});n.push(hp(r,25)),n.push("")}if(e.flags.length>0){n.push(t.bold("FLAGS"));let r=e.flags.map((o)=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let i=s.join(", "),a=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:i+a,right:mt(o.description,()=>"")}});n.push(hp(r)),n.push("")}if(e.globalFlags&&e.globalFlags.length>0){n.push(t.bold("GLOBAL FLAGS"));let r=e.globalFlags.map((o)=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let i=s.join(", "),a=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:i+a,right:mt(o.description,()=>"")}});n.push(hp(r)),n.push("")}if(e.subcommands&&e.subcommands.length>0){let r=e.subcommands.find((o)=>o.group===void 0);if(r){if(n.push(t.bold("SUBCOMMANDS")),n.push(hp(r.commands.map((o)=>({left:t.cyan(xH(o.name,o.alias)),right:o.shortDescription??o.description})),20)),e.subcommands.length>1)n.push("")}for(let o of e.subcommands){if(o.group===void 0)continue;n.push(t.bold(`${o.group}:`)),n.push(hp(o.commands.map((s)=>({left:t.cyan(xH(s.name,s.alias)),right:s.shortDescription??s.description})),20)),n.push("")}}if(e.examples&&e.examples.length>0){n.push(t.bold("EXAMPLES"));let r=!0,o=!1;for(let s of e.examples){if(s.description){if(!r)n.push("");n.push(` ${t.dim(`# ${s.description}`)}`)}else if(o)n.push("");n.push(` ${t.cyan(s.command)}`),r=!1,o=!!s.description}n.push("")}if(n[n.length-1]==="")n.pop();return n.join(`
124
+ `)};var n0=w(()=>{Ve();_e();ll=ke("effect/cli/CliOutput",{defaultValue:()=>Poe()})});var gp=(e)=>e.replace(/'/g,"'\\''"),r0=(e)=>e.replace(/[^a-zA-Z0-9_]/g,"_"),o0=(e)=>{let t=[`--${e.name}`];for(let n of e.aliases)t.push(n.length===1?`-${n}`:`--${n}`);if(e.type._tag==="Boolean")t.push(`--no-${e.name}`);return t},Doe=(e,t)=>{if(e.length===0)return;let n=e.map(o0);t.push(` local ${n.map((r,o)=>`_used_${o}=""`).join(" ")}`),t.push(" for ((i = 1; i < cword; i++)); do"),t.push(' case "${words[i]%%=*}" in'),n.forEach((r,o)=>{t.push(` ${r.join("|")}) _used_${o}=1 ;;`)}),t.push(" esac"),t.push(" done"),t.push(' local _filtered_flags=""'),n.forEach((r,o)=>{t.push(` [[ -n "$_used_${o}" ]] || _filtered_flags+=" ${r.join(" ")}"`)}),t.push("")},$oe=(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("")},SH=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map((n)=>`'${gp(n)}'`).join(" ")}`,Uoe=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return SH(t,e.values);case"Path":if(e.pathType==="directory")return'COMPREPLY=( $(compgen -d -- "$cur") )';return'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},Loe=(e,t)=>{switch(e._tag){case"Choice":return SH(t,e.values);case"Path":if(e.pathType==="directory")return'COMPREPLY=( $(compgen -d -- "$cur") )';return'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},EH=(e,t,n,r)=>{let o=[...t,e.name],s=`_${o.map(r0).join("_")}`;if(n.push(`${s}()`),n.push("{"),n.push(" local cur prev words cword i"),n.push(t.length===0?" local _command_index=0":' local _command_index="$1"'),n.push(' _init_completion -n "$COMP_WORDBREAKS" || return'),t.length===0)n.push(' local _comp_word="$2"');n.push("");let i=e.flags.filter((c)=>c.type._tag!=="Boolean");if(i.length>0){n.push(" # Flag value completions"),n.push(' case "$prev" in');for(let c of i){let u=[`--${c.name}`];for(let f of c.aliases)u.push(f.length===1?`-${f}`:`--${f}`);let l=Uoe(c.type,r);if(l)n.push(` ${u.join("|")})`),n.push(` ${l}`),n.push(" return"),n.push(" ;;")}n.push(" esac"),n.push("")}if(e.subcommands.length>0){n.push(" # Subcommand dispatch"),n.push(" local cmd _skip_next=0"),n.push(" for ((i = _command_index + 1; i < cword; i++)); do"),n.push(" if (( _skip_next )); then"),n.push(" _skip_next=0"),n.push(" continue"),n.push(" fi"),n.push(' case "${words[i]}" in');for(let c of e.flags){if(c.type._tag==="Boolean")continue;let u=o0(c);n.push(` ${u.join("|")}) _skip_next=1 ;;`),n.push(` ${u.map((l)=>`${l}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let u=`_${[...o,c.name].map(r0).join("_")}`;n.push(` ${c.name})`),n.push(` ${u} "$i"`),n.push(" return"),n.push(" ;;")}n.push(" esac"),n.push(" done"),n.push("")}if(Doe(e.flags,n),e.flags.length>0||e.subcommands.length>0){if(n.push(" # Complete flags (filtered) and subcommands"),n.push(' if [[ "$cur" == -* ]]; then'),e.flags.length>0)n.push(' COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )');n.push(" return"),n.push(" fi"),n.push("")}let a=e.arguments.flatMap((c,u)=>{let l=Loe(c.type,r);return l===void 0?[]:[{argument:c,completion:l,index:u}]});if(a.length>0){n.push(" # Positional argument completions"),n.push(" local _position=0 _skip_next=0 _end_of_options=0"),n.push(" for ((i = _command_index + 1; i < cword; i++)); do"),n.push(" if (( _skip_next )); then"),n.push(" _skip_next=0"),n.push(" continue"),n.push(" fi"),n.push(" if (( _end_of_options )); then"),n.push(" ((_position += 1))"),n.push(" continue"),n.push(" fi"),n.push(' case "${words[i]}" in'),n.push(" --) _end_of_options=1 ;;");for(let u of e.flags){let l=o0(u);if(u.type._tag==="Boolean")n.push(` ${l.join("|")}) ;;`);else n.push(` ${l.join("|")}) _skip_next=1 ;;`),n.push(` ${l.map((f)=>`${f}=*`).join("|")}) ;;`)}n.push(" -*) ;;"),n.push(" *) ((_position += 1)) ;;"),n.push(" esac"),n.push(" done"),n.push(' case "$_position" in');for(let{argument:u,completion:l,index:f}of a){if(u.variadic)continue;n.push(` ${f})`),n.push(` ${l}`),n.push(" return"),n.push(" ;;")}n.push(" esac");let c=a.find(({argument:u})=>u.variadic);if(c!==void 0)n.push(` if (( _position >= ${c.index} )); then`),n.push(` ${c.completion}`),n.push(" return"),n.push(" fi")}else if(e.subcommands.length>0){let c=e.subcommands.map((u)=>u.name);n.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}n.push("}"),n.push("");for(let c of e.subcommands)EH(c,o,n,r)},bH=(e,t)=>{let n=[],r=r0(e),o=`_${r}--choices`;return n.push(`###-begin-${gp(e)}-completions-###`),n.push("#"),n.push("# Static completion script for Bash"),n.push("#"),n.push("# Installation:"),n.push(`# ${gp(e)} --completions bash >> ~/.bashrc`),n.push("#"),n.push(""),n.push("if ! type _init_completion &>/dev/null; then"),n.push(" _init_completion()"),n.push(" {"),n.push(" COMPREPLY=()"),n.push(' local _i _j=0 _piece _line="$COMP_LINE"'),n.push(' words=("${COMP_WORDS[0]}")'),n.push(" cword=0"),n.push(' _line="${_line#*"${COMP_WORDS[0]}"}"'),n.push(" for ((_i = 1; _i < ${#COMP_WORDS[@]}; _i++)); do"),n.push(' _piece="${COMP_WORDS[_i]}"'),n.push(' if [[ "$_line" == [[:blank:]]* ]]; then'),n.push(" ((_j++))"),n.push(' words[_j]="$_piece"'),n.push(" else"),n.push(' words[_j]="${words[_j]}$_piece"'),n.push(" fi"),n.push(" ((_i == COMP_CWORD)) && cword=$_j"),n.push(' _line="${_line#*"$_piece"}"'),n.push(" done"),n.push(' cur="${words[cword]}"'),n.push(' prev=""'),n.push(' ((cword > 0)) && prev="${words[cword-1]}"'),n.push(" return 0"),n.push(" }"),n.push("fi"),n.push(""),$oe(o,n),EH(t,[],n,o),n.push(`complete -F _${r} ${gp(e)}`),n.push(`###-end-${gp(e)}-completions-###`),n.join(`
125
+ `)};var Vi=(e)=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),wH=(e)=>Vi(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),Boe=(e,t)=>{if(e.length===0){if(t.length>0)return"__fish_use_subcommand";return""}let n=e.map((r)=>`__fish_seen_subcommand_from ${r}`).join("; and ");if(t.length>0)return`${n}; and not __fish_seen_subcommand_from ${t.join(" ")}`;return n},s0=(e)=>{let t=[];for(let n of e.aliases)if(n.length===1)t.push(`-s ${n}`);t.push(e.name);for(let n of e.aliases)if(n.length>1)t.push(n);if(e.type._tag==="Boolean")t.push(`no-${e.name}`);return`not __fish_contains_opt ${t.join(" ")}`},Hoe=(e)=>{let t=[`--${e.name}`];for(let n of e.aliases)t.push(n.length===1?`-${n}`:`--${n}`);return`begin; ${s0(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},qoe=(e)=>{let t=[`-l ${e.name}`];for(let r of e.aliases)if(r.length===1)t.push(`-s ${r}`);else t.push(`-l ${r}`);if(e.description)t.push(`-d '${Vi(e.description)}'`);let n=zoe(e.type);if(n)t.push(n);return t},zoe=(e)=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(wH).join(" ")}'`;case"Path":if(e.pathType==="directory")return"-r -F";return"-r -F";default:return"-r -f"}},Woe=(e)=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(wH).join(" ")}'`;case"Path":return"-r -F";default:return}},vH=(e,t,n,r)=>{let o=t.subcommands.map((c)=>c.name),s=Boe(n,o),i=s?`-n '${s}'`:"";if(!t.arguments.some((c)=>c.type._tag==="Path")){let c=[`complete -c ${e}`];if(i)c.push(i);c.push("-f"),r.push(c.join(" "))}for(let c of t.subcommands){let u=[`complete -c ${e}`];if(i)u.push(i);if(u.push(`-f -a '${Vi(c.name)}'`),c.description)u.push(`-d '${Vi(c.description)}'`);r.push(u.join(" "))}for(let c of t.flags){let u=c.type._tag==="Boolean",l=u?s0(c):Hoe(c),f=s?`${s}; and ${l}`:l,d=f?`-n '${f}'`:"",m=[`complete -c ${e}`];if(d)m.push(d);if(m.push(...qoe(c)),r.push(m.join(" ")),u){let g=[`complete -c ${e}`];if(d)g.push(d);if(g.push(`-l no-${c.name}`),c.description)g.push(`-d '${Vi(`Disable ${c.name}`)}'`);r.push(g.join(" "))}}if(t.flags.length>0){let u=s?`${s}; and not string match -q -- "-*" (commandline -ct)`:'not string match -q -- "-*" (commandline -ct)';for(let l of t.flags){let f=`${u}; and ${s0(l)}`,d=l.type._tag==="Boolean",m=[`complete -c ${e}`];if(m.push(`-n '${f}'`),m.push(`-f -a '--${l.name}'`),l.description)m.push(`-d '${Vi(l.description)}'`);if(r.push(m.join(" ")),d){let g=[`complete -c ${e}`];if(g.push(`-n '${f}'`),g.push(`-f -a '--no-${l.name}'`),l.description)g.push(`-d '${Vi(`Disable ${l.name}`)}'`);r.push(g.join(" "))}}}for(let c of t.arguments){let u=Woe(c.type);if(u){let l=[`complete -c ${e}`];if(i)l.push(i);if(l.push(u),c.description)l.push(`-d '${Vi(c.description)}'`);r.push(l.join(" "))}}for(let c of t.subcommands)vH(e,c,[...n,c.name],r)},kH=(e,t)=>{let n=[];return n.push(`###-begin-${e}-completions-###`),n.push("#"),n.push("# Static completion script for Fish"),n.push("#"),n.push("# Installation:"),n.push(`# ${e} --completions fish > ~/.config/fish/completions/${e}.fish`),n.push("#"),n.push(""),vH(e,t,[],n),n.push(""),n.push(`###-end-${e}-completions-###`),n.join(`
126
+ `)};var ry=(e)=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),TH=(e)=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),i0=(e)=>e.replace(/[^a-zA-Z0-9_]/g,"_"),Voe=(e)=>{let t=[`--${e.name}`];for(let n of e.aliases)t.push(n.length===1?`-${n}`:`--${n}`);if(e.type._tag==="Boolean")t.push(`--no-${e.name}`);return t},Goe=(e)=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(TH).join(" ")})`;case"Path":return e.pathType==="directory"?":directory:_directories":":file:_files";case"Integer":return":integer:";case"Float":return":float:";case"Date":return":date:";default:return":value:"}},Joe=(e)=>{switch(e._tag){case"Choice":return`(${e.values.map(TH).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},IH=(e)=>{let t=[],n=e.description?`[${ry(e.description)}]`:"",r=Goe(e.type),o=`(${Voe(e).join(" ")})`;t.push(`'${o}--${e.name}${n}${r}'`);for(let s of e.aliases){let i=s.length===1?"-":"--";t.push(`'${o}${i}${s}${n}${r}'`)}if(e.type._tag==="Boolean"){let s=e.description?`[${ry(`Disable ${e.name}`)}]`:"";t.push(`'${o}--no-${e.name}${s}'`)}return t},CH=(e)=>{let t=e.description?ry(e.description):e.name,n=Joe(e.type);return`'${e.variadic?"*":""}:${t}:${n}'`},OH=(e,t,n)=>{let r=[...t,e.name],o=`_${r.map(i0).join("_")}`;if(n.push(`${o}() {`),e.subcommands.length>0){n.push(" local context state state_descr line"),n.push(" typeset -A opt_args"),n.push(""),n.push(" local -a commands"),n.push(" commands=(");for(let s of e.subcommands){let i=s.description?ry(s.description):"";n.push(` '${s.name}:${i}'`)}n.push(" )"),n.push(""),n.push(" local -a specs"),n.push(" specs=(");for(let s of e.flags)for(let i of IH(s))n.push(` ${i}`);if(e.arguments.length>0){n.push(" -"),n.push(" parent-arguments");for(let s of e.arguments)n.push(` ${CH(s)}`);n.push(" -"),n.push(" subcommands")}n.push(" '1:command:->command'"),n.push(" '*::arg:->args'"),n.push(" )"),n.push(""),n.push(' _arguments -C "${specs[@]}"'),n.push(""),n.push(' case "$state" in'),n.push(" command)"),n.push(" _describe -t commands 'commands' commands"),n.push(" ;;"),n.push(" args)"),n.push(' case "$words[1]" in');for(let s of e.subcommands){let i=`_${[...r,s.name].map(i0).join("_")}`;n.push(` ${s.name})`),n.push(` ${i}`),n.push(" ;;")}n.push(" esac"),n.push(" ;;"),n.push(" esac")}else{let s=[];for(let i of e.flags)s.push(...IH(i));for(let i of e.arguments)s.push(CH(i));if(s.length>0){n.push(" local -a specs"),n.push(" specs=(");for(let i of s)n.push(` ${i}`);n.push(" )"),n.push(' _arguments "${specs[@]}"')}}n.push("}"),n.push("");for(let s of e.subcommands)OH(s,r,n)},AH=(e,t)=>{let n=[],r=i0(e);return n.push(`#compdef ${e}`),n.push(`###-begin-${e}-completions-###`),n.push("#"),n.push("# Static completion script for Zsh"),n.push("#"),n.push("# Installation:"),n.push(`# ${e} --completions zsh > ~/.zsh/completions/_${e}`),n.push("# then add ~/.zsh/completions to your fpath"),n.push("#"),n.push(""),OH(t,[],n),n.push("# Handle both direct invocation and autoload"),n.push('if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then'),n.push(` _${r} "$@"`),n.push("else"),n.push(` compdef _${r} ${e}`),n.push("fi"),n.push(`###-end-${e}-completions-###`),n.join(`
127
+ `)};var _H=(e,t,n)=>{switch(t){case"bash":return bH(e,n);case"zsh":return AH(e,n);case"fish":return kH(e,n)}};var RH=()=>{};var Ct={};Un(Ct,{atLeast:()=>gse,atMost:()=>xse,between:()=>yse,boolean:()=>xp,choice:()=>c0,choiceWithValue:()=>a0,date:()=>tse,directory:()=>ose,file:()=>rse,fileParse:()=>ase,fileSchema:()=>cse,fileText:()=>ise,filter:()=>Ese,filterMap:()=>Sse,float:()=>ese,integer:()=>Xoe,keyValuePair:()=>use,map:()=>u0,mapEffect:()=>mse,mapTryCatch:()=>hse,none:()=>lse,optional:()=>iy,orElse:()=>bse,orElseResult:()=>wse,path:()=>nse,redacted:()=>sse,string:()=>Qoe,withAlias:()=>oy,withDefault:()=>yp,withDescription:()=>xc,withFallbackConfig:()=>dse,withFallbackPrompt:()=>pse,withHidden:()=>fse,withMetavar:()=>sy,withSchema:()=>vse});var Qoe=(e)=>_x(It,e),xp=(e)=>fH(It,e),Xoe=(e)=>Rx(It,e),ese=(e)=>Px(It,e),tse=(e)=>Fx(It,e),a0=(e,t)=>pp(It,e,t),c0=(e,t)=>Mx(It,e,t),nse=(e,t)=>ul(It,e,t),rse=(e,t)=>Dx(It,e,t),ose=(e,t)=>Nx(It,e,t),sse=(e)=>$x(It,e),ise=(e)=>Ux(It,e),ase=(e,t)=>Lx(It,e,t),cse=(e,t,n)=>jx(It,e,t,n),use=(e)=>dH(It,e),lse,oy,xc,sy,fse=(e)=>mH(e),iy=(e)=>lc(e),yp,dse,pse,u0,mse,hse,gse,xse,yse,Sse,Ese,bse,wse,vse;var l0=w(()=>{X();zo();lse=Bx(It),oy=p(2,(e,t)=>pH(e,t)),xc=p(2,(e,t)=>Hx(e,t)),sy=p(2,(e,t)=>Yx(e,t)),yp=zx,dse=p(2,(e,t)=>Wx(e,t)),pse=p(2,(e,t)=>Kx(e,t)),u0=p(2,(e,t)=>dc(e,t)),mse=p(2,(e,t)=>mc(e,t)),hse=p(3,(e,t,n)=>qx(e,t,n)),gse=p(2,(e,t)=>Jx(e,t)),xse=p(2,(e,t)=>Gx(e,t)),yse=p(3,(e,t,n)=>Vx(e,t,n)),Sse=p(3,(e,t,n)=>mp(e,t,n)),Ese=p(3,(e,t,n)=>Zx(e,t,n)),bse=p(2,(e,t)=>Xx(e,t)),wse=p(2,(e,t)=>ey(e,t)),vse=p(2,(e,t)=>Qx(e,t))});var ay="~effect/cli/Command/Config/Internal",cy=(e)=>{let t=[],n=[],r=[];function o(i){let a=Object.create(null);for(let c of Object.keys(i))a[c]=s(i[c]);return a}function s(i){if(Array.isArray(i))return{_tag:"Array",children:i.map((a)=>s(a))};else if(Ax(i)){let a=t.length;if(t.push(i),i.kind==="argument")r.push(i);else n.push(i);return{_tag:"Param",index:a}}else return{_tag:"Nested",tree:o(i)}}return{[ay]:ay,flags:n,arguments:r,orderedParams:t,tree:o(e)}},PH,FH=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map((n)=>FH(n,t))};case"Nested":return{_tag:"Nested",tree:MH(e.tree,t)}}},MH=(e,t)=>{let n=Object.create(null);for(let r of Object.keys(e))n[r]=FH(e[r],t);return n},f0=(e,t)=>{let n=e.orderedParams.length;return{[ay]:ay,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,MH(t.tree,n))}},d0=(e,t)=>{let n={};for(let o of Object.keys(e))U(n,o,r(e[o]));return n;function r(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map((s)=>r(s));case"Nested":return d0(o.tree,t)}}};var p0=w(()=>{zo();PH=cy({})});var Sp="~effect/cli/Command",Me=(e)=>e,kse,tr=(e)=>{let t=e.config,n=e.contextConfig??PH,r=e.service??ze(`${Sp}/${e.name}`),o=e.annotations??hn(),s=e.globalFlags??[],i=e.subcommands??[],a=(f,d)=>Le(e.handle)?e.handle(f,d):A(new qi({commandPath:d,errors:[]})),c=e.parse??uy(t),u=e.parseContext??uy(n,{allowLeftovers:!0}),l=(f)=>{let d=[],m=[];for(let I of t.arguments){let C=ct(I),S=er(I);for(let y of C)d.push({name:y.name,type:y.typeName??cp(y.primitiveType),description:y.description,required:!S.isOptional&&(!S.isVariadic||Qy(S.variadicMin,(h)=>h>0)),variadic:S.isVariadic})}let g=f.length>0?f.join(" "):e.name;if(i.some((I)=>I.commands.some((C)=>!C.unlisted)))g+=" <subcommand>";g+=" [flags]";for(let I of d){let C=I.variadic?`<${I.name}...>`:`<${I.name}>`;g+=` ${I.required?C:`[${C}]`}`}for(let I of t.flags){let C=ct(I),S=er(I);for(let y of C){if(y.hidden)continue;m.push(ly(y,S))}}let b=[];for(let I of i){let C=I.commands.filter((S)=>!S.unlisted);if(C.length===0)continue;b.push({group:I.group,commands:jt(C,(S)=>({name:S.name,alias:S.alias,shortDescription:S.shortDescription,description:S.description??""}))})}let x=e.examples??[];return{description:e.description??"",usage:g,flags:m,annotations:o,...d.length>0&&{args:d},...b.length>0&&{subcommands:b},...x.length>0&&{examples:x}}};return Object.assign(Object.create(kse),{[Sp]:Sp,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:i,unlisted:e.unlisted??!1,config:t,contextConfig:n,service:r,parse:c,parseContext:u,handle:a,buildHelpDoc:l,...Le(e.description)?{description:e.description}:{},...Le(e.shortDescription)?{shortDescription:e.shortDescription}:{},...Le(e.alias)?{alias:e.alias}:{}})},ly=(e,t)=>{let n=e.aliases.map((r)=>r.length===1?`-${r}`:`--${r}`);return{name:e.name,aliases:n,type:e.typeName??cp(e.primitiveType),description:Ise(e.description,Hs(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},Ise=(e,t)=>{if(t===void 0||t.length===0)return e;let n=`(choices: ${t.join(", ")})`;return et(e,{onNone:()=>_(n),onSome:(r)=>_(`${r} ${n}`)})},uy=(e,t)=>H(function*(n){let r={flags:n.flags,arguments:n.arguments},[o,s]=yield*Cse(r,e.orderedParams);if(t?.allowLeftovers!==!0&&o.length>0)return yield*new xx({arguments:o});return d0(e.tree,s)}),Cse,m0=(e,t,n)=>{let r=Me(e),o=new Set;((i)=>{for(let a of i){let c=ct(a);for(let u of c)o.add(u.name)}})((n?.contextConfig??r.contextConfig).flags);for(let i of t){let a=Me(i);for(let c of a.config.flags){let u=ct(c);for(let l of u)if(o.has(l.name))throw new hx({option:l.name,parentCommand:e.name,childCommand:i.name})}}};var fl=w(()=>{An();Ve();Oe();Pc();_e();he();ip();zo();il();p0();kse={...So({label:"Command",evaluate(){return Me(this).service}})},Cse=H(function*(e,t){let n=[],r=e.arguments;for(let o of t){let[s,i]=yield*o.parse({flags:e.flags,arguments:r});n.push(i),r=s}return[r,n]})});var Tse=(e)=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Hs(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:$I(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},Ose=(e)=>{switch(e.primitiveType._tag){case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Hs(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:$I(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},h0=(e)=>{let n=Me(e).config,r=[];for(let i of n.flags){let a=ct(i);for(let c of a){if(c.kind!=="flag")continue;if(c.hidden)continue;r.push({name:c.name,aliases:c.aliases,description:mn(c.description),type:Tse(c)})}}let o=[];for(let i of n.arguments){let a=ct(i),c=er(i);for(let u of a){if(u.kind!=="argument")continue;o.push({name:u.name,description:mn(u.description),required:!c.isOptional,variadic:c.isVariadic,type:Ose(u)})}}let s=[];for(let i of e.subcommands)for(let a of i.commands){if(a.unlisted)continue;s.push(h0(a))}return{name:e.name,description:e.shortDescription??e.description,flags:r,arguments:o,subcommands:s}};var NH=w(()=>{_e();zo();il();fl()});var g0=(e)=>{let t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r),n.push(r)}return n},DH=(e,t)=>{let n=[e],r=e;for(let o=1;o<t.length;o++){let s=t[o],i=void 0;for(let a of r.subcommands)if(i=a.commands.find((c)=>c.name===s),i)break;if(!i)break;n.push(i),r=i}return n},x0=(e,t,n)=>{let o=DH(e,t).flatMap((s)=>Me(s).globalFlags);return g0([...n,...o])},_se=(e)=>{let t=[],n=(r)=>{let o=Me(r);for(let s of o.globalFlags)t.push(s);for(let s of r.subcommands)for(let i of s.commands)n(i)};return n(e),g0(t)},Rse=(e,t)=>{if(e.length<=1)return[];let n=new Set(t.map((o)=>o.name)),r=[];for(let o of e.slice(0,-1)){let s=Me(o);for(let i of s.contextConfig.flags){let a=ct(i),c=er(i);for(let u of a){if(n.has(u.name))continue;if(u.hidden)continue;n.add(u.name),r.push(ly(u,c))}}}return r},$H=(e,t)=>g0([...t,..._se(e)]),fy=(e,t,n)=>qt(function*(){let r=DH(e,t),o=r.length>0?r[r.length-1]:e,s=Me(o).buildHelpDoc(t),i=Rse(r,s.flags),a=x0(e,t,n),c=[];for(let u of a){let l=ct(u.flag),f=er(u.flag);for(let d of l){if(d.hidden)continue;c.push({...ly(d,f),required:!1})}}return{...s,flags:[...i,...s.flags],globalFlags:c}});var y0=w(()=>{Oe();zo();fl()});var dy=(e)=>({_tag:"Action",flag:e.flag,run:e.run}),Fse=(e)=>(t)=>{UH+=1;let n=ze(`effect/unstable/cli/GlobalFlag/${e}/${UH}`);return Object.assign(n,{_tag:"Setting",id:e,flag:t.flag})},UH=0,Mse,Nse,S0,Dse,dl,LH;var E0=w(()=>{ty();Ve();Oe();_e();n0();RH();l0();NH();y0();Mse=dy({flag:xp("help").pipe(oy("h"),xc("Show help information"),yp(!1)),run:H(function*(e,{builtIns:t,command:n,commandPath:r}){let o=yield*ll,s=yield*fy(n,r,t);yield*un(o.formatHelpDoc(s))})}),Nse=dy({flag:xp("version").pipe(oy("v"),xc("Show version information"),yp(!1)),run:H(function*(e,{command:t,version:n}){let r=yield*ll;yield*un(r.formatVersion(t.name,n))})}),S0=dy({flag:xp("wizard").pipe(xc("Start wizard mode for a command"),yp(!1)),run:()=>Te}),Dse=dy({flag:c0("completions",["bash","zsh","fish","sh"]).pipe(iy,u0((e)=>en(e,(t)=>t==="sh"?"bash":t)),sy("<bash|zsh|fish|sh>"),xc("Print shell completion script")),run:H(function*(e,{command:t}){if(me(e))return;let n=h0(t);yield*un(_H(t.name,e.value,n))})}),dl=Fse("log-level")({flag:a0("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(iy,xc("Sets the minimum log level"),sy("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),LH=[Mse,Nse,S0,Dse,dl]});var py,$se;var BH=w(()=>{Ve();E0();py=class py extends ke("effect/unstable/cli/CliConfig",{defaultValue:()=>$se}){};$se={builtIns:LH}});function qH(e){let t=e.indexOf("--");if(t===-1)return{tokens:HH(e),trailingOperands:[]};return{tokens:HH(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var HH=(e)=>{let t=[];for(let n of e)if(!n.startsWith("-"))t.push({_tag:"Value",value:n});else if(n.startsWith("--")){let r=n.indexOf("=");if(r!==-1){let o=n.slice(2,r),s=n.slice(r+1);t.push({_tag:"LongOption",name:o,raw:n,value:s})}else t.push({_tag:"LongOption",name:n.slice(2),raw:n})}else if(n.length>1){let r=n.slice(1),o=r.indexOf("=");if(o!==-1){let s=r.slice(0,o),i=r.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:i})}else for(let s of r)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:n});return t};var jse=(e,t)=>{let n=e.length,r=t.length,o=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let s=0;s<=n;s++)o[s][0]=s;for(let s=0;s<=r;s++)o[0][s]=s;for(let s=1;s<=n;s++)for(let i=1;i<=r;i++){let a=e[s-1]===t[i-1]?0:1;o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+a)}return o[n][r]},b0=(e,t)=>{let n=t.map((o)=>[jse(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(n.length===0)return[];let r=n[0][0];return n.filter(([o])=>o===r).map(([,o])=>o)};var v0=(e)=>et(e.subcommand,{onNone:()=>[],onSome:(t)=>[t.name,...v0(t.parsedInput)]}),k0=(e,t,n=[])=>qt(function*(){let{tokens:r,trailingOperands:o}=e,s=[...n,t.name],i=Me(t),c=i.config.flags.flatMap(ct).filter(fc),u=ml(c),f=i.contextConfig.flags.flatMap(ct).filter(fc),d=ml(f),m=new Set(f.map((S)=>S.name)),g={command:t,commandPath:s,flagRegistry:u,inheritedFlagRegistry:d,localFlagNames:c.filter((S)=>!m.has(S.name)).map((S)=>S.name)},b=Xse(r,g);if(b._tag==="Leaf")return{flags:b.flags,arguments:[...b.arguments,...o],subcommand:O(),...b.errors.length>0&&{errors:b.errors}};let x={tokens:b.childTokens,trailingOperands:o},I=yield*k0(x,b.sub,s),C=[...b.errors,...I.errors??[]];return{flags:b.flags,arguments:[],subcommand:_({name:b.sub.name,parsedInput:I}),...C.length>0&&{errors:C}}}),my=(e)=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},ml=(e)=>{let t=new Map;for(let n of e){if(t.has(n.name))throw Error(`Duplicate flag name "${n.name}" in command definition`);t.set(n.name,n);for(let r of n.aliases){if(t.has(r))throw Error(`Duplicate flag/alias "${r}" in command definition (conflicts with "${t.get(r).name}")`);t.set(r,n)}}return{params:e,index:t}},KH=(e)=>{let t=new Map,n=(r,o)=>{let s=t.get(r);if(s&&s!==o)throw Error(`Duplicate subcommand name/alias "${r}" in command definition (conflicts with "${s.name}")`);t.set(r,o)};for(let r of e)for(let o of r.commands)if(n(o.name,o),o.alias&&o.alias!==o.name)n(o.alias,o);return t},I0=(e)=>Object.fromEntries(e.map((t)=>[t.name,[]])),Bse=(e)=>{let t=I0(e);return{add:(n,r)=>{if(r!==void 0)t[n].push(r)},merge:(n)=>{for(let r in n){let o=n[r];if(o?.length)for(let s=0;s<o.length;s++)t[r].push(o[s])}},snapshot:()=>t}},hy=(e)=>e._tag==="LongOption"||e._tag==="ShortOption",VH=(e)=>e._tag==="LongOption"?e.name:e.flag,pl=(e,t)=>{let n=VH(e),r=t.index.get(n);if(r&&r.name===n)return{param:r,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&&wx(s.primitiveType))return{param:s,negated:!0}}if(r)return{param:r,negated:!1};return},zH=(e,t,n)=>new $n({option:t.name,value:n,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),Hse=(e)=>{let t=Hs(e.primitiveType);return new $n({option:e.name,value:"",expected:t===void 0?e.typeName??cp(e.primitiveType):t.join(" | "),kind:"flag"})},WH=(e)=>e?._tag==="Value"&&(cB(e.value)||uB(e.value))?e.value:void 0,GH=(e,t,n,r=!1)=>{let o=Ep(e,t,n,r);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},Ep=(e,t,n,r=!1)=>{if(r){if(t.value!==void 0)return{_tag:"Error",error:zH(t,n,t.value),tokens:[]};let s=WH(e.peek());if(s!==void 0){let i=e.take();return{_tag:"Error",error:zH(t,n,s),tokens:i===void 0?[]:[i]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(wx(n.primitiveType)){let s=WH(e.peek()),i=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:i===void 0?[]:[i]}}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:Hse(n),tokens:[]}},qse=(e,t)=>{let n=I0(t.params),r=[],o=[],s=my(e);for(let i=s.take();i;i=s.take()){if(!hy(i)){r.push(i);continue}let a=pl(i,t);if(!a){r.push(i);continue}let c=GH(s,i,a.param,a.negated);if(c._tag==="Error"){o.push(c.error);continue}if(c.value!==void 0)n[a.param.name].push(c.value)}return{flagMap:n,remainder:r,errors:o}},zse=(e)=>Me(e).config.flags.flatMap(ct).filter(fc),Wse=(e)=>Me(e).contextConfig.flags.flatMap(ct).filter(fc),JH=(e,t)=>{for(let n of t){let r=pl(e,n);if(r!==void 0)return r}return},w0=(e,t,n,r)=>{e.push(n);let o=Ep(t,n,r.param,r.negated);e.push(...o.tokens)},Kse=(e,t,n,r,o)=>{let s=my(t);Ep(s,e,n.param,n.negated);for(let i=s.take();i;i=s.take()){if(hy(i)){let a=JH(i,o);if(a!==void 0)Ep(s,i,a.param,a.negated);continue}if(i._tag==="Value")return r.has(i.value)}return!1},ZH=(e,t,n)=>{let r=I0(n.params),o=[],s=(i,a,c)=>{let u=ml(zse(a)),l=ml(Wse(a)),f=KH(a.subcommands),d=my(i),m=[],g=!0;for(let b=d.take();b;b=d.take()){if(hy(b)){let x=JH(b,c);if(x!==void 0){w0(m,d,b,x);continue}let I=pl(b,l);if(I!==void 0){w0(m,d,b,I);continue}let C=pl(b,u),S=pl(b,n);if(C!==void 0){if(S===void 0||!g||!Kse(b,d.rest(),C,f,[u,l,n])){w0(m,d,b,C);continue}}if(S!==void 0){let y=Ep(d,b,S.param,S.negated);if(y._tag==="Error"){o.push(y.error);continue}if(y.value!==void 0)r[S.param.name].push(y.value);continue}m.push(b);continue}if(b._tag==="Value"&&g){let x=f.get(b.value);if(x!==void 0)return m.push(b),m.push(...s(d.rest(),x,[...c,l])),m;g=!1}m.push(b)}return m};return{flagMap:r,remainder:s(e,t,[]),errors:o}},Vse=(e,t,n)=>{let r=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let i of t){if(i.hidden)continue;if(o.push(i.name),wx(i.primitiveType))o.push(`no-${i.name}`);for(let a of i.aliases)o.push(a)}let s=b0(VH(e),o).map((i)=>i.length===1?`-${i}`:`--${i}`);return new nc({option:r,suggestions:s,command:n})},Gse=(e)=>({flags:Bse(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),Jse=(e)=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),Zse=(e,t,n,r)=>{let{command:o,commandPath:s,inheritedFlagRegistry:i,localFlagNames:a}=n,c=KH(o.subcommands),u=c.get(e);if(u){let f=[...s,u.name],d=r.flags.snapshot();for(let g of a){let b=d[g];if(b!==void 0&&b.length>0)r.errors.push(new nc({option:`--${g}`,suggestions:[],command:f}))}let m=qse(t.rest(),i);return r.flags.merge(m.flagMap),r.errors.push(...m.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:r.flags.snapshot(),sub:u,childTokens:m.remainder,errors:r.errors}}}if(!(Me(o).config.arguments.length>0)&&c.size>0){let f=[];for(let[m,g]of c)if(!g.unlisted)f.push(m);let d=b0(e,f);r.errors.push(new yx({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},Yse=(e,t,n,r)=>{let{commandPath:o,flagRegistry:s}=n,i=pl(e,s);if(!i){r.errors.push(Vse(e,s.params,o));return}let a=GH(t,e,i.param,i.negated);if(a._tag==="Error"){r.errors.push(a.error);return}r.flags.add(i.param.name,a.value)},Qse=(e,t,n,r)=>{if(r.mode._tag==="AwaitingFirstValue"){let o=Zse(e,t,n,r);if(o._tag==="Subcommand")return o.result;r.mode={_tag:"CollectingArguments"}}r.arguments.push(e);return},Xse=(e,t)=>{let n=my(e),r=Gse(t.flagRegistry);for(let o=n.take();o;o=n.take()){if(hy(o)){Yse(o,n,t,r);continue}if(o._tag==="Value"){let s=Qse(o.value,n,t,r);if(s)return s}}return Jse(r)};var YH=w(()=>{Oe();_e();ip();zo();il();fl()});var T0,tie=(e,t)=>{let n=e;for(let r of t.slice(1)){let o=n.subcommands.flatMap((s)=>s.commands).find((s)=>s.name===r||s.alias===r);if(o===void 0)break;n=o}return n},eq,nie=(e)=>e.subcommands.some((n)=>n.commands.some((r)=>!r.unlisted))||Me(e).config.orderedParams.length>0,QH,rie=(e)=>{let t=sie(e);switch(e.primitiveType._tag){case"Boolean":return oe(vn(jI({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),(n)=>Wo(String(n)));case"Choice":{let n=Hs(e.primitiveType)??[];return oe(vn(HI({message:t,choices:n.map((r)=>({title:r,value:r}))})),Wo)}case"Date":return oe(vn(LB({message:t})),(n)=>Wo(n.toISOString()));case"Float":return oe(vn(jB({message:t})),(n)=>Wo(String(n)));case"Integer":return oe(vn(BI({message:t})),(n)=>Wo(String(n)));case"Redacted":return oe(vn(BB({message:t})),(n)=>Wo(Ui(n),"<redacted>"));default:return oe(vn(HB({message:t})),Wo)}},Wo=(e,t=e)=>({value:e,displayValue:t}),oie=(e)=>e.kind===It?`--${e.name}`:e.name,sie=(e)=>C0(e),C0=(e)=>{let t=mn(e.description)?.trim(),n=e.kind===It&&t!==void 0&&t.length<=32?t:iie(e.name);return e.kind===It?`${n} (${oie(e)})`:n},iie=(e)=>{let t=e.split(/[-_]+/).filter((n)=>n.length>0);if(t.length===0)return e;return[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},gy=(e)=>un(oq("Current command",e.map((t)=>t.displayValue),IB)),XH=(e,t)=>`${at(e.toUpperCase(),qs,al)} ${at("\xB7",fp)} ${at(t,qs,sc)}`,tq=(e,t,n)=>[`${at(e,qs,al)} ${at(`v${t}`,sc)} ${at("\xB7 Command wizard",qs,sc)}`,...n===void 0||n.length===0?[]:[n],at("Build a command interactively. Press Ctrl+C to cancel.",fp),""].join(`
128
+ `),nq=(e)=>oq("Command ready",e,al,Tx),rq=()=>`
129
+ ${at("Wizard cancelled.",Cx)}`,oq=(e,t,n,r=sc)=>{let o=aie(t);return[at(e,qs,r),...o.map((s)=>at(s,n)),""].join(`
130
+ `)},aie=(e)=>{let o=e.map(cie),s=[],i=" $ ";for(let a of o){let c=i===" $ "||i===" "?"":" ";if(i.length+c.length+a.length>88&&i!==" $ ")s.push(`${i} \\`),i=` ${a}`;else i+=`${c}${a}`}if(i!==" $ ")s.push(i);return s},cie=(e)=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var sq=w(()=>{ty();Oe();_e();$d();zo();il();Ox();fl();T0=H(function*(e,t){let n=t?.commandPath??[e.name],r=tie(e,n),o=(t?.prefix??n).map((s)=>Wo(s));return yield*gy(o),yield*eq(r,o,r===e?"ROOT":r.name),{args:o.map((s)=>s.value),displayArgs:o.map((s)=>s.displayValue)}}),eq=H(function*(e,t,n){let r=Me(e),o=e.subcommands.flatMap((a)=>a.commands.filter((c)=>!c.unlisted)),s=o.length===0?r.config:r.contextConfig;if(s.flags.length>0){yield*un(XH(n,"FLAGS"));for(let a of s.flags)t.push(...yield*QH(a));if(s.arguments.length>0||o.length>0)yield*gy(t)}if(s.arguments.length>0){yield*un(XH(n,"ARGUMENTS"));for(let a of s.arguments)t.push(...yield*QH(a));if(o.length>0)yield*gy(t)}if(o.length===0)return;let i=yield*vn(HI({message:"Command",choices:o.map((a)=>({title:a.name,value:a,...a.shortDescription!==void 0?{description:a.shortDescription}:a.description!==void 0?{description:a.description}:{}}))}));if(yield*un(),t.push(Wo(i.name)),nie(i))yield*gy(t);yield*eq(i,t,i.name)}),QH=H(function*(e){let t=gc(e),n=er(e);if(n.isOptional){if(!(yield*vn(jI({message:`Set ${C0(t)}?`,initial:!1}))))return yield*un(),[]}let r=!n.isVariadic?1:yield*vn(BI({message:`${C0(t)} count`,default:mt(n.variadicMin,()=>0),min:mt(n.variadicMin,()=>0),...Ee(n.variadicMax)?{max:n.variadicMax.value}:{}})),o=[];for(let i=0;i<r;i++)o.push(yield*rie(t));let s=t.kind===It?{flags:{[t.name]:o.map((i)=>i.value)},arguments:[]}:{flags:{},arguments:o.map((i)=>i.value)};if(yield*e.parse(s),yield*un(),t.kind===Yt)return o;return o.flatMap((i)=>[Wo(`--${t.name}`),i])})});var ho={};Un(ho,{annotate:()=>Eie,annotateMerge:()=>bie,isCommand:()=>O0,make:()=>lie,provide:()=>vie,provideEffect:()=>Iie,provideEffectDiscard:()=>Cie,provideSync:()=>kie,run:()=>Rie,runWith:()=>A0,unlisted:()=>Sie,withAlias:()=>yie,withDescription:()=>gie,withExamples:()=>wie,withGlobalFlags:()=>hie,withHandler:()=>fie,withSharedFlags:()=>mie,withShortDescription:()=>xie,withSubcommands:()=>pie,wizard:()=>Tie});var O0=(e)=>M(e,Sp),lie=(e,t,n)=>{let r=cy(t??{});return tr({name:e,config:r,...Le(n)?{handle:n}:{}})},fie,die=(e)=>{let t=[],n=new Map,r=(i,a)=>{t.push(a);let c=n.get(i);if(c)c.push(a);else n.set(i,[a])};for(let i of e){if(O0(i)){r(void 0,i);continue}for(let a of i.commands)r(i.group,a)}let o=[],s=n.get(void 0);if(s&&s.length>0)o.push({group:void 0,commands:s});for(let[i,a]of n){if(i===void 0)continue;o.push({group:i,commands:a})}return{flat:t,groups:o}},pie,mie,hie,gie,xie,yie,Sie=(e)=>tr({...Me(e),unlisted:!0}),Eie,bie,wie,xy=(e,t)=>{let n=Me(e);return tr({...n,handle:(r,o)=>t(n.handle(r,o),r)})},vie,kie,Iie,Cie,Tie=(e,t)=>oe(T0(e,t),(n)=>n.args),Oie=(e,t,n,r)=>{let o=new Set(t),s=[],i=new Set;for(let a of e){if(o.has(a))continue;let c=ct(a.flag);for(let u of c){let l=n[u.name];if(!l||l.length===0)continue;let f=`--${u.name}`;if(i.has(f))continue;i.add(f),s.push(new nc({option:f,suggestions:[],command:r}))}}return s},Aie=(e,t,n)=>qt(function*(){let{builtIns:r}=yield*py,o=yield*ll,s=yield*fy(e,t.commandPath,r);if(yield*un(o.formatHelpDoc(s)),n&&t.errors.length>0)yield*XI(o.formatErrors(t.errors))}),_ie=(e)=>qt(function*(){let t=yield*ll;yield*XI(t.formatError(e)),e[Pa]=!1}),Rie,A0=(e,t)=>{let n=Me(e);return H(function*(r){let{builtIns:o}=yield*py,{tokens:s,trailingOperands:i}=qH(r),a=$H(e,o),c=a.flatMap((k)=>ct(k.flag)),u=ml(c.filter(fc)),{flagMap:l,remainder:f,errors:d}=ZH(s,e,u),m={flags:l,arguments:[]},g=yield*k0({tokens:f,trailingOperands:i},e),b=[e.name,...v0(g)],x={builtIns:o,command:e,commandPath:b,version:t.version},I=x0(e,b,o),C=Oie(a,I,l,b);if(C.length>0||d.length>0){let k=g.errors??[];return yield*new qi({commandPath:b,errors:[...d,...C,...k]})}for(let k of I){if(k._tag!=="Action")continue;if(!ct(k.flag).some((R)=>{let z=l[R.name];return z!==void 0&&z.length>0}))continue;let[,N]=yield*k.flag.parse(m);if(k===S0)return yield*qt(function*(){yield*un(tq(e.name,t.version,e.description));let R=[e.name,...r.filter((ue)=>ue!=="--wizard"&&!ue.startsWith("--wizard="))],z=yield*T0(e,{commandPath:b,prefix:R});if(yield*un(nq(z.displayArgs)),yield*vn(qB({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))yield*un(),yield*A0(e,{...t,renderErrors:!1})(z.args.slice(1))}).pipe(gs("QuitError",()=>un(rq())));yield*k.run(N,x);return}if(g.errors&&g.errors.length>0)return yield*new qi({commandPath:b,errors:g.errors});let S=yield*ih(n.parse(g));if(S._tag==="Failure")return yield*new qi({commandPath:b,errors:[S.failure]});let y=n.handle(S.success,[e.name]),h=I.includes(dl)?(yield*dl.flag.parse(m))[1]:O();y=Io(y,dl,h);for(let k of I){if(k._tag!=="Setting"||k===dl)continue;let[,T]=yield*k.flag.parse(m);y=Io(y,k,T)}let E=et(h,{onNone:()=>hn(),onSome:(k)=>os(I_,k)});yield*xs(y,E)},Mf((r)=>RI(r)&&r._tag==="ShowHelp"?G(r):te(r),(r)=>hr(Aie(e,r,t.renderErrors!==!1),A(r))),Mf((r)=>t.renderErrors!==!1&&RI(r)&&r._tag==="UserError"?G(r):te(r),(r)=>hr(_ie(r),A(r))),Mf((r)=>V2(r)?G(r):te(r),(r)=>hu))};var iq=w(()=>{ty();Ve();Oe();X();_e();he();tb();gn();xh();Wv();sx();BH();ip();n0();E0();fl();p0();y0();YH();sq();zo();Ox();fie=p(2,(e,t)=>tr({...Me(e),handle:t})),pie=p(2,(e,t)=>{let n=die(t);m0(e,n.flat);let r=Me(e),o=new Map(n.flat.map((c)=>[c.name,Me(c)])),s=Symbol("effect/cli/SubcommandState"),i=H(function*(c){if(me(c.subcommand))return yield*r.parse(c);let u=o.get(c.subcommand.value.name);if(!u)return yield*r.parse(c);let l=yield*r.parseContext(c),f=yield*u.parse(c.subcommand.value.parsedInput);return{...l,[s]:{name:u.name,result:f}}}),a=H(function*(c,u){let f=c[s];if(f){let d=o.get(f.name);if(!d)return yield*new qi({commandPath:u,errors:[]});return yield*d.handle(f.result,[...u,d.name]).pipe(Io(r.service,c))}return yield*r.handle(c,u)});return tr({name:r.name,config:r.config,contextConfig:r.contextConfig,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:n.groups,parse:i,parseContext:r.parseContext,handle:a})}),mie=p(2,(e,t)=>{let n=Me(e),r=cy(t),o=f0(n.config,r),s=f0(n.contextConfig,r);if(n.subcommands.length>0){let l=n.subcommands.flatMap((f)=>f.commands);m0(e,l,{contextConfig:s})}let i=uy(r,{allowLeftovers:!0}),a=H(function*(l){let f=yield*n.parse(l),d=yield*i(l);return{...f,...d}}),c=H(function*(l){let f=yield*n.parseContext(l),d=yield*i(l);return{...f,...d}}),u=(l,f)=>n.handle(l,f);return tr({name:n.name,config:o,contextConfig:s,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:n.subcommands,parse:a,parseContext:c,handle:u})}),hie=p(2,(e,t)=>{let n=Me(e),r=Array.from(new Set([...n.globalFlags,...t]));return tr({...n,globalFlags:r})}),gie=p(2,(e,t)=>tr({...Me(e),description:t})),xie=p(2,(e,t)=>tr({...Me(e),shortDescription:t})),yie=p(2,(e,t)=>tr({...Me(e),alias:t})),Eie=p(3,(e,t,n)=>{let r=Me(e);return tr({...r,annotations:tn(r.annotations,t,n)})}),bie=p(2,(e,t)=>{let n=Me(e);return tr({...n,annotations:ua(n.annotations,t)})}),wie=p(2,(e,t)=>tr({...Me(e),examples:t})),vie=p((e)=>O0(e[0]),(e,t,n)=>xy(e,(r,o)=>zb(r,typeof t==="function"?t(o):t,n))),kie=p(3,(e,t,n)=>xy(e,(r,o)=>Io(r,t,typeof n==="function"?n(o):n))),Iie=p(3,(e,t,n)=>xy(e,(r,o)=>Wb(r,t,typeof n==="function"?n(o):n))),Cie=p(2,(e,t)=>xy(e,(n,r)=>hr(typeof t==="function"?t(r):t,n))),Rie=p(2,(e,t)=>bg.use(({args:n})=>ne(n,(r)=>A0(e,t)(r))))});var aq=w(()=>{hH();iq();l0()});var cq=(e)=>{let t=e?.trim();return t===void 0||t.length===0?void 0:t},uq=()=>({bunExecutable:cq(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:cq(process.env.TRIPWIRE_PACKAGE_DIST)});var lq=()=>{};import{lstat as gq,mkdir as Pie,open as Fie,readFile as bp,readlink as Mie,realpath as Nie,rename as xq,rm as yy,stat as Die,symlink as fq}from"fs/promises";import{homedir as vp}from"os";import yc from"path";import{fileURLToPath as dq}from"url";var pq,yq,Ko=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),hl=(e,t)=>e instanceof Error&&("code"in e)&&e.code===t,wp=async(e,t,n={})=>{let r=e,o=!1;try{o=(await gq(e)).isSymbolicLink()}catch(c){if(!hl(c,"ENOENT"))throw c}if(o)r=await Nie(e);let s=`${r}.${process.pid}.next`,i,a=384;try{a=(await Die(r)).mode&4095}catch(c){if(!hl(c,"ENOENT"))throw c}await yy(s,{force:!0});try{i=await Fie(s,"wx",a),await i.writeFile(t,"utf8"),await i.chmod(a),await i.sync(),await i.close(),i=void 0,await n.beforeRename?.(s,r),await xq(s,r)}finally{try{if(i!==void 0)await i.close()}finally{await yy(s,{force:!0})}}},$ie=(e)=>Ko(e)&&typeof e.type==="string"&&typeof e.command==="string"&&(e.timeout===void 0||typeof e.timeout==="number"),mq=(e)=>Array.isArray(e)&&e.every((t)=>Ko(t)&&Array.isArray(t.hooks)&&t.hooks.every($ie)),Uie=(e)=>{if(!Ko(e))return!1;let{hooks:t}=e;if(t===void 0)return!0;return Ko(t)&&(t.PreToolUse===void 0||mq(t.PreToolUse))&&(t.PostToolUse===void 0||mq(t.PostToolUse))},_0=(e,t)=>{let n=JSON.parse(e);if(!Uie(n))throw Error(`${t} hook config has an unsupported shape`);return n},Lie=(e)=>{let t=JSON.parse(e);if(!Ko(t))throw Error("Cursor hooks.json must contain a JSON object");let{hooks:n}=t;if(n===void 0)return t;if(!Ko(n))throw Error("Cursor hooks.json `hooks` must be an object");for(let[r,o]of Object.entries(n))if(!Array.isArray(o)||o.some((s)=>!Ko(s)||typeof s.command!=="string"))throw Error(`Cursor hooks.json event ${r} must contain command hooks`);return t},Sc="tripwire-hook",Sq=async(e,t)=>{await Pie(yc.dirname(t),{recursive:!0});try{if(!(await gq(t)).isSymbolicLink())return{action:"already",success:!1};let r=await Mie(t);if(r===e)return{action:"already",success:!0};let o=yc.resolve(yc.dirname(t),r);if(yc.basename(o)!=="tripwire-pi.js")return{action:"already",success:!1};let s=`${t}.${process.pid}.next`;await yy(s,{force:!0});try{await fq(e,s),await xq(s,t)}finally{await yy(s,{force:!0})}return{action:"updated",success:!0}}catch(n){if(!(n instanceof Error&&("code"in n)&&n.code==="ENOENT"))throw n;return await fq(e,t),{action:"installed",success:!0}}},jie,Bie,Sy=(e)=>e===Sc||e.startsWith(`${Sc} `)||e.includes("/tripwire-darwin-arm64/")||e.includes("/tripwire-hook")||e.includes("/tripwire.js")||e.includes("/dist/tripwire"),Hie=(e,t,n=Sc)=>{let r=Bie.has(t),o={command:`${n} --cursor-event ${t}`,...r&&{failClosed:!0}};if(e===void 0)return[[o],!0];let s=!1,i=e.some((u)=>Sy(u.command)),a=`${n} --cursor-event ${t}`,c=e.map((u)=>{if(!Sy(u.command))return u;if(u.command===a&&(!r||u.failClosed===!0))return u;return s=!0,{...u,command:a,...r&&{failClosed:!0}}});if(i)return[c,s];return[[...c,o],!0]},Ey=(e,t=Sc)=>{if(!e)return[[{hooks:[{type:"command",command:t}]}],!1];let n=!1,r=e.map((i)=>({...i,hooks:i.hooks.map((a)=>{if(Sy(a.command)){if(a.command!==t)return n=!0,{...a,command:t};return a}return a})}));if(r.some((i)=>i.hooks.some((a)=>a.command===t)))return[r,!n];return[[...r,{hooks:[{type:"command",command:t}]}],!1]},R0=async(e={})=>{let t=e.homeDirectory??vp(),n=e.hookCommand??Sc,r=`${t}/.claude/settings.json`;try{let o=await bp(r,"utf8"),s=_0(o,"Claude");s.hooks??={};let[i,a]=Ey(s.hooks.PreToolUse,n),[c,u]=Ey(s.hooks.PostToolUse,n);if(s.hooks.PreToolUse=i,s.hooks.PostToolUse=c,a&&u)return{success:!0,message:`Already configured: ${r}`};return await wp(r,`${JSON.stringify(s,null,2)}
131
+ `),{success:!0,message:`Updated ${r}`}}catch(o){if(hl(o,"ENOENT"))return{success:!1,message:`Config file not found: ${r}`};return{success:!1,message:`Failed to update Claude config: ${o instanceof Error?o.message:String(o)}`}}},P0=async(e={})=>{let t=e.homeDirectory??vp(),n=`${t}/.pi/agent/settings.json`,r=`${t}/.pi/agent/extensions/tripwire.js`;try{let o=e.extensionSource??yq.find((f)=>Bun.file(f).size>0);if(o===void 0)return{success:!1,message:"Built Pi extension not found; run `bun run build` first"};let s=await bp(n,"utf8"),i=_0(s,"Pi");if(i.hooks!==void 0){let{PreToolUse:f,PostToolUse:d,...m}=i.hooks,g=(C)=>C?.map((S)=>({...S,hooks:S.hooks.filter((y)=>!Sy(y.command))})).filter((S)=>S.hooks.length>0)??[],b=g(f),x=g(d),I={...m,...b.length>0&&{PreToolUse:b},...x.length>0&&{PostToolUse:x}};if(Object.keys(I).length===0){let{hooks:C,...S}=i;i=S}else i.hooks=I}let a=`${JSON.stringify(i,null,2)}
132
+ `,c=a!==s,u=await Sq(o,r);if(!u.success)return{success:!1,message:`Refusing to replace existing Pi extension: ${r}`};if(c)await wp(n,a);if(u.action==="already"&&!c)return{success:!0,message:`Already configured: ${r}`};return{success:!0,message:`${u.action==="updated"?"Updated":"Installed"} ${r}`}}catch(o){if(hl(o,"ENOENT"))return{success:!1,message:`Config file not found: ${n}`};return{success:!1,message:`Failed to update pi config: ${o instanceof Error?o.message:String(o)}`}}},F0=async(e={})=>{let n=`${e.homeDirectory??vp()}/.omp/agent/extensions/tripwire.js`;try{let r=e.extensionSource??yq.find((i)=>Bun.file(i).size>0);if(r===void 0)return{success:!1,message:"Built Pi extension not found; run `bun run build` first"};let o=await Sq(r,n);if(!o.success)return{success:!1,message:`Refusing to replace existing oh-my-pi extension: ${n}`};if(o.action==="already")return{success:!0,message:`Already configured: ${n}`};return{success:!0,message:`${o.action==="updated"?"Updated":"Installed"} ${n}`}}catch(r){return{success:!1,message:`Failed to install oh-my-pi extension: ${r instanceof Error?r.message:String(r)}`}}},hq=(e)=>{let t=Bun.TOML.parse(e),n=Ko(t)?t.features:void 0;if(n!==void 0&&!Ko(n))throw Error("Codex config.toml `features` must be a table");return n},qie=(e)=>{if(hq(e)?.hooks===!0)return e;let t=e.includes(`\r
133
+ `)?`\r
134
+ `:`
135
+ `,n=/^[\t ]*\[features\][\t ]*(?:#.*)?(?:\r?\n|$)/m.exec(e),r;if(n===null){let o=e.length===0||e.endsWith(`
136
+ `)?"":t,s=e.length===0||e.endsWith(`
137
+ `)?t:"";r=`${e}${o}[features]${t}hooks = true${s}`}else{let o=n.index+n[0].length,s=/^[\t ]*\[/gm;s.lastIndex=o;let a=s.exec(e)?.index??e.length,c=e.slice(o,a),u=/^(?<prefix>[\t ]*hooks[\t ]*=[\t ]*)(?<value>[^#\r\n]*?)(?<suffix>[\t ]*(?:#.*)?)$/m.exec(c);if(u===null){let f=n[0].endsWith(`
138
+ `)?`hooks = true${t}`:`${t}hooks = true`;r=`${e.slice(0,o)}${f}${e.slice(o)}`}else{let l=u.groups?.prefix,f=u.groups?.value;if(l===void 0||f===void 0)throw Error("Could not locate Codex hooks value in config.toml");let d=o+u.index+l.length,m=d+f.length;r=`${e.slice(0,d)}true${e.slice(m)}`}}if(hq(r)?.hooks!==!0)throw Error("Could not enable Codex hooks in config.toml");return r},M0=async(e={})=>{let t=e.homeDirectory??vp(),n=e.hookCommand??Sc,r=`${t}/.codex/config.toml`,o=`${t}/.codex/hooks.json`;try{let[s,i]=await Promise.all([bp(o,"utf8"),bp(r,"utf8")]),a=_0(s,"Codex");a.hooks??={};let[c]=Ey(a.hooks.PreToolUse,n),[u]=Ey(a.hooks.PostToolUse,n),l=(b)=>b.map((x)=>({...x,hooks:x.hooks.map((I)=>I.command===n&&I.timeout===void 0?{...I,timeout:10}:I)}));a.hooks.PreToolUse=l(c),a.hooks.PostToolUse=l(u);let f=`${JSON.stringify(a,null,2)}
139
+ `,d=qie(i),m=f!==s,g=d!==i;if(m)await wp(o,f);if(g)await wp(r,d);if(!m&&!g)return{success:!0,message:`Already configured: ${r} and ${o}`};return{success:!0,message:`Updated ${r} and ${o}`}}catch(s){if(hl(s,"ENOENT"))return{success:!1,message:`Config file not found: ${Ko(s)&&typeof s.path==="string"?s.path:`${r} or ${o}`}`};return{success:!1,message:`Failed to update Codex config: ${s instanceof Error?s.message:String(s)}`}}},N0=async(e={})=>{let t=e.homeDirectory??vp(),n=e.hookCommand??Sc,r=`${t}/.cursor/hooks.json`;try{let o=await bp(r,"utf8"),s=Lie(o);s.version??=1,s.hooks??={};let i=!1;for(let a of jie){let[c,u]=Hie(s.hooks[a],a,n);s.hooks[a]=c,i||=u}if(!i)return{success:!0,message:`Already configured: ${r}`};return await wp(r,`${JSON.stringify(s,null,2)}
140
+ `),{success:!0,message:`Updated ${r}`}}catch(o){if(hl(o,"ENOENT"))return{success:!1,message:`Config file not found: ${r}`};return{success:!1,message:`Failed to update Cursor hooks.json: ${o instanceof Error?o.message:String(o)}`}}},Eq=async(e={})=>[{target:"claude",...await R0(e)},{target:"codex",...await M0(e)},{target:"cursor",...await N0(e)},{target:"pi",...await P0(e)},{target:"oh-my-pi",...await F0(e)}];var bq=w(()=>{lq();({packageDist:pq}=uq()),yq=[...pq===void 0?[]:[yc.join(pq,"tripwire-pi.js")],yc.join(yc.dirname(process.execPath),"tripwire-pi.js"),dq(new URL("../../dist/tripwire-pi.js",import.meta.url)),dq(new URL("tripwire-pi.js",import.meta.url))],jie=["preToolUse","postToolUse","beforeShellExecution","afterShellExecution","beforeReadFile","afterFileEdit"],Bie=new Set(["preToolUse","beforeShellExecution","beforeReadFile"])});var kq={};Un(kq,{runCli:()=>tae});import wq from"path";var vq=()=>{if(/(?:^|[/\\])bun(?:\.exe)?$/iu.test(process.execPath)){let t=import.meta.filename;if(wq.basename(t)==="tripwire.js")return["tripwire-hook"];let n=wq.join(import.meta.dirname,"main.ts");return[process.execPath,n,"--tripwire-hook"]}return[process.execPath,"--tripwire-hook"]},zie=(e)=>/^[A-Za-z0-9_/:=.,+@%-]+$/u.test(e)?e:`'${e.replaceAll("'",String.raw`'\''`)}'`,Wie=()=>vq().map((e)=>zie(e)).join(" "),Kie=(e,t,n,r)=>{if(e==="Bash")return{command:t??""};if(e==="Read")return{file_path:n??""};if(e==="Write")return{file_path:n??"",content:r??""};if(e==="Edit"||e==="MultiEdit")return{file_path:n??"",old_string:"",new_string:r??""};return null},Vie=(e)=>{let{tool:t,post:n,command:r,path:o,stdout:s,stderr:i,content:a}=e,c=n?"PostToolUse":"PreToolUse",u=Kie(t,r,o,a),l={hook_event_name:c,tool_name:t,cwd:process.cwd(),session_id:"tripwire-cli-test",...u!==null&&{tool_input:u}};if(n)l.tool_response=t==="Bash"?{stdout:s??"",stderr:i??""}:{content:a??""};return l},Gie=(e)=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},Jie=(e)=>j.sync(()=>{let{command:t,content:n,path:r,post:o,stderr:s,stdout:i,tool:a}=e,c=Vie({tool:a,post:o,command:t,path:r,stdout:i,stderr:s,content:n}),u=Bun.spawnSync(vq(),{stdin:new TextEncoder().encode(JSON.stringify(c)),timeout:1e4,stdout:"pipe",stderr:"pipe"});if(u.exitCode!==0){let f=new TextDecoder().decode(u.stderr);console.error(`error: ${f}`),process.exit(1)}let l=new TextDecoder().decode(u.stdout);console.log(Gie(l))}),Zie,Yie=(e)=>j.gen(function*(){if(!["claude","codex","cursor","pi","oh-my-pi","omp","all"].includes(e))console.error(`error: unknown target "${e}"`),console.error("Valid targets: claude, codex, cursor, pi, oh-my-pi, all"),process.exit(1);let n,r={hookCommand:Wie()};switch(e){case"claude":{n=[{target:"claude",result:yield*j.promise(()=>R0(r))}];break}case"codex":{n=[{target:"codex",result:yield*j.promise(()=>M0(r))}];break}case"pi":{n=[{target:"pi",result:yield*j.promise(()=>P0(r))}];break}case"oh-my-pi":case"omp":{n=[{target:"oh-my-pi",result:yield*j.promise(()=>F0(r))}];break}case"cursor":{n=[{target:"cursor",result:yield*j.promise(()=>N0(r))}];break}case"all":{n=(yield*j.promise(()=>Eq(r))).map((i)=>({target:i.target,result:i}));break}default:{n=[];break}}let o=!1;for(let{target:s,result:i}of n)if(i.success){let a=i.message.startsWith("Already configured")?"\u2299":"\u2713";console.log(`${a} [${s}] ${i.message}`)}else console.error(`\u2717 [${s}] ${i.message}`),o=!0;if(o)process.exit(1)}),Qie,Xie,eae,tae=async()=>{try{await j.runPromise(eae.pipe(j.provide(ax.layer)))}catch(e){let t=e instanceof Error?e.message:String(e);console.error(t),process.exitCode=1}};var Iq=w(()=>{nI();el();aq();ky();bq();Zie=ho.make("test",{command:Ki.string("command").pipe(Ki.optional,Ki.withDescription("Command to test (for Bash tool)")),content:Ct.string("content").pipe(Ct.optional,Ct.withDescription("Content for Write/Edit tools")),path:Ct.string("path").pipe(Ct.optional,Ct.withDescription("File path for Read/Write/Edit tools")),post:Ct.boolean("post").pipe(Ct.withDefault(!1),Ct.withDescription("Test PostToolUse instead of PreToolUse")),stderr:Ct.string("stderr").pipe(Ct.optional,Ct.withDescription("Stderr for PostToolUse Bash")),stdout:Ct.string("stdout").pipe(Ct.optional,Ct.withDescription("Stdout for PostToolUse Bash")),tool:Ct.string("tool").pipe(Ct.withDefault("Bash"),Ct.withDescription("Tool name (Bash, Read, Write, Edit, MultiEdit)"))},({command:e,content:t,path:n,post:r,stderr:o,stdout:s,tool:i})=>Jie({command:be.getOrUndefined(e),content:be.getOrUndefined(t),path:be.getOrUndefined(n),post:r,stderr:be.getOrUndefined(o),stdout:be.getOrUndefined(s),tool:i})).pipe(ho.withDescription("Test a synthetic hook event")),Qie=ho.make("install",{target:Ki.string("target").pipe(Ki.withDescription("Target agent (claude, codex, cursor, pi, oh-my-pi, or all)"))},({target:e})=>Yie(e)).pipe(ho.withDescription("Install tripwire hooks for AI agents")),Xie=ho.make("tripwire").pipe(ho.withDescription("Opinionated hooks dispatcher for AI coding agents"),ho.withSubcommands([Zie,Qie])),eae=ho.run(Xie,{version:Cp.version})});ky();import nae from"path";var rae="--tripwire-hook",oae="--tripwire-force-cli",Cq=process.argv.indexOf(oae,2),Tq=Cq!==-1;if(Tq)process.argv.splice(Cq,1);var by=process.argv.slice(2),sae=nae.basename(process.argv0),iae=!Tq&&(sae==="tripwire-hook"||by.includes(rae)||by.some((e)=>e.startsWith("--cursor-event")));if(iae){let{runHook:e}=await Promise.resolve().then(() => ($j(),Dj));e()}else if(by.length===1&&by[0]==="--version")process.stdout.write(`${Cp.version}
141
+ `);else{let{runCli:e}=await Promise.resolve().then(() => (Iq(),kq));await e()}