@shivaedev/work-board 0.14.0 → 0.14.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.
- package/CHANGELOG.md +6 -0
- package/assets/agent.js +17 -17
- package/assets/native.js +17 -17
- package/dist/client/react/Favorite.js +1 -1
- package/dist/client/react/Favorite.js.map +1 -1
- package/dist/client/react/{readingLibrary.d.ts → LibraryContext.d.ts} +1 -1
- package/dist/client/react/{readingLibrary.d.ts.map → LibraryContext.d.ts.map} +1 -1
- package/dist/client/react/{readingLibrary.js → LibraryContext.js} +1 -1
- package/dist/client/react/{readingLibrary.js.map → LibraryContext.js.map} +1 -1
- package/dist/client/react/ReadingHistory.d.ts +1 -1
- package/dist/client/react/ReadingHistory.d.ts.map +1 -1
- package/dist/client/react/ReadingHistory.js.map +1 -1
- package/dist/client/react/ReadingLibrary.js +1 -1
- package/dist/client/react/ReadingLibrary.js.map +1 -1
- package/dist/client/react/SavedViews.js +1 -1
- package/dist/client/react/SavedViews.js.map +1 -1
- package/dist/client/react/Sidebar.d.ts.map +1 -1
- package/dist/client/react/Sidebar.js +1 -1
- package/dist/client/react/Sidebar.js.map +1 -1
- package/dist/client/react/navigationLocation.d.ts +1 -1
- package/dist/client/react/navigationLocation.d.ts.map +1 -1
- package/dist/client/react/navigationLocation.js +1 -1
- package/dist/client/react/navigationLocation.js.map +1 -1
- package/dist/client/react/{readingHistory.d.ts → storedReadings.d.ts} +2 -2
- package/dist/client/react/{readingHistory.d.ts.map → storedReadings.d.ts.map} +1 -1
- package/dist/client/react/{readingHistory.js → storedReadings.js} +2 -2
- package/dist/client/react/{readingHistory.js.map → storedReadings.js.map} +1 -1
- package/dist/client/react/useBoardNavigation.js +2 -2
- package/dist/client/react/useBoardNavigation.js.map +1 -1
- package/dist/client/react/{savedViews.d.ts → useSavedViews.d.ts} +1 -1
- package/dist/client/react/useSavedViews.d.ts.map +1 -0
- package/dist/client/react/{savedViews.js → useSavedViews.js} +1 -1
- package/dist/client/react/useSavedViews.js.map +1 -0
- package/dist/rpc/contract.d.ts +2793 -2793
- package/dist/rpc/contract.d.ts.map +1 -1
- package/dist/rpc/handoffContract.d.ts +8 -8
- package/dist/rpc/responseContract.d.ts +51 -51
- package/dist/server/mcp/client.d.ts +623 -623
- package/dist/server/mcp/queries.d.ts +3426 -3426
- package/dist/server/packageInfo.d.ts +1 -1
- package/dist/server/packageInfo.js +1 -1
- package/package.json +6 -6
- package/src/client/react/Favorite.tsx +1 -1
- package/src/client/react/ReadingHistory.tsx +1 -1
- package/src/client/react/ReadingLibrary.tsx +1 -1
- package/src/client/react/SavedViews.tsx +1 -1
- package/src/client/react/Sidebar.tsx +1 -1
- package/src/client/react/navigationLocation.ts +1 -1
- package/src/client/react/{readingHistory.ts → storedReadings.ts} +1 -1
- package/src/client/react/useBoardNavigation.ts +2 -2
- package/src/server/packageInfo.ts +1 -1
- package/dist/client/react/savedViews.d.ts.map +0 -1
- package/dist/client/react/savedViews.js.map +0 -1
- /package/src/client/react/{readingLibrary.ts → LibraryContext.ts} +0 -0
- /package/src/client/react/{savedViews.ts → useSavedViews.ts} +0 -0
package/assets/native.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
/* @shivaedev/work-board native browser bundle */
|
|
2
|
-
var
|
|
2
|
+
var IK=Object.defineProperty;var ps=(e,t)=>{for(var r in t)IK(e,r,{get:t[r],enumerable:!0})};var V=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},oI={pipe(){return V(this,arguments)}},Ra=(function(){function e(){}return e.prototype=oI,e})();var d=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(o){return t(o,r)}};case 3:return function(r,n,o){return arguments.length>=3?t(r,n,o):function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var F=e=>e;var qe=e=>()=>e,nr=qe(!0),Oa=qe(!1),sI=qe(null),po=qe(void 0),Rr=po;function Ud(e,...t){return V(e,t)}function $c(e,t,r,n,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 r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(n(r(t(e.apply(this,arguments)))))))))}}}function mo(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function jc(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o!==r&&t.set(o,o),o}}var Dd=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");let r=Object.getPrototypeOf(e),n=r;for(;n!==null&&n!==Object.prototype;){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}return t.has("constructor")&&typeof e.constructor=="function"&&r===e.constructor.prototype&&t.delete("constructor"),t},Af=new WeakSet,Ld=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var Hc=0,UO=()=>{Hc++};function On(e){return typeof e=="string"}function Bd(e){return typeof e=="number"}function px(e){return typeof e=="boolean"}function DO(e){return typeof e=="bigint"}function iI(e){return typeof e=="symbol"}function mx(e){return On(e)||Bd(e)||iI(e)}function or(e){return typeof e=="function"}function LO(e){return e===void 0}function ei(e){return e!==void 0}function BO(e){return e==null}function hx(e){return e!=null}function $O(e){return!1}function aI(e){return!0}function $d(e){return typeof e=="object"&&e!==null}function Jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jd(e){return typeof e=="object"&&e!==null||or(e)}var O=d(2,(e,t)=>jd(e)&&t in e),Or=d(2,(e,t)=>O(e,"_tag")&&e._tag===t);function jO(e){return e instanceof Error}function ti(e){return O(e,Symbol.iterator)||On(e)}var ie="~effect/Hash",G=e=>{switch(typeof e){case"number":return zt(e);case"bigint":return Be(e.toString(10));case"string":return Be(e);case"function":case"object":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Be("Invalid Date"):Be(e.toISOString());if(e instanceof RegExp)return Be(e.toString());{if(Af.has(e))return xx(e);let t=qO.get(e);if(t!==void 0)return t;if(fI.has(e))return UO(),Be("[Circular]");fI.add(e);let r=Hc,n;try{ie in e?n=e[ie]():typeof e=="function"?n=xx(e):e instanceof DataView?n=ri(Ld(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=ri(e):e instanceof Map?n=TK(e):e instanceof Set?n=wK(e):n=qd(e)}finally{fI.delete(e)}return r===Hc&&qO.set(e,n),n}}}return _r(zO(Be(String(e))))},xx=e=>(uI.has(e)||uI.set(e,_r(Math.random()*4294967296|0)),uI.get(e)),zO=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),he=d(2,(e,t)=>zO(Math.imul(e,2654435761)+Math.imul(t,2246822507))),_r=e=>e&3221225471|e>>>1&1073741824;var cI=new DataView(new ArrayBuffer(8)),zt=e=>{let t=e|0;return t===e?_r(t):(cI.setFloat64(0,e!==e?NaN:e),_r(he(cI.getInt32(0),cI.getInt32(4))))},Be=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return _r(t)},Hd=(e,t)=>{let r=12289;for(let n of t)r^=he(G(n),G(e[n]));return _r(r)},qd=e=>Hd(e,Dd(e)),WO=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return _r(n)},ri=e=>{let t=6151;for(let r of e)t=he(t,G(r));return _r(t)},TK=WO(Be("Map"),([e,t])=>he(G(e),G(t))),HO=Be("Set"),wK=WO(HO,e=>he(HO,G(e))),uI=new WeakMap,qO=new WeakMap,fI=new WeakSet;var ae="~effect/Equal";function Z(){return arguments.length===1?e=>qc(e,arguments[0]):qc(arguments[0],arguments[1])}function qc(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;return r!==typeof t?!1:r==="number"&&e!==e&&t!==t?!0:r!=="object"&&r!=="function"||Af.has(e)||Af.has(t)?!1:vK(e,t)}function vK(e,t){let r=gx.length;for(let s=r;s-- >0;)if(gx[s]===e&&lI[s]===t)return!0;if(r)return KO(e,t);let n=VO.get(e);n||VO.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=KO(e,t)),o}function KO(e,t){gx.push(e),lI.push(t);try{return CK(e,t)}finally{gx.pop(),lI.pop()}}var gx=[],lI=[],VO=new WeakMap;function CK(e,t){if(G(e)!==G(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let r=JO(e);if(r!==JO(t)||typeof e=="function"&&!r)return!1;if(r)return e[ae](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:AK(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?GO(Ld(e),Ld(t)):GO(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:dI(e,t,RK,OK);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:dI(e,t,G,qc)}return kK(e,t)}function AK(e,t){for(let r=0;r<e.length;r++)if(!qc(e[r],t[r]))return!1;return!0}function GO(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function kK(e,t){let r=Dd(e),n=Dd(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!qc(e[o],t[o]))return!1;return!0}function dI(e,t,r,n){let o=new Map,s=0;for(let i of t){let a=r(i),c=o.get(a);c?c.push(i):o.set(a,[i]),s++}e:for(let i of e){let a=o.get(r(i));if(a){for(let c=0;c<a.length;c++)if(n(i,a[c])){a[c]=a[a.length-1],a.pop(),s--;continue e}}return!1}return s===0}var RK=e=>G(e[0]),OK=(e,t)=>qc(e[0],t[0])&&qc(e[1],t[1]),_K=()=>0;function yx(e,t){return zd((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function zd(e){return function(r,n){return dI(r,n,_K,e)}}var JO=e=>O(e,ae),Wd=()=>Z;var ZO=e=>(Af.add(e),e);var zc=Symbol.for("~effect/Redactable"),PK=e=>O(e,zc);function ho(e){return PK(e)?pI(e):e}function pI(e){return e[zc](globalThis[kf]?.context??MK)}var kf="~effect/Fiber/currentFiber",QO=new Map,MK={"~effect/Context":{},base:QO,depth:0,mapUnsafe:QO,pipe(){return V(this,arguments)}};function H(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r=="number"?" ".repeat(r):r:"",s=f=>o.repeat(f),i=(f,p)=>{let m=f?.constructor;return m&&m!==Object.prototype.constructor&&m.name?`${m.name}(${p})`:p},a=f=>{try{return Reflect.ownKeys(f)}catch{return["[ownKeys threw]"]}};function c(f,p=0){try{return u(f,p)}catch{return(typeof f=="object"&&f!==null||typeof f=="function")&&n.delete(f),"[inspection threw]"}}function u(f,p=0){if(typeof f=="string")return JSON.stringify(f);if(typeof f=="number"||f==null||typeof f=="boolean"||typeof f=="symbol")return String(f);if(typeof f=="bigint")return String(f)+"n";if(typeof f=="object"||typeof f=="function"){if(n.has(f))return FK;n.add(f);let m;if(zc in f)m=c(pI(f),p);else if(Array.isArray(f))m=!o||f.length<=1?`[${f.map(h=>c(h,p)).join(",")}]`:`[
|
|
3
3
|
${s(p+1)}${f.map(h=>c(h,p+1)).join(`,
|
|
4
4
|
`+s(p+1))}
|
|
5
|
-
${s(p)}]`;else if(f instanceof Date)m=mI(f);else if(!t?.ignoreToString&&O(f,"toString")&&typeof f.toString=="function"&&f.toString!==Object.prototype.toString&&f.toString!==Array.prototype.toString){let h=
|
|
5
|
+
${s(p)}]`;else if(f instanceof Date)m=mI(f);else if(!t?.ignoreToString&&O(f,"toString")&&typeof f.toString=="function"&&f.toString!==Object.prototype.toString&&f.toString!==Array.prototype.toString){let h=NK(f);m=f instanceof Error&&f.cause!==void 0?`${h} (cause: ${c(f.cause,p)})`:h}else if(Symbol.iterator in f)m=`${f.constructor.name}(${c(Array.from(f),p)})`;else{let h=a(f);if(!o||h.length<=1){let x=`{${h.map(g=>`${ni(g)}:${c(XO(f,g),p)}`).join(",")}}`;m=i(f,x)}else{let x=`{
|
|
6
6
|
${h.map(g=>`${s(p+1)}${ni(g)}: ${c(XO(f,g),p+1)}`).join(`,
|
|
7
7
|
`)}
|
|
8
|
-
${s(p)}}`;m=i(f,x)}}return n.delete(f),m}return String(f)}return c(e,0)}var MK="[Circular]";function ni(e){return typeof e=="string"?JSON.stringify(e):String(e)}function yx(e){return e.map(t=>`[${ni(t)}]`).join("")}function mI(e){try{return e.toISOString()}catch{return"Invalid Date"}}function FK(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function XO(e,t){try{return e[t]}catch{return"[property access threw]"}}function zc(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,i=O(s,qc)?ho(s):ho(o);if(typeof i=="bigint")return H(i);if(typeof i!="object"||i===null)return i;let a=i instanceof Error&&!O(i,"toJSON")?{...i,name:i.name,message:i.message}:i;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return;if(r.push(i),a!==i&&r.push(a),!NK(a)||UK(a))return a;let c=new Proxy(a,{get(u,f){let p=Reflect.get(u,f,u);return Object.getOwnPropertyDescriptor(u,f)?.get!==void 0?ho(p):p}});return r.push(c),c},t?.space)??"null"}function NK(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function UK(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var Qe=Symbol.for("nodejs.util.inspect.custom"),pr=e=>{try{return e=ho(e),O(e,"toJSON")&&or(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(pr):e}catch{return"[toJSON threw]"}},e_=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?zc(e,{space:t}):H(e,{space:t})}catch{return String(e)}},Ot={toJSON(){return pr(this)},[Qe](){return this.toJSON()},toString(){return H(this.toJSON())}},Sx=class{[Qe](){return this.toJSON()}toString(){return H(this.toJSON())}};var LK=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},BK=LK(),Ir=()=>Error.stackTraceLimit,yt=e=>{BK&&(Error.stackTraceLimit=e)};var _a=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},$K=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Ir();if(n===0)return r[e];yt(2);let o=t[e](()=>new Error);return yt(n),o.stack?.includes(e)===!0?t[e]:r[e]},Pa=$K();function B(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function bx(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&B(e,r,t[r])}var si="~effect/Effect",Wc="~effect/Exit",HK={_A:F,_E:F,_R:F},hI=`${si}/identifier`,Se=`${si}/args`,St=`${si}/evaluate`,mr=`${si}/successCont`,go=`${si}/failureCont`,Kc=`${si}/ensureCont`,Gc=Symbol.for("effect/Effect/Yield"),wr={pipe(){return V(this,arguments)},toJSON(){return{...this}},toString(){return H(this.toJSON(),{ignoreToString:!0,space:2})},[Qe](){return this.toJSON()}},r_={[ie](){return jd(this,Object.keys(this))},[ae](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!Z(this[t[n]],e[t[n]]))return!1;return!0}},qK={[si]:HK,...wr,[Symbol.iterator](){return new _a(this)},toJSON(){return{_id:"Effect",op:this[hI],...Se in this?{args:this[Se]}:void 0}}},ge=e=>O(e,si),Vd=e=>O(e,Wc),Ex="~effect/Cause",Wd="~effect/Cause/Reason",Of=e=>O(e,Ex),n_=e=>O(e,Wd),oi=class{constructor(t){this[Ex]=Ex,this.reasons=t}pipe(){return V(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${H(this.reasons)})`}[Qe](){return this.toJSON()}[ae](t){return Of(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>Z(r,t.reasons[n]))}[ie](){return ri(this.reasons)}},t_=new WeakMap,kf=class{[Wd];annotations;_tag;constructor(t,r,n){if(this[Wd]=Wd,this._tag=t,r!==Gd&&typeof n=="object"&&n!==null&&r.size>0){let o=t_.get(n);o&&(r=new Map([...o,...r])),t_.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,i)=>{r?.overwrite!==!0&&n.has(i)||n.set(i,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return V(this,arguments)}toString(){return H(this)}[Qe](){return this.toString()}},Gd=new Map,Vc=class extends kf{constructor(t,r=Gd){super("Fail",r,t),this.error=t}toString(){return`Fail(${H(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[ae](t){return hs(t)&&Z(this.error,t.error)&&Z(this.annotations,t.annotations)}[ie](){return he(Be(this._tag))(he(G(this.error))(G(this.annotations)))}},zi=e=>new oi(e),zK=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=G(o),i=r.get(s);if(i===void 0)r.set(s,[o]);else{if(i.some(a=>Z(a,o)))continue;i.push(o)}n.push(o)}return n},_f=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new oi(zK(e.reasons,t.reasons));return Z(e,r)?e:r}),xI=new oi([]),Pf=e=>new oi([new Vc(e)]),Kd=class extends kf{constructor(t,r=Gd){super("Die",r,t),this.defect=t}toString(){return`Die(${H(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[ae](t){return Zd(t)&&Z(this.defect,t.defect)&&Z(this.annotations,t.annotations)}[ie](){return he(Be(this._tag))(he(G(this.defect))(G(this.annotations)))}},gI=e=>new oi([new Kd(e)]),Jd=d(e=>Of(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new oi(e.reasons.map(n=>n.annotate(t,r)))),hs=e=>e._tag==="Fail",Zd=e=>e._tag==="Die",Qd=e=>e._tag==="Interrupt";function WK(e){return ln("Effect.evaluate: Not implemented")}var yo=e=>({...qK,[hI]:e.op,[St]:e[St]??WK,[mr]:e[mr],[go]:e[go],[Kc]:e[Kc]}),Uo=e=>{let t=yo(e),r=function(n){this[Se]=n};return r.prototype=t,function(n){return new r(n)}},o_=e=>{let t={[Wc]:Wc,_tag:e.op,get[e.prop](){return this[Se]},...yo(e),toString(){return`${e.op}(${H(this[Se])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Se]}},[ae](n){return Vd(n)&&n._tag===this._tag&&Z(this[Se],n[Se])},[ie](){return he(Be(e.op),G(this[Se]))}},r=function(n){this[Se]=n};return r.prototype=t,function(n){return new r(n)}},ze=o_({op:"Success",prop:"value",[St](e){let t=e.getCont(mr);return t?t[mr](this[Se],e,this):e.yieldWith(this)}}),Tx={key:"effect/Cause/StackTrace"},yI={key:"effect/Cause/InterruptorStackTrace"},Pr=o_({op:"Failure",prop:"cause",[St](e){let t=this[Se],r=!1;e.cache.stackFrame&&(t=Jd(t,{mapUnsafe:new Map([[Tx.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(go),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=hI in n,n=e.getCont(go);s&&(t=zi(t.reasons.filter(i=>i._tag!=="Fail"))),t=_f(t,o),r=!0}return n?n[go](t,e,r?void 0:this):e.yieldWith(r?Pr(t):this)}}),So=e=>Pr(Pf(e)),ln=e=>Pr(gI(e)),oe=Uo({op:"WithFiber",[St](e){return this[Se](e)}}),s_=Uo({op:"WithFiberSucceed",[St](e){let t=this[Se](e),r=e.getCont(mr);return r?r[mr](t,e):e.yieldWith(ze(t))}}),KK=(function(){class e extends globalThis.Error{}let t=yo({op:"YieldableError",[St](){return So(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),Yd=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends KK{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(bx(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Wi=e=>{class t extends Yd{_tag=e}return t.prototype.name=e,t},Ix="~effect/Cause/NoSuchElementError",SI=e=>O(e,Ix),ms=class extends Wi("NoSuchElementError"){[Ix]=Ix;constructor(t){super({message:t})}},Rf="~effect/Cause/Done",i_=e=>O(e,Rf),a_={[Rf]:Rf,_tag:"Done",value:void 0},Jc=e=>e===void 0?a_:{[Rf]:Rf,_tag:"Done",value:e},VK=So(a_),c_=e=>e===void 0?VK:So(Jc(e));var u_=e=>yo({op:e.label,[St]:e.evaluate});var ke={};ps(ke,{Do:()=>R3,all:()=>h3,andThen:()=>l3,as:()=>C_,asVoid:()=>u3,bind:()=>k3,bindTo:()=>C3,composeK:()=>p3,contains:()=>w3,containsWith:()=>__,exists:()=>v3,filter:()=>Fa,filterMap:()=>S3,firstSomeOf:()=>a3,flatMap:()=>gs,flatMapNullishOr:()=>RI,flatten:()=>Xc,fromIterable:()=>t3,fromNullOr:()=>AI,fromNullishOr:()=>Yc,fromUndefinedOr:()=>CI,gen:()=>O3,getFailure:()=>n3,getOrElse:()=>Ma,getOrNull:()=>op,getOrThrow:()=>kI,getOrThrowWith:()=>Lf,getOrUndefined:()=>_n,getSuccess:()=>r3,isNone:()=>fe,isOption:()=>ci,isSome:()=>de,let:()=>A3,lift2:()=>I3,liftNullishOr:()=>c3,liftPredicate:()=>T3,liftThrowable:()=>xs,makeCombinerFailFast:()=>P_,makeEquivalence:()=>b3,makeOrder:()=>E3,makeReducer:()=>_3,makeReducerFailFast:()=>P3,map:()=>Lt,match:()=>Zt,none:()=>_,orElse:()=>o3,orElseResult:()=>i3,orElseSome:()=>s3,partitionMap:()=>y3,product:()=>R_,productMany:()=>m3,reduceCompact:()=>x3,some:()=>N,tap:()=>k_,toArray:()=>g3,toRefinement:()=>e3,void:()=>f3,zipLeft:()=>d3,zipRight:()=>A_,zipWith:()=>O_});function l_(e){return{combine:e}}function bI(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Wr=e=>(t,r)=>t===r||e(t,r),GK=(e,t)=>e===t,Zc=()=>GK;function m_(e){return Wr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function wx(e){return Wr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var vx=e=>d(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Cx=e=>d(2,(t,r)=>e(t,n=>({[r]:n}))),Ax=(e,t)=>d(3,(r,n,o)=>t(r,s=>e(o(s),i=>({...s,[n]:i}))));var x_="~effect/Option",g_={[x_]:{_A:e=>e},...wr,[Symbol.iterator](){return new _a(this)}},JK=Object.defineProperty(Object.assign(Object.create(g_),{_tag:"Some",_op:"Some",[ae](e){return kx(e)&&EI(e)&&Z(this.value,e.value)},[ie](){return he(G(this._tag))(G(this.value))},toString(){return`some(${H(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:pr(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),ZK=G("None"),QK=Object.assign(Object.create(g_),{_tag:"None",_op:"None",valueOrUndefined:void 0,[ae](e){return kx(e)&&Rx(e)},[ie](){return ZK},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),kx=e=>O(e,x_),Rx=e=>e._tag==="None",EI=e=>e._tag==="Some",Xd=Object.create(QK),y_=function(e){this.value=e};y_.prototype=JK;var ep=e=>new y_(e);var b_="~effect/Result",E_={[b_]:{_A:e=>e,_E:e=>e},...wr,[Symbol.iterator](){return new _a(this)}},YK=Object.assign(Object.create(E_),{_tag:"Success",_op:"Success",[ae](e){return Ox(e)&&Ff(e)&&Z(this.success,e.success)},[ie](){return he(G(this._tag))(G(this.success))},toString(){return`success(${H(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:pr(this.success)}}}),XK=Object.assign(Object.create(E_),{_tag:"Failure",_op:"Failure",[ae](e){return Ox(e)&&Mf(e)&&Z(this.failure,e.failure)},[ie](){return he(G(this._tag))(G(this.failure))},toString(){return`failure(${H(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:pr(this.failure)}}}),Ox=e=>O(e,b_),Mf=e=>e._tag==="Failure",Ff=e=>e._tag==="Success",I_=function(e){this.failure=e};I_.prototype=XK;var _x=e=>new I_(e),T_=function(e){this.success=e};T_.prototype=YK;var Px=e=>new T_(e),II=e=>Ff(e)?Xd:ep(e.failure),TI=e=>Mf(e)?Xd:ep(e.success);function ai(e){return(t,r)=>t===r?0:e(t,r)}var v_=ai((e,t)=>e<t?-1:1),Ki=ai((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var Nf=ai((e,t)=>e<t?-1:1);var wI=d(2,(e,t)=>ai((r,n)=>e(t(r),t(n)))),Uf=wI(Ki,e=>e.getTime());var tp=e=>d(2,(t,r)=>e(t,r)===-1),Qc=e=>d(2,(t,r)=>e(t,r)===1),rp=e=>d(2,(t,r)=>e(t,r)!==1),np=e=>d(2,(t,r)=>e(t,r)!==-1),vI=e=>d(2,(t,r)=>t===r||e(t,r)<1?t:r);var _=()=>Xd,N=ep,ci=kx,fe=Rx,de=EI,Zt=d(2,(e,{onNone:t,onSome:r})=>fe(e)?t():r(e.value)),e3=e=>t=>de(e(t)),t3=e=>{for(let t of e)return N(t);return _()},r3=TI,n3=II,Ma=d(2,(e,t)=>fe(e)?t():e.value),o3=d(2,(e,t)=>fe(e)?t():e),s3=d(2,(e,t)=>fe(e)?N(t()):e),i3=d(2,(e,t)=>fe(e)?Lt(t(),Px):Lt(e,_x)),a3=e=>{let t=_();for(t of e)if(de(t))return t;return t},Yc=e=>e==null?_():N(e),CI=e=>e===void 0?_():N(e),AI=e=>e===null?_():N(e),c3=e=>(...t)=>Yc(e(...t)),op=Ma(sI),_n=Ma(po),xs=e=>(...t)=>{try{return N(e(...t))}catch{return _()}},Lf=d(2,(e,t)=>{if(de(e))return e.value;throw t()}),kI=Lf(()=>new Error("getOrThrow called on a None")),Lt=d(2,(e,t)=>fe(e)?_():N(t(e.value))),C_=d(2,(e,t)=>Lt(e,()=>t)),u3=C_(void 0),f3=N(void 0);var gs=d(2,(e,t)=>fe(e)?_():t(e.value)),l3=d(2,(e,t)=>gs(e,r=>{let n=or(t)?t(r):t;return ci(n)?n:N(n)})),RI=d(2,(e,t)=>fe(e)?_():Yc(t(e.value))),Xc=gs(F),A_=d(2,(e,t)=>gs(e,()=>t)),d3=d(2,(e,t)=>k_(e,()=>t)),p3=d(2,(e,t)=>r=>gs(e(r),t)),k_=d(2,(e,t)=>gs(e,r=>Lt(t(r),()=>r))),R_=d(2,(e,t)=>de(e)&&de(t)?N([e.value,t.value]):_()),m3=d(2,(e,t)=>{if(fe(e))return _();let r=[e.value];for(let n of t){if(fe(n))return _();r.push(n.value)}return N(r)}),h3=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(fe(n))return _();r.push(n.value)}return N(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(fe(n))return _();B(t,r,n.value)}return N(t)},O_=d(3,(e,t,r)=>Lt(R_(e,t),([n,o])=>r(n,o))),x3=d(3,(e,t,r)=>{let n=t;for(let o of e)de(o)&&(n=r(n,o.value));return n}),g3=e=>fe(e)?[]:[e.value],y3=d(2,(e,t)=>{if(fe(e))return[_(),_()];let r=t(e.value);return Mf(r)?[_(),N(r.failure)]:[N(r.success),_()]}),S3=d(2,(e,t)=>{if(fe(e))return _();let r=t(e.value);return Ff(r)?N(r.success):_()}),Fa=d(2,(e,t)=>fe(e)?_():t(e.value)?N(e.value):_()),b3=e=>Wr((t,r)=>fe(t)?fe(r):fe(r)?!1:e(t.value,r.value)),E3=e=>ai((t,r)=>de(t)?de(r)?e(t.value,r.value):1:-1),I3=e=>d(2,(t,r)=>O_(t,r,e)),T3=d(2,(e,t)=>t(e)?N(e):_()),__=e=>d(2,(t,r)=>fe(t)?!1:e(t.value,r)),w3=__(zd()),v3=d(2,(e,t)=>fe(e)?!1:t(e.value)),C3=Cx(Lt),A3=vx(Lt);var k3=Ax(Lt,gs),R3=N({}),O3=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(fe(o))return o;n=r.next(o.value)}return N(n.value)};function _3(e){return bI((t,r)=>fe(t)?r:fe(r)?t:N(e.combine(t.value,r.value)),_())}function P_(e){return l_((t,r)=>fe(t)||fe(r)?_():N(e.combine(t.value,r.value)))}function P3(e){let t=P_(e).combine,r=N(e.initialValue);return bI(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),fe(o))return o;return o})}var M_="~effect/Context/Service",Ue=function(){function e(){}let t=e;Object.setPrototypeOf(t,M3);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[_I]=_I,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&F_.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},M3={[M_]:M_,...u_({label:"Service",evaluate(e){return ze(Re(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return ys(this,e)},use(e){return oe(t=>e(Re(t.context,this)))},useSync(e){return oe(t=>ze(e(Re(t.context,this))))}},F_=new Set,_I="~effect/Context/Reference",N_="~effect/Context",F3=8,N3=8,PI=(e,t,r,n)=>{let o=Object.create(U3);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},MI=(e,t)=>{t&&(MI(e,t.parent),e.set(t.key,t.value))},U_=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return MI(t,e.overlay),e._flat=t},D_=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),qn(r)},Mx=Symbol(),FI=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?Mx:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=N3&&(r.base=U_(r),r.overlay=void 0,r.depth=0),n)},qn=e=>PI(void 0,e,void 0,0),U3={get mapUnsafe(){return U_(this)},...wr,[N_]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ae](e){if(!sp(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!Z(o,r.get(n)))return!1;return!0},[ie](){return zt(this.mapUnsafe.size)}},L_=(e,t)=>e.cacheRoot===t.cacheRoot,sp=e=>O(e,N_);var B_=e=>!!e[_I],pt=()=>D3,D3=qn(new Map),ys=(e,t)=>qn(new Map([[e.key,t]])),We=d(3,(e,t,r)=>L3(e,t.key,r)),L3=(e,t,r)=>{let n=e,o=F_.has(t)?void 0:n.cacheRoot;if(n.depth>=F3){let s=new Map(n._flat??n.base);return n._flat||MI(s,n.overlay),s.set(t,r),PI(o,s,void 0,0)}return PI(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Vi=d(2,(e,t)=>Gi(e,t.key)),Gi=(e,t)=>{let r=FI(e,t);return r===Mx?void 0:r},dn=d(2,(e,t)=>{let r=FI(e,t.key);if(r===Mx){if(B_(t))return $_(t);throw B3(t)}return r}),Re=dn,OI="~effect/Context/defaultValue",$_=e=>OI in e?e[OI]:e[OI]=e.defaultValue(),B3=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
8
|
+
${s(p)}}`;m=i(f,x)}}return n.delete(f),m}return String(f)}return c(e,0)}var FK="[Circular]";function ni(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Sx(e){return e.map(t=>`[${ni(t)}]`).join("")}function mI(e){try{return e.toISOString()}catch{return"Invalid Date"}}function NK(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function XO(e,t){try{return e[t]}catch{return"[property access threw]"}}function Wc(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,i=O(s,zc)?ho(s):ho(o);if(typeof i=="bigint")return H(i);if(typeof i!="object"||i===null)return i;let a=i instanceof Error&&!O(i,"toJSON")?{...i,name:i.name,message:i.message}:i;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return;if(r.push(i),a!==i&&r.push(a),!UK(a)||DK(a))return a;let c=new Proxy(a,{get(u,f){let p=Reflect.get(u,f,u);return Object.getOwnPropertyDescriptor(u,f)?.get!==void 0?ho(p):p}});return r.push(c),c},t?.space)??"null"}function UK(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function DK(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var Qe=Symbol.for("nodejs.util.inspect.custom"),pr=e=>{try{return e=ho(e),O(e,"toJSON")&&or(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(pr):e}catch{return"[toJSON threw]"}},e_=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?Wc(e,{space:t}):H(e,{space:t})}catch{return String(e)}},Ot={toJSON(){return pr(this)},[Qe](){return this.toJSON()},toString(){return H(this.toJSON())}},bx=class{[Qe](){return this.toJSON()}toString(){return H(this.toJSON())}};var BK=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},$K=BK(),Ir=()=>Error.stackTraceLimit,yt=e=>{$K&&(Error.stackTraceLimit=e)};var _a=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},jK=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=Ir();if(n===0)return r[e];yt(2);let o=t[e](()=>new Error);return yt(n),o.stack?.includes(e)===!0?t[e]:r[e]},Pa=jK();function B(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function Ex(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&B(e,r,t[r])}var si="~effect/Effect",Kc="~effect/Exit",qK={_A:F,_E:F,_R:F},hI=`${si}/identifier`,Se=`${si}/args`,St=`${si}/evaluate`,mr=`${si}/successCont`,go=`${si}/failureCont`,Vc=`${si}/ensureCont`,Jc=Symbol.for("effect/Effect/Yield"),wr={pipe(){return V(this,arguments)},toJSON(){return{...this}},toString(){return H(this.toJSON(),{ignoreToString:!0,space:2})},[Qe](){return this.toJSON()}},r_={[ie](){return Hd(this,Object.keys(this))},[ae](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!Z(this[t[n]],e[t[n]]))return!1;return!0}},zK={[si]:qK,...wr,[Symbol.iterator](){return new _a(this)},toJSON(){return{_id:"Effect",op:this[hI],...Se in this?{args:this[Se]}:void 0}}},ge=e=>O(e,si),Gd=e=>O(e,Kc),Ix="~effect/Cause",Kd="~effect/Cause/Reason",_f=e=>O(e,Ix),n_=e=>O(e,Kd),oi=class{constructor(t){this[Ix]=Ix,this.reasons=t}pipe(){return V(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${H(this.reasons)})`}[Qe](){return this.toJSON()}[ae](t){return _f(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>Z(r,t.reasons[n]))}[ie](){return ri(this.reasons)}},t_=new WeakMap,Rf=class{[Kd];annotations;_tag;constructor(t,r,n){if(this[Kd]=Kd,this._tag=t,r!==Jd&&typeof n=="object"&&n!==null&&r.size>0){let o=t_.get(n);o&&(r=new Map([...o,...r])),t_.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,i)=>{r?.overwrite!==!0&&n.has(i)||n.set(i,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return V(this,arguments)}toString(){return H(this)}[Qe](){return this.toString()}},Jd=new Map,Gc=class extends Rf{constructor(t,r=Jd){super("Fail",r,t),this.error=t}toString(){return`Fail(${H(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[ae](t){return hs(t)&&Z(this.error,t.error)&&Z(this.annotations,t.annotations)}[ie](){return he(Be(this._tag))(he(G(this.error))(G(this.annotations)))}},zi=e=>new oi(e),WK=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=G(o),i=r.get(s);if(i===void 0)r.set(s,[o]);else{if(i.some(a=>Z(a,o)))continue;i.push(o)}n.push(o)}return n},Pf=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new oi(WK(e.reasons,t.reasons));return Z(e,r)?e:r}),xI=new oi([]),Mf=e=>new oi([new Gc(e)]),Vd=class extends Rf{constructor(t,r=Jd){super("Die",r,t),this.defect=t}toString(){return`Die(${H(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[ae](t){return Qd(t)&&Z(this.defect,t.defect)&&Z(this.annotations,t.annotations)}[ie](){return he(Be(this._tag))(he(G(this.defect))(G(this.annotations)))}},gI=e=>new oi([new Vd(e)]),Zd=d(e=>_f(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new oi(e.reasons.map(n=>n.annotate(t,r)))),hs=e=>e._tag==="Fail",Qd=e=>e._tag==="Die",Yd=e=>e._tag==="Interrupt";function KK(e){return ln("Effect.evaluate: Not implemented")}var yo=e=>({...zK,[hI]:e.op,[St]:e[St]??KK,[mr]:e[mr],[go]:e[go],[Vc]:e[Vc]}),Uo=e=>{let t=yo(e),r=function(n){this[Se]=n};return r.prototype=t,function(n){return new r(n)}},o_=e=>{let t={[Kc]:Kc,_tag:e.op,get[e.prop](){return this[Se]},...yo(e),toString(){return`${e.op}(${H(this[Se])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Se]}},[ae](n){return Gd(n)&&n._tag===this._tag&&Z(this[Se],n[Se])},[ie](){return he(Be(e.op),G(this[Se]))}},r=function(n){this[Se]=n};return r.prototype=t,function(n){return new r(n)}},ze=o_({op:"Success",prop:"value",[St](e){let t=e.getCont(mr);return t?t[mr](this[Se],e,this):e.yieldWith(this)}}),wx={key:"effect/Cause/StackTrace"},yI={key:"effect/Cause/InterruptorStackTrace"},Pr=o_({op:"Failure",prop:"cause",[St](e){let t=this[Se],r=!1;e.cache.stackFrame&&(t=Zd(t,{mapUnsafe:new Map([[wx.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(go),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=hI in n,n=e.getCont(go);s&&(t=zi(t.reasons.filter(i=>i._tag!=="Fail"))),t=Pf(t,o),r=!0}return n?n[go](t,e,r?void 0:this):e.yieldWith(r?Pr(t):this)}}),So=e=>Pr(Mf(e)),ln=e=>Pr(gI(e)),oe=Uo({op:"WithFiber",[St](e){return this[Se](e)}}),s_=Uo({op:"WithFiberSucceed",[St](e){let t=this[Se](e),r=e.getCont(mr);return r?r[mr](t,e):e.yieldWith(ze(t))}}),VK=(function(){class e extends globalThis.Error{}let t=yo({op:"YieldableError",[St](){return So(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),Xd=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends VK{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(Ex(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Wi=e=>{class t extends Xd{_tag=e}return t.prototype.name=e,t},Tx="~effect/Cause/NoSuchElementError",SI=e=>O(e,Tx),ms=class extends Wi("NoSuchElementError"){[Tx]=Tx;constructor(t){super({message:t})}},Of="~effect/Cause/Done",i_=e=>O(e,Of),a_={[Of]:Of,_tag:"Done",value:void 0},Zc=e=>e===void 0?a_:{[Of]:Of,_tag:"Done",value:e},GK=So(a_),c_=e=>e===void 0?GK:So(Zc(e));var u_=e=>yo({op:e.label,[St]:e.evaluate});var ke={};ps(ke,{Do:()=>O3,all:()=>x3,andThen:()=>d3,as:()=>C_,asVoid:()=>f3,bind:()=>R3,bindTo:()=>A3,composeK:()=>m3,contains:()=>v3,containsWith:()=>__,exists:()=>C3,filter:()=>Fa,filterMap:()=>b3,firstSomeOf:()=>c3,flatMap:()=>gs,flatMapNullishOr:()=>RI,flatten:()=>eu,fromIterable:()=>r3,fromNullOr:()=>AI,fromNullishOr:()=>Xc,fromUndefinedOr:()=>CI,gen:()=>_3,getFailure:()=>o3,getOrElse:()=>Ma,getOrNull:()=>sp,getOrThrow:()=>kI,getOrThrowWith:()=>Bf,getOrUndefined:()=>_n,getSuccess:()=>n3,isNone:()=>fe,isOption:()=>ci,isSome:()=>de,let:()=>k3,lift2:()=>T3,liftNullishOr:()=>u3,liftPredicate:()=>w3,liftThrowable:()=>xs,makeCombinerFailFast:()=>P_,makeEquivalence:()=>E3,makeOrder:()=>I3,makeReducer:()=>P3,makeReducerFailFast:()=>M3,map:()=>Lt,match:()=>Zt,none:()=>_,orElse:()=>s3,orElseResult:()=>a3,orElseSome:()=>i3,partitionMap:()=>S3,product:()=>R_,productMany:()=>h3,reduceCompact:()=>g3,some:()=>N,tap:()=>k_,toArray:()=>y3,toRefinement:()=>t3,void:()=>l3,zipLeft:()=>p3,zipRight:()=>A_,zipWith:()=>O_});function l_(e){return{combine:e}}function bI(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Wr=e=>(t,r)=>t===r||e(t,r),JK=(e,t)=>e===t,Qc=()=>JK;function m_(e){return Wr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function vx(e){return Wr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var Cx=e=>d(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Ax=e=>d(2,(t,r)=>e(t,n=>({[r]:n}))),kx=(e,t)=>d(3,(r,n,o)=>t(r,s=>e(o(s),i=>({...s,[n]:i}))));var x_="~effect/Option",g_={[x_]:{_A:e=>e},...wr,[Symbol.iterator](){return new _a(this)}},ZK=Object.defineProperty(Object.assign(Object.create(g_),{_tag:"Some",_op:"Some",[ae](e){return Rx(e)&&EI(e)&&Z(this.value,e.value)},[ie](){return he(G(this._tag))(G(this.value))},toString(){return`some(${H(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:pr(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),QK=G("None"),YK=Object.assign(Object.create(g_),{_tag:"None",_op:"None",valueOrUndefined:void 0,[ae](e){return Rx(e)&&Ox(e)},[ie](){return QK},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Rx=e=>O(e,x_),Ox=e=>e._tag==="None",EI=e=>e._tag==="Some",ep=Object.create(YK),y_=function(e){this.value=e};y_.prototype=ZK;var tp=e=>new y_(e);var b_="~effect/Result",E_={[b_]:{_A:e=>e,_E:e=>e},...wr,[Symbol.iterator](){return new _a(this)}},XK=Object.assign(Object.create(E_),{_tag:"Success",_op:"Success",[ae](e){return _x(e)&&Nf(e)&&Z(this.success,e.success)},[ie](){return he(G(this._tag))(G(this.success))},toString(){return`success(${H(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:pr(this.success)}}}),e3=Object.assign(Object.create(E_),{_tag:"Failure",_op:"Failure",[ae](e){return _x(e)&&Ff(e)&&Z(this.failure,e.failure)},[ie](){return he(G(this._tag))(G(this.failure))},toString(){return`failure(${H(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:pr(this.failure)}}}),_x=e=>O(e,b_),Ff=e=>e._tag==="Failure",Nf=e=>e._tag==="Success",I_=function(e){this.failure=e};I_.prototype=e3;var Px=e=>new I_(e),T_=function(e){this.success=e};T_.prototype=XK;var Mx=e=>new T_(e),II=e=>Nf(e)?ep:tp(e.failure),TI=e=>Ff(e)?ep:tp(e.success);function ai(e){return(t,r)=>t===r?0:e(t,r)}var v_=ai((e,t)=>e<t?-1:1),Ki=ai((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var Uf=ai((e,t)=>e<t?-1:1);var wI=d(2,(e,t)=>ai((r,n)=>e(t(r),t(n)))),Df=wI(Ki,e=>e.getTime());var rp=e=>d(2,(t,r)=>e(t,r)===-1),Yc=e=>d(2,(t,r)=>e(t,r)===1),np=e=>d(2,(t,r)=>e(t,r)!==1),op=e=>d(2,(t,r)=>e(t,r)!==-1),vI=e=>d(2,(t,r)=>t===r||e(t,r)<1?t:r);var _=()=>ep,N=tp,ci=Rx,fe=Ox,de=EI,Zt=d(2,(e,{onNone:t,onSome:r})=>fe(e)?t():r(e.value)),t3=e=>t=>de(e(t)),r3=e=>{for(let t of e)return N(t);return _()},n3=TI,o3=II,Ma=d(2,(e,t)=>fe(e)?t():e.value),s3=d(2,(e,t)=>fe(e)?t():e),i3=d(2,(e,t)=>fe(e)?N(t()):e),a3=d(2,(e,t)=>fe(e)?Lt(t(),Mx):Lt(e,Px)),c3=e=>{let t=_();for(t of e)if(de(t))return t;return t},Xc=e=>e==null?_():N(e),CI=e=>e===void 0?_():N(e),AI=e=>e===null?_():N(e),u3=e=>(...t)=>Xc(e(...t)),sp=Ma(sI),_n=Ma(po),xs=e=>(...t)=>{try{return N(e(...t))}catch{return _()}},Bf=d(2,(e,t)=>{if(de(e))return e.value;throw t()}),kI=Bf(()=>new Error("getOrThrow called on a None")),Lt=d(2,(e,t)=>fe(e)?_():N(t(e.value))),C_=d(2,(e,t)=>Lt(e,()=>t)),f3=C_(void 0),l3=N(void 0);var gs=d(2,(e,t)=>fe(e)?_():t(e.value)),d3=d(2,(e,t)=>gs(e,r=>{let n=or(t)?t(r):t;return ci(n)?n:N(n)})),RI=d(2,(e,t)=>fe(e)?_():Xc(t(e.value))),eu=gs(F),A_=d(2,(e,t)=>gs(e,()=>t)),p3=d(2,(e,t)=>k_(e,()=>t)),m3=d(2,(e,t)=>r=>gs(e(r),t)),k_=d(2,(e,t)=>gs(e,r=>Lt(t(r),()=>r))),R_=d(2,(e,t)=>de(e)&&de(t)?N([e.value,t.value]):_()),h3=d(2,(e,t)=>{if(fe(e))return _();let r=[e.value];for(let n of t){if(fe(n))return _();r.push(n.value)}return N(r)}),x3=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(fe(n))return _();r.push(n.value)}return N(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(fe(n))return _();B(t,r,n.value)}return N(t)},O_=d(3,(e,t,r)=>Lt(R_(e,t),([n,o])=>r(n,o))),g3=d(3,(e,t,r)=>{let n=t;for(let o of e)de(o)&&(n=r(n,o.value));return n}),y3=e=>fe(e)?[]:[e.value],S3=d(2,(e,t)=>{if(fe(e))return[_(),_()];let r=t(e.value);return Ff(r)?[_(),N(r.failure)]:[N(r.success),_()]}),b3=d(2,(e,t)=>{if(fe(e))return _();let r=t(e.value);return Nf(r)?N(r.success):_()}),Fa=d(2,(e,t)=>fe(e)?_():t(e.value)?N(e.value):_()),E3=e=>Wr((t,r)=>fe(t)?fe(r):fe(r)?!1:e(t.value,r.value)),I3=e=>ai((t,r)=>de(t)?de(r)?e(t.value,r.value):1:-1),T3=e=>d(2,(t,r)=>O_(t,r,e)),w3=d(2,(e,t)=>t(e)?N(e):_()),__=e=>d(2,(t,r)=>fe(t)?!1:e(t.value,r)),v3=__(Wd()),C3=d(2,(e,t)=>fe(e)?!1:t(e.value)),A3=Ax(Lt),k3=Cx(Lt);var R3=kx(Lt,gs),O3=N({}),_3=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(fe(o))return o;n=r.next(o.value)}return N(n.value)};function P3(e){return bI((t,r)=>fe(t)?r:fe(r)?t:N(e.combine(t.value,r.value)),_())}function P_(e){return l_((t,r)=>fe(t)||fe(r)?_():N(e.combine(t.value,r.value)))}function M3(e){let t=P_(e).combine,r=N(e.initialValue);return bI(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),fe(o))return o;return o})}var M_="~effect/Context/Service",Ue=function(){function e(){}let t=e;Object.setPrototypeOf(t,F3);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[_I]=_I,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&F_.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},F3={[M_]:M_,...u_({label:"Service",evaluate(e){return ze(Re(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return ys(this,e)},use(e){return oe(t=>e(Re(t.context,this)))},useSync(e){return oe(t=>ze(e(Re(t.context,this))))}},F_=new Set,_I="~effect/Context/Reference",N_="~effect/Context",N3=8,U3=8,PI=(e,t,r,n)=>{let o=Object.create(D3);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},MI=(e,t)=>{t&&(MI(e,t.parent),e.set(t.key,t.value))},U_=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return MI(t,e.overlay),e._flat=t},D_=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),qn(r)},Fx=Symbol(),FI=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?Fx:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=U3&&(r.base=U_(r),r.overlay=void 0,r.depth=0),n)},qn=e=>PI(void 0,e,void 0,0),D3={get mapUnsafe(){return U_(this)},...wr,[N_]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ae](e){if(!ip(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!Z(o,r.get(n)))return!1;return!0},[ie](){return zt(this.mapUnsafe.size)}},L_=(e,t)=>e.cacheRoot===t.cacheRoot,ip=e=>O(e,N_);var B_=e=>!!e[_I],pt=()=>L3,L3=qn(new Map),ys=(e,t)=>qn(new Map([[e.key,t]])),We=d(3,(e,t,r)=>B3(e,t.key,r)),B3=(e,t,r)=>{let n=e,o=F_.has(t)?void 0:n.cacheRoot;if(n.depth>=N3){let s=new Map(n._flat??n.base);return n._flat||MI(s,n.overlay),s.set(t,r),PI(o,s,void 0,0)}return PI(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Vi=d(2,(e,t)=>Gi(e,t.key)),Gi=(e,t)=>{let r=FI(e,t);return r===Fx?void 0:r},dn=d(2,(e,t)=>{let r=FI(e,t.key);if(r===Fx){if(B_(t))return $_(t);throw $3(t)}return r}),Re=dn,OI="~effect/Context/defaultValue",$_=e=>OI in e?e[OI]:e[OI]=e.defaultValue(),$3=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
9
9
|
`);r.splice(1,3),t.stack=r.join(`
|
|
10
|
-
`)}return t},Fx=d(2,(e,t)=>{let r=FI(e,t.key);return r!==Mx?N(r):B_(t)?N($_(t)):_()}),Kr=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:D_(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),j_=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return qn(t)};var H_=(...e)=>t=>D_(t,r=>{for(let n=0;n<e.length;n++)r.delete(e[n].key)}),Ce=Ue;var NI=e=>e.length>0;var Bt=e=>e>0?Math.floor(e):0,Lo=e=>Math.max(1,Bt(e));var X=Px,re=_x;var Nx=e=>{if(or(e))try{return X(e())}catch(t){return re(t)}else try{return X(e.try())}catch(t){return re(e.catch(t))}};var Bf=Ox,be=Mf,tt=Ff;var UI=d(2,(e,t)=>be(e)?re(t(e.failure)):e),Vr=d(2,(e,t)=>tt(e)?X(t(e.success)):e),zn=d(2,(e,{onFailure:t,onSuccess:r})=>be(e)?t(e.failure):r(e.success));var ip=d(2,(e,t)=>be(e)?t(e.failure):e.success);var j3=d(2,(e,t)=>{if(tt(e))return e.success;throw t(e.failure)}),eu=j3(F);var hr=d(2,(e,t)=>be(e)?re(e.failure):t(e.success));var q_=m_;var H3=(e,t)=>{let r=t?.length!==void 0?Lo(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var q3=d(2,(e,t)=>z3(H3(()=>e,{length:t}))),W_=e=>q3(e,1/0);var K_=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error("headUnsafe: empty iterable");return r.value};var V_=d(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(dx(o)){if(o)return N(n)}else if(de(o))return o;r++}return _()});var z3=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var G_=d(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var W3=d(2,(e,t)=>Object.hasOwn(e,t));var Ux=d(2,(e,t)=>{let r={...e};for(let n of J_(e))B(r,n,t(e[n],n));return r});var J_=e=>Object.keys(e);var K3=e=>d(2,(t,r)=>{for(let n of J_(t))if(!W3(r,n)||!e(t[n],r[n]))return!1;return!0});var Z_=e=>{let t=K3(e);return(r,n)=>t(r,n)&&t(n,r)};var Lx=globalThis.Array;var Q_=d(2,(e,t)=>{let r=Lo(e),n=new Lx(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),DI=(e,t)=>e<=t?Q_(t-e+1,r=>e+r):[e];var Ct=e=>Lx.isArray(e)?e:Lx.from(e);var Bx=d(2,(e,t)=>[...e,t]),cp=d(2,(e,t)=>Ct(e).concat(Ct(t)));var Y_=Lx.isArray;var Gr=NI,bt=NI;function $x(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function V3(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var X_=d(2,(e,t)=>{let r=Math.floor(t);if(V3(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var $f=e=>e[e.length-1];var LI=V_;var G3=(e,t)=>{let r=G(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(Z(o,t))return!1;return n.push(t),!0};var Qt=()=>[],Me=e=>[e],Bo=d(2,(e,t)=>e.map(t));var jx=d(2,(e,t)=>{let r=Ct(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),BI=d(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let i=t(s,o++);tt(i)?r.push(i.success):n.push(i.failure)}return[r,n]});var eP=wx;var Hx=e=>{let t=Ct(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)G3(r,o)&&n.push(o);return n};var zx="~effect/Duration",Ua=BigInt(0),aP=BigInt(1),Y3=BigInt(2),X3=BigInt(10),tP=BigInt(24),qx=BigInt(60),$I=BigInt(1e3),rP=BigInt(1e6);var jI=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),cP=e=>jI(e*1e6),nP=e=>pn(Number.isFinite(e)?jI(e):e),oP=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=X3**BigInt(o.length),i=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return eV(n?-i:i,s)},eV=(e,t)=>{let r=e<Ua?-e:e,n=r/t+(r%t*Y3>=t?aP:Ua);return e<Ua?-n:n};var tV=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,$e=e=>{switch(typeof e){case"number":return Zi(e);case"bigint":return $o(e);case"string":{if(e==="Infinity")return Ss;if(e==="-Infinity")return Da;let t=tV.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return $o(oP(n,aP));if(o==="micro"||o==="micros")return $o(oP(n,$I));let s=Number(n);switch(o){case"milli":case"millis":return Zi(s);case"second":case"seconds":return up(s);case"minute":case"minutes":return aV(s);case"hour":case"hours":return cV(s);case"day":case"days":return uV(s);case"week":case"weeks":return fV(s)}break}case"object":{if(e===null)break;if(zx in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Ld)?sP(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ji:e[0]===-1/0||e[1]===-1/0?Da:e[0]===1/0||e[1]===1/0?Ss:nP(e[0]*1e9+e[1]);let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?pn(r):nP(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return sP(e)},sP=e=>{throw new Error(`Invalid Input: ${e}`)},uP=xs($e),iP={_tag:"Millis",millis:0},rV={_tag:"Infinity"},nV={_tag:"NegativeInfinity"},oV={[zx]:zx,[ie](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?G(jI(e)):zt(this.value.millis)}case"Nanos":return G(this.value.nanos);default:return Hd(this.value)}},[ae](e){return Qi(e)&&pV(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},pn=e=>{let t=Object.create(oV);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=iP:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:cP(e)}:t.value=e>0?rV:nV:e===Ua?t.value=iP:t.value={_tag:"Nanos",nanos:e},t},Qi=e=>O(e,zx),Wn=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",jf=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Ua;case"Infinity":case"NegativeInfinity":return!1}},sV=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<Ua;case"NegativeInfinity":return!0;case"Infinity":return!1}};var iV=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return Ss;case"Millis":return e.value.millis<0?pn(-e.value.millis):e;case"Nanos":return e.value.nanos<Ua?pn(-e.value.nanos):e}};var Ji=pn(0),Ss=pn(1/0),Da=pn(-1/0),$o=e=>pn(e);var Zi=e=>pn(e),up=e=>pn(e*1e3),aV=e=>pn(e*6e4),cV=e=>pn(e*36e5),uV=e=>pn(e*864e5),fV=e=>pn(e*6048e5),Wt=e=>lP($e(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ui=e=>lP($e(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Wx=e=>{let t=$e(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return cP(t.value.millis)}},fP=xs(Wx);var lP=d(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),HI=d(3,(e,t,r)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?r.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(Wx(e),t.value.nanos):r.onNanos(e.value.nanos,Wx(t))),lV=ai((e,t)=>HI(e,t,{onMillis:(r,n)=>r<n?-1:r>n?1:0,onNanos:(r,n)=>r<n?-1:r>n?1:0,onInfinity:(r,n)=>r.value._tag===n.value._tag?0:r.value._tag==="Infinity"?1:r.value._tag==="NegativeInfinity"||n.value._tag==="Infinity"?-1:1}));var dV=(e,t)=>HI(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag}),dP=vI(lV);var pP=d(2,(e,t)=>HI(e,t,{onMillis:(r,n)=>pn(r-n),onNanos:(r,n)=>pn(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?Ji:Ss:o==="NegativeInfinity"?s==="NegativeInfinity"?Ji:Da:s==="Infinity"?Da:Ss}}));var pV=d(2,(e,t)=>dV(e,t)),mV=e=>{if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag==="NegativeInfinity")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=Wx(e),r=t<Ua,n=r?-t:t,o=n/rP,s=o/$I,i=s/qx,a=i/qx,c=a/tP,u=r?-1:1;return{days:u*Number(c),hours:u*Number(a%tP),minutes:u*Number(i%qx),seconds:u*Number(s%qx),millis:u*Number(o%$I),nanos:u*Number(n%rP)}},qI=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(jf(e))return"0";if(sV(e))return"-"+qI(iV(e));let t=mV(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(" ")};var La=Ce("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new fi}),mP=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},hV="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},hP=e=>{try{return hV(e)}catch{return mP(e)}},zI=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,i=0;for(;i<o&&!(n[i][0]>r);i++)s=n[i];s&&s[0]===r?s[1].push(t):i===o?n.push([r,[t]]):n.splice(i,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},fi=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?mP:hP)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new WI(this.setImmediate)}},WI=class{tasks=new zI;running=void 0;setImmediate;constructor(t=hP){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},xP=Ce("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),gP=Ce("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var yP=class extends Ra{constructor(e){super(),e&&bx(this,e)}};var SP=Yd,sr=Wi;var bP="~effect/encoding/EncodingError",jo=class extends sr("EncodingError"){[bP]=bP};var Vx=e=>EP(typeof e=="string"?SV.encode(e):e),KI=e=>{switch(e){case 16:return gV();case 32:return yV();default:{let t="";for(let r=e>>>3;r>0;r--)t+=xV();return t}}},ue=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),tu=()=>Math.random()*4294967296>>>0,xV=()=>{let e=tu();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15])},gV=()=>{let e=tu(),t=tu();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15],ue[t>>>28],ue[t>>>24&15],ue[t>>>20&15],ue[t>>>16&15],ue[t>>>12&15],ue[t>>>8&15],ue[t>>>4&15],ue[t&15])},yV=()=>{let e=tu(),t=tu(),r=tu(),n=tu();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15],ue[t>>>28],ue[t>>>24&15],ue[t>>>20&15],ue[t>>>16&15],ue[t>>>12&15],ue[t>>>8&15],ue[t>>>4&15],ue[t&15],ue[r>>>28],ue[r>>>24&15],ue[r>>>20&15],ue[r>>>16&15],ue[r>>>12&15],ue[r>>>8&15],ue[r>>>4&15],ue[r&15],ue[n>>>28],ue[n>>>24&15],ue[n>>>20&15],ue[n>>>16&15],ue[n>>>12&15],ue[n>>>8&15],ue[n>>>4&15],ue[n&15])},VI=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return re(new jo({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=IP(t[o*2]),i=IP(t[o*2+1]);n[o]=s<<4|i}return X(n)}catch(r){return re(new jo({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},TP=e=>Vr(VI(e),t=>bV.decode(t)),SV=new TextEncoder,bV=new TextDecoder,EV=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),EP=e=>{let t="";for(let r=0;r<e.length;r++)t+=EV[e[r]];return t},IP=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var ZI="effect/Tracer/ParentSpan",li=class extends Ue()(ZI,{fiberCached:!0}){},IV=e=>e;var Hf=Ce("effect/Tracer/DisablePropagation",{defaultValue:Oa}),wP=Ce("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),vP=Ce("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),QI="effect/Tracer",YI=Ce(QI,{fiberCached:!0,defaultValue:()=>XI}),XI=IV({span:e=>new JI(e)}),JI=class{_tag="Span";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime}}get traceId(){return this._traceId??=_n(this.parent)?.traceId??KI(32)}get spanId(){return this._spanId??=KI(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var CP="effect/Metric/FiberRuntimeMetrics";var AP=Ce("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),qf=Ce("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:po}),Jx=Ce("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:nr}),ru=Ce("effect/References/TracerTimingEnabled",{defaultValue:nr}),fp=Ce("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),lp=Ce("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Xi=Ce("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),eT=Ce("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),tT=Ce("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),kP=Ce("effect/References/UnhandledLogLevel",{defaultValue:()=>"Error"}),Zx=Ce("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var Ho=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Ir();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};yt(3);let r=new Error;return yt(t),{...e,captureStackTrace:vV(()=>r.stack)}},rT=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`
|
|
11
|
-
`);if(o[e]!==void 0)return r=o[e].trim(),r}},
|
|
10
|
+
`)}return t},Nx=d(2,(e,t)=>{let r=FI(e,t.key);return r!==Fx?N(r):B_(t)?N($_(t)):_()}),Kr=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:D_(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),j_=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return qn(t)};var H_=(...e)=>t=>D_(t,r=>{for(let n=0;n<e.length;n++)r.delete(e[n].key)}),Ce=Ue;var NI=e=>e.length>0;var Bt=e=>e>0?Math.floor(e):0,Lo=e=>Math.max(1,Bt(e));var X=Mx,re=Px;var Ux=e=>{if(or(e))try{return X(e())}catch(t){return re(t)}else try{return X(e.try())}catch(t){return re(e.catch(t))}};var $f=_x,be=Ff,tt=Nf;var UI=d(2,(e,t)=>be(e)?re(t(e.failure)):e),Vr=d(2,(e,t)=>tt(e)?X(t(e.success)):e),zn=d(2,(e,{onFailure:t,onSuccess:r})=>be(e)?t(e.failure):r(e.success));var ap=d(2,(e,t)=>be(e)?t(e.failure):e.success);var H3=d(2,(e,t)=>{if(tt(e))return e.success;throw t(e.failure)}),tu=H3(F);var hr=d(2,(e,t)=>be(e)?re(e.failure):t(e.success));var q_=m_;var q3=(e,t)=>{let r=t?.length!==void 0?Lo(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var z3=d(2,(e,t)=>W3(q3(()=>e,{length:t}))),W_=e=>z3(e,1/0);var K_=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error("headUnsafe: empty iterable");return r.value};var V_=d(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(px(o)){if(o)return N(n)}else if(de(o))return o;r++}return _()});var W3=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var G_=d(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var K3=d(2,(e,t)=>Object.hasOwn(e,t));var Dx=d(2,(e,t)=>{let r={...e};for(let n of J_(e))B(r,n,t(e[n],n));return r});var J_=e=>Object.keys(e);var V3=e=>d(2,(t,r)=>{for(let n of J_(t))if(!K3(r,n)||!e(t[n],r[n]))return!1;return!0});var Z_=e=>{let t=V3(e);return(r,n)=>t(r,n)&&t(n,r)};var Bx=globalThis.Array;var Q_=d(2,(e,t)=>{let r=Lo(e),n=new Bx(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),DI=(e,t)=>e<=t?Q_(t-e+1,r=>e+r):[e];var Ct=e=>Bx.isArray(e)?e:Bx.from(e);var $x=d(2,(e,t)=>[...e,t]),up=d(2,(e,t)=>Ct(e).concat(Ct(t)));var Y_=Bx.isArray;var Gr=NI,bt=NI;function jx(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function G3(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var X_=d(2,(e,t)=>{let r=Math.floor(t);if(G3(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var jf=e=>e[e.length-1];var LI=V_;var J3=(e,t)=>{let r=G(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(Z(o,t))return!1;return n.push(t),!0};var Qt=()=>[],Me=e=>[e],Bo=d(2,(e,t)=>e.map(t));var Hx=d(2,(e,t)=>{let r=Ct(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),BI=d(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let i=t(s,o++);tt(i)?r.push(i.success):n.push(i.failure)}return[r,n]});var eP=vx;var qx=e=>{let t=Ct(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)J3(r,o)&&n.push(o);return n};var Wx="~effect/Duration",Ua=BigInt(0),aP=BigInt(1),X3=BigInt(2),eV=BigInt(10),tP=BigInt(24),zx=BigInt(60),$I=BigInt(1e3),rP=BigInt(1e6);var jI=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),cP=e=>jI(e*1e6),nP=e=>pn(Number.isFinite(e)?jI(e):e),oP=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=eV**BigInt(o.length),i=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return tV(n?-i:i,s)},tV=(e,t)=>{let r=e<Ua?-e:e,n=r/t+(r%t*X3>=t?aP:Ua);return e<Ua?-n:n};var rV=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,$e=e=>{switch(typeof e){case"number":return Zi(e);case"bigint":return $o(e);case"string":{if(e==="Infinity")return Ss;if(e==="-Infinity")return Da;let t=rV.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return $o(oP(n,aP));if(o==="micro"||o==="micros")return $o(oP(n,$I));let s=Number(n);switch(o){case"milli":case"millis":return Zi(s);case"second":case"seconds":return fp(s);case"minute":case"minutes":return cV(s);case"hour":case"hours":return uV(s);case"day":case"days":return fV(s);case"week":case"weeks":return lV(s)}break}case"object":{if(e===null)break;if(Wx in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Bd)?sP(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ji:e[0]===-1/0||e[1]===-1/0?Da:e[0]===1/0||e[1]===1/0?Ss:nP(e[0]*1e9+e[1]);let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?pn(r):nP(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return sP(e)},sP=e=>{throw new Error(`Invalid Input: ${e}`)},uP=xs($e),iP={_tag:"Millis",millis:0},nV={_tag:"Infinity"},oV={_tag:"NegativeInfinity"},sV={[Wx]:Wx,[ie](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?G(jI(e)):zt(this.value.millis)}case"Nanos":return G(this.value.nanos);default:return qd(this.value)}},[ae](e){return Qi(e)&&mV(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},pn=e=>{let t=Object.create(sV);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=iP:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:cP(e)}:t.value=e>0?nV:oV:e===Ua?t.value=iP:t.value={_tag:"Nanos",nanos:e},t},Qi=e=>O(e,Wx),Wn=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",Hf=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Ua;case"Infinity":case"NegativeInfinity":return!1}},iV=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<Ua;case"NegativeInfinity":return!0;case"Infinity":return!1}};var aV=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return Ss;case"Millis":return e.value.millis<0?pn(-e.value.millis):e;case"Nanos":return e.value.nanos<Ua?pn(-e.value.nanos):e}};var Ji=pn(0),Ss=pn(1/0),Da=pn(-1/0),$o=e=>pn(e);var Zi=e=>pn(e),fp=e=>pn(e*1e3),cV=e=>pn(e*6e4),uV=e=>pn(e*36e5),fV=e=>pn(e*864e5),lV=e=>pn(e*6048e5),Wt=e=>lP($e(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ui=e=>lP($e(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Kx=e=>{let t=$e(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return cP(t.value.millis)}},fP=xs(Kx);var lP=d(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),HI=d(3,(e,t,r)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?r.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(Kx(e),t.value.nanos):r.onNanos(e.value.nanos,Kx(t))),dV=ai((e,t)=>HI(e,t,{onMillis:(r,n)=>r<n?-1:r>n?1:0,onNanos:(r,n)=>r<n?-1:r>n?1:0,onInfinity:(r,n)=>r.value._tag===n.value._tag?0:r.value._tag==="Infinity"?1:r.value._tag==="NegativeInfinity"||n.value._tag==="Infinity"?-1:1}));var pV=(e,t)=>HI(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag}),dP=vI(dV);var pP=d(2,(e,t)=>HI(e,t,{onMillis:(r,n)=>pn(r-n),onNanos:(r,n)=>pn(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?Ji:Ss:o==="NegativeInfinity"?s==="NegativeInfinity"?Ji:Da:s==="Infinity"?Da:Ss}}));var mV=d(2,(e,t)=>pV(e,t)),hV=e=>{if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag==="NegativeInfinity")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=Kx(e),r=t<Ua,n=r?-t:t,o=n/rP,s=o/$I,i=s/zx,a=i/zx,c=a/tP,u=r?-1:1;return{days:u*Number(c),hours:u*Number(a%tP),minutes:u*Number(i%zx),seconds:u*Number(s%zx),millis:u*Number(o%$I),nanos:u*Number(n%rP)}},qI=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(Hf(e))return"0";if(iV(e))return"-"+qI(aV(e));let t=hV(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(" ")};var La=Ce("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new fi}),mP=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},xV="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},hP=e=>{try{return xV(e)}catch{return mP(e)}},zI=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,i=0;for(;i<o&&!(n[i][0]>r);i++)s=n[i];s&&s[0]===r?s[1].push(t):i===o?n.push([r,[t]]):n.splice(i,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},fi=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?mP:hP)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new WI(this.setImmediate)}},WI=class{tasks=new zI;running=void 0;setImmediate;constructor(t=hP){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},xP=Ce("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),gP=Ce("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var yP=class extends Ra{constructor(e){super(),e&&Ex(this,e)}};var SP=Xd,sr=Wi;var bP="~effect/encoding/EncodingError",jo=class extends sr("EncodingError"){[bP]=bP};var Gx=e=>EP(typeof e=="string"?bV.encode(e):e),KI=e=>{switch(e){case 16:return yV();case 32:return SV();default:{let t="";for(let r=e>>>3;r>0;r--)t+=gV();return t}}},ue=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),ru=()=>Math.random()*4294967296>>>0,gV=()=>{let e=ru();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15])},yV=()=>{let e=ru(),t=ru();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15],ue[t>>>28],ue[t>>>24&15],ue[t>>>20&15],ue[t>>>16&15],ue[t>>>12&15],ue[t>>>8&15],ue[t>>>4&15],ue[t&15])},SV=()=>{let e=ru(),t=ru(),r=ru(),n=ru();return String.fromCharCode(ue[e>>>28],ue[e>>>24&15],ue[e>>>20&15],ue[e>>>16&15],ue[e>>>12&15],ue[e>>>8&15],ue[e>>>4&15],ue[e&15],ue[t>>>28],ue[t>>>24&15],ue[t>>>20&15],ue[t>>>16&15],ue[t>>>12&15],ue[t>>>8&15],ue[t>>>4&15],ue[t&15],ue[r>>>28],ue[r>>>24&15],ue[r>>>20&15],ue[r>>>16&15],ue[r>>>12&15],ue[r>>>8&15],ue[r>>>4&15],ue[r&15],ue[n>>>28],ue[n>>>24&15],ue[n>>>20&15],ue[n>>>16&15],ue[n>>>12&15],ue[n>>>8&15],ue[n>>>4&15],ue[n&15])},VI=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return re(new jo({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=IP(t[o*2]),i=IP(t[o*2+1]);n[o]=s<<4|i}return X(n)}catch(r){return re(new jo({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},TP=e=>Vr(VI(e),t=>EV.decode(t)),bV=new TextEncoder,EV=new TextDecoder,IV=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),EP=e=>{let t="";for(let r=0;r<e.length;r++)t+=IV[e[r]];return t},IP=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var ZI="effect/Tracer/ParentSpan",li=class extends Ue()(ZI,{fiberCached:!0}){},TV=e=>e;var qf=Ce("effect/Tracer/DisablePropagation",{defaultValue:Oa}),wP=Ce("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),vP=Ce("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),QI="effect/Tracer",YI=Ce(QI,{fiberCached:!0,defaultValue:()=>XI}),XI=TV({span:e=>new JI(e)}),JI=class{_tag="Span";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime}}get traceId(){return this._traceId??=_n(this.parent)?.traceId??KI(32)}get spanId(){return this._spanId??=KI(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var CP="effect/Metric/FiberRuntimeMetrics";var AP=Ce("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),zf=Ce("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:po}),Zx=Ce("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:nr}),nu=Ce("effect/References/TracerTimingEnabled",{defaultValue:nr}),lp=Ce("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),dp=Ce("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Xi=Ce("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),eT=Ce("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),tT=Ce("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),kP=Ce("effect/References/UnhandledLogLevel",{defaultValue:()=>"Error"}),Qx=Ce("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var Ho=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Ir();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};yt(3);let r=new Error;return yt(t),{...e,captureStackTrace:CV(()=>r.stack)}},rT=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`
|
|
11
|
+
`);if(o[e]!==void 0)return r=o[e].trim(),r}},CV=rT(3);var Yx=class extends Rf{constructor(t,r=Jd){super("Interrupt",r,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[ae](t){return Yd(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[ie](){return he(Be(`${this._tag}:${this.fiberId}`))(xx(this.annotations))}},UP=e=>new Yx(e),$a=e=>new oi([new Yx(e)]),DP=e=>e.reasons.some(hs),LP=e=>{let t=e.reasons.find(hs);return t?X(t):re(e)},qo=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return X(r.error)}return re(e)};var BP=e=>e.reasons.some(Qd);var ag=e=>{let t=e.reasons.find(Qd);return t?X(t.defect):re(e)},cg=e=>e.reasons.some(Yd);var yT=e=>{let t;for(let r=0;r<e.reasons.length;r++){let n=e.reasons[r];n._tag==="Interrupt"&&(t??=new Set,n.fiberId!==void 0&&t.add(n.fiberId))}return t?X(t):re(e)},$P=e=>{let t=yT(e);return be(t)?kV:t.success},kV=new Set,ug=e=>e.reasons.length>0&&e.reasons.every(Yd);var jP=d(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>hs(o)?(r=!0,new Gc(t(o.error),o.annotations)):o);return r?zi(n):e}),fg=e=>{let t;for(let r of e.reasons){if(r._tag==="Fail")return r.error;r._tag==="Die"&&(t??=r)}return t!==void 0?t.defect:e.reasons.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},HP=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=Ir();o!==0&&yt(1);try{for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(oT(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=new Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=PV(s,n);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,r.push(oT(i,n[0].annotations,t))}}finally{o!==0&&yt(o)}return r},oT=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(RV(e),{cause:e.cause?oT(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=_V(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?sT(s,t):s}r?.includeCauseInStack&&(o.stack=zP(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else{o=new globalThis.Error(e?n==="string"?e:Wc(e):`Unknown error: ${e}`);let s=`${o.name}: ${o.message}`;o.stack=t?sT(s,t):s}return o},RV=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Wc(e)},OV=/\((.*)\)/g,_V=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
|
|
12
12
|
`),s=[n];for(let i=1;i<o.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(o[i]);i++)s.push(o[i]);return r?sT(s.join(`
|
|
13
13
|
`),r):s.join(`
|
|
14
|
-
`)},sT=(e,t)=>{let r=t?.get(
|
|
15
|
-
${qP(r)}`),e},
|
|
16
|
-
`)},qP=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(
|
|
17
|
-
`)},
|
|
14
|
+
`)},sT=(e,t)=>{let r=t?.get(wx.key);return r&&(e=`${e}
|
|
15
|
+
${qP(r)}`),e},PV=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:"unknown",s=n.annotations.get(yI.key);r.push(` at fiber (${o})`),s&&r.push(qP(s))}return r.join(`
|
|
16
|
+
`)},qP=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(OV),i=!1;for(let[,a]of s)i=!0,t.push(` at ${r.name} (${a})`);i||t.push(` at ${r.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${r.name}`);r=r.parent,n++}return t.join(`
|
|
17
|
+
`)},lg=e=>HP(e).map(zP).join(`
|
|
18
18
|
`),zP=e=>e.cause?`${e.stack} {
|
|
19
19
|
${WP(e.cause," ")}
|
|
20
20
|
}`:e.stack,WP=(e,t)=>{let r=e.stack.split(`
|
|
21
21
|
`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`
|
|
22
22
|
${t}${r[o]}`;return e.cause&&(n+=` {
|
|
23
23
|
${WP(e.cause,`${t} `)}
|
|
24
|
-
${t}}`),n},ST="~effect/Fiber",PV={_A:F,_E:F},MV={id:0},RP=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),KP=()=>RP===void 0?void 0:new RP("effect/Fiber"),ea=()=>globalThis[Af],dp=class{constructor(t,r=!0){this.setContext(t),this.id=++MV.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[ST](){return PV}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return Re(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Rr):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=$a(t);this.cache.stackFrame&&(n=Jd(n,ys(Tx,this.cache.stackFrame))),r&&(n=Jd(n,r)),this._interruptedCause=this._interruptedCause?_f(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ye(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Gc){this._asyncContext=KP();return}let n=iT.interruptChildren&&iT.interruptChildren(this);if(n!==void 0)return this.evaluate(Y(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=pt()}runLoop(t){let r=globalThis[Af];globalThis[Af]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Ye(this._interruptedCause)),this.currentOpCount++;let i=this.cache;if(!o&&!i.preventYield&&i.scheduler.shouldYield(this)){o=!0;let a=s;s=Y(Vf,()=>a)}if(s=i.tracerContext?i.tracerContext(s,this):s[St](this),s===Gc){let a=this._yielded;if(Wc in a)return this._deferredInterrupt=!1,this._yielded=void 0,a;if(this._deferredInterrupt){this._yielded=void 0,a();continue}return Gc}}catch(i){if(!O(s,St))return ln(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=ln(i)}}finally{this._running=n,globalThis[Af]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,NV;for(;;){let r=this._stack.pop();if(!r)return;let n=r[Kc];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&UV-1)===0)return ze(t);let r=this.getCont(mr);return r?r[mr](t,this):this.yieldWith(ze(t))}yieldWith(t){return this._yielded=t,Gc}children(){return this._children??=new Set}pipe(){return V(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&L_(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=FV(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag==="Span"?t:void 0}},FV=e=>{let t=Gi(e,QI);return{scheduler:Re(e,La),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Re(e,Jx),span:Gi(e,ZI),logLevel:Re(e,eT),minimumLogLevel:Re(e,tT),stackFrame:Re(e,qf),runtimeMetrics:Gi(e,CP),maxOpsBeforeYield:Re(e,xP),preventYield:Re(e,gP)}},NV={[mr](e,t){return Ye(t._interruptedCause)},[go](e,t){return Ye(t._interruptedCause)}},UV=32,iT={interruptChildren:void 0},lg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(yI.key,e.cache.stackFrame),qn(t)},DV=e=>{if(!(e._children===void 0||e._children.size===0))return zf(e._children)},bT=e=>{let t=e;return t._exit?q(t._exit):$t(r=>t._exit?r(q(t._exit)):ye(e.addObserver(n=>r(q(n)))))},dg=e=>$t(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let i=r.next();for(;!i.done;){if(i.value._exit){n.push(i.value._exit),i=r.next();continue}o=i.value.addObserver(a=>{n.push(a),s()});return}t(q(n))}return s(),ye(()=>o?.())}),Yx=e=>{let t=e;return t._exit?t._exit:$t(r=>t._exit?r(t._exit):ye(e.addObserver(r)))},VP=e=>$t(t=>{let r=Array.from(e);if(r.length===0)return t(q(Qt()));let n=new Array(r.length),o=Qt(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},i=0,a=!1;for(let c=0;c<r.length&&!a;c++){let u=f=>{if(i++,f._tag==="Failure")return a=!0,s(),t(f);n[c]=f.value,i===r.length&&t(q(n))};o.push(u),r[c].addObserver(u)}return ye(()=>{a=!0,s()})}),hp=e=>oe(t=>GP(e,t.id)),GP=d(e=>O(e[0],ST),(e,t,r)=>oe(n=>{let o=lg(n);return o=o&&r?Kr(o,r):o??r,e.interruptUnsafe(t,o),gp(bT(e))})),zf=e=>oe(t=>{let r=lg(t),n=Qt();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return gp(dg(n))});var q=ze,Ye=Pr,Et=So,ye=Uo({op:"Sync",[St](e){let t=this[Se](),r=e.getCont(mr);return r?r[mr](t,e):e.yieldWith(ze(t))}}),ce=Uo({op:"Suspend",[St](e){return this[Se]()}}),ET=d(e=>e.length>=2||ci(e[0]),(e,t)=>fe(e)?Et(t?t():new ms("Effect.fromOption: Option.none")):q(e.value)),Kf=zn({onFailure:Et,onSuccess:q}),JP=e=>e==null?Et(new ms):q(e),IT=Uo({op:"Yield",[St](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(hn)},this[Se]??0),e.yieldWith(()=>{t=!0})}}),Vf=IT(0),TT=e=>q(N(e)),su=q(_()),ZP=e=>fe(e)?su:_e(e.value,N),QP=e=>ce(()=>Ye(e())),ta=e=>ln(e),pg=e=>ce(()=>Et(e())),pe=q(void 0);var YP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new mp(n,"An error occurred in Effect.try"):e.catch;return ce(()=>{try{return q(t())}catch(n){return Et(r(n))}})};var wT=e=>vT(function(t,r){e(r).then(n=>t(q(n)),n=>t(ta(n)))},e.length!==0),XP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new mp(n,"An error occurred in Effect.tryPromise"):e.catch;return vT(function(n,o){let s=i=>ce(()=>{try{return Et(Pa(()=>r(i)))}catch(a){return ta(a)}});try{t(o).then(i=>n(q(i)),i=>n(s(i)))}catch(i){n(s(i))}},t.length!==0)},eM=e=>oe(t=>e(t.id)),tM=oe(q),rM=eM(q),vT=(function(){let e=yo({op:"Async",[St](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,i=this.register.call(r.cache.scheduler,a=>{n||(n=!0,o?r.evaluate(a):o=a)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&i===void 0?Gc:(r._stack.push(LV(()=>(n=!0,s?.abort(),i??hn))),Gc))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),LV=Uo({op:"AsyncFinalizer",[Kc](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Tp))},[go](e,t){return ag(e)?Y(rF(Pr(e),this[Se]()),()=>Ye(e)):Ye(e)}}),$t=e=>vT(e,e.length>=2),xp=$t(Rr),nM=(...e)=>{if(e.length===1){let n=e[0];return ce(()=>ou(n()))}let[t,r]=e;return ce(()=>ou(r.call(t.self)))},CT=(e,...t)=>{let r=t.length===0?function(){return ce(()=>ou(e.apply(this,arguments)))}:function(){let n=ce(()=>ou(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return AT(e.length,r)},AT=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),OP=rT(2),oM=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Ir(),o;return n!==0&&(yt(2),o=new globalThis.Error,yt(n)),e?(s,...i)=>_P(t,s,o,i,e,r):_P(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},_P=(e,t,r,n,o,s)=>{let i=typeof t=="function"?t:n.shift().bind(t.self),a=`${e} (definition)`,c=r?OP(()=>r.stack):po;return AT(i.length,function(...u){let f=ce(()=>{let h=i.apply(this,arguments);return ge(h)?h:ou(h)});for(let h=0;h<n.length;h++)f=n[h](f,...u);if(!ge(f))return f;let p=Ir(),m;return p!==0&&(yt(2),m=new globalThis.Error,yt(p)),na(o?pp(e,s,h=>lT(f,h)):f,qf,h=>({name:e,stack:m?OP(()=>m.stack):po,parent:{name:a,stack:c,parent:h}}))})},sM=(e,...t)=>AT(e.length,t.length===0?function(){return PP(()=>e.apply(this,arguments))}:function(){let r=PP(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),PP=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return q(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else{if(o&&o._tag==="Failure")return n.value;{let s=!0;return ce(()=>s?(s=!1,Y(n.value,i=>ou(t,i))):ce(()=>ou(e())))}}}}catch(t){return ta(t)}},ou=(function(){let e=yo({op:"Iterator",[mr](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return q(s.value);if(Xe(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[St](r){return this[mr](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Zr=d(2,(e,t)=>new ra(e,kT,q(t))),mg=function(e){return e._stack.push(this),this[Se]},BV=yo({op:"OnSuccess",[St]:mg}),ra=function(e,t,r){this[Se]=e,this[mr]=t,this.payload=r};ra.prototype=BV;var kT=function(){return this.payload},iM=function(e,t){return t.succeedWith(this.payload)},hg=(()=>{let e=Ir();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};yt(1);let n=r[t]();return yt(e),n.stack?.includes("[as "+t+"]")===!0})(),$V=function(e,t){let r=this.payload;return t.succeedWith(hg?r(e):Pa(()=>r(e)))},aM=function(e){let t=this.payload;return t(e)},jV=function(e){let t=this.payload;return new ra(t(e),iM,e)},HV=function(e){return new ra(this.payload,iM,e)},Gf=e=>_e(e,N),cM=e=>Yf(e,{onFailure:q,onSuccess:Et}),bo=d(2,(e,t)=>new ra(e,ge(t)?kT:aM,t)),pi=d(2,(e,t)=>new ra(e,ge(t)?HV:jV,t)),gp=e=>new ra(e,kT,hn),uM=e=>Mn(e,Et),RT=(e,t)=>oe(r=>{let n=new Set;return Wa(r,()=>n.size===0?void 0:zf(n)),$t(o=>{let s=Ct(e),i=s.length,a=0,c=!1,u=[],f=(p,m,h)=>{if(a++,p._tag==="Failure"){u.push(...p.cause.reasons),a>=i&&o(Ye(zi(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:m,index:h,parentFiber:r})};for(let p=0;p<i;p++){let m=au(r,s[p],!0,!0,!1);if(n.add(m),m.addObserver(h=>{n.delete(m),f(h,m,p)}),c)break}})}),OT=(e,t)=>oe(r=>{let n=new Set;return Wa(r,()=>n.size===0?void 0:zf(n)),$t(o=>{let s=!1,i=0;for(let a of e){if(s)break;let c=i++,u=au(r,a,!0,!0,!1);n.add(u),u.addObserver(f=>{n.delete(u);let p=!s;s=!0,o(f),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),fM=d(e=>ge(e[1]),(e,t,r)=>RT([e,t],r)),_T=d(e=>ge(e[1]),(e,t,r)=>OT([e,t],r)),Y=d(2,(e,t)=>new ra(e,aM,t)),lM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):di(e,t)),Xe=e=>e[Wc]!==void 0,dM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?t(e.value):e:Y(e,t)),pM=e=>Y(e,F),_e=d(2,(e,t)=>new ra(e,$V,t)),mM=d(2,(e,t)=>Xe(e)?bM(e,t):_e(e,t)),hM=d(2,(e,t)=>Xe(e)?EM(e,t):BT(e,t)),xM=d(2,(e,t)=>Xe(e)?IM(e,t):$T(e,t)),gM=d(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return e;let r=qo(e.cause);return be(r)?e:t(r.success)}return Es(e,t)}),Jf=e=>Pr($a(e)),Zf=e=>e._tag==="Success";var yM=e=>e._tag==="Failure";var SM=e=>e._tag==="Failure"?X(e.cause):re(e);var PT=e=>e._tag==="Failure"&&ag(e.cause);var hn=ze(void 0),bM=d(2,(e,t)=>e._tag==="Success"?ze(t(e.value)):e),EM=d(2,(e,t)=>{if(e._tag==="Success")return e;let r=qo(e.cause);return be(r)?e:So(t(r.success))}),IM=d(2,(e,t)=>{if(e._tag==="Success")return ze(t.onSuccess(e.value));let r=qo(e.cause);return be(r)?e:So(t.onFailure(r.success))});var TM=d(2,(e,t)=>Zf(e)?t:e),wM=d(2,(e,t)=>Zf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var MT=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?hn:Pr(zi(t))};var vM=e=>e,CM=e=>oe(t=>q(Fx(t.context,e))),qV=e=>oe(t=>ET(Fx(t.context,e))),Qf=d(2,(e,t)=>oe(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),Wa(r,()=>{r.setContext(n)})),e})),na=d(3,(e,t,r)=>Qf(e,n=>{let o=dn(n,t),s=r(o);return o===s?n:We(n,t,s)})),AM=(e,t,r)=>iu(oe(n=>{let o=dn(n.context,e),s=t(o);return n.setContext(We(n.context,e,s)),qa(dn(n.context,Ha),i=>{let a=Fx(n.context,e);if(fe(a))return pe;let c=a.value,u;if(r?.reset===void 0){if(c!==s)return pe;u=o}else u=r.reset(o,s,c);return n.setContext(We(n.context,e,u)),pe})})),FT=()=>zV,zV=oe(e=>q(e.context)),ja=e=>oe(t=>e(t.context)),kM=d(2,(e,t)=>Qf(e,qe(t))),Eo=d(2,(e,t)=>Xe(e)?e:Qf(e,Kr(t))),Pn=function(){return arguments.length===1?d(2,(e,t)=>MP(e,arguments[0],t)):d(3,(e,t,r)=>MP(e,t,r)).apply(this,arguments)},MP=(e,t,r)=>Qf(e,We(t,r)),xg=d(3,(e,t,r)=>Y(r,n=>Pn(e,t,n))),RM=d(e=>ge(e[1]),(e,t,r)=>NT(e,t,(n,o)=>[n,o],r)),NT=d(e=>ge(e[1]),(e,t,r,n)=>n?.concurrent?_e(nl([e,t],{concurrency:2}),([o,s])=>r(o,s)):Y(e,o=>_e(t,s=>r(o,s)))),OM=d(e=>ge(e[0]),(e,t,r)=>QT(e,t,r?n=>Et(r(n)):()=>Et(new ms))),_M=d(2,(e,t)=>Y(t,r=>r?Gf(e):su)),UT=d(2,(e,t)=>Array.from({length:t},()=>e)),PM=d(e=>ge(e[0]),(e,t,r)=>nl(UT(e,t),r)),gg=d(e=>ge(e[0]),(e,t)=>mi({while:nr,body:qe(t?.disableYield?e:Y(e,r=>Vf)),step:Rr})),Mn=d(2,(e,t)=>new MM(e,t.length!==1?r=>t(r):t)),WV=yo({op:"OnFailure",[St]:mg}),MM=function(e,t){this[Se]=e,this[go]=t};MM.prototype=WV;var DT=d(3,(e,t,r)=>Mn(e,n=>t(n)?r(n):Ye(n))),oa=d(3,(e,t,r)=>Mn(e,n=>{let o=t(n);return be(o)?Ye(o.failure):r(o.success,n)})),Es=d(2,(e,t)=>oa(e,qo,r=>t(r))),FM=e=>Yf(e,{onFailure:t=>SI(t)?su:Et(t),onSuccess:TT}),NM=d(2,(e,t)=>oa(e,ig,t)),UM=d(2,(e,t)=>Mn(e,r=>bo(t(r),Ye(r)))),DM=d(3,(e,t,r)=>DT(e,t,n=>bo(r(n),Ye(n)))),yg=d(3,(e,t,r)=>Mn(e,n=>{let o=t(n);return be(o)?Ye(n):bo(r(o.success,n),Ye(n))})),LT=d(2,(e,t)=>yg(e,qo,r=>t(r))),LM=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):Or(t);return LT(e,o=>n(o)?r(o):pe)}),BM=d(2,(e,t)=>yg(e,ig,r=>t(r))),yp=d(e=>ge(e[0]),(e,t,r,n)=>Mn(e,o=>{let s=qo(o);return be(s)?Ye(s.failure):t(s.success)?r(s.success):n?n(s.success):Ye(o)})),Sg=d(e=>ge(e[0]),(e,t,r,n)=>Mn(e,o=>{let s=qo(o);if(be(s))return Ye(s.failure);let i=t(s.success);return be(i)?n?n(i.failure):Ye(o):r(i.success)})),bg=d(e=>ge(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):Or(t);return yp(e,o,r,n)}),$M=d(e=>ge(e[0]),(e,t,r)=>{let n;return Sg(e,o=>(n??=Object.keys(t),O(o,"_tag")&&On(o._tag)&&n.includes(o._tag)?X(o):re(o)),o=>t[o._tag](o),r)}),jM=d(e=>ge(e[0]),(e,t,r,n,o)=>yp(e,s=>Or(s,t)&&O(s,"reason")&&(o!==void 0||Or(s.reason,r)),s=>{let i=s.reason;return Or(i,r)?n(i,s):o?o(i,s):Et(s)})),HM=d(e=>ge(e[0]),(e,t,r,n)=>{let o;return yp(e,s=>Or(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&On(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let i=s.reason;return o??=Object.keys(r),o.includes(i._tag)?r[i._tag](i,s):n?n(i,s):Et(s)})}),qM=d(2,(e,t)=>Sg(e,r=>Or(r,t)&&O(r,"reason")?X(r.reason):re(r),Et)),BT=d(2,(e,t)=>Es(e,r=>pg(()=>t(r)))),$T=d(2,(e,t)=>Yf(e,{onFailure:r=>pg(()=>t.onFailure(r)),onSuccess:r=>ye(()=>t.onSuccess(r))})),Eg=e=>Es(e,ta),zM=d(2,(e,t)=>Es(e,r=>ye(()=>t(r)))),WM=e=>ce(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return ta(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:Es(o.value,i=>n(s))}return n(r)}),jT=e=>Es(e,t=>Y(Vf,()=>jT(e))),KM=d(e=>ge(e[0]),(e,t)=>{if(!t?.log)return Yf(e,{onFailure:n=>pe,onSuccess:n=>pe});let r=Ts(t.log===!0?void 0:t.log);return di(e,{onFailure(n){let o=LP(n);return be(o)?Ye(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>pe})}),Ig=d(e=>ge(e[0]),(e,t)=>{if(!t?.log)return di(e,{onFailure:n=>pe,onSuccess:n=>pe});let r=Ts(t.log===!0?void 0:t.log);return di(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>pe})}),VM=e=>Tg(e,{onFailure:_,onSuccess:N}),Ba=e=>Sp(e,{onFailure:re,onSuccess:X}),di=d(2,(e,t)=>new GM(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),KV=yo({op:"OnSuccessAndFailure",[St]:mg}),GM=function(e,t,r){this[Se]=e,this[mr]=t,this[go]=r};GM.prototype=KV;var VV=function(e,t){let r=this.payload;return t.succeedWith(hg?r.onSuccess(e):Pa(()=>r.onSuccess(e)))},JM=(e,t)=>{let r=yo({op:e,[St]:mg,[mr]:VV,[go]:t}),n=function(o,s){this[Se]=o,this.payload=s};return n.prototype=r,n},GV=JM("Match",function(e,t){let r=e.reasons.find(hs);if(r===void 0)return Ye(e);let n=this.payload;return t.succeedWith(hg?n.onFailure(r.error):Pa(()=>n.onFailure(r.error)))}),JV=JM("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(hg?r.onFailure(e):Pa(()=>r.onFailure(e)))}),HT=d(2,(e,t)=>new JV(e,t)),Yf=d(2,(e,t)=>di(e,{onFailure:r=>{let n=r.reasons.find(hs);return n?t.onFailure(n.error):Ye(r)},onSuccess:t.onSuccess})),Tg=d(2,(e,t)=>new GV(e,t)),Sp=d(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return ze(t.onSuccess(e.value));let r=qo(e.cause);return be(r)?e:ze(t.onFailure(r.success))}return Tg(e,t)}),ZM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?ze(t.onSuccess(e.value)):ze(t.onFailure(e.cause)):HT(e,t)),bp=e=>Xe(e)?ze(e):ZV(e),ZV=Uo({op:"Exit",[St](e){return e._stack.push(this),this[Se]},[mr](e,t,r){return t.succeedWith(r??ze(e))},[go](e,t,r){return t.succeedWith(r??Pr(e))}}),QM=Sp({onFailure:()=>!0,onSuccess:()=>!1}),YM=Sp({onFailure:()=>!1,onSuccess:()=>!0}),XM=d(2,(e,t)=>bo(ol(t),e)),qT=d(2,(e,t)=>Y(zT(e,t.duration),r=>fe(r)?t.orElse():q(r.value))),QV=e=>new rg(`Operation timed out after '${qI(e)}'`),eF=d(2,(e,t)=>{let r=$e(t);return qT(e,{duration:r,orElse:()=>Et(QV(r))})}),zT=d(2,(e,t)=>_T(Gf(e),Zr(ol(t),_()))),tF=e=>Is(t=>{let r=t.monotonicTimeNanosUnsafe();return _e(e,n=>[$o(t.monotonicTimeNanosUnsafe()-r),n])}),aT="~effect/Scope",cT="~effect/Scope/Closeable",Ha=Ue("effect/Scope"),WT=(e,t)=>oe(r=>(tG(r),Xf(e,t)??pe)),Xf=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&eg(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return Xx(r.finalizer,t);let n=r.finalizers;return n.size===1?Xx(n.values().next().value,t):YV(e,n,t)},Xx=(e,t)=>{try{return e(t)}catch(r){return ln(r)}},rF=(e,t)=>Zf(e)?t:Mn(t,r=>Ye(_f(e.cause,r))),YV=CT(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),i=ea();for(let a=s.length-1;a>=0;a--){let c=s[a];e.strategy==="sequential"?n.push(yield*bp(Xx(c,r))):o.push(au(i,Xx(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*dg(o)),yield*MT(n)});var nF=(e,t)=>{let r=sF(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(za(e,r,n=>WT(r,n)),r)},qa=(e,t)=>ce(()=>e.state._tag==="Closed"?t(e.state.exit):(za(e,{},t),pe)),oF=(e,t)=>qa(e,qe(t)),za=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},eg=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=uT:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=uT))},el=e=>sF(e,void 0),sF=(e="sequential",t)=>({[cT]:cT,[aT]:aT,strategy:e,parent:t,state:uT}),uT={_tag:"Empty"};var Ep=Ha,iF=Pn(Ha),wg=e=>oe(t=>{let r=t.context,n=el();return t.setContext(We(t.context,Ha,n)),Wa(t,o=>(t.setContext(r),Xf(n,o))),e});var vg=e=>ce(()=>{let t=el();return To(e(t),r=>ce(()=>Xf(t,r)??pe))}),Cg=(e,t,r)=>ja(n=>Gn(o=>Y(Ep,s=>pi(r?.interruptible?o(e):e,i=>qa(s,a=>Eo(t(i,a),n)))))),tl=e=>Y(Ep,t=>ja(r=>qa(t,n=>Eo(e(n),r)))),aF=(function(){let e=yo({op:"OnExit",[St](r){return r._stack.push(this),this.effect},[Kc](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Tp),r.interruptible=!1)},[mr](r,n,o){o??=ze(r);let s;try{s=this.onExit(o)}catch(i){s=ln(i)}return s?Y(s,i=>o):o},[go](r,n,o){o??=Pr(r);let s;try{s=this.onExit(o)}catch(i){s=ln(i)}return s?Y(rF(o,s),i=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),Io=(e,t,r)=>new aF(e,t,r),Wa=(e,t)=>{e._stack.push(new aF(void 0,t,void 0))},To=d(2,Io),cF=d(2,(e,t)=>To(e,r=>t)),KT=d(3,(e,t,r)=>To(e,n=>t(n)?r(n):pe)),VT=d(3,(e,t,r)=>To(e,n=>{let o=t(n);return be(o)?pe:r(o.success,n)})),Ip=d(2,(e,t)=>VT(e,SM,t)),uF=d(3,(e,t,r)=>KT(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),GT=d(3,(e,t,r)=>To(e,n=>{if(n._tag!=="Failure")return pe;let o=t(n.cause);return be(o)?pe:r(o.success,n.cause)})),fF=d(2,(e,t)=>GT(yT,t)(e)),lF=(e,t,r)=>Gn(n=>Y(e,o=>Io(ce(()=>n(t(o))),s=>r(o,s),!0))),dF=e=>Cg(e,t=>O(t,Symbol.asyncDispose)?wT(()=>t[Symbol.asyncDispose]()):ye(()=>t[Symbol.dispose]())),JT=d(2,(e,t)=>ye(()=>pF(e,typeof t=="function"?r=>Wt($e(t(r))):qe(Wt($e(t)))))),XV=qe(1/0),pF=(e,t)=>{let r=0,n,o,s=(i,a)=>(a.awaiters++,Wa(i,()=>{if(!(--a.awaiters>0||o!==a))return o=void 0,hp(a.fiber)}),Yx(a.fiber));return[oe(i=>{if(o!==void 0)return i===o.fiber?Yx(o.fiber):s(i,o);if(n!==void 0&&(r===1/0||i.getRef(Vn).currentTimeMillisUnsafe()<r))return n;n=void 0;let a=i.getRef(Vn),c={fiber:new dp(i.context),awaiters:0};o=c;let u=s(i,c);return c.fiber.evaluate(Io(e,f=>{if(o!==c||(o=void 0,PT(f)))return;let p=t(f);r=p===1/0?1/0:a.currentTimeMillisUnsafe()+p,n=f})),c.fiber._exit??u}),ye(()=>{n=void 0})]},mF=d(2,(e,t)=>_e(JT(e,t),r=>r[0])),hF=e=>ye(()=>pF(e,XV)[0]),rl=oe(e=>Ye($a(e.id))),iu=e=>oe(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Tp)),e)),xF=Uo({op:"SetInterruptible",[Kc](e){if(e.interruptible=this[Se],e._interruptedCause&&e.interruptible)return()=>Ye(e._interruptedCause)}}),Tp=xF(!0),eG=xF(!1),gF=e=>{if(e.interruptible=!0,e._stack.push(eG),e._interruptedCause)return Ye(e._interruptedCause)},tG=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Tp))};var Ag=e=>oe(t=>t.interruptible?e:gF(t)??e),Gn=e=>oe(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Tp),e(Ag)):e(F)),yF=e=>oe(t=>{if(t.interruptible)return e(F);let r=gF(t),n=e(iu);return r??n}),SF=_e(Cg(ye(()=>new AbortController),e=>ye(()=>e.abort())),e=>e.signal),nl=(e,t)=>ti(e)?t?.mode==="result"?Kn(e,Ba,t):Kn(e,F,t):t?.discard?t.mode==="result"?Kn(Object.values(e),Ba,t):Kn(Object.values(e),F,t):ce(()=>{let r={};return Zr(Kn(Object.entries(e),([n,o])=>_e(t?.mode==="result"?Ba(o):o,s=>{B(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),ZT=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>_e(Kn(e,(n,o)=>Ba(t(n,o)),r),n=>BI(n,F))),bF=d(3,(e,t,r)=>{let n=Ct(e);return n.length===0?ye(t):ce(()=>{let o=0,s=t();return _e(mi({while:()=>o<n.length,body:()=>r(s,n[o],o),step(i){s=i,o++}}),()=>s)})}),EF=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>Y(ZT(e,t,{concurrency:r?.concurrency}),([n,o])=>Gr(o)?Et(o):r?.discard?pe:q(n))),IF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(_()):TF(r,0,t,n.value)})),TF=(e,t,r,n)=>Y(r(n,t),o=>{if(o)return q(N(n));let s=e.next();return s.done?q(_()):TF(e,t+1,r,s.value)}),wF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(_()):vF(r,0,t,n.value)})),vF=(e,t,r,n)=>Y(r(n,t),o=>{if(tt(o))return q(N(o.success));let s=e.next();return s.done?q(_()):vF(e,t+1,r,s.value)}),mi=Uo({op:"While",[mr](e,t){return this[Se].step(e),this[Se].while()?(t._stack.push(this),this[Se].body()):hn},[St](e){return this[Se].while()?(e._stack.push(this),this[Se].body()):hn}}),Kn=d(e=>typeof e[1]=="function",(e,t,r)=>ce(()=>{let n=wp(r?.concurrency);if(n===1)return rG(e,t,r);let o=Ct(e),s=o.length;if(s===0)return r?.discard?pe:q([]);let i=r?.discard?void 0:new Array(s),a=nG({f:t,out:i},o,{concurrency:n});return a?Zr(a,i):q(i)})),CF=e=>Y(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Et(new ms):q(r.value)}),rG=(e,t,r)=>ce(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return Zr(mi({while:()=>!s.done,body:()=>t(s.value,i++),step:a=>{n&&n.push(a),s=o.next()}}),n)}),wp=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),kg=()=>e=>{let t=e.onItem,r=e.step,n=(s,i,a,c,u)=>Y(bp(u),f=>r(s,i[a],f,a)??o(s,i,a+1,c)??pe),o=(s,i,a=0,c=i.length)=>{for(;a<c;a++){let u=i[a],f=t(s,u,a);if(!Xe(f))return n(s,i,a,c,f);let p=r(s,u,f,a);if(p)return p._tag==="Failure"?p:void 0}};return o},AF=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let i=0,a=s.end??o.length,c=s.concurrency,u=!1,f,p,m,h,x,g=E=>{let b=ln(E);return h=b,u=!0,p&&p.size>0?Y(iu(zf(Array.from(p))),()=>h??b):b},y=()=>{let E=!1;for(;!h&&i<a;i++){let b=o[i],v=x??t(n,b,i);if(Xe(v)){if(h=r(n,b,v,i),h)break}else if(f){x=void 0;let T=au(f,v,!0,!0,"inherit");if(T._exit){if(h=r(n,b,T._exit,i),h)break;continue}p.add(T);let S=i;if(T.addObserver(w=>{p.delete(T);try{if(h){if(w._tag==="Failure"){let k=w.cause.reasons.filter(C=>C._tag!=="Interrupt");if(k.length>0){let C=zi(k);h=Pr(h._tag==="Failure"?_f(h.cause,C):C)}}}else{let k=r(n,b,w,S);k&&(h=k,y())}if(E){let k=y();k&&m(k)}else u&&p.size===0&&m(h??pe)}catch(k){m(g(k))}}),p.size<c)continue;E=!0,i++;return}else return $t(T=>{f=ea(),p=new Set,x=v,m=T;let S;try{S=y()}catch(w){return T(g(w))}return S?T(S):ce(()=>(h??=hn,Y(p?zf(p):pe,()=>h?._tag==="Failure"?h:pe)))})}if(u=!0,h){if(p&&p.size>0){let b=lg(f);p.forEach(v=>v.interruptUnsafe(f.id,b));return}if(m||h._tag==="Failure")return h}else if(m)if(p)p.size===0&&m(pe);else return hn};return y()}},Rg=()=>e=>AF(e),nG=AF({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;e.out&&(e.out[n]=r.value)}}),QT=d(3,(e,t,r)=>Y(e,n=>t(n)?q(n):r(n))),YT=d(3,(e,t,r)=>Y(e,n=>{let o=t(n);return be(o)?r(o.failure):q(o.success)})),kF=d(e=>ge(e[0]),(e,t,r)=>YT(e,t,r?n=>Et(r(n)):()=>Et(new ms))),RF=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>ce(()=>{let n=[];return Zr(Kn(e,(o,s)=>{let i=t(o,s);return typeof i=="boolean"?(i&&n.push(o),pe):_e(i,a=>{a&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),OF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=[];for(let n of e){let o=t(n);tt(o)&&r.push(o.success)}return q(r)})),_F=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>ce(()=>{let n=[];return Zr(Kn(e,o=>_e(t(o),s=>{tt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),PF=q({}),MF=Cx(_e),FF=Ax(_e,Y),NF=vx(_e);var UF=d(e=>ge(e[0]),(e,t)=>oe(r=>(SG(),q(au(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),au=(e,t,r=!1,n=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new dp(s.context,i);return n||(s.children().add(a),a._parent=s),r?a.evaluate(t):(a._asyncContext=KP(),s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0)),a},DF=d(e=>ge(e[0]),(e,t)=>oe(r=>q(au(r,e,t?.startImmediately,!0,t?.uninterruptible)))),LF=e=>oe(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return Io(e,o=>{let s=t._children;if(s===void 0||s.size===0)return pe;r&&(s=G_(s,a=>!r.has(a)));let i=gp(dg(s));return n?Ag(i):i})}),XT=d(e=>ge(e[0]),(e,t,r)=>oe(n=>{let o=au(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};za(t,s,()=>eM(a=>a===o.id?pe:hp(o))),o.addObserver(()=>eg(t,s))}else o.interruptUnsafe(n.id,lg(n));return q(o)})),BF=d(e=>ge(e[0]),(e,t)=>Y(Ep,r=>XT(e,r,t))),sa=e=>(t,r)=>{let n=new dp(r?.scheduler?We(e,La,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}return r?.onFiberStart&&r.onFiberStart(n),n},$F=d(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(eg(t,e),za(t,e,()=>hp(e)),e.addObserver(()=>eg(t,e)),e)),jF=sa(pt()),e0=e=>{let t=sa(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},HF=e0(pt()),Og=e=>{let t=sa(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(i=>s(i))})}},qF=Og(pt()),t0=e=>{let t=Og(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw ug(o.cause);return o.value})},zF=t0(pt()),_g=e=>{let t=sa(e);return r=>{if(Xe(r))return r;let n=new fi("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??ln(new sg(o))}},WF=_g(pt()),r0=e=>{let t=_g(e);return r=>{let n=t(r);if(n._tag==="Failure")throw ug(n.cause);return n.value}},KF=r0(pt()),FP=q(!0),NP=q(!1),fT=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return FP;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],FP}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](hn)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](hn)}open=oe(t=>this._isOpen?NP:(this._isOpen=!0,this.scheduleUnsafe(t)));release=oe(t=>this._isOpen?NP:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=$t(t=>this._isOpen?t(pe):(this.waiters.push(t),ye(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=ye(()=>this.closeUnsafe());whenOpen=t=>Y(this.await,()=>t);isOpen(){return this._isOpen}},n0=e=>new fT(e??!1),VF=e=>ye(()=>n0(e)),GF=oe(e=>q(e.getRef(YI))),JF=d(2,(e,t)=>Pn(e,YI,t)),ZF=Pn(Jx),QF=Pn(ru),tg=BigInt(0),oG={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:tg,endTime:tg,exit:hn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},sG=e=>Object.assign(Object.create(oG),e),YF=e=>e?Re(e.annotations,Hf)?e._tag==="Span"?YF(_n(e.parent)):_():N(e):_(),o0=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&Re(r.annotations,Hf),o=r?.parent!==void 0?N(r.parent):r?.root?_():YF(e.cache.span),s;if(n)s=sG({name:t,parent:o,annotations:We(r?.annotations??pt(),Hf,!0)});else{let i=e.cache.tracer??XI,a=e.getRef(Vn),c=e.getRef(ru),u=e.getRef(fp),f=e.getRef(lp),p=r?.level??e.getRef(wP),m=r?.links!==void 0?[...f,...r.links]:f.length===0?[]:f.slice();s=i.span({name:t,parent:o,annotations:r?.annotations??pt(),links:m,startTime:c?a.currentTimeNanosUnsafe():tg,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(de(o)&&o.value.sampled===!1?!1:!lN(e.getRef(vP),p))});for(let h in u)s.attribute(h,u[h]);if(r?.attributes!==void 0)for(let h in r.attributes)s.attribute(h,r.attributes[h])}return s},XF=(e,t)=>oe(r=>q(o0(r,e,t))),bs=(e,t)=>iu(oe(r=>{let n=dn(r.context,Ha),o=o0(r,e,t??{}),s=r.getRef(Vn),i=r.getRef(ru);return Zr(qa(n,a=>Pg(o,a,s,i)),o)})),eN=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return Y(bs(t,r),o=>Wf(n,o,r))}return n=>Y(bs(t,r),o=>Wf(n,o,r))},iG=(e,t)=>(t=typeof t=="function"?t:po,na(qf,r=>({name:e,stack:t,parent:r}))),tN=fp,rN=lp,nN=d(e=>ge(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return na(e,lp,s=>[...s,...o])}),Pg=(e,t,r,n)=>ye(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():tg,t)}),pp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return oe(o=>{let s=o0(o,e,r),i=o.getRef(Vn),a=o.getRef(ru);return Wa(o,c=>Pg(s,c,i,a)),n(s)})},lT=Pn(li),Wf=function(){let e=ge(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;return t._tag==="Span"&&(r=Ho(r),n=iG(t.name,r?.captureStackTrace)),e?lT(n(arguments[0]),t):o=>lT(n(o),t)},oN=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(arguments[2]);if(e){let s=arguments[0];return pp(t,arguments[2],i=>Wf(s,i,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...i)=>pp(t,n?n(...i):o,a=>Wf(s,a,r))},sN=d(e=>ge(e[0]),(e,...t)=>na(e,fp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||B(n,t[0],t[1]),n})),iN=(...e)=>oe(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return pe}),aN=oe(e=>{let t=e.currentSpanLocal;return t?q(t):Et(new ms)}),cN=qV(li),Vn=Ce("effect/Clock",{defaultValue:()=>new dT}),nT=2**31-1,dT=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=ye(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return aG()}currentTimeNanos=ye(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return fN()}monotonicTimeNanos=ye(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Wt(t))}sleepMillis(t){return t<=0?Vf:Number.isFinite(t)?$t(r=>{let n=t>nT?this.sleepMillis(t-nT):pe,o=setTimeout(()=>r(n),Math.min(t,nT));return ye(()=>clearTimeout(o))}):xp}},uN=BigInt(1e6),fN=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*uN;return r>t&&(t=r),t}})(),aG=(function(){let e=BigInt(1e9),t;return()=>{let r=fN(),n=BigInt(Date.now())*uN;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),Is=e=>oe(t=>e(t.getRef(Vn))),ol=e=>Is(t=>t.sleep($e(e))),s0=Is(e=>e.currentTimeMillis);var pT="~effect/Cause/TimeoutError";var rg=class extends Wi("TimeoutError"){[pT]=pT;constructor(t){super({message:t})}},mT="~effect/Cause/IllegalArgumentError";var ng=class extends Wi("IllegalArgumentError"){[mT]=mT;constructor(t){super({message:t})}},hT="~effect/Cause/ExceededCapacityError";var og=class extends Wi("ExceededCapacityError"){[hT]=hT;constructor(t){super({message:t})}},xT="~effect/Cause/AsyncFiberError";var sg=class extends Wi("AsyncFiberError"){[xT]=xT;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},gT="~effect/Cause/UnknownError";var mp=class extends Wi("UnknownError"){[gT]=gT;constructor(t,r){super({message:r,cause:t})}},cG=Ce("effect/Console",{defaultValue:()=>globalThis.console}),uG=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},fG=wI(Ki,uG),lN=Qc(fG),i0=Ce("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([gG,yG])}),lG=Ce("effect/Logger/LogToStderr",{defaultValue:Oa}),dN=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return iu(oe(t=>{let r=t.getRef(Xi),n={...r};for(let o=0;o<e.length;o++){let[s,i]=e[o];B(n,s,i)}return t.setContext(We(t.context,Xi,n)),qa(dn(t.context,Ha),o=>{let s=t.getRef(Xi),i={...s};for(let a=0;a<e.length;a++){let[c,u]=e[a];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?B(i,c,r[c]):delete i[c])}return t.setContext(We(t.context,Xi,i)),pe})}))},dG="~effect/Logger",pG={[dG]:{_Message:F,_Output:F},pipe(){return V(this,arguments)}},pN=e=>{let t=Object.create(pG);return t.log=e,t},mG=e=>e.replace(/[\s="]/g,"_"),hG=(e,t)=>`${mG(e[0])}=${t-e[1]}ms`;var Ts=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Of(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?zi(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=xI),oe(n=>{let o=e??n.cache.logLevel;if(lN(n.cache.minimumLogLevel,o))return pe;let s=n.getRef(Vn),i=n.getRef(i0);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:r,fiber:n,date:a,logLevel:o,message:t})}return pe})};var nu={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Hle={None:[],All:[],Trace:[nu.gray],Debug:[nu.blue],Info:[nu.green],Warn:[nu.yellow],Error:[nu.red],Fatal:[nu.bgBrightRed,nu.black]};var xG=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var gG=pN(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(fg(e));let i=t.getTime(),a=r.getRef(Zx),c="";for(let m of a)c+=` ${hG(m,i)}`;let u=r.getRef(Xi);Object.keys(u).length>0&&s.push(u);let f=r.getRef(cG);(r.getRef(lG)?f.error:f.log)(`[${xG(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),yG=pN(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Vn),s=t.getRef(Xi),i=t.cache.span;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))B(a,c,u);a["effect.fiberId"]=t.id,a["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(a["effect.cause"]=fg(e)),i.event(e_(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),a)});function SG(){iT.interruptChildren??=DV}var Mg=q(void 0);var mN=d(e=>ge(e[0]),(e,t)=>Ip(e,r=>oe(n=>(bG(n,r,t?.defectsOnly),pe)))),bG=(e,t,r)=>{let n=e.getRef(AP);if(n.size===0||r&&!BP(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Vn).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var sl=Of,il=n_,Fg=hs;var cu=zi;var hN=Pf,al=gI,xN=$a,vp=e=>new Vc(e),Cp=e=>new Kd(e),Ap=UP,a0=cg,Ka=jP;var uu=ug,gN=DP;var cl=qo;var kp=ig,ul=ag;var yN=$P;var SN=fg;var fl=ms,Rp=i_;var bN=Jc,se=c_;var Ng=ng;var EN=og;var ne={};ps(ne,{Do:()=>qJ,Transaction:()=>xl,TypeId:()=>NJ,abortSignal:()=>H8,acquireDisposable:()=>F8,acquireRelease:()=>Ti,acquireUseRelease:()=>zU,addFinalizer:()=>WU,all:()=>UJ,andThen:()=>Vt,annotateCurrentSpan:()=>Q8,annotateLogs:()=>dy,annotateLogsScoped:()=>EZ,annotateSpans:()=>Z8,as:()=>Pt,asSome:()=>sy,asVoid:()=>vo,awaitAllChildren:()=>aZ,bind:()=>KJ,bindTo:()=>zJ,cached:()=>fy,cachedInvalidateWithTTL:()=>$8,cachedWithTTL:()=>B8,callback:()=>Nn,catch:()=>xu,catchCause:()=>rt,catchCauseFilter:()=>LU,catchCauseIf:()=>z0,catchDefect:()=>q0,catchEager:()=>py,catchFilter:()=>i8,catchIf:()=>s8,catchNoSuchElement:()=>a8,catchReason:()=>r8,catchReasons:()=>n8,catchTag:()=>UU,catchTags:()=>DU,clockWith:()=>Su,context:()=>Nr,contextWith:()=>yn,currentParentSpan:()=>X8,currentSpan:()=>Y8,delay:()=>ca,die:()=>gn,effectify:()=>PZ,ensuring:()=>wi,eventually:()=>d8,exit:()=>eo,fail:()=>D,failCause:()=>je,failCauseSync:()=>aa,failSync:()=>oy,fiber:()=>cZ,fiberId:()=>uZ,filter:()=>G0,filterMap:()=>I8,filterMapEffect:()=>J0,filterMapOrElse:()=>T8,filterMapOrFail:()=>w8,filterOrElse:()=>jU,filterOrFail:()=>HU,findFirst:()=>$J,findFirstFilter:()=>jJ,firstSuccessOf:()=>g8,flatMap:()=>A,flatMapEager:()=>ur,flatten:()=>j0,flip:()=>e8,fn:()=>pZ,fnUntraced:()=>me,fnUntracedEager:()=>aw,forEach:()=>Ko,forever:()=>Mt,forkChild:()=>bl,forkDetach:()=>El,forkIn:()=>gt,forkScoped:()=>Rs,fromNullishOr:()=>QJ,fromOption:()=>JJ,fromResult:()=>$0,gen:()=>xt,head:()=>HJ,ignore:()=>ay,ignoreCause:()=>cy,interrupt:()=>Dn,interruptible:()=>vi,interruptibleMask:()=>j8,isEffect:()=>Yr,isFailure:()=>R8,isSuccess:()=>O8,let:()=>WJ,linkSpans:()=>rZ,log:()=>mZ,logDebug:()=>yZ,logError:()=>Yp,logFatal:()=>hZ,logInfo:()=>gZ,logTrace:()=>SZ,logWarning:()=>xZ,logWithLevel:()=>Il,makeSpan:()=>tw,makeSpanScoped:()=>rw,map:()=>K,mapBoth:()=>c8,mapBothEager:()=>cr,mapEager:()=>bu,mapError:()=>gl,mapErrorEager:()=>Eu,match:()=>Z0,matchCause:()=>C8,matchCauseEager:()=>A8,matchCauseEffect:()=>Un,matchCauseEffectEager:()=>k8,matchEager:()=>v8,matchEffect:()=>qU,never:()=>Xn,onError:()=>to,onErrorFilter:()=>U8,onErrorIf:()=>N8,onExit:()=>Xr,onExitFilter:()=>L8,onExitIf:()=>D8,onExitPrimitive:()=>Jp,onInterrupt:()=>yu,option:()=>XJ,orDie:()=>Ii,orElseSucceed:()=>x8,partition:()=>DJ,promise:()=>zp,provide:()=>Q0,provideContext:()=>Ur,provideService:()=>Jo,provideServiceEffect:()=>M8,race:()=>E8,raceAll:()=>V0,raceAllFirst:()=>b8,raceFirst:()=>Ya,reduce:()=>LJ,repeat:()=>KU,repeatOrElse:()=>q8,replicate:()=>z8,replicateEffect:()=>ew,request:()=>sZ,requestUnsafe:()=>iZ,result:()=>YJ,retry:()=>iy,retryOrElse:()=>W0,runCallback:()=>fZ,runCallbackWith:()=>nw,runFork:()=>Qp,runForkWith:()=>Sr,runPromise:()=>ow,runPromiseExit:()=>ly,runPromiseExitWith:()=>lZ,runPromiseWith:()=>sw,runSync:()=>Ai,runSyncExit:()=>ki,runSyncExitWith:()=>dZ,runSyncWith:()=>iw,sandbox:()=>p8,satisfiesErrorType:()=>FZ,satisfiesServicesType:()=>NZ,satisfiesSuccessType:()=>MZ,schedule:()=>W8,scheduleFrom:()=>VU,scope:()=>Co,scoped:()=>ec,scopedWith:()=>yl,service:()=>Y0,serviceOption:()=>gu,setContext:()=>_8,sleep:()=>ua,spanAnnotations:()=>eZ,spanLinks:()=>tZ,succeed:()=>I,succeedNone:()=>ia,succeedSome:()=>B0,suspend:()=>L,sync:()=>W,tap:()=>_t,tapCause:()=>Gp,tapCauseFilter:()=>l8,tapCauseIf:()=>f8,tapDefect:()=>BU,tapError:()=>Vp,tapErrorTag:()=>u8,timed:()=>S8,timeout:()=>K0,timeoutOption:()=>y8,timeoutOrElse:()=>$U,tracer:()=>K8,track:()=>TZ,trackDefects:()=>CZ,trackDuration:()=>AZ,trackErrors:()=>vZ,trackSuccesses:()=>wZ,transposeOption:()=>ZJ,try:()=>Go,tryPromise:()=>Vo,tx:()=>kZ,txRetry:()=>_Z,undefined:()=>Wp,uninterruptible:()=>Ci,uninterruptibleMask:()=>en,unwrapReason:()=>o8,updateContext:()=>Xa,updateService:()=>X0,updateServiceScoped:()=>P8,useSpan:()=>Zp,validate:()=>BJ,void:()=>P,when:()=>uy,whileLoop:()=>xn,withErrorReporting:()=>h8,withExecutionPlan:()=>m8,withFiber:()=>ar,withFiberSucceed:()=>GJ,withLogSpan:()=>IZ,withLogger:()=>bZ,withParentSpan:()=>Sl,withSpan:()=>nZ,withSpanScoped:()=>oZ,withTracer:()=>V8,withTracerEnabled:()=>G8,withTracerTiming:()=>J8,yieldNow:()=>Kp,yieldNowWith:()=>VJ,zip:()=>H0,zipWith:()=>t8});var ws=Vd,Mr=ze,ir=Pr,Jn=So,Ug=ln,Dg=Jf,Kt=hn;var ft=Zf,vs=yM;var IN=PT;var TN=wM;var wN=MT;var Fn={};ps(Fn,{CurrentMemoMap:()=>lu,build:()=>LN,buildWithMemoMap:()=>gi,buildWithScope:()=>Op,catch:()=>DG,catchCause:()=>BG,catchTag:()=>LG,effect:()=>Qn,effectContext:()=>Ja,effectDiscard:()=>_G,empty:()=>OG,flatMap:()=>jN,forkMemoMap:()=>RG,forkMemoMapUnsafe:()=>d0,fresh:()=>$G,fromBuild:()=>Va,fromBuildMemo:()=>zg,isLayer:()=>qg,launch:()=>jG,makeMemoMap:()=>kG,makeMemoMapUnsafe:()=>xi,merge:()=>MG,mergeAll:()=>Wg,mock:()=>HG,orDie:()=>Kg,parentSpan:()=>qN,provide:()=>As,provideMerge:()=>_p,satisfiesErrorType:()=>WG,satisfiesServicesType:()=>KG,satisfiesSuccessType:()=>zG,span:()=>VG,succeed:()=>Ga,succeedContext:()=>du,suspend:()=>PG,sync:()=>p0,syncContext:()=>u0,tap:()=>FG,tapCause:()=>UG,tapError:()=>NG,unwrap:()=>f0,updateService:()=>HN,withParentSpan:()=>l0,withSpan:()=>GG});var EG="~effect/Deferred";var IG={[EG]:{_A:F,_E:F},pipe(){return V(this,arguments)}},vN=function(){this.resumes=void 0,this.effect=void 0};vN.prototype=IG;var fu=()=>new vN;var Lg=e=>$t(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),ye(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var TG=d(2,(e,t)=>ye(()=>hi(e,t))),wG=TG;var vG=d(2,(e,t)=>wG(e,Pr(t)));var c0=d(2,(e,t)=>vG(e,$a(t)));var hi=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var CN=Xi;var AN=Zx,kN=qf;var $g=ru,RN=kP;var it=Ha;var Zn=el,zo=iF,Wo=qa,It=oF;var yr=nF,Ve=WT;var DN="~effect/Layer",_N="~effect/Layer/MemoMap",CG=(e,t)=>{let r={observers:0,deferred:fu(),scope:Zn(),finalizer:n=>ce(()=>--r.observers>0?pe:(e.map.delete(t),Ve(r.scope,n)))};return r},PN=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,za(t,{},e.finalizer),!0),qg=e=>O(e,DN),AG={[DN]:{_ROut:F,_E:F,_RIn:F},pipe(){return V(this,arguments)}},pu=e=>{let t=Object.create(AG);return t.build=e,t},Va=e=>pu((t,r)=>{let n=yr(r);return To(e(t,n),o=>o._tag==="Failure"?Ve(n,o):pe)}),zg=e=>{let t=Va((r,n)=>r.getOrElseMemoize(t,n,e));return t},Hg=class{get[_N](){return _N}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(PN(n,r),n.deferred.effect??Lg(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return ce(()=>{let o;return Io(ce(()=>{let s=this.get(t,r);if(s)return s;let i=CG(this,t);return PN(i,r)?(o=i.deferred,this.map.set(t,i),n(this,i.scope)):n(this,r)}),s=>{o&&hi(o,s)})})}},xi=()=>new Hg,d0=e=>new Hg(e),kG=ye(xi),RG=e=>ye(()=>d0(e)),lu=class e extends Ue()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Vi(t,e);return r?d0(r):xi()}},gi=d(3,(e,t,r)=>Pn(_e(ce(()=>e.build(t,r)),We(lu,t)),lu,t)),LN=e=>oe(t=>gi(e,lu.forkOrCreate(t.context),dn(t.context,it))),Op=d(2,(e,t)=>oe(r=>gi(e,lu.forkOrCreate(r.context),t))),Ga=function(){return arguments.length===1?e=>du(ys(arguments[0],e)):du(ys(arguments[0],arguments[1]))},du=e=>pu(qe(q(e))),OG=du(pt()),p0=function(){return arguments.length===1?e=>u0(()=>ys(arguments[0],e())):u0(()=>ys(arguments[0],arguments[1]()))},u0=e=>zg(qe(ye(e))),Qn=function(){return arguments.length===1?e=>MN(arguments[0],e):MN(arguments[0],arguments[1])},MN=(e,t)=>Ja(_e(t,r=>ys(e,r))),Ja=e=>zg((t,r)=>zo(e,r)),_G=e=>Ja(Zr(e,pt())),PG=e=>zg((t,r)=>ce(()=>e().build(t,r))),FN=Ue("effect/Layer/unwrap"),f0=e=>jN(Qn(FN)(e),Re(FN)),BN=(e,t,r)=>{let n=yr(r,"parallel");return Kn(e,o=>o.build(t,yr(n,"sequential")),{concurrency:e.length}).pipe(_e(o=>j_(...o)))},Wg=(...e)=>Va((t,r)=>BN(e,t,r)),MG=d(2,(e,t)=>Wg(e,...Array.isArray(t)?t:[t])),$N=(e,t,r)=>Va((n,o)=>Y(Array.isArray(t)?BN(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Eo(s),_e(i=>r(i,s))))),As=d(2,(e,t)=>$N(e,t,F)),_p=d(2,(e,t)=>$N(e,t,(r,n)=>Kr(n,r))),jN=d(2,(e,t)=>Va((r,n)=>Y(e.build(r,n),o=>t(o).build(r,n)))),FG=d(2,(e,t)=>Va((r,n)=>Y(e.build(r,n),o=>zo(Zr(t(o),o),n)))),NG=d(2,(e,t)=>Va((r,n)=>Es(e.build(r,n),o=>zo(bo(t(o),Et(o)),n)))),UG=d(2,(e,t)=>Va((r,n)=>Mn(e.build(r,n),o=>zo(bo(t(o),Ye(o)),n)))),Kg=e=>pu((t,r)=>Eg(e.build(t,r))),DG=d(2,(e,t)=>pu((r,n)=>Es(e.build(r,n),o=>t(o).build(r,n))));var LG=d(3,(e,t,r)=>pu((n,o)=>bg(e.build(n,o),t,s=>r(s).build(n,o)))),BG=d(2,(e,t)=>pu((r,n)=>Mn(e.build(r,n),o=>t(o).build(r,n)))),HN=d(3,(e,t,r)=>As(e,Qn(t,_e(t,r)))),$G=e=>pu((t,r)=>e.build(xi(),r)),jG=e=>wg(bo(LN(e),xp)),HG=function(){return arguments.length===1?e=>NN(arguments[0],e):NN(arguments[0],arguments[1])},NN=(e,t)=>Ga(e)(new Proxy({...t},{get(r,n,o){if(n in r)return r[n];let s=Ir();yt(2);let i=new Error(`${e.key}: Unimplemented method "${n.toString()}"`);return yt(s),i.name="UnimplementedError",qG(i)},has:nr})),qG=e=>{let t=Object.assign(ta(e),{[UN]:UN,channel:{[jg]:jg,transform:()=>q(t),pipe(){return V(this,arguments)}},[jg]:jg,transform:()=>q(t)});function r(){return t}return Object.assign(r,t),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r},UN="~effect/Stream",jg="~effect/Channel",zG=()=>e=>e,WG=()=>e=>e,KG=()=>e=>e,VG=(e,t)=>(t=Ho(t),Qn(li,t?.onEnd?pi(bs(e,t),r=>tl(n=>t.onEnd(r,n))):bs(e,t))),qN=e=>du(li.context(e)),GG=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return f0(_e(r?.onEnd!==void 0?pi(bs(t,r),o=>tl(s=>r.onEnd(o,s))):bs(t,r),o=>l0(n,o,r)))}return n=>f0(_e(r?.onEnd!==void 0?pi(bs(t,r),o=>tl(s=>r.onEnd(o,s))):bs(t,r),o=>l0(n,o,r)))},l0=function(){let e=qg(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;t._tag==="Span"&&(r=Ho(r),n=JG(t.name,r?.captureStackTrace));let o=qN(t);return e?As(n(arguments[0]),o):s=>As(n(s),o)},JG=(e,t)=>(t=typeof t=="function"?t:po,HN(kN,r=>({name:e,stack:t,parent:r})));var Yn=Vn;var Vg="~effect/DateTime",Gg="~effect/DateTime/TimeZone",KN={[Vg]:Vg,pipe(){return V(this,arguments)},[Qe](){return this.toString()},toJSON(){return Fp(this).toJSON()}},ZG={...KN,_tag:"Utc",[ie](){return zt(this.epochMilliseconds)},[ae](e){return dl(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Fp(this).toJSON()})`}},QG={...KN,_tag:"Zoned",[ie](){return he(zt(this.epochMilliseconds))(G(this.zone))},[ae](e){return dl(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Z(this.zone,e.zone)},toString(){return`DateTime.Zoned(${v0(this)})`}},VN={[Gg]:Gg,[Qe](){return this.toString()}},YG={...VN,_tag:"Named",[ie](){return Be(`Named:${this.id}`)},[ae](e){return mu(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},XG={...VN,_tag:"Offset",[ie](){return Be(`Offset:${this.offset}`)},[ae](e){return mu(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${I0(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},yi=(e,t,r)=>{let n=Object.create(QG);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},dl=e=>O(e,Vg);var mu=e=>O(e,Gg),GN=e=>mu(e)&&e._tag==="Offset",JN=e=>mu(e)&&e._tag==="Named",ZN=e=>e._tag==="Utc",x0=e=>e._tag==="Zoned",QN=Wr((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var YN=e=>{let t=Object.create(ZG);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ll=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Ng("Invalid date");return YN(t)},Zg=e=>{if(dl(e))return e;if(e instanceof Date)return ll(e);if(typeof e=="object"){if("epochMilliseconds"in e)return ll(new Date(e.epochMilliseconds));let t=new Date(0);return aJ(t,e),ll(t)}else if(typeof e=="string"&&!eJ(e))return ll(new Date(e+"Z"));return ll(new Date(e))},eJ=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),tJ=-864e13+720*60*1e3,rJ=864e13-840*60*1e3,g0=(e,t)=>{let r=t?.timeZone;if(r===void 0&&dl(e)&&x0(e))return e;let n=Zg(e);if(n.epochMilliseconds<tJ||n.epochMilliseconds>rJ)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e=="object"&&"timeZoneId"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Mp(s)}else if(mu(r))o=r;else if(typeof r=="number")o=Mp(r);else{let s=b0(r);if(fe(s))throw new Ng(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?yi(n.epochMilliseconds,o,n.partsUtc):cJ(n.epochMilliseconds,o,t?.disambiguation??"compatible")},m0=xs(g0),XN=xs(Zg),nJ=/^(.{17,35})\[(.+)\]$/,eU=e=>{let t=nJ.exec(e);if(t===null){let o=w0(e);return o!==null?m0(e,{timeZone:o}):_()}let[,r,n]=t;return m0(r,{timeZone:n})};var tU=e=>YN(e.epochMilliseconds);var Jg=new Map,oJ={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},sJ=e=>{let t=e.resolvedOptions().timeZone,r=Jg.get(t);if(r!==void 0)return r;let n=Object.create(YG);return n.id=t,n.format=e,Jg.set(t,n),n},y0=e=>{let t=Jg.get(e);if(t!==void 0)return t;try{let r=sJ(new Intl.DateTimeFormat("en-US",{...oJ,timeZone:e}));return Jg.set(e,r),r}catch{throw new Ng(`Invalid time zone: ${e}`)}},Mp=e=>{let t=Object.create(XG);return t.offset=e,t},S0=xs(y0);var iJ=/^(?:GMT|[+-])/,b0=e=>{if(iJ.test(e)){let t=w0(e);return t===null?_():N(Mp(t))}return S0(e)},rU=e=>e._tag==="Offset"?I0(e.offset):e.id;var Fp=e=>new Date(e.epochMilliseconds),Qg=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(n=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type==="fractionalSecond"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},E0=e=>Qg(e).getTime()-T0(e),I0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},nU=e=>I0(E0(e)),T0=e=>e.epochMilliseconds;var aJ=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var WN=1440*60*1e3,cJ=(e,t,r)=>{if(t._tag==="Offset")return yi(e-t.offset,t);let n=Pp(e-WN,e,t),o=Pp(e+WN,e,t);if(n===o)return yi(e-n,t);let s=n<o,i=n-o;if(s){if(Pp(e-o,e,t)===o)return yi(e-o,t);let u=yi(e-n,t),f=Qg(u).getTime();if(e!==f)switch(r){case"reject":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case"earlier":return yi(e-o,t);case"compatible":case"later":return u}return u}if(Pp(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||Pp(e-n+i,e+i,t)===n)return yi(e-n,t);if(r==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return yi(e-o,t)},uJ=/([+-])(\d{2}):(\d{2})$/,w0=e=>{let t=uJ.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Pp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=w0(n);return o===null?E0(yi(t,r)):o};var oU=e=>Fp(e).toISOString();var h0=e=>{let t=Qg(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${nU(e)}`},v0=e=>e.zone._tag==="Offset"?h0(e):`${h0(e)}[${e.zone.id}]`;var vde=globalThis.Number;var iU=d(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=sU(e),[o,s]=sU(t),i=Math.min(n,s),a=r*BigInt(10)**BigInt(n-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 f=globalThis.Number(`${u}e${i}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f});function sU(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf("e"),n=t.slice(0,r).replace(".","");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var aU=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var Ade=globalThis.String,Yg=On;var cU=e=>e.trim();var ht=d(2,(e,t)=>oa(e,dJ,r=>t(r))),wo=e=>e.reasons.some(A0),A0=e=>e._tag==="Fail"&&Rp(e.error),Np=e=>{let t,r=!1;for(let n of e.reasons)A0(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?re(e):r?re(cu(e.reasons.filter(n=>!A0(n)))):X(t)};var dJ=e=>{let t=Np(e);return be(t)?t:X(t.success.value)},Xg=e=>{let t=Np(e);return be(t)?ir(t.failure):Mr(t.success.value)},Up=d(2,(e,t)=>di(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=Np(r);return be(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var uU="~effect/Schedule";var Fr=Ce("effect/Schedule/CurrentMetadata",{defaultValue:qe({input:void 0,output:void 0,duration:Ji,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),pJ={[uU]:{_Out:F,_In:F,_Env:F},pipe(){return V(this,arguments)}},k0=e=>O(e,uU),pl=e=>{let t=Object.create(pJ);return t.step=e,t},R0=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,i=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:i}}},fU=e=>pl(_e(e,t=>{let r=R0();return(n,o)=>t(r(n,o))})),Qa=e=>Mn(e.step,t=>q(()=>Ye(t))),ks=e=>Is(t=>_e(Qa(e),r=>{let n=R0();return o=>ce(()=>{let s=t.currentTimeMillisUnsafe();return Y(r(s,o),([i,a])=>{let c=n(s,o);return c.output=i,c.duration=a,Zr(ol(a),c)})})})),Dp=e=>_e(ks(e),t=>r=>_e(t(r),n=>n.output));var lU=e=>pl(_e(nl(e.map(Qa)),t=>(r,n)=>Y(Kn(t,o=>Up(o(r,n),{onSuccess:s=>q(s[1]),onDone:()=>Mg,onFailure:Ye})),o=>{let s=mJ(o);return s===void 0?se(Ji):q([s,s])}))),mJ=e=>{let t;for(let r=0;r<e.length;r++){let n=e[r];n!==void 0&&(t=t===void 0?n:dP(t,n))}return t},dU=(e,t=2)=>{let r=Wt($e(e));return fU(q(n=>{let o=Zi(r*Math.pow(t,n.attempt-1));return q([o,o])}))};var O0=e=>pl(_e(Qa(e),t=>(r,n)=>Up(t(r,n),{onSuccess:o=>q([n,o[1]]),onFailure:Ye,onDone:()=>se(n)}))),pU=e=>Lp(Bp,({attempt:t})=>q(t<=e)),ml=e=>{let t=$e(e);return fU(q(r=>q([r.attempt-1,t])))};var Lp=d(2,(e,t)=>pl(_e(Qa(e),r=>{let n=R0();return(o,s)=>Y(r(o,s),i=>{let[a,c]=i,u=t({...n(o,s),output:a,duration:c});return Y(ge(u)?u:q(u),f=>f?q(i):se(a))})})));var Bp=ml(Ji);var mU="~effect/ExecutionPlan";var hJ={[mU]:mU,get captureRequirements(){let e=this;return ja(t=>q(xJ(e.steps.map(r=>({...r,while:r.while?n=>Eo(r.while(n),t):void 0,schedule:r.schedule?pl(Eo(_e(Qa(r.schedule),n=>(o,s)=>Eo(n(o,s),t)),t)):void 0,provide:qg(r.provide)?As(r.provide,du(t)):r.provide})))))},pipe(){return V(this,arguments)}},xJ=e=>{let t=Object.create(hJ);return t.steps=e,t};var ey=Ce("effect/ExecutionPlan/CurrentMetadata",{defaultValue:qe({attempt:0,stepIndex:0})});var gJ=(e,t,r)=>vg(n=>Y(r?.local?gi(t,xi(),n):Op(t,n),o=>Eo(e,o))),ty=d(e=>ge(e[0]),(e,t,r)=>sp(t)?Eo(e,t):gJ(e,Array.isArray(t)?Wg(...t):t,r));var xU=e=>e.reasons.every(hs)?qo(e):re(e),P0=d(3,(e,t,r)=>Y(ks(t),n=>{let o=Fr.defaultValue();return oa(ht(gg(pi(Y(ce(()=>Pn(e,Fr,o)),n),s=>ye(()=>{o=s})),{disableYield:!0}),s=>q(s)),xU,s=>r(s,o.attempt===0?_():N(o)))})),M0=d(3,(e,t,r)=>Y(ks(t),n=>{let o=Fr.defaultValue(),s,i=oa(ce(()=>Pn(e,Fr,o)),xU,a=>(s=a,Y(n(a),c=>(o=c,i))));return ht(i,a=>Pa(()=>r(s,a)))})),gU=d(2,(e,t)=>{let r=typeof t=="function"?t(F):k0(t)?t:jp(t);return P0(e,r,Et)}),$p=d(2,(e,t)=>{let r=typeof t=="function"?t(F):k0(t)?t:jp(t);return M0(e,r,Et)}),yU=d(3,(e,t,r)=>Y(ks(r),n=>{let o=Fr.defaultValue(),s=ce(()=>Pn(e,Fr,o));return ht(Y(n(t),i=>{o=i;let a=qe(Y(s,n));return mi({while:nr,body:a,step(c){o=c}})}),i=>q(i))})),yJ=O0(Bp),jp=e=>{let t=e.schedule?O0(e.schedule):yJ;return e.while&&(t=Lp(t,({input:r})=>{let n=e.while(r);return ge(n)?n:q(n)})),e.until&&(t=Lp(t,({input:r})=>{let n=e.until(r);return ge(n)?_e(n,o=>!o):q(!n)})),e.times!==void 0&&(t=Lp(t,({attempt:r})=>q(r<=e.times))),t};var F0=(e,t)=>{let r=-1,n=0,o=s=>Ig(e(s));return{begin:Is(s=>ce(()=>{let i=t();i.stepIndex!==r&&(r=i.stepIndex,n=0),n++;let a={attempt:i.attempt,stepAttempt:n,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Zr(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>Is(a=>{let c=$o(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})})}},bU=d(e=>ge(e[0]),(e,t,r)=>ce(()=>{let n=0,o={attempt:0,stepIndex:0},s=xg(ey,ye(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),i=r?.onEvent===void 0?void 0:F0(r.onEvent,()=>o),a=i===void 0?F:u=>Gn(f=>Y(i.begin,p=>To(f(u),m=>i.end(p,m)))),c;return Y(mi({while:()=>n<t.steps.length&&(c===void 0||be(c)),body(){let u=t.steps[n],f=s(a(ty(e,u.provide)));if(c){let p=!1,m=f;f=ce(()=>p?m:(p=!0,Kf(c))),f=$p(f,Hp(u,!1))}else{let p=Hp(u,!0);f=p?$p(f,p):f}return Ba(f)},step(u){c=u,n++}}),()=>Kf(c))})),Hp=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return jp({schedule:e.schedule?e.schedule:e.attempts?void 0:SJ,times:e.attempts,while:e.while});return jp({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},SJ=pU(1);var IU="~effect/MutableHashMap";var bJ={[IU]:IU,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${H(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:pr(Array.from(this))}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},Si=()=>{let e=Object.create(bJ);return e.backing=new Map,e.buckets=new Map,e};var Qr=d(2,(e,t)=>{if(e.backing.has(t))return N(e.backing.get(t));if(N0(t))return _();let r=G(t),n=e.buckets.get(r);return n===void 0?_():EJ(e,n,t)}),N0=e=>typeof e!="object"&&typeof e!="function";var EJ=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(Z(r,t[n])){let s=t[n];return N(e.backing.get(s))}return _()},U0=d(2,(e,t)=>de(Qr(e,t))),bi=d(3,(e,t,r)=>{if(e.backing.has(t)||N0(t))return e.backing.set(t,r),e;let n=G(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=IJ(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),IJ=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(Z(t,e[r]))return e[r]};var Ei=d(2,(e,t)=>{if(N0(t))return e.backing.delete(t),e;let r=G(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let i=n[o];if(i===t||Z(t,i)){e.backing.delete(i),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),ry=e=>(e.backing.clear(),e.buckets.clear(),e),TU=e=>e.backing.size;var TJ="~effect/Request",wJ=ZO({_E:e=>e,_A:e=>e,_R:e=>e}),Gde={...r_,[TJ]:wJ};var wU=e=>e;var CU=d(2,(e,t)=>{let r=n=>$t(o=>{let s=kU(n,e,o,ea());return kJ(n,s)});return ge(t)?Y(t,r):r(t)}),AU=(e,t)=>{let r=kU(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:Re(t.context,La)}});return()=>RU(t.resolver,r)},CJ=new WeakSet,AJ=e=>{if(!CJ.has(e.batchKey))return new Map;let t=Si();return{get:r=>_n(Qr(t,r)),has:r=>U0(t,r),set:(r,n)=>bi(t,r,n),delete:r=>Ei(t,r)}},ny=[],D0=new WeakMap,kU=(e,t,r,n)=>{let o=D0.get(e);o||(o=AJ(e),D0.set(e,o));let s,i=!1,a=wU({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){i||(i=!0,!(s&&!s.entrySet.delete(a))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(ny.length>0)s=ny.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:Y(ce(()=>u.resolver.delay),f=>vU(u)),run:To(ce(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let p of u.entrySet)p.completeUnsafe(f._tag==="Success"?ln(new Error("Effect.request: RequestResolver did not complete request",{cause:p.request})):f);return u.entries.clear(),ny.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,ny.push(u)),pe})};s=u}o.set(c,s),s.fiber=sa(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=sa(n.context)(vU(s),{scheduler:n.cache.scheduler})),a},RU=(e,t)=>{if(t.uninterruptible)return;let r=D0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(Jf()),s?.interruptUnsafe()},kJ=(e,t)=>ye(()=>RU(e,t));function vU(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):pe}var OJ="effect/Metric/CurrentMetricAttributes",_J=Ce(OJ,{defaultValue:()=>({})}),PJ="effect/Metric/MetricRegistry",MJ=Ce(PJ,{defaultValue:()=>new Map}),OU="~effect/Metric",_U=class{[OU]=OU;#e;#t="";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=Re(t,_J);r!==this.#e&&(this.#e=r,this.#t=FJ(this,PU(this.attributes,r)));let n=Re(t,MJ),o=n.get(this.#t);return LO(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?PU(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#t,o)),o.hooks}pipe(){return V(this,arguments)}};var hl=d(2,(e,t)=>ja(r=>ye(()=>e.updateUnsafe(t,r))));function FJ(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function PU(e,t){return{...MU(e),...MU(t)}}function MU(e){return ei(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(B(t,r,n),t),{}):e}var NJ=si,Yr=ge,UJ=nl,DJ=ZT,LJ=bF,BJ=EF,$J=IF,jJ=wF,Ko=Kn,HJ=CF,xn=mi,zp=wT,Vo=XP,I=q,ia=su,B0=TT,L=ce,W=ye,P=pe;var Wp=Mg;var Nn=$t,Xn=xp,qJ=PF,zJ=MF,WJ=NF;var KJ=FF,xt=nM,D=Et,oy=pg,je=Ye,aa=QP,gn=ta,Go=YP;var Kp=Vf,VJ=IT,ar=oe,GJ=s_,$0=Kf,JJ=ET,ZJ=ZP,QJ=JP,A=Y,j0=pM,Vt=bo,_t=pi,YJ=Ba,XJ=VM,eo=bp,K=_e,Pt=Zr,sy=Gf,vo=gp,e8=cM,H0=RM,t8=NT,xu=Es;var UU=bg,DU=$M,r8=jM,n8=HM,o8=qM,rt=Mn,q0=NM,s8=yp,i8=Sg,a8=FM,z0=DT,LU=oa,gl=BT,c8=$T,Ii=Eg,Vp=LT,u8=LM,Gp=UM,f8=DM,l8=yg,BU=BM,d8=jT,iy=$p,W0=M0,p8=uM,ay=KM,cy=Ig,m8=bU,h8=mN,x8=zM,g8=WM,K0=eF,y8=zT,$U=qT,ca=XM,ua=ol,S8=tF,V0=RT,b8=OT,E8=fM,Ya=_T,G0=RF,I8=OF,J0=_F,jU=QT,T8=YT,HU=OM,w8=kF,uy=_M,Z0=Tg,v8=Sp,C8=HT,A8=ZM,k8=lM,Un=di,qU=Yf,R8=QM,O8=YM,Nr=FT,yn=ja,Q0=ty,Ur=Eo,_8=kM,Y0=vM,gu=CM,Xa=Qf,X0=na,P8=AM,Jo=Pn,M8=xg,Co=Ep,ec=wg,yl=vg,Ti=Cg,F8=dF,zU=lF,WU=tl,wi=cF,to=Ip,N8=uF,U8=GT,Jp=Io,Xr=To,D8=KT,L8=VT,fy=hF,B8=mF,$8=JT,Dn=rl,vi=Ag,yu=fF,Ci=iu,en=Gn,j8=yF,H8=SF,Mt=gg,KU=gU,q8=P0,z8=UT,ew=PM,W8=d(2,(e,t)=>VU(e,void 0,t)),VU=yU,K8=GF,V8=JF,G8=ZF,J8=QF,Z8=sN,Q8=iN,Y8=aN,X8=cN,eZ=tN,tZ=rN,rZ=nN,tw=XF,rw=bs,Zp=pp,nZ=oN,oZ=eN,Sl=Wf,sZ=CU,iZ=AU,bl=UF,gt=XT,Rs=BF,El=DF,aZ=LF,cZ=tM,uZ=rM,Qp=jF,Sr=sa,nw=e0,fZ=HF,ow=zF,sw=t0,ly=qF,lZ=Og,Ai=KF,iw=r0,ki=WF,dZ=_g,me=CT,pZ=oM,Su=Is,Il=Ts,mZ=Ts(),hZ=Ts("Fatal"),xZ=Ts("Warn"),Yp=Ts("Error"),gZ=Ts("Info"),yZ=Ts("Debug"),SZ=Ts("Trace"),bZ=d(2,(e,t)=>na(e,i0,r=>new Set([...r,t]))),dy=d(e=>Yr(e[0]),(e,...t)=>na(e,CN,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||B(n,t[0],t[1]),n})),EZ=dN,IZ=d(2,(e,t)=>Y(s0,r=>na(e,AN,n=>[[t,r],...n]))),TZ=d(e=>Yr(e[0]),(e,t,r)=>Xr(e,n=>{let o=r===void 0?n:r(n);return hl(t,o)})),wZ=d(e=>Yr(e[0]),(e,t,r)=>_t(e,n=>{let o=r===void 0?n:r(n);return hl(t,o)})),vZ=d(e=>Yr(e[0]),(e,t,r)=>Vp(e,n=>{let o=r===void 0?n:r(n);return hl(t,o)})),CZ=d(e=>Yr(e[0]),(e,t,r)=>BU(e,n=>{let o=r===void 0?n:r(n);return hl(t,o)})),AZ=d(e=>Yr(e[0]),(e,t,r)=>Su(n=>{let o=n.monotonicTimeNanosUnsafe();return Xr(e,()=>{let s=n.monotonicTimeNanosUnsafe(),i=pP($e(s),$e(o)),a=r===void 0?i:r(i);return hl(t,a)})})),xl=class extends Ue()("effect/Effect/Transaction"){},kZ=e=>ar(t=>{let r=Vi(t.context,xl);if(r&&!NU.has(r))return e;r={journal:new Map,retry:!1};let n;return en(o=>A(xn({while:()=>!n,body:qe(o(e).pipe(Jo(xl,r),Gp(s=>r.retry?cg(s)?o(RZ(r)):W(()=>L0(r)):P),eo)),step(s){if(r.retry||!GU(r))return L0(r);ft(s)&&OZ(t,r),L0(r),NU.add(r),n=s}}),()=>n))}),NU=new WeakSet,GU=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},RZ=e=>Nn(t=>{if(!GU(e))return t(P);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let i of n)i.pending.delete(r)},s=()=>{o(),t(P)};for(let i of n)i.pending.set(r,s);return W(o)});function OZ(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function L0(e){e.retry=!1,e.journal.clear()}var _Z=A(xl,e=>(e.retry=!0,Dn)),PZ=(e,t,r)=>(...n)=>Nn(o=>{try{e(...n,(s,i)=>{o(s?t?L(()=>D(t(s,n))):D(s):I(i))})}catch(s){o(r?D(r(s,n)):gn(s))}}),MZ=()=>e=>e,FZ=()=>e=>e,NZ=()=>e=>e,bu=mM,Eu=hM,cr=xM,ur=dM,py=gM,aw=sM;var JU=/^[+-]?\d+$/,uw="~effect/BigDecimal",UZ={[uw]:uw,[ie](){let e=Xp(this);return he(Be(String(e.value)),zt(e.scale))},[ae](e){return Iu(e)&&eD(this,e)===0},toString(){return`BigDecimal(${fa(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},Iu=e=>O(e,uw),my=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(UZ);return r.value=e,r.scale=t,r},YU=(e,t)=>{let r=my(e,t);return r.normalized=r,r};var Os=BigInt(0),DZ=BigInt(1);var LZ=BigInt(10),XU=YU(Os,0);var Xp=e=>{if(e.normalized===void 0)if(e.value===Os)e.normalized=XU;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=YU(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var BZ=100,$Z=[DZ],cw=(e,t)=>e===t?0:e<t?-1:1,ZU=(e,t)=>{let r=`${e.value<Os?-e.value:e.value}`,n=`${t.value<Os?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==Os)return o<Os?-1:1;let s=Math.max(r.length,n.length);return v_(r.padEnd(s,"0"),n.padEnd(s,"0"))},eD=(e,t)=>{if(e.scale===t.scale)return cw(e.value,t.value);let r=QU(e),n=QU(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>BZ)return r===-1?ZU(t,e):ZU(e,t);let i=$Z[s]??=LZ**BigInt(s);return o>0?cw(e.value,t.value*i):cw(e.value*i,t.value)},Tl=ai(eD);var QU=e=>e.value===Os?0:e.value<Os?-1:1;var tD=e=>{if(e==="")return N(XU);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!JU.test(c))return _()}else t=e,r=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(!JU.test(o))return _();let a=s-r;return Number.isSafeInteger(a)?N(my(BigInt(o),a)):_()};var fa=e=>{let t=Xp(e);if(Math.abs(t.scale)>=16)return jZ(t);let r=t.value<Os,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,"0"):n.padEnd(n.length-t.scale,"0"),s=o.length-t.scale,i=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${i}`:i},jZ=e=>{if(HZ(e))return"0e+0";let t=Xp(e),r=`${t.value}`,n=t.value<Os?2:1,o=r.slice(0,n),s=r.slice(n),i=s.length-t.scale;return`${o}${s===""?"":`.${s}`}e${i>=0?"+":""}${i}`};var HZ=e=>e.value===Os;var l={};ps(l,{Any:()=>v7,Array:()=>ct,ArrayEnsure:()=>N7,BigDecimal:()=>oj,BigDecimalFromString:()=>mee,BigInt:()=>ld,BigIntFromString:()=>XX,Boolean:()=>Fi,BooleanFromBit:()=>iee,BooleanLiterals:()=>H7,ByteSize:()=>GS,ByteSizeFromBigInt:()=>xee,ByteSizeFromNumber:()=>gee,ByteSizeFromString:()=>hee,Cause:()=>Gm,CauseReason:()=>XC,Char:()=>BX,Chunk:()=>yee,Class:()=>QS,Cookie:()=>Gj,Cookies:()=>Jj,Date:()=>VS,DateFromMillis:()=>KX,DateFromString:()=>WX,DateTimeUtc:()=>JS,DateTimeUtcFromDate:()=>wee,DateTimeUtcFromMillis:()=>Cee,DateTimeUtcFromString:()=>vee,DateTimeZoned:()=>Ej,DateTimeZonedFromString:()=>Oee,Defect:()=>er,DnsARecord:()=>Uj,DnsAaaaRecord:()=>Dj,DnsCaaRecord:()=>Lj,DnsCnameRecord:()=>Bj,DnsMxRecord:()=>$j,DnsNaptrRecord:()=>jj,DnsNsRecord:()=>Hj,DnsPtrRecord:()=>qj,DnsRecord:()=>Cte,DnsRecordType:()=>vte,DnsSoaRecord:()=>zj,DnsSrvRecord:()=>Wj,DnsTlsaRecord:()=>Kj,DnsTxtRecord:()=>Vj,DomainName:()=>Sa,DomainNameFromString:()=>_j,Duration:()=>sh,DurationFromMillis:()=>wte,DurationFromNanos:()=>Tte,DurationFromString:()=>Ite,Enum:()=>w7,Error:()=>Ar,ErrorInstance:()=>$X,Exit:()=>yA,FalseLiterals:()=>_$,File:()=>Z$,Finite:()=>WS,FiniteFromString:()=>YX,FormData:()=>Q$,Graph:()=>Ote,HashMap:()=>_te,HashSet:()=>Pte,Headers:()=>Dte,Host:()=>mte,HostFromString:()=>hte,HostPort:()=>Mj,HostPortFromString:()=>xte,InetAddress:()=>Rj,InetAddressFromString:()=>lte,InetAddressV4:()=>ute,InetAddressV6:()=>fte,Int:()=>In,IpAddress:()=>Sc,IpAddressFromString:()=>ef,IpInterface:()=>vj,IpInterfaceFromString:()=>ste,IpLinkLocalAddress:()=>Wee,IpLinkLocalAddressFromString:()=>Kee,IpLoopbackAddress:()=>qee,IpLoopbackAddressFromString:()=>zee,IpMulticastAddress:()=>_ee,IpMulticastAddressFromString:()=>Pee,IpNetwork:()=>kj,IpNetworkFromString:()=>cte,IpUnicastAddress:()=>Nee,IpUnicastAddressFromString:()=>Uee,IpUnspecifiedAddress:()=>Vee,IpUnspecifiedAddressFromString:()=>Gee,Ipv4Address:()=>oh,Ipv4AddressFromString:()=>xA,Ipv4BroadcastAddress:()=>Bee,Ipv4BroadcastAddressFromString:()=>$ee,Ipv4Interface:()=>Tj,Ipv4InterfaceFromString:()=>nte,Ipv4Network:()=>Cj,Ipv4NetworkFromString:()=>ite,Ipv4PrivateAddress:()=>Jee,Ipv4PrivateAddressFromString:()=>Zee,Ipv6Address:()=>ZS,Ipv6AddressFromString:()=>Ij,Ipv6Interface:()=>wj,Ipv6InterfaceFromString:()=>ote,Ipv6Network:()=>Aj,Ipv6NetworkFromString:()=>ate,Ipv6UniqueLocalAddress:()=>Qee,Ipv6UniqueLocalAddressFromString:()=>Yee,Json:()=>YS,JsonFromUrlParamsField:()=>Lte,JsonObject:()=>lre,Literal:()=>fr,Literals:()=>Fo,MacAddress:()=>Xu,MacAddressFromString:()=>md,MacBroadcastAddress:()=>jee,MacBroadcastAddressFromString:()=>Hee,MacLocallyAdministeredAddress:()=>Xee,MacLocallyAdministeredAddressFromString:()=>ete,MacMulticastAddress:()=>Mee,MacMulticastAddressFromString:()=>Fee,MacUnicastAddress:()=>Dee,MacUnicastAddressFromString:()=>Lee,MacUniversallyAdministeredAddress:()=>tte,MacUniversallyAdministeredAddressFromString:()=>rte,MutableJson:()=>pre,Natural:()=>Ku,Never:()=>Mi,NonEmptyArray:()=>Qu,NonEmptyString:()=>pA,Null:()=>jS,NullOr:()=>iA,NullishOr:()=>T$,Number:()=>Ju,NumberFromString:()=>QX,ObjectKeyword:()=>A7,Opaque:()=>J7,Option:()=>ba,OptionFromNullOr:()=>Mte,OptionFromNullishOr:()=>Nte,OptionFromOptional:()=>jte,OptionFromOptionalKey:()=>$te,OptionFromOptionalNullOr:()=>Hte,OptionFromUndefinedOr:()=>Fte,Port:()=>gte,PropertyKey:()=>YC,ReadonlyMap:()=>jX,ReadonlySet:()=>HX,Record:()=>Zu,RecordFromCookies:()=>Ute,RecordFromUrlParams:()=>Bte,Redacted:()=>Zj,RedactedFromValue:()=>qte,RegExp:()=>qX,Result:()=>zte,SchemaError:()=>$n,ScopedIpv6Literal:()=>gA,ScopedIpv6LiteralFromString:()=>Pj,SocketAddress:()=>pte,StandardSchemaV1FailureResult:()=>see,String:()=>z,StringForLiteralAutocomplete:()=>C7,StringFromBase64:()=>tee,StringFromBase64Url:()=>ree,StringFromHex:()=>nee,StringFromUriComponent:()=>oee,Struct:()=>Te,StructWithRest:()=>M7,Symbol:()=>b$,TaggedClass:()=>Gte,TaggedError:()=>EA,TaggedStruct:()=>ya,TaggedUnion:()=>G7,TemplateLiteral:()=>I7,TemplateLiteralParser:()=>T7,TimeZone:()=>Sj,TimeZoneFromString:()=>Ree,TimeZoneNamed:()=>gj,TimeZoneNamedFromString:()=>kee,TimeZoneOffset:()=>Aee,Tree:()=>fre,Trim:()=>eee,Trimmed:()=>X$,TrueLiterals:()=>O$,Tuple:()=>rs,TupleWithRest:()=>F7,URL:()=>G$,URLFromString:()=>zX,URLSearchParams:()=>Y$,Uint8Array:()=>qs,Uint8ArrayFromBase64:()=>aee,Uint8ArrayFromBase64Url:()=>cee,Uint8ArrayFromHex:()=>tj,Undefined:()=>oA,UndefinedOr:()=>qS,Union:()=>Pe,UniqueArray:()=>U7,UniqueSymbol:()=>k7,UnixPathAddress:()=>Oj,UnixPathAddressFromString:()=>dte,Unknown:()=>Ym,UnknownFromJsonString:()=>GX,UrlParams:()=>SA,Void:()=>dd,annotate:()=>e7,annotateEncoded:()=>t7,annotateKey:()=>r7,asserts:()=>a7,brand:()=>zS,catchDecoding:()=>$7,catchDecodingWithContext:()=>k$,catchEncoding:()=>j7,catchEncodingWithContext:()=>R$,check:()=>L7,declare:()=>Ge,declareConstructor:()=>Cr,decode:()=>q7,decodeEffect:()=>c7,decodeExit:()=>d$,decodeOption:()=>f7,decodePromise:()=>d7,decodeResult:()=>l7,decodeSync:()=>Jm,decodeTo:()=>ee,decodeUnknownEffect:()=>xc,decodeUnknownExit:()=>l$,decodeUnknownOption:()=>u7,decodeUnknownPromise:()=>m$,decodeUnknownResult:()=>p$,decodeUnknownSync:()=>$S,encode:()=>z7,encodeEffect:()=>rA,encodeExit:()=>x$,encodeKeys:()=>_7,encodeOption:()=>m7,encodePromise:()=>x7,encodeResult:()=>h7,encodeSync:()=>nA,encodeTo:()=>aA,encodeUnknownEffect:()=>Zm,encodeUnknownExit:()=>h$,encodeUnknownOption:()=>p7,encodeUnknownPromise:()=>y$,encodeUnknownResult:()=>g$,encodeUnknownSync:()=>Qm,extendTo:()=>P7,fieldsAssign:()=>R7,flip:()=>QC,fromBrand:()=>B7,fromFormData:()=>JX,fromJsonString:()=>mA,fromURLSearchParams:()=>ZX,instanceOf:()=>gc,is:()=>i7,isBase64:()=>D$,isBase64Url:()=>oX,isBetween:()=>yc,isBetweenBigDecimal:()=>pee,isBetweenBigInt:()=>kX,isBetweenCodePoints:()=>_X,isBetweenDate:()=>wX,isBetweenLength:()=>fA,isBetweenProperties:()=>DX,isBetweenSize:()=>FX,isCapitalized:()=>fX,isEndingWith:()=>iX,isFinite:()=>dX,isGUID:()=>rX,isGreaterThan:()=>mX,isGreaterThanBigDecimal:()=>uee,isGreaterThanBigInt:()=>vX,isGreaterThanDate:()=>bX,isGreaterThanOrEqualTo:()=>L$,isGreaterThanOrEqualToBigDecimal:()=>fee,isGreaterThanOrEqualToBigInt:()=>B$,isGreaterThanOrEqualToDate:()=>EX,isIncluding:()=>aX,isInt:()=>KS,isInt32:()=>yX,isLessThan:()=>hX,isLessThanBigDecimal:()=>lee,isLessThanBigInt:()=>CX,isLessThanDate:()=>IX,isLessThanOrEqualTo:()=>xX,isLessThanOrEqualToBigDecimal:()=>dee,isLessThanOrEqualToBigInt:()=>AX,isLessThanOrEqualToDate:()=>TX,isLowercased:()=>uX,isMaxCodePoints:()=>OX,isMaxLength:()=>q$,isMaxProperties:()=>UX,isMaxSize:()=>MX,isMinCodePoints:()=>RX,isMinLength:()=>$$,isMinProperties:()=>NX,isMinSize:()=>PX,isMultipleOf:()=>gX,isNonEmpty:()=>H$,isPattern:()=>Yu,isPropertyNames:()=>LX,isSchema:()=>Gu,isSchemaError:()=>ud,isStartingWith:()=>sX,isStringBigInt:()=>Y7,isStringFinite:()=>Q7,isStringSymbol:()=>X7,isTrimmed:()=>U$,isULID:()=>nX,isUUID:()=>tX,isUint32:()=>SX,isUncapitalized:()=>lX,isUnique:()=>dA,isUniqueKey:()=>z$,isUppercased:()=>cX,link:()=>Ne,linkDecoding:()=>pd,make:()=>J,makeFilter:()=>Je,makeFilterGroup:()=>Z7,makeIsBetween:()=>nh,makeIsGreaterThan:()=>Xm,makeIsGreaterThanOrEqualTo:()=>eh,makeIsLessThan:()=>th,makeIsLessThanOrEqualTo:()=>rh,makeIsMultipleOf:()=>pX,middlewareDecoding:()=>C$,middlewareEncoding:()=>A$,mutable:()=>D7,mutableKey:()=>S7,optional:()=>lr,optionalKey:()=>Vu,overrideToCodecIso:()=>cre,overrideToEquivalence:()=>Qte,overrideToFormatter:()=>Jte,readonlyKey:()=>b7,refine:()=>v$,required:()=>y7,requiredKey:()=>g7,resolveAnnotations:()=>mre,resolveAnnotationsKey:()=>hre,revealBottom:()=>XY,revealCodec:()=>n7,suspend:()=>w$,tag:()=>He,tagDefaultOmit:()=>V7,toCodecArrayFromSingle:()=>nre,toCodecIso:()=>tre,toCodecJson:()=>tf,toCodecStringTree:()=>rre,toDifferJsonPatch:()=>ure,toEncoded:()=>fd,toEncoderXml:()=>ore,toEquivalence:()=>Yte,toFormatter:()=>Zte,toIso:()=>sre,toIsoFocus:()=>are,toIsoSource:()=>ire,toJsonSchemaDocument:()=>ere,toRepresentation:()=>Xte,toStandardJSONSchemaV1:()=>s7,toStandardSchemaV1:()=>o7,toTaggedUnion:()=>N$,toType:()=>oo,withArrayLengthConstraints:()=>HS,withConstructorDefault:()=>P$,withDecodingDefault:()=>F$,withDecodingDefaultKey:()=>cA,withDecodingDefaultType:()=>K7,withDecodingDefaultTypeKey:()=>W7});var rD=globalThis.BigInt;var nD=e=>e>rD(Number.MAX_SAFE_INTEGER)||e<rD(Number.MIN_SAFE_INTEGER)?_():N(Number(e));var lw=BigInt(0),qZ=BigInt(1),Ri=BigInt(1e3),tc=BigInt(1024),sD=[{symbol:"B",factor:qZ,names:["B","byte","bytes"]},{symbol:"kB",factor:Ri,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ri**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ri**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ri**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ri**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ri**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ri**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ri**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ri**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ri**BigInt(10),names:["QB","quettabyte","quettabytes"]}],zZ=[sD[0],{symbol:"KiB",factor:tc,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:tc**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:tc**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:tc**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:tc**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:tc**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:tc**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:tc**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],WZ=[...sD,...zZ.slice(1)],KZ=new Map(WZ.flatMap(e=>e.names.map(t=>[t,e])));var dw=e=>e;var wl=e=>{throw new Error(`Invalid ByteSize: ${e}`)},iD=e=>!Number.isSafeInteger(e)||e<0?wl(`expected a non-negative safe integer, received ${e}`):dw(BigInt(e));var aD=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return wl(`unsupported syntax ${JSON.stringify(e)}`);let r=KZ.get(t[3]);if(r===void 0)return wl(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??"",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==lw?wl(`${JSON.stringify(e)} does not represent an integral number of bytes`):dw(s/o)},cD=xs(aD),hy=e=>{switch(typeof e){case"bigint":return e<lw?wl(`expected a non-negative bigint, received ${e}`):dw(e);case"number":return iD(e);case"string":return aD(e)}return wl(`unsupported input ${e}`)},pw=xs(hy),uD=e=>typeof e=="bigint"?hy(e):iD(e);var fD=e=>typeof e=="bigint"&&e>=lw;var xy=e=>e,lD=nD;var pD="~effect/Chunk";function dD(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var mD=[],hw=e=>Wr((t,r)=>{if(t.length!==r.length)return!1;let n=Tu(t),o=Tu(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),JZ=hw(Z),ZZ={[pD]:{_A:e=>e},toString(){return`Chunk(${H(Tu(this))})`},toJSON(){return{_id:"Chunk",values:pr(Tu(this))}},[Qe](){return this.toJSON()},[ae](e){return vl(e)&&JZ(this,e)},[ie](){return ri(Tu(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return mD[Symbol.iterator]();default:return Tu(this)[Symbol.iterator]()}},pipe(){return V(this,arguments)}},xw=e=>{let t=Object.create(ZZ);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=la,t.right=la;break}case"ISingleton":{t.length=1,t.depth=0,t.left=la,t.right=la;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=la,t.right=la;break}}return t},vl=e=>O(e,pD),la=xw({_tag:"IEmpty"}),QZ=()=>la;var YZ=e=>xw({_tag:"ISingleton",a:e}),gw=e=>vl(e)?e:e5(Ct(e)),mw=(e,t,r)=>{switch(e.backing._tag){case"IArray":{dD(e.backing.array,0,t,r,e.length);break}case"IConcat":{mw(e.left,t,r),mw(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{dD(Tu(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var XZ=e=>{switch(e.backing._tag){case"IEmpty":return mD;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return mw(e,t,0),e.backing={_tag:"IArray",array:t},e.left=la,e.right=la,e.depth=0,t}}},Tu=XZ;var e5=e=>e.length===0?QZ():e.length===1?YZ(e[0]):xw({_tag:"IArray",array:e});var hD=e=>e.length;var wu=dl,xD=mu,gD=GN,yD=JN,SD=ZN,bD=x0,ED=QN;var Sy=Zg;var by=g0;var yw=XN,ID=eU;var Sw=tU;var bw=y0,Ew=Mp,TD=S0;var wD=b0,em=rU;var vD=Fp;var CD=T0;var AD=oU;var Iw=v0;var Cl=e=>t5(typeof e=="string"?r5.encode(e):e),vu=e=>{let t=o5(e),r=t.length;if(r%4!==0)return re(new jo({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return re(new jo({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let i=0,a=0;i<r;i+=4,a+=3){let c=Ey(t.charCodeAt(i))<<18|Ey(t.charCodeAt(i+1))<<12|Ey(t.charCodeAt(i+2))<<6|Ey(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return X(s)}catch(o){return re(new jo({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},kD=e=>Vr(vu(e),t=>n5.decode(t)),t5=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4|e[n-1]>>4],r+=_s[(e[n-1]&15)<<2|e[n]>>6],r+=_s[e[n]&63];return n===t+1&&(r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4|e[n-1]>>4],r+=_s[(e[n-1]&15)<<2],r+="="),r},r5=new TextEncoder,n5=new TextDecoder,o5=e=>e.replace(/[\n\r]/g,""),_s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tm=new Uint8Array(123).fill(255);for(let e=0;e<_s.length;e++)tm[_s.charCodeAt(e)]=e;tm[61]=0;var Ey=e=>{if(e>=tm.length||tm[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return tm[e]};var Ty="~effect/HashMap",Ps=5,nm=1<<Ps,s5=nm/4,RD=nm/2,i5=nm-1,a5=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),rm=(e,t)=>e>>>t&i5,rc=(e,t)=>1<<rm(e,t),Iy=(e,t)=>a5(e&t-1);function OD(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let i=rc(r,t),a=rc(o,t);if(i===a){let f=OD(e,t+Ps,r,n,o,s);return new ku(e,i,[f])}let c=i|a,u=i>>>0<a>>>0?[n,s]:[s,n];return new ku(e,c,u)}var c5=Be("HashMap"),_D=(e,t)=>he(G(e),G(t)),PD=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},Cu=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=jc;t=this.computeHash(),r===jc&&(this._hash=t)}return t}},vw=class extends Cu{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return _()}has(t,r,n){return!1}set(t,r,n,o,s,i){return i.value=!0,new Au(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},Au=class e extends Cu{_tag="LeafNode";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&Z(this.key,n)?N(this.value):_()}has(t,r,n){return this.hash===r&&Z(this.key,n)}set(t,r,n,o,s,i){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&Z(this.key,o))return Z(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(i.value=!0,this.hash===n)return new Cw(t,n,[[this.key,this.value],[o,s]]);let a=rc(n,r),c=rc(this.hash,r);if(a===c)return new ku(t,a,[this.set(t,r+Ps,n,o,s,i)]);let u=a|c,f=a>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new ku(t,u,f)}remove(t,r,n,o,s){if(this.hash===n&&Z(this.key,o)){s.value=!0;return}return this}computeHash(){return _D(this.key,this.value)}},Cw=class e extends Cu{_tag="CollisionNode";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return _();for(let[o,s]of this.entries)if(Z(o,n))return N(s);return _()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(Z(o,n))return!0;return!1}set(t,r,n,o,s,i){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return i.value=!0,OD(t,r,this.hash,this,n,new Au(t,n,o,s));for(let a=0;a<this.entries.length;a++)if(Z(this.entries[a][0],o)){if(Z(this.entries[a][1],s))return this;if(this.canEdit(t))return this.entries[a]=[o,s],this;let c=[...this.entries];return c[a]=[o,s],new e(t,this.hash,c)}return i.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let i=this.entries.findIndex(([c])=>Z(c,o));if(i===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[i===0?1:0];return new Au(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(i,1),this;let a=[...this.entries];return a.splice(i,1),new e(t,this.hash,a)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=_D(r[n][0],r[n][1]);return t}},ku=class e extends Cu{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=rc(r,t);if((this.bitmap&o)===0)return _();let s=Iy(this.bitmap,o);return this.children[s].get(t+Ps,r,n)}has(t,r,n){let o=rc(r,t);if((this.bitmap&o)===0)return!1;let s=Iy(this.bitmap,o);return this.children[s].has(t+Ps,r,n)}set(t,r,n,o,s,i){this.canEdit(t)&&(this._hash=void 0);let a=rc(n,r),c=Iy(this.bitmap,a);if((this.bitmap&a)!==0){let u=this.children[c],f=u.set(t,r+Ps,n,o,s,i);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let p=[...this.children];return p[c]=f,new e(t,this.bitmap,p)}else{i.value=!0;let u=new Au(t,n,o,s),f=this.bitmap|a;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>RD?this.expand(t,f,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>RD?this.expand(t,f,p):new e(t,f,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let i=rc(n,r);if((this.bitmap&i)===0)return this;let a=Iy(this.bitmap,i),c=this.children[a],u=c.remove(t,r+Ps,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^i;if(p===0)return;if(this.children.length===2){let h=this.children[a===0?1:0];if(h._tag==="LeafNode")return h}if(this.canEdit(t))return this.children.splice(a,1),this.bitmap=p,this._size=void 0,this;let m=[...this.children];return m.splice(a,1),new e(t,p,m)}if(c===u)return this;if(this.canEdit(t))return this.children[a]=u,this;let f=[...this.children];return f[a]=u,new e(t,this.bitmap,f)}expand(t,r,n){let o=new globalThis.Array(nm),s=0;for(let i=0;i<nm;i++)(r&1<<i)!==0&&(o[i]=n[s++]);return new Aw(t,n.length,o)}computeHash(){return PD(this.children)}},Aw=class e extends Cu{_tag="ArrayNode";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=rm(r,t),s=this.children[o];return s?s.get(t+Ps,r,n):_()}has(t,r,n){let o=rm(r,t),s=this.children[o];return s?s.has(t+Ps,r,n):!1}set(t,r,n,o,s,i){this.canEdit(t)&&(this._hash=void 0);let a=rm(n,r),c=this.children[a];if(c){let u=c.set(t,r+Ps,n,o,s,i);if(c===u)return this;if(this.canEdit(t))return this.children[a]=u,this;let f=[...this.children];return f[a]=u,new e(t,this.count,f)}else{i.value=!0;let u=new Au(t,n,o,s);if(this.canEdit(t))return this.children[a]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[a]=u,new e(t,this.count+1,f)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let i=rm(n,r),a=this.children[i];if(!a)return this;let c=a.remove(t,r+Ps,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<s5)return this.pack(t,i,c);if(a===c)return this;if(this.canEdit(t))return this.children[i]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[i]=c,new e(t,u,f)}pack(t,r,n){let o=[],s=0,i=1;for(let a=0;a<this.children.length;a++){let c=a===r?n:this.children[a];c&&(o.push(c),s|=i),i<<=1}return new ku(t,s,o)}computeHash(){return PD(this.children)}},wy=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case"LeafNode":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case"CollisionNode":{this.entries=t.entries,this.index=0;break}case"IndexedNode":case"ArrayNode":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},u5=(e,t)=>[e,t];var om=class{[Ty]=Ty;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new wy(this._root,u5)}[ae](t){if(kw(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Nd(t,ND(n));if(fe(s)||!Z(o,s.value))return!1}return!0}return!1}[ie](){return _r(c5^this._root.subtreeHash())}[Qe](){return pr(this)}toString(){return`HashMap(${H(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[pr(t),pr(r)])}}pipe(){return V(this,arguments)}},MD=new vw,kw=e=>O(e,Ty),Rw=()=>new om(!1,0,MD,0);var FD=e=>{let t=MD,r=0,n={value:!1};for(let[o,s]of e){let i=G(o);n.value=!1,t=t.set(NaN,0,i,o,s,n),n.value&&r++}return new om(!1,0,t,r)};var ND=d(2,(e,t)=>e._root.get(0,G(t),t));var Ow=d(2,(e,t)=>e._root.has(0,G(t),t));var f5=(e,t,r,n)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,r,t,n,s);return o._editable?(o._root=a,s.value&&o._size++,e):o._root===a?e:new om(!1,o._edit,a,o._size+(s.value?1:0))},_w=d(3,(e,t,r)=>f5(e,t,G(t),r)),Pw=e=>new wy(e._root,F);var UD=e=>e[Symbol.iterator](),vy=e=>e.size;var Cy=kw;var Mw=FD;var p5=UD,sm=e=>Array.from(p5(e)),LD=vy;var im="~effect/HashSet",m5=Be(im),h5={[ie](){return _r(he(m5,G(ky(this))))},[ae](e){return Fw(e)&&Ry(this)===Ry(e)&&jD(this,t=>$D(e,t))},[Symbol.iterator](){return Pw(ky(this))},toString(){return`HashSet(${H(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:pr(Array.from(this))}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},x5=e=>{let t=Object.create(h5);return t[im]=im,t.keyMap=e,t},Fw=e=>O(e,im),ky=e=>e.keyMap;var BD=e=>{let t=Rw();for(let r of e)t=_w(t,r,!0);return x5(t)},$D=(e,t)=>Ow(ky(e),t);var Ry=e=>vy(ky(e));var jD=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var Nw=BD,Oy=Fw;var HD=Ry;var Uw="~effect/http/Cookies",zD=e=>O(e,Uw),Dw="~effect/http/Cookies/Cookie",WD=e=>O(e,Dw),qD="~effect/http/Cookies/CookieError",Lw=class extends SP{},Ru=class e extends sr("CookiesError"){static fromReason(t,r){return new e({reason:new Lw({_tag:t,cause:r})})}[qD]=qD;get message(){return this.reason._tag}};var y5={[Uw]:Uw,...Ot,toJSON(){return{_id:"effect/Cookies",cookies:Ux(this.cookies,e=>e.toJSON())}},pipe(){return V(this,arguments)}},$w=e=>{let t=Object.create(y5);return t.cookies=e,t},jw=e=>{let t={};for(let r of e)B(t,r.name,r);return $w(t)},Py=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=S5(n.trim());o&&r.push(o)}return jw(r)};function S5(e){let t=e.split(";").map(a=>a.trim()).filter(a=>a!=="");if(t.length===0)return;let r=t[0].indexOf("=");if(r===-1)return;let n=t[0].slice(0,r);if(!KD.test(n))return;let o=t[0].slice(r+1),s=v5(o);if(t.length===1)return Object.assign(Object.create(Bw),{name:n,value:s,valueEncoded:o});let i={};for(let a=1;a<t.length;a++){let c=t[a],u=c.indexOf("="),f=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(p===void 0)break;let m=p.trim().replace(/^\./,"");m&&(i.domain=m);break}case"expires":{if(p===void 0)break;let m=new Date(p);isNaN(m.getTime())||(i.expires=m);break}case"max-age":{if(p===void 0)break;let m=parseInt(p,10);isNaN(m)||(i.maxAge=up(m));break}case"path":{if(p===void 0)break;p[0]==="/"&&(i.path=p);break}case"priority":{if(p===void 0)break;switch(p.toLowerCase()){case"low":i.priority="low";break;case"medium":i.priority="medium";break;case"high":i.priority="high";break}break}case"httponly":{i.httpOnly=!0;break}case"secure":{i.secure=!0;break}case"partitioned":{i.partitioned=!0;break}case"samesite":{if(p===void 0)break;switch(p.toLowerCase()){case"lax":i.sameSite="lax";break;case"strict":i.sameSite="strict";break;case"none":i.sameSite="none";break}break}}}return Object.assign(Object.create(Bw),{name:n,value:s,valueEncoded:o,options:Object.keys(i).length>0?i:void 0})}var b5=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,KD=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,E5=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,I5=/^[\u0020-\u003a\u003c-\u007e]+$/,Bw={[Dw]:Dw,...Ot,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function T5(e,t,r){let n=encodeURIComponent(t),o=VD(e,n,r);return o!==void 0?re(o):X(Object.assign(Object.create(Bw),{name:e,value:t,valueEncoded:n,options:r}))}function VD(e,t,r){if(!KD.test(e))return Ru.fromReason("InvalidCookieName");if(t&&!b5.test(t))return Ru.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!E5.test(r.domain))return Ru.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!I5.test(r.path))return Ru.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!Wn($e(r.maxAge)))return Ru.fromReason("CookieInfinityMaxAge")}var GD=(e,t,r)=>eu(T5(e,t,r));function w5(e){let t=VD(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+"="+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=ui($e(n.maxAge));r+="; Max-Age="+Math.trunc(o)}if(n.domain!==void 0&&(r+="; Domain="+n.domain),n.path!==void 0&&(r+="; Path="+n.path),n.priority!==void 0)switch(n.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break}if(n.expires!==void 0&&(r+="; Expires="+n.expires.toUTCString()),n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.partitioned&&(r+="; Partitioned"),n.sameSite!==void 0)switch(n.sameSite){case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break}return r}var JD=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];B(t,o.name,o.value)}return t},ZD=e=>Object.values(e.cookies).map(w5);var v5=e=>{try{return decodeURIComponent(e)}catch{return e}};var Ou=new WeakMap,QD=e=>{if(Ou.has(e))return Ou.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var YD="~effect/Redacted",am=e=>O(e,YD),_u=(e,t)=>{let r=Object.create(A5);return t?.label&&(r.label=t.label),Ou.set(r,e),r},A5={[YD]:{_A:e=>e},label:void 0,...wr,toJSON(){return this.toString()},toString(){return`<redacted${On(this.label)?":"+this.label:""}>`},[ie](){return G(Ou.get(this))},[ae](e){return am(e)&&Z(Ou.get(this),Ou.get(e))}},nc=QD;var XD=e=>Wr((t,r)=>e(nc(t),nc(r)));var qw=Symbol.for("~effect/http/Headers"),e1=e=>O(e,qw),cm=Object.defineProperties(Object.create(null),{[qw]:{value:qw},[qc]:{value(e){return k5(this,Re(e,Ww))}},toJSON:{value(){return ho(this)}},[ae]:{value(e){return zw(this,e)}},[ie]:{value(){return Hd(this)}},toString:{value:Ot.toString},[Qe]:{value:Ot[Qe]}}),Fy=e=>Object.assign(Object.create(cm),e),zw=Z_(Zc()),Al=Object.create(cm),Zo=e=>{if(e===void 0)return Al;if(Symbol.iterator in e){let r=Object.create(cm);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(cm);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(", "):n!==void 0&&(t[r.toLowerCase()]=n);return t},t1=e=>Object.setPrototypeOf(e,cm);var um=d(3,(e,t,r)=>{let n=Fy(e);return n[t.toLowerCase()]=r,n}),r1=d(2,(e,t)=>Fy({...e,...Zo(t)})),kl=d(2,(e,t)=>{let r=Fy(e);return Object.assign(r,t),r}),oc=d(2,(e,t)=>{let r=Fy(e);return delete r[t.toLowerCase()],r});var k5=d(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=_u(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=_u(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),n1=(e,t)=>{for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="string"){if(n.toLowerCase()===e.toLowerCase())return!0}else if(e.search(n)!==-1)return!0}return!1},Ww=Ce("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key","AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var Kw="~effect/http/UrlParams",Vw=e=>O(e,Kw),R5={...wr,[Kw]:Kw,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[ae](e){return Gw(this,e)},[ie](){return ri(this.params.flat())}},Rl=e=>{let t=Object.create(R5);return t.params=e,t},Pu=e=>{if(Vw(e))return e;let t=o1(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return Rl(r)},o1=e=>{let t=typeof e[Symbol.iterator]=="function"?Ct(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,String(o[s])]);else if(o!==null&&typeof o=="object"){let s=o1(o);for(let[i,a]of s)r.push([[n,...typeof i=="string"?[i]:i],a])}else o!==void 0&&r.push([n,String(o)]);return r},Gw=Wr((e,t)=>O5(e.params,t.params)),O5=eP(q_([Zc(),Zc()])),s1=Rl([]);var i1=d(2,(e,t)=>LI(e.params,([r])=>r===t).pipe(Lt(([,r])=>r)));var a1=d(2,(e,t)=>{let r=Pu(t).params.slice(),n=new Set;for(let o=0;o<r.length;o++)n.add(r[o][0]);for(let o=0;o<e.params.length;o++)n.has(e.params[o][0])||r.push(e.params[o]);return Rl(r)});var _5=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))B(t,r,n);else{let o=t[r];typeof o=="string"?B(t,r,[o,n]):o.push(n)}return t},c1=_5;var Jw="~effect/Graph",Zw=e=>O(e,Jw),u1=e=>e;var P5=(e,t,r)=>(e==="directed"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&Z(t.data,r.data),M5=(e,t)=>e==="directed"?G(t):_r(he(G(t.data),F5(t.source,t.target))),F5=(e,t)=>he(0,G(e))+he(0,G(t)),N5=Be("Graph"),U5={[Jw]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[Qe](){return this.toJSON()},[ae](e){if(O(e,Jw)){let t=u1(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!Z(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!P5(this.type,n,o))return!1}return!0}return!1},[ie](){let e=N5;e=e^Be(this.type),e=e^zt(this.nodes.size),e=e^zt(this.edges.size);for(let[t,r]of this.nodes)e^=he(G(t),G(r));for(let[t,r]of this.edges)e^=he(G(t),M5(this.type,r));return _r(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 V(this,arguments)}},D5=(e,t)=>{let r=Object.create(U5);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=N(!0),r};var fm=e=>{let t=u1(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},Uy=e=>{let t=D5(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type==="undirected"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=_(),t};function da(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Dy(e){return t=>da(t)?.[e]}var ro="~structural",Mu="~identifier",lm="~sentinels",Ly="~constructor",f1=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],Ol=Dy("identifier"),Qw=Dy(Mu),Yw=Dy("title");var dm=mo(e=>{let t=da(e)?.identifier;return typeof t=="string"?t:e.getExpected(dm)}),l1=new Set([lm,ro,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var ve=Symbol();var Dr=Mr,no=Dr(ve),nt=Dr(ve),pm=e=>e===ve?_():N(e),Xw=e=>e._tag==="None"?no:Dr(e.value);var hm="~effect/SchemaIssue/Issue";function tv(e){return O(e,hm)&&e[hm]===hm}function B5(e){return Object.hasOwn(e,"input")}var Ao=class{[hm]=hm;constructor(t,r){r?.reportInput===!0&&t!==ve&&(this.input=t)}},d1=class extends Ao{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},p1=class extends Ao{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},At=class extends Ao{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},Yt=class extends Ao{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Fu=class extends Ao{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},Ft=class extends Ao{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},at=class extends Ao{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},le=class extends Ao{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function tn(e,t,r,n,o){return new Ft(e,[new At([t],r)],n,o)}var xm=class extends Ao{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},gm=class extends Ao{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},m1=class extends Ao{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function ev(e,t,r){if(tv(e))return e;if(typeof e=="string")return new le({message:e},t,r);let n=typeof e.issue=="string"?new le({message:e.issue},t,r):e.issue;return new At(e.path,n)}function h1(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new le(void 0,t,r):ev(e,t,r)}function x1(e,t,r,n){return Array.isArray(t)?bt(t)?t.length===1?ev(t[0],r,n):new Ft(e,Bo(t,o=>ev(o,r,n)),r,n):void 0:h1(t,r,n)}var g1=e=>{let t=Ml(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return ic(dm(e.ast),e);case"InvalidValue":{let r=rv(e);if(r!==void 0)return ic(r,e);let n=By(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=By(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=By(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},y1=e=>Ml(e.issue)??Ml(e);function S1(e){return t=>({issues:Pl(t,[],e?.leafHook??g1,e?.checkHook??y1)})}function By(e){return B5(e)?H(e.input):void 0}function rv(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function ic(e,t){let r=By(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Pl(e,t,r,n){switch(e._tag){case"Filter":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Pl(e.issue,t,r,n);let s=rv(e.issue);return[{path:t,message:s===void 0?ic(nv(e.filter),e):ic(s,e.issue)}]}case"Encoding":return Pl(e.issue,t,r,n);case"Pointer":return Pl(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>Pl(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:Ml(e)??ic(dm(e.ast),e)}]:e.issues.flatMap(o=>Pl(o,t,r,n));default:return[{path:t,message:r(e)}]}}function nv(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(r=>nv(r)).join(" & ")}}function $5(){return e=>mm(e,"")}var b1=$5();function mm(e,t){let r;switch(e._tag){case"Filter":{let n=y1(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return mm(e.issue,t);let o=rv(e.issue);r=o===void 0?ic(nv(e.filter),e):ic(o,e.issue)}break}case"Encoding":return mm(e.issue,t);case"Pointer":return mm(e.issue,t+yx(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>mm(n,t)).join(`
|
|
25
|
-
`);r=
|
|
26
|
-
at ${t}`:r}function Ml(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Ml(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r=="string")return r}function ym(e){let t;for(let r of e.reasons){if(!Fg(r)||!tv(r.error))return;t??=r.error}return t}function ko(e,t){let r=ym(e);if(r===void 0)throw new Error(t,{cause:e});return r}var I1=e=>Cl(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),ov=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return re(new jo({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return re(new jo({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),vu(n)},T1=e=>Vr(ov(e),t=>j5.decode(t)),j5=new TextDecoder;var Sm=e=>Object.assign(Object.create(oI),e);function q5(e){return v1((t,r)=>D(e(t,r)))}function $y(e){return q5((t,r)=>{let n={message:e(t)};return de(t)?new xm(n,t.value,r):new xm(n)})}var w1=$y(()=>"Encoding is not supported"),z5=Sm({_tag:"Passthrough"});function Oi(){return z5}function Ie(e){return Sm({_tag:"Transform",transform:e})}function rn(e){return Sm({_tag:"TransformEffect",transform:e})}function jy(e){return Sm({_tag:"TransformOptional",transform:e})}function v1(e){return Sm({_tag:"TransformOptionalEffect",transform:e})}function sv(){return jy(()=>_())}function iv(e){return v1(t=>{let r=Fa(t,ei);return de(r)?I(r):bu(e,N)})}function Nu(){return Ie(globalThis.String)}function Hy(){return Ie(globalThis.Number)}function C1(){return Ie(globalThis.BigInt)}function av(){return Ie(e=>new globalThis.Date(e))}function A1(){return Ie(cU)}function k1(e){return rn((t,r)=>Go({try:()=>JSON.parse(t,e?.reviver),catch:()=>new le({expected:"a valid JSON string"},t,r)}))}function R1(e){return rn((t,r)=>Go({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError("Value cannot be represented as JSON");return n},catch:()=>new le({expected:"a JSON-serializable value"},t,r)}))}function cv(){return Ie(Cl)}function qy(){return Ie(I1)}function zy(){return Ie(Vx)}function O1(){return rn((e,t)=>Eu($0(vu(e)),()=>new le({expected:"a valid Base64 string"},e,t)))}function _1(){return rn((e,t)=>zn(kD(e),{onFailure:()=>D(new le({expected:"a valid Base64 string"},e,t)),onSuccess:I}))}function P1(){return rn((e,t)=>zn(ov(e),{onFailure:()=>D(new le({expected:"a valid Base64Url string"},e,t)),onSuccess:I}))}function M1(){return rn((e,t)=>zn(T1(e),{onFailure:()=>D(new le({expected:"a valid Base64Url string"},e,t)),onSuccess:I}))}function F1(){return rn((e,t)=>zn(VI(e),{onFailure:()=>D(new le({expected:"a valid hexadecimal string"},e,t)),onSuccess:I}))}function N1(){return rn((e,t)=>zn(TP(e),{onFailure:()=>D(new le({expected:"a valid hexadecimal string"},e,t)),onSuccess:I}))}function U1(){return Ie(encodeURIComponent)}function D1(){return rn((e,t)=>{try{return I(globalThis.decodeURIComponent(e))}catch{return D(new le({expected:"a valid URI component"},e,t))}})}function L1(){return Ie(e=>H1(Array.from(e.entries())))}var W5=q1(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function B1(){return Ie(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&W5(e).forEach(([n,o])=>{t.append(n,o)}),t})}function $1(){return Ie(e=>H1(Array.from(e.entries())))}var K5=q1(On);function j1(){return Ie(e=>typeof e=="object"&&e!==null?new URLSearchParams(K5(e)):new URLSearchParams)}function V5(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>$x(o)?globalThis.Number(o):o)}var G5=20;function H1(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,i])=>{let a=V5(s),c=t;for(let u=0;u<a.length;u++){let f=o.get(c),p=a[u]===""&&f!==void 0?f.length:a[u];f!==void 0&&typeof p=="number"&&(f.length=Math.max(f.length,p+1));let m=Object.hasOwn(c,p),h=m?c[p]:void 0;if(u===a.length-1){let x=o.get(h);if(x!==void 0)B(h,x.length++,i);else if(n.has(h))h.push(i);else if(m){let g=[h,i];n.add(g),B(c,p,g)}else B(c,p,i)}else{let x=a[u+1],g=typeof x=="number"||x==="";if(r.has(h)&&o.has(h)===g)c=h;else{let y={};r.add(y),g&&o.set(y,{parent:c,key:p,length:0}),B(c,p,y),c=y}}}});for(let[s,{key:i,length:a,parent:c}]of Array.from(o).reverse())c[i]===s&&a-Object.keys(s).length<=G5&&B(c,i,Object.assign(new Array(a),s));return t}function q1(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(a=>{r.push([o,a])}):s.forEach((a,c)=>{n(`${o}[${c}]`,a)});else if(typeof s=="object"&&s!==null)for(let[i,a]of Object.entries(s))n(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var Wy=class extends Ra{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Wy(this.encode,this.decode)}},Em="~effect/SchemaTransformation/Transformation",et=class extends Ra{[Em]=Em;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new et(this.encode,this.decode)}};function J5(e){return O(e,Em)&&e[Em]===Em}var Ky=e=>J5(e)?e:new et(e.decode,e.encode);function Xt(e){return new et(rn(e.decode),rn(e.encode))}function Fe(e){return new et(Ie(e.decode),Ie(e.encode))}function Vy(e){return new et(jy(e.decode),jy(e.encode))}function z1(){return new et(A1(),Oi())}var Z5=new et(Oi(),Oi());function Fl(){return Z5}var Nl=new et(Hy(),Nu()),Gy=new et(C1(),Nu()),uv=new et(av(),Ie(mI)),W1=new et(av(),Ie(e=>e.getTime()));var fv=Xt({decode:(e,t)=>Zt(cD(e),{onNone:()=>D(new le({expected:"a valid ByteSize string"},e,t)),onSome:I}),encode:e=>I(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),K1=Xt({decode:(e,t)=>Zt(pw(e),{onNone:()=>D(new le({expected:"a non-negative bigint byte count"},e,t)),onSome:I}),encode:e=>I(xy(e))}),V1=Xt({decode:(e,t)=>Zt(pw(e),{onNone:()=>D(new le({expected:"a non-negative safe-integer byte count"},e,t)),onSome:I}),encode:(e,t)=>Zt(lD(e),{onNone:()=>D(new le({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:I})}),Q5=e=>Jt(e)&&typeof e.message=="string",G1=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:Z1(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(r.name=e.name),typeof e.stack=="string"&&(r.stack=e.stack),r},Y5=e=>{try{let t=zc(e);return t===void 0?H(e):JSON.parse(t)}catch{return H(e)}},X5=(e,t,r)=>{let n={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},J1=e=>{let t=new WeakSet,r=n=>{if(jO(n)){if(t.has(n))return"[Circular]";t.add(n);let o=X5(n,e,r);return t.delete(n),o}return Y5(n)};return r},Z1=e=>Q5(e)?G1(e):e,Q1=e=>Fe({decode:G1,encode:t=>J1(e)(t)}),Y1=e=>Fe({decode:Z1,encode:J1(e)});function X1(){return Fe({decode:AI,encode:op})}function e2(){return Fe({decode:CI,encode:_n})}function t2(e){return Fe({decode:Yc,encode:e?.onNoneEncoding===null?op:_n})}function r2(){return Vy({decode:N,encode:Xc})}function n2(){return Vy({decode:e=>e.pipe(Fa(ei),N),encode:Xc})}var lv=Xt({decode:(e,t)=>URL.canParse(e)?I(new URL(e)):D(new le({expected:"a valid URL string"},e,t)),encode:e=>I(e.href)});var dv=new et(O1(),cv()),o2=new et(_1(),cv()),s2=new et(M1(),qy()),i2=new et(N1(),zy()),a2=new et(D1(),U1());function c2(e){return new et(k1(e??{}),R1(e))}var u2=new et(L1(),B1()),f2=new et($1(),j1());function cc(e){return t=>t._tag===e}var $l=cc("Declaration");var eQ=cc("Never");var Ll=cc("Literal"),mv=cc("UniqueSymbol");var Iv=cc("Arrays"),tQ=cc("Objects"),S2=cc("Union"),b2=cc("Suspend"),jt=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},nn={},Yo=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},l2="~effect/Schema",Gt=class{[l2]=l2;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},uc=class extends Gt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,i,a){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,r)=>t===ve?no:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=Du(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new uc(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},rQ=class extends Gt{_tag="Null";getParser(){return oS(this,null)}getExpected(){return"null"}},Tv=new rQ;var nQ=class extends Gt{_tag="Undefined";getParser(){return oS(this,void 0)}toCodecJson(){return lt(this,[E2])}getExpected(){return"undefined"}},E2=new jt(Tv,new et(Ie(()=>{}),Ie(()=>null))),wv=new nQ;var oQ=class extends Gt{_tag="Void";getParser(){let e=Dr(void 0);return t=>t===ve?no:e}toCodecJson(){return lt(this,[E2])}getExpected(){return"void"}},I2=new oQ;var sQ=class extends Gt{_tag="Never";getParser(){return Ns(this,$O)}getExpected(){return"never"}},vv=new sQ,iQ=class extends Gt{_tag="Any";getParser(){return Ns(this,aI)}getExpected(){return"any"}},T2=new iQ,aQ=class extends Gt{_tag="Unknown";getParser(){return Ns(this,aI)}getExpected(){return"unknown"}},pa=new aQ,cQ=class extends Gt{_tag="ObjectKeyword";getParser(){return Ns(this,$d)}getExpected(){return"object | array | function"}},w2=new cQ,v2=class extends Gt{_tag="Enum";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s=="number"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${H(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Ns(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return lt(this,[new jt(new Sn(Object.keys(e).map(t=>new Ln(t))),new et(Ie(t=>e[t]),Nu()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function pv(e){return typeof e=="number"?`parts[${e}]`:e}function hv(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${pv(t)}`);let n;switch(e._tag){case"String":case"Number":case"BigInt":n=!0;break;case"Literal":n=!e.checks;break;case"TemplateLiteral":{let o=pv(t);n=!e.checks&&e.parts.every((s,i)=>hv(s,`${o}.parts[${i}]`,r));break}case"Union":{let o=pv(t);n=!e.checks&&e.types.every((s,i)=>hv(s,`${o}.types[${i}]`,r));break}default:return!1}return n&&r.add(e),n}var Cv=class extends Gt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],i=[],a=new Set;for(let u=0;u<e.length;u++){let f=e[u];if(!hv(f,u,a))throw new Error(`Invalid TemplateLiteral part ${f._tag}`);s.push(f),i.push(f._tag==="Literal"?globalThis.String(f.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(i[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=i,this.suffixLengths=c}getParser(e){let t=new Xo(!1,this.parts.map(Bv),[]),r=e(Wl(Ro,t,A2(this)));return(n,o)=>{if(n===ve)return no;let s=r(n,o);return s._tag==="Success"?nt:cr(s,{onSuccess:()=>n,onFailure:i=>new Ft(this,[i],n,o)})}}getExpected(){return"string"}matchPart(e,t){return X2(this,e,t)===void 0?void 0:e}};function C2(e){let t=mo(o=>{if(o._tag!=="Union")return o;let s=Du(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new Sn(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new Cv(e.map(o=>t(Bn(o)))),n=new Xo(!1,e.map(Bv),[]);return Wl(r,n,A2(r))}function A2(e){return new et(rn((t,r)=>{let n=X2(e,t,r);return n?I(n):D(new le({expected:"a string matching template literal parts"},t,r))}),Ie(t=>t.join("")))}var k2=class extends Gt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return oS(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return lt(this,[new jt(e===void 0?vv:new Ln(globalThis.String(this.symbol)),rL.transformation)])}getExpected(){return globalThis.String(this.symbol)}},Ln=class extends Gt{_tag="Literal";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${H(e)}`);this.literal=e}getParser(){return oS(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?d2(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:d2(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function d2(e){let t=globalThis.String(e.literal);return lt(e,[new jt(new Ln(t),new et(Ie(()=>e.literal),Ie(()=>t)))])}var uQ=class extends Gt{_tag="String";getParser(){return Ns(this,On)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Us(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Ro=new uQ,fQ=class extends Gt{_tag="Number";getParser(){return Ns(this,Ld)}matchKey(e,t){return this._match(kQ,e,t)}matchPart(e,t){return this._match(Sv,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:Us(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(xv(this.checks,"effect/schema/isFinite")||xv(this.checks,"effect/schema/isInt"))?this:lt(this,[EQ])}toCodecStringTree(){return this.toCodecJson()===this?lt(this,[RQ]):lt(this,[OQ])}getExpected(){return"number"}};function xv(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&xv(r.checks,t))}var Av=new fQ,lQ=class extends Gt{_tag="Boolean";getParser(){return Ns(this,dx)}getExpected(){return"boolean"}},R2=new lQ,dQ=class extends Gt{_tag="Symbol";getParser(){return Ns(this,iI)}matchKey(e,t){return t.disableChecks||!this.checks?e:Us(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return lt(this,[rL])}getExpected(){return"symbol"}},O2=new dQ,pQ=class extends Gt{_tag="BigInt";getParser(){return Ns(this,DO)}matchPart(e,t){if(!bv.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:Us(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return lt(this,[PQ])}getExpected(){return"bigint"}},_2=new pQ,Xo=class extends Gt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,i,a){super(n,o,s,i),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(Lr(t[u]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<r.length;u++)if(Lr(r[u]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,i=Math.max(0,r.rest.length-1);function a(f,p){return p<s?n[p]:p>=f?o[p-f+1]:o[0]}let c=f=>{let{input:p,len:m,options:h}=f;if(r.rest.length===0&&m>s)for(let x=s;x<m;x++){let g=new Fu(r,p[x],h),y=new At([x],g);if(h.errors==="all")f.issues?f.issues.push(y):f.issues=[y];else return D(new Ft(r,[y],p,h))}return f.issues?D(new Ft(r,f.issues,p,h)):Dr(f.output)},u=(f,p)=>{let m=f.length,h={ast:r,getParser:a,input:f,len:m,tailThreshold:Math.max(s,m-i),output:new globalThis.Array(m),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(m,s+i),g=p.concurrency===void 0?1:wp(p.concurrency),y=g===1?hQ(h,f,0,x):xQ(h,f,{concurrency:g,end:x});if(!y)return c(h);if(Xe(y))return ur(y,()=>c(h));let E=!0;return L(()=>E?(E=!1,A(y,()=>c(h))):u(f,p))};return(f,p)=>{if(f===ve)return no;try{return Array.isArray(f)?(n||(n=r.elements.map(m=>({ast:m,parser:t(m)})),o=r.rest.map(m=>({ast:m,parser:t(m)}))),u(f,p)):D(new at(r,f,p))}catch(m){return gn(m)}}}_rebuild(e,t,r){let n=Du(this.elements,e),o=Du(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new Xo(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function mQ(e,t,r,n){if(r._tag==="Failure")return Zy(e,e.ast,n,r);let o=r===nt?t:r[Se];if(o!==ve)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Lr(s.ast))return;let i=new At([n],new Yt(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return Jn(new Ft(e.ast,[i],e.input,e.options))}}var P2={onItem(e,t,r){let n=r<e.len?t:ve;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:mQ},hQ=kg()(P2),xQ=Rg()(P2),Zy=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=ym(n.cause);if(o===void 0)return ir(Ka(n.cause,i=>new Ft(t,[new At([r],i)],e.input,e.options)));let s=new At([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Jn(new Ft(t,[s],e.input,e.options))},Yy="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function _i(e,t,r=nn){let n,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter(a=>i.matchPart(a,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter(a=>i.matchKey(a,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(a=>Object.prototype.propertyIsEnumerable.call(e,a)&&i.matchKey(a,r)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(Lv(Bn(t)))}var kv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function M2(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(M2);default:return!1}}function F2(e){let t=Hl(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(F2);default:return!1}}function gQ(e){return M2(e)&&F2(e)}var Rv=class{parameter;type;constructor(e,t){if(!gQ(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Lr(t)&&!Y2(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Im=class extends Gt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return Ns(r,mx);let s,i,a=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),i=o?r.indexSignatures.map(p=>({is:p,parserKey:e(Lv(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(y=>typeof y.name=="number"?globalThis.String(y.name):y.name)),m=(y,E,b,v,T)=>{if(T._tag==="Failure")return Zy(y,r,E,T)??Kt;let S=T===nt?v:T[Se];if(b!==ve&&S!==ve){if(n&&(p.has(E)||p.has(typeof b=="number"?globalThis.String(b):b)))return Kt;B(y.out,b,S)}return Kt},h=(y,E,b,v)=>{if(!v){let k=b.parserKey(E,y.options);if(!Xe(k))return A(eo(k),C=>h(y,E,b,C));v=k}if(v._tag==="Failure")return Zy(y,r,E,v)??Kt;let T=v===nt?E:v[Se],S=y.input[E],w=b.parserValue(S,y.options);return Xe(w)?m(y,E,T,S,w):A(eo(w),k=>m(y,E,T,S,k))},x=(y,E,b)=>{let v=y.input[E],T=b.parserValue(v,y.options);return Xe(T)?m(y,E,E,v,T):A(eo(T),S=>m(y,E,E,v,S))},g=o?Rg()({onItem:(y,[E,b])=>b.is.parameter===Ro?x(y,E,b):h(y,E,b),step:(y,E,b)=>b._tag==="Failure"?b:void 0}):void 0;return aw(function*(y,E){if(y===ve)return ve;if(!(typeof y=="object"&&y!==null&&!Array.isArray(y)))return yield*D(new at(r,y,E));a();let b=y,v={},T={ast:r,input:b,out:v,issues:void 0,options:E},S=E.errors==="all",w=E.onExcessProperty==="error",k=E.concurrency===void 0?1:wp(E.concurrency),C=o&&w?r.indexSignatures.map(R=>_i(b,R.parameter,E)):void 0;if(w){let R=C?new Set(p):p;if(C)for(let $ of C)for(let te of $)R.add(te);let M=Reflect.ownKeys(b);for(let $=0;$<M.length;$++){let te=M[$];if(!R.has(te)&&Object.prototype.propertyIsEnumerable.call(b,te)){let xe=new Fu(r,b[te],E),Le=new At([te],xe);if(S){T.issues?T.issues.push(Le):T.issues=[Le];continue}else return yield*D(new Ft(r,[Le],y,E))}}}if(n){let R=k===1?p2(T,s):yQ(T,s,{concurrency:k});R&&(yield*R)}if(o&&k===1)for(let R=0;R<o;R++){let M=i[R],$=M.is.parameter===Ro?x:h,te=C?.[R]??(M.is.parameter===Ro?Object.keys(b):_i(b,M.is.parameter,E));for(let xe=0;xe<te.length;xe++){let Le=$(T,te[xe],M);if(!Xe(Le))yield*Le;else if(Le._tag==="Failure")return yield*Le}}else if(g){let R=Qt();for(let $=0;$<o;$++){let te=i[$],xe=C?.[$]??(te.is.parameter===Ro?Object.keys(b):_i(b,te.is.parameter,E));for(let Le=0;Le<xe.length;Le++)R.push([xe[Le],te])}let M=g(T,R,{concurrency:k});M&&(yield*M)}return T.issues?yield*D(new Ft(r,T.issues,y,E)):v})};if(o)return c();let u,f=(p,m,h)=>{let x=s[m];return A(eo(h),g=>{let y=gv(p,x,g);if(y)return y;let E=()=>Dr(p.out),b=p2(p,s.slice(m+1));return b?ur(b,E):E()})};return(p,m)=>{if(p===ve)return no;if(m.errors==="all"||m.onExcessProperty!==void 0||m.concurrency!==void 0&&wp(m.concurrency)!==1)return(u??=c())(p,m);if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return D(new at(r,p,m));let h=a(),x=p,g={},y={ast:r,input:x,out:g,issues:void 0,options:m};try{for(let E=0;E<h.length;E++){let b=h[E],v=b.name,T=Dl(x,v),S=T?x[v]:ve,w=b.parser(S,m);if(!Xe(w))return f(y,E,w);if(w===nt){T&&B(g,v,S);continue}let k=gv(y,b,w);if(k)return k}}catch(E){return gn(E)}return Dr(g)}}_rebuild(e,t,r,n){let o=Du(this.propertySignatures,i=>{let a=e(i.type);return a===i.type?i:new kv(i.name,a)}),s=Du(this.indexSignatures,i=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new Rv(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Im(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function gv(e,t,r){if(r._tag==="Failure")return Zy(e,e.ast,t.name,r);if(r===nt)return;let n=r[Se];if(n!==ve){B(e.out,t.name,n);return}if(delete e.out[t.name],!Lr(t.type)){let o=new At([t.name],new Yt(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Jn(new Ft(e.ast,[o],e.input,e.options))}}var N2={onItem(e,t){if(!Dl(e.input,t.name))return t.parser(ve,e.options);let r=e.input[t.name];return B(e.out,t.name,r),t.parser(r,e.options)},step:gv},p2=kg()(N2),yQ=Rg()(N2);function Ov(e,t){return e?t?[...e,...t]:e:t}function Xy(e,t,r){return new Im(Reflect.ownKeys(e).map(n=>new kv(n,e[n].ast)),[],r,t)}function Tm(e){return e.ast}function _v(e,t=void 0){return new Xo(!1,e.map(r=>r.ast),[],void 0,t)}function eS(e,t,r){return new Sn(e.map(Tm),t,void 0,r)}function U2(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let i of s.propertySignatures)if(r.some(a=>a.name===i.name))throw new Error(`Duplicate identifier: ${JSON.stringify(i.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=Ov(o,s.checks)}return new Im(r,n,void 0,o)}function D2(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Xo(e.isMutable,e.elements,t,void 0,e.checks)}function L2(e){if(e.encoding)throw new Error("mutable does not support encodings");return new Xo(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var Pv=$c(e=>{for(;;){if(b2(e))return pa;let t=e.encoding;if(!t)return e.recur?.(Pv,F)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==F))return pa;e=t[t.length-1].to}});function B2(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(B2)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function ac(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[lm];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Lr(r)){if(Ll(r))return[{key:t.name,literal:r.literal}];if(mv(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Lr(t)){if(Ll(t))return[{key:r,literal:t.literal}];if(mv(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>ac(Pv(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return ac(e.thunk())}}var m2=new WeakMap,Jy=Object.freeze([]),h2=e=>e===null?"null":Array.isArray(e)?"array":typeof e,Dl=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function wm(e){let t=m2.get(e);if(t)return t;let r,n=0,o,s,i=!0,a=[];for(let f=0;f<e.length;f++){let p=e[f],m=Pv(p);if(eQ(m))continue;if(Ll(m)||mv(m)){s??=new Map;let x=Ll(m)?m.literal:m.symbol;a[f]=x;let g=s.get(x);g||s.set(x,g=[]),g.push(f)}else i=!1;let h=ac(m);if(h.length){r??=new Map,n++;for(let{key:x,literal:g}of h){let y=r.get(x);y||r.set(x,y=[new Map,new Set]),y[1].add(f);let E=y[0].get(g);E||y[0].set(g,E=new Set),E.add(f)}}else{o??={};let x=B2(m);for(let g of x)(o[g]??=[]).push(f)}}let c={},u=f=>c[f]??=Object.freeze(o?.[f]??Jy);if(i&&s)s.forEach(Object.freeze),t=f=>s.get(f)??Jy;else if(r?.size===1&&!o){let[f,[p]]=r.entries().next().value,m=new Map;for(let[x,g]of p)m.set(x,Object.freeze(Array.from(g)));let h=Object.freeze(e.map((x,g)=>g));t=(x,g)=>{if($d(x)){let y=Dl(x,f)?x[f]:void 0;if(y!==void 0)return m.get(y)??Jy;if(g)return h}return Jy}}else if(r){let f;for(let p of r)(!f||p[1][0].size>f[1][0].size)&&p[1][1].size===n&&(f=p);t=(p,m)=>{let h=h2(p);if(!$d(p))return u(h);let x=new Set(o?.[h]),g;if(f){let[y,[E]]=f,b=Dl(p,y),v=b?p[y]:void 0;if(b&&(!m||v!==void 0)){let T=E.get(v);if(!T)return u(h);for(let S of T)x.add(S);g=y}}if(g===void 0)for(let[y,[E,b]]of r){let v=Dl(p,y),T=v?p[y]:void 0;if(v&&(!m||T!==void 0)){let S=E.get(T);if(S)for(let w of S)x.add(w)}else if(m)for(let S of b)x.add(S)}for(let[y,[E,b]]of r){if(y===g)continue;let v=Dl(p,y),T=v?p[y]:void 0;if(v&&(!m||T!==void 0)){let S=E.get(T);for(let w of x)b.has(w)&&!S?.has(w)&&x.delete(w)}}return Array.from(x).sort((y,E)=>y-E)}}else t=f=>{let p=u(h2(f));return s?p.filter(m=>a[m]===void 0||a[m]===f):p};return m2.set(e,t),t}var Sn=class extends Gt{_tag="Union";types;options;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=i}getParser(e,t){let r=this,n=t!==void 0,o=[],s=a=>o[a]??=e(r.types[a]),i;return(a,c)=>{if(a===ve)return no;let u=(i??=wm(r.types))(a,n);if(u.length===0)return D(new gm(r,[],a,c));if(u.length===1){let f=s(u[0])(a,c);return f._tag==="Success"?f:Xe(f)?$2(r,f.cause,a,c):SQ(r,f,a,c)}return j2(r,s,u,a,c)}}_rebuild(e,t,r){let n=Du(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Sn(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let r=this.types.map(n=>{let o=Bn(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(Ll);if(s.length>0)return`${g2(o.isMutable)}[ ${s.map(i=>e(i)+y2(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(i=>Ll(i.type));if(s.length>0)return`{ ${s.map(i=>`${g2(i.type.context?.isMutable)}${ni(i.name)}${y2(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function $2(e,t,r,n){let o=ym(t);return o?Jn(new gm(e,[o],r,n)):ir(t)}function SQ(e,t,r,n){return rt(t,o=>$2(e,o,r,n))}function j2(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},i=bQ(s,r);if(!i)return s.out?s.out:D(new gm(e,s.issues??[],n,o));if(Xe(i))return x2(i,s);let a=!0;return L(()=>a?(a=!1,x2(i,s)):j2(e,t,r,n,o))}function x2(e,t){return ur(e,r=>t.out===nt?I(t.input):t.out?t.out:D(new gm(t.ast,t.issues??[],t.input,t.options)))}var bQ=kg()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=ym(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Jn(new m1(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return Kt}}}),H2=new Sn([new Ln("Infinity"),new Ln("-Infinity"),new Ln("NaN")]);function g2(e){return e?"":"readonly "}function y2(e){return e?"?":""}var Mv=class extends Gt{_tag="Suspend";thunk;constructor(e,t,r,n,o){if(r)throw new Error("Cannot add checks to Suspend");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new Mv(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Qy=class extends Ra{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new Qy(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Qy(this.run,this.annotations,!0)}and(e,t){return new Uu([this,e],t)}},Uu=class extends Ra{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Uu(this.checks,{...this.annotations,...e})}and(e,t){return new Uu([this,e],t)}};function tS(e,t,r=!1){return new Qy((n,o,s)=>x1(o,e(n,o,s),n,s),t,r)}function rS(e,t){return new Qy((r,n,o)=>e(r)?void 0:new le(void 0,r,o),t,!0)}function Fv(e){return tS(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}var Nv=Pi(Av,[Fv()]),EQ=new jt(new Sn([Nv,H2]),new et(Hy(),Ie(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function vm(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return tS(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:"effect/schema/isPattern",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var yv=new WeakMap;function Cm(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&yv.set(r,jl(e)),r}function jl(e){let t=yv.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return yv.set(e,r),r}function lt(e,t){return e.encoding===t?e:Cm(e,{encoding:t})}function Lu(e,t){if(e.context===t)return e;let r=jl(e);return r.context===t&&r.encoding===e.encoding?r:Cm(e,{context:t})}function Hl(e){return e.encoding?Hl(e.encoding[e.encoding.length-1].to):e}function Fs(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return q2(e,Bx(e.checks.slice(0,-1),r.annotate(t)))}return Cm(e,{annotations:{...e.annotations,...t}})}function q2(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Cm(e,{checks:t})}function Pi(e,t){return q2(e,Ov(e.checks,t))}function fc(e,t){let r=t(e.to);return r===e.to?e:new jt(r,e.transformation)}function z2(e,t){let r=e,n=r[r.length-1],o=fc(n,t);return o===n?e:Bx(e.slice(0,e.length-1),o)}function nS(e){return t=>t.encoding?lt(t,z2(t.encoding,e)):t}function ql(e,t){return nS(r=>Lu(r,t))(e)}function ma(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:lt(n,z2(n.encoding,r))}return e(n)}return $c(r)}function W2(e,t){return Uv(e,t,Nt(e))}function K2(e,t){return Uv(Bn(e),t,e)}function Uv(e,t,r){let n=new jt(e,t);return lt(r,r.encoding?[...r.encoding,n]:[n])}function Du(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let i=0;i<n;i++)r[i]=e[i];r[n]=s}}return r??e}function zl(e,t){let r=e.context?new Yo(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Yo(!1,!1,void 0,t);return Lu(e,r)}var Bu=$c(e=>{let t=e.context?e.context.isOptional===!1?new Yo(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Yo(!0,!1);return IQ(Lu(e,t))}),IQ=nS(Bu),V2=mo(e=>Bu(new Sn([e,wv]))),Dv=$c(e=>{let t=e.context?e.context.isMutable===!1?new Yo(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Yo(!1,!0);return TQ(Lu(e,t))}),TQ=nS(Dv);function G2(e,t){let r=e.context?new Yo(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Yo(!1,!1,t);return Lu(e,r)}function Wl(e,t,r){return Uv(e,r,t)}function wQ(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":px(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function J2(e,t){let{literals:r,parameters:n}=wQ(e);return new Im(r.map(o=>new kv(o,t)),n.map(o=>new Rv(o,t)))}function Lr(e){return e.context?.isOptional??!1}function Z2(e){return e.context?.isMutable??!1}function Q2(e){return e.annotations?.[ro]===!0||e._tag==="FilterGroup"&&e.checks.every(Q2)}function vQ(e){function t(n){return Q2(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Gr(r)?r:void 0}function CQ(e){let t=!0;function r(n){return t=t&&!n.encoding&&!b2(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var Nt=$c(e=>{let t=jl(e);if(t!==e){let n=Nt(t);return n===t&&e.encoding===void 0?e:Lu(n,e.context)}let r="recur"in e?e.recur(Nt):e;if("encodingChecks"in r&&r.encodingChecks){let n=CQ(e)?r.encodingChecks:Iv(r)||tQ(r)||$l(r)&&r.typeParameters.length>0?vQ(r.encodingChecks):void 0;return Cm(r,{encodingChecks:void 0,checks:Ov(r.checks,n)})}return r}),Bn=$c(e=>Nt(Oo(e)));function AQ(e,t){let r=t,n=r.length,o=r[n-1],s=[new jt(Oo(lt(e,void 0)),r[0].transformation.flip())];for(let a=1;a<n;a++)s.unshift(new jt(Oo(r[a-1].to),r[a].transformation.flip()));let i=Oo(o.to);return i.encoding?lt(i,[...i.encoding,...s]):lt(i,s)}var Oo=mo(e=>{if(e.encoding)return AQ(e,e.encoding);let t=jl(e);if(t!==e){let r=Oo(t);return r===t?e:Lu(r,e.context)}return"flip"in e?e.flip(Oo):"recur"in e?e.recur(Oo):e});function Y2(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Y2);default:return!1}}function oS(e,t){let r=t===0?nt:Dr(t);return(n,o)=>n===ve?no:n===t?r:D(new at(e,n,o))}function Ns(e,t){return(r,n)=>r===ve?no:t(r)?nt:D(new at(e,r,n))}function X2(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let i=new Array(n.length),a;function c(u,f){if(u===n.length)return f===s;if(a?.has(u*(s+1)+f))return!1;let p=n[u];if(u===n.length-1){let m=t.slice(f);if(p.matchPart(m,r)!==void 0)return i[u]=m,!0}else if(p._tag==="Literal"){let m=o[u];if(t.startsWith(m,f)&&c(u+1,f+m.length))return i[u]=m,!0}else{let m=s-e.suffixLengths[u+1],h=o[u+1],x=h===void 0?m:t.lastIndexOf(h,m);for(;x>=f;){let g=t.slice(f,x);if(p.matchPart(g,r)!==void 0&&c(u+1,x))return i[u]=g,!0;if(x===0)break;x=h===void 0?x-1:t.lastIndexOf(h,x-1)}}return a??=new Set,a.add(u*(s+1)+f),!1}return c(0,0)?i:void 0}var Lv=ma(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Lv)}}),sS=ma(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(sS)}}),Bv=ma(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(Bv)}}),eL="[\\s\\S]*?",Sv=new globalThis.RegExp(`^${Yy}$`),kQ=new globalThis.RegExp(`^(?:${Yy}|Infinity|-Infinity|NaN)$`);function $v(e){return vm(Sv,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Sv.source}),...e})}var tL=Pi(Ro,[$v()]),RQ=new jt(tL,Nl),OQ=new jt(new Sn([tL,H2]),Nl),_Q="-?\\d+",bv=new globalThis.RegExp(`^${_Q}$`);function jv(e){return vm(bv,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:bv.source}),...e})}var Hv=Pi(Ro,[jv({expected:"a string representing a bigint"})]),PQ=new jt(Hv,Gy),MQ="Symbol\\(([\\s\\S]*)\\)",Ev=new globalThis.RegExp(`^${MQ}$`),FQ=Pi(Ro,[qv()]),rL=new jt(FQ,new et(Ie(e=>globalThis.Symbol.for(Ev.exec(e)[1])),rn((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?I(globalThis.String(e)):D(new xm({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function qv(e){return vm(Ev,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:Ev.source}),...e})}function Us(e,t,r,n,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(r=Us(i.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let a=i.run(t,n,o);if(a){let c=new d1(i,a,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||i.aborted)return r}}}return r}function nL(e,t){let r=Us(e,t,void 0,pa,{errors:"all"});if(r){let n=new Ft(pa,r);return re(n)}return X(t)}function oL(e){if(!$l(e))return;let t=e.annotations?.[Ly];return or(t)?t(e.typeParameters):void 0}function NQ(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function UQ(e){return e===void 0||typeof e=="string"}function sL(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}r.set(o,!1),n.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function Kl(e){return sL(e,NQ)}var Bl=new uc([],()=>(e,t,r)=>Kl(e)?nt:D(new at(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>Wv}),iL=Fs(Bl,{representation:{id:"effect/schema/MutableJson",payload:null}}),zv=new jt(Bl,Fl()),aL=new jt(new Sn([new Xo(!1,[],[Bl]),new Im([],[new Rv(Ro,Bl)])]),Fl());function DQ(e){return sL(e,UQ)}var LQ=new uc([],()=>(e,t,r)=>DQ(e)?nt:D(new at(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),Wv=new jt(LQ,Fl());var iS=(e,t,r)=>e===nt?r(t):ur(e,r);function uL(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===nt?e.decode(Dr(pm(n)),o):e.decode(bu(r,pm),o);return cL(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===nt?Dr(n):r;case"Transform":{let r=n=>n===ve?no:Dr(t.transform(n));return(n,o)=>iS(n,o,r)}case"TransformOptional":{let r=n=>Xw(t.transform(pm(n)));return(n,o)=>iS(n,o,r)}case"TransformEffect":return(r,n,o)=>iS(r,n,s=>s===ve?no:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>iS(r,n,s=>cL(t.transform(pm(s),o)))}}var cL=e=>ur(e,Xw),fL=(e,t,r,n)=>rt(n,o=>aa(()=>Ka(o,s=>new p1(e,s,t,r))));function BQ(e,t){let r=uL(e.link.transformation),n;return(o,s)=>{if(o===ve)return no;if(e.isConstructed(o))return nt;let i=(n??=t(e.link.to))(o,s);return r(i,o,s)}}function $Q(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==ve&&n!==void 0)return t(n,o);let s=r;if(Xe(s)&&s._tag==="Success"){let i=t(s[Se],o);return i===nt?s:i}return ur(fL(e,n,o,s),i=>{let a=t(i,o);return a===nt?Dr(i):a})}}function Kv(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:$Q(e,r)}function Am(e,t,r,n,o){if(e._tag==="Declaration")for(let x of e.typeParameters)t(x);let s=r?oL(e):void 0,i=s?BQ(s,t):n??e.getParser(t,r),a=e.checks,c=e.encoding,u=c?.map(x=>uL(x.transformation)),f=e.encodingChecks;if(!c&&!a&&!f)return i;let p,m=(x,g)=>{let y=i(x,g);if(f&&!g.disableChecks)if(Xe(y)){if(y._tag==="Success"){let E=y===nt?x:y[Se];if(x!==ve&&E!==ve){let b=Us(f,x,void 0,e,g);b&&(y=D(new Ft(e,b,x,g)))}}}else y=A(y,E=>{if(x!==ve&&E!==ve){let b=Us(f,x,void 0,e,g);if(b)return D(new Ft(e,b,x,g))}return I(E)});if(a&&!g.disableChecks)if(Xe(y)){if(y._tag==="Success"){let E=y===nt?x:y[Se];if(E===ve)return y;let b=Us(a,E,void 0,e,g);b&&(y=D(new Ft(e,b,E,g)))}}else y=A(y,E=>{if(E!==ve){let b=Us(a,E,void 0,e,g);if(b)return D(new Ft(e,b,E,g))}return I(E)});return y},h=o===void 0?m:o(m);return c?(x,g)=>{let y=p??=c.map(v=>t(v.to)),E=x,b=y[y.length-1](x,g);for(let v=c.length-1;v>=0;v--)if(b=u[v](b,E,g),v!==0){let T=y[v-1];b._tag==="Success"?(E=b[Se],b=T(E,g)):b=ur(b,S=>{let w=T(S,g);return w===nt?Dr(S):w})}if(b._tag==="Success"){let v=b[Se],T=h(v,g);return T===nt?b:T}return b=fL(e,x,g,b),ur(b,v=>{let T=h(v,g);return T===nt?Dr(v):T})}:h}var uS=Symbol(),lL=new WeakMap,dL,Vl=!1;var HQ=e=>Vl?cS(Po,e,"parser"):Po(e).parser,pL=e=>Vl?cS(Po,e,"makeEffect"):Po(e).makeEffect,qQ=e=>Kv(e,pL),aS=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=Am(this.ast,HQ)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Am(this.ast,pL,qQ)}},Vv=class extends aS{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r=="function"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??Am(this.ast,t=>cS(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",zQ(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>cS(this.resolve,n,"makeEffect");return this.save("makeEffect",Am(this.ast,r,n=>Kv(n,r)))}};function zQ(e,t){let r;return(n,o)=>{if(n!==ve)try{let s=e(n,o);if(s!==uS)return s===n?nt:Dr(s)}catch(s){return gn(s)}return(r??=t())(n,o)}}function cS(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,i)=>(o??=n[r])(s,i)}function Po(e){let t=lL.get(e);if(t!==void 0)return t;let r=dL===void 0?new aS(e):new Vv(e,dL(e,Po),Po);return lL.set(e,r),r}function Jv(e){let t=e.ast,r;return(n,o)=>(r??=rC(XQ,Nt(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function lS(e){let t=Jv(e);return(r,n)=>{let o=ki(t(r,n));return ft(o)?N(o.value):(ko(o.cause,"Option adapter can only return none for schema issues"),_())}}function dS(e){return QQ(Nt(e.ast))}function Zv(e){return km(e.ast)}function KQ(e){if(!Vl){let o=Gl(hS(e));return s=>{let i=o(s,nn);return ft(i)?!0:(ko(i.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=Po(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,nn)}catch(s){return ko(al(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=ki(tC(n(o,nn),o));return ft(s)?!0:(ko(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function km(e){let t=Nt(e),r=n=>(r=KQ(t),r(n));return n=>r(n)}function mL(e){let t=hS(e);return(r,n)=>{let o=ki(t(r,n));if(!ft(o))return ko(o.cause,"Issue adapter can only return schema issues")}}function hL(e,t){let r=Nt(e.ast),n=Po(r).parser(t,nn),o=ki(tC(n,t));if(vs(o)){let s=ko(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function ot(e,t){let r=hS(e.ast);return t===void 0?r:(n,o)=>r(n,eC(t,o))}var Qv=ot;function xL(e,t){return Gl(ot(e,t))}function Yv(e,t){return TL(ot(e,t))}var gL=Yv;function yL(e,t){return wL(ot(e,t))}function VQ(e,t){return Vl?vL(e.ast,t):nC(ot(e,t))}var pS=VQ;function $u(e,t){let r=hS(Oo(e.ast));return t===void 0?r:(n,o)=>r(n,eC(t,o))}var SL=$u;function bL(e,t){return Gl($u(e,t))}function Xv(e,t){return TL($u(e,t))}var EL=Xv;function IL(e,t){return wL($u(e,t))}function GQ(e,t){return Vl?vL(Oo(e.ast),t):nC($u(e,t))}var mS=GQ,eC=(e,t)=>t?{...e,...t}:e,fS=e=>e===ve?D(new le):I(e);function hS(e){return rC(YQ,e)}function tC(e,t){return e===nt?I(t):Xe(e)?e[Se]===ve?fS(ve):e:ur(e,fS)}function rC(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??nn);return s===nt?I(n):Xe(s)?s[Se]===ve?fS(ve):s:ur(s,fS)}}function Gl(e){return(t,r)=>ki(e(t,r))}function TL(e){let t=Gl(e);return(r,n)=>{let o=t(r,n);return ft(o)?N(o.value):(ko(o.cause,"Option adapter can only return none for schema issues"),_())}}function wL(e){let t=Gl(e);return(r,n)=>{let o=t(r,n);return ft(o)?X(o.value):re(ko(o.cause,"Result adapter can only return schema issues"))}}function vL(e,t){let r;return(n,o)=>(r??=JQ(Po(e),t))(n,o)}function JQ(e,t){let r=e.decode,n,o=r===void 0?(s,i=nn)=>(n??=Gv(e))(s,i):(s,i=nn)=>{if(s===ve)return(n??=Gv(e))(s,i);let a;try{a=r(s,i)}catch(c){throw ko(al(c),"Sync adapter can only throw schema issues"),c}return a!==uS?a:(n??=Gv(e))(s,i)};return t===void 0?o:(s,i)=>o(s,eC(t,i))}function Gv(e){return nC(rC(()=>e.decodeEffect,e.ast))}function nC(e){let t=Gl(e);return(r,n)=>{let o=t(r,n);if(ft(o))return o.value;let s=ko(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function ZQ(e,t){let r=ki(e);if(ft(r))return r.value;let n=ko(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function QQ(e){let t,r;return(n,o)=>{t??=Po(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??nn,i=t.make;if(i!==void 0&&n!==ve){let c;try{c=i(n,s)}catch(u){throw ko(al(u),"Constructor adapter can only throw schema issues"),u}if(c!==uS&&c!==ve)return c}let a=(r??=t.makeEffect)(n,s);return ZQ(tC(a,n),"Constructor adapter can only throw schema issues")}}var YQ=e=>Po(e).parser,XQ=e=>Po(e).makeEffect;var xS="~effect/Schema/Schema",CL=Symbol(),e9={[xS]:xS,get make(){let e=dS(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Jv(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=lS(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return V(this,arguments)},annotate(e){return this.rebuild(Fs(this.ast,e))},annotateKey(e){return this.rebuild(zl(this.ast,e))},check(...e){return this.rebuild(Pi(this.ast,e))},rebuild(e){return Ls(e,this[CL])}};function Ls(e,t){function r(){}let n=Object.setPrototypeOf(r,e9);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[CL]=t,n.ast=e,n}function oC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Rm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function sC(e){return encodeURI(oC(e)).replace(/#/g,"%23")}function iC(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let r=decodeURIComponent(t);return r.startsWith("/")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function kL(e){let t=iC(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Rm)}function RL(e){return e.reduce((t,r)=>`${t}/${sC(r)}`,"#")}var r9="http://json-schema.org/draft-07/schema#",OL="https://json-schema.org/draft/2020-12/schema";function _L(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function FL(e){return{dialect:"draft-07",...a9(e,g9)}}function n9(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Jt(n))return n;let i=o||!s&&DL(n.$id),a={};for(let c of Object.keys(n)){let u=n[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=cC(u,p=>r(p,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(p=>r(p,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":f=r(u,i)}B(a,c,f)}return t(a,i),a}}function NL(e,t){return n9(e,r=>{o9(r,t)})}function o9(e,t){typeof e.$ref=="string"&&B(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&B(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function cC(e,t){if(!Jt(e))return;let r={};for(let n of Object.keys(e))B(r,n,t(e[n],n));return r}function s9(e,t,r){let n=new Map,o=[],s=aC;function i(m,h=[],x=[]){if(h.length===0&&t?.trackIds){let g=Jt(m)?f(m):void 0;s=PL(g,aC)??aC}return u(m,h,x,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[m,h,x]of o){let g=h,y=UL(h,x);if(y!==void 0){let E=kL(y.hash);if(y.hash="",E!==void 0){let b=n.get(ML(y.href,E));b!==void 0&&(g=i9(h,b))}}B(m,"$ref",g)}}let c=r(i);return a(),c;function u(m,h,x,g){if(typeof m=="boolean")return p(h,x,g),t?.booleanAdapter?.(m)??m;if(!Jt(m))return m;let y=g,E=f(m);if(h.length>0&&t?.trackIds&&DL(E)){let T=PL(E,g.uri);T!==void 0&&(y={parent:g,sourceRoot:h,targetRoot:x,uri:T})}p(h,x,y);let b=y.uri,v={isDocumentRoot:h.length===0,schema(T,S,w=S){return u(T,[...h,S],[...x,w],y)},schemaAt(T,S,w){return u(T,[...h,...S],[...x,...w],y)},schemaArray(T,S,w=S){return Array.isArray(T)?T.map((k,C)=>u(k,[...h,S,String(C)],[...x,w,String(C)],y)):T},schemaMap(T,S,w=S){return Jt(T)?cC(T,(k,C)=>u(k,[...h,S,C],[...x,w,C],y)):T},reference(T,S){typeof S=="string"?o.push([T,S,b]):B(T,"$ref",S)}};return e(m,v)}function f(m){return t?.ignoreRefSiblings===!0&&typeof m.$ref=="string"?void 0:m.$id}function p(m,h,x){x.parent!==void 0&&p(m,h,x.parent),n.set(ML(x.uri,m.slice(x.sourceRoot.length)),h.slice(x.targetRoot.length))}}var aC="https://effect.invalid/.json-schema/";function UL(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function PL(e,t){if(typeof e!="string")return;let r=UL(e,t);if(r!==void 0)return r.hash="",r.href}function i9(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${RL(t)}`}function ML(e,t){return`${e}\0${JSON.stringify(t)}`}function DL(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function a9(e,t,r){return s9(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:cC(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var c9=new Set(["properties","patternProperties"]),u9=new Set(["allOf","anyOf","oneOf"]),f9=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function l9(e,t,r,n,o,s=c9){let i;if(s.has(t))i=n.schemaMap(r,t);else if(u9.has(t))i=n.schemaArray(r,t);else if(o.has(t))i=n.schema(r,t);else return!1;return B(e,t,i),!0}var LL=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],age=[...LL,"deprecated"],cge=[...LL,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],d9=/^[A-Za-z_][-A-Za-z0-9._]*$/,p9=/^[A-Za-z][-A-Za-z0-9._:]*$/;function ju(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function m9(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&ju(o,r,`it is not active in ${n} but would become active in the target`)}var h9=["additionalItems","definitions","dependencies"];function x9(e,t,r,n,o){r.isDocumentRoot?B(e,"$schema",_L(t,OL)?n:t):_L(t,OL)||ju("$schema",o,"an embedded resource cannot declare a different dialect")}function g9(e,t){m9(e,h9,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let i of Object.keys(e)){let a=e[i];if(!l9(r,i,a,t,f9))switch(i){case"$ref":n=a;break;case"$schema":x9(r,a,t,r9,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":B(r,"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":ju(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;B(r,i,a);break;default:B(r,i,a)}}if(y9(r,o,s,t),Object.hasOwn(e,"contains")){let i=e.minContains,a=e.maxContains;(i!==void 0&&i!==1||a!==void 0)&&ju("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&B(r,"minContains",i)}else Object.hasOwn(e,"minContains")&&B(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&B(r,"maxContains",e.maxContains);return b9(e,r,t,"draft-07"),I9(e,r,"$id","Draft-07"),S9(r,n,t),r}function y9(e,t,r,n){if(t===void 0){r!==void 0&&B(e,"items",n.schema(r,"items"));return}B(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&B(e,"additionalItems",n.schema(r,"items","additionalItems"))}function S9(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),E9(e,n)}else r.reference(e,t)}function b9(e,t,r,n){let o=Jt(e.dependentRequired)?e.dependentRequired:void 0,s=Jt(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],f=s?.[c],p=n==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?p||B(i,c,u):u===void 0||p?B(i,c,r.schemaAt(f,["dependentSchemas",c],["dependencies",c])):B(i,c,{allOf:[r.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(i).length>0&&B(t,"dependencies",i)}function E9(e,t){Array.isArray(e.allOf)?e.allOf.push(t):B(e,"allOf",[t])}function I9(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&B(t,r,o);return}(typeof s!="string"||!d9.test(s))&&ju("$anchor",n,"the anchor is not valid"),p9.test(s)||ju("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?B(t,r,`#${s}`):ju("$anchor",n,"it cannot be combined with the schema $id")}function gS(e){return Ls(Jl(e.ast),{schema:e})}var Jl=ma(e=>{let t=w9(e,Jl),r=e.context;return t===e||r===void 0?t:ql(t,uC(r))});function uC(e){return e.constructorDefault===void 0?e:new Yo(e.isOptional,e.isMutable,void 0,e.annotations)}function jL(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function HL(e){return t=>{let r=[...t].sort((o,s)=>e(Bn(o))-e(Bn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var T9=HL(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function w9(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!or(r))return lt(e,[zv]);let n=e.typeParameters.map(s=>Ls(Bn(s))),o=r(n);return o===void 0?e:lt(e,[fc(o,t)])}case"Unknown":return lt(e,[zv]);case"ObjectKeyword":return lt(e,[aL]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jL(e),e.recur(t,sS);case"Union":{let r=T9(e.types);return r!==e.types?new Sn(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function yS(e){return Ls(qL(Nt(e.ast)))}var qL=mo(e=>{let t=v9(e,qL);return t!==e&&e.context!==void 0?ql(t,uC(e.context)):t});function v9(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(or(r)){let n=r(e.typeParameters.map(o=>Ls(o)));return lt(e,[fc(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function SS(e){return Ls(VL(e.ast),{schema:e})}function zL(e){return Ls(GL(e.ast))}var C9=HL(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function A9(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(u=>Ls(t(Bn(u)))),o=e.annotations?.toCodecStringTree;if(or(o)){let u=o(n);return u===void 0?e:lt(e,[fc(u,t)])}let s=e.annotations?.toCodecJson,i=or(s)?s(n):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(or(a)?a(n):void 0);return c===void 0?r(e):lt(e,[fc(c,t)])}case"Null":return lt(e,[k9]);case"Boolean":return lt(e,[R9]);case"Unknown":case"ObjectKeyword":return lt(e,[Wv]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jL(e),e.recur(t,sS);case"Union":{let n=C9(e.types);return n!==e.types?new Sn(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var k9=new jt(new Ln("null"),new et(Ie(()=>null),Ie(()=>"null"))),R9=new jt(new Sn([new Ln("true"),new Ln("false")]),new et(Ie(e=>e==="true"),Nu())),WL=new et(Ie(e=>typeof e=="string"?[e]:e),Oi()),KL=e=>e.transformation===WL,VL=ma(e=>{let t=A9(e,VL,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?ql(t,uC(e.context)):t},{stopAt:KL}),$L=e=>Lr(e)?Bu(pa):pa,GL=ma(e=>{let t=O9(e);if(Iv(t)){let r=Wl(new Sn([new Xo(t.isMutable,t.elements.map($L),t.rest.map($L)),Ro],{mode:"anyOf"}),t,WL);return Lr(e)?Bu(r):r}return t},{stopAt:KL});function O9(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(GL):e}var fge=globalThis.RegExp;var ha=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function lc(e,t){return t.length>0&&(e+=`
|
|
27
|
-
at ${yx(t)}`),new Error(e)}function JL(e){return`#/$defs/${sC(e)}`}var _9=new Set([...l1,Mu,...f1]);function _m(e,t){if(e===void 0)return;let r={},n=e.title;typeof n=="string"&&(r.title=n);let o=e.description,s=e.expected;typeof o=="string"?r.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(r.description=s);let i=e.default;Kl(i)&&(r.default=i);let a=e.examples;Array.isArray(a)&&Kl(a)&&(r.examples=a);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(r.writeOnly=u);let f=e.format;typeof f=="string"&&(r.format=f);let p=e.contentEncoding;typeof p=="string"&&(r.contentEncoding=p);let m=e.contentMediaType;typeof m=="string"&&(r.contentMediaType=m);let h=e.contentSchema;if(Kl(h)&&(r.contentSchema=h),t?.includeAnnotationKey!==void 0)for(let[x,g]of Object.entries(e))_9.has(x)||!t.includeAnnotationKey(x)||Kl(g)&&B(r,x,g);return Object.keys(r).length===0?void 0:r}function ZL(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let i=ZL(s);i.type!==void 0&&(o=!0,(t===void 0||i.type==="integer")&&(t=i.type)),Object.keys(i.schema).length>0&&n.push(i.schema)}if(o){let{allOf:s,...i}=r;r=n.length===0?i:{...i,allOf:n}}}return{type:t,schema:r}}function P9(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}var QL="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function bS(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function M9(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var F9="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",N9="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function U9(e,t,r){if(typeof e.$ref=="string")return;let n={...e,...t};for(let o of r){if(!Object.hasOwn(e,o))continue;let s=e[o],i=t[o];if(typeof s!="number"||typeof i!="number")return;if(F9.includes(`|${o}|`))n[o]=Math.max(s,i);else if(N9.includes(`|${o}|`))n[o]=Math.min(s,i);else return}return typeof n.minimum=="number"&&typeof n.exclusiveMinimum=="number"&&delete n[n.exclusiveMinimum>=n.minimum?"minimum":"exclusiveMinimum"],typeof n.maximum=="number"&&typeof n.exclusiveMaximum=="number"&&delete n[n.exclusiveMaximum<=n.maximum?"maximum":"exclusiveMaximum"],n}var dC="|title|description|default|examples|readOnly|writeOnly|",D9=QL+dC;function Pm(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=P9(e);if(o!==void 0||s){let a=ZL(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(a.schema);return f.length===0?u:bS(a.schema,dC)&&M9(u,f)?{...u,...a.schema}:Pm(u,a.schema,r)}}if(r){let a=U9(e,t,n);if(a!==void 0)return a}let i=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...i]}:typeof e.$ref=="string"?{allOf:[e,...i]}:{...e,allOf:i}}function lC(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>lC(r,t)))}function L9(e){return Array.isArray(e)}function B9(e,t,r,n){let o=new Map,s=new Map,i=new WeakMap,a=new Map,c=new Map,u=Object.keys(r);for(let S of u)x(S,["references",S]);let f=Bo(e,(S,w)=>b(S,t[w],[]));for(let[S,w]of a.values())if(!lC(S))for(let k of w)Array.isArray(k.oneOf)&&(k.anyOf=k.oneOf,delete k.oneOf);for(let S of u){let w=r[S],k=y(w);if(k===void 0)continue;let C=o.get(S)[0],R=c.get(k),M=R?.find($=>Z(o.get($)[0],C));M===void 0?R===void 0?c.set(k,[S]):R.push(S):s.set(S,M)}let p=Bo(f,g),m={};for(let S of u)s.has(S)||B(m,S,g(o.get(S)[0]));return{dialect:"draft-2020-12",schemas:p,definitions:m};function h(S){return Array.isArray(S.oneOf)&&a.get(S.oneOf)?.[1].push(S),S}function x(S,w){if(!Object.hasOwn(r,S))throw lc(`Invalid reference ${S}`,[...w,"$ref"]);let k=o.get(S);if(k!==void 0)return k;let C=[{},[]];return o.set(S,C),C[0]=b(r[S],["references",S],C[1]),C}function g(S){return NL(S,w=>{let k=iC(w);if(k===void 0){if(/^#(?:\/|%2f)/i.test(w))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(w)}`);return w}if(!k.startsWith("/$defs/"))return w;let C=k.indexOf("/",7),R=s.get(Rm(k.slice(7,C<0?void 0:C)));return R===void 0?w:w.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,JL(R))})}function y(S){if(S._tag==="Reference")return;let w=S.checks.length===0?S.annotations:S.checks[S.checks.length-1].annotations;return typeof w?.identifier!="string"&&typeof w?.[Mu]=="string"?w[Mu]:void 0}function E(S,w,k,C){let R=S.annotations,M=R?.toJsonSchema;if(M!==void 0){let Le=S.representation?.schemas?.map((Rn,nI)=>b(Rn,[...k,"representation","schemas",nI],C))??[],Er=M({type:w,schemas:Le}),Ee=L9(Er);Ee&&C.push(!1);let Oe=Ee?Er[0]:Er,rr=_m(R,n),lo=rr===void 0?Oe:{...Oe,...rr},Xs=rr===void 0?QL:D9;return[lo,S._tag==="Filter"&&bS(lo,Xs)&&(rr===void 0||bS(rr,dC))?!0:void 0]}if(S._tag==="Filter"){C.push(!1);return}let $=S.checks.flatMap((Le,Er)=>{let Ee=E(Le,w,[...k,"checks",Er],C);return Ee===void 0?[]:[Ee[0]]});if($.length===0)return;let te=_m(R,n),xe={allOf:$};return[te===void 0?xe:{...xe,...te}]}function b(S,w,k){if(S._tag==="Reference")return k.push(x(S.$ref,w)[1]),{$ref:JL(S.$ref)};let C=i.get(S);if(C!==void 0)return k.push(C[1]),C[0];let R=[];k.push(R);let M=v(S,w,R),$=_m(S.annotations,n);$!==void 0&&(M={...M,...$});for(let te=0;te<S.checks.length;te++){let xe=typeof M.type=="string"&&$9(M.type)?M.type:void 0,Le=E(S.checks[te],xe,[...w,"checks",te],R);Le!==void 0&&(M=Pm(M,...Le))}return i.set(S,[M,R]),h(M)}function v(S,w,k){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":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(S.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(S.symbol)]};case"Declaration":return k.push(!1),{};case"Suspend":return b(S.thunk,[...w,"thunk"],k);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let C=S.literal;return typeof C=="bigint"?{type:"string",enum:[globalThis.String(C)]}:{type:typeof C,enum:[C]}}case"Enum":{let C=S.enums.map(([R,M],$)=>{if(typeof M=="number"&&!globalThis.Number.isFinite(M))throw lc(`Invalid numeric enum value ${globalThis.String(M)}`,[...w,"enums",$,1]);return{type:typeof M,enum:[M],title:R}});return C.length===0?{not:{}}:{anyOf:C}}case"TemplateLiteral":return{type:"string",pattern:`^${S.parts.map(ES).join("")}$`};case"Arrays":{if(S.rest.length>1)throw lc("Invalid schema representation document",[...w,"rest"]);let C={type:"array"},R=S.elements.length,M=S.elements.map(($,te)=>{$.isOptional&&R--;let xe=b($.type,[...w,"elements",te,"type"],k),Le=_m($.annotations,n);return Le===void 0?xe:h(Pm(xe,Le))});if(M.length>0?(C.prefixItems=M,C.maxItems=S.elements.length,R>0&&(C.minItems=R)):C.items=!1,S.rest.length===1){delete C.maxItems;let $=b(S.rest[0],[...w,"rest",0],k);Object.keys($).length>0?C.items=$:delete C.items}return C}case"Objects":{if(S.propertySignatures.length===0&&S.indexSignatures.length===0)return{not:{type:"null"}};let C={type:"object"},R={},M=[];for(let Ee=0;Ee<S.propertySignatures.length;Ee++){let Oe=S.propertySignatures[Ee];if(typeof Oe.name!="string")throw lc("Invalid schema representation document",[...w,"propertySignatures",Ee,"name"]);let rr=Oe.name,lo=b(Oe.type,[...w,"propertySignatures",Ee,"type"],k),Xs=_m(Oe.annotations,n);B(R,rr,Xs===void 0?lo:h(Pm(lo,Xs))),Oe.isOptional||M.push(rr)}S.propertySignatures.length>0&&(C.properties=R),M.length>0&&(C.required=M);let $={},te=[],xe=[],Le=!1;for(let Ee=0;Ee<S.indexSignatures.length;Ee++){let Oe=S.indexSignatures[Ee],rr=b(Oe.type,[...w,"indexSignatures",Ee,"type"],k);Z(rr,{not:{}})&&(rr=!1),xe.push(rr);let lo=T(Oe.parameter,[...w,"indexSignatures",Ee,"parameter"],new Set);if(lo===void 0){Le=!0,k.push(!1);continue}if(lo.length===0)te.push(rr);else for(let Xs of lo){let Rn=$[Xs];B($,Xs,Rn===void 0?rr:Rn===!1||rr===!1?!1:h(Pm(Rn,rr)))}}let Er=Object.keys($).length>0;if(Er&&(C.patternProperties=$),Le&&n?.onExcessProperty==="error"){let Ee=[];S.propertySignatures.length>0&&Ee.push({enum:Object.keys(R)});for(let Oe=0;Oe<S.indexSignatures.length;Oe++)Ee.push(b(S.indexSignatures[Oe].parameter,[...w,"indexSignatures",Oe,"parameter"],k));C.propertyNames=Ee.length===1?Ee[0]:{anyOf:Ee},C.additionalProperties=xe.length===1?xe[0]:{anyOf:xe},te.length>0&&(C.allOf=te.map(Oe=>({type:"object",additionalProperties:Oe})))}else te.length===0?C.additionalProperties=Le||n?.onExcessProperty!=="error":te.length===1&&S.propertySignatures.length===0&&!Er?C.additionalProperties=te[0]:te.length>0&&(C.allOf=te.map(Ee=>({type:"object",additionalProperties:Ee})));return typeof C.additionalProperties=="object"&&C.additionalProperties!==null&&Object.keys(C.additionalProperties).length===0&&delete C.additionalProperties,C}case"Union":{let C=[],R=S.types.map(($,te)=>b($,[...w,"types",te],C));if(k.push(C),R.length===0)return{not:{}};let M=S.options?.mode??"anyOf";if(M==="anyOf"&&R.length>1){let $=j9(R);if($!==void 0)return $}return M==="oneOf"&&a.set(R,[C,[]]),{[M]:R}}}}function T(S,w,k){switch(S._tag){case"Reference":{if(!Object.hasOwn(r,S.$ref))throw lc(`Invalid reference ${S.$ref}`,[...w,"$ref"]);if(x(S.$ref,w),k.has(S.$ref))return;let C=new Set(k).add(S.$ref);return T(r[S.$ref],["references",S.$ref],C)}case"String":{if(S.checks.length===0)return[];if(S.checks.length!==1||S.checks[0]._tag!=="Filter"||S.checks[0].annotations?.toJsonSchema===void 0)return;let C=[],R=b(S,w,C);return lC(C)&&R.type==="string"&&typeof R.pattern=="string"&&bS(R,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[R.pattern]:void 0}case"TemplateLiteral":return S.checks.length===0?[`^${S.parts.map(ES).join("")}$`]:void 0;case"Union":{if(S.types.length===0||S.checks.length>0||S.options?.mode==="oneOf")return;let C=[];for(let R=0;R<S.types.length;R++){let M=T(S.types[R],[...w,"types",R],k);if(M===void 0)return;if(M.length===0)return[];C.push(...M)}return C}default:throw lc("Invalid schema representation document",w)}}}function $9(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function j9(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function ES(e){switch(e._tag){case"Literal":return ha(globalThis.String(e.literal));case"String":return eL;case"Number":return Yy;case"TemplateLiteral":return e.parts.map(ES).join("");case"Union":return`(?:${e.types.map(ES).join("|")})`;default:throw lc("Invalid schema representation document",[])}}function IS(e,t){let r=B9([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var H9=({identifier:e})=>e;function Bs(e){return e===void 0?void 0:{annotations:e}}function Mm(e,t){let{references:r,representations:n}=q9([e],t);return{representation:n[0],references:r}}function q9(e,t){let r={},n=new Map,o=new Set,s=new Map,i=new Set;for(let S of e)h(S);let a=t?.referencePolicy??H9;for(let S of s.values())for(let w of S.values()){let k=a({ast:w.ast,occurrences:w.occurrences,identifier:w.identifier});if(k!==void 0){let C=k===w.identifier||!k.endsWith("_")?"_":"";w.reference=u(k,w,C)}else w.isRecursive&&(w.reference=u(`${w.ast._tag}_`,w,""))}return{representations:Bo(e,S=>g(S)),references:r};function u(S,w,k="_"){let C=S,R=0;for(;n.has(C);){if(n.get(C)===w)return C;C=`${S}${k}${++R}`}return n.set(C,w),C}function f(S,w,k){let C=w.fallback;return C!==void 0?Qw(S)===C?S:Fs(S,{[Mu]:C}):k===w.identifier?S:Fs(S,{identifier:k})}function p(S,w){if(!Object.hasOwn(r,S)&&!o.has(S)){o.add(S);let k=y(w);o.delete(S),B(r,S,k)}return{_tag:"Reference",$ref:S}}function m(S){let w=Hl(S),k=jl(w),C=Ol(w),R=C===void 0?(w!==S?Ol(S):void 0)??Qw(w):void 0;R!==void 0&&(C=`${R}Encoded`);let M=s.get(k);M===void 0&&(M=new Map,s.set(k,M));let $=M.get(C);return $===void 0&&($={ast:k,identifier:C,fallback:R,occurrences:0,isRecursive:!1,reference:void 0},M.set(C,$)),$}function h(S){let w=m(S),k=w.ast;if(w.occurrences++,i.has(w)){w.isRecursive=!0;return}if(!(w.occurrences>1)){switch(i.add(w),x(k.checks),k._tag){case"Declaration":case"Arrays":case"Objects":case"Union":k.recur(C=>(h(C),C));break;case"TemplateLiteral":k.parts.forEach(h);break;case"Suspend":h(k.thunk());break}i.delete(w)}}function x(S){S?.forEach(w=>{w.annotations?.representation?.schemas?.forEach(k=>h(Nt(k))),w._tag==="FilterGroup"&&x(w.checks)})}function g(S){let w=m(S),k=w.ast,C=w.reference;if(C!==void 0){let R=w.identifier===void 0?k:f(k,w,C);return p(C,R)}return y(k)}function y(S){let w=E(S.checks);switch(S._tag){case"Declaration":return{_tag:"Declaration",typeParameters:S.typeParameters.map(k=>g(k)),checks:w,...v(S.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:S._tag,checks:w,...Bs(S.annotations)};case"Literal":return{_tag:"Literal",literal:S.literal,checks:w,...Bs(S.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:S.symbol,checks:w,...Bs(S.annotations)};case"Enum":return{_tag:"Enum",enums:S.enums,checks:w,...Bs(S.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:S.parts.map(k=>g(k)),checks:w,...Bs(S.annotations)};case"Arrays":return{_tag:"Arrays",elements:S.elements.map(k=>{let C=Hl(k),R=C.context?.annotations;return{isOptional:Lr(C),type:g(k),...Bs(R)}}),rest:S.rest.map(k=>g(k)),checks:w,...Bs(S.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:S.propertySignatures.map(k=>{let C=Hl(k.type),R=C.context?.annotations;return{name:k.name,type:g(k.type),isOptional:Lr(C),isMutable:Z2(C),...Bs(R)}}),indexSignatures:S.indexSignatures.map(k=>({parameter:g(k.parameter),type:g(k.type)})),checks:w,...Bs(S.annotations)};case"Union":return{_tag:"Union",types:S.types.map(k=>g(k)),...S.options===void 0?{}:{options:S.options},checks:w,...Bs(S.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:g(S.thunk()),...Bs(S.annotations)}}}function E(S){return S?.map(b)??[]}function b(S){switch(S._tag){case"Filter":return{_tag:"Filter",aborted:S.aborted,...T(S.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Bo(S.checks,b),...T(S.annotations)}}}function v(S){if(S===void 0)return;let{representation:w,...k}=S;return{...w===void 0?void 0:{representation:w},...Object.keys(k).length===0?void 0:{annotations:k}}}function T(S){if(S===void 0)return;let{representation:w,...k}=S,C=w===void 0?void 0:w.schemas===void 0?w:{...w,schemas:w.schemas.map(R=>g(Nt(R)))};return{...C===void 0?void 0:{representation:C},...Object.keys(k).length===0?void 0:{annotations:k}}}}function eB(e){return ft(e)?e.value:{issues:[{message:SN(e.cause)}]}}function rB(e,t){let r=ot(e),n={errors:"all",...t?.parseOptions},o=S1(t),s=i=>{let a=new fi("sync"),c=Qp(Z0(r(i,n),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?eB(u):new Promise(f=>{c.addObserver(p=>{f(eB(p))})})};if(Object.hasOwn(e,"~standard")){let i=e;return"validate"in i["~standard"]||Object.assign(i["~standard"],{validate:s}),i}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function z9(e){let t=Mm(Jl(e));return IS(t)}function tB(e,t){let r=z9(e);if(t==="draft-2020-12"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t==="draft-07"){let n=FL(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function nB(e){let t={input(r){return tB(e.ast,r.target)},output(r){return tB(Nt(e.ast),r.target)}};if(Object.hasOwn(e,"~standard")){let r=e;return"jsonSchema"in r["~standard"]||Object.assign(r["~standard"],{jsonSchema:t}),r}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function sB(e,t){let r=[];return pC(e,t,"",r),r}function pC(e,t,r,n){if(!Object.is(e,t)){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++)pC(e[a],t[a],`${r}/${a}`,n);for(let a=o-1;a>=s;a--)n.push({op:"remove",path:`${r}/${a}`});for(let a=o;a<s;a++)n.push({op:"add",path:`${r}/${a}`,value:t[a]});return}if(TS(e)&&TS(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=`${r}/${oC(a)}`,u=Object.hasOwn(e,a),f=Object.hasOwn(t,a);u&&f?pC(e[a],t[a],c,n):!u&&f?n.push({op:"add",path:c,value:t[a]}):n.push({op:"remove",path:c})}return}n.push({op:"replace",path:r,value:t})}}function iB(e,t){let r=t;for(let n of e)r=V9(r,n);return r}function TS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K9(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Rm)}function aB(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function V9(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=G9(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=n==="-"?o.length:aB(n),a=t.op==="add"?o.length:o.length-1;if(i>a)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(i,0,t.value):t.op==="remove"?c.splice(i,1):c[i]=t.value,oB(s,c)}if(TS(o)){if(t.op!=="add"&&!Object.hasOwn(o,n))throw new Error(`Property "${n}" does not exist at "${t.path}".`);let i={...o};return t.op==="remove"?delete i[n]:B(i,n,t.value),oB(s,i)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function G9(e,t){let r=K9(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let i=0;i<r.length-1;i++){let a=r[i];if(Array.isArray(s)){let c=aB(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(TS(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:n}}function oB(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let i=o.slice();i[s]=r,r=i}else{let i={...o};B(i,s,r),r=i}}return r}function uB(e){let t=gS(e),r=mS(t),n=pS(t);return{empty:[],diff:(o,s)=>sB(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=r(o),a=iB(s,i);return Object.is(a,i)?o:n(a)}}}function fB(e,t){let r=Ol(e.ast)??Yw(e.ast),n=SL(SS(e));return o=>n(o).pipe(K(s=>Z9(s,{rootName:r,...t})))}function Z9(e,t){let r=t.rootName??"root",n=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return f(r,e,0),c.join(o?`
|
|
28
|
-
`:"");function u(p,m){c.push(o?s.repeat(p)+m:m)}function f(p,m,h,x){let{attrs:g,safe:y}=Zl.tagInfo(p,x);if(m===void 0)u(h,`<${y}${g}/>`);else if(typeof m=="string")u(h,`<${y}${g}>${Zl.escapeText(m)}</${y}>`);else if(typeof m!="object"||m===null)u(h,`<${y}${g}>${Zl.escapeText(H(m))}</${y}>`);else{if(a.has(m))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:m});a.add(m);try{if(globalThis.Array.isArray(m)){if(m.length===0){u(h,`<${y}${g}/>`);return}u(h,`<${y}${g}>`);for(let v of m)f(n,v,h+1);u(h,`</${y}>`);return}let E=m,b=Object.keys(E);if(i&&b.sort(),b.length===0){u(h,`<${y}${g}/>`);return}u(h,`<${y}${g}>`);for(let v of b)f(Zl.parseTagName(v).safe,E[v],h+1,v);u(h,`</${y}>`)}finally{a.delete(m)}}}}var Zl={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r="_"+r),r=r.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(r)&&(r="_"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=Zl.parseTagName(e),s=r||t&&t!==e?` data-name="${Zl.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var mC=mo(e=>dc(e));function dc(e){let t=da(e)?.toEquivalence;if(t)return t($l(e)?e.typeParameters.map(dc):[]);switch(e._tag){case"Never":return Zc();case"Declaration":return Y9(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return Z;case"Arrays":{let r=e.elements.map(dc),n=e.rest.map(dc),[o,...s]=n,i=s.length;return Wr((a,c)=>{if(!Array.isArray(a)||!Array.isArray(c))return!1;let u=a.length;if(u!==c.length)return!1;let f=0;for(;f<Math.min(u,e.elements.length);f++)if(!r[f](a[f],c[f]))return!1;if(n.length>0){for(;f<u-i;f++)if(!o(a[f],c[f]))return!1;for(let p=0;p<i;p++)if(!s[p](a[f+p],c[f+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Z;let r=e.propertySignatures.map(o=>dc(o.type)),n=e.indexSignatures.map(o=>dc(o.type));return Wr((o,s)=>{if(!Jt(o)||!Jt(s))return!1;for(let i=0;i<r.length;i++){let a=e.propertySignatures[i],c=a.name,u=Object.hasOwn(o,c),f=Object.hasOwn(s,c);if(Lr(a.type)&&u!==f||u&&f&&!r[i](o[c],s[c]))return!1}for(let i=0;i<n.length;i++){let a=e.indexSignatures[i],c=_i(o,a.parameter),u=_i(s,a.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let p=c[f];if(!Object.hasOwn(s,p)||!n[i](o[p],s[p]))return!1}}return!0})}case"Union":{let r=Nt(e).types,n=wm(r),o=r.map((s,i)=>[km(s),dc(e.types[i])]);return Wr((s,i)=>{let a=n(s,!1);for(let c=0;c<a.length;c++){let[u,f]=o[a[c]];if(u(s)&&u(i))return f(s,i)}return!1})}case"Suspend":{let r;return Wr((n,o)=>(r??=mC(e.thunk()))(n,o))}}}function Y9(e){let t=e.annotations?.representation;if(t===void 0)return Z;switch(t.id){case"effect/schema/Option":{let[r]=Hu(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Hu(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?r(o.success,s.success):n(o.failure,s.failure))}case"effect/schema/CauseReason":{let[r,n]=Hu(e);return dB(r,n)}case"effect/schema/Cause":{let[r,n]=Hu(e);return lB(r,n)}case"effect/schema/Exit":{let[r,n,o]=Hu(e),s=lB(n,o);return(i,a)=>i._tag===a._tag&&(i._tag==="Success"?r(i.value,a.value):s(i.cause,a.cause))}case"effect/schema/ReadonlyMap":{let[r,n]=Hu(e);return gx(r,n)}case"effect/schema/ReadonlySet":return qd(Hu(e)[0]);case"effect/schema/RegExp":return(r,n)=>r.source===n.source&&r.flags===n.flags;case"effect/schema/URL":return(r,n)=>r.toString()===n.toString();default:return Z}}function Hu(e){return e.typeParameters.map(dc)}function dB(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case"Fail":return e(r.error,n.error);case"Die":return t(r.defect,n.defect);case"Interrupt":return r.fiberId===n.fiberId}}}function lB(e,t){let r=wx(dB(e,t));return(n,o)=>r(n.reasons,o.reasons)}function mB(e,t){return r=>{switch(r._tag){case"Fail":return`Fail(${e(r.error)})`;case"Die":return`Die(${t(r.defect)})`;case"Interrupt":return"Interrupt"}}}function pB(e,t){let r=mB(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function hB(e,t){let r=new Map;return n(e);function n(i){let a=r.get(i);return a===void 0&&(a=o(i),r.set(i,a)),a}function o(i){let a=da(i)?.toFormatter;if(typeof a=="function")return a($l(i)?i.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(i,n);if(c!==void 0)return c}return s(i)}function s(i){switch(i._tag){default:return H;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let a=i.annotations?.representation;if(a===void 0)return H;let c=i.typeParameters.map(n);switch(a.id){case"effect/schema/Option":{let[u]=c;return Zt({onNone:()=>"none()",onSome:f=>`some(${u(f)})`})}case"effect/schema/Result":{let[u,f]=c;return zn({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${f(p)})`})}case"effect/schema/CauseReason":return mB(c[0],c[1]);case"effect/schema/Cause":return pB(c[0],c[1]);case"effect/schema/Exit":{let[u,f,p]=c,m=pB(f,p);return h=>{switch(h._tag){case"Success":return`Exit.Success(${u(h.value)})`;case"Failure":return`Exit.Failure(${m(h.cause)})`}}}case"effect/schema/ReadonlyMap":{let[u,f]=c;return p=>{let m=p.size;if(m===0)return"ReadonlyMap(0) {}";let h=globalThis.Array.from(p.entries()).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`ReadonlyMap(${m}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{let[u,f]=c;return p=>{let m=LD(p);if(m===0)return"HashMap(0) {}";let h=sm(p).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`HashMap(${m}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[u]=c;return f=>{let p=f.size;if(p===0)return"ReadonlySet(0) {}";let m=globalThis.Array.from(f.values()).sort().map(h=>`${u(h)}`);return`ReadonlySet(${p}) { ${m.join(", ")} }`}}case"effect/schema/HashSet":{let[u]=c;return f=>{let p=HD(f);if(p===0)return"HashSet(0) {}";let m=globalThis.Array.from(f).sort().map(h=>`${u(h)}`);return`HashSet(${p}) { ${m.join(", ")} }`}}case"effect/schema/Chunk":{let[u]=c;return f=>{let p=hD(f);if(p===0)return"Chunk(0) {}";let m=globalThis.Array.from(f).sort().map(h=>`${u(h)}`);return`Chunk(${p}) { ${m.join(", ")} }`}}default:return H}}case"Arrays":{let a=i.elements.map(m=>n(m)),c=i.rest.map(n),[u,...f]=c,p=f.length;return m=>{let h=[],x=0;for(;x<a.length;x++)if(m.length<x+1){if(Lr(i.elements[x]))continue}else h.push(a[x](m[x]));if(c.length>0){for(;x<m.length-p;x++)h.push(u(m[x]));for(let g=0;g<p;g++)h.push(f[g](m[x+g]))}return"["+h.join(", ")+"]"}}case"Objects":{let a=i.propertySignatures.map(u=>n(u.type)),c=i.indexSignatures.map(u=>n(u.type));return i.propertySignatures.length===0&&i.indexSignatures.length===0?H:u=>{let f=[],p=new Set;for(let m=0;m<a.length;m++){let h=i.propertySignatures[m],x=h.name;p.add(x),!(Lr(h.type)&&!Object.hasOwn(u,x))&&f.push(`${ni(x)}: ${a[m](u[x])}`)}for(let m=0;m<c.length;m++){let h=_i(u,i.indexSignatures[m].parameter);for(let x of h)p.has(x)||(p.add(x),f.push(`${ni(x)}: ${c[m](u[x])}`))}return f.length>0?"{ "+f.join(", ")+" }":"{}"}}case"Union":{let a=Nt(i).types,c=wm(a),u=a.map((f,p)=>[km(f),n(i.types[p])]);return f=>{let p=c(f,!1);for(let m=0;m<p.length;m++){let[h,x]=u[p[m]];if(h(f))return x(f)}return H(f)}}case"Suspend":{let a;return c=>(a??=n(i.thunk()))(c)}}}}var hC=d(2,(e,t)=>yC(e,(r,n)=>gB(t,r)?[r,n]:void 0)),xC=d(2,(e,t)=>yC(e,(r,n)=>gB(t,r)?void 0:[r,n])),xB=d(2,(e,t)=>({...e,...t}));var gC=d(2,(e,t)=>yC(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var bn=e=>e;function gB(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function yC(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,i]=o;B(r,s,i)}}return r}function bB(e,t){return $s(Ql("Iso",e,t))}function yB(e,t){return $s(Ql("Lens",e,t))}function Ql(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var tY={kind:"Iso",get:F,set:F},wS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=vS(n),s=o,i=0;for(;i<t.length-1;i++){let a=t[i];B(s,a,vS(s[a])),s=s[a]}return B(s,t[i],r),o}}},Fm=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=r=>nL(t,r)}};function qu(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?r[r.length-1]=new wS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new Fm([...s.checks,...o.checks]):r.push(o)}return r}function rY(e,t){return $s(Ql("Optional",e,t))}var Yl=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return ip(this.replaceResult(t,r),()=>r)}modify(t){return r=>ip(hr(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return $s(qu(this.node,t.node))}key(t){return $s(qu(this.node,[new wS([t])]))}optionalKey(t){return $s(qu(this.node,Ql("Lens",r=>r[t],(r,n)=>{let o=vS(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&$x(t))?o.splice(Number(t),1):delete o[t]:B(o,t,r),o})))}check(...t){return $s(qu(this.node,[new Fm(t)]))}refine(t,r){return $s(qu(this.node,[new Fm([rS(t,r)])]))}tag(t){let r=re(new le({expected:`${JSON.stringify(t)} tag`}));return $s(qu(this.node,Ql("Prism",n=>n._tag===t?X(n):r,F)))}at(t,...r){let n=re(new At([t],new Yt(void 0)));return $s(qu(this.node,Ql("Optional",o=>Object.hasOwn(o,t)?X(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let i=vS(s);return B(i,t,o),X(i)}else return n})))}pick(t){return this.compose(yB(hC(t),(r,n)=>({...xC(n,t),...r})))}omit(t){return this.compose(yB(xC(t),(r,n)=>({...hC(n,t),...r})))}notUndefined(){return this.refine(ei,{expected:"a value other than `undefined`"})}forEach(t){let r=t(CS());return rY(n=>Vr(this.getResult(n),o=>{let s=[];for(let i=0;i<o.length;i++){let a=r.getResult(o[i]);tt(a)&&s.push(a.success)}return s}),(n,o)=>hr(this.getResult(o),s=>{let i=[];for(let c=0;c<s.length;c++)tt(r.getResult(s[c]))&&i.push(c);if(n.length!==i.length)return re(new le({message:`each: replacement length mismatch: ${n.length} !== ${i.length}`}));let a=s.slice();for(let c=0;c<i.length;c++){let u=i[c],f=r.replaceResult(n[c],s[u]);if(be(f))return re(new At([u],f.failure));a[u]=f.success}return this.replaceResult(a,o)}))}modifyAll(t){return r=>ip(hr(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},bC=class extends Yl{get;set;constructor(t,r,n){super(t,o=>X(r(o)),o=>X(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},EC=class extends Yl{get;constructor(t,r,n){super(t,o=>X(r(o)),(o,s)=>X(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},IC=class extends Yl{set;constructor(t,r,n){super(t,r,(o,s)=>X(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>ip(Vr(this.getResult(r),n=>this.set(t(n))),()=>r)}};function $s(e){let t=e[0]??tY;if(e.length>1){let r=e.reduce((n,o)=>sY(n,o.kind),"Iso");t={kind:r,get:nY(e,r),set:oY(e,r)}}switch(t.kind){case"Iso":return new bC(e,t.get,t.set);case"Lens":return new EC(e,t.get,t.set);case"Prism":return new IC(e,t.get,t.set);case"Optional":return new Yl(e,t.get,t.set)}}function vS(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function nY(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(TC(o.kind)){if(be(s))return s;r=s.success}else r=s}return TC(t)?X(r):r}}function oY(e,t){return SB(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){s[i]=n;let a=e[i];if(TC(a.kind)){let c=a.get(n);if(be(c))return c;n=c.success}else n=a.get(n)}for(let i=o-1;i>=0;i--){let a=e[i];if(SB(a.kind))r=a.set(r);else if(a.kind==="Lens")r=a.set(r,s[i]);else{let c=a.set(r,s[i]);if(be(c))return c;r=c.success}}return t==="Optional"?X(r):r}}function TC(e){return e==="Prism"||e==="Optional"}function SB(e){return e==="Iso"||e==="Prism"}function sY(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var iY=$s([]);function CS(){return iY}function IB(e){let t=yS(e);return bB(mS(t),pS(t))}function TB(e){return CS()}function wB(e){return CS()}var Xl="~effect/Schema/SchemaError";function vB(e){return O(e,Xl)&&e[Xl]===Xl}var Mo="~effect/net/NetAddress";var js=e=>e.value,Hs=e=>e,xa=e=>e.bytes,es=class extends sr("NetAddressError"){},ed=e=>O(e,Mo),Br=e=>ed(e)&&e._tag==="Ipv4Address",ts=e=>ed(e)&&e._tag==="Ipv6Address",wC=e=>Br(e)||ts(e),td=e=>Br(e)?32:128;var rd=e=>ed(e)&&e._tag==="MacAddress",Um=e=>ed(e)&&e._tag==="InetAddressV4",Dm=e=>ed(e)&&e._tag==="InetAddressV6",vC=e=>Um(e)||Dm(e),AS=e=>ed(e)&&e._tag==="UnixPathAddress",CB=e=>vC(e)||AS(e),cY={...Ot,_tag:"Ipv4Address",[Mo]:Mo,[ae](e){return Br(e)&&js(this)===js(e)},[ie](){return _r(he(dY,js(this)|0))},toString(){return $r(this)},toJSON(){return this.toString()}},uY={...Ot,_tag:"Ipv6Address",[Mo]:Mo,[ae](e){if(!ts(e))return!1;let t=Hs(this),r=Hs(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ie](){let e=Hs(this),t=he(pY,e.w0|0);return t=he(t,e.w1|0),t=he(t,e.w2|0),_r(he(t,e.w3|0))},toString(){return $r(this)},toJSON(){return this.toString()}},fY={...Ot,_tag:"MacAddress",[Mo]:Mo,[ae](e){return rd(e)&&lY(xa(this),xa(e))},[ie](){return he(mY,ri(xa(this)))},toString(){return kC(this)},toJSON(){return this.toString()}},lY=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},dY=Be("Ipv4Address"),pY=Be("Ipv6Address"),mY=Be("MacAddress"),hY=e=>{let t=Object.create(cY);return t.value=e>>>0,Object.freeze(t)},xY=(e,t,r,n)=>{let o=Object.create(uY);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},gY=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var Nm=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],yY=e=>{let t=Object.assign(Object.create(fY),{bytes:new Uint8Array(e)});return Object.freeze(t)};var Ut=(e,t)=>re(new es({input:e,message:t})),AB=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(!Number.isInteger(n)||n<0||n>t)return!1}return!0},SY=e=>AB(e,255)?X(hY(gY(e[0],e[1],e[2],e[3]))):Ut(e,"octets must be integers from 0 through 255"),bY=e=>AB(e,65535)?X(xY(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):Ut(e,"segments must be integers from 0 through 65535");var kB=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?X(yY(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):Ut(e,"expected six two-digit hexadecimal octets separated by colons");var zu=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return Ut(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return Ut(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?Ut(e,"octets must be at most 255"):SY([r[0],r[1],r[2],r[3]])},EY=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return Ut(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return Ut(e,"only one compression marker is allowed");let r=t[0]===""?[]:t[0].split(":"),n=t.length===2&&t[1]!==""?t[1].split(":"):[];if(r.some(f=>f==="")||n.some(f=>f===""))return Ut(e,"empty segments are only valid in the compression marker");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:"",s;if(o.includes(".")){if(t.length===2&&n.length===0)return Ut(e,"embedded IPv4 syntax must be trailing");let f=Vr(zu(o),p=>{let m=js(p);return[m>>>16,m&65535]});if(be(f))return f;s=f.success,n.length>0?n.pop():r.pop()}let i=r.length+n.length+(s?2:0);if(t.length===1?i!==8:i>=8)return Ut(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let a=f=>/^[0-9a-fA-F]{1,4}$/.test(f)?Number.parseInt(f,16):void 0,c=r.map(a),u=n.map(a);return c.some(f=>f===void 0)||u.some(f=>f===void 0)?Ut(e,"segments must contain one through four hexadecimal digits"):X([...c,...Array(8-i).fill(0),...u,...s??[]])},Wu=e=>hr(EY(e),t=>bY(t)),pc=e=>e.includes(":")?Wu(e):zu(e);var CC=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=Lm(e);return tt(t)&&t.success===e},Lm=e=>{let t=e.indexOf("%");if(t===-1)return Ut(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return Ut(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return Ut(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return Vr(Wu(e.slice(0,t)),n=>`${$r(n)}%${r}`)};var kS=e=>Nm(js(e)),IY=e=>{let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},AC=e=>{let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return[...Nm(t),...Nm(r),...Nm(n),...Nm(o)]};var kC=e=>Array.from(xa(e),t=>t.toString(16).padStart(2,"0")).join(":"),RS=e=>xa(e).every(t=>t===255),TY=e=>(xa(e)[0]&1)!==0,OS=e=>(xa(e)[0]&1)===0,RC=e=>(xa(e)[0]&2)!==0,OC=e=>(xa(e)[0]&2)===0;var $r=e=>{if(Br(e))return kS(e).join(".");let t=IY(e);if(wY(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let a=0;a<=8;a++)a<8&&t[a]===0?o===-1&&(o=a):o!==-1&&(a-o>n&&(r=o,n=a-o),o=-1);if(n<2)return t.map(a=>a.toString(16)).join(":");let s=t.slice(0,r).map(a=>a.toString(16)).join(":"),i=t.slice(r+n).map(a=>a.toString(16)).join(":");return`${s}::${i}`},_S=e=>{if(Br(e))return js(e)===0;let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return t===0&&r===0&&n===0&&o===0},_C=e=>{if(Br(e))return js(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return t===0&&r===0&&n===0&&o===1},nd=e=>rd(e)?TY(e):Br(e)?js(e)>>>28===14:Hs(e).w0>>>24===255,PS=e=>rd(e)?RS(e):js(e)===4294967295,PC=e=>rd(e)?OS(e):!nd(e)&&!_S(e)&&(!Br(e)||!PS(e)),MC=e=>Br(e)?js(e)>>>16===43518:(Hs(e).w0>>>16&65472)===65152,FC=e=>{let t=js(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},NC=e=>(Hs(e).w0>>>24&254)===252,wY=e=>{let{w0:t,w1:r,w2:n}=Hs(e);return t===0&&r===0&&n===65535};var vY={...Ot,_tag:"InetAddressV4",[Mo]:Mo,[ae](e){return Um(e)&&this.port===e.port&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.port))},toString(){return MS(this)},toJSON(){return this.toString()}},CY={...Ot,_tag:"InetAddressV6",[Mo]:Mo,[ae](e){return Dm(e)&&this.port===e.port&&this.scopeId===e.scopeId&&Z(this.address,e.address)},[ie](){return he(he(G(this.address),zt(this.port)),zt(this.scopeId))},toString(){return MS(this)},toJSON(){return this.toString()}},RB=e=>Number.isInteger(e)&&e>=0&&e<=65535,AY=(e,t)=>{if(!RB(t))return Ut(e,"port must be an integer from 0 through 65535");let r=Object.create(vY);return r.address=e,r.port=t,X(Object.freeze(r))},kY=(e,t,r)=>{if(!RB(t))return Ut(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return Ut(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(CY);return o.address=e,o.port=t,o.scopeId=n,X(Object.freeze(o))};var UC=e=>{let t,r,n=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return Ut(e,"expected [IPv6]:port");t=e.slice(1,s),r=e.slice(s+2);let i=t.indexOf("%");if(i!==-1){let a=t.slice(i+1);if(t.indexOf("%",i+1)!==-1||!/^\d+$/.test(a))return Ut(e,"scope identifier must be decimal");if(n=Number(a),!Number.isInteger(n)||n>4294967295)return Ut(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,i)}}else{let s=e.lastIndexOf(":");if(s<0)return Ut(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return Ut(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?hr(pc(t),s=>o!==ts(s)?Ut(e,"only IPv6 addresses use brackets"):ts(s)?kY(s,Number(r),{scopeId:n}):AY(s,Number(r))):Ut(e,"port must be an unpadded decimal integer")};var RY=e=>$r(e.address)+(Dm(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var MS=e=>{let t=RY(e);return Um(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var OY={...Ot,_tag:"UnixPathAddress",[Mo]:Mo,[ae](e){return AS(e)&&this.path===e.path},[ie](){return he(Be("UnixPathAddress"),Be(this.path))},toString(){return this.path},toJSON(){return this.toString()}},OB=e=>{let t=Object.create(OY);return t.path=e,Object.freeze(t)};var DC="~effect/net/Host",mc=(e,t)=>re(new es({input:e,message:t})),_Y=/^[a-z0-9_.-]$/i,PY=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,MY=/^(?:\d+|0x[0-9a-f]*)$/,_B=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let r=t.split(".");for(let n of r){if(n.length===0)return"domain name labels must not be empty";if(n.length>63)return"domain name labels must be at most 63 characters";if(!PY.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(MY.test(r[r.length-1]))return"the last domain name label must not be numeric"},FY=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!_Y.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},ga=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&_B(e)===void 0;var BC=e=>O(e,DC),FS=e=>{let t=FY(e);if(t===void 0)return mc(e,"invalid domain name");let r=_B(t);return r===void 0?X(t):mc(e,r)};var NY=e=>{if(e.includes("%"))return Lm(e);if(e.includes(":"))return pc(e);if(/^[\d.]+$/.test(e)){let t=pc(e);if(tt(t))return t}return FS(e)};var UY=e=>typeof e=="string"?e:$r(e);var DY={...Ot,_tag:"HostPort",[DC]:DC,[ae](e){return BC(e)&&this.port===e.port&&Z(this.host,e.host)},[ie](){return he(G(this.host),zt(this.port))},toString(){return $C(this)},toJSON(){return this.toString()}},LY=e=>Number.isInteger(e)&&e>=0&&e<=65535,BY=(e,t)=>{let r=Object.create(DY);return r.host=e,r.port=t,Object.freeze(r)};var PB=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return mc(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return mc(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return mc(e,"expected host:port");if(e.indexOf(":")!==o)return mc(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return mc(e,"port must be an unpadded decimal integer");let n=Number(r);return LY(n)?Vr(NY(t),o=>BY(o,n)):mc(e,"port must be an integer from 0 through 65535")};var $C=e=>{let t=UY(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var HC="~effect/net/Dns/DnsRecord",jC=e=>Number.isInteger(e)&&e>=0&&e<=255,od=e=>Number.isInteger(e)&&e>=0&&e<=65535,NB=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,hc=e=>typeof e=="string",NS=e=>Qi(e)&&Wn(e)&&NB(ui(e)),UB={A:{address:Br},AAAA:{address:ts},CAA:{critical:e=>typeof e=="boolean",tag:e=>hc(e)&&/^[a-z0-9]+$/i.test(e),value:hc},CNAME:{target:ga},MX:{exchange:ga,priority:od},NAPTR:{order:od,preference:od,flags:hc,service:hc,regexp:hc,replacement:ga},NS:{host:ga},PTR:{host:e=>hc(e)&&e.length>0},SOA:{primary:ga,admin:e=>hc(e)&&e.length>0,serial:NB,refresh:NS,retry:NS,expire:NS,minimum:NS},SRV:{target:ga,port:od,priority:od,weight:od},TLSA:{certUsage:jC,selector:jC,matchingType:jC,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(hc)}},qC=Object.keys(UB),$Y=e=>qC.includes(e),zC=e=>O(e,HC),jY={...Ot,[HC]:HC,[ae](e){return zC(e)&&e._tag===this._tag&&Object.keys(this).every(t=>Z(this[t],e[t]))},[ie](){return jd(this,Object.keys(this))},toString(){return qY(this)},toJSON(){return{...this}}},DB=(e,t)=>{if(!$Y(e))return re(new es({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(jY);n._tag=e;for(let[o,s]of Object.entries(UB[e])){let i=r[o];if(!s(i))return re(new es({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(i)?Object.freeze([...i]):i instanceof Uint8Array?new Uint8Array(i):i}return X(Object.freeze(n))};var LB=new TextEncoder,BB=e=>`\\${e.toString().padStart(3,"0")}`,$m=e=>{let t='"';for(let r of LB.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?BB(r):String.fromCharCode(r);return t+'"'},HY=[34,36,40,41,59,64],FB=e=>{let t=LB.encode(e),r="";for(let n=0;n<t.length;n++){let o=t[n];if(o===92){let s=t[n+1];s===46||s===92?(r+=`\\${String.fromCharCode(s)}`,n++):r+="\\\\"}else o<=32||o>126?r+=BB(o):r+=HY.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},qY=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${$r(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${$m(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${$m(e.flags)} ${$m(e.service)} ${$m(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${FB(e.host)}`;case"SOA":return`SOA ${e.primary} ${FB(e.admin)} ${e.serial} ${ui(e.refresh)} ${ui(e.retry)} ${ui(e.expire)} ${ui(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Vx(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map($m).join(" ")}`}};var WC="~effect/net/IpInterface",$B=e=>jm(e)&&Br(e.address),jB=e=>jm(e)&&ts(e.address),jm=e=>O(e,WC),VY={...Ot,_tag:"IpInterface",[WC]:WC,[ae](e){return jm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.prefixLength))},toString(){return qm(this)},toJSON(){return this.toString()}},KC=(e,t)=>re(new es({input:e,message:t})),Hm=(e,t)=>{let r=td(e);if(!Number.isInteger(t)||t<0||t>r)return KC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(VY),{address:e,prefixLength:t});return X(Object.freeze(n))},VC=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return X({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return KC(e,"expected an address and prefix length separated by one slash");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?X({address:e.slice(0,r),prefixLength:Number(n)}):KC(e,"prefix length must be an unpadded ASCII decimal integer")},US=(e,t)=>hr(VC(e,t),r=>hr(zu(r.address),n=>Hm(n,r.prefixLength??td(n)))),DS=(e,t)=>hr(VC(e,t),r=>hr(Wu(r.address),n=>Hm(n,r.prefixLength??td(n)))),LS=(e,t)=>hr(VC(e,t),r=>hr(pc(r.address),n=>Hm(n,r.prefixLength??td(n))));var qm=e=>`${$r(e.address)}/${e.prefixLength}`;var GC="~effect/net/IpNetwork",qB=e=>zm(e)&&Br(e.address),zB=e=>zm(e)&&ts(e.address),zm=e=>O(e,GC),GY={...Ot,_tag:"IpNetwork",[GC]:GC,[ae](e){return zm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.prefixLength))},toString(){return Wm(this)},toJSON(){return this.toString()}},JY=e=>{let t=Object.assign(Object.create(GY),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},ZY=e=>Br(e)?kS(e):AC(e);var QY=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},JC=(e,t)=>hr(Hm(e,t),r=>{let n=ZY(e),o=QY(n,t);return n.some((s,i)=>s!==o[i])?re(new es({input:e,message:"address has non-zero host bits"})):X(JY(r))});var WB=e=>hr(US(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength)),KB=e=>hr(DS(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength)),VB=e=>hr(LS(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength));var Wm=e=>`${$r(e.address)}/${e.prefixLength}`;var Km=xS;function Cr(){return(e,t,r)=>J(new uc(e.map(Tm),n=>t(n.map(o=>J(o))),r))}function Ge(e,t){return Cr()([],()=>(r,n,o)=>e(r)?I(r):D(new at(n,r,o)),t)}function XY(e){return e}function e7(e){return t=>t.annotate(e)}function t7(e){return t=>QC(QC(t).annotate(e))}function r7(e){return t=>t.rebuild(zl(t.ast,e))}function n7(e){return e}var $n=class extends sr("SchemaError"){[Xl]=Xl;constructor(t){let r=Ir();yt(0);try{super({issue:t})}finally{yt(r)}}get message(){return b1(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[Qe](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function ud(e){return vB(e)}function a$(e){return Xe(e)?tA(e):rt(e,t=>aa(()=>Ka(t,r=>new $n(r))))}function tA(e){return ft(e)?e:ir(Ka(e.cause,t=>new $n(t)))}function c$(e,t){let r;for(let n of e.reasons){if(!Fg(n)||!ud(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function u$(e){return ly(e).then(t=>{if(ft(t))return t.value;throw c$(t.cause,"Promise adapter can only reject schema errors")})}function f$(e){let t=ki(e);if(ft(t))return t.value;throw c$(t.cause,"Sync adapter can only throw schema errors")}function o7(e,t){return rB(e,t)}function s7(e){return nB(e)}var i7=Zv,a7=hL;function xc(e,t){let r=ot(e,t);return(n,o)=>a$(r(n,o))}var c7=xc;function l$(e,t){let r=xL(e,t);return(n,o)=>tA(r(n,o))}var d$=l$,u7=Yv,f7=gL;function p$(e,t){let r=yL(e,t);return(n,o)=>UI(r(n,o),s=>new $n(s))}var l7=p$;function m$(e,t){let r=xc(e,t);return(n,o)=>u$(r(n,o))}var d7=m$;function $S(e,t){let r=xc(e,t);return(n,o)=>f$(r(n,o))}var Jm=$S;function Zm(e,t){let r=$u(e,t);return(n,o)=>a$(r(n,o))}var rA=Zm;function h$(e,t){let r=bL(e,t);return(n,o)=>tA(r(n,o))}var x$=h$,p7=Xv,m7=EL;function g$(e,t){let r=IL(e,t);return(n,o)=>UI(r(n,o),s=>new $n(s))}var h7=g$;function y$(e,t){let r=Zm(e,t);return(n,o)=>u$(r(n,o))}var x7=y$;function Qm(e,t){let r=Zm(e,t);return(n,o)=>f$(r(n,o))}var nA=Qm,J=Ls;function Gu(e){return O(e,Km)&&e[Km]===Km}var Vu=bn(e=>J(Bu(e.ast),{schema:e})),g7=bn(e=>e.schema),lr=bn(e=>{let t=qS(e);return J(V2(e.ast),{schema:t})}),y7=bn(e=>e.schema.members[0]),S7=bn(e=>J(Dv(e.ast),{schema:e})),b7=bn(e=>e.schema),oo=bn(e=>J(Nt(e.ast),{schema:e})),fd=bn(e=>J(Bn(e.ast),{schema:e})),Vm="~effect/Schema/flip";function E7(e){return O(e,Vm)&&e[Vm]===Vm}function QC(e){return E7(e)?e.schema.rebuild(Oo(e.ast)):J(Oo(e.ast),{[Vm]:Vm,schema:e})}function fr(e){let t=J(new Ln(e),{literal:e,transform(r){return t.pipe(ee(fr(r),{decode:Ie(()=>r),encode:Ie(()=>e)}))}});return t}function S$(e){return e.map(t=>Gu(t)?t.ast:new Ln(t))}function I7(e){return J(new Cv(S$(e)),{parts:e})}function T7(e){return J(C2(S$(e)),{parts:e})}function w7(e){return J(new v2(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var Mi=J(vv),v7=J(T2),Ym=J(pa),jS=J(Tv),oA=J(wv),z=J(Ro),C7=z,Ju=J(Av),Fi=J(R2),b$=J(O2),ld=J(_2),dd=J(I2),A7=J(w2);function k7(e){return J(new k2(e))}function sA(e,t){return J(e,{fields:t,mapFields(r,n){let o=r(this.fields);return sA(Xy(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Te(e){return sA(Xy(e,void 0),e)}function R7(e){return bn(t=>t.mapFields(xB(e)))}var O7=e=>typeof e=="symbol"?e:globalThis.String(e);function _7(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=fd(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,f=O7(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${ni(u)}`);s.add(f),B(r,u,a),c&&(n[i]=u,o[u]=i)}return Te(r).pipe(ee(t,Fe({decode:gC(o),encode:gC(n)})))}}function P7(e,t){return r=>{let n=Ux(r.fields,oo),o=Te({...n,...e});return r.pipe(ee(o,Fe({decode:s=>{let i={...s};for(let a in e){let c=t[a],u=c(s);de(u)&&B(i,a,u.value)}return i},encode:s=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function Zu(e,t){return J(J2(e.ast,t.ast),{key:e,value:t})}function M7(e,t){return J(U2(e.ast,t.map(Tm)),{schema:e,records:t})}function E$(e,t){return J(e,{elements:t,mapElements(r,n){let o=r(this.elements);return E$(_v(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function rs(e){return E$(_v(e),e)}function F7(e,t){return J(D2(e.ast,t.map(Tm)),{schema:e,rest:t})}var ct=bn(e=>J(new Xo(!1,[],[e.ast]),{value:e}));function HS(e,t,r){return t!==void 0&&r!==void 0?e.check(fA(t,r)):t!==void 0?e.check($$(t)):r!==void 0?e.check(q$(r)):e}var Qu=bn(e=>J(new Xo(!1,[e.ast],[e.ast]),{value:e}));function N7(e){let t=ct(e),r=ct(oo(e)),n=ee(rs([Ym]),Fe({decode:o=>[o],encode:([o])=>o}))(e);return J(Pe([n,t]).pipe(ee(r)).ast,{from:Pe([e,t]),to:r})}function U7(e){return ct(e).check(dA())}var D7=bn(e=>J(L2(e.ast),{schema:e}));function I$(e,t){return J(e,{members:t,mapMembers(r,n){let o=r(this.members);return I$(eS(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Pe(e,t){return I$(eS(e,t,void 0),e)}function Fo(e){let t=e.map(fr);return J(eS(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return Pe(r(this.members))},pick(r){return Fo(r)},transform(r){return Pe(t.map((n,o)=>n.transform(r[o])))}})}var iA=bn(e=>Pe([e,jS])),qS=bn(e=>Pe([e,oA])),T$=bn(e=>Pe([e,jS,oA]));function w$(e){return J(new Mv(()=>e().ast))}function L7(...e){return t=>t.check(...e)}function v$(e,t){return r=>J(Pi(r.ast,[rS(e,t)]),{schema:r})}function zS(e){return t=>J(t.ast,{schema:t,identifier:e})}function B7(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(zS(e))}function C$(e){return t=>J(W2(t.ast,new Wy(e,F)),{schema:t})}function A$(e){return t=>J(K2(t.ast,new Wy(F,e)),{schema:t})}function $7(e){return k$(e)}function k$(e){return t=>C$(py(e))(t)}function j7(e){return R$(e)}function R$(e){return t=>A$(py(e))(t)}function ee(e,t){return r=>J(Wl(r.ast,e.ast,t?Ky(t):Fl()),{from:r,to:e})}function pd(){return(e,t)=>Ne()(e,{decode:t,encode:w1})}var O$=Fo(["true","yes","on","1","y"]),_$=Fo(["false","no","off","0","n"]),H7=Fo([...O$.literals,..._$.literals]).pipe(ee(Fi,Fe({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function q7(e){return t=>ee(oo(t),e)(t)}function aA(e,t){return r=>t?ee(r,t)(e):ee(r)(e)}function z7(e){return t=>ee(t,e)(fd(t))}function P$(e){return t=>J(G2(t.ast,e),{schema:t})}function M$(e){return rt(e,t=>aa(()=>Ka(t,r=>r.issue)))}function cA(e,t){let r=t?.encodingStrategy==="omit"?sv():Oi();return n=>Vu(fd(n)).pipe(ee(n,{decode:iv(M$(e)),encode:r}))}function W7(e,t){return r=>oo(r).pipe(cA(e,t),aA(Vu(r)))}function F$(e,t){let r=t?.encodingStrategy==="omit"?sv():Oi();return n=>lr(fd(n)).pipe(ee(n,{decode:iv(M$(e)),encode:r}))}function K7(e,t){return r=>oo(r).pipe(F$(e,t),aA(lr(r)))}function He(e){return fr(e).pipe(P$(I(e)))}function V7(e){return He(e).pipe(cA(I(e),{encodingStrategy:"omit"}))}function ya(e,t){return Te({_tag:He(e),...t})}function N$(e){return t=>{let r={},n=[],o=new Set,s={},i=f=>p=>f.includes(p[e]);return a(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(f){let p=f.ast;if(S2(p)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(Gu))return f.members.forEach(a);let m=ac(p);if(m.length>0){let h=m.find(x=>x.key===e)?.literal;if(px(h)){let x=typeof h=="number"?globalThis.String(h):h;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(x),n.push(h),B(r,h,f),B(s,h,Zv(oo(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let x=arguments[0];return function(g){let y=g[e];return(Object.hasOwn(x,y)?x[y]:void 0)(g)}}let f=arguments[0],p=arguments[1],m=f[e];return(Object.hasOwn(p,m)?p[m]:void 0)(f)}function u(){if(arguments.length===2){let g=arguments[0],y=arguments[1];return function(E){let b=E[e];return(Object.hasOwn(g,b)?g[b]??y:y)(E)}}let f=arguments[0],p=arguments[1],m=arguments[2],h=f[e];return(Object.hasOwn(p,h)?p[h]??m:m)(f)}}}function G7(e){let t={},r=[];for(let u of Object.keys(e)){let f=ya(u,e[u]);B(t,u,f),r.push(f)}let n=Pe(r),{tag:o,guards:s,isAnyOf:i,match:a,matchOrElse:c}=N$("_tag")(n);return J(n.ast,{tag:o,cases:t,isAnyOf:i,guards:s,match:a,matchOrElse:c})}function J7(){return e=>e}function gc(e,t){return Ge(r=>r instanceof e,t)}function Ne(){return(e,t)=>new jt(e.ast,Ky(t))}var Je=tS;function Z7(e,t=void 0){return new Uu(e,t)}var GB="^\\S[\\s\\S]*\\S$|^\\S$|^$";function U$(e){let t=new globalThis.RegExp(GB);return Je(r=>r.trim()===r,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitraryConstraint:{patterns:[{source:GB,flags:""}]},...e})}function Yu(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${H(r)})`:`new RegExp(${H(r)}, ${H(n)})`;return vm(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function Q7(e){return $v({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function Y7(e){return jv({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function X7(e){return qv({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var eX=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function tX(e,t){let r=eX(e);return Yu(r,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var JB=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;function rX(e){return Yu(JB,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:JB.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function nX(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Yu(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function D$(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Yu(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function oX(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Yu(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function uA(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function sX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${ha(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return Je(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>uA(o,e,`^${ha(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function iX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${ha(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return Je(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>uA(o,e,`${ha(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function aX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(ha(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return Je(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>uA(o,e,ha(o)),toCode:()=>({runtime:`Schema.isIncluding(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var ZB="^[^a-z]*$";function cX(e){let t=new globalThis.RegExp(ZB);return Je(r=>r.toUpperCase()===r,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:ZB,flags:""}]},...e})}var QB="^[^A-Z]*$";function uX(e){let t=new globalThis.RegExp(QB);return Je(r=>r.toLowerCase()===r,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:QB,flags:""}]},...e})}var YB="^(?:[^a-z][\\s\\S]*)?$";function fX(e){let t=new globalThis.RegExp(YB);return Je(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:YB,flags:""}]},...e})}var XB="^(?:[^A-Z][\\s\\S]*)?$";function lX(e){let t=new globalThis.RegExp(XB);return Je(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:XB,flags:""}]},...e})}var WS=J(Nv),dX=Fv;function Xm(e){let t=Qc(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function eh(e){let t=np(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function th(e){let t=tp(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function rh(e){let t=rp(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function nh(e){let t=np(e.order),r=Qc(e.order),n=rp(e.order),o=tp(e.order),s=e.formatter??H;return(i,a)=>{let c=i.exclusiveMinimum?r:t,u=i.exclusiveMaximum?o:n;return Je(f=>c(f,i.minimum)&&u(f,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(i),...a})}}function pX(e){return(t,r)=>{let n=e.formatter??H;return Je(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function id(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${H(e)}`);return e}var mX=Xm({order:Ki,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:id(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${H(e)})`})})}),L$=eh({order:Ki,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:id(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${H(e)})`})})}),hX=th({order:Ki,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:id(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${H(e)})`})})}),xX=rh({order:Ki,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:id(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${H(e)})`})})}),yc=nh({order:Ki,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:id(e.minimum),maximum:id(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${H(e.minimum)}, maximum: ${H(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}});function gX(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Je(r=>iU(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${H(e)})`}),...t})}function KS(e){return Je(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var In=Ju.check(KS()),Ku=In.check(L$(0));function yX(e){return new Uu([KS(),yc({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function SX(e){return new Uu([KS(),yc({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function ad(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${H(e)}`);return e.toISOString()}function cd(e){return`new Date(${H(e.getTime())})`}var bX=Xm({order:Uf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:ad(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${cd(e)})`})})}),EX=eh({order:Uf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:ad(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${cd(e)})`})})}),IX=th({order:Uf,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:ad(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${cd(e)})`})})}),TX=rh({order:Uf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:ad(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${cd(e)})`})})}),wX=nh({order:Uf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:ad(e.minimum),maximum:ad(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${cd(e.minimum)}, maximum: ${cd(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}}),vX=Xm({order:Nf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${H(e)})`})})}),B$=eh({order:Nf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${H(e)})`})})}),CX=th({order:Nf,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${H(e)})`})})}),AX=rh({order:Nf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${H(e)})`})})}),kX=nh({order:Nf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${H(e.minimum)}, maximum: ${H(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}});function $$(e,t){return e=En(e),j$(e,Math.ceil(e/2),t)}function j$(e,t,r){return Je(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:n==="array"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[ro]:!0,arbitraryConstraint:{minLength:e},...r})}function H$(e){return j$(1,1,e)}function q$(e,t){return e=En(e),Je(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:r==="array"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[ro]:!0,arbitraryConstraint:{maxLength:e},...t})}function fA(e,t,r){return e=En(e),t=En(t),Je(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n==="array"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function RX(e,t){return e=En(e),Je(r=>lA(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function OX(e,t){return e=En(e),Je(r=>lA(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function _X(e,t,r){return e=En(e),t=En(t),Je(n=>{let o=lA(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function lA(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function En(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function PX(e,t){return e=En(e),Je(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[ro]:!0,arbitraryConstraint:{minSize:e},...t})}function MX(e,t){return e=En(e),Je(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[ro]:!0,arbitraryConstraint:{maxSize:e},...t})}function FX(e,t,r){return e=En(e),t=En(t),Je(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function NX(e,t){return e=En(e),Je(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[ro]:!0,arbitraryConstraint:{minProperties:e},...t})}function UX(e,t){return e=En(e),Je(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[ro]:!0,arbitraryConstraint:{maxProperties:e},...t})}function DX(e,t,r){return e=En(e),t=En(t),Je(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function LX(e,t){let r=fd(e),n=mL(r.ast);return Je((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let f=n(u,i);if(f!==void 0&&(c.push(new At([u],f)),i.errors==="first"))break}return Gr(c)?new Ft(s,c,o,i):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[ro]:!0,...t})}function dA(e){return Je(t=>Hx(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:F},...e})}function z$(e){return Je(t=>Hx(t.map(([r])=>r)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var pA=z.check(H$()),BX=z.check(fA(1,1)),W$=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),K$=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},e$=[];function $X(e){let t=W$(e),r=e$[t];if(r!==void 0)return r;let n=K$(t),o=gc(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${H(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Ne()(dre,Q1(n))});return e$[t]=o,o}var t$=[];function er(e){let t=W$(e),r=t$[t];if(r!==void 0)return r;let n=YS.pipe(ee(Ym,Y1(K$(t))));return t$[t]=n,n}function jX(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(rs([n,o]));return(i,a,c)=>i instanceof globalThis.Map?cr(ot(s)([...i],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>tn(a,"entries",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:"ReadonlyMap",toCodec:([n,o])=>Ne()(ct(rs([n,o])),Fe({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return J(r.ast,{key:e,value:t})}function HX(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>o instanceof globalThis.Set?cr(ot(n)([...o],i),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:"ReadonlySet",toCodec:([r])=>Ne()(ct(r),Fe({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return J(t.ast,{value:e})}var qX=gc(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Ne()(Te({source:z,flags:z}),Xt({decode:(e,t)=>Go({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new le({expected:"valid RegExp source and flags"},e,t)}),encode:e=>I({source:e.source,flags:e.flags})}))}),V$=z.annotate({expected:"a string that will be decoded as a URL"}),G$=gc(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Ne()(V$,lv)}),zX=V$.pipe(ee(G$,lv)),J$=z.annotate({expected:"a string that will be decoded as a Date"}),VS=Ge(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:()=>Ne()(J$,uv)}),WX=J$.pipe(ee(VS,uv)),KX=In.pipe(ee(VS,W1)),VX=z.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function mA(e,t){return VX.pipe(ee(e,c2(t)))}var GX=mA(Ym),Z$=gc(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Ne()(Te({data:z.check(D$()),type:z,name:z,lastModified:In}),Xt({decode:(e,t)=>zn(vu(e.data),{onFailure:()=>D(new le({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return I(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Vo({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Cl(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new le({expected:"a readable File"},e,t)})}))}),Q$=gc(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Ne()(ct(rs([z,Pe([Te({_tag:He("String"),value:z}),Te({_tag:He("File"),value:Z$})])])),Xt({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return I(t)},encode:e=>I(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function JX(e){return Q$.pipe(ee(e,u2))}var Y$=gc(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Ne()(z.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Fe({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function ZX(e){return Y$.pipe(ee(e,f2))}var QX=z.annotate({expected:"a string that will be decoded as a number"}).pipe(ee(Ju,Nl)),YX=z.annotate({expected:"a string that will be decoded as a finite number"}).pipe(ee(WS,Nl)),XX=J(Hv).pipe(ee(ld,Gy)),X$=z.check(U$()),eee=z.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(ee(X$,z1())),tee=z.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,o2)),ree=z.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,s2)),nee=z.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,i2)),oee=z.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,a2)),YC=Pe([WS,b$,z]),see=Te({issues:ct(Te({message:z,path:lr(ct(Pe([YC,Te({key:YC})])))}))}),iee=Fo([0,1]).pipe(ee(Fi,Fe({decode:e=>e===1,encode:e=>e?1:0}))),ej=z.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),qs=gc(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Ne()(ej,dv)}),aee=ej.pipe(ee(qs,dv)),cee=z.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(ee(qs,{decode:P1(),encode:qy()})),tj=z.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(ee(qs,{decode:F1(),encode:zy()})),rj=Xt({decode:(e,t)=>{let r=tD(e);return fe(r)?D(new le({expected:"a valid BigDecimal string"},e,t)):I(r.value)},encode:e=>I(fa(e))}),uee=Xm({order:Tl,formatter:e=>fa(e)}),fee=eh({order:Tl,formatter:e=>fa(e)}),lee=th({order:Tl,formatter:e=>fa(e)}),dee=rh({order:Tl,formatter:e=>fa(e)}),pee=nh({order:Tl,formatter:e=>fa(e)}),nj=z.annotate({expected:"a string that will be decoded as a BigDecimal"}),oj=Ge(Iu,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Ne()(nj,rj),toFormatter:()=>e=>fa(e)}),mee=nj.pipe(ee(oj,rj)),GS=Ge(fD,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Ne()(ld.check(B$(globalThis.BigInt(0))),Fe({decode:uD,encode:xy})),toCodecStringTree:()=>Ne()(sj,fv)}),sj=z.annotate({expected:"a string that will be decoded as a ByteSize"}),hee=sj.pipe(ee(GS,fv)),xee=ld.pipe(ee(GS,K1)),gee=Ju.pipe(ee(GS,V1));function XC(e,t){let r=Cr()([e,t],([n,o])=>(s,i,a)=>{if(!il(s))return D(new at(i,s,a));switch(s._tag){case"Fail":return cr(ot(n)(s.error,a),{onSuccess:vp,onFailure:c=>tn(i,"error",c,s,a)});case"Die":return cr(ot(o)(s.defect,a),{onSuccess:Cp,onFailure:c=>tn(i,"defect",c,s,a)});case"Interrupt":return I(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([n,o])=>Ne()(Pe([Te({_tag:fr("Fail"),error:n}),Te({_tag:fr("Die"),defect:o}),Te({_tag:fr("Interrupt"),fiberId:qS(WS)})]),Fe({decode:s=>{switch(s._tag){case"Fail":return vp(s.error);case"Die":return Cp(s.defect);case"Interrupt":return Ap(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return J(r.ast,{error:e,defect:t})}function Gm(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(XC(n,o));return(i,a,c)=>sl(i)?cr(ot(s)(i.reasons,c),{onSuccess:cu,onFailure:u=>tn(a,"failures",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([n,o])=>Ne()(ct(XC(n,o)),Fe({decode:cu,encode:({reasons:s})=>s}))});return J(r.ast,{error:e,defect:t})}function r$(e){return Ne()(e,Fe({decode:gw,encode:Ct}))}function yee(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>vl(o)?cr(ot(n)(Ct(o),i),{onSuccess:gw,onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:"Chunk",toCodec:([r])=>r$(ct(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>r$(HS(ct(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>hw(r)});return J(t.ast,{value:e})}function ij(){return rn((e,t)=>Zt(yw(e),{onNone:()=>D(new le({message:"Invalid DateTime input"},e,t)),onSome:r=>I(Sw(r))}))}var See=Fe({decode:e=>Ew(e),encode:e=>e.offset}),aj=Xt({decode:(e,t)=>Zt(TD(e),{onNone:()=>D(new le({expected:"a valid IANA time zone"},e,t)),onSome:I}),encode:e=>I(e.id)}),cj=Xt({decode:(e,t)=>Zt(wD(e),{onNone:()=>D(new le({expected:"a valid time zone"},e,t)),onSome:I}),encode:e=>I(em(e))}),uj=Xt({decode:(e,t)=>Zt(yw(e),{onNone:()=>D(new le({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>I(Sw(r))}),encode:e=>I(AD(e))}),fj=Xt({decode:(e,t)=>Zt(ID(e),{onNone:()=>D(new le({expected:"a valid Zoned DateTime string"},e,t)),onSome:I}),encode:e=>I(Iw(e))}),lj=-864e13,dj=864e13,bee=lj+840*60*1e3,Eee=dj-840*60*1e3,Iee=-720*60*1e3,Tee=840*60*1e3,pj=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function mj(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function hA(e,t){return In.check(yc({minimum:e,maximum:t}))}function hj(){return Pe([hA(Iee,Tee),Fo(pj)])}var JS=Ge(e=>wu(e)&&SD(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{let[t,r]=mj(e,lj,dj);return pd()(hA(t,r),Ie(Sy))},toCodecJson:()=>Ne()(z,uj),toFormatter:()=>e=>e.toString()}),wee=VS.pipe(ee(JS,{decode:ij(),encode:Ie(vD)})),vee=z.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(ee(JS,uj)),Cee=In.pipe(ee(JS,{decode:ij(),encode:Ie(CD)})),Aee=Ge(gD,{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:()=>Ne()(In,See),toFormatter:()=>e=>em(e)}),xj=z.annotate({expected:"an IANA time zone identifier"}),gj=Ge(yD,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>pd()(Fo(pj),Ie(bw)),toCodecJson:()=>Ne()(xj,aj),toFormatter:()=>e=>em(e)}),kee=xj.pipe(ee(gj,aj)),yj=z.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),Sj=Ge(xD,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>pd()(hj(),Ie(e=>typeof e=="number"?Ew(e):bw(e))),toCodecJson:()=>Ne()(yj,cj),toFormatter:()=>e=>em(e)}),Ree=yj.pipe(ee(Sj,cj)),bj=z.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),Ej=Ge(e=>wu(e)&&bD(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{let[t,r]=mj(e,bee,Eee);return pd()(Te({epochMilliseconds:hA(t,r),timeZone:hj()}),Ie(({epochMilliseconds:n,timeZone:o})=>by(n,{timeZone:o})))},toCodecJson:()=>Ne()(bj,fj),toFormatter:()=>e=>Iw(e),toEquivalence:()=>ED}),Oee=bj.pipe(ee(Ej,fj)),so=(e,t,r,n)=>z.pipe(ee(e,Xt({decode:(o,s)=>{let i=t(o);return tt(i)?I(i.success):D(new le({message:i.failure.message},o,s))},encode:o=>I(r(o))}))).annotate({identifier:n}),Xu=Ge(rd,{identifier:"MacAddress"}),md=so(Xu,kB,kC,"MacAddressFromString"),oh=Ge(Br,{identifier:"Ipv4Address"}),xA=so(oh,zu,$r,"Ipv4AddressFromString"),ZS=Ge(ts,{identifier:"Ipv6Address"}),Ij=so(ZS,Wu,$r,"Ipv6AddressFromString"),Sc=Ge(wC,{identifier:"IpAddress"}),ef=so(Sc,pc,$r,"IpAddressFromString"),kt=(e,t,r,n)=>v$(t,{expected:r})(e).annotate({identifier:n}),_ee=kt(Sc,nd,"a multicast address","IpMulticastAddress"),Pee=kt(ef,nd,"a multicast address","IpMulticastAddressFromString"),Mee=kt(Xu,nd,"a multicast address","MacMulticastAddress"),Fee=kt(md,nd,"a multicast address","MacMulticastAddressFromString"),Nee=kt(Sc,PC,"a unicast address","IpUnicastAddress"),Uee=kt(ef,PC,"a unicast address","IpUnicastAddressFromString"),Dee=kt(Xu,OS,"a unicast address","MacUnicastAddress"),Lee=kt(md,OS,"a unicast address","MacUnicastAddressFromString"),Bee=kt(oh,PS,"a broadcast address","Ipv4BroadcastAddress"),$ee=kt(xA,PS,"a broadcast address","Ipv4BroadcastAddressFromString"),jee=kt(Xu,RS,"a broadcast address","MacBroadcastAddress"),Hee=kt(md,RS,"a broadcast address","MacBroadcastAddressFromString"),qee=kt(Sc,_C,"a loopback address","IpLoopbackAddress"),zee=kt(ef,_C,"a loopback address","IpLoopbackAddressFromString"),Wee=kt(Sc,MC,"a link-local address","IpLinkLocalAddress"),Kee=kt(ef,MC,"a link-local address","IpLinkLocalAddressFromString"),Vee=kt(Sc,_S,"an unspecified address","IpUnspecifiedAddress"),Gee=kt(ef,_S,"an unspecified address","IpUnspecifiedAddressFromString"),Jee=kt(oh,FC,"a private address","Ipv4PrivateAddress"),Zee=kt(xA,FC,"a private address","Ipv4PrivateAddressFromString"),Qee=kt(ZS,NC,"a unique-local address","Ipv6UniqueLocalAddress"),Yee=kt(Ij,NC,"a unique-local address","Ipv6UniqueLocalAddressFromString"),Xee=kt(Xu,RC,"a locally administered address","MacLocallyAdministeredAddress"),ete=kt(md,RC,"a locally administered address","MacLocallyAdministeredAddressFromString"),tte=kt(Xu,OC,"a universally administered address","MacUniversallyAdministeredAddress"),rte=kt(md,OC,"a universally administered address","MacUniversallyAdministeredAddressFromString"),Tj=Ge($B,{identifier:"Ipv4Interface"}),nte=so(Tj,US,qm,"Ipv4InterfaceFromString"),wj=Ge(jB,{identifier:"Ipv6Interface"}),ote=so(wj,DS,qm,"Ipv6InterfaceFromString"),vj=Ge(jm,{identifier:"IpInterface"}),ste=so(vj,LS,qm,"IpInterfaceFromString"),Cj=Ge(qB,{identifier:"Ipv4Network"}),ite=so(Cj,WB,Wm,"Ipv4NetworkFromString"),Aj=Ge(zB,{identifier:"Ipv6Network"}),ate=so(Aj,KB,Wm,"Ipv6NetworkFromString"),kj=Ge(zm,{identifier:"IpNetwork"}),cte=so(kj,VB,Wm,"IpNetworkFromString"),ute=Ge(Um,{identifier:"InetAddressV4"}),fte=Ge(Dm,{identifier:"InetAddressV6"}),Rj=Ge(vC,{identifier:"InetAddress"}),lte=so(Rj,UC,MS,"InetAddressFromString"),Oj=Ge(AS,{identifier:"UnixPathAddress"}),dte=z.pipe(ee(Oj,Fe({decode:OB,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),pte=Ge(CB,{identifier:"SocketAddress"}),Sa=z.check(Je(ga,{expected:"a normalized domain name"})).pipe(zS("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),_j=so(Sa,FS,e=>e,"DomainNameFromString"),gA=z.check(Je(CC,{expected:"a canonical scoped IPv6 literal"})).pipe(zS("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),Pj=so(gA,Lm,e=>e,"ScopedIpv6LiteralFromString"),mte=Pe([Sc,gA,Sa]).annotate({identifier:"Host"}),hte=Pe([ef,Pj,_j]).annotate({identifier:"HostFromString"}),Mj=Ge(BC,{identifier:"HostPort"}),xte=so(Mj,PB,$C,"HostPortFromString"),gte=In.check(yc({minimum:0,maximum:65535},{expected:"a port number"})),yte=Xt({decode:(e,t)=>Zt(uP(e),{onNone:()=>D(new le({expected:"a valid Duration string"},e,t)),onSome:I}),encode:e=>I(globalThis.String(e))}),Ste=Xt({decode:e=>I($o(e)),encode:(e,t)=>Zt(fP(e),{onNone:()=>D(new le({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>I(r)})}),bte=Fe({decode:e=>Zi(e),encode:e=>Wt(e)}),sh=Ge(Qi,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Ne()(Pe([Te({_tag:fr("Infinity")}),Te({_tag:fr("NegativeInfinity")}),Te({_tag:fr("Nanos"),value:ld}),Te({_tag:fr("Millis"),value:In})]),Fe({decode:e=>{switch(e._tag){case"Infinity":return Ss;case"NegativeInfinity":return Da;case"Nanos":return $o(e.value);case"Millis":return Zi(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}}}}))}),Ete=z.annotate({expected:"a string that will be decoded as a Duration"}),Ite=Ete.pipe(ee(sh,yte)),Tte=ld.pipe(ee(sh,Ste)),wte=Ju.pipe(ee(sh,bte)),vte=Fo(qC),Fj=(e,t)=>z.pipe(ee(e,Xt({decode:(r,n)=>{let o=t(r);return be(o)?D(new le({message:o.failure.message},r,n)):$r(o.success)===r?I(o.success):D(new le({message:"expected a canonical address"},r,n))},encode:r=>I($r(r))}))),ZC=In.check(yc({minimum:0,maximum:255})),sd=In.check(yc({minimum:0,maximum:65535})),Nj=In.check(yc({minimum:0,maximum:4294967295})),BS=Nj.pipe(ee(sh,Fe({decode:up,encode:ui}))),ns=(e,t)=>Ge(r=>zC(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=ya(e,t);return Ne()(r,Xt({decode:(n,o)=>{let{_tag:s,...i}=n,a=DB(e,i);return tt(a)?I(a.success):D(new le({message:a.failure.message},n,o))},encode:n=>I({...n})}))}}),Uj=ns("A",{address:Fj(oh,zu)}),Dj=ns("AAAA",{address:Fj(ZS,Wu)}),Lj=ns("CAA",{critical:Fi,tag:z.check(Yu(/^[a-z0-9]+$/i)),value:z}),Bj=ns("CNAME",{target:Sa}),$j=ns("MX",{exchange:Sa,priority:sd}),jj=ns("NAPTR",{order:sd,preference:sd,flags:z,service:z,regexp:z,replacement:Sa}),Hj=ns("NS",{host:Sa}),qj=ns("PTR",{host:pA}),zj=ns("SOA",{primary:Sa,admin:pA,serial:Nj,refresh:BS,retry:BS,expire:BS,minimum:BS}),Wj=ns("SRV",{target:Sa,port:sd,priority:sd,weight:sd}),Kj=ns("TLSA",{certUsage:ZC,selector:ZC,matchingType:ZC,data:tj}),Vj=ns("TXT",{chunks:Qu(z)}),Cte=Pe([Uj,Dj,Lj,Bj,$j,jj,Hj,qj,zj,Wj,Kj,Vj]).annotate({identifier:"DnsRecord"});function yA(e,t,r){let n=Cr()([e,t,r],([o,s,i])=>{let a=Gm(s,i);return(c,u,f)=>{if(!ws(c))return D(new at(u,c,f));switch(c._tag){case"Success":return cr(ot(o)(c.value,f),{onSuccess:Mr,onFailure:p=>tn(u,"value",p,c,f)});case"Failure":return cr(ot(a)(c.cause,f),{onSuccess:ir,onFailure:p=>tn(u,"cause",p,c,f)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,i])=>Ne()(Pe([Te({_tag:fr("Success"),value:o}),Te({_tag:fr("Failure"),cause:Gm(s,i)})]),Fe({decode:a=>a._tag==="Success"?Mr(a.value):ir(a.cause),encode:a=>ft(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}}))});return J(n.ast,{value:e,error:t,defect:r})}function n$(e,t,r){return Te({type:fr(e),nodes:ct(Te({index:Ku,data:t})),edges:ct(Te({index:Ku,source:Ku,target:Ku,data:r}))})}function o$(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return D(new At(["nodes",o,"index"],new le({expected:"a strictly increasing node index"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return D(new At(["edges",o,"index"],new le({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return D(new At(["edges",o,"source"],new le({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return D(new At(["edges",o,"target"],new le({expected:"an encoded node index"},s.target,t)))}return I(Uy(e))}function Ate(e,t,r){return!Zw(e)||e.mutable||e.type!==t?D(new le({expected:`an immutable ${t} Graph`},e,r)):I(fm(e))}function kte(e,t){return(r,n)=>{let o=fm(r),s=fm(n);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 Rte(e,t,r){return pd()(Pe([jS,Te({nodes:Qu(t),edges:ct(rs([Ku,Ku,r]))})]),Ie(n=>{if(n===null)return Uy({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,i)=>({index:i,data:s}));return Uy({type:e,nodes:o,edges:n.edges.map(([s,i,a],c)=>({index:c,source:s%o.length,target:i%o.length,data:a}))})}))}function Ote(e,t,r){let n=Cr()([t,r],([o,s])=>{let i=n$(e,o,s);return(a,c,u)=>!Zw(a)||a.mutable||a.type!==e?D(new at(c,a,u)):A(ot(i)(fm(a),u),f=>o$(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${H(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${H(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Ne()(n$(e,o,s),Xt({decode:o$,encode:(i,a)=>Ate(i,e,a)})),toCodecArbitrary:({typeParameters:[o,s]})=>Rte(e,o,s),toEquivalence:([o,s])=>kte(o,s)});return J(n.ast,{type:e,node:t,edge:r})}function s$(e){return Ne()(e,Fe({decode:Mw,encode:sm}))}function _te(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(rs([n,o]));return(i,a,c)=>Cy(i)?cr(ot(s)(sm(i),c),{onSuccess:Mw,onFailure:u=>tn(a,"entries",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([n,o])=>s$(ct(rs([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>s$(HS(ct(rs([o,s])).check(z$()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>gx(n,o)});return J(r.ast,{key:e,value:t})}function i$(e){return Ne()(e,Fe({decode:Nw,encode:Ct}))}function Pte(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>Oy(o)?cr(ot(n)(Ct(o),i),{onSuccess:Nw,onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:"HashSet",toCodec:([r])=>i$(ct(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>i$(HS(ct(n).check(dA()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>qd(r)});return J(t.ast,{value:e})}function ba(e){let t=Cr()([e],([r])=>(n,o,s)=>ci(n)?fe(n)?ia:cr(ot(r)(n.value,s),{onSuccess:N,onFailure:i=>tn(o,"value",i,n,s)}):D(new at(o,n,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([r])=>Ne()(Pe([Te({_tag:fr("Some"),value:r}),Te({_tag:fr("None")})]),Fe({decode:n=>n._tag==="None"?_():N(n.value),encode:n=>de(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return J(t.ast,{value:e})}function Mte(e){return iA(e).pipe(ee(ba(oo(e)),X1()))}function Fte(e){return qS(e).pipe(ee(ba(oo(e)),e2()))}function Nte(e,t){return T$(e).pipe(ee(ba(oo(e)),t2(t)))}var Gj=Ge(WD,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Jj=Ge(zD,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Ne()(ct(z),Fe({decode:Py,encode:ZD})),toCodecIso:()=>Ne()(Zu(z,Gj),Fe({decode:$w,encode:e=>e.cookies}))}),Ute=Jj.pipe(ee(Zu(z,z),Fe({decode:JD,encode:e=>jw(globalThis.Object.entries(e).map(([t,r])=>GD(t,r)))}))),Dte=Ge(e1,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>zw,toCodec:()=>Ne()(Zu(z,z),Fe({decode:Zo,encode:e=>({...e})}))}),SA=Ge(Vw,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Gw,toCodec:()=>Ne()(ct(rs([z,z])),Fe({decode:Rl,encode:e=>e.params}))}),Lte=(e,t)=>SA.pipe(ee(mA(Ym,t),Xt({decode:r=>Zt(i1(r,e),{onNone:()=>D(new At([e],new Yt(void 0))),onSome:I}),encode:r=>I(Rl([[e,r]]))}))),Bte=SA.pipe(ee(Zu(z,Pe([z,Qu(z)])),Fe({decode:c1,encode:Pu})));function $te(e){return Vu(e).pipe(ee(ba(oo(e)),r2()))}function jte(e){return lr(e).pipe(ee(ba(oo(e)),n2()))}function Hte(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return lr(iA(e)).pipe(ee(ba(oo(e)),Vy({decode:o=>o.pipe(Fa(mx),N),encode:r==="omit"?Xc:o=>N(Ma(Xc(o),()=>n))})))}function Zj(e,t){let r=typeof t?.label=="string"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?ot(fr(r)):void 0,i=Cr()([e],([a])=>(c,u,f)=>{if(am(c)){let p=s!==void 0?Eu(s(c.label,f),m=>new At(["label"],m)):P;return ur(p,()=>cr(ot(a)(nc(c),f),{onSuccess:m=>_u(m,{label:c.label}),onFailure:()=>new Ft(u,[new At(["value"],new le(void 0,c,f))],c,f)}))}return D(new at(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${H(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Ne()(a,{decode:Ie(c=>_u(c,{label:r})),encode:n?$y(c=>"Cannot serialize Redacted"+(de(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Ie(nc)}),toEquivalence:([a])=>XD(a)});return J(i.ast,{value:e})}function qte(e,t){return ee(Zj(oo(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ie(r=>_u(r,{label:t?.label})),encode:t?.disallowEncode?$y(r=>"Cannot encode Redacted"+(de(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):Ie(nc)})(e)}function zte(e,t){let r=Cr()([e,t],([n,o])=>(s,i,a)=>{if(!Bf(s))return D(new at(i,s,a));switch(s._tag){case"Success":return cr(Qv(n)(s.success,a),{onSuccess:X,onFailure:c=>tn(i,"success",c,s,a)});case"Failure":return cr(Qv(o)(s.failure,a),{onSuccess:re,onFailure:c=>tn(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([n,o])=>Ne()(Pe([Te({_tag:fr("Success"),success:n}),Te({_tag:fr("Failure"),failure:o})]),Fe({decode:s=>s._tag==="Success"?X(s.success):re(s.failure),encode:s=>tt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return J(r.ast,{success:e,failure:t})}var Wte=globalThis.Symbol.for("immer-draftable"),eA={};function bA(e,t,r,n,o){let s=Vte(r,t,n),i=Qj(t),a=class extends e{constructor(...[c,u]){let p=u?.["~payload"],m=p?.token===eA?p.value:r.make(c??{},u);super(m,{...u,disableChecks:!0,"~payload":{token:eA,value:m}})}static[Km]=Km;get[i](){return i}static[Wte]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return V(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return dS(s(this))(c??{},u)}static makeOption(c,u){return lS(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Fs(this.ast,c))}static annotateKey(c){return this.rebuild(zl(this.ast,c))}static check(...c){return this.rebuild(Pi(this.ast,c))}static extend(c){return(u,f)=>{let p=ih(u)?u:Te(u),m={...r.fields,...p.fields},h=Xy(m,r.ast.checks,{identifier:c});return bA(this,c,sA(Pi(h,p.ast.checks),m),f,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(a.prototype,o(t)),a}function Kte(e){return new et(Ie(t=>new e(t,{"~payload":{token:eA,value:t}})),Oi())}function Qj(e){return`~effect/Schema/Class/${e}`}function Vte(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=Qj(t),i=u=>u instanceof o||O(u,s),a=Kte(o),c=J(new uc([e.ast],()=>(u,f,p)=>i(u)?I(u):D(new at(f,u,p)),{identifier:t,[Ly]:([u])=>({isConstructed:i,link:new jt(u,a)}),toCodec:([u])=>new jt(u.ast,a),toEquivalence:([u])=>u,toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[lm]:ac(e.ast),...r}));return n=ee(c,a)(e)}}function ih(e){return Gu(e)}var QS=e=>(t,r)=>{let n=ih(t)?t:Te(t);return bA(yP,e,n,r,o=>({toString(){return`${o}(${H({...this})})`}}))},Gte=e=>(t,r,n)=>{let o=ih(r)?r.mapFields(s=>({_tag:He(t),...s}),{unsafePreserveChecks:!0}):ya(t,r);return QS(e??t)(o,n)},Ar=e=>(t,r)=>{let n=ih(t)?t:Te(t);return bA(Yd,e,n,r,s=>({name:s}))},EA=e=>(t,r,n)=>{let o=ih(r)?r.mapFields(s=>({_tag:He(t),...s}),{unsafePreserveChecks:!0}):ya(t,r);return Ar(e??t)(o,n)};function Jte(e){return t=>t.annotate({toFormatter:e})}function Zte(e,t){return hB(e.ast,t)}function Qte(e){return t=>t.annotate({toEquivalence:e})}function Yte(e){return mC(e.ast)}function Xte(e,t){return Mm(e.ast,t)}function ere(e,t){let r=Mm(Jl(e.ast),t);return IS(r,t)}var tf=gS,tre=yS,rre=SS,nre=zL;function ore(e,t){return fB(e,t)}function sre(e){return IB(e)}function ire(e){return TB(e)}function are(e){return wB(e)}function cre(e,t){return r=>J(Fs(r.ast,{toCodecIso:()=>new jt(e.ast,Ky(t))}),{schema:r})}function ure(e){return uB(e)}function fre(e){let t=w$(()=>r),r=Pe([e,ct(t),Zu(z,t)]);return r}var YS=J(Fs(Bl,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),lre=Zu(z,YS),dre=Te({message:z,name:Vu(z),stack:Vu(z),cause:Vu(YS)}),pre=J(Fs(iL,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function mre(e){return da(e.ast)}function hre(e){return e.ast.context?.annotations}var Yj=bT;var bc=Yx,XS=VP,Tn=hp;var os=ea,Ni=$F;var jr=n0,Xj=VF;var eH="~effect/MutableRef",xre={[eH]:eH,...wr,toJSON(){return{_id:"MutableRef",current:pr(this.current)}}},hd=e=>{let t=Object.create(xre);return t.current=e,t};var tH=e=>e.current;var eb=d(2,(e,t)=>(e.current=t,e));var Hr=Symbol.for("effect/MutableList/Empty"),Ta=()=>({head:void 0,tail:void 0,length:0}),TA=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},rH=()=>({array:[],mutable:!0,offset:0,next:void 0}),zs=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=rH(),e.tail=e.tail.next):e.head=e.tail=rH(),e.tail.array.push(t),e.length++},wA=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var tb=(e,t)=>rb(e,Ct(t),!Array.isArray(t)),rb=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},Ia=e=>{e.head=e.tail=void 0,e.length=0},rf=(e,t)=>{if(t=Bt(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return Ia(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?Ia(e):TA(e),r;o=o.next}return Ia(e),r},nb=(e,t)=>{if(t=Bt(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){Ia(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,TA(e);return}r+=o,n=n.next}Ia(e)},Ec=e=>rf(e,e.length),nf=e=>{if(!e.head)return Hr;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:Ia(e):TA(e),t},nH=(e,t)=>{if(t=Bt(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let i=s.offset;i<s.array.length;i++)if(n[o++]=s.array[i],o===r)return n;s=s.next}return n};var vA=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){Ia(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},oH=(e,t)=>vA(e,r=>r!==t);var gre="~effect/PubSub";var yre="~effect/PubSub/Subscription",cb=e=>W(()=>wre(e.atomicPubSub(),new Map,Zn(),jr(!1),hd(!1),e.strategy(),hd(_()))),ub=e=>cb({atomicPubSub:()=>DA(e),strategy:()=>new sb}),fb=e=>cb({atomicPubSub:()=>DA(e),strategy:()=>new ib}),lb=e=>cb({atomicPubSub:()=>DA(e),strategy:()=>new UA}),ch=e=>cb({atomicPubSub:()=>sH(e),strategy:()=>new ib}),DA=e=>{let t=typeof e=="number"?{capacity:e}:e;if(vre(t.capacity),t.capacity===1/0)return sH(t);let r=t.replay&&t.replay>0?new ab(Math.ceil(t.replay)):void 0;return t.capacity===1?new OA(r):aU(t.capacity)===t.capacity?new kA(t.capacity,r):new CA(t.capacity,r)},sH=e=>{let t=e?.replay;return new PA(t&&t>0?new ab(Math.ceil(t)):void 0)};var uh=e=>Ci(ar(t=>(eb(e.shutdownFlag,!0),Ve(e.scope,Dg(t.id)).pipe(Vt(e.strategy.shutdown),uy(e.shutdownHook.open),vo)))),db=d(2,(e,t)=>W(()=>Sre(e,t))),Sre=d(2,(e,t)=>{if(e.shutdownFlag.current||de(e.ended.current))return!1;if(eb(e.ended,N(t)),e.strategy instanceof sb)for(let[n,o,s]of Ec(e.strategy.publishers))s&&hi(o,Mr(!1));let r=Mr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=nf(o))!==Hr;)hi(s,r)}return e.subscribers.clear(),!0});var pb=d(2,(e,t)=>L(()=>e.shutdownFlag.current||de(e.ended.current)?I(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),I(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag,e.ended))),iH=d(2,(e,t)=>e.shutdownFlag.current||de(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),aH=d(2,(e,t)=>L(()=>{if(e.shutdownFlag.current||de(e.ended.current))return I(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?I(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag,e.ended)})),fh=e=>Ci(yn(t=>{let r=Re(t,it),n=yr(e.scope),o=Tre(e.pubsub,e.subscribers,e.strategy,e.ended);return It(n,bre(o)).pipe(Vt(Wo(r,s=>Ve(n,s))),Pt(o))})),bre=e=>Ci(ar(t=>(eb(e.shutdownFlag,!0),Ko(Ec(e.pollers),r=>c0(r,t.id),{discard:!0,concurrency:"unbounded"}).pipe(_t(()=>W(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),uy(e.shutdownHook.open),vo)))),mb=e=>L(()=>{if(e.shutdownFlag.current)return Dn;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return I(r)}let t=e.pollers.length===0?e.subscription.poll():Hr;return t===Hr?uH(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),I(t))}),cH=e=>L(function t(r){if(e.shutdownFlag.current)return Dn;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?I(e.replayWindow.takeAll().concat(n)):Gr(n)?I(n):A(uH(e),o=>t([o]))}),uH=e=>Nn(t=>{if(e.shutdownFlag.current)return t(Dn);if(de(e.ended.current)){let o=e.pollers.length===0?e.subscription.poll():Hr;return o!==Hr?(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),t(I(o))):t(I(e.ended.current.value))}let r=fu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),zs(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],W(()=>oH(e.pollers,r)))});var tr=Symbol.for("effect/PubSub/AbsentValue"),Ere=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},Ire=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},Tre=(e,t,r,n)=>new FA(e,t,e.subscribe(),Ta(),jr(!1),hd(!1),r,e.replayWindow(),n),CA=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new xd(this.replayBuffer):hb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(n,s);if(i===0)return r;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=r[a++],f=this.publisherIndex%this.capacity;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=tr,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new AA(this,this.publisherIndex,!1)}},AA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return Hr}pollUpTo(t){if(t=Bt(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let i=this.subscriberIndex%this.self.capacity,a=this.self.array[i];this.self.subscribers[i]-=1,this.self.subscribers[i]===0&&(this.self.array[i]=tr,this.self.subscribersIndex+=1),o.push(a),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},kA=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new xd(this.replayBuffer):hb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(n,s);if(i===0)return r;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=r[a++],f=this.publisherIndex&this.mask;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=tr,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new RA(this,this.publisherIndex,!1)}},RA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return Hr}pollUpTo(t){if(t=Bt(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let i=this.subscriberIndex&this.self.mask,a=this.self.array[i];this.self.subscribers[i]-=1,this.self.subscribers[i]===0&&(this.self.array[i]=tr,this.self.subscribersIndex+=1),o.push(a),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},OA=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=tr;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new xd(this.replayBuffer):hb}pipe(){return V(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=tr,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new _A(this,this.publisherIndex,!1)}},_A=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return Hr;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=tr),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return Bt(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=tr)))}},PA=class{publisherHead={value:tr,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new xd(this.replayBuffer):hb}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=tr,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new MA(this,this.publisherTail,this.publisherIndex,!1)}},MA=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==tr?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;let t=!0,r=Hr;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==tr&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=tr,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=Bt(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===Hr?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==tr&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=tr,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},FA=class{[yre]={_A:F};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,i,a,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=i,this.strategy=a,this.replayWindow=c,this.ended=u}pipe(){return V(this,arguments)}},NA=class{[gre]={_A:F};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,i,a){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=i,this.ended=a}pipe(){return V(this,arguments)}},wre=(e,t,r,n,o,s,i)=>new NA(e,t,r,n,o,s,i),vre=e=>{if(e<=0||e!==1/0&&!Number.isInteger(e))throw new Error(`Cannot construct PubSub with capacity of ${e}`)},sb=class{publishers=Ta();get shutdown(){return ar(t=>Ko(Ec(this.publishers),([r,n,o])=>o?c0(n,t.id):P,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,r,n,o,s){return Nn(i=>{if(de(s.current))return i(I(!1));let a=fu();return this.offerUnsafe(n,a),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),tH(o)?(this.removeUnsafe(a),i(Dn)):a.effect?i(a.effect):(a.resumes=[i],W(()=>this.removeUnsafe(a)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=nf(this.publishers);if(o===Hr)n=!1;else{let[s,i]=o,a=t.publish(s);a&&o[2]?hi(i,Mr(!0)):a||wA(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){zs(this.publishers,[s,r,!0]);break}zs(this.publishers,[s,r,!1])}}removeUnsafe(t){vA(this.publishers,([r,n])=>n!==t)}},ib=class{get shutdown(){return P}handleSurplus(t,r,n,o){return I(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}},UA=class{get shutdown(){return P}handleSurplus(t,r,n,o,s){return W(()=>de(s.current)?!1:(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,i=!0;for(;i;){t.slide();let a=t.publish(s);a&&(o=n.next())&&!o.done?s=o.value:a&&(i=!1)}}}},LA=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let i=nf(o);if(i===Hr)Ire(r,n,o),o.length===0?s=!1:Ere(r,n,o);else{let a=n.poll();a===Hr?wA(o,i):(hi(i,Mr(a)),e.onPubSubEmptySpaceUnsafe(t,r))}}},BA=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},ab=class{capacity;head={value:tr,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:tr,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},xd=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=tr,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=Bt(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},hb={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var Cre="~effect/Queue",Are="~effect/Queue/Enqueue",kre="~effect/Queue/Dequeue";var $A={_A:F,_E:F},Rre={[Cre]:$A,[Are]:$A,[kre]:$A,...wr,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:_re(this)}}},io=e=>oe(t=>{let r=Object.create(Rre);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=Ta(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},q(r)}),of=e=>io({capacity:e});var yb=()=>io(),jn=d(2,(e,t)=>ce(()=>Ic(e,t)?Eb:e.state._tag==="Open"&&e.strategy==="suspend"?Nre(e,t):lH)),Ic=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(nf(e.messages),zs(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(zs(e.messages,t),dH(e),!0):!1:(zs(e.messages,t),gb(e),!0),wa=d(2,(e,t)=>$t(r=>{let n=Sb(e,t);return n.length===0||e.strategy==="dropping"?r(ze(n)):hH(e,{_tag:"Array",remaining:n,offset:0,resume:r})})),Sb=(e,t)=>{if(e.state._tag!=="Open")return Ct(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return tb(e.messages,t),e.strategy==="sliding"&&rf(e.messages,e.messages.length-e.capacity),gb(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return Ct(t);let n=[],o=0;for(let s of t)o<r?zs(e.messages,s):n.push(s),o++;return gb(e),n};var Ht=d(2,(e,t)=>ye(()=>Ui(e,t))),Ui=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=Pr(t),n=TM(r,Pre);return e.state.offers.size===0&&e.messages.length===0?(Ib(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},gb(e),!0)},gd=e=>Ht(e,Pf(Jc())),bb=e=>Ui(e,Pf(Jc()));var ss=e=>ye(()=>HA(e)),HA=e=>{if(e.state._tag==="Done")return!1;Ia(e.messages);let t=e.state.offers;Ib(e,e.state._tag==="Open"?Mre:e.state.exit);for(let r of t)xH(r);return!0};var sf=e=>fH(e,1,Number.POSITIVE_INFINITY);var fH=d(3,(e,t,r)=>(t=Bt(t),r=Bt(r),pH(()=>Fre(e,t,r)??bo(mH(e,()=>qA(e,t)),fH(e,t,r))))),Ws=e=>pH(()=>Ore(e)??bo(mH(e,()=>qA(e,1)),Ws(e)));var Ore=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=nf(e.messages);return jA(e),ze(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=gH(e.state.offers);return jA(e),ze(t)}};var _re=e=>e.state._tag==="Done"?0:e.messages.length;var lH=ze(!1),Eb=ze(!0),Pre=So(Jc()),Mre=Jf(),dH=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(hn),e.messages.length===0))break}},gb=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,dH(e)},0))},Fre=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return ze([]);if(!qA(e,t))return;let n=e.messages.length>0?rf(e.messages,r):[gH(e.state.offers)];return jA(e),ze(n)},pH=Uo({op:"QueueTake",[St](e){let t=this[Se]();return Vd(t)?t[St](e):t}}),qA=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,mH=(e,t)=>$t(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(hn);let n={ready:t,resume:r};return e.state.takers.add(n),ye(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),Nre=(e,t)=>$t(r=>Ic(e,t)?r(Eb):hH(e,{_tag:"Single",message:t,resume:r})),hH=(e,t)=>{if(e.state._tag!=="Open")return xH(t);let r=e.state.offers;return r.add(t),ye(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&Ib(e,e.state.exit))})},xH=e=>e._tag==="Single"?e.resume(lH):e.resume(ze(e.remaining.slice(e.offset))),gH=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(Eb),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(ze([]))),r},jA=e=>{if(e.state._tag==="Done")return wo(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Ib(e,e.state.exit),wo(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag==="Single")zs(e.messages,t.message),e.state.offers.delete(t),t.resume(Eb);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;zs(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(ze([]))}let n=e.state;if(n._tag==="Done")return wo(n.exit.cause)}return!1};var Ib=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var cf=e=>new zA(e),yH=(e,t,r)=>$t(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),ye(()=>{e.waiters.delete(o)})}),zA=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=ce(()=>this.free<t?yH(this,t,r):(this.taken+=t,q(t)));return r}takeIfAvailable(t){return ce(()=>this.free<t?q(!1):(this.taken+=t,q(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return oe(r=>(this.permits=t,this.free<0?pe:(this.releaseUnsafe(r,0),pe)))}release(t){return oe(r=>q(this.releaseUnsafe(r,t)))}get releaseAll(){return oe(t=>q(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Gn(n=>{let o=ce(()=>{if(this.free<t){let s=yH(this,t,pe);return Y(n(s),()=>o)}return this.taken+=t,Io(n(r),()=>{this.releaseUnsafe(ea(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Gn(n=>this.free<t?su:(this.taken+=t,Io(n(Gf(r)),()=>{this.releaseUnsafe(ea(),t)},!0)))}};var KA=e=>ws(e)?ft(e)?se(e.value):e:I(e);var IH="~effect/Channel",on=e=>O(e,IH),Ure={[IH]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return V(this,arguments)}},De=e=>{let t=Object.create(Ure);return t.transform=(r,n)=>rt(e(r,n),o=>I(je(o))),t},is=(e,t)=>De((r,n)=>A(we(e)(r,n),o=>t(o,n))),qr=e=>De((t,r)=>e),Vs=e=>De(me(function*(t,r){let n=yr(r),o=i=>Ve(n,Xg(i)),s=yield*to(e(t,r,n),o);return to(s,o)})),we=e=>e.transform,lh=4096,Dre=(e,t,r)=>io({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(_t(n=>It(e,ss(n))),_t(n=>zo(t(n),e).pipe(rt(o=>Ht(n,o)),gt(e))));var TH=(e,t)=>De((r,n)=>K(Dre(n,e,t),sf)),Tb=e=>De((t,r)=>L(()=>we(e())(t,r))),Lre=(e,t,r)=>Vs(me(function*(n,o,s){let i=_();yield*Wo(s,c=>de(i)?r(i.value,c):P);let a=yield*Ci(K(e,c=>(i=N(c),c)));return yield*we(t(a))(n,o)}));var wH=e=>qr(W(()=>{let t=e();return L(()=>{let r=t.next();return r.done?se(r.value):I(r.value)})})),VA=e=>qr(W(()=>{let t=0;return L(()=>t>=e.length?se():I(e[t++]))}));var GA=(e,t=lh)=>{let r=Lo(t);return qr(W(()=>{let n=e(),o=_();return L(()=>{if(o._tag==="Some")return se(o.value);let s=[];for(;s.length<r;){let i=n.next();if(i.done){if(s.length===0)return se(i.value);o=N(i.value);break}s.push(i.value)}return I(s)})}))};var vH=(e,t=lh)=>GA(()=>e[Symbol.iterator](),t),wb=e=>vb(I(e));var CH=e=>vb(W(e)),yd=qr(I(se())),AH=qr(I(Xn)),Di=e=>qr(I(D(e))),kH=e=>qr(oy(e)),dh=e=>qr(je(e)),RH=e=>qr(aa(e)),JA=e=>dh(al(e)),vb=e=>qr(W(()=>{let t=!1;return L(()=>t?se():(t=!0,e))}));var OH=e=>qr(A(e,()=>se())),ZA=e=>qr(I(A(e,KA)));var _H=e=>qr(I(sf(e)));var QA=e=>qr(I(yu(cH(e),()=>se())));var PH=e=>Tc(K(fh(e),QA)),MH=e=>Tc(K(fh(e),t=>ZA(mb(t))));var FH=e=>De((t,r)=>Bre({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var Bre=e=>{let t=e.readable.getReader(),r=e.exit??hd(void 0),n=L(()=>r.current?r.current:Un(Vo({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??je(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?se():I(Me(s))}));return Pt(It(e.scope,e.releaseLockOnEnd?W(()=>t.releaseLock()):zp(()=>t.cancel().catch(Rr))),n)},$re=(e,t)=>De(me(function*(r,n){let o=e[Symbol.asyncIterator]();return o.return&&(yield*It(n,zp(()=>o.return()))),A(Vo({try:()=>o.next(),catch:t}),s=>s.done?se(s.value):I(s.value))})),NH=(e,t)=>Gs($re(e,t),Me),Gs=d(2,(e,t)=>is(e,r=>W(()=>{let n=0;return K(r,o=>t(o,n++))})));var UH=d(2,(e,t)=>is(e,r=>I(ht(r,n=>A(t(n),se))))),DH=e=>e===void 0||e!=="unbounded"&&e<=1,Cb=d(e=>on(e[0]),(e,t,r)=>DH(r?.concurrency)?LH(e,t):jre(e,t,r)),LH=(e,t)=>De((r,n)=>{let o=0;return K(we(e)(r,n),A(s=>t(s,o++)))}),jre=(e,t,r)=>Vs(me(function*(n,o,s){let i=0,a=yield*we(e)(n,o),c=r.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*of(0);yield*It(s,ss(u));let f=Sr(yield*Nr()),p=Ni(s);if(r.unordered){let m=cf(c),h=qe(m.release(1)),x=Un({onFailure:g=>A(Ht(u,g),h),onSuccess:g=>A(jn(u,g),h)});yield*m.take(1).pipe(A(()=>a),A(g=>{let y=i++;return p(f(x(L(()=>t(g,y))))),P}),Mt({disableYield:!0}),rt(g=>m.withPermits(c-1)(Ht(u,g))),gt(s))}else{let m=yield*of(c-2);yield*It(s,ss(m)),yield*Ws(m).pipe(j0,A(g=>jn(u,g)),Mt({disableYield:!0}),rt(g=>Ht(u,g)),gt(s));let h,x=g=>{g._tag!=="Success"&&(h=g.cause,Ui(u,g.cause))};yield*a.pipe(A(g=>{if(h)return je(h);let y=i++,E=f(L(()=>t(g,y)));return p(E),E.addObserver(x),jn(m,bc(E))}),Mt({disableYield:!0}),rt(g=>jn(m,ir(g)).pipe(Vt(Ht(m,g)))),gt(s))}return Ws(u)}));var YA=d(e=>on(e[0]),(e,t,r)=>DH(r?.concurrency)?Hre(e,t):qre(e,t,r)),Hre=(e,t)=>De((r,n)=>K(we(e)(r,n),o=>{let s,i,a=A(o,u=>(i??=yr(n),ur(we(t(u))(r,i),f=>(s=c(f),s)))),c=ht(u=>{if(s=void 0,i.state._tag==="Empty")return a;let f=Ve(i,Kt);return i=void 0,A(f,()=>a)});return L(()=>s??a)})),qre=(e,t,r)=>e.pipe(Gs(t),Rb(r)),BH=d(2,(e,t)=>De((r,n)=>W(()=>{let o,s=yr(n),i=A(we(e)(r,s),a=>(o=ht(a,c=>Ve(s,Kt).pipe(A(()=>we(t(c))(r,n)),A(u=>(o=u,u)))),o));return L(()=>o??i)})));var XA=d(4,(e,t,r,n)=>De(me(function*(o,s){let i=yield*we(e)(o,s),a=yield*we(t)(o,s),c=r();return L(()=>{let u=n(c,i,a);return K(u,([f,p])=>(c=p,f))})}))),$H=d(2,(e,t)=>De((r,n)=>W(()=>{let o,s=yr(n),i=A(we(e)(r,s),a=>{let c=a.pipe(_t(()=>(o=a,P)),ht(u=>Ve(s,Mr(u)).pipe(Vt(we(t(u))(r,n)),A(f=>(o=f,f)))));return o=c,c});return L(()=>o??i)}))),jH=e=>YA(e,F),wn=e=>is(e,t=>{let r,n=0,o=L(function s(){if(r===void 0)return A(t,a=>{switch(a.length){case 0:return s();case 1:return I(a[0]);default:return r=a,I(a[n++])}});let i=r[n++];return n>=r.length&&(r=void 0,n=0),I(i)});return I(o)}),HH=e=>LH(e,KA),qH=e=>is(e,t=>I(Mt(t,{disableYield:!0}))),zH=d(2,(e,t)=>ks(typeof t=="function"?t(F):t).pipe(K(r=>{let n=Fr.defaultValue();return WH(Mb(e,Fr,W(()=>n)),o=>r(o).pipe(K(s=>{n=s}),ht(()=>se(o))))}),Tc)),WH=(e,t)=>De((r,n)=>W(()=>{let o,s=()=>{let i=yr(n);return A(we(e)(r,i),a=>(o=ht(a,c=>Ve(i,Kt).pipe(A(()=>t(c)),A(s))),o))};return L(()=>o??s())})),KH=e=>WH(e,()=>P),VH=d(2,(e,t)=>is(e,(r,n)=>K(Dp(t),o=>_t(r,o)))),GH=d(2,(e,t)=>De((r,n)=>K(we(e)(r,n),o=>A(o,function s(i){return t(i)?I(i):A(o,s)}))));var JH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){let s=[];for(let i=0;i<o.length;i++)t(o[i])&&s.push(o[i]);return bt(s)?I(s):A(r,n)})))),ZH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){let s=[];for(let i=0;i<o.length;i++){let a=t(o[i]);tt(a)&&s.push(a.success)}return bt(s)?I(s):A(r,n)})))),QH=d(2,(e,t)=>is(e,r=>{let n=A(r,o=>G0(o,t));return I(A(n,function o(s){return bt(s)?I(s):A(n,o)}))})),YH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){return A(J0(o,t),s=>bt(s)?I(s):A(r,n))})))),Sd=d(e=>on(e[0]),(e,t,r,n)=>De((o,s)=>K(we(e)(o,s),i=>{let a=t(),c,u=0,f,p=Un(i,{onFailure(h){f=h;let x=n?.onHalt&&n.onHalt(a);return x&&x.length>0?I([a,x]):je(h)},onSuccess(h){let x=r(a,h);return Y_(x)?I(x):x}});return L(function h(){if(c===void 0)return f?je(f):A(p,([g,y])=>(a=g,y.length===0?h():y.length===1?I(y[0]):(c=y,h())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),I(x)})})));var XH=d(3,(e,t,r)=>De((n,o)=>K(we(e)(n,o),s=>{let i=t,a=!0;return L(()=>a?(a=!1,I(i)):K(A(s,c=>r(i,c)),c=>(i=c,i)))}))),bd=d(2,(e,t)=>De((r,n)=>{let o=yr(n);return K(we(e)(r,o),s=>{let i=s.pipe(rt(a=>{if(wo(a))return je(a);let c=o;return o=yr(n),Ve(c,ir(a)).pipe(Vt(we(t(a))(r,o)),A(u=>(i=u,u)))}));return L(()=>i)})})),eq=d(2,(e,t)=>kb(e,kp,t)),Ab=d(2,(e,t)=>bd(e,r=>OH(A(t(r),n=>je(r))))),tq=d(3,(e,t,r)=>bd(e,n=>t(n)?r(n):dh(n))),kb=d(3,(e,t,r)=>bd(e,n=>{let o=t(n);return be(o)?dh(o.failure):r(o.success,n)})),Ks=d(2,(e,t)=>kb(e,cl,r=>t(r)));var rq=d(2,(e,t)=>is(e,r=>I(Vp(r,n=>Rp(n)?P:vo(t(n)))))),nq=d(e=>on(e[0]),(e,t,r,n)=>Ks(e,o=>t(o)?r(o):n?n(o):Di(o))),oq=d(e=>on(e[0]),(e,t,r,n)=>Ks(e,o=>{let s=t(o);return be(s)?n?n(s.failure):Di(s.failure):r(s.success)}));var sq=d(e=>on(e[0]),(e,t,r,n,o)=>Ks(e,s=>{if(Or(s,t)&&O(s,"reason")){let i=s.reason;return Or(i,r)?n(i,s):o?o(i,s):Di(s)}return Di(s)})),iq=d(e=>on(e[0]),(e,t,r,n)=>{let o;return Ks(e,s=>{if(Or(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&Yg(s.reason._tag)){let i=s.reason;return o??=new Set(Object.keys(r)),o.has(i._tag)?r[i._tag](i,s):n?n(i,s):Di(s)}return Di(s)})});var aq=d(2,(e,t)=>Ks(e,r=>Di(t(r)))),cq=e=>Ks(e,JA),uq=d(e=>on(e[0]),(e,t)=>{if(!t?.log)return Ks(e,()=>yd);let r=Il(t.log===!0?void 0:t.log);return Ks(Ab(e,n=>gN(n)?r(n):P),()=>yd)}),bH=e=>bd(e,()=>yd),fq=d(e=>on(e[0]),(e,t)=>{if(!t?.log)return bH(e);let r=Il(t.log===!0?void 0:t.log);return bH(Ab(e,n=>r(n)))}),lq=d(2,(e,t)=>Tb(()=>{let r,n=Fr.defaultValue(),o=Mb(e,Fr,W(()=>n)),s=nk(o,()=>(r=void 0,P)),i=typeof t=="function"?t(F):t,a=Ks(s,me(function*(c){return r||(r=yield*ks(i)),n=yield*r(c),a},(c,u)=>ht(c,()=>I(Di(u))),Tc));return a})),dq=d(e=>on(e[0]),(e,t,r)=>e.pipe(Gs(t),Rb({...r,concurrency:r?.concurrency??1,switch:!0}))),Rb=d(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>Vs(me(function*(o,s,i){let a=r==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:cf(a),u=yield*Xj(!0),f=new Set,p=yield*of(t);yield*It(i,ss(p));let m=yield*we(e)(o,s);return yield*xt(function*(){for(;;){let h;c&&(f.size<a?yield*c.take(1):(h=yield*bl(m),yield*Ya(c.take(1),Vt(bc(h),Xn))));let x=h===void 0?yield*m:yield*bc(h),g=yr(i),y=yield*we(x)(o,g);for(;f.size>=a;){let b=K_(f);f.delete(b),f.size===0&&(yield*u.open),yield*Tn(b)}let E=yield*y.pipe(_t(()=>Kp),A(b=>jn(p,b)),Mt({disableYield:!0}),to(me(function*(b){let v=Xg(b),T=yield*eo(Ve(g,v));if(!f.has(E))return;let S=wN([v,T]);vs(S)&&(yield*Ht(p,S.cause)),f.delete(E),c&&(yield*c.release(1)),f.size===0&&(yield*u.open)})),bl);u.closeUnsafe(),f.add(E)}}).pipe(rt(h=>{let x=Np(h);return tt(x)?u.whenOpen(Ht(p,h)):Ht(p,h)}),gt(i)),Ws(p)}))),Ob=d(e=>on(e[0])&&on(e[1]),(e,t,r)=>Vs(me(function*(n,o,s){let i=r?.haltStrategy??"both",a=yield*of(0);yield*It(s,ss(a));let c=0;function u(p,m){if(c++,!wo(m))return Ht(a,m);switch(i){case"both":return c===2?Ht(a,m):P;case"left":case"right":return p===i?Ht(a,m):P;case"either":return Ht(a,m)}}let f=(p,m,h)=>we(m)(n,h).pipe(A(x=>x.pipe(A(g=>jn(a,g)),Mt)),to(x=>Jp(Xg(x),g=>Ve(h,g)).pipe(Un({onFailure:g=>u(p,g),onSuccess:()=>u(p,x)}))),gt(s));return yield*f("left",e,yr(s)),yield*f("right",t,yr(s)),Ws(a)}))),pq=d(2,(e,t)=>Ob(e,OH(t),{haltStrategy:"left"})),mq=()=>De((e,t)=>W(()=>{let r="",n=!1,o=_();function s(c){let u=[];function f(p){r.length===0?u.push(p):(u.push(r+p),r="")}for(let p=0;p<c.length;p++){let m=c[p];if(m.length!==0){let h=0,x=m.indexOf("\r"),g=m.indexOf(`
|
|
24
|
+
${t}}`),n},ST="~effect/Fiber",MV={_A:F,_E:F},FV={id:0},RP=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),KP=()=>RP===void 0?void 0:new RP("effect/Fiber"),ea=()=>globalThis[kf],pp=class{constructor(t,r=!0){this.setContext(t),this.id=++FV.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[ST](){return MV}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return Re(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Rr):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=$a(t);this.cache.stackFrame&&(n=Zd(n,ys(wx,this.cache.stackFrame))),r&&(n=Zd(n,r)),this._interruptedCause=this._interruptedCause?Pf(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ye(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Jc){this._asyncContext=KP();return}let n=iT.interruptChildren&&iT.interruptChildren(this);if(n!==void 0)return this.evaluate(Y(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=pt()}runLoop(t){let r=globalThis[kf];globalThis[kf]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Ye(this._interruptedCause)),this.currentOpCount++;let i=this.cache;if(!o&&!i.preventYield&&i.scheduler.shouldYield(this)){o=!0;let a=s;s=Y(Gf,()=>a)}if(s=i.tracerContext?i.tracerContext(s,this):s[St](this),s===Jc){let a=this._yielded;if(Kc in a)return this._deferredInterrupt=!1,this._yielded=void 0,a;if(this._deferredInterrupt){this._yielded=void 0,a();continue}return Jc}}catch(i){if(!O(s,St))return ln(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=ln(i)}}finally{this._running=n,globalThis[kf]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,UV;for(;;){let r=this._stack.pop();if(!r)return;let n=r[Vc];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&DV-1)===0)return ze(t);let r=this.getCont(mr);return r?r[mr](t,this):this.yieldWith(ze(t))}yieldWith(t){return this._yielded=t,Jc}children(){return this._children??=new Set}pipe(){return V(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&L_(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=NV(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag==="Span"?t:void 0}},NV=e=>{let t=Gi(e,QI);return{scheduler:Re(e,La),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Re(e,Zx),span:Gi(e,ZI),logLevel:Re(e,eT),minimumLogLevel:Re(e,tT),stackFrame:Re(e,zf),runtimeMetrics:Gi(e,CP),maxOpsBeforeYield:Re(e,xP),preventYield:Re(e,gP)}},UV={[mr](e,t){return Ye(t._interruptedCause)},[go](e,t){return Ye(t._interruptedCause)}},DV=32,iT={interruptChildren:void 0},dg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(yI.key,e.cache.stackFrame),qn(t)},LV=e=>{if(!(e._children===void 0||e._children.size===0))return Wf(e._children)},bT=e=>{let t=e;return t._exit?q(t._exit):$t(r=>t._exit?r(q(t._exit)):ye(e.addObserver(n=>r(q(n)))))},pg=e=>$t(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let i=r.next();for(;!i.done;){if(i.value._exit){n.push(i.value._exit),i=r.next();continue}o=i.value.addObserver(a=>{n.push(a),s()});return}t(q(n))}return s(),ye(()=>o?.())}),Xx=e=>{let t=e;return t._exit?t._exit:$t(r=>t._exit?r(t._exit):ye(e.addObserver(r)))},VP=e=>$t(t=>{let r=Array.from(e);if(r.length===0)return t(q(Qt()));let n=new Array(r.length),o=Qt(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},i=0,a=!1;for(let c=0;c<r.length&&!a;c++){let u=f=>{if(i++,f._tag==="Failure")return a=!0,s(),t(f);n[c]=f.value,i===r.length&&t(q(n))};o.push(u),r[c].addObserver(u)}return ye(()=>{a=!0,s()})}),xp=e=>oe(t=>GP(e,t.id)),GP=d(e=>O(e[0],ST),(e,t,r)=>oe(n=>{let o=dg(n);return o=o&&r?Kr(o,r):o??r,e.interruptUnsafe(t,o),yp(bT(e))})),Wf=e=>oe(t=>{let r=dg(t),n=Qt();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return yp(pg(n))});var q=ze,Ye=Pr,Et=So,ye=Uo({op:"Sync",[St](e){let t=this[Se](),r=e.getCont(mr);return r?r[mr](t,e):e.yieldWith(ze(t))}}),ce=Uo({op:"Suspend",[St](e){return this[Se]()}}),ET=d(e=>e.length>=2||ci(e[0]),(e,t)=>fe(e)?Et(t?t():new ms("Effect.fromOption: Option.none")):q(e.value)),Vf=zn({onFailure:Et,onSuccess:q}),JP=e=>e==null?Et(new ms):q(e),IT=Uo({op:"Yield",[St](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(hn)},this[Se]??0),e.yieldWith(()=>{t=!0})}}),Gf=IT(0),TT=e=>q(N(e)),iu=q(_()),ZP=e=>fe(e)?iu:_e(e.value,N),QP=e=>ce(()=>Ye(e())),ta=e=>ln(e),mg=e=>ce(()=>Et(e())),pe=q(void 0);var YP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new hp(n,"An error occurred in Effect.try"):e.catch;return ce(()=>{try{return q(t())}catch(n){return Et(r(n))}})};var wT=e=>vT(function(t,r){e(r).then(n=>t(q(n)),n=>t(ta(n)))},e.length!==0),XP=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new hp(n,"An error occurred in Effect.tryPromise"):e.catch;return vT(function(n,o){let s=i=>ce(()=>{try{return Et(Pa(()=>r(i)))}catch(a){return ta(a)}});try{t(o).then(i=>n(q(i)),i=>n(s(i)))}catch(i){n(s(i))}},t.length!==0)},eM=e=>oe(t=>e(t.id)),tM=oe(q),rM=eM(q),vT=(function(){let e=yo({op:"Async",[St](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,i=this.register.call(r.cache.scheduler,a=>{n||(n=!0,o?r.evaluate(a):o=a)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&i===void 0?Jc:(r._stack.push(BV(()=>(n=!0,s?.abort(),i??hn))),Jc))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),BV=Uo({op:"AsyncFinalizer",[Vc](e){e.interruptible&&(e.interruptible=!1,e._stack.push(wp))},[go](e,t){return cg(e)?Y(rF(Pr(e),this[Se]()),()=>Ye(e)):Ye(e)}}),$t=e=>vT(e,e.length>=2),gp=$t(Rr),nM=(...e)=>{if(e.length===1){let n=e[0];return ce(()=>su(n()))}let[t,r]=e;return ce(()=>su(r.call(t.self)))},CT=(e,...t)=>{let r=t.length===0?function(){return ce(()=>su(e.apply(this,arguments)))}:function(){let n=ce(()=>su(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return AT(e.length,r)},AT=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),OP=rT(2),oM=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=Ir(),o;return n!==0&&(yt(2),o=new globalThis.Error,yt(n)),e?(s,...i)=>_P(t,s,o,i,e,r):_P(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},_P=(e,t,r,n,o,s)=>{let i=typeof t=="function"?t:n.shift().bind(t.self),a=`${e} (definition)`,c=r?OP(()=>r.stack):po;return AT(i.length,function(...u){let f=ce(()=>{let h=i.apply(this,arguments);return ge(h)?h:su(h)});for(let h=0;h<n.length;h++)f=n[h](f,...u);if(!ge(f))return f;let p=Ir(),m;return p!==0&&(yt(2),m=new globalThis.Error,yt(p)),na(o?mp(e,s,h=>lT(f,h)):f,zf,h=>({name:e,stack:m?OP(()=>m.stack):po,parent:{name:a,stack:c,parent:h}}))})},sM=(e,...t)=>AT(e.length,t.length===0?function(){return PP(()=>e.apply(this,arguments))}:function(){let r=PP(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),PP=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return q(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else{if(o&&o._tag==="Failure")return n.value;{let s=!0;return ce(()=>s?(s=!1,Y(n.value,i=>su(t,i))):ce(()=>su(e())))}}}}catch(t){return ta(t)}},su=(function(){let e=yo({op:"Iterator",[mr](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return q(s.value);if(Xe(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[St](r){return this[mr](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Zr=d(2,(e,t)=>new ra(e,kT,q(t))),hg=function(e){return e._stack.push(this),this[Se]},$V=yo({op:"OnSuccess",[St]:hg}),ra=function(e,t,r){this[Se]=e,this[mr]=t,this.payload=r};ra.prototype=$V;var kT=function(){return this.payload},iM=function(e,t){return t.succeedWith(this.payload)},xg=(()=>{let e=Ir();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};yt(1);let n=r[t]();return yt(e),n.stack?.includes("[as "+t+"]")===!0})(),jV=function(e,t){let r=this.payload;return t.succeedWith(xg?r(e):Pa(()=>r(e)))},aM=function(e){let t=this.payload;return t(e)},HV=function(e){let t=this.payload;return new ra(t(e),iM,e)},qV=function(e){return new ra(this.payload,iM,e)},Jf=e=>_e(e,N),cM=e=>Xf(e,{onFailure:q,onSuccess:Et}),bo=d(2,(e,t)=>new ra(e,ge(t)?kT:aM,t)),pi=d(2,(e,t)=>new ra(e,ge(t)?qV:HV,t)),yp=e=>new ra(e,kT,hn),uM=e=>Mn(e,Et),RT=(e,t)=>oe(r=>{let n=new Set;return Wa(r,()=>n.size===0?void 0:Wf(n)),$t(o=>{let s=Ct(e),i=s.length,a=0,c=!1,u=[],f=(p,m,h)=>{if(a++,p._tag==="Failure"){u.push(...p.cause.reasons),a>=i&&o(Ye(zi(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:m,index:h,parentFiber:r})};for(let p=0;p<i;p++){let m=cu(r,s[p],!0,!0,!1);if(n.add(m),m.addObserver(h=>{n.delete(m),f(h,m,p)}),c)break}})}),OT=(e,t)=>oe(r=>{let n=new Set;return Wa(r,()=>n.size===0?void 0:Wf(n)),$t(o=>{let s=!1,i=0;for(let a of e){if(s)break;let c=i++,u=cu(r,a,!0,!0,!1);n.add(u),u.addObserver(f=>{n.delete(u);let p=!s;s=!0,o(f),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),fM=d(e=>ge(e[1]),(e,t,r)=>RT([e,t],r)),_T=d(e=>ge(e[1]),(e,t,r)=>OT([e,t],r)),Y=d(2,(e,t)=>new ra(e,aM,t)),lM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):di(e,t)),Xe=e=>e[Kc]!==void 0,dM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?t(e.value):e:Y(e,t)),pM=e=>Y(e,F),_e=d(2,(e,t)=>new ra(e,jV,t)),mM=d(2,(e,t)=>Xe(e)?bM(e,t):_e(e,t)),hM=d(2,(e,t)=>Xe(e)?EM(e,t):BT(e,t)),xM=d(2,(e,t)=>Xe(e)?IM(e,t):$T(e,t)),gM=d(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return e;let r=qo(e.cause);return be(r)?e:t(r.success)}return Es(e,t)}),Zf=e=>Pr($a(e)),Qf=e=>e._tag==="Success";var yM=e=>e._tag==="Failure";var SM=e=>e._tag==="Failure"?X(e.cause):re(e);var PT=e=>e._tag==="Failure"&&cg(e.cause);var hn=ze(void 0),bM=d(2,(e,t)=>e._tag==="Success"?ze(t(e.value)):e),EM=d(2,(e,t)=>{if(e._tag==="Success")return e;let r=qo(e.cause);return be(r)?e:So(t(r.success))}),IM=d(2,(e,t)=>{if(e._tag==="Success")return ze(t.onSuccess(e.value));let r=qo(e.cause);return be(r)?e:So(t.onFailure(r.success))});var TM=d(2,(e,t)=>Qf(e)?t:e),wM=d(2,(e,t)=>Qf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var MT=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?hn:Pr(zi(t))};var vM=e=>e,CM=e=>oe(t=>q(Nx(t.context,e))),zV=e=>oe(t=>ET(Nx(t.context,e))),Yf=d(2,(e,t)=>oe(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),Wa(r,()=>{r.setContext(n)})),e})),na=d(3,(e,t,r)=>Yf(e,n=>{let o=dn(n,t),s=r(o);return o===s?n:We(n,t,s)})),AM=(e,t,r)=>au(oe(n=>{let o=dn(n.context,e),s=t(o);return n.setContext(We(n.context,e,s)),qa(dn(n.context,Ha),i=>{let a=Nx(n.context,e);if(fe(a))return pe;let c=a.value,u;if(r?.reset===void 0){if(c!==s)return pe;u=o}else u=r.reset(o,s,c);return n.setContext(We(n.context,e,u)),pe})})),FT=()=>WV,WV=oe(e=>q(e.context)),ja=e=>oe(t=>e(t.context)),kM=d(2,(e,t)=>Yf(e,qe(t))),Eo=d(2,(e,t)=>Xe(e)?e:Yf(e,Kr(t))),Pn=function(){return arguments.length===1?d(2,(e,t)=>MP(e,arguments[0],t)):d(3,(e,t,r)=>MP(e,t,r)).apply(this,arguments)},MP=(e,t,r)=>Yf(e,We(t,r)),gg=d(3,(e,t,r)=>Y(r,n=>Pn(e,t,n))),RM=d(e=>ge(e[1]),(e,t,r)=>NT(e,t,(n,o)=>[n,o],r)),NT=d(e=>ge(e[1]),(e,t,r,n)=>n?.concurrent?_e(ol([e,t],{concurrency:2}),([o,s])=>r(o,s)):Y(e,o=>_e(t,s=>r(o,s)))),OM=d(e=>ge(e[0]),(e,t,r)=>QT(e,t,r?n=>Et(r(n)):()=>Et(new ms))),_M=d(2,(e,t)=>Y(t,r=>r?Jf(e):iu)),UT=d(2,(e,t)=>Array.from({length:t},()=>e)),PM=d(e=>ge(e[0]),(e,t,r)=>ol(UT(e,t),r)),yg=d(e=>ge(e[0]),(e,t)=>mi({while:nr,body:qe(t?.disableYield?e:Y(e,r=>Gf)),step:Rr})),Mn=d(2,(e,t)=>new MM(e,t.length!==1?r=>t(r):t)),KV=yo({op:"OnFailure",[St]:hg}),MM=function(e,t){this[Se]=e,this[go]=t};MM.prototype=KV;var DT=d(3,(e,t,r)=>Mn(e,n=>t(n)?r(n):Ye(n))),oa=d(3,(e,t,r)=>Mn(e,n=>{let o=t(n);return be(o)?Ye(o.failure):r(o.success,n)})),Es=d(2,(e,t)=>oa(e,qo,r=>t(r))),FM=e=>Xf(e,{onFailure:t=>SI(t)?iu:Et(t),onSuccess:TT}),NM=d(2,(e,t)=>oa(e,ag,t)),UM=d(2,(e,t)=>Mn(e,r=>bo(t(r),Ye(r)))),DM=d(3,(e,t,r)=>DT(e,t,n=>bo(r(n),Ye(n)))),Sg=d(3,(e,t,r)=>Mn(e,n=>{let o=t(n);return be(o)?Ye(n):bo(r(o.success,n),Ye(n))})),LT=d(2,(e,t)=>Sg(e,qo,r=>t(r))),LM=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):Or(t);return LT(e,o=>n(o)?r(o):pe)}),BM=d(2,(e,t)=>Sg(e,ag,r=>t(r))),Sp=d(e=>ge(e[0]),(e,t,r,n)=>Mn(e,o=>{let s=qo(o);return be(s)?Ye(s.failure):t(s.success)?r(s.success):n?n(s.success):Ye(o)})),bg=d(e=>ge(e[0]),(e,t,r,n)=>Mn(e,o=>{let s=qo(o);if(be(s))return Ye(s.failure);let i=t(s.success);return be(i)?n?n(i.failure):Ye(o):r(i.success)})),Eg=d(e=>ge(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):Or(t);return Sp(e,o,r,n)}),$M=d(e=>ge(e[0]),(e,t,r)=>{let n;return bg(e,o=>(n??=Object.keys(t),O(o,"_tag")&&On(o._tag)&&n.includes(o._tag)?X(o):re(o)),o=>t[o._tag](o),r)}),jM=d(e=>ge(e[0]),(e,t,r,n,o)=>Sp(e,s=>Or(s,t)&&O(s,"reason")&&(o!==void 0||Or(s.reason,r)),s=>{let i=s.reason;return Or(i,r)?n(i,s):o?o(i,s):Et(s)})),HM=d(e=>ge(e[0]),(e,t,r,n)=>{let o;return Sp(e,s=>Or(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&On(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let i=s.reason;return o??=Object.keys(r),o.includes(i._tag)?r[i._tag](i,s):n?n(i,s):Et(s)})}),qM=d(2,(e,t)=>bg(e,r=>Or(r,t)&&O(r,"reason")?X(r.reason):re(r),Et)),BT=d(2,(e,t)=>Es(e,r=>mg(()=>t(r)))),$T=d(2,(e,t)=>Xf(e,{onFailure:r=>mg(()=>t.onFailure(r)),onSuccess:r=>ye(()=>t.onSuccess(r))})),Ig=e=>Es(e,ta),zM=d(2,(e,t)=>Es(e,r=>ye(()=>t(r)))),WM=e=>ce(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return ta(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:Es(o.value,i=>n(s))}return n(r)}),jT=e=>Es(e,t=>Y(Gf,()=>jT(e))),KM=d(e=>ge(e[0]),(e,t)=>{if(!t?.log)return Xf(e,{onFailure:n=>pe,onSuccess:n=>pe});let r=Ts(t.log===!0?void 0:t.log);return di(e,{onFailure(n){let o=LP(n);return be(o)?Ye(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>pe})}),Tg=d(e=>ge(e[0]),(e,t)=>{if(!t?.log)return di(e,{onFailure:n=>pe,onSuccess:n=>pe});let r=Ts(t.log===!0?void 0:t.log);return di(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>pe})}),VM=e=>wg(e,{onFailure:_,onSuccess:N}),Ba=e=>bp(e,{onFailure:re,onSuccess:X}),di=d(2,(e,t)=>new GM(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),VV=yo({op:"OnSuccessAndFailure",[St]:hg}),GM=function(e,t,r){this[Se]=e,this[mr]=t,this[go]=r};GM.prototype=VV;var GV=function(e,t){let r=this.payload;return t.succeedWith(xg?r.onSuccess(e):Pa(()=>r.onSuccess(e)))},JM=(e,t)=>{let r=yo({op:e,[St]:hg,[mr]:GV,[go]:t}),n=function(o,s){this[Se]=o,this.payload=s};return n.prototype=r,n},JV=JM("Match",function(e,t){let r=e.reasons.find(hs);if(r===void 0)return Ye(e);let n=this.payload;return t.succeedWith(xg?n.onFailure(r.error):Pa(()=>n.onFailure(r.error)))}),ZV=JM("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(xg?r.onFailure(e):Pa(()=>r.onFailure(e)))}),HT=d(2,(e,t)=>new ZV(e,t)),Xf=d(2,(e,t)=>di(e,{onFailure:r=>{let n=r.reasons.find(hs);return n?t.onFailure(n.error):Ye(r)},onSuccess:t.onSuccess})),wg=d(2,(e,t)=>new JV(e,t)),bp=d(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return ze(t.onSuccess(e.value));let r=qo(e.cause);return be(r)?e:ze(t.onFailure(r.success))}return wg(e,t)}),ZM=d(2,(e,t)=>Xe(e)?e._tag==="Success"?ze(t.onSuccess(e.value)):ze(t.onFailure(e.cause)):HT(e,t)),Ep=e=>Xe(e)?ze(e):QV(e),QV=Uo({op:"Exit",[St](e){return e._stack.push(this),this[Se]},[mr](e,t,r){return t.succeedWith(r??ze(e))},[go](e,t,r){return t.succeedWith(r??Pr(e))}}),QM=bp({onFailure:()=>!0,onSuccess:()=>!1}),YM=bp({onFailure:()=>!1,onSuccess:()=>!0}),XM=d(2,(e,t)=>bo(sl(t),e)),qT=d(2,(e,t)=>Y(zT(e,t.duration),r=>fe(r)?t.orElse():q(r.value))),YV=e=>new ng(`Operation timed out after '${qI(e)}'`),eF=d(2,(e,t)=>{let r=$e(t);return qT(e,{duration:r,orElse:()=>Et(YV(r))})}),zT=d(2,(e,t)=>_T(Jf(e),Zr(sl(t),_()))),tF=e=>Is(t=>{let r=t.monotonicTimeNanosUnsafe();return _e(e,n=>[$o(t.monotonicTimeNanosUnsafe()-r),n])}),aT="~effect/Scope",cT="~effect/Scope/Closeable",Ha=Ue("effect/Scope"),WT=(e,t)=>oe(r=>(rG(r),el(e,t)??pe)),el=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&tg(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return eg(r.finalizer,t);let n=r.finalizers;return n.size===1?eg(n.values().next().value,t):XV(e,n,t)},eg=(e,t)=>{try{return e(t)}catch(r){return ln(r)}},rF=(e,t)=>Qf(e)?t:Mn(t,r=>Ye(Pf(e.cause,r))),XV=CT(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),i=ea();for(let a=s.length-1;a>=0;a--){let c=s[a];e.strategy==="sequential"?n.push(yield*Ep(eg(c,r))):o.push(cu(i,eg(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*pg(o)),yield*MT(n)});var nF=(e,t)=>{let r=sF(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(za(e,r,n=>WT(r,n)),r)},qa=(e,t)=>ce(()=>e.state._tag==="Closed"?t(e.state.exit):(za(e,{},t),pe)),oF=(e,t)=>qa(e,qe(t)),za=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},tg=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=uT:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=uT))},tl=e=>sF(e,void 0),sF=(e="sequential",t)=>({[cT]:cT,[aT]:aT,strategy:e,parent:t,state:uT}),uT={_tag:"Empty"};var Ip=Ha,iF=Pn(Ha),vg=e=>oe(t=>{let r=t.context,n=tl();return t.setContext(We(t.context,Ha,n)),Wa(t,o=>(t.setContext(r),el(n,o))),e});var Cg=e=>ce(()=>{let t=tl();return To(e(t),r=>ce(()=>el(t,r)??pe))}),Ag=(e,t,r)=>ja(n=>Gn(o=>Y(Ip,s=>pi(r?.interruptible?o(e):e,i=>qa(s,a=>Eo(t(i,a),n)))))),rl=e=>Y(Ip,t=>ja(r=>qa(t,n=>Eo(e(n),r)))),aF=(function(){let e=yo({op:"OnExit",[St](r){return r._stack.push(this),this.effect},[Vc](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(wp),r.interruptible=!1)},[mr](r,n,o){o??=ze(r);let s;try{s=this.onExit(o)}catch(i){s=ln(i)}return s?Y(s,i=>o):o},[go](r,n,o){o??=Pr(r);let s;try{s=this.onExit(o)}catch(i){s=ln(i)}return s?Y(rF(o,s),i=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),Io=(e,t,r)=>new aF(e,t,r),Wa=(e,t)=>{e._stack.push(new aF(void 0,t,void 0))},To=d(2,Io),cF=d(2,(e,t)=>To(e,r=>t)),KT=d(3,(e,t,r)=>To(e,n=>t(n)?r(n):pe)),VT=d(3,(e,t,r)=>To(e,n=>{let o=t(n);return be(o)?pe:r(o.success,n)})),Tp=d(2,(e,t)=>VT(e,SM,t)),uF=d(3,(e,t,r)=>KT(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),GT=d(3,(e,t,r)=>To(e,n=>{if(n._tag!=="Failure")return pe;let o=t(n.cause);return be(o)?pe:r(o.success,n.cause)})),fF=d(2,(e,t)=>GT(yT,t)(e)),lF=(e,t,r)=>Gn(n=>Y(e,o=>Io(ce(()=>n(t(o))),s=>r(o,s),!0))),dF=e=>Ag(e,t=>O(t,Symbol.asyncDispose)?wT(()=>t[Symbol.asyncDispose]()):ye(()=>t[Symbol.dispose]())),JT=d(2,(e,t)=>ye(()=>pF(e,typeof t=="function"?r=>Wt($e(t(r))):qe(Wt($e(t)))))),eG=qe(1/0),pF=(e,t)=>{let r=0,n,o,s=(i,a)=>(a.awaiters++,Wa(i,()=>{if(!(--a.awaiters>0||o!==a))return o=void 0,xp(a.fiber)}),Xx(a.fiber));return[oe(i=>{if(o!==void 0)return i===o.fiber?Xx(o.fiber):s(i,o);if(n!==void 0&&(r===1/0||i.getRef(Vn).currentTimeMillisUnsafe()<r))return n;n=void 0;let a=i.getRef(Vn),c={fiber:new pp(i.context),awaiters:0};o=c;let u=s(i,c);return c.fiber.evaluate(Io(e,f=>{if(o!==c||(o=void 0,PT(f)))return;let p=t(f);r=p===1/0?1/0:a.currentTimeMillisUnsafe()+p,n=f})),c.fiber._exit??u}),ye(()=>{n=void 0})]},mF=d(2,(e,t)=>_e(JT(e,t),r=>r[0])),hF=e=>ye(()=>pF(e,eG)[0]),nl=oe(e=>Ye($a(e.id))),au=e=>oe(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(wp)),e)),xF=Uo({op:"SetInterruptible",[Vc](e){if(e.interruptible=this[Se],e._interruptedCause&&e.interruptible)return()=>Ye(e._interruptedCause)}}),wp=xF(!0),tG=xF(!1),gF=e=>{if(e.interruptible=!0,e._stack.push(tG),e._interruptedCause)return Ye(e._interruptedCause)},rG=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(wp))};var kg=e=>oe(t=>t.interruptible?e:gF(t)??e),Gn=e=>oe(t=>t.interruptible?(t.interruptible=!1,t._stack.push(wp),e(kg)):e(F)),yF=e=>oe(t=>{if(t.interruptible)return e(F);let r=gF(t),n=e(au);return r??n}),SF=_e(Ag(ye(()=>new AbortController),e=>ye(()=>e.abort())),e=>e.signal),ol=(e,t)=>ti(e)?t?.mode==="result"?Kn(e,Ba,t):Kn(e,F,t):t?.discard?t.mode==="result"?Kn(Object.values(e),Ba,t):Kn(Object.values(e),F,t):ce(()=>{let r={};return Zr(Kn(Object.entries(e),([n,o])=>_e(t?.mode==="result"?Ba(o):o,s=>{B(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),ZT=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>_e(Kn(e,(n,o)=>Ba(t(n,o)),r),n=>BI(n,F))),bF=d(3,(e,t,r)=>{let n=Ct(e);return n.length===0?ye(t):ce(()=>{let o=0,s=t();return _e(mi({while:()=>o<n.length,body:()=>r(s,n[o],o),step(i){s=i,o++}}),()=>s)})}),EF=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>Y(ZT(e,t,{concurrency:r?.concurrency}),([n,o])=>Gr(o)?Et(o):r?.discard?pe:q(n))),IF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(_()):TF(r,0,t,n.value)})),TF=(e,t,r,n)=>Y(r(n,t),o=>{if(o)return q(N(n));let s=e.next();return s.done?q(_()):TF(e,t+1,r,s.value)}),wF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?q(_()):vF(r,0,t,n.value)})),vF=(e,t,r,n)=>Y(r(n,t),o=>{if(tt(o))return q(N(o.success));let s=e.next();return s.done?q(_()):vF(e,t+1,r,s.value)}),mi=Uo({op:"While",[mr](e,t){return this[Se].step(e),this[Se].while()?(t._stack.push(this),this[Se].body()):hn},[St](e){return this[Se].while()?(e._stack.push(this),this[Se].body()):hn}}),Kn=d(e=>typeof e[1]=="function",(e,t,r)=>ce(()=>{let n=vp(r?.concurrency);if(n===1)return nG(e,t,r);let o=Ct(e),s=o.length;if(s===0)return r?.discard?pe:q([]);let i=r?.discard?void 0:new Array(s),a=oG({f:t,out:i},o,{concurrency:n});return a?Zr(a,i):q(i)})),CF=e=>Y(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Et(new ms):q(r.value)}),nG=(e,t,r)=>ce(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return Zr(mi({while:()=>!s.done,body:()=>t(s.value,i++),step:a=>{n&&n.push(a),s=o.next()}}),n)}),vp=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),Rg=()=>e=>{let t=e.onItem,r=e.step,n=(s,i,a,c,u)=>Y(Ep(u),f=>r(s,i[a],f,a)??o(s,i,a+1,c)??pe),o=(s,i,a=0,c=i.length)=>{for(;a<c;a++){let u=i[a],f=t(s,u,a);if(!Xe(f))return n(s,i,a,c,f);let p=r(s,u,f,a);if(p)return p._tag==="Failure"?p:void 0}};return o},AF=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let i=0,a=s.end??o.length,c=s.concurrency,u=!1,f,p,m,h,x,g=E=>{let b=ln(E);return h=b,u=!0,p&&p.size>0?Y(au(Wf(Array.from(p))),()=>h??b):b},y=()=>{let E=!1;for(;!h&&i<a;i++){let b=o[i],v=x??t(n,b,i);if(Xe(v)){if(h=r(n,b,v,i),h)break}else if(f){x=void 0;let T=cu(f,v,!0,!0,"inherit");if(T._exit){if(h=r(n,b,T._exit,i),h)break;continue}p.add(T);let S=i;if(T.addObserver(w=>{p.delete(T);try{if(h){if(w._tag==="Failure"){let k=w.cause.reasons.filter(C=>C._tag!=="Interrupt");if(k.length>0){let C=zi(k);h=Pr(h._tag==="Failure"?Pf(h.cause,C):C)}}}else{let k=r(n,b,w,S);k&&(h=k,y())}if(E){let k=y();k&&m(k)}else u&&p.size===0&&m(h??pe)}catch(k){m(g(k))}}),p.size<c)continue;E=!0,i++;return}else return $t(T=>{f=ea(),p=new Set,x=v,m=T;let S;try{S=y()}catch(w){return T(g(w))}return S?T(S):ce(()=>(h??=hn,Y(p?Wf(p):pe,()=>h?._tag==="Failure"?h:pe)))})}if(u=!0,h){if(p&&p.size>0){let b=dg(f);p.forEach(v=>v.interruptUnsafe(f.id,b));return}if(m||h._tag==="Failure")return h}else if(m)if(p)p.size===0&&m(pe);else return hn};return y()}},Og=()=>e=>AF(e),oG=AF({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;e.out&&(e.out[n]=r.value)}}),QT=d(3,(e,t,r)=>Y(e,n=>t(n)?q(n):r(n))),YT=d(3,(e,t,r)=>Y(e,n=>{let o=t(n);return be(o)?r(o.failure):q(o.success)})),kF=d(e=>ge(e[0]),(e,t,r)=>YT(e,t,r?n=>Et(r(n)):()=>Et(new ms))),RF=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>ce(()=>{let n=[];return Zr(Kn(e,(o,s)=>{let i=t(o,s);return typeof i=="boolean"?(i&&n.push(o),pe):_e(i,a=>{a&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),OF=d(e=>ti(e[0])&&!ge(e[0]),(e,t)=>ce(()=>{let r=[];for(let n of e){let o=t(n);tt(o)&&r.push(o.success)}return q(r)})),_F=d(e=>ti(e[0])&&!ge(e[0]),(e,t,r)=>ce(()=>{let n=[];return Zr(Kn(e,o=>_e(t(o),s=>{tt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),PF=q({}),MF=Ax(_e),FF=kx(_e,Y),NF=Cx(_e);var UF=d(e=>ge(e[0]),(e,t)=>oe(r=>(bG(),q(cu(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),cu=(e,t,r=!1,n=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new pp(s.context,i);return n||(s.children().add(a),a._parent=s),r?a.evaluate(t):(a._asyncContext=KP(),s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0)),a},DF=d(e=>ge(e[0]),(e,t)=>oe(r=>q(cu(r,e,t?.startImmediately,!0,t?.uninterruptible)))),LF=e=>oe(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return Io(e,o=>{let s=t._children;if(s===void 0||s.size===0)return pe;r&&(s=G_(s,a=>!r.has(a)));let i=yp(pg(s));return n?kg(i):i})}),XT=d(e=>ge(e[0]),(e,t,r)=>oe(n=>{let o=cu(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};za(t,s,()=>eM(a=>a===o.id?pe:xp(o))),o.addObserver(()=>tg(t,s))}else o.interruptUnsafe(n.id,dg(n));return q(o)})),BF=d(e=>ge(e[0]),(e,t)=>Y(Ip,r=>XT(e,r,t))),sa=e=>(t,r)=>{let n=new pp(r?.scheduler?We(e,La,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}return r?.onFiberStart&&r.onFiberStart(n),n},$F=d(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(tg(t,e),za(t,e,()=>xp(e)),e.addObserver(()=>tg(t,e)),e)),jF=sa(pt()),e0=e=>{let t=sa(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},HF=e0(pt()),_g=e=>{let t=sa(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(i=>s(i))})}},qF=_g(pt()),t0=e=>{let t=_g(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw fg(o.cause);return o.value})},zF=t0(pt()),Pg=e=>{let t=sa(e);return r=>{if(Xe(r))return r;let n=new fi("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??ln(new ig(o))}},WF=Pg(pt()),r0=e=>{let t=Pg(e);return r=>{let n=t(r);if(n._tag==="Failure")throw fg(n.cause);return n.value}},KF=r0(pt()),FP=q(!0),NP=q(!1),fT=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return FP;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],FP}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](hn)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](hn)}open=oe(t=>this._isOpen?NP:(this._isOpen=!0,this.scheduleUnsafe(t)));release=oe(t=>this._isOpen?NP:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=$t(t=>this._isOpen?t(pe):(this.waiters.push(t),ye(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=ye(()=>this.closeUnsafe());whenOpen=t=>Y(this.await,()=>t);isOpen(){return this._isOpen}},n0=e=>new fT(e??!1),VF=e=>ye(()=>n0(e)),GF=oe(e=>q(e.getRef(YI))),JF=d(2,(e,t)=>Pn(e,YI,t)),ZF=Pn(Zx),QF=Pn(nu),rg=BigInt(0),sG={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:rg,endTime:rg,exit:hn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},iG=e=>Object.assign(Object.create(sG),e),YF=e=>e?Re(e.annotations,qf)?e._tag==="Span"?YF(_n(e.parent)):_():N(e):_(),o0=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&Re(r.annotations,qf),o=r?.parent!==void 0?N(r.parent):r?.root?_():YF(e.cache.span),s;if(n)s=iG({name:t,parent:o,annotations:We(r?.annotations??pt(),qf,!0)});else{let i=e.cache.tracer??XI,a=e.getRef(Vn),c=e.getRef(nu),u=e.getRef(lp),f=e.getRef(dp),p=r?.level??e.getRef(wP),m=r?.links!==void 0?[...f,...r.links]:f.length===0?[]:f.slice();s=i.span({name:t,parent:o,annotations:r?.annotations??pt(),links:m,startTime:c?a.currentTimeNanosUnsafe():rg,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(de(o)&&o.value.sampled===!1?!1:!lN(e.getRef(vP),p))});for(let h in u)s.attribute(h,u[h]);if(r?.attributes!==void 0)for(let h in r.attributes)s.attribute(h,r.attributes[h])}return s},XF=(e,t)=>oe(r=>q(o0(r,e,t))),bs=(e,t)=>au(oe(r=>{let n=dn(r.context,Ha),o=o0(r,e,t??{}),s=r.getRef(Vn),i=r.getRef(nu);return Zr(qa(n,a=>Mg(o,a,s,i)),o)})),eN=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return Y(bs(t,r),o=>Kf(n,o,r))}return n=>Y(bs(t,r),o=>Kf(n,o,r))},aG=(e,t)=>(t=typeof t=="function"?t:po,na(zf,r=>({name:e,stack:t,parent:r}))),tN=lp,rN=dp,nN=d(e=>ge(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return na(e,dp,s=>[...s,...o])}),Mg=(e,t,r,n)=>ye(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():rg,t)}),mp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return oe(o=>{let s=o0(o,e,r),i=o.getRef(Vn),a=o.getRef(nu);return Wa(o,c=>Mg(s,c,i,a)),n(s)})},lT=Pn(li),Kf=function(){let e=ge(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;return t._tag==="Span"&&(r=Ho(r),n=aG(t.name,r?.captureStackTrace)),e?lT(n(arguments[0]),t):o=>lT(n(o),t)},oN=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(arguments[2]);if(e){let s=arguments[0];return mp(t,arguments[2],i=>Kf(s,i,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...i)=>mp(t,n?n(...i):o,a=>Kf(s,a,r))},sN=d(e=>ge(e[0]),(e,...t)=>na(e,lp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||B(n,t[0],t[1]),n})),iN=(...e)=>oe(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return pe}),aN=oe(e=>{let t=e.currentSpanLocal;return t?q(t):Et(new ms)}),cN=zV(li),Vn=Ce("effect/Clock",{defaultValue:()=>new dT}),nT=2**31-1,dT=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=ye(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return cG()}currentTimeNanos=ye(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return fN()}monotonicTimeNanos=ye(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Wt(t))}sleepMillis(t){return t<=0?Gf:Number.isFinite(t)?$t(r=>{let n=t>nT?this.sleepMillis(t-nT):pe,o=setTimeout(()=>r(n),Math.min(t,nT));return ye(()=>clearTimeout(o))}):gp}},uN=BigInt(1e6),fN=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*uN;return r>t&&(t=r),t}})(),cG=(function(){let e=BigInt(1e9),t;return()=>{let r=fN(),n=BigInt(Date.now())*uN;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),Is=e=>oe(t=>e(t.getRef(Vn))),sl=e=>Is(t=>t.sleep($e(e))),s0=Is(e=>e.currentTimeMillis);var pT="~effect/Cause/TimeoutError";var ng=class extends Wi("TimeoutError"){[pT]=pT;constructor(t){super({message:t})}},mT="~effect/Cause/IllegalArgumentError";var og=class extends Wi("IllegalArgumentError"){[mT]=mT;constructor(t){super({message:t})}},hT="~effect/Cause/ExceededCapacityError";var sg=class extends Wi("ExceededCapacityError"){[hT]=hT;constructor(t){super({message:t})}},xT="~effect/Cause/AsyncFiberError";var ig=class extends Wi("AsyncFiberError"){[xT]=xT;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},gT="~effect/Cause/UnknownError";var hp=class extends Wi("UnknownError"){[gT]=gT;constructor(t,r){super({message:r,cause:t})}},uG=Ce("effect/Console",{defaultValue:()=>globalThis.console}),fG=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},lG=wI(Ki,fG),lN=Yc(lG),i0=Ce("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([yG,SG])}),dG=Ce("effect/Logger/LogToStderr",{defaultValue:Oa}),dN=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return au(oe(t=>{let r=t.getRef(Xi),n={...r};for(let o=0;o<e.length;o++){let[s,i]=e[o];B(n,s,i)}return t.setContext(We(t.context,Xi,n)),qa(dn(t.context,Ha),o=>{let s=t.getRef(Xi),i={...s};for(let a=0;a<e.length;a++){let[c,u]=e[a];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?B(i,c,r[c]):delete i[c])}return t.setContext(We(t.context,Xi,i)),pe})}))},pG="~effect/Logger",mG={[pG]:{_Message:F,_Output:F},pipe(){return V(this,arguments)}},pN=e=>{let t=Object.create(mG);return t.log=e,t},hG=e=>e.replace(/[\s="]/g,"_"),xG=(e,t)=>`${hG(e[0])}=${t-e[1]}ms`;var Ts=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];_f(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?zi(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=xI),oe(n=>{let o=e??n.cache.logLevel;if(lN(n.cache.minimumLogLevel,o))return pe;let s=n.getRef(Vn),i=n.getRef(i0);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:r,fiber:n,date:a,logLevel:o,message:t})}return pe})};var ou={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},qle={None:[],All:[],Trace:[ou.gray],Debug:[ou.blue],Info:[ou.green],Warn:[ou.yellow],Error:[ou.red],Fatal:[ou.bgBrightRed,ou.black]};var gG=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var yG=pN(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(lg(e));let i=t.getTime(),a=r.getRef(Qx),c="";for(let m of a)c+=` ${xG(m,i)}`;let u=r.getRef(Xi);Object.keys(u).length>0&&s.push(u);let f=r.getRef(uG);(r.getRef(dG)?f.error:f.log)(`[${gG(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),SG=pN(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Vn),s=t.getRef(Xi),i=t.cache.span;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))B(a,c,u);a["effect.fiberId"]=t.id,a["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(a["effect.cause"]=lg(e)),i.event(e_(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),a)});function bG(){iT.interruptChildren??=LV}var Fg=q(void 0);var mN=d(e=>ge(e[0]),(e,t)=>Tp(e,r=>oe(n=>(EG(n,r,t?.defectsOnly),pe)))),EG=(e,t,r)=>{let n=e.getRef(AP);if(n.size===0||r&&!BP(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Vn).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var il=_f,al=n_,Ng=hs;var uu=zi;var hN=Mf,cl=gI,xN=$a,Cp=e=>new Gc(e),Ap=e=>new Vd(e),kp=UP,a0=ug,Ka=jP;var fu=fg,gN=DP;var ul=qo;var Rp=ag,fl=cg;var yN=$P;var SN=lg;var ll=ms,Op=i_;var bN=Zc,se=c_;var Ug=og;var EN=sg;var ne={};ps(ne,{Do:()=>zJ,Transaction:()=>gl,TypeId:()=>UJ,abortSignal:()=>q8,acquireDisposable:()=>N8,acquireRelease:()=>Ti,acquireUseRelease:()=>zU,addFinalizer:()=>WU,all:()=>DJ,andThen:()=>Vt,annotateCurrentSpan:()=>Y8,annotateLogs:()=>py,annotateLogsScoped:()=>IZ,annotateSpans:()=>Q8,as:()=>Pt,asSome:()=>iy,asVoid:()=>vo,awaitAllChildren:()=>cZ,bind:()=>VJ,bindTo:()=>WJ,cached:()=>ly,cachedInvalidateWithTTL:()=>j8,cachedWithTTL:()=>$8,callback:()=>Nn,catch:()=>gu,catchCause:()=>rt,catchCauseFilter:()=>LU,catchCauseIf:()=>z0,catchDefect:()=>q0,catchEager:()=>my,catchFilter:()=>a8,catchIf:()=>i8,catchNoSuchElement:()=>c8,catchReason:()=>n8,catchReasons:()=>o8,catchTag:()=>UU,catchTags:()=>DU,clockWith:()=>bu,context:()=>Nr,contextWith:()=>yn,currentParentSpan:()=>eZ,currentSpan:()=>X8,delay:()=>ca,die:()=>gn,effectify:()=>MZ,ensuring:()=>wi,eventually:()=>p8,exit:()=>eo,fail:()=>D,failCause:()=>je,failCauseSync:()=>aa,failSync:()=>sy,fiber:()=>uZ,fiberId:()=>fZ,filter:()=>G0,filterMap:()=>T8,filterMapEffect:()=>J0,filterMapOrElse:()=>w8,filterMapOrFail:()=>v8,filterOrElse:()=>jU,filterOrFail:()=>HU,findFirst:()=>jJ,findFirstFilter:()=>HJ,firstSuccessOf:()=>y8,flatMap:()=>A,flatMapEager:()=>ur,flatten:()=>j0,flip:()=>t8,fn:()=>mZ,fnUntraced:()=>me,fnUntracedEager:()=>aw,forEach:()=>Ko,forever:()=>Mt,forkChild:()=>El,forkDetach:()=>Il,forkIn:()=>gt,forkScoped:()=>Rs,fromNullishOr:()=>YJ,fromOption:()=>ZJ,fromResult:()=>$0,gen:()=>xt,head:()=>qJ,ignore:()=>cy,ignoreCause:()=>uy,interrupt:()=>Dn,interruptible:()=>vi,interruptibleMask:()=>H8,isEffect:()=>Yr,isFailure:()=>O8,isSuccess:()=>_8,let:()=>KJ,linkSpans:()=>nZ,log:()=>hZ,logDebug:()=>SZ,logError:()=>Xp,logFatal:()=>xZ,logInfo:()=>yZ,logTrace:()=>bZ,logWarning:()=>gZ,logWithLevel:()=>Tl,makeSpan:()=>tw,makeSpanScoped:()=>rw,map:()=>K,mapBoth:()=>u8,mapBothEager:()=>cr,mapEager:()=>Eu,mapError:()=>yl,mapErrorEager:()=>Iu,match:()=>Z0,matchCause:()=>A8,matchCauseEager:()=>k8,matchCauseEffect:()=>Un,matchCauseEffectEager:()=>R8,matchEager:()=>C8,matchEffect:()=>qU,never:()=>Xn,onError:()=>to,onErrorFilter:()=>D8,onErrorIf:()=>U8,onExit:()=>Xr,onExitFilter:()=>B8,onExitIf:()=>L8,onExitPrimitive:()=>Zp,onInterrupt:()=>Su,option:()=>e8,orDie:()=>Ii,orElseSucceed:()=>g8,partition:()=>LJ,promise:()=>Wp,provide:()=>Q0,provideContext:()=>Ur,provideService:()=>Jo,provideServiceEffect:()=>F8,race:()=>I8,raceAll:()=>V0,raceAllFirst:()=>E8,raceFirst:()=>Ya,reduce:()=>BJ,repeat:()=>KU,repeatOrElse:()=>z8,replicate:()=>W8,replicateEffect:()=>ew,request:()=>iZ,requestUnsafe:()=>aZ,result:()=>XJ,retry:()=>ay,retryOrElse:()=>W0,runCallback:()=>lZ,runCallbackWith:()=>nw,runFork:()=>Yp,runForkWith:()=>Sr,runPromise:()=>ow,runPromiseExit:()=>dy,runPromiseExitWith:()=>dZ,runPromiseWith:()=>sw,runSync:()=>Ai,runSyncExit:()=>ki,runSyncExitWith:()=>pZ,runSyncWith:()=>iw,sandbox:()=>m8,satisfiesErrorType:()=>NZ,satisfiesServicesType:()=>UZ,satisfiesSuccessType:()=>FZ,schedule:()=>K8,scheduleFrom:()=>VU,scope:()=>Co,scoped:()=>ec,scopedWith:()=>Sl,service:()=>Y0,serviceOption:()=>yu,setContext:()=>P8,sleep:()=>ua,spanAnnotations:()=>tZ,spanLinks:()=>rZ,succeed:()=>I,succeedNone:()=>ia,succeedSome:()=>B0,suspend:()=>L,sync:()=>W,tap:()=>_t,tapCause:()=>Jp,tapCauseFilter:()=>d8,tapCauseIf:()=>l8,tapDefect:()=>BU,tapError:()=>Gp,tapErrorTag:()=>f8,timed:()=>b8,timeout:()=>K0,timeoutOption:()=>S8,timeoutOrElse:()=>$U,tracer:()=>V8,track:()=>wZ,trackDefects:()=>AZ,trackDuration:()=>kZ,trackErrors:()=>CZ,trackSuccesses:()=>vZ,transposeOption:()=>QJ,try:()=>Go,tryPromise:()=>Vo,tx:()=>RZ,txRetry:()=>PZ,undefined:()=>Kp,uninterruptible:()=>Ci,uninterruptibleMask:()=>en,unwrapReason:()=>s8,updateContext:()=>Xa,updateService:()=>X0,updateServiceScoped:()=>M8,useSpan:()=>Qp,validate:()=>$J,void:()=>P,when:()=>fy,whileLoop:()=>xn,withErrorReporting:()=>x8,withExecutionPlan:()=>h8,withFiber:()=>ar,withFiberSucceed:()=>JJ,withLogSpan:()=>TZ,withLogger:()=>EZ,withParentSpan:()=>bl,withSpan:()=>oZ,withSpanScoped:()=>sZ,withTracer:()=>G8,withTracerEnabled:()=>J8,withTracerTiming:()=>Z8,yieldNow:()=>Vp,yieldNowWith:()=>GJ,zip:()=>H0,zipWith:()=>r8});var ws=Gd,Mr=ze,ir=Pr,Jn=So,Dg=ln,Lg=Zf,Kt=hn;var ft=Qf,vs=yM;var IN=PT;var TN=wM;var wN=MT;var Fn={};ps(Fn,{CurrentMemoMap:()=>du,build:()=>LN,buildWithMemoMap:()=>gi,buildWithScope:()=>_p,catch:()=>LG,catchCause:()=>$G,catchTag:()=>BG,effect:()=>Qn,effectContext:()=>Ja,effectDiscard:()=>PG,empty:()=>_G,flatMap:()=>jN,forkMemoMap:()=>OG,forkMemoMapUnsafe:()=>d0,fresh:()=>jG,fromBuild:()=>Va,fromBuildMemo:()=>Wg,isLayer:()=>zg,launch:()=>HG,makeMemoMap:()=>RG,makeMemoMapUnsafe:()=>xi,merge:()=>FG,mergeAll:()=>Kg,mock:()=>qG,orDie:()=>Vg,parentSpan:()=>qN,provide:()=>As,provideMerge:()=>Pp,satisfiesErrorType:()=>KG,satisfiesServicesType:()=>VG,satisfiesSuccessType:()=>WG,span:()=>GG,succeed:()=>Ga,succeedContext:()=>pu,suspend:()=>MG,sync:()=>p0,syncContext:()=>u0,tap:()=>NG,tapCause:()=>DG,tapError:()=>UG,unwrap:()=>f0,updateService:()=>HN,withParentSpan:()=>l0,withSpan:()=>JG});var IG="~effect/Deferred";var TG={[IG]:{_A:F,_E:F},pipe(){return V(this,arguments)}},vN=function(){this.resumes=void 0,this.effect=void 0};vN.prototype=TG;var lu=()=>new vN;var Bg=e=>$t(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),ye(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var wG=d(2,(e,t)=>ye(()=>hi(e,t))),vG=wG;var CG=d(2,(e,t)=>vG(e,Pr(t)));var c0=d(2,(e,t)=>CG(e,$a(t)));var hi=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var CN=Xi;var AN=Qx,kN=zf;var jg=nu,RN=kP;var it=Ha;var Zn=tl,zo=iF,Wo=qa,It=oF;var yr=nF,Ve=WT;var DN="~effect/Layer",_N="~effect/Layer/MemoMap",AG=(e,t)=>{let r={observers:0,deferred:lu(),scope:Zn(),finalizer:n=>ce(()=>--r.observers>0?pe:(e.map.delete(t),Ve(r.scope,n)))};return r},PN=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,za(t,{},e.finalizer),!0),zg=e=>O(e,DN),kG={[DN]:{_ROut:F,_E:F,_RIn:F},pipe(){return V(this,arguments)}},mu=e=>{let t=Object.create(kG);return t.build=e,t},Va=e=>mu((t,r)=>{let n=yr(r);return To(e(t,n),o=>o._tag==="Failure"?Ve(n,o):pe)}),Wg=e=>{let t=Va((r,n)=>r.getOrElseMemoize(t,n,e));return t},qg=class{get[_N](){return _N}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(PN(n,r),n.deferred.effect??Bg(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return ce(()=>{let o;return Io(ce(()=>{let s=this.get(t,r);if(s)return s;let i=AG(this,t);return PN(i,r)?(o=i.deferred,this.map.set(t,i),n(this,i.scope)):n(this,r)}),s=>{o&&hi(o,s)})})}},xi=()=>new qg,d0=e=>new qg(e),RG=ye(xi),OG=e=>ye(()=>d0(e)),du=class e extends Ue()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Vi(t,e);return r?d0(r):xi()}},gi=d(3,(e,t,r)=>Pn(_e(ce(()=>e.build(t,r)),We(du,t)),du,t)),LN=e=>oe(t=>gi(e,du.forkOrCreate(t.context),dn(t.context,it))),_p=d(2,(e,t)=>oe(r=>gi(e,du.forkOrCreate(r.context),t))),Ga=function(){return arguments.length===1?e=>pu(ys(arguments[0],e)):pu(ys(arguments[0],arguments[1]))},pu=e=>mu(qe(q(e))),_G=pu(pt()),p0=function(){return arguments.length===1?e=>u0(()=>ys(arguments[0],e())):u0(()=>ys(arguments[0],arguments[1]()))},u0=e=>Wg(qe(ye(e))),Qn=function(){return arguments.length===1?e=>MN(arguments[0],e):MN(arguments[0],arguments[1])},MN=(e,t)=>Ja(_e(t,r=>ys(e,r))),Ja=e=>Wg((t,r)=>zo(e,r)),PG=e=>Ja(Zr(e,pt())),MG=e=>Wg((t,r)=>ce(()=>e().build(t,r))),FN=Ue("effect/Layer/unwrap"),f0=e=>jN(Qn(FN)(e),Re(FN)),BN=(e,t,r)=>{let n=yr(r,"parallel");return Kn(e,o=>o.build(t,yr(n,"sequential")),{concurrency:e.length}).pipe(_e(o=>j_(...o)))},Kg=(...e)=>Va((t,r)=>BN(e,t,r)),FG=d(2,(e,t)=>Kg(e,...Array.isArray(t)?t:[t])),$N=(e,t,r)=>Va((n,o)=>Y(Array.isArray(t)?BN(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Eo(s),_e(i=>r(i,s))))),As=d(2,(e,t)=>$N(e,t,F)),Pp=d(2,(e,t)=>$N(e,t,(r,n)=>Kr(n,r))),jN=d(2,(e,t)=>Va((r,n)=>Y(e.build(r,n),o=>t(o).build(r,n)))),NG=d(2,(e,t)=>Va((r,n)=>Y(e.build(r,n),o=>zo(Zr(t(o),o),n)))),UG=d(2,(e,t)=>Va((r,n)=>Es(e.build(r,n),o=>zo(bo(t(o),Et(o)),n)))),DG=d(2,(e,t)=>Va((r,n)=>Mn(e.build(r,n),o=>zo(bo(t(o),Ye(o)),n)))),Vg=e=>mu((t,r)=>Ig(e.build(t,r))),LG=d(2,(e,t)=>mu((r,n)=>Es(e.build(r,n),o=>t(o).build(r,n))));var BG=d(3,(e,t,r)=>mu((n,o)=>Eg(e.build(n,o),t,s=>r(s).build(n,o)))),$G=d(2,(e,t)=>mu((r,n)=>Mn(e.build(r,n),o=>t(o).build(r,n)))),HN=d(3,(e,t,r)=>As(e,Qn(t,_e(t,r)))),jG=e=>mu((t,r)=>e.build(xi(),r)),HG=e=>vg(bo(LN(e),gp)),qG=function(){return arguments.length===1?e=>NN(arguments[0],e):NN(arguments[0],arguments[1])},NN=(e,t)=>Ga(e)(new Proxy({...t},{get(r,n,o){if(n in r)return r[n];let s=Ir();yt(2);let i=new Error(`${e.key}: Unimplemented method "${n.toString()}"`);return yt(s),i.name="UnimplementedError",zG(i)},has:nr})),zG=e=>{let t=Object.assign(ta(e),{[UN]:UN,channel:{[Hg]:Hg,transform:()=>q(t),pipe(){return V(this,arguments)}},[Hg]:Hg,transform:()=>q(t)});function r(){return t}return Object.assign(r,t),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r},UN="~effect/Stream",Hg="~effect/Channel",WG=()=>e=>e,KG=()=>e=>e,VG=()=>e=>e,GG=(e,t)=>(t=Ho(t),Qn(li,t?.onEnd?pi(bs(e,t),r=>rl(n=>t.onEnd(r,n))):bs(e,t))),qN=e=>pu(li.context(e)),JG=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return f0(_e(r?.onEnd!==void 0?pi(bs(t,r),o=>rl(s=>r.onEnd(o,s))):bs(t,r),o=>l0(n,o,r)))}return n=>f0(_e(r?.onEnd!==void 0?pi(bs(t,r),o=>rl(s=>r.onEnd(o,s))):bs(t,r),o=>l0(n,o,r)))},l0=function(){let e=zg(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;t._tag==="Span"&&(r=Ho(r),n=ZG(t.name,r?.captureStackTrace));let o=qN(t);return e?As(n(arguments[0]),o):s=>As(n(s),o)},ZG=(e,t)=>(t=typeof t=="function"?t:po,HN(kN,r=>({name:e,stack:t,parent:r})));var Yn=Vn;var Gg="~effect/DateTime",Jg="~effect/DateTime/TimeZone",KN={[Gg]:Gg,pipe(){return V(this,arguments)},[Qe](){return this.toString()},toJSON(){return Np(this).toJSON()}},QG={...KN,_tag:"Utc",[ie](){return zt(this.epochMilliseconds)},[ae](e){return pl(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Np(this).toJSON()})`}},YG={...KN,_tag:"Zoned",[ie](){return he(zt(this.epochMilliseconds))(G(this.zone))},[ae](e){return pl(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&Z(this.zone,e.zone)},toString(){return`DateTime.Zoned(${v0(this)})`}},VN={[Jg]:Jg,[Qe](){return this.toString()}},XG={...VN,_tag:"Named",[ie](){return Be(`Named:${this.id}`)},[ae](e){return hu(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},eJ={...VN,_tag:"Offset",[ie](){return Be(`Offset:${this.offset}`)},[ae](e){return hu(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${I0(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},yi=(e,t,r)=>{let n=Object.create(YG);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},pl=e=>O(e,Gg);var hu=e=>O(e,Jg),GN=e=>hu(e)&&e._tag==="Offset",JN=e=>hu(e)&&e._tag==="Named",ZN=e=>e._tag==="Utc",x0=e=>e._tag==="Zoned",QN=Wr((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var YN=e=>{let t=Object.create(QG);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},dl=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Ug("Invalid date");return YN(t)},Qg=e=>{if(pl(e))return e;if(e instanceof Date)return dl(e);if(typeof e=="object"){if("epochMilliseconds"in e)return dl(new Date(e.epochMilliseconds));let t=new Date(0);return cJ(t,e),dl(t)}else if(typeof e=="string"&&!tJ(e))return dl(new Date(e+"Z"));return dl(new Date(e))},tJ=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),rJ=-864e13+720*60*1e3,nJ=864e13-840*60*1e3,g0=(e,t)=>{let r=t?.timeZone;if(r===void 0&&pl(e)&&x0(e))return e;let n=Qg(e);if(n.epochMilliseconds<rJ||n.epochMilliseconds>nJ)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e=="object"&&"timeZoneId"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Fp(s)}else if(hu(r))o=r;else if(typeof r=="number")o=Fp(r);else{let s=b0(r);if(fe(s))throw new Ug(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?yi(n.epochMilliseconds,o,n.partsUtc):uJ(n.epochMilliseconds,o,t?.disambiguation??"compatible")},m0=xs(g0),XN=xs(Qg),oJ=/^(.{17,35})\[(.+)\]$/,eU=e=>{let t=oJ.exec(e);if(t===null){let o=w0(e);return o!==null?m0(e,{timeZone:o}):_()}let[,r,n]=t;return m0(r,{timeZone:n})};var tU=e=>YN(e.epochMilliseconds);var Zg=new Map,sJ={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},iJ=e=>{let t=e.resolvedOptions().timeZone,r=Zg.get(t);if(r!==void 0)return r;let n=Object.create(XG);return n.id=t,n.format=e,Zg.set(t,n),n},y0=e=>{let t=Zg.get(e);if(t!==void 0)return t;try{let r=iJ(new Intl.DateTimeFormat("en-US",{...sJ,timeZone:e}));return Zg.set(e,r),r}catch{throw new Ug(`Invalid time zone: ${e}`)}},Fp=e=>{let t=Object.create(eJ);return t.offset=e,t},S0=xs(y0);var aJ=/^(?:GMT|[+-])/,b0=e=>{if(aJ.test(e)){let t=w0(e);return t===null?_():N(Fp(t))}return S0(e)},rU=e=>e._tag==="Offset"?I0(e.offset):e.id;var Np=e=>new Date(e.epochMilliseconds),Yg=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(n=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type==="fractionalSecond"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},E0=e=>Yg(e).getTime()-T0(e),I0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},nU=e=>I0(E0(e)),T0=e=>e.epochMilliseconds;var cJ=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var WN=1440*60*1e3,uJ=(e,t,r)=>{if(t._tag==="Offset")return yi(e-t.offset,t);let n=Mp(e-WN,e,t),o=Mp(e+WN,e,t);if(n===o)return yi(e-n,t);let s=n<o,i=n-o;if(s){if(Mp(e-o,e,t)===o)return yi(e-o,t);let u=yi(e-n,t),f=Yg(u).getTime();if(e!==f)switch(r){case"reject":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case"earlier":return yi(e-o,t);case"compatible":case"later":return u}return u}if(Mp(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||Mp(e-n+i,e+i,t)===n)return yi(e-n,t);if(r==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return yi(e-o,t)},fJ=/([+-])(\d{2}):(\d{2})$/,w0=e=>{let t=fJ.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Mp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=w0(n);return o===null?E0(yi(t,r)):o};var oU=e=>Np(e).toISOString();var h0=e=>{let t=Yg(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${nU(e)}`},v0=e=>e.zone._tag==="Offset"?h0(e):`${h0(e)}[${e.zone.id}]`;var Cde=globalThis.Number;var iU=d(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=sU(e),[o,s]=sU(t),i=Math.min(n,s),a=r*BigInt(10)**BigInt(n-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 f=globalThis.Number(`${u}e${i}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f});function sU(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf("e"),n=t.slice(0,r).replace(".","");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var aU=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var kde=globalThis.String,Xg=On;var cU=e=>e.trim();var ht=d(2,(e,t)=>oa(e,pJ,r=>t(r))),wo=e=>e.reasons.some(A0),A0=e=>e._tag==="Fail"&&Op(e.error),Up=e=>{let t,r=!1;for(let n of e.reasons)A0(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?re(e):r?re(uu(e.reasons.filter(n=>!A0(n)))):X(t)};var pJ=e=>{let t=Up(e);return be(t)?t:X(t.success.value)},ey=e=>{let t=Up(e);return be(t)?ir(t.failure):Mr(t.success.value)},Dp=d(2,(e,t)=>di(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=Up(r);return be(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var uU="~effect/Schedule";var Fr=Ce("effect/Schedule/CurrentMetadata",{defaultValue:qe({input:void 0,output:void 0,duration:Ji,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),mJ={[uU]:{_Out:F,_In:F,_Env:F},pipe(){return V(this,arguments)}},k0=e=>O(e,uU),ml=e=>{let t=Object.create(mJ);return t.step=e,t},R0=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,i=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:i}}},fU=e=>ml(_e(e,t=>{let r=R0();return(n,o)=>t(r(n,o))})),Qa=e=>Mn(e.step,t=>q(()=>Ye(t))),ks=e=>Is(t=>_e(Qa(e),r=>{let n=R0();return o=>ce(()=>{let s=t.currentTimeMillisUnsafe();return Y(r(s,o),([i,a])=>{let c=n(s,o);return c.output=i,c.duration=a,Zr(sl(a),c)})})})),Lp=e=>_e(ks(e),t=>r=>_e(t(r),n=>n.output));var lU=e=>ml(_e(ol(e.map(Qa)),t=>(r,n)=>Y(Kn(t,o=>Dp(o(r,n),{onSuccess:s=>q(s[1]),onDone:()=>Fg,onFailure:Ye})),o=>{let s=hJ(o);return s===void 0?se(Ji):q([s,s])}))),hJ=e=>{let t;for(let r=0;r<e.length;r++){let n=e[r];n!==void 0&&(t=t===void 0?n:dP(t,n))}return t},dU=(e,t=2)=>{let r=Wt($e(e));return fU(q(n=>{let o=Zi(r*Math.pow(t,n.attempt-1));return q([o,o])}))};var O0=e=>ml(_e(Qa(e),t=>(r,n)=>Dp(t(r,n),{onSuccess:o=>q([n,o[1]]),onFailure:Ye,onDone:()=>se(n)}))),pU=e=>Bp($p,({attempt:t})=>q(t<=e)),hl=e=>{let t=$e(e);return fU(q(r=>q([r.attempt-1,t])))};var Bp=d(2,(e,t)=>ml(_e(Qa(e),r=>{let n=R0();return(o,s)=>Y(r(o,s),i=>{let[a,c]=i,u=t({...n(o,s),output:a,duration:c});return Y(ge(u)?u:q(u),f=>f?q(i):se(a))})})));var $p=hl(Ji);var mU="~effect/ExecutionPlan";var xJ={[mU]:mU,get captureRequirements(){let e=this;return ja(t=>q(gJ(e.steps.map(r=>({...r,while:r.while?n=>Eo(r.while(n),t):void 0,schedule:r.schedule?ml(Eo(_e(Qa(r.schedule),n=>(o,s)=>Eo(n(o,s),t)),t)):void 0,provide:zg(r.provide)?As(r.provide,pu(t)):r.provide})))))},pipe(){return V(this,arguments)}},gJ=e=>{let t=Object.create(xJ);return t.steps=e,t};var ty=Ce("effect/ExecutionPlan/CurrentMetadata",{defaultValue:qe({attempt:0,stepIndex:0})});var yJ=(e,t,r)=>Cg(n=>Y(r?.local?gi(t,xi(),n):_p(t,n),o=>Eo(e,o))),ry=d(e=>ge(e[0]),(e,t,r)=>ip(t)?Eo(e,t):yJ(e,Array.isArray(t)?Kg(...t):t,r));var xU=e=>e.reasons.every(hs)?qo(e):re(e),P0=d(3,(e,t,r)=>Y(ks(t),n=>{let o=Fr.defaultValue();return oa(ht(yg(pi(Y(ce(()=>Pn(e,Fr,o)),n),s=>ye(()=>{o=s})),{disableYield:!0}),s=>q(s)),xU,s=>r(s,o.attempt===0?_():N(o)))})),M0=d(3,(e,t,r)=>Y(ks(t),n=>{let o=Fr.defaultValue(),s,i=oa(ce(()=>Pn(e,Fr,o)),xU,a=>(s=a,Y(n(a),c=>(o=c,i))));return ht(i,a=>Pa(()=>r(s,a)))})),gU=d(2,(e,t)=>{let r=typeof t=="function"?t(F):k0(t)?t:Hp(t);return P0(e,r,Et)}),jp=d(2,(e,t)=>{let r=typeof t=="function"?t(F):k0(t)?t:Hp(t);return M0(e,r,Et)}),yU=d(3,(e,t,r)=>Y(ks(r),n=>{let o=Fr.defaultValue(),s=ce(()=>Pn(e,Fr,o));return ht(Y(n(t),i=>{o=i;let a=qe(Y(s,n));return mi({while:nr,body:a,step(c){o=c}})}),i=>q(i))})),SJ=O0($p),Hp=e=>{let t=e.schedule?O0(e.schedule):SJ;return e.while&&(t=Bp(t,({input:r})=>{let n=e.while(r);return ge(n)?n:q(n)})),e.until&&(t=Bp(t,({input:r})=>{let n=e.until(r);return ge(n)?_e(n,o=>!o):q(!n)})),e.times!==void 0&&(t=Bp(t,({attempt:r})=>q(r<=e.times))),t};var F0=(e,t)=>{let r=-1,n=0,o=s=>Tg(e(s));return{begin:Is(s=>ce(()=>{let i=t();i.stepIndex!==r&&(r=i.stepIndex,n=0),n++;let a={attempt:i.attempt,stepAttempt:n,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Zr(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>Is(a=>{let c=$o(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})})}},bU=d(e=>ge(e[0]),(e,t,r)=>ce(()=>{let n=0,o={attempt:0,stepIndex:0},s=gg(ty,ye(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),i=r?.onEvent===void 0?void 0:F0(r.onEvent,()=>o),a=i===void 0?F:u=>Gn(f=>Y(i.begin,p=>To(f(u),m=>i.end(p,m)))),c;return Y(mi({while:()=>n<t.steps.length&&(c===void 0||be(c)),body(){let u=t.steps[n],f=s(a(ry(e,u.provide)));if(c){let p=!1,m=f;f=ce(()=>p?m:(p=!0,Vf(c))),f=jp(f,qp(u,!1))}else{let p=qp(u,!0);f=p?jp(f,p):f}return Ba(f)},step(u){c=u,n++}}),()=>Vf(c))})),qp=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return Hp({schedule:e.schedule?e.schedule:e.attempts?void 0:bJ,times:e.attempts,while:e.while});return Hp({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},bJ=pU(1);var IU="~effect/MutableHashMap";var EJ={[IU]:IU,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${H(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:pr(Array.from(this))}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},Si=()=>{let e=Object.create(EJ);return e.backing=new Map,e.buckets=new Map,e};var Qr=d(2,(e,t)=>{if(e.backing.has(t))return N(e.backing.get(t));if(N0(t))return _();let r=G(t),n=e.buckets.get(r);return n===void 0?_():IJ(e,n,t)}),N0=e=>typeof e!="object"&&typeof e!="function";var IJ=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(Z(r,t[n])){let s=t[n];return N(e.backing.get(s))}return _()},U0=d(2,(e,t)=>de(Qr(e,t))),bi=d(3,(e,t,r)=>{if(e.backing.has(t)||N0(t))return e.backing.set(t,r),e;let n=G(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=TJ(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),TJ=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(Z(t,e[r]))return e[r]};var Ei=d(2,(e,t)=>{if(N0(t))return e.backing.delete(t),e;let r=G(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let i=n[o];if(i===t||Z(t,i)){e.backing.delete(i),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),ny=e=>(e.backing.clear(),e.buckets.clear(),e),TU=e=>e.backing.size;var wJ="~effect/Request",vJ=ZO({_E:e=>e,_A:e=>e,_R:e=>e}),Jde={...r_,[wJ]:vJ};var wU=e=>e;var CU=d(2,(e,t)=>{let r=n=>$t(o=>{let s=kU(n,e,o,ea());return RJ(n,s)});return ge(t)?Y(t,r):r(t)}),AU=(e,t)=>{let r=kU(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:Re(t.context,La)}});return()=>RU(t.resolver,r)},AJ=new WeakSet,kJ=e=>{if(!AJ.has(e.batchKey))return new Map;let t=Si();return{get:r=>_n(Qr(t,r)),has:r=>U0(t,r),set:(r,n)=>bi(t,r,n),delete:r=>Ei(t,r)}},oy=[],D0=new WeakMap,kU=(e,t,r,n)=>{let o=D0.get(e);o||(o=kJ(e),D0.set(e,o));let s,i=!1,a=wU({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){i||(i=!0,!(s&&!s.entrySet.delete(a))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(oy.length>0)s=oy.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:Y(ce(()=>u.resolver.delay),f=>vU(u)),run:To(ce(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let p of u.entrySet)p.completeUnsafe(f._tag==="Success"?ln(new Error("Effect.request: RequestResolver did not complete request",{cause:p.request})):f);return u.entries.clear(),oy.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,oy.push(u)),pe})};s=u}o.set(c,s),s.fiber=sa(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=sa(n.context)(vU(s),{scheduler:n.cache.scheduler})),a},RU=(e,t)=>{if(t.uninterruptible)return;let r=D0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(Zf()),s?.interruptUnsafe()},RJ=(e,t)=>ye(()=>RU(e,t));function vU(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):pe}var _J="effect/Metric/CurrentMetricAttributes",PJ=Ce(_J,{defaultValue:()=>({})}),MJ="effect/Metric/MetricRegistry",FJ=Ce(MJ,{defaultValue:()=>new Map}),OU="~effect/Metric",_U=class{[OU]=OU;#e;#t="";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=Re(t,PJ);r!==this.#e&&(this.#e=r,this.#t=NJ(this,PU(this.attributes,r)));let n=Re(t,FJ),o=n.get(this.#t);return LO(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?PU(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#t,o)),o.hooks}pipe(){return V(this,arguments)}};var xl=d(2,(e,t)=>ja(r=>ye(()=>e.updateUnsafe(t,r))));function NJ(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function PU(e,t){return{...MU(e),...MU(t)}}function MU(e){return ei(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(B(t,r,n),t),{}):e}var UJ=si,Yr=ge,DJ=ol,LJ=ZT,BJ=bF,$J=EF,jJ=IF,HJ=wF,Ko=Kn,qJ=CF,xn=mi,Wp=wT,Vo=XP,I=q,ia=iu,B0=TT,L=ce,W=ye,P=pe;var Kp=Fg;var Nn=$t,Xn=gp,zJ=PF,WJ=MF,KJ=NF;var VJ=FF,xt=nM,D=Et,sy=mg,je=Ye,aa=QP,gn=ta,Go=YP;var Vp=Gf,GJ=IT,ar=oe,JJ=s_,$0=Vf,ZJ=ET,QJ=ZP,YJ=JP,A=Y,j0=pM,Vt=bo,_t=pi,XJ=Ba,e8=VM,eo=Ep,K=_e,Pt=Zr,iy=Jf,vo=yp,t8=cM,H0=RM,r8=NT,gu=Es;var UU=Eg,DU=$M,n8=jM,o8=HM,s8=qM,rt=Mn,q0=NM,i8=Sp,a8=bg,c8=FM,z0=DT,LU=oa,yl=BT,u8=$T,Ii=Ig,Gp=LT,f8=LM,Jp=UM,l8=DM,d8=Sg,BU=BM,p8=jT,ay=jp,W0=M0,m8=uM,cy=KM,uy=Tg,h8=bU,x8=mN,g8=zM,y8=WM,K0=eF,S8=zT,$U=qT,ca=XM,ua=sl,b8=tF,V0=RT,E8=OT,I8=fM,Ya=_T,G0=RF,T8=OF,J0=_F,jU=QT,w8=YT,HU=OM,v8=kF,fy=_M,Z0=wg,C8=bp,A8=HT,k8=ZM,R8=lM,Un=di,qU=Xf,O8=QM,_8=YM,Nr=FT,yn=ja,Q0=ry,Ur=Eo,P8=kM,Y0=vM,yu=CM,Xa=Yf,X0=na,M8=AM,Jo=Pn,F8=gg,Co=Ip,ec=vg,Sl=Cg,Ti=Ag,N8=dF,zU=lF,WU=rl,wi=cF,to=Tp,U8=uF,D8=GT,Zp=Io,Xr=To,L8=KT,B8=VT,ly=hF,$8=mF,j8=JT,Dn=nl,vi=kg,Su=fF,Ci=au,en=Gn,H8=yF,q8=SF,Mt=yg,KU=gU,z8=P0,W8=UT,ew=PM,K8=d(2,(e,t)=>VU(e,void 0,t)),VU=yU,V8=GF,G8=JF,J8=ZF,Z8=QF,Q8=sN,Y8=iN,X8=aN,eZ=cN,tZ=tN,rZ=rN,nZ=nN,tw=XF,rw=bs,Qp=mp,oZ=oN,sZ=eN,bl=Kf,iZ=CU,aZ=AU,El=UF,gt=XT,Rs=BF,Il=DF,cZ=LF,uZ=tM,fZ=rM,Yp=jF,Sr=sa,nw=e0,lZ=HF,ow=zF,sw=t0,dy=qF,dZ=_g,Ai=KF,iw=r0,ki=WF,pZ=Pg,me=CT,mZ=oM,bu=Is,Tl=Ts,hZ=Ts(),xZ=Ts("Fatal"),gZ=Ts("Warn"),Xp=Ts("Error"),yZ=Ts("Info"),SZ=Ts("Debug"),bZ=Ts("Trace"),EZ=d(2,(e,t)=>na(e,i0,r=>new Set([...r,t]))),py=d(e=>Yr(e[0]),(e,...t)=>na(e,CN,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||B(n,t[0],t[1]),n})),IZ=dN,TZ=d(2,(e,t)=>Y(s0,r=>na(e,AN,n=>[[t,r],...n]))),wZ=d(e=>Yr(e[0]),(e,t,r)=>Xr(e,n=>{let o=r===void 0?n:r(n);return xl(t,o)})),vZ=d(e=>Yr(e[0]),(e,t,r)=>_t(e,n=>{let o=r===void 0?n:r(n);return xl(t,o)})),CZ=d(e=>Yr(e[0]),(e,t,r)=>Gp(e,n=>{let o=r===void 0?n:r(n);return xl(t,o)})),AZ=d(e=>Yr(e[0]),(e,t,r)=>BU(e,n=>{let o=r===void 0?n:r(n);return xl(t,o)})),kZ=d(e=>Yr(e[0]),(e,t,r)=>bu(n=>{let o=n.monotonicTimeNanosUnsafe();return Xr(e,()=>{let s=n.monotonicTimeNanosUnsafe(),i=pP($e(s),$e(o)),a=r===void 0?i:r(i);return xl(t,a)})})),gl=class extends Ue()("effect/Effect/Transaction"){},RZ=e=>ar(t=>{let r=Vi(t.context,gl);if(r&&!NU.has(r))return e;r={journal:new Map,retry:!1};let n;return en(o=>A(xn({while:()=>!n,body:qe(o(e).pipe(Jo(gl,r),Jp(s=>r.retry?ug(s)?o(OZ(r)):W(()=>L0(r)):P),eo)),step(s){if(r.retry||!GU(r))return L0(r);ft(s)&&_Z(t,r),L0(r),NU.add(r),n=s}}),()=>n))}),NU=new WeakSet,GU=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},OZ=e=>Nn(t=>{if(!GU(e))return t(P);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let i of n)i.pending.delete(r)},s=()=>{o(),t(P)};for(let i of n)i.pending.set(r,s);return W(o)});function _Z(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function L0(e){e.retry=!1,e.journal.clear()}var PZ=A(gl,e=>(e.retry=!0,Dn)),MZ=(e,t,r)=>(...n)=>Nn(o=>{try{e(...n,(s,i)=>{o(s?t?L(()=>D(t(s,n))):D(s):I(i))})}catch(s){o(r?D(r(s,n)):gn(s))}}),FZ=()=>e=>e,NZ=()=>e=>e,UZ=()=>e=>e,Eu=mM,Iu=hM,cr=xM,ur=dM,my=gM,aw=sM;var JU=/^[+-]?\d+$/,uw="~effect/BigDecimal",DZ={[uw]:uw,[ie](){let e=em(this);return he(Be(String(e.value)),zt(e.scale))},[ae](e){return Tu(e)&&eD(this,e)===0},toString(){return`BigDecimal(${fa(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},Tu=e=>O(e,uw),hy=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(DZ);return r.value=e,r.scale=t,r},YU=(e,t)=>{let r=hy(e,t);return r.normalized=r,r};var Os=BigInt(0),LZ=BigInt(1);var BZ=BigInt(10),XU=YU(Os,0);var em=e=>{if(e.normalized===void 0)if(e.value===Os)e.normalized=XU;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=YU(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var $Z=100,jZ=[LZ],cw=(e,t)=>e===t?0:e<t?-1:1,ZU=(e,t)=>{let r=`${e.value<Os?-e.value:e.value}`,n=`${t.value<Os?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==Os)return o<Os?-1:1;let s=Math.max(r.length,n.length);return v_(r.padEnd(s,"0"),n.padEnd(s,"0"))},eD=(e,t)=>{if(e.scale===t.scale)return cw(e.value,t.value);let r=QU(e),n=QU(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>$Z)return r===-1?ZU(t,e):ZU(e,t);let i=jZ[s]??=BZ**BigInt(s);return o>0?cw(e.value,t.value*i):cw(e.value*i,t.value)},wl=ai(eD);var QU=e=>e.value===Os?0:e.value<Os?-1:1;var tD=e=>{if(e==="")return N(XU);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!JU.test(c))return _()}else t=e,r=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(!JU.test(o))return _();let a=s-r;return Number.isSafeInteger(a)?N(hy(BigInt(o),a)):_()};var fa=e=>{let t=em(e);if(Math.abs(t.scale)>=16)return HZ(t);let r=t.value<Os,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,"0"):n.padEnd(n.length-t.scale,"0"),s=o.length-t.scale,i=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${i}`:i},HZ=e=>{if(qZ(e))return"0e+0";let t=em(e),r=`${t.value}`,n=t.value<Os?2:1,o=r.slice(0,n),s=r.slice(n),i=s.length-t.scale;return`${o}${s===""?"":`.${s}`}e${i>=0?"+":""}${i}`};var qZ=e=>e.value===Os;var l={};ps(l,{Any:()=>C7,Array:()=>ct,ArrayEnsure:()=>U7,BigDecimal:()=>oj,BigDecimalFromString:()=>hee,BigInt:()=>dd,BigIntFromString:()=>eee,Boolean:()=>Fi,BooleanFromBit:()=>aee,BooleanLiterals:()=>q7,ByteSize:()=>JS,ByteSizeFromBigInt:()=>gee,ByteSizeFromNumber:()=>yee,ByteSizeFromString:()=>xee,Cause:()=>Jm,CauseReason:()=>XC,Char:()=>$X,Chunk:()=>See,Class:()=>YS,Cookie:()=>Gj,Cookies:()=>Jj,Date:()=>GS,DateFromMillis:()=>VX,DateFromString:()=>KX,DateTimeUtc:()=>ZS,DateTimeUtcFromDate:()=>vee,DateTimeUtcFromMillis:()=>Aee,DateTimeUtcFromString:()=>Cee,DateTimeZoned:()=>Ej,DateTimeZonedFromString:()=>_ee,Defect:()=>er,DnsARecord:()=>Uj,DnsAaaaRecord:()=>Dj,DnsCaaRecord:()=>Lj,DnsCnameRecord:()=>Bj,DnsMxRecord:()=>$j,DnsNaptrRecord:()=>jj,DnsNsRecord:()=>Hj,DnsPtrRecord:()=>qj,DnsRecord:()=>Ate,DnsRecordType:()=>Cte,DnsSoaRecord:()=>zj,DnsSrvRecord:()=>Wj,DnsTlsaRecord:()=>Kj,DnsTxtRecord:()=>Vj,DomainName:()=>Sa,DomainNameFromString:()=>_j,Duration:()=>ih,DurationFromMillis:()=>vte,DurationFromNanos:()=>wte,DurationFromString:()=>Tte,Enum:()=>v7,Error:()=>Ar,ErrorInstance:()=>jX,Exit:()=>yA,FalseLiterals:()=>_$,File:()=>Z$,Finite:()=>KS,FiniteFromString:()=>XX,FormData:()=>Q$,Graph:()=>_te,HashMap:()=>Pte,HashSet:()=>Mte,Headers:()=>Lte,Host:()=>hte,HostFromString:()=>xte,HostPort:()=>Mj,HostPortFromString:()=>gte,InetAddress:()=>Rj,InetAddressFromString:()=>dte,InetAddressV4:()=>fte,InetAddressV6:()=>lte,Int:()=>In,IpAddress:()=>Sc,IpAddressFromString:()=>tf,IpInterface:()=>vj,IpInterfaceFromString:()=>ite,IpLinkLocalAddress:()=>Kee,IpLinkLocalAddressFromString:()=>Vee,IpLoopbackAddress:()=>zee,IpLoopbackAddressFromString:()=>Wee,IpMulticastAddress:()=>Pee,IpMulticastAddressFromString:()=>Mee,IpNetwork:()=>kj,IpNetworkFromString:()=>ute,IpUnicastAddress:()=>Uee,IpUnicastAddressFromString:()=>Dee,IpUnspecifiedAddress:()=>Gee,IpUnspecifiedAddressFromString:()=>Jee,Ipv4Address:()=>sh,Ipv4AddressFromString:()=>xA,Ipv4BroadcastAddress:()=>$ee,Ipv4BroadcastAddressFromString:()=>jee,Ipv4Interface:()=>Tj,Ipv4InterfaceFromString:()=>ote,Ipv4Network:()=>Cj,Ipv4NetworkFromString:()=>ate,Ipv4PrivateAddress:()=>Zee,Ipv4PrivateAddressFromString:()=>Qee,Ipv6Address:()=>QS,Ipv6AddressFromString:()=>Ij,Ipv6Interface:()=>wj,Ipv6InterfaceFromString:()=>ste,Ipv6Network:()=>Aj,Ipv6NetworkFromString:()=>cte,Ipv6UniqueLocalAddress:()=>Yee,Ipv6UniqueLocalAddressFromString:()=>Xee,Json:()=>XS,JsonFromUrlParamsField:()=>Bte,JsonObject:()=>dre,Literal:()=>fr,Literals:()=>Fo,MacAddress:()=>ef,MacAddressFromString:()=>hd,MacBroadcastAddress:()=>Hee,MacBroadcastAddressFromString:()=>qee,MacLocallyAdministeredAddress:()=>ete,MacLocallyAdministeredAddressFromString:()=>tte,MacMulticastAddress:()=>Fee,MacMulticastAddressFromString:()=>Nee,MacUnicastAddress:()=>Lee,MacUnicastAddressFromString:()=>Bee,MacUniversallyAdministeredAddress:()=>rte,MacUniversallyAdministeredAddressFromString:()=>nte,MutableJson:()=>mre,Natural:()=>Vu,Never:()=>Mi,NonEmptyArray:()=>Yu,NonEmptyString:()=>pA,Null:()=>HS,NullOr:()=>iA,NullishOr:()=>T$,Number:()=>Zu,NumberFromString:()=>YX,ObjectKeyword:()=>k7,Opaque:()=>Z7,Option:()=>ba,OptionFromNullOr:()=>Fte,OptionFromNullishOr:()=>Ute,OptionFromOptional:()=>Hte,OptionFromOptionalKey:()=>jte,OptionFromOptionalNullOr:()=>qte,OptionFromUndefinedOr:()=>Nte,Port:()=>yte,PropertyKey:()=>YC,ReadonlyMap:()=>HX,ReadonlySet:()=>qX,Record:()=>Qu,RecordFromCookies:()=>Dte,RecordFromUrlParams:()=>$te,Redacted:()=>Zj,RedactedFromValue:()=>zte,RegExp:()=>zX,Result:()=>Wte,SchemaError:()=>$n,ScopedIpv6Literal:()=>gA,ScopedIpv6LiteralFromString:()=>Pj,SocketAddress:()=>mte,StandardSchemaV1FailureResult:()=>iee,String:()=>z,StringForLiteralAutocomplete:()=>A7,StringFromBase64:()=>ree,StringFromBase64Url:()=>nee,StringFromHex:()=>oee,StringFromUriComponent:()=>see,Struct:()=>Te,StructWithRest:()=>F7,Symbol:()=>b$,TaggedClass:()=>Jte,TaggedError:()=>EA,TaggedStruct:()=>ya,TaggedUnion:()=>J7,TemplateLiteral:()=>T7,TemplateLiteralParser:()=>w7,TimeZone:()=>Sj,TimeZoneFromString:()=>Oee,TimeZoneNamed:()=>gj,TimeZoneNamedFromString:()=>Ree,TimeZoneOffset:()=>kee,Tree:()=>lre,Trim:()=>tee,Trimmed:()=>X$,TrueLiterals:()=>O$,Tuple:()=>rs,TupleWithRest:()=>N7,URL:()=>G$,URLFromString:()=>WX,URLSearchParams:()=>Y$,Uint8Array:()=>qs,Uint8ArrayFromBase64:()=>cee,Uint8ArrayFromBase64Url:()=>uee,Uint8ArrayFromHex:()=>tj,Undefined:()=>oA,UndefinedOr:()=>zS,Union:()=>Pe,UniqueArray:()=>D7,UniqueSymbol:()=>R7,UnixPathAddress:()=>Oj,UnixPathAddressFromString:()=>pte,Unknown:()=>Xm,UnknownFromJsonString:()=>JX,UrlParams:()=>SA,Void:()=>pd,annotate:()=>t7,annotateEncoded:()=>r7,annotateKey:()=>n7,asserts:()=>c7,brand:()=>WS,catchDecoding:()=>j7,catchDecodingWithContext:()=>k$,catchEncoding:()=>H7,catchEncodingWithContext:()=>R$,check:()=>B7,declare:()=>Ge,declareConstructor:()=>Cr,decode:()=>z7,decodeEffect:()=>u7,decodeExit:()=>d$,decodeOption:()=>l7,decodePromise:()=>p7,decodeResult:()=>d7,decodeSync:()=>Zm,decodeTo:()=>ee,decodeUnknownEffect:()=>xc,decodeUnknownExit:()=>l$,decodeUnknownOption:()=>f7,decodeUnknownPromise:()=>m$,decodeUnknownResult:()=>p$,decodeUnknownSync:()=>jS,encode:()=>W7,encodeEffect:()=>rA,encodeExit:()=>x$,encodeKeys:()=>P7,encodeOption:()=>h7,encodePromise:()=>g7,encodeResult:()=>x7,encodeSync:()=>nA,encodeTo:()=>aA,encodeUnknownEffect:()=>Qm,encodeUnknownExit:()=>h$,encodeUnknownOption:()=>m7,encodeUnknownPromise:()=>y$,encodeUnknownResult:()=>g$,encodeUnknownSync:()=>Ym,extendTo:()=>M7,fieldsAssign:()=>O7,flip:()=>QC,fromBrand:()=>$7,fromFormData:()=>ZX,fromJsonString:()=>mA,fromURLSearchParams:()=>QX,instanceOf:()=>gc,is:()=>a7,isBase64:()=>D$,isBase64Url:()=>sX,isBetween:()=>yc,isBetweenBigDecimal:()=>mee,isBetweenBigInt:()=>RX,isBetweenCodePoints:()=>PX,isBetweenDate:()=>vX,isBetweenLength:()=>fA,isBetweenProperties:()=>LX,isBetweenSize:()=>NX,isCapitalized:()=>lX,isEndingWith:()=>aX,isFinite:()=>pX,isGUID:()=>nX,isGreaterThan:()=>hX,isGreaterThanBigDecimal:()=>fee,isGreaterThanBigInt:()=>CX,isGreaterThanDate:()=>EX,isGreaterThanOrEqualTo:()=>L$,isGreaterThanOrEqualToBigDecimal:()=>lee,isGreaterThanOrEqualToBigInt:()=>B$,isGreaterThanOrEqualToDate:()=>IX,isIncluding:()=>cX,isInt:()=>VS,isInt32:()=>SX,isLessThan:()=>xX,isLessThanBigDecimal:()=>dee,isLessThanBigInt:()=>AX,isLessThanDate:()=>TX,isLessThanOrEqualTo:()=>gX,isLessThanOrEqualToBigDecimal:()=>pee,isLessThanOrEqualToBigInt:()=>kX,isLessThanOrEqualToDate:()=>wX,isLowercased:()=>fX,isMaxCodePoints:()=>_X,isMaxLength:()=>q$,isMaxProperties:()=>DX,isMaxSize:()=>FX,isMinCodePoints:()=>OX,isMinLength:()=>$$,isMinProperties:()=>UX,isMinSize:()=>MX,isMultipleOf:()=>yX,isNonEmpty:()=>H$,isPattern:()=>Xu,isPropertyNames:()=>BX,isSchema:()=>Ju,isSchemaError:()=>fd,isStartingWith:()=>iX,isStringBigInt:()=>X7,isStringFinite:()=>Y7,isStringSymbol:()=>eX,isTrimmed:()=>U$,isULID:()=>oX,isUUID:()=>rX,isUint32:()=>bX,isUncapitalized:()=>dX,isUnique:()=>dA,isUniqueKey:()=>z$,isUppercased:()=>uX,link:()=>Ne,linkDecoding:()=>md,make:()=>J,makeFilter:()=>Je,makeFilterGroup:()=>Q7,makeIsBetween:()=>oh,makeIsGreaterThan:()=>eh,makeIsGreaterThanOrEqualTo:()=>th,makeIsLessThan:()=>rh,makeIsLessThanOrEqualTo:()=>nh,makeIsMultipleOf:()=>mX,middlewareDecoding:()=>C$,middlewareEncoding:()=>A$,mutable:()=>L7,mutableKey:()=>b7,optional:()=>lr,optionalKey:()=>Gu,overrideToCodecIso:()=>ure,overrideToEquivalence:()=>Yte,overrideToFormatter:()=>Zte,readonlyKey:()=>E7,refine:()=>v$,required:()=>S7,requiredKey:()=>y7,resolveAnnotations:()=>hre,resolveAnnotationsKey:()=>xre,revealBottom:()=>e7,revealCodec:()=>o7,suspend:()=>w$,tag:()=>He,tagDefaultOmit:()=>G7,toCodecArrayFromSingle:()=>ore,toCodecIso:()=>rre,toCodecJson:()=>rf,toCodecStringTree:()=>nre,toDifferJsonPatch:()=>fre,toEncoded:()=>ld,toEncoderXml:()=>sre,toEquivalence:()=>Xte,toFormatter:()=>Qte,toIso:()=>ire,toIsoFocus:()=>cre,toIsoSource:()=>are,toJsonSchemaDocument:()=>tre,toRepresentation:()=>ere,toStandardJSONSchemaV1:()=>i7,toStandardSchemaV1:()=>s7,toTaggedUnion:()=>N$,toType:()=>oo,withArrayLengthConstraints:()=>qS,withConstructorDefault:()=>P$,withDecodingDefault:()=>F$,withDecodingDefaultKey:()=>cA,withDecodingDefaultType:()=>V7,withDecodingDefaultTypeKey:()=>K7});var rD=globalThis.BigInt;var nD=e=>e>rD(Number.MAX_SAFE_INTEGER)||e<rD(Number.MIN_SAFE_INTEGER)?_():N(Number(e));var lw=BigInt(0),zZ=BigInt(1),Ri=BigInt(1e3),tc=BigInt(1024),sD=[{symbol:"B",factor:zZ,names:["B","byte","bytes"]},{symbol:"kB",factor:Ri,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:Ri**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:Ri**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:Ri**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:Ri**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:Ri**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:Ri**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:Ri**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:Ri**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:Ri**BigInt(10),names:["QB","quettabyte","quettabytes"]}],WZ=[sD[0],{symbol:"KiB",factor:tc,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:tc**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:tc**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:tc**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:tc**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:tc**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:tc**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:tc**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],KZ=[...sD,...WZ.slice(1)],VZ=new Map(KZ.flatMap(e=>e.names.map(t=>[t,e])));var dw=e=>e;var vl=e=>{throw new Error(`Invalid ByteSize: ${e}`)},iD=e=>!Number.isSafeInteger(e)||e<0?vl(`expected a non-negative safe integer, received ${e}`):dw(BigInt(e));var aD=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return vl(`unsupported syntax ${JSON.stringify(e)}`);let r=VZ.get(t[3]);if(r===void 0)return vl(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??"",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==lw?vl(`${JSON.stringify(e)} does not represent an integral number of bytes`):dw(s/o)},cD=xs(aD),xy=e=>{switch(typeof e){case"bigint":return e<lw?vl(`expected a non-negative bigint, received ${e}`):dw(e);case"number":return iD(e);case"string":return aD(e)}return vl(`unsupported input ${e}`)},pw=xs(xy),uD=e=>typeof e=="bigint"?xy(e):iD(e);var fD=e=>typeof e=="bigint"&&e>=lw;var gy=e=>e,lD=nD;var pD="~effect/Chunk";function dD(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var mD=[],hw=e=>Wr((t,r)=>{if(t.length!==r.length)return!1;let n=wu(t),o=wu(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),ZZ=hw(Z),QZ={[pD]:{_A:e=>e},toString(){return`Chunk(${H(wu(this))})`},toJSON(){return{_id:"Chunk",values:pr(wu(this))}},[Qe](){return this.toJSON()},[ae](e){return Cl(e)&&ZZ(this,e)},[ie](){return ri(wu(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return mD[Symbol.iterator]();default:return wu(this)[Symbol.iterator]()}},pipe(){return V(this,arguments)}},xw=e=>{let t=Object.create(QZ);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=la,t.right=la;break}case"ISingleton":{t.length=1,t.depth=0,t.left=la,t.right=la;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=la,t.right=la;break}}return t},Cl=e=>O(e,pD),la=xw({_tag:"IEmpty"}),YZ=()=>la;var XZ=e=>xw({_tag:"ISingleton",a:e}),gw=e=>Cl(e)?e:t5(Ct(e)),mw=(e,t,r)=>{switch(e.backing._tag){case"IArray":{dD(e.backing.array,0,t,r,e.length);break}case"IConcat":{mw(e.left,t,r),mw(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{dD(wu(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var e5=e=>{switch(e.backing._tag){case"IEmpty":return mD;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return mw(e,t,0),e.backing={_tag:"IArray",array:t},e.left=la,e.right=la,e.depth=0,t}}},wu=e5;var t5=e=>e.length===0?YZ():e.length===1?XZ(e[0]):xw({_tag:"IArray",array:e});var hD=e=>e.length;var vu=pl,xD=hu,gD=GN,yD=JN,SD=ZN,bD=x0,ED=QN;var by=Qg;var Ey=g0;var yw=XN,ID=eU;var Sw=tU;var bw=y0,Ew=Fp,TD=S0;var wD=b0,tm=rU;var vD=Np;var CD=T0;var AD=oU;var Iw=v0;var Al=e=>r5(typeof e=="string"?n5.encode(e):e),Cu=e=>{let t=s5(e),r=t.length;if(r%4!==0)return re(new jo({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return re(new jo({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let i=0,a=0;i<r;i+=4,a+=3){let c=Iy(t.charCodeAt(i))<<18|Iy(t.charCodeAt(i+1))<<12|Iy(t.charCodeAt(i+2))<<6|Iy(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return X(s)}catch(o){return re(new jo({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},kD=e=>Vr(Cu(e),t=>o5.decode(t)),r5=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4|e[n-1]>>4],r+=_s[(e[n-1]&15)<<2|e[n]>>6],r+=_s[e[n]&63];return n===t+1&&(r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=_s[e[n-2]>>2],r+=_s[(e[n-2]&3)<<4|e[n-1]>>4],r+=_s[(e[n-1]&15)<<2],r+="="),r},n5=new TextEncoder,o5=new TextDecoder,s5=e=>e.replace(/[\n\r]/g,""),_s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rm=new Uint8Array(123).fill(255);for(let e=0;e<_s.length;e++)rm[_s.charCodeAt(e)]=e;rm[61]=0;var Iy=e=>{if(e>=rm.length||rm[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return rm[e]};var wy="~effect/HashMap",Ps=5,om=1<<Ps,i5=om/4,RD=om/2,a5=om-1,c5=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),nm=(e,t)=>e>>>t&a5,rc=(e,t)=>1<<nm(e,t),Ty=(e,t)=>c5(e&t-1);function OD(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let i=rc(r,t),a=rc(o,t);if(i===a){let f=OD(e,t+Ps,r,n,o,s);return new Ru(e,i,[f])}let c=i|a,u=i>>>0<a>>>0?[n,s]:[s,n];return new Ru(e,c,u)}var u5=Be("HashMap"),_D=(e,t)=>he(G(e),G(t)),PD=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},Au=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=Hc;t=this.computeHash(),r===Hc&&(this._hash=t)}return t}},vw=class extends Au{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return _()}has(t,r,n){return!1}set(t,r,n,o,s,i){return i.value=!0,new ku(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},ku=class e extends Au{_tag="LeafNode";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&Z(this.key,n)?N(this.value):_()}has(t,r,n){return this.hash===r&&Z(this.key,n)}set(t,r,n,o,s,i){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&Z(this.key,o))return Z(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(i.value=!0,this.hash===n)return new Cw(t,n,[[this.key,this.value],[o,s]]);let a=rc(n,r),c=rc(this.hash,r);if(a===c)return new Ru(t,a,[this.set(t,r+Ps,n,o,s,i)]);let u=a|c,f=a>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new Ru(t,u,f)}remove(t,r,n,o,s){if(this.hash===n&&Z(this.key,o)){s.value=!0;return}return this}computeHash(){return _D(this.key,this.value)}},Cw=class e extends Au{_tag="CollisionNode";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return _();for(let[o,s]of this.entries)if(Z(o,n))return N(s);return _()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(Z(o,n))return!0;return!1}set(t,r,n,o,s,i){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return i.value=!0,OD(t,r,this.hash,this,n,new ku(t,n,o,s));for(let a=0;a<this.entries.length;a++)if(Z(this.entries[a][0],o)){if(Z(this.entries[a][1],s))return this;if(this.canEdit(t))return this.entries[a]=[o,s],this;let c=[...this.entries];return c[a]=[o,s],new e(t,this.hash,c)}return i.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let i=this.entries.findIndex(([c])=>Z(c,o));if(i===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[i===0?1:0];return new ku(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(i,1),this;let a=[...this.entries];return a.splice(i,1),new e(t,this.hash,a)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=_D(r[n][0],r[n][1]);return t}},Ru=class e extends Au{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=rc(r,t);if((this.bitmap&o)===0)return _();let s=Ty(this.bitmap,o);return this.children[s].get(t+Ps,r,n)}has(t,r,n){let o=rc(r,t);if((this.bitmap&o)===0)return!1;let s=Ty(this.bitmap,o);return this.children[s].has(t+Ps,r,n)}set(t,r,n,o,s,i){this.canEdit(t)&&(this._hash=void 0);let a=rc(n,r),c=Ty(this.bitmap,a);if((this.bitmap&a)!==0){let u=this.children[c],f=u.set(t,r+Ps,n,o,s,i);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let p=[...this.children];return p[c]=f,new e(t,this.bitmap,p)}else{i.value=!0;let u=new ku(t,n,o,s),f=this.bitmap|a;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>RD?this.expand(t,f,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>RD?this.expand(t,f,p):new e(t,f,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let i=rc(n,r);if((this.bitmap&i)===0)return this;let a=Ty(this.bitmap,i),c=this.children[a],u=c.remove(t,r+Ps,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^i;if(p===0)return;if(this.children.length===2){let h=this.children[a===0?1:0];if(h._tag==="LeafNode")return h}if(this.canEdit(t))return this.children.splice(a,1),this.bitmap=p,this._size=void 0,this;let m=[...this.children];return m.splice(a,1),new e(t,p,m)}if(c===u)return this;if(this.canEdit(t))return this.children[a]=u,this;let f=[...this.children];return f[a]=u,new e(t,this.bitmap,f)}expand(t,r,n){let o=new globalThis.Array(om),s=0;for(let i=0;i<om;i++)(r&1<<i)!==0&&(o[i]=n[s++]);return new Aw(t,n.length,o)}computeHash(){return PD(this.children)}},Aw=class e extends Au{_tag="ArrayNode";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=nm(r,t),s=this.children[o];return s?s.get(t+Ps,r,n):_()}has(t,r,n){let o=nm(r,t),s=this.children[o];return s?s.has(t+Ps,r,n):!1}set(t,r,n,o,s,i){this.canEdit(t)&&(this._hash=void 0);let a=nm(n,r),c=this.children[a];if(c){let u=c.set(t,r+Ps,n,o,s,i);if(c===u)return this;if(this.canEdit(t))return this.children[a]=u,this;let f=[...this.children];return f[a]=u,new e(t,this.count,f)}else{i.value=!0;let u=new ku(t,n,o,s);if(this.canEdit(t))return this.children[a]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[a]=u,new e(t,this.count+1,f)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let i=nm(n,r),a=this.children[i];if(!a)return this;let c=a.remove(t,r+Ps,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<i5)return this.pack(t,i,c);if(a===c)return this;if(this.canEdit(t))return this.children[i]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[i]=c,new e(t,u,f)}pack(t,r,n){let o=[],s=0,i=1;for(let a=0;a<this.children.length;a++){let c=a===r?n:this.children[a];c&&(o.push(c),s|=i),i<<=1}return new Ru(t,s,o)}computeHash(){return PD(this.children)}},vy=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case"LeafNode":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case"CollisionNode":{this.entries=t.entries,this.index=0;break}case"IndexedNode":case"ArrayNode":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},f5=(e,t)=>[e,t];var sm=class{[wy]=wy;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new vy(this._root,f5)}[ae](t){if(kw(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Ud(t,ND(n));if(fe(s)||!Z(o,s.value))return!1}return!0}return!1}[ie](){return _r(u5^this._root.subtreeHash())}[Qe](){return pr(this)}toString(){return`HashMap(${H(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[pr(t),pr(r)])}}pipe(){return V(this,arguments)}},MD=new vw,kw=e=>O(e,wy),Rw=()=>new sm(!1,0,MD,0);var FD=e=>{let t=MD,r=0,n={value:!1};for(let[o,s]of e){let i=G(o);n.value=!1,t=t.set(NaN,0,i,o,s,n),n.value&&r++}return new sm(!1,0,t,r)};var ND=d(2,(e,t)=>e._root.get(0,G(t),t));var Ow=d(2,(e,t)=>e._root.has(0,G(t),t));var l5=(e,t,r,n)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,r,t,n,s);return o._editable?(o._root=a,s.value&&o._size++,e):o._root===a?e:new sm(!1,o._edit,a,o._size+(s.value?1:0))},_w=d(3,(e,t,r)=>l5(e,t,G(t),r)),Pw=e=>new vy(e._root,F);var UD=e=>e[Symbol.iterator](),Cy=e=>e.size;var Ay=kw;var Mw=FD;var m5=UD,im=e=>Array.from(m5(e)),LD=Cy;var am="~effect/HashSet",h5=Be(am),x5={[ie](){return _r(he(h5,G(Ry(this))))},[ae](e){return Fw(e)&&Oy(this)===Oy(e)&&jD(this,t=>$D(e,t))},[Symbol.iterator](){return Pw(Ry(this))},toString(){return`HashSet(${H(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:pr(Array.from(this))}},[Qe](){return this.toJSON()},pipe(){return V(this,arguments)}},g5=e=>{let t=Object.create(x5);return t[am]=am,t.keyMap=e,t},Fw=e=>O(e,am),Ry=e=>e.keyMap;var BD=e=>{let t=Rw();for(let r of e)t=_w(t,r,!0);return g5(t)},$D=(e,t)=>Ow(Ry(e),t);var Oy=e=>Cy(Ry(e));var jD=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var Nw=BD,_y=Fw;var HD=Oy;var Uw="~effect/http/Cookies",zD=e=>O(e,Uw),Dw="~effect/http/Cookies/Cookie",WD=e=>O(e,Dw),qD="~effect/http/Cookies/CookieError",Lw=class extends SP{},Ou=class e extends sr("CookiesError"){static fromReason(t,r){return new e({reason:new Lw({_tag:t,cause:r})})}[qD]=qD;get message(){return this.reason._tag}};var S5={[Uw]:Uw,...Ot,toJSON(){return{_id:"effect/Cookies",cookies:Dx(this.cookies,e=>e.toJSON())}},pipe(){return V(this,arguments)}},$w=e=>{let t=Object.create(S5);return t.cookies=e,t},jw=e=>{let t={};for(let r of e)B(t,r.name,r);return $w(t)},My=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=b5(n.trim());o&&r.push(o)}return jw(r)};function b5(e){let t=e.split(";").map(a=>a.trim()).filter(a=>a!=="");if(t.length===0)return;let r=t[0].indexOf("=");if(r===-1)return;let n=t[0].slice(0,r);if(!KD.test(n))return;let o=t[0].slice(r+1),s=C5(o);if(t.length===1)return Object.assign(Object.create(Bw),{name:n,value:s,valueEncoded:o});let i={};for(let a=1;a<t.length;a++){let c=t[a],u=c.indexOf("="),f=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(p===void 0)break;let m=p.trim().replace(/^\./,"");m&&(i.domain=m);break}case"expires":{if(p===void 0)break;let m=new Date(p);isNaN(m.getTime())||(i.expires=m);break}case"max-age":{if(p===void 0)break;let m=parseInt(p,10);isNaN(m)||(i.maxAge=fp(m));break}case"path":{if(p===void 0)break;p[0]==="/"&&(i.path=p);break}case"priority":{if(p===void 0)break;switch(p.toLowerCase()){case"low":i.priority="low";break;case"medium":i.priority="medium";break;case"high":i.priority="high";break}break}case"httponly":{i.httpOnly=!0;break}case"secure":{i.secure=!0;break}case"partitioned":{i.partitioned=!0;break}case"samesite":{if(p===void 0)break;switch(p.toLowerCase()){case"lax":i.sameSite="lax";break;case"strict":i.sameSite="strict";break;case"none":i.sameSite="none";break}break}}}return Object.assign(Object.create(Bw),{name:n,value:s,valueEncoded:o,options:Object.keys(i).length>0?i:void 0})}var E5=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,KD=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,I5=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,T5=/^[\u0020-\u003a\u003c-\u007e]+$/,Bw={[Dw]:Dw,...Ot,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function w5(e,t,r){let n=encodeURIComponent(t),o=VD(e,n,r);return o!==void 0?re(o):X(Object.assign(Object.create(Bw),{name:e,value:t,valueEncoded:n,options:r}))}function VD(e,t,r){if(!KD.test(e))return Ou.fromReason("InvalidCookieName");if(t&&!E5.test(t))return Ou.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!I5.test(r.domain))return Ou.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!T5.test(r.path))return Ou.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!Wn($e(r.maxAge)))return Ou.fromReason("CookieInfinityMaxAge")}var GD=(e,t,r)=>tu(w5(e,t,r));function v5(e){let t=VD(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+"="+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=ui($e(n.maxAge));r+="; Max-Age="+Math.trunc(o)}if(n.domain!==void 0&&(r+="; Domain="+n.domain),n.path!==void 0&&(r+="; Path="+n.path),n.priority!==void 0)switch(n.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break}if(n.expires!==void 0&&(r+="; Expires="+n.expires.toUTCString()),n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.partitioned&&(r+="; Partitioned"),n.sameSite!==void 0)switch(n.sameSite){case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break}return r}var JD=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];B(t,o.name,o.value)}return t},ZD=e=>Object.values(e.cookies).map(v5);var C5=e=>{try{return decodeURIComponent(e)}catch{return e}};var _u=new WeakMap,QD=e=>{if(_u.has(e))return _u.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var YD="~effect/Redacted",cm=e=>O(e,YD),Pu=(e,t)=>{let r=Object.create(k5);return t?.label&&(r.label=t.label),_u.set(r,e),r},k5={[YD]:{_A:e=>e},label:void 0,...wr,toJSON(){return this.toString()},toString(){return`<redacted${On(this.label)?":"+this.label:""}>`},[ie](){return G(_u.get(this))},[ae](e){return cm(e)&&Z(_u.get(this),_u.get(e))}},nc=QD;var XD=e=>Wr((t,r)=>e(nc(t),nc(r)));var qw=Symbol.for("~effect/http/Headers"),e1=e=>O(e,qw),um=Object.defineProperties(Object.create(null),{[qw]:{value:qw},[zc]:{value(e){return R5(this,Re(e,Ww))}},toJSON:{value(){return ho(this)}},[ae]:{value(e){return zw(this,e)}},[ie]:{value(){return qd(this)}},toString:{value:Ot.toString},[Qe]:{value:Ot[Qe]}}),Ny=e=>Object.assign(Object.create(um),e),zw=Z_(Qc()),kl=Object.create(um),Zo=e=>{if(e===void 0)return kl;if(Symbol.iterator in e){let r=Object.create(um);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(um);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(", "):n!==void 0&&(t[r.toLowerCase()]=n);return t},t1=e=>Object.setPrototypeOf(e,um);var fm=d(3,(e,t,r)=>{let n=Ny(e);return n[t.toLowerCase()]=r,n}),r1=d(2,(e,t)=>Ny({...e,...Zo(t)})),Rl=d(2,(e,t)=>{let r=Ny(e);return Object.assign(r,t),r}),oc=d(2,(e,t)=>{let r=Ny(e);return delete r[t.toLowerCase()],r});var R5=d(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=Pu(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Pu(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),n1=(e,t)=>{for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="string"){if(n.toLowerCase()===e.toLowerCase())return!0}else if(e.search(n)!==-1)return!0}return!1},Ww=Ce("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key","AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var Kw="~effect/http/UrlParams",Vw=e=>O(e,Kw),O5={...wr,[Kw]:Kw,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[ae](e){return Gw(this,e)},[ie](){return ri(this.params.flat())}},Ol=e=>{let t=Object.create(O5);return t.params=e,t},Mu=e=>{if(Vw(e))return e;let t=o1(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return Ol(r)},o1=e=>{let t=typeof e[Symbol.iterator]=="function"?Ct(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,String(o[s])]);else if(o!==null&&typeof o=="object"){let s=o1(o);for(let[i,a]of s)r.push([[n,...typeof i=="string"?[i]:i],a])}else o!==void 0&&r.push([n,String(o)]);return r},Gw=Wr((e,t)=>_5(e.params,t.params)),_5=eP(q_([Qc(),Qc()])),s1=Ol([]);var i1=d(2,(e,t)=>LI(e.params,([r])=>r===t).pipe(Lt(([,r])=>r)));var a1=d(2,(e,t)=>{let r=Mu(t).params.slice(),n=new Set;for(let o=0;o<r.length;o++)n.add(r[o][0]);for(let o=0;o<e.params.length;o++)n.has(e.params[o][0])||r.push(e.params[o]);return Ol(r)});var P5=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))B(t,r,n);else{let o=t[r];typeof o=="string"?B(t,r,[o,n]):o.push(n)}return t},c1=P5;var Jw="~effect/Graph",Zw=e=>O(e,Jw),u1=e=>e;var M5=(e,t,r)=>(e==="directed"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&Z(t.data,r.data),F5=(e,t)=>e==="directed"?G(t):_r(he(G(t.data),N5(t.source,t.target))),N5=(e,t)=>he(0,G(e))+he(0,G(t)),U5=Be("Graph"),D5={[Jw]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[Qe](){return this.toJSON()},[ae](e){if(O(e,Jw)){let t=u1(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!Z(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!M5(this.type,n,o))return!1}return!0}return!1},[ie](){let e=U5;e=e^Be(this.type),e=e^zt(this.nodes.size),e=e^zt(this.edges.size);for(let[t,r]of this.nodes)e^=he(G(t),G(r));for(let[t,r]of this.edges)e^=he(G(t),F5(this.type,r));return _r(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 V(this,arguments)}},L5=(e,t)=>{let r=Object.create(D5);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=N(!0),r};var lm=e=>{let t=u1(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},Dy=e=>{let t=L5(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type==="undirected"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=_(),t};function da(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Ly(e){return t=>da(t)?.[e]}var ro="~structural",Fu="~identifier",dm="~sentinels",By="~constructor",f1=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],_l=Ly("identifier"),Qw=Ly(Fu),Yw=Ly("title");var pm=mo(e=>{let t=da(e)?.identifier;return typeof t=="string"?t:e.getExpected(pm)}),l1=new Set([dm,ro,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var ve=Symbol();var Dr=Mr,no=Dr(ve),nt=Dr(ve),mm=e=>e===ve?_():N(e),Xw=e=>e._tag==="None"?no:Dr(e.value);var xm="~effect/SchemaIssue/Issue";function tv(e){return O(e,xm)&&e[xm]===xm}function $5(e){return Object.hasOwn(e,"input")}var Ao=class{[xm]=xm;constructor(t,r){r?.reportInput===!0&&t!==ve&&(this.input=t)}},d1=class extends Ao{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},p1=class extends Ao{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},At=class extends Ao{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},Yt=class extends Ao{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Nu=class extends Ao{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},Ft=class extends Ao{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},at=class extends Ao{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},le=class extends Ao{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function tn(e,t,r,n,o){return new Ft(e,[new At([t],r)],n,o)}var gm=class extends Ao{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},ym=class extends Ao{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},m1=class extends Ao{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function ev(e,t,r){if(tv(e))return e;if(typeof e=="string")return new le({message:e},t,r);let n=typeof e.issue=="string"?new le({message:e.issue},t,r):e.issue;return new At(e.path,n)}function h1(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new le(void 0,t,r):ev(e,t,r)}function x1(e,t,r,n){return Array.isArray(t)?bt(t)?t.length===1?ev(t[0],r,n):new Ft(e,Bo(t,o=>ev(o,r,n)),r,n):void 0:h1(t,r,n)}var g1=e=>{let t=Fl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return ic(pm(e.ast),e);case"InvalidValue":{let r=rv(e);if(r!==void 0)return ic(r,e);let n=$y(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=$y(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=$y(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},y1=e=>Fl(e.issue)??Fl(e);function S1(e){return t=>({issues:Ml(t,[],e?.leafHook??g1,e?.checkHook??y1)})}function $y(e){return $5(e)?H(e.input):void 0}function rv(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function ic(e,t){let r=$y(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Ml(e,t,r,n){switch(e._tag){case"Filter":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Ml(e.issue,t,r,n);let s=rv(e.issue);return[{path:t,message:s===void 0?ic(nv(e.filter),e):ic(s,e.issue)}]}case"Encoding":return Ml(e.issue,t,r,n);case"Pointer":return Ml(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>Ml(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:Fl(e)??ic(pm(e.ast),e)}]:e.issues.flatMap(o=>Ml(o,t,r,n));default:return[{path:t,message:r(e)}]}}function nv(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(r=>nv(r)).join(" & ")}}function j5(){return e=>hm(e,"")}var b1=j5();function hm(e,t){let r;switch(e._tag){case"Filter":{let n=y1(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return hm(e.issue,t);let o=rv(e.issue);r=o===void 0?ic(nv(e.filter),e):ic(o,e.issue)}break}case"Encoding":return hm(e.issue,t);case"Pointer":return hm(e.issue,t+Sx(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>hm(n,t)).join(`
|
|
25
|
+
`);r=Fl(e)??ic(pm(e.ast),e);break}default:r=g1(e);break}return t?`${r}
|
|
26
|
+
at ${t}`:r}function Fl(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Fl(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r=="string")return r}function Sm(e){let t;for(let r of e.reasons){if(!Ng(r)||!tv(r.error))return;t??=r.error}return t}function ko(e,t){let r=Sm(e);if(r===void 0)throw new Error(t,{cause:e});return r}var I1=e=>Al(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),ov=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return re(new jo({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return re(new jo({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),Cu(n)},T1=e=>Vr(ov(e),t=>H5.decode(t)),H5=new TextDecoder;var bm=e=>Object.assign(Object.create(oI),e);function z5(e){return v1((t,r)=>D(e(t,r)))}function jy(e){return z5((t,r)=>{let n={message:e(t)};return de(t)?new gm(n,t.value,r):new gm(n)})}var w1=jy(()=>"Encoding is not supported"),W5=bm({_tag:"Passthrough"});function Oi(){return W5}function Ie(e){return bm({_tag:"Transform",transform:e})}function rn(e){return bm({_tag:"TransformEffect",transform:e})}function Hy(e){return bm({_tag:"TransformOptional",transform:e})}function v1(e){return bm({_tag:"TransformOptionalEffect",transform:e})}function sv(){return Hy(()=>_())}function iv(e){return v1(t=>{let r=Fa(t,ei);return de(r)?I(r):Eu(e,N)})}function Uu(){return Ie(globalThis.String)}function qy(){return Ie(globalThis.Number)}function C1(){return Ie(globalThis.BigInt)}function av(){return Ie(e=>new globalThis.Date(e))}function A1(){return Ie(cU)}function k1(e){return rn((t,r)=>Go({try:()=>JSON.parse(t,e?.reviver),catch:()=>new le({expected:"a valid JSON string"},t,r)}))}function R1(e){return rn((t,r)=>Go({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError("Value cannot be represented as JSON");return n},catch:()=>new le({expected:"a JSON-serializable value"},t,r)}))}function cv(){return Ie(Al)}function zy(){return Ie(I1)}function Wy(){return Ie(Gx)}function O1(){return rn((e,t)=>Iu($0(Cu(e)),()=>new le({expected:"a valid Base64 string"},e,t)))}function _1(){return rn((e,t)=>zn(kD(e),{onFailure:()=>D(new le({expected:"a valid Base64 string"},e,t)),onSuccess:I}))}function P1(){return rn((e,t)=>zn(ov(e),{onFailure:()=>D(new le({expected:"a valid Base64Url string"},e,t)),onSuccess:I}))}function M1(){return rn((e,t)=>zn(T1(e),{onFailure:()=>D(new le({expected:"a valid Base64Url string"},e,t)),onSuccess:I}))}function F1(){return rn((e,t)=>zn(VI(e),{onFailure:()=>D(new le({expected:"a valid hexadecimal string"},e,t)),onSuccess:I}))}function N1(){return rn((e,t)=>zn(TP(e),{onFailure:()=>D(new le({expected:"a valid hexadecimal string"},e,t)),onSuccess:I}))}function U1(){return Ie(encodeURIComponent)}function D1(){return rn((e,t)=>{try{return I(globalThis.decodeURIComponent(e))}catch{return D(new le({expected:"a valid URI component"},e,t))}})}function L1(){return Ie(e=>H1(Array.from(e.entries())))}var K5=q1(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function B1(){return Ie(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&K5(e).forEach(([n,o])=>{t.append(n,o)}),t})}function $1(){return Ie(e=>H1(Array.from(e.entries())))}var V5=q1(On);function j1(){return Ie(e=>typeof e=="object"&&e!==null?new URLSearchParams(V5(e)):new URLSearchParams)}function G5(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>jx(o)?globalThis.Number(o):o)}var J5=20;function H1(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,i])=>{let a=G5(s),c=t;for(let u=0;u<a.length;u++){let f=o.get(c),p=a[u]===""&&f!==void 0?f.length:a[u];f!==void 0&&typeof p=="number"&&(f.length=Math.max(f.length,p+1));let m=Object.hasOwn(c,p),h=m?c[p]:void 0;if(u===a.length-1){let x=o.get(h);if(x!==void 0)B(h,x.length++,i);else if(n.has(h))h.push(i);else if(m){let g=[h,i];n.add(g),B(c,p,g)}else B(c,p,i)}else{let x=a[u+1],g=typeof x=="number"||x==="";if(r.has(h)&&o.has(h)===g)c=h;else{let y={};r.add(y),g&&o.set(y,{parent:c,key:p,length:0}),B(c,p,y),c=y}}}});for(let[s,{key:i,length:a,parent:c}]of Array.from(o).reverse())c[i]===s&&a-Object.keys(s).length<=J5&&B(c,i,Object.assign(new Array(a),s));return t}function q1(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(a=>{r.push([o,a])}):s.forEach((a,c)=>{n(`${o}[${c}]`,a)});else if(typeof s=="object"&&s!==null)for(let[i,a]of Object.entries(s))n(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var Ky=class extends Ra{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ky(this.encode,this.decode)}},Im="~effect/SchemaTransformation/Transformation",et=class extends Ra{[Im]=Im;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new et(this.encode,this.decode)}};function Z5(e){return O(e,Im)&&e[Im]===Im}var Vy=e=>Z5(e)?e:new et(e.decode,e.encode);function Xt(e){return new et(rn(e.decode),rn(e.encode))}function Fe(e){return new et(Ie(e.decode),Ie(e.encode))}function Gy(e){return new et(Hy(e.decode),Hy(e.encode))}function z1(){return new et(A1(),Oi())}var Q5=new et(Oi(),Oi());function Nl(){return Q5}var Ul=new et(qy(),Uu()),Jy=new et(C1(),Uu()),uv=new et(av(),Ie(mI)),W1=new et(av(),Ie(e=>e.getTime()));var fv=Xt({decode:(e,t)=>Zt(cD(e),{onNone:()=>D(new le({expected:"a valid ByteSize string"},e,t)),onSome:I}),encode:e=>I(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),K1=Xt({decode:(e,t)=>Zt(pw(e),{onNone:()=>D(new le({expected:"a non-negative bigint byte count"},e,t)),onSome:I}),encode:e=>I(gy(e))}),V1=Xt({decode:(e,t)=>Zt(pw(e),{onNone:()=>D(new le({expected:"a non-negative safe-integer byte count"},e,t)),onSome:I}),encode:(e,t)=>Zt(lD(e),{onNone:()=>D(new le({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:I})}),Y5=e=>Jt(e)&&typeof e.message=="string",G1=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:Z1(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(r.name=e.name),typeof e.stack=="string"&&(r.stack=e.stack),r},X5=e=>{try{let t=Wc(e);return t===void 0?H(e):JSON.parse(t)}catch{return H(e)}},eQ=(e,t,r)=>{let n={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},J1=e=>{let t=new WeakSet,r=n=>{if(jO(n)){if(t.has(n))return"[Circular]";t.add(n);let o=eQ(n,e,r);return t.delete(n),o}return X5(n)};return r},Z1=e=>Y5(e)?G1(e):e,Q1=e=>Fe({decode:G1,encode:t=>J1(e)(t)}),Y1=e=>Fe({decode:Z1,encode:J1(e)});function X1(){return Fe({decode:AI,encode:sp})}function e2(){return Fe({decode:CI,encode:_n})}function t2(e){return Fe({decode:Xc,encode:e?.onNoneEncoding===null?sp:_n})}function r2(){return Gy({decode:N,encode:eu})}function n2(){return Gy({decode:e=>e.pipe(Fa(ei),N),encode:eu})}var lv=Xt({decode:(e,t)=>URL.canParse(e)?I(new URL(e)):D(new le({expected:"a valid URL string"},e,t)),encode:e=>I(e.href)});var dv=new et(O1(),cv()),o2=new et(_1(),cv()),s2=new et(M1(),zy()),i2=new et(N1(),Wy()),a2=new et(D1(),U1());function c2(e){return new et(k1(e??{}),R1(e))}var u2=new et(L1(),B1()),f2=new et($1(),j1());function cc(e){return t=>t._tag===e}var jl=cc("Declaration");var tQ=cc("Never");var Bl=cc("Literal"),mv=cc("UniqueSymbol");var Iv=cc("Arrays"),rQ=cc("Objects"),S2=cc("Union"),b2=cc("Suspend"),jt=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},nn={},Yo=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},l2="~effect/Schema",Gt=class{[l2]=l2;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},uc=class extends Gt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,i,a){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,r)=>t===ve?no:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=Lu(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new uc(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},nQ=class extends Gt{_tag="Null";getParser(){return sS(this,null)}getExpected(){return"null"}},Tv=new nQ;var oQ=class extends Gt{_tag="Undefined";getParser(){return sS(this,void 0)}toCodecJson(){return lt(this,[E2])}getExpected(){return"undefined"}},E2=new jt(Tv,new et(Ie(()=>{}),Ie(()=>null))),wv=new oQ;var sQ=class extends Gt{_tag="Void";getParser(){let e=Dr(void 0);return t=>t===ve?no:e}toCodecJson(){return lt(this,[E2])}getExpected(){return"void"}},I2=new sQ;var iQ=class extends Gt{_tag="Never";getParser(){return Ns(this,$O)}getExpected(){return"never"}},vv=new iQ,aQ=class extends Gt{_tag="Any";getParser(){return Ns(this,aI)}getExpected(){return"any"}},T2=new aQ,cQ=class extends Gt{_tag="Unknown";getParser(){return Ns(this,aI)}getExpected(){return"unknown"}},pa=new cQ,uQ=class extends Gt{_tag="ObjectKeyword";getParser(){return Ns(this,jd)}getExpected(){return"object | array | function"}},w2=new uQ,v2=class extends Gt{_tag="Enum";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s=="number"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${H(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Ns(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return lt(this,[new jt(new Sn(Object.keys(e).map(t=>new Ln(t))),new et(Ie(t=>e[t]),Uu()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function pv(e){return typeof e=="number"?`parts[${e}]`:e}function hv(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${pv(t)}`);let n;switch(e._tag){case"String":case"Number":case"BigInt":n=!0;break;case"Literal":n=!e.checks;break;case"TemplateLiteral":{let o=pv(t);n=!e.checks&&e.parts.every((s,i)=>hv(s,`${o}.parts[${i}]`,r));break}case"Union":{let o=pv(t);n=!e.checks&&e.types.every((s,i)=>hv(s,`${o}.types[${i}]`,r));break}default:return!1}return n&&r.add(e),n}var Cv=class extends Gt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],i=[],a=new Set;for(let u=0;u<e.length;u++){let f=e[u];if(!hv(f,u,a))throw new Error(`Invalid TemplateLiteral part ${f._tag}`);s.push(f),i.push(f._tag==="Literal"?globalThis.String(f.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(i[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=i,this.suffixLengths=c}getParser(e){let t=new Xo(!1,this.parts.map(Bv),[]),r=e(Kl(Ro,t,A2(this)));return(n,o)=>{if(n===ve)return no;let s=r(n,o);return s._tag==="Success"?nt:cr(s,{onSuccess:()=>n,onFailure:i=>new Ft(this,[i],n,o)})}}getExpected(){return"string"}matchPart(e,t){return X2(this,e,t)===void 0?void 0:e}};function C2(e){let t=mo(o=>{if(o._tag!=="Union")return o;let s=Lu(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new Sn(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new Cv(e.map(o=>t(Bn(o)))),n=new Xo(!1,e.map(Bv),[]);return Kl(r,n,A2(r))}function A2(e){return new et(rn((t,r)=>{let n=X2(e,t,r);return n?I(n):D(new le({expected:"a string matching template literal parts"},t,r))}),Ie(t=>t.join("")))}var k2=class extends Gt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return sS(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return lt(this,[new jt(e===void 0?vv:new Ln(globalThis.String(this.symbol)),rL.transformation)])}getExpected(){return globalThis.String(this.symbol)}},Ln=class extends Gt{_tag="Literal";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${H(e)}`);this.literal=e}getParser(){return sS(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?d2(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:d2(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function d2(e){let t=globalThis.String(e.literal);return lt(e,[new jt(new Ln(t),new et(Ie(()=>e.literal),Ie(()=>t)))])}var fQ=class extends Gt{_tag="String";getParser(){return Ns(this,On)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Us(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Ro=new fQ,lQ=class extends Gt{_tag="Number";getParser(){return Ns(this,Bd)}matchKey(e,t){return this._match(RQ,e,t)}matchPart(e,t){return this._match(Sv,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:Us(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(xv(this.checks,"effect/schema/isFinite")||xv(this.checks,"effect/schema/isInt"))?this:lt(this,[IQ])}toCodecStringTree(){return this.toCodecJson()===this?lt(this,[OQ]):lt(this,[_Q])}getExpected(){return"number"}};function xv(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&xv(r.checks,t))}var Av=new lQ,dQ=class extends Gt{_tag="Boolean";getParser(){return Ns(this,px)}getExpected(){return"boolean"}},R2=new dQ,pQ=class extends Gt{_tag="Symbol";getParser(){return Ns(this,iI)}matchKey(e,t){return t.disableChecks||!this.checks?e:Us(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return lt(this,[rL])}getExpected(){return"symbol"}},O2=new pQ,mQ=class extends Gt{_tag="BigInt";getParser(){return Ns(this,DO)}matchPart(e,t){if(!bv.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:Us(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return lt(this,[MQ])}getExpected(){return"bigint"}},_2=new mQ,Xo=class extends Gt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,i,a){super(n,o,s,i),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(Lr(t[u]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<r.length;u++)if(Lr(r[u]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,i=Math.max(0,r.rest.length-1);function a(f,p){return p<s?n[p]:p>=f?o[p-f+1]:o[0]}let c=f=>{let{input:p,len:m,options:h}=f;if(r.rest.length===0&&m>s)for(let x=s;x<m;x++){let g=new Nu(r,p[x],h),y=new At([x],g);if(h.errors==="all")f.issues?f.issues.push(y):f.issues=[y];else return D(new Ft(r,[y],p,h))}return f.issues?D(new Ft(r,f.issues,p,h)):Dr(f.output)},u=(f,p)=>{let m=f.length,h={ast:r,getParser:a,input:f,len:m,tailThreshold:Math.max(s,m-i),output:new globalThis.Array(m),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(m,s+i),g=p.concurrency===void 0?1:vp(p.concurrency),y=g===1?xQ(h,f,0,x):gQ(h,f,{concurrency:g,end:x});if(!y)return c(h);if(Xe(y))return ur(y,()=>c(h));let E=!0;return L(()=>E?(E=!1,A(y,()=>c(h))):u(f,p))};return(f,p)=>{if(f===ve)return no;try{return Array.isArray(f)?(n||(n=r.elements.map(m=>({ast:m,parser:t(m)})),o=r.rest.map(m=>({ast:m,parser:t(m)}))),u(f,p)):D(new at(r,f,p))}catch(m){return gn(m)}}}_rebuild(e,t,r){let n=Lu(this.elements,e),o=Lu(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new Xo(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function hQ(e,t,r,n){if(r._tag==="Failure")return Qy(e,e.ast,n,r);let o=r===nt?t:r[Se];if(o!==ve)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Lr(s.ast))return;let i=new At([n],new Yt(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return Jn(new Ft(e.ast,[i],e.input,e.options))}}var P2={onItem(e,t,r){let n=r<e.len?t:ve;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:hQ},xQ=Rg()(P2),gQ=Og()(P2),Qy=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Sm(n.cause);if(o===void 0)return ir(Ka(n.cause,i=>new Ft(t,[new At([r],i)],e.input,e.options)));let s=new At([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Jn(new Ft(t,[s],e.input,e.options))},Xy="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function _i(e,t,r=nn){let n,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter(a=>i.matchPart(a,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter(a=>i.matchKey(a,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(a=>Object.prototype.propertyIsEnumerable.call(e,a)&&i.matchKey(a,r)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(Lv(Bn(t)))}var kv=class{name;type;constructor(e,t){this.name=e,this.type=t}};function M2(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(M2);default:return!1}}function F2(e){let t=ql(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(F2);default:return!1}}function yQ(e){return M2(e)&&F2(e)}var Rv=class{parameter;type;constructor(e,t){if(!yQ(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Lr(t)&&!Y2(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Tm=class extends Gt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return Ns(r,hx);let s,i,a=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),i=o?r.indexSignatures.map(p=>({is:p,parserKey:e(Lv(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(y=>typeof y.name=="number"?globalThis.String(y.name):y.name)),m=(y,E,b,v,T)=>{if(T._tag==="Failure")return Qy(y,r,E,T)??Kt;let S=T===nt?v:T[Se];if(b!==ve&&S!==ve){if(n&&(p.has(E)||p.has(typeof b=="number"?globalThis.String(b):b)))return Kt;B(y.out,b,S)}return Kt},h=(y,E,b,v)=>{if(!v){let k=b.parserKey(E,y.options);if(!Xe(k))return A(eo(k),C=>h(y,E,b,C));v=k}if(v._tag==="Failure")return Qy(y,r,E,v)??Kt;let T=v===nt?E:v[Se],S=y.input[E],w=b.parserValue(S,y.options);return Xe(w)?m(y,E,T,S,w):A(eo(w),k=>m(y,E,T,S,k))},x=(y,E,b)=>{let v=y.input[E],T=b.parserValue(v,y.options);return Xe(T)?m(y,E,E,v,T):A(eo(T),S=>m(y,E,E,v,S))},g=o?Og()({onItem:(y,[E,b])=>b.is.parameter===Ro?x(y,E,b):h(y,E,b),step:(y,E,b)=>b._tag==="Failure"?b:void 0}):void 0;return aw(function*(y,E){if(y===ve)return ve;if(!(typeof y=="object"&&y!==null&&!Array.isArray(y)))return yield*D(new at(r,y,E));a();let b=y,v={},T={ast:r,input:b,out:v,issues:void 0,options:E},S=E.errors==="all",w=E.onExcessProperty==="error",k=E.concurrency===void 0?1:vp(E.concurrency),C=o&&w?r.indexSignatures.map(R=>_i(b,R.parameter,E)):void 0;if(w){let R=C?new Set(p):p;if(C)for(let $ of C)for(let te of $)R.add(te);let M=Reflect.ownKeys(b);for(let $=0;$<M.length;$++){let te=M[$];if(!R.has(te)&&Object.prototype.propertyIsEnumerable.call(b,te)){let xe=new Nu(r,b[te],E),Le=new At([te],xe);if(S){T.issues?T.issues.push(Le):T.issues=[Le];continue}else return yield*D(new Ft(r,[Le],y,E))}}}if(n){let R=k===1?p2(T,s):SQ(T,s,{concurrency:k});R&&(yield*R)}if(o&&k===1)for(let R=0;R<o;R++){let M=i[R],$=M.is.parameter===Ro?x:h,te=C?.[R]??(M.is.parameter===Ro?Object.keys(b):_i(b,M.is.parameter,E));for(let xe=0;xe<te.length;xe++){let Le=$(T,te[xe],M);if(!Xe(Le))yield*Le;else if(Le._tag==="Failure")return yield*Le}}else if(g){let R=Qt();for(let $=0;$<o;$++){let te=i[$],xe=C?.[$]??(te.is.parameter===Ro?Object.keys(b):_i(b,te.is.parameter,E));for(let Le=0;Le<xe.length;Le++)R.push([xe[Le],te])}let M=g(T,R,{concurrency:k});M&&(yield*M)}return T.issues?yield*D(new Ft(r,T.issues,y,E)):v})};if(o)return c();let u,f=(p,m,h)=>{let x=s[m];return A(eo(h),g=>{let y=gv(p,x,g);if(y)return y;let E=()=>Dr(p.out),b=p2(p,s.slice(m+1));return b?ur(b,E):E()})};return(p,m)=>{if(p===ve)return no;if(m.errors==="all"||m.onExcessProperty!==void 0||m.concurrency!==void 0&&vp(m.concurrency)!==1)return(u??=c())(p,m);if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return D(new at(r,p,m));let h=a(),x=p,g={},y={ast:r,input:x,out:g,issues:void 0,options:m};try{for(let E=0;E<h.length;E++){let b=h[E],v=b.name,T=Ll(x,v),S=T?x[v]:ve,w=b.parser(S,m);if(!Xe(w))return f(y,E,w);if(w===nt){T&&B(g,v,S);continue}let k=gv(y,b,w);if(k)return k}}catch(E){return gn(E)}return Dr(g)}}_rebuild(e,t,r,n){let o=Lu(this.propertySignatures,i=>{let a=e(i.type);return a===i.type?i:new kv(i.name,a)}),s=Lu(this.indexSignatures,i=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new Rv(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Tm(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function gv(e,t,r){if(r._tag==="Failure")return Qy(e,e.ast,t.name,r);if(r===nt)return;let n=r[Se];if(n!==ve){B(e.out,t.name,n);return}if(delete e.out[t.name],!Lr(t.type)){let o=new At([t.name],new Yt(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Jn(new Ft(e.ast,[o],e.input,e.options))}}var N2={onItem(e,t){if(!Ll(e.input,t.name))return t.parser(ve,e.options);let r=e.input[t.name];return B(e.out,t.name,r),t.parser(r,e.options)},step:gv},p2=Rg()(N2),SQ=Og()(N2);function Ov(e,t){return e?t?[...e,...t]:e:t}function eS(e,t,r){return new Tm(Reflect.ownKeys(e).map(n=>new kv(n,e[n].ast)),[],r,t)}function wm(e){return e.ast}function _v(e,t=void 0){return new Xo(!1,e.map(r=>r.ast),[],void 0,t)}function tS(e,t,r){return new Sn(e.map(wm),t,void 0,r)}function U2(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let i of s.propertySignatures)if(r.some(a=>a.name===i.name))throw new Error(`Duplicate identifier: ${JSON.stringify(i.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=Ov(o,s.checks)}return new Tm(r,n,void 0,o)}function D2(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Xo(e.isMutable,e.elements,t,void 0,e.checks)}function L2(e){if(e.encoding)throw new Error("mutable does not support encodings");return new Xo(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var Pv=jc(e=>{for(;;){if(b2(e))return pa;let t=e.encoding;if(!t)return e.recur?.(Pv,F)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==F))return pa;e=t[t.length-1].to}});function B2(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(B2)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function ac(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[dm];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Lr(r)){if(Bl(r))return[{key:t.name,literal:r.literal}];if(mv(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Lr(t)){if(Bl(t))return[{key:r,literal:t.literal}];if(mv(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>ac(Pv(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return ac(e.thunk())}}var m2=new WeakMap,Zy=Object.freeze([]),h2=e=>e===null?"null":Array.isArray(e)?"array":typeof e,Ll=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function vm(e){let t=m2.get(e);if(t)return t;let r,n=0,o,s,i=!0,a=[];for(let f=0;f<e.length;f++){let p=e[f],m=Pv(p);if(tQ(m))continue;if(Bl(m)||mv(m)){s??=new Map;let x=Bl(m)?m.literal:m.symbol;a[f]=x;let g=s.get(x);g||s.set(x,g=[]),g.push(f)}else i=!1;let h=ac(m);if(h.length){r??=new Map,n++;for(let{key:x,literal:g}of h){let y=r.get(x);y||r.set(x,y=[new Map,new Set]),y[1].add(f);let E=y[0].get(g);E||y[0].set(g,E=new Set),E.add(f)}}else{o??={};let x=B2(m);for(let g of x)(o[g]??=[]).push(f)}}let c={},u=f=>c[f]??=Object.freeze(o?.[f]??Zy);if(i&&s)s.forEach(Object.freeze),t=f=>s.get(f)??Zy;else if(r?.size===1&&!o){let[f,[p]]=r.entries().next().value,m=new Map;for(let[x,g]of p)m.set(x,Object.freeze(Array.from(g)));let h=Object.freeze(e.map((x,g)=>g));t=(x,g)=>{if(jd(x)){let y=Ll(x,f)?x[f]:void 0;if(y!==void 0)return m.get(y)??Zy;if(g)return h}return Zy}}else if(r){let f;for(let p of r)(!f||p[1][0].size>f[1][0].size)&&p[1][1].size===n&&(f=p);t=(p,m)=>{let h=h2(p);if(!jd(p))return u(h);let x=new Set(o?.[h]),g;if(f){let[y,[E]]=f,b=Ll(p,y),v=b?p[y]:void 0;if(b&&(!m||v!==void 0)){let T=E.get(v);if(!T)return u(h);for(let S of T)x.add(S);g=y}}if(g===void 0)for(let[y,[E,b]]of r){let v=Ll(p,y),T=v?p[y]:void 0;if(v&&(!m||T!==void 0)){let S=E.get(T);if(S)for(let w of S)x.add(w)}else if(m)for(let S of b)x.add(S)}for(let[y,[E,b]]of r){if(y===g)continue;let v=Ll(p,y),T=v?p[y]:void 0;if(v&&(!m||T!==void 0)){let S=E.get(T);for(let w of x)b.has(w)&&!S?.has(w)&&x.delete(w)}}return Array.from(x).sort((y,E)=>y-E)}}else t=f=>{let p=u(h2(f));return s?p.filter(m=>a[m]===void 0||a[m]===f):p};return m2.set(e,t),t}var Sn=class extends Gt{_tag="Union";types;options;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=i}getParser(e,t){let r=this,n=t!==void 0,o=[],s=a=>o[a]??=e(r.types[a]),i;return(a,c)=>{if(a===ve)return no;let u=(i??=vm(r.types))(a,n);if(u.length===0)return D(new ym(r,[],a,c));if(u.length===1){let f=s(u[0])(a,c);return f._tag==="Success"?f:Xe(f)?$2(r,f.cause,a,c):bQ(r,f,a,c)}return j2(r,s,u,a,c)}}_rebuild(e,t,r){let n=Lu(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Sn(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let r=this.types.map(n=>{let o=Bn(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(Bl);if(s.length>0)return`${g2(o.isMutable)}[ ${s.map(i=>e(i)+y2(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(i=>Bl(i.type));if(s.length>0)return`{ ${s.map(i=>`${g2(i.type.context?.isMutable)}${ni(i.name)}${y2(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function $2(e,t,r,n){let o=Sm(t);return o?Jn(new ym(e,[o],r,n)):ir(t)}function bQ(e,t,r,n){return rt(t,o=>$2(e,o,r,n))}function j2(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},i=EQ(s,r);if(!i)return s.out?s.out:D(new ym(e,s.issues??[],n,o));if(Xe(i))return x2(i,s);let a=!0;return L(()=>a?(a=!1,x2(i,s)):j2(e,t,r,n,o))}function x2(e,t){return ur(e,r=>t.out===nt?I(t.input):t.out?t.out:D(new ym(t.ast,t.issues??[],t.input,t.options)))}var EQ=Rg()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Sm(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Jn(new m1(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return Kt}}}),H2=new Sn([new Ln("Infinity"),new Ln("-Infinity"),new Ln("NaN")]);function g2(e){return e?"":"readonly "}function y2(e){return e?"?":""}var Mv=class extends Gt{_tag="Suspend";thunk;constructor(e,t,r,n,o){if(r)throw new Error("Cannot add checks to Suspend");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new Mv(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Yy=class extends Ra{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new Yy(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Yy(this.run,this.annotations,!0)}and(e,t){return new Du([this,e],t)}},Du=class extends Ra{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Du(this.checks,{...this.annotations,...e})}and(e,t){return new Du([this,e],t)}};function rS(e,t,r=!1){return new Yy((n,o,s)=>x1(o,e(n,o,s),n,s),t,r)}function nS(e,t){return new Yy((r,n,o)=>e(r)?void 0:new le(void 0,r,o),t,!0)}function Fv(e){return rS(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}var Nv=Pi(Av,[Fv()]),IQ=new jt(new Sn([Nv,H2]),new et(qy(),Ie(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Cm(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return rS(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:"effect/schema/isPattern",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var yv=new WeakMap;function Am(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&yv.set(r,Hl(e)),r}function Hl(e){let t=yv.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return yv.set(e,r),r}function lt(e,t){return e.encoding===t?e:Am(e,{encoding:t})}function Bu(e,t){if(e.context===t)return e;let r=Hl(e);return r.context===t&&r.encoding===e.encoding?r:Am(e,{context:t})}function ql(e){return e.encoding?ql(e.encoding[e.encoding.length-1].to):e}function Fs(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return q2(e,$x(e.checks.slice(0,-1),r.annotate(t)))}return Am(e,{annotations:{...e.annotations,...t}})}function q2(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Am(e,{checks:t})}function Pi(e,t){return q2(e,Ov(e.checks,t))}function fc(e,t){let r=t(e.to);return r===e.to?e:new jt(r,e.transformation)}function z2(e,t){let r=e,n=r[r.length-1],o=fc(n,t);return o===n?e:$x(e.slice(0,e.length-1),o)}function oS(e){return t=>t.encoding?lt(t,z2(t.encoding,e)):t}function zl(e,t){return oS(r=>Bu(r,t))(e)}function ma(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:lt(n,z2(n.encoding,r))}return e(n)}return jc(r)}function W2(e,t){return Uv(e,t,Nt(e))}function K2(e,t){return Uv(Bn(e),t,e)}function Uv(e,t,r){let n=new jt(e,t);return lt(r,r.encoding?[...r.encoding,n]:[n])}function Lu(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let i=0;i<n;i++)r[i]=e[i];r[n]=s}}return r??e}function Wl(e,t){let r=e.context?new Yo(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Yo(!1,!1,void 0,t);return Bu(e,r)}var $u=jc(e=>{let t=e.context?e.context.isOptional===!1?new Yo(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Yo(!0,!1);return TQ(Bu(e,t))}),TQ=oS($u),V2=mo(e=>$u(new Sn([e,wv]))),Dv=jc(e=>{let t=e.context?e.context.isMutable===!1?new Yo(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Yo(!1,!0);return wQ(Bu(e,t))}),wQ=oS(Dv);function G2(e,t){let r=e.context?new Yo(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Yo(!1,!1,t);return Bu(e,r)}function Kl(e,t,r){return Uv(e,r,t)}function vQ(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":mx(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function J2(e,t){let{literals:r,parameters:n}=vQ(e);return new Tm(r.map(o=>new kv(o,t)),n.map(o=>new Rv(o,t)))}function Lr(e){return e.context?.isOptional??!1}function Z2(e){return e.context?.isMutable??!1}function Q2(e){return e.annotations?.[ro]===!0||e._tag==="FilterGroup"&&e.checks.every(Q2)}function CQ(e){function t(n){return Q2(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Gr(r)?r:void 0}function AQ(e){let t=!0;function r(n){return t=t&&!n.encoding&&!b2(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var Nt=jc(e=>{let t=Hl(e);if(t!==e){let n=Nt(t);return n===t&&e.encoding===void 0?e:Bu(n,e.context)}let r="recur"in e?e.recur(Nt):e;if("encodingChecks"in r&&r.encodingChecks){let n=AQ(e)?r.encodingChecks:Iv(r)||rQ(r)||jl(r)&&r.typeParameters.length>0?CQ(r.encodingChecks):void 0;return Am(r,{encodingChecks:void 0,checks:Ov(r.checks,n)})}return r}),Bn=jc(e=>Nt(Oo(e)));function kQ(e,t){let r=t,n=r.length,o=r[n-1],s=[new jt(Oo(lt(e,void 0)),r[0].transformation.flip())];for(let a=1;a<n;a++)s.unshift(new jt(Oo(r[a-1].to),r[a].transformation.flip()));let i=Oo(o.to);return i.encoding?lt(i,[...i.encoding,...s]):lt(i,s)}var Oo=mo(e=>{if(e.encoding)return kQ(e,e.encoding);let t=Hl(e);if(t!==e){let r=Oo(t);return r===t?e:Bu(r,e.context)}return"flip"in e?e.flip(Oo):"recur"in e?e.recur(Oo):e});function Y2(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Y2);default:return!1}}function sS(e,t){let r=t===0?nt:Dr(t);return(n,o)=>n===ve?no:n===t?r:D(new at(e,n,o))}function Ns(e,t){return(r,n)=>r===ve?no:t(r)?nt:D(new at(e,r,n))}function X2(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let i=new Array(n.length),a;function c(u,f){if(u===n.length)return f===s;if(a?.has(u*(s+1)+f))return!1;let p=n[u];if(u===n.length-1){let m=t.slice(f);if(p.matchPart(m,r)!==void 0)return i[u]=m,!0}else if(p._tag==="Literal"){let m=o[u];if(t.startsWith(m,f)&&c(u+1,f+m.length))return i[u]=m,!0}else{let m=s-e.suffixLengths[u+1],h=o[u+1],x=h===void 0?m:t.lastIndexOf(h,m);for(;x>=f;){let g=t.slice(f,x);if(p.matchPart(g,r)!==void 0&&c(u+1,x))return i[u]=g,!0;if(x===0)break;x=h===void 0?x-1:t.lastIndexOf(h,x-1)}}return a??=new Set,a.add(u*(s+1)+f),!1}return c(0,0)?i:void 0}var Lv=ma(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Lv)}}),iS=ma(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(iS)}}),Bv=ma(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(Bv)}}),eL="[\\s\\S]*?",Sv=new globalThis.RegExp(`^${Xy}$`),RQ=new globalThis.RegExp(`^(?:${Xy}|Infinity|-Infinity|NaN)$`);function $v(e){return Cm(Sv,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Sv.source}),...e})}var tL=Pi(Ro,[$v()]),OQ=new jt(tL,Ul),_Q=new jt(new Sn([tL,H2]),Ul),PQ="-?\\d+",bv=new globalThis.RegExp(`^${PQ}$`);function jv(e){return Cm(bv,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:bv.source}),...e})}var Hv=Pi(Ro,[jv({expected:"a string representing a bigint"})]),MQ=new jt(Hv,Jy),FQ="Symbol\\(([\\s\\S]*)\\)",Ev=new globalThis.RegExp(`^${FQ}$`),NQ=Pi(Ro,[qv()]),rL=new jt(NQ,new et(Ie(e=>globalThis.Symbol.for(Ev.exec(e)[1])),rn((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?I(globalThis.String(e)):D(new gm({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function qv(e){return Cm(Ev,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:Ev.source}),...e})}function Us(e,t,r,n,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(r=Us(i.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let a=i.run(t,n,o);if(a){let c=new d1(i,a,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||i.aborted)return r}}}return r}function nL(e,t){let r=Us(e,t,void 0,pa,{errors:"all"});if(r){let n=new Ft(pa,r);return re(n)}return X(t)}function oL(e){if(!jl(e))return;let t=e.annotations?.[By];return or(t)?t(e.typeParameters):void 0}function UQ(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function DQ(e){return e===void 0||typeof e=="string"}function sL(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}r.set(o,!1),n.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function Vl(e){return sL(e,UQ)}var $l=new uc([],()=>(e,t,r)=>Vl(e)?nt:D(new at(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>Wv}),iL=Fs($l,{representation:{id:"effect/schema/MutableJson",payload:null}}),zv=new jt($l,Nl()),aL=new jt(new Sn([new Xo(!1,[],[$l]),new Tm([],[new Rv(Ro,$l)])]),Nl());function LQ(e){return sL(e,DQ)}var BQ=new uc([],()=>(e,t,r)=>LQ(e)?nt:D(new at(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),Wv=new jt(BQ,Nl());var aS=(e,t,r)=>e===nt?r(t):ur(e,r);function uL(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===nt?e.decode(Dr(mm(n)),o):e.decode(Eu(r,mm),o);return cL(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===nt?Dr(n):r;case"Transform":{let r=n=>n===ve?no:Dr(t.transform(n));return(n,o)=>aS(n,o,r)}case"TransformOptional":{let r=n=>Xw(t.transform(mm(n)));return(n,o)=>aS(n,o,r)}case"TransformEffect":return(r,n,o)=>aS(r,n,s=>s===ve?no:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>aS(r,n,s=>cL(t.transform(mm(s),o)))}}var cL=e=>ur(e,Xw),fL=(e,t,r,n)=>rt(n,o=>aa(()=>Ka(o,s=>new p1(e,s,t,r))));function $Q(e,t){let r=uL(e.link.transformation),n;return(o,s)=>{if(o===ve)return no;if(e.isConstructed(o))return nt;let i=(n??=t(e.link.to))(o,s);return r(i,o,s)}}function jQ(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==ve&&n!==void 0)return t(n,o);let s=r;if(Xe(s)&&s._tag==="Success"){let i=t(s[Se],o);return i===nt?s:i}return ur(fL(e,n,o,s),i=>{let a=t(i,o);return a===nt?Dr(i):a})}}function Kv(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:jQ(e,r)}function km(e,t,r,n,o){if(e._tag==="Declaration")for(let x of e.typeParameters)t(x);let s=r?oL(e):void 0,i=s?$Q(s,t):n??e.getParser(t,r),a=e.checks,c=e.encoding,u=c?.map(x=>uL(x.transformation)),f=e.encodingChecks;if(!c&&!a&&!f)return i;let p,m=(x,g)=>{let y=i(x,g);if(f&&!g.disableChecks)if(Xe(y)){if(y._tag==="Success"){let E=y===nt?x:y[Se];if(x!==ve&&E!==ve){let b=Us(f,x,void 0,e,g);b&&(y=D(new Ft(e,b,x,g)))}}}else y=A(y,E=>{if(x!==ve&&E!==ve){let b=Us(f,x,void 0,e,g);if(b)return D(new Ft(e,b,x,g))}return I(E)});if(a&&!g.disableChecks)if(Xe(y)){if(y._tag==="Success"){let E=y===nt?x:y[Se];if(E===ve)return y;let b=Us(a,E,void 0,e,g);b&&(y=D(new Ft(e,b,E,g)))}}else y=A(y,E=>{if(E!==ve){let b=Us(a,E,void 0,e,g);if(b)return D(new Ft(e,b,E,g))}return I(E)});return y},h=o===void 0?m:o(m);return c?(x,g)=>{let y=p??=c.map(v=>t(v.to)),E=x,b=y[y.length-1](x,g);for(let v=c.length-1;v>=0;v--)if(b=u[v](b,E,g),v!==0){let T=y[v-1];b._tag==="Success"?(E=b[Se],b=T(E,g)):b=ur(b,S=>{let w=T(S,g);return w===nt?Dr(S):w})}if(b._tag==="Success"){let v=b[Se],T=h(v,g);return T===nt?b:T}return b=fL(e,x,g,b),ur(b,v=>{let T=h(v,g);return T===nt?Dr(v):T})}:h}var fS=Symbol(),lL=new WeakMap,dL,Gl=!1;var qQ=e=>Gl?uS(Po,e,"parser"):Po(e).parser,pL=e=>Gl?uS(Po,e,"makeEffect"):Po(e).makeEffect,zQ=e=>Kv(e,pL),cS=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=km(this.ast,qQ)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=km(this.ast,pL,zQ)}},Vv=class extends cS{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r=="function"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??km(this.ast,t=>uS(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",WQ(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>uS(this.resolve,n,"makeEffect");return this.save("makeEffect",km(this.ast,r,n=>Kv(n,r)))}};function WQ(e,t){let r;return(n,o)=>{if(n!==ve)try{let s=e(n,o);if(s!==fS)return s===n?nt:Dr(s)}catch(s){return gn(s)}return(r??=t())(n,o)}}function uS(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,i)=>(o??=n[r])(s,i)}function Po(e){let t=lL.get(e);if(t!==void 0)return t;let r=dL===void 0?new cS(e):new Vv(e,dL(e,Po),Po);return lL.set(e,r),r}function Jv(e){let t=e.ast,r;return(n,o)=>(r??=rC(e9,Nt(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function dS(e){let t=Jv(e);return(r,n)=>{let o=ki(t(r,n));return ft(o)?N(o.value):(ko(o.cause,"Option adapter can only return none for schema issues"),_())}}function pS(e){return YQ(Nt(e.ast))}function Zv(e){return Rm(e.ast)}function VQ(e){if(!Gl){let o=Jl(xS(e));return s=>{let i=o(s,nn);return ft(i)?!0:(ko(i.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=Po(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,nn)}catch(s){return ko(cl(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=ki(tC(n(o,nn),o));return ft(s)?!0:(ko(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function Rm(e){let t=Nt(e),r=n=>(r=VQ(t),r(n));return n=>r(n)}function mL(e){let t=xS(e);return(r,n)=>{let o=ki(t(r,n));if(!ft(o))return ko(o.cause,"Issue adapter can only return schema issues")}}function hL(e,t){let r=Nt(e.ast),n=Po(r).parser(t,nn),o=ki(tC(n,t));if(vs(o)){let s=ko(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function ot(e,t){let r=xS(e.ast);return t===void 0?r:(n,o)=>r(n,eC(t,o))}var Qv=ot;function xL(e,t){return Jl(ot(e,t))}function Yv(e,t){return TL(ot(e,t))}var gL=Yv;function yL(e,t){return wL(ot(e,t))}function GQ(e,t){return Gl?vL(e.ast,t):nC(ot(e,t))}var mS=GQ;function ju(e,t){let r=xS(Oo(e.ast));return t===void 0?r:(n,o)=>r(n,eC(t,o))}var SL=ju;function bL(e,t){return Jl(ju(e,t))}function Xv(e,t){return TL(ju(e,t))}var EL=Xv;function IL(e,t){return wL(ju(e,t))}function JQ(e,t){return Gl?vL(Oo(e.ast),t):nC(ju(e,t))}var hS=JQ,eC=(e,t)=>t?{...e,...t}:e,lS=e=>e===ve?D(new le):I(e);function xS(e){return rC(XQ,e)}function tC(e,t){return e===nt?I(t):Xe(e)?e[Se]===ve?lS(ve):e:ur(e,lS)}function rC(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??nn);return s===nt?I(n):Xe(s)?s[Se]===ve?lS(ve):s:ur(s,lS)}}function Jl(e){return(t,r)=>ki(e(t,r))}function TL(e){let t=Jl(e);return(r,n)=>{let o=t(r,n);return ft(o)?N(o.value):(ko(o.cause,"Option adapter can only return none for schema issues"),_())}}function wL(e){let t=Jl(e);return(r,n)=>{let o=t(r,n);return ft(o)?X(o.value):re(ko(o.cause,"Result adapter can only return schema issues"))}}function vL(e,t){let r;return(n,o)=>(r??=ZQ(Po(e),t))(n,o)}function ZQ(e,t){let r=e.decode,n,o=r===void 0?(s,i=nn)=>(n??=Gv(e))(s,i):(s,i=nn)=>{if(s===ve)return(n??=Gv(e))(s,i);let a;try{a=r(s,i)}catch(c){throw ko(cl(c),"Sync adapter can only throw schema issues"),c}return a!==fS?a:(n??=Gv(e))(s,i)};return t===void 0?o:(s,i)=>o(s,eC(t,i))}function Gv(e){return nC(rC(()=>e.decodeEffect,e.ast))}function nC(e){let t=Jl(e);return(r,n)=>{let o=t(r,n);if(ft(o))return o.value;let s=ko(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function QQ(e,t){let r=ki(e);if(ft(r))return r.value;let n=ko(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function YQ(e){let t,r;return(n,o)=>{t??=Po(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??nn,i=t.make;if(i!==void 0&&n!==ve){let c;try{c=i(n,s)}catch(u){throw ko(cl(u),"Constructor adapter can only throw schema issues"),u}if(c!==fS&&c!==ve)return c}let a=(r??=t.makeEffect)(n,s);return QQ(tC(a,n),"Constructor adapter can only throw schema issues")}}var XQ=e=>Po(e).parser,e9=e=>Po(e).makeEffect;var gS="~effect/Schema/Schema",CL=Symbol(),t9={[gS]:gS,get make(){let e=pS(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Jv(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=dS(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return V(this,arguments)},annotate(e){return this.rebuild(Fs(this.ast,e))},annotateKey(e){return this.rebuild(Wl(this.ast,e))},check(...e){return this.rebuild(Pi(this.ast,e))},rebuild(e){return Ls(e,this[CL])}};function Ls(e,t){function r(){}let n=Object.setPrototypeOf(r,t9);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[CL]=t,n.ast=e,n}function oC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Om(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function sC(e){return encodeURI(oC(e)).replace(/#/g,"%23")}function iC(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let r=decodeURIComponent(t);return r.startsWith("/")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function kL(e){let t=iC(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(Om)}function RL(e){return e.reduce((t,r)=>`${t}/${sC(r)}`,"#")}var n9="http://json-schema.org/draft-07/schema#",OL="https://json-schema.org/draft/2020-12/schema";function _L(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function FL(e){return{dialect:"draft-07",...c9(e,y9)}}function o9(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Jt(n))return n;let i=o||!s&&DL(n.$id),a={};for(let c of Object.keys(n)){let u=n[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=cC(u,p=>r(p,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(p=>r(p,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":f=r(u,i)}B(a,c,f)}return t(a,i),a}}function NL(e,t){return o9(e,r=>{s9(r,t)})}function s9(e,t){typeof e.$ref=="string"&&B(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&B(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function cC(e,t){if(!Jt(e))return;let r={};for(let n of Object.keys(e))B(r,n,t(e[n],n));return r}function i9(e,t,r){let n=new Map,o=[],s=aC;function i(m,h=[],x=[]){if(h.length===0&&t?.trackIds){let g=Jt(m)?f(m):void 0;s=PL(g,aC)??aC}return u(m,h,x,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[m,h,x]of o){let g=h,y=UL(h,x);if(y!==void 0){let E=kL(y.hash);if(y.hash="",E!==void 0){let b=n.get(ML(y.href,E));b!==void 0&&(g=a9(h,b))}}B(m,"$ref",g)}}let c=r(i);return a(),c;function u(m,h,x,g){if(typeof m=="boolean")return p(h,x,g),t?.booleanAdapter?.(m)??m;if(!Jt(m))return m;let y=g,E=f(m);if(h.length>0&&t?.trackIds&&DL(E)){let T=PL(E,g.uri);T!==void 0&&(y={parent:g,sourceRoot:h,targetRoot:x,uri:T})}p(h,x,y);let b=y.uri,v={isDocumentRoot:h.length===0,schema(T,S,w=S){return u(T,[...h,S],[...x,w],y)},schemaAt(T,S,w){return u(T,[...h,...S],[...x,...w],y)},schemaArray(T,S,w=S){return Array.isArray(T)?T.map((k,C)=>u(k,[...h,S,String(C)],[...x,w,String(C)],y)):T},schemaMap(T,S,w=S){return Jt(T)?cC(T,(k,C)=>u(k,[...h,S,C],[...x,w,C],y)):T},reference(T,S){typeof S=="string"?o.push([T,S,b]):B(T,"$ref",S)}};return e(m,v)}function f(m){return t?.ignoreRefSiblings===!0&&typeof m.$ref=="string"?void 0:m.$id}function p(m,h,x){x.parent!==void 0&&p(m,h,x.parent),n.set(ML(x.uri,m.slice(x.sourceRoot.length)),h.slice(x.targetRoot.length))}}var aC="https://effect.invalid/.json-schema/";function UL(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function PL(e,t){if(typeof e!="string")return;let r=UL(e,t);if(r!==void 0)return r.hash="",r.href}function a9(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${RL(t)}`}function ML(e,t){return`${e}\0${JSON.stringify(t)}`}function DL(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function c9(e,t,r){return i9(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:cC(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var u9=new Set(["properties","patternProperties"]),f9=new Set(["allOf","anyOf","oneOf"]),l9=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function d9(e,t,r,n,o,s=u9){let i;if(s.has(t))i=n.schemaMap(r,t);else if(f9.has(t))i=n.schemaArray(r,t);else if(o.has(t))i=n.schema(r,t);else return!1;return B(e,t,i),!0}var LL=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],cge=[...LL,"deprecated"],uge=[...LL,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],p9=/^[A-Za-z_][-A-Za-z0-9._]*$/,m9=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Hu(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function h9(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&Hu(o,r,`it is not active in ${n} but would become active in the target`)}var x9=["additionalItems","definitions","dependencies"];function g9(e,t,r,n,o){r.isDocumentRoot?B(e,"$schema",_L(t,OL)?n:t):_L(t,OL)||Hu("$schema",o,"an embedded resource cannot declare a different dialect")}function y9(e,t){h9(e,x9,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let i of Object.keys(e)){let a=e[i];if(!d9(r,i,a,t,l9))switch(i){case"$ref":n=a;break;case"$schema":g9(r,a,t,n9,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":B(r,"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":Hu(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;B(r,i,a);break;default:B(r,i,a)}}if(S9(r,o,s,t),Object.hasOwn(e,"contains")){let i=e.minContains,a=e.maxContains;(i!==void 0&&i!==1||a!==void 0)&&Hu("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&B(r,"minContains",i)}else Object.hasOwn(e,"minContains")&&B(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&B(r,"maxContains",e.maxContains);return E9(e,r,t,"draft-07"),T9(e,r,"$id","Draft-07"),b9(r,n,t),r}function S9(e,t,r,n){if(t===void 0){r!==void 0&&B(e,"items",n.schema(r,"items"));return}B(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&B(e,"additionalItems",n.schema(r,"items","additionalItems"))}function b9(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),I9(e,n)}else r.reference(e,t)}function E9(e,t,r,n){let o=Jt(e.dependentRequired)?e.dependentRequired:void 0,s=Jt(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],f=s?.[c],p=n==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?p||B(i,c,u):u===void 0||p?B(i,c,r.schemaAt(f,["dependentSchemas",c],["dependencies",c])):B(i,c,{allOf:[r.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(i).length>0&&B(t,"dependencies",i)}function I9(e,t){Array.isArray(e.allOf)?e.allOf.push(t):B(e,"allOf",[t])}function T9(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&B(t,r,o);return}(typeof s!="string"||!p9.test(s))&&Hu("$anchor",n,"the anchor is not valid"),m9.test(s)||Hu("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?B(t,r,`#${s}`):Hu("$anchor",n,"it cannot be combined with the schema $id")}function yS(e){return Ls(Zl(e.ast),{schema:e})}var Zl=ma(e=>{let t=v9(e,Zl),r=e.context;return t===e||r===void 0?t:zl(t,uC(r))});function uC(e){return e.constructorDefault===void 0?e:new Yo(e.isOptional,e.isMutable,void 0,e.annotations)}function jL(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function HL(e){return t=>{let r=[...t].sort((o,s)=>e(Bn(o))-e(Bn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var w9=HL(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function v9(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!or(r))return lt(e,[zv]);let n=e.typeParameters.map(s=>Ls(Bn(s))),o=r(n);return o===void 0?e:lt(e,[fc(o,t)])}case"Unknown":return lt(e,[zv]);case"ObjectKeyword":return lt(e,[aL]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jL(e),e.recur(t,iS);case"Union":{let r=w9(e.types);return r!==e.types?new Sn(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function SS(e){return Ls(qL(Nt(e.ast)))}var qL=mo(e=>{let t=C9(e,qL);return t!==e&&e.context!==void 0?zl(t,uC(e.context)):t});function C9(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(or(r)){let n=r(e.typeParameters.map(o=>Ls(o)));return lt(e,[fc(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function bS(e){return Ls(VL(e.ast),{schema:e})}function zL(e){return Ls(GL(e.ast))}var A9=HL(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function k9(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(u=>Ls(t(Bn(u)))),o=e.annotations?.toCodecStringTree;if(or(o)){let u=o(n);return u===void 0?e:lt(e,[fc(u,t)])}let s=e.annotations?.toCodecJson,i=or(s)?s(n):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(or(a)?a(n):void 0);return c===void 0?r(e):lt(e,[fc(c,t)])}case"Null":return lt(e,[R9]);case"Boolean":return lt(e,[O9]);case"Unknown":case"ObjectKeyword":return lt(e,[Wv]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jL(e),e.recur(t,iS);case"Union":{let n=A9(e.types);return n!==e.types?new Sn(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var R9=new jt(new Ln("null"),new et(Ie(()=>null),Ie(()=>"null"))),O9=new jt(new Sn([new Ln("true"),new Ln("false")]),new et(Ie(e=>e==="true"),Uu())),WL=new et(Ie(e=>typeof e=="string"?[e]:e),Oi()),KL=e=>e.transformation===WL,VL=ma(e=>{let t=k9(e,VL,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?zl(t,uC(e.context)):t},{stopAt:KL}),$L=e=>Lr(e)?$u(pa):pa,GL=ma(e=>{let t=_9(e);if(Iv(t)){let r=Kl(new Sn([new Xo(t.isMutable,t.elements.map($L),t.rest.map($L)),Ro],{mode:"anyOf"}),t,WL);return Lr(e)?$u(r):r}return t},{stopAt:KL});function _9(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(GL):e}var lge=globalThis.RegExp;var ha=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function lc(e,t){return t.length>0&&(e+=`
|
|
27
|
+
at ${Sx(t)}`),new Error(e)}function JL(e){return`#/$defs/${sC(e)}`}var P9=new Set([...l1,Fu,...f1]);function Pm(e,t){if(e===void 0)return;let r={},n=e.title;typeof n=="string"&&(r.title=n);let o=e.description,s=e.expected;typeof o=="string"?r.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(r.description=s);let i=e.default;Vl(i)&&(r.default=i);let a=e.examples;Array.isArray(a)&&Vl(a)&&(r.examples=a);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(r.writeOnly=u);let f=e.format;typeof f=="string"&&(r.format=f);let p=e.contentEncoding;typeof p=="string"&&(r.contentEncoding=p);let m=e.contentMediaType;typeof m=="string"&&(r.contentMediaType=m);let h=e.contentSchema;if(Vl(h)&&(r.contentSchema=h),t?.includeAnnotationKey!==void 0)for(let[x,g]of Object.entries(e))P9.has(x)||!t.includeAnnotationKey(x)||Vl(g)&&B(r,x,g);return Object.keys(r).length===0?void 0:r}function ZL(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let i=ZL(s);i.type!==void 0&&(o=!0,(t===void 0||i.type==="integer")&&(t=i.type)),Object.keys(i.schema).length>0&&n.push(i.schema)}if(o){let{allOf:s,...i}=r;r=n.length===0?i:{...i,allOf:n}}}return{type:t,schema:r}}function M9(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}var QL="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function ES(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function F9(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var N9="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",U9="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function D9(e,t,r){if(typeof e.$ref=="string")return;let n={...e,...t};for(let o of r){if(!Object.hasOwn(e,o))continue;let s=e[o],i=t[o];if(typeof s!="number"||typeof i!="number")return;if(N9.includes(`|${o}|`))n[o]=Math.max(s,i);else if(U9.includes(`|${o}|`))n[o]=Math.min(s,i);else return}return typeof n.minimum=="number"&&typeof n.exclusiveMinimum=="number"&&delete n[n.exclusiveMinimum>=n.minimum?"minimum":"exclusiveMinimum"],typeof n.maximum=="number"&&typeof n.exclusiveMaximum=="number"&&delete n[n.exclusiveMaximum<=n.maximum?"maximum":"exclusiveMaximum"],n}var dC="|title|description|default|examples|readOnly|writeOnly|",L9=QL+dC;function Mm(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=M9(e);if(o!==void 0||s){let a=ZL(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(a.schema);return f.length===0?u:ES(a.schema,dC)&&F9(u,f)?{...u,...a.schema}:Mm(u,a.schema,r)}}if(r){let a=D9(e,t,n);if(a!==void 0)return a}let i=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...i]}:typeof e.$ref=="string"?{allOf:[e,...i]}:{...e,allOf:i}}function lC(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>lC(r,t)))}function B9(e){return Array.isArray(e)}function $9(e,t,r,n){let o=new Map,s=new Map,i=new WeakMap,a=new Map,c=new Map,u=Object.keys(r);for(let S of u)x(S,["references",S]);let f=Bo(e,(S,w)=>b(S,t[w],[]));for(let[S,w]of a.values())if(!lC(S))for(let k of w)Array.isArray(k.oneOf)&&(k.anyOf=k.oneOf,delete k.oneOf);for(let S of u){let w=r[S],k=y(w);if(k===void 0)continue;let C=o.get(S)[0],R=c.get(k),M=R?.find($=>Z(o.get($)[0],C));M===void 0?R===void 0?c.set(k,[S]):R.push(S):s.set(S,M)}let p=Bo(f,g),m={};for(let S of u)s.has(S)||B(m,S,g(o.get(S)[0]));return{dialect:"draft-2020-12",schemas:p,definitions:m};function h(S){return Array.isArray(S.oneOf)&&a.get(S.oneOf)?.[1].push(S),S}function x(S,w){if(!Object.hasOwn(r,S))throw lc(`Invalid reference ${S}`,[...w,"$ref"]);let k=o.get(S);if(k!==void 0)return k;let C=[{},[]];return o.set(S,C),C[0]=b(r[S],["references",S],C[1]),C}function g(S){return NL(S,w=>{let k=iC(w);if(k===void 0){if(/^#(?:\/|%2f)/i.test(w))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(w)}`);return w}if(!k.startsWith("/$defs/"))return w;let C=k.indexOf("/",7),R=s.get(Om(k.slice(7,C<0?void 0:C)));return R===void 0?w:w.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,JL(R))})}function y(S){if(S._tag==="Reference")return;let w=S.checks.length===0?S.annotations:S.checks[S.checks.length-1].annotations;return typeof w?.identifier!="string"&&typeof w?.[Fu]=="string"?w[Fu]:void 0}function E(S,w,k,C){let R=S.annotations,M=R?.toJsonSchema;if(M!==void 0){let Le=S.representation?.schemas?.map((Rn,nI)=>b(Rn,[...k,"representation","schemas",nI],C))??[],Er=M({type:w,schemas:Le}),Ee=B9(Er);Ee&&C.push(!1);let Oe=Ee?Er[0]:Er,rr=Pm(R,n),lo=rr===void 0?Oe:{...Oe,...rr},Xs=rr===void 0?QL:L9;return[lo,S._tag==="Filter"&&ES(lo,Xs)&&(rr===void 0||ES(rr,dC))?!0:void 0]}if(S._tag==="Filter"){C.push(!1);return}let $=S.checks.flatMap((Le,Er)=>{let Ee=E(Le,w,[...k,"checks",Er],C);return Ee===void 0?[]:[Ee[0]]});if($.length===0)return;let te=Pm(R,n),xe={allOf:$};return[te===void 0?xe:{...xe,...te}]}function b(S,w,k){if(S._tag==="Reference")return k.push(x(S.$ref,w)[1]),{$ref:JL(S.$ref)};let C=i.get(S);if(C!==void 0)return k.push(C[1]),C[0];let R=[];k.push(R);let M=v(S,w,R),$=Pm(S.annotations,n);$!==void 0&&(M={...M,...$});for(let te=0;te<S.checks.length;te++){let xe=typeof M.type=="string"&&j9(M.type)?M.type:void 0,Le=E(S.checks[te],xe,[...w,"checks",te],R);Le!==void 0&&(M=Mm(M,...Le))}return i.set(S,[M,R]),h(M)}function v(S,w,k){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":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(S.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(S.symbol)]};case"Declaration":return k.push(!1),{};case"Suspend":return b(S.thunk,[...w,"thunk"],k);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let C=S.literal;return typeof C=="bigint"?{type:"string",enum:[globalThis.String(C)]}:{type:typeof C,enum:[C]}}case"Enum":{let C=S.enums.map(([R,M],$)=>{if(typeof M=="number"&&!globalThis.Number.isFinite(M))throw lc(`Invalid numeric enum value ${globalThis.String(M)}`,[...w,"enums",$,1]);return{type:typeof M,enum:[M],title:R}});return C.length===0?{not:{}}:{anyOf:C}}case"TemplateLiteral":return{type:"string",pattern:`^${S.parts.map(IS).join("")}$`};case"Arrays":{if(S.rest.length>1)throw lc("Invalid schema representation document",[...w,"rest"]);let C={type:"array"},R=S.elements.length,M=S.elements.map(($,te)=>{$.isOptional&&R--;let xe=b($.type,[...w,"elements",te,"type"],k),Le=Pm($.annotations,n);return Le===void 0?xe:h(Mm(xe,Le))});if(M.length>0?(C.prefixItems=M,C.maxItems=S.elements.length,R>0&&(C.minItems=R)):C.items=!1,S.rest.length===1){delete C.maxItems;let $=b(S.rest[0],[...w,"rest",0],k);Object.keys($).length>0?C.items=$:delete C.items}return C}case"Objects":{if(S.propertySignatures.length===0&&S.indexSignatures.length===0)return{not:{type:"null"}};let C={type:"object"},R={},M=[];for(let Ee=0;Ee<S.propertySignatures.length;Ee++){let Oe=S.propertySignatures[Ee];if(typeof Oe.name!="string")throw lc("Invalid schema representation document",[...w,"propertySignatures",Ee,"name"]);let rr=Oe.name,lo=b(Oe.type,[...w,"propertySignatures",Ee,"type"],k),Xs=Pm(Oe.annotations,n);B(R,rr,Xs===void 0?lo:h(Mm(lo,Xs))),Oe.isOptional||M.push(rr)}S.propertySignatures.length>0&&(C.properties=R),M.length>0&&(C.required=M);let $={},te=[],xe=[],Le=!1;for(let Ee=0;Ee<S.indexSignatures.length;Ee++){let Oe=S.indexSignatures[Ee],rr=b(Oe.type,[...w,"indexSignatures",Ee,"type"],k);Z(rr,{not:{}})&&(rr=!1),xe.push(rr);let lo=T(Oe.parameter,[...w,"indexSignatures",Ee,"parameter"],new Set);if(lo===void 0){Le=!0,k.push(!1);continue}if(lo.length===0)te.push(rr);else for(let Xs of lo){let Rn=$[Xs];B($,Xs,Rn===void 0?rr:Rn===!1||rr===!1?!1:h(Mm(Rn,rr)))}}let Er=Object.keys($).length>0;if(Er&&(C.patternProperties=$),Le&&n?.onExcessProperty==="error"){let Ee=[];S.propertySignatures.length>0&&Ee.push({enum:Object.keys(R)});for(let Oe=0;Oe<S.indexSignatures.length;Oe++)Ee.push(b(S.indexSignatures[Oe].parameter,[...w,"indexSignatures",Oe,"parameter"],k));C.propertyNames=Ee.length===1?Ee[0]:{anyOf:Ee},C.additionalProperties=xe.length===1?xe[0]:{anyOf:xe},te.length>0&&(C.allOf=te.map(Oe=>({type:"object",additionalProperties:Oe})))}else te.length===0?C.additionalProperties=Le||n?.onExcessProperty!=="error":te.length===1&&S.propertySignatures.length===0&&!Er?C.additionalProperties=te[0]:te.length>0&&(C.allOf=te.map(Ee=>({type:"object",additionalProperties:Ee})));return typeof C.additionalProperties=="object"&&C.additionalProperties!==null&&Object.keys(C.additionalProperties).length===0&&delete C.additionalProperties,C}case"Union":{let C=[],R=S.types.map(($,te)=>b($,[...w,"types",te],C));if(k.push(C),R.length===0)return{not:{}};let M=S.options?.mode??"anyOf";if(M==="anyOf"&&R.length>1){let $=H9(R);if($!==void 0)return $}return M==="oneOf"&&a.set(R,[C,[]]),{[M]:R}}}}function T(S,w,k){switch(S._tag){case"Reference":{if(!Object.hasOwn(r,S.$ref))throw lc(`Invalid reference ${S.$ref}`,[...w,"$ref"]);if(x(S.$ref,w),k.has(S.$ref))return;let C=new Set(k).add(S.$ref);return T(r[S.$ref],["references",S.$ref],C)}case"String":{if(S.checks.length===0)return[];if(S.checks.length!==1||S.checks[0]._tag!=="Filter"||S.checks[0].annotations?.toJsonSchema===void 0)return;let C=[],R=b(S,w,C);return lC(C)&&R.type==="string"&&typeof R.pattern=="string"&&ES(R,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[R.pattern]:void 0}case"TemplateLiteral":return S.checks.length===0?[`^${S.parts.map(IS).join("")}$`]:void 0;case"Union":{if(S.types.length===0||S.checks.length>0||S.options?.mode==="oneOf")return;let C=[];for(let R=0;R<S.types.length;R++){let M=T(S.types[R],[...w,"types",R],k);if(M===void 0)return;if(M.length===0)return[];C.push(...M)}return C}default:throw lc("Invalid schema representation document",w)}}}function j9(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function H9(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function IS(e){switch(e._tag){case"Literal":return ha(globalThis.String(e.literal));case"String":return eL;case"Number":return Xy;case"TemplateLiteral":return e.parts.map(IS).join("");case"Union":return`(?:${e.types.map(IS).join("|")})`;default:throw lc("Invalid schema representation document",[])}}function TS(e,t){let r=$9([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var q9=({identifier:e})=>e;function Bs(e){return e===void 0?void 0:{annotations:e}}function Fm(e,t){let{references:r,representations:n}=z9([e],t);return{representation:n[0],references:r}}function z9(e,t){let r={},n=new Map,o=new Set,s=new Map,i=new Set;for(let S of e)h(S);let a=t?.referencePolicy??q9;for(let S of s.values())for(let w of S.values()){let k=a({ast:w.ast,occurrences:w.occurrences,identifier:w.identifier});if(k!==void 0){let C=k===w.identifier||!k.endsWith("_")?"_":"";w.reference=u(k,w,C)}else w.isRecursive&&(w.reference=u(`${w.ast._tag}_`,w,""))}return{representations:Bo(e,S=>g(S)),references:r};function u(S,w,k="_"){let C=S,R=0;for(;n.has(C);){if(n.get(C)===w)return C;C=`${S}${k}${++R}`}return n.set(C,w),C}function f(S,w,k){let C=w.fallback;return C!==void 0?Qw(S)===C?S:Fs(S,{[Fu]:C}):k===w.identifier?S:Fs(S,{identifier:k})}function p(S,w){if(!Object.hasOwn(r,S)&&!o.has(S)){o.add(S);let k=y(w);o.delete(S),B(r,S,k)}return{_tag:"Reference",$ref:S}}function m(S){let w=ql(S),k=Hl(w),C=_l(w),R=C===void 0?(w!==S?_l(S):void 0)??Qw(w):void 0;R!==void 0&&(C=`${R}Encoded`);let M=s.get(k);M===void 0&&(M=new Map,s.set(k,M));let $=M.get(C);return $===void 0&&($={ast:k,identifier:C,fallback:R,occurrences:0,isRecursive:!1,reference:void 0},M.set(C,$)),$}function h(S){let w=m(S),k=w.ast;if(w.occurrences++,i.has(w)){w.isRecursive=!0;return}if(!(w.occurrences>1)){switch(i.add(w),x(k.checks),k._tag){case"Declaration":case"Arrays":case"Objects":case"Union":k.recur(C=>(h(C),C));break;case"TemplateLiteral":k.parts.forEach(h);break;case"Suspend":h(k.thunk());break}i.delete(w)}}function x(S){S?.forEach(w=>{w.annotations?.representation?.schemas?.forEach(k=>h(Nt(k))),w._tag==="FilterGroup"&&x(w.checks)})}function g(S){let w=m(S),k=w.ast,C=w.reference;if(C!==void 0){let R=w.identifier===void 0?k:f(k,w,C);return p(C,R)}return y(k)}function y(S){let w=E(S.checks);switch(S._tag){case"Declaration":return{_tag:"Declaration",typeParameters:S.typeParameters.map(k=>g(k)),checks:w,...v(S.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:S._tag,checks:w,...Bs(S.annotations)};case"Literal":return{_tag:"Literal",literal:S.literal,checks:w,...Bs(S.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:S.symbol,checks:w,...Bs(S.annotations)};case"Enum":return{_tag:"Enum",enums:S.enums,checks:w,...Bs(S.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:S.parts.map(k=>g(k)),checks:w,...Bs(S.annotations)};case"Arrays":return{_tag:"Arrays",elements:S.elements.map(k=>{let C=ql(k),R=C.context?.annotations;return{isOptional:Lr(C),type:g(k),...Bs(R)}}),rest:S.rest.map(k=>g(k)),checks:w,...Bs(S.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:S.propertySignatures.map(k=>{let C=ql(k.type),R=C.context?.annotations;return{name:k.name,type:g(k.type),isOptional:Lr(C),isMutable:Z2(C),...Bs(R)}}),indexSignatures:S.indexSignatures.map(k=>({parameter:g(k.parameter),type:g(k.type)})),checks:w,...Bs(S.annotations)};case"Union":return{_tag:"Union",types:S.types.map(k=>g(k)),...S.options===void 0?{}:{options:S.options},checks:w,...Bs(S.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:g(S.thunk()),...Bs(S.annotations)}}}function E(S){return S?.map(b)??[]}function b(S){switch(S._tag){case"Filter":return{_tag:"Filter",aborted:S.aborted,...T(S.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Bo(S.checks,b),...T(S.annotations)}}}function v(S){if(S===void 0)return;let{representation:w,...k}=S;return{...w===void 0?void 0:{representation:w},...Object.keys(k).length===0?void 0:{annotations:k}}}function T(S){if(S===void 0)return;let{representation:w,...k}=S,C=w===void 0?void 0:w.schemas===void 0?w:{...w,schemas:w.schemas.map(R=>g(Nt(R)))};return{...C===void 0?void 0:{representation:C},...Object.keys(k).length===0?void 0:{annotations:k}}}}function eB(e){return ft(e)?e.value:{issues:[{message:SN(e.cause)}]}}function rB(e,t){let r=ot(e),n={errors:"all",...t?.parseOptions},o=S1(t),s=i=>{let a=new fi("sync"),c=Yp(Z0(r(i,n),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?eB(u):new Promise(f=>{c.addObserver(p=>{f(eB(p))})})};if(Object.hasOwn(e,"~standard")){let i=e;return"validate"in i["~standard"]||Object.assign(i["~standard"],{validate:s}),i}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function W9(e){let t=Fm(Zl(e));return TS(t)}function tB(e,t){let r=W9(e);if(t==="draft-2020-12"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t==="draft-07"){let n=FL(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function nB(e){let t={input(r){return tB(e.ast,r.target)},output(r){return tB(Nt(e.ast),r.target)}};if(Object.hasOwn(e,"~standard")){let r=e;return"jsonSchema"in r["~standard"]||Object.assign(r["~standard"],{jsonSchema:t}),r}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function sB(e,t){let r=[];return pC(e,t,"",r),r}function pC(e,t,r,n){if(!Object.is(e,t)){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++)pC(e[a],t[a],`${r}/${a}`,n);for(let a=o-1;a>=s;a--)n.push({op:"remove",path:`${r}/${a}`});for(let a=o;a<s;a++)n.push({op:"add",path:`${r}/${a}`,value:t[a]});return}if(wS(e)&&wS(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=`${r}/${oC(a)}`,u=Object.hasOwn(e,a),f=Object.hasOwn(t,a);u&&f?pC(e[a],t[a],c,n):!u&&f?n.push({op:"add",path:c,value:t[a]}):n.push({op:"remove",path:c})}return}n.push({op:"replace",path:r,value:t})}}function iB(e,t){let r=t;for(let n of e)r=G9(r,n);return r}function wS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function V9(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Om)}function aB(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function G9(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=J9(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=n==="-"?o.length:aB(n),a=t.op==="add"?o.length:o.length-1;if(i>a)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(i,0,t.value):t.op==="remove"?c.splice(i,1):c[i]=t.value,oB(s,c)}if(wS(o)){if(t.op!=="add"&&!Object.hasOwn(o,n))throw new Error(`Property "${n}" does not exist at "${t.path}".`);let i={...o};return t.op==="remove"?delete i[n]:B(i,n,t.value),oB(s,i)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function J9(e,t){let r=V9(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let i=0;i<r.length-1;i++){let a=r[i];if(Array.isArray(s)){let c=aB(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(wS(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:n}}function oB(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let i=o.slice();i[s]=r,r=i}else{let i={...o};B(i,s,r),r=i}}return r}function uB(e){let t=yS(e),r=hS(t),n=mS(t);return{empty:[],diff:(o,s)=>sB(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=r(o),a=iB(s,i);return Object.is(a,i)?o:n(a)}}}function fB(e,t){let r=_l(e.ast)??Yw(e.ast),n=SL(bS(e));return o=>n(o).pipe(K(s=>Q9(s,{rootName:r,...t})))}function Q9(e,t){let r=t.rootName??"root",n=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return f(r,e,0),c.join(o?`
|
|
28
|
+
`:"");function u(p,m){c.push(o?s.repeat(p)+m:m)}function f(p,m,h,x){let{attrs:g,safe:y}=Ql.tagInfo(p,x);if(m===void 0)u(h,`<${y}${g}/>`);else if(typeof m=="string")u(h,`<${y}${g}>${Ql.escapeText(m)}</${y}>`);else if(typeof m!="object"||m===null)u(h,`<${y}${g}>${Ql.escapeText(H(m))}</${y}>`);else{if(a.has(m))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:m});a.add(m);try{if(globalThis.Array.isArray(m)){if(m.length===0){u(h,`<${y}${g}/>`);return}u(h,`<${y}${g}>`);for(let v of m)f(n,v,h+1);u(h,`</${y}>`);return}let E=m,b=Object.keys(E);if(i&&b.sort(),b.length===0){u(h,`<${y}${g}/>`);return}u(h,`<${y}${g}>`);for(let v of b)f(Ql.parseTagName(v).safe,E[v],h+1,v);u(h,`</${y}>`)}finally{a.delete(m)}}}}var Ql={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r="_"+r),r=r.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(r)&&(r="_"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=Ql.parseTagName(e),s=r||t&&t!==e?` data-name="${Ql.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var mC=mo(e=>dc(e));function dc(e){let t=da(e)?.toEquivalence;if(t)return t(jl(e)?e.typeParameters.map(dc):[]);switch(e._tag){case"Never":return Qc();case"Declaration":return X9(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return Z;case"Arrays":{let r=e.elements.map(dc),n=e.rest.map(dc),[o,...s]=n,i=s.length;return Wr((a,c)=>{if(!Array.isArray(a)||!Array.isArray(c))return!1;let u=a.length;if(u!==c.length)return!1;let f=0;for(;f<Math.min(u,e.elements.length);f++)if(!r[f](a[f],c[f]))return!1;if(n.length>0){for(;f<u-i;f++)if(!o(a[f],c[f]))return!1;for(let p=0;p<i;p++)if(!s[p](a[f+p],c[f+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Z;let r=e.propertySignatures.map(o=>dc(o.type)),n=e.indexSignatures.map(o=>dc(o.type));return Wr((o,s)=>{if(!Jt(o)||!Jt(s))return!1;for(let i=0;i<r.length;i++){let a=e.propertySignatures[i],c=a.name,u=Object.hasOwn(o,c),f=Object.hasOwn(s,c);if(Lr(a.type)&&u!==f||u&&f&&!r[i](o[c],s[c]))return!1}for(let i=0;i<n.length;i++){let a=e.indexSignatures[i],c=_i(o,a.parameter),u=_i(s,a.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let p=c[f];if(!Object.hasOwn(s,p)||!n[i](o[p],s[p]))return!1}}return!0})}case"Union":{let r=Nt(e).types,n=vm(r),o=r.map((s,i)=>[Rm(s),dc(e.types[i])]);return Wr((s,i)=>{let a=n(s,!1);for(let c=0;c<a.length;c++){let[u,f]=o[a[c]];if(u(s)&&u(i))return f(s,i)}return!1})}case"Suspend":{let r;return Wr((n,o)=>(r??=mC(e.thunk()))(n,o))}}}function X9(e){let t=e.annotations?.representation;if(t===void 0)return Z;switch(t.id){case"effect/schema/Option":{let[r]=qu(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=qu(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?r(o.success,s.success):n(o.failure,s.failure))}case"effect/schema/CauseReason":{let[r,n]=qu(e);return dB(r,n)}case"effect/schema/Cause":{let[r,n]=qu(e);return lB(r,n)}case"effect/schema/Exit":{let[r,n,o]=qu(e),s=lB(n,o);return(i,a)=>i._tag===a._tag&&(i._tag==="Success"?r(i.value,a.value):s(i.cause,a.cause))}case"effect/schema/ReadonlyMap":{let[r,n]=qu(e);return yx(r,n)}case"effect/schema/ReadonlySet":return zd(qu(e)[0]);case"effect/schema/RegExp":return(r,n)=>r.source===n.source&&r.flags===n.flags;case"effect/schema/URL":return(r,n)=>r.toString()===n.toString();default:return Z}}function qu(e){return e.typeParameters.map(dc)}function dB(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case"Fail":return e(r.error,n.error);case"Die":return t(r.defect,n.defect);case"Interrupt":return r.fiberId===n.fiberId}}}function lB(e,t){let r=vx(dB(e,t));return(n,o)=>r(n.reasons,o.reasons)}function mB(e,t){return r=>{switch(r._tag){case"Fail":return`Fail(${e(r.error)})`;case"Die":return`Die(${t(r.defect)})`;case"Interrupt":return"Interrupt"}}}function pB(e,t){let r=mB(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function hB(e,t){let r=new Map;return n(e);function n(i){let a=r.get(i);return a===void 0&&(a=o(i),r.set(i,a)),a}function o(i){let a=da(i)?.toFormatter;if(typeof a=="function")return a(jl(i)?i.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(i,n);if(c!==void 0)return c}return s(i)}function s(i){switch(i._tag){default:return H;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let a=i.annotations?.representation;if(a===void 0)return H;let c=i.typeParameters.map(n);switch(a.id){case"effect/schema/Option":{let[u]=c;return Zt({onNone:()=>"none()",onSome:f=>`some(${u(f)})`})}case"effect/schema/Result":{let[u,f]=c;return zn({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${f(p)})`})}case"effect/schema/CauseReason":return mB(c[0],c[1]);case"effect/schema/Cause":return pB(c[0],c[1]);case"effect/schema/Exit":{let[u,f,p]=c,m=pB(f,p);return h=>{switch(h._tag){case"Success":return`Exit.Success(${u(h.value)})`;case"Failure":return`Exit.Failure(${m(h.cause)})`}}}case"effect/schema/ReadonlyMap":{let[u,f]=c;return p=>{let m=p.size;if(m===0)return"ReadonlyMap(0) {}";let h=globalThis.Array.from(p.entries()).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`ReadonlyMap(${m}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{let[u,f]=c;return p=>{let m=LD(p);if(m===0)return"HashMap(0) {}";let h=im(p).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`HashMap(${m}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[u]=c;return f=>{let p=f.size;if(p===0)return"ReadonlySet(0) {}";let m=globalThis.Array.from(f.values()).sort().map(h=>`${u(h)}`);return`ReadonlySet(${p}) { ${m.join(", ")} }`}}case"effect/schema/HashSet":{let[u]=c;return f=>{let p=HD(f);if(p===0)return"HashSet(0) {}";let m=globalThis.Array.from(f).sort().map(h=>`${u(h)}`);return`HashSet(${p}) { ${m.join(", ")} }`}}case"effect/schema/Chunk":{let[u]=c;return f=>{let p=hD(f);if(p===0)return"Chunk(0) {}";let m=globalThis.Array.from(f).sort().map(h=>`${u(h)}`);return`Chunk(${p}) { ${m.join(", ")} }`}}default:return H}}case"Arrays":{let a=i.elements.map(m=>n(m)),c=i.rest.map(n),[u,...f]=c,p=f.length;return m=>{let h=[],x=0;for(;x<a.length;x++)if(m.length<x+1){if(Lr(i.elements[x]))continue}else h.push(a[x](m[x]));if(c.length>0){for(;x<m.length-p;x++)h.push(u(m[x]));for(let g=0;g<p;g++)h.push(f[g](m[x+g]))}return"["+h.join(", ")+"]"}}case"Objects":{let a=i.propertySignatures.map(u=>n(u.type)),c=i.indexSignatures.map(u=>n(u.type));return i.propertySignatures.length===0&&i.indexSignatures.length===0?H:u=>{let f=[],p=new Set;for(let m=0;m<a.length;m++){let h=i.propertySignatures[m],x=h.name;p.add(x),!(Lr(h.type)&&!Object.hasOwn(u,x))&&f.push(`${ni(x)}: ${a[m](u[x])}`)}for(let m=0;m<c.length;m++){let h=_i(u,i.indexSignatures[m].parameter);for(let x of h)p.has(x)||(p.add(x),f.push(`${ni(x)}: ${c[m](u[x])}`))}return f.length>0?"{ "+f.join(", ")+" }":"{}"}}case"Union":{let a=Nt(i).types,c=vm(a),u=a.map((f,p)=>[Rm(f),n(i.types[p])]);return f=>{let p=c(f,!1);for(let m=0;m<p.length;m++){let[h,x]=u[p[m]];if(h(f))return x(f)}return H(f)}}case"Suspend":{let a;return c=>(a??=n(i.thunk()))(c)}}}}var hC=d(2,(e,t)=>yC(e,(r,n)=>gB(t,r)?[r,n]:void 0)),xC=d(2,(e,t)=>yC(e,(r,n)=>gB(t,r)?void 0:[r,n])),xB=d(2,(e,t)=>({...e,...t}));var gC=d(2,(e,t)=>yC(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var bn=e=>e;function gB(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function yC(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,i]=o;B(r,s,i)}}return r}function bB(e,t){return $s(Yl("Iso",e,t))}function yB(e,t){return $s(Yl("Lens",e,t))}function Yl(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var rY={kind:"Iso",get:F,set:F},vS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=CS(n),s=o,i=0;for(;i<t.length-1;i++){let a=t[i];B(s,a,CS(s[a])),s=s[a]}return B(s,t[i],r),o}}},Nm=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=r=>nL(t,r)}};function zu(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?r[r.length-1]=new vS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new Nm([...s.checks,...o.checks]):r.push(o)}return r}function nY(e,t){return $s(Yl("Optional",e,t))}var Xl=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return ap(this.replaceResult(t,r),()=>r)}modify(t){return r=>ap(hr(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return $s(zu(this.node,t.node))}key(t){return $s(zu(this.node,[new vS([t])]))}optionalKey(t){return $s(zu(this.node,Yl("Lens",r=>r[t],(r,n)=>{let o=CS(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&jx(t))?o.splice(Number(t),1):delete o[t]:B(o,t,r),o})))}check(...t){return $s(zu(this.node,[new Nm(t)]))}refine(t,r){return $s(zu(this.node,[new Nm([nS(t,r)])]))}tag(t){let r=re(new le({expected:`${JSON.stringify(t)} tag`}));return $s(zu(this.node,Yl("Prism",n=>n._tag===t?X(n):r,F)))}at(t,...r){let n=re(new At([t],new Yt(void 0)));return $s(zu(this.node,Yl("Optional",o=>Object.hasOwn(o,t)?X(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let i=CS(s);return B(i,t,o),X(i)}else return n})))}pick(t){return this.compose(yB(hC(t),(r,n)=>({...xC(n,t),...r})))}omit(t){return this.compose(yB(xC(t),(r,n)=>({...hC(n,t),...r})))}notUndefined(){return this.refine(ei,{expected:"a value other than `undefined`"})}forEach(t){let r=t(AS());return nY(n=>Vr(this.getResult(n),o=>{let s=[];for(let i=0;i<o.length;i++){let a=r.getResult(o[i]);tt(a)&&s.push(a.success)}return s}),(n,o)=>hr(this.getResult(o),s=>{let i=[];for(let c=0;c<s.length;c++)tt(r.getResult(s[c]))&&i.push(c);if(n.length!==i.length)return re(new le({message:`each: replacement length mismatch: ${n.length} !== ${i.length}`}));let a=s.slice();for(let c=0;c<i.length;c++){let u=i[c],f=r.replaceResult(n[c],s[u]);if(be(f))return re(new At([u],f.failure));a[u]=f.success}return this.replaceResult(a,o)}))}modifyAll(t){return r=>ap(hr(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},bC=class extends Xl{get;set;constructor(t,r,n){super(t,o=>X(r(o)),o=>X(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},EC=class extends Xl{get;constructor(t,r,n){super(t,o=>X(r(o)),(o,s)=>X(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},IC=class extends Xl{set;constructor(t,r,n){super(t,r,(o,s)=>X(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>ap(Vr(this.getResult(r),n=>this.set(t(n))),()=>r)}};function $s(e){let t=e[0]??rY;if(e.length>1){let r=e.reduce((n,o)=>iY(n,o.kind),"Iso");t={kind:r,get:oY(e,r),set:sY(e,r)}}switch(t.kind){case"Iso":return new bC(e,t.get,t.set);case"Lens":return new EC(e,t.get,t.set);case"Prism":return new IC(e,t.get,t.set);case"Optional":return new Xl(e,t.get,t.set)}}function CS(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function oY(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(TC(o.kind)){if(be(s))return s;r=s.success}else r=s}return TC(t)?X(r):r}}function sY(e,t){return SB(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){s[i]=n;let a=e[i];if(TC(a.kind)){let c=a.get(n);if(be(c))return c;n=c.success}else n=a.get(n)}for(let i=o-1;i>=0;i--){let a=e[i];if(SB(a.kind))r=a.set(r);else if(a.kind==="Lens")r=a.set(r,s[i]);else{let c=a.set(r,s[i]);if(be(c))return c;r=c.success}}return t==="Optional"?X(r):r}}function TC(e){return e==="Prism"||e==="Optional"}function SB(e){return e==="Iso"||e==="Prism"}function iY(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var aY=$s([]);function AS(){return aY}function IB(e){let t=SS(e);return bB(hS(t),mS(t))}function TB(e){return AS()}function wB(e){return AS()}var ed="~effect/Schema/SchemaError";function vB(e){return O(e,ed)&&e[ed]===ed}var Mo="~effect/net/NetAddress";var js=e=>e.value,Hs=e=>e,xa=e=>e.bytes,es=class extends sr("NetAddressError"){},td=e=>O(e,Mo),Br=e=>td(e)&&e._tag==="Ipv4Address",ts=e=>td(e)&&e._tag==="Ipv6Address",wC=e=>Br(e)||ts(e),rd=e=>Br(e)?32:128;var nd=e=>td(e)&&e._tag==="MacAddress",Dm=e=>td(e)&&e._tag==="InetAddressV4",Lm=e=>td(e)&&e._tag==="InetAddressV6",vC=e=>Dm(e)||Lm(e),kS=e=>td(e)&&e._tag==="UnixPathAddress",CB=e=>vC(e)||kS(e),uY={...Ot,_tag:"Ipv4Address",[Mo]:Mo,[ae](e){return Br(e)&&js(this)===js(e)},[ie](){return _r(he(pY,js(this)|0))},toString(){return $r(this)},toJSON(){return this.toString()}},fY={...Ot,_tag:"Ipv6Address",[Mo]:Mo,[ae](e){if(!ts(e))return!1;let t=Hs(this),r=Hs(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ie](){let e=Hs(this),t=he(mY,e.w0|0);return t=he(t,e.w1|0),t=he(t,e.w2|0),_r(he(t,e.w3|0))},toString(){return $r(this)},toJSON(){return this.toString()}},lY={...Ot,_tag:"MacAddress",[Mo]:Mo,[ae](e){return nd(e)&&dY(xa(this),xa(e))},[ie](){return he(hY,ri(xa(this)))},toString(){return kC(this)},toJSON(){return this.toString()}},dY=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},pY=Be("Ipv4Address"),mY=Be("Ipv6Address"),hY=Be("MacAddress"),xY=e=>{let t=Object.create(uY);return t.value=e>>>0,Object.freeze(t)},gY=(e,t,r,n)=>{let o=Object.create(fY);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},yY=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var Um=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],SY=e=>{let t=Object.assign(Object.create(lY),{bytes:new Uint8Array(e)});return Object.freeze(t)};var Ut=(e,t)=>re(new es({input:e,message:t})),AB=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(!Number.isInteger(n)||n<0||n>t)return!1}return!0},bY=e=>AB(e,255)?X(xY(yY(e[0],e[1],e[2],e[3]))):Ut(e,"octets must be integers from 0 through 255"),EY=e=>AB(e,65535)?X(gY(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):Ut(e,"segments must be integers from 0 through 65535");var kB=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?X(SY(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):Ut(e,"expected six two-digit hexadecimal octets separated by colons");var Wu=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return Ut(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return Ut(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?Ut(e,"octets must be at most 255"):bY([r[0],r[1],r[2],r[3]])},IY=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return Ut(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return Ut(e,"only one compression marker is allowed");let r=t[0]===""?[]:t[0].split(":"),n=t.length===2&&t[1]!==""?t[1].split(":"):[];if(r.some(f=>f==="")||n.some(f=>f===""))return Ut(e,"empty segments are only valid in the compression marker");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:"",s;if(o.includes(".")){if(t.length===2&&n.length===0)return Ut(e,"embedded IPv4 syntax must be trailing");let f=Vr(Wu(o),p=>{let m=js(p);return[m>>>16,m&65535]});if(be(f))return f;s=f.success,n.length>0?n.pop():r.pop()}let i=r.length+n.length+(s?2:0);if(t.length===1?i!==8:i>=8)return Ut(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let a=f=>/^[0-9a-fA-F]{1,4}$/.test(f)?Number.parseInt(f,16):void 0,c=r.map(a),u=n.map(a);return c.some(f=>f===void 0)||u.some(f=>f===void 0)?Ut(e,"segments must contain one through four hexadecimal digits"):X([...c,...Array(8-i).fill(0),...u,...s??[]])},Ku=e=>hr(IY(e),t=>EY(t)),pc=e=>e.includes(":")?Ku(e):Wu(e);var CC=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=Bm(e);return tt(t)&&t.success===e},Bm=e=>{let t=e.indexOf("%");if(t===-1)return Ut(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return Ut(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return Ut(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return Vr(Ku(e.slice(0,t)),n=>`${$r(n)}%${r}`)};var RS=e=>Um(js(e)),TY=e=>{let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},AC=e=>{let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return[...Um(t),...Um(r),...Um(n),...Um(o)]};var kC=e=>Array.from(xa(e),t=>t.toString(16).padStart(2,"0")).join(":"),OS=e=>xa(e).every(t=>t===255),wY=e=>(xa(e)[0]&1)!==0,_S=e=>(xa(e)[0]&1)===0,RC=e=>(xa(e)[0]&2)!==0,OC=e=>(xa(e)[0]&2)===0;var $r=e=>{if(Br(e))return RS(e).join(".");let t=TY(e);if(vY(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let a=0;a<=8;a++)a<8&&t[a]===0?o===-1&&(o=a):o!==-1&&(a-o>n&&(r=o,n=a-o),o=-1);if(n<2)return t.map(a=>a.toString(16)).join(":");let s=t.slice(0,r).map(a=>a.toString(16)).join(":"),i=t.slice(r+n).map(a=>a.toString(16)).join(":");return`${s}::${i}`},PS=e=>{if(Br(e))return js(e)===0;let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return t===0&&r===0&&n===0&&o===0},_C=e=>{if(Br(e))return js(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=Hs(e);return t===0&&r===0&&n===0&&o===1},od=e=>nd(e)?wY(e):Br(e)?js(e)>>>28===14:Hs(e).w0>>>24===255,MS=e=>nd(e)?OS(e):js(e)===4294967295,PC=e=>nd(e)?_S(e):!od(e)&&!PS(e)&&(!Br(e)||!MS(e)),MC=e=>Br(e)?js(e)>>>16===43518:(Hs(e).w0>>>16&65472)===65152,FC=e=>{let t=js(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},NC=e=>(Hs(e).w0>>>24&254)===252,vY=e=>{let{w0:t,w1:r,w2:n}=Hs(e);return t===0&&r===0&&n===65535};var CY={...Ot,_tag:"InetAddressV4",[Mo]:Mo,[ae](e){return Dm(e)&&this.port===e.port&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.port))},toString(){return FS(this)},toJSON(){return this.toString()}},AY={...Ot,_tag:"InetAddressV6",[Mo]:Mo,[ae](e){return Lm(e)&&this.port===e.port&&this.scopeId===e.scopeId&&Z(this.address,e.address)},[ie](){return he(he(G(this.address),zt(this.port)),zt(this.scopeId))},toString(){return FS(this)},toJSON(){return this.toString()}},RB=e=>Number.isInteger(e)&&e>=0&&e<=65535,kY=(e,t)=>{if(!RB(t))return Ut(e,"port must be an integer from 0 through 65535");let r=Object.create(CY);return r.address=e,r.port=t,X(Object.freeze(r))},RY=(e,t,r)=>{if(!RB(t))return Ut(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return Ut(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(AY);return o.address=e,o.port=t,o.scopeId=n,X(Object.freeze(o))};var UC=e=>{let t,r,n=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return Ut(e,"expected [IPv6]:port");t=e.slice(1,s),r=e.slice(s+2);let i=t.indexOf("%");if(i!==-1){let a=t.slice(i+1);if(t.indexOf("%",i+1)!==-1||!/^\d+$/.test(a))return Ut(e,"scope identifier must be decimal");if(n=Number(a),!Number.isInteger(n)||n>4294967295)return Ut(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,i)}}else{let s=e.lastIndexOf(":");if(s<0)return Ut(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return Ut(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?hr(pc(t),s=>o!==ts(s)?Ut(e,"only IPv6 addresses use brackets"):ts(s)?RY(s,Number(r),{scopeId:n}):kY(s,Number(r))):Ut(e,"port must be an unpadded decimal integer")};var OY=e=>$r(e.address)+(Lm(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var FS=e=>{let t=OY(e);return Dm(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var _Y={...Ot,_tag:"UnixPathAddress",[Mo]:Mo,[ae](e){return kS(e)&&this.path===e.path},[ie](){return he(Be("UnixPathAddress"),Be(this.path))},toString(){return this.path},toJSON(){return this.toString()}},OB=e=>{let t=Object.create(_Y);return t.path=e,Object.freeze(t)};var DC="~effect/net/Host",mc=(e,t)=>re(new es({input:e,message:t})),PY=/^[a-z0-9_.-]$/i,MY=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,FY=/^(?:\d+|0x[0-9a-f]*)$/,_B=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let r=t.split(".");for(let n of r){if(n.length===0)return"domain name labels must not be empty";if(n.length>63)return"domain name labels must be at most 63 characters";if(!MY.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(FY.test(r[r.length-1]))return"the last domain name label must not be numeric"},NY=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!PY.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},ga=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&_B(e)===void 0;var BC=e=>O(e,DC),NS=e=>{let t=NY(e);if(t===void 0)return mc(e,"invalid domain name");let r=_B(t);return r===void 0?X(t):mc(e,r)};var UY=e=>{if(e.includes("%"))return Bm(e);if(e.includes(":"))return pc(e);if(/^[\d.]+$/.test(e)){let t=pc(e);if(tt(t))return t}return NS(e)};var DY=e=>typeof e=="string"?e:$r(e);var LY={...Ot,_tag:"HostPort",[DC]:DC,[ae](e){return BC(e)&&this.port===e.port&&Z(this.host,e.host)},[ie](){return he(G(this.host),zt(this.port))},toString(){return $C(this)},toJSON(){return this.toString()}},BY=e=>Number.isInteger(e)&&e>=0&&e<=65535,$Y=(e,t)=>{let r=Object.create(LY);return r.host=e,r.port=t,Object.freeze(r)};var PB=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return mc(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return mc(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return mc(e,"expected host:port");if(e.indexOf(":")!==o)return mc(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return mc(e,"port must be an unpadded decimal integer");let n=Number(r);return BY(n)?Vr(UY(t),o=>$Y(o,n)):mc(e,"port must be an integer from 0 through 65535")};var $C=e=>{let t=DY(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var HC="~effect/net/Dns/DnsRecord",jC=e=>Number.isInteger(e)&&e>=0&&e<=255,sd=e=>Number.isInteger(e)&&e>=0&&e<=65535,NB=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,hc=e=>typeof e=="string",US=e=>Qi(e)&&Wn(e)&&NB(ui(e)),UB={A:{address:Br},AAAA:{address:ts},CAA:{critical:e=>typeof e=="boolean",tag:e=>hc(e)&&/^[a-z0-9]+$/i.test(e),value:hc},CNAME:{target:ga},MX:{exchange:ga,priority:sd},NAPTR:{order:sd,preference:sd,flags:hc,service:hc,regexp:hc,replacement:ga},NS:{host:ga},PTR:{host:e=>hc(e)&&e.length>0},SOA:{primary:ga,admin:e=>hc(e)&&e.length>0,serial:NB,refresh:US,retry:US,expire:US,minimum:US},SRV:{target:ga,port:sd,priority:sd,weight:sd},TLSA:{certUsage:jC,selector:jC,matchingType:jC,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(hc)}},qC=Object.keys(UB),jY=e=>qC.includes(e),zC=e=>O(e,HC),HY={...Ot,[HC]:HC,[ae](e){return zC(e)&&e._tag===this._tag&&Object.keys(this).every(t=>Z(this[t],e[t]))},[ie](){return Hd(this,Object.keys(this))},toString(){return zY(this)},toJSON(){return{...this}}},DB=(e,t)=>{if(!jY(e))return re(new es({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(HY);n._tag=e;for(let[o,s]of Object.entries(UB[e])){let i=r[o];if(!s(i))return re(new es({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(i)?Object.freeze([...i]):i instanceof Uint8Array?new Uint8Array(i):i}return X(Object.freeze(n))};var LB=new TextEncoder,BB=e=>`\\${e.toString().padStart(3,"0")}`,jm=e=>{let t='"';for(let r of LB.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?BB(r):String.fromCharCode(r);return t+'"'},qY=[34,36,40,41,59,64],FB=e=>{let t=LB.encode(e),r="";for(let n=0;n<t.length;n++){let o=t[n];if(o===92){let s=t[n+1];s===46||s===92?(r+=`\\${String.fromCharCode(s)}`,n++):r+="\\\\"}else o<=32||o>126?r+=BB(o):r+=qY.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},zY=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${$r(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${jm(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${jm(e.flags)} ${jm(e.service)} ${jm(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${FB(e.host)}`;case"SOA":return`SOA ${e.primary} ${FB(e.admin)} ${e.serial} ${ui(e.refresh)} ${ui(e.retry)} ${ui(e.expire)} ${ui(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Gx(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(jm).join(" ")}`}};var WC="~effect/net/IpInterface",$B=e=>Hm(e)&&Br(e.address),jB=e=>Hm(e)&&ts(e.address),Hm=e=>O(e,WC),GY={...Ot,_tag:"IpInterface",[WC]:WC,[ae](e){return Hm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.prefixLength))},toString(){return zm(this)},toJSON(){return this.toString()}},KC=(e,t)=>re(new es({input:e,message:t})),qm=(e,t)=>{let r=rd(e);if(!Number.isInteger(t)||t<0||t>r)return KC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(GY),{address:e,prefixLength:t});return X(Object.freeze(n))},VC=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return X({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return KC(e,"expected an address and prefix length separated by one slash");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?X({address:e.slice(0,r),prefixLength:Number(n)}):KC(e,"prefix length must be an unpadded ASCII decimal integer")},DS=(e,t)=>hr(VC(e,t),r=>hr(Wu(r.address),n=>qm(n,r.prefixLength??rd(n)))),LS=(e,t)=>hr(VC(e,t),r=>hr(Ku(r.address),n=>qm(n,r.prefixLength??rd(n)))),BS=(e,t)=>hr(VC(e,t),r=>hr(pc(r.address),n=>qm(n,r.prefixLength??rd(n))));var zm=e=>`${$r(e.address)}/${e.prefixLength}`;var GC="~effect/net/IpNetwork",qB=e=>Wm(e)&&Br(e.address),zB=e=>Wm(e)&&ts(e.address),Wm=e=>O(e,GC),JY={...Ot,_tag:"IpNetwork",[GC]:GC,[ae](e){return Wm(e)&&this.prefixLength===e.prefixLength&&Z(this.address,e.address)},[ie](){return he(G(this.address),zt(this.prefixLength))},toString(){return Km(this)},toJSON(){return this.toString()}},ZY=e=>{let t=Object.assign(Object.create(JY),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},QY=e=>Br(e)?RS(e):AC(e);var YY=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},JC=(e,t)=>hr(qm(e,t),r=>{let n=QY(e),o=YY(n,t);return n.some((s,i)=>s!==o[i])?re(new es({input:e,message:"address has non-zero host bits"})):X(ZY(r))});var WB=e=>hr(DS(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength)),KB=e=>hr(LS(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength)),VB=e=>hr(BS(e,{prefix:"required"}),t=>JC(t.address,t.prefixLength));var Km=e=>`${$r(e.address)}/${e.prefixLength}`;var Vm=gS;function Cr(){return(e,t,r)=>J(new uc(e.map(wm),n=>t(n.map(o=>J(o))),r))}function Ge(e,t){return Cr()([],()=>(r,n,o)=>e(r)?I(r):D(new at(n,r,o)),t)}function e7(e){return e}function t7(e){return t=>t.annotate(e)}function r7(e){return t=>QC(QC(t).annotate(e))}function n7(e){return t=>t.rebuild(Wl(t.ast,e))}function o7(e){return e}var $n=class extends sr("SchemaError"){[ed]=ed;constructor(t){let r=Ir();yt(0);try{super({issue:t})}finally{yt(r)}}get message(){return b1(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[Qe](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function fd(e){return vB(e)}function a$(e){return Xe(e)?tA(e):rt(e,t=>aa(()=>Ka(t,r=>new $n(r))))}function tA(e){return ft(e)?e:ir(Ka(e.cause,t=>new $n(t)))}function c$(e,t){let r;for(let n of e.reasons){if(!Ng(n)||!fd(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function u$(e){return dy(e).then(t=>{if(ft(t))return t.value;throw c$(t.cause,"Promise adapter can only reject schema errors")})}function f$(e){let t=ki(e);if(ft(t))return t.value;throw c$(t.cause,"Sync adapter can only throw schema errors")}function s7(e,t){return rB(e,t)}function i7(e){return nB(e)}var a7=Zv,c7=hL;function xc(e,t){let r=ot(e,t);return(n,o)=>a$(r(n,o))}var u7=xc;function l$(e,t){let r=xL(e,t);return(n,o)=>tA(r(n,o))}var d$=l$,f7=Yv,l7=gL;function p$(e,t){let r=yL(e,t);return(n,o)=>UI(r(n,o),s=>new $n(s))}var d7=p$;function m$(e,t){let r=xc(e,t);return(n,o)=>u$(r(n,o))}var p7=m$;function jS(e,t){let r=xc(e,t);return(n,o)=>f$(r(n,o))}var Zm=jS;function Qm(e,t){let r=ju(e,t);return(n,o)=>a$(r(n,o))}var rA=Qm;function h$(e,t){let r=bL(e,t);return(n,o)=>tA(r(n,o))}var x$=h$,m7=Xv,h7=EL;function g$(e,t){let r=IL(e,t);return(n,o)=>UI(r(n,o),s=>new $n(s))}var x7=g$;function y$(e,t){let r=Qm(e,t);return(n,o)=>u$(r(n,o))}var g7=y$;function Ym(e,t){let r=Qm(e,t);return(n,o)=>f$(r(n,o))}var nA=Ym,J=Ls;function Ju(e){return O(e,Vm)&&e[Vm]===Vm}var Gu=bn(e=>J($u(e.ast),{schema:e})),y7=bn(e=>e.schema),lr=bn(e=>{let t=zS(e);return J(V2(e.ast),{schema:t})}),S7=bn(e=>e.schema.members[0]),b7=bn(e=>J(Dv(e.ast),{schema:e})),E7=bn(e=>e.schema),oo=bn(e=>J(Nt(e.ast),{schema:e})),ld=bn(e=>J(Bn(e.ast),{schema:e})),Gm="~effect/Schema/flip";function I7(e){return O(e,Gm)&&e[Gm]===Gm}function QC(e){return I7(e)?e.schema.rebuild(Oo(e.ast)):J(Oo(e.ast),{[Gm]:Gm,schema:e})}function fr(e){let t=J(new Ln(e),{literal:e,transform(r){return t.pipe(ee(fr(r),{decode:Ie(()=>r),encode:Ie(()=>e)}))}});return t}function S$(e){return e.map(t=>Ju(t)?t.ast:new Ln(t))}function T7(e){return J(new Cv(S$(e)),{parts:e})}function w7(e){return J(C2(S$(e)),{parts:e})}function v7(e){return J(new v2(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var Mi=J(vv),C7=J(T2),Xm=J(pa),HS=J(Tv),oA=J(wv),z=J(Ro),A7=z,Zu=J(Av),Fi=J(R2),b$=J(O2),dd=J(_2),pd=J(I2),k7=J(w2);function R7(e){return J(new k2(e))}function sA(e,t){return J(e,{fields:t,mapFields(r,n){let o=r(this.fields);return sA(eS(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Te(e){return sA(eS(e,void 0),e)}function O7(e){return bn(t=>t.mapFields(xB(e)))}var _7=e=>typeof e=="symbol"?e:globalThis.String(e);function P7(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=ld(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,f=_7(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${ni(u)}`);s.add(f),B(r,u,a),c&&(n[i]=u,o[u]=i)}return Te(r).pipe(ee(t,Fe({decode:gC(o),encode:gC(n)})))}}function M7(e,t){return r=>{let n=Dx(r.fields,oo),o=Te({...n,...e});return r.pipe(ee(o,Fe({decode:s=>{let i={...s};for(let a in e){let c=t[a],u=c(s);de(u)&&B(i,a,u.value)}return i},encode:s=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function Qu(e,t){return J(J2(e.ast,t.ast),{key:e,value:t})}function F7(e,t){return J(U2(e.ast,t.map(wm)),{schema:e,records:t})}function E$(e,t){return J(e,{elements:t,mapElements(r,n){let o=r(this.elements);return E$(_v(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function rs(e){return E$(_v(e),e)}function N7(e,t){return J(D2(e.ast,t.map(wm)),{schema:e,rest:t})}var ct=bn(e=>J(new Xo(!1,[],[e.ast]),{value:e}));function qS(e,t,r){return t!==void 0&&r!==void 0?e.check(fA(t,r)):t!==void 0?e.check($$(t)):r!==void 0?e.check(q$(r)):e}var Yu=bn(e=>J(new Xo(!1,[e.ast],[e.ast]),{value:e}));function U7(e){let t=ct(e),r=ct(oo(e)),n=ee(rs([Xm]),Fe({decode:o=>[o],encode:([o])=>o}))(e);return J(Pe([n,t]).pipe(ee(r)).ast,{from:Pe([e,t]),to:r})}function D7(e){return ct(e).check(dA())}var L7=bn(e=>J(L2(e.ast),{schema:e}));function I$(e,t){return J(e,{members:t,mapMembers(r,n){let o=r(this.members);return I$(tS(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Pe(e,t){return I$(tS(e,t,void 0),e)}function Fo(e){let t=e.map(fr);return J(tS(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return Pe(r(this.members))},pick(r){return Fo(r)},transform(r){return Pe(t.map((n,o)=>n.transform(r[o])))}})}var iA=bn(e=>Pe([e,HS])),zS=bn(e=>Pe([e,oA])),T$=bn(e=>Pe([e,HS,oA]));function w$(e){return J(new Mv(()=>e().ast))}function B7(...e){return t=>t.check(...e)}function v$(e,t){return r=>J(Pi(r.ast,[nS(e,t)]),{schema:r})}function WS(e){return t=>J(t.ast,{schema:t,identifier:e})}function $7(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(WS(e))}function C$(e){return t=>J(W2(t.ast,new Ky(e,F)),{schema:t})}function A$(e){return t=>J(K2(t.ast,new Ky(F,e)),{schema:t})}function j7(e){return k$(e)}function k$(e){return t=>C$(my(e))(t)}function H7(e){return R$(e)}function R$(e){return t=>A$(my(e))(t)}function ee(e,t){return r=>J(Kl(r.ast,e.ast,t?Vy(t):Nl()),{from:r,to:e})}function md(){return(e,t)=>Ne()(e,{decode:t,encode:w1})}var O$=Fo(["true","yes","on","1","y"]),_$=Fo(["false","no","off","0","n"]),q7=Fo([...O$.literals,..._$.literals]).pipe(ee(Fi,Fe({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function z7(e){return t=>ee(oo(t),e)(t)}function aA(e,t){return r=>t?ee(r,t)(e):ee(r)(e)}function W7(e){return t=>ee(t,e)(ld(t))}function P$(e){return t=>J(G2(t.ast,e),{schema:t})}function M$(e){return rt(e,t=>aa(()=>Ka(t,r=>r.issue)))}function cA(e,t){let r=t?.encodingStrategy==="omit"?sv():Oi();return n=>Gu(ld(n)).pipe(ee(n,{decode:iv(M$(e)),encode:r}))}function K7(e,t){return r=>oo(r).pipe(cA(e,t),aA(Gu(r)))}function F$(e,t){let r=t?.encodingStrategy==="omit"?sv():Oi();return n=>lr(ld(n)).pipe(ee(n,{decode:iv(M$(e)),encode:r}))}function V7(e,t){return r=>oo(r).pipe(F$(e,t),aA(lr(r)))}function He(e){return fr(e).pipe(P$(I(e)))}function G7(e){return He(e).pipe(cA(I(e),{encodingStrategy:"omit"}))}function ya(e,t){return Te({_tag:He(e),...t})}function N$(e){return t=>{let r={},n=[],o=new Set,s={},i=f=>p=>f.includes(p[e]);return a(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(f){let p=f.ast;if(S2(p)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(Ju))return f.members.forEach(a);let m=ac(p);if(m.length>0){let h=m.find(x=>x.key===e)?.literal;if(mx(h)){let x=typeof h=="number"?globalThis.String(h):h;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(x),n.push(h),B(r,h,f),B(s,h,Zv(oo(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let x=arguments[0];return function(g){let y=g[e];return(Object.hasOwn(x,y)?x[y]:void 0)(g)}}let f=arguments[0],p=arguments[1],m=f[e];return(Object.hasOwn(p,m)?p[m]:void 0)(f)}function u(){if(arguments.length===2){let g=arguments[0],y=arguments[1];return function(E){let b=E[e];return(Object.hasOwn(g,b)?g[b]??y:y)(E)}}let f=arguments[0],p=arguments[1],m=arguments[2],h=f[e];return(Object.hasOwn(p,h)?p[h]??m:m)(f)}}}function J7(e){let t={},r=[];for(let u of Object.keys(e)){let f=ya(u,e[u]);B(t,u,f),r.push(f)}let n=Pe(r),{tag:o,guards:s,isAnyOf:i,match:a,matchOrElse:c}=N$("_tag")(n);return J(n.ast,{tag:o,cases:t,isAnyOf:i,guards:s,match:a,matchOrElse:c})}function Z7(){return e=>e}function gc(e,t){return Ge(r=>r instanceof e,t)}function Ne(){return(e,t)=>new jt(e.ast,Vy(t))}var Je=rS;function Q7(e,t=void 0){return new Du(e,t)}var GB="^\\S[\\s\\S]*\\S$|^\\S$|^$";function U$(e){let t=new globalThis.RegExp(GB);return Je(r=>r.trim()===r,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitraryConstraint:{patterns:[{source:GB,flags:""}]},...e})}function Xu(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${H(r)})`:`new RegExp(${H(r)}, ${H(n)})`;return Cm(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function Y7(e){return $v({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function X7(e){return jv({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function eX(e){return qv({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var tX=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function rX(e,t){let r=tX(e);return Xu(r,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var JB=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;function nX(e){return Xu(JB,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:JB.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function oX(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Xu(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function D$(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Xu(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function sX(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Xu(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function uA(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function iX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${ha(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return Je(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>uA(o,e,`^${ha(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function aX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${ha(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return Je(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>uA(o,e,`${ha(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function cX(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(ha(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return Je(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>uA(o,e,ha(o)),toCode:()=>({runtime:`Schema.isIncluding(${H(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var ZB="^[^a-z]*$";function uX(e){let t=new globalThis.RegExp(ZB);return Je(r=>r.toUpperCase()===r,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:ZB,flags:""}]},...e})}var QB="^[^A-Z]*$";function fX(e){let t=new globalThis.RegExp(QB);return Je(r=>r.toLowerCase()===r,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:QB,flags:""}]},...e})}var YB="^(?:[^a-z][\\s\\S]*)?$";function lX(e){let t=new globalThis.RegExp(YB);return Je(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:YB,flags:""}]},...e})}var XB="^(?:[^A-Z][\\s\\S]*)?$";function dX(e){let t=new globalThis.RegExp(XB);return Je(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:XB,flags:""}]},...e})}var KS=J(Nv),pX=Fv;function eh(e){let t=Yc(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function th(e){let t=op(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function rh(e){let t=rp(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function nh(e){let t=np(e.order),r=e.formatter??H;return(n,o)=>Je(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function oh(e){let t=op(e.order),r=Yc(e.order),n=np(e.order),o=rp(e.order),s=e.formatter??H;return(i,a)=>{let c=i.exclusiveMinimum?r:t,u=i.exclusiveMaximum?o:n;return Je(f=>c(f,i.minimum)&&u(f,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(i),...a})}}function mX(e){return(t,r)=>{let n=e.formatter??H;return Je(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function ad(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${H(e)}`);return e}var hX=eh({order:Ki,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:ad(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${H(e)})`})})}),L$=th({order:Ki,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:ad(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${H(e)})`})})}),xX=rh({order:Ki,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:ad(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${H(e)})`})})}),gX=nh({order:Ki,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:ad(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${H(e)})`})})}),yc=oh({order:Ki,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:ad(e.minimum),maximum:ad(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${H(e.minimum)}, maximum: ${H(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}});function yX(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Je(r=>iU(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${H(e)})`}),...t})}function VS(e){return Je(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var In=Zu.check(VS()),Vu=In.check(L$(0));function SX(e){return new Du([VS(),yc({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function bX(e){return new Du([VS(),yc({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function cd(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${H(e)}`);return e.toISOString()}function ud(e){return`new Date(${H(e.getTime())})`}var EX=eh({order:Df,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:cd(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${ud(e)})`})})}),IX=th({order:Df,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:cd(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${ud(e)})`})})}),TX=rh({order:Df,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:cd(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${ud(e)})`})})}),wX=nh({order:Df,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:cd(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${ud(e)})`})})}),vX=oh({order:Df,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:cd(e.minimum),maximum:cd(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${ud(e.minimum)}, maximum: ${ud(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}}),CX=eh({order:Uf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${H(e)})`})})}),B$=th({order:Uf,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${H(e)})`})})}),AX=rh({order:Uf,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${H(e)})`})})}),kX=nh({order:Uf,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${H(e)})`})})}),RX=oh({order:Uf,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${H(e.minimum)}, maximum: ${H(e.maximum)}, exclusiveMinimum: ${H(t)}, exclusiveMaximum: ${H(r)} })`})}}});function $$(e,t){return e=En(e),j$(e,Math.ceil(e/2),t)}function j$(e,t,r){return Je(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:n==="array"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[ro]:!0,arbitraryConstraint:{minLength:e},...r})}function H$(e){return j$(1,1,e)}function q$(e,t){return e=En(e),Je(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:r==="array"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[ro]:!0,arbitraryConstraint:{maxLength:e},...t})}function fA(e,t,r){return e=En(e),t=En(t),Je(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n==="array"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function OX(e,t){return e=En(e),Je(r=>lA(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function _X(e,t){return e=En(e),Je(r=>lA(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function PX(e,t,r){return e=En(e),t=En(t),Je(n=>{let o=lA(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function lA(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function En(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function MX(e,t){return e=En(e),Je(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[ro]:!0,arbitraryConstraint:{minSize:e},...t})}function FX(e,t){return e=En(e),Je(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[ro]:!0,arbitraryConstraint:{maxSize:e},...t})}function NX(e,t,r){return e=En(e),t=En(t),Je(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function UX(e,t){return e=En(e),Je(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[ro]:!0,arbitraryConstraint:{minProperties:e},...t})}function DX(e,t){return e=En(e),Je(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[ro]:!0,arbitraryConstraint:{maxProperties:e},...t})}function LX(e,t,r){return e=En(e),t=En(t),Je(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[ro]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function BX(e,t){let r=ld(e),n=mL(r.ast);return Je((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let f=n(u,i);if(f!==void 0&&(c.push(new At([u],f)),i.errors==="first"))break}return Gr(c)?new Ft(s,c,o,i):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[ro]:!0,...t})}function dA(e){return Je(t=>qx(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:F},...e})}function z$(e){return Je(t=>qx(t.map(([r])=>r)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var pA=z.check(H$()),$X=z.check(fA(1,1)),W$=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),K$=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},e$=[];function jX(e){let t=W$(e),r=e$[t];if(r!==void 0)return r;let n=K$(t),o=gc(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${H(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Ne()(pre,Q1(n))});return e$[t]=o,o}var t$=[];function er(e){let t=W$(e),r=t$[t];if(r!==void 0)return r;let n=XS.pipe(ee(Xm,Y1(K$(t))));return t$[t]=n,n}function HX(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(rs([n,o]));return(i,a,c)=>i instanceof globalThis.Map?cr(ot(s)([...i],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>tn(a,"entries",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:"ReadonlyMap",toCodec:([n,o])=>Ne()(ct(rs([n,o])),Fe({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return J(r.ast,{key:e,value:t})}function qX(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>o instanceof globalThis.Set?cr(ot(n)([...o],i),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:"ReadonlySet",toCodec:([r])=>Ne()(ct(r),Fe({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return J(t.ast,{value:e})}var zX=gc(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Ne()(Te({source:z,flags:z}),Xt({decode:(e,t)=>Go({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new le({expected:"valid RegExp source and flags"},e,t)}),encode:e=>I({source:e.source,flags:e.flags})}))}),V$=z.annotate({expected:"a string that will be decoded as a URL"}),G$=gc(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Ne()(V$,lv)}),WX=V$.pipe(ee(G$,lv)),J$=z.annotate({expected:"a string that will be decoded as a Date"}),GS=Ge(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:()=>Ne()(J$,uv)}),KX=J$.pipe(ee(GS,uv)),VX=In.pipe(ee(GS,W1)),GX=z.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function mA(e,t){return GX.pipe(ee(e,c2(t)))}var JX=mA(Xm),Z$=gc(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Ne()(Te({data:z.check(D$()),type:z,name:z,lastModified:In}),Xt({decode:(e,t)=>zn(Cu(e.data),{onFailure:()=>D(new le({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return I(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Vo({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Al(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new le({expected:"a readable File"},e,t)})}))}),Q$=gc(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Ne()(ct(rs([z,Pe([Te({_tag:He("String"),value:z}),Te({_tag:He("File"),value:Z$})])])),Xt({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return I(t)},encode:e=>I(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function ZX(e){return Q$.pipe(ee(e,u2))}var Y$=gc(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Ne()(z.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Fe({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function QX(e){return Y$.pipe(ee(e,f2))}var YX=z.annotate({expected:"a string that will be decoded as a number"}).pipe(ee(Zu,Ul)),XX=z.annotate({expected:"a string that will be decoded as a finite number"}).pipe(ee(KS,Ul)),eee=J(Hv).pipe(ee(dd,Jy)),X$=z.check(U$()),tee=z.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(ee(X$,z1())),ree=z.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,o2)),nee=z.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,s2)),oee=z.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,i2)),see=z.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(ee(z,a2)),YC=Pe([KS,b$,z]),iee=Te({issues:ct(Te({message:z,path:lr(ct(Pe([YC,Te({key:YC})])))}))}),aee=Fo([0,1]).pipe(ee(Fi,Fe({decode:e=>e===1,encode:e=>e?1:0}))),ej=z.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),qs=gc(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Ne()(ej,dv)}),cee=ej.pipe(ee(qs,dv)),uee=z.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(ee(qs,{decode:P1(),encode:zy()})),tj=z.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(ee(qs,{decode:F1(),encode:Wy()})),rj=Xt({decode:(e,t)=>{let r=tD(e);return fe(r)?D(new le({expected:"a valid BigDecimal string"},e,t)):I(r.value)},encode:e=>I(fa(e))}),fee=eh({order:wl,formatter:e=>fa(e)}),lee=th({order:wl,formatter:e=>fa(e)}),dee=rh({order:wl,formatter:e=>fa(e)}),pee=nh({order:wl,formatter:e=>fa(e)}),mee=oh({order:wl,formatter:e=>fa(e)}),nj=z.annotate({expected:"a string that will be decoded as a BigDecimal"}),oj=Ge(Tu,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Ne()(nj,rj),toFormatter:()=>e=>fa(e)}),hee=nj.pipe(ee(oj,rj)),JS=Ge(fD,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Ne()(dd.check(B$(globalThis.BigInt(0))),Fe({decode:uD,encode:gy})),toCodecStringTree:()=>Ne()(sj,fv)}),sj=z.annotate({expected:"a string that will be decoded as a ByteSize"}),xee=sj.pipe(ee(JS,fv)),gee=dd.pipe(ee(JS,K1)),yee=Zu.pipe(ee(JS,V1));function XC(e,t){let r=Cr()([e,t],([n,o])=>(s,i,a)=>{if(!al(s))return D(new at(i,s,a));switch(s._tag){case"Fail":return cr(ot(n)(s.error,a),{onSuccess:Cp,onFailure:c=>tn(i,"error",c,s,a)});case"Die":return cr(ot(o)(s.defect,a),{onSuccess:Ap,onFailure:c=>tn(i,"defect",c,s,a)});case"Interrupt":return I(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([n,o])=>Ne()(Pe([Te({_tag:fr("Fail"),error:n}),Te({_tag:fr("Die"),defect:o}),Te({_tag:fr("Interrupt"),fiberId:zS(KS)})]),Fe({decode:s=>{switch(s._tag){case"Fail":return Cp(s.error);case"Die":return Ap(s.defect);case"Interrupt":return kp(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return J(r.ast,{error:e,defect:t})}function Jm(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(XC(n,o));return(i,a,c)=>il(i)?cr(ot(s)(i.reasons,c),{onSuccess:uu,onFailure:u=>tn(a,"failures",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([n,o])=>Ne()(ct(XC(n,o)),Fe({decode:uu,encode:({reasons:s})=>s}))});return J(r.ast,{error:e,defect:t})}function r$(e){return Ne()(e,Fe({decode:gw,encode:Ct}))}function See(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>Cl(o)?cr(ot(n)(Ct(o),i),{onSuccess:gw,onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:"Chunk",toCodec:([r])=>r$(ct(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>r$(qS(ct(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>hw(r)});return J(t.ast,{value:e})}function ij(){return rn((e,t)=>Zt(yw(e),{onNone:()=>D(new le({message:"Invalid DateTime input"},e,t)),onSome:r=>I(Sw(r))}))}var bee=Fe({decode:e=>Ew(e),encode:e=>e.offset}),aj=Xt({decode:(e,t)=>Zt(TD(e),{onNone:()=>D(new le({expected:"a valid IANA time zone"},e,t)),onSome:I}),encode:e=>I(e.id)}),cj=Xt({decode:(e,t)=>Zt(wD(e),{onNone:()=>D(new le({expected:"a valid time zone"},e,t)),onSome:I}),encode:e=>I(tm(e))}),uj=Xt({decode:(e,t)=>Zt(yw(e),{onNone:()=>D(new le({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>I(Sw(r))}),encode:e=>I(AD(e))}),fj=Xt({decode:(e,t)=>Zt(ID(e),{onNone:()=>D(new le({expected:"a valid Zoned DateTime string"},e,t)),onSome:I}),encode:e=>I(Iw(e))}),lj=-864e13,dj=864e13,Eee=lj+840*60*1e3,Iee=dj-840*60*1e3,Tee=-720*60*1e3,wee=840*60*1e3,pj=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function mj(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function hA(e,t){return In.check(yc({minimum:e,maximum:t}))}function hj(){return Pe([hA(Tee,wee),Fo(pj)])}var ZS=Ge(e=>vu(e)&&SD(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{let[t,r]=mj(e,lj,dj);return md()(hA(t,r),Ie(by))},toCodecJson:()=>Ne()(z,uj),toFormatter:()=>e=>e.toString()}),vee=GS.pipe(ee(ZS,{decode:ij(),encode:Ie(vD)})),Cee=z.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(ee(ZS,uj)),Aee=In.pipe(ee(ZS,{decode:ij(),encode:Ie(CD)})),kee=Ge(gD,{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:()=>Ne()(In,bee),toFormatter:()=>e=>tm(e)}),xj=z.annotate({expected:"an IANA time zone identifier"}),gj=Ge(yD,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>md()(Fo(pj),Ie(bw)),toCodecJson:()=>Ne()(xj,aj),toFormatter:()=>e=>tm(e)}),Ree=xj.pipe(ee(gj,aj)),yj=z.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),Sj=Ge(xD,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>md()(hj(),Ie(e=>typeof e=="number"?Ew(e):bw(e))),toCodecJson:()=>Ne()(yj,cj),toFormatter:()=>e=>tm(e)}),Oee=yj.pipe(ee(Sj,cj)),bj=z.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),Ej=Ge(e=>vu(e)&&bD(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{let[t,r]=mj(e,Eee,Iee);return md()(Te({epochMilliseconds:hA(t,r),timeZone:hj()}),Ie(({epochMilliseconds:n,timeZone:o})=>Ey(n,{timeZone:o})))},toCodecJson:()=>Ne()(bj,fj),toFormatter:()=>e=>Iw(e),toEquivalence:()=>ED}),_ee=bj.pipe(ee(Ej,fj)),so=(e,t,r,n)=>z.pipe(ee(e,Xt({decode:(o,s)=>{let i=t(o);return tt(i)?I(i.success):D(new le({message:i.failure.message},o,s))},encode:o=>I(r(o))}))).annotate({identifier:n}),ef=Ge(nd,{identifier:"MacAddress"}),hd=so(ef,kB,kC,"MacAddressFromString"),sh=Ge(Br,{identifier:"Ipv4Address"}),xA=so(sh,Wu,$r,"Ipv4AddressFromString"),QS=Ge(ts,{identifier:"Ipv6Address"}),Ij=so(QS,Ku,$r,"Ipv6AddressFromString"),Sc=Ge(wC,{identifier:"IpAddress"}),tf=so(Sc,pc,$r,"IpAddressFromString"),kt=(e,t,r,n)=>v$(t,{expected:r})(e).annotate({identifier:n}),Pee=kt(Sc,od,"a multicast address","IpMulticastAddress"),Mee=kt(tf,od,"a multicast address","IpMulticastAddressFromString"),Fee=kt(ef,od,"a multicast address","MacMulticastAddress"),Nee=kt(hd,od,"a multicast address","MacMulticastAddressFromString"),Uee=kt(Sc,PC,"a unicast address","IpUnicastAddress"),Dee=kt(tf,PC,"a unicast address","IpUnicastAddressFromString"),Lee=kt(ef,_S,"a unicast address","MacUnicastAddress"),Bee=kt(hd,_S,"a unicast address","MacUnicastAddressFromString"),$ee=kt(sh,MS,"a broadcast address","Ipv4BroadcastAddress"),jee=kt(xA,MS,"a broadcast address","Ipv4BroadcastAddressFromString"),Hee=kt(ef,OS,"a broadcast address","MacBroadcastAddress"),qee=kt(hd,OS,"a broadcast address","MacBroadcastAddressFromString"),zee=kt(Sc,_C,"a loopback address","IpLoopbackAddress"),Wee=kt(tf,_C,"a loopback address","IpLoopbackAddressFromString"),Kee=kt(Sc,MC,"a link-local address","IpLinkLocalAddress"),Vee=kt(tf,MC,"a link-local address","IpLinkLocalAddressFromString"),Gee=kt(Sc,PS,"an unspecified address","IpUnspecifiedAddress"),Jee=kt(tf,PS,"an unspecified address","IpUnspecifiedAddressFromString"),Zee=kt(sh,FC,"a private address","Ipv4PrivateAddress"),Qee=kt(xA,FC,"a private address","Ipv4PrivateAddressFromString"),Yee=kt(QS,NC,"a unique-local address","Ipv6UniqueLocalAddress"),Xee=kt(Ij,NC,"a unique-local address","Ipv6UniqueLocalAddressFromString"),ete=kt(ef,RC,"a locally administered address","MacLocallyAdministeredAddress"),tte=kt(hd,RC,"a locally administered address","MacLocallyAdministeredAddressFromString"),rte=kt(ef,OC,"a universally administered address","MacUniversallyAdministeredAddress"),nte=kt(hd,OC,"a universally administered address","MacUniversallyAdministeredAddressFromString"),Tj=Ge($B,{identifier:"Ipv4Interface"}),ote=so(Tj,DS,zm,"Ipv4InterfaceFromString"),wj=Ge(jB,{identifier:"Ipv6Interface"}),ste=so(wj,LS,zm,"Ipv6InterfaceFromString"),vj=Ge(Hm,{identifier:"IpInterface"}),ite=so(vj,BS,zm,"IpInterfaceFromString"),Cj=Ge(qB,{identifier:"Ipv4Network"}),ate=so(Cj,WB,Km,"Ipv4NetworkFromString"),Aj=Ge(zB,{identifier:"Ipv6Network"}),cte=so(Aj,KB,Km,"Ipv6NetworkFromString"),kj=Ge(Wm,{identifier:"IpNetwork"}),ute=so(kj,VB,Km,"IpNetworkFromString"),fte=Ge(Dm,{identifier:"InetAddressV4"}),lte=Ge(Lm,{identifier:"InetAddressV6"}),Rj=Ge(vC,{identifier:"InetAddress"}),dte=so(Rj,UC,FS,"InetAddressFromString"),Oj=Ge(kS,{identifier:"UnixPathAddress"}),pte=z.pipe(ee(Oj,Fe({decode:OB,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),mte=Ge(CB,{identifier:"SocketAddress"}),Sa=z.check(Je(ga,{expected:"a normalized domain name"})).pipe(WS("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),_j=so(Sa,NS,e=>e,"DomainNameFromString"),gA=z.check(Je(CC,{expected:"a canonical scoped IPv6 literal"})).pipe(WS("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),Pj=so(gA,Bm,e=>e,"ScopedIpv6LiteralFromString"),hte=Pe([Sc,gA,Sa]).annotate({identifier:"Host"}),xte=Pe([tf,Pj,_j]).annotate({identifier:"HostFromString"}),Mj=Ge(BC,{identifier:"HostPort"}),gte=so(Mj,PB,$C,"HostPortFromString"),yte=In.check(yc({minimum:0,maximum:65535},{expected:"a port number"})),Ste=Xt({decode:(e,t)=>Zt(uP(e),{onNone:()=>D(new le({expected:"a valid Duration string"},e,t)),onSome:I}),encode:e=>I(globalThis.String(e))}),bte=Xt({decode:e=>I($o(e)),encode:(e,t)=>Zt(fP(e),{onNone:()=>D(new le({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>I(r)})}),Ete=Fe({decode:e=>Zi(e),encode:e=>Wt(e)}),ih=Ge(Qi,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Ne()(Pe([Te({_tag:fr("Infinity")}),Te({_tag:fr("NegativeInfinity")}),Te({_tag:fr("Nanos"),value:dd}),Te({_tag:fr("Millis"),value:In})]),Fe({decode:e=>{switch(e._tag){case"Infinity":return Ss;case"NegativeInfinity":return Da;case"Nanos":return $o(e.value);case"Millis":return Zi(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}}}}))}),Ite=z.annotate({expected:"a string that will be decoded as a Duration"}),Tte=Ite.pipe(ee(ih,Ste)),wte=dd.pipe(ee(ih,bte)),vte=Zu.pipe(ee(ih,Ete)),Cte=Fo(qC),Fj=(e,t)=>z.pipe(ee(e,Xt({decode:(r,n)=>{let o=t(r);return be(o)?D(new le({message:o.failure.message},r,n)):$r(o.success)===r?I(o.success):D(new le({message:"expected a canonical address"},r,n))},encode:r=>I($r(r))}))),ZC=In.check(yc({minimum:0,maximum:255})),id=In.check(yc({minimum:0,maximum:65535})),Nj=In.check(yc({minimum:0,maximum:4294967295})),$S=Nj.pipe(ee(ih,Fe({decode:fp,encode:ui}))),ns=(e,t)=>Ge(r=>zC(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=ya(e,t);return Ne()(r,Xt({decode:(n,o)=>{let{_tag:s,...i}=n,a=DB(e,i);return tt(a)?I(a.success):D(new le({message:a.failure.message},n,o))},encode:n=>I({...n})}))}}),Uj=ns("A",{address:Fj(sh,Wu)}),Dj=ns("AAAA",{address:Fj(QS,Ku)}),Lj=ns("CAA",{critical:Fi,tag:z.check(Xu(/^[a-z0-9]+$/i)),value:z}),Bj=ns("CNAME",{target:Sa}),$j=ns("MX",{exchange:Sa,priority:id}),jj=ns("NAPTR",{order:id,preference:id,flags:z,service:z,regexp:z,replacement:Sa}),Hj=ns("NS",{host:Sa}),qj=ns("PTR",{host:pA}),zj=ns("SOA",{primary:Sa,admin:pA,serial:Nj,refresh:$S,retry:$S,expire:$S,minimum:$S}),Wj=ns("SRV",{target:Sa,port:id,priority:id,weight:id}),Kj=ns("TLSA",{certUsage:ZC,selector:ZC,matchingType:ZC,data:tj}),Vj=ns("TXT",{chunks:Yu(z)}),Ate=Pe([Uj,Dj,Lj,Bj,$j,jj,Hj,qj,zj,Wj,Kj,Vj]).annotate({identifier:"DnsRecord"});function yA(e,t,r){let n=Cr()([e,t,r],([o,s,i])=>{let a=Jm(s,i);return(c,u,f)=>{if(!ws(c))return D(new at(u,c,f));switch(c._tag){case"Success":return cr(ot(o)(c.value,f),{onSuccess:Mr,onFailure:p=>tn(u,"value",p,c,f)});case"Failure":return cr(ot(a)(c.cause,f),{onSuccess:ir,onFailure:p=>tn(u,"cause",p,c,f)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,i])=>Ne()(Pe([Te({_tag:fr("Success"),value:o}),Te({_tag:fr("Failure"),cause:Jm(s,i)})]),Fe({decode:a=>a._tag==="Success"?Mr(a.value):ir(a.cause),encode:a=>ft(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}}))});return J(n.ast,{value:e,error:t,defect:r})}function n$(e,t,r){return Te({type:fr(e),nodes:ct(Te({index:Vu,data:t})),edges:ct(Te({index:Vu,source:Vu,target:Vu,data:r}))})}function o$(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return D(new At(["nodes",o,"index"],new le({expected:"a strictly increasing node index"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return D(new At(["edges",o,"index"],new le({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return D(new At(["edges",o,"source"],new le({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return D(new At(["edges",o,"target"],new le({expected:"an encoded node index"},s.target,t)))}return I(Dy(e))}function kte(e,t,r){return!Zw(e)||e.mutable||e.type!==t?D(new le({expected:`an immutable ${t} Graph`},e,r)):I(lm(e))}function Rte(e,t){return(r,n)=>{let o=lm(r),s=lm(n);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 Ote(e,t,r){return md()(Pe([HS,Te({nodes:Yu(t),edges:ct(rs([Vu,Vu,r]))})]),Ie(n=>{if(n===null)return Dy({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,i)=>({index:i,data:s}));return Dy({type:e,nodes:o,edges:n.edges.map(([s,i,a],c)=>({index:c,source:s%o.length,target:i%o.length,data:a}))})}))}function _te(e,t,r){let n=Cr()([t,r],([o,s])=>{let i=n$(e,o,s);return(a,c,u)=>!Zw(a)||a.mutable||a.type!==e?D(new at(c,a,u)):A(ot(i)(lm(a),u),f=>o$(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${H(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${H(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Ne()(n$(e,o,s),Xt({decode:o$,encode:(i,a)=>kte(i,e,a)})),toCodecArbitrary:({typeParameters:[o,s]})=>Ote(e,o,s),toEquivalence:([o,s])=>Rte(o,s)});return J(n.ast,{type:e,node:t,edge:r})}function s$(e){return Ne()(e,Fe({decode:Mw,encode:im}))}function Pte(e,t){let r=Cr()([e,t],([n,o])=>{let s=ct(rs([n,o]));return(i,a,c)=>Ay(i)?cr(ot(s)(im(i),c),{onSuccess:Mw,onFailure:u=>tn(a,"entries",u,i,c)}):D(new at(a,i,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([n,o])=>s$(ct(rs([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>s$(qS(ct(rs([o,s])).check(z$()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>yx(n,o)});return J(r.ast,{key:e,value:t})}function i$(e){return Ne()(e,Fe({decode:Nw,encode:Ct}))}function Mte(e){let t=Cr()([e],([r])=>{let n=ct(r);return(o,s,i)=>_y(o)?cr(ot(n)(Ct(o),i),{onSuccess:Nw,onFailure:a=>tn(s,"values",a,o,i)}):D(new at(s,o,i))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:"HashSet",toCodec:([r])=>i$(ct(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>i$(qS(ct(n).check(dA()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>zd(r)});return J(t.ast,{value:e})}function ba(e){let t=Cr()([e],([r])=>(n,o,s)=>ci(n)?fe(n)?ia:cr(ot(r)(n.value,s),{onSuccess:N,onFailure:i=>tn(o,"value",i,n,s)}):D(new at(o,n,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([r])=>Ne()(Pe([Te({_tag:fr("Some"),value:r}),Te({_tag:fr("None")})]),Fe({decode:n=>n._tag==="None"?_():N(n.value),encode:n=>de(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return J(t.ast,{value:e})}function Fte(e){return iA(e).pipe(ee(ba(oo(e)),X1()))}function Nte(e){return zS(e).pipe(ee(ba(oo(e)),e2()))}function Ute(e,t){return T$(e).pipe(ee(ba(oo(e)),t2(t)))}var Gj=Ge(WD,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Jj=Ge(zD,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Ne()(ct(z),Fe({decode:My,encode:ZD})),toCodecIso:()=>Ne()(Qu(z,Gj),Fe({decode:$w,encode:e=>e.cookies}))}),Dte=Jj.pipe(ee(Qu(z,z),Fe({decode:JD,encode:e=>jw(globalThis.Object.entries(e).map(([t,r])=>GD(t,r)))}))),Lte=Ge(e1,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>zw,toCodec:()=>Ne()(Qu(z,z),Fe({decode:Zo,encode:e=>({...e})}))}),SA=Ge(Vw,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Gw,toCodec:()=>Ne()(ct(rs([z,z])),Fe({decode:Ol,encode:e=>e.params}))}),Bte=(e,t)=>SA.pipe(ee(mA(Xm,t),Xt({decode:r=>Zt(i1(r,e),{onNone:()=>D(new At([e],new Yt(void 0))),onSome:I}),encode:r=>I(Ol([[e,r]]))}))),$te=SA.pipe(ee(Qu(z,Pe([z,Yu(z)])),Fe({decode:c1,encode:Mu})));function jte(e){return Gu(e).pipe(ee(ba(oo(e)),r2()))}function Hte(e){return lr(e).pipe(ee(ba(oo(e)),n2()))}function qte(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return lr(iA(e)).pipe(ee(ba(oo(e)),Gy({decode:o=>o.pipe(Fa(hx),N),encode:r==="omit"?eu:o=>N(Ma(eu(o),()=>n))})))}function Zj(e,t){let r=typeof t?.label=="string"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?ot(fr(r)):void 0,i=Cr()([e],([a])=>(c,u,f)=>{if(cm(c)){let p=s!==void 0?Iu(s(c.label,f),m=>new At(["label"],m)):P;return ur(p,()=>cr(ot(a)(nc(c),f),{onSuccess:m=>Pu(m,{label:c.label}),onFailure:()=>new Ft(u,[new At(["value"],new le(void 0,c,f))],c,f)}))}return D(new at(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${H(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Ne()(a,{decode:Ie(c=>Pu(c,{label:r})),encode:n?jy(c=>"Cannot serialize Redacted"+(de(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Ie(nc)}),toEquivalence:([a])=>XD(a)});return J(i.ast,{value:e})}function zte(e,t){return ee(Zj(oo(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ie(r=>Pu(r,{label:t?.label})),encode:t?.disallowEncode?jy(r=>"Cannot encode Redacted"+(de(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):Ie(nc)})(e)}function Wte(e,t){let r=Cr()([e,t],([n,o])=>(s,i,a)=>{if(!$f(s))return D(new at(i,s,a));switch(s._tag){case"Success":return cr(Qv(n)(s.success,a),{onSuccess:X,onFailure:c=>tn(i,"success",c,s,a)});case"Failure":return cr(Qv(o)(s.failure,a),{onSuccess:re,onFailure:c=>tn(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([n,o])=>Ne()(Pe([Te({_tag:fr("Success"),success:n}),Te({_tag:fr("Failure"),failure:o})]),Fe({decode:s=>s._tag==="Success"?X(s.success):re(s.failure),encode:s=>tt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return J(r.ast,{success:e,failure:t})}var Kte=globalThis.Symbol.for("immer-draftable"),eA={};function bA(e,t,r,n,o){let s=Gte(r,t,n),i=Qj(t),a=class extends e{constructor(...[c,u]){let p=u?.["~payload"],m=p?.token===eA?p.value:r.make(c??{},u);super(m,{...u,disableChecks:!0,"~payload":{token:eA,value:m}})}static[Vm]=Vm;get[i](){return i}static[Kte]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return V(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return pS(s(this))(c??{},u)}static makeOption(c,u){return dS(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Fs(this.ast,c))}static annotateKey(c){return this.rebuild(Wl(this.ast,c))}static check(...c){return this.rebuild(Pi(this.ast,c))}static extend(c){return(u,f)=>{let p=ah(u)?u:Te(u),m={...r.fields,...p.fields},h=eS(m,r.ast.checks,{identifier:c});return bA(this,c,sA(Pi(h,p.ast.checks),m),f,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(a.prototype,o(t)),a}function Vte(e){return new et(Ie(t=>new e(t,{"~payload":{token:eA,value:t}})),Oi())}function Qj(e){return`~effect/Schema/Class/${e}`}function Gte(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=Qj(t),i=u=>u instanceof o||O(u,s),a=Vte(o),c=J(new uc([e.ast],()=>(u,f,p)=>i(u)?I(u):D(new at(f,u,p)),{identifier:t,[By]:([u])=>({isConstructed:i,link:new jt(u,a)}),toCodec:([u])=>new jt(u.ast,a),toEquivalence:([u])=>u,toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[dm]:ac(e.ast),...r}));return n=ee(c,a)(e)}}function ah(e){return Ju(e)}var YS=e=>(t,r)=>{let n=ah(t)?t:Te(t);return bA(yP,e,n,r,o=>({toString(){return`${o}(${H({...this})})`}}))},Jte=e=>(t,r,n)=>{let o=ah(r)?r.mapFields(s=>({_tag:He(t),...s}),{unsafePreserveChecks:!0}):ya(t,r);return YS(e??t)(o,n)},Ar=e=>(t,r)=>{let n=ah(t)?t:Te(t);return bA(Xd,e,n,r,s=>({name:s}))},EA=e=>(t,r,n)=>{let o=ah(r)?r.mapFields(s=>({_tag:He(t),...s}),{unsafePreserveChecks:!0}):ya(t,r);return Ar(e??t)(o,n)};function Zte(e){return t=>t.annotate({toFormatter:e})}function Qte(e,t){return hB(e.ast,t)}function Yte(e){return t=>t.annotate({toEquivalence:e})}function Xte(e){return mC(e.ast)}function ere(e,t){return Fm(e.ast,t)}function tre(e,t){let r=Fm(Zl(e.ast),t);return TS(r,t)}var rf=yS,rre=SS,nre=bS,ore=zL;function sre(e,t){return fB(e,t)}function ire(e){return IB(e)}function are(e){return TB(e)}function cre(e){return wB(e)}function ure(e,t){return r=>J(Fs(r.ast,{toCodecIso:()=>new jt(e.ast,Vy(t))}),{schema:r})}function fre(e){return uB(e)}function lre(e){let t=w$(()=>r),r=Pe([e,ct(t),Qu(z,t)]);return r}var XS=J(Fs($l,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),dre=Qu(z,XS),pre=Te({message:z,name:Gu(z),stack:Gu(z),cause:Gu(XS)}),mre=J(Fs(iL,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function hre(e){return da(e.ast)}function xre(e){return e.ast.context?.annotations}var Yj=bT;var bc=Xx,eb=VP,Tn=xp;var os=ea,Ni=$F;var jr=n0,Xj=VF;var eH="~effect/MutableRef",gre={[eH]:eH,...wr,toJSON(){return{_id:"MutableRef",current:pr(this.current)}}},xd=e=>{let t=Object.create(gre);return t.current=e,t};var tH=e=>e.current;var tb=d(2,(e,t)=>(e.current=t,e));var Hr=Symbol.for("effect/MutableList/Empty"),Ta=()=>({head:void 0,tail:void 0,length:0}),TA=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},rH=()=>({array:[],mutable:!0,offset:0,next:void 0}),zs=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=rH(),e.tail=e.tail.next):e.head=e.tail=rH(),e.tail.array.push(t),e.length++},wA=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var rb=(e,t)=>nb(e,Ct(t),!Array.isArray(t)),nb=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},Ia=e=>{e.head=e.tail=void 0,e.length=0},nf=(e,t)=>{if(t=Bt(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return Ia(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?Ia(e):TA(e),r;o=o.next}return Ia(e),r},ob=(e,t)=>{if(t=Bt(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){Ia(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,TA(e);return}r+=o,n=n.next}Ia(e)},Ec=e=>nf(e,e.length),of=e=>{if(!e.head)return Hr;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:Ia(e):TA(e),t},nH=(e,t)=>{if(t=Bt(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let i=s.offset;i<s.array.length;i++)if(n[o++]=s.array[i],o===r)return n;s=s.next}return n};var vA=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){Ia(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},oH=(e,t)=>vA(e,r=>r!==t);var yre="~effect/PubSub";var Sre="~effect/PubSub/Subscription",ub=e=>W(()=>vre(e.atomicPubSub(),new Map,Zn(),jr(!1),xd(!1),e.strategy(),xd(_()))),fb=e=>ub({atomicPubSub:()=>DA(e),strategy:()=>new ib}),lb=e=>ub({atomicPubSub:()=>DA(e),strategy:()=>new ab}),db=e=>ub({atomicPubSub:()=>DA(e),strategy:()=>new UA}),uh=e=>ub({atomicPubSub:()=>sH(e),strategy:()=>new ab}),DA=e=>{let t=typeof e=="number"?{capacity:e}:e;if(Cre(t.capacity),t.capacity===1/0)return sH(t);let r=t.replay&&t.replay>0?new cb(Math.ceil(t.replay)):void 0;return t.capacity===1?new OA(r):aU(t.capacity)===t.capacity?new kA(t.capacity,r):new CA(t.capacity,r)},sH=e=>{let t=e?.replay;return new PA(t&&t>0?new cb(Math.ceil(t)):void 0)};var fh=e=>Ci(ar(t=>(tb(e.shutdownFlag,!0),Ve(e.scope,Lg(t.id)).pipe(Vt(e.strategy.shutdown),fy(e.shutdownHook.open),vo)))),pb=d(2,(e,t)=>W(()=>bre(e,t))),bre=d(2,(e,t)=>{if(e.shutdownFlag.current||de(e.ended.current))return!1;if(tb(e.ended,N(t)),e.strategy instanceof ib)for(let[n,o,s]of Ec(e.strategy.publishers))s&&hi(o,Mr(!1));let r=Mr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=of(o))!==Hr;)hi(s,r)}return e.subscribers.clear(),!0});var mb=d(2,(e,t)=>L(()=>e.shutdownFlag.current||de(e.ended.current)?I(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),I(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag,e.ended))),iH=d(2,(e,t)=>e.shutdownFlag.current||de(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),aH=d(2,(e,t)=>L(()=>{if(e.shutdownFlag.current||de(e.ended.current))return I(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?I(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag,e.ended)})),lh=e=>Ci(yn(t=>{let r=Re(t,it),n=yr(e.scope),o=wre(e.pubsub,e.subscribers,e.strategy,e.ended);return It(n,Ere(o)).pipe(Vt(Wo(r,s=>Ve(n,s))),Pt(o))})),Ere=e=>Ci(ar(t=>(tb(e.shutdownFlag,!0),Ko(Ec(e.pollers),r=>c0(r,t.id),{discard:!0,concurrency:"unbounded"}).pipe(_t(()=>W(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),fy(e.shutdownHook.open),vo)))),hb=e=>L(()=>{if(e.shutdownFlag.current)return Dn;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return I(r)}let t=e.pollers.length===0?e.subscription.poll():Hr;return t===Hr?uH(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),I(t))}),cH=e=>L(function t(r){if(e.shutdownFlag.current)return Dn;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?I(e.replayWindow.takeAll().concat(n)):Gr(n)?I(n):A(uH(e),o=>t([o]))}),uH=e=>Nn(t=>{if(e.shutdownFlag.current)return t(Dn);if(de(e.ended.current)){let o=e.pollers.length===0?e.subscription.poll():Hr;return o!==Hr?(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),t(I(o))):t(I(e.ended.current.value))}let r=lu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),zs(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],W(()=>oH(e.pollers,r)))});var tr=Symbol.for("effect/PubSub/AbsentValue"),Ire=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},Tre=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},wre=(e,t,r,n)=>new FA(e,t,e.subscribe(),Ta(),jr(!1),xd(!1),r,e.replayWindow(),n),CA=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gd(this.replayBuffer):xb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(n,s);if(i===0)return r;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=r[a++],f=this.publisherIndex%this.capacity;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=tr,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new AA(this,this.publisherIndex,!1)}},AA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return Hr}pollUpTo(t){if(t=Bt(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let i=this.subscriberIndex%this.self.capacity,a=this.self.array[i];this.self.subscribers[i]-=1,this.self.subscribers[i]===0&&(this.self.array[i]=tr,this.self.subscribersIndex+=1),o.push(a),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},kA=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gd(this.replayBuffer):xb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(n,s);if(i===0)return r;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=r[a++],f=this.publisherIndex&this.mask;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=tr,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new RA(this,this.publisherIndex,!1)}},RA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return Hr}pollUpTo(t){if(t=Bt(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let i=this.subscriberIndex&this.self.mask,a=this.self.array[i];this.self.subscribers[i]-=1,this.self.subscribers[i]===0&&(this.self.array[i]=tr,this.self.subscribersIndex+=1),o.push(a),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=tr,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},OA=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=tr;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gd(this.replayBuffer):xb}pipe(){return V(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Ct(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=tr,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new _A(this,this.publisherIndex,!1)}},_A=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return Hr;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=tr),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return Bt(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=tr)))}},PA=class{publisherHead={value:tr,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gd(this.replayBuffer):xb}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=tr,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new MA(this,this.publisherTail,this.publisherIndex,!1)}},MA=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==tr?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Hr;let t=!0,r=Hr;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==tr&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=tr,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=Bt(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===Hr?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==tr&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=tr,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},FA=class{[Sre]={_A:F};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,i,a,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=i,this.strategy=a,this.replayWindow=c,this.ended=u}pipe(){return V(this,arguments)}},NA=class{[yre]={_A:F};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,i,a){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=i,this.ended=a}pipe(){return V(this,arguments)}},vre=(e,t,r,n,o,s,i)=>new NA(e,t,r,n,o,s,i),Cre=e=>{if(e<=0||e!==1/0&&!Number.isInteger(e))throw new Error(`Cannot construct PubSub with capacity of ${e}`)},ib=class{publishers=Ta();get shutdown(){return ar(t=>Ko(Ec(this.publishers),([r,n,o])=>o?c0(n,t.id):P,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,r,n,o,s){return Nn(i=>{if(de(s.current))return i(I(!1));let a=lu();return this.offerUnsafe(n,a),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),tH(o)?(this.removeUnsafe(a),i(Dn)):a.effect?i(a.effect):(a.resumes=[i],W(()=>this.removeUnsafe(a)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=of(this.publishers);if(o===Hr)n=!1;else{let[s,i]=o,a=t.publish(s);a&&o[2]?hi(i,Mr(!0)):a||wA(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){zs(this.publishers,[s,r,!0]);break}zs(this.publishers,[s,r,!1])}}removeUnsafe(t){vA(this.publishers,([r,n])=>n!==t)}},ab=class{get shutdown(){return P}handleSurplus(t,r,n,o){return I(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}},UA=class{get shutdown(){return P}handleSurplus(t,r,n,o,s){return W(()=>de(s.current)?!1:(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return LA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return BA(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,i=!0;for(;i;){t.slide();let a=t.publish(s);a&&(o=n.next())&&!o.done?s=o.value:a&&(i=!1)}}}},LA=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let i=of(o);if(i===Hr)Tre(r,n,o),o.length===0?s=!1:Ire(r,n,o);else{let a=n.poll();a===Hr?wA(o,i):(hi(i,Mr(a)),e.onPubSubEmptySpaceUnsafe(t,r))}}},BA=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},cb=class{capacity;head={value:tr,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:tr,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},gd=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=tr,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=Bt(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},xb={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var Are="~effect/Queue",kre="~effect/Queue/Enqueue",Rre="~effect/Queue/Dequeue";var $A={_A:F,_E:F},Ore={[Are]:$A,[kre]:$A,[Rre]:$A,...wr,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:Pre(this)}}},io=e=>oe(t=>{let r=Object.create(Ore);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=Ta(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},q(r)}),sf=e=>io({capacity:e});var Sb=()=>io(),jn=d(2,(e,t)=>ce(()=>Ic(e,t)?Ib:e.state._tag==="Open"&&e.strategy==="suspend"?Ure(e,t):lH)),Ic=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(of(e.messages),zs(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(zs(e.messages,t),dH(e),!0):!1:(zs(e.messages,t),yb(e),!0),wa=d(2,(e,t)=>$t(r=>{let n=bb(e,t);return n.length===0||e.strategy==="dropping"?r(ze(n)):hH(e,{_tag:"Array",remaining:n,offset:0,resume:r})})),bb=(e,t)=>{if(e.state._tag!=="Open")return Ct(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return rb(e.messages,t),e.strategy==="sliding"&&nf(e.messages,e.messages.length-e.capacity),yb(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return Ct(t);let n=[],o=0;for(let s of t)o<r?zs(e.messages,s):n.push(s),o++;return yb(e),n};var Ht=d(2,(e,t)=>ye(()=>Ui(e,t))),Ui=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=Pr(t),n=TM(r,Mre);return e.state.offers.size===0&&e.messages.length===0?(Tb(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},yb(e),!0)},yd=e=>Ht(e,Mf(Zc())),Eb=e=>Ui(e,Mf(Zc()));var ss=e=>ye(()=>HA(e)),HA=e=>{if(e.state._tag==="Done")return!1;Ia(e.messages);let t=e.state.offers;Tb(e,e.state._tag==="Open"?Fre:e.state.exit);for(let r of t)xH(r);return!0};var af=e=>fH(e,1,Number.POSITIVE_INFINITY);var fH=d(3,(e,t,r)=>(t=Bt(t),r=Bt(r),pH(()=>Nre(e,t,r)??bo(mH(e,()=>qA(e,t)),fH(e,t,r))))),Ws=e=>pH(()=>_re(e)??bo(mH(e,()=>qA(e,1)),Ws(e)));var _re=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=of(e.messages);return jA(e),ze(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=gH(e.state.offers);return jA(e),ze(t)}};var Pre=e=>e.state._tag==="Done"?0:e.messages.length;var lH=ze(!1),Ib=ze(!0),Mre=So(Zc()),Fre=Zf(),dH=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(hn),e.messages.length===0))break}},yb=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,dH(e)},0))},Nre=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return ze([]);if(!qA(e,t))return;let n=e.messages.length>0?nf(e.messages,r):[gH(e.state.offers)];return jA(e),ze(n)},pH=Uo({op:"QueueTake",[St](e){let t=this[Se]();return Gd(t)?t[St](e):t}}),qA=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,mH=(e,t)=>$t(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(hn);let n={ready:t,resume:r};return e.state.takers.add(n),ye(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),Ure=(e,t)=>$t(r=>Ic(e,t)?r(Ib):hH(e,{_tag:"Single",message:t,resume:r})),hH=(e,t)=>{if(e.state._tag!=="Open")return xH(t);let r=e.state.offers;return r.add(t),ye(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&Tb(e,e.state.exit))})},xH=e=>e._tag==="Single"?e.resume(lH):e.resume(ze(e.remaining.slice(e.offset))),gH=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(Ib),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(ze([]))),r},jA=e=>{if(e.state._tag==="Done")return wo(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Tb(e,e.state.exit),wo(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag==="Single")zs(e.messages,t.message),e.state.offers.delete(t),t.resume(Ib);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;zs(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(ze([]))}let n=e.state;if(n._tag==="Done")return wo(n.exit.cause)}return!1};var Tb=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var uf=e=>new zA(e),yH=(e,t,r)=>$t(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),ye(()=>{e.waiters.delete(o)})}),zA=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=ce(()=>this.free<t?yH(this,t,r):(this.taken+=t,q(t)));return r}takeIfAvailable(t){return ce(()=>this.free<t?q(!1):(this.taken+=t,q(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return oe(r=>(this.permits=t,this.free<0?pe:(this.releaseUnsafe(r,0),pe)))}release(t){return oe(r=>q(this.releaseUnsafe(r,t)))}get releaseAll(){return oe(t=>q(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Gn(n=>{let o=ce(()=>{if(this.free<t){let s=yH(this,t,pe);return Y(n(s),()=>o)}return this.taken+=t,Io(n(r),()=>{this.releaseUnsafe(ea(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Gn(n=>this.free<t?iu:(this.taken+=t,Io(n(Jf(r)),()=>{this.releaseUnsafe(ea(),t)},!0)))}};var KA=e=>ws(e)?ft(e)?se(e.value):e:I(e);var IH="~effect/Channel",on=e=>O(e,IH),Dre={[IH]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return V(this,arguments)}},De=e=>{let t=Object.create(Dre);return t.transform=(r,n)=>rt(e(r,n),o=>I(je(o))),t},is=(e,t)=>De((r,n)=>A(we(e)(r,n),o=>t(o,n))),qr=e=>De((t,r)=>e),Vs=e=>De(me(function*(t,r){let n=yr(r),o=i=>Ve(n,ey(i)),s=yield*to(e(t,r,n),o);return to(s,o)})),we=e=>e.transform,dh=4096,Lre=(e,t,r)=>io({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(_t(n=>It(e,ss(n))),_t(n=>zo(t(n),e).pipe(rt(o=>Ht(n,o)),gt(e))));var TH=(e,t)=>De((r,n)=>K(Lre(n,e,t),af)),wb=e=>De((t,r)=>L(()=>we(e())(t,r))),Bre=(e,t,r)=>Vs(me(function*(n,o,s){let i=_();yield*Wo(s,c=>de(i)?r(i.value,c):P);let a=yield*Ci(K(e,c=>(i=N(c),c)));return yield*we(t(a))(n,o)}));var wH=e=>qr(W(()=>{let t=e();return L(()=>{let r=t.next();return r.done?se(r.value):I(r.value)})})),VA=e=>qr(W(()=>{let t=0;return L(()=>t>=e.length?se():I(e[t++]))}));var GA=(e,t=dh)=>{let r=Lo(t);return qr(W(()=>{let n=e(),o=_();return L(()=>{if(o._tag==="Some")return se(o.value);let s=[];for(;s.length<r;){let i=n.next();if(i.done){if(s.length===0)return se(i.value);o=N(i.value);break}s.push(i.value)}return I(s)})}))};var vH=(e,t=dh)=>GA(()=>e[Symbol.iterator](),t),vb=e=>Cb(I(e));var CH=e=>Cb(W(e)),Sd=qr(I(se())),AH=qr(I(Xn)),Di=e=>qr(I(D(e))),kH=e=>qr(sy(e)),ph=e=>qr(je(e)),RH=e=>qr(aa(e)),JA=e=>ph(cl(e)),Cb=e=>qr(W(()=>{let t=!1;return L(()=>t?se():(t=!0,e))}));var OH=e=>qr(A(e,()=>se())),ZA=e=>qr(I(A(e,KA)));var _H=e=>qr(I(af(e)));var QA=e=>qr(I(Su(cH(e),()=>se())));var PH=e=>Tc(K(lh(e),QA)),MH=e=>Tc(K(lh(e),t=>ZA(hb(t))));var FH=e=>De((t,r)=>$re({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var $re=e=>{let t=e.readable.getReader(),r=e.exit??xd(void 0),n=L(()=>r.current?r.current:Un(Vo({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??je(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?se():I(Me(s))}));return Pt(It(e.scope,e.releaseLockOnEnd?W(()=>t.releaseLock()):Wp(()=>t.cancel().catch(Rr))),n)},jre=(e,t)=>De(me(function*(r,n){let o=e[Symbol.asyncIterator]();return o.return&&(yield*It(n,Wp(()=>o.return()))),A(Vo({try:()=>o.next(),catch:t}),s=>s.done?se(s.value):I(s.value))})),NH=(e,t)=>Gs(jre(e,t),Me),Gs=d(2,(e,t)=>is(e,r=>W(()=>{let n=0;return K(r,o=>t(o,n++))})));var UH=d(2,(e,t)=>is(e,r=>I(ht(r,n=>A(t(n),se))))),DH=e=>e===void 0||e!=="unbounded"&&e<=1,Ab=d(e=>on(e[0]),(e,t,r)=>DH(r?.concurrency)?LH(e,t):Hre(e,t,r)),LH=(e,t)=>De((r,n)=>{let o=0;return K(we(e)(r,n),A(s=>t(s,o++)))}),Hre=(e,t,r)=>Vs(me(function*(n,o,s){let i=0,a=yield*we(e)(n,o),c=r.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*sf(0);yield*It(s,ss(u));let f=Sr(yield*Nr()),p=Ni(s);if(r.unordered){let m=uf(c),h=qe(m.release(1)),x=Un({onFailure:g=>A(Ht(u,g),h),onSuccess:g=>A(jn(u,g),h)});yield*m.take(1).pipe(A(()=>a),A(g=>{let y=i++;return p(f(x(L(()=>t(g,y))))),P}),Mt({disableYield:!0}),rt(g=>m.withPermits(c-1)(Ht(u,g))),gt(s))}else{let m=yield*sf(c-2);yield*It(s,ss(m)),yield*Ws(m).pipe(j0,A(g=>jn(u,g)),Mt({disableYield:!0}),rt(g=>Ht(u,g)),gt(s));let h,x=g=>{g._tag!=="Success"&&(h=g.cause,Ui(u,g.cause))};yield*a.pipe(A(g=>{if(h)return je(h);let y=i++,E=f(L(()=>t(g,y)));return p(E),E.addObserver(x),jn(m,bc(E))}),Mt({disableYield:!0}),rt(g=>jn(m,ir(g)).pipe(Vt(Ht(m,g)))),gt(s))}return Ws(u)}));var YA=d(e=>on(e[0]),(e,t,r)=>DH(r?.concurrency)?qre(e,t):zre(e,t,r)),qre=(e,t)=>De((r,n)=>K(we(e)(r,n),o=>{let s,i,a=A(o,u=>(i??=yr(n),ur(we(t(u))(r,i),f=>(s=c(f),s)))),c=ht(u=>{if(s=void 0,i.state._tag==="Empty")return a;let f=Ve(i,Kt);return i=void 0,A(f,()=>a)});return L(()=>s??a)})),zre=(e,t,r)=>e.pipe(Gs(t),Ob(r)),BH=d(2,(e,t)=>De((r,n)=>W(()=>{let o,s=yr(n),i=A(we(e)(r,s),a=>(o=ht(a,c=>Ve(s,Kt).pipe(A(()=>we(t(c))(r,n)),A(u=>(o=u,u)))),o));return L(()=>o??i)})));var XA=d(4,(e,t,r,n)=>De(me(function*(o,s){let i=yield*we(e)(o,s),a=yield*we(t)(o,s),c=r();return L(()=>{let u=n(c,i,a);return K(u,([f,p])=>(c=p,f))})}))),$H=d(2,(e,t)=>De((r,n)=>W(()=>{let o,s=yr(n),i=A(we(e)(r,s),a=>{let c=a.pipe(_t(()=>(o=a,P)),ht(u=>Ve(s,Mr(u)).pipe(Vt(we(t(u))(r,n)),A(f=>(o=f,f)))));return o=c,c});return L(()=>o??i)}))),jH=e=>YA(e,F),wn=e=>is(e,t=>{let r,n=0,o=L(function s(){if(r===void 0)return A(t,a=>{switch(a.length){case 0:return s();case 1:return I(a[0]);default:return r=a,I(a[n++])}});let i=r[n++];return n>=r.length&&(r=void 0,n=0),I(i)});return I(o)}),HH=e=>LH(e,KA),qH=e=>is(e,t=>I(Mt(t,{disableYield:!0}))),zH=d(2,(e,t)=>ks(typeof t=="function"?t(F):t).pipe(K(r=>{let n=Fr.defaultValue();return WH(Fb(e,Fr,W(()=>n)),o=>r(o).pipe(K(s=>{n=s}),ht(()=>se(o))))}),Tc)),WH=(e,t)=>De((r,n)=>W(()=>{let o,s=()=>{let i=yr(n);return A(we(e)(r,i),a=>(o=ht(a,c=>Ve(i,Kt).pipe(A(()=>t(c)),A(s))),o))};return L(()=>o??s())})),KH=e=>WH(e,()=>P),VH=d(2,(e,t)=>is(e,(r,n)=>K(Lp(t),o=>_t(r,o)))),GH=d(2,(e,t)=>De((r,n)=>K(we(e)(r,n),o=>A(o,function s(i){return t(i)?I(i):A(o,s)}))));var JH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){let s=[];for(let i=0;i<o.length;i++)t(o[i])&&s.push(o[i]);return bt(s)?I(s):A(r,n)})))),ZH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){let s=[];for(let i=0;i<o.length;i++){let a=t(o[i]);tt(a)&&s.push(a.success)}return bt(s)?I(s):A(r,n)})))),QH=d(2,(e,t)=>is(e,r=>{let n=A(r,o=>G0(o,t));return I(A(n,function o(s){return bt(s)?I(s):A(n,o)}))})),YH=d(2,(e,t)=>is(e,r=>I(A(r,function n(o){return A(J0(o,t),s=>bt(s)?I(s):A(r,n))})))),bd=d(e=>on(e[0]),(e,t,r,n)=>De((o,s)=>K(we(e)(o,s),i=>{let a=t(),c,u=0,f,p=Un(i,{onFailure(h){f=h;let x=n?.onHalt&&n.onHalt(a);return x&&x.length>0?I([a,x]):je(h)},onSuccess(h){let x=r(a,h);return Y_(x)?I(x):x}});return L(function h(){if(c===void 0)return f?je(f):A(p,([g,y])=>(a=g,y.length===0?h():y.length===1?I(y[0]):(c=y,h())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),I(x)})})));var XH=d(3,(e,t,r)=>De((n,o)=>K(we(e)(n,o),s=>{let i=t,a=!0;return L(()=>a?(a=!1,I(i)):K(A(s,c=>r(i,c)),c=>(i=c,i)))}))),Ed=d(2,(e,t)=>De((r,n)=>{let o=yr(n);return K(we(e)(r,o),s=>{let i=s.pipe(rt(a=>{if(wo(a))return je(a);let c=o;return o=yr(n),Ve(c,ir(a)).pipe(Vt(we(t(a))(r,o)),A(u=>(i=u,u)))}));return L(()=>i)})})),eq=d(2,(e,t)=>Rb(e,Rp,t)),kb=d(2,(e,t)=>Ed(e,r=>OH(A(t(r),n=>je(r))))),tq=d(3,(e,t,r)=>Ed(e,n=>t(n)?r(n):ph(n))),Rb=d(3,(e,t,r)=>Ed(e,n=>{let o=t(n);return be(o)?ph(o.failure):r(o.success,n)})),Ks=d(2,(e,t)=>Rb(e,ul,r=>t(r)));var rq=d(2,(e,t)=>is(e,r=>I(Gp(r,n=>Op(n)?P:vo(t(n)))))),nq=d(e=>on(e[0]),(e,t,r,n)=>Ks(e,o=>t(o)?r(o):n?n(o):Di(o))),oq=d(e=>on(e[0]),(e,t,r,n)=>Ks(e,o=>{let s=t(o);return be(s)?n?n(s.failure):Di(s.failure):r(s.success)}));var sq=d(e=>on(e[0]),(e,t,r,n,o)=>Ks(e,s=>{if(Or(s,t)&&O(s,"reason")){let i=s.reason;return Or(i,r)?n(i,s):o?o(i,s):Di(s)}return Di(s)})),iq=d(e=>on(e[0]),(e,t,r,n)=>{let o;return Ks(e,s=>{if(Or(s,t)&&O(s,"reason")&&O(s.reason,"_tag")&&Xg(s.reason._tag)){let i=s.reason;return o??=new Set(Object.keys(r)),o.has(i._tag)?r[i._tag](i,s):n?n(i,s):Di(s)}return Di(s)})});var aq=d(2,(e,t)=>Ks(e,r=>Di(t(r)))),cq=e=>Ks(e,JA),uq=d(e=>on(e[0]),(e,t)=>{if(!t?.log)return Ks(e,()=>Sd);let r=Tl(t.log===!0?void 0:t.log);return Ks(kb(e,n=>gN(n)?r(n):P),()=>Sd)}),bH=e=>Ed(e,()=>Sd),fq=d(e=>on(e[0]),(e,t)=>{if(!t?.log)return bH(e);let r=Tl(t.log===!0?void 0:t.log);return bH(kb(e,n=>r(n)))}),lq=d(2,(e,t)=>wb(()=>{let r,n=Fr.defaultValue(),o=Fb(e,Fr,W(()=>n)),s=nk(o,()=>(r=void 0,P)),i=typeof t=="function"?t(F):t,a=Ks(s,me(function*(c){return r||(r=yield*ks(i)),n=yield*r(c),a},(c,u)=>ht(c,()=>I(Di(u))),Tc));return a})),dq=d(e=>on(e[0]),(e,t,r)=>e.pipe(Gs(t),Ob({...r,concurrency:r?.concurrency??1,switch:!0}))),Ob=d(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>Vs(me(function*(o,s,i){let a=r==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:uf(a),u=yield*Xj(!0),f=new Set,p=yield*sf(t);yield*It(i,ss(p));let m=yield*we(e)(o,s);return yield*xt(function*(){for(;;){let h;c&&(f.size<a?yield*c.take(1):(h=yield*El(m),yield*Ya(c.take(1),Vt(bc(h),Xn))));let x=h===void 0?yield*m:yield*bc(h),g=yr(i),y=yield*we(x)(o,g);for(;f.size>=a;){let b=K_(f);f.delete(b),f.size===0&&(yield*u.open),yield*Tn(b)}let E=yield*y.pipe(_t(()=>Vp),A(b=>jn(p,b)),Mt({disableYield:!0}),to(me(function*(b){let v=ey(b),T=yield*eo(Ve(g,v));if(!f.has(E))return;let S=wN([v,T]);vs(S)&&(yield*Ht(p,S.cause)),f.delete(E),c&&(yield*c.release(1)),f.size===0&&(yield*u.open)})),El);u.closeUnsafe(),f.add(E)}}).pipe(rt(h=>{let x=Up(h);return tt(x)?u.whenOpen(Ht(p,h)):Ht(p,h)}),gt(i)),Ws(p)}))),_b=d(e=>on(e[0])&&on(e[1]),(e,t,r)=>Vs(me(function*(n,o,s){let i=r?.haltStrategy??"both",a=yield*sf(0);yield*It(s,ss(a));let c=0;function u(p,m){if(c++,!wo(m))return Ht(a,m);switch(i){case"both":return c===2?Ht(a,m):P;case"left":case"right":return p===i?Ht(a,m):P;case"either":return Ht(a,m)}}let f=(p,m,h)=>we(m)(n,h).pipe(A(x=>x.pipe(A(g=>jn(a,g)),Mt)),to(x=>Zp(ey(x),g=>Ve(h,g)).pipe(Un({onFailure:g=>u(p,g),onSuccess:()=>u(p,x)}))),gt(s));return yield*f("left",e,yr(s)),yield*f("right",t,yr(s)),Ws(a)}))),pq=d(2,(e,t)=>_b(e,OH(t),{haltStrategy:"left"})),mq=()=>De((e,t)=>W(()=>{let r="",n=!1,o=_();function s(c){let u=[];function f(p){r.length===0?u.push(p):(u.push(r+p),r="")}for(let p=0;p<c.length;p++){let m=c[p];if(m.length!==0){let h=0,x=m.indexOf("\r"),g=m.indexOf(`
|
|
29
29
|
`);for(n&&(g===0&&(h=1,g=m.indexOf(`
|
|
30
30
|
`,h)),n=!1);x!==-1||g!==-1;)x===-1||g!==-1&&g<x?(f(m.substring(h,g)),h=g+1,g=m.indexOf(`
|
|
31
31
|
`,h)):(f(m.substring(h,x)),m.length===x+1?(n=!0,h=m.length,x=-1):(h=x+(g===x+1?2:1),x=m.indexOf("\r",h),g=m.indexOf(`
|
|
32
|
-
`,h)));r=r+m.substring(h)}}return bt(u)?u:null}let i=L(()=>o._tag==="Some"?se(o.value):Up(e,{onSuccess:a,onFailure:je,onDone:c=>{if(o=N(c),r.length>0){let u=r;return r="",n=!1,I([u])}return se(c)}}));function a(c){let u=s(c);return u!==null?I(u):i}return i}));var ek=d(2,(e,t)=>De((r,n)=>A(we(e)(r,n),o=>we(t)(o,n)))),tk=d(2,(e,t)=>De((r,n)=>A(we(e)(r,n),o=>{let s=rt(o,i=>wo(i)?je(i):gn(bN(i)));return K(we(t)(s,n),i=>q0(i,a=>Rp(a)?je(a.value):gn(a)))}))),Tc=e=>De((t,r)=>{let n;return I(L(()=>n||e.pipe(zo(r),A(o=>we(o)(t,r)),A(o=>n=o))))}),hq=e=>Vs((t,r,n)=>K(zo(we(e)(t,r),n),zo(n)));var xq=d(2,(e,t)=>De(me(function*(r,n){let o=yield*we(e)(r,n),s=yield*io({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*It(n,ss(s)),yield*o.pipe(A(i=>jn(s,i)),Mt({disableYield:!0}),to(i=>Ht(s,i)),gt(n)),Ws(s)}))),gq=d(2,(e,t)=>De(me(function*(r,n){let o=yield*we(e)(r,n),s=yield*io({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*It(n,ss(s)),yield*o.pipe(A(i=>wa(s,i)),Mt({disableYield:!0}),to(i=>Ht(s,i)),gt(n)),sf(s)}))),rk=d(2,(e,t)=>Ob(e,qr(I(A(t,se))),{haltStrategy:"either"})),yq=d(2,(e,t)=>Vs(me(function*(r,n,o){let s=yield*we(e)(r,n),i=yield*gt(t,o,{startImmediately:!0});return L(()=>{let a=i.pollUnsafe();return a===void 0?s:TN(a,{onFailure:je,onSuccess:se})})}))),Sq=d(2,(e,t)=>ph(e,r=>vs(r)?t(r.cause):P)),ph=d(2,(e,t)=>Vs((r,n,o)=>Wo(o,t).pipe(Vt(we(e)(r,n))))),bq=d(2,(e,t)=>Tc(Pt(t,e))),nk=d(2,(e,t)=>is(e,r=>W(()=>{let n=!0,o=_t(r,s=>(n=!1,t(s)));return L(()=>n?o:r)}))),Eq=d(2,(e,t)=>is(e,r=>I(ht(r,n=>A(t,()=>se(n)))))),Iq=d(2,(e,t)=>ph(e,r=>t)),uf=(e,t,r)=>L(()=>{let n=Zn(),o=we(e)(se(),n);return ht(A(o,t),r||I).pipe(Xr(s=>Ve(n,s)))});var _b=d(2,(e,t)=>De((r,n)=>K(Ur(we(e)(r,n),t),Ur(t)))),Pb=d(3,(e,t,r)=>De((n,o)=>K(Jo(we(e)(n,o),t,r),Jo(t,r)))),Mb=d(3,(e,t,r)=>De((n,o)=>A(r,s=>we(Pb(e,t,s))(n,o)))),Tq=d(e=>on(e[0]),(e,t,r)=>sp(t)?_b(e,t):De((n,o)=>A(r?.local?gi(t,xi(),o):Op(t,o),s=>K(Ur(we(e)(n,o),s),Ur(s))))),wq=d(2,(e,t)=>De((r,n)=>yn(o=>{let s=t(o);return we(_b(e,s))(r,n)})));var ok=function(){let e=on(arguments[0]),t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return EH(n,t,r)}return n=>EH(n,t,r)},EH=(e,t,r)=>Lre(tw(t,r),n=>Pb(e,li,n),(n,o)=>ar(s=>{let i=s.getRef(Vn),a=s.getRef($g);return Pg(n,o,i,a)}));var vq=e=>uf(e,t=>Mt(t,{disableYield:!0})),ff=d(2,(e,t)=>uf(e,r=>Mt(A(r,t),{disableYield:!0}))),Cq=d(2,(e,t)=>uf(e,r=>r.pipe(A(t),A(n=>n?P:se()),Mt({disableYield:!0})))),sk=e=>K(lf(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let i=t[s];n.set(i,o),o+=i.length}return n});var Aq=e=>L(()=>{let t=_();return uf(e,r=>r.pipe(sy,A(n=>(t=n,se()))),()=>I(t))}),kq=e=>L(()=>{let t=Symbol(),r=t;return uf(e,n=>Mt(A(n,o=>(r=o,P)),{disableYield:!0}),()=>r===t?ia:B0(r))}),lf=d(3,(e,t,r)=>L(()=>{let n=t();return uf(e,o=>xn({while:nr,body:()=>o,step:s=>{n=r(n,s)}}),()=>I(n))})),Rq=d(3,(e,t,r)=>L(()=>{let n=t();return uf(e,o=>xn({while:nr,body:qe(o.pipe(A(s=>r(n,s)),K(s=>{n=s}))),step:Rr}),()=>I(n))})),ik=me(function*(e){let t=cf(1),r=yield*Nr(),n=Re(r,it);return(yield*we(e)(se(),n)).pipe(Ur(r),t.withPermits(1))},rt(e=>I(je(e)))),as=(e,t)=>we(e)(se(),t);var ak=d(e=>on(e[0]),(e,t)=>en(r=>ff(e,n=>wa(t,n)).pipe(r,eo,A(n=>(ft(n)?bb(t):Ui(t,n.cause),P)))));var Oq=d(e=>on(e[0]),me(function*(e,t){let r=yield*Co,n=yield*io({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*It(r,ss(n)),yield*gt(ak(e,n),r),n}));var _q=e=>Ti(e.capacity==="unbounded"?ch(e):e.strategy==="dropping"?fb(e):e.strategy==="sliding"?lb(e):ub(e),uh),Pq=d(2,me(function*(e,t){let r=yield*_q(t);return yield*Rs(ck(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),ck=d(e=>on(e[0]),(e,t,r)=>ff(e,n=>aH(t,n)).pipe(r?.shutdownOnEnd===!0?wi(uh(t)):F)),Mq=d(2,me(function*(e,t){let r=yield*_q(t);return yield*ff(e,n=>pb(r,n)).pipe(Xr(n=>db(r,n)),Rs),r}));var zre="~effect/Stream",Wre={_R:F,_E:F,_A:F},Fq=function(e){this.channel=e};Fq.prototype={[zre]:Wre,pipe(){return V(this,arguments)}};var Nq=e=>new Fq(e);var Vre="~effect/Sink";var Gre={_A:F,_In:F,_L:F,_E:F,_R:F},Jre={[Vre]:Gre,pipe(){return V(this,arguments)}};var Zre=e=>{let t=Object.create(Jre);return t.transform=e,t},Uq=e=>De((t,r)=>I(A(e.transform(t,r),se)));var Dq=e=>{let t=Bt(e);return Zre(r=>{let n=[];if(t===0)return I([n]);let o;return r.pipe(A(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?se():P;for(let i=0;i<s.length;i++)if(n.push(s[i]),n.length===t)return i+1<s.length&&(o=s.slice(i+1)),se();return P}),Mt({disableYield:!0}),ht(()=>I([n,o])))})};var sn={};ps(sn,{DefaultChunkSize:()=>Qq,Do:()=>Mse,TypeId:()=>Zq,accumulate:()=>Sse,aggregate:()=>lse,aggregateWithin:()=>Tk,as:()=>kne,bind:()=>Nse,bindEffect:()=>Use,bindTo:()=>Dse,broadcast:()=>wz,broadcastN:()=>dse,buffer:()=>yoe,bufferArray:()=>Soe,callback:()=>Ub,catch:()=>Sh,catchCause:()=>fz,catchCauseFilter:()=>Roe,catchCauseIf:()=>koe,catchDefect:()=>boe,catchFilter:()=>Ek,catchIf:()=>dz,catchReason:()=>voe,catchReasons:()=>Coe,catchTag:()=>Toe,catchTags:()=>woe,changes:()=>vz,changesWith:()=>Cz,changesWithEffect:()=>bse,chunks:()=>Sz,collect:()=>yse,combine:()=>Goe,combineArray:()=>Joe,concat:()=>pf,cross:()=>Yne,crossWith:()=>cz,debounce:()=>tse,decodeText:()=>Ese,die:()=>dne,drain:()=>Dne,drainFork:()=>Lne,drop:()=>Ik,dropRight:()=>Woe,dropUntil:()=>Hoe,dropUntilEffect:()=>qoe,dropWhile:()=>gz,dropWhileEffect:()=>yz,dropWhileFilter:()=>zoe,empty:()=>Js,encodeText:()=>Ise,ensuring:()=>bh,fail:()=>wc,failCause:()=>ez,failCauseSync:()=>pne,failSync:()=>lne,filter:()=>yk,filterEffect:()=>doe,filterMap:()=>loe,filterMapEffect:()=>poe,flatMap:()=>Ed,flatten:()=>sz,flattenArray:()=>Une,flattenEffect:()=>One,flattenIterable:()=>zne,flattenTake:()=>Wne,forever:()=>qne,fromArray:()=>gh,fromArrayEffect:()=>gne,fromArrays:()=>yne,fromAsyncIterable:()=>Sne,fromChannel:()=>U,fromEffect:()=>Nb,fromEffectDrain:()=>Yq,fromEffectRepeat:()=>Xq,fromEffectSchedule:()=>ane,fromEventListener:()=>Ine,fromIterable:()=>mf,fromIterableEffect:()=>hne,fromIterableEffectRepeat:()=>xne,fromIteratorSucceed:()=>mne,fromPubSub:()=>pk,fromPubSubTake:()=>tz,fromPull:()=>Li,fromQueue:()=>yh,fromReadableStream:()=>mk,fromSchedule:()=>bne,fromSubscription:()=>Ene,groupAdjacentBy:()=>use,groupBy:()=>ase,groupByKey:()=>cse,grouped:()=>sse,groupedWithin:()=>ise,haltWhen:()=>Ase,ignore:()=>Moe,ignoreCause:()=>Foe,interleave:()=>vse,interleaveWith:()=>kz,interruptWhen:()=>Cse,intersperse:()=>Az,intersperseAffixes:()=>wse,isStream:()=>Ae,iterate:()=>wne,let:()=>Fse,limitBytes:()=>Loe,make:()=>une,map:()=>ao,mapAccum:()=>Zoe,mapAccumArray:()=>xf,mapAccumArrayEffect:()=>Yoe,mapAccumEffect:()=>Qoe,mapArray:()=>nz,mapArrayEffect:()=>_ne,mapBoth:()=>Rne,mapEffect:()=>hf,mapError:()=>pz,merge:()=>hk,mergeAll:()=>Qne,mergeEffect:()=>Db,mergeLeft:()=>Jne,mergeResult:()=>Gne,mergeRight:()=>Zne,mkArrayBuffer:()=>Gse,mkString:()=>Vse,mkUint8Array:()=>Jse,never:()=>Cne,onEnd:()=>Rse,onError:()=>kse,onExit:()=>Rz,onFirst:()=>_z,onStart:()=>Oz,orDie:()=>Poe,orElseIfEmpty:()=>Ooe,orElseSucceed:()=>_oe,paginate:()=>Tne,partition:()=>hoe,partitionEffect:()=>moe,partitionQueue:()=>Sk,peel:()=>goe,pipeThrough:()=>gse,pipeThroughChannel:()=>hse,pipeThroughChannelOrFail:()=>xse,prepend:()=>Vne,provide:()=>Pz,provideContext:()=>wk,provideService:()=>Ose,provideServiceEffect:()=>vk,race:()=>foe,raceAll:()=>uz,range:()=>vne,rechunk:()=>bz,repeat:()=>Bne,repeatElements:()=>Hne,result:()=>Pne,retry:()=>Noe,run:()=>Lse,runCollect:()=>Fz,runCount:()=>Bse,runDrain:()=>Bb,runFold:()=>jse,runFoldEffect:()=>Hse,runForEach:()=>Wse,runForEachArray:()=>Id,runForEachWhile:()=>Kse,runHead:()=>qse,runIntoPubSub:()=>Xse,runIntoQueue:()=>rie,runLast:()=>zse,runSum:()=>$se,scan:()=>Xoe,scanEffect:()=>ese,schedule:()=>$ne,scoped:()=>Ane,service:()=>sne,serviceOption:()=>ine,share:()=>mse,sliding:()=>Koe,slidingSize:()=>Ez,split:()=>Voe,splitLines:()=>Tse,succeed:()=>df,suspend:()=>vn,switchMap:()=>Nne,sync:()=>fne,take:()=>Doe,takeRight:()=>Boe,takeUntil:()=>mz,takeUntilEffect:()=>hz,takeWhile:()=>xz,takeWhileEffect:()=>joe,takeWhileFilter:()=>$oe,tap:()=>oz,tapBoth:()=>Mne,tapCause:()=>lz,tapDefect:()=>Ioe,tapError:()=>bk,tapErrorTag:()=>Eoe,tapSink:()=>Fne,throttle:()=>ose,throttleEffect:()=>Iz,tick:()=>cne,timeout:()=>jne,timeoutOrElse:()=>iz,toAsyncIterable:()=>Yse,toAsyncIterableEffect:()=>Qse,toAsyncIterableWith:()=>Rk,toChannel:()=>cs,toPubSub:()=>eie,toPubSubTake:()=>Nz,toPull:()=>Ck,toQueue:()=>tie,toReadableStream:()=>Zse,toReadableStreamEffect:()=>kk,toReadableStreamWith:()=>Ak,transduce:()=>fse,transformPull:()=>br,transformPullBracket:()=>dk,unfold:()=>rz,unwrap:()=>Cn,unwrapReason:()=>Aoe,updateContext:()=>Mz,updateService:()=>_se,when:()=>xoe,withExecutionPlan:()=>Uoe,withSpan:()=>Pse,zip:()=>eoe,zipFlatten:()=>noe,zipLatest:()=>coe,zipLatestAll:()=>gk,zipLatestWith:()=>uoe,zipLeft:()=>toe,zipRight:()=>roe,zipWith:()=>xk,zipWithArray:()=>Lb,zipWithIndex:()=>ooe,zipWithNext:()=>soe,zipWithPrevious:()=>ioe,zipWithPreviousAndNext:()=>aoe});var Bq="~effect/RcMap",Qre=e=>({[Bq]:Bq,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:Si()},pipe(){return V(this,arguments)}}),$q=e=>ar(t=>{let r=t.context,n=Re(r,it),o=Qre({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive=="function"?Bc(e.idleTimeToLive,$e):qe($e(e.idleTimeToLive??Ji)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return Pt(Wo(n,()=>{if(o.state._tag==="Closed")return P;let s=o.state.map;return o.state={_tag:"Closed"},Ko(s,([,i])=>eo(mh(i))).pipe(_t(()=>W(()=>{ry(s)})))}),o)}),uk=d(2,(e,t)=>en(r=>{if(e.state._tag==="Closed")return Dn;let n=e.state,o=os(),s=Qr(n.map,t),i;if(s._tag==="Some")i=s.value,i.refCount++;else{if(Number.isFinite(e.capacity)&&TU(e.state.map)>=e.capacity)return D(new EN(`RcMap attempted to exceed capacity of ${e.capacity}`));{i={deferred:fu(),scope:Zn(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},i.finalizer=Xre(e,t,i),bi(n.map,t,i);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((f,p)=>{c.set(p,f)}),c.set(it.key,i.scope);let u=qn(c);L(()=>e.lookup(t)).pipe(Sr(u),Ni(i.scope)).addObserver(f=>{IN(f)&&Yre(e,t,i,u),hi(i.deferred,f)})}}let a=dn(o.context,it);return It(a,i.finalizer).pipe(Vt(r(Lg(i.deferred))))}));var Yre=(e,t,r,n)=>{if(e.state._tag==="Closed")return;let o=Qr(e.state.map,t);o._tag==="None"||o.value!==r||(Ei(e.state.map,t),!(r.refCount>0)&&mh(r).pipe(Sr(n),Ni(e.scope)))},mh=e=>e.fiber?Tn(e.fiber).pipe(Vt(Ve(e.scope,Kt))):Ve(e.scope,Kt),Xre=(e,t,r)=>ar(n=>{if(r.refCount--,r.refCount>0)return P;if(e.state._tag==="Closed")return mh(r);let o=Qr(e.state.map,t);if(o._tag==="None"||o.value!==r)return mh(r);if(jf(r.idleTimeToLive))return Ei(e.state.map,t),mh(r);if(!Wn(r.idleTimeToLive))return P;let s=n.getRef(Yn);return r.expiresAt=s.currentTimeMillisUnsafe()+Wt(r.idleTimeToLive),r.fiber?P:(r.fiber=en(function i(a){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag==="Closed"||r.refCount>0)return P;let f=Qr(e.state.map,t);return f._tag==="None"||f.value!==r?P:(Ei(e.state.map,t),Ve(r.scope,Kt))}return A(a(s.sleep(Zi(u))),()=>i(a))}).pipe(wi(W(()=>{r.fiber=void 0})),Sr(n.context),Ni(e.scope)),P)});var fk=d(2,(e,t)=>Su(r=>{if(e.state._tag==="Closed")return P;let n=Qr(e.state.map,t);if(n._tag==="None"||jf(n.value.idleTimeToLive))return P;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+Wt(o.idleTimeToLive),P}));var ene="~effect/RcRef",hh={_tag:"Empty"},tne={_tag:"Closed"},rne={_A:F,_E:F},lk=class{[ene]=rne;pipe(){return V(this,arguments)}state=hh;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},qq=e=>ar(t=>{let r=t.context,n=Re(r,it),o=new lk(e.acquire,r,n,e.idleTimeToLive!==void 0?$e(e.idleTimeToLive):void 0);return Pt(Wo(n,()=>{let s=o.state;return o.state=tne,s._tag==="Acquired"?Ve(s.scope,Kt):s._tag==="Acquiring"?Tn(s.fiber):P}),o)}),nne=(e,t)=>{switch(e.state._tag){case"Closed":return Dn;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?Pt(Tn(r.fiber),r):I(r)}case"Acquiring":{let r=e.state;return r.awaiters++,Hq(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Zn(),o=Ur(e.acquire,We(e.context,it,n)).pipe(A(s=>{if(e.state!==r)return Dn;let i={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=i,r.acquired=i,I(i)}),Xr(s=>ft(s)?P:(e.state===r&&(e.state=hh),Ve(n,s))));return r.fiber=Sr(os().context)(o),Hq(e,r,t)}}},Hq=(e,t,r)=>Xr(r(bc(t.fiber)),n=>{let o=t.acquired;return o!==void 0?vs(n)?Wq(e,o):P:--t.awaiters>0||e.state!==t?P:(e.state=hh,Tn(t.fiber))}),zq=e=>{let t=e;return en(r=>A(Co,n=>A(nne(t,r),o=>Pt(Wo(n,()=>Wq(t,o)),o.value))))},Wq=(e,t)=>{if(t.refCount--,t.refCount>0)return P;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=hh),Ve(t.scope,Kt)):Wn(r)?(t.fiber=en(n=>A(n(ua(r)),()=>e.state===t&&t.refCount===0?(e.state=hh,Ve(t.scope,Kt)):P)).pipe(wi(W(()=>{t.fiber=void 0})),Sr(e.context),Ni(e.scope)),P):P};var Kq=qq,Vq=zq;var Zq="~effect/Stream",Ae=e=>O(e,Zq),Qq=lh,U=Nq,Nb=e=>U(vb(K(e,Me))),sne=e=>Nb(Y0(e)),ine=e=>Nb(gu(e)),Yq=e=>Li(I(A(e,()=>se()))),Xq=e=>Li(I(K(e,Me))),ane=(e,t)=>Li(xt(function*(){let r=yield*ks(t),n=yield*Jo(e,Fr,Fr.defaultValue()),o=!0,s=L(()=>r(n)).pipe(A(i=>Jo(e,Fr,i)),K(i=>(n=i,Me(i))));return L(()=>o?(o=!1,I(Me(n))):s)})),cne=e=>Li(W(()=>{let t=!0,r=I(Me(void 0)),n=ca(r,e);return L(()=>t?(t=!1,r):n)})),Li=e=>U(qr(e)),br=(e,t)=>U(De((r,n)=>A(as(e.channel,n),o=>t(o,n)))),dk=(e,t)=>U(Vs((r,n,o)=>A(as(e.channel,n),s=>t(s,n,o)))),cs=e=>e.channel,Ub=(e,t)=>U(TH(e,t)),Js=U(yd),df=e=>U(wb(Me(e))),une=(...e)=>gh(e),fne=e=>U(CH(()=>Me(e()))),vn=e=>U(Tb(()=>e().channel)),wc=e=>U(Di(e)),lne=e=>U(kH(e)),ez=e=>U(dh(e)),dne=e=>U(JA(e)),pne=e=>U(RH(e)),mne=(e,t)=>U(GA(()=>e,t)),mf=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?gh(e):U(vH(e,t?.chunkSize)),hne=e=>Cn(K(e,mf)),xne=e=>Ed(Xq(e),mf),gh=e=>bt(e)?U(wb(e)):Js,gne=e=>Cn(K(e,gh)),yne=(...e)=>U(VA(jx(e,bt))),yh=e=>U(_H(e)),pk=e=>U(PH(e)),tz=e=>U(MH(e)),mk=e=>U(FH(e)),Sne=(e,t)=>U(NH(e,t)),bne=e=>Li(K(Dp(e),t=>ht(K(t(void 0),Me),()=>se()))),Ene=e=>U(QA(e)),Ine=(e,t,r)=>Ub(n=>{let o=typeof r=="object"&&r.once;function s(i){Ic(n,i),o&&bb(n)}return Ti(W(()=>e.addEventListener(t,s,r)),()=>W(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r=="object"?r.bufferSize:void 0}),rz=(e,t)=>Li(W(()=>{let r=e;return A(L(()=>t(r)),n=>n===void 0?se():(r=n[1],I(Me(n[0]))))})),Tne=(e,t)=>Li(W(()=>{let r=e,n=!1;return L(function o(){return n?se():A(t(r),([s,i])=>(fe(i)?n=!0:r=i.value,bt(s)?I(s):o()))})})),wne=(e,t)=>rz(e,r=>I([r,t(r)])),vne=(e,t,r=lh)=>e>t?Js:Li(W(()=>{let n=Lo(r),o=e,s=!1;return L(()=>{if(s)return se();let i=t-o+1;if(i>n){let c=DI(o,o+n-1);return o+=n,I(c)}let a=DI(o,o+i-1);return s=!0,I(a)})})),Cne=U(AH),Cn=e=>U(Tc(K(e,cs))),Ane=e=>U(hq(e.channel)),ao=d(2,(e,t)=>vn(()=>{let r=0;return U(Gs(e.channel,Bo(n=>t(n,r++))))})),kne=d(2,(e,t)=>ao(e,()=>t)),Rne=d(2,(e,t)=>e.pipe(ao(t.onElement),pz(t.onError))),nz=d(2,(e,t)=>U(Gs(e.channel,t))),hf=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,Cb(t,r),Gs(Me),U)),One=d(e=>Ae(e[0]),(e,t)=>hf(e,F,t)),_ne=d(2,(e,t)=>U(Cb(e.channel,t))),Pne=e=>e.pipe(ao(X),Sh(t=>df(re(t)))),oz=d(e=>Ae(e[0]),(e,t,r)=>hf(e,n=>Pt(t(n),n),r)),Mne=d(2,(e,t)=>e.pipe(bk(t.onError),oz(t.onElement,{concurrency:t.concurrency}))),Fne=d(2,(e,t)=>dk(e,me(function*(r,n,o){let s=jr(),i=jr(),a,c,u=!1,f=!1,p=s.whenOpen(L(()=>{if(a){let h=a;return a=void 0,f||s.closeUnsafe(),Pt(i.open,h)}return se()}));yield*L(()=>t.transform(p,o)).pipe(h=>Jp(h,x=>(u=!0,vs(x)&&(c=x.cause),i.open),!0),gt(o));let m=r.pipe(A(h=>c?je(c):u?I(h):(a=h,i.closeUnsafe(),s.openUnsafe(),Pt(i.await,h))),ht(()=>c?je(c):u?se():(f=!0,i.closeUnsafe(),s.openUnsafe(),A(i.await,()=>c?je(c):se()))));return L(()=>c?je(c):u?r:m)}))),Ed=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,YA(n=>t(n).channel,r),U)),Nne=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,dq(n=>t(n).channel,r),U)),sz=d(e=>Ae(e[0]),(e,t)=>Ed(e,F,t)),Une=e=>U(wn(e.channel)),Dne=e=>U(qH(e.channel)),Lne=d(2,(e,t)=>Db(e,Bb(t))),Bne=d(2,(e,t)=>U(zH(e.channel,t))),$ne=d(2,(e,t)=>e.channel.pipe(wn,VH(t),Gs(Me),U)),jne=d(2,(e,t)=>iz(e,{duration:t,orElse:()=>Js})),iz=d(2,(e,t)=>{let r=$e(t.duration);if(!Wn(r))return e;if(jf(r))return vn(t.orElse);let n=Symbol();return fz(vn(()=>{let s=os().getRef(Yn),i=Wt(r),a,c=jr(!1);return hk(br(e,(u,f)=>L(()=>(a=s.currentTimeMillisUnsafe()+i,c.openUnsafe(),u)).pipe(K(p=>(c.closeUnsafe(),a=void 0,p)),I)),Yq(xt(function*(){for(;;)if(yield*c.await,!(a===void 0||(yield*ua(a-s.currentTimeMillisUnsafe()),a===void 0)||a-s.currentTimeMillisUnsafe()>0))return yield*gn(n)})),{haltStrategy:"left"})}),o=>o.reasons.find(i=>i._tag==="Die"&&i.defect===n)?t.orElse():ez(o))}),Hne=d(2,(e,t)=>U(De((r,n)=>K(we(wn(e.channel))(r,n),o=>{let s,i=xt(function*(){let a=yield*o,c=Me(a);return s=(yield*Dp(t))(a).pipe(Pt(c),ht(f=>(s=void 0,i))),c});return L(()=>s??i)})))),qne=e=>U(KH(e.channel)),zne=e=>Ed(e,mf),Wne=e=>e.channel.pipe(wn,HH,U),pf=d(2,(e,t)=>{let r=U(jH(wH(()=>Kne(e,t))));return az.set(r,[e,t]),r}),az=new WeakMap;function*Kne(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=az.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var Vne=d(2,(e,t)=>pf(mf(t),e)),hk=d(e=>Ae(e[0])&&Ae(e[1]),(e,t,r)=>U(Ob(cs(e),cs(t),r))),Db=d(2,(e,t)=>e.channel.pipe(pq(t),U)),Gne=d(2,(e,t)=>hk(ao(e,X),ao(t,re))),Jne=d(2,(e,t)=>Db(e,Bb(t))),Zne=d(2,(e,t)=>Db(t,Bb(e))),Qne=d(2,(e,t)=>sz(mf(e),t)),Yne=d(2,(e,t)=>cz(e,t,(r,n)=>[r,n])),cz=d(3,(e,t,r)=>Ed(e,n=>ao(t,o=>r(n,o)))),xk=d(3,(e,t,r)=>Lb(e,t,Xne(r))),Xne=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},Lb=d(3,(e,t,r)=>U(Vs(me(function*(n,o){let s=yield*as(e.channel,o),i=yield*as(t.channel,o),a=xt(function*(){let f=yield*gt(s,o),p=yield*gt(i,o);return yield*XS([f,p])}),c={_tag:"PullBoth"};return xt(function*(){let[f,p]=c._tag==="PullBoth"?yield*a:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*i],m=r(f,p);return bt(m[1])?c={_tag:"PullRight",leftArray:m[1]}:bt(m[2])?c={_tag:"PullLeft",rightArray:m[2]}:c={_tag:"PullBoth"},m[0]})})))),eoe=d(2,(e,t)=>xk(e,t,(r,n)=>[r,n])),toe=d(2,(e,t)=>Lb(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),i=r.slice(o),a=n.slice(o);return[s,i,a]})),roe=d(2,(e,t)=>Lb(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),i=r.slice(o),a=n.slice(o);return[s,i,a]})),noe=d(2,(e,t)=>xk(e,t,(r,n)=>[...r,n])),ooe=e=>ao(e,(t,r)=>[t,r]),soe=e=>xf(e,_,(t,r)=>{let n=0;t._tag==="None"&&(n=1,t=N(r[0]));let o=Qt();for(;n<r.length;n++){let s=t.value;t=N(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,_()]]:[]}}),ioe=e=>xf(e,_,(t,r)=>{let n=Qt();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=N(r[o])}return[t,n]}),aoe=e=>xf(e,()=>({prev:_(),current:_()}),(t,r)=>{let n=0,o;t.current._tag==="None"?(n=1,o=r[0],t.current=N(o)):o=t.current.value;let s=Qt();for(;n<r.length;n++){let i=r[n];t.current=N(i),s.push([t.prev,o,t.current]),t.prev=N(o),o=i}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,_()]]:[]}}),gk=(...e)=>U(Tb(()=>{let t=[],r=new Set,n=jr(),o=jr();return Rb(VA(e.map((s,i)=>s.channel.pipe(wn,Cb(a=>(t[i]=a,r.has(i)?I(Me(t.slice())):(r.add(i),r.size<e.length?n.await:Pt(n.open,Me(t.slice()))))),GH(ei),UH(()=>r.has(i)?P:o.open)))),{concurrency:"unbounded",bufferSize:0}).pipe(rk(o.await))})),coe=d(2,(e,t)=>gk(e,t)),uoe=d(3,(e,t,r)=>ao(gk(e,t),([n,o])=>r(n,o))),uz=(...e)=>U(De((t,r)=>W(()=>{let n,o=V0(e.map(s=>{let i=yr(r);return as(s.channel,i).pipe(A(a=>H0(I(a),a)),Xr(a=>a._tag==="Success"?n?Ve(i,a):(n=a.value[0],P):Ve(i,a)),K(([,a])=>a))}));return L(()=>n??o)}))),foe=d(2,(e,t)=>uz(e,t)),yk=d(2,(e,t)=>U(JH(cs(e),t))),loe=d(2,(e,t)=>U(ZH(cs(e),t))),doe=d(2,(e,t)=>U(QH(cs(e),t))),poe=d(2,(e,t)=>U(YH(cs(e),t))),Sk=d(e=>Ae(e[0]),me(function*(e,t,r){let n=yield*Co,o=yield*as(e.channel,n),s=r?.capacity==="unbounded"?void 0:r?.capacity??Qq,i=yield*io({capacity:s}),a=yield*io({capacity:s});return yield*xt(function*(){for(;;){let c=yield*o,u=[],f=[];for(let m=0;m<c.length;m++){let h=t(c[m]);be(h)?u.push(h.failure):f.push(h.success)}let p;if(f.length>0){let m=Sb(i,f);m.length>0&&(p=yield*bl(wa(i,m)))}if(u.length>0){let m=Sb(a,u);m.length>0&&(yield*wa(a,m))}p&&(yield*bc(p))}}).pipe(to(c=>(Ui(i,c),Ui(a,c),P)),gt(n)),[i,a]})),xh=e=>U(De((t,r)=>Pt(It(r,ss(e)),sf(e)))),moe=d(e=>Ae(e[0]),(e,t,r)=>K(Sk(hf(e,n=>t(n),r),n=>n,r),([n,o])=>[xh(n),xh(o)])),hoe=d(e=>Ae(e[0]),(e,t,r)=>K(Sk(e,t,{capacity:r?.capacity??16}),([n,o])=>[xh(n),xh(o)])),xoe=d(2,(e,t)=>t.pipe(K(r=>r?e:Js),Cn)),goe=d(2,me(function*(e,t){let r,n=yield*ik(e.channel),o=rt(n,c=>(r=c,je(c))),[s,i]=yield*yl(c=>t.transform(o,c)),a=r?Js:Li(I(n));return i&&(a=pf(gh(i),a)),[s,a]})),yoe=d(2,(e,t)=>U(gq(e.channel,t))),Soe=d(2,(e,t)=>U(xq(e.channel,t))),fz=d(2,(e,t)=>e.channel.pipe(bd(r=>t(r).channel),U)),boe=d(2,(e,t)=>e.channel.pipe(eq(r=>t(r).channel),U)),lz=d(2,(e,t)=>e.channel.pipe(Ab(t),U)),Sh=d(2,(e,t)=>U(Ks(e.channel,r=>t(r).channel)));var bk=d(2,(e,t)=>e.channel.pipe(rq(t),U)),Eoe=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):Or(t);return bk(e,o=>n(o)?r(o):P)}),Ioe=d(2,(e,t)=>lz(e,r=>{let n=kp(r);return tt(n)?t(n.success):P})),dz=d(e=>Ae(e[0]),(e,t,r,n)=>U(nq(cs(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Ek=d(e=>Ae(e[0]),(e,t,r,n)=>U(oq(cs(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Toe=d(e=>Ae(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):Or(t);return dz(e,o,r,n)}),woe=d(e=>Ae(e[0]),(e,t,r)=>{let n;return Ek(e,o=>(n??=Object.keys(t),O(o,"_tag")&&Yg(o._tag)&&n.includes(o._tag)?X(o):re(o)),o=>t[o._tag](o),r)}),voe=d(e=>Ae(e[0]),(e,t,r,n,o)=>U(sq(cs(e),t,r,(s,i)=>n(s,i).channel,o&&((s,i)=>o(s,i).channel)))),Coe=d(e=>Ae(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let i of Object.keys(r)){let a=r[i];o[i]=(c,u)=>a(c,u).channel}let s=n&&((i,a)=>n(i,a).channel);return U(iq(e.channel,t,o,s))}),Aoe=d(2,(e,t)=>Ek(e,r=>Or(r,t)&&O(r,"reason")?X(r.reason):re(r),wc)),pz=d(2,(e,t)=>U(aq(e.channel,t))),koe=d(3,(e,t,r)=>U(tq(e.channel,t,n=>r(n).channel))),Roe=d(3,(e,t,r)=>U(kb(e.channel,t,(n,o)=>r(n,o).channel))),Ooe=d(2,(e,t)=>U($H(e.channel,r=>cs(t())))),_oe=d(2,(e,t)=>Sh(e,r=>df(t(r)))),Poe=e=>U(cq(e.channel)),Moe=d(e=>Ae(e[0]),(e,t)=>U(uq(e.channel,t))),Foe=d(e=>Ae(e[0]),(e,t)=>U(fq(e.channel,t))),Noe=d(2,(e,t)=>U(lq(e.channel,t))),Jq=(e,t)=>Cn(K(ks(t),r=>{let n=Fr.defaultValue(),o=()=>Sh(vk(e,Fr,W(()=>n)),s=>Cn(ht(K(r(s),i=>(n=i,Cn(Pt(Kp,o())))),()=>I(wc(s)))));return o()})),Uoe=d(e=>Ae(e[0]),(e,t,r)=>vn(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},i=vk(ey,W(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),a=r?.onEvent===void 0?void 0:F0(r.onEvent,()=>s),c,u=a===void 0?F:m=>Rz(Oz(m,K(a.begin,h=>{c=h})),h=>L(()=>{if(c===void 0)return P;let x=c;return c=void 0,a.end(x,h)})),f=_(),p=vn(()=>{let m=t.steps[o];if(!m)return wc(kI(f));let h=i(u(Pz(e,m.provide))),x=!1;if(de(f)){let g=f.value,y=!1,E=h;h=vn(()=>y?E:(y=!0,wc(g))),h=Jq(h,Hp(m,!1))}else{let g=Hp(m,!0);h=g?Jq(h,g):h}return Sh(n?_z(h,g=>(x=!0,P)):h,g=>(o++,n&&x?wc(g):(f=N(g),p)))});return p})),Doe=d(2,(e,t)=>{let r=Bt(t);return r===0?Js:mz(e,(n,o)=>o===r-1)}),Loe=d(3,(e,t,r)=>vn(()=>{let n=hy(t),o=BigInt(0),s=!1;return pf(xz(e,i=>{let a=o+BigInt(i.length);return a>n?(s=!0,!1):(o=a,!0)}),vn(()=>s?r():Js))})),Boe=d(2,(e,t)=>{let r=Bt(t);return r===0?Js:xf(e,Ta,(n,o)=>(tb(n,o),n.length>r&&nb(n,n.length-r),[n,va]),{onHalt(n){return Ec(n)}})}),mz=d(e=>Ae(e[0]),(e,t,r)=>br(e,(n,o)=>W(()=>{let s=0,i=!1;return A(L(()=>i?se():n),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){i=!0;let f=c.slice(0,r?.excludeLast?u:u+1);return bt(f)?I(f):se()}return I(c)})}))),hz=d(e=>Ae(e[0]),(e,t,r)=>br(e,(n,o)=>W(()=>{let s=0,i=!1;return xt(function*(){if(i)return yield*se();let a=yield*n;for(let c=0;c<a.length;c++)if(yield*t(a[c],s++)){i=!0;let u=a.slice(0,r?.excludeLast?c:c+1);return bt(u)?u:yield*se()}return a})}))),xz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=0,s=!1,i=A(L(()=>s?se():r),a=>{let c=[];for(let u=0;u<a.length;u++){if(!t(a[u],o++)){s=!0;break}c.push(a[u])}return bt(c)?I(c):s?se():i});return i}))),$oe=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!1,s=A(L(()=>o?se():r),i=>{let a=[];for(let c=0;c<i.length;c++){let u=t(i[c]);if(be(u)){o=!0;break}a.push(u.success)}return bt(a)?I(a):o?se():s});return s}))),joe=d(2,(e,t)=>hz(e,(r,n)=>K(t(r,n),o=>!o),{excludeLast:!0})),Ik=d(2,(e,t)=>{let r=Bt(t);return r===0?e:br(e,(n,o)=>W(()=>{let s=0,i=n.pipe(A(a=>s>=r?I(a):(s+=a.length,s<=r?i:I(a.slice(r-s)))));return i}))}),Hoe=d(2,(e,t)=>Ik(gz(e,(r,n)=>!t(r,n)),1)),qoe=d(2,(e,t)=>Ik(yz(e,(r,n)=>K(t(r,n),o=>!o)),1)),gz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=0,i=A(r,a=>{let c=a.findIndex(u=>!t(u,s++));return c===-1?i:(o=!1,I(a.slice(c)))});return L(()=>o?i:r)}))),zoe=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=A(r,i=>{let a=i.findIndex(c=>be(t(c)));return a===-1?s:(o=!1,I(i.slice(a)))});return L(()=>o?s:r)}))),yz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=0,i=xt(function*(){for(;;){let a=yield*r;for(let c=0;c<a.length;c++)if(!(yield*t(a[c],s++)))return o=!1,a.slice(c)}});return L(()=>o?i:r)}))),Woe=d(2,(e,t)=>{let r=Bt(t);return r===0?e:br(e,(n,o)=>W(()=>{let s=Ta(),i=A(n,a=>{rb(s,a);let c=s.length-r,u=rf(s,c);return Gr(u)?I(u):i});return i}))}),Sz=e=>e.channel.pipe(Gs(Me),U),bz=d(2,(e,t)=>(t=Lo(t),br(e,(r,n)=>W(()=>{let o=Qt(),s=0,i,a=!1;return L(function c(){if(a)return se();if(i===void 0)return A(r,u=>{if(o.length===0&&u.length===t)return I(u);if(o.length+u.length<t){for(let f=0;f<u.length;f++)o.push(u[f]);return c()}return i=u,c()});for(;s<i.length;)if(o.push(i[s++]),o.length===t){let u=o;return o=[],I(u)}return s=0,i=void 0,c()}).pipe(ht(()=>{if(o.length===0)return se();let c=o;return a=!0,o=[],I(c)}))})))),Koe=d(2,(e,t)=>Ez(e,t,1)),Ez=d(3,(e,t,r)=>{let n=Lo(t),o=Lo(r);return br(e,(s,i)=>W(()=>{let a=null,c=Ta(),u=!1,f=0,p=Un(s,{onSuccess(m){if(rb(c,m),f>0){let x=c.length;nb(c,f),f=Math.max(0,f-x)}if(c.length<n)return p;u=!0;let h=[];for(;c.length>=n;)if(n===o)h.push(rf(c,n));else{h.push(nH(c,n));let x=c.length;nb(c,o),f=Math.max(0,o-x)}return I(h)},onFailure(m){return c.length===0||u&&c.length<=n-o?je(m):(a=m,I(Me(Ec(c))))}});return L(()=>a?je(a):p)}))}),Voe=d(2,(e,t)=>xf(e,Qt,(r,n)=>{let o=Qt();for(let s=0;s<n.length;s++)t(n[s])?Gr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return Gr(r)?Me(r):va}})),Goe=d(4,(e,t,r,n)=>XA(wn(e.channel),wn(t.channel),r,n).pipe(Gs(Me),U)),Joe=d(4,(e,t,r,n)=>U(XA(e.channel,t.channel,r,n))),Zoe=d(e=>Ae(e[0]),(e,t,r,n)=>U(Sd(e.channel,t,(o,s)=>{let i=Qt();for(let a=0;a<s.length;a++){let[c,u]=r(o,s[a]);o=c,i.push(...u)}return[o,Gr(i)?Me(i):va]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0))),xf=d(e=>Ae(e[0]),(e,t,r,n)=>U(Sd(e.channel,t,(o,s)=>{let[i,a]=r(o,s);return o=i,[o,bt(a)?Me(a):va]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0))),va=Qt(),Qoe=d(e=>Ae(e[0]),(e,t,r,n)=>e.channel.pipe(wn,Sd(t,(o,s)=>K(r(o,s),([i,a])=>[i,bt(a)?Me(a):Qt()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0),U)),Yoe=d(e=>Ae(e[0]),(e,t,r,n)=>e.channel.pipe(Sd(t,(o,s)=>K(r(o,s),([i,a])=>[i,bt(a)?Me(a):va]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0),U)),Xoe=d(3,(e,t,r)=>vn(()=>{let n=t();return pf(df(n),U(Sd(e.channel,()=>n,(o,s)=>{let i=Qt();for(let a=0;a<s.length;a++)o=r(o,s[a]),i.push(o);return[o,Me(i)]})))})),ese=d(3,(e,t,r)=>vn(()=>e.channel.pipe(wn,XH(t(),r),Gs(Me),U))),tse=d(2,(e,t)=>br(e,me(function*(r,n){let o=yield*Yn,s=Wt($e(t)),i,a,c=1/0,u=jr(),f=jr(),p=jr();yield*r.pipe(u.whenOpen,A(h=>(f.openUnsafe(),i=h,c=o.currentTimeMillisUnsafe()+s,P)),Mt({disableYield:!0}),to(h=>(a=h,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),p.openUnsafe(),P)),gt(n));let m=L(function h(){let x=o.currentTimeMillisUnsafe(),g=c<x?s:Math.min(s,c-x);return A(Ya(ua(g),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return h();if(i){f.closeUnsafe(),u.closeUnsafe();let E=I(Me($f(i)));return i=void 0,E}else if(a)return je(a);return h()})});return L(()=>{if(a){if(i){let h=I(Me($f(i)));return i=void 0,h}return je(a)}return u.openUnsafe(),f.whenOpen(m)})}))),Iz=d(2,(e,t)=>{let r=t.burst??0;return t.strategy==="enforce"?rse(e,t.cost,t.units,t.duration,r):nse(e,t.cost,t.units,t.duration,r)}),rse=(e,t,r,n,o)=>br(e,s=>Su(i=>{let a=Wt($e(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=i.currentTimeMillisUnsafe();return I(A(s,function p(m){return A(t(m),h=>{let x=i.currentTimeMillisUnsafe(),y=(x-f)/a,E=u+y*r,b=E<0?c:Math.min(E,c);return h<=b?(u=b-h,f=x,I(m)):A(s,p)})}))})),nse=(e,t,r,n,o)=>br(e,s=>Su(i=>{let a=Wt($e(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=i.monotonicTimeNanosUnsafe();return I(A(s,p=>A(t(p),m=>{let h=i.monotonicTimeNanosUnsafe(),g=Number(h-f)/1e6/a,y=u+g*r,b=Math.min(y,c)-m;if(b>=0)return u=b,f=h,I(p);let v=-b/r,T=Math.max(0,v*a);return T>0?A(ua(T),()=>(u=b,f=h,I(p))):(u=b,f=h,I(p))})))})),ose=d(2,(e,t)=>Iz(e,{...t,cost:r=>I(t.cost(r))})),sse=d(2,(e,t)=>Sz(bz(e,t))),ise=d(3,(e,t,r)=>Tk(e,Dq(Lo(t)),ml(r))),ase=d(e=>Ae(e[0]),(e,t,r)=>Tz(e,me(function*(n,o,s){for(let i=0;i<n.length;i++){let[a,c]=yield*t(n[i]),u=Qr(s,a),f=de(u)?u.value:yield*ec(uk(o,a));yield*fk(o,a),yield*jn(f,c)}}),r)),cse=d(e=>Ae(e[0]),(e,t,r)=>vn(()=>{let n=Si();return Tz(e,me(function*(o,s,i){for(let a=0;a<o.length;a++){let c=t(o[a]),u=Qr(n,c);fe(u)?bi(n,c,[o[a]]):u.value.push(o[a])}for(let[a,c]of n){let u=Qr(i,a),f=de(u)?u.value:yield*ec(uk(s,a));yield*fk(s,a),yield*wa(f,c)}ry(n)}),r)})),Tz=(e,t,r)=>dk(e,me(function*(n,o,s){let i=yield*yb();yield*It(o,ss(i));let a=Si(),c=yield*$q({lookup:u=>Ti(io({capacity:r?.bufferSize??4096}).pipe(_t(f=>(bi(a,u,f),jn(i,[u,xh(f)])))),f=>(Ei(a,u),gd(f))),idleTimeToLive:r?.idleTimeToLive??Ss}).pipe(zo(s));return yield*xn({while:nr,body:qe(A(n,u=>t(u,c,a))),step:Rr}).pipe(rt(u=>Ht(i,u)),gt(o)),sf(i)})),use=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o,s,i=Qt(),a=r.pipe(A(u=>{for(let f=0;f<u.length;f++){let p=u[f],m=t(p);if(s===void 0){o=m,s=[p];continue}else if(Z(m,o)){s.push(p);continue}i.push([o,s]),o=m,s=[p]}if(Gr(i)){let f=i;return i=[],I(f)}return a})),c=!1;return ht(L(()=>c?se():a),()=>{c=!0;let u=s;return s=void 0,u&&Gr(u)?I(Me([o,u])):se()})}))),fse=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o,s,i=L(()=>{if(s!==void 0){let c=s;return s=void 0,I(c)}return r}).pipe(xu(c=>(o=Jn(c),se()))),a=K(L(()=>t.transform(i,n)),([c,u])=>(s=u,Me(c)));return L(()=>o||a)}))),lse=d(2,(e,t)=>Tk(e,t,Bp)),Tk=d(3,(e,t,r)=>U(Vs(me(function*(n,o,s){let i=yield*as(e.channel,o),a=jr(!1),c=Symbol(),u=yield*io({capacity:0});yield*i.pipe(a.whenOpen,A(S=>(a.closeUnsafe(),jn(u,S))),Mt,rt(S=>Ht(u,S)),gt(s));let f=yield*Yn,p=yield*Qa(r),m=jr(!1),h=f.currentTimeMillisUnsafe(),x=0,g=_(),y,E=S=>(m.openUnsafe()&&(x=f.currentTimeMillisUnsafe()),I(S)),b=m.await.pipe(A(()=>p(h,g)),A(([,S])=>ua(S)),A(()=>jn(u,c)),ht(()=>gd(u)),A(()=>Xn)),v=L(()=>{if(y!==void 0){let S=y;return y=void 0,E(S)}return u.state._tag==="Open"&&a.openUnsafe(),A(Ws(u),S=>S===c?se():E(S))}),T=A(([S,w])=>{if(m.isOpen())h+=f.currentTimeMillisUnsafe()-x;else if(u.state._tag==="Done")return se();return g=N(S),y=w,I(Me(S))});return L(()=>{if(u.state._tag==="Done"&&y===void 0)return u.state.exit;m.closeUnsafe();let S=T(L(()=>t.transform(v,s)));return u.state._tag==="Open"?Ya(S,b):S})})))),dse=d(2,me(function*(e,t){let r=Bt(t.n),n=yield*pse(t),o=new Array(r),s=yield*it;for(let i=0;i<r;i++){let a=yr(s),c=yield*fh(n).pipe(Jo(it,a));o[i]=ZA(mb(c)).pipe(ph(u=>Ve(a,u)),U)}return yield*ff(e.channel,i=>pb(n,i)).pipe(Xr(i=>db(n,i)),Rs),o})),pse=e=>Ti(e.capacity==="unbounded"?ch(e):e.strategy==="dropping"?fb(e):e.strategy==="sliding"?lb(e):ub(e),uh),wz=d(2,(e,t)=>K(Nz(e,t),tz)),mse=d(2,(e,t)=>K(Kq({acquire:wz(e,t),idleTimeToLive:t.idleTimeToLive}),r=>Cn(Vq(r)))),hse=d(2,(e,t)=>U(ek(e.channel,t))),xse=d(2,(e,t)=>U(tk(e.channel,t))),gse=d(2,(e,t)=>e.channel.pipe(tk(Uq(t)),BH(([r,n])=>n?wb(n):yd),U)),yse=e=>Nb(Fz(e)),Sse=e=>xf(e,Qt,(t,r)=>{let n=cp(t,r);return[n,[n]]}),vz=e=>Cz(e,Z),Cz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s;return A(r,function i(a){let c=[],u=0;for(o&&(o=!1,s=a[0],u=1,c.push(s));u<a.length;u++){let f=a[u];t(f,s)||(s=f,c.push(f))}return Gr(c)?I(c):A(r,i)})}))),bse=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s;return A(r,me(function*i(a){let c=[],u=0;for(o&&(o=!1,s=a[0],u=1,c.push(s));u<a.length;u++){let f=a[u];(yield*t(f,s))||(s=f,c.push(f))}return Gr(c)?c:yield*A(r,me(i))}))}))),Ese=d(e=>Ae(e[0]),(e,t)=>vn(()=>{let r=new TextDecoder(t?.encoding);return ao(e,n=>r.decode(n,{stream:!0}))})),Ise=e=>vn(()=>{let t=new TextEncoder;return ao(e,r=>t.encode(r))}),Tse=e=>e.channel.pipe(ek(mq()),U),Az=d(2,(e,t)=>nz(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let i=0;i<r.length;i++)i===s?o.push(r[i]):o.push(r[i],t);return o})),wse=d(2,(e,t)=>df(t.start).pipe(pf(Az(e,t.middle)),pf(df(t.end)))),vse=d(2,(e,t)=>kz(e,t,mf(W_([!0,!1])))),kz=d(3,(e,t,r)=>U(De(me(function*(n,o){let s=yield*we(wn(r.channel))(n,o),i=Symbol(),a=!1,c=!1,u=(yield*we(wn(e.channel))(n,o)).pipe(ht(()=>(a=!0,I(i)))),f=(yield*we(wn(t.channel))(n,o)).pipe(ht(()=>(c=!0,I(i))));return xt(function*(){for(;;){if(a&&c)return yield*se();let p=yield*s;if(p&&a||!p&&c)continue;let m=yield*p?u:f;if(m!==i)return Me(m)}})})))),Cse=d(2,(e,t)=>U(rk(e.channel,t))),Ase=d(2,(e,t)=>U(yq(e.channel,t))),Rz=d(2,(e,t)=>U(ph(e.channel,t))),kse=d(2,(e,t)=>U(Sq(e.channel,t))),Oz=d(2,(e,t)=>U(bq(e.channel,t))),_z=d(2,(e,t)=>U(nk(e.channel,r=>t(r[0])))),Rse=d(2,(e,t)=>U(Eq(e.channel,t))),bh=d(2,(e,t)=>U(Iq(e.channel,t))),Pz=d(e=>Ae(e[0]),(e,t,r)=>U(Tq(e.channel,t,r))),wk=d(2,(e,t)=>U(_b(e.channel,t))),Ose=d(3,(e,t,r)=>U(Pb(e.channel,t,r))),vk=d(3,(e,t,r)=>U(Mb(e.channel,t,r))),Mz=d(2,(e,t)=>U(wq(e.channel,t))),_se=d(3,(e,t,r)=>Mz(e,n=>We(n,t,r(Re(n,t))))),Pse=function(){let e=Ae(arguments[0]),t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return U(ok(n.channel,t,r))}return n=>U(ok(n.channel,t,r))},Mse=df({}),Fse=d(3,(e,t,r)=>ao(e,n=>({...n,[t]:r(n)})));var Nse=d(e=>Ae(e[0]),(e,t,r,n)=>Ed(e,o=>ao(r(o),s=>({...o,[t]:s})),n)),Use=d(e=>Ae(e[0]),(e,t,r,n)=>hf(e,o=>K(r(o),s=>({...o,[t]:s})),n)),Dse=d(2,(e,t)=>ao(e,r=>({[t]:r}))),Lse=d(2,(e,t)=>yl(r=>as(e.channel,r).pipe(A(n=>t.transform(n,r)),K(([n])=>n)))),Fz=e=>lf(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),Bse=e=>lf(e.channel,()=>0,(t,r)=>t+r.length),$se=e=>lf(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),jse=d(3,(e,t,r)=>lf(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),Hse=d(3,(e,t,r)=>Rq(e.channel,t,(n,o)=>{let s=0,i=n;return K(xn({while:()=>s<o.length,body:()=>r(i,o[s]),step(a){i=a,s++}}),()=>i)})),qse=e=>K(Aq(e.channel),Lt(X_(0))),zse=e=>K(kq(e.channel),Lt($f)),Wse=d(2,(e,t)=>ff(e.channel,r=>{let n=0;return xn({while:()=>n<r.length,body:()=>t(r[n++]),step:Rr})})),Kse=d(2,(e,t)=>Cq(e.channel,r=>{let n=!1,o=0;return K(xn({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),Id=d(2,(e,t)=>ff(e.channel,t)),Bb=e=>vq(e.channel),Ck=e=>ik(e.channel),Vse=e=>lf(e.channel,()=>"",(t,r)=>t+r.join("")),Gse=e=>K(sk(e.channel),t=>t.buffer),Jse=e=>sk(e.channel),Ak=d(e=>Ae(e[0]),(e,t,r)=>{let n,o,s=!1,i=jr(!1),a=r?.signal,c=()=>o.interruptUnsafe();return new ReadableStream({start(u){o=Qp(Ur(Id(e,f=>i.whenOpen(W(()=>{i.closeUnsafe();for(let p=0;p<f.length;p++)u.enqueue(f[p]);n(),n=void 0}))),t)),o.addObserver(f=>{a?.removeEventListener("abort",c),!s&&(f._tag==="Failure"&&a?.aborted!==!0?u.error(uu(f.cause)):u.close())}),a!==void 0&&o.pollUnsafe()===void 0&&(a.aborted?c():a.addEventListener("abort",c,{once:!0}))},pull(){return new Promise(u=>{n=u,i.openUnsafe()})},cancel(){if(o)return s=!0,ow(vo(Tn(o)))}},r?.strategy)}),Zse=d(e=>Ae(e[0]),(e,t)=>Ak(e,pt(),t)),kk=d(e=>Ae(e[0]),(e,t)=>K(Nr(),r=>Ak(e,r,t))),Rk=d(2,(e,t)=>({[Symbol.asyncIterator](){let r=sw(t),n=Sr(t),o=Zn(),s,i,a,c,u=p=>{if(c)return c;let m=a;return c=r(Pt(Vt(m?Tn(m):P,Ve(o,p)),{done:!0,value:void 0})),c},f=async p=>{try{await u(p)}catch(m){await r(Yp("Suppressed error while closing Stream async iterator",m))}};return{async next(){if(c)return c;if(i){let h=i.next();if(!h.done)return h;i=void 0}let p=n(s??A(as(e.channel,o),h=>(s=h,h)));a=p;let m=await r(Yj(p));if(a===p&&(a=void 0),ft(m))return i=m.value[Symbol.iterator](),i.next();if(wo(m.cause))return u(Kt);if(c&&a0(m.cause))return c;throw await f(m),uu(m.cause)},return(){return u(Kt)},async throw(p){throw await f(Ug(p)),p}}}})),Qse=e=>K(Nr(),t=>Rk(e,t)),Yse=e=>Rk(e,pt()),Xse=d(e=>Ae(e[0]),(e,t,r)=>ck(e.channel,t,r)),eie=d(2,(e,t)=>Pq(e.channel,t)),Nz=d(2,(e,t)=>Mq(e.channel,t)),tie=d(2,(e,t)=>Oq(e.channel,t)),rie=d(2,(e,t)=>ak(e.channel,t));var Uz="~effect/PrimaryKey";var Lz="~effect/Pool",Hz=Symbol(),qz=Symbol(),_k=Symbol();var zz=e=>Kz({...e,min:e.size,max:e.size,strategy:jb}),Wz=e=>A(e.timeToLiveStrategy==="creation"?lie(e.timeToLive):die(e.timeToLive),t=>Kz({...e,strategy:t})),Kz=e=>en(me(function*(t){let r=yield*Nr(),n=Re(r,it),o=Xa(e.acquire,u=>Kr(r,u)),s=e.concurrency??1,i={acquire:o,concurrency:s,isFixed:e.min===e.max,minSize:e.min,maxSize:e.max,strategy:e.strategy,targetUtilization:Math.min(Math.max(e.targetUtilization??1,.1),1)},a={scope:n,isShuttingDown:!1,usage:0,resizeSemaphore:cf(1),items:new Set,availableHead:void 0,availableTail:void 0,invalidated:new Set,waiters:new Set},c={[Lz]:Lz,[Hz]:e.acquire,[qz]:r,[_k]:yield*Yn,config:i,state:a,pipe(){return V(this,arguments)}};return yield*It(n,nie(c)),i.minSize>0&&(yield*_t(El(t($b(c)),{startImmediately:!0}),u=>It(n,Tn(u)))),e.strategy!==jb&&(yield*_t(El(t(e.strategy.run(c))),u=>It(n,Tn(u)))),c})),nie=me(function*(e){if(e.state.isShuttingDown)return;e.state.isShuttingDown=!0;let t=e.state.items.size,r=cf(t);for(let n of e.state.items)n.refCount>0?(n.finalizer=_t(n.finalizer,r.release(1)),e.state.invalidated.add(n),yield*r.take(1)):(e.state.items.delete(n),Eh(e,n),e.state.invalidated.delete(n),yield*n.finalizer);if(e.state.waiters.size>0){let n=Array.from(e.state.waiters);e.state.waiters.clear();for(let o of n)o()}yield*r.take(t)}),Pk=e=>oe(t=>{let r=e.state;if(r.isShuttingDown)return rl;if(r.availableHead?.exit._tag==="Success"){if(r.usage++,e.config.isFixed||Ih(e)<=Th(e))return Vz(e,r.availableHead,t);r.usage--}return oie(e,aie)});var oie=(e,t)=>Gn(r=>{let n=e.state;n.usage++;let o=Y(Ip(r(uie(e)),()=>ye(()=>{n.usage--})),()=>i),s=oe(a=>{if(n.isShuttingDown)return n.usage--,rl;let c=Mk(e)??(Ih(e)<=Th(e)?n.availableHead:void 0);return c===void 0?o:c.exit._tag==="Failure"?(iie(e,c),i):t(e,c,a,r)}),i=ce(()=>n.isShuttingDown?(n.usage--,rl):Ih(e)>Th(e)?Y(n.resizeSemaphore.withPermitsIfAvailable(1)(gt(vi($b(e)),n.scope)),()=>s):s);return i}),sie=(e,t)=>{t.refCount++,t.refCount>=e.config.concurrency&&Eh(e,t)},iie=(e,t)=>{e.state.items.delete(t),e.state.invalidated.delete(t),Eh(e,t)},Vz=(e,t,r)=>{sie(e,t);let n=dn(r.context,it);return n.state._tag==="Closed"?Wa(r,t.release):za(n,{},t.release),t.exit},aie=(e,t,r)=>Vz(e,t,r),cie=(e,t)=>oe(r=>{let n=e.state;return t.refCount--,n.usage--,t.refCount===0&&(t.idleSince=e[_k].currentTimeMillisUnsafe()),n.invalidated.has(t)?Nk(e,t):(t.refCount<e.config.concurrency&&(fie(e,t),Gz(e,r,1)),pe)}),Mk=e=>{let t=e.state.availableHead;for(;t!==void 0&&t.exit._tag==="Failure";)t=t.availableNext;return t},uie=e=>$t(t=>{let r=e.state;if(Mk(e)!==void 0||r.isShuttingDown)return t(pe);let n=o=>{r.waiters.delete(n),t(o??pe)};return r.waiters.add(n),ye(()=>{r.waiters.delete(n)})}),Gz=(e,t,r)=>{let n=e.state.waiters;n.size!==0&&t.currentDispatcher.scheduleTask(()=>{let o=r,s=[];for(let i of n){if(o--<=0)break;s.push(i)}for(let i=0;i<s.length;i++)s[i]()},0)},Bz=e=>oe(t=>(Gz(e,t,Number.POSITIVE_INFINITY),pe)),Fk=new WeakMap,$z=(e,t)=>{t.isAvailable||Fk.has(t)||(t.isAvailable=!0,t.availablePrevious=e.state.availableTail,t.availableNext=void 0,e.state.availableTail!==void 0?e.state.availableTail.availableNext=t:e.state.availableHead=t,e.state.availableTail=t)},fie=(e,t)=>{t.isAvailable||Fk.has(t)||(t.isAvailable=!0,t.availablePrevious=void 0,t.availableNext=e.state.availableHead,e.state.availableHead!==void 0?e.state.availableHead.availablePrevious=t:e.state.availableTail=t,e.state.availableHead=t)},Eh=(e,t)=>{t.isAvailable&&(t.isAvailable=!1,t.availablePrevious!==void 0?t.availablePrevious.availableNext=t.availableNext:e.state.availableHead=t.availableNext,t.availableNext!==void 0?t.availableNext.availablePrevious=t.availablePrevious:e.state.availableTail=t.availablePrevious,t.availablePrevious=void 0,t.availableNext=void 0)};var Nk=(e,t)=>L(()=>{if(e.state.items.has(t)){if(t.refCount===0)return e.state.items.delete(t),Eh(e,t),e.state.invalidated.delete(t),vo(A(t.finalizer,()=>gt(vi($b(e)),e.state.scope,{startImmediately:!0})))}else return P;return e.state.invalidated.add(t),Eh(e,t),vo(gt(vi($b(e)),e.state.scope,{startImmediately:!0}))}),$b=e=>e.state.resizeSemaphore.withPermits(1)(Ok(e)),Ok=e=>L(()=>{let t=Th(e),r=Ih(e);if(t>=r)return P;let n=r-t,o=e.config.strategy===jb?jz(e):A(e.config.strategy.reclaim(e),i=>i?I(i):jz(e));if(n===1){let i=_t(o,Bz(e));return e.config.isFixed?vo(i):A(i,a=>a.exit._tag==="Failure"?P:Ok(e))}let s=o.pipe(ew(n,{concurrency:n}),_t(Bz(e)));return e.config.isFixed?vo(s):A(s,i=>i.some(a=>a.exit._tag==="Failure")?P:Ok(e))}),jz=e=>Gn(t=>oe(r=>{let n=e,o=el(),s=r.context;r.setContext(We(n[qz],it,o));let i=A(eo(n[Hz]),a=>{let c={exit:a,finalizer:rt(Ve(o,a),pie),refCount:0,idleSince:n[_k].currentTimeMillisUnsafe(),disableReclaim:!1,isAvailable:!1,availablePrevious:void 0,availableNext:void 0,release:void 0};c.release=qe(cie(e,c));let u=L(()=>e.state.items.has(c)?e.config.strategy.onAcquire(c):P);if(a._tag==="Success")return e.state.items.add(c),$z(e,c),e.config.strategy===jb?I(c):Pt(u,c);let f=Mk(e)===void 0?e.state.waiters.values().next().value:void 0;return f!==void 0?f(a):(e.state.items.add(c),$z(e,c)),Pt(gt(Vt(c.finalizer,u),e.state.scope,{startImmediately:!0}),c)});return Io(t(i),a=>(r.setContext(s),a._tag==="Failure"?Xf(o,a):void 0),!0)})),Ih=e=>{if(e.state.isShuttingDown)return 0;if(e.config.isFixed)return e.config.minSize;let t=e.state.usage/e.config.targetUtilization,r=Math.ceil(t/e.config.concurrency);return Math.min(Math.max(e.config.minSize,r),e.config.maxSize)},Th=e=>e.state.items.size-e.state.invalidated.size,jb={run:e=>P,onAcquire:e=>P,reclaim:e=>Wp},lie=me(function*(e){let t=yield*Yn,r=yield*yb(),n=Wt($e(e)),o=new WeakMap;return F({run:s=>{let i=a=>L(()=>{if(!s.state.items.has(a)||s.state.invalidated.has(a))return P;let c=t.currentTimeMillisUnsafe(),u=o.get(a),f=n-(c-u);return f>0?ca(i(a),f):Nk(s,a)});return Ws(r).pipe(_t(i),Mt({disableYield:!0}))},onAcquire:s=>L(()=>(o.set(s,t.currentTimeMillisUnsafe()),jn(r,s))),reclaim:s=>Wp})}),die=me(function*(e){let t=yield*Yn,r=Wt($e(e));return F({run:n=>{let o=L(()=>{if(Th(n)<=Ih(n))return P;let s=t.currentTimeMillisUnsafe()-r,i;for(let a of n.state.items)a.refCount>0||a.idleSince>s||n.state.invalidated.has(a)||Fk.has(a)||(i===void 0||a.idleSince<i.idleSince)&&(i=a);return i===void 0?P:A(Nk(n,i),()=>o)});return o.pipe(ca(e),Mt({disableYield:!0}))},onAcquire:n=>P,reclaim:n=>Wp})}),pie=e=>ar(t=>{let r=t.getRef(RN);return r?Il(r)("Unhandled error in pool finalizer",e):P});var Zz="~effect/reactivity/Reactivity",vc=Ue("effect/reactivity/Reactivity"),mie=W(()=>{let e=new Map,t=c=>{Uk(c,u=>{let f=e.get(u);f!==void 0&&f.forEach(p=>p())})},r=c=>yn(u=>{let f=Vi(u,Hb);return f?Uk(c,p=>{f.add(p)}):t(c),P}),n=(c,u)=>_t(u,r(c)),o=(c,u)=>{let f=[];return Uk(c,p=>{f.push(p);let m=e.get(p);m===void 0&&(m=new Set,e.set(p,m)),m.add(u)}),()=>{for(let p=0;p<f.length;p++){let m=e.get(f[p]);m!==void 0&&(m.delete(u),m.size===0&&e.delete(f[p]))}}},s=(c,u)=>xt(function*(){let f=yield*Nr(),p=Re(f,it),m=yield*io(),h=Bc(Sr(f),Ni(p)),x=!1,g=!1,y=v=>{v._tag==="Failure"?Ui(m,v.cause):Ic(m,v.value),g?(g=!1,h(u).addObserver(y)):x=!1};function E(){if(x){g=!0;return}x=!0,h(u).addObserver(y)}let b=o(c,E);return yield*It(p,W(b)),E(),m}),i=(c,u)=>s(c,u).pipe(K(yh),Cn),a=c=>L(()=>{let u=new Set;return c.pipe(Jo(Hb,u),Xr(f=>W(()=>{u.forEach(p=>{let m=e.get(p);m!==void 0&&m.forEach(h=>h())})})))});return vc.of({[Zz]:Zz,mutation:n,query:s,stream:i,invalidateUnsafe:t,invalidate:r,registerUnsafe:o,withBatch:a})}),Hb=class extends Ue()("effect/reactivity/Reactivity/PendingInvalidation"){},qb=d(2,(e,t)=>vc.use(r=>r.mutation(t,e)));var zb=e=>vc.use(t=>t.invalidate(e)),Wb=Qn(vc)(mie);function Qz(e){switch(typeof e){case"string":case"number":case"bigint":case"boolean":return String(e);default:return G(e)}}var Uk=(e,t)=>{if(Array.isArray(e)){for(let r=0;r<e.length;r++)t(Qz(e[r]));return}for(let r in e){t(r);let n=e[r];for(let o=0;o<n.length;o++)t(`${r}:${Qz(n[o])}`)}};var Yz="~effect/SubscriptionRef",wh=e=>O(e,Yz),_ye={...wr,[Yz]:{_A:F},toJSON(){return{_id:"SubscriptionRef",value:this.value}}};var Dk=e=>pk(e.pubsub);var Xz=e=>W(()=>e.value);var hie=(e,t)=>{e.value=t,iH(e.pubsub,t)};var Lk=d(2,(e,t)=>e.semaphore.withPermit(W(()=>hie(e,t))));var sE={};ps(sE,{Fetch:()=>CW,RequestInit:()=>oE,layer:()=>Die});var Bk="~effect/http/HttpBody";var tW="~effect/http/HttpBody/HttpBodyError",rW=class extends sr("HttpBodyError"){[tW]=tW};var Vb=class{[Bk];constructor(){this[Bk]=Bk}[Qe](){return this.toJSON()}toString(){return H(this,{ignoreToString:!0})}},$k=class extends Vb{_tag="Empty";toJSON(){return{_id:"effect/HttpBody",_tag:"Empty"}}},nW=new $k;var vh=class extends Vb{_tag="Uint8Array";contentType;contentLength;text;_body;constructor(t,r,n,o){super(),this._body=t,this.text=o,this.contentType=r,this.contentLength=n}get body(){return this._body??=xie(this.text)}toJSON(){return{_id:"effect/HttpBody",_tag:"Uint8Array",body:this.contentType.startsWith("text/")||this.contentType.endsWith("json")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},jk=(e,t)=>new vh(e,t??"application/octet-stream",e.length),oW=new TextEncoder,Gb=globalThis.Buffer,xie=Gb!==void 0?e=>Gb.from(e,"utf8"):e=>oW.encode(e),Hk=(e,t)=>{if(typeof e!="string"&&(e=e===void 0?"":String(e)),Gb!==void 0)return new vh(void 0,t??"text/plain",Gb.byteLength(e,"utf8"),e);let r=oW.encode(e);return new vh(r,t??"text/plain",r.length,e)};var zk="~effect/http/HttpClientError";var co=class extends sr("HttpClientError"){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[zk]=zk;get request(){return this.reason.request}get response(){return"response"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},Ah=e=>e.endsWith("Error")?e.slice(0,-5):e,kh=(e,t,r)=>t?`${e}: ${t} (${r})`:`${e} error (${r})`,Jb=class extends sr("TransportError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return kh(Ah(this._tag),this.description,this.methodAndUrl)}};var Zb=class extends sr("InvalidUrlError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return kh(Ah(this._tag),this.description,this.methodAndUrl)}},Ch=class extends sr("StatusCodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return kh(Ah(this._tag),this.description,t)}},Cc=class extends sr("DecodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return kh(Ah(this._tag),this.description,t)}},Qb=class extends sr("EmptyBodyError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return kh(Ah(this._tag),this.description,t)}},Td=class e extends Ar(zk)({_tag:He("HttpError"),kind:Fo(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:lr(er())}){static fromHttpClientError(t){return new e({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}};var sW=[["GET","get"],["POST","post"],["PUT","put"],["DELETE","del"],["PATCH","patch"],["HEAD","head"],["OPTIONS","options"],["TRACE","trace"],["QUERY","query"]];var aW=(e,t)=>t._tag==="Empty"||t._tag==="FormData"?oc(oc(e,"content-type"),"content-length"):(e=t.contentType===void 0?oc(e,"content-type"):um(e,"content-type",t.contentType),t.contentLength===void 0?oc(e,"content-length"):um(e,"content-length",t.contentLength.toString()));var Xb=class extends sr("UrlError"){},eE=(e,t,r)=>Nx({try:()=>{let n=new URL(e,yie());for(let o=0;o<t.params.length;o++){let[s,i]=t.params[o];i!==void 0&&n.searchParams.append(s,i)}return r!==void 0&&(n.hash=r),n},catch:n=>new Xb({cause:n})}),yie=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var cW="~effect/http/HttpClientRequest";var Sie={[cW]:cW,...Ot,toJSON(){return{_id:"HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ho(this.headers),body:this.body.toJSON()}},pipe(){return V(this,arguments)}};function Bi(e,t,r,n,o,s){let i=Object.create(Sie);return i.method=e,i.url=t,i.urlParams=r,i.hash=n,i.headers=o,i.body=s,i}var bie=Bi("GET","",s1,_(),Al,nW),uW=e=>(t,r)=>Eie(bie,{method:e,url:t,...r??void 0});var Eie=d(2,(e,t)=>{let r=e;return t.method&&(r=fW(r,t.method)),t.url&&(r=pW(r,t.url)),t.headers&&(r=Kk(r,t.headers)),t.urlParams&&(r=wie(r,t.urlParams)),t.hash&&(r=vie(r,t.hash)),t.body&&(r=hW(r,t.body)),t.accept&&(r=dW(r,t.accept)),t.acceptJson&&(r=Iie(r)),r}),fW=d(2,(e,t)=>Bi(t,e.url,e.urlParams,e.hash,e.headers,e.body)),lW=d(3,(e,t,r)=>Bi(e.method,e.url,e.urlParams,e.hash,um(e.headers,t,r),e.body)),Kk=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,e.hash,r1(e.headers,t),e.body));var dW=d(2,(e,t)=>lW(e,"Accept",t)),Iie=dW("application/json"),pW=d(2,(e,t)=>{if(typeof t=="string")return Bi(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),n=Pu(r.searchParams),o=Yc(r.hash===""?void 0:r.hash.slice(1));return r.search="",r.hash="",Bi(e.method,r.toString(),n,o,e.headers,e.body)}),mW=d(2,(e,t)=>t===""?e:Bi(e.method,Tie(t,e.url),e.urlParams,e.hash,e.headers,e.body));var Tie=(e,t)=>{let r=e.endsWith("/"),n=t.startsWith("/");return r&&n?e+t.slice(1):!r&&!n?e+"/"+t:e+t};var wie=d(2,(e,t)=>Bi(e.method,e.url,a1(e.urlParams,t),e.hash,e.headers,e.body));var vie=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,N(t),e.headers,e.body));var hW=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,e.hash,aW(e.headers,t),t));function xW(e){let t=eE(e.url,e.urlParams,_n(e.hash));return tt(t)?N(t.success):_()}var gf="~effect/http/HttpIncomingMessage";var gW=(e,t)=>{let r=e.headers["content-type"]??"",n;if(r.includes("application/json"))try{n=Ai(e.json)}catch{}else if(r.includes("text/")||r.includes("urlencoded"))try{n=Ai(e.text)}catch{}let o={...t,headers:ho(e.headers),remoteAddress:e.remoteAddress};return n!==void 0&&(o.body=n),o};var wd="~effect/http/HttpClientResponse",yW=(e,t)=>new Gk(e,t);var Gk=class extends Sx{[gf];[wd];request;source;constructor(t,r){super(),this.request=t,this.source=r,this[gf]=gf,this[wd]=wd}toJSON(){return gW(this,{_id:"HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split("#")[0];let t=xW(this.request);return fe(t)?"":(t.value.hash="",t.value.href)}get headers(){return Zo(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=Py(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return _()}get stream(){return this.source.body?mk({evaluate:()=>this.source.body,onError:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}):wc(new co({reason:new Qb({request:this.request,response:this,description:"can not create stream from empty body"})}))}get json(){return A(this.text,t=>Go({try:()=>t===""?null:JSON.parse(t),catch:r=>new co({reason:new Cc({request:this.request,response:this,cause:r})})}))}textBody;get text(){return this.textBody??=K(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return A(this.text,t=>Go({try:()=>Pu(new URLSearchParams(t)),catch:r=>new co({reason:new Cc({request:this.request,response:this,cause:r})})}))}formDataBody;get formData(){return this.formDataBody??=Vo({try:()=>this.source.formData(),catch:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}).pipe(fy,Ai)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=Vo({try:()=>this.source.arrayBuffer(),catch:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}).pipe(fy,Ai),this.arrayBufferBody)}pipe(){return V(this,arguments)}};var SW=e=>t1({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${Zt(e.parent,{onNone:()=>"",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?"01":"00"}`});var Cie={"http:":80,"https:":443,"ws:":80,"wss:":443},EW=(e,t)=>{let r=t.search.slice(1);if(e.attribute("url.full",t.toString()),e.attribute("url.path",t.pathname),r!==""&&e.attribute("url.query",r),e.attribute("url.scheme",t.protocol.slice(0,-1)),t.hostname!==""){e.attribute("server.address",t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname);let n=t.port===""?Cie[t.protocol]:Number(t.port);n!==void 0&&e.attribute("server.port",n)}},Zk=(e,t,r,n,o)=>{for(let s in r)n(s,t)&&e.attribute(`http.${t}.header.${s}`,n1(s,o)?"<redacted>":r[s])};var IW="~effect/http/HttpClient";var Qk=Ue("effect/HttpClient");var kie=d(2,(e,t)=>Yk(r=>t(e.postprocess(r)),e.preprocess));var Yk=(e,t)=>{let r=Object.create(Rie);return r.preprocess=t,r.postprocess=e,r.execute=function(n){return e(t(n))},r},Rie={[IW]:IW,pipe(){return V(this,arguments)},...Ot,toJSON(){return{_id:"effect/HttpClient"}},...Object.fromEntries(sW.map(([e,t])=>[t,function(r,n){return this.execute(uW(e)(r,n))}]))},TW=e=>Yk(t=>A(t,r=>ar(n=>{let o=Nie.get(r),s=o??new AbortController,i=eE(r.url,r.urlParams,_n(r.hash));if(be(i))return D(new co({reason:new Zb({request:r,cause:i.failure})}));let a=i.success;if(n.getRef(Hf)||n.getRef(_ie)(r)){let u=e(r,a,s.signal,n);return o?u:en(f=>Un(f(u),{onSuccess(p){return rE.register(p,s),I(new nE(p,s))},onFailure(p){return ul(p)&&s.abort(),je(p)}}))}return Zp(n.getRef(Fie)(r),{kind:"client"},u=>{u.attribute("http.request.method",r.method);let f=n.getRef(Ww);EW(u,a);let p=n.getRef(Pie);return Zk(u,"request",r.headers,p,f),r=n.getRef(Mie)?Kk(r,SW(u)):r,en(m=>m(e(r,a,s.signal,n)).pipe(Sl(u,{captureStackTrace:!1}),Un({onSuccess:h=>(u.attribute("http.response.status_code",h.status),Zk(u,"response",h.headers,p,f),h.status>=400&&h.status<600&&(u.attribute("error.type",String(h.status)),Oie(n,u,r,h)),o?I(h):(rE.register(h,s),I(new nE(h,s)))),onFailure(h){return!o&&ul(h)&&s.abort(),je(h)}})))})})),I),Oie=(e,t,r,n)=>{let o=Ir();yt(0);let s;try{s=Jn(new co({reason:new Ch({request:r,response:n})}))}finally{yt(o)}t.end(e.getRef($g)?e.getRef(Yn).currentTimeNanosUnsafe():BigInt(0),s)},wW=d(2,(e,t)=>Yk(e.postprocess,r=>K(e.preprocess(r),t)));var _ie=Ce("effect/http/HttpClient/TracerDisabledWhen",{defaultValue:()=>Oa}),Pie=Ce("effect/http/HttpClient/TracerHeaderFilter",{defaultValue:()=>Oa}),Mie=Ce("effect/http/HttpClient/TracerPropagationEnabled",{defaultValue:nr}),Fie=Ce("effect/http/HttpClient/SpanNameGenerator",{defaultValue:()=>e=>e.method}),vW=e=>Qn(Qk)(yn(t=>K(e,r=>kie(r,Xa(n=>Kr(t,n)))))),rE=(()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(r=>{r.abort()});return{register(r,n){t.register(r,n,r)},unregister(r){t.unregister(r)}}}let e=new WeakMap;return{register(t,r){e.set(t,setTimeout(()=>r.abort(),5e3))},unregister(t){let r=e.get(t);r!==void 0&&(clearTimeout(r),e.delete(t))}}})(),Nie=new WeakMap,nE=class{original;controller;constructor(t,r){this.original=t,this.controller=r}[wd]=wd;[gf]=gf;applyInterrupt(t){return L(()=>(rE.unregister(this.original),yu(t,()=>W(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return vn(()=>(rE.unregister(this.original),bh(this.original.stream,W(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Qe](){return this.original[Qe]()}pipe(){return V(this,arguments)}};var CW=Ce("effect/http/FetchHttpClient/Fetch",{defaultValue:()=>globalThis.fetch}),oE=class extends Ue()("effect/http/FetchHttpClient/RequestInit"){},Uie=TW((e,t,r,n)=>{let o=n.getRef(CW),s=Vi(n.context,oE)??{},i=s.headers?kl(Zo(s.headers),e.headers):e.headers;i["content-length"]&&(i=oc(i,"content-length"));let a=c=>K(Vo({try:()=>o(t,{...s,method:e.method,headers:i,body:c,duplex:typeof ReadableStream<"u"&&c instanceof ReadableStream?"half":void 0,signal:r}),catch:u=>new co({reason:new Jb({request:e,cause:u})})}),u=>yW(e,u));switch(e.body._tag){case"Raw":case"Uint8Array":return a(e.body.body);case"FormData":return a(e.body.formData);case"Stream":return A(kk(e.body.stream),a)}return a(void 0)}),Die=vW(I(Uie));var kW=Ue("effect/socket/Socket");var eR="~effect/socket/Socket/CloseEvent",AW=class{[eR];code;reason;constructor(t=1e3,r){this[eR]=eR,this.code=t,this.reason=r}toString(){return this.reason?`${this.code}: ${this.reason}`:`${this.code}`}};var iE="~effect/socket/Socket/SocketError",Lie=e=>O(e,iE),Rh=class extends Ar("effect/socket/Socket/SocketReadError")({_tag:He("SocketReadError"),cause:er()}){message="An error occurred during Read"},tR=class extends Ar("effect/socket/Socket/SocketWriteError")({_tag:He("SocketWriteError"),cause:er()}){message="An error occurred during Write"},rR=class extends Ar("effect/socket/Socket/SocketOpenError")({_tag:He("SocketOpenError"),kind:Fo(["Unknown","Timeout"]),cause:er()}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}},nR=class e extends Ar("effect/socket/Socket/SocketUpgradeError")({_tag:He("SocketUpgradeError"),cause:lr(er())}){static unsupported=()=>D(new Oh({reason:new e({})}));get message(){return this.cause===void 0?"Socket does not support TLS upgrade":"An error occurred during TLS upgrade"}},oR=class extends Ar("effect/socket/Socket/SocketCloseError")({_tag:He("SocketCloseError"),code:In,closeReason:lr(z)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},sR=Pe([Rh,tR,rR,nR,oR]),Oh=class extends EA(iE)("SocketError",{_tag:He("SocketError"),reason:sR}){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[iE]=iE;static is(t){return Lie(t)}message=this.reason.message};var xbe=64*1024;var RW="~effect/reactivity/AsyncResult",aR=e=>O(e,RW),aE={[RW]:{E:F,A:F},pipe(){return V(this,arguments)},[ae](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case"Initial":return!0;case"Success":return Z(this.value,e.value);case"Failure":return Z(this.cause,e.cause)}},[ie](){let e=Be(`${this._tag}:${this.waiting}`);return this._tag==="Initial"?e:he(e)(this._tag==="Success"?G(this.value):G(this.cause))}};var cR=(e,t)=>e._tag==="Success"?us(e.value):Cd(e.cause,{previous:t}),cE=e=>e._tag==="None"?Ca(!0):_h(e.value);var OW=e=>e._tag!=="Initial",Ca=(e=!1)=>{let t=Object.create(aE);return t._tag="Initial",t.waiting=e,t},vd=e=>e._tag==="Success",us=(e,t)=>{let r=Object.create(aE);return r._tag="Success",r.value=e,r.waiting=t?.waiting??!1,r.timestamp=t?.timestamp??Date.now(),r},_W=e=>e._tag==="Failure";var iR=(e,t)=>{let r=Object.create(aE);return r._tag="Failure",r.cause=e,r.previousSuccess=t?.previousSuccess??_(),r.waiting=t?.waiting??!1,r},Cd=(e,t)=>iR(e,{previousSuccess:gs(t.previous,r=>vd(r)?N(r):_W(r)?r.previousSuccess:_()),waiting:t.waiting});var PW=(e,t)=>Cd(hN(e),t),_h=d(e=>aR(e[0]),(e,t)=>{if(e.waiting)return t?.touch?$ie(e):e;let r=Object.assign(Object.create(aE),e);return r.waiting=!0,t?.touch&&vd(r)&&(r.timestamp=Date.now()),r}),$ie=e=>vd(e)?us(e.value,{waiting:e.waiting}):e,Ph=d(2,(e,t)=>e._tag==="Failure"?Cd(e.cause,{previous:t,waiting:e.waiting}):e),uR=e=>e._tag==="Success"?N(e.value):e._tag==="Failure"?Lt(e.previousSuccess,t=>t.value):_();var fR=e=>Lf(uR(e),()=>new fl("AsyncResult.getOrThrow: no value found"));var Ad=e=>{switch(e._tag){case"Success":return Mr(e.value);case"Failure":return ir(e.cause);default:return Jn(new fl)}};var lR=e=>{let t=e.success??Mi,r=e.error??Mi,n=Cr()([t,Gm(r,er())],([o,s])=>(i,a,c)=>{if(!aR(i))return D(new at(a,i,c));switch(i._tag){case"Initial":return I(i);case"Success":return cr(ot(o)(i.value,c),{onSuccess:u=>us(u,i),onFailure:u=>tn(a,"value",u,i,c)});case"Failure":{let u=i.previousSuccess.pipe(Lt(p=>cr(ot(o)(p.value,c),{onSuccess:m=>N(us(m,p)),onFailure:m=>new Ft(a,[new At(["previousSuccess","value"],m)],i,c)})),Ma(()=>ia)),f=Eu(ot(s)(i.cause,c),p=>tn(a,"cause",p,i,c));return ur(u,p=>bu(f,m=>iR(m,{previousSuccess:p,waiting:i.waiting})))}}},{expected:"AsyncResult",toCodec([o,s]){let i=ya("Success",{value:o,waiting:Fi,timestamp:In});return Ne()(Pe([ya("Initial",{waiting:Fi}),i,ya("Failure",{cause:s,previousSuccess:ba(i),waiting:Fi})]),Fe({decode:a=>{switch(a._tag){case"Initial":return Ca(a.waiting);case"Success":return us(a.value,{waiting:a.waiting,timestamp:a.timestamp});case"Failure":return iR(a.cause,{previousSuccess:Lt(a.previousSuccess,c=>us(c.value,c)),waiting:a.waiting})}},encode(a){switch(a._tag){case"Initial":return{_tag:"Initial",waiting:a.waiting};case"Success":return{_tag:"Success",value:a.value,waiting:a.waiting,timestamp:a.timestamp};case"Failure":return{_tag:"Failure",cause:a.cause,previousSuccess:a.previousSuccess,waiting:a.waiting}}}}))},toEquivalence:zd,toFormatter:([o,s])=>i=>{switch(i._tag){case"Success":return`AsyncResult.Success(${o(i.value)}, ${i.waiting}, ${i.timestamp})`;case"Failure":return`AsyncResult.Failure(${s(i.cause)}, ${i.waiting})`;case"Initial":return`AsyncResult.Initial(${i.waiting}, ${i.waiting})`}}});return Object.assign(n,{success:t,error:r})};var Fh="~effect/reactivity/AtomRegistry",jie=e=>O(e,Fh),MW=e=>new mR(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),uE=Ue(Fh);var Uh=d(e=>jie(e[0]),(e,t,r)=>{let n=r?.suspendOnWaiting??!1;return Nn(o=>{let s=e.get(t);if(s._tag!=="Initial"&&!(n&&s.waiting))return o(Ad(s));let i=e.subscribe(t,a=>{a._tag!=="Initial"&&!(n&&a.waiting)&&(o(Ad(a)),i())});return W(i)})});var Hie={immediate:!0},FW=e=>{e()},An={};function Nh(e,t){let r=An;for(let n of e)try{t(n)}catch(o){r===An&&(r=o)}if(r!==An)throw r}var pR="~effect-atom/atom/Atom/Serializable",Mh=e=>pR in e?e[pR].key:e,mR=class{[Fh];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(t,r,n,o){if(this[Fh]=Fh,this.scheduler=new fi("sync",r),this.schedulerAsync=new fi("async",r),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=o,n===void 0&&o!==void 0?this.timeoutResolution=Math.round(o/2):this.timeoutResolution=n??1e3,t!==void 0)for(let[s,i]of t){let a=s;for(;a.initialValueTarget;)a=a.initialValueTarget;this.ensureNode(a).setInitialValue(i)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(t){return this.ensureNode(t).value()}set(t,r){t.write(this.ensureNode(t).writeContext,r)}setSerializable(t,r){this.preloadedSerializable.set(t,r)}modify(t,r){let n=this.ensureNode(t),o=r(n.value());return t.write(n.writeContext,o[1]),o[0]}update(t,r){let n=this.ensureNode(t);t.write(n.writeContext,r(n.value()))}refresh=t=>{t.refresh!==void 0?t.refresh(this.refresh):this.invalidateAtom(t)};subscribe(t,r,n){let o=this.ensureNode(t);n?.immediate?r(o.value()):o.state===an.stale&&o.value();let s=o.subscribe(function(){r(o._value)});return()=>{s(),o.canBeRemoved&&this.scheduleNodeRemoval(o)}}mount(t){return this.subscribe(t,Rr,Hie)}atomHasTtl(t){return!t.keepAlive&&t.idleTTL!==0&&(t.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(t){let r=Mh(t),n=this.nodes.get(r);if(n===void 0?(n=this.createNode(t),this.nodes.set(r,n),this.onNodeAdded?.(n)):this.atomHasTtl(t)&&this.removeNodeTimeout(n),typeof r=="string"&&this.preloadedSerializable.has(r)){let o=this.preloadedSerializable.get(r);this.preloadedSerializable.delete(r);let s=t[pR].decode(o),i=t;for(;i.initialValueTarget;)i=i.initialValueTarget;i===t?n.setValue(s):this.ensureNode(i).setInitialValue(s)}return n}createNode(t){if(this.disposed)throw new Error(`Cannot access Atom ${t}: registry is disposed`);return t.keepAlive||this.scheduleAtomRemoval(t),new hR(this,t)}invalidateAtom=t=>{this.ensureNode(t).invalidate()};scheduleAtomRemoval(t){this.dispatcher.scheduleTask(()=>{let r=this.nodes.get(Mh(t));r!==void 0&&r.canBeRemoved&&this.removeNode(r)},0)}scheduleNodeRemoval(t){this.dispatcher.scheduleTask(()=>{t.canBeRemoved&&this.removeNode(t)},0)}removeNode(t){this.atomHasTtl(t.atom)?this.setNodeTimeout(t):(this.nodes.delete(Mh(t.atom)),t.remove(),this.onNodeRemoved?.(t))}setNodeTimeout(t){if(this.nodeTimeoutBucket.has(t))return;let r=t.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(r-=this.#e,r<=0)){this.nodes.delete(Mh(t.atom)),t.remove(),this.onNodeRemoved?.(t);return}let n=Math.ceil(r/this.timeoutResolution)*this.timeoutResolution,o=Date.now()+n,s=o-o%this.timeoutResolution+this.timeoutResolution,i=this.timeoutBuckets.get(s);i===void 0&&(i=[new Set,setTimeout(()=>this.sweepBucket(s),s-Date.now())],this.timeoutBuckets.set(s,i)),i[0].add(t),this.nodeTimeoutBucket.set(t,s)}removeNodeTimeout(t){let r=this.nodeTimeoutBucket.get(t);if(r===void 0)return;this.nodeTimeoutBucket.delete(t),this.scheduleNodeRemoval(t);let[n,o]=this.timeoutBuckets.get(r);n.delete(t),n.size===0&&(clearTimeout(o),this.timeoutBuckets.delete(r))}#e=null;sweepBucket(t){let r=this.timeoutBuckets.get(t)[0];this.timeoutBuckets.delete(t),Nh(r,this.removeIdleNode)}removeIdleNode=t=>{if(this.nodeTimeoutBucket.delete(t),!!t.canBeRemoved){this.nodes.delete(Mh(t.atom)),this.onNodeRemoved?.(t),this.#e=t.atom.idleTTL??this.defaultIdleTTL;try{t.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,r])=>clearTimeout(r)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let t=Array.from(this.nodes.values());this.nodes.clear();for(let r of t)r.state=an.removed;Nh(t,this.destroyNode)}destroyNode=t=>{t.remove(),this.onNodeRemoved?.(t)};dispose(){this.disposed=!0,this.reset()}},fs={alive:1,initialized:2,waitingForValue:4},an={uninitialized:fs.alive|fs.waitingForValue,stale:fs.alive|fs.initialized|fs.waitingForValue,valid:fs.alive|fs.initialized,removed:0},hR=class{constructor(t,r){this.registry=t,this.atom=r,this.writeContext=new xR(t,this)}registry;atom;state=an.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case an.uninitialized:return"uninitialized";case an.stale:return"stale";case an.valid:return"valid";default:return"removed"}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(t){let r=this.isObserved;this.observedChildren+=t,r!==this.isObserved&&this.observedChanged(t)}observedChanged(t){for(let r of this.parents)r.childObserved(t)}_value=void 0;value(){for(;(this.state&fs.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let t=zie(this);this.lifetime=t;let r,n=!1;try{r=this.atom.read(t),n=!0}finally{let o=t.reads;t.reads=void 0,this.lifetime===t&&(this.dropUnread(o),n||this.fail())}if(this.lifetime===t&&(this.state&fs.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=an.valid):this.setValue(r)),t.failure!==An)throw t.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(t,r){let n=this.registry.ensureNode(t);this.parents.has(n)||(this.parents.add(n),n.children.add(this),this.isObserved&&n.childObserved(1));try{return n.value()}catch(o){if(r.reads===void 0||n.state!==an.valid)throw o;return r.failure===An&&(r.failure=o),n._value}finally{r.reads!==void 0&&!r.disposed&&r.reads.add(n)}}dropUnread(t){if(t.size===this.parents.size)return;let r=this.isObserved;for(let n of this.parents)t.has(n)||(this.parents.delete(n),n.children.delete(this),r&&n.childObserved(-1),n.canBeRemoved&&this.registry.scheduleNodeRemoval(n))}valueOption(){return(this.state&fs.initialized)===0?_():N(this._value)}setInitialValue(t){if((this.state&fs.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=an.stale,this._value=t,this.listeners.size>0&&this.announce();return}this.setValue(t)}setValue(t){let r=this.failed;this.failed=!1;let n=(this.state&fs.initialized)!==0;if(this.state=an.valid,n&&this.atom.equals(this._value,t)){r&&this.invalidateChildren();return}this._value=t;let o=An;try{this.invalidateChildren()}catch(s){o=s}if(this.listeners.size>0)try{this.announce()}catch(s){o===An&&(o=s)}if(o!==An)throw o}announce(){cn.phase===Ac.collect?cn.notify.add(this):this.notify()}invalidate(){if(this.state===an.valid){this.state=an.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&cn.phase!==Ac.collect?this.build():this.propagate()}propagate(){cn.phase===Ac.collect?(this.building&&(this.invalidatedDuringBuild=!0),cn.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let t=An;for(let r of Array.from(this.children))if(r.affectedBy(this))try{r.invalidate()}catch(n){t===An&&(t=n)}if(t!==An)throw t}affectedBy(t){if(this.state===an.valid)return!0;let r=this.lifetime?.reads;return r!==void 0?r.has(t):this.isObserved&&t.state===an.valid}notify(){cn.phase===Ac.commit&&cn.notify.delete(this),Nh(this.listeners,FW)}disposeLifetime(){let t=this.lifetime;t!==void 0&&(this.lifetime=void 0,t.dispose())}remove(){let t=this.isObserved;this.state=an.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let r=Array.from(this.parents);this.parents.clear(),Nh(r,n=>{n.children.delete(this),t&&n.childObserved(-1),n.canBeRemoved&&this.registry.removeNode(n)})}}subscribe(t){let r=this.isObserved;return this.listeners.add(t),r||this.observedChanged(1),()=>{this.listeners.delete(t)&&!this.isObserved&&this.observedChanged(-1)}}},qie={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let r=this.get(e);if(t?.suspendOnWaiting&&r.waiting)return Xn;switch(r._tag){case"Initial":return Xn;case"Failure":return ir(r.cause);case"Success":return I(r.value)}},resultOnce(e,t){return Nn(r=>{let n=this.once(e);if(n._tag!=="Initial"&&!(t?.suspendOnWaiting&&n.waiting))return r(Ad(n));let o=this.node.registry.subscribe(e,s=>{s._tag==="Initial"||t?.suspendOnWaiting&&s.waiting||(o(),r(Ad(s)))},{immediate:!1});return W(o)})},setResult(e,t){return this.disposed?Xn:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag==="None"?Xn:I(t.value)},someOnce(e){return Nn(t=>{let r=this.once(e);if(de(r))return t(I(r.value));let n=this.node.registry.subscribe(e,o=>{fe(o)||(n(),t(I(o.value)))},{immediate:!1});return W(n)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?_():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,r){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,r))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?Js:Ub(r=>W(()=>{this.subscribe(e,n=>Ic(r,n),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(yk(OW),hf(r=>r._tag==="Success"?I(r.value):je(r.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,Nh(e.reverse(),FW)}},zie=e=>{function t(r){return t.disposed||t.isFn?e.registry.get(r):e.readTracked(r,t)}return Object.setPrototypeOf(t,qie),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=An,t},xR=class{constructor(t,r){this.registry=t,this.node=r}registry;node;get(t){return this.registry.get(t)}set(t,r){return this.registry.set(t,r)}setSelf(t){return this.node.setValue(t)}refreshSelf(){return this.node.invalidate()}},Ac={disabled:0,collect:1,commit:2},cn={phase:Ac.disabled,depth:0,stale:[],notify:new Set};function NW(e){let t=cn.phase;cn.phase=Ac.collect,cn.depth++;let r=An;try{e()}catch(n){r=n}if(cn.depth===1){let{notify:n,stale:o}=cn,s=0;do{for(cn.phase=Ac.collect;s<o.length;s++)try{Wie(o[s])}catch(i){r===An&&(r=i)}cn.phase=Ac.commit;for(let i of n)try{i.notify()}catch(a){r===An&&(r=a)}}while(s<o.length);cn.stale=[],n.clear()}if(cn.depth--,cn.phase=t,r!==An)throw r}function Wie(e){if(e.state===an.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=an.stale,e.disposeLifetime()}e.value()}var Xh={};ps(Xh,{ConnectionHooks:()=>Yh,CurrentHeaders:()=>UE,Protocol:()=>Hi,layerProtocolHttp:()=>cue,layerProtocolSocket:()=>lue,layerProtocolWorker:()=>due,make:()=>oO,makeNoSerialization:()=>d6,makeProtocolHttp:()=>p6,makeProtocolSocket:()=>m6,makeProtocolWorker:()=>h6,withHeaders:()=>aue});var Dh=class extends Ue()("effect/workers/Transferable/Collector"){},DW=()=>{let e=[],t=o=>{e.push(...o)},r=()=>e,n=()=>{let o=e;return e=[],o};return Dh.of({addAllUnsafe:t,addAll:o=>W(()=>t(o)),readUnsafe:r,read:W(r),clearUnsafe:n,clear:W(n)})};var gR="~effect/workers/WorkerError";var yR=class extends Ar("effect/workers/WorkerError/WorkerSpawnError")({_tag:He("WorkerSpawnError"),message:z,cause:lr(er())}){},SR=class extends Ar("effect/workers/WorkerError/WorkerSendError")({_tag:He("WorkerSendError"),message:z,cause:lr(er())}){},bR=class extends Ar("effect/workers/WorkerError/WorkerReceiveError")({_tag:He("WorkerReceiveError"),message:z,cause:lr(er())}){},ER=class extends Ar("effect/workers/WorkerError/WorkerUnknownError")({_tag:He("WorkerUnknownError"),message:z,cause:lr(er())}){},IR=Pe([yR,SR,bR,ER]),LW=class extends Ar(gR)({_tag:He("WorkerError"),reason:IR}){constructor(t){super({...t,cause:t.reason.cause})}[gR]=gR;get message(){return this.reason.message}};var fE=class extends Ue()("effect/workers/Worker/WorkerPlatform"){};var TR=(e,t)=>e===void 0?t:`${e}.${t}`,wR=(e,t)=>({"rpc.system.name":"effect_rpc","rpc.method":e,...t});var Rd={};ps(Rd,{ServerClient:()=>kR,custom:()=>Yie,exitSchema:()=>RR,fork:()=>tae,isRpc:()=>Zie,isWrapper:()=>kd,make:()=>$W,uninterruptible:()=>rae,unwrap:()=>Xie,wrap:()=>pE,wrapMap:()=>eae});var vR="~effect/rpc/RpcSchema/StreamSchema";function Lh(e){return O(e,vR)}function lE(e){return Lh(e)?N({success:e.success,error:e.error}):_()}var Jie=Ge(Ae);function BW(e,t){return J(Jie.ast,{[vR]:vR,success:e,error:t})}var AR="~effect/rpc/Rpc",Zie=e=>O(e,AR),kR=class{id;annotations;constructor(t){this.id=t,this.annotations=pt()}annotate(t,r){return this.annotations=We(this.annotations,t,r),this}},Qie={[AR]:AR,pipe(){return V(this,arguments)},setSuccess(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return kc({_tag:this._tag,payloadSchema:Gu(e)?e:Te(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return kc({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:We(this.annotations,e,t)})},annotateMerge(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Kr(this.annotations,e)})}},kc=e=>{function t(){}return Object.setPrototypeOf(t,Qie),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},$W=(e,t)=>{let r=t?.success??dd,n=t?.error??Mi,o=t?.defect??er(),s;return t?.primaryKey?s=class extends QS(`effect/rpc/Rpc/${e}`)(t.payload){[Uz](){return t.primaryKey(this)}}:s=Gu(t?.payload)?t?.payload:t?.payload?Te(t?.payload):dd,kc({_tag:e,payloadSchema:s,successSchema:t?.stream?BW(r,n):r,errorSchema:t?.stream?Mi:n,defectSchema:o,annotations:pt(),middlewares:new Set})},Yie=e=>(t,r)=>{let n=r?.success??dd,o=r?.error??Mi,s=r?.defect??er(),i=e({success:n,error:o,defect:s});return $W(t,{...i,primaryKey:r?.primaryKey,payload:r?.payload,stream:r?.stream})},CR=new WeakMap,RR=e=>{if(CR.has(e))return CR.get(e);let t=e,r=new Set([t.errorSchema]),n=lE(t.successSchema);de(n)&&r.add(n.value.error);for(let s of t.middlewares)r.add(s.error);let o=yA(de(n)?dd:t.successSchema,Pe([...r]),t.defectSchema);return CR.set(e,o),o},Bh="~effect/rpc/Rpc/Wrapper",kd=e=>Bh in e,pE=e=>t=>kd(t)?{[Bh]:Bh,value:t.value,fork:e.fork??t.fork,uninterruptible:e.uninterruptible??t.uninterruptible}:{[Bh]:Bh,value:t,fork:e.fork??!1,uninterruptible:e.uninterruptible??!1},Xie=e=>kd(e)?e.value:e,eae=(e,t)=>kd(e)?pE(e)(t(e.value)):t(e),tae=pE({fork:!0}),rae=pE({uninterruptible:!0});var OR="~effect/rpc/RpcClientError",Rc=class extends Ar("effect/rpc/RpcClientError/RpcClientDefect")({_tag:He("RpcClientDefect"),message:z,cause:er()}){},Zs=class extends Ar(OR)({_tag:He("RpcClientError"),reason:Pe([IR,sR,Td,Rc])}){[OR]=OR;get message(){return`${this.reason._tag}: ${this.reason.message}`}};var _R=e=>e;var jW={_tag:"Ping"};var $h=Pe([z,Ju]),oae=Te({_tag:He("Request"),id:$h,tag:z,payload:qs,headers:ct(rs([z,z])),isNotification:lr(fr(!0)),traceId:lr(z),spanId:lr(z),sampled:lr(Fi)}),PR=Pe([oae,Te({_tag:He("Ack"),requestId:$h}),Te({_tag:He("Interrupt"),requestId:$h}),Te({_tag:He("Ping")}),Te({_tag:He("Eof")}),Te({_tag:He("Chunk"),requestId:$h,values:qs}),Te({_tag:He("Exit"),requestId:$h,exit:qs}),Te({_tag:He("Defect"),defect:qs}),Te({_tag:He("Pong")})]);var MR=e=>{switch(e._tag){case"Exit":case"Defect":case"ClientProtocolError":return!0;default:return!1}};var Qh={};ps(Qh,{MaxBufferSizeExceeded:()=>PE,RpcSerialization:()=>fn,json:()=>o6,jsonRpc:()=>i6,layerJson:()=>Zce,layerJsonRpc:()=>Xce,layerNdJsonRpc:()=>eue,layerNdjson:()=>Qce,layerNdjsonWith:()=>Yce,layerSchemaBinary:()=>tue,makeNdjson:()=>FE,ndJsonRpc:()=>a6,ndjson:()=>s6});var sae=new WeakMap,iae=new WeakMap,aae=new WeakMap,cae=new WeakMap;function c4(e,t){let r=t?.fingerprint===!0?iae:sae,n=r.get(e);if(n!==void 0)return n;let{exact:o,layout:s,recursive:i,target:a}=Pd(e),c=Sf(s,t?.fingerprint),u=o?{value:void 0}:void 0,f=NR(u===void 0?a:Lce(a,u,!i),s,c,u);return r.set(e,f),f}function VR(e,t){let r=t?.fingerprint===!0?cae:aae,n=r.get(e);if(n!==void 0)return n;let{exact:o,exitSuccess:s,layout:i,target:a}=Pd(e);if(!o){if(!s)return c4(e,t);let u={value:void 0},f=NR($ce(a,u),i,Sf(i,t?.fingerprint),u,!0);return r.set(e,f),f}let c=NR(jce(a),i,Sf(i,t?.fingerprint),void 0);return r.set(e,c),c}function NR(e,t,r,n,o=!1){return qs.pipe(ee(e,Nce(t,r,n,o)))}function u4(e,t){let{exact:r,exitSuccess:n,layout:o}=Pd(e),s=Sf(o,t?.fingerprint),i=t??nn;if(!r||i.onExcessProperty==="error"){let a=Qm(c4(e,t),t);return!n||i.onExcessProperty==="error"?a:c=>{if(!_E(c))return a(c);try{return CE(o,c,i,s)}catch(u){throw u instanceof ji?new $n(u.issue):u}}}return a=>{try{return CE(o,a,i,s)}catch(c){throw c instanceof ji?new $n(c.issue):c}}}function uae(e,t){let{exact:r,layout:n}=Pd(e),o=t??nn;if(!r||o.onExcessProperty==="error"){let i=u4(e,t);return a=>fae(a.map(i))}let s=Sf(n,t?.fingerprint);return i=>{try{return H4(n,i,o,s)}catch(a){throw a instanceof ji?new $n(a.issue):a}}}function fae(e){if(e.length===1)return e[0];let t=0;for(let o of e)t+=o.length;let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function f4(e,t){let{exact:r,exitSuccess:n,layout:o,target:s}=Pd(e),i=t??nn,a=r?void 0:$S(s,i),c=a!==void 0&&n?u=>_E(u)?u:a(u):a;return lae(o,Sf(o,t?.fingerprint),i,t?.maxFrameSize,c,l4(r,t))}function l4(e,t){if(t?.dictionary!==!0)return!1;if(!e)throw new Error("Binary layout: dictionary needs a schema the binary layer validates on its own");return!0}function d4(e,t){let{exact:r,layout:n,target:o}=Pd(e),s=l4(r,t),i=u4(e,t),a=uae(e,t);if(!s)return{encode:i,encodeMany:a};let c=Sf(n,t?.fingerprint),u=t??nn,f=u.onExcessProperty==="error"?Qm(o,t):void 0,p=ice(),m=h=>{try{return h()}catch(x){throw x instanceof ji?new $n(x.issue):x}};return{encode:h=>m(()=>CE(n,f===void 0?h:f(h),u,c,p)),encodeMany:h=>m(()=>H4(n,f===void 0?h:h.map(f),u,c,p))}}function lae(e,t,r,n,o,s){let i=s?[]:void 0,a=new Uint8Array(0),c=0,u=0,f,p=!1,m=new qh,h=new Hh(r,Pae),x=()=>{m.release(),h.clear(),a=$R,c=u=0},g=(v,T)=>{throw new $n(new le({expected:v},T,r))},y=()=>{let v=f;throw f=void 0,v},E=(v,T)=>{let S=v.length-T;S>a.length&&(a=new Uint8Array(Math.max(256,S))),a.set(T===0?v:v.subarray(T),0),c=0,u=S},b={feedSync(v){if(f!==void 0)return y();if(p)return g("parser is spent");let T=u===c,S,w,k;if(T)S=v,w=0,k=v.length;else{if(v.length>0){let $=u-c,te=$+v.length;if(te>a.length){let xe=new Uint8Array(Math.max(256,a.length*2,te));xe.set(a.subarray(c,u)),a=xe,c=0,u=$}else c>0&&(a.copyWithin(0,c,u),c=0,u=$);a.set(v,u),u+=v.length}S=a,w=c,k=u}let C=[],R=()=>(T?w<k&&E(v,w):(c=w,c===u&&(c=u=0)),C),M=($,te)=>{p=!0;let xe=new $n(new le({expected:$},te,r));if(x(),C.length===0)throw xe;return f=xe,C};for(;;){let $=0,te=-1,xe=k-w,Le=1;for(let Ee=0;Ee<Math.min(6,xe);Ee++){let Oe=S[w+Ee];if($+=(Oe&127)*Le,(Oe&128)===0){te=Ee+1;break}Le*=128}if(te===-1){if(xe<6)return R();let Ee=BigInt($);for(let Oe=6;Oe<Math.min(10,xe);Oe++){let rr=S[w+Oe];if(Ee|=BigInt(rr&127)<<BigInt(Oe*7),(rr&128)===0){if(te=Oe+1,Ee>UR)return M("safe integer length",Ee);$=Number(Ee);break}}if(te===-1)return xe>=10?M("uvarint",S.subarray(w,w+10)):R()}if($===0)return M("nonzero frame length",$);if(n!==void 0&&$>n)return M("frame within maxFrameSize",$);if(te+$>xe)return R();let Er=Q;try{Q=0;let Ee=w+te;h.beginFrame(),m.reset(S,Ee,Ee+$,r,h,t.positional,i);let Oe=Q4(e,m,t);C.push(o===void 0?Oe:o(Oe))}catch(Ee){p=!0,x();let Oe=Ee instanceof ji?new $n(Ee.issue):ud(Ee)?Ee:(()=>{throw Ee})();if(C.length===0)throw Oe;return f=Oe,C}finally{Q=Er}w+=te+$}},endSync(){if(f!==void 0)return y();if(p)return g("parser is spent");p=!0;let v=c<u?a.subarray(c,u):void 0;if(x(),v!==void 0)return g("complete value",v)},feed:v=>L(()=>{try{return I(b.feedSync(v))}catch(T){if(ud(T))return D(T);throw T}}),end:L(()=>{try{return b.endSync(),P}catch(v){if(ud(v))return D(v);throw v}})};return b}var dae="~effect/encoding/SchemaBinary/fieldId",pae=32,mae=33,UR=BigInt(Number.MAX_SAFE_INTEGER),bE=BigInt(0),ls=BigInt(1),hae=BigInt(2),p4=BigInt(7),qW=BigInt(127),xae=BigInt(1e6),gae=BigInt(255),zW=BigInt(4294967295),yae=BigInt(32),$i=new TextEncoder,Sae=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),m4=7,WW=0xffffffffffff,bae=0xfffffffffffff,h4=0,x4=1,g4=2,KW=512,Eae=1048576,Iae=4194304,bf=0,yf=1,Kh=2,Vh=3,Gh=4,Jh=5,Tae=6,wae=7,ds=8;function GR(e){return typeof e=="number"&&Number.isInteger(e)&&e>=-WW&&e<=WW}var AE=8,DR=2199023255551,_c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];function JR(e){for(let t=1;t<=AE;t++){let r=Math.round(e*_c[t]);if(!(r>=-DR&&r<=DR))return 0;if(r/_c[t]===e)return t}return 0}function y4(e){let t=Math.floor(e/2);return e%2===1?-t:t}var dt={bool:1,null:2,undefined:3,number:4,string:5,bytes:6,bigint:7,int64:8,struct:9,variant:10,array:11,option:12,result:13,duration:14,bigDecimal:15,dateTimeZoned:16,json:17,exit:18,cause:19,causeReason:20};function S4(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e[r],16777619);return t>>>0}var vae=BigInt("14695981039346656037"),Cae=BigInt("1099511628211"),Aae=BigInt("18446744073709551615");function VW(e){let t=vae;for(let r=0;r<e.length;r++)t=(t^BigInt(e[r]))*Cae&Aae;return t}function EE(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}function Oc(e,t){for(;t>127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t)}function IE(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}function No(e,t){for(let r=0;r<8;r++)e.push(Number(t>>BigInt(r*8)&gae))}function b4(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length}var ji=class extends Error{issue;constructor(t){super("SchemaBinary failure"),this.issue=t}};function j(e,t,r){throw dr(new le({expected:e},t,r))}var Ze=[],Q=0;function dr(e){return new ji(Q===0?e:new At(Ze.slice(0,Q),e))}function kae(e){let t=new Uint8Array(E4(e)),r=0;for(;e>127;)t[r++]=e&127|128,e=Math.floor(e/128);return t[r]=e,t}function E4(e){let t=1;for(;e>127;)e=Math.floor(e/128),t++;return t}var Rae=32;function Oae(e,t,r,n){let o=r-t;if(o===0)return"";if(o<=Rae){let s=_ae(e,t,r);if(s!==void 0)return s}try{return Sae.decode(e.subarray(t,r))}catch{j("utf-8",void 0,n)}}function _ae(e,t,r){let n="",o=t;for(;o+16<=r;o+=16){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6],m=e[o+7],h=e[o+8],x=e[o+9],g=e[o+10],y=e[o+11],E=e[o+12],b=e[o+13],v=e[o+14],T=e[o+15];if((s|i|a|c|u|f|p|m|h|x|g|y|E|b|v|T)>127)return;n+=String.fromCharCode(s,i,a,c,u,f,p,m,h,x,g,y,E,b,v,T)}if(o+8<=r){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6],m=e[o+7];if((s|i|a|c|u|f|p|m)>127)return;n+=String.fromCharCode(s,i,a,c,u,f,p,m),o+=8}switch(r-o){case 0:return n;case 1:{let s=e[o];return s>127?void 0:n+String.fromCharCode(s)}case 2:{let s=e[o],i=e[o+1];return(s|i)>127?void 0:n+String.fromCharCode(s,i)}case 3:{let s=e[o],i=e[o+1],a=e[o+2];return(s|i|a)>127?void 0:n+String.fromCharCode(s,i,a)}case 4:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3];return(s|i|a|c)>127?void 0:n+String.fromCharCode(s,i,a,c)}case 5:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4];return(s|i|a|c|u)>127?void 0:n+String.fromCharCode(s,i,a,c,u)}case 6:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5];return(s|i|a|c|u|f)>127?void 0:n+String.fromCharCode(s,i,a,c,u,f)}default:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6];return(s|i|a|c|u|f|p)>127?void 0:n+String.fromCharCode(s,i,a,c,u,f,p)}}}var LR=64*1024,Pae=256,Mae=512,Fae=16*1024;function BR(e){let t=new Uint8Array(e);return{buf:t,view:new DataView(t.buffer),offset:0,writing:!1}}var jh=BR(LR),TE=class{buf=new Uint8Array(0);view=new DataView(this.buf.buffer);arena;start=0;limit=0;len=0;reset(){let t=jh;(t.writing||t.offset>=t.buf.length)&&(t=jh=BR(LR)),t.writing=!0,this.arena=t,this.buf=t.buf,this.view=t.view,this.start=t.offset,this.limit=t.buf.length-t.offset,this.len=0}ensure(t){if(this.len+t>this.limit){let r=this.arena,n=this.len+t,o=LR;for(;o<n;)o*=2;let s=BR(o);s.writing=!0,s.buf.set(this.buf.subarray(this.start,this.start+this.len)),r.writing=!1,this.arena=jh=s,this.buf=s.buf,this.view=s.view,this.start=0,this.limit=s.buf.length}}byte(t){this.ensure(1),this.buf[this.start+this.len++]=t}bytes(t){this.ensure(t.length),this.buf.set(t,this.start+this.len),this.len+=t.length}uvarint(t){this.ensure(10);let r=this.buf,n=this.start+this.len;if(t<128)r[n++]=t;else if(r[n++]=t&127|128,t<16384)r[n++]=t>>>7;else{for(r[n++]=t>>>7&127|128,t=Math.floor(t/16384);t>127;)r[n++]=t&127|128,t=Math.floor(t/128);r[n++]=t}this.len=n-this.start}uvarintBig(t){for(;t>qW;)this.byte(Number(t&qW)|128),t>>=p4;this.byte(Number(t))}zigzag(t){this.uvarintBig(t>=bE?t<<ls:(-t<<ls)-ls)}numberVarint(t){let r=t<0||t===0&&1/t<0,n=r?-t:t;n<=bae?this.uvarint(n*2+(r?1:0)):this.uvarintBig(BigInt(n)*hae+(r?ls:bE))}f64(t){this.ensure(8),this.view.setFloat64(this.start+this.len,t,!0),this.len+=8}i64(t){this.ensure(8),this.view.setBigInt64(this.start+this.len,t,!0),this.len+=8}u32le(t){this.ensure(4),this.view.setUint32(this.start+this.len,t>>>0,!0),this.len+=4}i32le(t){this.ensure(4),this.view.setInt32(this.start+this.len,t|0,!0),this.len+=4}idAndMark(t){let r=t.length;this.ensure(r+1);let n=this.buf,o=this.start+this.len;for(let i=0;i<r;i++)n[o++]=t[i];let s=o-this.start;return this.len=s+1,s}beginSized(){return this.ensure(1),this.len++}endSized(t){let r=this.len-t-1;r<128?this.buf[this.start+t]=r:this.growSized(t,r)}endSizedRun(t){let r=(this.len-t-1)*2;r<128?this.buf[this.start+t]=r:this.growSized(t,r)}growSized(t,r){let n=E4(r),o=n-1;this.ensure(o);let s=this.start+t;this.buf.copyWithin(s+n,s+1,this.start+this.len),this.len+=o;let i=r,a=s;for(;i>127;)this.buf[a++]=i&127|128,i=Math.floor(i/128);this.buf[a]=i}string(t){let r=t.length;if(r===0)return;this.ensure(r*3);let n=this.buf,o=this.start+this.len,s=0;for(;s+4<=r;s+=4){let i=t.charCodeAt(s),a=t.charCodeAt(s+1),c=t.charCodeAt(s+2),u=t.charCodeAt(s+3);if((i|a|c|u)>127){this.len+=$i.encodeInto(t,n.subarray(this.start+this.len)).written;return}n[o++]=i,n[o++]=a,n[o++]=c,n[o++]=u}for(;s<r;s++){let i=t.charCodeAt(s);if(i>127){this.len+=$i.encodeInto(t,n.subarray(this.start+this.len)).written;return}n[o++]=i}this.len=o-this.start}out(){let t=this.arena,r=new Uint8Array(t.buf.buffer,this.start,this.len);return t===jh&&(t.offset=this.start+this.len),t.writing=!1,this.arena=void 0,r}abort(){let t=this.arena;t!==void 0&&(t===jh&&(t.offset=this.start),t.writing=!1,this.arena=void 0)}};function Nae(e){let t=Bn(e);return t._tag==="String"&&t.checks===void 0}function Uae(e,t,r){return e.extra.find(n=>_i({[t]:null},n.parameter,r).length>0)}var Hh=class{entries=new WeakMap;orderLayouts;orderKeys;options;size=0;next=0;replace=!1;constructor(t,r){this.options=t,this.orderLayouts=r===void 0?void 0:new Array(r),this.orderKeys=r===void 0?void 0:new Array(r)}beginFrame(){this.replace=!0}find(t,r){let n=this.entries.get(t);if(n===void 0&&(n=new Map,this.entries.set(t,n)),n.has(r))return n.get(r);let o=Uae(t,r,this.options),s=this.orderLayouts;if(s===void 0)return n.set(r,o),o;let i=this.orderKeys;if(this.size<s.length)s[this.size]=t,i[this.size]=r,this.size++,n.set(r,o);else if(this.replace){this.replace=!1;let a=s[this.next];(a===t?n:this.entries.get(a))?.delete(i[this.next]),s[this.next]=t,i[this.next]=r,this.next=(this.next+1)%s.length,n.set(r,o)}return o}clear(){this.entries=new WeakMap,this.orderLayouts?.fill(void 0),this.orderKeys?.fill(void 0),this.size=this.next=0,this.replace=!1}},wE=new ArrayBuffer(0),$R=new Uint8Array(wE),GW=new DataView(wE),qh=class{pos=0;nesting=0;buf=$R;view;viewCache=GW;viewBuffer=wE;viewOffset=0;viewLength=0;end=0;options=nn;indexSignatures;positional=!1;intern;dict;reset(t,r,n,o,s,i,a){this.nesting=0,this.view=void 0,this.buf=t,this.pos=r,this.end=n,this.options=o,this.indexSignatures=s,this.positional=i,this.intern=void 0,this.dict=a}release(){this.pos=this.end=this.nesting=0,this.buf=$R,this.view=void 0,this.viewCache=GW,this.viewBuffer=wE,this.viewOffset=this.viewLength=0,this.options=nn,this.indexSignatures=void 0,this.positional=!1,this.intern=void 0,this.dict=void 0}get remaining(){return this.end-this.pos}dataView(){let t=this.buf;return(t.buffer!==this.viewBuffer||t.byteOffset!==this.viewOffset||t.byteLength!==this.viewLength)&&(this.viewBuffer=t.buffer,this.viewOffset=t.byteOffset,this.viewLength=t.byteLength,this.viewCache=new DataView(t.buffer,t.byteOffset,t.byteLength)),this.view=this.viewCache}byte(){return this.pos>=this.end&&j("complete value",void 0,this.options),this.buf[this.pos++]}take(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.buf.subarray(this.pos,this.pos+t);return this.pos+=t,r}takeCopy(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,r}enter(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.end;return this.end=this.pos+t,r}exit(t){this.pos=this.end,this.end=t}readUtf8(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.pos;return this.pos+=t,Oae(this.buf,r,r+t,this.options)}uvarint(){let t=this.buf,r=this.end,n=this.pos;n>=r&&j("complete value",void 0,this.options);let o=t[n++];if(o<128)return this.pos=n,o;let s=o&127;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<7,o<128)return this.pos=n,s;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<14,o<128)return this.pos=n,s;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<21,o<128)return this.pos=n,s;let i=268435456;for(let a=4;a<10;a++){n>=r&&(this.pos=n,j("complete value",void 0,this.options)),o=t[n++];let c=(o&127)*i;if(c>Number.MAX_SAFE_INTEGER-s&&(this.pos=n,j("safe integer length",void 0,this.options)),s+=c,o<128)return this.pos=n,s;i*=128}this.pos=n,j("uvarint",void 0,this.options)}fieldTag(){let t=this.buf,r=this.end,n=this.pos;n>=r&&j("complete value",void 0,this.options);let o=t[n++];if(o<128)return this.pos=n,o;let s=o&127;return n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<7,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<14,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<21,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],this.pos=n,o>=128&&j("uvarint",void 0,this.options),s+o*268435456)))}uvarintBig(){let t=bE,r=bE;for(;;){let n=this.byte();if(t|=BigInt(n&127)<<r,(n&128)===0)return t;r+=p4}}numberVarint(){let t=this.buf,r=this.end,n=this.pos,o=0,s=1;for(let c=0;c<m4;c++){n>=r&&(this.pos=n,j("complete value",void 0,this.options));let u=t[n++];if(o+=(u&127)*s,u<128)return this.pos=n,y4(o);s*=128}let i=this.uvarintBig(),a=Number(i>>ls);return Number.isFinite(a)||j("safe integer length",void 0,this.options),(i&ls)===ls?-a:a}zigzag(){let t=this.uvarintBig();return(t&ls)===ls?-(t+ls>>ls):t>>ls}f64(){this.pos+8>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getFloat64(this.pos,!0);return this.pos+=8,t}i64(){this.pos+8>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getBigInt64(this.pos,!0);return this.pos+=8,t}u32le(){this.pos+4>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getUint32(this.pos,!0);return this.pos+=4,t}i32le(){this.pos+4>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getInt32(this.pos,!0);return this.pos+=4,t}};function JW(e,t){return{_:"literal",leaf:e,values:t,valueSet:t.length>4?new Set(t):void 0}}function Zh(e,t){let r=e.values;return e.valueSet!==void 0?e.valueSet.has(t):r.length===1?t===r[0]:r.includes(t)}function kE(e){return e.values.map(t=>typeof t=="string"?JSON.stringify(t):String(t)).join(" | ")}var xE=0,ZR=1,I4=2,T4=3,w4=30,gE=1<<w4;function RE(e){return e._==="literal"?RE(e.leaf):e._==="int"}function OE(e){switch(e._){case"literal":return OE(e.leaf);case"bool":return 1;case"int64":return 8;default:return}}function jR(e){return OE(e)!==void 0||RE(e)||e._==="null"||e._==="undefined"}function v4(e){return e._==="literal"?v4(e.leaf):e._==="null"||e._==="undefined"}var zh={"effect/schema/Date":{kind:dt.int64,exact:!0},"effect/schema/DateTimeUtc":{kind:dt.int64,exact:!0},"effect/schema/DateTimeZoned":{kind:dt.dateTimeZoned,exact:!0},"effect/schema/Duration":{kind:dt.duration,exact:!0},"effect/schema/BigDecimal":{kind:dt.bigDecimal,exact:!0},"effect/schema/Uint8Array":{kind:dt.bytes,exact:!0},"effect/schema/Option":{kind:dt.option,exact:"parameters"},"effect/schema/Result":{kind:dt.result,exact:"parameters"},"effect/schema/Exit":{kind:dt.exit,exact:"parameters"},"effect/schema/Cause":{kind:dt.cause,exact:"parameters"},"effect/schema/CauseReason":{kind:dt.causeReason,exact:"parameters"}};function _d(e){let t=e.annotations?.representation;return Jt(t)&&typeof t.id=="string"?t.id:void 0}var yE=ma(e=>{let t=Dae(e),r=e.context;return t===e||r===void 0?t:ql(t,new Yo(r.isOptional,r.isMutable,void 0,r.annotations))});function Dae(e){switch(e._tag){case"Declaration":{let t=_d(e);if(t!==void 0&&(t in zh||t==="effect/schema/Json"||t==="effect/schema/MutableJson"))return e.recur(yE);let r=e.annotations?.toCodecJson,n=e.annotations?.toCodec;if(!or(r)&&!or(n))return e;let o=e.typeParameters.map(i=>J(Bn(i))),s=(or(r)?r(o):void 0)??(or(n)?n(o):void 0);return s===void 0?e:lt(e,[fc(s,yE)])}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(yE);default:return e}}function Lae(e){let t=[...e].sort((n,o)=>{let s=typeof n.key=="number",i=typeof o.key=="number";return s!==i?s?-1:1:s?n.key-o.key:b4($i.encode(n.key),$i.encode(o.key))}),r=[];for(let n of t){let o=$i.encode(String(n.key));r.push(typeof n.key=="number"?0:1),IE(r,o.length),EE(r,o);let s=n.literal,i=$i.encode(A4(s));r.push(C4(s)),IE(r,i.length),EE(r,i)}return S4(r)}function C4(e){switch(typeof e){case"string":return 1;case"number":return 2;case"boolean":return 3;case"bigint":return 4;default:return 5}}function A4(e){if(typeof e=="symbol"){let t=globalThis.Symbol.keyFor(e);if(t===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return t}return String(e)}function k4(e){switch(e._tag){case"Symbol":return!0;case"Union":return e.types.some(k4);default:return!1}}function R4(e){let t=_d(e);return t==="effect/schema/Json"||t==="effect/schema/MutableJson"?!0:or(e.annotations?.toCodecJson)}function Bae(e){let t=e.checks;if(t===void 0)return!1;let r=n=>n.annotations?.representation?.id==="effect/schema/isInt"?!0:n._tag==="FilterGroup"&&n.checks.some(r);return t.some(r)}function O4(e){for(;e._tag==="Suspend";)e=e.thunk();return e}function _4(e){return new Sn(e.enums.map(t=>new Ln(t[1],{title:t[0]})))}function ZW(e){let t=[],r=new Set,n=o=>{let s=O4(o);if(!r.has(s))switch(r.add(s),s._tag){case"Never":return;case"Union":s.types.forEach(n);return;case"Enum":_4(s).types.forEach(n);return;default:t.push(s)}};return e.types.forEach(n),t}function QW(e){switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"bool";default:return"bigint"}}function SE(e){switch(e._tag){case"String":case"TemplateLiteral":case"Symbol":return dt.string;case"UniqueSymbol":if(globalThis.Symbol.keyFor(e.symbol)===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return dt.string;case"Boolean":return dt.bool;case"Null":return dt.null;case"Undefined":case"Void":return dt.undefined;case"Number":return dt.number;case"BigInt":return dt.bigint;case"Literal":switch(typeof e.literal){case"string":return dt.string;case"number":return dt.number;case"boolean":return dt.bool;default:return dt.bigint}case"Unknown":case"Any":case"ObjectKeyword":return dt.json;case"Objects":return dt.struct;case"Arrays":return dt.array;case"Declaration":{let t=_d(e);if(t!==void 0&&t in zh)return zh[t].kind;if(R4(e))return dt.json;throw new Error(`Binary layout: declaration ${t??"<anonymous>"} has no toCodecJson or toCodec`)}case"Suspend":return SE(O4(e));default:throw new Error("Binary layout: union members are not uniquely identifiable")}}function YW(e){for(let t of e.fields)t.optional||(t.index<32?e.requiredMask|=1<<t.index:e.requiredWide=!0)}function $ae(e){let t=P4(e),r=!t&&jae(e);e=Bn(e);let n=new Map,o=!1,s=0,i=x=>({_:x,slot:x==="string"?s++:0});function a(x){let g=n.get(x);if(g!==void 0)return g;let y=c(x);return n.set(x,y),y}function c(x){switch(x._tag){case"String":case"TemplateLiteral":return i("string");case"Symbol":case"UniqueSymbol":return i("symbol");case"Boolean":return i("bool");case"Null":return i("null");case"Undefined":case"Void":return i("undefined");case"Number":return i(Bae(x)?"int":"number");case"BigInt":return i("bigint");case"Literal":return JW(i(QW(x.literal)),[x.literal]);case"Unknown":case"Any":case"ObjectKeyword":return i("json");case"Never":return{_:"never",ast:x};case"Enum":return m(x,ZW(_4(x)));case"Suspend":{o=!0;let g=a(x.thunk());return n.set(x,g),g}case"Objects":return u(x);case"Arrays":return f(x);case"Union":return m(x,ZW(x));case"Declaration":return p(x)}}function u(x){let g=[],y=[],E=new Map;for(let T of x.propertySignatures){if(typeof T.name=="symbol")throw new Error("Binary layout: symbol property names are illegal");let S=String(T.name),w=T.type.context?.annotations,k=w?.[dae],C=typeof k=="number"?k:S4($i.encode(S));if(!Number.isInteger(C)||C<0||C>4294967295)throw new Error(`Binary layout: illegal field id for ${S}`);let R=E.get(C);R===void 0?E.set(C,[S]):R.push(S),g.push({name:S,id:C,tagBytes:kae(C*ds+bf),index:0,optional:T.type.context?.isOptional===!0,annotations:w,layout:void 0,wireMask:0,inline:!1}),y.push(T.type)}for(let[T,S]of E)if(T===0||S.length>1)throw new Error(`Binary layout field id collision: ${T} (${S.join(", ")})`);let b=[];for(let T of x.indexSignatures){if(k4(T.parameter))throw new Error("Binary layout: symbol property names are illegal");b.push({parameter:T.parameter,layout:void 0,wireMask:0})}let v={_:"struct",ast:x,fields:g,byId:new Map,extra:b,extraAll:b.length===1&&Nae(b[0].parameter)?b[0]:void 0,names:new Set(g.map(T=>T.name)),extraShape:void 0,optionalCount:0,requiredMask:0,requiredWide:!1};n.set(x,v);for(let T=0;T<g.length;T++){let S=g[T];S.layout=a(y[T]),S.wireMask=WR(S.layout),S.inline=jR(S.layout),S.optional&&v.optionalCount++,v.byId.set(S.id,S)}g.sort((T,S)=>T.id-S.id);for(let T=0;T<g.length;T++)g[T].index=T;YW(v);for(let T=0;T<b.length;T++)b[T].layout=a(x.indexSignatures[T].type),b[T].wireMask=WR(b[T].layout);return v}function f(x){let g=x.rest.length>0||x.elements.some(v=>v.context?.isOptional===!0),y=x.elements.filter(v=>v.context?.isOptional!==!0).length,E=Math.max(0,x.rest.length-1),b={_:"array",ast:x,elements:[],rest:[],hasCount:g,minCount:y+E,uniform:void 0,uniformInline:!1,uniformPacked:void 0,uniformNumbers:!1,run:void 0};n.set(x,b);for(let v of x.elements)b.elements.push({optional:v.context?.isOptional===!0,layout:a(v)});for(let v of x.rest)b.rest.push(a(v));if(b.elements.length===0&&b.rest.length===1){let v=b.rest[0];b.uniform=v,b.uniformPacked=OE(v),b.uniformNumbers=v._==="number",b.uniformInline=jR(v)}return b}function p(x){let g=_d(x);switch(g){case"effect/schema/Date":return{_:"int64",flavor:"date"};case"effect/schema/DateTimeUtc":return{_:"int64",flavor:"utc"};case"effect/schema/DateTimeZoned":return i("dateTimeZoned");case"effect/schema/Duration":return i("duration");case"effect/schema/BigDecimal":return i("bigDecimal");case"effect/schema/Uint8Array":return i("bytes")}let y=x.typeParameters;switch(g){case"effect/schema/Option":{let E={_:"option",value:void 0};return n.set(x,E),E.value=a(y[0]),E}case"effect/schema/Result":{let E={_:"result",success:void 0,failure:void 0};return n.set(x,E),E.success=a(y[0]),E.failure=a(y[1]),E}case"effect/schema/Exit":{let E={_:"cause",error:void 0,defect:void 0},b={_:"exit",value:void 0,cause:E};return n.set(x,b),b.value=a(y[0]),E.error=a(y[1]),E.defect=a(y[2]),b}case"effect/schema/Cause":case"effect/schema/CauseReason":{let E={_:g==="effect/schema/Cause"?"cause":"causeReason",error:void 0,defect:void 0};return n.set(x,E),E.error=a(y[0]),E.defect=a(y[1]),E}}if(g!==void 0&&g in zh)throw new Error(`Binary layout: native declaration ${g} has no layout constructor`);if(R4(x))return i("json");throw new Error(`Binary layout: declaration ${g??"<anonymous>"} has no toCodecJson or toCodec`)}function m(x,g){if(g.length===0)return{_:"never",ast:x};let y=[],E=[],b=new Map,v=new Map,T=(R,M)=>{let $=b.get(R);if($!==void 0&&$._!==M._)throw new Error("Binary layout: union members are not uniquely identifiable");b.set(R,M)};for(let R of g){if(R._tag==="Literal"){let M=SE(R),$=v.get(M);$===void 0?v.set(M,[R.literal]):$.includes(R.literal)||$.push(R.literal);continue}if(R._tag==="UniqueSymbol"){SE(R),T(dt.string,i("symbol"));continue}if(R._tag==="Objects"||R._tag==="Arrays"){let M=ac(R);if(M!==void 0&&M.length>0){for(let $ of M)if(typeof $.key=="symbol")throw new Error("Binary layout: symbol property names are illegal");y.push({member:R,sentinels:M});continue}}E.push({member:R,kind:SE(R)})}for(let[R,M]of v)T(R,JW(i(QW(M[0])),M));if(y.length===0&&E.length===0&&b.size===1)return b.values().next().value;let S=new Set(b.keys());for(let{kind:R}of E){if(S.has(R))throw new Error("Binary layout: union members are not uniquely identifiable");S.add(R)}if(y.length===0&&b.size===0&&E.length===1){let R=a(E[0].member);return n.set(x,R),R}let w=new Map,k=[];for(let{sentinels:R}of y){let M=Lae(R);if(w.has(M))throw new Error(`Binary layout sentinel collision: ${M}`);w.set(M,R),k.push(M)}let C={_:"union",ast:x,variants:[],byTag:new Map,discriminator:void 0,others:[],byKind:new Map,byPos:[]};n.set(x,C);for(let R=0;R<y.length;R++){let{member:M,sentinels:$}=y[R],te=k[R],xe=a(M),Le,Er;if(M._tag==="Objects"){let Oe=xe,rr=new Set($.map(Rn=>String(Rn.key))),lo=Oe.fields.filter(Rn=>!rr.has(Rn.name)),Xs={_:"struct",ast:Oe.ast,fields:lo,byId:new Map(lo.map(Rn=>[Rn.id,Rn])),extra:Oe.extra,extraAll:Oe.extraAll,names:Oe.names,extraShape:void 0,optionalCount:lo.reduce((Rn,nI)=>nI.optional?Rn+1:Rn,0),requiredMask:0,requiredWide:!1};YW(Xs),Le=Xs,Er=!1}else Le=xe,Er=!0;let Ee={tag:te,sentinels:$,tuple:Er,payload:Le,position:0};C.variants.push(Ee),C.byTag.set(te,Ee)}for(let[R,M]of b)C.others.push({kind:R,layout:M,position:0}),C.byKind.set(R,M);for(let{kind:R,member:M}of E){let $=a(M);C.others.push({kind:R,layout:$,position:0}),C.byKind.set(R,$)}for(let R of[...C.variants].sort((M,$)=>M.tag-$.tag))R.position=C.byPos.length,C.byPos.push({variant:R,layout:R.payload});for(let R of[...C.others].sort((M,$)=>M.kind-$.kind))R.position=C.byPos.length,C.byPos.push({variant:void 0,layout:R.layout});return C.others.sort((R,M)=>XW(R.layout)-XW(M.layout)),C.discriminator=xce(C.variants),C}return{layout:a(e),recursive:o,exact:t,exitSuccess:r}}function P4(e){let t=new Map,r=n=>{if(n.encoding!==void 0||n.checks!==void 0||n.encodingChecks!==void 0)return!1;switch(n._tag){case"String":case"Symbol":case"Boolean":case"Null":case"Undefined":case"Void":case"Number":case"BigInt":case"Literal":return!0;case"Never":return!0;case"Unknown":case"Any":return!0;case"Arrays":return n.elements.every(r)&&n.rest.every(r);case"Objects":return n.propertySignatures.every(o=>r(o.type))&&n.indexSignatures.every(o=>o.parameter._tag==="String"&&r(o.parameter)&&r(o.type));case"Union":return(n.options?.mode??"anyOf")==="anyOf"&&n.types.every(r);case"Suspend":{let o=t.get(n);if(o!==void 0)return o;t.set(n,!0);let s=r(n.thunk());return t.set(n,s),s}case"Declaration":{let o=_d(n),s=o!==void 0?zh[o]:void 0;return s===void 0?!1:s.exact===!0||n.typeParameters.every(r)}default:return!1}};return r(e)}function jae(e){return e._tag==="Declaration"&&e.encoding===void 0&&e.checks===void 0&&e.encodingChecks===void 0&&_d(e)==="effect/schema/Exit"&&P4(e.typeParameters[0])}var uo={backEdge:0,bool:1,null:2,undefined:3,number:4,int:5,string:6,symbol:7,bytes:8,bigint:9,json:10,duration:11,bigDecimal:12,dateTimeZoned:13,date:14,dateTimeUtc:15,never:16,struct:17,array:18,union:19,option:20,result:21,exit:22,cause:23,causeReason:24,literal:25};function Hae(e){let t=new Map,r=[],n=Number.MAX_SAFE_INTEGER;function o(i){let a=r.lastIndexOf(i);if(a>=0){a<n&&(n=a);let h=[uo.backEdge];return Oc(h,r.length-a),VW(h)}let c=t.get(i);if(c!==void 0)return c;let u=r.length,f=n;n=Number.MAX_SAFE_INTEGER,r.push(i);let p=VW(s(i));r.pop();let m=n>=u;return m&&t.set(i,p),n=m?f:Math.min(f,n),p}function s(i){let a=[];switch(i._){case"bool":case"null":case"undefined":case"number":case"int":case"string":case"symbol":case"bytes":case"bigint":case"json":case"duration":case"bigDecimal":case"dateTimeZoned":return a.push(uo[i._]),a;case"literal":{a.push(uo.literal),EE(a,s(i.leaf)),Oc(a,i.values.length);let c=i.values.map(u=>[C4(u),A4(u)]).sort((u,f)=>u[1]<f[1]?-1:u[1]>f[1]?1:u[0]-f[0]);for(let[u,f]of c){a.push(u);let p=$i.encode(f);Oc(a,p.length),EE(a,p)}return a}case"int64":return a.push(i.flavor==="date"?uo.date:uo.dateTimeUtc),a;case"never":return a.push(uo.never),a;case"struct":{a.push(uo.struct),Oc(a,i.fields.length);for(let c of i.fields)IE(a,c.id),a.push(c.optional?1:0),No(a,o(c.layout));Oc(a,i.extra.length);for(let c of i.extra)No(a,o(c.layout));return a}case"array":{a.push(uo.array),Oc(a,i.elements.length);for(let c of i.elements)a.push(c.optional?1:0),No(a,o(c.layout));Oc(a,i.rest.length);for(let c of i.rest)No(a,o(c));return a}case"union":{a.push(uo.union),Oc(a,i.byPos.length);for(let c of i.byPos){let u=c.variant;u===void 0?a.push(0):(a.push(1,u.tuple?1:0),IE(a,u.tag)),No(a,o(c.layout))}return a}case"option":return a.push(uo.option),No(a,o(i.value)),a;case"result":return a.push(uo.result),No(a,o(i.success)),No(a,o(i.failure)),a;case"exit":return a.push(uo.exit),No(a,o(i.value)),No(a,o(i.cause.error)),No(a,o(i.cause.defect)),a;case"cause":case"causeReason":return a.push(i._==="cause"?uo.cause:uo.causeReason),No(a,o(i.error)),No(a,o(i.defect)),a}}return o(e)}function qae(e,t){let r=new Uint8Array(8);for(let n=0;n<4;n++)r[n]=e>>>n*8&255,r[n+4]=t>>>n*8&255;return r}var zae={positional:!1,envelope:pae,expectedEnvelope:"version 2 envelope, flags 0",fingerprint:new Uint8Array(8)};function Wae(e){let t=Hae(e);return{positional:!0,envelope:mae,expectedEnvelope:"version 2 envelope, flags 1",fingerprint:qae(Number(t&zW),Number(t>>yae&zW))}}function XW(e){switch(e._){case"json":return 2;case"struct":return 1;default:return 0}}function HR(e,t){switch(e._){case"literal":return Zh(e,t);case"bool":return typeof t=="boolean";case"null":return t===null;case"undefined":return t===void 0;case"number":case"int":return typeof t=="number";case"string":return typeof t=="string";case"symbol":return typeof t=="symbol";case"bigint":return typeof t=="bigint";case"bytes":return t instanceof Uint8Array;case"int64":return e.flavor==="date"?t instanceof Date:wu(t)&&t._tag==="Utc";case"dateTimeZoned":return wu(t)&&t._tag==="Zoned";case"duration":return Qi(t);case"bigDecimal":return Iu(t);case"option":return ci(t);case"result":return Bf(t);case"exit":return ws(t);case"cause":return sl(t);case"causeReason":return il(t);case"array":return Array.isArray(t);case"struct":return Jt(t)&&!Array.isArray(t);case"json":return!0;case"union":case"never":return!1}}function ut(e,t,r){throw dr(new le({expected:e},t,r))}function kn(e,t=new Set){if(!Bd(e))return!1;let r=Array.isArray(e),n=Object.getPrototypeOf(e);if(r||n===Object.prototype||n===null){if(t.has(e))return!0;t.add(e);try{if(r){for(let o=0;o<e.length;o++)if(kn(e[o],t))return!0}else for(let o of Object.keys(e))if(kn(e[o],t))return!0}finally{t.delete(e)}return!1}if(e instanceof Date||e instanceof Uint8Array||wu(e)||Qi(e)||Iu(e))return!1;if(t.has(e))return!0;t.add(e);try{if(ci(e))return de(e)&&kn(e.value,t);if(Bf(e))return kn(tt(e)?e.success:e.failure,t);if(ws(e))return kn(ft(e)?e.value:e.cause,t);if(sl(e))return e.reasons.some(o=>kn(o,t));if(il(e))switch(e._tag){case"Fail":return kn(e.error,t);case"Die":return kn(e.defect,t);case"Interrupt":return!1}if(vl(e)){for(let o of e)if(kn(o,t))return!0;return!1}if(Cy(e)){for(let[o,s]of e)if(kn(o,t)||kn(s,t))return!0;return!1}if(Oy(e)){for(let o of e)if(kn(o,t))return!0;return!1}if(am(e))return kn(nc(e),t);for(let o of Object.keys(e))if(kn(e[o],t))return!0}finally{t.delete(e)}return!1}function vE(e,t,r,n){let o=n.beginSized();zr(e,t,r,n),n.endSized(o)}function Kae(e,t,r){let n=globalThis.Symbol.keyFor(t);n===void 0&&ut("registered symbol",t,e.options),r.string(n)}function e4(e,t,r,n){let o=r;switch(o._tag){case"Fail":n.byte(0),zr(e,t.error,o.error,n);return;case"Die":n.byte(1),zr(e,t.defect,o.defect,n);return;case"Interrupt":o.fiberId===void 0?n.byte(2):(n.byte(3),n.f64(o.fiberId))}}function Vae(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function t4(e,t,r){if(e.layout!==t||e.keys.length!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.keys[n]!==r[n])return!1;return!0}function Gae(e,t){if(e.extraAll===void 0||t.length>Mae)return!1;let r=0;for(let n=0;n<t.length;n++)if(r+=t[n].length,r>Fae)return!1;return!0}function QR(e,t,r){let n=Object.keys(r),o=t.extraShape;if(o!==void 0&&t4(o,t,n))return o.pairs;let s=Gae(t,n),i=s?void 0:e.extraShape;if(i!==void 0&&t4(i,t,n))return i.pairs;let a=t.names,c=t.extraAll,u=[],f=!0;for(let m of n){if(a.has(m))continue;let h=c??(e.indexSignatures??=new Hh(e.options)).find(t,m);h!==void 0&&(f&&!Vae(m)&&(f=!1),u.push([m,h,void 0]))}if(f)u.sort((m,h)=>m[0]<h[0]?-1:m[0]>h[0]?1:0);else{for(let m of u)m[2]=$i.encode(m[0]);u.sort((m,h)=>b4(m[2],h[2]))}if(s)for(let m of u)m[2]??=$i.encode(m[0]);let p={layout:t,keys:n,pairs:u};return s?t.extraShape=p:e.extraShape=p,u}function YR(e,t,r,n,o){for(let[s,i,a]of t){let c=a===void 0?s.length:a.length,u=r[s],f=XR(i.layout,u,e.options),p=f%ds;if(o===void 0)n.uvarint(c*ds+p);else{if(!o.disabled){let m=F4(o,s);if(m!==void 0){n.uvarint(m*16+p*2+1),Ze[Q++]=s,qR(e,i.layout,u,f,n),Q--;continue}N4(o,s)}n.uvarint(c*16+p*2)}a===void 0?n.string(s):n.bytes(a),Ze[Q++]=s,qR(e,i.layout,u,f,n),Q--}}function XR(e,t,r){if(e._==="literal")return Zh(e,t)||ut(kE(e),t,r),XR(e.leaf,t,r);switch(e._){case"bool":return typeof t!="boolean"&&ut("a boolean",t,r),t?Gh:Vh;case"number":if(typeof t!="number"&&ut("a number",t,r),GR(t))return yf;{let n=JR(t);return n===0?Kh:n*ds+Jh}case"int":return Number.isSafeInteger(t)||ut("an integer",t,r),yf;default:return bf}}function qR(e,t,r,n,o){switch(n%ds){case Vh:case Gh:return;case yf:o.numberVarint(r);return;case Kh:o.f64(r);return;case Jh:{let i=Math.floor(n/ds);o.numberVarint(Math.round(r*_c[i])),o.uvarint(i);return}default:vE(e,t,r,o)}}function Jae(e,t,r,n){let o=XR(t.layout,r,e.options),s=o%ds;if(s===bf){let i=n.idAndMark(t.tagBytes);zr(e,t.layout,r,n),n.endSized(i);return}n.uvarint(t.id*ds+s),qR(e,t.layout,r,o,n)}function Zae(e,t){let r=e.byName;if(r===void 0)return;let n=Object.getOwnPropertyNames(t),o=0;for(let i=0;i<n.length;i++){let a=r.get(n[i]);a!==void 0&&(o|=1<<a)}let s=e.struct;if((o&s.requiredMask)!==s.requiredMask){let i=s.fields;for(let a=0;a<i.length;a++){let c=i[a];if(!c.optional&&(o&1<<a)===0)throw Ze[Q++]=c.name,dr(new Yt(c.annotations))}}return o}function Qae(e,t,r,n){let o=r;if(t.extra.length>0){let i=e.intern;e.intern=void 0;let a=QR(e,t,o);if(a.length>0){n.uvarint(0);let c=n.beginSized();YR(e,a,o,n,i),n.endSized(c)}}let s=t.fields;for(let i=0;i<s.length;i++){let a=s[i],c=a.name;if(!Object.hasOwn(o,c)){if(a.optional)continue;throw Ze[Q++]=c,dr(new Yt(a.annotations))}Ze[Q++]=c,Jae(e,a,o[c],n),Q--}}function Yae(e,t,r,n){let o=r,s=e.intern;e.intern=void 0;let i=t.optionalCount+7>>3,a=0;if(i>0){a=n.len;for(let f=0;f<i;f++)n.byte(0)}let c=t.fields,u=0;for(let f=0;f<c.length;f++){let p=c[f],m=p.name,h=Object.hasOwn(o,m);if(p.optional){if(h&&(n.buf[n.start+a+(u>>3)]|=1<<(u&7)),u++,!h)continue}else if(!h)throw Ze[Q++]=m,dr(new Yt(p.annotations));Ze[Q++]=m,p.inline?zr(e,p.layout,o[m],n):vE(e,p.layout,o[m],n),Q--}if(t.extra.length>0){let f=QR(e,t,o);n.uvarint(f.length),YR(e,f,o,n,s)}}function Xae(e){switch(e._){case"string":return ZR;case"array":return e.uniform?._==="string"?I4:xE;case"struct":return e.extra.length>0?T4:xE;default:return xE}}function ece(e){let t=e.uniform;if(t===void 0){if(e.rest.length!==1)return;t=e.rest[0];for(let r of e.elements)if(r.optional||r.layout!==t)return}return t._==="struct"?t:void 0}function M4(e){let t=e.run;if(t!==void 0)return t;let r=ece(e);if(r===void 0)return e.run=t=null,t;let n=r.fields.map(s=>Xae(s.layout)),o=r.fields.length<=w4;return t={struct:r,intern:n,shapes:o,byName:o&&r.extra.length===0?new Map(r.fields.map((s,i)=>[s.name,i])):void 0},e.run=t,t}var tce=16,rce=64;function r4(e,t){return e[t]??={values:[],refs:void 0,hits:0,disabled:!1}}function F4(e,t){let r=e.refs;if(r!==void 0){let o=r.get(t);return o!==void 0&&e.hits++,o}let n=e.values;for(let o=0;o<n.length;o++)if(n[o]===t)return e.hits++,o}function N4(e,t){let r=e.values;if(e.refs!==void 0){if(e.hits===0&&r.length>=rce){e.disabled=!0,e.refs=void 0;return}e.refs.set(t,r.length)}else if(r.length>=tce){let n=e.refs=new Map;for(let o=0;o<r.length;o++)n.set(r[o],o);n.set(t,r.length)}r.push(t)}var eO=0,nce=1,tO=2,oce=64,sce=512;function ice(){return{slots:[],marks:[],frame:0}}function U4(e,t){return e[t]??={values:[],refs:new Map,state:eO,stamp:-1}}function D4(e,t){if(e.refs.has(t)){e.state=nce;return}e.refs.set(t,e.values.length),e.values.push(t),e.values.length>=oce&&(e.state=tO)}function L4(e,t){let r=e.values;r.length>=sce||(e.refs.set(t,r.length),r.push(t))}function ace(e,t){t.stamp!==e.frame&&(t.stamp=e.frame,e.marks.push({slot:t,length:t.values.length,state:t.state}))}function cce(e){e.marks.length=0,e.frame++}function uce(e){let t=e.marks;for(let r=t.length-1;r>=0;r--){let{length:n,slot:o,state:s}=t[r],i=o.values;for(let a=n;a<i.length;a++)o.refs.delete(i[a]);i.length=n,o.state=s}t.length=0,e.frame++}function fce(e,t,r,n){let o=U4(e.slots,t.slot),s=o.state;if(s===tO){n.string(r);return}if(ace(e,o),s===eO){n.string(r),D4(o,r);return}let i=o.refs.get(r);if(i!==void 0){n.uvarint(i*2+1);return}n.byte(0),L4(o,r),n.string(r)}function lce(e,t,r){let n=U4(e,t.slot),o=n.state;if(o===tO)return r.readUtf8(r.end-r.pos);if(o===eO){let a=r.readUtf8(r.end-r.pos);return D4(n,a),a}let s=r.uvarint();if((s&1)===1){let a=(s-1)/2,c=n.values;return a>=c.length&&j("a dictionary reference",s,r.options),c[a]}s!==0&&j("a dictionary marker",s,r.options);let i=r.readUtf8(r.end-r.pos);return L4(n,i),i}function B4(e,t,r,n,o){if(!e.disabled){let i=F4(e,n);if(i!==void 0){o.uvarint(i*2+1);return}N4(e,n)}let s=o.beginSized();zr(t,r,n,o),o.endSizedRun(s)}function dce(e,t,r,n,o){let s=[],i=[];for(let a=0;a<n;a++){Ze[Q++]=a;let c=o.beginSized();pce(e,t,s,i,r[a],o),o.endSized(c),Q--}}function pce(e,t,r,n,o,s){let i=t.struct,a=o,c=i.fields,u;if(i.extra.length>0){let y=QR(e,i,a);y.length>0&&(u=y)}let f=!t.shapes,p=u===void 0?0:gE,m=Zae(t,a);if(m!==void 0)p=m;else for(let y=0;y<c.length;y++){let E=c[y];if(Object.hasOwn(a,E.name))f||(p|=1<<y);else if(!E.optional)throw Ze[Q++]=E.name,dr(new Yt(E.annotations))}let h=-1;for(let y=0;y<r.length;y++)if(r[y]===p){h=y;break}h>=0?s.uvarint(h+1):(s.uvarint(0),f||r.push(p));let x=h<0,g=e.positional&&!f;if(x&&g&&s.uvarint(p),u!==void 0){x&&!g&&s.uvarint(0);let y=s.beginSized();YR(e,u,a,s),s.endSizedRun(y)}for(let y=0;y<c.length;y++){let E=c[y];if(f?!Object.hasOwn(a,E.name):(p&1<<y)===0)continue;x&&!g&&s.uvarint(E.id),Ze[Q++]=E.name;let b=t.intern[y];if(b===ZR)B4(r4(n,y),e,E.layout,a[E.name],s);else{b!==xE&&(e.intern=r4(n,y));let v=s.beginSized();zr(e,E.layout,a[E.name],s),s.endSizedRun(v),e.intern=void 0}Q--}}function $4(e,t,r){let n=e.elements.length;if(t<n)return e.elements[t].layout;let o=Math.max(0,e.rest.length-1),s=Math.max(n,r-o);return t>=s?e.rest[t-s+1]:e.rest[0]}function mce(e,t,r,n){let o=r.length;if(t.rest.length===0&&o>t.elements.length)throw Ze[Q++]=t.elements.length,dr(new Fu(t.ast,r[t.elements.length],e.options));if(o<t.minCount)throw Ze[Q++]=o,dr(new Yt(void 0));if(t.hasCount&&n.uvarint(o),o>0){let i=M4(t);if(i!==null){dce(e,i,r,o,n);return}}let s=t.uniform;if(s!==void 0){if(t.uniformNumbers){hce(e,r,o,n);return}let i=e.intern;if(e.intern=void 0,i!==void 0){for(let c=0;c<o;c++)Ze[Q++]=c,B4(i,e,s,r[c],n),Q--;return}let a=t.uniformInline;for(let c=0;c<o;c++)Ze[Q++]=c,a?zr(e,s,r[c],n):vE(e,s,r[c],n),Q--;return}for(let i=0;i<o;i++){let a=$4(t,i,o);Ze[Q++]=i,jR(a)?zr(e,a,r[i],n):vE(e,a,r[i],n),Q--}}var n4=[];function hce(e,t,r,n){let o=!0,s=!0;for(let i=0;i<r;i++){let a=t[i];if(typeof a!="number"&&(Ze[Q++]=i,ut("a number",a,e.options)),GR(a))(a<0?-a:a)>DR&&(s=!1);else{o=!1;let c=JR(a);c===0?s=!1:n4[i]=c}if(!o&&!s)break}if(o){n.byte(x4);for(let i=0;i<r;i++)n.numberVarint(t[i])}else if(s){n.byte(g4);for(let i=0;i<r;i++){let a=t[i],c=Number.isInteger(a)?0:n4[i],u=c===0?a:Math.round(a*_c[c]),f=u<0||u===0&&1/u<0,p=f?-u:u;n.uvarint((p*2+(f?1:0))*16+c)}}else{n.byte(h4);for(let i=0;i<r;i++)n.f64(t[i])}}function xce(e){if(!(e.length<2||e.some(t=>t.tuple)))for(let t of e[0].sentinels){let r=new Map;for(let n of e){let o=n.sentinels.find(s=>s.key===t.key);if(o===void 0||r.has(o.literal)||Number.isNaN(o.literal))break;r.set(o.literal,n)}if(r.size===e.length)return{key:t.key,rows:r}}}function zR(e,t){let r=e.sentinels;for(let n=0;n<r.length;n++){let{key:o,literal:s}=r[n];if(t[o]!==s||!Object.hasOwn(t,o))return!1}return!0}function gce(e,t){return e.tuple?Array.isArray(t)&&zR(e,t):Jt(t)&&!Array.isArray(t)&&zR(e,t)}function o4(e,t,r,n){e.positional?n.uvarint(t.position):(n.byte(dt.variant),n.u32le(t.tag)),zr(e,t.payload,r,n)}function yce(e,t,r,n){let o=t.discriminator;if(o!==void 0){if(Jt(r)&&!Array.isArray(r)){let s=r,i=o.rows.get(s[o.key]);if(i!==void 0&&zR(i,s)){o4(e,i,r,n);return}}}else for(let s of t.variants)if(gce(s,r)){o4(e,s,r,n);return}for(let s of t.others)if(HR(s.layout,r)){e.positional?n.uvarint(s.position):n.byte(s.kind),zr(e,s.layout,r,n);return}throw dr(new at(t.ast,r,e.options))}function zr(e,t,r,n){switch(t._){case"literal":Zh(t,r)||ut(kE(t),r,e.options),zr(e,t.leaf,r,n);return;case"bool":typeof r!="boolean"&&ut("a boolean",r,e.options),n.byte(r===!0?1:0);return;case"null":r!==null&&ut("null",r,e.options);return;case"undefined":r!==void 0&&ut("undefined",r,e.options);return;case"number":{if(typeof r!="number"&&ut("a number",r,e.options),GR(r)){n.numberVarint(r);return}let o=JR(r);o>0?(n.numberVarint(Math.round(r*_c[o])),n.byte(o)):n.f64(r);return}case"int":{Number.isSafeInteger(r)||ut("an integer",r,e.options),n.numberVarint(r);return}case"string":{typeof r!="string"&&ut("a string",r,e.options);let o=e.dict;o===void 0?n.string(r):fce(o,t,r,n);return}case"symbol":typeof r!="symbol"&&ut("a symbol",r,e.options),Kae(e,r,n);return;case"bytes":r instanceof Uint8Array||ut("a Uint8Array",r,e.options),n.bytes(r);return;case"bigint":typeof r!="bigint"&&ut("a bigint",r,e.options),n.zigzag(r);return;case"int64":{HR(t,r)||ut(t.flavor==="date"?"a Date":"a DateTime.Utc",r,e.options);let o=t.flavor==="date"?r.getTime():r.epochMilliseconds;Number.isNaN(o)&&ut("a valid Date",r,e.options),n.i64(BigInt(o));return}case"dateTimeZoned":{HR(t,r)||ut("a DateTime.Zoned",r,e.options);let o=r;n.i64(BigInt(o.epochMilliseconds)),o.zone._tag==="Offset"?(n.byte(0),n.i32le(o.zone.offset)):(n.byte(1),n.string(o.zone.id));return}case"duration":{Qi(r)||ut("a Duration",r,e.options);let o=r.value;switch(o._tag){case"Infinity":n.byte(1);return;case"NegativeInfinity":n.byte(2);return;case"Nanos":n.byte(0),n.zigzag(o.nanos);return;case"Millis":n.byte(0),n.zigzag(BigInt(o.millis)*xae);return}}case"bigDecimal":{Iu(r)||ut("a BigDecimal",r,e.options);let o=Xp(r);n.zigzag(o.value),n.zigzag(BigInt(o.scale));return}case"json":{let o;try{o=JSON.stringify(r)}catch{o=void 0}o===void 0&&(kn(r)&&ut("acyclic value",r,e.options),ut("a JSON-serializable value",r,e.options)),n.string(o);return}case"option":{ci(r)||ut("an Option",r,e.options);let o=r;o._tag==="None"?n.byte(0):(n.byte(1),zr(e,t.value,o.value,n));return}case"result":{Bf(r)||ut("a Result",r,e.options);let o=r;o._tag==="Success"?(n.byte(0),zr(e,t.success,o.success,n)):(n.byte(1),zr(e,t.failure,o.failure,n));return}case"exit":{ws(r)||ut("an Exit",r,e.options);let o=r;o._tag==="Success"?(n.byte(0),zr(e,t.value,o.value,n)):(n.byte(1),zr(e,t.cause,o.cause,n));return}case"cause":{sl(r)||ut("a Cause",r,e.options);let o=r.reasons;n.uvarint(o.length);for(let s of o){let i=n.beginSized();e4(e,t,s,n),n.endSized(i)}return}case"causeReason":{il(r)||ut("a Cause.Reason",r,e.options),e4(e,t,r,n);return}case"struct":{(!Jt(r)||Array.isArray(r))&&ut("an object",r,e.options),e.positional?Yae(e,t,r,n):Qae(e,t,r,n);return}case"array":{Array.isArray(r)||ut("an array",r,e.options),mce(e,t,r,n);return}case"union":yce(e,t,r,n);return;case"never":throw dr(new at(t.ast,r,e.options))}}var mE=new TE;function s4(e,t,r,n,o){let s=o.beginSized();o.byte(n.envelope),n.positional&&o.bytes(n.fingerprint),zr(e,t,r,o),o.endSized(s)}function j4(e,t,r,n,o,s){let i={options:n,positional:o.positional,indexSignatures:void 0,extraShape:void 0,intern:void 0,dict:s},a=mE??new TE,c=a===mE;c&&(mE=void 0),a.reset();let u=Q,f=!1;try{if(r===void 0)Q=0,s4(i,e,t,o,a);else for(let m=0;m<r.length;m++)Q=0,s4(i,e,r[m],o,a);let p=a.out();return f=!0,p}finally{s!==void 0&&(f?cce(s):uce(s)),a.abort(),Q=u,c&&(mE=a)}}function H4(e,t,r,n,o){return j4(e,void 0,t,r,n,o)}function CE(e,t,r,n,o){return j4(e,t,void 0,r,n,o)}function _E(e){return ws(e)&&ft(e)}var kr=globalThis.Symbol.for("~effect/encoding/SchemaBinary/absent");function un(e,t){let r=Wh(e,t);return r!==kr&&t.pos!==t.end&&j("no leftover bytes",void 0,t.options),r}function q4(e,t){let r=t.enter(t.uvarint()),n=un(e,t);return t.exit(r),n}function z4(e,t){if(RE(e))return Wh(e,t);let r=OE(e),n=t.enter(r!==void 0?r:e._==="null"||e._==="undefined"?0:t.uvarint()),o=un(e,t);return t.exit(n),o}var Sce=8;function bce(e,t){let r=e.set;if(r!==void 0)return r.has(t)?!0:(r.add(t),!1);let n=e.list;if(n.includes(t))return!0;if(n.length>=Sce){let o=e.set=new Set;for(let s=0;s<n.length;s++)o.add(n[s]);o.add(t)}else n.push(t);return!1}function W4(e,t,r,n,o){let s=t.uvarint(),i=Math.floor(o===void 0?s/ds:s/16),a=o===void 0?s-i*ds:Math.floor((s-i*16)/2),c=o===void 0?t.readUtf8(i):Ece(o,s,i,t);e.names.has(c)&&j("an extra key distinct from declared fields",c,t.options),bce(n,c)&&j("unique extra keys",void 0,t.options);let u=e.extraAll??(t.indexSignatures??=new Hh(t.options)).find(e,c);if(u===void 0){rO(a,t);return}Ze[Q++]=c;let f=G4(u.layout,u.wireMask,a,t);Q--,f!==kr&&B(r,c,f)}function Ece(e,t,r,n){if((t&1)===1)return r>=e.length&&j("a known back-reference",void 0,n.options),e[r];let o=n.readUtf8(r);return e.push(o),o}function K4(e){return new At([e.name],new Yt(e.annotations))}function V4(e,t){throw dr(new Ft(e.ast,t))}function FR(e){for(;(e.byte()&128)!==0;);}function rO(e,t){switch(e){case bf:t.take(t.uvarint());return;case yf:FR(t);return;case Kh:t.take(8);return;case Vh:case Gh:case wae:return;case Jh:FR(t),FR(t);return;case Tae:t.take(4);return}}function WR(e){if(e._==="literal")return WR(e.leaf);switch(e._){case"bool":return 1<<Vh|1<<Gh;case"number":return 1<<yf|1<<Kh|1<<Jh;case"int":return 1<<yf;default:return 1<<bf}}function Ice(e,t){switch(e){case Vh:return!1;case Gh:return!0;case yf:return t.numberVarint();case Kh:return t.f64();case Jh:{let r=t.numberVarint(),n=t.uvarint();return(n===0||n>AE)&&j("a decimal scale in [1, 8]",n,t.options),r/_c[n]}}return j("matching field wire kind",void 0,t.options)}function G4(e,t,r,n){if((t&1<<r)===0)return rO(r,n),kr;if(r!==bf){let i=Ice(r,n);return e._==="literal"&&!Zh(e,i)&&j(kE(e),i,n.options),i}let o=n.enter(n.uvarint()),s=un(e,n);return n.exit(o),s}function Tce(e,t){let r;e.extra.length>0&&(r=t.intern,t.intern=void 0);let n={},o=0,s=0,i,a,c,u=!1,f=e.fields,p=0;for(;t.pos<t.end;){let m=t.fieldTag(),h=Math.floor(m/ds),x=m-h*ds;if(h===0){u&&j("unique field ids",void 0,t.options),u=!0,x!==bf&&j("extra field map",void 0,t.options);let b=t.enter(t.uvarint());Z4(e,t,n,r),t.exit(b);continue}let g;if(p<f.length&&f[p].id===h?(g=f[p],p++):(g=e.byId.get(h),g!==void 0&&(p=g.index+1)),g===void 0){c===void 0?c=new Set:c.has(h)&&j("unique field ids",void 0,t.options),c.add(h),rO(x,t);continue}let y=g.index;if(y<32){let b=1<<y;(o&b)!==0&&j("unique field ids",void 0,t.options),o|=b}else i===void 0?i=new Set([y]):(i.has(y)&&j("unique field ids",void 0,t.options),i.add(y));Ze[Q++]=g.name;let E=G4(g.layout,g.wireMask,x,t);Q--,E!==kr&&(B(n,g.name,E),y<32?s|=1<<y:(a??=new Set).add(y))}return J4(e,s,a,t),n}function J4(e,t,r,n){if((t&e.requiredMask)===e.requiredMask&&!e.requiredWide)return;let o=e.fields,s;for(let i=0;i<o.length;i++){let a=o[i],c=a.index,u=c<32?(t&1<<c)!==0:r?.has(c)===!0;if(!a.optional&&!u&&((s??=[]).push(K4(a)),n.options.errors!=="all"))break}s!==void 0&&V4(e,s)}function wce(e,t){let r;e.extra.length>0&&(r=t.intern,t.intern=void 0);let n={},o=e.optionalCount+7>>3,s=0;o>0&&(t.pos+o>t.end&&j("complete value",void 0,t.options),s=t.pos,t.pos+=o);let i=t.buf,a=e.fields,c=0,u;for(let f=0;f<a.length;f++){let p=a[f];if(p.optional){let h=(i[s+(c>>3)]&1<<(c&7))!==0;if(c++,!h)continue}Ze[Q++]=p.name;let m=p.inline?z4(p.layout,t):q4(p.layout,t);if(Q--,m!==kr)B(n,p.name,m);else if(!p.optional&&((u??=[]).push(K4(p)),t.options.errors!=="all"))break}if(u!==void 0&&V4(e,u),e.extra.length>0){let f=t.uvarint();if(f>t.remaining&&j("complete value",void 0,t.options),f>0){let p={list:[],set:void 0};for(let m=0;m<f;m++)W4(e,t,n,p,r)}}return n}function Z4(e,t,r,n){let o={list:[],set:void 0};for(;t.pos<t.end;)W4(e,t,r,o,n)}function vce(e,t,r){let n=r.uvarint();if((n&1)===1){let i=(n-1)/2;return i>=e.length&&j("a known back-reference",void 0,r.options),e[i]}if(t._==="string"){if(r.dict!==void 0){let a=r.enter(n/2),c=un(t,r);return r.exit(a),e.push(c),c}let i=r.readUtf8(n/2);return e.push(i),i}let o=r.enter(n/2),s=un(t,r);return r.exit(o),e.push(s),s}function Cce(e,t,r){let n=new Array(t),o=[],s=[];for(let i=0;i<t;i++){Ze[Q++]=i;let a=r.enter(r.uvarint());n[i]=kce(e,o,s,r),r.exit(a),Q--}return n}function Ace(e,t){let r=t.uvarint(),n=e.fields,o=r&~gE;(r>gE*2-1||o>>>n.length)&&j("a known row shape",void 0,t.options);let s=[];(r&gE)!==0&&s.push(null);for(let i=0;i<n.length;i++)(o&1<<i)!==0&&s.push(n[i]);return s}function kce(e,t,r,n){let o=e.struct,s={},i=0,a,c=n.uvarint(),u;if(c===0?n.positional&&e.shapes&&(u=Ace(o,n),t.push(u)):(u=t[c-1],u===void 0&&j("a known row shape",void 0,n.options)),u!==void 0){for(let f=0;f<u.length;f++){let p=i4(e,r,u[f],s,n);p>=0&&(p<32?i|=1<<p:(a??=new Set).add(p))}n.pos!==n.end&&j("no leftover bytes",void 0,n.options)}else{let f=e.shapes?[]:void 0,p=0,m,h,x=!1;for(;n.pos<n.end;){let g=n.uvarint(),y;g===0?(x&&j("unique field ids",void 0,n.options),x=!0,y=null):(y=o.byId.get(g),y===void 0?h===void 0?h=new Set([g]):h.has(g)?j("unique field ids",void 0,n.options):h.add(g):y.index<32?((p&1<<y.index)!==0&&j("unique field ids",void 0,n.options),p|=1<<y.index):m===void 0?m=new Set([y.index]):(m.has(y.index)&&j("unique field ids",void 0,n.options),m.add(y.index))),f?.push(y);let E=i4(e,r,y,s,n);E>=0&&(E<32?i|=1<<E:(a??=new Set).add(E))}f!==void 0&&t.push(f)}return J4(o,i,a,n),s}function i4(e,t,r,n,o){let s=o.uvarint();if((s&1)===1){if(r==null)return-1;let u=t[r.index],f=(s-1)/2;(u===void 0||f>=u.length)&&j("a known back-reference",void 0,o.options);let p=u[f];return p===kr?-1:(B(n,r.name,p),r.index)}let i=o.enter(s/2);if(r===null)return Z4(e.struct,o,n),o.exit(i),-1;if(r===void 0)return o.exit(i),-1;let a=e.intern[r.index];(a===I4||a===T4)&&(o.intern=t[r.index]??=[]),Ze[Q++]=r.name;let c=un(r.layout,o);return Q--,o.intern=void 0,o.exit(i),a===ZR&&(t[r.index]??=[]).push(c),c===kr?-1:(B(n,r.name,c),r.index)}function Rce(e,t){let r=e.elements.length,n=e.hasCount?t.uvarint():r;if(e.rest.length===0&&n>r)throw Ze[Q++]=r,dr(new Fu(e.ast,void 0,t.options));if(n<e.minCount)throw Ze[Q++]=n,dr(new Yt(void 0));if(e.hasCount){let i=e.rest.length>0&&v4(e.rest[0])?Iae:t.remaining+Eae;n>i&&j("array count within allocation limit",n,t.options)}if(n>0){let i=M4(e);if(i!==null)return Cce(i,n,t)}let o=new Array(n),s=e.uniform;if(s!==void 0){if(e.uniformNumbers)return Oce(o,n,t);let i=t.intern;if(t.intern=void 0,i!==void 0){for(let u=0;u<n;u++){Ze[Q++]=u;let f=vce(i,s,t);if(f===kr)throw dr(new Yt(void 0));Q--,o[u]=f}return o}if(RE(s)){for(let u=0;u<n;u++)Ze[Q++]=u,o[u]=Wh(s,t),Q--;return o}if(s._==="string"){for(let u=0;u<n;u++)Ze[Q++]=u,o[u]=t.dict===void 0?t.readUtf8(t.uvarint()):q4(s,t),Q--;return o}let a=e.uniformPacked,c=e.uniformInline;for(let u=0;u<n;u++){Ze[Q++]=u;let f=t.enter(c?a??0:t.uvarint()),p=un(s,t);if(t.exit(f),p===kr)throw dr(new Yt(void 0));Q--,o[u]=p}return o}for(let i=0;i<n;i++){let a=$4(e,i,n),c=i<r&&e.elements[i].optional;if(!e.hasCount&&t.remaining===0&&!c&&a._!=="null"&&a._!=="undefined")throw Ze[Q++]=i,dr(new Yt(void 0));Ze[Q++]=i;let u=z4(a,t);if(u===kr)throw c&&j("known union member",void 0,t.options),dr(new Yt(void 0));Q--,o[i]=u}if(!e.hasCount&&t.pos<t.end)throw Ze[Q++]=r,dr(new Fu(e.ast,void 0,t.options));return o}function Oce(e,t,r){let n=r.byte();if(n===h4){r.remaining!==t*8&&j("f64",void 0,r.options);for(let o=0;o<t;o++)e[o]=r.f64();return e}if(n===g4){for(let o=0;o<t;o++){Ze[Q++]=o;let s=r.uvarint(),i=s%16;i>AE&&j("decimal",void 0,r.options);let a=y4((s-i)/16);e[o]=i===0?a:a/_c[i],Q--}return e}n!==x4&&j("f64",void 0,r.options);for(let o=0;o<t;o++)Ze[Q++]=o,e[o]=r.numberVarint(),Q--;return e}function _ce(e,t){let r=t.byte();if(r===dt.variant){let o=t.u32le(),s=e.byTag.get(o);if(s===void 0)return t.take(t.remaining),kr;let i=un(s.payload,t);if(i===kr)return kr;if(!s.tuple)for(let a of s.sentinels)B(i,a.key,a.literal);return i}let n=e.byKind.get(r);return n===void 0?(t.take(t.remaining),kr):un(n,t)}function Pce(e,t){let r=e.byPos[t.uvarint()];r===void 0&&j("known union member",void 0,t.options);let n=un(r.layout,t),o=r.variant;if(o!==void 0&&!o.tuple&&n!==kr)for(let s of o.sentinels)B(n,s.key,s.literal);return n}function a4(e,t){switch(t.byte()){case 0:return vp(Od(un(e.error,t)));case 1:return Cp(Od(un(e.defect,t)));case 2:return t.remaining!==0&&j("empty",void 0,t.options),Ap();case 3:return t.remaining!==8&&j("f64",void 0,t.options),Ap(t.f64());default:return t.take(t.remaining),kr}}function Od(e){if(e===kr)throw dr(new Yt(void 0));return e}function Wh(e,t){t.nesting>=KW&&j(`nesting depth at most ${KW}`,t.nesting+1,t.options),t.nesting++;try{return Mce(e,t)}finally{t.nesting--}}function Mce(e,t){switch(e._){case"literal":{let r=Wh(e.leaf,t);return Zh(e,r)||j(kE(e),r,t.options),r}case"bool":{t.remaining!==1&&j("bool",void 0,t.options);let r=t.byte();return r>1&&j("bool",void 0,t.options),r===1}case"null":return t.remaining!==0&&j("empty",void 0,t.options),null;case"undefined":t.remaining!==0&&j("empty",void 0,t.options);return;case"number":{let r=t.remaining;if(r===8)return t.f64();(r===0||r>m4)&&j("f64",void 0,t.options);let n=t.numberVarint();if(t.remaining===0)return n;let o=t.byte();return(t.remaining!==0||o===0||o>AE)&&j("decimal",void 0,t.options),n/_c[o]}case"int":return t.numberVarint();case"string":{let r=t.dict;return r===void 0?t.readUtf8(t.end-t.pos):lce(r,e,t)}case"symbol":return globalThis.Symbol.for(t.readUtf8(t.end-t.pos));case"bytes":return t.takeCopy(t.end-t.pos);case"bigint":return t.zigzag();case"int64":{t.remaining!==8&&j("int64",void 0,t.options);let r=Number(t.i64()),n=new Date(r);return Number.isNaN(n.getTime())&&j(e.flavor==="date"?"a valid Date":"a valid DateTime",r,t.options),e.flavor==="date"?n:Sy(r)}case"dateTimeZoned":{let r=Number(t.i64()),n=t.byte(),o;if(n===0)t.remaining!==4&&j("time zone",void 0,t.options),o=t.i32le();else if(n===1)o=t.readUtf8(t.end-t.pos);else return j("time zone",void 0,t.options);try{return by(r,{timeZone:o})}catch{return j("time zone",void 0,t.options)}}case"duration":switch(t.byte()){case 0:return $o(t.zigzag());case 1:return Ss;case 2:return Da;default:return j("duration",void 0,t.options)}case"bigDecimal":{let r=t.zigzag(),n=t.zigzag();return(n>UR||-n>UR)&&j("safe integer length",void 0,t.options),my(r,Number(n))}case"json":{let r=t.readUtf8(t.end-t.pos);try{return JSON.parse(r)}catch{return j("json",void 0,t.options)}}case"option":{let r=t.byte();return r===0?(t.remaining!==0&&j("empty",void 0,t.options),_()):(r!==1&&j("bool",void 0,t.options),N(Od(un(e.value,t))))}case"result":{let r=t.byte();return r===0?X(Od(un(e.success,t))):(r!==1&&j("bool",void 0,t.options),re(Od(un(e.failure,t))))}case"exit":{let r=t.byte();if(r===0)return Mr(Od(un(e.value,t)));r!==1&&j("bool",void 0,t.options);let n=Wh(e.cause,t);return ir(n)}case"cause":{let r=t.uvarint(),n=[];for(let o=0;o<r;o++){Ze[Q++]=o;let s=t.enter(t.uvarint()),i=a4(e,t);t.exit(s),Q--,i!==kr&&n.push(i)}return t.pos!==t.end&&j("no leftover bytes",void 0,t.options),cu(n)}case"causeReason":return a4(e,t);case"struct":return t.positional?wce(e,t):Tce(e,t);case"array":return Rce(e,t);case"union":return t.positional?Pce(e,t):_ce(e,t);case"never":throw dr(new at(e.ast,void 0,t.options))}}function Q4(e,t,r){let n=t.byte();if(n!==r.envelope&&j(r.expectedEnvelope,n,t.options),r.positional){t.remaining<8&&j("complete value",void 0,t.options);let s=t.buf,i=r.fingerprint,a=t.pos;for(let c=0;c<8;c++)s[a+c]!==i[c]&&j("matching layout fingerprint",void 0,t.options);t.pos=a+8}let o=un(e,t);if(o===kr)throw dr(new Yt(void 0));return o}var hE=new qh;function Fce(e,t,r,n){let o=hE??new qh,s=o===hE;s&&(hE=void 0),o.reset(t,0,t.length,r,void 0,n.positional,void 0);let i=Q;Q=0;try{let a=o.uvarint();a===0&&j("nonzero frame length",void 0,r);let c=o.enter(a),u=Q4(e,o,n);return o.exit(c),o.pos!==t.length&&j("no leftover bytes",void 0,r),u}finally{Q=i,o.release(),s&&(hE=o)}}function Nce(e,t,r,n=!1){return Xt({decode:(o,s)=>{try{let i=Fce(e,o,s,t);return r!==void 0&&Bd(i)&&(!n||_E(i))&&(r.value=i),I(i)}catch(i){return i instanceof ji?D(i.issue):gn(i)}},encode:(o,s)=>{try{return I(CE(e,o,s,t))}catch(i){return i instanceof ji?D(i.issue):gn(i)}}})}var Uce=mo(Wae);function Sf(e,t){return t===!0?Uce(e):zae}var Dce=mo(e=>{let t=J(yE(e)),{exact:r,exitSuccess:n,layout:o,recursive:s}=$ae(t.ast);return{target:s?Hce(t):t,layout:o,exact:r,exitSuccess:n,recursive:s}});function Pd(e){return Dce(e.ast)}function Y4(e,t){return e.value===void 0||t!==e.value?!1:(e.value=void 0,!0)}function X4(e,t,r){let n=J(Nt(e.ast)),o=ot(n),s=i=>()=>(a,c,u)=>i(a,u)?nt:o(a,u);return J(new uc([n.ast],s(t),{identifier:"binary value"},void 0,void 0,void 0,void 0,s(r)))}function KR(e,t){return t.onExcessProperty!=="error"}function Lce(e,t,r){return X4(e,n=>Y4(t,n),r?KR:Bce)}function Bce(){return!1}function $ce(e,t){return Cr()([e],([r])=>{let n=ot(r);return(o,s,i)=>Y4(t,o)||_E(o)&&i.onExcessProperty!=="error"?I(o):n(o,i)},{identifier:"binary exit value"})}function jce(e){return X4(e,KR,KR)}function Hce(e){let t=J(Nt(e.ast)),r=new WeakSet,n=Cr()([t],([o])=>(s,i,a)=>Bd(s)&&r.delete(s)?I(s):kn(s)?D(new at(i,s,a)):ot(o)(s,a),{identifier:"acyclic value"});return ee(n,Fe({decode:o=>(Bd(o)&&r.add(o),o),encode:o=>o}))(e)}var ME=tf,zce,n6=e=>(zce??=new TextDecoder).decode(e),fn=class extends Ue()("effect/rpc/RpcSerialization"){},PE=class extends sr("MaxBufferSizeExceeded"){get message(){return`RPC serialization buffer exceeded the maximum size of ${this.maxBufferSize}`}},Wce=16*1024*1024,e6=(e,t)=>t!=="unbounded"&&e>t,o6=fn.of({contentType:"application/json",includesFraming:!1,codecFor:ME,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e=="string"?e:n6(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),FE=e=>{let t=e?.maxBufferSize??Wce;return fn.of({contentType:"application/ndjson",includesFraming:!0,codecFor:ME,makeUnsafe:()=>{let r,n="",o=s=>{throw n="",new PE({maxBufferSize:s})};return{decode:s=>{n+=typeof s=="string"?s:(r??=new TextDecoder).decode(s,{stream:!0});let i=0,a=n.indexOf(`
|
|
32
|
+
`,h)));r=r+m.substring(h)}}return bt(u)?u:null}let i=L(()=>o._tag==="Some"?se(o.value):Dp(e,{onSuccess:a,onFailure:je,onDone:c=>{if(o=N(c),r.length>0){let u=r;return r="",n=!1,I([u])}return se(c)}}));function a(c){let u=s(c);return u!==null?I(u):i}return i}));var ek=d(2,(e,t)=>De((r,n)=>A(we(e)(r,n),o=>we(t)(o,n)))),tk=d(2,(e,t)=>De((r,n)=>A(we(e)(r,n),o=>{let s=rt(o,i=>wo(i)?je(i):gn(bN(i)));return K(we(t)(s,n),i=>q0(i,a=>Op(a)?je(a.value):gn(a)))}))),Tc=e=>De((t,r)=>{let n;return I(L(()=>n||e.pipe(zo(r),A(o=>we(o)(t,r)),A(o=>n=o))))}),hq=e=>Vs((t,r,n)=>K(zo(we(e)(t,r),n),zo(n)));var xq=d(2,(e,t)=>De(me(function*(r,n){let o=yield*we(e)(r,n),s=yield*io({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*It(n,ss(s)),yield*o.pipe(A(i=>jn(s,i)),Mt({disableYield:!0}),to(i=>Ht(s,i)),gt(n)),Ws(s)}))),gq=d(2,(e,t)=>De(me(function*(r,n){let o=yield*we(e)(r,n),s=yield*io({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*It(n,ss(s)),yield*o.pipe(A(i=>wa(s,i)),Mt({disableYield:!0}),to(i=>Ht(s,i)),gt(n)),af(s)}))),rk=d(2,(e,t)=>_b(e,qr(I(A(t,se))),{haltStrategy:"either"})),yq=d(2,(e,t)=>Vs(me(function*(r,n,o){let s=yield*we(e)(r,n),i=yield*gt(t,o,{startImmediately:!0});return L(()=>{let a=i.pollUnsafe();return a===void 0?s:TN(a,{onFailure:je,onSuccess:se})})}))),Sq=d(2,(e,t)=>mh(e,r=>vs(r)?t(r.cause):P)),mh=d(2,(e,t)=>Vs((r,n,o)=>Wo(o,t).pipe(Vt(we(e)(r,n))))),bq=d(2,(e,t)=>Tc(Pt(t,e))),nk=d(2,(e,t)=>is(e,r=>W(()=>{let n=!0,o=_t(r,s=>(n=!1,t(s)));return L(()=>n?o:r)}))),Eq=d(2,(e,t)=>is(e,r=>I(ht(r,n=>A(t,()=>se(n)))))),Iq=d(2,(e,t)=>mh(e,r=>t)),ff=(e,t,r)=>L(()=>{let n=Zn(),o=we(e)(se(),n);return ht(A(o,t),r||I).pipe(Xr(s=>Ve(n,s)))});var Pb=d(2,(e,t)=>De((r,n)=>K(Ur(we(e)(r,n),t),Ur(t)))),Mb=d(3,(e,t,r)=>De((n,o)=>K(Jo(we(e)(n,o),t,r),Jo(t,r)))),Fb=d(3,(e,t,r)=>De((n,o)=>A(r,s=>we(Mb(e,t,s))(n,o)))),Tq=d(e=>on(e[0]),(e,t,r)=>ip(t)?Pb(e,t):De((n,o)=>A(r?.local?gi(t,xi(),o):_p(t,o),s=>K(Ur(we(e)(n,o),s),Ur(s))))),wq=d(2,(e,t)=>De((r,n)=>yn(o=>{let s=t(o);return we(Pb(e,s))(r,n)})));var ok=function(){let e=on(arguments[0]),t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return EH(n,t,r)}return n=>EH(n,t,r)},EH=(e,t,r)=>Bre(tw(t,r),n=>Mb(e,li,n),(n,o)=>ar(s=>{let i=s.getRef(Vn),a=s.getRef(jg);return Mg(n,o,i,a)}));var vq=e=>ff(e,t=>Mt(t,{disableYield:!0})),lf=d(2,(e,t)=>ff(e,r=>Mt(A(r,t),{disableYield:!0}))),Cq=d(2,(e,t)=>ff(e,r=>r.pipe(A(t),A(n=>n?P:se()),Mt({disableYield:!0})))),sk=e=>K(df(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let i=t[s];n.set(i,o),o+=i.length}return n});var Aq=e=>L(()=>{let t=_();return ff(e,r=>r.pipe(iy,A(n=>(t=n,se()))),()=>I(t))}),kq=e=>L(()=>{let t=Symbol(),r=t;return ff(e,n=>Mt(A(n,o=>(r=o,P)),{disableYield:!0}),()=>r===t?ia:B0(r))}),df=d(3,(e,t,r)=>L(()=>{let n=t();return ff(e,o=>xn({while:nr,body:()=>o,step:s=>{n=r(n,s)}}),()=>I(n))})),Rq=d(3,(e,t,r)=>L(()=>{let n=t();return ff(e,o=>xn({while:nr,body:qe(o.pipe(A(s=>r(n,s)),K(s=>{n=s}))),step:Rr}),()=>I(n))})),ik=me(function*(e){let t=uf(1),r=yield*Nr(),n=Re(r,it);return(yield*we(e)(se(),n)).pipe(Ur(r),t.withPermits(1))},rt(e=>I(je(e)))),as=(e,t)=>we(e)(se(),t);var ak=d(e=>on(e[0]),(e,t)=>en(r=>lf(e,n=>wa(t,n)).pipe(r,eo,A(n=>(ft(n)?Eb(t):Ui(t,n.cause),P)))));var Oq=d(e=>on(e[0]),me(function*(e,t){let r=yield*Co,n=yield*io({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*It(r,ss(n)),yield*gt(ak(e,n),r),n}));var _q=e=>Ti(e.capacity==="unbounded"?uh(e):e.strategy==="dropping"?lb(e):e.strategy==="sliding"?db(e):fb(e),fh),Pq=d(2,me(function*(e,t){let r=yield*_q(t);return yield*Rs(ck(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),ck=d(e=>on(e[0]),(e,t,r)=>lf(e,n=>aH(t,n)).pipe(r?.shutdownOnEnd===!0?wi(fh(t)):F)),Mq=d(2,me(function*(e,t){let r=yield*_q(t);return yield*lf(e,n=>mb(r,n)).pipe(Xr(n=>pb(r,n)),Rs),r}));var Wre="~effect/Stream",Kre={_R:F,_E:F,_A:F},Fq=function(e){this.channel=e};Fq.prototype={[Wre]:Kre,pipe(){return V(this,arguments)}};var Nq=e=>new Fq(e);var Gre="~effect/Sink";var Jre={_A:F,_In:F,_L:F,_E:F,_R:F},Zre={[Gre]:Jre,pipe(){return V(this,arguments)}};var Qre=e=>{let t=Object.create(Zre);return t.transform=e,t},Uq=e=>De((t,r)=>I(A(e.transform(t,r),se)));var Dq=e=>{let t=Bt(e);return Qre(r=>{let n=[];if(t===0)return I([n]);let o;return r.pipe(A(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?se():P;for(let i=0;i<s.length;i++)if(n.push(s[i]),n.length===t)return i+1<s.length&&(o=s.slice(i+1)),se();return P}),Mt({disableYield:!0}),ht(()=>I([n,o])))})};var sn={};ps(sn,{DefaultChunkSize:()=>Qq,Do:()=>Fse,TypeId:()=>Zq,accumulate:()=>bse,aggregate:()=>dse,aggregateWithin:()=>Tk,as:()=>Rne,bind:()=>Use,bindEffect:()=>Dse,bindTo:()=>Lse,broadcast:()=>wz,broadcastN:()=>pse,buffer:()=>Soe,bufferArray:()=>boe,callback:()=>Db,catch:()=>bh,catchCause:()=>fz,catchCauseFilter:()=>Ooe,catchCauseIf:()=>Roe,catchDefect:()=>Eoe,catchFilter:()=>Ek,catchIf:()=>dz,catchReason:()=>Coe,catchReasons:()=>Aoe,catchTag:()=>woe,catchTags:()=>voe,changes:()=>vz,changesWith:()=>Cz,changesWithEffect:()=>Ese,chunks:()=>Sz,collect:()=>Sse,combine:()=>Joe,combineArray:()=>Zoe,concat:()=>mf,cross:()=>Xne,crossWith:()=>cz,debounce:()=>rse,decodeText:()=>Ise,die:()=>pne,drain:()=>Lne,drainFork:()=>Bne,drop:()=>Ik,dropRight:()=>Koe,dropUntil:()=>qoe,dropUntilEffect:()=>zoe,dropWhile:()=>gz,dropWhileEffect:()=>yz,dropWhileFilter:()=>Woe,empty:()=>Js,encodeText:()=>Tse,ensuring:()=>Eh,fail:()=>wc,failCause:()=>ez,failCauseSync:()=>mne,failSync:()=>dne,filter:()=>yk,filterEffect:()=>poe,filterMap:()=>doe,filterMapEffect:()=>moe,flatMap:()=>Id,flatten:()=>sz,flattenArray:()=>Dne,flattenEffect:()=>_ne,flattenIterable:()=>Wne,flattenTake:()=>Kne,forever:()=>zne,fromArray:()=>yh,fromArrayEffect:()=>yne,fromArrays:()=>Sne,fromAsyncIterable:()=>bne,fromChannel:()=>U,fromEffect:()=>Ub,fromEffectDrain:()=>Yq,fromEffectRepeat:()=>Xq,fromEffectSchedule:()=>cne,fromEventListener:()=>Tne,fromIterable:()=>hf,fromIterableEffect:()=>xne,fromIterableEffectRepeat:()=>gne,fromIteratorSucceed:()=>hne,fromPubSub:()=>pk,fromPubSubTake:()=>tz,fromPull:()=>Li,fromQueue:()=>Sh,fromReadableStream:()=>mk,fromSchedule:()=>Ene,fromSubscription:()=>Ine,groupAdjacentBy:()=>fse,groupBy:()=>cse,groupByKey:()=>use,grouped:()=>ise,groupedWithin:()=>ase,haltWhen:()=>kse,ignore:()=>Foe,ignoreCause:()=>Noe,interleave:()=>Cse,interleaveWith:()=>kz,interruptWhen:()=>Ase,intersperse:()=>Az,intersperseAffixes:()=>vse,isStream:()=>Ae,iterate:()=>vne,let:()=>Nse,limitBytes:()=>Boe,make:()=>fne,map:()=>ao,mapAccum:()=>Qoe,mapAccumArray:()=>gf,mapAccumArrayEffect:()=>Xoe,mapAccumEffect:()=>Yoe,mapArray:()=>nz,mapArrayEffect:()=>Pne,mapBoth:()=>One,mapEffect:()=>xf,mapError:()=>pz,merge:()=>hk,mergeAll:()=>Yne,mergeEffect:()=>Lb,mergeLeft:()=>Zne,mergeResult:()=>Jne,mergeRight:()=>Qne,mkArrayBuffer:()=>Jse,mkString:()=>Gse,mkUint8Array:()=>Zse,never:()=>Ane,onEnd:()=>Ose,onError:()=>Rse,onExit:()=>Rz,onFirst:()=>_z,onStart:()=>Oz,orDie:()=>Moe,orElseIfEmpty:()=>_oe,orElseSucceed:()=>Poe,paginate:()=>wne,partition:()=>xoe,partitionEffect:()=>hoe,partitionQueue:()=>Sk,peel:()=>yoe,pipeThrough:()=>yse,pipeThroughChannel:()=>xse,pipeThroughChannelOrFail:()=>gse,prepend:()=>Gne,provide:()=>Pz,provideContext:()=>wk,provideService:()=>_se,provideServiceEffect:()=>vk,race:()=>loe,raceAll:()=>uz,range:()=>Cne,rechunk:()=>bz,repeat:()=>$ne,repeatElements:()=>qne,result:()=>Mne,retry:()=>Uoe,run:()=>Bse,runCollect:()=>Fz,runCount:()=>$se,runDrain:()=>$b,runFold:()=>Hse,runFoldEffect:()=>qse,runForEach:()=>Kse,runForEachArray:()=>Td,runForEachWhile:()=>Vse,runHead:()=>zse,runIntoPubSub:()=>eie,runIntoQueue:()=>nie,runLast:()=>Wse,runSum:()=>jse,scan:()=>ese,scanEffect:()=>tse,schedule:()=>jne,scoped:()=>kne,service:()=>ine,serviceOption:()=>ane,share:()=>hse,sliding:()=>Voe,slidingSize:()=>Ez,split:()=>Goe,splitLines:()=>wse,succeed:()=>pf,suspend:()=>vn,switchMap:()=>Une,sync:()=>lne,take:()=>Loe,takeRight:()=>$oe,takeUntil:()=>mz,takeUntilEffect:()=>hz,takeWhile:()=>xz,takeWhileEffect:()=>Hoe,takeWhileFilter:()=>joe,tap:()=>oz,tapBoth:()=>Fne,tapCause:()=>lz,tapDefect:()=>Toe,tapError:()=>bk,tapErrorTag:()=>Ioe,tapSink:()=>Nne,throttle:()=>sse,throttleEffect:()=>Iz,tick:()=>une,timeout:()=>Hne,timeoutOrElse:()=>iz,toAsyncIterable:()=>Xse,toAsyncIterableEffect:()=>Yse,toAsyncIterableWith:()=>Rk,toChannel:()=>cs,toPubSub:()=>tie,toPubSubTake:()=>Nz,toPull:()=>Ck,toQueue:()=>rie,toReadableStream:()=>Qse,toReadableStreamEffect:()=>kk,toReadableStreamWith:()=>Ak,transduce:()=>lse,transformPull:()=>br,transformPullBracket:()=>dk,unfold:()=>rz,unwrap:()=>Cn,unwrapReason:()=>koe,updateContext:()=>Mz,updateService:()=>Pse,when:()=>goe,withExecutionPlan:()=>Doe,withSpan:()=>Mse,zip:()=>toe,zipFlatten:()=>ooe,zipLatest:()=>uoe,zipLatestAll:()=>gk,zipLatestWith:()=>foe,zipLeft:()=>roe,zipRight:()=>noe,zipWith:()=>xk,zipWithArray:()=>Bb,zipWithIndex:()=>soe,zipWithNext:()=>ioe,zipWithPrevious:()=>aoe,zipWithPreviousAndNext:()=>coe});var Bq="~effect/RcMap",Yre=e=>({[Bq]:Bq,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:Si()},pipe(){return V(this,arguments)}}),$q=e=>ar(t=>{let r=t.context,n=Re(r,it),o=Yre({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive=="function"?$c(e.idleTimeToLive,$e):qe($e(e.idleTimeToLive??Ji)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return Pt(Wo(n,()=>{if(o.state._tag==="Closed")return P;let s=o.state.map;return o.state={_tag:"Closed"},Ko(s,([,i])=>eo(hh(i))).pipe(_t(()=>W(()=>{ny(s)})))}),o)}),uk=d(2,(e,t)=>en(r=>{if(e.state._tag==="Closed")return Dn;let n=e.state,o=os(),s=Qr(n.map,t),i;if(s._tag==="Some")i=s.value,i.refCount++;else{if(Number.isFinite(e.capacity)&&TU(e.state.map)>=e.capacity)return D(new EN(`RcMap attempted to exceed capacity of ${e.capacity}`));{i={deferred:lu(),scope:Zn(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},i.finalizer=ene(e,t,i),bi(n.map,t,i);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((f,p)=>{c.set(p,f)}),c.set(it.key,i.scope);let u=qn(c);L(()=>e.lookup(t)).pipe(Sr(u),Ni(i.scope)).addObserver(f=>{IN(f)&&Xre(e,t,i,u),hi(i.deferred,f)})}}let a=dn(o.context,it);return It(a,i.finalizer).pipe(Vt(r(Bg(i.deferred))))}));var Xre=(e,t,r,n)=>{if(e.state._tag==="Closed")return;let o=Qr(e.state.map,t);o._tag==="None"||o.value!==r||(Ei(e.state.map,t),!(r.refCount>0)&&hh(r).pipe(Sr(n),Ni(e.scope)))},hh=e=>e.fiber?Tn(e.fiber).pipe(Vt(Ve(e.scope,Kt))):Ve(e.scope,Kt),ene=(e,t,r)=>ar(n=>{if(r.refCount--,r.refCount>0)return P;if(e.state._tag==="Closed")return hh(r);let o=Qr(e.state.map,t);if(o._tag==="None"||o.value!==r)return hh(r);if(Hf(r.idleTimeToLive))return Ei(e.state.map,t),hh(r);if(!Wn(r.idleTimeToLive))return P;let s=n.getRef(Yn);return r.expiresAt=s.currentTimeMillisUnsafe()+Wt(r.idleTimeToLive),r.fiber?P:(r.fiber=en(function i(a){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag==="Closed"||r.refCount>0)return P;let f=Qr(e.state.map,t);return f._tag==="None"||f.value!==r?P:(Ei(e.state.map,t),Ve(r.scope,Kt))}return A(a(s.sleep(Zi(u))),()=>i(a))}).pipe(wi(W(()=>{r.fiber=void 0})),Sr(n.context),Ni(e.scope)),P)});var fk=d(2,(e,t)=>bu(r=>{if(e.state._tag==="Closed")return P;let n=Qr(e.state.map,t);if(n._tag==="None"||Hf(n.value.idleTimeToLive))return P;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+Wt(o.idleTimeToLive),P}));var tne="~effect/RcRef",xh={_tag:"Empty"},rne={_tag:"Closed"},nne={_A:F,_E:F},lk=class{[tne]=nne;pipe(){return V(this,arguments)}state=xh;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},qq=e=>ar(t=>{let r=t.context,n=Re(r,it),o=new lk(e.acquire,r,n,e.idleTimeToLive!==void 0?$e(e.idleTimeToLive):void 0);return Pt(Wo(n,()=>{let s=o.state;return o.state=rne,s._tag==="Acquired"?Ve(s.scope,Kt):s._tag==="Acquiring"?Tn(s.fiber):P}),o)}),one=(e,t)=>{switch(e.state._tag){case"Closed":return Dn;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?Pt(Tn(r.fiber),r):I(r)}case"Acquiring":{let r=e.state;return r.awaiters++,Hq(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Zn(),o=Ur(e.acquire,We(e.context,it,n)).pipe(A(s=>{if(e.state!==r)return Dn;let i={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=i,r.acquired=i,I(i)}),Xr(s=>ft(s)?P:(e.state===r&&(e.state=xh),Ve(n,s))));return r.fiber=Sr(os().context)(o),Hq(e,r,t)}}},Hq=(e,t,r)=>Xr(r(bc(t.fiber)),n=>{let o=t.acquired;return o!==void 0?vs(n)?Wq(e,o):P:--t.awaiters>0||e.state!==t?P:(e.state=xh,Tn(t.fiber))}),zq=e=>{let t=e;return en(r=>A(Co,n=>A(one(t,r),o=>Pt(Wo(n,()=>Wq(t,o)),o.value))))},Wq=(e,t)=>{if(t.refCount--,t.refCount>0)return P;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=xh),Ve(t.scope,Kt)):Wn(r)?(t.fiber=en(n=>A(n(ua(r)),()=>e.state===t&&t.refCount===0?(e.state=xh,Ve(t.scope,Kt)):P)).pipe(wi(W(()=>{t.fiber=void 0})),Sr(e.context),Ni(e.scope)),P):P};var Kq=qq,Vq=zq;var Zq="~effect/Stream",Ae=e=>O(e,Zq),Qq=dh,U=Nq,Ub=e=>U(Cb(K(e,Me))),ine=e=>Ub(Y0(e)),ane=e=>Ub(yu(e)),Yq=e=>Li(I(A(e,()=>se()))),Xq=e=>Li(I(K(e,Me))),cne=(e,t)=>Li(xt(function*(){let r=yield*ks(t),n=yield*Jo(e,Fr,Fr.defaultValue()),o=!0,s=L(()=>r(n)).pipe(A(i=>Jo(e,Fr,i)),K(i=>(n=i,Me(i))));return L(()=>o?(o=!1,I(Me(n))):s)})),une=e=>Li(W(()=>{let t=!0,r=I(Me(void 0)),n=ca(r,e);return L(()=>t?(t=!1,r):n)})),Li=e=>U(qr(e)),br=(e,t)=>U(De((r,n)=>A(as(e.channel,n),o=>t(o,n)))),dk=(e,t)=>U(Vs((r,n,o)=>A(as(e.channel,n),s=>t(s,n,o)))),cs=e=>e.channel,Db=(e,t)=>U(TH(e,t)),Js=U(Sd),pf=e=>U(vb(Me(e))),fne=(...e)=>yh(e),lne=e=>U(CH(()=>Me(e()))),vn=e=>U(wb(()=>e().channel)),wc=e=>U(Di(e)),dne=e=>U(kH(e)),ez=e=>U(ph(e)),pne=e=>U(JA(e)),mne=e=>U(RH(e)),hne=(e,t)=>U(GA(()=>e,t)),hf=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?yh(e):U(vH(e,t?.chunkSize)),xne=e=>Cn(K(e,hf)),gne=e=>Id(Xq(e),hf),yh=e=>bt(e)?U(vb(e)):Js,yne=e=>Cn(K(e,yh)),Sne=(...e)=>U(VA(Hx(e,bt))),Sh=e=>U(_H(e)),pk=e=>U(PH(e)),tz=e=>U(MH(e)),mk=e=>U(FH(e)),bne=(e,t)=>U(NH(e,t)),Ene=e=>Li(K(Lp(e),t=>ht(K(t(void 0),Me),()=>se()))),Ine=e=>U(QA(e)),Tne=(e,t,r)=>Db(n=>{let o=typeof r=="object"&&r.once;function s(i){Ic(n,i),o&&Eb(n)}return Ti(W(()=>e.addEventListener(t,s,r)),()=>W(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r=="object"?r.bufferSize:void 0}),rz=(e,t)=>Li(W(()=>{let r=e;return A(L(()=>t(r)),n=>n===void 0?se():(r=n[1],I(Me(n[0]))))})),wne=(e,t)=>Li(W(()=>{let r=e,n=!1;return L(function o(){return n?se():A(t(r),([s,i])=>(fe(i)?n=!0:r=i.value,bt(s)?I(s):o()))})})),vne=(e,t)=>rz(e,r=>I([r,t(r)])),Cne=(e,t,r=dh)=>e>t?Js:Li(W(()=>{let n=Lo(r),o=e,s=!1;return L(()=>{if(s)return se();let i=t-o+1;if(i>n){let c=DI(o,o+n-1);return o+=n,I(c)}let a=DI(o,o+i-1);return s=!0,I(a)})})),Ane=U(AH),Cn=e=>U(Tc(K(e,cs))),kne=e=>U(hq(e.channel)),ao=d(2,(e,t)=>vn(()=>{let r=0;return U(Gs(e.channel,Bo(n=>t(n,r++))))})),Rne=d(2,(e,t)=>ao(e,()=>t)),One=d(2,(e,t)=>e.pipe(ao(t.onElement),pz(t.onError))),nz=d(2,(e,t)=>U(Gs(e.channel,t))),xf=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,Ab(t,r),Gs(Me),U)),_ne=d(e=>Ae(e[0]),(e,t)=>xf(e,F,t)),Pne=d(2,(e,t)=>U(Ab(e.channel,t))),Mne=e=>e.pipe(ao(X),bh(t=>pf(re(t)))),oz=d(e=>Ae(e[0]),(e,t,r)=>xf(e,n=>Pt(t(n),n),r)),Fne=d(2,(e,t)=>e.pipe(bk(t.onError),oz(t.onElement,{concurrency:t.concurrency}))),Nne=d(2,(e,t)=>dk(e,me(function*(r,n,o){let s=jr(),i=jr(),a,c,u=!1,f=!1,p=s.whenOpen(L(()=>{if(a){let h=a;return a=void 0,f||s.closeUnsafe(),Pt(i.open,h)}return se()}));yield*L(()=>t.transform(p,o)).pipe(h=>Zp(h,x=>(u=!0,vs(x)&&(c=x.cause),i.open),!0),gt(o));let m=r.pipe(A(h=>c?je(c):u?I(h):(a=h,i.closeUnsafe(),s.openUnsafe(),Pt(i.await,h))),ht(()=>c?je(c):u?se():(f=!0,i.closeUnsafe(),s.openUnsafe(),A(i.await,()=>c?je(c):se()))));return L(()=>c?je(c):u?r:m)}))),Id=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,YA(n=>t(n).channel,r),U)),Une=d(e=>Ae(e[0]),(e,t,r)=>e.channel.pipe(wn,dq(n=>t(n).channel,r),U)),sz=d(e=>Ae(e[0]),(e,t)=>Id(e,F,t)),Dne=e=>U(wn(e.channel)),Lne=e=>U(qH(e.channel)),Bne=d(2,(e,t)=>Lb(e,$b(t))),$ne=d(2,(e,t)=>U(zH(e.channel,t))),jne=d(2,(e,t)=>e.channel.pipe(wn,VH(t),Gs(Me),U)),Hne=d(2,(e,t)=>iz(e,{duration:t,orElse:()=>Js})),iz=d(2,(e,t)=>{let r=$e(t.duration);if(!Wn(r))return e;if(Hf(r))return vn(t.orElse);let n=Symbol();return fz(vn(()=>{let s=os().getRef(Yn),i=Wt(r),a,c=jr(!1);return hk(br(e,(u,f)=>L(()=>(a=s.currentTimeMillisUnsafe()+i,c.openUnsafe(),u)).pipe(K(p=>(c.closeUnsafe(),a=void 0,p)),I)),Yq(xt(function*(){for(;;)if(yield*c.await,!(a===void 0||(yield*ua(a-s.currentTimeMillisUnsafe()),a===void 0)||a-s.currentTimeMillisUnsafe()>0))return yield*gn(n)})),{haltStrategy:"left"})}),o=>o.reasons.find(i=>i._tag==="Die"&&i.defect===n)?t.orElse():ez(o))}),qne=d(2,(e,t)=>U(De((r,n)=>K(we(wn(e.channel))(r,n),o=>{let s,i=xt(function*(){let a=yield*o,c=Me(a);return s=(yield*Lp(t))(a).pipe(Pt(c),ht(f=>(s=void 0,i))),c});return L(()=>s??i)})))),zne=e=>U(KH(e.channel)),Wne=e=>Id(e,hf),Kne=e=>e.channel.pipe(wn,HH,U),mf=d(2,(e,t)=>{let r=U(jH(wH(()=>Vne(e,t))));return az.set(r,[e,t]),r}),az=new WeakMap;function*Vne(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=az.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var Gne=d(2,(e,t)=>mf(hf(t),e)),hk=d(e=>Ae(e[0])&&Ae(e[1]),(e,t,r)=>U(_b(cs(e),cs(t),r))),Lb=d(2,(e,t)=>e.channel.pipe(pq(t),U)),Jne=d(2,(e,t)=>hk(ao(e,X),ao(t,re))),Zne=d(2,(e,t)=>Lb(e,$b(t))),Qne=d(2,(e,t)=>Lb(t,$b(e))),Yne=d(2,(e,t)=>sz(hf(e),t)),Xne=d(2,(e,t)=>cz(e,t,(r,n)=>[r,n])),cz=d(3,(e,t,r)=>Id(e,n=>ao(t,o=>r(n,o)))),xk=d(3,(e,t,r)=>Bb(e,t,eoe(r))),eoe=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},Bb=d(3,(e,t,r)=>U(Vs(me(function*(n,o){let s=yield*as(e.channel,o),i=yield*as(t.channel,o),a=xt(function*(){let f=yield*gt(s,o),p=yield*gt(i,o);return yield*eb([f,p])}),c={_tag:"PullBoth"};return xt(function*(){let[f,p]=c._tag==="PullBoth"?yield*a:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*i],m=r(f,p);return bt(m[1])?c={_tag:"PullRight",leftArray:m[1]}:bt(m[2])?c={_tag:"PullLeft",rightArray:m[2]}:c={_tag:"PullBoth"},m[0]})})))),toe=d(2,(e,t)=>xk(e,t,(r,n)=>[r,n])),roe=d(2,(e,t)=>Bb(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),i=r.slice(o),a=n.slice(o);return[s,i,a]})),noe=d(2,(e,t)=>Bb(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),i=r.slice(o),a=n.slice(o);return[s,i,a]})),ooe=d(2,(e,t)=>xk(e,t,(r,n)=>[...r,n])),soe=e=>ao(e,(t,r)=>[t,r]),ioe=e=>gf(e,_,(t,r)=>{let n=0;t._tag==="None"&&(n=1,t=N(r[0]));let o=Qt();for(;n<r.length;n++){let s=t.value;t=N(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,_()]]:[]}}),aoe=e=>gf(e,_,(t,r)=>{let n=Qt();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=N(r[o])}return[t,n]}),coe=e=>gf(e,()=>({prev:_(),current:_()}),(t,r)=>{let n=0,o;t.current._tag==="None"?(n=1,o=r[0],t.current=N(o)):o=t.current.value;let s=Qt();for(;n<r.length;n++){let i=r[n];t.current=N(i),s.push([t.prev,o,t.current]),t.prev=N(o),o=i}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,_()]]:[]}}),gk=(...e)=>U(wb(()=>{let t=[],r=new Set,n=jr(),o=jr();return Ob(VA(e.map((s,i)=>s.channel.pipe(wn,Ab(a=>(t[i]=a,r.has(i)?I(Me(t.slice())):(r.add(i),r.size<e.length?n.await:Pt(n.open,Me(t.slice()))))),GH(ei),UH(()=>r.has(i)?P:o.open)))),{concurrency:"unbounded",bufferSize:0}).pipe(rk(o.await))})),uoe=d(2,(e,t)=>gk(e,t)),foe=d(3,(e,t,r)=>ao(gk(e,t),([n,o])=>r(n,o))),uz=(...e)=>U(De((t,r)=>W(()=>{let n,o=V0(e.map(s=>{let i=yr(r);return as(s.channel,i).pipe(A(a=>H0(I(a),a)),Xr(a=>a._tag==="Success"?n?Ve(i,a):(n=a.value[0],P):Ve(i,a)),K(([,a])=>a))}));return L(()=>n??o)}))),loe=d(2,(e,t)=>uz(e,t)),yk=d(2,(e,t)=>U(JH(cs(e),t))),doe=d(2,(e,t)=>U(ZH(cs(e),t))),poe=d(2,(e,t)=>U(QH(cs(e),t))),moe=d(2,(e,t)=>U(YH(cs(e),t))),Sk=d(e=>Ae(e[0]),me(function*(e,t,r){let n=yield*Co,o=yield*as(e.channel,n),s=r?.capacity==="unbounded"?void 0:r?.capacity??Qq,i=yield*io({capacity:s}),a=yield*io({capacity:s});return yield*xt(function*(){for(;;){let c=yield*o,u=[],f=[];for(let m=0;m<c.length;m++){let h=t(c[m]);be(h)?u.push(h.failure):f.push(h.success)}let p;if(f.length>0){let m=bb(i,f);m.length>0&&(p=yield*El(wa(i,m)))}if(u.length>0){let m=bb(a,u);m.length>0&&(yield*wa(a,m))}p&&(yield*bc(p))}}).pipe(to(c=>(Ui(i,c),Ui(a,c),P)),gt(n)),[i,a]})),gh=e=>U(De((t,r)=>Pt(It(r,ss(e)),af(e)))),hoe=d(e=>Ae(e[0]),(e,t,r)=>K(Sk(xf(e,n=>t(n),r),n=>n,r),([n,o])=>[gh(n),gh(o)])),xoe=d(e=>Ae(e[0]),(e,t,r)=>K(Sk(e,t,{capacity:r?.capacity??16}),([n,o])=>[gh(n),gh(o)])),goe=d(2,(e,t)=>t.pipe(K(r=>r?e:Js),Cn)),yoe=d(2,me(function*(e,t){let r,n=yield*ik(e.channel),o=rt(n,c=>(r=c,je(c))),[s,i]=yield*Sl(c=>t.transform(o,c)),a=r?Js:Li(I(n));return i&&(a=mf(yh(i),a)),[s,a]})),Soe=d(2,(e,t)=>U(gq(e.channel,t))),boe=d(2,(e,t)=>U(xq(e.channel,t))),fz=d(2,(e,t)=>e.channel.pipe(Ed(r=>t(r).channel),U)),Eoe=d(2,(e,t)=>e.channel.pipe(eq(r=>t(r).channel),U)),lz=d(2,(e,t)=>e.channel.pipe(kb(t),U)),bh=d(2,(e,t)=>U(Ks(e.channel,r=>t(r).channel)));var bk=d(2,(e,t)=>e.channel.pipe(rq(t),U)),Ioe=d(3,(e,t,r)=>{let n=Array.isArray(t)?o=>O(o,"_tag")&&t.includes(o._tag):Or(t);return bk(e,o=>n(o)?r(o):P)}),Toe=d(2,(e,t)=>lz(e,r=>{let n=Rp(r);return tt(n)?t(n.success):P})),dz=d(e=>Ae(e[0]),(e,t,r,n)=>U(nq(cs(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Ek=d(e=>Ae(e[0]),(e,t,r,n)=>U(oq(cs(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),woe=d(e=>Ae(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>O(s,"_tag")&&t.includes(s._tag):Or(t);return dz(e,o,r,n)}),voe=d(e=>Ae(e[0]),(e,t,r)=>{let n;return Ek(e,o=>(n??=Object.keys(t),O(o,"_tag")&&Xg(o._tag)&&n.includes(o._tag)?X(o):re(o)),o=>t[o._tag](o),r)}),Coe=d(e=>Ae(e[0]),(e,t,r,n,o)=>U(sq(cs(e),t,r,(s,i)=>n(s,i).channel,o&&((s,i)=>o(s,i).channel)))),Aoe=d(e=>Ae(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let i of Object.keys(r)){let a=r[i];o[i]=(c,u)=>a(c,u).channel}let s=n&&((i,a)=>n(i,a).channel);return U(iq(e.channel,t,o,s))}),koe=d(2,(e,t)=>Ek(e,r=>Or(r,t)&&O(r,"reason")?X(r.reason):re(r),wc)),pz=d(2,(e,t)=>U(aq(e.channel,t))),Roe=d(3,(e,t,r)=>U(tq(e.channel,t,n=>r(n).channel))),Ooe=d(3,(e,t,r)=>U(Rb(e.channel,t,(n,o)=>r(n,o).channel))),_oe=d(2,(e,t)=>U($H(e.channel,r=>cs(t())))),Poe=d(2,(e,t)=>bh(e,r=>pf(t(r)))),Moe=e=>U(cq(e.channel)),Foe=d(e=>Ae(e[0]),(e,t)=>U(uq(e.channel,t))),Noe=d(e=>Ae(e[0]),(e,t)=>U(fq(e.channel,t))),Uoe=d(2,(e,t)=>U(lq(e.channel,t))),Jq=(e,t)=>Cn(K(ks(t),r=>{let n=Fr.defaultValue(),o=()=>bh(vk(e,Fr,W(()=>n)),s=>Cn(ht(K(r(s),i=>(n=i,Cn(Pt(Vp,o())))),()=>I(wc(s)))));return o()})),Doe=d(e=>Ae(e[0]),(e,t,r)=>vn(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},i=vk(ty,W(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),a=r?.onEvent===void 0?void 0:F0(r.onEvent,()=>s),c,u=a===void 0?F:m=>Rz(Oz(m,K(a.begin,h=>{c=h})),h=>L(()=>{if(c===void 0)return P;let x=c;return c=void 0,a.end(x,h)})),f=_(),p=vn(()=>{let m=t.steps[o];if(!m)return wc(kI(f));let h=i(u(Pz(e,m.provide))),x=!1;if(de(f)){let g=f.value,y=!1,E=h;h=vn(()=>y?E:(y=!0,wc(g))),h=Jq(h,qp(m,!1))}else{let g=qp(m,!0);h=g?Jq(h,g):h}return bh(n?_z(h,g=>(x=!0,P)):h,g=>(o++,n&&x?wc(g):(f=N(g),p)))});return p})),Loe=d(2,(e,t)=>{let r=Bt(t);return r===0?Js:mz(e,(n,o)=>o===r-1)}),Boe=d(3,(e,t,r)=>vn(()=>{let n=xy(t),o=BigInt(0),s=!1;return mf(xz(e,i=>{let a=o+BigInt(i.length);return a>n?(s=!0,!1):(o=a,!0)}),vn(()=>s?r():Js))})),$oe=d(2,(e,t)=>{let r=Bt(t);return r===0?Js:gf(e,Ta,(n,o)=>(rb(n,o),n.length>r&&ob(n,n.length-r),[n,va]),{onHalt(n){return Ec(n)}})}),mz=d(e=>Ae(e[0]),(e,t,r)=>br(e,(n,o)=>W(()=>{let s=0,i=!1;return A(L(()=>i?se():n),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){i=!0;let f=c.slice(0,r?.excludeLast?u:u+1);return bt(f)?I(f):se()}return I(c)})}))),hz=d(e=>Ae(e[0]),(e,t,r)=>br(e,(n,o)=>W(()=>{let s=0,i=!1;return xt(function*(){if(i)return yield*se();let a=yield*n;for(let c=0;c<a.length;c++)if(yield*t(a[c],s++)){i=!0;let u=a.slice(0,r?.excludeLast?c:c+1);return bt(u)?u:yield*se()}return a})}))),xz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=0,s=!1,i=A(L(()=>s?se():r),a=>{let c=[];for(let u=0;u<a.length;u++){if(!t(a[u],o++)){s=!0;break}c.push(a[u])}return bt(c)?I(c):s?se():i});return i}))),joe=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!1,s=A(L(()=>o?se():r),i=>{let a=[];for(let c=0;c<i.length;c++){let u=t(i[c]);if(be(u)){o=!0;break}a.push(u.success)}return bt(a)?I(a):o?se():s});return s}))),Hoe=d(2,(e,t)=>hz(e,(r,n)=>K(t(r,n),o=>!o),{excludeLast:!0})),Ik=d(2,(e,t)=>{let r=Bt(t);return r===0?e:br(e,(n,o)=>W(()=>{let s=0,i=n.pipe(A(a=>s>=r?I(a):(s+=a.length,s<=r?i:I(a.slice(r-s)))));return i}))}),qoe=d(2,(e,t)=>Ik(gz(e,(r,n)=>!t(r,n)),1)),zoe=d(2,(e,t)=>Ik(yz(e,(r,n)=>K(t(r,n),o=>!o)),1)),gz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=0,i=A(r,a=>{let c=a.findIndex(u=>!t(u,s++));return c===-1?i:(o=!1,I(a.slice(c)))});return L(()=>o?i:r)}))),Woe=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=A(r,i=>{let a=i.findIndex(c=>be(t(c)));return a===-1?s:(o=!1,I(i.slice(a)))});return L(()=>o?s:r)}))),yz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s=0,i=xt(function*(){for(;;){let a=yield*r;for(let c=0;c<a.length;c++)if(!(yield*t(a[c],s++)))return o=!1,a.slice(c)}});return L(()=>o?i:r)}))),Koe=d(2,(e,t)=>{let r=Bt(t);return r===0?e:br(e,(n,o)=>W(()=>{let s=Ta(),i=A(n,a=>{nb(s,a);let c=s.length-r,u=nf(s,c);return Gr(u)?I(u):i});return i}))}),Sz=e=>e.channel.pipe(Gs(Me),U),bz=d(2,(e,t)=>(t=Lo(t),br(e,(r,n)=>W(()=>{let o=Qt(),s=0,i,a=!1;return L(function c(){if(a)return se();if(i===void 0)return A(r,u=>{if(o.length===0&&u.length===t)return I(u);if(o.length+u.length<t){for(let f=0;f<u.length;f++)o.push(u[f]);return c()}return i=u,c()});for(;s<i.length;)if(o.push(i[s++]),o.length===t){let u=o;return o=[],I(u)}return s=0,i=void 0,c()}).pipe(ht(()=>{if(o.length===0)return se();let c=o;return a=!0,o=[],I(c)}))})))),Voe=d(2,(e,t)=>Ez(e,t,1)),Ez=d(3,(e,t,r)=>{let n=Lo(t),o=Lo(r);return br(e,(s,i)=>W(()=>{let a=null,c=Ta(),u=!1,f=0,p=Un(s,{onSuccess(m){if(nb(c,m),f>0){let x=c.length;ob(c,f),f=Math.max(0,f-x)}if(c.length<n)return p;u=!0;let h=[];for(;c.length>=n;)if(n===o)h.push(nf(c,n));else{h.push(nH(c,n));let x=c.length;ob(c,o),f=Math.max(0,o-x)}return I(h)},onFailure(m){return c.length===0||u&&c.length<=n-o?je(m):(a=m,I(Me(Ec(c))))}});return L(()=>a?je(a):p)}))}),Goe=d(2,(e,t)=>gf(e,Qt,(r,n)=>{let o=Qt();for(let s=0;s<n.length;s++)t(n[s])?Gr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return Gr(r)?Me(r):va}})),Joe=d(4,(e,t,r,n)=>XA(wn(e.channel),wn(t.channel),r,n).pipe(Gs(Me),U)),Zoe=d(4,(e,t,r,n)=>U(XA(e.channel,t.channel,r,n))),Qoe=d(e=>Ae(e[0]),(e,t,r,n)=>U(bd(e.channel,t,(o,s)=>{let i=Qt();for(let a=0;a<s.length;a++){let[c,u]=r(o,s[a]);o=c,i.push(...u)}return[o,Gr(i)?Me(i):va]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0))),gf=d(e=>Ae(e[0]),(e,t,r,n)=>U(bd(e.channel,t,(o,s)=>{let[i,a]=r(o,s);return o=i,[o,bt(a)?Me(a):va]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0))),va=Qt(),Yoe=d(e=>Ae(e[0]),(e,t,r,n)=>e.channel.pipe(wn,bd(t,(o,s)=>K(r(o,s),([i,a])=>[i,bt(a)?Me(a):Qt()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0),U)),Xoe=d(e=>Ae(e[0]),(e,t,r,n)=>e.channel.pipe(bd(t,(o,s)=>K(r(o,s),([i,a])=>[i,bt(a)?Me(a):va]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return bt(s)?Me(s):va}}:void 0),U)),ese=d(3,(e,t,r)=>vn(()=>{let n=t();return mf(pf(n),U(bd(e.channel,()=>n,(o,s)=>{let i=Qt();for(let a=0;a<s.length;a++)o=r(o,s[a]),i.push(o);return[o,Me(i)]})))})),tse=d(3,(e,t,r)=>vn(()=>e.channel.pipe(wn,XH(t(),r),Gs(Me),U))),rse=d(2,(e,t)=>br(e,me(function*(r,n){let o=yield*Yn,s=Wt($e(t)),i,a,c=1/0,u=jr(),f=jr(),p=jr();yield*r.pipe(u.whenOpen,A(h=>(f.openUnsafe(),i=h,c=o.currentTimeMillisUnsafe()+s,P)),Mt({disableYield:!0}),to(h=>(a=h,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),p.openUnsafe(),P)),gt(n));let m=L(function h(){let x=o.currentTimeMillisUnsafe(),g=c<x?s:Math.min(s,c-x);return A(Ya(ua(g),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return h();if(i){f.closeUnsafe(),u.closeUnsafe();let E=I(Me(jf(i)));return i=void 0,E}else if(a)return je(a);return h()})});return L(()=>{if(a){if(i){let h=I(Me(jf(i)));return i=void 0,h}return je(a)}return u.openUnsafe(),f.whenOpen(m)})}))),Iz=d(2,(e,t)=>{let r=t.burst??0;return t.strategy==="enforce"?nse(e,t.cost,t.units,t.duration,r):ose(e,t.cost,t.units,t.duration,r)}),nse=(e,t,r,n,o)=>br(e,s=>bu(i=>{let a=Wt($e(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=i.currentTimeMillisUnsafe();return I(A(s,function p(m){return A(t(m),h=>{let x=i.currentTimeMillisUnsafe(),y=(x-f)/a,E=u+y*r,b=E<0?c:Math.min(E,c);return h<=b?(u=b-h,f=x,I(m)):A(s,p)})}))})),ose=(e,t,r,n,o)=>br(e,s=>bu(i=>{let a=Wt($e(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=i.monotonicTimeNanosUnsafe();return I(A(s,p=>A(t(p),m=>{let h=i.monotonicTimeNanosUnsafe(),g=Number(h-f)/1e6/a,y=u+g*r,b=Math.min(y,c)-m;if(b>=0)return u=b,f=h,I(p);let v=-b/r,T=Math.max(0,v*a);return T>0?A(ua(T),()=>(u=b,f=h,I(p))):(u=b,f=h,I(p))})))})),sse=d(2,(e,t)=>Iz(e,{...t,cost:r=>I(t.cost(r))})),ise=d(2,(e,t)=>Sz(bz(e,t))),ase=d(3,(e,t,r)=>Tk(e,Dq(Lo(t)),hl(r))),cse=d(e=>Ae(e[0]),(e,t,r)=>Tz(e,me(function*(n,o,s){for(let i=0;i<n.length;i++){let[a,c]=yield*t(n[i]),u=Qr(s,a),f=de(u)?u.value:yield*ec(uk(o,a));yield*fk(o,a),yield*jn(f,c)}}),r)),use=d(e=>Ae(e[0]),(e,t,r)=>vn(()=>{let n=Si();return Tz(e,me(function*(o,s,i){for(let a=0;a<o.length;a++){let c=t(o[a]),u=Qr(n,c);fe(u)?bi(n,c,[o[a]]):u.value.push(o[a])}for(let[a,c]of n){let u=Qr(i,a),f=de(u)?u.value:yield*ec(uk(s,a));yield*fk(s,a),yield*wa(f,c)}ny(n)}),r)})),Tz=(e,t,r)=>dk(e,me(function*(n,o,s){let i=yield*Sb();yield*It(o,ss(i));let a=Si(),c=yield*$q({lookup:u=>Ti(io({capacity:r?.bufferSize??4096}).pipe(_t(f=>(bi(a,u,f),jn(i,[u,gh(f)])))),f=>(Ei(a,u),yd(f))),idleTimeToLive:r?.idleTimeToLive??Ss}).pipe(zo(s));return yield*xn({while:nr,body:qe(A(n,u=>t(u,c,a))),step:Rr}).pipe(rt(u=>Ht(i,u)),gt(o)),af(i)})),fse=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o,s,i=Qt(),a=r.pipe(A(u=>{for(let f=0;f<u.length;f++){let p=u[f],m=t(p);if(s===void 0){o=m,s=[p];continue}else if(Z(m,o)){s.push(p);continue}i.push([o,s]),o=m,s=[p]}if(Gr(i)){let f=i;return i=[],I(f)}return a})),c=!1;return ht(L(()=>c?se():a),()=>{c=!0;let u=s;return s=void 0,u&&Gr(u)?I(Me([o,u])):se()})}))),lse=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o,s,i=L(()=>{if(s!==void 0){let c=s;return s=void 0,I(c)}return r}).pipe(gu(c=>(o=Jn(c),se()))),a=K(L(()=>t.transform(i,n)),([c,u])=>(s=u,Me(c)));return L(()=>o||a)}))),dse=d(2,(e,t)=>Tk(e,t,$p)),Tk=d(3,(e,t,r)=>U(Vs(me(function*(n,o,s){let i=yield*as(e.channel,o),a=jr(!1),c=Symbol(),u=yield*io({capacity:0});yield*i.pipe(a.whenOpen,A(S=>(a.closeUnsafe(),jn(u,S))),Mt,rt(S=>Ht(u,S)),gt(s));let f=yield*Yn,p=yield*Qa(r),m=jr(!1),h=f.currentTimeMillisUnsafe(),x=0,g=_(),y,E=S=>(m.openUnsafe()&&(x=f.currentTimeMillisUnsafe()),I(S)),b=m.await.pipe(A(()=>p(h,g)),A(([,S])=>ua(S)),A(()=>jn(u,c)),ht(()=>yd(u)),A(()=>Xn)),v=L(()=>{if(y!==void 0){let S=y;return y=void 0,E(S)}return u.state._tag==="Open"&&a.openUnsafe(),A(Ws(u),S=>S===c?se():E(S))}),T=A(([S,w])=>{if(m.isOpen())h+=f.currentTimeMillisUnsafe()-x;else if(u.state._tag==="Done")return se();return g=N(S),y=w,I(Me(S))});return L(()=>{if(u.state._tag==="Done"&&y===void 0)return u.state.exit;m.closeUnsafe();let S=T(L(()=>t.transform(v,s)));return u.state._tag==="Open"?Ya(S,b):S})})))),pse=d(2,me(function*(e,t){let r=Bt(t.n),n=yield*mse(t),o=new Array(r),s=yield*it;for(let i=0;i<r;i++){let a=yr(s),c=yield*lh(n).pipe(Jo(it,a));o[i]=ZA(hb(c)).pipe(mh(u=>Ve(a,u)),U)}return yield*lf(e.channel,i=>mb(n,i)).pipe(Xr(i=>pb(n,i)),Rs),o})),mse=e=>Ti(e.capacity==="unbounded"?uh(e):e.strategy==="dropping"?lb(e):e.strategy==="sliding"?db(e):fb(e),fh),wz=d(2,(e,t)=>K(Nz(e,t),tz)),hse=d(2,(e,t)=>K(Kq({acquire:wz(e,t),idleTimeToLive:t.idleTimeToLive}),r=>Cn(Vq(r)))),xse=d(2,(e,t)=>U(ek(e.channel,t))),gse=d(2,(e,t)=>U(tk(e.channel,t))),yse=d(2,(e,t)=>e.channel.pipe(tk(Uq(t)),BH(([r,n])=>n?vb(n):Sd),U)),Sse=e=>Ub(Fz(e)),bse=e=>gf(e,Qt,(t,r)=>{let n=up(t,r);return[n,[n]]}),vz=e=>Cz(e,Z),Cz=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s;return A(r,function i(a){let c=[],u=0;for(o&&(o=!1,s=a[0],u=1,c.push(s));u<a.length;u++){let f=a[u];t(f,s)||(s=f,c.push(f))}return Gr(c)?I(c):A(r,i)})}))),Ese=d(2,(e,t)=>br(e,(r,n)=>W(()=>{let o=!0,s;return A(r,me(function*i(a){let c=[],u=0;for(o&&(o=!1,s=a[0],u=1,c.push(s));u<a.length;u++){let f=a[u];(yield*t(f,s))||(s=f,c.push(f))}return Gr(c)?c:yield*A(r,me(i))}))}))),Ise=d(e=>Ae(e[0]),(e,t)=>vn(()=>{let r=new TextDecoder(t?.encoding);return ao(e,n=>r.decode(n,{stream:!0}))})),Tse=e=>vn(()=>{let t=new TextEncoder;return ao(e,r=>t.encode(r))}),wse=e=>e.channel.pipe(ek(mq()),U),Az=d(2,(e,t)=>nz(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let i=0;i<r.length;i++)i===s?o.push(r[i]):o.push(r[i],t);return o})),vse=d(2,(e,t)=>pf(t.start).pipe(mf(Az(e,t.middle)),mf(pf(t.end)))),Cse=d(2,(e,t)=>kz(e,t,hf(W_([!0,!1])))),kz=d(3,(e,t,r)=>U(De(me(function*(n,o){let s=yield*we(wn(r.channel))(n,o),i=Symbol(),a=!1,c=!1,u=(yield*we(wn(e.channel))(n,o)).pipe(ht(()=>(a=!0,I(i)))),f=(yield*we(wn(t.channel))(n,o)).pipe(ht(()=>(c=!0,I(i))));return xt(function*(){for(;;){if(a&&c)return yield*se();let p=yield*s;if(p&&a||!p&&c)continue;let m=yield*p?u:f;if(m!==i)return Me(m)}})})))),Ase=d(2,(e,t)=>U(rk(e.channel,t))),kse=d(2,(e,t)=>U(yq(e.channel,t))),Rz=d(2,(e,t)=>U(mh(e.channel,t))),Rse=d(2,(e,t)=>U(Sq(e.channel,t))),Oz=d(2,(e,t)=>U(bq(e.channel,t))),_z=d(2,(e,t)=>U(nk(e.channel,r=>t(r[0])))),Ose=d(2,(e,t)=>U(Eq(e.channel,t))),Eh=d(2,(e,t)=>U(Iq(e.channel,t))),Pz=d(e=>Ae(e[0]),(e,t,r)=>U(Tq(e.channel,t,r))),wk=d(2,(e,t)=>U(Pb(e.channel,t))),_se=d(3,(e,t,r)=>U(Mb(e.channel,t,r))),vk=d(3,(e,t,r)=>U(Fb(e.channel,t,r))),Mz=d(2,(e,t)=>U(wq(e.channel,t))),Pse=d(3,(e,t,r)=>Mz(e,n=>We(n,t,r(Re(n,t))))),Mse=function(){let e=Ae(arguments[0]),t=e?arguments[1]:arguments[0],r=Ho(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return U(ok(n.channel,t,r))}return n=>U(ok(n.channel,t,r))},Fse=pf({}),Nse=d(3,(e,t,r)=>ao(e,n=>({...n,[t]:r(n)})));var Use=d(e=>Ae(e[0]),(e,t,r,n)=>Id(e,o=>ao(r(o),s=>({...o,[t]:s})),n)),Dse=d(e=>Ae(e[0]),(e,t,r,n)=>xf(e,o=>K(r(o),s=>({...o,[t]:s})),n)),Lse=d(2,(e,t)=>ao(e,r=>({[t]:r}))),Bse=d(2,(e,t)=>Sl(r=>as(e.channel,r).pipe(A(n=>t.transform(n,r)),K(([n])=>n)))),Fz=e=>df(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),$se=e=>df(e.channel,()=>0,(t,r)=>t+r.length),jse=e=>df(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),Hse=d(3,(e,t,r)=>df(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),qse=d(3,(e,t,r)=>Rq(e.channel,t,(n,o)=>{let s=0,i=n;return K(xn({while:()=>s<o.length,body:()=>r(i,o[s]),step(a){i=a,s++}}),()=>i)})),zse=e=>K(Aq(e.channel),Lt(X_(0))),Wse=e=>K(kq(e.channel),Lt(jf)),Kse=d(2,(e,t)=>lf(e.channel,r=>{let n=0;return xn({while:()=>n<r.length,body:()=>t(r[n++]),step:Rr})})),Vse=d(2,(e,t)=>Cq(e.channel,r=>{let n=!1,o=0;return K(xn({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),Td=d(2,(e,t)=>lf(e.channel,t)),$b=e=>vq(e.channel),Ck=e=>ik(e.channel),Gse=e=>df(e.channel,()=>"",(t,r)=>t+r.join("")),Jse=e=>K(sk(e.channel),t=>t.buffer),Zse=e=>sk(e.channel),Ak=d(e=>Ae(e[0]),(e,t,r)=>{let n,o,s=!1,i=jr(!1),a=r?.signal,c=()=>o.interruptUnsafe();return new ReadableStream({start(u){o=Yp(Ur(Td(e,f=>i.whenOpen(W(()=>{i.closeUnsafe();for(let p=0;p<f.length;p++)u.enqueue(f[p]);n(),n=void 0}))),t)),o.addObserver(f=>{a?.removeEventListener("abort",c),!s&&(f._tag==="Failure"&&a?.aborted!==!0?u.error(fu(f.cause)):u.close())}),a!==void 0&&o.pollUnsafe()===void 0&&(a.aborted?c():a.addEventListener("abort",c,{once:!0}))},pull(){return new Promise(u=>{n=u,i.openUnsafe()})},cancel(){if(o)return s=!0,ow(vo(Tn(o)))}},r?.strategy)}),Qse=d(e=>Ae(e[0]),(e,t)=>Ak(e,pt(),t)),kk=d(e=>Ae(e[0]),(e,t)=>K(Nr(),r=>Ak(e,r,t))),Rk=d(2,(e,t)=>({[Symbol.asyncIterator](){let r=sw(t),n=Sr(t),o=Zn(),s,i,a,c,u=p=>{if(c)return c;let m=a;return c=r(Pt(Vt(m?Tn(m):P,Ve(o,p)),{done:!0,value:void 0})),c},f=async p=>{try{await u(p)}catch(m){await r(Xp("Suppressed error while closing Stream async iterator",m))}};return{async next(){if(c)return c;if(i){let h=i.next();if(!h.done)return h;i=void 0}let p=n(s??A(as(e.channel,o),h=>(s=h,h)));a=p;let m=await r(Yj(p));if(a===p&&(a=void 0),ft(m))return i=m.value[Symbol.iterator](),i.next();if(wo(m.cause))return u(Kt);if(c&&a0(m.cause))return c;throw await f(m),fu(m.cause)},return(){return u(Kt)},async throw(p){throw await f(Dg(p)),p}}}})),Yse=e=>K(Nr(),t=>Rk(e,t)),Xse=e=>Rk(e,pt()),eie=d(e=>Ae(e[0]),(e,t,r)=>ck(e.channel,t,r)),tie=d(2,(e,t)=>Pq(e.channel,t)),Nz=d(2,(e,t)=>Mq(e.channel,t)),rie=d(2,(e,t)=>Oq(e.channel,t)),nie=d(2,(e,t)=>ak(e.channel,t));var Uz="~effect/PrimaryKey";var Lz="~effect/Pool",Hz=Symbol(),qz=Symbol(),_k=Symbol();var zz=e=>Kz({...e,min:e.size,max:e.size,strategy:Hb}),Wz=e=>A(e.timeToLiveStrategy==="creation"?die(e.timeToLive):pie(e.timeToLive),t=>Kz({...e,strategy:t})),Kz=e=>en(me(function*(t){let r=yield*Nr(),n=Re(r,it),o=Xa(e.acquire,u=>Kr(r,u)),s=e.concurrency??1,i={acquire:o,concurrency:s,isFixed:e.min===e.max,minSize:e.min,maxSize:e.max,strategy:e.strategy,targetUtilization:Math.min(Math.max(e.targetUtilization??1,.1),1)},a={scope:n,isShuttingDown:!1,usage:0,resizeSemaphore:uf(1),items:new Set,availableHead:void 0,availableTail:void 0,invalidated:new Set,waiters:new Set},c={[Lz]:Lz,[Hz]:e.acquire,[qz]:r,[_k]:yield*Yn,config:i,state:a,pipe(){return V(this,arguments)}};return yield*It(n,oie(c)),i.minSize>0&&(yield*_t(Il(t(jb(c)),{startImmediately:!0}),u=>It(n,Tn(u)))),e.strategy!==Hb&&(yield*_t(Il(t(e.strategy.run(c))),u=>It(n,Tn(u)))),c})),oie=me(function*(e){if(e.state.isShuttingDown)return;e.state.isShuttingDown=!0;let t=e.state.items.size,r=uf(t);for(let n of e.state.items)n.refCount>0?(n.finalizer=_t(n.finalizer,r.release(1)),e.state.invalidated.add(n),yield*r.take(1)):(e.state.items.delete(n),Ih(e,n),e.state.invalidated.delete(n),yield*n.finalizer);if(e.state.waiters.size>0){let n=Array.from(e.state.waiters);e.state.waiters.clear();for(let o of n)o()}yield*r.take(t)}),Pk=e=>oe(t=>{let r=e.state;if(r.isShuttingDown)return nl;if(r.availableHead?.exit._tag==="Success"){if(r.usage++,e.config.isFixed||Th(e)<=wh(e))return Vz(e,r.availableHead,t);r.usage--}return sie(e,cie)});var sie=(e,t)=>Gn(r=>{let n=e.state;n.usage++;let o=Y(Tp(r(fie(e)),()=>ye(()=>{n.usage--})),()=>i),s=oe(a=>{if(n.isShuttingDown)return n.usage--,nl;let c=Mk(e)??(Th(e)<=wh(e)?n.availableHead:void 0);return c===void 0?o:c.exit._tag==="Failure"?(aie(e,c),i):t(e,c,a,r)}),i=ce(()=>n.isShuttingDown?(n.usage--,nl):Th(e)>wh(e)?Y(n.resizeSemaphore.withPermitsIfAvailable(1)(gt(vi(jb(e)),n.scope)),()=>s):s);return i}),iie=(e,t)=>{t.refCount++,t.refCount>=e.config.concurrency&&Ih(e,t)},aie=(e,t)=>{e.state.items.delete(t),e.state.invalidated.delete(t),Ih(e,t)},Vz=(e,t,r)=>{iie(e,t);let n=dn(r.context,it);return n.state._tag==="Closed"?Wa(r,t.release):za(n,{},t.release),t.exit},cie=(e,t,r)=>Vz(e,t,r),uie=(e,t)=>oe(r=>{let n=e.state;return t.refCount--,n.usage--,t.refCount===0&&(t.idleSince=e[_k].currentTimeMillisUnsafe()),n.invalidated.has(t)?Nk(e,t):(t.refCount<e.config.concurrency&&(lie(e,t),Gz(e,r,1)),pe)}),Mk=e=>{let t=e.state.availableHead;for(;t!==void 0&&t.exit._tag==="Failure";)t=t.availableNext;return t},fie=e=>$t(t=>{let r=e.state;if(Mk(e)!==void 0||r.isShuttingDown)return t(pe);let n=o=>{r.waiters.delete(n),t(o??pe)};return r.waiters.add(n),ye(()=>{r.waiters.delete(n)})}),Gz=(e,t,r)=>{let n=e.state.waiters;n.size!==0&&t.currentDispatcher.scheduleTask(()=>{let o=r,s=[];for(let i of n){if(o--<=0)break;s.push(i)}for(let i=0;i<s.length;i++)s[i]()},0)},Bz=e=>oe(t=>(Gz(e,t,Number.POSITIVE_INFINITY),pe)),Fk=new WeakMap,$z=(e,t)=>{t.isAvailable||Fk.has(t)||(t.isAvailable=!0,t.availablePrevious=e.state.availableTail,t.availableNext=void 0,e.state.availableTail!==void 0?e.state.availableTail.availableNext=t:e.state.availableHead=t,e.state.availableTail=t)},lie=(e,t)=>{t.isAvailable||Fk.has(t)||(t.isAvailable=!0,t.availablePrevious=void 0,t.availableNext=e.state.availableHead,e.state.availableHead!==void 0?e.state.availableHead.availablePrevious=t:e.state.availableTail=t,e.state.availableHead=t)},Ih=(e,t)=>{t.isAvailable&&(t.isAvailable=!1,t.availablePrevious!==void 0?t.availablePrevious.availableNext=t.availableNext:e.state.availableHead=t.availableNext,t.availableNext!==void 0?t.availableNext.availablePrevious=t.availablePrevious:e.state.availableTail=t.availablePrevious,t.availablePrevious=void 0,t.availableNext=void 0)};var Nk=(e,t)=>L(()=>{if(e.state.items.has(t)){if(t.refCount===0)return e.state.items.delete(t),Ih(e,t),e.state.invalidated.delete(t),vo(A(t.finalizer,()=>gt(vi(jb(e)),e.state.scope,{startImmediately:!0})))}else return P;return e.state.invalidated.add(t),Ih(e,t),vo(gt(vi(jb(e)),e.state.scope,{startImmediately:!0}))}),jb=e=>e.state.resizeSemaphore.withPermits(1)(Ok(e)),Ok=e=>L(()=>{let t=wh(e),r=Th(e);if(t>=r)return P;let n=r-t,o=e.config.strategy===Hb?jz(e):A(e.config.strategy.reclaim(e),i=>i?I(i):jz(e));if(n===1){let i=_t(o,Bz(e));return e.config.isFixed?vo(i):A(i,a=>a.exit._tag==="Failure"?P:Ok(e))}let s=o.pipe(ew(n,{concurrency:n}),_t(Bz(e)));return e.config.isFixed?vo(s):A(s,i=>i.some(a=>a.exit._tag==="Failure")?P:Ok(e))}),jz=e=>Gn(t=>oe(r=>{let n=e,o=tl(),s=r.context;r.setContext(We(n[qz],it,o));let i=A(eo(n[Hz]),a=>{let c={exit:a,finalizer:rt(Ve(o,a),mie),refCount:0,idleSince:n[_k].currentTimeMillisUnsafe(),disableReclaim:!1,isAvailable:!1,availablePrevious:void 0,availableNext:void 0,release:void 0};c.release=qe(uie(e,c));let u=L(()=>e.state.items.has(c)?e.config.strategy.onAcquire(c):P);if(a._tag==="Success")return e.state.items.add(c),$z(e,c),e.config.strategy===Hb?I(c):Pt(u,c);let f=Mk(e)===void 0?e.state.waiters.values().next().value:void 0;return f!==void 0?f(a):(e.state.items.add(c),$z(e,c)),Pt(gt(Vt(c.finalizer,u),e.state.scope,{startImmediately:!0}),c)});return Io(t(i),a=>(r.setContext(s),a._tag==="Failure"?el(o,a):void 0),!0)})),Th=e=>{if(e.state.isShuttingDown)return 0;if(e.config.isFixed)return e.config.minSize;let t=e.state.usage/e.config.targetUtilization,r=Math.ceil(t/e.config.concurrency);return Math.min(Math.max(e.config.minSize,r),e.config.maxSize)},wh=e=>e.state.items.size-e.state.invalidated.size,Hb={run:e=>P,onAcquire:e=>P,reclaim:e=>Kp},die=me(function*(e){let t=yield*Yn,r=yield*Sb(),n=Wt($e(e)),o=new WeakMap;return F({run:s=>{let i=a=>L(()=>{if(!s.state.items.has(a)||s.state.invalidated.has(a))return P;let c=t.currentTimeMillisUnsafe(),u=o.get(a),f=n-(c-u);return f>0?ca(i(a),f):Nk(s,a)});return Ws(r).pipe(_t(i),Mt({disableYield:!0}))},onAcquire:s=>L(()=>(o.set(s,t.currentTimeMillisUnsafe()),jn(r,s))),reclaim:s=>Kp})}),pie=me(function*(e){let t=yield*Yn,r=Wt($e(e));return F({run:n=>{let o=L(()=>{if(wh(n)<=Th(n))return P;let s=t.currentTimeMillisUnsafe()-r,i;for(let a of n.state.items)a.refCount>0||a.idleSince>s||n.state.invalidated.has(a)||Fk.has(a)||(i===void 0||a.idleSince<i.idleSince)&&(i=a);return i===void 0?P:A(Nk(n,i),()=>o)});return o.pipe(ca(e),Mt({disableYield:!0}))},onAcquire:n=>P,reclaim:n=>Kp})}),mie=e=>ar(t=>{let r=t.getRef(RN);return r?Tl(r)("Unhandled error in pool finalizer",e):P});var Zz="~effect/reactivity/Reactivity",vc=Ue("effect/reactivity/Reactivity"),hie=W(()=>{let e=new Map,t=c=>{Uk(c,u=>{let f=e.get(u);f!==void 0&&f.forEach(p=>p())})},r=c=>yn(u=>{let f=Vi(u,qb);return f?Uk(c,p=>{f.add(p)}):t(c),P}),n=(c,u)=>_t(u,r(c)),o=(c,u)=>{let f=[];return Uk(c,p=>{f.push(p);let m=e.get(p);m===void 0&&(m=new Set,e.set(p,m)),m.add(u)}),()=>{for(let p=0;p<f.length;p++){let m=e.get(f[p]);m!==void 0&&(m.delete(u),m.size===0&&e.delete(f[p]))}}},s=(c,u)=>xt(function*(){let f=yield*Nr(),p=Re(f,it),m=yield*io(),h=$c(Sr(f),Ni(p)),x=!1,g=!1,y=v=>{v._tag==="Failure"?Ui(m,v.cause):Ic(m,v.value),g?(g=!1,h(u).addObserver(y)):x=!1};function E(){if(x){g=!0;return}x=!0,h(u).addObserver(y)}let b=o(c,E);return yield*It(p,W(b)),E(),m}),i=(c,u)=>s(c,u).pipe(K(Sh),Cn),a=c=>L(()=>{let u=new Set;return c.pipe(Jo(qb,u),Xr(f=>W(()=>{u.forEach(p=>{let m=e.get(p);m!==void 0&&m.forEach(h=>h())})})))});return vc.of({[Zz]:Zz,mutation:n,query:s,stream:i,invalidateUnsafe:t,invalidate:r,registerUnsafe:o,withBatch:a})}),qb=class extends Ue()("effect/reactivity/Reactivity/PendingInvalidation"){},zb=d(2,(e,t)=>vc.use(r=>r.mutation(t,e)));var Wb=e=>vc.use(t=>t.invalidate(e)),Kb=Qn(vc)(hie);function Qz(e){switch(typeof e){case"string":case"number":case"bigint":case"boolean":return String(e);default:return G(e)}}var Uk=(e,t)=>{if(Array.isArray(e)){for(let r=0;r<e.length;r++)t(Qz(e[r]));return}for(let r in e){t(r);let n=e[r];for(let o=0;o<n.length;o++)t(`${r}:${Qz(n[o])}`)}};var Yz="~effect/SubscriptionRef",vh=e=>O(e,Yz),Pye={...wr,[Yz]:{_A:F},toJSON(){return{_id:"SubscriptionRef",value:this.value}}};var Dk=e=>pk(e.pubsub);var Xz=e=>W(()=>e.value);var xie=(e,t)=>{e.value=t,iH(e.pubsub,t)};var Lk=d(2,(e,t)=>e.semaphore.withPermit(W(()=>xie(e,t))));var iE={};ps(iE,{Fetch:()=>CW,RequestInit:()=>sE,layer:()=>Lie});var Bk="~effect/http/HttpBody";var tW="~effect/http/HttpBody/HttpBodyError",rW=class extends sr("HttpBodyError"){[tW]=tW};var Gb=class{[Bk];constructor(){this[Bk]=Bk}[Qe](){return this.toJSON()}toString(){return H(this,{ignoreToString:!0})}},$k=class extends Gb{_tag="Empty";toJSON(){return{_id:"effect/HttpBody",_tag:"Empty"}}},nW=new $k;var Ch=class extends Gb{_tag="Uint8Array";contentType;contentLength;text;_body;constructor(t,r,n,o){super(),this._body=t,this.text=o,this.contentType=r,this.contentLength=n}get body(){return this._body??=gie(this.text)}toJSON(){return{_id:"effect/HttpBody",_tag:"Uint8Array",body:this.contentType.startsWith("text/")||this.contentType.endsWith("json")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},jk=(e,t)=>new Ch(e,t??"application/octet-stream",e.length),oW=new TextEncoder,Jb=globalThis.Buffer,gie=Jb!==void 0?e=>Jb.from(e,"utf8"):e=>oW.encode(e),Hk=(e,t)=>{if(typeof e!="string"&&(e=e===void 0?"":String(e)),Jb!==void 0)return new Ch(void 0,t??"text/plain",Jb.byteLength(e,"utf8"),e);let r=oW.encode(e);return new Ch(r,t??"text/plain",r.length,e)};var zk="~effect/http/HttpClientError";var co=class extends sr("HttpClientError"){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[zk]=zk;get request(){return this.reason.request}get response(){return"response"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},kh=e=>e.endsWith("Error")?e.slice(0,-5):e,Rh=(e,t,r)=>t?`${e}: ${t} (${r})`:`${e} error (${r})`,Zb=class extends sr("TransportError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Rh(kh(this._tag),this.description,this.methodAndUrl)}};var Qb=class extends sr("InvalidUrlError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Rh(kh(this._tag),this.description,this.methodAndUrl)}},Ah=class extends sr("StatusCodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rh(kh(this._tag),this.description,t)}},Cc=class extends sr("DecodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rh(kh(this._tag),this.description,t)}},Yb=class extends sr("EmptyBodyError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rh(kh(this._tag),this.description,t)}},wd=class e extends Ar(zk)({_tag:He("HttpError"),kind:Fo(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:lr(er())}){static fromHttpClientError(t){return new e({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}};var sW=[["GET","get"],["POST","post"],["PUT","put"],["DELETE","del"],["PATCH","patch"],["HEAD","head"],["OPTIONS","options"],["TRACE","trace"],["QUERY","query"]];var aW=(e,t)=>t._tag==="Empty"||t._tag==="FormData"?oc(oc(e,"content-type"),"content-length"):(e=t.contentType===void 0?oc(e,"content-type"):fm(e,"content-type",t.contentType),t.contentLength===void 0?oc(e,"content-length"):fm(e,"content-length",t.contentLength.toString()));var eE=class extends sr("UrlError"){},tE=(e,t,r)=>Ux({try:()=>{let n=new URL(e,Sie());for(let o=0;o<t.params.length;o++){let[s,i]=t.params[o];i!==void 0&&n.searchParams.append(s,i)}return r!==void 0&&(n.hash=r),n},catch:n=>new eE({cause:n})}),Sie=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var cW="~effect/http/HttpClientRequest";var bie={[cW]:cW,...Ot,toJSON(){return{_id:"HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ho(this.headers),body:this.body.toJSON()}},pipe(){return V(this,arguments)}};function Bi(e,t,r,n,o,s){let i=Object.create(bie);return i.method=e,i.url=t,i.urlParams=r,i.hash=n,i.headers=o,i.body=s,i}var Eie=Bi("GET","",s1,_(),kl,nW),uW=e=>(t,r)=>Iie(Eie,{method:e,url:t,...r??void 0});var Iie=d(2,(e,t)=>{let r=e;return t.method&&(r=fW(r,t.method)),t.url&&(r=pW(r,t.url)),t.headers&&(r=Kk(r,t.headers)),t.urlParams&&(r=vie(r,t.urlParams)),t.hash&&(r=Cie(r,t.hash)),t.body&&(r=hW(r,t.body)),t.accept&&(r=dW(r,t.accept)),t.acceptJson&&(r=Tie(r)),r}),fW=d(2,(e,t)=>Bi(t,e.url,e.urlParams,e.hash,e.headers,e.body)),lW=d(3,(e,t,r)=>Bi(e.method,e.url,e.urlParams,e.hash,fm(e.headers,t,r),e.body)),Kk=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,e.hash,r1(e.headers,t),e.body));var dW=d(2,(e,t)=>lW(e,"Accept",t)),Tie=dW("application/json"),pW=d(2,(e,t)=>{if(typeof t=="string")return Bi(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),n=Mu(r.searchParams),o=Xc(r.hash===""?void 0:r.hash.slice(1));return r.search="",r.hash="",Bi(e.method,r.toString(),n,o,e.headers,e.body)}),mW=d(2,(e,t)=>t===""?e:Bi(e.method,wie(t,e.url),e.urlParams,e.hash,e.headers,e.body));var wie=(e,t)=>{let r=e.endsWith("/"),n=t.startsWith("/");return r&&n?e+t.slice(1):!r&&!n?e+"/"+t:e+t};var vie=d(2,(e,t)=>Bi(e.method,e.url,a1(e.urlParams,t),e.hash,e.headers,e.body));var Cie=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,N(t),e.headers,e.body));var hW=d(2,(e,t)=>Bi(e.method,e.url,e.urlParams,e.hash,aW(e.headers,t),t));function xW(e){let t=tE(e.url,e.urlParams,_n(e.hash));return tt(t)?N(t.success):_()}var yf="~effect/http/HttpIncomingMessage";var gW=(e,t)=>{let r=e.headers["content-type"]??"",n;if(r.includes("application/json"))try{n=Ai(e.json)}catch{}else if(r.includes("text/")||r.includes("urlencoded"))try{n=Ai(e.text)}catch{}let o={...t,headers:ho(e.headers),remoteAddress:e.remoteAddress};return n!==void 0&&(o.body=n),o};var vd="~effect/http/HttpClientResponse",yW=(e,t)=>new Gk(e,t);var Gk=class extends bx{[yf];[vd];request;source;constructor(t,r){super(),this.request=t,this.source=r,this[yf]=yf,this[vd]=vd}toJSON(){return gW(this,{_id:"HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split("#")[0];let t=xW(this.request);return fe(t)?"":(t.value.hash="",t.value.href)}get headers(){return Zo(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=My(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return _()}get stream(){return this.source.body?mk({evaluate:()=>this.source.body,onError:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}):wc(new co({reason:new Yb({request:this.request,response:this,description:"can not create stream from empty body"})}))}get json(){return A(this.text,t=>Go({try:()=>t===""?null:JSON.parse(t),catch:r=>new co({reason:new Cc({request:this.request,response:this,cause:r})})}))}textBody;get text(){return this.textBody??=K(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return A(this.text,t=>Go({try:()=>Mu(new URLSearchParams(t)),catch:r=>new co({reason:new Cc({request:this.request,response:this,cause:r})})}))}formDataBody;get formData(){return this.formDataBody??=Vo({try:()=>this.source.formData(),catch:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}).pipe(ly,Ai)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=Vo({try:()=>this.source.arrayBuffer(),catch:t=>new co({reason:new Cc({request:this.request,response:this,cause:t})})}).pipe(ly,Ai),this.arrayBufferBody)}pipe(){return V(this,arguments)}};var SW=e=>t1({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${Zt(e.parent,{onNone:()=>"",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?"01":"00"}`});var Aie={"http:":80,"https:":443,"ws:":80,"wss:":443},EW=(e,t)=>{let r=t.search.slice(1);if(e.attribute("url.full",t.toString()),e.attribute("url.path",t.pathname),r!==""&&e.attribute("url.query",r),e.attribute("url.scheme",t.protocol.slice(0,-1)),t.hostname!==""){e.attribute("server.address",t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname);let n=t.port===""?Aie[t.protocol]:Number(t.port);n!==void 0&&e.attribute("server.port",n)}},Zk=(e,t,r,n,o)=>{for(let s in r)n(s,t)&&e.attribute(`http.${t}.header.${s}`,n1(s,o)?"<redacted>":r[s])};var IW="~effect/http/HttpClient";var Qk=Ue("effect/HttpClient");var Rie=d(2,(e,t)=>Yk(r=>t(e.postprocess(r)),e.preprocess));var Yk=(e,t)=>{let r=Object.create(Oie);return r.preprocess=t,r.postprocess=e,r.execute=function(n){return e(t(n))},r},Oie={[IW]:IW,pipe(){return V(this,arguments)},...Ot,toJSON(){return{_id:"effect/HttpClient"}},...Object.fromEntries(sW.map(([e,t])=>[t,function(r,n){return this.execute(uW(e)(r,n))}]))},TW=e=>Yk(t=>A(t,r=>ar(n=>{let o=Uie.get(r),s=o??new AbortController,i=tE(r.url,r.urlParams,_n(r.hash));if(be(i))return D(new co({reason:new Qb({request:r,cause:i.failure})}));let a=i.success;if(n.getRef(qf)||n.getRef(Pie)(r)){let u=e(r,a,s.signal,n);return o?u:en(f=>Un(f(u),{onSuccess(p){return nE.register(p,s),I(new oE(p,s))},onFailure(p){return fl(p)&&s.abort(),je(p)}}))}return Qp(n.getRef(Nie)(r),{kind:"client"},u=>{u.attribute("http.request.method",r.method);let f=n.getRef(Ww);EW(u,a);let p=n.getRef(Mie);return Zk(u,"request",r.headers,p,f),r=n.getRef(Fie)?Kk(r,SW(u)):r,en(m=>m(e(r,a,s.signal,n)).pipe(bl(u,{captureStackTrace:!1}),Un({onSuccess:h=>(u.attribute("http.response.status_code",h.status),Zk(u,"response",h.headers,p,f),h.status>=400&&h.status<600&&(u.attribute("error.type",String(h.status)),_ie(n,u,r,h)),o?I(h):(nE.register(h,s),I(new oE(h,s)))),onFailure(h){return!o&&fl(h)&&s.abort(),je(h)}})))})})),I),_ie=(e,t,r,n)=>{let o=Ir();yt(0);let s;try{s=Jn(new co({reason:new Ah({request:r,response:n})}))}finally{yt(o)}t.end(e.getRef(jg)?e.getRef(Yn).currentTimeNanosUnsafe():BigInt(0),s)},wW=d(2,(e,t)=>Yk(e.postprocess,r=>K(e.preprocess(r),t)));var Pie=Ce("effect/http/HttpClient/TracerDisabledWhen",{defaultValue:()=>Oa}),Mie=Ce("effect/http/HttpClient/TracerHeaderFilter",{defaultValue:()=>Oa}),Fie=Ce("effect/http/HttpClient/TracerPropagationEnabled",{defaultValue:nr}),Nie=Ce("effect/http/HttpClient/SpanNameGenerator",{defaultValue:()=>e=>e.method}),vW=e=>Qn(Qk)(yn(t=>K(e,r=>Rie(r,Xa(n=>Kr(t,n)))))),nE=(()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(r=>{r.abort()});return{register(r,n){t.register(r,n,r)},unregister(r){t.unregister(r)}}}let e=new WeakMap;return{register(t,r){e.set(t,setTimeout(()=>r.abort(),5e3))},unregister(t){let r=e.get(t);r!==void 0&&(clearTimeout(r),e.delete(t))}}})(),Uie=new WeakMap,oE=class{original;controller;constructor(t,r){this.original=t,this.controller=r}[vd]=vd;[yf]=yf;applyInterrupt(t){return L(()=>(nE.unregister(this.original),Su(t,()=>W(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return vn(()=>(nE.unregister(this.original),Eh(this.original.stream,W(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Qe](){return this.original[Qe]()}pipe(){return V(this,arguments)}};var CW=Ce("effect/http/FetchHttpClient/Fetch",{defaultValue:()=>globalThis.fetch}),sE=class extends Ue()("effect/http/FetchHttpClient/RequestInit"){},Die=TW((e,t,r,n)=>{let o=n.getRef(CW),s=Vi(n.context,sE)??{},i=s.headers?Rl(Zo(s.headers),e.headers):e.headers;i["content-length"]&&(i=oc(i,"content-length"));let a=c=>K(Vo({try:()=>o(t,{...s,method:e.method,headers:i,body:c,duplex:typeof ReadableStream<"u"&&c instanceof ReadableStream?"half":void 0,signal:r}),catch:u=>new co({reason:new Zb({request:e,cause:u})})}),u=>yW(e,u));switch(e.body._tag){case"Raw":case"Uint8Array":return a(e.body.body);case"FormData":return a(e.body.formData);case"Stream":return A(kk(e.body.stream),a)}return a(void 0)}),Lie=vW(I(Die));var kW=Ue("effect/socket/Socket");var eR="~effect/socket/Socket/CloseEvent",AW=class{[eR];code;reason;constructor(t=1e3,r){this[eR]=eR,this.code=t,this.reason=r}toString(){return this.reason?`${this.code}: ${this.reason}`:`${this.code}`}};var aE="~effect/socket/Socket/SocketError",Bie=e=>O(e,aE),Oh=class extends Ar("effect/socket/Socket/SocketReadError")({_tag:He("SocketReadError"),cause:er()}){message="An error occurred during Read"},tR=class extends Ar("effect/socket/Socket/SocketWriteError")({_tag:He("SocketWriteError"),cause:er()}){message="An error occurred during Write"},rR=class extends Ar("effect/socket/Socket/SocketOpenError")({_tag:He("SocketOpenError"),kind:Fo(["Unknown","Timeout"]),cause:er()}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}},nR=class e extends Ar("effect/socket/Socket/SocketUpgradeError")({_tag:He("SocketUpgradeError"),cause:lr(er())}){static unsupported=()=>D(new _h({reason:new e({})}));get message(){return this.cause===void 0?"Socket does not support TLS upgrade":"An error occurred during TLS upgrade"}},oR=class extends Ar("effect/socket/Socket/SocketCloseError")({_tag:He("SocketCloseError"),code:In,closeReason:lr(z)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},sR=Pe([Oh,tR,rR,nR,oR]),_h=class extends EA(aE)("SocketError",{_tag:He("SocketError"),reason:sR}){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[aE]=aE;static is(t){return Bie(t)}message=this.reason.message};var gbe=64*1024;var RW="~effect/reactivity/AsyncResult",aR=e=>O(e,RW),cE={[RW]:{E:F,A:F},pipe(){return V(this,arguments)},[ae](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case"Initial":return!0;case"Success":return Z(this.value,e.value);case"Failure":return Z(this.cause,e.cause)}},[ie](){let e=Be(`${this._tag}:${this.waiting}`);return this._tag==="Initial"?e:he(e)(this._tag==="Success"?G(this.value):G(this.cause))}};var cR=(e,t)=>e._tag==="Success"?us(e.value):Ad(e.cause,{previous:t}),uE=e=>e._tag==="None"?Ca(!0):Ph(e.value);var OW=e=>e._tag!=="Initial",Ca=(e=!1)=>{let t=Object.create(cE);return t._tag="Initial",t.waiting=e,t},Cd=e=>e._tag==="Success",us=(e,t)=>{let r=Object.create(cE);return r._tag="Success",r.value=e,r.waiting=t?.waiting??!1,r.timestamp=t?.timestamp??Date.now(),r},_W=e=>e._tag==="Failure";var iR=(e,t)=>{let r=Object.create(cE);return r._tag="Failure",r.cause=e,r.previousSuccess=t?.previousSuccess??_(),r.waiting=t?.waiting??!1,r},Ad=(e,t)=>iR(e,{previousSuccess:gs(t.previous,r=>Cd(r)?N(r):_W(r)?r.previousSuccess:_()),waiting:t.waiting});var PW=(e,t)=>Ad(hN(e),t),Ph=d(e=>aR(e[0]),(e,t)=>{if(e.waiting)return t?.touch?jie(e):e;let r=Object.assign(Object.create(cE),e);return r.waiting=!0,t?.touch&&Cd(r)&&(r.timestamp=Date.now()),r}),jie=e=>Cd(e)?us(e.value,{waiting:e.waiting}):e,Mh=d(2,(e,t)=>e._tag==="Failure"?Ad(e.cause,{previous:t,waiting:e.waiting}):e),uR=e=>e._tag==="Success"?N(e.value):e._tag==="Failure"?Lt(e.previousSuccess,t=>t.value):_();var fR=e=>Bf(uR(e),()=>new ll("AsyncResult.getOrThrow: no value found"));var kd=e=>{switch(e._tag){case"Success":return Mr(e.value);case"Failure":return ir(e.cause);default:return Jn(new ll)}};var lR=e=>{let t=e.success??Mi,r=e.error??Mi,n=Cr()([t,Jm(r,er())],([o,s])=>(i,a,c)=>{if(!aR(i))return D(new at(a,i,c));switch(i._tag){case"Initial":return I(i);case"Success":return cr(ot(o)(i.value,c),{onSuccess:u=>us(u,i),onFailure:u=>tn(a,"value",u,i,c)});case"Failure":{let u=i.previousSuccess.pipe(Lt(p=>cr(ot(o)(p.value,c),{onSuccess:m=>N(us(m,p)),onFailure:m=>new Ft(a,[new At(["previousSuccess","value"],m)],i,c)})),Ma(()=>ia)),f=Iu(ot(s)(i.cause,c),p=>tn(a,"cause",p,i,c));return ur(u,p=>Eu(f,m=>iR(m,{previousSuccess:p,waiting:i.waiting})))}}},{expected:"AsyncResult",toCodec([o,s]){let i=ya("Success",{value:o,waiting:Fi,timestamp:In});return Ne()(Pe([ya("Initial",{waiting:Fi}),i,ya("Failure",{cause:s,previousSuccess:ba(i),waiting:Fi})]),Fe({decode:a=>{switch(a._tag){case"Initial":return Ca(a.waiting);case"Success":return us(a.value,{waiting:a.waiting,timestamp:a.timestamp});case"Failure":return iR(a.cause,{previousSuccess:Lt(a.previousSuccess,c=>us(c.value,c)),waiting:a.waiting})}},encode(a){switch(a._tag){case"Initial":return{_tag:"Initial",waiting:a.waiting};case"Success":return{_tag:"Success",value:a.value,waiting:a.waiting,timestamp:a.timestamp};case"Failure":return{_tag:"Failure",cause:a.cause,previousSuccess:a.previousSuccess,waiting:a.waiting}}}}))},toEquivalence:Wd,toFormatter:([o,s])=>i=>{switch(i._tag){case"Success":return`AsyncResult.Success(${o(i.value)}, ${i.waiting}, ${i.timestamp})`;case"Failure":return`AsyncResult.Failure(${s(i.cause)}, ${i.waiting})`;case"Initial":return`AsyncResult.Initial(${i.waiting}, ${i.waiting})`}}});return Object.assign(n,{success:t,error:r})};var Nh="~effect/reactivity/AtomRegistry",Hie=e=>O(e,Nh),MW=e=>new mR(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),fE=Ue(Nh);var Dh=d(e=>Hie(e[0]),(e,t,r)=>{let n=r?.suspendOnWaiting??!1;return Nn(o=>{let s=e.get(t);if(s._tag!=="Initial"&&!(n&&s.waiting))return o(kd(s));let i=e.subscribe(t,a=>{a._tag!=="Initial"&&!(n&&a.waiting)&&(o(kd(a)),i())});return W(i)})});var qie={immediate:!0},FW=e=>{e()},An={};function Uh(e,t){let r=An;for(let n of e)try{t(n)}catch(o){r===An&&(r=o)}if(r!==An)throw r}var pR="~effect-atom/atom/Atom/Serializable",Fh=e=>pR in e?e[pR].key:e,mR=class{[Nh];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(t,r,n,o){if(this[Nh]=Nh,this.scheduler=new fi("sync",r),this.schedulerAsync=new fi("async",r),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=o,n===void 0&&o!==void 0?this.timeoutResolution=Math.round(o/2):this.timeoutResolution=n??1e3,t!==void 0)for(let[s,i]of t){let a=s;for(;a.initialValueTarget;)a=a.initialValueTarget;this.ensureNode(a).setInitialValue(i)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(t){return this.ensureNode(t).value()}set(t,r){t.write(this.ensureNode(t).writeContext,r)}setSerializable(t,r){this.preloadedSerializable.set(t,r)}modify(t,r){let n=this.ensureNode(t),o=r(n.value());return t.write(n.writeContext,o[1]),o[0]}update(t,r){let n=this.ensureNode(t);t.write(n.writeContext,r(n.value()))}refresh=t=>{t.refresh!==void 0?t.refresh(this.refresh):this.invalidateAtom(t)};subscribe(t,r,n){let o=this.ensureNode(t);n?.immediate?r(o.value()):o.state===an.stale&&o.value();let s=o.subscribe(function(){r(o._value)});return()=>{s(),o.canBeRemoved&&this.scheduleNodeRemoval(o)}}mount(t){return this.subscribe(t,Rr,qie)}atomHasTtl(t){return!t.keepAlive&&t.idleTTL!==0&&(t.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(t){let r=Fh(t),n=this.nodes.get(r);if(n===void 0?(n=this.createNode(t),this.nodes.set(r,n),this.onNodeAdded?.(n)):this.atomHasTtl(t)&&this.removeNodeTimeout(n),typeof r=="string"&&this.preloadedSerializable.has(r)){let o=this.preloadedSerializable.get(r);this.preloadedSerializable.delete(r);let s=t[pR].decode(o),i=t;for(;i.initialValueTarget;)i=i.initialValueTarget;i===t?n.setValue(s):this.ensureNode(i).setInitialValue(s)}return n}createNode(t){if(this.disposed)throw new Error(`Cannot access Atom ${t}: registry is disposed`);return t.keepAlive||this.scheduleAtomRemoval(t),new hR(this,t)}invalidateAtom=t=>{this.ensureNode(t).invalidate()};scheduleAtomRemoval(t){this.dispatcher.scheduleTask(()=>{let r=this.nodes.get(Fh(t));r!==void 0&&r.canBeRemoved&&this.removeNode(r)},0)}scheduleNodeRemoval(t){this.dispatcher.scheduleTask(()=>{t.canBeRemoved&&this.removeNode(t)},0)}removeNode(t){this.atomHasTtl(t.atom)?this.setNodeTimeout(t):(this.nodes.delete(Fh(t.atom)),t.remove(),this.onNodeRemoved?.(t))}setNodeTimeout(t){if(this.nodeTimeoutBucket.has(t))return;let r=t.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(r-=this.#e,r<=0)){this.nodes.delete(Fh(t.atom)),t.remove(),this.onNodeRemoved?.(t);return}let n=Math.ceil(r/this.timeoutResolution)*this.timeoutResolution,o=Date.now()+n,s=o-o%this.timeoutResolution+this.timeoutResolution,i=this.timeoutBuckets.get(s);i===void 0&&(i=[new Set,setTimeout(()=>this.sweepBucket(s),s-Date.now())],this.timeoutBuckets.set(s,i)),i[0].add(t),this.nodeTimeoutBucket.set(t,s)}removeNodeTimeout(t){let r=this.nodeTimeoutBucket.get(t);if(r===void 0)return;this.nodeTimeoutBucket.delete(t),this.scheduleNodeRemoval(t);let[n,o]=this.timeoutBuckets.get(r);n.delete(t),n.size===0&&(clearTimeout(o),this.timeoutBuckets.delete(r))}#e=null;sweepBucket(t){let r=this.timeoutBuckets.get(t)[0];this.timeoutBuckets.delete(t),Uh(r,this.removeIdleNode)}removeIdleNode=t=>{if(this.nodeTimeoutBucket.delete(t),!!t.canBeRemoved){this.nodes.delete(Fh(t.atom)),this.onNodeRemoved?.(t),this.#e=t.atom.idleTTL??this.defaultIdleTTL;try{t.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,r])=>clearTimeout(r)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let t=Array.from(this.nodes.values());this.nodes.clear();for(let r of t)r.state=an.removed;Uh(t,this.destroyNode)}destroyNode=t=>{t.remove(),this.onNodeRemoved?.(t)};dispose(){this.disposed=!0,this.reset()}},fs={alive:1,initialized:2,waitingForValue:4},an={uninitialized:fs.alive|fs.waitingForValue,stale:fs.alive|fs.initialized|fs.waitingForValue,valid:fs.alive|fs.initialized,removed:0},hR=class{constructor(t,r){this.registry=t,this.atom=r,this.writeContext=new xR(t,this)}registry;atom;state=an.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case an.uninitialized:return"uninitialized";case an.stale:return"stale";case an.valid:return"valid";default:return"removed"}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(t){let r=this.isObserved;this.observedChildren+=t,r!==this.isObserved&&this.observedChanged(t)}observedChanged(t){for(let r of this.parents)r.childObserved(t)}_value=void 0;value(){for(;(this.state&fs.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let t=Wie(this);this.lifetime=t;let r,n=!1;try{r=this.atom.read(t),n=!0}finally{let o=t.reads;t.reads=void 0,this.lifetime===t&&(this.dropUnread(o),n||this.fail())}if(this.lifetime===t&&(this.state&fs.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=an.valid):this.setValue(r)),t.failure!==An)throw t.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(t,r){let n=this.registry.ensureNode(t);this.parents.has(n)||(this.parents.add(n),n.children.add(this),this.isObserved&&n.childObserved(1));try{return n.value()}catch(o){if(r.reads===void 0||n.state!==an.valid)throw o;return r.failure===An&&(r.failure=o),n._value}finally{r.reads!==void 0&&!r.disposed&&r.reads.add(n)}}dropUnread(t){if(t.size===this.parents.size)return;let r=this.isObserved;for(let n of this.parents)t.has(n)||(this.parents.delete(n),n.children.delete(this),r&&n.childObserved(-1),n.canBeRemoved&&this.registry.scheduleNodeRemoval(n))}valueOption(){return(this.state&fs.initialized)===0?_():N(this._value)}setInitialValue(t){if((this.state&fs.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=an.stale,this._value=t,this.listeners.size>0&&this.announce();return}this.setValue(t)}setValue(t){let r=this.failed;this.failed=!1;let n=(this.state&fs.initialized)!==0;if(this.state=an.valid,n&&this.atom.equals(this._value,t)){r&&this.invalidateChildren();return}this._value=t;let o=An;try{this.invalidateChildren()}catch(s){o=s}if(this.listeners.size>0)try{this.announce()}catch(s){o===An&&(o=s)}if(o!==An)throw o}announce(){cn.phase===Ac.collect?cn.notify.add(this):this.notify()}invalidate(){if(this.state===an.valid){this.state=an.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&cn.phase!==Ac.collect?this.build():this.propagate()}propagate(){cn.phase===Ac.collect?(this.building&&(this.invalidatedDuringBuild=!0),cn.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let t=An;for(let r of Array.from(this.children))if(r.affectedBy(this))try{r.invalidate()}catch(n){t===An&&(t=n)}if(t!==An)throw t}affectedBy(t){if(this.state===an.valid)return!0;let r=this.lifetime?.reads;return r!==void 0?r.has(t):this.isObserved&&t.state===an.valid}notify(){cn.phase===Ac.commit&&cn.notify.delete(this),Uh(this.listeners,FW)}disposeLifetime(){let t=this.lifetime;t!==void 0&&(this.lifetime=void 0,t.dispose())}remove(){let t=this.isObserved;this.state=an.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let r=Array.from(this.parents);this.parents.clear(),Uh(r,n=>{n.children.delete(this),t&&n.childObserved(-1),n.canBeRemoved&&this.registry.removeNode(n)})}}subscribe(t){let r=this.isObserved;return this.listeners.add(t),r||this.observedChanged(1),()=>{this.listeners.delete(t)&&!this.isObserved&&this.observedChanged(-1)}}},zie={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let r=this.get(e);if(t?.suspendOnWaiting&&r.waiting)return Xn;switch(r._tag){case"Initial":return Xn;case"Failure":return ir(r.cause);case"Success":return I(r.value)}},resultOnce(e,t){return Nn(r=>{let n=this.once(e);if(n._tag!=="Initial"&&!(t?.suspendOnWaiting&&n.waiting))return r(kd(n));let o=this.node.registry.subscribe(e,s=>{s._tag==="Initial"||t?.suspendOnWaiting&&s.waiting||(o(),r(kd(s)))},{immediate:!1});return W(o)})},setResult(e,t){return this.disposed?Xn:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag==="None"?Xn:I(t.value)},someOnce(e){return Nn(t=>{let r=this.once(e);if(de(r))return t(I(r.value));let n=this.node.registry.subscribe(e,o=>{fe(o)||(n(),t(I(o.value)))},{immediate:!1});return W(n)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?_():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,r){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,r))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?Js:Db(r=>W(()=>{this.subscribe(e,n=>Ic(r,n),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(yk(OW),xf(r=>r._tag==="Success"?I(r.value):je(r.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,Uh(e.reverse(),FW)}},Wie=e=>{function t(r){return t.disposed||t.isFn?e.registry.get(r):e.readTracked(r,t)}return Object.setPrototypeOf(t,zie),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=An,t},xR=class{constructor(t,r){this.registry=t,this.node=r}registry;node;get(t){return this.registry.get(t)}set(t,r){return this.registry.set(t,r)}setSelf(t){return this.node.setValue(t)}refreshSelf(){return this.node.invalidate()}},Ac={disabled:0,collect:1,commit:2},cn={phase:Ac.disabled,depth:0,stale:[],notify:new Set};function NW(e){let t=cn.phase;cn.phase=Ac.collect,cn.depth++;let r=An;try{e()}catch(n){r=n}if(cn.depth===1){let{notify:n,stale:o}=cn,s=0;do{for(cn.phase=Ac.collect;s<o.length;s++)try{Kie(o[s])}catch(i){r===An&&(r=i)}cn.phase=Ac.commit;for(let i of n)try{i.notify()}catch(a){r===An&&(r=a)}}while(s<o.length);cn.stale=[],n.clear()}if(cn.depth--,cn.phase=t,r!==An)throw r}function Kie(e){if(e.state===an.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=an.stale,e.disposeLifetime()}e.value()}var ex={};ps(ex,{ConnectionHooks:()=>Xh,CurrentHeaders:()=>DE,Protocol:()=>Hi,layerProtocolHttp:()=>uue,layerProtocolSocket:()=>due,layerProtocolWorker:()=>pue,make:()=>oO,makeNoSerialization:()=>d6,makeProtocolHttp:()=>p6,makeProtocolSocket:()=>m6,makeProtocolWorker:()=>h6,withHeaders:()=>cue});var Lh=class extends Ue()("effect/workers/Transferable/Collector"){},DW=()=>{let e=[],t=o=>{e.push(...o)},r=()=>e,n=()=>{let o=e;return e=[],o};return Lh.of({addAllUnsafe:t,addAll:o=>W(()=>t(o)),readUnsafe:r,read:W(r),clearUnsafe:n,clear:W(n)})};var gR="~effect/workers/WorkerError";var yR=class extends Ar("effect/workers/WorkerError/WorkerSpawnError")({_tag:He("WorkerSpawnError"),message:z,cause:lr(er())}){},SR=class extends Ar("effect/workers/WorkerError/WorkerSendError")({_tag:He("WorkerSendError"),message:z,cause:lr(er())}){},bR=class extends Ar("effect/workers/WorkerError/WorkerReceiveError")({_tag:He("WorkerReceiveError"),message:z,cause:lr(er())}){},ER=class extends Ar("effect/workers/WorkerError/WorkerUnknownError")({_tag:He("WorkerUnknownError"),message:z,cause:lr(er())}){},IR=Pe([yR,SR,bR,ER]),LW=class extends Ar(gR)({_tag:He("WorkerError"),reason:IR}){constructor(t){super({...t,cause:t.reason.cause})}[gR]=gR;get message(){return this.reason.message}};var lE=class extends Ue()("effect/workers/Worker/WorkerPlatform"){};var TR=(e,t)=>e===void 0?t:`${e}.${t}`,wR=(e,t)=>({"rpc.system.name":"effect_rpc","rpc.method":e,...t});var Od={};ps(Od,{ServerClient:()=>kR,custom:()=>Xie,exitSchema:()=>RR,fork:()=>rae,isRpc:()=>Qie,isWrapper:()=>Rd,make:()=>$W,uninterruptible:()=>nae,unwrap:()=>eae,wrap:()=>mE,wrapMap:()=>tae});var vR="~effect/rpc/RpcSchema/StreamSchema";function Bh(e){return O(e,vR)}function dE(e){return Bh(e)?N({success:e.success,error:e.error}):_()}var Zie=Ge(Ae);function BW(e,t){return J(Zie.ast,{[vR]:vR,success:e,error:t})}var AR="~effect/rpc/Rpc",Qie=e=>O(e,AR),kR=class{id;annotations;constructor(t){this.id=t,this.annotations=pt()}annotate(t,r){return this.annotations=We(this.annotations,t,r),this}},Yie={[AR]:AR,pipe(){return V(this,arguments)},setSuccess(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return kc({_tag:this._tag,payloadSchema:Ju(e)?e:Te(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return kc({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:We(this.annotations,e,t)})},annotateMerge(e){return kc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Kr(this.annotations,e)})}},kc=e=>{function t(){}return Object.setPrototypeOf(t,Yie),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},$W=(e,t)=>{let r=t?.success??pd,n=t?.error??Mi,o=t?.defect??er(),s;return t?.primaryKey?s=class extends YS(`effect/rpc/Rpc/${e}`)(t.payload){[Uz](){return t.primaryKey(this)}}:s=Ju(t?.payload)?t?.payload:t?.payload?Te(t?.payload):pd,kc({_tag:e,payloadSchema:s,successSchema:t?.stream?BW(r,n):r,errorSchema:t?.stream?Mi:n,defectSchema:o,annotations:pt(),middlewares:new Set})},Xie=e=>(t,r)=>{let n=r?.success??pd,o=r?.error??Mi,s=r?.defect??er(),i=e({success:n,error:o,defect:s});return $W(t,{...i,primaryKey:r?.primaryKey,payload:r?.payload,stream:r?.stream})},CR=new WeakMap,RR=e=>{if(CR.has(e))return CR.get(e);let t=e,r=new Set([t.errorSchema]),n=dE(t.successSchema);de(n)&&r.add(n.value.error);for(let s of t.middlewares)r.add(s.error);let o=yA(de(n)?pd:t.successSchema,Pe([...r]),t.defectSchema);return CR.set(e,o),o},$h="~effect/rpc/Rpc/Wrapper",Rd=e=>$h in e,mE=e=>t=>Rd(t)?{[$h]:$h,value:t.value,fork:e.fork??t.fork,uninterruptible:e.uninterruptible??t.uninterruptible}:{[$h]:$h,value:t,fork:e.fork??!1,uninterruptible:e.uninterruptible??!1},eae=e=>Rd(e)?e.value:e,tae=(e,t)=>Rd(e)?mE(e)(t(e.value)):t(e),rae=mE({fork:!0}),nae=mE({uninterruptible:!0});var OR="~effect/rpc/RpcClientError",Rc=class extends Ar("effect/rpc/RpcClientError/RpcClientDefect")({_tag:He("RpcClientDefect"),message:z,cause:er()}){},Zs=class extends Ar(OR)({_tag:He("RpcClientError"),reason:Pe([IR,sR,wd,Rc])}){[OR]=OR;get message(){return`${this.reason._tag}: ${this.reason.message}`}};var _R=e=>e;var jW={_tag:"Ping"};var jh=Pe([z,Zu]),sae=Te({_tag:He("Request"),id:jh,tag:z,payload:qs,headers:ct(rs([z,z])),isNotification:lr(fr(!0)),traceId:lr(z),spanId:lr(z),sampled:lr(Fi)}),PR=Pe([sae,Te({_tag:He("Ack"),requestId:jh}),Te({_tag:He("Interrupt"),requestId:jh}),Te({_tag:He("Ping")}),Te({_tag:He("Eof")}),Te({_tag:He("Chunk"),requestId:jh,values:qs}),Te({_tag:He("Exit"),requestId:jh,exit:qs}),Te({_tag:He("Defect"),defect:qs}),Te({_tag:He("Pong")})]);var MR=e=>{switch(e._tag){case"Exit":case"Defect":case"ClientProtocolError":return!0;default:return!1}};var Yh={};ps(Yh,{MaxBufferSizeExceeded:()=>ME,RpcSerialization:()=>fn,json:()=>o6,jsonRpc:()=>i6,layerJson:()=>Qce,layerJsonRpc:()=>eue,layerNdJsonRpc:()=>tue,layerNdjson:()=>Yce,layerNdjsonWith:()=>Xce,layerSchemaBinary:()=>rue,makeNdjson:()=>NE,ndJsonRpc:()=>a6,ndjson:()=>s6});var iae=new WeakMap,aae=new WeakMap,cae=new WeakMap,uae=new WeakMap;function c4(e,t){let r=t?.fingerprint===!0?aae:iae,n=r.get(e);if(n!==void 0)return n;let{exact:o,layout:s,recursive:i,target:a}=Md(e),c=bf(s,t?.fingerprint),u=o?{value:void 0}:void 0,f=NR(u===void 0?a:Bce(a,u,!i),s,c,u);return r.set(e,f),f}function VR(e,t){let r=t?.fingerprint===!0?uae:cae,n=r.get(e);if(n!==void 0)return n;let{exact:o,exitSuccess:s,layout:i,target:a}=Md(e);if(!o){if(!s)return c4(e,t);let u={value:void 0},f=NR(jce(a,u),i,bf(i,t?.fingerprint),u,!0);return r.set(e,f),f}let c=NR(Hce(a),i,bf(i,t?.fingerprint),void 0);return r.set(e,c),c}function NR(e,t,r,n,o=!1){return qs.pipe(ee(e,Uce(t,r,n,o)))}function u4(e,t){let{exact:r,exitSuccess:n,layout:o}=Md(e),s=bf(o,t?.fingerprint),i=t??nn;if(!r||i.onExcessProperty==="error"){let a=Ym(c4(e,t),t);return!n||i.onExcessProperty==="error"?a:c=>{if(!PE(c))return a(c);try{return AE(o,c,i,s)}catch(u){throw u instanceof ji?new $n(u.issue):u}}}return a=>{try{return AE(o,a,i,s)}catch(c){throw c instanceof ji?new $n(c.issue):c}}}function fae(e,t){let{exact:r,layout:n}=Md(e),o=t??nn;if(!r||o.onExcessProperty==="error"){let i=u4(e,t);return a=>lae(a.map(i))}let s=bf(n,t?.fingerprint);return i=>{try{return H4(n,i,o,s)}catch(a){throw a instanceof ji?new $n(a.issue):a}}}function lae(e){if(e.length===1)return e[0];let t=0;for(let o of e)t+=o.length;let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function f4(e,t){let{exact:r,exitSuccess:n,layout:o,target:s}=Md(e),i=t??nn,a=r?void 0:jS(s,i),c=a!==void 0&&n?u=>PE(u)?u:a(u):a;return dae(o,bf(o,t?.fingerprint),i,t?.maxFrameSize,c,l4(r,t))}function l4(e,t){if(t?.dictionary!==!0)return!1;if(!e)throw new Error("Binary layout: dictionary needs a schema the binary layer validates on its own");return!0}function d4(e,t){let{exact:r,layout:n,target:o}=Md(e),s=l4(r,t),i=u4(e,t),a=fae(e,t);if(!s)return{encode:i,encodeMany:a};let c=bf(n,t?.fingerprint),u=t??nn,f=u.onExcessProperty==="error"?Ym(o,t):void 0,p=ace(),m=h=>{try{return h()}catch(x){throw x instanceof ji?new $n(x.issue):x}};return{encode:h=>m(()=>AE(n,f===void 0?h:f(h),u,c,p)),encodeMany:h=>m(()=>H4(n,f===void 0?h:h.map(f),u,c,p))}}function dae(e,t,r,n,o,s){let i=s?[]:void 0,a=new Uint8Array(0),c=0,u=0,f,p=!1,m=new zh,h=new qh(r,Mae),x=()=>{m.release(),h.clear(),a=$R,c=u=0},g=(v,T)=>{throw new $n(new le({expected:v},T,r))},y=()=>{let v=f;throw f=void 0,v},E=(v,T)=>{let S=v.length-T;S>a.length&&(a=new Uint8Array(Math.max(256,S))),a.set(T===0?v:v.subarray(T),0),c=0,u=S},b={feedSync(v){if(f!==void 0)return y();if(p)return g("parser is spent");let T=u===c,S,w,k;if(T)S=v,w=0,k=v.length;else{if(v.length>0){let $=u-c,te=$+v.length;if(te>a.length){let xe=new Uint8Array(Math.max(256,a.length*2,te));xe.set(a.subarray(c,u)),a=xe,c=0,u=$}else c>0&&(a.copyWithin(0,c,u),c=0,u=$);a.set(v,u),u+=v.length}S=a,w=c,k=u}let C=[],R=()=>(T?w<k&&E(v,w):(c=w,c===u&&(c=u=0)),C),M=($,te)=>{p=!0;let xe=new $n(new le({expected:$},te,r));if(x(),C.length===0)throw xe;return f=xe,C};for(;;){let $=0,te=-1,xe=k-w,Le=1;for(let Ee=0;Ee<Math.min(6,xe);Ee++){let Oe=S[w+Ee];if($+=(Oe&127)*Le,(Oe&128)===0){te=Ee+1;break}Le*=128}if(te===-1){if(xe<6)return R();let Ee=BigInt($);for(let Oe=6;Oe<Math.min(10,xe);Oe++){let rr=S[w+Oe];if(Ee|=BigInt(rr&127)<<BigInt(Oe*7),(rr&128)===0){if(te=Oe+1,Ee>UR)return M("safe integer length",Ee);$=Number(Ee);break}}if(te===-1)return xe>=10?M("uvarint",S.subarray(w,w+10)):R()}if($===0)return M("nonzero frame length",$);if(n!==void 0&&$>n)return M("frame within maxFrameSize",$);if(te+$>xe)return R();let Er=Q;try{Q=0;let Ee=w+te;h.beginFrame(),m.reset(S,Ee,Ee+$,r,h,t.positional,i);let Oe=Q4(e,m,t);C.push(o===void 0?Oe:o(Oe))}catch(Ee){p=!0,x();let Oe=Ee instanceof ji?new $n(Ee.issue):fd(Ee)?Ee:(()=>{throw Ee})();if(C.length===0)throw Oe;return f=Oe,C}finally{Q=Er}w+=te+$}},endSync(){if(f!==void 0)return y();if(p)return g("parser is spent");p=!0;let v=c<u?a.subarray(c,u):void 0;if(x(),v!==void 0)return g("complete value",v)},feed:v=>L(()=>{try{return I(b.feedSync(v))}catch(T){if(fd(T))return D(T);throw T}}),end:L(()=>{try{return b.endSync(),P}catch(v){if(fd(v))return D(v);throw v}})};return b}var pae="~effect/encoding/SchemaBinary/fieldId",mae=32,hae=33,UR=BigInt(Number.MAX_SAFE_INTEGER),EE=BigInt(0),ls=BigInt(1),xae=BigInt(2),p4=BigInt(7),qW=BigInt(127),gae=BigInt(1e6),yae=BigInt(255),zW=BigInt(4294967295),Sae=BigInt(32),$i=new TextEncoder,bae=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),m4=7,WW=0xffffffffffff,Eae=0xfffffffffffff,h4=0,x4=1,g4=2,KW=512,Iae=1048576,Tae=4194304,Ef=0,Sf=1,Vh=2,Gh=3,Jh=4,Zh=5,wae=6,vae=7,ds=8;function GR(e){return typeof e=="number"&&Number.isInteger(e)&&e>=-WW&&e<=WW}var kE=8,DR=2199023255551,_c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];function JR(e){for(let t=1;t<=kE;t++){let r=Math.round(e*_c[t]);if(!(r>=-DR&&r<=DR))return 0;if(r/_c[t]===e)return t}return 0}function y4(e){let t=Math.floor(e/2);return e%2===1?-t:t}var dt={bool:1,null:2,undefined:3,number:4,string:5,bytes:6,bigint:7,int64:8,struct:9,variant:10,array:11,option:12,result:13,duration:14,bigDecimal:15,dateTimeZoned:16,json:17,exit:18,cause:19,causeReason:20};function S4(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e[r],16777619);return t>>>0}var Cae=BigInt("14695981039346656037"),Aae=BigInt("1099511628211"),kae=BigInt("18446744073709551615");function VW(e){let t=Cae;for(let r=0;r<e.length;r++)t=(t^BigInt(e[r]))*Aae&kae;return t}function IE(e,t){for(let r=0;r<t.length;r++)e.push(t[r])}function Oc(e,t){for(;t>127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t)}function TE(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}function No(e,t){for(let r=0;r<8;r++)e.push(Number(t>>BigInt(r*8)&yae))}function b4(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length}var ji=class extends Error{issue;constructor(t){super("SchemaBinary failure"),this.issue=t}};function j(e,t,r){throw dr(new le({expected:e},t,r))}var Ze=[],Q=0;function dr(e){return new ji(Q===0?e:new At(Ze.slice(0,Q),e))}function Rae(e){let t=new Uint8Array(E4(e)),r=0;for(;e>127;)t[r++]=e&127|128,e=Math.floor(e/128);return t[r]=e,t}function E4(e){let t=1;for(;e>127;)e=Math.floor(e/128),t++;return t}var Oae=32;function _ae(e,t,r,n){let o=r-t;if(o===0)return"";if(o<=Oae){let s=Pae(e,t,r);if(s!==void 0)return s}try{return bae.decode(e.subarray(t,r))}catch{j("utf-8",void 0,n)}}function Pae(e,t,r){let n="",o=t;for(;o+16<=r;o+=16){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6],m=e[o+7],h=e[o+8],x=e[o+9],g=e[o+10],y=e[o+11],E=e[o+12],b=e[o+13],v=e[o+14],T=e[o+15];if((s|i|a|c|u|f|p|m|h|x|g|y|E|b|v|T)>127)return;n+=String.fromCharCode(s,i,a,c,u,f,p,m,h,x,g,y,E,b,v,T)}if(o+8<=r){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6],m=e[o+7];if((s|i|a|c|u|f|p|m)>127)return;n+=String.fromCharCode(s,i,a,c,u,f,p,m),o+=8}switch(r-o){case 0:return n;case 1:{let s=e[o];return s>127?void 0:n+String.fromCharCode(s)}case 2:{let s=e[o],i=e[o+1];return(s|i)>127?void 0:n+String.fromCharCode(s,i)}case 3:{let s=e[o],i=e[o+1],a=e[o+2];return(s|i|a)>127?void 0:n+String.fromCharCode(s,i,a)}case 4:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3];return(s|i|a|c)>127?void 0:n+String.fromCharCode(s,i,a,c)}case 5:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4];return(s|i|a|c|u)>127?void 0:n+String.fromCharCode(s,i,a,c,u)}case 6:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5];return(s|i|a|c|u|f)>127?void 0:n+String.fromCharCode(s,i,a,c,u,f)}default:{let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],p=e[o+6];return(s|i|a|c|u|f|p)>127?void 0:n+String.fromCharCode(s,i,a,c,u,f,p)}}}var LR=64*1024,Mae=256,Fae=512,Nae=16*1024;function BR(e){let t=new Uint8Array(e);return{buf:t,view:new DataView(t.buffer),offset:0,writing:!1}}var Hh=BR(LR),wE=class{buf=new Uint8Array(0);view=new DataView(this.buf.buffer);arena;start=0;limit=0;len=0;reset(){let t=Hh;(t.writing||t.offset>=t.buf.length)&&(t=Hh=BR(LR)),t.writing=!0,this.arena=t,this.buf=t.buf,this.view=t.view,this.start=t.offset,this.limit=t.buf.length-t.offset,this.len=0}ensure(t){if(this.len+t>this.limit){let r=this.arena,n=this.len+t,o=LR;for(;o<n;)o*=2;let s=BR(o);s.writing=!0,s.buf.set(this.buf.subarray(this.start,this.start+this.len)),r.writing=!1,this.arena=Hh=s,this.buf=s.buf,this.view=s.view,this.start=0,this.limit=s.buf.length}}byte(t){this.ensure(1),this.buf[this.start+this.len++]=t}bytes(t){this.ensure(t.length),this.buf.set(t,this.start+this.len),this.len+=t.length}uvarint(t){this.ensure(10);let r=this.buf,n=this.start+this.len;if(t<128)r[n++]=t;else if(r[n++]=t&127|128,t<16384)r[n++]=t>>>7;else{for(r[n++]=t>>>7&127|128,t=Math.floor(t/16384);t>127;)r[n++]=t&127|128,t=Math.floor(t/128);r[n++]=t}this.len=n-this.start}uvarintBig(t){for(;t>qW;)this.byte(Number(t&qW)|128),t>>=p4;this.byte(Number(t))}zigzag(t){this.uvarintBig(t>=EE?t<<ls:(-t<<ls)-ls)}numberVarint(t){let r=t<0||t===0&&1/t<0,n=r?-t:t;n<=Eae?this.uvarint(n*2+(r?1:0)):this.uvarintBig(BigInt(n)*xae+(r?ls:EE))}f64(t){this.ensure(8),this.view.setFloat64(this.start+this.len,t,!0),this.len+=8}i64(t){this.ensure(8),this.view.setBigInt64(this.start+this.len,t,!0),this.len+=8}u32le(t){this.ensure(4),this.view.setUint32(this.start+this.len,t>>>0,!0),this.len+=4}i32le(t){this.ensure(4),this.view.setInt32(this.start+this.len,t|0,!0),this.len+=4}idAndMark(t){let r=t.length;this.ensure(r+1);let n=this.buf,o=this.start+this.len;for(let i=0;i<r;i++)n[o++]=t[i];let s=o-this.start;return this.len=s+1,s}beginSized(){return this.ensure(1),this.len++}endSized(t){let r=this.len-t-1;r<128?this.buf[this.start+t]=r:this.growSized(t,r)}endSizedRun(t){let r=(this.len-t-1)*2;r<128?this.buf[this.start+t]=r:this.growSized(t,r)}growSized(t,r){let n=E4(r),o=n-1;this.ensure(o);let s=this.start+t;this.buf.copyWithin(s+n,s+1,this.start+this.len),this.len+=o;let i=r,a=s;for(;i>127;)this.buf[a++]=i&127|128,i=Math.floor(i/128);this.buf[a]=i}string(t){let r=t.length;if(r===0)return;this.ensure(r*3);let n=this.buf,o=this.start+this.len,s=0;for(;s+4<=r;s+=4){let i=t.charCodeAt(s),a=t.charCodeAt(s+1),c=t.charCodeAt(s+2),u=t.charCodeAt(s+3);if((i|a|c|u)>127){this.len+=$i.encodeInto(t,n.subarray(this.start+this.len)).written;return}n[o++]=i,n[o++]=a,n[o++]=c,n[o++]=u}for(;s<r;s++){let i=t.charCodeAt(s);if(i>127){this.len+=$i.encodeInto(t,n.subarray(this.start+this.len)).written;return}n[o++]=i}this.len=o-this.start}out(){let t=this.arena,r=new Uint8Array(t.buf.buffer,this.start,this.len);return t===Hh&&(t.offset=this.start+this.len),t.writing=!1,this.arena=void 0,r}abort(){let t=this.arena;t!==void 0&&(t===Hh&&(t.offset=this.start),t.writing=!1,this.arena=void 0)}};function Uae(e){let t=Bn(e);return t._tag==="String"&&t.checks===void 0}function Dae(e,t,r){return e.extra.find(n=>_i({[t]:null},n.parameter,r).length>0)}var qh=class{entries=new WeakMap;orderLayouts;orderKeys;options;size=0;next=0;replace=!1;constructor(t,r){this.options=t,this.orderLayouts=r===void 0?void 0:new Array(r),this.orderKeys=r===void 0?void 0:new Array(r)}beginFrame(){this.replace=!0}find(t,r){let n=this.entries.get(t);if(n===void 0&&(n=new Map,this.entries.set(t,n)),n.has(r))return n.get(r);let o=Dae(t,r,this.options),s=this.orderLayouts;if(s===void 0)return n.set(r,o),o;let i=this.orderKeys;if(this.size<s.length)s[this.size]=t,i[this.size]=r,this.size++,n.set(r,o);else if(this.replace){this.replace=!1;let a=s[this.next];(a===t?n:this.entries.get(a))?.delete(i[this.next]),s[this.next]=t,i[this.next]=r,this.next=(this.next+1)%s.length,n.set(r,o)}return o}clear(){this.entries=new WeakMap,this.orderLayouts?.fill(void 0),this.orderKeys?.fill(void 0),this.size=this.next=0,this.replace=!1}},vE=new ArrayBuffer(0),$R=new Uint8Array(vE),GW=new DataView(vE),zh=class{pos=0;nesting=0;buf=$R;view;viewCache=GW;viewBuffer=vE;viewOffset=0;viewLength=0;end=0;options=nn;indexSignatures;positional=!1;intern;dict;reset(t,r,n,o,s,i,a){this.nesting=0,this.view=void 0,this.buf=t,this.pos=r,this.end=n,this.options=o,this.indexSignatures=s,this.positional=i,this.intern=void 0,this.dict=a}release(){this.pos=this.end=this.nesting=0,this.buf=$R,this.view=void 0,this.viewCache=GW,this.viewBuffer=vE,this.viewOffset=this.viewLength=0,this.options=nn,this.indexSignatures=void 0,this.positional=!1,this.intern=void 0,this.dict=void 0}get remaining(){return this.end-this.pos}dataView(){let t=this.buf;return(t.buffer!==this.viewBuffer||t.byteOffset!==this.viewOffset||t.byteLength!==this.viewLength)&&(this.viewBuffer=t.buffer,this.viewOffset=t.byteOffset,this.viewLength=t.byteLength,this.viewCache=new DataView(t.buffer,t.byteOffset,t.byteLength)),this.view=this.viewCache}byte(){return this.pos>=this.end&&j("complete value",void 0,this.options),this.buf[this.pos++]}take(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.buf.subarray(this.pos,this.pos+t);return this.pos+=t,r}takeCopy(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,r}enter(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.end;return this.end=this.pos+t,r}exit(t){this.pos=this.end,this.end=t}readUtf8(t){this.pos+t>this.end&&j("complete value",void 0,this.options);let r=this.pos;return this.pos+=t,_ae(this.buf,r,r+t,this.options)}uvarint(){let t=this.buf,r=this.end,n=this.pos;n>=r&&j("complete value",void 0,this.options);let o=t[n++];if(o<128)return this.pos=n,o;let s=o&127;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<7,o<128)return this.pos=n,s;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<14,o<128)return this.pos=n,s;if(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<21,o<128)return this.pos=n,s;let i=268435456;for(let a=4;a<10;a++){n>=r&&(this.pos=n,j("complete value",void 0,this.options)),o=t[n++];let c=(o&127)*i;if(c>Number.MAX_SAFE_INTEGER-s&&(this.pos=n,j("safe integer length",void 0,this.options)),s+=c,o<128)return this.pos=n,s;i*=128}this.pos=n,j("uvarint",void 0,this.options)}fieldTag(){let t=this.buf,r=this.end,n=this.pos;n>=r&&j("complete value",void 0,this.options);let o=t[n++];if(o<128)return this.pos=n,o;let s=o&127;return n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<7,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<14,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],s|=(o&127)<<21,o<128?(this.pos=n,s):(n>=r&&j("complete value",void 0,this.options),o=t[n++],this.pos=n,o>=128&&j("uvarint",void 0,this.options),s+o*268435456)))}uvarintBig(){let t=EE,r=EE;for(;;){let n=this.byte();if(t|=BigInt(n&127)<<r,(n&128)===0)return t;r+=p4}}numberVarint(){let t=this.buf,r=this.end,n=this.pos,o=0,s=1;for(let c=0;c<m4;c++){n>=r&&(this.pos=n,j("complete value",void 0,this.options));let u=t[n++];if(o+=(u&127)*s,u<128)return this.pos=n,y4(o);s*=128}let i=this.uvarintBig(),a=Number(i>>ls);return Number.isFinite(a)||j("safe integer length",void 0,this.options),(i&ls)===ls?-a:a}zigzag(){let t=this.uvarintBig();return(t&ls)===ls?-(t+ls>>ls):t>>ls}f64(){this.pos+8>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getFloat64(this.pos,!0);return this.pos+=8,t}i64(){this.pos+8>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getBigInt64(this.pos,!0);return this.pos+=8,t}u32le(){this.pos+4>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getUint32(this.pos,!0);return this.pos+=4,t}i32le(){this.pos+4>this.end&&j("complete value",void 0,this.options);let t=(this.view??this.dataView()).getInt32(this.pos,!0);return this.pos+=4,t}};function JW(e,t){return{_:"literal",leaf:e,values:t,valueSet:t.length>4?new Set(t):void 0}}function Qh(e,t){let r=e.values;return e.valueSet!==void 0?e.valueSet.has(t):r.length===1?t===r[0]:r.includes(t)}function RE(e){return e.values.map(t=>typeof t=="string"?JSON.stringify(t):String(t)).join(" | ")}var gE=0,ZR=1,I4=2,T4=3,w4=30,yE=1<<w4;function OE(e){return e._==="literal"?OE(e.leaf):e._==="int"}function _E(e){switch(e._){case"literal":return _E(e.leaf);case"bool":return 1;case"int64":return 8;default:return}}function jR(e){return _E(e)!==void 0||OE(e)||e._==="null"||e._==="undefined"}function v4(e){return e._==="literal"?v4(e.leaf):e._==="null"||e._==="undefined"}var Wh={"effect/schema/Date":{kind:dt.int64,exact:!0},"effect/schema/DateTimeUtc":{kind:dt.int64,exact:!0},"effect/schema/DateTimeZoned":{kind:dt.dateTimeZoned,exact:!0},"effect/schema/Duration":{kind:dt.duration,exact:!0},"effect/schema/BigDecimal":{kind:dt.bigDecimal,exact:!0},"effect/schema/Uint8Array":{kind:dt.bytes,exact:!0},"effect/schema/Option":{kind:dt.option,exact:"parameters"},"effect/schema/Result":{kind:dt.result,exact:"parameters"},"effect/schema/Exit":{kind:dt.exit,exact:"parameters"},"effect/schema/Cause":{kind:dt.cause,exact:"parameters"},"effect/schema/CauseReason":{kind:dt.causeReason,exact:"parameters"}};function Pd(e){let t=e.annotations?.representation;return Jt(t)&&typeof t.id=="string"?t.id:void 0}var SE=ma(e=>{let t=Lae(e),r=e.context;return t===e||r===void 0?t:zl(t,new Yo(r.isOptional,r.isMutable,void 0,r.annotations))});function Lae(e){switch(e._tag){case"Declaration":{let t=Pd(e);if(t!==void 0&&(t in Wh||t==="effect/schema/Json"||t==="effect/schema/MutableJson"))return e.recur(SE);let r=e.annotations?.toCodecJson,n=e.annotations?.toCodec;if(!or(r)&&!or(n))return e;let o=e.typeParameters.map(i=>J(Bn(i))),s=(or(r)?r(o):void 0)??(or(n)?n(o):void 0);return s===void 0?e:lt(e,[fc(s,SE)])}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(SE);default:return e}}function Bae(e){let t=[...e].sort((n,o)=>{let s=typeof n.key=="number",i=typeof o.key=="number";return s!==i?s?-1:1:s?n.key-o.key:b4($i.encode(n.key),$i.encode(o.key))}),r=[];for(let n of t){let o=$i.encode(String(n.key));r.push(typeof n.key=="number"?0:1),TE(r,o.length),IE(r,o);let s=n.literal,i=$i.encode(A4(s));r.push(C4(s)),TE(r,i.length),IE(r,i)}return S4(r)}function C4(e){switch(typeof e){case"string":return 1;case"number":return 2;case"boolean":return 3;case"bigint":return 4;default:return 5}}function A4(e){if(typeof e=="symbol"){let t=globalThis.Symbol.keyFor(e);if(t===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return t}return String(e)}function k4(e){switch(e._tag){case"Symbol":return!0;case"Union":return e.types.some(k4);default:return!1}}function R4(e){let t=Pd(e);return t==="effect/schema/Json"||t==="effect/schema/MutableJson"?!0:or(e.annotations?.toCodecJson)}function $ae(e){let t=e.checks;if(t===void 0)return!1;let r=n=>n.annotations?.representation?.id==="effect/schema/isInt"?!0:n._tag==="FilterGroup"&&n.checks.some(r);return t.some(r)}function O4(e){for(;e._tag==="Suspend";)e=e.thunk();return e}function _4(e){return new Sn(e.enums.map(t=>new Ln(t[1],{title:t[0]})))}function ZW(e){let t=[],r=new Set,n=o=>{let s=O4(o);if(!r.has(s))switch(r.add(s),s._tag){case"Never":return;case"Union":s.types.forEach(n);return;case"Enum":_4(s).types.forEach(n);return;default:t.push(s)}};return e.types.forEach(n),t}function QW(e){switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"bool";default:return"bigint"}}function bE(e){switch(e._tag){case"String":case"TemplateLiteral":case"Symbol":return dt.string;case"UniqueSymbol":if(globalThis.Symbol.keyFor(e.symbol)===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return dt.string;case"Boolean":return dt.bool;case"Null":return dt.null;case"Undefined":case"Void":return dt.undefined;case"Number":return dt.number;case"BigInt":return dt.bigint;case"Literal":switch(typeof e.literal){case"string":return dt.string;case"number":return dt.number;case"boolean":return dt.bool;default:return dt.bigint}case"Unknown":case"Any":case"ObjectKeyword":return dt.json;case"Objects":return dt.struct;case"Arrays":return dt.array;case"Declaration":{let t=Pd(e);if(t!==void 0&&t in Wh)return Wh[t].kind;if(R4(e))return dt.json;throw new Error(`Binary layout: declaration ${t??"<anonymous>"} has no toCodecJson or toCodec`)}case"Suspend":return bE(O4(e));default:throw new Error("Binary layout: union members are not uniquely identifiable")}}function YW(e){for(let t of e.fields)t.optional||(t.index<32?e.requiredMask|=1<<t.index:e.requiredWide=!0)}function jae(e){let t=P4(e),r=!t&&Hae(e);e=Bn(e);let n=new Map,o=!1,s=0,i=x=>({_:x,slot:x==="string"?s++:0});function a(x){let g=n.get(x);if(g!==void 0)return g;let y=c(x);return n.set(x,y),y}function c(x){switch(x._tag){case"String":case"TemplateLiteral":return i("string");case"Symbol":case"UniqueSymbol":return i("symbol");case"Boolean":return i("bool");case"Null":return i("null");case"Undefined":case"Void":return i("undefined");case"Number":return i($ae(x)?"int":"number");case"BigInt":return i("bigint");case"Literal":return JW(i(QW(x.literal)),[x.literal]);case"Unknown":case"Any":case"ObjectKeyword":return i("json");case"Never":return{_:"never",ast:x};case"Enum":return m(x,ZW(_4(x)));case"Suspend":{o=!0;let g=a(x.thunk());return n.set(x,g),g}case"Objects":return u(x);case"Arrays":return f(x);case"Union":return m(x,ZW(x));case"Declaration":return p(x)}}function u(x){let g=[],y=[],E=new Map;for(let T of x.propertySignatures){if(typeof T.name=="symbol")throw new Error("Binary layout: symbol property names are illegal");let S=String(T.name),w=T.type.context?.annotations,k=w?.[pae],C=typeof k=="number"?k:S4($i.encode(S));if(!Number.isInteger(C)||C<0||C>4294967295)throw new Error(`Binary layout: illegal field id for ${S}`);let R=E.get(C);R===void 0?E.set(C,[S]):R.push(S),g.push({name:S,id:C,tagBytes:Rae(C*ds+Ef),index:0,optional:T.type.context?.isOptional===!0,annotations:w,layout:void 0,wireMask:0,inline:!1}),y.push(T.type)}for(let[T,S]of E)if(T===0||S.length>1)throw new Error(`Binary layout field id collision: ${T} (${S.join(", ")})`);let b=[];for(let T of x.indexSignatures){if(k4(T.parameter))throw new Error("Binary layout: symbol property names are illegal");b.push({parameter:T.parameter,layout:void 0,wireMask:0})}let v={_:"struct",ast:x,fields:g,byId:new Map,extra:b,extraAll:b.length===1&&Uae(b[0].parameter)?b[0]:void 0,names:new Set(g.map(T=>T.name)),extraShape:void 0,optionalCount:0,requiredMask:0,requiredWide:!1};n.set(x,v);for(let T=0;T<g.length;T++){let S=g[T];S.layout=a(y[T]),S.wireMask=WR(S.layout),S.inline=jR(S.layout),S.optional&&v.optionalCount++,v.byId.set(S.id,S)}g.sort((T,S)=>T.id-S.id);for(let T=0;T<g.length;T++)g[T].index=T;YW(v);for(let T=0;T<b.length;T++)b[T].layout=a(x.indexSignatures[T].type),b[T].wireMask=WR(b[T].layout);return v}function f(x){let g=x.rest.length>0||x.elements.some(v=>v.context?.isOptional===!0),y=x.elements.filter(v=>v.context?.isOptional!==!0).length,E=Math.max(0,x.rest.length-1),b={_:"array",ast:x,elements:[],rest:[],hasCount:g,minCount:y+E,uniform:void 0,uniformInline:!1,uniformPacked:void 0,uniformNumbers:!1,run:void 0};n.set(x,b);for(let v of x.elements)b.elements.push({optional:v.context?.isOptional===!0,layout:a(v)});for(let v of x.rest)b.rest.push(a(v));if(b.elements.length===0&&b.rest.length===1){let v=b.rest[0];b.uniform=v,b.uniformPacked=_E(v),b.uniformNumbers=v._==="number",b.uniformInline=jR(v)}return b}function p(x){let g=Pd(x);switch(g){case"effect/schema/Date":return{_:"int64",flavor:"date"};case"effect/schema/DateTimeUtc":return{_:"int64",flavor:"utc"};case"effect/schema/DateTimeZoned":return i("dateTimeZoned");case"effect/schema/Duration":return i("duration");case"effect/schema/BigDecimal":return i("bigDecimal");case"effect/schema/Uint8Array":return i("bytes")}let y=x.typeParameters;switch(g){case"effect/schema/Option":{let E={_:"option",value:void 0};return n.set(x,E),E.value=a(y[0]),E}case"effect/schema/Result":{let E={_:"result",success:void 0,failure:void 0};return n.set(x,E),E.success=a(y[0]),E.failure=a(y[1]),E}case"effect/schema/Exit":{let E={_:"cause",error:void 0,defect:void 0},b={_:"exit",value:void 0,cause:E};return n.set(x,b),b.value=a(y[0]),E.error=a(y[1]),E.defect=a(y[2]),b}case"effect/schema/Cause":case"effect/schema/CauseReason":{let E={_:g==="effect/schema/Cause"?"cause":"causeReason",error:void 0,defect:void 0};return n.set(x,E),E.error=a(y[0]),E.defect=a(y[1]),E}}if(g!==void 0&&g in Wh)throw new Error(`Binary layout: native declaration ${g} has no layout constructor`);if(R4(x))return i("json");throw new Error(`Binary layout: declaration ${g??"<anonymous>"} has no toCodecJson or toCodec`)}function m(x,g){if(g.length===0)return{_:"never",ast:x};let y=[],E=[],b=new Map,v=new Map,T=(R,M)=>{let $=b.get(R);if($!==void 0&&$._!==M._)throw new Error("Binary layout: union members are not uniquely identifiable");b.set(R,M)};for(let R of g){if(R._tag==="Literal"){let M=bE(R),$=v.get(M);$===void 0?v.set(M,[R.literal]):$.includes(R.literal)||$.push(R.literal);continue}if(R._tag==="UniqueSymbol"){bE(R),T(dt.string,i("symbol"));continue}if(R._tag==="Objects"||R._tag==="Arrays"){let M=ac(R);if(M!==void 0&&M.length>0){for(let $ of M)if(typeof $.key=="symbol")throw new Error("Binary layout: symbol property names are illegal");y.push({member:R,sentinels:M});continue}}E.push({member:R,kind:bE(R)})}for(let[R,M]of v)T(R,JW(i(QW(M[0])),M));if(y.length===0&&E.length===0&&b.size===1)return b.values().next().value;let S=new Set(b.keys());for(let{kind:R}of E){if(S.has(R))throw new Error("Binary layout: union members are not uniquely identifiable");S.add(R)}if(y.length===0&&b.size===0&&E.length===1){let R=a(E[0].member);return n.set(x,R),R}let w=new Map,k=[];for(let{sentinels:R}of y){let M=Bae(R);if(w.has(M))throw new Error(`Binary layout sentinel collision: ${M}`);w.set(M,R),k.push(M)}let C={_:"union",ast:x,variants:[],byTag:new Map,discriminator:void 0,others:[],byKind:new Map,byPos:[]};n.set(x,C);for(let R=0;R<y.length;R++){let{member:M,sentinels:$}=y[R],te=k[R],xe=a(M),Le,Er;if(M._tag==="Objects"){let Oe=xe,rr=new Set($.map(Rn=>String(Rn.key))),lo=Oe.fields.filter(Rn=>!rr.has(Rn.name)),Xs={_:"struct",ast:Oe.ast,fields:lo,byId:new Map(lo.map(Rn=>[Rn.id,Rn])),extra:Oe.extra,extraAll:Oe.extraAll,names:Oe.names,extraShape:void 0,optionalCount:lo.reduce((Rn,nI)=>nI.optional?Rn+1:Rn,0),requiredMask:0,requiredWide:!1};YW(Xs),Le=Xs,Er=!1}else Le=xe,Er=!0;let Ee={tag:te,sentinels:$,tuple:Er,payload:Le,position:0};C.variants.push(Ee),C.byTag.set(te,Ee)}for(let[R,M]of b)C.others.push({kind:R,layout:M,position:0}),C.byKind.set(R,M);for(let{kind:R,member:M}of E){let $=a(M);C.others.push({kind:R,layout:$,position:0}),C.byKind.set(R,$)}for(let R of[...C.variants].sort((M,$)=>M.tag-$.tag))R.position=C.byPos.length,C.byPos.push({variant:R,layout:R.payload});for(let R of[...C.others].sort((M,$)=>M.kind-$.kind))R.position=C.byPos.length,C.byPos.push({variant:void 0,layout:R.layout});return C.others.sort((R,M)=>XW(R.layout)-XW(M.layout)),C.discriminator=gce(C.variants),C}return{layout:a(e),recursive:o,exact:t,exitSuccess:r}}function P4(e){let t=new Map,r=n=>{if(n.encoding!==void 0||n.checks!==void 0||n.encodingChecks!==void 0)return!1;switch(n._tag){case"String":case"Symbol":case"Boolean":case"Null":case"Undefined":case"Void":case"Number":case"BigInt":case"Literal":return!0;case"Never":return!0;case"Unknown":case"Any":return!0;case"Arrays":return n.elements.every(r)&&n.rest.every(r);case"Objects":return n.propertySignatures.every(o=>r(o.type))&&n.indexSignatures.every(o=>o.parameter._tag==="String"&&r(o.parameter)&&r(o.type));case"Union":return(n.options?.mode??"anyOf")==="anyOf"&&n.types.every(r);case"Suspend":{let o=t.get(n);if(o!==void 0)return o;t.set(n,!0);let s=r(n.thunk());return t.set(n,s),s}case"Declaration":{let o=Pd(n),s=o!==void 0?Wh[o]:void 0;return s===void 0?!1:s.exact===!0||n.typeParameters.every(r)}default:return!1}};return r(e)}function Hae(e){return e._tag==="Declaration"&&e.encoding===void 0&&e.checks===void 0&&e.encodingChecks===void 0&&Pd(e)==="effect/schema/Exit"&&P4(e.typeParameters[0])}var uo={backEdge:0,bool:1,null:2,undefined:3,number:4,int:5,string:6,symbol:7,bytes:8,bigint:9,json:10,duration:11,bigDecimal:12,dateTimeZoned:13,date:14,dateTimeUtc:15,never:16,struct:17,array:18,union:19,option:20,result:21,exit:22,cause:23,causeReason:24,literal:25};function qae(e){let t=new Map,r=[],n=Number.MAX_SAFE_INTEGER;function o(i){let a=r.lastIndexOf(i);if(a>=0){a<n&&(n=a);let h=[uo.backEdge];return Oc(h,r.length-a),VW(h)}let c=t.get(i);if(c!==void 0)return c;let u=r.length,f=n;n=Number.MAX_SAFE_INTEGER,r.push(i);let p=VW(s(i));r.pop();let m=n>=u;return m&&t.set(i,p),n=m?f:Math.min(f,n),p}function s(i){let a=[];switch(i._){case"bool":case"null":case"undefined":case"number":case"int":case"string":case"symbol":case"bytes":case"bigint":case"json":case"duration":case"bigDecimal":case"dateTimeZoned":return a.push(uo[i._]),a;case"literal":{a.push(uo.literal),IE(a,s(i.leaf)),Oc(a,i.values.length);let c=i.values.map(u=>[C4(u),A4(u)]).sort((u,f)=>u[1]<f[1]?-1:u[1]>f[1]?1:u[0]-f[0]);for(let[u,f]of c){a.push(u);let p=$i.encode(f);Oc(a,p.length),IE(a,p)}return a}case"int64":return a.push(i.flavor==="date"?uo.date:uo.dateTimeUtc),a;case"never":return a.push(uo.never),a;case"struct":{a.push(uo.struct),Oc(a,i.fields.length);for(let c of i.fields)TE(a,c.id),a.push(c.optional?1:0),No(a,o(c.layout));Oc(a,i.extra.length);for(let c of i.extra)No(a,o(c.layout));return a}case"array":{a.push(uo.array),Oc(a,i.elements.length);for(let c of i.elements)a.push(c.optional?1:0),No(a,o(c.layout));Oc(a,i.rest.length);for(let c of i.rest)No(a,o(c));return a}case"union":{a.push(uo.union),Oc(a,i.byPos.length);for(let c of i.byPos){let u=c.variant;u===void 0?a.push(0):(a.push(1,u.tuple?1:0),TE(a,u.tag)),No(a,o(c.layout))}return a}case"option":return a.push(uo.option),No(a,o(i.value)),a;case"result":return a.push(uo.result),No(a,o(i.success)),No(a,o(i.failure)),a;case"exit":return a.push(uo.exit),No(a,o(i.value)),No(a,o(i.cause.error)),No(a,o(i.cause.defect)),a;case"cause":case"causeReason":return a.push(i._==="cause"?uo.cause:uo.causeReason),No(a,o(i.error)),No(a,o(i.defect)),a}}return o(e)}function zae(e,t){let r=new Uint8Array(8);for(let n=0;n<4;n++)r[n]=e>>>n*8&255,r[n+4]=t>>>n*8&255;return r}var Wae={positional:!1,envelope:mae,expectedEnvelope:"version 2 envelope, flags 0",fingerprint:new Uint8Array(8)};function Kae(e){let t=qae(e);return{positional:!0,envelope:hae,expectedEnvelope:"version 2 envelope, flags 1",fingerprint:zae(Number(t&zW),Number(t>>Sae&zW))}}function XW(e){switch(e._){case"json":return 2;case"struct":return 1;default:return 0}}function HR(e,t){switch(e._){case"literal":return Qh(e,t);case"bool":return typeof t=="boolean";case"null":return t===null;case"undefined":return t===void 0;case"number":case"int":return typeof t=="number";case"string":return typeof t=="string";case"symbol":return typeof t=="symbol";case"bigint":return typeof t=="bigint";case"bytes":return t instanceof Uint8Array;case"int64":return e.flavor==="date"?t instanceof Date:vu(t)&&t._tag==="Utc";case"dateTimeZoned":return vu(t)&&t._tag==="Zoned";case"duration":return Qi(t);case"bigDecimal":return Tu(t);case"option":return ci(t);case"result":return $f(t);case"exit":return ws(t);case"cause":return il(t);case"causeReason":return al(t);case"array":return Array.isArray(t);case"struct":return Jt(t)&&!Array.isArray(t);case"json":return!0;case"union":case"never":return!1}}function ut(e,t,r){throw dr(new le({expected:e},t,r))}function kn(e,t=new Set){if(!$d(e))return!1;let r=Array.isArray(e),n=Object.getPrototypeOf(e);if(r||n===Object.prototype||n===null){if(t.has(e))return!0;t.add(e);try{if(r){for(let o=0;o<e.length;o++)if(kn(e[o],t))return!0}else for(let o of Object.keys(e))if(kn(e[o],t))return!0}finally{t.delete(e)}return!1}if(e instanceof Date||e instanceof Uint8Array||vu(e)||Qi(e)||Tu(e))return!1;if(t.has(e))return!0;t.add(e);try{if(ci(e))return de(e)&&kn(e.value,t);if($f(e))return kn(tt(e)?e.success:e.failure,t);if(ws(e))return kn(ft(e)?e.value:e.cause,t);if(il(e))return e.reasons.some(o=>kn(o,t));if(al(e))switch(e._tag){case"Fail":return kn(e.error,t);case"Die":return kn(e.defect,t);case"Interrupt":return!1}if(Cl(e)){for(let o of e)if(kn(o,t))return!0;return!1}if(Ay(e)){for(let[o,s]of e)if(kn(o,t)||kn(s,t))return!0;return!1}if(_y(e)){for(let o of e)if(kn(o,t))return!0;return!1}if(cm(e))return kn(nc(e),t);for(let o of Object.keys(e))if(kn(e[o],t))return!0}finally{t.delete(e)}return!1}function CE(e,t,r,n){let o=n.beginSized();zr(e,t,r,n),n.endSized(o)}function Vae(e,t,r){let n=globalThis.Symbol.keyFor(t);n===void 0&&ut("registered symbol",t,e.options),r.string(n)}function e4(e,t,r,n){let o=r;switch(o._tag){case"Fail":n.byte(0),zr(e,t.error,o.error,n);return;case"Die":n.byte(1),zr(e,t.defect,o.defect,n);return;case"Interrupt":o.fiberId===void 0?n.byte(2):(n.byte(3),n.f64(o.fiberId))}}function Gae(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function t4(e,t,r){if(e.layout!==t||e.keys.length!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.keys[n]!==r[n])return!1;return!0}function Jae(e,t){if(e.extraAll===void 0||t.length>Fae)return!1;let r=0;for(let n=0;n<t.length;n++)if(r+=t[n].length,r>Nae)return!1;return!0}function QR(e,t,r){let n=Object.keys(r),o=t.extraShape;if(o!==void 0&&t4(o,t,n))return o.pairs;let s=Jae(t,n),i=s?void 0:e.extraShape;if(i!==void 0&&t4(i,t,n))return i.pairs;let a=t.names,c=t.extraAll,u=[],f=!0;for(let m of n){if(a.has(m))continue;let h=c??(e.indexSignatures??=new qh(e.options)).find(t,m);h!==void 0&&(f&&!Gae(m)&&(f=!1),u.push([m,h,void 0]))}if(f)u.sort((m,h)=>m[0]<h[0]?-1:m[0]>h[0]?1:0);else{for(let m of u)m[2]=$i.encode(m[0]);u.sort((m,h)=>b4(m[2],h[2]))}if(s)for(let m of u)m[2]??=$i.encode(m[0]);let p={layout:t,keys:n,pairs:u};return s?t.extraShape=p:e.extraShape=p,u}function YR(e,t,r,n,o){for(let[s,i,a]of t){let c=a===void 0?s.length:a.length,u=r[s],f=XR(i.layout,u,e.options),p=f%ds;if(o===void 0)n.uvarint(c*ds+p);else{if(!o.disabled){let m=F4(o,s);if(m!==void 0){n.uvarint(m*16+p*2+1),Ze[Q++]=s,qR(e,i.layout,u,f,n),Q--;continue}N4(o,s)}n.uvarint(c*16+p*2)}a===void 0?n.string(s):n.bytes(a),Ze[Q++]=s,qR(e,i.layout,u,f,n),Q--}}function XR(e,t,r){if(e._==="literal")return Qh(e,t)||ut(RE(e),t,r),XR(e.leaf,t,r);switch(e._){case"bool":return typeof t!="boolean"&&ut("a boolean",t,r),t?Jh:Gh;case"number":if(typeof t!="number"&&ut("a number",t,r),GR(t))return Sf;{let n=JR(t);return n===0?Vh:n*ds+Zh}case"int":return Number.isSafeInteger(t)||ut("an integer",t,r),Sf;default:return Ef}}function qR(e,t,r,n,o){switch(n%ds){case Gh:case Jh:return;case Sf:o.numberVarint(r);return;case Vh:o.f64(r);return;case Zh:{let i=Math.floor(n/ds);o.numberVarint(Math.round(r*_c[i])),o.uvarint(i);return}default:CE(e,t,r,o)}}function Zae(e,t,r,n){let o=XR(t.layout,r,e.options),s=o%ds;if(s===Ef){let i=n.idAndMark(t.tagBytes);zr(e,t.layout,r,n),n.endSized(i);return}n.uvarint(t.id*ds+s),qR(e,t.layout,r,o,n)}function Qae(e,t){let r=e.byName;if(r===void 0)return;let n=Object.getOwnPropertyNames(t),o=0;for(let i=0;i<n.length;i++){let a=r.get(n[i]);a!==void 0&&(o|=1<<a)}let s=e.struct;if((o&s.requiredMask)!==s.requiredMask){let i=s.fields;for(let a=0;a<i.length;a++){let c=i[a];if(!c.optional&&(o&1<<a)===0)throw Ze[Q++]=c.name,dr(new Yt(c.annotations))}}return o}function Yae(e,t,r,n){let o=r;if(t.extra.length>0){let i=e.intern;e.intern=void 0;let a=QR(e,t,o);if(a.length>0){n.uvarint(0);let c=n.beginSized();YR(e,a,o,n,i),n.endSized(c)}}let s=t.fields;for(let i=0;i<s.length;i++){let a=s[i],c=a.name;if(!Object.hasOwn(o,c)){if(a.optional)continue;throw Ze[Q++]=c,dr(new Yt(a.annotations))}Ze[Q++]=c,Zae(e,a,o[c],n),Q--}}function Xae(e,t,r,n){let o=r,s=e.intern;e.intern=void 0;let i=t.optionalCount+7>>3,a=0;if(i>0){a=n.len;for(let f=0;f<i;f++)n.byte(0)}let c=t.fields,u=0;for(let f=0;f<c.length;f++){let p=c[f],m=p.name,h=Object.hasOwn(o,m);if(p.optional){if(h&&(n.buf[n.start+a+(u>>3)]|=1<<(u&7)),u++,!h)continue}else if(!h)throw Ze[Q++]=m,dr(new Yt(p.annotations));Ze[Q++]=m,p.inline?zr(e,p.layout,o[m],n):CE(e,p.layout,o[m],n),Q--}if(t.extra.length>0){let f=QR(e,t,o);n.uvarint(f.length),YR(e,f,o,n,s)}}function ece(e){switch(e._){case"string":return ZR;case"array":return e.uniform?._==="string"?I4:gE;case"struct":return e.extra.length>0?T4:gE;default:return gE}}function tce(e){let t=e.uniform;if(t===void 0){if(e.rest.length!==1)return;t=e.rest[0];for(let r of e.elements)if(r.optional||r.layout!==t)return}return t._==="struct"?t:void 0}function M4(e){let t=e.run;if(t!==void 0)return t;let r=tce(e);if(r===void 0)return e.run=t=null,t;let n=r.fields.map(s=>ece(s.layout)),o=r.fields.length<=w4;return t={struct:r,intern:n,shapes:o,byName:o&&r.extra.length===0?new Map(r.fields.map((s,i)=>[s.name,i])):void 0},e.run=t,t}var rce=16,nce=64;function r4(e,t){return e[t]??={values:[],refs:void 0,hits:0,disabled:!1}}function F4(e,t){let r=e.refs;if(r!==void 0){let o=r.get(t);return o!==void 0&&e.hits++,o}let n=e.values;for(let o=0;o<n.length;o++)if(n[o]===t)return e.hits++,o}function N4(e,t){let r=e.values;if(e.refs!==void 0){if(e.hits===0&&r.length>=nce){e.disabled=!0,e.refs=void 0;return}e.refs.set(t,r.length)}else if(r.length>=rce){let n=e.refs=new Map;for(let o=0;o<r.length;o++)n.set(r[o],o);n.set(t,r.length)}r.push(t)}var eO=0,oce=1,tO=2,sce=64,ice=512;function ace(){return{slots:[],marks:[],frame:0}}function U4(e,t){return e[t]??={values:[],refs:new Map,state:eO,stamp:-1}}function D4(e,t){if(e.refs.has(t)){e.state=oce;return}e.refs.set(t,e.values.length),e.values.push(t),e.values.length>=sce&&(e.state=tO)}function L4(e,t){let r=e.values;r.length>=ice||(e.refs.set(t,r.length),r.push(t))}function cce(e,t){t.stamp!==e.frame&&(t.stamp=e.frame,e.marks.push({slot:t,length:t.values.length,state:t.state}))}function uce(e){e.marks.length=0,e.frame++}function fce(e){let t=e.marks;for(let r=t.length-1;r>=0;r--){let{length:n,slot:o,state:s}=t[r],i=o.values;for(let a=n;a<i.length;a++)o.refs.delete(i[a]);i.length=n,o.state=s}t.length=0,e.frame++}function lce(e,t,r,n){let o=U4(e.slots,t.slot),s=o.state;if(s===tO){n.string(r);return}if(cce(e,o),s===eO){n.string(r),D4(o,r);return}let i=o.refs.get(r);if(i!==void 0){n.uvarint(i*2+1);return}n.byte(0),L4(o,r),n.string(r)}function dce(e,t,r){let n=U4(e,t.slot),o=n.state;if(o===tO)return r.readUtf8(r.end-r.pos);if(o===eO){let a=r.readUtf8(r.end-r.pos);return D4(n,a),a}let s=r.uvarint();if((s&1)===1){let a=(s-1)/2,c=n.values;return a>=c.length&&j("a dictionary reference",s,r.options),c[a]}s!==0&&j("a dictionary marker",s,r.options);let i=r.readUtf8(r.end-r.pos);return L4(n,i),i}function B4(e,t,r,n,o){if(!e.disabled){let i=F4(e,n);if(i!==void 0){o.uvarint(i*2+1);return}N4(e,n)}let s=o.beginSized();zr(t,r,n,o),o.endSizedRun(s)}function pce(e,t,r,n,o){let s=[],i=[];for(let a=0;a<n;a++){Ze[Q++]=a;let c=o.beginSized();mce(e,t,s,i,r[a],o),o.endSized(c),Q--}}function mce(e,t,r,n,o,s){let i=t.struct,a=o,c=i.fields,u;if(i.extra.length>0){let y=QR(e,i,a);y.length>0&&(u=y)}let f=!t.shapes,p=u===void 0?0:yE,m=Qae(t,a);if(m!==void 0)p=m;else for(let y=0;y<c.length;y++){let E=c[y];if(Object.hasOwn(a,E.name))f||(p|=1<<y);else if(!E.optional)throw Ze[Q++]=E.name,dr(new Yt(E.annotations))}let h=-1;for(let y=0;y<r.length;y++)if(r[y]===p){h=y;break}h>=0?s.uvarint(h+1):(s.uvarint(0),f||r.push(p));let x=h<0,g=e.positional&&!f;if(x&&g&&s.uvarint(p),u!==void 0){x&&!g&&s.uvarint(0);let y=s.beginSized();YR(e,u,a,s),s.endSizedRun(y)}for(let y=0;y<c.length;y++){let E=c[y];if(f?!Object.hasOwn(a,E.name):(p&1<<y)===0)continue;x&&!g&&s.uvarint(E.id),Ze[Q++]=E.name;let b=t.intern[y];if(b===ZR)B4(r4(n,y),e,E.layout,a[E.name],s);else{b!==gE&&(e.intern=r4(n,y));let v=s.beginSized();zr(e,E.layout,a[E.name],s),s.endSizedRun(v),e.intern=void 0}Q--}}function $4(e,t,r){let n=e.elements.length;if(t<n)return e.elements[t].layout;let o=Math.max(0,e.rest.length-1),s=Math.max(n,r-o);return t>=s?e.rest[t-s+1]:e.rest[0]}function hce(e,t,r,n){let o=r.length;if(t.rest.length===0&&o>t.elements.length)throw Ze[Q++]=t.elements.length,dr(new Nu(t.ast,r[t.elements.length],e.options));if(o<t.minCount)throw Ze[Q++]=o,dr(new Yt(void 0));if(t.hasCount&&n.uvarint(o),o>0){let i=M4(t);if(i!==null){pce(e,i,r,o,n);return}}let s=t.uniform;if(s!==void 0){if(t.uniformNumbers){xce(e,r,o,n);return}let i=e.intern;if(e.intern=void 0,i!==void 0){for(let c=0;c<o;c++)Ze[Q++]=c,B4(i,e,s,r[c],n),Q--;return}let a=t.uniformInline;for(let c=0;c<o;c++)Ze[Q++]=c,a?zr(e,s,r[c],n):CE(e,s,r[c],n),Q--;return}for(let i=0;i<o;i++){let a=$4(t,i,o);Ze[Q++]=i,jR(a)?zr(e,a,r[i],n):CE(e,a,r[i],n),Q--}}var n4=[];function xce(e,t,r,n){let o=!0,s=!0;for(let i=0;i<r;i++){let a=t[i];if(typeof a!="number"&&(Ze[Q++]=i,ut("a number",a,e.options)),GR(a))(a<0?-a:a)>DR&&(s=!1);else{o=!1;let c=JR(a);c===0?s=!1:n4[i]=c}if(!o&&!s)break}if(o){n.byte(x4);for(let i=0;i<r;i++)n.numberVarint(t[i])}else if(s){n.byte(g4);for(let i=0;i<r;i++){let a=t[i],c=Number.isInteger(a)?0:n4[i],u=c===0?a:Math.round(a*_c[c]),f=u<0||u===0&&1/u<0,p=f?-u:u;n.uvarint((p*2+(f?1:0))*16+c)}}else{n.byte(h4);for(let i=0;i<r;i++)n.f64(t[i])}}function gce(e){if(!(e.length<2||e.some(t=>t.tuple)))for(let t of e[0].sentinels){let r=new Map;for(let n of e){let o=n.sentinels.find(s=>s.key===t.key);if(o===void 0||r.has(o.literal)||Number.isNaN(o.literal))break;r.set(o.literal,n)}if(r.size===e.length)return{key:t.key,rows:r}}}function zR(e,t){let r=e.sentinels;for(let n=0;n<r.length;n++){let{key:o,literal:s}=r[n];if(t[o]!==s||!Object.hasOwn(t,o))return!1}return!0}function yce(e,t){return e.tuple?Array.isArray(t)&&zR(e,t):Jt(t)&&!Array.isArray(t)&&zR(e,t)}function o4(e,t,r,n){e.positional?n.uvarint(t.position):(n.byte(dt.variant),n.u32le(t.tag)),zr(e,t.payload,r,n)}function Sce(e,t,r,n){let o=t.discriminator;if(o!==void 0){if(Jt(r)&&!Array.isArray(r)){let s=r,i=o.rows.get(s[o.key]);if(i!==void 0&&zR(i,s)){o4(e,i,r,n);return}}}else for(let s of t.variants)if(yce(s,r)){o4(e,s,r,n);return}for(let s of t.others)if(HR(s.layout,r)){e.positional?n.uvarint(s.position):n.byte(s.kind),zr(e,s.layout,r,n);return}throw dr(new at(t.ast,r,e.options))}function zr(e,t,r,n){switch(t._){case"literal":Qh(t,r)||ut(RE(t),r,e.options),zr(e,t.leaf,r,n);return;case"bool":typeof r!="boolean"&&ut("a boolean",r,e.options),n.byte(r===!0?1:0);return;case"null":r!==null&&ut("null",r,e.options);return;case"undefined":r!==void 0&&ut("undefined",r,e.options);return;case"number":{if(typeof r!="number"&&ut("a number",r,e.options),GR(r)){n.numberVarint(r);return}let o=JR(r);o>0?(n.numberVarint(Math.round(r*_c[o])),n.byte(o)):n.f64(r);return}case"int":{Number.isSafeInteger(r)||ut("an integer",r,e.options),n.numberVarint(r);return}case"string":{typeof r!="string"&&ut("a string",r,e.options);let o=e.dict;o===void 0?n.string(r):lce(o,t,r,n);return}case"symbol":typeof r!="symbol"&&ut("a symbol",r,e.options),Vae(e,r,n);return;case"bytes":r instanceof Uint8Array||ut("a Uint8Array",r,e.options),n.bytes(r);return;case"bigint":typeof r!="bigint"&&ut("a bigint",r,e.options),n.zigzag(r);return;case"int64":{HR(t,r)||ut(t.flavor==="date"?"a Date":"a DateTime.Utc",r,e.options);let o=t.flavor==="date"?r.getTime():r.epochMilliseconds;Number.isNaN(o)&&ut("a valid Date",r,e.options),n.i64(BigInt(o));return}case"dateTimeZoned":{HR(t,r)||ut("a DateTime.Zoned",r,e.options);let o=r;n.i64(BigInt(o.epochMilliseconds)),o.zone._tag==="Offset"?(n.byte(0),n.i32le(o.zone.offset)):(n.byte(1),n.string(o.zone.id));return}case"duration":{Qi(r)||ut("a Duration",r,e.options);let o=r.value;switch(o._tag){case"Infinity":n.byte(1);return;case"NegativeInfinity":n.byte(2);return;case"Nanos":n.byte(0),n.zigzag(o.nanos);return;case"Millis":n.byte(0),n.zigzag(BigInt(o.millis)*gae);return}}case"bigDecimal":{Tu(r)||ut("a BigDecimal",r,e.options);let o=em(r);n.zigzag(o.value),n.zigzag(BigInt(o.scale));return}case"json":{let o;try{o=JSON.stringify(r)}catch{o=void 0}o===void 0&&(kn(r)&&ut("acyclic value",r,e.options),ut("a JSON-serializable value",r,e.options)),n.string(o);return}case"option":{ci(r)||ut("an Option",r,e.options);let o=r;o._tag==="None"?n.byte(0):(n.byte(1),zr(e,t.value,o.value,n));return}case"result":{$f(r)||ut("a Result",r,e.options);let o=r;o._tag==="Success"?(n.byte(0),zr(e,t.success,o.success,n)):(n.byte(1),zr(e,t.failure,o.failure,n));return}case"exit":{ws(r)||ut("an Exit",r,e.options);let o=r;o._tag==="Success"?(n.byte(0),zr(e,t.value,o.value,n)):(n.byte(1),zr(e,t.cause,o.cause,n));return}case"cause":{il(r)||ut("a Cause",r,e.options);let o=r.reasons;n.uvarint(o.length);for(let s of o){let i=n.beginSized();e4(e,t,s,n),n.endSized(i)}return}case"causeReason":{al(r)||ut("a Cause.Reason",r,e.options),e4(e,t,r,n);return}case"struct":{(!Jt(r)||Array.isArray(r))&&ut("an object",r,e.options),e.positional?Xae(e,t,r,n):Yae(e,t,r,n);return}case"array":{Array.isArray(r)||ut("an array",r,e.options),hce(e,t,r,n);return}case"union":Sce(e,t,r,n);return;case"never":throw dr(new at(t.ast,r,e.options))}}var hE=new wE;function s4(e,t,r,n,o){let s=o.beginSized();o.byte(n.envelope),n.positional&&o.bytes(n.fingerprint),zr(e,t,r,o),o.endSized(s)}function j4(e,t,r,n,o,s){let i={options:n,positional:o.positional,indexSignatures:void 0,extraShape:void 0,intern:void 0,dict:s},a=hE??new wE,c=a===hE;c&&(hE=void 0),a.reset();let u=Q,f=!1;try{if(r===void 0)Q=0,s4(i,e,t,o,a);else for(let m=0;m<r.length;m++)Q=0,s4(i,e,r[m],o,a);let p=a.out();return f=!0,p}finally{s!==void 0&&(f?uce(s):fce(s)),a.abort(),Q=u,c&&(hE=a)}}function H4(e,t,r,n,o){return j4(e,void 0,t,r,n,o)}function AE(e,t,r,n,o){return j4(e,t,void 0,r,n,o)}function PE(e){return ws(e)&&ft(e)}var kr=globalThis.Symbol.for("~effect/encoding/SchemaBinary/absent");function un(e,t){let r=Kh(e,t);return r!==kr&&t.pos!==t.end&&j("no leftover bytes",void 0,t.options),r}function q4(e,t){let r=t.enter(t.uvarint()),n=un(e,t);return t.exit(r),n}function z4(e,t){if(OE(e))return Kh(e,t);let r=_E(e),n=t.enter(r!==void 0?r:e._==="null"||e._==="undefined"?0:t.uvarint()),o=un(e,t);return t.exit(n),o}var bce=8;function Ece(e,t){let r=e.set;if(r!==void 0)return r.has(t)?!0:(r.add(t),!1);let n=e.list;if(n.includes(t))return!0;if(n.length>=bce){let o=e.set=new Set;for(let s=0;s<n.length;s++)o.add(n[s]);o.add(t)}else n.push(t);return!1}function W4(e,t,r,n,o){let s=t.uvarint(),i=Math.floor(o===void 0?s/ds:s/16),a=o===void 0?s-i*ds:Math.floor((s-i*16)/2),c=o===void 0?t.readUtf8(i):Ice(o,s,i,t);e.names.has(c)&&j("an extra key distinct from declared fields",c,t.options),Ece(n,c)&&j("unique extra keys",void 0,t.options);let u=e.extraAll??(t.indexSignatures??=new qh(t.options)).find(e,c);if(u===void 0){rO(a,t);return}Ze[Q++]=c;let f=G4(u.layout,u.wireMask,a,t);Q--,f!==kr&&B(r,c,f)}function Ice(e,t,r,n){if((t&1)===1)return r>=e.length&&j("a known back-reference",void 0,n.options),e[r];let o=n.readUtf8(r);return e.push(o),o}function K4(e){return new At([e.name],new Yt(e.annotations))}function V4(e,t){throw dr(new Ft(e.ast,t))}function FR(e){for(;(e.byte()&128)!==0;);}function rO(e,t){switch(e){case Ef:t.take(t.uvarint());return;case Sf:FR(t);return;case Vh:t.take(8);return;case Gh:case Jh:case vae:return;case Zh:FR(t),FR(t);return;case wae:t.take(4);return}}function WR(e){if(e._==="literal")return WR(e.leaf);switch(e._){case"bool":return 1<<Gh|1<<Jh;case"number":return 1<<Sf|1<<Vh|1<<Zh;case"int":return 1<<Sf;default:return 1<<Ef}}function Tce(e,t){switch(e){case Gh:return!1;case Jh:return!0;case Sf:return t.numberVarint();case Vh:return t.f64();case Zh:{let r=t.numberVarint(),n=t.uvarint();return(n===0||n>kE)&&j("a decimal scale in [1, 8]",n,t.options),r/_c[n]}}return j("matching field wire kind",void 0,t.options)}function G4(e,t,r,n){if((t&1<<r)===0)return rO(r,n),kr;if(r!==Ef){let i=Tce(r,n);return e._==="literal"&&!Qh(e,i)&&j(RE(e),i,n.options),i}let o=n.enter(n.uvarint()),s=un(e,n);return n.exit(o),s}function wce(e,t){let r;e.extra.length>0&&(r=t.intern,t.intern=void 0);let n={},o=0,s=0,i,a,c,u=!1,f=e.fields,p=0;for(;t.pos<t.end;){let m=t.fieldTag(),h=Math.floor(m/ds),x=m-h*ds;if(h===0){u&&j("unique field ids",void 0,t.options),u=!0,x!==Ef&&j("extra field map",void 0,t.options);let b=t.enter(t.uvarint());Z4(e,t,n,r),t.exit(b);continue}let g;if(p<f.length&&f[p].id===h?(g=f[p],p++):(g=e.byId.get(h),g!==void 0&&(p=g.index+1)),g===void 0){c===void 0?c=new Set:c.has(h)&&j("unique field ids",void 0,t.options),c.add(h),rO(x,t);continue}let y=g.index;if(y<32){let b=1<<y;(o&b)!==0&&j("unique field ids",void 0,t.options),o|=b}else i===void 0?i=new Set([y]):(i.has(y)&&j("unique field ids",void 0,t.options),i.add(y));Ze[Q++]=g.name;let E=G4(g.layout,g.wireMask,x,t);Q--,E!==kr&&(B(n,g.name,E),y<32?s|=1<<y:(a??=new Set).add(y))}return J4(e,s,a,t),n}function J4(e,t,r,n){if((t&e.requiredMask)===e.requiredMask&&!e.requiredWide)return;let o=e.fields,s;for(let i=0;i<o.length;i++){let a=o[i],c=a.index,u=c<32?(t&1<<c)!==0:r?.has(c)===!0;if(!a.optional&&!u&&((s??=[]).push(K4(a)),n.options.errors!=="all"))break}s!==void 0&&V4(e,s)}function vce(e,t){let r;e.extra.length>0&&(r=t.intern,t.intern=void 0);let n={},o=e.optionalCount+7>>3,s=0;o>0&&(t.pos+o>t.end&&j("complete value",void 0,t.options),s=t.pos,t.pos+=o);let i=t.buf,a=e.fields,c=0,u;for(let f=0;f<a.length;f++){let p=a[f];if(p.optional){let h=(i[s+(c>>3)]&1<<(c&7))!==0;if(c++,!h)continue}Ze[Q++]=p.name;let m=p.inline?z4(p.layout,t):q4(p.layout,t);if(Q--,m!==kr)B(n,p.name,m);else if(!p.optional&&((u??=[]).push(K4(p)),t.options.errors!=="all"))break}if(u!==void 0&&V4(e,u),e.extra.length>0){let f=t.uvarint();if(f>t.remaining&&j("complete value",void 0,t.options),f>0){let p={list:[],set:void 0};for(let m=0;m<f;m++)W4(e,t,n,p,r)}}return n}function Z4(e,t,r,n){let o={list:[],set:void 0};for(;t.pos<t.end;)W4(e,t,r,o,n)}function Cce(e,t,r){let n=r.uvarint();if((n&1)===1){let i=(n-1)/2;return i>=e.length&&j("a known back-reference",void 0,r.options),e[i]}if(t._==="string"){if(r.dict!==void 0){let a=r.enter(n/2),c=un(t,r);return r.exit(a),e.push(c),c}let i=r.readUtf8(n/2);return e.push(i),i}let o=r.enter(n/2),s=un(t,r);return r.exit(o),e.push(s),s}function Ace(e,t,r){let n=new Array(t),o=[],s=[];for(let i=0;i<t;i++){Ze[Q++]=i;let a=r.enter(r.uvarint());n[i]=Rce(e,o,s,r),r.exit(a),Q--}return n}function kce(e,t){let r=t.uvarint(),n=e.fields,o=r&~yE;(r>yE*2-1||o>>>n.length)&&j("a known row shape",void 0,t.options);let s=[];(r&yE)!==0&&s.push(null);for(let i=0;i<n.length;i++)(o&1<<i)!==0&&s.push(n[i]);return s}function Rce(e,t,r,n){let o=e.struct,s={},i=0,a,c=n.uvarint(),u;if(c===0?n.positional&&e.shapes&&(u=kce(o,n),t.push(u)):(u=t[c-1],u===void 0&&j("a known row shape",void 0,n.options)),u!==void 0){for(let f=0;f<u.length;f++){let p=i4(e,r,u[f],s,n);p>=0&&(p<32?i|=1<<p:(a??=new Set).add(p))}n.pos!==n.end&&j("no leftover bytes",void 0,n.options)}else{let f=e.shapes?[]:void 0,p=0,m,h,x=!1;for(;n.pos<n.end;){let g=n.uvarint(),y;g===0?(x&&j("unique field ids",void 0,n.options),x=!0,y=null):(y=o.byId.get(g),y===void 0?h===void 0?h=new Set([g]):h.has(g)?j("unique field ids",void 0,n.options):h.add(g):y.index<32?((p&1<<y.index)!==0&&j("unique field ids",void 0,n.options),p|=1<<y.index):m===void 0?m=new Set([y.index]):(m.has(y.index)&&j("unique field ids",void 0,n.options),m.add(y.index))),f?.push(y);let E=i4(e,r,y,s,n);E>=0&&(E<32?i|=1<<E:(a??=new Set).add(E))}f!==void 0&&t.push(f)}return J4(o,i,a,n),s}function i4(e,t,r,n,o){let s=o.uvarint();if((s&1)===1){if(r==null)return-1;let u=t[r.index],f=(s-1)/2;(u===void 0||f>=u.length)&&j("a known back-reference",void 0,o.options);let p=u[f];return p===kr?-1:(B(n,r.name,p),r.index)}let i=o.enter(s/2);if(r===null)return Z4(e.struct,o,n),o.exit(i),-1;if(r===void 0)return o.exit(i),-1;let a=e.intern[r.index];(a===I4||a===T4)&&(o.intern=t[r.index]??=[]),Ze[Q++]=r.name;let c=un(r.layout,o);return Q--,o.intern=void 0,o.exit(i),a===ZR&&(t[r.index]??=[]).push(c),c===kr?-1:(B(n,r.name,c),r.index)}function Oce(e,t){let r=e.elements.length,n=e.hasCount?t.uvarint():r;if(e.rest.length===0&&n>r)throw Ze[Q++]=r,dr(new Nu(e.ast,void 0,t.options));if(n<e.minCount)throw Ze[Q++]=n,dr(new Yt(void 0));if(e.hasCount){let i=e.rest.length>0&&v4(e.rest[0])?Tae:t.remaining+Iae;n>i&&j("array count within allocation limit",n,t.options)}if(n>0){let i=M4(e);if(i!==null)return Ace(i,n,t)}let o=new Array(n),s=e.uniform;if(s!==void 0){if(e.uniformNumbers)return _ce(o,n,t);let i=t.intern;if(t.intern=void 0,i!==void 0){for(let u=0;u<n;u++){Ze[Q++]=u;let f=Cce(i,s,t);if(f===kr)throw dr(new Yt(void 0));Q--,o[u]=f}return o}if(OE(s)){for(let u=0;u<n;u++)Ze[Q++]=u,o[u]=Kh(s,t),Q--;return o}if(s._==="string"){for(let u=0;u<n;u++)Ze[Q++]=u,o[u]=t.dict===void 0?t.readUtf8(t.uvarint()):q4(s,t),Q--;return o}let a=e.uniformPacked,c=e.uniformInline;for(let u=0;u<n;u++){Ze[Q++]=u;let f=t.enter(c?a??0:t.uvarint()),p=un(s,t);if(t.exit(f),p===kr)throw dr(new Yt(void 0));Q--,o[u]=p}return o}for(let i=0;i<n;i++){let a=$4(e,i,n),c=i<r&&e.elements[i].optional;if(!e.hasCount&&t.remaining===0&&!c&&a._!=="null"&&a._!=="undefined")throw Ze[Q++]=i,dr(new Yt(void 0));Ze[Q++]=i;let u=z4(a,t);if(u===kr)throw c&&j("known union member",void 0,t.options),dr(new Yt(void 0));Q--,o[i]=u}if(!e.hasCount&&t.pos<t.end)throw Ze[Q++]=r,dr(new Nu(e.ast,void 0,t.options));return o}function _ce(e,t,r){let n=r.byte();if(n===h4){r.remaining!==t*8&&j("f64",void 0,r.options);for(let o=0;o<t;o++)e[o]=r.f64();return e}if(n===g4){for(let o=0;o<t;o++){Ze[Q++]=o;let s=r.uvarint(),i=s%16;i>kE&&j("decimal",void 0,r.options);let a=y4((s-i)/16);e[o]=i===0?a:a/_c[i],Q--}return e}n!==x4&&j("f64",void 0,r.options);for(let o=0;o<t;o++)Ze[Q++]=o,e[o]=r.numberVarint(),Q--;return e}function Pce(e,t){let r=t.byte();if(r===dt.variant){let o=t.u32le(),s=e.byTag.get(o);if(s===void 0)return t.take(t.remaining),kr;let i=un(s.payload,t);if(i===kr)return kr;if(!s.tuple)for(let a of s.sentinels)B(i,a.key,a.literal);return i}let n=e.byKind.get(r);return n===void 0?(t.take(t.remaining),kr):un(n,t)}function Mce(e,t){let r=e.byPos[t.uvarint()];r===void 0&&j("known union member",void 0,t.options);let n=un(r.layout,t),o=r.variant;if(o!==void 0&&!o.tuple&&n!==kr)for(let s of o.sentinels)B(n,s.key,s.literal);return n}function a4(e,t){switch(t.byte()){case 0:return Cp(_d(un(e.error,t)));case 1:return Ap(_d(un(e.defect,t)));case 2:return t.remaining!==0&&j("empty",void 0,t.options),kp();case 3:return t.remaining!==8&&j("f64",void 0,t.options),kp(t.f64());default:return t.take(t.remaining),kr}}function _d(e){if(e===kr)throw dr(new Yt(void 0));return e}function Kh(e,t){t.nesting>=KW&&j(`nesting depth at most ${KW}`,t.nesting+1,t.options),t.nesting++;try{return Fce(e,t)}finally{t.nesting--}}function Fce(e,t){switch(e._){case"literal":{let r=Kh(e.leaf,t);return Qh(e,r)||j(RE(e),r,t.options),r}case"bool":{t.remaining!==1&&j("bool",void 0,t.options);let r=t.byte();return r>1&&j("bool",void 0,t.options),r===1}case"null":return t.remaining!==0&&j("empty",void 0,t.options),null;case"undefined":t.remaining!==0&&j("empty",void 0,t.options);return;case"number":{let r=t.remaining;if(r===8)return t.f64();(r===0||r>m4)&&j("f64",void 0,t.options);let n=t.numberVarint();if(t.remaining===0)return n;let o=t.byte();return(t.remaining!==0||o===0||o>kE)&&j("decimal",void 0,t.options),n/_c[o]}case"int":return t.numberVarint();case"string":{let r=t.dict;return r===void 0?t.readUtf8(t.end-t.pos):dce(r,e,t)}case"symbol":return globalThis.Symbol.for(t.readUtf8(t.end-t.pos));case"bytes":return t.takeCopy(t.end-t.pos);case"bigint":return t.zigzag();case"int64":{t.remaining!==8&&j("int64",void 0,t.options);let r=Number(t.i64()),n=new Date(r);return Number.isNaN(n.getTime())&&j(e.flavor==="date"?"a valid Date":"a valid DateTime",r,t.options),e.flavor==="date"?n:by(r)}case"dateTimeZoned":{let r=Number(t.i64()),n=t.byte(),o;if(n===0)t.remaining!==4&&j("time zone",void 0,t.options),o=t.i32le();else if(n===1)o=t.readUtf8(t.end-t.pos);else return j("time zone",void 0,t.options);try{return Ey(r,{timeZone:o})}catch{return j("time zone",void 0,t.options)}}case"duration":switch(t.byte()){case 0:return $o(t.zigzag());case 1:return Ss;case 2:return Da;default:return j("duration",void 0,t.options)}case"bigDecimal":{let r=t.zigzag(),n=t.zigzag();return(n>UR||-n>UR)&&j("safe integer length",void 0,t.options),hy(r,Number(n))}case"json":{let r=t.readUtf8(t.end-t.pos);try{return JSON.parse(r)}catch{return j("json",void 0,t.options)}}case"option":{let r=t.byte();return r===0?(t.remaining!==0&&j("empty",void 0,t.options),_()):(r!==1&&j("bool",void 0,t.options),N(_d(un(e.value,t))))}case"result":{let r=t.byte();return r===0?X(_d(un(e.success,t))):(r!==1&&j("bool",void 0,t.options),re(_d(un(e.failure,t))))}case"exit":{let r=t.byte();if(r===0)return Mr(_d(un(e.value,t)));r!==1&&j("bool",void 0,t.options);let n=Kh(e.cause,t);return ir(n)}case"cause":{let r=t.uvarint(),n=[];for(let o=0;o<r;o++){Ze[Q++]=o;let s=t.enter(t.uvarint()),i=a4(e,t);t.exit(s),Q--,i!==kr&&n.push(i)}return t.pos!==t.end&&j("no leftover bytes",void 0,t.options),uu(n)}case"causeReason":return a4(e,t);case"struct":return t.positional?vce(e,t):wce(e,t);case"array":return Oce(e,t);case"union":return t.positional?Mce(e,t):Pce(e,t);case"never":throw dr(new at(e.ast,void 0,t.options))}}function Q4(e,t,r){let n=t.byte();if(n!==r.envelope&&j(r.expectedEnvelope,n,t.options),r.positional){t.remaining<8&&j("complete value",void 0,t.options);let s=t.buf,i=r.fingerprint,a=t.pos;for(let c=0;c<8;c++)s[a+c]!==i[c]&&j("matching layout fingerprint",void 0,t.options);t.pos=a+8}let o=un(e,t);if(o===kr)throw dr(new Yt(void 0));return o}var xE=new zh;function Nce(e,t,r,n){let o=xE??new zh,s=o===xE;s&&(xE=void 0),o.reset(t,0,t.length,r,void 0,n.positional,void 0);let i=Q;Q=0;try{let a=o.uvarint();a===0&&j("nonzero frame length",void 0,r);let c=o.enter(a),u=Q4(e,o,n);return o.exit(c),o.pos!==t.length&&j("no leftover bytes",void 0,r),u}finally{Q=i,o.release(),s&&(xE=o)}}function Uce(e,t,r,n=!1){return Xt({decode:(o,s)=>{try{let i=Nce(e,o,s,t);return r!==void 0&&$d(i)&&(!n||PE(i))&&(r.value=i),I(i)}catch(i){return i instanceof ji?D(i.issue):gn(i)}},encode:(o,s)=>{try{return I(AE(e,o,s,t))}catch(i){return i instanceof ji?D(i.issue):gn(i)}}})}var Dce=mo(Kae);function bf(e,t){return t===!0?Dce(e):Wae}var Lce=mo(e=>{let t=J(SE(e)),{exact:r,exitSuccess:n,layout:o,recursive:s}=jae(t.ast);return{target:s?qce(t):t,layout:o,exact:r,exitSuccess:n,recursive:s}});function Md(e){return Lce(e.ast)}function Y4(e,t){return e.value===void 0||t!==e.value?!1:(e.value=void 0,!0)}function X4(e,t,r){let n=J(Nt(e.ast)),o=ot(n),s=i=>()=>(a,c,u)=>i(a,u)?nt:o(a,u);return J(new uc([n.ast],s(t),{identifier:"binary value"},void 0,void 0,void 0,void 0,s(r)))}function KR(e,t){return t.onExcessProperty!=="error"}function Bce(e,t,r){return X4(e,n=>Y4(t,n),r?KR:$ce)}function $ce(){return!1}function jce(e,t){return Cr()([e],([r])=>{let n=ot(r);return(o,s,i)=>Y4(t,o)||PE(o)&&i.onExcessProperty!=="error"?I(o):n(o,i)},{identifier:"binary exit value"})}function Hce(e){return X4(e,KR,KR)}function qce(e){let t=J(Nt(e.ast)),r=new WeakSet,n=Cr()([t],([o])=>(s,i,a)=>$d(s)&&r.delete(s)?I(s):kn(s)?D(new at(i,s,a)):ot(o)(s,a),{identifier:"acyclic value"});return ee(n,Fe({decode:o=>($d(o)&&r.add(o),o),encode:o=>o}))(e)}var FE=rf,Wce,n6=e=>(Wce??=new TextDecoder).decode(e),fn=class extends Ue()("effect/rpc/RpcSerialization"){},ME=class extends sr("MaxBufferSizeExceeded"){get message(){return`RPC serialization buffer exceeded the maximum size of ${this.maxBufferSize}`}},Kce=16*1024*1024,e6=(e,t)=>t!=="unbounded"&&e>t,o6=fn.of({contentType:"application/json",includesFraming:!1,codecFor:FE,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e=="string"?e:n6(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),NE=e=>{let t=e?.maxBufferSize??Kce;return fn.of({contentType:"application/ndjson",includesFraming:!0,codecFor:FE,makeUnsafe:()=>{let r,n="",o=s=>{throw n="",new ME({maxBufferSize:s})};return{decode:s=>{n+=typeof s=="string"?s:(r??=new TextDecoder).decode(s,{stream:!0});let i=0,a=n.indexOf(`
|
|
33
33
|
`,i),c=[];for(;a!==-1;){e6(a-i,t)&&o(t);let u=n.slice(i,a);i=a+1;try{c.push(JSON.parse(u))}catch{}a=n.indexOf(`
|
|
34
34
|
`,i)}return n=n.slice(i),e6(n.length,t)&&o(t),c},encode:s=>{if(Array.isArray(s)){if(s.length===0)return;let i="";for(let a=0;a<s.length;a++)i+=JSON.stringify(s[a])+`
|
|
35
35
|
`;return i}return JSON.stringify(s)+`
|
|
36
|
-
`}}}})},s6=FE(),i6=e=>fn.of({contentType:e?.contentType??"application/json",includesFraming:!1,codecFor:ME,makeUnsafe:()=>{let t=new Map;return{decode:r=>{let n=JSON.parse(typeof r=="string"?r:n6(r));return c6(n,t)},encode:r=>{let n=u6(r,t);return n&&JSON.stringify(n)}}}}),a6=e=>fn.of({contentType:e?.contentType??"application/json-rpc",includesFraming:!0,codecFor:ME,makeUnsafe:()=>{let t=FE({maxBufferSize:e?.maxBufferSize}).makeUnsafe(),r=new Map;return{decode:n=>{let o=t.decode(n);if(o.length===0)return[];let s=[];for(let i=0;i<o.length;i++)s.push(...c6(o[i],r));return s},encode:n=>{let o=u6(n,r);return o&&t.encode(o)}}}});function c6(e,t){if(Array.isArray(e)){let r={size:0,responses:new Map},n=[];for(let o=0;o<e.length;o++){let s=e[o];if(!Jt(s))continue;let i=t6(s);n.push(i),i._tag==="Request"&&!i.isNotification&&(r.size++,t.set(i.id,r))}return n}return Jt(e)?[t6(e)]:[]}function t6(e){if(Object.hasOwn(e,"method")){let n=e;if(BO(n.id)&&On(n.method)&&n.method.startsWith("@effect/rpc/")){let o=n.method.slice(12),s=n.params?.requestId;return s!==void 0?{_tag:o,requestId:s}:{_tag:o}}return{_tag:"Request",id:n.id??"",tag:n.method,payload:n.params??null,headers:n.headers??[],...O(n,"id")?{}:{isNotification:!0},...n.spanId?{traceId:n.traceId,spanId:n.spanId,sampled:n.sampled}:{}}}let t=e,r=Object.hasOwn(t,"error");return r&&t.error&&t.error._tag==="Defect"?{_tag:"Defect",defect:t.error.data}:Object.hasOwn(t,"chunk")&&t.chunk===!0?{_tag:"Chunk",requestId:t.id??"",values:t.result}:{_tag:"Exit",requestId:t.id??"",exit:r&&t.error!=null?{_tag:"Failure",cause:t.error._tag==="Cause"?t.error.data:[{_tag:"Fail",error:t.error}]}:{_tag:"Success",value:t.result}}}function r6(e,t){if(!("requestId"in e))return nO(e);let r=t.get(e.requestId);return r?(t.delete(e.requestId),r.responses.set(e.requestId,e),r.size===r.responses.size?Array.from(r.responses.values(),nO):void 0):nO(e)}function u6(e,t){if(Array.isArray(e)===!1)return r6(e,t);if(e.length===0)return;let r=[];for(let o=0;o<e.length;o++){let s=r6(e[o],t);s!==void 0&&r.push(s)}if(r.length===0)return;if(r.length===1)return r[0];let n=[];for(let o=0;o<r.length;o++){let s=r[o];Array.isArray(s)?n.push(...s):n.push(s)}return n}function nO(e){switch(e._tag){case"Request":return{jsonrpc:"2.0",method:e.tag,params:e.payload,...e.isNotification?{}:{id:e.id},...e.headers?.length>0?{headers:e.headers}:{},traceId:e.traceId,spanId:e.spanId,sampled:e.sampled};case"Ping":case"Pong":case"Interrupt":case"Ack":case"Eof":return{jsonrpc:"2.0",method:`@effect/rpc/${e._tag}`,params:"requestId"in e?{requestId:e.requestId}:void 0};case"Chunk":return{jsonrpc:"2.0",chunk:!0,id:e.requestId,result:e.values};case"Exit":{if(e.exit._tag==="Success")return{jsonrpc:"2.0",id:e.requestId??void 0,result:e.exit.value};let t=e.exit.cause.find(n=>n._tag==="Fail"),r=t?._tag==="Fail"?t.error:void 0;return{jsonrpc:"2.0",id:e.requestId??void 0,error:e.exit._tag==="Failure"?{_tag:"Cause",code:r&&O(r,"code")?Number(r.code):0,message:r&&O(r,"message")?r.message:JSON.stringify(e.exit.cause),data:e.exit.cause}:void 0}}case"Defect":return{jsonrpc:"2.0",id:Kce,error:{_tag:"Defect",code:1,message:"A defect occurred",data:e.defect}};case"ClientProtocolError":return{}}}var Kce=-32603,Vce=16*1024*1024,Gce=new TextEncoder,Jce=e=>{let t=e?.maxFrameSize==="unbounded"?void 0:e?.maxFrameSize??Vce,r=e?.fingerprintPayloads===!0?o=>VR(o,{fingerprint:!0}):VR,n={fingerprint:!0};return fn.of({contentType:"application/vnd.effect.rpc+schema-binary",includesFraming:!0,codecFor:r,makeUnsafe:()=>{let o=f4(PR,{...n,maxFrameSize:t}),s=d4(PR,n);return{decode:i=>o.feedSync(typeof i=="string"?Gce.encode(i):i),encode:i=>{if(!Array.isArray(i))return s.encode(i);if(i.length!==0)return s.encodeMany(i)}}}})},Zce=Ga(fn)(o6),Qce=Ga(fn)(s6),Yce=e=>Ga(fn)(FE(e)),Xce=e=>Ga(fn)(i6(e)),eue=e=>Ga(fn)(a6(e)),tue=e=>p0(fn)(()=>Jce(e));var NE=class extends Ue()("effect/rpc/RpcWorker/InitialMessage"){};var l6=e=>L(()=>{let t=new Set,r=new Map,n=new Map,o=(s,i)=>yn(a=>{let c=r.get(s);return c||(c=[],r.set(s,c)),c.push([i,a]),P});return K(e((s,i)=>{let a=n.get(s);return a?a(i):o(s,i)},t),s=>({...s,run(i,a){return xt(function*(){t.add(i),n.set(i,a);let c=r.get(i);if(c){r.delete(i);for(let[u,f]of c)yield*Ur(L(()=>a(u)),f)}return yield*Xr(Xn,()=>(t.delete(i),n.delete(i),P))})}}))});var nue=e=>Or(e,"RpcClientError"),oue=0,d6=me(function*(e,t){let r=t.spanPrefix,n=t?.supportsAck??!0,o=t?.disableTracing??!1,s=t?.generateRequestId??(()=>oue++),i=yield*Nr(),a=Re(i,it),c=new Map,u=!1;yield*It(a,ar(b=>(u=!0,f(Dg(b.id)))));let f=me(function*(b){for(let[v,T]of c)c.delete(v),T._tag==="Queue"?yield*b._tag==="Success"?gd(T.queue):Ht(T.queue,b.cause):T.resume(b)}),p=b=>{let v=Lh(b.successSchema),T=x(b);return(S,w)=>{let k=w?.headers?Zo(w.headers):Al,C=w?.context??pt();if(!v){let M=$=>m(b,T,$,b.payloadSchema.make(S),k,C,w?.discard??!1);return o?M(void 0):Zp(TR(r,b._tag),{kind:"client",attributes:wR(b._tag,t.spanAttributes)},M)}let R=h(b,T,b.payloadSchema.make(S),k,w?.streamBufferSize??16,C);return w?.asQueue?R:Cn(K(R,yh))}},m=(b,v,T,S,w,k,C)=>ar(R=>{if(u)return Dn;let M=s(),$=v(xe=>t.onFromClient({message:xe,context:k,discard:C}),{_tag:"Request",id:M,tag:b._tag,payload:S,...T?{traceId:T.traceId,spanId:T.spanId,sampled:T.sampled}:{},headers:kl(R.getRef(UE),w)});if(C)return $;let te;return yu(Nn(xe=>{let Le={_tag:"Effect",rpc:b,context:k,resume(Er){xe(Er),te&&!te.pollUnsafe()&&R.currentDispatcher.scheduleTask(()=>{te.interruptUnsafe(R.id)},0)}};c.set(M,Le),te=$.pipe(T?Sl(T,{captureStackTrace:!1}):F,Sr(R.context)),te.addObserver(Er=>{if(Er._tag==="Failure")return xe(Er)})}),xe=>(c.delete(M),Vt(Tn(te),g(M,Array.from(xe),k))))}),h=me(function*(b,v,T,S,w,k){if(u)return yield*Dn;let C=o?void 0:yield*rw(TR(r,b._tag),{kind:"client",attributes:wR(b._tag,t.spanAttributes)}),R=os(),M=s(),$=dn(R.context,it),te=yield*of(w);return yield*Wo($,xe=>(HA(te),c.has(M)?(c.delete(M),g(M,vs(xe)?Array.from(yN(xe.cause)):[],k)):P)),c.set(M,{_tag:"Queue",rpc:b,queue:te,scope:$,context:k}),yield*v(xe=>t.onFromClient({message:xe,context:k,discard:!1}),{_tag:"Request",id:M,tag:b._tag,payload:T,...C?{traceId:C.traceId,spanId:C.spanId,sampled:C.sampled}:{},headers:kl(R.getRef(UE),S)}).pipe(C?Sl(C,{captureStackTrace:!1}):F,to(xe=>Ht(te,xe)),vi,gt($,{startImmediately:!0})),te}),x=b=>{let v=[];for(let T of b.middlewares.values()){let S=Gi(i,`${T.key}/Client`);S&&v.push(S)}return v.length===0?(T,S)=>T(S):function T(S,w,k=v.length-1){return k===-1?S(w):v[k]({rpc:b,request:w,next(C){return T(S,C,k-1)}})}},g=(b,v,T)=>Nn(S=>{let w=os();t.onFromClient({message:{_tag:"Interrupt",requestId:b,interruptors:v},context:T,discard:!1}).pipe(K0(1e3),Sr(w.context)).addObserver(()=>{S(P)})}),y=b=>{switch(b._tag){case"Chunk":{let v=b.requestId,T=c.get(v);return!T||T._tag!=="Queue"?P:wa(T.queue,b.values).pipe(n?A(()=>t.onFromClient({message:{_tag:"Ack",requestId:b.requestId},context:T.context,discard:!1})):F,rt(S=>Ht(T.queue,S)))}case"Exit":{let v=b.requestId,T=c.get(v);return T?(c.delete(v),T._tag==="Effect"?(T.resume(b.exit),P):b.exit._tag==="Success"?gd(T.queue):Ht(T.queue,b.exit.cause)):P}case"Defect":return f(Ug(b.defect));case"ClientEnd":return P}},E;if(t.flatten){let b=new Map;E=function(T,S,w){let k=b.get(T);return k||(k=p(e.requests.get(T)),b.set(T,k)),k(S,w)}}else E={},e.requests.forEach(b=>{B(E,b._tag,p(b))});return{client:E,write:y}}),sue=0,oO=me(function*(e,t){let r=sue++,{codecFor:n,run:o,send:s,supportsAck:i,supportsTransferables:a}=yield*Hi,c=iue(n),u=Jm(n(er())),f=new Map,p=x=>f.has(x)?(f.delete(x),s(r,{_tag:"Interrupt",requestId:x})):P,{client:m,write:h}=yield*d6(e,{...t,supportsAck:i,onFromClient({message:x}){switch(x._tag){case"Request":{let g=e.requests.get(x.tag),y=a?DW():void 0,E=os(),b={rpc:g,context:y?We(E.context,Dh,y):E.context,schemas:c(g)};return f.set(x.id,b),b.schemas.encodePayload(x.payload).pipe(Ur(b.context),Ii,A(v=>s(r,{...x,id:x.id,payload:v,headers:Object.entries(x.headers)},y&&y.readUnsafe())))}case"Ack":return f.get(x.requestId)?s(r,{_tag:"Ack",requestId:x.requestId}):P;case"Interrupt":return p(x.requestId);case"Eof":return P}}});return yield*o(r,x=>{switch(x._tag){case"Chunk":{let g=_R(x.requestId),y=f.get(g);if(!y||fe(y.schemas.decodeChunk))return P;let E=y.schemas.decodeChunk.value;return en(b=>b(E(x.values).pipe(Ur(y.context),Ii,A(v=>h({_tag:"Chunk",clientId:0,requestId:g,values:v})))).pipe(to(v=>h({_tag:"Exit",clientId:0,requestId:g,exit:ir(v)}).pipe(Vt(ul(v)?P:ay(p(g))))),z0(v=>!ul(v),()=>P)))}case"Exit":{let g=_R(x.requestId),y=f.get(g);return y?(f.delete(g),y.schemas.decodeExit(x.exit).pipe(Ur(y.context),Ii,Un({onSuccess:E=>h({_tag:"Exit",clientId:0,requestId:g,exit:E}),onFailure:E=>h({_tag:"Exit",clientId:0,requestId:g,exit:ir(E)})}))):P}case"Defect":return h({_tag:"Defect",clientId:0,defect:u(x.defect)});case"ClientProtocolError":{let g=Jn(x.error);return Ko(Array.from(f.keys()),y=>h({_tag:"Exit",clientId:0,requestId:y,exit:g}))}default:return P}}).pipe(rt(Yp),vi,Rs),m}),iue=e=>{let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=lE(r.successSchema);return n={decodeChunk:Lt(o,s=>xc(e(Qu(s.success)))),encodePayload:rA(e(r.payloadSchema)),decodeExit:xc(e(RR(r)))},t.set(r,n),n}},UE=Ce("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>Al}),aue=d(2,(e,t)=>X0(e,UE,kl(Zo(t)))),Hi=class extends Ue()("effect/rpc/RpcClient/Protocol"){static make=l6},p6=e=>Hi.make(me(function*(t){let r=yield*fn,n=r.includesFraming,o=u=>new Zs({reason:Td.fromHttpClientError(u)}),s=(u,f)=>new Zs({reason:new Rc({message:u,cause:f})}),i=u=>s("Received empty HTTP response from RPC server",u),a=u=>s("HTTP response ended before RPC request completed",u);return{send:me(function*(u,f){if(f._tag!=="Request")return;let p=r.makeUnsafe(),m=p.encode(f),h=typeof m=="string"?Hk(m,r.contentType):jk(m,r.contentType),x=yield*e.post("",{body:h}).pipe(gl(o));if(!n){let E=yield*x.text.pipe(gl(o)),b=yield*Go({try:()=>p.decode(E),catch:T=>s("Error decoding HTTP response",T)});if(!Array.isArray(b))return yield*s("Expected an array of responses",b);if(b.length===0)return yield*i(f);let v=!1;for(let T=0;T<b.length;T++){let S=b[T];MR(S)&&(v=!0),yield*t(u,S)}return v?void 0:yield*a(f)}let g=!1,y=!1;if(yield*Id(x.stream,E=>Go({try:()=>E.flatMap(p.decode),catch:b=>s("Error decoding HTTP response",b)}).pipe(A(b=>{if(b.length===0)return P;g=!0;let v=0;return xn({while:()=>v<b.length,body:()=>{let T=b[v++];return MR(T)&&(y=!0),t(u,T)},step:Rr})}))).pipe(gl(E=>nue(E)?E:o(E))),g){if(!y)return yield*a(f)}else return yield*i(f)}),supportsAck:!1,supportsTransferables:!1,codecFor:r.codecFor}})),cue=e=>Qn(Hi)(A(Qk,t=>(t=wW(t,mW(e.url)),p6(e.transformClient?e.transformClient(t):t)))),m6=e=>Hi.make(me(function*(t,r){let n=yield*kW,o=yield*fn,s=yield*gu(Yh),i=new Map,a=yield*n.writer,c=o.makeUnsafe(),u=yield*fue(L(()=>a.write(c.encode(jW))),e),f=cy(e?.onPingTimeout??P,{log:!0,message:"RpcClient onPingTimeout hook failed"}),p,m=g=>Ko(r,y=>t(y,g)),h=g=>(p=g,m({_tag:"ClientProtocolError",error:g})),x=g=>{try{let y=c.decode(g);if(y.length===0)return P;u.onFrame();let E=0;return xn({while:()=>E<y.length,body:()=>{let b=y[E++];if(b._tag==="Pong")return P;if(Object.hasOwn(b,"requestId")){let v=b.requestId,T=i.get(v);if(T!==void 0)return b._tag==="Exit"&&i.delete(v),t(T,b)}return m(b)},step:Rr})}catch(y){return m({_tag:"ClientProtocolError",error:new Zs({reason:new Rc({message:"Error decoding message",cause:y})})})}};return yield*L(()=>{c=o.makeUnsafe(),u.reset();let g=!1;return xt(function*(){let{pull:y}=yield*n.reader;for(p=void 0,g=!0,de(s)&&(yield*s.value.onConnect);;){let E=yield*y;for(let b=0;b<E.length;b++)yield*x(E[b])}}).pipe(ec,Ya(u.timeout),Vt(()=>g?f:P),Vt(()=>D(new Oh({reason:new Rh({cause:new Error("ping timeout")})}))))}).pipe(de(s)?wi(s.value.onDisconnect):F,Gp(g=>{let y=cl(g),E=tt(y),b=new Zs({reason:E?y.success.reason:new Rc({message:"Unknown socket error",cause:uu(g)})});return e?.retryTransientErrors&&E&&y.success.reason._tag==="SocketOpenError"?(e.onTransientError?.(b)??P).pipe(cy({log:!0,message:"RpcClient onTransientError hook failed"})):h(b)}),W0(e?.retryPolicy??uue,g=>h(new Zs({reason:g.reason}))),dy({module:"RpcClient",method:"makeProtocolSocket"}),Rs),{send(g,y){if(p)return D(p);y._tag==="Request"&&i.set(y.id,g);let E=c.encode(y);return E===void 0?P:Ii(a.write(E))},supportsAck:!0,supportsTransferables:!1,codecFor:o.codecFor}})),uue=lU([dU(500,1.5),ml(5e3)]),fue=me(function*(e,t){let r=yield*Yn,n=t?.pingInterval??"5 seconds",o=Wt(t?.pingTimeout??n),s=r.currentTimeMillisUnsafe(),i=jr(),a=()=>{s=r.currentTimeMillisUnsafe()},c=()=>{a(),i.closeUnsafe()};return yield*L(()=>r.currentTimeMillisUnsafe()-s>o?i.open:e).pipe(ca(n),ay,Mt,vi,Rs),{timeout:i.await,reset:c,onFrame:a}}),lue=e=>Qn(Hi)(m6(e)),h6=e=>Hi.make(me(function*(t,r){let n=yield*fE,o=yield*Co,s=0,i=yield*gu(NE),a=yield*gu(Yh),c=new Map,u=h=>Ko(r,x=>t(x,h)),f=xt(function*(){let h=s++,x=yield*n.spawn(h);return yield*x.run(g=>{if(g._tag==="Exit"){let y=c.get(g.requestId);if(y)return c.delete(g.requestId),y.latch.openUnsafe(),t(y.clientId,g)}else if(g._tag==="Defect"){for(let[y,E]of c)c.delete(y),E.latch.openUnsafe();return u(g)}else if("requestId"in g){let y=c.get(g.requestId);if(y)return t(y.clientId,g)}return u(g)},{onSpawn:de(i)?A(i.value,([g,y])=>Ii(x.send({_tag:"InitialMessage",value:g},y))):void 0}).pipe(Gp(g=>{for(let[E,b]of c)b.worker===x&&(c.delete(E),b.latch.openUnsafe());let y=cl(g);return u({_tag:"ClientProtocolError",error:new Zs({reason:tt(y)?y.success.reason:new Rc({message:"Error in worker",cause:uu(g)})})})}),iy(ml(1e3)),dy({module:"RpcClient",method:"makeProtocolWorker"}),vi,Rs),x}),p="minSize"in e?yield*Wz({acquire:f,min:e.minSize,max:e.maxSize,concurrency:e.concurrency,targetUtilization:e.targetUtilization,timeToLive:e.timeToLive}):yield*zz({acquire:f,size:e.size,concurrency:e.concurrency,targetUtilization:e.targetUtilization});yield*It(o,W(()=>{for(let h of c.values())h.latch.openUnsafe();c.clear()}));let m=(h,x,g)=>{switch(x._tag){case"Request":return Pk(p).pipe(A(y=>{let E=jr(!1);return c.set(x.id,{clientId:h,worker:y,latch:E}),A(y.send(x,g),()=>E.await)}),ec,Ii);case"Interrupt":{let y=c.get(x.requestId);return y?(c.delete(x.requestId),y.latch.openUnsafe(),Ii(y.worker.send(x))):P}case"Ack":{let y=c.get(x.requestId);return y?Ii(y.worker.send(x)):P}}return P};return yield*ec(Pk(p)),de(a)&&(yield*a.value.onConnect),{send:m,supportsAck:!0,supportsTransferables:!0,codecFor:tf}})),due=Bc(h6,Qn(Hi)),Yh=class extends Ue()("effect/rpc/RpcClient/ConnectionHooks"){};var DE="~effect/reactivity/Atom",y6=e=>O(e,DE),iO="~effect/reactivity/Atom/Writable",tx=d(2,(e,t)=>{let r=$e(t),n=Wn(r);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!n,idleTTL:n?Wt(r):void 0})}),Ef=tx(0),cO={[DE]:DE,equals:Object.is,...wr,toJSON(){return{_id:"Atom",keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},pue={...cO,atom(e,t){let r=S6(e,t);return qi(n=>{let o=n.self(),s=n(this);return s._tag!=="Success"?Ph(s,o):r(n,s.value)})},fn(e,t){return arguments.length===0?(r,n)=>x6(this,r,n):x6(this,e,t)},pull(e,t){let r=Ef(uO(0)),n=qi(o=>{let s=o.self(),i=o(this);return i._tag!=="Success"?Ph(i,s):LE(o,Tue(o,r,e,t),Ca(!0),i.value)});return wue(r,n)},subscriptionRef(e){return bue(Ef(qi(t=>{let r=t.self(),n=t(this);if(n._tag!=="Success")return Ph(n,r);let o=typeof e=="function"?e(t):e;return wh(o)?o:LE(t,o,Ca(!0),n.value)})),(t,r)=>{let n=fR(t(this));return Sue(t,r,n)})}},x6=(e,t,r)=>{let[n,o,s]=Iue(r?.reactivityKeys?(i,a)=>{let c=t(i,a);return Yr(c)?qb(c,r.reactivityKeys):bh(c,zb(r.reactivityKeys))}:t,r);return rx(i=>{i.get(s);let a=i.self(),c=i.get(e);return c._tag!=="Success"?Ph(c,a):n(i,c.value)},o)},mue={...cO,[iO]:iO},hue=e=>iO in e,qi=(e,t)=>{let r=Object.create(cO);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.refresh=t,r},rx=(e,t,r)=>{let n=Object.create(mue);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.write=t,n.refresh=r,n};function xue(e,t){e.setSelf(t)}var ex=(e,t)=>{let r=S6(e,t);return DE in r?r:qi(r)},S6=(e,t)=>{if(typeof e=="function"&&!Yr(e)&&!Ae(e)){let r=e;return function(n,o){let s=r(n);switch(typeof s){case"function":case"object":return s===null?s:b6 in s?aO(n,s,t,o):gue in s?g6(n,s,t,o):s;default:return s}}}else{if(Yr(e))return function(r,n){return aO(r,e,t,n)};if(Ae(e))return function(r,n){return g6(r,e,t,n)}}return uO(e)},b6="~effect/Effect",gue="~effect/Stream",uO=e=>rx(function(t){return e},xue),aO=(e,t,r,n)=>{let o=r?.initialValue!==void 0?us(r.initialValue):Ca();return LE(e,t,o,n,r?.uninterruptible)};function LE(e,t,r,n=pt(),o=!1){let s=e.self(),i=Zn();e.addFinalizer(()=>{Sr(n)(Ve(i,Kt))});let a,c=!1,u=fO(n.pipe(We(it,i),We(uE,e.registry),We(La,e.registry.scheduler)),t,function(f){a=cR(f,s),c&&e.setSelf(a)},o);return c=!0,u!==void 0&&e.addFinalizer(u),a!==void 0?a:s._tag==="Some"?cE(s):_h(r)}function fO(e,t,r,n=!1){if(ws(t)){r(t);return}let s=Sr(e)(t);s.currentDispatcher?.flush();let i=s.pollUnsafe();if(i){r(i);return}let a=s.addObserver(r);function c(){a(),n||s.interruptUnsafe()}return c}function yue(e){let t=e?.memoMap??Ef(ex(()=>xi())),r=i=>y6(t)?i(t):t,n=Wb;function o(i){let a=Object.create(pue);a.keepAlive=!1,a.lazy=!0,a.refresh=void 0,a.factory=o;let c=mO(qi(typeof i=="function"?u=>_p(i(u),n):()=>_p(i,n)));return a.layer=c,a.read=function(f){let p=f(c),m=A(Co,h=>gi(p,r(f),h));return aO(f,m,{uninterruptible:!0})},a}o.memoMap=t,o.addGlobalLayer=i=>{n=_p(n,As(i,Wb))};let s=Ef(ex(i=>yn(a=>gi(Wb,r(i),Re(a,it))).pipe(K(Re(vc)))));return o.withReactivity=i=>a=>vue(a,c=>{let u=fR(c(s));return c.addFinalizer(u.registerUnsafe(i,()=>{c.refresh(a)})),c.subscribe(a,f=>c.setSelf(f)),c.once(a)},{initialValueTarget:a}),o}var lO=yue(),mEe=lO.withReactivity,g6=(e,t,r,n)=>{let o=r?.initialValue!==void 0?us(r.initialValue):Ca();return dO(e,t,o,n)};function dO(e,t,r,n=pt()){let o=e.self();n=We(n,uE,e.registry);let s=yl(a=>A(as(t.channel,a),c=>xn({while:nr,body:()=>c,step(u){e.setSelf(us($f(u),{waiting:!0}))}}))).pipe(rt(a=>(wo(a)?Nd(e.self(),gs(uR),Zt({onNone:()=>e.setSelf(PW(new fl,{previous:e.self()})),onSome:c=>e.setSelf(us(c))})):e.setSelf(Cd(a,{previous:e.self()})),P))),i=fO(n.pipe(We(uE,e.registry),We(La,e.registry.scheduler)),s,Rr,!1);return i!==void 0&&e.addFinalizer(i),o._tag==="Some"?cE(o):_h(r)}var Sue=(e,t,r=pt())=>wh(t)?(e.addFinalizer(Dk(t).pipe(Id(n=>{for(let o=0;o<n.length;o++)e.setSelf(n[o]);return P}),nw(r))),iw(r)(Xz(t))):t._tag!=="Success"?t:dO(e,Dk(t.value),Ca(!0),r),bue=(e,t)=>{function r(n,o){let s=n.get(e);wh(s)?Ai(Lk(s,o)):vd(s)&&Ai(Lk(s.value,o))}return rx(n=>{let o=n(e);return wh(o)||vd(o)?t(n,o):o},r)};var Eue=Symbol.for("effect/reactivity/atom/Atom/Reset"),sO=Symbol.for("effect/reactivity/atom/Atom/Interrupt");function Iue(e,t){let r=Ef(uO([0,void 0])),n=t?.initialValue!==void 0?us(t.initialValue):Ca(),o=t?.concurrent?Ef(qi(a=>{let c=new Set;return a.addFinalizer(()=>c.forEach(u=>u.interruptUnsafe())),c})):void 0;function s(a,c){let u=o?a(o):void 0;a.isFn=!0;let[f,p]=a.get(r);if(f===0)return n;if(p===sO)return Cd(xN(),{previous:a.self()});let m=e(p,a);return b6 in m?(u&&(m=A(El(m,{startImmediately:!0}),x=>{u.add(x);let g=Array.from(u);return x.addObserver(()=>u.delete(x)),K(XS(g),y=>y[0])})),LE(a,m,n,c,!1)):dO(a,m,n,c)}function i(a,c){Aue(()=>{c===Eue?a.set(r,[0,void 0]):c===sO?a.set(r,[a.get(r)[0]+1,sO]):a.set(r,[a.get(r)[0]+1,c]),a.refreshSelf()})}return[s,i,r]}var Tue=(e,t,r,n)=>A(Ck(typeof r=="function"?r(e):r),o=>{let i=os().context,a=Qt(),c=Un(o,{onFailure(f){return wo(f)?bt(a)?I({done:!0,items:a}):D(new fl("Atom.pull: no items")):je(f)},onSuccess(f){let p;return n?.disableAccumulation?p=f:(p=cp(a,f),a=p),I({done:!1,items:p})}}),u=new Set;return e.addFinalizer(()=>{for(let f of u)f()}),e.once(t),e.subscribe(t,()=>{e.setSelf(cE(e.self()));let f;f=fO(i,c,p=>{f&&u.delete(f);let m=cR(p,e.self()),h=u.size>0;e.setSelf(h?_h(m):m)}),f&&u.add(f)}),c}),wue=(e,t)=>rx(t.read,function(r,n){r.set(e,r.get(e)+1)}),pO=typeof WeakRef>"u"||typeof FinalizationRegistry>"u"?e=>{let t=Si();return function(r){let n=Qr(t,r);if(n._tag==="Some")return n.value;let o=e(r);return bi(t,r,o),o}}:e=>{let t=Si(),r=new FinalizationRegistry(n=>{let o=Qr(t,n);o._tag==="Some"&&o.value.deref()===void 0&&Ei(t,n)});return function(n){let o=Qr(t,n).pipe(RI(i=>i.deref()));if(o._tag==="Some")return o.value;let s=e(n);return bi(t,n,new WeakRef(s)),r.register(s,n),s}};var mO=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0});var vue=d(e=>y6(e[0]),(e,t,r)=>{let n=Ef(hue(e)?rx(o=>t(o,e),function(o,s){o.set(e,s)},e.refresh??function(o){o(e)}):qi(o=>t(o,e),e.refresh??function(o){o(e)}));return r?.initialValueTarget&&(n.initialValueTarget=Cue(r.initialValueTarget)),n}),Cue=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t};var Aue=NW;var kue="~effect-atom/atom/Atom/Serializable";var hO=d(2,(e,t)=>{let r=tf(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,Ir()===0?"":new Error().stack?.split(`
|
|
37
|
-
`)[5]??""],[kue]:{key:t.key,encode:nA(r),decode:Jm(r)}})});var I6=()=>(e,t)=>{let r=Ue()(e),n=Qn(r,t.makeEffect??oO(t.group,{...t,flatten:!0})),o=t.runtime??lO;r.runtime=o(typeof t.protocol=="function"?i=>As(n,Kg(t.protocol(i))):As(n,Kg(t.protocol))),r.mutation=pO(i=>{let a=t.group.requests.get(i);return r.runtime.fn()(me(function*({headers:c,payload:u,reactivityKeys:f}){let m=(yield*r)(i,u,{headers:c});return yield*f?qb(m,f):m})).pipe(hO({key:`AtomRpc:mutation:${i}`,schema:lR({success:a.successSchema,error:E6(a)})}))});let s=pO(i=>{let{headers:a,payload:c,reactivityKeys:u,tag:f,timeToLive:p}=i,m=t.group.requests.get(f),h=Lh(m.successSchema),x=h?r.runtime.pull(Cn(r.use(g=>I(g(f,c,{headers:a}))))):r.runtime.atom(r.use(g=>g(f,c,{headers:a})));return u&&(x=r.runtime.factory.withReactivity(u)(x)),!h&&i.serializationKey&&(x=hO(x,{key:`AtomRpc:${i.tag}:${i.serializationKey}`,schema:lR({success:m.successSchema,error:E6(m)})})),p&&(x=Wn(p)?tx(x,p):mO(x)),x});return r.query=(i,a,c)=>{let u={tag:i,payload:a,headers:c?.headers?Zo(c.headers):void 0,reactivityKeys:c?.reactivityKeys,timeToLive:c?.timeToLive!==void 0?$e(c.timeToLive):void 0,serializationKey:c?.serializationKey};return s(u)},r},E6=e=>Pe([e.errorSchema,...Array.from(e.middlewares,t=>t.error),Zs]);var BE={};ps(BE,{make:()=>_ue});var Oue={add(...e){let t=new Map(this.requests);for(let r of e)t.set(r._tag,r);return Aa({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),r=new Map(this.annotations.mapUnsafe);for(let n of e){for(let[o,s]of n.requests)t.set(o,s);for(let[o,s]of n.annotations.mapUnsafe)r.set(o,s)}return Aa({requests:t,annotations:qn(r)})},omit(...e){let t=new Map(this.requests);for(let r of e)t.delete(r);return Aa({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.middleware(e));return Aa({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return xt(function*(){let r=yield*Nr(),n=Yr(e)?yield*e:e,o=new Map;return t.requests.forEach((s,i)=>{o.set(s.key,{tag:s._tag,handler:n[i],context:r})}),qn(o)})},prefix(e){let t=new Map;for(let r of this.requests.values()){let n=r.prefix(e);t.set(n._tag,n)}return Aa({requests:t,annotations:this.annotations})},toLayer(e){return Ja(this.toHandlers(e))},of:F,toLayerHandler(e,t){let r=this;return Ja(xt(function*(){let n=yield*Nr(),o=Yr(t)?yield*t:t,s=new Map,i=r.requests.get(e);return s.set(i.key,{handler:o,context:n}),qn(s)}))},accessHandler(e){return yn(t=>{let r=this.requests.get(e),{handler:n,context:o}=Gi(t,r.key);return I((s,i)=>{i.rpc=r;let a=n(s,i),c=kd(a)?a.value:a;return Yr(c)?Q0(c,o):wk(c,o)})})},annotate(e,t){return Aa({requests:this.requests,annotations:We(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(ys(e,t))},annotateMerge(e){return Aa({requests:this.requests,annotations:Kr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.annotateMerge(Kr(e,n.annotations)));return Aa({requests:t,annotations:this.annotations})}},Aa=e=>Object.assign(function(){},Oue,{requests:e.requests,annotations:e.annotations}),_ue=(...e)=>Aa({requests:new Map(e.map(t=>[t._tag,t])),annotations:pt()});var Md={};ps(Md,{Service:()=>Pue,TypeId:()=>gO,layerClient:()=>Mue});var gO="~effect/rpc/RpcMiddleware",Pue=()=>(e,t)=>{let r=Ir(),n;r!==0&&(yt(2),n=new globalThis.Error,yt(r));function o(){}let s=o;return Object.setPrototypeOf(o,Object.getPrototypeOf(Ue(e))),o.key=e,Object.defineProperty(o,"stack",{get(){return n?.stack}}),s[gO]=gO,s.error=t?.error??Mi,s.requiredForClient=t?.requiredForClient??!1,o},Mue=(e,t)=>Ja(xt(function*(){let r=(yield*Nr()).pipe(H_(it)),n=Yr(t)?yield*t:t;return qn(new Map([[`${e.key}/Client`,o=>Xa(n(o),s=>Kr(r,s))]]))}));var T6=l.Union([l.Struct({_tag:l.Literal("List"),collection:l.String}),l.Struct({_tag:l.Literal("Item"),collection:l.String,id:l.Union([l.String,l.Number])})]),If=(e,t)=>({item:r=>({_tag:"Item",collection:e,id:r}),list:{_tag:"List",collection:e},name:e});function w6(e){return e._tag==="List"?e.collection:`${e.collection}:${e.id}`}var $E=e=>[...new Set(e.map(w6))],jE=e=>[...new Set(e.flatMap(t=>t._tag==="List"?[t.collection]:[w6(t),t.collection]))];var Fue=ne.fn("EffectContract.invalidateAfter")(function*(e){yield*zb(jE(e))});function Nue(e,t,r){function n(o){return $E(r.reads(o))}return{query:(o,s={})=>e.query(t,o,{...s,reactivityKeys:n(o)}),run:o=>e.use(s=>s(t,o))}}function Uue(e,t,r){return{run:n=>e.use(o=>o(t,n)).pipe(ne.tap(o=>Fue(r.invalidates(n,o))))}}function Due(e,t){return{run:r=>sn.unwrap(e.use(n=>ne.succeed(n(t,r))))}}function HE(e,t){let{name:r,queries:n,commands:o,streams:s}=e.declaration;return Object.fromEntries([...n.map(i=>[i.name,Nue(t,`${r}.${i.name}`,i)]),...o.map(i=>[i.name,Uue(t,`${r}.${i.name}`,i)]),...s.map(i=>[i.name,Due(t,`${r}.${i.name}`)])])}var v6=l.Union([l.Struct({_tag:l.Literal("Changed"),keys:l.Array(T6)}),l.Struct({_tag:l.Literal("Resync")})]),Lue=256;function C6(e,t){let r=ex(!1),n=ex({connection:"connecting",failure:ke.none(),needsResync:!0,pending:0});return{connection:e.atom(s=>ne.gen(function*(){s.mount(n);let i=yield*vc;function a(f){s.set(n,{...s.once(n),...f})}function c(){if(s.once(r)){a({needsResync:!0});return}i.invalidateUnsafe($E(t.resyncKeys)),a({needsResync:!1,pending:0})}s.subscribe(r,f=>{f||c()}),t.resume!==void 0&&(s.once(t.resume),s.subscribe(t.resume,c));let u=ne.suspend(()=>{let f=!0;function p(m){a({connection:"live",failure:ke.none()}),s.once(r)?a({needsResync:!0,pending:Math.min(Lue,s.once(n).pending+1)}):f||m._tag==="Resync"?c():i.invalidateUnsafe(jE(m.keys)),f=!1}return t.stream.pipe(sn.runForEach(m=>ne.sync(()=>p(m))),ne.scoped,ne.catchCause(m=>ne.sync(()=>a({failure:ke.some(m)}))),ne.andThen(ne.sync(()=>a({connection:"reconnecting",needsResync:!0}))),ne.andThen(ne.sleep(t.retryDelay??"1 second")))});yield*ne.forever(u)})).pipe(tx(0)),paused:r,status:n}}function A6(e,t){return r=>{function n(){e.document.visibilityState==="visible"&&r()}return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}}function k6({window:e,native:t}){let r=e===void 0?[]:[A6(e,"visibilitychange"),A6(e,"online")],n=t===void 0?r:[...r,t];return qi(o=>{let s=0;function i(){s+=1,o.setSelf(s)}for(let a of n)o.addFinalizer(a(i));return s})}function Bue(e){let t=e.map(({name:r})=>r).filter((r,n,o)=>o.indexOf(r)!==n);if(t.length>0)throw new Error(`Operation names must be unique; duplicated: ${[...new Set(t)].join(", ")}`)}function R6(e,t){let r=e.middleware.bind(e);return Object.assign(e,{declaration:t,middleware:n=>R6(r(n),t)})}function Pc(e,t){let{queries:r=[],commands:n=[],streams:o=[]}=t;Bue([...r,...n,...o]);let s=[...r,...n,...o].map(i=>Rd.make(`${e}.${i.name}`,{error:i.error,payload:i.payload,stream:i.kind==="stream",success:i.success}));return R6(BE.make(...s),{commands:n,name:e,queries:r,streams:o})}function O6(e){let t=Object.entries(e).map(([r,n])=>[r,l.isSchema(n)?n:l.TaggedError()(r,n)]);return{error:t.length===0?l.Never:l.Union(t.map(([,r])=>r)),Rejection:Object.fromEntries(t),reject:Object.fromEntries(t.map(([r,n])=>[r,(...o)=>ne.fail(Reflect.construct(n,o))]))}}function $ue(e){return e===void 0?l.Void:l.isSchema(e)?e:l.Struct(e)}function yO(e,t,r){let{payload:n,success:o,rejections:s={}}=r;return{kind:e,name:t,payload:$ue(n),rejections:s,success:o??l.Void,...O6(s)}}function Tt(e,t){return{...yO("query",e,t),reads:t.reads}}function nx(e,t){return{...yO("command",e,t),invalidates:t.invalidates}}function _6(e,t){return{...yO("stream",e,t),reads:t.reads}}var Mc={message:l.String},M6={field:l.optionalKey(l.String),message:l.String},ox=class extends l.TaggedError()("NotFound",Mc){},qE=class extends l.TaggedError()("Unauthorized",Mc){},Tf=class extends l.TaggedError()("Forbidden",Mc){},zE=class extends l.TaggedError()("BadRequest",M6){},sx=class extends l.TaggedError()("Conflict",M6){},WE=class extends l.TaggedError()("PreconditionFailed",Mc){},P6=class extends l.TaggedError()("TooManyRequests",Mc){},ix=class extends l.TaggedError()("AuthUnavailable",Mc){},Hn=class extends l.TaggedError()("InternalServerError",Mc){},wf=class extends l.TaggedError()("ServiceUnavailable",Mc){};var Fc=class extends Md.Service()("@shivaedev/platform/rpc/RequestTracing"){},F6=class extends Md.Service()("@shivaedev/platform/rpc/Authenticated",{error:l.Union([qE,ix,Tf])}){},N6=class extends Md.Service()("@shivaedev/platform/rpc/MaybeAuthenticated",{error:l.Union([ix,Tf])}){};var wt=l.String.check(l.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*$/u));var Qs=l.String.check(l.isPattern(/^[a-f\d]{64}$/u)),U6=l.Literals(["answer","clarify","not_now"]),jue=l.Struct({prompt:wt.check(l.isMaxLength(128)),selected:l.Array(wt.check(l.isMaxLength(128))).check(l.isMaxLength(32)),text:l.String.check(l.isMaxLength(8192))}),D6=l.Array(jue).check(l.isMaxLength(32)),SO=l.Struct({deadline:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),item:wt,reason:l.String,registeredAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),request:wt,reviewedRevision:Qs,source:l.String}),KE=l.Struct({answers:l.optional(D6),author:l.String.check(l.isPattern(/\S/u),l.isMaxLength(200)),question:wt,recordedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),reviewedRevision:Qs,supersedes:l.optional(wt),type:U6}),VE=l.Struct({context:l.String,id:wt,item:wt,reason:l.String,request:wt,reviewedRevision:Qs,source:l.String}),Fd=l.Struct({context:l.String,id:wt,question:SO}),Nc=l.Struct({body:l.String,id:wt,response:KE}),L6=l.Struct({question:Fd,responses:l.Array(Nc)}),B6=l.Struct({expired:l.Boolean,question:Fd,response:l.optional(Nc)}),$6=l.Struct({answers:l.optional(D6),author:KE.fields.author,body:l.String.check(l.isMaxLength(32768)),id:wt,question:wt,supersedes:l.optional(wt),type:U6});var GE=l.Struct({disposition:l.Literals(["applied","superseded"]),question:wt,recordedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),response:l.optional(wt),reviewedRevision:Qs});var ax=l.String.check(l.isPattern(/\S/u),l.isMaxLength(8192)),cx=l.Struct({by:l.optional(ax),constraints:l.String.check(l.isMaxLength(8192)),goal:ax,item:wt,nextAction:ax,note:l.optional(ax),preparedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),recipient:ax.check(l.isMaxLength(200)),reviewedRevision:Qs,source:l.String,state:l.Literals(["requested","acknowledged","rejected","unavailable"])}),bO=cx.pipe(l.encodeKeys({nextAction:"next_action",preparedAt:"prepared_at",reviewedRevision:"reviewed_revision"})),j6=l.Struct({constraints:cx.fields.constraints,goal:cx.fields.goal,id:wt,item:wt,nextAction:cx.fields.nextAction,recipient:cx.fields.recipient,revision:Qs,source:l.String}),EO=l.Struct({context:l.String,file:l.String,handoff:bO,id:wt,prompt:l.String}),JE=l.Struct({records:l.Array(EO),unknown:l.Array(l.String)}),ZE=l.Struct({context:l.String,id:wt,item:wt,reviewedRevision:Qs,source:l.String});var QE=wt,IO=l.String.check(l.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*(?:#[a-zA-Z\d][a-zA-Z\d._-]*)?$/u)),fo=l.String.check(l.isPattern(/\S/u)),Hue=l.Struct({id:QE,kind:l.Literals(["decision","review","blocker"]),managed:l.optional(l.Boolean),reason:fo,responseFrom:l.Array(fo).check(l.isMinLength(1)),state:l.Literals(["open","closed"]),unblocks:l.Array(IO).check(l.isMinLength(1))}).pipe(l.encodeKeys({responseFrom:"response_from"})),que=l.Struct({id:QE,text:fo}),zue=l.Struct({kind:l.Literals(["implements","informs","depends_on","relates_to"]),target:IO}),Wue=l.Struct({checkedRevision:l.optional(l.String.check(l.isPattern(/^(?:[a-f\d]{40}|[a-f\d]{64})$/iu))),criterion:l.optional(IO),method:l.optional(fo),observedAt:l.optional(fo.check(l.makeFilter(e=>Number.isFinite(Date.parse(e))&&/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/u.exec(e)!==null||"Expected an ISO timestamp with timezone"))),outcome:l.optional(fo),source:fo}).pipe(l.encodeKeys({checkedRevision:"checked_revision",observedAt:"observed_at"})),Uc=l.Struct({areas:l.optional(l.Array(fo)),attention:l.optional(l.Array(Hue)),criteria:l.optional(l.Array(que)),evidence:l.optional(l.Array(Wue)),handoff:l.optional(bO),id:l.optional(QE),items:l.optional(l.Array(QE)),kind:l.optional(l.Literals(["task","investigation","decision","result","project","board","question","response","handoff","goal","report"])),nextAction:l.optional(fo),options:l.optional(l.Array(l.Struct({description:fo.check(l.isMaxLength(8192)),label:fo.check(l.isMaxLength(128))})).check(l.isMaxLength(32))),owner:l.optional(fo),question:l.optional(SO),recommended:l.optional(fo),relationships:l.optional(l.Array(zue)),requestReceipt:l.optional(GE),response:l.optional(KE),status:l.optional(fo)}).pipe(l.encodeKeys({nextAction:"next_action",requestReceipt:"request_receipt"}));var Kue=l.Struct({href:l.optional(l.String),label:l.String}),H6=l.Struct({backlinks:l.Array(l.Struct({href:l.String,kind:l.String,label:l.String,status:l.optional(l.String),title:l.optional(l.String)})),board:l.Boolean,claims:l.Record(l.String,l.Array(Kue)),evidenceSources:l.Array(l.Struct({href:l.optional(l.String),problem:l.String})),lines:l.Record(l.String,l.Number),proseLine:l.Number,raw:l.optional(l.String),receipts:l.Record(l.String,GE)});var TO=l.Struct({id:l.String,open:l.Boolean,options:Uc.to.fields.options,preview:l.optional(VE),prompts:l.optional(l.Array(l.Struct({id:l.String,mode:l.Literals(["one","many","text"]),options:l.Array(l.Struct({id:l.String,source:l.String})),source:l.String}))),promptUnavailable:l.optional(l.String),recommended:Uc.to.fields.recommended,responses:l.optional(l.Array(Nc)),sourceOpen:l.optional(l.Boolean),title:l.optional(l.String),unavailable:l.optional(l.String)}),ka=l.Struct({diagnostics:l.Array(l.Struct({field:l.optional(l.String),line:l.Number,message:l.String})),file:l.String,identity:l.optional(l.String),links:l.Record(l.String,l.String),metadata:Uc,modified:l.Number,questionActions:l.Record(l.String,l.String),reading:l.optional(H6),referenceDetails:l.optional(l.Record(l.String,l.Struct({status:l.optional(l.String),title:l.String}))),references:l.Record(l.String,l.String),requests:l.Array(TO),source:l.String,unavailable:l.Array(l.String),writable:l.Boolean});var q6=l.Struct({counts:l.Struct({goals:l.Number,library:l.Number,now:l.Number,system:l.Number}),home:l.optional(l.Struct({file:l.String,identity:l.optional(l.String)})),inboxCount:l.NullOr(l.Number)});var z6={folder:l.optional(l.String),kind:l.optional(l.String),showFleet:l.optional(l.Boolean),status:l.optional(l.String)},Vue=l.Struct({href:l.String,kind:l.String,modified:l.Number,path:l.String,status:l.String,title:l.String}),W6=l.Struct({files:l.Array(Vue),fleetCount:l.Number,folders:l.Array(l.Struct({count:l.Number,name:l.String,path:l.String})),kinds:l.Array(l.String),statuses:l.Array(l.String)});var Gue=l.Literals(["prepared","executing","adopting","reviewing","repairing","validating","delivering","completed","needs-human","released"]),wO=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0)),YE=l.Struct({attentionOwner:l.optional(l.Literals(["maintainer","orchestrator","automation"])),prUrl:l.optional(l.String),stage:Gue,stageEnteredAt:l.NullOr(wO),updatedAt:l.NullOr(wO),workId:l.String}),vO=l.Struct({...YE.fields,completedAt:wO,stage:l.Literal("completed")}),K6=l.Struct({completed:l.Array(vO),items:l.Array(YE)});var V6=l.NullOr(l.Struct({file:l.String,metadata:Uc,title:l.String})),G6=l.Union([l.Struct({completed:l.Array(l.Struct({...vO.fields,document:V6})),items:l.Array(l.Struct({...YE.fields,document:V6})),state:l.Literal("ready")}),l.Struct({reason:l.String,state:l.Literal("unavailable")})]);var Jue=l.Literals(["now","board","table"]),Zue=l.Literals(["title","owner","status"]),J6=l.Struct({board:l.String,item:l.String,owner:l.String,query:l.String,sort:Zue,status:l.String,view:Jue});var fx=l.Struct({file:l.String,fleetApproved:l.optional(l.Boolean),id:l.String,metadata:Uc,title:l.String,waiting:l.optional(l.String)}),Z6=l.Struct({boards:l.Array(fx),issues:l.Array(l.String),items:l.Array(fx),rows:l.Array(fx),selected:l.optional(ka),selectedOutside:l.Boolean,selectionProblem:l.optional(l.String),state:J6,title:l.String,validBoard:l.Boolean}),ux=l.Struct({earlierAsks:l.optional(l.Number),file:l.String,href:l.String,id:l.String,modified:l.optional(l.Number),problem:l.optional(l.String),reason:l.String,responseFrom:l.optional(l.Array(l.String)),title:l.String}),Q6=l.Struct({agents:l.Array(ux),complete:l.Boolean,issues:l.Array(l.Struct({file:l.String,line:l.Number,message:l.String})),items:l.Array(ux),parked:l.Array(ux),resolved:l.Array(ux),sourceIssues:l.Boolean,you:l.Array(ux)}),Y6=l.Struct({counts:l.Array(l.Struct({count:l.Number,title:l.String})),document:ka});var eK=l.Struct({done:l.Number,"in progress":l.Number,planned:l.Number}),Que=l.Struct({counts:eK,evidence:l.Number,id:l.String,linked:l.Number,text:l.String}),X6=l.Struct({counts:eK,criteria:l.Array(Que),id:l.String,linked:l.Number,nextAction:l.optional(l.String),openAsks:l.Number,owner:l.optional(l.String),status:l.optional(l.String),title:l.String,unlinked:l.Boolean}),tK=l.Struct({closedGoals:l.Array(X6),goals:l.Array(X6),items:l.Array(fx)});var CO=l.Struct({href:l.optional(l.String),label:l.String}),Yue=l.Struct({checkedRevision:l.optional(l.String),method:l.optional(l.String),observedAt:l.optional(l.String),outcome:l.optional(l.String),problem:l.String,source:CO}),rK=l.Struct({document:ka,feedback:l.Array(l.Struct({matching:l.Boolean,question:Fd,questionFile:l.String,response:Nc,responseFile:l.String,supersedesFile:l.optional(l.String)})),feedbackUnknown:l.Boolean,revision:l.String,targets:l.Array(l.Struct({available:l.Boolean,criteria:l.Array(l.Struct({claims:l.Array(Yue),link:CO,text:l.String})),link:CO,status:l.optional(l.String)}))});var nK=l.Struct({resetsAt:l.NullOr(l.Int.check(l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e10))),usedPercent:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0)),windowDurationMins:l.NullOr(l.Int.check(l.isGreaterThan(0)))}),sK=l.Struct({primary:l.NullOr(nK),secondary:l.NullOr(nK)}),AO=l.Int.check(l.isGreaterThanOrEqualTo(0)),oK=l.Struct({limit:AO,remaining:AO,reset:AO.check(l.isLessThanOrEqualTo(864e10))}),iK=l.Struct({core:oK,graphql:oK});var lx=l.Int.check(l.isGreaterThanOrEqualTo(0)),kO=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),Xue=l.Struct({at:kO,cause:l.String.check(l.isMinLength(1),l.isMaxLength(500))}),efe="health.json",zIe=`fleet/${efe}`,aK=l.Struct({concurrency:l.Int.check(l.isGreaterThan(0)),lastCapacityRejection:l.NullOr(Xue),lastSchedulerPass:l.NullOr(kO),observedAt:kO,queued:lx,running:lx,staleAfterMs:l.Int.check(l.isGreaterThan(0)),version:l.Literal(2),waiting:l.Struct({automation:lx,maintainer:lx,orchestrator:lx})});var cK=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13));function RO(e){return l.Union([l.Struct({observedAt:cK,state:l.Literal("ready"),value:e}),l.Struct({cause:l.String,observedAt:cK,state:l.Literals(["not-configured","error"])})])}var OO=l.Struct({codex:RO(sK),fleet:RO(aK),github:RO(iK)}),YIe=Pc("daemon",{queries:[Tt("diagnostics",{payload:{},reads:()=>[],success:OO}),Tt("fleetItems",{payload:{},reads:()=>[],success:K6})]});var uK=l.Struct({now:l.Number,sources:OO}),fK=l.Struct({empty:l.Boolean,templates:l.Array(l.Struct({file:l.String,label:l.String,source:l.String}))}),lK=l.Struct({document:ka,request:TO}),dK=l.Struct({background:l.String,goal:l.String,item:l.String,nextAction:l.String,reading:JE,source:l.optional(ZE),unavailable:l.optional(l.String),writable:l.Boolean});var Rt=If("work-board/workspace",l.String),pK=If("work-board/documents",l.String),mK=If("work-board/identities",l.String),hK=If("work-board/navigation",l.String),Dt=If("work-board/index",l.String),xK=If("work-board/watcher",l.String);var _O=class extends l.TaggedError()("PublicationUncertain",{message:l.String}){},PO=class extends l.TaggedError()("Unanswered",{message:l.String}){},Ys={BadRequest:zE,Conflict:sx,Forbidden:Tf,InternalServerError:Hn,NotFound:ox,PreconditionFailed:WE,PublicationUncertain:_O,ServiceUnavailable:wf,Unanswered:PO},fTe=l.Union(Object.values(Ys)),Dc={Conflict:sx,InternalServerError:Hn,NotFound:ox,ServiceUnavailable:wf},lTe=l.Union(Object.values(Dc));var tfe=Tt("handoffSource",{payload:{item:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:ZE}),rfe=Tt("handoffs",{payload:{item:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:JE}),nfe=nx("prepareHandoff",{invalidates:()=>[Rt.list,Dt.list],payload:j6,rejections:Ys,success:EO}),XE=Pc("work-board",{commands:[nfe],queries:[tfe,rfe]}).middleware(Fc);var ofe=Tt("question",{payload:{item:l.String,request:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:VE}),sfe=Tt("awaitResponse",{payload:{after:l.optional(l.String),question:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:B6}),ife=Tt("responses",{payload:{question:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:L6}),afe=nx("registerQuestion",{invalidates:()=>[Rt.list,Dt.list],payload:{item:l.String,request:l.String,revision:Qs},rejections:Ys,success:Fd}),cfe=nx("recordResponse",{invalidates:()=>[Rt.list,Dt.list],payload:$6,rejections:Ys,success:Nc}),eI=Pc("work-board",{commands:[afe,cfe],queries:[ofe,ife,sfe]}).middleware(Fc);var vf=l.String.check(l.isMaxLength(8192),l.makeFilter(e=>{if(!e.startsWith("/")||e.startsWith("//"))return"Expected a local reading URL";try{let t=new URL(e,"http://127.0.0.1").pathname;return t==="/"||["/_board/inbox","/_board/system","/_board/work","/_board/overview","/_board/changes","/_board/start","/_board/respond","/_board/handoff","/_board/result"].includes(t)||/^\/_board\/item\/[^/]+\/?$/u.exec(t)!==null||/\.md$/iu.exec(t)!==null||"Expected a local reading URL"}catch{return"Expected a local reading URL"}}));function tI(e){let t=new URL(e,"http://127.0.0.1").pathname,r=/^\/_board\/item\/(?<id>[^/]+)\/?$/u.exec(t)?.groups?.id,n=pK.item(decodeURIComponent(t.slice(1)));return r?n=mK.item(decodeURIComponent(r)):t.startsWith("/_board/")&&(n=Dt.list),[Rt.list,n]}var gK=l.Struct({directory:l.String,url:l.String});var ufe=l.Struct({file:l.String,href:l.String,id:l.optional(l.String),itemKind:l.optional(l.String),kind:l.Literals(["document","heading","passage"]),line:l.optional(l.Number),snippet:l.String,status:l.optional(l.String),text:l.String,title:l.String}),ffe=Tt("document",{payload:{url:vf},reads:({url:e})=>[...tI(e),Dt.list],rejections:Dc,success:ka}),lfe=Tt("board",{payload:{url:vf},reads:({url:e})=>tI(e),rejections:Dc,success:Y6}),dfe=Tt("work",{payload:{url:vf},reads:()=>[Rt.list,Dt.list],rejections:Dc,success:Z6}),pfe=Tt("inbox",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:Q6}),mfe=Tt("server",{reads:()=>[],rejections:{ServiceUnavailable:wf},success:gK}),hfe=Tt("diagnostics",{reads:()=>[Rt.list],rejections:{InternalServerError:Hn},success:uK}),xfe=Tt("fleetItems",{reads:()=>[Rt.list,Dt.list],success:G6}),gfe=Tt("goals",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:tK}),yfe=Tt("start",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:fK}),Sfe=Tt("respond",{payload:{url:vf},reads:({url:e})=>[...tI(e),Dt.list],rejections:Dc,success:lK}),bfe=Tt("handoff",{payload:{url:vf},reads:()=>[Rt.list,Dt.list],rejections:Dc,success:dK}),Efe=Tt("result",{payload:{url:vf},reads:()=>[Rt.list,Dt.list],rejections:Dc,success:rK}),Ife=Tt("library",{payload:z6,reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:W6}),Tfe=Tt("navigation",{payload:{current:l.String.check(l.isMaxLength(8192))},reads:()=>[Rt.list,hK.list,Dt.list],rejections:{InternalServerError:Hn},success:q6}),wfe=Tt("search",{payload:{query:l.String.check(l.isMaxLength(8192))},reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:l.Struct({results:l.Array(ufe),total:l.Number,unavailable:l.Array(l.String)})}),vfe=Tt("watcher",{reads:()=>[Rt.list,xK.list],rejections:{InternalServerError:Hn},success:l.Struct({watching:l.Boolean})}),MO=_6("subscribe",{reads:()=>[Rt.list],rejections:{InternalServerError:Hn},success:v6}),FO=Pc("work-board",{queries:[mfe,ffe,lfe,dfe,pfe,hfe,xfe,gfe,yfe,Sfe,bfe,Efe,Tfe,Ife,wfe,vfe],streams:[MO]}).middleware(Fc),yK=FO.merge(eI).merge(XE);function SK(e,t={}){class r extends I6()("WorkBoard/Reader",{group:yK,protocol:Xh.layerProtocolHttp({url:`${e}/_board/rpc`}).pipe(Fn.provide([sE.layer,Qh.layerNdjson]))}){}let n=HE(FO,r),o=MW({defaultIdleTTL:0,timeoutResolution:1}),s=C6(r.runtime,{resume:k6(t),resyncKeys:MO.reads(void 0),stream:n.subscribe.run(void 0)});o.mount(s.connection);async function i(f,p){try{return await ne.runPromise(Uh(o,f,{suspendOnWaiting:!0}),{signal:p})}catch(m){if(p?.aborted){let h=new Error("Reading canceled",{cause:m});throw h.name="AbortError",h}throw m}}async function a(f,p){try{return await ne.runPromise(ne.flatMap(Uh(o,r.runtime),m=>ne.provideContext(f,m)),{signal:p})}catch(m){if(p?.aborted){let h=new Error("Reading canceled",{cause:m});throw h.name="AbortError",h}throw m}}async function c(f,p){let m=await ne.runPromise(ne.result(Uh(o,r.runtime.atom(f),{suspendOnWaiting:!0})),{signal:p});if(m._tag==="Failure")throw m.failure;return m.success}let u=HE(eI,r);return{api:n,handoffs:HE(XE,r),mutate:c,read:i,registry:o,responses:u,run:a,updates:s}}var rI=new WeakMap;function bK(e){let t=rI.get(e);if(t===void 0){let o=function(){n.registry.dispose(),rI.get(e)===n&&rI.delete(e),e.removeEventListener("pagehide",o)};var r=o;t=SK(e.location.origin,{window:e}),rI.set(e,t);let n=t;e.addEventListener("pagehide",o)}return t}var x0e=bK;export{x0e as session};
|
|
36
|
+
`}}}})},s6=NE(),i6=e=>fn.of({contentType:e?.contentType??"application/json",includesFraming:!1,codecFor:FE,makeUnsafe:()=>{let t=new Map;return{decode:r=>{let n=JSON.parse(typeof r=="string"?r:n6(r));return c6(n,t)},encode:r=>{let n=u6(r,t);return n&&JSON.stringify(n)}}}}),a6=e=>fn.of({contentType:e?.contentType??"application/json-rpc",includesFraming:!0,codecFor:FE,makeUnsafe:()=>{let t=NE({maxBufferSize:e?.maxBufferSize}).makeUnsafe(),r=new Map;return{decode:n=>{let o=t.decode(n);if(o.length===0)return[];let s=[];for(let i=0;i<o.length;i++)s.push(...c6(o[i],r));return s},encode:n=>{let o=u6(n,r);return o&&t.encode(o)}}}});function c6(e,t){if(Array.isArray(e)){let r={size:0,responses:new Map},n=[];for(let o=0;o<e.length;o++){let s=e[o];if(!Jt(s))continue;let i=t6(s);n.push(i),i._tag==="Request"&&!i.isNotification&&(r.size++,t.set(i.id,r))}return n}return Jt(e)?[t6(e)]:[]}function t6(e){if(Object.hasOwn(e,"method")){let n=e;if(BO(n.id)&&On(n.method)&&n.method.startsWith("@effect/rpc/")){let o=n.method.slice(12),s=n.params?.requestId;return s!==void 0?{_tag:o,requestId:s}:{_tag:o}}return{_tag:"Request",id:n.id??"",tag:n.method,payload:n.params??null,headers:n.headers??[],...O(n,"id")?{}:{isNotification:!0},...n.spanId?{traceId:n.traceId,spanId:n.spanId,sampled:n.sampled}:{}}}let t=e,r=Object.hasOwn(t,"error");return r&&t.error&&t.error._tag==="Defect"?{_tag:"Defect",defect:t.error.data}:Object.hasOwn(t,"chunk")&&t.chunk===!0?{_tag:"Chunk",requestId:t.id??"",values:t.result}:{_tag:"Exit",requestId:t.id??"",exit:r&&t.error!=null?{_tag:"Failure",cause:t.error._tag==="Cause"?t.error.data:[{_tag:"Fail",error:t.error}]}:{_tag:"Success",value:t.result}}}function r6(e,t){if(!("requestId"in e))return nO(e);let r=t.get(e.requestId);return r?(t.delete(e.requestId),r.responses.set(e.requestId,e),r.size===r.responses.size?Array.from(r.responses.values(),nO):void 0):nO(e)}function u6(e,t){if(Array.isArray(e)===!1)return r6(e,t);if(e.length===0)return;let r=[];for(let o=0;o<e.length;o++){let s=r6(e[o],t);s!==void 0&&r.push(s)}if(r.length===0)return;if(r.length===1)return r[0];let n=[];for(let o=0;o<r.length;o++){let s=r[o];Array.isArray(s)?n.push(...s):n.push(s)}return n}function nO(e){switch(e._tag){case"Request":return{jsonrpc:"2.0",method:e.tag,params:e.payload,...e.isNotification?{}:{id:e.id},...e.headers?.length>0?{headers:e.headers}:{},traceId:e.traceId,spanId:e.spanId,sampled:e.sampled};case"Ping":case"Pong":case"Interrupt":case"Ack":case"Eof":return{jsonrpc:"2.0",method:`@effect/rpc/${e._tag}`,params:"requestId"in e?{requestId:e.requestId}:void 0};case"Chunk":return{jsonrpc:"2.0",chunk:!0,id:e.requestId,result:e.values};case"Exit":{if(e.exit._tag==="Success")return{jsonrpc:"2.0",id:e.requestId??void 0,result:e.exit.value};let t=e.exit.cause.find(n=>n._tag==="Fail"),r=t?._tag==="Fail"?t.error:void 0;return{jsonrpc:"2.0",id:e.requestId??void 0,error:e.exit._tag==="Failure"?{_tag:"Cause",code:r&&O(r,"code")?Number(r.code):0,message:r&&O(r,"message")?r.message:JSON.stringify(e.exit.cause),data:e.exit.cause}:void 0}}case"Defect":return{jsonrpc:"2.0",id:Vce,error:{_tag:"Defect",code:1,message:"A defect occurred",data:e.defect}};case"ClientProtocolError":return{}}}var Vce=-32603,Gce=16*1024*1024,Jce=new TextEncoder,Zce=e=>{let t=e?.maxFrameSize==="unbounded"?void 0:e?.maxFrameSize??Gce,r=e?.fingerprintPayloads===!0?o=>VR(o,{fingerprint:!0}):VR,n={fingerprint:!0};return fn.of({contentType:"application/vnd.effect.rpc+schema-binary",includesFraming:!0,codecFor:r,makeUnsafe:()=>{let o=f4(PR,{...n,maxFrameSize:t}),s=d4(PR,n);return{decode:i=>o.feedSync(typeof i=="string"?Jce.encode(i):i),encode:i=>{if(!Array.isArray(i))return s.encode(i);if(i.length!==0)return s.encodeMany(i)}}}})},Qce=Ga(fn)(o6),Yce=Ga(fn)(s6),Xce=e=>Ga(fn)(NE(e)),eue=e=>Ga(fn)(i6(e)),tue=e=>Ga(fn)(a6(e)),rue=e=>p0(fn)(()=>Zce(e));var UE=class extends Ue()("effect/rpc/RpcWorker/InitialMessage"){};var l6=e=>L(()=>{let t=new Set,r=new Map,n=new Map,o=(s,i)=>yn(a=>{let c=r.get(s);return c||(c=[],r.set(s,c)),c.push([i,a]),P});return K(e((s,i)=>{let a=n.get(s);return a?a(i):o(s,i)},t),s=>({...s,run(i,a){return xt(function*(){t.add(i),n.set(i,a);let c=r.get(i);if(c){r.delete(i);for(let[u,f]of c)yield*Ur(L(()=>a(u)),f)}return yield*Xr(Xn,()=>(t.delete(i),n.delete(i),P))})}}))});var oue=e=>Or(e,"RpcClientError"),sue=0,d6=me(function*(e,t){let r=t.spanPrefix,n=t?.supportsAck??!0,o=t?.disableTracing??!1,s=t?.generateRequestId??(()=>sue++),i=yield*Nr(),a=Re(i,it),c=new Map,u=!1;yield*It(a,ar(b=>(u=!0,f(Lg(b.id)))));let f=me(function*(b){for(let[v,T]of c)c.delete(v),T._tag==="Queue"?yield*b._tag==="Success"?yd(T.queue):Ht(T.queue,b.cause):T.resume(b)}),p=b=>{let v=Bh(b.successSchema),T=x(b);return(S,w)=>{let k=w?.headers?Zo(w.headers):kl,C=w?.context??pt();if(!v){let M=$=>m(b,T,$,b.payloadSchema.make(S),k,C,w?.discard??!1);return o?M(void 0):Qp(TR(r,b._tag),{kind:"client",attributes:wR(b._tag,t.spanAttributes)},M)}let R=h(b,T,b.payloadSchema.make(S),k,w?.streamBufferSize??16,C);return w?.asQueue?R:Cn(K(R,Sh))}},m=(b,v,T,S,w,k,C)=>ar(R=>{if(u)return Dn;let M=s(),$=v(xe=>t.onFromClient({message:xe,context:k,discard:C}),{_tag:"Request",id:M,tag:b._tag,payload:S,...T?{traceId:T.traceId,spanId:T.spanId,sampled:T.sampled}:{},headers:Rl(R.getRef(DE),w)});if(C)return $;let te;return Su(Nn(xe=>{let Le={_tag:"Effect",rpc:b,context:k,resume(Er){xe(Er),te&&!te.pollUnsafe()&&R.currentDispatcher.scheduleTask(()=>{te.interruptUnsafe(R.id)},0)}};c.set(M,Le),te=$.pipe(T?bl(T,{captureStackTrace:!1}):F,Sr(R.context)),te.addObserver(Er=>{if(Er._tag==="Failure")return xe(Er)})}),xe=>(c.delete(M),Vt(Tn(te),g(M,Array.from(xe),k))))}),h=me(function*(b,v,T,S,w,k){if(u)return yield*Dn;let C=o?void 0:yield*rw(TR(r,b._tag),{kind:"client",attributes:wR(b._tag,t.spanAttributes)}),R=os(),M=s(),$=dn(R.context,it),te=yield*sf(w);return yield*Wo($,xe=>(HA(te),c.has(M)?(c.delete(M),g(M,vs(xe)?Array.from(yN(xe.cause)):[],k)):P)),c.set(M,{_tag:"Queue",rpc:b,queue:te,scope:$,context:k}),yield*v(xe=>t.onFromClient({message:xe,context:k,discard:!1}),{_tag:"Request",id:M,tag:b._tag,payload:T,...C?{traceId:C.traceId,spanId:C.spanId,sampled:C.sampled}:{},headers:Rl(R.getRef(DE),S)}).pipe(C?bl(C,{captureStackTrace:!1}):F,to(xe=>Ht(te,xe)),vi,gt($,{startImmediately:!0})),te}),x=b=>{let v=[];for(let T of b.middlewares.values()){let S=Gi(i,`${T.key}/Client`);S&&v.push(S)}return v.length===0?(T,S)=>T(S):function T(S,w,k=v.length-1){return k===-1?S(w):v[k]({rpc:b,request:w,next(C){return T(S,C,k-1)}})}},g=(b,v,T)=>Nn(S=>{let w=os();t.onFromClient({message:{_tag:"Interrupt",requestId:b,interruptors:v},context:T,discard:!1}).pipe(K0(1e3),Sr(w.context)).addObserver(()=>{S(P)})}),y=b=>{switch(b._tag){case"Chunk":{let v=b.requestId,T=c.get(v);return!T||T._tag!=="Queue"?P:wa(T.queue,b.values).pipe(n?A(()=>t.onFromClient({message:{_tag:"Ack",requestId:b.requestId},context:T.context,discard:!1})):F,rt(S=>Ht(T.queue,S)))}case"Exit":{let v=b.requestId,T=c.get(v);return T?(c.delete(v),T._tag==="Effect"?(T.resume(b.exit),P):b.exit._tag==="Success"?yd(T.queue):Ht(T.queue,b.exit.cause)):P}case"Defect":return f(Dg(b.defect));case"ClientEnd":return P}},E;if(t.flatten){let b=new Map;E=function(T,S,w){let k=b.get(T);return k||(k=p(e.requests.get(T)),b.set(T,k)),k(S,w)}}else E={},e.requests.forEach(b=>{B(E,b._tag,p(b))});return{client:E,write:y}}),iue=0,oO=me(function*(e,t){let r=iue++,{codecFor:n,run:o,send:s,supportsAck:i,supportsTransferables:a}=yield*Hi,c=aue(n),u=Zm(n(er())),f=new Map,p=x=>f.has(x)?(f.delete(x),s(r,{_tag:"Interrupt",requestId:x})):P,{client:m,write:h}=yield*d6(e,{...t,supportsAck:i,onFromClient({message:x}){switch(x._tag){case"Request":{let g=e.requests.get(x.tag),y=a?DW():void 0,E=os(),b={rpc:g,context:y?We(E.context,Lh,y):E.context,schemas:c(g)};return f.set(x.id,b),b.schemas.encodePayload(x.payload).pipe(Ur(b.context),Ii,A(v=>s(r,{...x,id:x.id,payload:v,headers:Object.entries(x.headers)},y&&y.readUnsafe())))}case"Ack":return f.get(x.requestId)?s(r,{_tag:"Ack",requestId:x.requestId}):P;case"Interrupt":return p(x.requestId);case"Eof":return P}}});return yield*o(r,x=>{switch(x._tag){case"Chunk":{let g=_R(x.requestId),y=f.get(g);if(!y||fe(y.schemas.decodeChunk))return P;let E=y.schemas.decodeChunk.value;return en(b=>b(E(x.values).pipe(Ur(y.context),Ii,A(v=>h({_tag:"Chunk",clientId:0,requestId:g,values:v})))).pipe(to(v=>h({_tag:"Exit",clientId:0,requestId:g,exit:ir(v)}).pipe(Vt(fl(v)?P:cy(p(g))))),z0(v=>!fl(v),()=>P)))}case"Exit":{let g=_R(x.requestId),y=f.get(g);return y?(f.delete(g),y.schemas.decodeExit(x.exit).pipe(Ur(y.context),Ii,Un({onSuccess:E=>h({_tag:"Exit",clientId:0,requestId:g,exit:E}),onFailure:E=>h({_tag:"Exit",clientId:0,requestId:g,exit:ir(E)})}))):P}case"Defect":return h({_tag:"Defect",clientId:0,defect:u(x.defect)});case"ClientProtocolError":{let g=Jn(x.error);return Ko(Array.from(f.keys()),y=>h({_tag:"Exit",clientId:0,requestId:y,exit:g}))}default:return P}}).pipe(rt(Xp),vi,Rs),m}),aue=e=>{let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=dE(r.successSchema);return n={decodeChunk:Lt(o,s=>xc(e(Yu(s.success)))),encodePayload:rA(e(r.payloadSchema)),decodeExit:xc(e(RR(r)))},t.set(r,n),n}},DE=Ce("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>kl}),cue=d(2,(e,t)=>X0(e,DE,Rl(Zo(t)))),Hi=class extends Ue()("effect/rpc/RpcClient/Protocol"){static make=l6},p6=e=>Hi.make(me(function*(t){let r=yield*fn,n=r.includesFraming,o=u=>new Zs({reason:wd.fromHttpClientError(u)}),s=(u,f)=>new Zs({reason:new Rc({message:u,cause:f})}),i=u=>s("Received empty HTTP response from RPC server",u),a=u=>s("HTTP response ended before RPC request completed",u);return{send:me(function*(u,f){if(f._tag!=="Request")return;let p=r.makeUnsafe(),m=p.encode(f),h=typeof m=="string"?Hk(m,r.contentType):jk(m,r.contentType),x=yield*e.post("",{body:h}).pipe(yl(o));if(!n){let E=yield*x.text.pipe(yl(o)),b=yield*Go({try:()=>p.decode(E),catch:T=>s("Error decoding HTTP response",T)});if(!Array.isArray(b))return yield*s("Expected an array of responses",b);if(b.length===0)return yield*i(f);let v=!1;for(let T=0;T<b.length;T++){let S=b[T];MR(S)&&(v=!0),yield*t(u,S)}return v?void 0:yield*a(f)}let g=!1,y=!1;if(yield*Td(x.stream,E=>Go({try:()=>E.flatMap(p.decode),catch:b=>s("Error decoding HTTP response",b)}).pipe(A(b=>{if(b.length===0)return P;g=!0;let v=0;return xn({while:()=>v<b.length,body:()=>{let T=b[v++];return MR(T)&&(y=!0),t(u,T)},step:Rr})}))).pipe(yl(E=>oue(E)?E:o(E))),g){if(!y)return yield*a(f)}else return yield*i(f)}),supportsAck:!1,supportsTransferables:!1,codecFor:r.codecFor}})),uue=e=>Qn(Hi)(A(Qk,t=>(t=wW(t,mW(e.url)),p6(e.transformClient?e.transformClient(t):t)))),m6=e=>Hi.make(me(function*(t,r){let n=yield*kW,o=yield*fn,s=yield*yu(Xh),i=new Map,a=yield*n.writer,c=o.makeUnsafe(),u=yield*lue(L(()=>a.write(c.encode(jW))),e),f=uy(e?.onPingTimeout??P,{log:!0,message:"RpcClient onPingTimeout hook failed"}),p,m=g=>Ko(r,y=>t(y,g)),h=g=>(p=g,m({_tag:"ClientProtocolError",error:g})),x=g=>{try{let y=c.decode(g);if(y.length===0)return P;u.onFrame();let E=0;return xn({while:()=>E<y.length,body:()=>{let b=y[E++];if(b._tag==="Pong")return P;if(Object.hasOwn(b,"requestId")){let v=b.requestId,T=i.get(v);if(T!==void 0)return b._tag==="Exit"&&i.delete(v),t(T,b)}return m(b)},step:Rr})}catch(y){return m({_tag:"ClientProtocolError",error:new Zs({reason:new Rc({message:"Error decoding message",cause:y})})})}};return yield*L(()=>{c=o.makeUnsafe(),u.reset();let g=!1;return xt(function*(){let{pull:y}=yield*n.reader;for(p=void 0,g=!0,de(s)&&(yield*s.value.onConnect);;){let E=yield*y;for(let b=0;b<E.length;b++)yield*x(E[b])}}).pipe(ec,Ya(u.timeout),Vt(()=>g?f:P),Vt(()=>D(new _h({reason:new Oh({cause:new Error("ping timeout")})}))))}).pipe(de(s)?wi(s.value.onDisconnect):F,Jp(g=>{let y=ul(g),E=tt(y),b=new Zs({reason:E?y.success.reason:new Rc({message:"Unknown socket error",cause:fu(g)})});return e?.retryTransientErrors&&E&&y.success.reason._tag==="SocketOpenError"?(e.onTransientError?.(b)??P).pipe(uy({log:!0,message:"RpcClient onTransientError hook failed"})):h(b)}),W0(e?.retryPolicy??fue,g=>h(new Zs({reason:g.reason}))),py({module:"RpcClient",method:"makeProtocolSocket"}),Rs),{send(g,y){if(p)return D(p);y._tag==="Request"&&i.set(y.id,g);let E=c.encode(y);return E===void 0?P:Ii(a.write(E))},supportsAck:!0,supportsTransferables:!1,codecFor:o.codecFor}})),fue=lU([dU(500,1.5),hl(5e3)]),lue=me(function*(e,t){let r=yield*Yn,n=t?.pingInterval??"5 seconds",o=Wt(t?.pingTimeout??n),s=r.currentTimeMillisUnsafe(),i=jr(),a=()=>{s=r.currentTimeMillisUnsafe()},c=()=>{a(),i.closeUnsafe()};return yield*L(()=>r.currentTimeMillisUnsafe()-s>o?i.open:e).pipe(ca(n),cy,Mt,vi,Rs),{timeout:i.await,reset:c,onFrame:a}}),due=e=>Qn(Hi)(m6(e)),h6=e=>Hi.make(me(function*(t,r){let n=yield*lE,o=yield*Co,s=0,i=yield*yu(UE),a=yield*yu(Xh),c=new Map,u=h=>Ko(r,x=>t(x,h)),f=xt(function*(){let h=s++,x=yield*n.spawn(h);return yield*x.run(g=>{if(g._tag==="Exit"){let y=c.get(g.requestId);if(y)return c.delete(g.requestId),y.latch.openUnsafe(),t(y.clientId,g)}else if(g._tag==="Defect"){for(let[y,E]of c)c.delete(y),E.latch.openUnsafe();return u(g)}else if("requestId"in g){let y=c.get(g.requestId);if(y)return t(y.clientId,g)}return u(g)},{onSpawn:de(i)?A(i.value,([g,y])=>Ii(x.send({_tag:"InitialMessage",value:g},y))):void 0}).pipe(Jp(g=>{for(let[E,b]of c)b.worker===x&&(c.delete(E),b.latch.openUnsafe());let y=ul(g);return u({_tag:"ClientProtocolError",error:new Zs({reason:tt(y)?y.success.reason:new Rc({message:"Error in worker",cause:fu(g)})})})}),ay(hl(1e3)),py({module:"RpcClient",method:"makeProtocolWorker"}),vi,Rs),x}),p="minSize"in e?yield*Wz({acquire:f,min:e.minSize,max:e.maxSize,concurrency:e.concurrency,targetUtilization:e.targetUtilization,timeToLive:e.timeToLive}):yield*zz({acquire:f,size:e.size,concurrency:e.concurrency,targetUtilization:e.targetUtilization});yield*It(o,W(()=>{for(let h of c.values())h.latch.openUnsafe();c.clear()}));let m=(h,x,g)=>{switch(x._tag){case"Request":return Pk(p).pipe(A(y=>{let E=jr(!1);return c.set(x.id,{clientId:h,worker:y,latch:E}),A(y.send(x,g),()=>E.await)}),ec,Ii);case"Interrupt":{let y=c.get(x.requestId);return y?(c.delete(x.requestId),y.latch.openUnsafe(),Ii(y.worker.send(x))):P}case"Ack":{let y=c.get(x.requestId);return y?Ii(y.worker.send(x)):P}}return P};return yield*ec(Pk(p)),de(a)&&(yield*a.value.onConnect),{send:m,supportsAck:!0,supportsTransferables:!0,codecFor:rf}})),pue=$c(h6,Qn(Hi)),Xh=class extends Ue()("effect/rpc/RpcClient/ConnectionHooks"){};var LE="~effect/reactivity/Atom",y6=e=>O(e,LE),iO="~effect/reactivity/Atom/Writable",rx=d(2,(e,t)=>{let r=$e(t),n=Wn(r);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!n,idleTTL:n?Wt(r):void 0})}),If=rx(0),cO={[LE]:LE,equals:Object.is,...wr,toJSON(){return{_id:"Atom",keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},mue={...cO,atom(e,t){let r=S6(e,t);return qi(n=>{let o=n.self(),s=n(this);return s._tag!=="Success"?Mh(s,o):r(n,s.value)})},fn(e,t){return arguments.length===0?(r,n)=>x6(this,r,n):x6(this,e,t)},pull(e,t){let r=If(uO(0)),n=qi(o=>{let s=o.self(),i=o(this);return i._tag!=="Success"?Mh(i,s):BE(o,wue(o,r,e,t),Ca(!0),i.value)});return vue(r,n)},subscriptionRef(e){return Eue(If(qi(t=>{let r=t.self(),n=t(this);if(n._tag!=="Success")return Mh(n,r);let o=typeof e=="function"?e(t):e;return vh(o)?o:BE(t,o,Ca(!0),n.value)})),(t,r)=>{let n=fR(t(this));return bue(t,r,n)})}},x6=(e,t,r)=>{let[n,o,s]=Tue(r?.reactivityKeys?(i,a)=>{let c=t(i,a);return Yr(c)?zb(c,r.reactivityKeys):Eh(c,Wb(r.reactivityKeys))}:t,r);return nx(i=>{i.get(s);let a=i.self(),c=i.get(e);return c._tag!=="Success"?Mh(c,a):n(i,c.value)},o)},hue={...cO,[iO]:iO},xue=e=>iO in e,qi=(e,t)=>{let r=Object.create(cO);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.refresh=t,r},nx=(e,t,r)=>{let n=Object.create(hue);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.write=t,n.refresh=r,n};function gue(e,t){e.setSelf(t)}var tx=(e,t)=>{let r=S6(e,t);return LE in r?r:qi(r)},S6=(e,t)=>{if(typeof e=="function"&&!Yr(e)&&!Ae(e)){let r=e;return function(n,o){let s=r(n);switch(typeof s){case"function":case"object":return s===null?s:b6 in s?aO(n,s,t,o):yue in s?g6(n,s,t,o):s;default:return s}}}else{if(Yr(e))return function(r,n){return aO(r,e,t,n)};if(Ae(e))return function(r,n){return g6(r,e,t,n)}}return uO(e)},b6="~effect/Effect",yue="~effect/Stream",uO=e=>nx(function(t){return e},gue),aO=(e,t,r,n)=>{let o=r?.initialValue!==void 0?us(r.initialValue):Ca();return BE(e,t,o,n,r?.uninterruptible)};function BE(e,t,r,n=pt(),o=!1){let s=e.self(),i=Zn();e.addFinalizer(()=>{Sr(n)(Ve(i,Kt))});let a,c=!1,u=fO(n.pipe(We(it,i),We(fE,e.registry),We(La,e.registry.scheduler)),t,function(f){a=cR(f,s),c&&e.setSelf(a)},o);return c=!0,u!==void 0&&e.addFinalizer(u),a!==void 0?a:s._tag==="Some"?uE(s):Ph(r)}function fO(e,t,r,n=!1){if(ws(t)){r(t);return}let s=Sr(e)(t);s.currentDispatcher?.flush();let i=s.pollUnsafe();if(i){r(i);return}let a=s.addObserver(r);function c(){a(),n||s.interruptUnsafe()}return c}function Sue(e){let t=e?.memoMap??If(tx(()=>xi())),r=i=>y6(t)?i(t):t,n=Kb;function o(i){let a=Object.create(mue);a.keepAlive=!1,a.lazy=!0,a.refresh=void 0,a.factory=o;let c=mO(qi(typeof i=="function"?u=>Pp(i(u),n):()=>Pp(i,n)));return a.layer=c,a.read=function(f){let p=f(c),m=A(Co,h=>gi(p,r(f),h));return aO(f,m,{uninterruptible:!0})},a}o.memoMap=t,o.addGlobalLayer=i=>{n=Pp(n,As(i,Kb))};let s=If(tx(i=>yn(a=>gi(Kb,r(i),Re(a,it))).pipe(K(Re(vc)))));return o.withReactivity=i=>a=>Cue(a,c=>{let u=fR(c(s));return c.addFinalizer(u.registerUnsafe(i,()=>{c.refresh(a)})),c.subscribe(a,f=>c.setSelf(f)),c.once(a)},{initialValueTarget:a}),o}var lO=Sue(),hEe=lO.withReactivity,g6=(e,t,r,n)=>{let o=r?.initialValue!==void 0?us(r.initialValue):Ca();return dO(e,t,o,n)};function dO(e,t,r,n=pt()){let o=e.self();n=We(n,fE,e.registry);let s=Sl(a=>A(as(t.channel,a),c=>xn({while:nr,body:()=>c,step(u){e.setSelf(us(jf(u),{waiting:!0}))}}))).pipe(rt(a=>(wo(a)?Ud(e.self(),gs(uR),Zt({onNone:()=>e.setSelf(PW(new ll,{previous:e.self()})),onSome:c=>e.setSelf(us(c))})):e.setSelf(Ad(a,{previous:e.self()})),P))),i=fO(n.pipe(We(fE,e.registry),We(La,e.registry.scheduler)),s,Rr,!1);return i!==void 0&&e.addFinalizer(i),o._tag==="Some"?uE(o):Ph(r)}var bue=(e,t,r=pt())=>vh(t)?(e.addFinalizer(Dk(t).pipe(Td(n=>{for(let o=0;o<n.length;o++)e.setSelf(n[o]);return P}),nw(r))),iw(r)(Xz(t))):t._tag!=="Success"?t:dO(e,Dk(t.value),Ca(!0),r),Eue=(e,t)=>{function r(n,o){let s=n.get(e);vh(s)?Ai(Lk(s,o)):Cd(s)&&Ai(Lk(s.value,o))}return nx(n=>{let o=n(e);return vh(o)||Cd(o)?t(n,o):o},r)};var Iue=Symbol.for("effect/reactivity/atom/Atom/Reset"),sO=Symbol.for("effect/reactivity/atom/Atom/Interrupt");function Tue(e,t){let r=If(uO([0,void 0])),n=t?.initialValue!==void 0?us(t.initialValue):Ca(),o=t?.concurrent?If(qi(a=>{let c=new Set;return a.addFinalizer(()=>c.forEach(u=>u.interruptUnsafe())),c})):void 0;function s(a,c){let u=o?a(o):void 0;a.isFn=!0;let[f,p]=a.get(r);if(f===0)return n;if(p===sO)return Ad(xN(),{previous:a.self()});let m=e(p,a);return b6 in m?(u&&(m=A(Il(m,{startImmediately:!0}),x=>{u.add(x);let g=Array.from(u);return x.addObserver(()=>u.delete(x)),K(eb(g),y=>y[0])})),BE(a,m,n,c,!1)):dO(a,m,n,c)}function i(a,c){kue(()=>{c===Iue?a.set(r,[0,void 0]):c===sO?a.set(r,[a.get(r)[0]+1,sO]):a.set(r,[a.get(r)[0]+1,c]),a.refreshSelf()})}return[s,i,r]}var wue=(e,t,r,n)=>A(Ck(typeof r=="function"?r(e):r),o=>{let i=os().context,a=Qt(),c=Un(o,{onFailure(f){return wo(f)?bt(a)?I({done:!0,items:a}):D(new ll("Atom.pull: no items")):je(f)},onSuccess(f){let p;return n?.disableAccumulation?p=f:(p=up(a,f),a=p),I({done:!1,items:p})}}),u=new Set;return e.addFinalizer(()=>{for(let f of u)f()}),e.once(t),e.subscribe(t,()=>{e.setSelf(uE(e.self()));let f;f=fO(i,c,p=>{f&&u.delete(f);let m=cR(p,e.self()),h=u.size>0;e.setSelf(h?Ph(m):m)}),f&&u.add(f)}),c}),vue=(e,t)=>nx(t.read,function(r,n){r.set(e,r.get(e)+1)}),pO=typeof WeakRef>"u"||typeof FinalizationRegistry>"u"?e=>{let t=Si();return function(r){let n=Qr(t,r);if(n._tag==="Some")return n.value;let o=e(r);return bi(t,r,o),o}}:e=>{let t=Si(),r=new FinalizationRegistry(n=>{let o=Qr(t,n);o._tag==="Some"&&o.value.deref()===void 0&&Ei(t,n)});return function(n){let o=Qr(t,n).pipe(RI(i=>i.deref()));if(o._tag==="Some")return o.value;let s=e(n);return bi(t,n,new WeakRef(s)),r.register(s,n),s}};var mO=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0});var Cue=d(e=>y6(e[0]),(e,t,r)=>{let n=If(xue(e)?nx(o=>t(o,e),function(o,s){o.set(e,s)},e.refresh??function(o){o(e)}):qi(o=>t(o,e),e.refresh??function(o){o(e)}));return r?.initialValueTarget&&(n.initialValueTarget=Aue(r.initialValueTarget)),n}),Aue=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t};var kue=NW;var Rue="~effect-atom/atom/Atom/Serializable";var hO=d(2,(e,t)=>{let r=rf(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,Ir()===0?"":new Error().stack?.split(`
|
|
37
|
+
`)[5]??""],[Rue]:{key:t.key,encode:nA(r),decode:Zm(r)}})});var I6=()=>(e,t)=>{let r=Ue()(e),n=Qn(r,t.makeEffect??oO(t.group,{...t,flatten:!0})),o=t.runtime??lO;r.runtime=o(typeof t.protocol=="function"?i=>As(n,Vg(t.protocol(i))):As(n,Vg(t.protocol))),r.mutation=pO(i=>{let a=t.group.requests.get(i);return r.runtime.fn()(me(function*({headers:c,payload:u,reactivityKeys:f}){let m=(yield*r)(i,u,{headers:c});return yield*f?zb(m,f):m})).pipe(hO({key:`AtomRpc:mutation:${i}`,schema:lR({success:a.successSchema,error:E6(a)})}))});let s=pO(i=>{let{headers:a,payload:c,reactivityKeys:u,tag:f,timeToLive:p}=i,m=t.group.requests.get(f),h=Bh(m.successSchema),x=h?r.runtime.pull(Cn(r.use(g=>I(g(f,c,{headers:a}))))):r.runtime.atom(r.use(g=>g(f,c,{headers:a})));return u&&(x=r.runtime.factory.withReactivity(u)(x)),!h&&i.serializationKey&&(x=hO(x,{key:`AtomRpc:${i.tag}:${i.serializationKey}`,schema:lR({success:m.successSchema,error:E6(m)})})),p&&(x=Wn(p)?rx(x,p):mO(x)),x});return r.query=(i,a,c)=>{let u={tag:i,payload:a,headers:c?.headers?Zo(c.headers):void 0,reactivityKeys:c?.reactivityKeys,timeToLive:c?.timeToLive!==void 0?$e(c.timeToLive):void 0,serializationKey:c?.serializationKey};return s(u)},r},E6=e=>Pe([e.errorSchema,...Array.from(e.middlewares,t=>t.error),Zs]);var $E={};ps($E,{make:()=>Pue});var _ue={add(...e){let t=new Map(this.requests);for(let r of e)t.set(r._tag,r);return Aa({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),r=new Map(this.annotations.mapUnsafe);for(let n of e){for(let[o,s]of n.requests)t.set(o,s);for(let[o,s]of n.annotations.mapUnsafe)r.set(o,s)}return Aa({requests:t,annotations:qn(r)})},omit(...e){let t=new Map(this.requests);for(let r of e)t.delete(r);return Aa({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.middleware(e));return Aa({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return xt(function*(){let r=yield*Nr(),n=Yr(e)?yield*e:e,o=new Map;return t.requests.forEach((s,i)=>{o.set(s.key,{tag:s._tag,handler:n[i],context:r})}),qn(o)})},prefix(e){let t=new Map;for(let r of this.requests.values()){let n=r.prefix(e);t.set(n._tag,n)}return Aa({requests:t,annotations:this.annotations})},toLayer(e){return Ja(this.toHandlers(e))},of:F,toLayerHandler(e,t){let r=this;return Ja(xt(function*(){let n=yield*Nr(),o=Yr(t)?yield*t:t,s=new Map,i=r.requests.get(e);return s.set(i.key,{handler:o,context:n}),qn(s)}))},accessHandler(e){return yn(t=>{let r=this.requests.get(e),{handler:n,context:o}=Gi(t,r.key);return I((s,i)=>{i.rpc=r;let a=n(s,i),c=Rd(a)?a.value:a;return Yr(c)?Q0(c,o):wk(c,o)})})},annotate(e,t){return Aa({requests:this.requests,annotations:We(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(ys(e,t))},annotateMerge(e){return Aa({requests:this.requests,annotations:Kr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[r,n]of this.requests)t.set(r,n.annotateMerge(Kr(e,n.annotations)));return Aa({requests:t,annotations:this.annotations})}},Aa=e=>Object.assign(function(){},_ue,{requests:e.requests,annotations:e.annotations}),Pue=(...e)=>Aa({requests:new Map(e.map(t=>[t._tag,t])),annotations:pt()});var Tf={};ps(Tf,{Service:()=>Mue,TypeId:()=>gO,layerClient:()=>Fue});var gO="~effect/rpc/RpcMiddleware",Mue=()=>(e,t)=>{let r=Ir(),n;r!==0&&(yt(2),n=new globalThis.Error,yt(r));function o(){}let s=o;return Object.setPrototypeOf(o,Object.getPrototypeOf(Ue(e))),o.key=e,Object.defineProperty(o,"stack",{get(){return n?.stack}}),s[gO]=gO,s.error=t?.error??Mi,s.requiredForClient=t?.requiredForClient??!1,o},Fue=(e,t)=>Ja(xt(function*(){let r=(yield*Nr()).pipe(H_(it)),n=Yr(t)?yield*t:t;return qn(new Map([[`${e.key}/Client`,o=>Xa(n(o),s=>Kr(r,s))]]))}));var T6=l.Union([l.Struct({_tag:l.Literal("List"),collection:l.String}),l.Struct({_tag:l.Literal("Item"),collection:l.String,id:l.Union([l.String,l.Number])})]),wf=(e,t)=>({item:r=>({_tag:"Item",collection:e,id:r}),list:{_tag:"List",collection:e},name:e});function w6(e){return e._tag==="List"?e.collection:`${e.collection}:${e.id}`}var jE=e=>[...new Set(e.map(w6))],HE=e=>[...new Set(e.flatMap(t=>t._tag==="List"?[t.collection]:[w6(t),t.collection]))];var Nue=ne.fn("EffectContract.invalidateAfter")(function*(e){yield*Wb(HE(e))});function Uue(e,t,r){function n(o){return jE(r.reads(o))}return{query:(o,s={})=>e.query(t,o,{...s,reactivityKeys:n(o)}),run:o=>e.use(s=>s(t,o))}}function Due(e,t,r){return{run:n=>e.use(o=>o(t,n)).pipe(ne.tap(o=>Nue(r.invalidates(n,o))))}}function Lue(e,t){return{run:r=>sn.unwrap(e.use(n=>ne.succeed(n(t,r))))}}function qE(e,t){let{name:r,queries:n,commands:o,streams:s}=e.declaration;return Object.fromEntries([...n.map(i=>[i.name,Uue(t,`${r}.${i.name}`,i)]),...o.map(i=>[i.name,Due(t,`${r}.${i.name}`,i)]),...s.map(i=>[i.name,Lue(t,`${r}.${i.name}`)])])}var v6=l.Union([l.Struct({_tag:l.Literal("Changed"),keys:l.Array(T6)}),l.Struct({_tag:l.Literal("Resync")})]),Bue=256;function C6(e,t){let r=tx(!1),n=tx({connection:"connecting",failure:ke.none(),needsResync:!0,pending:0});return{connection:e.atom(s=>ne.gen(function*(){s.mount(n);let i=yield*vc;function a(f){s.set(n,{...s.once(n),...f})}function c(){if(s.once(r)){a({needsResync:!0});return}i.invalidateUnsafe(jE(t.resyncKeys)),a({needsResync:!1,pending:0})}s.subscribe(r,f=>{f||c()}),t.resume!==void 0&&(s.once(t.resume),s.subscribe(t.resume,c));let u=ne.suspend(()=>{let f=!0;function p(m){a({connection:"live",failure:ke.none()}),s.once(r)?a({needsResync:!0,pending:Math.min(Bue,s.once(n).pending+1)}):f||m._tag==="Resync"?c():i.invalidateUnsafe(HE(m.keys)),f=!1}return t.stream.pipe(sn.runForEach(m=>ne.sync(()=>p(m))),ne.scoped,ne.catchCause(m=>ne.sync(()=>a({failure:ke.some(m)}))),ne.andThen(ne.sync(()=>a({connection:"reconnecting",needsResync:!0}))),ne.andThen(ne.sleep(t.retryDelay??"1 second")))});yield*ne.forever(u)})).pipe(rx(0)),paused:r,status:n}}function A6(e,t){return r=>{function n(){e.document.visibilityState==="visible"&&r()}return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}}function k6({window:e,native:t}){let r=e===void 0?[]:[A6(e,"visibilitychange"),A6(e,"online")],n=t===void 0?r:[...r,t];return qi(o=>{let s=0;function i(){s+=1,o.setSelf(s)}for(let a of n)o.addFinalizer(a(i));return s})}function $ue(e){let t=e.map(({name:r})=>r).filter((r,n,o)=>o.indexOf(r)!==n);if(t.length>0)throw new Error(`Operation names must be unique; duplicated: ${[...new Set(t)].join(", ")}`)}function R6(e,t){let r=e.middleware.bind(e);return Object.assign(e,{declaration:t,middleware:n=>R6(r(n),t)})}function Pc(e,t){let{queries:r=[],commands:n=[],streams:o=[]}=t;$ue([...r,...n,...o]);let s=[...r,...n,...o].map(i=>Od.make(`${e}.${i.name}`,{error:i.error,payload:i.payload,stream:i.kind==="stream",success:i.success}));return R6($E.make(...s),{commands:n,name:e,queries:r,streams:o})}function O6(e){let t=Object.entries(e).map(([r,n])=>[r,l.isSchema(n)?n:l.TaggedError()(r,n)]);return{error:t.length===0?l.Never:l.Union(t.map(([,r])=>r)),Rejection:Object.fromEntries(t),reject:Object.fromEntries(t.map(([r,n])=>[r,(...o)=>ne.fail(Reflect.construct(n,o))]))}}function jue(e){return e===void 0?l.Void:l.isSchema(e)?e:l.Struct(e)}function yO(e,t,r){let{payload:n,success:o,rejections:s={}}=r;return{kind:e,name:t,payload:jue(n),rejections:s,success:o??l.Void,...O6(s)}}function Tt(e,t){return{...yO("query",e,t),reads:t.reads}}function ox(e,t){return{...yO("command",e,t),invalidates:t.invalidates}}function _6(e,t){return{...yO("stream",e,t),reads:t.reads}}var Fc={message:l.String},M6={field:l.optionalKey(l.String),message:l.String},sx=class extends l.TaggedError()("NotFound",Fc){},ix=class extends l.TaggedError()("Unauthorized",Fc){},Mc=class extends l.TaggedError()("Forbidden",Fc){},zE=class extends l.TaggedError()("BadRequest",M6){},ax=class extends l.TaggedError()("Conflict",M6){},WE=class extends l.TaggedError()("PreconditionFailed",Fc){},P6=class extends l.TaggedError()("TooManyRequests",Fc){},Fd=class extends l.TaggedError()("AuthUnavailable",Fc){},Hn=class extends l.TaggedError()("InternalServerError",Fc){},vf=class extends l.TaggedError()("ServiceUnavailable",Fc){};var Nc=class extends Tf.Service()("@shivaedev/platform/rpc/RequestTracing"){},F6=class extends Tf.Service()("@shivaedev/platform/rpc/Authenticated",{error:l.Union([ix,Fd,Mc])}){},N6=class extends Tf.Service()("@shivaedev/platform/rpc/MaybeAuthenticated",{error:l.Union([Fd,Mc])}){},U6=class extends Tf.Service()("@shivaedev/platform/rpc/AuthenticatedUser",{error:l.Union([ix,Fd,Mc])}){};var wt=l.String.check(l.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*$/u));var Qs=l.String.check(l.isPattern(/^[a-f\d]{64}$/u)),D6=l.Literals(["answer","clarify","not_now"]),Hue=l.Struct({prompt:wt.check(l.isMaxLength(128)),selected:l.Array(wt.check(l.isMaxLength(128))).check(l.isMaxLength(32)),text:l.String.check(l.isMaxLength(8192))}),L6=l.Array(Hue).check(l.isMaxLength(32)),SO=l.Struct({deadline:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),item:wt,reason:l.String,registeredAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),request:wt,reviewedRevision:Qs,source:l.String}),KE=l.Struct({answers:l.optional(L6),author:l.String.check(l.isPattern(/\S/u),l.isMaxLength(200)),question:wt,recordedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),reviewedRevision:Qs,supersedes:l.optional(wt),type:D6}),VE=l.Struct({context:l.String,id:wt,item:wt,reason:l.String,request:wt,reviewedRevision:Qs,source:l.String}),Nd=l.Struct({context:l.String,id:wt,question:SO}),Uc=l.Struct({body:l.String,id:wt,response:KE}),B6=l.Struct({question:Nd,responses:l.Array(Uc)}),$6=l.Struct({expired:l.Boolean,question:Nd,response:l.optional(Uc)}),j6=l.Struct({answers:l.optional(L6),author:KE.fields.author,body:l.String.check(l.isMaxLength(32768)),id:wt,question:wt,supersedes:l.optional(wt),type:D6});var GE=l.Struct({disposition:l.Literals(["applied","superseded"]),question:wt,recordedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),response:l.optional(wt),reviewedRevision:Qs});var cx=l.String.check(l.isPattern(/\S/u),l.isMaxLength(8192)),ux=l.Struct({by:l.optional(cx),constraints:l.String.check(l.isMaxLength(8192)),goal:cx,item:wt,nextAction:cx,note:l.optional(cx),preparedAt:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),recipient:cx.check(l.isMaxLength(200)),reviewedRevision:Qs,source:l.String,state:l.Literals(["requested","acknowledged","rejected","unavailable"])}),bO=ux.pipe(l.encodeKeys({nextAction:"next_action",preparedAt:"prepared_at",reviewedRevision:"reviewed_revision"})),H6=l.Struct({constraints:ux.fields.constraints,goal:ux.fields.goal,id:wt,item:wt,nextAction:ux.fields.nextAction,recipient:ux.fields.recipient,revision:Qs,source:l.String}),EO=l.Struct({context:l.String,file:l.String,handoff:bO,id:wt,prompt:l.String}),JE=l.Struct({records:l.Array(EO),unknown:l.Array(l.String)}),ZE=l.Struct({context:l.String,id:wt,item:wt,reviewedRevision:Qs,source:l.String});var QE=wt,IO=l.String.check(l.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*(?:#[a-zA-Z\d][a-zA-Z\d._-]*)?$/u)),fo=l.String.check(l.isPattern(/\S/u)),que=l.Struct({id:QE,kind:l.Literals(["decision","review","blocker"]),managed:l.optional(l.Boolean),reason:fo,responseFrom:l.Array(fo).check(l.isMinLength(1)),state:l.Literals(["open","closed"]),unblocks:l.Array(IO).check(l.isMinLength(1))}).pipe(l.encodeKeys({responseFrom:"response_from"})),zue=l.Struct({id:QE,text:fo}),Wue=l.Struct({kind:l.Literals(["implements","informs","depends_on","relates_to"]),target:IO}),Kue=l.Struct({checkedRevision:l.optional(l.String.check(l.isPattern(/^(?:[a-f\d]{40}|[a-f\d]{64})$/iu))),criterion:l.optional(IO),method:l.optional(fo),observedAt:l.optional(fo.check(l.makeFilter(e=>Number.isFinite(Date.parse(e))&&/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/u.exec(e)!==null||"Expected an ISO timestamp with timezone"))),outcome:l.optional(fo),source:fo}).pipe(l.encodeKeys({checkedRevision:"checked_revision",observedAt:"observed_at"})),Dc=l.Struct({areas:l.optional(l.Array(fo)),attention:l.optional(l.Array(que)),criteria:l.optional(l.Array(zue)),evidence:l.optional(l.Array(Kue)),handoff:l.optional(bO),id:l.optional(QE),items:l.optional(l.Array(QE)),kind:l.optional(l.Literals(["task","investigation","decision","result","project","board","question","response","handoff","goal","report"])),nextAction:l.optional(fo),options:l.optional(l.Array(l.Struct({description:fo.check(l.isMaxLength(8192)),label:fo.check(l.isMaxLength(128))})).check(l.isMaxLength(32))),owner:l.optional(fo),question:l.optional(SO),recommended:l.optional(fo),relationships:l.optional(l.Array(Wue)),requestReceipt:l.optional(GE),response:l.optional(KE),status:l.optional(fo)}).pipe(l.encodeKeys({nextAction:"next_action",requestReceipt:"request_receipt"}));var Vue=l.Struct({href:l.optional(l.String),label:l.String}),q6=l.Struct({backlinks:l.Array(l.Struct({href:l.String,kind:l.String,label:l.String,status:l.optional(l.String),title:l.optional(l.String)})),board:l.Boolean,claims:l.Record(l.String,l.Array(Vue)),evidenceSources:l.Array(l.Struct({href:l.optional(l.String),problem:l.String})),lines:l.Record(l.String,l.Number),proseLine:l.Number,raw:l.optional(l.String),receipts:l.Record(l.String,GE)});var TO=l.Struct({id:l.String,open:l.Boolean,options:Dc.to.fields.options,preview:l.optional(VE),prompts:l.optional(l.Array(l.Struct({id:l.String,mode:l.Literals(["one","many","text"]),options:l.Array(l.Struct({id:l.String,source:l.String})),source:l.String}))),promptUnavailable:l.optional(l.String),recommended:Dc.to.fields.recommended,responses:l.optional(l.Array(Uc)),sourceOpen:l.optional(l.Boolean),title:l.optional(l.String),unavailable:l.optional(l.String)}),ka=l.Struct({diagnostics:l.Array(l.Struct({field:l.optional(l.String),line:l.Number,message:l.String})),file:l.String,identity:l.optional(l.String),links:l.Record(l.String,l.String),metadata:Dc,modified:l.Number,questionActions:l.Record(l.String,l.String),reading:l.optional(q6),referenceDetails:l.optional(l.Record(l.String,l.Struct({status:l.optional(l.String),title:l.String}))),references:l.Record(l.String,l.String),requests:l.Array(TO),source:l.String,unavailable:l.Array(l.String),writable:l.Boolean});var z6=l.Struct({counts:l.Struct({goals:l.Number,library:l.Number,now:l.Number,system:l.Number}),home:l.optional(l.Struct({file:l.String,identity:l.optional(l.String)})),inboxCount:l.NullOr(l.Number)});var W6={folder:l.optional(l.String),kind:l.optional(l.String),showFleet:l.optional(l.Boolean),status:l.optional(l.String)},Gue=l.Struct({href:l.String,kind:l.String,modified:l.Number,path:l.String,status:l.String,title:l.String}),K6=l.Struct({files:l.Array(Gue),fleetCount:l.Number,folders:l.Array(l.Struct({count:l.Number,name:l.String,path:l.String})),kinds:l.Array(l.String),statuses:l.Array(l.String)});var Jue=l.Literals(["prepared","executing","adopting","reviewing","repairing","validating","delivering","completed","needs-human","released"]),wO=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0)),YE=l.Struct({attentionOwner:l.optional(l.Literals(["maintainer","orchestrator","automation"])),prUrl:l.optional(l.String),stage:Jue,stageEnteredAt:l.NullOr(wO),updatedAt:l.NullOr(wO),workId:l.String}),vO=l.Struct({...YE.fields,completedAt:wO,stage:l.Literal("completed")}),V6=l.Struct({completed:l.Array(vO),items:l.Array(YE)});var G6=l.NullOr(l.Struct({file:l.String,metadata:Dc,title:l.String})),J6=l.Union([l.Struct({completed:l.Array(l.Struct({...vO.fields,document:G6})),items:l.Array(l.Struct({...YE.fields,document:G6})),state:l.Literal("ready")}),l.Struct({reason:l.String,state:l.Literal("unavailable")})]);var Zue=l.Literals(["now","board","table"]),Que=l.Literals(["title","owner","status"]),Z6=l.Struct({board:l.String,item:l.String,owner:l.String,query:l.String,sort:Que,status:l.String,view:Zue});var lx=l.Struct({file:l.String,fleetApproved:l.optional(l.Boolean),id:l.String,metadata:Dc,title:l.String,waiting:l.optional(l.String)}),Q6=l.Struct({boards:l.Array(lx),issues:l.Array(l.String),items:l.Array(lx),rows:l.Array(lx),selected:l.optional(ka),selectedOutside:l.Boolean,selectionProblem:l.optional(l.String),state:Z6,title:l.String,validBoard:l.Boolean}),fx=l.Struct({earlierAsks:l.optional(l.Number),file:l.String,href:l.String,id:l.String,modified:l.optional(l.Number),problem:l.optional(l.String),reason:l.String,responseFrom:l.optional(l.Array(l.String)),title:l.String}),Y6=l.Struct({agents:l.Array(fx),complete:l.Boolean,issues:l.Array(l.Struct({file:l.String,line:l.Number,message:l.String})),items:l.Array(fx),parked:l.Array(fx),resolved:l.Array(fx),sourceIssues:l.Boolean,you:l.Array(fx)}),X6=l.Struct({counts:l.Array(l.Struct({count:l.Number,title:l.String})),document:ka});var tK=l.Struct({done:l.Number,"in progress":l.Number,planned:l.Number}),Yue=l.Struct({counts:tK,evidence:l.Number,id:l.String,linked:l.Number,text:l.String}),eK=l.Struct({counts:tK,criteria:l.Array(Yue),id:l.String,linked:l.Number,nextAction:l.optional(l.String),openAsks:l.Number,owner:l.optional(l.String),status:l.optional(l.String),title:l.String,unlinked:l.Boolean}),rK=l.Struct({closedGoals:l.Array(eK),goals:l.Array(eK),items:l.Array(lx)});var CO=l.Struct({href:l.optional(l.String),label:l.String}),Xue=l.Struct({checkedRevision:l.optional(l.String),method:l.optional(l.String),observedAt:l.optional(l.String),outcome:l.optional(l.String),problem:l.String,source:CO}),nK=l.Struct({document:ka,feedback:l.Array(l.Struct({matching:l.Boolean,question:Nd,questionFile:l.String,response:Uc,responseFile:l.String,supersedesFile:l.optional(l.String)})),feedbackUnknown:l.Boolean,revision:l.String,targets:l.Array(l.Struct({available:l.Boolean,criteria:l.Array(l.Struct({claims:l.Array(Xue),link:CO,text:l.String})),link:CO,status:l.optional(l.String)}))});var oK=l.Struct({resetsAt:l.NullOr(l.Int.check(l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e10))),usedPercent:l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0)),windowDurationMins:l.NullOr(l.Int.check(l.isGreaterThan(0)))}),iK=l.Struct({primary:l.NullOr(oK),secondary:l.NullOr(oK)}),AO=l.Int.check(l.isGreaterThanOrEqualTo(0)),sK=l.Struct({limit:AO,remaining:AO,reset:AO.check(l.isLessThanOrEqualTo(864e10))}),aK=l.Struct({core:sK,graphql:sK});var dx=l.Int.check(l.isGreaterThanOrEqualTo(0)),kO=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13)),efe=l.Struct({at:kO,cause:l.String.check(l.isMinLength(1),l.isMaxLength(500))}),tfe="health.json",WIe=`fleet/${tfe}`,cK=l.Struct({concurrency:l.Int.check(l.isGreaterThan(0)),lastCapacityRejection:l.NullOr(efe),lastSchedulerPass:l.NullOr(kO),observedAt:kO,queued:dx,running:dx,staleAfterMs:l.Int.check(l.isGreaterThan(0)),version:l.Literal(2),waiting:l.Struct({automation:dx,maintainer:dx,orchestrator:dx})});var uK=l.Number.check(l.isFinite(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(864e13));function RO(e){return l.Union([l.Struct({observedAt:uK,state:l.Literal("ready"),value:e}),l.Struct({cause:l.String,observedAt:uK,state:l.Literals(["not-configured","error"])})])}var OO=l.Struct({codex:RO(iK),fleet:RO(cK),github:RO(aK)}),XIe=Pc("daemon",{queries:[Tt("diagnostics",{payload:{},reads:()=>[],success:OO}),Tt("fleetItems",{payload:{},reads:()=>[],success:V6})]});var fK=l.Struct({now:l.Number,sources:OO}),lK=l.Struct({empty:l.Boolean,templates:l.Array(l.Struct({file:l.String,label:l.String,source:l.String}))}),dK=l.Struct({document:ka,request:TO}),pK=l.Struct({background:l.String,goal:l.String,item:l.String,nextAction:l.String,reading:JE,source:l.optional(ZE),unavailable:l.optional(l.String),writable:l.Boolean});var Rt=wf("work-board/workspace",l.String),mK=wf("work-board/documents",l.String),hK=wf("work-board/identities",l.String),xK=wf("work-board/navigation",l.String),Dt=wf("work-board/index",l.String),gK=wf("work-board/watcher",l.String);var _O=class extends l.TaggedError()("PublicationUncertain",{message:l.String}){},PO=class extends l.TaggedError()("Unanswered",{message:l.String}){},Ys={BadRequest:zE,Conflict:ax,Forbidden:Mc,InternalServerError:Hn,NotFound:sx,PreconditionFailed:WE,PublicationUncertain:_O,ServiceUnavailable:vf,Unanswered:PO},lTe=l.Union(Object.values(Ys)),Lc={Conflict:ax,InternalServerError:Hn,NotFound:sx,ServiceUnavailable:vf},dTe=l.Union(Object.values(Lc));var rfe=Tt("handoffSource",{payload:{item:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:ZE}),nfe=Tt("handoffs",{payload:{item:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:JE}),ofe=ox("prepareHandoff",{invalidates:()=>[Rt.list,Dt.list],payload:H6,rejections:Ys,success:EO}),XE=Pc("work-board",{commands:[ofe],queries:[rfe,nfe]}).middleware(Nc);var sfe=Tt("question",{payload:{item:l.String,request:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:VE}),ife=Tt("awaitResponse",{payload:{after:l.optional(l.String),question:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:$6}),afe=Tt("responses",{payload:{question:l.String},reads:()=>[Rt.list,Dt.list],rejections:Ys,success:B6}),cfe=ox("registerQuestion",{invalidates:()=>[Rt.list,Dt.list],payload:{item:l.String,request:l.String,revision:Qs},rejections:Ys,success:Nd}),ufe=ox("recordResponse",{invalidates:()=>[Rt.list,Dt.list],payload:j6,rejections:Ys,success:Uc}),eI=Pc("work-board",{commands:[cfe,ufe],queries:[sfe,afe,ife]}).middleware(Nc);var Cf=l.String.check(l.isMaxLength(8192),l.makeFilter(e=>{if(!e.startsWith("/")||e.startsWith("//"))return"Expected a local reading URL";try{let t=new URL(e,"http://127.0.0.1").pathname;return t==="/"||["/_board/inbox","/_board/system","/_board/work","/_board/overview","/_board/changes","/_board/start","/_board/respond","/_board/handoff","/_board/result"].includes(t)||/^\/_board\/item\/[^/]+\/?$/u.exec(t)!==null||/\.md$/iu.exec(t)!==null||"Expected a local reading URL"}catch{return"Expected a local reading URL"}}));function tI(e){let t=new URL(e,"http://127.0.0.1").pathname,r=/^\/_board\/item\/(?<id>[^/]+)\/?$/u.exec(t)?.groups?.id,n=mK.item(decodeURIComponent(t.slice(1)));return r?n=hK.item(decodeURIComponent(r)):t.startsWith("/_board/")&&(n=Dt.list),[Rt.list,n]}var yK=l.Struct({directory:l.String,url:l.String});var ffe=l.Struct({file:l.String,href:l.String,id:l.optional(l.String),itemKind:l.optional(l.String),kind:l.Literals(["document","heading","passage"]),line:l.optional(l.Number),snippet:l.String,status:l.optional(l.String),text:l.String,title:l.String}),lfe=Tt("document",{payload:{url:Cf},reads:({url:e})=>[...tI(e),Dt.list],rejections:Lc,success:ka}),dfe=Tt("board",{payload:{url:Cf},reads:({url:e})=>tI(e),rejections:Lc,success:X6}),pfe=Tt("work",{payload:{url:Cf},reads:()=>[Rt.list,Dt.list],rejections:Lc,success:Q6}),mfe=Tt("inbox",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:Y6}),hfe=Tt("server",{reads:()=>[],rejections:{ServiceUnavailable:vf},success:yK}),xfe=Tt("diagnostics",{reads:()=>[Rt.list],rejections:{InternalServerError:Hn},success:fK}),gfe=Tt("fleetItems",{reads:()=>[Rt.list,Dt.list],success:J6}),yfe=Tt("goals",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:rK}),Sfe=Tt("start",{reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:lK}),bfe=Tt("respond",{payload:{url:Cf},reads:({url:e})=>[...tI(e),Dt.list],rejections:Lc,success:dK}),Efe=Tt("handoff",{payload:{url:Cf},reads:()=>[Rt.list,Dt.list],rejections:Lc,success:pK}),Ife=Tt("result",{payload:{url:Cf},reads:()=>[Rt.list,Dt.list],rejections:Lc,success:nK}),Tfe=Tt("library",{payload:W6,reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:K6}),wfe=Tt("navigation",{payload:{current:l.String.check(l.isMaxLength(8192))},reads:()=>[Rt.list,xK.list,Dt.list],rejections:{InternalServerError:Hn},success:z6}),vfe=Tt("search",{payload:{query:l.String.check(l.isMaxLength(8192))},reads:()=>[Rt.list,Dt.list],rejections:{InternalServerError:Hn},success:l.Struct({results:l.Array(ffe),total:l.Number,unavailable:l.Array(l.String)})}),Cfe=Tt("watcher",{reads:()=>[Rt.list,gK.list],rejections:{InternalServerError:Hn},success:l.Struct({watching:l.Boolean})}),MO=_6("subscribe",{reads:()=>[Rt.list],rejections:{InternalServerError:Hn},success:v6}),FO=Pc("work-board",{queries:[hfe,lfe,dfe,pfe,mfe,xfe,gfe,yfe,Sfe,bfe,Efe,Ife,wfe,Tfe,vfe,Cfe],streams:[MO]}).middleware(Nc),SK=FO.merge(eI).merge(XE);function bK(e,t={}){class r extends I6()("WorkBoard/Reader",{group:SK,protocol:ex.layerProtocolHttp({url:`${e}/_board/rpc`}).pipe(Fn.provide([iE.layer,Yh.layerNdjson]))}){}let n=qE(FO,r),o=MW({defaultIdleTTL:0,timeoutResolution:1}),s=C6(r.runtime,{resume:k6(t),resyncKeys:MO.reads(void 0),stream:n.subscribe.run(void 0)});o.mount(s.connection);async function i(f,p){try{return await ne.runPromise(Dh(o,f,{suspendOnWaiting:!0}),{signal:p})}catch(m){if(p?.aborted){let h=new Error("Reading canceled",{cause:m});throw h.name="AbortError",h}throw m}}async function a(f,p){try{return await ne.runPromise(ne.flatMap(Dh(o,r.runtime),m=>ne.provideContext(f,m)),{signal:p})}catch(m){if(p?.aborted){let h=new Error("Reading canceled",{cause:m});throw h.name="AbortError",h}throw m}}async function c(f,p){let m=await ne.runPromise(ne.result(Dh(o,r.runtime.atom(f),{suspendOnWaiting:!0})),{signal:p});if(m._tag==="Failure")throw m.failure;return m.success}let u=qE(eI,r);return{api:n,handoffs:qE(XE,r),mutate:c,read:i,registry:o,responses:u,run:a,updates:s}}var rI=new WeakMap;function EK(e){let t=rI.get(e);if(t===void 0){let o=function(){n.registry.dispose(),rI.get(e)===n&&rI.delete(e),e.removeEventListener("pagehide",o)};var r=o;t=bK(e.location.origin,{window:e}),rI.set(e,t);let n=t;e.addEventListener("pagehide",o)}return t}var g0e=EK;export{g0e as session};
|