@shivaedev/work-board 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +18 -1
  3. package/assets/agent.js +14 -14
  4. package/assets/native.js +49 -27
  5. package/dist/browser/responses/Prompt.d.ts +10 -0
  6. package/dist/browser/responses/Prompt.d.ts.map +1 -0
  7. package/dist/browser/responses/Prompt.js +2 -0
  8. package/dist/browser/responses/Prompt.js.map +1 -0
  9. package/dist/browser/responses/answerBody.d.ts +4 -0
  10. package/dist/browser/responses/answerBody.d.ts.map +1 -0
  11. package/dist/browser/responses/answerBody.js +9 -0
  12. package/dist/browser/responses/answerBody.js.map +1 -0
  13. package/dist/browser/responses/draftSession.d.ts.map +1 -1
  14. package/dist/browser/responses/draftSession.js +23 -10
  15. package/dist/browser/responses/draftSession.js.map +1 -1
  16. package/dist/browser/responses/drafts.d.ts +5 -0
  17. package/dist/browser/responses/drafts.d.ts.map +1 -1
  18. package/dist/browser/responses/drafts.js +20 -1
  19. package/dist/browser/responses/drafts.js.map +1 -1
  20. package/dist/browser/responses/preview.d.ts +2 -1
  21. package/dist/browser/responses/preview.d.ts.map +1 -1
  22. package/dist/browser/responses/preview.js +3 -2
  23. package/dist/browser/responses/preview.js.map +1 -1
  24. package/dist/browser/responses/questionnaireControls.d.ts +10 -0
  25. package/dist/browser/responses/questionnaireControls.d.ts.map +1 -0
  26. package/dist/browser/responses/questionnaireControls.js +68 -0
  27. package/dist/browser/responses/questionnaireControls.js.map +1 -0
  28. package/dist/browser/responses/schema.d.ts +41 -0
  29. package/dist/browser/responses/schema.d.ts.map +1 -1
  30. package/dist/browser/responses/schema.js +11 -1
  31. package/dist/browser/responses/schema.js.map +1 -1
  32. package/dist/browser/responses/setup.d.ts.map +1 -1
  33. package/dist/browser/responses/setup.js +34 -4
  34. package/dist/browser/responses/setup.js.map +1 -1
  35. package/dist/browser/responses/submissionFields.d.ts +15 -0
  36. package/dist/browser/responses/submissionFields.d.ts.map +1 -0
  37. package/dist/browser/responses/submissionFields.js +14 -0
  38. package/dist/browser/responses/submissionFields.js.map +1 -0
  39. package/dist/browser/responses/submit.d.ts.map +1 -1
  40. package/dist/browser/responses/submit.js +3 -9
  41. package/dist/browser/responses/submit.js.map +1 -1
  42. package/dist/metadata/backlinks.d.ts.map +1 -1
  43. package/dist/metadata/backlinks.js +3 -0
  44. package/dist/metadata/backlinks.js.map +1 -1
  45. package/dist/metadata/fields.d.ts +6 -0
  46. package/dist/metadata/fields.d.ts.map +1 -1
  47. package/dist/metadata/problems.d.ts.map +1 -1
  48. package/dist/metadata/problems.js +1 -0
  49. package/dist/metadata/problems.js.map +1 -1
  50. package/dist/metadata/schema.d.ts +6 -0
  51. package/dist/metadata/schema.d.ts.map +1 -1
  52. package/dist/page/metadataDetails.js +1 -1
  53. package/dist/page/metadataDetails.js.map +1 -1
  54. package/dist/page/style.d.ts.map +1 -1
  55. package/dist/page/style.js +1 -0
  56. package/dist/page/style.js.map +1 -1
  57. package/dist/render/markdown.d.ts +1 -0
  58. package/dist/render/markdown.d.ts.map +1 -1
  59. package/dist/render/markdown.js +4 -2
  60. package/dist/render/markdown.js.map +1 -1
  61. package/dist/render/questionnaireDocuments.d.ts +3 -0
  62. package/dist/render/questionnaireDocuments.d.ts.map +1 -0
  63. package/dist/render/questionnaireDocuments.js +11 -0
  64. package/dist/render/questionnaireDocuments.js.map +1 -0
  65. package/dist/render/visualDocuments.d.ts.map +1 -1
  66. package/dist/render/visualDocuments.js +3 -0
  67. package/dist/render/visualDocuments.js.map +1 -1
  68. package/dist/responses/agent.d.ts +12 -0
  69. package/dist/responses/agent.d.ts.map +1 -1
  70. package/dist/responses/await.d.ts +6 -0
  71. package/dist/responses/await.d.ts.map +1 -1
  72. package/dist/responses/composerHtml.d.ts +27 -0
  73. package/dist/responses/composerHtml.d.ts.map +1 -0
  74. package/dist/responses/composerHtml.js +14 -0
  75. package/dist/responses/composerHtml.js.map +1 -0
  76. package/dist/responses/history.d.ts +20 -0
  77. package/dist/responses/history.d.ts.map +1 -0
  78. package/dist/responses/history.js +16 -0
  79. package/dist/responses/history.js.map +1 -0
  80. package/dist/responses/locate.d.ts.map +1 -1
  81. package/dist/responses/locate.js +5 -0
  82. package/dist/responses/locate.js.map +1 -1
  83. package/dist/responses/make.d.ts +3 -0
  84. package/dist/responses/make.d.ts.map +1 -0
  85. package/dist/responses/make.js +16 -0
  86. package/dist/responses/make.js.map +1 -0
  87. package/dist/responses/outcome.d.ts +6 -0
  88. package/dist/responses/outcome.d.ts.map +1 -1
  89. package/dist/responses/page.d.ts +1 -1
  90. package/dist/responses/page.d.ts.map +1 -1
  91. package/dist/responses/page.js +7 -10
  92. package/dist/responses/page.js.map +1 -1
  93. package/dist/responses/read.d.ts +6 -0
  94. package/dist/responses/read.d.ts.map +1 -1
  95. package/dist/responses/records.d.ts.map +1 -1
  96. package/dist/responses/records.js +2 -0
  97. package/dist/responses/records.js.map +1 -1
  98. package/dist/responses/retry.d.ts +12 -0
  99. package/dist/responses/retry.d.ts.map +1 -1
  100. package/dist/responses/service.d.ts +37 -1
  101. package/dist/responses/service.d.ts.map +1 -1
  102. package/dist/responses/service.js +19 -14
  103. package/dist/responses/service.js.map +1 -1
  104. package/dist/responses/template.d.ts +7 -0
  105. package/dist/responses/template.d.ts.map +1 -0
  106. package/dist/responses/template.js +58 -0
  107. package/dist/responses/template.js.map +1 -0
  108. package/dist/responses/templateHtml.d.ts +7 -0
  109. package/dist/responses/templateHtml.d.ts.map +1 -0
  110. package/dist/responses/templateHtml.js +18 -0
  111. package/dist/responses/templateHtml.js.map +1 -0
  112. package/dist/responses/templateLinks.d.ts +3 -0
  113. package/dist/responses/templateLinks.d.ts.map +1 -0
  114. package/dist/responses/templateLinks.js +45 -0
  115. package/dist/responses/templateLinks.js.map +1 -0
  116. package/dist/responses/templateNodes.d.ts +17 -0
  117. package/dist/responses/templateNodes.d.ts.map +1 -0
  118. package/dist/responses/templateNodes.js +47 -0
  119. package/dist/responses/templateNodes.js.map +1 -0
  120. package/dist/responses/validateSupersedes.d.ts +5 -0
  121. package/dist/responses/validateSupersedes.d.ts.map +1 -0
  122. package/dist/responses/validateSupersedes.js +21 -0
  123. package/dist/responses/validateSupersedes.js.map +1 -0
  124. package/dist/responses/validatedInput.d.ts +3 -0
  125. package/dist/responses/validatedInput.d.ts.map +1 -0
  126. package/dist/responses/validatedInput.js +43 -0
  127. package/dist/responses/validatedInput.js.map +1 -0
  128. package/dist/responses/waitFor.d.ts +6 -0
  129. package/dist/responses/waitFor.d.ts.map +1 -1
  130. package/dist/rpc/contract.d.ts +24 -0
  131. package/dist/rpc/contract.d.ts.map +1 -1
  132. package/dist/rpc/responseContract.d.ts +48 -0
  133. package/dist/rpc/responseContract.d.ts.map +1 -1
  134. package/dist/serve-cli.js +1 -1
  135. package/package.json +2 -2
  136. package/src/browser/responses/Prompt.ts +6 -0
  137. package/src/browser/responses/answerBody.ts +11 -0
  138. package/src/browser/responses/draftSession.ts +23 -10
  139. package/src/browser/responses/drafts.ts +25 -1
  140. package/src/browser/responses/preview.ts +4 -2
  141. package/src/browser/responses/questionnaireControls.ts +74 -0
  142. package/src/browser/responses/schema.ts +12 -1
  143. package/src/browser/responses/setup.ts +34 -4
  144. package/src/browser/responses/submissionFields.ts +15 -0
  145. package/src/browser/responses/submit.ts +3 -11
  146. package/src/metadata/backlinks.ts +3 -0
  147. package/src/metadata/problems.ts +1 -0
  148. package/src/page/metadataDetails.ts +1 -1
  149. package/src/page/style.ts +1 -0
  150. package/src/render/markdown.ts +5 -2
  151. package/src/render/questionnaireDocuments.ts +12 -0
  152. package/src/render/visualDocuments.ts +3 -0
  153. package/src/responses/composerHtml.ts +28 -0
  154. package/src/responses/history.ts +18 -0
  155. package/src/responses/locate.ts +5 -0
  156. package/src/responses/make.ts +17 -0
  157. package/src/responses/page.ts +7 -18
  158. package/src/responses/records.ts +2 -0
  159. package/src/responses/service.ts +26 -15
  160. package/src/responses/template.ts +72 -0
  161. package/src/responses/templateHtml.ts +26 -0
  162. package/src/responses/templateLinks.ts +43 -0
  163. package/src/responses/templateNodes.ts +55 -0
  164. package/src/responses/validateSupersedes.ts +24 -0
  165. package/src/responses/validatedInput.ts +45 -0
  166. package/src/serve-cli.ts +1 -1
package/assets/native.js CHANGED
@@ -1,43 +1,65 @@
1
- var YH=Object.defineProperty;var ns=(e,t)=>{for(var n in t)YH(e,n,{get:t[n],enumerable:!0})};var ie=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},XH={pipe(){return ie(this,arguments)}},Bc=(function(){function e(){}return e.prototype=XH,e})();var d=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(o){return t(o,n)}};case 3:return function(n,r,o){return arguments.length>=3?t(n,r,o):function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}};var B=e=>e;var Qe=e=>()=>e,Xt=Qe(!0),jc=Qe(!1),jb=Qe(null),rs=Qe(void 0),En=rs;function lf(e,...t){return ie(e,t)}function qc(e,t,n,r,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}}function wn(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function $c(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var pd=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}return t.has("constructor")&&typeof e.constructor=="function"&&n===e.constructor.prototype&&t.delete("constructor"),t},df=new WeakSet;function io(e){return typeof e=="string"}function md(e){return typeof e=="number"}function DA(e){return typeof e=="boolean"}function NA(e){return typeof e=="bigint"}function qb(e){return typeof e=="symbol"}function yh(e){return io(e)||md(e)||qb(e)}function cn(e){return typeof e=="function"}function LA(e){return e===void 0}function Kn(e){return e!==void 0}function BA(e){return e==null}function Sh(e){return e!=null}function jA(e){return!1}function $b(e){return!0}function hd(e){return typeof e=="object"&&e!==null}function en(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gd(e){return typeof e=="object"&&e!==null||cn(e)}var j=d(2,(e,t)=>gd(e)&&t in e),yr=d(2,(e,t)=>j(e,"_tag")&&e._tag===t);function qA(e){return e instanceof Error}function Js(e){return j(e,Symbol.iterator)||io(e)}var Oe="~effect/interfaces/Hash",ce=e=>{switch(typeof e){case"number":return Nr(e);case"bigint":return it(e.toString(10));case"boolean":return it(String(e));case"symbol":return it(String(e));case"string":return it(e);case"undefined":return it("undefined");case"function":case"object":{if(e===null)return it("null");if(e instanceof Date)return Number.isNaN(e.getTime())?it("Invalid Date"):it(e.toISOString());if(e instanceof RegExp)return it(e.toString());{if(df.has(e))return bh(e);if(Hb.has(e))return Hb.get(e);let t=rW(e,()=>eW(e)?e[Oe]():typeof e=="function"?bh(e):e instanceof DataView?Fa(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?Fa(e):e instanceof Map?tW(e):e instanceof Set?nW(e):xd(e));return Hb.set(e,t),t}}default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},bh=e=>(zb.has(e)||zb.set(e,Nr(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),zb.get(e)),Nt=d(2,(e,t)=>e*53^t),Ua=e=>e&3221225471|e>>>1&1073741824,eW=e=>j(e,Oe),Nr=e=>{if(e!==e)return it("NaN");if(e===1/0)return it("Infinity");if(e===-1/0)return it("-Infinity");let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Ua(t)},it=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Ua(t)},Kb=(e,t)=>{let n=12289;for(let r of t)n^=Nt(ce(r),ce(e[r]));return Ua(n)},xd=e=>Kb(e,pd(e)),Vb=(e,t)=>n=>{let r=e;for(let o of n)r^=t(o);return Ua(r)},Fa=Vb(6151,ce),tW=Vb(it("Map"),([e,t])=>Nt(ce(e),ce(t))),nW=Vb(it("Set"),ce),zb=new WeakMap,Hb=new WeakMap,Wb=new WeakSet;function rW(e,t){if(Wb.has(e))return it("[Circular]");Wb.add(e);let n=t();return Wb.delete(e),n}var _e="~effect/interfaces/Equal";function ae(){return arguments.length===1?e=>zc(e,arguments[0]):zc(arguments[0],arguments[1])}function zc(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n!==typeof t?!1:n==="number"&&e!==e&&t!==t?!0:n!=="object"&&n!=="function"||df.has(e)||df.has(t)?!1:iW(e,t,sW)}function oW(e,t,n){let r=Jb.has(e),o=Gb.has(t);if(r&&o)return!0;if(r||o)return!1;Jb.add(e),Gb.add(t);let s=n();return Jb.delete(e),Gb.delete(t),s}var Jb=new WeakSet,Gb=new WeakSet;function sW(e,t){if(ce(e)!==ce(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=zA(e),r=zA(t);if(n!==r)return!1;let o=n&&r;return typeof e=="function"&&!o?!1:oW(e,t,()=>{if(o)return e[_e](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:aW(e,t);if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return $A(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return $A(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:uW(e,t);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:fW(e,t)}return cW(e,t)})}function iW(e,t,n){let r=Eh.get(e);if(!r)r=new WeakMap,Eh.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=Eh.get(t);return s||(s=new WeakMap,Eh.set(t,s)),s.set(e,o),o}var Eh=new WeakMap;function aW(e,t){for(let n=0;n<e.length;n++)if(!zc(e[n],t[n]))return!1;return!0}function $A(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function cW(e,t){let n=pd(e),r=pd(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!zc(e[o],t[o]))return!1;return!0}function wh(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[f,l]=s[u];if(e(i,f)&&t(a,l)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}var uW=wh(zc,zc);function Ih(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var fW=Ih(zc),zA=e=>j(e,_e),yd=()=>ae;var Zb=e=>(df.add(e),e);function vo(e,t,n){return{combine:e,initialValue:t,combineAll:n??(r=>{let o=t;for(let s of r)o=e(o,s);return o})}}var un=e=>(t,n)=>t===n||e(t,n),lW=(e,t)=>e===t,Hc=()=>lW;function HA(e){return un((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function vh(e){return un((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var Qb=e=>e.length>0;var Th=e=>d(3,(t,n,r)=>e(t,o=>({...o,[n]:r(o)}))),kh=e=>d(2,(t,n)=>e(t,r=>({[n]:r}))),Ch=(e,t)=>d(3,(n,r,o)=>t(n,s=>e(o(s),i=>({...s,[r]:i}))));function W(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Ah(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&W(e,n,t[n])}var Le={};ns(Le,{Do:()=>r3,all:()=>WW,andThen:()=>qW,as:()=>cR,asVoid:()=>BW,bind:()=>n3,bindTo:()=>e3,composeK:()=>zW,contains:()=>YW,containsWith:()=>mR,exists:()=>XW,filter:()=>za,filterMap:()=>JW,firstSomeOf:()=>NW,flatMap:()=>is,flatMapNullishOr:()=>dE,flatten:()=>eu,fromIterable:()=>_W,fromNullOr:()=>fE,fromNullishOr:()=>Xc,fromUndefinedOr:()=>uE,gen:()=>o3,getFailure:()=>PW,getOrElse:()=>qa,getOrNull:()=>Od,getOrThrow:()=>lE,getOrThrowWith:()=>_d,getOrUndefined:()=>Oo,getSuccess:()=>MW,isNone:()=>xe,isOption:()=>Ys,isSome:()=>Te,let:()=>t3,lift2:()=>ZW,liftNullishOr:()=>LW,liftPredicate:()=>QW,liftThrowable:()=>$a,makeCombinerFailFast:()=>hR,makeEquivalence:()=>pE,makeOrder:()=>GW,makeReducer:()=>s3,makeReducerFailFast:()=>i3,map:()=>Lt,match:()=>rr,none:()=>D,orElse:()=>FW,orElseResult:()=>DW,orElseSome:()=>UW,partitionMap:()=>VW,product:()=>lR,productMany:()=>HW,reduceCompact:()=>KW,some:()=>L,tap:()=>fR,toArray:()=>pR,toRefinement:()=>OW,void:()=>jW,zipLeft:()=>$W,zipRight:()=>uR,zipWith:()=>dR});function Rh(e){return{combine:e}}var Wc=Symbol.for("~effect/Redactable"),pW=e=>j(e,Wc);function To(e){return pW(e)?Xb(e):e}function Xb(e){return e[Wc](globalThis[mf]?.context??mW)}var mf="~effect/Fiber/currentFiber",KA=new Map,mW={"~effect/Context":{},base:KA,depth:0,mapUnsafe:KA,pipe(){return ie(this,arguments)}};function X(e,t){let n=t?.space??0,r=new WeakSet,o=n?typeof n=="number"?" ".repeat(n):n:"",s=u=>o.repeat(u),i=(u,f)=>{let l=u?.constructor;return l&&l!==Object.prototype.constructor&&l.name?`${l.name}(${f})`:f},a=u=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,f=0){if(typeof u=="string")return JSON.stringify(u);if(typeof u=="number"||u==null||typeof u=="boolean"||typeof u=="symbol")return String(u);if(typeof u=="bigint")return String(u)+"n";if(typeof u=="object"||typeof u=="function"){if(r.has(u))return hW;r.add(u);let l;if(Wc in u)l=c(Xb(u),f);else if(Array.isArray(u))l=!o||u.length<=1?`[${u.map(p=>c(p,f)).join(",")}]`:`[
1
+ var oW=Object.defineProperty;var rs=(e,t)=>{for(var n in t)oW(e,n,{get:t[n],enumerable:!0})};var ie=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},sW={pipe(){return ie(this,arguments)}},Bc=(function(){function e(){}return e.prototype=sW,e})();var d=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,r){return arguments.length>=2?t(n,r):function(o){return t(o,n)}};case 3:return function(n,r,o){return arguments.length>=3?t(n,r,o):function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}};var B=e=>e;var Qe=e=>()=>e,Xt=Qe(!0),qc=Qe(!1),jE=Qe(null),os=Qe(void 0),bn=os;function lf(e,...t){return ie(e,t)}function jc(e,t,n,r,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}}function wn(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function $c(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var pd=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}return t.has("constructor")&&typeof e.constructor=="function"&&n===e.constructor.prototype&&t.delete("constructor"),t},df=new WeakSet;function ao(e){return typeof e=="string"}function md(e){return typeof e=="number"}function LA(e){return typeof e=="boolean"}function BA(e){return typeof e=="bigint"}function $E(e){return typeof e=="symbol"}function yh(e){return ao(e)||md(e)||$E(e)}function cn(e){return typeof e=="function"}function qA(e){return e===void 0}function Kn(e){return e!==void 0}function jA(e){return e==null}function Sh(e){return e!=null}function $A(e){return!1}function zE(e){return!0}function hd(e){return typeof e=="object"&&e!==null}function en(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gd(e){return typeof e=="object"&&e!==null||cn(e)}var q=d(2,(e,t)=>gd(e)&&t in e),Sr=d(2,(e,t)=>q(e,"_tag")&&e._tag===t);function zA(e){return e instanceof Error}function Js(e){return q(e,Symbol.iterator)||ao(e)}var Oe="~effect/interfaces/Hash",ce=e=>{switch(typeof e){case"number":return Lr(e);case"bigint":return it(e.toString(10));case"boolean":return it(String(e));case"symbol":return it(String(e));case"string":return it(e);case"undefined":return it("undefined");case"function":case"object":{if(e===null)return it("null");if(e instanceof Date)return Number.isNaN(e.getTime())?it("Invalid Date"):it(e.toISOString());if(e instanceof RegExp)return it(e.toString());{if(df.has(e))return Eh(e);if(WE.has(e))return WE.get(e);let t=uW(e,()=>iW(e)?e[Oe]():typeof e=="function"?Eh(e):e instanceof DataView?Fa(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?Fa(e):e instanceof Map?aW(e):e instanceof Set?cW(e):xd(e));return WE.set(e,t),t}}default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Eh=e=>(HE.has(e)||HE.set(e,Lr(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),HE.get(e)),Nt=d(2,(e,t)=>e*53^t),Ua=e=>e&3221225471|e>>>1&1073741824,iW=e=>q(e,Oe),Lr=e=>{if(e!==e)return it("NaN");if(e===1/0)return it("Infinity");if(e===-1/0)return it("-Infinity");let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Ua(t)},it=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Ua(t)},KE=(e,t)=>{let n=12289;for(let r of t)n^=Nt(ce(r),ce(e[r]));return Ua(n)},xd=e=>KE(e,pd(e)),JE=(e,t)=>n=>{let r=e;for(let o of n)r^=t(o);return Ua(r)},Fa=JE(6151,ce),aW=JE(it("Map"),([e,t])=>Nt(ce(e),ce(t))),cW=JE(it("Set"),ce),HE=new WeakMap,WE=new WeakMap,VE=new WeakSet;function uW(e,t){if(VE.has(e))return it("[Circular]");VE.add(e);let n=t();return VE.delete(e),n}var _e="~effect/interfaces/Equal";function ae(){return arguments.length===1?e=>zc(e,arguments[0]):zc(arguments[0],arguments[1])}function zc(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n!==typeof t?!1:n==="number"&&e!==e&&t!==t?!0:n!=="object"&&n!=="function"||df.has(e)||df.has(t)?!1:dW(e,t,lW)}function fW(e,t,n){let r=GE.has(e),o=ZE.has(t);if(r&&o)return!0;if(r||o)return!1;GE.add(e),ZE.add(t);let s=n();return GE.delete(e),ZE.delete(t),s}var GE=new WeakSet,ZE=new WeakSet;function lW(e,t){if(ce(e)!==ce(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=WA(e),r=WA(t);if(n!==r)return!1;let o=n&&r;return typeof e=="function"&&!o?!1:fW(e,t,()=>{if(o)return e[_e](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:pW(e,t);if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return HA(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return HA(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:hW(e,t);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:gW(e,t)}return mW(e,t)})}function dW(e,t,n){let r=bh.get(e);if(!r)r=new WeakMap,bh.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=bh.get(t);return s||(s=new WeakMap,bh.set(t,s)),s.set(e,o),o}var bh=new WeakMap;function pW(e,t){for(let n=0;n<e.length;n++)if(!zc(e[n],t[n]))return!1;return!0}function HA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function mW(e,t){let n=pd(e),r=pd(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!zc(e[o],t[o]))return!1;return!0}function wh(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[f,l]=s[u];if(e(i,f)&&t(a,l)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}var hW=wh(zc,zc);function Ih(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var gW=Ih(zc),WA=e=>q(e,_e),yd=()=>ae;var QE=e=>(df.add(e),e);function To(e,t,n){return{combine:e,initialValue:t,combineAll:n??(r=>{let o=t;for(let s of r)o=e(o,s);return o})}}var un=e=>(t,n)=>t===n||e(t,n),xW=(e,t)=>e===t,Hc=()=>xW;function VA(e){return un((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function vh(e){return un((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var YE=e=>e.length>0;var Th=e=>d(3,(t,n,r)=>e(t,o=>({...o,[n]:r(o)}))),kh=e=>d(2,(t,n)=>e(t,r=>({[n]:r}))),Ch=(e,t)=>d(3,(n,r,o)=>t(n,s=>e(o(s),i=>({...s,[r]:i}))));function W(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Ah(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&W(e,n,t[n])}var Le={};rs(Le,{Do:()=>u3,all:()=>QW,andThen:()=>KW,as:()=>fR,asVoid:()=>WW,bind:()=>c3,bindTo:()=>i3,composeK:()=>GW,contains:()=>o3,containsWith:()=>gR,exists:()=>s3,filter:()=>za,filterMap:()=>e3,firstSomeOf:()=>zW,flatMap:()=>as,flatMapNullishOr:()=>pb,flatten:()=>eu,fromIterable:()=>NW,fromNullOr:()=>lb,fromNullishOr:()=>Xc,fromUndefinedOr:()=>fb,gen:()=>f3,getFailure:()=>BW,getOrElse:()=>ja,getOrNull:()=>Od,getOrThrow:()=>db,getOrThrowWith:()=>_d,getOrUndefined:()=>_o,getSuccess:()=>LW,isNone:()=>xe,isOption:()=>Ys,isSome:()=>Te,let:()=>a3,lift2:()=>n3,liftNullishOr:()=>HW,liftPredicate:()=>r3,liftThrowable:()=>$a,makeCombinerFailFast:()=>xR,makeEquivalence:()=>mb,makeOrder:()=>t3,makeReducer:()=>l3,makeReducerFailFast:()=>d3,map:()=>Lt,match:()=>or,none:()=>D,orElse:()=>qW,orElseResult:()=>$W,orElseSome:()=>jW,partitionMap:()=>XW,product:()=>pR,productMany:()=>ZW,reduceCompact:()=>YW,some:()=>L,tap:()=>dR,toArray:()=>hR,toRefinement:()=>DW,void:()=>VW,zipLeft:()=>JW,zipRight:()=>lR,zipWith:()=>mR});function Rh(e){return{combine:e}}var Wc=Symbol.for("~effect/Redactable"),SW=e=>q(e,Wc);function ko(e){return SW(e)?eb(e):e}function eb(e){return e[Wc](globalThis[mf]?.context??EW)}var mf="~effect/Fiber/currentFiber",JA=new Map,EW={"~effect/Context":{},base:JA,depth:0,mapUnsafe:JA,pipe(){return ie(this,arguments)}};function X(e,t){let n=t?.space??0,r=new WeakSet,o=n?typeof n=="number"?" ".repeat(n):n:"",s=u=>o.repeat(u),i=(u,f)=>{let l=u?.constructor;return l&&l!==Object.prototype.constructor&&l.name?`${l.name}(${f})`:f},a=u=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,f=0){if(typeof u=="string")return JSON.stringify(u);if(typeof u=="number"||u==null||typeof u=="boolean"||typeof u=="symbol")return String(u);if(typeof u=="bigint")return String(u)+"n";if(typeof u=="object"||typeof u=="function"){if(r.has(u))return bW;r.add(u);let l;if(Wc in u)l=c(eb(u),f);else if(Array.isArray(u))l=!o||u.length<=1?`[${u.map(p=>c(p,f)).join(",")}]`:`[
2
2
  ${s(f+1)}${u.map(p=>c(p,f+1)).join(`,
3
3
  `+s(f+1))}
4
- ${s(f)}]`;else if(u instanceof Date)l=eE(u);else if(!t?.ignoreToString&&j(u,"toString")&&typeof u.toString=="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let p=gW(u);l=u instanceof Error&&u.cause?`${p} (cause: ${c(u.cause,f)})`:p}else if(Symbol.iterator in u)l=`${u.constructor.name}(${c(Array.from(u),f)})`;else{let p=a(u);if(!o||p.length<=1){let m=`{${p.map(h=>`${qi(h)}:${c(u[h],f)}`).join(",")}}`;l=i(u,m)}else{let m=`{
5
- ${p.map(h=>`${s(f+1)}${qi(h)}: ${c(u[h],f+1)}`).join(`,
4
+ ${s(f)}]`;else if(u instanceof Date)l=tb(u);else if(!t?.ignoreToString&&q(u,"toString")&&typeof u.toString=="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let p=wW(u);l=u instanceof Error&&u.cause?`${p} (cause: ${c(u.cause,f)})`:p}else if(Symbol.iterator in u)l=`${u.constructor.name}(${c(Array.from(u),f)})`;else{let p=a(u);if(!o||p.length<=1){let m=`{${p.map(h=>`${$i(h)}:${c(u[h],f)}`).join(",")}}`;l=i(u,m)}else{let m=`{
5
+ ${p.map(h=>`${s(f+1)}${$i(h)}: ${c(u[h],f+1)}`).join(`,
6
6
  `)}
7
- ${s(f)}}`;l=i(u,m)}}return r.delete(u),l}return String(u)}return c(e,0)}var hW="[Circular]";function qi(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Oh(e){return e.map(t=>`[${qi(t)}]`).join("")}function eE(e){try{return e.toISOString()}catch{return"Invalid Date"}}function gW(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Kc(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,i=j(s,Wc)?To(s):To(o);if(typeof i=="bigint")return X(i);if(typeof i!="object"||i===null)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),i},t?.space)??"null"}var at=Symbol.for("nodejs.util.inspect.custom"),hn=e=>{try{return e=To(e),j(e,"toJSON")&&cn(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(hn):e}catch{return"[toJSON threw]"}},JA=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?Kc(e,{space:t}):X(e,{space:t})}catch{return String(e)}},Gs={toJSON(){return hn(this)},[at](){return this.toJSON()},toString(){return X(this.toJSON())}},_h=class{[at](){return this.toJSON()}toString(){return X(this.toJSON())}};var Na=class e{called=!1;self;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},yW=()=>{let e="~effect/Utils/internal",t={[e]:o=>o()},n={[e]:o=>o()};return t[e](()=>new Error().stack)?.includes(e)===!0?t[e]:n[e]},je=yW();var Qs="~effect/Effect",Vc="~effect/Exit",bW={_A:B,_E:B,_R:B},ZA=`${Qs}/identifier`,ye=`${Qs}/args`,nn=`${Qs}/evaluate`,Sr=`${Qs}/successCont`,ko=`${Qs}/failureCont`,La=`${Qs}/ensureCont`,Gc=Symbol.for("effect/Effect/Yield"),vn={pipe(){return ie(this,arguments)},toJSON(){return{...this}},toString(){return X(this.toJSON(),{ignoreToString:!0,space:2})},[at](){return this.toJSON()}},QA={[Oe](){return Kb(this,Object.keys(this))},[_e](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]||!ae(this[t[r]],e[t[r]]))return!1;return!0}},EW={[Qs]:bW,...vn,[Symbol.iterator](){return new Na(this)},toJSON(){return{_id:"Effect",op:this[ZA],...ye in this?{args:this[ye]}:void 0}}},ve=e=>j(e,Qs),tE=e=>j(e,Vc),Sd="~effect/Cause",bd="~effect/Cause/Reason",xf=e=>j(e,Sd),YA=e=>j(e,bd),Zs=class{[Sd];reasons;constructor(t){this[Sd]=Sd,this.reasons=t}pipe(){return ie(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${X(this.reasons)})`}[at](){return this.toJSON()}[_e](t){return xf(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,r)=>ae(n,t.reasons[r]))}[Oe](){return Fa(this.reasons)}},GA=new WeakMap,hf=class{[bd];annotations;_tag;constructor(t,n,r){if(this[bd]=bd,this._tag=t,n!==wd&&typeof r=="object"&&r!==null&&n.size>0){let o=GA.get(r);o&&(n=new Map([...o,...n])),GA.set(r,n)}this.annotations=n}annotate(t,n){if(t.mapUnsafe.size===0)return this;let r=new Map(this.annotations);t.mapUnsafe.forEach((s,i)=>{n?.overwrite!==!0&&r.has(i)||r.set(i,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=r,o}pipe(){return ie(this,arguments)}toString(){return X(this)}[at](){return this.toString()}},wd=new Map,Jc=class extends hf{error;constructor(t,n=wd){super("Fail",n,t),this.error=t}toString(){return`Fail(${X(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[_e](t){return Ba(t)&&ae(this.error,t.error)&&ae(this.annotations,t.annotations)}[Oe](){return Nt(it(this._tag))(Nt(ce(this.error))(ce(this.annotations)))}},$i=e=>new Zs(e),Ph=new Zs([]),yf=e=>new Zs([new Jc(e)]),Ed=class extends hf{defect;constructor(t,n=wd){super("Die",n,t),this.defect=t}toString(){return`Die(${X(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[_e](t){return vd(t)&&ae(this.defect,t.defect)&&ae(this.annotations,t.annotations)}[Oe](){return Nt(it(this._tag))(Nt(ce(this.defect))(ce(this.annotations)))}},nE=e=>new Zs([new Ed(e)]),Id=d(e=>xf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Zs(e.reasons.map(r=>r.annotate(t,n)))),Ba=e=>e._tag==="Fail",vd=e=>e._tag==="Die",Td=e=>e._tag==="Interrupt";function wW(e){return uo("Effect.evaluate: Not implemented")}var zi=e=>({...EW,[ZA]:e.op,[nn]:e[nn]??wW,[Sr]:e[Sr],[ko]:e[ko],[La]:e[La]}),Co=e=>{let t=zi(e);return function(){let n=Object.create(t);return n[ye]=e.single===!1?arguments:arguments[0],n}},XA=e=>{let t={[Vc]:Vc,_tag:e.op,get[e.prop](){return this[ye]},...zi(e),toString(){return`${e.op}(${X(this[ye])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ye]}},[_e](n){return tE(n)&&n._tag===this._tag&&ae(this[ye],n[ye])},[Oe](){return Nt(it(e.op),ce(this[ye]))}};return function(n){let r=Object.create(t);return r[ye]=n,r}},rt=XA({op:"Success",prop:"value",[nn](e){let t=e.getCont(Sr);return t?t[Sr](this[ye],e,this):e.yieldWith(this)}}),Fh={key:"effect/Cause/StackTrace"},rE={key:"effect/Cause/InterruptorStackTrace"},On=XA({op:"Failure",prop:"cause",[nn](e){let t=this[ye],n=!1;e.currentStackFrame&&(t=Id(t,{mapUnsafe:new Map([[Fh.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(ko);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(ko);return r?r[ko](t,e,n?void 0:this):e.yieldWith(n?On(t):this)}}),co=e=>On(yf(e)),uo=e=>On(nE(e)),pe=Co({op:"WithFiber",[nn](e){return this[ye](e)}}),IW=(function(){class e extends globalThis.Error{}let t=zi({op:"YieldableError",[nn](){return co(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),kd=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends IW{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Ah(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Hi=e=>{class t extends kd{_tag=e}return t.prototype.name=e,t},Mh="~effect/Cause/NoSuchElementError",oE=e=>j(e,Mh),os=class extends Hi("NoSuchElementError"){[Mh]=Mh;constructor(t){super({message:t})}},gf="~effect/Cause/Done",Cd=e=>j(e,gf),eR={[gf]:gf,_tag:"Done",value:void 0},Zc=e=>e===void 0?eR:{[gf]:gf,_tag:"Done",value:e},vW=co(eR),tR=e=>e===void 0?vW:co(Zc(e));var nR="~effect/data/Option",rR={[nR]:{_A:e=>e},...vn,[Symbol.iterator](){return new Na(this)}},TW=Object.defineProperty(Object.assign(Object.create(rR),{_tag:"Some",_op:"Some",[_e](e){return Uh(e)&&sE(e)&&ae(this.value,e.value)},[Oe](){return Nt(ce(this._tag))(ce(this.value))},toString(){return`some(${X(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:hn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),kW=ce("None"),CW=Object.assign(Object.create(rR),{_tag:"None",_op:"None",valueOrUndefined:void 0,[_e](e){return Uh(e)&&Dh(e)},[Oe](){return kW},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Uh=e=>j(e,nR),Dh=e=>e._tag==="None",sE=e=>e._tag==="Some",Ad=Object.create(CW),Rd=e=>{let t=Object.create(TW);return t.value=e,t};var sR="~effect/data/Result",iR={[sR]:{_A:e=>e,_E:e=>e},...vn,[Symbol.iterator](){return new Na(this)}},AW=Object.assign(Object.create(iR),{_tag:"Success",_op:"Success",[_e](e){return Nh(e)&&bf(e)&&ae(this.success,e.success)},[Oe](){return Nt(ce(this._tag))(ce(this.success))},toString(){return`success(${X(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:hn(this.success)}}}),RW=Object.assign(Object.create(iR),{_tag:"Failure",_op:"Failure",[_e](e){return Nh(e)&&Sf(e)&&ae(this.failure,e.failure)},[Oe](){return Nt(ce(this._tag))(ce(this.failure))},toString(){return`failure(${X(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:hn(this.failure)}}}),Nh=e=>j(e,sR),Sf=e=>e._tag==="Failure",bf=e=>e._tag==="Success",Lh=e=>{let t=Object.create(RW);return t.failure=e,t},Bh=e=>{let t=Object.create(AW);return t.success=e,t},iE=e=>bf(e)?Ad:Rd(e.failure),aE=e=>Sf(e)?Ad:Rd(e.success);function ss(e){return(t,n)=>t===n?0:e(t,n)}var fo=ss((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 Ro=ss((e,t)=>e<t?-1:1);var cE=d(2,(e,t)=>ss((n,r)=>e(t(n),t(r)))),Qc=cE(fo,e=>e.getTime());var Yc=e=>d(2,(t,n)=>e(t,n)===-1),Wi=e=>d(2,(t,n)=>e(t,n)===1),Ef=e=>d(2,(t,n)=>e(t,n)!==1),wf=e=>d(2,(t,n)=>e(t,n)!==-1),jh=e=>d(2,(t,n)=>t===n||e(t,n)<1?t:n);var D=()=>Ad,L=Rd,Ys=Uh,xe=Dh,Te=sE,rr=d(2,(e,{onNone:t,onSome:n})=>xe(e)?t():n(e.value)),OW=e=>t=>Te(e(t)),_W=e=>{for(let t of e)return L(t);return D()},MW=aE,PW=iE,qa=d(2,(e,t)=>xe(e)?t():e.value),FW=d(2,(e,t)=>xe(e)?t():e),UW=d(2,(e,t)=>xe(e)?L(t()):e),DW=d(2,(e,t)=>xe(e)?Lt(t(),Bh):Lt(e,Lh)),NW=e=>{let t=D();for(t of e)if(Te(t))return t;return t},Xc=e=>e==null?D():L(e),uE=e=>e===void 0?D():L(e),fE=e=>e===null?D():L(e),LW=e=>(...t)=>Xc(e(...t)),Od=qa(jb),Oo=qa(rs),$a=e=>(...t)=>{try{return L(e(...t))}catch{return D()}},_d=d(2,(e,t)=>{if(Te(e))return e.value;throw t()}),lE=_d(()=>new Error("getOrThrow called on a None")),Lt=d(2,(e,t)=>xe(e)?D():L(t(e.value))),cR=d(2,(e,t)=>Lt(e,()=>t)),BW=cR(void 0),jW=L(void 0);var is=d(2,(e,t)=>xe(e)?D():t(e.value)),qW=d(2,(e,t)=>is(e,n=>{let r=cn(t)?t(n):t;return Ys(r)?r:L(r)})),dE=d(2,(e,t)=>xe(e)?D():Xc(t(e.value))),eu=is(B),uR=d(2,(e,t)=>is(e,()=>t)),$W=d(2,(e,t)=>fR(e,()=>t)),zW=d(2,(e,t)=>n=>is(e(n),t)),fR=d(2,(e,t)=>is(e,n=>Lt(t(n),()=>n))),lR=(e,t)=>Te(e)&&Te(t)?L([e.value,t.value]):D(),HW=(e,t)=>{if(xe(e))return D();let n=[e.value];for(let r of t){if(xe(r))return D();n.push(r.value)}return L(n)},WW=e=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(xe(r))return D();n.push(r.value)}return L(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(xe(r))return D();W(t,n,r.value)}return L(t)},dR=d(3,(e,t,n)=>Lt(lR(e,t),([r,o])=>n(r,o))),KW=d(3,(e,t,n)=>{let r=t;for(let o of e)Te(o)&&(r=n(r,o.value));return r}),pR=e=>xe(e)?[]:[e.value],VW=d(2,(e,t)=>{if(xe(e))return[D(),D()];let n=t(e.value);return Sf(n)?[L(n.failure),D()]:[D(),L(n.success)]}),JW=d(2,(e,t)=>{if(xe(e))return D();let n=t(e.value);return bf(n)?L(n.success):D()}),za=d(2,(e,t)=>xe(e)?D():t(e.value)?L(e.value):D()),pE=e=>un((t,n)=>xe(t)?xe(n):xe(n)?!1:e(t.value,n.value)),GW=e=>ss((t,n)=>Te(t)?Te(n)?e(t.value,n.value):1:-1),ZW=e=>d(2,(t,n)=>dR(t,n,e)),QW=d(2,(e,t)=>t(e)?L(e):D()),mR=e=>d(2,(t,n)=>xe(t)?!1:e(t.value,n)),YW=mR(yd()),XW=d(2,(e,t)=>xe(e)?!1:t(e.value)),e3=kh(Lt),t3=Th(Lt);var n3=Ch(Lt,is),r3=L({}),o3=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();for(;!r.done;){let o=r.value;if(xe(o))return o;r=n.next(o.value)}return L(r.value)};function s3(e){return vo((t,n)=>xe(t)?n:xe(n)?t:L(e.combine(t.value,n.value)),D())}function hR(e){return Rh((t,n)=>xe(t)||xe(n)?D():L(e.combine(t.value,n.value)))}function i3(e){let t=hR(e).combine,n=L(e.initialValue);return vo(t,n,r=>{let o=n;for(let s of r)if(o=t(o,s),xe(o))return o;return o})}var Ce=Bh,Ae=Lh;var qh=e=>{if(cn(e))try{return Ce(e())}catch(t){return Ae(t)}else try{return Ce(e.try())}catch(t){return Ae(e.catch(t))}};var If=Nh,Fe=Sf,Kt=bf;var gR=(e,t)=>un((n,r)=>Fe(n)?Fe(r)&&t(n.failure,r.failure):Kt(r)&&e(n.success,r.success));var mE=d(2,(e,t)=>Fe(e)?Ae(t(e.failure)):e),tu=d(2,(e,t)=>Kt(e)?Ce(t(e.success)):e),_o=d(2,(e,{onFailure:t,onSuccess:n})=>Fe(e)?t(e.failure):n(e.success));var Md=d(2,(e,t)=>Fe(e)?t(e.failure):e.success);var $h=d(2,(e,t)=>Fe(e)?Ae(e.failure):t(e.success));var xR=HA;var a3=(e,t)=>{let n=t?.length!==void 0?Math.max(1,Math.floor(t.length)):1/0;return{[Symbol.iterator](){let r=0;return{next(){return r<n?{value:e(r++),done:!1}:{done:!0,value:void 0}}}}}};var c3=d(2,(e,t)=>u3(a3(()=>e,{length:t}))),SR=e=>c3(e,1/0);var bR=e=>{let n=e[Symbol.iterator]().next();return n.done?D():L(n.value)},ER=e=>{let n=e[Symbol.iterator]().next();if(n.done)throw new Error("headUnsafe: empty iterable");return n.value};var u3=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),n;function r(){for(;;){if(n===void 0){let s=t.next();if(s.done)return s;n=s.value[Symbol.iterator]()}let o=n.next();if(!o.done)return o;n=void 0}}return{next:r}}});var zh=d(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let o=n.next();for(;!o.done;){if(t(o.value,r++))return{done:!1,value:o.value};o=n.next()}return{done:!0,value:void 0}}}}}));var f3=d(2,(e,t)=>Object.hasOwn(e,t));var Hh=d(2,(e,t)=>{let n={...e};for(let r of wR(e))W(n,r,t(e[r],r));return n});var wR=e=>Object.keys(e);var l3=e=>d(2,(t,n)=>{for(let r of wR(t))if(!f3(n,r)||!e(t[r],n[r]))return!1;return!0});var IR=e=>{let t=l3(e);return(n,r)=>t(n,r)&&t(r,n)};var Fd=globalThis.Array;var vR=d(2,(e,t)=>{let n=Math.max(1,Math.floor(e)),r=new Fd(n);for(let o=0;o<n;o++)r[o]=t(o);return r}),hE=(e,t)=>e<=t?vR(t-e+1,n=>e+n):[e];var ht=e=>Fd.isArray(e)?e:Fd.from(e),TR=e=>Fd.isArray(e)?e:[e];var Kh=d(2,(e,t)=>[...e,t]),vf=d(2,(e,t)=>ht(e).concat(ht(t)));var kR=Fd.isArray;var Vn=Qb,Ye=Qb;function d3(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var CR=d(2,(e,t)=>{let n=Math.floor(t);if(d3(n,e))throw new Error(`Index out of bounds: ${n}`);return e[n]});var Tf=e=>e[e.length-1];var AR=d(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r});var p3=(e,t)=>{let n=ce(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(ae(o,t))return!1;return r.push(t),!0};var gE=d(2,(e,t)=>{let n=ht(e),r=ht(t);return Ye(n)?Ye(r)?Jh(vf(n,r)):n:r});var rn=()=>[],Ne=e=>[e],as=d(2,(e,t)=>e.map(t));var xE=e=>{let t=[];for(let n of e)Te(n)&&t.push(n.value);return t};var Vh=d(2,(e,t)=>{let n=ht(e),r=[];for(let o=0;o<n.length;o++)t(n[o],o)&&r.push(n[o]);return r}),yE=d(2,(e,t)=>{let n=[],r=[],o=0;for(let s of e){let i=t(s,o++);Kt(i)?r.push(i.success):n.push(i.failure)}return[n,r]});var RR=vh;var Jh=e=>{let t=ht(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)p3(n,o)&&r.push(o);return r};var m3=vo((e,t)=>e.concat(t),[]);function OR(){return m3}var _R=/^[+-]?\d+$/,SE="~effect/BigDecimal",h3={[SE]:SE,[Oe](){let e=Ud(this);return Nt(ce(e.value),Nr(e.scale))},[_e](e){return Wa(e)&&E3(this,e)},toString(){return`BigDecimal(${Xs(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},Wa=e=>j(e,SE),sr=(e,t)=>{let n=Object.create(h3);return n.value=e,n.scale=t,n},DR=(e,t)=>{if(e!==lo&&e%Gh===lo)throw new RangeError("Value must be normalized");let n=sr(e,t);return n.normalized=n,n},lo=BigInt(0),g3=BigInt(1),x3=BigInt(-1);var Gh=BigInt(10),NR=DR(lo,0);var Ud=e=>{if(e.normalized===void 0)if(e.value===lo)e.normalized=NR;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0&&t[s]==="0";s--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=DR(r,o)}return e.normalized},Ha=d(2,(e,t)=>t>e.scale?sr(e.value*Gh**BigInt(t-e.scale),t):t<e.scale?sr(e.value/Gh**BigInt(e.scale-t),t):e),LR=d(2,(e,t)=>t.value===lo?e:e.value===lo?t:e.scale>t.scale?sr(Ha(t,e.scale).value+e.value,e.scale):e.scale<t.scale?sr(Ha(e,t.scale).value+t.value,t.scale):sr(e.value+t.value,e.scale));var Ki=ss((e,t)=>{let n=fo(MR(e),MR(t));return n!==0?n:e.scale>t.scale?Ro(e.value,Ha(t,e.scale).value):e.scale<t.scale?Ro(Ha(e,t.scale).value,t.value):Ro(e.value,t.value)}),y3=Yc(Ki);var S3=Wi(Ki);var MR=e=>e.value===lo?0:e.value<lo?-1:1,b3=e=>e.value<lo?sr(-e.value,e.scale):e;var bE=un((e,t)=>e.scale>t.scale?Ha(t,e.scale).value===e.value:e.scale<t.scale?Ha(e,t.scale).value===t.value:e.value===t.value),E3=d(2,(e,t)=>bE(e,t));var BR=e=>{if(e==="")return L(NR);let t,n,r=e.search(/[eE]/);if(r!==-1){let c=e.slice(r+1);if(t=e.slice(0,r),n=Number(c),t===""||!Number.isSafeInteger(n)||!_R.test(c))return D()}else t=e,n=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),u=t.slice(i+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!_R.test(o))return D();let a=s-n;return Number.isSafeInteger(a)?L(sr(BigInt(o),a)):D()};var Xs=e=>{let t=Ud(e);if(Math.abs(t.scale)>=16)return w3(t);let n=t.value<lo,r=n?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=r.length)o="0",s="0".repeat(t.scale-r.length)+r;else{let a=r.length-t.scale;if(a>r.length){let c=a-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(a),o=r.slice(0,a)}let i=s===""?o:`${o}.${s}`;return n?`-${i}`:i},w3=e=>{if(I3(e))return"0e+0";let t=Ud(e),n=`${b3(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${jR(t)?"-":""}${r}`;o!==""&&(s+=`.${o}`);let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`};var I3=e=>e.value===lo,jR=e=>e.value<lo,v3=e=>e.value>lo,EE=e=>Wa(e[0]);var qR=d(EE,(e,t=0)=>e.scale<=t?e:sr(e.value/Gh**BigInt(e.scale-t),t)),wE=d(EE,(e,t=0)=>{let n=qR(e,t);return v3(e)&&y3(n,e)?LR(n,sr(g3,t)):n});var IE=d(EE,(e,t=0)=>{let n=qR(e,t);return jR(e)&&S3(n,e)?LR(n,sr(x3,t)):n});var Rse=globalThis.Boolean;var $R=vo((e,t)=>e||t,!1);var HR=e=>zi({op:e.label,[nn]:e.evaluate});var KR="~effect/Context/Service",Ke=function(){function e(){}let t=e;Object.setPrototypeOf(t,T3);let n=(r,o)=>(t.key=r,o?.defaultValue&&(t[TE]=TE,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&VR.add(r),t);return arguments.length>0?n(arguments[0],arguments[1]):n},T3={[KR]:KR,...HR({label:"Service",evaluate(e){return rt($e(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return cs(this,e)},use(e){return pe(t=>e($e(t.context,this)))},useSync(e){return pe(t=>rt(e($e(t.context,this))))}},VR=new Set,TE="~effect/Context/Reference",JR="~effect/Context",k3=8,C3=8,kE=(e,t,n,r)=>{let o=Object.create(R3);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},GR=(e,t)=>{t&&(GR(e,t.parent),e.set(t.key,t.value))},ZR=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return GR(t,e.overlay),e._flat=t},A3=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Mo(n)},Qh=Symbol(),CE=(e,t)=>{let n=e;for(let o=n.overlay;o;o=o.parent)if(o.key===t)return o.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Qh:(n.overlay&&++n.baseHits>=C3&&(n.base=ZR(n),n.overlay=void 0,n.depth=0),r)},Mo=e=>kE(void 0,e,void 0,0),R3={get mapUnsafe(){return ZR(this)},...vn,[JR]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[_e](e){if(!Dd(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[r,o]of t)if(!n.has(r)||!ae(o,n.get(r)))return!1;return!0},[Oe](){return Nr(this.mapUnsafe.size)}},QR=(e,t)=>e.cacheRoot===t.cacheRoot,Dd=e=>j(e,JR);var YR=e=>!!e[TE],Et=()=>O3,O3=Mo(new Map),cs=(e,t)=>Mo(new Map([[e.key,t]])),Ve=d(3,(e,t,n)=>_3(e,t.key,n)),_3=(e,t,n)=>{let r=e,o=VR.has(t)?void 0:r.cacheRoot;if(r.depth>=k3){let s=new Map(r.mapUnsafe);return s.set(t,n),kE(o,s,void 0,0)}return kE(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)};var Vi=d(2,(e,t)=>Ji(e,t.key)),Ji=(e,t)=>{let n=CE(e,t);return n===Qh?void 0:n},Jn=d(2,(e,t)=>{let n=CE(e,t.key);if(n===Qh){if(YR(t))return XR(t);throw M3(t)}return n}),$e=Jn,vE="~effect/Context/defaultValue",XR=e=>vE in e?e[vE]:e[vE]=e.defaultValue(),M3=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
7
+ ${s(f)}}`;l=i(u,m)}}return r.delete(u),l}return String(u)}return c(e,0)}var bW="[Circular]";function $i(e){return typeof e=="string"?JSON.stringify(e):String(e)}function Oh(e){return e.map(t=>`[${$i(t)}]`).join("")}function tb(e){try{return e.toISOString()}catch{return"Invalid Date"}}function wW(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Vc(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,i=q(s,Wc)?ko(s):ko(o);if(typeof i=="bigint")return X(i);if(typeof i!="object"||i===null)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),i},t?.space)??"null"}var at=Symbol.for("nodejs.util.inspect.custom"),hn=e=>{try{return e=ko(e),q(e,"toJSON")&&cn(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(hn):e}catch{return"[toJSON threw]"}},ZA=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?Vc(e,{space:t}):X(e,{space:t})}catch{return String(e)}},Gs={toJSON(){return hn(this)},[at](){return this.toJSON()},toString(){return X(this.toJSON())}},_h=class{[at](){return this.toJSON()}toString(){return X(this.toJSON())}};var Na=class e{called=!1;self;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},vW=()=>{let e="~effect/Utils/internal",t={[e]:o=>o()},n={[e]:o=>o()};return t[e](()=>new Error().stack)?.includes(e)===!0?t[e]:n[e]},qe=vW();var Qs="~effect/Effect",Kc="~effect/Exit",kW={_A:B,_E:B,_R:B},YA=`${Qs}/identifier`,ye=`${Qs}/args`,nn=`${Qs}/evaluate`,Er=`${Qs}/successCont`,Co=`${Qs}/failureCont`,La=`${Qs}/ensureCont`,Gc=Symbol.for("effect/Effect/Yield"),vn={pipe(){return ie(this,arguments)},toJSON(){return{...this}},toString(){return X(this.toJSON(),{ignoreToString:!0,space:2})},[at](){return this.toJSON()}},XA={[Oe](){return KE(this,Object.keys(this))},[_e](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]||!ae(this[t[r]],e[t[r]]))return!1;return!0}},CW={[Qs]:kW,...vn,[Symbol.iterator](){return new Na(this)},toJSON(){return{_id:"Effect",op:this[YA],...ye in this?{args:this[ye]}:void 0}}},ve=e=>q(e,Qs),nb=e=>q(e,Kc),Sd="~effect/Cause",Ed="~effect/Cause/Reason",xf=e=>q(e,Sd),eR=e=>q(e,Ed),Zs=class{[Sd];reasons;constructor(t){this[Sd]=Sd,this.reasons=t}pipe(){return ie(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${X(this.reasons)})`}[at](){return this.toJSON()}[_e](t){return xf(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,r)=>ae(n,t.reasons[r]))}[Oe](){return Fa(this.reasons)}},QA=new WeakMap,hf=class{[Ed];annotations;_tag;constructor(t,n,r){if(this[Ed]=Ed,this._tag=t,n!==wd&&typeof r=="object"&&r!==null&&n.size>0){let o=QA.get(r);o&&(n=new Map([...o,...n])),QA.set(r,n)}this.annotations=n}annotate(t,n){if(t.mapUnsafe.size===0)return this;let r=new Map(this.annotations);t.mapUnsafe.forEach((s,i)=>{n?.overwrite!==!0&&r.has(i)||r.set(i,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=r,o}pipe(){return ie(this,arguments)}toString(){return X(this)}[at](){return this.toString()}},wd=new Map,Jc=class extends hf{error;constructor(t,n=wd){super("Fail",n,t),this.error=t}toString(){return`Fail(${X(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[_e](t){return Ba(t)&&ae(this.error,t.error)&&ae(this.annotations,t.annotations)}[Oe](){return Nt(it(this._tag))(Nt(ce(this.error))(ce(this.annotations)))}},zi=e=>new Zs(e),Ph=new Zs([]),yf=e=>new Zs([new Jc(e)]),bd=class extends hf{defect;constructor(t,n=wd){super("Die",n,t),this.defect=t}toString(){return`Die(${X(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[_e](t){return vd(t)&&ae(this.defect,t.defect)&&ae(this.annotations,t.annotations)}[Oe](){return Nt(it(this._tag))(Nt(ce(this.defect))(ce(this.annotations)))}},rb=e=>new Zs([new bd(e)]),Id=d(e=>xf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Zs(e.reasons.map(r=>r.annotate(t,n)))),Ba=e=>e._tag==="Fail",vd=e=>e._tag==="Die",Td=e=>e._tag==="Interrupt";function AW(e){return fo("Effect.evaluate: Not implemented")}var Hi=e=>({...CW,[YA]:e.op,[nn]:e[nn]??AW,[Er]:e[Er],[Co]:e[Co],[La]:e[La]}),Ao=e=>{let t=Hi(e);return function(){let n=Object.create(t);return n[ye]=e.single===!1?arguments:arguments[0],n}},tR=e=>{let t={[Kc]:Kc,_tag:e.op,get[e.prop](){return this[ye]},...Hi(e),toString(){return`${e.op}(${X(this[ye])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ye]}},[_e](n){return nb(n)&&n._tag===this._tag&&ae(this[ye],n[ye])},[Oe](){return Nt(it(e.op),ce(this[ye]))}};return function(n){let r=Object.create(t);return r[ye]=n,r}},rt=tR({op:"Success",prop:"value",[nn](e){let t=e.getCont(Er);return t?t[Er](this[ye],e,this):e.yieldWith(this)}}),Fh={key:"effect/Cause/StackTrace"},ob={key:"effect/Cause/InterruptorStackTrace"},On=tR({op:"Failure",prop:"cause",[nn](e){let t=this[ye],n=!1;e.currentStackFrame&&(t=Id(t,{mapUnsafe:new Map([[Fh.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(Co);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Co);return r?r[Co](t,e,n?void 0:this):e.yieldWith(n?On(t):this)}}),uo=e=>On(yf(e)),fo=e=>On(rb(e)),pe=Ao({op:"WithFiber",[nn](e){return this[ye](e)}}),RW=(function(){class e extends globalThis.Error{}let t=Hi({op:"YieldableError",[nn](){return uo(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),kd=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends RW{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(Ah(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Wi=e=>{class t extends kd{_tag=e}return t.prototype.name=e,t},Mh="~effect/Cause/NoSuchElementError",sb=e=>q(e,Mh),ss=class extends Wi("NoSuchElementError"){[Mh]=Mh;constructor(t){super({message:t})}},gf="~effect/Cause/Done",Cd=e=>q(e,gf),nR={[gf]:gf,_tag:"Done",value:void 0},Zc=e=>e===void 0?nR:{[gf]:gf,_tag:"Done",value:e},OW=uo(nR),rR=e=>e===void 0?OW:uo(Zc(e));var oR="~effect/data/Option",sR={[oR]:{_A:e=>e},...vn,[Symbol.iterator](){return new Na(this)}},_W=Object.defineProperty(Object.assign(Object.create(sR),{_tag:"Some",_op:"Some",[_e](e){return Uh(e)&&ib(e)&&ae(this.value,e.value)},[Oe](){return Nt(ce(this._tag))(ce(this.value))},toString(){return`some(${X(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:hn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),MW=ce("None"),PW=Object.assign(Object.create(sR),{_tag:"None",_op:"None",valueOrUndefined:void 0,[_e](e){return Uh(e)&&Dh(e)},[Oe](){return MW},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Uh=e=>q(e,oR),Dh=e=>e._tag==="None",ib=e=>e._tag==="Some",Ad=Object.create(PW),Rd=e=>{let t=Object.create(_W);return t.value=e,t};var aR="~effect/data/Result",cR={[aR]:{_A:e=>e,_E:e=>e},...vn,[Symbol.iterator](){return new Na(this)}},FW=Object.assign(Object.create(cR),{_tag:"Success",_op:"Success",[_e](e){return Nh(e)&&Ef(e)&&ae(this.success,e.success)},[Oe](){return Nt(ce(this._tag))(ce(this.success))},toString(){return`success(${X(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:hn(this.success)}}}),UW=Object.assign(Object.create(cR),{_tag:"Failure",_op:"Failure",[_e](e){return Nh(e)&&Sf(e)&&ae(this.failure,e.failure)},[Oe](){return Nt(ce(this._tag))(ce(this.failure))},toString(){return`failure(${X(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:hn(this.failure)}}}),Nh=e=>q(e,aR),Sf=e=>e._tag==="Failure",Ef=e=>e._tag==="Success",Lh=e=>{let t=Object.create(UW);return t.failure=e,t},Bh=e=>{let t=Object.create(FW);return t.success=e,t},ab=e=>Ef(e)?Ad:Rd(e.failure),cb=e=>Sf(e)?Ad:Rd(e.success);function is(e){return(t,n)=>t===n?0:e(t,n)}var lo=is((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 Oo=is((e,t)=>e<t?-1:1);var ub=d(2,(e,t)=>is((n,r)=>e(t(n),t(r)))),Qc=ub(lo,e=>e.getTime());var Yc=e=>d(2,(t,n)=>e(t,n)===-1),Vi=e=>d(2,(t,n)=>e(t,n)===1),bf=e=>d(2,(t,n)=>e(t,n)!==1),wf=e=>d(2,(t,n)=>e(t,n)!==-1),qh=e=>d(2,(t,n)=>t===n||e(t,n)<1?t:n);var D=()=>Ad,L=Rd,Ys=Uh,xe=Dh,Te=ib,or=d(2,(e,{onNone:t,onSome:n})=>xe(e)?t():n(e.value)),DW=e=>t=>Te(e(t)),NW=e=>{for(let t of e)return L(t);return D()},LW=cb,BW=ab,ja=d(2,(e,t)=>xe(e)?t():e.value),qW=d(2,(e,t)=>xe(e)?t():e),jW=d(2,(e,t)=>xe(e)?L(t()):e),$W=d(2,(e,t)=>xe(e)?Lt(t(),Bh):Lt(e,Lh)),zW=e=>{let t=D();for(t of e)if(Te(t))return t;return t},Xc=e=>e==null?D():L(e),fb=e=>e===void 0?D():L(e),lb=e=>e===null?D():L(e),HW=e=>(...t)=>Xc(e(...t)),Od=ja(jE),_o=ja(os),$a=e=>(...t)=>{try{return L(e(...t))}catch{return D()}},_d=d(2,(e,t)=>{if(Te(e))return e.value;throw t()}),db=_d(()=>new Error("getOrThrow called on a None")),Lt=d(2,(e,t)=>xe(e)?D():L(t(e.value))),fR=d(2,(e,t)=>Lt(e,()=>t)),WW=fR(void 0),VW=L(void 0);var as=d(2,(e,t)=>xe(e)?D():t(e.value)),KW=d(2,(e,t)=>as(e,n=>{let r=cn(t)?t(n):t;return Ys(r)?r:L(r)})),pb=d(2,(e,t)=>xe(e)?D():Xc(t(e.value))),eu=as(B),lR=d(2,(e,t)=>as(e,()=>t)),JW=d(2,(e,t)=>dR(e,()=>t)),GW=d(2,(e,t)=>n=>as(e(n),t)),dR=d(2,(e,t)=>as(e,n=>Lt(t(n),()=>n))),pR=(e,t)=>Te(e)&&Te(t)?L([e.value,t.value]):D(),ZW=(e,t)=>{if(xe(e))return D();let n=[e.value];for(let r of t){if(xe(r))return D();n.push(r.value)}return L(n)},QW=e=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(xe(r))return D();n.push(r.value)}return L(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(xe(r))return D();W(t,n,r.value)}return L(t)},mR=d(3,(e,t,n)=>Lt(pR(e,t),([r,o])=>n(r,o))),YW=d(3,(e,t,n)=>{let r=t;for(let o of e)Te(o)&&(r=n(r,o.value));return r}),hR=e=>xe(e)?[]:[e.value],XW=d(2,(e,t)=>{if(xe(e))return[D(),D()];let n=t(e.value);return Sf(n)?[L(n.failure),D()]:[D(),L(n.success)]}),e3=d(2,(e,t)=>{if(xe(e))return D();let n=t(e.value);return Ef(n)?L(n.success):D()}),za=d(2,(e,t)=>xe(e)?D():t(e.value)?L(e.value):D()),mb=e=>un((t,n)=>xe(t)?xe(n):xe(n)?!1:e(t.value,n.value)),t3=e=>is((t,n)=>Te(t)?Te(n)?e(t.value,n.value):1:-1),n3=e=>d(2,(t,n)=>mR(t,n,e)),r3=d(2,(e,t)=>t(e)?L(e):D()),gR=e=>d(2,(t,n)=>xe(t)?!1:e(t.value,n)),o3=gR(yd()),s3=d(2,(e,t)=>xe(e)?!1:t(e.value)),i3=kh(Lt),a3=Th(Lt);var c3=Ch(Lt,as),u3=L({}),f3=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();for(;!r.done;){let o=r.value;if(xe(o))return o;r=n.next(o.value)}return L(r.value)};function l3(e){return To((t,n)=>xe(t)?n:xe(n)?t:L(e.combine(t.value,n.value)),D())}function xR(e){return Rh((t,n)=>xe(t)||xe(n)?D():L(e.combine(t.value,n.value)))}function d3(e){let t=xR(e).combine,n=L(e.initialValue);return To(t,n,r=>{let o=n;for(let s of r)if(o=t(o,s),xe(o))return o;return o})}var Ce=Bh,Ae=Lh;var jh=e=>{if(cn(e))try{return Ce(e())}catch(t){return Ae(t)}else try{return Ce(e.try())}catch(t){return Ae(e.catch(t))}};var If=Nh,Fe=Sf,Vt=Ef;var yR=(e,t)=>un((n,r)=>Fe(n)?Fe(r)&&t(n.failure,r.failure):Vt(r)&&e(n.success,r.success));var hb=d(2,(e,t)=>Fe(e)?Ae(t(e.failure)):e),tu=d(2,(e,t)=>Vt(e)?Ce(t(e.success)):e),Mo=d(2,(e,{onFailure:t,onSuccess:n})=>Fe(e)?t(e.failure):n(e.success));var Md=d(2,(e,t)=>Fe(e)?t(e.failure):e.success);var $h=d(2,(e,t)=>Fe(e)?Ae(e.failure):t(e.success));var SR=VA;var p3=(e,t)=>{let n=t?.length!==void 0?Math.max(1,Math.floor(t.length)):1/0;return{[Symbol.iterator](){let r=0;return{next(){return r<n?{value:e(r++),done:!1}:{done:!0,value:void 0}}}}}};var m3=d(2,(e,t)=>h3(p3(()=>e,{length:t}))),bR=e=>m3(e,1/0);var wR=e=>{let n=e[Symbol.iterator]().next();return n.done?D():L(n.value)},IR=e=>{let n=e[Symbol.iterator]().next();if(n.done)throw new Error("headUnsafe: empty iterable");return n.value};var h3=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),n;function r(){for(;;){if(n===void 0){let s=t.next();if(s.done)return s;n=s.value[Symbol.iterator]()}let o=n.next();if(!o.done)return o;n=void 0}}return{next:r}}});var zh=d(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let o=n.next();for(;!o.done;){if(t(o.value,r++))return{done:!1,value:o.value};o=n.next()}return{done:!0,value:void 0}}}}}));var g3=d(2,(e,t)=>Object.hasOwn(e,t));var Hh=d(2,(e,t)=>{let n={...e};for(let r of vR(e))W(n,r,t(e[r],r));return n});var vR=e=>Object.keys(e);var x3=e=>d(2,(t,n)=>{for(let r of vR(t))if(!g3(n,r)||!e(t[r],n[r]))return!1;return!0});var TR=e=>{let t=x3(e);return(n,r)=>t(n,r)&&t(r,n)};var Fd=globalThis.Array;var kR=d(2,(e,t)=>{let n=Math.max(1,Math.floor(e)),r=new Fd(n);for(let o=0;o<n;o++)r[o]=t(o);return r}),gb=(e,t)=>e<=t?kR(t-e+1,n=>e+n):[e];var ht=e=>Fd.isArray(e)?e:Fd.from(e),CR=e=>Fd.isArray(e)?e:[e];var Vh=d(2,(e,t)=>[...e,t]),vf=d(2,(e,t)=>ht(e).concat(ht(t)));var AR=Fd.isArray;var Jn=YE,Ye=YE;function y3(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var RR=d(2,(e,t)=>{let n=Math.floor(t);if(y3(n,e))throw new Error(`Index out of bounds: ${n}`);return e[n]});var Tf=e=>e[e.length-1];var OR=d(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r});var S3=(e,t)=>{let n=ce(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(ae(o,t))return!1;return r.push(t),!0};var xb=d(2,(e,t)=>{let n=ht(e),r=ht(t);return Ye(n)?Ye(r)?Jh(vf(n,r)):n:r});var rn=()=>[],Ne=e=>[e],cs=d(2,(e,t)=>e.map(t));var yb=e=>{let t=[];for(let n of e)Te(n)&&t.push(n.value);return t};var Kh=d(2,(e,t)=>{let n=ht(e),r=[];for(let o=0;o<n.length;o++)t(n[o],o)&&r.push(n[o]);return r}),Sb=d(2,(e,t)=>{let n=[],r=[],o=0;for(let s of e){let i=t(s,o++);Vt(i)?r.push(i.success):n.push(i.failure)}return[n,r]});var _R=vh;var Jh=e=>{let t=ht(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)S3(n,o)&&r.push(o);return r};var E3=To((e,t)=>e.concat(t),[]);function MR(){return E3}var PR=/^[+-]?\d+$/,Eb="~effect/BigDecimal",b3={[Eb]:Eb,[Oe](){let e=Ud(this);return Nt(ce(e.value),Lr(e.scale))},[_e](e){return Wa(e)&&C3(this,e)},toString(){return`BigDecimal(${Xs(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},Wa=e=>q(e,Eb),ir=(e,t)=>{let n=Object.create(b3);return n.value=e,n.scale=t,n},LR=(e,t)=>{if(e!==po&&e%Gh===po)throw new RangeError("Value must be normalized");let n=ir(e,t);return n.normalized=n,n},po=BigInt(0),w3=BigInt(1),I3=BigInt(-1);var Gh=BigInt(10),BR=LR(po,0);var Ud=e=>{if(e.normalized===void 0)if(e.value===po)e.normalized=BR;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0&&t[s]==="0";s--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=LR(r,o)}return e.normalized},Ha=d(2,(e,t)=>t>e.scale?ir(e.value*Gh**BigInt(t-e.scale),t):t<e.scale?ir(e.value/Gh**BigInt(e.scale-t),t):e),qR=d(2,(e,t)=>t.value===po?e:e.value===po?t:e.scale>t.scale?ir(Ha(t,e.scale).value+e.value,e.scale):e.scale<t.scale?ir(Ha(e,t.scale).value+t.value,t.scale):ir(e.value+t.value,e.scale));var Ki=is((e,t)=>{let n=lo(FR(e),FR(t));return n!==0?n:e.scale>t.scale?Oo(e.value,Ha(t,e.scale).value):e.scale<t.scale?Oo(Ha(e,t.scale).value,t.value):Oo(e.value,t.value)}),v3=Yc(Ki);var T3=Vi(Ki);var FR=e=>e.value===po?0:e.value<po?-1:1,k3=e=>e.value<po?ir(-e.value,e.scale):e;var bb=un((e,t)=>e.scale>t.scale?Ha(t,e.scale).value===e.value:e.scale<t.scale?Ha(e,t.scale).value===t.value:e.value===t.value),C3=d(2,(e,t)=>bb(e,t));var jR=e=>{if(e==="")return L(BR);let t,n,r=e.search(/[eE]/);if(r!==-1){let c=e.slice(r+1);if(t=e.slice(0,r),n=Number(c),t===""||!Number.isSafeInteger(n)||!PR.test(c))return D()}else t=e,n=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),u=t.slice(i+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!PR.test(o))return D();let a=s-n;return Number.isSafeInteger(a)?L(ir(BigInt(o),a)):D()};var Xs=e=>{let t=Ud(e);if(Math.abs(t.scale)>=16)return A3(t);let n=t.value<po,r=n?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=r.length)o="0",s="0".repeat(t.scale-r.length)+r;else{let a=r.length-t.scale;if(a>r.length){let c=a-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(a),o=r.slice(0,a)}let i=s===""?o:`${o}.${s}`;return n?`-${i}`:i},A3=e=>{if(R3(e))return"0e+0";let t=Ud(e),n=`${k3(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${$R(t)?"-":""}${r}`;o!==""&&(s+=`.${o}`);let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`};var R3=e=>e.value===po,$R=e=>e.value<po,O3=e=>e.value>po,wb=e=>Wa(e[0]);var zR=d(wb,(e,t=0)=>e.scale<=t?e:ir(e.value/Gh**BigInt(e.scale-t),t)),Ib=d(wb,(e,t=0)=>{let n=zR(e,t);return O3(e)&&v3(n,e)?qR(n,ir(w3,t)):n});var vb=d(wb,(e,t=0)=>{let n=zR(e,t);return $R(e)&&T3(n,e)?qR(n,ir(I3,t)):n});var Nse=globalThis.Boolean;var HR=To((e,t)=>e||t,!1);var VR=e=>Hi({op:e.label,[nn]:e.evaluate});var JR="~effect/Context/Service",Ve=function(){function e(){}let t=e;Object.setPrototypeOf(t,_3);let n=(r,o)=>(t.key=r,o?.defaultValue&&(t[kb]=kb,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&GR.add(r),t);return arguments.length>0?n(arguments[0],arguments[1]):n},_3={[JR]:JR,...VR({label:"Service",evaluate(e){return rt($e(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return us(this,e)},use(e){return pe(t=>e($e(t.context,this)))},useSync(e){return pe(t=>rt(e($e(t.context,this))))}},GR=new Set,kb="~effect/Context/Reference",ZR="~effect/Context",M3=8,P3=8,Cb=(e,t,n,r)=>{let o=Object.create(U3);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},QR=(e,t)=>{t&&(QR(e,t.parent),e.set(t.key,t.value))},YR=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return QR(t,e.overlay),e._flat=t},F3=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Po(n)},Qh=Symbol(),Ab=(e,t)=>{let n=e;for(let o=n.overlay;o;o=o.parent)if(o.key===t)return o.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Qh:(n.overlay&&++n.baseHits>=P3&&(n.base=YR(n),n.overlay=void 0,n.depth=0),r)},Po=e=>Cb(void 0,e,void 0,0),U3={get mapUnsafe(){return YR(this)},...vn,[ZR]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[_e](e){if(!Dd(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[r,o]of t)if(!n.has(r)||!ae(o,n.get(r)))return!1;return!0},[Oe](){return Lr(this.mapUnsafe.size)}},XR=(e,t)=>e.cacheRoot===t.cacheRoot,Dd=e=>q(e,ZR);var eO=e=>!!e[kb],bt=()=>D3,D3=Po(new Map),us=(e,t)=>Po(new Map([[e.key,t]])),Ke=d(3,(e,t,n)=>N3(e,t.key,n)),N3=(e,t,n)=>{let r=e,o=GR.has(t)?void 0:r.cacheRoot;if(r.depth>=M3){let s=new Map(r.mapUnsafe);return s.set(t,n),Cb(o,s,void 0,0)}return Cb(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)};var Ji=d(2,(e,t)=>Gi(e,t.key)),Gi=(e,t)=>{let n=Ab(e,t);return n===Qh?void 0:n},Gn=d(2,(e,t)=>{let n=Ab(e,t.key);if(n===Qh){if(eO(t))return tO(t);throw L3(t)}return n}),$e=Gn,Tb="~effect/Context/defaultValue",tO=e=>Tb in e?e[Tb]:e[Tb]=e.defaultValue(),L3=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
8
8
  `);n.splice(1,3),t.stack=n.join(`
9
- `)}return t},AE=d(2,(e,t)=>{let n=CE(e,t.key);return n!==Qh?L(n):YR(t)?L(XR(t)):D()}),br=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:A3(e,n=>t.mapUnsafe.forEach((r,o)=>n.set(o,r)))),eO=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((r,o)=>{t.set(o,r)});return Mo(t)};var Me=Ke;var Yh="~effect/time/Duration",OE=BigInt(0),oO=BigInt(1),P3=BigInt(2),F3=BigInt(10);var U3=BigInt(1e3);var Xh=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),sO=e=>Xh(e*1e6),tO=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=F3**BigInt(o.length),i=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,a=i/s+(i%s*P3>=s?oO:OE);return r?-a:a};var D3=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,gt=e=>{switch(typeof e){case"number":return us(e);case"bigint":return Lr(e);case"string":{if(e==="Infinity")return po;if(e==="-Infinity")return Zi;let t=D3.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return Lr(tO(r,oO));if(o==="micro"||o==="micros")return Lr(tO(r,U3));let s=Number(r);switch(o){case"milli":case"millis":return us(s);case"second":case"seconds":return _E(s);case"minute":case"minutes":return j3(s);case"hour":case"hours":return q3(s);case"day":case"days":return $3(s);case"week":case"weeks":return z3(s)}break}case"object":{if(e===null)break;if(Yh in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(md)?nO(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Gi:e[0]===-1/0||e[1]===-1/0?Zi:e[0]===1/0||e[1]===1/0?po:Er(Xh(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Er(n):Er(Xh(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return nO(e)},nO=e=>{throw new Error(`Invalid Input: ${e}`)},iO=$a(gt),rO={_tag:"Millis",millis:0},N3={_tag:"Infinity"},L3={_tag:"NegativeInfinity"},B3={[Yh]:Yh,[Oe](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?ce(Xh(e)):Nr(this.value.millis)}case"Nanos":return ce(this.value.nanos);default:return xd(this.value)}},[_e](e){return nu(e)&&K3(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},Er=e=>{let t=Object.create(B3);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=rO:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:sO(e)}:t.value=e>0?N3:L3:e===OE?t.value=rO:t.value={_tag:"Nanos",nanos:e},t},nu=e=>j(e,Yh),fs=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",Nd=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===OE;case"Infinity":case"NegativeInfinity":return!1}};var Gi=Er(0),po=Er(1/0),Zi=Er(-1/0),Lr=e=>Er(e);var us=e=>Er(e),_E=e=>Er(e*1e3),j3=e=>Er(e*6e4),q3=e=>Er(e*36e5),$3=e=>Er(e*864e5),z3=e=>Er(e*6048e5),Tn=e=>H3(gt(e),{onMillis:B,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var RE=e=>{let t=gt(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 sO(t.value.millis)}},aO=$a(RE);var H3=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)()}}),ME=d(3,(e,t,n)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?n.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(RE(e),t.value.nanos):n.onNanos(e.value.nanos,RE(t))),W3=ss((e,t)=>ME(e,t,{onMillis:(n,r)=>n<r?-1:n>r?1:0,onNanos:(n,r)=>n<r?-1:n>r?1:0,onInfinity:(n,r)=>n.value._tag===r.value._tag?0:n.value._tag==="Infinity"?1:n.value._tag==="NegativeInfinity"||r.value._tag==="Infinity"?-1:1}));var PE=(e,t)=>ME(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag}),cO=jh(W3);var uO=d(2,(e,t)=>ME(e,t,{onMillis:(n,r)=>Er(n-r),onNanos:(n,r)=>Er(n-r),onInfinity:(n,r)=>{let o=n.value._tag,s=r.value._tag;return o==="Infinity"?s==="Infinity"?Gi:po:o==="NegativeInfinity"?s==="NegativeInfinity"?Gi:Zi:s==="Infinity"?Zi:po}}));var K3=d(2,(e,t)=>PE(e,t));var Ka=Me("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new ei}),fO="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},V3=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},FE=class{buckets=[];scheduleTask(t,n){let r=this.buckets,o=r.length,s,i=0;for(;i<o&&!(r[i][0]>n);i++)s=r[i];s&&s[0]===n?s[1].push(t):i===o?r.push([n,[t]]):r.splice(i,0,[n,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},ei=class{executionMode;setImmediate;constructor(t="async",n){this.executionMode=t,this.setImmediate=n??(t==="sync"?V3:fO)}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new UE(this.setImmediate)}},UE=class{tasks=new FE;running=void 0;setImmediate;constructor(t=fO){this.setImmediate=t}scheduleTask(t,n){this.tasks.scheduleTask(t,n),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 n=0;n<t.length;n++){let r=t[n][1];for(let o=0;o<r.length;o++)r[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},lO=Me("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),dO=Me("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var pO=class extends Bc{constructor(e){super(),e&&Ah(this,e)}};var mO=kd,Mn=Hi;var hO="~effect/encoding/EncodingError",Yi=class extends Mn("EncodingError"){[hO]=hO};var ng=e=>DE(typeof e=="string"?jE.encode(e):e),Cf=e=>{let t=TO(e),n=t.length;if(n%4!==0)return Ae(new Yi({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf("=");if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!=="="))return Ae(new Yi({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(n/4)-o);for(let i=0,a=0;i<n;i+=4,a+=3){let c=tg(t.charCodeAt(i))<<18|tg(t.charCodeAt(i+1))<<12|tg(t.charCodeAt(i+2))<<6|tg(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return Ce(s)}catch(o){return Ae(new Yi({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},bO=e=>tu(Cf(e),t=>qE.decode(t)),EO=e=>xO(typeof e=="string"?jE.encode(e):e),NE=e=>{let t=TO(e),n=t.length;if(n%4===1)return Ae(new Yi({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${n}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return Ae(new Yi({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let r=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return r=r.replace(/-/g,"+").replace(/_/g,"/"),Cf(r)},wO=e=>tu(NE(e),t=>qE.decode(t)),IO=e=>yO(typeof e=="string"?jE.encode(e):e),LE=e=>{let t="";for(let n=e>>>3;n>0;n--){let r=Math.random()*4294967296>>>0;t+=kf[r>>>24]+kf[r>>>16&255]+kf[r>>>8&255]+kf[r&255]}return t},BE=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Ae(new Yi({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let n=t.length/2,r=new Uint8Array(n);for(let o=0;o<n;o++){let s=SO(t[o*2]),i=SO(t[o*2+1]);r[o]=s<<4|i}return Ce(r)}catch(n){return Ae(new Yi({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},vO=e=>tu(BE(e),t=>qE.decode(t)),jE=new TextEncoder,qE=new TextDecoder,TO=e=>e.replace(/[\n\r]/g,""),DE=e=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=Qi[e[r-2]>>2],n+=Qi[(e[r-2]&3)<<4|e[r-1]>>4],n+=Qi[(e[r-1]&15)<<2|e[r]>>6],n+=Qi[e[r]&63];return r===t+1&&(n+=Qi[e[r-2]>>2],n+=Qi[(e[r-2]&3)<<4],n+="=="),r===t&&(n+=Qi[e[r-2]>>2],n+=Qi[(e[r-2]&3)<<4|e[r-1]>>4],n+=Qi[(e[r-1]&15)<<2],n+="="),n};function tg(e){if(e>=gO.length)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=gO[e];if(t===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var Qi=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],gO=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],xO=e=>DE(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),kf=[];for(let e=0;e<256;e++)kf.push(e.toString(16).padStart(2,"0"));var yO=e=>{let t="";for(let n=0;n<e.length;n++)t+=kf[e[n]];return t},SO=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 zE="effect/Tracer/ParentSpan",ti=class extends Ke()(zE,{fiberCached:!0}){},J3=e=>e;var Af=Me("effect/Tracer/DisablePropagation",{defaultValue:jc}),kO=Me("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),CO=Me("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),HE="effect/Tracer",og=Me(HE,{fiberCached:!0,defaultValue:()=>J3({span:e=>new $E(e)})}),$E=class{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];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},this.attributes=new Map,this.traceId=Oo(t.parent)?.traceId??LE(32),this.spanId=LE(16)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}};var AO="effect/observability/Metric/FiberRuntimeMetricsKey";var RO=Me("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Rf=Me("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:rs}),ig=Me("effect/References/TracerEnabled",{defaultValue:Xt}),ru=Me("effect/References/TracerTimingEnabled",{defaultValue:Xt}),Ld=Me("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Bd=Me("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Xi=Me("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),WE=Me("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),KE=Me("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),OO=Me("effect/References/UnhandledLogLevel",{defaultValue:()=>"Error"}),ag=Me("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var Q3=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},Y3=Q3(),ni=()=>Error.stackTraceLimit,ir=e=>{Y3&&(Error.stackTraceLimit=e)};var Po=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=ni();ir(3);let n=new Error;return ir(t),{...e,captureStackTrace:X3(()=>n.stack)}},VE=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let o=r.split(`
10
- `);if(o[e]!==void 0)return n=o[e].trim(),n}},X3=VE(3);var cg=class extends hf{fiberId;constructor(t,n=wd){super("Interrupt",n,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[_e](t){return Td(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[Oe](){return Nt(it(`${this._tag}:${this.fiberId}`))(bh(this.annotations))}},NO=e=>new cg(e),Za=e=>new Zs([new cg(e)]),LO=e=>e.reasons.some(Ba),BO=e=>{let t=e.reasons.find(Ba);return t?Ce(t):Ae(e)},ri=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return Ce(n.error)}return Ae(e)};var jO=e=>e.reasons.some(vd);var c0=e=>{let t=e.reasons.find(vd);return t?Ce(t.defect):Ae(e)},u0=e=>e.reasons.some(Td);var f0=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag==="Interrupt"&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Ce(t):Ae(e)},qO=e=>{let t=f0(e);return Fe(t)?t4:t.success},t4=new Set,$O=e=>e.reasons.length>0&&e.reasons.every(Td);var l0=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Zs(gE(e.reasons,t.reasons));return ae(e,n)?e:n}),zO=d(2,(e,t)=>{let n=!1,r=e.reasons.map(o=>Ba(o)?(n=!0,new Jc(t(o.error),o.annotations)):o);return n?$i(r):e}),n4=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},hg=e=>{let t=n4(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},HO=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let o=ni();ir(1);for(let s of e.reasons){if(s._tag==="Interrupt"){r.push(s);continue}n.push(GE(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(n.length===0){let s=new Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=i4(s,r);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,n.push(GE(i,r[0].annotations,t))}return ir(o),n},GE=(e,t,n)=>{let r=typeof e,o;if(e&&r==="object"){if(o=new globalThis.Error(r4(e),{cause:e.cause?GE(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=s4(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?WO(s,t):s}n?.includeCauseInStack&&(o.stack=VO(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else o=new globalThis.Error(e?r==="string"?e:Kc(e):`Unknown error: ${e}`);return o},r4=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 Kc(e)},o4=/\((.*)\)/g,s4=(e,t,n)=>{let r=`${t.name}: ${t.message}`,o=(e.startsWith(r)?e.slice(r.length):e).split(`
11
- `),s=[r];for(let i=1;i<o.length&&!/(?:Generator\.next|~effect\/Effect)/.test(o[i]);i++)s.push(o[i]);return n?WO(s.join(`
9
+ `)}return t},Rb=d(2,(e,t)=>{let n=Ab(e,t.key);return n!==Qh?L(n):eO(t)?L(tO(t)):D()}),br=d(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:F3(e,n=>t.mapUnsafe.forEach((r,o)=>n.set(o,r)))),nO=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((r,o)=>{t.set(o,r)});return Po(t)};var Me=Ve;var Yh="~effect/time/Duration",_b=BigInt(0),iO=BigInt(1),B3=BigInt(2),q3=BigInt(10);var j3=BigInt(1e3);var Xh=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),aO=e=>Xh(e*1e6),rO=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=q3**BigInt(o.length),i=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,a=i/s+(i%s*B3>=s?iO:_b);return r?-a:a};var $3=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,gt=e=>{switch(typeof e){case"number":return fs(e);case"bigint":return Br(e);case"string":{if(e==="Infinity")return mo;if(e==="-Infinity")return Qi;let t=$3.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return Br(rO(r,iO));if(o==="micro"||o==="micros")return Br(rO(r,j3));let s=Number(r);switch(o){case"milli":case"millis":return fs(s);case"second":case"seconds":return Mb(s);case"minute":case"minutes":return V3(s);case"hour":case"hours":return K3(s);case"day":case"days":return J3(s);case"week":case"weeks":return G3(s)}break}case"object":{if(e===null)break;if(Yh in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(md)?oO(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Zi:e[0]===-1/0||e[1]===-1/0?Qi:e[0]===1/0||e[1]===1/0?mo:wr(Xh(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?wr(n):wr(Xh(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return oO(e)},oO=e=>{throw new Error(`Invalid Input: ${e}`)},cO=$a(gt),sO={_tag:"Millis",millis:0},z3={_tag:"Infinity"},H3={_tag:"NegativeInfinity"},W3={[Yh]:Yh,[Oe](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?ce(Xh(e)):Lr(this.value.millis)}case"Nanos":return ce(this.value.nanos);default:return xd(this.value)}},[_e](e){return nu(e)&&Y3(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},wr=e=>{let t=Object.create(W3);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=sO:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:aO(e)}:t.value=e>0?z3:H3:e===_b?t.value=sO:t.value={_tag:"Nanos",nanos:e},t},nu=e=>q(e,Yh),ls=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",Nd=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===_b;case"Infinity":case"NegativeInfinity":return!1}};var Zi=wr(0),mo=wr(1/0),Qi=wr(-1/0),Br=e=>wr(e);var fs=e=>wr(e),Mb=e=>wr(e*1e3),V3=e=>wr(e*6e4),K3=e=>wr(e*36e5),J3=e=>wr(e*864e5),G3=e=>wr(e*6048e5),Tn=e=>Z3(gt(e),{onMillis:B,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Ob=e=>{let t=gt(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 aO(t.value.millis)}},uO=$a(Ob);var Z3=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)()}}),Pb=d(3,(e,t,n)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?n.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Ob(e),t.value.nanos):n.onNanos(e.value.nanos,Ob(t))),Q3=is((e,t)=>Pb(e,t,{onMillis:(n,r)=>n<r?-1:n>r?1:0,onNanos:(n,r)=>n<r?-1:n>r?1:0,onInfinity:(n,r)=>n.value._tag===r.value._tag?0:n.value._tag==="Infinity"?1:n.value._tag==="NegativeInfinity"||r.value._tag==="Infinity"?-1:1}));var Fb=(e,t)=>Pb(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag}),fO=qh(Q3);var lO=d(2,(e,t)=>Pb(e,t,{onMillis:(n,r)=>wr(n-r),onNanos:(n,r)=>wr(n-r),onInfinity:(n,r)=>{let o=n.value._tag,s=r.value._tag;return o==="Infinity"?s==="Infinity"?Zi:mo:o==="NegativeInfinity"?s==="NegativeInfinity"?Zi:Qi:s==="Infinity"?Qi:mo}}));var Y3=d(2,(e,t)=>Fb(e,t));var Va=Me("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new ei}),dO="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},X3=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Ub=class{buckets=[];scheduleTask(t,n){let r=this.buckets,o=r.length,s,i=0;for(;i<o&&!(r[i][0]>n);i++)s=r[i];s&&s[0]===n?s[1].push(t):i===o?r.push([n,[t]]):r.splice(i,0,[n,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},ei=class{executionMode;setImmediate;constructor(t="async",n){this.executionMode=t,this.setImmediate=n??(t==="sync"?X3:dO)}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new Db(this.setImmediate)}},Db=class{tasks=new Ub;running=void 0;setImmediate;constructor(t=dO){this.setImmediate=t}scheduleTask(t,n){this.tasks.scheduleTask(t,n),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 n=0;n<t.length;n++){let r=t[n][1];for(let o=0;o<r.length;o++)r[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},pO=Me("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),mO=Me("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var hO=class extends Bc{constructor(e){super(),e&&Ah(this,e)}};var gO=kd,Mn=Wi;var xO="~effect/encoding/EncodingError",Xi=class extends Mn("EncodingError"){[xO]=xO};var ng=e=>Nb(typeof e=="string"?jb.encode(e):e),Cf=e=>{let t=CO(e),n=t.length;if(n%4!==0)return Ae(new Xi({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf("=");if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!=="="))return Ae(new Xi({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(n/4)-o);for(let i=0,a=0;i<n;i+=4,a+=3){let c=tg(t.charCodeAt(i))<<18|tg(t.charCodeAt(i+1))<<12|tg(t.charCodeAt(i+2))<<6|tg(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return Ce(s)}catch(o){return Ae(new Xi({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},wO=e=>tu(Cf(e),t=>$b.decode(t)),IO=e=>SO(typeof e=="string"?jb.encode(e):e),Lb=e=>{let t=CO(e),n=t.length;if(n%4===1)return Ae(new Xi({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${n}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return Ae(new Xi({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let r=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return r=r.replace(/-/g,"+").replace(/_/g,"/"),Cf(r)},vO=e=>tu(Lb(e),t=>$b.decode(t)),TO=e=>EO(typeof e=="string"?jb.encode(e):e),Bb=e=>{let t="";for(let n=e>>>3;n>0;n--){let r=Math.random()*4294967296>>>0;t+=kf[r>>>24]+kf[r>>>16&255]+kf[r>>>8&255]+kf[r&255]}return t},qb=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Ae(new Xi({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let n=t.length/2,r=new Uint8Array(n);for(let o=0;o<n;o++){let s=bO(t[o*2]),i=bO(t[o*2+1]);r[o]=s<<4|i}return Ce(r)}catch(n){return Ae(new Xi({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},kO=e=>tu(qb(e),t=>$b.decode(t)),jb=new TextEncoder,$b=new TextDecoder,CO=e=>e.replace(/[\n\r]/g,""),Nb=e=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=Yi[e[r-2]>>2],n+=Yi[(e[r-2]&3)<<4|e[r-1]>>4],n+=Yi[(e[r-1]&15)<<2|e[r]>>6],n+=Yi[e[r]&63];return r===t+1&&(n+=Yi[e[r-2]>>2],n+=Yi[(e[r-2]&3)<<4],n+="=="),r===t&&(n+=Yi[e[r-2]>>2],n+=Yi[(e[r-2]&3)<<4|e[r-1]>>4],n+=Yi[(e[r-1]&15)<<2],n+="="),n};function tg(e){if(e>=yO.length)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=yO[e];if(t===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var Yi=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],yO=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],SO=e=>Nb(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),kf=[];for(let e=0;e<256;e++)kf.push(e.toString(16).padStart(2,"0"));var EO=e=>{let t="";for(let n=0;n<e.length;n++)t+=kf[e[n]];return t},bO=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 Hb="effect/Tracer/ParentSpan",ti=class extends Ve()(Hb,{fiberCached:!0}){},e4=e=>e;var Af=Me("effect/Tracer/DisablePropagation",{defaultValue:qc}),AO=Me("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),RO=Me("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),Wb="effect/Tracer",og=Me(Wb,{fiberCached:!0,defaultValue:()=>e4({span:e=>new zb(e)})}),zb=class{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];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},this.attributes=new Map,this.traceId=_o(t.parent)?.traceId??Bb(32),this.spanId=Bb(16)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}};var OO="effect/observability/Metric/FiberRuntimeMetricsKey";var _O=Me("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Rf=Me("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:os}),ig=Me("effect/References/TracerEnabled",{defaultValue:Xt}),ru=Me("effect/References/TracerTimingEnabled",{defaultValue:Xt}),Ld=Me("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Bd=Me("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),ea=Me("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),Vb=Me("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Kb=Me("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),MO=Me("effect/References/UnhandledLogLevel",{defaultValue:()=>"Error"}),ag=Me("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var r4=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},o4=r4(),ni=()=>Error.stackTraceLimit,ar=e=>{o4&&(Error.stackTraceLimit=e)};var Fo=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=ni();ar(3);let n=new Error;return ar(t),{...e,captureStackTrace:s4(()=>n.stack)}},Jb=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let o=r.split(`
10
+ `);if(o[e]!==void 0)return n=o[e].trim(),n}},s4=Jb(3);var cg=class extends hf{fiberId;constructor(t,n=wd){super("Interrupt",n,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[_e](t){return Td(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[Oe](){return Nt(it(`${this._tag}:${this.fiberId}`))(Eh(this.annotations))}},BO=e=>new cg(e),Za=e=>new Zs([new cg(e)]),qO=e=>e.reasons.some(Ba),jO=e=>{let t=e.reasons.find(Ba);return t?Ce(t):Ae(e)},ri=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return Ce(n.error)}return Ae(e)};var $O=e=>e.reasons.some(vd);var u0=e=>{let t=e.reasons.find(vd);return t?Ce(t.defect):Ae(e)},f0=e=>e.reasons.some(Td);var l0=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag==="Interrupt"&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Ce(t):Ae(e)},zO=e=>{let t=l0(e);return Fe(t)?a4:t.success},a4=new Set,HO=e=>e.reasons.length>0&&e.reasons.every(Td);var d0=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Zs(xb(e.reasons,t.reasons));return ae(e,n)?e:n}),WO=d(2,(e,t)=>{let n=!1,r=e.reasons.map(o=>Ba(o)?(n=!0,new Jc(t(o.error),o.annotations)):o);return n?zi(r):e}),c4=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},hg=e=>{let t=c4(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},VO=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let o=ni();ar(1);for(let s of e.reasons){if(s._tag==="Interrupt"){r.push(s);continue}n.push(Zb(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(n.length===0){let s=new Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=d4(s,r);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,n.push(Zb(i,r[0].annotations,t))}return ar(o),n},Zb=(e,t,n)=>{let r=typeof e,o;if(e&&r==="object"){if(o=new globalThis.Error(u4(e),{cause:e.cause?Zb(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=l4(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?KO(s,t):s}n?.includeCauseInStack&&(o.stack=GO(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else o=new globalThis.Error(e?r==="string"?e:Vc(e):`Unknown error: ${e}`);return o},u4=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 Vc(e)},f4=/\((.*)\)/g,l4=(e,t,n)=>{let r=`${t.name}: ${t.message}`,o=(e.startsWith(r)?e.slice(r.length):e).split(`
11
+ `),s=[r];for(let i=1;i<o.length&&!/(?:Generator\.next|~effect\/Effect)/.test(o[i]);i++)s.push(o[i]);return n?KO(s.join(`
12
12
  `),n):s.join(`
13
- `)},WO=(e,t)=>{let n=t?.get(Fh.key);return n&&(e=`${e}
14
- ${KO(n)}`),e},i4=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let r of t){let o=r.fiberId!==void 0?`#${r.fiberId}`:"unknown",s=r.annotations.get(rE.key);n.push(` at fiber (${o})`),s&&n.push(KO(s))}return n.join(`
15
- `)},KO=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let o=n.stack();if(o){let s=o.matchAll(o4),i=!1;for(let[,a]of s)i=!0,t.push(` at ${n.name} (${a})`);i||t.push(` at ${n.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
16
- `)},gg=e=>HO(e).map(VO).join(`
17
- `),VO=e=>e.cause?`${e.stack} {
18
- ${JO(e.cause," ")}
19
- }`:e.stack,JO=(e,t)=>{let n=e.stack.split(`
13
+ `)},KO=(e,t)=>{let n=t?.get(Fh.key);return n&&(e=`${e}
14
+ ${JO(n)}`),e},d4=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let r of t){let o=r.fiberId!==void 0?`#${r.fiberId}`:"unknown",s=r.annotations.get(ob.key);n.push(` at fiber (${o})`),s&&n.push(JO(s))}return n.join(`
15
+ `)},JO=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let o=n.stack();if(o){let s=o.matchAll(f4),i=!1;for(let[,a]of s)i=!0,t.push(` at ${n.name} (${a})`);i||t.push(` at ${n.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
16
+ `)},gg=e=>VO(e).map(GO).join(`
17
+ `),GO=e=>e.cause?`${e.stack} {
18
+ ${ZO(e.cause," ")}
19
+ }`:e.stack,ZO=(e,t)=>{let n=e.stack.split(`
20
20
  `),r=`${t}[cause]: ${n[0]}`;for(let o=1,s=n.length;o<s;o++)r+=`
21
21
  ${t}${n[o]}`;return e.cause&&(r+=` {
22
- ${JO(e.cause,`${t} `)}
23
- ${t}}`),r},ug="~effect/Fiber",a4={_A:B,_E:B},c4={id:0},ea=()=>globalThis[mf],fg=class{constructor(t,n=!0){this[ug]=a4,this.setContext(t),this.id=++c4.id,this.currentOpCount=0,this.interruptible=n,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[ug];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(t){return $e(this.context,t)}addObserver(t){return this._exit?(t(this._exit),En):(this._observers.push(t),()=>{if(this._exit)return;let n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}interruptUnsafe(t,n){if(this._exit)return;let r=Za(t);this.currentStackFrame&&(r=Id(r,cs(Fh,this.currentStackFrame))),n&&(r=Id(r,n)),this._interruptedCause=this._interruptedCause?l0(this._interruptedCause,r):r,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(ot(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let n=this.runLoop(t);if(n===Gc)return;let r=ZE.interruptChildren&&ZE.interruptChildren(this);if(r!==void 0)return this.evaluate(ne(r,()=>n));this._exit=n,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let o=0;o<this._observers.length;o++)this._observers[o](n);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Et()}runLoop(t){let n=globalThis[mf];globalThis[mf]=this;let r=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,s=ot(this._interruptedCause)),this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let i=s;s=ne(Pf,()=>i)}if(s=this.currentTracerContext?this.currentTracerContext(s,this):s[nn](this),s===Gc){let i=this._yielded;if(Vc in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Gc}}}catch(i){return j(s,nn)?this.runLoop(uo(i)):uo(`Fiber.runLoop: Not a valid effect: ${String(s)}`)}finally{this._running=r,globalThis[mf]=n}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,u4;for(;;){let n=this._stack.pop();if(!n)return;let r=n[La]&&n[La](this);if(r)return r[t]=r,r;if(n[t])return n}}yieldWith(t){return this._yielded=t,Gc}children(){return this._children??=new Set}pipe(){return ie(this,arguments)}setContext(t){let n=this.context;if(this.context=t,n!==void 0&&QR(n,t))return;let r=this.getRef(Ka);r!==this.currentScheduler&&(this.currentScheduler=r,this._dispatcher=void 0),this.currentSpan=Ji(t,zE),this.currentLogLevel=this.getRef(WE),this.minimumLogLevel=this.getRef(KE),this.currentStackFrame=this.getRef(Rf),this.maxOpsBeforeYield=this.getRef(lO),this.currentPreventYield=this.getRef(dO),this.runtimeMetrics=Ji(t,AO);let o=Ji(t,HE);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}},u4={[Sr](e,t){return ot(t._interruptedCause)},[ko](e,t){return ot(t._interruptedCause)}},ZE={interruptChildren:void 0},xg=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(rE.key,e.currentStackFrame),Mo(t)},f4=e=>{if(!(e._children===void 0||e._children.size===0))return Ga(e._children)},d0=e=>{let t=e;return t._exit?J(t._exit):Bt(n=>t._exit?n(J(t._exit)):ge(e.addObserver(r=>n(J(r)))))},yg=e=>Bt(t=>{let n=e[Symbol.iterator](),r=[],o;function s(){let i=n.next();for(;!i.done;){if(i.value._exit){r.push(i.value._exit),i=n.next();continue}o=i.value.addObserver(a=>{r.push(a),s()});return}t(J(r))}return s(),ge(()=>o?.())}),GO=e=>{let t=e;return t._exit?t._exit:Bt(n=>t._exit?n(t._exit):ge(e.addObserver(n)))},ZO=e=>Bt(t=>{let n=Array.from(e);if(n.length===0)return t(J(rn()));let r=new Array(n.length),o=rn(),s=0,i=!1;for(let a=0;a<n.length&&!i;a++)o.push(n[a].addObserver(c=>{if(s++,c._tag==="Failure")return i=!0,o.forEach(u=>u()),t(c);r[a]=c.value,s===n.length&&t(J(r))}));return ge(()=>{i=!0,o.forEach(a=>a())})}),Sg=e=>pe(t=>QO(e,t.id)),QO=d(e=>j(e[0],ug),(e,t,n)=>pe(r=>{let o=xg(r);return o=o&&n?br(o,n):o??n,e.interruptUnsafe(t,o),zd(d0(e))})),Ga=e=>pe(t=>{let n=xg(t),r=rn();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return zd(yg(r))});var J=rt,ot=On,wt=co,ge=Co({op:"Sync",[nn](e){let t=this[ye](),n=e.getCont(Sr);return n?n[Sr](t,e):e.yieldWith(rt(t))}}),he=Co({op:"Suspend",[nn](e){return this[ye]()}}),p0=d(e=>e.length>=2||Ys(e[0]),(e,t)=>xe(e)?wt(t?t():new os("Effect.fromOption: Option.none")):J(e.value)),Mf=_o({onFailure:wt,onSuccess:J}),YO=e=>e==null?wt(new os):J(e),m0=Co({op:"Yield",[nn](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Ir)},this[ye]??0),e.yieldWith(()=>{t=!0})}}),Pf=m0(0),h0=e=>J(L(e)),iu=J(D()),XO=e=>xe(e)?iu:Be(e.value,L),e_=e=>he(()=>ot(je(e))),ta=e=>uo(e),bg=e=>he(()=>wt(je(e))),we=J(void 0);var t_=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new qd(r,"An error occurred in Effect.try"):e.catch;return he(()=>{try{return J(je(t))}catch(r){return wt(je(()=>n(r)))}})};var g0=e=>x0(function(t,n){je(()=>e(n)).then(r=>t(J(r)),r=>t(ta(r)))},e.length!==0),n_=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new qd(r,"An error occurred in Effect.tryPromise"):e.catch;return x0(function(r,o){let s=i=>{try{r(wt(je(()=>n(i))))}catch(a){r(ta(a))}};try{je(()=>t(o)).then(i=>r(J(i)),s)}catch(i){s(i)}},t.length!==0)},r_=e=>pe(t=>e(t.id)),o_=pe(J),s_=r_(J),x0=Co({op:"Async",single:!1,[nn](e){let t=je(()=>this[ye][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[ye][1]?new AbortController:void 0,s=t(i=>{n||(n=!0,r?e.evaluate(i):r=i)},o?.signal);return r!==!1?r:(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0?Gc:(e._stack.push(l4(()=>(n=!0,o?.abort(),s??Ir))),Gc))}}),l4=Co({op:"AsyncFinalizer",[La](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ug))},[ko](e,t){return u0(e)?ne(this[ye](),()=>ot(e)):ot(e)}}),Bt=e=>x0(e,e.length>=2),$d=Bt(En),i_=(...e)=>he(()=>Of(e.length===1?e[0]():e[1].call(e[0].self))),y0=(e,...t)=>{let n=t.length===0?function(){return he(()=>Of(e.apply(this,arguments)))}:function(){let r=he(()=>Of(e.apply(this,arguments)));for(let o=0;o<t.length;o++)r=t[o](r,...arguments);return r};return S0(e.length,n)},S0=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),_O=VE(2),a_=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",n=e?arguments[1]:void 0,r=ni();ir(2);let o=new globalThis.Error;return ir(r),e?(s,...i)=>MO(t,s,o,i,e,n):MO(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,n)},MO=(e,t,n,r,o,s)=>{let i=typeof t=="function"?t:r.shift().bind(t.self);return S0(i.length,function(...a){let c=he(()=>{let l=i.apply(this,arguments);return ve(l)?l:Of(l)});for(let l=0;l<r.length;l++)c=r[l](c,...a);if(!ve(c))return c;let u=ni();ir(2);let f=new globalThis.Error;return ir(u),na(o?jd(e,s,l=>t0(c,l)):c,Rf,l=>({name:e,stack:_O(()=>f.stack),parent:{name:`${e} (definition)`,stack:_O(()=>n.stack),parent:l}}))})},c_=(e,...t)=>S0(e.length,t.length===0?function(){return PO(()=>e.apply(this,arguments))}:function(){let n=PO(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),PO=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return J(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else{if(o&&o._tag==="Failure")return r.value;{let s=!0;return he(()=>s?(s=!1,ne(r.value,i=>Of(t,i))):he(()=>Of(e())))}}}}catch(t){return ta(t)}},Of=Co({op:"Iterator",single:!1,[Sr](e,t){let n=this[ye][0];for(;;){let r=n.next(e);if(r.done)return J(r.value);if(xt(r.value)){if(r.value._tag==="Failure")return r.value}else return t._stack.push(this),r.value;e=r.value.value}},[nn](e){return this[Sr](this[ye][1],e)}}),Pn=d(2,(e,t)=>{let n=J(t);return ne(e,r=>n)}),Ff=e=>Be(e,L),u_=e=>au(e,{onFailure:J,onSuccess:wt}),jr=d(2,(e,t)=>ne(e,n=>ve(t)?t:je(()=>t(n)))),oi=d(2,(e,t)=>ne(e,n=>Pn(ve(t)?t:je(()=>t(n)),n))),zd=e=>ne(e,t=>Ir),f_=e=>Tr(e,wt),b0=(e,t)=>pe(n=>Bt(r=>{let o=ht(e),s=o.length,i=0,a=!1,c=new Set,u=[],f=(l,p,m)=>{if(i++,l._tag==="Failure"){u.push(...l.cause.reasons),i>=s&&r(ot($i(u)));return}let h=!a;a=!0,r(c.size===0?l:ne(oa(Ga(c)),()=>l)),h&&t?.onWinner&&t.onWinner({fiber:p,index:m,parentFiber:n})};for(let l=0;l<s;l++){let p=uu(n,o[l],!0,!0,!1);if(c.add(p),p.addObserver(m=>{c.delete(p),f(m,p,l)}),a)break}return Ga(c)})),E0=(e,t)=>pe(n=>Bt(r=>{let o=!1,s=new Set,i=c=>{o=!0,r(s.size===0?c:ne(oa(Ga(s)),()=>c))},a=0;for(let c of e){if(o)break;let u=a++,f=uu(n,c,!0,!0,!1);s.add(f),f.addObserver(l=>{s.delete(f);let p=!o;i(l),p&&t?.onWinner&&t.onWinner({fiber:f,index:u,parentFiber:n})})}return Ga(s)})),l_=d(e=>ve(e[1]),(e,t,n)=>b0([e,t],n)),Eg=d(e=>ve(e[1]),(e,t,n)=>E0([e,t],n)),ne=d(2,(e,t)=>{let n=Object.create(d4);return n[ye]=e,n[Sr]=t.length!==1?r=>t(r):t,n}),d4=zi({op:"OnSuccess",[nn](e){return e._stack.push(this),this[ye]}}),d_=d(2,(e,t)=>xt(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):ls(e,t)),xt=e=>Vc in e,p_=d(2,(e,t)=>xt(e)?e._tag==="Success"?t(e.value):e:ne(e,t)),m_=e=>ne(e,B),Be=d(2,(e,t)=>ne(e,n=>J(je(()=>t(n))))),h_=d(2,(e,t)=>xt(e)?E_(e,t):Be(e,t)),g_=d(2,(e,t)=>xt(e)?w_(e,t):C0(e,t)),x_=d(2,(e,t)=>xt(e)?I_(e,t):A0(e,t)),y_=d(2,(e,t)=>{if(xt(e)){if(e._tag==="Success")return e;let n=ri(e.cause);return Fe(n)?e:t(n.success)}return kr(e,t)}),wg=e=>On(Za(e)),Uf=e=>e._tag==="Success";var S_=e=>e._tag==="Failure";var b_=e=>e._tag==="Failure"?Ce(e.cause):Ae(e);var Ir=rt(void 0),E_=d(2,(e,t)=>e._tag==="Success"?rt(t(e.value)):e),w_=d(2,(e,t)=>{if(e._tag==="Success")return e;let n=ri(e.cause);return Fe(n)?e:co(t(n.success))}),I_=d(2,(e,t)=>{if(e._tag==="Success")return rt(t.onSuccess(e.value));let n=ri(e.cause);return Fe(n)?e:co(t.onFailure(n.success))});var v_=d(2,(e,t)=>Uf(e)?t:e),T_=d(2,(e,t)=>Uf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var k_=e=>{let t=[];for(let n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?Ir:On($i(t))};var C_=e=>e,A_=e=>pe(t=>J(AE(t.context,e))),p4=e=>pe(t=>p0(AE(t.context,e))),Df=d(2,(e,t)=>pe(n=>{let r=n.context,o=t(r);return r===o?e:(n.setContext(o),ms(e,()=>{n.setContext(r)}))})),na=d(3,(e,t,n)=>Df(e,r=>{let o=Jn(r,t),s=n(o);return o===s?r:Ve(r,t,s)})),R_=(e,t,n)=>oa(pe(r=>{let o=Jn(r.context,e),s=t(o);return r.setContext(Ve(r.context,e,s)),ps(Jn(r.context,Ya),i=>{let a=Jn(r.context,e),c;if(n?.reset===void 0){if(a!==s)return we;c=o}else c=n.reset(o,s,a);return r.setContext(Ve(r.context,e,c)),we})})),w0=()=>m4,m4=pe(e=>J(e.context)),Qa=e=>pe(t=>e(t.context)),O_=d(2,(e,t)=>Df(e,Qe(t))),ra=d(2,(e,t)=>xt(e)?e:Df(e,br(t))),vr=function(){return arguments.length===1?d(2,(e,t)=>FO(e,arguments[0],t)):d(3,(e,t,n)=>FO(e,t,n)).apply(this,arguments)},FO=(e,t,n)=>Df(e,Ve(t,n)),Ig=d(3,(e,t,n)=>ne(n,r=>vr(e,t,r))),__=d(e=>ve(e[1]),(e,t,n)=>I0(e,t,(r,o)=>[r,o],n)),I0=d(e=>ve(e[1]),(e,t,n,r)=>r?.concurrent?Be(qf([e,t],{concurrency:2}),([o,s])=>je(()=>n(o,s))):ne(e,o=>Be(t,s=>je(()=>n(o,s))))),M_=d(e=>ve(e[0]),(e,t,n)=>$0(e,t,n?r=>wt(n(r)):()=>wt(new os))),P_=d(2,(e,t)=>ne(t,n=>n?Ff(e):iu)),v0=d(2,(e,t)=>Array.from({length:t},()=>e)),F_=d(e=>ve(e[0]),(e,t,n)=>qf(v0(e,t),n)),vg=d(e=>ve(e[0]),(e,t)=>si({while:Xt,body:Qe(t?.disableYield?e:ne(e,n=>Pf)),step:En})),Tr=d(2,(e,t)=>{let n=Object.create(h4);return n[ye]=e,n[ko]=t.length!==1?r=>t(r):t,n}),h4=zi({op:"OnFailure",[nn](e){return e._stack.push(this),this[ye]}}),T0=d(3,(e,t,n)=>Tr(e,r=>t(r)?je(()=>n(r)):ot(r))),Nf=d(3,(e,t,n)=>Tr(e,r=>{let o=t(r);return Fe(o)?ot(o.failure):je(()=>n(o.success,r))})),kr=d(2,(e,t)=>Nf(e,ri,n=>t(n))),U_=e=>au(e,{onFailure:t=>oE(t)?iu:wt(t),onSuccess:h0}),D_=d(2,(e,t)=>Nf(e,c0,t)),N_=d(2,(e,t)=>Tr(e,n=>jr(je(()=>t(n)),ot(n)))),L_=d(3,(e,t,n)=>T0(e,t,r=>jr(je(()=>n(r)),ot(r)))),Tg=d(3,(e,t,n)=>Tr(e,r=>{let o=t(r);return Fe(o)?ot(r):jr(je(()=>n(o.success,r)),ot(r))})),k0=d(2,(e,t)=>Tg(e,ri,n=>t(n))),B_=d(3,(e,t,n)=>{let r=Array.isArray(t)?o=>j(o,"_tag")&&t.includes(o._tag):yr(t);return k0(e,o=>r(o)?n(o):we)}),j_=d(2,(e,t)=>Tg(e,c0,n=>t(n))),Hd=d(e=>ve(e[0]),(e,t,n,r)=>Tr(e,o=>{let s=ri(o);return Fe(s)?ot(s.failure):t(s.success)?je(()=>n(s.success)):r?je(()=>r(s.success)):ot(o)})),kg=d(e=>ve(e[0]),(e,t,n,r)=>Tr(e,o=>{let s=ri(o);if(Fe(s))return ot(s.failure);let i=t(s.success);return Fe(i)?r?je(()=>r(i.failure)):ot(o):je(()=>n(i.success))})),Cg=d(e=>ve(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?s=>j(s,"_tag")&&t.includes(s._tag):yr(t);return Hd(e,o,n,r)}),q_=d(e=>ve(e[0]),(e,t,n)=>{let r;return kg(e,o=>(r??=Object.keys(t),j(o,"_tag")&&io(o._tag)&&r.includes(o._tag)?Ce(o):Ae(o)),o=>je(()=>t[o._tag](o)),n)}),$_=d(e=>ve(e[0]),(e,t,n,r,o)=>Hd(e,s=>yr(s,t)&&j(s,"reason"),s=>{let i=s.reason;return yr(i,n)?r(i,s):o?je(()=>o(i,s)):wt(s)})),z_=d(e=>ve(e[0]),(e,t,n,r)=>{let o;return Hd(e,s=>yr(s,t)&&j(s,"reason")&&j(s.reason,"_tag")&&io(s.reason._tag),s=>{let i=s.reason;return o??=Object.keys(n),o.includes(i._tag)?je(()=>n[i._tag](i,s)):r?je(()=>r(i,s)):wt(s)})}),H_=d(2,(e,t)=>kg(e,n=>yr(n,t)&&j(n,"reason")?Ce(n.reason):Ae(n),wt)),C0=d(2,(e,t)=>kr(e,n=>bg(()=>t(n)))),A0=d(2,(e,t)=>au(e,{onFailure:n=>bg(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),Ag=e=>kr(e,ta),W_=d(2,(e,t)=>kr(e,n=>ge(t))),K_=e=>he(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return ta(new Error("Received an empty collection of effects"));function r(o){let s=t.next();return s.done?o.value:kr(o.value,i=>r(s))}return r(n)}),R0=e=>kr(e,t=>ne(Pf,()=>R0(e))),V_=d(e=>ve(e[0]),(e,t)=>{if(!t?.log)return au(e,{onFailure:r=>we,onSuccess:r=>we});let n=hs(t.log===!0?void 0:t.log);return ls(e,{onFailure(r){let o=BO(r);return Fe(o)?ot(o.failure):t.message===void 0?n(r):n(t.message,r)},onSuccess:r=>we})}),Rg=d(e=>ve(e[0]),(e,t)=>{if(!t?.log)return ls(e,{onFailure:r=>we,onSuccess:r=>we});let n=hs(t.log===!0?void 0:t.log);return ls(e,{onFailure:r=>t.message===void 0?n(r):n(t.message,r),onSuccess:r=>we})}),J_=e=>Og(e,{onFailure:D,onSuccess:L}),Ja=e=>Wd(e,{onFailure:Ae,onSuccess:Ce}),ls=d(2,(e,t)=>{let n=Object.create(g4);return n[ye]=e,n[Sr]=t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,n[ko]=t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure,n}),g4=zi({op:"OnSuccessAndFailure",[nn](e){return e._stack.push(this),this[ye]}}),O0=d(2,(e,t)=>ls(e,{onFailure:n=>ge(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),au=d(2,(e,t)=>ls(e,{onFailure:n=>{let r=n.reasons.find(Ba);return r?je(()=>t.onFailure(r.error)):ot(n)},onSuccess:t.onSuccess})),Og=d(2,(e,t)=>au(e,{onFailure:n=>ge(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),Wd=d(2,(e,t)=>{if(xt(e)){if(e._tag==="Success")return rt(t.onSuccess(e.value));let n=ri(e.cause);return Fe(n)?e:rt(t.onFailure(n.success))}return Og(e,t)}),G_=d(2,(e,t)=>xt(e)?e._tag==="Success"?rt(t.onSuccess(e.value)):rt(t.onFailure(e.cause)):O0(e,t)),Kd=e=>xt(e)?rt(e):x4(e),x4=Co({op:"Exit",[nn](e){return e._stack.push(this),this[ye]},[Sr](e,t,n){return J(n??rt(e))},[ko](e,t,n){return J(n??On(e))}}),Z_=Wd({onFailure:()=>!0,onSuccess:()=>!1}),Q_=Wd({onFailure:()=>!1,onSuccess:()=>!0}),Y_=d(2,(e,t)=>jr(fu(t),e)),_0=d(2,(e,t)=>Eg(e,ne(fu(t.duration),t.orElse))),X_=d(2,(e,t)=>_0(e,{duration:t,orElse:()=>wt(new lg)})),eM=d(2,(e,t)=>Eg(Ff(e),Pn(fu(t),D()))),tM=e=>$r(t=>{let n=t.monotonicTimeNanosUnsafe();return Be(e,r=>[Lr(t.monotonicTimeNanosUnsafe()-n),r])}),QE="~effect/Scope",YE="~effect/Scope/Closeable",Ya=Ke("effect/Scope"),M0=(e,t)=>he(()=>Lf(e,t)??we),Lf=(e,t)=>{if(e.state._tag==="Closed")return;let n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}let r=e.state;if(e.state=n,r.finalizer!==void 0)return r.finalizer(t);let o=r.finalizers;if(!(o===void 0||o.size===0))return o.size===1?o.values().next().value(t):S4(e,o,t)},y4=(e,t)=>Uf(e)?t:Tr(t,n=>ot(l0(e.cause,n))),S4=y0(function*(e,t,n){let r=[],o=[],s=Array.from(t.values()),i=ea();for(let a=s.length-1;a>=0;a--){let c=s[a];e.strategy==="sequential"?r.push(yield*Kd(c(n))):o.push(uu(i,c(n),!0,!0,"inherit"))}return o.length>0&&(r=yield*yg(o)),yield*k_(r)});var nM=(e,t)=>{let n=cu(t);if(e.state._tag==="Closed")return n.state=e.state,n;let r={};return su(e,r,o=>M0(n,o)),su(n,r,o=>ge(()=>P0(e,r))),n},ps=(e,t)=>he(()=>e.state._tag==="Closed"?t(e.state.exit):(su(e,{},t),we)),rM=(e,t)=>ps(e,Qe(t)),su=(e,t,n)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag==="Open"){let r=e.state;r.finalizer!==void 0?(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n)):r.finalizers===void 0?(r.finalizerKey=t,r.finalizer=n):r.finalizers.set(t,n)}},P0=(e,t)=>{if(e.state._tag==="Open"){let n=e.state;n.finalizerKey===t?(n.finalizerKey=void 0,n.finalizer=void 0):n.finalizers!==void 0&&n.finalizers.delete(t)}},oM=e=>e.state._tag!=="Open"?0:e.state.finalizer!==void 0?1:e.state.finalizers?.size??0,cu=(e="sequential")=>({[YE]:YE,[QE]:QE,strategy:e,state:b4}),b4={_tag:"Empty"};var Vd=Ya,sM=vr(Ya),_g=e=>pe(t=>{let n=t.context,r=cu();return t.setContext(Ve(t.context,Ya,r)),ms(e,o=>(t.setContext(n),Lf(r,o)))});var Mg=e=>he(()=>{let t=cu();return Gn(e(t),n=>he(()=>Lf(t,n)??we))}),Pg=(e,t,n)=>Qa(r=>qr(o=>ne(Vd,s=>oi(n?.interruptible?o(e):e,i=>ps(s,a=>ra(t(i,a),r)))))),Bf=e=>ne(Vd,t=>Qa(n=>ps(t,r=>ra(e(r),n)))),ms=Co({op:"OnExit",single:!1,[nn](e){return e._stack.push(this),this[ye][0]},[La](e){e.interruptible&&this[ye][2]!==!0&&(e._stack.push(Ug),e.interruptible=!1)},[Sr](e,t,n){n??=rt(e);let r=this[ye][1](n);return r?ne(r,o=>n):n},[ko](e,t,n){n??=On(e);let r=this[ye][1](n);return r?ne(y4(n,r),o=>n):n}}),Gn=d(2,ms),iM=d(2,(e,t)=>Gn(e,n=>t)),F0=d(3,(e,t,n)=>Gn(e,r=>t(r)?n(r):we)),U0=d(3,(e,t,n)=>Gn(e,r=>{let o=t(r);return Fe(o)?we:n(o.success,r)})),D0=d(2,(e,t)=>U0(e,b_,t)),aM=d(3,(e,t,n)=>F0(e,r=>r._tag!=="Failure"?!1:t(r.cause),r=>n(r.cause))),N0=d(3,(e,t,n)=>Gn(e,r=>{if(r._tag!=="Failure")return we;let o=t(r.cause);return Fe(o)?we:n(o.success,r.cause)})),Fg=d(2,(e,t)=>N0(f0,t)(e)),cM=(e,t,n)=>qr(r=>ne(e,o=>ms(r(t(o)),s=>n(o,s),!0))),uM=e=>Pg(e,t=>j(t,Symbol.asyncDispose)?g0(()=>t[Symbol.asyncDispose]()):ge(()=>t[Symbol.dispose]())),L0=d(2,(e,t)=>ge(()=>{let n=Tn(gt(t)),r=Number.isFinite(n),o=Lg(!1),s=0,i=!1,a,c=ne(o.await,()=>a);return[pe(u=>{let f=u.getRef(mo),l=r?f.currentTimeMillisUnsafe():0;return i||l<s?a??c:(i=!0,o.closeUnsafe(),a=void 0,Gn(e,p=>ge(()=>{i=!1,s=f.currentTimeMillisUnsafe()+n,a=p,o.openUnsafe()})))}),ge(()=>{s=0,o.closeUnsafe(),a=void 0})]})),B0=d(2,(e,t)=>Be(L0(e,t),n=>n[0])),fM=e=>B0(e,po),jf=pe(e=>ot(Za(e.id))),oa=e=>pe(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Ug)),e)),lM=Co({op:"SetInterruptible",[La](e){if(e.interruptible=this[ye],e._interruptedCause&&e.interruptible)return()=>ot(e._interruptedCause)}}),Ug=lM(!0),E4=lM(!1),dM=e=>{if(e.interruptible=!0,e._stack.push(E4),e._interruptedCause)return ot(e._interruptedCause)},j0=e=>pe(t=>t.interruptible?e:dM(t)??e),qr=e=>pe(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ug),e(j0)):e(B)),pM=e=>pe(t=>{if(t.interruptible)return e(B);let n=dM(t),r=e(oa);return n??r}),mM=Be(Pg(ge(()=>new AbortController),e=>ge(()=>e.abort())),e=>e.signal),qf=(e,t)=>Js(e)?t?.mode==="result"?Br(e,Ja,t):Br(e,B,t):t?.discard?t.mode==="result"?Br(Object.values(e),Ja,t):Br(Object.values(e),B,t):he(()=>{let n={};return Pn(Br(Object.entries(e),([r,o])=>Be(t?.mode==="result"?Ja(o):o,s=>{W(n,r,s)}),{discard:!0,concurrency:t?.concurrency}),n)}),q0=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>Be(Br(e,(r,o)=>Ja(t(r,o)),n),r=>yE(r,B))),hM=d(3,(e,t,n)=>{let r=ht(e);return r.length===0?ge(t):he(()=>{let o=0,s=t();return Be(si({while:()=>o<r.length,body:()=>n(s,r[o],o),step(i){s=i,o++}}),()=>s)})}),gM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>ne(q0(e,t,{concurrency:n?.concurrency}),([r,o])=>Vn(r)?wt(r):n?.discard?we:J(o))),xM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?J(D()):yM(n,0,t,r.value)})),yM=(e,t,n,r)=>ne(n(r,t),o=>{if(o)return J(L(r));let s=e.next();return s.done?J(D()):yM(e,t+1,n,s.value)}),SM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?J(D()):bM(n,0,t,r.value)})),bM=(e,t,n,r)=>ne(n(r,t),o=>{if(Kt(o))return J(L(o.success));let s=e.next();return s.done?J(D()):bM(e,t+1,n,s.value)}),si=Co({op:"While",[Sr](e,t){return this[ye].step(e),this[ye].while()?(t._stack.push(this),this[ye].body()):Ir},[nn](e){return this[ye].while()?(e._stack.push(this),this[ye].body()):Ir}}),Br=d(e=>typeof e[1]=="function",(e,t,n)=>he(()=>{let r=n?.concurrency??1,o=r==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,r);if(o===1)return w4(e,t,n);let s=ht(e),i=s.length;if(i===0)return n?.discard?we:J([]);let a=n?.discard?void 0:new Array(i),c=I4({f:t,out:a},s,{concurrency:o});return c?Pn(c,a):J(a)})),EM=e=>ne(e,t=>{let n=t[Symbol.iterator]().next();return n.done?wt(new os):J(n.value)}),w4=(e,t,n)=>he(()=>{let r=n?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return Pn(si({while:()=>!s.done,body:()=>t(s.value,i++),step:a=>{r&&r.push(a),s=o.next()}}),r)}),wM=e=>{let t=e.onItem,n=e.step,r=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],u=t(o,c,i);if(!xt(u))return ne(Kd(u),l=>n(o,c,l,i)??r(o,s,i+1,a)??we);let f=n(o,c,u,i);if(f)return f._tag==="Failure"?f:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,u=i?.concurrency??1;if(u===1)return r(o,s,0,c);let f=i?.orderedStep===!0,l=!1,p,m,h,g=!1,x,E,b=a,y=f?new Array(c):void 0,w=M=>{let _=uo(M);return x=_,l=!0,g=!0,m&&m.size>0?ne(oa(Ga(Array.from(m))),()=>_):_},S=(M,_,P)=>{if(!f)return n(o,M,_,P);if(x)return x;for(y[P]=_;b<c;){let $=y[b];if($===void 0)return;y[b]=void 0;let F=b++,te=n(o,s[F],$,F);if(te)return te}},C=()=>{let M=!1;for(;!x&&a<c;a++){let _=s[a],P=E??t(o,_,a);if(xt(P)){if(x=S(_,P,a),x)break}else if(p){E=void 0;let $=uu(p,P,!0,!0,"inherit");if($._exit){if(x=S(_,$._exit,a),x)break;continue}m.add($);let F=a;if($.addObserver(te=>{m.delete($);try{if(x){if(!g&&te._tag==="Failure")for(let ee of te.cause.reasons)ee._tag!=="Interrupt"&&(x._tag==="Failure"?x.cause.reasons.push(ee):x=On($i([ee])))}else{let ee=S(_,te,F);ee&&(x=ee._tag==="Failure"?On($i(ee.cause.reasons.slice())):ee,C())}if(M){let ee=C();ee&&h(ee)}else l&&m.size===0&&h(x??we)}catch(ee){h(w(ee))}}),m.size<u)continue;M=!0,a++;return}else return Bt($=>{p=ea(),m=new Set,E=P,h=$;let F;try{F=C()}catch(te){return $(w(te))}return F?$(F):he(()=>(x=Ir,g=!0,m?Ga(m):we))})}if(l=!0,x){if(m&&m.size>0){let _=xg(p);m.forEach(P=>P.interruptUnsafe(p.id,_));return}if(h||x._tag==="Failure")return x}else if(h)if(m)m.size===0&&h(we);else return Ir};return C()}},Jd=()=>wM,I4=wM({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag==="Failure")return n;e.out&&(e.out[r]=n.value)}}),$0=d(3,(e,t,n)=>ne(e,r=>t(r)?J(r):n(r))),z0=d(3,(e,t,n)=>ne(e,r=>{let o=t(r);return Fe(o)?n(o.failure):J(o.success)})),IM=d(e=>ve(e[0]),(e,t,n)=>z0(e,t,n?r=>wt(n(r)):()=>wt(new os))),vM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>he(()=>{let r=[];return Pn(Br(e,(o,s)=>{let i=t(o,s);return typeof i=="boolean"?(i&&r.push(o),we):Be(i,a=>{a&&r.push(o)})},{discard:!0,concurrency:n?.concurrency}),r)})),TM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=[];for(let r of e){let o=t(r);Kt(o)&&n.push(o.success)}return J(n)})),kM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>he(()=>{let r=[];return Pn(Br(e,o=>Be(t(o),s=>{Kt(s)&&r.push(s.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),CM=J({}),AM=kh(Be),RM=Ch(Be,ne),OM=Th(Be);var _M=d(e=>ve(e[0]),(e,t)=>pe(n=>(B4(),J(uu(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),uu=(e,t,n=!1,r=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new fg(s.context,i);return n?a.evaluate(t):s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0),!r&&!a._exit&&(s.children().add(a),a.addObserver(()=>s._children.delete(a))),a},MM=d(e=>ve(e[0]),(e,t)=>pe(n=>J(uu(n,e,t?.startImmediately,!0,t?.uninterruptible)))),PM=e=>pe(t=>{let n=t._children&&new Set(t._children);return Gn(e,r=>{let o=t._children;return o===void 0||o.size===0?we:(n&&(o=zh(o,s=>!n.has(s))),zd(yg(o)))})}),H0=d(e=>ve(e[0]),(e,t,n)=>pe(r=>{let o=uu(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};su(t,s,()=>r_(a=>a===o.id?we:Sg(o))),o.addObserver(()=>P0(t,s))}else o.interruptUnsafe(r.id,xg(r));return J(o)})),FM=d(e=>ve(e[0]),(e,t)=>ne(Vd,n=>H0(e,n,t))),sa=e=>(t,n)=>{let r=new fg(n?.scheduler?Ve(e,Ka,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();n.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>n.signal.removeEventListener("abort",o))}return n?.onFiberStart&&n.onFiberStart(r),r},UM=d(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let n={};return su(t,n,()=>Sg(e)),e.addObserver(()=>P0(t,n)),e}),DM=sa(Et()),W0=e=>{let t=sa(e);return(n,r)=>{let o=t(n,r);return r?.onExit&&o.addObserver(r.onExit),s=>o.interruptUnsafe(s)}},NM=W0(Et()),Dg=e=>{let t=sa(e);return(n,r)=>{let o=t(n,r);return new Promise(s=>{o.addObserver(i=>s(i))})}},LM=Dg(Et()),K0=e=>{let t=Dg(e);return(n,r)=>t(n,r).then(o=>{if(o._tag==="Failure")throw hg(o.cause);return o.value})},BM=K0(Et()),Ng=e=>{let t=sa(e);return n=>{if(xt(n))return n;let r=new ei("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??uo(new mg(o))}},jM=Ng(Et()),V0=e=>{let t=Ng(e);return n=>{let r=t(n);if(r._tag==="Failure")throw hg(r.cause);return r.value}},qM=V0(Et()),UO=J(!0),DO=J(!1),XE=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return UO;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let n=0;n<this.waiters.length;n++)this.scheduled.push(this.waiters[n]);return this.waiters=[],UO}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let n=0;n<t.length;n++)t[n](Ir)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let n=0;n<t.length;n++)t[n](Ir)}open=pe(t=>this._isOpen?DO:(this._isOpen=!0,this.scheduleUnsafe(t)));release=pe(t=>this._isOpen?DO:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Bt(t=>this._isOpen?t(we):(this.waiters.push(t),ge(()=>{let n=this.waiters.indexOf(t);n!==-1?this.waiters.splice(n,1):this.scheduled!==void 0&&(n=this.scheduled.indexOf(t),n!==-1&&this.scheduled.splice(n,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=ge(()=>this.closeUnsafe());whenOpen=t=>ne(this.await,()=>t);isOpen(){return this._isOpen}},Lg=e=>new XE(e??!1),$M=e=>ge(()=>Lg(e)),zM=pe(e=>J(e.getRef(og))),HM=d(2,(e,t)=>vr(e,og,t)),WM=vr(ig),KM=vr(ru),e0=BigInt(0),v4={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:e0,endTime:e0,exit:Ir},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},T4=e=>Object.assign(Object.create(v4),e),VM=e=>e?$e(e.annotations,Af)?e._tag==="Span"?VM(Oo(e.parent)):D():L(e):D(),J0=(e,t,n)=>{let r=!e.getRef(ig)||n?.annotations&&$e(n.annotations,Af),o=n?.parent!==void 0?L(n.parent):n?.root?D():VM(e.currentSpan),s;if(r)s=T4({name:t,parent:o,annotations:Ve(n?.annotations??Et(),Af,!0)});else{let i=e.getRef(og),a=e.getRef(mo),c=e.getRef(ru),u=e.getRef(Ld),f=e.getRef(Bd),l=n?.level??e.getRef(kO),p=n?.links!==void 0?[...f,...n.links]:f.length===0?[]:f.slice();s=i.span({name:t,parent:o,annotations:n?.annotations??Et(),links:p,startTime:c?a.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??"internal",root:n?.root??xe(o),sampled:n?.sampled??(Te(o)&&o.value.sampled===!1?!1:!cP(e.getRef(CO),l))});for(let m in u)s.attribute(m,u[m]);if(n?.attributes!==void 0)for(let m in n.attributes)s.attribute(m,n.attributes[m])}return s},JM=(e,t)=>pe(n=>J(J0(n,e,t))),ds=(e,t)=>oa(pe(n=>{let r=Jn(n.context,Ya),o=J0(n,e,t??{}),s=n.getRef(mo),i=n.getRef(ru);return Pn(ps(r,a=>Bg(o,a,s,i)),o)})),GM=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Po(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return ne(ds(t,n),o=>_f(r,o,n))}return r=>ne(ds(t,n),o=>_f(r,o,n))},k4=(e,t)=>(t=typeof t=="function"?t:rs,na(Rf,n=>({name:e,stack:t,parent:n}))),ZM=Ld,QM=Bd,YM=d(e=>ve(e[0]),(e,t,n={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:n}));return na(e,Bd,s=>[...s,...o])}),Bg=(e,t,n,r)=>ge(()=>{e.status._tag!=="Ended"&&e.end(r?n.currentTimeNanosUnsafe():e0,t)}),jd=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return pe(o=>{let s=J0(o,e,n),i=o.getRef(mo),a=o.getRef(ru);return Gn(je(()=>r(s)),c=>Bg(s,c,i,a))})},t0=vr(ti),_f=function(){let e=ve(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=B;return t._tag==="Span"&&(n=Po(n),r=k4(t.name,n?.captureStackTrace)),e?t0(r(arguments[0]),t):o=>t0(r(o),t)},XM=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Po(arguments[2]);if(e){let s=arguments[0];return jd(t,arguments[2],i=>_f(s,i,n))}let r=typeof arguments[1]=="function"?arguments[1]:void 0,o=r?void 0:arguments[1];return(s,...i)=>jd(t,r?r(...i):o,a=>_f(s,a,n))},eP=d(e=>ve(e[0]),(e,...t)=>na(e,Ld,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||W(r,t[0],t[1]),r})),tP=(...e)=>pe(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[r,o]of Object.entries(e[0]))n.attribute(r,o);else n.attribute(e[0],e[1]);return we}),nP=pe(e=>{let t=e.currentSpanLocal;return t?J(t):wt(new os)}),rP=p4(ti),mo=Me("effect/Clock",{defaultValue:()=>new n0}),JE=2**31-1,n0=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=ge(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return C4()}currentTimeNanos=ge(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return sP()}monotonicTimeNanos=ge(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Tn(t))}sleepMillis(t){return t<=0?Pf:Number.isFinite(t)?Bt(n=>{let r=t>JE?this.sleepMillis(t-JE):we,o=setTimeout(()=>n(r),Math.min(t,JE));return ge(()=>clearTimeout(o))}):$d}},oP=BigInt(1e6),sP=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let n=BigInt(Date.now())*oP;return n>t&&(t=n),t}})(),C4=(function(){let e=BigInt(1e9),t;return()=>{let n=sP(),r=BigInt(Date.now())*oP;if(t===void 0)t=r-n;else{let o=t+n;(r>o?r-o:o-r)>e&&(t=r-n)}return t+n}})(),$r=e=>pe(t=>e(t.getRef(mo))),fu=e=>$r(t=>t.sleep(gt(e))),jg=$r(e=>e.currentTimeMillis),iP=$r(e=>e.currentTimeNanos),aP=$r(e=>e.monotonicTimeNanos),r0="~effect/Cause/TimeoutError";var lg=class extends Hi("TimeoutError"){[r0]=r0;constructor(t){super({message:t})}},o0="~effect/Cause/IllegalArgumentError";var dg=class extends Hi("IllegalArgumentError"){[o0]=o0;constructor(t){super({message:t})}},s0="~effect/Cause/ExceededCapacityError";var pg=class extends Hi("ExceededCapacityError"){[s0]=s0;constructor(t){super({message:t})}},i0="~effect/Cause/AsyncFiberError";var mg=class extends Hi("AsyncFiberError"){[i0]=i0;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},a0="~effect/Cause/UnknownError";var qd=class extends Hi("UnknownError"){[a0]=a0;constructor(t,n){super({message:n,cause:t})}},A4=Me("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),R4=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}},O4=cE(fo,R4),cP=Wi(O4),G0=Me("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([N4,L4])}),_4=Me("effect/Logger/LogToStderr",{defaultValue:jc}),uP=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return oa(pe(t=>{let n=t.getRef(Xi),r={...n};for(let o=0;o<e.length;o++){let[s,i]=e[o];W(r,s,i)}return t.setContext(Ve(t.context,Xi,r)),ps(Jn(t.context,Ya),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.hasOwn(n,c)?W(i,c,n[c]):delete i[c])}return t.setContext(Ve(t.context,Xi,i)),we})}))},M4="~effect/Logger",P4={[M4]:{_Message:B,_Output:B},pipe(){return ie(this,arguments)}},fP=e=>{let t=Object.create(P4);return t.log=e,t},F4=e=>e.replace(/[\s="]/g,"_"),U4=(e,t)=>`${F4(e[0])}=${t-e[1]}ms`;var hs=e=>(...t)=>{let n;for(let r=0,o=t.length;r<o;r++){let s=t[r];xf(s)&&(n?t.splice(r,1):t=t.slice(0,r).concat(t.slice(r+1)),n=n?$i(n.reasons.concat(s.reasons)):s,r--)}return n===void 0&&(n=Ph),pe(r=>{let o=e??r.currentLogLevel;if(cP(r.minimumLogLevel,o))return we;let s=r.getRef(mo),i=r.getRef(G0);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:n,fiber:r,date:a,logLevel:o,message:t})}return we})};var ou={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},eie={None:[],All:[],Trace:[ou.gray],Debug:[ou.blue],Info:[ou.green],Warn:[ou.yellow],Error:[ou.red],Fatal:[ou.bgBrightRed,ou.black]};var D4=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 N4=fP(({cause:e,date:t,fiber:n,logLevel:r,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(gg(e));let i=t.getTime(),a=n.getRef(ag),c="";for(let p of a)c+=` ${U4(p,i)}`;let u=n.getRef(Xi);Object.keys(u).length>0&&s.push(u);let f=n.getRef(A4);(n.getRef(_4)?f.error:f.log)(`[${D4(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...s)}),L4=fP(({cause:e,fiber:t,logLevel:n,message:r})=>{let o=t.getRef(mo),s=t.getRef(Xi),i=t.currentSpan;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))W(a,c,u);a["effect.fiberId"]=t.id,a["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0&&(a["effect.cause"]=gg(e)),i.event(JA(Array.isArray(r)&&r.length===1?r[0]:r),o.currentTimeNanosUnsafe(),a)});function B4(){ZE.interruptChildren??=f4}var qg=J(void 0);var lP=d(e=>ve(e[0]),(e,t)=>D0(e,n=>pe(r=>(j4(r,n,t?.defectsOnly),we)))),j4=(e,t,n)=>{let r=e.getRef(RO);if(r.size===0||n&&!jO(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(mo).currentTimeNanosUnsafe()};r.forEach(s=>s.report(o))};var $f=xf,zf=YA,$g=Ba;var Xa=$i,dP=Ph,pP=yf,mP=nE,hP=Za,Hf=e=>new Jc(e),Wf=e=>new Ed(e),lu=NO,Z0=$O,ec=zO;var du=hg,gP=LO;var Kf=ri;var Q0=u0;var xP=qO;var yP=gg;var Vf=os,Gd=Cd;var SP=Zc,me=tR;var zg=dg;var bP=pg;var le={};ns(le,{Do:()=>l6,Transaction:()=>nl,TypeId:()=>r6,abortSignal:()=>lK,acquireDisposable:()=>oK,acquireRelease:()=>ic,acquireUseRelease:()=>FF,addFinalizer:()=>UF,all:()=>o6,andThen:()=>Dn,annotateCurrentSpan:()=>bK,annotateLogs:()=>xx,annotateLogsScoped:()=>HK,annotateSpans:()=>SK,as:()=>zt,asSome:()=>dx,asVoid:()=>jo,awaitAllChildren:()=>OK,bind:()=>m6,bindTo:()=>d6,cached:()=>hx,cachedInvalidateWithTTL:()=>fK,cachedWithTTL:()=>uK,callback:()=>ws,catch:()=>bu,catchCause:()=>ft,catchCauseFilter:()=>O6,catchCauseIf:()=>R6,catchDefect:()=>Mw,catchEager:()=>yx,catchFilter:()=>C6,catchIf:()=>k6,catchNoSuchElement:()=>A6,catchReason:()=>I6,catchReasons:()=>v6,catchTag:()=>AF,catchTags:()=>RF,clockWith:()=>Iu,context:()=>ar,contextWith:()=>cr,currentParentSpan:()=>wK,currentSpan:()=>EK,delay:()=>aa,die:()=>ho,effectify:()=>nV,ensuring:()=>ca,eventually:()=>U6,exit:()=>Vr,fail:()=>G,failCause:()=>ct,failCauseSync:()=>ia,failSync:()=>lx,fiber:()=>_K,fiberId:()=>MK,filter:()=>Lw,filterMap:()=>K6,filterMapEffect:()=>Bw,filterMapOrElse:()=>V6,filterMapOrFail:()=>J6,filterOrElse:()=>_F,filterOrFail:()=>MF,findFirst:()=>c6,findFirstFilter:()=>u6,firstSuccessOf:()=>j6,flatMap:()=>R,flatMapEager:()=>Bn,flatten:()=>Ow,flip:()=>E6,fn:()=>DK,fnUntraced:()=>Se,fnUntracedEager:()=>Sx,forEach:()=>Lo,forever:()=>Ht,forkChild:()=>il,forkDetach:()=>al,forkIn:()=>Ut,forkScoped:()=>Is,fromNullishOr:()=>y6,fromOption:()=>g6,fromResult:()=>Rw,gen:()=>$t,head:()=>f6,ignore:()=>Fw,ignoreCause:()=>Uw,interrupt:()=>xo,interruptible:()=>ua,interruptibleMask:()=>Ww,isEffect:()=>Cr,isFailure:()=>X6,isSuccess:()=>eK,let:()=>p6,linkSpans:()=>TK,log:()=>NK,logDebug:()=>qK,logError:()=>hp,logFatal:()=>LK,logInfo:()=>jK,logTrace:()=>$K,logWarning:()=>BK,logWithLevel:()=>cl,makeSpan:()=>Vw,makeSpanScoped:()=>Jw,map:()=>Y,mapBoth:()=>_6,mapBothEager:()=>fn,mapEager:()=>fa,mapError:()=>ol,mapErrorEager:()=>vu,match:()=>jw,matchCause:()=>Z6,matchCauseEager:()=>Q6,matchCauseEffect:()=>Jr,matchCauseEffectEager:()=>Y6,matchEager:()=>G6,matchEffect:()=>PF,never:()=>Kr,onError:()=>go,onErrorFilter:()=>iK,onErrorIf:()=>sK,onExit:()=>ur,onExitFilter:()=>cK,onExitIf:()=>aK,onExitPrimitive:()=>Hw,onInterrupt:()=>pi,option:()=>b6,orDie:()=>di,orElseSucceed:()=>B6,partition:()=>s6,promise:()=>ux,provide:()=>qw,provideContext:()=>Nn,provideService:()=>qo,provideServiceEffect:()=>rK,race:()=>W6,raceAll:()=>Nw,raceAllFirst:()=>H6,raceFirst:()=>sc,reduce:()=>i6,repeat:()=>DF,repeatOrElse:()=>dK,replicate:()=>pK,replicateEffect:()=>Kw,request:()=>AK,requestUnsafe:()=>RK,result:()=>S6,retry:()=>px,retryOrElse:()=>Pw,runCallback:()=>PK,runCallbackWith:()=>Gw,runFork:()=>mp,runForkWith:()=>Ln,runPromise:()=>Zw,runPromiseExit:()=>gx,runPromiseExitWith:()=>FK,runPromiseWith:()=>Qw,runSync:()=>hi,runSyncExit:()=>ac,runSyncExitWith:()=>UK,runSyncWith:()=>Yw,sandbox:()=>D6,satisfiesErrorType:()=>oV,satisfiesServicesType:()=>sV,satisfiesSuccessType:()=>rV,schedule:()=>mK,scheduleFrom:()=>NF,scope:()=>$o,scoped:()=>wu,scopedWith:()=>dp,service:()=>$w,serviceOption:()=>Eu,setContext:()=>tK,sleep:()=>oc,spanAnnotations:()=>IK,spanLinks:()=>vK,succeed:()=>v,succeedNone:()=>Es,succeedSome:()=>fx,suspend:()=>K,sync:()=>se,tap:()=>Mt,tapCause:()=>fp,tapCauseFilter:()=>F6,tapCauseIf:()=>P6,tapDefect:()=>OF,tapError:()=>up,tapErrorTag:()=>M6,timed:()=>z6,timeout:()=>Dw,timeoutOption:()=>q6,timeoutOrElse:()=>$6,tracer:()=>hK,track:()=>KK,trackDefects:()=>GK,trackDuration:()=>ZK,trackErrors:()=>JK,trackSuccesses:()=>VK,transposeOption:()=>x6,try:()=>Bo,tryPromise:()=>bs,tx:()=>QK,txRetry:()=>tV,undefined:()=>rl,uninterruptible:()=>mi,uninterruptibleMask:()=>yo,unwrapReason:()=>T6,updateContext:()=>lp,updateService:()=>zw,updateServiceScoped:()=>nK,useSpan:()=>pp,validate:()=>a6,void:()=>H,when:()=>mx,whileLoop:()=>Qn,withErrorReporting:()=>L6,withExecutionPlan:()=>N6,withFiber:()=>xn,withLogSpan:()=>WK,withLogger:()=>zK,withParentSpan:()=>sl,withSpan:()=>kK,withSpanScoped:()=>CK,withTracer:()=>gK,withTracerEnabled:()=>xK,withTracerTiming:()=>yK,yieldNow:()=>cp,yieldNowWith:()=>h6,zip:()=>_w,zipWith:()=>w6});var gs=tE,kn=rt,jt=On,Fo=co,Hg=uo,Wg=wg,Vt=Ir;var Ft=Uf,ii=S_;var EP=T_;var Wr={};ns(Wr,{CurrentMemoMap:()=>hu,build:()=>MP,buildWithMemoMap:()=>ci,buildWithScope:()=>Zd,catch:()=>o8,catchCause:()=>i8,catchTag:()=>s8,effect:()=>Hr,effectContext:()=>Gf,effectDiscard:()=>Y4,empty:()=>Q4,flatMap:()=>UP,forkMemoMap:()=>Z4,forkMemoMapUnsafe:()=>rw,fresh:()=>a8,fromBuild:()=>tc,fromBuildMemo:()=>Zg,isLayer:()=>Gg,launch:()=>c8,makeMemoMap:()=>G4,makeMemoMapUnsafe:()=>ai,merge:()=>e8,mergeAll:()=>Qg,mock:()=>u8,orDie:()=>Yg,parentSpan:()=>NP,provide:()=>ys,provideMerge:()=>Qd,satisfiesErrorType:()=>d8,satisfiesServicesType:()=>p8,satisfiesSuccessType:()=>l8,span:()=>m8,succeed:()=>ui,succeedContext:()=>gu,suspend:()=>X4,sync:()=>ow,syncContext:()=>ew,tap:()=>t8,tapCause:()=>r8,tapError:()=>n8,unwrap:()=>tw,updateService:()=>DP,withParentSpan:()=>nw,withSpan:()=>h8});var q4="~effect/Deferred";var $4={[q4]:{_A:B,_E:B},pipe(){return ie(this,arguments)}},pu=()=>{let e=Object.create($4);return e.resumes=void 0,e.effect=void 0,e};var mu=e=>Bt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),ge(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)})));var z4=d(2,(e,t)=>ge(()=>Jf(e,t))),Y0=z4;var H4=d(2,(e,t)=>Y0(e,On(t)));var X0=d(2,(e,t)=>H4(e,Za(t)));var Jf=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let r=0;r<n.length;r++)n[r](t)}return!0};var wP=Xi;var IP=ag,vP=Rf;var TP=ru,kP=OO;var It=Ya;var zr=cu,Uo=sM,Do=ps,_t=rM;var Cn=nM,Je=M0;var _P="~effect/Layer",CP="~effect/Layer/MemoMap",K4=(e,t)=>(e.observers++,jr(ps(t,n=>e.finalizer(n)),e.effect)),Gg=e=>j(e,_P),V4={[_P]:{_ROut:B,_E:B,_RIn:B},pipe(){return ie(this,arguments)}},xu=e=>{let t=Object.create(V4);return t.build=e,t},tc=e=>xu((t,n)=>{let r=Cn(n);return Gn(e(t,r),o=>o._tag==="Failure"?Je(r,o):we)}),Zg=e=>{let t=tc((n,r)=>n.getOrElseMemoize(t,r,e));return t},J4=(e,t,n,r)=>{let o=zr(),s=pu(),i={observers:1,effect:mu(s),finalizer:a=>he(()=>(i.observers--,i.observers===0?(e.map.delete(t),Je(o,a)):we))};return e.map.set(t,i),ps(n,i.finalizer).pipe(ne(()=>r(e,o)),Gn(a=>(i.effect=a,Y0(s,a))))},Jg=class{get[CP](){return CP}parent;constructor(t){this.parent=t}map=new Map;get(t,n){let r=this.map.get(t);return r?K4(r,n):this.parent?.get(t,n)}getOrElseMemoize(t,n,r){return he(()=>{let o=this.get(t,n);return o||J4(this,t,n,r)})}},ai=()=>new Jg,rw=e=>new Jg(e),G4=ge(ai),Z4=e=>ge(()=>rw(e)),hu=class e extends Ke()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let n=Vi(t,e);return n?rw(n):ai()}},ci=d(3,(e,t,n)=>vr(Be(e.build(t,n),Ve(hu,t)),hu,t)),MP=e=>pe(t=>ci(e,hu.forkOrCreate(t.context),Jn(t.context,It))),Zd=d(2,(e,t)=>pe(n=>ci(e,hu.forkOrCreate(n.context),t))),ui=function(){return arguments.length===1?e=>gu(cs(arguments[0],e)):gu(cs(arguments[0],arguments[1]))},gu=e=>xu(Qe(J(e))),Q4=gu(Et()),ow=function(){return arguments.length===1?e=>ew(()=>cs(arguments[0],e())):ew(()=>cs(arguments[0],arguments[1]()))},ew=e=>Zg(Qe(ge(e))),Hr=function(){return arguments.length===1?e=>AP(arguments[0],e):AP(arguments[0],arguments[1])},AP=(e,t)=>Gf(Be(t,n=>cs(e,n))),Gf=e=>Zg((t,n)=>Uo(e,n)),Y4=e=>Gf(Pn(e,Et())),X4=e=>Zg((t,n)=>he(()=>e().build(t,n))),tw=e=>{let t=Ke("effect/Layer/unwrap");return UP(Hr(t)(e),$e(t))},PP=(e,t,n)=>{let r=Cn(n,"parallel");return Br(e,o=>o.build(t,Cn(r,"sequential")),{concurrency:e.length}).pipe(Be(o=>eO(...o)))},Qg=(...e)=>tc((t,n)=>PP(e,t,n)),e8=d(2,(e,t)=>Qg(e,...Array.isArray(t)?t:[t])),FP=(e,t,n)=>tc((r,o)=>ne(Array.isArray(t)?PP(t,r,o):t.build(r,o),s=>e.build(r,o).pipe(ra(s),Be(i=>n(i,s))))),ys=d(2,(e,t)=>FP(e,t,B)),Qd=d(2,(e,t)=>FP(e,t,(n,r)=>br(r,n))),UP=d(2,(e,t)=>tc((n,r)=>ne(e.build(n,r),o=>t(o).build(n,r)))),t8=d(2,(e,t)=>tc((n,r)=>ne(e.build(n,r),o=>Uo(Pn(t(o),o),r)))),n8=d(2,(e,t)=>tc((n,r)=>kr(e.build(n,r),o=>Uo(jr(t(o),wt(o)),r)))),r8=d(2,(e,t)=>tc((n,r)=>Tr(e.build(n,r),o=>Uo(jr(t(o),ot(o)),r)))),Yg=e=>xu((t,n)=>Ag(e.build(t,n))),o8=d(2,(e,t)=>xu((n,r)=>kr(e.build(n,r),o=>t(o).build(n,r))));var s8=d(3,(e,t,n)=>xu((r,o)=>Cg(e.build(r,o),t,s=>n(s).build(r,o)))),i8=d(2,(e,t)=>xu((n,r)=>Tr(e.build(n,r),o=>t(o).build(n,r)))),DP=d(3,(e,t,n)=>ys(e,Hr(t,Be(t,n)))),a8=e=>xu((t,n)=>e.build(ai(),n)),c8=e=>_g(jr(MP(e),$d)),u8=function(){return arguments.length===1?e=>RP(arguments[0],e):RP(arguments[0],arguments[1])},RP=(e,t)=>ui(e)(new Proxy({...t},{get(n,r,o){if(r in n)return n[r];let s=ni();ir(2);let i=new Error(`${e.key}: Unimplemented method "${r.toString()}"`);return ir(s),i.name="UnimplementedError",f8(i)},has:Xt})),f8=e=>{let t=Object.assign(ta(e),{[OP]:OP,channel:{[Vg]:Vg,transform:()=>J(t),pipe(){return ie(this,arguments)}},[Vg]:Vg,transform:()=>J(t)});function n(){return t}return Object.assign(n,t),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n},OP="~effect/Stream",Vg="~effect/Channel",l8=()=>e=>e,d8=()=>e=>e,p8=()=>e=>e,m8=(e,t)=>(t=Po(t),Hr(ti,t?.onEnd?oi(ds(e,t),n=>Bf(r=>t.onEnd(n,r))):ds(e,t))),NP=e=>gu(ti.context(e)),h8=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Po(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return tw(Be(n?.onEnd!==void 0?oi(ds(t,n),o=>Bf(s=>n.onEnd(o,s))):ds(t,n),o=>nw(r,o)))}return r=>tw(Be(n?.onEnd!==void 0?oi(ds(t,n),o=>Bf(s=>n.onEnd(o,s))):ds(t,n),o=>nw(r,o)))},nw=function(){let e=Gg(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=B;t._tag==="Span"&&(n=Po(n),r=g8(t.name,n?.captureStackTrace));let o=NP(t);return e?ys(r(arguments[0]),o):s=>ys(r(s),o)},g8=(e,t)=>(t=typeof t=="function"?t:rs,DP(vP,n=>({name:e,stack:t,parent:n})));var LP="~effect/ExecutionPlan";var x8={[LP]:LP,get captureRequirements(){let e=this;return Qa(t=>J(y8(e.steps.map(n=>({...n,provide:Gg(n.provide)?ys(n.provide,gu(t)):n.provide})))))},pipe(){return ie(this,arguments)}},y8=e=>{let t=Object.create(x8);return t.steps=e,t};var Xg=Me("effect/ExecutionPlan/CurrentMetadata",{defaultValue:Qe({attempt:0,stepIndex:0})});var fi={};ns(fi,{Clock:()=>nc,clockWith:()=>S8,currentTimeMillis:()=>b8,currentTimeNanos:()=>E8,monotonicTimeNanos:()=>w8});var nc=mo,S8=$r,b8=jg,E8=iP,w8=aP;var ex="~effect/time/DateTime",tx="~effect/time/DateTime/TimeZone",jP={[ex]:ex,pipe(){return ie(this,arguments)},[at](){return this.toString()},toJSON(){return tp(this).toJSON()}},I8={...jP,_tag:"Utc",[Oe](){return Nr(this.epochMilliseconds)},[_e](e){return Zf(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${tp(this).toJSON()})`}},v8={...jP,_tag:"Zoned",[Oe](){return Nt(Nr(this.epochMilliseconds))(ce(this.zone))},[_e](e){return Zf(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&ae(this.zone,e.zone)},toString(){return`DateTime.Zoned(${xw(this)})`}},qP={[tx]:tx,[at](){return this.toString()}},T8={...qP,_tag:"Named",[Oe](){return it(`Named:${this.id}`)},[_e](e){return Su(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},k8={...qP,_tag:"Offset",[Oe](){return it(`Offset:${this.offset}`)},[_e](e){return Su(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${mw(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},li=(e,t,n)=>{let r=Object.create(v8);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},Zf=e=>j(e,ex);var Su=e=>j(e,tx),$P=e=>Su(e)&&e._tag==="Offset",zP=e=>Su(e)&&e._tag==="Named",HP=e=>e._tag==="Utc",cw=e=>e._tag==="Zoned",WP=un((e,t)=>e.epochMilliseconds===t.epochMilliseconds),KP=ss((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var VP=e=>{let t=Object.create(I8);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},yu=e=>{let t=e.getTime();if(Number.isNaN(t))throw new zg("Invalid date");return VP(t)},nx=e=>{if(Zf(e))return e;if(e instanceof Date)return yu(e);if(typeof e=="object"){if("epochMilliseconds"in e)return yu(new Date(e.epochMilliseconds));let t=new Date(0);return F8(t,e),yu(t)}else if(typeof e=="string"&&!C8(e))return yu(new Date(e+"Z"));return yu(new Date(e))},C8=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),A8=-864e13+720*60*1e3,R8=864e13-840*60*1e3,uw=(e,t)=>{let n=t?.timeZone;if(n===void 0&&Zf(e)&&cw(e))return e;let r=nx(e);if(r.epochMilliseconds<A8||r.epochMilliseconds>R8)throw new RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);n===void 0&&typeof e=="object"&&"timeZoneId"in e&&(n=e.timeZoneId);let o;if(n===void 0){let s=new Date(r.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=ep(s)}else if(Su(n))o=n;else if(typeof n=="number")o=ep(n);else{let s=dw(n);if(xe(s))throw new zg(`Invalid time zone: ${n}`);o=s.value}return t?.adjustForTimeZone!==!0?li(r.epochMilliseconds,o,r.partsUtc):U8(r.epochMilliseconds,o,t?.disambiguation??"compatible")},iw=$a(uw),JP=$a(nx),O8=/^(.{17,35})\[(.+)\]$/,GP=e=>{let t=O8.exec(e);if(t===null){let o=gw(e);return o!==null?iw(e,{timeZone:o}):D()}let[,n,r]=t;return iw(n,{timeZone:r})};var ZP=e=>VP(e.epochMilliseconds);var Xd=new Map,_8={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},M8=e=>{let t=e.resolvedOptions().timeZone;if(Xd.has(t))return Xd.get(t);let n=Object.create(T8);return n.id=t,n.format=e,Xd.set(t,n),n},fw=e=>{if(Xd.has(e))return Xd.get(e);try{return M8(new Intl.DateTimeFormat("en-US",{..._8,timeZone:e}))}catch{throw new zg(`Invalid time zone: ${e}`)}},ep=e=>{let t=Object.create(k8);return t.offset=e,t},lw=$a(fw);var P8=/^(?:GMT|[+-])/,dw=e=>{if(P8.test(e)){let t=gw(e);return t===null?D():L(ep(t))}return lw(e)},QP=e=>e._tag==="Offset"?mw(e.offset):e.id;var tp=e=>new Date(e.epochMilliseconds),rx=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(r=>r.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},pw=e=>rx(e).getTime()-hw(e),mw=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},YP=e=>mw(pw(e)),hw=e=>e.epochMilliseconds;var F8=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.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 BP=1440*60*1e3,U8=(e,t,n)=>{if(t._tag==="Offset")return li(e-t.offset,t);let r=Yd(e-BP,e,t),o=Yd(e+BP,e,t);if(r===o)return li(e-r,t);let s=r<o,i=r-o;if(s){if(Yd(e-o,e,t)===o)return li(e-o,t);let u=li(e-r,t),f=rx(u).getTime();if(e!==f)switch(n){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return li(e-o,t);case"compatible":case"later":return u}return u}if(Yd(e-r,e,t)===r){if(n==="earlier"||n==="compatible"||Yd(e-r+i,e+i,t)===r)return li(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return li(e-o,t)},D8=/([+-])(\d{2}):(\d{2})$/,gw=e=>{let t=D8.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1e3},Yd=(e,t,n)=>{let r=n.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=gw(r);return o===null?pw(li(t,n)):o};var XP=e=>tp(e).toISOString();var aw=e=>{let t=rx(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${YP(e)}`},xw=e=>e.zone._tag==="Offset"?aw(e):`${aw(e)}[${e.zone.id}]`;var Lie=globalThis.Number;var tF=d(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e"))return!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0?NaN:L8(e,t);let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,i=o>s?o:s,a=parseInt(e.toFixed(i).replace(".","")),c=parseInt(t.toFixed(i).replace(".",""));return a%c/Math.pow(10,i)});function L8(e,t){let[n,r]=eF(e),[o,s]=eF(t),i=Math.min(r,s),a=n*BigInt(10)**BigInt(r-i),c=o*BigInt(10)**BigInt(s-i),u=a%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${i}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f}function eF(e){let t=Math.abs(e).toExponential(),n=t.indexOf("e"),r=t.slice(0,n).replace(".","");return[BigInt(r)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(n+1))-r.length+1]}var nF=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var rF=vo((e,t)=>Math.max(e,t),-1/0),oF=vo((e,t)=>Math.min(e,t),1/0);var jie=globalThis.String,ox=io;var iF=e=>e.trim();var qt=d(2,(e,t)=>Nf(e,B8,n=>t(n))),No=e=>e.reasons.some(Sw),Sw=e=>e._tag==="Fail"&&Gd(e.error),Qf=e=>{let t,n=!1;for(let r of e.reasons)Sw(r)?t??=r.error:r._tag!=="Interrupt"&&(n=!0);return t===void 0?Ae(e):n?Ae(Xa(e.reasons.filter(r=>!Sw(r)))):Ce(t)};var B8=e=>{let t=Qf(e);return Fe(t)?t:Ce(t.success.value)},bw=e=>{let t=Qf(e);return Fe(t)?jt(t.failure):kn(t.success.value)},np=d(2,(e,t)=>ls(e,{onSuccess:t.onSuccess,onFailure:n=>{let r=Qf(n);return Fe(r)?t.onFailure(r.failure):t.onDone(r.success.value)}}));var aF="~effect/Schedule";var Un=Me("effect/Schedule/CurrentMetadata",{defaultValue:Qe({input:void 0,output:void 0,duration:Gi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),j8={[aF]:{_Out:B,_In:B,_Env:B},pipe(){return ie(this,arguments)}},Ew=e=>j(e,aF),sx=e=>{let t=Object.create(j8);return t.step=e,t},ww=()=>{let e=0,t,n;return(r,o)=>{n===void 0&&(n=r);let s=r-n,i=t===void 0?0:r-t;return t=r,{input:o,attempt:++e,start:n,now:r,elapsed:s,elapsedSincePrevious:i}}},cF=e=>sx(Be(e,t=>{let n=ww();return(r,o)=>t(n(r,o))})),ix=e=>Tr(e.step,t=>J(()=>ot(t))),Ss=e=>$r(t=>Be(ix(e),n=>{let r=ww();return o=>he(()=>{let s=t.currentTimeMillisUnsafe();return ne(n(s,o),([i,a])=>{let c=r(s,o);return c.output=i,c.duration=a,Pn(fu(a),c)})})})),Yf=e=>Be(Ss(e),t=>n=>Be(t(n),r=>r.output));var uF=e=>sx(Be(qf(e.map(ix)),t=>(n,r)=>ne(Br(t,o=>np(o(n,r),{onSuccess:s=>J(s[1]),onDone:()=>qg,onFailure:ot})),o=>{let s=q8(o);return s===void 0?me(Gi):J([s,s])}))),q8=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:cO(t,r))}return t},fF=(e,t=2)=>{let n=Tn(gt(e));return cF(J(r=>{let o=us(n*Math.pow(t,r.attempt-1));return J([o,o])}))};var Iw=e=>sx(Be(ix(e),t=>(n,r)=>np(t(n,r),{onSuccess:o=>J([r,o[1]]),onFailure:ot,onDone:()=>me(r)}))),lF=e=>rp(op,({attempt:t})=>J(t<=e)),Xf=e=>{let t=gt(e);return cF(J(n=>J([n.attempt-1,t])))};var rp=d(2,(e,t)=>sx(Be(ix(e),n=>{let r=ww();return(o,s)=>ne(n(o,s),i=>{let[a,c]=i,u=t({...r(o,s),output:a,duration:c});return ne(ve(u)?u:J(u),f=>f?J(i):me(a))})})));var op=Xf(Gi);var $8=(e,t,n)=>Mg(r=>ne(n?.local?ci(t,ai(),r):Zd(t,r),o=>ra(e,o))),ax=d(e=>ve(e[0]),(e,t,n)=>Dd(t)?ra(e,t):$8(e,Array.isArray(t)?Qg(...t):t,n));var vw=d(3,(e,t,n)=>ne(Ss(t),r=>{let o=Un.defaultValue();return kr(vg(oi(ne(he(()=>vr(e,Un,o)),r),s=>ge(()=>{o=s})),{disableYield:!0}),s=>Cd(s)?J(s.value):n(s,o.attempt===0?D():L(o)))})),Tw=d(3,(e,t,n)=>ne(Ss(t),r=>{let o=Un.defaultValue(),s,i=kr(he(()=>vr(e,Un,o)),a=>(s=a,ne(r(a),c=>(o=c,i))));return qt(i,a=>je(()=>n(s,a)))})),pF=d(2,(e,t)=>{let n=typeof t=="function"?t(B):Ew(t)?t:ip(t);return vw(e,n,wt)}),sp=d(2,(e,t)=>{let n=typeof t=="function"?t(B):Ew(t)?t:ip(t);return Tw(e,n,wt)}),mF=d(3,(e,t,n)=>ne(Ss(n),r=>{let o=Un.defaultValue(),s=he(()=>vr(e,Un,o));return kr(ne(r(t),i=>{o=i;let a=Qe(ne(s,r));return si({while:Xt,body:a,step(c){o=c}})}),i=>Cd(i)?J(i.value):wt(i))})),z8=Iw(op),ip=e=>{let t=e.schedule?Iw(e.schedule):z8;return e.while&&(t=rp(t,({input:n})=>{let r=e.while(n);return ve(r)?r:J(r)})),e.until&&(t=rp(t,({input:n})=>{let r=e.until(n);return ve(r)?Be(r,o=>!o):J(!r)})),e.times!==void 0&&(t=rp(t,({attempt:n})=>J(n<=e.times))),t};var kw=(e,t)=>{let n=-1,r=0,o=s=>Rg(e(s));return{begin:$r(s=>he(()=>{let i=t();i.stepIndex!==n&&(n=i.stepIndex,r=0),r++;let a={attempt:i.attempt,stepAttempt:r,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Pn(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>$r(a=>{let c=Lr(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})})}},gF=d(e=>ve(e[0]),(e,t,n)=>he(()=>{let r=0,o={attempt:0,stepIndex:0},s=Ig(Xg,ge(()=>(o={attempt:o.attempt+1,stepIndex:r},o))),i=n?.onEvent===void 0?void 0:kw(n.onEvent,()=>o),a=i===void 0?B:u=>qr(f=>ne(i.begin,l=>Gn(f(u),p=>i.end(l,p)))),c;return ne(si({while:()=>r<t.steps.length&&(c===void 0||Fe(c)),body(){let u=t.steps[r],f=s(a(ax(e,u.provide)));if(c){let l=!1,p=f;f=he(()=>l?p:(l=!0,Mf(c))),f=sp(f,ap(u,!1))}else{let l=ap(u,!0);f=l?sp(f,l):f}return Ja(f)},step(u){c=u,r++}}),()=>Mf(c))})),ap=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return ip({schedule:e.schedule?e.schedule:e.attempts?void 0:H8,times:e.attempts,while:e.while});return ip({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},H8=lF(1);var W8="~effect/Request",K8=Zb({_E:e=>e,_A:e=>e,_R:e=>e}),tae={...QA,[W8]:K8};var yF=e=>e;var bF=d(2,(e,t)=>{let n=r=>Bt(o=>{let s=wF(r,e,o,ea());return J8(r,s)});return ve(t)?ne(t,n):n(t)}),EF=(e,t)=>{let n=wF(t.resolver,e,t.onExit,{context:t.context,currentScheduler:$e(t.context,Ka)});return()=>IF(t.resolver,n)},cx=[],Cw=new WeakMap,wF=(e,t,n,r)=>{let o=Cw.get(e);o||(o=new Map,Cw.set(e,o));let s,i=!1,a=yF({request:t,context:r.context,uninterruptible:!1,completeUnsafe(u){i||(i=!0,n(u),s?.entrySet.delete(a))}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(cx.length>0)s=cx.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:ne(he(()=>u.resolver.delay),f=>SF(u)),run:Gn(he(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let l of u.entrySet)l.completeUnsafe(f._tag==="Success"?uo(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):f);return u.entries.clear(),cx.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,cx.push(u)),we})};s=u}o.set(c,s),s.fiber=sa(r.context)(s.delayEffect,{scheduler:r.currentScheduler})}return s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(r.id),s.fiber=sa(r.context)(SF(s),{scheduler:r.currentScheduler})),a},IF=(e,t)=>{if(t.uninterruptible)return;let n=Cw.get(e);if(!n)return;let r=e.batchKey(t),o=n.get(r);o&&(o.entries.delete(t),o.entrySet.delete(t),o.entries.size===0&&(n.delete(r),o.fiber?.interruptUnsafe()))},J8=(e,t)=>ge(()=>IF(e,t));function SF(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):we}var Z8="effect/Metric/CurrentMetricAttributes",Q8=Me(Z8,{defaultValue:()=>({})}),Y8="~effect/observability/Metric/MetricRegistryKey",X8=Me(Y8,{defaultValue:()=>new Map}),vF="~effect/observability/Metric",TF=class{[vF]=vF;#e=new WeakMap;#t;id;description;attributes;constructor(t,n,r){this.id=t,this.description=n,this.attributes=r}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,n){return this.hook(n).modify(t,n)}updateUnsafe(t,n){return this.hook(n).update(t,n)}hook(t){let n=$e(t,Q8);if(Object.keys(n).length===0)return Kn(this.#t)?this.#t.hooks:(this.#t=this.getOrCreate(t,this.attributes),this.#t.hooks);let r=n6(this.attributes,n),o=this.#e.get(r);return Kn(o)||(o=this.getOrCreate(t,r),this.#e.set(r,o)),o.hooks}getOrCreate(t,n){let r=e6(this,n),o=$e(t,X8);if(o.has(r))return o.get(r);let s=this.createHooks(),i={id:this.id,type:this.type,description:this.description,attributes:Aw(n),hooks:s};return o.set(r,i),i}pipe(){return ie(this,arguments)}};var tl=d(2,(e,t)=>Qa(n=>ge(()=>e.updateUnsafe(t,n))));function e6(e,t){let n=`${e.type}:${e.id}`;return Kn(e.description)&&(n+=`:${e.description}`),Kn(t)&&(n+=`:${t6(t)}`),n}function t6(e){return JSON.stringify(Array.isArray(e)?e:Object.entries(e))}function n6(e,t){return{...Aw(e),...Aw(t)}}function Aw(e){return Kn(e)&&Array.isArray(e)?e.reduce((t,[n,r])=>(W(t,n,r),t),{}):e}var r6=Qs,Cr=ve,o6=qf,s6=q0,i6=hM,a6=gM,c6=xM,u6=SM,Lo=Br,f6=EM,Qn=si,ux=g0,bs=n_,v=J,Es=iu,fx=h0,K=he,se=ge,H=we;var rl=qg;var ws=Bt,Kr=$d,l6=CM,d6=AM,p6=OM;var m6=RM,$t=i_,G=wt,lx=bg,ct=ot,ia=e_,ho=ta,Bo=t_;var cp=Pf,h6=m0,xn=pe,Rw=Mf,g6=p0,x6=XO,y6=YO,R=ne,Ow=m_,Dn=jr,Mt=oi,S6=Ja,b6=J_,Vr=Kd,Y=Be,zt=Pn,dx=Ff,jo=zd,E6=u_,_w=__,w6=I0,bu=kr;var AF=Cg,RF=q_,I6=$_,v6=z_,T6=H_,ft=Tr,Mw=D_,k6=Hd,C6=kg,A6=U_,R6=T0,O6=Nf,ol=C0,_6=A0,di=Ag,up=k0,M6=B_,fp=N_,P6=L_,F6=Tg,OF=j_,U6=R0,px=sp,Pw=Tw,D6=f_,Fw=V_,Uw=Rg,N6=gF,L6=lP,B6=W_,j6=K_,Dw=X_,q6=eM,$6=_0,aa=Y_,oc=fu,z6=tM,Nw=b0,H6=E0,W6=l_,sc=Eg,Lw=vM,K6=TM,Bw=kM,_F=$0,V6=z0,MF=M_,J6=IM,mx=P_,jw=Og,G6=Wd,Z6=O0,Q6=G_,Y6=d_,Jr=ls,PF=au,X6=Z_,eK=Q_,ar=w0,cr=Qa,qw=ax,Nn=ra,tK=O_,$w=C_,Eu=A_,lp=Df,zw=na,nK=R_,qo=vr,rK=Ig,$o=Vd,wu=_g,dp=Mg,ic=Pg,oK=uM,FF=cM,UF=Bf,ca=iM,go=D0,sK=aM,iK=N0,Hw=ms,ur=Gn,aK=F0,cK=U0,hx=fM,uK=B0,fK=L0,xo=jf,ua=j0,pi=Fg,mi=oa,yo=qr,Ww=pM,lK=mM,Ht=vg,DF=pF,dK=vw,pK=v0,Kw=F_,mK=d(2,(e,t)=>NF(e,void 0,t)),NF=mF,hK=zM,gK=HM,xK=WM,yK=KM,SK=eP,bK=tP,EK=nP,wK=rP,IK=ZM,vK=QM,TK=YM,Vw=JM,Jw=ds,pp=jd,kK=XM,CK=GM,sl=_f,AK=bF,RK=EF,il=_M,Ut=H0,Is=FM,al=MM,OK=PM,_K=o_,MK=s_,mp=DM,Ln=sa,Gw=W0,PK=NM,Zw=BM,Qw=K0,gx=LM,FK=Dg,hi=qM,Yw=V0,ac=jM,UK=Ng,Se=y0,DK=a_,Iu=$r,cl=hs,NK=hs(),LK=hs("Fatal"),BK=hs("Warn"),hp=hs("Error"),jK=hs("Info"),qK=hs("Debug"),$K=hs("Trace"),zK=d(2,(e,t)=>na(e,G0,n=>new Set([...n,t]))),xx=d(e=>Cr(e[0]),(e,...t)=>na(e,wP,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||W(r,t[0],t[1]),r})),HK=uP,WK=d(2,(e,t)=>ne(jg,n=>na(e,IP,r=>[[t,n],...r]))),KK=d(e=>Cr(e[0]),(e,t,n)=>ur(e,r=>{let o=n===void 0?r:je(()=>n(r));return tl(t,o)})),VK=d(e=>Cr(e[0]),(e,t,n)=>Mt(e,r=>{let o=n===void 0?r:n(r);return tl(t,o)})),JK=d(e=>Cr(e[0]),(e,t,n)=>up(e,r=>{let o=n===void 0?r:je(()=>n(r));return tl(t,o)})),GK=d(e=>Cr(e[0]),(e,t,n)=>OF(e,r=>{let o=n===void 0?r:je(()=>n(r));return tl(t,o)})),ZK=d(e=>Cr(e[0]),(e,t,n)=>Iu(r=>{let o=r.monotonicTimeNanosUnsafe();return ur(e,()=>{let s=r.monotonicTimeNanosUnsafe(),i=uO(gt(s),gt(o)),a=n===void 0?i:je(()=>n(i));return tl(t,a)})})),nl=class extends Ke()("effect/Effect/Transaction"){},QK=e=>xn(t=>{let n=Vi(t.context,nl);if(n)return e;n={journal:new Map,retry:!1};let r;return yo(o=>R(Qn({while:()=>!r,body:Qe(o(e).pipe(qo(nl,n),fp(()=>n.retry?o(XK(n)):H),Vr)),step(s){if(n.retry||!YK(n))return CF(n);Ft(s)?eV(t,n):CF(n),r=s}}),()=>r))}),YK=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},XK=e=>K(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let o of n)o.pending.delete(t)};return ws(o=>{let s=()=>{r(),o(H)};for(let i of n)i.pending.set(t,s);return se(r)})});function eV(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version=n.version+1,n.value=r);for(let o of n.pending.values())e.currentDispatcher.scheduleTask(o,0);n.pending.clear()}}function CF(e){e.retry=!1,e.journal.clear()}var tV=R(nl,e=>(e.retry=!0,xo)),nV=(e,t,n)=>(...r)=>ws(o=>{try{e(...r,(s,i)=>{o(s?G(t?t(s,r):s):v(i))})}catch(s){o(n?G(n(s,r)):ho(s))}}),rV=()=>e=>e,oV=()=>e=>e,sV=()=>e=>e,fa=h_,vu=g_,fn=x_,Bn=p_,yx=y_,Sx=c_;function gi(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function gp(e){return t=>gi(t)?.[e]}var Gr="~structural",Tu="~identifier",xp="~sentinels",bx="~constructor",LF=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],ul=gp("identifier"),Xw=gp(Tu),eI=gp("title");var BF=gp("brands"),yp=wn(e=>{let t=gi(e)?.identifier;return typeof t=="string"?t:e.getExpected(yp)});var jF=new Set([xp,Gr,"representation","arbitrary","brands","toJsonSchema","toCode","toArbitrary","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso"]);var ze=Symbol();var zo=kn,vs=zo(ze),on=zo(ze),Ex=e=>e===ze?D():L(e),tI=e=>e._tag==="None"?vs:zo(e.value);var bp="~effect/SchemaIssue/Issue";function rI(e){return j(e,bp)&&e[bp]===bp}function iV(e){return Object.hasOwn(e,"input")}var So=class{[bp]=bp;constructor(t,n){n?.reportInput===!0&&t!==ze&&(this.input=t)}},vx=class extends So{_tag="Filter";filter;issue;constructor(t,n,r,o){super(r,o),this.filter=t,this.issue=n}},Tx=class extends So{_tag="Encoding";ast;issue;constructor(t,n,r,o){super(r,o),this.ast=t,this.issue=n}},Ct=class extends So{_tag="Pointer";path;issue;constructor(t,n){super(),this.path=t,this.issue=n}},sn=class extends So{_tag="MissingKey";annotations;constructor(t){super(),this.annotations=t}},la=class extends So{_tag="UnexpectedKey";ast;constructor(t,n,r){super(n,r),this.ast=t}},At=class extends So{_tag="Composite";ast;issues;constructor(t,n,r,o){super(r,o),this.ast=t,this.issues=n}},st=class extends So{_tag="InvalidType";ast;constructor(t,n,r){super(n,r),this.ast=t}},ke=class extends So{_tag="InvalidValue";annotations;constructor(t,n,r){super(n,r),this.annotations=t}};function Yn(e,t,n,r,o){return new At(e,[new Ct([t],n)],r,o)}var Cu=class extends So{_tag="Forbidden";annotations;constructor(t,n,r){super(n,r),this.annotations=t}},ll=class extends So{_tag="AnyOf";ast;issues;constructor(t,n,r,o){super(r,o),this.ast=t,this.issues=n}},kx=class extends So{_tag="OneOf";ast;successes;constructor(t,n,r,o){super(r,o),this.ast=t,this.successes=n}};function nI(e,t,n){if(rI(e))return e;if(typeof e=="string")return new ke({message:e},t,n);let r=typeof e.issue=="string"?new ke({message:e.issue},t,n):e.issue;return new Ct(e.path,r)}function qF(e,t,n){if(e!==void 0)return typeof e=="boolean"?e?void 0:new ke(void 0,t,n):nI(e,t,n)}function $F(e,t,n,r){return Array.isArray(t)?Ye(t)?t.length===1?nI(t[0],n,r):new At(e,as(t,o=>nI(o,n,r)),n,r):void 0:qF(t,n,r)}var zF=e=>{let t=dl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return cc(yp(e.ast),e);case"InvalidValue":{let n=oI(e);if(n!==void 0)return cc(n,e);let r=Ix(e);return r===void 0?"Expected a valid value":`Invalid data ${r}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let n=Ix(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let n=Ix(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},HF=e=>dl(e.issue)??dl(e);function WF(e){return t=>({issues:fl(t,[],e?.leafHook??zF,e?.checkHook??HF)})}function Ix(e){return iV(e)?X(e.input):void 0}function oI(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function cc(e,t){let n=Ix(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function fl(e,t,n,r){switch(e._tag){case"Filter":{let o=r(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return fl(e.issue,t,n,r);let s=oI(e.issue);return[{path:t,message:s===void 0?cc(sI(e.filter),e):cc(s,e.issue)}]}case"Encoding":return fl(e.issue,t,n,r);case"Pointer":return fl(e.issue,[...t,...e.path],n,r);case"Composite":return e.issues.flatMap(o=>fl(o,t,n,r));case"AnyOf":return e.issues.length===0?[{path:t,message:dl(e)??cc(yp(e.ast),e)}]:e.issues.flatMap(o=>fl(o,t,n,r));default:return[{path:t,message:n(e)}]}}function sI(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(n=>sI(n)).join(" & ")}}function aV(){return e=>Sp(e,"")}var KF=aV();function Sp(e,t){let n;switch(e._tag){case"Filter":{let r=HF(e);if(r!==void 0)n=r;else{if(e.issue._tag!=="InvalidValue")return Sp(e.issue,t);let o=oI(e.issue);n=o===void 0?cc(sI(e.filter),e):cc(o,e.issue)}break}case"Encoding":return Sp(e.issue,t);case"Pointer":return Sp(e.issue,t+Oh(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(r=>Sp(r,t)).join(`
24
- `);n=dl(e)??cc(yp(e.ast),e);break}default:n=zF(e);break}return t?`${n}
25
- at ${t}`:n}function dl(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return dl(e.issue);let n=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof n=="string")return n}function Ep(e){let t;for(let n of e.reasons){if(!$g(n)||!rI(n.error))return;t??=n.error}return t}function da(e,t){let n=Ep(e);if(n===void 0)throw new Error(t,{cause:e});return n}var Au=Zf,JF=Su,GF=$P,ZF=zP,QF=HP,YF=cw,iI=WP,aI=KP;var XF=yu,eU=nx;var Cx=uw;var Ax=JP,tU=GP;var Rx=ZP;var cI=fw,wp=ep,nU=lw;var rU=dw,uc=QP;var Ox=tp;var oU=hw;var sU=XP;var _x=xw;var fc=class e extends Bc{run;constructor(t){super(),this.run=t}map(t){return new e((n,r)=>this.run(n,r).pipe(fa(Lt(t))))}compose(t){return iU(this)?t:iU(t)?this:new e((n,r)=>this.run(n,r).pipe(Bn(o=>t.run(o,r))))}};function cV(e){return new fc((t,n)=>G(e(t,n)))}function uI(e){return cV((t,n)=>{let r={message:e(t)};return Te(t)?new Cu(r,t.value,n):new Cu(r)})}var aU=new fc(v);function iU(e){return e.run===aU.run}function Ts(){return aU}function fI(e){return new fc((t,n)=>xe(t)?Es:e(t.value,n))}function De(e){return Mx(Lt(e))}function Zr(e){return fI((t,n)=>e(t,n).pipe(fa(L)))}function Mx(e){return new fc(t=>v(e(t)))}function lI(){return new fc(()=>Es)}function vp(e){return new fc(t=>{let n=za(t,Kn);return Te(n)?v(n):fa(e,L)})}function Ru(){return De(globalThis.String)}function Px(){return De(globalThis.Number)}function cU(){return De(globalThis.BigInt)}function dI(){return De(e=>new globalThis.Date(e))}function uU(){return De(iF)}function fU(e){return fI((t,n)=>Bo({try:()=>L(JSON.parse(t,e?.reviver)),catch:()=>new ke({expected:"a valid JSON string"},t,n)}))}function lU(e){return fI((t,n)=>Bo({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw new TypeError("Value cannot be represented as JSON");return L(r)},catch:()=>new ke({expected:"a JSON-serializable value"},t,n)}))}function pI(){return De(ng)}function Fx(){return De(EO)}function Ux(){return De(IO)}function dU(){return Zr((e,t)=>vu(Rw(Cf(e)),()=>new ke({expected:"a valid Base64 string"},e,t)))}function pU(){return Zr((e,t)=>_o(bO(e),{onFailure:()=>G(new ke({expected:"a valid Base64 string"},e,t)),onSuccess:v}))}function mU(){return Zr((e,t)=>_o(NE(e),{onFailure:()=>G(new ke({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function hU(){return Zr((e,t)=>_o(wO(e),{onFailure:()=>G(new ke({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function gU(){return Zr((e,t)=>_o(BE(e),{onFailure:()=>G(new ke({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function xU(){return Zr((e,t)=>_o(vO(e),{onFailure:()=>G(new ke({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function yU(){return De(encodeURIComponent)}function SU(){return Zr((e,t)=>{try{return v(globalThis.decodeURIComponent(e))}catch{return G(new ke({expected:"a valid URI component"},e,t))}})}function mI(){return Zr((e,t)=>rr(Ax(e),{onNone:()=>G(new ke({message:"Invalid DateTime input"},e,t)),onSome:n=>v(Rx(n))}))}function bU(){return De(e=>vU(Array.from(e.entries())))}var uV=TU(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function EU(){return De(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&uV(e).forEach(([r,o])=>{t.append(r,o)}),t})}function wU(){return De(e=>vU(Array.from(e.entries())))}var fV=TU(io);function IU(){return De(e=>typeof e=="object"&&e!==null?new URLSearchParams(fV(e)):new URLSearchParams)}var lV=/^\d+$/;function dV(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map(o=>lV.test(o)?globalThis.Number(o):o)}function vU(e){let t={},n=new WeakSet;function r(o,s,i){let a=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(a)&&Array.isArray(a)===i)return a;let c=i?[]:{};return n.add(c),W(o,s,c),c}return e.forEach(([o,s])=>{let i=dV(o),a=t;i.forEach((c,u)=>{let f=u===i.length-1;if(Array.isArray(a)&&c==="")if(f)a.push(s);else{let l=i[u+1],p=typeof l=="number"||l==="",m=a.length;a=r(a,m,p)}else if(f){let l=Object.hasOwn(a,c);l&&Array.isArray(a[c])?a[c].push(s):l?W(a,c,[a[c],s]):W(a,c,s)}else{let l=i[u+1];a=r(a,c,typeof l=="number"||l==="")}})}),t}function TU(e){return t=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(a=>{n.push([o,a])}):s.forEach((a,c)=>{r(`${o}[${c}]`,a)});else if(typeof s=="object"&&s!==null)for(let[i,a]of Object.entries(s))r(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))r(o,s);return n}}var kp=class e{_tag="Middleware";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}},Tp="~effect/SchemaTransformation/Transformation",et=class e{[Tp]=Tp;_tag="Transformation";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function pV(e){return j(e,Tp)&&e[Tp]===Tp}var Nx=e=>pV(e)?e:new et(e.decode,e.encode);function Ar(e){return new et(Zr(e.decode),Zr(e.encode))}function vt(e){return new et(De(e.decode),De(e.encode))}function Lx(e){return new et(Mx(e.decode),Mx(e.encode))}function kU(){return new et(uU(),Ts())}var mV=new et(Ts(),Ts());function pl(){return mV}var ml=new et(Px(),Ru()),Bx=new et(cU(),Ru()),hI=new et(dI(),De(eE)),CU=new et(dI(),De(e=>e.getTime())),AU=Ar({decode:(e,t)=>rr(iO(e),{onNone:()=>G(new ke({expected:"a valid Duration string"},e,t)),onSome:v}),encode:e=>v(globalThis.String(e))}),RU=Ar({decode:e=>v(Lr(e)),encode:(e,t)=>rr(aO(e),{onNone:()=>G(new ke({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>v(n)})}),OU=vt({decode:e=>us(e),encode:e=>Tn(e)}),hV=e=>en(e)&&typeof e.message=="string",_U=e=>{let n=Object.hasOwn(e,"cause")?new Error(e.message,{cause:PU(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(n.name=e.name),typeof e.stack=="string"&&(n.stack=e.stack),n},gV=e=>{try{let t=Kc(e);return t===void 0?X(e):JSON.parse(t)}catch{return X(e)}},xV=(e,t,n)=>{let r={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},MU=e=>{let t=new WeakSet,n=r=>{if(qA(r)){if(t.has(r))return"[Circular]";t.add(r);let o=xV(r,e,n);return t.delete(r),o}return gV(r)};return n},PU=e=>hV(e)?_U(e):e,FU=e=>vt({decode:_U,encode:t=>MU(e)(t)}),UU=e=>vt({decode:PU,encode:MU(e)});function DU(){return vt({decode:fE,encode:Od})}function NU(){return vt({decode:uE,encode:Oo})}function LU(e){return vt({decode:Xc,encode:e?.onNoneEncoding===null?Od:Oo})}function BU(){return Lx({decode:L,encode:eu})}function jU(){return Lx({decode:e=>e.pipe(za(Kn),L),encode:eu})}var gI=Ar({decode:(e,t)=>URL.canParse(e)?v(new URL(e)):G(new ke({expected:"a valid URL string"},e,t)),encode:e=>v(e.href)}),xI=Ar({decode:(e,t)=>{let n=BR(e);return xe(n)?G(new ke({expected:"a valid BigDecimal string"},e,t)):v(n.value)},encode:e=>v(Xs(e))}),yI=new et(dU(),pI()),qU=new et(pU(),pI()),$U=new et(hU(),Fx()),zU=new et(xU(),Ux()),HU=new et(SU(),yU());function WU(e){return new et(fU(e??{}),lU(e))}var KU=new et(bU(),EU()),VU=new et(wU(),IU()),JU=vt({decode:e=>wp(e),encode:e=>e.offset}),SI=Ar({decode:(e,t)=>rr(nU(e),{onNone:()=>G(new ke({expected:"a valid IANA time zone"},e,t)),onSome:v}),encode:e=>v(e.id)}),bI=Ar({decode:(e,t)=>rr(rU(e),{onNone:()=>G(new ke({expected:"a valid time zone"},e,t)),onSome:v}),encode:e=>v(uc(e))}),EI=Ar({decode:(e,t)=>rr(Ax(e),{onNone:()=>G(new ke({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>v(Rx(n))}),encode:e=>v(sU(e))}),wI=Ar({decode:(e,t)=>rr(tU(e),{onNone:()=>G(new ke({expected:"a valid Zoned DateTime string"},e,t)),onSome:v}),encode:e=>v(_x(e))});function dc(e){return t=>t._tag===e}var pc=dc("Declaration");var yV=dc("Never");var hl=dc("Literal"),II=dc("UniqueSymbol");var $I=dc("Arrays"),SV=dc("Objects"),r1=dc("Union"),bV=dc("Suspend"),Dt=class{to;transformation;constructor(t,n){this.to=t,this.transformation=n}},Xr={},Yr=class{isOptional;isMutable;constructorDefault;annotations;constructor(t,n,r=void 0,o=void 0){this.isOptional=t,this.isMutable=n,this.constructorDefault=r,this.annotations=o}},GU="~effect/Schema",Jt=class{[GU]=GU;annotations;checks;encoding;context;constructor(t=void 0,n=void 0,r=void 0,o=void 0){this.annotations=t,this.checks=n,this.encoding=r,this.context=o}toString(){return`<${this._tag}>`}},pa=class e extends Jt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(t,n,r,o,s,i,a,c){super(r,o,s,i),this.typeParameters=t,this.run=n,this.encodingChecks=a,this.encodingRun=c}getParser(){let t;return(n,r)=>n===ze?vs:(t??=this.run(this.typeParameters))(n,this,r)}_rebuild(t,n,r,o,s){let i=xl(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks&&o===this.run&&s===this.encodingRun?this:new e(i,o,this.annotations,n,void 0,this.context,r,s)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let t=this.annotations?.expected;return typeof t=="string"?t:"<Declaration>"}},vI=class extends Jt{_tag="Null";getParser(){return ty(this,null)}getExpected(){return"null"}},zI=new vI;var TI=class extends Jt{_tag="Undefined";getParser(){return ty(this,void 0)}toCodecJson(){return lt(this,[o1])}getExpected(){return"undefined"}},o1=new Dt(zI,new et(De(()=>{}),De(()=>null))),HI=new TI;var kI=class extends Jt{_tag="Void";getParser(){let t=zo(void 0);return n=>n===ze?vs:t}toCodecJson(){return lt(this,[o1])}getExpected(){return"void"}},s1=new kI;var CI=class extends Jt{_tag="Never";getParser(){return As(this,jA)}getExpected(){return"never"}},i1=new CI,AI=class extends Jt{_tag="Any";getParser(){return As(this,$b)}getExpected(){return"any"}},a1=new AI,RI=class extends Jt{_tag="Unknown";getParser(){return As(this,$b)}getExpected(){return"unknown"}},ma=new RI,OI=class extends Jt{_tag="ObjectKeyword";getParser(){return As(this,gd)}getExpected(){return"object | array | function"}},c1=new OI,jx=class extends Jt{_tag="Enum";enums;constructor(t,n,r,o,s){super(n,r,o,s),this.enums=t}getParser(){let t=new Set(this.enums.map(([,n])=>n));return As(this,n=>t.has(n))}toCodecStringTree(){if(this.enums.some(([t,n])=>typeof n=="number")){let t=Object.fromEntries(this.enums.map(([n,r])=>[globalThis.String(r),r]));return lt(this,[new Dt(new Rr(Object.keys(t).map(n=>new Qr(n)),"anyOf"),new et(De(n=>t[n]),Ru()))])}return this}getExpected(){return this.enums.map(([t,n])=>JSON.stringify(n)).join(" | ")}};function u1(e){switch(e._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return!e.checks;case"Union":return!e.checks&&e.types.every(u1);default:return!1}}var qx=class extends Jt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(t,n,r,o,s){super(n,r,o,s);let i=[],a=[];for(let u of t){let f=jn(u);if(u1(f))i.push(f),a.push(f._tag==="Literal"?globalThis.String(f.literal):void 0);else throw new Error(`Invalid TemplateLiteral part ${f._tag}`)}let c=new Array(i.length+1);c[i.length]=0;for(let u=i.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=t,this.encodedParts=i,this.literals=a,this.suffixLengths=c}getParser(t){let n=t(this.asTemplateLiteralParser());return(r,o)=>{if(r===ze)return vs;let s=n(r,o);return s._tag==="Success"?on:fn(s,{onSuccess:()=>r,onFailure:i=>new At(this,[i],r,o)})}}getExpected(){return"string"}matchPart(t,n){return n1(this,t,n)===void 0?void 0:t}asTemplateLiteralParser(){let t=new Cs(!1,this.parts.map(A1),[]);return ey(yi,t,new et(Zr((n,r)=>{let o=n1(this,n,r);return o?v(o):G(new ke({expected:"a string matching template literal parts"},n,r))}),De(n=>n.join(""))))}},$x=class extends Jt{_tag="UniqueSymbol";symbol;constructor(t,n,r,o,s){super(n,r,o,s),this.symbol=t}getParser(){return ty(this,this.symbol)}toCodecStringTree(){return lt(this,[_1])}getExpected(){return globalThis.String(this.symbol)}},Qr=class extends Jt{_tag="Literal";literal;constructor(t,n,r,o,s){if(super(n,r,o,s),typeof t=="number"&&!globalThis.Number.isFinite(t))throw new Error(`A numeric literal must be finite, got ${X(t)}`);this.literal=t}getParser(){return ty(this,this.literal)}matchPart(t,n){return t===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?ZU(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:ZU(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function ZU(e){let t=globalThis.String(e.literal);return lt(e,[new Dt(new Qr(t),new et(De(()=>e.literal),De(()=>t)))])}var _I=class extends Jt{_tag="String";getParser(){return As(this,io)}matchPart(t,n){let r=this.checks;return r&&!n.disableChecks&&Rs(r,t,void 0,this,n)?void 0:t}getExpected(){return"string"}},yi=new _I,MI=class extends Jt{_tag="Number";getParser(){return As(this,md)}matchKey(t,n){return this._match(MV,t,n)}matchPart(t,n){return this._match(BI,t,n)}_match(t,n,r){if(!t.test(n))return;let o=globalThis.Number(n);return r.disableChecks||!this.checks?o:Rs(this.checks,o,void 0,this,r)?void 0:o}toCodecJson(){return this.checks&&(PI(this.checks,"effect/schema/isFinite")||PI(this.checks,"effect/schema/isInt"))?this:lt(this,[kV])}toCodecStringTree(){return this.toCodecJson()===this?lt(this,[PV]):lt(this,[FV])}getExpected(){return"number"}};function PI(e,t){return e.some(n=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&PI(n.checks,t))}var WI=new MI,FI=class extends Jt{_tag="Boolean";getParser(){return As(this,DA)}getExpected(){return"boolean"}},f1=new FI,UI=class extends Jt{_tag="Symbol";getParser(){return As(this,qb)}matchKey(t,n){return n.disableChecks||!this.checks?t:Rs(this.checks,t,void 0,this,n)?void 0:t}toCodecStringTree(){return lt(this,[_1])}getExpected(){return"symbol"}},l1=new UI,DI=class extends Jt{_tag="BigInt";getParser(){return As(this,NA)}matchPart(t,n){if(!jI.test(t))return;let r=globalThis.BigInt(t);return n.disableChecks||!this.checks?r:Rs(this.checks,r,void 0,this,n)?void 0:r}toCodecStringTree(){return lt(this,[DV])}getExpected(){return"bigint"}},d1=new DI,Cs=class e extends Jt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(t,n,r,o,s,i,a,c){super(o,s,i,a),this.isMutable=t,this.elements=n,this.rest=r,this.encodingChecks=c;let u=!1;for(let f=0;f<n.length;f++)if(an(n[f]))u=!0;else if(u)throw new Error("A required element cannot follow an optional element. ts(1257)");if(u&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let f=1;f<r.length;f++)if(an(r[f]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(t,n=t){let r=this,o,s,i=r.elements.length,a=Math.max(0,r.rest.length-1);function c(u,f){return f<i?o[f]:f>=u?s[f-u+1]:s[0]}return Sx(function*(u,f){if(u===ze)return ze;if(!Array.isArray(u))return yield*G(new st(r,u,f));o||(o=r.elements.map(g=>({ast:g,parser:n(g)})),s=r.rest.map(g=>({ast:g,parser:n(g)})));let l=u.length,p={ast:r,getParser:c,input:u,len:l,tailThreshold:Math.max(i,l-a),output:new globalThis.Array(l),issues:void 0,options:f},m=KI(f?.concurrency),h=EV(p,u,{concurrency:m?.concurrency,end:r.rest.length===0?i:Math.max(l,i+a)});if(h&&(yield*h),r.rest.length===0&&l>i)for(let g=i;g<=l-1;g++){let x=new la(r,u[g],f),E=new Ct([g],x);if(f.errors==="all")p.issues?p.issues.push(E):p.issues=[E];else return yield*G(new At(r,[E],u,f))}return p.issues?yield*G(new At(r,p.issues,u,f)):p.output})}_rebuild(t,n,r){let o=xl(this.elements,t),s=xl(this.rest,t);return o===this.elements&&s===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,o,s,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){return"array"}},EV=Jd()({onItem(e,t,n){let r=n<e.len?t:ze;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return zx(e,e.ast,r,n);let o=n===on?t:n[ye];if(o!==ze)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(an(s.ast))return;let i=new Ct([r],new sn(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return Fo(new At(e.ast,[i],e.input,e.options))}}}),KI=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),zx=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=Ep(r.cause);if(o===void 0)return jt(ec(r.cause,i=>new At(t,[new Ct([n],i)],e.input,e.options)));let s=new Ct([n],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Fo(new At(t,[s],e.input,e.options))},Kx="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function ha(e,t,n=Xr){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(a=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter(a=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(a=>i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(ev(jn(t)))}var Rp=class{name;type;constructor(t,n){this.name=t,this.type=n}};function NI(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(NI);default:return!1}}function wV(e){return NI(e)&&NI(jn(e))}var Op=class{parameter;type;constructor(t,n){if(!wV(t))throw new Error(`Invalid index signature parameter ${t._tag}`);if(this.parameter=t,this.type=n,an(n)&&!C1(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},gl=class e extends Jt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(t,n,r,o,s,i,a){super(r,o,s,i),this.propertySignatures=t,this.indexSignatures=n,this.encodingChecks=a;let c=t.map(u=>u.name).filter((u,f,l)=>l.indexOf(u)!==f);if(c.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(c)}. ts(2300)`)}getParser(t,n=t){let r=this,o=[];for(let E of r.propertySignatures)o.push(E.name);let s=o.length,i=r.indexSignatures.length,a=s&&i?new Set(o):void 0;if(!s&&!i)return As(r,Sh);let c,u,f=(E,b,y,w,S)=>{if(S._tag==="Failure")return zx(E,r,b,S)??Vt;let C=S===on?w:S[ye];if(y!==ze&&C!==ze){if(s&&(a.has(b)||a.has(y)))return Vt;W(E.out,y,C)}return Vt},l=(E,b,y,w)=>{if(!w){let _=y.parserKey(b,E.options);if(!xt(_))return R(Vr(_),P=>l(E,b,y,P));w=_}if(w._tag==="Failure")return zx(E,r,b,w)??Vt;let S=w===on?b:w[ye],C=E.input[b],M=y.parserValue(C,E.options);return xt(M)?f(E,b,S,C,M):R(Vr(M),_=>f(E,b,S,C,_))},p=(E,b,y)=>{let w=E.input[b],S=y.parserValue(w,E.options);return xt(S)?f(E,b,b,w,S):R(Vr(S),C=>f(E,b,b,w,C))},m=i?Jd()({onItem:(E,[b,y])=>l(E,b,y),step:(E,b,y)=>y._tag==="Failure"?y:void 0}):void 0,h=()=>(c||(c=r.propertySignatures.map(E=>({parser:n(E.type),name:E.name,type:E.type})),u=i?r.indexSignatures.map(E=>({is:E,parserKey:t(ev(E.parameter)),parserValue:n(E.type)})):void 0),c),g=Sx(function*(E,b){if(E===ze)return ze;if(!(typeof E=="object"&&E!==null&&!Array.isArray(E)))return yield*G(new st(r,E,b));h();let y=E,w={},S={ast:r,input:y,out:w,issues:void 0,options:b},C=b.errors==="all",M=b.onExcessProperty==="error",_=b.onExcessProperty==="preserve",P;if(!i&&(M||_)){a??=new Set(o),P=Reflect.ownKeys(y);for(let F=0;F<P.length;F++){let te=P[F];if(!a.has(te))if(M){let ee=new la(r,y[te],b),T=new Ct([te],ee);if(C){S.issues?S.issues.push(T):S.issues=[T];continue}else return yield*G(new At(r,[T],E,b))}else W(w,te,y[te])}}let $=KI(b?.concurrency);if(s){let F=QU(S,c,$);F&&(yield*F)}if(i&&!$)for(let F=0;F<i;F++){let te=u[F],ee=te.is.parameter===yi?p:l,T=te.is.parameter===yi?Object.keys(y):ha(y,te.is.parameter,b);for(let z=0;z<T.length;z++){let U=ee(S,T[z],te);if(!xt(U))yield*U;else if(U._tag==="Failure")return yield*U}}else if(m){let F=rn();for(let ee=0;ee<i;ee++){let T=u[ee],z=ha(y,T.is.parameter,b);for(let U=0;U<z.length;U++)F.push([z[U],T])}let te=m(S,F,$);te&&(yield*te)}if(S.issues)return yield*G(new At(r,S.issues,E,b));if(b.propertyOrder==="original"){let F=(P??Reflect.ownKeys(y)).concat(o),te={};for(let ee of F)Object.hasOwn(w,ee)&&W(te,ee,w[ee]);return te}return w});if(i)return g;let x=(E,b,y)=>{let w=c[b];return R(Vr(y),S=>{let C=LI(E,w,S);if(C)return C;let M=()=>zo(E.out),_=QU(E,c.slice(b+1));return _?Bn(_,M):M()})};return(E,b)=>{if(E===ze)return vs;if(b.errors==="all"||b.onExcessProperty!==void 0||b.propertyOrder==="original"||b.concurrency!==void 0)return g(E,b);if(!(typeof E=="object"&&E!==null&&!Array.isArray(E)))return G(new st(r,E,b));let y=h(),w=E,S={},C={ast:r,input:w,out:S,issues:void 0,options:b};try{for(let M=0;M<y.length;M++){let _=y[M],P=_.name,$=Object.hasOwn(w,P),F=$?w[P]:ze,te=_.parser(F,b);if(!xt(te))return x(C,M,te);if(te===on){$&&W(S,P,F);continue}let ee=LI(C,_,te);if(ee)return ee}}catch(M){return ho(M)}return zo(S)}}_rebuild(t,n,r,o){let s=xl(this.propertySignatures,a=>{let c=t(a.type);return c===a.type?a:new Rp(a.name,c)}),i=xl(this.indexSignatures,a=>{let c=n(a.parameter),u=t(a.type);return c===a.parameter&&u===a.type?a:new Op(c,u)});return s===this.propertySignatures&&i===this.indexSignatures&&r===this.checks&&o===this.encodingChecks?this:new e(s,i,this.annotations,r,void 0,this.context,o)}flip(t){return this._rebuild(t,t,this.encodingChecks,this.checks)}recur(t,n=t){return this._rebuild(t,n,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function LI(e,t,n){if(n._tag==="Failure")return zx(e,e.ast,t.name,n);if(n===on)return;let r=n[ye];if(r!==ze){W(e.out,t.name,r);return}if(delete e.out[t.name],!an(t.type)){let o=new Ct([t.name],new sn(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Fo(new At(e.ast,[o],e.input,e.options))}}var QU=Jd()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(ze,e.options);let n=e.input[t.name];return W(e.out,t.name,n),t.parser(n,e.options)},step:LI});function VI(e,t){return e?t?[...e,...t]:e:t}function Vx(e,t,n){return new gl(Reflect.ownKeys(e).map(r=>new Rp(r,e[r].ast)),[],n,t)}function _p(e){return e.ast}function JI(e,t=void 0){return new Cs(!1,e.map(n=>n.ast),[],void 0,t)}function Jx(e,t,n){return new Rr(e.map(_p),t,void 0,n)}function p1(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let n=e.propertySignatures,r=e.indexSignatures,o=e.checks;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=VI(o,s.checks);return new gl(n,r,void 0,o)}function m1(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Cs(e.isMutable,e.elements,t,void 0,e.checks)}var Gx=$c(e=>{for(;;){if(bV(e))return ma;let t=e.encoding;if(!t)return e.recur?.(Gx,B)??e;if(t.some(n=>n.transformation._tag==="Middleware"&&n.transformation.decode!==B))return ma;e=t[t.length-1].to}});function h1(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(h1)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function lc(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[xp];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let n=t.type;if(!an(n)){if(hl(n))return[{key:t.name,literal:n.literal}];if(II(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!an(t)){if(hl(t))return[{key:n,literal:t.literal}];if(II(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(n=>lc(Gx(n)));return t[0].filter(n=>t.every(r=>r.some(o=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return lc(e.thunk())}}var YU=new WeakMap,Ap=Object.freeze([]);function IV(e){let t=YU.get(e);if(t)return t;let n,r=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],u=Gx(c);if(yV(u))continue;if(i)if(hl(u)||II(u)){s??=new Map;let l=hl(u)?u.literal:u.symbol,p=s.get(l);p||s.set(l,p=[]),p.push(c)}else i=!1;let f=lc(u);if(f.length){n??=new Map,r++;for(let{key:l,literal:p}of f){let m=n.get(l);m||n.set(l,m=[new Map,new Set]),m[1].add(a);let h=m[0].get(p);h||m[0].set(p,h=new Set),h.add(a)}}else{o??={};let l=h1(u);for(let p of l)(o[p]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=a=>s.get(a)??Ap;else if(n?.size===1&&!o){let[a,[c]]=n.entries().next().value,u=c;for(let[f,l]of c)u.set(f,Object.freeze(Array.from(l,p=>e[p])));t=(f,l)=>{if(gd(f)){let p=Object.hasOwn(f,a)?f[a]:void 0;if(p!==void 0)return u.get(p)??Ap;if(l)return e}return Ap}}else if(n){let a;for(let c of n)(!a||c[1][0].size>a[1][0].size)&&c[1][1].size===r&&(a=c);t=(c,u)=>{let f=c===null?"null":Array.isArray(c)?"array":typeof c,l=o?.[f]??Ap;if(!gd(c))return l.map(h=>e[h]);let p=new Set(l),m;if(a){let[h,[g]]=a,x=Object.hasOwn(c,h),E=x?c[h]:void 0;if(x&&(!u||E!==void 0)){let b=g.get(E);if(!b)return l.map(y=>e[y]);for(let y of b)p.add(y);m=h}}if(m===void 0)for(let[h,[g,x]]of n){let E=Object.hasOwn(c,h),b=E?c[h]:void 0;if(E&&(!u||b!==void 0)){let y=g.get(b);if(y)for(let w of y)p.add(w)}else if(u)for(let y of x)p.add(y)}for(let[h,[g,x]]of n){if(h===m)continue;let E=Object.hasOwn(c,h),b=E?c[h]:void 0;if(E&&(!u||b!==void 0)){let y=g.get(b);for(let w of p)x.has(w)&&!y?.has(w)&&p.delete(w)}}return Array.from(p).sort((h,g)=>h-g).map(h=>e[h])}}else t=a=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??Ap).map(u=>e[u]).filter(vV(a))};return YU.set(e,t),t}function vV(e){return t=>{let n=Gx(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Mp(e,t,n=!1){return IV(t)(e,n)}var Rr=class e extends Jt{_tag="Union";types;mode;encodingChecks;constructor(t,n,r,o,s,i,a){super(r,o,s,i),this.types=t,this.mode=n,this.encodingChecks=a}getParser(t,n){let r=this;return(o,s)=>{if(o===ze)return vs;let i=Mp(o,r.types,n!==void 0);if(i.length===1){let f=t(i[0])(o,s);return f._tag==="Success"?f:xt(f)?XU(r,f.cause,o,s):ft(f,l=>XU(r,l,o,s))}let a={ast:r,compile:t,input:o,out:void 0,successes:r.mode==="oneOf"?[]:void 0,issues:void 0,options:s},c=KI(s?.concurrency),u=TV(a,i,c?{...c,orderedStep:!0}:void 0);return u?Bn(u,f=>a.out===on?v(o):a.out?a.out:G(new ll(r,a.issues??[],o,s))):a.out?a.out:G(new ll(r,a.issues??[],o,s))}}_rebuild(t,n,r){let o=xl(this.types,t);return o===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(o,this.mode,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}matchPart(t,n){for(let r of this.types){let o=r.matchPart(t,n);if(o!==void 0)return o}}getExpected(t){let n=this.annotations?.expected;if(typeof n=="string")return n;if(this.types.length===0)return"never";let r=this.types.map(o=>{let s=jn(o);switch(s._tag){case"Arrays":{let i=s.elements.filter(hl);if(i.length>0)return`${e1(s.isMutable)}[ ${i.map(a=>t(a)+t1(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=s.propertySignatures.filter(a=>hl(a.type));if(i.length>0)return`{ ${i.map(a=>`${e1(a.type.context?.isMutable)}${qi(a.name)}${t1(a.type.context?.isOptional)}: ${t(a.type)}`).join(", ")}, ... }`;break}}return t(s)});return Array.from(new Set(r)).join(" | ")}};function XU(e,t,n,r){let o=Ep(t);return o?Fo(new ll(e,[o],n,r)):jt(t)}var TV=Jd()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=Ep(n.cause);if(r===void 0)return n;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),Fo(new kx(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Vt}}}),g1=new Rr([new Qr("Infinity"),new Qr("-Infinity"),new Qr("NaN")],"anyOf");function e1(e){return e?"":"readonly "}function t1(e){return e?"?":""}function _u(e){let t=!1,n;return()=>(t||(n=e(),t=!0),n)}var Hx=class e extends Jt{_tag="Suspend";thunk;constructor(t,n,r,o,s){if(r)throw new Error("Cannot add checks to Suspend");super(n,void 0,o,s),this.thunk=_u(t)}getParser(t){let n;return(r,o)=>(n??=t(this.thunk()))(r,o)}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(t){return t(this.thunk())}},Wx=class e extends Bc{_tag="Filter";run;annotations;aborted;constructor(t,n=void 0,r=!1){super(),this.run=t,this.annotations=n,this.aborted=r}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(t,n){return new Ou([this,t],n)}},Ou=class e extends Bc{_tag="FilterGroup";checks;annotations;constructor(t,n=void 0){super(),this.checks=t,this.annotations=n}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function Zx(e,t,n=!1){return new Wx((r,o,s)=>$F(o,e(r,o,s),r,s),t,n)}function Qx(e,t){return new Wx((n,r,o)=>e(n)?void 0:new ke(void 0,n,o),t,!0)}function GI(e){return Zx(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var ZI=Si(WI,[GI()]),kV=new Dt(new Rr([ZI,g1],"anyOf"),new et(Px(),De(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Pp(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return Zx(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Fp(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var x1=new WeakMap;function QI(e){return x1.get(e)??e}function lt(e,t){return e.encoding===t?e:Fp(e,n=>{n.encoding.value=t})}function Up(e,t){if(e.context===t)return e;let n=QI(e);if(n.context===t)return n;let r=Fp(e,o=>{o.context.value=t});return x1.set(r,n),r}function Dp(e){return e.encoding?Dp(e.encoding[e.encoding.length-1].to):e}function Ho(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Yx(e,Kh(e.checks.slice(0,-1),n.annotate(t)))}return Fp(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Yx(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Fp(e,n=>{n.checks.value=t})}function Si(e,t){return Yx(e,VI(e.checks,t))}function mc(e,t){let n=t(e.to);return n===e.to?e:new Dt(n,e.transformation)}function y1(e,t){let n=e,r=n[n.length-1],o=mc(r,t);return o===r?e:Kh(e.slice(0,e.length-1),o)}function Xx(e){return t=>t.encoding?lt(t,y1(t.encoding,e)):t}function Sl(e,t){return Xx(n=>Up(n,t))(e)}function ga(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:lt(r,y1(r.encoding,n))}return e(r)}return $c(n)}function S1(e,t){return YI(e,t,yn(e))}function b1(e,t){return YI(jn(e),t,e)}function YI(e,t,n){let r=new Dt(e,t);return lt(n,n.encoding?[...n.encoding,r]:[r])}function E1(e,t){let n=BF(e),r=n?[...n,t]:[t];return Ho(e,{brands:r})}function xl(e,t){let n=!1,r=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);i!==s&&(n=!0),r[o]=i}return n?r:e}function bl(e,t){let n=e.context?new Yr(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Yr(!1,!1,void 0,t);return Up(e,n)}var El=$c(e=>{let t=e.context?e.context.isOptional===!1?new Yr(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Yr(!0,!1);return CV(Up(e,t))}),CV=Xx(El),w1=wn(e=>El(new Rr([e,HI],"anyOf"))),XI=$c(e=>{let t=e.context?e.context.isMutable===!1?new Yr(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Yr(!1,!0);return AV(Up(e,t))}),AV=Xx(XI);function I1(e,t){let n=new et(vp(t),Ts()),r=new Dt(ma,n),o=e.context?new Yr(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new Yr(!1,!1,r);return Up(e,o)}function ey(e,t,n){return YI(e,n,t)}function RV(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":yh(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)r(o.types[s]);return;default:n.push(o)}}return r(e),{literals:t,parameters:n}}function v1(e,t){let{literals:n,parameters:r}=RV(e);return new gl(n.map(o=>new Rp(o,t)),r.map(o=>new Op(o,t)))}function an(e){return e.context?.isOptional??!1}function T1(e){return e.context?.isMutable??!1}function k1(e){return e.annotations?.[Gr]===!0||e._tag==="FilterGroup"&&e.checks.every(k1)}function OV(e){function t(r){return k1(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return Vn(n)?n:void 0}var yn=$c(e=>{if(e.encoding)return yn(lt(e,void 0));let t=e,n=t.recur?.(yn)??t,r=n.encodingChecks;if(r){let o=n===e?r:$I(n)||SV(n)||pc(n)&&n.typeParameters.length>0?OV(r):void 0;return Fp(n,s=>{s.encodingChecks.value=void 0,s.checks.value=VI(n.checks,o)})}return n}),jn=$c(e=>yn(ks(e)));function _V(e,t){let n=t,r=n.length,o=n[r-1],s=[new Dt(ks(lt(e,void 0)),n[0].transformation.flip())];for(let a=1;a<r;a++)s.unshift(new Dt(ks(n[a-1].to),n[a].transformation.flip()));let i=ks(o.to);return i.encoding?lt(i,[...i.encoding,...s]):lt(i,s)}var ks=wn(e=>{if(e.encoding)return _V(e,e.encoding);let t=e;return t.flip?.(ks)??t.recur?.(ks)??t});function C1(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(C1);default:return!1}}function ty(e,t){let n=zo(t);return(r,o)=>r===ze?vs:r===t?n:G(new st(e,r,o))}function As(e,t){return(n,r)=>n===ze?vs:t(n)?on:G(new st(e,n,r))}function n1(e,t,n){let r=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(r.length),a;function c(u,f){if(u===r.length)return f===s;if(a?.has(u*(s+1)+f))return!1;let l=r[u];if(u===r.length-1){let p=t.slice(f);if(l.matchPart(p,n)!==void 0)return i[u]=p,!0}else if(l._tag==="Literal"){let p=o[u];if(t.startsWith(p,f)&&c(u+1,f+p.length))return i[u]=p,!0}else{let p=s-e.suffixLengths[u+1],m=o[u+1],h=m===void 0?p:t.lastIndexOf(m,p);for(;h>=f;){let g=t.slice(f,h);if(l.matchPart(g,n)!==void 0&&c(u+1,h))return i[u]=g,!0;if(h===0)break;h=m===void 0?h-1:t.lastIndexOf(m,h-1)}}return a??=new Set,a.add(u*(s+1)+f),!1}return c(0,0)?i:void 0}var Np=wn(e=>new Rr(e.enums.map(t=>new Qr(t[1],{title:t[0]})),"anyOf")),ev=ga(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(ev)}}),ny=ga(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(ny)}}),A1=ga(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(A1)}}),R1="[\\s\\S]*?",BI=new globalThis.RegExp(`^${Kx}$`),MV=new globalThis.RegExp(`^(?:${Kx}|Infinity|-Infinity|NaN)$`);function tv(e){return Pp(BI,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:BI.source}),...e})}var O1=Si(yi,[tv()]),PV=new Dt(O1,ml),FV=new Dt(new Rr([O1,g1],"anyOf"),ml),UV="-?\\d+",jI=new globalThis.RegExp(`^${UV}$`);function nv(e){return Pp(jI,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:jI.source}),...e})}var rv=Si(yi,[nv({expected:"a string representing a bigint"})]),DV=new Dt(rv,Bx),NV="Symbol\\((.*)\\)",qI=new globalThis.RegExp(`^${NV}$`),LV=Si(yi,[ov()]),_1=new Dt(LV,new et(De(e=>globalThis.Symbol.for(qI.exec(e)[1])),Zr((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?v(globalThis.String(e)):G(new Cu({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function ov(e){return Pp(qI,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:qI.source}),...e})}function Rs(e,t,n,r,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(n=Rs(i.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=i.run(t,r,o);if(a){let c=new vx(i,a,t,o);if(n?n.push(c):n=[c],o.errors!=="all"||i.aborted)return n}}}return n}function M1(e,t){let n=Rs(e,t,void 0,ma,{errors:"all"});if(n){let r=new At(ma,n);return Ae(r)}return Ce(t)}function P1(e){if(!pc(e))return;let t=e.annotations?.[bx];return cn(t)?t(e.typeParameters):void 0}function BV(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function jV(e){return e===void 0||typeof e=="string"}function F1(e,t){let n=new WeakMap,r=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=n.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(o,!1),r.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}for(;r.length>0;){let o=r[r.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}n.set(o.value,!0),r.pop()}return!0}}function wl(e){return F1(e,BV)}var yl=new pa([],()=>(e,t,n)=>wl(e)?on:G(new st(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>iv,toArbitrary:()=>e=>e.jsonValue()}),U1=Ho(yl,{representation:{id:"effect/schema/MutableJson",payload:null}}),sv=new Dt(yl,pl()),D1=new Dt(new Rr([new Cs(!1,[],[yl]),new gl([],[new Op(yi,yl)])],"anyOf"),pl());function qV(e){return F1(e,jV)}var $V=new pa([],()=>(e,t,n)=>qV(e)?on:G(new st(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{}}),iv=new Dt($V,pl());var N1="~effect/collections/MutableHashMap";var zV={[N1]:N1,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${X(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:hn(Array.from(this))}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},hc=()=>{let e=Object.create(zV);return e.backing=new Map,e.buckets=new Map,e};var Os=d(2,(e,t)=>{if(e.backing.has(t))return L(e.backing.get(t));if(av(t))return D();let n=Lp.get(e);if(n!==void 0)return e.backing.has(n)?L(e.backing.get(n)):D();let r=ce(t),o=e.buckets.get(r);return o===void 0?D():HV(e,o,t)}),Lp=new WeakMap,av=e=>typeof e!="object"&&typeof e!="function";var HV=(e,t,n)=>{for(let r=0,o=t.length;r<o;r++)if(ae(n,t[r])){let s=t[r];return Lp.set(n,s),L(e.backing.get(s))}return D()},L1=d(2,(e,t)=>Te(Os(e,t))),gc=d(3,(e,t,n)=>{if(e.backing.has(t)||av(t))return e.backing.set(t,n),e;let r=Lp.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let o=ce(t),s=e.buckets.get(o);return s===void 0?(e.buckets.set(o,[t]),e.backing.set(t,n),e):(r=WV(s,t),r===void 0&&(s.push(t),r=t),e.backing.set(r,n),e)}),WV=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(ae(t,e[n]))return Lp.set(t,e[n]),e[n]};var Mu=d(2,(e,t)=>{if(av(t))return e.backing.delete(t),e;let n=Lp.get(e)??t,r=ce(n),o=e.buckets.get(r);if(o===void 0)return e;for(let s=0,i=o.length;s<i;s++){let a=o[s];if(a===n||ae(n,a)){e.backing.delete(a),o.splice(s,1);break}}return o.length===0&&e.buckets.delete(r),e}),ry=e=>(e.backing.clear(),e.buckets.clear(),e),B1=e=>e.backing.size;var j1="~effect/collections/Chunk";function GV(e,t,n,r,o){for(let s=t;s<Math.min(e.length,t+o);s++)n[r+s-t]=e[s];return n}var q1=[],uv=e=>un((t,n)=>t.length===n.length&&Bp(t).every((r,o)=>e(r,jp(n,o)))),ZV=uv(ae),QV={[j1]:{_A:e=>e},toString(){return`Chunk(${X(Bp(this))})`},toJSON(){return{_id:"Chunk",values:hn(Bp(this))}},[at](){return this.toJSON()},[_e](e){return Il(e)&&ZV(this,e)},[Oe](){return Fa(Bp(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return q1[Symbol.iterator]();default:return Bp(this)[Symbol.iterator]()}},pipe(){return ie(this,arguments)}},fv=e=>{let t=Object.create(QV);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=xa,t.right=xa;break}case"ISingleton":{t.length=1,t.depth=0,t.left=xa,t.right=xa;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=xa,t.right=xa;break}}return t},Il=e=>j(e,j1),xa=fv({_tag:"IEmpty"}),YV=()=>xa;var XV=e=>fv({_tag:"ISingleton",a:e}),sy=e=>Il(e)?e:tJ(ht(e)),cv=(e,t,n)=>{switch(e.backing._tag){case"IArray":{GV(e.backing.array,0,t,n,e.length);break}case"IConcat":{cv(e.left,t,n),cv(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;for(;r<e.length;)t[o]=jp(e,r),r+=1,o+=1;break}}};var eJ=e=>{switch(e.backing._tag){case"IEmpty":return q1;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return cv(e,t,0),e.backing={_tag:"IArray",array:t},e.left=xa,e.right=xa,e.depth=0,t}}},Bp=eJ;var tJ=e=>e.length===0?YV():e.length===1?XV(e[0]):fv({_tag:"IArray",array:e});var jp=d(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw new Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw new Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw new Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?jp(e.left,n):jp(e.right,n-e.left.length);case"ISlice":return jp(e.backing.chunk,n+e.backing.offset)}});var $1=e=>e.length;var z1=d0;var vl=GO,iy=ZO,bo=Sg;var Ei=ea,ya=UM;var fr=Lg,H1=$M;var W1="~effect/MutableRef",nJ={[W1]:W1,...vn,toJSON(){return{_id:"MutableRef",current:hn(this.current)}}},$p=e=>{let t=Object.create(nJ);return t.current=e,t};var K1=e=>e.current;var dv=d(2,(e,t)=>(e.current=t,e));var Or=Symbol.for("effect/MutableList/Empty"),Ea=()=>({head:void 0,tail:void 0,length:0}),V1=()=>({array:[],mutable:!0,offset:0,next:void 0}),eo=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=V1(),e.tail=e.tail.next):e.head=e.tail=V1(),e.tail.array.push(t),e.length++},mv=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var ay=(e,t)=>cy(e,ht(t),!Array.isArray(t)),cy=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},ba=e=>{e.head=e.tail=void 0,e.length=0},Pu=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return ba(e),s}let n=new Array(t),r=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(n[r++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,r===t)return e.head=o,e.length-=t,e.length===0&&ba(e),n;o=o.next}return ba(e),n},zp=(e,t)=>{if(t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){ba(e);return}let n=0,r=e.head;for(;r;){let o=r.array.length-r.offset;if(n+o>t){r.offset+=t-n,e.head=r,e.length-=t;return}n+=o,r=r.next}ba(e)},Fu=e=>Pu(e,e.length),_s=e=>{if(!e.head)return Or;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:ba(e)),t},J1=(e,t)=>{if(t<=0)return[];let n=Math.min(t,e.length),r=new Array(n),o=0,s=e.head;for(;s;){for(let i=s.offset;i<s.array.length;i++)if(r[o++]=s.array[i],o===n)return r;s=s.next}return r};var hv=(e,t)=>{let n=[],r=e.head;for(;r;){for(let o=r.offset;o<r.array.length;o++)t(r.array[o],o)&&n.push(r.array[o]);r=r.next}if(n.length===0){ba(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},G1=(e,t)=>hv(e,n=>n!==t);var rJ="~effect/PubSub",oJ="~effect/PubSub/Subscription",dy=e=>se(()=>fJ(e.atomicPubSub(),new Map,zr(),fr(!1),$p(!1),e.strategy())),py=e=>dy({atomicPubSub:()=>Av(e),strategy:()=>new kv}),my=e=>dy({atomicPubSub:()=>Av(e),strategy:()=>new fy}),hy=e=>dy({atomicPubSub:()=>Av(e),strategy:()=>new Cv}),Hp=e=>dy({atomicPubSub:()=>sJ(e),strategy:()=>new fy}),Av=e=>{let t=typeof e=="number"?{capacity:e}:e;lJ(t.capacity);let n=t.replay&&t.replay>0?new ly(Math.ceil(t.replay)):void 0;return t.capacity===1?new bv(n):nF(t.capacity)===t.capacity?new yv(t.capacity,n):new gv(t.capacity,n)},sJ=e=>{let t=e?.replay;return new wv(t&&t>0?new ly(Math.ceil(t)):void 0)};var Wp=e=>mi(xn(t=>(dv(e.shutdownFlag,!0),Je(e.scope,Wg(t.id)).pipe(Dn(e.strategy.shutdown),mx(e.shutdownHook.open),jo))));var kl=d(2,(e,t)=>K(()=>e.shutdownFlag.current?v(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),v(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),Z1=d(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Q1=d(2,(e,t)=>K(()=>{if(e.shutdownFlag.current)return v(!1);let n=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),n.length===0?v(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,n,e.shutdownFlag)})),Kp=e=>mi(cr(t=>{let n=$e(t,It),r=Cn(e.scope),o=uJ(e.pubsub,e.subscribers,e.strategy);return _t(r,iJ(o)).pipe(Dn(Do(n,s=>Je(r,s))),zt(o))})),iJ=e=>mi(xn(t=>(dv(e.shutdownFlag,!0),Lo(Fu(e.pollers),n=>X0(n,t.id),{discard:!0,concurrency:"unbounded"}).pipe(Mt(()=>se(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),mx(e.shutdownHook.open),jo)))),gy=e=>K(()=>{if(e.shutdownFlag.current)return xo;if(e.replayWindow.remaining>0){let n=e.replayWindow.take();return v(n)}let t=e.pollers.length===0?e.subscription.poll():Or;return t===Or?X1(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),v(t))}),Y1=e=>K(function t(n){if(e.shutdownFlag.current)return xo;let r=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?v(e.replayWindow.takeAll().concat(r)):Vn(r)?v(r):R(X1(e),o=>t([o]))}),X1=e=>{let t=pu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),eo(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),pi(mu(t),()=>(G1(e.pollers,t),H))};var Gt=Symbol.for("effect/PubSub/AbsentValue"),aJ=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},cJ=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},uJ=(e,t,n)=>new vv(e,t,e.subscribe(),Ea(),fr(!1),$p(!1),n,e.replayWindow()),gv=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.replayIndices=n?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}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 n=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let r=this.publisherIndex%this.capacity;this.array[r]=t,n!==void 0&&(this.replayIndices[r]=n),this.subscribers[r]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t),r=n.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(r,s);if(i===0)return n;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=n[a++],f=this.publisherIndex%this.capacity;this.array[f]=u;let l=this.replayBuffer?.offer(u);l!==void 0&&(this.replayIndices[f]=l),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return n.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,n=this.array[t];this.array[t]=Gt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(n,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new xv(this,this.publisherIndex,!1)}},xv=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}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 Or;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,n=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,n}return Or}pollUpTo(t){if(this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return[];let o=[],s=this.subscriberIndex+r;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]=Gt,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]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},yv=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.replayIndices=n?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}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 n=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let r=this.publisherIndex&this.mask;this.array[r]=t,n!==void 0&&(this.replayIndices[r]=n),this.subscribers[r]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t),r=n.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(r,s);if(i===0)return n;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=n[a++],f=this.publisherIndex&this.mask;this.array[f]=u;let l=this.replayBuffer?.offer(u);l!==void 0&&(this.replayIndices[f]=l),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return n.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,n=this.array[t];this.array[t]=Gt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(n,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new Sv(this,this.publisherIndex,!1)}},Sv=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}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 Or;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,n=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,n}return Or}pollUpTo(t){if(this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return[];let o=[],s=this.subscriberIndex+r;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]=Gt,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]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},bv=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=Gt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}pipe(){return ie(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 n=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,n!==void 0&&(this.replayIndex=n),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t);return n.length===0?n:this.publish(n[0])?n.slice(1):n}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=Gt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new Ev(this,this.publisherIndex,!1)}},Ev=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return Or;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt),this.subscriberIndex+=1,t}pollUpTo(t){if(this.isEmpty()||t<1)return[];let n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt),this.subscriberIndex+=1,[n]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt)))}},wv=class{publisherHead={value:Gt,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 Tl(this.replayBuffer):xy}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let n=this.replayBuffer?.offer(t),r=this.publisherTail.subscribers;if(r!==0){let o={value:t,replayIndex:n,subscribers:r,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 n of t)this.publish(n);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,n=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=Gt,this.subscribersIndex+=1,this.replayBuffer?.slide(n,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new Iv(this,this.publisherTail,this.publisherIndex,!1)}},Iv=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,n,r,o){this.self=t,this.subscriberHead=n,this.subscriberIndex=r,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,n=!0;for(;n;)this.subscriberHead===this.self.publisherTail?n=!1:this.subscriberHead.next.value!==Gt?(t=!1,n=!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 Or;let t=!0,n=Or;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let r=this.subscriberHead.next.value;r!==Gt&&(n=r,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return n}pollUpTo(t){let n=[],r=0;for(;r!==t;){let o=this.poll();o===Or?r=t:(n.push(o),r+=1)}return n}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Gt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},vv=class{[oJ]={_A:B};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(t,n,r,o,s,i,a,c){this.pubsub=t,this.subscribers=n,this.subscription=r,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=i,this.strategy=a,this.replayWindow=c}pipe(){return ie(this,arguments)}},Tv=class{[rJ]={_A:B};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;constructor(t,n,r,o,s,i){this.pubsub=t,this.subscribers=n,this.scope=r,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=i}pipe(){return ie(this,arguments)}},fJ=(e,t,n,r,o,s)=>new Tv(e,t,n,r,o,s),lJ=e=>{if(e<=0)throw new Error(`Cannot construct PubSub with capacity of ${e}`)},kv=class{publishers=Ea();get shutdown(){return xn(t=>Lo(Fu(this.publishers),([n,r,o])=>o?X0(r,t.id):H,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,n,r,o){return K(()=>{let s=pu();return this.offerUnsafe(r,s),this.onPubSubEmptySpaceUnsafe(t,n),this.completeSubscribersUnsafe(t,n),(K1(o)?xo:mu(s)).pipe(pi(()=>(this.removeUnsafe(s),H)))})}onPubSubEmptySpaceUnsafe(t,n){let r=!0;for(;r&&!t.isFull();){let o=_s(this.publishers);if(o===Or)r=!1;else{let[s,i]=o,a=t.publish(s);a&&o[2]?Jf(i,kn(!0)):a||mv(this.publishers,o),this.completeSubscribersUnsafe(t,n)}}}completePollersUnsafe(t,n,r,o){return Rv(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return Ov(this,t,n)}offerUnsafe(t,n){let r=t[Symbol.iterator](),o=r.next();if(!o.done)for(;;){let s=o.value;if(o=r.next(),o.done){eo(this.publishers,[s,n,!0]);break}eo(this.publishers,[s,n,!1])}}removeUnsafe(t){hv(this.publishers,([n,r])=>r!==t)}},fy=class{get shutdown(){return H}handleSurplus(t,n,r,o){return v(!1)}onPubSubEmptySpaceUnsafe(t,n){}completePollersUnsafe(t,n,r,o){return Rv(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return Ov(this,t,n)}},Cv=class{get shutdown(){return H}handleSurplus(t,n,r,o){return se(()=>(this.slidingPublishUnsafe(t,r),this.completeSubscribersUnsafe(t,n),!0))}onPubSubEmptySpaceUnsafe(t,n){}completePollersUnsafe(t,n,r,o){return Rv(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return Ov(this,t,n)}slidingPublishUnsafe(t,n){let r=n[Symbol.iterator](),o=r.next();if(!o.done&&t.capacity>0){let s=o.value,i=!0;for(;i;){t.slide();let a=t.publish(s);a&&(o=r.next())&&!o.done?s=o.value:a&&(i=!1)}}}},Rv=(e,t,n,r,o)=>{let s=!0;for(;s&&!r.isEmpty();){let i=_s(o);if(i===Or)cJ(n,r,o),o.length===0?s=!1:aJ(n,r,o);else{let a=r.poll();a===Or?mv(o,i):(Jf(i,kn(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},Ov=(e,t,n)=>{for(let[r,o]of n)for(let s of o)e.completePollersUnsafe(t,n,r,s)},ly=class{capacity;head={value:Gt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,n){this.slideValues[this.index%this.capacity]={value:t,index:n},this.index++}offer(t){let n=this.publisherIndex++;return this.tail.value=t,this.tail.index=n,this.tail.next={value:Gt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,n}offerAll(t){for(let n of t)this.offer(n)}},Tl=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 n=t.head;for(let r=0;r<this.remaining;r++)this.values[r]=n.value,this.newestIndex=n.index,n=n.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 n=Math.min(t,this.buffer.capacity),r=this.buffer.index-n;for(let o=0;o<n;o++){let s=this.buffer.slideValues[(r+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]=Gt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){let n=Math.min(t,this.remaining),r=new Array(n);for(let o=0;o<n;o++)r[o]=this.take();return r}takeAll(){return this.takeN(this.remaining)}},xy={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var dJ="~effect/Queue",pJ="~effect/Queue/Enqueue",mJ="~effect/Queue/Dequeue";var _v={_A:B,_E:B},hJ={[dJ]:_v,[pJ]:_v,[mJ]:_v,...vn,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:xJ(this)}}},to=e=>pe(t=>{let n=Object.create(hJ);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=Ea(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},J(n)}),Uu=e=>to({capacity:e});var Vp=()=>to(),Xn=(e,t)=>he(()=>{if(e.state._tag!=="Open")return by;if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return by;case"suspend":return e.capacity<=0&&e.state.takers.size>0?(eo(e.messages,t),Mv(e),Sy):EJ(e,t);case"sliding":return _s(e.messages),eo(e.messages,t),Sy}return eo(e.messages,t),Ey(e),Sy}),Al=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(_s(e.messages),eo(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(eo(e.messages,t),Mv(e),!0):!1:(eo(e.messages,t),Ey(e),!0),wa=(e,t)=>he(()=>{if(e.state._tag!=="Open")return J(ht(t));let n=wy(e,t);return n.length===0?rt([]):e.strategy==="dropping"?J(n):wJ(e,n)}),wy=(e,t)=>{if(e.state._tag!=="Open")return ht(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return ay(e.messages,t),e.strategy==="sliding"&&Pu(e.messages,e.messages.length-e.capacity),Ey(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return ht(t);let r=[],o=0;for(let s of t)o<n?eo(e.messages,s):r.push(s),o++;return Ey(e),r};var Zt=d(2,(e,t)=>ge(()=>wi(e,t))),wi=(e,t)=>{if(e.state._tag!=="Open")return!1;let n=On(t),r=v_(n,yJ);return e.state.offers.size===0&&e.messages.length===0?(Pv(e,r),!0):(e.state={...e.state,_tag:"Closing",exit:r},!0)},Jp=e=>Zt(e,yf(Zc())),eD=e=>wi(e,yf(Zc()));var Ms=e=>ge(()=>{if(e.state._tag==="Done")return!0;ba(e.messages);let t=e.state.offers;if(Pv(e,e.state._tag==="Open"?SJ:e.state.exit),t.size>0){for(let n of t)n._tag==="Single"?n.resume(by):n.resume(rt(n.remaining.slice(n.offset)));t.clear()}return!0});var Rl=e=>tD(e,1,Number.POSITIVE_INFINITY);var tD=(e,t,n)=>he(()=>bJ(e,t,n)??jr(nD(e),tD(e,1,n))),Wo=e=>he(()=>gJ(e)??jr(nD(e),Wo(e)));var gJ=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=_s(e.messages);return Cl(e),rt(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Cl(e),e.capacity=0;let t=_s(e.messages);return Cl(e),rt(t)}};var xJ=e=>e.state._tag==="Done"?0:e.messages.length;var by=rt(!1),Sy=rt(!0),yJ=co(Zc()),SJ=wg(),Mv=e=>{if(e.scheduleRunning=!1,!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(Ir),e.messages.length===0)break}},Ey=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>Mv(e),0))},bJ=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return rt([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Cl(e),e.capacity=0;let r=[_s(e.messages)];return Cl(e),rt(r)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let r=Pu(e.messages,n);return Cl(e),rt(r)}},EJ=(e,t)=>Bt(n=>{if(e.state._tag!=="Open")return n(by);let r={_tag:"Single",message:t,resume:n};return e.state.offers.add(r),ge(()=>{e.state._tag==="Open"&&e.state.offers.delete(r)})}),wJ=(e,t)=>Bt(n=>{if(e.state._tag!=="Open")return n(rt(t));let r={_tag:"Array",remaining:t,offset:0,resume:n};return e.state.offers.add(r),ge(()=>{e.state._tag==="Open"&&e.state.offers.delete(r)})}),Cl=e=>{if(e.state._tag==="Done")return No(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Pv(e,e.state.exit),No(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers){if(t===0)break;if(n._tag==="Single")eo(e.messages,n.message),t--,n.resume(Sy),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;eo(e.messages,n.remaining[n.offset]),t--}n.resume(rt([])),e.state.offers.delete(n)}}return!1},nD=e=>Bt(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),ge(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)})));var Pv=(e,t)=>{if(e.state._tag==="Done")return;let n=e.state;e.state={_tag:"Done",exit:t};for(let r of n.takers)r(t);n.takers.clear();for(let r of n.awaiters)r(t);n.awaiters.clear()};var Ia=e=>new Fv(e),rD=(e,t,n)=>Bt(r=>{if(e.free>=t)return r(n);let o=()=>{e.free<t||(e.waiters.delete(o),r(n))};return e.waiters.add(o),ge(()=>{e.waiters.delete(o)})}),Fv=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let n=he(()=>this.free<t?rD(this,t,n):(this.taken+=t,J(t)));return n}takeIfAvailable(t){return he(()=>this.free<t?J(!1):(this.taken+=t,J(!0)))}releaseUnsafe(t,n){return this.taken-=n,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let r of this.waiters){if(this.free<=0)break;r()}},0),this.free}resize(t){return pe(n=>(this.permits=t,this.free<0?we:(this.releaseUnsafe(n,0),we)))}release(t){return pe(n=>J(this.releaseUnsafe(n,t)))}get releaseAll(){return pe(t=>J(this.releaseUnsafe(t,this.taken)))}withPermits(t){return n=>qr(r=>{let o=he(()=>{if(this.free<t){let s=rD(this,t,we);return ne(r(s),()=>o)}return this.taken+=t,ms(r(n),()=>{this.releaseUnsafe(ea(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return n=>qr(r=>this.free<t?iu:(this.taken+=t,ms(r(Ff(n)),()=>{this.releaseUnsafe(ea(),t)},!0)))}};var Uv=e=>gs(e)?Ft(e)?me(e.value):e:v(e);var aD="~effect/Channel",er=e=>j(e,aD),IJ={[aD]:{_Env:B,_InErr:B,_InElem:B,_OutErr:B,_OutElem:B},pipe(){return ie(this,arguments)}},Ge=e=>{let t=Object.create(IJ);return t.transform=(n,r)=>ft(e(n,r),o=>v(ct(o))),t},Fs=(e,t)=>Ge((n,r)=>R(Pe(e)(n,r),o=>t(o,r))),qn=e=>Ge((t,n)=>e),Us=e=>Ge(Se(function*(t,n){let r=Cn(n),o=i=>Je(r,bw(i)),s=yield*go(e(t,n,r),o);return go(s,o)})),Pe=e=>e.transform,Gp=4096,vJ=(e,t,n)=>to({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Mt(r=>_t(e,Ms(r))),Mt(r=>Ut(Uo(t(r),e),e)));var cD=(e,t)=>Ge((n,r)=>Y(vJ(r,e,t),Rl)),vy=e=>Ge((t,n)=>K(()=>Pe(e())(t,n))),TJ=(e,t,n)=>Us(Se(function*(r,o,s){let i=D();yield*Do(s,c=>Te(i)?n(i.value,c):H);let a=yield*mi(e);return i=L(a),yield*Pe(t(a))(r,o)}));var Dv=e=>qn(se(()=>{let t=0;return K(()=>t>=e.length?me():v(e[t++]))}));var Nv=(e,t=Gp)=>qn(se(()=>{let n=e(),r=D();return K(()=>{if(r._tag==="Some")return me(r.value);let o=[];for(;o.length<t;){let s=n.next();if(s.done){if(o.length===0)return me(s.value);r=L(s.value);break}o.push(s.value)}return v(o)})}));var uD=(e,t=Gp)=>Nv(()=>e[Symbol.iterator](),t),Ty=e=>ky(v(e)),kJ=e=>qn(v(me(e)));var fD=e=>ky(se(e)),Ol=qn(v(me())),lD=qn(v(Kr)),Ii=e=>qn(v(G(e))),dD=e=>qn(lx(e)),Zp=e=>qn(ct(e)),pD=e=>qn(ia(e)),Lv=e=>Zp(mP(e)),ky=e=>qn(se(()=>{let t=!1;return K(()=>t?me():(t=!0,e))}));var mD=e=>qn(R(e,()=>me())),Bv=e=>qn(v(R(e,Uv)));var hD=e=>qn(v(Rl(e)));var jv=e=>qn(v(pi(Y1(e),()=>me())));var gD=e=>va(Y(Kp(e),jv)),xD=e=>va(Y(Kp(e),t=>Bv(gy(t))));var yD=e=>Ge((t,n)=>CJ({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var CJ=e=>{let t=e.readable.getReader(),n=e.exit??$p(void 0),r=K(()=>n.current?n.current:Jr(bs({try:()=>t.read(),catch:e.onError}),{onFailure:o=>n.current??ct(o),onSuccess:({done:o,value:s})=>n.current?n.current:o?me():v(Ne(s))}));return zt(_t(e.scope,e.releaseLockOnEnd?se(()=>t.releaseLock()):ux(()=>t.cancel().catch(En))),r)},AJ=(e,t)=>Ge(Se(function*(n,r){let o=e[Symbol.asyncIterator]();return o.return&&(yield*_t(r,ux(()=>o.return()))),R(bs({try:()=>o.next(),catch:t}),s=>s.done?me(s.value):v(s.value))})),SD=(e,t)=>Ds(AJ(e,t),Ne),Ds=d(2,(e,t)=>Fs(e,n=>se(()=>{let r=0;return Y(n,o=>t(o,r++))})));var bD=e=>e===void 0||e!=="unbounded"&&e<=1,Cy=d(e=>er(e[0]),(e,t,n)=>bD(n?.concurrency)?ED(e,t):RJ(e,t,n)),ED=(e,t)=>Ge((n,r)=>{let o=0;return Y(Pe(e)(n,r),R(s=>t(s,o++)))}),RJ=(e,t,n)=>Us(Se(function*(r,o,s){let i=0,a=yield*Pe(e)(r,o),c=n.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:n.concurrency,u=yield*Uu(0);yield*_t(s,Ms(u));let f=Ln(yield*ar()),l=ya(s);if(n.unordered){let p=Ia(c),m=Qe(p.release(1)),h=Jr({onFailure:g=>R(Zt(u,g),m),onSuccess:g=>R(Xn(u,g),m)});yield*p.take(1).pipe(R(()=>a),R(g=>(l(f(h(t(g,i++)))),H)),Ht({disableYield:!0}),ft(g=>p.withPermits(c-1)(Zt(u,g))),Ut(s))}else{let p=yield*Uu(c-2);yield*_t(s,Ms(p)),yield*Wo(p).pipe(Ow,R(g=>Xn(u,g)),Ht({disableYield:!0}),ft(g=>Zt(u,g)),Ut(s));let m,h=g=>{g._tag!=="Success"&&(m=g.cause,wi(u,g.cause))};yield*a.pipe(R(g=>{if(m)return ct(m);let x=f(t(g,i++));return l(x),x.addObserver(h),Xn(p,vl(x))}),Ht({disableYield:!0}),ft(g=>Xn(p,jt(g)).pipe(Dn(Zt(p,g)))),Ut(s))}return Wo(u)}));var wD=d(e=>er(e[0]),(e,t,n)=>bD(n?.concurrency)?OJ(e,t):_J(e,t,n)),OJ=(e,t)=>Ge((n,r)=>Y(Pe(e)(n,r),o=>{let s,i,a=R(o,u=>(i??=Cn(r),Bn(Pe(t(u))(n,i),f=>(s=c(f),s)))),c=qt(u=>{if(s=void 0,i.state._tag==="Open"&&oM(i)===1)return a;let f=Je(i,Vt);return i=void 0,R(f,()=>a)});return K(()=>s??a)})),_J=(e,t,n)=>e.pipe(Ds(t),Oy(n)),Ay=d(2,(e,t)=>Ge((n,r)=>se(()=>{let o,s=Cn(r),i=R(Pe(e)(n,s),a=>(o=qt(a,c=>Je(s,Vt).pipe(R(()=>Pe(t(c))(n,r)),R(u=>(o=u,u)))),o));return K(()=>o??i)})));var qv=d(4,(e,t,n,r)=>Ge(Se(function*(o,s){let i=yield*Pe(e)(o,s),a=yield*Pe(t)(o,s),c=n();return K(()=>{let u=r(c,i,a);return Y(u,([f,l])=>(c=l,f))})}))),ID=d(2,(e,t)=>Ge((n,r)=>se(()=>{let o,s=Cn(r),i=R(Pe(e)(n,s),a=>{let c=a.pipe(Mt(()=>(o=a,H)),qt(u=>Je(s,kn(u)).pipe(Dn(Pe(t(u))(n,r)),R(f=>(o=f,f)))));return o=c,c});return K(()=>o??i)})));var lr=e=>Fs(e,t=>{let n,r=0,o=K(function s(){if(n===void 0)return R(t,a=>{switch(a.length){case 0:return s();case 1:return v(a[0]);default:return n=a,v(a[r++])}});let i=n[r++];return r>=n.length&&(n=void 0,r=0),v(i)});return v(o)}),vD=e=>ED(e,Uv),TD=e=>Fs(e,t=>v(Ht(t,{disableYield:!0}))),kD=d(2,(e,t)=>Ss(typeof t=="function"?t(B):t).pipe(Y(n=>{let r=Un.defaultValue(),o=Ay(Fy(e,Un,se(()=>r)),s=>n(s).pipe(Y(i=>(r=i,o)),qt(()=>v(kJ(s))),va));return o}),va)),$v=e=>Ay(e,()=>$v(e)),CD=d(2,(e,t)=>Fs(e,(n,r)=>Y(Yf(t),o=>Mt(n,o)))),AD=d(2,(e,t)=>Ge((n,r)=>Y(Pe(e)(n,r),o=>R(o,function s(i){return t(i)?v(i):R(o,s)}))));var RD=d(2,(e,t)=>Fs(e,n=>v(R(n,function r(o){let s=[];for(let i=0;i<o.length;i++)t(o[i])&&s.push(o[i]);return Ye(s)?v(s):R(n,r)})))),OD=d(2,(e,t)=>Fs(e,n=>v(R(n,function r(o){let s=[];for(let i=0;i<o.length;i++){let a=t(o[i]);Kt(a)&&s.push(a.success)}return Ye(s)?v(s):R(n,r)})))),_D=d(2,(e,t)=>Fs(e,n=>{let r=R(n,o=>Lw(o,t));return v(R(r,function o(s){return Ye(s)?v(s):R(r,o)}))})),MD=d(2,(e,t)=>Fs(e,n=>v(R(n,function r(o){return R(Bw(o,t),s=>Ye(s)?v(s):R(n,r))})))),_l=d(e=>er(e[0]),(e,t,n,r)=>Ge((o,s)=>Y(Pe(e)(o,s),i=>{let a=t(),c,u=0,f,l=Jr(i,{onFailure(m){f=m;let h=r?.onHalt&&r.onHalt(a);return h&&h.length>0?v([a,h]):ct(m)},onSuccess(m){let h=n(a,m);return kR(h)?v(h):h}});return K(function m(){if(c===void 0)return f?ct(f):R(l,([g,x])=>(a=g,x.length===0?m():x.length===1?v(x[0]):(c=x,m())));let h=c[u++];return u>=c.length&&(c=void 0,u=0),v(h)})})));var PD=d(3,(e,t,n)=>Ge((r,o)=>Y(Pe(e)(r,o),s=>{let i=t,a=!0;return K(()=>a?(a=!1,v(i)):Y(R(s,c=>n(i,c)),c=>(i=c,i)))}))),Ml=d(2,(e,t)=>Ge((n,r)=>{let o=Cn(r);return Y(Pe(e)(n,o),s=>{let i=s.pipe(ft(a=>{if(No(a))return ct(a);let c=o;return o=Cn(r),Je(c,jt(a)).pipe(Dn(Pe(t(a))(n,o)),R(u=>(i=u,u)))}));return K(()=>i)})})),Ry=d(2,(e,t)=>Ml(e,n=>mD(R(t(n),r=>ct(n))))),FD=d(3,(e,t,n)=>Ml(e,r=>t(r)?n(r):Zp(r))),zv=d(3,(e,t,n)=>Ml(e,r=>{let o=t(r);return Fe(o)?Zp(o.failure):n(o.success,r)})),Ps=d(2,(e,t)=>zv(e,Kf,n=>t(n)));var UD=d(2,(e,t)=>Fs(e,n=>v(up(n,r=>Gd(r)?H:jo(t(r)))))),DD=d(e=>er(e[0]),(e,t,n,r)=>Ps(e,o=>t(o)?n(o):r?r(o):Ii(o))),ND=d(e=>er(e[0]),(e,t,n,r)=>Ps(e,o=>{let s=t(o);return Fe(s)?r?r(s.failure):Ii(s.failure):n(s.success)}));var LD=d(e=>er(e[0]),(e,t,n,r,o)=>Ps(e,s=>{if(yr(s,t)&&j(s,"reason")){let i=s.reason;return yr(i,n)?r(i,s):o?o(i,s):Ii(s)}return Ii(s)})),BD=d(e=>er(e[0]),(e,t,n,r)=>{let o;return Ps(e,s=>{if(yr(s,t)&&j(s,"reason")&&j(s.reason,"_tag")&&ox(s.reason._tag)){let i=s.reason;return o??=new Set(Object.keys(n)),o.has(i._tag)?n[i._tag](i,s):r?r(i,s):Ii(s)}return Ii(s)})});var jD=d(2,(e,t)=>Ps(e,n=>Ii(t(n)))),qD=e=>Ps(e,Lv),$D=d(e=>er(e[0]),(e,t)=>{if(!t?.log)return Ps(e,()=>Ol);let n=cl(t.log===!0?void 0:t.log);return Ps(Ry(e,r=>gP(r)?n(r):H),()=>Ol)}),sD=e=>Ml(e,()=>Ol),zD=d(e=>er(e[0]),(e,t)=>{if(!t?.log)return sD(e);let n=cl(t.log===!0?void 0:t.log);return sD(Ry(e,r=>n(r)))}),HD=d(2,(e,t)=>vy(()=>{let n,r=Un.defaultValue(),o=Fy(e,Un,se(()=>r)),s=Kv(o,()=>(n=void 0,H)),i=typeof t=="function"?t(B):t,a=Ps(s,Se(function*(c){return n||(n=yield*Ss(i)),r=yield*n(c),a},(c,u)=>qt(c,()=>v(Ii(u))),va));return a})),WD=d(e=>er(e[0]),(e,t,n)=>e.pipe(Ds(t),Oy({...n,concurrency:n?.concurrency??1,switch:!0}))),Oy=d(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>Us(Se(function*(o,s,i){let a=n==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,n),c=r?void 0:Ia(a),u=yield*H1(!0),f=new Set,l=yield*Uu(t);yield*_t(i,Ms(l));let p=yield*Pe(e)(o,s);return yield*$t(function*(){for(;;){let m;c&&(f.size<a?yield*c.take(1):(m=yield*il(p),yield*sc(c.take(1),Dn(vl(m),Kr))));let h=m===void 0?yield*p:yield*vl(m),g=Cn(i),x=yield*Pe(h)(o,g);for(;f.size>=a;){let b=ER(f);f.delete(b),f.size===0&&(yield*u.open),yield*bo(b)}let E=yield*x.pipe(Mt(()=>cp),R(b=>Xn(l,b)),Ht({disableYield:!0}),go(Se(function*(b){let y=Qf(b);if(yield*Vr(Je(g,Fe(y)?jt(y.failure):kn(y.success.value))),!!f.has(E)&&(f.delete(E),c&&(yield*c.release(1)),f.size===0&&(yield*u.open),!Kt(y)))return yield*Zt(l,b)})),il);u.closeUnsafe(),f.add(E)}}).pipe(ft(m=>{let h=Qf(m);return Kt(h)?u.whenOpen(Zt(l,m)):Zt(l,m)}),Ut(i)),Wo(l)}))),_y=d(e=>er(e[0])&&er(e[1]),(e,t,n)=>Us(Se(function*(r,o,s){let i=n?.haltStrategy??"both",a=yield*Uu(0);yield*_t(s,Ms(a));let c=0;function u(l,p){if(c++,!No(p))return Zt(a,p);switch(i){case"both":return c===2?Zt(a,p):H;case"left":case"right":return l===i?Zt(a,p):H;case"either":return Zt(a,p)}}let f=(l,p,m)=>Pe(p)(r,m).pipe(R(h=>h.pipe(R(g=>Xn(a,g)),Ht)),go(h=>Dn(Je(m,bw(h)),u(l,h))),Ut(s));return yield*f("left",e,Cn(s)),yield*f("right",t,Cn(s)),Wo(a)}))),KD=d(2,(e,t)=>_y(e,mD(t),{haltStrategy:"left"})),VD=()=>Ge((e,t)=>se(()=>{let n="",r=!1,o=D();function s(c){let u=[];function f(l){n.length===0?u.push(l):(u.push(n+l),n="")}for(let l=0;l<c.length;l++){let p=c[l];if(p.length!==0){let m=0,h=p.indexOf("\r"),g=p.indexOf(`
22
+ ${ZO(e.cause,`${t} `)}
23
+ ${t}}`),r},ug="~effect/Fiber",p4={_A:B,_E:B},m4={id:0},ta=()=>globalThis[mf],fg=class{constructor(t,n=!0){this[ug]=p4,this.setContext(t),this.id=++m4.id,this.currentOpCount=0,this.interruptible=n,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[ug];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(t){return $e(this.context,t)}addObserver(t){return this._exit?(t(this._exit),bn):(this._observers.push(t),()=>{if(this._exit)return;let n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}interruptUnsafe(t,n){if(this._exit)return;let r=Za(t);this.currentStackFrame&&(r=Id(r,us(Fh,this.currentStackFrame))),n&&(r=Id(r,n)),this._interruptedCause=this._interruptedCause?d0(this._interruptedCause,r):r,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(ot(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let n=this.runLoop(t);if(n===Gc)return;let r=Qb.interruptChildren&&Qb.interruptChildren(this);if(r!==void 0)return this.evaluate(ne(r,()=>n));this._exit=n,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let o=0;o<this._observers.length;o++)this._observers[o](n);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=bt()}runLoop(t){let n=globalThis[mf];globalThis[mf]=this;let r=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,s=ot(this._interruptedCause)),this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let i=s;s=ne(Pf,()=>i)}if(s=this.currentTracerContext?this.currentTracerContext(s,this):s[nn](this),s===Gc){let i=this._yielded;if(Kc in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Gc}}}catch(i){return q(s,nn)?this.runLoop(fo(i)):fo(`Fiber.runLoop: Not a valid effect: ${String(s)}`)}finally{this._running=r,globalThis[mf]=n}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,h4;for(;;){let n=this._stack.pop();if(!n)return;let r=n[La]&&n[La](this);if(r)return r[t]=r,r;if(n[t])return n}}yieldWith(t){return this._yielded=t,Gc}children(){return this._children??=new Set}pipe(){return ie(this,arguments)}setContext(t){let n=this.context;if(this.context=t,n!==void 0&&XR(n,t))return;let r=this.getRef(Va);r!==this.currentScheduler&&(this.currentScheduler=r,this._dispatcher=void 0),this.currentSpan=Gi(t,Hb),this.currentLogLevel=this.getRef(Vb),this.minimumLogLevel=this.getRef(Kb),this.currentStackFrame=this.getRef(Rf),this.maxOpsBeforeYield=this.getRef(pO),this.currentPreventYield=this.getRef(mO),this.runtimeMetrics=Gi(t,OO);let o=Gi(t,Wb);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}},h4={[Er](e,t){return ot(t._interruptedCause)},[Co](e,t){return ot(t._interruptedCause)}},Qb={interruptChildren:void 0},xg=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(ob.key,e.currentStackFrame),Po(t)},g4=e=>{if(!(e._children===void 0||e._children.size===0))return Ga(e._children)},p0=e=>{let t=e;return t._exit?J(t._exit):Bt(n=>t._exit?n(J(t._exit)):ge(e.addObserver(r=>n(J(r)))))},yg=e=>Bt(t=>{let n=e[Symbol.iterator](),r=[],o;function s(){let i=n.next();for(;!i.done;){if(i.value._exit){r.push(i.value._exit),i=n.next();continue}o=i.value.addObserver(a=>{r.push(a),s()});return}t(J(r))}return s(),ge(()=>o?.())}),QO=e=>{let t=e;return t._exit?t._exit:Bt(n=>t._exit?n(t._exit):ge(e.addObserver(n)))},YO=e=>Bt(t=>{let n=Array.from(e);if(n.length===0)return t(J(rn()));let r=new Array(n.length),o=rn(),s=0,i=!1;for(let a=0;a<n.length&&!i;a++)o.push(n[a].addObserver(c=>{if(s++,c._tag==="Failure")return i=!0,o.forEach(u=>u()),t(c);r[a]=c.value,s===n.length&&t(J(r))}));return ge(()=>{i=!0,o.forEach(a=>a())})}),Sg=e=>pe(t=>XO(e,t.id)),XO=d(e=>q(e[0],ug),(e,t,n)=>pe(r=>{let o=xg(r);return o=o&&n?br(o,n):o??n,e.interruptUnsafe(t,o),zd(p0(e))})),Ga=e=>pe(t=>{let n=xg(t),r=rn();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return zd(yg(r))});var J=rt,ot=On,wt=uo,ge=Ao({op:"Sync",[nn](e){let t=this[ye](),n=e.getCont(Er);return n?n[Er](t,e):e.yieldWith(rt(t))}}),he=Ao({op:"Suspend",[nn](e){return this[ye]()}}),m0=d(e=>e.length>=2||Ys(e[0]),(e,t)=>xe(e)?wt(t?t():new ss("Effect.fromOption: Option.none")):J(e.value)),Mf=Mo({onFailure:wt,onSuccess:J}),e_=e=>e==null?wt(new ss):J(e),h0=Ao({op:"Yield",[nn](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(vr)},this[ye]??0),e.yieldWith(()=>{t=!0})}}),Pf=h0(0),g0=e=>J(L(e)),iu=J(D()),t_=e=>xe(e)?iu:Be(e.value,L),n_=e=>he(()=>ot(qe(e))),na=e=>fo(e),Eg=e=>he(()=>wt(qe(e))),we=J(void 0);var r_=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new jd(r,"An error occurred in Effect.try"):e.catch;return he(()=>{try{return J(qe(t))}catch(r){return wt(qe(()=>n(r)))}})};var x0=e=>y0(function(t,n){qe(()=>e(n)).then(r=>t(J(r)),r=>t(na(r)))},e.length!==0),o_=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new jd(r,"An error occurred in Effect.tryPromise"):e.catch;return y0(function(r,o){let s=i=>{try{r(wt(qe(()=>n(i))))}catch(a){r(na(a))}};try{qe(()=>t(o)).then(i=>r(J(i)),s)}catch(i){s(i)}},t.length!==0)},s_=e=>pe(t=>e(t.id)),i_=pe(J),a_=s_(J),y0=Ao({op:"Async",single:!1,[nn](e){let t=qe(()=>this[ye][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[ye][1]?new AbortController:void 0,s=t(i=>{n||(n=!0,r?e.evaluate(i):r=i)},o?.signal);return r!==!1?r:(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0?Gc:(e._stack.push(x4(()=>(n=!0,o?.abort(),s??vr))),Gc))}}),x4=Ao({op:"AsyncFinalizer",[La](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ug))},[Co](e,t){return f0(e)?ne(this[ye](),()=>ot(e)):ot(e)}}),Bt=e=>y0(e,e.length>=2),$d=Bt(bn),c_=(...e)=>he(()=>Of(e.length===1?e[0]():e[1].call(e[0].self))),S0=(e,...t)=>{let n=t.length===0?function(){return he(()=>Of(e.apply(this,arguments)))}:function(){let r=he(()=>Of(e.apply(this,arguments)));for(let o=0;o<t.length;o++)r=t[o](r,...arguments);return r};return E0(e.length,n)},E0=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),PO=Jb(2),u_=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",n=e?arguments[1]:void 0,r=ni();ar(2);let o=new globalThis.Error;return ar(r),e?(s,...i)=>FO(t,s,o,i,e,n):FO(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,n)},FO=(e,t,n,r,o,s)=>{let i=typeof t=="function"?t:r.shift().bind(t.self);return E0(i.length,function(...a){let c=he(()=>{let l=i.apply(this,arguments);return ve(l)?l:Of(l)});for(let l=0;l<r.length;l++)c=r[l](c,...a);if(!ve(c))return c;let u=ni();ar(2);let f=new globalThis.Error;return ar(u),ra(o?qd(e,s,l=>n0(c,l)):c,Rf,l=>({name:e,stack:PO(()=>f.stack),parent:{name:`${e} (definition)`,stack:PO(()=>n.stack),parent:l}}))})},f_=(e,...t)=>E0(e.length,t.length===0?function(){return UO(()=>e.apply(this,arguments))}:function(){let n=UO(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),UO=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return J(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else{if(o&&o._tag==="Failure")return r.value;{let s=!0;return he(()=>s?(s=!1,ne(r.value,i=>Of(t,i))):he(()=>Of(e())))}}}}catch(t){return na(t)}},Of=Ao({op:"Iterator",single:!1,[Er](e,t){let n=this[ye][0];for(;;){let r=n.next(e);if(r.done)return J(r.value);if(xt(r.value)){if(r.value._tag==="Failure")return r.value}else return t._stack.push(this),r.value;e=r.value.value}},[nn](e){return this[Er](this[ye][1],e)}}),Pn=d(2,(e,t)=>{let n=J(t);return ne(e,r=>n)}),Ff=e=>Be(e,L),l_=e=>au(e,{onFailure:J,onSuccess:wt}),jr=d(2,(e,t)=>ne(e,n=>ve(t)?t:qe(()=>t(n)))),oi=d(2,(e,t)=>ne(e,n=>Pn(ve(t)?t:qe(()=>t(n)),n))),zd=e=>ne(e,t=>vr),d_=e=>kr(e,wt),b0=(e,t)=>pe(n=>Bt(r=>{let o=ht(e),s=o.length,i=0,a=!1,c=new Set,u=[],f=(l,p,m)=>{if(i++,l._tag==="Failure"){u.push(...l.cause.reasons),i>=s&&r(ot(zi(u)));return}let h=!a;a=!0,r(c.size===0?l:ne(sa(Ga(c)),()=>l)),h&&t?.onWinner&&t.onWinner({fiber:p,index:m,parentFiber:n})};for(let l=0;l<s;l++){let p=uu(n,o[l],!0,!0,!1);if(c.add(p),p.addObserver(m=>{c.delete(p),f(m,p,l)}),a)break}return Ga(c)})),w0=(e,t)=>pe(n=>Bt(r=>{let o=!1,s=new Set,i=c=>{o=!0,r(s.size===0?c:ne(sa(Ga(s)),()=>c))},a=0;for(let c of e){if(o)break;let u=a++,f=uu(n,c,!0,!0,!1);s.add(f),f.addObserver(l=>{s.delete(f);let p=!o;i(l),p&&t?.onWinner&&t.onWinner({fiber:f,index:u,parentFiber:n})})}return Ga(s)})),p_=d(e=>ve(e[1]),(e,t,n)=>b0([e,t],n)),bg=d(e=>ve(e[1]),(e,t,n)=>w0([e,t],n)),ne=d(2,(e,t)=>{let n=Object.create(y4);return n[ye]=e,n[Er]=t.length!==1?r=>t(r):t,n}),y4=Hi({op:"OnSuccess",[nn](e){return e._stack.push(this),this[ye]}}),m_=d(2,(e,t)=>xt(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):ds(e,t)),xt=e=>Kc in e,h_=d(2,(e,t)=>xt(e)?e._tag==="Success"?t(e.value):e:ne(e,t)),g_=e=>ne(e,B),Be=d(2,(e,t)=>ne(e,n=>J(qe(()=>t(n))))),x_=d(2,(e,t)=>xt(e)?I_(e,t):Be(e,t)),y_=d(2,(e,t)=>xt(e)?v_(e,t):A0(e,t)),S_=d(2,(e,t)=>xt(e)?T_(e,t):R0(e,t)),E_=d(2,(e,t)=>{if(xt(e)){if(e._tag==="Success")return e;let n=ri(e.cause);return Fe(n)?e:t(n.success)}return Cr(e,t)}),wg=e=>On(Za(e)),Uf=e=>e._tag==="Success";var b_=e=>e._tag==="Failure";var w_=e=>e._tag==="Failure"?Ce(e.cause):Ae(e);var vr=rt(void 0),I_=d(2,(e,t)=>e._tag==="Success"?rt(t(e.value)):e),v_=d(2,(e,t)=>{if(e._tag==="Success")return e;let n=ri(e.cause);return Fe(n)?e:uo(t(n.success))}),T_=d(2,(e,t)=>{if(e._tag==="Success")return rt(t.onSuccess(e.value));let n=ri(e.cause);return Fe(n)?e:uo(t.onFailure(n.success))});var k_=d(2,(e,t)=>Uf(e)?t:e),C_=d(2,(e,t)=>Uf(e)?t.onSuccess(e.value):t.onFailure(e.cause));var A_=e=>{let t=[];for(let n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?vr:On(zi(t))};var R_=e=>e,O_=e=>pe(t=>J(Rb(t.context,e))),S4=e=>pe(t=>m0(Rb(t.context,e))),Df=d(2,(e,t)=>pe(n=>{let r=n.context,o=t(r);return r===o?e:(n.setContext(o),hs(e,()=>{n.setContext(r)}))})),ra=d(3,(e,t,n)=>Df(e,r=>{let o=Gn(r,t),s=n(o);return o===s?r:Ke(r,t,s)})),__=(e,t,n)=>sa(pe(r=>{let o=Gn(r.context,e),s=t(o);return r.setContext(Ke(r.context,e,s)),ms(Gn(r.context,Ya),i=>{let a=Gn(r.context,e),c;if(n?.reset===void 0){if(a!==s)return we;c=o}else c=n.reset(o,s,a);return r.setContext(Ke(r.context,e,c)),we})})),I0=()=>E4,E4=pe(e=>J(e.context)),Qa=e=>pe(t=>e(t.context)),M_=d(2,(e,t)=>Df(e,Qe(t))),oa=d(2,(e,t)=>xt(e)?e:Df(e,br(t))),Tr=function(){return arguments.length===1?d(2,(e,t)=>DO(e,arguments[0],t)):d(3,(e,t,n)=>DO(e,t,n)).apply(this,arguments)},DO=(e,t,n)=>Df(e,Ke(t,n)),Ig=d(3,(e,t,n)=>ne(n,r=>Tr(e,t,r))),P_=d(e=>ve(e[1]),(e,t,n)=>v0(e,t,(r,o)=>[r,o],n)),v0=d(e=>ve(e[1]),(e,t,n,r)=>r?.concurrent?Be(jf([e,t],{concurrency:2}),([o,s])=>qe(()=>n(o,s))):ne(e,o=>Be(t,s=>qe(()=>n(o,s))))),F_=d(e=>ve(e[0]),(e,t,n)=>z0(e,t,n?r=>wt(n(r)):()=>wt(new ss))),U_=d(2,(e,t)=>ne(t,n=>n?Ff(e):iu)),T0=d(2,(e,t)=>Array.from({length:t},()=>e)),D_=d(e=>ve(e[0]),(e,t,n)=>jf(T0(e,t),n)),vg=d(e=>ve(e[0]),(e,t)=>si({while:Xt,body:Qe(t?.disableYield?e:ne(e,n=>Pf)),step:bn})),kr=d(2,(e,t)=>{let n=Object.create(b4);return n[ye]=e,n[Co]=t.length!==1?r=>t(r):t,n}),b4=Hi({op:"OnFailure",[nn](e){return e._stack.push(this),this[ye]}}),k0=d(3,(e,t,n)=>kr(e,r=>t(r)?qe(()=>n(r)):ot(r))),Nf=d(3,(e,t,n)=>kr(e,r=>{let o=t(r);return Fe(o)?ot(o.failure):qe(()=>n(o.success,r))})),Cr=d(2,(e,t)=>Nf(e,ri,n=>t(n))),N_=e=>au(e,{onFailure:t=>sb(t)?iu:wt(t),onSuccess:g0}),L_=d(2,(e,t)=>Nf(e,u0,t)),B_=d(2,(e,t)=>kr(e,n=>jr(qe(()=>t(n)),ot(n)))),q_=d(3,(e,t,n)=>k0(e,t,r=>jr(qe(()=>n(r)),ot(r)))),Tg=d(3,(e,t,n)=>kr(e,r=>{let o=t(r);return Fe(o)?ot(r):jr(qe(()=>n(o.success,r)),ot(r))})),C0=d(2,(e,t)=>Tg(e,ri,n=>t(n))),j_=d(3,(e,t,n)=>{let r=Array.isArray(t)?o=>q(o,"_tag")&&t.includes(o._tag):Sr(t);return C0(e,o=>r(o)?n(o):we)}),$_=d(2,(e,t)=>Tg(e,u0,n=>t(n))),Hd=d(e=>ve(e[0]),(e,t,n,r)=>kr(e,o=>{let s=ri(o);return Fe(s)?ot(s.failure):t(s.success)?qe(()=>n(s.success)):r?qe(()=>r(s.success)):ot(o)})),kg=d(e=>ve(e[0]),(e,t,n,r)=>kr(e,o=>{let s=ri(o);if(Fe(s))return ot(s.failure);let i=t(s.success);return Fe(i)?r?qe(()=>r(i.failure)):ot(o):qe(()=>n(i.success))})),Cg=d(e=>ve(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?s=>q(s,"_tag")&&t.includes(s._tag):Sr(t);return Hd(e,o,n,r)}),z_=d(e=>ve(e[0]),(e,t,n)=>{let r;return kg(e,o=>(r??=Object.keys(t),q(o,"_tag")&&ao(o._tag)&&r.includes(o._tag)?Ce(o):Ae(o)),o=>qe(()=>t[o._tag](o)),n)}),H_=d(e=>ve(e[0]),(e,t,n,r,o)=>Hd(e,s=>Sr(s,t)&&q(s,"reason"),s=>{let i=s.reason;return Sr(i,n)?r(i,s):o?qe(()=>o(i,s)):wt(s)})),W_=d(e=>ve(e[0]),(e,t,n,r)=>{let o;return Hd(e,s=>Sr(s,t)&&q(s,"reason")&&q(s.reason,"_tag")&&ao(s.reason._tag),s=>{let i=s.reason;return o??=Object.keys(n),o.includes(i._tag)?qe(()=>n[i._tag](i,s)):r?qe(()=>r(i,s)):wt(s)})}),V_=d(2,(e,t)=>kg(e,n=>Sr(n,t)&&q(n,"reason")?Ce(n.reason):Ae(n),wt)),A0=d(2,(e,t)=>Cr(e,n=>Eg(()=>t(n)))),R0=d(2,(e,t)=>au(e,{onFailure:n=>Eg(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),Ag=e=>Cr(e,na),K_=d(2,(e,t)=>Cr(e,n=>ge(t))),J_=e=>he(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return na(new Error("Received an empty collection of effects"));function r(o){let s=t.next();return s.done?o.value:Cr(o.value,i=>r(s))}return r(n)}),O0=e=>Cr(e,t=>ne(Pf,()=>O0(e))),G_=d(e=>ve(e[0]),(e,t)=>{if(!t?.log)return au(e,{onFailure:r=>we,onSuccess:r=>we});let n=gs(t.log===!0?void 0:t.log);return ds(e,{onFailure(r){let o=jO(r);return Fe(o)?ot(o.failure):t.message===void 0?n(r):n(t.message,r)},onSuccess:r=>we})}),Rg=d(e=>ve(e[0]),(e,t)=>{if(!t?.log)return ds(e,{onFailure:r=>we,onSuccess:r=>we});let n=gs(t.log===!0?void 0:t.log);return ds(e,{onFailure:r=>t.message===void 0?n(r):n(t.message,r),onSuccess:r=>we})}),Z_=e=>Og(e,{onFailure:D,onSuccess:L}),Ja=e=>Wd(e,{onFailure:Ae,onSuccess:Ce}),ds=d(2,(e,t)=>{let n=Object.create(w4);return n[ye]=e,n[Er]=t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,n[Co]=t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure,n}),w4=Hi({op:"OnSuccessAndFailure",[nn](e){return e._stack.push(this),this[ye]}}),_0=d(2,(e,t)=>ds(e,{onFailure:n=>ge(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),au=d(2,(e,t)=>ds(e,{onFailure:n=>{let r=n.reasons.find(Ba);return r?qe(()=>t.onFailure(r.error)):ot(n)},onSuccess:t.onSuccess})),Og=d(2,(e,t)=>au(e,{onFailure:n=>ge(()=>t.onFailure(n)),onSuccess:n=>ge(()=>t.onSuccess(n))})),Wd=d(2,(e,t)=>{if(xt(e)){if(e._tag==="Success")return rt(t.onSuccess(e.value));let n=ri(e.cause);return Fe(n)?e:rt(t.onFailure(n.success))}return Og(e,t)}),Q_=d(2,(e,t)=>xt(e)?e._tag==="Success"?rt(t.onSuccess(e.value)):rt(t.onFailure(e.cause)):_0(e,t)),Vd=e=>xt(e)?rt(e):I4(e),I4=Ao({op:"Exit",[nn](e){return e._stack.push(this),this[ye]},[Er](e,t,n){return J(n??rt(e))},[Co](e,t,n){return J(n??On(e))}}),Y_=Wd({onFailure:()=>!0,onSuccess:()=>!1}),X_=Wd({onFailure:()=>!1,onSuccess:()=>!0}),eM=d(2,(e,t)=>jr(fu(t),e)),M0=d(2,(e,t)=>bg(e,ne(fu(t.duration),t.orElse))),tM=d(2,(e,t)=>M0(e,{duration:t,orElse:()=>wt(new lg)})),nM=d(2,(e,t)=>bg(Ff(e),Pn(fu(t),D()))),rM=e=>zr(t=>{let n=t.monotonicTimeNanosUnsafe();return Be(e,r=>[Br(t.monotonicTimeNanosUnsafe()-n),r])}),Yb="~effect/Scope",Xb="~effect/Scope/Closeable",Ya=Ve("effect/Scope"),P0=(e,t)=>he(()=>Lf(e,t)??we),Lf=(e,t)=>{if(e.state._tag==="Closed")return;let n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}let r=e.state;if(e.state=n,r.finalizer!==void 0)return r.finalizer(t);let o=r.finalizers;if(!(o===void 0||o.size===0))return o.size===1?o.values().next().value(t):T4(e,o,t)},v4=(e,t)=>Uf(e)?t:kr(t,n=>ot(d0(e.cause,n))),T4=S0(function*(e,t,n){let r=[],o=[],s=Array.from(t.values()),i=ta();for(let a=s.length-1;a>=0;a--){let c=s[a];e.strategy==="sequential"?r.push(yield*Vd(c(n))):o.push(uu(i,c(n),!0,!0,"inherit"))}return o.length>0&&(r=yield*yg(o)),yield*A_(r)});var oM=(e,t)=>{let n=cu(t);if(e.state._tag==="Closed")return n.state=e.state,n;let r={};return su(e,r,o=>P0(n,o)),su(n,r,o=>ge(()=>F0(e,r))),n},ms=(e,t)=>he(()=>e.state._tag==="Closed"?t(e.state.exit):(su(e,{},t),we)),sM=(e,t)=>ms(e,Qe(t)),su=(e,t,n)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag==="Open"){let r=e.state;r.finalizer!==void 0?(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n)):r.finalizers===void 0?(r.finalizerKey=t,r.finalizer=n):r.finalizers.set(t,n)}},F0=(e,t)=>{if(e.state._tag==="Open"){let n=e.state;n.finalizerKey===t?(n.finalizerKey=void 0,n.finalizer=void 0):n.finalizers!==void 0&&n.finalizers.delete(t)}},iM=e=>e.state._tag!=="Open"?0:e.state.finalizer!==void 0?1:e.state.finalizers?.size??0,cu=(e="sequential")=>({[Xb]:Xb,[Yb]:Yb,strategy:e,state:k4}),k4={_tag:"Empty"};var Kd=Ya,aM=Tr(Ya),_g=e=>pe(t=>{let n=t.context,r=cu();return t.setContext(Ke(t.context,Ya,r)),hs(e,o=>(t.setContext(n),Lf(r,o)))});var Mg=e=>he(()=>{let t=cu();return Zn(e(t),n=>he(()=>Lf(t,n)??we))}),Pg=(e,t,n)=>Qa(r=>$r(o=>ne(Kd,s=>oi(n?.interruptible?o(e):e,i=>ms(s,a=>oa(t(i,a),r)))))),Bf=e=>ne(Kd,t=>Qa(n=>ms(t,r=>oa(e(r),n)))),hs=Ao({op:"OnExit",single:!1,[nn](e){return e._stack.push(this),this[ye][0]},[La](e){e.interruptible&&this[ye][2]!==!0&&(e._stack.push(Ug),e.interruptible=!1)},[Er](e,t,n){n??=rt(e);let r=this[ye][1](n);return r?ne(r,o=>n):n},[Co](e,t,n){n??=On(e);let r=this[ye][1](n);return r?ne(v4(n,r),o=>n):n}}),Zn=d(2,hs),cM=d(2,(e,t)=>Zn(e,n=>t)),U0=d(3,(e,t,n)=>Zn(e,r=>t(r)?n(r):we)),D0=d(3,(e,t,n)=>Zn(e,r=>{let o=t(r);return Fe(o)?we:n(o.success,r)})),N0=d(2,(e,t)=>D0(e,w_,t)),uM=d(3,(e,t,n)=>U0(e,r=>r._tag!=="Failure"?!1:t(r.cause),r=>n(r.cause))),L0=d(3,(e,t,n)=>Zn(e,r=>{if(r._tag!=="Failure")return we;let o=t(r.cause);return Fe(o)?we:n(o.success,r.cause)})),Fg=d(2,(e,t)=>L0(l0,t)(e)),fM=(e,t,n)=>$r(r=>ne(e,o=>hs(r(t(o)),s=>n(o,s),!0))),lM=e=>Pg(e,t=>q(t,Symbol.asyncDispose)?x0(()=>t[Symbol.asyncDispose]()):ge(()=>t[Symbol.dispose]())),B0=d(2,(e,t)=>ge(()=>{let n=Tn(gt(t)),r=Number.isFinite(n),o=Lg(!1),s=0,i=!1,a,c=ne(o.await,()=>a);return[pe(u=>{let f=u.getRef(ho),l=r?f.currentTimeMillisUnsafe():0;return i||l<s?a??c:(i=!0,o.closeUnsafe(),a=void 0,Zn(e,p=>ge(()=>{i=!1,s=f.currentTimeMillisUnsafe()+n,a=p,o.openUnsafe()})))}),ge(()=>{s=0,o.closeUnsafe(),a=void 0})]})),q0=d(2,(e,t)=>Be(B0(e,t),n=>n[0])),dM=e=>q0(e,mo),qf=pe(e=>ot(Za(e.id))),sa=e=>pe(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Ug)),e)),pM=Ao({op:"SetInterruptible",[La](e){if(e.interruptible=this[ye],e._interruptedCause&&e.interruptible)return()=>ot(e._interruptedCause)}}),Ug=pM(!0),C4=pM(!1),mM=e=>{if(e.interruptible=!0,e._stack.push(C4),e._interruptedCause)return ot(e._interruptedCause)},j0=e=>pe(t=>t.interruptible?e:mM(t)??e),$r=e=>pe(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ug),e(j0)):e(B)),hM=e=>pe(t=>{if(t.interruptible)return e(B);let n=mM(t),r=e(sa);return n??r}),gM=Be(Pg(ge(()=>new AbortController),e=>ge(()=>e.abort())),e=>e.signal),jf=(e,t)=>Js(e)?t?.mode==="result"?qr(e,Ja,t):qr(e,B,t):t?.discard?t.mode==="result"?qr(Object.values(e),Ja,t):qr(Object.values(e),B,t):he(()=>{let n={};return Pn(qr(Object.entries(e),([r,o])=>Be(t?.mode==="result"?Ja(o):o,s=>{W(n,r,s)}),{discard:!0,concurrency:t?.concurrency}),n)}),$0=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>Be(qr(e,(r,o)=>Ja(t(r,o)),n),r=>Sb(r,B))),xM=d(3,(e,t,n)=>{let r=ht(e);return r.length===0?ge(t):he(()=>{let o=0,s=t();return Be(si({while:()=>o<r.length,body:()=>n(s,r[o],o),step(i){s=i,o++}}),()=>s)})}),yM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>ne($0(e,t,{concurrency:n?.concurrency}),([r,o])=>Jn(r)?wt(r):n?.discard?we:J(o))),SM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?J(D()):EM(n,0,t,r.value)})),EM=(e,t,n,r)=>ne(n(r,t),o=>{if(o)return J(L(r));let s=e.next();return s.done?J(D()):EM(e,t+1,n,s.value)}),bM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?J(D()):wM(n,0,t,r.value)})),wM=(e,t,n,r)=>ne(n(r,t),o=>{if(Vt(o))return J(L(o.success));let s=e.next();return s.done?J(D()):wM(e,t+1,n,s.value)}),si=Ao({op:"While",[Er](e,t){return this[ye].step(e),this[ye].while()?(t._stack.push(this),this[ye].body()):vr},[nn](e){return this[ye].while()?(e._stack.push(this),this[ye].body()):vr}}),qr=d(e=>typeof e[1]=="function",(e,t,n)=>he(()=>{let r=n?.concurrency??1,o=r==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,r);if(o===1)return A4(e,t,n);let s=ht(e),i=s.length;if(i===0)return n?.discard?we:J([]);let a=n?.discard?void 0:new Array(i),c=R4({f:t,out:a},s,{concurrency:o});return c?Pn(c,a):J(a)})),IM=e=>ne(e,t=>{let n=t[Symbol.iterator]().next();return n.done?wt(new ss):J(n.value)}),A4=(e,t,n)=>he(()=>{let r=n?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return Pn(si({while:()=>!s.done,body:()=>t(s.value,i++),step:a=>{r&&r.push(a),s=o.next()}}),r)}),vM=e=>{let t=e.onItem,n=e.step,r=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],u=t(o,c,i);if(!xt(u))return ne(Vd(u),l=>n(o,c,l,i)??r(o,s,i+1,a)??we);let f=n(o,c,u,i);if(f)return f._tag==="Failure"?f:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,u=i?.concurrency??1;if(u===1)return r(o,s,0,c);let f=i?.orderedStep===!0,l=!1,p,m,h,g=!1,y,b,E=a,x=f?new Array(c):void 0,w=M=>{let R=fo(M);return y=R,l=!0,g=!0,m&&m.size>0?ne(sa(Ga(Array.from(m))),()=>R):R},S=(M,R,P)=>{if(!f)return n(o,M,R,P);if(y)return y;for(x[P]=R;E<c;){let $=x[E];if($===void 0)return;x[E]=void 0;let F=E++,te=n(o,s[F],$,F);if(te)return te}},A=()=>{let M=!1;for(;!y&&a<c;a++){let R=s[a],P=b??t(o,R,a);if(xt(P)){if(y=S(R,P,a),y)break}else if(p){b=void 0;let $=uu(p,P,!0,!0,"inherit");if($._exit){if(y=S(R,$._exit,a),y)break;continue}m.add($);let F=a;if($.addObserver(te=>{m.delete($);try{if(y){if(!g&&te._tag==="Failure")for(let ee of te.cause.reasons)ee._tag!=="Interrupt"&&(y._tag==="Failure"?y.cause.reasons.push(ee):y=On(zi([ee])))}else{let ee=S(R,te,F);ee&&(y=ee._tag==="Failure"?On(zi(ee.cause.reasons.slice())):ee,A())}if(M){let ee=A();ee&&h(ee)}else l&&m.size===0&&h(y??we)}catch(ee){h(w(ee))}}),m.size<u)continue;M=!0,a++;return}else return Bt($=>{p=ta(),m=new Set,b=P,h=$;let F;try{F=A()}catch(te){return $(w(te))}return F?$(F):he(()=>(y=vr,g=!0,m?Ga(m):we))})}if(l=!0,y){if(m&&m.size>0){let R=xg(p);m.forEach(P=>P.interruptUnsafe(p.id,R));return}if(h||y._tag==="Failure")return y}else if(h)if(m)m.size===0&&h(we);else return vr};return A()}},Jd=()=>vM,R4=vM({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag==="Failure")return n;e.out&&(e.out[r]=n.value)}}),z0=d(3,(e,t,n)=>ne(e,r=>t(r)?J(r):n(r))),H0=d(3,(e,t,n)=>ne(e,r=>{let o=t(r);return Fe(o)?n(o.failure):J(o.success)})),TM=d(e=>ve(e[0]),(e,t,n)=>H0(e,t,n?r=>wt(n(r)):()=>wt(new ss))),kM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>he(()=>{let r=[];return Pn(qr(e,(o,s)=>{let i=t(o,s);return typeof i=="boolean"?(i&&r.push(o),we):Be(i,a=>{a&&r.push(o)})},{discard:!0,concurrency:n?.concurrency}),r)})),CM=d(e=>Js(e[0])&&!ve(e[0]),(e,t)=>he(()=>{let n=[];for(let r of e){let o=t(r);Vt(o)&&n.push(o.success)}return J(n)})),AM=d(e=>Js(e[0])&&!ve(e[0]),(e,t,n)=>he(()=>{let r=[];return Pn(qr(e,o=>Be(t(o),s=>{Vt(s)&&r.push(s.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),RM=J({}),OM=kh(Be),_M=Ch(Be,ne),MM=Th(Be);var PM=d(e=>ve(e[0]),(e,t)=>pe(n=>(W4(),J(uu(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),uu=(e,t,n=!1,r=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new fg(s.context,i);return n?a.evaluate(t):s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0),!r&&!a._exit&&(s.children().add(a),a.addObserver(()=>s._children.delete(a))),a},FM=d(e=>ve(e[0]),(e,t)=>pe(n=>J(uu(n,e,t?.startImmediately,!0,t?.uninterruptible)))),UM=e=>pe(t=>{let n=t._children&&new Set(t._children);return Zn(e,r=>{let o=t._children;return o===void 0||o.size===0?we:(n&&(o=zh(o,s=>!n.has(s))),zd(yg(o)))})}),W0=d(e=>ve(e[0]),(e,t,n)=>pe(r=>{let o=uu(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};su(t,s,()=>s_(a=>a===o.id?we:Sg(o))),o.addObserver(()=>F0(t,s))}else o.interruptUnsafe(r.id,xg(r));return J(o)})),DM=d(e=>ve(e[0]),(e,t)=>ne(Kd,n=>W0(e,n,t))),ia=e=>(t,n)=>{let r=new fg(n?.scheduler?Ke(e,Va,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();n.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>n.signal.removeEventListener("abort",o))}return n?.onFiberStart&&n.onFiberStart(r),r},NM=d(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let n={};return su(t,n,()=>Sg(e)),e.addObserver(()=>F0(t,n)),e}),LM=ia(bt()),V0=e=>{let t=ia(e);return(n,r)=>{let o=t(n,r);return r?.onExit&&o.addObserver(r.onExit),s=>o.interruptUnsafe(s)}},BM=V0(bt()),Dg=e=>{let t=ia(e);return(n,r)=>{let o=t(n,r);return new Promise(s=>{o.addObserver(i=>s(i))})}},qM=Dg(bt()),K0=e=>{let t=Dg(e);return(n,r)=>t(n,r).then(o=>{if(o._tag==="Failure")throw hg(o.cause);return o.value})},jM=K0(bt()),Ng=e=>{let t=ia(e);return n=>{if(xt(n))return n;let r=new ei("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??fo(new mg(o))}},$M=Ng(bt()),J0=e=>{let t=Ng(e);return n=>{let r=t(n);if(r._tag==="Failure")throw hg(r.cause);return r.value}},zM=J0(bt()),NO=J(!0),LO=J(!1),e0=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return NO;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let n=0;n<this.waiters.length;n++)this.scheduled.push(this.waiters[n]);return this.waiters=[],NO}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let n=0;n<t.length;n++)t[n](vr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let n=0;n<t.length;n++)t[n](vr)}open=pe(t=>this._isOpen?LO:(this._isOpen=!0,this.scheduleUnsafe(t)));release=pe(t=>this._isOpen?LO:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Bt(t=>this._isOpen?t(we):(this.waiters.push(t),ge(()=>{let n=this.waiters.indexOf(t);n!==-1?this.waiters.splice(n,1):this.scheduled!==void 0&&(n=this.scheduled.indexOf(t),n!==-1&&this.scheduled.splice(n,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=ge(()=>this.closeUnsafe());whenOpen=t=>ne(this.await,()=>t);isOpen(){return this._isOpen}},Lg=e=>new e0(e??!1),HM=e=>ge(()=>Lg(e)),WM=pe(e=>J(e.getRef(og))),VM=d(2,(e,t)=>Tr(e,og,t)),KM=Tr(ig),JM=Tr(ru),t0=BigInt(0),O4={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:t0,endTime:t0,exit:vr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},_4=e=>Object.assign(Object.create(O4),e),GM=e=>e?$e(e.annotations,Af)?e._tag==="Span"?GM(_o(e.parent)):D():L(e):D(),G0=(e,t,n)=>{let r=!e.getRef(ig)||n?.annotations&&$e(n.annotations,Af),o=n?.parent!==void 0?L(n.parent):n?.root?D():GM(e.currentSpan),s;if(r)s=_4({name:t,parent:o,annotations:Ke(n?.annotations??bt(),Af,!0)});else{let i=e.getRef(og),a=e.getRef(ho),c=e.getRef(ru),u=e.getRef(Ld),f=e.getRef(Bd),l=n?.level??e.getRef(AO),p=n?.links!==void 0?[...f,...n.links]:f.length===0?[]:f.slice();s=i.span({name:t,parent:o,annotations:n?.annotations??bt(),links:p,startTime:c?a.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??"internal",root:n?.root??xe(o),sampled:n?.sampled??(Te(o)&&o.value.sampled===!1?!1:!fP(e.getRef(RO),l))});for(let m in u)s.attribute(m,u[m]);if(n?.attributes!==void 0)for(let m in n.attributes)s.attribute(m,n.attributes[m])}return s},ZM=(e,t)=>pe(n=>J(G0(n,e,t))),ps=(e,t)=>sa(pe(n=>{let r=Gn(n.context,Ya),o=G0(n,e,t??{}),s=n.getRef(ho),i=n.getRef(ru);return Pn(ms(r,a=>Bg(o,a,s,i)),o)})),QM=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Fo(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return ne(ps(t,n),o=>_f(r,o,n))}return r=>ne(ps(t,n),o=>_f(r,o,n))},M4=(e,t)=>(t=typeof t=="function"?t:os,ra(Rf,n=>({name:e,stack:t,parent:n}))),YM=Ld,XM=Bd,eP=d(e=>ve(e[0]),(e,t,n={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:n}));return ra(e,Bd,s=>[...s,...o])}),Bg=(e,t,n,r)=>ge(()=>{e.status._tag!=="Ended"&&e.end(r?n.currentTimeNanosUnsafe():t0,t)}),qd=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return pe(o=>{let s=G0(o,e,n),i=o.getRef(ho),a=o.getRef(ru);return Zn(qe(()=>r(s)),c=>Bg(s,c,i,a))})},n0=Tr(ti),_f=function(){let e=ve(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=B;return t._tag==="Span"&&(n=Fo(n),r=M4(t.name,n?.captureStackTrace)),e?n0(r(arguments[0]),t):o=>n0(r(o),t)},tP=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Fo(arguments[2]);if(e){let s=arguments[0];return qd(t,arguments[2],i=>_f(s,i,n))}let r=typeof arguments[1]=="function"?arguments[1]:void 0,o=r?void 0:arguments[1];return(s,...i)=>qd(t,r?r(...i):o,a=>_f(s,a,n))},nP=d(e=>ve(e[0]),(e,...t)=>ra(e,Ld,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||W(r,t[0],t[1]),r})),rP=(...e)=>pe(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[r,o]of Object.entries(e[0]))n.attribute(r,o);else n.attribute(e[0],e[1]);return we}),oP=pe(e=>{let t=e.currentSpanLocal;return t?J(t):wt(new ss)}),sP=S4(ti),ho=Me("effect/Clock",{defaultValue:()=>new r0}),Gb=2**31-1,r0=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=ge(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return P4()}currentTimeNanos=ge(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return aP()}monotonicTimeNanos=ge(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Tn(t))}sleepMillis(t){return t<=0?Pf:Number.isFinite(t)?Bt(n=>{let r=t>Gb?this.sleepMillis(t-Gb):we,o=setTimeout(()=>n(r),Math.min(t,Gb));return ge(()=>clearTimeout(o))}):$d}},iP=BigInt(1e6),aP=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let n=BigInt(Date.now())*iP;return n>t&&(t=n),t}})(),P4=(function(){let e=BigInt(1e9),t;return()=>{let n=aP(),r=BigInt(Date.now())*iP;if(t===void 0)t=r-n;else{let o=t+n;(r>o?r-o:o-r)>e&&(t=r-n)}return t+n}})(),zr=e=>pe(t=>e(t.getRef(ho))),fu=e=>zr(t=>t.sleep(gt(e))),qg=zr(e=>e.currentTimeMillis),cP=zr(e=>e.currentTimeNanos),uP=zr(e=>e.monotonicTimeNanos),o0="~effect/Cause/TimeoutError";var lg=class extends Wi("TimeoutError"){[o0]=o0;constructor(t){super({message:t})}},s0="~effect/Cause/IllegalArgumentError";var dg=class extends Wi("IllegalArgumentError"){[s0]=s0;constructor(t){super({message:t})}},i0="~effect/Cause/ExceededCapacityError";var pg=class extends Wi("ExceededCapacityError"){[i0]=i0;constructor(t){super({message:t})}},a0="~effect/Cause/AsyncFiberError";var mg=class extends Wi("AsyncFiberError"){[a0]=a0;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},c0="~effect/Cause/UnknownError";var jd=class extends Wi("UnknownError"){[c0]=c0;constructor(t,n){super({message:n,cause:t})}},F4=Me("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),U4=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}},D4=ub(lo,U4),fP=Vi(D4),Z0=Me("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([z4,H4])}),N4=Me("effect/Logger/LogToStderr",{defaultValue:qc}),lP=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return sa(pe(t=>{let n=t.getRef(ea),r={...n};for(let o=0;o<e.length;o++){let[s,i]=e[o];W(r,s,i)}return t.setContext(Ke(t.context,ea,r)),ms(Gn(t.context,Ya),o=>{let s=t.getRef(ea),i={...s};for(let a=0;a<e.length;a++){let[c,u]=e[a];s[c]===u&&(Object.hasOwn(n,c)?W(i,c,n[c]):delete i[c])}return t.setContext(Ke(t.context,ea,i)),we})}))},L4="~effect/Logger",B4={[L4]:{_Message:B,_Output:B},pipe(){return ie(this,arguments)}},dP=e=>{let t=Object.create(B4);return t.log=e,t},q4=e=>e.replace(/[\s="]/g,"_"),j4=(e,t)=>`${q4(e[0])}=${t-e[1]}ms`;var gs=e=>(...t)=>{let n;for(let r=0,o=t.length;r<o;r++){let s=t[r];xf(s)&&(n?t.splice(r,1):t=t.slice(0,r).concat(t.slice(r+1)),n=n?zi(n.reasons.concat(s.reasons)):s,r--)}return n===void 0&&(n=Ph),pe(r=>{let o=e??r.currentLogLevel;if(fP(r.minimumLogLevel,o))return we;let s=r.getRef(ho),i=r.getRef(Z0);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:n,fiber:r,date:a,logLevel:o,message:t})}return we})};var ou={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},cie={None:[],All:[],Trace:[ou.gray],Debug:[ou.blue],Info:[ou.green],Warn:[ou.yellow],Error:[ou.red],Fatal:[ou.bgBrightRed,ou.black]};var $4=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 z4=dP(({cause:e,date:t,fiber:n,logLevel:r,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(gg(e));let i=t.getTime(),a=n.getRef(ag),c="";for(let p of a)c+=` ${j4(p,i)}`;let u=n.getRef(ea);Object.keys(u).length>0&&s.push(u);let f=n.getRef(F4);(n.getRef(N4)?f.error:f.log)(`[${$4(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...s)}),H4=dP(({cause:e,fiber:t,logLevel:n,message:r})=>{let o=t.getRef(ho),s=t.getRef(ea),i=t.currentSpan;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))W(a,c,u);a["effect.fiberId"]=t.id,a["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0&&(a["effect.cause"]=gg(e)),i.event(ZA(Array.isArray(r)&&r.length===1?r[0]:r),o.currentTimeNanosUnsafe(),a)});function W4(){Qb.interruptChildren??=g4}var jg=J(void 0);var pP=d(e=>ve(e[0]),(e,t)=>N0(e,n=>pe(r=>(V4(r,n,t?.defectsOnly),we)))),V4=(e,t,n)=>{let r=e.getRef(_O);if(r.size===0||n&&!$O(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(ho).currentTimeNanosUnsafe()};r.forEach(s=>s.report(o))};var $f=xf,zf=eR,$g=Ba;var Xa=zi,mP=Ph,hP=yf,gP=rb,xP=Za,Hf=e=>new Jc(e),Wf=e=>new bd(e),lu=BO,Q0=HO,ec=WO;var du=hg,yP=qO;var Vf=ri;var Y0=f0;var SP=zO;var EP=gg;var Kf=ss,Gd=Cd;var bP=Zc,me=rR;var zg=dg;var wP=pg;var le={};rs(le,{Do:()=>x6,Transaction:()=>nl,TypeId:()=>u6,abortSignal:()=>xV,acquireDisposable:()=>fV,acquireRelease:()=>ic,acquireUseRelease:()=>DF,addFinalizer:()=>NF,all:()=>f6,andThen:()=>Dn,annotateCurrentSpan:()=>kV,annotateLogs:()=>xx,annotateLogsScoped:()=>ZV,annotateSpans:()=>TV,as:()=>zt,asSome:()=>dx,asVoid:()=>jo,awaitAllChildren:()=>DV,bind:()=>E6,bindTo:()=>y6,cached:()=>hx,cachedInvalidateWithTTL:()=>gV,cachedWithTTL:()=>hV,callback:()=>Is,catch:()=>Eu,catchCause:()=>ft,catchCauseFilter:()=>D6,catchCauseIf:()=>U6,catchDefect:()=>Pw,catchEager:()=>yx,catchFilter:()=>P6,catchIf:()=>M6,catchNoSuchElement:()=>F6,catchReason:()=>R6,catchReasons:()=>O6,catchTag:()=>OF,catchTags:()=>_F,clockWith:()=>Iu,context:()=>cr,contextWith:()=>ur,currentParentSpan:()=>AV,currentSpan:()=>CV,delay:()=>ca,die:()=>go,effectify:()=>cK,ensuring:()=>ua,eventually:()=>j6,exit:()=>Jr,fail:()=>G,failCause:()=>ct,failCauseSync:()=>aa,failSync:()=>lx,fiber:()=>NV,fiberId:()=>LV,filter:()=>Bw,filterMap:()=>Y6,filterMapEffect:()=>qw,filterMapOrElse:()=>X6,filterMapOrFail:()=>eV,filterOrElse:()=>PF,filterOrFail:()=>FF,findFirst:()=>m6,findFirstFilter:()=>h6,firstSuccessOf:()=>V6,flatMap:()=>O,flatMapEager:()=>Bn,flatten:()=>_w,flip:()=>C6,fn:()=>$V,fnUntraced:()=>Se,fnUntracedEager:()=>Sx,forEach:()=>Bo,forever:()=>Ht,forkChild:()=>il,forkDetach:()=>al,forkIn:()=>Ut,forkScoped:()=>vs,fromNullishOr:()=>v6,fromOption:()=>w6,fromResult:()=>Ow,gen:()=>$t,head:()=>g6,ignore:()=>Uw,ignoreCause:()=>Dw,interrupt:()=>yo,interruptible:()=>fa,interruptibleMask:()=>Vw,isEffect:()=>Ar,isFailure:()=>sV,isSuccess:()=>iV,let:()=>S6,linkSpans:()=>_V,log:()=>zV,logDebug:()=>KV,logError:()=>hp,logFatal:()=>HV,logInfo:()=>VV,logTrace:()=>JV,logWarning:()=>WV,logWithLevel:()=>cl,makeSpan:()=>Jw,makeSpanScoped:()=>Gw,map:()=>Y,mapBoth:()=>N6,mapBothEager:()=>fn,mapEager:()=>la,mapError:()=>ol,mapErrorEager:()=>vu,match:()=>jw,matchCause:()=>nV,matchCauseEager:()=>rV,matchCauseEffect:()=>Gr,matchCauseEffectEager:()=>oV,matchEager:()=>tV,matchEffect:()=>UF,never:()=>Kr,onError:()=>xo,onErrorFilter:()=>dV,onErrorIf:()=>lV,onExit:()=>fr,onExitFilter:()=>mV,onExitIf:()=>pV,onExitPrimitive:()=>Ww,onInterrupt:()=>pi,option:()=>k6,orDie:()=>di,orElseSucceed:()=>W6,partition:()=>l6,promise:()=>ux,provide:()=>$w,provideContext:()=>Nn,provideService:()=>$o,provideServiceEffect:()=>uV,race:()=>Q6,raceAll:()=>Lw,raceAllFirst:()=>Z6,raceFirst:()=>sc,reduce:()=>d6,repeat:()=>LF,repeatOrElse:()=>yV,replicate:()=>SV,replicateEffect:()=>Kw,request:()=>FV,requestUnsafe:()=>UV,result:()=>T6,retry:()=>px,retryOrElse:()=>Fw,runCallback:()=>BV,runCallbackWith:()=>Zw,runFork:()=>mp,runForkWith:()=>Ln,runPromise:()=>Qw,runPromiseExit:()=>gx,runPromiseExitWith:()=>qV,runPromiseWith:()=>Yw,runSync:()=>hi,runSyncExit:()=>ac,runSyncExitWith:()=>jV,runSyncWith:()=>Xw,sandbox:()=>$6,satisfiesErrorType:()=>fK,satisfiesServicesType:()=>lK,satisfiesSuccessType:()=>uK,schedule:()=>EV,scheduleFrom:()=>BF,scope:()=>zo,scoped:()=>wu,scopedWith:()=>dp,service:()=>zw,serviceOption:()=>bu,setContext:()=>aV,sleep:()=>oc,spanAnnotations:()=>RV,spanLinks:()=>OV,succeed:()=>v,succeedNone:()=>ws,succeedSome:()=>fx,suspend:()=>V,sync:()=>se,tap:()=>Mt,tapCause:()=>fp,tapCauseFilter:()=>q6,tapCauseIf:()=>B6,tapDefect:()=>MF,tapError:()=>up,tapErrorTag:()=>L6,timed:()=>G6,timeout:()=>Nw,timeoutOption:()=>K6,timeoutOrElse:()=>J6,tracer:()=>bV,track:()=>YV,trackDefects:()=>tK,trackDuration:()=>nK,trackErrors:()=>eK,trackSuccesses:()=>XV,transposeOption:()=>I6,try:()=>qo,tryPromise:()=>bs,tx:()=>rK,txRetry:()=>aK,undefined:()=>rl,uninterruptible:()=>mi,uninterruptibleMask:()=>So,unwrapReason:()=>_6,updateContext:()=>lp,updateService:()=>Hw,updateServiceScoped:()=>cV,useSpan:()=>pp,validate:()=>p6,void:()=>H,when:()=>mx,whileLoop:()=>Yn,withErrorReporting:()=>H6,withExecutionPlan:()=>z6,withFiber:()=>xn,withLogSpan:()=>QV,withLogger:()=>GV,withParentSpan:()=>sl,withSpan:()=>MV,withSpanScoped:()=>PV,withTracer:()=>wV,withTracerEnabled:()=>IV,withTracerTiming:()=>vV,yieldNow:()=>cp,yieldNowWith:()=>b6,zip:()=>Mw,zipWith:()=>A6});var xs=nb,kn=rt,qt=On,Uo=uo,Hg=fo,Wg=wg,Kt=vr;var Ft=Uf,ii=b_;var IP=C_;var Vr={};rs(Vr,{CurrentMemoMap:()=>hu,build:()=>FP,buildWithMemoMap:()=>ci,buildWithScope:()=>Zd,catch:()=>f8,catchCause:()=>d8,catchTag:()=>l8,effect:()=>Wr,effectContext:()=>Gf,effectDiscard:()=>o8,empty:()=>r8,flatMap:()=>NP,forkMemoMap:()=>n8,forkMemoMapUnsafe:()=>ow,fresh:()=>p8,fromBuild:()=>tc,fromBuildMemo:()=>Zg,isLayer:()=>Gg,launch:()=>m8,makeMemoMap:()=>t8,makeMemoMapUnsafe:()=>ai,merge:()=>i8,mergeAll:()=>Qg,mock:()=>h8,orDie:()=>Yg,parentSpan:()=>BP,provide:()=>Ss,provideMerge:()=>Qd,satisfiesErrorType:()=>y8,satisfiesServicesType:()=>S8,satisfiesSuccessType:()=>x8,span:()=>E8,succeed:()=>ui,succeedContext:()=>gu,suspend:()=>s8,sync:()=>sw,syncContext:()=>tw,tap:()=>a8,tapCause:()=>u8,tapError:()=>c8,unwrap:()=>nw,updateService:()=>LP,withParentSpan:()=>rw,withSpan:()=>b8});var K4="~effect/Deferred";var J4={[K4]:{_A:B,_E:B},pipe(){return ie(this,arguments)}},pu=()=>{let e=Object.create(J4);return e.resumes=void 0,e.effect=void 0,e};var mu=e=>Bt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),ge(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)})));var G4=d(2,(e,t)=>ge(()=>Jf(e,t))),X0=G4;var Z4=d(2,(e,t)=>X0(e,On(t)));var ew=d(2,(e,t)=>Z4(e,Za(t)));var Jf=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let r=0;r<n.length;r++)n[r](t)}return!0};var vP=ea;var TP=ag,kP=Rf;var CP=ru,AP=MO;var It=Ya;var Hr=cu,Do=aM,No=ms,_t=sM;var Cn=oM,Je=P0;var PP="~effect/Layer",RP="~effect/Layer/MemoMap",Y4=(e,t)=>(e.observers++,jr(ms(t,n=>e.finalizer(n)),e.effect)),Gg=e=>q(e,PP),X4={[PP]:{_ROut:B,_E:B,_RIn:B},pipe(){return ie(this,arguments)}},xu=e=>{let t=Object.create(X4);return t.build=e,t},tc=e=>xu((t,n)=>{let r=Cn(n);return Zn(e(t,r),o=>o._tag==="Failure"?Je(r,o):we)}),Zg=e=>{let t=tc((n,r)=>n.getOrElseMemoize(t,r,e));return t},e8=(e,t,n,r)=>{let o=Hr(),s=pu(),i={observers:1,effect:mu(s),finalizer:a=>he(()=>(i.observers--,i.observers===0?(e.map.delete(t),Je(o,a)):we))};return e.map.set(t,i),ms(n,i.finalizer).pipe(ne(()=>r(e,o)),Zn(a=>(i.effect=a,X0(s,a))))},Jg=class{get[RP](){return RP}parent;constructor(t){this.parent=t}map=new Map;get(t,n){let r=this.map.get(t);return r?Y4(r,n):this.parent?.get(t,n)}getOrElseMemoize(t,n,r){return he(()=>{let o=this.get(t,n);return o||e8(this,t,n,r)})}},ai=()=>new Jg,ow=e=>new Jg(e),t8=ge(ai),n8=e=>ge(()=>ow(e)),hu=class e extends Ve()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let n=Ji(t,e);return n?ow(n):ai()}},ci=d(3,(e,t,n)=>Tr(Be(e.build(t,n),Ke(hu,t)),hu,t)),FP=e=>pe(t=>ci(e,hu.forkOrCreate(t.context),Gn(t.context,It))),Zd=d(2,(e,t)=>pe(n=>ci(e,hu.forkOrCreate(n.context),t))),ui=function(){return arguments.length===1?e=>gu(us(arguments[0],e)):gu(us(arguments[0],arguments[1]))},gu=e=>xu(Qe(J(e))),r8=gu(bt()),sw=function(){return arguments.length===1?e=>tw(()=>us(arguments[0],e())):tw(()=>us(arguments[0],arguments[1]()))},tw=e=>Zg(Qe(ge(e))),Wr=function(){return arguments.length===1?e=>OP(arguments[0],e):OP(arguments[0],arguments[1])},OP=(e,t)=>Gf(Be(t,n=>us(e,n))),Gf=e=>Zg((t,n)=>Do(e,n)),o8=e=>Gf(Pn(e,bt())),s8=e=>Zg((t,n)=>he(()=>e().build(t,n))),nw=e=>{let t=Ve("effect/Layer/unwrap");return NP(Wr(t)(e),$e(t))},UP=(e,t,n)=>{let r=Cn(n,"parallel");return qr(e,o=>o.build(t,Cn(r,"sequential")),{concurrency:e.length}).pipe(Be(o=>nO(...o)))},Qg=(...e)=>tc((t,n)=>UP(e,t,n)),i8=d(2,(e,t)=>Qg(e,...Array.isArray(t)?t:[t])),DP=(e,t,n)=>tc((r,o)=>ne(Array.isArray(t)?UP(t,r,o):t.build(r,o),s=>e.build(r,o).pipe(oa(s),Be(i=>n(i,s))))),Ss=d(2,(e,t)=>DP(e,t,B)),Qd=d(2,(e,t)=>DP(e,t,(n,r)=>br(r,n))),NP=d(2,(e,t)=>tc((n,r)=>ne(e.build(n,r),o=>t(o).build(n,r)))),a8=d(2,(e,t)=>tc((n,r)=>ne(e.build(n,r),o=>Do(Pn(t(o),o),r)))),c8=d(2,(e,t)=>tc((n,r)=>Cr(e.build(n,r),o=>Do(jr(t(o),wt(o)),r)))),u8=d(2,(e,t)=>tc((n,r)=>kr(e.build(n,r),o=>Do(jr(t(o),ot(o)),r)))),Yg=e=>xu((t,n)=>Ag(e.build(t,n))),f8=d(2,(e,t)=>xu((n,r)=>Cr(e.build(n,r),o=>t(o).build(n,r))));var l8=d(3,(e,t,n)=>xu((r,o)=>Cg(e.build(r,o),t,s=>n(s).build(r,o)))),d8=d(2,(e,t)=>xu((n,r)=>kr(e.build(n,r),o=>t(o).build(n,r)))),LP=d(3,(e,t,n)=>Ss(e,Wr(t,Be(t,n)))),p8=e=>xu((t,n)=>e.build(ai(),n)),m8=e=>_g(jr(FP(e),$d)),h8=function(){return arguments.length===1?e=>_P(arguments[0],e):_P(arguments[0],arguments[1])},_P=(e,t)=>ui(e)(new Proxy({...t},{get(n,r,o){if(r in n)return n[r];let s=ni();ar(2);let i=new Error(`${e.key}: Unimplemented method "${r.toString()}"`);return ar(s),i.name="UnimplementedError",g8(i)},has:Xt})),g8=e=>{let t=Object.assign(na(e),{[MP]:MP,channel:{[Kg]:Kg,transform:()=>J(t),pipe(){return ie(this,arguments)}},[Kg]:Kg,transform:()=>J(t)});function n(){return t}return Object.assign(n,t),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n},MP="~effect/Stream",Kg="~effect/Channel",x8=()=>e=>e,y8=()=>e=>e,S8=()=>e=>e,E8=(e,t)=>(t=Fo(t),Wr(ti,t?.onEnd?oi(ps(e,t),n=>Bf(r=>t.onEnd(n,r))):ps(e,t))),BP=e=>gu(ti.context(e)),b8=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Fo(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return nw(Be(n?.onEnd!==void 0?oi(ps(t,n),o=>Bf(s=>n.onEnd(o,s))):ps(t,n),o=>rw(r,o)))}return r=>nw(Be(n?.onEnd!==void 0?oi(ps(t,n),o=>Bf(s=>n.onEnd(o,s))):ps(t,n),o=>rw(r,o)))},rw=function(){let e=Gg(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=B;t._tag==="Span"&&(n=Fo(n),r=w8(t.name,n?.captureStackTrace));let o=BP(t);return e?Ss(r(arguments[0]),o):s=>Ss(r(s),o)},w8=(e,t)=>(t=typeof t=="function"?t:os,LP(kP,n=>({name:e,stack:t,parent:n})));var qP="~effect/ExecutionPlan";var I8={[qP]:qP,get captureRequirements(){let e=this;return Qa(t=>J(v8(e.steps.map(n=>({...n,provide:Gg(n.provide)?Ss(n.provide,gu(t)):n.provide})))))},pipe(){return ie(this,arguments)}},v8=e=>{let t=Object.create(I8);return t.steps=e,t};var Xg=Me("effect/ExecutionPlan/CurrentMetadata",{defaultValue:Qe({attempt:0,stepIndex:0})});var fi={};rs(fi,{Clock:()=>nc,clockWith:()=>T8,currentTimeMillis:()=>k8,currentTimeNanos:()=>C8,monotonicTimeNanos:()=>A8});var nc=ho,T8=zr,k8=qg,C8=cP,A8=uP;var ex="~effect/time/DateTime",tx="~effect/time/DateTime/TimeZone",$P={[ex]:ex,pipe(){return ie(this,arguments)},[at](){return this.toString()},toJSON(){return tp(this).toJSON()}},R8={...$P,_tag:"Utc",[Oe](){return Lr(this.epochMilliseconds)},[_e](e){return Zf(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${tp(this).toJSON()})`}},O8={...$P,_tag:"Zoned",[Oe](){return Nt(Lr(this.epochMilliseconds))(ce(this.zone))},[_e](e){return Zf(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&ae(this.zone,e.zone)},toString(){return`DateTime.Zoned(${yw(this)})`}},zP={[tx]:tx,[at](){return this.toString()}},_8={...zP,_tag:"Named",[Oe](){return it(`Named:${this.id}`)},[_e](e){return Su(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},M8={...zP,_tag:"Offset",[Oe](){return it(`Offset:${this.offset}`)},[_e](e){return Su(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${hw(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},li=(e,t,n)=>{let r=Object.create(O8);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},Zf=e=>q(e,ex);var Su=e=>q(e,tx),HP=e=>Su(e)&&e._tag==="Offset",WP=e=>Su(e)&&e._tag==="Named",VP=e=>e._tag==="Utc",uw=e=>e._tag==="Zoned",KP=un((e,t)=>e.epochMilliseconds===t.epochMilliseconds),JP=is((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var GP=e=>{let t=Object.create(R8);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},yu=e=>{let t=e.getTime();if(Number.isNaN(t))throw new zg("Invalid date");return GP(t)},nx=e=>{if(Zf(e))return e;if(e instanceof Date)return yu(e);if(typeof e=="object"){if("epochMilliseconds"in e)return yu(new Date(e.epochMilliseconds));let t=new Date(0);return q8(t,e),yu(t)}else if(typeof e=="string"&&!P8(e))return yu(new Date(e+"Z"));return yu(new Date(e))},P8=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),F8=-864e13+720*60*1e3,U8=864e13-840*60*1e3,fw=(e,t)=>{let n=t?.timeZone;if(n===void 0&&Zf(e)&&uw(e))return e;let r=nx(e);if(r.epochMilliseconds<F8||r.epochMilliseconds>U8)throw new RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);n===void 0&&typeof e=="object"&&"timeZoneId"in e&&(n=e.timeZoneId);let o;if(n===void 0){let s=new Date(r.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=ep(s)}else if(Su(n))o=n;else if(typeof n=="number")o=ep(n);else{let s=pw(n);if(xe(s))throw new zg(`Invalid time zone: ${n}`);o=s.value}return t?.adjustForTimeZone!==!0?li(r.epochMilliseconds,o,r.partsUtc):j8(r.epochMilliseconds,o,t?.disambiguation??"compatible")},aw=$a(fw),ZP=$a(nx),D8=/^(.{17,35})\[(.+)\]$/,QP=e=>{let t=D8.exec(e);if(t===null){let o=xw(e);return o!==null?aw(e,{timeZone:o}):D()}let[,n,r]=t;return aw(n,{timeZone:r})};var YP=e=>GP(e.epochMilliseconds);var Xd=new Map,N8={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},L8=e=>{let t=e.resolvedOptions().timeZone;if(Xd.has(t))return Xd.get(t);let n=Object.create(_8);return n.id=t,n.format=e,Xd.set(t,n),n},lw=e=>{if(Xd.has(e))return Xd.get(e);try{return L8(new Intl.DateTimeFormat("en-US",{...N8,timeZone:e}))}catch{throw new zg(`Invalid time zone: ${e}`)}},ep=e=>{let t=Object.create(M8);return t.offset=e,t},dw=$a(lw);var B8=/^(?:GMT|[+-])/,pw=e=>{if(B8.test(e)){let t=xw(e);return t===null?D():L(ep(t))}return dw(e)},XP=e=>e._tag==="Offset"?hw(e.offset):e.id;var tp=e=>new Date(e.epochMilliseconds),rx=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(r=>r.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},mw=e=>rx(e).getTime()-gw(e),hw=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},eF=e=>hw(mw(e)),gw=e=>e.epochMilliseconds;var q8=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.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 jP=1440*60*1e3,j8=(e,t,n)=>{if(t._tag==="Offset")return li(e-t.offset,t);let r=Yd(e-jP,e,t),o=Yd(e+jP,e,t);if(r===o)return li(e-r,t);let s=r<o,i=r-o;if(s){if(Yd(e-o,e,t)===o)return li(e-o,t);let u=li(e-r,t),f=rx(u).getTime();if(e!==f)switch(n){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return li(e-o,t);case"compatible":case"later":return u}return u}if(Yd(e-r,e,t)===r){if(n==="earlier"||n==="compatible"||Yd(e-r+i,e+i,t)===r)return li(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return li(e-o,t)},$8=/([+-])(\d{2}):(\d{2})$/,xw=e=>{let t=$8.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1e3},Yd=(e,t,n)=>{let r=n.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=xw(r);return o===null?mw(li(t,n)):o};var tF=e=>tp(e).toISOString();var cw=e=>{let t=rx(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${eF(e)}`},yw=e=>e.zone._tag==="Offset"?cw(e):`${cw(e)}[${e.zone.id}]`;var Vie=globalThis.Number;var rF=d(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e"))return!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0?NaN:H8(e,t);let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,i=o>s?o:s,a=parseInt(e.toFixed(i).replace(".","")),c=parseInt(t.toFixed(i).replace(".",""));return a%c/Math.pow(10,i)});function H8(e,t){let[n,r]=nF(e),[o,s]=nF(t),i=Math.min(r,s),a=n*BigInt(10)**BigInt(r-i),c=o*BigInt(10)**BigInt(s-i),u=a%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${i}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f}function nF(e){let t=Math.abs(e).toExponential(),n=t.indexOf("e"),r=t.slice(0,n).replace(".","");return[BigInt(r)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(n+1))-r.length+1]}var oF=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)};var sF=To((e,t)=>Math.max(e,t),-1/0),iF=To((e,t)=>Math.min(e,t),1/0);var Jie=globalThis.String,ox=ao;var cF=e=>e.trim();var jt=d(2,(e,t)=>Nf(e,W8,n=>t(n))),Lo=e=>e.reasons.some(Ew),Ew=e=>e._tag==="Fail"&&Gd(e.error),Qf=e=>{let t,n=!1;for(let r of e.reasons)Ew(r)?t??=r.error:r._tag!=="Interrupt"&&(n=!0);return t===void 0?Ae(e):n?Ae(Xa(e.reasons.filter(r=>!Ew(r)))):Ce(t)};var W8=e=>{let t=Qf(e);return Fe(t)?t:Ce(t.success.value)},bw=e=>{let t=Qf(e);return Fe(t)?qt(t.failure):kn(t.success.value)},np=d(2,(e,t)=>ds(e,{onSuccess:t.onSuccess,onFailure:n=>{let r=Qf(n);return Fe(r)?t.onFailure(r.failure):t.onDone(r.success.value)}}));var uF="~effect/Schedule";var Un=Me("effect/Schedule/CurrentMetadata",{defaultValue:Qe({input:void 0,output:void 0,duration:Zi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),V8={[uF]:{_Out:B,_In:B,_Env:B},pipe(){return ie(this,arguments)}},ww=e=>q(e,uF),sx=e=>{let t=Object.create(V8);return t.step=e,t},Iw=()=>{let e=0,t,n;return(r,o)=>{n===void 0&&(n=r);let s=r-n,i=t===void 0?0:r-t;return t=r,{input:o,attempt:++e,start:n,now:r,elapsed:s,elapsedSincePrevious:i}}},fF=e=>sx(Be(e,t=>{let n=Iw();return(r,o)=>t(n(r,o))})),ix=e=>kr(e.step,t=>J(()=>ot(t))),Es=e=>zr(t=>Be(ix(e),n=>{let r=Iw();return o=>he(()=>{let s=t.currentTimeMillisUnsafe();return ne(n(s,o),([i,a])=>{let c=r(s,o);return c.output=i,c.duration=a,Pn(fu(a),c)})})})),Yf=e=>Be(Es(e),t=>n=>Be(t(n),r=>r.output));var lF=e=>sx(Be(jf(e.map(ix)),t=>(n,r)=>ne(qr(t,o=>np(o(n,r),{onSuccess:s=>J(s[1]),onDone:()=>jg,onFailure:ot})),o=>{let s=K8(o);return s===void 0?me(Zi):J([s,s])}))),K8=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:fO(t,r))}return t},dF=(e,t=2)=>{let n=Tn(gt(e));return fF(J(r=>{let o=fs(n*Math.pow(t,r.attempt-1));return J([o,o])}))};var vw=e=>sx(Be(ix(e),t=>(n,r)=>np(t(n,r),{onSuccess:o=>J([r,o[1]]),onFailure:ot,onDone:()=>me(r)}))),pF=e=>rp(op,({attempt:t})=>J(t<=e)),Xf=e=>{let t=gt(e);return fF(J(n=>J([n.attempt-1,t])))};var rp=d(2,(e,t)=>sx(Be(ix(e),n=>{let r=Iw();return(o,s)=>ne(n(o,s),i=>{let[a,c]=i,u=t({...r(o,s),output:a,duration:c});return ne(ve(u)?u:J(u),f=>f?J(i):me(a))})})));var op=Xf(Zi);var J8=(e,t,n)=>Mg(r=>ne(n?.local?ci(t,ai(),r):Zd(t,r),o=>oa(e,o))),ax=d(e=>ve(e[0]),(e,t,n)=>Dd(t)?oa(e,t):J8(e,Array.isArray(t)?Qg(...t):t,n));var Tw=d(3,(e,t,n)=>ne(Es(t),r=>{let o=Un.defaultValue();return Cr(vg(oi(ne(he(()=>Tr(e,Un,o)),r),s=>ge(()=>{o=s})),{disableYield:!0}),s=>Cd(s)?J(s.value):n(s,o.attempt===0?D():L(o)))})),kw=d(3,(e,t,n)=>ne(Es(t),r=>{let o=Un.defaultValue(),s,i=Cr(he(()=>Tr(e,Un,o)),a=>(s=a,ne(r(a),c=>(o=c,i))));return jt(i,a=>qe(()=>n(s,a)))})),hF=d(2,(e,t)=>{let n=typeof t=="function"?t(B):ww(t)?t:ip(t);return Tw(e,n,wt)}),sp=d(2,(e,t)=>{let n=typeof t=="function"?t(B):ww(t)?t:ip(t);return kw(e,n,wt)}),gF=d(3,(e,t,n)=>ne(Es(n),r=>{let o=Un.defaultValue(),s=he(()=>Tr(e,Un,o));return Cr(ne(r(t),i=>{o=i;let a=Qe(ne(s,r));return si({while:Xt,body:a,step(c){o=c}})}),i=>Cd(i)?J(i.value):wt(i))})),G8=vw(op),ip=e=>{let t=e.schedule?vw(e.schedule):G8;return e.while&&(t=rp(t,({input:n})=>{let r=e.while(n);return ve(r)?r:J(r)})),e.until&&(t=rp(t,({input:n})=>{let r=e.until(n);return ve(r)?Be(r,o=>!o):J(!r)})),e.times!==void 0&&(t=rp(t,({attempt:n})=>J(n<=e.times))),t};var Cw=(e,t)=>{let n=-1,r=0,o=s=>Rg(e(s));return{begin:zr(s=>he(()=>{let i=t();i.stepIndex!==n&&(n=i.stepIndex,r=0),r++;let a={attempt:i.attempt,stepAttempt:r,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Pn(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>zr(a=>{let c=Br(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})})}},yF=d(e=>ve(e[0]),(e,t,n)=>he(()=>{let r=0,o={attempt:0,stepIndex:0},s=Ig(Xg,ge(()=>(o={attempt:o.attempt+1,stepIndex:r},o))),i=n?.onEvent===void 0?void 0:Cw(n.onEvent,()=>o),a=i===void 0?B:u=>$r(f=>ne(i.begin,l=>Zn(f(u),p=>i.end(l,p)))),c;return ne(si({while:()=>r<t.steps.length&&(c===void 0||Fe(c)),body(){let u=t.steps[r],f=s(a(ax(e,u.provide)));if(c){let l=!1,p=f;f=he(()=>l?p:(l=!0,Mf(c))),f=sp(f,ap(u,!1))}else{let l=ap(u,!0);f=l?sp(f,l):f}return Ja(f)},step(u){c=u,r++}}),()=>Mf(c))})),ap=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return ip({schedule:e.schedule?e.schedule:e.attempts?void 0:Z8,times:e.attempts,while:e.while});return ip({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},Z8=pF(1);var Q8="~effect/Request",Y8=QE({_E:e=>e,_A:e=>e,_R:e=>e}),uae={...XA,[Q8]:Y8};var EF=e=>e;var wF=d(2,(e,t)=>{let n=r=>Bt(o=>{let s=vF(r,e,o,ta());return e6(r,s)});return ve(t)?ne(t,n):n(t)}),IF=(e,t)=>{let n=vF(t.resolver,e,t.onExit,{context:t.context,currentScheduler:$e(t.context,Va)});return()=>TF(t.resolver,n)},cx=[],Aw=new WeakMap,vF=(e,t,n,r)=>{let o=Aw.get(e);o||(o=new Map,Aw.set(e,o));let s,i=!1,a=EF({request:t,context:r.context,uninterruptible:!1,completeUnsafe(u){i||(i=!0,n(u),s?.entrySet.delete(a))}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(cx.length>0)s=cx.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:ne(he(()=>u.resolver.delay),f=>bF(u)),run:Zn(he(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let l of u.entrySet)l.completeUnsafe(f._tag==="Success"?fo(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):f);return u.entries.clear(),cx.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,cx.push(u)),we})};s=u}o.set(c,s),s.fiber=ia(r.context)(s.delayEffect,{scheduler:r.currentScheduler})}return s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(r.id),s.fiber=ia(r.context)(bF(s),{scheduler:r.currentScheduler})),a},TF=(e,t)=>{if(t.uninterruptible)return;let n=Aw.get(e);if(!n)return;let r=e.batchKey(t),o=n.get(r);o&&(o.entries.delete(t),o.entrySet.delete(t),o.entries.size===0&&(n.delete(r),o.fiber?.interruptUnsafe()))},e6=(e,t)=>ge(()=>TF(e,t));function bF(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):we}var n6="effect/Metric/CurrentMetricAttributes",r6=Me(n6,{defaultValue:()=>({})}),o6="~effect/observability/Metric/MetricRegistryKey",s6=Me(o6,{defaultValue:()=>new Map}),kF="~effect/observability/Metric",CF=class{[kF]=kF;#e=new WeakMap;#t;id;description;attributes;constructor(t,n,r){this.id=t,this.description=n,this.attributes=r}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,n){return this.hook(n).modify(t,n)}updateUnsafe(t,n){return this.hook(n).update(t,n)}hook(t){let n=$e(t,r6);if(Object.keys(n).length===0)return Kn(this.#t)?this.#t.hooks:(this.#t=this.getOrCreate(t,this.attributes),this.#t.hooks);let r=c6(this.attributes,n),o=this.#e.get(r);return Kn(o)||(o=this.getOrCreate(t,r),this.#e.set(r,o)),o.hooks}getOrCreate(t,n){let r=i6(this,n),o=$e(t,s6);if(o.has(r))return o.get(r);let s=this.createHooks(),i={id:this.id,type:this.type,description:this.description,attributes:Rw(n),hooks:s};return o.set(r,i),i}pipe(){return ie(this,arguments)}};var tl=d(2,(e,t)=>Qa(n=>ge(()=>e.updateUnsafe(t,n))));function i6(e,t){let n=`${e.type}:${e.id}`;return Kn(e.description)&&(n+=`:${e.description}`),Kn(t)&&(n+=`:${a6(t)}`),n}function a6(e){return JSON.stringify(Array.isArray(e)?e:Object.entries(e))}function c6(e,t){return{...Rw(e),...Rw(t)}}function Rw(e){return Kn(e)&&Array.isArray(e)?e.reduce((t,[n,r])=>(W(t,n,r),t),{}):e}var u6=Qs,Ar=ve,f6=jf,l6=$0,d6=xM,p6=yM,m6=SM,h6=bM,Bo=qr,g6=IM,Yn=si,ux=x0,bs=o_,v=J,ws=iu,fx=g0,V=he,se=ge,H=we;var rl=jg;var Is=Bt,Kr=$d,x6=RM,y6=OM,S6=MM;var E6=_M,$t=c_,G=wt,lx=Eg,ct=ot,aa=n_,go=na,qo=r_;var cp=Pf,b6=h0,xn=pe,Ow=Mf,w6=m0,I6=t_,v6=e_,O=ne,_w=g_,Dn=jr,Mt=oi,T6=Ja,k6=Z_,Jr=Vd,Y=Be,zt=Pn,dx=Ff,jo=zd,C6=l_,Mw=P_,A6=v0,Eu=Cr;var OF=Cg,_F=z_,R6=H_,O6=W_,_6=V_,ft=kr,Pw=L_,M6=Hd,P6=kg,F6=N_,U6=k0,D6=Nf,ol=A0,N6=R0,di=Ag,up=C0,L6=j_,fp=B_,B6=q_,q6=Tg,MF=$_,j6=O0,px=sp,Fw=kw,$6=d_,Uw=G_,Dw=Rg,z6=yF,H6=pP,W6=K_,V6=J_,Nw=tM,K6=nM,J6=M0,ca=eM,oc=fu,G6=rM,Lw=b0,Z6=w0,Q6=p_,sc=bg,Bw=kM,Y6=CM,qw=AM,PF=z0,X6=H0,FF=F_,eV=TM,mx=U_,jw=Og,tV=Wd,nV=_0,rV=Q_,oV=m_,Gr=ds,UF=au,sV=Y_,iV=X_,cr=I0,ur=Qa,$w=ax,Nn=oa,aV=M_,zw=R_,bu=O_,lp=Df,Hw=ra,cV=__,$o=Tr,uV=Ig,zo=Kd,wu=_g,dp=Mg,ic=Pg,fV=lM,DF=fM,NF=Bf,ua=cM,xo=N0,lV=uM,dV=L0,Ww=hs,fr=Zn,pV=U0,mV=D0,hx=dM,hV=q0,gV=B0,yo=qf,fa=j0,pi=Fg,mi=sa,So=$r,Vw=hM,xV=gM,Ht=vg,LF=hF,yV=Tw,SV=T0,Kw=D_,EV=d(2,(e,t)=>BF(e,void 0,t)),BF=gF,bV=WM,wV=VM,IV=KM,vV=JM,TV=nP,kV=rP,CV=oP,AV=sP,RV=YM,OV=XM,_V=eP,Jw=ZM,Gw=ps,pp=qd,MV=tP,PV=QM,sl=_f,FV=wF,UV=IF,il=PM,Ut=W0,vs=DM,al=FM,DV=UM,NV=i_,LV=a_,mp=LM,Ln=ia,Zw=V0,BV=BM,Qw=jM,Yw=K0,gx=qM,qV=Dg,hi=zM,Xw=J0,ac=$M,jV=Ng,Se=S0,$V=u_,Iu=zr,cl=gs,zV=gs(),HV=gs("Fatal"),WV=gs("Warn"),hp=gs("Error"),VV=gs("Info"),KV=gs("Debug"),JV=gs("Trace"),GV=d(2,(e,t)=>ra(e,Z0,n=>new Set([...n,t]))),xx=d(e=>Ar(e[0]),(e,...t)=>ra(e,vP,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||W(r,t[0],t[1]),r})),ZV=lP,QV=d(2,(e,t)=>ne(qg,n=>ra(e,TP,r=>[[t,n],...r]))),YV=d(e=>Ar(e[0]),(e,t,n)=>fr(e,r=>{let o=n===void 0?r:qe(()=>n(r));return tl(t,o)})),XV=d(e=>Ar(e[0]),(e,t,n)=>Mt(e,r=>{let o=n===void 0?r:n(r);return tl(t,o)})),eK=d(e=>Ar(e[0]),(e,t,n)=>up(e,r=>{let o=n===void 0?r:qe(()=>n(r));return tl(t,o)})),tK=d(e=>Ar(e[0]),(e,t,n)=>MF(e,r=>{let o=n===void 0?r:qe(()=>n(r));return tl(t,o)})),nK=d(e=>Ar(e[0]),(e,t,n)=>Iu(r=>{let o=r.monotonicTimeNanosUnsafe();return fr(e,()=>{let s=r.monotonicTimeNanosUnsafe(),i=lO(gt(s),gt(o)),a=n===void 0?i:qe(()=>n(i));return tl(t,a)})})),nl=class extends Ve()("effect/Effect/Transaction"){},rK=e=>xn(t=>{let n=Ji(t.context,nl);if(n)return e;n={journal:new Map,retry:!1};let r;return So(o=>O(Yn({while:()=>!r,body:Qe(o(e).pipe($o(nl,n),fp(()=>n.retry?o(sK(n)):H),Jr)),step(s){if(n.retry||!oK(n))return RF(n);Ft(s)?iK(t,n):RF(n),r=s}}),()=>r))}),oK=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},sK=e=>V(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let o of n)o.pending.delete(t)};return Is(o=>{let s=()=>{r(),o(H)};for(let i of n)i.pending.set(t,s);return se(r)})});function iK(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version=n.version+1,n.value=r);for(let o of n.pending.values())e.currentDispatcher.scheduleTask(o,0);n.pending.clear()}}function RF(e){e.retry=!1,e.journal.clear()}var aK=O(nl,e=>(e.retry=!0,yo)),cK=(e,t,n)=>(...r)=>Is(o=>{try{e(...r,(s,i)=>{o(s?G(t?t(s,r):s):v(i))})}catch(s){o(n?G(n(s,r)):go(s))}}),uK=()=>e=>e,fK=()=>e=>e,lK=()=>e=>e,la=x_,vu=y_,fn=S_,Bn=h_,yx=E_,Sx=f_;function gi(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function gp(e){return t=>gi(t)?.[e]}var Zr="~structural",Tu="~identifier",xp="~sentinels",Ex="~constructor",qF=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],ul=gp("identifier"),eI=gp(Tu),tI=gp("title");var jF=gp("brands"),yp=wn(e=>{let t=gi(e)?.identifier;return typeof t=="string"?t:e.getExpected(yp)});var $F=new Set([xp,Zr,"representation","arbitrary","brands","toJsonSchema","toCode","toArbitrary","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso"]);var ze=Symbol();var Ho=kn,Ts=Ho(ze),on=Ho(ze),bx=e=>e===ze?D():L(e),nI=e=>e._tag==="None"?Ts:Ho(e.value);var Ep="~effect/SchemaIssue/Issue";function oI(e){return q(e,Ep)&&e[Ep]===Ep}function dK(e){return Object.hasOwn(e,"input")}var Eo=class{[Ep]=Ep;constructor(t,n){n?.reportInput===!0&&t!==ze&&(this.input=t)}},vx=class extends Eo{_tag="Filter";filter;issue;constructor(t,n,r,o){super(r,o),this.filter=t,this.issue=n}},Tx=class extends Eo{_tag="Encoding";ast;issue;constructor(t,n,r,o){super(r,o),this.ast=t,this.issue=n}},Ct=class extends Eo{_tag="Pointer";path;issue;constructor(t,n){super(),this.path=t,this.issue=n}},sn=class extends Eo{_tag="MissingKey";annotations;constructor(t){super(),this.annotations=t}},da=class extends Eo{_tag="UnexpectedKey";ast;constructor(t,n,r){super(n,r),this.ast=t}},At=class extends Eo{_tag="Composite";ast;issues;constructor(t,n,r,o){super(r,o),this.ast=t,this.issues=n}},st=class extends Eo{_tag="InvalidType";ast;constructor(t,n,r){super(n,r),this.ast=t}},ke=class extends Eo{_tag="InvalidValue";annotations;constructor(t,n,r){super(n,r),this.annotations=t}};function Xn(e,t,n,r,o){return new At(e,[new Ct([t],n)],r,o)}var Cu=class extends Eo{_tag="Forbidden";annotations;constructor(t,n,r){super(n,r),this.annotations=t}},ll=class extends Eo{_tag="AnyOf";ast;issues;constructor(t,n,r,o){super(r,o),this.ast=t,this.issues=n}},kx=class extends Eo{_tag="OneOf";ast;successes;constructor(t,n,r,o){super(r,o),this.ast=t,this.successes=n}};function rI(e,t,n){if(oI(e))return e;if(typeof e=="string")return new ke({message:e},t,n);let r=typeof e.issue=="string"?new ke({message:e.issue},t,n):e.issue;return new Ct(e.path,r)}function zF(e,t,n){if(e!==void 0)return typeof e=="boolean"?e?void 0:new ke(void 0,t,n):rI(e,t,n)}function HF(e,t,n,r){return Array.isArray(t)?Ye(t)?t.length===1?rI(t[0],n,r):new At(e,cs(t,o=>rI(o,n,r)),n,r):void 0:zF(t,n,r)}var WF=e=>{let t=dl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return cc(yp(e.ast),e);case"InvalidValue":{let n=sI(e);if(n!==void 0)return cc(n,e);let r=Ix(e);return r===void 0?"Expected a valid value":`Invalid data ${r}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let n=Ix(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let n=Ix(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},VF=e=>dl(e.issue)??dl(e);function KF(e){return t=>({issues:fl(t,[],e?.leafHook??WF,e?.checkHook??VF)})}function Ix(e){return dK(e)?X(e.input):void 0}function sI(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function cc(e,t){let n=Ix(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function fl(e,t,n,r){switch(e._tag){case"Filter":{let o=r(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return fl(e.issue,t,n,r);let s=sI(e.issue);return[{path:t,message:s===void 0?cc(iI(e.filter),e):cc(s,e.issue)}]}case"Encoding":return fl(e.issue,t,n,r);case"Pointer":return fl(e.issue,[...t,...e.path],n,r);case"Composite":return e.issues.flatMap(o=>fl(o,t,n,r));case"AnyOf":return e.issues.length===0?[{path:t,message:dl(e)??cc(yp(e.ast),e)}]:e.issues.flatMap(o=>fl(o,t,n,r));default:return[{path:t,message:n(e)}]}}function iI(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(n=>iI(n)).join(" & ")}}function pK(){return e=>Sp(e,"")}var JF=pK();function Sp(e,t){let n;switch(e._tag){case"Filter":{let r=VF(e);if(r!==void 0)n=r;else{if(e.issue._tag!=="InvalidValue")return Sp(e.issue,t);let o=sI(e.issue);n=o===void 0?cc(iI(e.filter),e):cc(o,e.issue)}break}case"Encoding":return Sp(e.issue,t);case"Pointer":return Sp(e.issue,t+Oh(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(r=>Sp(r,t)).join(`
24
+ `);n=dl(e)??cc(yp(e.ast),e);break}default:n=WF(e);break}return t?`${n}
25
+ at ${t}`:n}function dl(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return dl(e.issue);let n=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof n=="string")return n}function bp(e){let t;for(let n of e.reasons){if(!$g(n)||!oI(n.error))return;t??=n.error}return t}function pa(e,t){let n=bp(e);if(n===void 0)throw new Error(t,{cause:e});return n}var Au=Zf,ZF=Su,QF=HP,YF=WP,XF=VP,eU=uw,aI=KP,cI=JP;var tU=yu,nU=nx;var Cx=fw;var Ax=ZP,rU=QP;var Rx=YP;var uI=lw,wp=ep,oU=dw;var sU=pw,uc=XP;var Ox=tp;var iU=gw;var aU=tF;var _x=yw;var fc=class e extends Bc{run;constructor(t){super(),this.run=t}map(t){return new e((n,r)=>this.run(n,r).pipe(la(Lt(t))))}compose(t){return cU(this)?t:cU(t)?this:new e((n,r)=>this.run(n,r).pipe(Bn(o=>t.run(o,r))))}};function mK(e){return new fc((t,n)=>G(e(t,n)))}function fI(e){return mK((t,n)=>{let r={message:e(t)};return Te(t)?new Cu(r,t.value,n):new Cu(r)})}var uU=new fc(v);function cU(e){return e.run===uU.run}function ks(){return uU}function lI(e){return new fc((t,n)=>xe(t)?ws:e(t.value,n))}function De(e){return Mx(Lt(e))}function Qr(e){return lI((t,n)=>e(t,n).pipe(la(L)))}function Mx(e){return new fc(t=>v(e(t)))}function dI(){return new fc(()=>ws)}function vp(e){return new fc(t=>{let n=za(t,Kn);return Te(n)?v(n):la(e,L)})}function Ru(){return De(globalThis.String)}function Px(){return De(globalThis.Number)}function fU(){return De(globalThis.BigInt)}function pI(){return De(e=>new globalThis.Date(e))}function lU(){return De(cF)}function dU(e){return lI((t,n)=>qo({try:()=>L(JSON.parse(t,e?.reviver)),catch:()=>new ke({expected:"a valid JSON string"},t,n)}))}function pU(e){return lI((t,n)=>qo({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw new TypeError("Value cannot be represented as JSON");return L(r)},catch:()=>new ke({expected:"a JSON-serializable value"},t,n)}))}function mI(){return De(ng)}function Fx(){return De(IO)}function Ux(){return De(TO)}function mU(){return Qr((e,t)=>vu(Ow(Cf(e)),()=>new ke({expected:"a valid Base64 string"},e,t)))}function hU(){return Qr((e,t)=>Mo(wO(e),{onFailure:()=>G(new ke({expected:"a valid Base64 string"},e,t)),onSuccess:v}))}function gU(){return Qr((e,t)=>Mo(Lb(e),{onFailure:()=>G(new ke({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function xU(){return Qr((e,t)=>Mo(vO(e),{onFailure:()=>G(new ke({expected:"a valid Base64Url string"},e,t)),onSuccess:v}))}function yU(){return Qr((e,t)=>Mo(qb(e),{onFailure:()=>G(new ke({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function SU(){return Qr((e,t)=>Mo(kO(e),{onFailure:()=>G(new ke({expected:"a valid hexadecimal string"},e,t)),onSuccess:v}))}function EU(){return De(encodeURIComponent)}function bU(){return Qr((e,t)=>{try{return v(globalThis.decodeURIComponent(e))}catch{return G(new ke({expected:"a valid URI component"},e,t))}})}function hI(){return Qr((e,t)=>or(Ax(e),{onNone:()=>G(new ke({message:"Invalid DateTime input"},e,t)),onSome:n=>v(Rx(n))}))}function wU(){return De(e=>kU(Array.from(e.entries())))}var hK=CU(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function IU(){return De(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&hK(e).forEach(([r,o])=>{t.append(r,o)}),t})}function vU(){return De(e=>kU(Array.from(e.entries())))}var gK=CU(ao);function TU(){return De(e=>typeof e=="object"&&e!==null?new URLSearchParams(gK(e)):new URLSearchParams)}var xK=/^\d+$/;function yK(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map(o=>xK.test(o)?globalThis.Number(o):o)}function kU(e){let t={},n=new WeakSet;function r(o,s,i){let a=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(a)&&Array.isArray(a)===i)return a;let c=i?[]:{};return n.add(c),W(o,s,c),c}return e.forEach(([o,s])=>{let i=yK(o),a=t;i.forEach((c,u)=>{let f=u===i.length-1;if(Array.isArray(a)&&c==="")if(f)a.push(s);else{let l=i[u+1],p=typeof l=="number"||l==="",m=a.length;a=r(a,m,p)}else if(f){let l=Object.hasOwn(a,c);l&&Array.isArray(a[c])?a[c].push(s):l?W(a,c,[a[c],s]):W(a,c,s)}else{let l=i[u+1];a=r(a,c,typeof l=="number"||l==="")}})}),t}function CU(e){return t=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(a=>{n.push([o,a])}):s.forEach((a,c)=>{r(`${o}[${c}]`,a)});else if(typeof s=="object"&&s!==null)for(let[i,a]of Object.entries(s))r(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))r(o,s);return n}}var kp=class e{_tag="Middleware";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}},Tp="~effect/SchemaTransformation/Transformation",et=class e{[Tp]=Tp;_tag="Transformation";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function SK(e){return q(e,Tp)&&e[Tp]===Tp}var Nx=e=>SK(e)?e:new et(e.decode,e.encode);function Rr(e){return new et(Qr(e.decode),Qr(e.encode))}function vt(e){return new et(De(e.decode),De(e.encode))}function Lx(e){return new et(Mx(e.decode),Mx(e.encode))}function AU(){return new et(lU(),ks())}var EK=new et(ks(),ks());function pl(){return EK}var ml=new et(Px(),Ru()),Bx=new et(fU(),Ru()),gI=new et(pI(),De(tb)),RU=new et(pI(),De(e=>e.getTime())),OU=Rr({decode:(e,t)=>or(cO(e),{onNone:()=>G(new ke({expected:"a valid Duration string"},e,t)),onSome:v}),encode:e=>v(globalThis.String(e))}),_U=Rr({decode:e=>v(Br(e)),encode:(e,t)=>or(uO(e),{onNone:()=>G(new ke({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>v(n)})}),MU=vt({decode:e=>fs(e),encode:e=>Tn(e)}),bK=e=>en(e)&&typeof e.message=="string",PU=e=>{let n=Object.hasOwn(e,"cause")?new Error(e.message,{cause:UU(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(n.name=e.name),typeof e.stack=="string"&&(n.stack=e.stack),n},wK=e=>{try{let t=Vc(e);return t===void 0?X(e):JSON.parse(t)}catch{return X(e)}},IK=(e,t,n)=>{let r={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},FU=e=>{let t=new WeakSet,n=r=>{if(zA(r)){if(t.has(r))return"[Circular]";t.add(r);let o=IK(r,e,n);return t.delete(r),o}return wK(r)};return n},UU=e=>bK(e)?PU(e):e,DU=e=>vt({decode:PU,encode:t=>FU(e)(t)}),NU=e=>vt({decode:UU,encode:FU(e)});function LU(){return vt({decode:lb,encode:Od})}function BU(){return vt({decode:fb,encode:_o})}function qU(e){return vt({decode:Xc,encode:e?.onNoneEncoding===null?Od:_o})}function jU(){return Lx({decode:L,encode:eu})}function $U(){return Lx({decode:e=>e.pipe(za(Kn),L),encode:eu})}var xI=Rr({decode:(e,t)=>URL.canParse(e)?v(new URL(e)):G(new ke({expected:"a valid URL string"},e,t)),encode:e=>v(e.href)}),yI=Rr({decode:(e,t)=>{let n=jR(e);return xe(n)?G(new ke({expected:"a valid BigDecimal string"},e,t)):v(n.value)},encode:e=>v(Xs(e))}),SI=new et(mU(),mI()),zU=new et(hU(),mI()),HU=new et(xU(),Fx()),WU=new et(SU(),Ux()),VU=new et(bU(),EU());function KU(e){return new et(dU(e??{}),pU(e))}var JU=new et(wU(),IU()),GU=new et(vU(),TU()),ZU=vt({decode:e=>wp(e),encode:e=>e.offset}),EI=Rr({decode:(e,t)=>or(oU(e),{onNone:()=>G(new ke({expected:"a valid IANA time zone"},e,t)),onSome:v}),encode:e=>v(e.id)}),bI=Rr({decode:(e,t)=>or(sU(e),{onNone:()=>G(new ke({expected:"a valid time zone"},e,t)),onSome:v}),encode:e=>v(uc(e))}),wI=Rr({decode:(e,t)=>or(Ax(e),{onNone:()=>G(new ke({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>v(Rx(n))}),encode:e=>v(aU(e))}),II=Rr({decode:(e,t)=>or(rU(e),{onNone:()=>G(new ke({expected:"a valid Zoned DateTime string"},e,t)),onSome:v}),encode:e=>v(_x(e))});function dc(e){return t=>t._tag===e}var pc=dc("Declaration");var vK=dc("Never");var hl=dc("Literal"),vI=dc("UniqueSymbol");var zI=dc("Arrays"),TK=dc("Objects"),s1=dc("Union"),kK=dc("Suspend"),Dt=class{to;transformation;constructor(t,n){this.to=t,this.transformation=n}},eo={},Xr=class{isOptional;isMutable;constructorDefault;annotations;constructor(t,n,r=void 0,o=void 0){this.isOptional=t,this.isMutable=n,this.constructorDefault=r,this.annotations=o}},QU="~effect/Schema",Jt=class{[QU]=QU;annotations;checks;encoding;context;constructor(t=void 0,n=void 0,r=void 0,o=void 0){this.annotations=t,this.checks=n,this.encoding=r,this.context=o}toString(){return`<${this._tag}>`}},ma=class e extends Jt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(t,n,r,o,s,i,a,c){super(r,o,s,i),this.typeParameters=t,this.run=n,this.encodingChecks=a,this.encodingRun=c}getParser(){let t;return(n,r)=>n===ze?Ts:(t??=this.run(this.typeParameters))(n,this,r)}_rebuild(t,n,r,o,s){let i=xl(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks&&o===this.run&&s===this.encodingRun?this:new e(i,o,this.annotations,n,void 0,this.context,r,s)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let t=this.annotations?.expected;return typeof t=="string"?t:"<Declaration>"}},TI=class extends Jt{_tag="Null";getParser(){return ty(this,null)}getExpected(){return"null"}},HI=new TI;var kI=class extends Jt{_tag="Undefined";getParser(){return ty(this,void 0)}toCodecJson(){return lt(this,[i1])}getExpected(){return"undefined"}},i1=new Dt(HI,new et(De(()=>{}),De(()=>null))),WI=new kI;var CI=class extends Jt{_tag="Void";getParser(){let t=Ho(void 0);return n=>n===ze?Ts:t}toCodecJson(){return lt(this,[i1])}getExpected(){return"void"}},a1=new CI;var AI=class extends Jt{_tag="Never";getParser(){return Rs(this,$A)}getExpected(){return"never"}},c1=new AI,RI=class extends Jt{_tag="Any";getParser(){return Rs(this,zE)}getExpected(){return"any"}},u1=new RI,OI=class extends Jt{_tag="Unknown";getParser(){return Rs(this,zE)}getExpected(){return"unknown"}},ha=new OI,_I=class extends Jt{_tag="ObjectKeyword";getParser(){return Rs(this,gd)}getExpected(){return"object | array | function"}},f1=new _I,qx=class extends Jt{_tag="Enum";enums;constructor(t,n,r,o,s){super(n,r,o,s),this.enums=t}getParser(){let t=new Set(this.enums.map(([,n])=>n));return Rs(this,n=>t.has(n))}toCodecStringTree(){if(this.enums.some(([t,n])=>typeof n=="number")){let t=Object.fromEntries(this.enums.map(([n,r])=>[globalThis.String(r),r]));return lt(this,[new Dt(new Or(Object.keys(t).map(n=>new Yr(n)),"anyOf"),new et(De(n=>t[n]),Ru()))])}return this}getExpected(){return this.enums.map(([t,n])=>JSON.stringify(n)).join(" | ")}};function l1(e){switch(e._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return!e.checks;case"Union":return!e.checks&&e.types.every(l1);default:return!1}}var jx=class extends Jt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(t,n,r,o,s){super(n,r,o,s);let i=[],a=[];for(let u of t){let f=qn(u);if(l1(f))i.push(f),a.push(f._tag==="Literal"?globalThis.String(f.literal):void 0);else throw new Error(`Invalid TemplateLiteral part ${f._tag}`)}let c=new Array(i.length+1);c[i.length]=0;for(let u=i.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=t,this.encodedParts=i,this.literals=a,this.suffixLengths=c}getParser(t){let n=t(this.asTemplateLiteralParser());return(r,o)=>{if(r===ze)return Ts;let s=n(r,o);return s._tag==="Success"?on:fn(s,{onSuccess:()=>r,onFailure:i=>new At(this,[i],r,o)})}}getExpected(){return"string"}matchPart(t,n){return o1(this,t,n)===void 0?void 0:t}asTemplateLiteralParser(){let t=new As(!1,this.parts.map(O1),[]);return ey(yi,t,new et(Qr((n,r)=>{let o=o1(this,n,r);return o?v(o):G(new ke({expected:"a string matching template literal parts"},n,r))}),De(n=>n.join(""))))}},$x=class extends Jt{_tag="UniqueSymbol";symbol;constructor(t,n,r,o,s){super(n,r,o,s),this.symbol=t}getParser(){return ty(this,this.symbol)}toCodecStringTree(){return lt(this,[P1])}getExpected(){return globalThis.String(this.symbol)}},Yr=class extends Jt{_tag="Literal";literal;constructor(t,n,r,o,s){if(super(n,r,o,s),typeof t=="number"&&!globalThis.Number.isFinite(t))throw new Error(`A numeric literal must be finite, got ${X(t)}`);this.literal=t}getParser(){return ty(this,this.literal)}matchPart(t,n){return t===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?YU(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:YU(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function YU(e){let t=globalThis.String(e.literal);return lt(e,[new Dt(new Yr(t),new et(De(()=>e.literal),De(()=>t)))])}var MI=class extends Jt{_tag="String";getParser(){return Rs(this,ao)}matchPart(t,n){let r=this.checks;return r&&!n.disableChecks&&Os(r,t,void 0,this,n)?void 0:t}getExpected(){return"string"}},yi=new MI,PI=class extends Jt{_tag="Number";getParser(){return Rs(this,md)}matchKey(t,n){return this._match(LK,t,n)}matchPart(t,n){return this._match(qI,t,n)}_match(t,n,r){if(!t.test(n))return;let o=globalThis.Number(n);return r.disableChecks||!this.checks?o:Os(this.checks,o,void 0,this,r)?void 0:o}toCodecJson(){return this.checks&&(FI(this.checks,"effect/schema/isFinite")||FI(this.checks,"effect/schema/isInt"))?this:lt(this,[MK])}toCodecStringTree(){return this.toCodecJson()===this?lt(this,[BK]):lt(this,[qK])}getExpected(){return"number"}};function FI(e,t){return e.some(n=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&FI(n.checks,t))}var VI=new PI,UI=class extends Jt{_tag="Boolean";getParser(){return Rs(this,LA)}getExpected(){return"boolean"}},d1=new UI,DI=class extends Jt{_tag="Symbol";getParser(){return Rs(this,$E)}matchKey(t,n){return n.disableChecks||!this.checks?t:Os(this.checks,t,void 0,this,n)?void 0:t}toCodecStringTree(){return lt(this,[P1])}getExpected(){return"symbol"}},p1=new DI,NI=class extends Jt{_tag="BigInt";getParser(){return Rs(this,BA)}matchPart(t,n){if(!jI.test(t))return;let r=globalThis.BigInt(t);return n.disableChecks||!this.checks?r:Os(this.checks,r,void 0,this,n)?void 0:r}toCodecStringTree(){return lt(this,[$K])}getExpected(){return"bigint"}},m1=new NI,As=class e extends Jt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(t,n,r,o,s,i,a,c){super(o,s,i,a),this.isMutable=t,this.elements=n,this.rest=r,this.encodingChecks=c;let u=!1;for(let f=0;f<n.length;f++)if(an(n[f]))u=!0;else if(u)throw new Error("A required element cannot follow an optional element. ts(1257)");if(u&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let f=1;f<r.length;f++)if(an(r[f]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(t,n=t){let r=this,o,s,i=r.elements.length,a=Math.max(0,r.rest.length-1);function c(u,f){return f<i?o[f]:f>=u?s[f-u+1]:s[0]}return Sx(function*(u,f){if(u===ze)return ze;if(!Array.isArray(u))return yield*G(new st(r,u,f));o||(o=r.elements.map(g=>({ast:g,parser:n(g)})),s=r.rest.map(g=>({ast:g,parser:n(g)})));let l=u.length,p={ast:r,getParser:c,input:u,len:l,tailThreshold:Math.max(i,l-a),output:new globalThis.Array(l),issues:void 0,options:f},m=KI(f?.concurrency),h=CK(p,u,{concurrency:m?.concurrency,end:r.rest.length===0?i:Math.max(l,i+a)});if(h&&(yield*h),r.rest.length===0&&l>i)for(let g=i;g<=l-1;g++){let y=new da(r,u[g],f),b=new Ct([g],y);if(f.errors==="all")p.issues?p.issues.push(b):p.issues=[b];else return yield*G(new At(r,[b],u,f))}return p.issues?yield*G(new At(r,p.issues,u,f)):p.output})}_rebuild(t,n,r){let o=xl(this.elements,t),s=xl(this.rest,t);return o===this.elements&&s===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,o,s,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){return"array"}},CK=Jd()({onItem(e,t,n){let r=n<e.len?t:ze;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return zx(e,e.ast,r,n);let o=n===on?t:n[ye];if(o!==ze)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(an(s.ast))return;let i=new Ct([r],new sn(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return Uo(new At(e.ast,[i],e.input,e.options))}}}),KI=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),zx=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=bp(r.cause);if(o===void 0)return qt(ec(r.cause,i=>new At(t,[new Ct([n],i)],e.input,e.options)));let s=new Ct([n],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Uo(new At(t,[s],e.input,e.options))},Vx="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function ga(e,t,n=eo){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(a=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter(a=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(a=>i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(tv(qn(t)))}var Rp=class{name;type;constructor(t,n){this.name=t,this.type=n}};function LI(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(LI);default:return!1}}function AK(e){return LI(e)&&LI(qn(e))}var Op=class{parameter;type;constructor(t,n){if(!AK(t))throw new Error(`Invalid index signature parameter ${t._tag}`);if(this.parameter=t,this.type=n,an(n)&&!R1(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},gl=class e extends Jt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(t,n,r,o,s,i,a){super(r,o,s,i),this.propertySignatures=t,this.indexSignatures=n,this.encodingChecks=a;let c=t.map(u=>u.name).filter((u,f,l)=>l.indexOf(u)!==f);if(c.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(c)}. ts(2300)`)}getParser(t,n=t){let r=this,o=[];for(let b of r.propertySignatures)o.push(b.name);let s=o.length,i=r.indexSignatures.length,a=s&&i?new Set(o):void 0;if(!s&&!i)return Rs(r,Sh);let c,u,f=(b,E,x,w,S)=>{if(S._tag==="Failure")return zx(b,r,E,S)??Kt;let A=S===on?w:S[ye];if(x!==ze&&A!==ze){if(s&&(a.has(E)||a.has(x)))return Kt;W(b.out,x,A)}return Kt},l=(b,E,x,w)=>{if(!w){let R=x.parserKey(E,b.options);if(!xt(R))return O(Jr(R),P=>l(b,E,x,P));w=R}if(w._tag==="Failure")return zx(b,r,E,w)??Kt;let S=w===on?E:w[ye],A=b.input[E],M=x.parserValue(A,b.options);return xt(M)?f(b,E,S,A,M):O(Jr(M),R=>f(b,E,S,A,R))},p=(b,E,x)=>{let w=b.input[E],S=x.parserValue(w,b.options);return xt(S)?f(b,E,E,w,S):O(Jr(S),A=>f(b,E,E,w,A))},m=i?Jd()({onItem:(b,[E,x])=>l(b,E,x),step:(b,E,x)=>x._tag==="Failure"?x:void 0}):void 0,h=()=>(c||(c=r.propertySignatures.map(b=>({parser:n(b.type),name:b.name,type:b.type})),u=i?r.indexSignatures.map(b=>({is:b,parserKey:t(tv(b.parameter)),parserValue:n(b.type)})):void 0),c),g=Sx(function*(b,E){if(b===ze)return ze;if(!(typeof b=="object"&&b!==null&&!Array.isArray(b)))return yield*G(new st(r,b,E));h();let x=b,w={},S={ast:r,input:x,out:w,issues:void 0,options:E},A=E.errors==="all",M=E.onExcessProperty==="error",R=E.onExcessProperty==="preserve",P;if(!i&&(M||R)){a??=new Set(o),P=Reflect.ownKeys(x);for(let F=0;F<P.length;F++){let te=P[F];if(!a.has(te))if(M){let ee=new da(r,x[te],E),T=new Ct([te],ee);if(A){S.issues?S.issues.push(T):S.issues=[T];continue}else return yield*G(new At(r,[T],b,E))}else W(w,te,x[te])}}let $=KI(E?.concurrency);if(s){let F=XU(S,c,$);F&&(yield*F)}if(i&&!$)for(let F=0;F<i;F++){let te=u[F],ee=te.is.parameter===yi?p:l,T=te.is.parameter===yi?Object.keys(x):ga(x,te.is.parameter,E);for(let z=0;z<T.length;z++){let U=ee(S,T[z],te);if(!xt(U))yield*U;else if(U._tag==="Failure")return yield*U}}else if(m){let F=rn();for(let ee=0;ee<i;ee++){let T=u[ee],z=ga(x,T.is.parameter,E);for(let U=0;U<z.length;U++)F.push([z[U],T])}let te=m(S,F,$);te&&(yield*te)}if(S.issues)return yield*G(new At(r,S.issues,b,E));if(E.propertyOrder==="original"){let F=(P??Reflect.ownKeys(x)).concat(o),te={};for(let ee of F)Object.hasOwn(w,ee)&&W(te,ee,w[ee]);return te}return w});if(i)return g;let y=(b,E,x)=>{let w=c[E];return O(Jr(x),S=>{let A=BI(b,w,S);if(A)return A;let M=()=>Ho(b.out),R=XU(b,c.slice(E+1));return R?Bn(R,M):M()})};return(b,E)=>{if(b===ze)return Ts;if(E.errors==="all"||E.onExcessProperty!==void 0||E.propertyOrder==="original"||E.concurrency!==void 0)return g(b,E);if(!(typeof b=="object"&&b!==null&&!Array.isArray(b)))return G(new st(r,b,E));let x=h(),w=b,S={},A={ast:r,input:w,out:S,issues:void 0,options:E};try{for(let M=0;M<x.length;M++){let R=x[M],P=R.name,$=Object.hasOwn(w,P),F=$?w[P]:ze,te=R.parser(F,E);if(!xt(te))return y(A,M,te);if(te===on){$&&W(S,P,F);continue}let ee=BI(A,R,te);if(ee)return ee}}catch(M){return go(M)}return Ho(S)}}_rebuild(t,n,r,o){let s=xl(this.propertySignatures,a=>{let c=t(a.type);return c===a.type?a:new Rp(a.name,c)}),i=xl(this.indexSignatures,a=>{let c=n(a.parameter),u=t(a.type);return c===a.parameter&&u===a.type?a:new Op(c,u)});return s===this.propertySignatures&&i===this.indexSignatures&&r===this.checks&&o===this.encodingChecks?this:new e(s,i,this.annotations,r,void 0,this.context,o)}flip(t){return this._rebuild(t,t,this.encodingChecks,this.checks)}recur(t,n=t){return this._rebuild(t,n,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function BI(e,t,n){if(n._tag==="Failure")return zx(e,e.ast,t.name,n);if(n===on)return;let r=n[ye];if(r!==ze){W(e.out,t.name,r);return}if(delete e.out[t.name],!an(t.type)){let o=new Ct([t.name],new sn(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Uo(new At(e.ast,[o],e.input,e.options))}}var XU=Jd()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(ze,e.options);let n=e.input[t.name];return W(e.out,t.name,n),t.parser(n,e.options)},step:BI});function JI(e,t){return e?t?[...e,...t]:e:t}function Kx(e,t,n){return new gl(Reflect.ownKeys(e).map(r=>new Rp(r,e[r].ast)),[],n,t)}function _p(e){return e.ast}function GI(e,t=void 0){return new As(!1,e.map(n=>n.ast),[],void 0,t)}function Jx(e,t,n){return new Or(e.map(_p),t,void 0,n)}function h1(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let n=e.propertySignatures,r=e.indexSignatures,o=e.checks;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=JI(o,s.checks);return new gl(n,r,void 0,o)}function g1(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new As(e.isMutable,e.elements,t,void 0,e.checks)}var Gx=$c(e=>{for(;;){if(kK(e))return ha;let t=e.encoding;if(!t)return e.recur?.(Gx,B)??e;if(t.some(n=>n.transformation._tag==="Middleware"&&n.transformation.decode!==B))return ha;e=t[t.length-1].to}});function x1(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(x1)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function lc(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[xp];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let n=t.type;if(!an(n)){if(hl(n))return[{key:t.name,literal:n.literal}];if(vI(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!an(t)){if(hl(t))return[{key:n,literal:t.literal}];if(vI(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(n=>lc(Gx(n)));return t[0].filter(n=>t.every(r=>r.some(o=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return lc(e.thunk())}}var e1=new WeakMap,Ap=Object.freeze([]);function RK(e){let t=e1.get(e);if(t)return t;let n,r=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],u=Gx(c);if(vK(u))continue;if(i)if(hl(u)||vI(u)){s??=new Map;let l=hl(u)?u.literal:u.symbol,p=s.get(l);p||s.set(l,p=[]),p.push(c)}else i=!1;let f=lc(u);if(f.length){n??=new Map,r++;for(let{key:l,literal:p}of f){let m=n.get(l);m||n.set(l,m=[new Map,new Set]),m[1].add(a);let h=m[0].get(p);h||m[0].set(p,h=new Set),h.add(a)}}else{o??={};let l=x1(u);for(let p of l)(o[p]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=a=>s.get(a)??Ap;else if(n?.size===1&&!o){let[a,[c]]=n.entries().next().value,u=c;for(let[f,l]of c)u.set(f,Object.freeze(Array.from(l,p=>e[p])));t=(f,l)=>{if(gd(f)){let p=Object.hasOwn(f,a)?f[a]:void 0;if(p!==void 0)return u.get(p)??Ap;if(l)return e}return Ap}}else if(n){let a;for(let c of n)(!a||c[1][0].size>a[1][0].size)&&c[1][1].size===r&&(a=c);t=(c,u)=>{let f=c===null?"null":Array.isArray(c)?"array":typeof c,l=o?.[f]??Ap;if(!gd(c))return l.map(h=>e[h]);let p=new Set(l),m;if(a){let[h,[g]]=a,y=Object.hasOwn(c,h),b=y?c[h]:void 0;if(y&&(!u||b!==void 0)){let E=g.get(b);if(!E)return l.map(x=>e[x]);for(let x of E)p.add(x);m=h}}if(m===void 0)for(let[h,[g,y]]of n){let b=Object.hasOwn(c,h),E=b?c[h]:void 0;if(b&&(!u||E!==void 0)){let x=g.get(E);if(x)for(let w of x)p.add(w)}else if(u)for(let x of y)p.add(x)}for(let[h,[g,y]]of n){if(h===m)continue;let b=Object.hasOwn(c,h),E=b?c[h]:void 0;if(b&&(!u||E!==void 0)){let x=g.get(E);for(let w of p)y.has(w)&&!x?.has(w)&&p.delete(w)}}return Array.from(p).sort((h,g)=>h-g).map(h=>e[h])}}else t=a=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??Ap).map(u=>e[u]).filter(OK(a))};return e1.set(e,t),t}function OK(e){return t=>{let n=Gx(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Mp(e,t,n=!1){return RK(t)(e,n)}var Or=class e extends Jt{_tag="Union";types;mode;encodingChecks;constructor(t,n,r,o,s,i,a){super(r,o,s,i),this.types=t,this.mode=n,this.encodingChecks=a}getParser(t,n){let r=this;return(o,s)=>{if(o===ze)return Ts;let i=Mp(o,r.types,n!==void 0);if(i.length===1){let f=t(i[0])(o,s);return f._tag==="Success"?f:xt(f)?t1(r,f.cause,o,s):ft(f,l=>t1(r,l,o,s))}let a={ast:r,compile:t,input:o,out:void 0,successes:r.mode==="oneOf"?[]:void 0,issues:void 0,options:s},c=KI(s?.concurrency),u=_K(a,i,c?{...c,orderedStep:!0}:void 0);return u?Bn(u,f=>a.out===on?v(o):a.out?a.out:G(new ll(r,a.issues??[],o,s))):a.out?a.out:G(new ll(r,a.issues??[],o,s))}}_rebuild(t,n,r){let o=xl(this.types,t);return o===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(o,this.mode,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}matchPart(t,n){for(let r of this.types){let o=r.matchPart(t,n);if(o!==void 0)return o}}getExpected(t){let n=this.annotations?.expected;if(typeof n=="string")return n;if(this.types.length===0)return"never";let r=this.types.map(o=>{let s=qn(o);switch(s._tag){case"Arrays":{let i=s.elements.filter(hl);if(i.length>0)return`${n1(s.isMutable)}[ ${i.map(a=>t(a)+r1(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let i=s.propertySignatures.filter(a=>hl(a.type));if(i.length>0)return`{ ${i.map(a=>`${n1(a.type.context?.isMutable)}${$i(a.name)}${r1(a.type.context?.isOptional)}: ${t(a.type)}`).join(", ")}, ... }`;break}}return t(s)});return Array.from(new Set(r)).join(" | ")}};function t1(e,t,n,r){let o=bp(t);return o?Uo(new ll(e,[o],n,r)):qt(t)}var _K=Jd()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=bp(n.cause);if(r===void 0)return n;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),Uo(new kx(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Kt}}}),y1=new Or([new Yr("Infinity"),new Yr("-Infinity"),new Yr("NaN")],"anyOf");function n1(e){return e?"":"readonly "}function r1(e){return e?"?":""}function _u(e){let t=!1,n;return()=>(t||(n=e(),t=!0),n)}var Hx=class e extends Jt{_tag="Suspend";thunk;constructor(t,n,r,o,s){if(r)throw new Error("Cannot add checks to Suspend");super(n,void 0,o,s),this.thunk=_u(t)}getParser(t){let n;return(r,o)=>(n??=t(this.thunk()))(r,o)}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(t){return t(this.thunk())}},Wx=class e extends Bc{_tag="Filter";run;annotations;aborted;constructor(t,n=void 0,r=!1){super(),this.run=t,this.annotations=n,this.aborted=r}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(t,n){return new Ou([this,t],n)}},Ou=class e extends Bc{_tag="FilterGroup";checks;annotations;constructor(t,n=void 0){super(),this.checks=t,this.annotations=n}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function Zx(e,t,n=!1){return new Wx((r,o,s)=>HF(o,e(r,o,s),r,s),t,n)}function Qx(e,t){return new Wx((n,r,o)=>e(n)?void 0:new ke(void 0,n,o),t,!0)}function ZI(e){return Zx(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var QI=Si(VI,[ZI()]),MK=new Dt(new Or([QI,y1],"anyOf"),new et(Px(),De(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Pp(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return Zx(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Fp(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var S1=new WeakMap;function YI(e){return S1.get(e)??e}function lt(e,t){return e.encoding===t?e:Fp(e,n=>{n.encoding.value=t})}function Up(e,t){if(e.context===t)return e;let n=YI(e);if(n.context===t)return n;let r=Fp(e,o=>{o.context.value=t});return S1.set(r,n),r}function Dp(e){return e.encoding?Dp(e.encoding[e.encoding.length-1].to):e}function Wo(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Yx(e,Vh(e.checks.slice(0,-1),n.annotate(t)))}return Fp(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Yx(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Fp(e,n=>{n.checks.value=t})}function Si(e,t){return Yx(e,JI(e.checks,t))}function mc(e,t){let n=t(e.to);return n===e.to?e:new Dt(n,e.transformation)}function E1(e,t){let n=e,r=n[n.length-1],o=mc(r,t);return o===r?e:Vh(e.slice(0,e.length-1),o)}function Xx(e){return t=>t.encoding?lt(t,E1(t.encoding,e)):t}function Sl(e,t){return Xx(n=>Up(n,t))(e)}function xa(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:lt(r,E1(r.encoding,n))}return e(r)}return $c(n)}function b1(e,t){return XI(e,t,yn(e))}function w1(e,t){return XI(qn(e),t,e)}function XI(e,t,n){let r=new Dt(e,t);return lt(n,n.encoding?[...n.encoding,r]:[r])}function I1(e,t){let n=jF(e),r=n?[...n,t]:[t];return Wo(e,{brands:r})}function xl(e,t){let n=!1,r=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);i!==s&&(n=!0),r[o]=i}return n?r:e}function El(e,t){let n=e.context?new Xr(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Xr(!1,!1,void 0,t);return Up(e,n)}var bl=$c(e=>{let t=e.context?e.context.isOptional===!1?new Xr(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Xr(!0,!1);return PK(Up(e,t))}),PK=Xx(bl),v1=wn(e=>bl(new Or([e,WI],"anyOf"))),ev=$c(e=>{let t=e.context?e.context.isMutable===!1?new Xr(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Xr(!1,!0);return FK(Up(e,t))}),FK=Xx(ev);function T1(e,t){let n=new et(vp(t),ks()),r=new Dt(ha,n),o=e.context?new Xr(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new Xr(!1,!1,r);return Up(e,o)}function ey(e,t,n){return XI(e,n,t)}function UK(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":yh(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)r(o.types[s]);return;default:n.push(o)}}return r(e),{literals:t,parameters:n}}function k1(e,t){let{literals:n,parameters:r}=UK(e);return new gl(n.map(o=>new Rp(o,t)),r.map(o=>new Op(o,t)))}function an(e){return e.context?.isOptional??!1}function C1(e){return e.context?.isMutable??!1}function A1(e){return e.annotations?.[Zr]===!0||e._tag==="FilterGroup"&&e.checks.every(A1)}function DK(e){function t(r){return A1(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return Jn(n)?n:void 0}var yn=$c(e=>{if(e.encoding)return yn(lt(e,void 0));let t=e,n=t.recur?.(yn)??t,r=n.encodingChecks;if(r){let o=n===e?r:zI(n)||TK(n)||pc(n)&&n.typeParameters.length>0?DK(r):void 0;return Fp(n,s=>{s.encodingChecks.value=void 0,s.checks.value=JI(n.checks,o)})}return n}),qn=$c(e=>yn(Cs(e)));function NK(e,t){let n=t,r=n.length,o=n[r-1],s=[new Dt(Cs(lt(e,void 0)),n[0].transformation.flip())];for(let a=1;a<r;a++)s.unshift(new Dt(Cs(n[a-1].to),n[a].transformation.flip()));let i=Cs(o.to);return i.encoding?lt(i,[...i.encoding,...s]):lt(i,s)}var Cs=wn(e=>{if(e.encoding)return NK(e,e.encoding);let t=e;return t.flip?.(Cs)??t.recur?.(Cs)??t});function R1(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(R1);default:return!1}}function ty(e,t){let n=Ho(t);return(r,o)=>r===ze?Ts:r===t?n:G(new st(e,r,o))}function Rs(e,t){return(n,r)=>n===ze?Ts:t(n)?on:G(new st(e,n,r))}function o1(e,t,n){let r=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(r.length),a;function c(u,f){if(u===r.length)return f===s;if(a?.has(u*(s+1)+f))return!1;let l=r[u];if(u===r.length-1){let p=t.slice(f);if(l.matchPart(p,n)!==void 0)return i[u]=p,!0}else if(l._tag==="Literal"){let p=o[u];if(t.startsWith(p,f)&&c(u+1,f+p.length))return i[u]=p,!0}else{let p=s-e.suffixLengths[u+1],m=o[u+1],h=m===void 0?p:t.lastIndexOf(m,p);for(;h>=f;){let g=t.slice(f,h);if(l.matchPart(g,n)!==void 0&&c(u+1,h))return i[u]=g,!0;if(h===0)break;h=m===void 0?h-1:t.lastIndexOf(m,h-1)}}return a??=new Set,a.add(u*(s+1)+f),!1}return c(0,0)?i:void 0}var Np=wn(e=>new Or(e.enums.map(t=>new Yr(t[1],{title:t[0]})),"anyOf")),tv=xa(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(tv)}}),ny=xa(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(ny)}}),O1=xa(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(O1)}}),_1="[\\s\\S]*?",qI=new globalThis.RegExp(`^${Vx}$`),LK=new globalThis.RegExp(`^(?:${Vx}|Infinity|-Infinity|NaN)$`);function nv(e){return Pp(qI,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:qI.source}),...e})}var M1=Si(yi,[nv()]),BK=new Dt(M1,ml),qK=new Dt(new Or([M1,y1],"anyOf"),ml),jK="-?\\d+",jI=new globalThis.RegExp(`^${jK}$`);function rv(e){return Pp(jI,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:jI.source}),...e})}var ov=Si(yi,[rv({expected:"a string representing a bigint"})]),$K=new Dt(ov,Bx),zK="Symbol\\((.*)\\)",$I=new globalThis.RegExp(`^${zK}$`),HK=Si(yi,[sv()]),P1=new Dt(HK,new et(De(e=>globalThis.Symbol.for($I.exec(e)[1])),Qr((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?v(globalThis.String(e)):G(new Cu({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function sv(e){return Pp($I,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:$I.source}),...e})}function Os(e,t,n,r,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(n=Os(i.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=i.run(t,r,o);if(a){let c=new vx(i,a,t,o);if(n?n.push(c):n=[c],o.errors!=="all"||i.aborted)return n}}}return n}function F1(e,t){let n=Os(e,t,void 0,ha,{errors:"all"});if(n){let r=new At(ha,n);return Ae(r)}return Ce(t)}function U1(e){if(!pc(e))return;let t=e.annotations?.[Ex];return cn(t)?t(e.typeParameters):void 0}function WK(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function VK(e){return e===void 0||typeof e=="string"}function D1(e,t){let n=new WeakMap,r=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=n.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(o,!1),r.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}for(;r.length>0;){let o=r[r.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}n.set(o.value,!0),r.pop()}return!0}}function wl(e){return D1(e,WK)}var yl=new ma([],()=>(e,t,n)=>wl(e)?on:G(new st(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>av,toArbitrary:()=>e=>e.jsonValue()}),N1=Wo(yl,{representation:{id:"effect/schema/MutableJson",payload:null}}),iv=new Dt(yl,pl()),L1=new Dt(new Or([new As(!1,[],[yl]),new gl([],[new Op(yi,yl)])],"anyOf"),pl());function KK(e){return D1(e,VK)}var JK=new ma([],()=>(e,t,n)=>KK(e)?on:G(new st(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{}}),av=new Dt(JK,pl());var B1="~effect/collections/MutableHashMap";var GK={[B1]:B1,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${X(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:hn(Array.from(this))}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},hc=()=>{let e=Object.create(GK);return e.backing=new Map,e.buckets=new Map,e};var _s=d(2,(e,t)=>{if(e.backing.has(t))return L(e.backing.get(t));if(cv(t))return D();let n=Lp.get(e);if(n!==void 0)return e.backing.has(n)?L(e.backing.get(n)):D();let r=ce(t),o=e.buckets.get(r);return o===void 0?D():ZK(e,o,t)}),Lp=new WeakMap,cv=e=>typeof e!="object"&&typeof e!="function";var ZK=(e,t,n)=>{for(let r=0,o=t.length;r<o;r++)if(ae(n,t[r])){let s=t[r];return Lp.set(n,s),L(e.backing.get(s))}return D()},q1=d(2,(e,t)=>Te(_s(e,t))),gc=d(3,(e,t,n)=>{if(e.backing.has(t)||cv(t))return e.backing.set(t,n),e;let r=Lp.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let o=ce(t),s=e.buckets.get(o);return s===void 0?(e.buckets.set(o,[t]),e.backing.set(t,n),e):(r=QK(s,t),r===void 0&&(s.push(t),r=t),e.backing.set(r,n),e)}),QK=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(ae(t,e[n]))return Lp.set(t,e[n]),e[n]};var Mu=d(2,(e,t)=>{if(cv(t))return e.backing.delete(t),e;let n=Lp.get(e)??t,r=ce(n),o=e.buckets.get(r);if(o===void 0)return e;for(let s=0,i=o.length;s<i;s++){let a=o[s];if(a===n||ae(n,a)){e.backing.delete(a),o.splice(s,1);break}}return o.length===0&&e.buckets.delete(r),e}),ry=e=>(e.backing.clear(),e.buckets.clear(),e),j1=e=>e.backing.size;var $1="~effect/collections/Chunk";function tJ(e,t,n,r,o){for(let s=t;s<Math.min(e.length,t+o);s++)n[r+s-t]=e[s];return n}var z1=[],fv=e=>un((t,n)=>t.length===n.length&&Bp(t).every((r,o)=>e(r,qp(n,o)))),nJ=fv(ae),rJ={[$1]:{_A:e=>e},toString(){return`Chunk(${X(Bp(this))})`},toJSON(){return{_id:"Chunk",values:hn(Bp(this))}},[at](){return this.toJSON()},[_e](e){return Il(e)&&nJ(this,e)},[Oe](){return Fa(Bp(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return z1[Symbol.iterator]();default:return Bp(this)[Symbol.iterator]()}},pipe(){return ie(this,arguments)}},lv=e=>{let t=Object.create(rJ);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=ya,t.right=ya;break}case"ISingleton":{t.length=1,t.depth=0,t.left=ya,t.right=ya;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=ya,t.right=ya;break}}return t},Il=e=>q(e,$1),ya=lv({_tag:"IEmpty"}),oJ=()=>ya;var sJ=e=>lv({_tag:"ISingleton",a:e}),sy=e=>Il(e)?e:aJ(ht(e)),uv=(e,t,n)=>{switch(e.backing._tag){case"IArray":{tJ(e.backing.array,0,t,n,e.length);break}case"IConcat":{uv(e.left,t,n),uv(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;for(;r<e.length;)t[o]=qp(e,r),r+=1,o+=1;break}}};var iJ=e=>{switch(e.backing._tag){case"IEmpty":return z1;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return uv(e,t,0),e.backing={_tag:"IArray",array:t},e.left=ya,e.right=ya,e.depth=0,t}}},Bp=iJ;var aJ=e=>e.length===0?oJ():e.length===1?sJ(e[0]):lv({_tag:"IArray",array:e});var qp=d(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw new Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw new Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw new Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?qp(e.left,n):qp(e.right,n-e.left.length);case"ISlice":return qp(e.backing.chunk,n+e.backing.offset)}});var H1=e=>e.length;var W1=p0;var vl=QO,iy=YO,bo=Sg;var bi=ta,Sa=NM;var lr=Lg,V1=HM;var K1="~effect/MutableRef",cJ={[K1]:K1,...vn,toJSON(){return{_id:"MutableRef",current:hn(this.current)}}},$p=e=>{let t=Object.create(cJ);return t.current=e,t};var J1=e=>e.current;var pv=d(2,(e,t)=>(e.current=t,e));var _r=Symbol.for("effect/MutableList/Empty"),wa=()=>({head:void 0,tail:void 0,length:0}),G1=()=>({array:[],mutable:!0,offset:0,next:void 0}),to=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=G1(),e.tail=e.tail.next):e.head=e.tail=G1(),e.tail.array.push(t),e.length++},hv=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var ay=(e,t)=>cy(e,ht(t),!Array.isArray(t)),cy=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},ba=e=>{e.head=e.tail=void 0,e.length=0},Pu=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return ba(e),s}let n=new Array(t),r=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(n[r++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,r===t)return e.head=o,e.length-=t,e.length===0&&ba(e),n;o=o.next}return ba(e),n},zp=(e,t)=>{if(t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){ba(e);return}let n=0,r=e.head;for(;r;){let o=r.array.length-r.offset;if(n+o>t){r.offset+=t-n,e.head=r,e.length-=t;return}n+=o,r=r.next}ba(e)},Fu=e=>Pu(e,e.length),Ms=e=>{if(!e.head)return _r;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:ba(e)),t},Z1=(e,t)=>{if(t<=0)return[];let n=Math.min(t,e.length),r=new Array(n),o=0,s=e.head;for(;s;){for(let i=s.offset;i<s.array.length;i++)if(r[o++]=s.array[i],o===n)return r;s=s.next}return r};var gv=(e,t)=>{let n=[],r=e.head;for(;r;){for(let o=r.offset;o<r.array.length;o++)t(r.array[o],o)&&n.push(r.array[o]);r=r.next}if(n.length===0){ba(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},Q1=(e,t)=>gv(e,n=>n!==t);var uJ="~effect/PubSub",fJ="~effect/PubSub/Subscription",dy=e=>se(()=>gJ(e.atomicPubSub(),new Map,Hr(),lr(!1),$p(!1),e.strategy())),py=e=>dy({atomicPubSub:()=>Rv(e),strategy:()=>new Cv}),my=e=>dy({atomicPubSub:()=>Rv(e),strategy:()=>new fy}),hy=e=>dy({atomicPubSub:()=>Rv(e),strategy:()=>new Av}),Hp=e=>dy({atomicPubSub:()=>lJ(e),strategy:()=>new fy}),Rv=e=>{let t=typeof e=="number"?{capacity:e}:e;xJ(t.capacity);let n=t.replay&&t.replay>0?new ly(Math.ceil(t.replay)):void 0;return t.capacity===1?new bv(n):oF(t.capacity)===t.capacity?new Sv(t.capacity,n):new xv(t.capacity,n)},lJ=e=>{let t=e?.replay;return new Iv(t&&t>0?new ly(Math.ceil(t)):void 0)};var Wp=e=>mi(xn(t=>(pv(e.shutdownFlag,!0),Je(e.scope,Wg(t.id)).pipe(Dn(e.strategy.shutdown),mx(e.shutdownHook.open),jo))));var kl=d(2,(e,t)=>V(()=>e.shutdownFlag.current?v(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),v(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),Y1=d(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),X1=d(2,(e,t)=>V(()=>{if(e.shutdownFlag.current)return v(!1);let n=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),n.length===0?v(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,n,e.shutdownFlag)})),Vp=e=>mi(ur(t=>{let n=$e(t,It),r=Cn(e.scope),o=hJ(e.pubsub,e.subscribers,e.strategy);return _t(r,dJ(o)).pipe(Dn(No(n,s=>Je(r,s))),zt(o))})),dJ=e=>mi(xn(t=>(pv(e.shutdownFlag,!0),Bo(Fu(e.pollers),n=>ew(n,t.id),{discard:!0,concurrency:"unbounded"}).pipe(Mt(()=>se(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),mx(e.shutdownHook.open),jo)))),gy=e=>V(()=>{if(e.shutdownFlag.current)return yo;if(e.replayWindow.remaining>0){let n=e.replayWindow.take();return v(n)}let t=e.pollers.length===0?e.subscription.poll():_r;return t===_r?tD(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),v(t))}),eD=e=>V(function t(n){if(e.shutdownFlag.current)return yo;let r=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?v(e.replayWindow.takeAll().concat(r)):Jn(r)?v(r):O(tD(e),o=>t([o]))}),tD=e=>{let t=pu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),to(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),pi(mu(t),()=>(Q1(e.pollers,t),H))};var Gt=Symbol.for("effect/PubSub/AbsentValue"),pJ=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},mJ=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},hJ=(e,t,n)=>new Tv(e,t,e.subscribe(),wa(),lr(!1),$p(!1),n,e.replayWindow()),xv=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.replayIndices=n?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}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 n=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let r=this.publisherIndex%this.capacity;this.array[r]=t,n!==void 0&&(this.replayIndices[r]=n),this.subscribers[r]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t),r=n.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(r,s);if(i===0)return n;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=n[a++],f=this.publisherIndex%this.capacity;this.array[f]=u;let l=this.replayBuffer?.offer(u);l!==void 0&&(this.replayIndices[f]=l),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return n.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,n=this.array[t];this.array[t]=Gt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(n,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new yv(this,this.publisherIndex,!1)}},yv=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}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 _r;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,n=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,n}return _r}pollUpTo(t){if(this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return[];let o=[],s=this.subscriberIndex+r;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]=Gt,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]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},Sv=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,n){this.capacity=t,this.replayBuffer=n,this.array=Array.from({length:t}),this.replayIndices=n?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}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 n=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let r=this.publisherIndex&this.mask;this.array[r]=t,n!==void 0&&(this.replayIndices[r]=n),this.subscribers[r]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t),r=n.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,i=Math.min(r,s);if(i===0)return n;let a=0,c=this.publisherIndex+i;for(;this.publisherIndex!==c;){let u=n[a++],f=this.publisherIndex&this.mask;this.array[f]=u;let l=this.replayBuffer?.offer(u);l!==void 0&&(this.replayIndices[f]=l),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return n.slice(a)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,n=this.array[t];this.array[t]=Gt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(n,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new Ev(this,this.publisherIndex,!1)}},Ev=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}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 _r;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,n=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,n}return _r}pollUpTo(t){if(this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let n=this.self.publisherIndex-this.subscriberIndex,r=Math.min(t,n);if(r<=0)return[];let o=[],s=this.subscriberIndex+r;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]=Gt,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]=Gt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},bv=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=Gt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new Tl(this.replayBuffer):xy}pipe(){return ie(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 n=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,n!==void 0&&(this.replayIndex=n),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let n=ht(t);return n.length===0?n:this.publish(n[0])?n.slice(1):n}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=Gt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new wv(this,this.publisherIndex,!1)}},wv=class{self;subscriberIndex;unsubscribed;constructor(t,n,r){this.self=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return _r;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt),this.subscriberIndex+=1,t}pollUpTo(t){if(this.isEmpty()||t<1)return[];let n=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt),this.subscriberIndex+=1,[n]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Gt)))}},Iv=class{publisherHead={value:Gt,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 Tl(this.replayBuffer):xy}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let n=this.replayBuffer?.offer(t),r=this.publisherTail.subscribers;if(r!==0){let o={value:t,replayIndex:n,subscribers:r,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 n of t)this.publish(n);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,n=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=Gt,this.subscribersIndex+=1,this.replayBuffer?.slide(n,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new vv(this,this.publisherTail,this.publisherIndex,!1)}},vv=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,n,r,o){this.self=t,this.subscriberHead=n,this.subscriberIndex=r,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,n=!0;for(;n;)this.subscriberHead===this.self.publisherTail?n=!1:this.subscriberHead.next.value!==Gt?(t=!1,n=!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 _r;let t=!0,n=_r;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let r=this.subscriberHead.next.value;r!==Gt&&(n=r,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return n}pollUpTo(t){let n=[],r=0;for(;r!==t;){let o=this.poll();o===_r?r=t:(n.push(o),r+=1)}return n}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Gt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},Tv=class{[fJ]={_A:B};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(t,n,r,o,s,i,a,c){this.pubsub=t,this.subscribers=n,this.subscription=r,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=i,this.strategy=a,this.replayWindow=c}pipe(){return ie(this,arguments)}},kv=class{[uJ]={_A:B};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;constructor(t,n,r,o,s,i){this.pubsub=t,this.subscribers=n,this.scope=r,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=i}pipe(){return ie(this,arguments)}},gJ=(e,t,n,r,o,s)=>new kv(e,t,n,r,o,s),xJ=e=>{if(e<=0)throw new Error(`Cannot construct PubSub with capacity of ${e}`)},Cv=class{publishers=wa();get shutdown(){return xn(t=>Bo(Fu(this.publishers),([n,r,o])=>o?ew(r,t.id):H,{concurrency:"unbounded",discard:!0}))}handleSurplus(t,n,r,o){return V(()=>{let s=pu();return this.offerUnsafe(r,s),this.onPubSubEmptySpaceUnsafe(t,n),this.completeSubscribersUnsafe(t,n),(J1(o)?yo:mu(s)).pipe(pi(()=>(this.removeUnsafe(s),H)))})}onPubSubEmptySpaceUnsafe(t,n){let r=!0;for(;r&&!t.isFull();){let o=Ms(this.publishers);if(o===_r)r=!1;else{let[s,i]=o,a=t.publish(s);a&&o[2]?Jf(i,kn(!0)):a||hv(this.publishers,o),this.completeSubscribersUnsafe(t,n)}}}completePollersUnsafe(t,n,r,o){return Ov(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return _v(this,t,n)}offerUnsafe(t,n){let r=t[Symbol.iterator](),o=r.next();if(!o.done)for(;;){let s=o.value;if(o=r.next(),o.done){to(this.publishers,[s,n,!0]);break}to(this.publishers,[s,n,!1])}}removeUnsafe(t){gv(this.publishers,([n,r])=>r!==t)}},fy=class{get shutdown(){return H}handleSurplus(t,n,r,o){return v(!1)}onPubSubEmptySpaceUnsafe(t,n){}completePollersUnsafe(t,n,r,o){return Ov(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return _v(this,t,n)}},Av=class{get shutdown(){return H}handleSurplus(t,n,r,o){return se(()=>(this.slidingPublishUnsafe(t,r),this.completeSubscribersUnsafe(t,n),!0))}onPubSubEmptySpaceUnsafe(t,n){}completePollersUnsafe(t,n,r,o){return Ov(this,t,n,r,o)}completeSubscribersUnsafe(t,n){return _v(this,t,n)}slidingPublishUnsafe(t,n){let r=n[Symbol.iterator](),o=r.next();if(!o.done&&t.capacity>0){let s=o.value,i=!0;for(;i;){t.slide();let a=t.publish(s);a&&(o=r.next())&&!o.done?s=o.value:a&&(i=!1)}}}},Ov=(e,t,n,r,o)=>{let s=!0;for(;s&&!r.isEmpty();){let i=Ms(o);if(i===_r)mJ(n,r,o),o.length===0?s=!1:pJ(n,r,o);else{let a=r.poll();a===_r?hv(o,i):(Jf(i,kn(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},_v=(e,t,n)=>{for(let[r,o]of n)for(let s of o)e.completePollersUnsafe(t,n,r,s)},ly=class{capacity;head={value:Gt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,n){this.slideValues[this.index%this.capacity]={value:t,index:n},this.index++}offer(t){let n=this.publisherIndex++;return this.tail.value=t,this.tail.index=n,this.tail.next={value:Gt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,n}offerAll(t){for(let n of t)this.offer(n)}},Tl=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 n=t.head;for(let r=0;r<this.remaining;r++)this.values[r]=n.value,this.newestIndex=n.index,n=n.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 n=Math.min(t,this.buffer.capacity),r=this.buffer.index-n;for(let o=0;o<n;o++){let s=this.buffer.slideValues[(r+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]=Gt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){let n=Math.min(t,this.remaining),r=new Array(n);for(let o=0;o<n;o++)r[o]=this.take();return r}takeAll(){return this.takeN(this.remaining)}},xy={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var yJ="~effect/Queue",SJ="~effect/Queue/Enqueue",EJ="~effect/Queue/Dequeue";var Mv={_A:B,_E:B},bJ={[yJ]:Mv,[SJ]:Mv,[EJ]:Mv,...vn,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:IJ(this)}}},no=e=>pe(t=>{let n=Object.create(bJ);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=wa(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},J(n)}),Uu=e=>no({capacity:e});var Kp=()=>no(),er=(e,t)=>he(()=>{if(e.state._tag!=="Open")return Ey;if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return Ey;case"suspend":return e.capacity<=0&&e.state.takers.size>0?(to(e.messages,t),Pv(e),Sy):CJ(e,t);case"sliding":return Ms(e.messages),to(e.messages,t),Sy}return to(e.messages,t),by(e),Sy}),Al=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(Ms(e.messages),to(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(to(e.messages,t),Pv(e),!0):!1:(to(e.messages,t),by(e),!0),Ia=(e,t)=>he(()=>{if(e.state._tag!=="Open")return J(ht(t));let n=wy(e,t);return n.length===0?rt([]):e.strategy==="dropping"?J(n):AJ(e,n)}),wy=(e,t)=>{if(e.state._tag!=="Open")return ht(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return ay(e.messages,t),e.strategy==="sliding"&&Pu(e.messages,e.messages.length-e.capacity),by(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return ht(t);let r=[],o=0;for(let s of t)o<n?to(e.messages,s):r.push(s),o++;return by(e),r};var Zt=d(2,(e,t)=>ge(()=>wi(e,t))),wi=(e,t)=>{if(e.state._tag!=="Open")return!1;let n=On(t),r=k_(n,vJ);return e.state.offers.size===0&&e.messages.length===0?(Fv(e,r),!0):(e.state={...e.state,_tag:"Closing",exit:r},!0)},Jp=e=>Zt(e,yf(Zc())),nD=e=>wi(e,yf(Zc()));var Ps=e=>ge(()=>{if(e.state._tag==="Done")return!0;ba(e.messages);let t=e.state.offers;if(Fv(e,e.state._tag==="Open"?TJ:e.state.exit),t.size>0){for(let n of t)n._tag==="Single"?n.resume(Ey):n.resume(rt(n.remaining.slice(n.offset)));t.clear()}return!0});var Rl=e=>rD(e,1,Number.POSITIVE_INFINITY);var rD=(e,t,n)=>he(()=>kJ(e,t,n)??jr(oD(e),rD(e,1,n))),Vo=e=>he(()=>wJ(e)??jr(oD(e),Vo(e)));var wJ=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=Ms(e.messages);return Cl(e),rt(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Cl(e),e.capacity=0;let t=Ms(e.messages);return Cl(e),rt(t)}};var IJ=e=>e.state._tag==="Done"?0:e.messages.length;var Ey=rt(!1),Sy=rt(!0),vJ=uo(Zc()),TJ=wg(),Pv=e=>{if(e.scheduleRunning=!1,!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(vr),e.messages.length===0)break}},by=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>Pv(e),0))},kJ=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return rt([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Cl(e),e.capacity=0;let r=[Ms(e.messages)];return Cl(e),rt(r)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let r=Pu(e.messages,n);return Cl(e),rt(r)}},CJ=(e,t)=>Bt(n=>{if(e.state._tag!=="Open")return n(Ey);let r={_tag:"Single",message:t,resume:n};return e.state.offers.add(r),ge(()=>{e.state._tag==="Open"&&e.state.offers.delete(r)})}),AJ=(e,t)=>Bt(n=>{if(e.state._tag!=="Open")return n(rt(t));let r={_tag:"Array",remaining:t,offset:0,resume:n};return e.state.offers.add(r),ge(()=>{e.state._tag==="Open"&&e.state.offers.delete(r)})}),Cl=e=>{if(e.state._tag==="Done")return Lo(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(Fv(e,e.state.exit),Lo(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers){if(t===0)break;if(n._tag==="Single")to(e.messages,n.message),t--,n.resume(Sy),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;to(e.messages,n.remaining[n.offset]),t--}n.resume(rt([])),e.state.offers.delete(n)}}return!1},oD=e=>Bt(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),ge(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)})));var Fv=(e,t)=>{if(e.state._tag==="Done")return;let n=e.state;e.state={_tag:"Done",exit:t};for(let r of n.takers)r(t);n.takers.clear();for(let r of n.awaiters)r(t);n.awaiters.clear()};var va=e=>new Uv(e),sD=(e,t,n)=>Bt(r=>{if(e.free>=t)return r(n);let o=()=>{e.free<t||(e.waiters.delete(o),r(n))};return e.waiters.add(o),ge(()=>{e.waiters.delete(o)})}),Uv=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let n=he(()=>this.free<t?sD(this,t,n):(this.taken+=t,J(t)));return n}takeIfAvailable(t){return he(()=>this.free<t?J(!1):(this.taken+=t,J(!0)))}releaseUnsafe(t,n){return this.taken-=n,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let r of this.waiters){if(this.free<=0)break;r()}},0),this.free}resize(t){return pe(n=>(this.permits=t,this.free<0?we:(this.releaseUnsafe(n,0),we)))}release(t){return pe(n=>J(this.releaseUnsafe(n,t)))}get releaseAll(){return pe(t=>J(this.releaseUnsafe(t,this.taken)))}withPermits(t){return n=>$r(r=>{let o=he(()=>{if(this.free<t){let s=sD(this,t,we);return ne(r(s),()=>o)}return this.taken+=t,hs(r(n),()=>{this.releaseUnsafe(ta(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return n=>$r(r=>this.free<t?iu:(this.taken+=t,hs(r(Ff(n)),()=>{this.releaseUnsafe(ta(),t)},!0)))}};var Dv=e=>xs(e)?Ft(e)?me(e.value):e:v(e);var uD="~effect/Channel",tr=e=>q(e,uD),RJ={[uD]:{_Env:B,_InErr:B,_InElem:B,_OutErr:B,_OutElem:B},pipe(){return ie(this,arguments)}},Ge=e=>{let t=Object.create(RJ);return t.transform=(n,r)=>ft(e(n,r),o=>v(ct(o))),t},Us=(e,t)=>Ge((n,r)=>O(Pe(e)(n,r),o=>t(o,r))),jn=e=>Ge((t,n)=>e),Ds=e=>Ge(Se(function*(t,n){let r=Cn(n),o=i=>Je(r,bw(i)),s=yield*xo(e(t,n,r),o);return xo(s,o)})),Pe=e=>e.transform,Gp=4096,OJ=(e,t,n)=>no({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Mt(r=>_t(e,Ps(r))),Mt(r=>Ut(Do(t(r),e),e)));var fD=(e,t)=>Ge((n,r)=>Y(OJ(r,e,t),Rl)),vy=e=>Ge((t,n)=>V(()=>Pe(e())(t,n))),_J=(e,t,n)=>Ds(Se(function*(r,o,s){let i=D();yield*No(s,c=>Te(i)?n(i.value,c):H);let a=yield*mi(e);return i=L(a),yield*Pe(t(a))(r,o)}));var Nv=e=>jn(se(()=>{let t=0;return V(()=>t>=e.length?me():v(e[t++]))}));var Lv=(e,t=Gp)=>jn(se(()=>{let n=e(),r=D();return V(()=>{if(r._tag==="Some")return me(r.value);let o=[];for(;o.length<t;){let s=n.next();if(s.done){if(o.length===0)return me(s.value);r=L(s.value);break}o.push(s.value)}return v(o)})}));var lD=(e,t=Gp)=>Lv(()=>e[Symbol.iterator](),t),Ty=e=>ky(v(e)),MJ=e=>jn(v(me(e)));var dD=e=>ky(se(e)),Ol=jn(v(me())),pD=jn(v(Kr)),Ii=e=>jn(v(G(e))),mD=e=>jn(lx(e)),Zp=e=>jn(ct(e)),hD=e=>jn(aa(e)),Bv=e=>Zp(gP(e)),ky=e=>jn(se(()=>{let t=!1;return V(()=>t?me():(t=!0,e))}));var gD=e=>jn(O(e,()=>me())),qv=e=>jn(v(O(e,Dv)));var xD=e=>jn(v(Rl(e)));var jv=e=>jn(v(pi(eD(e),()=>me())));var yD=e=>Ta(Y(Vp(e),jv)),SD=e=>Ta(Y(Vp(e),t=>qv(gy(t))));var ED=e=>Ge((t,n)=>PJ({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var PJ=e=>{let t=e.readable.getReader(),n=e.exit??$p(void 0),r=V(()=>n.current?n.current:Gr(bs({try:()=>t.read(),catch:e.onError}),{onFailure:o=>n.current??ct(o),onSuccess:({done:o,value:s})=>n.current?n.current:o?me():v(Ne(s))}));return zt(_t(e.scope,e.releaseLockOnEnd?se(()=>t.releaseLock()):ux(()=>t.cancel().catch(bn))),r)},FJ=(e,t)=>Ge(Se(function*(n,r){let o=e[Symbol.asyncIterator]();return o.return&&(yield*_t(r,ux(()=>o.return()))),O(bs({try:()=>o.next(),catch:t}),s=>s.done?me(s.value):v(s.value))})),bD=(e,t)=>Ns(FJ(e,t),Ne),Ns=d(2,(e,t)=>Us(e,n=>se(()=>{let r=0;return Y(n,o=>t(o,r++))})));var wD=e=>e===void 0||e!=="unbounded"&&e<=1,Cy=d(e=>tr(e[0]),(e,t,n)=>wD(n?.concurrency)?ID(e,t):UJ(e,t,n)),ID=(e,t)=>Ge((n,r)=>{let o=0;return Y(Pe(e)(n,r),O(s=>t(s,o++)))}),UJ=(e,t,n)=>Ds(Se(function*(r,o,s){let i=0,a=yield*Pe(e)(r,o),c=n.concurrency==="unbounded"?Number.MAX_SAFE_INTEGER:n.concurrency,u=yield*Uu(0);yield*_t(s,Ps(u));let f=Ln(yield*cr()),l=Sa(s);if(n.unordered){let p=va(c),m=Qe(p.release(1)),h=Gr({onFailure:g=>O(Zt(u,g),m),onSuccess:g=>O(er(u,g),m)});yield*p.take(1).pipe(O(()=>a),O(g=>(l(f(h(t(g,i++)))),H)),Ht({disableYield:!0}),ft(g=>p.withPermits(c-1)(Zt(u,g))),Ut(s))}else{let p=yield*Uu(c-2);yield*_t(s,Ps(p)),yield*Vo(p).pipe(_w,O(g=>er(u,g)),Ht({disableYield:!0}),ft(g=>Zt(u,g)),Ut(s));let m,h=g=>{g._tag!=="Success"&&(m=g.cause,wi(u,g.cause))};yield*a.pipe(O(g=>{if(m)return ct(m);let y=f(t(g,i++));return l(y),y.addObserver(h),er(p,vl(y))}),Ht({disableYield:!0}),ft(g=>er(p,qt(g)).pipe(Dn(Zt(p,g)))),Ut(s))}return Vo(u)}));var vD=d(e=>tr(e[0]),(e,t,n)=>wD(n?.concurrency)?DJ(e,t):NJ(e,t,n)),DJ=(e,t)=>Ge((n,r)=>Y(Pe(e)(n,r),o=>{let s,i,a=O(o,u=>(i??=Cn(r),Bn(Pe(t(u))(n,i),f=>(s=c(f),s)))),c=jt(u=>{if(s=void 0,i.state._tag==="Open"&&iM(i)===1)return a;let f=Je(i,Kt);return i=void 0,O(f,()=>a)});return V(()=>s??a)})),NJ=(e,t,n)=>e.pipe(Ns(t),Oy(n)),Ay=d(2,(e,t)=>Ge((n,r)=>se(()=>{let o,s=Cn(r),i=O(Pe(e)(n,s),a=>(o=jt(a,c=>Je(s,Kt).pipe(O(()=>Pe(t(c))(n,r)),O(u=>(o=u,u)))),o));return V(()=>o??i)})));var $v=d(4,(e,t,n,r)=>Ge(Se(function*(o,s){let i=yield*Pe(e)(o,s),a=yield*Pe(t)(o,s),c=n();return V(()=>{let u=r(c,i,a);return Y(u,([f,l])=>(c=l,f))})}))),TD=d(2,(e,t)=>Ge((n,r)=>se(()=>{let o,s=Cn(r),i=O(Pe(e)(n,s),a=>{let c=a.pipe(Mt(()=>(o=a,H)),jt(u=>Je(s,kn(u)).pipe(Dn(Pe(t(u))(n,r)),O(f=>(o=f,f)))));return o=c,c});return V(()=>o??i)})));var dr=e=>Us(e,t=>{let n,r=0,o=V(function s(){if(n===void 0)return O(t,a=>{switch(a.length){case 0:return s();case 1:return v(a[0]);default:return n=a,v(a[r++])}});let i=n[r++];return r>=n.length&&(n=void 0,r=0),v(i)});return v(o)}),kD=e=>ID(e,Dv),CD=e=>Us(e,t=>v(Ht(t,{disableYield:!0}))),AD=d(2,(e,t)=>Es(typeof t=="function"?t(B):t).pipe(Y(n=>{let r=Un.defaultValue(),o=Ay(Fy(e,Un,se(()=>r)),s=>n(s).pipe(Y(i=>(r=i,o)),jt(()=>v(MJ(s))),Ta));return o}),Ta)),zv=e=>Ay(e,()=>zv(e)),RD=d(2,(e,t)=>Us(e,(n,r)=>Y(Yf(t),o=>Mt(n,o)))),OD=d(2,(e,t)=>Ge((n,r)=>Y(Pe(e)(n,r),o=>O(o,function s(i){return t(i)?v(i):O(o,s)}))));var _D=d(2,(e,t)=>Us(e,n=>v(O(n,function r(o){let s=[];for(let i=0;i<o.length;i++)t(o[i])&&s.push(o[i]);return Ye(s)?v(s):O(n,r)})))),MD=d(2,(e,t)=>Us(e,n=>v(O(n,function r(o){let s=[];for(let i=0;i<o.length;i++){let a=t(o[i]);Vt(a)&&s.push(a.success)}return Ye(s)?v(s):O(n,r)})))),PD=d(2,(e,t)=>Us(e,n=>{let r=O(n,o=>Bw(o,t));return v(O(r,function o(s){return Ye(s)?v(s):O(r,o)}))})),FD=d(2,(e,t)=>Us(e,n=>v(O(n,function r(o){return O(qw(o,t),s=>Ye(s)?v(s):O(n,r))})))),_l=d(e=>tr(e[0]),(e,t,n,r)=>Ge((o,s)=>Y(Pe(e)(o,s),i=>{let a=t(),c,u=0,f,l=Gr(i,{onFailure(m){f=m;let h=r?.onHalt&&r.onHalt(a);return h&&h.length>0?v([a,h]):ct(m)},onSuccess(m){let h=n(a,m);return AR(h)?v(h):h}});return V(function m(){if(c===void 0)return f?ct(f):O(l,([g,y])=>(a=g,y.length===0?m():y.length===1?v(y[0]):(c=y,m())));let h=c[u++];return u>=c.length&&(c=void 0,u=0),v(h)})})));var UD=d(3,(e,t,n)=>Ge((r,o)=>Y(Pe(e)(r,o),s=>{let i=t,a=!0;return V(()=>a?(a=!1,v(i)):Y(O(s,c=>n(i,c)),c=>(i=c,i)))}))),Ml=d(2,(e,t)=>Ge((n,r)=>{let o=Cn(r);return Y(Pe(e)(n,o),s=>{let i=s.pipe(ft(a=>{if(Lo(a))return ct(a);let c=o;return o=Cn(r),Je(c,qt(a)).pipe(Dn(Pe(t(a))(n,o)),O(u=>(i=u,u)))}));return V(()=>i)})})),Ry=d(2,(e,t)=>Ml(e,n=>gD(O(t(n),r=>ct(n))))),DD=d(3,(e,t,n)=>Ml(e,r=>t(r)?n(r):Zp(r))),Hv=d(3,(e,t,n)=>Ml(e,r=>{let o=t(r);return Fe(o)?Zp(o.failure):n(o.success,r)})),Fs=d(2,(e,t)=>Hv(e,Vf,n=>t(n)));var ND=d(2,(e,t)=>Us(e,n=>v(up(n,r=>Gd(r)?H:jo(t(r)))))),LD=d(e=>tr(e[0]),(e,t,n,r)=>Fs(e,o=>t(o)?n(o):r?r(o):Ii(o))),BD=d(e=>tr(e[0]),(e,t,n,r)=>Fs(e,o=>{let s=t(o);return Fe(s)?r?r(s.failure):Ii(s.failure):n(s.success)}));var qD=d(e=>tr(e[0]),(e,t,n,r,o)=>Fs(e,s=>{if(Sr(s,t)&&q(s,"reason")){let i=s.reason;return Sr(i,n)?r(i,s):o?o(i,s):Ii(s)}return Ii(s)})),jD=d(e=>tr(e[0]),(e,t,n,r)=>{let o;return Fs(e,s=>{if(Sr(s,t)&&q(s,"reason")&&q(s.reason,"_tag")&&ox(s.reason._tag)){let i=s.reason;return o??=new Set(Object.keys(n)),o.has(i._tag)?n[i._tag](i,s):r?r(i,s):Ii(s)}return Ii(s)})});var $D=d(2,(e,t)=>Fs(e,n=>Ii(t(n)))),zD=e=>Fs(e,Bv),HD=d(e=>tr(e[0]),(e,t)=>{if(!t?.log)return Fs(e,()=>Ol);let n=cl(t.log===!0?void 0:t.log);return Fs(Ry(e,r=>yP(r)?n(r):H),()=>Ol)}),aD=e=>Ml(e,()=>Ol),WD=d(e=>tr(e[0]),(e,t)=>{if(!t?.log)return aD(e);let n=cl(t.log===!0?void 0:t.log);return aD(Ry(e,r=>n(r)))}),VD=d(2,(e,t)=>vy(()=>{let n,r=Un.defaultValue(),o=Fy(e,Un,se(()=>r)),s=Kv(o,()=>(n=void 0,H)),i=typeof t=="function"?t(B):t,a=Fs(s,Se(function*(c){return n||(n=yield*Es(i)),r=yield*n(c),a},(c,u)=>jt(c,()=>v(Ii(u))),Ta));return a})),KD=d(e=>tr(e[0]),(e,t,n)=>e.pipe(Ns(t),Oy({...n,concurrency:n?.concurrency??1,switch:!0}))),Oy=d(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>Ds(Se(function*(o,s,i){let a=n==="unbounded"?Number.MAX_SAFE_INTEGER:Math.max(1,n),c=r?void 0:va(a),u=yield*V1(!0),f=new Set,l=yield*Uu(t);yield*_t(i,Ps(l));let p=yield*Pe(e)(o,s);return yield*$t(function*(){for(;;){let m;c&&(f.size<a?yield*c.take(1):(m=yield*il(p),yield*sc(c.take(1),Dn(vl(m),Kr))));let h=m===void 0?yield*p:yield*vl(m),g=Cn(i),y=yield*Pe(h)(o,g);for(;f.size>=a;){let E=IR(f);f.delete(E),f.size===0&&(yield*u.open),yield*bo(E)}let b=yield*y.pipe(Mt(()=>cp),O(E=>er(l,E)),Ht({disableYield:!0}),xo(Se(function*(E){let x=Qf(E);if(yield*Jr(Je(g,Fe(x)?qt(x.failure):kn(x.success.value))),!!f.has(b)&&(f.delete(b),c&&(yield*c.release(1)),f.size===0&&(yield*u.open),!Vt(x)))return yield*Zt(l,E)})),il);u.closeUnsafe(),f.add(b)}}).pipe(ft(m=>{let h=Qf(m);return Vt(h)?u.whenOpen(Zt(l,m)):Zt(l,m)}),Ut(i)),Vo(l)}))),_y=d(e=>tr(e[0])&&tr(e[1]),(e,t,n)=>Ds(Se(function*(r,o,s){let i=n?.haltStrategy??"both",a=yield*Uu(0);yield*_t(s,Ps(a));let c=0;function u(l,p){if(c++,!Lo(p))return Zt(a,p);switch(i){case"both":return c===2?Zt(a,p):H;case"left":case"right":return l===i?Zt(a,p):H;case"either":return Zt(a,p)}}let f=(l,p,m)=>Pe(p)(r,m).pipe(O(h=>h.pipe(O(g=>er(a,g)),Ht)),xo(h=>Dn(Je(m,bw(h)),u(l,h))),Ut(s));return yield*f("left",e,Cn(s)),yield*f("right",t,Cn(s)),Vo(a)}))),JD=d(2,(e,t)=>_y(e,gD(t),{haltStrategy:"left"})),GD=()=>Ge((e,t)=>se(()=>{let n="",r=!1,o=D();function s(c){let u=[];function f(l){n.length===0?u.push(l):(u.push(n+l),n="")}for(let l=0;l<c.length;l++){let p=c[l];if(p.length!==0){let m=0,h=p.indexOf("\r"),g=p.indexOf(`
26
26
  `);for(r&&(g===0?(f(""),m=1,g=p.indexOf(`
27
27
  `,m)):f(""),r=!1);h!==-1||g!==-1;)h===-1||g!==-1&&g<h?(f(p.substring(m,g)),m=g+1,g=p.indexOf(`
28
28
  `,m)):p.length===h+1?(r=!0,h=-1):(f(p.substring(m,h)),m=h+(g===h+1?2:1),h=p.indexOf("\r",m),g=p.indexOf(`
29
- `,m));n=n+p.substring(m,p.length-(r?1:0))}}return Ye(u)?u:null}let i=K(()=>o._tag==="Some"?me(o.value):np(e,{onSuccess:a,onFailure:ct,onDone:c=>{if(o=L(c),n.length>0||r){let u=n;return n="",r=!1,v([u])}return me(c)}}));function a(c){let u=s(c);return u!==null?v(u):i}return i}));var Hv=d(2,(e,t)=>Ge((n,r)=>R(Pe(e)(n,r),o=>Pe(t)(o,r)))),Wv=d(2,(e,t)=>Ge((n,r)=>R(Pe(e)(n,r),o=>{let s=ft(o,i=>No(i)?ct(i):ho(SP(i)));return Y(Pe(t)(s,r),i=>Mw(i,a=>Gd(a)?ct(a.value):ho(a)))}))),va=e=>Ge((t,n)=>{let r;return v(K(()=>r||e.pipe(Uo(n),R(o=>Pe(o)(t,n)),R(o=>r=o))))}),JD=e=>Us((t,n,r)=>Y(Uo(Pe(e)(t,n),r),Uo(r)));var GD=d(2,(e,t)=>Ge(Se(function*(n,r){let o=yield*Pe(e)(n,r),s=yield*to({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*_t(r,Ms(s)),yield*o.pipe(R(i=>Xn(s,i)),Ht({disableYield:!0}),go(i=>Zt(s,i)),Ut(r)),Wo(s)}))),ZD=d(2,(e,t)=>Ge(Se(function*(n,r){let o=yield*Pe(e)(n,r),s=yield*to({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*_t(r,Ms(s)),yield*o.pipe(R(i=>wa(s,i)),Ht({disableYield:!0}),go(i=>Zt(s,i)),Ut(r)),Rl(s)}))),QD=d(2,(e,t)=>_y(e,qn(v(R(t,me))),{haltStrategy:"either"})),YD=d(2,(e,t)=>Us(Se(function*(n,r,o){let s=yield*Pe(e)(n,r),i=yield*Ut(t,o,{startImmediately:!0});return K(()=>{let a=i.pollUnsafe();return a===void 0?s:EP(a,{onFailure:ct,onSuccess:me})})}))),XD=d(2,(e,t)=>Qp(e,n=>ii(n)?t(n.cause):H)),Qp=d(2,(e,t)=>Us((n,r,o)=>Do(o,t).pipe(Dn(Pe(e)(n,r))))),eN=d(2,(e,t)=>va(zt(t,e))),Kv=d(2,(e,t)=>Fs(e,n=>se(()=>{let r=!0,o=Mt(n,s=>(r=!1,t(s)));return K(()=>r?o:n)}))),tN=d(2,(e,t)=>Fs(e,n=>v(qt(n,r=>R(t,()=>me(r)))))),nN=d(2,(e,t)=>Qp(e,n=>t)),Nu=(e,t,n)=>K(()=>{let r=zr(),o=Pe(e)(me(),r);return qt(R(o,t),n||v).pipe(ur(s=>Je(r,s)))});var My=d(2,(e,t)=>Ge((n,r)=>Y(Nn(Pe(e)(n,r),t),Nn(t)))),Py=d(3,(e,t,n)=>Ge((r,o)=>Y(qo(Pe(e)(r,o),t,n),qo(t,n)))),Fy=d(3,(e,t,n)=>Ge((r,o)=>R(n,s=>Pe(Py(e,t,s))(r,o)))),rN=d(e=>er(e[0]),(e,t,n)=>Dd(t)?My(e,t):Ge((r,o)=>R(n?.local?ci(t,ai(),o):Zd(t,o),s=>Y(Nn(Pe(e)(r,o),s),Nn(s))))),oN=d(2,(e,t)=>Ge((n,r)=>cr(o=>{let s=t(o);return Pe(My(e,s))(n,r)})));var Vv=function(){let e=er(arguments[0]),t=e?arguments[1]:arguments[0],n=Po(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return iD(r,t,n)}return r=>iD(r,t,n)},iD=(e,t,n)=>TJ(Vw(t,n),r=>Py(e,ti,r),(r,o)=>xn(s=>{let i=s.getRef(mo),a=s.getRef(TP);return Bg(r,o,i,a)}));var sN=e=>Nu(e,t=>Ht(t,{disableYield:!0})),Lu=d(2,(e,t)=>Nu(e,n=>Ht(R(n,t),{disableYield:!0}))),iN=d(2,(e,t)=>Nu(e,n=>n.pipe(R(t),R(r=>r?H:me()),Ht({disableYield:!0})))),Jv=e=>Y(Bu(e,()=>({bytes:0,arrays:[]}),(t,n)=>{for(let r=0;r<n.length;r++)t.bytes+=n[r].length,t.arrays.push(n[r]);return t}),({arrays:t,bytes:n})=>{let r=new Uint8Array(n),o=0;for(let s=0;s<t.length;s++){let i=t[s];r.set(i,o),o+=i.length}return r});var aN=e=>K(()=>{let t=D();return Nu(e,n=>n.pipe(dx,R(r=>(t=r,me()))),()=>v(t))}),cN=e=>K(()=>{let t=Symbol(),n=t;return Nu(e,r=>Ht(R(r,o=>(n=o,H)),{disableYield:!0}),()=>n===t?Es:fx(n))}),Bu=d(3,(e,t,n)=>K(()=>{let r=t();return Nu(e,o=>Qn({while:Xt,body:()=>o,step:s=>{r=n(r,s)}}),()=>v(r))})),uN=d(3,(e,t,n)=>K(()=>{let r=t();return Nu(e,o=>Qn({while:Xt,body:Qe(o.pipe(R(s=>n(r,s)),Y(s=>{r=s}))),step:En}),()=>v(r))})),Gv=Se(function*(e){let t=Ia(1),n=yield*ar(),r=$e(n,It);return(yield*Pe(e)(me(),r)).pipe(Nn(n),t.withPermits(1))},ft(e=>v(ct(e)))),Ko=(e,t)=>Pe(e)(me(),t);var Zv=d(e=>er(e[0]),(e,t)=>yo(n=>Lu(e,r=>wa(t,r)).pipe(n,Vr,R(r=>(Ft(r)?eD(t):wi(t,r.cause),H)))));var fN=d(e=>er(e[0]),Se(function*(e,t){let n=yield*$o,r=yield*to({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*_t(n,Ms(r)),yield*Ut(Zv(e,r),n),r}));var lN=e=>ic(e.capacity==="unbounded"?Hp(e):e.strategy==="dropping"?my(e):e.strategy==="sliding"?hy(e):py(e),Wp),dN=d(2,Se(function*(e,t){let n=yield*lN(t);return yield*Is(Qv(e,n,{shutdownOnEnd:t.shutdownOnEnd!==!1})),n})),Qv=d(e=>er(e[0]),(e,t,n)=>Lu(e,r=>Q1(t,r)).pipe(n?.shutdownOnEnd===!0?ca(Wp(t)):B)),pN=d(2,Se(function*(e,t){let n=yield*lN(t);return yield*Lu(e,r=>kl(n,r)).pipe(ur(r=>kl(n,r)),Is),n}));var A={};ns(A,{Any:()=>F5,Array:()=>Wt,ArrayEnsure:()=>z5,BigDecimal:()=>ek,BigDecimalFromString:()=>qQ,BigDecimalReviver:()=>jQ,BigInt:()=>Ti,BigIntFromString:()=>QQ,Boolean:()=>vc,BooleanFromBit:()=>o7,Cause:()=>Hl,CauseReason:()=>sS,CauseReasonReviver:()=>fQ,CauseReviver:()=>lQ,Char:()=>QZ,Chunk:()=>FB,ChunkReviver:()=>vQ,Class:()=>hS,Date:()=>qs,DateFromMillis:()=>OQ,DateFromString:()=>RQ,DateReviver:()=>AQ,DateTimeUtc:()=>km,DateTimeUtcFromDate:()=>f7,DateTimeUtcFromMillis:()=>d7,DateTimeUtcFromString:()=>l7,DateTimeUtcReviver:()=>u7,DateTimeZoned:()=>ik,DateTimeZonedFromString:()=>S7,DateTimeZonedReviver:()=>y7,Defect:()=>ln,Duration:()=>Tm,DurationFromMillis:()=>UQ,DurationFromNanos:()=>FQ,DurationFromString:()=>PQ,DurationReviver:()=>_Q,Enum:()=>P5,Error:()=>$n,ErrorInstance:()=>kB,ErrorInstanceReviver:()=>mQ,Exit:()=>pS,ExitReviver:()=>hQ,File:()=>tk,FileReviver:()=>HQ,Finite:()=>js,FiniteFromString:()=>ZQ,FormData:()=>nk,FormDataReviver:()=>WQ,Graph:()=>OB,GraphReviver:()=>bQ,HashMap:()=>_B,HashMapReviver:()=>EQ,HashSet:()=>PB,HashSetReviver:()=>IQ,Int:()=>$s,Json:()=>Am,JsonObject:()=>r9,JsonReviver:()=>o9,Literal:()=>Rt,Literals:()=>ka,MutableJson:()=>sj,MutableJsonReviver:()=>i9,Natural:()=>tr,Never:()=>Ic,NonEmptyArray:()=>fS,NonEmptyString:()=>ZZ,Null:()=>tt,NullOr:()=>$T,NullishOr:()=>EL,Number:()=>Vl,NumberFromString:()=>GQ,ObjectKeyword:()=>U5,Opaque:()=>rZ,Option:()=>ki,OptionFromNullOr:()=>XZ,OptionFromNullishOr:()=>tQ,OptionFromOptional:()=>rQ,OptionFromOptionalKey:()=>nQ,OptionFromOptionalNullOr:()=>oQ,OptionFromUndefinedOr:()=>eQ,OptionReviver:()=>YZ,PropertyKey:()=>FT,ReadonlyMap:()=>RB,ReadonlyMapReviver:()=>gQ,ReadonlySet:()=>MB,ReadonlySetReviver:()=>wQ,Record:()=>qT,Redacted:()=>QT,RedactedFromValue:()=>uQ,RedactedReviver:()=>cQ,RegExp:()=>UB,RegExpReviver:()=>TQ,Result:()=>xB,ResultReviver:()=>sQ,SchemaError:()=>Mr,StandardSchemaV1FailureResult:()=>r7,String:()=>fe,StringFromBase64:()=>XQ,StringFromBase64Url:()=>e7,StringFromHex:()=>t7,StringFromUriComponent:()=>n7,Struct:()=>oe,StructWithRest:()=>q5,Symbol:()=>yL,TaggedClass:()=>I7,TaggedError:()=>ck,TaggedStruct:()=>Tc,TaggedUnion:()=>nZ,TemplateLiteral:()=>_5,TemplateLiteralParser:()=>M5,TimeZone:()=>sk,TimeZoneFromString:()=>x7,TimeZoneNamed:()=>ok,TimeZoneNamedFromString:()=>h7,TimeZoneNamedReviver:()=>m7,TimeZoneOffset:()=>HB,TimeZoneOffsetReviver:()=>p7,TimeZoneReviver:()=>g7,Tree:()=>n9,Trim:()=>YQ,Trimmed:()=>$B,Tuple:()=>Ec,TupleWithRest:()=>$5,URL:()=>YT,URLFromString:()=>CQ,URLReviver:()=>kQ,URLSearchParams:()=>rk,URLSearchParamsReviver:()=>VQ,Uint8Array:()=>Go,Uint8ArrayFromBase64:()=>i7,Uint8ArrayFromBase64Url:()=>a7,Uint8ArrayFromHex:()=>c7,Uint8ArrayReviver:()=>s7,Undefined:()=>BT,UndefinedOr:()=>lS,Union:()=>He,UniqueArray:()=>H5,UniqueSymbol:()=>D5,Unknown:()=>LT,UnknownFromJsonString:()=>zQ,Void:()=>Jl,annotate:()=>f5,annotateEncoded:()=>l5,annotateKey:()=>d5,asserts:()=>g5,brand:()=>IL,catchDecoding:()=>G5,catchDecodingWithContext:()=>kL,catchEncoding:()=>Z5,catchEncodingWithContext:()=>CL,check:()=>K5,declare:()=>no,declareConstructor:()=>An,decode:()=>Q5,decodeEffect:()=>x5,decodeExit:()=>fL,decodeOption:()=>S5,decodePromise:()=>E5,decodeResult:()=>b5,decodeSync:()=>xm,decodeTo:()=>be,decodeUnknownEffect:()=>wc,decodeUnknownExit:()=>uL,decodeUnknownOption:()=>y5,decodeUnknownPromise:()=>dL,decodeUnknownResult:()=>lL,decodeUnknownSync:()=>aS,encode:()=>Y5,encodeEffect:()=>cS,encodeExit:()=>mL,encodeKeys:()=>B5,encodeOption:()=>I5,encodePromise:()=>T5,encodeResult:()=>v5,encodeSync:()=>NT,encodeTo:()=>zT,encodeUnknownEffect:()=>ym,encodeUnknownExit:()=>pL,encodeUnknownOption:()=>w5,encodeUnknownPromise:()=>gL,encodeUnknownResult:()=>hL,encodeUnknownSync:()=>uS,extendTo:()=>j5,fieldsAssign:()=>N5,flip:()=>MT,fromBrand:()=>J5,fromFormData:()=>KQ,fromJsonString:()=>qB,fromURLSearchParams:()=>JQ,instanceOf:()=>kc,is:()=>oL,isBase64:()=>KT,isBase64Reviver:()=>hZ,isBase64Url:()=>LL,isBase64UrlReviver:()=>gZ,isBetween:()=>dS,isBetweenBigDecimal:()=>LZ,isBetweenBigInt:()=>aB,isBetweenBigIntReviver:()=>Z7,isBetweenDate:()=>nB,isBetweenDateReviver:()=>W7,isBetweenReviver:()=>RZ,isCapitalized:()=>HL,isCapitalizedReviver:()=>wZ,isEndsWith:()=>jL,isEndsWithReviver:()=>yZ,isFinite:()=>KL,isFiniteReviver:()=>vZ,isGUID:()=>DL,isGUIDReviver:()=>pZ,isGreaterThan:()=>JL,isGreaterThanBigDecimal:()=>FZ,isGreaterThanBigInt:()=>rB,isGreaterThanBigIntReviver:()=>K7,isGreaterThanDate:()=>YL,isGreaterThanDateReviver:()=>q7,isGreaterThanOrEqualTo:()=>VT,isGreaterThanOrEqualToBigDecimal:()=>UZ,isGreaterThanOrEqualToBigInt:()=>oB,isGreaterThanOrEqualToBigIntReviver:()=>V7,isGreaterThanOrEqualToDate:()=>XL,isGreaterThanOrEqualToDateReviver:()=>$7,isGreaterThanOrEqualToReviver:()=>kZ,isGreaterThanReviver:()=>TZ,isIncludes:()=>qL,isIncludesReviver:()=>SZ,isInt:()=>vm,isInt32:()=>MZ,isIntReviver:()=>_Z,isLengthBetween:()=>GT,isLengthBetweenReviver:()=>qZ,isLessThan:()=>GL,isLessThanBigDecimal:()=>DZ,isLessThanBigInt:()=>sB,isLessThanBigIntReviver:()=>J7,isLessThanDate:()=>eB,isLessThanDateReviver:()=>z7,isLessThanOrEqualTo:()=>ZL,isLessThanOrEqualToBigDecimal:()=>NZ,isLessThanOrEqualToBigInt:()=>iB,isLessThanOrEqualToBigIntReviver:()=>G7,isLessThanOrEqualToDate:()=>tB,isLessThanOrEqualToDateReviver:()=>H7,isLessThanOrEqualToReviver:()=>AZ,isLessThanReviver:()=>CZ,isLowercased:()=>zL,isLowercasedReviver:()=>EZ,isMaxLength:()=>uB,isMaxLengthReviver:()=>jZ,isMaxProperties:()=>mB,isMaxPropertiesReviver:()=>KZ,isMaxSize:()=>lB,isMaxSizeReviver:()=>zZ,isMinLength:()=>JT,isMinLengthReviver:()=>BZ,isMinProperties:()=>pB,isMinPropertiesReviver:()=>WZ,isMinSize:()=>fB,isMinSizeReviver:()=>$Z,isMultipleOf:()=>QL,isMultipleOfReviver:()=>OZ,isNonEmpty:()=>cB,isPattern:()=>Zu,isPatternReviver:()=>aZ,isPropertiesLengthBetween:()=>hB,isPropertiesLengthBetweenReviver:()=>VZ,isPropertyNames:()=>gB,isPropertyNamesReviver:()=>JZ,isSchema:()=>Gu,isSchemaError:()=>Wl,isSizeBetween:()=>dB,isSizeBetweenReviver:()=>HZ,isStartsWith:()=>BL,isStartsWithReviver:()=>xZ,isStringBigInt:()=>PL,isStringBigIntReviver:()=>uZ,isStringFinite:()=>ML,isStringFiniteReviver:()=>cZ,isStringSymbol:()=>FL,isStringSymbolReviver:()=>fZ,isTrimmed:()=>WT,isTrimmedReviver:()=>sZ,isULID:()=>NL,isULIDReviver:()=>mZ,isUUID:()=>UL,isUUIDReviver:()=>dZ,isUint32:()=>PZ,isUncapitalized:()=>WL,isUncapitalizedReviver:()=>IZ,isUnique:()=>ZT,isUniqueReviver:()=>GZ,isUppercased:()=>$L,isUppercasedReviver:()=>bZ,link:()=>pt,make:()=>re,makeFilter:()=>Tt,makeFilterGroup:()=>oZ,makeIsBetween:()=>Im,makeIsGreaterThan:()=>Sm,makeIsGreaterThanOrEqualTo:()=>bm,makeIsLessThan:()=>Em,makeIsLessThanOrEqualTo:()=>wm,makeIsMultipleOf:()=>VL,middlewareDecoding:()=>vL,middlewareEncoding:()=>TL,mutable:()=>W5,mutableKey:()=>A5,optional:()=>Pt,optionalKey:()=>Ju,overrideToCodecIso:()=>e9,overrideToEquivalence:()=>C7,overrideToFormatter:()=>T7,readonlyKey:()=>R5,refine:()=>V5,required:()=>C5,requiredKey:()=>k5,resolveAnnotations:()=>a9,resolveAnnotationsKey:()=>c9,revealBottom:()=>u5,revealCodec:()=>p5,suspend:()=>wL,tag:()=>Ze,tagDefaultOmit:()=>tZ,toArbitrary:()=>v7,toCodecArrayFromSingle:()=>P7,toCodecIso:()=>YB,toCodecJson:()=>Cc,toCodecJsonAST:()=>gS,toCodecStringTree:()=>ej,toDifferJsonPatch:()=>t9,toEncoded:()=>Kl,toEncoderXml:()=>F7,toEquivalence:()=>A7,toFormatter:()=>k7,toIso:()=>Q7,toIsoFocus:()=>X7,toIsoSource:()=>Y7,toJsonSchemaDocument:()=>GB,toRepresentation:()=>R7,toStandardJSONSchemaV1:()=>h5,toStandardSchemaV1:()=>m5,toTaggedUnion:()=>_L,toType:()=>Pr,withConstructorDefault:()=>AL,withDecodingDefault:()=>OL,withDecodingDefaultKey:()=>HT,withDecodingDefaultType:()=>eZ,withDecodingDefaultTypeKey:()=>X5});var Dy="~effect/collections/Graph",Yv=e=>e;var MJ=(e,t,n)=>(e==="directed"?t.source===n.source&&t.target===n.target:t.source===n.source&&t.target===n.target||t.source===n.target&&t.target===n.source)&&ae(t.data,n.data),PJ=(e,t)=>e==="directed"?ce(t):Ua(ce(t.data)^ce(t.source)+ce(t.target)),FJ={[Dy]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[at](){return this.toJSON()},[_e](e){if(j(e,Dy)){let t=Yv(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[n,r]of this.nodes)if(!t.nodes.has(n)||!ae(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!MJ(this.type,r,o))return!1}return!0}return!1},[Oe](){let e=it("Graph");e=e^it(this.type),e=e^Nr(this.nodes.size),e=e^Nr(this.edges.size);for(let[t,n]of this.nodes)e=e^ce(t)+ce(n);for(let[t,n]of this.edges)e=e^ce(t)+PJ(this.type,n);return e},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return ie(this,arguments)}},mN=(e,t)=>{let n=Object.create(FJ);return n.type=e,n.mutable=t,n.transforming=!1,n.nodes=new Map,n.edges=new Map,n.adjacency=new Map,n.reverseAdjacency=new Map,n.nextNodeIndex=0,n.nextEdgeIndex=0,n.acyclic=L(!0),n};var Yp=e=>{let t=Yv(e);return{type:e.type,nodes:Array.from(t.nodes,([n,r])=>({index:n,data:r})).sort((n,r)=>n.index-r.index),edges:Array.from(t.edges,([n,r])=>({index:n,source:r.source,target:r.target,data:r.data})).sort((n,r)=>n.index-r.index)}},Xp=e=>{let t=mN(e.type,!1);for(let n of e.nodes)t.nodes.set(n.index,n.data),t.adjacency.set(n.index,[]),t.reverseAdjacency.set(n.index,[]);for(let n of e.edges)t.edges.set(n.index,{source:n.source,target:n.target,data:n.data}),t.adjacency.get(n.source).push(n.index),t.reverseAdjacency.get(n.target).push(n.index),e.type==="undirected"&&(t.adjacency.get(n.target).push(n.index),t.reverseAdjacency.get(n.source).push(n.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=D(),t};var UJ=Dy;var Xv=e=>j(e,UJ);var gN=class e{type;source;target;identity;constructor(t,n,r,o){this.type=t,this.source=n,this.target=r,this.identity=o}[_e](t){return!(t instanceof e)||this.type!==t.type||!ae(this.identity,t.identity)?!1:this.type==="directed"?ae(this.source,t.source)&&ae(this.target,t.target):ae(this.source,t.source)&&ae(this.target,t.target)||ae(this.source,t.target)&&ae(this.target,t.source)}[Oe](){let t=ce(this.identity);return this.type==="directed"?Nt(ce(this.target))(Nt(ce(this.source))(t)):Ua(t^ce(this.source)+ce(this.target))}};var Ly="~effect/collections/HashMap",Ns=5,tm=1<<Ns,DJ=tm/4,yN=tm/2,NJ=tm-1,LJ=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),em=(e,t)=>e>>>t&NJ,xc=(e,t)=>1<<em(e,t),Ny=(e,t)=>LJ(e&t-1);function SN(e,t,n,r,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let i=xc(n,t),a=xc(o,t);if(i===a){let f=SN(e,t+Ns,n,r,o,s);return new $u(e,i,[f])}let c=i|a,u=i>>>0<a>>>0?[r,s]:[s,r];return new $u(e,c,u)}var ju=class{canEdit(t){return this.edit===t}},eT=class extends ju{_tag="EmptyNode";edit=0;get size(){return 0}get(t,n,r){return D()}has(t,n,r){return!1}set(t,n,r,o,s,i){return i.value=!0,new qu(t,r,o,s)}remove(t,n,r,o,s){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(t){return!1}},qu=class e extends ju{_tag="LeafNode";edit;hash;key;value;constructor(t,n,r,o){super(),this.edit=t,this.hash=n,this.key=r,this.value=o}get size(){return 1}get(t,n,r){return this.hash===n&&ae(this.key,r)?L(this.value):D()}has(t,n,r){return this.hash===n&&ae(this.key,r)}set(t,n,r,o,s,i){if(this.hash===r&&ae(this.key,o))return ae(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,r,o,s);if(i.value=!0,this.hash===r)return new tT(t,r,[[this.key,this.value],[o,s]]);let a=xc(r,n),c=xc(this.hash,n);if(a===c)return new $u(t,a,[this.set(t,n+Ns,r,o,s,i)]);let u=a|c,f=a>>>0<c>>>0?[new e(t,r,o,s),this]:[this,new e(t,r,o,s)];return new $u(t,u,f)}remove(t,n,r,o,s){if(this.hash===r&&ae(this.key,o)){s.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},tT=class e extends ju{_tag="CollisionNode";edit;hash;entries;constructor(t,n,r){super(),this.edit=t,this.hash=n,this.entries=r}get size(){return this.entries.length}get(t,n,r){if(this.hash!==n)return D();for(let[o,s]of this.entries)if(ae(o,r))return L(s);return D()}has(t,n,r){if(this.hash!==n)return!1;for(let[o]of this.entries)if(ae(o,r))return!0;return!1}set(t,n,r,o,s,i){if(this.hash!==r)return i.value=!0,SN(t,n,this.hash,this,r,new qu(t,r,o,s));for(let a=0;a<this.entries.length;a++)if(ae(this.entries[a][0],o)){if(ae(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,n,r,o,s){if(this.hash!==r)return this;let i=this.entries.findIndex(([c])=>ae(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 qu(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)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},$u=class e extends ju{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,n,r){super(),this.edit=t,this.bitmap=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+n.size,0)),this._size}get(t,n,r){let o=xc(n,t);if((this.bitmap&o)===0)return D();let s=Ny(this.bitmap,o);return this.children[s].get(t+Ns,n,r)}has(t,n,r){let o=xc(n,t);if((this.bitmap&o)===0)return!1;let s=Ny(this.bitmap,o);return this.children[s].has(t+Ns,n,r)}set(t,n,r,o,s,i){let a=xc(r,n),c=Ny(this.bitmap,a);if((this.bitmap&a)!==0){let u=this.children[c],f=u.set(t,n+Ns,r,o,s,i);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let l=[...this.children];return l[c]=f,new e(t,this.bitmap,l)}else{i.value=!0;let u=new qu(t,r,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>yN?this.expand(t,f,this.children):this;let l=[...this.children];return l.splice(c,0,u),l.length>yN?this.expand(t,f,l):new e(t,f,l)}}remove(t,n,r,o,s){let i=xc(r,n);if((this.bitmap&i)===0)return this;let a=Ny(this.bitmap,i),c=this.children[a],u=c.remove(t,n+Ns,r,o,s);if(!s.value)return this;if(u===void 0){let l=this.bitmap^i;if(l===0)return;if(this.children.length===2){let m=this.children[a===0?1:0];if(m._tag==="LeafNode")return m}if(this.canEdit(t))return this.children.splice(a,1),this.bitmap=l,this._size=void 0,this;let p=[...this.children];return p.splice(a,1),new e(t,l,p)}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,n,r){let o=new globalThis.Array(tm),s=0;for(let i=0;i<tm;i++)(n&1<<i)!==0&&(o[i]=r[s++]);return new nT(t,r.length,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){n||(n=this.children[t].iterator());let r=n.next();if(!r.done)return r;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},nT=class e extends ju{_tag="ArrayNode";edit;_size;count;children;constructor(t,n,r){super(),this.edit=t,this.count=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+(n?.size??0),0)),this._size}get(t,n,r){let o=em(n,t),s=this.children[o];return s?s.get(t+Ns,n,r):D()}has(t,n,r){let o=em(n,t),s=this.children[o];return s?s.has(t+Ns,n,r):!1}set(t,n,r,o,s,i){let a=em(r,n),c=this.children[a];if(c){let u=c.set(t,n+Ns,r,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 qu(t,r,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,n,r,o,s){let i=em(r,n),a=this.children[i];if(!a)return this;let c=a.remove(t,n+Ns,r,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<DJ)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,n,r){let o=[],s=0,i=1;for(let a=0;a<this.children.length;a++){let c=a===n?r:this.children[a];c&&(o.push(c),s|=i),i<<=1}return new $u(t,s,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){let r=this.children[t];if(!r){t++;continue}n||(n=r.iterator());let o=n.next();if(!o.done)return o;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},nm=class{[Ly]=Ly;_editable;_edit;_root;_size;constructor(t,n,r,o){this._editable=t,this._edit=n,this._root=r,this._size=o}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[_e](t){if(rT(t)){let n=t;if(this.size!==n.size)return!1;for(let[r,o]of this){let s=lf(t,wN(r));if(xe(s)||!ae(o,s.value))return!1}return!0}return!1}[Oe](){let t=it("HashMap");for(let[n,r]of this)t=t^ce(n)+ce(r);return t}[at](){return hn(this)}toString(){return`HashMap(${X(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,n])=>[hn(t),hn(n)])}}pipe(){return ie(this,arguments)}},bN=new eT,rT=e=>j(e,Ly),oT=()=>new nm(!1,0,bN,0);var EN=e=>{let t=bN,n=0,r={value:!1};for(let[o,s]of e){let i=ce(o);r.value=!1,t=t.set(NaN,0,i,o,s,r),r.value&&n++}return new nm(!1,0,t,n)};var wN=d(2,(e,t)=>e._root.get(0,ce(t),t));var sT=d(2,(e,t)=>e._root.has(0,ce(t),t));var BJ=(e,t,n,r)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,n,t,r,s);return o._editable?(o._root=a,s.value&&o._size++,e):o._root===a?e:new nm(!1,o._edit,a,o._size+(s.value?1:0))},iT=d(3,(e,t,n)=>BJ(e,t,ce(t),n)),aT=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();return n.done?{done:!0,value:void 0}:{done:!1,value:n.value[0]}}}};var IN=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},By=e=>e.size;var jy=rT;var qy=EN;var $J=IN,$y=e=>Array.from($J(e)),TN=By;var rm="~effect/collections/HashSet",zJ={[Oe](){return ce(rm)},[_e](e){return uT(e)&&zy(this)===zy(e)&&AN(this,t=>CN(e,t))},[Symbol.iterator](){return aT(fT(this))},toString(){return`HashSet(${X(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:hn(Array.from(this))}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},HJ=e=>{let t=Object.create(zJ);return t[rm]=rm,t.keyMap=e,t},uT=e=>j(e,rm),fT=e=>e.keyMap;var kN=e=>{let t=oT();for(let n of e)t=iT(t,n,!0);return HJ(t)},CN=(e,t)=>sT(fT(e),t);var zy=e=>By(fT(e));var AN=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var Hy=kN,Wy=uT;var RN=zy;function Ky(e){let t=qN(Jy,yn(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Vy(e){let t=Ky(e);return(n,r)=>{let o=ac(t(n,r));return Ft(o)?L(o.value):(da(o.cause,"Option adapter can only return none for schema issues"),D())}}function _N(e){let t=Ky(e);return(n,r)=>{let o=ac(t(n,r));if(Ft(o))return o.value;let s=da(o.cause,"Constructor adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function MN(e){return sm(e.ast)}function sm(e){let t=zu(im(yn(e)));return n=>{let r=t(n,Xr);return Ft(r)?!0:(da(r.cause,"Type guard adapter can only return false for schema issues"),!1)}}function PN(e){let t=im(e);return(n,r)=>{let o=ac(t(n,r));if(!Ft(o))return da(o.cause,"Issue adapter can only return schema issues")}}function FN(e,t){let r=zu(im(yn(e.ast)))(t,Xr);if(ii(r)){let o=da(r.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:o})}}function dt(e,t){let n=im(e.ast);return t===void 0?n:(r,o)=>n(r,om(t,o))}var dT=dt;function UN(e,t){return zu(dt(e,t))}function pT(e,t){return $N(dt(e,t))}var DN=pT;function NN(e,t){return zN(dt(e,t))}function KJ(e,t){return HN(dt(e,t))}var mT=KJ;function Pl(e,t){let n=im(ks(e.ast));return t===void 0?n:(r,o)=>n(r,om(t,o))}function LN(e,t){return zu(Pl(e,t))}function hT(e,t){return $N(Pl(e,t))}var BN=hT;function jN(e,t){return zN(Pl(e,t))}function VJ(e,t){return HN(Pl(e,t))}var gT=VJ,om=(e,t)=>t?{...e,...t}:e,ON=e=>e===ze?G(new ke):v(e);function im(e){return qN(WN,e)}function qN(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??Xr);return s===on?v(r):xt(s)?s[ye]===ze?ON(ze):s:Bn(s,ON)}}function zu(e){return(t,n)=>ac(e(t,n))}function $N(e){let t=zu(e);return(n,r)=>{let o=t(n,r);return Ft(o)?L(o.value):(da(o.cause,"Option adapter can only return none for schema issues"),D())}}function zN(e){let t=zu(e);return(n,r)=>{let o=t(n,r);return Ft(o)?Ce(o.value):Ae(da(o.cause,"Result adapter can only return schema issues"))}}function HN(e){let t=zu(e);return(n,r)=>{let o=t(n,r);if(Ft(o))return o.value;let s=da(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}var WN=wn(e=>xT(e,WN)),Jy=wn(e=>xT(e,Jy,KN)),JJ=wn(e=>xT(e,Jy,KN,e.context?.constructorDefault));function KN(e){return e.context?.constructorDefault?JJ(e):Jy(e)}function VN(e,t,n,r){let o;if(xt(e)&&e._tag==="Success"){let s=Ex(e===on?t:e[ye]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(zo(s),r)}else n._tag==="Transformation"?o=Bn(e,s=>n.decode.run(Ex(s),r)):o=n.decode(fa(e,Ex),r);return xt(o)&&o._tag==="Success"?tI(o[ye]):Bn(o,tI)}function GJ(e,t){let n;return(r,o)=>{if(r===ze)return vs;if(e.isConstructed(r))return on;let s=(n??=t(e.link.to))(r,o);return VN(s,r,e.link.transformation,o)}}function xT(e,t,n,r){let o=n?P1(e):void 0,s=o?GJ(o,t):e.getParser(t,n),i=e.checks,a=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c)return u?(p,m)=>s(p,om(m,u)):s;let f,l=(p,m)=>{let h=s(p,m);if(c&&!m.disableChecks)if(xt(h)){if(h._tag==="Success"){let g=h===on?p:h[ye];if(p!==ze&&g!==ze){let x=Rs(c,p,void 0,e,m);x&&(h=G(new At(e,x,p,m)))}}}else h=R(h,g=>{if(p!==ze&&g!==ze){let x=Rs(c,p,void 0,e,m);if(x)return G(new At(e,x,p,m))}return v(g)});if(i&&!m.disableChecks)if(xt(h)){if(h._tag==="Success"){let g=h===on?p:h[ye];if(g===ze)return h;let x=Rs(i,g,void 0,e,m);x&&(h=G(new At(e,x,g,m)))}}else h=R(h,g=>{if(g!==ze){let x=Rs(i,g,void 0,e,m);if(x)return G(new At(e,x,g,m))}return v(g)});return h};return a?(p,m)=>{u&&(m=om(m,u));let h=f??=a.map(E=>t(E.to)),g=p,x=h[h.length-1](p,m);for(let E=a.length-1;E>=0;E--)if(x=VN(x,g,a[E].transformation,m),E!==0){let b=h[E-1];x._tag==="Success"?(g=x[ye],x=b(g,m)):x=Bn(x,y=>{let w=b(y,m);return w===on?zo(y):w})}if(x._tag==="Success"){let E=x[ye],b=l(E,m);return b===on?x:b}return x=ft(x,E=>ia(()=>ec(E,b=>new Tx(e,b,p,m)))),Bn(x,E=>{let b=l(E,m);return b===on?zo(E):b})}:u?(p,m)=>l(p,om(m,u)):l}var Gy="~effect/Schema/Schema";function _r(e,t,n){return{id:e,payloadSchema:t,revive:n}}function Re(e,t,n){return{id:e,payloadSchema:t,revive:n}}var ZJ={[Gy]:Gy,pipe(){return ie(this,arguments)},annotate(e){return this.rebuild(Ho(this.ast,e))},annotateKey(e){return this.rebuild(bl(this.ast,e))},check(...e){return this.rebuild(Si(this.ast,e))}};function am(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,ZJ),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=o=>am(o,t),r.makeEffect=Ky(r),r.make=_N(r),r.makeOption=Vy(r),r}var JN=d(2,(e,t)=>ST(e,(n,r)=>t.includes(n)?[n,r]:void 0)),GN=d(2,(e,t)=>ST(e,(n,r)=>t.includes(n)?void 0:[n,r])),ZN=d(2,(e,t)=>({...e,...t}));var yT=d(2,(e,t)=>ST(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]));var dr=e=>e;function ST(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,i]=o;W(n,s,i)}}return n}function QN(e,t){let n=t?.omitKeyWhen??(()=>!1);return Rh((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);n(c)||W(i,a,c)}return i})}function cm(e){return vo((t,n)=>t===void 0?n:n===void 0?t:e.combine(t,n),void 0)}function vi(e,t){return t.length>0&&(e+=`
30
- at ${Oh(t)}`),new Error(e)}var XN=new WeakMap,e2=new WeakMap,t2=[];function Ta(e){return new Error(`Unable to derive an arbitrary for ${e}`)}var n2=([e],[t])=>ae(e,t);function YJ(e,t,n){return t.reduce((r,o)=>r.filter(s=>o.run(s,e,Xr)===void 0),n)}function d2(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw Ta(`${t} constraints`)}function p2(e){return e===void 0||e.minLength===void 0&&e.maxLength===void 0?void 0:{...e.minLength!==void 0?{minLength:e.minLength}:{},...e.maxLength!==void 0?{maxLength:e.maxLength}:{}}}function bT(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function r2(e,t,n,r=!1){let o=t.constraint,s=p2(o);return d2(s,"array"),bT(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?ae:void 0)}function Qy(e,t,n,r){return t.chain(o=>o.length<n?e.constant(o):r.map(s=>[...o,...s]))}function o2(e,t){return e.chain(n=>t.map(r=>({...Object.fromEntries(r),...n})))}var XJ=cm(rF),eG=cm(oF),Yy=cm($R),tG=cm(OR()),nG=QN({integer:Yy,maxLength:eG,minLength:XJ,noInfinity:Yy,noNaN:Yy,patterns:tG,unique:Yy},{omitKeyWhen:LA});function s2(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function rG(e,t){if(e===void 0)return t;if(e.order!==t.order)throw new Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=s2(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=s2(e.order,e.maximum,e.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1);return{order:e.order,...n!==void 0?{minimum:n}:{},...r!==void 0?{exclusiveMinimum:r}:{},...o!==void 0?{maximum:o}:{},...s!==void 0?{exclusiveMaximum:s}:{}}}function oG(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,i=o===void 0?n:rG(n,o);return{...nG.combine(r,s),...i===void 0?{}:{ordered:i}}}function i2(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary&&n.push(o.annotations.arbitrary),o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function sG(e){let t=e.map(({constraint:n})=>n).filter(Kn);return n=>{let r=t.reduce((o,s)=>oG(o,s),n.constraint);return{...n,constraint:r}}}function um(e){return{...e,constraint:void 0}}function a2(e,t,n){if(t===void 0||t.minLength===void 0&&t.maxLength===void 0)return;if(t.minLength!==void 0&&e.indexSignatures.length===0&&t.minLength>e.propertySignatures.length)throw Ta("object property constraints");let r={};if(t.minLength!==void 0&&(r.minLength=Math.max(0,t.minLength-n)),t.maxLength!==void 0&&(r.maxLength=t.maxLength-n,r.maxLength<0))throw Ta("object property constraints");return d2(r,"object property"),r}function iG(e,t,n,r,o,s){let i=r.length;if(s.maxLength!==void 0&&s.maxLength<i)throw Ta("object property constraints");let a=s.minLength===void 0?0:Math.max(0,s.minLength-i),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-i);if(a>c)throw Ta("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),f=e.shuffledSubarray([...o],{minLength:a,maxLength:c});return e.tuple(u,f).map(([l,p])=>{let m=new Set([...r,...p]),h={};for(let g of n)m.has(g)&&W(h,g,l[g]);return h})}function m2(e,t,n,r){let o={};if(e?.minimum!==void 0&&(o.min=t(e.minimum,e.exclusiveMinimum===!0)),e?.maximum!==void 0&&(o.max=n(e.maximum,e.exclusiveMaximum===!0)),o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw Ta(r);return o}function aG(e){return m2(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function cG(e,t){let n={...e?.noInfinity?{noDefaultInfinity:!0}:{},...e?.noNaN?{noNaN:!0}:{},...t?.minimum!==void 0?{min:t.minimum}:{},...t?.exclusiveMinimum!==void 0?{minExcluded:t.exclusiveMinimum}:{},...t?.maximum!==void 0?{max:t.maximum}:{},...t?.exclusiveMaximum!==void 0?{maxExcluded:t.exclusiveMaximum}:{}};if(n.min!==void 0&&n.max!==void 0&&(n.min>n.max||n.min===n.max&&(n.minExcluded||n.maxExcluded)))throw Ta("number constraints");return n}function uG(e){return m2(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function Ul(e,t){let n=(r,o,s=t2)=>e(r,o,s);return n.terminal=(r,o,s=t2)=>t(r,o,s),n}function Vo(e){return Ul(e,e)}function c2(e,t){let n=e2.get(t)??e.createDepthIdentifier();return e2.set(t,n),{maxDepth:2,depthIdentifier:n}}function u2(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}var fG={noInfinity:!0,noNaN:!0};function lG(e){return{...e,constraint:fG}}function dG(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let i=s.make(e,t);if(i===void 0)continue;let a=s.weight??1;if(!globalThis.Number.isInteger(a)||a<=0)throw Ta("a candidate with an invalid weight");o.push({arbitrary:i,weight:a})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function f2(e,t,n,r,o){let s=dG(n,r,t.arbitraries,o);return s===void 0?void 0:YJ(e,t.filters,s)}function pG(e,t){if(!(typeof e=="object"&&e!==null&&"arbitrary"in e))return{arbitrary:e,terminal:t?void 0:e};let n="terminal"in e?e.terminal:t?void 0:e.arbitrary;return{arbitrary:e.arbitrary,terminal:n}}function mG(e,t,n,r,o){return e.map(s=>({arbitrary:o?t.constant(null).chain(()=>s(t,n,r)):s(t,n,r),terminal:s.terminal(t,n,r)}))}function l2(e,t,n,r){let o=sG(t.arbitraries);return Ul((s,i,a)=>{let c=o(i);return f2(e,t,s,c,n(s,i,c,a))},(s,i,a)=>{let c=o(i);return f2(e,t,s,c,r(s,i,c,a))})}var h2=wn(e=>Jo(e,[]));function Jo(e,t){let n=gi(e)?.toArbitrary;if(n){let r=pc(e)?e.typeParameters.map(i=>Jo(i,t)):[],o=i2(e.checks),s=i=>(a,c,u,f)=>pG(n(mG(r,a,um(c),f,i))(a,u),r.length>0)[i?"terminal":"arbitrary"];return l2(e,o,s(!1),s(!0))}if(e.checks){let r=i2(e.checks),o=Jo(Yx(e,void 0),t);return l2(e,r,(s,i,a,c)=>o(s,a,c),(s,i,a,c)=>o.terminal(s,a,c))}return hG(e,t)}function hG(e,t){switch(e._tag){case"Never":case"Declaration":throw vi(`Unsupported AST ${e._tag}`,t);case"Null":return Vo(n=>n.constant(null));case"Void":case"Undefined":return Vo(n=>n.constant(void 0));case"Unknown":case"Any":return Vo(n=>n.anything());case"String":return Vo((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map(i=>n.stringMatching(new RegExp(i)))):n.string(p2(o))});case"Number":return Vo((n,r)=>{let o=r.constraint,s=o?.ordered?.order===fo?o.ordered:void 0;return o?.integer?n.integer(aG(s)):n.float(cG(o,s))});case"Boolean":return Vo(n=>n.boolean());case"BigInt":return Vo((n,r)=>{let o=r.constraint?.ordered?.order===Ro?r.constraint.ordered:void 0;return n.bigInt(uG(o))});case"Symbol":return Vo(n=>n.string().map(Symbol.for));case"Literal":return Vo(n=>n.constant(e.literal));case"UniqueSymbol":return Vo(n=>n.constant(e.symbol));case"ObjectKeyword":return Vo(n=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return Jo(Np(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>Jo(jn(r),[...t,o]));return Vo((r,o,s)=>r.tuple(...n.map(i=>i(r,lG(o),s))).map(i=>i.map(a=>globalThis.String(a)).join("")))}case"Arrays":{let n=e.elements.map((i,a)=>({ast:i,arbitrary:Jo(i,[...t,a])})),r=e.elements.length,o=e.rest.map((i,a)=>({ast:i,arbitrary:Jo(i,[...t,r+a])})),s=(i,a,c)=>{let u=um(a),f=[],l=[],p=0;for(let b of n){let y=b.arbitrary.terminal(i,u,c);if(an(b.ast)){l.push(y);continue}if(y===void 0)return;p++,f.push(y.map(L))}let m=a.constraint?.minLength??0,g=Ye(o)&&m>p+l.length?l.length:Math.max(0,m-p),x=0;for(let b of l){if(x>=g||b===void 0){f.push(i.constant(D()));continue}x++,p++,f.push(b.map(L))}if(x<g)return;let E=i.tuple(...f).map(xE);if(Ye(o)){let[b,...y]=o,w=e.elements.length===0?a:u,S=Math.max(0,m-p-y.length),C=S===0?void 0:b.arbitrary.terminal(i,u,c);if(S>0&&C===void 0)return;let M=S===0?i.constant([]):r2(i,{...w,constraint:{...w.constraint,minLength:S}},C,!0);if(E=Qy(i,E,r,M),y.length>0){let _=[];for(let $ of y){let F=$.arbitrary.terminal(i,u,c);if(F===void 0)return;_.push(F)}let P=i.tuple(..._);E=Qy(i,E,r,P)}}return E};return Ul((i,a,c)=>{let u=um(a),f=n.map(({ast:p,arbitrary:m})=>{let h=m(i,u,c);return an(p)?h.chain(g=>i.boolean().map(x=>x?L(g):D())):h.map(L)}),l=i.tuple(...f).map(p=>xE(AR(p,Te)));if(Ye(o)){let[p,...m]=o.map(({arbitrary:g})=>g(i,u,c)),h=r2(i,e.elements.length===0?a:u,p);if(l=Qy(i,l,r,h),m.length>0){let g=i.tuple(...m);l=Qy(i,l,r,g)}}if(a.recursion){let p=s(i,a,c);if(p!==void 0)return i.oneof(a.recursion,p,l)}return l},s)}case"Objects":{let n=e.propertySignatures.map(s=>({ps:s,arbitrary:Jo(s.type,[...t,s.name])})),r=e.indexSignatures.map(s=>({is:s,parameter:Jo(s.parameter,t),type:Jo(s.type,t)}));return Ul((s,i,a)=>{let c=um(i),u={},f=[],l=[],p=[];for(let{ps:x,arbitrary:E}of n){let b=x.name;f.push(b),an(x.type)?p.push(b):l.push(b),W(u,b,E(s,c,a))}let m=i.constraint;if(p.length>0&&r.length===0&&m!==void 0&&(m.minLength!==void 0||m.maxLength!==void 0))return iG(s,u,f,l,p,m);let h=s.record(u,{requiredKeys:l}),g=a2(e,i.constraint,l.length);for(let{parameter:x,type:E}of r){let b=s.tuple(x(s,c,a),E(s,c,a)),y=bT(s,b,g,n2);h=o2(h,y)}return h},(s,i,a)=>{let c=um(i),u={},f=[],l=[];for(let{ps:x,arbitrary:E}of n){let b=x.name,y=E.terminal(s,c,a);if(an(x.type)){y!==void 0&&l.push([b,y]);continue}if(y===void 0)return;f.push(b),W(u,b,y)}let p=Math.max(0,(i.constraint?.minLength??0)-f.length);for(let[x,E]of l){if(p===0)break;p--,f.push(x),W(u,x,E)}if(p>0&&e.indexSignatures.length===0)return;let m=s.record(u,{requiredKeys:f}),h=a2(e,i.constraint,f.length),g=h?.minLength??0;for(let{parameter:x,type:E}of r){let b;if(g===0)b=s.constant([]);else{let y=x.terminal(s,c,a),w=E.terminal(s,c,a);if(y===void 0||w===void 0)return;b=bT(s,s.tuple(y,w),{...h,maxLength:g},n2)}m=o2(m,b)}return m})}case"Union":{let n=e.types.map(o=>Jo(o,t)),r=(o,s,i)=>u2(o,n.map(a=>a.terminal(o,s,i)).filter(Kn));return Ul((o,s,i)=>{let a=n.map(u=>u(o,s,i));if(s.recursion){let u=r(o,s,i);if(u!==void 0)return o.oneof(s.recursion,u,...a)}let c=u2(o,a);if(c===void 0)throw Ta("a union with no members");return c},r)}case"Suspend":{let n=XN.get(e);if(n)return n;let r=_u(()=>Jo(e.thunk(),t)),o=Ul((s,i,a)=>{let c=c2(s,e),u={...i,recursion:c},f=a.includes(e)?a:[...a,e],l=r().terminal(s,u,f);if(l===void 0)throw vi("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,l,s.constant(null).chain(()=>r()(s,u,f)))},(s,i,a)=>{if(a.includes(e))return;let c=c2(s,e);return r().terminal(s,{...i,recursion:c},[...a,e])});return XN.set(e,o),o}}}var g2=wn(e=>yc(e,[]));function yc(e,t){let n=gi(e)?.toEquivalence;if(n)return n(pc(e)?e.typeParameters.map(r=>yc(r,t)):[]);switch(e._tag){case"Never":return Hc();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ae;case"Arrays":{let r=e.elements.map((i,a)=>yc(i,[...t,a])),o=e.elements.length,s=e.rest.map((i,a)=>yc(i,[...t,o+a]));return un((i,a)=>{if(!Array.isArray(i)||!Array.isArray(a))return!1;let c=i.length;if(c!==a.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](i[u],a[u]))return!1;if(s.length>0){let[f,...l]=s;for(;u<c-l.length;u++)if(!f(i[u],a[u]))return!1;for(let p=0;p<l.length;p++)if(!l[p](i[u+p],a[u+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ae;let r=e.propertySignatures.map(s=>yc(s.type,[...t,s.name])),o=e.indexSignatures.map(s=>yc(s.type,t));return un((s,i)=>{if(!en(s)||!en(i))return!1;for(let a=0;a<r.length;a++){let c=e.propertySignatures[a],u=c.name,f=Object.hasOwn(s,u),l=Object.hasOwn(i,u);if(an(c.type)&&f!==l||f&&l&&!r[a](s[u],i[u]))return!1}for(let a=0;a<o.length;a++){let c=e.indexSignatures[a],u=ha(s,c.parameter),f=ha(i,c.parameter);if(u.length!==f.length)return!1;for(let l=0;l<u.length;l++){let p=u[l];if(!Object.hasOwn(i,p)||!o[a](s[p],i[p]))return!1}}return!0})}case"Union":{let r=yn(e).types,o=new Map(r.map((s,i)=>[s,[sm(s),yc(e.types[i],t)]]));return un((s,i)=>{let a=Mp(s,r);for(let c=0;c<a.length;c++){let[u,f]=o.get(a[c]);if(u(s)&&u(i))return f(s,i)}return!1})}case"Suspend":{let r=_u(()=>yc(e.thunk(),t));return un((o,s)=>r()(o,s))}}}function Hu(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Dl(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var SG="http://json-schema.org/draft-07/schema#",x2="https://json-schema.org/draft/2020-12/schema";function y2(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function E2(e){return{dialect:"draft-07",...kG(e,DG)}}function bG(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!en(r))return r;let i=o||!s&&v2(r.$id),a={};for(let c of Object.keys(r)){let u=r[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=wT(u,l=>n(l,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(l=>n(l,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=n(u,i)}W(a,c,f)}return t(a,i),a}}function w2(e,t){return bG(e,n=>{EG(n,t)})}function EG(e,t){typeof e.$ref=="string"&&W(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&W(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function wT(e,t){if(!en(e))return;let n={};for(let r of Object.keys(e))W(n,r,t(e[r],r));return n}function wG(e,t,n){let r=new Map,o=[],s=ET;function i(p,m=[],h=[]){if(m.length===0&&t?.trackIds){let g=en(p)?f(p):void 0;s=S2(g,ET)??ET}return u(p,m,h,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[p,m,h]of o){let g=m,x=I2(m,h);if(x!==void 0){let E=IG(x.hash);if(x.hash="",E!==void 0){let b=r.get(b2(x.href,E));b!==void 0&&(g=vG(m,b))}}W(p,"$ref",g)}}let c=n(i);return a(),c;function u(p,m,h,g){if(typeof p=="boolean")return l(m,h,g),t?.booleanAdapter?.(p)??p;if(!en(p))return p;let x=g,E=f(p);if(m.length>0&&t?.trackIds&&v2(E)){let w=S2(E,g.uri);w!==void 0&&(x={parent:g,sourceRoot:m,targetRoot:h,uri:w})}l(m,h,x);let b=x.uri,y={isDocumentRoot:m.length===0,schema(w,S,C=S){return u(w,[...m,S],[...h,C],x)},schemaAt(w,S,C){return u(w,[...m,...S],[...h,...C],x)},schemaArray(w,S,C=S){return Array.isArray(w)?w.map((M,_)=>u(M,[...m,S,String(_)],[...h,C,String(_)],x)):w},schemaMap(w,S,C=S){return en(w)?wT(w,(M,_)=>u(M,[...m,S,_],[...h,C,_],x)):w},reference(w,S){typeof S=="string"?o.push([w,S,b]):W(w,"$ref",S)}};return e(p,y)}function f(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function l(p,m,h){h.parent!==void 0&&l(p,m,h.parent),r.set(b2(h.uri,p.slice(h.sourceRoot.length)),m.slice(h.targetRoot.length))}}var ET="https://effect.invalid/.json-schema/";function I2(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function S2(e,t){if(typeof e!="string")return;let n=I2(e,t);if(n!==void 0)return n.hash="",n.href}function IG(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(t.startsWith("/"))return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(Dl)}function vG(e,t){let n=e.indexOf("#");return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${TG(t)}`}function TG(e){return e.length===0?"#":`#/${e.map(t=>encodeURI(Hu(t)).replace(/#/g,"%23")).join("/")}`}function b2(e,t){return`${e}\0${JSON.stringify(t)}`}function v2(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function kG(e,t,n){return wG(t,{...n,trackIds:!0},r=>({schema:r(e.schema),definitions:wT(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}var CG=new Set(["properties","patternProperties"]),AG=new Set(["allOf","anyOf","oneOf"]),RG=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function OG(e,t,n,r,o,s=CG){let i;if(s.has(t))i=r.schemaMap(n,t);else if(AG.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return W(e,t,i),!0}var T2=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],Afe=[...T2,"deprecated"],Rfe=[...T2,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],_G=/^[A-Za-z_][-A-Za-z0-9._]*$/,MG=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Wu(e,t,n){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function PG(e,t,n,r){for(let o of t)Object.hasOwn(e,o)&&Wu(o,n,`it is not active in ${r} but would become active in the target`)}var FG=["additionalItems","definitions","dependencies"];function UG(e,t,n,r,o){n.isDocumentRoot?W(e,"$schema",y2(t,x2)?r:t):y2(t,x2)||Wu("$schema",o,"an embedded resource cannot declare a different dialect")}function DG(e,t){PG(e,FG,"Draft-07","Draft 2020-12");let n={},r,o,s;for(let i of Object.keys(e)){let a=e[i];if(!OG(n,i,a,t,RG))switch(i){case"$ref":r=a;break;case"$schema":UG(n,a,t,SG,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":W(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":Wu(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;W(n,i,a);break;default:W(n,i,a)}}if(NG(n,o,s,t),Object.hasOwn(e,"contains")){let i=e.minContains,a=e.maxContains;(i!==void 0&&i!==1||a!==void 0)&&Wu("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&W(n,"minContains",i)}else Object.hasOwn(e,"minContains")&&W(n,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&W(n,"maxContains",e.maxContains);return BG(e,n,t,"draft-07"),qG(e,n,"$id","Draft-07"),LG(n,r,t),n}function NG(e,t,n,r){if(t===void 0){n!==void 0&&W(e,"items",r.schema(n,"items"));return}W(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0&&W(e,"additionalItems",r.schema(n,"items","additionalItems"))}function LG(e,t,n){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),jG(e,r)}else n.reference(e,t)}function BG(e,t,n,r){let o=en(e.dependentRequired)?e.dependentRequired:void 0,s=en(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],l=r==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?l||W(i,c,u):u===void 0||l?W(i,c,n.schemaAt(f,["dependentSchemas",c],["dependencies",c])):W(i,c,{allOf:[n.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(i).length>0&&W(t,"dependencies",i)}function jG(e,t){Array.isArray(e.allOf)?e.allOf.push(t):W(e,"allOf",[t])}function qG(e,t,n,r){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&W(t,n,o);return}(typeof s!="string"||!_G.test(s))&&Wu("$anchor",r,"the anchor is not valid"),MG.test(s)||Wu("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?W(t,n,`#${s}`):Wu("$anchor",r,"it cannot be combined with the schema $id")}var Ofe=globalThis.RegExp;var Nl=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var $G=new Set([...jF,Tu,...LF]);function fm(e,t){if(e===void 0)return;let n={},r=e.title;typeof r=="string"&&(n.title=r);let o=e.description,s=e.expected;typeof o=="string"?n.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(n.description=s);let i=e.default;wl(i)&&(n.default=i);let a=e.examples;Array.isArray(a)&&wl(a)&&(n.examples=a);let c=e.readOnly;typeof c=="boolean"&&(n.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(n.writeOnly=u);let f=e.format;typeof f=="string"&&(n.format=f);let l=e.contentEncoding;typeof l=="string"&&(n.contentEncoding=l);let p=e.contentMediaType;typeof p=="string"&&(n.contentMediaType=p);let m=e.contentSchema;if(wl(m)&&(n.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[h,g]of Object.entries(e))$G.has(h)||!t.includeAnnotationKey(h)||wl(g)&&W(n,h,g);return Object.keys(n).length===0?void 0:n}function A2(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let i=A2(s);i.type!==void 0&&(o=!0,(t===void 0||i.type==="integer")&&(t=i.type)),Object.keys(i.schema).length>0&&r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function zG(e){return Array.isArray(e.anyOf)&&e.anyOf.length===4&&e.anyOf[0]?.type==="number"&&e.anyOf.slice(1).every(t=>t.type==="string")}var R2="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function vT(e,t){return Object.keys(e).every(n=>t.includes(`|${n}|`))}function C2(e,t){return typeof e.$ref!="string"&&t.every(n=>!Object.hasOwn(e,n))}var TT="|title|description|default|examples|readOnly|writeOnly|",HG=R2+TT;function lm(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=zG(e);if(o!==void 0||s){let a=A2(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:vT(a.schema,TT)&&C2(u,f)?{...u,...a.schema}:lm(u,a.schema,n)}}if(n&&C2(e,r))return{...e,...t};let i=Array.isArray(t.allOf)&&r.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 WG(e,t,n,r){let o=new Map,s=new WeakMap,i=new Map,a=!1,c=Object.keys(n);for(let y of c)l(y,["references",y]);let u=as(e,(y,w)=>p(x(y,t[w]))),f={};for(let y of c){let w=o.get(y);typeof w!="string"&&W(f,y,p(w))}return{dialect:"draft-2020-12",schemas:u,definitions:f};function l(y,w){let S=o.get(y);if(S!==void 0)return typeof S=="string"?S:y;if(!Object.hasOwn(n,y))throw vi(`Invalid reference ${y}`,[...w,"$ref"]);o.set(y,null);let C=n[y],M=x(C,["references",y]),_=m(C);if(_!==void 0){let P=i.get(_),$=P?.find(F=>ae(o.get(F),M));if($===void 0)P===void 0?i.set(_,[y]):P.push(y);else return a=!0,o.set(y,$),$}return o.set(y,M),y}function p(y){return a?w2(y,w=>w.replace(/^#\/\$defs\/([^/]*)/,(S,C)=>{let M=o.get(Dl(C));return typeof M=="string"?`#/$defs/${Hu(M)}`:S})):y}function m(y){if(y._tag==="Reference")return;let w=y.checks.length===0?y.annotations:y.checks[y.checks.length-1].annotations;return typeof w?.identifier!="string"&&typeof w?.[Tu]=="string"?w[Tu]:void 0}function h(y,w){return y?.schemas?.map((S,C)=>x(S,[...w,"schemas",C]))??[]}function g(y,w,S){let C=y.annotations,M=C?.toJsonSchema;if(M!==void 0){let F=h(y.representation,[...S,"representation"]),te=M({type:w,schemas:F}),ee=fm(C,r),T=ee===void 0?te:{...te,...ee},z=ee===void 0?R2:HG;return y._tag==="Filter"&&vT(T,z)&&(ee===void 0||vT(ee,TT))?[T,!0]:[T]}if(y._tag==="Filter")return;let _=y.checks.map((F,te)=>g(F,w,[...S,"checks",te])).filter(F=>F!==void 0);if(_.length===0)return;let P=fm(C,r),$=_.map(([F])=>F);return[P===void 0?{allOf:$}:{allOf:$,...P}]}function x(y,w){if(y._tag==="Reference"){let _=l(y.$ref,w);return{$ref:`#/$defs/${Hu(_)}`}}let S=s.get(y);if(S!==void 0)return S;let C=E(y,w),M=fm(y.annotations,r);M!==void 0&&(C={...C,...M});for(let _=0;_<y.checks.length;_++){let P=typeof C.type=="string"&&KG(C.type)?C.type:void 0,$=g(y.checks[_],P,[...w,"checks",_]);$!==void 0&&(C=lm(C,...$))}return s.set(y,C),C}function E(y,w){switch(y._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":case"UniqueSymbol":return{type:"string",allOf:[{pattern:"^Symbol\\((.*)\\)$"}]};case"Declaration":return{};case"Suspend":return x(y.thunk,[...w,"thunk"]);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN"]},{type:"string",enum:["Infinity"]},{type:"string",enum:["-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let S=y.literal;return typeof S=="bigint"?{type:"string",enum:[globalThis.String(S)]}:{type:typeof S,enum:[S]}}case"Enum":{let S=y.enums.map(([C,M])=>typeof M=="number"&&!globalThis.Number.isFinite(M)?{type:"string",enum:[globalThis.String(M)],title:C}:{type:typeof M,enum:[M],title:C});return S.length===0?{not:{}}:{anyOf:S}}case"TemplateLiteral":return{type:"string",pattern:`^${y.parts.map(Xy).join("")}$`};case"Arrays":{if(y.rest.length>1)throw vi("Invalid schema representation document",[...w,"rest"]);let S={type:"array"},C=y.elements.length,M=y.elements.map((_,P)=>{_.isOptional&&C--;let $=x(_.type,[...w,"elements",P,"type"]),F=fm(_.annotations,r);return F===void 0?$:lm($,F)});if(M.length>0?(S.prefixItems=M,S.maxItems=y.elements.length,C>0&&(S.minItems=C)):S.items=!1,y.rest.length===1){delete S.maxItems;let _=x(y.rest[0],[...w,"rest",0]);Object.keys(_).length>0?S.items=_:delete S.items}return S}case"Objects":{if(y.propertySignatures.length===0&&y.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let S={type:"object"},C={},M=[];for(let F=0;F<y.propertySignatures.length;F++){let te=y.propertySignatures[F];if(typeof te.name!="string")throw vi("Invalid schema representation document",[...w,"propertySignatures",F,"name"]);let ee=te.name,T=x(te.type,[...w,"propertySignatures",F,"type"]),z=fm(te.annotations,r);W(C,ee,z===void 0?T:lm(T,z)),te.isOptional||M.push(ee)}y.propertySignatures.length>0&&(S.properties=C),M.length>0&&(S.required=M);let _={},P=[];for(let F=0;F<y.indexSignatures.length;F++){let te=y.indexSignatures[F],ee=x(te.type,[...w,"indexSignatures",F,"type"]);Object.keys(ee).length===1&&"not"in ee&&(ee=!1);let T=b(te.parameter,[...w,"indexSignatures",F,"parameter"],new Set);if(T.length===0)P.push(ee);else for(let z of T){let U=_[z];W(_,z,U===void 0?ee:U===!1||ee===!1?!1:lm(U,ee))}}let $=Object.keys(_).length>0;return $&&(S.patternProperties=_),y.indexSignatures.length===0?S.additionalProperties=r?.additionalProperties??!1:P.length===1&&y.propertySignatures.length===0&&!$?S.additionalProperties=P[0]:P.length>0&&(S.allOf=P.map(F=>({type:"object",additionalProperties:F}))),typeof S.additionalProperties=="object"&&S.additionalProperties!==null&&Object.keys(S.additionalProperties).length===0&&delete S.additionalProperties,S}case"Union":{let S=y.types.map((C,M)=>x(C,[...w,"types",M]));if(S.length===0)return{not:{}};if(y.mode==="anyOf"&&S.length>1){let C=VG(S);if(C!==void 0)return C}return y.mode==="anyOf"?{anyOf:S}:{oneOf:S}}}}function b(y,w,S){switch(y._tag){case"Reference":{if(!Object.hasOwn(n,y.$ref))throw vi(`Invalid reference ${y.$ref}`,[...w,"$ref"]);if(l(y.$ref,w),S.has(y.$ref))return[];let C=new Set(S).add(y.$ref);return b(n[y.$ref],["references",y.$ref],C)}case"String":return O2(x(y,w));case"TemplateLiteral":return[`^${y.parts.map(Xy).join("")}$`];case"Union":return y.types.flatMap((C,M)=>b(C,[...w,"types",M],S));default:throw vi("Invalid schema representation document",w)}}}function KG(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function VG(e){let t,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;n.push(...r.enum)}return{type:t,enum:n}}function O2(e){let t=[];typeof e.pattern=="string"&&t.push(e.pattern);for(let n of["allOf","anyOf","oneOf"]){let r=e[n];if(Array.isArray(r))for(let o of r)typeof o=="object"&&o!==null&&!Array.isArray(o)&&t.push(...O2(o))}return t}function Xy(e){switch(e._tag){case"Literal":return Nl(globalThis.String(e.literal));case"String":return R1;case"Number":return Kx;case"TemplateLiteral":return e.parts.map(Xy).join("");case"Union":return e.types.map(Xy).join("|");default:throw vi("Invalid schema representation document",[])}}function _2(e,t){let n=WG([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var GG=({identifier:e})=>e;function Ls(e){return e===void 0?void 0:{annotations:e}}function kT(e,t){let{references:n,representations:r}=ZG([e],t);return{representation:r[0],references:n}}function ZG(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let S of e)m(S);let a=t?.referencePolicy??GG;for(let S of s.values())for(let C of S.values()){let M=a({ast:C.ast,occurrences:C.occurrences,identifier:C.identifier});if(M!==void 0){let _=M===C.identifier||!M.endsWith("_")?"_":"";C.reference=u(M,C,_)}else C.isRecursive&&(C.reference=u(`${C.ast._tag}_`,C,""))}return{representations:as(e,S=>g(S)),references:n};function u(S,C,M="_"){let _=S,P=0;for(;r.has(_);){if(r.get(_)===C)return _;_=`${S}${M}${++P}`}return r.set(_,C),_}function f(S,C,M){let _=C.fallback;return _!==void 0?Xw(S)===_?S:Ho(S,{[Tu]:_}):M===C.identifier?S:Ho(S,{identifier:M})}function l(S,C){if(!Object.hasOwn(n,S)&&!o.has(S)){o.add(S);let M=x(C);o.delete(S),W(n,S,M)}return{_tag:"Reference",$ref:S}}function p(S){let C=Dp(S),M=QI(C),_=ul(C),P=_===void 0?(C!==S?ul(S):void 0)??Xw(C):void 0;P!==void 0&&(_=`${P}Encoded`);let $=s.get(M);$===void 0&&($=new Map,s.set(M,$));let F=$.get(_);return F===void 0&&(F={ast:M,identifier:_,fallback:P,occurrences:0,isRecursive:!1,reference:void 0},$.set(_,F)),F}function m(S){let C=p(S),M=C.ast;if(C.occurrences++,i.has(C)){C.isRecursive=!0;return}if(!(C.occurrences>1)){switch(i.add(C),h(M.checks),M._tag){case"Declaration":case"Arrays":case"Objects":case"Union":M.recur(_=>(m(_),_));break;case"TemplateLiteral":M.parts.forEach(m);break;case"Suspend":m(M.thunk());break}i.delete(C)}}function h(S){S?.forEach(C=>{C.annotations?.representation?.schemas?.forEach(M=>m(yn(M))),C._tag==="FilterGroup"&&h(C.checks)})}function g(S){let C=p(S),M=C.ast,_=C.reference;if(_!==void 0){let P=C.identifier===void 0?M:f(M,C,_);return l(_,P)}return x(M)}function x(S){let C=E(S.checks);switch(S._tag){case"Declaration":return{_tag:"Declaration",typeParameters:S.typeParameters.map(M=>g(M)),checks:C,...y(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:C,...Ls(S.annotations)};case"Literal":return{_tag:"Literal",literal:S.literal,checks:C,...Ls(S.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:S.symbol,checks:C,...Ls(S.annotations)};case"Enum":return{_tag:"Enum",enums:S.enums,checks:C,...Ls(S.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:S.parts.map(M=>g(M)),checks:C,...Ls(S.annotations)};case"Arrays":return{_tag:"Arrays",elements:S.elements.map(M=>{let _=Dp(M),P=_.context?.annotations;return{isOptional:an(_),type:g(M),...Ls(P)}}),rest:S.rest.map(M=>g(M)),checks:C,...Ls(S.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:S.propertySignatures.map(M=>{let _=Dp(M.type),P=_.context?.annotations;return{name:M.name,type:g(M.type),isOptional:an(_),isMutable:T1(_),...Ls(P)}}),indexSignatures:S.indexSignatures.map(M=>({parameter:g(M.parameter),type:g(M.type)})),checks:C,...Ls(S.annotations)};case"Union":return{_tag:"Union",types:S.types.map(M=>g(M)),mode:S.mode,checks:C,...Ls(S.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:g(S.thunk()),...Ls(S.annotations)}}}function E(S){return S?.map(b)??[]}function b(S){switch(S._tag){case"Filter":return{_tag:"Filter",aborted:S.aborted,...w(S.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:as(S.checks,b),...w(S.annotations)}}}function y(S){if(S===void 0)return;let{representation:C,...M}=S;return{...C===void 0?void 0:{representation:C},...Object.keys(M).length===0?void 0:{annotations:M}}}function w(S){if(S===void 0)return;let{representation:C,...M}=S,_=C===void 0?void 0:C.schemas===void 0?C:{...C,schemas:C.schemas.map(P=>g(yn(P)))};return{..._===void 0?void 0:{representation:_},...Object.keys(M).length===0?void 0:{annotations:M}}}}function P2(e,t){let n=[];return CT(e,t,"",n),n}function CT(e,t,n,r){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++)CT(e[a],t[a],`${n}/${a}`,r);for(let a=o-1;a>=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;a<s;a++)r.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(eS(e)&&eS(t)){let o=Object.keys(e),s=Object.keys(t),i=Array.from(new Set([...o,...s])).sort();for(let a of i){let c=`${n}/${Hu(a)}`,u=Object.hasOwn(e,a),f=Object.hasOwn(t,a);u&&f?CT(e[a],t[a],c,r):!u&&f?r.push({op:"add",path:c,value:t[a]}):r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}}function F2(e,t){let n=t;for(let r of e)n=XG(n,r);return n}function eS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function YG(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(Dl)}function U2(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function XG(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let n=e5(e,t.path);if(n===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:r,parent:o,stack:s}=n;if(Array.isArray(o)){if(r==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=r==="-"?o.length:U2(r),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,M2(s,c)}if(eS(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw new Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};return t.op==="remove"?delete i[r]:W(i,r,t.value),M2(s,i)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function e5(e,t){let n=YG(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i<n.length-1;i++){let a=n[i];if(Array.isArray(s)){let c=U2(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(eS(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function M2(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let i=o.slice();i[s]=n,n=i}else{let i={...o};W(i,s,n),n=i}}return n}function B2(e,t){return Bs(Ll("Iso",e,t))}function N2(e,t){return Bs(Ll("Lens",e,t))}function Ll(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}var t5={kind:"Iso",get:B,set:B},tS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=n=>{let r=n;for(let o=0;o<t.length;o++)r=r[t[o]];return r},this.set=(n,r)=>{let o=nS(r),s=o,i=0;for(;i<t.length-1;i++){let a=t[i];W(s,a,nS(s[a])),s=s[a]}return W(s,t[i],n),o}}},dm=class{_tag="CheckNode";kind="Prism";checks;get;set=B;constructor(t){this.checks=t,this.get=n=>M1(t,n)}};function Ku(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;r<t.length;r++){let o=t[r],s=n[n.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?n[n.length-1]=new tS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?n[n.length-1]=new dm([...s.checks,...o.checks]):n.push(o)}return n}function n5(e,t){return Bs(Ll("Optional",e,t))}var Bl=class{node;getResult;replaceResult;constructor(t,n,r){this.node=t,this.getResult=n,this.replaceResult=r}replace(t,n){return Md(this.replaceResult(t,n),()=>n)}modify(t){return n=>Md($h(this.getResult(n),r=>this.replaceResult(t(r),n)),()=>n)}compose(t){return Bs(Ku(this.node,t.node))}key(t){return Bs(Ku(this.node,[new tS([t])]))}optionalKey(t){return Bs(Ku(this.node,Ll("Lens",n=>n[t],(n,r)=>{let o=nS(r);return n===void 0?Array.isArray(o)&&typeof t=="number"?o.splice(t,1):delete o[t]:W(o,t,n),o})))}check(...t){return Bs(Ku(this.node,[new dm(t)]))}refine(t,n){return Bs(Ku(this.node,[new dm([Qx(t,n)])]))}tag(t){let n=Ae(new ke({expected:`${JSON.stringify(t)} tag`}));return Bs(Ku(this.node,Ll("Prism",r=>r._tag===t?Ce(r):n,B)))}at(t,...n){let r=Ae(new Ct([t],new sn(void 0)));return Bs(Ku(this.node,Ll("Optional",o=>Object.hasOwn(o,t)?Ce(o[t]):r,(o,s)=>{if(Object.hasOwn(s,t)){let i=nS(s);return W(i,t,o),Ce(i)}else return r})))}pick(t){return this.compose(N2(JN(t),(n,r)=>({...r,...n})))}omit(t){return this.compose(N2(GN(t),(n,r)=>({...r,...n})))}notUndefined(){return this.refine(Kn,{expected:"a value other than `undefined`"})}forEach(t){let n=t(rS());return n5(r=>tu(this.getResult(r),o=>{let s=[];for(let i=0;i<o.length;i++){let a=n.getResult(o[i]);Kt(a)&&s.push(a.success)}return s}),(r,o)=>$h(this.getResult(o),s=>{let i=[];for(let c=0;c<s.length;c++)Kt(n.getResult(s[c]))&&i.push(c);if(r.length!==i.length)return Ae(new ke({message:`each: replacement length mismatch: ${r.length} !== ${i.length}`}));let a=s.slice();for(let c=0;c<i.length;c++){let u=i[c],f=n.replaceResult(r[c],s[u]);if(Fe(f))return Ae(new Ct([u],f.failure));a[u]=f.success}return this.replaceResult(a,o)}))}modifyAll(t){return n=>Md($h(this.getResult(n),r=>this.replaceResult(r.map(t),n)),()=>n)}},AT=class extends Bl{get;set;constructor(t,n,r){super(t,o=>Ce(n(o)),o=>Ce(r(o))),this.get=n,this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>this.set(t(this.get(n)))}},RT=class extends Bl{get;constructor(t,n,r){super(t,o=>Ce(n(o)),(o,s)=>Ce(r(o,s))),this.get=n,this.replace=r}modify(t){return n=>this.replace(t(this.get(n)),n)}},OT=class extends Bl{set;constructor(t,n,r){super(t,n,(o,s)=>Ce(r(o))),this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>Md(tu(this.getResult(n),r=>this.set(t(r))),()=>n)}};function Bs(e){let t=e[0]??t5;if(e.length>1){let n=e.reduce((r,o)=>s5(r,o.kind),"Iso");t={kind:n,get:r5(e,n),set:o5(e,n)}}switch(t.kind){case"Iso":return new AT(e,t.get,t.set);case"Lens":return new RT(e,t.get,t.set);case"Prism":return new OT(e,t.get,t.set);case"Optional":return new Bl(e,t.get,t.set)}}function nS(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 r5(e,t){return n=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if(_T(o.kind)){if(Fe(s))return s;n=s.success}else n=s}return _T(t)?Ce(n):n}}function o5(e,t){return L2(t)?n=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n}:(n,r)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){s[i]=r;let a=e[i];if(_T(a.kind)){let c=a.get(r);if(Fe(c))return c;r=c.success}else r=a.get(r)}for(let i=o-1;i>=0;i--){let a=e[i];if(L2(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(Fe(c))return c;n=c.success}}return t==="Optional"?Ce(n):n}}function _T(e){return e==="Prism"||e==="Optional"}function L2(e){return e==="Iso"||e==="Prism"}function s5(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var i5=Bs([]);function rS(){return i5}var Vu=new WeakMap,q2=e=>{if(Vu.has(e))return Vu.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var $2="~effect/data/Redacted",pm=e=>j(e,$2),bc=(e,t)=>{let n=Object.create(c5);return t?.label&&(n.label=t.label),Vu.set(n,e),n},c5={[$2]:{_A:e=>e},label:void 0,...vn,toJSON(){return this.toString()},toString(){return`<redacted${io(this.label)?":"+this.label:""}>`},[Oe](){return ce(Vu.get(this))},[_e](e){return pm(e)&&ae(Vu.get(this),Vu.get(e))}},Sc=q2;var z2=e=>un((t,n)=>e(Sc(t),Sc(n)));var mm=Gy;function An(){return(e,t,n)=>re(new pa(e.map(_p),r=>t(r.map(o=>re(o))),n))}function no(e,t){return An()([],()=>(n,r,o)=>e(n)?v(n):G(new st(r,n,o)),t)}function u5(e){return e}function f5(e){return t=>t.annotate(e)}function l5(e){return t=>MT(MT(t).annotate(e))}function d5(e){return t=>t.rebuild(bl(t.ast,e))}function p5(e){return e}var hm="~effect/SchemaError/SchemaError",Mr=class extends Mn("SchemaError"){[hm]=hm;constructor(t){let n=ni();ir(0);try{super({issue:t})}finally{ir(n)}}get message(){return KF(this.issue)}toString(){return`SchemaError(${this.message})`}};function Wl(e){return j(e,hm)&&e[hm]===hm}function H2(e){return Ft(e)?e.value:{issues:[{message:yP(e.cause)}]}}function m5(e,t){let n=dt(e),r={errors:"all",...t?.parseOptions},o=WF(t),s=i=>{let a=new ei("sync"),c=mp(jw(n(i,r),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?H2(u):new Promise(f=>{c.addObserver(l=>{f(H2(l))})})};if("~standard"in e){let i=e;return"validate"in i["~standard"]||Object.assign(i["~standard"],{validate:s}),i}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function W2(e,t){let n=GB(e);if(t==="draft-2020-12"){let r=n.schema;return Object.keys(n.definitions).length>0&&(r.$defs=n.definitions),r}else if(t==="draft-07"){let r=E2(n),o=r.schema;return Object.keys(r.definitions).length>0&&(o.definitions=r.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function h5(e){let t={input(n){return W2(e,n.target)},output(n){return W2(Pr(e),n.target)}};if("~standard"in e){let n=e;return"jsonSchema"in n["~standard"]||Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}var oL=MN,g5=FN;function wc(e,t){let n=dt(e,t);return(r,o)=>sL(n(r,o))}function sL(e){return xt(e)?DT(e):ft(e,t=>ia(()=>ec(t,n=>new Mr(n))))}var x5=wc;function iL(e,t){let n;for(let r of e.reasons){if(!$g(r)||!Wl(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function aL(e){return gx(e).then(t=>{if(Ft(t))return t.value;throw iL(t.cause,"Promise adapter can only reject schema errors")})}function cL(e){let t=ac(e);if(Ft(t))return t.value;throw iL(t.cause,"Sync adapter can only throw schema errors")}function uL(e,t){let n=UN(e,t);return(r,o)=>DT(n(r,o))}function DT(e){return Ft(e)?e:jt(ec(e.cause,t=>new Mr(t)))}var fL=uL,y5=pT,S5=DN;function lL(e,t){let n=NN(e,t);return(r,o)=>mE(n(r,o),s=>new Mr(s))}var b5=lL;function dL(e,t){let n=wc(e,t);return(r,o)=>aL(n(r,o))}var E5=dL;function aS(e,t){let n=wc(e,t);return(r,o)=>cL(n(r,o))}var xm=aS;function ym(e,t){let n=Pl(e,t);return(r,o)=>sL(n(r,o))}var cS=ym;function pL(e,t){let n=LN(e,t);return(r,o)=>DT(n(r,o))}var mL=pL,w5=hT,I5=BN;function hL(e,t){let n=jN(e,t);return(r,o)=>mE(n(r,o),s=>new Mr(s))}var v5=hL;function gL(e,t){let n=ym(e,t);return(r,o)=>aL(n(r,o))}var T5=gL;function uS(e,t){let n=ym(e,t);return(r,o)=>cL(n(r,o))}var NT=uS,re=am;function Gu(e){return j(e,mm)&&e[mm]===mm}var Ju=dr(e=>re(El(e.ast),{schema:e})),k5=dr(e=>e.schema),Pt=dr(e=>{let t=lS(e);return re(w1(e.ast),{schema:t})}),C5=dr(e=>e.schema.members[0]),A5=dr(e=>re(XI(e.ast),{schema:e})),R5=dr(e=>e.schema),Pr=dr(e=>re(yn(e.ast),{schema:e})),Kl=dr(e=>re(jn(e.ast),{schema:e})),gm="~effect/Schema/flip";function O5(e){return j(e,gm)&&e[gm]===gm}function MT(e){return O5(e)?e.schema.rebuild(ks(e.ast)):re(ks(e.ast),{[gm]:gm,schema:e})}function Rt(e){let t=re(new Qr(e),{literal:e,transform(n){return t.pipe(be(Rt(n),{decode:De(()=>n),encode:De(()=>e)}))}});return t}function xL(e){return new qx(e.map(t=>Gu(t)?t.ast:new Qr(t)))}function _5(e){return re(xL(e),{parts:e})}function M5(e){return re(xL(e).asTemplateLiteralParser(),{parts:e})}function P5(e){return re(new jx(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var Ic=re(i1),F5=re(a1),LT=re(ma),tt=re(zI),BT=re(HI),fe=re(yi),Vl=re(WI),vc=re(f1),yL=re(l1),Ti=re(d1),Jl=re(s1),U5=re(c1);function D5(e){return re(new $x(e))}function jT(e,t){return re(e,{fields:t,mapFields(n,r){let o=n(this.fields);return jT(Vx(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function oe(e){return jT(Vx(e,void 0),e)}function N5(e){return dr(t=>t.mapFields(ZN(e)))}var L5=e=>typeof e=="symbol"?e:globalThis.String(e);function B5(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=Kl(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,f=L5(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${qi(u)}`);s.add(f),W(n,u,a),c&&(r[i]=u,o[u]=i)}return oe(n).pipe(be(t,vt({decode:yT(o),encode:yT(r)})))}}function j5(e,t){return n=>{let r=Hh(n.fields,Pr),o=oe({...r,...e});return n.pipe(be(o,vt({decode:s=>{let i={...s};for(let a in e){let c=t[a],u=c(s);Te(u)&&W(i,a,u.value)}return i},encode:s=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function qT(e,t){return re(v1(e.ast,t.ast),{key:e,value:t})}function q5(e,t){return re(p1(e.ast,t.map(_p)),{schema:e,records:t})}function SL(e,t){return re(e,{elements:t,mapElements(n,r){let o=n(this.elements);return SL(JI(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ec(e){return SL(JI(e),e)}function $5(e,t){return re(m1(e.ast,t.map(_p)),{schema:e,rest:t})}var Wt=dr(e=>re(new Cs(!1,[],[e.ast]),{value:e}));var fS=dr(e=>re(new Cs(!1,[e.ast],[e.ast]),{value:e}));function z5(e){return He([e,Wt(e)]).pipe(be(Wt(Pr(e)),vt({decode:TR,encode:t=>t.length===1?t[0]:t})))}function H5(e){return Wt(e).check(ZT())}var W5=dr(e=>re(new Cs(!0,e.ast.elements,e.ast.rest),{schema:e}));function bL(e,t){return re(e,{members:t,mapMembers(n,r){let o=n(this.members);return bL(Jx(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function He(e,t){return bL(Jx(e,t?.mode??"anyOf",void 0),e)}function ka(e){let t=e.map(Rt);return re(Jx(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return He(n(this.members))},pick(n){return ka(n)},transform(n){return He(t.map((r,o)=>r.transform(n[o])))}})}var $T=dr(e=>He([e,tt])),lS=dr(e=>He([e,BT])),EL=dr(e=>He([e,tt,BT]));function wL(e){return re(new Hx(()=>e().ast))}function K5(...e){return t=>t.check(...e)}function V5(e,t){return n=>re(Si(n.ast,[Qx(e,t)]),{schema:n})}function IL(e){return t=>re(E1(t.ast,e),{schema:t,identifier:e})}function J5(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(IL(e))}function vL(e){return t=>re(S1(t.ast,new kp(e,B)),{schema:t})}function TL(e){return t=>re(b1(t.ast,new kp(B,e)),{schema:t})}function G5(e){return kL(e)}function kL(e){return t=>vL(yx(e))(t)}function Z5(e){return CL(e)}function CL(e){return t=>TL(yx(e))(t)}function be(e,t){return n=>re(ey(n.ast,e.ast,t?Nx(t):pl()),{from:n,to:e})}function Q5(e){return t=>be(Pr(t),e)(t)}function zT(e,t){return n=>t?be(n,t)(e):be(n)(e)}function Y5(e){return t=>be(t,e)(Kl(t))}function AL(e){return t=>re(I1(t.ast,e),{schema:t})}function RL(e){return ft(e,t=>ia(()=>ec(t,n=>n.issue)))}function HT(e,t){let n=t?.encodingStrategy==="omit"?lI():Ts();return r=>Ju(Kl(r)).pipe(be(r,{decode:vp(RL(e)),encode:n}))}function X5(e,t){return n=>Pr(n).pipe(HT(e,t),zT(Ju(n)))}function OL(e,t){let n=t?.encodingStrategy==="omit"?lI():Ts();return r=>Pt(Kl(r)).pipe(be(r,{decode:vp(RL(e)),encode:n}))}function eZ(e,t){return n=>Pr(n).pipe(OL(e,t),zT(Pt(n)))}function Ze(e){return Rt(e).pipe(AL(v(e)))}function tZ(e){return Ze(e).pipe(HT(v(e),{encodingStrategy:"omit"}))}function Tc(e,t){return oe({_tag:Ze(e),...t})}function _L(e){return t=>{let n={},r=[],o=new Set,s={},i=f=>l=>f.includes(l[e]);return a(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(f){let l=f.ast;if(r1(l)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(Gu))return f.members.forEach(a);let p=lc(l);if(p.length>0){let m=p.find(h=>h.key===e)?.literal;if(yh(m)){let h=typeof m=="number"?globalThis.String(m):m;if(o.has(h))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(h),r.push(m),W(n,m,f),W(s,m,oL(Pr(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let h=arguments[0];return function(g){let x=g[e];return(Object.hasOwn(h,x)?h[x]:void 0)(g)}}let f=arguments[0],l=arguments[1],p=f[e];return(Object.hasOwn(l,p)?l[p]:void 0)(f)}function u(){if(arguments.length===2){let g=arguments[0],x=arguments[1];return function(E){let b=E[e];return(Object.hasOwn(g,b)?g[b]??x:x)(E)}}let f=arguments[0],l=arguments[1],p=arguments[2],m=f[e];return(Object.hasOwn(l,m)?l[m]??p:p)(f)}}}function nZ(e){let t={},n=[];for(let c of Object.keys(e)){let u=Tc(c,e[c]);W(t,c,u),n.push(u)}let r=He(n),{guards:o,isAnyOf:s,match:i,matchOrElse:a}=_L("_tag")(r);return re(r.ast,{cases:t,isAnyOf:s,guards:o,match:i,matchOrElse:a})}function rZ(){return e=>e}function kc(e,t){return no(n=>n instanceof e,t)}function pt(){return(e,t)=>new Dt(e.ast,Nx(t))}var Tt=Zx;function oZ(e,t=void 0){return new Ou(e,t)}function pr(e,t){return _r(e,tt,({annotations:n})=>n===void 0?t:t.annotate(n))}var K2="^\\S[\\s\\S]*\\S$|^\\S$|^$";function WT(e){let t=new globalThis.RegExp(K2);return Tt(n=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[K2]}},...e})}var sZ=Re("effect/schema/isTrimmed",tt,({annotations:e})=>WT(e));function Zu(e,t){let n=e.source,r=e.flags,o=r===""?`new RegExp(${X(n)})`:`new RegExp(${X(n)}, ${X(r)})`;return Pp(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}var iZ=oe({source:fe,flags:fe}).check(Tt(e=>{let t=qh(()=>new globalThis.RegExp(e.source,e.flags));return Kt(t)&&t.success.source===e.source&&t.success.flags===e.flags})),aZ={id:"effect/schema/isPattern",payloadSchema:iZ,revive:({annotations:e,payload:t})=>Zu(new globalThis.RegExp(t.source,t.flags),e)};function ML(e){return tv({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}var cZ=Re("effect/schema/isStringFinite",tt,({annotations:e})=>ML(e));function PL(e){return nv({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}var uZ=Re("effect/schema/isStringBigInt",tt,({annotations:e})=>PL(e));function FL(e){return ov({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var fZ=Re("effect/schema/isStringSymbol",tt,({annotations:e})=>FL(e)),lZ=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 UL(e,t){let n=lZ(e);return Zu(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var dZ=Re("effect/schema/isUUID",oe({version:He([ka([1,2,3,4,5,6,7,8]),tt])}),({annotations:e,payload:t})=>UL(t.version??void 0,e)),V2=/^([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 DL(e){return Zu(V2,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:V2.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}var pZ=Re("effect/schema/isGUID",tt,({annotations:e})=>DL(e));function NL(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Zu(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}var mZ=Re("effect/schema/isULID",tt,({annotations:e})=>NL(e));function KT(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Zu(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var hZ=Re("effect/schema/isBase64",tt,({annotations:e})=>KT(e));function LL(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Zu(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}var gZ=Re("effect/schema/isBase64Url",tt,({annotations:e})=>LL(e));function BL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${Nl(e)}`);return Tt(o=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isStartsWith(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var xZ=Re("effect/schema/isStartsWith",oe({startsWith:fe}),({annotations:e,payload:t})=>BL(t.startsWith,e));function jL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${Nl(e)}$`);return Tt(o=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isEndsWith(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var yZ=Re("effect/schema/isEndsWith",oe({endsWith:fe}),({annotations:e,payload:t})=>jL(t.endsWith,e));function qL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(Nl(e));return Tt(o=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncludes",payload:{includes:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isIncludes(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var SZ=Re("effect/schema/isIncludes",oe({includes:fe}),({annotations:e,payload:t})=>qL(t.includes,e)),J2="^[^a-z]*$";function $L(e){let t=new globalThis.RegExp(J2);return Tt(n=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[J2]}},...e})}var bZ=Re("effect/schema/isUppercased",tt,({annotations:e})=>$L(e)),G2="^[^A-Z]*$";function zL(e){let t=new globalThis.RegExp(G2);return Tt(n=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[G2]}},...e})}var EZ=Re("effect/schema/isLowercased",tt,({annotations:e})=>zL(e)),Z2="^[^a-z]?.*$";function HL(e){let t=new globalThis.RegExp(Z2);return Tt(n=>n.charAt(0).toUpperCase()===n.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[Z2]}},...e})}var wZ=Re("effect/schema/isCapitalized",tt,({annotations:e})=>HL(e)),Q2="^[^A-Z]?.*$";function WL(e){let t=new globalThis.RegExp(Q2);return Tt(n=>n.charAt(0).toLowerCase()===n.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[Q2]}},...e})}var IZ=Re("effect/schema/isUncapitalized",tt,({annotations:e})=>WL(e)),js=re(ZI),KL=GI,vZ=Re("effect/schema/isFinite",tt,({annotations:e})=>KL(e));function Sm(e){let t=Wi(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...o})}function bm(e){let t=wf(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function Em(e){let t=Yc(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...o})}function wm(e){let t=Ef(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...o})}function Im(e){let t=wf(e.order),n=Wi(e.order),r=Ef(e.order),o=Yc(e.order),s=e.formatter??X;return(i,a)=>{let c=i.exclusiveMinimum?n:t,u=i.exclusiveMaximum?o:r;return Tt(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)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(i),...a})}}function VL(e){return(t,n)=>{let r=e.formatter??X;return Tt(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function ql(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${X(e)}`);return e}var JL=Sm({order:fo,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:ql(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${X(e)})`})})}),TZ=Re("effect/schema/isGreaterThan",oe({exclusiveMinimum:js}),({annotations:e,payload:t})=>JL(t.exclusiveMinimum,e)),VT=bm({order:fo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:ql(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${X(e)})`})})}),kZ=Re("effect/schema/isGreaterThanOrEqualTo",oe({minimum:js}),({annotations:e,payload:t})=>VT(t.minimum,e)),GL=Em({order:fo,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:ql(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${X(e)})`})})}),CZ=Re("effect/schema/isLessThan",oe({exclusiveMaximum:js}),({annotations:e,payload:t})=>GL(t.exclusiveMaximum,e)),ZL=wm({order:fo,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:ql(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${X(e)})`})})}),AZ=Re("effect/schema/isLessThanOrEqualTo",oe({maximum:js}),({annotations:e,payload:t})=>ZL(t.maximum,e)),dS=Im({order:fo,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:ql(e.minimum),maximum:ql(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${X(e.minimum)}, maximum: ${X(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),RZ=Re("effect/schema/isBetween",oe({minimum:js,maximum:js,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>dS(t,e)),QL=VL({remainder:tF,zero:0,annotate:e=>({expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${X(e)})`})})}),OZ=Re("effect/schema/isMultipleOf",oe({divisor:js}),({annotations:e,payload:t})=>QL(t.divisor,e));function vm(e){return Tt(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var _Z=Re("effect/schema/isInt",tt,({annotations:e})=>vm(e)),$s=Vl.check(vm()),tr=$s.check(VT(0));function MZ(e){return new Ou([vm(),dS({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function PZ(e){return new Ou([vm(),dS({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function $l(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${X(e)}`);return e.toISOString()}function zl(e){return`new Date(${X(e.getTime())})`}var YL=Sm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${zl(e)})`})})}),XL=bm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${zl(e)})`})})}),eB=Em({order:Qc,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${zl(e)})`})})}),tB=wm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${zl(e)})`})})}),nB=Im({order:Qc,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:$l(e.minimum),maximum:$l(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${zl(e.minimum)}, maximum: ${zl(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),rB=Sm({order:Ro,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${X(e)})`})})}),oB=bm({order:Ro,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${X(e)})`})})}),sB=Em({order:Ro,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${X(e)})`})})}),iB=wm({order:Ro,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${X(e)})`})})}),aB=Im({order:Ro,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${X(e.minimum)}, maximum: ${X(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),FZ=Sm({order:Ki,formatter:e=>Xs(e)}),UZ=bm({order:Ki,formatter:e=>Xs(e)}),DZ=Em({order:Ki,formatter:e=>Xs(e)}),NZ=wm({order:Ki,formatter:e=>Xs(e)}),LZ=Im({order:Ki,formatter:e=>Xs(e)});function JT(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var BZ=Re("effect/schema/isMinLength",oe({minLength:tr}),({annotations:e,payload:t})=>JT(t.minLength,e));function cB(e){return JT(1,e)}function uB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:n})=>n==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Gr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var jZ=Re("effect/schema/isMaxLength",oe({maxLength:tr}),({annotations:e,payload:t})=>uB(t.maxLength,e));function GT(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>r.length>=e&&r.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="array"?{allOf:[{minItems:e},{maxItems:t}]}:{allOf:[{minLength:e},{maxLength:t}]},toCode:()=>({runtime:`Schema.isLengthBetween(${e}, ${t})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var qZ=Re("effect/schema/isLengthBetween",oe({minimum:tr,maximum:tr}),({annotations:e,payload:t})=>GT(t.minimum,t.maximum,e));function fB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var $Z=Re("effect/schema/isMinSize",oe({minSize:tr}),({annotations:e,payload:t})=>fB(t.minSize,e));function lB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Gr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var zZ=Re("effect/schema/isMaxSize",oe({maxSize:tr}),({annotations:e,payload:t})=>lB(t.maxSize,e));function dB(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>r.size>=e&&r.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isSizeBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${e}, ${t})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var HZ=Re("effect/schema/isSizeBetween",oe({minimum:tr,maximum:tr}),({annotations:e,payload:t})=>dB(t.minimum,t.maximum,e));function pB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>Reflect.ownKeys(n).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:()=>({minProperties:e}),toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var WZ=Re("effect/schema/isMinProperties",oe({minProperties:tr}),({annotations:e,payload:t})=>pB(t.minProperties,e));function mB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>Reflect.ownKeys(n).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Gr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var KZ=Re("effect/schema/isMaxProperties",oe({maxProperties:tr}),({annotations:e,payload:t})=>mB(t.maxProperties,e));function hB(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isPropertiesLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({minProperties:e,maxProperties:t}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${e}, ${t})`}),[Gr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var VZ=Re("effect/schema/isPropertiesLengthBetween",oe({minimum:tr,maximum:tr}),({annotations:e,payload:t})=>hB(t.minimum,t.maximum,e));function gB(e,t){let n=Kl(e),r=PN(n.ast);return Tt((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let f=r(u,i);if(f!==void 0&&(c.push(new Ct([u],f)),i.errors==="first"))break}return Vn(c)?new At(s,c,o,i):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o})=>({propertyNames:o[0]}),toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Gr]:!0,...t})}var JZ=Re("effect/schema/isPropertyNames",tt,({annotations:e,schemas:t})=>gB(t[0],e));function ZT(e){return Tt(t=>Jh(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitrary:{constraint:{unique:!0}},...e})}var GZ=Re("effect/schema/isUnique",tt,({annotations:e})=>ZT(e)),ZZ=fe.check(cB()),QZ=fe.check(GT(1,1));function ki(e){let t=An()([e],([n])=>(r,o,s)=>Ys(r)?xe(r)?Es:fn(dt(n)(r.value,s),{onSuccess:L,onFailure:i=>Yn(o,"value",i,r,s)}):G(new st(o,r,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>pt()(He([oe({_tag:Rt("Some"),value:n}),oe({_tag:Rt("None")})]),vt({decode:r=>r._tag==="None"?D():L(r.value),encode:r=>Te(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(D()),i=r.oneof(s,n.arbitrary.map(L));return Qu(r,o,s,i)},toEquivalence:([n])=>pE(n),toFormatter:([n])=>rr({onNone:()=>"none()",onSome:r=>`some(${n(r)})`})});return re(t.ast,{value:e})}var YZ=_r("effect/schema/Option",tt,({annotations:e,typeParameters:t})=>{let n=ki(t[0]);return e===void 0?n:n.annotate(e)});function XZ(e){return $T(e).pipe(be(ki(Pr(e)),DU()))}function eQ(e){return lS(e).pipe(be(ki(Pr(e)),NU()))}function tQ(e,t){return EL(e).pipe(be(ki(Pr(e)),LU(t)))}function nQ(e){return Ju(e).pipe(be(ki(Pr(e)),BU()))}function rQ(e){return Pt(e).pipe(be(ki(Pr(e)),jU()))}function oQ(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return Pt($T(e)).pipe(be(ki(Pr(e)),Lx({decode:o=>o.pipe(za(Sh),L),encode:n==="omit"?eu:o=>L(qa(eu(o),()=>r))})))}function xB(e,t){let n=An()([e,t],([r,o])=>(s,i,a)=>{if(!If(s))return G(new st(i,s,a));switch(s._tag){case"Success":return fn(dT(r)(s.success,a),{onSuccess:Ce,onFailure:c=>Yn(i,"success",c,s,a)});case"Failure":return fn(dT(o)(s.failure,a),{onSuccess:Ae,onFailure:c=>Yn(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>pt()(He([oe({_tag:Rt("Success"),success:r}),oe({_tag:Rt("Failure"),failure:o})]),vt({decode:s=>s._tag==="Success"?Ce(s.success):Ae(s.failure),encode:s=>Kt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,i)=>{let a=CB(s,r.terminal?.map(u=>Ce(u)),o.terminal?.map(u=>Ae(u))),c=s.oneof(r.arbitrary.map(u=>Ce(u)),o.arbitrary.map(u=>Ae(u)));return Qu(s,i,a,c)},toEquivalence:([r,o])=>gR(r,o),toFormatter:([r,o])=>_o({onSuccess:s=>`success(${r(s)})`,onFailure:s=>`failure(${o(s)})`})});return re(n.ast,{success:e,failure:t})}var sQ=_r("effect/schema/Result",tt,({annotations:e,typeParameters:t})=>{let n=xB(t[0],t[1]);return e===void 0?n:n.annotate(e)}),iQ=no(e=>{if(!en(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>{switch(n){case"label":return typeof e[n]=="string";case"disallowJsonEncode":return e[n]===!0;default:return!1}})}),aQ=He([tt,iQ]);function QT(e,t){let n=typeof t?.label=="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?dt(Rt(n)):void 0,i=An()([e],([a])=>(c,u,f)=>{if(pm(c)){let l=s!==void 0?vu(s(c.label,f),p=>new Ct(["label"],p)):H;return Bn(l,()=>fn(dt(a)(Sc(c),f),{onSuccess:()=>c,onFailure:()=>new At(u,[new Ct(["value"],new ke(void 0,c,f))],c,f)}))}return G(new st(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${X(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>pt()(a,{decode:De(c=>bc(c,{label:n})),encode:r?uI(c=>"Cannot serialize Redacted"+(Te(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):De(Sc)}),toArbitrary:([a])=>()=>({arbitrary:a.arbitrary.map(c=>bc(c,{label:n})),terminal:a.terminal?.map(c=>bc(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([a])=>z2(a)});return re(i.ast,{value:e})}var cQ=_r("effect/schema/Redacted",aQ,({annotations:e,payload:t,typeParameters:n})=>{let r=QT(n[0],t??void 0);return e===void 0?r:r.annotate(e)});function uQ(e,t){return be(QT(Pr(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:De(n=>bc(n,{label:t?.label})),encode:t?.disallowEncode?uI(n=>"Cannot encode Redacted"+(Te(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):De(Sc)})(e)}function sS(e,t){let n=An()([e,t],([r,o])=>(s,i,a)=>{if(!zf(s))return G(new st(i,s,a));switch(s._tag){case"Fail":return fn(dt(r)(s.error,a),{onSuccess:Hf,onFailure:c=>Yn(i,"error",c,s,a)});case"Die":return fn(dt(o)(s.defect,a),{onSuccess:Wf,onFailure:c=>Yn(i,"defect",c,s,a)});case"Interrupt":return v(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>pt()(He([oe({_tag:Rt("Fail"),error:r}),oe({_tag:Rt("Die"),defect:o}),oe({_tag:Rt("Interrupt"),fiberId:lS(js)})]),vt({decode:s=>{switch(s._tag){case"Fail":return Hf(s.error);case"Die":return Wf(s.defect);case"Interrupt":return lu(s.fiberId)}},encode:B})),toArbitrary:([r,o])=>yB(r,o),toEquivalence:([r,o])=>SB(r,o),toFormatter:([r,o])=>bB(r,o)});return re(n.ast,{error:e,defect:t})}var fQ=_r("effect/schema/CauseReason",tt,({annotations:e,typeParameters:t})=>{let n=sS(t[0],t[1]);return e===void 0?n:n.annotate(e)});function yB(e,t){return(n,r)=>{let o=n.constant(lu()),s=n.oneof(o,n.integer({min:1}).map(lu),e.arbitrary.map(i=>Hf(i)),t.arbitrary.map(i=>Wf(i)));return Qu(n,r,o,s)}}function SB(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function bB(e,t){return n=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function Hl(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(sS(r,o));return(i,a,c)=>$f(i)?fn(dt(s)(i.reasons,c),{onSuccess:Xa,onFailure:u=>Yn(a,"failures",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>pt()(Wt(sS(r,o)),vt({decode:Xa,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>EB(r,o),toEquivalence:([r,o])=>wB(r,o),toFormatter:([r,o])=>IB(r,o)});return re(n.ast,{error:e,defect:t})}var lQ=_r("effect/schema/Cause",tt,({annotations:e,typeParameters:t})=>{let n=Hl(t[0],t[1]);return e===void 0?n:n.annotate(e)});function EB(e,t){return(n,r)=>{let o=yB(e,t)(n,r),s=n.constant(dP),i=n.array(o.arbitrary).map(Xa);return Qu(n,r,s,i)}}function wB(e,t){let n=vh(SB(e,t));return(r,o)=>n(r.reasons,o.reasons)}function IB(e,t){let n=bB(e,t);return r=>`Cause([${r.reasons.map(n).join(", ")}])`}var dQ=no(e=>{if(!en(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),pQ=He([tt,dQ]),vB=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),TB=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},Y2=[];function kB(e){let t=vB(e),n=Y2[t];if(n!==void 0)return n;let r=TB(t),o=kc(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${X(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>pt()(s9,FU(r)),toArbitrary:()=>s=>s.string().map(i=>new globalThis.Error(i))});return Y2[t]=o,o}var mQ=_r("effect/schema/Error",pQ,({annotations:e,payload:t})=>{let n=kB(t??void 0);return e===void 0?n:n.annotate(e)}),X2=[];function ln(e){let t=vB(e),n=X2[t];if(n!==void 0)return n;let r=Am.pipe(be(LT,UU(TB(t))));return X2[t]=r,r}function pS(e,t,n){let r=An()([e,t,n],([o,s,i])=>{let a=Hl(s,i);return(c,u,f)=>{if(!gs(c))return G(new st(u,c,f));switch(c._tag){case"Success":return fn(dt(o)(c.value,f),{onSuccess:kn,onFailure:l=>Yn(u,"value",l,c,f)});case"Failure":return fn(dt(a)(c.cause,f),{onSuccess:jt,onFailure:l=>Yn(u,"cause",l,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])=>pt()(He([oe({_tag:Rt("Success"),value:o}),oe({_tag:Rt("Failure"),cause:Hl(s,i)})]),vt({decode:a=>a._tag==="Success"?kn(a.value):jt(a.cause),encode:a=>Ft(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}})),toArbitrary:([o,s,i])=>(a,c)=>{let u=EB(s,i)(a,c),f=CB(a,o.terminal?.map(p=>kn(p)),u.terminal?.map(p=>jt(p))),l=a.oneof(o.arbitrary.map(p=>kn(p)),u.arbitrary.map(p=>jt(p)));return Qu(a,c,f,l)},toEquivalence:([o,s,i])=>{let a=wB(s,i);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return a(c.cause,u.cause)}}},toFormatter:([o,s,i])=>{let a=IB(s,i);return c=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${a(c.cause)})`}}}});return re(r.ast,{value:e,error:t,defect:n})}var hQ=_r("effect/schema/Exit",tt,({annotations:e,typeParameters:t})=>{let n=pS(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});function CB(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function Qu(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function eL(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function mS(e,t,n,r,o,s){let i=t.constraint,a=i===void 0||i.minLength===void 0&&i.maxLength===void 0?void 0:{...i.minLength!==void 0?{minLength:i.minLength}:{},...i.maxLength!==void 0?{maxLength:i.maxLength}:{}};if(a?.minLength!==void 0&&a.maxLength!==void 0&&a.minLength>a.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=a?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:eL(e,r,{...a,maxLength:c},s),f=Qu(e,t,u,eL(e,n,a,s));return{arbitrary:f.arbitrary.map(o),terminal:f.terminal?.map(o)}}function AB(e,t,n,r,o){return mS(e,t,e.tuple(n.arbitrary,r.arbitrary),n.terminal===void 0||r.terminal===void 0?void 0:e.tuple(n.terminal,r.terminal),o,([s],[i])=>ae(s,i))}function RB(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(Ec([r,o]));return(i,a,c)=>i instanceof globalThis.Map?fn(dt(s)([...i],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Yn(a,"entries",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>pt()(Wt(Ec([r,o])),vt({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]})),toArbitrary:([r,o])=>(s,i)=>AB(s,i,r,o,a=>new globalThis.Map(a)),toEquivalence:([r,o])=>wh(r,o),toFormatter:([r,o])=>s=>{let i=s.size;if(i===0)return"ReadonlyMap(0) {}";let a=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${i}) { ${a.join(", ")} }`}});return re(n.ast,{key:e,value:t})}var gQ=_r("effect/schema/ReadonlyMap",tt,({annotations:e,typeParameters:t})=>{let n=RB(t[0],t[1]);return e===void 0?n:n.annotate(e)});function tL(e,t,n){return oe({type:Rt(e),nodes:Wt(oe({index:tr,data:t})),edges:Wt(oe({index:tr,source:tr,target:tr,data:n}))})}function nL(e,t){let n=-1,r=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=n)return G(new Ct(["nodes",o,"index"],new ke({expected:"a strictly increasing node index"},s,t)));n=s,r.add(s)}n=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=n)return G(new Ct(["edges",o,"index"],new ke({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return G(new Ct(["edges",o,"source"],new ke({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return G(new Ct(["edges",o,"target"],new ke({expected:"an encoded node index"},s.target,t)))}return v(Xp(e))}function xQ(e,t,n){return!Xv(e)||e.mutable||e.type!==t?G(new ke({expected:`an immutable ${t} Graph`},e,n)):v(Yp(e))}function yQ(e,t){return(n,r)=>{let o=Yp(n),s=Yp(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i<o.nodes.length;i++)if(o.nodes[i].index!==s.nodes[i].index||!e(o.nodes[i].data,s.nodes[i].data))return!1;for(let i=0;i<o.edges.length;i++){let a=o.edges[i],c=s.edges[i],u=o.type==="directed"?a.source===c.source&&a.target===c.target:a.source===c.source&&a.target===c.target||a.source===c.target&&a.target===c.source;if(a.index!==c.index||!u||!t(a.data,c.data))return!1}return!0}}function SQ(e,t,n){return(r,o)=>{let s=Xp({type:e,nodes:[],edges:[]}),i=r.constant(s),a=r.array(t.arbitrary).chain(c=>{let u=c.map((l,p)=>({index:p,data:l}));if(u.length===0)return i;let f=r.integer({min:0,max:u.length-1});return r.array(r.tuple(f,f,n.arbitrary)).map(l=>Xp({type:e,nodes:u,edges:l.map(([p,m,h],g)=>({index:g,source:p,target:m,data:h}))}))});return Qu(r,o,i,a)}}function OB(e,t,n){let r=An()([t,n],([o,s])=>{let i=tL(e,o,s);return(a,c,u)=>!Xv(a)||a.mutable||a.type!==e?G(new st(c,a,u)):R(dt(i)(Yp(a),u),f=>nL(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${X(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${X(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>pt()(tL(e,o,s),Ar({decode:nL,encode:(i,a)=>xQ(i,e,a)})),toArbitrary:([o,s])=>SQ(e,o,s),toEquivalence:([o,s])=>yQ(o,s),toFormatter:()=>globalThis.String});return re(r.ast,{type:e,node:t,edge:n})}var bQ=_r("effect/schema/Graph",ka(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=OB(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});function _B(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(Ec([r,o]));return(i,a,c)=>jy(i)?fn(dt(s)($y(i),c),{onSuccess:qy,onFailure:u=>Yn(a,"entries",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>pt()(Wt(Ec([r,o])),vt({decode:qy,encode:$y})),toArbitrary:([r,o])=>(s,i)=>AB(s,i,r,o,qy),toEquivalence:([r,o])=>wh(r,o),toFormatter:([r,o])=>s=>{let i=TN(s);if(i===0)return"HashMap(0) {}";let a=$y(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${i}) { ${a.join(", ")} }`}});return re(n.ast,{key:e,value:t})}var EQ=_r("effect/schema/HashMap",tt,({annotations:e,typeParameters:t})=>{let n=_B(t[0],t[1]);return e===void 0?n:n.annotate(e)});function MB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>o instanceof globalThis.Set?fn(dt(r)([...o],i),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>Yn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>pt()(Wt(n),vt({decode:r=>new globalThis.Set(r),encode:r=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,s=>new globalThis.Set(s),ae),toEquivalence:([n])=>Ih(n),toFormatter:([n])=>r=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map(i=>`${n(i)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var wQ=_r("effect/schema/ReadonlySet",tt,({annotations:e,typeParameters:t})=>{let n=MB(t[0]);return e===void 0?n:n.annotate(e)});function PB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>Wy(o)?fn(dt(r)(ht(o),i),{onSuccess:Hy,onFailure:a=>Yn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>pt()(Wt(n),vt({decode:Hy,encode:ht})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,Hy,ae),toEquivalence:([n])=>Ih(n),toFormatter:([n])=>r=>{let o=RN(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map(i=>`${n(i)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var IQ=_r("effect/schema/HashSet",tt,({annotations:e,typeParameters:t})=>{let n=PB(t[0]);return e===void 0?n:n.annotate(e)});function FB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>Il(o)?fn(dt(r)(ht(o),i),{onSuccess:sy,onFailure:a=>Yn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>pt()(Wt(n),vt({decode:sy,encode:ht})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,sy),toEquivalence:([n])=>uv(n),toFormatter:([n])=>r=>{let o=$1(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map(i=>`${n(i)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var vQ=_r("effect/schema/Chunk",tt,({annotations:e,typeParameters:t})=>{let n=FB(t[0]);return e===void 0?n:n.annotate(e)}),UB=kc(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>pt()(oe({source:fe,flags:fe}),Ar({decode:(e,t)=>Bo({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ke({expected:"valid RegExp source and flags"},e,t)}),encode:e=>v({source:e.source,flags:e.flags})})),toArbitrary:()=>e=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map(t=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),TQ=pr("effect/schema/RegExp",UB),DB=fe.annotate({expected:"a string that will be decoded as a URL"}),YT=kc(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>pt()(DB,gI),toArbitrary:()=>e=>e.webUrl().map(t=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),kQ=pr("effect/schema/URL",YT),CQ=DB.pipe(be(YT,gI));function XT(e,t,n){let r={...t};if(e?.minimum!==void 0){let o=n===void 0?e.minimum:n(e.minimum),s=e.exclusiveMinimum?new globalThis.Date(o.getTime()+1):o;(r.min===void 0||s.getTime()>r.min.getTime())&&(r.min=s)}if(e?.maximum!==void 0){let o=n===void 0?e.maximum:n(e.maximum),s=e.exclusiveMaximum?new globalThis.Date(o.getTime()-1):o;(r.max===void 0||s.getTime()<r.max.getTime())&&(r.max=s)}return r}var NB=fe.annotate({expected:"a string that will be decoded as a Date"}),qs=no(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:()=>pt()(NB,hI),toArbitrary:()=>(e,t)=>e.date(XT(t?.constraint?.ordered?.order===Qc?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),AQ=pr("effect/schema/Date",qs),RQ=NB.pipe(be(qs,hI)),OQ=$s.pipe(be(qs,CU)),Tm=no(nu,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>pt()(He([oe({_tag:Rt("Infinity")}),oe({_tag:Rt("NegativeInfinity")}),oe({_tag:Rt("Nanos"),value:Ti}),oe({_tag:Rt("Millis"),value:$s})]),vt({decode:e=>{switch(e._tag){case"Infinity":return po;case"NegativeInfinity":return Zi;case"Nanos":return Lr(e.value);case"Millis":return us(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}})),toArbitrary:()=>e=>e.oneof(e.constant(po),e.constant(Zi),e.bigInt().map(Lr),e.maxSafeInteger().map(us)),toFormatter:()=>globalThis.String,toEquivalence:()=>PE}),_Q=pr("effect/schema/Duration",Tm),MQ=fe.annotate({expected:"a string that will be decoded as a Duration"}),PQ=MQ.pipe(be(Tm,AU)),FQ=Ti.pipe(be(Tm,RU)),UQ=Vl.pipe(be(Tm,OU)),LB=fe.annotate({expected:"a string that will be decoded as a BigDecimal"}),BB=20,jB="Unable to derive an arbitrary for the ordered BigDecimal constraints";function iS(e,t){return Ha(e,t).value}function DQ(e,t,n){return n?iS(IE(e,t),t)+globalThis.BigInt(1):iS(wE(e,t),t)}function NQ(e,t,n){return n?iS(wE(e,t),t)-globalThis.BigInt(1):iS(IE(e,t),t)}function LQ(e){return Math.max(BB,e.minimum?.scale??0,e.maximum?.scale??0,e.exclusiveMinimum&&e.minimum!==void 0?e.minimum.scale+1:0,e.exclusiveMaximum&&e.maximum!==void 0?e.maximum.scale+1:0)}function PT(e,t){let n={};if(e.minimum!==void 0&&(n.min=DQ(e.minimum,t,e.exclusiveMinimum===!0)),e.maximum!==void 0&&(n.max=NQ(e.maximum,t,e.exclusiveMaximum===!0)),!(n.min!==void 0&&n.max!==void 0&&n.min>n.max))return n}function BQ(e){let t=LQ(e);if(PT(e,t)===void 0)throw new globalThis.Error(jB);let n=0,r=t;for(;n<r;){let o=n+Math.floor((r-n)/2);PT(e,o)===void 0?n=o+1:r=o}return{min:n,max:t}}var ek=no(Wa,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>pt()(LB,xI),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===Ki?t.constraint.ordered:void 0;return n===void 0?e.tuple(e.bigInt(),e.integer({min:0,max:BB})).map(([r,o])=>sr(r,o)):e.integer(BQ(n)).chain(r=>{let o=PT(n,r);if(o===void 0)throw new globalThis.Error(jB);return e.bigInt(o).map(s=>sr(s,r))})},toFormatter:()=>e=>Xs(e),toEquivalence:()=>bE}),jQ=pr("effect/schema/BigDecimal",ek),qQ=LB.pipe(be(ek,xI)),$Q=fe.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function qB(e,t){return $Q.pipe(be(e,WU(t)))}var zQ=qB(LT),tk=kc(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>pt()(oe({data:fe.check(KT()),type:fe,name:fe,lastModified:$s}),Ar({decode:(e,t)=>_o(Cf(e.data),{onFailure:()=>G(new ke({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{let r=new globalThis.Uint8Array(n);return v(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>bs({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ng(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ke({expected:"a readable File"},e,t)})}))}),HQ=pr("effect/schema/File",tk),nk=kc(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>pt()(Wt(Ec([fe,He([oe({_tag:Ze("String"),value:fe}),oe({_tag:Ze("File"),value:tk})])])),Ar({decode:e=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return v(t)},encode:e=>v(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))}),WQ=pr("effect/schema/FormData",nk);function KQ(e){return nk.pipe(be(e,KU))}var rk=kc(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>pt()(fe.annotate({expected:"a query string that will be decoded as URLSearchParams"}),vt({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))}),VQ=pr("effect/schema/URLSearchParams",rk);function JQ(e){return rk.pipe(be(e,VU))}var GQ=fe.annotate({expected:"a string that will be decoded as a number"}).pipe(be(Vl,ml)),ZQ=fe.annotate({expected:"a string that will be decoded as a finite number"}).pipe(be(js,ml)),QQ=re(rv).pipe(be(Ti,Bx)),$B=fe.check(WT()),YQ=fe.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(be($B,kU())),XQ=fe.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(be(fe,qU)),e7=fe.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(be(fe,$U)),t7=fe.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(be(fe,zU)),n7=fe.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(be(fe,HU)),FT=He([js,yL,fe]),r7=oe({issues:Wt(oe({message:fe,path:Pt(Wt(He([FT,oe({key:FT})])))}))}),o7=ka([0,1]).pipe(be(vc,vt({decode:e=>e===1,encode:e=>e?1:0}))),zB=fe.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Go=kc(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>pt()(zB,yI),toArbitrary:()=>e=>e.uint8Array()}),s7=pr("effect/schema/Uint8Array",Go),i7=zB.pipe(be(Go,yI)),a7=fe.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(be(Go,{decode:mU(),encode:Fx()})),c7=fe.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(be(Go,{decode:gU(),encode:Ux()})),km=no(e=>Au(e)&&QF(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>pt()(fe,EI),toArbitrary:()=>(e,t)=>e.date(XT(t?.constraint?.ordered?.order===aI?t.constraint.ordered:void 0,{noInvalidDate:!0},Ox)).map(n=>XF(n)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>iI}),u7=pr("effect/schema/DateTimeUtc",km),f7=qs.pipe(be(km,{decode:mI(),encode:De(Ox)})),l7=fe.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(be(km,EI)),d7=$s.pipe(be(km,{decode:mI(),encode:De(oU)})),HB=no(GF,{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:()=>pt()($s,JU),toArbitrary:()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>wp(t)),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),p7=pr("effect/schema/TimeZoneOffset",HB),WB=fe.annotate({expected:"an IANA time zone identifier"}),ok=no(ZF,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecJson:()=>pt()(WB,SI),toArbitrary:()=>e=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(cI)),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>e.id===t.id}),m7=pr("effect/schema/TimeZoneNamed",ok),h7=WB.pipe(be(ok,SI)),KB=fe.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),sk=no(JF,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecJson:()=>pt()(KB,bI),toArbitrary:()=>e=>e.oneof(e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>wp(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(cI))),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>uc(e)===uc(t)}),g7=pr("effect/schema/TimeZone",sk),x7=KB.pipe(be(sk,bI)),VB=fe.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),ik=no(e=>Au(e)&&YF(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecJson:()=>pt()(VB,wI),toArbitrary:()=>(e,t)=>e.tuple(e.date(XT(t?.constraint?.ordered?.order===aI?t.constraint.ordered:void 0,{max:new globalThis.Date(864e13-840*60*1e3),min:new globalThis.Date(-864e13+840*60*1e3),noInvalidDate:!0},Ox)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>Cx(n,{timeZone:r})),toFormatter:()=>e=>_x(e),toEquivalence:()=>iI}),y7=pr("effect/schema/DateTimeZoned",ik),S7=VB.pipe(be(ik,wI)),b7=globalThis.Symbol.for("immer-draftable"),UT={};function ak(e,t,n,r,o){let s=w7(n,t,r),i=JB(t),a=class extends e{constructor(...[c,u]){let l=u?.["~payload"],p=l?.token===UT?l.value:n.make(c??{},u);super(p,{...u,disableChecks:!0,"~payload":{token:UT,value:p}})}static[mm]=mm;get[i](){return i}static[b7]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return ie(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return Vy(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Ho(this.ast,c))}static annotateKey(c){return this.rebuild(bl(this.ast,c))}static check(...c){return this.rebuild(Si(this.ast,c))}static extend(c){return(u,f)=>{let l=Cm(u)?u:oe(u),p={...n.fields,...l.fields},m=Vx(p,n.ast.checks,{identifier:c});return ak(this,c,jT(Si(m,l.ast.checks),p),f,o)}}static mapFields(c,u){return n.mapFields(c,u)}};return o!==void 0&&Object.assign(a.prototype,o(t)),a}function E7(e){return new et(De(t=>new e(t,{"~payload":{token:UT,value:t}})),Ts())}function JB(e){return`~effect/Schema/Class/${e}`}function w7(e,t,n){let r;return o=>{if(r!==void 0)return r;let s=JB(t),i=u=>u instanceof o||j(u,s),a=E7(o),c=re(new pa([e.ast],()=>(u,f,l)=>i(u)?v(u):G(new st(f,u,l)),{identifier:t,[bx]:([u])=>({isConstructed:i,link:new Dt(u,a)}),toCodec:([u])=>new Dt(u.ast,a),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map(f=>new o(f)),terminal:u.terminal?.map(f=>new o(f))}),toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[xp]:lc(e.ast),...n}));return r=be(c,a)(e)}}function Cm(e){return Gu(e)}var hS=e=>(t,n)=>{let r=Cm(t)?t:oe(t);return ak(pO,e,r,n,o=>({toString(){return`${o}(${X({...this})})`}}))},I7=e=>(t,n,r)=>{let o=Cm(n)?n.mapFields(s=>({_tag:Ze(t),...s}),{unsafePreserveChecks:!0}):Tc(t,n);return hS(e??t)(o,r)},$n=e=>(t,n)=>{let r=Cm(t)?t:oe(t);return ak(kd,e,r,n,s=>({name:s}))},ck=e=>(t,n,r)=>{let o=Cm(n)?n.mapFields(s=>({_tag:Ze(t),...s}),{unsafePreserveChecks:!0}):Tc(t,n);return $n(e??t)(o,r)};function v7(e){let t=h2(e.ast);return n=>t(n,{})}function T7(e){return t=>t.annotate({toFormatter:e})}function k7(e,t){return n(e.ast);function n(o){let s=gi(o)?.toFormatter;if(typeof s=="function")return s(pc(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let i=t.onBefore(o,n);if(i!==void 0)return i}return r(o)}function r(o){switch(o._tag){default:return X;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),i=o.rest.map(n);return a=>{let c=[],u=0;for(;u<s.length;u++)if(a.length<u+1){if(an(o.elements[u]))continue}else c.push(s[u](a[u]));if(i.length>0){let[f,...l]=i;for(;u<a.length-l.length;u++)c.push(f(a[u]));for(let p=0;p<l.length;p++)c.push(l[p](a[u+p]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map(a=>n(a.type)),i=o.indexSignatures.map(a=>n(a.type));return o.propertySignatures.length===0&&o.indexSignatures.length===0?X:a=>{let c=[],u=new Set;for(let f=0;f<s.length;f++){let l=o.propertySignatures[f],p=l.name;u.add(p),!(an(l.type)&&!Object.hasOwn(a,p))&&c.push(`${qi(p)}: ${s[f](a[p])}`)}for(let f=0;f<i.length;f++){let l=ha(a,o.indexSignatures[f].parameter);for(let p of l)u.has(p)||(u.add(p),c.push(`${qi(p)}: ${i[f](a[p])}`))}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=yn(o).types,i=c=>Mp(c,s),a=new Map(s.map((c,u)=>[c,[sm(c),n(o.types[u])]]));return c=>{let u=i(c);for(let f=0;f<u.length;f++){let[l,p]=a.get(u[f]);if(l(c))return p(c)}return X(c)}}case"Suspend":{let s=_u(()=>n(o.thunk()));return i=>s()(i)}}}}function C7(e){return t=>t.annotate({toEquivalence:e})}function A7(e){return g2(e.ast)}function R7(e,t){return kT(e.ast,t)}function GB(e,t){let n=kT(gS(e.ast),t);return _2(n,t)}function Cc(e){return re(gS(e.ast),{schema:e})}var gS=ga(e=>{let t=_7(e,gS),n=e.context;return t===e||n===void 0?t:Sl(t,uk(n))});function uk(e){return e.constructorDefault===void 0?e:new Yr(e.isOptional,e.isMutable,void 0,e.annotations)}function ZB(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function QB(e){return t=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(jn(t[s]),s);let r=[...t].sort((s,i)=>{s=jn(s),i=jn(i);let a=e(s),c=e(i);return a!==c?a-c:n.get(s)-n.get(i)});return r.some((s,i)=>s!==t[i])?r:t}}var O7=QB(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function _7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!cn(n))return lt(e,[sv]);let r=e.typeParameters.map(s=>am(jn(s))),o=n(r);return o===void 0?e:lt(e,[mc(o,t)])}case"Unknown":return lt(e,[sv]);case"ObjectKeyword":return lt(e,[D1]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return ZB(e),e.recur(t,ny);case"Union":{let n=O7(e.types);return n!==e.types?new Rr(n,e.mode,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 YB(e){return re(XB(yn(e.ast)))}var XB=wn(e=>{let t=M7(e,XB);return t!==e&&e.context!==void 0?Sl(t,uk(e.context)):t});function M7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(cn(n)){let r=n(e.typeParameters.map(o=>am(o)));return lt(e,[mc(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function ej(e){return re(rj(e.ast),{schema:e})}function P7(e){return re(oj(e.ast))}function F7(e,t){let n=ul(e.ast)??eI(e.ast),r=cS(ej(e));return o=>r(o).pipe(Y(s=>U7(s,{rootName:n,...t})))}function U7(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return f(n,e,0),c.join(o?`
31
- `:"");function u(l,p){c.push(o?s.repeat(l)+p:p)}function f(l,p,m,h){let{attrs:g,safe:x}=jl.tagInfo(l,h);if(p===void 0)u(m,`<${x}${g}/>`);else if(typeof p=="string")u(m,`<${x}${g}>${jl.escapeText(p)}</${x}>`);else if(typeof p!="object"||p===null)u(m,`<${x}${g}>${jl.escapeText(X(p))}</${x}>`);else{if(a.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});a.add(p);try{if(globalThis.globalThis.Array.isArray(p)){if(p.length===0){u(m,`<${x}${g}/>`);return}u(m,`<${x}${g}>`);for(let y of p)f(r,y,m+1);u(m,`</${x}>`);return}let E=p,b=Object.keys(E);if(i&&b.sort(),b.length===0){u(m,`<${x}${g}/>`);return}u(m,`<${x}${g}>`);for(let y of b)f(jl.parseTagName(y).safe,E[y],m+1,y);u(m,`</${x}>`)}finally{a.delete(p)}}}}var jl={escapeText(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},escapeAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},parseTagName(e){let t=e,n=e;return/^[A-Za-z_]/.test(n)||(n="_"+n),n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n)&&(n="_"+n),{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=jl.parseTagName(e),s=n||t&&t!==e?` data-name="${jl.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},D7=QB(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function N7(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map(u=>re(t(jn(u)))),o=e.annotations?.toCodecStringTree;if(cn(o)){let u=o(r);return u===void 0?e:lt(e,[mc(u,t)])}let s=e.annotations?.toCodecJson,i=cn(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(cn(a)?a(r):void 0);return c===void 0?n(e):lt(e,[mc(c,t)])}case"Null":return lt(e,[L7]);case"Boolean":return lt(e,[B7]);case"Unknown":case"ObjectKeyword":return lt(e,[iv]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return ZB(e),e.recur(t,ny);case"Union":{let r=D7(e.types);return r!==e.types?new Rr(r,e.mode,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 L7=new Dt(new Qr("null"),new et(De(()=>null),De(()=>"null"))),B7=new Dt(new Rr([new Qr("true"),new Qr("false")],"anyOf"),new et(De(e=>e==="true"),Ru())),tj=new et(De(e=>typeof e=="string"?[e]:e),Ts()),nj=e=>e.transformation===tj,rj=ga(e=>{let t=N7(e,rj,n=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});return t!==e&&e.context!==void 0?Sl(t,uk(e.context)):t},{stopAt:nj}),rL=e=>an(e)?El(ma):ma,oj=ga(e=>{let t=j7(e);if($I(t)){let n=ey(new Rr([new Cs(t.isMutable,t.elements.map(rL),t.rest.map(rL)),yi],"anyOf"),t,tj);return an(e)?El(n):n}return t},{stopAt:nj});function j7(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(oj):e}var q7=Re("effect/schema/isGreaterThanDate",oe({exclusiveMinimum:qs}),({annotations:e,payload:t})=>YL(t.exclusiveMinimum,e)),$7=Re("effect/schema/isGreaterThanOrEqualToDate",oe({minimum:qs}),({annotations:e,payload:t})=>XL(t.minimum,e)),z7=Re("effect/schema/isLessThanDate",oe({exclusiveMaximum:qs}),({annotations:e,payload:t})=>eB(t.exclusiveMaximum,e)),H7=Re("effect/schema/isLessThanOrEqualToDate",oe({maximum:qs}),({annotations:e,payload:t})=>tB(t.maximum,e)),W7=Re("effect/schema/isBetweenDate",oe({minimum:qs,maximum:qs,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>nB(t,e)),K7=Re("effect/schema/isGreaterThanBigInt",oe({exclusiveMinimum:Ti}),({annotations:e,payload:t})=>rB(t.exclusiveMinimum,e)),V7=Re("effect/schema/isGreaterThanOrEqualToBigInt",oe({minimum:Ti}),({annotations:e,payload:t})=>oB(t.minimum,e)),J7=Re("effect/schema/isLessThanBigInt",oe({exclusiveMaximum:Ti}),({annotations:e,payload:t})=>sB(t.exclusiveMaximum,e)),G7=Re("effect/schema/isLessThanOrEqualToBigInt",oe({maximum:Ti}),({annotations:e,payload:t})=>iB(t.maximum,e)),Z7=Re("effect/schema/isBetweenBigInt",oe({minimum:Ti,maximum:Ti,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>aB(t,e));function Q7(e){let t=YB(e);return B2(gT(t),mT(t))}function Y7(e){return rS()}function X7(e){return rS()}function e9(e,t){return n=>re(Ho(n.ast,{toCodecIso:()=>new Dt(e.ast,Nx(t))}),{schema:n})}function t9(e){let t=Cc(e),n=gT(t),r=mT(t);return{empty:[],diff:(o,s)=>P2(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=F2(s,i);return Object.is(a,i)?o:r(a)}}}function n9(e){let t=wL(()=>n),n=He([e,Wt(t),qT(fe,t)]);return n}var Am=re(Ho(yl,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),r9=qT(fe,Am),o9=pr("effect/schema/Json",Am),s9=oe({message:fe,name:Ju(fe),stack:Ju(fe),cause:Ju(Am)}),sj=re(Ho(U1,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),i9=pr("effect/schema/MutableJson",sj);function a9(e){return gi(e.ast)}function c9(e){return e.ast.context?.annotations}var u9="~effect/Stream",f9={_R:B,_E:B,_A:B},l9={[u9]:f9,pipe(){return ie(this,arguments)}},ij=e=>{let t=Object.create(l9);return t.channel=e,t};var p9="~effect/Sink";var m9={_A:B,_In:B,_L:B,_E:B,_R:B},h9={[p9]:m9,pipe(){return ie(this,arguments)}};var g9=e=>{let t=Object.create(h9);return t.transform=e,t},aj=e=>Ge((t,n)=>v(R(e.transform(t,n),me)));var cj=e=>g9(t=>{let n=[];if(e<=0)return v([n]);let r;return t.pipe(R(o=>{if(n.length+o.length<=e)return n.push(...o),n.length===e?me():H;for(let s=0;s<o.length;s++)if(n.push(o[s]),n.length===e)return s+1<o.length&&(r=o.slice(s+1)),me();return H}),Ht({disableYield:!0}),qt(()=>v([n,r])))});var nr={};ns(nr,{DefaultChunkSize:()=>bj,Do:()=>VX,TypeId:()=>Sj,accumulate:()=>PX,aggregate:()=>TX,aggregateWithin:()=>vk,bind:()=>GX,bindEffect:()=>ZX,bindTo:()=>QX,broadcast:()=>Kj,broadcastN:()=>kX,buffer:()=>UY,bufferArray:()=>DY,callback:()=>yS,catch:()=>_m,catchCause:()=>_j,catchCauseFilter:()=>zY,catchCauseIf:()=>$Y,catchFilter:()=>Fj,catchIf:()=>Pj,catchReason:()=>jY,catchReasons:()=>qY,catchTag:()=>LY,catchTags:()=>BY,changes:()=>Vj,changesWith:()=>Jj,changesWithEffect:()=>FX,chunks:()=>qj,collect:()=>MX,combine:()=>cX,combineArray:()=>uX,concat:()=>Rm,cross:()=>hY,crossWith:()=>Rj,debounce:()=>hX,decodeText:()=>UX,die:()=>_9,drain:()=>tY,drainFork:()=>nY,drop:()=>Ik,dropRight:()=>sX,dropUntil:()=>nX,dropUntilEffect:()=>rX,dropWhile:()=>Bj,dropWhileEffect:()=>jj,dropWhileFilter:()=>oX,empty:()=>Ai,encodeText:()=>DX,ensuring:()=>Mm,fail:()=>Yu,failCause:()=>Ij,failCauseSync:()=>M9,failSync:()=>O9,filter:()=>Ek,filterEffect:()=>RY,filterMap:()=>AY,filterMapEffect:()=>OY,flatMap:()=>Zl,flatten:()=>xk,flattenArray:()=>eY,flattenEffect:()=>J9,flattenIterable:()=>cY,flattenTake:()=>uY,forever:()=>aY,fromArray:()=>Om,fromArrayEffect:()=>D9,fromArrays:()=>N9,fromAsyncIterable:()=>L9,fromChannel:()=>q,fromEffect:()=>xS,fromEffectDrain:()=>Ej,fromEffectRepeat:()=>wj,fromEffectSchedule:()=>k9,fromEventListener:()=>q9,fromIterable:()=>Xu,fromIterableEffect:()=>F9,fromIterableEffectRepeat:()=>U9,fromIteratorSucceed:()=>P9,fromPubSub:()=>hk,fromPubSubTake:()=>vj,fromPull:()=>zs,fromQueue:()=>Ci,fromReadableStream:()=>gk,fromSchedule:()=>B9,fromSubscription:()=>j9,groupAdjacentBy:()=>IX,groupBy:()=>EX,groupByKey:()=>wX,grouped:()=>SX,groupedWithin:()=>bX,haltWhen:()=>qX,ignore:()=>VY,ignoreCause:()=>JY,interleave:()=>BX,interleaveWith:()=>Zj,interruptWhen:()=>jX,intersperse:()=>Gj,intersperseAffixes:()=>LX,isStream:()=>Ue,iterate:()=>z9,let:()=>JX,limitBytes:()=>YY,make:()=>A9,map:()=>Eo,mapAccum:()=>fX,mapAccumArray:()=>tf,mapAccumArrayEffect:()=>dX,mapAccumEffect:()=>lX,mapArray:()=>kj,mapArrayEffect:()=>G9,mapBoth:()=>V9,mapEffect:()=>ef,mapError:()=>Uj,merge:()=>yk,mergeAll:()=>mY,mergeEffect:()=>SS,mergeLeft:()=>dY,mergeResult:()=>lY,mergeRight:()=>pY,mkArrayBuffer:()=>aee,mkString:()=>iee,mkUint8Array:()=>cee,never:()=>W9,onEnd:()=>zX,onError:()=>$X,onExit:()=>Qj,onFirst:()=>Xj,onStart:()=>Yj,orDie:()=>KY,orElseIfEmpty:()=>HY,orElseSucceed:()=>WY,paginate:()=>$9,partition:()=>MY,partitionEffect:()=>_Y,partitionQueue:()=>wk,peel:()=>FY,pipeThrough:()=>_X,pipeThroughChannel:()=>RX,pipeThroughChannelOrFail:()=>OX,prepend:()=>fY,provide:()=>eq,provideContext:()=>Tk,provideService:()=>HX,provideServiceEffect:()=>kk,race:()=>CY,raceAll:()=>Oj,range:()=>H9,rechunk:()=>$j,repeat:()=>rY,repeatElements:()=>iY,result:()=>Z9,retry:()=>GY,run:()=>nq,runCollect:()=>rq,runCount:()=>YX,runDrain:()=>ES,runFold:()=>eee,runFoldEffect:()=>tee,runForEach:()=>oee,runForEachArray:()=>Ql,runForEachWhile:()=>see,runHead:()=>nee,runIntoPubSub:()=>dee,runIntoQueue:()=>hee,runLast:()=>ree,runSum:()=>XX,scan:()=>pX,scanEffect:()=>mX,schedule:()=>oY,scoped:()=>K9,service:()=>v9,serviceOption:()=>T9,share:()=>AX,sliding:()=>iX,slidingSize:()=>zj,split:()=>aX,splitLines:()=>NX,succeed:()=>Gl,suspend:()=>Fr,switchMap:()=>X9,sync:()=>R9,take:()=>QY,takeRight:()=>XY,takeUntil:()=>Dj,takeUntilEffect:()=>Nj,takeWhile:()=>Lj,takeWhileEffect:()=>tX,takeWhileFilter:()=>eX,tap:()=>Cj,tapBoth:()=>Q9,tapCause:()=>NY,tapError:()=>Mj,tapSink:()=>Y9,throttle:()=>yX,throttleEffect:()=>Hj,tick:()=>C9,timeout:()=>sY,timeoutOrElse:()=>Aj,toAsyncIterable:()=>lee,toAsyncIterableEffect:()=>fee,toAsyncIterableWith:()=>Ok,toChannel:()=>Zo,toPubSub:()=>pee,toPubSubTake:()=>oq,toPull:()=>Ck,toQueue:()=>mee,toReadableStream:()=>uee,toReadableStreamEffect:()=>Rk,toReadableStreamWith:()=>Ak,transduce:()=>vX,transformPull:()=>Sn,transformPullBracket:()=>mk,unfold:()=>Tj,unwrap:()=>mr,updateContext:()=>tq,updateService:()=>WX,when:()=>PY,withExecutionPlan:()=>ZY,withSpan:()=>KX,zip:()=>xY,zipFlatten:()=>bY,zipLatest:()=>TY,zipLatestAll:()=>bk,zipLatestWith:()=>kY,zipLeft:()=>yY,zipRight:()=>SY,zipWith:()=>Sk,zipWithArray:()=>bS,zipWithIndex:()=>EY,zipWithNext:()=>wY,zipWithPrevious:()=>IY,zipWithPreviousAndNext:()=>vY});var fj="~effect/RcMap",x9=e=>({[fj]:fj,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:hc()},pipe(){return ie(this,arguments)}}),lj=e=>xn(t=>{let n=t.context,r=$e(n,It),o=x9({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive=="function"?qc(e.idleTimeToLive,gt):Qe(gt(e.idleTimeToLive??Gi)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return zt(Do(r,()=>{if(o.state._tag==="Closed")return H;let s=o.state.map;return o.state={_tag:"Closed"},Lo(s,([,i])=>Vr(Je(i.scope,Vt))).pipe(Mt(()=>se(()=>{ry(s)})))}),o)}),fk=d(2,(e,t)=>yo(n=>{if(e.state._tag==="Closed")return xo;let r=e.state,o=Ei(),s=Os(r.map,t),i;if(s._tag==="Some")i=s.value,i.refCount++;else{if(Number.isFinite(e.capacity)&&B1(e.state.map)>=e.capacity)return G(new bP(`RcMap attempted to exceed capacity of ${e.capacity}`));{i={deferred:pu(),scope:zr(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},i.finalizer=y9(e,t,i),gc(r.map,t,i);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((u,f)=>{c.set(f,u)}),c.set(It.key,i.scope),e.lookup(t).pipe(Ln(Mo(c)),ya(i.scope)).addObserver(u=>Jf(i.deferred,u))}}let a=Jn(o.context,It);return _t(a,i.finalizer).pipe(Dn(n(mu(i.deferred))))}));var y9=(e,t,n)=>xn(r=>{if(n.refCount--,n.refCount>0)return H;if(e.state._tag==="Closed"||!L1(e.state.map,t)||Nd(n.idleTimeToLive))return e.state._tag==="Open"&&Mu(e.state.map,t),Je(n.scope,Vt);if(!fs(n.idleTimeToLive))return H;let o=r.getRef(nc);return n.expiresAt=o.currentTimeMillisUnsafe()+Tn(n.idleTimeToLive),n.fiber?H:(n.fiber=Ww(function s(i){let a=o.currentTimeMillisUnsafe(),c=n.expiresAt-a;return c<=0?e.state._tag==="Closed"||n.refCount>0?H:(Mu(e.state.map,t),i(Je(n.scope,Vt))):R(o.sleep(us(c)),()=>s(i))}).pipe(ca(se(()=>{n.fiber=void 0})),Ln(r.context),ya(e.scope)),H)});var lk=d(2,(e,t)=>Iu(n=>{if(e.state._tag==="Closed")return H;let r=Os(e.state.map,t);if(r._tag==="None"||Nd(r.value.idleTimeToLive))return H;let o=r.value;return o.expiresAt=n.currentTimeMillisUnsafe()+Tn(o.idleTimeToLive),H}));var S9="~effect/RcRef",dk={_tag:"Empty"},b9={_tag:"Closed"},E9={_A:B,_E:B},pk=class{[S9]=E9;pipe(){return ie(this,arguments)}state=dk;semaphore=Ia(1);acquire;context;scope;idleTimeToLive;constructor(t,n,r,o){this.acquire=t,this.context=n,this.scope=r,this.idleTimeToLive=o}},pj=e=>xn(t=>{let n=t.context,r=$e(n,It),o=new pk(e.acquire,n,r,e.idleTimeToLive?gt(e.idleTimeToLive):void 0);return zt(Do(r,()=>{let s=o.state._tag==="Acquired"?Je(o.state.scope,Vt):H;return o.state=b9,s}),o)}),w9=e=>yo(function t(n){switch(e.state._tag){case"Closed":return xo;case"Acquired":return e.state.refCount++,e.state.fiber?zt(bo(e.state.fiber),e.state):v(e.state);case"Empty":{let r=zr();return e.semaphore.withPermit(K(()=>e.state._tag!=="Empty"?t(n):n(Nn(e.acquire,Ve(e.context,It,r))).pipe(Y(o=>{let s={_tag:"Acquired",value:o,scope:r,fiber:void 0,refCount:1,invalidated:!1};return e.state=s,s}),ur(o=>ii(o)?Je(r,o):H))))}}}),mj=Se(function*(e){let t=e,n=yield*w9(t),r=yield*$o,o=t.idleTimeToLive!==void 0&&fs(t.idleTimeToLive);return yield*Do(r,()=>(n.refCount--,n.refCount>0?H:t.idleTimeToLive===void 0?(t.state=dk,Je(n.scope,Vt)):n.invalidated?Je(n.scope,Vt):o?(n.fiber=oc(t.idleTimeToLive).pipe(R(()=>t.state._tag==="Acquired"&&t.state.refCount===0?(t.state=dk,Je(n.scope,Vt)):H),ca(se(()=>{n.fiber=void 0})),Ln(t.context),ya(t.scope)),H):H)),n.value});var hj=pj,gj=mj;var Sj="~effect/Stream",Ue=e=>j(e,Sj),bj=Gp,q=ij,xS=e=>q(ky(Y(e,Ne))),v9=e=>xS($w(e)),T9=e=>xS(Eu(e)),Ej=e=>zs(v(R(e,()=>me()))),wj=e=>zs(v(Y(e,Ne))),k9=(e,t)=>zs($t(function*(){let n=yield*Ss(t),r=yield*qo(e,Un,Un.defaultValue()),o=!0,s=K(()=>n(r)).pipe(R(i=>qo(e,Un,i)),Y(i=>(r=i,Ne(i))));return K(()=>o?(o=!1,v(Ne(r))):s)})),C9=e=>zs(se(()=>{let t=!0,n=v(Ne(void 0)),r=aa(n,e);return K(()=>t?(t=!1,n):r)})),zs=e=>q(qn(e)),Sn=(e,t)=>q(Ge((n,r)=>R(Ko(e.channel,r),o=>t(o,r)))),mk=(e,t)=>q(Us((n,r,o)=>R(Ko(e.channel,r),s=>t(s,r,o)))),Zo=e=>e.channel,yS=(e,t)=>q(cD(e,t)),Ai=q(Ol),Gl=e=>q(Ty(Ne(e))),A9=(...e)=>Om(e),R9=e=>q(fD(()=>Ne(e()))),Fr=e=>q(vy(()=>e().channel)),Yu=e=>q(Ii(e)),O9=e=>q(dD(e)),Ij=e=>q(Zp(e)),_9=e=>q(Lv(e)),M9=e=>q(pD(e)),P9=(e,t)=>q(Nv(()=>e,t)),Xu=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?Om(e):q(uD(e,t?.chunkSize)),F9=e=>mr(Y(e,Xu)),U9=e=>Zl(wj(e),Xu),Om=e=>Ye(e)?q(Ty(e)):Ai,D9=e=>mr(Y(e,Om)),N9=(...e)=>q(Dv(Vh(e,Ye))),Ci=e=>q(hD(e)),hk=e=>q(gD(e)),vj=e=>q(xD(e)),gk=e=>q(yD(e)),L9=(e,t)=>q(SD(e,t)),B9=e=>zs(Y(Yf(e),t=>qt(Y(t(void 0),Ne),()=>me()))),j9=e=>q(jv(e)),q9=(e,t,n)=>yS(r=>{function o(s){Al(r,s)}return ic(se(()=>e.addEventListener(t,o,n)),()=>se(()=>e.removeEventListener(t,o,n)))},{bufferSize:typeof n=="object"?n.bufferSize:void 0}),Tj=(e,t)=>zs(se(()=>{let n=e;return R(K(()=>t(n)),r=>r===void 0?me():(n=r[1],v(Ne(r[0]))))})),$9=(e,t)=>zs(se(()=>{let n=e,r=!1;return K(function o(){return r?me():R(t(n),([s,i])=>(xe(i)?r=!0:n=i.value,Ye(s)?v(s):o()))})})),z9=(e,t)=>Tj(e,n=>v([n,t(n)])),H9=(e,t,n=Gp)=>e>t?Ai:zs(se(()=>{let r=Math.max(1,n),o=e,s=!1;return K(()=>{if(s)return me();let i=t-o+1;if(i>r){let c=hE(o,o+r-1);return o+=r,v(c)}let a=hE(o,o+i-1);return s=!0,v(a)})})),W9=q(lD),mr=e=>q(va(Y(e,Zo))),K9=e=>q(JD(e.channel)),Eo=d(2,(e,t)=>Fr(()=>{let n=0;return q(Ds(e.channel,as(r=>t(r,n++))))})),V9=d(2,(e,t)=>e.pipe(Eo(t.onSuccess),Uj(t.onFailure))),kj=d(2,(e,t)=>q(Ds(e.channel,t))),ef=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(lr,Cy(t,n),Ds(Ne),q)),J9=d(e=>Ue(e[0]),(e,t)=>ef(e,B,t)),G9=d(2,(e,t)=>q(Cy(e.channel,t))),Z9=e=>e.pipe(Eo(Ce),_m(t=>Gl(Ae(t)))),Cj=d(e=>Ue(e[0]),(e,t,n)=>ef(e,r=>zt(t(r),r),n)),Q9=d(2,(e,t)=>e.pipe(Mj(t.onError),Cj(t.onElement,{concurrency:t.concurrency}))),Y9=d(2,(e,t)=>mk(e,Se(function*(n,r,o){let s=fr(),i=fr(),a,c,u=!1,f=!1,l=s.whenOpen(K(()=>{if(a){let m=a;return a=void 0,f||s.closeUnsafe(),zt(i.open,m)}return me()}));yield*K(()=>t.transform(l,o)).pipe(m=>Hw(m,h=>(u=!0,ii(h)&&(c=h.cause),i.open),!0),Ut(o));let p=n.pipe(R(m=>(a=m,i.closeUnsafe(),s.openUnsafe(),zt(i.await,m))),qt(()=>(f=!0,i.closeUnsafe(),s.openUnsafe(),R(i.await,()=>me()))));return K(()=>c?ct(c):u?n:p)}))),Zl=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(lr,wD(r=>t(r).channel,n),q)),X9=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(lr,WD(r=>t(r).channel,n),q)),xk=d(e=>Ue(e[0]),(e,t)=>Zl(e,B,t)),eY=e=>q(lr(e.channel)),tY=e=>q(TD(e.channel)),nY=d(2,(e,t)=>SS(e,ES(t))),rY=d(2,(e,t)=>q(kD(e.channel,t))),oY=d(2,(e,t)=>e.channel.pipe(lr,CD(t),Ds(Ne),q)),sY=d(2,(e,t)=>Aj(e,{duration:t,orElse:()=>Ai})),Aj=d(2,(e,t)=>{let n=gt(t.duration);if(!fs(n))return e;if(Nd(n))return Fr(t.orElse);let r=Symbol();return _j(Fr(()=>{let s=Ei().getRef(nc),i=Tn(n),a,c=fr(!1);return yk(Sn(e,(u,f)=>K(()=>(a=s.currentTimeMillisUnsafe()+i,c.openUnsafe(),u)).pipe(Y(l=>(c.closeUnsafe(),a=void 0,l)),v)),Ej($t(function*(){for(;;)if(yield*c.await,!(a===void 0||(yield*oc(a-s.currentTimeMillisUnsafe()),a===void 0)||a-s.currentTimeMillisUnsafe()>0))return yield*ho(r)})),{haltStrategy:"left"})}),o=>o.reasons.find(i=>i._tag==="Die"&&i.defect===r)?t.orElse():Ij(o))}),iY=d(2,(e,t)=>q(Ge((n,r)=>Y(Pe(lr(e.channel))(n,r),o=>{let s,i=$t(function*(){let a=yield*o,c=Ne(a);return s=(yield*Yf(t))(a).pipe(zt(c),qt(f=>(s=void 0,i))),c});return K(()=>s??i)})))),aY=e=>q($v(e.channel)),cY=e=>Zl(e,Xu),uY=e=>e.channel.pipe(lr,vD,q),Rm=d(2,(e,t)=>xk(Om([e,t]))),fY=d(2,(e,t)=>Rm(Xu(t),e)),yk=d(e=>Ue(e[0])&&Ue(e[1]),(e,t,n)=>q(_y(Zo(e),Zo(t),n))),SS=d(2,(e,t)=>e.channel.pipe(KD(t),q)),lY=d(2,(e,t)=>yk(Eo(e,Ce),Eo(t,Ae))),dY=d(2,(e,t)=>SS(e,ES(t))),pY=d(2,(e,t)=>SS(t,ES(e))),mY=d(2,(e,t)=>xk(Xu(e),t)),hY=d(2,(e,t)=>Rj(e,t,(n,r)=>[n,r])),Rj=d(3,(e,t,n)=>Zl(e,r=>Eo(t,o=>n(r,o)))),Sk=d(3,(e,t,n)=>bS(e,t,gY(n))),gY=e=>(t,n)=>{let r=Math.min(t.length,n.length),o=[];for(let s=0;s<r;s++)o.push(e(t[s],n[s]));return[o,t.slice(r),n.slice(r)]},bS=d(3,(e,t,n)=>q(Us(Se(function*(r,o){let s=yield*Ko(e.channel,o),i=yield*Ko(t.channel,o),a=$t(function*(){let f=yield*Ut(s,o),l=yield*Ut(i,o);return yield*iy([f,l])}),c={_tag:"PullBoth"};return $t(function*(){let[f,l]=c._tag==="PullBoth"?yield*a:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*i],p=n(f,l);return Ye(p[1])?c={_tag:"PullRight",leftArray:p[1]}:Ye(p[2])?c={_tag:"PullLeft",rightArray:p[2]}:c={_tag:"PullBoth"},p[0]})})))),xY=d(2,(e,t)=>Sk(e,t,(n,r)=>[n,r])),yY=d(2,(e,t)=>bS(e,t,(n,r)=>{let o=Math.min(n.length,r.length),s=n.slice(0,o),i=n.slice(o),a=r.slice(o);return[s,i,a]})),SY=d(2,(e,t)=>bS(e,t,(n,r)=>{let o=Math.min(n.length,r.length),s=r.slice(0,o),i=n.slice(o),a=r.slice(o);return[s,i,a]})),bY=d(2,(e,t)=>Sk(e,t,(n,r)=>[...n,r])),EY=e=>Eo(e,(t,n)=>[t,n]),wY=e=>tf(e,D,(t,n)=>{let r=0;t._tag==="None"&&(r=1,t=L(n[0]));let o=rn();for(;r<n.length;r++){let s=t.value;t=L(n[r]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,D()]]:[]}}),IY=e=>tf(e,D,(t,n)=>{let r=rn();for(let o=0;o<n.length;o++){let s=n[o];r.push([t,s]),t=L(n[o])}return[t,r]}),vY=e=>tf(e,()=>({prev:D(),current:D()}),(t,n)=>{let r=0,o;t.current._tag==="None"?(r=1,o=n[0],t.current=L(o)):o=t.current.value;let s=rn();for(;r<n.length;r++){let i=n[r];t.current=L(i),s.push([t.prev,o,t.current]),t.prev=L(o),o=i}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,D()]]:[]}}),bk=(...e)=>q(vy(()=>{let t=[],n=new Set,r=fr();return Oy(Dv(e.map((o,s)=>o.channel.pipe(lr,Cy(i=>(t[s]=i,n.has(s)?v(Ne(t.slice())):(n.add(s),n.size<e.length?r.await:zt(r.open,Ne(t.slice()))))),AD(Kn)))),{concurrency:"unbounded",bufferSize:0})})),TY=d(2,(e,t)=>bk(e,t)),kY=d(3,(e,t,n)=>Eo(bk(e,t),([r,o])=>n(r,o))),Oj=(...e)=>q(Ge((t,n)=>se(()=>{let r,o=Nw(e.map(s=>{let i=Cn(n);return Ko(s.channel,i).pipe(R(a=>_w(v(a),a)),ur(a=>a._tag==="Success"?r?Je(i,a):(r=a.value[0],H):Je(i,a)),Y(([,a])=>a))}));return K(()=>r??o)}))),CY=d(2,(e,t)=>Oj(e,t)),Ek=d(2,(e,t)=>q(RD(Zo(e),t))),AY=d(2,(e,t)=>q(OD(Zo(e),t))),RY=d(2,(e,t)=>q(_D(Zo(e),t))),OY=d(2,(e,t)=>q(MD(Zo(e),t))),wk=d(e=>Ue(e[0]),Se(function*(e,t,n){let r=yield*$o,o=yield*Ko(e.channel,r),s=n?.capacity==="unbounded"?void 0:n?.capacity??bj,i=yield*to({capacity:s}),a=yield*to({capacity:s});return yield*$t(function*(){for(;;){let c=yield*o,u=[],f=[];for(let p=0;p<c.length;p++){let m=t(c[p]);Fe(m)?u.push(m.failure):f.push(m.success)}let l;if(f.length>0){let p=wy(i,f);p.length>0&&(l=yield*il(wa(i,p)))}if(u.length>0){let p=wy(a,u);p.length>0&&(yield*wa(a,p))}l&&(yield*vl(l))}}).pipe(go(c=>(wi(i,c),wi(a,c),H)),Ut(r)),[i,a]})),_Y=d(e=>Ue(e[0]),(e,t,n)=>Y(wk(ef(e,r=>t(r),n),r=>r,n),([r,o])=>[Ci(r),Ci(o)])),MY=d(e=>Ue(e[0]),(e,t,n)=>Y(wk(e,t,{capacity:n?.bufferSize??16}),([r,o])=>[Ci(o),Ci(r)])),PY=d(2,(e,t)=>t.pipe(Y(n=>n?e:Ai),mr)),FY=d(2,Se(function*(e,t){let n,r=yield*Gv(e.channel),o=ft(r,a=>(n=a,ct(a))),s=zs(v(o)),i=yield*nq(s,t);return n?[i,Ai]:(s=zs(v(r)),[i,s])})),UY=d(2,(e,t)=>q(ZD(e.channel,t))),DY=d(2,(e,t)=>q(GD(e.channel,t))),_j=d(2,(e,t)=>e.channel.pipe(Ml(n=>t(n).channel),q)),NY=d(2,(e,t)=>e.channel.pipe(Ry(t),q)),_m=d(2,(e,t)=>q(Ps(e.channel,n=>t(n).channel)));var Mj=d(2,(e,t)=>e.channel.pipe(UD(t),q)),Pj=d(e=>Ue(e[0]),(e,t,n,r)=>q(DD(Zo(e),t,o=>n(o).channel,r&&(o=>r(o).channel)))),Fj=d(e=>Ue(e[0]),(e,t,n,r)=>q(ND(Zo(e),t,o=>n(o).channel,r&&(o=>r(o).channel)))),LY=d(e=>Ue(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?s=>j(s,"_tag")&&t.includes(s._tag):yr(t);return Pj(e,o,n,r)}),BY=d(e=>Ue(e[0]),(e,t,n)=>{let r;return Fj(e,o=>(r??=Object.keys(t),j(o,"_tag")&&ox(o._tag)&&r.includes(o._tag)?Ce(o):Ae(o)),o=>t[o._tag](o),n)}),jY=d(e=>Ue(e[0]),(e,t,n,r,o)=>q(LD(Zo(e),t,n,(s,i)=>r(s,i).channel,o&&((s,i)=>o(s,i).channel)))),qY=d(e=>Ue(e[0]),(e,t,n,r)=>{let o=Object.create(null);for(let i of Object.keys(n)){let a=n[i];o[i]=(c,u)=>a(c,u).channel}let s=r&&((i,a)=>r(i,a).channel);return q(BD(e.channel,t,o,s))}),Uj=d(2,(e,t)=>q(jD(e.channel,t))),$Y=d(3,(e,t,n)=>q(FD(e.channel,t,r=>n(r).channel))),zY=d(3,(e,t,n)=>q(zv(e.channel,t,(r,o)=>n(r,o).channel))),HY=d(2,(e,t)=>q(ID(e.channel,n=>Zo(t())))),WY=d(2,(e,t)=>_m(e,n=>Gl(t(n)))),KY=e=>q(qD(e.channel)),VY=d(e=>Ue(e[0]),(e,t)=>q($D(e.channel,t))),JY=d(e=>Ue(e[0]),(e,t)=>q(zD(e.channel,t))),GY=d(2,(e,t)=>q(HD(e.channel,t))),yj=(e,t)=>mr(Y(Ss(t),n=>{let r=Un.defaultValue(),o=()=>_m(kk(e,Un,se(()=>r)),s=>mr(qt(Y(n(s),i=>(r=i,mr(zt(cp,o())))),()=>v(Yu(s)))));return o()})),ZY=d(e=>Ue(e[0]),(e,t,n)=>Fr(()=>{let r=n?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},i=kk(Xg,se(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),a=n?.onEvent===void 0?void 0:kw(n.onEvent,()=>s),c,u=a===void 0?B:p=>Qj(Yj(p,Y(a.begin,m=>{c=m})),m=>K(()=>{if(c===void 0)return H;let h=c;return c=void 0,a.end(h,m)})),f=D(),l=Fr(()=>{let p=t.steps[o];if(!p)return Yu(lE(f));let m=i(u(eq(e,p.provide))),h=!1;if(Te(f)){let g=f.value,x=!1,E=m;m=Fr(()=>x?E:(x=!0,Yu(g))),m=yj(m,ap(p,!1))}else{let g=ap(p,!0);m=g?yj(m,g):m}return _m(r?Xj(m,g=>(h=!0,H)):m,g=>(o++,r&&h?Yu(g):(f=L(g),l)))});return l})),QY=d(2,(e,t)=>t<1?Ai:Dj(e,(n,r)=>r===t-1)),YY=d(3,(e,t,n)=>Fr(()=>{let r=BigInt(t),o=BigInt(0),s=!1;return Rm(Lj(e,i=>{let a=o+BigInt(i.length);return a>r?(s=!0,!1):(o=a,!0)}),Fr(()=>s?n():Ai))})),XY=d(2,(e,t)=>tf(e,Ea,(n,r)=>(ay(n,r),n.length>t&&zp(n,n.length-t),[n,Ca]),{onHalt(n){return Fu(n)}})),Dj=d(e=>Ue(e[0]),(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=0,i=!1;return R(K(()=>i?me():r),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){i=!0;let f=c.slice(0,n?.excludeLast?u:u+1);return Ye(f)?v(f):me()}return v(c)})}))),Nj=d(e=>Ue(e[0]),(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=0,i=!1;return $t(function*(){if(i)return yield*me();let a=yield*r;for(let c=0;c<a.length;c++)if(yield*t(a[c],s++)){i=!0;let u=a.slice(0,n?.excludeLast?c:c+1);return Ye(u)?u:yield*me()}return a})}))),Lj=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=0,s=!1,i=R(K(()=>s?me():n),a=>{let c=[];for(let u=0;u<a.length;u++){if(!t(a[u],o++)){s=!0;break}c.push(a[u])}return Ye(c)?v(c):s?me():i});return i}))),eX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!1,s=R(K(()=>o?me():n),i=>{let a=[];for(let c=0;c<i.length;c++){let u=t(i[c]);if(Fe(u)){o=!0;break}a.push(u.success)}return Ye(a)?v(a):o?me():s});return s}))),tX=d(2,(e,t)=>Nj(e,(n,r)=>Y(t(n,r),o=>!o),{excludeLast:!0})),Ik=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=0,s=n.pipe(R(i=>o>=t?v(i):(o+=i.length,o<=t?s:v(i.slice(t-o)))));return s}))),nX=d(2,(e,t)=>Ik(Bj(e,(n,r)=>!t(n,r)),1)),rX=d(2,(e,t)=>Ik(jj(e,(n,r)=>Y(t(n,r),o=>!o)),1)),Bj=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=0,i=R(n,a=>{let c=a.findIndex(u=>!t(u,s++));return c===-1?i:(o=!1,v(a.slice(c)))});return K(()=>o?i:n)}))),oX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=R(n,i=>{let a=i.findIndex(c=>Fe(t(c)));return a===-1?s:(o=!1,v(i.slice(a)))});return K(()=>o?s:n)}))),jj=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=0,i=$t(function*(){for(;;){let a=yield*n;for(let c=0;c<a.length;c++)if(!(yield*t(a[c],s++)))return o=!1,a.slice(c)}});return K(()=>o?i:n)}))),sX=d(2,(e,t)=>t<=0?e:Sn(e,(n,r)=>se(()=>{let o=Ea(),s=R(n,i=>{cy(o,i);let a=o.length-t,c=Pu(o,a);return Vn(c)?v(c):s});return s}))),qj=e=>e.channel.pipe(Ds(Ne),q),$j=d(2,(e,t)=>(t=Math.max(1,t),Sn(e,(n,r)=>se(()=>{let o=rn(),s=0,i,a=!1;return K(function c(){if(a)return me();if(i===void 0)return R(n,u=>o.length===0&&u.length===t?v(u):o.length+u.length<t?(o.push(...u),c()):(i=u,c()));for(;s<i.length;)if(o.push(i[s++]),o.length===t){let u=o;return o=[],v(u)}return s=0,i=void 0,c()}).pipe(qt(()=>{if(o.length===0)return me();let c=o;return a=!0,o=[],v(c)}))})))),iX=d(2,(e,t)=>zj(e,t,1)),zj=d(3,(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=null,i=Ea(),a=!1,c=0,u=Jr(r,{onSuccess(f){if(cy(i,f),c>0){let p=i.length;zp(i,c),c=Math.max(0,c-p)}if(i.length<t)return u;a=!0;let l=[];for(;i.length>=t;)if(t===n)l.push(Pu(i,t));else if(l.push(J1(i,t)),t===1&&n<=0)_s(i);else{let p=i.length;zp(i,n),c=Math.max(0,n-p)}return v(l)},onFailure(f){return a&&zp(i,t-n),i.length===0?ct(f):(s=f,v(Ne(Fu(i))))}});return K(()=>s?ct(s):u)}))),aX=d(2,(e,t)=>tf(e,rn,(n,r)=>{let o=rn();for(let s=0;s<r.length;s++)t(r[s])?Vn(n)&&(o.push(n),n=[]):n.push(r[s]);return[n,o]},{onHalt(n){return Vn(n)?Ne(n):Ca}})),cX=d(4,(e,t,n,r)=>qv(lr(e.channel),lr(t.channel),n,r).pipe(Ds(Ne),q)),uX=d(4,(e,t,n,r)=>q(qv(e.channel,t.channel,n,r))),fX=d(e=>Ue(e[0]),(e,t,n,r)=>q(_l(e.channel,t,(o,s)=>{let i=rn();for(let a=0;a<s.length;a++){let[c,u]=n(o,s[a]);o=c,i.push(...u)}return[o,Vn(i)?Ne(i):Ca]},r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Ca}}:void 0))),tf=d(e=>Ue(e[0]),(e,t,n,r)=>q(_l(e.channel,t,(o,s)=>{let[i,a]=n(o,s);return o=i,[o,Ye(a)?Ne(a):Ca]},r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Ca}}:void 0))),Ca=rn(),lX=d(e=>Ue(e[0]),(e,t,n,r)=>e.channel.pipe(lr,_l(t,(o,s)=>Y(n(o,s),([i,a])=>[i,Ye(a)?Ne(a):rn()]),r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Ca}}:void 0),q)),dX=d(e=>Ue(e[0]),(e,t,n,r)=>e.channel.pipe(_l(t,(o,s)=>Y(n(o,s),([i,a])=>[i,Ye(a)?Ne(a):Ca]),r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Ca}}:void 0),q)),pX=d(3,(e,t,n)=>Fr(()=>{let r=!0;return q(_l(e.channel,Qe(t),(o,s)=>{let i=rn();r&&(r=!1,i.push(o));for(let a=0;a<s.length;a++)o=n(o,s[a]),i.push(o);return[o,Ne(i)]}))})),mX=d(3,(e,t,n)=>e.channel.pipe(lr,PD(t,n),Ds(Ne),q)),hX=d(2,(e,t)=>Sn(e,Se(function*(n,r){let o=yield*nc,s=Tn(gt(t)),i,a,c=1/0,u=fr(),f=fr(),l=fr();yield*n.pipe(u.whenOpen,R(m=>(f.openUnsafe(),i=m,c=o.currentTimeMillisUnsafe()+s,H)),Ht({disableYield:!0}),go(m=>(a=m,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),l.openUnsafe(),H)),Ut(r));let p=K(function m(){let h=o.currentTimeMillisUnsafe(),g=c<h?s:Math.min(s,c-h);return R(sc(oc(g),l.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(i){f.closeUnsafe(),u.closeUnsafe();let E=v(Ne(Tf(i)));return i=void 0,E}else if(a)return ct(a);return m()})});return K(()=>{if(a){if(i){let m=v(Ne(Tf(i)));return i=void 0,m}return ct(a)}return u.openUnsafe(),f.whenOpen(p)})}))),Hj=d(2,(e,t)=>{let n=t.burst??0;return t.strategy==="enforce"?gX(e,t.cost,t.units,t.duration,n):xX(e,t.cost,t.units,t.duration,n)}),gX=(e,t,n,r,o)=>Sn(e,s=>Iu(i=>{let a=Tn(gt(r)),c=n+o<0?Number.POSITIVE_INFINITY:n+o,u=n,f=i.currentTimeMillisUnsafe();return v(R(s,function l(p){return R(t(p),m=>{let h=i.currentTimeMillisUnsafe(),x=(h-f)/a,E=u+x*n,b=E<0?c:Math.min(E,c);return m<=b?(u=b-m,f=h,v(p)):R(s,l)})}))})),xX=(e,t,n,r,o)=>Sn(e,s=>Iu(i=>{let a=Tn(gt(r)),c=n+o<0?Number.POSITIVE_INFINITY:n+o,u=n,f=i.currentTimeMillisUnsafe();return v(R(s,l=>R(t(l),p=>{let m=i.currentTimeMillisUnsafe(),g=(m-f)/a,x=u+g*n,b=(x<0?c:Math.min(x,c))-p;if(b>=0)return u=b,f=m,v(l);let y=-b/n,w=Math.max(0,y*a);return w>0?R(oc(w),()=>(u=b,f=m,v(l))):(u=b,f=m,v(l))})))})),yX=d(2,(e,t)=>Hj(e,{...t,cost:n=>v(t.cost(n))})),SX=d(2,(e,t)=>qj($j(e,t))),bX=d(3,(e,t,n)=>vk(e,cj(t),Xf(n))),EX=d(e=>Ue(e[0]),(e,t,n)=>Wj(e,Se(function*(r,o,s){for(let i=0;i<r.length;i++){let[a,c]=yield*t(r[i]),u=Os(s,a),f=Te(u)?u.value:yield*wu(fk(o,a));yield*lk(o,a),yield*Xn(f,c)}}),n)),wX=d(e=>Ue(e[0]),(e,t,n)=>Fr(()=>{let r=hc();return Wj(e,Se(function*(o,s,i){for(let a=0;a<o.length;a++){let c=t(o[a]),u=Os(r,c);xe(u)?gc(r,c,[o[a]]):u.value.push(o[a])}for(let[a,c]of r){let u=Os(i,a),f=Te(u)?u.value:yield*wu(fk(s,a));yield*lk(s,a),yield*wa(f,c)}ry(r)}),n)})),Wj=(e,t,n)=>mk(e,Se(function*(r,o,s){let i=yield*Vp();yield*_t(o,Ms(i));let a=hc(),c=yield*lj({lookup:u=>ic(to({capacity:n?.bufferSize??4096}).pipe(Mt(f=>(gc(a,u,f),Xn(i,[u,Ci(f)])))),f=>(Mu(a,u),Jp(f))),idleTimeToLive:n?.idleTimeToLive??po}).pipe(Uo(s));return yield*Qn({while:Xt,body:Qe(R(r,u=>t(u,c,a))),step:En}).pipe(ft(u=>Zt(i,u)),Ut(o)),Rl(i)})),IX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o,s,i=rn(),a=n.pipe(R(u=>{for(let f=0;f<u.length;f++){let l=u[f],p=t(l);if(s===void 0){o=p,s=[l];continue}else if(ae(p,o)){s.push(l);continue}i.push([o,s]),o=p,s=[l]}if(Vn(i)){let f=i;return i=[],v(f)}return a})),c=!1;return qt(K(()=>c?me():a),()=>{c=!0;let u=s;return s=void 0,u&&Vn(u)?v(Ne([o,u])):me()})}))),vX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o,s,i=K(()=>{if(s!==void 0){let c=s;return s=void 0,v(c)}return n}).pipe(bu(c=>(o=Fo(c),me()))),a=Y(K(()=>t.transform(i,r)),([c,u])=>(s=u,Ne(c)));return K(()=>o||a)}))),TX=d(2,(e,t)=>vk(e,t,op)),vk=d(3,(e,t,n)=>q(Us(Se(function*(r,o,s){let i=yield*Ko(e.channel,o),a=fr(!1),c=Symbol(),u=yield*to({capacity:0});yield*i.pipe(a.whenOpen,R(y=>(a.closeUnsafe(),Xn(u,y))),Ht,ft(y=>Zt(u,y)),Ut(s));let f=D(),l,p=!1,m=yield*Yf(n),g=K(function y(){return R(m(f),()=>p?Xn(u,c):y())}).pipe(R(()=>Kr),qt(()=>me())),x=Wo(u).pipe(R(y=>y===c?me():(p=!0,v(y)))),E=K(()=>{if(l!==void 0){let y=l;return l=void 0,p=!0,v(y)}return a.openUnsafe(),x}),b=R(([y,w])=>!p&&u.state._tag==="Done"?me():(f=L(y),l=w,v(Ne(y))));return K(()=>u.state._tag==="Done"&&l===void 0?u.state.exit:(p=l!==void 0,v(K(()=>t.transform(E,s))))).pipe(R(y=>sc(b(y),g)))})))),kX=d(2,Se(function*(e,t){let n=yield*CX(t),r=new Array(t.n),o=yield*It;for(let s=0;s<t.n;s++){let i=Cn(o),a=yield*Kp(n).pipe(qo(It,i));r[s]=Bv(gy(a)).pipe(Qp(c=>Je(i,c)),q)}return yield*Lu(e.channel,s=>kl(n,s)).pipe(ur(s=>kl(n,s)),Is),r})),CX=e=>ic(e.capacity==="unbounded"?Hp(e):e.strategy==="dropping"?my(e):e.strategy==="sliding"?hy(e):py(e),Wp),Kj=d(2,(e,t)=>Y(oq(e,t),vj)),AX=d(2,(e,t)=>Y(hj({acquire:Kj(e,t),idleTimeToLive:t.idleTimeToLive}),n=>mr(gj(n)))),RX=d(2,(e,t)=>q(Hv(e.channel,t))),OX=d(2,(e,t)=>q(Wv(e.channel,t))),_X=d(2,(e,t)=>e.channel.pipe(Wv(aj(t)),Ay(([n,r])=>r?Ty(r):Ol),q)),MX=e=>xS(rq(e)),PX=e=>tf(e,rn,(t,n)=>{let r=vf(t,n);return[r,[r]]}),Vj=e=>Jj(e,ae),Jj=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s;return R(n,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 Vn(c)?v(c):R(n,i)})}))),FX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s;return R(n,Se(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 Vn(c)?c:yield*R(n,Se(i))}))}))),UX=d(e=>Ue(e[0]),(e,t)=>Fr(()=>{let n=new TextDecoder(t?.encoding);return Eo(e,r=>n.decode(r,{stream:!0}))})),DX=e=>Fr(()=>{let t=new TextEncoder;return Eo(e,n=>t.encode(n))}),NX=e=>e.channel.pipe(Hv(VD()),q),Gj=d(2,(e,t)=>kj(e,(n,r)=>{let o=r===0?[]:[t],s=n.length-1;for(let i=0;i<n.length;i++)i===s?o.push(n[i]):o.push(n[i],t);return o})),LX=d(2,(e,t)=>Gl(t.start).pipe(Rm(Gj(e,t.middle)),Rm(Gl(t.end)))),BX=d(2,(e,t)=>Zj(e,t,Xu(SR([!0,!1])))),Zj=d(3,(e,t,n)=>q(Ge(Se(function*(r,o){let s=yield*Pe(lr(n.channel))(r,o),i=Symbol(),a=!1,c=!1,u=(yield*Pe(lr(e.channel))(r,o)).pipe(qt(()=>(a=!0,v(i)))),f=(yield*Pe(lr(t.channel))(r,o)).pipe(qt(()=>(c=!0,v(i))));return $t(function*(){for(;;){if(a&&c)return yield*me();let l=yield*s;if(l&&a||!l&&c)continue;let p=yield*l?u:f;if(p!==i)return Ne(p)}})})))),jX=d(2,(e,t)=>q(QD(e.channel,t))),qX=d(2,(e,t)=>q(YD(e.channel,t))),Qj=d(2,(e,t)=>q(Qp(e.channel,t))),$X=d(2,(e,t)=>q(XD(e.channel,t))),Yj=d(2,(e,t)=>q(eN(e.channel,t))),Xj=d(2,(e,t)=>q(Kv(e.channel,n=>t(n[0])))),zX=d(2,(e,t)=>q(tN(e.channel,t))),Mm=d(2,(e,t)=>q(nN(e.channel,t))),eq=d(e=>Ue(e[0]),(e,t,n)=>q(rN(e.channel,t,n))),Tk=d(2,(e,t)=>q(My(e.channel,t))),HX=d(3,(e,t,n)=>q(Py(e.channel,t,n))),kk=d(3,(e,t,n)=>q(Fy(e.channel,t,n))),tq=d(2,(e,t)=>q(oN(e.channel,t))),WX=d(3,(e,t,n)=>tq(e,r=>Ve(r,t,n($e(r,t))))),KX=function(){let e=Ue(arguments[0]),t=e?arguments[1]:arguments[0],n=Po(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return q(Vv(r.channel,t,n))}return r=>q(Vv(r.channel,t,n))},VX=Gl({}),JX=d(3,(e,t,n)=>Eo(e,r=>({...r,[t]:n(r)})));var GX=d(e=>Ue(e[0]),(e,t,n,r)=>Zl(e,o=>Eo(n(o),s=>({...o,[t]:s})),r)),ZX=d(e=>Ue(e[0]),(e,t,n,r)=>ef(e,o=>Y(n(o),s=>({...o,[t]:s})),r)),QX=d(2,(e,t)=>Eo(e,n=>({[t]:n}))),nq=d(2,(e,t)=>dp(n=>Ko(e.channel,n).pipe(R(r=>t.transform(r,n)),Y(([r])=>r)))),rq=e=>Bu(e.channel,()=>[],(t,n)=>{for(let r=0;r<n.length;r++)t.push(n[r]);return t}),YX=e=>Bu(e.channel,()=>0,(t,n)=>t+n.length),XX=e=>Bu(e.channel,()=>0,(t,n)=>{for(let r=0;r<n.length;r++)t+=n[r];return t}),eee=d(3,(e,t,n)=>Bu(e.channel,t,(r,o)=>{for(let s=0;s<o.length;s++)r=n(r,o[s]);return r})),tee=d(3,(e,t,n)=>uN(e.channel,t,(r,o)=>{let s=0,i=r;return Y(Qn({while:()=>s<o.length,body:()=>n(i,o[s]),step(a){i=a,s++}}),()=>i)})),nee=e=>Y(aN(e.channel),Lt(CR(0))),ree=e=>Y(cN(e.channel),Lt(Tf)),oee=d(2,(e,t)=>Lu(e.channel,n=>{let r=0;return Qn({while:()=>r<n.length,body:()=>t(n[r++]),step:En})})),see=d(2,(e,t)=>iN(e.channel,n=>{let r=!1,o=0;return Y(Qn({while:()=>!r&&o<n.length,body:()=>t(n[o]),step(s){o++,s||(r=!0)}}),()=>!r)})),Ql=d(2,(e,t)=>Lu(e.channel,t)),ES=e=>sN(e.channel),Ck=e=>Gv(e.channel),iee=e=>Bu(e.channel,()=>"",(t,n)=>t+n.join("")),aee=e=>Y(Jv(e.channel),t=>t.buffer),cee=e=>Jv(e.channel),Ak=d(e=>Ue(e[0]),(e,t,n)=>{let r,o,s=fr(!1);return new ReadableStream({start(i){o=mp(Nn(Ql(e,a=>s.whenOpen(se(()=>{s.closeUnsafe();for(let c=0;c<a.length;c++)i.enqueue(a[c]);r(),r=void 0}))),t)),o.addObserver(a=>{a._tag==="Failure"?i.error(du(a.cause)):i.close()})},pull(){return new Promise(i=>{r=i,s.openUnsafe()})},cancel(){if(o)return Zw(jo(bo(o)))}},n?.strategy)}),uee=d(e=>Ue(e[0]),(e,t)=>Ak(e,Et(),t)),Rk=d(e=>Ue(e[0]),(e,t)=>Y(ar(),n=>Ak(e,n,t))),Ok=d(2,(e,t)=>({[Symbol.asyncIterator](){let n=Qw(t),r=Ln(t),o=zr(),s,i,a,c,u=l=>{if(c)return c;let p=a;return c=n(zt(Dn(p?bo(p):H,Je(o,l)),{done:!0,value:void 0})),c},f=async l=>{try{await u(l)}catch(p){await n(hp("Suppressed error while closing Stream async iterator",p))}};return{async next(){if(c)return c;if(i){let m=i.next();if(!m.done)return m;i=void 0}let l=r(s??R(Ko(e.channel,o),m=>(s=m,m)));a=l;let p=await n(z1(l));if(a===l&&(a=void 0),Ft(p))return i=p.value[Symbol.iterator](),i.next();if(No(p.cause))return u(Vt);if(c&&Z0(p.cause))return c;throw await f(p),du(p.cause)},return(){return u(Vt)},async throw(l){throw await f(Hg(l)),l}}}})),fee=e=>Y(ar(),t=>Ok(e,t)),lee=e=>Ok(e,Et()),dee=d(e=>Ue(e[0]),(e,t,n)=>Qv(e.channel,t,n)),pee=d(2,(e,t)=>dN(e.channel,t)),oq=d(2,(e,t)=>pN(e.channel,t)),mee=d(2,(e,t)=>fN(e.channel,t)),hee=d(2,(e,t)=>Zv(e.channel,t));var sq="~effect/interfaces/PrimaryKey";var aq="~effect/Pool",fq=Symbol(),lq=Symbol();var dq=e=>mq({...e,min:e.size,max:e.size,strategy:vS}),pq=e=>R(e.timeToLiveStrategy==="creation"?wee(e.timeToLive):Iee(e.timeToLive),t=>mq({...e,strategy:t})),mq=e=>yo(Se(function*(t){let n=yield*ar(),r=$e(n,It),o=lp(e.acquire,u=>br(n,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:r,isShuttingDown:!1,usage:0,resizeSemaphore:Ia(1),items:new Set,availableHead:void 0,availableTail:void 0,invalidated:new Set,waiters:new Set},c={[aq]:aq,[fq]:e.acquire,[lq]:n,config:i,state:a,pipe(){return ie(this,arguments)}};return yield*_t(r,gee(c)),i.minSize>0&&(yield*Mt(al(t(Uk(c)),{startImmediately:!0}),u=>_t(r,bo(u)))),e.strategy!==vS&&(yield*Mt(al(t(e.strategy.run(c))),u=>_t(r,bo(u)))),c})),gee=Se(function*(e){if(e.state.isShuttingDown)return;e.state.isShuttingDown=!0;let t=e.state.items.size,n=Ia(t);for(let r of e.state.items)r.refCount>0?(r.finalizer=Mt(r.finalizer,n.release(1)),e.state.invalidated.add(r),yield*n.take(1)):(e.state.items.delete(r),Pm(e,r),e.state.invalidated.delete(r),yield*r.finalizer);if(yield*n.releaseAll,e.state.waiters.size>0){let r=Array.from(e.state.waiters);e.state.waiters.clear();for(let o of r)o()}yield*n.take(t)}),Mk=e=>pe(t=>{let n=e.state;if(n.isShuttingDown)return jf;if(n.availableHead!==void 0){if(n.usage++,e.config.isFixed||wS(e)<=IS(e))return hq(e,n.availableHead,t);n.usage--}return xee(e,See)});var xee=(e,t)=>qr(n=>{let r=e.state;r.usage++;let o=ne(Fg(n(Eee(e)),()=>ge(()=>{r.usage--})),()=>i),s=pe(a=>r.isShuttingDown?(r.usage--,jf):r.availableHead!==void 0?t(e,r.availableHead,a,n):o),i=he(()=>r.isShuttingDown?(r.usage--,jf):wS(e)>IS(e)?ne(r.resizeSemaphore.withPermitsIfAvailable(1)(Ut(ua(Uk(e)),r.scope)),()=>s):s);return i}),yee=(e,t)=>{let n=e.state;return t.exit._tag==="Failure"?(n.usage--,n.items.delete(t),n.invalidated.delete(t),Pm(e,t),!1):(t.refCount++,t.refCount>=e.config.concurrency&&Pm(e,t),!0)},hq=(e,t,n)=>{if(!yee(e,t))return t.exit;let r=Jn(n.context,It);return r.state._tag==="Closed"?ne(t.release(t.exit),()=>t.exit):(su(r,{},t.release),t.exit)},See=(e,t,n)=>hq(e,t,n),bee=(e,t)=>pe(n=>{let r=e.state;return t.refCount--,r.usage--,r.invalidated.has(t)?Fk(e,t):(t.refCount===e.config.concurrency-1&&(Pk(e,t),gq(e,n,1)),we)}),Eee=e=>Bt(t=>{let n=e.state;if(n.availableHead!==void 0||n.isShuttingDown)return t(we);let r=()=>{n.waiters.delete(r),t(we)};return n.waiters.add(r),ge(()=>{n.waiters.delete(r)})}),gq=(e,t,n)=>{let r=e.state.waiters;r.size!==0&&t.currentDispatcher.scheduleTask(()=>{let o=n,s=[];for(let i of r){if(o--<=0)break;s.push(i)}for(let i=0;i<s.length;i++)s[i]()},0)},cq=e=>pe(t=>(gq(e,t,Number.POSITIVE_INFINITY),we)),Pk=(e,t)=>{t.isAvailable||(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)},Pm=(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 Fk=(e,t)=>K(()=>{if(e.state.items.has(t)){if(t.refCount===0)return e.state.items.delete(t),Pm(e,t),e.state.invalidated.delete(t),jo(R(t.finalizer,()=>Ut(ua(Uk(e)),e.state.scope,{startImmediately:!0})))}else return H;return e.state.invalidated.add(t),Pm(e,t),H}),Uk=e=>e.state.resizeSemaphore.withPermits(1)(_k(e)),_k=e=>K(()=>{let t=IS(e),n=wS(e);if(t>=n)return H;let r=n-t,o=e.config.strategy===vS?uq(e):R(e.config.strategy.reclaim(e),i=>i?v(i):uq(e));if(r===1){let i=Mt(o,cq(e));return e.config.isFixed?jo(i):R(i,a=>a.exit._tag==="Failure"?H:_k(e))}let s=o.pipe(Kw(r,{concurrency:r}),Mt(cq(e)));return e.config.isFixed?jo(s):R(s,i=>i.some(a=>a.exit._tag==="Failure")?H:_k(e))}),uq=e=>qr(t=>pe(n=>{let r=e,o=cu(),s=n.context;n.setContext(Ve(r[lq],It,o));let i=R(Vr(r[fq]),a=>{let c={exit:a,finalizer:ft(Je(o,a),vee),refCount:0,disableReclaim:!1,isAvailable:!1,availablePrevious:void 0,availableNext:void 0,release:void 0};return c.release=Qe(bee(e,c)),e.state.items.add(c),Pk(e,c),e.config.strategy===vS?a._tag==="Success"?v(c):zt(c.finalizer,c):zt(a._tag==="Success"?e.config.strategy.onAcquire(c):R(c.finalizer,()=>e.config.strategy.onAcquire(c)),c)});return ms(t(i),a=>(n.setContext(s),a._tag==="Failure"?Lf(o,a):void 0),!0)})),wS=e=>{if(e.state.isShuttingDown)return 0;if(e.config.isFixed)return e.config.minSize;let t=e.state.usage/e.config.targetUtilization,n=Math.ceil(t/e.config.concurrency);return Math.min(Math.max(e.config.minSize,n),e.config.maxSize)},IS=e=>e.state.items.size-e.state.invalidated.size,vS={run:e=>H,onAcquire:e=>H,reclaim:e=>rl},wee=Se(function*(e){let t=yield*nc,n=yield*Vp(),r=Tn(gt(e)),o=new WeakMap;return B({run:s=>{let i=a=>K(()=>{if(!s.state.items.has(a)||s.state.invalidated.has(a))return H;let c=t.currentTimeMillisUnsafe(),u=o.get(a),f=r-(c-u);return f>0?aa(i(a),f):Fk(s,a)});return Wo(n).pipe(Mt(i),Ht({disableYield:!0}))},onAcquire:s=>K(()=>(o.set(s,t.currentTimeMillisUnsafe()),Xn(n,s))),reclaim:s=>rl})}),Iee=Se(function*(e){let t=yield*Vp();return B({run:n=>{let r=K(()=>IS(n)-wS(n)<=0?H:Wo(t).pipe(Mt(s=>Fk(n,s)),R(()=>r)));return r.pipe(aa(e),Ht({disableYield:!0}))},onAcquire:n=>Xn(t,n),reclaim(n){return K(()=>{if(n.state.invalidated.size===0)return rl;let r=bR(zh(n.state.invalidated,o=>!o.disableReclaim));return r._tag==="None"?rl:(n.state.invalidated.delete(r.value),r.value.refCount<n.config.concurrency&&Pk(n,r.value),zt(Xn(t,r.value),r.value))})}})}),vee=e=>xn(t=>{let n=t.getRef(kP);return n?cl(n)("Unhandled error in pool finalizer",e):H});var Ri=class extends Ke()("effect/reactivity/Reactivity"){},Tee=se(()=>{let e=new Map,t=c=>{Dk(c,u=>{let f=e.get(u);f!==void 0&&f.forEach(l=>l())})},n=c=>cr(u=>{let f=Vi(u,TS);return f?Dk(c,l=>{f.add(l)}):t(c),H}),r=(c,u)=>Mt(u,n(c)),o=(c,u)=>{let f=[];return Dk(c,l=>{f.push(l);let p=e.get(l);p===void 0&&(p=new Set,e.set(l,p)),p.add(u)}),()=>{for(let l=0;l<f.length;l++){let p=e.get(f[l]);p.delete(u),p.size===0&&e.delete(f[l])}}},s=(c,u)=>$t(function*(){let f=yield*ar(),l=$e(f,It),p=yield*to(),m=qc(Ln(f),ya(l)),h=!1,g=!1,x=y=>{y._tag==="Failure"?wi(p,y.cause):Al(p,y.value),g?(g=!1,m(u).addObserver(x)):h=!1};function E(){if(h){g=!0;return}h=!0,m(u).addObserver(x)}let b=o(c,E);return yield*_t(l,se(b)),E(),p}),i=(c,u)=>s(c,u).pipe(Y(Ci),mr),a=c=>K(()=>{let u=new Set;return c.pipe(qo(TS,u),ur(f=>se(()=>{u.forEach(l=>{let p=e.get(l);p!==void 0&&p.forEach(m=>m())})})))});return Ri.of({mutation:r,query:s,stream:i,invalidateUnsafe:t,invalidate:n,registerUnsafe:o,withBatch:a})}),TS=class extends Ke()("effect/reactivity/Reactivity/PendingInvalidation"){},kS=d(2,(e,t)=>Ri.use(n=>n.mutation(t,e)));var CS=e=>Ri.use(t=>t.invalidate(e)),AS=Hr(Ri)(Tee);function yq(e){switch(typeof e){case"string":case"number":case"bigint":case"boolean":return String(e);default:return ce(e)}}var Dk=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(yq(e[n]));return}for(let n in e){t(n);let r=e[n];for(let o=0;o<r.length;o++)t(`${n}:${yq(r[o])}`)}};var Sq="~effect/SubscriptionRef",Fm=e=>j(e,Sq),gle={...vn,[Sq]:{_A:B},toJSON(){return{_id:"SubscriptionRef",value:this.value}}};var Nk=e=>hk(e.pubsub);var bq=e=>se(()=>e.value);var kee=(e,t)=>{e.value=t,Z1(e.pubsub,t)};var Lk=d(2,(e,t)=>e.semaphore.withPermit(se(()=>kee(e,t))));function OS(e,t){if(e===null)return{drafts:{},expired:!1};if(new TextEncoder().encode(e).length>2097152)throw new Error("Draft storage exceeds the workspace limit.");let n=JSON.parse(e);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Draft storage is malformed.");let r={},o=!1;for(let[s,i]of Object.entries(n)){if(typeof i!="object"||i===null||!("author"in i)||!("body"in i)||!("id"in i)||!("revision"in i)||!("type"in i)||!("updatedAt"in i)||typeof i.author!="string"||typeof i.body!="string"||typeof i.id!="string"||typeof i.revision!="string"||i.type!=="answer"&&i.type!=="clarify"&&i.type!=="not_now"||typeof i.updatedAt!="number"||!Number.isFinite(i.updatedAt))throw new Error("Draft storage is malformed.");if(i.updatedAt>t||t-i.updatedAt>=2592e6){o=!0;continue}r[s]={author:i.author,body:i.body,id:i.id,revision:i.revision,type:i.type,updatedAt:i.updatedAt}}return{drafts:r,expired:o}}function _S(e){let t=JSON.stringify(e);if(new TextEncoder().encode(t).length>2097152)throw new Error("Draft storage is full. Copy this draft before clearing workspace drafts.");return t}var Aa=new Map;function wq(e,t,n,r,o){function s(){if(!n)throw new Error("Draft storage unavailable");return n}let i=!1,a={};try{let m=OS(s().getItem(r),le.runSync(fi.currentTimeMillis));a=m.drafts,m.expired&&o("Expired drafts were cleared after 30 days. Saved responses are unaffected."),s().setItem(r,_S(a))}catch{i=!0,o("Draft history is unavailable or malformed. Keep a copy; edits remain in this window.")}let c=Aa.get(e);c&&le.runSync(fi.currentTimeMillis)-c.updatedAt>=2592e6&&(Aa.delete(e),o("A window draft expired after 30 days. Saved responses are unaffected."));let u=Aa.get(e)??a[e]??{author:"",body:"",id:`response.${crypto.randomUUID()}`,revision:t,type:"answer",updatedAt:le.runSync(fi.currentTimeMillis)};u.revision!==t&&o("Source changed since this draft. Your text is retained; review the new source and preview to bind it to this revision.");function f(m){u={...Aa.get(e)??u,...m,updatedAt:le.runSync(fi.currentTimeMillis)},Aa.set(e,u);try{if(i)throw new Error("Unknown draft history");let h=OS(s().getItem(r),le.runSync(fi.currentTimeMillis)).drafts;s().setItem(r,_S({...h,[e]:u}))}catch{o("Draft could not be persisted (storage full or unavailable). Keep a copy; your text remains in this window.")}return u}function l(){try{s().removeItem(r),i=!1,Aa.clear(),o("Workspace drafts cleared. Saved responses are unchanged; this visible text remains until you navigate away.")}catch{o("Draft storage could not be cleared.")}}function p(m){if(Aa.get(e)!==m)return Aa.get(e)?.id===m.id&&f({id:`response.${crypto.randomUUID()}`}),!1;Aa.delete(e);try{let h=OS(s().getItem(r),le.runSync(fi.currentTimeMillis)).drafts;h[e]?.id===m.id&&delete h[e],s().setItem(r,_S(h))}catch{o("Saved response confirmed, but its browser draft could not be cleared.")}return u={...u,body:"",id:`response.${crypto.randomUUID()}`,updatedAt:le.runSync(fi.currentTimeMillis)},!0}return{clear:l,current:()=>u,saved:p,update:f}}function Iq(e,t){return`New file: responses/${e.id}.md
29
+ `,m));n=n+p.substring(m,p.length-(r?1:0))}}return Ye(u)?u:null}let i=V(()=>o._tag==="Some"?me(o.value):np(e,{onSuccess:a,onFailure:ct,onDone:c=>{if(o=L(c),n.length>0||r){let u=n;return n="",r=!1,v([u])}return me(c)}}));function a(c){let u=s(c);return u!==null?v(u):i}return i}));var Wv=d(2,(e,t)=>Ge((n,r)=>O(Pe(e)(n,r),o=>Pe(t)(o,r)))),Vv=d(2,(e,t)=>Ge((n,r)=>O(Pe(e)(n,r),o=>{let s=ft(o,i=>Lo(i)?ct(i):go(bP(i)));return Y(Pe(t)(s,r),i=>Pw(i,a=>Gd(a)?ct(a.value):go(a)))}))),Ta=e=>Ge((t,n)=>{let r;return v(V(()=>r||e.pipe(Do(n),O(o=>Pe(o)(t,n)),O(o=>r=o))))}),ZD=e=>Ds((t,n,r)=>Y(Do(Pe(e)(t,n),r),Do(r)));var QD=d(2,(e,t)=>Ge(Se(function*(n,r){let o=yield*Pe(e)(n,r),s=yield*no({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*_t(r,Ps(s)),yield*o.pipe(O(i=>er(s,i)),Ht({disableYield:!0}),xo(i=>Zt(s,i)),Ut(r)),Vo(s)}))),YD=d(2,(e,t)=>Ge(Se(function*(n,r){let o=yield*Pe(e)(n,r),s=yield*no({capacity:t.capacity==="unbounded"?void 0:t.capacity,strategy:t.capacity==="unbounded"?void 0:t.strategy});return yield*_t(r,Ps(s)),yield*o.pipe(O(i=>Ia(s,i)),Ht({disableYield:!0}),xo(i=>Zt(s,i)),Ut(r)),Rl(s)}))),XD=d(2,(e,t)=>_y(e,jn(v(O(t,me))),{haltStrategy:"either"})),eN=d(2,(e,t)=>Ds(Se(function*(n,r,o){let s=yield*Pe(e)(n,r),i=yield*Ut(t,o,{startImmediately:!0});return V(()=>{let a=i.pollUnsafe();return a===void 0?s:IP(a,{onFailure:ct,onSuccess:me})})}))),tN=d(2,(e,t)=>Qp(e,n=>ii(n)?t(n.cause):H)),Qp=d(2,(e,t)=>Ds((n,r,o)=>No(o,t).pipe(Dn(Pe(e)(n,r))))),nN=d(2,(e,t)=>Ta(zt(t,e))),Kv=d(2,(e,t)=>Us(e,n=>se(()=>{let r=!0,o=Mt(n,s=>(r=!1,t(s)));return V(()=>r?o:n)}))),rN=d(2,(e,t)=>Us(e,n=>v(jt(n,r=>O(t,()=>me(r)))))),oN=d(2,(e,t)=>Qp(e,n=>t)),Nu=(e,t,n)=>V(()=>{let r=Hr(),o=Pe(e)(me(),r);return jt(O(o,t),n||v).pipe(fr(s=>Je(r,s)))});var My=d(2,(e,t)=>Ge((n,r)=>Y(Nn(Pe(e)(n,r),t),Nn(t)))),Py=d(3,(e,t,n)=>Ge((r,o)=>Y($o(Pe(e)(r,o),t,n),$o(t,n)))),Fy=d(3,(e,t,n)=>Ge((r,o)=>O(n,s=>Pe(Py(e,t,s))(r,o)))),sN=d(e=>tr(e[0]),(e,t,n)=>Dd(t)?My(e,t):Ge((r,o)=>O(n?.local?ci(t,ai(),o):Zd(t,o),s=>Y(Nn(Pe(e)(r,o),s),Nn(s))))),iN=d(2,(e,t)=>Ge((n,r)=>ur(o=>{let s=t(o);return Pe(My(e,s))(n,r)})));var Jv=function(){let e=tr(arguments[0]),t=e?arguments[1]:arguments[0],n=Fo(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return cD(r,t,n)}return r=>cD(r,t,n)},cD=(e,t,n)=>_J(Jw(t,n),r=>Py(e,ti,r),(r,o)=>xn(s=>{let i=s.getRef(ho),a=s.getRef(CP);return Bg(r,o,i,a)}));var aN=e=>Nu(e,t=>Ht(t,{disableYield:!0})),Lu=d(2,(e,t)=>Nu(e,n=>Ht(O(n,t),{disableYield:!0}))),cN=d(2,(e,t)=>Nu(e,n=>n.pipe(O(t),O(r=>r?H:me()),Ht({disableYield:!0})))),Gv=e=>Y(Bu(e,()=>({bytes:0,arrays:[]}),(t,n)=>{for(let r=0;r<n.length;r++)t.bytes+=n[r].length,t.arrays.push(n[r]);return t}),({arrays:t,bytes:n})=>{let r=new Uint8Array(n),o=0;for(let s=0;s<t.length;s++){let i=t[s];r.set(i,o),o+=i.length}return r});var uN=e=>V(()=>{let t=D();return Nu(e,n=>n.pipe(dx,O(r=>(t=r,me()))),()=>v(t))}),fN=e=>V(()=>{let t=Symbol(),n=t;return Nu(e,r=>Ht(O(r,o=>(n=o,H)),{disableYield:!0}),()=>n===t?ws:fx(n))}),Bu=d(3,(e,t,n)=>V(()=>{let r=t();return Nu(e,o=>Yn({while:Xt,body:()=>o,step:s=>{r=n(r,s)}}),()=>v(r))})),lN=d(3,(e,t,n)=>V(()=>{let r=t();return Nu(e,o=>Yn({while:Xt,body:Qe(o.pipe(O(s=>n(r,s)),Y(s=>{r=s}))),step:bn}),()=>v(r))})),Zv=Se(function*(e){let t=va(1),n=yield*cr(),r=$e(n,It);return(yield*Pe(e)(me(),r)).pipe(Nn(n),t.withPermits(1))},ft(e=>v(ct(e)))),Ko=(e,t)=>Pe(e)(me(),t);var Qv=d(e=>tr(e[0]),(e,t)=>So(n=>Lu(e,r=>Ia(t,r)).pipe(n,Jr,O(r=>(Ft(r)?nD(t):wi(t,r.cause),H)))));var dN=d(e=>tr(e[0]),Se(function*(e,t){let n=yield*zo,r=yield*no({capacity:typeof t.capacity=="number"?t.capacity:void 0,strategy:typeof t.capacity=="number"?t.strategy:void 0});return yield*_t(n,Ps(r)),yield*Ut(Qv(e,r),n),r}));var pN=e=>ic(e.capacity==="unbounded"?Hp(e):e.strategy==="dropping"?my(e):e.strategy==="sliding"?hy(e):py(e),Wp),mN=d(2,Se(function*(e,t){let n=yield*pN(t);return yield*vs(Yv(e,n,{shutdownOnEnd:t.shutdownOnEnd!==!1})),n})),Yv=d(e=>tr(e[0]),(e,t,n)=>Lu(e,r=>X1(t,r)).pipe(n?.shutdownOnEnd===!0?ua(Wp(t)):B)),hN=d(2,Se(function*(e,t){let n=yield*pN(t);return yield*Lu(e,r=>kl(n,r)).pipe(fr(r=>kl(n,r)),vs),n}));var k={};rs(k,{Any:()=>q5,Array:()=>Wt,ArrayEnsure:()=>G5,BigDecimal:()=>tk,BigDecimalFromString:()=>KQ,BigDecimalReviver:()=>VQ,BigInt:()=>Ti,BigIntFromString:()=>r7,Boolean:()=>vc,BooleanFromBit:()=>f7,Cause:()=>Hl,CauseReason:()=>sS,CauseReasonReviver:()=>gQ,CauseReviver:()=>xQ,Char:()=>rQ,Chunk:()=>DB,ChunkReviver:()=>OQ,Class:()=>hS,Date:()=>$s,DateFromMillis:()=>DQ,DateFromString:()=>UQ,DateReviver:()=>FQ,DateTimeUtc:()=>km,DateTimeUtcFromDate:()=>g7,DateTimeUtcFromMillis:()=>y7,DateTimeUtcFromString:()=>x7,DateTimeUtcReviver:()=>h7,DateTimeZoned:()=>ak,DateTimeZonedFromString:()=>T7,DateTimeZonedReviver:()=>v7,Defect:()=>ln,Duration:()=>Tm,DurationFromMillis:()=>jQ,DurationFromNanos:()=>qQ,DurationFromString:()=>BQ,DurationReviver:()=>NQ,Enum:()=>B5,Error:()=>$n,ErrorInstance:()=>AB,ErrorInstanceReviver:()=>EQ,Exit:()=>pS,ExitReviver:()=>bQ,File:()=>nk,FileReviver:()=>ZQ,Finite:()=>js,FiniteFromString:()=>n7,FormData:()=>rk,FormDataReviver:()=>QQ,Graph:()=>MB,GraphReviver:()=>kQ,HashMap:()=>PB,HashMapReviver:()=>CQ,HashSet:()=>UB,HashSetReviver:()=>RQ,Int:()=>zs,Json:()=>Am,JsonObject:()=>u9,JsonReviver:()=>f9,Literal:()=>Rt,Literals:()=>Ca,MutableJson:()=>aq,MutableJsonReviver:()=>d9,Natural:()=>nr,Never:()=>Ic,NonEmptyArray:()=>fS,NonEmptyString:()=>nQ,Null:()=>tt,NullOr:()=>zT,NullishOr:()=>IL,Number:()=>Kl,NumberFromString:()=>t7,ObjectKeyword:()=>j5,Opaque:()=>uZ,Option:()=>ki,OptionFromNullOr:()=>sQ,OptionFromNullishOr:()=>aQ,OptionFromOptional:()=>uQ,OptionFromOptionalKey:()=>cQ,OptionFromOptionalNullOr:()=>fQ,OptionFromUndefinedOr:()=>iQ,OptionReviver:()=>oQ,PropertyKey:()=>UT,ReadonlyMap:()=>_B,ReadonlyMapReviver:()=>wQ,ReadonlySet:()=>FB,ReadonlySetReviver:()=>AQ,Record:()=>$T,Redacted:()=>YT,RedactedFromValue:()=>hQ,RedactedReviver:()=>mQ,RegExp:()=>NB,RegExpReviver:()=>_Q,Result:()=>SB,ResultReviver:()=>lQ,SchemaError:()=>Pr,StandardSchemaV1FailureResult:()=>u7,String:()=>fe,StringFromBase64:()=>s7,StringFromBase64Url:()=>i7,StringFromHex:()=>a7,StringFromUriComponent:()=>c7,Struct:()=>oe,StructWithRest:()=>K5,Symbol:()=>EL,TaggedClass:()=>R7,TaggedError:()=>uk,TaggedStruct:()=>Tc,TaggedUnion:()=>cZ,TemplateLiteral:()=>N5,TemplateLiteralParser:()=>L5,TimeZone:()=>ik,TimeZoneFromString:()=>I7,TimeZoneNamed:()=>sk,TimeZoneNamedFromString:()=>b7,TimeZoneNamedReviver:()=>E7,TimeZoneOffset:()=>VB,TimeZoneOffsetReviver:()=>S7,TimeZoneReviver:()=>w7,Tree:()=>c9,Trim:()=>o7,Trimmed:()=>HB,Tuple:()=>bc,TupleWithRest:()=>J5,URL:()=>XT,URLFromString:()=>PQ,URLReviver:()=>MQ,URLSearchParams:()=>ok,URLSearchParamsReviver:()=>XQ,Uint8Array:()=>Zo,Uint8ArrayFromBase64:()=>d7,Uint8ArrayFromBase64Url:()=>p7,Uint8ArrayFromHex:()=>m7,Uint8ArrayReviver:()=>l7,Undefined:()=>qT,UndefinedOr:()=>lS,Union:()=>He,UniqueArray:()=>Z5,UniqueSymbol:()=>$5,Unknown:()=>BT,UnknownFromJsonString:()=>GQ,Void:()=>Jl,annotate:()=>g5,annotateEncoded:()=>x5,annotateKey:()=>y5,asserts:()=>w5,brand:()=>TL,catchDecoding:()=>tZ,catchDecodingWithContext:()=>AL,catchEncoding:()=>nZ,catchEncodingWithContext:()=>RL,check:()=>Y5,declare:()=>ro,declareConstructor:()=>An,decode:()=>rZ,decodeEffect:()=>I5,decodeExit:()=>dL,decodeOption:()=>T5,decodePromise:()=>C5,decodeResult:()=>k5,decodeSync:()=>xm,decodeTo:()=>Ee,decodeUnknownEffect:()=>wc,decodeUnknownExit:()=>lL,decodeUnknownOption:()=>v5,decodeUnknownPromise:()=>mL,decodeUnknownResult:()=>pL,decodeUnknownSync:()=>aS,encode:()=>oZ,encodeEffect:()=>cS,encodeExit:()=>gL,encodeKeys:()=>W5,encodeOption:()=>R5,encodePromise:()=>_5,encodeResult:()=>O5,encodeSync:()=>LT,encodeTo:()=>HT,encodeUnknownEffect:()=>ym,encodeUnknownExit:()=>hL,encodeUnknownOption:()=>A5,encodeUnknownPromise:()=>yL,encodeUnknownResult:()=>xL,encodeUnknownSync:()=>uS,extendTo:()=>V5,fieldsAssign:()=>z5,flip:()=>PT,fromBrand:()=>eZ,fromFormData:()=>YQ,fromJsonString:()=>zB,fromURLSearchParams:()=>e7,instanceOf:()=>kc,is:()=>iL,isBase64:()=>KT,isBase64Reviver:()=>bZ,isBase64Url:()=>qL,isBase64UrlReviver:()=>wZ,isBetween:()=>dS,isBetweenBigDecimal:()=>HZ,isBetweenBigInt:()=>uB,isBetweenBigIntReviver:()=>n9,isBetweenDate:()=>oB,isBetweenDateReviver:()=>Q7,isBetweenReviver:()=>UZ,isCapitalized:()=>VL,isCapitalizedReviver:()=>AZ,isEndsWith:()=>$L,isEndsWithReviver:()=>vZ,isFinite:()=>JL,isFiniteReviver:()=>OZ,isGUID:()=>LL,isGUIDReviver:()=>SZ,isGreaterThan:()=>ZL,isGreaterThanBigDecimal:()=>qZ,isGreaterThanBigInt:()=>sB,isGreaterThanBigIntReviver:()=>Y7,isGreaterThanDate:()=>eB,isGreaterThanDateReviver:()=>K7,isGreaterThanOrEqualTo:()=>JT,isGreaterThanOrEqualToBigDecimal:()=>jZ,isGreaterThanOrEqualToBigInt:()=>iB,isGreaterThanOrEqualToBigIntReviver:()=>X7,isGreaterThanOrEqualToDate:()=>tB,isGreaterThanOrEqualToDateReviver:()=>J7,isGreaterThanOrEqualToReviver:()=>MZ,isGreaterThanReviver:()=>_Z,isIncludes:()=>zL,isIncludesReviver:()=>TZ,isInt:()=>vm,isInt32:()=>LZ,isIntReviver:()=>NZ,isLengthBetween:()=>ZT,isLengthBetweenReviver:()=>KZ,isLessThan:()=>QL,isLessThanBigDecimal:()=>$Z,isLessThanBigInt:()=>aB,isLessThanBigIntReviver:()=>e9,isLessThanDate:()=>nB,isLessThanDateReviver:()=>G7,isLessThanOrEqualTo:()=>YL,isLessThanOrEqualToBigDecimal:()=>zZ,isLessThanOrEqualToBigInt:()=>cB,isLessThanOrEqualToBigIntReviver:()=>t9,isLessThanOrEqualToDate:()=>rB,isLessThanOrEqualToDateReviver:()=>Z7,isLessThanOrEqualToReviver:()=>FZ,isLessThanReviver:()=>PZ,isLowercased:()=>WL,isLowercasedReviver:()=>CZ,isMaxLength:()=>lB,isMaxLengthReviver:()=>VZ,isMaxProperties:()=>gB,isMaxPropertiesReviver:()=>YZ,isMaxSize:()=>pB,isMaxSizeReviver:()=>GZ,isMinLength:()=>GT,isMinLengthReviver:()=>WZ,isMinProperties:()=>hB,isMinPropertiesReviver:()=>QZ,isMinSize:()=>dB,isMinSizeReviver:()=>JZ,isMultipleOf:()=>XL,isMultipleOfReviver:()=>DZ,isNonEmpty:()=>fB,isPattern:()=>Zu,isPatternReviver:()=>pZ,isPropertiesLengthBetween:()=>xB,isPropertiesLengthBetweenReviver:()=>XZ,isPropertyNames:()=>yB,isPropertyNamesReviver:()=>eQ,isSchema:()=>Gu,isSchemaError:()=>Wl,isSizeBetween:()=>mB,isSizeBetweenReviver:()=>ZZ,isStartsWith:()=>jL,isStartsWithReviver:()=>IZ,isStringBigInt:()=>UL,isStringBigIntReviver:()=>hZ,isStringFinite:()=>FL,isStringFiniteReviver:()=>mZ,isStringSymbol:()=>DL,isStringSymbolReviver:()=>gZ,isTrimmed:()=>VT,isTrimmedReviver:()=>lZ,isULID:()=>BL,isULIDReviver:()=>EZ,isUUID:()=>NL,isUUIDReviver:()=>yZ,isUint32:()=>BZ,isUncapitalized:()=>KL,isUncapitalizedReviver:()=>RZ,isUnique:()=>QT,isUniqueReviver:()=>tQ,isUppercased:()=>HL,isUppercasedReviver:()=>kZ,link:()=>pt,make:()=>re,makeFilter:()=>Tt,makeFilterGroup:()=>fZ,makeIsBetween:()=>Im,makeIsGreaterThan:()=>Sm,makeIsGreaterThanOrEqualTo:()=>Em,makeIsLessThan:()=>bm,makeIsLessThanOrEqualTo:()=>wm,makeIsMultipleOf:()=>GL,middlewareDecoding:()=>kL,middlewareEncoding:()=>CL,mutable:()=>Q5,mutableKey:()=>F5,optional:()=>Pt,optionalKey:()=>Ju,overrideToCodecIso:()=>i9,overrideToEquivalence:()=>P7,overrideToFormatter:()=>_7,readonlyKey:()=>U5,refine:()=>X5,required:()=>P5,requiredKey:()=>M5,resolveAnnotations:()=>p9,resolveAnnotationsKey:()=>m9,revealBottom:()=>h5,revealCodec:()=>S5,suspend:()=>vL,tag:()=>Ze,tagDefaultOmit:()=>aZ,toArbitrary:()=>O7,toCodecArrayFromSingle:()=>B7,toCodecIso:()=>eq,toCodecJson:()=>Cc,toCodecJsonAST:()=>gS,toCodecStringTree:()=>nq,toDifferJsonPatch:()=>a9,toEncoded:()=>Vl,toEncoderXml:()=>q7,toEquivalence:()=>F7,toFormatter:()=>M7,toIso:()=>r9,toIsoFocus:()=>s9,toIsoSource:()=>o9,toJsonSchemaDocument:()=>QB,toRepresentation:()=>U7,toStandardJSONSchemaV1:()=>b5,toStandardSchemaV1:()=>E5,toTaggedUnion:()=>PL,toType:()=>Fr,withConstructorDefault:()=>OL,withDecodingDefault:()=>ML,withDecodingDefaultKey:()=>WT,withDecodingDefaultType:()=>iZ,withDecodingDefaultTypeKey:()=>sZ});var Dy="~effect/collections/Graph",Xv=e=>e;var LJ=(e,t,n)=>(e==="directed"?t.source===n.source&&t.target===n.target:t.source===n.source&&t.target===n.target||t.source===n.target&&t.target===n.source)&&ae(t.data,n.data),BJ=(e,t)=>e==="directed"?ce(t):Ua(ce(t.data)^ce(t.source)+ce(t.target)),qJ={[Dy]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[at](){return this.toJSON()},[_e](e){if(q(e,Dy)){let t=Xv(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[n,r]of this.nodes)if(!t.nodes.has(n)||!ae(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!LJ(this.type,r,o))return!1}return!0}return!1},[Oe](){let e=it("Graph");e=e^it(this.type),e=e^Lr(this.nodes.size),e=e^Lr(this.edges.size);for(let[t,n]of this.nodes)e=e^ce(t)+ce(n);for(let[t,n]of this.edges)e=e^ce(t)+BJ(this.type,n);return e},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return ie(this,arguments)}},gN=(e,t)=>{let n=Object.create(qJ);return n.type=e,n.mutable=t,n.transforming=!1,n.nodes=new Map,n.edges=new Map,n.adjacency=new Map,n.reverseAdjacency=new Map,n.nextNodeIndex=0,n.nextEdgeIndex=0,n.acyclic=L(!0),n};var Yp=e=>{let t=Xv(e);return{type:e.type,nodes:Array.from(t.nodes,([n,r])=>({index:n,data:r})).sort((n,r)=>n.index-r.index),edges:Array.from(t.edges,([n,r])=>({index:n,source:r.source,target:r.target,data:r.data})).sort((n,r)=>n.index-r.index)}},Xp=e=>{let t=gN(e.type,!1);for(let n of e.nodes)t.nodes.set(n.index,n.data),t.adjacency.set(n.index,[]),t.reverseAdjacency.set(n.index,[]);for(let n of e.edges)t.edges.set(n.index,{source:n.source,target:n.target,data:n.data}),t.adjacency.get(n.source).push(n.index),t.reverseAdjacency.get(n.target).push(n.index),e.type==="undirected"&&(t.adjacency.get(n.target).push(n.index),t.reverseAdjacency.get(n.source).push(n.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=D(),t};var jJ=Dy;var eT=e=>q(e,jJ);var yN=class e{type;source;target;identity;constructor(t,n,r,o){this.type=t,this.source=n,this.target=r,this.identity=o}[_e](t){return!(t instanceof e)||this.type!==t.type||!ae(this.identity,t.identity)?!1:this.type==="directed"?ae(this.source,t.source)&&ae(this.target,t.target):ae(this.source,t.source)&&ae(this.target,t.target)||ae(this.source,t.target)&&ae(this.target,t.source)}[Oe](){let t=ce(this.identity);return this.type==="directed"?Nt(ce(this.target))(Nt(ce(this.source))(t)):Ua(t^ce(this.source)+ce(this.target))}};var Ly="~effect/collections/HashMap",Ls=5,tm=1<<Ls,$J=tm/4,EN=tm/2,zJ=tm-1,HJ=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),em=(e,t)=>e>>>t&zJ,xc=(e,t)=>1<<em(e,t),Ny=(e,t)=>HJ(e&t-1);function bN(e,t,n,r,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let i=xc(n,t),a=xc(o,t);if(i===a){let f=bN(e,t+Ls,n,r,o,s);return new $u(e,i,[f])}let c=i|a,u=i>>>0<a>>>0?[r,s]:[s,r];return new $u(e,c,u)}var qu=class{canEdit(t){return this.edit===t}},tT=class extends qu{_tag="EmptyNode";edit=0;get size(){return 0}get(t,n,r){return D()}has(t,n,r){return!1}set(t,n,r,o,s,i){return i.value=!0,new ju(t,r,o,s)}remove(t,n,r,o,s){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(t){return!1}},ju=class e extends qu{_tag="LeafNode";edit;hash;key;value;constructor(t,n,r,o){super(),this.edit=t,this.hash=n,this.key=r,this.value=o}get size(){return 1}get(t,n,r){return this.hash===n&&ae(this.key,r)?L(this.value):D()}has(t,n,r){return this.hash===n&&ae(this.key,r)}set(t,n,r,o,s,i){if(this.hash===r&&ae(this.key,o))return ae(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,r,o,s);if(i.value=!0,this.hash===r)return new nT(t,r,[[this.key,this.value],[o,s]]);let a=xc(r,n),c=xc(this.hash,n);if(a===c)return new $u(t,a,[this.set(t,n+Ls,r,o,s,i)]);let u=a|c,f=a>>>0<c>>>0?[new e(t,r,o,s),this]:[this,new e(t,r,o,s)];return new $u(t,u,f)}remove(t,n,r,o,s){if(this.hash===r&&ae(this.key,o)){s.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},nT=class e extends qu{_tag="CollisionNode";edit;hash;entries;constructor(t,n,r){super(),this.edit=t,this.hash=n,this.entries=r}get size(){return this.entries.length}get(t,n,r){if(this.hash!==n)return D();for(let[o,s]of this.entries)if(ae(o,r))return L(s);return D()}has(t,n,r){if(this.hash!==n)return!1;for(let[o]of this.entries)if(ae(o,r))return!0;return!1}set(t,n,r,o,s,i){if(this.hash!==r)return i.value=!0,bN(t,n,this.hash,this,r,new ju(t,r,o,s));for(let a=0;a<this.entries.length;a++)if(ae(this.entries[a][0],o)){if(ae(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,n,r,o,s){if(this.hash!==r)return this;let i=this.entries.findIndex(([c])=>ae(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 ju(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)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},$u=class e extends qu{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,n,r){super(),this.edit=t,this.bitmap=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+n.size,0)),this._size}get(t,n,r){let o=xc(n,t);if((this.bitmap&o)===0)return D();let s=Ny(this.bitmap,o);return this.children[s].get(t+Ls,n,r)}has(t,n,r){let o=xc(n,t);if((this.bitmap&o)===0)return!1;let s=Ny(this.bitmap,o);return this.children[s].has(t+Ls,n,r)}set(t,n,r,o,s,i){let a=xc(r,n),c=Ny(this.bitmap,a);if((this.bitmap&a)!==0){let u=this.children[c],f=u.set(t,n+Ls,r,o,s,i);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let l=[...this.children];return l[c]=f,new e(t,this.bitmap,l)}else{i.value=!0;let u=new ju(t,r,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>EN?this.expand(t,f,this.children):this;let l=[...this.children];return l.splice(c,0,u),l.length>EN?this.expand(t,f,l):new e(t,f,l)}}remove(t,n,r,o,s){let i=xc(r,n);if((this.bitmap&i)===0)return this;let a=Ny(this.bitmap,i),c=this.children[a],u=c.remove(t,n+Ls,r,o,s);if(!s.value)return this;if(u===void 0){let l=this.bitmap^i;if(l===0)return;if(this.children.length===2){let m=this.children[a===0?1:0];if(m._tag==="LeafNode")return m}if(this.canEdit(t))return this.children.splice(a,1),this.bitmap=l,this._size=void 0,this;let p=[...this.children];return p.splice(a,1),new e(t,l,p)}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,n,r){let o=new globalThis.Array(tm),s=0;for(let i=0;i<tm;i++)(n&1<<i)!==0&&(o[i]=r[s++]);return new rT(t,r.length,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){n||(n=this.children[t].iterator());let r=n.next();if(!r.done)return r;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},rT=class e extends qu{_tag="ArrayNode";edit;_size;count;children;constructor(t,n,r){super(),this.edit=t,this.count=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+(n?.size??0),0)),this._size}get(t,n,r){let o=em(n,t),s=this.children[o];return s?s.get(t+Ls,n,r):D()}has(t,n,r){let o=em(n,t),s=this.children[o];return s?s.has(t+Ls,n,r):!1}set(t,n,r,o,s,i){let a=em(r,n),c=this.children[a];if(c){let u=c.set(t,n+Ls,r,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 ju(t,r,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,n,r,o,s){let i=em(r,n),a=this.children[i];if(!a)return this;let c=a.remove(t,n+Ls,r,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<$J)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,n,r){let o=[],s=0,i=1;for(let a=0;a<this.children.length;a++){let c=a===n?r:this.children[a];c&&(o.push(c),s|=i),i<<=1}return new $u(t,s,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){let r=this.children[t];if(!r){t++;continue}n||(n=r.iterator());let o=n.next();if(!o.done)return o;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},nm=class{[Ly]=Ly;_editable;_edit;_root;_size;constructor(t,n,r,o){this._editable=t,this._edit=n,this._root=r,this._size=o}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[_e](t){if(oT(t)){let n=t;if(this.size!==n.size)return!1;for(let[r,o]of this){let s=lf(t,vN(r));if(xe(s)||!ae(o,s.value))return!1}return!0}return!1}[Oe](){let t=it("HashMap");for(let[n,r]of this)t=t^ce(n)+ce(r);return t}[at](){return hn(this)}toString(){return`HashMap(${X(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,n])=>[hn(t),hn(n)])}}pipe(){return ie(this,arguments)}},wN=new tT,oT=e=>q(e,Ly),sT=()=>new nm(!1,0,wN,0);var IN=e=>{let t=wN,n=0,r={value:!1};for(let[o,s]of e){let i=ce(o);r.value=!1,t=t.set(NaN,0,i,o,s,r),r.value&&n++}return new nm(!1,0,t,n)};var vN=d(2,(e,t)=>e._root.get(0,ce(t),t));var iT=d(2,(e,t)=>e._root.has(0,ce(t),t));var WJ=(e,t,n,r)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,n,t,r,s);return o._editable?(o._root=a,s.value&&o._size++,e):o._root===a?e:new nm(!1,o._edit,a,o._size+(s.value?1:0))},aT=d(3,(e,t,n)=>WJ(e,t,ce(t),n)),cT=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();return n.done?{done:!0,value:void 0}:{done:!1,value:n.value[0]}}}};var TN=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},By=e=>e.size;var qy=oT;var jy=IN;var JJ=TN,$y=e=>Array.from(JJ(e)),CN=By;var rm="~effect/collections/HashSet",GJ={[Oe](){return ce(rm)},[_e](e){return fT(e)&&zy(this)===zy(e)&&ON(this,t=>RN(e,t))},[Symbol.iterator](){return cT(lT(this))},toString(){return`HashSet(${X(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:hn(Array.from(this))}},[at](){return this.toJSON()},pipe(){return ie(this,arguments)}},ZJ=e=>{let t=Object.create(GJ);return t[rm]=rm,t.keyMap=e,t},fT=e=>q(e,rm),lT=e=>e.keyMap;var AN=e=>{let t=sT();for(let n of e)t=aT(t,n,!0);return ZJ(t)},RN=(e,t)=>iT(lT(e),t);var zy=e=>By(lT(e));var ON=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var Hy=AN,Wy=fT;var _N=zy;function Vy(e){let t=zN(Jy,yn(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Ky(e){let t=Vy(e);return(n,r)=>{let o=ac(t(n,r));return Ft(o)?L(o.value):(pa(o.cause,"Option adapter can only return none for schema issues"),D())}}function PN(e){let t=Vy(e);return(n,r)=>{let o=ac(t(n,r));if(Ft(o))return o.value;let s=pa(o.cause,"Constructor adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function FN(e){return sm(e.ast)}function sm(e){let t=zu(im(yn(e)));return n=>{let r=t(n,eo);return Ft(r)?!0:(pa(r.cause,"Type guard adapter can only return false for schema issues"),!1)}}function UN(e){let t=im(e);return(n,r)=>{let o=ac(t(n,r));if(!Ft(o))return pa(o.cause,"Issue adapter can only return schema issues")}}function DN(e,t){let r=zu(im(yn(e.ast)))(t,eo);if(ii(r)){let o=pa(r.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:o})}}function dt(e,t){let n=im(e.ast);return t===void 0?n:(r,o)=>n(r,om(t,o))}var pT=dt;function NN(e,t){return zu(dt(e,t))}function mT(e,t){return HN(dt(e,t))}var LN=mT;function BN(e,t){return WN(dt(e,t))}function YJ(e,t){return VN(dt(e,t))}var hT=YJ;function Pl(e,t){let n=im(Cs(e.ast));return t===void 0?n:(r,o)=>n(r,om(t,o))}function qN(e,t){return zu(Pl(e,t))}function gT(e,t){return HN(Pl(e,t))}var jN=gT;function $N(e,t){return WN(Pl(e,t))}function XJ(e,t){return VN(Pl(e,t))}var xT=XJ,om=(e,t)=>t?{...e,...t}:e,MN=e=>e===ze?G(new ke):v(e);function im(e){return zN(KN,e)}function zN(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??eo);return s===on?v(r):xt(s)?s[ye]===ze?MN(ze):s:Bn(s,MN)}}function zu(e){return(t,n)=>ac(e(t,n))}function HN(e){let t=zu(e);return(n,r)=>{let o=t(n,r);return Ft(o)?L(o.value):(pa(o.cause,"Option adapter can only return none for schema issues"),D())}}function WN(e){let t=zu(e);return(n,r)=>{let o=t(n,r);return Ft(o)?Ce(o.value):Ae(pa(o.cause,"Result adapter can only return schema issues"))}}function VN(e){let t=zu(e);return(n,r)=>{let o=t(n,r);if(Ft(o))return o.value;let s=pa(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}var KN=wn(e=>yT(e,KN)),Jy=wn(e=>yT(e,Jy,JN)),eG=wn(e=>yT(e,Jy,JN,e.context?.constructorDefault));function JN(e){return e.context?.constructorDefault?eG(e):Jy(e)}function GN(e,t,n,r){let o;if(xt(e)&&e._tag==="Success"){let s=bx(e===on?t:e[ye]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(Ho(s),r)}else n._tag==="Transformation"?o=Bn(e,s=>n.decode.run(bx(s),r)):o=n.decode(la(e,bx),r);return xt(o)&&o._tag==="Success"?nI(o[ye]):Bn(o,nI)}function tG(e,t){let n;return(r,o)=>{if(r===ze)return Ts;if(e.isConstructed(r))return on;let s=(n??=t(e.link.to))(r,o);return GN(s,r,e.link.transformation,o)}}function yT(e,t,n,r){let o=n?U1(e):void 0,s=o?tG(o,t):e.getParser(t,n),i=e.checks,a=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c)return u?(p,m)=>s(p,om(m,u)):s;let f,l=(p,m)=>{let h=s(p,m);if(c&&!m.disableChecks)if(xt(h)){if(h._tag==="Success"){let g=h===on?p:h[ye];if(p!==ze&&g!==ze){let y=Os(c,p,void 0,e,m);y&&(h=G(new At(e,y,p,m)))}}}else h=O(h,g=>{if(p!==ze&&g!==ze){let y=Os(c,p,void 0,e,m);if(y)return G(new At(e,y,p,m))}return v(g)});if(i&&!m.disableChecks)if(xt(h)){if(h._tag==="Success"){let g=h===on?p:h[ye];if(g===ze)return h;let y=Os(i,g,void 0,e,m);y&&(h=G(new At(e,y,g,m)))}}else h=O(h,g=>{if(g!==ze){let y=Os(i,g,void 0,e,m);if(y)return G(new At(e,y,g,m))}return v(g)});return h};return a?(p,m)=>{u&&(m=om(m,u));let h=f??=a.map(b=>t(b.to)),g=p,y=h[h.length-1](p,m);for(let b=a.length-1;b>=0;b--)if(y=GN(y,g,a[b].transformation,m),b!==0){let E=h[b-1];y._tag==="Success"?(g=y[ye],y=E(g,m)):y=Bn(y,x=>{let w=E(x,m);return w===on?Ho(x):w})}if(y._tag==="Success"){let b=y[ye],E=l(b,m);return E===on?y:E}return y=ft(y,b=>aa(()=>ec(b,E=>new Tx(e,E,p,m)))),Bn(y,b=>{let E=l(b,m);return E===on?Ho(b):E})}:u?(p,m)=>l(p,om(m,u)):l}var Gy="~effect/Schema/Schema";function Mr(e,t,n){return{id:e,payloadSchema:t,revive:n}}function Re(e,t,n){return{id:e,payloadSchema:t,revive:n}}var nG={[Gy]:Gy,pipe(){return ie(this,arguments)},annotate(e){return this.rebuild(Wo(this.ast,e))},annotateKey(e){return this.rebuild(El(this.ast,e))},check(...e){return this.rebuild(Si(this.ast,e))}};function am(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,nG),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=o=>am(o,t),r.makeEffect=Vy(r),r.make=PN(r),r.makeOption=Ky(r),r}var ZN=d(2,(e,t)=>ET(e,(n,r)=>t.includes(n)?[n,r]:void 0)),QN=d(2,(e,t)=>ET(e,(n,r)=>t.includes(n)?void 0:[n,r])),YN=d(2,(e,t)=>({...e,...t}));var ST=d(2,(e,t)=>ET(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]));var pr=e=>e;function ET(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,i]=o;W(n,s,i)}}return n}function XN(e,t){let n=t?.omitKeyWhen??(()=>!1);return Rh((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);n(c)||W(i,a,c)}return i})}function cm(e){return To((t,n)=>t===void 0?n:n===void 0?t:e.combine(t,n),void 0)}function vi(e,t){return t.length>0&&(e+=`
30
+ at ${Oh(t)}`),new Error(e)}var t2=new WeakMap,n2=new WeakMap,r2=[];function ka(e){return new Error(`Unable to derive an arbitrary for ${e}`)}var o2=([e],[t])=>ae(e,t);function oG(e,t,n){return t.reduce((r,o)=>r.filter(s=>o.run(s,e,eo)===void 0),n)}function m2(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw ka(`${t} constraints`)}function h2(e){return e===void 0||e.minLength===void 0&&e.maxLength===void 0?void 0:{...e.minLength!==void 0?{minLength:e.minLength}:{},...e.maxLength!==void 0?{maxLength:e.maxLength}:{}}}function bT(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function s2(e,t,n,r=!1){let o=t.constraint,s=h2(o);return m2(s,"array"),bT(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?ae:void 0)}function Qy(e,t,n,r){return t.chain(o=>o.length<n?e.constant(o):r.map(s=>[...o,...s]))}function i2(e,t){return e.chain(n=>t.map(r=>({...Object.fromEntries(r),...n})))}var sG=cm(sF),iG=cm(iF),Yy=cm(HR),aG=cm(MR()),cG=XN({integer:Yy,maxLength:iG,minLength:sG,noInfinity:Yy,noNaN:Yy,patterns:aG,unique:Yy},{omitKeyWhen:qA});function a2(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function uG(e,t){if(e===void 0)return t;if(e.order!==t.order)throw new Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=a2(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=a2(e.order,e.maximum,e.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1);return{order:e.order,...n!==void 0?{minimum:n}:{},...r!==void 0?{exclusiveMinimum:r}:{},...o!==void 0?{maximum:o}:{},...s!==void 0?{exclusiveMaximum:s}:{}}}function fG(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,i=o===void 0?n:uG(n,o);return{...cG.combine(r,s),...i===void 0?{}:{ordered:i}}}function c2(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary&&n.push(o.annotations.arbitrary),o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function lG(e){let t=e.map(({constraint:n})=>n).filter(Kn);return n=>{let r=t.reduce((o,s)=>fG(o,s),n.constraint);return{...n,constraint:r}}}function um(e){return{...e,constraint:void 0}}function u2(e,t,n){if(t===void 0||t.minLength===void 0&&t.maxLength===void 0)return;if(t.minLength!==void 0&&e.indexSignatures.length===0&&t.minLength>e.propertySignatures.length)throw ka("object property constraints");let r={};if(t.minLength!==void 0&&(r.minLength=Math.max(0,t.minLength-n)),t.maxLength!==void 0&&(r.maxLength=t.maxLength-n,r.maxLength<0))throw ka("object property constraints");return m2(r,"object property"),r}function dG(e,t,n,r,o,s){let i=r.length;if(s.maxLength!==void 0&&s.maxLength<i)throw ka("object property constraints");let a=s.minLength===void 0?0:Math.max(0,s.minLength-i),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-i);if(a>c)throw ka("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),f=e.shuffledSubarray([...o],{minLength:a,maxLength:c});return e.tuple(u,f).map(([l,p])=>{let m=new Set([...r,...p]),h={};for(let g of n)m.has(g)&&W(h,g,l[g]);return h})}function g2(e,t,n,r){let o={};if(e?.minimum!==void 0&&(o.min=t(e.minimum,e.exclusiveMinimum===!0)),e?.maximum!==void 0&&(o.max=n(e.maximum,e.exclusiveMaximum===!0)),o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw ka(r);return o}function pG(e){return g2(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function mG(e,t){let n={...e?.noInfinity?{noDefaultInfinity:!0}:{},...e?.noNaN?{noNaN:!0}:{},...t?.minimum!==void 0?{min:t.minimum}:{},...t?.exclusiveMinimum!==void 0?{minExcluded:t.exclusiveMinimum}:{},...t?.maximum!==void 0?{max:t.maximum}:{},...t?.exclusiveMaximum!==void 0?{maxExcluded:t.exclusiveMaximum}:{}};if(n.min!==void 0&&n.max!==void 0&&(n.min>n.max||n.min===n.max&&(n.minExcluded||n.maxExcluded)))throw ka("number constraints");return n}function hG(e){return g2(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function Ul(e,t){let n=(r,o,s=r2)=>e(r,o,s);return n.terminal=(r,o,s=r2)=>t(r,o,s),n}function Jo(e){return Ul(e,e)}function f2(e,t){let n=n2.get(t)??e.createDepthIdentifier();return n2.set(t,n),{maxDepth:2,depthIdentifier:n}}function l2(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}var gG={noInfinity:!0,noNaN:!0};function xG(e){return{...e,constraint:gG}}function yG(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let i=s.make(e,t);if(i===void 0)continue;let a=s.weight??1;if(!globalThis.Number.isInteger(a)||a<=0)throw ka("a candidate with an invalid weight");o.push({arbitrary:i,weight:a})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function d2(e,t,n,r,o){let s=yG(n,r,t.arbitraries,o);return s===void 0?void 0:oG(e,t.filters,s)}function SG(e,t){if(!(typeof e=="object"&&e!==null&&"arbitrary"in e))return{arbitrary:e,terminal:t?void 0:e};let n="terminal"in e?e.terminal:t?void 0:e.arbitrary;return{arbitrary:e.arbitrary,terminal:n}}function EG(e,t,n,r,o){return e.map(s=>({arbitrary:o?t.constant(null).chain(()=>s(t,n,r)):s(t,n,r),terminal:s.terminal(t,n,r)}))}function p2(e,t,n,r){let o=lG(t.arbitraries);return Ul((s,i,a)=>{let c=o(i);return d2(e,t,s,c,n(s,i,c,a))},(s,i,a)=>{let c=o(i);return d2(e,t,s,c,r(s,i,c,a))})}var x2=wn(e=>Go(e,[]));function Go(e,t){let n=gi(e)?.toArbitrary;if(n){let r=pc(e)?e.typeParameters.map(i=>Go(i,t)):[],o=c2(e.checks),s=i=>(a,c,u,f)=>SG(n(EG(r,a,um(c),f,i))(a,u),r.length>0)[i?"terminal":"arbitrary"];return p2(e,o,s(!1),s(!0))}if(e.checks){let r=c2(e.checks),o=Go(Yx(e,void 0),t);return p2(e,r,(s,i,a,c)=>o(s,a,c),(s,i,a,c)=>o.terminal(s,a,c))}return bG(e,t)}function bG(e,t){switch(e._tag){case"Never":case"Declaration":throw vi(`Unsupported AST ${e._tag}`,t);case"Null":return Jo(n=>n.constant(null));case"Void":case"Undefined":return Jo(n=>n.constant(void 0));case"Unknown":case"Any":return Jo(n=>n.anything());case"String":return Jo((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map(i=>n.stringMatching(new RegExp(i)))):n.string(h2(o))});case"Number":return Jo((n,r)=>{let o=r.constraint,s=o?.ordered?.order===lo?o.ordered:void 0;return o?.integer?n.integer(pG(s)):n.float(mG(o,s))});case"Boolean":return Jo(n=>n.boolean());case"BigInt":return Jo((n,r)=>{let o=r.constraint?.ordered?.order===Oo?r.constraint.ordered:void 0;return n.bigInt(hG(o))});case"Symbol":return Jo(n=>n.string().map(Symbol.for));case"Literal":return Jo(n=>n.constant(e.literal));case"UniqueSymbol":return Jo(n=>n.constant(e.symbol));case"ObjectKeyword":return Jo(n=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return Go(Np(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>Go(qn(r),[...t,o]));return Jo((r,o,s)=>r.tuple(...n.map(i=>i(r,xG(o),s))).map(i=>i.map(a=>globalThis.String(a)).join("")))}case"Arrays":{let n=e.elements.map((i,a)=>({ast:i,arbitrary:Go(i,[...t,a])})),r=e.elements.length,o=e.rest.map((i,a)=>({ast:i,arbitrary:Go(i,[...t,r+a])})),s=(i,a,c)=>{let u=um(a),f=[],l=[],p=0;for(let E of n){let x=E.arbitrary.terminal(i,u,c);if(an(E.ast)){l.push(x);continue}if(x===void 0)return;p++,f.push(x.map(L))}let m=a.constraint?.minLength??0,g=Ye(o)&&m>p+l.length?l.length:Math.max(0,m-p),y=0;for(let E of l){if(y>=g||E===void 0){f.push(i.constant(D()));continue}y++,p++,f.push(E.map(L))}if(y<g)return;let b=i.tuple(...f).map(yb);if(Ye(o)){let[E,...x]=o,w=e.elements.length===0?a:u,S=Math.max(0,m-p-x.length),A=S===0?void 0:E.arbitrary.terminal(i,u,c);if(S>0&&A===void 0)return;let M=S===0?i.constant([]):s2(i,{...w,constraint:{...w.constraint,minLength:S}},A,!0);if(b=Qy(i,b,r,M),x.length>0){let R=[];for(let $ of x){let F=$.arbitrary.terminal(i,u,c);if(F===void 0)return;R.push(F)}let P=i.tuple(...R);b=Qy(i,b,r,P)}}return b};return Ul((i,a,c)=>{let u=um(a),f=n.map(({ast:p,arbitrary:m})=>{let h=m(i,u,c);return an(p)?h.chain(g=>i.boolean().map(y=>y?L(g):D())):h.map(L)}),l=i.tuple(...f).map(p=>yb(OR(p,Te)));if(Ye(o)){let[p,...m]=o.map(({arbitrary:g})=>g(i,u,c)),h=s2(i,e.elements.length===0?a:u,p);if(l=Qy(i,l,r,h),m.length>0){let g=i.tuple(...m);l=Qy(i,l,r,g)}}if(a.recursion){let p=s(i,a,c);if(p!==void 0)return i.oneof(a.recursion,p,l)}return l},s)}case"Objects":{let n=e.propertySignatures.map(s=>({ps:s,arbitrary:Go(s.type,[...t,s.name])})),r=e.indexSignatures.map(s=>({is:s,parameter:Go(s.parameter,t),type:Go(s.type,t)}));return Ul((s,i,a)=>{let c=um(i),u={},f=[],l=[],p=[];for(let{ps:y,arbitrary:b}of n){let E=y.name;f.push(E),an(y.type)?p.push(E):l.push(E),W(u,E,b(s,c,a))}let m=i.constraint;if(p.length>0&&r.length===0&&m!==void 0&&(m.minLength!==void 0||m.maxLength!==void 0))return dG(s,u,f,l,p,m);let h=s.record(u,{requiredKeys:l}),g=u2(e,i.constraint,l.length);for(let{parameter:y,type:b}of r){let E=s.tuple(y(s,c,a),b(s,c,a)),x=bT(s,E,g,o2);h=i2(h,x)}return h},(s,i,a)=>{let c=um(i),u={},f=[],l=[];for(let{ps:y,arbitrary:b}of n){let E=y.name,x=b.terminal(s,c,a);if(an(y.type)){x!==void 0&&l.push([E,x]);continue}if(x===void 0)return;f.push(E),W(u,E,x)}let p=Math.max(0,(i.constraint?.minLength??0)-f.length);for(let[y,b]of l){if(p===0)break;p--,f.push(y),W(u,y,b)}if(p>0&&e.indexSignatures.length===0)return;let m=s.record(u,{requiredKeys:f}),h=u2(e,i.constraint,f.length),g=h?.minLength??0;for(let{parameter:y,type:b}of r){let E;if(g===0)E=s.constant([]);else{let x=y.terminal(s,c,a),w=b.terminal(s,c,a);if(x===void 0||w===void 0)return;E=bT(s,s.tuple(x,w),{...h,maxLength:g},o2)}m=i2(m,E)}return m})}case"Union":{let n=e.types.map(o=>Go(o,t)),r=(o,s,i)=>l2(o,n.map(a=>a.terminal(o,s,i)).filter(Kn));return Ul((o,s,i)=>{let a=n.map(u=>u(o,s,i));if(s.recursion){let u=r(o,s,i);if(u!==void 0)return o.oneof(s.recursion,u,...a)}let c=l2(o,a);if(c===void 0)throw ka("a union with no members");return c},r)}case"Suspend":{let n=t2.get(e);if(n)return n;let r=_u(()=>Go(e.thunk(),t)),o=Ul((s,i,a)=>{let c=f2(s,e),u={...i,recursion:c},f=a.includes(e)?a:[...a,e],l=r().terminal(s,u,f);if(l===void 0)throw vi("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,l,s.constant(null).chain(()=>r()(s,u,f)))},(s,i,a)=>{if(a.includes(e))return;let c=f2(s,e);return r().terminal(s,{...i,recursion:c},[...a,e])});return t2.set(e,o),o}}}var y2=wn(e=>yc(e,[]));function yc(e,t){let n=gi(e)?.toEquivalence;if(n)return n(pc(e)?e.typeParameters.map(r=>yc(r,t)):[]);switch(e._tag){case"Never":return Hc();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ae;case"Arrays":{let r=e.elements.map((i,a)=>yc(i,[...t,a])),o=e.elements.length,s=e.rest.map((i,a)=>yc(i,[...t,o+a]));return un((i,a)=>{if(!Array.isArray(i)||!Array.isArray(a))return!1;let c=i.length;if(c!==a.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](i[u],a[u]))return!1;if(s.length>0){let[f,...l]=s;for(;u<c-l.length;u++)if(!f(i[u],a[u]))return!1;for(let p=0;p<l.length;p++)if(!l[p](i[u+p],a[u+p]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ae;let r=e.propertySignatures.map(s=>yc(s.type,[...t,s.name])),o=e.indexSignatures.map(s=>yc(s.type,t));return un((s,i)=>{if(!en(s)||!en(i))return!1;for(let a=0;a<r.length;a++){let c=e.propertySignatures[a],u=c.name,f=Object.hasOwn(s,u),l=Object.hasOwn(i,u);if(an(c.type)&&f!==l||f&&l&&!r[a](s[u],i[u]))return!1}for(let a=0;a<o.length;a++){let c=e.indexSignatures[a],u=ga(s,c.parameter),f=ga(i,c.parameter);if(u.length!==f.length)return!1;for(let l=0;l<u.length;l++){let p=u[l];if(!Object.hasOwn(i,p)||!o[a](s[p],i[p]))return!1}}return!0})}case"Union":{let r=yn(e).types,o=new Map(r.map((s,i)=>[s,[sm(s),yc(e.types[i],t)]]));return un((s,i)=>{let a=Mp(s,r);for(let c=0;c<a.length;c++){let[u,f]=o.get(a[c]);if(u(s)&&u(i))return f(s,i)}return!1})}case"Suspend":{let r=_u(()=>yc(e.thunk(),t));return un((o,s)=>r()(o,s))}}}function Hu(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Dl(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var TG="http://json-schema.org/draft-07/schema#",S2="https://json-schema.org/draft/2020-12/schema";function E2(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function I2(e){return{dialect:"draft-07",...MG(e,$G)}}function kG(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!en(r))return r;let i=o||!s&&k2(r.$id),a={};for(let c of Object.keys(r)){let u=r[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=IT(u,l=>n(l,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(l=>n(l,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=n(u,i)}W(a,c,f)}return t(a,i),a}}function v2(e,t){return kG(e,n=>{CG(n,t)})}function CG(e,t){typeof e.$ref=="string"&&W(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&W(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function IT(e,t){if(!en(e))return;let n={};for(let r of Object.keys(e))W(n,r,t(e[r],r));return n}function AG(e,t,n){let r=new Map,o=[],s=wT;function i(p,m=[],h=[]){if(m.length===0&&t?.trackIds){let g=en(p)?f(p):void 0;s=b2(g,wT)??wT}return u(p,m,h,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[p,m,h]of o){let g=m,y=T2(m,h);if(y!==void 0){let b=RG(y.hash);if(y.hash="",b!==void 0){let E=r.get(w2(y.href,b));E!==void 0&&(g=OG(m,E))}}W(p,"$ref",g)}}let c=n(i);return a(),c;function u(p,m,h,g){if(typeof p=="boolean")return l(m,h,g),t?.booleanAdapter?.(p)??p;if(!en(p))return p;let y=g,b=f(p);if(m.length>0&&t?.trackIds&&k2(b)){let w=b2(b,g.uri);w!==void 0&&(y={parent:g,sourceRoot:m,targetRoot:h,uri:w})}l(m,h,y);let E=y.uri,x={isDocumentRoot:m.length===0,schema(w,S,A=S){return u(w,[...m,S],[...h,A],y)},schemaAt(w,S,A){return u(w,[...m,...S],[...h,...A],y)},schemaArray(w,S,A=S){return Array.isArray(w)?w.map((M,R)=>u(M,[...m,S,String(R)],[...h,A,String(R)],y)):w},schemaMap(w,S,A=S){return en(w)?IT(w,(M,R)=>u(M,[...m,S,R],[...h,A,R],y)):w},reference(w,S){typeof S=="string"?o.push([w,S,E]):W(w,"$ref",S)}};return e(p,x)}function f(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function l(p,m,h){h.parent!==void 0&&l(p,m,h.parent),r.set(w2(h.uri,p.slice(h.sourceRoot.length)),m.slice(h.targetRoot.length))}}var wT="https://effect.invalid/.json-schema/";function T2(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function b2(e,t){if(typeof e!="string")return;let n=T2(e,t);if(n!==void 0)return n.hash="",n.href}function RG(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(t.startsWith("/"))return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(Dl)}function OG(e,t){let n=e.indexOf("#");return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${_G(t)}`}function _G(e){return e.length===0?"#":`#/${e.map(t=>encodeURI(Hu(t)).replace(/#/g,"%23")).join("/")}`}function w2(e,t){return`${e}\0${JSON.stringify(t)}`}function k2(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function MG(e,t,n){return AG(t,{...n,trackIds:!0},r=>({schema:r(e.schema),definitions:IT(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}var PG=new Set(["properties","patternProperties"]),FG=new Set(["allOf","anyOf","oneOf"]),UG=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function DG(e,t,n,r,o,s=PG){let i;if(s.has(t))i=r.schemaMap(n,t);else if(FG.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return W(e,t,i),!0}var C2=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],Dfe=[...C2,"deprecated"],Nfe=[...C2,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],NG=/^[A-Za-z_][-A-Za-z0-9._]*$/,LG=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Wu(e,t,n){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function BG(e,t,n,r){for(let o of t)Object.hasOwn(e,o)&&Wu(o,n,`it is not active in ${r} but would become active in the target`)}var qG=["additionalItems","definitions","dependencies"];function jG(e,t,n,r,o){n.isDocumentRoot?W(e,"$schema",E2(t,S2)?r:t):E2(t,S2)||Wu("$schema",o,"an embedded resource cannot declare a different dialect")}function $G(e,t){BG(e,qG,"Draft-07","Draft 2020-12");let n={},r,o,s;for(let i of Object.keys(e)){let a=e[i];if(!DG(n,i,a,t,UG))switch(i){case"$ref":r=a;break;case"$schema":jG(n,a,t,TG,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":W(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":Wu(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;W(n,i,a);break;default:W(n,i,a)}}if(zG(n,o,s,t),Object.hasOwn(e,"contains")){let i=e.minContains,a=e.maxContains;(i!==void 0&&i!==1||a!==void 0)&&Wu("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&W(n,"minContains",i)}else Object.hasOwn(e,"minContains")&&W(n,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&W(n,"maxContains",e.maxContains);return WG(e,n,t,"draft-07"),KG(e,n,"$id","Draft-07"),HG(n,r,t),n}function zG(e,t,n,r){if(t===void 0){n!==void 0&&W(e,"items",r.schema(n,"items"));return}W(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0&&W(e,"additionalItems",r.schema(n,"items","additionalItems"))}function HG(e,t,n){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),VG(e,r)}else n.reference(e,t)}function WG(e,t,n,r){let o=en(e.dependentRequired)?e.dependentRequired:void 0,s=en(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],l=r==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?l||W(i,c,u):u===void 0||l?W(i,c,n.schemaAt(f,["dependentSchemas",c],["dependencies",c])):W(i,c,{allOf:[n.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(i).length>0&&W(t,"dependencies",i)}function VG(e,t){Array.isArray(e.allOf)?e.allOf.push(t):W(e,"allOf",[t])}function KG(e,t,n,r){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&W(t,n,o);return}(typeof s!="string"||!NG.test(s))&&Wu("$anchor",r,"the anchor is not valid"),LG.test(s)||Wu("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?W(t,n,`#${s}`):Wu("$anchor",r,"it cannot be combined with the schema $id")}var Lfe=globalThis.RegExp;var Nl=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var JG=new Set([...$F,Tu,...qF]);function fm(e,t){if(e===void 0)return;let n={},r=e.title;typeof r=="string"&&(n.title=r);let o=e.description,s=e.expected;typeof o=="string"?n.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(n.description=s);let i=e.default;wl(i)&&(n.default=i);let a=e.examples;Array.isArray(a)&&wl(a)&&(n.examples=a);let c=e.readOnly;typeof c=="boolean"&&(n.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(n.writeOnly=u);let f=e.format;typeof f=="string"&&(n.format=f);let l=e.contentEncoding;typeof l=="string"&&(n.contentEncoding=l);let p=e.contentMediaType;typeof p=="string"&&(n.contentMediaType=p);let m=e.contentSchema;if(wl(m)&&(n.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[h,g]of Object.entries(e))JG.has(h)||!t.includeAnnotationKey(h)||wl(g)&&W(n,h,g);return Object.keys(n).length===0?void 0:n}function O2(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let i=O2(s);i.type!==void 0&&(o=!0,(t===void 0||i.type==="integer")&&(t=i.type)),Object.keys(i.schema).length>0&&r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function GG(e){return Array.isArray(e.anyOf)&&e.anyOf.length===4&&e.anyOf[0]?.type==="number"&&e.anyOf.slice(1).every(t=>t.type==="string")}var _2="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function TT(e,t){return Object.keys(e).every(n=>t.includes(`|${n}|`))}function R2(e,t){return typeof e.$ref!="string"&&t.every(n=>!Object.hasOwn(e,n))}var kT="|title|description|default|examples|readOnly|writeOnly|",ZG=_2+kT;function lm(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=GG(e);if(o!==void 0||s){let a=O2(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:TT(a.schema,kT)&&R2(u,f)?{...u,...a.schema}:lm(u,a.schema,n)}}if(n&&R2(e,r))return{...e,...t};let i=Array.isArray(t.allOf)&&r.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 QG(e,t,n,r){let o=new Map,s=new WeakMap,i=new Map,a=!1,c=Object.keys(n);for(let x of c)l(x,["references",x]);let u=cs(e,(x,w)=>p(y(x,t[w]))),f={};for(let x of c){let w=o.get(x);typeof w!="string"&&W(f,x,p(w))}return{dialect:"draft-2020-12",schemas:u,definitions:f};function l(x,w){let S=o.get(x);if(S!==void 0)return typeof S=="string"?S:x;if(!Object.hasOwn(n,x))throw vi(`Invalid reference ${x}`,[...w,"$ref"]);o.set(x,null);let A=n[x],M=y(A,["references",x]),R=m(A);if(R!==void 0){let P=i.get(R),$=P?.find(F=>ae(o.get(F),M));if($===void 0)P===void 0?i.set(R,[x]):P.push(x);else return a=!0,o.set(x,$),$}return o.set(x,M),x}function p(x){return a?v2(x,w=>w.replace(/^#\/\$defs\/([^/]*)/,(S,A)=>{let M=o.get(Dl(A));return typeof M=="string"?`#/$defs/${Hu(M)}`:S})):x}function m(x){if(x._tag==="Reference")return;let w=x.checks.length===0?x.annotations:x.checks[x.checks.length-1].annotations;return typeof w?.identifier!="string"&&typeof w?.[Tu]=="string"?w[Tu]:void 0}function h(x,w){return x?.schemas?.map((S,A)=>y(S,[...w,"schemas",A]))??[]}function g(x,w,S){let A=x.annotations,M=A?.toJsonSchema;if(M!==void 0){let F=h(x.representation,[...S,"representation"]),te=M({type:w,schemas:F}),ee=fm(A,r),T=ee===void 0?te:{...te,...ee},z=ee===void 0?_2:ZG;return x._tag==="Filter"&&TT(T,z)&&(ee===void 0||TT(ee,kT))?[T,!0]:[T]}if(x._tag==="Filter")return;let R=x.checks.map((F,te)=>g(F,w,[...S,"checks",te])).filter(F=>F!==void 0);if(R.length===0)return;let P=fm(A,r),$=R.map(([F])=>F);return[P===void 0?{allOf:$}:{allOf:$,...P}]}function y(x,w){if(x._tag==="Reference"){let R=l(x.$ref,w);return{$ref:`#/$defs/${Hu(R)}`}}let S=s.get(x);if(S!==void 0)return S;let A=b(x,w),M=fm(x.annotations,r);M!==void 0&&(A={...A,...M});for(let R=0;R<x.checks.length;R++){let P=typeof A.type=="string"&&YG(A.type)?A.type:void 0,$=g(x.checks[R],P,[...w,"checks",R]);$!==void 0&&(A=lm(A,...$))}return s.set(x,A),A}function b(x,w){switch(x._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":case"UniqueSymbol":return{type:"string",allOf:[{pattern:"^Symbol\\((.*)\\)$"}]};case"Declaration":return{};case"Suspend":return y(x.thunk,[...w,"thunk"]);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN"]},{type:"string",enum:["Infinity"]},{type:"string",enum:["-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let S=x.literal;return typeof S=="bigint"?{type:"string",enum:[globalThis.String(S)]}:{type:typeof S,enum:[S]}}case"Enum":{let S=x.enums.map(([A,M])=>typeof M=="number"&&!globalThis.Number.isFinite(M)?{type:"string",enum:[globalThis.String(M)],title:A}:{type:typeof M,enum:[M],title:A});return S.length===0?{not:{}}:{anyOf:S}}case"TemplateLiteral":return{type:"string",pattern:`^${x.parts.map(Xy).join("")}$`};case"Arrays":{if(x.rest.length>1)throw vi("Invalid schema representation document",[...w,"rest"]);let S={type:"array"},A=x.elements.length,M=x.elements.map((R,P)=>{R.isOptional&&A--;let $=y(R.type,[...w,"elements",P,"type"]),F=fm(R.annotations,r);return F===void 0?$:lm($,F)});if(M.length>0?(S.prefixItems=M,S.maxItems=x.elements.length,A>0&&(S.minItems=A)):S.items=!1,x.rest.length===1){delete S.maxItems;let R=y(x.rest[0],[...w,"rest",0]);Object.keys(R).length>0?S.items=R:delete S.items}return S}case"Objects":{if(x.propertySignatures.length===0&&x.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let S={type:"object"},A={},M=[];for(let F=0;F<x.propertySignatures.length;F++){let te=x.propertySignatures[F];if(typeof te.name!="string")throw vi("Invalid schema representation document",[...w,"propertySignatures",F,"name"]);let ee=te.name,T=y(te.type,[...w,"propertySignatures",F,"type"]),z=fm(te.annotations,r);W(A,ee,z===void 0?T:lm(T,z)),te.isOptional||M.push(ee)}x.propertySignatures.length>0&&(S.properties=A),M.length>0&&(S.required=M);let R={},P=[];for(let F=0;F<x.indexSignatures.length;F++){let te=x.indexSignatures[F],ee=y(te.type,[...w,"indexSignatures",F,"type"]);Object.keys(ee).length===1&&"not"in ee&&(ee=!1);let T=E(te.parameter,[...w,"indexSignatures",F,"parameter"],new Set);if(T.length===0)P.push(ee);else for(let z of T){let U=R[z];W(R,z,U===void 0?ee:U===!1||ee===!1?!1:lm(U,ee))}}let $=Object.keys(R).length>0;return $&&(S.patternProperties=R),x.indexSignatures.length===0?S.additionalProperties=r?.additionalProperties??!1:P.length===1&&x.propertySignatures.length===0&&!$?S.additionalProperties=P[0]:P.length>0&&(S.allOf=P.map(F=>({type:"object",additionalProperties:F}))),typeof S.additionalProperties=="object"&&S.additionalProperties!==null&&Object.keys(S.additionalProperties).length===0&&delete S.additionalProperties,S}case"Union":{let S=x.types.map((A,M)=>y(A,[...w,"types",M]));if(S.length===0)return{not:{}};if(x.mode==="anyOf"&&S.length>1){let A=XG(S);if(A!==void 0)return A}return x.mode==="anyOf"?{anyOf:S}:{oneOf:S}}}}function E(x,w,S){switch(x._tag){case"Reference":{if(!Object.hasOwn(n,x.$ref))throw vi(`Invalid reference ${x.$ref}`,[...w,"$ref"]);if(l(x.$ref,w),S.has(x.$ref))return[];let A=new Set(S).add(x.$ref);return E(n[x.$ref],["references",x.$ref],A)}case"String":return M2(y(x,w));case"TemplateLiteral":return[`^${x.parts.map(Xy).join("")}$`];case"Union":return x.types.flatMap((A,M)=>E(A,[...w,"types",M],S));default:throw vi("Invalid schema representation document",w)}}}function YG(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function XG(e){let t,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;n.push(...r.enum)}return{type:t,enum:n}}function M2(e){let t=[];typeof e.pattern=="string"&&t.push(e.pattern);for(let n of["allOf","anyOf","oneOf"]){let r=e[n];if(Array.isArray(r))for(let o of r)typeof o=="object"&&o!==null&&!Array.isArray(o)&&t.push(...M2(o))}return t}function Xy(e){switch(e._tag){case"Literal":return Nl(globalThis.String(e.literal));case"String":return _1;case"Number":return Vx;case"TemplateLiteral":return e.parts.map(Xy).join("");case"Union":return e.types.map(Xy).join("|");default:throw vi("Invalid schema representation document",[])}}function P2(e,t){let n=QG([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var t5=({identifier:e})=>e;function Bs(e){return e===void 0?void 0:{annotations:e}}function CT(e,t){let{references:n,representations:r}=n5([e],t);return{representation:r[0],references:n}}function n5(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let S of e)m(S);let a=t?.referencePolicy??t5;for(let S of s.values())for(let A of S.values()){let M=a({ast:A.ast,occurrences:A.occurrences,identifier:A.identifier});if(M!==void 0){let R=M===A.identifier||!M.endsWith("_")?"_":"";A.reference=u(M,A,R)}else A.isRecursive&&(A.reference=u(`${A.ast._tag}_`,A,""))}return{representations:cs(e,S=>g(S)),references:n};function u(S,A,M="_"){let R=S,P=0;for(;r.has(R);){if(r.get(R)===A)return R;R=`${S}${M}${++P}`}return r.set(R,A),R}function f(S,A,M){let R=A.fallback;return R!==void 0?eI(S)===R?S:Wo(S,{[Tu]:R}):M===A.identifier?S:Wo(S,{identifier:M})}function l(S,A){if(!Object.hasOwn(n,S)&&!o.has(S)){o.add(S);let M=y(A);o.delete(S),W(n,S,M)}return{_tag:"Reference",$ref:S}}function p(S){let A=Dp(S),M=YI(A),R=ul(A),P=R===void 0?(A!==S?ul(S):void 0)??eI(A):void 0;P!==void 0&&(R=`${P}Encoded`);let $=s.get(M);$===void 0&&($=new Map,s.set(M,$));let F=$.get(R);return F===void 0&&(F={ast:M,identifier:R,fallback:P,occurrences:0,isRecursive:!1,reference:void 0},$.set(R,F)),F}function m(S){let A=p(S),M=A.ast;if(A.occurrences++,i.has(A)){A.isRecursive=!0;return}if(!(A.occurrences>1)){switch(i.add(A),h(M.checks),M._tag){case"Declaration":case"Arrays":case"Objects":case"Union":M.recur(R=>(m(R),R));break;case"TemplateLiteral":M.parts.forEach(m);break;case"Suspend":m(M.thunk());break}i.delete(A)}}function h(S){S?.forEach(A=>{A.annotations?.representation?.schemas?.forEach(M=>m(yn(M))),A._tag==="FilterGroup"&&h(A.checks)})}function g(S){let A=p(S),M=A.ast,R=A.reference;if(R!==void 0){let P=A.identifier===void 0?M:f(M,A,R);return l(R,P)}return y(M)}function y(S){let A=b(S.checks);switch(S._tag){case"Declaration":return{_tag:"Declaration",typeParameters:S.typeParameters.map(M=>g(M)),checks:A,...x(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:A,...Bs(S.annotations)};case"Literal":return{_tag:"Literal",literal:S.literal,checks:A,...Bs(S.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:S.symbol,checks:A,...Bs(S.annotations)};case"Enum":return{_tag:"Enum",enums:S.enums,checks:A,...Bs(S.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:S.parts.map(M=>g(M)),checks:A,...Bs(S.annotations)};case"Arrays":return{_tag:"Arrays",elements:S.elements.map(M=>{let R=Dp(M),P=R.context?.annotations;return{isOptional:an(R),type:g(M),...Bs(P)}}),rest:S.rest.map(M=>g(M)),checks:A,...Bs(S.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:S.propertySignatures.map(M=>{let R=Dp(M.type),P=R.context?.annotations;return{name:M.name,type:g(M.type),isOptional:an(R),isMutable:C1(R),...Bs(P)}}),indexSignatures:S.indexSignatures.map(M=>({parameter:g(M.parameter),type:g(M.type)})),checks:A,...Bs(S.annotations)};case"Union":return{_tag:"Union",types:S.types.map(M=>g(M)),mode:S.mode,checks:A,...Bs(S.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:g(S.thunk()),...Bs(S.annotations)}}}function b(S){return S?.map(E)??[]}function E(S){switch(S._tag){case"Filter":return{_tag:"Filter",aborted:S.aborted,...w(S.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:cs(S.checks,E),...w(S.annotations)}}}function x(S){if(S===void 0)return;let{representation:A,...M}=S;return{...A===void 0?void 0:{representation:A},...Object.keys(M).length===0?void 0:{annotations:M}}}function w(S){if(S===void 0)return;let{representation:A,...M}=S,R=A===void 0?void 0:A.schemas===void 0?A:{...A,schemas:A.schemas.map(P=>g(yn(P)))};return{...R===void 0?void 0:{representation:R},...Object.keys(M).length===0?void 0:{annotations:M}}}}function U2(e,t){let n=[];return AT(e,t,"",n),n}function AT(e,t,n,r){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++)AT(e[a],t[a],`${n}/${a}`,r);for(let a=o-1;a>=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;a<s;a++)r.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(eS(e)&&eS(t)){let o=Object.keys(e),s=Object.keys(t),i=Array.from(new Set([...o,...s])).sort();for(let a of i){let c=`${n}/${Hu(a)}`,u=Object.hasOwn(e,a),f=Object.hasOwn(t,a);u&&f?AT(e[a],t[a],c,r):!u&&f?r.push({op:"add",path:c,value:t[a]}):r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}}function D2(e,t){let n=t;for(let r of e)n=s5(n,r);return n}function eS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function o5(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(Dl)}function N2(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function s5(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let n=i5(e,t.path);if(n===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:r,parent:o,stack:s}=n;if(Array.isArray(o)){if(r==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=r==="-"?o.length:N2(r),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,F2(s,c)}if(eS(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw new Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};return t.op==="remove"?delete i[r]:W(i,r,t.value),F2(s,i)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function i5(e,t){let n=o5(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i<n.length-1;i++){let a=n[i];if(Array.isArray(s)){let c=N2(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(eS(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function F2(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let i=o.slice();i[s]=n,n=i}else{let i={...o};W(i,s,n),n=i}}return n}function j2(e,t){return qs(Ll("Iso",e,t))}function B2(e,t){return qs(Ll("Lens",e,t))}function Ll(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}var a5={kind:"Iso",get:B,set:B},tS=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=n=>{let r=n;for(let o=0;o<t.length;o++)r=r[t[o]];return r},this.set=(n,r)=>{let o=nS(r),s=o,i=0;for(;i<t.length-1;i++){let a=t[i];W(s,a,nS(s[a])),s=s[a]}return W(s,t[i],n),o}}},dm=class{_tag="CheckNode";kind="Prism";checks;get;set=B;constructor(t){this.checks=t,this.get=n=>F1(t,n)}};function Vu(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;r<t.length;r++){let o=t[r],s=n[n.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?n[n.length-1]=new tS([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?n[n.length-1]=new dm([...s.checks,...o.checks]):n.push(o)}return n}function c5(e,t){return qs(Ll("Optional",e,t))}var Bl=class{node;getResult;replaceResult;constructor(t,n,r){this.node=t,this.getResult=n,this.replaceResult=r}replace(t,n){return Md(this.replaceResult(t,n),()=>n)}modify(t){return n=>Md($h(this.getResult(n),r=>this.replaceResult(t(r),n)),()=>n)}compose(t){return qs(Vu(this.node,t.node))}key(t){return qs(Vu(this.node,[new tS([t])]))}optionalKey(t){return qs(Vu(this.node,Ll("Lens",n=>n[t],(n,r)=>{let o=nS(r);return n===void 0?Array.isArray(o)&&typeof t=="number"?o.splice(t,1):delete o[t]:W(o,t,n),o})))}check(...t){return qs(Vu(this.node,[new dm(t)]))}refine(t,n){return qs(Vu(this.node,[new dm([Qx(t,n)])]))}tag(t){let n=Ae(new ke({expected:`${JSON.stringify(t)} tag`}));return qs(Vu(this.node,Ll("Prism",r=>r._tag===t?Ce(r):n,B)))}at(t,...n){let r=Ae(new Ct([t],new sn(void 0)));return qs(Vu(this.node,Ll("Optional",o=>Object.hasOwn(o,t)?Ce(o[t]):r,(o,s)=>{if(Object.hasOwn(s,t)){let i=nS(s);return W(i,t,o),Ce(i)}else return r})))}pick(t){return this.compose(B2(ZN(t),(n,r)=>({...r,...n})))}omit(t){return this.compose(B2(QN(t),(n,r)=>({...r,...n})))}notUndefined(){return this.refine(Kn,{expected:"a value other than `undefined`"})}forEach(t){let n=t(rS());return c5(r=>tu(this.getResult(r),o=>{let s=[];for(let i=0;i<o.length;i++){let a=n.getResult(o[i]);Vt(a)&&s.push(a.success)}return s}),(r,o)=>$h(this.getResult(o),s=>{let i=[];for(let c=0;c<s.length;c++)Vt(n.getResult(s[c]))&&i.push(c);if(r.length!==i.length)return Ae(new ke({message:`each: replacement length mismatch: ${r.length} !== ${i.length}`}));let a=s.slice();for(let c=0;c<i.length;c++){let u=i[c],f=n.replaceResult(r[c],s[u]);if(Fe(f))return Ae(new Ct([u],f.failure));a[u]=f.success}return this.replaceResult(a,o)}))}modifyAll(t){return n=>Md($h(this.getResult(n),r=>this.replaceResult(r.map(t),n)),()=>n)}},RT=class extends Bl{get;set;constructor(t,n,r){super(t,o=>Ce(n(o)),o=>Ce(r(o))),this.get=n,this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>this.set(t(this.get(n)))}},OT=class extends Bl{get;constructor(t,n,r){super(t,o=>Ce(n(o)),(o,s)=>Ce(r(o,s))),this.get=n,this.replace=r}modify(t){return n=>this.replace(t(this.get(n)),n)}},_T=class extends Bl{set;constructor(t,n,r){super(t,n,(o,s)=>Ce(r(o))),this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>Md(tu(this.getResult(n),r=>this.set(t(r))),()=>n)}};function qs(e){let t=e[0]??a5;if(e.length>1){let n=e.reduce((r,o)=>l5(r,o.kind),"Iso");t={kind:n,get:u5(e,n),set:f5(e,n)}}switch(t.kind){case"Iso":return new RT(e,t.get,t.set);case"Lens":return new OT(e,t.get,t.set);case"Prism":return new _T(e,t.get,t.set);case"Optional":return new Bl(e,t.get,t.set)}}function nS(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 u5(e,t){return n=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if(MT(o.kind)){if(Fe(s))return s;n=s.success}else n=s}return MT(t)?Ce(n):n}}function f5(e,t){return q2(t)?n=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n}:(n,r)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){s[i]=r;let a=e[i];if(MT(a.kind)){let c=a.get(r);if(Fe(c))return c;r=c.success}else r=a.get(r)}for(let i=o-1;i>=0;i--){let a=e[i];if(q2(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(Fe(c))return c;n=c.success}}return t==="Optional"?Ce(n):n}}function MT(e){return e==="Prism"||e==="Optional"}function q2(e){return e==="Iso"||e==="Prism"}function l5(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var d5=qs([]);function rS(){return d5}var Ku=new WeakMap,z2=e=>{if(Ku.has(e))return Ku.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var H2="~effect/data/Redacted",pm=e=>q(e,H2),Ec=(e,t)=>{let n=Object.create(m5);return t?.label&&(n.label=t.label),Ku.set(n,e),n},m5={[H2]:{_A:e=>e},label:void 0,...vn,toJSON(){return this.toString()},toString(){return`<redacted${ao(this.label)?":"+this.label:""}>`},[Oe](){return ce(Ku.get(this))},[_e](e){return pm(e)&&ae(Ku.get(this),Ku.get(e))}},Sc=z2;var W2=e=>un((t,n)=>e(Sc(t),Sc(n)));var mm=Gy;function An(){return(e,t,n)=>re(new ma(e.map(_p),r=>t(r.map(o=>re(o))),n))}function ro(e,t){return An()([],()=>(n,r,o)=>e(n)?v(n):G(new st(r,n,o)),t)}function h5(e){return e}function g5(e){return t=>t.annotate(e)}function x5(e){return t=>PT(PT(t).annotate(e))}function y5(e){return t=>t.rebuild(El(t.ast,e))}function S5(e){return e}var hm="~effect/SchemaError/SchemaError",Pr=class extends Mn("SchemaError"){[hm]=hm;constructor(t){let n=ni();ar(0);try{super({issue:t})}finally{ar(n)}}get message(){return JF(this.issue)}toString(){return`SchemaError(${this.message})`}};function Wl(e){return q(e,hm)&&e[hm]===hm}function V2(e){return Ft(e)?e.value:{issues:[{message:EP(e.cause)}]}}function E5(e,t){let n=dt(e),r={errors:"all",...t?.parseOptions},o=KF(t),s=i=>{let a=new ei("sync"),c=mp(jw(n(i,r),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?V2(u):new Promise(f=>{c.addObserver(l=>{f(V2(l))})})};if("~standard"in e){let i=e;return"validate"in i["~standard"]||Object.assign(i["~standard"],{validate:s}),i}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function K2(e,t){let n=QB(e);if(t==="draft-2020-12"){let r=n.schema;return Object.keys(n.definitions).length>0&&(r.$defs=n.definitions),r}else if(t==="draft-07"){let r=I2(n),o=r.schema;return Object.keys(r.definitions).length>0&&(o.definitions=r.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function b5(e){let t={input(n){return K2(e,n.target)},output(n){return K2(Fr(e),n.target)}};if("~standard"in e){let n=e;return"jsonSchema"in n["~standard"]||Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}var iL=FN,w5=DN;function wc(e,t){let n=dt(e,t);return(r,o)=>aL(n(r,o))}function aL(e){return xt(e)?NT(e):ft(e,t=>aa(()=>ec(t,n=>new Pr(n))))}var I5=wc;function cL(e,t){let n;for(let r of e.reasons){if(!$g(r)||!Wl(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function uL(e){return gx(e).then(t=>{if(Ft(t))return t.value;throw cL(t.cause,"Promise adapter can only reject schema errors")})}function fL(e){let t=ac(e);if(Ft(t))return t.value;throw cL(t.cause,"Sync adapter can only throw schema errors")}function lL(e,t){let n=NN(e,t);return(r,o)=>NT(n(r,o))}function NT(e){return Ft(e)?e:qt(ec(e.cause,t=>new Pr(t)))}var dL=lL,v5=mT,T5=LN;function pL(e,t){let n=BN(e,t);return(r,o)=>hb(n(r,o),s=>new Pr(s))}var k5=pL;function mL(e,t){let n=wc(e,t);return(r,o)=>uL(n(r,o))}var C5=mL;function aS(e,t){let n=wc(e,t);return(r,o)=>fL(n(r,o))}var xm=aS;function ym(e,t){let n=Pl(e,t);return(r,o)=>aL(n(r,o))}var cS=ym;function hL(e,t){let n=qN(e,t);return(r,o)=>NT(n(r,o))}var gL=hL,A5=gT,R5=jN;function xL(e,t){let n=$N(e,t);return(r,o)=>hb(n(r,o),s=>new Pr(s))}var O5=xL;function yL(e,t){let n=ym(e,t);return(r,o)=>uL(n(r,o))}var _5=yL;function uS(e,t){let n=ym(e,t);return(r,o)=>fL(n(r,o))}var LT=uS,re=am;function Gu(e){return q(e,mm)&&e[mm]===mm}var Ju=pr(e=>re(bl(e.ast),{schema:e})),M5=pr(e=>e.schema),Pt=pr(e=>{let t=lS(e);return re(v1(e.ast),{schema:t})}),P5=pr(e=>e.schema.members[0]),F5=pr(e=>re(ev(e.ast),{schema:e})),U5=pr(e=>e.schema),Fr=pr(e=>re(yn(e.ast),{schema:e})),Vl=pr(e=>re(qn(e.ast),{schema:e})),gm="~effect/Schema/flip";function D5(e){return q(e,gm)&&e[gm]===gm}function PT(e){return D5(e)?e.schema.rebuild(Cs(e.ast)):re(Cs(e.ast),{[gm]:gm,schema:e})}function Rt(e){let t=re(new Yr(e),{literal:e,transform(n){return t.pipe(Ee(Rt(n),{decode:De(()=>n),encode:De(()=>e)}))}});return t}function SL(e){return new jx(e.map(t=>Gu(t)?t.ast:new Yr(t)))}function N5(e){return re(SL(e),{parts:e})}function L5(e){return re(SL(e).asTemplateLiteralParser(),{parts:e})}function B5(e){return re(new qx(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var Ic=re(c1),q5=re(u1),BT=re(ha),tt=re(HI),qT=re(WI),fe=re(yi),Kl=re(VI),vc=re(d1),EL=re(p1),Ti=re(m1),Jl=re(a1),j5=re(f1);function $5(e){return re(new $x(e))}function jT(e,t){return re(e,{fields:t,mapFields(n,r){let o=n(this.fields);return jT(Kx(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function oe(e){return jT(Kx(e,void 0),e)}function z5(e){return pr(t=>t.mapFields(YN(e)))}var H5=e=>typeof e=="symbol"?e:globalThis.String(e);function W5(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=Vl(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,f=H5(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${$i(u)}`);s.add(f),W(n,u,a),c&&(r[i]=u,o[u]=i)}return oe(n).pipe(Ee(t,vt({decode:ST(o),encode:ST(r)})))}}function V5(e,t){return n=>{let r=Hh(n.fields,Fr),o=oe({...r,...e});return n.pipe(Ee(o,vt({decode:s=>{let i={...s};for(let a in e){let c=t[a],u=c(s);Te(u)&&W(i,a,u.value)}return i},encode:s=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function $T(e,t){return re(k1(e.ast,t.ast),{key:e,value:t})}function K5(e,t){return re(h1(e.ast,t.map(_p)),{schema:e,records:t})}function bL(e,t){return re(e,{elements:t,mapElements(n,r){let o=n(this.elements);return bL(GI(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function bc(e){return bL(GI(e),e)}function J5(e,t){return re(g1(e.ast,t.map(_p)),{schema:e,rest:t})}var Wt=pr(e=>re(new As(!1,[],[e.ast]),{value:e}));var fS=pr(e=>re(new As(!1,[e.ast],[e.ast]),{value:e}));function G5(e){return He([e,Wt(e)]).pipe(Ee(Wt(Fr(e)),vt({decode:CR,encode:t=>t.length===1?t[0]:t})))}function Z5(e){return Wt(e).check(QT())}var Q5=pr(e=>re(new As(!0,e.ast.elements,e.ast.rest),{schema:e}));function wL(e,t){return re(e,{members:t,mapMembers(n,r){let o=n(this.members);return wL(Jx(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function He(e,t){return wL(Jx(e,t?.mode??"anyOf",void 0),e)}function Ca(e){let t=e.map(Rt);return re(Jx(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return He(n(this.members))},pick(n){return Ca(n)},transform(n){return He(t.map((r,o)=>r.transform(n[o])))}})}var zT=pr(e=>He([e,tt])),lS=pr(e=>He([e,qT])),IL=pr(e=>He([e,tt,qT]));function vL(e){return re(new Hx(()=>e().ast))}function Y5(...e){return t=>t.check(...e)}function X5(e,t){return n=>re(Si(n.ast,[Qx(e,t)]),{schema:n})}function TL(e){return t=>re(I1(t.ast,e),{schema:t,identifier:e})}function eZ(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(TL(e))}function kL(e){return t=>re(b1(t.ast,new kp(e,B)),{schema:t})}function CL(e){return t=>re(w1(t.ast,new kp(B,e)),{schema:t})}function tZ(e){return AL(e)}function AL(e){return t=>kL(yx(e))(t)}function nZ(e){return RL(e)}function RL(e){return t=>CL(yx(e))(t)}function Ee(e,t){return n=>re(ey(n.ast,e.ast,t?Nx(t):pl()),{from:n,to:e})}function rZ(e){return t=>Ee(Fr(t),e)(t)}function HT(e,t){return n=>t?Ee(n,t)(e):Ee(n)(e)}function oZ(e){return t=>Ee(t,e)(Vl(t))}function OL(e){return t=>re(T1(t.ast,e),{schema:t})}function _L(e){return ft(e,t=>aa(()=>ec(t,n=>n.issue)))}function WT(e,t){let n=t?.encodingStrategy==="omit"?dI():ks();return r=>Ju(Vl(r)).pipe(Ee(r,{decode:vp(_L(e)),encode:n}))}function sZ(e,t){return n=>Fr(n).pipe(WT(e,t),HT(Ju(n)))}function ML(e,t){let n=t?.encodingStrategy==="omit"?dI():ks();return r=>Pt(Vl(r)).pipe(Ee(r,{decode:vp(_L(e)),encode:n}))}function iZ(e,t){return n=>Fr(n).pipe(ML(e,t),HT(Pt(n)))}function Ze(e){return Rt(e).pipe(OL(v(e)))}function aZ(e){return Ze(e).pipe(WT(v(e),{encodingStrategy:"omit"}))}function Tc(e,t){return oe({_tag:Ze(e),...t})}function PL(e){return t=>{let n={},r=[],o=new Set,s={},i=f=>l=>f.includes(l[e]);return a(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(f){let l=f.ast;if(s1(l)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(Gu))return f.members.forEach(a);let p=lc(l);if(p.length>0){let m=p.find(h=>h.key===e)?.literal;if(yh(m)){let h=typeof m=="number"?globalThis.String(m):m;if(o.has(h))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(h),r.push(m),W(n,m,f),W(s,m,iL(Fr(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let h=arguments[0];return function(g){let y=g[e];return(Object.hasOwn(h,y)?h[y]:void 0)(g)}}let f=arguments[0],l=arguments[1],p=f[e];return(Object.hasOwn(l,p)?l[p]:void 0)(f)}function u(){if(arguments.length===2){let g=arguments[0],y=arguments[1];return function(b){let E=b[e];return(Object.hasOwn(g,E)?g[E]??y:y)(b)}}let f=arguments[0],l=arguments[1],p=arguments[2],m=f[e];return(Object.hasOwn(l,m)?l[m]??p:p)(f)}}}function cZ(e){let t={},n=[];for(let c of Object.keys(e)){let u=Tc(c,e[c]);W(t,c,u),n.push(u)}let r=He(n),{guards:o,isAnyOf:s,match:i,matchOrElse:a}=PL("_tag")(r);return re(r.ast,{cases:t,isAnyOf:s,guards:o,match:i,matchOrElse:a})}function uZ(){return e=>e}function kc(e,t){return ro(n=>n instanceof e,t)}function pt(){return(e,t)=>new Dt(e.ast,Nx(t))}var Tt=Zx;function fZ(e,t=void 0){return new Ou(e,t)}function mr(e,t){return Mr(e,tt,({annotations:n})=>n===void 0?t:t.annotate(n))}var J2="^\\S[\\s\\S]*\\S$|^\\S$|^$";function VT(e){let t=new globalThis.RegExp(J2);return Tt(n=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[J2]}},...e})}var lZ=Re("effect/schema/isTrimmed",tt,({annotations:e})=>VT(e));function Zu(e,t){let n=e.source,r=e.flags,o=r===""?`new RegExp(${X(n)})`:`new RegExp(${X(n)}, ${X(r)})`;return Pp(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}var dZ=oe({source:fe,flags:fe}).check(Tt(e=>{let t=jh(()=>new globalThis.RegExp(e.source,e.flags));return Vt(t)&&t.success.source===e.source&&t.success.flags===e.flags})),pZ={id:"effect/schema/isPattern",payloadSchema:dZ,revive:({annotations:e,payload:t})=>Zu(new globalThis.RegExp(t.source,t.flags),e)};function FL(e){return nv({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}var mZ=Re("effect/schema/isStringFinite",tt,({annotations:e})=>FL(e));function UL(e){return rv({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}var hZ=Re("effect/schema/isStringBigInt",tt,({annotations:e})=>UL(e));function DL(e){return sv({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var gZ=Re("effect/schema/isStringSymbol",tt,({annotations:e})=>DL(e)),xZ=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 NL(e,t){let n=xZ(e);return Zu(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var yZ=Re("effect/schema/isUUID",oe({version:He([Ca([1,2,3,4,5,6,7,8]),tt])}),({annotations:e,payload:t})=>NL(t.version??void 0,e)),G2=/^([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 LL(e){return Zu(G2,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:G2.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}var SZ=Re("effect/schema/isGUID",tt,({annotations:e})=>LL(e));function BL(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Zu(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}var EZ=Re("effect/schema/isULID",tt,({annotations:e})=>BL(e));function KT(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Zu(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var bZ=Re("effect/schema/isBase64",tt,({annotations:e})=>KT(e));function qL(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Zu(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}var wZ=Re("effect/schema/isBase64Url",tt,({annotations:e})=>qL(e));function jL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${Nl(e)}`);return Tt(o=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isStartsWith(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var IZ=Re("effect/schema/isStartsWith",oe({startsWith:fe}),({annotations:e,payload:t})=>jL(t.startsWith,e));function $L(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${Nl(e)}$`);return Tt(o=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isEndsWith(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var vZ=Re("effect/schema/isEndsWith",oe({endsWith:fe}),({annotations:e,payload:t})=>$L(t.endsWith,e));function zL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(Nl(e));return Tt(o=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncludes",payload:{includes:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isIncludes(${X(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var TZ=Re("effect/schema/isIncludes",oe({includes:fe}),({annotations:e,payload:t})=>zL(t.includes,e)),Z2="^[^a-z]*$";function HL(e){let t=new globalThis.RegExp(Z2);return Tt(n=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[Z2]}},...e})}var kZ=Re("effect/schema/isUppercased",tt,({annotations:e})=>HL(e)),Q2="^[^A-Z]*$";function WL(e){let t=new globalThis.RegExp(Q2);return Tt(n=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[Q2]}},...e})}var CZ=Re("effect/schema/isLowercased",tt,({annotations:e})=>WL(e)),Y2="^[^a-z]?.*$";function VL(e){let t=new globalThis.RegExp(Y2);return Tt(n=>n.charAt(0).toUpperCase()===n.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[Y2]}},...e})}var AZ=Re("effect/schema/isCapitalized",tt,({annotations:e})=>VL(e)),X2="^[^A-Z]?.*$";function KL(e){let t=new globalThis.RegExp(X2);return Tt(n=>n.charAt(0).toLowerCase()===n.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[X2]}},...e})}var RZ=Re("effect/schema/isUncapitalized",tt,({annotations:e})=>KL(e)),js=re(QI),JL=ZI,OZ=Re("effect/schema/isFinite",tt,({annotations:e})=>JL(e));function Sm(e){let t=Vi(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...o})}function Em(e){let t=wf(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function bm(e){let t=Yc(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...o})}function wm(e){let t=bf(e.order),n=e.formatter??X;return(r,o)=>Tt(s=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...o})}function Im(e){let t=wf(e.order),n=Vi(e.order),r=bf(e.order),o=Yc(e.order),s=e.formatter??X;return(i,a)=>{let c=i.exclusiveMinimum?n:t,u=i.exclusiveMaximum?o:r;return Tt(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)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(i),...a})}}function GL(e){return(t,n)=>{let r=e.formatter??X;return Tt(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function jl(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${X(e)}`);return e}var ZL=Sm({order:lo,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:jl(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${X(e)})`})})}),_Z=Re("effect/schema/isGreaterThan",oe({exclusiveMinimum:js}),({annotations:e,payload:t})=>ZL(t.exclusiveMinimum,e)),JT=Em({order:lo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:jl(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${X(e)})`})})}),MZ=Re("effect/schema/isGreaterThanOrEqualTo",oe({minimum:js}),({annotations:e,payload:t})=>JT(t.minimum,e)),QL=bm({order:lo,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:jl(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${X(e)})`})})}),PZ=Re("effect/schema/isLessThan",oe({exclusiveMaximum:js}),({annotations:e,payload:t})=>QL(t.exclusiveMaximum,e)),YL=wm({order:lo,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:jl(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${X(e)})`})})}),FZ=Re("effect/schema/isLessThanOrEqualTo",oe({maximum:js}),({annotations:e,payload:t})=>YL(t.maximum,e)),dS=Im({order:lo,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:jl(e.minimum),maximum:jl(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${X(e.minimum)}, maximum: ${X(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),UZ=Re("effect/schema/isBetween",oe({minimum:js,maximum:js,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>dS(t,e)),XL=GL({remainder:rF,zero:0,annotate:e=>({expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${X(e)})`})})}),DZ=Re("effect/schema/isMultipleOf",oe({divisor:js}),({annotations:e,payload:t})=>XL(t.divisor,e));function vm(e){return Tt(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var NZ=Re("effect/schema/isInt",tt,({annotations:e})=>vm(e)),zs=Kl.check(vm()),nr=zs.check(JT(0));function LZ(e){return new Ou([vm(),dS({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function BZ(e){return new Ou([vm(),dS({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function $l(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${X(e)}`);return e.toISOString()}function zl(e){return`new Date(${X(e.getTime())})`}var eB=Sm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${zl(e)})`})})}),tB=Em({order:Qc,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${zl(e)})`})})}),nB=bm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${zl(e)})`})})}),rB=wm({order:Qc,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:$l(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${zl(e)})`})})}),oB=Im({order:Qc,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:$l(e.minimum),maximum:$l(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${zl(e.minimum)}, maximum: ${zl(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),sB=Sm({order:Oo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${X(e)})`})})}),iB=Em({order:Oo,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${X(e)})`})})}),aB=bm({order:Oo,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${X(e)})`})})}),cB=wm({order:Oo,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${X(e)})`})})}),uB=Im({order:Oo,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${X(e.minimum)}, maximum: ${X(e.maximum)}, exclusiveMinimum: ${X(t)}, exclusiveMaximum: ${X(n)} })`})}}}),qZ=Sm({order:Ki,formatter:e=>Xs(e)}),jZ=Em({order:Ki,formatter:e=>Xs(e)}),$Z=bm({order:Ki,formatter:e=>Xs(e)}),zZ=wm({order:Ki,formatter:e=>Xs(e)}),HZ=Im({order:Ki,formatter:e=>Xs(e)});function GT(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var WZ=Re("effect/schema/isMinLength",oe({minLength:nr}),({annotations:e,payload:t})=>GT(t.minLength,e));function fB(e){return GT(1,e)}function lB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:n})=>n==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Zr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var VZ=Re("effect/schema/isMaxLength",oe({maxLength:nr}),({annotations:e,payload:t})=>lB(t.maxLength,e));function ZT(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>r.length>=e&&r.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="array"?{allOf:[{minItems:e},{maxItems:t}]}:{allOf:[{minLength:e},{maxLength:t}]},toCode:()=>({runtime:`Schema.isLengthBetween(${e}, ${t})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var KZ=Re("effect/schema/isLengthBetween",oe({minimum:nr,maximum:nr}),({annotations:e,payload:t})=>ZT(t.minimum,t.maximum,e));function dB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var JZ=Re("effect/schema/isMinSize",oe({minSize:nr}),({annotations:e,payload:t})=>dB(t.minSize,e));function pB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Zr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var GZ=Re("effect/schema/isMaxSize",oe({maxSize:nr}),({annotations:e,payload:t})=>pB(t.maxSize,e));function mB(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>r.size>=e&&r.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isSizeBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${e}, ${t})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var ZZ=Re("effect/schema/isSizeBetween",oe({minimum:nr,maximum:nr}),({annotations:e,payload:t})=>mB(t.minimum,t.maximum,e));function hB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>Reflect.ownKeys(n).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:()=>({minProperties:e}),toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e}},...t})}var QZ=Re("effect/schema/isMinProperties",oe({minProperties:nr}),({annotations:e,payload:t})=>hB(t.minProperties,e));function gB(e,t){return e=Math.max(0,Math.floor(e)),Tt(n=>Reflect.ownKeys(n).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Zr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var YZ=Re("effect/schema/isMaxProperties",oe({maxProperties:nr}),({annotations:e,payload:t})=>gB(t.maxProperties,e));function xB(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),Tt(r=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isPropertiesLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({minProperties:e,maxProperties:t}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${e}, ${t})`}),[Zr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var XZ=Re("effect/schema/isPropertiesLengthBetween",oe({minimum:nr,maximum:nr}),({annotations:e,payload:t})=>xB(t.minimum,t.maximum,e));function yB(e,t){let n=Vl(e),r=UN(n.ast);return Tt((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let f=r(u,i);if(f!==void 0&&(c.push(new Ct([u],f)),i.errors==="first"))break}return Jn(c)?new At(s,c,o,i):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o})=>({propertyNames:o[0]}),toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Zr]:!0,...t})}var eQ=Re("effect/schema/isPropertyNames",tt,({annotations:e,schemas:t})=>yB(t[0],e));function QT(e){return Tt(t=>Jh(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitrary:{constraint:{unique:!0}},...e})}var tQ=Re("effect/schema/isUnique",tt,({annotations:e})=>QT(e)),nQ=fe.check(fB()),rQ=fe.check(ZT(1,1));function ki(e){let t=An()([e],([n])=>(r,o,s)=>Ys(r)?xe(r)?ws:fn(dt(n)(r.value,s),{onSuccess:L,onFailure:i=>Xn(o,"value",i,r,s)}):G(new st(o,r,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>pt()(He([oe({_tag:Rt("Some"),value:n}),oe({_tag:Rt("None")})]),vt({decode:r=>r._tag==="None"?D():L(r.value),encode:r=>Te(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(D()),i=r.oneof(s,n.arbitrary.map(L));return Qu(r,o,s,i)},toEquivalence:([n])=>mb(n),toFormatter:([n])=>or({onNone:()=>"none()",onSome:r=>`some(${n(r)})`})});return re(t.ast,{value:e})}var oQ=Mr("effect/schema/Option",tt,({annotations:e,typeParameters:t})=>{let n=ki(t[0]);return e===void 0?n:n.annotate(e)});function sQ(e){return zT(e).pipe(Ee(ki(Fr(e)),LU()))}function iQ(e){return lS(e).pipe(Ee(ki(Fr(e)),BU()))}function aQ(e,t){return IL(e).pipe(Ee(ki(Fr(e)),qU(t)))}function cQ(e){return Ju(e).pipe(Ee(ki(Fr(e)),jU()))}function uQ(e){return Pt(e).pipe(Ee(ki(Fr(e)),$U()))}function fQ(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return Pt(zT(e)).pipe(Ee(ki(Fr(e)),Lx({decode:o=>o.pipe(za(Sh),L),encode:n==="omit"?eu:o=>L(ja(eu(o),()=>r))})))}function SB(e,t){let n=An()([e,t],([r,o])=>(s,i,a)=>{if(!If(s))return G(new st(i,s,a));switch(s._tag){case"Success":return fn(pT(r)(s.success,a),{onSuccess:Ce,onFailure:c=>Xn(i,"success",c,s,a)});case"Failure":return fn(pT(o)(s.failure,a),{onSuccess:Ae,onFailure:c=>Xn(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>pt()(He([oe({_tag:Rt("Success"),success:r}),oe({_tag:Rt("Failure"),failure:o})]),vt({decode:s=>s._tag==="Success"?Ce(s.success):Ae(s.failure),encode:s=>Vt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,i)=>{let a=RB(s,r.terminal?.map(u=>Ce(u)),o.terminal?.map(u=>Ae(u))),c=s.oneof(r.arbitrary.map(u=>Ce(u)),o.arbitrary.map(u=>Ae(u)));return Qu(s,i,a,c)},toEquivalence:([r,o])=>yR(r,o),toFormatter:([r,o])=>Mo({onSuccess:s=>`success(${r(s)})`,onFailure:s=>`failure(${o(s)})`})});return re(n.ast,{success:e,failure:t})}var lQ=Mr("effect/schema/Result",tt,({annotations:e,typeParameters:t})=>{let n=SB(t[0],t[1]);return e===void 0?n:n.annotate(e)}),dQ=ro(e=>{if(!en(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>{switch(n){case"label":return typeof e[n]=="string";case"disallowJsonEncode":return e[n]===!0;default:return!1}})}),pQ=He([tt,dQ]);function YT(e,t){let n=typeof t?.label=="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?dt(Rt(n)):void 0,i=An()([e],([a])=>(c,u,f)=>{if(pm(c)){let l=s!==void 0?vu(s(c.label,f),p=>new Ct(["label"],p)):H;return Bn(l,()=>fn(dt(a)(Sc(c),f),{onSuccess:()=>c,onFailure:()=>new At(u,[new Ct(["value"],new ke(void 0,c,f))],c,f)}))}return G(new st(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${X(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>pt()(a,{decode:De(c=>Ec(c,{label:n})),encode:r?fI(c=>"Cannot serialize Redacted"+(Te(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):De(Sc)}),toArbitrary:([a])=>()=>({arbitrary:a.arbitrary.map(c=>Ec(c,{label:n})),terminal:a.terminal?.map(c=>Ec(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([a])=>W2(a)});return re(i.ast,{value:e})}var mQ=Mr("effect/schema/Redacted",pQ,({annotations:e,payload:t,typeParameters:n})=>{let r=YT(n[0],t??void 0);return e===void 0?r:r.annotate(e)});function hQ(e,t){return Ee(YT(Fr(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:De(n=>Ec(n,{label:t?.label})),encode:t?.disallowEncode?fI(n=>"Cannot encode Redacted"+(Te(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):De(Sc)})(e)}function sS(e,t){let n=An()([e,t],([r,o])=>(s,i,a)=>{if(!zf(s))return G(new st(i,s,a));switch(s._tag){case"Fail":return fn(dt(r)(s.error,a),{onSuccess:Hf,onFailure:c=>Xn(i,"error",c,s,a)});case"Die":return fn(dt(o)(s.defect,a),{onSuccess:Wf,onFailure:c=>Xn(i,"defect",c,s,a)});case"Interrupt":return v(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>pt()(He([oe({_tag:Rt("Fail"),error:r}),oe({_tag:Rt("Die"),defect:o}),oe({_tag:Rt("Interrupt"),fiberId:lS(js)})]),vt({decode:s=>{switch(s._tag){case"Fail":return Hf(s.error);case"Die":return Wf(s.defect);case"Interrupt":return lu(s.fiberId)}},encode:B})),toArbitrary:([r,o])=>EB(r,o),toEquivalence:([r,o])=>bB(r,o),toFormatter:([r,o])=>wB(r,o)});return re(n.ast,{error:e,defect:t})}var gQ=Mr("effect/schema/CauseReason",tt,({annotations:e,typeParameters:t})=>{let n=sS(t[0],t[1]);return e===void 0?n:n.annotate(e)});function EB(e,t){return(n,r)=>{let o=n.constant(lu()),s=n.oneof(o,n.integer({min:1}).map(lu),e.arbitrary.map(i=>Hf(i)),t.arbitrary.map(i=>Wf(i)));return Qu(n,r,o,s)}}function bB(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function wB(e,t){return n=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function Hl(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(sS(r,o));return(i,a,c)=>$f(i)?fn(dt(s)(i.reasons,c),{onSuccess:Xa,onFailure:u=>Xn(a,"failures",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>pt()(Wt(sS(r,o)),vt({decode:Xa,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>IB(r,o),toEquivalence:([r,o])=>vB(r,o),toFormatter:([r,o])=>TB(r,o)});return re(n.ast,{error:e,defect:t})}var xQ=Mr("effect/schema/Cause",tt,({annotations:e,typeParameters:t})=>{let n=Hl(t[0],t[1]);return e===void 0?n:n.annotate(e)});function IB(e,t){return(n,r)=>{let o=EB(e,t)(n,r),s=n.constant(mP),i=n.array(o.arbitrary).map(Xa);return Qu(n,r,s,i)}}function vB(e,t){let n=vh(bB(e,t));return(r,o)=>n(r.reasons,o.reasons)}function TB(e,t){let n=wB(e,t);return r=>`Cause([${r.reasons.map(n).join(", ")}])`}var yQ=ro(e=>{if(!en(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),SQ=He([tt,yQ]),kB=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),CB=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},eL=[];function AB(e){let t=kB(e),n=eL[t];if(n!==void 0)return n;let r=CB(t),o=kc(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${X(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>pt()(l9,DU(r)),toArbitrary:()=>s=>s.string().map(i=>new globalThis.Error(i))});return eL[t]=o,o}var EQ=Mr("effect/schema/Error",SQ,({annotations:e,payload:t})=>{let n=AB(t??void 0);return e===void 0?n:n.annotate(e)}),tL=[];function ln(e){let t=kB(e),n=tL[t];if(n!==void 0)return n;let r=Am.pipe(Ee(BT,NU(CB(t))));return tL[t]=r,r}function pS(e,t,n){let r=An()([e,t,n],([o,s,i])=>{let a=Hl(s,i);return(c,u,f)=>{if(!xs(c))return G(new st(u,c,f));switch(c._tag){case"Success":return fn(dt(o)(c.value,f),{onSuccess:kn,onFailure:l=>Xn(u,"value",l,c,f)});case"Failure":return fn(dt(a)(c.cause,f),{onSuccess:qt,onFailure:l=>Xn(u,"cause",l,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])=>pt()(He([oe({_tag:Rt("Success"),value:o}),oe({_tag:Rt("Failure"),cause:Hl(s,i)})]),vt({decode:a=>a._tag==="Success"?kn(a.value):qt(a.cause),encode:a=>Ft(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}})),toArbitrary:([o,s,i])=>(a,c)=>{let u=IB(s,i)(a,c),f=RB(a,o.terminal?.map(p=>kn(p)),u.terminal?.map(p=>qt(p))),l=a.oneof(o.arbitrary.map(p=>kn(p)),u.arbitrary.map(p=>qt(p)));return Qu(a,c,f,l)},toEquivalence:([o,s,i])=>{let a=vB(s,i);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return a(c.cause,u.cause)}}},toFormatter:([o,s,i])=>{let a=TB(s,i);return c=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${a(c.cause)})`}}}});return re(r.ast,{value:e,error:t,defect:n})}var bQ=Mr("effect/schema/Exit",tt,({annotations:e,typeParameters:t})=>{let n=pS(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});function RB(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function Qu(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function nL(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function mS(e,t,n,r,o,s){let i=t.constraint,a=i===void 0||i.minLength===void 0&&i.maxLength===void 0?void 0:{...i.minLength!==void 0?{minLength:i.minLength}:{},...i.maxLength!==void 0?{maxLength:i.maxLength}:{}};if(a?.minLength!==void 0&&a.maxLength!==void 0&&a.minLength>a.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=a?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:nL(e,r,{...a,maxLength:c},s),f=Qu(e,t,u,nL(e,n,a,s));return{arbitrary:f.arbitrary.map(o),terminal:f.terminal?.map(o)}}function OB(e,t,n,r,o){return mS(e,t,e.tuple(n.arbitrary,r.arbitrary),n.terminal===void 0||r.terminal===void 0?void 0:e.tuple(n.terminal,r.terminal),o,([s],[i])=>ae(s,i))}function _B(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(bc([r,o]));return(i,a,c)=>i instanceof globalThis.Map?fn(dt(s)([...i],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Xn(a,"entries",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>pt()(Wt(bc([r,o])),vt({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]})),toArbitrary:([r,o])=>(s,i)=>OB(s,i,r,o,a=>new globalThis.Map(a)),toEquivalence:([r,o])=>wh(r,o),toFormatter:([r,o])=>s=>{let i=s.size;if(i===0)return"ReadonlyMap(0) {}";let a=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${i}) { ${a.join(", ")} }`}});return re(n.ast,{key:e,value:t})}var wQ=Mr("effect/schema/ReadonlyMap",tt,({annotations:e,typeParameters:t})=>{let n=_B(t[0],t[1]);return e===void 0?n:n.annotate(e)});function rL(e,t,n){return oe({type:Rt(e),nodes:Wt(oe({index:nr,data:t})),edges:Wt(oe({index:nr,source:nr,target:nr,data:n}))})}function oL(e,t){let n=-1,r=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=n)return G(new Ct(["nodes",o,"index"],new ke({expected:"a strictly increasing node index"},s,t)));n=s,r.add(s)}n=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=n)return G(new Ct(["edges",o,"index"],new ke({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return G(new Ct(["edges",o,"source"],new ke({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return G(new Ct(["edges",o,"target"],new ke({expected:"an encoded node index"},s.target,t)))}return v(Xp(e))}function IQ(e,t,n){return!eT(e)||e.mutable||e.type!==t?G(new ke({expected:`an immutable ${t} Graph`},e,n)):v(Yp(e))}function vQ(e,t){return(n,r)=>{let o=Yp(n),s=Yp(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i<o.nodes.length;i++)if(o.nodes[i].index!==s.nodes[i].index||!e(o.nodes[i].data,s.nodes[i].data))return!1;for(let i=0;i<o.edges.length;i++){let a=o.edges[i],c=s.edges[i],u=o.type==="directed"?a.source===c.source&&a.target===c.target:a.source===c.source&&a.target===c.target||a.source===c.target&&a.target===c.source;if(a.index!==c.index||!u||!t(a.data,c.data))return!1}return!0}}function TQ(e,t,n){return(r,o)=>{let s=Xp({type:e,nodes:[],edges:[]}),i=r.constant(s),a=r.array(t.arbitrary).chain(c=>{let u=c.map((l,p)=>({index:p,data:l}));if(u.length===0)return i;let f=r.integer({min:0,max:u.length-1});return r.array(r.tuple(f,f,n.arbitrary)).map(l=>Xp({type:e,nodes:u,edges:l.map(([p,m,h],g)=>({index:g,source:p,target:m,data:h}))}))});return Qu(r,o,i,a)}}function MB(e,t,n){let r=An()([t,n],([o,s])=>{let i=rL(e,o,s);return(a,c,u)=>!eT(a)||a.mutable||a.type!==e?G(new st(c,a,u)):O(dt(i)(Yp(a),u),f=>oL(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${X(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${X(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>pt()(rL(e,o,s),Rr({decode:oL,encode:(i,a)=>IQ(i,e,a)})),toArbitrary:([o,s])=>TQ(e,o,s),toEquivalence:([o,s])=>vQ(o,s),toFormatter:()=>globalThis.String});return re(r.ast,{type:e,node:t,edge:n})}var kQ=Mr("effect/schema/Graph",Ca(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=MB(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});function PB(e,t){let n=An()([e,t],([r,o])=>{let s=Wt(bc([r,o]));return(i,a,c)=>qy(i)?fn(dt(s)($y(i),c),{onSuccess:jy,onFailure:u=>Xn(a,"entries",u,i,c)}):G(new st(a,i,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>pt()(Wt(bc([r,o])),vt({decode:jy,encode:$y})),toArbitrary:([r,o])=>(s,i)=>OB(s,i,r,o,jy),toEquivalence:([r,o])=>wh(r,o),toFormatter:([r,o])=>s=>{let i=CN(s);if(i===0)return"HashMap(0) {}";let a=$y(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${i}) { ${a.join(", ")} }`}});return re(n.ast,{key:e,value:t})}var CQ=Mr("effect/schema/HashMap",tt,({annotations:e,typeParameters:t})=>{let n=PB(t[0],t[1]);return e===void 0?n:n.annotate(e)});function FB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>o instanceof globalThis.Set?fn(dt(r)([...o],i),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>Xn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>pt()(Wt(n),vt({decode:r=>new globalThis.Set(r),encode:r=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,s=>new globalThis.Set(s),ae),toEquivalence:([n])=>Ih(n),toFormatter:([n])=>r=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map(i=>`${n(i)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var AQ=Mr("effect/schema/ReadonlySet",tt,({annotations:e,typeParameters:t})=>{let n=FB(t[0]);return e===void 0?n:n.annotate(e)});function UB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>Wy(o)?fn(dt(r)(ht(o),i),{onSuccess:Hy,onFailure:a=>Xn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>pt()(Wt(n),vt({decode:Hy,encode:ht})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,Hy,ae),toEquivalence:([n])=>Ih(n),toFormatter:([n])=>r=>{let o=_N(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map(i=>`${n(i)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var RQ=Mr("effect/schema/HashSet",tt,({annotations:e,typeParameters:t})=>{let n=UB(t[0]);return e===void 0?n:n.annotate(e)});function DB(e){let t=An()([e],([n])=>{let r=Wt(n);return(o,s,i)=>Il(o)?fn(dt(r)(ht(o),i),{onSuccess:sy,onFailure:a=>Xn(s,"values",a,o,i)}):G(new st(s,o,i))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>pt()(Wt(n),vt({decode:sy,encode:ht})),toArbitrary:([n])=>(r,o)=>mS(r,o,n.arbitrary,n.terminal,sy),toEquivalence:([n])=>fv(n),toFormatter:([n])=>r=>{let o=H1(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map(i=>`${n(i)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return re(t.ast,{value:e})}var OQ=Mr("effect/schema/Chunk",tt,({annotations:e,typeParameters:t})=>{let n=DB(t[0]);return e===void 0?n:n.annotate(e)}),NB=kc(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>pt()(oe({source:fe,flags:fe}),Rr({decode:(e,t)=>qo({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ke({expected:"valid RegExp source and flags"},e,t)}),encode:e=>v({source:e.source,flags:e.flags})})),toArbitrary:()=>e=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map(t=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),_Q=mr("effect/schema/RegExp",NB),LB=fe.annotate({expected:"a string that will be decoded as a URL"}),XT=kc(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>pt()(LB,xI),toArbitrary:()=>e=>e.webUrl().map(t=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),MQ=mr("effect/schema/URL",XT),PQ=LB.pipe(Ee(XT,xI));function ek(e,t,n){let r={...t};if(e?.minimum!==void 0){let o=n===void 0?e.minimum:n(e.minimum),s=e.exclusiveMinimum?new globalThis.Date(o.getTime()+1):o;(r.min===void 0||s.getTime()>r.min.getTime())&&(r.min=s)}if(e?.maximum!==void 0){let o=n===void 0?e.maximum:n(e.maximum),s=e.exclusiveMaximum?new globalThis.Date(o.getTime()-1):o;(r.max===void 0||s.getTime()<r.max.getTime())&&(r.max=s)}return r}var BB=fe.annotate({expected:"a string that will be decoded as a Date"}),$s=ro(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:()=>pt()(BB,gI),toArbitrary:()=>(e,t)=>e.date(ek(t?.constraint?.ordered?.order===Qc?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),FQ=mr("effect/schema/Date",$s),UQ=BB.pipe(Ee($s,gI)),DQ=zs.pipe(Ee($s,RU)),Tm=ro(nu,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>pt()(He([oe({_tag:Rt("Infinity")}),oe({_tag:Rt("NegativeInfinity")}),oe({_tag:Rt("Nanos"),value:Ti}),oe({_tag:Rt("Millis"),value:zs})]),vt({decode:e=>{switch(e._tag){case"Infinity":return mo;case"NegativeInfinity":return Qi;case"Nanos":return Br(e.value);case"Millis":return fs(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}})),toArbitrary:()=>e=>e.oneof(e.constant(mo),e.constant(Qi),e.bigInt().map(Br),e.maxSafeInteger().map(fs)),toFormatter:()=>globalThis.String,toEquivalence:()=>Fb}),NQ=mr("effect/schema/Duration",Tm),LQ=fe.annotate({expected:"a string that will be decoded as a Duration"}),BQ=LQ.pipe(Ee(Tm,OU)),qQ=Ti.pipe(Ee(Tm,_U)),jQ=Kl.pipe(Ee(Tm,MU)),qB=fe.annotate({expected:"a string that will be decoded as a BigDecimal"}),jB=20,$B="Unable to derive an arbitrary for the ordered BigDecimal constraints";function iS(e,t){return Ha(e,t).value}function $Q(e,t,n){return n?iS(vb(e,t),t)+globalThis.BigInt(1):iS(Ib(e,t),t)}function zQ(e,t,n){return n?iS(Ib(e,t),t)-globalThis.BigInt(1):iS(vb(e,t),t)}function HQ(e){return Math.max(jB,e.minimum?.scale??0,e.maximum?.scale??0,e.exclusiveMinimum&&e.minimum!==void 0?e.minimum.scale+1:0,e.exclusiveMaximum&&e.maximum!==void 0?e.maximum.scale+1:0)}function FT(e,t){let n={};if(e.minimum!==void 0&&(n.min=$Q(e.minimum,t,e.exclusiveMinimum===!0)),e.maximum!==void 0&&(n.max=zQ(e.maximum,t,e.exclusiveMaximum===!0)),!(n.min!==void 0&&n.max!==void 0&&n.min>n.max))return n}function WQ(e){let t=HQ(e);if(FT(e,t)===void 0)throw new globalThis.Error($B);let n=0,r=t;for(;n<r;){let o=n+Math.floor((r-n)/2);FT(e,o)===void 0?n=o+1:r=o}return{min:n,max:t}}var tk=ro(Wa,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>pt()(qB,yI),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===Ki?t.constraint.ordered:void 0;return n===void 0?e.tuple(e.bigInt(),e.integer({min:0,max:jB})).map(([r,o])=>ir(r,o)):e.integer(WQ(n)).chain(r=>{let o=FT(n,r);if(o===void 0)throw new globalThis.Error($B);return e.bigInt(o).map(s=>ir(s,r))})},toFormatter:()=>e=>Xs(e),toEquivalence:()=>bb}),VQ=mr("effect/schema/BigDecimal",tk),KQ=qB.pipe(Ee(tk,yI)),JQ=fe.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function zB(e,t){return JQ.pipe(Ee(e,KU(t)))}var GQ=zB(BT),nk=kc(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>pt()(oe({data:fe.check(KT()),type:fe,name:fe,lastModified:zs}),Rr({decode:(e,t)=>Mo(Cf(e.data),{onFailure:()=>G(new ke({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{let r=new globalThis.Uint8Array(n);return v(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>bs({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ng(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ke({expected:"a readable File"},e,t)})}))}),ZQ=mr("effect/schema/File",nk),rk=kc(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>pt()(Wt(bc([fe,He([oe({_tag:Ze("String"),value:fe}),oe({_tag:Ze("File"),value:nk})])])),Rr({decode:e=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return v(t)},encode:e=>v(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))}),QQ=mr("effect/schema/FormData",rk);function YQ(e){return rk.pipe(Ee(e,JU))}var ok=kc(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>pt()(fe.annotate({expected:"a query string that will be decoded as URLSearchParams"}),vt({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))}),XQ=mr("effect/schema/URLSearchParams",ok);function e7(e){return ok.pipe(Ee(e,GU))}var t7=fe.annotate({expected:"a string that will be decoded as a number"}).pipe(Ee(Kl,ml)),n7=fe.annotate({expected:"a string that will be decoded as a finite number"}).pipe(Ee(js,ml)),r7=re(ov).pipe(Ee(Ti,Bx)),HB=fe.check(VT()),o7=fe.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(Ee(HB,AU())),s7=fe.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(Ee(fe,zU)),i7=fe.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(Ee(fe,HU)),a7=fe.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(Ee(fe,WU)),c7=fe.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(Ee(fe,VU)),UT=He([js,EL,fe]),u7=oe({issues:Wt(oe({message:fe,path:Pt(Wt(He([UT,oe({key:UT})])))}))}),f7=Ca([0,1]).pipe(Ee(vc,vt({decode:e=>e===1,encode:e=>e?1:0}))),WB=fe.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Zo=kc(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>pt()(WB,SI),toArbitrary:()=>e=>e.uint8Array()}),l7=mr("effect/schema/Uint8Array",Zo),d7=WB.pipe(Ee(Zo,SI)),p7=fe.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(Ee(Zo,{decode:gU(),encode:Fx()})),m7=fe.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(Ee(Zo,{decode:yU(),encode:Ux()})),km=ro(e=>Au(e)&&XF(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>pt()(fe,wI),toArbitrary:()=>(e,t)=>e.date(ek(t?.constraint?.ordered?.order===cI?t.constraint.ordered:void 0,{noInvalidDate:!0},Ox)).map(n=>tU(n)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>aI}),h7=mr("effect/schema/DateTimeUtc",km),g7=$s.pipe(Ee(km,{decode:hI(),encode:De(Ox)})),x7=fe.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(Ee(km,wI)),y7=zs.pipe(Ee(km,{decode:hI(),encode:De(iU)})),VB=ro(QF,{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:()=>pt()(zs,ZU),toArbitrary:()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>wp(t)),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),S7=mr("effect/schema/TimeZoneOffset",VB),KB=fe.annotate({expected:"an IANA time zone identifier"}),sk=ro(YF,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecJson:()=>pt()(KB,EI),toArbitrary:()=>e=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(uI)),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>e.id===t.id}),E7=mr("effect/schema/TimeZoneNamed",sk),b7=KB.pipe(Ee(sk,EI)),JB=fe.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),ik=ro(ZF,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecJson:()=>pt()(JB,bI),toArbitrary:()=>e=>e.oneof(e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>wp(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(uI))),toFormatter:()=>e=>uc(e),toEquivalence:()=>(e,t)=>uc(e)===uc(t)}),w7=mr("effect/schema/TimeZone",ik),I7=JB.pipe(Ee(ik,bI)),GB=fe.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),ak=ro(e=>Au(e)&&eU(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecJson:()=>pt()(GB,II),toArbitrary:()=>(e,t)=>e.tuple(e.date(ek(t?.constraint?.ordered?.order===cI?t.constraint.ordered:void 0,{max:new globalThis.Date(864e13-840*60*1e3),min:new globalThis.Date(-864e13+840*60*1e3),noInvalidDate:!0},Ox)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>Cx(n,{timeZone:r})),toFormatter:()=>e=>_x(e),toEquivalence:()=>aI}),v7=mr("effect/schema/DateTimeZoned",ak),T7=GB.pipe(Ee(ak,II)),k7=globalThis.Symbol.for("immer-draftable"),DT={};function ck(e,t,n,r,o){let s=A7(n,t,r),i=ZB(t),a=class extends e{constructor(...[c,u]){let l=u?.["~payload"],p=l?.token===DT?l.value:n.make(c??{},u);super(p,{...u,disableChecks:!0,"~payload":{token:DT,value:p}})}static[mm]=mm;get[i](){return i}static[k7]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return ie(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return Ky(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Wo(this.ast,c))}static annotateKey(c){return this.rebuild(El(this.ast,c))}static check(...c){return this.rebuild(Si(this.ast,c))}static extend(c){return(u,f)=>{let l=Cm(u)?u:oe(u),p={...n.fields,...l.fields},m=Kx(p,n.ast.checks,{identifier:c});return ck(this,c,jT(Si(m,l.ast.checks),p),f,o)}}static mapFields(c,u){return n.mapFields(c,u)}};return o!==void 0&&Object.assign(a.prototype,o(t)),a}function C7(e){return new et(De(t=>new e(t,{"~payload":{token:DT,value:t}})),ks())}function ZB(e){return`~effect/Schema/Class/${e}`}function A7(e,t,n){let r;return o=>{if(r!==void 0)return r;let s=ZB(t),i=u=>u instanceof o||q(u,s),a=C7(o),c=re(new ma([e.ast],()=>(u,f,l)=>i(u)?v(u):G(new st(f,u,l)),{identifier:t,[Ex]:([u])=>({isConstructed:i,link:new Dt(u,a)}),toCodec:([u])=>new Dt(u.ast,a),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map(f=>new o(f)),terminal:u.terminal?.map(f=>new o(f))}),toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[xp]:lc(e.ast),...n}));return r=Ee(c,a)(e)}}function Cm(e){return Gu(e)}var hS=e=>(t,n)=>{let r=Cm(t)?t:oe(t);return ck(hO,e,r,n,o=>({toString(){return`${o}(${X({...this})})`}}))},R7=e=>(t,n,r)=>{let o=Cm(n)?n.mapFields(s=>({_tag:Ze(t),...s}),{unsafePreserveChecks:!0}):Tc(t,n);return hS(e??t)(o,r)},$n=e=>(t,n)=>{let r=Cm(t)?t:oe(t);return ck(kd,e,r,n,s=>({name:s}))},uk=e=>(t,n,r)=>{let o=Cm(n)?n.mapFields(s=>({_tag:Ze(t),...s}),{unsafePreserveChecks:!0}):Tc(t,n);return $n(e??t)(o,r)};function O7(e){let t=x2(e.ast);return n=>t(n,{})}function _7(e){return t=>t.annotate({toFormatter:e})}function M7(e,t){return n(e.ast);function n(o){let s=gi(o)?.toFormatter;if(typeof s=="function")return s(pc(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let i=t.onBefore(o,n);if(i!==void 0)return i}return r(o)}function r(o){switch(o._tag){default:return X;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),i=o.rest.map(n);return a=>{let c=[],u=0;for(;u<s.length;u++)if(a.length<u+1){if(an(o.elements[u]))continue}else c.push(s[u](a[u]));if(i.length>0){let[f,...l]=i;for(;u<a.length-l.length;u++)c.push(f(a[u]));for(let p=0;p<l.length;p++)c.push(l[p](a[u+p]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map(a=>n(a.type)),i=o.indexSignatures.map(a=>n(a.type));return o.propertySignatures.length===0&&o.indexSignatures.length===0?X:a=>{let c=[],u=new Set;for(let f=0;f<s.length;f++){let l=o.propertySignatures[f],p=l.name;u.add(p),!(an(l.type)&&!Object.hasOwn(a,p))&&c.push(`${$i(p)}: ${s[f](a[p])}`)}for(let f=0;f<i.length;f++){let l=ga(a,o.indexSignatures[f].parameter);for(let p of l)u.has(p)||(u.add(p),c.push(`${$i(p)}: ${i[f](a[p])}`))}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=yn(o).types,i=c=>Mp(c,s),a=new Map(s.map((c,u)=>[c,[sm(c),n(o.types[u])]]));return c=>{let u=i(c);for(let f=0;f<u.length;f++){let[l,p]=a.get(u[f]);if(l(c))return p(c)}return X(c)}}case"Suspend":{let s=_u(()=>n(o.thunk()));return i=>s()(i)}}}}function P7(e){return t=>t.annotate({toEquivalence:e})}function F7(e){return y2(e.ast)}function U7(e,t){return CT(e.ast,t)}function QB(e,t){let n=CT(gS(e.ast),t);return P2(n,t)}function Cc(e){return re(gS(e.ast),{schema:e})}var gS=xa(e=>{let t=N7(e,gS),n=e.context;return t===e||n===void 0?t:Sl(t,fk(n))});function fk(e){return e.constructorDefault===void 0?e:new Xr(e.isOptional,e.isMutable,void 0,e.annotations)}function YB(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function XB(e){return t=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(qn(t[s]),s);let r=[...t].sort((s,i)=>{s=qn(s),i=qn(i);let a=e(s),c=e(i);return a!==c?a-c:n.get(s)-n.get(i)});return r.some((s,i)=>s!==t[i])?r:t}}var D7=XB(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function N7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!cn(n))return lt(e,[iv]);let r=e.typeParameters.map(s=>am(qn(s))),o=n(r);return o===void 0?e:lt(e,[mc(o,t)])}case"Unknown":return lt(e,[iv]);case"ObjectKeyword":return lt(e,[L1]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return YB(e),e.recur(t,ny);case"Union":{let n=D7(e.types);return n!==e.types?new Or(n,e.mode,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 eq(e){return re(tq(yn(e.ast)))}var tq=wn(e=>{let t=L7(e,tq);return t!==e&&e.context!==void 0?Sl(t,fk(e.context)):t});function L7(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(cn(n)){let r=n(e.typeParameters.map(o=>am(o)));return lt(e,[mc(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function nq(e){return re(sq(e.ast),{schema:e})}function B7(e){return re(iq(e.ast))}function q7(e,t){let n=ul(e.ast)??tI(e.ast),r=cS(nq(e));return o=>r(o).pipe(Y(s=>j7(s,{rootName:n,...t})))}function j7(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return f(n,e,0),c.join(o?`
31
+ `:"");function u(l,p){c.push(o?s.repeat(l)+p:p)}function f(l,p,m,h){let{attrs:g,safe:y}=ql.tagInfo(l,h);if(p===void 0)u(m,`<${y}${g}/>`);else if(typeof p=="string")u(m,`<${y}${g}>${ql.escapeText(p)}</${y}>`);else if(typeof p!="object"||p===null)u(m,`<${y}${g}>${ql.escapeText(X(p))}</${y}>`);else{if(a.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});a.add(p);try{if(globalThis.globalThis.Array.isArray(p)){if(p.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let x of p)f(r,x,m+1);u(m,`</${y}>`);return}let b=p,E=Object.keys(b);if(i&&E.sort(),E.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let x of E)f(ql.parseTagName(x).safe,b[x],m+1,x);u(m,`</${y}>`)}finally{a.delete(p)}}}}var ql={escapeText(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},escapeAttribute(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},parseTagName(e){let t=e,n=e;return/^[A-Za-z_]/.test(n)||(n="_"+n),n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n)&&(n="_"+n),{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=ql.parseTagName(e),s=n||t&&t!==e?` data-name="${ql.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},$7=XB(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function z7(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map(u=>re(t(qn(u)))),o=e.annotations?.toCodecStringTree;if(cn(o)){let u=o(r);return u===void 0?e:lt(e,[mc(u,t)])}let s=e.annotations?.toCodecJson,i=cn(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(cn(a)?a(r):void 0);return c===void 0?n(e):lt(e,[mc(c,t)])}case"Null":return lt(e,[H7]);case"Boolean":return lt(e,[W7]);case"Unknown":case"ObjectKeyword":return lt(e,[av]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return YB(e),e.recur(t,ny);case"Union":{let r=$7(e.types);return r!==e.types?new Or(r,e.mode,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 H7=new Dt(new Yr("null"),new et(De(()=>null),De(()=>"null"))),W7=new Dt(new Or([new Yr("true"),new Yr("false")],"anyOf"),new et(De(e=>e==="true"),Ru())),rq=new et(De(e=>typeof e=="string"?[e]:e),ks()),oq=e=>e.transformation===rq,sq=xa(e=>{let t=z7(e,sq,n=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});return t!==e&&e.context!==void 0?Sl(t,fk(e.context)):t},{stopAt:oq}),sL=e=>an(e)?bl(ha):ha,iq=xa(e=>{let t=V7(e);if(zI(t)){let n=ey(new Or([new As(t.isMutable,t.elements.map(sL),t.rest.map(sL)),yi],"anyOf"),t,rq);return an(e)?bl(n):n}return t},{stopAt:oq});function V7(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(iq):e}var K7=Re("effect/schema/isGreaterThanDate",oe({exclusiveMinimum:$s}),({annotations:e,payload:t})=>eB(t.exclusiveMinimum,e)),J7=Re("effect/schema/isGreaterThanOrEqualToDate",oe({minimum:$s}),({annotations:e,payload:t})=>tB(t.minimum,e)),G7=Re("effect/schema/isLessThanDate",oe({exclusiveMaximum:$s}),({annotations:e,payload:t})=>nB(t.exclusiveMaximum,e)),Z7=Re("effect/schema/isLessThanOrEqualToDate",oe({maximum:$s}),({annotations:e,payload:t})=>rB(t.maximum,e)),Q7=Re("effect/schema/isBetweenDate",oe({minimum:$s,maximum:$s,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>oB(t,e)),Y7=Re("effect/schema/isGreaterThanBigInt",oe({exclusiveMinimum:Ti}),({annotations:e,payload:t})=>sB(t.exclusiveMinimum,e)),X7=Re("effect/schema/isGreaterThanOrEqualToBigInt",oe({minimum:Ti}),({annotations:e,payload:t})=>iB(t.minimum,e)),e9=Re("effect/schema/isLessThanBigInt",oe({exclusiveMaximum:Ti}),({annotations:e,payload:t})=>aB(t.exclusiveMaximum,e)),t9=Re("effect/schema/isLessThanOrEqualToBigInt",oe({maximum:Ti}),({annotations:e,payload:t})=>cB(t.maximum,e)),n9=Re("effect/schema/isBetweenBigInt",oe({minimum:Ti,maximum:Ti,exclusiveMinimum:Pt(Rt(!0)),exclusiveMaximum:Pt(Rt(!0))}),({annotations:e,payload:t})=>uB(t,e));function r9(e){let t=eq(e);return j2(xT(t),hT(t))}function o9(e){return rS()}function s9(e){return rS()}function i9(e,t){return n=>re(Wo(n.ast,{toCodecIso:()=>new Dt(e.ast,Nx(t))}),{schema:n})}function a9(e){let t=Cc(e),n=xT(t),r=hT(t);return{empty:[],diff:(o,s)=>U2(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=D2(s,i);return Object.is(a,i)?o:r(a)}}}function c9(e){let t=vL(()=>n),n=He([e,Wt(t),$T(fe,t)]);return n}var Am=re(Wo(yl,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),u9=$T(fe,Am),f9=mr("effect/schema/Json",Am),l9=oe({message:fe,name:Ju(fe),stack:Ju(fe),cause:Ju(Am)}),aq=re(Wo(N1,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),d9=mr("effect/schema/MutableJson",aq);function p9(e){return gi(e.ast)}function m9(e){return e.ast.context?.annotations}var h9="~effect/Stream",g9={_R:B,_E:B,_A:B},x9={[h9]:g9,pipe(){return ie(this,arguments)}},cq=e=>{let t=Object.create(x9);return t.channel=e,t};var S9="~effect/Sink";var E9={_A:B,_In:B,_L:B,_E:B,_R:B},b9={[S9]:E9,pipe(){return ie(this,arguments)}};var w9=e=>{let t=Object.create(b9);return t.transform=e,t},uq=e=>Ge((t,n)=>v(O(e.transform(t,n),me)));var fq=e=>w9(t=>{let n=[];if(e<=0)return v([n]);let r;return t.pipe(O(o=>{if(n.length+o.length<=e)return n.push(...o),n.length===e?me():H;for(let s=0;s<o.length;s++)if(n.push(o[s]),n.length===e)return s+1<o.length&&(r=o.slice(s+1)),me();return H}),Ht({disableYield:!0}),jt(()=>v([n,r])))});var rr={};rs(rr,{DefaultChunkSize:()=>wq,Do:()=>XX,TypeId:()=>bq,accumulate:()=>BX,aggregate:()=>_X,aggregateWithin:()=>Tk,bind:()=>tee,bindEffect:()=>nee,bindTo:()=>ree,broadcast:()=>Jq,broadcastN:()=>MX,buffer:()=>jY,bufferArray:()=>$Y,callback:()=>yS,catch:()=>_m,catchCause:()=>Pq,catchCauseFilter:()=>GY,catchCauseIf:()=>JY,catchFilter:()=>Dq,catchIf:()=>Uq,catchReason:()=>VY,catchReasons:()=>KY,catchTag:()=>HY,catchTags:()=>WY,changes:()=>Gq,changesWith:()=>Zq,changesWithEffect:()=>qX,chunks:()=>zq,collect:()=>LX,combine:()=>mX,combineArray:()=>hX,concat:()=>Rm,cross:()=>bY,crossWith:()=>_q,debounce:()=>bX,decodeText:()=>jX,die:()=>N9,drain:()=>aY,drainFork:()=>cY,drop:()=>vk,dropRight:()=>lX,dropUntil:()=>cX,dropUntilEffect:()=>uX,dropWhile:()=>jq,dropWhileEffect:()=>$q,dropWhileFilter:()=>fX,empty:()=>Ai,encodeText:()=>$X,ensuring:()=>Mm,fail:()=>Yu,failCause:()=>Tq,failCauseSync:()=>L9,failSync:()=>D9,filter:()=>wk,filterEffect:()=>UY,filterMap:()=>FY,filterMapEffect:()=>DY,flatMap:()=>Zl,flatten:()=>yk,flattenArray:()=>iY,flattenEffect:()=>eY,flattenIterable:()=>mY,flattenTake:()=>hY,forever:()=>pY,fromArray:()=>Om,fromArrayEffect:()=>$9,fromArrays:()=>z9,fromAsyncIterable:()=>H9,fromChannel:()=>j,fromEffect:()=>xS,fromEffectDrain:()=>Iq,fromEffectRepeat:()=>vq,fromEffectSchedule:()=>M9,fromEventListener:()=>K9,fromIterable:()=>Xu,fromIterableEffect:()=>q9,fromIterableEffectRepeat:()=>j9,fromIteratorSucceed:()=>B9,fromPubSub:()=>gk,fromPubSubTake:()=>kq,fromPull:()=>Hs,fromQueue:()=>Ci,fromReadableStream:()=>xk,fromSchedule:()=>W9,fromSubscription:()=>V9,groupAdjacentBy:()=>RX,groupBy:()=>CX,groupByKey:()=>AX,grouped:()=>TX,groupedWithin:()=>kX,haltWhen:()=>KX,ignore:()=>XY,ignoreCause:()=>eX,interleave:()=>WX,interleaveWith:()=>Yq,interruptWhen:()=>VX,intersperse:()=>Qq,intersperseAffixes:()=>HX,isStream:()=>Ue,iterate:()=>G9,let:()=>eee,limitBytes:()=>oX,make:()=>F9,map:()=>wo,mapAccum:()=>gX,mapAccumArray:()=>tf,mapAccumArrayEffect:()=>yX,mapAccumEffect:()=>xX,mapArray:()=>Aq,mapArrayEffect:()=>tY,mapBoth:()=>X9,mapEffect:()=>ef,mapError:()=>Nq,merge:()=>Sk,mergeAll:()=>EY,mergeEffect:()=>SS,mergeLeft:()=>yY,mergeResult:()=>xY,mergeRight:()=>SY,mkArrayBuffer:()=>pee,mkString:()=>dee,mkUint8Array:()=>mee,never:()=>Q9,onEnd:()=>GX,onError:()=>JX,onExit:()=>Xq,onFirst:()=>tj,onStart:()=>ej,orDie:()=>YY,orElseIfEmpty:()=>ZY,orElseSucceed:()=>QY,paginate:()=>J9,partition:()=>LY,partitionEffect:()=>NY,partitionQueue:()=>Ik,peel:()=>qY,pipeThrough:()=>NX,pipeThroughChannel:()=>UX,pipeThroughChannelOrFail:()=>DX,prepend:()=>gY,provide:()=>nj,provideContext:()=>kk,provideService:()=>ZX,provideServiceEffect:()=>Ck,race:()=>PY,raceAll:()=>Mq,range:()=>Z9,rechunk:()=>Hq,repeat:()=>uY,repeatElements:()=>dY,result:()=>nY,retry:()=>tX,run:()=>oj,runCollect:()=>sj,runCount:()=>oee,runDrain:()=>bS,runFold:()=>iee,runFoldEffect:()=>aee,runForEach:()=>fee,runForEachArray:()=>Ql,runForEachWhile:()=>lee,runHead:()=>cee,runIntoPubSub:()=>yee,runIntoQueue:()=>bee,runLast:()=>uee,runSum:()=>see,scan:()=>SX,scanEffect:()=>EX,schedule:()=>fY,scoped:()=>Y9,service:()=>O9,serviceOption:()=>_9,share:()=>FX,sliding:()=>dX,slidingSize:()=>Wq,split:()=>pX,splitLines:()=>zX,succeed:()=>Gl,suspend:()=>Ur,switchMap:()=>sY,sync:()=>U9,take:()=>rX,takeRight:()=>sX,takeUntil:()=>Lq,takeUntilEffect:()=>Bq,takeWhile:()=>qq,takeWhileEffect:()=>aX,takeWhileFilter:()=>iX,tap:()=>Rq,tapBoth:()=>rY,tapCause:()=>zY,tapError:()=>Fq,tapSink:()=>oY,throttle:()=>vX,throttleEffect:()=>Vq,tick:()=>P9,timeout:()=>lY,timeoutOrElse:()=>Oq,toAsyncIterable:()=>xee,toAsyncIterableEffect:()=>gee,toAsyncIterableWith:()=>_k,toChannel:()=>Qo,toPubSub:()=>See,toPubSubTake:()=>ij,toPull:()=>Ak,toQueue:()=>Eee,toReadableStream:()=>hee,toReadableStreamEffect:()=>Ok,toReadableStreamWith:()=>Rk,transduce:()=>OX,transformPull:()=>Sn,transformPullBracket:()=>hk,unfold:()=>Cq,unwrap:()=>hr,updateContext:()=>rj,updateService:()=>QX,when:()=>BY,withExecutionPlan:()=>nX,withSpan:()=>YX,zip:()=>IY,zipFlatten:()=>kY,zipLatest:()=>_Y,zipLatestAll:()=>bk,zipLatestWith:()=>MY,zipLeft:()=>vY,zipRight:()=>TY,zipWith:()=>Ek,zipWithArray:()=>ES,zipWithIndex:()=>CY,zipWithNext:()=>AY,zipWithPrevious:()=>RY,zipWithPreviousAndNext:()=>OY});var dq="~effect/RcMap",I9=e=>({[dq]:dq,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:"Open",map:hc()},pipe(){return ie(this,arguments)}}),pq=e=>xn(t=>{let n=t.context,r=$e(n,It),o=I9({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive=="function"?jc(e.idleTimeToLive,gt):Qe(gt(e.idleTimeToLive??Zi)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return zt(No(r,()=>{if(o.state._tag==="Closed")return H;let s=o.state.map;return o.state={_tag:"Closed"},Bo(s,([,i])=>Jr(Je(i.scope,Kt))).pipe(Mt(()=>se(()=>{ry(s)})))}),o)}),lk=d(2,(e,t)=>So(n=>{if(e.state._tag==="Closed")return yo;let r=e.state,o=bi(),s=_s(r.map,t),i;if(s._tag==="Some")i=s.value,i.refCount++;else{if(Number.isFinite(e.capacity)&&j1(e.state.map)>=e.capacity)return G(new wP(`RcMap attempted to exceed capacity of ${e.capacity}`));{i={deferred:pu(),scope:Hr(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},i.finalizer=v9(e,t,i),gc(r.map,t,i);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((u,f)=>{c.set(f,u)}),c.set(It.key,i.scope),e.lookup(t).pipe(Ln(Po(c)),Sa(i.scope)).addObserver(u=>Jf(i.deferred,u))}}let a=Gn(o.context,It);return _t(a,i.finalizer).pipe(Dn(n(mu(i.deferred))))}));var v9=(e,t,n)=>xn(r=>{if(n.refCount--,n.refCount>0)return H;if(e.state._tag==="Closed"||!q1(e.state.map,t)||Nd(n.idleTimeToLive))return e.state._tag==="Open"&&Mu(e.state.map,t),Je(n.scope,Kt);if(!ls(n.idleTimeToLive))return H;let o=r.getRef(nc);return n.expiresAt=o.currentTimeMillisUnsafe()+Tn(n.idleTimeToLive),n.fiber?H:(n.fiber=Vw(function s(i){let a=o.currentTimeMillisUnsafe(),c=n.expiresAt-a;return c<=0?e.state._tag==="Closed"||n.refCount>0?H:(Mu(e.state.map,t),i(Je(n.scope,Kt))):O(o.sleep(fs(c)),()=>s(i))}).pipe(ua(se(()=>{n.fiber=void 0})),Ln(r.context),Sa(e.scope)),H)});var dk=d(2,(e,t)=>Iu(n=>{if(e.state._tag==="Closed")return H;let r=_s(e.state.map,t);if(r._tag==="None"||Nd(r.value.idleTimeToLive))return H;let o=r.value;return o.expiresAt=n.currentTimeMillisUnsafe()+Tn(o.idleTimeToLive),H}));var T9="~effect/RcRef",pk={_tag:"Empty"},k9={_tag:"Closed"},C9={_A:B,_E:B},mk=class{[T9]=C9;pipe(){return ie(this,arguments)}state=pk;semaphore=va(1);acquire;context;scope;idleTimeToLive;constructor(t,n,r,o){this.acquire=t,this.context=n,this.scope=r,this.idleTimeToLive=o}},hq=e=>xn(t=>{let n=t.context,r=$e(n,It),o=new mk(e.acquire,n,r,e.idleTimeToLive?gt(e.idleTimeToLive):void 0);return zt(No(r,()=>{let s=o.state._tag==="Acquired"?Je(o.state.scope,Kt):H;return o.state=k9,s}),o)}),A9=e=>So(function t(n){switch(e.state._tag){case"Closed":return yo;case"Acquired":return e.state.refCount++,e.state.fiber?zt(bo(e.state.fiber),e.state):v(e.state);case"Empty":{let r=Hr();return e.semaphore.withPermit(V(()=>e.state._tag!=="Empty"?t(n):n(Nn(e.acquire,Ke(e.context,It,r))).pipe(Y(o=>{let s={_tag:"Acquired",value:o,scope:r,fiber:void 0,refCount:1,invalidated:!1};return e.state=s,s}),fr(o=>ii(o)?Je(r,o):H))))}}}),gq=Se(function*(e){let t=e,n=yield*A9(t),r=yield*zo,o=t.idleTimeToLive!==void 0&&ls(t.idleTimeToLive);return yield*No(r,()=>(n.refCount--,n.refCount>0?H:t.idleTimeToLive===void 0?(t.state=pk,Je(n.scope,Kt)):n.invalidated?Je(n.scope,Kt):o?(n.fiber=oc(t.idleTimeToLive).pipe(O(()=>t.state._tag==="Acquired"&&t.state.refCount===0?(t.state=pk,Je(n.scope,Kt)):H),ua(se(()=>{n.fiber=void 0})),Ln(t.context),Sa(t.scope)),H):H)),n.value});var xq=hq,yq=gq;var bq="~effect/Stream",Ue=e=>q(e,bq),wq=Gp,j=cq,xS=e=>j(ky(Y(e,Ne))),O9=e=>xS(zw(e)),_9=e=>xS(bu(e)),Iq=e=>Hs(v(O(e,()=>me()))),vq=e=>Hs(v(Y(e,Ne))),M9=(e,t)=>Hs($t(function*(){let n=yield*Es(t),r=yield*$o(e,Un,Un.defaultValue()),o=!0,s=V(()=>n(r)).pipe(O(i=>$o(e,Un,i)),Y(i=>(r=i,Ne(i))));return V(()=>o?(o=!1,v(Ne(r))):s)})),P9=e=>Hs(se(()=>{let t=!0,n=v(Ne(void 0)),r=ca(n,e);return V(()=>t?(t=!1,n):r)})),Hs=e=>j(jn(e)),Sn=(e,t)=>j(Ge((n,r)=>O(Ko(e.channel,r),o=>t(o,r)))),hk=(e,t)=>j(Ds((n,r,o)=>O(Ko(e.channel,r),s=>t(s,r,o)))),Qo=e=>e.channel,yS=(e,t)=>j(fD(e,t)),Ai=j(Ol),Gl=e=>j(Ty(Ne(e))),F9=(...e)=>Om(e),U9=e=>j(dD(()=>Ne(e()))),Ur=e=>j(vy(()=>e().channel)),Yu=e=>j(Ii(e)),D9=e=>j(mD(e)),Tq=e=>j(Zp(e)),N9=e=>j(Bv(e)),L9=e=>j(hD(e)),B9=(e,t)=>j(Lv(()=>e,t)),Xu=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?Om(e):j(lD(e,t?.chunkSize)),q9=e=>hr(Y(e,Xu)),j9=e=>Zl(vq(e),Xu),Om=e=>Ye(e)?j(Ty(e)):Ai,$9=e=>hr(Y(e,Om)),z9=(...e)=>j(Nv(Kh(e,Ye))),Ci=e=>j(xD(e)),gk=e=>j(yD(e)),kq=e=>j(SD(e)),xk=e=>j(ED(e)),H9=(e,t)=>j(bD(e,t)),W9=e=>Hs(Y(Yf(e),t=>jt(Y(t(void 0),Ne),()=>me()))),V9=e=>j(jv(e)),K9=(e,t,n)=>yS(r=>{function o(s){Al(r,s)}return ic(se(()=>e.addEventListener(t,o,n)),()=>se(()=>e.removeEventListener(t,o,n)))},{bufferSize:typeof n=="object"?n.bufferSize:void 0}),Cq=(e,t)=>Hs(se(()=>{let n=e;return O(V(()=>t(n)),r=>r===void 0?me():(n=r[1],v(Ne(r[0]))))})),J9=(e,t)=>Hs(se(()=>{let n=e,r=!1;return V(function o(){return r?me():O(t(n),([s,i])=>(xe(i)?r=!0:n=i.value,Ye(s)?v(s):o()))})})),G9=(e,t)=>Cq(e,n=>v([n,t(n)])),Z9=(e,t,n=Gp)=>e>t?Ai:Hs(se(()=>{let r=Math.max(1,n),o=e,s=!1;return V(()=>{if(s)return me();let i=t-o+1;if(i>r){let c=gb(o,o+r-1);return o+=r,v(c)}let a=gb(o,o+i-1);return s=!0,v(a)})})),Q9=j(pD),hr=e=>j(Ta(Y(e,Qo))),Y9=e=>j(ZD(e.channel)),wo=d(2,(e,t)=>Ur(()=>{let n=0;return j(Ns(e.channel,cs(r=>t(r,n++))))})),X9=d(2,(e,t)=>e.pipe(wo(t.onSuccess),Nq(t.onFailure))),Aq=d(2,(e,t)=>j(Ns(e.channel,t))),ef=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(dr,Cy(t,n),Ns(Ne),j)),eY=d(e=>Ue(e[0]),(e,t)=>ef(e,B,t)),tY=d(2,(e,t)=>j(Cy(e.channel,t))),nY=e=>e.pipe(wo(Ce),_m(t=>Gl(Ae(t)))),Rq=d(e=>Ue(e[0]),(e,t,n)=>ef(e,r=>zt(t(r),r),n)),rY=d(2,(e,t)=>e.pipe(Fq(t.onError),Rq(t.onElement,{concurrency:t.concurrency}))),oY=d(2,(e,t)=>hk(e,Se(function*(n,r,o){let s=lr(),i=lr(),a,c,u=!1,f=!1,l=s.whenOpen(V(()=>{if(a){let m=a;return a=void 0,f||s.closeUnsafe(),zt(i.open,m)}return me()}));yield*V(()=>t.transform(l,o)).pipe(m=>Ww(m,h=>(u=!0,ii(h)&&(c=h.cause),i.open),!0),Ut(o));let p=n.pipe(O(m=>(a=m,i.closeUnsafe(),s.openUnsafe(),zt(i.await,m))),jt(()=>(f=!0,i.closeUnsafe(),s.openUnsafe(),O(i.await,()=>me()))));return V(()=>c?ct(c):u?n:p)}))),Zl=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(dr,vD(r=>t(r).channel,n),j)),sY=d(e=>Ue(e[0]),(e,t,n)=>e.channel.pipe(dr,KD(r=>t(r).channel,n),j)),yk=d(e=>Ue(e[0]),(e,t)=>Zl(e,B,t)),iY=e=>j(dr(e.channel)),aY=e=>j(CD(e.channel)),cY=d(2,(e,t)=>SS(e,bS(t))),uY=d(2,(e,t)=>j(AD(e.channel,t))),fY=d(2,(e,t)=>e.channel.pipe(dr,RD(t),Ns(Ne),j)),lY=d(2,(e,t)=>Oq(e,{duration:t,orElse:()=>Ai})),Oq=d(2,(e,t)=>{let n=gt(t.duration);if(!ls(n))return e;if(Nd(n))return Ur(t.orElse);let r=Symbol();return Pq(Ur(()=>{let s=bi().getRef(nc),i=Tn(n),a,c=lr(!1);return Sk(Sn(e,(u,f)=>V(()=>(a=s.currentTimeMillisUnsafe()+i,c.openUnsafe(),u)).pipe(Y(l=>(c.closeUnsafe(),a=void 0,l)),v)),Iq($t(function*(){for(;;)if(yield*c.await,!(a===void 0||(yield*oc(a-s.currentTimeMillisUnsafe()),a===void 0)||a-s.currentTimeMillisUnsafe()>0))return yield*go(r)})),{haltStrategy:"left"})}),o=>o.reasons.find(i=>i._tag==="Die"&&i.defect===r)?t.orElse():Tq(o))}),dY=d(2,(e,t)=>j(Ge((n,r)=>Y(Pe(dr(e.channel))(n,r),o=>{let s,i=$t(function*(){let a=yield*o,c=Ne(a);return s=(yield*Yf(t))(a).pipe(zt(c),jt(f=>(s=void 0,i))),c});return V(()=>s??i)})))),pY=e=>j(zv(e.channel)),mY=e=>Zl(e,Xu),hY=e=>e.channel.pipe(dr,kD,j),Rm=d(2,(e,t)=>yk(Om([e,t]))),gY=d(2,(e,t)=>Rm(Xu(t),e)),Sk=d(e=>Ue(e[0])&&Ue(e[1]),(e,t,n)=>j(_y(Qo(e),Qo(t),n))),SS=d(2,(e,t)=>e.channel.pipe(JD(t),j)),xY=d(2,(e,t)=>Sk(wo(e,Ce),wo(t,Ae))),yY=d(2,(e,t)=>SS(e,bS(t))),SY=d(2,(e,t)=>SS(t,bS(e))),EY=d(2,(e,t)=>yk(Xu(e),t)),bY=d(2,(e,t)=>_q(e,t,(n,r)=>[n,r])),_q=d(3,(e,t,n)=>Zl(e,r=>wo(t,o=>n(r,o)))),Ek=d(3,(e,t,n)=>ES(e,t,wY(n))),wY=e=>(t,n)=>{let r=Math.min(t.length,n.length),o=[];for(let s=0;s<r;s++)o.push(e(t[s],n[s]));return[o,t.slice(r),n.slice(r)]},ES=d(3,(e,t,n)=>j(Ds(Se(function*(r,o){let s=yield*Ko(e.channel,o),i=yield*Ko(t.channel,o),a=$t(function*(){let f=yield*Ut(s,o),l=yield*Ut(i,o);return yield*iy([f,l])}),c={_tag:"PullBoth"};return $t(function*(){let[f,l]=c._tag==="PullBoth"?yield*a:c._tag==="PullLeft"?[yield*s,c.rightArray]:[c.leftArray,yield*i],p=n(f,l);return Ye(p[1])?c={_tag:"PullRight",leftArray:p[1]}:Ye(p[2])?c={_tag:"PullLeft",rightArray:p[2]}:c={_tag:"PullBoth"},p[0]})})))),IY=d(2,(e,t)=>Ek(e,t,(n,r)=>[n,r])),vY=d(2,(e,t)=>ES(e,t,(n,r)=>{let o=Math.min(n.length,r.length),s=n.slice(0,o),i=n.slice(o),a=r.slice(o);return[s,i,a]})),TY=d(2,(e,t)=>ES(e,t,(n,r)=>{let o=Math.min(n.length,r.length),s=r.slice(0,o),i=n.slice(o),a=r.slice(o);return[s,i,a]})),kY=d(2,(e,t)=>Ek(e,t,(n,r)=>[...n,r])),CY=e=>wo(e,(t,n)=>[t,n]),AY=e=>tf(e,D,(t,n)=>{let r=0;t._tag==="None"&&(r=1,t=L(n[0]));let o=rn();for(;r<n.length;r++){let s=t.value;t=L(n[r]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag==="Some"?[[t.value,D()]]:[]}}),RY=e=>tf(e,D,(t,n)=>{let r=rn();for(let o=0;o<n.length;o++){let s=n[o];r.push([t,s]),t=L(n[o])}return[t,r]}),OY=e=>tf(e,()=>({prev:D(),current:D()}),(t,n)=>{let r=0,o;t.current._tag==="None"?(r=1,o=n[0],t.current=L(o)):o=t.current.value;let s=rn();for(;r<n.length;r++){let i=n[r];t.current=L(i),s.push([t.prev,o,t.current]),t.prev=L(o),o=i}return[t,s]},{onHalt(t){return t.current._tag==="Some"?[[t.prev,t.current.value,D()]]:[]}}),bk=(...e)=>j(vy(()=>{let t=[],n=new Set,r=lr();return Oy(Nv(e.map((o,s)=>o.channel.pipe(dr,Cy(i=>(t[s]=i,n.has(s)?v(Ne(t.slice())):(n.add(s),n.size<e.length?r.await:zt(r.open,Ne(t.slice()))))),OD(Kn)))),{concurrency:"unbounded",bufferSize:0})})),_Y=d(2,(e,t)=>bk(e,t)),MY=d(3,(e,t,n)=>wo(bk(e,t),([r,o])=>n(r,o))),Mq=(...e)=>j(Ge((t,n)=>se(()=>{let r,o=Lw(e.map(s=>{let i=Cn(n);return Ko(s.channel,i).pipe(O(a=>Mw(v(a),a)),fr(a=>a._tag==="Success"?r?Je(i,a):(r=a.value[0],H):Je(i,a)),Y(([,a])=>a))}));return V(()=>r??o)}))),PY=d(2,(e,t)=>Mq(e,t)),wk=d(2,(e,t)=>j(_D(Qo(e),t))),FY=d(2,(e,t)=>j(MD(Qo(e),t))),UY=d(2,(e,t)=>j(PD(Qo(e),t))),DY=d(2,(e,t)=>j(FD(Qo(e),t))),Ik=d(e=>Ue(e[0]),Se(function*(e,t,n){let r=yield*zo,o=yield*Ko(e.channel,r),s=n?.capacity==="unbounded"?void 0:n?.capacity??wq,i=yield*no({capacity:s}),a=yield*no({capacity:s});return yield*$t(function*(){for(;;){let c=yield*o,u=[],f=[];for(let p=0;p<c.length;p++){let m=t(c[p]);Fe(m)?u.push(m.failure):f.push(m.success)}let l;if(f.length>0){let p=wy(i,f);p.length>0&&(l=yield*il(Ia(i,p)))}if(u.length>0){let p=wy(a,u);p.length>0&&(yield*Ia(a,p))}l&&(yield*vl(l))}}).pipe(xo(c=>(wi(i,c),wi(a,c),H)),Ut(r)),[i,a]})),NY=d(e=>Ue(e[0]),(e,t,n)=>Y(Ik(ef(e,r=>t(r),n),r=>r,n),([r,o])=>[Ci(r),Ci(o)])),LY=d(e=>Ue(e[0]),(e,t,n)=>Y(Ik(e,t,{capacity:n?.bufferSize??16}),([r,o])=>[Ci(o),Ci(r)])),BY=d(2,(e,t)=>t.pipe(Y(n=>n?e:Ai),hr)),qY=d(2,Se(function*(e,t){let n,r=yield*Zv(e.channel),o=ft(r,a=>(n=a,ct(a))),s=Hs(v(o)),i=yield*oj(s,t);return n?[i,Ai]:(s=Hs(v(r)),[i,s])})),jY=d(2,(e,t)=>j(YD(e.channel,t))),$Y=d(2,(e,t)=>j(QD(e.channel,t))),Pq=d(2,(e,t)=>e.channel.pipe(Ml(n=>t(n).channel),j)),zY=d(2,(e,t)=>e.channel.pipe(Ry(t),j)),_m=d(2,(e,t)=>j(Fs(e.channel,n=>t(n).channel)));var Fq=d(2,(e,t)=>e.channel.pipe(ND(t),j)),Uq=d(e=>Ue(e[0]),(e,t,n,r)=>j(LD(Qo(e),t,o=>n(o).channel,r&&(o=>r(o).channel)))),Dq=d(e=>Ue(e[0]),(e,t,n,r)=>j(BD(Qo(e),t,o=>n(o).channel,r&&(o=>r(o).channel)))),HY=d(e=>Ue(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?s=>q(s,"_tag")&&t.includes(s._tag):Sr(t);return Uq(e,o,n,r)}),WY=d(e=>Ue(e[0]),(e,t,n)=>{let r;return Dq(e,o=>(r??=Object.keys(t),q(o,"_tag")&&ox(o._tag)&&r.includes(o._tag)?Ce(o):Ae(o)),o=>t[o._tag](o),n)}),VY=d(e=>Ue(e[0]),(e,t,n,r,o)=>j(qD(Qo(e),t,n,(s,i)=>r(s,i).channel,o&&((s,i)=>o(s,i).channel)))),KY=d(e=>Ue(e[0]),(e,t,n,r)=>{let o=Object.create(null);for(let i of Object.keys(n)){let a=n[i];o[i]=(c,u)=>a(c,u).channel}let s=r&&((i,a)=>r(i,a).channel);return j(jD(e.channel,t,o,s))}),Nq=d(2,(e,t)=>j($D(e.channel,t))),JY=d(3,(e,t,n)=>j(DD(e.channel,t,r=>n(r).channel))),GY=d(3,(e,t,n)=>j(Hv(e.channel,t,(r,o)=>n(r,o).channel))),ZY=d(2,(e,t)=>j(TD(e.channel,n=>Qo(t())))),QY=d(2,(e,t)=>_m(e,n=>Gl(t(n)))),YY=e=>j(zD(e.channel)),XY=d(e=>Ue(e[0]),(e,t)=>j(HD(e.channel,t))),eX=d(e=>Ue(e[0]),(e,t)=>j(WD(e.channel,t))),tX=d(2,(e,t)=>j(VD(e.channel,t))),Eq=(e,t)=>hr(Y(Es(t),n=>{let r=Un.defaultValue(),o=()=>_m(Ck(e,Un,se(()=>r)),s=>hr(jt(Y(n(s),i=>(r=i,hr(zt(cp,o())))),()=>v(Yu(s)))));return o()})),nX=d(e=>Ue(e[0]),(e,t,n)=>Ur(()=>{let r=n?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},i=Ck(Xg,se(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),a=n?.onEvent===void 0?void 0:Cw(n.onEvent,()=>s),c,u=a===void 0?B:p=>Xq(ej(p,Y(a.begin,m=>{c=m})),m=>V(()=>{if(c===void 0)return H;let h=c;return c=void 0,a.end(h,m)})),f=D(),l=Ur(()=>{let p=t.steps[o];if(!p)return Yu(db(f));let m=i(u(nj(e,p.provide))),h=!1;if(Te(f)){let g=f.value,y=!1,b=m;m=Ur(()=>y?b:(y=!0,Yu(g))),m=Eq(m,ap(p,!1))}else{let g=ap(p,!0);m=g?Eq(m,g):m}return _m(r?tj(m,g=>(h=!0,H)):m,g=>(o++,r&&h?Yu(g):(f=L(g),l)))});return l})),rX=d(2,(e,t)=>t<1?Ai:Lq(e,(n,r)=>r===t-1)),oX=d(3,(e,t,n)=>Ur(()=>{let r=BigInt(t),o=BigInt(0),s=!1;return Rm(qq(e,i=>{let a=o+BigInt(i.length);return a>r?(s=!0,!1):(o=a,!0)}),Ur(()=>s?n():Ai))})),sX=d(2,(e,t)=>tf(e,wa,(n,r)=>(ay(n,r),n.length>t&&zp(n,n.length-t),[n,Aa]),{onHalt(n){return Fu(n)}})),Lq=d(e=>Ue(e[0]),(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=0,i=!1;return O(V(()=>i?me():r),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){i=!0;let f=c.slice(0,n?.excludeLast?u:u+1);return Ye(f)?v(f):me()}return v(c)})}))),Bq=d(e=>Ue(e[0]),(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=0,i=!1;return $t(function*(){if(i)return yield*me();let a=yield*r;for(let c=0;c<a.length;c++)if(yield*t(a[c],s++)){i=!0;let u=a.slice(0,n?.excludeLast?c:c+1);return Ye(u)?u:yield*me()}return a})}))),qq=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=0,s=!1,i=O(V(()=>s?me():n),a=>{let c=[];for(let u=0;u<a.length;u++){if(!t(a[u],o++)){s=!0;break}c.push(a[u])}return Ye(c)?v(c):s?me():i});return i}))),iX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!1,s=O(V(()=>o?me():n),i=>{let a=[];for(let c=0;c<i.length;c++){let u=t(i[c]);if(Fe(u)){o=!0;break}a.push(u.success)}return Ye(a)?v(a):o?me():s});return s}))),aX=d(2,(e,t)=>Bq(e,(n,r)=>Y(t(n,r),o=>!o),{excludeLast:!0})),vk=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=0,s=n.pipe(O(i=>o>=t?v(i):(o+=i.length,o<=t?s:v(i.slice(t-o)))));return s}))),cX=d(2,(e,t)=>vk(jq(e,(n,r)=>!t(n,r)),1)),uX=d(2,(e,t)=>vk($q(e,(n,r)=>Y(t(n,r),o=>!o)),1)),jq=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=0,i=O(n,a=>{let c=a.findIndex(u=>!t(u,s++));return c===-1?i:(o=!1,v(a.slice(c)))});return V(()=>o?i:n)}))),fX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=O(n,i=>{let a=i.findIndex(c=>Fe(t(c)));return a===-1?s:(o=!1,v(i.slice(a)))});return V(()=>o?s:n)}))),$q=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s=0,i=$t(function*(){for(;;){let a=yield*n;for(let c=0;c<a.length;c++)if(!(yield*t(a[c],s++)))return o=!1,a.slice(c)}});return V(()=>o?i:n)}))),lX=d(2,(e,t)=>t<=0?e:Sn(e,(n,r)=>se(()=>{let o=wa(),s=O(n,i=>{cy(o,i);let a=o.length-t,c=Pu(o,a);return Jn(c)?v(c):s});return s}))),zq=e=>e.channel.pipe(Ns(Ne),j),Hq=d(2,(e,t)=>(t=Math.max(1,t),Sn(e,(n,r)=>se(()=>{let o=rn(),s=0,i,a=!1;return V(function c(){if(a)return me();if(i===void 0)return O(n,u=>o.length===0&&u.length===t?v(u):o.length+u.length<t?(o.push(...u),c()):(i=u,c()));for(;s<i.length;)if(o.push(i[s++]),o.length===t){let u=o;return o=[],v(u)}return s=0,i=void 0,c()}).pipe(jt(()=>{if(o.length===0)return me();let c=o;return a=!0,o=[],v(c)}))})))),dX=d(2,(e,t)=>Wq(e,t,1)),Wq=d(3,(e,t,n)=>Sn(e,(r,o)=>se(()=>{let s=null,i=wa(),a=!1,c=0,u=Gr(r,{onSuccess(f){if(cy(i,f),c>0){let p=i.length;zp(i,c),c=Math.max(0,c-p)}if(i.length<t)return u;a=!0;let l=[];for(;i.length>=t;)if(t===n)l.push(Pu(i,t));else if(l.push(Z1(i,t)),t===1&&n<=0)Ms(i);else{let p=i.length;zp(i,n),c=Math.max(0,n-p)}return v(l)},onFailure(f){return a&&zp(i,t-n),i.length===0?ct(f):(s=f,v(Ne(Fu(i))))}});return V(()=>s?ct(s):u)}))),pX=d(2,(e,t)=>tf(e,rn,(n,r)=>{let o=rn();for(let s=0;s<r.length;s++)t(r[s])?Jn(n)&&(o.push(n),n=[]):n.push(r[s]);return[n,o]},{onHalt(n){return Jn(n)?Ne(n):Aa}})),mX=d(4,(e,t,n,r)=>$v(dr(e.channel),dr(t.channel),n,r).pipe(Ns(Ne),j)),hX=d(4,(e,t,n,r)=>j($v(e.channel,t.channel,n,r))),gX=d(e=>Ue(e[0]),(e,t,n,r)=>j(_l(e.channel,t,(o,s)=>{let i=rn();for(let a=0;a<s.length;a++){let[c,u]=n(o,s[a]);o=c,i.push(...u)}return[o,Jn(i)?Ne(i):Aa]},r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Aa}}:void 0))),tf=d(e=>Ue(e[0]),(e,t,n,r)=>j(_l(e.channel,t,(o,s)=>{let[i,a]=n(o,s);return o=i,[o,Ye(a)?Ne(a):Aa]},r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Aa}}:void 0))),Aa=rn(),xX=d(e=>Ue(e[0]),(e,t,n,r)=>e.channel.pipe(dr,_l(t,(o,s)=>Y(n(o,s),([i,a])=>[i,Ye(a)?Ne(a):rn()]),r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Aa}}:void 0),j)),yX=d(e=>Ue(e[0]),(e,t,n,r)=>e.channel.pipe(_l(t,(o,s)=>Y(n(o,s),([i,a])=>[i,Ye(a)?Ne(a):Aa]),r?.onHalt?{onHalt(o){let s=r.onHalt(o);return Ye(s)?Ne(s):Aa}}:void 0),j)),SX=d(3,(e,t,n)=>Ur(()=>{let r=!0;return j(_l(e.channel,Qe(t),(o,s)=>{let i=rn();r&&(r=!1,i.push(o));for(let a=0;a<s.length;a++)o=n(o,s[a]),i.push(o);return[o,Ne(i)]}))})),EX=d(3,(e,t,n)=>e.channel.pipe(dr,UD(t,n),Ns(Ne),j)),bX=d(2,(e,t)=>Sn(e,Se(function*(n,r){let o=yield*nc,s=Tn(gt(t)),i,a,c=1/0,u=lr(),f=lr(),l=lr();yield*n.pipe(u.whenOpen,O(m=>(f.openUnsafe(),i=m,c=o.currentTimeMillisUnsafe()+s,H)),Ht({disableYield:!0}),xo(m=>(a=m,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),l.openUnsafe(),H)),Ut(r));let p=V(function m(){let h=o.currentTimeMillisUnsafe(),g=c<h?s:Math.min(s,c-h);return O(sc(oc(g),l.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(i){f.closeUnsafe(),u.closeUnsafe();let b=v(Ne(Tf(i)));return i=void 0,b}else if(a)return ct(a);return m()})});return V(()=>{if(a){if(i){let m=v(Ne(Tf(i)));return i=void 0,m}return ct(a)}return u.openUnsafe(),f.whenOpen(p)})}))),Vq=d(2,(e,t)=>{let n=t.burst??0;return t.strategy==="enforce"?wX(e,t.cost,t.units,t.duration,n):IX(e,t.cost,t.units,t.duration,n)}),wX=(e,t,n,r,o)=>Sn(e,s=>Iu(i=>{let a=Tn(gt(r)),c=n+o<0?Number.POSITIVE_INFINITY:n+o,u=n,f=i.currentTimeMillisUnsafe();return v(O(s,function l(p){return O(t(p),m=>{let h=i.currentTimeMillisUnsafe(),y=(h-f)/a,b=u+y*n,E=b<0?c:Math.min(b,c);return m<=E?(u=E-m,f=h,v(p)):O(s,l)})}))})),IX=(e,t,n,r,o)=>Sn(e,s=>Iu(i=>{let a=Tn(gt(r)),c=n+o<0?Number.POSITIVE_INFINITY:n+o,u=n,f=i.currentTimeMillisUnsafe();return v(O(s,l=>O(t(l),p=>{let m=i.currentTimeMillisUnsafe(),g=(m-f)/a,y=u+g*n,E=(y<0?c:Math.min(y,c))-p;if(E>=0)return u=E,f=m,v(l);let x=-E/n,w=Math.max(0,x*a);return w>0?O(oc(w),()=>(u=E,f=m,v(l))):(u=E,f=m,v(l))})))})),vX=d(2,(e,t)=>Vq(e,{...t,cost:n=>v(t.cost(n))})),TX=d(2,(e,t)=>zq(Hq(e,t))),kX=d(3,(e,t,n)=>Tk(e,fq(t),Xf(n))),CX=d(e=>Ue(e[0]),(e,t,n)=>Kq(e,Se(function*(r,o,s){for(let i=0;i<r.length;i++){let[a,c]=yield*t(r[i]),u=_s(s,a),f=Te(u)?u.value:yield*wu(lk(o,a));yield*dk(o,a),yield*er(f,c)}}),n)),AX=d(e=>Ue(e[0]),(e,t,n)=>Ur(()=>{let r=hc();return Kq(e,Se(function*(o,s,i){for(let a=0;a<o.length;a++){let c=t(o[a]),u=_s(r,c);xe(u)?gc(r,c,[o[a]]):u.value.push(o[a])}for(let[a,c]of r){let u=_s(i,a),f=Te(u)?u.value:yield*wu(lk(s,a));yield*dk(s,a),yield*Ia(f,c)}ry(r)}),n)})),Kq=(e,t,n)=>hk(e,Se(function*(r,o,s){let i=yield*Kp();yield*_t(o,Ps(i));let a=hc(),c=yield*pq({lookup:u=>ic(no({capacity:n?.bufferSize??4096}).pipe(Mt(f=>(gc(a,u,f),er(i,[u,Ci(f)])))),f=>(Mu(a,u),Jp(f))),idleTimeToLive:n?.idleTimeToLive??mo}).pipe(Do(s));return yield*Yn({while:Xt,body:Qe(O(r,u=>t(u,c,a))),step:bn}).pipe(ft(u=>Zt(i,u)),Ut(o)),Rl(i)})),RX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o,s,i=rn(),a=n.pipe(O(u=>{for(let f=0;f<u.length;f++){let l=u[f],p=t(l);if(s===void 0){o=p,s=[l];continue}else if(ae(p,o)){s.push(l);continue}i.push([o,s]),o=p,s=[l]}if(Jn(i)){let f=i;return i=[],v(f)}return a})),c=!1;return jt(V(()=>c?me():a),()=>{c=!0;let u=s;return s=void 0,u&&Jn(u)?v(Ne([o,u])):me()})}))),OX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o,s,i=V(()=>{if(s!==void 0){let c=s;return s=void 0,v(c)}return n}).pipe(Eu(c=>(o=Uo(c),me()))),a=Y(V(()=>t.transform(i,r)),([c,u])=>(s=u,Ne(c)));return V(()=>o||a)}))),_X=d(2,(e,t)=>Tk(e,t,op)),Tk=d(3,(e,t,n)=>j(Ds(Se(function*(r,o,s){let i=yield*Ko(e.channel,o),a=lr(!1),c=Symbol(),u=yield*no({capacity:0});yield*i.pipe(a.whenOpen,O(x=>(a.closeUnsafe(),er(u,x))),Ht,ft(x=>Zt(u,x)),Ut(s));let f=D(),l,p=!1,m=yield*Yf(n),g=V(function x(){return O(m(f),()=>p?er(u,c):x())}).pipe(O(()=>Kr),jt(()=>me())),y=Vo(u).pipe(O(x=>x===c?me():(p=!0,v(x)))),b=V(()=>{if(l!==void 0){let x=l;return l=void 0,p=!0,v(x)}return a.openUnsafe(),y}),E=O(([x,w])=>!p&&u.state._tag==="Done"?me():(f=L(x),l=w,v(Ne(x))));return V(()=>u.state._tag==="Done"&&l===void 0?u.state.exit:(p=l!==void 0,v(V(()=>t.transform(b,s))))).pipe(O(x=>sc(E(x),g)))})))),MX=d(2,Se(function*(e,t){let n=yield*PX(t),r=new Array(t.n),o=yield*It;for(let s=0;s<t.n;s++){let i=Cn(o),a=yield*Vp(n).pipe($o(It,i));r[s]=qv(gy(a)).pipe(Qp(c=>Je(i,c)),j)}return yield*Lu(e.channel,s=>kl(n,s)).pipe(fr(s=>kl(n,s)),vs),r})),PX=e=>ic(e.capacity==="unbounded"?Hp(e):e.strategy==="dropping"?my(e):e.strategy==="sliding"?hy(e):py(e),Wp),Jq=d(2,(e,t)=>Y(ij(e,t),kq)),FX=d(2,(e,t)=>Y(xq({acquire:Jq(e,t),idleTimeToLive:t.idleTimeToLive}),n=>hr(yq(n)))),UX=d(2,(e,t)=>j(Wv(e.channel,t))),DX=d(2,(e,t)=>j(Vv(e.channel,t))),NX=d(2,(e,t)=>e.channel.pipe(Vv(uq(t)),Ay(([n,r])=>r?Ty(r):Ol),j)),LX=e=>xS(sj(e)),BX=e=>tf(e,rn,(t,n)=>{let r=vf(t,n);return[r,[r]]}),Gq=e=>Zq(e,ae),Zq=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s;return O(n,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 Jn(c)?v(c):O(n,i)})}))),qX=d(2,(e,t)=>Sn(e,(n,r)=>se(()=>{let o=!0,s;return O(n,Se(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 Jn(c)?c:yield*O(n,Se(i))}))}))),jX=d(e=>Ue(e[0]),(e,t)=>Ur(()=>{let n=new TextDecoder(t?.encoding);return wo(e,r=>n.decode(r,{stream:!0}))})),$X=e=>Ur(()=>{let t=new TextEncoder;return wo(e,n=>t.encode(n))}),zX=e=>e.channel.pipe(Wv(GD()),j),Qq=d(2,(e,t)=>Aq(e,(n,r)=>{let o=r===0?[]:[t],s=n.length-1;for(let i=0;i<n.length;i++)i===s?o.push(n[i]):o.push(n[i],t);return o})),HX=d(2,(e,t)=>Gl(t.start).pipe(Rm(Qq(e,t.middle)),Rm(Gl(t.end)))),WX=d(2,(e,t)=>Yq(e,t,Xu(bR([!0,!1])))),Yq=d(3,(e,t,n)=>j(Ge(Se(function*(r,o){let s=yield*Pe(dr(n.channel))(r,o),i=Symbol(),a=!1,c=!1,u=(yield*Pe(dr(e.channel))(r,o)).pipe(jt(()=>(a=!0,v(i)))),f=(yield*Pe(dr(t.channel))(r,o)).pipe(jt(()=>(c=!0,v(i))));return $t(function*(){for(;;){if(a&&c)return yield*me();let l=yield*s;if(l&&a||!l&&c)continue;let p=yield*l?u:f;if(p!==i)return Ne(p)}})})))),VX=d(2,(e,t)=>j(XD(e.channel,t))),KX=d(2,(e,t)=>j(eN(e.channel,t))),Xq=d(2,(e,t)=>j(Qp(e.channel,t))),JX=d(2,(e,t)=>j(tN(e.channel,t))),ej=d(2,(e,t)=>j(nN(e.channel,t))),tj=d(2,(e,t)=>j(Kv(e.channel,n=>t(n[0])))),GX=d(2,(e,t)=>j(rN(e.channel,t))),Mm=d(2,(e,t)=>j(oN(e.channel,t))),nj=d(e=>Ue(e[0]),(e,t,n)=>j(sN(e.channel,t,n))),kk=d(2,(e,t)=>j(My(e.channel,t))),ZX=d(3,(e,t,n)=>j(Py(e.channel,t,n))),Ck=d(3,(e,t,n)=>j(Fy(e.channel,t,n))),rj=d(2,(e,t)=>j(iN(e.channel,t))),QX=d(3,(e,t,n)=>rj(e,r=>Ke(r,t,n($e(r,t))))),YX=function(){let e=Ue(arguments[0]),t=e?arguments[1]:arguments[0],n=Fo(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return j(Jv(r.channel,t,n))}return r=>j(Jv(r.channel,t,n))},XX=Gl({}),eee=d(3,(e,t,n)=>wo(e,r=>({...r,[t]:n(r)})));var tee=d(e=>Ue(e[0]),(e,t,n,r)=>Zl(e,o=>wo(n(o),s=>({...o,[t]:s})),r)),nee=d(e=>Ue(e[0]),(e,t,n,r)=>ef(e,o=>Y(n(o),s=>({...o,[t]:s})),r)),ree=d(2,(e,t)=>wo(e,n=>({[t]:n}))),oj=d(2,(e,t)=>dp(n=>Ko(e.channel,n).pipe(O(r=>t.transform(r,n)),Y(([r])=>r)))),sj=e=>Bu(e.channel,()=>[],(t,n)=>{for(let r=0;r<n.length;r++)t.push(n[r]);return t}),oee=e=>Bu(e.channel,()=>0,(t,n)=>t+n.length),see=e=>Bu(e.channel,()=>0,(t,n)=>{for(let r=0;r<n.length;r++)t+=n[r];return t}),iee=d(3,(e,t,n)=>Bu(e.channel,t,(r,o)=>{for(let s=0;s<o.length;s++)r=n(r,o[s]);return r})),aee=d(3,(e,t,n)=>lN(e.channel,t,(r,o)=>{let s=0,i=r;return Y(Yn({while:()=>s<o.length,body:()=>n(i,o[s]),step(a){i=a,s++}}),()=>i)})),cee=e=>Y(uN(e.channel),Lt(RR(0))),uee=e=>Y(fN(e.channel),Lt(Tf)),fee=d(2,(e,t)=>Lu(e.channel,n=>{let r=0;return Yn({while:()=>r<n.length,body:()=>t(n[r++]),step:bn})})),lee=d(2,(e,t)=>cN(e.channel,n=>{let r=!1,o=0;return Y(Yn({while:()=>!r&&o<n.length,body:()=>t(n[o]),step(s){o++,s||(r=!0)}}),()=>!r)})),Ql=d(2,(e,t)=>Lu(e.channel,t)),bS=e=>aN(e.channel),Ak=e=>Zv(e.channel),dee=e=>Bu(e.channel,()=>"",(t,n)=>t+n.join("")),pee=e=>Y(Gv(e.channel),t=>t.buffer),mee=e=>Gv(e.channel),Rk=d(e=>Ue(e[0]),(e,t,n)=>{let r,o,s=lr(!1);return new ReadableStream({start(i){o=mp(Nn(Ql(e,a=>s.whenOpen(se(()=>{s.closeUnsafe();for(let c=0;c<a.length;c++)i.enqueue(a[c]);r(),r=void 0}))),t)),o.addObserver(a=>{a._tag==="Failure"?i.error(du(a.cause)):i.close()})},pull(){return new Promise(i=>{r=i,s.openUnsafe()})},cancel(){if(o)return Qw(jo(bo(o)))}},n?.strategy)}),hee=d(e=>Ue(e[0]),(e,t)=>Rk(e,bt(),t)),Ok=d(e=>Ue(e[0]),(e,t)=>Y(cr(),n=>Rk(e,n,t))),_k=d(2,(e,t)=>({[Symbol.asyncIterator](){let n=Yw(t),r=Ln(t),o=Hr(),s,i,a,c,u=l=>{if(c)return c;let p=a;return c=n(zt(Dn(p?bo(p):H,Je(o,l)),{done:!0,value:void 0})),c},f=async l=>{try{await u(l)}catch(p){await n(hp("Suppressed error while closing Stream async iterator",p))}};return{async next(){if(c)return c;if(i){let m=i.next();if(!m.done)return m;i=void 0}let l=r(s??O(Ko(e.channel,o),m=>(s=m,m)));a=l;let p=await n(W1(l));if(a===l&&(a=void 0),Ft(p))return i=p.value[Symbol.iterator](),i.next();if(Lo(p.cause))return u(Kt);if(c&&Q0(p.cause))return c;throw await f(p),du(p.cause)},return(){return u(Kt)},async throw(l){throw await f(Hg(l)),l}}}})),gee=e=>Y(cr(),t=>_k(e,t)),xee=e=>_k(e,bt()),yee=d(e=>Ue(e[0]),(e,t,n)=>Yv(e.channel,t,n)),See=d(2,(e,t)=>mN(e.channel,t)),ij=d(2,(e,t)=>hN(e.channel,t)),Eee=d(2,(e,t)=>dN(e.channel,t)),bee=d(2,(e,t)=>Qv(e.channel,t));var aj="~effect/interfaces/PrimaryKey";var uj="~effect/Pool",dj=Symbol(),pj=Symbol();var mj=e=>gj({...e,min:e.size,max:e.size,strategy:vS}),hj=e=>O(e.timeToLiveStrategy==="creation"?Aee(e.timeToLive):Ree(e.timeToLive),t=>gj({...e,strategy:t})),gj=e=>So(Se(function*(t){let n=yield*cr(),r=$e(n,It),o=lp(e.acquire,u=>br(n,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:r,isShuttingDown:!1,usage:0,resizeSemaphore:va(1),items:new Set,availableHead:void 0,availableTail:void 0,invalidated:new Set,waiters:new Set},c={[uj]:uj,[dj]:e.acquire,[pj]:n,config:i,state:a,pipe(){return ie(this,arguments)}};return yield*_t(r,wee(c)),i.minSize>0&&(yield*Mt(al(t(Dk(c)),{startImmediately:!0}),u=>_t(r,bo(u)))),e.strategy!==vS&&(yield*Mt(al(t(e.strategy.run(c))),u=>_t(r,bo(u)))),c})),wee=Se(function*(e){if(e.state.isShuttingDown)return;e.state.isShuttingDown=!0;let t=e.state.items.size,n=va(t);for(let r of e.state.items)r.refCount>0?(r.finalizer=Mt(r.finalizer,n.release(1)),e.state.invalidated.add(r),yield*n.take(1)):(e.state.items.delete(r),Pm(e,r),e.state.invalidated.delete(r),yield*r.finalizer);if(yield*n.releaseAll,e.state.waiters.size>0){let r=Array.from(e.state.waiters);e.state.waiters.clear();for(let o of r)o()}yield*n.take(t)}),Pk=e=>pe(t=>{let n=e.state;if(n.isShuttingDown)return qf;if(n.availableHead!==void 0){if(n.usage++,e.config.isFixed||wS(e)<=IS(e))return xj(e,n.availableHead,t);n.usage--}return Iee(e,Tee)});var Iee=(e,t)=>$r(n=>{let r=e.state;r.usage++;let o=ne(Fg(n(Cee(e)),()=>ge(()=>{r.usage--})),()=>i),s=pe(a=>r.isShuttingDown?(r.usage--,qf):r.availableHead!==void 0?t(e,r.availableHead,a,n):o),i=he(()=>r.isShuttingDown?(r.usage--,qf):wS(e)>IS(e)?ne(r.resizeSemaphore.withPermitsIfAvailable(1)(Ut(fa(Dk(e)),r.scope)),()=>s):s);return i}),vee=(e,t)=>{let n=e.state;return t.exit._tag==="Failure"?(n.usage--,n.items.delete(t),n.invalidated.delete(t),Pm(e,t),!1):(t.refCount++,t.refCount>=e.config.concurrency&&Pm(e,t),!0)},xj=(e,t,n)=>{if(!vee(e,t))return t.exit;let r=Gn(n.context,It);return r.state._tag==="Closed"?ne(t.release(t.exit),()=>t.exit):(su(r,{},t.release),t.exit)},Tee=(e,t,n)=>xj(e,t,n),kee=(e,t)=>pe(n=>{let r=e.state;return t.refCount--,r.usage--,r.invalidated.has(t)?Uk(e,t):(t.refCount===e.config.concurrency-1&&(Fk(e,t),yj(e,n,1)),we)}),Cee=e=>Bt(t=>{let n=e.state;if(n.availableHead!==void 0||n.isShuttingDown)return t(we);let r=()=>{n.waiters.delete(r),t(we)};return n.waiters.add(r),ge(()=>{n.waiters.delete(r)})}),yj=(e,t,n)=>{let r=e.state.waiters;r.size!==0&&t.currentDispatcher.scheduleTask(()=>{let o=n,s=[];for(let i of r){if(o--<=0)break;s.push(i)}for(let i=0;i<s.length;i++)s[i]()},0)},fj=e=>pe(t=>(yj(e,t,Number.POSITIVE_INFINITY),we)),Fk=(e,t)=>{t.isAvailable||(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)},Pm=(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 Uk=(e,t)=>V(()=>{if(e.state.items.has(t)){if(t.refCount===0)return e.state.items.delete(t),Pm(e,t),e.state.invalidated.delete(t),jo(O(t.finalizer,()=>Ut(fa(Dk(e)),e.state.scope,{startImmediately:!0})))}else return H;return e.state.invalidated.add(t),Pm(e,t),H}),Dk=e=>e.state.resizeSemaphore.withPermits(1)(Mk(e)),Mk=e=>V(()=>{let t=IS(e),n=wS(e);if(t>=n)return H;let r=n-t,o=e.config.strategy===vS?lj(e):O(e.config.strategy.reclaim(e),i=>i?v(i):lj(e));if(r===1){let i=Mt(o,fj(e));return e.config.isFixed?jo(i):O(i,a=>a.exit._tag==="Failure"?H:Mk(e))}let s=o.pipe(Kw(r,{concurrency:r}),Mt(fj(e)));return e.config.isFixed?jo(s):O(s,i=>i.some(a=>a.exit._tag==="Failure")?H:Mk(e))}),lj=e=>$r(t=>pe(n=>{let r=e,o=cu(),s=n.context;n.setContext(Ke(r[pj],It,o));let i=O(Jr(r[dj]),a=>{let c={exit:a,finalizer:ft(Je(o,a),Oee),refCount:0,disableReclaim:!1,isAvailable:!1,availablePrevious:void 0,availableNext:void 0,release:void 0};return c.release=Qe(kee(e,c)),e.state.items.add(c),Fk(e,c),e.config.strategy===vS?a._tag==="Success"?v(c):zt(c.finalizer,c):zt(a._tag==="Success"?e.config.strategy.onAcquire(c):O(c.finalizer,()=>e.config.strategy.onAcquire(c)),c)});return hs(t(i),a=>(n.setContext(s),a._tag==="Failure"?Lf(o,a):void 0),!0)})),wS=e=>{if(e.state.isShuttingDown)return 0;if(e.config.isFixed)return e.config.minSize;let t=e.state.usage/e.config.targetUtilization,n=Math.ceil(t/e.config.concurrency);return Math.min(Math.max(e.config.minSize,n),e.config.maxSize)},IS=e=>e.state.items.size-e.state.invalidated.size,vS={run:e=>H,onAcquire:e=>H,reclaim:e=>rl},Aee=Se(function*(e){let t=yield*nc,n=yield*Kp(),r=Tn(gt(e)),o=new WeakMap;return B({run:s=>{let i=a=>V(()=>{if(!s.state.items.has(a)||s.state.invalidated.has(a))return H;let c=t.currentTimeMillisUnsafe(),u=o.get(a),f=r-(c-u);return f>0?ca(i(a),f):Uk(s,a)});return Vo(n).pipe(Mt(i),Ht({disableYield:!0}))},onAcquire:s=>V(()=>(o.set(s,t.currentTimeMillisUnsafe()),er(n,s))),reclaim:s=>rl})}),Ree=Se(function*(e){let t=yield*Kp();return B({run:n=>{let r=V(()=>IS(n)-wS(n)<=0?H:Vo(t).pipe(Mt(s=>Uk(n,s)),O(()=>r)));return r.pipe(ca(e),Ht({disableYield:!0}))},onAcquire:n=>er(t,n),reclaim(n){return V(()=>{if(n.state.invalidated.size===0)return rl;let r=wR(zh(n.state.invalidated,o=>!o.disableReclaim));return r._tag==="None"?rl:(n.state.invalidated.delete(r.value),r.value.refCount<n.config.concurrency&&Fk(n,r.value),zt(er(t,r.value),r.value))})}})}),Oee=e=>xn(t=>{let n=t.getRef(AP);return n?cl(n)("Unhandled error in pool finalizer",e):H});var Ri=class extends Ve()("effect/reactivity/Reactivity"){},_ee=se(()=>{let e=new Map,t=c=>{Nk(c,u=>{let f=e.get(u);f!==void 0&&f.forEach(l=>l())})},n=c=>ur(u=>{let f=Ji(u,TS);return f?Nk(c,l=>{f.add(l)}):t(c),H}),r=(c,u)=>Mt(u,n(c)),o=(c,u)=>{let f=[];return Nk(c,l=>{f.push(l);let p=e.get(l);p===void 0&&(p=new Set,e.set(l,p)),p.add(u)}),()=>{for(let l=0;l<f.length;l++){let p=e.get(f[l]);p.delete(u),p.size===0&&e.delete(f[l])}}},s=(c,u)=>$t(function*(){let f=yield*cr(),l=$e(f,It),p=yield*no(),m=jc(Ln(f),Sa(l)),h=!1,g=!1,y=x=>{x._tag==="Failure"?wi(p,x.cause):Al(p,x.value),g?(g=!1,m(u).addObserver(y)):h=!1};function b(){if(h){g=!0;return}h=!0,m(u).addObserver(y)}let E=o(c,b);return yield*_t(l,se(E)),b(),p}),i=(c,u)=>s(c,u).pipe(Y(Ci),hr),a=c=>V(()=>{let u=new Set;return c.pipe($o(TS,u),fr(f=>se(()=>{u.forEach(l=>{let p=e.get(l);p!==void 0&&p.forEach(m=>m())})})))});return Ri.of({mutation:r,query:s,stream:i,invalidateUnsafe:t,invalidate:n,registerUnsafe:o,withBatch:a})}),TS=class extends Ve()("effect/reactivity/Reactivity/PendingInvalidation"){},kS=d(2,(e,t)=>Ri.use(n=>n.mutation(t,e)));var CS=e=>Ri.use(t=>t.invalidate(e)),AS=Wr(Ri)(_ee);function Ej(e){switch(typeof e){case"string":case"number":case"bigint":case"boolean":return String(e);default:return ce(e)}}var Nk=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(Ej(e[n]));return}for(let n in e){t(n);let r=e[n];for(let o=0;o<r.length;o++)t(`${n}:${Ej(r[o])}`)}};var bj="~effect/SubscriptionRef",Fm=e=>q(e,bj),vle={...vn,[bj]:{_A:B},toJSON(){return{_id:"SubscriptionRef",value:this.value}}};var Lk=e=>gk(e.pubsub);var wj=e=>se(()=>e.value);var Mee=(e,t)=>{e.value=t,Y1(e.pubsub,t)};var Bk=d(2,(e,t)=>e.semaphore.withPermit(se(()=>Mee(e,t))));var zn=k.String.check(k.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*$/u));var Um=k.String.check(k.isPattern(/^[a-f\d]{64}$/u)),OS=k.Literals(["answer","clarify","not_now"]),Pee=k.Struct({prompt:zn.check(k.isMaxLength(128)),selected:k.Array(zn.check(k.isMaxLength(128))).check(k.isMaxLength(32)),text:k.String.check(k.isMaxLength(8192))}),_S=k.Array(Pee).check(k.isMaxLength(32)),Fee=k.Struct({deadline:k.Number.check(k.isFinite(),k.isGreaterThanOrEqualTo(0),k.isLessThanOrEqualTo(864e13)),item:zn,reason:k.String,registeredAt:k.Number.check(k.isFinite(),k.isGreaterThanOrEqualTo(0),k.isLessThanOrEqualTo(864e13)),request:zn,reviewedRevision:Um,source:k.String}),vj=k.Struct({answers:k.optional(_S),author:k.String.check(k.isPattern(/\S/u),k.isMaxLength(200)),question:zn,recordedAt:k.Number.check(k.isFinite(),k.isGreaterThanOrEqualTo(0),k.isLessThanOrEqualTo(864e13)),reviewedRevision:Um,supersedes:k.optional(zn),type:OS}),Tj=k.Struct({context:k.String,id:zn,item:zn,reason:k.String,request:zn,reviewedRevision:Um,source:k.String}),MS=k.Struct({context:k.String,id:zn,question:Fee}),PS=k.Struct({body:k.String,id:zn,response:vj}),kj=k.Struct({question:MS,responses:k.Array(PS)}),Cj=k.Struct({expired:k.Boolean,question:MS,response:k.optional(PS)}),Oi=class extends k.TaggedError()("ResponseFailed",{cause:k.optional(k.Defect()),code:k.Literals(["Disabled","Missing","Stale","Conflict","Unavailable","Unsupported","Uncertain","Unanswered"]),message:k.String}){},Aj=k.Struct({answers:k.optional(_S),author:vj.fields.author,body:k.String.check(k.isMaxLength(32768)),id:zn,question:zn,supersedes:k.optional(zn),type:OS});var Rj=2*1024*1024,qk=720*60*60*1e3;function Uee(e){return{..."question"in e?{question:k.decodeUnknownSync(zn)(e.question)}:{},..."recovery"in e?{recovery:k.decodeUnknownSync(k.String)(e.recovery)}:{},..."answers"in e?{answers:k.decodeUnknownSync(_S,{onExcessProperty:"error"})(e.answers)}:{},..."supersedes"in e?{supersedes:k.decodeUnknownSync(zn)(e.supersedes)}:{}}}function FS(e,t){if(e===null)return{drafts:{},expired:!1};if(new TextEncoder().encode(e).length>Rj)throw new Error("Draft storage exceeds the workspace limit.");let n=JSON.parse(e);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Draft storage is malformed.");let r={},o=!1;for(let[s,i]of Object.entries(n)){if(typeof i!="object"||i===null||!("author"in i)||!("body"in i)||!("id"in i)||!("revision"in i)||!("type"in i)||!("updatedAt"in i)||typeof i.author!="string"||typeof i.body!="string"||typeof i.id!="string"||typeof i.revision!="string"||i.type!=="answer"&&i.type!=="clarify"&&i.type!=="not_now"||typeof i.updatedAt!="number"||!Number.isFinite(i.updatedAt))throw new Error("Draft storage is malformed.");if(i.updatedAt>t||t-i.updatedAt>=qk){o=!0;continue}r[s]={...Uee(i),author:i.author,body:i.body,id:i.id,revision:i.revision,type:i.type,updatedAt:i.updatedAt}}return{drafts:r,expired:o}}function US(e){let t=JSON.stringify(e);if(new TextEncoder().encode(t).length>Rj)throw new Error("Draft storage is full. Copy this draft before clearing workspace drafts.");return t}var _i=new Map;function Oj(e,t,n,r,o){let s=`${JSON.stringify(r)}:${e}`;function i(){if(!n)throw new Error("Draft storage unavailable");return n}let a=!1,c={};try{let h=FS(i().getItem(r),le.runSync(fi.currentTimeMillis));c=h.drafts,h.expired&&o("Expired drafts were cleared after 30 days. Saved responses are unaffected."),i().setItem(r,US(c))}catch{a=!0,o("Draft history is unavailable or malformed. Keep a copy; edits remain in this window.")}let u=_i.get(s);u&&le.runSync(fi.currentTimeMillis)-u.updatedAt>=qk&&(_i.delete(s),o("A window draft expired after 30 days. Saved responses are unaffected."));let f=_i.get(s)??c[e]??{author:"",body:"",id:`response.${crypto.randomUUID()}`,revision:t,type:"answer",updatedAt:le.runSync(fi.currentTimeMillis)};f.revision!==t&&o("Source changed since this draft. Your text is retained; review the new source and preview to bind it to this revision.");function l(h){f={..._i.get(s)??f,...h,updatedAt:le.runSync(fi.currentTimeMillis)},_i.set(s,f);try{if(a)throw new Error("Unknown draft history");let g=FS(i().getItem(r),le.runSync(fi.currentTimeMillis)).drafts;i().setItem(r,US({...g,[e]:f}))}catch{o("Draft could not be persisted (storage full or unavailable). Keep a copy; your text remains in this window.")}return f}function p(){try{i().removeItem(r),a=!1;for(let h of _i.keys())h.startsWith(`${JSON.stringify(r)}:`)&&_i.delete(h);o("Workspace drafts cleared. Saved responses are unchanged; this visible text remains until you navigate away.")}catch{o("Draft storage could not be cleared.")}}function m(h){if(_i.get(s)!==h)return _i.get(s)?.id===h.id&&l({id:`response.${crypto.randomUUID()}`}),!1;_i.delete(s);try{let g=FS(i().getItem(r),le.runSync(fi.currentTimeMillis)).drafts;g[e]?.id===h.id&&delete g[e],i().setItem(r,US(g))}catch{o("Saved response confirmed, but its browser draft could not be cleared.")}return f={...f,answers:void 0,body:"",id:`response.${crypto.randomUUID()}`,recovery:void 0,supersedes:void 0,updatedAt:le.runSync(fi.currentTimeMillis)},!0}return{clear:p,current:()=>f,saved:m,update:l}}function _j(e,t,n){return`# Recorded response
32
+
33
+ ${e.map((o,s)=>{let i=t[s],a=o.options.filter(c=>i?.selected.includes(c.id));return`## Question: ${o.id}
34
+
35
+ ${o.source}
36
+
37
+ Selected: ${a.map(c=>c.id).join(", ")||"No supplied option"}
38
+
39
+ ${a.map(c=>c.source).join(`
40
+
41
+ `)}
42
+
43
+ ${i?.text.trim()?`Additional text:
44
+
45
+ ${i.text}`:""}`}).join(`
46
+
47
+ `)}
48
+
49
+ ${n.trim()?`## Overall response
50
+
51
+ ${n}`:""}`.trim()}function Mj(e,t,n=[]){return`New file: responses/${e.id}.md
32
52
  Registration (if needed): responses/${t}.md
33
53
  Recorded time is assigned by the server when saving.
34
54
 
35
55
  ---
36
- ${JSON.stringify({id:e.id,kind:"response",response:{author:e.author,question:t,reviewedRevision:e.revision,type:e.type}},null,2)}
56
+ ${JSON.stringify({id:e.id,kind:"response",response:{answers:e.answers,author:e.author,question:t,reviewedRevision:e.revision,supersedes:e.supersedes,type:e.type}},null,2)}
37
57
  ---
38
- ${e.body}`}var vq="~effect/http/Cookies";var Tq="~effect/http/Cookies/Cookie";var kq="~effect/http/Cookies/CookieError",Bk=class extends mO{},Cq=class e extends Mn("CookieError"){static fromReason(t,n){return new e({reason:new Bk({_tag:t,cause:n})})}[kq]=kq;get message(){return this.reason._tag}},Aee={[vq]:vq,...Gs,toJSON(){return{_id:"effect/Cookies",cookies:Hh(this.cookies,e=>e.toJSON())}},pipe(){return ie(this,arguments)}},Ree=e=>{let t=Object.create(Aee);return t.cookies=e,t},Oee=e=>{let t={};for(let n of e)W(t,n.name,n);return Ree(t)},Rq=e=>{let t=typeof e=="string"?[e]:e,n=[];for(let r of t){let o=_ee(r.trim());o&&n.push(o)}return Oee(n)};function _ee(e){let t=e.split(";").map(a=>a.trim()).filter(a=>a!=="");if(t.length===0)return;let n=t[0].indexOf("=");if(n===-1)return;let r=t[0].slice(0,n);if(!Mee.test(r))return;let o=t[0].slice(n+1),s=Pee(o);if(t.length===1)return Object.assign(Object.create(Aq),{name:r,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(),l=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(l===void 0)break;let p=l.trim().replace(/^\./,"");p&&(i.domain=p);break}case"expires":{if(l===void 0)break;let p=new Date(l);isNaN(p.getTime())||(i.expires=p);break}case"max-age":{if(l===void 0)break;let p=parseInt(l,10);isNaN(p)||(i.maxAge=_E(p));break}case"path":{if(l===void 0)break;l[0]==="/"&&(i.path=l);break}case"priority":{if(l===void 0)break;switch(l.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(l===void 0)break;switch(l.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(Aq),{name:r,value:s,valueEncoded:o,options:Object.keys(i).length>0?i:void 0})}var Mee=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;var Aq={[Tq]:Tq,...Gs,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};var Pee=e=>{try{return decodeURIComponent(e)}catch{return e}};var HS={};ns(HS,{Fetch:()=>c$,RequestInit:()=>zS,layer:()=>ote});var _q=Symbol.for("~effect/http/Headers");var Um=Object.defineProperties(Object.create(null),{[_q]:{value:_q},[Wc]:{value(e){return Uee(this,$e(e,qk))}},toJSON:{value(){return To(this)}},[_e]:{value(e){return Fee(this,e)}},[Oe]:{value(){return xd(this)}},toString:{value:Gs.toString},[at]:{value:Gs[at]}}),MS=e=>Object.assign(Object.create(Um),e),Fee=IR(Hc());var Yl=Object.create(Um),Oi=e=>{if(e===void 0)return Yl;if(Symbol.iterator in e){let n=Object.create(Um);for(let[r,o]of e)n[r.toLowerCase()]=o;return n}let t=Object.create(Um);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(", "):r!==void 0&&(t[n.toLowerCase()]=r);return t},Mq=e=>Object.setPrototypeOf(e,Um);var Dm=d(3,(e,t,n)=>{let r=MS(e);return r[t.toLowerCase()]=n,r}),Pq=d(2,(e,t)=>MS({...e,...Oi(t)})),Xl=d(2,(e,t)=>{let n=MS(e);return Object.assign(n,t),n}),Ac=d(2,(e,t)=>{let n=MS(e);return delete n[t.toLowerCase()],n});var Uee=d(2,(e,t)=>{let n={...e},r=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(n[s]=bc(e[s]))}else for(let s in e)o.test(s)&&(n[s]=bc(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)r(t[o]);else r(t);return n}),jk=(e,t)=>{for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="string"){if(r.toLowerCase()===e)return!0}else if(r.test(e))return!0}return!1},qk=Me("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]});var $k="~effect/http/UrlParams",Dee=e=>j(e,$k),Nee={...vn,[$k]:$k,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[_e](e){return Lee(this,e)},[Oe](){return Fa(this.params.flat())}},Fq=e=>{let t=Object.create(Nee);return t.params=e,t},Nm=e=>{if(Dee(e))return e;let t=Uq(e),n=[];for(let r=0;r<t.length;r++)if(Array.isArray(t[r][0])){let[o,s]=t[r];n.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else n.push(t[r]);return Fq(n)},Uq=e=>{let t=typeof e[Symbol.iterator]=="function"?ht(e):Object.entries(e),n=[];for(let[r,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&n.push([r,String(o[s])]);else if(typeof o=="object"){let s=Uq(o);for(let[i,a]of s)n.push([[r,...typeof i=="string"?[i]:i],a])}else o!==void 0&&n.push([r,String(o)]);return n},Lee=un((e,t)=>Bee(e.params,t.params)),Bee=RR(xR([Hc(),Hc()]));var Dq=Fq([]);var Nq=d(2,(e,t)=>{let n=Nm(t),r=n.params,o=new Set;for(let s=0;s<r.length;s++)o.add(r[s][0]);for(let s=0;s<e.params.length;s++)o.has(e.params[s][0])||r.push(e.params[s]);return n});var Hk="~effect/http/HttpBody";var Lq="~effect/http/HttpBody/HttpBodyError",Bq=class extends Mn("HttpBodyError"){[Lq]=Lq},PS=class{[Hk];constructor(){this[Hk]=Hk}[at](){return this.toJSON()}toString(){return X(this,{ignoreToString:!0})}},Wk=class extends PS{_tag="Empty";toJSON(){return{_id:"effect/HttpBody",_tag:"Empty"}}},jq=new Wk;var Kk=class extends PS{_tag="Uint8Array";body;contentType;contentLength;constructor(t,n,r){super(),this.body=t,this.contentType=n,this.contentLength=r}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}}},FS=(e,t)=>new Kk(e,t??"application/octet-stream",e.length),jee=new TextEncoder,Vk=(e,t)=>FS(jee.encode(e),t??"text/plain");var Gk="~effect/http/HttpClientError";var wo=class extends Mn("HttpClientError"){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[Gk]=Gk;get request(){return this.reason.request}get response(){return"response"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},LS=e=>e.endsWith("Error")?e.slice(0,-5):e,BS=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,US=class extends Mn("TransportError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return BS(LS(this._tag),this.description,this.methodAndUrl)}};var DS=class extends Mn("InvalidUrlError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return BS(LS(this._tag),this.description,this.methodAndUrl)}};var Rc=class extends Mn("DecodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return BS(LS(this._tag),this.description,t)}},NS=class extends Mn("EmptyBodyError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return BS(LS(this._tag),this.description,t)}},ed=class e extends $n(Gk)({_tag:Ze("HttpError"),kind:ka(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:Pt(ln())}){static fromHttpClientError(t){return new e({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}};var qq=[["GET","get"],["POST","post"],["PUT","put"],["DELETE","del"],["PATCH","patch"],["HEAD","head"],["OPTIONS","options"],["TRACE","trace"]];var zq=(e,t)=>t._tag==="Empty"||t._tag==="FormData"?Ac(Ac(e,"content-type"),"content-length"):(e=t.contentType===void 0?Ac(e,"content-type"):Dm(e,"content-type",t.contentType),t.contentLength===void 0?Ac(e,"content-length"):Dm(e,"content-length",t.contentLength.toString()));var Zk=class extends Mn("UrlError"){},Hq=(e,t,n)=>qh({try:()=>{let r=new URL(e,$ee());for(let o=0;o<t.params.length;o++){let[s,i]=t.params[o];i!==void 0&&r.searchParams.append(s,i)}return n!==void 0&&(r.hash=n),r},catch:r=>new Zk({cause:r})}),$ee=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var Kq="~effect/http/HttpClientRequest";var zee={[Kq]:Kq,...Gs,toJSON(){return{_id:"HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:To(this.headers),body:this.body.toJSON()}},pipe(){return ie(this,arguments)}};function _i(e,t,n,r,o,s){let i=Object.create(zee);return i.method=e,i.url=t,i.urlParams=n,i.hash=r,i.headers=o,i.body=s,i}var Hee=_i("GET","",Dq,D(),Yl,jq),Vq=e=>(t,n)=>Wee(Hee,{method:e,url:t,...n??void 0});var Wee=d(2,(e,t)=>{let n=e;return t.method&&(n=Jq(n,t.method)),t.url&&(n=Qq(n,t.url)),t.headers&&(n=Qk(n,t.headers)),t.urlParams&&(n=Jee(n,t.urlParams)),t.hash&&(n=Gee(n,t.hash)),t.body&&(n=Xq(n,t.body)),t.accept&&(n=Zq(n,t.accept)),t.acceptJson&&(n=Kee(n)),n}),Jq=d(2,(e,t)=>_i(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Gq=d(3,(e,t,n)=>_i(e.method,e.url,e.urlParams,e.hash,Dm(e.headers,t,n),e.body)),Qk=d(2,(e,t)=>_i(e.method,e.url,e.urlParams,e.hash,Pq(e.headers,t),e.body));var Zq=d(2,(e,t)=>Gq(e,"Accept",t)),Kee=Zq("application/json"),Qq=d(2,(e,t)=>{if(typeof t=="string")return _i(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Nm(n.searchParams),o=Xc(n.hash===""?void 0:n.hash.slice(1));return n.search="",n.hash="",_i(e.method,n.toString(),r,o,e.headers,e.body)}),Yq=d(2,(e,t)=>t===""?e:_i(e.method,Vee(t,e.url),e.urlParams,e.hash,e.headers,e.body));var Vee=(e,t)=>{let n=e.endsWith("/"),r=t.startsWith("/");return n&&r?e+t.slice(1):!n&&!r?e+"/"+t:e+t};var Jee=d(2,(e,t)=>_i(e.method,e.url,Nq(e.urlParams,t),e.hash,e.headers,e.body));var Gee=d(2,(e,t)=>_i(e.method,e.url,e.urlParams,L(t),e.headers,e.body));var Xq=d(2,(e,t)=>_i(e.method,e.url,e.urlParams,e.hash,zq(e.headers,t),t));var nf="~effect/http/HttpIncomingMessage";var e$=(e,t)=>{let n=e.headers["content-type"]??"",r;if(n.includes("application/json"))try{r=hi(e.json)}catch{}else if(n.includes("text/")||n.includes("urlencoded"))try{r=hi(e.text)}catch{}let o={...t,headers:To(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(o.body=r),o};var td="~effect/http/HttpClientResponse",t$=(e,t)=>new eC(e,t);var eC=class extends _h{[nf];[td];request;source;constructor(t,n){super(),this.request=t,this.source=n,this[nf]=nf,this[td]=td}toJSON(){return e$(this,{_id:"HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return Oi(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=Rq(this.source.headers.getSetCookie())}get remoteAddress(){return D()}get stream(){return this.source.body?gk({evaluate:()=>this.source.body,onError:t=>new wo({reason:new Rc({request:this.request,response:this,cause:t})})}):Yu(new wo({reason:new NS({request:this.request,response:this,description:"can not create stream from empty body"})}))}get json(){return R(this.text,t=>Bo({try:()=>t===""?null:JSON.parse(t),catch:n=>new wo({reason:new Rc({request:this.request,response:this,cause:n})})}))}textBody;get text(){return this.textBody??=Y(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return R(this.text,t=>Bo({try:()=>Nm(new URLSearchParams(t)),catch:n=>new wo({reason:new Rc({request:this.request,response:this,cause:n})})}))}formDataBody;get formData(){return this.formDataBody??=bs({try:()=>this.source.formData(),catch:t=>new wo({reason:new Rc({request:this.request,response:this,cause:t})})}).pipe(hx,hi)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=bs({try:()=>this.source.arrayBuffer(),catch:t=>new wo({reason:new Rc({request:this.request,response:this,cause:t})})}).pipe(hx,hi),this.arrayBufferBody)}pipe(){return ie(this,arguments)}};var n$=e=>Mq({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${rr(e.parent,{onNone:()=>"",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?"01":"00"}`});var o$="~effect/http/HttpClient";var nC=Ke("effect/HttpClient");var Zee=d(2,(e,t)=>rC(n=>t(e.postprocess(n)),e.preprocess));var rC=(e,t)=>{let n=Object.create(Qee);return n.preprocess=t,n.postprocess=e,n.execute=function(r){return e(t(r))},n},Qee={[o$]:o$,pipe(){return ie(this,arguments)},...Gs,toJSON(){return{_id:"effect/HttpClient"}},...Object.fromEntries(qq.map(([e,t])=>[t,function(n,r){return this.execute(Vq(e)(n,r))}]))},s$=e=>rC(t=>R(t,n=>xn(r=>{let o=nte.get(n),s=o??new AbortController,i=Hq(n.url,n.urlParams,Oo(n.hash));if(Fe(i))return G(new wo({reason:new DS({request:n,cause:i.failure})}));let a=i.success;if(r.getRef(Af)||r.getRef(Yee)(n)){let u=e(n,a,s.signal,r);return o?u:yo(f=>Jr(f(u),{onSuccess(l){return qS.register(l,s),v(new $S(l,s))},onFailure(l){return Q0(l)&&s.abort(),ct(l)}}))}return pp(r.getRef(tte)(n),{kind:"client"},u=>{u.attribute("http.request.method",n.method),u.attribute("server.address",a.origin),a.port!==""&&u.attribute("server.port",+a.port),u.attribute("url.full",a.toString()),u.attribute("url.path",a.pathname),u.attribute("url.scheme",a.protocol.slice(0,-1));let f=a.search.slice(1);f!==""&&u.attribute("url.query",f);let l=r.getRef(qk),p=r.getRef(Xee);for(let m in n.headers)p(m,"request")&&u.attribute(`http.request.header.${m}`,jk(m,l)?"<redacted>":n.headers[m]);return n=r.getRef(ete)?Qk(n,n$(u)):n,yo(m=>m(e(n,a,s.signal,r)).pipe(sl(u,{captureStackTrace:!1}),Jr({onSuccess:h=>{u.attribute("http.response.status_code",h.status);for(let g in h.headers)p(g,"response")&&u.attribute(`http.response.header.${g}`,jk(g,l)?"<redacted>":h.headers[g]);return o?v(h):(qS.register(h,s),v(new $S(h,s)))},onFailure(h){return!o&&Q0(h)&&s.abort(),ct(h)}})))})})),v),i$=d(2,(e,t)=>rC(e.postprocess,n=>Y(e.preprocess(n),t)));var Yee=Me("effect/http/HttpClient/TracerDisabledWhen",{defaultValue:()=>jc}),Xee=Me("effect/http/HttpClient/TracerHeaderFilter",{defaultValue:()=>Xt}),ete=Me("effect/HttpClient/TracerPropagationEnabled",{defaultValue:Xt}),tte=Me("effect/http/HttpClient/SpanNameGenerator",{defaultValue:()=>e=>`http.client ${e.method}`}),a$=e=>Hr(nC)(cr(t=>Y(e,n=>Zee(n,lp(r=>br(t,r)))))),qS=(()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(n=>{n.abort()});return{register(n,r){t.register(n,r,n)},unregister(n){t.unregister(n)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),nte=new WeakMap,$S=class{original;controller;constructor(t,n){this.original=t,this.controller=n}[td]=td;[nf]=nf;applyInterrupt(t){return K(()=>(qS.unregister(this.original),pi(t,()=>se(()=>{this.controller.abort()}))))}get request(){return this.original.request}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 Fr(()=>(qS.unregister(this.original),Mm(this.original.stream,se(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[at](){return this.original[at]()}pipe(){return ie(this,arguments)}};var c$=Me("effect/http/FetchHttpClient/Fetch",{defaultValue:()=>globalThis.fetch}),zS=class extends Ke()("effect/http/FetchHttpClient/RequestInit"){},rte=s$((e,t,n,r)=>{let o=r.getRef(c$),s=Vi(r.context,zS)??{},i=s.headers?Xl(Oi(s.headers),e.headers):e.headers;i["content-length"]&&(i=Ac(i,"content-length"));let a=c=>Y(bs({try:()=>o(t,{...s,method:e.method,headers:i,body:c,duplex:e.body._tag==="Stream"?"half":void 0,signal:n}),catch:u=>new wo({reason:new US({request:e,cause:u})})}),u=>t$(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 R(Rk(e.body.stream),a)}return a(void 0)}),ote=a$(v(rte));var f$=Ke("effect/socket/Socket");var sC="~effect/socket/Socket/CloseEvent",u$=class{[sC];code;reason;constructor(t=1e3,n){this[sC]=sC,this.code=t,this.reason=n}toString(){return this.reason?`${this.code}: ${this.reason}`:`${this.code}`}};var WS="~effect/socket/Socket/SocketError",ste=e=>j(e,WS),iC=class extends $n("effect/socket/Socket/SocketReadError")({_tag:Ze("SocketReadError"),cause:ln()}){message="An error occurred during Read"},aC=class extends $n("effect/socket/Socket/SocketWriteError")({_tag:Ze("SocketWriteError"),cause:ln()}){message="An error occurred during Write"},Lm=class extends $n("effect/socket/Socket/SocketOpenError")({_tag:Ze("SocketOpenError"),kind:ka(["Unknown","Timeout"]),cause:ln()}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}},Bm=class extends $n("effect/socket/Socket/SocketCloseError")({_tag:Ze("SocketCloseError"),code:$s,closeReason:Pt(fe)}){static filterClean(t){return function(n){return nd.is(n)&&n.reason._tag==="SocketCloseError"&&t(n.reason.code)?Ce(n.reason):Ae(n)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},cC=He([iC,aC,Lm,Bm]),nd=class extends ck(WS)("SocketError",{_tag:Ze("SocketError"),reason:cC}){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[WS]=WS;static is(t){return ste(t)}message=this.reason.message};var l$="~effect/reactivity/AsyncResult",d$=e=>j(e,l$),KS={[l$]:{E:B,A:B},pipe(){return ie(this,arguments)},[_e](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case"Initial":return!0;case"Success":return ae(this.value,e.value);case"Failure":return ae(this.cause,e.cause)}},[Oe](){let e=it(`${this._tag}:${this.waiting}`);return this._tag==="Initial"?e:Nt(e)(this._tag==="Success"?ce(this.value):ce(this.cause))}};var fC=(e,t)=>e._tag==="Success"?Qo(e.value):od(e.cause,{previous:t}),VS=e=>e._tag==="None"?Oa(!0):jm(e.value);var p$=e=>e._tag!=="Initial",Oa=(e=!1)=>{let t=Object.create(KS);return t._tag="Initial",t.waiting=e,t},rd=e=>e._tag==="Success",Qo=(e,t)=>{let n=Object.create(KS);return n._tag="Success",n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},m$=e=>e._tag==="Failure";var uC=(e,t)=>{let n=Object.create(KS);return n._tag="Failure",n.cause=e,n.previousSuccess=t?.previousSuccess??D(),n.waiting=t?.waiting??!1,n},od=(e,t)=>uC(e,{previousSuccess:is(t.previous,n=>rd(n)?L(n):m$(n)?n.previousSuccess:D()),waiting:t.waiting});var h$=(e,t)=>od(pP(e),t),jm=(e,t)=>{if(e.waiting)return t?.touch?ate(e):e;let n=Object.assign(Object.create(KS),e);return n.waiting=!0,t?.touch&&rd(n)&&(n.timestamp=Date.now()),n},ate=e=>rd(e)?Qo(e.value,{waiting:e.waiting}):e,qm=(e,t)=>e._tag==="Failure"?od(e.cause,{previous:t,waiting:e.waiting}):e,lC=e=>e._tag==="Success"?L(e.value):e._tag==="Failure"?Lt(e.previousSuccess,t=>t.value):D();var dC=e=>_d(lC(e),()=>new Vf("AsyncResult.getOrThrow: no value found"));var sd=e=>{switch(e._tag){case"Success":return kn(e.value);case"Failure":return jt(e.cause);default:return Fo(new Vf)}};var pC=e=>{let t=e.success??Ic,n=e.error??Ic,r=An()([t,Hl(n,ln())],([o,s])=>(i,a,c)=>{if(!d$(i))return G(new st(a,i,c));switch(i._tag){case"Initial":return v(i);case"Success":return fn(dt(o)(i.value,c),{onSuccess:u=>Qo(u,i),onFailure:u=>Yn(a,"value",u,i,c)});case"Failure":{let u=i.previousSuccess.pipe(Lt(l=>fn(dt(o)(l.value,c),{onSuccess:p=>L(Qo(p,l)),onFailure:p=>new At(a,[new Ct(["previousSuccess","value"],p)],i,c)})),qa(()=>Es)),f=vu(dt(s)(i.cause,c),l=>Yn(a,"cause",l,i,c));return Bn(u,l=>fa(f,p=>uC(p,{previousSuccess:l,waiting:i.waiting})))}}},{expected:"AsyncResult",toCodec([o,s]){let i=Tc("Success",{value:o,waiting:vc,timestamp:$s});return pt()(He([Tc("Initial",{waiting:vc}),i,Tc("Failure",{cause:s,previousSuccess:ki(i),waiting:vc})]),vt({decode:a=>{switch(a._tag){case"Initial":return Oa(a.waiting);case"Success":return Qo(a.value,{waiting:a.waiting,timestamp:a.timestamp});case"Failure":return uC(a.cause,{previousSuccess:Lt(a.previousSuccess,c=>Qo(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:yd,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(r,{success:t,error:n})};var zm="~effect/reactivity/AtomRegistry",cte=e=>j(e,zm),g$=e=>new gC(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),JS=Ke(zm);var Hm=d(e=>cte(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return ws(o=>{let s=e.get(t);if(s._tag!=="Initial"&&!(r&&s.waiting))return o(sd(s));let i=e.subscribe(t,a=>{a._tag!=="Initial"&&!(r&&a.waiting)&&(o(sd(a)),i())});return se(i)})});var ute={immediate:!0},fte=e=>{e()},hC="~effect-atom/atom/Atom/Serializable",$m=e=>hC in e?e[hC].key:e,gC=class{[zm];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(t,n,r,o){if(this[zm]=zm,this.scheduler=new ei("sync",n),this.schedulerAsync=new ei("async",n),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=o,r===void 0&&o!==void 0?this.timeoutResolution=Math.round(o/2):this.timeoutResolution=r??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,n){t.write(this.ensureNode(t).writeContext,n)}setSerializable(t,n){this.preloadedSerializable.set(t,n)}modify(t,n){let r=this.ensureNode(t),o=n(r.value());return t.write(r.writeContext,o[1]),o[0]}update(t,n){let r=this.ensureNode(t);t.write(r.writeContext,n(r.value()))}refresh=t=>{t.refresh!==void 0?t.refresh(this.refresh):this.invalidateAtom(t)};subscribe(t,n,r){let o=this.ensureNode(t);r?.immediate&&n(o.value());let s=o.subscribe(function(){n(o._value)});return()=>{s(),o.canBeRemoved&&this.scheduleNodeRemoval(o)}}mount(t){return this.subscribe(t,En,ute)}atomHasTtl(t){return!t.keepAlive&&t.idleTTL!==0&&(t.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(t){let n=$m(t),r=this.nodes.get(n);if(r===void 0?(r=this.createNode(t),this.nodes.set(n,r),this.onNodeAdded?.(r)):this.atomHasTtl(t)&&this.removeNodeTimeout(r),typeof n=="string"&&this.preloadedSerializable.has(n)){let o=this.preloadedSerializable.get(n);this.preloadedSerializable.delete(n);let s=t[hC].decode(o),i=t;for(;i.initialValueTarget;)i=i.initialValueTarget;i===t?r.setValue(s):this.ensureNode(i).setInitialValue(s)}return r}createNode(t){if(this.disposed)throw new Error(`Cannot access Atom ${t}: registry is disposed`);return t.keepAlive||this.scheduleAtomRemoval(t),new xC(this,t)}invalidateAtom=t=>{this.ensureNode(t).invalidate()};scheduleAtomRemoval(t){this.dispatcher.scheduleTask(()=>{let n=this.nodes.get($m(t));n!==void 0&&n.canBeRemoved&&this.removeNode(n)},0)}scheduleNodeRemoval(t){this.dispatcher.scheduleTask(()=>{t.canBeRemoved&&this.removeNode(t)},0)}removeNode(t){this.atomHasTtl(t.atom)?this.setNodeTimeout(t):(this.nodes.delete($m(t.atom)),t.remove(),this.onNodeRemoved?.(t))}setNodeTimeout(t){if(this.nodeTimeoutBucket.has(t))return;let n=t.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(n-=this.#e,n<=0)){this.nodes.delete($m(t.atom)),t.remove(),this.onNodeRemoved?.(t);return}let r=Math.ceil(n/this.timeoutResolution)*this.timeoutResolution,o=Date.now()+r,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 n=this.nodeTimeoutBucket.get(t);if(n===void 0)return;this.nodeTimeoutBucket.delete(t),this.scheduleNodeRemoval(t);let[r,o]=this.timeoutBuckets.get(n);r.delete(t),r.size===0&&(clearTimeout(o),this.timeoutBuckets.delete(n))}#e=null;sweepBucket(t){let n=this.timeoutBuckets.get(t)[0];this.timeoutBuckets.delete(t),n.forEach(r=>{this.nodeTimeoutBucket.delete(r),r.canBeRemoved&&(this.nodes.delete($m(r.atom)),this.onNodeRemoved?.(r),this.#e=r.atom.idleTTL??this.defaultIdleTTL,r.remove(),this.#e=null)})}reset(){this.timeoutBuckets.forEach(([,t])=>clearTimeout(t)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear(),this.nodes.forEach(t=>{t.remove(),this.onNodeRemoved?.(t)}),this.nodes.clear()}dispose(){this.disposed=!0,this.reset()}},Yo={alive:1,initialized:2,waitingForValue:4},Ur={uninitialized:Yo.alive|Yo.waitingForValue,stale:Yo.alive|Yo.initialized|Yo.waitingForValue,valid:Yo.alive|Yo.initialized,removed:0},xC=class{constructor(t,n){this.registry=t,this.atom=n,this.writeContext=new yC(t,this)}registry;atom;state=Ur.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;parents=new Set;previousParents;children=new Set;listeners=new Set;skipInvalidation=!1;building=!1;invalidatedDuringBuild=!1;currentState(){switch(this.state){case Ur.uninitialized:return"uninitialized";case Ur.stale:return"stale";case Ur.valid:return"valid";default:return"removed"}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}_value=void 0;value(){if((this.state&Yo.waitingForValue)!==0){this.lifetime=pte(this),this.building=!0;let t=this.atom.read(this.lifetime);if(this.building=!1,(this.state&Yo.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.state=Ur.valid):this.setValue(t)),this.previousParents){let n=this.previousParents;this.previousParents=void 0;for(let r of n)r.removeChild(this),r.canBeRemoved&&this.registry.scheduleNodeRemoval(r)}}return this._value}valueOption(){return(this.state&Yo.initialized)===0?D():L(this._value)}setInitialValue(t){if((this.state&Yo.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=Ur.stale,this._value=t,Qt.phase===Mi.collect?Qt.notify.add(this):this.notify();return}this.setValue(t)}setValue(t){if((this.state&Yo.initialized)===0){this.state=Ur.valid,this._value=t,Qt.phase===Mi.collect?Qt.notify.add(this):this.notify();return}this.state=Ur.valid,!this.atom.equals(this._value,t)&&(this._value=t,this.skipInvalidation?this.skipInvalidation=!1:this.invalidateChildren(),this.listeners.size>0&&(Qt.phase===Mi.collect?Qt.notify.add(this):this.notify()))}addParent(t){this.parents.add(t),this.previousParents!==void 0&&(this.previousParents.delete(t),this.previousParents.size===0&&(this.previousParents=void 0)),t.children.has(this)||(t.children.add(this),t.skipInvalidation&&(t.skipInvalidation=!1))}removeChild(t){this.children.delete(t)}invalidate(){this.building&&Qt.phase===Mi.collect&&(this.invalidatedDuringBuild=!0),this.state===Ur.valid&&(this.state=Ur.stale,this.disposeLifetime()),Qt.phase===Mi.collect?Qt.stale.push(this):this.atom.lazy&&this.listeners.size===0&&!lte(this.children)?(this.invalidateChildren(),this.skipInvalidation=!0):this.value()}invalidateChildren(){if(this.children.size===0)return;let t=this.children;this.children=new Set;for(let n of t)n.invalidate()}notify(){this.listeners.forEach(fte),Qt.phase===Mi.commit&&Qt.notify.delete(this)}disposeLifetime(){this.lifetime!==void 0&&(this.lifetime.dispose(),this.lifetime=void 0),this.parents.size!==0&&(this.previousParents=this.parents,this.parents=new Set)}remove(){if(this.state=Ur.removed,this.listeners.clear(),this.lifetime===void 0||(this.disposeLifetime(),this.previousParents===void 0))return;let t=this.previousParents;this.previousParents=void 0;for(let n of t)n.removeChild(this),n.canBeRemoved&&this.registry.removeNode(n)}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}};function lte(e){if(e.size===0)return!1;let t=e,n,r=0;for(;t!==void 0;){for(let o of t){if(!o.atom.lazy||o.listeners.size>0)return!0;o.children.size>0&&(n===void 0?n=[o.children]:n.push(o.children))}t=n?.[r++]}return!1}var dte={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){if(this.disposed)return this.node.registry.get(e);let t=this.node.registry.ensureNode(e),n=t.value();return this.node.addParent(t),n},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return Kr;switch(n._tag){case"Initial":return Kr;case"Failure":return jt(n.cause);case"Success":return v(n.value)}},resultOnce(e,t){return ws(n=>{let r=this.once(e);if(r._tag!=="Initial"&&!(t?.suspendOnWaiting&&r.waiting))return n(sd(r));let o=this.node.registry.subscribe(e,s=>{s._tag==="Initial"||t?.suspendOnWaiting&&s.waiting||(o(),n(sd(s)))},{immediate:!1});return se(o)})},setResult(e,t){return this.disposed?Kr:(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"?Kr:v(t.value)},someOnce(e){return ws(t=>{let n=this.once(e);if(Te(n))return t(v(n.value));let r=this.node.registry.subscribe(e,o=>{xe(o)||(r(),t(v(o.value)))},{immediate:!1});return se(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?D():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,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},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?Ai:yS(n=>se(()=>{this.subscribe(e,r=>Al(n,r),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(Ek(p$),ef(n=>n._tag==="Success"?v(n.value):ct(n.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0;for(let t=e.length-1;t>=0;t--)e[t]()}},pte=e=>{function t(n){if(t.disposed)return e.registry.get(n);if(t.isFn)return e.registry.get(n);let r=e.registry.ensureNode(n),o=r.value();return e.addParent(r),o}return Object.setPrototypeOf(t,dte),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t},yC=class{constructor(t,n){this.registry=t,this.node=n}registry;node;get(t){return this.registry.get(t)}set(t,n){return this.registry.set(t,n)}setSelf(t){return this.node.setValue(t)}refreshSelf(){return this.node.invalidate()}},Mi={disabled:0,collect:1,commit:2},Qt={phase:Mi.disabled,depth:0,stale:[],notify:new Set};function x$(e){Qt.phase=Mi.collect,Qt.depth++;try{if(e(),Qt.depth===1){for(let t=0;t<Qt.stale.length;t++)y$(Qt.stale[t]);Qt.phase=Mi.commit;for(let t of Qt.notify)t.notify();Qt.notify.clear()}}finally{Qt.depth--,Qt.depth===0&&(Qt.phase=Mi.disabled,Qt.stale=[])}}function y$(e){if(e.state===Ur.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=Ur.stale,e.disposeLifetime()}for(let t of e.parents)t.state!==Ur.valid&&y$(t);e.state!==Ur.valid&&e.value()}var ph={};ns(ph,{ConnectionHooks:()=>dh,CurrentHeaders:()=>Cb,Protocol:()=>Ni,layerProtocolHttp:()=>Hre,layerProtocolSocket:()=>Vre,layerProtocolWorker:()=>Jre,make:()=>yA,makeNoSerialization:()=>hH,makeProtocolHttp:()=>gH,makeProtocolSocket:()=>xH,makeProtocolWorker:()=>yH,withHeaders:()=>zre});var Wm=class extends Ke()("effect/workers/Transferable/Collector"){},b$=()=>{let e=[],t=o=>{e.push(...o)},n=()=>e,r=()=>{let o=e;return e=[],o};return Wm.of({addAllUnsafe:t,addAll:o=>se(()=>t(o)),readUnsafe:n,read:se(n),clearUnsafe:r,clear:se(r)})};var SC="~effect/workers/WorkerError";var bC=class extends $n("effect/workers/WorkerError/WorkerSpawnError")({_tag:Ze("WorkerSpawnError"),message:fe,cause:Pt(ln())}){},EC=class extends $n("effect/workers/WorkerError/WorkerSendError")({_tag:Ze("WorkerSendError"),message:fe,cause:Pt(ln())}){},wC=class extends $n("effect/workers/WorkerError/WorkerReceiveError")({_tag:Ze("WorkerReceiveError"),message:fe,cause:Pt(ln())}){},IC=class extends $n("effect/workers/WorkerError/WorkerUnknownError")({_tag:Ze("WorkerUnknownError"),message:fe,cause:Pt(ln())}){},vC=He([bC,EC,wC,IC]),E$=class extends $n(SC)({_tag:Ze("WorkerError"),reason:vC}){constructor(t){super({...t,cause:t.reason.cause})}[SC]=SC;get message(){return this.reason.message}};var GS=class extends Ke()("effect/workers/Worker/WorkerPlatform"){};var _c={};ns(_c,{ServerClient:()=>AC,custom:()=>Ste,exitSchema:()=>RC,fork:()=>wte,isRpc:()=>xte,isWrapper:()=>id,make:()=>I$,uninterruptible:()=>Ite,unwrap:()=>bte,wrap:()=>YS,wrapMap:()=>Ete});var TC="~effect/rpc/RpcSchema/StreamSchema";function Km(e){return j(e,TC)}function ZS(e){return Km(e)?L({success:e.success,error:e.error}):D()}var gte=no(Ue);function w$(e,t){return re(gte.ast,{[TC]:TC,success:e,error:t})}var CC="~effect/rpc/Rpc",xte=e=>j(e,CC),AC=class{id;annotations;constructor(t){this.id=t,this.annotations=Et()}annotate(t,n){return this.annotations=Ve(this.annotations,t,n),this}},yte={[CC]:CC,pipe(){return ie(this,arguments)},setSuccess(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return Oc({_tag:this._tag,payloadSchema:Gu(e)?e:oe(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return Oc({_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 Oc({_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 Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Ve(this.annotations,e,t)})},annotateMerge(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:br(this.annotations,e)})}},Oc=e=>{function t(){}return Object.setPrototypeOf(t,yte),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},I$=(e,t)=>{let n=t?.success??Jl,r=t?.error??Ic,o=t?.defect??ln(),s;return t?.primaryKey?s=class extends hS(`effect/rpc/Rpc/${e}`)(t.payload){[sq](){return t.primaryKey(this)}}:s=Gu(t?.payload)?t?.payload:t?.payload?oe(t?.payload):Jl,Oc({_tag:e,payloadSchema:s,successSchema:t?.stream?w$(n,r):n,errorSchema:t?.stream?Ic:r,defectSchema:o,annotations:Et(),middlewares:new Set})},Ste=e=>(t,n)=>{let r=n?.success??Jl,o=n?.error??Ic,s=n?.defect??ln(),i=e({success:r,error:o,defect:s});return I$(t,{...i,primaryKey:n?.primaryKey,payload:n?.payload,stream:n?.stream})},kC=new WeakMap,RC=e=>{if(kC.has(e))return kC.get(e);let t=e,n=new Set([t.errorSchema]),r=ZS(t.successSchema);Te(r)&&n.add(r.value.error);for(let s of t.middlewares)n.add(s.error);let o=pS(Te(r)?Jl:t.successSchema,He([...n]),t.defectSchema);return kC.set(e,o),o},Vm="~effect/rpc/Rpc/Wrapper",id=e=>Vm in e,YS=e=>t=>id(t)?{[Vm]:Vm,value:t.value,fork:e.fork??t.fork,uninterruptible:e.uninterruptible??t.uninterruptible}:{[Vm]:Vm,value:t,fork:e.fork??!1,uninterruptible:e.uninterruptible??!1},bte=e=>id(e)?e.value:e,Ete=(e,t)=>id(e)?YS(e)(t(e.value)):t(e),wte=YS({fork:!0}),Ite=YS({uninterruptible:!0});var OC="~effect/rpc/RpcClientError",Mc=class extends $n("effect/rpc/RpcClientError/RpcClientDefect")({_tag:Ze("RpcClientDefect"),message:fe,cause:ln()}){},Hs=class extends $n(OC)({_tag:Ze("RpcClientError"),reason:He([vC,cC,ed,Mc])}){[OC]=OC;get message(){return`${this.reason._tag}: ${this.reason.message}`}};var Gm=e=>e;var v$={_tag:"Ping"};var Jm=He([fe,Vl]),Tte=oe({_tag:Ze("Request"),id:Jm,tag:fe,payload:Go,headers:Wt(Ec([fe,fe])),isNotification:Pt(Rt(!0)),traceId:Pt(fe),spanId:Pt(fe),sampled:Pt(vc)}),_C=He([Tte,oe({_tag:Ze("Ack"),requestId:Jm}),oe({_tag:Ze("Interrupt"),requestId:Jm}),oe({_tag:Ze("Ping")}),oe({_tag:Ze("Eof")}),oe({_tag:Ze("Chunk"),requestId:Jm,values:Go}),oe({_tag:Ze("Exit"),requestId:Jm,exit:Go}),oe({_tag:Ze("Defect"),defect:Go}),oe({_tag:Ze("Pong")})]);var MC=e=>{switch(e._tag){case"Exit":case"Defect":case"ClientProtocolError":return!0;default:return!1}};var lh={};ns(lh,{MaxBufferSizeExceeded:()=>uh,RpcSerialization:()=>bn,json:()=>iH,jsonRpc:()=>cH,layerJson:()=>Ore,layerJsonRpc:()=>Pre,layerMsgPack:()=>Ure,layerMsgPackWith:()=>Dre,layerNdJsonRpc:()=>Fre,layerNdjson:()=>_re,layerNdjsonWith:()=>Mre,layerSchemaBinary:()=>Nre,makeMsgPack:()=>xA,makeNdjson:()=>Tb,msgPack:()=>dH,ndJsonRpc:()=>uH,ndjson:()=>aH});var FC;try{FC=new TextDecoder}catch{}var Z,ro,I=0;var D$=[],UC=D$,DC=0,mt={},We,Pc,Xo=0,Pi=0,Hn,_a,oo=[],qe,k$={useRecords:!1,mapsAsObjects:!0},Zm=class{},LC=new Zm;LC.name="MessagePack 0xC1";var Fc=!1,C$=2;var Fi=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,n){if(Z)return q$(()=>(eb(),this?this.unpack(t,n):e.prototype.unpack.call(k$,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof n=="object"?(ro=n.end||t.length,I=n.start||0):(I=0,ro=n>-1?n:t.length),DC=0,Pi=0,Pc=null,UC=D$,Hn=null,Z=t;try{qe=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw Z=null,t instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(mt=this,this.structures)return We=this.structures,XS(n);(!We||We.length>0)&&(We=[])}else mt=k$,(!We||We.length>0)&&(We=[]);return XS(n)}unpackMultiple(t,n){let r,o=0;try{Fc=!0;let s=t.length,i=this?this.unpack(t,s):nb.unpack(t,s);if(n){if(n(i,o,I)===!1)return;for(;I<s;)if(o=I,n(XS(),o,I)===!1)return}else{for(r=[i];I<s;)o=I,r.push(XS());return r}}catch(s){throw s.lastPosition=o,s.values=r,s}finally{Fc=!1,eb()}}_mergeStructures(t,n){this._onLoadedStructures&&(t=this._onLoadedStructures(t)),t=t||[],Object.isFrozen(t)&&(t=t.map(r=>r.slice(0)));for(let r=0,o=t.length;r<o;r++){let s=t[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}t.sharedLength=t.length;for(let r in n||[])if(r>=0){let o=t[r],s=n[r];s&&(o&&((t.restoreStructures||(t.restoreStructures=[]))[r]=o),t[r]=s)}return this.structures=t}decode(t,n){return this.unpack(t,n)}};function XS(e){try{if(!mt.trusted&&!Fc){let n=We.sharedLength||0;n<We.length&&(We.length=n)}let t;if(mt._readStruct&&Z[I]<64&&Z[I]>=32?(t=mt._readStruct(Z,I,ro),Z=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),I=ro):t=dn(),Hn&&(I=Hn.postBundlePosition,Hn=null),Fc&&(We.restoreStructures=null),I==ro)We&&We.restoreStructures&&A$(),We=null,Z=null,_a&&(_a=null);else{if(I>ro)throw new Error("Unexpected end of MessagePack data");if(!Fc){let n;try{n=JSON.stringify(t,(r,o)=>typeof o=="bigint"?`${o}n`:o).slice(0,100)}catch(r){n="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+n)}}return t}catch(t){throw We&&We.restoreStructures&&A$(),eb(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||I>ro)&&(t.incomplete=!0),t}}function A$(){for(let e in We.restoreStructures)We[e]=We.restoreStructures[e];We.restoreStructures=null}function dn(){let e=Z[I++];if(e<160)if(e<128){if(e<64)return e;{let t=We[e&63]||mt.getStructures&&N$()[e&63];return t?(t.read||(t.read=BC(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,mt.mapsAsObjects){let t={};for(let n=0;n<e;n++){let r=B$();r==="__proto__"&&(r="__proto_"),t[r]=dn()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(dn(),dn());return t}else{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=dn();return mt.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(Pi>=I)return Pc.slice(I-Xo,(I+=t)-Xo);if(Pi==0&&ro<140){let n=t<16?qC(t):L$(t);if(n!=null)return n}return NC(t)}else{let t;switch(e){case 192:return null;case 193:return Hn?(t=dn(),t>0?Hn[1].slice(Hn.position1,Hn.position1+=t):Hn[0].slice(Hn.position0,Hn.position0-=t)):LC;case 194:return!1;case 195:return!0;case 196:if(t=Z[I++],t===void 0)throw new Error("Unexpected end of buffer");return PC(t);case 197:return t=qe.getUint16(I),I+=2,PC(t);case 198:return t=qe.getUint32(I),I+=4,PC(t);case 199:return rf(Z[I++]);case 200:return t=qe.getUint16(I),I+=2,rf(t);case 201:return t=qe.getUint32(I),I+=4,rf(t);case 202:if(t=qe.getFloat32(I),mt.useFloat32>2){let n=tb[(Z[I]&127)<<1|Z[I+1]>>7];return I+=4,(n*t+(t>0?.5:-.5)>>0)/n}return I+=4,t;case 203:return t=qe.getFloat64(I),I+=8,t;case 204:return Z[I++];case 205:return t=qe.getUint16(I),I+=2,t;case 206:return t=qe.getUint32(I),I+=4,t;case 207:return mt.int64AsType==="number"?(t=qe.getUint32(I)*4294967296,t+=qe.getUint32(I+4)):mt.int64AsType==="string"?t=qe.getBigUint64(I).toString():mt.int64AsType==="auto"?(t=qe.getBigUint64(I),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=qe.getBigUint64(I),I+=8,t;case 208:return qe.getInt8(I++);case 209:return t=qe.getInt16(I),I+=2,t;case 210:return t=qe.getInt32(I),I+=4,t;case 211:return mt.int64AsType==="number"?(t=qe.getInt32(I)*4294967296,t+=qe.getUint32(I+4)):mt.int64AsType==="string"?t=qe.getBigInt64(I).toString():mt.int64AsType==="auto"?(t=qe.getBigInt64(I),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=qe.getBigInt64(I),I+=8,t;case 212:if(t=Z[I++],t==114)return F$(Z[I++]&63);{let n=oo[t];if(n)return n.read?(I++,n.read(dn())):n.noBuffer?(I++,n()):n(Z.subarray(I,++I));throw new Error("Unknown extension "+t)}case 213:return t=Z[I],t==114?(I++,F$(Z[I++]&63,Z[I++])):rf(2);case 214:return rf(4);case 215:return rf(8);case 216:return rf(16);case 217:return t=Z[I++],Pi>=I?Pc.slice(I-Xo,(I+=t)-Xo):Cte(t);case 218:return t=qe.getUint16(I),I+=2,Pi>=I?Pc.slice(I-Xo,(I+=t)-Xo):Ate(t);case 219:return t=qe.getUint32(I),I+=4,Pi>=I?Pc.slice(I-Xo,(I+=t)-Xo):Rte(t);case 220:return t=qe.getUint16(I),I+=2,O$(t);case 221:return t=qe.getUint32(I),I+=4,O$(t);case 222:return t=qe.getUint16(I),I+=2,_$(t);case 223:return t=qe.getUint32(I),I+=4,_$(t);default:if(e>=224)return e-256;throw e===void 0?jC():new Error("Unknown MessagePack token "+e)}}}var kte=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function BC(e,t){function n(){if(n.count++>C$){let o;try{o=e.read=new Function("r","return function(){return "+(mt.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":kte.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(dn)}catch{return C$=1/0,n()}return e.read0=o,e.highByte===0&&(e.read=R$(t,e.read)),o()}let r={};for(let o=0,s=e.length;o<s;o++){let i=e[o];i==="__proto__"&&(i="__proto_"),r[i]=dn()}return mt.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?R$(t,n):n}var R$=(e,t)=>function(){let n=Z[I++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),o=We[r]||N$()[r];if(!o)throw new Error("Record id is not defined for "+r);return o.read||(o.read=BC(o,e)),o.read()};function N$(){let e=q$(()=>(Z=null,mt.getStructures()));return We=mt._mergeStructures(e,We)}var NC=Qm,Cte=Qm,Ate=Qm,Rte=Qm;function Qm(e){let t;if(e<16&&(t=qC(e)))return t;if(e>64&&FC)return FC.decode(Z.subarray(I,I+=e));let n=I+e,r=[];for(t="";I<n;){let o=Z[I++];if((o&128)===0)r.push(o);else if((o&224)===192)if(o<194||I>=n||(Z[I]&192)!==128)r.push(65533);else{let s=Z[I++]&63;r.push((o&31)<<6|s)}else if((o&240)===224){let s=I<n?Z[I]:0;if(I>=n||(s&192)!==128||o===224&&s<160||o===237&&s>=160)r.push(65533);else if(I++,I>=n||(Z[I]&192)!==128)r.push(65533);else{let i=Z[I++]&63;r.push((o&31)<<12|(s&63)<<6|i)}}else if((o&248)===240){let s=I<n?Z[I]:0;if(o>244||I>=n||(s&192)!==128||o===240&&s<144||o===244&&s>=144)r.push(65533);else if(I++,I>=n||(Z[I]&192)!==128)r.push(65533);else{let i=Z[I++]&63;if(I>=n||(Z[I]&192)!==128)r.push(65533);else{let a=Z[I++]&63,c=(o&7)<<18|(s&63)<<12|i<<6|a;c-=65536,r.push(c>>>10&1023|55296),r.push(56320|c&1023)}}}else r.push(65533);r.length>=4096&&(t+=zn.apply(String,r),r.length=0)}return r.length>0&&(t+=zn.apply(String,r)),t}function jC(){let e=new Error("Unexpected end of MessagePack data");return e.incomplete=!0,e}function O$(e){if(e>ro-I)throw jC();let t=new Array(e);for(let n=0;n<e;n++)t[n]=dn();return mt.freezeData?Object.freeze(t):t}function _$(e){if(e>(ro-I)/2)throw jC();if(mt.mapsAsObjects){let t={};for(let n=0;n<e;n++){let r=B$();r==="__proto__"&&(r="__proto_"),t[r]=dn()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(dn(),dn());return t}}var zn=String.fromCharCode;function L$(e){let t=I,n=new Array(e);for(let r=0;r<e;r++){let o=Z[I++];if((o&128)>0){I=t;return}n[r]=o}return zn.apply(String,n)}function qC(e){if(e<4)if(e<2){if(e===0)return"";{let t=Z[I++];if((t&128)>1){I-=1;return}return zn(t)}}else{let t=Z[I++],n=Z[I++];if((t&128)>0||(n&128)>0){I-=2;return}if(e<3)return zn(t,n);let r=Z[I++];if((r&128)>0){I-=3;return}return zn(t,n,r)}else{let t=Z[I++],n=Z[I++],r=Z[I++],o=Z[I++];if((t&128)>0||(n&128)>0||(r&128)>0||(o&128)>0){I-=4;return}if(e<6){if(e===4)return zn(t,n,r,o);{let s=Z[I++];if((s&128)>0){I-=5;return}return zn(t,n,r,o,s)}}else if(e<8){let s=Z[I++],i=Z[I++];if((s&128)>0||(i&128)>0){I-=6;return}if(e<7)return zn(t,n,r,o,s,i);let a=Z[I++];if((a&128)>0){I-=7;return}return zn(t,n,r,o,s,i,a)}else{let s=Z[I++],i=Z[I++],a=Z[I++],c=Z[I++];if((s&128)>0||(i&128)>0||(a&128)>0||(c&128)>0){I-=8;return}if(e<10){if(e===8)return zn(t,n,r,o,s,i,a,c);{let u=Z[I++];if((u&128)>0){I-=9;return}return zn(t,n,r,o,s,i,a,c,u)}}else if(e<12){let u=Z[I++],f=Z[I++];if((u&128)>0||(f&128)>0){I-=10;return}if(e<11)return zn(t,n,r,o,s,i,a,c,u,f);let l=Z[I++];if((l&128)>0){I-=11;return}return zn(t,n,r,o,s,i,a,c,u,f,l)}else{let u=Z[I++],f=Z[I++],l=Z[I++],p=Z[I++];if((u&128)>0||(f&128)>0||(l&128)>0||(p&128)>0){I-=12;return}if(e<14){if(e===12)return zn(t,n,r,o,s,i,a,c,u,f,l,p);{let m=Z[I++];if((m&128)>0){I-=13;return}return zn(t,n,r,o,s,i,a,c,u,f,l,p,m)}}else{let m=Z[I++],h=Z[I++];if((m&128)>0||(h&128)>0){I-=14;return}if(e<15)return zn(t,n,r,o,s,i,a,c,u,f,l,p,m,h);let g=Z[I++];if((g&128)>0){I-=15;return}return zn(t,n,r,o,s,i,a,c,u,f,l,p,m,h,g)}}}}}function M$(){let e=Z[I++],t;if(e<192)t=e-160;else switch(e){case 217:t=Z[I++];break;case 218:t=qe.getUint16(I),I+=2;break;case 219:t=qe.getUint32(I),I+=4;break;default:throw new Error("Expected string")}return Qm(t)}function PC(e){return mt.copyBuffers?Uint8Array.prototype.slice.call(Z,I,I+=e):Z.subarray(I,I+=e)}function rf(e){let t=Z[I++];if(oo[t]){let n;return oo[t](Z.subarray(I,n=I+=e),r=>{I=r;try{return dn()}finally{I=n}})}else throw new Error("Unknown extension type "+t)}var P$=new Array(4096);function B$(){let e=Z[I++];if(e>=160&&e<192){if(e=e-160,Pi>=I)return Pc.slice(I-Xo,(I+=e)-Xo);if(!(Pi==0&&ro<180))return NC(e)}else return I--,j$(dn());let t=(e<<5^(e>1?qe.getUint16(I):e>0?Z[I]:0))&4095,n=P$[t],r=I,o=I+e-3,s,i=0;if(n&&n.bytes==e){for(;r<o;){if(s=qe.getUint32(r),s!=n[i++]){r=1879048192;break}r+=4}for(o+=3;r<o;)if(s=Z[r++],s!=n[i++]){r=1879048192;break}if(r===o)return I=r,n.string;o-=3,r=I}for(n=[],P$[t]=n,n.bytes=e;r<o;)s=qe.getUint32(r),n.push(s),r+=4;for(o+=3;r<o;)s=Z[r++],n.push(s);let a=e<16?qC(e):L$(e);return a!=null?n.string=a:n.string=NC(e)}function j$(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(mt.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error(`Invalid property type for record: ${typeof e}`)}var F$=(e,t)=>{let n=dn().map(j$),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let o=We[e];return o&&(o.isShared||Fc)&&((We.restoreStructures||(We.restoreStructures=[]))[e]=o),We[e]=n,n.read=BC(n,r),(n.read0||n.read)()};oo[0]=()=>{};oo[0].noBuffer=!0;oo[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=(s,i)=>{let a=i-s;if(a<=40){let l=r.getBigUint64(s);for(let p=s+8;p<i;p+=8)l<<=BigInt(64),l|=r.getBigUint64(p);return l}let c=s+(a>>4<<3),u=o(s,c),f=o(c,i);return u<<BigInt((i-c)*8)|f};n=n<<BigInt((r.byteLength-t)*8)|o(t,r.byteLength)}return n};var U$={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};oo[101]=()=>{let e=dn();if(!U$[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return U$[e[0]](e[1],{cause:e[2]})};oo[105]=e=>{if(mt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=qe.getUint32(I-4);_a||(_a=new Map);let n=Z[I],r;n>=144&&n<160||n==220||n==221?r=[]:n>=128&&n<144||n==222||n==223?r=new Map:(n>=199&&n<=201||n>=212&&n<=216)&&Z[I+1]===115?r=new Set:r={};let o={target:r};_a.set(t,o);let s=dn();if(o.used)Object.assign(r,s);else return o.target=s;if(r instanceof Map)for(let[i,a]of s.entries())r.set(i,a);if(r instanceof Set)for(let i of Array.from(s))r.add(i);return r};oo[112]=e=>{if(mt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=qe.getUint32(I-4),n=_a.get(t);return n.used=!0,n.target};oo[115]=()=>new Set(dn());var $C=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),Ote=typeof globalThis=="object"?globalThis:window;oo[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=$C[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw new Error("Could not find typed array for code "+t)}return new Ote[r](n)};oo[120]=()=>{let e=dn();return new RegExp(e[0],e[1])};var _te=[];oo[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=I;return I+=t-e.length,Hn=_te,Hn=[M$(),M$()],Hn.position0=0,Hn.position1=0,Hn.postBundlePosition=I,I=n,dn()};oo[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function q$(e){mt&&mt._onSaveState&&mt._onSaveState();let t=ro,n=I,r=DC,o=Xo,s=Pi,i=Pc,a=UC,c=_a,u=Hn,f=new Uint8Array(Z.slice(0,ro)),l=We,p=We.slice(0,We.length),m=mt,h=Fc,g=e();return ro=t,I=n,DC=r,Xo=o,Pi=s,Pc=i,UC=a,_a=c,Hn=u,Z=f,Fc=h,We=l,We.splice(0,We.length,...p),mt=m,qe=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),g}function eb(){Z=null,_a=null,We=null}var tb=new Array(147);for(let e=0;e<256;e++)tb[e]=+("1e"+Math.floor(45.15-e*.30103));var nb=new Fi({useRecords:!1}),Mte=nb.unpack,Pte=nb.unpackMultiple,Fte=nb.unpack,rb={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Ute=new Float32Array(1),qpe=new Uint8Array(Ute.buffer,0,4);Fi.SUPPORTS_STRUCT_HOOKS=!0;var sb;try{sb=new TextEncoder}catch{}var WC,KC,cd=typeof Buffer<"u",ob=cd?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,W$=cd?Buffer:Uint8Array,$$=cd?4294967296:2144337920,O,Ym,Ot,k=0,hr,Yt=null,Dte=21760,Nte=/[\u0080-\uFFFF]/,ad=Symbol("record-id"),Uc=class extends Fi{constructor(t){super(t),this.offset=0;let n,r,o,s,i,a=W$.prototype.utf8Write?function(T,z){return O.utf8Write(T,z,O.byteLength-z)}:sb&&sb.encodeInto?function(T,z){return sb.encodeInto(T,O.subarray(z)).written}:!1,c=this;t||(t={});let u=t&&t.sequential,f=t.structures||t.saveStructures,l=t.maxSharedStructures;if(l==null&&(l=f?32:0),l>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=f?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let m=l>32||p+l>64,h=l+64,g=l+p+64;if(g>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let x=[],E=0,b=0;this.pack=this.encode=function(T,z){if(O||(O=new ob(8192),Ot=O.dataView||(O.dataView=new DataView(O.buffer,0,8192)),k=0),hr=O.length-10,hr-k<2048?(O=new ob(O.length),Ot=O.dataView||(O.dataView=new DataView(O.buffer,0,O.length)),hr=O.length-10,k=0):k=k+7&2147483640,r=k,z&G$&&(k+=z&255),i=c.structuredClone?new Map:null,c.bundleStrings&&typeof T!="string"?(Yt=[],Yt.size=1/0):Yt=null,s=c.structures,s){s.uninitialized&&(s=c._mergeStructures(c.getStructures()));let N=s.sharedLength||0;if(N>l)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let V=0;V<N;V++){let Ee=s[V];if(!Ee)continue;let Ie,de=s.transitions;for(let ut=0,bt=Ee.length;ut<bt;ut++){let Vs=Ee[ut];Ie=de[Vs],Ie||(Ie=de[Vs]=Object.create(null)),de=Ie}de[ad]=V+64}this.lastNamedStructuresLength=N}u||(s.nextId=N+64)}o&&(o=!1);let U;try{c._writeStruct&&T&&typeof T=="object"?T.constructor===Object?$(T):T.constructor!==Map&&!Array.isArray(T)&&!KC.some(V=>T instanceof V)?$(c.useToJSON!==!1&&T.toJSON?T.toJSON():T):S(T):S(T);let N=Yt;if(Yt&&H$(r,S,0),i&&i.idsToInsert){let V=i.idsToInsert.sort((ut,bt)=>ut.offset>bt.offset?1:-1),Ee=V.length,Ie=-1;for(;N&&Ee>0;){let ut=V[--Ee].offset+r;ut<N.stringsPosition+r&&Ie===-1&&(Ie=0),ut>N.position+r?Ie>=0&&(Ie+=6):(Ie>=0&&(Ot.setUint32(N.position+r,Ot.getUint32(N.position+r)+Ie),Ie=-1),N=N.previous,Ee++)}Ie>=0&&N&&Ot.setUint32(N.position+r,Ot.getUint32(N.position+r)+Ie),k+=V.length*6,k>hr&&F(k),c.offset=k;let de=Lte(O.subarray(r,k),V);return i=null,de}return c.offset=k,z&V$?(O.start=r,O.end=k,O):O.subarray(r,k)}catch(N){throw U=N,N}finally{if(s&&(y(),o&&c.saveStructures)){let N=s.sharedLength||0,V=O.subarray(r,k),Ee=(c._prepareStructures||Bte)(s,c);if(!U)return c.saveStructures(Ee,Ee.isCompatible)===!1?(s.uninitialized=!0,c.pack(T,z)):(c.lastNamedStructuresLength=N,O.length>1073741824&&(O=null),V)}O.length>1073741824&&(O=null),z&J$&&(k=r)}};let y=()=>{b<10&&b++;let T=s.sharedLength||0;if(s.length>T&&!u&&(s.length=T),E>1e4)s.transitions=null,b=0,E=0,x.length>0&&(x=[]);else if(x.length>0&&!u){for(let z=0,U=x.length;z<U;z++)x[z][ad]=0;x=[]}},w=T=>{var z=T.length;z<16?O[k++]=144|z:z<65536?(O[k++]=220,O[k++]=z>>8,O[k++]=z&255):(O[k++]=221,Ot.setUint32(k,z),k+=4);for(let U=0;U<z;U++)S(T[U])},S=T=>{k>hr&&(O=F(k));var z=typeof T,U;if(z==="string"){let N=T.length;if(Yt&&N>=4&&N<4096){if((Yt.size+=N)>Dte){let de,ut=(Yt[0]?Yt[0].length*3+Yt[1].length:0)+10;k+ut>hr&&(O=F(k+ut));let bt;Yt.position?(bt=Yt,O[k]=200,k+=3,O[k++]=98,de=k-r,k+=4,H$(r,S,0),Ot.setUint16(de+r-3,k-r-de)):(O[k++]=214,O[k++]=98,de=k-r,k+=4),Yt=["",""],Yt.previous=bt,Yt.size=0,Yt.position=de}let Ie=Nte.test(T);Yt[Ie?0:1]+=T,O[k++]=193,S(Ie?-N:N);return}let V;N<32?V=1:N<256?V=2:N<65536?V=3:V=5;let Ee=N*3;if(k+Ee>hr&&(O=F(k+Ee)),N<64||!a){let Ie,de,ut,bt=k+V;for(Ie=0;Ie<N;Ie++)de=T.charCodeAt(Ie),de<128?O[bt++]=de:de<2048?(O[bt++]=de>>6|192,O[bt++]=de&63|128):(de&64512)===55296&&((ut=T.charCodeAt(Ie+1))&64512)===56320?(de=65536+((de&1023)<<10)+(ut&1023),Ie++,O[bt++]=de>>18|240,O[bt++]=de>>12&63|128,O[bt++]=de>>6&63|128,O[bt++]=de&63|128):(O[bt++]=de>>12|224,O[bt++]=de>>6&63|128,O[bt++]=de&63|128);U=bt-k-V}else U=a(T,k+V);U<32?O[k++]=160|U:U<256?(V<2&&O.copyWithin(k+2,k+1,k+1+U),O[k++]=217,O[k++]=U):U<65536?(V<3&&O.copyWithin(k+3,k+2,k+2+U),O[k++]=218,O[k++]=U>>8,O[k++]=U&255):(V<5&&O.copyWithin(k+5,k+3,k+3+U),O[k++]=219,Ot.setUint32(k,U),k+=4),k+=U}else if(z==="number")if(T>>>0===T)T<32||T<128&&this.useRecords===!1||T<64&&!this._writeStruct?O[k++]=T:T<256?(O[k++]=204,O[k++]=T):T<65536?(O[k++]=205,O[k++]=T>>8,O[k++]=T&255):(O[k++]=206,Ot.setUint32(k,T),k+=4);else if(T>>0===T)T>=-32?O[k++]=256+T:T>=-128?(O[k++]=208,O[k++]=T+256):T>=-32768?(O[k++]=209,Ot.setInt16(k,T),k+=2):(O[k++]=210,Ot.setInt32(k,T),k+=4);else{let N;if((N=this.useFloat32)>0&&T<4294967296&&T>=-2147483648){O[k++]=202,Ot.setFloat32(k,T);let V;if(N<4||(V=T*tb[(O[k]&127)<<1|O[k+1]>>7])>>0===V){k+=4;return}else k--}O[k++]=203,Ot.setFloat64(k,T),k+=8}else if(z==="object"||z==="function")if(!T)O[k++]=192;else{if(i){let V=i.get(T);if(V){if(!V.id){let Ee=i.idsToInsert||(i.idsToInsert=[]);V.id=Ee.push(V)}O[k++]=214,O[k++]=112,Ot.setUint32(k,V.id),k+=4;return}else i.set(T,{offset:k-r})}let N=T.constructor;if(N===Object)P(T);else if(N===Array)w(T);else if(N===Map)if(this.mapAsEmptyObject)O[k++]=128;else{U=T.size,U<16?O[k++]=128|U:U<65536?(O[k++]=222,O[k++]=U>>8,O[k++]=U&255):(O[k++]=223,Ot.setUint32(k,U),k+=4);for(let[V,Ee]of T)S(V),S(Ee)}else{for(let V=0,Ee=WC.length;V<Ee;V++){let Ie=KC[V];if(T instanceof Ie){let de=WC[V];if(de.write){de.type&&(O[k++]=212,O[k++]=de.type,O[k++]=0);let dd=de.write.call(this,T);dd===T?Array.isArray(T)?w(T):P(T):S(dd);return}let ut=O,bt=Ot,Vs=k;O=null;let Pa;try{Pa=de.pack.call(this,T,dd=>(O=ut,ut=null,k+=dd,k>hr&&F(k),{target:O,targetView:Ot,position:k-dd}),S)}finally{ut&&(O=ut,Ot=bt,k=Vs,hr=O.length-10)}Pa&&(Pa.length+k>hr&&F(Pa.length+k),k=z$(Pa,O,k,de.type));return}}if(Array.isArray(T))w(T);else{if(c.useToJSON!==!1&&T.toJSON){let V=T.toJSON();if(V!==T)return S(V)}if(z==="function")return S(this.writeFunction&&this.writeFunction(T));P(T)}}}else if(z==="boolean")O[k++]=T?195:194;else if(z==="bigint"){if(T<9223372036854776e3&&T>=-9223372036854776e3)O[k++]=211,Ot.setBigInt64(k,T);else if(T<18446744073709552e3&&T>0)O[k++]=207,Ot.setBigUint64(k,T);else if(this.largeBigIntToFloat)O[k++]=203,Ot.setFloat64(k,Number(T));else{if(this.largeBigIntToString)return S(T.toString());if(this.useBigIntExtension||this.moreTypes){let N=T<0?BigInt(-1):BigInt(0),V;if(T>>BigInt(65536)===N){let Ee=BigInt(18446744073709552e3)-BigInt(1),Ie=[];for(;Ie.push(T&Ee),T>>BigInt(63)!==N;)T>>=BigInt(64);V=new Uint8Array(new BigUint64Array(Ie).buffer),V.reverse()}else{let Ee=T<0,Ie=(Ee?~T:T).toString(16);if(Ie.length%2?Ie="0"+Ie:parseInt(Ie.charAt(0),16)>=8&&(Ie="00"+Ie),cd)V=Buffer.from(Ie,"hex");else{V=new Uint8Array(Ie.length/2);for(let de=0;de<V.length;de++)V[de]=parseInt(Ie.slice(de*2,de*2+2),16)}if(Ee)for(let de=0;de<V.length;de++)V[de]=~V[de]}V.length+k>hr&&F(V.length+k),k=z$(V,O,k,66);return}else throw new RangeError(T+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}k+=8}else if(z==="undefined")this.encodeUndefinedAsNil?O[k++]=192:(O[k++]=212,O[k++]=0,O[k++]=0);else throw new Error("Unknown type: "+z)},C=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?T=>{let z;if(this.skipValues){z=[];for(let V in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(V))&&!this.skipValues.includes(T[V])&&z.push(V)}else z=Object.keys(T);let U=z.length;U<16?O[k++]=128|U:U<65536?(O[k++]=222,O[k++]=U>>8,O[k++]=U&255):(O[k++]=223,Ot.setUint32(k,U),k+=4);let N;if(this.coercibleKeyAsNumber)for(let V=0;V<U;V++){N=z[V];let Ee=Number(N);S(isNaN(Ee)?N:Ee),S(T[N])}else for(let V=0;V<U;V++)S(N=z[V]),S(T[N])}:T=>{O[k++]=222;let z=k-r;k+=2;let U=0;for(let N in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(N))&&(S(N),S(T[N]),U++);if(U>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');O[z+++r]=U>>8,O[z+r]=U&255},M=this.useRecords===!1?C:t.progressiveRecords&&!m?T=>{let z,U=s.transitions||(s.transitions=Object.create(null)),N=k++-r,V;for(let Ee in T)if(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(Ee)){if(z=U[Ee],z)U=z;else{let Ie=Object.keys(T),de=U;U=s.transitions;let ut=0;for(let bt=0,Vs=Ie.length;bt<Vs;bt++){let Pa=Ie[bt];z=U[Pa],z||(z=U[Pa]=Object.create(null),ut++),U=z}N+r+1==k?(k--,te(U,Ie,ut)):ee(U,Ie,N,ut),V=!0,U=de[Ee]}S(T[Ee])}if(!V){let Ee=U[ad];Ee?O[N+r]=Ee:ee(U,Object.keys(T),N,0)}}:T=>{let z,U=s.transitions||(s.transitions=Object.create(null)),N=0;for(let Ee in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(Ee))&&(z=U[Ee],z||(z=U[Ee]=Object.create(null),N++),U=z);let V=U[ad];V?V>=96&&m?(O[k++]=((V-=96)&31)+96,O[k++]=V>>5):O[k++]=V:te(U,U.__keys__||Object.keys(T),N);for(let Ee in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(Ee))&&S(T[Ee])},_=typeof this.useRecords=="function"&&this.useRecords,P=_?T=>{_(T)?M(T):C(T)}:M,$=T=>{let z=c._writeStruct(T,O,r,k,s,F,(U,N,V)=>{if(V)return o=!0;k=N;let Ee=O;return S(U),y(),Ee!==O?{position:k,targetView:Ot,target:O}:k});if(z===0)return P(T);k=z},F=T=>{let z;if(T>16777216){if(T-r>$$)throw new Error("Packed buffer would be larger than maximum buffer size");z=Math.min($$,Math.round(Math.max((T-r)*(T>67108864?1.25:2),4194304)/4096)*4096)}else z=(Math.max(T-r<<2,O.length-1)>>12)+1<<12;let U=new ob(z);return Ot=U.dataView||(U.dataView=new DataView(U.buffer,0,z)),T=Math.min(T,O.length),O.copy?O.copy(U,0,r,T):U.set(O.slice(r,T)),k-=r,r=0,hr=U.length-10,O=U},te=(T,z,U)=>{let N=s.nextId;N||(N=64),N<h&&this.shouldShareStructure&&!this.shouldShareStructure(z)?(N=s.nextOwnId,N<g||(N=h),s.nextOwnId=N+1):(N>=g&&(N=h),s.nextId=N+1);let V=z.highByte=N>=96&&m?N-96>>5:-1;T[ad]=N,T.__keys__=z,s[N-64]=z,N<h?(z.isShared=!0,s.sharedLength=N-63,o=!0,V>=0?(O[k++]=(N&31)+96,O[k++]=V):O[k++]=N):(V>=0?(O[k++]=213,O[k++]=114,O[k++]=(N&31)+96,O[k++]=V):(O[k++]=212,O[k++]=114,O[k++]=N),U&&(E+=b*U),x.length>=p&&(x.shift()[ad]=0),x.push(T),S(z))},ee=(T,z,U,N)=>{let V=O,Ee=k,Ie=hr,de=r;O=Ym,k=0,r=0,O||(Ym=O=new ob(8192)),hr=O.length-10,te(T,z,N),Ym=O;let ut=k;if(O=V,k=Ee,hr=Ie,r=de,ut>1){let bt=k+ut-1;bt>hr&&F(bt);let Vs=U+r;O.copyWithin(Vs+ut,Vs+1,k),O.set(Ym.slice(0,ut),Vs),k=bt}else O[U+r]=Ym[0]}}useBuffer(t){O=t,O.dataView||(O.dataView=new DataView(O.buffer,O.byteOffset,O.byteLength)),Ot=O.dataView,k=0}set position(t){k=t}get position(){return k}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};KC=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,Zm];WC=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:o,targetView:s,position:i}=t(6);o[i++]=214,o[i++]=255,s.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:o,targetView:s,position:i}=t(10);o[i++]=215,o[i++]=255,s.setUint32(i,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(i+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:o,targetView:s,position:i}=t(3);o[i++]=212,o[i++]=255,o[i++]=255}else{let{target:o,targetView:s,position:i}=t(15);o[i++]=199,o[i++]=12,o[i++]=255,s.setUint32(i,e.getMilliseconds()*1e6),s.setBigInt64(i+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:o,position:s}=t(this.moreTypes?3:0);this.moreTypes&&(o[s++]=212,o[s++]=115,o[s++]=0),n(r)}},{pack(e,t,n){let{target:r,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(r[o++]=212,r[o++]=101,r[o++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(r[o++]=212,r[o++]=120,r[o++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?zC(e,16,t):HC(cd?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==W$&&this.moreTypes?zC(e,$C.indexOf(n.name),t):HC(e,t)}},{pack(e,t){this.moreTypes?zC(e,17,t):HC(cd?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function zC(e,t,n,r){let o=e.byteLength;if(o+1<256){var{target:s,position:i}=n(4+o);s[i++]=199,s[i++]=o+1}else if(o+1<65536){var{target:s,position:i}=n(5+o);s[i++]=200,s[i++]=o+1>>8,s[i++]=o+1&255}else{var{target:s,position:i,targetView:a}=n(7+o);s[i++]=201,a.setUint32(i,o+1),i+=4}s[i++]=116,s[i++]=t,e.buffer||(e=new Uint8Array(e)),s.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i)}function HC(e,t){let n=e.byteLength;var r,o;if(n<256){var{target:r,position:o}=t(n+2);r[o++]=196,r[o++]=n}else if(n<65536){var{target:r,position:o}=t(n+3);r[o++]=197,r[o++]=n>>8,r[o++]=n&255}else{var{target:r,position:o,targetView:s}=t(n+5);r[o++]=198,s.setUint32(o,n),o+=4}r.set(e,o)}function z$(e,t,n,r){let o=e.length;switch(o){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:o<256?(t[n++]=199,t[n++]=o):o<65536?(t[n++]=200,t[n++]=o>>8,t[n++]=o&255):(t[n++]=201,t[n++]=o>>24,t[n++]=o>>16&255,t[n++]=o>>8&255,t[n++]=o&255)}return t[n++]=r,t.set(e,n),n+=o,n}function Lte(e,t){let n,r=t.length*6,o=e.length-r;for(;n=t.pop();){let s=n.offset,i=n.id;e.copyWithin(s+r,s,o),r-=6;let a=s+r;e[a++]=214,e[a++]=105,e[a++]=i>>24,e[a++]=i>>16&255,e[a++]=i>>8&255,e[a++]=i&255,o=s}return e}function H$(e,t,n){if(Yt.length>0){Ot.setUint32(Yt.position+e,k+n-Yt.position-e),Yt.stringsPosition=k-e;let r=Yt;Yt=null,t(r[0]),t(r[1])}}function Bte(e,t){return e.isCompatible=n=>{let r=!n||(t.lastNamedStructuresLength||0)===n.length;return r||t._mergeStructures(n),r},e}Uc.SUPPORTS_STRUCT_HOOKS=!0;var K$=new Uc({useRecords:!1}),jte=K$.pack,qte=K$.pack;var{NEVER:$te,ALWAYS:zte,DECIMAL_ROUND:Hte,DECIMAL_FIT:Wte}=rb,V$=512,J$=1024,G$=2048;function mz(e,t){let{exact:n,layout:r,recursive:o,target:s}=ld(e),i=sf(r,t?.fingerprint),a=n?{value:void 0}:void 0;return JC(a===void 0?s:bre(s,a,!o),r,i,a)}function iA(e,t){let{exact:n,exitSuccess:r,layout:o,target:s}=ld(e);if(!n){if(!r)return mz(e,t);let i={value:void 0};return JC(wre(s,i),o,sf(o,t?.fingerprint),i,!0)}return JC(Ire(s),o,sf(o,t?.fingerprint),void 0)}function JC(e,t,n,r,o=!1){return Go.pipe(be(e,xre(t,n,r,o)))}function hz(e,t){let{exact:n,exitSuccess:r,layout:o}=ld(e),s=sf(o,t?.fingerprint),i=t??Xr;if(!n){let a=uS(mz(e,t),t);return!r||i.onExcessProperty==="error"?a:c=>{if(!Ib(c))return a(c);try{return yb(o,c,i,s)}catch(u){throw u instanceof Di?new Mr(u.issue):u}}}return a=>{try{return yb(o,a,i,s)}catch(c){throw c instanceof Di?new Mr(c.issue):c}}}function Vte(e,t){let{exact:n,layout:r}=ld(e);if(!n){let i=hz(e,t);return a=>Jte(a.map(i))}let o=sf(r,t?.fingerprint),s=t??Xr;return i=>{try{return Kz(r,i,s,o)}catch(a){throw a instanceof Di?new Mr(a.issue):a}}}function Jte(e){if(e.length===1)return e[0];let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function gz(e,t){let{exact:n,exitSuccess:r,layout:o,target:s}=ld(e),i=t??Xr,a=n?void 0:aS(s,i),c=a!==void 0&&r?u=>Ib(u)?u:a(u):a;return Gte(o,sf(o,t?.fingerprint),i,t?.maxFrameSize,c,xz(n,t))}function xz(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 yz(e,t){let{exact:n,layout:r}=ld(e),o=xz(n,t),s=hz(e,t),i=Vte(e,t);if(!o)return{encode:s,encodeMany:i};let a=sf(r,t?.fingerprint),c=t??Xr,u=$ne(),f=l=>{try{return l()}catch(p){throw p instanceof Di?new Mr(p.issue):p}};return{encode:l=>f(()=>yb(r,l,c,a,u)),encodeMany:l=>f(()=>Kz(r,l,c,a,u))}}function Gte(e,t,n,r,o,s){let i=s?[]:void 0,a=new Uint8Array(0),c=0,u=0,f,l=!1,p=new th,m=new eh(n,mne),h=()=>{p.release(),m.clear(),a=XC,c=u=0},g=(y,w)=>{throw new Mr(new ke({expected:y},w,n))},x=()=>{let y=f;throw f=void 0,y},E=(y,w)=>{let S=y.length-w;S>a.length&&(a=new Uint8Array(Math.max(256,S))),a.set(w===0?y:y.subarray(w),0),c=0,u=S},b={feedSync(y){if(f!==void 0)return x();if(l)return g("parser is spent");let w=u===c,S,C,M;if(w)S=y,C=0,M=y.length;else{if(y.length>0){let F=u-c,te=F+y.length;if(te>a.length){let ee=new Uint8Array(Math.max(256,a.length*2,te));ee.set(a.subarray(c,u)),a=ee,c=0,u=F}else c>0&&(a.copyWithin(0,c,u),c=0,u=F);a.set(y,u),u+=y.length}S=a,C=c,M=u}let _=[],P=()=>(w?C<M&&E(y,C):(c=C,c===u&&(c=u=0)),_),$=(F,te)=>{l=!0;let ee=new Mr(new ke({expected:F},te,n));if(h(),_.length===0)throw ee;return f=ee,_};for(;;){let F=0,te=-1,ee=M-C,T=1;for(let U=0;U<Math.min(6,ee);U++){let N=S[C+U];if(F+=(N&127)*T,(N&128)===0){te=U+1;break}T*=128}if(te===-1){if(ee<6)return P();let U=BigInt(F);for(let N=6;N<Math.min(10,ee);N++){let V=S[C+N];if(U|=BigInt(V&127)<<BigInt(N*7),(V&128)===0){if(te=N+1,U>GC)return $("safe integer length",U);F=Number(U);break}}if(te===-1)return ee>=10?$("uvarint",S.subarray(C,C+10)):P()}if(F===0)return $("nonzero frame length",F);if(r!==void 0&&F>r)return $("frame within maxFrameSize",F);if(te+F>ee)return P();let z=ue;try{ue=0;let U=C+te;m.beginFrame(),p.reset(S,U,U+F,n,m,t.positional,i);let N=eH(e,p,t);_.push(o===void 0?N:o(N))}catch(U){l=!0,h();let N=U instanceof Di?new Mr(U.issue):Wl(U)?U:(()=>{throw U})();if(_.length===0)throw N;return f=N,_}finally{ue=z}C+=te+F}},endSync(){if(f!==void 0)return x();if(l)return g("parser is spent");l=!0;let y=c<u?a.subarray(c,u):void 0;if(h(),y!==void 0)return g("complete value",y)},feed:y=>K(()=>{try{return v(b.feedSync(y))}catch(w){if(Wl(w))return G(w);throw w}}),end:K(()=>{try{return b.endSync(),H}catch(y){if(Wl(y))return G(y);throw y}})};return b}var Zte="~effect/encoding/SchemaBinary/fieldId",Qte=32,Yte=33,GC=BigInt(Number.MAX_SAFE_INTEGER),db=BigInt(0),es=BigInt(1),Xte=BigInt(2),Sz=BigInt(7),Z$=BigInt(127),ene=BigInt(1e6),tne=BigInt(255),Q$=BigInt(4294967295),nne=BigInt(32),Ui=new TextEncoder,rne=new TextDecoder("utf-8",{fatal:!0}),bz=7,Y$=0xffffffffffff,one=0xfffffffffffff,Ez=0,wz=1,Iz=2,af=0,of=1,oh=2,sh=3,ih=4,ah=5,sne=6,ine=7,ts=8;function aA(e){return typeof e=="number"&&Number.isInteger(e)&&e>=-Y$&&e<=Y$}var Sb=8,ZC=2199023255551,Nc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];function cA(e){for(let t=1;t<=Sb;t++){let n=Math.round(e*Nc[t]);if(!(n>=-ZC&&n<=ZC))return 0;if(n/Nc[t]===e)return t}return 0}function vz(e){let t=Math.floor(e/2);return e%2===1?-t:t}var St={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 Tz(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e[n],16777619);return t>>>0}var ane=BigInt("14695981039346656037"),cne=BigInt("1099511628211"),une=BigInt("18446744073709551615");function X$(e){let t=ane;for(let n=0;n<e.length;n++)t=(t^BigInt(e[n]))*cne&une;return t}function pb(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function Dc(e,t){for(;t>127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t)}function mb(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}function Io(e,t){for(let n=0;n<8;n++)e.push(Number(t>>BigInt(n*8)&tne))}function kz(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e[r]-t[r];return e.length-t.length}var Di=class extends Error{issue;constructor(t){super("SchemaBinary failure"),this.issue=t}};function Q(e,t,n){throw pn(new ke({expected:e},t,n))}var nt=[],ue=0;function pn(e){return new Di(ue===0?e:new Ct(nt.slice(0,ue),e))}function fne(e){let t=new Uint8Array(Cz(e)),n=0;for(;e>127;)t[n++]=e&127|128,e=Math.floor(e/128);return t[n]=e,t}function Cz(e){let t=1;for(;e>127;)e=Math.floor(e/128),t++;return t}var lne=32;function dne(e,t,n,r){let o=n-t;if(o===0)return"";if(o<=lne){let s=pne(e,t,n);if(s!==void 0)return s}try{return rne.decode(e.subarray(t,n))}catch{Q("utf-8",void 0,r)}}function pne(e,t,n){let r="",o=t;for(;o+16<=n;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],l=e[o+6],p=e[o+7],m=e[o+8],h=e[o+9],g=e[o+10],x=e[o+11],E=e[o+12],b=e[o+13],y=e[o+14],w=e[o+15];if((s|i|a|c|u|f|l|p|m|h|g|x|E|b|y|w)>127)return;r+=String.fromCharCode(s,i,a,c,u,f,l,p,m,h,g,x,E,b,y,w)}if(o+8<=n){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],l=e[o+6],p=e[o+7];if((s|i|a|c|u|f|l|p)>127)return;r+=String.fromCharCode(s,i,a,c,u,f,l,p),o+=8}switch(n-o){case 0:return r;case 1:{let s=e[o];return s>127?void 0:r+String.fromCharCode(s)}case 2:{let s=e[o],i=e[o+1];return(s|i)>127?void 0:r+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:r+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:r+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:r+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:r+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],l=e[o+6];return(s|i|a|c|u|f|l)>127?void 0:r+String.fromCharCode(s,i,a,c,u,f,l)}}}var QC=64*1024,mne=256,hne=512,gne=16*1024;function YC(e){let t=new Uint8Array(e);return{buf:t,view:new DataView(t.buffer),offset:0,writing:!1}}var Xm=YC(QC),hb=class{buf=new Uint8Array(0);view=new DataView(this.buf.buffer);arena;start=0;limit=0;len=0;reset(){let t=Xm;(t.writing||t.offset>=t.buf.length)&&(t=Xm=YC(QC)),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 n=this.arena,r=this.len+t,o=QC;for(;o<r;)o*=2;let s=YC(o);s.writing=!0,s.buf.set(this.buf.subarray(this.start,this.start+this.len)),n.writing=!1,this.arena=Xm=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 n=this.buf,r=this.start+this.len;if(t<128)n[r++]=t;else if(n[r++]=t&127|128,t<16384)n[r++]=t>>>7;else{for(n[r++]=t>>>7&127|128,t=Math.floor(t/16384);t>127;)n[r++]=t&127|128,t=Math.floor(t/128);n[r++]=t}this.len=r-this.start}uvarintBig(t){for(;t>Z$;)this.byte(Number(t&Z$)|128),t>>=Sz;this.byte(Number(t))}zigzag(t){this.uvarintBig(t>=db?t<<es:(-t<<es)-es)}numberVarint(t){let n=t<0||t===0&&1/t<0,r=n?-t:t;r<=one?this.uvarint(r*2+(n?1:0)):this.uvarintBig(BigInt(r)*Xte+(n?es:db))}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 n=t.length;this.ensure(n+1);let r=this.buf,o=this.start+this.len;for(let i=0;i<n;i++)r[o++]=t[i];let s=o-this.start;return this.len=s+1,s}beginSized(){return this.ensure(1),this.len++}endSized(t){let n=this.len-t-1;n<128?this.buf[this.start+t]=n:this.growSized(t,n)}endSizedRun(t){let n=(this.len-t-1)*2;n<128?this.buf[this.start+t]=n:this.growSized(t,n)}growSized(t,n){let r=Cz(n),o=r-1;this.ensure(o);let s=this.start+t;this.buf.copyWithin(s+r,s+1,this.start+this.len),this.len+=o;let i=n,a=s;for(;i>127;)this.buf[a++]=i&127|128,i=Math.floor(i/128);this.buf[a]=i}string(t){let n=t.length;if(n===0)return;this.ensure(n*3);let r=this.buf,o=this.start+this.len,s=0;for(;s+4<=n;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+=Ui.encodeInto(t,r.subarray(this.start+this.len)).written;return}r[o++]=i,r[o++]=a,r[o++]=c,r[o++]=u}for(;s<n;s++){let i=t.charCodeAt(s);if(i>127){this.len+=Ui.encodeInto(t,r.subarray(this.start+this.len)).written;return}r[o++]=i}this.len=o-this.start}out(){let t=this.arena,n=new Uint8Array(t.buf.buffer,this.start,this.len);return t===Xm&&(t.offset=this.start+this.len),t.writing=!1,this.arena=void 0,n}abort(){let t=this.arena;t!==void 0&&(t===Xm&&(t.offset=this.start),t.writing=!1,this.arena=void 0)}};function xne(e){let t=jn(e);return t._tag==="String"&&t.checks===void 0}function yne(e,t,n){return e.extra.find(r=>ha({[t]:null},r.parameter,n).length>0)}var eh=class{entries=new WeakMap;orderLayouts;orderKeys;options;size=0;next=0;replace=!1;constructor(t,n){this.options=t,this.orderLayouts=n===void 0?void 0:new Array(n),this.orderKeys=n===void 0?void 0:new Array(n)}beginFrame(){this.replace=!0}find(t,n){let r=this.entries.get(t);if(r===void 0&&(r=new Map,this.entries.set(t,r)),r.has(n))return r.get(n);let o=yne(t,n,this.options),s=this.orderLayouts;if(s===void 0)return r.set(n,o),o;let i=this.orderKeys;if(this.size<s.length)s[this.size]=t,i[this.size]=n,this.size++,r.set(n,o);else if(this.replace){this.replace=!1;let a=s[this.next];(a===t?r:this.entries.get(a))?.delete(i[this.next]),s[this.next]=t,i[this.next]=n,this.next=(this.next+1)%s.length,r.set(n,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}},gb=new ArrayBuffer(0),XC=new Uint8Array(gb),ez=new DataView(gb),th=class{pos=0;buf=XC;view;viewCache=ez;viewBuffer=gb;viewOffset=0;viewLength=0;end=0;options=Xr;indexSignatures;positional=!1;intern;dict;reset(t,n,r,o,s,i,a){this.view=void 0,this.buf=t,this.pos=n,this.end=r,this.options=o,this.indexSignatures=s,this.positional=i,this.intern=void 0,this.dict=a}release(){this.pos=this.end=0,this.buf=XC,this.view=void 0,this.viewCache=ez,this.viewBuffer=gb,this.viewOffset=this.viewLength=0,this.options=Xr,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&&Q("complete value",void 0,this.options),this.buf[this.pos++]}take(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.buf.subarray(this.pos,this.pos+t);return this.pos+=t,n}takeCopy(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,n}enter(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.end;return this.end=this.pos+t,n}exit(t){this.pos=this.end,this.end=t}readUtf8(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.pos;return this.pos+=t,dne(this.buf,n,n+t,this.options)}uvarint(){let t=this.buf,n=this.end,r=this.pos;r>=n&&Q("complete value",void 0,this.options);let o=t[r++];if(o<128)return this.pos=r,o;let s=o&127;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<7,o<128)return this.pos=r,s;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<14,o<128)return this.pos=r,s;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<21,o<128)return this.pos=r,s;let i=268435456;for(let a=4;a<10;a++){r>=n&&(this.pos=r,Q("complete value",void 0,this.options)),o=t[r++];let c=(o&127)*i;if(c>Number.MAX_SAFE_INTEGER-s&&(this.pos=r,Q("safe integer length",void 0,this.options)),s+=c,o<128)return this.pos=r,s;i*=128}this.pos=r,Q("uvarint",void 0,this.options)}fieldTag(){let t=this.buf,n=this.end,r=this.pos;r>=n&&Q("complete value",void 0,this.options);let o=t[r++];if(o<128)return this.pos=r,o;let s=o&127;return r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<7,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<14,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<21,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],this.pos=r,o>=128&&Q("uvarint",void 0,this.options),s+o*268435456)))}uvarintBig(){let t=db,n=db;for(;;){let r=this.byte();if(t|=BigInt(r&127)<<n,(r&128)===0)return t;n+=Sz}}numberVarint(){let t=this.buf,n=this.end,r=this.pos,o=0,s=1;for(let c=0;c<bz;c++){r>=n&&(this.pos=r,Q("complete value",void 0,this.options));let u=t[r++];if(o+=(u&127)*s,u<128)return this.pos=r,vz(o);s*=128}let i=this.uvarintBig(),a=Number(i>>es);return Number.isFinite(a)||Q("safe integer length",void 0,this.options),(i&es)===es?-a:a}zigzag(){let t=this.uvarintBig();return(t&es)===es?-(t+es>>es):t>>es}f64(){this.pos+8>this.end&&Q("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&&Q("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&&Q("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&&Q("complete value",void 0,this.options);let t=(this.view??this.dataView()).getInt32(this.pos,!0);return this.pos+=4,t}};function tz(e,t){return{_:"literal",leaf:e,values:t,valueSet:t.length>4?new Set(t):void 0}}function ch(e,t){let n=e.values;return e.valueSet!==void 0?e.valueSet.has(t):n.length===1?t===n[0]:n.includes(t)}function bb(e){return e.values.map(t=>typeof t=="string"?JSON.stringify(t):String(t)).join(" | ")}var cb=0,uA=1,Az=2,Rz=3,Oz=30,ub=1<<Oz;function Eb(e){return e._==="literal"?Eb(e.leaf):e._==="int"}function wb(e){switch(e._){case"literal":return wb(e.leaf);case"bool":return 1;case"int64":return 8;default:return}}function eA(e){return wb(e)!==void 0||Eb(e)||e._==="null"||e._==="undefined"}var nh={"effect/schema/Date":{kind:St.int64,exact:!0},"effect/schema/DateTimeUtc":{kind:St.int64,exact:!0},"effect/schema/DateTimeZoned":{kind:St.dateTimeZoned,exact:!0},"effect/schema/Duration":{kind:St.duration,exact:!0},"effect/schema/BigDecimal":{kind:St.bigDecimal,exact:!0},"effect/schema/Uint8Array":{kind:St.bytes,exact:!0},"effect/schema/Option":{kind:St.option,exact:"parameters"},"effect/schema/Result":{kind:St.result,exact:"parameters"},"effect/schema/Exit":{kind:St.exit,exact:"parameters"},"effect/schema/Cause":{kind:St.cause,exact:"parameters"},"effect/schema/CauseReason":{kind:St.causeReason,exact:"parameters"}};function fd(e){let t=e.annotations?.representation;return en(t)&&typeof t.id=="string"?t.id:void 0}var fb=ga(e=>{let t=Sne(e),n=e.context;return t===e||n===void 0?t:Sl(t,new Yr(n.isOptional,n.isMutable,void 0,n.annotations))});function Sne(e){switch(e._tag){case"Declaration":{let t=fd(e);if(t!==void 0&&(t in nh||t==="effect/schema/Json"||t==="effect/schema/MutableJson"))return e.recur(fb);let n=e.annotations?.toCodecJson,r=e.annotations?.toCodec;if(!cn(n)&&!cn(r))return e;let o=e.typeParameters.map(i=>re(jn(i))),s=(cn(n)?n(o):void 0)??(cn(r)?r(o):void 0);return s===void 0?e:lt(e,[mc(s,fb)])}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(fb);default:return e}}function bne(e){let t=[...e].sort((r,o)=>{let s=typeof r.key=="number",i=typeof o.key=="number";return s!==i?s?-1:1:s?r.key-o.key:kz(Ui.encode(r.key),Ui.encode(o.key))}),n=[];for(let r of t){let o=Ui.encode(String(r.key));n.push(typeof r.key=="number"?0:1),mb(n,o.length),pb(n,o);let s=r.literal,i=Ui.encode(Mz(s));n.push(_z(s)),mb(n,i.length),pb(n,i)}return Tz(n)}function _z(e){switch(typeof e){case"string":return 1;case"number":return 2;case"boolean":return 3;case"bigint":return 4;default:return 5}}function Mz(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 Pz(e){switch(e._tag){case"Symbol":return!0;case"Union":return e.types.some(Pz);default:return!1}}function Fz(e){let t=fd(e);return t==="effect/schema/Json"||t==="effect/schema/MutableJson"?!0:cn(e.annotations?.toCodecJson)}function Ene(e){let t=e.checks;if(t===void 0)return!1;let n=r=>r.annotations?.representation?.id==="effect/schema/isInt"?!0:r._tag==="FilterGroup"&&r.checks.some(n);return t.some(n)}function Uz(e){for(;e._tag==="Suspend";)e=e.thunk();return e}function nz(e){let t=[],n=new Set,r=o=>{let s=Uz(o);if(!n.has(s))switch(n.add(s),s._tag){case"Never":return;case"Union":s.types.forEach(r);return;case"Enum":Np(s).types.forEach(r);return;default:t.push(s)}};return e.types.forEach(r),t}function rz(e){switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"bool";default:return"bigint"}}function lb(e){switch(e._tag){case"String":case"TemplateLiteral":case"Symbol":return St.string;case"UniqueSymbol":if(globalThis.Symbol.keyFor(e.symbol)===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return St.string;case"Boolean":return St.bool;case"Null":return St.null;case"Undefined":case"Void":return St.undefined;case"Number":return St.number;case"BigInt":return St.bigint;case"Literal":switch(typeof e.literal){case"string":return St.string;case"number":return St.number;case"boolean":return St.bool;default:return St.bigint}case"Unknown":case"Any":case"ObjectKeyword":return St.json;case"Objects":return St.struct;case"Arrays":return St.array;case"Declaration":{let t=fd(e);if(t!==void 0&&t in nh)return nh[t].kind;if(Fz(e))return St.json;throw new Error(`Binary layout: declaration ${t??"<anonymous>"} has no toCodecJson or toCodec`)}case"Suspend":return lb(Uz(e));default:throw new Error("Binary layout: union members are not uniquely identifiable")}}function oz(e){for(let t of e.fields)t.optional||(t.index<32?e.requiredMask|=1<<t.index:e.requiredWide=!0)}function wne(e){let t=Dz(e),n=!t&&Ine(e);e=jn(e);let r=new Map,o=!1,s=0,i=h=>({_:h,slot:h==="string"?s++:0});function a(h){let g=r.get(h);if(g!==void 0)return g;let x=c(h);return r.set(h,x),x}function c(h){switch(h._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(Ene(h)?"int":"number");case"BigInt":return i("bigint");case"Literal":return tz(i(rz(h.literal)),[h.literal]);case"Unknown":case"Any":case"ObjectKeyword":return i("json");case"Never":return{_:"never",ast:h};case"Enum":return p(h,nz(Np(h)));case"Suspend":{o=!0;let g=a(h.thunk());return r.set(h,g),g}case"Objects":return u(h);case"Arrays":return f(h);case"Union":return p(h,nz(h));case"Declaration":return l(h)}}function u(h){let g=[],x=[],E=new Map;for(let w of h.propertySignatures){if(typeof w.name=="symbol")throw new Error("Binary layout: symbol property names are illegal");let S=String(w.name),C=w.type.context?.annotations,M=C?.[Zte],_=typeof M=="number"?M:Tz(Ui.encode(S));if(!Number.isInteger(_)||_<0||_>4294967295)throw new Error(`Binary layout: illegal field id for ${S}`);let P=E.get(_);P===void 0?E.set(_,[S]):P.push(S),g.push({name:S,id:_,tagBytes:fne(_*ts+af),index:0,optional:w.type.context?.isOptional===!0,annotations:C,layout:void 0,wireMask:0,inline:!1}),x.push(w.type)}for(let[w,S]of E)if(w===0||S.length>1)throw new Error(`Binary layout field id collision: ${w} (${S.join(", ")})`);let b=[];for(let w of h.indexSignatures){if(Pz(w.parameter))throw new Error("Binary layout: symbol property names are illegal");b.push({parameter:w.parameter,layout:void 0,wireMask:0})}let y={_:"struct",ast:h,fields:g,byId:new Map,extra:b,extraAll:b.length===1&&xne(b[0].parameter)?b[0]:void 0,names:new Set(g.map(w=>w.name)),extraShape:void 0,optionalCount:0,requiredMask:0,requiredWide:!1};r.set(h,y);for(let w=0;w<g.length;w++){let S=g[w];S.layout=a(x[w]),S.wireMask=oA(S.layout),S.inline=eA(S.layout),S.optional&&y.optionalCount++,y.byId.set(S.id,S)}g.sort((w,S)=>w.id-S.id);for(let w=0;w<g.length;w++)g[w].index=w;oz(y);for(let w=0;w<b.length;w++)b[w].layout=a(h.indexSignatures[w].type),b[w].wireMask=oA(b[w].layout);return y}function f(h){let g=h.rest.length>0||h.elements.some(y=>y.context?.isOptional===!0),x=h.elements.filter(y=>y.context?.isOptional!==!0).length,E=Math.max(0,h.rest.length-1),b={_:"array",ast:h,elements:[],rest:[],hasCount:g,minCount:x+E,uniform:void 0,uniformInline:!1,uniformPacked:void 0,uniformNumbers:!1,run:void 0};r.set(h,b);for(let y of h.elements)b.elements.push({optional:y.context?.isOptional===!0,layout:a(y)});for(let y of h.rest)b.rest.push(a(y));if(b.elements.length===0&&b.rest.length===1){let y=b.rest[0];b.uniform=y,b.uniformPacked=wb(y),b.uniformNumbers=y._==="number",b.uniformInline=eA(y)}return b}function l(h){let g=fd(h);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 x=h.typeParameters;switch(g){case"effect/schema/Option":{let E={_:"option",value:void 0};return r.set(h,E),E.value=a(x[0]),E}case"effect/schema/Result":{let E={_:"result",success:void 0,failure:void 0};return r.set(h,E),E.success=a(x[0]),E.failure=a(x[1]),E}case"effect/schema/Exit":{let E={_:"cause",error:void 0,defect:void 0},b={_:"exit",value:void 0,cause:E};return r.set(h,b),b.value=a(x[0]),E.error=a(x[1]),E.defect=a(x[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 r.set(h,E),E.error=a(x[0]),E.defect=a(x[1]),E}}if(g!==void 0&&g in nh)throw new Error(`Binary layout: native declaration ${g} has no layout constructor`);if(Fz(h))return i("json");throw new Error(`Binary layout: declaration ${g??"<anonymous>"} has no toCodecJson or toCodec`)}function p(h,g){if(g.length===0)return{_:"never",ast:h};let x=[],E=[],b=new Map,y=new Map,w=(P,$)=>{let F=b.get(P);if(F!==void 0&&F._!==$._)throw new Error("Binary layout: union members are not uniquely identifiable");b.set(P,$)};for(let P of g){if(P._tag==="Literal"){let $=lb(P),F=y.get($);F===void 0?y.set($,[P.literal]):F.includes(P.literal)||F.push(P.literal);continue}if(P._tag==="UniqueSymbol"){lb(P),w(St.string,i("symbol"));continue}if(P._tag==="Objects"||P._tag==="Arrays"){let $=lc(P);if($!==void 0&&$.length>0){for(let F of $)if(typeof F.key=="symbol")throw new Error("Binary layout: symbol property names are illegal");x.push({member:P,sentinels:$});continue}}E.push({member:P,kind:lb(P)})}for(let[P,$]of y)w(P,tz(i(rz($[0])),$));if(x.length===0&&E.length===0&&b.size===1)return b.values().next().value;let S=new Set(b.keys());for(let{kind:P}of E){if(S.has(P))throw new Error("Binary layout: union members are not uniquely identifiable");S.add(P)}if(x.length===0&&b.size===0&&E.length===1){let P=a(E[0].member);return r.set(h,P),P}let C=new Map,M=[];for(let{sentinels:P}of x){let $=bne(P);if(C.has($))throw new Error(`Binary layout sentinel collision: ${$}`);C.set($,P),M.push($)}let _={_:"union",ast:h,variants:[],byTag:new Map,discriminator:void 0,others:[],byKind:new Map,byPos:[]};r.set(h,_);for(let P=0;P<x.length;P++){let{member:$,sentinels:F}=x[P],te=M[P],ee=a($),T,z;if($._tag==="Objects"){let N=ee,V=new Set(F.map(de=>String(de.key))),Ee=N.fields.filter(de=>!V.has(de.name)),Ie={_:"struct",ast:N.ast,fields:Ee,byId:new Map(Ee.map(de=>[de.id,de])),extra:N.extra,extraAll:N.extraAll,names:N.names,extraShape:void 0,optionalCount:Ee.reduce((de,ut)=>ut.optional?de+1:de,0),requiredMask:0,requiredWide:!1};oz(Ie),T=Ie,z=!1}else T=ee,z=!0;let U={tag:te,sentinels:F,tuple:z,payload:T,position:0};_.variants.push(U),_.byTag.set(te,U)}for(let[P,$]of b)_.others.push({kind:P,layout:$,position:0}),_.byKind.set(P,$);for(let{kind:P,member:$}of E){let F=a($);_.others.push({kind:P,layout:F,position:0}),_.byKind.set(P,F)}for(let P of[..._.variants].sort(($,F)=>$.tag-F.tag))P.position=_.byPos.length,_.byPos.push({variant:P,layout:P.payload});for(let P of[..._.others].sort(($,F)=>$.kind-F.kind))P.position=_.byPos.length,_.byPos.push({variant:void 0,layout:P.layout});return _.others.sort((P,$)=>sz(P.layout)-sz($.layout)),_.discriminator=Yne(_.variants),_}return{layout:a(e),recursive:o,exact:t,exitSuccess:n}}function Dz(e){let t=new Map,n=r=>{if(r.encoding!==void 0||r.checks!==void 0||r.encodingChecks!==void 0||r.annotations?.parseOptions!==void 0)return!1;switch(r._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 r.elements.every(n)&&r.rest.every(n);case"Objects":return r.propertySignatures.every(o=>n(o.type))&&r.indexSignatures.every(o=>o.parameter._tag==="String"&&n(o.parameter)&&n(o.type));case"Union":return r.mode==="anyOf"&&r.types.every(n);case"Suspend":{let o=t.get(r);if(o!==void 0)return o;t.set(r,!0);let s=n(r.thunk());return t.set(r,s),s}case"Declaration":{let o=fd(r),s=o!==void 0?nh[o]:void 0;return s===void 0?!1:s.exact===!0||r.typeParameters.every(n)}default:return!1}};return n(e)}function Ine(e){return e._tag==="Declaration"&&e.encoding===void 0&&e.checks===void 0&&e.encodingChecks===void 0&&e.annotations?.parseOptions===void 0&&fd(e)==="effect/schema/Exit"&&Dz(e.typeParameters[0])}var so={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 vne(e){let t=new Map,n=[],r=Number.MAX_SAFE_INTEGER;function o(i){let a=n.lastIndexOf(i);if(a>=0){a<r&&(r=a);let m=[so.backEdge];return Dc(m,n.length-a),X$(m)}let c=t.get(i);if(c!==void 0)return c;let u=n.length,f=r;r=Number.MAX_SAFE_INTEGER,n.push(i);let l=X$(s(i));n.pop();let p=r>=u;return p&&t.set(i,l),r=p?f:Math.min(f,r),l}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(so[i._]),a;case"literal":{a.push(so.literal),pb(a,s(i.leaf)),Dc(a,i.values.length);let c=i.values.map(u=>[_z(u),Mz(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 l=Ui.encode(f);Dc(a,l.length),pb(a,l)}return a}case"int64":return a.push(i.flavor==="date"?so.date:so.dateTimeUtc),a;case"never":return a.push(so.never),a;case"struct":{a.push(so.struct),Dc(a,i.fields.length);for(let c of i.fields)mb(a,c.id),a.push(c.optional?1:0),Io(a,o(c.layout));Dc(a,i.extra.length);for(let c of i.extra)Io(a,o(c.layout));return a}case"array":{a.push(so.array),Dc(a,i.elements.length);for(let c of i.elements)a.push(c.optional?1:0),Io(a,o(c.layout));Dc(a,i.rest.length);for(let c of i.rest)Io(a,o(c));return a}case"union":{a.push(so.union),Dc(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),mb(a,u.tag)),Io(a,o(c.layout))}return a}case"option":return a.push(so.option),Io(a,o(i.value)),a;case"result":return a.push(so.result),Io(a,o(i.success)),Io(a,o(i.failure)),a;case"exit":return a.push(so.exit),Io(a,o(i.value)),Io(a,o(i.cause.error)),Io(a,o(i.cause.defect)),a;case"cause":case"causeReason":return a.push(i._==="cause"?so.cause:so.causeReason),Io(a,o(i.error)),Io(a,o(i.defect)),a}}return o(e)}function Tne(e,t){let n=new Uint8Array(8);for(let r=0;r<4;r++)n[r]=e>>>r*8&255,n[r+4]=t>>>r*8&255;return n}var kne={positional:!1,envelope:Qte,expectedEnvelope:"version 2 envelope, flags 0",fingerprint:new Uint8Array(8)};function Cne(e){let t=vne(e);return{positional:!0,envelope:Yte,expectedEnvelope:"version 2 envelope, flags 1",fingerprint:Tne(Number(t&Q$),Number(t>>nne&Q$))}}function sz(e){switch(e._){case"json":return 2;case"struct":return 1;default:return 0}}function tA(e,t){switch(e._){case"literal":return ch(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:Au(t)&&t._tag==="Utc";case"dateTimeZoned":return Au(t)&&t._tag==="Zoned";case"duration":return nu(t);case"bigDecimal":return Wa(t);case"option":return Ys(t);case"result":return If(t);case"exit":return gs(t);case"cause":return $f(t);case"causeReason":return zf(t);case"array":return Array.isArray(t);case"struct":return en(t)&&!Array.isArray(t);case"json":return!0;case"union":case"never":return!1}}function yt(e,t,n){throw pn(new ke({expected:e},t,n))}function gr(e,t=new Set){if(!hd(e))return!1;let n=Array.isArray(e),r=Object.getPrototypeOf(e);if(n||r===Object.prototype||r===null){if(t.has(e))return!0;t.add(e);try{if(n){for(let o=0;o<e.length;o++)if(gr(e[o],t))return!0}else for(let o of Object.keys(e))if(gr(e[o],t))return!0}finally{t.delete(e)}return!1}if(e instanceof Date||e instanceof Uint8Array||Au(e)||nu(e)||Wa(e))return!1;if(t.has(e))return!0;t.add(e);try{if(Ys(e))return Te(e)&&gr(e.value,t);if(If(e))return gr(Kt(e)?e.success:e.failure,t);if(gs(e))return gr(Ft(e)?e.value:e.cause,t);if($f(e))return e.reasons.some(o=>gr(o,t));if(zf(e))switch(e._tag){case"Fail":return gr(e.error,t);case"Die":return gr(e.defect,t);case"Interrupt":return!1}if(Il(e)){for(let o of e)if(gr(o,t))return!0;return!1}if(jy(e)){for(let[o,s]of e)if(gr(o,t)||gr(s,t))return!0;return!1}if(Wy(e)){for(let o of e)if(gr(o,t))return!0;return!1}if(pm(e))return gr(Sc(e),t);for(let o of Object.keys(e))if(gr(e[o],t))return!0}finally{t.delete(e)}return!1}function xb(e,t,n,r){let o=r.beginSized();Wn(e,t,n,r),r.endSized(o)}function Ane(e,t,n){let r=globalThis.Symbol.keyFor(t);r===void 0&&yt("registered symbol",t,e.options),n.string(r)}function iz(e,t,n,r){let o=n;switch(o._tag){case"Fail":r.byte(0),Wn(e,t.error,o.error,r);return;case"Die":r.byte(1),Wn(e,t.defect,o.defect,r);return;case"Interrupt":o.fiberId===void 0?r.byte(2):(r.byte(3),r.f64(o.fiberId))}}function Rne(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function az(e,t,n){if(e.layout!==t||e.keys.length!==n.length)return!1;for(let r=0;r<n.length;r++)if(e.keys[r]!==n[r])return!1;return!0}function One(e,t){if(e.extraAll===void 0||t.length>hne)return!1;let n=0;for(let r=0;r<t.length;r++)if(n+=t[r].length,n>gne)return!1;return!0}function fA(e,t,n){let r=Object.keys(n),o=t.extraShape;if(o!==void 0&&az(o,t,r))return o.pairs;let s=One(t,r),i=s?void 0:e.extraShape;if(i!==void 0&&az(i,t,r))return i.pairs;let a=t.names,c=t.extraAll,u=[],f=!0;for(let p of r){if(a.has(p))continue;let m=c??(e.indexSignatures??=new eh(e.options)).find(t,p);m!==void 0&&(f&&!Rne(p)&&(f=!1),u.push([p,m,void 0]))}if(f)u.sort((p,m)=>p[0]<m[0]?-1:p[0]>m[0]?1:0);else{for(let p of u)p[2]=Ui.encode(p[0]);u.sort((p,m)=>kz(p[2],m[2]))}if(s)for(let p of u)p[2]??=Ui.encode(p[0]);let l={layout:t,keys:r,pairs:u};return s?t.extraShape=l:e.extraShape=l,u}function lA(e,t,n,r,o){for(let[s,i,a]of t){let c=a===void 0?s.length:a.length,u=n[s],f=dA(i.layout,u,e.options),l=f%ts;if(o===void 0)r.uvarint(c*ts+l);else{if(!o.disabled){let p=Lz(o,s);if(p!==void 0){r.uvarint(p*16+l*2+1),nt[ue++]=s,nA(e,i.layout,u,f,r),ue--;continue}Bz(o,s)}r.uvarint(c*16+l*2)}a===void 0?r.string(s):r.bytes(a),nt[ue++]=s,nA(e,i.layout,u,f,r),ue--}}function dA(e,t,n){if(e._==="literal")return ch(e,t)||yt(bb(e),t,n),dA(e.leaf,t,n);switch(e._){case"bool":return typeof t!="boolean"&&yt("a boolean",t,n),t?ih:sh;case"number":if(typeof t!="number"&&yt("a number",t,n),aA(t))return of;{let r=cA(t);return r===0?oh:r*ts+ah}case"int":return Number.isSafeInteger(t)||yt("an integer",t,n),of;default:return af}}function nA(e,t,n,r,o){switch(r%ts){case sh:case ih:return;case of:o.numberVarint(n);return;case oh:o.f64(n);return;case ah:{let i=Math.floor(r/ts);o.numberVarint(Math.round(n*Nc[i])),o.uvarint(i);return}default:xb(e,t,n,o)}}function _ne(e,t,n,r){let o=dA(t.layout,n,e.options),s=o%ts;if(s===af){let i=r.idAndMark(t.tagBytes);Wn(e,t.layout,n,r),r.endSized(i);return}r.uvarint(t.id*ts+s),nA(e,t.layout,n,o,r)}function Mne(e,t){let n=e.byName;if(n===void 0)return;let r=Object.getOwnPropertyNames(t),o=0;for(let i=0;i<r.length;i++){let a=n.get(r[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 nt[ue++]=c.name,pn(new sn(c.annotations))}}return o}function Pne(e,t,n,r){let o=n;if(t.extra.length>0){let i=e.intern;e.intern=void 0;let a=fA(e,t,o);if(a.length>0){r.uvarint(0);let c=r.beginSized();lA(e,a,o,r,i),r.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 nt[ue++]=c,pn(new sn(a.annotations))}nt[ue++]=c,_ne(e,a,o[c],r),ue--}}function Fne(e,t,n,r){let o=n,s=e.intern;e.intern=void 0;let i=t.optionalCount+7>>3,a=0;if(i>0){a=r.len;for(let f=0;f<i;f++)r.byte(0)}let c=t.fields,u=0;for(let f=0;f<c.length;f++){let l=c[f],p=l.name,m=Object.hasOwn(o,p);if(l.optional){if(m&&(r.buf[r.start+a+(u>>3)]|=1<<(u&7)),u++,!m)continue}else if(!m)throw nt[ue++]=p,pn(new sn(l.annotations));nt[ue++]=p,l.inline?Wn(e,l.layout,o[p],r):xb(e,l.layout,o[p],r),ue--}if(t.extra.length>0){let f=fA(e,t,o);r.uvarint(f.length),lA(e,f,o,r,s)}}function Une(e){switch(e._){case"string":return uA;case"array":return e.uniform?._==="string"?Az:cb;case"struct":return e.extra.length>0?Rz:cb;default:return cb}}function Dne(e){let t=e.uniform;if(t===void 0){if(e.rest.length!==1)return;t=e.rest[0];for(let n of e.elements)if(n.optional||n.layout!==t)return}return t._==="struct"?t:void 0}function Nz(e){let t=e.run;if(t!==void 0)return t;let n=Dne(e);if(n===void 0)return e.run=t=null,t;let r=n.fields.map(s=>Une(s.layout)),o=n.fields.length<=Oz;return t={struct:n,intern:r,shapes:o,byName:o&&n.extra.length===0?new Map(n.fields.map((s,i)=>[s.name,i])):void 0},e.run=t,t}var Nne=16,Lne=64;function cz(e,t){return e[t]??={values:[],refs:void 0,hits:0,disabled:!1}}function Lz(e,t){let n=e.refs;if(n!==void 0){let o=n.get(t);return o!==void 0&&e.hits++,o}let r=e.values;for(let o=0;o<r.length;o++)if(r[o]===t)return e.hits++,o}function Bz(e,t){let n=e.values;if(e.refs!==void 0){if(e.hits===0&&n.length>=Lne){e.disabled=!0,e.refs=void 0;return}e.refs.set(t,n.length)}else if(n.length>=Nne){let r=e.refs=new Map;for(let o=0;o<n.length;o++)r.set(n[o],o);r.set(t,n.length)}n.push(t)}var pA=0,Bne=1,mA=2,jne=64,qne=512;function $ne(){return{slots:[],marks:[],frame:0}}function jz(e,t){return e[t]??={values:[],refs:new Map,state:pA,stamp:-1}}function qz(e,t){if(e.refs.has(t)){e.state=Bne;return}e.refs.set(t,e.values.length),e.values.push(t),e.values.length>=jne&&(e.state=mA)}function $z(e,t){let n=e.values;n.length>=qne||(e.refs.set(t,n.length),n.push(t))}function zne(e,t){t.stamp!==e.frame&&(t.stamp=e.frame,e.marks.push({slot:t,length:t.values.length,state:t.state}))}function Hne(e){e.marks.length=0,e.frame++}function Wne(e){let t=e.marks;for(let n=t.length-1;n>=0;n--){let{length:r,slot:o,state:s}=t[n],i=o.values;for(let a=r;a<i.length;a++)o.refs.delete(i[a]);i.length=r,o.state=s}t.length=0,e.frame++}function Kne(e,t,n,r){let o=jz(e.slots,t.slot),s=o.state;if(s===mA){r.string(n);return}if(zne(e,o),s===pA){r.string(n),qz(o,n);return}let i=o.refs.get(n);if(i!==void 0){r.uvarint(i*2+1);return}r.byte(0),$z(o,n),r.string(n)}function Vne(e,t,n){let r=jz(e,t.slot),o=r.state;if(o===mA)return n.readUtf8(n.end-n.pos);if(o===pA){let a=n.readUtf8(n.end-n.pos);return qz(r,a),a}let s=n.uvarint();if((s&1)===1){let a=(s-1)/2,c=r.values;return a>=c.length&&Q("a dictionary reference",s,n.options),c[a]}s!==0&&Q("a dictionary marker",s,n.options);let i=n.readUtf8(n.end-n.pos);return $z(r,i),i}function zz(e,t,n,r,o){if(!e.disabled){let i=Lz(e,r);if(i!==void 0){o.uvarint(i*2+1);return}Bz(e,r)}let s=o.beginSized();Wn(t,n,r,o),o.endSizedRun(s)}function Jne(e,t,n,r,o){let s=[],i=[];for(let a=0;a<r;a++){nt[ue++]=a;let c=o.beginSized();Gne(e,t,s,i,n[a],o),o.endSized(c),ue--}}function Gne(e,t,n,r,o,s){let i=t.struct,a=o,c=i.fields,u;if(i.extra.length>0){let x=fA(e,i,a);x.length>0&&(u=x)}let f=!t.shapes,l=u===void 0?0:ub,p=Mne(t,a);if(p!==void 0)l=p;else for(let x=0;x<c.length;x++){let E=c[x];if(Object.hasOwn(a,E.name))f||(l|=1<<x);else if(!E.optional)throw nt[ue++]=E.name,pn(new sn(E.annotations))}let m=-1;for(let x=0;x<n.length;x++)if(n[x]===l){m=x;break}m>=0?s.uvarint(m+1):(s.uvarint(0),f||n.push(l));let h=m<0,g=e.positional&&!f;if(h&&g&&s.uvarint(l),u!==void 0){h&&!g&&s.uvarint(0);let x=s.beginSized();lA(e,u,a,s),s.endSizedRun(x)}for(let x=0;x<c.length;x++){let E=c[x];if(f?!Object.hasOwn(a,E.name):(l&1<<x)===0)continue;h&&!g&&s.uvarint(E.id),nt[ue++]=E.name;let b=t.intern[x];if(b===uA)zz(cz(r,x),e,E.layout,a[E.name],s);else{b!==cb&&(e.intern=cz(r,x));let y=s.beginSized();Wn(e,E.layout,a[E.name],s),s.endSizedRun(y),e.intern=void 0}ue--}}function Hz(e,t,n){let r=e.elements.length;if(t<r)return e.elements[t].layout;let o=Math.max(0,e.rest.length-1),s=Math.max(r,n-o);return t>=s?e.rest[t-s+1]:e.rest[0]}function Zne(e,t,n,r){let o=n.length;if(t.rest.length===0&&o>t.elements.length)throw nt[ue++]=t.elements.length,pn(new la(t.ast,n[t.elements.length],e.options));if(o<t.minCount)throw nt[ue++]=o,pn(new sn(void 0));if(t.hasCount&&r.uvarint(o),o>0){let i=Nz(t);if(i!==null){Jne(e,i,n,o,r);return}}let s=t.uniform;if(s!==void 0){if(t.uniformNumbers){Qne(n,o,r);return}let i=e.intern;if(e.intern=void 0,i!==void 0){for(let c=0;c<o;c++)nt[ue++]=c,zz(i,e,s,n[c],r),ue--;return}let a=t.uniformInline;for(let c=0;c<o;c++)nt[ue++]=c,a?Wn(e,s,n[c],r):xb(e,s,n[c],r),ue--;return}for(let i=0;i<o;i++){let a=Hz(t,i,o);nt[ue++]=i,eA(a)?Wn(e,a,n[i],r):xb(e,a,n[i],r),ue--}}var uz=[];function Qne(e,t,n){let r=!0,o=!0;for(let s=0;s<t;s++){let i=e[s];if(aA(i))(i<0?-i:i)>ZC&&(o=!1);else if(r=!1,typeof i!="number")o=!1;else{let a=cA(i);a===0?o=!1:uz[s]=a}if(!r&&!o)break}if(r){n.byte(wz);for(let s=0;s<t;s++)n.numberVarint(e[s])}else if(o){n.byte(Iz);for(let s=0;s<t;s++){let i=e[s],a=Number.isInteger(i)?0:uz[s],c=a===0?i:Math.round(i*Nc[a]),u=c<0||c===0&&1/c<0,f=u?-c:c;n.uvarint((f*2+(u?1:0))*16+a)}}else{n.byte(Ez);for(let s=0;s<t;s++)n.f64(e[s])}}function Yne(e){if(!(e.length<2||e.some(t=>t.tuple)))for(let t of e[0].sentinels){let n=new Map;for(let r of e){let o=r.sentinels.find(s=>s.key===t.key);if(o===void 0||n.has(o.literal)||Number.isNaN(o.literal))break;n.set(o.literal,r)}if(n.size===e.length)return{key:t.key,rows:n}}}function rA(e,t){let n=e.sentinels;for(let r=0;r<n.length;r++){let{key:o,literal:s}=n[r];if(t[o]!==s||!Object.hasOwn(t,o))return!1}return!0}function Xne(e,t){return e.tuple?Array.isArray(t)&&rA(e,t):en(t)&&!Array.isArray(t)&&rA(e,t)}function fz(e,t,n,r){e.positional?r.uvarint(t.position):(r.byte(St.variant),r.u32le(t.tag)),Wn(e,t.payload,n,r)}function ere(e,t,n,r){let o=t.discriminator;if(o!==void 0){if(en(n)&&!Array.isArray(n)){let s=n,i=o.rows.get(s[o.key]);if(i!==void 0&&rA(i,s)){fz(e,i,n,r);return}}}else for(let s of t.variants)if(Xne(s,n)){fz(e,s,n,r);return}for(let s of t.others)if(tA(s.layout,n)){e.positional?r.uvarint(s.position):r.byte(s.kind),Wn(e,s.layout,n,r);return}throw pn(new st(t.ast,n,e.options))}function Wn(e,t,n,r){switch(t._){case"literal":ch(t,n)||yt(bb(t),n,e.options),Wn(e,t.leaf,n,r);return;case"bool":typeof n!="boolean"&&yt("a boolean",n,e.options),r.byte(n===!0?1:0);return;case"null":n!==null&&yt("null",n,e.options);return;case"undefined":n!==void 0&&yt("undefined",n,e.options);return;case"number":{if(typeof n!="number"&&yt("a number",n,e.options),aA(n)){r.numberVarint(n);return}let o=cA(n);o>0?(r.numberVarint(Math.round(n*Nc[o])),r.byte(o)):r.f64(n);return}case"int":{Number.isSafeInteger(n)||yt("an integer",n,e.options),r.numberVarint(n);return}case"string":{typeof n!="string"&&yt("a string",n,e.options);let o=e.dict;o===void 0?r.string(n):Kne(o,t,n,r);return}case"symbol":typeof n!="symbol"&&yt("a symbol",n,e.options),Ane(e,n,r);return;case"bytes":n instanceof Uint8Array||yt("a Uint8Array",n,e.options),r.bytes(n);return;case"bigint":typeof n!="bigint"&&yt("a bigint",n,e.options),r.zigzag(n);return;case"int64":{tA(t,n)||yt(t.flavor==="date"?"a Date":"a DateTime.Utc",n,e.options);let o=t.flavor==="date"?n.getTime():n.epochMilliseconds;Number.isNaN(o)&&yt("a valid Date",n,e.options),r.i64(BigInt(o));return}case"dateTimeZoned":{tA(t,n)||yt("a DateTime.Zoned",n,e.options);let o=n;r.i64(BigInt(o.epochMilliseconds)),o.zone._tag==="Offset"?(r.byte(0),r.i32le(o.zone.offset)):(r.byte(1),r.string(o.zone.id));return}case"duration":{nu(n)||yt("a Duration",n,e.options);let o=n.value;switch(o._tag){case"Infinity":r.byte(1);return;case"NegativeInfinity":r.byte(2);return;case"Nanos":r.byte(0),r.zigzag(o.nanos);return;case"Millis":r.byte(0),r.zigzag(BigInt(o.millis)*ene);return}}case"bigDecimal":{Wa(n)||yt("a BigDecimal",n,e.options);let o=Ud(n);r.zigzag(o.value),r.zigzag(BigInt(o.scale));return}case"json":{let o;try{o=JSON.stringify(n)}catch{o=void 0}o===void 0&&(gr(n)&&yt("acyclic value",n,e.options),yt("a JSON-serializable value",n,e.options)),r.string(o);return}case"option":{Ys(n)||yt("an Option",n,e.options);let o=n;o._tag==="None"?r.byte(0):(r.byte(1),Wn(e,t.value,o.value,r));return}case"result":{If(n)||yt("a Result",n,e.options);let o=n;o._tag==="Success"?(r.byte(0),Wn(e,t.success,o.success,r)):(r.byte(1),Wn(e,t.failure,o.failure,r));return}case"exit":{gs(n)||yt("an Exit",n,e.options);let o=n;o._tag==="Success"?(r.byte(0),Wn(e,t.value,o.value,r)):(r.byte(1),Wn(e,t.cause,o.cause,r));return}case"cause":{$f(n)||yt("a Cause",n,e.options);let o=n.reasons;r.uvarint(o.length);for(let s of o){let i=r.beginSized();iz(e,t,s,r),r.endSized(i)}return}case"causeReason":{zf(n)||yt("a Cause.Reason",n,e.options),iz(e,t,n,r);return}case"struct":{(!en(n)||Array.isArray(n))&&yt("an object",n,e.options),e.positional?Fne(e,t,n,r):Pne(e,t,n,r);return}case"array":{Array.isArray(n)||yt("an array",n,e.options),Zne(e,t,n,r);return}case"union":ere(e,t,n,r);return;case"never":throw pn(new st(t.ast,n,e.options))}}var ib=new hb;function lz(e,t,n,r,o){let s=o.beginSized();o.byte(r.envelope),r.positional&&o.bytes(r.fingerprint),Wn(e,t,n,o),o.endSized(s)}function Wz(e,t,n,r,o,s){let i={options:r,positional:o.positional,indexSignatures:void 0,extraShape:void 0,intern:void 0,dict:s},a=ib??new hb,c=a===ib;c&&(ib=void 0),a.reset();let u=ue,f=!1;try{if(n===void 0)ue=0,lz(i,e,t,o,a);else for(let p=0;p<n.length;p++)ue=0,lz(i,e,n[p],o,a);let l=a.out();return f=!0,l}finally{s!==void 0&&(f?Hne(s):Wne(s)),a.abort(),ue=u,c&&(ib=a)}}function Kz(e,t,n,r,o){return Wz(e,void 0,t,n,r,o)}function yb(e,t,n,r,o){return Wz(e,t,void 0,n,r,o)}function Ib(e){return gs(e)&&Ft(e)}var Rn=globalThis.Symbol.for("~effect/encoding/SchemaBinary/absent");function xr(e,t){let n=rh(e,t);return n!==Rn&&t.pos!==t.end&&Q("no leftover bytes",void 0,t.options),n}function tre(e,t){let n=t.enter(t.uvarint()),r=xr(e,t);return t.exit(n),r}function Vz(e,t){if(Eb(e))return rh(e,t);let n=wb(e),r=t.enter(n!==void 0?n:e._==="null"||e._==="undefined"?0:t.uvarint()),o=xr(e,t);return t.exit(r),o}var nre=8;function rre(e,t){let n=e.set;if(n!==void 0)return n.has(t)?!0:(n.add(t),!1);let r=e.list;if(r.includes(t))return!0;if(r.length>=nre){let o=e.set=new Set;for(let s=0;s<r.length;s++)o.add(r[s]);o.add(t)}else r.push(t);return!1}function Jz(e,t,n,r,o){let s=t.uvarint(),i=Math.floor(o===void 0?s/ts:s/16),a=o===void 0?s-i*ts:Math.floor((s-i*16)/2),c=o===void 0?t.readUtf8(i):ore(o,s,i,t);rre(r,c)&&Q("unique extra keys",void 0,t.options);let u=e.extraAll??(t.indexSignatures??=new eh(t.options)).find(e,c);if(u===void 0){hA(a,t);return}nt[ue++]=c;let f=Qz(u.layout,u.wireMask,a,t);ue--,f!==Rn&&W(n,c,f)}function ore(e,t,n,r){if((t&1)===1)return n>=e.length&&Q("a known back-reference",void 0,r.options),e[n];let o=r.readUtf8(n);return e.push(o),o}function Gz(e){return new Ct([e.name],new sn(e.annotations))}function Zz(e,t){throw pn(new At(e.ast,t))}function VC(e){for(;(e.byte()&128)!==0;);}function hA(e,t){switch(e){case af:t.take(t.uvarint());return;case of:VC(t);return;case oh:t.take(8);return;case sh:case ih:case ine:return;case ah:VC(t),VC(t);return;case sne:t.take(4);return}}function oA(e){if(e._==="literal")return oA(e.leaf);switch(e._){case"bool":return 1<<sh|1<<ih;case"number":return 1<<of|1<<oh|1<<ah;case"int":return 1<<of;default:return 1<<af}}function sre(e,t){switch(e){case sh:return!1;case ih:return!0;case of:return t.numberVarint();case oh:return t.f64();case ah:{let n=t.numberVarint(),r=t.uvarint();return(r===0||r>Sb)&&Q("a decimal scale in [1, 8]",r,t.options),n/Nc[r]}}return Q("matching field wire kind",void 0,t.options)}function Qz(e,t,n,r){if((t&1<<n)===0)return hA(n,r),Rn;if(n!==af){let i=sre(n,r);return e._==="literal"&&!ch(e,i)&&Q(bb(e),i,r.options),i}let o=r.enter(r.uvarint()),s=xr(e,r);return r.exit(o),s}function ire(e,t){let n;e.extra.length>0&&(n=t.intern,t.intern=void 0);let r={},o=0,s=0,i,a,c,u=!1,f=e.fields,l=0;for(;t.pos<t.end;){let p=t.fieldTag(),m=Math.floor(p/ts),h=p-m*ts;if(m===0){u&&Q("unique field ids",void 0,t.options),u=!0,h!==af&&Q("extra field map",void 0,t.options);let b=t.enter(t.uvarint());Xz(e,t,r,n),t.exit(b);continue}let g;if(l<f.length&&f[l].id===m?(g=f[l],l++):(g=e.byId.get(m),g!==void 0&&(l=g.index+1)),g===void 0){c===void 0?c=new Set:c.has(m)&&Q("unique field ids",void 0,t.options),c.add(m),hA(h,t);continue}let x=g.index;if(x<32){let b=1<<x;(o&b)!==0&&Q("unique field ids",void 0,t.options),o|=b}else i===void 0?i=new Set([x]):(i.has(x)&&Q("unique field ids",void 0,t.options),i.add(x));nt[ue++]=g.name;let E=Qz(g.layout,g.wireMask,h,t);ue--,E!==Rn&&(W(r,g.name,E),x<32?s|=1<<x:(a??=new Set).add(x))}return Yz(e,s,a,t),r}function Yz(e,t,n,r){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:n?.has(c)===!0;if(!a.optional&&!u&&((s??=[]).push(Gz(a)),r.options.errors!=="all"))break}s!==void 0&&Zz(e,s)}function are(e,t){let n;e.extra.length>0&&(n=t.intern,t.intern=void 0);let r={},o=e.optionalCount+7>>3,s=0;o>0&&(t.pos+o>t.end&&Q("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 l=a[f];if(l.optional){let m=(i[s+(c>>3)]&1<<(c&7))!==0;if(c++,!m)continue}nt[ue++]=l.name;let p=l.inline?Vz(l.layout,t):tre(l.layout,t);if(ue--,p!==Rn)W(r,l.name,p);else if(!l.optional&&((u??=[]).push(Gz(l)),t.options.errors!=="all"))break}if(u!==void 0&&Zz(e,u),e.extra.length>0){let f=t.uvarint();if(f>t.remaining&&Q("complete value",void 0,t.options),f>0){let l={list:[],set:void 0};for(let p=0;p<f;p++)Jz(e,t,r,l,n)}}return r}function Xz(e,t,n,r){let o={list:[],set:void 0};for(;t.pos<t.end;)Jz(e,t,n,o,r)}function cre(e,t,n){let r=n.uvarint();if((r&1)===1){let i=(r-1)/2;return i>=e.length&&Q("a known back-reference",void 0,n.options),e[i]}if(t._==="string"){let i=n.readUtf8(r/2);return e.push(i),i}let o=n.enter(r/2),s=xr(t,n);return n.exit(o),e.push(s),s}function ure(e,t,n){let r=new Array(t),o=[],s=[];for(let i=0;i<t;i++){nt[ue++]=i;let a=n.enter(n.uvarint());r[i]=lre(e,o,s,n),n.exit(a),ue--}return r}function fre(e,t){let n=t.uvarint(),r=e.fields,o=n&~ub;(n>ub*2-1||o>>>r.length)&&Q("a known row shape",void 0,t.options);let s=[];(n&ub)!==0&&s.push(null);for(let i=0;i<r.length;i++)(o&1<<i)!==0&&s.push(r[i]);return s}function lre(e,t,n,r){let o=e.struct,s={},i=0,a,c=r.uvarint(),u;if(c===0?r.positional&&e.shapes&&(u=fre(o,r),t.push(u)):(u=t[c-1],u===void 0&&Q("a known row shape",void 0,r.options)),u!==void 0){for(let f=0;f<u.length;f++){let l=dz(e,n,u[f],s,r);l>=0&&(l<32?i|=1<<l:(a??=new Set).add(l))}r.pos!==r.end&&Q("no leftover bytes",void 0,r.options)}else{let f=e.shapes?[]:void 0,l=0,p,m,h=!1;for(;r.pos<r.end;){let g=r.uvarint(),x;g===0?(h&&Q("unique field ids",void 0,r.options),h=!0,x=null):(x=o.byId.get(g),x===void 0?m===void 0?m=new Set([g]):m.has(g)?Q("unique field ids",void 0,r.options):m.add(g):x.index<32?((l&1<<x.index)!==0&&Q("unique field ids",void 0,r.options),l|=1<<x.index):p===void 0?p=new Set([x.index]):(p.has(x.index)&&Q("unique field ids",void 0,r.options),p.add(x.index))),f?.push(x);let E=dz(e,n,x,s,r);E>=0&&(E<32?i|=1<<E:(a??=new Set).add(E))}f!==void 0&&t.push(f)}return Yz(o,i,a,r),s}function dz(e,t,n,r,o){let s=o.uvarint();if((s&1)===1){if(n==null)return-1;let u=t[n.index],f=(s-1)/2;(u===void 0||f>=u.length)&&Q("a known back-reference",void 0,o.options);let l=u[f];return l===Rn?-1:(W(r,n.name,l),n.index)}let i=o.enter(s/2);if(n===null)return Xz(e.struct,o,r),o.exit(i),-1;if(n===void 0)return o.exit(i),-1;let a=e.intern[n.index];(a===Az||a===Rz)&&(o.intern=t[n.index]??=[]),nt[ue++]=n.name;let c=xr(n.layout,o);return ue--,o.intern=void 0,o.exit(i),a===uA&&(t[n.index]??=[]).push(c),c===Rn?-1:(W(r,n.name,c),n.index)}function dre(e,t){let n=e.elements.length,r=e.hasCount?t.uvarint():n;if(e.hasCount&&r>t.remaining+1048576&&Q("array count within allocation limit",r,t.options),e.rest.length===0&&r>n)throw nt[ue++]=n,pn(new la(e.ast,void 0,t.options));if(r<e.minCount)throw nt[ue++]=r,pn(new sn(void 0));if(r>0){let i=Nz(e);if(i!==null)return ure(i,r,t)}let o=new Array(r),s=e.uniform;if(s!==void 0){if(e.uniformNumbers)return pre(o,r,t);let i=t.intern;if(t.intern=void 0,i!==void 0){for(let u=0;u<r;u++){nt[ue++]=u;let f=cre(i,s,t);if(f===Rn)throw pn(new sn(void 0));ue--,o[u]=f}return o}if(Eb(s)){for(let u=0;u<r;u++)nt[ue++]=u,o[u]=rh(s,t),ue--;return o}if(s._==="string"){for(let u=0;u<r;u++)nt[ue++]=u,o[u]=t.readUtf8(t.uvarint()),ue--;return o}let a=e.uniformPacked,c=e.uniformInline;for(let u=0;u<r;u++){nt[ue++]=u;let f=t.enter(c?a??0:t.uvarint()),l=xr(s,t);if(t.exit(f),l===Rn)throw pn(new sn(void 0));ue--,o[u]=l}return o}for(let i=0;i<r;i++){let a=Hz(e,i,r),c=i<n&&e.elements[i].optional;if(!e.hasCount&&t.remaining===0&&!c&&a._!=="null"&&a._!=="undefined")throw nt[ue++]=i,pn(new sn(void 0));nt[ue++]=i;let u=Vz(a,t);if(u===Rn)throw c&&Q("known union member",void 0,t.options),pn(new sn(void 0));ue--,o[i]=u}if(!e.hasCount&&t.pos<t.end)throw nt[ue++]=n,pn(new la(e.ast,void 0,t.options));return o}function pre(e,t,n){let r=n.byte();if(r===Ez){n.remaining!==t*8&&Q("f64",void 0,n.options);for(let o=0;o<t;o++)e[o]=n.f64();return e}if(r===Iz){for(let o=0;o<t;o++){nt[ue++]=o;let s=n.uvarint(),i=s%16;i>Sb&&Q("decimal",void 0,n.options);let a=vz((s-i)/16);e[o]=i===0?a:a/Nc[i],ue--}return e}r!==wz&&Q("f64",void 0,n.options);for(let o=0;o<t;o++)nt[ue++]=o,e[o]=n.numberVarint(),ue--;return e}function mre(e,t){let n=t.byte();if(n===St.variant){let o=t.u32le(),s=e.byTag.get(o);if(s===void 0)return t.take(t.remaining),Rn;let i=xr(s.payload,t);if(i===Rn)return Rn;if(!s.tuple)for(let a of s.sentinels)W(i,a.key,a.literal);return i}let r=e.byKind.get(n);return r===void 0?(t.take(t.remaining),Rn):xr(r,t)}function hre(e,t){let n=e.byPos[t.uvarint()];n===void 0&&Q("known union member",void 0,t.options);let r=xr(n.layout,t),o=n.variant;if(o!==void 0&&!o.tuple&&r!==Rn)for(let s of o.sentinels)W(r,s.key,s.literal);return r}function pz(e,t){switch(t.byte()){case 0:return Hf(ud(xr(e.error,t)));case 1:return Wf(ud(xr(e.defect,t)));case 2:return t.remaining!==0&&Q("empty",void 0,t.options),lu();case 3:return t.remaining!==8&&Q("f64",void 0,t.options),lu(t.f64());default:return t.take(t.remaining),Rn}}function ud(e){if(e===Rn)throw pn(new sn(void 0));return e}function rh(e,t){switch(e._){case"literal":{let n=rh(e.leaf,t);return ch(e,n)||Q(bb(e),n,t.options),n}case"bool":{t.remaining!==1&&Q("bool",void 0,t.options);let n=t.byte();return n>1&&Q("bool",void 0,t.options),n===1}case"null":return t.remaining!==0&&Q("empty",void 0,t.options),null;case"undefined":t.remaining!==0&&Q("empty",void 0,t.options);return;case"number":{let n=t.remaining;if(n===8)return t.f64();(n===0||n>bz)&&Q("f64",void 0,t.options);let r=t.numberVarint();if(t.remaining===0)return r;let o=t.byte();return(t.remaining!==0||o===0||o>Sb)&&Q("decimal",void 0,t.options),r/Nc[o]}case"int":return t.numberVarint();case"string":{let n=t.dict;return n===void 0?t.readUtf8(t.end-t.pos):Vne(n,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&&Q("int64",void 0,t.options);let n=Number(t.i64());if(e.flavor!=="date")return eU(n);let r=new Date(n);return Number.isNaN(r.getTime())&&Q("a valid Date",n,t.options),r}case"dateTimeZoned":{let n=Number(t.i64()),r=t.byte(),o;if(r===0)t.remaining!==4&&Q("time zone",void 0,t.options),o=t.i32le();else if(r===1)o=t.readUtf8(t.end-t.pos);else return Q("time zone",void 0,t.options);try{return Cx(n,{timeZone:o})}catch{return Q("time zone",void 0,t.options)}}case"duration":switch(t.byte()){case 0:return Lr(t.zigzag());case 1:return po;case 2:return Zi;default:return Q("duration",void 0,t.options)}case"bigDecimal":{let n=t.zigzag(),r=t.zigzag();return(r>GC||-r>GC)&&Q("safe integer length",void 0,t.options),sr(n,Number(r))}case"json":{let n=t.readUtf8(t.end-t.pos);try{return JSON.parse(n)}catch{return Q("json",void 0,t.options)}}case"option":{let n=t.byte();return n===0?(t.remaining!==0&&Q("empty",void 0,t.options),D()):(n!==1&&Q("bool",void 0,t.options),L(ud(xr(e.value,t))))}case"result":{let n=t.byte();return n===0?Ce(ud(xr(e.success,t))):(n!==1&&Q("bool",void 0,t.options),Ae(ud(xr(e.failure,t))))}case"exit":{let n=t.byte();if(n===0)return kn(ud(xr(e.value,t)));n!==1&&Q("bool",void 0,t.options);let r=rh(e.cause,t);return jt(r)}case"cause":{let n=t.uvarint(),r=[];for(let o=0;o<n;o++){nt[ue++]=o;let s=t.enter(t.uvarint()),i=pz(e,t);t.exit(s),ue--,i!==Rn&&r.push(i)}return t.pos!==t.end&&Q("no leftover bytes",void 0,t.options),Xa(r)}case"causeReason":return pz(e,t);case"struct":return t.positional?are(e,t):ire(e,t);case"array":return dre(e,t);case"union":return t.positional?hre(e,t):mre(e,t);case"never":throw pn(new st(e.ast,void 0,t.options))}}function eH(e,t,n){let r=t.byte();if(r!==n.envelope&&Q(n.expectedEnvelope,r,t.options),n.positional){t.remaining<8&&Q("complete value",void 0,t.options);let s=t.buf,i=n.fingerprint,a=t.pos;for(let c=0;c<8;c++)s[a+c]!==i[c]&&Q("matching layout fingerprint",void 0,t.options);t.pos=a+8}let o=xr(e,t);if(o===Rn)throw pn(new sn(void 0));return o}var ab=new th;function gre(e,t,n,r){let o=ab??new th,s=o===ab;s&&(ab=void 0),o.reset(t,0,t.length,n,void 0,r.positional,void 0);let i=ue;ue=0;try{let a=o.uvarint();a===0&&Q("nonzero frame length",void 0,n);let c=o.enter(a),u=eH(e,o,r);return o.exit(c),o.pos!==t.length&&Q("no leftover bytes",void 0,n),u}finally{ue=i,o.release(),s&&(ab=o)}}function xre(e,t,n,r=!1){return Ar({decode:(o,s)=>{try{let i=gre(e,o,s,t);return n!==void 0&&hd(i)&&(!r||Ib(i))&&(n.value=i),v(i)}catch(i){return i instanceof Di?G(i.issue):ho(i)}},encode:(o,s)=>{try{return v(yb(e,o,s,t))}catch(i){return i instanceof Di?G(i.issue):ho(i)}}})}var yre=wn(Cne);function sf(e,t){return t===!0?yre(e):kne}var Sre=wn(e=>{let t=re(fb(e)),{exact:n,exitSuccess:r,layout:o,recursive:s}=wne(t.ast);return{target:s?vre(t):t,layout:o,exact:n,exitSuccess:r,recursive:s}});function ld(e){return Sre(e.ast)}function tH(e,t){return e.value===void 0||t!==e.value?!1:(e.value=void 0,!0)}function nH(e,t,n){let r=re(yn(e.ast)),o=dt(r),s=i=>()=>(a,c,u)=>i(a,u)?on:o(a,u);return re(new pa([r.ast],s(t),{identifier:"binary value"},void 0,void 0,void 0,void 0,s(n)))}function sA(e,t){return t.onExcessProperty!=="error"}function bre(e,t,n){return nH(e,r=>tH(t,r),n?sA:Ere)}function Ere(){return!1}function wre(e,t){return An()([e],([n])=>{let r=dt(n);return(o,s,i)=>tH(t,o)||Ib(o)&&i.onExcessProperty!=="error"?v(o):r(o,i)},{identifier:"binary exit value"})}function Ire(e){return nH(e,sA,sA)}function vre(e){let t=re(yn(e.ast)),n=new WeakSet,r=An()([t],([o])=>(s,i,a)=>hd(s)&&n.delete(s)?v(s):gr(s)?G(new st(i,s,a)):dt(o)(s,a),{identifier:"acyclic value"});return be(r,vt({decode:o=>(hd(o)&&n.add(o),o),encode:o=>o}))(e)}var fh=Cc,bn=class extends Ke()("effect/rpc/RpcSerialization"){},uh=class extends Mn("MaxBufferSizeExceeded"){get message(){return`RPC serialization buffer exceeded the maximum size of ${this.maxBufferSize}`}},sH=16*1024*1024,vb=(e,t)=>t!=="unbounded"&&e>t,iH=bn.of({contentType:"application/json",includesFraming:!1,codecFor:fh,makeUnsafe:()=>{let e=new TextDecoder;return{decode:t=>{let n=JSON.parse(typeof t=="string"?t:e.decode(t));return Array.isArray(n)?n:[n]},encode:t=>JSON.stringify(t)}}}),Tb=e=>{let t=e?.maxBufferSize??sH;return bn.of({contentType:"application/ndjson",includesFraming:!0,codecFor:fh,makeUnsafe:()=>{let n=new TextDecoder,r="",o=s=>{throw r="",new uh({maxBufferSize:s})};return{decode:s=>{r+=typeof s=="string"?s:n.decode(s,{stream:!0});let i=0,a=r.indexOf(`
39
- `,i),c=[];for(;a!==-1;){vb(a-i,t)&&o(t);let u=JSON.parse(r.slice(i,a));c.push(u),i=a+1,a=r.indexOf(`
40
- `,i)}return r=r.slice(i),vb(r.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])+`
58
+ ${e.answers?_j(n,e.answers,e.body):e.body}`}function Dee(e,t,n){for(let r of e){let o=t.answers?.find(i=>i.prompt===r.dataset.prompt);for(let i of r.querySelectorAll("input"))i.checked=n&&(o?.selected.includes(i.value)??!1);let s=r.querySelector("textarea");s&&(s.value=o?.text??"")}}function Pj(e){function t(a){return a.dataset.mode==="text"?"text":a.dataset.mode==="many"?"many":"one"}let n=[...e.querySelectorAll("fieldset[data-prompt]")],r=n.map(a=>({id:a.dataset.prompt??"",mode:t(a),options:[...a.querySelectorAll("input[data-option-source]")].map(c=>({id:c.value,source:c.dataset.optionSource??""})),source:a.dataset.source??""}));function o(){return n.length===0?void 0:n.map(a=>({prompt:a.dataset.prompt??"",selected:[...a.querySelectorAll("input:checked")].map(c=>c.value),text:a.querySelector("textarea")?.value??""}))}function s(a,c){let u=a.revision===c&&(a.question===void 0||a.question===e.dataset.question);Dee(n,a,u);let f=e.querySelector("#response-draft-recovery"),l=!u&&a.answers?`Earlier template answers (selections cleared; review before choosing again):
59
+ ${JSON.stringify(a.answers,null,2)}
60
+ ${a.recovery??""}`:a.recovery;return f&&(f.textContent=l??"",f.hidden=!l),l}function i(a){for(let c of n){let u=c.querySelector("textarea");u?.setCustomValidity(a==="answer"&&!u.value.trim()&&!c.querySelector("input:checked")?"Choose an option or answer in your own words.":"")}}for(let a of n)a.querySelector("[data-clear-choices]")?.addEventListener("click",()=>{for(let c of a.querySelectorAll("input"))c.checked=!1;e.dispatchEvent(new Event("input",{bubbles:!0}))});return{models:r,read:o,restore:s,validate:i}}var Fj="~effect/http/Cookies";var Uj="~effect/http/Cookies/Cookie";var Dj="~effect/http/Cookies/CookieError",jk=class extends gO{},Nj=class e extends Mn("CookieError"){static fromReason(t,n){return new e({reason:new jk({_tag:t,cause:n})})}[Dj]=Dj;get message(){return this.reason._tag}},Nee={[Fj]:Fj,...Gs,toJSON(){return{_id:"effect/Cookies",cookies:Hh(this.cookies,e=>e.toJSON())}},pipe(){return ie(this,arguments)}},Lee=e=>{let t=Object.create(Nee);return t.cookies=e,t},Bee=e=>{let t={};for(let n of e)W(t,n.name,n);return Lee(t)},Bj=e=>{let t=typeof e=="string"?[e]:e,n=[];for(let r of t){let o=qee(r.trim());o&&n.push(o)}return Bee(n)};function qee(e){let t=e.split(";").map(a=>a.trim()).filter(a=>a!=="");if(t.length===0)return;let n=t[0].indexOf("=");if(n===-1)return;let r=t[0].slice(0,n);if(!jee.test(r))return;let o=t[0].slice(n+1),s=$ee(o);if(t.length===1)return Object.assign(Object.create(Lj),{name:r,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(),l=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case"domain":{if(l===void 0)break;let p=l.trim().replace(/^\./,"");p&&(i.domain=p);break}case"expires":{if(l===void 0)break;let p=new Date(l);isNaN(p.getTime())||(i.expires=p);break}case"max-age":{if(l===void 0)break;let p=parseInt(l,10);isNaN(p)||(i.maxAge=Mb(p));break}case"path":{if(l===void 0)break;l[0]==="/"&&(i.path=l);break}case"priority":{if(l===void 0)break;switch(l.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(l===void 0)break;switch(l.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(Lj),{name:r,value:s,valueEncoded:o,options:Object.keys(i).length>0?i:void 0})}var jee=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;var Lj={[Uj]:Uj,...Gs,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};var $ee=e=>{try{return decodeURIComponent(e)}catch{return e}};var JS={};rs(JS,{Fetch:()=>y$,RequestInit:()=>KS,layer:()=>pte});var jj=Symbol.for("~effect/http/Headers");var Dm=Object.defineProperties(Object.create(null),{[jj]:{value:jj},[Wc]:{value(e){return Hee(this,$e(e,zk))}},toJSON:{value(){return ko(this)}},[_e]:{value(e){return zee(this,e)}},[Oe]:{value(){return xd(this)}},toString:{value:Gs.toString},[at]:{value:Gs[at]}}),DS=e=>Object.assign(Object.create(Dm),e),zee=TR(Hc());var Yl=Object.create(Dm),Mi=e=>{if(e===void 0)return Yl;if(Symbol.iterator in e){let n=Object.create(Dm);for(let[r,o]of e)n[r.toLowerCase()]=o;return n}let t=Object.create(Dm);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(", "):r!==void 0&&(t[n.toLowerCase()]=r);return t},$j=e=>Object.setPrototypeOf(e,Dm);var Nm=d(3,(e,t,n)=>{let r=DS(e);return r[t.toLowerCase()]=n,r}),zj=d(2,(e,t)=>DS({...e,...Mi(t)})),Xl=d(2,(e,t)=>{let n=DS(e);return Object.assign(n,t),n}),Ac=d(2,(e,t)=>{let n=DS(e);return delete n[t.toLowerCase()],n});var Hee=d(2,(e,t)=>{let n={...e},r=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(n[s]=Ec(e[s]))}else for(let s in e)o.test(s)&&(n[s]=Ec(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)r(t[o]);else r(t);return n}),$k=(e,t)=>{for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="string"){if(r.toLowerCase()===e)return!0}else if(r.test(e))return!0}return!1},zk=Me("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]});var Hk="~effect/http/UrlParams",Wee=e=>q(e,Hk),Vee={...vn,[Hk]:Hk,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[_e](e){return Kee(this,e)},[Oe](){return Fa(this.params.flat())}},Hj=e=>{let t=Object.create(Vee);return t.params=e,t},Lm=e=>{if(Wee(e))return e;let t=Wj(e),n=[];for(let r=0;r<t.length;r++)if(Array.isArray(t[r][0])){let[o,s]=t[r];n.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else n.push(t[r]);return Hj(n)},Wj=e=>{let t=typeof e[Symbol.iterator]=="function"?ht(e):Object.entries(e),n=[];for(let[r,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&n.push([r,String(o[s])]);else if(typeof o=="object"){let s=Wj(o);for(let[i,a]of s)n.push([[r,...typeof i=="string"?[i]:i],a])}else o!==void 0&&n.push([r,String(o)]);return n},Kee=un((e,t)=>Jee(e.params,t.params)),Jee=_R(SR([Hc(),Hc()]));var Vj=Hj([]);var Kj=d(2,(e,t)=>{let n=Lm(t),r=n.params,o=new Set;for(let s=0;s<r.length;s++)o.add(r[s][0]);for(let s=0;s<e.params.length;s++)o.has(e.params[s][0])||r.push(e.params[s]);return n});var Vk="~effect/http/HttpBody";var Jj="~effect/http/HttpBody/HttpBodyError",Gj=class extends Mn("HttpBodyError"){[Jj]=Jj},NS=class{[Vk];constructor(){this[Vk]=Vk}[at](){return this.toJSON()}toString(){return X(this,{ignoreToString:!0})}},Kk=class extends NS{_tag="Empty";toJSON(){return{_id:"effect/HttpBody",_tag:"Empty"}}},Zj=new Kk;var Jk=class extends NS{_tag="Uint8Array";body;contentType;contentLength;constructor(t,n,r){super(),this.body=t,this.contentType=n,this.contentLength=r}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}}},LS=(e,t)=>new Jk(e,t??"application/octet-stream",e.length),Gee=new TextEncoder,Gk=(e,t)=>LS(Gee.encode(e),t??"text/plain");var Qk="~effect/http/HttpClientError";var Io=class extends Mn("HttpClientError"){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[Qk]=Qk;get request(){return this.reason.request}get response(){return"response"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},$S=e=>e.endsWith("Error")?e.slice(0,-5):e,zS=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,BS=class extends Mn("TransportError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return zS($S(this._tag),this.description,this.methodAndUrl)}};var qS=class extends Mn("InvalidUrlError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return zS($S(this._tag),this.description,this.methodAndUrl)}};var Rc=class extends Mn("DecodeError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return zS($S(this._tag),this.description,t)}},jS=class extends Mn("EmptyBodyError"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return zS($S(this._tag),this.description,t)}},ed=class e extends $n(Qk)({_tag:Ze("HttpError"),kind:Ca(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:Pt(ln())}){static fromHttpClientError(t){return new e({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}};var Qj=[["GET","get"],["POST","post"],["PUT","put"],["DELETE","del"],["PATCH","patch"],["HEAD","head"],["OPTIONS","options"],["TRACE","trace"]];var Xj=(e,t)=>t._tag==="Empty"||t._tag==="FormData"?Ac(Ac(e,"content-type"),"content-length"):(e=t.contentType===void 0?Ac(e,"content-type"):Nm(e,"content-type",t.contentType),t.contentLength===void 0?Ac(e,"content-length"):Nm(e,"content-length",t.contentLength.toString()));var Yk=class extends Mn("UrlError"){},e$=(e,t,n)=>jh({try:()=>{let r=new URL(e,Qee());for(let o=0;o<t.params.length;o++){let[s,i]=t.params[o];i!==void 0&&r.searchParams.append(s,i)}return n!==void 0&&(r.hash=n),r},catch:r=>new Yk({cause:r})}),Qee=()=>{if("location"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var n$="~effect/http/HttpClientRequest";var Yee={[n$]:n$,...Gs,toJSON(){return{_id:"HttpClientRequest",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:ko(this.headers),body:this.body.toJSON()}},pipe(){return ie(this,arguments)}};function Pi(e,t,n,r,o,s){let i=Object.create(Yee);return i.method=e,i.url=t,i.urlParams=n,i.hash=r,i.headers=o,i.body=s,i}var Xee=Pi("GET","",Vj,D(),Yl,Zj),r$=e=>(t,n)=>ete(Xee,{method:e,url:t,...n??void 0});var ete=d(2,(e,t)=>{let n=e;return t.method&&(n=o$(n,t.method)),t.url&&(n=a$(n,t.url)),t.headers&&(n=Xk(n,t.headers)),t.urlParams&&(n=rte(n,t.urlParams)),t.hash&&(n=ote(n,t.hash)),t.body&&(n=u$(n,t.body)),t.accept&&(n=i$(n,t.accept)),t.acceptJson&&(n=tte(n)),n}),o$=d(2,(e,t)=>Pi(t,e.url,e.urlParams,e.hash,e.headers,e.body)),s$=d(3,(e,t,n)=>Pi(e.method,e.url,e.urlParams,e.hash,Nm(e.headers,t,n),e.body)),Xk=d(2,(e,t)=>Pi(e.method,e.url,e.urlParams,e.hash,zj(e.headers,t),e.body));var i$=d(2,(e,t)=>s$(e,"Accept",t)),tte=i$("application/json"),a$=d(2,(e,t)=>{if(typeof t=="string")return Pi(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Lm(n.searchParams),o=Xc(n.hash===""?void 0:n.hash.slice(1));return n.search="",n.hash="",Pi(e.method,n.toString(),r,o,e.headers,e.body)}),c$=d(2,(e,t)=>t===""?e:Pi(e.method,nte(t,e.url),e.urlParams,e.hash,e.headers,e.body));var nte=(e,t)=>{let n=e.endsWith("/"),r=t.startsWith("/");return n&&r?e+t.slice(1):!n&&!r?e+"/"+t:e+t};var rte=d(2,(e,t)=>Pi(e.method,e.url,Kj(e.urlParams,t),e.hash,e.headers,e.body));var ote=d(2,(e,t)=>Pi(e.method,e.url,e.urlParams,L(t),e.headers,e.body));var u$=d(2,(e,t)=>Pi(e.method,e.url,e.urlParams,e.hash,Xj(e.headers,t),t));var nf="~effect/http/HttpIncomingMessage";var f$=(e,t)=>{let n=e.headers["content-type"]??"",r;if(n.includes("application/json"))try{r=hi(e.json)}catch{}else if(n.includes("text/")||n.includes("urlencoded"))try{r=hi(e.text)}catch{}let o={...t,headers:ko(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(o.body=r),o};var td="~effect/http/HttpClientResponse",l$=(e,t)=>new nC(e,t);var nC=class extends _h{[nf];[td];request;source;constructor(t,n){super(),this.request=t,this.source=n,this[nf]=nf,this[td]=td}toJSON(){return f$(this,{_id:"HttpClientResponse",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return Mi(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=Bj(this.source.headers.getSetCookie())}get remoteAddress(){return D()}get stream(){return this.source.body?xk({evaluate:()=>this.source.body,onError:t=>new Io({reason:new Rc({request:this.request,response:this,cause:t})})}):Yu(new Io({reason:new jS({request:this.request,response:this,description:"can not create stream from empty body"})}))}get json(){return O(this.text,t=>qo({try:()=>t===""?null:JSON.parse(t),catch:n=>new Io({reason:new Rc({request:this.request,response:this,cause:n})})}))}textBody;get text(){return this.textBody??=Y(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return O(this.text,t=>qo({try:()=>Lm(new URLSearchParams(t)),catch:n=>new Io({reason:new Rc({request:this.request,response:this,cause:n})})}))}formDataBody;get formData(){return this.formDataBody??=bs({try:()=>this.source.formData(),catch:t=>new Io({reason:new Rc({request:this.request,response:this,cause:t})})}).pipe(hx,hi)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=bs({try:()=>this.source.arrayBuffer(),catch:t=>new Io({reason:new Rc({request:this.request,response:this,cause:t})})}).pipe(hx,hi),this.arrayBufferBody)}pipe(){return ie(this,arguments)}};var d$=e=>$j({b3:`${e.traceId}-${e.spanId}-${e.sampled?"1":"0"}${or(e.parent,{onNone:()=>"",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?"01":"00"}`});var m$="~effect/http/HttpClient";var oC=Ve("effect/HttpClient");var ste=d(2,(e,t)=>sC(n=>t(e.postprocess(n)),e.preprocess));var sC=(e,t)=>{let n=Object.create(ite);return n.preprocess=t,n.postprocess=e,n.execute=function(r){return e(t(r))},n},ite={[m$]:m$,pipe(){return ie(this,arguments)},...Gs,toJSON(){return{_id:"effect/HttpClient"}},...Object.fromEntries(Qj.map(([e,t])=>[t,function(n,r){return this.execute(r$(e)(n,r))}]))},h$=e=>sC(t=>O(t,n=>xn(r=>{let o=lte.get(n),s=o??new AbortController,i=e$(n.url,n.urlParams,_o(n.hash));if(Fe(i))return G(new Io({reason:new qS({request:n,cause:i.failure})}));let a=i.success;if(r.getRef(Af)||r.getRef(ate)(n)){let u=e(n,a,s.signal,r);return o?u:So(f=>Gr(f(u),{onSuccess(l){return WS.register(l,s),v(new VS(l,s))},onFailure(l){return Y0(l)&&s.abort(),ct(l)}}))}return pp(r.getRef(fte)(n),{kind:"client"},u=>{u.attribute("http.request.method",n.method),u.attribute("server.address",a.origin),a.port!==""&&u.attribute("server.port",+a.port),u.attribute("url.full",a.toString()),u.attribute("url.path",a.pathname),u.attribute("url.scheme",a.protocol.slice(0,-1));let f=a.search.slice(1);f!==""&&u.attribute("url.query",f);let l=r.getRef(zk),p=r.getRef(cte);for(let m in n.headers)p(m,"request")&&u.attribute(`http.request.header.${m}`,$k(m,l)?"<redacted>":n.headers[m]);return n=r.getRef(ute)?Xk(n,d$(u)):n,So(m=>m(e(n,a,s.signal,r)).pipe(sl(u,{captureStackTrace:!1}),Gr({onSuccess:h=>{u.attribute("http.response.status_code",h.status);for(let g in h.headers)p(g,"response")&&u.attribute(`http.response.header.${g}`,$k(g,l)?"<redacted>":h.headers[g]);return o?v(h):(WS.register(h,s),v(new VS(h,s)))},onFailure(h){return!o&&Y0(h)&&s.abort(),ct(h)}})))})})),v),g$=d(2,(e,t)=>sC(e.postprocess,n=>Y(e.preprocess(n),t)));var ate=Me("effect/http/HttpClient/TracerDisabledWhen",{defaultValue:()=>qc}),cte=Me("effect/http/HttpClient/TracerHeaderFilter",{defaultValue:()=>Xt}),ute=Me("effect/HttpClient/TracerPropagationEnabled",{defaultValue:Xt}),fte=Me("effect/http/HttpClient/SpanNameGenerator",{defaultValue:()=>e=>`http.client ${e.method}`}),x$=e=>Wr(oC)(ur(t=>Y(e,n=>ste(n,lp(r=>br(t,r)))))),WS=(()=>{if("FinalizationRegistry"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(n=>{n.abort()});return{register(n,r){t.register(n,r,n)},unregister(n){t.unregister(n)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),lte=new WeakMap,VS=class{original;controller;constructor(t,n){this.original=t,this.controller=n}[td]=td;[nf]=nf;applyInterrupt(t){return V(()=>(WS.unregister(this.original),pi(t,()=>se(()=>{this.controller.abort()}))))}get request(){return this.original.request}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 Ur(()=>(WS.unregister(this.original),Mm(this.original.stream,se(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[at](){return this.original[at]()}pipe(){return ie(this,arguments)}};var y$=Me("effect/http/FetchHttpClient/Fetch",{defaultValue:()=>globalThis.fetch}),KS=class extends Ve()("effect/http/FetchHttpClient/RequestInit"){},dte=h$((e,t,n,r)=>{let o=r.getRef(y$),s=Ji(r.context,KS)??{},i=s.headers?Xl(Mi(s.headers),e.headers):e.headers;i["content-length"]&&(i=Ac(i,"content-length"));let a=c=>Y(bs({try:()=>o(t,{...s,method:e.method,headers:i,body:c,duplex:e.body._tag==="Stream"?"half":void 0,signal:n}),catch:u=>new Io({reason:new BS({request:e,cause:u})})}),u=>l$(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 O(Ok(e.body.stream),a)}return a(void 0)}),pte=x$(v(dte));var E$=Ve("effect/socket/Socket");var aC="~effect/socket/Socket/CloseEvent",S$=class{[aC];code;reason;constructor(t=1e3,n){this[aC]=aC,this.code=t,this.reason=n}toString(){return this.reason?`${this.code}: ${this.reason}`:`${this.code}`}};var GS="~effect/socket/Socket/SocketError",mte=e=>q(e,GS),cC=class extends $n("effect/socket/Socket/SocketReadError")({_tag:Ze("SocketReadError"),cause:ln()}){message="An error occurred during Read"},uC=class extends $n("effect/socket/Socket/SocketWriteError")({_tag:Ze("SocketWriteError"),cause:ln()}){message="An error occurred during Write"},Bm=class extends $n("effect/socket/Socket/SocketOpenError")({_tag:Ze("SocketOpenError"),kind:Ca(["Unknown","Timeout"]),cause:ln()}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}},qm=class extends $n("effect/socket/Socket/SocketCloseError")({_tag:Ze("SocketCloseError"),code:zs,closeReason:Pt(fe)}){static filterClean(t){return function(n){return nd.is(n)&&n.reason._tag==="SocketCloseError"&&t(n.reason.code)?Ce(n.reason):Ae(n)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},fC=He([cC,uC,Bm,qm]),nd=class extends uk(GS)("SocketError",{_tag:Ze("SocketError"),reason:fC}){constructor(t){"cause"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[GS]=GS;static is(t){return mte(t)}message=this.reason.message};var b$="~effect/reactivity/AsyncResult",w$=e=>q(e,b$),ZS={[b$]:{E:B,A:B},pipe(){return ie(this,arguments)},[_e](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case"Initial":return!0;case"Success":return ae(this.value,e.value);case"Failure":return ae(this.cause,e.cause)}},[Oe](){let e=it(`${this._tag}:${this.waiting}`);return this._tag==="Initial"?e:Nt(e)(this._tag==="Success"?ce(this.value):ce(this.cause))}};var dC=(e,t)=>e._tag==="Success"?Yo(e.value):od(e.cause,{previous:t}),QS=e=>e._tag==="None"?Oa(!0):jm(e.value);var I$=e=>e._tag!=="Initial",Oa=(e=!1)=>{let t=Object.create(ZS);return t._tag="Initial",t.waiting=e,t},rd=e=>e._tag==="Success",Yo=(e,t)=>{let n=Object.create(ZS);return n._tag="Success",n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},v$=e=>e._tag==="Failure";var lC=(e,t)=>{let n=Object.create(ZS);return n._tag="Failure",n.cause=e,n.previousSuccess=t?.previousSuccess??D(),n.waiting=t?.waiting??!1,n},od=(e,t)=>lC(e,{previousSuccess:as(t.previous,n=>rd(n)?L(n):v$(n)?n.previousSuccess:D()),waiting:t.waiting});var T$=(e,t)=>od(hP(e),t),jm=(e,t)=>{if(e.waiting)return t?.touch?gte(e):e;let n=Object.assign(Object.create(ZS),e);return n.waiting=!0,t?.touch&&rd(n)&&(n.timestamp=Date.now()),n},gte=e=>rd(e)?Yo(e.value,{waiting:e.waiting}):e,$m=(e,t)=>e._tag==="Failure"?od(e.cause,{previous:t,waiting:e.waiting}):e,pC=e=>e._tag==="Success"?L(e.value):e._tag==="Failure"?Lt(e.previousSuccess,t=>t.value):D();var mC=e=>_d(pC(e),()=>new Kf("AsyncResult.getOrThrow: no value found"));var sd=e=>{switch(e._tag){case"Success":return kn(e.value);case"Failure":return qt(e.cause);default:return Uo(new Kf)}};var hC=e=>{let t=e.success??Ic,n=e.error??Ic,r=An()([t,Hl(n,ln())],([o,s])=>(i,a,c)=>{if(!w$(i))return G(new st(a,i,c));switch(i._tag){case"Initial":return v(i);case"Success":return fn(dt(o)(i.value,c),{onSuccess:u=>Yo(u,i),onFailure:u=>Xn(a,"value",u,i,c)});case"Failure":{let u=i.previousSuccess.pipe(Lt(l=>fn(dt(o)(l.value,c),{onSuccess:p=>L(Yo(p,l)),onFailure:p=>new At(a,[new Ct(["previousSuccess","value"],p)],i,c)})),ja(()=>ws)),f=vu(dt(s)(i.cause,c),l=>Xn(a,"cause",l,i,c));return Bn(u,l=>la(f,p=>lC(p,{previousSuccess:l,waiting:i.waiting})))}}},{expected:"AsyncResult",toCodec([o,s]){let i=Tc("Success",{value:o,waiting:vc,timestamp:zs});return pt()(He([Tc("Initial",{waiting:vc}),i,Tc("Failure",{cause:s,previousSuccess:ki(i),waiting:vc})]),vt({decode:a=>{switch(a._tag){case"Initial":return Oa(a.waiting);case"Success":return Yo(a.value,{waiting:a.waiting,timestamp:a.timestamp});case"Failure":return lC(a.cause,{previousSuccess:Lt(a.previousSuccess,c=>Yo(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:yd,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(r,{success:t,error:n})};var Hm="~effect/reactivity/AtomRegistry",xte=e=>q(e,Hm),k$=e=>new yC(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),YS=Ve(Hm);var Wm=d(e=>xte(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return Is(o=>{let s=e.get(t);if(s._tag!=="Initial"&&!(r&&s.waiting))return o(sd(s));let i=e.subscribe(t,a=>{a._tag!=="Initial"&&!(r&&a.waiting)&&(o(sd(a)),i())});return se(i)})});var yte={immediate:!0},Ste=e=>{e()},xC="~effect-atom/atom/Atom/Serializable",zm=e=>xC in e?e[xC].key:e,yC=class{[Hm];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(t,n,r,o){if(this[Hm]=Hm,this.scheduler=new ei("sync",n),this.schedulerAsync=new ei("async",n),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=o,r===void 0&&o!==void 0?this.timeoutResolution=Math.round(o/2):this.timeoutResolution=r??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,n){t.write(this.ensureNode(t).writeContext,n)}setSerializable(t,n){this.preloadedSerializable.set(t,n)}modify(t,n){let r=this.ensureNode(t),o=n(r.value());return t.write(r.writeContext,o[1]),o[0]}update(t,n){let r=this.ensureNode(t);t.write(r.writeContext,n(r.value()))}refresh=t=>{t.refresh!==void 0?t.refresh(this.refresh):this.invalidateAtom(t)};subscribe(t,n,r){let o=this.ensureNode(t);r?.immediate&&n(o.value());let s=o.subscribe(function(){n(o._value)});return()=>{s(),o.canBeRemoved&&this.scheduleNodeRemoval(o)}}mount(t){return this.subscribe(t,bn,yte)}atomHasTtl(t){return!t.keepAlive&&t.idleTTL!==0&&(t.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(t){let n=zm(t),r=this.nodes.get(n);if(r===void 0?(r=this.createNode(t),this.nodes.set(n,r),this.onNodeAdded?.(r)):this.atomHasTtl(t)&&this.removeNodeTimeout(r),typeof n=="string"&&this.preloadedSerializable.has(n)){let o=this.preloadedSerializable.get(n);this.preloadedSerializable.delete(n);let s=t[xC].decode(o),i=t;for(;i.initialValueTarget;)i=i.initialValueTarget;i===t?r.setValue(s):this.ensureNode(i).setInitialValue(s)}return r}createNode(t){if(this.disposed)throw new Error(`Cannot access Atom ${t}: registry is disposed`);return t.keepAlive||this.scheduleAtomRemoval(t),new SC(this,t)}invalidateAtom=t=>{this.ensureNode(t).invalidate()};scheduleAtomRemoval(t){this.dispatcher.scheduleTask(()=>{let n=this.nodes.get(zm(t));n!==void 0&&n.canBeRemoved&&this.removeNode(n)},0)}scheduleNodeRemoval(t){this.dispatcher.scheduleTask(()=>{t.canBeRemoved&&this.removeNode(t)},0)}removeNode(t){this.atomHasTtl(t.atom)?this.setNodeTimeout(t):(this.nodes.delete(zm(t.atom)),t.remove(),this.onNodeRemoved?.(t))}setNodeTimeout(t){if(this.nodeTimeoutBucket.has(t))return;let n=t.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(n-=this.#e,n<=0)){this.nodes.delete(zm(t.atom)),t.remove(),this.onNodeRemoved?.(t);return}let r=Math.ceil(n/this.timeoutResolution)*this.timeoutResolution,o=Date.now()+r,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 n=this.nodeTimeoutBucket.get(t);if(n===void 0)return;this.nodeTimeoutBucket.delete(t),this.scheduleNodeRemoval(t);let[r,o]=this.timeoutBuckets.get(n);r.delete(t),r.size===0&&(clearTimeout(o),this.timeoutBuckets.delete(n))}#e=null;sweepBucket(t){let n=this.timeoutBuckets.get(t)[0];this.timeoutBuckets.delete(t),n.forEach(r=>{this.nodeTimeoutBucket.delete(r),r.canBeRemoved&&(this.nodes.delete(zm(r.atom)),this.onNodeRemoved?.(r),this.#e=r.atom.idleTTL??this.defaultIdleTTL,r.remove(),this.#e=null)})}reset(){this.timeoutBuckets.forEach(([,t])=>clearTimeout(t)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear(),this.nodes.forEach(t=>{t.remove(),this.onNodeRemoved?.(t)}),this.nodes.clear()}dispose(){this.disposed=!0,this.reset()}},Xo={alive:1,initialized:2,waitingForValue:4},Dr={uninitialized:Xo.alive|Xo.waitingForValue,stale:Xo.alive|Xo.initialized|Xo.waitingForValue,valid:Xo.alive|Xo.initialized,removed:0},SC=class{constructor(t,n){this.registry=t,this.atom=n,this.writeContext=new EC(t,this)}registry;atom;state=Dr.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;parents=new Set;previousParents;children=new Set;listeners=new Set;skipInvalidation=!1;building=!1;invalidatedDuringBuild=!1;currentState(){switch(this.state){case Dr.uninitialized:return"uninitialized";case Dr.stale:return"stale";case Dr.valid:return"valid";default:return"removed"}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}_value=void 0;value(){if((this.state&Xo.waitingForValue)!==0){this.lifetime=wte(this),this.building=!0;let t=this.atom.read(this.lifetime);if(this.building=!1,(this.state&Xo.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.state=Dr.valid):this.setValue(t)),this.previousParents){let n=this.previousParents;this.previousParents=void 0;for(let r of n)r.removeChild(this),r.canBeRemoved&&this.registry.scheduleNodeRemoval(r)}}return this._value}valueOption(){return(this.state&Xo.initialized)===0?D():L(this._value)}setInitialValue(t){if((this.state&Xo.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=Dr.stale,this._value=t,Qt.phase===Fi.collect?Qt.notify.add(this):this.notify();return}this.setValue(t)}setValue(t){if((this.state&Xo.initialized)===0){this.state=Dr.valid,this._value=t,Qt.phase===Fi.collect?Qt.notify.add(this):this.notify();return}this.state=Dr.valid,!this.atom.equals(this._value,t)&&(this._value=t,this.skipInvalidation?this.skipInvalidation=!1:this.invalidateChildren(),this.listeners.size>0&&(Qt.phase===Fi.collect?Qt.notify.add(this):this.notify()))}addParent(t){this.parents.add(t),this.previousParents!==void 0&&(this.previousParents.delete(t),this.previousParents.size===0&&(this.previousParents=void 0)),t.children.has(this)||(t.children.add(this),t.skipInvalidation&&(t.skipInvalidation=!1))}removeChild(t){this.children.delete(t)}invalidate(){this.building&&Qt.phase===Fi.collect&&(this.invalidatedDuringBuild=!0),this.state===Dr.valid&&(this.state=Dr.stale,this.disposeLifetime()),Qt.phase===Fi.collect?Qt.stale.push(this):this.atom.lazy&&this.listeners.size===0&&!Ete(this.children)?(this.invalidateChildren(),this.skipInvalidation=!0):this.value()}invalidateChildren(){if(this.children.size===0)return;let t=this.children;this.children=new Set;for(let n of t)n.invalidate()}notify(){this.listeners.forEach(Ste),Qt.phase===Fi.commit&&Qt.notify.delete(this)}disposeLifetime(){this.lifetime!==void 0&&(this.lifetime.dispose(),this.lifetime=void 0),this.parents.size!==0&&(this.previousParents=this.parents,this.parents=new Set)}remove(){if(this.state=Dr.removed,this.listeners.clear(),this.lifetime===void 0||(this.disposeLifetime(),this.previousParents===void 0))return;let t=this.previousParents;this.previousParents=void 0;for(let n of t)n.removeChild(this),n.canBeRemoved&&this.registry.removeNode(n)}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}};function Ete(e){if(e.size===0)return!1;let t=e,n,r=0;for(;t!==void 0;){for(let o of t){if(!o.atom.lazy||o.listeners.size>0)return!0;o.children.size>0&&(n===void 0?n=[o.children]:n.push(o.children))}t=n?.[r++]}return!1}var bte={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){if(this.disposed)return this.node.registry.get(e);let t=this.node.registry.ensureNode(e),n=t.value();return this.node.addParent(t),n},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return Kr;switch(n._tag){case"Initial":return Kr;case"Failure":return qt(n.cause);case"Success":return v(n.value)}},resultOnce(e,t){return Is(n=>{let r=this.once(e);if(r._tag!=="Initial"&&!(t?.suspendOnWaiting&&r.waiting))return n(sd(r));let o=this.node.registry.subscribe(e,s=>{s._tag==="Initial"||t?.suspendOnWaiting&&s.waiting||(o(),n(sd(s)))},{immediate:!1});return se(o)})},setResult(e,t){return this.disposed?Kr:(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"?Kr:v(t.value)},someOnce(e){return Is(t=>{let n=this.once(e);if(Te(n))return t(v(n.value));let r=this.node.registry.subscribe(e,o=>{xe(o)||(r(),t(v(o.value)))},{immediate:!1});return se(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?D():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,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},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?Ai:yS(n=>se(()=>{this.subscribe(e,r=>Al(n,r),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(wk(I$),ef(n=>n._tag==="Success"?v(n.value):ct(n.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0;for(let t=e.length-1;t>=0;t--)e[t]()}},wte=e=>{function t(n){if(t.disposed)return e.registry.get(n);if(t.isFn)return e.registry.get(n);let r=e.registry.ensureNode(n),o=r.value();return e.addParent(r),o}return Object.setPrototypeOf(t,bte),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t},EC=class{constructor(t,n){this.registry=t,this.node=n}registry;node;get(t){return this.registry.get(t)}set(t,n){return this.registry.set(t,n)}setSelf(t){return this.node.setValue(t)}refreshSelf(){return this.node.invalidate()}},Fi={disabled:0,collect:1,commit:2},Qt={phase:Fi.disabled,depth:0,stale:[],notify:new Set};function C$(e){Qt.phase=Fi.collect,Qt.depth++;try{if(e(),Qt.depth===1){for(let t=0;t<Qt.stale.length;t++)A$(Qt.stale[t]);Qt.phase=Fi.commit;for(let t of Qt.notify)t.notify();Qt.notify.clear()}}finally{Qt.depth--,Qt.depth===0&&(Qt.phase=Fi.disabled,Qt.stale=[])}}function A$(e){if(e.state===Dr.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=Dr.stale,e.disposeLifetime()}for(let t of e.parents)t.state!==Dr.valid&&A$(t);e.state!==Dr.valid&&e.value()}var mh={};rs(mh,{ConnectionHooks:()=>ph,CurrentHeaders:()=>_E,Protocol:()=>Bi,layerProtocolHttp:()=>Xre,layerProtocolSocket:()=>noe,layerProtocolWorker:()=>roe,make:()=>EA,makeNoSerialization:()=>TH,makeProtocolHttp:()=>kH,makeProtocolSocket:()=>CH,makeProtocolWorker:()=>AH,withHeaders:()=>Yre});var Vm=class extends Ve()("effect/workers/Transferable/Collector"){},O$=()=>{let e=[],t=o=>{e.push(...o)},n=()=>e,r=()=>{let o=e;return e=[],o};return Vm.of({addAllUnsafe:t,addAll:o=>se(()=>t(o)),readUnsafe:n,read:se(n),clearUnsafe:r,clear:se(r)})};var bC="~effect/workers/WorkerError";var wC=class extends $n("effect/workers/WorkerError/WorkerSpawnError")({_tag:Ze("WorkerSpawnError"),message:fe,cause:Pt(ln())}){},IC=class extends $n("effect/workers/WorkerError/WorkerSendError")({_tag:Ze("WorkerSendError"),message:fe,cause:Pt(ln())}){},vC=class extends $n("effect/workers/WorkerError/WorkerReceiveError")({_tag:Ze("WorkerReceiveError"),message:fe,cause:Pt(ln())}){},TC=class extends $n("effect/workers/WorkerError/WorkerUnknownError")({_tag:Ze("WorkerUnknownError"),message:fe,cause:Pt(ln())}){},kC=He([wC,IC,vC,TC]),_$=class extends $n(bC)({_tag:Ze("WorkerError"),reason:kC}){constructor(t){super({...t,cause:t.reason.cause})}[bC]=bC;get message(){return this.reason.message}};var XS=class extends Ve()("effect/workers/Worker/WorkerPlatform"){};var _c={};rs(_c,{ServerClient:()=>OC,custom:()=>Ate,exitSchema:()=>_C,fork:()=>_te,isRpc:()=>kte,isWrapper:()=>id,make:()=>P$,uninterruptible:()=>Mte,unwrap:()=>Rte,wrap:()=>nE,wrapMap:()=>Ote});var CC="~effect/rpc/RpcSchema/StreamSchema";function Km(e){return q(e,CC)}function eE(e){return Km(e)?L({success:e.success,error:e.error}):D()}var Tte=ro(Ue);function M$(e,t){return re(Tte.ast,{[CC]:CC,success:e,error:t})}var RC="~effect/rpc/Rpc",kte=e=>q(e,RC),OC=class{id;annotations;constructor(t){this.id=t,this.annotations=bt()}annotate(t,n){return this.annotations=Ke(this.annotations,t,n),this}},Cte={[RC]:RC,pipe(){return ie(this,arguments)},setSuccess(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return Oc({_tag:this._tag,payloadSchema:Gu(e)?e:oe(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return Oc({_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 Oc({_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 Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Ke(this.annotations,e,t)})},annotateMerge(e){return Oc({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:br(this.annotations,e)})}},Oc=e=>{function t(){}return Object.setPrototypeOf(t,Cte),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},P$=(e,t)=>{let n=t?.success??Jl,r=t?.error??Ic,o=t?.defect??ln(),s;return t?.primaryKey?s=class extends hS(`effect/rpc/Rpc/${e}`)(t.payload){[aj](){return t.primaryKey(this)}}:s=Gu(t?.payload)?t?.payload:t?.payload?oe(t?.payload):Jl,Oc({_tag:e,payloadSchema:s,successSchema:t?.stream?M$(n,r):n,errorSchema:t?.stream?Ic:r,defectSchema:o,annotations:bt(),middlewares:new Set})},Ate=e=>(t,n)=>{let r=n?.success??Jl,o=n?.error??Ic,s=n?.defect??ln(),i=e({success:r,error:o,defect:s});return P$(t,{...i,primaryKey:n?.primaryKey,payload:n?.payload,stream:n?.stream})},AC=new WeakMap,_C=e=>{if(AC.has(e))return AC.get(e);let t=e,n=new Set([t.errorSchema]),r=eE(t.successSchema);Te(r)&&n.add(r.value.error);for(let s of t.middlewares)n.add(s.error);let o=pS(Te(r)?Jl:t.successSchema,He([...n]),t.defectSchema);return AC.set(e,o),o},Jm="~effect/rpc/Rpc/Wrapper",id=e=>Jm in e,nE=e=>t=>id(t)?{[Jm]:Jm,value:t.value,fork:e.fork??t.fork,uninterruptible:e.uninterruptible??t.uninterruptible}:{[Jm]:Jm,value:t,fork:e.fork??!1,uninterruptible:e.uninterruptible??!1},Rte=e=>id(e)?e.value:e,Ote=(e,t)=>id(e)?nE(e)(t(e.value)):t(e),_te=nE({fork:!0}),Mte=nE({uninterruptible:!0});var MC="~effect/rpc/RpcClientError",Mc=class extends $n("effect/rpc/RpcClientError/RpcClientDefect")({_tag:Ze("RpcClientDefect"),message:fe,cause:ln()}){},Ws=class extends $n(MC)({_tag:Ze("RpcClientError"),reason:He([kC,fC,ed,Mc])}){[MC]=MC;get message(){return`${this.reason._tag}: ${this.reason.message}`}};var Zm=e=>e;var F$={_tag:"Ping"};var Gm=He([fe,Kl]),Fte=oe({_tag:Ze("Request"),id:Gm,tag:fe,payload:Zo,headers:Wt(bc([fe,fe])),isNotification:Pt(Rt(!0)),traceId:Pt(fe),spanId:Pt(fe),sampled:Pt(vc)}),PC=He([Fte,oe({_tag:Ze("Ack"),requestId:Gm}),oe({_tag:Ze("Interrupt"),requestId:Gm}),oe({_tag:Ze("Ping")}),oe({_tag:Ze("Eof")}),oe({_tag:Ze("Chunk"),requestId:Gm,values:Zo}),oe({_tag:Ze("Exit"),requestId:Gm,exit:Zo}),oe({_tag:Ze("Defect"),defect:Zo}),oe({_tag:Ze("Pong")})]);var FC=e=>{switch(e._tag){case"Exit":case"Defect":case"ClientProtocolError":return!0;default:return!1}};var dh={};rs(dh,{MaxBufferSizeExceeded:()=>fh,RpcSerialization:()=>En,json:()=>gH,jsonRpc:()=>yH,layerJson:()=>Bre,layerJsonRpc:()=>$re,layerMsgPack:()=>Hre,layerMsgPackWith:()=>Wre,layerNdJsonRpc:()=>zre,layerNdjson:()=>qre,layerNdjsonWith:()=>jre,layerSchemaBinary:()=>Vre,makeMsgPack:()=>SA,makeNdjson:()=>RE,msgPack:()=>wH,ndJsonRpc:()=>SH,ndjson:()=>xH});var DC;try{DC=new TextDecoder}catch{}var Z,oo,I=0;var V$=[],NC=V$,LC=0,mt={},We,Pc,es=0,Ui=0,Wn,_a,so=[],je,D$={useRecords:!1,mapsAsObjects:!0},Qm=class{},qC=new Qm;qC.name="MessagePack 0xC1";var Fc=!1,N$=2;var Di=class e{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,n){if(Z)return Q$(()=>(oE(),this?this.unpack(t,n):e.prototype.unpack.call(D$,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof n=="object"?(oo=n.end||t.length,I=n.start||0):(I=0,oo=n>-1?n:t.length),LC=0,Ui=0,Pc=null,NC=V$,Wn=null,Z=t;try{je=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw Z=null,t instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof e){if(mt=this,this.structures)return We=this.structures,rE(n);(!We||We.length>0)&&(We=[])}else mt=D$,(!We||We.length>0)&&(We=[]);return rE(n)}unpackMultiple(t,n){let r,o=0;try{Fc=!0;let s=t.length,i=this?this.unpack(t,s):iE.unpack(t,s);if(n){if(n(i,o,I)===!1)return;for(;I<s;)if(o=I,n(rE(),o,I)===!1)return}else{for(r=[i];I<s;)o=I,r.push(rE());return r}}catch(s){throw s.lastPosition=o,s.values=r,s}finally{Fc=!1,oE()}}_mergeStructures(t,n){this._onLoadedStructures&&(t=this._onLoadedStructures(t)),t=t||[],Object.isFrozen(t)&&(t=t.map(r=>r.slice(0)));for(let r=0,o=t.length;r<o;r++){let s=t[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}t.sharedLength=t.length;for(let r in n||[])if(r>=0){let o=t[r],s=n[r];s&&(o&&((t.restoreStructures||(t.restoreStructures=[]))[r]=o),t[r]=s)}return this.structures=t}decode(t,n){return this.unpack(t,n)}};function rE(e){try{if(!mt.trusted&&!Fc){let n=We.sharedLength||0;n<We.length&&(We.length=n)}let t;if(mt._readStruct&&Z[I]<64&&Z[I]>=32?(t=mt._readStruct(Z,I,oo),Z=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),I=oo):t=dn(),Wn&&(I=Wn.postBundlePosition,Wn=null),Fc&&(We.restoreStructures=null),I==oo)We&&We.restoreStructures&&L$(),We=null,Z=null,_a&&(_a=null);else{if(I>oo)throw new Error("Unexpected end of MessagePack data");if(!Fc){let n;try{n=JSON.stringify(t,(r,o)=>typeof o=="bigint"?`${o}n`:o).slice(0,100)}catch(r){n="(JSON view not available "+r+")"}throw new Error("Data read, but end of buffer not reached "+n)}}return t}catch(t){throw We&&We.restoreStructures&&L$(),oE(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||I>oo)&&(t.incomplete=!0),t}}function L$(){for(let e in We.restoreStructures)We[e]=We.restoreStructures[e];We.restoreStructures=null}function dn(){let e=Z[I++];if(e<160)if(e<128){if(e<64)return e;{let t=We[e&63]||mt.getStructures&&K$()[e&63];return t?(t.read||(t.read=jC(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,mt.mapsAsObjects){let t={};for(let n=0;n<e;n++){let r=G$();r==="__proto__"&&(r="__proto_"),t[r]=dn()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(dn(),dn());return t}else{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=dn();return mt.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(Ui>=I)return Pc.slice(I-es,(I+=t)-es);if(Ui==0&&oo<140){let n=t<16?zC(t):J$(t);if(n!=null)return n}return BC(t)}else{let t;switch(e){case 192:return null;case 193:return Wn?(t=dn(),t>0?Wn[1].slice(Wn.position1,Wn.position1+=t):Wn[0].slice(Wn.position0,Wn.position0-=t)):qC;case 194:return!1;case 195:return!0;case 196:if(t=Z[I++],t===void 0)throw new Error("Unexpected end of buffer");return UC(t);case 197:return t=je.getUint16(I),I+=2,UC(t);case 198:return t=je.getUint32(I),I+=4,UC(t);case 199:return rf(Z[I++]);case 200:return t=je.getUint16(I),I+=2,rf(t);case 201:return t=je.getUint32(I),I+=4,rf(t);case 202:if(t=je.getFloat32(I),mt.useFloat32>2){let n=sE[(Z[I]&127)<<1|Z[I+1]>>7];return I+=4,(n*t+(t>0?.5:-.5)>>0)/n}return I+=4,t;case 203:return t=je.getFloat64(I),I+=8,t;case 204:return Z[I++];case 205:return t=je.getUint16(I),I+=2,t;case 206:return t=je.getUint32(I),I+=4,t;case 207:return mt.int64AsType==="number"?(t=je.getUint32(I)*4294967296,t+=je.getUint32(I+4)):mt.int64AsType==="string"?t=je.getBigUint64(I).toString():mt.int64AsType==="auto"?(t=je.getBigUint64(I),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigUint64(I),I+=8,t;case 208:return je.getInt8(I++);case 209:return t=je.getInt16(I),I+=2,t;case 210:return t=je.getInt32(I),I+=4,t;case 211:return mt.int64AsType==="number"?(t=je.getInt32(I)*4294967296,t+=je.getUint32(I+4)):mt.int64AsType==="string"?t=je.getBigInt64(I).toString():mt.int64AsType==="auto"?(t=je.getBigInt64(I),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigInt64(I),I+=8,t;case 212:if(t=Z[I++],t==114)return H$(Z[I++]&63);{let n=so[t];if(n)return n.read?(I++,n.read(dn())):n.noBuffer?(I++,n()):n(Z.subarray(I,++I));throw new Error("Unknown extension "+t)}case 213:return t=Z[I],t==114?(I++,H$(Z[I++]&63,Z[I++])):rf(2);case 214:return rf(4);case 215:return rf(8);case 216:return rf(16);case 217:return t=Z[I++],Ui>=I?Pc.slice(I-es,(I+=t)-es):Dte(t);case 218:return t=je.getUint16(I),I+=2,Ui>=I?Pc.slice(I-es,(I+=t)-es):Nte(t);case 219:return t=je.getUint32(I),I+=4,Ui>=I?Pc.slice(I-es,(I+=t)-es):Lte(t);case 220:return t=je.getUint16(I),I+=2,q$(t);case 221:return t=je.getUint32(I),I+=4,q$(t);case 222:return t=je.getUint16(I),I+=2,j$(t);case 223:return t=je.getUint32(I),I+=4,j$(t);default:if(e>=224)return e-256;throw e===void 0?$C():new Error("Unknown MessagePack token "+e)}}}var Ute=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function jC(e,t){function n(){if(n.count++>N$){let o;try{o=e.read=new Function("r","return function(){return "+(mt.freezeData?"Object.freeze":"")+"({"+e.map(s=>s==="__proto__"?"__proto_:r()":Ute.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(dn)}catch{return N$=1/0,n()}return e.read0=o,e.highByte===0&&(e.read=B$(t,e.read)),o()}let r={};for(let o=0,s=e.length;o<s;o++){let i=e[o];i==="__proto__"&&(i="__proto_"),r[i]=dn()}return mt.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?B$(t,n):n}var B$=(e,t)=>function(){let n=Z[I++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),o=We[r]||K$()[r];if(!o)throw new Error("Record id is not defined for "+r);return o.read||(o.read=jC(o,e)),o.read()};function K$(){let e=Q$(()=>(Z=null,mt.getStructures()));return We=mt._mergeStructures(e,We)}var BC=Ym,Dte=Ym,Nte=Ym,Lte=Ym;function Ym(e){let t;if(e<16&&(t=zC(e)))return t;if(e>64&&DC)return DC.decode(Z.subarray(I,I+=e));let n=I+e,r=[];for(t="";I<n;){let o=Z[I++];if((o&128)===0)r.push(o);else if((o&224)===192)if(o<194||I>=n||(Z[I]&192)!==128)r.push(65533);else{let s=Z[I++]&63;r.push((o&31)<<6|s)}else if((o&240)===224){let s=I<n?Z[I]:0;if(I>=n||(s&192)!==128||o===224&&s<160||o===237&&s>=160)r.push(65533);else if(I++,I>=n||(Z[I]&192)!==128)r.push(65533);else{let i=Z[I++]&63;r.push((o&31)<<12|(s&63)<<6|i)}}else if((o&248)===240){let s=I<n?Z[I]:0;if(o>244||I>=n||(s&192)!==128||o===240&&s<144||o===244&&s>=144)r.push(65533);else if(I++,I>=n||(Z[I]&192)!==128)r.push(65533);else{let i=Z[I++]&63;if(I>=n||(Z[I]&192)!==128)r.push(65533);else{let a=Z[I++]&63,c=(o&7)<<18|(s&63)<<12|i<<6|a;c-=65536,r.push(c>>>10&1023|55296),r.push(56320|c&1023)}}}else r.push(65533);r.length>=4096&&(t+=Hn.apply(String,r),r.length=0)}return r.length>0&&(t+=Hn.apply(String,r)),t}function $C(){let e=new Error("Unexpected end of MessagePack data");return e.incomplete=!0,e}function q$(e){if(e>oo-I)throw $C();let t=new Array(e);for(let n=0;n<e;n++)t[n]=dn();return mt.freezeData?Object.freeze(t):t}function j$(e){if(e>(oo-I)/2)throw $C();if(mt.mapsAsObjects){let t={};for(let n=0;n<e;n++){let r=G$();r==="__proto__"&&(r="__proto_"),t[r]=dn()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(dn(),dn());return t}}var Hn=String.fromCharCode;function J$(e){let t=I,n=new Array(e);for(let r=0;r<e;r++){let o=Z[I++];if((o&128)>0){I=t;return}n[r]=o}return Hn.apply(String,n)}function zC(e){if(e<4)if(e<2){if(e===0)return"";{let t=Z[I++];if((t&128)>1){I-=1;return}return Hn(t)}}else{let t=Z[I++],n=Z[I++];if((t&128)>0||(n&128)>0){I-=2;return}if(e<3)return Hn(t,n);let r=Z[I++];if((r&128)>0){I-=3;return}return Hn(t,n,r)}else{let t=Z[I++],n=Z[I++],r=Z[I++],o=Z[I++];if((t&128)>0||(n&128)>0||(r&128)>0||(o&128)>0){I-=4;return}if(e<6){if(e===4)return Hn(t,n,r,o);{let s=Z[I++];if((s&128)>0){I-=5;return}return Hn(t,n,r,o,s)}}else if(e<8){let s=Z[I++],i=Z[I++];if((s&128)>0||(i&128)>0){I-=6;return}if(e<7)return Hn(t,n,r,o,s,i);let a=Z[I++];if((a&128)>0){I-=7;return}return Hn(t,n,r,o,s,i,a)}else{let s=Z[I++],i=Z[I++],a=Z[I++],c=Z[I++];if((s&128)>0||(i&128)>0||(a&128)>0||(c&128)>0){I-=8;return}if(e<10){if(e===8)return Hn(t,n,r,o,s,i,a,c);{let u=Z[I++];if((u&128)>0){I-=9;return}return Hn(t,n,r,o,s,i,a,c,u)}}else if(e<12){let u=Z[I++],f=Z[I++];if((u&128)>0||(f&128)>0){I-=10;return}if(e<11)return Hn(t,n,r,o,s,i,a,c,u,f);let l=Z[I++];if((l&128)>0){I-=11;return}return Hn(t,n,r,o,s,i,a,c,u,f,l)}else{let u=Z[I++],f=Z[I++],l=Z[I++],p=Z[I++];if((u&128)>0||(f&128)>0||(l&128)>0||(p&128)>0){I-=12;return}if(e<14){if(e===12)return Hn(t,n,r,o,s,i,a,c,u,f,l,p);{let m=Z[I++];if((m&128)>0){I-=13;return}return Hn(t,n,r,o,s,i,a,c,u,f,l,p,m)}}else{let m=Z[I++],h=Z[I++];if((m&128)>0||(h&128)>0){I-=14;return}if(e<15)return Hn(t,n,r,o,s,i,a,c,u,f,l,p,m,h);let g=Z[I++];if((g&128)>0){I-=15;return}return Hn(t,n,r,o,s,i,a,c,u,f,l,p,m,h,g)}}}}}function $$(){let e=Z[I++],t;if(e<192)t=e-160;else switch(e){case 217:t=Z[I++];break;case 218:t=je.getUint16(I),I+=2;break;case 219:t=je.getUint32(I),I+=4;break;default:throw new Error("Expected string")}return Ym(t)}function UC(e){return mt.copyBuffers?Uint8Array.prototype.slice.call(Z,I,I+=e):Z.subarray(I,I+=e)}function rf(e){let t=Z[I++];if(so[t]){let n;return so[t](Z.subarray(I,n=I+=e),r=>{I=r;try{return dn()}finally{I=n}})}else throw new Error("Unknown extension type "+t)}var z$=new Array(4096);function G$(){let e=Z[I++];if(e>=160&&e<192){if(e=e-160,Ui>=I)return Pc.slice(I-es,(I+=e)-es);if(!(Ui==0&&oo<180))return BC(e)}else return I--,Z$(dn());let t=(e<<5^(e>1?je.getUint16(I):e>0?Z[I]:0))&4095,n=z$[t],r=I,o=I+e-3,s,i=0;if(n&&n.bytes==e){for(;r<o;){if(s=je.getUint32(r),s!=n[i++]){r=1879048192;break}r+=4}for(o+=3;r<o;)if(s=Z[r++],s!=n[i++]){r=1879048192;break}if(r===o)return I=r,n.string;o-=3,r=I}for(n=[],z$[t]=n,n.bytes=e;r<o;)s=je.getUint32(r),n.push(s),r+=4;for(o+=3;r<o;)s=Z[r++],n.push(s);let a=e<16?zC(e):J$(e);return a!=null?n.string=a:n.string=BC(e)}function Z$(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(mt.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error(`Invalid property type for record: ${typeof e}`)}var H$=(e,t)=>{let n=dn().map(Z$),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let o=We[e];return o&&(o.isShared||Fc)&&((We.restoreStructures||(We.restoreStructures=[]))[e]=o),We[e]=n,n.read=jC(n,r),(n.read0||n.read)()};so[0]=()=>{};so[0].noBuffer=!0;so[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=(s,i)=>{let a=i-s;if(a<=40){let l=r.getBigUint64(s);for(let p=s+8;p<i;p+=8)l<<=BigInt(64),l|=r.getBigUint64(p);return l}let c=s+(a>>4<<3),u=o(s,c),f=o(c,i);return u<<BigInt((i-c)*8)|f};n=n<<BigInt((r.byteLength-t)*8)|o(t,r.byteLength)}return n};var W$={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};so[101]=()=>{let e=dn();if(!W$[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return W$[e[0]](e[1],{cause:e[2]})};so[105]=e=>{if(mt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(I-4);_a||(_a=new Map);let n=Z[I],r;n>=144&&n<160||n==220||n==221?r=[]:n>=128&&n<144||n==222||n==223?r=new Map:(n>=199&&n<=201||n>=212&&n<=216)&&Z[I+1]===115?r=new Set:r={};let o={target:r};_a.set(t,o);let s=dn();if(o.used)Object.assign(r,s);else return o.target=s;if(r instanceof Map)for(let[i,a]of s.entries())r.set(i,a);if(r instanceof Set)for(let i of Array.from(s))r.add(i);return r};so[112]=e=>{if(mt.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(I-4),n=_a.get(t);return n.used=!0,n.target};so[115]=()=>new Set(dn());var HC=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array"),Bte=typeof globalThis=="object"?globalThis:window;so[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=HC[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw new Error("Could not find typed array for code "+t)}return new Bte[r](n)};so[120]=()=>{let e=dn();return new RegExp(e[0],e[1])};var qte=[];so[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=I;return I+=t-e.length,Wn=qte,Wn=[$$(),$$()],Wn.position0=0,Wn.position1=0,Wn.postBundlePosition=I,I=n,dn()};so[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function Q$(e){mt&&mt._onSaveState&&mt._onSaveState();let t=oo,n=I,r=LC,o=es,s=Ui,i=Pc,a=NC,c=_a,u=Wn,f=new Uint8Array(Z.slice(0,oo)),l=We,p=We.slice(0,We.length),m=mt,h=Fc,g=e();return oo=t,I=n,LC=r,es=o,Ui=s,Pc=i,NC=a,_a=c,Wn=u,Z=f,Fc=h,We=l,We.splice(0,We.length,...p),mt=m,je=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),g}function oE(){Z=null,_a=null,We=null}var sE=new Array(147);for(let e=0;e<256;e++)sE[e]=+("1e"+Math.floor(45.15-e*.30103));var iE=new Di({useRecords:!1}),jte=iE.unpack,$te=iE.unpackMultiple,zte=iE.unpack,aE={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Hte=new Float32Array(1),ime=new Uint8Array(Hte.buffer,0,4);Di.SUPPORTS_STRUCT_HOOKS=!0;var uE;try{uE=new TextEncoder}catch{}var KC,JC,cd=typeof Buffer<"u",cE=cd?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,tz=cd?Buffer:Uint8Array,Y$=cd?4294967296:2144337920,_,Xm,Ot,C=0,gr,Yt=null,Wte=21760,Vte=/[\u0080-\uFFFF]/,ad=Symbol("record-id"),Uc=class extends Di{constructor(t){super(t),this.offset=0;let n,r,o,s,i,a=tz.prototype.utf8Write?function(T,z){return _.utf8Write(T,z,_.byteLength-z)}:uE&&uE.encodeInto?function(T,z){return uE.encodeInto(T,_.subarray(z)).written}:!1,c=this;t||(t={});let u=t&&t.sequential,f=t.structures||t.saveStructures,l=t.maxSharedStructures;if(l==null&&(l=f?32:0),l>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=f?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let m=l>32||p+l>64,h=l+64,g=l+p+64;if(g>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],b=0,E=0;this.pack=this.encode=function(T,z){if(_||(_=new cE(8192),Ot=_.dataView||(_.dataView=new DataView(_.buffer,0,8192)),C=0),gr=_.length-10,gr-C<2048?(_=new cE(_.length),Ot=_.dataView||(_.dataView=new DataView(_.buffer,0,_.length)),gr=_.length-10,C=0):C=C+7&2147483640,r=C,z&sz&&(C+=z&255),i=c.structuredClone?new Map:null,c.bundleStrings&&typeof T!="string"?(Yt=[],Yt.size=1/0):Yt=null,s=c.structures,s){s.uninitialized&&(s=c._mergeStructures(c.getStructures()));let N=s.sharedLength||0;if(N>l)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let K=0;K<N;K++){let be=s[K];if(!be)continue;let Ie,de=s.transitions;for(let ut=0,Et=be.length;ut<Et;ut++){let Ks=be[ut];Ie=de[Ks],Ie||(Ie=de[Ks]=Object.create(null)),de=Ie}de[ad]=K+64}this.lastNamedStructuresLength=N}u||(s.nextId=N+64)}o&&(o=!1);let U;try{c._writeStruct&&T&&typeof T=="object"?T.constructor===Object?$(T):T.constructor!==Map&&!Array.isArray(T)&&!JC.some(K=>T instanceof K)?$(c.useToJSON!==!1&&T.toJSON?T.toJSON():T):S(T):S(T);let N=Yt;if(Yt&&ez(r,S,0),i&&i.idsToInsert){let K=i.idsToInsert.sort((ut,Et)=>ut.offset>Et.offset?1:-1),be=K.length,Ie=-1;for(;N&&be>0;){let ut=K[--be].offset+r;ut<N.stringsPosition+r&&Ie===-1&&(Ie=0),ut>N.position+r?Ie>=0&&(Ie+=6):(Ie>=0&&(Ot.setUint32(N.position+r,Ot.getUint32(N.position+r)+Ie),Ie=-1),N=N.previous,be++)}Ie>=0&&N&&Ot.setUint32(N.position+r,Ot.getUint32(N.position+r)+Ie),C+=K.length*6,C>gr&&F(C),c.offset=C;let de=Kte(_.subarray(r,C),K);return i=null,de}return c.offset=C,z&rz?(_.start=r,_.end=C,_):_.subarray(r,C)}catch(N){throw U=N,N}finally{if(s&&(x(),o&&c.saveStructures)){let N=s.sharedLength||0,K=_.subarray(r,C),be=(c._prepareStructures||Jte)(s,c);if(!U)return c.saveStructures(be,be.isCompatible)===!1?(s.uninitialized=!0,c.pack(T,z)):(c.lastNamedStructuresLength=N,_.length>1073741824&&(_=null),K)}_.length>1073741824&&(_=null),z&oz&&(C=r)}};let x=()=>{E<10&&E++;let T=s.sharedLength||0;if(s.length>T&&!u&&(s.length=T),b>1e4)s.transitions=null,E=0,b=0,y.length>0&&(y=[]);else if(y.length>0&&!u){for(let z=0,U=y.length;z<U;z++)y[z][ad]=0;y=[]}},w=T=>{var z=T.length;z<16?_[C++]=144|z:z<65536?(_[C++]=220,_[C++]=z>>8,_[C++]=z&255):(_[C++]=221,Ot.setUint32(C,z),C+=4);for(let U=0;U<z;U++)S(T[U])},S=T=>{C>gr&&(_=F(C));var z=typeof T,U;if(z==="string"){let N=T.length;if(Yt&&N>=4&&N<4096){if((Yt.size+=N)>Wte){let de,ut=(Yt[0]?Yt[0].length*3+Yt[1].length:0)+10;C+ut>gr&&(_=F(C+ut));let Et;Yt.position?(Et=Yt,_[C]=200,C+=3,_[C++]=98,de=C-r,C+=4,ez(r,S,0),Ot.setUint16(de+r-3,C-r-de)):(_[C++]=214,_[C++]=98,de=C-r,C+=4),Yt=["",""],Yt.previous=Et,Yt.size=0,Yt.position=de}let Ie=Vte.test(T);Yt[Ie?0:1]+=T,_[C++]=193,S(Ie?-N:N);return}let K;N<32?K=1:N<256?K=2:N<65536?K=3:K=5;let be=N*3;if(C+be>gr&&(_=F(C+be)),N<64||!a){let Ie,de,ut,Et=C+K;for(Ie=0;Ie<N;Ie++)de=T.charCodeAt(Ie),de<128?_[Et++]=de:de<2048?(_[Et++]=de>>6|192,_[Et++]=de&63|128):(de&64512)===55296&&((ut=T.charCodeAt(Ie+1))&64512)===56320?(de=65536+((de&1023)<<10)+(ut&1023),Ie++,_[Et++]=de>>18|240,_[Et++]=de>>12&63|128,_[Et++]=de>>6&63|128,_[Et++]=de&63|128):(_[Et++]=de>>12|224,_[Et++]=de>>6&63|128,_[Et++]=de&63|128);U=Et-C-K}else U=a(T,C+K);U<32?_[C++]=160|U:U<256?(K<2&&_.copyWithin(C+2,C+1,C+1+U),_[C++]=217,_[C++]=U):U<65536?(K<3&&_.copyWithin(C+3,C+2,C+2+U),_[C++]=218,_[C++]=U>>8,_[C++]=U&255):(K<5&&_.copyWithin(C+5,C+3,C+3+U),_[C++]=219,Ot.setUint32(C,U),C+=4),C+=U}else if(z==="number")if(T>>>0===T)T<32||T<128&&this.useRecords===!1||T<64&&!this._writeStruct?_[C++]=T:T<256?(_[C++]=204,_[C++]=T):T<65536?(_[C++]=205,_[C++]=T>>8,_[C++]=T&255):(_[C++]=206,Ot.setUint32(C,T),C+=4);else if(T>>0===T)T>=-32?_[C++]=256+T:T>=-128?(_[C++]=208,_[C++]=T+256):T>=-32768?(_[C++]=209,Ot.setInt16(C,T),C+=2):(_[C++]=210,Ot.setInt32(C,T),C+=4);else{let N;if((N=this.useFloat32)>0&&T<4294967296&&T>=-2147483648){_[C++]=202,Ot.setFloat32(C,T);let K;if(N<4||(K=T*sE[(_[C]&127)<<1|_[C+1]>>7])>>0===K){C+=4;return}else C--}_[C++]=203,Ot.setFloat64(C,T),C+=8}else if(z==="object"||z==="function")if(!T)_[C++]=192;else{if(i){let K=i.get(T);if(K){if(!K.id){let be=i.idsToInsert||(i.idsToInsert=[]);K.id=be.push(K)}_[C++]=214,_[C++]=112,Ot.setUint32(C,K.id),C+=4;return}else i.set(T,{offset:C-r})}let N=T.constructor;if(N===Object)P(T);else if(N===Array)w(T);else if(N===Map)if(this.mapAsEmptyObject)_[C++]=128;else{U=T.size,U<16?_[C++]=128|U:U<65536?(_[C++]=222,_[C++]=U>>8,_[C++]=U&255):(_[C++]=223,Ot.setUint32(C,U),C+=4);for(let[K,be]of T)S(K),S(be)}else{for(let K=0,be=KC.length;K<be;K++){let Ie=JC[K];if(T instanceof Ie){let de=KC[K];if(de.write){de.type&&(_[C++]=212,_[C++]=de.type,_[C++]=0);let dd=de.write.call(this,T);dd===T?Array.isArray(T)?w(T):P(T):S(dd);return}let ut=_,Et=Ot,Ks=C;_=null;let Pa;try{Pa=de.pack.call(this,T,dd=>(_=ut,ut=null,C+=dd,C>gr&&F(C),{target:_,targetView:Ot,position:C-dd}),S)}finally{ut&&(_=ut,Ot=Et,C=Ks,gr=_.length-10)}Pa&&(Pa.length+C>gr&&F(Pa.length+C),C=X$(Pa,_,C,de.type));return}}if(Array.isArray(T))w(T);else{if(c.useToJSON!==!1&&T.toJSON){let K=T.toJSON();if(K!==T)return S(K)}if(z==="function")return S(this.writeFunction&&this.writeFunction(T));P(T)}}}else if(z==="boolean")_[C++]=T?195:194;else if(z==="bigint"){if(T<9223372036854776e3&&T>=-9223372036854776e3)_[C++]=211,Ot.setBigInt64(C,T);else if(T<18446744073709552e3&&T>0)_[C++]=207,Ot.setBigUint64(C,T);else if(this.largeBigIntToFloat)_[C++]=203,Ot.setFloat64(C,Number(T));else{if(this.largeBigIntToString)return S(T.toString());if(this.useBigIntExtension||this.moreTypes){let N=T<0?BigInt(-1):BigInt(0),K;if(T>>BigInt(65536)===N){let be=BigInt(18446744073709552e3)-BigInt(1),Ie=[];for(;Ie.push(T&be),T>>BigInt(63)!==N;)T>>=BigInt(64);K=new Uint8Array(new BigUint64Array(Ie).buffer),K.reverse()}else{let be=T<0,Ie=(be?~T:T).toString(16);if(Ie.length%2?Ie="0"+Ie:parseInt(Ie.charAt(0),16)>=8&&(Ie="00"+Ie),cd)K=Buffer.from(Ie,"hex");else{K=new Uint8Array(Ie.length/2);for(let de=0;de<K.length;de++)K[de]=parseInt(Ie.slice(de*2,de*2+2),16)}if(be)for(let de=0;de<K.length;de++)K[de]=~K[de]}K.length+C>gr&&F(K.length+C),C=X$(K,_,C,66);return}else throw new RangeError(T+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}C+=8}else if(z==="undefined")this.encodeUndefinedAsNil?_[C++]=192:(_[C++]=212,_[C++]=0,_[C++]=0);else throw new Error("Unknown type: "+z)},A=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?T=>{let z;if(this.skipValues){z=[];for(let K in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(K))&&!this.skipValues.includes(T[K])&&z.push(K)}else z=Object.keys(T);let U=z.length;U<16?_[C++]=128|U:U<65536?(_[C++]=222,_[C++]=U>>8,_[C++]=U&255):(_[C++]=223,Ot.setUint32(C,U),C+=4);let N;if(this.coercibleKeyAsNumber)for(let K=0;K<U;K++){N=z[K];let be=Number(N);S(isNaN(be)?N:be),S(T[N])}else for(let K=0;K<U;K++)S(N=z[K]),S(T[N])}:T=>{_[C++]=222;let z=C-r;C+=2;let U=0;for(let N in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(N))&&(S(N),S(T[N]),U++);if(U>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');_[z+++r]=U>>8,_[z+r]=U&255},M=this.useRecords===!1?A:t.progressiveRecords&&!m?T=>{let z,U=s.transitions||(s.transitions=Object.create(null)),N=C++-r,K;for(let be in T)if(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(be)){if(z=U[be],z)U=z;else{let Ie=Object.keys(T),de=U;U=s.transitions;let ut=0;for(let Et=0,Ks=Ie.length;Et<Ks;Et++){let Pa=Ie[Et];z=U[Pa],z||(z=U[Pa]=Object.create(null),ut++),U=z}N+r+1==C?(C--,te(U,Ie,ut)):ee(U,Ie,N,ut),K=!0,U=de[be]}S(T[be])}if(!K){let be=U[ad];be?_[N+r]=be:ee(U,Object.keys(T),N,0)}}:T=>{let z,U=s.transitions||(s.transitions=Object.create(null)),N=0;for(let be in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(be))&&(z=U[be],z||(z=U[be]=Object.create(null),N++),U=z);let K=U[ad];K?K>=96&&m?(_[C++]=((K-=96)&31)+96,_[C++]=K>>5):_[C++]=K:te(U,U.__keys__||Object.keys(T),N);for(let be in T)(typeof T.hasOwnProperty!="function"||T.hasOwnProperty(be))&&S(T[be])},R=typeof this.useRecords=="function"&&this.useRecords,P=R?T=>{R(T)?M(T):A(T)}:M,$=T=>{let z=c._writeStruct(T,_,r,C,s,F,(U,N,K)=>{if(K)return o=!0;C=N;let be=_;return S(U),x(),be!==_?{position:C,targetView:Ot,target:_}:C});if(z===0)return P(T);C=z},F=T=>{let z;if(T>16777216){if(T-r>Y$)throw new Error("Packed buffer would be larger than maximum buffer size");z=Math.min(Y$,Math.round(Math.max((T-r)*(T>67108864?1.25:2),4194304)/4096)*4096)}else z=(Math.max(T-r<<2,_.length-1)>>12)+1<<12;let U=new cE(z);return Ot=U.dataView||(U.dataView=new DataView(U.buffer,0,z)),T=Math.min(T,_.length),_.copy?_.copy(U,0,r,T):U.set(_.slice(r,T)),C-=r,r=0,gr=U.length-10,_=U},te=(T,z,U)=>{let N=s.nextId;N||(N=64),N<h&&this.shouldShareStructure&&!this.shouldShareStructure(z)?(N=s.nextOwnId,N<g||(N=h),s.nextOwnId=N+1):(N>=g&&(N=h),s.nextId=N+1);let K=z.highByte=N>=96&&m?N-96>>5:-1;T[ad]=N,T.__keys__=z,s[N-64]=z,N<h?(z.isShared=!0,s.sharedLength=N-63,o=!0,K>=0?(_[C++]=(N&31)+96,_[C++]=K):_[C++]=N):(K>=0?(_[C++]=213,_[C++]=114,_[C++]=(N&31)+96,_[C++]=K):(_[C++]=212,_[C++]=114,_[C++]=N),U&&(b+=E*U),y.length>=p&&(y.shift()[ad]=0),y.push(T),S(z))},ee=(T,z,U,N)=>{let K=_,be=C,Ie=gr,de=r;_=Xm,C=0,r=0,_||(Xm=_=new cE(8192)),gr=_.length-10,te(T,z,N),Xm=_;let ut=C;if(_=K,C=be,gr=Ie,r=de,ut>1){let Et=C+ut-1;Et>gr&&F(Et);let Ks=U+r;_.copyWithin(Ks+ut,Ks+1,C),_.set(Xm.slice(0,ut),Ks),C=Et}else _[U+r]=Xm[0]}}useBuffer(t){_=t,_.dataView||(_.dataView=new DataView(_.buffer,_.byteOffset,_.byteLength)),Ot=_.dataView,C=0}set position(t){C=t}get position(){return C}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}};JC=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,Qm];KC=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:o,targetView:s,position:i}=t(6);o[i++]=214,o[i++]=255,s.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:o,targetView:s,position:i}=t(10);o[i++]=215,o[i++]=255,s.setUint32(i,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(i+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:o,targetView:s,position:i}=t(3);o[i++]=212,o[i++]=255,o[i++]=255}else{let{target:o,targetView:s,position:i}=t(15);o[i++]=199,o[i++]=12,o[i++]=255,s.setUint32(i,e.getMilliseconds()*1e6),s.setBigInt64(i+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:o,position:s}=t(this.moreTypes?3:0);this.moreTypes&&(o[s++]=212,o[s++]=115,o[s++]=0),n(r)}},{pack(e,t,n){let{target:r,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(r[o++]=212,r[o++]=101,r[o++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:o}=t(this.moreTypes?3:0);this.moreTypes&&(r[o++]=212,r[o++]=120,r[o++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?WC(e,16,t):VC(cd?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==tz&&this.moreTypes?WC(e,HC.indexOf(n.name),t):VC(e,t)}},{pack(e,t){this.moreTypes?WC(e,17,t):VC(cd?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function WC(e,t,n,r){let o=e.byteLength;if(o+1<256){var{target:s,position:i}=n(4+o);s[i++]=199,s[i++]=o+1}else if(o+1<65536){var{target:s,position:i}=n(5+o);s[i++]=200,s[i++]=o+1>>8,s[i++]=o+1&255}else{var{target:s,position:i,targetView:a}=n(7+o);s[i++]=201,a.setUint32(i,o+1),i+=4}s[i++]=116,s[i++]=t,e.buffer||(e=new Uint8Array(e)),s.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i)}function VC(e,t){let n=e.byteLength;var r,o;if(n<256){var{target:r,position:o}=t(n+2);r[o++]=196,r[o++]=n}else if(n<65536){var{target:r,position:o}=t(n+3);r[o++]=197,r[o++]=n>>8,r[o++]=n&255}else{var{target:r,position:o,targetView:s}=t(n+5);r[o++]=198,s.setUint32(o,n),o+=4}r.set(e,o)}function X$(e,t,n,r){let o=e.length;switch(o){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:o<256?(t[n++]=199,t[n++]=o):o<65536?(t[n++]=200,t[n++]=o>>8,t[n++]=o&255):(t[n++]=201,t[n++]=o>>24,t[n++]=o>>16&255,t[n++]=o>>8&255,t[n++]=o&255)}return t[n++]=r,t.set(e,n),n+=o,n}function Kte(e,t){let n,r=t.length*6,o=e.length-r;for(;n=t.pop();){let s=n.offset,i=n.id;e.copyWithin(s+r,s,o),r-=6;let a=s+r;e[a++]=214,e[a++]=105,e[a++]=i>>24,e[a++]=i>>16&255,e[a++]=i>>8&255,e[a++]=i&255,o=s}return e}function ez(e,t,n){if(Yt.length>0){Ot.setUint32(Yt.position+e,C+n-Yt.position-e),Yt.stringsPosition=C-e;let r=Yt;Yt=null,t(r[0]),t(r[1])}}function Jte(e,t){return e.isCompatible=n=>{let r=!n||(t.lastNamedStructuresLength||0)===n.length;return r||t._mergeStructures(n),r},e}Uc.SUPPORTS_STRUCT_HOOKS=!0;var nz=new Uc({useRecords:!1}),Gte=nz.pack,Zte=nz.pack;var{NEVER:Qte,ALWAYS:Yte,DECIMAL_ROUND:Xte,DECIMAL_FIT:ene}=aE,rz=512,oz=1024,sz=2048;function vz(e,t){let{exact:n,layout:r,recursive:o,target:s}=ld(e),i=sf(r,t?.fingerprint),a=n?{value:void 0}:void 0;return ZC(a===void 0?s:Rre(s,a,!o),r,i,a)}function cA(e,t){let{exact:n,exitSuccess:r,layout:o,target:s}=ld(e);if(!n){if(!r)return vz(e,t);let i={value:void 0};return ZC(_re(s,i),o,sf(o,t?.fingerprint),i,!0)}return ZC(Mre(s),o,sf(o,t?.fingerprint),void 0)}function ZC(e,t,n,r,o=!1){return Zo.pipe(Ee(e,kre(t,n,r,o)))}function Tz(e,t){let{exact:n,exitSuccess:r,layout:o}=ld(e),s=sf(o,t?.fingerprint),i=t??eo;if(!n){let a=uS(vz(e,t),t);return!r||i.onExcessProperty==="error"?a:c=>{if(!CE(c))return a(c);try{return wE(o,c,i,s)}catch(u){throw u instanceof Li?new Pr(u.issue):u}}}return a=>{try{return wE(o,a,i,s)}catch(c){throw c instanceof Li?new Pr(c.issue):c}}}function nne(e,t){let{exact:n,layout:r}=ld(e);if(!n){let i=Tz(e,t);return a=>rne(a.map(i))}let o=sf(r,t?.fingerprint),s=t??eo;return i=>{try{return nH(r,i,s,o)}catch(a){throw a instanceof Li?new Pr(a.issue):a}}}function rne(e){if(e.length===1)return e[0];let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function kz(e,t){let{exact:n,exitSuccess:r,layout:o,target:s}=ld(e),i=t??eo,a=n?void 0:aS(s,i),c=a!==void 0&&r?u=>CE(u)?u:a(u):a;return one(o,sf(o,t?.fingerprint),i,t?.maxFrameSize,c,Cz(n,t))}function Cz(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 Az(e,t){let{exact:n,layout:r}=ld(e),o=Cz(n,t),s=Tz(e,t),i=nne(e,t);if(!o)return{encode:s,encodeMany:i};let a=sf(r,t?.fingerprint),c=t??eo,u=Qne(),f=l=>{try{return l()}catch(p){throw p instanceof Li?new Pr(p.issue):p}};return{encode:l=>f(()=>wE(r,l,c,a,u)),encodeMany:l=>f(()=>nH(r,l,c,a,u))}}function one(e,t,n,r,o,s){let i=s?[]:void 0,a=new Uint8Array(0),c=0,u=0,f,l=!1,p=new nh,m=new th(n,Ine),h=()=>{p.release(),m.clear(),a=tA,c=u=0},g=(x,w)=>{throw new Pr(new ke({expected:x},w,n))},y=()=>{let x=f;throw f=void 0,x},b=(x,w)=>{let S=x.length-w;S>a.length&&(a=new Uint8Array(Math.max(256,S))),a.set(w===0?x:x.subarray(w),0),c=0,u=S},E={feedSync(x){if(f!==void 0)return y();if(l)return g("parser is spent");let w=u===c,S,A,M;if(w)S=x,A=0,M=x.length;else{if(x.length>0){let F=u-c,te=F+x.length;if(te>a.length){let ee=new Uint8Array(Math.max(256,a.length*2,te));ee.set(a.subarray(c,u)),a=ee,c=0,u=F}else c>0&&(a.copyWithin(0,c,u),c=0,u=F);a.set(x,u),u+=x.length}S=a,A=c,M=u}let R=[],P=()=>(w?A<M&&b(x,A):(c=A,c===u&&(c=u=0)),R),$=(F,te)=>{l=!0;let ee=new Pr(new ke({expected:F},te,n));if(h(),R.length===0)throw ee;return f=ee,R};for(;;){let F=0,te=-1,ee=M-A,T=1;for(let U=0;U<Math.min(6,ee);U++){let N=S[A+U];if(F+=(N&127)*T,(N&128)===0){te=U+1;break}T*=128}if(te===-1){if(ee<6)return P();let U=BigInt(F);for(let N=6;N<Math.min(10,ee);N++){let K=S[A+N];if(U|=BigInt(K&127)<<BigInt(N*7),(K&128)===0){if(te=N+1,U>QC)return $("safe integer length",U);F=Number(U);break}}if(te===-1)return ee>=10?$("uvarint",S.subarray(A,A+10)):P()}if(F===0)return $("nonzero frame length",F);if(r!==void 0&&F>r)return $("frame within maxFrameSize",F);if(te+F>ee)return P();let z=ue;try{ue=0;let U=A+te;m.beginFrame(),p.reset(S,U,U+F,n,m,t.positional,i);let N=fH(e,p,t);R.push(o===void 0?N:o(N))}catch(U){l=!0,h();let N=U instanceof Li?new Pr(U.issue):Wl(U)?U:(()=>{throw U})();if(R.length===0)throw N;return f=N,R}finally{ue=z}A+=te+F}},endSync(){if(f!==void 0)return y();if(l)return g("parser is spent");l=!0;let x=c<u?a.subarray(c,u):void 0;if(h(),x!==void 0)return g("complete value",x)},feed:x=>V(()=>{try{return v(E.feedSync(x))}catch(w){if(Wl(w))return G(w);throw w}}),end:V(()=>{try{return E.endSync(),H}catch(x){if(Wl(x))return G(x);throw x}})};return E}var sne="~effect/encoding/SchemaBinary/fieldId",ine=32,ane=33,QC=BigInt(Number.MAX_SAFE_INTEGER),gE=BigInt(0),ts=BigInt(1),cne=BigInt(2),Rz=BigInt(7),iz=BigInt(127),une=BigInt(1e6),fne=BigInt(255),az=BigInt(4294967295),lne=BigInt(32),Ni=new TextEncoder,dne=new TextDecoder("utf-8",{fatal:!0}),Oz=7,cz=0xffffffffffff,pne=0xfffffffffffff,_z=0,Mz=1,Pz=2,af=0,of=1,sh=2,ih=3,ah=4,ch=5,mne=6,hne=7,ns=8;function uA(e){return typeof e=="number"&&Number.isInteger(e)&&e>=-cz&&e<=cz}var IE=8,YC=2199023255551,Nc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];function fA(e){for(let t=1;t<=IE;t++){let n=Math.round(e*Nc[t]);if(!(n>=-YC&&n<=YC))return 0;if(n/Nc[t]===e)return t}return 0}function Fz(e){let t=Math.floor(e/2);return e%2===1?-t:t}var St={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 Uz(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e[n],16777619);return t>>>0}var gne=BigInt("14695981039346656037"),xne=BigInt("1099511628211"),yne=BigInt("18446744073709551615");function uz(e){let t=gne;for(let n=0;n<e.length;n++)t=(t^BigInt(e[n]))*xne&yne;return t}function xE(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function Dc(e,t){for(;t>127;)e.push(t&127|128),t=Math.floor(t/128);e.push(t)}function yE(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}function vo(e,t){for(let n=0;n<8;n++)e.push(Number(t>>BigInt(n*8)&fne))}function Dz(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e[r]-t[r];return e.length-t.length}var Li=class extends Error{issue;constructor(t){super("SchemaBinary failure"),this.issue=t}};function Q(e,t,n){throw pn(new ke({expected:e},t,n))}var nt=[],ue=0;function pn(e){return new Li(ue===0?e:new Ct(nt.slice(0,ue),e))}function Sne(e){let t=new Uint8Array(Nz(e)),n=0;for(;e>127;)t[n++]=e&127|128,e=Math.floor(e/128);return t[n]=e,t}function Nz(e){let t=1;for(;e>127;)e=Math.floor(e/128),t++;return t}var Ene=32;function bne(e,t,n,r){let o=n-t;if(o===0)return"";if(o<=Ene){let s=wne(e,t,n);if(s!==void 0)return s}try{return dne.decode(e.subarray(t,n))}catch{Q("utf-8",void 0,r)}}function wne(e,t,n){let r="",o=t;for(;o+16<=n;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],l=e[o+6],p=e[o+7],m=e[o+8],h=e[o+9],g=e[o+10],y=e[o+11],b=e[o+12],E=e[o+13],x=e[o+14],w=e[o+15];if((s|i|a|c|u|f|l|p|m|h|g|y|b|E|x|w)>127)return;r+=String.fromCharCode(s,i,a,c,u,f,l,p,m,h,g,y,b,E,x,w)}if(o+8<=n){let s=e[o],i=e[o+1],a=e[o+2],c=e[o+3],u=e[o+4],f=e[o+5],l=e[o+6],p=e[o+7];if((s|i|a|c|u|f|l|p)>127)return;r+=String.fromCharCode(s,i,a,c,u,f,l,p),o+=8}switch(n-o){case 0:return r;case 1:{let s=e[o];return s>127?void 0:r+String.fromCharCode(s)}case 2:{let s=e[o],i=e[o+1];return(s|i)>127?void 0:r+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:r+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:r+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:r+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:r+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],l=e[o+6];return(s|i|a|c|u|f|l)>127?void 0:r+String.fromCharCode(s,i,a,c,u,f,l)}}}var XC=64*1024,Ine=256,vne=512,Tne=16*1024;function eA(e){let t=new Uint8Array(e);return{buf:t,view:new DataView(t.buffer),offset:0,writing:!1}}var eh=eA(XC),SE=class{buf=new Uint8Array(0);view=new DataView(this.buf.buffer);arena;start=0;limit=0;len=0;reset(){let t=eh;(t.writing||t.offset>=t.buf.length)&&(t=eh=eA(XC)),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 n=this.arena,r=this.len+t,o=XC;for(;o<r;)o*=2;let s=eA(o);s.writing=!0,s.buf.set(this.buf.subarray(this.start,this.start+this.len)),n.writing=!1,this.arena=eh=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 n=this.buf,r=this.start+this.len;if(t<128)n[r++]=t;else if(n[r++]=t&127|128,t<16384)n[r++]=t>>>7;else{for(n[r++]=t>>>7&127|128,t=Math.floor(t/16384);t>127;)n[r++]=t&127|128,t=Math.floor(t/128);n[r++]=t}this.len=r-this.start}uvarintBig(t){for(;t>iz;)this.byte(Number(t&iz)|128),t>>=Rz;this.byte(Number(t))}zigzag(t){this.uvarintBig(t>=gE?t<<ts:(-t<<ts)-ts)}numberVarint(t){let n=t<0||t===0&&1/t<0,r=n?-t:t;r<=pne?this.uvarint(r*2+(n?1:0)):this.uvarintBig(BigInt(r)*cne+(n?ts:gE))}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 n=t.length;this.ensure(n+1);let r=this.buf,o=this.start+this.len;for(let i=0;i<n;i++)r[o++]=t[i];let s=o-this.start;return this.len=s+1,s}beginSized(){return this.ensure(1),this.len++}endSized(t){let n=this.len-t-1;n<128?this.buf[this.start+t]=n:this.growSized(t,n)}endSizedRun(t){let n=(this.len-t-1)*2;n<128?this.buf[this.start+t]=n:this.growSized(t,n)}growSized(t,n){let r=Nz(n),o=r-1;this.ensure(o);let s=this.start+t;this.buf.copyWithin(s+r,s+1,this.start+this.len),this.len+=o;let i=n,a=s;for(;i>127;)this.buf[a++]=i&127|128,i=Math.floor(i/128);this.buf[a]=i}string(t){let n=t.length;if(n===0)return;this.ensure(n*3);let r=this.buf,o=this.start+this.len,s=0;for(;s+4<=n;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+=Ni.encodeInto(t,r.subarray(this.start+this.len)).written;return}r[o++]=i,r[o++]=a,r[o++]=c,r[o++]=u}for(;s<n;s++){let i=t.charCodeAt(s);if(i>127){this.len+=Ni.encodeInto(t,r.subarray(this.start+this.len)).written;return}r[o++]=i}this.len=o-this.start}out(){let t=this.arena,n=new Uint8Array(t.buf.buffer,this.start,this.len);return t===eh&&(t.offset=this.start+this.len),t.writing=!1,this.arena=void 0,n}abort(){let t=this.arena;t!==void 0&&(t===eh&&(t.offset=this.start),t.writing=!1,this.arena=void 0)}};function kne(e){let t=qn(e);return t._tag==="String"&&t.checks===void 0}function Cne(e,t,n){return e.extra.find(r=>ga({[t]:null},r.parameter,n).length>0)}var th=class{entries=new WeakMap;orderLayouts;orderKeys;options;size=0;next=0;replace=!1;constructor(t,n){this.options=t,this.orderLayouts=n===void 0?void 0:new Array(n),this.orderKeys=n===void 0?void 0:new Array(n)}beginFrame(){this.replace=!0}find(t,n){let r=this.entries.get(t);if(r===void 0&&(r=new Map,this.entries.set(t,r)),r.has(n))return r.get(n);let o=Cne(t,n,this.options),s=this.orderLayouts;if(s===void 0)return r.set(n,o),o;let i=this.orderKeys;if(this.size<s.length)s[this.size]=t,i[this.size]=n,this.size++,r.set(n,o);else if(this.replace){this.replace=!1;let a=s[this.next];(a===t?r:this.entries.get(a))?.delete(i[this.next]),s[this.next]=t,i[this.next]=n,this.next=(this.next+1)%s.length,r.set(n,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}},EE=new ArrayBuffer(0),tA=new Uint8Array(EE),fz=new DataView(EE),nh=class{pos=0;buf=tA;view;viewCache=fz;viewBuffer=EE;viewOffset=0;viewLength=0;end=0;options=eo;indexSignatures;positional=!1;intern;dict;reset(t,n,r,o,s,i,a){this.view=void 0,this.buf=t,this.pos=n,this.end=r,this.options=o,this.indexSignatures=s,this.positional=i,this.intern=void 0,this.dict=a}release(){this.pos=this.end=0,this.buf=tA,this.view=void 0,this.viewCache=fz,this.viewBuffer=EE,this.viewOffset=this.viewLength=0,this.options=eo,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&&Q("complete value",void 0,this.options),this.buf[this.pos++]}take(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.buf.subarray(this.pos,this.pos+t);return this.pos+=t,n}takeCopy(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.buf.slice(this.pos,this.pos+t);return this.pos+=t,n}enter(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.end;return this.end=this.pos+t,n}exit(t){this.pos=this.end,this.end=t}readUtf8(t){this.pos+t>this.end&&Q("complete value",void 0,this.options);let n=this.pos;return this.pos+=t,bne(this.buf,n,n+t,this.options)}uvarint(){let t=this.buf,n=this.end,r=this.pos;r>=n&&Q("complete value",void 0,this.options);let o=t[r++];if(o<128)return this.pos=r,o;let s=o&127;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<7,o<128)return this.pos=r,s;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<14,o<128)return this.pos=r,s;if(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<21,o<128)return this.pos=r,s;let i=268435456;for(let a=4;a<10;a++){r>=n&&(this.pos=r,Q("complete value",void 0,this.options)),o=t[r++];let c=(o&127)*i;if(c>Number.MAX_SAFE_INTEGER-s&&(this.pos=r,Q("safe integer length",void 0,this.options)),s+=c,o<128)return this.pos=r,s;i*=128}this.pos=r,Q("uvarint",void 0,this.options)}fieldTag(){let t=this.buf,n=this.end,r=this.pos;r>=n&&Q("complete value",void 0,this.options);let o=t[r++];if(o<128)return this.pos=r,o;let s=o&127;return r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<7,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<14,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],s|=(o&127)<<21,o<128?(this.pos=r,s):(r>=n&&Q("complete value",void 0,this.options),o=t[r++],this.pos=r,o>=128&&Q("uvarint",void 0,this.options),s+o*268435456)))}uvarintBig(){let t=gE,n=gE;for(;;){let r=this.byte();if(t|=BigInt(r&127)<<n,(r&128)===0)return t;n+=Rz}}numberVarint(){let t=this.buf,n=this.end,r=this.pos,o=0,s=1;for(let c=0;c<Oz;c++){r>=n&&(this.pos=r,Q("complete value",void 0,this.options));let u=t[r++];if(o+=(u&127)*s,u<128)return this.pos=r,Fz(o);s*=128}let i=this.uvarintBig(),a=Number(i>>ts);return Number.isFinite(a)||Q("safe integer length",void 0,this.options),(i&ts)===ts?-a:a}zigzag(){let t=this.uvarintBig();return(t&ts)===ts?-(t+ts>>ts):t>>ts}f64(){this.pos+8>this.end&&Q("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&&Q("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&&Q("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&&Q("complete value",void 0,this.options);let t=(this.view??this.dataView()).getInt32(this.pos,!0);return this.pos+=4,t}};function lz(e,t){return{_:"literal",leaf:e,values:t,valueSet:t.length>4?new Set(t):void 0}}function uh(e,t){let n=e.values;return e.valueSet!==void 0?e.valueSet.has(t):n.length===1?t===n[0]:n.includes(t)}function vE(e){return e.values.map(t=>typeof t=="string"?JSON.stringify(t):String(t)).join(" | ")}var dE=0,lA=1,Lz=2,Bz=3,qz=30,pE=1<<qz;function TE(e){return e._==="literal"?TE(e.leaf):e._==="int"}function kE(e){switch(e._){case"literal":return kE(e.leaf);case"bool":return 1;case"int64":return 8;default:return}}function nA(e){return kE(e)!==void 0||TE(e)||e._==="null"||e._==="undefined"}var rh={"effect/schema/Date":{kind:St.int64,exact:!0},"effect/schema/DateTimeUtc":{kind:St.int64,exact:!0},"effect/schema/DateTimeZoned":{kind:St.dateTimeZoned,exact:!0},"effect/schema/Duration":{kind:St.duration,exact:!0},"effect/schema/BigDecimal":{kind:St.bigDecimal,exact:!0},"effect/schema/Uint8Array":{kind:St.bytes,exact:!0},"effect/schema/Option":{kind:St.option,exact:"parameters"},"effect/schema/Result":{kind:St.result,exact:"parameters"},"effect/schema/Exit":{kind:St.exit,exact:"parameters"},"effect/schema/Cause":{kind:St.cause,exact:"parameters"},"effect/schema/CauseReason":{kind:St.causeReason,exact:"parameters"}};function fd(e){let t=e.annotations?.representation;return en(t)&&typeof t.id=="string"?t.id:void 0}var mE=xa(e=>{let t=Ane(e),n=e.context;return t===e||n===void 0?t:Sl(t,new Xr(n.isOptional,n.isMutable,void 0,n.annotations))});function Ane(e){switch(e._tag){case"Declaration":{let t=fd(e);if(t!==void 0&&(t in rh||t==="effect/schema/Json"||t==="effect/schema/MutableJson"))return e.recur(mE);let n=e.annotations?.toCodecJson,r=e.annotations?.toCodec;if(!cn(n)&&!cn(r))return e;let o=e.typeParameters.map(i=>re(qn(i))),s=(cn(n)?n(o):void 0)??(cn(r)?r(o):void 0);return s===void 0?e:lt(e,[mc(s,mE)])}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(mE);default:return e}}function Rne(e){let t=[...e].sort((r,o)=>{let s=typeof r.key=="number",i=typeof o.key=="number";return s!==i?s?-1:1:s?r.key-o.key:Dz(Ni.encode(r.key),Ni.encode(o.key))}),n=[];for(let r of t){let o=Ni.encode(String(r.key));n.push(typeof r.key=="number"?0:1),yE(n,o.length),xE(n,o);let s=r.literal,i=Ni.encode($z(s));n.push(jz(s)),yE(n,i.length),xE(n,i)}return Uz(n)}function jz(e){switch(typeof e){case"string":return 1;case"number":return 2;case"boolean":return 3;case"bigint":return 4;default:return 5}}function $z(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 zz(e){switch(e._tag){case"Symbol":return!0;case"Union":return e.types.some(zz);default:return!1}}function Hz(e){let t=fd(e);return t==="effect/schema/Json"||t==="effect/schema/MutableJson"?!0:cn(e.annotations?.toCodecJson)}function One(e){let t=e.checks;if(t===void 0)return!1;let n=r=>r.annotations?.representation?.id==="effect/schema/isInt"?!0:r._tag==="FilterGroup"&&r.checks.some(n);return t.some(n)}function Wz(e){for(;e._tag==="Suspend";)e=e.thunk();return e}function dz(e){let t=[],n=new Set,r=o=>{let s=Wz(o);if(!n.has(s))switch(n.add(s),s._tag){case"Never":return;case"Union":s.types.forEach(r);return;case"Enum":Np(s).types.forEach(r);return;default:t.push(s)}};return e.types.forEach(r),t}function pz(e){switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"bool";default:return"bigint"}}function hE(e){switch(e._tag){case"String":case"TemplateLiteral":case"Symbol":return St.string;case"UniqueSymbol":if(globalThis.Symbol.keyFor(e.symbol)===void 0)throw new Error("Binary layout: unregistered unique symbol (Symbol.keyFor)");return St.string;case"Boolean":return St.bool;case"Null":return St.null;case"Undefined":case"Void":return St.undefined;case"Number":return St.number;case"BigInt":return St.bigint;case"Literal":switch(typeof e.literal){case"string":return St.string;case"number":return St.number;case"boolean":return St.bool;default:return St.bigint}case"Unknown":case"Any":case"ObjectKeyword":return St.json;case"Objects":return St.struct;case"Arrays":return St.array;case"Declaration":{let t=fd(e);if(t!==void 0&&t in rh)return rh[t].kind;if(Hz(e))return St.json;throw new Error(`Binary layout: declaration ${t??"<anonymous>"} has no toCodecJson or toCodec`)}case"Suspend":return hE(Wz(e));default:throw new Error("Binary layout: union members are not uniquely identifiable")}}function mz(e){for(let t of e.fields)t.optional||(t.index<32?e.requiredMask|=1<<t.index:e.requiredWide=!0)}function _ne(e){let t=Vz(e),n=!t&&Mne(e);e=qn(e);let r=new Map,o=!1,s=0,i=h=>({_:h,slot:h==="string"?s++:0});function a(h){let g=r.get(h);if(g!==void 0)return g;let y=c(h);return r.set(h,y),y}function c(h){switch(h._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(One(h)?"int":"number");case"BigInt":return i("bigint");case"Literal":return lz(i(pz(h.literal)),[h.literal]);case"Unknown":case"Any":case"ObjectKeyword":return i("json");case"Never":return{_:"never",ast:h};case"Enum":return p(h,dz(Np(h)));case"Suspend":{o=!0;let g=a(h.thunk());return r.set(h,g),g}case"Objects":return u(h);case"Arrays":return f(h);case"Union":return p(h,dz(h));case"Declaration":return l(h)}}function u(h){let g=[],y=[],b=new Map;for(let w of h.propertySignatures){if(typeof w.name=="symbol")throw new Error("Binary layout: symbol property names are illegal");let S=String(w.name),A=w.type.context?.annotations,M=A?.[sne],R=typeof M=="number"?M:Uz(Ni.encode(S));if(!Number.isInteger(R)||R<0||R>4294967295)throw new Error(`Binary layout: illegal field id for ${S}`);let P=b.get(R);P===void 0?b.set(R,[S]):P.push(S),g.push({name:S,id:R,tagBytes:Sne(R*ns+af),index:0,optional:w.type.context?.isOptional===!0,annotations:A,layout:void 0,wireMask:0,inline:!1}),y.push(w.type)}for(let[w,S]of b)if(w===0||S.length>1)throw new Error(`Binary layout field id collision: ${w} (${S.join(", ")})`);let E=[];for(let w of h.indexSignatures){if(zz(w.parameter))throw new Error("Binary layout: symbol property names are illegal");E.push({parameter:w.parameter,layout:void 0,wireMask:0})}let x={_:"struct",ast:h,fields:g,byId:new Map,extra:E,extraAll:E.length===1&&kne(E[0].parameter)?E[0]:void 0,names:new Set(g.map(w=>w.name)),extraShape:void 0,optionalCount:0,requiredMask:0,requiredWide:!1};r.set(h,x);for(let w=0;w<g.length;w++){let S=g[w];S.layout=a(y[w]),S.wireMask=iA(S.layout),S.inline=nA(S.layout),S.optional&&x.optionalCount++,x.byId.set(S.id,S)}g.sort((w,S)=>w.id-S.id);for(let w=0;w<g.length;w++)g[w].index=w;mz(x);for(let w=0;w<E.length;w++)E[w].layout=a(h.indexSignatures[w].type),E[w].wireMask=iA(E[w].layout);return x}function f(h){let g=h.rest.length>0||h.elements.some(x=>x.context?.isOptional===!0),y=h.elements.filter(x=>x.context?.isOptional!==!0).length,b=Math.max(0,h.rest.length-1),E={_:"array",ast:h,elements:[],rest:[],hasCount:g,minCount:y+b,uniform:void 0,uniformInline:!1,uniformPacked:void 0,uniformNumbers:!1,run:void 0};r.set(h,E);for(let x of h.elements)E.elements.push({optional:x.context?.isOptional===!0,layout:a(x)});for(let x of h.rest)E.rest.push(a(x));if(E.elements.length===0&&E.rest.length===1){let x=E.rest[0];E.uniform=x,E.uniformPacked=kE(x),E.uniformNumbers=x._==="number",E.uniformInline=nA(x)}return E}function l(h){let g=fd(h);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=h.typeParameters;switch(g){case"effect/schema/Option":{let b={_:"option",value:void 0};return r.set(h,b),b.value=a(y[0]),b}case"effect/schema/Result":{let b={_:"result",success:void 0,failure:void 0};return r.set(h,b),b.success=a(y[0]),b.failure=a(y[1]),b}case"effect/schema/Exit":{let b={_:"cause",error:void 0,defect:void 0},E={_:"exit",value:void 0,cause:b};return r.set(h,E),E.value=a(y[0]),b.error=a(y[1]),b.defect=a(y[2]),E}case"effect/schema/Cause":case"effect/schema/CauseReason":{let b={_:g==="effect/schema/Cause"?"cause":"causeReason",error:void 0,defect:void 0};return r.set(h,b),b.error=a(y[0]),b.defect=a(y[1]),b}}if(g!==void 0&&g in rh)throw new Error(`Binary layout: native declaration ${g} has no layout constructor`);if(Hz(h))return i("json");throw new Error(`Binary layout: declaration ${g??"<anonymous>"} has no toCodecJson or toCodec`)}function p(h,g){if(g.length===0)return{_:"never",ast:h};let y=[],b=[],E=new Map,x=new Map,w=(P,$)=>{let F=E.get(P);if(F!==void 0&&F._!==$._)throw new Error("Binary layout: union members are not uniquely identifiable");E.set(P,$)};for(let P of g){if(P._tag==="Literal"){let $=hE(P),F=x.get($);F===void 0?x.set($,[P.literal]):F.includes(P.literal)||F.push(P.literal);continue}if(P._tag==="UniqueSymbol"){hE(P),w(St.string,i("symbol"));continue}if(P._tag==="Objects"||P._tag==="Arrays"){let $=lc(P);if($!==void 0&&$.length>0){for(let F of $)if(typeof F.key=="symbol")throw new Error("Binary layout: symbol property names are illegal");y.push({member:P,sentinels:$});continue}}b.push({member:P,kind:hE(P)})}for(let[P,$]of x)w(P,lz(i(pz($[0])),$));if(y.length===0&&b.length===0&&E.size===1)return E.values().next().value;let S=new Set(E.keys());for(let{kind:P}of b){if(S.has(P))throw new Error("Binary layout: union members are not uniquely identifiable");S.add(P)}if(y.length===0&&E.size===0&&b.length===1){let P=a(b[0].member);return r.set(h,P),P}let A=new Map,M=[];for(let{sentinels:P}of y){let $=Rne(P);if(A.has($))throw new Error(`Binary layout sentinel collision: ${$}`);A.set($,P),M.push($)}let R={_:"union",ast:h,variants:[],byTag:new Map,discriminator:void 0,others:[],byKind:new Map,byPos:[]};r.set(h,R);for(let P=0;P<y.length;P++){let{member:$,sentinels:F}=y[P],te=M[P],ee=a($),T,z;if($._tag==="Objects"){let N=ee,K=new Set(F.map(de=>String(de.key))),be=N.fields.filter(de=>!K.has(de.name)),Ie={_:"struct",ast:N.ast,fields:be,byId:new Map(be.map(de=>[de.id,de])),extra:N.extra,extraAll:N.extraAll,names:N.names,extraShape:void 0,optionalCount:be.reduce((de,ut)=>ut.optional?de+1:de,0),requiredMask:0,requiredWide:!1};mz(Ie),T=Ie,z=!1}else T=ee,z=!0;let U={tag:te,sentinels:F,tuple:z,payload:T,position:0};R.variants.push(U),R.byTag.set(te,U)}for(let[P,$]of E)R.others.push({kind:P,layout:$,position:0}),R.byKind.set(P,$);for(let{kind:P,member:$}of b){let F=a($);R.others.push({kind:P,layout:F,position:0}),R.byKind.set(P,F)}for(let P of[...R.variants].sort(($,F)=>$.tag-F.tag))P.position=R.byPos.length,R.byPos.push({variant:P,layout:P.payload});for(let P of[...R.others].sort(($,F)=>$.kind-F.kind))P.position=R.byPos.length,R.byPos.push({variant:void 0,layout:P.layout});return R.others.sort((P,$)=>hz(P.layout)-hz($.layout)),R.discriminator=are(R.variants),R}return{layout:a(e),recursive:o,exact:t,exitSuccess:n}}function Vz(e){let t=new Map,n=r=>{if(r.encoding!==void 0||r.checks!==void 0||r.encodingChecks!==void 0||r.annotations?.parseOptions!==void 0)return!1;switch(r._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 r.elements.every(n)&&r.rest.every(n);case"Objects":return r.propertySignatures.every(o=>n(o.type))&&r.indexSignatures.every(o=>o.parameter._tag==="String"&&n(o.parameter)&&n(o.type));case"Union":return r.mode==="anyOf"&&r.types.every(n);case"Suspend":{let o=t.get(r);if(o!==void 0)return o;t.set(r,!0);let s=n(r.thunk());return t.set(r,s),s}case"Declaration":{let o=fd(r),s=o!==void 0?rh[o]:void 0;return s===void 0?!1:s.exact===!0||r.typeParameters.every(n)}default:return!1}};return n(e)}function Mne(e){return e._tag==="Declaration"&&e.encoding===void 0&&e.checks===void 0&&e.encodingChecks===void 0&&e.annotations?.parseOptions===void 0&&fd(e)==="effect/schema/Exit"&&Vz(e.typeParameters[0])}var io={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 Pne(e){let t=new Map,n=[],r=Number.MAX_SAFE_INTEGER;function o(i){let a=n.lastIndexOf(i);if(a>=0){a<r&&(r=a);let m=[io.backEdge];return Dc(m,n.length-a),uz(m)}let c=t.get(i);if(c!==void 0)return c;let u=n.length,f=r;r=Number.MAX_SAFE_INTEGER,n.push(i);let l=uz(s(i));n.pop();let p=r>=u;return p&&t.set(i,l),r=p?f:Math.min(f,r),l}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(io[i._]),a;case"literal":{a.push(io.literal),xE(a,s(i.leaf)),Dc(a,i.values.length);let c=i.values.map(u=>[jz(u),$z(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 l=Ni.encode(f);Dc(a,l.length),xE(a,l)}return a}case"int64":return a.push(i.flavor==="date"?io.date:io.dateTimeUtc),a;case"never":return a.push(io.never),a;case"struct":{a.push(io.struct),Dc(a,i.fields.length);for(let c of i.fields)yE(a,c.id),a.push(c.optional?1:0),vo(a,o(c.layout));Dc(a,i.extra.length);for(let c of i.extra)vo(a,o(c.layout));return a}case"array":{a.push(io.array),Dc(a,i.elements.length);for(let c of i.elements)a.push(c.optional?1:0),vo(a,o(c.layout));Dc(a,i.rest.length);for(let c of i.rest)vo(a,o(c));return a}case"union":{a.push(io.union),Dc(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),yE(a,u.tag)),vo(a,o(c.layout))}return a}case"option":return a.push(io.option),vo(a,o(i.value)),a;case"result":return a.push(io.result),vo(a,o(i.success)),vo(a,o(i.failure)),a;case"exit":return a.push(io.exit),vo(a,o(i.value)),vo(a,o(i.cause.error)),vo(a,o(i.cause.defect)),a;case"cause":case"causeReason":return a.push(i._==="cause"?io.cause:io.causeReason),vo(a,o(i.error)),vo(a,o(i.defect)),a}}return o(e)}function Fne(e,t){let n=new Uint8Array(8);for(let r=0;r<4;r++)n[r]=e>>>r*8&255,n[r+4]=t>>>r*8&255;return n}var Une={positional:!1,envelope:ine,expectedEnvelope:"version 2 envelope, flags 0",fingerprint:new Uint8Array(8)};function Dne(e){let t=Pne(e);return{positional:!0,envelope:ane,expectedEnvelope:"version 2 envelope, flags 1",fingerprint:Fne(Number(t&az),Number(t>>lne&az))}}function hz(e){switch(e._){case"json":return 2;case"struct":return 1;default:return 0}}function rA(e,t){switch(e._){case"literal":return uh(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:Au(t)&&t._tag==="Utc";case"dateTimeZoned":return Au(t)&&t._tag==="Zoned";case"duration":return nu(t);case"bigDecimal":return Wa(t);case"option":return Ys(t);case"result":return If(t);case"exit":return xs(t);case"cause":return $f(t);case"causeReason":return zf(t);case"array":return Array.isArray(t);case"struct":return en(t)&&!Array.isArray(t);case"json":return!0;case"union":case"never":return!1}}function yt(e,t,n){throw pn(new ke({expected:e},t,n))}function xr(e,t=new Set){if(!hd(e))return!1;let n=Array.isArray(e),r=Object.getPrototypeOf(e);if(n||r===Object.prototype||r===null){if(t.has(e))return!0;t.add(e);try{if(n){for(let o=0;o<e.length;o++)if(xr(e[o],t))return!0}else for(let o of Object.keys(e))if(xr(e[o],t))return!0}finally{t.delete(e)}return!1}if(e instanceof Date||e instanceof Uint8Array||Au(e)||nu(e)||Wa(e))return!1;if(t.has(e))return!0;t.add(e);try{if(Ys(e))return Te(e)&&xr(e.value,t);if(If(e))return xr(Vt(e)?e.success:e.failure,t);if(xs(e))return xr(Ft(e)?e.value:e.cause,t);if($f(e))return e.reasons.some(o=>xr(o,t));if(zf(e))switch(e._tag){case"Fail":return xr(e.error,t);case"Die":return xr(e.defect,t);case"Interrupt":return!1}if(Il(e)){for(let o of e)if(xr(o,t))return!0;return!1}if(qy(e)){for(let[o,s]of e)if(xr(o,t)||xr(s,t))return!0;return!1}if(Wy(e)){for(let o of e)if(xr(o,t))return!0;return!1}if(pm(e))return xr(Sc(e),t);for(let o of Object.keys(e))if(xr(e[o],t))return!0}finally{t.delete(e)}return!1}function bE(e,t,n,r){let o=r.beginSized();Vn(e,t,n,r),r.endSized(o)}function Nne(e,t,n){let r=globalThis.Symbol.keyFor(t);r===void 0&&yt("registered symbol",t,e.options),n.string(r)}function gz(e,t,n,r){let o=n;switch(o._tag){case"Fail":r.byte(0),Vn(e,t.error,o.error,r);return;case"Die":r.byte(1),Vn(e,t.defect,o.defect,r);return;case"Interrupt":o.fiberId===void 0?r.byte(2):(r.byte(3),r.f64(o.fiberId))}}function Lne(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}function xz(e,t,n){if(e.layout!==t||e.keys.length!==n.length)return!1;for(let r=0;r<n.length;r++)if(e.keys[r]!==n[r])return!1;return!0}function Bne(e,t){if(e.extraAll===void 0||t.length>vne)return!1;let n=0;for(let r=0;r<t.length;r++)if(n+=t[r].length,n>Tne)return!1;return!0}function dA(e,t,n){let r=Object.keys(n),o=t.extraShape;if(o!==void 0&&xz(o,t,r))return o.pairs;let s=Bne(t,r),i=s?void 0:e.extraShape;if(i!==void 0&&xz(i,t,r))return i.pairs;let a=t.names,c=t.extraAll,u=[],f=!0;for(let p of r){if(a.has(p))continue;let m=c??(e.indexSignatures??=new th(e.options)).find(t,p);m!==void 0&&(f&&!Lne(p)&&(f=!1),u.push([p,m,void 0]))}if(f)u.sort((p,m)=>p[0]<m[0]?-1:p[0]>m[0]?1:0);else{for(let p of u)p[2]=Ni.encode(p[0]);u.sort((p,m)=>Dz(p[2],m[2]))}if(s)for(let p of u)p[2]??=Ni.encode(p[0]);let l={layout:t,keys:r,pairs:u};return s?t.extraShape=l:e.extraShape=l,u}function pA(e,t,n,r,o){for(let[s,i,a]of t){let c=a===void 0?s.length:a.length,u=n[s],f=mA(i.layout,u,e.options),l=f%ns;if(o===void 0)r.uvarint(c*ns+l);else{if(!o.disabled){let p=Jz(o,s);if(p!==void 0){r.uvarint(p*16+l*2+1),nt[ue++]=s,oA(e,i.layout,u,f,r),ue--;continue}Gz(o,s)}r.uvarint(c*16+l*2)}a===void 0?r.string(s):r.bytes(a),nt[ue++]=s,oA(e,i.layout,u,f,r),ue--}}function mA(e,t,n){if(e._==="literal")return uh(e,t)||yt(vE(e),t,n),mA(e.leaf,t,n);switch(e._){case"bool":return typeof t!="boolean"&&yt("a boolean",t,n),t?ah:ih;case"number":if(typeof t!="number"&&yt("a number",t,n),uA(t))return of;{let r=fA(t);return r===0?sh:r*ns+ch}case"int":return Number.isSafeInteger(t)||yt("an integer",t,n),of;default:return af}}function oA(e,t,n,r,o){switch(r%ns){case ih:case ah:return;case of:o.numberVarint(n);return;case sh:o.f64(n);return;case ch:{let i=Math.floor(r/ns);o.numberVarint(Math.round(n*Nc[i])),o.uvarint(i);return}default:bE(e,t,n,o)}}function qne(e,t,n,r){let o=mA(t.layout,n,e.options),s=o%ns;if(s===af){let i=r.idAndMark(t.tagBytes);Vn(e,t.layout,n,r),r.endSized(i);return}r.uvarint(t.id*ns+s),oA(e,t.layout,n,o,r)}function jne(e,t){let n=e.byName;if(n===void 0)return;let r=Object.getOwnPropertyNames(t),o=0;for(let i=0;i<r.length;i++){let a=n.get(r[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 nt[ue++]=c.name,pn(new sn(c.annotations))}}return o}function $ne(e,t,n,r){let o=n;if(t.extra.length>0){let i=e.intern;e.intern=void 0;let a=dA(e,t,o);if(a.length>0){r.uvarint(0);let c=r.beginSized();pA(e,a,o,r,i),r.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 nt[ue++]=c,pn(new sn(a.annotations))}nt[ue++]=c,qne(e,a,o[c],r),ue--}}function zne(e,t,n,r){let o=n,s=e.intern;e.intern=void 0;let i=t.optionalCount+7>>3,a=0;if(i>0){a=r.len;for(let f=0;f<i;f++)r.byte(0)}let c=t.fields,u=0;for(let f=0;f<c.length;f++){let l=c[f],p=l.name,m=Object.hasOwn(o,p);if(l.optional){if(m&&(r.buf[r.start+a+(u>>3)]|=1<<(u&7)),u++,!m)continue}else if(!m)throw nt[ue++]=p,pn(new sn(l.annotations));nt[ue++]=p,l.inline?Vn(e,l.layout,o[p],r):bE(e,l.layout,o[p],r),ue--}if(t.extra.length>0){let f=dA(e,t,o);r.uvarint(f.length),pA(e,f,o,r,s)}}function Hne(e){switch(e._){case"string":return lA;case"array":return e.uniform?._==="string"?Lz:dE;case"struct":return e.extra.length>0?Bz:dE;default:return dE}}function Wne(e){let t=e.uniform;if(t===void 0){if(e.rest.length!==1)return;t=e.rest[0];for(let n of e.elements)if(n.optional||n.layout!==t)return}return t._==="struct"?t:void 0}function Kz(e){let t=e.run;if(t!==void 0)return t;let n=Wne(e);if(n===void 0)return e.run=t=null,t;let r=n.fields.map(s=>Hne(s.layout)),o=n.fields.length<=qz;return t={struct:n,intern:r,shapes:o,byName:o&&n.extra.length===0?new Map(n.fields.map((s,i)=>[s.name,i])):void 0},e.run=t,t}var Vne=16,Kne=64;function yz(e,t){return e[t]??={values:[],refs:void 0,hits:0,disabled:!1}}function Jz(e,t){let n=e.refs;if(n!==void 0){let o=n.get(t);return o!==void 0&&e.hits++,o}let r=e.values;for(let o=0;o<r.length;o++)if(r[o]===t)return e.hits++,o}function Gz(e,t){let n=e.values;if(e.refs!==void 0){if(e.hits===0&&n.length>=Kne){e.disabled=!0,e.refs=void 0;return}e.refs.set(t,n.length)}else if(n.length>=Vne){let r=e.refs=new Map;for(let o=0;o<n.length;o++)r.set(n[o],o);r.set(t,n.length)}n.push(t)}var hA=0,Jne=1,gA=2,Gne=64,Zne=512;function Qne(){return{slots:[],marks:[],frame:0}}function Zz(e,t){return e[t]??={values:[],refs:new Map,state:hA,stamp:-1}}function Qz(e,t){if(e.refs.has(t)){e.state=Jne;return}e.refs.set(t,e.values.length),e.values.push(t),e.values.length>=Gne&&(e.state=gA)}function Yz(e,t){let n=e.values;n.length>=Zne||(e.refs.set(t,n.length),n.push(t))}function Yne(e,t){t.stamp!==e.frame&&(t.stamp=e.frame,e.marks.push({slot:t,length:t.values.length,state:t.state}))}function Xne(e){e.marks.length=0,e.frame++}function ere(e){let t=e.marks;for(let n=t.length-1;n>=0;n--){let{length:r,slot:o,state:s}=t[n],i=o.values;for(let a=r;a<i.length;a++)o.refs.delete(i[a]);i.length=r,o.state=s}t.length=0,e.frame++}function tre(e,t,n,r){let o=Zz(e.slots,t.slot),s=o.state;if(s===gA){r.string(n);return}if(Yne(e,o),s===hA){r.string(n),Qz(o,n);return}let i=o.refs.get(n);if(i!==void 0){r.uvarint(i*2+1);return}r.byte(0),Yz(o,n),r.string(n)}function nre(e,t,n){let r=Zz(e,t.slot),o=r.state;if(o===gA)return n.readUtf8(n.end-n.pos);if(o===hA){let a=n.readUtf8(n.end-n.pos);return Qz(r,a),a}let s=n.uvarint();if((s&1)===1){let a=(s-1)/2,c=r.values;return a>=c.length&&Q("a dictionary reference",s,n.options),c[a]}s!==0&&Q("a dictionary marker",s,n.options);let i=n.readUtf8(n.end-n.pos);return Yz(r,i),i}function Xz(e,t,n,r,o){if(!e.disabled){let i=Jz(e,r);if(i!==void 0){o.uvarint(i*2+1);return}Gz(e,r)}let s=o.beginSized();Vn(t,n,r,o),o.endSizedRun(s)}function rre(e,t,n,r,o){let s=[],i=[];for(let a=0;a<r;a++){nt[ue++]=a;let c=o.beginSized();ore(e,t,s,i,n[a],o),o.endSized(c),ue--}}function ore(e,t,n,r,o,s){let i=t.struct,a=o,c=i.fields,u;if(i.extra.length>0){let y=dA(e,i,a);y.length>0&&(u=y)}let f=!t.shapes,l=u===void 0?0:pE,p=jne(t,a);if(p!==void 0)l=p;else for(let y=0;y<c.length;y++){let b=c[y];if(Object.hasOwn(a,b.name))f||(l|=1<<y);else if(!b.optional)throw nt[ue++]=b.name,pn(new sn(b.annotations))}let m=-1;for(let y=0;y<n.length;y++)if(n[y]===l){m=y;break}m>=0?s.uvarint(m+1):(s.uvarint(0),f||n.push(l));let h=m<0,g=e.positional&&!f;if(h&&g&&s.uvarint(l),u!==void 0){h&&!g&&s.uvarint(0);let y=s.beginSized();pA(e,u,a,s),s.endSizedRun(y)}for(let y=0;y<c.length;y++){let b=c[y];if(f?!Object.hasOwn(a,b.name):(l&1<<y)===0)continue;h&&!g&&s.uvarint(b.id),nt[ue++]=b.name;let E=t.intern[y];if(E===lA)Xz(yz(r,y),e,b.layout,a[b.name],s);else{E!==dE&&(e.intern=yz(r,y));let x=s.beginSized();Vn(e,b.layout,a[b.name],s),s.endSizedRun(x),e.intern=void 0}ue--}}function eH(e,t,n){let r=e.elements.length;if(t<r)return e.elements[t].layout;let o=Math.max(0,e.rest.length-1),s=Math.max(r,n-o);return t>=s?e.rest[t-s+1]:e.rest[0]}function sre(e,t,n,r){let o=n.length;if(t.rest.length===0&&o>t.elements.length)throw nt[ue++]=t.elements.length,pn(new da(t.ast,n[t.elements.length],e.options));if(o<t.minCount)throw nt[ue++]=o,pn(new sn(void 0));if(t.hasCount&&r.uvarint(o),o>0){let i=Kz(t);if(i!==null){rre(e,i,n,o,r);return}}let s=t.uniform;if(s!==void 0){if(t.uniformNumbers){ire(n,o,r);return}let i=e.intern;if(e.intern=void 0,i!==void 0){for(let c=0;c<o;c++)nt[ue++]=c,Xz(i,e,s,n[c],r),ue--;return}let a=t.uniformInline;for(let c=0;c<o;c++)nt[ue++]=c,a?Vn(e,s,n[c],r):bE(e,s,n[c],r),ue--;return}for(let i=0;i<o;i++){let a=eH(t,i,o);nt[ue++]=i,nA(a)?Vn(e,a,n[i],r):bE(e,a,n[i],r),ue--}}var Sz=[];function ire(e,t,n){let r=!0,o=!0;for(let s=0;s<t;s++){let i=e[s];if(uA(i))(i<0?-i:i)>YC&&(o=!1);else if(r=!1,typeof i!="number")o=!1;else{let a=fA(i);a===0?o=!1:Sz[s]=a}if(!r&&!o)break}if(r){n.byte(Mz);for(let s=0;s<t;s++)n.numberVarint(e[s])}else if(o){n.byte(Pz);for(let s=0;s<t;s++){let i=e[s],a=Number.isInteger(i)?0:Sz[s],c=a===0?i:Math.round(i*Nc[a]),u=c<0||c===0&&1/c<0,f=u?-c:c;n.uvarint((f*2+(u?1:0))*16+a)}}else{n.byte(_z);for(let s=0;s<t;s++)n.f64(e[s])}}function are(e){if(!(e.length<2||e.some(t=>t.tuple)))for(let t of e[0].sentinels){let n=new Map;for(let r of e){let o=r.sentinels.find(s=>s.key===t.key);if(o===void 0||n.has(o.literal)||Number.isNaN(o.literal))break;n.set(o.literal,r)}if(n.size===e.length)return{key:t.key,rows:n}}}function sA(e,t){let n=e.sentinels;for(let r=0;r<n.length;r++){let{key:o,literal:s}=n[r];if(t[o]!==s||!Object.hasOwn(t,o))return!1}return!0}function cre(e,t){return e.tuple?Array.isArray(t)&&sA(e,t):en(t)&&!Array.isArray(t)&&sA(e,t)}function Ez(e,t,n,r){e.positional?r.uvarint(t.position):(r.byte(St.variant),r.u32le(t.tag)),Vn(e,t.payload,n,r)}function ure(e,t,n,r){let o=t.discriminator;if(o!==void 0){if(en(n)&&!Array.isArray(n)){let s=n,i=o.rows.get(s[o.key]);if(i!==void 0&&sA(i,s)){Ez(e,i,n,r);return}}}else for(let s of t.variants)if(cre(s,n)){Ez(e,s,n,r);return}for(let s of t.others)if(rA(s.layout,n)){e.positional?r.uvarint(s.position):r.byte(s.kind),Vn(e,s.layout,n,r);return}throw pn(new st(t.ast,n,e.options))}function Vn(e,t,n,r){switch(t._){case"literal":uh(t,n)||yt(vE(t),n,e.options),Vn(e,t.leaf,n,r);return;case"bool":typeof n!="boolean"&&yt("a boolean",n,e.options),r.byte(n===!0?1:0);return;case"null":n!==null&&yt("null",n,e.options);return;case"undefined":n!==void 0&&yt("undefined",n,e.options);return;case"number":{if(typeof n!="number"&&yt("a number",n,e.options),uA(n)){r.numberVarint(n);return}let o=fA(n);o>0?(r.numberVarint(Math.round(n*Nc[o])),r.byte(o)):r.f64(n);return}case"int":{Number.isSafeInteger(n)||yt("an integer",n,e.options),r.numberVarint(n);return}case"string":{typeof n!="string"&&yt("a string",n,e.options);let o=e.dict;o===void 0?r.string(n):tre(o,t,n,r);return}case"symbol":typeof n!="symbol"&&yt("a symbol",n,e.options),Nne(e,n,r);return;case"bytes":n instanceof Uint8Array||yt("a Uint8Array",n,e.options),r.bytes(n);return;case"bigint":typeof n!="bigint"&&yt("a bigint",n,e.options),r.zigzag(n);return;case"int64":{rA(t,n)||yt(t.flavor==="date"?"a Date":"a DateTime.Utc",n,e.options);let o=t.flavor==="date"?n.getTime():n.epochMilliseconds;Number.isNaN(o)&&yt("a valid Date",n,e.options),r.i64(BigInt(o));return}case"dateTimeZoned":{rA(t,n)||yt("a DateTime.Zoned",n,e.options);let o=n;r.i64(BigInt(o.epochMilliseconds)),o.zone._tag==="Offset"?(r.byte(0),r.i32le(o.zone.offset)):(r.byte(1),r.string(o.zone.id));return}case"duration":{nu(n)||yt("a Duration",n,e.options);let o=n.value;switch(o._tag){case"Infinity":r.byte(1);return;case"NegativeInfinity":r.byte(2);return;case"Nanos":r.byte(0),r.zigzag(o.nanos);return;case"Millis":r.byte(0),r.zigzag(BigInt(o.millis)*une);return}}case"bigDecimal":{Wa(n)||yt("a BigDecimal",n,e.options);let o=Ud(n);r.zigzag(o.value),r.zigzag(BigInt(o.scale));return}case"json":{let o;try{o=JSON.stringify(n)}catch{o=void 0}o===void 0&&(xr(n)&&yt("acyclic value",n,e.options),yt("a JSON-serializable value",n,e.options)),r.string(o);return}case"option":{Ys(n)||yt("an Option",n,e.options);let o=n;o._tag==="None"?r.byte(0):(r.byte(1),Vn(e,t.value,o.value,r));return}case"result":{If(n)||yt("a Result",n,e.options);let o=n;o._tag==="Success"?(r.byte(0),Vn(e,t.success,o.success,r)):(r.byte(1),Vn(e,t.failure,o.failure,r));return}case"exit":{xs(n)||yt("an Exit",n,e.options);let o=n;o._tag==="Success"?(r.byte(0),Vn(e,t.value,o.value,r)):(r.byte(1),Vn(e,t.cause,o.cause,r));return}case"cause":{$f(n)||yt("a Cause",n,e.options);let o=n.reasons;r.uvarint(o.length);for(let s of o){let i=r.beginSized();gz(e,t,s,r),r.endSized(i)}return}case"causeReason":{zf(n)||yt("a Cause.Reason",n,e.options),gz(e,t,n,r);return}case"struct":{(!en(n)||Array.isArray(n))&&yt("an object",n,e.options),e.positional?zne(e,t,n,r):$ne(e,t,n,r);return}case"array":{Array.isArray(n)||yt("an array",n,e.options),sre(e,t,n,r);return}case"union":ure(e,t,n,r);return;case"never":throw pn(new st(t.ast,n,e.options))}}var fE=new SE;function bz(e,t,n,r,o){let s=o.beginSized();o.byte(r.envelope),r.positional&&o.bytes(r.fingerprint),Vn(e,t,n,o),o.endSized(s)}function tH(e,t,n,r,o,s){let i={options:r,positional:o.positional,indexSignatures:void 0,extraShape:void 0,intern:void 0,dict:s},a=fE??new SE,c=a===fE;c&&(fE=void 0),a.reset();let u=ue,f=!1;try{if(n===void 0)ue=0,bz(i,e,t,o,a);else for(let p=0;p<n.length;p++)ue=0,bz(i,e,n[p],o,a);let l=a.out();return f=!0,l}finally{s!==void 0&&(f?Xne(s):ere(s)),a.abort(),ue=u,c&&(fE=a)}}function nH(e,t,n,r,o){return tH(e,void 0,t,n,r,o)}function wE(e,t,n,r,o){return tH(e,t,void 0,n,r,o)}function CE(e){return xs(e)&&Ft(e)}var Rn=globalThis.Symbol.for("~effect/encoding/SchemaBinary/absent");function yr(e,t){let n=oh(e,t);return n!==Rn&&t.pos!==t.end&&Q("no leftover bytes",void 0,t.options),n}function fre(e,t){let n=t.enter(t.uvarint()),r=yr(e,t);return t.exit(n),r}function rH(e,t){if(TE(e))return oh(e,t);let n=kE(e),r=t.enter(n!==void 0?n:e._==="null"||e._==="undefined"?0:t.uvarint()),o=yr(e,t);return t.exit(r),o}var lre=8;function dre(e,t){let n=e.set;if(n!==void 0)return n.has(t)?!0:(n.add(t),!1);let r=e.list;if(r.includes(t))return!0;if(r.length>=lre){let o=e.set=new Set;for(let s=0;s<r.length;s++)o.add(r[s]);o.add(t)}else r.push(t);return!1}function oH(e,t,n,r,o){let s=t.uvarint(),i=Math.floor(o===void 0?s/ns:s/16),a=o===void 0?s-i*ns:Math.floor((s-i*16)/2),c=o===void 0?t.readUtf8(i):pre(o,s,i,t);dre(r,c)&&Q("unique extra keys",void 0,t.options);let u=e.extraAll??(t.indexSignatures??=new th(t.options)).find(e,c);if(u===void 0){xA(a,t);return}nt[ue++]=c;let f=aH(u.layout,u.wireMask,a,t);ue--,f!==Rn&&W(n,c,f)}function pre(e,t,n,r){if((t&1)===1)return n>=e.length&&Q("a known back-reference",void 0,r.options),e[n];let o=r.readUtf8(n);return e.push(o),o}function sH(e){return new Ct([e.name],new sn(e.annotations))}function iH(e,t){throw pn(new At(e.ast,t))}function GC(e){for(;(e.byte()&128)!==0;);}function xA(e,t){switch(e){case af:t.take(t.uvarint());return;case of:GC(t);return;case sh:t.take(8);return;case ih:case ah:case hne:return;case ch:GC(t),GC(t);return;case mne:t.take(4);return}}function iA(e){if(e._==="literal")return iA(e.leaf);switch(e._){case"bool":return 1<<ih|1<<ah;case"number":return 1<<of|1<<sh|1<<ch;case"int":return 1<<of;default:return 1<<af}}function mre(e,t){switch(e){case ih:return!1;case ah:return!0;case of:return t.numberVarint();case sh:return t.f64();case ch:{let n=t.numberVarint(),r=t.uvarint();return(r===0||r>IE)&&Q("a decimal scale in [1, 8]",r,t.options),n/Nc[r]}}return Q("matching field wire kind",void 0,t.options)}function aH(e,t,n,r){if((t&1<<n)===0)return xA(n,r),Rn;if(n!==af){let i=mre(n,r);return e._==="literal"&&!uh(e,i)&&Q(vE(e),i,r.options),i}let o=r.enter(r.uvarint()),s=yr(e,r);return r.exit(o),s}function hre(e,t){let n;e.extra.length>0&&(n=t.intern,t.intern=void 0);let r={},o=0,s=0,i,a,c,u=!1,f=e.fields,l=0;for(;t.pos<t.end;){let p=t.fieldTag(),m=Math.floor(p/ns),h=p-m*ns;if(m===0){u&&Q("unique field ids",void 0,t.options),u=!0,h!==af&&Q("extra field map",void 0,t.options);let E=t.enter(t.uvarint());uH(e,t,r,n),t.exit(E);continue}let g;if(l<f.length&&f[l].id===m?(g=f[l],l++):(g=e.byId.get(m),g!==void 0&&(l=g.index+1)),g===void 0){c===void 0?c=new Set:c.has(m)&&Q("unique field ids",void 0,t.options),c.add(m),xA(h,t);continue}let y=g.index;if(y<32){let E=1<<y;(o&E)!==0&&Q("unique field ids",void 0,t.options),o|=E}else i===void 0?i=new Set([y]):(i.has(y)&&Q("unique field ids",void 0,t.options),i.add(y));nt[ue++]=g.name;let b=aH(g.layout,g.wireMask,h,t);ue--,b!==Rn&&(W(r,g.name,b),y<32?s|=1<<y:(a??=new Set).add(y))}return cH(e,s,a,t),r}function cH(e,t,n,r){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:n?.has(c)===!0;if(!a.optional&&!u&&((s??=[]).push(sH(a)),r.options.errors!=="all"))break}s!==void 0&&iH(e,s)}function gre(e,t){let n;e.extra.length>0&&(n=t.intern,t.intern=void 0);let r={},o=e.optionalCount+7>>3,s=0;o>0&&(t.pos+o>t.end&&Q("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 l=a[f];if(l.optional){let m=(i[s+(c>>3)]&1<<(c&7))!==0;if(c++,!m)continue}nt[ue++]=l.name;let p=l.inline?rH(l.layout,t):fre(l.layout,t);if(ue--,p!==Rn)W(r,l.name,p);else if(!l.optional&&((u??=[]).push(sH(l)),t.options.errors!=="all"))break}if(u!==void 0&&iH(e,u),e.extra.length>0){let f=t.uvarint();if(f>t.remaining&&Q("complete value",void 0,t.options),f>0){let l={list:[],set:void 0};for(let p=0;p<f;p++)oH(e,t,r,l,n)}}return r}function uH(e,t,n,r){let o={list:[],set:void 0};for(;t.pos<t.end;)oH(e,t,n,o,r)}function xre(e,t,n){let r=n.uvarint();if((r&1)===1){let i=(r-1)/2;return i>=e.length&&Q("a known back-reference",void 0,n.options),e[i]}if(t._==="string"){let i=n.readUtf8(r/2);return e.push(i),i}let o=n.enter(r/2),s=yr(t,n);return n.exit(o),e.push(s),s}function yre(e,t,n){let r=new Array(t),o=[],s=[];for(let i=0;i<t;i++){nt[ue++]=i;let a=n.enter(n.uvarint());r[i]=Ere(e,o,s,n),n.exit(a),ue--}return r}function Sre(e,t){let n=t.uvarint(),r=e.fields,o=n&~pE;(n>pE*2-1||o>>>r.length)&&Q("a known row shape",void 0,t.options);let s=[];(n&pE)!==0&&s.push(null);for(let i=0;i<r.length;i++)(o&1<<i)!==0&&s.push(r[i]);return s}function Ere(e,t,n,r){let o=e.struct,s={},i=0,a,c=r.uvarint(),u;if(c===0?r.positional&&e.shapes&&(u=Sre(o,r),t.push(u)):(u=t[c-1],u===void 0&&Q("a known row shape",void 0,r.options)),u!==void 0){for(let f=0;f<u.length;f++){let l=wz(e,n,u[f],s,r);l>=0&&(l<32?i|=1<<l:(a??=new Set).add(l))}r.pos!==r.end&&Q("no leftover bytes",void 0,r.options)}else{let f=e.shapes?[]:void 0,l=0,p,m,h=!1;for(;r.pos<r.end;){let g=r.uvarint(),y;g===0?(h&&Q("unique field ids",void 0,r.options),h=!0,y=null):(y=o.byId.get(g),y===void 0?m===void 0?m=new Set([g]):m.has(g)?Q("unique field ids",void 0,r.options):m.add(g):y.index<32?((l&1<<y.index)!==0&&Q("unique field ids",void 0,r.options),l|=1<<y.index):p===void 0?p=new Set([y.index]):(p.has(y.index)&&Q("unique field ids",void 0,r.options),p.add(y.index))),f?.push(y);let b=wz(e,n,y,s,r);b>=0&&(b<32?i|=1<<b:(a??=new Set).add(b))}f!==void 0&&t.push(f)}return cH(o,i,a,r),s}function wz(e,t,n,r,o){let s=o.uvarint();if((s&1)===1){if(n==null)return-1;let u=t[n.index],f=(s-1)/2;(u===void 0||f>=u.length)&&Q("a known back-reference",void 0,o.options);let l=u[f];return l===Rn?-1:(W(r,n.name,l),n.index)}let i=o.enter(s/2);if(n===null)return uH(e.struct,o,r),o.exit(i),-1;if(n===void 0)return o.exit(i),-1;let a=e.intern[n.index];(a===Lz||a===Bz)&&(o.intern=t[n.index]??=[]),nt[ue++]=n.name;let c=yr(n.layout,o);return ue--,o.intern=void 0,o.exit(i),a===lA&&(t[n.index]??=[]).push(c),c===Rn?-1:(W(r,n.name,c),n.index)}function bre(e,t){let n=e.elements.length,r=e.hasCount?t.uvarint():n;if(e.hasCount&&r>t.remaining+1048576&&Q("array count within allocation limit",r,t.options),e.rest.length===0&&r>n)throw nt[ue++]=n,pn(new da(e.ast,void 0,t.options));if(r<e.minCount)throw nt[ue++]=r,pn(new sn(void 0));if(r>0){let i=Kz(e);if(i!==null)return yre(i,r,t)}let o=new Array(r),s=e.uniform;if(s!==void 0){if(e.uniformNumbers)return wre(o,r,t);let i=t.intern;if(t.intern=void 0,i!==void 0){for(let u=0;u<r;u++){nt[ue++]=u;let f=xre(i,s,t);if(f===Rn)throw pn(new sn(void 0));ue--,o[u]=f}return o}if(TE(s)){for(let u=0;u<r;u++)nt[ue++]=u,o[u]=oh(s,t),ue--;return o}if(s._==="string"){for(let u=0;u<r;u++)nt[ue++]=u,o[u]=t.readUtf8(t.uvarint()),ue--;return o}let a=e.uniformPacked,c=e.uniformInline;for(let u=0;u<r;u++){nt[ue++]=u;let f=t.enter(c?a??0:t.uvarint()),l=yr(s,t);if(t.exit(f),l===Rn)throw pn(new sn(void 0));ue--,o[u]=l}return o}for(let i=0;i<r;i++){let a=eH(e,i,r),c=i<n&&e.elements[i].optional;if(!e.hasCount&&t.remaining===0&&!c&&a._!=="null"&&a._!=="undefined")throw nt[ue++]=i,pn(new sn(void 0));nt[ue++]=i;let u=rH(a,t);if(u===Rn)throw c&&Q("known union member",void 0,t.options),pn(new sn(void 0));ue--,o[i]=u}if(!e.hasCount&&t.pos<t.end)throw nt[ue++]=n,pn(new da(e.ast,void 0,t.options));return o}function wre(e,t,n){let r=n.byte();if(r===_z){n.remaining!==t*8&&Q("f64",void 0,n.options);for(let o=0;o<t;o++)e[o]=n.f64();return e}if(r===Pz){for(let o=0;o<t;o++){nt[ue++]=o;let s=n.uvarint(),i=s%16;i>IE&&Q("decimal",void 0,n.options);let a=Fz((s-i)/16);e[o]=i===0?a:a/Nc[i],ue--}return e}r!==Mz&&Q("f64",void 0,n.options);for(let o=0;o<t;o++)nt[ue++]=o,e[o]=n.numberVarint(),ue--;return e}function Ire(e,t){let n=t.byte();if(n===St.variant){let o=t.u32le(),s=e.byTag.get(o);if(s===void 0)return t.take(t.remaining),Rn;let i=yr(s.payload,t);if(i===Rn)return Rn;if(!s.tuple)for(let a of s.sentinels)W(i,a.key,a.literal);return i}let r=e.byKind.get(n);return r===void 0?(t.take(t.remaining),Rn):yr(r,t)}function vre(e,t){let n=e.byPos[t.uvarint()];n===void 0&&Q("known union member",void 0,t.options);let r=yr(n.layout,t),o=n.variant;if(o!==void 0&&!o.tuple&&r!==Rn)for(let s of o.sentinels)W(r,s.key,s.literal);return r}function Iz(e,t){switch(t.byte()){case 0:return Hf(ud(yr(e.error,t)));case 1:return Wf(ud(yr(e.defect,t)));case 2:return t.remaining!==0&&Q("empty",void 0,t.options),lu();case 3:return t.remaining!==8&&Q("f64",void 0,t.options),lu(t.f64());default:return t.take(t.remaining),Rn}}function ud(e){if(e===Rn)throw pn(new sn(void 0));return e}function oh(e,t){switch(e._){case"literal":{let n=oh(e.leaf,t);return uh(e,n)||Q(vE(e),n,t.options),n}case"bool":{t.remaining!==1&&Q("bool",void 0,t.options);let n=t.byte();return n>1&&Q("bool",void 0,t.options),n===1}case"null":return t.remaining!==0&&Q("empty",void 0,t.options),null;case"undefined":t.remaining!==0&&Q("empty",void 0,t.options);return;case"number":{let n=t.remaining;if(n===8)return t.f64();(n===0||n>Oz)&&Q("f64",void 0,t.options);let r=t.numberVarint();if(t.remaining===0)return r;let o=t.byte();return(t.remaining!==0||o===0||o>IE)&&Q("decimal",void 0,t.options),r/Nc[o]}case"int":return t.numberVarint();case"string":{let n=t.dict;return n===void 0?t.readUtf8(t.end-t.pos):nre(n,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&&Q("int64",void 0,t.options);let n=Number(t.i64());if(e.flavor!=="date")return nU(n);let r=new Date(n);return Number.isNaN(r.getTime())&&Q("a valid Date",n,t.options),r}case"dateTimeZoned":{let n=Number(t.i64()),r=t.byte(),o;if(r===0)t.remaining!==4&&Q("time zone",void 0,t.options),o=t.i32le();else if(r===1)o=t.readUtf8(t.end-t.pos);else return Q("time zone",void 0,t.options);try{return Cx(n,{timeZone:o})}catch{return Q("time zone",void 0,t.options)}}case"duration":switch(t.byte()){case 0:return Br(t.zigzag());case 1:return mo;case 2:return Qi;default:return Q("duration",void 0,t.options)}case"bigDecimal":{let n=t.zigzag(),r=t.zigzag();return(r>QC||-r>QC)&&Q("safe integer length",void 0,t.options),ir(n,Number(r))}case"json":{let n=t.readUtf8(t.end-t.pos);try{return JSON.parse(n)}catch{return Q("json",void 0,t.options)}}case"option":{let n=t.byte();return n===0?(t.remaining!==0&&Q("empty",void 0,t.options),D()):(n!==1&&Q("bool",void 0,t.options),L(ud(yr(e.value,t))))}case"result":{let n=t.byte();return n===0?Ce(ud(yr(e.success,t))):(n!==1&&Q("bool",void 0,t.options),Ae(ud(yr(e.failure,t))))}case"exit":{let n=t.byte();if(n===0)return kn(ud(yr(e.value,t)));n!==1&&Q("bool",void 0,t.options);let r=oh(e.cause,t);return qt(r)}case"cause":{let n=t.uvarint(),r=[];for(let o=0;o<n;o++){nt[ue++]=o;let s=t.enter(t.uvarint()),i=Iz(e,t);t.exit(s),ue--,i!==Rn&&r.push(i)}return t.pos!==t.end&&Q("no leftover bytes",void 0,t.options),Xa(r)}case"causeReason":return Iz(e,t);case"struct":return t.positional?gre(e,t):hre(e,t);case"array":return bre(e,t);case"union":return t.positional?vre(e,t):Ire(e,t);case"never":throw pn(new st(e.ast,void 0,t.options))}}function fH(e,t,n){let r=t.byte();if(r!==n.envelope&&Q(n.expectedEnvelope,r,t.options),n.positional){t.remaining<8&&Q("complete value",void 0,t.options);let s=t.buf,i=n.fingerprint,a=t.pos;for(let c=0;c<8;c++)s[a+c]!==i[c]&&Q("matching layout fingerprint",void 0,t.options);t.pos=a+8}let o=yr(e,t);if(o===Rn)throw pn(new sn(void 0));return o}var lE=new nh;function Tre(e,t,n,r){let o=lE??new nh,s=o===lE;s&&(lE=void 0),o.reset(t,0,t.length,n,void 0,r.positional,void 0);let i=ue;ue=0;try{let a=o.uvarint();a===0&&Q("nonzero frame length",void 0,n);let c=o.enter(a),u=fH(e,o,r);return o.exit(c),o.pos!==t.length&&Q("no leftover bytes",void 0,n),u}finally{ue=i,o.release(),s&&(lE=o)}}function kre(e,t,n,r=!1){return Rr({decode:(o,s)=>{try{let i=Tre(e,o,s,t);return n!==void 0&&hd(i)&&(!r||CE(i))&&(n.value=i),v(i)}catch(i){return i instanceof Li?G(i.issue):go(i)}},encode:(o,s)=>{try{return v(wE(e,o,s,t))}catch(i){return i instanceof Li?G(i.issue):go(i)}}})}var Cre=wn(Dne);function sf(e,t){return t===!0?Cre(e):Une}var Are=wn(e=>{let t=re(mE(e)),{exact:n,exitSuccess:r,layout:o,recursive:s}=_ne(t.ast);return{target:s?Pre(t):t,layout:o,exact:n,exitSuccess:r,recursive:s}});function ld(e){return Are(e.ast)}function lH(e,t){return e.value===void 0||t!==e.value?!1:(e.value=void 0,!0)}function dH(e,t,n){let r=re(yn(e.ast)),o=dt(r),s=i=>()=>(a,c,u)=>i(a,u)?on:o(a,u);return re(new ma([r.ast],s(t),{identifier:"binary value"},void 0,void 0,void 0,void 0,s(n)))}function aA(e,t){return t.onExcessProperty!=="error"}function Rre(e,t,n){return dH(e,r=>lH(t,r),n?aA:Ore)}function Ore(){return!1}function _re(e,t){return An()([e],([n])=>{let r=dt(n);return(o,s,i)=>lH(t,o)||CE(o)&&i.onExcessProperty!=="error"?v(o):r(o,i)},{identifier:"binary exit value"})}function Mre(e){return dH(e,aA,aA)}function Pre(e){let t=re(yn(e.ast)),n=new WeakSet,r=An()([t],([o])=>(s,i,a)=>hd(s)&&n.delete(s)?v(s):xr(s)?G(new st(i,s,a)):dt(o)(s,a),{identifier:"acyclic value"});return Ee(r,vt({decode:o=>(hd(o)&&n.add(o),o),encode:o=>o}))(e)}var lh=Cc,En=class extends Ve()("effect/rpc/RpcSerialization"){},fh=class extends Mn("MaxBufferSizeExceeded"){get message(){return`RPC serialization buffer exceeded the maximum size of ${this.maxBufferSize}`}},hH=16*1024*1024,AE=(e,t)=>t!=="unbounded"&&e>t,gH=En.of({contentType:"application/json",includesFraming:!1,codecFor:lh,makeUnsafe:()=>{let e=new TextDecoder;return{decode:t=>{let n=JSON.parse(typeof t=="string"?t:e.decode(t));return Array.isArray(n)?n:[n]},encode:t=>JSON.stringify(t)}}}),RE=e=>{let t=e?.maxBufferSize??hH;return En.of({contentType:"application/ndjson",includesFraming:!0,codecFor:lh,makeUnsafe:()=>{let n=new TextDecoder,r="",o=s=>{throw r="",new fh({maxBufferSize:s})};return{decode:s=>{r+=typeof s=="string"?s:n.decode(s,{stream:!0});let i=0,a=r.indexOf(`
61
+ `,i),c=[];for(;a!==-1;){AE(a-i,t)&&o(t);let u=JSON.parse(r.slice(i,a));c.push(u),i=a+1,a=r.indexOf(`
62
+ `,i)}return r=r.slice(i),AE(r.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])+`
41
63
  `;return i}return JSON.stringify(s)+`
42
- `}}}})},aH=Tb(),cH=e=>bn.of({contentType:e?.contentType??"application/json",includesFraming:!1,codecFor:fh,makeUnsafe:()=>{let t=new TextDecoder,n=new Map;return{decode:r=>{let o=JSON.parse(typeof r=="string"?r:t.decode(r));return fH(o,n)},encode:r=>{let o=lH(r,n);return o&&JSON.stringify(o)}}}}),uH=e=>bn.of({contentType:e?.contentType??"application/json-rpc",includesFraming:!0,codecFor:fh,makeUnsafe:()=>{let t=Tb({maxBufferSize:e?.maxBufferSize}).makeUnsafe(),n=new Map;return{decode:r=>{let o=t.decode(r);if(o.length===0)return[];let s=[];for(let i=0;i<o.length;i++){let a=o[i];s.push(...fH(a,n))}return s},encode:r=>{let o=lH(r,n);return o&&t.encode(o)}}}});function fH(e,t){if(Array.isArray(e)){let n={size:0,responses:new Map},r=[];for(let o=0;o<e.length;o++){let s=rH(e[o]);r.push(s),s._tag==="Request"&&!s.isNotification&&(n.size++,t.set(s.id,n))}return r}return[rH(e)]}function rH(e){if(Object.hasOwn(e,"method")){let r=e;if(BA(r.id)&&r.method.startsWith("@effect/rpc/")){let o=r.method.slice(12),s=r.params?.requestId;return s?{_tag:o,requestId:s}:{_tag:o}}return{_tag:"Request",id:r.id??"",tag:r.method,payload:r.params??null,headers:r.headers??[],...j(r,"id")?{}:{isNotification:!0},...r.spanId?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{}}}let t=e,n=Object.hasOwn(t,"error");return n&&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:n&&t.error!=null?{_tag:"Failure",cause:t.error._tag==="Cause"?t.error.data:[{_tag:"Die",defect:t.error}]}:{_tag:"Success",value:t.result}}}function oH(e,t){if(!("requestId"in e))return gA(e);let n=t.get(e.requestId);return n?(t.delete(e.requestId),n.responses.set(e.requestId,e),n.size===n.responses.size?Array.from(n.responses.values(),gA):void 0):gA(e)}function lH(e,t){if(Array.isArray(e)===!1)return oH(e,t);if(e.length===0)return;let n=[];for(let o=0;o<e.length;o++){let s=oH(e[o],t);s!==void 0&&n.push(s)}if(n.length===0)return;if(n.length===1)return n[0];let r=[];for(let o=0;o<n.length;o++){let s=n[o];Array.isArray(s)?r.push(...s):r.push(s)}return r}function gA(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(r=>r._tag==="Fail"),n=t?._tag==="Fail"?t.error:void 0;return{jsonrpc:"2.0",id:e.requestId??void 0,error:e.exit._tag==="Failure"?{_tag:"Cause",code:n&&j(n,"code")?Number(n.code):0,message:n&&j(n,"message")?n.message:JSON.stringify(e.exit.cause),data:e.exit.cause}:void 0}}case"Defect":return{jsonrpc:"2.0",id:kre,error:{_tag:"Defect",code:1,message:"A defect occurred",data:e.defect}};case"ClientProtocolError":return{}}}var kre=-32603,xA=e=>{let{maxBufferSize:t=sH,...n}=e??{};return bn.of({contentType:"application/msgpack",includesFraming:!0,codecFor:fh,makeUnsafe:()=>{let r=new Fi(n),o=new Uc(n),s=new TextEncoder,i,a=c=>{throw i=void 0,new uh({maxBufferSize:c})};return{decode(c){let u=typeof c=="string"?s.encode(c):c;if(i!==void 0){vb(i.length+u.length,t)&&a(t);let f=u;c=new Uint8Array(i.length+u.length),c.set(i),c.set(f,i.length),u=c,i=void 0}try{return r.unpackMultiple(u)}catch(f){let l=f;if(l.incomplete)return i=u.subarray(l.lastPosition),vb(i.length,t)&&a(t),l.values??[];throw f}},encode:c=>o.pack(c)}}})},dH=xA({useRecords:!0}),Cre=16*1024*1024,Are=new TextEncoder,Rre=e=>{let t=e?.maxFrameSize??Cre,n=e?.fingerprintPayloads===!0?o=>iA(o,{fingerprint:!0}):iA,r={fingerprint:!0,dictionary:!0};return bn.of({contentType:"application/vnd.effect.rpc+schema-binary",includesFraming:!0,codecFor:n,makeUnsafe:()=>{let o=gz(_C,{...r,maxFrameSize:t}),s=yz(_C,r);return{decode:i=>o.feedSync(typeof i=="string"?Are.encode(i):i),encode:i=>{if(!Array.isArray(i))return s.encode(i);if(i.length!==0)return s.encodeMany(i)}}}})},Ore=ui(bn)(iH),_re=ui(bn)(aH),Mre=e=>ui(bn)(Tb(e)),Pre=e=>ui(bn)(cH(e)),Fre=e=>ui(bn)(uH(e)),Ure=ui(bn)(dH),Dre=e=>ui(bn)(xA(e)),Nre=e=>ow(bn)(()=>Rre(e));var kb=class extends Ke()("effect/rpc/RpcWorker/InitialMessage"){};var mH=e=>K(()=>{let t=new Set,n=new Map,r=new Map,o=(s,i)=>cr(a=>{let c=n.get(s);return c||(c=[],n.set(s,c)),c.push([i,a]),H});return Y(e((s,i)=>{let a=r.get(s);return a?a(i):o(s,i)},t),s=>({...s,run(i,a){return $t(function*(){t.add(i),r.set(i,a);let c=n.get(i);if(c){n.delete(i);for(let[u,f]of c)yield*Nn(K(()=>a(u)),f)}return yield*ur(Kr,()=>(t.delete(i),r.delete(i),H))})}}))});var Bre=e=>yr(e,"RpcClientError"),jre=0,hH=Se(function*(e,t){let n=t?.spanPrefix??"RpcClient",r=t?.supportsAck??!0,o=t?.disableTracing??!1,s=t?.generateRequestId??(()=>jre++),i=yield*ar(),a=$e(i,It),c=new Map,u=!1;yield*_t(a,xn(b=>(u=!0,f(Wg(b.id)))));let f=Se(function*(b){for(let[y,w]of c)c.delete(y),w._tag==="Queue"?yield*b._tag==="Success"?Jp(w.queue):Zt(w.queue,b.cause):w.resume(b)}),l=b=>{let y=Km(b.successSchema),w=h(b);return(S,C)=>{let M=C?.headers?Oi(C.headers):Yl,_=C?.context??Et();if(!y){let $=F=>p(b,w,F,b.payloadSchema.make(S),M,_,C?.discard??!1);return o?$(void 0):pp(`${n}.${b._tag}`,{attributes:t.spanAttributes},$)}let P=m(b,w,b.payloadSchema.make(S),M,C?.streamBufferSize??16,_);return C?.asQueue?P:mr(Y(P,Ci))}},p=(b,y,w,S,C,M,_)=>xn(P=>{if(u)return xo;let $=s(),F=y(ee=>t.onFromClient({message:ee,context:M,discard:_}),{_tag:"Request",id:$,tag:b._tag,payload:S,...w?{traceId:w.traceId,spanId:w.spanId,sampled:w.sampled}:{},headers:Xl(P.getRef(Cb),C)});if(_)return F;let te;return pi(ws(ee=>{let T={_tag:"Effect",rpc:b,context:M,resume(z){ee(z),te&&!te.pollUnsafe()&&P.currentDispatcher.scheduleTask(()=>{te.interruptUnsafe(P.id)},0)}};c.set($,T),te=F.pipe(w?sl(w,{captureStackTrace:!1}):B,Ln(P.context)),te.addObserver(z=>{if(z._tag==="Failure")return ee(z)})}),ee=>(c.delete($),Dn(bo(te),g($,Array.from(ee),M))))}),m=Se(function*(b,y,w,S,C,M){if(u)return yield*xo;let _=o?void 0:yield*Jw(`${n}.${b._tag}`,{attributes:t.spanAttributes}),P=Ei(),$=s(),F=Jn(P.context,It);yield*Do(F,ee=>c.has($)?(c.delete($),g($,ii(ee)?Array.from(xP(ee.cause)):[],M)):H);let te=yield*Uu(C);return c.set($,{_tag:"Queue",rpc:b,queue:te,scope:F,context:M}),yield*y(ee=>t.onFromClient({message:ee,context:M,discard:!1}),{_tag:"Request",id:$,tag:b._tag,payload:w,..._?{traceId:_.traceId,spanId:_.spanId,sampled:_.sampled}:{},headers:Xl(P.getRef(Cb),S)}).pipe(_?sl(_,{captureStackTrace:!1}):B,ft(ee=>Zt(te,ee)),ua,Ut(F,{startImmediately:!0})),te}),h=b=>{let y=[];for(let w of b.middlewares.values()){let S=Ji(i,`${w.key}/Client`);S&&y.push(S)}return y.length===0?(w,S)=>w(S):function w(S,C,M=y.length-1){return M===-1?S(C):y[M]({rpc:b,request:C,next(_){return w(S,_,M-1)}})}},g=(b,y,w)=>ws(S=>{let C=Ei();t.onFromClient({message:{_tag:"Interrupt",requestId:b,interruptors:y},context:w,discard:!1}).pipe(Dw(1e3),Ln(C.context)).addObserver(()=>{S(H)})}),x=b=>{switch(b._tag){case"Chunk":{let y=b.requestId,w=c.get(y);return!w||w._tag!=="Queue"?H:wa(w.queue,b.values).pipe(r?R(()=>t.onFromClient({message:{_tag:"Ack",requestId:b.requestId},context:w.context,discard:!1})):B,ft(S=>Zt(w.queue,S)))}case"Exit":{let y=b.requestId,w=c.get(y);return w?(c.delete(y),w._tag==="Effect"?(w.resume(b.exit),H):b.exit._tag==="Success"?Jp(w.queue):Zt(w.queue,b.exit.cause)):H}case"Defect":return f(Hg(b.defect));case"ClientEnd":return H}},E;if(t.flatten){let b=new Map;E=function(w,S,C){let M=b.get(w);return M||(M=l(e.requests.get(w)),b.set(w,M)),M(S,C)}}else E={},e.requests.forEach(b=>{W(E,b._tag,l(b))});return{client:E,write:x}}),qre=0,yA=Se(function*(e,t){let n=qre++,{codecFor:r,run:o,send:s,supportsAck:i,supportsTransferables:a}=yield*Ni,c=$re(r),u=xm(r(ln())),f=new Map,{client:l,write:p}=yield*hH(e,{...t,supportsAck:i,onFromClient({message:m}){switch(m._tag){case"Request":{let h=e.requests.get(m.tag),g=a?b$():void 0,x=Ei(),E={rpc:h,context:g?Ve(x.context,Wm,g):x.context,schemas:c(h)};return f.set(m.id,E),E.schemas.encodePayload(m.payload).pipe(Nn(E.context),di,R(b=>s(n,{...m,id:m.id,payload:b,headers:Object.entries(m.headers)},g&&g.readUnsafe())))}case"Ack":return f.get(m.requestId)?s(n,{_tag:"Ack",requestId:m.requestId}):H;case"Interrupt":return f.get(m.requestId)?(f.delete(m.requestId),s(n,{_tag:"Interrupt",requestId:m.requestId})):H;case"Eof":return H}}});return yield*o(n,m=>{switch(m._tag){case"Chunk":{let h=Gm(m.requestId),g=f.get(h);return!g||xe(g.schemas.decodeChunk)?H:g.schemas.decodeChunk.value(m.values).pipe(Nn(g.context),di,R(x=>p({_tag:"Chunk",clientId:0,requestId:Gm(m.requestId),values:x})),go(x=>p({_tag:"Exit",clientId:0,requestId:Gm(m.requestId),exit:jt(x)})))}case"Exit":{let h=Gm(m.requestId),g=f.get(h);return g?(f.delete(h),g.schemas.decodeExit(m.exit).pipe(Nn(g.context),di,Jr({onSuccess:x=>p({_tag:"Exit",clientId:0,requestId:h,exit:x}),onFailure:x=>p({_tag:"Exit",clientId:0,requestId:h,exit:jt(x)})}))):H}case"Defect":return p({_tag:"Defect",clientId:0,defect:u(m.defect)});case"ClientProtocolError":{let h=Fo(m.error);return Lo(f.keys(),g=>p({_tag:"Exit",clientId:0,requestId:g,exit:h}))}default:return H}}).pipe(ft(hp),ua,Is),l}),$re=e=>{let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=ZS(n.successSchema);return r={decodeChunk:Lt(o,s=>wc(e(fS(s.success)))),encodePayload:cS(e(n.payloadSchema)),decodeExit:wc(e(RC(n)))},t.set(n,r),r}},Cb=Me("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>Yl}),zre=d(2,(e,t)=>zw(e,Cb,Xl(Oi(t)))),Ni=class extends Ke()("effect/rpc/RpcClient/Protocol"){static make=mH},gH=e=>Ni.make(Se(function*(t){let n=yield*bn,r=n.includesFraming,o=u=>new Hs({reason:ed.fromHttpClientError(u)}),s=(u,f)=>new Hs({reason:new Mc({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:Se(function*(u,f){if(f._tag!=="Request")return;let l=n.makeUnsafe(),p=l.encode(f),m=typeof p=="string"?Vk(p,n.contentType):FS(p,n.contentType),h=yield*e.post("",{body:m}).pipe(ol(o));if(!r){let E=yield*h.text.pipe(ol(o)),b=yield*Bo({try:()=>l.decode(E),catch:S=>s("Error decoding HTTP response",S)});if(!Array.isArray(b))return yield*s("Expected an array of responses",b);if(b.length===0)return yield*i(f);let y=!1,w=0;return yield*Qn({while:()=>w<b.length,body:()=>{let S=b[w++];return MC(S)&&(y=!0),t(u,S)},step:En}),y?void 0:yield*a(f)}let g=!1,x=!1;if(yield*Ql(h.stream,E=>Bo({try:()=>E.flatMap(l.decode),catch:b=>s("Error decoding HTTP response",b)}).pipe(R(b=>{if(b.length===0)return H;g=!0;let y=0;return Qn({while:()=>y<b.length,body:()=>{let w=b[y++];return MC(w)&&(x=!0),t(u,w)},step:En})}))).pipe(ol(E=>Bre(E)?E:o(E))),g){if(!x)return yield*a(f)}else return yield*i(f)}),supportsAck:!1,supportsTransferables:!1,codecFor:n.codecFor}})),Hre=e=>Hr(Ni)(R(nC,t=>(t=i$(t,Yq(e.url)),gH(e.transformClient?e.transformClient(t):t)))),xH=e=>Ni.make(Se(function*(t,n){let r=yield*f$,o=yield*bn,s=yield*Eu(dh),i=new Map,a=yield*r.writer,c=o.makeUnsafe(),u=yield*Kre(K(()=>a(c.encode(v$)))),f,l=K(()=>(f=void 0,Te(s)?s.value.onConnect:H)),p=h=>Lo(n,g=>t(g,h)),m=h=>(f=h,p({_tag:"ClientProtocolError",error:h}));return yield*K(()=>(c=o.makeUnsafe(),u.reset(),r.runRaw(h=>{try{let g=c.decode(h);if(g.length===0)return;let x=0;return Qn({while:()=>x<g.length,body:()=>{let E=g[x++];if(E._tag==="Pong")return u.onPong(),H;if(Object.hasOwn(E,"requestId")){let b=E.requestId,y=i.get(b);if(y!==void 0)return E._tag==="Exit"&&i.delete(b),t(y,E)}return p(E)},step:En})}catch(g){return p({_tag:"ClientProtocolError",error:new Hs({reason:new Mc({message:"Error decoding message",cause:g})})})}},{onOpen:l}).pipe(sc(R(u.timeout,()=>G(new nd({reason:new Lm({kind:"Timeout",cause:new Error("ping timeout")})}))))))).pipe(R(()=>G(new nd({reason:new Bm({code:1e3})}))),Te(s)?ca(s.value.onDisconnect):B,fp(h=>{let g=Kf(h),x=Kt(g),E=new Hs({reason:x?g.success.reason:new Mc({message:"Unknown socket error",cause:du(h)})});return e?.retryTransientErrors&&x&&g.success.reason._tag==="SocketOpenError"?(e.onTransientError?.(E)??H).pipe(Uw({log:!0,message:"RpcClient onTransientError hook failed"})):m(E)}),Pw(e?.retryPolicy??Wre,h=>m(new Hs({reason:h.reason}))),xx({module:"RpcClient",method:"makeProtocolSocket"}),Is),{send(h,g){if(f)return G(f);g._tag==="Request"&&i.set(g.id,h);let x=c.encode(g);return x===void 0?H:di(a(x))},supportsAck:!0,supportsTransferables:!1,codecFor:o.codecFor}})),Wre=uF([fF(500,1.5),Xf(5e3)]),Kre=Se(function*(e){let t=!0,n=fr(),r=()=>{t=!0,n.closeUnsafe()},o=()=>{t=!0};return yield*K(()=>t?(t=!1,e):n.open).pipe(aa("5 seconds"),Fw,Ht,ua,Is),{timeout:n.await,reset:r,onPong:o}}),Vre=e=>Hr(Ni)(xH(e)),yH=e=>Ni.make(Se(function*(t,n){let r=yield*GS,o=yield*$o,s=0,i=yield*Eu(kb),a=yield*Eu(dh),c=new Map,u=m=>Lo(n,h=>t(h,m)),f=$t(function*(){let m=s++,h=yield*r.spawn(m);return yield*h.run(g=>{if(g._tag==="Exit"){let x=c.get(g.requestId);if(x)return c.delete(g.requestId),x.latch.openUnsafe(),t(x.clientId,g)}else if(g._tag==="Defect"){for(let[x,E]of c)c.delete(x),E.latch.openUnsafe();return u(g)}else if("requestId"in g){let x=c.get(g.requestId);if(x)return t(x.clientId,g)}return u(g)},{onSpawn:Te(i)?R(i.value,([g,x])=>di(h.send({_tag:"InitialMessage",value:g},x))):void 0}).pipe(fp(g=>{for(let[E,b]of c)b.worker===h&&(c.delete(E),b.latch.openUnsafe());let x=Kf(g);return u({_tag:"ClientProtocolError",error:new Hs({reason:Kt(x)?x.success.reason:new Mc({message:"Error in worker",cause:du(g)})})})}),px(Xf(1e3)),xx({module:"RpcClient",method:"makeProtocolWorker"}),ua,Is),h}),l="minSize"in e?yield*pq({acquire:f,min:e.minSize,max:e.maxSize,concurrency:e.concurrency,targetUtilization:e.targetUtilization,timeToLive:e.timeToLive}):yield*dq({acquire:f,size:e.size,concurrency:e.concurrency,targetUtilization:e.targetUtilization});yield*_t(o,se(()=>{for(let m of c.values())m.latch.openUnsafe();c.clear()}));let p=(m,h,g)=>{switch(h._tag){case"Request":return Mk(l).pipe(R(x=>{let E=fr(!1);return c.set(h.id,{clientId:m,worker:x,latch:E}),R(x.send(h,g),()=>E.await)}),wu,di);case"Interrupt":{let x=c.get(h.requestId);return x?(c.delete(h.requestId),x.latch.openUnsafe(),di(x.worker.send(h))):H}case"Ack":{let x=c.get(h.requestId);return x?di(x.worker.send(h)):H}}return H};return yield*wu(Mk(l)),Te(a)&&(yield*a.value.onConnect),{send:p,supportsAck:!0,supportsTransferables:!0,codecFor:Cc}})),Jre=qc(yH,Hr(Ni)),dh=class extends Ke()("effect/rpc/RpcClient/ConnectionHooks"){};var Ab="~effect/reactivity/Atom",EH=e=>j(e,Ab),bA="~effect/reactivity/Atom/Writable",hh=d(2,(e,t)=>{let n=gt(t),r=fs(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Tn(n):void 0})}),cf=hh(0),wA={[Ab]:Ab,equals:Object.is,...vn,toJSON(){return{_id:"Atom",keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},Gre={...wA,atom(e,t){let n=wH(e,t);return Li(r=>{let o=r.self(),s=r(this);return s._tag!=="Success"?qm(s,o):n(r,s.value)})},fn(e,t){return arguments.length===0?(n,r)=>SH(this,n,r):SH(this,e,t)},pull(e,t){let n=cf(IA(0)),r=Li(o=>{let s=o.self(),i=o(this);return i._tag!=="Success"?qm(i,s):Rb(o,soe(o,n,e,t),Oa(!0),i.value)});return ioe(n,r)},subscriptionRef(e){return noe(cf(Li(t=>{let n=t.self(),r=t(this);if(r._tag!=="Success")return qm(r,n);let o=typeof e=="function"?e(t):e;return Fm(o)?o:Rb(t,o,Oa(!0),r.value)})),(t,n)=>{let r=dC(t(this));return toe(t,n,r)})}},SH=(e,t,n)=>{let[r,o,s]=ooe(n?.reactivityKeys?(i,a)=>{let c=t(i,a);return Cr(c)?kS(c,n.reactivityKeys):Mm(c,CS(n.reactivityKeys))}:t,n);return gh(i=>{i.get(s);let a=i.self(),c=i.get(e);return c._tag!=="Success"?qm(c,a):r(i,c.value)},o)},Zre={...wA,[bA]:bA},Qre=e=>bA in e,Li=(e,t)=>{let n=Object.create(wA);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},gh=(e,t,n)=>{let r=Object.create(Zre);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function Yre(e,t){e.setSelf(t)}var mh=(e,t)=>{let n=wH(e,t);return Ab in n?n:Li(n)},wH=(e,t)=>{if(typeof e=="function"&&!Cr(e)&&!Ue(e)){let n=e;return function(r,o){let s=n(r);switch(typeof s){case"function":case"object":return s===null?s:IH in s?EA(r,s,t,o):Xre in s?bH(r,s,t,o):s;default:return s}}}else{if(Cr(e))return function(n,r){return EA(n,e,t,r)};if(Ue(e))return function(n,r){return bH(n,e,t,r)}}return IA(e)},IH="~effect/Effect",Xre="~effect/Stream",IA=e=>gh(function(t){return e},Yre),EA=(e,t,n,r)=>{let o=n?.initialValue!==void 0?Qo(n.initialValue):Oa();return Rb(e,t,o,r,n?.uninterruptible)};function Rb(e,t,n,r=Et(),o=!1){let s=e.self(),i=zr();e.addFinalizer(()=>{Ln(r)(Je(i,Vt))});let a,c=!1,u=vA(r.pipe(Ve(It,i),Ve(JS,e.registry),Ve(Ka,e.registry.scheduler)),t,function(f){a=fC(f,s),c&&e.setSelf(a)},o);return c=!0,u!==void 0&&e.addFinalizer(u),a!==void 0?a:s._tag==="Some"?VS(s):jm(n)}function vA(e,t,n,r=!1){if(gs(t)){n(t);return}let s=Ln(e)(t);s.currentDispatcher?.flush();let i=s.pollUnsafe();if(i){n(i);return}let a=s.addObserver(n);function c(){a(),r||s.interruptUnsafe()}return c}function eoe(e){let t=e?.memoMap??cf(mh(()=>ai())),n=i=>EH(t)?i(t):t,r=AS;function o(i){let a=Object.create(Gre);a.keepAlive=!1,a.lazy=!0,a.refresh=void 0,a.factory=o;let c=AA(Li(typeof i=="function"?u=>Qd(i(u),r):()=>Qd(i,r)));return a.layer=c,a.read=function(f){let l=f(c),p=R($o,m=>ci(l,n(f),m));return EA(f,p,{uninterruptible:!0})},a}o.memoMap=t,o.addGlobalLayer=i=>{r=Qd(r,ys(i,AS))};let s=cf(mh(i=>cr(a=>ci(AS,n(i),$e(a,It))).pipe(Y($e(Ri)))));return o.withReactivity=i=>a=>aoe(a,c=>{let u=dC(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 TA=eoe(),Tme=TA.withReactivity,bH=(e,t,n,r)=>{let o=n?.initialValue!==void 0?Qo(n.initialValue):Oa();return kA(e,t,o,r)};function kA(e,t,n,r=Et()){let o=e.self();r=Ve(r,JS,e.registry);let s=dp(a=>R(Ko(t.channel,a),c=>Qn({while:Xt,body:()=>c,step(u){e.setSelf(Qo(Tf(u),{waiting:!0}))}}))).pipe(ft(a=>(No(a)?lf(e.self(),is(lC),rr({onNone:()=>e.setSelf(h$(new Vf,{previous:e.self()})),onSome:c=>e.setSelf(Qo(c))})):e.setSelf(od(a,{previous:e.self()})),H))),i=vA(r.pipe(Ve(JS,e.registry),Ve(Ka,e.registry.scheduler)),s,En,!1);return i!==void 0&&e.addFinalizer(i),o._tag==="Some"?VS(o):jm(n)}var toe=(e,t,n=Et())=>Fm(t)?(e.addFinalizer(Nk(t).pipe(Ql(r=>{for(let o=0;o<r.length;o++)e.setSelf(r[o]);return H}),Gw(n))),Yw(n)(bq(t))):t._tag!=="Success"?t:kA(e,Nk(t.value),Oa(!0),n),noe=(e,t)=>{function n(r,o){let s=r.get(e);Fm(s)?hi(Lk(s,o)):rd(s)&&hi(Lk(s.value,o))}return gh(r=>{let o=r(e);return Fm(o)||rd(o)?t(r,o):o},n)};var roe=Symbol.for("effect/reactivity/atom/Atom/Reset"),SA=Symbol.for("effect/reactivity/atom/Atom/Interrupt");function ooe(e,t){let n=cf(IA([0,void 0])),r=t?.initialValue!==void 0?Qo(t.initialValue):Oa(),o=t?.concurrent?cf(Li(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,l]=a.get(n);if(f===0)return r;if(l===SA)return od(hP(),{previous:a.self()});let p=e(l,a);return IH in p?(u&&(p=R(al(p,{startImmediately:!0}),h=>(u.add(h),h.addObserver(()=>u.delete(h)),Y(iy(u),g=>g[0])))),Rb(a,p,r,c,!1)):kA(a,p,r,c)}function i(a,c){uoe(()=>{c===roe?a.set(n,[0,void 0]):c===SA?a.set(n,[a.get(n)[0]+1,SA]):a.set(n,[a.get(n)[0]+1,c]),a.refreshSelf()})}return[s,i,n]}var soe=(e,t,n,r)=>R(Ck(typeof n=="function"?n(e):n),o=>{let i=Ei().context,a=rn(),c=Jr(o,{onFailure(f){return No(f)?Ye(a)?v({done:!0,items:a}):G(new Vf("Atom.pull: no items")):ct(f)},onSuccess(f){let l;return r?.disableAccumulation?l=f:(l=vf(a,f),a=l),v({done:!1,items:l})}}),u=new Set;return e.addFinalizer(()=>{for(let f of u)f()}),e.once(t),e.subscribe(t,()=>{e.setSelf(VS(e.self()));let f;f=vA(i,c,l=>{f&&u.delete(f);let p=fC(l,e.self()),m=u.size>0;e.setSelf(m?jm(p):p)}),f&&u.add(f)}),c}),ioe=(e,t)=>gh(t.read,function(n,r){n.set(e,n.get(e)+1)}),CA=typeof WeakRef>"u"||typeof FinalizationRegistry>"u"?e=>{let t=hc();return function(n){let r=Os(t,n);if(r._tag==="Some")return r.value;let o=e(n);return gc(t,n,o),o}}:e=>{let t=hc(),n=new FinalizationRegistry(r=>{Mu(t,r)});return function(r){let o=Os(t,r).pipe(dE(i=>i.deref()));if(o._tag==="Some")return o.value;let s=e(r);return gc(t,r,new WeakRef(s)),n.register(s,r),s}};var AA=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0});var aoe=d(e=>EH(e[0]),(e,t,n)=>{let r=cf(Qre(e)?gh(o=>t(o,e),function(o,s){o.set(e,s)},e.refresh??function(o){o(e)}):Li(o=>t(o,e),e.refresh??function(o){o(e)}));return n?.initialValueTarget&&(r.initialValueTarget=coe(n.initialValueTarget)),r}),coe=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t};var uoe=x$;var foe="~effect-atom/atom/Atom/Serializable";var RA=d(2,(e,t)=>{let n=Cc(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,new Error().stack?.split(`
43
- `)[5]??""],[foe]:{key:t.key,encode:NT(n),decode:xm(n)}})});var TH=()=>(e,t)=>{let n=Ke()(e),r=Hr(n,t.makeEffect??yA(t.group,{...t,flatten:!0})),o=t.runtime??TA;n.runtime=o(typeof t.protocol=="function"?i=>ys(r,Yg(t.protocol(i))):ys(r,Yg(t.protocol))),n.mutation=CA(i=>{let a=t.group.requests.get(i);return n.runtime.fn()(Se(function*({headers:c,payload:u,reactivityKeys:f}){let p=(yield*n)(i,u,{headers:c});return yield*f?kS(p,f):p})).pipe(RA({key:`AtomRpc:mutation:${i}`,schema:pC({success:a.successSchema,error:vH(a)})}))});let s=CA(i=>{let{headers:a,payload:c,reactivityKeys:u,tag:f,timeToLive:l}=i,p=t.group.requests.get(f),m=Km(p.successSchema),h=m?n.runtime.pull(mr(n.use(g=>v(g(f,c,{headers:a}))))):n.runtime.atom(n.use(g=>g(f,c,{headers:a})));return u&&(h=n.runtime.factory.withReactivity(u)(h)),!m&&i.serializationKey&&(h=RA(h,{key:`AtomRpc:${i.tag}:${i.serializationKey}`,schema:pC({success:p.successSchema,error:vH(p)})})),l&&(h=fs(l)?hh(h,l):AA(h)),h});return n.query=(i,a,c)=>{let u={tag:i,payload:a,headers:c?.headers?Oi(c.headers):void 0,reactivityKeys:c?.reactivityKeys,timeToLive:c?.timeToLive?gt(c.timeToLive):void 0,serializationKey:c?.serializationKey};return s(u)},n},vH=e=>He([e.errorSchema,...Array.from(e.middlewares,t=>t.error),Hs]);var Ob={};ns(Ob,{make:()=>poe});var doe={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return Ma({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[o,s]of r.requests)t.set(o,s);for(let[o,s]of r.annotations.mapUnsafe)n.set(o,s)}return Ma({requests:t,annotations:Mo(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return Ma({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return Ma({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return $t(function*(){let n=yield*ar(),r=Cr(e)?yield*e:e,o=new Map;return t.requests.forEach((s,i)=>{o.set(s.key,{tag:s._tag,handler:r[i],context:n})}),Mo(o)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return Ma({requests:t,annotations:this.annotations})},toLayer(e){return Gf(this.toHandlers(e))},of:B,toLayerHandler(e,t){let n=this;return Gf($t(function*(){let r=yield*ar(),o=Cr(t)?yield*t:t,s=new Map,i=n.requests.get(e);return s.set(i.key,{handler:o,context:r}),Mo(s)}))},accessHandler(e){return cr(t=>{let n=this.requests.get(e),{handler:r,context:o}=Ji(t,n.key);return v((s,i)=>{i.rpc=n;let a=r(s,i),c=id(a)?a.value:a;return Cr(c)?qw(c,o):Tk(c,o)})})},annotate(e,t){return Ma({requests:this.requests,annotations:Ve(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(cs(e,t))},annotateMerge(e){return Ma({requests:this.requests,annotations:br(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(br(e,r.annotations)));return Ma({requests:t,annotations:this.annotations})}},Ma=e=>Object.assign(function(){},doe,{requests:e.requests,annotations:e.annotations}),poe=(...e)=>Ma({requests:new Map(e.map(t=>[t._tag,t])),annotations:Et()});var kH=A.Union([A.Struct({_tag:A.Literal("List"),collection:A.String}),A.Struct({_tag:A.Literal("Item"),collection:A.String,id:A.Union([A.String,A.Number])})]),uf=(e,t)=>({item:n=>({_tag:"Item",collection:e,id:n}),list:{_tag:"List",collection:e},name:e}),CH=e=>e._tag==="List"?e.collection:`${e.collection}:${e.id}`,_b=e=>[...new Set(e.map(CH))],Mb=e=>[...new Set(e.flatMap(t=>t._tag==="List"?[t.collection]:[CH(t),t.collection]))];var moe=le.fn("EffectContract.invalidateAfter")(function*(e){yield*CS(Mb(e))});function hoe(e,t,n){function r(o){return _b(n.reads(o))}return{query:(o,s={})=>e.query(t,o,{...s,reactivityKeys:r(o)}),run:o=>e.use(s=>s(t,o))}}function goe(e,t,n){return{run:r=>e.use(o=>o(t,r)).pipe(le.tap(o=>moe(n.invalidates(r,o))))}}function _A(e,t){let{name:n,queries:r,commands:o}=e.declaration;return Object.fromEntries([...r.map(s=>[s.name,hoe(t,`${n}.${s.name}`,s)]),...o.map(s=>[s.name,goe(t,`${n}.${s.name}`,s)])])}var AH=A.Union([A.Struct({_tag:A.Literal("Changed"),keys:A.Array(kH)}),A.Struct({_tag:A.Literal("Resync")})]),xoe=256;function RH(e,t){let n=mh(!1),r=mh({connection:"connecting",failure:Le.none(),needsResync:!0,pending:0});return{connection:e.atom(s=>le.gen(function*(){s.mount(r);let i=yield*Ri;function a(f){s.set(r,{...s.once(r),...f})}function c(){if(s.once(n)){a({needsResync:!0});return}i.invalidateUnsafe(_b(t.resyncKeys)),a({needsResync:!1,pending:0})}s.subscribe(n,f=>{f||c()}),t.resume!==void 0&&(s.once(t.resume),s.subscribe(t.resume,c));let u=le.suspend(()=>{let f=!0;function l(p){a({connection:"live",failure:Le.none()}),s.once(n)?a({needsResync:!0,pending:Math.min(xoe,s.once(r).pending+1)}):f||p._tag==="Resync"?c():i.invalidateUnsafe(Mb(p.keys)),f=!1}return t.stream.pipe(nr.runForEach(p=>le.sync(()=>l(p))),le.scoped,le.catchCause(p=>le.sync(()=>a({failure:Le.some(p)}))),le.andThen(le.sync(()=>a({connection:"reconnecting",needsResync:!0}))),le.andThen(le.sleep(t.retryDelay??"1 second")))});yield*le.forever(u)})).pipe(hh(0)),paused:n,status:r}}function OH(e,t){return n=>{function r(){e.document.visibilityState==="visible"&&n()}return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}}function _H({window:e,native:t}){let n=e===void 0?[]:[OH(e,"visibilitychange"),OH(e,"online")],r=t===void 0?n:[...n,t];return Li(o=>{let s=0;function i(){s+=1,o.setSelf(s)}for(let a of r)o.addFinalizer(a(i));return s})}var yoe=e=>{let t=e.map(({name:n})=>n).filter((n,r,o)=>o.indexOf(n)!==r);if(t.length>0)throw new Error(`Operation names must be unique; duplicated: ${[...new Set(t)].join(", ")}`)},MH=(e,t)=>{let n=e.middleware.bind(e);return Object.assign(e,{declaration:t,middleware:r=>MH(n(r),t)})};function Pb(e,t){let{queries:n=[],commands:r=[]}=t;yoe([...n,...r]);let o=[...n,...r].map(s=>_c.make(`${e}.${s.name}`,{error:s.error,payload:s.payload,success:s.success}));return MH(Ob.make(...o),{commands:r,name:e,queries:n})}function PH(e){let t=Object.entries(e).map(([n,r])=>[n,A.isSchema(r)?r:A.TaggedError()(n,r)]);return{error:t.length===0?A.Never:A.Union(t.map(([,n])=>n)),Rejection:Object.fromEntries(t),reject:Object.fromEntries(t.map(([n,r])=>[n,(...o)=>le.fail(Reflect.construct(r,o))]))}}var Soe=e=>e===void 0?A.Void:A.isSchema(e)?e:A.Struct(e),FH=(e,t,n)=>{let{payload:r,success:o,rejections:s={}}=n;return{kind:e,name:t,payload:Soe(r),rejections:s,success:o??A.Void,...PH(s)}};function Bi(e,t){return{...FH("query",e,t),reads:t.reads}}function MA(e,t){return{...FH("command",e,t),invalidates:t.invalidates}}function boe(e){return e.startsWith(".")||e==="node_modules"}function UH(e){return e.endsWith(".md")&&!e.split("/").some(boe)}var Eoe=A.String.check(A.makeFilter(e=>UH(e)&&!e.includes("\\")&&!e.includes("\0")&&e.split("/").every(t=>t.length>0&&t!=="..")||"Expected a relative readable Markdown path")),woe=A.String.check(A.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 observation time with timezone")),Qme=A.Struct({documents:A.Array(A.Struct({file:Eoe,source:A.String})).check(A.makeFilter(e=>new Set(e.map(t=>t.file)).size===e.length||"Duplicate source paths are not a complete observation")),recordedAt:woe,version:A.Literal(1)}).pipe(A.encodeKeys({recordedAt:"recorded_at"})),DH=A.Struct({action:A.Literals(["check","compare","observe"]),baseline:A.NullOr(A.String)}),NH=A.Struct({discardBaseline:A.Boolean,html:A.String,reason:A.String,snapshot:A.NullOr(A.String)});var Ws=A.String.check(A.isPattern(/^[a-zA-Z\d][a-zA-Z\d._-]*$/u));var xh=A.String.check(A.isPattern(/^[a-f\d]{64}$/u)),Fb=A.Literals(["answer","clarify","not_now"]),Ioe=A.Struct({deadline:A.Number.check(A.isFinite(),A.isGreaterThanOrEqualTo(0),A.isLessThanOrEqualTo(864e13)),item:Ws,reason:A.String,registeredAt:A.Number.check(A.isFinite(),A.isGreaterThanOrEqualTo(0),A.isLessThanOrEqualTo(864e13)),request:Ws,reviewedRevision:xh,source:A.String}),LH=A.Struct({author:A.String.check(A.isPattern(/\S/u),A.isMaxLength(200)),question:Ws,recordedAt:A.Number.check(A.isFinite(),A.isGreaterThanOrEqualTo(0),A.isLessThanOrEqualTo(864e13)),reviewedRevision:xh,type:Fb}),BH=A.Struct({context:A.String,id:Ws,item:Ws,reason:A.String,request:Ws,reviewedRevision:xh,source:A.String}),Ub=A.Struct({context:A.String,id:Ws,question:Ioe}),Db=A.Struct({body:A.String,id:Ws,response:LH}),jH=A.Struct({question:Ub,responses:A.Array(Db)}),qH=A.Struct({expired:A.Boolean,question:Ub,response:A.optional(Db)}),ji=class extends A.TaggedError()("ResponseFailed",{cause:A.optional(A.Defect()),code:A.Literals(["Disabled","Missing","Stale","Conflict","Unavailable","Unsupported","Uncertain","Unanswered"]),message:A.String}){},$H=A.Struct({author:LH.fields.author,body:A.String.check(A.isPattern(/\S/u),A.isMaxLength(32768)),id:Ws,question:Ws,type:Fb});var Dr=uf("work-board/workspace",A.String),zH=uf("work-board/documents",A.String),HH=uf("work-board/identities",A.String),WH=uf("work-board/navigation",A.String),Ks=uf("work-board/index",A.String),KH=uf("work-board/watcher",A.String);var voe=Bi("question",{payload:{item:A.String,request:A.String},reads:()=>[Dr.list,Ks.list],rejections:{ResponseFailed:ji},success:BH}),Toe=Bi("awaitResponse",{payload:{after:A.optional(A.String),question:A.String},reads:()=>[Dr.list,Ks.list],rejections:{ResponseFailed:ji},success:qH}),koe=Bi("responses",{payload:{question:A.String},reads:()=>[Dr.list,Ks.list],rejections:{ResponseFailed:ji},success:jH}),Coe=MA("registerQuestion",{invalidates:()=>[Dr.list,Ks.list],payload:{item:A.String,request:A.String,revision:xh},rejections:{ResponseFailed:ji},success:Ub}),Aoe=MA("recordResponse",{invalidates:()=>[Dr.list,Ks.list],payload:$H,rejections:{ResponseFailed:ji},success:Db}),Nb=Pb("work-board",{commands:[Coe,Aoe],queries:[voe,koe,Toe]});function VH(e){let t=new URL(e,"http://127.0.0.1").pathname,n=/^\/_board\/item\/(?<id>[^/]+)\/$/u.exec(t)?.groups?.id,r=zH.item(decodeURIComponent(t.slice(1)));return n?r=HH.item(decodeURIComponent(n)):t.startsWith("/_board/")&&(r=Ks.list),[Dr.list,r]}var Lc=class extends A.TaggedError()("ReadFailed",{operation:A.String,status:A.Number}){},Roe=A.String.check(A.isMaxLength(8192),A.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/work","/_board/overview","/_board/changes","/_board/start","/_board/respond"].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"}})),Ooe=A.Struct({html:A.String,status:A.Number}),_oe=A.Struct({file:A.String,href:A.String,kind:A.Literals(["document","heading","passage"]),line:A.optional(A.Number),snippet:A.String,text:A.String,title:A.String}),Moe=Bi("page",{payload:{url:Roe},reads:({url:e})=>VH(e),rejections:{ReadFailed:Lc},success:Ooe}),Poe=Bi("navigation",{reads:()=>[Dr.list,WH.list],rejections:{ReadFailed:Lc},success:A.String}),Foe=Bi("search",{payload:{query:A.String.check(A.isMaxLength(8192))},reads:()=>[Dr.list,Ks.list],rejections:{ReadFailed:Lc},success:A.Struct({results:A.Array(_oe),total:A.Number,unavailable:A.Array(A.String)})}),Uoe=Bi("history",{payload:DH,reads:()=>[Dr.list,Ks.list],rejections:{ReadFailed:Lc},success:NH}),Doe=Bi("watcher",{reads:()=>[Dr.list,KH.list],rejections:{ReadFailed:Lc},success:A.Struct({watching:A.Boolean})}),PA=Pb("work-board",{queries:[Moe,Poe,Foe,Uoe,Doe]}),Noe=_c.make("work-board.subscribe",{error:Lc,stream:!0,success:AH}),JH=PA.add(Noe).merge(Nb);function GH(e,t={}){class n extends TH()("WorkBoard/Reader",{group:JH,protocol:ph.layerProtocolHttp({url:`${e}/_board/rpc`}).pipe(Wr.provide([HS.layer,lh.layerNdjson]))}){}let r=_A(PA,n),o=g$({defaultIdleTTL:0,timeoutResolution:1}),s=RH(n.runtime,{resume:_H(t),resyncKeys:[Dr.list],stream:nr.unwrap(n.use(f=>le.succeed(f("work-board.subscribe",void 0))))});o.mount(s.connection);async function i(f,l){try{return await le.runPromise(Hm(o,f,{suspendOnWaiting:!0}),{signal:l})}catch(p){if(l?.aborted){let m=new Error("Reading canceled",{cause:p});throw m.name="AbortError",m}throw p}}async function a(f,l){try{return await le.runPromise(le.flatMap(Hm(o,n.runtime),p=>le.provideContext(f,p)),{signal:l})}catch(p){if(l?.aborted){let m=new Error("Reading canceled",{cause:p});throw m.name="AbortError",m}throw p}}async function c(f,l){let p=await le.runPromise(le.result(Hm(o,n.runtime.atom(f),{suspendOnWaiting:!0})),{signal:l});if(p._tag==="Failure")throw p.failure;return p.success}let u=_A(Nb,n);return{api:r,mutate:c,read:i,registry:o,responses:u,run:a,updates:s}}var Lb=new WeakMap;function Bb(e){let t=Lb.get(e);if(t===void 0){let o=function(){r.registry.dispose(),Lb.get(e)===r&&Lb.delete(e),e.removeEventListener("pagehide",o)};var n=o;t=GH(e.location.origin,{window:e}),Lb.set(e,t);let r=t;e.addEventListener("pagehide",o)}return t}async function ZH(e,t,n,r){t.dataset.outcome="pending",t.textContent="Pending: registering reviewed context, then recording response\u2026";let o=Bb(window);try{let s=await o.mutate(o.responses.registerQuestion.run({item:e.dataset.item??"",request:e.dataset.request??"",revision:r.revision}));await o.mutate(o.responses.recordResponse.run({author:r.author,body:r.body,id:r.id,question:s.id,type:A.decodeUnknownSync(Fb)(r.type)})),e.isConnected&&(t.dataset.outcome="saved",t.textContent=`Saved: responses/${r.id}.md. This records feedback, not acceptance.`);let i=n.saved(r);return!i&&e.isConnected&&(t.textContent+=" Your current draft remains unsaved."),i}catch(s){if(e.isConnected){let i=s instanceof ji&&s.code!=="Uncertain"?"rejected":"uncertain";t.dataset.outcome=i,t.textContent=`${i==="rejected"?"Rejected":"Uncertain"}: ${String(s)}. Draft retained. Preview and retry with the same identity; saved content will be reconciled.`}return!1}}function FA(){let e=document.getElementById("doc");if(e?.dataset.view!=="response")return;let t=e.querySelector("#response-form");if(!t||t.dataset.bound==="true")return;t.dataset.bound="true";let n=t.querySelector("#response-status"),r=t.elements.namedItem("author"),o=t.elements.namedItem("body"),s=t.elements.namedItem("type"),i=t.querySelector("#response-submit"),a=t.querySelector("#response-preview-content"),c=t.querySelector("#response-clear"),u=t.querySelector("#response-preview");if(!(n&&r instanceof HTMLInputElement&&o instanceof HTMLTextAreaElement&&s instanceof HTMLSelectElement&&i&&a&&c&&u))return;n.textContent?.includes("JavaScript is required")&&(n.textContent="Draft ready. Preview the Markdown before recording it.");let f=t.dataset.item??"",l=t.dataset.request??"",p=t.dataset.revision??"",m=`${f}/${l}`,h=`work-board:drafts:${document.documentElement.dataset.workspace}`,g;try{g=window.localStorage}catch{g=void 0}let x=wq(m,p,g,h,w=>{n.textContent=w}),E=x.current();r.value=E.author,o.value=E.body,s.value=E.type;let b={author:r,body:o,type:s};function y(){E=x.update({author:b.author.value,body:b.body.value,revision:E.revision,type:b.type.value})}t.addEventListener("input",()=>{y(),a.hidden=!0,i.disabled=!0}),u.disabled=!1,c.disabled=!1,u.addEventListener("click",()=>{E=x.update({author:r.value,body:o.value,id:E.revision===p?x.current().id:`response.${crypto.randomUUID()}`,revision:p,type:s.value}),a.textContent=Iq(E,t.dataset.question??""),a.hidden=!1,i.disabled=t.dataset.writable!=="true"||!t.checkValidity()}),c.addEventListener("click",x.clear),t.addEventListener("submit",async w=>{w.preventDefault(),!(i.disabled||E.revision!==p||!t.reportValidity())&&(i.disabled=!0,u.disabled=!0,await ZH(t,n,x,E)&&(E=x.current(),t.isConnected&&(o.value="")),u.disabled=!1)})}function QH(){document.addEventListener("board-page",FA),window.addEventListener("pageshow",FA),FA()}typeof window<"u"&&typeof document<"u"&&QH();var Vhe=Bb;export{Vhe as session};
64
+ `}}}})},xH=RE(),yH=e=>En.of({contentType:e?.contentType??"application/json",includesFraming:!1,codecFor:lh,makeUnsafe:()=>{let t=new TextDecoder,n=new Map;return{decode:r=>{let o=JSON.parse(typeof r=="string"?r:t.decode(r));return EH(o,n)},encode:r=>{let o=bH(r,n);return o&&JSON.stringify(o)}}}}),SH=e=>En.of({contentType:e?.contentType??"application/json-rpc",includesFraming:!0,codecFor:lh,makeUnsafe:()=>{let t=RE({maxBufferSize:e?.maxBufferSize}).makeUnsafe(),n=new Map;return{decode:r=>{let o=t.decode(r);if(o.length===0)return[];let s=[];for(let i=0;i<o.length;i++){let a=o[i];s.push(...EH(a,n))}return s},encode:r=>{let o=bH(r,n);return o&&t.encode(o)}}}});function EH(e,t){if(Array.isArray(e)){let n={size:0,responses:new Map},r=[];for(let o=0;o<e.length;o++){let s=pH(e[o]);r.push(s),s._tag==="Request"&&!s.isNotification&&(n.size++,t.set(s.id,n))}return r}return[pH(e)]}function pH(e){if(Object.hasOwn(e,"method")){let r=e;if(jA(r.id)&&r.method.startsWith("@effect/rpc/")){let o=r.method.slice(12),s=r.params?.requestId;return s?{_tag:o,requestId:s}:{_tag:o}}return{_tag:"Request",id:r.id??"",tag:r.method,payload:r.params??null,headers:r.headers??[],...q(r,"id")?{}:{isNotification:!0},...r.spanId?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{}}}let t=e,n=Object.hasOwn(t,"error");return n&&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:n&&t.error!=null?{_tag:"Failure",cause:t.error._tag==="Cause"?t.error.data:[{_tag:"Die",defect:t.error}]}:{_tag:"Success",value:t.result}}}function mH(e,t){if(!("requestId"in e))return yA(e);let n=t.get(e.requestId);return n?(t.delete(e.requestId),n.responses.set(e.requestId,e),n.size===n.responses.size?Array.from(n.responses.values(),yA):void 0):yA(e)}function bH(e,t){if(Array.isArray(e)===!1)return mH(e,t);if(e.length===0)return;let n=[];for(let o=0;o<e.length;o++){let s=mH(e[o],t);s!==void 0&&n.push(s)}if(n.length===0)return;if(n.length===1)return n[0];let r=[];for(let o=0;o<n.length;o++){let s=n[o];Array.isArray(s)?r.push(...s):r.push(s)}return r}function yA(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(r=>r._tag==="Fail"),n=t?._tag==="Fail"?t.error:void 0;return{jsonrpc:"2.0",id:e.requestId??void 0,error:e.exit._tag==="Failure"?{_tag:"Cause",code:n&&q(n,"code")?Number(n.code):0,message:n&&q(n,"message")?n.message:JSON.stringify(e.exit.cause),data:e.exit.cause}:void 0}}case"Defect":return{jsonrpc:"2.0",id:Ure,error:{_tag:"Defect",code:1,message:"A defect occurred",data:e.defect}};case"ClientProtocolError":return{}}}var Ure=-32603,SA=e=>{let{maxBufferSize:t=hH,...n}=e??{};return En.of({contentType:"application/msgpack",includesFraming:!0,codecFor:lh,makeUnsafe:()=>{let r=new Di(n),o=new Uc(n),s=new TextEncoder,i,a=c=>{throw i=void 0,new fh({maxBufferSize:c})};return{decode(c){let u=typeof c=="string"?s.encode(c):c;if(i!==void 0){AE(i.length+u.length,t)&&a(t);let f=u;c=new Uint8Array(i.length+u.length),c.set(i),c.set(f,i.length),u=c,i=void 0}try{return r.unpackMultiple(u)}catch(f){let l=f;if(l.incomplete)return i=u.subarray(l.lastPosition),AE(i.length,t)&&a(t),l.values??[];throw f}},encode:c=>o.pack(c)}}})},wH=SA({useRecords:!0}),Dre=16*1024*1024,Nre=new TextEncoder,Lre=e=>{let t=e?.maxFrameSize??Dre,n=e?.fingerprintPayloads===!0?o=>cA(o,{fingerprint:!0}):cA,r={fingerprint:!0,dictionary:!0};return En.of({contentType:"application/vnd.effect.rpc+schema-binary",includesFraming:!0,codecFor:n,makeUnsafe:()=>{let o=kz(PC,{...r,maxFrameSize:t}),s=Az(PC,r);return{decode:i=>o.feedSync(typeof i=="string"?Nre.encode(i):i),encode:i=>{if(!Array.isArray(i))return s.encode(i);if(i.length!==0)return s.encodeMany(i)}}}})},Bre=ui(En)(gH),qre=ui(En)(xH),jre=e=>ui(En)(RE(e)),$re=e=>ui(En)(yH(e)),zre=e=>ui(En)(SH(e)),Hre=ui(En)(wH),Wre=e=>ui(En)(SA(e)),Vre=e=>sw(En)(()=>Lre(e));var OE=class extends Ve()("effect/rpc/RpcWorker/InitialMessage"){};var vH=e=>V(()=>{let t=new Set,n=new Map,r=new Map,o=(s,i)=>ur(a=>{let c=n.get(s);return c||(c=[],n.set(s,c)),c.push([i,a]),H});return Y(e((s,i)=>{let a=r.get(s);return a?a(i):o(s,i)},t),s=>({...s,run(i,a){return $t(function*(){t.add(i),r.set(i,a);let c=n.get(i);if(c){n.delete(i);for(let[u,f]of c)yield*Nn(V(()=>a(u)),f)}return yield*fr(Kr,()=>(t.delete(i),r.delete(i),H))})}}))});var Jre=e=>Sr(e,"RpcClientError"),Gre=0,TH=Se(function*(e,t){let n=t?.spanPrefix??"RpcClient",r=t?.supportsAck??!0,o=t?.disableTracing??!1,s=t?.generateRequestId??(()=>Gre++),i=yield*cr(),a=$e(i,It),c=new Map,u=!1;yield*_t(a,xn(E=>(u=!0,f(Wg(E.id)))));let f=Se(function*(E){for(let[x,w]of c)c.delete(x),w._tag==="Queue"?yield*E._tag==="Success"?Jp(w.queue):Zt(w.queue,E.cause):w.resume(E)}),l=E=>{let x=Km(E.successSchema),w=h(E);return(S,A)=>{let M=A?.headers?Mi(A.headers):Yl,R=A?.context??bt();if(!x){let $=F=>p(E,w,F,E.payloadSchema.make(S),M,R,A?.discard??!1);return o?$(void 0):pp(`${n}.${E._tag}`,{attributes:t.spanAttributes},$)}let P=m(E,w,E.payloadSchema.make(S),M,A?.streamBufferSize??16,R);return A?.asQueue?P:hr(Y(P,Ci))}},p=(E,x,w,S,A,M,R)=>xn(P=>{if(u)return yo;let $=s(),F=x(ee=>t.onFromClient({message:ee,context:M,discard:R}),{_tag:"Request",id:$,tag:E._tag,payload:S,...w?{traceId:w.traceId,spanId:w.spanId,sampled:w.sampled}:{},headers:Xl(P.getRef(_E),A)});if(R)return F;let te;return pi(Is(ee=>{let T={_tag:"Effect",rpc:E,context:M,resume(z){ee(z),te&&!te.pollUnsafe()&&P.currentDispatcher.scheduleTask(()=>{te.interruptUnsafe(P.id)},0)}};c.set($,T),te=F.pipe(w?sl(w,{captureStackTrace:!1}):B,Ln(P.context)),te.addObserver(z=>{if(z._tag==="Failure")return ee(z)})}),ee=>(c.delete($),Dn(bo(te),g($,Array.from(ee),M))))}),m=Se(function*(E,x,w,S,A,M){if(u)return yield*yo;let R=o?void 0:yield*Gw(`${n}.${E._tag}`,{attributes:t.spanAttributes}),P=bi(),$=s(),F=Gn(P.context,It);yield*No(F,ee=>c.has($)?(c.delete($),g($,ii(ee)?Array.from(SP(ee.cause)):[],M)):H);let te=yield*Uu(A);return c.set($,{_tag:"Queue",rpc:E,queue:te,scope:F,context:M}),yield*x(ee=>t.onFromClient({message:ee,context:M,discard:!1}),{_tag:"Request",id:$,tag:E._tag,payload:w,...R?{traceId:R.traceId,spanId:R.spanId,sampled:R.sampled}:{},headers:Xl(P.getRef(_E),S)}).pipe(R?sl(R,{captureStackTrace:!1}):B,ft(ee=>Zt(te,ee)),fa,Ut(F,{startImmediately:!0})),te}),h=E=>{let x=[];for(let w of E.middlewares.values()){let S=Gi(i,`${w.key}/Client`);S&&x.push(S)}return x.length===0?(w,S)=>w(S):function w(S,A,M=x.length-1){return M===-1?S(A):x[M]({rpc:E,request:A,next(R){return w(S,R,M-1)}})}},g=(E,x,w)=>Is(S=>{let A=bi();t.onFromClient({message:{_tag:"Interrupt",requestId:E,interruptors:x},context:w,discard:!1}).pipe(Nw(1e3),Ln(A.context)).addObserver(()=>{S(H)})}),y=E=>{switch(E._tag){case"Chunk":{let x=E.requestId,w=c.get(x);return!w||w._tag!=="Queue"?H:Ia(w.queue,E.values).pipe(r?O(()=>t.onFromClient({message:{_tag:"Ack",requestId:E.requestId},context:w.context,discard:!1})):B,ft(S=>Zt(w.queue,S)))}case"Exit":{let x=E.requestId,w=c.get(x);return w?(c.delete(x),w._tag==="Effect"?(w.resume(E.exit),H):E.exit._tag==="Success"?Jp(w.queue):Zt(w.queue,E.exit.cause)):H}case"Defect":return f(Hg(E.defect));case"ClientEnd":return H}},b;if(t.flatten){let E=new Map;b=function(w,S,A){let M=E.get(w);return M||(M=l(e.requests.get(w)),E.set(w,M)),M(S,A)}}else b={},e.requests.forEach(E=>{W(b,E._tag,l(E))});return{client:b,write:y}}),Zre=0,EA=Se(function*(e,t){let n=Zre++,{codecFor:r,run:o,send:s,supportsAck:i,supportsTransferables:a}=yield*Bi,c=Qre(r),u=xm(r(ln())),f=new Map,{client:l,write:p}=yield*TH(e,{...t,supportsAck:i,onFromClient({message:m}){switch(m._tag){case"Request":{let h=e.requests.get(m.tag),g=a?O$():void 0,y=bi(),b={rpc:h,context:g?Ke(y.context,Vm,g):y.context,schemas:c(h)};return f.set(m.id,b),b.schemas.encodePayload(m.payload).pipe(Nn(b.context),di,O(E=>s(n,{...m,id:m.id,payload:E,headers:Object.entries(m.headers)},g&&g.readUnsafe())))}case"Ack":return f.get(m.requestId)?s(n,{_tag:"Ack",requestId:m.requestId}):H;case"Interrupt":return f.get(m.requestId)?(f.delete(m.requestId),s(n,{_tag:"Interrupt",requestId:m.requestId})):H;case"Eof":return H}}});return yield*o(n,m=>{switch(m._tag){case"Chunk":{let h=Zm(m.requestId),g=f.get(h);return!g||xe(g.schemas.decodeChunk)?H:g.schemas.decodeChunk.value(m.values).pipe(Nn(g.context),di,O(y=>p({_tag:"Chunk",clientId:0,requestId:Zm(m.requestId),values:y})),xo(y=>p({_tag:"Exit",clientId:0,requestId:Zm(m.requestId),exit:qt(y)})))}case"Exit":{let h=Zm(m.requestId),g=f.get(h);return g?(f.delete(h),g.schemas.decodeExit(m.exit).pipe(Nn(g.context),di,Gr({onSuccess:y=>p({_tag:"Exit",clientId:0,requestId:h,exit:y}),onFailure:y=>p({_tag:"Exit",clientId:0,requestId:h,exit:qt(y)})}))):H}case"Defect":return p({_tag:"Defect",clientId:0,defect:u(m.defect)});case"ClientProtocolError":{let h=Uo(m.error);return Bo(f.keys(),g=>p({_tag:"Exit",clientId:0,requestId:g,exit:h}))}default:return H}}).pipe(ft(hp),fa,vs),l}),Qre=e=>{let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let o=eE(n.successSchema);return r={decodeChunk:Lt(o,s=>wc(e(fS(s.success)))),encodePayload:cS(e(n.payloadSchema)),decodeExit:wc(e(_C(n)))},t.set(n,r),r}},_E=Me("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>Yl}),Yre=d(2,(e,t)=>Hw(e,_E,Xl(Mi(t)))),Bi=class extends Ve()("effect/rpc/RpcClient/Protocol"){static make=vH},kH=e=>Bi.make(Se(function*(t){let n=yield*En,r=n.includesFraming,o=u=>new Ws({reason:ed.fromHttpClientError(u)}),s=(u,f)=>new Ws({reason:new Mc({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:Se(function*(u,f){if(f._tag!=="Request")return;let l=n.makeUnsafe(),p=l.encode(f),m=typeof p=="string"?Gk(p,n.contentType):LS(p,n.contentType),h=yield*e.post("",{body:m}).pipe(ol(o));if(!r){let b=yield*h.text.pipe(ol(o)),E=yield*qo({try:()=>l.decode(b),catch:S=>s("Error decoding HTTP response",S)});if(!Array.isArray(E))return yield*s("Expected an array of responses",E);if(E.length===0)return yield*i(f);let x=!1,w=0;return yield*Yn({while:()=>w<E.length,body:()=>{let S=E[w++];return FC(S)&&(x=!0),t(u,S)},step:bn}),x?void 0:yield*a(f)}let g=!1,y=!1;if(yield*Ql(h.stream,b=>qo({try:()=>b.flatMap(l.decode),catch:E=>s("Error decoding HTTP response",E)}).pipe(O(E=>{if(E.length===0)return H;g=!0;let x=0;return Yn({while:()=>x<E.length,body:()=>{let w=E[x++];return FC(w)&&(y=!0),t(u,w)},step:bn})}))).pipe(ol(b=>Jre(b)?b:o(b))),g){if(!y)return yield*a(f)}else return yield*i(f)}),supportsAck:!1,supportsTransferables:!1,codecFor:n.codecFor}})),Xre=e=>Wr(Bi)(O(oC,t=>(t=g$(t,c$(e.url)),kH(e.transformClient?e.transformClient(t):t)))),CH=e=>Bi.make(Se(function*(t,n){let r=yield*E$,o=yield*En,s=yield*bu(ph),i=new Map,a=yield*r.writer,c=o.makeUnsafe(),u=yield*toe(V(()=>a(c.encode(F$)))),f,l=V(()=>(f=void 0,Te(s)?s.value.onConnect:H)),p=h=>Bo(n,g=>t(g,h)),m=h=>(f=h,p({_tag:"ClientProtocolError",error:h}));return yield*V(()=>(c=o.makeUnsafe(),u.reset(),r.runRaw(h=>{try{let g=c.decode(h);if(g.length===0)return;let y=0;return Yn({while:()=>y<g.length,body:()=>{let b=g[y++];if(b._tag==="Pong")return u.onPong(),H;if(Object.hasOwn(b,"requestId")){let E=b.requestId,x=i.get(E);if(x!==void 0)return b._tag==="Exit"&&i.delete(E),t(x,b)}return p(b)},step:bn})}catch(g){return p({_tag:"ClientProtocolError",error:new Ws({reason:new Mc({message:"Error decoding message",cause:g})})})}},{onOpen:l}).pipe(sc(O(u.timeout,()=>G(new nd({reason:new Bm({kind:"Timeout",cause:new Error("ping timeout")})}))))))).pipe(O(()=>G(new nd({reason:new qm({code:1e3})}))),Te(s)?ua(s.value.onDisconnect):B,fp(h=>{let g=Vf(h),y=Vt(g),b=new Ws({reason:y?g.success.reason:new Mc({message:"Unknown socket error",cause:du(h)})});return e?.retryTransientErrors&&y&&g.success.reason._tag==="SocketOpenError"?(e.onTransientError?.(b)??H).pipe(Dw({log:!0,message:"RpcClient onTransientError hook failed"})):m(b)}),Fw(e?.retryPolicy??eoe,h=>m(new Ws({reason:h.reason}))),xx({module:"RpcClient",method:"makeProtocolSocket"}),vs),{send(h,g){if(f)return G(f);g._tag==="Request"&&i.set(g.id,h);let y=c.encode(g);return y===void 0?H:di(a(y))},supportsAck:!0,supportsTransferables:!1,codecFor:o.codecFor}})),eoe=lF([dF(500,1.5),Xf(5e3)]),toe=Se(function*(e){let t=!0,n=lr(),r=()=>{t=!0,n.closeUnsafe()},o=()=>{t=!0};return yield*V(()=>t?(t=!1,e):n.open).pipe(ca("5 seconds"),Uw,Ht,fa,vs),{timeout:n.await,reset:r,onPong:o}}),noe=e=>Wr(Bi)(CH(e)),AH=e=>Bi.make(Se(function*(t,n){let r=yield*XS,o=yield*zo,s=0,i=yield*bu(OE),a=yield*bu(ph),c=new Map,u=m=>Bo(n,h=>t(h,m)),f=$t(function*(){let m=s++,h=yield*r.spawn(m);return yield*h.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,b]of c)c.delete(y),b.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:Te(i)?O(i.value,([g,y])=>di(h.send({_tag:"InitialMessage",value:g},y))):void 0}).pipe(fp(g=>{for(let[b,E]of c)E.worker===h&&(c.delete(b),E.latch.openUnsafe());let y=Vf(g);return u({_tag:"ClientProtocolError",error:new Ws({reason:Vt(y)?y.success.reason:new Mc({message:"Error in worker",cause:du(g)})})})}),px(Xf(1e3)),xx({module:"RpcClient",method:"makeProtocolWorker"}),fa,vs),h}),l="minSize"in e?yield*hj({acquire:f,min:e.minSize,max:e.maxSize,concurrency:e.concurrency,targetUtilization:e.targetUtilization,timeToLive:e.timeToLive}):yield*mj({acquire:f,size:e.size,concurrency:e.concurrency,targetUtilization:e.targetUtilization});yield*_t(o,se(()=>{for(let m of c.values())m.latch.openUnsafe();c.clear()}));let p=(m,h,g)=>{switch(h._tag){case"Request":return Pk(l).pipe(O(y=>{let b=lr(!1);return c.set(h.id,{clientId:m,worker:y,latch:b}),O(y.send(h,g),()=>b.await)}),wu,di);case"Interrupt":{let y=c.get(h.requestId);return y?(c.delete(h.requestId),y.latch.openUnsafe(),di(y.worker.send(h))):H}case"Ack":{let y=c.get(h.requestId);return y?di(y.worker.send(h)):H}}return H};return yield*wu(Pk(l)),Te(a)&&(yield*a.value.onConnect),{send:p,supportsAck:!0,supportsTransferables:!0,codecFor:Cc}})),roe=jc(AH,Wr(Bi)),ph=class extends Ve()("effect/rpc/RpcClient/ConnectionHooks"){};var ME="~effect/reactivity/Atom",_H=e=>q(e,ME),wA="~effect/reactivity/Atom/Writable",gh=d(2,(e,t)=>{let n=gt(t),r=ls(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Tn(n):void 0})}),cf=gh(0),vA={[ME]:ME,equals:Object.is,...vn,toJSON(){return{_id:"Atom",keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},ooe={...vA,atom(e,t){let n=MH(e,t);return qi(r=>{let o=r.self(),s=r(this);return s._tag!=="Success"?$m(s,o):n(r,s.value)})},fn(e,t){return arguments.length===0?(n,r)=>RH(this,n,r):RH(this,e,t)},pull(e,t){let n=cf(TA(0)),r=qi(o=>{let s=o.self(),i=o(this);return i._tag!=="Success"?$m(i,s):PE(o,moe(o,n,e,t),Oa(!0),i.value)});return hoe(n,r)},subscriptionRef(e){return loe(cf(qi(t=>{let n=t.self(),r=t(this);if(r._tag!=="Success")return $m(r,n);let o=typeof e=="function"?e(t):e;return Fm(o)?o:PE(t,o,Oa(!0),r.value)})),(t,n)=>{let r=mC(t(this));return foe(t,n,r)})}},RH=(e,t,n)=>{let[r,o,s]=poe(n?.reactivityKeys?(i,a)=>{let c=t(i,a);return Ar(c)?kS(c,n.reactivityKeys):Mm(c,CS(n.reactivityKeys))}:t,n);return xh(i=>{i.get(s);let a=i.self(),c=i.get(e);return c._tag!=="Success"?$m(c,a):r(i,c.value)},o)},soe={...vA,[wA]:wA},ioe=e=>wA in e,qi=(e,t)=>{let n=Object.create(vA);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},xh=(e,t,n)=>{let r=Object.create(soe);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function aoe(e,t){e.setSelf(t)}var hh=(e,t)=>{let n=MH(e,t);return ME in n?n:qi(n)},MH=(e,t)=>{if(typeof e=="function"&&!Ar(e)&&!Ue(e)){let n=e;return function(r,o){let s=n(r);switch(typeof s){case"function":case"object":return s===null?s:PH in s?IA(r,s,t,o):coe in s?OH(r,s,t,o):s;default:return s}}}else{if(Ar(e))return function(n,r){return IA(n,e,t,r)};if(Ue(e))return function(n,r){return OH(n,e,t,r)}}return TA(e)},PH="~effect/Effect",coe="~effect/Stream",TA=e=>xh(function(t){return e},aoe),IA=(e,t,n,r)=>{let o=n?.initialValue!==void 0?Yo(n.initialValue):Oa();return PE(e,t,o,r,n?.uninterruptible)};function PE(e,t,n,r=bt(),o=!1){let s=e.self(),i=Hr();e.addFinalizer(()=>{Ln(r)(Je(i,Kt))});let a,c=!1,u=kA(r.pipe(Ke(It,i),Ke(YS,e.registry),Ke(Va,e.registry.scheduler)),t,function(f){a=dC(f,s),c&&e.setSelf(a)},o);return c=!0,u!==void 0&&e.addFinalizer(u),a!==void 0?a:s._tag==="Some"?QS(s):jm(n)}function kA(e,t,n,r=!1){if(xs(t)){n(t);return}let s=Ln(e)(t);s.currentDispatcher?.flush();let i=s.pollUnsafe();if(i){n(i);return}let a=s.addObserver(n);function c(){a(),r||s.interruptUnsafe()}return c}function uoe(e){let t=e?.memoMap??cf(hh(()=>ai())),n=i=>_H(t)?i(t):t,r=AS;function o(i){let a=Object.create(ooe);a.keepAlive=!1,a.lazy=!0,a.refresh=void 0,a.factory=o;let c=OA(qi(typeof i=="function"?u=>Qd(i(u),r):()=>Qd(i,r)));return a.layer=c,a.read=function(f){let l=f(c),p=O(zo,m=>ci(l,n(f),m));return IA(f,p,{uninterruptible:!0})},a}o.memoMap=t,o.addGlobalLayer=i=>{r=Qd(r,Ss(i,AS))};let s=cf(hh(i=>ur(a=>ci(AS,n(i),$e(a,It))).pipe(Y($e(Ri)))));return o.withReactivity=i=>a=>goe(a,c=>{let u=mC(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 CA=uoe(),Hme=CA.withReactivity,OH=(e,t,n,r)=>{let o=n?.initialValue!==void 0?Yo(n.initialValue):Oa();return AA(e,t,o,r)};function AA(e,t,n,r=bt()){let o=e.self();r=Ke(r,YS,e.registry);let s=dp(a=>O(Ko(t.channel,a),c=>Yn({while:Xt,body:()=>c,step(u){e.setSelf(Yo(Tf(u),{waiting:!0}))}}))).pipe(ft(a=>(Lo(a)?lf(e.self(),as(pC),or({onNone:()=>e.setSelf(T$(new Kf,{previous:e.self()})),onSome:c=>e.setSelf(Yo(c))})):e.setSelf(od(a,{previous:e.self()})),H))),i=kA(r.pipe(Ke(YS,e.registry),Ke(Va,e.registry.scheduler)),s,bn,!1);return i!==void 0&&e.addFinalizer(i),o._tag==="Some"?QS(o):jm(n)}var foe=(e,t,n=bt())=>Fm(t)?(e.addFinalizer(Lk(t).pipe(Ql(r=>{for(let o=0;o<r.length;o++)e.setSelf(r[o]);return H}),Zw(n))),Xw(n)(wj(t))):t._tag!=="Success"?t:AA(e,Lk(t.value),Oa(!0),n),loe=(e,t)=>{function n(r,o){let s=r.get(e);Fm(s)?hi(Bk(s,o)):rd(s)&&hi(Bk(s.value,o))}return xh(r=>{let o=r(e);return Fm(o)||rd(o)?t(r,o):o},n)};var doe=Symbol.for("effect/reactivity/atom/Atom/Reset"),bA=Symbol.for("effect/reactivity/atom/Atom/Interrupt");function poe(e,t){let n=cf(TA([0,void 0])),r=t?.initialValue!==void 0?Yo(t.initialValue):Oa(),o=t?.concurrent?cf(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,l]=a.get(n);if(f===0)return r;if(l===bA)return od(xP(),{previous:a.self()});let p=e(l,a);return PH in p?(u&&(p=O(al(p,{startImmediately:!0}),h=>(u.add(h),h.addObserver(()=>u.delete(h)),Y(iy(u),g=>g[0])))),PE(a,p,r,c,!1)):AA(a,p,r,c)}function i(a,c){yoe(()=>{c===doe?a.set(n,[0,void 0]):c===bA?a.set(n,[a.get(n)[0]+1,bA]):a.set(n,[a.get(n)[0]+1,c]),a.refreshSelf()})}return[s,i,n]}var moe=(e,t,n,r)=>O(Ak(typeof n=="function"?n(e):n),o=>{let i=bi().context,a=rn(),c=Gr(o,{onFailure(f){return Lo(f)?Ye(a)?v({done:!0,items:a}):G(new Kf("Atom.pull: no items")):ct(f)},onSuccess(f){let l;return r?.disableAccumulation?l=f:(l=vf(a,f),a=l),v({done:!1,items:l})}}),u=new Set;return e.addFinalizer(()=>{for(let f of u)f()}),e.once(t),e.subscribe(t,()=>{e.setSelf(QS(e.self()));let f;f=kA(i,c,l=>{f&&u.delete(f);let p=dC(l,e.self()),m=u.size>0;e.setSelf(m?jm(p):p)}),f&&u.add(f)}),c}),hoe=(e,t)=>xh(t.read,function(n,r){n.set(e,n.get(e)+1)}),RA=typeof WeakRef>"u"||typeof FinalizationRegistry>"u"?e=>{let t=hc();return function(n){let r=_s(t,n);if(r._tag==="Some")return r.value;let o=e(n);return gc(t,n,o),o}}:e=>{let t=hc(),n=new FinalizationRegistry(r=>{Mu(t,r)});return function(r){let o=_s(t,r).pipe(pb(i=>i.deref()));if(o._tag==="Some")return o.value;let s=e(r);return gc(t,r,new WeakRef(s)),n.register(s,r),s}};var OA=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0});var goe=d(e=>_H(e[0]),(e,t,n)=>{let r=cf(ioe(e)?xh(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 n?.initialValueTarget&&(r.initialValueTarget=xoe(n.initialValueTarget)),r}),xoe=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t};var yoe=C$;var Soe="~effect-atom/atom/Atom/Serializable";var _A=d(2,(e,t)=>{let n=Cc(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,new Error().stack?.split(`
65
+ `)[5]??""],[Soe]:{key:t.key,encode:LT(n),decode:xm(n)}})});var UH=()=>(e,t)=>{let n=Ve()(e),r=Wr(n,t.makeEffect??EA(t.group,{...t,flatten:!0})),o=t.runtime??CA;n.runtime=o(typeof t.protocol=="function"?i=>Ss(r,Yg(t.protocol(i))):Ss(r,Yg(t.protocol))),n.mutation=RA(i=>{let a=t.group.requests.get(i);return n.runtime.fn()(Se(function*({headers:c,payload:u,reactivityKeys:f}){let p=(yield*n)(i,u,{headers:c});return yield*f?kS(p,f):p})).pipe(_A({key:`AtomRpc:mutation:${i}`,schema:hC({success:a.successSchema,error:FH(a)})}))});let s=RA(i=>{let{headers:a,payload:c,reactivityKeys:u,tag:f,timeToLive:l}=i,p=t.group.requests.get(f),m=Km(p.successSchema),h=m?n.runtime.pull(hr(n.use(g=>v(g(f,c,{headers:a}))))):n.runtime.atom(n.use(g=>g(f,c,{headers:a})));return u&&(h=n.runtime.factory.withReactivity(u)(h)),!m&&i.serializationKey&&(h=_A(h,{key:`AtomRpc:${i.tag}:${i.serializationKey}`,schema:hC({success:p.successSchema,error:FH(p)})})),l&&(h=ls(l)?gh(h,l):OA(h)),h});return n.query=(i,a,c)=>{let u={tag:i,payload:a,headers:c?.headers?Mi(c.headers):void 0,reactivityKeys:c?.reactivityKeys,timeToLive:c?.timeToLive?gt(c.timeToLive):void 0,serializationKey:c?.serializationKey};return s(u)},n},FH=e=>He([e.errorSchema,...Array.from(e.middlewares,t=>t.error),Ws]);var FE={};rs(FE,{make:()=>woe});var boe={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return Ma({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[o,s]of r.requests)t.set(o,s);for(let[o,s]of r.annotations.mapUnsafe)n.set(o,s)}return Ma({requests:t,annotations:Po(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return Ma({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return Ma({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return $t(function*(){let n=yield*cr(),r=Ar(e)?yield*e:e,o=new Map;return t.requests.forEach((s,i)=>{o.set(s.key,{tag:s._tag,handler:r[i],context:n})}),Po(o)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return Ma({requests:t,annotations:this.annotations})},toLayer(e){return Gf(this.toHandlers(e))},of:B,toLayerHandler(e,t){let n=this;return Gf($t(function*(){let r=yield*cr(),o=Ar(t)?yield*t:t,s=new Map,i=n.requests.get(e);return s.set(i.key,{handler:o,context:r}),Po(s)}))},accessHandler(e){return ur(t=>{let n=this.requests.get(e),{handler:r,context:o}=Gi(t,n.key);return v((s,i)=>{i.rpc=n;let a=r(s,i),c=id(a)?a.value:a;return Ar(c)?$w(c,o):kk(c,o)})})},annotate(e,t){return Ma({requests:this.requests,annotations:Ke(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(us(e,t))},annotateMerge(e){return Ma({requests:this.requests,annotations:br(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(br(e,r.annotations)));return Ma({requests:t,annotations:this.annotations})}},Ma=e=>Object.assign(function(){},boe,{requests:e.requests,annotations:e.annotations}),woe=(...e)=>Ma({requests:new Map(e.map(t=>[t._tag,t])),annotations:bt()});var DH=k.Union([k.Struct({_tag:k.Literal("List"),collection:k.String}),k.Struct({_tag:k.Literal("Item"),collection:k.String,id:k.Union([k.String,k.Number])})]),uf=(e,t)=>({item:n=>({_tag:"Item",collection:e,id:n}),list:{_tag:"List",collection:e},name:e}),NH=e=>e._tag==="List"?e.collection:`${e.collection}:${e.id}`,UE=e=>[...new Set(e.map(NH))],DE=e=>[...new Set(e.flatMap(t=>t._tag==="List"?[t.collection]:[NH(t),t.collection]))];var Ioe=le.fn("EffectContract.invalidateAfter")(function*(e){yield*CS(DE(e))});function voe(e,t,n){function r(o){return UE(n.reads(o))}return{query:(o,s={})=>e.query(t,o,{...s,reactivityKeys:r(o)}),run:o=>e.use(s=>s(t,o))}}function Toe(e,t,n){return{run:r=>e.use(o=>o(t,r)).pipe(le.tap(o=>Ioe(n.invalidates(r,o))))}}function PA(e,t){let{name:n,queries:r,commands:o}=e.declaration;return Object.fromEntries([...r.map(s=>[s.name,voe(t,`${n}.${s.name}`,s)]),...o.map(s=>[s.name,Toe(t,`${n}.${s.name}`,s)])])}var LH=k.Union([k.Struct({_tag:k.Literal("Changed"),keys:k.Array(DH)}),k.Struct({_tag:k.Literal("Resync")})]),koe=256;function BH(e,t){let n=hh(!1),r=hh({connection:"connecting",failure:Le.none(),needsResync:!0,pending:0});return{connection:e.atom(s=>le.gen(function*(){s.mount(r);let i=yield*Ri;function a(f){s.set(r,{...s.once(r),...f})}function c(){if(s.once(n)){a({needsResync:!0});return}i.invalidateUnsafe(UE(t.resyncKeys)),a({needsResync:!1,pending:0})}s.subscribe(n,f=>{f||c()}),t.resume!==void 0&&(s.once(t.resume),s.subscribe(t.resume,c));let u=le.suspend(()=>{let f=!0;function l(p){a({connection:"live",failure:Le.none()}),s.once(n)?a({needsResync:!0,pending:Math.min(koe,s.once(r).pending+1)}):f||p._tag==="Resync"?c():i.invalidateUnsafe(DE(p.keys)),f=!1}return t.stream.pipe(rr.runForEach(p=>le.sync(()=>l(p))),le.scoped,le.catchCause(p=>le.sync(()=>a({failure:Le.some(p)}))),le.andThen(le.sync(()=>a({connection:"reconnecting",needsResync:!0}))),le.andThen(le.sleep(t.retryDelay??"1 second")))});yield*le.forever(u)})).pipe(gh(0)),paused:n,status:r}}function qH(e,t){return n=>{function r(){e.document.visibilityState==="visible"&&n()}return e.addEventListener(t,r),()=>e.removeEventListener(t,r)}}function jH({window:e,native:t}){let n=e===void 0?[]:[qH(e,"visibilitychange"),qH(e,"online")],r=t===void 0?n:[...n,t];return qi(o=>{let s=0;function i(){s+=1,o.setSelf(s)}for(let a of r)o.addFinalizer(a(i));return s})}var Coe=e=>{let t=e.map(({name:n})=>n).filter((n,r,o)=>o.indexOf(n)!==r);if(t.length>0)throw new Error(`Operation names must be unique; duplicated: ${[...new Set(t)].join(", ")}`)},$H=(e,t)=>{let n=e.middleware.bind(e);return Object.assign(e,{declaration:t,middleware:r=>$H(n(r),t)})};function NE(e,t){let{queries:n=[],commands:r=[]}=t;Coe([...n,...r]);let o=[...n,...r].map(s=>_c.make(`${e}.${s.name}`,{error:s.error,payload:s.payload,success:s.success}));return $H(FE.make(...o),{commands:r,name:e,queries:n})}function zH(e){let t=Object.entries(e).map(([n,r])=>[n,k.isSchema(r)?r:k.TaggedError()(n,r)]);return{error:t.length===0?k.Never:k.Union(t.map(([,n])=>n)),Rejection:Object.fromEntries(t),reject:Object.fromEntries(t.map(([n,r])=>[n,(...o)=>le.fail(Reflect.construct(r,o))]))}}var Aoe=e=>e===void 0?k.Void:k.isSchema(e)?e:k.Struct(e),HH=(e,t,n)=>{let{payload:r,success:o,rejections:s={}}=n;return{kind:e,name:t,payload:Aoe(r),rejections:s,success:o??k.Void,...zH(s)}};function ji(e,t){return{...HH("query",e,t),reads:t.reads}}function FA(e,t){return{...HH("command",e,t),invalidates:t.invalidates}}function Roe(e){return e.startsWith(".")||e==="node_modules"}function WH(e){return e.endsWith(".md")&&!e.split("/").some(Roe)}var Ooe=k.String.check(k.makeFilter(e=>WH(e)&&!e.includes("\\")&&!e.includes("\0")&&e.split("/").every(t=>t.length>0&&t!=="..")||"Expected a relative readable Markdown path")),_oe=k.String.check(k.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 observation time with timezone")),ghe=k.Struct({documents:k.Array(k.Struct({file:Ooe,source:k.String})).check(k.makeFilter(e=>new Set(e.map(t=>t.file)).size===e.length||"Duplicate source paths are not a complete observation")),recordedAt:_oe,version:k.Literal(1)}).pipe(k.encodeKeys({recordedAt:"recorded_at"})),VH=k.Struct({action:k.Literals(["check","compare","observe"]),baseline:k.NullOr(k.String)}),KH=k.Struct({discardBaseline:k.Boolean,html:k.String,reason:k.String,snapshot:k.NullOr(k.String)});var Nr=uf("work-board/workspace",k.String),JH=uf("work-board/documents",k.String),GH=uf("work-board/identities",k.String),ZH=uf("work-board/navigation",k.String),Vs=uf("work-board/index",k.String),QH=uf("work-board/watcher",k.String);var Moe=ji("question",{payload:{item:k.String,request:k.String},reads:()=>[Nr.list,Vs.list],rejections:{ResponseFailed:Oi},success:Tj}),Poe=ji("awaitResponse",{payload:{after:k.optional(k.String),question:k.String},reads:()=>[Nr.list,Vs.list],rejections:{ResponseFailed:Oi},success:Cj}),Foe=ji("responses",{payload:{question:k.String},reads:()=>[Nr.list,Vs.list],rejections:{ResponseFailed:Oi},success:kj}),Uoe=FA("registerQuestion",{invalidates:()=>[Nr.list,Vs.list],payload:{item:k.String,request:k.String,revision:Um},rejections:{ResponseFailed:Oi},success:MS}),Doe=FA("recordResponse",{invalidates:()=>[Nr.list,Vs.list],payload:Aj,rejections:{ResponseFailed:Oi},success:PS}),LE=NE("work-board",{commands:[Uoe,Doe],queries:[Moe,Foe,Poe]});function YH(e){let t=new URL(e,"http://127.0.0.1").pathname,n=/^\/_board\/item\/(?<id>[^/]+)\/$/u.exec(t)?.groups?.id,r=JH.item(decodeURIComponent(t.slice(1)));return n?r=GH.item(decodeURIComponent(n)):t.startsWith("/_board/")&&(r=Vs.list),[Nr.list,r]}var Lc=class extends k.TaggedError()("ReadFailed",{operation:k.String,status:k.Number}){},Noe=k.String.check(k.isMaxLength(8192),k.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/work","/_board/overview","/_board/changes","/_board/start","/_board/respond"].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"}})),Loe=k.Struct({html:k.String,status:k.Number}),Boe=k.Struct({file:k.String,href:k.String,kind:k.Literals(["document","heading","passage"]),line:k.optional(k.Number),snippet:k.String,text:k.String,title:k.String}),qoe=ji("page",{payload:{url:Noe},reads:({url:e})=>YH(e),rejections:{ReadFailed:Lc},success:Loe}),joe=ji("navigation",{reads:()=>[Nr.list,ZH.list],rejections:{ReadFailed:Lc},success:k.String}),$oe=ji("search",{payload:{query:k.String.check(k.isMaxLength(8192))},reads:()=>[Nr.list,Vs.list],rejections:{ReadFailed:Lc},success:k.Struct({results:k.Array(Boe),total:k.Number,unavailable:k.Array(k.String)})}),zoe=ji("history",{payload:VH,reads:()=>[Nr.list,Vs.list],rejections:{ReadFailed:Lc},success:KH}),Hoe=ji("watcher",{reads:()=>[Nr.list,QH.list],rejections:{ReadFailed:Lc},success:k.Struct({watching:k.Boolean})}),UA=NE("work-board",{queries:[qoe,joe,$oe,zoe,Hoe]}),Woe=_c.make("work-board.subscribe",{error:Lc,stream:!0,success:LH}),XH=UA.add(Woe).merge(LE);function eW(e,t={}){class n extends UH()("WorkBoard/Reader",{group:XH,protocol:mh.layerProtocolHttp({url:`${e}/_board/rpc`}).pipe(Vr.provide([JS.layer,dh.layerNdjson]))}){}let r=PA(UA,n),o=k$({defaultIdleTTL:0,timeoutResolution:1}),s=BH(n.runtime,{resume:jH(t),resyncKeys:[Nr.list],stream:rr.unwrap(n.use(f=>le.succeed(f("work-board.subscribe",void 0))))});o.mount(s.connection);async function i(f,l){try{return await le.runPromise(Wm(o,f,{suspendOnWaiting:!0}),{signal:l})}catch(p){if(l?.aborted){let m=new Error("Reading canceled",{cause:p});throw m.name="AbortError",m}throw p}}async function a(f,l){try{return await le.runPromise(le.flatMap(Wm(o,n.runtime),p=>le.provideContext(f,p)),{signal:l})}catch(p){if(l?.aborted){let m=new Error("Reading canceled",{cause:p});throw m.name="AbortError",m}throw p}}async function c(f,l){let p=await le.runPromise(le.result(Wm(o,n.runtime.atom(f),{suspendOnWaiting:!0})),{signal:l});if(p._tag==="Failure")throw p.failure;return p.success}let u=PA(LE,n);return{api:r,mutate:c,read:i,registry:o,responses:u,run:a,updates:s}}var BE=new WeakMap;function qE(e){let t=BE.get(e);if(t===void 0){let o=function(){r.registry.dispose(),BE.get(e)===r&&BE.delete(e),e.removeEventListener("pagehide",o)};var n=o;t=eW(e.location.origin,{window:e}),BE.set(e,t);let r=t;e.addEventListener("pagehide",o)}return t}function tW(e,t){return{...e.answers===void 0?{}:{answers:e.answers},...e.supersedes===void 0?{}:{supersedes:e.supersedes},author:e.author,body:e.body,id:e.id,question:t,type:k.decodeUnknownSync(OS)(e.type)}}async function nW(e,t,n,r){t.dataset.outcome="pending",t.textContent="Pending: registering reviewed context, then recording response\u2026";let o=qE(window);try{let s=await o.mutate(o.responses.registerQuestion.run({item:e.dataset.item??"",request:e.dataset.request??"",revision:r.revision}));await o.mutate(o.responses.recordResponse.run(tW(r,s.id))),e.isConnected&&(t.dataset.outcome="saved",t.textContent=`Saved: responses/${r.id}.md. This records feedback, not acceptance.`);let i=n.saved(r);return!i&&e.isConnected&&(t.textContent+=" Your current draft remains unsaved."),i}catch(s){if(e.isConnected){let i=s instanceof Oi&&s.code!=="Uncertain"?"rejected":"uncertain";t.dataset.outcome=i,t.textContent=`${i==="rejected"?"Rejected":"Uncertain"}: ${String(s)}. Draft retained. Preview and retry with the same identity; saved content will be reconciled.`}return!1}}function DA(){let e=document.getElementById("doc");if(e?.dataset.view!=="response")return;let t=e.querySelector("#response-form");if(!t||t.dataset.bound==="true")return;t.dataset.bound="true";let n=t.querySelector("#response-status"),r=t.elements.namedItem("author"),o=t.elements.namedItem("body"),s=t.elements.namedItem("type"),i=t.elements.namedItem("supersedes"),a=t.querySelector("#response-submit"),c=t.querySelector("#response-preview-content"),u=t.querySelector("#response-clear"),f=t.querySelector("#response-preview");if(!(n&&r instanceof HTMLInputElement&&o instanceof HTMLTextAreaElement&&s instanceof HTMLSelectElement&&a&&c&&u&&f))return;n.textContent?.includes("JavaScript is required")&&(n.textContent="Draft ready. Preview the Markdown before recording it.");let l=t.dataset.item??"",p=t.dataset.request??"",m=t.dataset.revision??"",h=t.dataset.question??"",g=`${l}/${p}`,y=`work-board:drafts:${document.documentElement.dataset.workspace}`,b;try{b=window.localStorage}catch{b=void 0}let E=Oj(g,m,b,y,R=>{n.textContent=R}),x=E.current(),w=Pj(t),S=w.restore(x,m);x.question&&x.question!==h&&x.revision===m&&(n.textContent="Source moved since this draft. Text is retained and selections cleared; review the source and preview before responding."),i instanceof HTMLSelectElement&&(i.value=x.supersedes??""),r.value=x.author,o.value=x.body,s.value=x.type;let A={author:r,body:o,type:s};function M(){x=E.update({answers:w.read(),author:A.author.value,body:A.body.value,question:x.question??h,recovery:S,revision:x.revision,supersedes:i instanceof HTMLSelectElement&&i.value||void 0,type:A.type.value})}t.addEventListener("input",()=>{M(),c.hidden=!0,a.disabled=!0}),f.disabled=!1,u.disabled=!1,f.addEventListener("click",()=>{w.validate(s.value),x=E.update({answers:w.read(),author:r.value,body:o.value,id:x.revision===m&&(!x.question||x.question===h)?E.current().id:`response.${crypto.randomUUID()}`,question:h,recovery:S,revision:m,supersedes:i instanceof HTMLSelectElement&&i.value||void 0,type:s.value}),c.textContent=Mj(x,h??"",w.models),c.hidden=!1,a.disabled=t.dataset.writable!=="true"||!t.checkValidity()}),u.addEventListener("click",E.clear),t.addEventListener("submit",async R=>{R.preventDefault(),!(a.disabled||x.revision!==m||x.question!==h||!t.reportValidity())&&(a.disabled=!0,f.disabled=!0,await nW(t,n,E,x)&&(x=E.current(),S=x.recovery,t.isConnected&&(o.value="",w.restore(x,m),i instanceof HTMLSelectElement&&(i.value=""))),f.disabled=!1)})}function rW(){document.addEventListener("board-page",DA),window.addEventListener("pageshow",DA),DA()}typeof window<"u"&&typeof document<"u"&&rW();var lge=qE;export{lge as session};