@seanmozeik/tripwire 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -141
- package/dist/tripwire +0 -0
- package/dist/tripwire-pi.js +4 -0
- package/package.json +50 -22
- package/scripts/tripwire-cli +12 -0
- package/src/cli.ts +64 -57
- package/src/dispatch.ts +322 -114
- package/src/index.ts +1 -1
- package/src/lib/bash.ts +106 -62
- package/src/lib/config.ts +93 -46
- package/src/lib/cursor.ts +336 -0
- package/src/lib/diff.ts +5 -2
- package/src/lib/event.ts +20 -21
- package/src/lib/install.ts +508 -136
- package/src/lib/log.ts +2 -3
- package/src/lib/secrets.ts +151 -88
- package/src/main.ts +31 -0
- package/src/pi-extension.ts +337 -0
- package/src/rules/bash-deny.ts +13 -3
- package/src/rules/bash-git.ts +32 -45
- package/src/rules/bash-network-install.ts +6 -3
- package/src/rules/bash-redirect.ts +5 -5
- package/src/rules/bash-scoped-rm.ts +1 -1
- package/src/rules/bash-tar-explosion.ts +16 -15
- package/src/rules/config-custom.ts +21 -15
- package/src/rules/lazy-code.ts +1 -1
- package/src/rules/path-protect.ts +73 -10
- package/src/rules/post-secret-scrub.ts +17 -6
- package/src/rules/read-protect.ts +5 -15
- package/src/rules/tool-policy.ts +54 -0
- package/dist/tripwire-cli.js +0 -11
- package/dist/tripwire-cli.js.jsc +0 -0
- package/dist/tripwire.js +0 -96
- package/dist/tripwire.js.jsc +0 -0
- package/src/rules/bash-tool-policy.ts +0 -146
package/dist/tripwire.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
// @bun @bytecode @bun-cjs
|
|
3
|
-
(function(exports, require, module, __filename, __dirname) {var eC=Object.create;var{getPrototypeOf:Qj,defineProperty:YQ,getOwnPropertyNames:vK,getOwnPropertyDescriptor:Xj}=Object,xK=Object.prototype.hasOwnProperty;function bK(Q){return this[Q]}var Yj,$j,z=(Q,X,Y)=>{var $=Q!=null&&typeof Q==="object";if($){var J=X?Yj??=new WeakMap:$j??=new WeakMap,Z=J.get(Q);if(Z)return Z}Y=Q!=null?eC(Qj(Q)):{};let G=X||!Q||!Q.__esModule?YQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let W of vK(Q))if(!xK.call(G,W))YQ(G,W,{get:bK.bind(Q,W),enumerable:!0});if($)J.set(Q,G);return G},Jj=(Q)=>{var X=(SK??=new WeakMap).get(Q),Y;if(X)return X;if(X=YQ({},"__esModule",{value:!0}),Q&&typeof Q==="object"||typeof Q==="function"){for(var $ of vK(Q))if(!xK.call(X,$))YQ(X,$,{get:bK.bind(Q,$),enumerable:!(Y=Xj(Q,$))||Y.enumerable})}return SK.set(Q,X),X},SK,r3=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var Zj=(Q)=>Q;function Gj(Q,X){this[Q]=Zj.bind(null,X)}var p6=(Q,X)=>{for(var Y in X)YQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:Gj.bind(X,Y)})};var uA=r3((TX0,cA)=>{var ka=["||","&&",";;","|&","<(","<<<",">>",">&","<&","&",";","(",")","|","<",">"],fA=/[\n\r\u2028\u2029]/,ya=/[\s#!"$&'():;<=>@\\^`|]/g;cA.exports=function(X){return X.map(function(Y){if(Y==="")return"''";if(Y&&typeof Y==="object"){if(Y.op==="glob"){if(typeof Y.pattern!=="string")throw TypeError("glob token requires a string `pattern`");if(fA.test(Y.pattern))throw TypeError("glob `pattern` must not contain line terminators");return Y.pattern.replace(ya,"\\$&")}if(typeof Y.op==="string"){if(ka.indexOf(Y.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(Y.op));return Y.op.replace(/[\s\S]/g,"\\$&")}if(typeof Y.comment==="string"){if(fA.test(Y.comment))throw TypeError("`comment` must not contain line terminators");return"#"+Y.comment}throw TypeError("unrecognized object token shape")}if(/["\s\\]/.test(Y)&&!/'/.test(Y))return"'"+Y.replace(/(['])/g,"\\$1")+"'";if(/["'\s]/.test(Y))return'"'+Y.replace(/(["\\$`!])/g,"\\$1")+'"';return String(Y).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var sA=r3((IX0,aA)=>{var nA="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",lA=new RegExp("^"+nA+"$"),oA="|&;()<> \\t",ga='"((\\\\"|[^"])*?)"',ha="'((\\\\'|[^'])*?)'",ma=/^#$/,rA="'",iA='"',OK="$",y9="",da=4294967296;for(f3=0;f3<4;f3++)y9+=(da*Math.random()).toString(16);var f3,pa=new RegExp("^"+y9);function fa(Q,X){var Y=X.lastIndex,$=[],J;while(J=X.exec(Q))if($.push(J),X.lastIndex===J.index)X.lastIndex+=1;return X.lastIndex=Y,$}function ca(Q,X,Y){var $=typeof Q==="function"?Q(Y):Q[Y];if(typeof $>"u"&&Y!="")$="";else if(typeof $>"u")$="$";if(typeof $==="object")return X+y9+JSON.stringify($)+y9;return X+$}function ua(Q,X,Y){if(!Y)Y={};var $=Y.escape||"\\",J="(\\"+$+`['"`+oA+`]|[^\\s'"`+oA+"])+",Z=new RegExp(["("+nA+")","("+J+"|"+ga+"|"+ha+")+"].join("|"),"g"),G=fa(Q,Z);if(G.length===0)return[];if(!X)X={};var W=!1;return G.map(function(H){var K=H[0];if(!K||W)return;if(lA.test(K))return{op:K};var V=!1,_=!1,q="",D=!1,B;function F(){B+=1;var w,A,s=K.charAt(B);if(s==="{"){if(B+=1,K.charAt(B)==="}")throw Error("Bad substitution: "+K.slice(B-2,B+1));if(w=K.indexOf("}",B),w<0)throw Error("Bad substitution: "+K.slice(B));A=K.slice(B,w),B=w}else if(/[*@#?$!_-]/.test(s))A=s,B+=1;else{var L=K.slice(B);if(w=L.match(/[^\w\d_]/),!w)A=L,B=K.length;else A=L.slice(0,w.index),B+=w.index-1}return ca(X,"",A)}for(B=0;B<K.length;B++){var N=K.charAt(B);if(D=D||!V&&(N==="*"||N==="?"),_)q+=N,_=!1;else if(V)if(N===V)V=!1;else if(V==rA)q+=N;else if(N===$)if(B+=1,N=K.charAt(B),N===iA||N===$||N===OK)q+=N;else q+=$+N;else if(N===OK)q+=F();else q+=N;else if(N===iA||N===rA)V=N;else if(lA.test(N))return{op:K};else if(ma.test(N)){W=!0;var M={comment:Q.slice(H.index+B+1)};if(q.length)return[q,M];return[M]}else if(N===$)_=!0;else if(N===OK)q+=F();else q+=N}if(D)return{op:"glob",pattern:q};return q}).reduce(function(H,K){return typeof K>"u"?H:H.concat(K)},[])}aA.exports=function(X,Y,$){var J=ua(X,Y,$);if(typeof Y!=="function")return J;return J.reduce(function(Z,G){if(typeof G==="object")return Z.concat(G);var W=G.split(RegExp("("+y9+".*?"+y9+")","g"));if(W.length===1)return Z.concat(W[0]);return Z.concat(W.filter(Boolean).map(function(H){if(pa.test(H))return JSON.parse(H.split(y9)[1]);return H}))},[])}});var tA=r3((FK)=>{FK.quote=uA();FK.parse=sA()});var it={};p6(it,{runRulesSync:()=>TK,runRules:()=>ft,normalizeToolName:()=>EK,decide:()=>IK,collectPreToolUseRules:()=>sC,collectPostToolUseRules:()=>tC});module.exports=Jj(it);var pY={};p6(pY,{runMain:()=>Hk});var B1={};p6(B1,{squash:()=>CY,reasonAnnotations:()=>tI,prettyErrors:()=>SI,pretty:()=>iJ,map:()=>Z4,makeInterruptReason:()=>lQ,makeFailReason:()=>cQ,makeDieReason:()=>uQ,isUnknownError:()=>nI,isTimeoutError:()=>hI,isReason:()=>oJ,isNoSuchElementError:()=>vI,isInterruptReason:()=>zI,isIllegalArgumentError:()=>pI,isFailReason:()=>pQ,isExceededCapacityError:()=>fI,isDone:()=>TY,isDieReason:()=>BI,isCause:()=>lJ,isAsyncFiberError:()=>oI,interruptors:()=>II,interrupt:()=>RI,hasInterruptsOnly:()=>AY,hasInterrupts:()=>jI,hasFails:()=>LI,hasDies:()=>PI,fromReasons:()=>fQ,findInterrupt:()=>TI,findFail:()=>MI,findErrorOption:()=>wI,findError:()=>jY,findDie:()=>AI,findDefect:()=>CI,filterInterruptors:()=>EI,fail:()=>OI,empty:()=>rJ,done:()=>IY,die:()=>FI,combine:()=>NI,annotations:()=>eI,annotate:()=>sI,UnknownErrorTypeId:()=>iI,UnknownError:()=>aI,TypeId:()=>DI,TimeoutErrorTypeId:()=>gI,TimeoutError:()=>mI,StackTrace:()=>dD,ReasonTypeId:()=>UI,NoSuchElementErrorTypeId:()=>xI,NoSuchElementError:()=>bI,InterruptorStackTrace:()=>pD,IllegalArgumentErrorTypeId:()=>dI,IllegalArgumentError:()=>oQ,ExceededCapacityErrorTypeId:()=>cI,ExceededCapacityError:()=>uI,DoneTypeId:()=>kI,Done:()=>yI,AsyncFiberErrorTypeId:()=>lI,AsyncFiberError:()=>rI});var H0=(Q,X)=>{switch(X.length){case 0:return Q;case 1:return X[0](Q);case 2:return X[1](X[0](Q));case 3:return X[2](X[1](X[0](Q)));case 4:return X[3](X[2](X[1](X[0](Q))));case 5:return X[4](X[3](X[2](X[1](X[0](Q)))));case 6:return X[5](X[4](X[3](X[2](X[1](X[0](Q))))));case 7:return X[6](X[5](X[4](X[3](X[2](X[1](X[0](Q)))))));case 8:return X[7](X[6](X[5](X[4](X[3](X[2](X[1](X[0](Q))))))));case 9:return X[8](X[7](X[6](X[5](X[4](X[3](X[2](X[1](X[0](Q)))))))));default:{let Y=Q;for(let $=0,J=X.length;$<J;$++)Y=X[$](Y);return Y}}},Wj={pipe(){return H0(this,arguments)}},f6=function(){function Q(){}return Q.prototype=Wj,Q}();var U=function(Q,X){if(typeof Q==="function")return function(){return Q(arguments)?X.apply(this,arguments):(Y)=>X(Y,...arguments)};switch(Q){case 0:case 1:throw RangeError(`Invalid arity ${Q}`);case 2:return function(Y,$){if(arguments.length>=2)return X(Y,$);return function(J){return X(J,Y)}};case 3:return function(Y,$,J){if(arguments.length>=3)return X(Y,$,J);return function(Z){return X(Z,Y,$)}};default:return function(){if(arguments.length>=Q)return X.apply(this,arguments);let Y=arguments;return function($){return X($,...Y)}}}};var u=(Q)=>Q;var V1=(Q)=>()=>Q,n4=V1(!0),O7=V1(!1),i3=V1(null),i8=V1(void 0),h9=i8;function n3(Q,...X){return H0(Q,X)}function s0(Q){let X=new WeakMap;return(Y)=>{if(X.has(Y))return X.get(Y);let $=Q(Y);return X.set(Y,$),$}}var JQ=(Q)=>{let X=new Set(Reflect.ownKeys(Q));if(Q.constructor===Object)return X;if(Q instanceof Error)X.delete("stack");let Y=Object.getPrototypeOf(Q),$=Y;while($!==null&&$!==Object.prototype){let J=Reflect.ownKeys($);for(let Z=0;Z<J.length;Z++)X.add(J[Z]);$=Object.getPrototypeOf($)}if(X.has("constructor")&&typeof Q.constructor==="function"&&Y===Q.constructor.prototype)X.delete("constructor");return X},m9=new WeakSet;function C8(Q){return typeof Q==="string"}function ZQ(Q){return typeof Q==="number"}function kK(Q){return typeof Q==="boolean"}function yK(Q){return typeof Q==="bigint"}function a3(Q){return typeof Q==="symbol"}function F7(Q){return C8(Q)||ZQ(Q)||a3(Q)}function r1(Q){return typeof Q==="function"}function gK(Q){return Q===void 0}function _1(Q){return Q!==void 0}function R7(Q){return Q!=null}function hK(Q){return!1}function s3(Q){return!0}function j1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function t3(Q){return typeof Q==="object"&&Q!==null||r1(Q)}var C=U(2,(Q,X)=>t3(Q)&&(X in Q)),c6=U(2,(Q,X)=>C(Q,"_tag")&&Q._tag===X);function mK(Q){return Q instanceof Error}function B4(Q){return C(Q,Symbol.iterator)||C8(Q)}var D0="~effect/interfaces/Hash",X0=(Q)=>{switch(typeof Q){case"number":return z4(Q);case"bigint":return b0(Q.toString(10));case"boolean":return b0(String(Q));case"symbol":return b0(String(Q));case"string":return b0(Q);case"undefined":return b0("undefined");case"function":case"object":if(Q===null)return b0("null");else if(Q instanceof Date)return b0(Q.toISOString());else if(Q instanceof RegExp)return b0(Q.toString());else{if(m9.has(Q))return N7(Q);if(Q$.has(Q))return Q$.get(Q);let X=_j(Q,()=>{if(Hj(Q))return Q[D0]();else if(typeof Q==="function")return N7(Q);else if(Array.isArray(Q)||ArrayBuffer.isView(Q))return GQ(Q);else if(Q instanceof Map)return Kj(Q);else if(Q instanceof Set)return Vj(Q);return $$(Q)});return Q$.set(Q,X),X}default:throw Error(`BUG: unhandled typeof ${typeof Q} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},N7=(Q)=>{if(!e3.has(Q))e3.set(Q,z4(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return e3.get(Q)},X1=U(2,(Q,X)=>Q*53^X),L7=(Q)=>Q&3221225471|Q>>>1&1073741824,Hj=(Q)=>C(Q,D0),z4=(Q)=>{if(Q!==Q)return b0("NaN");if(Q===1/0)return b0("Infinity");if(Q===-1/0)return b0("-Infinity");let X=Q|0;if(X!==Q)X^=Q*4294967295;while(Q>4294967295)X^=Q/=4294967295;return L7(X)},b0=(Q)=>{let X=5381,Y=Q.length;while(Y)X=X*33^Q.charCodeAt(--Y);return L7(X)},Y$=(Q,X)=>{let Y=12289;for(let $ of X)Y^=X1(X0($),X0(Q[$]));return L7(Y)},$$=(Q)=>Y$(Q,JQ(Q)),J$=(Q,X)=>(Y)=>{let $=Q;for(let J of Y)$^=X(J);return L7($)},GQ=J$(6151,X0),Kj=J$(b0("Map"),([Q,X])=>X1(X0(Q),X0(X))),Vj=J$(b0("Set"),X0),e3=new WeakMap,Q$=new WeakMap,X$=new WeakSet;function _j(Q,X){if(X$.has(Q))return b0("[Circular]");X$.add(Q);let Y=X();return X$.delete(Q),Y}var U0="~effect/interfaces/Equal";function o(){if(arguments.length===1)return(Q)=>u6(Q,arguments[0]);return u6(arguments[0],arguments[1])}function u6(Q,X){if(Q===X)return!0;if(Q==null||X==null)return!1;let Y=typeof Q;if(Y!==typeof X)return!1;if(Y==="number"&&Q!==Q&&X!==X)return!0;if(Y!=="object"&&Y!=="function")return!1;if(m9.has(Q)||m9.has(X))return!1;return Uj(Q,X,Dj)}function qj(Q,X,Y){let $=Z$.has(Q),J=G$.has(X);if($&&J)return!0;if($||J)return!1;Z$.add(Q),G$.add(X);let Z=Y();return Z$.delete(Q),G$.delete(X),Z}var Z$=new WeakSet,G$=new WeakSet;function Dj(Q,X){if(X0(Q)!==X0(X))return!1;else if(Q instanceof Date){if(!(X instanceof Date))return!1;return Q.toISOString()===X.toISOString()}else if(Q instanceof RegExp){if(!(X instanceof RegExp))return!1;return Q.toString()===X.toString()}let Y=dK(Q),$=dK(X);if(Y!==$)return!1;let J=Y&&$;if(typeof Q==="function"&&!J)return!1;return qj(Q,X,()=>{if(J)return Q[U0](X);else if(Array.isArray(Q)){if(!Array.isArray(X)||Q.length!==X.length)return!1;return Bj(Q,X)}else if(ArrayBuffer.isView(Q)){if(!ArrayBuffer.isView(X)||Q.byteLength!==X.byteLength)return!1;return zj(Q,X)}else if(Q instanceof Map){if(!(X instanceof Map)||Q.size!==X.size)return!1;return Fj(Q,X)}else if(Q instanceof Set){if(!(X instanceof Set)||Q.size!==X.size)return!1;return Rj(Q,X)}return Oj(Q,X)})}function Uj(Q,X,Y){let $=M7.get(Q);if(!$)$=new WeakMap,M7.set(Q,$);else if($.has(X))return $.get(X);let J=Y(Q,X);$.set(X,J);let Z=M7.get(X);if(!Z)Z=new WeakMap,M7.set(X,Z);return Z.set(Q,J),J}var M7=new WeakMap;function Bj(Q,X){for(let Y=0;Y<Q.length;Y++)if(!u6(Q[Y],X[Y]))return!1;return!0}function zj(Q,X){if(Q.length!==X.length)return!1;for(let Y=0;Y<Q.length;Y++)if(Q[Y]!==X[Y])return!1;return!0}function Oj(Q,X){let Y=JQ(Q),$=JQ(X);if(Y.size!==$.size)return!1;for(let J of Y)if(!$.has(J)||!u6(Q[J],X[J]))return!1;return!0}function w7(Q,X){return function($,J){for(let[Z,G]of $){let W=!1;for(let[H,K]of J)if(Q(Z,H)&&X(G,K)){W=!0;break}if(!W)return!1}return!0}}var Fj=w7(u6,u6);function P7(Q){return function(Y,$){for(let J of Y){let Z=!1;for(let G of $)if(Q(J,G)){Z=!0;break}if(!Z)return!1}return!0}}var Rj=P7(u6),dK=(Q)=>C(Q,U0);var pK=(Q)=>{return m9.add(Q),Q};var A7=Symbol.for("~effect/Redactable"),Nj=(Q)=>C(Q,A7);function WQ(Q){if(Nj(Q))return W$(Q);return Q}function W$(Q){return Q[A7](globalThis[d9]?.context??Lj)}var d9="~effect/Fiber/currentFiber",Lj={"~effect/Context":{},mapUnsafe:new Map,pipe(){return H0(this,arguments)}};function P(Q,X){let Y=X?.space??0,$=new WeakSet,J=!Y?"":typeof Y==="number"?" ".repeat(Y):Y,Z=(K)=>J.repeat(K),G=(K,V)=>{let _=K?.constructor;return _&&_!==Object.prototype.constructor&&_.name?`${_.name}(${V})`:V},W=(K)=>{try{return Reflect.ownKeys(K)}catch{return["[ownKeys threw]"]}};function H(K,V=0){if(Array.isArray(K)){if($.has(K))return fK;if($.add(K),!J||K.length<=1)return`[${K.map((q)=>H(q,V)).join(",")}]`;let _=K.map((q)=>H(q,V+1)).join(`,
|
|
4
|
-
`+Z(V+1));return`[
|
|
5
|
-
${Z(V+1)}${_}
|
|
6
|
-
${Z(V)}]`}if(K instanceof Date)return H$(K);if(!X?.ignoreToString&&C(K,"toString")&&typeof K.toString==="function"&&K.toString!==Object.prototype.toString&&K.toString!==Array.prototype.toString){let _=Mj(K);if(K instanceof Error&&K.cause)return`${_} (cause: ${H(K.cause,V)})`;return _}if(typeof K==="string")return JSON.stringify(K);if(typeof K==="number"||K==null||typeof K==="boolean"||typeof K==="symbol")return String(K);if(typeof K==="bigint")return String(K)+"n";if(typeof K==="object"||typeof K==="function"){if($.has(K))return fK;if($.add(K),A7 in K)return P(W$(K));if(Symbol.iterator in K)return`${K.constructor.name}(${H(Array.from(K),V)})`;let _=W(K);if(!J||_.length<=1){let D=`{${_.map((B)=>`${O4(B)}:${H(K[B],V)}`).join(",")}}`;return G(K,D)}let q=`{
|
|
7
|
-
${_.map((D)=>`${Z(V+1)}${O4(D)}: ${H(K[D],V+1)}`).join(`,
|
|
8
|
-
`)}
|
|
9
|
-
${Z(V)}}`;return G(K,q)}return String(K)}return H(Q,0)}var fK="[Circular]";function O4(Q){return typeof Q==="string"?JSON.stringify(Q):String(Q)}function C7(Q){return Q.map((X)=>`[${O4(X)}]`).join("")}function H$(Q){try{return Q.toISOString()}catch{return"Invalid Date"}}function Mj(Q){try{let X=Q.toString();return typeof X==="string"?X:String(X)}catch{return"[toString threw]"}}function l6(Q,X){let Y=[];return JSON.stringify(Q,function($,J){let Z=WQ(J);if(typeof Z!=="object"||Z===null)return Z;while(Y.length>0&&Y[Y.length-1]!==this)Y.pop();if(Y.includes(Z))return;return Y.push(Z),Z},X?.space)}var W1=Symbol.for("nodejs.util.inspect.custom"),R1=(Q)=>{try{if(C(Q,"toJSON")&&r1(Q.toJSON)&&Q.toJSON.length===0)return Q.toJSON();else if(Array.isArray(Q))return Q.map(R1)}catch{return"[toJSON threw]"}return WQ(Q)},cK=(Q,X=2)=>{if(typeof Q==="string")return Q;try{return typeof Q==="object"?l6(Q,{space:X}):String(Q)}catch{return String(Q)}},qe={toJSON(){return R1(this)},[W1](){return this.toJSON()},toString(){return P(this.toJSON())}};class a4{called=!1;self;constructor(Q){this.self=Q}next(Q){return this.called?{value:Q,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new a4(this.self)}}var Pj=()=>{let X={["~effect/Utils/internal"]:(J)=>{return J()}},Y={["~effect/Utils/internal"]:(J)=>{try{return J()}finally{}}};return X["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?X["~effect/Utils/internal"]:Y["~effect/Utils/internal"]},V0=Pj();function b(Q,X,Y){if(X==="__proto__")Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Q[X]=Y}function j7(Q,X){for(let Y of Reflect.ownKeys(X))if(Object.prototype.propertyIsEnumerable.call(X,Y))b(Q,Y,X[Y])}var n8="~effect/Effect",o6="~effect/Exit",Aj={_A:u,_E:u,_R:u},lK=`${n8}/identifier`,J0=`${n8}/args`,c0=`${n8}/evaluate`,I1=`${n8}/successCont`,K8=`${n8}/failureCont`,s4=`${n8}/ensureCont`,i6=Symbol.for("effect/Effect/Yield"),F4={pipe(){return H0(this,arguments)},toJSON(){return{...this}},toString(){return P(this.toJSON(),{ignoreToString:!0,space:2})},[W1](){return this.toJSON()}},oK={[D0](){return Y$(this,Object.keys(this))},[U0](Q){let X=Object.keys(this),Y=Object.keys(Q);if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++)if(X[$]!==Y[$]||!o(this[X[$]],Q[X[$]]))return!1;return!0}},Cj={[n8]:Aj,...F4,[Symbol.iterator](){return new a4(this)},toJSON(){return{_id:"Effect",op:this[lK],...J0 in this?{args:this[J0]}:void 0}}},r=(Q)=>C(Q,n8),K$=(Q)=>C(Q,o6),p9="~effect/Cause",f9="~effect/Cause/Reason",c9=(Q)=>C(Q,p9),rK=(Q)=>C(Q,f9);class R4{[p9];reasons;constructor(Q){this[p9]=p9,this.reasons=Q}pipe(){return H0(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((Q)=>Q.toJSON())}}toString(){return`Cause(${P(this.reasons)})`}[W1](){return this.toJSON()}[U0](Q){return c9(Q)&&this.reasons.length===Q.reasons.length&&this.reasons.every((X,Y)=>o(X,Q.reasons[Y]))}[D0](){return GQ(this.reasons)}}var uK=new WeakMap;class KQ{[f9];annotations;_tag;constructor(Q,X,Y){if(this[f9]=f9,this._tag=Q,X!==VQ&&typeof Y==="object"&&Y!==null&&X.size>0){let $=uK.get(Y);if($)X=new Map([...$,...X]);uK.set(Y,X)}this.annotations=X}annotate(Q,X){if(Q.mapUnsafe.size===0)return this;let Y=new Map(this.annotations);Q.mapUnsafe.forEach((J,Z)=>{if(X?.overwrite!==!0&&Y.has(Z))return;Y.set(Z,J)});let $=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return $.annotations=Y,$}pipe(){return H0(this,arguments)}toString(){return P(this)}[W1](){return this.toString()}}var VQ=new Map;class u9 extends KQ{error;constructor(Q,X=VQ){super("Fail",X,Q);this.error=Q}toString(){return`Fail(${P(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[U0](Q){return t4(Q)&&o(this.error,Q.error)&&o(this.annotations,Q.annotations)}[D0](){return X1(b0(this._tag))(X1(X0(this.error))(X0(this.annotations)))}}var N4=(Q)=>new R4(Q),T7=new R4([]),V$=(Q)=>new R4([new u9(Q)]);class I7 extends KQ{defect;constructor(Q,X=VQ){super("Die",X,Q);this.defect=Q}toString(){return`Die(${P(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[U0](Q){return n6(Q)&&o(this.defect,Q.defect)&&o(this.annotations,Q.annotations)}[D0](){return X1(b0(this._tag))(X1(X0(this.defect))(X0(this.annotations)))}}var _$=(Q)=>new R4([new I7(Q)]),l9=U((Q)=>c9(Q[0]),(Q,X,Y)=>{if(X.mapUnsafe.size===0)return Q;return new R4(Q.reasons.map(($)=>$.annotate(X,Y)))}),t4=(Q)=>Q._tag==="Fail",n6=(Q)=>Q._tag==="Die",a6=(Q)=>Q._tag==="Interrupt";function jj(Q){return j8("Effect.evaluate: Not implemented")}var L4=(Q)=>({...Cj,[lK]:Q.op,[c0]:Q[c0]??jj,[I1]:Q[I1],[K8]:Q[K8],[s4]:Q[s4]}),V8=(Q)=>{let X=L4(Q);return function(){let Y=Object.create(X);return Y[J0]=Q.single===!1?arguments:arguments[0],Y}},iK=(Q)=>{let X={...L4(Q),[o6]:o6,_tag:Q.op,get[Q.prop](){return this[J0]},toString(){return`${Q.op}(${P(this[J0])})`},toJSON(){return{_id:"Exit",_tag:Q.op,[Q.prop]:this[J0]}},[U0](Y){return K$(Y)&&Y._tag===this._tag&&o(this[J0],Y[J0])},[D0](){return X1(b0(Q.op),X0(this[J0]))}};return function(Y){let $=Object.create(X);return $[J0]=Y,$}},t0=iK({op:"Success",prop:"value",[c0](Q){let X=Q.getCont(I1);return X?X[I1](this[J0],Q,this):Q.yieldWith(this)}}),E7={key:"effect/Cause/StackTrace"},q$={key:"effect/Cause/InterruptorStackTrace"},g1=iK({op:"Failure",prop:"cause",[c0](Q){let X=this[J0],Y=!1;if(Q.currentStackFrame)X=l9(X,{mapUnsafe:new Map([[E7.key,Q.currentStackFrame]])}),Y=!0;let $=Q.getCont(K8);while(Q.interruptible&&Q._interruptedCause&&$)$=Q.getCont(K8);return $?$[K8](X,Q,Y?void 0:this):Q.yieldWith(Y?g1(X):this)}}),a8=(Q)=>g1(V$(Q)),j8=(Q)=>g1(_$(Q)),e=V8({op:"WithFiber",[c0](Q){return this[J0](Q)}}),Tj=function(){class Q extends globalThis.Error{}let X=L4({op:"YieldableError",[c0](){return a8(this)}});return delete X.toString,Object.assign(Q.prototype,X),Q}(),S7=function(){let Q=Symbol.for("effect/Data/Error/plainArgs");return class extends Tj{constructor(Y){super(Y?.message,Y?.cause?{cause:Y.cause}:void 0);if(Y)j7(this,Y),Object.defineProperty(this,Q,{value:Y,enumerable:!1})}toJSON(){return{...this[Q],...this}}}}(),M4=(Q)=>{class X extends S7{_tag=Q}return X.prototype.name=Q,X},HQ="~effect/Cause/NoSuchElementError",v7=(Q)=>C(Q,HQ);class s8 extends M4("NoSuchElementError"){[HQ]=HQ;constructor(Q){super({message:Q})}}var r6="~effect/Cause/Done",_Q=(Q)=>C(Q,r6),nK={[r6]:r6,_tag:"Done",value:void 0},D$=(Q)=>{if(Q===void 0)return nK;return{[r6]:r6,_tag:"Done",value:Q}},Ij=a8(nK),aK=(Q)=>{if(Q===void 0)return Ij;return a8(D$(Q))};var sK=(Q)=>L4({op:Q.label,[c0]:Q.evaluate});var Sj=()=>{let Q=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(Q===void 0)return Object.isExtensible(Error);return Object.hasOwn(Q,"writable")?Q.writable===!0:Q.set!==void 0},vj=Sj(),Q6=()=>Error.stackTraceLimit,i1=(Q)=>{if(vj)Error.stackTraceLimit=Q};function tK(Q){return{combine:Q}}function w4(Q,X,Y){return{combine:Q,initialValue:X,combineAll:Y??(($)=>{let J=X;for(let Z of $)J=Q(J,Z);return J})}}var H1=(Q)=>(X,Y)=>X===Y||Q(X,Y),bj=(Q,X)=>Q===X,eK=()=>bj;function QV(Q){return H1((X,Y)=>{if(X.length!==Y.length)return!1;for(let $=0;$<X.length;$++)if(!Q(X[$],Y[$]))return!1;return!0})}var XV=(Q)=>U(3,(X,Y,$)=>Q(X,(J)=>({...J,[Y]:$(J)}))),YV=(Q)=>U(2,(X,Y)=>Q(X,($)=>({[Y]:$}))),$V=(Q,X)=>U(3,(Y,$,J)=>X(Y,(Z)=>Q(J(Z),(G)=>({...Z,[$]:G}))));var JV="~effect/data/Option",ZV={[JV]:{_A:(Q)=>Q},...F4,[Symbol.iterator](){return new a4(this)}},yj=Object.defineProperty(Object.assign(Object.create(ZV),{_tag:"Some",_op:"Some",[U0](Q){return b7(Q)&&B$(Q)&&o(this.value,Q.value)},[D0](){return X1(X0(this._tag))(X0(this.value))},toString(){return`some(${P(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:R1(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),gj=X0("None"),hj=Object.assign(Object.create(ZV),{_tag:"None",_op:"None",valueOrUndefined:void 0,[U0](Q){return b7(Q)&&U$(Q)},[D0](){return gj},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),b7=(Q)=>C(Q,JV),U$=(Q)=>Q._tag==="None",B$=(Q)=>Q._tag==="Some",GV=Object.create(hj),WV=(Q)=>{let X=Object.create(yj);return X.value=Q,X};var HV="~effect/data/Result",KV={[HV]:{_A:(Q)=>Q,_E:(Q)=>Q},...F4,[Symbol.iterator](){return new a4(this)}},dj=Object.assign(Object.create(KV),{_tag:"Success",_op:"Success",[U0](Q){return k7(Q)&&O$(Q)&&o(this.success,Q.success)},[D0](){return X1(X0(this._tag))(X0(this.success))},toString(){return`success(${P(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:R1(this.success)}}}),pj=Object.assign(Object.create(KV),{_tag:"Failure",_op:"Failure",[U0](Q){return k7(Q)&&z$(Q)&&o(this.failure,Q.failure)},[D0](){return X1(X0(this._tag))(X0(this.failure))},toString(){return`failure(${P(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:R1(this.failure)}}}),k7=(Q)=>C(Q,HV),z$=(Q)=>Q._tag==="Failure",O$=(Q)=>Q._tag==="Success",VV=(Q)=>{let X=Object.create(pj);return X.failure=Q,X},_V=(Q)=>{let X=Object.create(dj);return X.success=Q,X};function s6(Q){return(X,Y)=>X===Y?0:Q(X,Y)}var D1=s6((Q,X)=>{if(globalThis.Number.isNaN(Q)&&globalThis.Number.isNaN(X))return 0;if(globalThis.Number.isNaN(Q))return-1;if(globalThis.Number.isNaN(X))return 1;return Q<X?-1:1});var _8=s6((Q,X)=>Q<X?-1:1);var F$=U(2,(Q,X)=>s6((Y,$)=>Q(X(Y),X($)))),t6=F$(D1,(Q)=>Q.getTime());var o9=(Q)=>U(2,(X,Y)=>Q(X,Y)===-1),Y6=(Q)=>U(2,(X,Y)=>Q(X,Y)===1),qQ=(Q)=>U(2,(X,Y)=>Q(X,Y)!==1),DQ=(Q)=>U(2,(X,Y)=>Q(X,Y)!==-1);var d=()=>GV,R=WV,y7=b7,I0=U$,L1=B$,T8=U(2,(Q,{onNone:X,onSome:Y})=>I0(Q)?X():Y(Q.value));var g7=U(2,(Q,X)=>I0(Q)?X():Q.value);var qV=(Q)=>Q==null?d():R(Q),DV=(Q)=>Q===void 0?d():R(Q),UV=(Q)=>Q===null?d():R(Q);var R$=g7(i3),e6=g7(i8),Q9=(Q)=>(...X)=>{try{return R(Q(...X))}catch{return d()}};var $6=U(2,(Q,X)=>I0(Q)?d():R(X(Q.value)));var cj=U(2,(Q,X)=>I0(Q)?d():X(Q.value));var i9=cj(u);var n9=U(2,(Q,X)=>I0(Q)?d():X(Q.value)?R(Q.value):d()),BV=(Q)=>H1((X,Y)=>I0(X)?I0(Y):I0(Y)?!1:Q(X.value,Y.value));var zV="~effect/Context/Service",q8=function(){let Q=Q6();i1(2);let X=Error();i1(Q);function Y(){}let $=Y;if(Object.setPrototypeOf($,uj),Object.defineProperty($,"stack",{get(){return X.stack}}),arguments.length>0){if($.key=arguments[0],arguments[1]?.defaultValue)$[h7]=h7,$.defaultValue=arguments[1].defaultValue;return $}return function(J,Z){if($.key=J,Z?.make)$.make=Z.make;return $}},uj={[zV]:zV,...sK({label:"Service",evaluate(Q){return t0(n1(Q.context,this))}}),toJSON(){return{_id:"Service",key:this.key,stack:this.stack}},of(Q){return Q},context(Q){return m7(this,Q)},use(Q){return e((X)=>Q(n1(X.context,this)))},useSync(Q){return e((X)=>t0(Q(n1(X.context,this))))}},h7="~effect/Context/Reference",OV="~effect/Context",J6=(Q)=>{let X=Object.create(lj);return X.mapUnsafe=Q,X.mutable=!1,X},lj={...F4,[OV]:{_Services:(Q)=>Q},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([Q,X])=>({key:Q,value:X}))}},[U0](Q){if(!L$(Q)||this.mapUnsafe.size!==Q.mapUnsafe.size)return!1;for(let X of this.mapUnsafe.keys())if(!Q.mapUnsafe.has(X)||!o(this.mapUnsafe.get(X),Q.mapUnsafe.get(X)))return!1;return!0},[D0](){return z4(this.mapUnsafe.size)}},L$=(Q)=>C(Q,OV);var oj=(Q)=>C(Q,h7),D8=()=>rj,rj=J6(new Map),m7=(Q,X)=>J6(new Map([[Q.key,X]])),a1=U(3,(Q,X,Y)=>MV(Q,($)=>{$.set(X.key,Y)}));var FV=U(2,(Q,X)=>Q.mapUnsafe.get(X.key)),t8=U(2,(Q,X)=>{if(!Q.mapUnsafe.has(X.key)){if(h7 in X)return M$(X);throw ij(X)}return Q.mapUnsafe.get(X.key)}),n1=t8,RV=(Q,X)=>{if(!Q.mapUnsafe.has(X.key))return M$(X);return Q.mapUnsafe.get(X.key)},N$="~effect/Context/defaultValue",M$=(Q)=>{if(N$ in Q)return Q[N$];return Q[N$]=Q.defaultValue()},ij=(Q)=>{let X=Error(`Service not found${Q.key?`: ${String(Q.key)}`:""}`);if(Q.stack){let Y=Q.stack.split(`
|
|
10
|
-
`);if(Y.length>2){let $=Y[2].match(/at (.*)/);if($)X.message=X.message+` (defined at ${$[1]})`}}if(X.stack){let Y=X.stack.split(`
|
|
11
|
-
`);Y.splice(1,3),X.stack=Y.join(`
|
|
12
|
-
`)}return X},NV=U(2,(Q,X)=>{if(Q.mapUnsafe.has(X.key))return R(Q.mapUnsafe.get(X.key));return oj(X)?R(M$(X)):d()}),d7=U(2,(Q,X)=>{if(Q.mapUnsafe.size===0)return X;if(X.mapUnsafe.size===0)return Q;return MV(Q,(Y)=>{X.mapUnsafe.forEach(($,J)=>Y.set(J,$))})}),LV=(...Q)=>{let X=new Map;for(let Y=0;Y<Q.length;Y++)Q[Y].mapUnsafe.forEach(($,J)=>{X.set(J,$)});return J6(X)};var MV=(Q,X)=>{if(Q.mutable)return X(Q.mapUnsafe),Q;let Y=new Map(Q.mapUnsafe);return X(Y),J6(Y)},R0=q8;var w$=(Q)=>Q.length>0;var t=_V,i=VV;var wV=(Q)=>{if(r1(Q))try{return t(Q())}catch(X){return i(X)}else try{return t(Q.try())}catch(X){return i(Q.catch(X))}};var PV=k7,_0=z$,E1=O$;var AV=(Q,X)=>H1((Y,$)=>_0(Y)?_0($)&&X(Y.failure,$.failure):E1($)&&Q(Y.success,$.success));var a9=U(2,(Q,X)=>_0(Q)?i(X(Q.failure)):t(Q.success)),X9=U(2,(Q,X)=>E1(Q)?t(X(Q.success)):i(Q.failure)),B8=U(2,(Q,{onFailure:X,onSuccess:Y})=>_0(Q)?X(Q.failure):Y(Q.success));var UQ=U(2,(Q,X)=>_0(Q)?X(Q.failure):Q.success);var p7=U(2,(Q,X)=>_0(Q)?i(Q.failure):X(Q.success));var le={[Symbol.iterator](){return aj}},aj={next(){return{done:!0,value:void 0}}};var CV=U(2,(Q,X)=>({[Symbol.iterator](){let Y=Q[Symbol.iterator](),$=0;return{next(){let J=Y.next();while(!J.done){if(X(J.value,$++))return{done:!1,value:J.value};J=Y.next()}return{done:!0,value:void 0}}}}}));var f7=U(2,(Q,X)=>{let Y={...Q};for(let $ of tj(Q))b(Y,$,X(Q[$],$));return Y});var tj=(Q)=>Object.keys(Q);var s9=globalThis.Array;var P$=(Q)=>new s9(Q);var M1=(Q)=>s9.isArray(Q)?Q:s9.from(Q),TV=(Q)=>s9.isArray(Q)?Q:[Q];var c7=U(2,(Q,X)=>[...Q,X]),ej=U(2,(Q,X)=>M1(Q).concat(M1(X)));var ae=s9.isArray;var e8=w$,Z6=w$;var BQ=U(2,(Q,X)=>{let Y=s9.from(Q);return Y.sort(X),Y});var QT=(Q,X)=>{let Y=X0(X),$=Q.get(Y);if($===void 0)return Q.set(Y,[X]),!0;for(let J of $)if(o(J,X))return!1;return $.push(X),!0};var A$=U(2,(Q,X)=>{let Y=M1(Q),$=M1(X);if(Z6(Y))return Z6($)?l7(ej(Y,$)):Y;return $});var u7=()=>[];var Q4=U(2,(Q,X)=>Q.map(X));var C$=(Q)=>{let X=[];for(let Y of Q)if(L1(Y))X.push(Y.value);return X};var j$=U(2,(Q,X)=>{let Y=[],$=[],J=0;for(let Z of Q){let G=X(Z,J++);if(E1(G))$.push(G.success);else Y.push(G.failure)}return[Y,$]});var l7=(Q)=>{let X=M1(Q);if(X.length<2)return[...X];let Y=new Map,$=[];for(let J of X)if(QT(Y,J))$.push(J);return $};var XT=w4((Q,X)=>Q.concat(X),[]);function IV(){return XT}var o7="~effect/time/Duration",YT=BigInt(0),$T=BigInt(1);var JT=BigInt(1000);var r7=(Q)=>BigInt(Q<0?Math.ceil(Q-0.5):Math.floor(Q+0.5)),xV=(Q)=>r7(Q*1e6),EV=(Q,X)=>Q.includes(".")?r7(Number(Q)*Number(X)):BigInt(Q)*X;var ZT=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,s1=(Q)=>{switch(typeof Q){case"number":return G6(Q);case"bigint":return Y4(Q);case"string":{if(Q==="Infinity")return P4;if(Q==="-Infinity")return Y9;let X=ZT.exec(Q);if(!X)break;let[Y,$,J]=X;if(J==="nano"||J==="nanos")return Y4(EV($,$T));if(J==="micro"||J==="micros")return Y4(EV($,JT));let Z=Number($);switch(J){case"milli":case"millis":return G6(Z);case"second":case"seconds":return KT(Z);case"minute":case"minutes":return VT(Z);case"hour":case"hours":return _T(Z);case"day":case"days":return qT(Z);case"week":case"weeks":return DT(Z)}break}case"object":{if(Q===null)break;if(o7 in Q)return Q;if(Array.isArray(Q)){if(Q.length!==2||!Q.every(ZQ))return SV(Q);if(Number.isNaN(Q[0])||Number.isNaN(Q[1]))return t9;if(Q[0]===-1/0||Q[1]===-1/0)return Y9;if(Q[0]===1/0||Q[1]===1/0)return P4;return S1(r7(Q[0]*1e9+Q[1]))}let X=Q,Y=0;if(X.weeks)Y+=X.weeks*604800000;if(X.days)Y+=X.days*86400000;if(X.hours)Y+=X.hours*3600000;if(X.minutes)Y+=X.minutes*60000;if(X.seconds)Y+=X.seconds*1000;if(X.milliseconds)Y+=X.milliseconds;if(!X.microseconds&&!X.nanoseconds)return S1(Y);return S1(r7(Y*1e6+(X.microseconds??0)*1000+(X.nanoseconds??0)))}}return SV(Q)},SV=(Q)=>{throw Error(`Invalid Input: ${Q}`)},bV=Q9(s1),vV={_tag:"Millis",millis:0},GT={_tag:"Infinity"},WT={_tag:"NegativeInfinity"},HT={[o7]:o7,[D0](){return $$(this.value)},[U0](Q){return I$(Q)&&BT(this,Q)},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"}}},[W1](){return this.toJSON()},pipe(){return H0(this,arguments)}},S1=(Q)=>{let X=Object.create(HT);if(typeof Q==="number")if(isNaN(Q)||Q===0||Object.is(Q,-0))X.value=vV;else if(!Number.isFinite(Q))X.value=Q>0?GT:WT;else if(!Number.isInteger(Q))X.value={_tag:"Nanos",nanos:xV(Q)};else X.value={_tag:"Millis",millis:Q};else if(Q===YT)X.value=vV;else X.value={_tag:"Nanos",nanos:Q};return X},I$=(Q)=>C(Q,o7);var t9=S1(0),P4=S1(1/0),Y9=S1(-1/0),Y4=(Q)=>S1(Q);var G6=(Q)=>S1(Q),KT=(Q)=>S1(Q*1000),VT=(Q)=>S1(Q*60000),_T=(Q)=>S1(Q*3600000),qT=(Q)=>S1(Q*86400000),DT=(Q)=>S1(Q*604800000),W6=(Q)=>UT(s1(Q),{onMillis:u,onNanos:(X)=>Number(X)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var T$=(Q)=>{let X=s1(Q);switch(X.value._tag){case"Infinity":case"NegativeInfinity":throw Error("Cannot convert infinite duration to nanos");case"Nanos":return X.value.nanos;case"Millis":return xV(X.value.millis)}},kV=Q9(T$);var UT=U(2,(Q,X)=>{switch(Q.value._tag){case"Millis":return X.onMillis(Q.value.millis);case"Nanos":return X.onNanos(Q.value.nanos);case"Infinity":return X.onInfinity();case"NegativeInfinity":return(X.onNegativeInfinity??X.onInfinity)()}}),yV=U(3,(Q,X,Y)=>{if(Q.value._tag==="Infinity"||Q.value._tag==="NegativeInfinity"||X.value._tag==="Infinity"||X.value._tag==="NegativeInfinity")return Y.onInfinity(Q,X);if(Q.value._tag==="Millis")return X.value._tag==="Millis"?Y.onMillis(Q.value.millis,X.value.millis):Y.onNanos(T$(Q),X.value.nanos);else return Y.onNanos(Q.value.nanos,T$(X))});var E$=(Q,X)=>yV(Q,X,{onMillis:(Y,$)=>Y===$,onNanos:(Y,$)=>Y===$,onInfinity:(Y,$)=>Y.value._tag===$.value._tag});var gV=U(2,(Q,X)=>yV(Q,X,{onMillis:(Y,$)=>S1(Y-$),onNanos:(Y,$)=>S1(Y-$),onInfinity:(Y,$)=>{let J=Y.value._tag,Z=$.value._tag;if(J==="Infinity")return Z==="Infinity"?t9:P4;if(J==="NegativeInfinity")return Z==="NegativeInfinity"?t9:Y9;return Z==="Infinity"?Y9:P4}}));var BT=U(2,(Q,X)=>E$(Q,X));var Q5=U(2,(Q,X)=>(Y)=>{let $=Q(Y);if(_0($))return i(Y);let J=X($.success);if(_0(J))return i(Y);return J}),hV=(Q)=>(X)=>{let Y=Q(X);return _0(Y)?d():R(Y.success)};var zQ=R0("effect/Scheduler",{defaultValue:()=>new X5}),dV="setImmediate"in globalThis?(Q)=>{let X=globalThis.setImmediate(Q);return()=>globalThis.clearImmediate(X)}:(Q)=>{let X=setTimeout(Q,0);return()=>clearTimeout(X)};class pV{buckets=[];scheduleTask(Q,X){let Y=this.buckets,$=Y.length,J,Z=0;for(;Z<$;Z++){if(Y[Z][0]>X)break;J=Y[Z]}if(J&&J[0]===X)J[1].push(Q);else if(Z===$)Y.push([X,[Q]]);else Y.splice(Z,0,[X,[Q]])}drain(){let Q=this.buckets;return this.buckets=[],Q}}class X5{executionMode;setImmediate;constructor(Q="async",X=dV){this.executionMode=Q,this.setImmediate=X}shouldYield(Q){return Q.currentOpCount>=Q.maxOpsBeforeYield}makeDispatcher(){return new fV(this.setImmediate)}}class fV{tasks=new pV;running=void 0;setImmediate;constructor(Q=dV){this.setImmediate=Q}scheduleTask(Q,X){if(this.tasks.scheduleTask(Q,X),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let Q=this.tasks.drain();for(let X=0;X<Q.length;X++){let Y=Q[X][1];for(let $=0;$<Y.length;$++)Y[$]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var cV=R0("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),uV=R0("effect/Scheduler/PreventSchedulerYield",{defaultValue:()=>!1});var S$="effect/Tracer/ParentSpan";class i7 extends q8()(S$){}var zT=(Q)=>Q;var n7=R0("effect/Tracer/DisablePropagation",{defaultValue:O7}),rV=R0("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),iV=R0("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),v$="effect/Tracer",a7=R0(v$,{defaultValue:()=>zT({span:(Q)=>new nV(Q)})});class nV{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(Q){this.name=Q.name,this.parent=Q.parent,this.annotations=Q.annotations,this.links=Q.links,this.startTime=Q.startTime,this.kind=Q.kind,this.sampled=Q.sampled,this.status={_tag:"Started",startTime:Q.startTime},this.attributes=new Map,this.traceId=e6(Q.parent)?.traceId??oV(32),this.spanId=oV(16)}end(Q,X){this.status={_tag:"Ended",endTime:Q,exit:X,startTime:this.status.startTime}}attribute(Q,X){this.attributes.set(Q,X)}event(Q,X,Y){this.events.push([Q,X,Y??{}])}addLinks(Q){this.links.push(...Q)}}var oV=function(){return function(Y){let $="";for(let J=0;J<Y;J++)$+="abcdef0123456789".charAt(Math.floor(Math.random()*16));return $}}();var aV="effect/observability/Metric/FiberRuntimeMetricsKey";var sV=R0("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),OQ=R0("effect/References/CurrentStackFrame",{defaultValue:i8}),s7=R0("effect/References/TracerEnabled",{defaultValue:n4}),FQ=R0("effect/References/TracerTimingEnabled",{defaultValue:n4}),RQ=R0("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),NQ=R0("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),A4=R0("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),x$=R0("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),b$=R0("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"});var t7=R0("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var e7=(Q)=>{if(Q?.captureStackTrace===!1)return Q;else if(Q?.captureStackTrace!==void 0&&typeof Q.captureStackTrace!=="boolean")return Q;let X=Q6();i1(3);let Y=Error();return i1(X),{...Q,captureStackTrace:NT(()=>Y.stack)}},k$=(Q)=>(X)=>{let Y;return()=>{if(Y!==void 0)return Y;let $=X();if(!$)return;let J=$.split(`
|
|
13
|
-
`);if(J[Q]!==void 0)return Y=J[Q].trim(),Y}},NT=k$(3);var tV="dev";class u$ extends KQ{fiberId;constructor(Q,X=VQ){super("Interrupt",X,"Interrupted");this.fiberId=Q}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[U0](Q){return a6(Q)&&this.fiberId===Q.fiberId&&this.annotations===Q.annotations}[D0](){return X1(b0(`${this._tag}:${this.fiberId}`))(N7(this.annotations))}}var Z_=(Q)=>new u$(Q),J5=(Q)=>new R4([new u$(Q)]),l$=(Q)=>Q.reasons.some(t4),o$=(Q)=>{let X=Q.reasons.find(t4);return X?t(X):i(Q)},z8=(Q)=>{for(let X=0;X<Q.reasons.length;X++){let Y=Q.reasons[X];if(Y._tag==="Fail")return t(Y.error)}return i(Q)},G_=hV(z8),XY=(Q)=>Q.reasons.some(n6),W_=(Q)=>{let X=Q.reasons.find(n6);return X?t(X):i(Q)},TQ=(Q)=>{let X=Q.reasons.find(n6);return X?t(X.defect):i(Q)},YY=(Q)=>Q.reasons.some(a6),H_=(Q)=>{let X=Q.reasons.find(a6);return X?t(X):i(Q)},$Y=(Q)=>{let X;for(let Y=0;Y<Q.reasons.length;Y++){let $=Q.reasons[Y];if($._tag!=="Interrupt")continue;if(X??=new Set,$.fiberId!==void 0)X.add($.fiberId)}return X?t(X):i(Q)},K_=(Q)=>{let X=$Y(Q);return _0(X)?LT:X.success},LT=new Set,V_=(Q)=>Q.reasons.length>0&&Q.reasons.every(a6),__=(Q)=>J6(Q.annotations),q_=(Q)=>{let X=new Map;for(let Y of Q.reasons)if(Y.annotations.size>0)for(let[$,J]of Y.annotations)X.set($,J);return J6(X)},r$=U(2,(Q,X)=>{if(Q.reasons.length===0)return X;else if(X.reasons.length===0)return Q;let Y=new R4(A$(Q.reasons,X.reasons));return o(Q,Y)?Q:Y}),D_=U(2,(Q,X)=>{let Y=!1,$=Q.reasons.map((J)=>{if(t4(J))return Y=!0,new u9(X(J.error));return J});return Y?N4($):Q}),MT=(Q)=>{let X={Fail:[],Die:[],Interrupt:[]};for(let Y=0;Y<Q.reasons.length;Y++)X[Q.reasons[Y]._tag].push(Q.reasons[Y]);return X},JY=(Q)=>{let X=MT(Q);if(X.Fail.length>0)return X.Fail[0].error;else if(X.Die.length>0)return X.Die[0].defect;else if(X.Interrupt.length>0)return new globalThis.Error("All fibers interrupted without error");return new globalThis.Error("Empty cause")},i$=(Q,X)=>{let Y=[],$=[];if(Q.reasons.length===0)return Y;let J=Q6();i1(1);for(let Z of Q.reasons){if(Z._tag==="Interrupt"){$.push(Z);continue}Y.push(g$(Z._tag==="Die"?Z.defect:Z.error,Z.annotations,X))}if(Y.length===0){let Z=Error("The fiber was interrupted by:");Z.name="InterruptCause",Z.stack=CT(Z,$);let G=new globalThis.Error("All fibers interrupted without error",{cause:Z});G.name="InterruptError",G.stack=`${G.name}: ${G.message}`,Y.push(g$(G,$[0].annotations,X))}return i1(J),Y},g$=(Q,X,Y)=>{let $=typeof Q,J;if(Q&&$==="object"){if(J=new globalThis.Error(wT(Q),{cause:Q.cause?g$(Q.cause):void 0}),typeof Q.name==="string")J.name=Q.name;if(typeof Q.stack==="string")J.stack=AT(Q.stack,J,X);else{let Z=`${J.name}: ${J.message}`;J.stack=X?U_(Z,X):Z}if(Y?.includeCauseInStack)J.stack=z_(J);for(let Z of Object.keys(Q))if(!(Z in J))J[Z]=Q[Z]}else J=new globalThis.Error(!Q?`Unknown error: ${Q}`:$==="string"?Q:l6(Q));return J},wT=(Q)=>{if(typeof Q.message==="string")return Q.message;else if(typeof Q.toString==="function"&&Q.toString!==Object.prototype.toString&&Q.toString!==Array.prototype.toString)try{return Q.toString()}catch{}return l6(Q)},PT=/\((.*)\)/g,AT=(Q,X,Y)=>{let $=`${X.name}: ${X.message}`,J=(Q.startsWith($)?Q.slice($.length):Q).split(`
|
|
14
|
-
`),Z=[$];for(let G=1;G<J.length;G++){if(/(?:Generator\.next|~effect\/Effect)/.test(J[G]))break;Z.push(J[G])}return Y?U_(Z.join(`
|
|
15
|
-
`),Y):Z.join(`
|
|
16
|
-
`)},U_=(Q,X)=>{let Y=X?.get(E7.key);if(Y)Q=`${Q}
|
|
17
|
-
${B_(Y)}`;return Q},CT=(Q,X)=>{let Y=[`${Q.name}: ${Q.message}`];for(let $ of X){let J=$.fiberId!==void 0?`#${$.fiberId}`:"unknown",Z=$.annotations.get(q$.key);if(Y.push(` at fiber (${J})`),Z)Y.push(B_(Z))}return Y.join(`
|
|
18
|
-
`)},B_=(Q)=>{let X=[],Y=Q,$=0;while(Y&&$<10){let J=Y.stack();if(J){let Z=J.matchAll(PT),G=!1;for(let[,W]of Z)G=!0,X.push(` at ${Y.name} (${W})`);if(!G)X.push(` at ${Y.name} (${J.replace(/^at /,"")})`)}else X.push(` at ${Y.name}`);Y=Y.parent,$++}return X.join(`
|
|
19
|
-
`)},ZY=(Q)=>i$(Q).map(z_).join(`
|
|
20
|
-
`),z_=(Q)=>Q.cause?`${Q.stack} {
|
|
21
|
-
${O_(Q.cause," ")}
|
|
22
|
-
}`:Q.stack,O_=(Q,X)=>{let Y=Q.stack.split(`
|
|
23
|
-
`),$=`${X}[cause]: ${Y[0]}`;for(let J=1,Z=Y.length;J<Z;J++)$+=`
|
|
24
|
-
${X}${Y[J]}`;if(Q.cause)$+=` {
|
|
25
|
-
${O_(Q.cause,`${X} `)}
|
|
26
|
-
${X}}`;return $},h$=`~effect/Fiber/${tV}`,jT={_A:u,_E:u},TT={id:0},GY=()=>globalThis[d9];class n${constructor(Q,X=!0){this[h$]=jT,this.setContext(Q),this.id=++TT.id,this.currentOpCount=0,this.interruptible=X,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)}[h$];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(Q){return RV(this.context,Q)}addObserver(Q){if(this._exit)return Q(this._exit),h9;return this._observers.push(Q),()=>{let X=this._observers.indexOf(Q);if(X>=0)this._observers.splice(X,1)}}interruptUnsafe(Q,X){if(this._exit)return;let Y=J5(Q);if(this.currentStackFrame)Y=l9(Y,m7(E7,this.currentStackFrame));if(X)Y=l9(Y,X);if(this._interruptedCause=this._interruptedCause?r$(this._interruptedCause,Y):Y,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(P0(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(Q){if(this._exit)return;else if(this._yielded!==void 0){let $=this._yielded;this._yielded=void 0,$()}let X=this.runLoop(Q);if(X===i6)return;let Y=m$.interruptChildren&&m$.interruptChildren(this);if(Y!==void 0)return this.evaluate(S(Y,()=>X));this._exit=X,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let $=0;$<this._observers.length;$++)this._observers[$](X);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=D8()}runLoop(Q){let X=globalThis[d9];globalThis[d9]=this;let Y=this._running;this._running=!0;let $=!1,J=Q;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,J=P0(this._interruptedCause);if(this.currentOpCount++,!$&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){$=!0;let Z=J;J=S(G5,()=>Z)}if(J=this.currentTracerContext?this.currentTracerContext(J,this):J[c0](this),J===i6){let Z=this._yielded;if(o6 in Z)return this._deferredInterrupt=!1,this._yielded=void 0,Z;else if(this._deferredInterrupt){this._yielded=void 0,Z();continue}return i6}}}catch(Z){if(!C(J,c0))return j8(`Fiber.runLoop: Not a valid effect: ${String(J)}`);return this.runLoop(j8(Z))}finally{this._running=Y,globalThis[d9]=X}}getCont(Q){if(this._deferredInterrupt)return this._deferredInterrupt=!1,IT;while(!0){let X=this._stack.pop();if(!X)return;let Y=X[s4]&&X[s4](this);if(Y)return Y[Q]=Y,Y;if(X[Q])return X}}yieldWith(Q){return this._yielded=Q,i6}children(){return this._children??=new Set}pipe(){return H0(this,arguments)}setContext(Q){this.context=Q;let X=this.getRef(zQ);if(X!==this.currentScheduler)this.currentScheduler=X,this._dispatcher=void 0;this.currentSpan=Q.mapUnsafe.get(S$),this.currentLogLevel=this.getRef(x$),this.minimumLogLevel=this.getRef(b$),this.currentStackFrame=Q.mapUnsafe.get(OQ.key),this.maxOpsBeforeYield=this.getRef(cV),this.currentPreventYield=this.getRef(uV),this.runtimeMetrics=Q.mapUnsafe.get(aV);let Y=Q.mapUnsafe.get(v$);this.currentTracerContext=Y?Y.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}var IT={[I1](Q,X){return P0(X._interruptedCause)},[K8](Q,X){return P0(X._interruptedCause)}},m$={interruptChildren:void 0},WY=(Q)=>{if(!Q.currentStackFrame)return;let X=new Map;return X.set(q$.key,Q.currentStackFrame),J6(X)},ET=(Q)=>{if(Q._children===void 0||Q._children.size===0)return;return J9(Q._children)},ST=(Q)=>{let X=Q;if(X._exit)return j(X._exit);return h1((Y)=>{if(X._exit)return Y(j(X._exit));return K0(Q.addObserver(($)=>Y(j($))))})},a$=(Q)=>h1((X)=>{let Y=Q[Symbol.iterator](),$=[],J=void 0;function Z(){let G=Y.next();while(!G.done){if(G.value._exit){$.push(G.value._exit),G=Y.next();continue}J=G.value.addObserver((W)=>{$.push(W),Z()});return}X(j($))}return Z(),K0(()=>J?.())});var vT=(Q)=>e((X)=>xT(Q,X.id)),xT=U((Q)=>C(Q[0],h$),(Q,X,Y)=>e(($)=>{let J=WY($);return J=J&&Y?d7(J,Y):J??Y,Q.interruptUnsafe(X,J),EQ(ST(Q))})),J9=(Q)=>e((X)=>{let Y=WY(X),$=u7();for(let J of Q)J.interruptUnsafe(X.id,Y),$.push(J);return EQ(a$($))});var j=t0,P0=g1,E0=a8,K0=V8({op:"Sync",[c0](Q){let X=this[J0](),Y=Q.getCont(I1);return Y?Y[I1](X,Q):Q.yieldWith(t0(X))}}),Q0=V8({op:"Suspend",[c0](Q){return this[J0]()}}),F_=U((Q)=>Q.length>=2||y7(Q[0]),(Q,X)=>I0(Q)?E0(X?X():new s8("Effect.fromOption: Option.none")):j(Q.value)),Z5=B8({onFailure:E0,onSuccess:j}),R_=(Q)=>Q==null?E0(new s8):j(Q),s$=V8({op:"Yield",[c0](Q){let X=!1;return Q.currentDispatcher.scheduleTask(()=>{if(X)return;Q.evaluate(e1)},this[J0]??0),Q.yieldWith(()=>{X=!0})}}),G5=s$(0),t$=(Q)=>j(R(Q)),IQ=j(d()),N_=(Q)=>I0(Q)?IQ:M0(Q.value,R),L_=(Q)=>Q0(()=>P0(V0(Q))),K6=(Q)=>j8(Q),HY=(Q)=>Q0(()=>E0(V0(Q))),$0=j(void 0);var M_=(Q)=>{let X=typeof Q==="function"?Q:Q.try,Y=typeof Q==="function"?($)=>new dQ($,"An error occurred in Effect.try"):Q.catch;return Q0(()=>{try{return j(V0(X))}catch($){return E0(V0(()=>Y($)))}})};var e$=(Q)=>QJ(function(X,Y){V0(()=>Q(Y)).then(($)=>X(j($)),($)=>X(K6($)))},Q.length!==0),w_=(Q)=>{let X=typeof Q==="function"?Q:Q.try,Y=typeof Q==="function"?($)=>new dQ($,"An error occurred in Effect.tryPromise"):Q.catch;return QJ(function($,J){let Z=(G)=>{try{$(E0(V0(()=>Y(G))))}catch(W){$(K6(W))}};try{V0(()=>X(J)).then((G)=>$(j(G)),Z)}catch(G){Z(G)}},X.length!==0)},P_=(Q)=>e((X)=>Q(X.id)),A_=e(j),C_=P_(j),QJ=V8({op:"Async",single:!1,[c0](Q){let X=V0(()=>this[J0][0].bind(Q.currentScheduler)),Y=!1,$=!1,J=this[J0][1]?new AbortController:void 0,Z=X((G)=>{if(Y)return;if(Y=!0,$)Q.evaluate(G);else $=G},J?.signal);if($!==!1)return $;if($=!0,Q._yielded=()=>{Y=!0},J===void 0&&Z===void 0)return i6;return Q._stack.push(bT(()=>{return Y=!0,J?.abort(),Z??e1})),i6}}),bT=V8({op:"AsyncFinalizer",[s4](Q){if(Q.interruptible)Q.interruptible=!1,Q._stack.push(NY)},[K8](Q,X){return YY(Q)?S(this[J0](),()=>P0(Q)):P0(Q)}}),h1=(Q)=>QJ(Q,Q.length>=2),KY=h1(h9),j_=(...Q)=>Q0(()=>Y5(Q.length===1?Q[0]():Q[1].call(Q[0].self))),XJ=(Q,...X)=>{let Y=X.length===0?function(){return Q0(()=>Y5(Q.apply(this,arguments)))}:function(){let $=Q0(()=>Y5(Q.apply(this,arguments)));for(let J=0;J<X.length;J++)$=X[J]($,...arguments);return $};return YJ(Q.length,Y)},YJ=(Q,X)=>Object.defineProperty(X,"length",{value:Q,configurable:!0}),eV=k$(2),T_=function(){let Q=typeof arguments[0]==="string",X=Q?arguments[0]:"Effect.fn",Y=Q?arguments[1]:void 0,$=Q6();i1(2);let J=new globalThis.Error;if(i1($),Q)return(Z,...G)=>Q_(X,Z,J,G,Q,Y);return Q_(X,arguments[0],J,Array.prototype.slice.call(arguments,1),Q,Y)},Q_=(Q,X,Y,$,J,Z)=>{let G=typeof X==="function"?X:$.pop().bind(X.self);return YJ(G.length,function(...W){let H=Q0(()=>{let _=G.apply(this,arguments);return r(_)?_:Y5(_)});for(let _=0;_<$.length;_++)H=$[_](H,...W);if(!r(H))return H;let K=Q6();i1(2);let V=new globalThis.Error;return i1(K),C4(J?MQ(Q,Z,(_)=>c$(H,_)):H,OQ,(_)=>({name:Q,stack:eV(()=>V.stack),parent:{name:`${Q} (definition)`,stack:eV(()=>Y.stack),parent:_}}))})},I_=(Q,...X)=>YJ(Q.length,X.length===0?function(){return X_(()=>Q.apply(this,arguments))}:function(){let Y=X_(()=>Q.apply(this,arguments));for(let $ of X)Y=$(Y);return Y}),X_=(Q)=>{try{let X=Q(),Y=void 0;while(!0){let $=X.next(Y);if($.done)return j($.value);let J=$.value;if(J&&J._tag==="Success"){Y=J.value;continue}else if(J&&J._tag==="Failure")return $.value;else{let Z=!0;return Q0(()=>{if(Z)return Z=!1,S($.value,(G)=>Y5(X,G));else return Q0(()=>Y5(Q()))})}}}catch(X){return K6(X)}},Y5=V8({op:"Iterator",single:!1,[I1](Q,X){let Y=this[J0][0];while(!0){let $=Y.next(Q);if($.done)return j($.value);if(!w1($.value))return X._stack.push(this),$.value;else if($.value._tag==="Failure")return $.value;Q=$.value.value}},[c0](Q){return this[I1](this[J0][1],Q)}}),Q8=U(2,(Q,X)=>{let Y=j(X);return S(Q,($)=>Y)}),VY=(Q)=>M0(Q,R),E_=(Q)=>G9(Q,{onFailure:j,onSuccess:E0}),V6=U(2,(Q,X)=>S(Q,(Y)=>r(X)?X:V0(()=>X(Y)))),Z9=U(2,(Q,X)=>S(Q,(Y)=>Q8(r(X)?X:V0(()=>X(Y)),Y))),EQ=(Q)=>S(Q,(X)=>e1),S_=(Q)=>O8(Q,E0),$J=(Q,X)=>e((Y)=>h1(($)=>{let J=M1(Q),Z=J.length,G=0,W=!1,H=new Set,K=[],V=(_,q,D)=>{if(G++,_._tag==="Failure"){if(K.push(..._.cause.reasons),G>=Z)$(P0(N4(K)));return}let B=!W;if(W=!0,$(H.size===0?_:S(I4(J9(H)),()=>_)),B&&X?.onWinner)X.onWinner({fiber:q,index:D,parentFiber:Y})};for(let _=0;_<Z;_++){let q=W9(Y,J[_],!0,!0,!1);if(H.add(q),q.addObserver((D)=>{H.delete(q),V(D,q,_)}),W)break}return J9(H)})),JJ=(Q,X)=>e((Y)=>h1(($)=>{let J=!1,Z=new Set,G=(H)=>{J=!0,$(Z.size===0?H:S(I4(J9(Z)),()=>H))},W=0;for(let H of Q){if(J)break;let K=W++,V=W9(Y,H,!0,!0,!1);Z.add(V),V.addObserver((_)=>{Z.delete(V);let q=!J;if(G(_),q&&X?.onWinner)X.onWinner({fiber:V,index:K,parentFiber:Y})})}return J9(Z)})),v_=U((Q)=>r(Q[1]),(Q,X,Y)=>$J([Q,X],Y)),_Y=U((Q)=>r(Q[1]),(Q,X,Y)=>JJ([Q,X],Y)),S=U(2,(Q,X)=>{let Y=Object.create(kT);return Y[J0]=Q,Y[I1]=X.length!==1?($)=>X($):X,Y}),kT=L4({op:"OnSuccess",[c0](Q){return Q._stack.push(this),this[J0]}}),x_=U(2,(Q,X)=>{if(w1(Q))return Q._tag==="Success"?X.onSuccess(Q.value):X.onFailure(Q.cause);return $4(Q,X)}),w1=(Q)=>(o6 in Q),b_=U(2,(Q,X)=>{if(w1(Q))return Q._tag==="Success"?X(Q.value):Q;return S(Q,X)}),k_=(Q)=>S(Q,u),M0=U(2,(Q,X)=>S(Q,(Y)=>j(V0(()=>X(Y))))),y_=U(2,(Q,X)=>w1(Q)?WJ(Q,X):M0(Q,X)),g_=U(2,(Q,X)=>w1(Q)?HJ(Q,X):OJ(Q,X)),h_=U(2,(Q,X)=>w1(Q)?KJ(Q,X):FJ(Q,X)),m_=U(2,(Q,X)=>{if(w1(Q)){if(Q._tag==="Success")return Q;let Y=z8(Q.cause);if(_0(Y))return Q;return X(Y.success)}return X8(Q,X)}),d_=(Q)=>g1(J5(Q)),W5=(Q)=>Q._tag==="Success",p_=(Q)=>Q._tag==="Success"?t(Q):i(Q),f_=(Q)=>Q._tag==="Success"?t(Q.value):i(Q),ZJ=(Q)=>Q._tag==="Failure",c_=(Q)=>Q._tag==="Failure"?t(Q):i(Q),SQ=(Q)=>Q._tag==="Failure"?t(Q.cause):i(Q),GJ=Q5(SQ,z8),u_=Q5(SQ,TQ),l_=(Q)=>Q._tag==="Failure"&&YY(Q.cause),o_=(Q)=>Q._tag==="Failure"&&XY(Q.cause),r_=(Q)=>Q._tag==="Failure"&&l$(Q.cause),e1=t0(void 0),WJ=U(2,(Q,X)=>Q._tag==="Success"?t0(X(Q.value)):Q),HJ=U(2,(Q,X)=>{if(Q._tag==="Success")return Q;let Y=z8(Q.cause);if(_0(Y))return Q;return a8(X(Y.success))}),KJ=U(2,(Q,X)=>{if(Q._tag==="Success")return t0(X.onSuccess(Q.value));let Y=z8(Q.cause);if(_0(Y))return Q;return a8(X.onFailure(Y.success))}),yT=U(2,(Q,X)=>W5(Q)?t0(X):Q);var i_=U(2,(Q,X)=>W5(Q)?X.onSuccess(Q.value):X.onFailure(Q.cause)),n_=yT(void 0),VJ=(Q)=>{let X=[];for(let Y of Q)if(Y._tag==="Failure")X.push(...Y.cause.reasons);return X.length===0?e1:g1(N4(X))},a_=(Q)=>W5(Q)?R(Q.value):d(),s_=(Q)=>ZJ(Q)?R(Q.cause):d(),t_=(Q)=>{let X=GJ(Q);return _0(X)?d():R(X.success)},e_=(Q)=>Q,Qq=(Q)=>e((X)=>j(NV(X.context,Q))),gT=(Q)=>e((X)=>X.context.mapUnsafe.has(Q.key)?j(t8(X.context,Q)):E0(new s8)),H5=U(2,(Q,X)=>e((Y)=>{let $=Y.context,J=X($);if($===J)return Q;return Y.setContext(J),_5(Q,()=>{Y.setContext($);return})})),C4=U(3,(Q,X,Y)=>H5(Q,($)=>{let J=t8($,X),Z=Y(J);if(J===Z)return $;return a1($,X,Z)})),Xq=(Q,X,Y)=>I4(e(($)=>{let J=t8($.context,Q),Z=X(J);return $.setContext(a1($.context,Q,Z)),T4(t8($.context,V5),(G)=>{let W=t8($.context,Q),H;if(Y?.reset===void 0){if(W!==Z)return $0;H=J}else H=Y.reset(J,Z,W);return $.setContext(a1($.context,Q,H)),$0})})),_J=()=>hT,hT=e((Q)=>j(Q.context)),_6=(Q)=>e((X)=>Q(X.context)),Yq=U(2,(Q,X)=>H5(Q,V1(X))),j4=U(2,(Q,X)=>{if(w1(Q))return Q;return H5(Q,d7(X))}),m1=function(){if(arguments.length===1)return U(2,(Q,X)=>Y_(Q,arguments[0],X));return U(3,(Q,X,Y)=>Y_(Q,X,Y)).apply(this,arguments)},Y_=(Q,X,Y)=>H5(Q,($)=>{if($.mapUnsafe.get(X.key)===Y)return $;return a1($,X,Y)}),qY=U(3,(Q,X,Y)=>S(Y,($)=>m1(Q,X,$))),$q=U((Q)=>r(Q[1]),(Q,X,Y)=>qJ(Q,X,($,J)=>[$,J],Y)),qJ=U((Q)=>r(Q[1]),(Q,X,Y,$)=>$?.concurrent?M0(hQ([Q,X],{concurrency:2}),([J,Z])=>V0(()=>Y(J,Z))):S(Q,(J)=>M0(X,(Z)=>V0(()=>Y(J,Z))))),Jq=U((Q)=>r(Q[0]),(Q,X,Y)=>bJ(Q,X,Y?($)=>E0(Y($)):()=>E0(new s8))),Zq=U(2,(Q,X)=>S(X,(Y)=>Y?VY(Q):IQ)),DJ=U(2,(Q,X)=>Array.from({length:X},()=>Q)),Gq=U((Q)=>r(Q[0]),(Q,X,Y)=>hQ(DJ(Q,X),Y)),DY=U((Q)=>r(Q[0]),(Q,X)=>E4({while:n4,body:V1(X?.disableYield?Q:S(Q,(Y)=>G5)),step:h9})),O8=U(2,(Q,X)=>{let Y=Object.create(mT);return Y[J0]=Q,Y[K8]=X.length!==1?($)=>X($):X,Y}),mT=L4({op:"OnFailure",[c0](Q){return Q._stack.push(this),this[J0]}}),UJ=U(3,(Q,X,Y)=>O8(Q,($)=>{if(!X($))return P0($);return V0(()=>Y($))})),K5=U(3,(Q,X,Y)=>O8(Q,($)=>{let J=X($);return _0(J)?P0(J.failure):V0(()=>Y(J.success,$))})),X8=U(2,(Q,X)=>K5(Q,z8,(Y)=>X(Y))),Wq=(Q)=>G9(Q,{onFailure:(X)=>v7(X)?IQ:E0(X),onSuccess:t$}),Hq=U(2,(Q,X)=>K5(Q,TQ,X)),Kq=U(2,(Q,X)=>O8(Q,(Y)=>V6(V0(()=>X(Y)),P0(Y)))),Vq=U(3,(Q,X,Y)=>UJ(Q,X,($)=>V6(V0(()=>Y($)),P0($)))),UY=U(3,(Q,X,Y)=>O8(Q,($)=>{let J=X($);if(_0(J))return P0($);return V6(V0(()=>Y(J.success,$)),P0($))})),BJ=U(2,(Q,X)=>UY(Q,z8,(Y)=>X(Y))),_q=U(3,(Q,X,Y)=>{let $=Array.isArray(X)?(J)=>C(J,"_tag")&&X.includes(J._tag):c6(X);return BJ(Q,(J)=>$(J)?Y(J):$0)}),qq=U(2,(Q,X)=>UY(Q,TQ,(Y)=>X(Y))),vQ=U((Q)=>r(Q[0]),(Q,X,Y,$)=>O8(Q,(J)=>{let Z=z8(J);if(_0(Z))return P0(Z.failure);if(!X(Z.success))return $?V0(()=>$(Z.success)):P0(J);return V0(()=>Y(Z.success))})),BY=U((Q)=>r(Q[0]),(Q,X,Y,$)=>O8(Q,(J)=>{let Z=z8(J);if(_0(Z))return P0(Z.failure);let G=X(Z.success);if(_0(G))return $?V0(()=>$(G.failure)):P0(J);return V0(()=>Y(G.success))})),zJ=U((Q)=>r(Q[0]),(Q,X,Y,$)=>{let J=Array.isArray(X)?(Z)=>C(Z,"_tag")&&X.includes(Z._tag):c6(X);return vQ(Q,J,Y,$)}),Dq=U((Q)=>r(Q[0]),(Q,X,Y)=>{let $;return BY(Q,(J)=>{return $??=Object.keys(X),C(J,"_tag")&&C8(J._tag)&&$.includes(J._tag)?t(J):i(J)},(J)=>V0(()=>X[J._tag](J)),Y)}),Uq=U((Q)=>r(Q[0]),(Q,X,Y,$,J)=>vQ(Q,(Z)=>c6(Z,X)&&C(Z,"reason"),(Z)=>{let G=Z.reason;if(c6(G,Y))return $(G,Z);return J?V0(()=>J(G,Z)):E0(Z)})),Bq=U((Q)=>r(Q[0]),(Q,X,Y,$)=>{let J;return vQ(Q,(Z)=>c6(Z,X)&&C(Z,"reason")&&C(Z.reason,"_tag")&&C8(Z.reason._tag),(Z)=>{let G=Z.reason;if(J??=Object.keys(Y),J.includes(G._tag))return V0(()=>Y[G._tag](G,Z));return $?V0(()=>$(G,Z)):E0(Z)})}),zq=U(2,(Q,X)=>BY(Q,(Y)=>{if(c6(Y,X)&&C(Y,"reason"))return t(Y.reason);return i(Y)},E0)),OJ=U(2,(Q,X)=>X8(Q,(Y)=>HY(()=>X(Y)))),FJ=U(2,(Q,X)=>G9(Q,{onFailure:(Y)=>HY(()=>X.onFailure(Y)),onSuccess:(Y)=>K0(()=>X.onSuccess(Y))})),RJ=(Q)=>X8(Q,K6),Oq=U(2,(Q,X)=>X8(Q,(Y)=>K0(X))),Fq=(Q)=>Q0(()=>{let X=Q[Symbol.iterator](),Y=X.next();if(Y.done)return K6(Error("Received an empty collection of effects"));function $(J){let Z=X.next();if(Z.done)return J.value;return X8(J.value,(G)=>$(Z))}return $(Y)}),NJ=(Q)=>X8(Q,(X)=>S(G5,()=>NJ(Q))),Rq=U((Q)=>r(Q[0]),(Q,X)=>{if(!X?.log)return G9(Q,{onFailure:($)=>$0,onSuccess:($)=>$0});let Y=E8(X.log===!0?void 0:X.log);return $4(Q,{onFailure($){let J=o$($);return _0(J)?P0(J.failure):X.message===void 0?Y($):Y(X.message,$)},onSuccess:($)=>$0})}),Nq=U((Q)=>r(Q[0]),(Q,X)=>{if(!X?.log)return $4(Q,{onFailure:($)=>$0,onSuccess:($)=>$0});let Y=E8(X.log===!0?void 0:X.log);return $4(Q,{onFailure:($)=>X.message===void 0?Y($):Y(X.message,$),onSuccess:($)=>$0})}),Lq=(Q)=>zY(Q,{onFailure:d,onSuccess:R}),H6=(Q)=>xQ(Q,{onFailure:i,onSuccess:t}),$4=U(2,(Q,X)=>{let Y=Object.create(dT);return Y[J0]=Q,Y[I1]=X.onSuccess.length!==1?($)=>X.onSuccess($):X.onSuccess,Y[K8]=X.onFailure.length!==1?($)=>X.onFailure($):X.onFailure,Y}),dT=L4({op:"OnSuccessAndFailure",[c0](Q){return Q._stack.push(this),this[J0]}}),LJ=U(2,(Q,X)=>$4(Q,{onFailure:(Y)=>K0(()=>X.onFailure(Y)),onSuccess:(Y)=>K0(()=>X.onSuccess(Y))})),G9=U(2,(Q,X)=>$4(Q,{onFailure:(Y)=>{let $=Y.reasons.find(t4);return $?V0(()=>X.onFailure($.error)):P0(Y)},onSuccess:X.onSuccess})),zY=U(2,(Q,X)=>G9(Q,{onFailure:(Y)=>K0(()=>X.onFailure(Y)),onSuccess:(Y)=>K0(()=>X.onSuccess(Y))})),xQ=U(2,(Q,X)=>{if(w1(Q)){if(Q._tag==="Success")return t0(X.onSuccess(Q.value));let Y=z8(Q.cause);if(_0(Y))return Q;return t0(X.onFailure(Y.success))}return zY(Q,X)}),Mq=U(2,(Q,X)=>{if(w1(Q)){if(Q._tag==="Success")return t0(X.onSuccess(Q.value));return t0(X.onFailure(Q.cause))}return LJ(Q,X)}),bQ=(Q)=>w1(Q)?t0(Q):pT(Q),pT=V8({op:"Exit",[c0](Q){return Q._stack.push(this),this[J0]},[I1](Q,X,Y){return j(Y??t0(Q))},[K8](Q,X,Y){return j(Y??g1(Q))}}),wq=xQ({onFailure:()=>!0,onSuccess:()=>!1}),Pq=xQ({onFailure:()=>!1,onSuccess:()=>!0}),Aq=U(2,(Q,X)=>V6(K9(X),Q)),MJ=U(2,(Q,X)=>_Y(Q,S(K9(X.duration),X.orElse))),Cq=U(2,(Q,X)=>MJ(Q,{duration:X,orElse:()=>E0(new wY)})),jq=U(2,(Q,X)=>_Y(VY(Q),Q8(K9(X),d()))),Tq=(Q)=>H9((X)=>{let Y=X.currentTimeNanosUnsafe();return M0(Q,($)=>[Y4(X.currentTimeNanosUnsafe()-Y),$])}),d$="~effect/Scope",p$="~effect/Scope/Closeable",V5=q8("effect/Scope"),wJ=(Q,X)=>Q0(()=>OY(Q,X)??$0),OY=(Q,X)=>{if(Q.state._tag==="Closed")return;let Y={_tag:"Closed",exit:X};if(Q.state._tag==="Empty"){Q.state=Y;return}let{finalizers:$}=Q.state;if(Q.state=Y,$.size===0)return;else if($.size===1)return $.values().next().value(X);return fT(Q,$,X)},fT=XJ(function*(Q,X,Y){let $=[],J=[],Z=Array.from(X.values()),G=GY();for(let W=Z.length-1;W>=0;W--){let H=Z[W];if(Q.strategy==="sequential")$.push(yield*bQ(H(Y)));else J.push(W9(G,H(Y),!0,!0,"inherit"))}if(J.length>0)$=yield*a$(J);return yield*VJ($)});var Iq=(Q,X)=>{let Y=kQ(X);if(Q.state._tag==="Closed")return Y.state=Q.state,Y;let $={};return QY(Q,$,(J)=>wJ(Y,J)),QY(Y,$,(J)=>K0(()=>Eq(Q,$))),Y},T4=(Q,X)=>{return Q0(()=>{if(Q.state._tag==="Closed")return X(Q.state.exit);return QY(Q,{},X),$0})};var QY=(Q,X,Y)=>{if(Q.state._tag==="Empty")Q.state={_tag:"Open",finalizers:new Map([[X,Y]])};else if(Q.state._tag==="Open")Q.state.finalizers.set(X,Y)},Eq=(Q,X)=>{if(Q.state._tag==="Open")Q.state.finalizers.delete(X)},kQ=(Q="sequential")=>({[p$]:p$,[d$]:d$,strategy:Q,state:cT}),cT={_tag:"Empty"};var yQ=V5;var PJ=(Q)=>e((X)=>{let Y=X.context,$=kQ();return X.setContext(a1(X.context,V5,$)),_5(Q,(J)=>{return X.setContext(Y),OY($,J)})});var FY=(Q)=>Q0(()=>{let X=kQ();return v1(Q(X),(Y)=>Q0(()=>OY(X,Y)??$0))}),RY=(Q,X,Y)=>_6(($)=>gQ((J)=>S(yQ,(Z)=>Z9(Y?.interruptible?J(Q):Q,(G)=>T4(Z,(W)=>j4(X(G,W),$)))))),AJ=(Q)=>S(yQ,(X)=>_6((Y)=>T4(X,($)=>j4(Q($),Y)))),_5=V8({op:"OnExit",single:!1,[c0](Q){return Q._stack.push(this),this[J0][0]},[s4](Q){if(Q.interruptible&&this[J0][2]!==!0)Q._stack.push(NY),Q.interruptible=!1},[I1](Q,X,Y){Y??=t0(Q);let $=this[J0][1](Y);return $?S($,(J)=>Y):Y},[K8](Q,X,Y){Y??=g1(Q);let $=this[J0][1](Y);return $?S($,(J)=>Y):Y}}),v1=U(2,_5),Sq=U(2,(Q,X)=>v1(Q,(Y)=>X)),CJ=U(3,(Q,X,Y)=>v1(Q,($)=>{if(!X($))return $0;return Y($)})),jJ=U(3,(Q,X,Y)=>v1(Q,($)=>{let J=X($);return _0(J)?$0:Y(J.success,$)})),TJ=U(2,(Q,X)=>jJ(Q,SQ,X)),vq=U(3,(Q,X,Y)=>CJ(Q,($)=>{if($._tag!=="Failure")return!1;return X($.cause)},($)=>Y($.cause))),IJ=U(3,(Q,X,Y)=>v1(Q,($)=>{if($._tag!=="Failure")return $0;let J=X($.cause);return _0(J)?$0:Y(J.success,$.cause)})),xq=U(2,(Q,X)=>IJ($Y,X)(Q)),bq=(Q,X,Y)=>gQ(($)=>S(Q,(J)=>_5($(X(J)),(Z)=>Y(J,Z),!0))),kq=(Q)=>RY(Q,(X)=>C(X,Symbol.asyncDispose)?e$(()=>X[Symbol.asyncDispose]()):K0(()=>X[Symbol.dispose]())),EJ=U(2,(Q,X)=>K0(()=>{let Y=W6(s1(X)),$=Number.isFinite(Y),J=rT(!1),Z=0,G=!1,W,H=S(J.await,()=>W);return[e((K)=>{let V=K.getRef(J4),_=$?V.currentTimeMillisUnsafe():0;if(G||_<Z)return W??H;return G=!0,J.closeUnsafe(),W=void 0,v1(Q,(q)=>K0(()=>{G=!1,Z=V.currentTimeMillisUnsafe()+Y,W=q,J.openUnsafe()}))}),K0(()=>{Z=0,J.closeUnsafe(),W=void 0})]})),SJ=U(2,(Q,X)=>M0(EJ(Q,X),(Y)=>Y[0])),yq=(Q)=>SJ(Q,P4),gq=e((Q)=>P0(J5(Q.id))),I4=(Q)=>e((X)=>{if(!X.interruptible)return Q;return X.interruptible=!1,X._stack.push(NY),Q}),hq=V8({op:"SetInterruptible",[s4](Q){if(Q.interruptible=this[J0],Q._interruptedCause&&Q.interruptible)return()=>P0(Q._interruptedCause)}}),NY=hq(!0),uT=hq(!1),mq=(Q)=>{if(Q.interruptible=!0,Q._stack.push(uT),Q._interruptedCause)return P0(Q._interruptedCause)},vJ=(Q)=>e((X)=>{if(X.interruptible)return Q;return mq(X)??Q}),gQ=(Q)=>e((X)=>{if(!X.interruptible)return Q(u);return X.interruptible=!1,X._stack.push(NY),Q(vJ)}),dq=(Q)=>e((X)=>{if(X.interruptible)return Q(u);let Y=mq(X),$=Q(I4);return Y??$}),pq=M0(RY(K0(()=>new AbortController),(Q)=>K0(()=>Q.abort())),(Q)=>Q.signal),hQ=(Q,X)=>{if(B4(Q))return X?.mode==="result"?t1(Q,H6,X):t1(Q,u,X);else if(X?.discard)return X.mode==="result"?t1(Object.values(Q),H6,X):t1(Object.values(Q),u,X);return Q0(()=>{let Y={};return Q8(t1(Object.entries(Q),([$,J])=>M0(X?.mode==="result"?H6(J):J,(Z)=>{b(Y,$,Z)}),{discard:!0,concurrency:X?.concurrency}),Y)})},xJ=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X,Y)=>M0(t1(Q,($,J)=>H6(X($,J)),Y),($)=>j$($,u))),fq=U(3,(Q,X,Y)=>{let $=M1(Q);if($.length===0)return K0(X);return Q0(()=>{let J=0,Z=X();return M0(E4({while:()=>J<$.length,body:()=>Y(Z,$[J],J),step(G){Z=G,J++}}),()=>Z)})}),cq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X,Y)=>S(xJ(Q,X,{concurrency:Y?.concurrency}),([$,J])=>{if(e8($))return E0($);return Y?.discard?$0:j(J)})),uq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X)=>Q0(()=>{let Y=Q[Symbol.iterator](),$=Y.next();if(!$.done)return lq(Y,0,X,$.value);return j(d())})),lq=(Q,X,Y,$)=>S(Y($,X),(J)=>{if(J)return j(R($));let Z=Q.next();if(!Z.done)return lq(Q,X+1,Y,Z.value);return j(d())}),oq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X)=>Q0(()=>{let Y=Q[Symbol.iterator](),$=Y.next();if(!$.done)return rq(Y,0,X,$.value);return j(d())})),rq=(Q,X,Y,$)=>S(Y($,X),(J)=>{if(E1(J))return j(R(J.success));let Z=Q.next();if(!Z.done)return rq(Q,X+1,Y,Z.value);return j(d())}),E4=V8({op:"While",[I1](Q,X){if(this[J0].step(Q),this[J0].while())return X._stack.push(this),this[J0].body();return e1},[c0](Q){if(this[J0].while())return Q._stack.push(this),this[J0].body();return e1}}),t1=U((Q)=>typeof Q[1]==="function",(Q,X,Y)=>Q0(()=>{let $=Y?.concurrency??1,J=$==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,$);if(J===1)return lT(Q,X,Y);let Z=M1(Q),G=Z.length;if(G===0)return Y?.discard?$0:j([]);let W=Y?.discard?void 0:Array(G),H=oT({f:X,out:W},Z,{concurrency:J});return H?Q8(H,W):j(W)})),lT=(Q,X,Y)=>Q0(()=>{let $=Y?.discard?void 0:[],J=Q[Symbol.iterator](),Z=J.next(),G=0;return Q8(E4({while:()=>!Z.done,body:()=>X(Z.value,G++),step:(W)=>{if($)$.push(W);Z=J.next()}}),$)}),iq=(Q)=>{let{onItem:X,step:Y}=Q;return($,J,Z)=>{let G=Z?.start??0,W=Z?.end??J.length,H=Z?.concurrency??1,K=Z?.orderedStep===!0&&H>1,V=!1,_,q,D,B=!1,F,N,M=G,w=K?Array(W):void 0,A=(x)=>{let I=j8(x);return F=I,V=!0,B=!0,q&&q.size>0?S(I4(J9(Array.from(q))),()=>I):I},s=(x,I,W0)=>{if(!K)return Y($,x,I,W0);if(F)return F;w[W0]=I;while(M<W){let T0=w[M];if(T0===void 0)return;w[M]=void 0;let o1=M++,F1=Y($,J[o1],T0,o1);if(F1)return F1}},L=()=>{let x=!1;for(;!F&&G<W;G++){let I=J[G],W0=N??X($,I,G);if(w1(W0)){if(F=s(I,W0,G),F)break}else if(H===1)return S(bQ(W0),(T0)=>{return F=s(I,T0,G),G++,F??L()??$0});else if(!_)return h1((T0)=>{_=GY(),q=new Set,N=W0,D=T0;let o1;try{o1=L()}catch(F1){return T0(A(F1))}if(o1)return T0(o1);return Q0(()=>{return F=e1,B=!0,q?J9(q):$0})});else{N=void 0;let T0=W9(_,W0,!0,!0,"inherit");if(T0._exit){if(F=s(I,T0._exit,G),F)break;continue}q.add(T0);let o1=G;if(T0.addObserver((F1)=>{q.delete(T0);try{if(F){if(!B&&F1._tag==="Failure")for(let x0 of F1.cause.reasons)if(x0._tag==="Interrupt")continue;else if(F._tag==="Failure")F.cause.reasons.push(x0);else F=g1(N4([x0]))}else{let x0=s(I,F1,o1);if(x0)F=x0._tag==="Failure"?g1(N4(x0.cause.reasons.slice())):x0,L()}if(x){let x0=L();if(x0)D(x0)}else if(V&&q.size===0)D(F??$0)}catch(x0){D(A(x0))}}),q.size<H)continue;x=!0,G++;return}}if(V=!0,F){if(q&&q.size>0){let I=WY(_);q.forEach((W0)=>W0.interruptUnsafe(_.id,I));return}if(D||F._tag==="Failure")return F}else if(D){if(!q)return e1;else if(q.size===0)D($0)}};return L()}},mQ=()=>iq,oT=iq({onItem(Q,X,Y){return Q.f(X,Y)},step(Q,X,Y,$){if(Y._tag==="Failure")return Y;else if(Q.out)Q.out[$]=Y.value}}),bJ=U(3,(Q,X,Y)=>S(Q,($)=>X($)?j($):Y($))),kJ=U(3,(Q,X,Y)=>S(Q,($)=>{let J=X($);return _0(J)?Y(J.failure):j(J.success)})),nq=U((Q)=>r(Q[0]),(Q,X,Y)=>kJ(Q,X,Y?($)=>E0(Y($)):()=>E0(new s8))),aq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X,Y)=>Q0(()=>{let $=[];return Q8(t1(Q,(J,Z)=>{let G=X(J,Z);if(typeof G==="boolean"){if(G)$.push(J);return $0}return M0(G,(W)=>{if(W)$.push(J)})},{discard:!0,concurrency:Y?.concurrency}),$)})),sq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X)=>Q0(()=>{let Y=[];for(let $ of Q){let J=X($);if(E1(J))Y.push(J.success)}return j(Y)})),tq=U((Q)=>B4(Q[0])&&!r(Q[0]),(Q,X,Y)=>Q0(()=>{let $=[];return Q8(t1(Q,(J)=>M0(X(J),(Z)=>{if(E1(Z))$.push(Z.success)}),{discard:!0,concurrency:Y?.concurrency}),$)})),eq=j({}),QD=YV(M0),XD=$V(M0,S),YD=XV(M0);var $D=U((Q)=>r(Q[0]),(Q,X)=>e((Y)=>{return _I(),j(W9(Y,Q,X?.startImmediately,!1,X?.uninterruptible??!1))})),W9=(Q,X,Y=!1,$=!1,J=!1)=>{let Z=J==="inherit"?Q.interruptible:!J,G=new n$(Q.context,Z);if(Y)G.evaluate(X);else Q.currentDispatcher.scheduleTask(()=>G.evaluate(X),0);if(!$&&!G._exit)Q.children().add(G),G.addObserver(()=>Q._children.delete(G));return G},JD=U((Q)=>r(Q[0]),(Q,X)=>e((Y)=>j(W9(Y,Q,X?.startImmediately,!0,X?.uninterruptible)))),ZD=(Q)=>e((X)=>{let Y=X._children&&new Set(X._children);return v1(Q,($)=>{let J=X._children;if(J===void 0||J.size===0)return $0;else if(Y)J=CV(J,(Z)=>!Y.has(Z));return EQ(a$(J))})}),yJ=U((Q)=>r(Q[0]),(Q,X,Y)=>e(($)=>{let J=W9($,Q,Y?.startImmediately,!0,Y?.uninterruptible);if(!J._exit)if(X.state._tag!=="Closed"){let Z={};QY(X,Z,()=>P_((W)=>W===J.id?$0:vT(J))),J.addObserver(()=>Eq(X,Z))}else J.interruptUnsafe($.id,WY($));return j(J)})),GD=U((Q)=>r(Q[0]),(Q,X)=>S(yQ,(Y)=>yJ(Q,Y,X))),S4=(Q)=>(X,Y)=>{let $=new n$(Y?.scheduler?a1(Q,zQ,Y.scheduler):Q,Y?.uninterruptible!==!0);if($.evaluate(X),$._exit)return $;if(Y?.signal)if(Y.signal.aborted)$.interruptUnsafe();else{let J=()=>$.interruptUnsafe();Y.signal.addEventListener("abort",J,{once:!0}),$.addObserver(()=>Y.signal.removeEventListener("abort",J))}if(Y?.onFiberStart)Y.onFiberStart($);return $};var WD=S4(D8()),gJ=(Q)=>{let X=S4(Q);return(Y,$)=>{let J=X(Y,$);if($?.onExit)J.addObserver($.onExit);return(Z)=>{return J.interruptUnsafe(Z)}}},HD=gJ(D8()),LY=(Q)=>{let X=S4(Q);return(Y,$)=>{let J=X(Y,$);return new Promise((Z)=>{J.addObserver((G)=>Z(G))})}},KD=LY(D8()),hJ=(Q)=>{let X=LY(Q);return(Y,$)=>X(Y,$).then((J)=>{if(J._tag==="Failure")throw JY(J.cause);return J.value})},VD=hJ(D8()),MY=(Q)=>{let X=S4(Q);return(Y)=>{if(w1(Y))return Y;let $=new X5("sync"),J=X(Y,{scheduler:$});return J._dispatcher?.flush(),J._exit??j8(new PY(J))}},_D=MY(D8()),mJ=(Q)=>{let X=MY(Q);return(Y)=>{let $=X(Y);if($._tag==="Failure")throw JY($.cause);return $.value}},qD=mJ(D8()),$_=j(!0),J_=j(!1);class DD{waiters=[];scheduled=void 0;_isOpen;constructor(Q){this._isOpen=Q}scheduleUnsafe(Q){if(this.waiters.length===0)return $_;if(this.scheduled===void 0)this.scheduled=this.waiters,Q.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let X=0;X<this.waiters.length;X++)this.scheduled.push(this.waiters[X]);return this.waiters=[],$_}flushScheduled=()=>{if(this.scheduled===void 0)return;let Q=this.scheduled;this.scheduled=void 0;for(let X=0;X<Q.length;X++)Q[X](e1)};flushWaiters(){let Q=this.waiters;this.waiters=[],this.flushScheduled();for(let X=0;X<Q.length;X++)Q[X](e1)}open=e((Q)=>{if(this._isOpen)return J_;return this._isOpen=!0,this.scheduleUnsafe(Q)});release=e((Q)=>this._isOpen?J_:this.scheduleUnsafe(Q));openUnsafe(){if(this._isOpen)return!1;return this._isOpen=!0,this.flushWaiters(),!0}await=h1((Q)=>{if(this._isOpen)return Q($0);return this.waiters.push(Q),K0(()=>{let X=this.waiters.indexOf(Q);if(X!==-1)this.waiters.splice(X,1);else if(this.scheduled!==void 0){if(X=this.scheduled.indexOf(Q),X!==-1)this.scheduled.splice(X,1)}})});closeUnsafe(){if(!this._isOpen)return!1;return this._isOpen=!1,!0}close=K0(()=>this.closeUnsafe());whenOpen=(Q)=>S(this.await,()=>Q);isOpen(){return this._isOpen}}var rT=(Q)=>new DD(Q??!1);var UD=e((Q)=>j(Q.getRef(a7))),BD=U(2,(Q,X)=>m1(Q,a7,X)),zD=m1(s7),OD=m1(FQ),f$=BigInt(0),iT={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:f$,endTime:f$,exit:e1},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},nT=(Q)=>Object.assign(Object.create(iT),Q),FD=(Q)=>{if(!Q)return d();return n1(Q.annotations,n7)?Q._tag==="Span"?FD(e6(Q.parent)):d():R(Q)},dJ=(Q,X,Y)=>{let $=!Q.getRef(s7)||Y?.annotations&&n1(Y.annotations,n7),J=Y?.parent!==void 0?R(Y.parent):Y?.root?d():FD(Q.currentSpan),Z;if($)Z=nT({name:X,parent:J,annotations:a1(Y?.annotations??D8(),n7,!0)});else{let G=Q.getRef(a7),W=Q.getRef(J4),H=Q.getRef(FQ),K=Q.getRef(RQ),V=Q.getRef(NQ),_=Y?.level??Q.getRef(rV),q=Y?.links!==void 0?[...V,...Y.links]:V.slice();Z=G.span({name:X,parent:J,annotations:Y?.annotations??D8(),links:q,startTime:H?W.currentTimeNanosUnsafe():BigInt(0),kind:Y?.kind??"internal",root:Y?.root??I0(J),sampled:Y?.sampled??(L1(J)&&J.value.sampled===!1?!1:!yD(Q.getRef(iV),_))});for(let[D,B]of Object.entries(K))Z.attribute(D,B);if(Y?.attributes!==void 0)for(let[D,B]of Object.entries(Y.attributes))Z.attribute(D,B)}return Z},RD=(Q,X)=>e((Y)=>j(dJ(Y,Q,X))),LQ=(Q,X)=>I4(e((Y)=>{let $=t8(Y.context,V5),J=dJ(Y,Q,X??{}),Z=Y.getRef(J4),G=Y.getRef(FQ);return Q8(T4($,(W)=>sT(J,W,Z,G)),J)})),ND=function(){let Q=typeof arguments[0]!=="string",X=Q?arguments[1]:arguments[0],Y=e7(Q?arguments[2]:arguments[1]);if(Q){let $=arguments[0];return S(LQ(X,Y),(J)=>$5($,J,Y))}return($)=>S(LQ(X,Y),(J)=>$5($,J,Y))},aT=(Q,X)=>{return X=typeof X==="function"?X:i8,C4(OQ,(Y)=>({name:Q,stack:X,parent:Y}))},LD=RQ,MD=NQ,wD=U((Q)=>r(Q[0]),(Q,X,Y={})=>{let J=(Array.isArray(X)?X:[X]).map((Z)=>({span:Z,attributes:Y}));return C4(Q,NQ,(Z)=>[...Z,...J])}),sT=(Q,X,Y,$)=>K0(()=>{if(Q.status._tag==="Ended")return;Q.end($?Y.currentTimeNanosUnsafe():f$,X)}),MQ=(Q,...X)=>{let Y=X.length===1?void 0:X[0],$=X[X.length-1];return e((J)=>{let Z=dJ(J,Q,Y),G=J.getRef(J4);return v1(V0(()=>$(Z)),(W)=>K0(()=>{if(Z.status._tag==="Ended")return;Z.end(G.currentTimeNanosUnsafe(),W)}))})},c$=m1(i7),$5=function(){let Q=r(arguments[0]),X=Q?arguments[1]:arguments[0],Y=Q?arguments[2]:arguments[1],$=u;if(X._tag==="Span")Y=e7(Y),$=aT(X.name,Y?.captureStackTrace);if(Q)return c$($(arguments[0]),X);return(J)=>c$($(J),X)},PD=function(){let Q=typeof arguments[0]!=="string",X=Q?arguments[1]:arguments[0],Y=e7(arguments[2]);if(Q){let Z=arguments[0];return MQ(X,arguments[2],(G)=>$5(Z,G,Y))}let $=typeof arguments[1]==="function"?arguments[1]:void 0,J=$?void 0:arguments[1];return(Z,...G)=>MQ(X,$?$(...G):J,(W)=>$5(Z,W,Y))},AD=U((Q)=>r(Q[0]),(Q,...X)=>C4(Q,RQ,(Y)=>{let $=X.length===1?{...Y,...X[0]}:{...Y};if(X.length===1)return $;else b($,X[0],X[1]);return $})),CD=(...Q)=>e((X)=>{let Y=X.currentSpanLocal;if(Y)if(Q.length===1)for(let[$,J]of Object.entries(Q[0]))Y.attribute($,J);else Y.attribute(Q[0],Q[1]);return $0}),jD=e((Q)=>{let X=Q.currentSpanLocal;return X?j(X):E0(new s8)}),TD=gT(i7),J4=R0("effect/Clock",{defaultValue:()=>new ID}),y$=2147483647;class ID{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=K0(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return eT()}currentTimeNanos=K0(()=>this.currentTimeNanosUnsafe());sleep(Q){return this.sleepMillis(W6(Q))}sleepMillis(Q){if(Q<=0)return G5;else if(!Number.isFinite(Q))return KY;return h1((X)=>{let Y=Q>y$?this.sleepMillis(Q-y$):$0,$=setTimeout(()=>X(Y),Math.min(Q,y$));return K0(()=>clearTimeout($))})}}var tT=function(){let Q=BigInt(1e6);if(typeof performance>"u"||typeof performance.now>"u")return()=>BigInt(Date.now())*Q;let X;return()=>{return X??=BigInt(Date.now())*Q-BigInt(Math.round(performance.now()*1e6)),X+BigInt(Math.round(performance.now()*1e6))}}(),eT=function(){let Q=typeof process==="object"&&"hrtime"in process&&typeof process.hrtime.bigint==="function"?process.hrtime:void 0;if(!Q)return tT;let X=BigInt(Date.now())*BigInt(1e6)-Q.bigint();return()=>X+Q.bigint()}(),H9=(Q)=>e((X)=>Q(X.getRef(J4))),K9=(Q)=>H9((X)=>X.sleep(s1(Q))),ED=H9((Q)=>Q.currentTimeMillis);var wQ="~effect/Cause/TimeoutError",SD=(Q)=>C(Q,wQ);class wY extends M4("TimeoutError"){[wQ]=wQ;constructor(Q){super({message:Q})}}var PQ="~effect/Cause/IllegalArgumentError",vD=(Q)=>C(Q,PQ);class pJ extends M4("IllegalArgumentError"){[PQ]=PQ;constructor(Q){super({message:Q})}}var AQ="~effect/Cause/ExceededCapacityError",xD=(Q)=>C(Q,AQ);class fJ extends M4("ExceededCapacityError"){[AQ]=AQ;constructor(Q){super({message:Q})}}var CQ="~effect/Cause/AsyncFiberError",bD=(Q)=>C(Q,CQ);class PY extends M4("AsyncFiberError"){[CQ]=CQ;constructor(Q){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:Q})}}var jQ="~effect/Cause/UnknownError",kD=(Q)=>C(Q,jQ);class dQ extends M4("UnknownError"){[jQ]=jQ;constructor(Q,X){super({message:X,cause:Q})}}var QI=R0("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),XI=(Q)=>{switch(Q){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 50000;case"Error":return 40000;case"Warn":return 30000;case"Info":return 20000;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},YI=F$(D1,XI),yD=Y6(YI),cJ=R0("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([KI,VI])}),$I=R0("effect/Logger/LogToStderr",{defaultValue:O7}),gD=function(){let Q=typeof arguments[0]==="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return I4(e((X)=>{let Y=X.getRef(A4),$={...Y};for(let J=0;J<Q.length;J++){let[Z,G]=Q[J];b($,Z,G)}return X.setContext(a1(X.context,A4,$)),T4(t8(X.context,V5),(J)=>{let Z=X.getRef(A4),G={...Z};for(let W=0;W<Q.length;W++){let[H,K]=Q[W];if(Z[H]!==K)continue;if(Object.hasOwn(Y,H))b(G,H,Y[H]);else delete G[H]}return X.setContext(a1(X.context,A4,G)),$0})}))},JI="~effect/Logger",ZI={[JI]:{_Message:u,_Output:u},pipe(){return H0(this,arguments)}},hD=(Q)=>{let X=Object.create(ZI);return X.log=Q,X},GI=(Q)=>Q.replace(/[\s="]/g,"_"),WI=(Q,X)=>{return`${GI(Q[0])}=${X-Q[1]}ms`};var E8=(Q)=>(...X)=>{let Y=void 0;for(let $=0,J=X.length;$<J;$++){let Z=X[$];if(c9(Z)){if(Y)X.splice($,1);else X=X.slice(0,$).concat(X.slice($+1));Y=Y?N4(Y.reasons.concat(Z.reasons)):Z,$--}}if(Y===void 0)Y=T7;return e(($)=>{let J=Q??$.currentLogLevel;if(yD($.minimumLogLevel,J))return $0;let Z=$.getRef(J4),G=$.getRef(cJ);if(G.size>0){let W=new Date(Z.currentTimeMillisUnsafe());for(let H of G)H.log({cause:Y,fiber:$,date:W,logLevel:J,message:X})}return $0})};var $9={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},R00={None:[],All:[],Trace:[$9.gray],Debug:[$9.blue],Info:[$9.green],Warn:[$9.yellow],Error:[$9.red],Fatal:[$9.bgBrightRed,$9.black]};var HI=(Q)=>`${Q.getHours().toString().padStart(2,"0")}:${Q.getMinutes().toString().padStart(2,"0")}:${Q.getSeconds().toString().padStart(2,"0")}.${Q.getMilliseconds().toString().padStart(3,"0")}`;var KI=hD(({cause:Q,date:X,fiber:Y,logLevel:$,message:J})=>{let Z=Array.isArray(J)?J.slice():[J];if(Q.reasons.length>0)Z.push(ZY(Q));let G=X.getTime(),W=Y.getRef(t7),H="";for(let q of W)H+=` ${WI(q,G)}`;let K=Y.getRef(A4);if(Object.keys(K).length>0)Z.push(K);let V=Y.getRef(QI);(Y.getRef($I)?V.error:V.log)(`[${HI(X)}] ${$.toUpperCase()} (#${Y.id})${H}:`,...Z)}),VI=hD(({cause:Q,fiber:X,logLevel:Y,message:$})=>{let J=X.getRef(J4),Z=X.getRef(A4),G=X.currentSpan;if(G===void 0||G._tag==="ExternalSpan")return;let W={};for(let[H,K]of Object.entries(Z))b(W,H,K);if(W["effect.fiberId"]=X.id,W["effect.logLevel"]=Y.toUpperCase(),Q.reasons.length>0)W["effect.cause"]=ZY(Q);G.event(cK(Array.isArray($)&&$.length===1?$[0]:$),J.currentTimeNanosUnsafe(),W)});function _I(){m$.interruptChildren??=ET}var uJ=j(void 0);var mD=U((Q)=>r(Q[0]),(Q,X)=>TJ(Q,(Y)=>e(($)=>{return qI($,Y,X?.defectsOnly),$0}))),qI=(Q,X,Y)=>{let $=Q.getRef(sV);if($.size===0)return;if(Y&&!XY(X))return;let J={cause:X,fiber:Q,timestamp:Q.getRef(J4).currentTimeNanosUnsafe()};$.forEach((Z)=>Z.report(J))};var DI=p9,UI=f9,lJ=c9,oJ=rK,pQ=t4,BI=n6,zI=a6,fQ=N4,rJ=T7,OI=V$,FI=_$,RI=J5,cQ=(Q)=>new u9(Q),uQ=(Q)=>new I7(Q),lQ=Z_,AY=V_,Z4=D_,NI=r$,CY=JY,LI=l$,MI=o$,jY=z8,wI=G_,PI=XY,AI=W_,CI=TQ,jI=YY,TI=H_,II=K_,EI=$Y,SI=i$,iJ=ZY,vI=v7,xI=HQ,bI=s8,TY=_Q,kI=r6,yI=D$,IY=aK,gI=wQ,hI=SD,mI=wY,dI=PQ,pI=vD,oQ=pJ,fI=xD,cI=AQ,uI=fJ,lI=CQ,oI=bD,rI=PY,iI=jQ,nI=kD,aI=dQ,sI=l9,tI=__,eI=q_;class dD extends q8()("effect/Cause/StackTrace"){}class pD extends q8()("effect/Cause/InterruptorStackTrace"){}var w0={};p6(w0,{zipWith:()=>Kv,zip:()=>Hv,yieldNowWith:()=>aS,yieldNow:()=>nS,withTracerTiming:()=>tx,withTracerEnabled:()=>sx,withTracer:()=>ax,withSpanScoped:()=>Vb,withSpan:()=>Kb,withParentSpan:()=>_b,withLogger:()=>mb,withLogSpan:()=>fb,withFiber:()=>sU,withExecutionPlan:()=>bv,withErrorReporting:()=>kv,whileLoop:()=>rU,when:()=>Xx,void:()=>D6,validate:()=>kS,useSpan:()=>Hb,updateServiceScoped:()=>Rx,updateService:()=>Fx,updateContext:()=>Ox,unwrapReason:()=>Bv,uninterruptibleMask:()=>$B,uninterruptible:()=>dx,undefined:()=>dS,txRetry:()=>tb,tx:()=>ib,tryPromise:()=>jZ,try:()=>O5,transposeOption:()=>tS,trackSuccesses:()=>ub,trackErrors:()=>lb,trackDuration:()=>rb,trackDefects:()=>ob,track:()=>cb,tracer:()=>nx,timeoutOrElse:()=>dv,timeoutOption:()=>mv,timeout:()=>hv,timed:()=>cv,tapErrorTag:()=>Av,tapError:()=>eU,tapDefect:()=>QB,tapCauseIf:()=>Cv,tapCauseFilter:()=>jv,tapCause:()=>hY,tap:()=>tU,sync:()=>nU,suspend:()=>iU,succeedSome:()=>$X,succeedNone:()=>v8,succeed:()=>f,spanLinks:()=>Jb,spanAnnotations:()=>$b,sleep:()=>fv,setContext:()=>Ux,serviceOption:()=>zx,service:()=>Bx,scopedWith:()=>wx,scoped:()=>Mx,scope:()=>Lx,scheduleFrom:()=>JB,schedule:()=>ix,satisfiesSuccessType:()=>Qk,satisfiesServicesType:()=>Yk,satisfiesErrorType:()=>Xk,sandbox:()=>Sv,runSyncWith:()=>Tb,runSyncExitWith:()=>Ib,runSyncExit:()=>U6,runSync:()=>jb,runPromiseWith:()=>Ab,runPromiseExitWith:()=>Cb,runPromiseExit:()=>mY,runPromise:()=>Pb,runForkWith:()=>Lb,runFork:()=>F5,runCallbackWith:()=>Mb,runCallback:()=>wb,retryOrElse:()=>Ev,retry:()=>Iv,result:()=>Yv,requestUnsafe:()=>Db,request:()=>qb,replicateEffect:()=>rx,replicate:()=>ox,repeatOrElse:()=>lx,repeat:()=>ux,reduce:()=>bS,raceFirst:()=>rv,raceAllFirst:()=>lv,raceAll:()=>uv,race:()=>ov,provideServiceEffect:()=>Nx,provideService:()=>XB,provideContext:()=>Dx,provide:()=>qx,promise:()=>mS,partition:()=>xS,orElseSucceed:()=>yv,orDie:()=>Pv,option:()=>$v,onInterrupt:()=>mx,onExitPrimitive:()=>vx,onExitIf:()=>xx,onExitFilter:()=>bx,onExit:()=>vZ,onErrorIf:()=>Ex,onErrorFilter:()=>Sx,onError:()=>Ix,never:()=>pS,matchEffect:()=>Wx,matchEager:()=>Yx,matchCauseEffectEager:()=>Zx,matchCauseEffect:()=>Gx,matchCauseEager:()=>Jx,matchCause:()=>$x,match:()=>SZ,mapErrorEager:()=>R5,mapError:()=>Mv,mapEager:()=>B9,mapBothEager:()=>K1,mapBoth:()=>wv,map:()=>EZ,makeSpanScoped:()=>Wb,makeSpan:()=>Gb,logWithLevel:()=>vb,logWarning:()=>kb,logTrace:()=>hb,logInfo:()=>yb,logFatal:()=>bb,logError:()=>xZ,logDebug:()=>gb,log:()=>xb,linkSpans:()=>Zb,let:()=>uS,isSuccess:()=>Kx,isFailure:()=>Hx,isEffect:()=>x4,interruptibleMask:()=>px,interruptible:()=>hx,interrupt:()=>YB,ignoreCause:()=>xv,ignore:()=>vv,gen:()=>oS,fromResult:()=>IZ,fromOption:()=>sS,fromNullishOr:()=>eS,forkScoped:()=>zb,forkIn:()=>Bb,forkDetach:()=>Ob,forkChild:()=>Ub,forever:()=>cx,forEach:()=>hS,fnUntracedEager:()=>GX,fnUntraced:()=>Eb,fn:()=>Sb,flip:()=>Wv,flatten:()=>Qv,flatMapEager:()=>F8,flatMap:()=>JX,firstSuccessOf:()=>gv,findFirstFilter:()=>gS,findFirst:()=>yS,filterOrFail:()=>ev,filterOrElse:()=>sv,filterMapOrFail:()=>Qx,filterMapOrElse:()=>tv,filterMapEffect:()=>av,filterMap:()=>nv,filter:()=>iv,fiberId:()=>Nb,fiber:()=>Rb,failSync:()=>rS,failCauseSync:()=>D9,failCause:()=>iS,fail:()=>p,exit:()=>ZX,eventually:()=>Tv,ensuring:()=>Tx,effectify:()=>eb,die:()=>aU,delay:()=>pv,currentSpan:()=>Xb,currentParentSpan:()=>Yb,contextWith:()=>_x,context:()=>Vx,clockWith:()=>ZB,catchTags:()=>qv,catchTag:()=>_v,catchReasons:()=>Uv,catchReason:()=>Dv,catchNoSuchElement:()=>Rv,catchIf:()=>Ov,catchFilter:()=>Fv,catchEager:()=>dY,catchDefect:()=>zv,catchCauseIf:()=>Nv,catchCauseFilter:()=>Lv,catchCause:()=>U9,catch:()=>Vv,callback:()=>TZ,cachedWithTTL:()=>yx,cachedInvalidateWithTTL:()=>gx,cached:()=>kx,bindTo:()=>cS,bind:()=>lS,awaitAllChildren:()=>Fb,asVoid:()=>Gv,asSome:()=>Zv,as:()=>Jv,annotateSpans:()=>ex,annotateLogsScoped:()=>pb,annotateLogs:()=>db,annotateCurrentSpan:()=>Qb,andThen:()=>Xv,all:()=>vS,addFinalizer:()=>jx,acquireUseRelease:()=>Cx,acquireRelease:()=>Px,acquireDisposable:()=>Ax,abortSignal:()=>fx,TypeId:()=>SS,Transaction:()=>YX,Do:()=>fS});var S8={};p6(S8,{void:()=>aJ,succeed:()=>V9,match:()=>_E,mapError:()=>DE,mapBoth:()=>UE,map:()=>qE,isSuccess:()=>Y1,isFailure:()=>sJ,isExit:()=>nJ,interrupt:()=>XE,hasInterrupts:()=>JE,hasFails:()=>YE,hasDies:()=>$E,getSuccess:()=>OE,getCause:()=>FE,findErrorOption:()=>RE,findError:()=>KE,findDefect:()=>VE,filterValue:()=>GE,filterSuccess:()=>ZE,filterFailure:()=>WE,filterCause:()=>HE,failCause:()=>v4,fail:()=>q5,die:()=>QE,asVoidAll:()=>zE,asVoid:()=>BE});var nJ=K$,V9=t0,v4=g1,q5=a8,QE=j8,XE=d_,aJ=e1;var Y1=W5,sJ=ZJ,YE=r_,$E=o_,JE=l_,ZE=p_,GE=f_,WE=c_,HE=SQ,KE=GJ,VE=u_,_E=i_,qE=WJ,DE=HJ,UE=KJ,BE=n_,zE=VJ,OE=a_,FE=s_,RE=t_;var NE="~effect/Deferred";var LE={[NE]:{_A:u,_E:u},pipe(){return H0(this,arguments)}},fD=()=>{let Q=Object.create(LE);return Q.resumes=void 0,Q.effect=void 0,Q};var cD=(Q)=>h1((X)=>{if(Q.effect)return X(Q.effect);return Q.resumes??=[],Q.resumes.push(X),K0(()=>{let Y=Q.resumes.indexOf(X);Q.resumes.splice(Y,1)})});var ME=U(2,(Q,X)=>K0(()=>wE(Q,X))),uD=ME;var wE=(Q,X)=>{if(Q.effect)return!1;if(Q.effect=X,Q.resumes){for(let Y=0;Y<Q.resumes.length;Y++)Q.resumes[Y](X);Q.resumes=void 0}return!0};var lD=A4;var oD=t7;var rD=kQ;var EY=Iq,tJ=wJ;var nD="~effect/Layer",iD="~effect/Layer/MemoMap",CE=(Q,X)=>{return Q.observers++,V6(T4(X,(Y)=>Q.finalizer(Y)),Q.effect)},aD=(Q)=>C(Q,nD),jE={[nD]:{_ROut:u,_E:u,_RIn:u},pipe(){return H0(this,arguments)}},sD=(Q)=>{let X=Object.create(jE);return X.build=Q,X},tD=(Q)=>sD((X,Y)=>{let $=EY(Y);return v1(Q(X,$),(J)=>J._tag==="Failure"?tJ($,J):$0)});var TE=(Q,X,Y,$)=>{let J=rD(),Z=fD(),G={observers:1,effect:cD(Z),finalizer:(W)=>Q0(()=>{if(G.observers--,G.observers===0)return Q.map.delete(X),tJ(J,W);return $0})};return Q.map.set(X,G),T4(Y,G.finalizer).pipe(S(()=>$(Q,J)),v1((W)=>{return G.effect=W,uD(Z,W)}))};class eJ{get[iD](){return iD}parent;constructor(Q){this.parent=Q}map=new Map;get(Q,X){let Y=this.map.get(Q);if(Y)return CE(Y,X);return this.parent?.get(Q,X)}getOrElseMemoize(Q,X,Y){let $=this.get(Q,X);if($)return $;return TE(this,Q,X,Y)}}var QZ=()=>new eJ,IE=(Q)=>new eJ(Q);class rQ extends q8()("effect/Layer/CurrentMemoMap"){static forkOrCreate(Q){let X=FV(Q,rQ);return X?IE(X):QZ()}}var XZ=U(3,(Q,X,Y)=>m1(M0(Q.build(X,Y),a1(rQ,X)),rQ,X));var eD=U(2,(Q,X)=>e((Y)=>XZ(Q,rQ.forkOrCreate(Y.context),X)));var QU=(Q)=>sD(V1(j(Q)));var XU=(Q,X,Y)=>{let $=EY(Y,"parallel");return t1(Q,(J)=>J.build(X,EY($,"sequential")),{concurrency:Q.length}).pipe(M0((J)=>LV(...J)))},YU=(...Q)=>tD((X,Y)=>XU(Q,X,Y));var EE=(Q,X,Y)=>tD(($,J)=>S(Array.isArray(X)?XU(X,$,J):X.build($,J),(Z)=>Q.build($,J).pipe(j4(Z),M0((G)=>Y(G,Z))))),$U=U(2,(Q,X)=>EE(Q,X,u));var ZU="~effect/ExecutionPlan";var SE={[ZU]:ZU,get captureRequirements(){let Q=this;return _6((X)=>j(vE(Q.steps.map((Y)=>({...Y,provide:aD(Y.provide)?$U(Y.provide,QU(X)):Y.provide})))))},pipe(){return H0(this,arguments)}},vE=(Q)=>{let X=Object.create(SE);return X.steps=Q,X};var GU=R0("effect/ExecutionPlan/CurrentMetadata",{defaultValue:V1({attempt:0,stepIndex:0})});var WU=class extends f6{constructor(Q){super();if(Q)j7(this,Q)}};var SY=M4;var vY="~effect/time/DateTime",xY="~effect/time/DateTime/TimeZone",KU={[vY]:vY,pipe(){return H0(this,arguments)},[W1](){return this.toString()},toJSON(){return sQ(this).toJSON()}},hE={...KU,_tag:"Utc",[D0](){return z4(this.epochMilliseconds)},[U0](Q){return U5(Q)&&Q._tag==="Utc"&&this.epochMilliseconds===Q.epochMilliseconds},toString(){return`DateTime.Utc(${sQ(this).toJSON()})`}},mE={...KU,_tag:"Zoned",[D0](){return X1(z4(this.epochMilliseconds))(X0(this.zone))},[U0](Q){return U5(Q)&&Q._tag==="Zoned"&&this.epochMilliseconds===Q.epochMilliseconds&&o(this.zone,Q.zone)},toString(){return`DateTime.Zoned(${zZ(this)})`}},VU={[xY]:xY,[W1](){return this.toString()}},dE={...VU,_tag:"Named",[D0](){return b0(`Named:${this.id}`)},[U0](Q){return _9(Q)&&Q._tag==="Named"&&this.id===Q.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},pE={...VU,_tag:"Offset",[D0](){return b0(`Offset:${this.offset}`)},[U0](Q){return _9(Q)&&Q._tag==="Offset"&&this.offset===Q.offset},toString(){return`TimeZone.Offset(${DZ(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},G4=(Q,X,Y)=>{let $=Object.create(mE);return $.epochMilliseconds=Q,$.zone=X,Object.defineProperty($,"partsUtc",{value:Y,enumerable:!1,writable:!0}),Object.defineProperty($,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty($,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),$},U5=(Q)=>C(Q,vY);var _9=(Q)=>C(Q,xY),_U=(Q)=>_9(Q)&&Q._tag==="Offset",qU=(Q)=>_9(Q)&&Q._tag==="Named",DU=(Q)=>Q._tag==="Utc",ZZ=(Q)=>Q._tag==="Zoned",UU=H1((Q,X)=>Q.epochMilliseconds===X.epochMilliseconds),BU=s6((Q,X)=>Q.epochMilliseconds<X.epochMilliseconds?-1:Q.epochMilliseconds>X.epochMilliseconds?1:0);var GZ=(Q)=>{let X=Object.create(hE);return X.epochMilliseconds=Q,Object.defineProperty(X,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),X},D5=(Q)=>{let X=Q.getTime();if(Number.isNaN(X))throw new oQ("Invalid date");return GZ(X)},WZ=(Q)=>{if(U5(Q))return Q;else if(Q instanceof Date)return D5(Q);else if(typeof Q==="object"){if("epochMilliseconds"in Q)return GZ(Q.epochMilliseconds);let X=new Date(0);return nE(X,Q),D5(X)}else if(typeof Q==="string"&&!fE(Q))return D5(new Date(Q+"Z"));return D5(new Date(Q))},fE=(Q)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(Q),cE=-8639999956800000,uE=8639999949600000,HZ=(Q,X)=>{let Y=X?.timeZone;if(Y===void 0&&U5(Q)&&ZZ(Q))return Q;let $=WZ(Q);if($.epochMilliseconds<cE||$.epochMilliseconds>uE)throw RangeError(`Epoch millis out of range: ${$.epochMilliseconds}`);if(Y===void 0&&typeof Q==="object"&&"timeZoneId"in Q)Y=Q.timeZoneId;let J;if(Y===void 0){let Z=new Date($.epochMilliseconds).getTimezoneOffset()*-60*1000;J=aQ(Z)}else if(_9(Y))J=Y;else if(typeof Y==="number")J=aQ(Y);else{let Z=_Z(Y);if(I0(Z))throw new oQ(`Invalid time zone: ${Y}`);J=Z.value}if(X?.adjustForTimeZone!==!0)return G4($.epochMilliseconds,J,$.partsUtc);return aE($.epochMilliseconds,J,X?.disambiguation??"compatible")},$Z=Q9(HZ),zU=Q9(WZ),lE=/^(.{17,35})\[(.+)\]$/,OU=(Q)=>{let X=lE.exec(Q);if(X===null){let J=BZ(Q);return J!==null?$Z(Q,{timeZone:J}):d()}let[,Y,$]=X;return $Z(Y,{timeZone:$})};var FU=(Q)=>GZ(Q.epochMilliseconds);var nQ=new Map,oE={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},rE=(Q)=>{let X=Q.resolvedOptions().timeZone;if(nQ.has(X))return nQ.get(X);let Y=Object.create(dE);return Y.id=X,Y.format=Q,nQ.set(X,Y),Y},KZ=(Q)=>{if(nQ.has(Q))return nQ.get(Q);try{return rE(new Intl.DateTimeFormat("en-US",{...oE,timeZone:Q}))}catch{throw new oQ(`Invalid time zone: ${Q}`)}},aQ=(Q)=>{let X=Object.create(pE);return X.offset=Q,X},VZ=Q9(KZ);var iE=/^(?:GMT|[+-])/,_Z=(Q)=>{if(iE.test(Q)){let X=BZ(Q);return X===null?d():R(aQ(X))}return VZ(Q)},RU=(Q)=>{if(Q._tag==="Offset")return DZ(Q.offset);return Q.id};var sQ=(Q)=>new Date(Q.epochMilliseconds),bY=(Q)=>{if(Q._tag==="Utc")return new Date(Q.epochMilliseconds);else if(Q.zone._tag==="Offset")return new Date(Q.epochMilliseconds+Q.zone.offset);else if(Q.adjustedEpochMilliseconds!==void 0)return new Date(Q.adjustedEpochMilliseconds);let X=Q.zone.format.formatToParts(Q.epochMilliseconds).filter(($)=>$.type!=="literal"),Y=new Date(0);return Y.setUTCFullYear(Number(X[2].value),Number(X[0].value)-1,Number(X[1].value)),Y.setUTCHours(Number(X[3].value),Number(X[4].value),Number(X[5].value),Number(X[6].value)),Q.adjustedEpochMilliseconds=Y.getTime(),Y},qZ=(Q)=>{return bY(Q).getTime()-UZ(Q)},DZ=(Q)=>{let X=Math.abs(Q),Y=Math.floor(X/3600000),$=Math.round(X%3600000/60000);if($===60)Y+=1,$=0;return`${Q<0?"-":"+"}${String(Y).padStart(2,"0")}:${String($).padStart(2,"0")}`},NU=(Q)=>DZ(qZ(Q)),UZ=(Q)=>Q.epochMilliseconds;var nE=(Q,X)=>{if(X.year!==void 0)Q.setUTCFullYear(X.year);if(X.month!==void 0)Q.setUTCMonth(X.month-1);if(X.day!==void 0)Q.setUTCDate(X.day);if(X.weekDay!==void 0){let Y=X.weekDay-Q.getUTCDay();Q.setUTCDate(Q.getUTCDate()+Y)}if(X.hour!==void 0)Q.setUTCHours(X.hour);if(X.minute!==void 0)Q.setUTCMinutes(X.minute);if(X.second!==void 0)Q.setUTCSeconds(X.second);if(X.millisecond!==void 0)Q.setUTCMilliseconds(X.millisecond)};var HU=86400000,aE=(Q,X,Y)=>{if(X._tag==="Offset")return G4(Q-X.offset,X);let $=iQ(Q-HU,Q,X),J=iQ(Q+HU,Q,X);if($===J)return G4(Q-$,X);let Z=$<J,G=$-J;if(Z){if(iQ(Q-J,Q,X)===J)return G4(Q-J,X);let K=G4(Q-$,X),V=bY(K).getTime();if(Q!==V)switch(Y){case"reject":{let _=new Date(Q).toISOString();throw RangeError(`Gap time: ${_} does not exist in time zone ${X.id}`)}case"earlier":return G4(Q-J,X);case"compatible":case"later":return K}return K}if(iQ(Q-$,Q,X)===$){if(Y==="earlier"||Y==="compatible")return G4(Q-$,X);if(iQ(Q-$+G,Q+G,X)===$)return G4(Q-$,X);if(Y==="reject"){let K=new Date(Q).toISOString();throw RangeError(`Ambiguous time: ${K} occurs twice in time zone ${X.id}`)}}return G4(Q-J,X)},sE=/([+-])(\d{2}):(\d{2})$/,BZ=(Q)=>{let X=sE.exec(Q);if(X===null)return null;let[,Y,$,J]=X;return(Y==="+"?1:-1)*(Number($)*60+Number(J))*60*1000},iQ=(Q,X,Y)=>{let $=Y.format.formatToParts(Q).find((Z)=>Z.type==="timeZoneName")?.value??"";if($==="GMT")return 0;let J=BZ($);if(J===null)return qZ(G4(X,Y));return J};var LU=(Q)=>sQ(Q).toISOString();var JZ=(Q)=>{let X=bY(Q);return Q._tag==="Utc"?X.toISOString():`${X.toISOString().slice(0,-1)}${NU(Q)}`},zZ=(Q)=>Q.zone._tag==="Offset"?JZ(Q):`${JZ(Q)}[${Q.zone.id}]`;var d00=globalThis.Number;var wU=U(2,(Q,X)=>{let Y=Q.toString(),$=X.toString();if(Y.includes("e")||$.includes("e")){if(!globalThis.Number.isFinite(Q)||!globalThis.Number.isFinite(X)||X===0)return NaN;return eE(Q,X)}let J=(Y.split(".")[1]||"").length,Z=($.split(".")[1]||"").length,G=J>Z?J:Z,W=parseInt(Q.toFixed(G).replace(".","")),H=parseInt(X.toFixed(G).replace(".",""));return W%H/Math.pow(10,G)});function eE(Q,X){let[Y,$]=MU(Q),[J,Z]=MU(X),G=Math.min($,Z),W=Y*BigInt(10)**BigInt($-G),H=J*BigInt(10)**BigInt(Z-G),K=W%H;if(K===BigInt(0))return Q<0||Object.is(Q,-0)?-0:0;let V=globalThis.Number(`${K}e${G}`);return V===0?Math.sign(Q)*globalThis.Number.MIN_VALUE:V}function MU(Q){let X=Math.abs(Q).toExponential(),Y=X.indexOf("e"),$=X.slice(0,Y).replace(".","");return[BigInt($)*(Q<0?-BigInt(1):BigInt(1)),globalThis.Number(X.slice(Y+1))-$.length+1]}var PU=w4((Q,X)=>Math.max(Q,X),-1/0),AU=w4((Q,X)=>Math.min(Q,X),1/0);var p00=globalThis.String;var CU=(Q)=>Q.trim();var OZ=U(2,(Q,X)=>K5(Q,$S,(Y)=>X(Y)));var YS=Q5(jY,(Q)=>TY(Q)?t(Q):i(Q));var $S=Q5(jY,(Q)=>TY(Q)?t(Q.value):i(Q));var jU=U(2,(Q,X)=>$4(Q,{onSuccess:X.onSuccess,onFailure:(Y)=>{let $=YS(Y);return!_0($)?X.onDone($.success.value):X.onFailure($.failure)}}));var IU="~effect/Schedule";var q9=R0("effect/Schedule/CurrentMetadata",{defaultValue:V1({input:void 0,output:void 0,duration:t9,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),JS={[IU]:{_Out:u,_In:u,_Env:u},pipe(){return H0(this,arguments)}},FZ=(Q)=>C(Q,IU),RZ=(Q)=>{let X=Object.create(JS);return X.step=Q,X},NZ=()=>{let Q=0,X,Y;return($,J)=>{if(Y===void 0)Y=$;let Z=$-Y,G=X===void 0?0:$-X;return X=$,{input:J,attempt:++Q,start:Y,now:$,elapsed:Z,elapsedSincePrevious:G}}},ZS=(Q)=>RZ(M0(Q,(X)=>{let Y=NZ();return($,J)=>X(Y($,J))})),LZ=(Q)=>O8(Q.step,(X)=>j(()=>P0(X))),kY=(Q)=>H9((X)=>M0(LZ(Q),(Y)=>{let $=NZ();return(J)=>Q0(()=>{let Z=X.currentTimeMillisUnsafe();return S(Y(Z,J),([G,W])=>{let H=$(Z,J);return H.output=G,H.duration=W,Q8(K9(W),H)})})}));var MZ=(Q)=>RZ(M0(LZ(Q),(X)=>(Y,$)=>jU(X(Y,$),{onSuccess:(J)=>j([$,J[1]]),onFailure:P0,onDone:()=>IY($)}))),EU=(Q)=>tQ(wZ,({attempt:X})=>j(X<=Q)),GS=(Q)=>{let X=s1(Q);return ZS(j((Y)=>j([Y.attempt-1,X])))};var tQ=U(2,(Q,X)=>RZ(M0(LZ(Q),(Y)=>{let $=NZ();return(J,Z)=>S(Y(J,Z),(G)=>{let[W,H]=G,K=X({...$(J,Z),output:W,duration:H});return S(r(K)?K:j(K),(V)=>V?j(G):IY(W))})})));var wZ=GS(t9);var WS=(Q,X,Y)=>FY(($)=>S(Y?.local?XZ(X,QZ(),$):eD(X,$),(J)=>j4(Q,J))),yY=U((Q)=>r(Q[0]),(Q,X,Y)=>L$(X)?j4(Q,X):WS(Q,Array.isArray(X)?YU(...X):X,Y));var PZ=U(3,(Q,X,Y)=>S(kY(X),($)=>{let J=q9.defaultValue();return X8(DY(Z9(S(Q0(()=>m1(Q,q9,J)),$),(Z)=>K0(()=>{J=Z})),{disableYield:!0}),(Z)=>_Q(Z)?j(Z.value):Y(Z,J.attempt===0?d():R(J)))})),AZ=U(3,(Q,X,Y)=>S(kY(X),($)=>{let J=q9.defaultValue(),Z,G=X8(Q0(()=>m1(Q,q9,J)),(W)=>{return Z=W,S($(W),(H)=>{return J=H,G})});return OZ(G,(W)=>V0(()=>Y(Z,W)))})),xU=U(2,(Q,X)=>{let Y=typeof X==="function"?X(u):FZ(X)?X:QX(X);return PZ(Q,Y,E0)}),eQ=U(2,(Q,X)=>{let Y=typeof X==="function"?X(u):FZ(X)?X:QX(X);return AZ(Q,Y,E0)}),bU=U(3,(Q,X,Y)=>S(kY(Y),($)=>{let J=q9.defaultValue(),Z=Q0(()=>m1(Q,q9,J));return X8(S($(X),(G)=>{J=G;let W=V1(S(Z,$));return E4({while:n4,body:W,step(H){J=H}})}),(G)=>_Q(G)?j(G.value):E0(G))})),HS=MZ(wZ),QX=(Q)=>{let X=Q.schedule?MZ(Q.schedule):HS;if(Q.while)X=tQ(X,({input:Y})=>{let $=Q.while(Y);return r($)?$:j($)});if(Q.until)X=tQ(X,({input:Y})=>{let $=Q.until(Y);return r($)?M0($,(J)=>!J):j(!$)});if(Q.times!==void 0)X=tQ(X,({attempt:Y})=>j(Y<=Q.times));return X};var gU=U(2,(Q,X)=>Q0(()=>{let Y=0,$={attempt:0,stepIndex:0},J=qY(GU,K0(()=>{return $={attempt:$.attempt+1,stepIndex:Y},$})),Z;return S(E4({while:()=>Y<X.steps.length&&(Z===void 0||_0(Z)),body(){let G=X.steps[Y],W=J(yY(Q,G.provide));if(Z){let H=!1,K=W;W=Q0(()=>{if(H)return K;return H=!0,Z5(Z)}),W=eQ(W,yU(G,!1))}else{let H=yU(G,!0);W=H?eQ(W,H):W}return H6(W)},step(G){Z=G,Y++}}),()=>Z5(Z))})),yU=(Q,X)=>{if(!X)return QX({schedule:Q.schedule?Q.schedule:Q.attempts?void 0:KS,times:Q.attempts,while:Q.while});else if(Q.attempts===1||!(Q.schedule||Q.attempts))return;return QX({schedule:Q.schedule,while:Q.while,times:Q.attempts?Q.attempts-1:void 0})},KS=EU(1);var _S="~effect/Request",qS=pK({_E:(Q)=>Q,_A:(Q)=>Q,_R:(Q)=>Q}),$10={...oK,[_S]:qS};var hU=(Q)=>Q;var dU=U(2,(Q,X)=>{let Y=($)=>h1((J)=>{let Z=fU($,Q,J,GY());return DS($,Z)});return r(X)?S(X,Y):Y(X)}),pU=(Q,X)=>{let Y=fU(X.resolver,Q,X.onExit,{context:X.context,currentScheduler:n1(X.context,zQ)});return()=>cU(X.resolver,Y)},gY=[],CZ=new WeakMap,fU=(Q,X,Y,$)=>{let J=CZ.get(Q);if(!J)J=new Map,CZ.set(Q,J);let Z,G=!1,W=hU({request:X,context:$.context,uninterruptible:!1,completeUnsafe(K){if(G)return;G=!0,Y(K),Z?.entrySet.delete(W)}});if(Q.preCheck!==void 0&&!Q.preCheck(W))return W;let H=Q.batchKey(W);if(Z=J.get(H),!Z){if(gY.length>0)Z=gY.pop(),Z.key=H,Z.resolver=Q,Z.map=J;else{let K={key:H,resolver:Q,map:J,entrySet:new Set,entries:new Set,delayEffect:S(Q0(()=>K.resolver.delay),(V)=>mU(K)),run:v1(Q0(()=>K.resolver.runAll(Array.from(K.entries),K.key)),(V)=>{for(let _ of K.entrySet)_.completeUnsafe(V._tag==="Success"?j8(Error("Effect.request: RequestResolver did not complete request",{cause:_.request})):V);if(K.entries.clear(),gY.length<128)K.entrySet.clear(),K.key=void 0,K.fiber=void 0,K.resolver=void 0,K.map=void 0,gY.push(K);return $0})};Z=K}J.set(H,Z),Z.fiber=S4($.context)(Z.delayEffect,{scheduler:$.currentScheduler})}if(Z.entrySet.add(W),Z.entries.add(W),Z.resolver.collectWhile(Z.entries))return W;return Z.fiber.interruptUnsafe($.id),Z.fiber=S4($.context)(mU(Z),{scheduler:$.currentScheduler}),W},cU=(Q,X)=>{if(X.uninterruptible)return;let Y=CZ.get(Q);if(!Y)return;let $=Q.batchKey(X),J=Y.get($);if(!J)return;if(J.entries.delete(X),J.entrySet.delete(X),J.entries.size===0)Y.delete($),J.fiber?.interruptUnsafe()},DS=(Q,X)=>K0(()=>cU(Q,X));function mU(Q){if(!Q.map.has(Q.key))return $0;return Q.map.delete(Q.key),Q.run}var OS="effect/Metric/CurrentMetricAttributes",FS=R0(OS,{defaultValue:()=>({})}),RS="~effect/observability/Metric/MetricRegistryKey",NS=R0(RS,{defaultValue:()=>new Map}),uU="~effect/observability/Metric";class B5{[uU]=uU;#Q=new WeakMap;#X;id;description;attributes;constructor(Q,X,Y){this.id=Q,this.description=X,this.attributes=Y}valueUnsafe(Q){return this.hook(Q).get(Q)}modifyUnsafe(Q,X){return this.hook(X).modify(Q,X)}updateUnsafe(Q,X){return this.hook(X).update(Q,X)}hook(Q){let X=n1(Q,FS);if(Object.keys(X).length===0){if(_1(this.#X))return this.#X.hooks;return this.#X=this.getOrCreate(Q,this.attributes),this.#X.hooks}let Y=IS(this.attributes,X),$=this.#Q.get(Y);if(_1($))return $.hooks;return $=this.getOrCreate(Q,Y),this.#Q.set(Y,$),$.hooks}getOrCreate(Q,X){let Y=CS(this,X),$=n1(Q,NS);if($.has(Y))return $.get(Y);let J=this.createHooks(),Z={id:this.id,type:this.type,description:this.description,attributes:q6(X),hooks:J};return $.set(Y,Z),Z}pipe(){return H0(this,arguments)}}var lU=BigInt(0);class LS extends B5{type="Counter";#Q;#X;constructor(Q,X){super(Q,X?.description,q6(X?.attributes));this.#Q=X?.bigint??!1,this.#X=X?.incremental??!1}createHooks(){let Q=this.#Q?lU:0,X=this.#X?this.#Q?($)=>$>=lU:($)=>$>=0:($)=>!0;return XX(()=>({count:Q,incremental:this.#X}),($)=>{if(X($))Q=Q+$})}}class MS extends B5{type="Gauge";#Q;constructor(Q,X){super(Q,X?.description,q6(X?.attributes));this.#Q=X?.bigint??!1}createHooks(){let Q=this.#Q?BigInt(0):0;return XX(()=>({value:Q}),($)=>{Q=$},($)=>{Q=Q+$})}}class wS extends B5{type="Frequency";#Q;constructor(Q,X){super(Q,X?.description,q6(X?.attributes));this.#Q=X?.preregisteredWords}createHooks(){let Q=new Map;if(_1(this.#Q))for(let Y of this.#Q)Q.set(Y,0);return XX(()=>({occurrences:Q}),(Y)=>{let $=Q.get(Y)??0;Q.set(Y,$+1)})}}class PS extends B5{type="Histogram";#Q;constructor(Q,X){super(Q,X?.description,q6(X?.attributes));this.#Q=X.boundaries}createHooks(){let Q=this.#Q,X=Q.length,Y=new Uint32Array(X+1),$=new Float64Array(X),J=0,Z=0,G=Number.MAX_VALUE,W=-Number.MAX_VALUE;Q4(BQ(Q,D1),(V,_)=>{$[_]=V});let H=(V)=>{let _=0,q=X;while(_!==q){let D=Math.floor(_+(q-_)/2),B=$[D];if(V<=B)q=D;else _=D;if(q===_+1)if(V<=$[_])q=_;else _=q}if(Y[_]=Y[_]+1,J=J+1,Z=Z+V,V<G)G=V;if(V>W)W=V},K=()=>{let V=P$(X),_=0;for(let q=0;q<X;q++){let D=$[q],B=Y[q];_=_+B,V[q]=[D,_]}return V};return XX(()=>({buckets:K(),count:J,min:G,max:W,sum:Z}),H)}}class AS extends B5{type="Summary";#Q;#X;#Y;constructor(Q,X){super(Q,X?.description,q6(X?.attributes));this.#Q=Math.max(W6(s1(X.maxAge)),0),this.#X=X.maxSize,this.#Y=X.quantiles}createHooks(){let Q=BQ(this.#Y,D1),X=P$(this.#X);for(let _ of this.#Y)if(_<0||_>1)throw Error(`Quantile must be between 0 and 1, found: ${_}`);let Y=0,$=0,J=0,Z=Number.MAX_VALUE,G=-Number.MAX_VALUE,W=(_)=>{let q=[],D=0;while(D<this.#X){let N=X[D];if(_1(N)){let[M,w]=N,A=_-M;if(A>=0&&A<=this.#Q)q.push(w)}D=D+1}let B=BQ(q,D1),F=B.length;if(F===0)return Q.map((N)=>[N,void 0]);return Q.map((N)=>{if(N<=0)return[N,B[0]];if(N>=1)return[N,B[F-1]];let M=Math.ceil(N*F)-1;return[N,B[M]]})},H=(_,q)=>{if(this.#X>0){let D=Y%this.#X;X[D]=[q,_],Y=Y+1}if($=$+1,J=J+_,_<Z)Z=_;if(_>G)G=_};return XX((_)=>{let q=n1(_,J4);return{quantiles:W(q.currentTimeMillisUnsafe()),count:$,min:Z,max:G,sum:J}},([_,q])=>H(_,q))}}var z5=U(2,(Q,X)=>_6((Y)=>K0(()=>Q.updateUnsafe(X,Y))));function CS(Q,X){let Y=`${Q.type}:${Q.id}`;if(_1(Q.description))Y+=`:${Q.description}`;if(_1(X))Y+=`:${jS(X)}`;return Y}function XX(Q,X,Y){return{get:Q,update:X,modify:Y??X}}function jS(Q){return TS(Array.isArray(Q)?Q:Object.entries(Q))}function TS(Q){return Q.map(([X,Y])=>`${X}=${Y}`).join(",")}function IS(Q,X){return{...q6(Q),...q6(X)}}function q6(Q){if(_1(Q)&&Array.isArray(Q))return Q.reduce((X,[Y,$])=>{return b(X,Y,$),X},{});return Q}var SS=n8,x4=r,vS=hQ,xS=xJ,bS=fq,kS=cq,yS=uq,gS=oq,hS=t1,rU=E4,mS=e$,jZ=w_,f=j,v8=IQ,$X=t$,iU=Q0,nU=K0,D6=$0;var dS=uJ;var TZ=h1,pS=KY,fS=eq,cS=QD,uS=YD;var lS=XD,oS=j_,p=E0,rS=HY,iS=P0,D9=L_,aU=K6,O5=M_;var nS=G5,aS=s$,sU=e,IZ=Z5,sS=F_,tS=N_,eS=R_,JX=S,Qv=k_,Xv=V6,tU=Z9,Yv=H6,$v=Lq,ZX=bQ,EZ=M0,Jv=Q8,Zv=VY,Gv=EQ,Wv=E_,Hv=$q,Kv=qJ,Vv=X8;var _v=zJ,qv=Dq,Dv=Uq,Uv=Bq,Bv=zq,U9=O8,zv=Hq,Ov=vQ,Fv=BY,Rv=Wq,Nv=UJ,Lv=K5,Mv=OJ,wv=FJ,Pv=RJ,eU=BJ,Av=_q,hY=Kq,Cv=Vq,jv=UY,QB=qq,Tv=NJ,Iv=eQ,Ev=AZ,Sv=S_,vv=Rq,xv=Nq,bv=gU,kv=mD,yv=Oq,gv=Fq,hv=Cq,mv=jq,dv=MJ,pv=Aq,fv=K9,cv=Tq,uv=$J,lv=JJ,ov=v_,rv=_Y,iv=aq,nv=sq,av=tq,sv=bJ,tv=kJ,ev=Jq,Qx=nq,Xx=Zq,SZ=zY,Yx=xQ,$x=LJ,Jx=Mq,Zx=x_,Gx=$4,Wx=G9,Hx=wq,Kx=Pq,Vx=_J,_x=_6,qx=yY,Dx=j4,Ux=Yq,Bx=e_,zx=Qq,Ox=H5,Fx=C4,Rx=Xq,XB=m1,Nx=qY,Lx=yQ,Mx=PJ,wx=FY,Px=RY,Ax=kq,Cx=bq,jx=AJ,Tx=Sq,Ix=TJ,Ex=vq,Sx=IJ,vx=_5,vZ=v1,xx=CJ,bx=jJ,kx=yq,yx=SJ,gx=EJ,YB=gq,hx=vJ,mx=xq,dx=I4,$B=gQ,px=dq,fx=pq,cx=DY,ux=xU,lx=PZ,ox=DJ,rx=Gq,ix=U(2,(Q,X)=>JB(Q,void 0,X)),JB=bU,nx=UD,ax=BD,sx=zD,tx=OD,ex=AD,Qb=CD,Xb=jD,Yb=TD,$b=LD,Jb=MD,Zb=wD,Gb=RD,Wb=LQ,Hb=MQ,Kb=PD,Vb=ND,_b=$5,qb=dU,Db=pU,Ub=$D,Bb=yJ,zb=GD,Ob=JD,Fb=ZD,Rb=A_,Nb=C_,F5=WD,Lb=S4,Mb=gJ,wb=HD,Pb=VD,Ab=hJ,mY=KD,Cb=LY,jb=qD,Tb=mJ,U6=_D,Ib=MY,Eb=XJ,Sb=T_,ZB=H9,vb=E8,xb=E8(),bb=E8("Fatal"),kb=E8("Warn"),xZ=E8("Error"),yb=E8("Info"),gb=E8("Debug"),hb=E8("Trace"),mb=U(2,(Q,X)=>C4(Q,cJ,(Y)=>new Set([...Y,X]))),db=U((Q)=>x4(Q[0]),(Q,...X)=>C4(Q,lD,(Y)=>{let $=X.length===1?{...Y,...X[0]}:{...Y};if(X.length===1)return $;else b($,X[0],X[1]);return $})),pb=gD,fb=U(2,(Q,X)=>S(ED,(Y)=>C4(Q,oD,($)=>{return[[X,Y],...$]}))),cb=U((Q)=>x4(Q[0]),(Q,X,Y)=>vZ(Q,($)=>{let J=Y===void 0?$:V0(()=>Y($));return z5(X,J)})),ub=U((Q)=>x4(Q[0]),(Q,X,Y)=>tU(Q,($)=>{let J=Y===void 0?$:Y($);return z5(X,J)})),lb=U((Q)=>x4(Q[0]),(Q,X,Y)=>eU(Q,($)=>{let J=Y===void 0?$:V0(()=>Y($));return z5(X,J)})),ob=U((Q)=>x4(Q[0]),(Q,X,Y)=>QB(Q,($)=>{let J=Y===void 0?$:V0(()=>Y($));return z5(X,J)})),rb=U((Q)=>x4(Q[0]),(Q,X,Y)=>ZB(($)=>{let J=$.currentTimeNanosUnsafe();return vZ(Q,()=>{let Z=$.currentTimeNanosUnsafe(),G=gV(s1(Z),s1(J)),W=Y===void 0?G:V0(()=>Y(G));return z5(X,W)})}));class YX extends q8()("effect/Effect/Transaction"){}var ib=(Q)=>sU((X)=>{if(X.context.mapUnsafe.has(YX.key))return Q;let Y={journal:new Map,retry:!1},$;return $B((J)=>JX(rU({while:()=>!$,body:V1(J(Q).pipe(XB(YX,Y),hY(()=>{if(!Y.retry)return D6;return J(ab(Y))}),ZX)),step(Z){if(Y.retry||!nb(Y))return oU(Y);if(Y1(Z))sb(X,Y);else oU(Y);$=Z}}),()=>$))}),nb=(Q)=>{for(let[X,{version:Y}]of Q.journal)if(X.version!==Y)return!1;return!0},ab=(Q)=>iU(()=>{let X={},Y=Array.from(Q.journal.keys()),$=()=>{for(let J of Y)J.pending.delete(X)};return TZ((J)=>{let Z=()=>{$(),J(D6)};for(let G of Y)G.pending.set(X,Z);return nU($)})});function sb(Q,X){for(let[Y,{value:$}]of X.journal){if($!==Y.value)Y.version=Y.version+1,Y.value=$;for(let J of Y.pending.values())Q.currentDispatcher.scheduleTask(J,0);Y.pending.clear()}}function oU(Q){Q.retry=!1,Q.journal.clear()}var tb=JX(YX,(Q)=>{return Q.retry=!0,YB}),eb=(Q,X,Y)=>(...$)=>TZ((J)=>{try{Q(...$,(Z,G)=>{if(Z)J(p(X?X(Z,$):Z));else J(f(G))})}catch(Z){J(Y?p(Y(Z,$)):aU(Z))}}),Qk=()=>(Q)=>Q,Xk=()=>(Q)=>Q,Yk=()=>(Q)=>Q,B9=y_,R5=g_,K1=h_,F8=b_,dY=m_,GX=I_;var $k=(Q,X)=>{if(Y1(Q))return X(0);if(AY(Q.cause))return X(130);return X(Jk(CY(Q.cause)))},HB=(Q)=>U((X)=>x4(X[0]),(X,Y)=>{let $=Y?.disableErrorReporting===!0?F5(X):F5(hY(X,(Z)=>{if(AY(Z))return D6;return Zk(CY(Z))?xZ(Z):D6}));try{let Z=globalThis.setInterval(h9,2147483647);$.addObserver(()=>{clearInterval(Z)})}catch{}let J=Y?.teardown??$k;return Q({fiber:$,teardown:J})}),GB="~effect/Runtime/errorExitCode",Jk=(Q)=>{if(typeof Q==="object"&&Q!==null&&GB in Q){let X=Q[GB];if(typeof X==="number")return X}return 1},WB="~effect/Runtime/errorReported",Zk=(Q)=>{if(typeof Q==="object"&&Q!==null&&WB in Q){let X=Q[WB];if(typeof X==="boolean")return X}return!0};var KB=HB(({fiber:Q,teardown:X})=>{let Y=!1;Q.addObserver((J)=>{process.removeListener("SIGINT",$),process.removeListener("SIGTERM",$),X(J,(Z)=>{if(Y||Z!==0)process.exit(Z)})});function $(){Y=!0,Q.interruptUnsafe(Q.id)}process.on("SIGINT",$),process.on("SIGTERM",$)});var Hk=KB;var g={};p6(g,{withDecodingDefaultTypeKey:()=>Ar,withDecodingDefaultType:()=>Cr,withDecodingDefaultKey:()=>sH,withDecodingDefault:()=>HP,withConstructorDefault:()=>WP,toType:()=>k1,toTaggedUnion:()=>KP,toStandardSchemaV1:()=>vo,toStandardJSONSchemaV1:()=>xo,toRepresentation:()=>Qa,toJsonSchemaDocument:()=>EA,toIsoSource:()=>Aa,toIsoFocus:()=>Ca,toIso:()=>Pa,toFormatter:()=>sn,toEquivalence:()=>en,toEncoderXml:()=>Ga,toEncoded:()=>s5,toDifferJsonPatch:()=>Ta,toCodecStringTree:()=>yA,toCodecJsonAST:()=>d3,toCodecJson:()=>SA,toCodecIso:()=>bA,toCodecArrayFromSingle:()=>Za,toArbitraryLazy:()=>IA,toArbitrary:()=>nn,tagDefaultOmit:()=>jr,tag:()=>x9,suspend:()=>YP,revealCodec:()=>So,revealBottom:()=>jo,resolveAnnotationsKey:()=>ba,resolveAnnotations:()=>xa,requiredKey:()=>no,required:()=>ao,refine:()=>Rr,redact:()=>ZK,readonlyKey:()=>to,overrideToFormatter:()=>an,overrideToEquivalence:()=>tn,overrideToCodecIso:()=>ja,optionalKey:()=>k6,optional:()=>P8,mutableKey:()=>so,mutable:()=>Or,middlewareEncoding:()=>JP,middlewareDecoding:()=>iH,makeIsMultipleOf:()=>AP,makeIsLessThanOrEqualTo:()=>H7,makeIsLessThan:()=>W7,makeIsGreaterThanOrEqualTo:()=>G7,makeIsGreaterThan:()=>Z7,makeIsBetween:()=>K7,makeFilterGroup:()=>Er,makeFilter:()=>j0,make:()=>E,link:()=>v0,isUppercasedReviver:()=>or,isUppercased:()=>NP,isUniqueReviver:()=>Li,isUnique:()=>$K,isUncapitalizedReviver:()=>nr,isUncapitalized:()=>wP,isUint32:()=>Zi,isUUIDReviver:()=>hr,isUUID:()=>DP,isULIDReviver:()=>dr,isULID:()=>BP,isTrimmedReviver:()=>Sr,isTrimmed:()=>tH,isStringSymbolReviver:()=>yr,isStringSymbol:()=>qP,isStringFiniteReviver:()=>br,isStringFinite:()=>VP,isStringBigIntReviver:()=>kr,isStringBigInt:()=>_P,isStartsWithReviver:()=>cr,isStartsWith:()=>OP,isSizeBetweenReviver:()=>zi,isSizeBetween:()=>uP,isSchemaError:()=>eG,isSchema:()=>x3,isPropertyNamesReviver:()=>Ni,isPropertyNames:()=>iP,isPropertiesLengthBetweenReviver:()=>Ri,isPropertiesLengthBetween:()=>rP,isPatternReviver:()=>xr,isPattern:()=>b9,isNonEmpty:()=>dP,isMultipleOfReviver:()=>Yi,isMultipleOf:()=>IP,isMinSizeReviver:()=>Ui,isMinSize:()=>fP,isMinPropertiesReviver:()=>Oi,isMinProperties:()=>lP,isMinLengthReviver:()=>_i,isMinLength:()=>XK,isMaxSizeReviver:()=>Bi,isMaxSize:()=>cP,isMaxPropertiesReviver:()=>Fi,isMaxProperties:()=>oP,isMaxLengthReviver:()=>qi,isMaxLength:()=>pP,isLowercasedReviver:()=>rr,isLowercased:()=>LP,isLessThanReviver:()=>er,isLessThanOrEqualToReviver:()=>Qi,isLessThanOrEqualToDateReviver:()=>Oa,isLessThanOrEqualToDate:()=>xP,isLessThanOrEqualToBigIntReviver:()=>Ma,isLessThanOrEqualToBigInt:()=>hP,isLessThanOrEqualToBigDecimal:()=>Ki,isLessThanOrEqualTo:()=>TP,isLessThanDateReviver:()=>za,isLessThanDate:()=>vP,isLessThanBigIntReviver:()=>La,isLessThanBigInt:()=>gP,isLessThanBigDecimal:()=>Hi,isLessThan:()=>jP,isLengthBetweenReviver:()=>Di,isLengthBetween:()=>YK,isIntReviver:()=>$i,isInt32:()=>Ji,isInt:()=>V7,isIncludesReviver:()=>lr,isIncludes:()=>RP,isGreaterThanReviver:()=>sr,isGreaterThanOrEqualToReviver:()=>tr,isGreaterThanOrEqualToDateReviver:()=>Ba,isGreaterThanOrEqualToDate:()=>SP,isGreaterThanOrEqualToBigIntReviver:()=>Na,isGreaterThanOrEqualToBigInt:()=>yP,isGreaterThanOrEqualToBigDecimal:()=>Wi,isGreaterThanOrEqualTo:()=>QK,isGreaterThanDateReviver:()=>Ua,isGreaterThanDate:()=>EP,isGreaterThanBigIntReviver:()=>Ra,isGreaterThanBigInt:()=>kP,isGreaterThanBigDecimal:()=>Gi,isGreaterThan:()=>CP,isGUIDReviver:()=>mr,isGUID:()=>UP,isFiniteReviver:()=>ar,isFinite:()=>PP,isEndsWithReviver:()=>ur,isEndsWith:()=>FP,isCapitalizedReviver:()=>ir,isCapitalized:()=>MP,isBetweenReviver:()=>Xi,isBetweenDateReviver:()=>Fa,isBetweenDate:()=>bP,isBetweenBigIntReviver:()=>wa,isBetweenBigInt:()=>mP,isBetweenBigDecimal:()=>Vi,isBetween:()=>h3,isBase64UrlReviver:()=>fr,isBase64Url:()=>zP,isBase64Reviver:()=>pr,isBase64:()=>eH,is:()=>kw,instanceOf:()=>y6,fromURLSearchParams:()=>On,fromJsonString:()=>RA,fromFormData:()=>Bn,fromBrand:()=>Nr,flip:()=>pH,fieldsAssign:()=>Hr,extendTo:()=>_r,encodeUnknownSync:()=>iw,encodeUnknownResult:()=>ow,encodeUnknownPromise:()=>rw,encodeUnknownOption:()=>uo,encodeUnknownExit:()=>lw,encodeUnknownEffect:()=>v3,encodeTo:()=>nH,encodeSync:()=>io,encodeResult:()=>oo,encodePromise:()=>ro,encodeOption:()=>lo,encodeKeys:()=>Vr,encodeExit:()=>co,encodeEffect:()=>uw,encode:()=>Pr,decodeUnknownSync:()=>cw,decodeUnknownResult:()=>pw,decodeUnknownPromise:()=>fw,decodeUnknownOption:()=>go,decodeUnknownExit:()=>mw,decodeUnknownEffect:()=>S3,decodeTo:()=>l,decodeSync:()=>fo,decodeResult:()=>mo,decodePromise:()=>po,decodeOption:()=>ho,decodeExit:()=>yo,decodeEffect:()=>ko,decode:()=>wr,declareConstructor:()=>H8,declare:()=>A8,check:()=>Fr,catchEncodingWithContext:()=>GP,catchEncoding:()=>Mr,catchDecodingWithContext:()=>ZP,catchDecoding:()=>Lr,brand:()=>$P,asserts:()=>bo,annotateKey:()=>Eo,annotateEncoded:()=>Io,annotate:()=>To,Void:()=>Zr,UnknownFromJsonString:()=>qn,Unknown:()=>uH,UniqueSymbol:()=>Wr,UniqueArray:()=>zr,Union:()=>Q1,UndefinedOr:()=>y3,Undefined:()=>lH,Uint8ArrayReviver:()=>Tn,Uint8ArrayFromHex:()=>Sn,Uint8ArrayFromBase64Url:()=>En,Uint8ArrayFromBase64:()=>In,Uint8Array:()=>q7,URLSearchParamsReviver:()=>zn,URLSearchParams:()=>_K,URLReviver:()=>ni,URLFromString:()=>ai,URL:()=>GK,TupleWithRest:()=>Dr,Tuple:()=>r5,Trimmed:()=>NA,Trim:()=>Ln,Tree:()=>Ia,TimeZoneReviver:()=>mn,TimeZoneOffsetReviver:()=>yn,TimeZoneOffset:()=>MA,TimeZoneNamedReviver:()=>gn,TimeZoneNamedFromString:()=>hn,TimeZoneNamed:()=>qK,TimeZoneFromString:()=>dn,TimeZone:()=>DK,TemplateLiteralParser:()=>Xr,TemplateLiteral:()=>Qr,TaggedUnion:()=>Tr,TaggedStruct:()=>g3,TaggedErrorClass:()=>rn,TaggedClass:()=>on,Symbol:()=>sw,StructWithRest:()=>qr,Struct:()=>m,StringFromUriComponent:()=>An,StringFromHex:()=>Pn,StringFromBase64Url:()=>wn,StringFromBase64:()=>Mn,String:()=>n,StandardSchemaV1FailureResult:()=>Cn,SchemaError:()=>C6,ResultReviver:()=>Si,Result:()=>nP,RegExpReviver:()=>ii,RegExp:()=>DA,RedactedReviver:()=>bi,RedactedFromValue:()=>ki,Redacted:()=>JK,Record:()=>tw,ReadonlySetReviver:()=>li,ReadonlySet:()=>VA,ReadonlyMapReviver:()=>ci,ReadonlyMap:()=>HA,PropertyKey:()=>cH,OptionReviver:()=>Pi,OptionFromUndefinedOr:()=>Ci,OptionFromOptionalNullOr:()=>Ei,OptionFromOptionalKey:()=>Ti,OptionFromOptional:()=>Ii,OptionFromNullishOr:()=>ji,OptionFromNullOr:()=>Ai,Option:()=>g6,Opaque:()=>Ir,ObjectKeyword:()=>Gr,NumberFromString:()=>Fn,Number:()=>b3,NullishOr:()=>XP,NullOr:()=>rH,Null:()=>F0,NonEmptyString:()=>Mi,NonEmptyArray:()=>Ur,Never:()=>$r,Natural:()=>W8,MutableJsonReviver:()=>va,MutableJson:()=>pA,Literals:()=>k3,Literal:()=>p0,JsonReviver:()=>Ea,Json:()=>p3,Int:()=>k9,HashSetReviver:()=>oi,HashSet:()=>_A,HashMapReviver:()=>ui,HashMap:()=>KA,FormDataReviver:()=>Un,FormData:()=>VK,FiniteFromString:()=>Rn,Finite:()=>o8,FileReviver:()=>Dn,File:()=>KK,ExitReviver:()=>fi,Exit:()=>ZA,ErrorReviver:()=>di,ErrorClass:()=>TA,Error:()=>JA,Enum:()=>Yr,DurationReviver:()=>Qn,DurationFromString:()=>Yn,DurationFromNanos:()=>$n,DurationFromMillis:()=>Jn,Duration:()=>_7,Defect:()=>pi,DateTimeZonedReviver:()=>pn,DateTimeZonedFromString:()=>fn,DateTimeZoned:()=>UK,DateTimeUtcReviver:()=>vn,DateTimeUtcFromString:()=>bn,DateTimeUtcFromMillis:()=>kn,DateTimeUtcFromDate:()=>xn,DateTimeUtc:()=>D7,DateReviver:()=>si,DateFromString:()=>ti,DateFromMillis:()=>ei,Date:()=>r8,Class:()=>jA,ChunkReviver:()=>ri,Chunk:()=>qA,Char:()=>wi,CauseReviver:()=>gi,CauseReasonReviver:()=>yi,CauseReason:()=>T3,Cause:()=>I3,BooleanFromBit:()=>jn,Boolean:()=>aw,BigIntFromString:()=>Nn,BigInt:()=>U4,BigDecimalReviver:()=>Kn,BigDecimalFromString:()=>Vn,BigDecimal:()=>HK,ArrayEnsure:()=>Br,Array:()=>e0,Any:()=>Jr});var VB=/^[+-]?\d+$/,bZ="~effect/BigDecimal",Kk={[bZ]:bZ,[D0](){let Q=kZ(this);return X1(X0(Q.value),z4(Q.scale))},[U0](Q){return cY(Q)&&Bk(this,Q)},toString(){return`BigDecimal(${W4(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[W1](){return this.toJSON()},pipe(){return H0(this,arguments)}},cY=(Q)=>C(Q,bZ),p1=(Q,X)=>{let Y=Object.create(Kk);return Y.value=Q,Y.scale=X,Y},qB=(Q,X)=>{if(Q!==Y8&&Q%fY===Y8)throw RangeError("Value must be normalized");let Y=p1(Q,X);return Y.normalized=Y,Y},Y8=BigInt(0),Vk=BigInt(1),_k=BigInt(-1);var fY=BigInt(10),DB=qB(Y8,0);var kZ=(Q)=>{if(Q.normalized===void 0)if(Q.value===Y8)Q.normalized=DB;else{let X=`${Q.value}`,Y=0;for(let Z=X.length-1;Z>=0;Z--)if(X[Z]==="0")Y++;else break;if(Y===0)Q.normalized=Q;let $=BigInt(X.substring(0,X.length-Y)),J=Q.scale-Y;Q.normalized=qB($,J)}return Q.normalized},B6=U(2,(Q,X)=>{if(X>Q.scale)return p1(Q.value*fY**BigInt(X-Q.scale),X);if(X<Q.scale)return p1(Q.value/fY**BigInt(Q.scale-X),X);return Q}),UB=U(2,(Q,X)=>{if(X.value===Y8)return Q;if(Q.value===Y8)return X;if(Q.scale>X.scale)return p1(B6(X,Q.scale).value+Q.value,Q.scale);if(Q.scale<X.scale)return p1(B6(Q,X.scale).value+X.value,X.scale);return p1(Q.value+X.value,Q.scale)});var b4=s6((Q,X)=>{let Y=D1(_B(Q),_B(X));if(Y!==0)return Y;if(Q.scale>X.scale)return _8(Q.value,B6(X,Q.scale).value);if(Q.scale<X.scale)return _8(B6(Q,X.scale).value,X.value);return _8(Q.value,X.value)}),qk=o9(b4);var Dk=Y6(b4);var _B=(Q)=>Q.value===Y8?0:Q.value<Y8?-1:1,Uk=(Q)=>Q.value<Y8?p1(-Q.value,Q.scale):Q;var yZ=H1((Q,X)=>{if(Q.scale>X.scale)return B6(X,Q.scale).value===Q.value;if(Q.scale<X.scale)return B6(Q,X.scale).value===X.value;return Q.value===X.value}),Bk=U(2,(Q,X)=>yZ(Q,X));var BB=(Q)=>{if(Q==="")return R(DB);let X,Y,$=Q.search(/[eE]/);if($!==-1){let H=Q.slice($+1);if(X=Q.slice(0,$),Y=Number(H),X===""||!Number.isSafeInteger(Y)||!VB.test(H))return d()}else X=Q,Y=0;let J,Z,G=X.search(/\./);if(G!==-1){let H=X.slice(0,G),K=X.slice(G+1);J=`${H}${K}`,Z=K.length}else J=X,Z=0;if(!VB.test(J))return d();let W=Z-Y;if(!Number.isSafeInteger(W))return d();return R(p1(BigInt(J),W))};var W4=(Q)=>{let X=kZ(Q);if(Math.abs(X.scale)>=16)return zk(X);let Y=X.value<Y8,$=Y?`${X.value}`.substring(1):`${X.value}`,J,Z;if(X.scale>=$.length)J="0",Z="0".repeat(X.scale-$.length)+$;else{let W=$.length-X.scale;if(W>$.length){let H=W-$.length;J=`${$}${"0".repeat(H)}`,Z=""}else Z=$.slice(W),J=$.slice(0,W)}let G=Z===""?J:`${J}.${Z}`;return Y?`-${G}`:G},zk=(Q)=>{if(Ok(Q))return"0e+0";let X=kZ(Q),Y=`${Uk(X).value}`,$=Y.slice(0,1),J=Y.slice(1),Z=`${zB(X)?"-":""}${$}`;if(J!=="")Z+=`.${J}`;let G=J.length-X.scale;return`${Z}e${G>=0?"+":""}${G}`};var Ok=(Q)=>Q.value===Y8,zB=(Q)=>Q.value<Y8,Fk=(Q)=>Q.value>Y8,gZ=(Q)=>cY(Q[0]);var OB=U(gZ,(Q,X=0)=>{if(Q.scale<=X)return Q;return p1(Q.value/fY**BigInt(Q.scale-X),X)}),hZ=U(gZ,(Q,X=0)=>{let Y=OB(Q,X);if(Fk(Q)&&qk(Y,Q))return UB(Y,p1(Vk,X));return Y});var mZ=U(gZ,(Q,X=0)=>{let Y=OB(Q,X);if(zB(Q)&&Dk(Y,Q))return UB(Y,p1(_k,X));return Y});var RB="~effect/collections/Chunk";function Rk(Q,X,Y,$,J){for(let Z=X;Z<Math.min(Q.length,X+J);Z++)Y[$+Z-X]=Q[Z];return Y}var NB=[],pZ=(Q)=>H1((X,Y)=>X.length===Y.length&&WX(X).every(($,J)=>Q($,HX(Y,J)))),Nk=pZ(o),Lk={[RB]:{_A:(Q)=>Q},toString(){return`Chunk(${P(WX(this))})`},toJSON(){return{_id:"Chunk",values:R1(WX(this))}},[W1](){return this.toJSON()},[U0](Q){return uY(Q)&&Nk(this,Q)},[D0](){return GQ(WX(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return NB[Symbol.iterator]();default:return WX(this)[Symbol.iterator]()}},pipe(){return H0(this,arguments)}},fZ=(Q)=>{let X=Object.create(Lk);switch(X.backing=Q,Q._tag){case"IEmpty":{X.length=0,X.depth=0,X.left=X,X.right=X;break}case"IConcat":{X.length=Q.left.length+Q.right.length,X.depth=1+Math.max(Q.left.depth,Q.right.depth),X.left=Q.left,X.right=Q.right;break}case"IArray":{X.length=Q.array.length,X.depth=0,X.left=k4,X.right=k4;break}case"ISingleton":{X.length=1,X.depth=0,X.left=k4,X.right=k4;break}case"ISlice":{X.length=Q.length,X.depth=Q.chunk.depth+1,X.left=k4,X.right=k4;break}}return X},uY=(Q)=>C(Q,RB),k4=fZ({_tag:"IEmpty"}),Mk=()=>k4;var wk=(Q)=>fZ({_tag:"ISingleton",a:Q}),lY=(Q)=>uY(Q)?Q:Ak(M1(Q)),dZ=(Q,X,Y)=>{switch(Q.backing._tag){case"IArray":{Rk(Q.backing.array,0,X,Y,Q.length);break}case"IConcat":{dZ(Q.left,X,Y),dZ(Q.right,X,Y+Q.left.length);break}case"ISingleton":{X[Y]=Q.backing.a;break}case"ISlice":{let $=0,J=Y;while($<Q.length)X[J]=HX(Q,$),$+=1,J+=1;break}}};var Pk=(Q)=>{switch(Q.backing._tag){case"IEmpty":return NB;case"IArray":return Q.backing.array;default:{let X=Array(Q.length);return dZ(Q,X,0),Q.backing={_tag:"IArray",array:X},Q.left=k4,Q.right=k4,Q.depth=0,X}}},WX=Pk;var Ak=(Q)=>Q.length===0?Mk():Q.length===1?wk(Q[0]):fZ({_tag:"IArray",array:Q});var HX=U(2,(Q,X)=>{let Y=Math.floor(X);switch(Q.backing._tag){case"IEmpty":throw Error(`Index out of bounds: ${Y}`);case"ISingleton":{if(X!==0)throw Error(`Index out of bounds: ${Y}`);return Q.backing.a}case"IArray":{if(Y>=Q.length||Y<0)throw Error(`Index out of bounds: ${Y}`);return Q.backing.array[Y]}case"IConcat":return Y<Q.left.length?HX(Q.left,Y):HX(Q.right,Y-Q.left.length);case"ISlice":return HX(Q.backing.chunk,Y+Q.backing.offset)}});var LB=(Q)=>Q.length;var cZ=U5,MB=_9,wB=_U,PB=qU,AB=DU,CB=ZZ,uZ=UU,lZ=BU;var jB=D5;var TB=HZ;var oY=zU,IB=OU;var rY=FU;var oZ=KZ,KX=aQ,EB=VZ;var SB=_Z,z6=RU;var iY=sQ;var vB=UZ;var xB=LU;var nY=zZ;var bB="~effect/encoding/EncodingError";class O6 extends SY("EncodingError"){[bB]=bB}var sY=(Q)=>typeof Q==="string"?iZ(sZ.encode(Q)):iZ(Q),N5=(Q)=>{let X=uB(Q),Y=X.length;if(Y%4!==0)return i(new O6({kind:"Decode",module:"Base64",input:X,message:`Length must be a multiple of 4, but is ${Y}`}));let $=X.indexOf("=");if($!==-1&&($<Y-2||$===Y-2&&X[Y-1]!=="="))return i(new O6({kind:"Decode",module:"Base64",input:X,message:"Found a '=' character, but it is not at the end"}));try{let J=X.endsWith("==")?2:X.endsWith("=")?1:0,Z=new Uint8Array(3*(Y/4)-J);for(let G=0,W=0;G<Y;G+=4,W+=3){let H=aY(X.charCodeAt(G))<<18|aY(X.charCodeAt(G+1))<<12|aY(X.charCodeAt(G+2))<<6|aY(X.charCodeAt(G+3));Z[W]=H>>16,Z[W+1]=H>>8&255,Z[W+2]=H&255}return t(Z)}catch(J){return i(new O6({kind:"Decode",module:"Base64",input:X,message:J instanceof Error?J.message:"Invalid input"}))}},mB=(Q)=>X9(N5(Q),(X)=>tZ.decode(X)),dB=(Q)=>typeof Q==="string"?yB(sZ.encode(Q)):yB(Q),nZ=(Q)=>{let X=uB(Q),Y=X.length;if(Y%4===1)return i(new O6({module:"Base64Url",kind:"Decode",input:X,message:`Length should be a multiple of 4, but is ${Y}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(X))return i(new O6({module:"Base64Url",kind:"Decode",input:X,message:"Invalid input"}));let $=Y%4===2?`${X}==`:Y%4===3?`${X}=`:X;return $=$.replace(/-/g,"+").replace(/_/g,"/"),N5($)},pB=(Q)=>X9(nZ(Q),(X)=>tZ.decode(X)),fB=(Q)=>typeof Q==="string"?gB(sZ.encode(Q)):gB(Q),aZ=(Q)=>{let X=new TextEncoder().encode(Q);if(X.length%2!==0)return i(new O6({module:"Hex",kind:"Decode",input:Q,message:`Length must be a multiple of 2, but is ${X.length}`}));try{let Y=X.length/2,$=new Uint8Array(Y);for(let J=0;J<Y;J++){let Z=hB(X[J*2]),G=hB(X[J*2+1]);$[J]=Z<<4|G}return t($)}catch(Y){return i(new O6({module:"Hex",kind:"Decode",input:Q,message:Y instanceof Error?Y.message:"Invalid input"}))}},cB=(Q)=>X9(aZ(Q),(X)=>tZ.decode(X)),sZ=new TextEncoder,tZ=new TextDecoder,uB=(Q)=>Q.replace(/[\n\r]/g,""),iZ=(Q)=>{let X=Q.length,Y="",$;for($=2;$<X;$+=3)Y+=y4[Q[$-2]>>2],Y+=y4[(Q[$-2]&3)<<4|Q[$-1]>>4],Y+=y4[(Q[$-1]&15)<<2|Q[$]>>6],Y+=y4[Q[$]&63];if($===X+1)Y+=y4[Q[$-2]>>2],Y+=y4[(Q[$-2]&3)<<4],Y+="==";if($===X)Y+=y4[Q[$-2]>>2],Y+=y4[(Q[$-2]&3)<<4|Q[$-1]>>4],Y+=y4[(Q[$-1]&15)<<2],Y+="=";return Y};function aY(Q){if(Q>=kB.length)throw TypeError(`Invalid character ${String.fromCharCode(Q)}`);let X=kB[Q];if(X===255)throw TypeError(`Invalid character ${String.fromCharCode(Q)}`);return X}var y4=["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","+","/"],kB=[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],yB=(Q)=>iZ(Q).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),gB=(Q)=>{let X="";for(let Y=0;Y<Q.length;++Y)X+=jk[Q[Y]];return X},hB=(Q)=>{if(48<=Q&&Q<=57)return Q-48;if(97<=Q&&Q<=102)return Q-97+10;if(65<=Q&&Q<=70)return Q-65+10;throw TypeError("Invalid input")},jk=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var eY="~effect/collections/HashMap",x8=5,DX=1<<x8,Tk=DX/4,oB=DX/2,Ik=DX-1,Ek=(Q)=>{return Q=Q-(Q>>>1&1431655765),Q=(Q&858993459)+(Q>>>2&858993459),(Q+(Q>>>4)&252645135)*16843009>>>24},VX=(Q,X)=>Q>>>X&Ik,F6=(Q,X)=>1<<VX(Q,X),tY=(Q,X)=>Ek(Q&X-1);function rB(Q,X,Y,$,J,Z){if(X>32)throw Error("HashMap: max depth exceeded");let G=F6(Y,X),W=F6(J,X);if(G===W){let V=rB(Q,X+x8,Y,$,J,Z);return new H4(Q,G,[V])}let H=G|W,K=G>>>0<W>>>0?[$,Z]:[Z,$];return new H4(Q,H,K)}class L5{canEdit(Q){return this.edit===Q}}class iB extends L5{_tag="EmptyNode";edit=0;get size(){return 0}get(Q,X,Y){return d()}has(Q,X,Y){return!1}set(Q,X,Y,$,J,Z){return Z.value=!0,new g4(Q,Y,$,J)}remove(Q,X,Y,$,J){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(Q){return!1}}class g4 extends L5{_tag="LeafNode";edit;hash;key;value;constructor(Q,X,Y,$){super();this.edit=Q,this.hash=X,this.key=Y,this.value=$}get size(){return 1}get(Q,X,Y){if(this.hash===X&&o(this.key,Y))return R(this.value);return d()}has(Q,X,Y){return this.hash===X&&o(this.key,Y)}set(Q,X,Y,$,J,Z){if(this.hash===Y&&o(this.key,$)){if(o(this.value,J))return this;if(this.canEdit(Q))return this.value=J,this;return new g4(Q,Y,$,J)}if(Z.value=!0,this.hash===Y)return new _X(Q,Y,[[this.key,this.value],[$,J]]);let G=F6(Y,X),W=F6(this.hash,X);if(G===W)return new H4(Q,G,[this.set(Q,X+x8,Y,$,J,Z)]);let H=G|W,K=G>>>0<W>>>0?[new g4(Q,Y,$,J),this]:[this,new g4(Q,Y,$,J)];return new H4(Q,H,K)}remove(Q,X,Y,$,J){if(this.hash===Y&&o(this.key,$)){J.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}}class _X extends L5{_tag="CollisionNode";edit;hash;entries;constructor(Q,X,Y){super();this.edit=Q,this.hash=X,this.entries=Y}get size(){return this.entries.length}get(Q,X,Y){if(this.hash!==X)return d();for(let[$,J]of this.entries)if(o($,Y))return R(J);return d()}has(Q,X,Y){if(this.hash!==X)return!1;for(let[$]of this.entries)if(o($,Y))return!0;return!1}set(Q,X,Y,$,J,Z){if(this.hash!==Y)return Z.value=!0,rB(Q,X,this.hash,this,Y,new g4(Q,Y,$,J));for(let G=0;G<this.entries.length;G++)if(o(this.entries[G][0],$)){if(o(this.entries[G][1],J))return this;if(this.canEdit(Q))return this.entries[G]=[$,J],this;let W=[...this.entries];return W[G]=[$,J],new _X(Q,this.hash,W)}if(Z.value=!0,this.canEdit(Q))return this.entries.push([$,J]),this;return new _X(Q,this.hash,[...this.entries,[$,J]])}remove(Q,X,Y,$,J){if(this.hash!==Y)return this;let Z=this.entries.findIndex(([W])=>o(W,$));if(Z===-1)return this;if(J.value=!0,this.entries.length===1)return;if(this.entries.length===2){let W=this.entries[Z===0?1:0];return new g4(Q,this.hash,W[0],W[1])}if(this.canEdit(Q))return this.entries.splice(Z,1),this;let G=[...this.entries];return G.splice(Z,1),new _X(Q,this.hash,G)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}}class H4 extends L5{_tag="IndexedNode";edit;_size;bitmap;children;constructor(Q,X,Y){super();this.edit=Q,this.bitmap=X,this.children=Y}get size(){if(this._size===void 0)this._size=this.children.reduce((Q,X)=>Q+X.size,0);return this._size}get(Q,X,Y){let $=F6(X,Q);if((this.bitmap&$)===0)return d();let J=tY(this.bitmap,$);return this.children[J].get(Q+x8,X,Y)}has(Q,X,Y){let $=F6(X,Q);if((this.bitmap&$)===0)return!1;let J=tY(this.bitmap,$);return this.children[J].has(Q+x8,X,Y)}set(Q,X,Y,$,J,Z){let G=F6(Y,X),W=tY(this.bitmap,G);if((this.bitmap&G)!==0){let H=this.children[W],K=H.set(Q,X+x8,Y,$,J,Z);if(H===K)return this;if(this.canEdit(Q))return this.children[W]=K,this;let V=[...this.children];return V[W]=K,new H4(Q,this.bitmap,V)}else{Z.value=!0;let H=new g4(Q,Y,$,J),K=this.bitmap|G;if(this.canEdit(Q)){if(this.children.splice(W,0,H),this.bitmap=K,this._size=void 0,this.children.length>oB)return this.expand(Q,K,this.children);return this}let V=[...this.children];if(V.splice(W,0,H),V.length>oB)return this.expand(Q,K,V);return new H4(Q,K,V)}}remove(Q,X,Y,$,J){let Z=F6(Y,X);if((this.bitmap&Z)===0)return this;let G=tY(this.bitmap,Z),W=this.children[G],H=W.remove(Q,X+x8,Y,$,J);if(!J.value)return this;if(H===void 0){let V=this.bitmap^Z;if(V===0)return;if(this.children.length===2){let q=this.children[G===0?1:0];if(q._tag==="LeafNode")return q}if(this.canEdit(Q))return this.children.splice(G,1),this.bitmap=V,this._size=void 0,this;let _=[...this.children];return _.splice(G,1),new H4(Q,V,_)}if(W===H)return this;if(this.canEdit(Q))return this.children[G]=H,this;let K=[...this.children];return K[G]=H,new H4(Q,this.bitmap,K)}expand(Q,X,Y){let $=new globalThis.Array(DX),J=0;for(let Z=0;Z<DX;Z++)if((X&1<<Z)!==0)$[Z]=Y[J++];return new qX(Q,Y.length,$)}iterator(){let Q=0,X;return{next:()=>{while(Q<this.children.length){if(!X)X=this.children[Q].iterator();let Y=X.next();if(!Y.done)return Y;X=void 0,Q++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}}class qX extends L5{_tag="ArrayNode";edit;_size;count;children;constructor(Q,X,Y){super();this.edit=Q,this.count=X,this.children=Y}get size(){if(this._size===void 0)this._size=this.children.reduce((Q,X)=>Q+(X?.size??0),0);return this._size}get(Q,X,Y){let $=VX(X,Q),J=this.children[$];return J?J.get(Q+x8,X,Y):d()}has(Q,X,Y){let $=VX(X,Q),J=this.children[$];return J?J.has(Q+x8,X,Y):!1}set(Q,X,Y,$,J,Z){let G=VX(Y,X),W=this.children[G];if(W){let H=W.set(Q,X+x8,Y,$,J,Z);if(W===H)return this;if(this.canEdit(Q))return this.children[G]=H,this;let K=[...this.children];return K[G]=H,new qX(Q,this.count,K)}else{Z.value=!0;let H=new g4(Q,Y,$,J);if(this.canEdit(Q))return this.children[G]=H,this.count++,this._size=void 0,this;let K=[...this.children];return K[G]=H,new qX(Q,this.count+1,K)}}remove(Q,X,Y,$,J){let Z=VX(Y,X),G=this.children[Z];if(!G)return this;let W=G.remove(Q,X+x8,Y,$,J);if(!J.value)return this;let H=this.count-(W?0:1);if(H<Tk)return this.pack(Q,Z,W);if(G===W)return this;if(this.canEdit(Q)){if(this.children[Z]=W,!W)this.count=H;return this._size=void 0,this}let K=[...this.children];return K[Z]=W,new qX(Q,H,K)}pack(Q,X,Y){let $=[],J=0,Z=1;for(let G=0;G<this.children.length;G++){let W=G===X?Y:this.children[G];if(W)$.push(W),J|=Z;Z<<=1}return new H4(Q,J,$)}iterator(){let Q=0,X;return{next:()=>{while(Q<this.children.length){let Y=this.children[Q];if(!Y){Q++;continue}if(!X)X=Y.iterator();let $=X.next();if(!$.done)return $;X=void 0,Q++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}}class Q2{[eY]=eY;_editable;_edit;_root;_size;constructor(Q,X,Y,$){this._editable=Q,this._edit=X,this._root=Y,this._size=$}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[U0](Q){if(eZ(Q)){let X=Q;if(this.size!==X.size)return!1;for(let[Y,$]of this){let J=n3(Q,sB(Y));if(I0(J)||!o($,J.value))return!1}return!0}return!1}[D0](){let Q=b0("HashMap");for(let[X,Y]of this)Q=Q^X0(X)+X0(Y);return Q}[W1](){return R1(this)}toString(){return`HashMap(${P(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([Q,X])=>[R1(Q),R1(X)])}}pipe(){return H0(this,arguments)}}var nB=new iB,eZ=(Q)=>C(Q,eY),QG=()=>new Q2(!1,0,nB,0);var aB=(Q)=>{let X=nB,Y=0,$={value:!1};for(let[J,Z]of Q){let G=X0(J);if($.value=!1,X=X.set(NaN,0,G,J,Z,$),$.value)Y++}return new Q2(!1,0,X,Y)};var sB=U(2,(Q,X)=>{return Q._root.get(0,X0(X),X)});var XG=U(2,(Q,X)=>{return Q._root.has(0,X0(X),X)});var YG=U(3,(Q,X,Y)=>{let $=Q,J=X0(X),Z={value:!1},G=$._editable?$._edit:NaN,W=$._root.set(G,0,J,X,Y,Z);if($._editable){if($._root=W,Z.value)$._size++;return Q}if($._root===W)return Q;return new Q2(!1,$._edit,W,$._size+(Z.value?1:0))}),$G=(Q)=>{let X=Q[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let Y=X.next();if(Y.done)return{done:!0,value:void 0};return{done:!1,value:Y.value[0]}}}};var tB=(Q)=>{let X=Q[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return X.next()}}},X2=(Q)=>Q.size;var Qz=eZ;var Y2=aB;var xk=tB,$2=(Q)=>Array.from(xk(Q)),Xz=X2;var UX="~effect/collections/HashSet",kk={[D0](){return X0(UX)},[U0](Q){return JG(Q)&&J2(this)===J2(Q)&&Jz(this,(X)=>$z(Q,X))},[Symbol.iterator](){return $G(ZG(this))},toString(){return`HashSet(${P(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:R1(Array.from(this))}},[W1](){return this.toJSON()},pipe(){return H0(this,arguments)}},yk=(Q)=>{let X=Object.create(kk);return X[UX]=UX,X.keyMap=Q,X},JG=(Q)=>C(Q,UX),ZG=(Q)=>Q.keyMap;var Yz=(Q)=>{let X=QG();for(let Y of Q)X=YG(X,Y,!0);return yk(X)},$z=(Q,X)=>XG(ZG(Q),X);var J2=(Q)=>X2(ZG(Q));var Jz=(Q,X)=>{for(let Y of Q)if(!X(Y))return!1;return!0};var Z2=Yz,Zz=JG;var Gz=J2;function h4(Q){return Q.checks?Q.checks[Q.checks.length-1].annotations:Q.annotations}function BX(Q){return(X)=>h4(X)?.[Q]}var f1="~structural",zX="~identifier",OX="~sentinels",Wz=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],R6=BX("identifier"),G2=BX(zX),GG=BX("title");var Hz=BX("brands"),W2=s0((Q)=>{let X=R6(Q);if(typeof X==="string")return X;return Q.getExpected(W2)});var Kz=new Set([OX,f1,"representation","arbitrary","brands","toJsonSchema","toCode","toArbitrary","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso"]);var O9=new WeakMap,Vz=(Q)=>{if(O9.has(Q))return O9.get(Q);else throw Error("Unable to get redacted value"+(Q.label?` with label: "${Q.label}"`:""))};var _z="~effect/data/Redacted",WG=(Q)=>C(Q,_z),K4=(Q,X)=>{let Y=Object.create(dk);if(X?.label)Y.label=X.label;return O9.set(Y,Q),Y},dk={[_z]:{_A:(Q)=>Q},label:void 0,...F4,toJSON(){return this.toString()},toString(){return`<redacted${C8(this.label)?":"+this.label:""}>`},[D0](){return X0(O9.get(this))},[U0](Q){return WG(Q)&&o(O9.get(this),O9.get(Q))}},M5=Vz;var qz=(Q)=>H1((X,Y)=>Q(M5(X),M5(Y)));var RX="~effect/SchemaIssue/Issue";function VG(Q){return C(Q,RX)&&Q[RX]===RX}class R8{[RX]=RX;toString(){return fk(this)}}class K2 extends R8{_tag="Filter";actual;filter;issue;constructor(Q,X,Y){super();this.actual=Q,this.filter=X,this.issue=Y}}class _G extends R8{_tag="Encoding";ast;actual;issue;constructor(Q,X,Y){super();this.ast=Q,this.actual=X,this.issue=Y}}class S0 extends R8{_tag="Pointer";path;issue;constructor(Q,X){super();this.path=Q,this.issue=X}}class LX extends R8{_tag="MissingKey";annotations;constructor(Q){super();this.annotations=Q}}class V2 extends R8{_tag="UnexpectedKey";ast;actual;constructor(Q,X){super();this.ast=Q,this.actual=X}}class N0 extends R8{_tag="Composite";ast;actual;issues;constructor(Q,X,Y){super();this.ast=Q,this.actual=X,this.issues=Y}}class u0 extends R8{_tag="InvalidType";ast;actual;constructor(Q,X){super();this.ast=Q,this.actual=X}}class q0 extends R8{_tag="InvalidValue";actual;annotations;constructor(Q,X){super();this.actual=Q,this.annotations=X}}class w5 extends R8{_tag="Forbidden";actual;annotations;constructor(Q,X){super();this.actual=Q,this.annotations=X}}class _2 extends R8{_tag="AnyOf";ast;actual;issues;constructor(Q,X,Y){super();this.ast=Q,this.actual=X,this.issues=Y}}class qG extends R8{_tag="OneOf";ast;actual;successes;constructor(Q,X,Y){super();this.ast=Q,this.actual=X,this.successes=Y}}function HG(Q,X){if(VG(X))return X;if(typeof X==="string")return new q0(R(Q),{message:X});let Y=typeof X.issue==="string"?new q0(R(Q),{message:X.issue}):X.issue;return new S0(X.path,Y)}function Bz(Q,X){if(X===void 0)return;if(typeof X==="boolean")return X?void 0:new q0(R(Q));return HG(Q,X)}function zz(Q,X,Y){if(Array.isArray(Y)){if(Z6(Y)){if(Y.length===1)return HG(Q,Y[0]);return new N0(X,R(Q),Q4(Y,($)=>HG(Q,$)))}return}return Bz(Q,Y)}var Oz=(Q)=>{let X=NX(Q);if(X!==void 0)return X;switch(Q._tag){case"InvalidType":return KG(W2(Q.ast),Uz(Q.actual));case"InvalidValue":return`Invalid data ${Uz(Q.actual)}`;case"MissingKey":return"Missing key";case"UnexpectedKey":return`Unexpected key with value ${P(Q.actual)}`;case"Forbidden":return"Forbidden operation";case"OneOf":return`Expected exactly one member to match the input ${P(Q.actual)}`}},Fz=(Q)=>{return NX(Q.issue)??NX(Q)};function Rz(Q){return(X)=>({issues:F9(X,[],Q?.leafHook??Oz,Q?.checkHook??Fz)})}function KG(Q,X){return`Expected ${Q}, got ${X}`}function F9(Q,X,Y,$){switch(Q._tag){case"Filter":{let J=$(Q);if(J!==void 0)return[{path:X,message:J}];switch(Q.issue._tag){case"InvalidValue":return[{path:X,message:KG(Nz(Q.filter),P(Q.actual))}];default:return F9(Q.issue,X,Y,$)}}case"Encoding":return F9(Q.issue,X,Y,$);case"Pointer":return F9(Q.issue,[...X,...Q.path],Y,$);case"Composite":return Q.issues.flatMap((J)=>F9(J,X,Y,$));case"AnyOf":{let J=NX(Q);if(Q.issues.length===0){if(J!==void 0)return[{path:X,message:J}];let Z=KG(W2(Q.ast),P(Q.actual));return[{path:X,message:Z}]}return Q.issues.flatMap((Z)=>F9(Z,X,Y,$))}default:return[{path:X,message:Y(Q)}]}}function Nz(Q){let X=Q.annotations?.expected;if(typeof X==="string")return X;switch(Q._tag){case"Filter":return"<filter>";case"FilterGroup":return Q.checks.map((Y)=>Nz(Y)).join(" & ")}}function pk(){return(Q)=>F9(Q,[],Oz,Fz).map(ck).join(`
|
|
27
|
-
`)}var fk=pk();function ck(Q){let X=Q.message;if(Q.path&&Q.path.length>0){let Y=C7(Q.path);X+=`
|
|
28
|
-
at ${Y}`}return X}function NX(Q){switch(Q._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return FX(Q.ast.annotations);case"InvalidValue":case"Forbidden":return FX(Q.annotations);case"MissingKey":return FX(Q.annotations,"messageMissingKey");case"UnexpectedKey":return FX(Q.ast.annotations,"messageUnexpectedKey");case"Filter":return FX(Q.filter.annotations);case"Encoding":return NX(Q.issue)}}function FX(Q,X="message"){let Y=Q?.[X];if(typeof Y==="string")return Y}function Uz(Q){if(I0(Q))return"no value provided";return P(Q.value)}function H2(Q){switch(Q._tag){case"MissingKey":return Q;case"Forbidden":return new w5($6(Q.actual,K4),Q.annotations);case"Filter":return new K2(K4(Q.actual),Q.filter,H2(Q.issue));case"Pointer":return new S0(Q.path,H2(Q.issue));case"Encoding":case"InvalidType":case"InvalidValue":case"Composite":return new q0($6(Q.actual,K4));case"AnyOf":case"OneOf":case"UnexpectedKey":return new q0(R(K4(Q.actual)))}}function q2(Q){let X;for(let Y of Q.reasons){if(!pQ(Y)||!VG(Y.error))return;X??=Y.error}return X}function m4(Q,X){let Y=q2(Q);if(Y===void 0)throw Error(X,{cause:Q});return Y}class d4 extends f6{run;constructor(Q){super();this.run=Q}map(Q){return new d4((X,Y)=>this.run(X,Y).pipe(B9($6(Q))))}compose(Q){if(Mz(this))return Q;if(Mz(Q))return this;return new d4((X,Y)=>this.run(X,Y).pipe(F8(($)=>Q.run($,Y))))}}function uk(Q){return new d4((X)=>p(Q(X)))}function DG(Q){return uk((X)=>new w5(X,{message:Q(X)}))}var wz=new d4(f);function Mz(Q){return Q.run===wz.run}function b8(){return wz}function UG(Q){return new d4((X,Y)=>I0(X)?v8:Q(X.value,Y))}function Y0(Q){return D2($6(Q))}function c1(Q){return UG((X,Y)=>Q(X,Y).pipe(B9(R)))}function D2(Q){return new d4((X)=>f(Q(X)))}function BG(){return new d4(()=>v8)}function MX(Q){return new d4((X)=>{let Y=n9(X,_1);return L1(Y)?f(Y):B9(Q,R)})}function R9(){return Y0(globalThis.String)}function U2(){return Y0(globalThis.Number)}function Pz(){return Y0(globalThis.BigInt)}function zG(){return Y0((Q)=>new globalThis.Date(Q))}function Az(){return Y0(CU)}function Cz(Q){return UG((X)=>O5({try:()=>R(JSON.parse(X,Q?.reviver)),catch:(Y)=>new q0(R(X),{message:globalThis.String(Y)})}))}function jz(Q){return UG((X)=>O5({try:()=>{let Y=JSON.stringify(X,Q?.replacer,Q?.space);if(Y===void 0)throw TypeError("Value cannot be represented as JSON");return R(Y)},catch:(Y)=>new q0(R(X),{message:globalThis.String(Y)})}))}function OG(){return Y0(sY)}function B2(){return Y0(dB)}function z2(){return Y0(fB)}function Tz(){return c1((Q)=>R5(IZ(N5(Q)),(X)=>new q0(R(Q),{message:X.message})))}function Iz(){return c1((Q)=>B8(mB(Q),{onFailure:(X)=>p(new q0(R(Q),{message:X.message})),onSuccess:f}))}function Ez(){return c1((Q)=>B8(nZ(Q),{onFailure:(X)=>p(new q0(R(Q),{message:X.message})),onSuccess:f}))}function Sz(){return c1((Q)=>B8(pB(Q),{onFailure:(X)=>p(new q0(R(Q),{message:X.message})),onSuccess:f}))}function vz(){return c1((Q)=>B8(aZ(Q),{onFailure:(X)=>p(new q0(R(Q),{message:X.message})),onSuccess:f}))}function xz(){return c1((Q)=>B8(cB(Q),{onFailure:(X)=>p(new q0(R(Q),{message:X.message})),onSuccess:f}))}function bz(){return Y0(encodeURIComponent)}function kz(){return c1((Q)=>{try{return f(globalThis.decodeURIComponent(Q))}catch(X){return p(new q0(R(Q),{message:X instanceof URIError?X.message:"Invalid URI component"}))}})}function FG(){return c1((Q)=>{return T8(oY(Q),{onNone:()=>p(new q0(R(Q),{message:"Invalid DateTime input"})),onSome:(X)=>f(rY(X))})})}function yz(){return Y0((Q)=>dz(Array.from(Q.entries())))}var lk=pz((Q)=>typeof Q==="string"||typeof Blob<"u"&&Q instanceof Blob);function gz(){return Y0((Q)=>{let X=new FormData;if(typeof Q==="object"&&Q!==null)lk(Q).forEach(([$,J])=>{X.append($,J)});return X})}function hz(){return Y0((Q)=>dz(Array.from(Q.entries())))}var ok=pz(C8);function mz(){return Y0((Q)=>{if(typeof Q==="object"&&Q!==null)return new URLSearchParams(ok(Q));return new URLSearchParams})}var rk=/^\d+$/;function ik(Q){if(Q==="")return[""];let X=Q.replace(/\[(.*?)\]/g,".$1"),Y=X.split("."),$=X.startsWith(".")?1:0;return Y.slice($).map((J)=>rk.test(J)?globalThis.Number(J):J)}function dz(Q){let X={},Y=new WeakSet;function $(J,Z,G){let W=Object.hasOwn(J,Z)?J[Z]:void 0;if(Y.has(W)&&Array.isArray(W)===G)return W;let H=G?[]:{};return Y.add(H),b(J,Z,H),H}return Q.forEach(([J,Z])=>{let G=ik(J),W=X;G.forEach((H,K)=>{let V=K===G.length-1;if(Array.isArray(W)&&H==="")if(V)W.push(Z);else{let _=G[K+1],q=typeof _==="number"||_==="",D=W.length;W=$(W,D,q)}else if(V){let _=Object.hasOwn(W,H);if(_&&Array.isArray(W[H]))W[H].push(Z);else if(_)b(W,H,[W[H],Z]);else b(W,H,Z)}else{let _=G[K+1];W=$(W,H,typeof _==="number"||_==="")}})}),X}function pz(Q){return(X)=>{let Y=[];function $(J,Z){if(Q(Z))Y.push([J,Z]);else if(Array.isArray(Z))if(Z.every(Q))Z.forEach((W)=>{Y.push([J,W])});else Z.forEach((W,H)=>{$(`${J}[${H}]`,W)});else if(typeof Z==="object"&&Z!==null)for(let[G,W]of Object.entries(Z))$(`${J}[${G}]`,W)}for(let[J,Z]of Object.entries(X))$(J,Z);return Y}}class PX{_tag="Middleware";decode;encode;constructor(Q,X){this.decode=Q,this.encode=X}flip(){return new PX(this.encode,this.decode)}}var wX="~effect/SchemaTransformation/Transformation";class z0{[wX]=wX;_tag="Transformation";decode;encode;constructor(Q,X){this.decode=Q,this.encode=X}flip(){return new z0(this.encode,this.decode)}compose(Q){return new z0(this.decode.compose(Q.decode),Q.encode.compose(this.encode))}}function nk(Q){return C(Q,wX)&&Q[wX]===wX}var O2=(Q)=>{if(nk(Q))return Q;return new z0(Q.decode,Q.encode)};function N8(Q){return new z0(c1(Q.decode),c1(Q.encode))}function h0(Q){return new z0(Y0(Q.decode),Y0(Q.encode))}function F2(Q){return new z0(D2(Q.decode),D2(Q.encode))}function fz(){return new z0(Az(),b8())}var ak=new z0(b8(),b8());function A5(){return ak}var C5=new z0(U2(),R9()),R2=new z0(Pz(),R9()),NG=new z0(zG(),Y0(H$)),cz=new z0(zG(),Y0((Q)=>Q.getTime())),uz=N8({decode:(Q)=>T8(bV(Q),{onNone:()=>p(new q0(R(Q),{message:`Invalid Duration string: ${Q}`})),onSome:f}),encode:(Q)=>f(globalThis.String(Q))}),lz=N8({decode:(Q)=>f(Y4(Q)),encode:(Q)=>T8(kV(Q),{onNone:()=>p(new q0(R(Q),{message:`Unable to encode ${Q} into a bigint`})),onSome:(X)=>f(X)})}),oz=h0({decode:(Q)=>G6(Q),encode:(Q)=>W6(Q)}),sk=(Q)=>j1(Q)&&typeof Q.message==="string",rz=(Q)=>{let Y=Object.hasOwn(Q,"cause")?Error(Q.message,{cause:nz(Q.cause)}):Error(Q.message);if(typeof Q.name==="string"&&Q.name!=="Error")Y.name=Q.name;if(typeof Q.stack==="string")Y.stack=Q.stack;return Y},tk=(Q)=>{try{let X=l6(Q);return X===void 0?P(Q):JSON.parse(X)}catch{return P(Q)}},ek=(Q,X,Y)=>{let $={name:Q.name,message:typeof Q.message==="string"?Q.message:""};if(X?.includeStack&&typeof Q.stack==="string")$.stack=Q.stack;if(!X?.excludeCause&&Q.cause!==void 0)$.cause=Y(Q.cause);return $},iz=(Q)=>{let X=new WeakSet,Y=($)=>{if(mK($)){if(X.has($))return"[Circular]";X.add($);let J=ek($,Q,Y);return X.delete($),J}return tk($)};return Y},nz=(Q)=>sk(Q)?rz(Q):Q,az=(Q)=>h0({decode:rz,encode:(X)=>iz(Q)(X)}),sz=(Q)=>h0({decode:nz,encode:iz(Q)});function tz(){return h0({decode:UV,encode:R$})}function ez(){return h0({decode:DV,encode:e6})}function QO(Q){return h0({decode:qV,encode:Q?.onNoneEncoding===null?R$:e6})}function XO(){return F2({decode:R,encode:i9})}function YO(){return F2({decode:(Q)=>Q.pipe(n9(_1),R),encode:i9})}var LG=N8({decode:(Q)=>URL.canParse(Q)?f(new URL(Q)):p(new q0(R(Q),{message:`Invalid URL string: ${Q}`})),encode:(Q)=>f(Q.href)}),MG=N8({decode:(Q)=>{let X=BB(Q);return I0(X)?p(new q0(R(Q),{message:`Invalid BigDecimal string: ${Q}`})):f(X.value)},encode:(Q)=>f(W4(Q))}),wG=new z0(Tz(),OG()),$O=new z0(Iz(),OG()),JO=new z0(Sz(),B2()),ZO=new z0(xz(),z2()),GO=new z0(kz(),bz()),WO=new z0(Cz(),jz()),HO=new z0(yz(),gz()),KO=new z0(hz(),mz()),VO=h0({decode:(Q)=>KX(Q),encode:(Q)=>Q.offset}),PG=N8({decode:(Q)=>{return T8(EB(Q),{onNone:()=>p(new q0(R(Q),{message:`Invalid IANA time zone: ${Q}`})),onSome:f})},encode:(Q)=>f(Q.id)}),AG=N8({decode:(Q)=>{return T8(SB(Q),{onNone:()=>p(new q0(R(Q),{message:`Invalid time zone: ${Q}`})),onSome:f})},encode:(Q)=>f(z6(Q))}),CG=N8({decode:(Q)=>{return T8(oY(Q),{onNone:()=>p(new q0(R(Q),{message:`Invalid UTC DateTime string: ${Q}`})),onSome:(X)=>f(rY(X))})},encode:(Q)=>f(xB(Q))}),jG=N8({decode:(Q)=>{return T8(IB(Q),{onNone:()=>p(new q0(R(Q),{message:`Invalid Zoned DateTime string: ${Q}`})),onSome:f})},encode:(Q)=>f(nY(Q))});function L9(Q){return(X)=>X._tag===Q}var M9=L9("Declaration");var Qy=L9("Never");var N2=L9("Literal"),Xy=L9("UniqueSymbol");var CX=L9("Arrays"),xG=L9("Objects"),jX=L9("Union");class m0{to;transformation;constructor(Q,X){this.to=Q,this.transformation=X}}var w9={};class y8{isOptional;isMutable;defaultValue;annotations;constructor(Q,X,Y=void 0,$=void 0){this.isOptional=Q,this.isMutable=X,this.defaultValue=Y,this.annotations=$}}var qO="~effect/Schema";class l0{[qO]=qO;annotations;checks;encoding;context;constructor(Q=void 0,X=void 0,Y=void 0,$=void 0){this.annotations=Q,this.checks=X,this.encoding=Y,this.context=$}toString(){return`<${this._tag}>`}}class P9 extends l0{_tag="Declaration";typeParameters;run;encodingChecks;constructor(Q,X,Y,$,J,Z,G){super(Y,$,J,Z);this.typeParameters=Q,this.run=X,this.encodingChecks=G}getParser(){let Q=this.run(this.typeParameters);return(X,Y)=>{if(I0(X))return v8;return B9(Q(X.value,this,Y),R)}}_rebuild(Q,X,Y){let $=j5(this.typeParameters,Q);return $===this.typeParameters&&X===this.checks&&Y===this.encodingChecks?this:new P9($,this.run,this.annotations,X,void 0,this.context,Y)}recur(Q){return this._rebuild(Q,this.checks,this.encodingChecks)}flip(Q){return this._rebuild(Q,this.encodingChecks,this.checks)}getExpected(){let Q=this.annotations?.expected;if(typeof Q==="string")return Q;return"<Declaration>"}}class RO extends l0{_tag="Null";getParser(){return k2(this,null)}getExpected(){return"null"}}var bG=new RO;class NO extends l0{_tag="Undefined";getParser(){return k2(this,void 0)}toCodecJson(){return L0(this,[LO])}getExpected(){return"undefined"}}var LO=new m0(bG,new z0(Y0(()=>{return}),Y0(()=>null))),MO=new NO;class wO extends l0{_tag="Void";getParser(){return Uy(void 0)}toCodecJson(){return L0(this,[LO])}getExpected(){return"void"}}var PO=new wO;class AO extends l0{_tag="Never";getParser(){return m8(this,hK)}getExpected(){return"never"}}var CO=new AO;class jO extends l0{_tag="Any";getParser(){return m8(this,s3)}getExpected(){return"any"}}var TO=new jO;class IO extends l0{_tag="Unknown";getParser(){return m8(this,s3)}getExpected(){return"unknown"}}var N9=new IO;class EO extends l0{_tag="ObjectKeyword";getParser(){return m8(this,t3)}getExpected(){return"object | array | function"}}var SO=new EO;class kG extends l0{_tag="Enum";enums;constructor(Q,X,Y,$,J){super(X,Y,$,J);this.enums=Q}getParser(){let Q=new Set(this.enums.map(([,X])=>X));return m8(this,(X)=>Q.has(X))}toCodecStringTree(){if(this.enums.some(([Q,X])=>typeof X==="number")){let Q=Object.fromEntries(this.enums.map(([X,Y])=>[globalThis.String(Y),Y]));return L0(this,[new m0(new u1(Object.keys(Q).map((X)=>new $8(X)),"anyOf"),new z0(Y0((X)=>Q[X]),R9()))])}return this}getExpected(){return this.enums.map(([Q,X])=>JSON.stringify(X)).join(" | ")}}function vO(Q){switch(Q._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return Q.checks===void 0;case"Union":return Q.checks===void 0&&Q.types.every(vO);default:return!1}}class yG extends l0{_tag="TemplateLiteral";parts;encodedParts;constructor(Q,X,Y,$,J){super(X,Y,$,J);let Z=[];for(let G of Q){let W=O1(G);if(vO(W))Z.push(W);else throw Error(`Invalid TemplateLiteral part ${W._tag}`)}this.parts=Q,this.encodedParts=Z}getParser(Q){let X=Q(this.asTemplateLiteralParser());return(Y,$)=>K1(X(Y,$),{onSuccess:()=>Y,onFailure:(J)=>new N0(this,Y,[J])})}getExpected(){return"string"}matchPart(Q,X){return FO(this.encodedParts,Q,X)===void 0?void 0:Q}asTemplateLiteralParser(){let Q=new g8(!1,this.parts.map(XF),[]);return b2(L6,Q,new z0(c1((X,Y)=>{let $=FO(this.encodedParts,X,Y);if($!==void 0)return f($);return p(new q0(R(X),{message:`Expected a string matching template literal parts, got ${P(X)}`}))}),Y0((X)=>X.join(""))))}}class gG extends l0{_tag="UniqueSymbol";symbol;constructor(Q,X,Y,$,J){super(X,Y,$,J);this.symbol=Q}getParser(){return k2(this,this.symbol)}toCodecStringTree(){return L0(this,[JF])}getExpected(){return globalThis.String(this.symbol)}}class $8 extends l0{_tag="Literal";literal;constructor(Q,X,Y,$,J){super(X,Y,$,J);if(typeof Q==="number"&&!globalThis.Number.isFinite(Q))throw Error(`A numeric literal must be finite, got ${P(Q)}`);this.literal=Q}getParser(){return k2(this,this.literal)}matchPart(Q,X){return Q===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?DO(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:DO(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}}function DO(Q){let X=globalThis.String(Q.literal);return L0(Q,[new m0(new $8(X),new z0(Y0(()=>Q.literal),Y0(()=>X)))])}class xO extends l0{_tag="String";getParser(){return m8(this,C8)}matchPart(Q,X){return y2(this,Q,X)}getExpected(){return"string"}}var L6=new xO;class bO extends l0{_tag="Number";getParser(){return m8(this,ZQ)}matchKey(Q,X){return this._match(By,Q,X)}matchPart(Q,X){return this._match(EG,Q,X)}_match(Q,X,Y){return Q.test(X)?y2(this,globalThis.Number(X),Y):void 0}toCodecJson(){if(this.checks&&(TG(this.checks,"effect/schema/isFinite")||TG(this.checks,"effect/schema/isInt")))return this;return L0(this,[Yy(this.checks)])}toCodecStringTree(){if(this.toCodecJson()===this)return L0(this,[zy]);return L0(this,[Oy])}getExpected(){return"number"}}function TG(Q,X){return Q.some((Y)=>Y.annotations?.representation?.id===X||Y._tag==="FilterGroup"&&TG(Y.checks,X))}function Yy(Q){let X=Q===void 0?M2:h8(M2,Q);return new m0(new u1([X,uO],"anyOf"),new z0(U2(),Y0((Y)=>globalThis.Number.isFinite(Y)?Y:globalThis.String(Y))))}var hG=new bO;class kO extends l0{_tag="Boolean";getParser(){return m8(this,kK)}getExpected(){return"boolean"}}var yO=new kO;class gO extends l0{_tag="Symbol";getParser(){return m8(this,a3)}matchKey(Q,X){return y2(this,Q,X)}toCodecStringTree(){return L0(this,[JF])}getExpected(){return"symbol"}}var hO=new gO;class mO extends l0{_tag="BigInt";getParser(){return m8(this,yK)}matchPart(Q,X){return SG.test(Q)?y2(this,globalThis.BigInt(Q),X):void 0}toCodecStringTree(){return L0(this,[Ry])}getExpected(){return"bigint"}}var dO=new mO;class g8 extends l0{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(Q,X,Y,$,J,Z,G,W){super($,J,Z,G);this.isMutable=Q,this.elements=X,this.rest=Y,this.encodingChecks=W;let H=X.findIndex(f0);if(H!==-1&&(X.slice(H+1).some((K)=>!f0(K))||Y.length>1))throw Error("A required element cannot follow an optional element. ts(1257)");if(Y.length>1&&Y.slice(1).some(f0))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(Q){let X=this,Y=X.elements.map((K)=>({ast:K,parser:Q(K)})),$=X.rest.map((K)=>({ast:K,parser:Q(K)})),J=Y.length,[Z,...G]=$,W=G.length;function H(K,V){if(V<J)return Y[V];else if(V>=K)return G[V-K];return Z}return GX(function*(K,V){if(K._tag==="None")return K;let _=K.value;if(!Array.isArray(_))return yield*p(new u0(X,K));let q=_.length,D={ast:X,getParser:H,oinput:K,len:q,tailThreshold:Jy(q,J,W),output:new globalThis.Array(q),issues:void 0,options:V},B=mG(V?.concurrency),F=$y(D,_,{concurrency:B?.concurrency,end:X.rest.length===0?J:Math.max(q,J+W)});if(F)yield*F;if(X.rest.length===0&&q>J)for(let N=J;N<=q-1;N++){let M=new S0([N],new V2(X,_[N]));if(V.errors==="all")if(D.issues)D.issues.push(M);else D.issues=[M];else return yield*p(new N0(X,K,[M]))}if(D.issues)return yield*p(new N0(X,K,D.issues));return R(D.output)})}_rebuild(Q,X,Y){let $=j5(this.elements,Q),J=j5(this.rest,Q);return $===this.elements&&J===this.rest&&X===this.checks&&Y===this.encodingChecks?this:new g8(this.isMutable,$,J,this.annotations,X,void 0,this.context,Y)}recur(Q){return this._rebuild(Q,this.checks,this.encodingChecks)}flip(Q){return this._rebuild(Q,this.encodingChecks,this.checks)}getExpected(){return"array"}}var $y=mQ()({onItem(Q,X,Y){let $=Y<Q.len?R(X):d();return Q.getParser(Q.tailThreshold,Y).parser($,Q.options)},step(Q,X,Y,$){if(Y._tag==="Failure")return L2(Q,Q.ast,$,Y);else if(Y.value._tag==="Some")Q.output[$]=Y.value.value;else{let J=Q.getParser(Q.tailThreshold,$);if(f0(J.ast))return;let Z=new S0([$],new LX(J.ast.context?.annotations));if(Q.options.errors==="all")if(Q.issues)Q.issues.push(Z);else Q.issues=[Z];else return q5(new N0(Q.ast,Q.oinput,[Z]))}}});function Jy(Q,X,Y){return Math.max(X,Q-Y)}var mG=(Q)=>{return Q=Q==="unbounded"?1/0:Q??1,Q>1?{concurrency:Q}:void 0},L2=(Q,X,Y,$)=>{if($.cause.reasons.length===0)return $;let J=q2($.cause);if(J===void 0)return v4(Z4($.cause,(G)=>new N0(X,Q.oinput,[new S0([Y],G)])));let Z=new S0([Y],J);if(Q.options.errors==="all")if(Q.issues)Q.issues.push(Z);else Q.issues=[Z];else return q5(new N0(X,Q.oinput,[Z]))},w2="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function I5(Q,X,Y=w9){let $,J;function Z(G){switch(G._tag){case"String":case"TemplateLiteral":return($??=Object.keys(Q)).filter((W)=>G.matchPart(W,Y)!==void 0);case"Number":return($??=Object.keys(Q)).filter((W)=>G.matchKey(W,Y)!==void 0);case"Symbol":return(J??=Object.getOwnPropertySymbols(Q)).filter((W)=>G.matchKey(W,Y)!==void 0);case"Union":return[...new Set(G.types.flatMap(Z))];default:return[]}}return Z(oG(O1(X)))}class P2{name;type;constructor(Q,X){this.name=Q,this.type=X}}class A2{decode;encode;constructor(Q,X){this.decode=Q,this.encode=X}flip(){return new A2(this.encode,this.decode)}}function IG(Q){switch(Q._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return Q.types.every(IG);default:return!1}}function Zy(Q){return IG(Q)&&IG(O1(Q))}class C2{parameter;type;merge;constructor(Q,X,Y){if(!Zy(Q))throw Error(`Invalid index signature parameter ${Q._tag}`);if(this.parameter=Q,this.type=X,this.merge=Y,f0(X)&&!eO(X))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class E5 extends l0{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(Q,X,Y,$,J,Z,G){super(Y,$,J,Z);this.propertySignatures=Q,this.indexSignatures=X,this.encodingChecks=G;let W=Q.map((H)=>H.name).filter((H,K,V)=>V.indexOf(H)!==K);if(W.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(W)}. ts(2300)`)}getParser(Q){let X=this,Y=[],$=new Set,J=[];for(let W of X.propertySignatures)Y.push(W.name),$.add(W.name),J.push({ps:W,parser:Q(W.type),name:W.name,type:W.type});let Z=X.indexSignatures.length;if(X.propertySignatures.length===0&&X.indexSignatures.length===0)return m8(X,R7);let G=Z>0?mQ()({onItem:GX(function*(W,[H,K]){let _=Q(oG(K.parameter))(R(H),W.options),q=w1(_)?_:yield*ZX(_);if(q._tag==="Failure"){let M=L2(W,X,H,q);if(M)yield*M;return}let D=R(W.input[H]),F=Q(K.type)(D,W.options),N=w1(F)?F:yield*ZX(F);if(N._tag==="Failure"){let M=L2(W,X,H,N);if(M)yield*M;return}else if(q.value._tag==="Some"&&N.value._tag==="Some"){let M=q.value.value;if($.has(H)||$.has(M))return;let w=N.value.value;if(K.merge&&K.merge.decode&&Object.hasOwn(W.out,M)){let[A,s]=K.merge.decode.combine([M,W.out[M]],[M,w]);b(W.out,A,s)}else b(W.out,M,w)}}),step:(W,H,K)=>K._tag==="Failure"?K:void 0}):void 0;return GX(function*(W,H){if(W._tag==="None")return W;let K=W.value;if(!(typeof K==="object"&&K!==null&&!Array.isArray(K)))return yield*p(new u0(X,W));let V={},_={ast:X,oinput:W,input:K,out:V,issues:void 0,options:H},q=H.errors==="all",D=H.onExcessProperty==="error",B=H.onExcessProperty==="preserve",F;if(X.indexSignatures.length===0&&(D||B)){F=Reflect.ownKeys(K);for(let w=0;w<F.length;w++){let A=F[w];if(!$.has(A))if(D){let s=new S0([A],new V2(X,K[A]));if(q){if(_.issues)_.issues.push(s);else _.issues=[s];continue}else return yield*p(new N0(X,W,[s]))}else b(V,A,K[A])}}let N=mG(H?.concurrency),M=Gy(_,J,N);if(M)yield*M;if(G){let w=u7();for(let s=0;s<Z;s++){let L=X.indexSignatures[s],x=I5(K,L.parameter,H);for(let I=0;I<x.length;I++){let W0=x[I];w.push([W0,L])}}let A=G(_,w,N);if(A)yield*A}if(_.issues)return yield*p(new N0(X,W,_.issues));if(H.propertyOrder==="original"){let w=(F??Reflect.ownKeys(K)).concat(Y),A={};for(let s of w)if(Object.hasOwn(V,s))b(A,s,V[s]);return R(A)}return R(V)})}_rebuild(Q,X,Y,$,J){let Z=j5(this.propertySignatures,(W)=>{let H=Q(W.type);return H===W.type?W:new P2(W.name,H)}),G=j5(this.indexSignatures,(W)=>{let H=X(W.parameter),K=Q(W.type),V=Y?W.merge?.flip():W.merge;return H===W.parameter&&K===W.type&&V===W.merge?W:new C2(H,K,V)});return Z===this.propertySignatures&&G===this.indexSignatures&&$===this.checks&&J===this.encodingChecks?this:new E5(Z,G,this.annotations,$,void 0,this.context,J)}flip(Q){return this._rebuild(Q,Q,!0,this.encodingChecks,this.checks)}recur(Q,X=Q){return this._rebuild(Q,X,!1,this.checks,this.encodingChecks)}getExpected(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}}var Gy=mQ()({onItem(Q,X){let Y=Object.hasOwn(Q.input,X.name)?R(Q.input[X.name]):d();return X.parser(Y,Q.options)},step(Q,X,Y){if(Y._tag==="Failure")return L2(Q,Q.ast,X.name,Y);else if(Y.value._tag==="Some")b(Q.out,X.name,Y.value.value);else if(!f0(X.type)){let $=new S0([X.name],new LX(X.type.context?.annotations));if(Q.options.errors==="all"){if(Q.issues)Q.issues.push($);else Q.issues=[$];return}else return q5(new N0(Q.ast,Q.oinput,[$]))}}});function dG(Q,X){if(!Q)return X;if(!X)return Q;return[...Q,...X]}function j2(Q,X,Y){return new E5(Reflect.ownKeys(Q).map(($)=>{return new P2($,Q[$].ast)}),[],Y,X)}function TX(Q){return Q.ast}function pG(Q,X=void 0){return new g8(!1,Q.map((Y)=>Y.ast),[],void 0,X)}function T2(Q,X,Y){return new u1(Q.map(TX),X,void 0,Y)}function pO(Q,X){if(Q.encoding||X.some((Z)=>Z.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:Y,indexSignatures:$,checks:J}=Q;for(let Z of X)Y=Y.concat(Z.propertySignatures),$=$.concat(Z.indexSignatures),J=dG(J,Z.checks);return new E5(Y,$,void 0,J)}function fO(Q,X){if(Q.encoding)throw Error("TupleWithRest does not support encodings");return new g8(Q.isMutable,Q.elements,X,void 0,Q.checks)}function cO(Q){switch(Q._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 Q.propertySignatures.length||Q.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(Q.enums.map(([,X])=>typeof X)));case"Literal":return[typeof Q.literal];case"Union":return Array.from(new Set(Q.types.flatMap(cO)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function IX(Q){switch(Q._tag){default:return[];case"Declaration":{let X=Q.annotations?.[OX];return Array.isArray(X)?X:[]}case"Objects":return Q.propertySignatures.flatMap((X)=>{let Y=X.type;if(!f0(Y)){if(N2(Y))return[{key:X.name,literal:Y.literal}];if(Xy(Y))return[{key:X.name,literal:Y.symbol}]}return[]});case"Arrays":return Q.elements.flatMap((X,Y)=>{return N2(X)&&!f0(X)?[{key:Y,literal:X.literal}]:[]});case"Suspend":return IX(Q.thunk())}}var UO=new WeakMap;function Wy(Q){let X=UO.get(Q);if(X)return X;X={};for(let Y=0;Y<Q.length;Y++){let $=Q[Y],J=O1($);if(Qy(J))continue;let Z=cO(J),G=IX(J);X.byType??={};for(let W of Z)(X.byType[W]??=[]).push(Y);if(G.length>0){X.bySentinel??=new Map;for(let{key:W,literal:H}of G){let K=X.bySentinel.get(W);if(!K)X.bySentinel.set(W,K=new Map);let V=K.get(H);if(!V)K.set(H,V=[]);V.push(Y)}}else{X.otherwise??={};for(let W of Z)(X.otherwise[W]??=[]).push(Y)}}return UO.set(Q,X),X}function BO(Q){return(X)=>{let Y=O1(X);return Y._tag==="Literal"?Y.literal===Q:Y._tag==="UniqueSymbol"?Y.symbol===Q:!0}}function EX(Q,X){let Y=Wy(X),$=Q===null?"null":Array.isArray(Q)?"array":typeof Q;if(Y.bySentinel){let J=Y.otherwise?.[$]??[];if($==="object"||$==="array"){let Z=new Set(J);for(let[G,W]of Y.bySentinel)if(Object.hasOwn(Q,G)){let H=W.get(Q[G]);if(H)for(let K of H)Z.add(K)}return Array.from(Z).sort((G,W)=>G-W).map((G)=>X[G]).filter(BO(Q))}return J.map((Z)=>X[Z])}return(Y.byType?.[$]??[]).map((J)=>X[J]).filter(BO(Q))}class u1 extends l0{_tag="Union";types;mode;encodingChecks;constructor(Q,X,Y,$,J,Z,G){super(Y,$,J,Z);this.types=Q,this.mode=X,this.encodingChecks=G}getParser(Q){let X=this;return(Y,$)=>{if(Y._tag==="None")return f(Y);let J=Y.value,Z=EX(J,X.types),G={ast:X,recur:Q,oinput:Y,input:J,out:void 0,successes:[],issues:void 0,options:$},W=mG($?.concurrency),H=Hy(G,Z,W?{...W,orderedStep:!0}:void 0);if(!H)return G.out?f(G.out):p(new _2(X,J,G.issues??[]));return JX(H,(K)=>{return G.out?f(G.out):p(new _2(X,J,G.issues??[]))})}}_rebuild(Q,X,Y){let $=j5(this.types,Q);return $===this.types&&X===this.checks&&Y===this.encodingChecks?this:new u1($,this.mode,this.annotations,X,void 0,this.context,Y)}recur(Q){return this._rebuild(Q,this.checks,this.encodingChecks)}flip(Q){return this._rebuild(Q,this.encodingChecks,this.checks)}matchPart(Q,X){for(let Y of this.types){let $=Y.matchPart(Q,X);if($!==void 0)return $}return}getExpected(Q){let X=this.annotations?.expected;if(typeof X==="string")return X;if(this.types.length===0)return"never";let Y=this.types.map(($)=>{let J=O1($);switch(J._tag){case"Arrays":{let Z=J.elements.filter(N2);if(Z.length>0)return`${zO(J.isMutable)}[ ${Z.map((G)=>Q(G)+OO(G.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let Z=J.propertySignatures.filter((G)=>N2(G.type));if(Z.length>0)return`{ ${Z.map((G)=>`${zO(G.type.context?.isMutable)}${O4(G.name)}${OO(G.type.context?.isOptional)}: ${Q(G.type)}`).join(", ")}, ... }`;break}}return Q(J)});return Array.from(new Set(Y)).join(" | ")}}var Hy=mQ()({onItem(Q,X){return Q.recur(X)(Q.oinput,Q.options)},step(Q,X,Y){if(Y._tag==="Failure"){let $=q2(Y.cause);if($===void 0)return Y;if(Q.issues)Q.issues.push($);else Q.issues=[$]}else{if(Q.out&&Q.ast.mode==="oneOf")return Q.successes.push(X),q5(new qG(Q.ast,Q.input,Q.successes));if(Q.out=Y.value,Q.successes.push(X),Q.ast.mode==="anyOf")return aJ}}}),uO=new u1([new $8("Infinity"),new $8("-Infinity"),new $8("NaN")],"anyOf");function zO(Q){return Q?"":"readonly "}function OO(Q){return Q?"?":""}function A9(Q){let X=!1,Y;return()=>{if(X)return Y;return Y=Q(),X=!0,Y}}class I2 extends l0{_tag="Suspend";thunk;constructor(Q,X,Y,$,J){if(Y!==void 0)throw Error("Cannot add checks to Suspend");super(X,void 0,$,J);this.thunk=A9(Q)}getParser(Q){return Q(this.thunk())}recur(Q){return new I2(()=>Q(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(Q){return Q(this.thunk())}}class AX extends f6{_tag="Filter";run;annotations;aborted;constructor(Q,X=void 0,Y=!1){super();this.run=Q,this.annotations=X,this.aborted=Y}annotate(Q){return new AX(this.run,{...this.annotations,...Q},this.aborted)}abort(){return new AX(this.run,this.annotations,!0)}and(Q,X){return new N6([this,Q],X)}}class N6 extends f6{_tag="FilterGroup";checks;annotations;constructor(Q,X=void 0){super();this.checks=Q,this.annotations=X}annotate(Q){return new N6(this.checks,{...this.annotations,...Q})}and(Q,X){return new N6([this,Q],X)}}function E2(Q,X,Y=!1){return new AX(($,J,Z)=>zz($,J,Q($,J,Z)),X,Y)}function S2(Q,X){return new AX((Y)=>Q(Y)?void 0:new q0(R(Y)),X,!0)}function fG(Q){return E2((X)=>globalThis.Number.isFinite(X),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...Q})}var M2=h8(hG,[fG()]);function SX(Q,X){let Y=Q.source;return E2(($)=>Q.test($),{expected:`a string matching the RegExp ${Y}`,representation:{id:"effect/schema/isPattern",payload:{source:Y,flags:Q.flags}},toJsonSchema:()=>({pattern:Y}),arbitrary:{constraint:{patterns:[Q.source]}},...X})}function vX(Q,X){let Y=Object.getOwnPropertyDescriptors(Q);return X(Y),Object.create(Object.getPrototypeOf(Q),Y)}function L0(Q,X){if(Q.encoding===X)return Q;return vX(Q,(Y)=>{Y.encoding.value=X})}function xX(Q,X){if(Q.context===X)return Q;return vX(Q,(Y)=>{Y.context.value=X})}function M6(Q){return Q.encoding?M6(Q.encoding[Q.encoding.length-1].to):Q}function V4(Q,X){if(Q.checks){let Y=Q.checks[Q.checks.length-1];return v2(Q,c7(Q.checks.slice(0,-1),Y.annotate(X)))}return vX(Q,(Y)=>{Y.annotations.value={...Y.annotations.value,...X}})}function v2(Q,X){if(Q._tag==="Suspend"&&X!==void 0)throw Error("Cannot add checks to Suspend");if(Q.checks===X)return Q;return vX(Q,(Y)=>{Y.checks.value=X})}function h8(Q,X){return v2(Q,dG(Q.checks,X))}function w6(Q,X){let Y=X(Q.to);return Y===Q.to?Q:new m0(Y,Q.transformation)}function lO(Q,X){let Y=Q,$=Y[Y.length-1],J=w6($,X);return J===$?Q:c7(Q.slice(0,Q.length-1),J)}function cG(Q){return(X)=>X.encoding?L0(X,lO(X.encoding,Q)):X}function x2(Q,X){return cG((Y)=>xX(Y,X))(Q)}function P6(Q){function X(Y){return Y.encoding?L0(Y,lO(Y.encoding,X)):Q(Y)}return s0(X)}function oO(Q,X){return uG(Q,X,z1(Q))}function rO(Q,X){return uG(O1(Q),X,Q)}function uG(Q,X,Y){let $=new m0(Q,X);return L0(Y,Y.encoding?[...Y.encoding,$]:[$])}function iO(Q,X){let Y=Hz(Q),$=Y?[...Y,X]:[X];return V4(Q,{brands:$})}function j5(Q,X){let Y=!1,$=Array(Q.length);for(let J=0;J<Q.length;J++){let Z=Q[J],G=X(Z);if(G!==Z)Y=!0;$[J]=G}return Y?$:Q}function bX(Q,X){let Y=Q.context?new y8(Q.context.isOptional,Q.context.isMutable,Q.context.defaultValue,{...Q.context.annotations,...X}):new y8(!1,!1,void 0,X);return xX(Q,Y)}var Ky=cG(kX);function kX(Q){let X=Q.context?Q.context.isOptional===!1?new y8(!0,Q.context.isMutable,Q.context.defaultValue,Q.context.annotations):Q.context:new y8(!0,!1);return Ky(xX(Q,X))}var Vy=cG(lG);function lG(Q){let X=Q.context?Q.context.isMutable===!1?new y8(Q.context.isOptional,!0,Q.context.defaultValue,Q.context.annotations):Q.context:new y8(!1,!0);return Vy(xX(Q,X))}function nO(Q,X){let Y=new z0(MX(X),b8()),$=[new m0(N9,Y)],J=Q.context?new y8(Q.context.isOptional,Q.context.isMutable,$,Q.context.annotations):new y8(!1,!1,$);return xX(Q,J)}function b2(Q,X,Y){return uG(Q,Y,X)}function _y(Q){let X=[],Y=[];function $(J){switch(J._tag){case"Literal":if(F7(J.literal))X.push(J.literal);return;case"UniqueSymbol":X.push(J.symbol);return;case"Never":return;case"Union":for(let Z=0;Z<J.types.length;Z++)$(J.types[Z]);return;default:Y.push(J)}}return $(Q),{literals:X,parameters:Y}}function aO(Q,X,Y){let{literals:$,parameters:J}=_y(Q);return new E5($.map((Z)=>new P2(Z,X)),J.map((Z)=>new C2(Z,X,Y)))}function f0(Q){return Q.context?.isOptional??!1}function sO(Q){return Q.context?.isMutable??!1}function tO(Q){return Q.annotations?.[f1]===!0||Q._tag==="FilterGroup"&&Q.checks.every(tO)}function qy(Q){function X($){if(tO($))return[$];return $._tag==="FilterGroup"?$.checks.flatMap(X):[]}let Y=Q.flatMap(X);return e8(Y)?Y:void 0}var z1=s0((Q)=>{if(Q.encoding)return z1(L0(Q,void 0));let X=Q,Y=X.recur?.(z1)??X,$=Y.encodingChecks;if($){let J=Y===Q?$:CX(Y)||xG(Y)||M9(Y)&&Y.typeParameters.length>0?qy($):void 0;return vX(Y,(Z)=>{Z.encodingChecks.value=void 0,Z.checks.value=dG(Y.checks,J)})}return Y}),O1=s0((Q)=>{return z1(k8(Q))});function Dy(Q,X){let Y=X,$=Y.length,J=Y[$-1],Z=[new m0(k8(L0(Q,void 0)),Y[0].transformation.flip())];for(let W=1;W<$;W++)Z.unshift(new m0(k8(Y[W-1].to),Y[W].transformation.flip()));let G=k8(J.to);if(G.encoding)return L0(G,[...G.encoding,...Z]);else return L0(G,Z)}var k8=s0((Q)=>{if(Q.encoding)return Dy(Q,Q.encoding);let X=Q;return X.flip?.(k8)??X.recur?.(k8)??X});function eO(Q){switch(Q._tag){case"Undefined":return!0;case"Union":return Q.types.some(eO);default:return!1}}function k2(Q,X){let Y=$X(X);return($)=>{if($._tag==="None")return v8;return $.value===X?Y:p(new u0(Q,$))}}function Uy(Q){let X=$X(Q);return(Y)=>Y._tag==="None"?v8:X}function m8(Q,X){return(Y)=>{if(Y._tag==="None")return v8;return X(Y.value)?f(Y):p(new u0(Q,Y))}}function y2(Q,X,Y){if(Y?.disableChecks||Q.checks===void 0)return X;let $=[];return S5(Q.checks,X,$,Q,Y),$.length===0?X:void 0}function FO(Q,X,Y){let $=Q.map((H)=>H._tag==="Literal"?globalThis.String(H.literal):void 0);if($.some((H)=>H!==void 0&&!X.includes(H)))return;let J=Array(Q.length+1);J[Q.length]=0;for(let H=Q.length-1;H>=0;H--)J[H]=J[H+1]+($[H]?.length??0);if(J[0]>X.length)return;let Z=Array(Q.length),G=Q.map(()=>new Set);function W(H,K){if(H===Q.length)return K===X.length;if(G[H].has(K))return!1;let V=Q[H];if(H===Q.length-1){let _=X.slice(K);if(V.matchPart(_,Y)!==void 0)return Z[H]=_,!0}else if(V._tag==="Literal"){let _=$[H];if(X.startsWith(_,K)&&W(H+1,K+_.length))return Z[H]=_,!0}else{let _=X.length-J[H+1],q=$[H+1],D=q===void 0?_:X.lastIndexOf(q,_);while(D>=K){let B=X.slice(K,D);if(V.matchPart(B,Y)!==void 0&&W(H+1,D))return Z[H]=B,!0;if(D===0)break;D=q===void 0?D-1:X.lastIndexOf(q,D-1)}}return G[H].add(K),!1}return W(0,0)?Z:void 0}var QF=s0((Q)=>{return new u1(Q.enums.map((X)=>new $8(X[1],{title:X[0]})),"anyOf")}),oG=P6((Q)=>{switch(Q._tag){default:return Q;case"Number":return Q.toCodecStringTree();case"Union":return Q.recur(oG)}}),g2=P6((Q)=>{switch(Q._tag){default:return Q;case"Symbol":case"UniqueSymbol":return Q.toCodecStringTree();case"Union":return Q.recur(g2)}}),XF=P6((Q)=>{switch(Q._tag){default:return Q;case"Number":case"Literal":case"BigInt":return Q.toCodecStringTree();case"Union":return Q.recur(XF)}}),YF="[\\s\\S]*?",EG=new globalThis.RegExp(`^${w2}$`),By=new globalThis.RegExp(`^(?:${w2}|Infinity|-Infinity|NaN)$`);function rG(Q){return SX(EG,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:EG.source}),...Q})}var $F=h8(L6,[rG()]),zy=new m0($F,C5),Oy=new m0(new u1([$F,uO],"anyOf"),C5),Fy="-?\\d+",SG=new globalThis.RegExp(`^${Fy}$`);function iG(Q){return SX(SG,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:SG.source}),...Q})}var nG=h8(L6,[iG({expected:"a string representing a bigint"})]),Ry=new m0(nG,R2),Ny="Symbol\\((.*)\\)",vG=new globalThis.RegExp(`^${Ny}$`),Ly=h8(L6,[aG()]),JF=new m0(Ly,new z0(Y0((Q)=>globalThis.Symbol.for(vG.exec(Q)[1])),c1((Q)=>{if(globalThis.Symbol.keyFor(Q)!==void 0)return f(globalThis.String(Q));return p(new w5(R(Q),{message:"cannot serialize to string, Symbol is not registered"}))})));function aG(Q){return SX(vG,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:vG.source}),...Q})}function S5(Q,X,Y,$,J){for(let Z=0;Z<Q.length;Z++){let G=Q[Z];if(G._tag==="FilterGroup")S5(G.checks,X,Y,$,J);else{let W=G.run(X,$,J);if(W){if(Y.push(new K2(X,G,W)),G.aborted||J?.errors!=="all")return}}}}function ZF(Q,X){let Y=[];if(S5(Q,X,Y,N9,{errors:"all"}),e8(Y)){let $=new N0(N9,R(X),Y);return i($)}return t(X)}var h2="~effect/Schema/Class";function My(Q){return Q===null||typeof Q==="string"||typeof Q==="boolean"||typeof Q==="number"&&globalThis.Number.isFinite(Q)}function wy(Q){return Q===void 0||typeof Q==="string"}function GF(Q,X){let Y=new WeakMap,$=[];Q:while(!0){if(typeof Q!=="object"||Q===null){if(!X(Q))return!1}else{let J=Q,Z=Y.get(J);if(Z===!1)return!1;if(Z===void 0){let G=Array.isArray(J);if(!G){let W=Object.getPrototypeOf(J);if(W!==null&&W!==Object.prototype&&Object.getPrototypeOf(W)!==null)return!1}Y.set(J,!1),$.push({value:J,keys:G?J.length:Object.keys(J),index:0})}}while($.length>0){let J=$[$.length-1],Z=J.keys;if(typeof Z==="number"){if(J.index<Z){Q=J.value[J.index++];continue Q}}else if(J.index<Z.length){Q=J.value[Z[J.index++]];continue Q}Y.set(J.value,!0),$.pop()}return!0}}function v5(Q){return GF(Q,My)}var T5=new P9([],()=>(Q,X)=>v5(Q)?f(Q):p(new u0(X,R(Q))),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>tG,toArbitrary:()=>(Q)=>Q.jsonValue()}),WF=V4(T5,{representation:{id:"effect/schema/MutableJson",payload:null}}),sG=new m0(T5,A5()),HF=new m0(new u1([new g8(!1,[],[T5]),new E5([],[new C2(L6,T5,void 0)])],"anyOf"),A5());function Py(Q){return GF(Q,wy)}var Ay=new P9([],()=>(Q,X)=>Py(Q)?f(Q):p(new u0(X,R(Q))),{expected:"StringTree",toCodecStringTree:()=>{return}}),tG=new m0(Ay,A5());var yX="~effect/SchemaError/SchemaError";class C6 extends SY("SchemaError"){[yX]=yX;constructor(Q){super({issue:Q})}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}}function eG(Q){return C(Q,yX)&&Q[yX]===yX}var gX=s0((Q)=>{switch(Q._tag){case"Declaration":{let X=Q.annotations?.[h2];if(r1(X)){let Y=X(Q.typeParameters);return L0(Q,[w6(Y,gX)])}return Q}case"Objects":case"Arrays":return Q.recur((X)=>{let Y=X.context?.defaultValue;if(Y){let $=gX(X);return L0($,$.encoding?[...$.encoding,...Y]:Y)}return gX(X)});case"Suspend":return Q.recur(gX);default:return Q}});function d2(Q){let X=gX(z1(Q.ast)),Y=b5(X);return($,J)=>{return Y($,J?.disableChecks?J?.parseOptions?{...J.parseOptions,disableChecks:!0}:{disableChecks:!0}:J?.parseOptions)}}function p2(Q){let X=d2(Q);return(Y,$)=>{let J=U6(X(Y,$));if(Y1(J))return R(J.value);return m4(J.cause,"Option adapter can only return none for schema issues"),d()}}function KF(Q){let X=d2(Q);return(Y,$)=>{let J=U6(X(Y,$));if(Y1(J))return J.value;let Z=m4(J.cause,"Constructor adapter can only throw schema issues");throw Error(Z.toString(),{cause:Z})}}function VF(Q){return hX(Q.ast)}function hX(Q){let X=C9(b5(z1(Q)));return(Y)=>{let $=X(Y,w9);if(Y1($))return!0;return m4($.cause,"Type guard adapter can only return false for schema issues"),!1}}function _F(Q){let X=b5(Q);return(Y,$)=>{let J=U6(X(Y,$));if(Y1(J))return;return m4(J.cause,"Issue adapter can only return schema issues")}}function qF(Q,X){let $=C9(b5(z1(Q.ast)))(X,w9);if(sJ($)){let J=m4($.cause,"Assertion adapter can only throw schema issues");throw Error(J.toString(),{cause:J})}}function i0(Q,X){let Y=b5(Q.ast);return X===void 0?Y:($,J)=>Y($,RF(X,J))}var QW=i0;function DF(Q,X){return C9(i0(Q,X))}function XW(Q,X){return NF(i0(Q,X))}var UF=XW;function BF(Q,X){return LF(i0(Q,X))}function Cy(Q,X){return MF(i0(Q,X))}var YW=Cy;function x5(Q,X){let Y=b5(k8(Q.ast));return X===void 0?Y:($,J)=>Y($,RF(X,J))}function zF(Q,X){return C9(x5(Q,X))}function $W(Q,X){return NF(x5(Q,X))}var OF=$W;function FF(Q,X){return LF(x5(Q,X))}function jy(Q,X){return MF(x5(Q,X))}var JW=jy,RF=(Q,X)=>X===void 0?Q:{...Q,...X};function b5(Q){let X=m2(Q);return(Y,$)=>F8(X(R(Y),$??w9),(J)=>{if(J._tag==="None")return p(new q0(J));return f(J.value)})}function C9(Q){return(X,Y)=>U6(Q(X,Y))}function NF(Q){let X=C9(Q);return(Y,$)=>{let J=X(Y,$);if(Y1(J))return R(J.value);return m4(J.cause,"Option adapter can only return none for schema issues"),d()}}function LF(Q){let X=C9(Q);return(Y,$)=>{let J=X(Y,$);if(Y1(J))return t(J.value);return i(m4(J.cause,"Result adapter can only return schema issues"))}}function MF(Q){let X=C9(Q);return(Y,$)=>{let J=X(Y,$);if(Y1(J))return J.value;let Z=m4(J.cause,"Sync adapter can only throw schema issues");throw Error(Z.toString(),{cause:Z})}}function Ty(Q,X){return U9(Q,(Y)=>D9(()=>Z4(Y,X)))}var m2=s0((Q)=>{let X,Y=Q.checks,$=Q.encoding,J=$,Z=J?.length??0,G=Q.encodingChecks,W=(Y?Y[Y.length-1].annotations:Q.annotations)?.parseOptions;if(!Q.context&&!$&&!Y&&!G)return(H,K)=>{if(X??=Q.getParser(m2),W)K={...K,...W};return X(H,K)};return(H,K)=>{if(W)K={...K,...W};let V;if(J){for(let D=Z-1;D>=0;D--){let B=J[D],F=B.to,N=m2(F);if(V=V?F8(V,(M)=>N(M,K)):N(H,K),B.transformation._tag==="Transformation"){let M=B.transformation.decode;V=F8(V,(w)=>M.run(w,K))}else V=B.transformation.decode(V,K)}V=Ty(V,(D)=>new _G(Q,H,D))}X??=Q.getParser(m2);let _=(D)=>{let B=X(D,K);if(G&&!K?.disableChecks)B=F8(B,(F)=>{if(L1(D)&&L1(F)){let N=[];if(S5(G,D.value,N,Q,K),e8(N))return p(new N0(Q,D,N))}return f(F)});if(Y&&!K?.disableChecks)B=F8(B,(F)=>{if(L1(F)){let N=F.value,M=[];if(S5(Y,N,M,Q,K),e8(M))return p(new N0(Q,F,M))}return f(F)});return B};return V?F8(V,_):_(H)}});var f2="~effect/Schema/Schema";function l1(Q,X,Y){return{id:Q,payloadSchema:X,revive:Y}}function a(Q,X,Y){return{id:Q,payloadSchema:X,revive:Y}}var Iy={[f2]:f2,pipe(){return H0(this,arguments)},annotate(Q){return this.rebuild(V4(this.ast,Q))},annotateKey(Q){return this.rebuild(bX(this.ast,Q))},check(...Q){return this.rebuild(h8(this.ast,Q))}};function mX(Q,X){function Y(){}let $=Object.defineProperties(Object.setPrototypeOf(Y,Iy),Object.getOwnPropertyDescriptors({...X}));$.ast=Q,$.rebuild=(Z)=>mX(Z,X);let J=d2($);return $.makeEffect=(Z,G)=>c2(J(Z,G)),$.make=KF($),$.makeOption=p2($),$}function c2(Q){return U9(Q,(X)=>D9(()=>Z4(X,(Y)=>new C6(Y))))}var I60=globalThis.Boolean;var wF=w4((Q,X)=>Q||X,!1);var PF=U(2,(Q,X)=>{return WW(Q,(Y,$)=>X.includes(Y)?[Y,$]:void 0)}),AF=U(2,(Q,X)=>{return WW(Q,(Y,$)=>!X.includes(Y)?[Y,$]:void 0)}),CF=U(2,(Q,X)=>{return{...Q,...X}});var GW=U(2,(Q,X)=>{return WW(Q,(Y,$)=>[Object.hasOwn(X,Y)?X[Y]:Y,$])});var P1=(Q)=>Q;function WW(Q,X){let Y={};for(let $ of Reflect.ownKeys(Q)){if(!Object.prototype.propertyIsEnumerable.call(Q,$))continue;let J=X($,Q[$]);if(J){let[Z,G]=J;b(Y,Z,G)}}return Y}function jF(Q,X){let Y=X?.omitKeyWhen??(()=>!1);return tK(($,J)=>{let Z=Reflect.ownKeys(Q),G={};for(let W of Z){let H=Q[W].combine($[W],J[W]);if(Y(H))continue;b(G,W,H)}return G})}function dX(Q){return w4((X,Y)=>{if(X===void 0)return Y;if(Y===void 0)return X;return Q.combine(X,Y)},void 0)}function _4(Q,X){if(X.length>0)Q+=`
|
|
29
|
-
at ${C7(X)}`;return Error(Q)}var TF=new WeakMap,IF=new WeakMap,EF=[];function pF(){return{warnings:[]}}function fF(Q){return{warnings:Q.warnings.slice()}}function p4(Q){return Error(`Unable to derive an arbitrary for ${Q}`)}var SF=([Q],[X])=>o(Q,X);function xy(Q,X,Y){return X.reduce(($,J)=>$.filter((Z)=>J.run(Z,Q,w9)===void 0),Y)}function cF(Q,X){if(Q?.minLength!==void 0&&Q.maxLength!==void 0&&Q.minLength>Q.maxLength)throw p4(`${X} constraints`)}function uF(Q){return Q===void 0||Q.minLength===void 0&&Q.maxLength===void 0?void 0:{...Q.minLength!==void 0?{minLength:Q.minLength}:{},...Q.maxLength!==void 0?{maxLength:Q.maxLength}:{}}}function KW(Q,X,Y,$){return $?Q.uniqueArray(X,{...Y,comparator:$}):Q.array(X,Y)}function vF(Q,X,Y,$=!1){let J=X.constraint,Z=uF(J);return cF(Z,"array"),KW(Q,Y,$?{...Z,maxLength:Z?.minLength??0}:Z,J?.unique?o:void 0)}function u2(Q,X,Y,$){return X.chain((J)=>J.length<Y?Q.constant(J):$.map((Z)=>[...J,...Z]))}function xF(Q,X){return Q.chain((Y)=>X.map(($)=>({...Object.fromEntries($),...Y})))}var by=dX(PU),ky=dX(AU),l2=dX(wF),yy=dX(IV()),gy=jF({integer:l2,maxLength:ky,minLength:by,noInfinity:l2,noNaN:l2,patterns:yy,unique:l2},{omitKeyWhen:gK});function bF(Q,X,Y,$,J,Z){if($===void 0||X===void 0)return $===void 0?[X,Y]:[$,J];let G=Q(X,$);return G===Z?[$,J]:G===0?[X,Y||J]:[X,Y]}function hy(Q,X){if(Q===void 0)return X;if(Q.order!==X.order)throw Error("Cannot merge ordered arbitrary constraints with different Order instances");let[Y,$]=bF(Q.order,Q.minimum,Q.exclusiveMinimum,X.minimum,X.exclusiveMinimum,-1),[J,Z]=bF(Q.order,Q.maximum,Q.exclusiveMaximum,X.maximum,X.exclusiveMaximum,1);return{order:Q.order,...Y!==void 0?{minimum:Y}:{},...$!==void 0?{exclusiveMinimum:$}:{},...J!==void 0?{maximum:J}:{},...Z!==void 0?{exclusiveMaximum:Z}:{}}}function my(Q,X){let{ordered:Y,...$}=Q??{},{ordered:J,...Z}=X,G=J===void 0?Y:hy(Y,J);return{...gy.combine($,Z),...G===void 0?{}:{ordered:G}}}function kF(Q){let X=[],Y=[];function $(J){if(J.annotations?.arbitrary)Y.push(J.annotations.arbitrary);if(J._tag!=="Filter")for(let Z of J.checks)$(Z);else X.push(J)}return Q?.forEach($),{filters:X,arbitraries:Y}}function dy(Q){let X=Q.map(({constraint:Y})=>Y).filter(_1);return(Y)=>{let $=X.reduce((J,Z)=>my(J,Z),Y.constraint);return{...Y,constraint:$}}}function pX(Q){return{...Q,constraint:void 0}}function yF(Q,X,Y){if(X===void 0||X.minLength===void 0&&X.maxLength===void 0)return;if(X.minLength!==void 0&&Q.indexSignatures.length===0&&X.minLength>Q.propertySignatures.length)throw p4("object property constraints");let $={};if(X.minLength!==void 0)$.minLength=Math.max(0,X.minLength-Y);if(X.maxLength!==void 0){if($.maxLength=X.maxLength-Y,$.maxLength<0)throw p4("object property constraints")}return cF($,"object property"),$}function py(Q,X,Y,$,J,Z){let G=$.length;if(Z.maxLength!==void 0&&Z.maxLength<G)throw p4("object property constraints");let W=Z.minLength===void 0?0:Math.max(0,Z.minLength-G),H=Z.maxLength===void 0?J.length:Math.min(J.length,Z.maxLength-G);if(W>H)throw p4("object property constraints");let K=Q.record(X,{requiredKeys:[...$,...J]}),V=Q.shuffledSubarray([...J],{minLength:W,maxLength:H});return Q.tuple(K,V).map(([_,q])=>{let D=new Set([...$,...q]),B={};for(let F of Y)if(D.has(F))b(B,F,_[F]);return B})}function lF(Q,X,Y,$){let J={};if(Q?.minimum!==void 0)J.min=X(Q.minimum,Q.exclusiveMinimum===!0);if(Q?.maximum!==void 0)J.max=Y(Q.maximum,Q.exclusiveMaximum===!0);if(J.min!==void 0&&J.max!==void 0&&J.min>J.max)throw p4($);return J}function fy(Q){return lF(Q,(X,Y)=>Y?Math.floor(X)+1:Math.ceil(X),(X,Y)=>Y?Math.ceil(X)-1:Math.floor(X),"integer constraints")}function cy(Q,X){let Y={...Q?.noInfinity?{noDefaultInfinity:!0}:{},...Q?.noNaN?{noNaN:!0}:{},...X?.minimum!==void 0?{min:X.minimum}:{},...X?.exclusiveMinimum!==void 0?{minExcluded:X.exclusiveMinimum}:{},...X?.maximum!==void 0?{max:X.maximum}:{},...X?.exclusiveMaximum!==void 0?{maxExcluded:X.exclusiveMaximum}:{}};if(Y.min!==void 0&&Y.max!==void 0&&(Y.min>Y.max||Y.min===Y.max&&(Y.minExcluded||Y.maxExcluded)))throw p4("number constraints");return Y}function uy(Q){return lF(Q,(X,Y)=>Y?X+BigInt(1):X,(X,Y)=>Y?X-BigInt(1):X,"the ordered bigint constraints")}function k5(Q,X){let Y=($,J,Z=EF)=>Q($,J,Z);return Y.terminal=($,J,Z=EF)=>X($,J,Z),Y}function L8(Q){return k5(Q,Q)}function gF(Q,X){let Y=IF.get(X)??Q.createDepthIdentifier();return IF.set(X,Y),{maxDepth:2,depthIdentifier:Y}}function hF(Q,X){return X.length===0?void 0:X.length===1?X[0]:Q.oneof(...X)}var ly={noInfinity:!0,noNaN:!0};function oy(Q){return{...Q,constraint:ly}}function ry(Q,X,Y){function $(J,Z){let G=J.annotations?.arbitrary,W=Z||G?.constraint!==void 0||G?.candidate!==void 0;if(J._tag!=="Filter")for(let H of J.checks)$(H,W);else if(!W){let H=J.annotations?.representation?.id??J.annotations?.identifier??J.annotations?.expected;Q.warnings.push({_tag:"OpaqueFilter",path:Y,...H===void 0?{}:{description:H}})}}X?.forEach((J)=>$(J,!1))}function oF(Q,X){let Y=new WeakSet;function $(J,Z){if(Y.has(J))return;switch(Y.add(J),ry(X,J.checks,Z),J._tag){case"Declaration":J.typeParameters.forEach((G)=>$(G,Z));break;case"Arrays":{for(let[G,W]of[...J.elements,...J.rest].entries())$(W,[...Z,G]);break}case"Objects":J.propertySignatures.forEach((G)=>$(G.type,[...Z,G.name])),J.indexSignatures.forEach((G)=>{$(G.parameter,Z),$(G.type,Z)});break;case"Union":J.types.forEach((G)=>$(G,Z));break;case"TemplateLiteral":J.parts.forEach((G,W)=>$(O1(G),[...Z,W]));break;case"Suspend":$(J.thunk(),Z);break}Y.delete(J)}$(Q,[])}function iy(Q,X,Y,$){let J=$===void 0?[]:[{arbitrary:$,weight:1}];for(let{candidate:Z}of Y){if(!Z)continue;let G=Z.make(Q,X);if(G===void 0)continue;let W=Z.weight??1;if(!globalThis.Number.isInteger(W)||W<=0)throw p4("a candidate with an invalid weight");J.push({arbitrary:G,weight:W})}return J.length===0?void 0:J.length===1?J[0].arbitrary:Q.oneof(...J)}function mF(Q,X,Y,$,J){let Z=iy(Y,$,X.arbitraries,J);return Z===void 0?void 0:xy(Q,X.filters,Z)}function ny(Q,X){if(!(typeof Q==="object"&&Q!==null&&("arbitrary"in Q)))return{arbitrary:Q,terminal:X?void 0:Q};let Y="terminal"in Q?Q.terminal:X?void 0:Q.arbitrary;return{arbitrary:Q.arbitrary,terminal:Y}}function ay(Q,X,Y,$,J){return Q.map((Z)=>({arbitrary:J?X.constant(null).chain(()=>Z(X,Y,$)):Z(X,Y,$),terminal:Z.terminal(X,Y,$)}))}function dF(Q,X,Y,$){let J=dy(X.arbitraries);return k5((Z,G,W)=>{let H=J(G);return mF(Q,X,Z,H,Y(Z,G,H,W))},(Z,G,W)=>{let H=J(G);return mF(Q,X,Z,H,$(Z,G,H,W))})}var VW=s0((Q)=>M8(Q,[]));function M8(Q,X){let Y=h4(Q)?.toArbitrary;if(Y){let $=M9(Q)?Q.typeParameters.map((G)=>M8(G,X)):[],J=kF(Q.checks),Z=(G)=>(W,H,K,V)=>ny(Y(ay($,W,pX(H),V,G))(W,K),$.length>0)[G?"terminal":"arbitrary"];return dF(Q,J,Z(!1),Z(!0))}if(Q.checks){let $=kF(Q.checks),J=M8(v2(Q,void 0),X);return dF(Q,$,(Z,G,W,H)=>J(Z,W,H),(Z,G,W,H)=>J.terminal(Z,W,H))}return sy(Q,X)}function sy(Q,X){switch(Q._tag){case"Never":case"Declaration":throw _4(`Unsupported AST ${Q._tag}`,X);case"Null":return L8((Y)=>Y.constant(null));case"Void":case"Undefined":return L8((Y)=>Y.constant(void 0));case"Unknown":case"Any":return L8((Y)=>Y.anything());case"String":return L8((Y,$)=>{let J=$.constraint,Z=J?.patterns;return Z?Y.oneof(...Z.map((G)=>Y.stringMatching(new RegExp(G)))):Y.string(uF(J))});case"Number":return L8((Y,$)=>{let J=$.constraint,Z=J?.ordered?.order===D1?J.ordered:void 0;return J?.integer?Y.integer(fy(Z)):Y.float(cy(J,Z))});case"Boolean":return L8((Y)=>Y.boolean());case"BigInt":return L8((Y,$)=>{let J=$.constraint?.ordered?.order===_8?$.constraint.ordered:void 0;return Y.bigInt(uy(J))});case"Symbol":return L8((Y)=>Y.string().map(Symbol.for));case"Literal":return L8((Y)=>Y.constant(Q.literal));case"UniqueSymbol":return L8((Y)=>Y.constant(Q.symbol));case"ObjectKeyword":return L8((Y)=>Y.oneof(Y.object(),Y.array(Y.anything())));case"Enum":return M8(QF(Q),X);case"TemplateLiteral":{let Y=Q.parts.map(($,J)=>M8(O1($),[...X,J]));return L8(($,J,Z)=>$.tuple(...Y.map((G)=>G($,oy(J),Z))).map((G)=>G.map((W)=>globalThis.String(W)).join("")))}case"Arrays":{let Y=Q.elements.map((G,W)=>({ast:G,arbitrary:M8(G,[...X,W])})),$=Q.elements.length,J=Q.rest.map((G,W)=>({ast:G,arbitrary:M8(G,[...X,$+W])})),Z=(G,W,H)=>{let K=pX(W),V=[],_=[],q=0;for(let w of Y){let A=w.arbitrary.terminal(G,K,H);if(f0(w.ast)){_.push(A);continue}if(A===void 0)return;q++,V.push(A.map(R))}let D=W.constraint?.minLength??0,F=Z6(J)&&D>q+_.length?_.length:Math.max(0,D-q),N=0;for(let w of _){if(N>=F||w===void 0){V.push(G.constant(d()));continue}N++,q++,V.push(w.map(R))}if(N<F)return;let M=G.tuple(...V).map(C$);if(Z6(J)){let[w,...A]=J,s=Q.elements.length===0?W:K,L=Math.max(0,D-q-A.length),x=L===0?void 0:w.arbitrary.terminal(G,K,H);if(L>0&&x===void 0)return;let I=L===0?G.constant([]):vF(G,{...s,constraint:{...s.constraint,minLength:L}},x,!0);if(M=u2(G,M,$,I),A.length>0){let W0=[];for(let o1 of A){let F1=o1.arbitrary.terminal(G,K,H);if(F1===void 0)return;W0.push(F1)}let T0=G.tuple(...W0);M=u2(G,M,$,T0)}}return M};return k5((G,W,H)=>{let K=pX(W),V=Y.map(({ast:q,arbitrary:D})=>{let B=D(G,K,H);return f0(q)?B.chain((F)=>G.boolean().map((N)=>N?R(F):d())):B.map(R)}),_=G.tuple(...V).map(C$);if(Z6(J)){let[q,...D]=J.map(({arbitrary:F})=>F(G,K,H)),B=vF(G,Q.elements.length===0?W:K,q);if(_=u2(G,_,$,B),D.length>0){let F=G.tuple(...D);_=u2(G,_,$,F)}}if(W.recursion){let q=Z(G,W,H);if(q!==void 0)return G.oneof(W.recursion,q,_)}return _},Z)}case"Objects":{let Y=Q.propertySignatures.map((Z)=>({ps:Z,arbitrary:M8(Z.type,[...X,Z.name])})),$=Q.indexSignatures.map((Z)=>({is:Z,parameter:M8(Z.parameter,X),type:M8(Z.type,X)}));return k5((Z,G,W)=>{let H=pX(G),K={},V=[],_=[],q=[];for(let{ps:N,arbitrary:M}of Y){let w=N.name;if(V.push(w),f0(N.type))q.push(w);else _.push(w);b(K,w,M(Z,H,W))}let D=G.constraint;if(q.length>0&&$.length===0&&D!==void 0&&(D.minLength!==void 0||D.maxLength!==void 0))return py(Z,K,V,_,q,D);let B=Z.record(K,{requiredKeys:_}),F=yF(Q,G.constraint,_.length);for(let{parameter:N,type:M}of $){let w=Z.tuple(N(Z,H,W),M(Z,H,W)),A=KW(Z,w,F,SF);B=xF(B,A)}return B},(Z,G,W)=>{let H=pX(G),K={},V=[],_=[];for(let{ps:N,arbitrary:M}of Y){let w=N.name,A=M.terminal(Z,H,W);if(f0(N.type)){if(A!==void 0)_.push([w,A]);continue}if(A===void 0)return;V.push(w),b(K,w,A)}let q=Math.max(0,(G.constraint?.minLength??0)-V.length);for(let[N,M]of _){if(q===0)break;q--,V.push(N),b(K,N,M)}if(q>0&&Q.indexSignatures.length===0)return;let D=Z.record(K,{requiredKeys:V}),B=yF(Q,G.constraint,V.length),F=B?.minLength??0;for(let{parameter:N,type:M}of $){let w;if(F===0)w=Z.constant([]);else{let A=N.terminal(Z,H,W),s=M.terminal(Z,H,W);if(A===void 0||s===void 0)return;w=KW(Z,Z.tuple(A,s),{...B,maxLength:F},SF)}D=xF(D,w)}return D})}case"Union":{let Y=Q.types.map((J)=>M8(J,X)),$=(J,Z,G)=>hF(J,Y.map((W)=>W.terminal(J,Z,G)).filter(_1));return k5((J,Z,G)=>{let W=Y.map((K)=>K(J,Z,G));if(Z.recursion){let K=$(J,Z,G);if(K!==void 0)return J.oneof(Z.recursion,K,...W)}let H=hF(J,W);if(H===void 0)throw p4("a union with no members");return H},$)}case"Suspend":{let Y=TF.get(Q);if(Y)return Y;let $=A9(()=>M8(Q.thunk(),X)),J=k5((Z,G,W)=>{let H=gF(Z,Q),K={...G,recursion:H},V=W.includes(Q)?W:[...W,Q],_=$().terminal(Z,K,V);if(_===void 0)throw _4("Unable to derive an arbitrary for a recursive schema without a finite generation path",X);return Z.oneof(H,_,Z.constant(null).chain(()=>$()(Z,K,V)))},(Z,G,W)=>{if(W.includes(Q))return;let H=gF(Z,Q);return $().terminal(Z,{...G,recursion:H},[...W,Q])});return TF.set(Q,J),J}}}var rF=s0((Q)=>{return j6(Q,[])});function j6(Q,X){let Y=h4(Q)?.toEquivalence;if(Y)return Y(M9(Q)?Q.typeParameters.map(($)=>j6($,X)):[]);switch(Q._tag){case"Never":return eK();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 o;case"Arrays":{let $=Q.elements.map((G,W)=>j6(G,[...X,W])),J=Q.elements.length,Z=Q.rest.map((G,W)=>j6(G,[...X,J+W]));return H1((G,W)=>{if(!Array.isArray(G)||!Array.isArray(W))return!1;let H=G.length;if(H!==W.length)return!1;let K=0;for(;K<Math.min(H,Q.elements.length);K++)if(!$[K](G[K],W[K]))return!1;if(Z.length>0){let[V,..._]=Z;for(;K<H-_.length;K++)if(!V(G[K],W[K]))return!1;for(let q=0;q<_.length;q++)if(!_[q](G[K+q],W[K+q]))return!1}return!0})}case"Objects":{if(Q.propertySignatures.length===0&&Q.indexSignatures.length===0)return o;let $=Q.propertySignatures.map((Z)=>j6(Z.type,[...X,Z.name])),J=Q.indexSignatures.map((Z)=>j6(Z.type,X));return H1((Z,G)=>{if(!j1(Z)||!j1(G))return!1;for(let W=0;W<$.length;W++){let H=Q.propertySignatures[W],K=H.name,V=Object.hasOwn(Z,K),_=Object.hasOwn(G,K);if(f0(H.type)){if(V!==_)return!1}if(V&&_&&!$[W](Z[K],G[K]))return!1}for(let W=0;W<J.length;W++){let H=Q.indexSignatures[W],K=I5(Z,H.parameter),V=I5(G,H.parameter);if(K.length!==V.length)return!1;for(let _=0;_<K.length;_++){let q=K[_];if(!Object.hasOwn(G,q)||!J[W](Z[q],G[q]))return!1}}return!0})}case"Union":{let $=z1(Q).types,J=new Map($.map((Z,G)=>[Z,[hX(Z),j6(Q.types[G],X)]]));return H1((Z,G)=>{let W=EX(Z,$);for(let H=0;H<W.length;H++){let[K,V]=J.get(W[H]);if(K(Z)&&K(G))return V(Z,G)}return!1})}case"Suspend":{let $=A9(()=>j6(Q.thunk(),X));return H1((J,Z)=>$()(J,Z))}}}function o2(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}function iF(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}var g60=globalThis.RegExp;var y5=(Q)=>Q.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var Qg=new Set([...Kz,zX,...Wz]);function fX(Q,X){if(Q===void 0)return;let Y={},$=Q.title;if(typeof $==="string")Y.title=$;let{description:J,expected:Z}=Q;if(typeof J==="string")Y.description=J;else if(X?.generateDescriptions===!0&&typeof Z==="string")Y.description=Z;let G=Q.default;if(v5(G))Y.default=G;let W=Q.examples;if(Array.isArray(W)&&v5(W))Y.examples=W;let H=Q.readOnly;if(typeof H==="boolean")Y.readOnly=H;let K=Q.writeOnly;if(typeof K==="boolean")Y.writeOnly=K;let V=Q.format;if(typeof V==="string")Y.format=V;let _=Q.contentEncoding;if(typeof _==="string")Y.contentEncoding=_;let q=Q.contentMediaType;if(typeof q==="string")Y.contentMediaType=q;let D=Q.contentSchema;if(v5(D))Y.contentSchema=D;if(X?.includeAnnotationKey!==void 0)for(let[B,F]of Object.entries(Q)){if(Qg.has(B)||!X.includeAnnotationKey(B))continue;if(v5(F))b(Y,B,F)}return Object.keys(Y).length===0?void 0:Y}function aF(Q){let X=Q.type==="number"||Q.type==="integer"?Q.type:void 0,Y=Q;if(X!==void 0)Y={...Q},delete Y.type;if(Array.isArray(Y.allOf)){let $=[],J=!1;for(let Z of Y.allOf){let G=aF(Z);if(G.type!==void 0){if(J=!0,X===void 0||G.type==="integer")X=G.type}if(Object.keys(G.schema).length>0)$.push(G.schema)}if(J){let{allOf:Z,...G}=Y;Y=$.length===0?G:{...G,allOf:$}}}return{type:X,schema:Y}}function Xg(Q){return Array.isArray(Q.anyOf)&&Q.anyOf.length===4&&Q.anyOf[0]?.type==="number"&&Q.anyOf.slice(1).every((X)=>X.type==="string")}function r2(Q,X){if(Object.keys(Q).length===0)return X;let Y=Object.keys(X);if(Y.length===0)return Q;let $=Q.type==="number"||Q.type==="integer"?Q.type:void 0,J=Xg(Q);if($!==void 0||J){let G=aF(X);if(G.type!==void 0){let W=$==="integer"||G.type==="integer"?"integer":"number",H={...Q,type:W};if(J)delete H.anyOf;return Object.keys(G.schema).length===0?H:r2(H,G.schema)}}let Z=Array.isArray(X.allOf)&&Y.length===1?X.allOf:[X];if(Array.isArray(Q.allOf))return{...Q,allOf:[...Q.allOf,...Z]};if(typeof Q.$ref==="string")return{allOf:[Q,...Z]};return{...Q,allOf:Z}}function Yg(Q,X,Y,$){let J={};for(let _ of Object.keys(Y))b(J,_,H(Y[_],["references",_]));return{dialect:"draft-2020-12",schemas:Q4(Q,(_,q)=>H(_,X[q])),definitions:J};function G(_,q){return _?.schemas?.map((D,B)=>H(D,[...q,"schemas",B]))??[]}function W(_,q,D){let B=_.annotations,F=B?.toJsonSchema;if(F!==void 0){let w=G(_.representation,[...D,"representation"]),A=F({type:q,schemas:w}),s=fX(B,$);return s===void 0?A:{...A,...s}}if(_._tag==="Filter")return;let N=_.checks.map((w,A)=>W(w,q,[...D,"checks",A])).filter((w)=>w!==void 0);if(N.length===0)return;let M=fX(B,$);return M===void 0?{allOf:N}:{allOf:N,...M}}function H(_,q){if(_._tag==="Reference"){if(!Object.hasOwn(Y,_.$ref))throw _4(`Invalid reference ${_.$ref}`,[...q,"$ref"]);return{$ref:`#/$defs/${o2(_.$ref)}`}}let D=K(_,q),B=fX(_.annotations,$);if(B!==void 0)D={...D,...B};for(let F=0;F<_.checks.length;F++){let N=typeof D.type==="string"&&$g(D.type)?D.type:void 0,M=W(_.checks[F],N,[...q,"checks",F]);if(M!==void 0)D=r2(D,M)}return D}function K(_,q){switch(_._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 H(_.thunk,[...q,"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 D=_.literal;return typeof D==="bigint"?{type:"string",enum:[globalThis.String(D)]}:{type:typeof D,enum:[D]}}case"Enum":{let D=_.enums.map(([B,F])=>typeof F==="number"&&!globalThis.Number.isFinite(F)?{type:"string",enum:[globalThis.String(F)],title:B}:{type:typeof F,enum:[F],title:B});return D.length===0?{not:{}}:{anyOf:D}}case"TemplateLiteral":return{type:"string",pattern:`^${_.parts.map(i2).join("")}$`};case"Arrays":{if(_.rest.length>1)throw _4("Invalid schema representation document",[...q,"rest"]);let D={type:"array"},B=_.elements.length,F=_.elements.map((N,M)=>{if(N.isOptional)B--;let w=H(N.type,[...q,"elements",M,"type"]),A=fX(N.annotations,$);return A===void 0?w:r2(w,A)});if(F.length>0){if(D.prefixItems=F,D.maxItems=_.elements.length,B>0)D.minItems=B}else D.items=!1;if(_.rest.length===1){delete D.maxItems;let N=H(_.rest[0],[...q,"rest",0]);if(Object.keys(N).length>0)D.items=N;else delete D.items}return D}case"Objects":{if(_.propertySignatures.length===0&&_.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let D={type:"object"},B={},F=[];for(let M=0;M<_.propertySignatures.length;M++){let w=_.propertySignatures[M];if(typeof w.name!=="string")throw _4("Invalid schema representation document",[...q,"propertySignatures",M,"name"]);let A=w.name,s=H(w.type,[...q,"propertySignatures",M,"type"]),L=fX(w.annotations,$);if(b(B,A,L===void 0?s:r2(s,L)),!w.isOptional)F.push(A)}if(_.propertySignatures.length>0)D.properties=B;if(F.length>0)D.required=F;D.additionalProperties=$?.additionalProperties??!1;let N={};for(let M=0;M<_.indexSignatures.length;M++){let w=_.indexSignatures[M],A=H(w.type,[...q,"indexSignatures",M,"type"]);if(Object.keys(A).length===1&&"not"in A)A=!1;let s=V(w.parameter,[...q,"indexSignatures",M,"parameter"],new Set);if(s.length===0)D.additionalProperties=A;else for(let L of s)b(N,L,A)}if(Object.keys(N).length>0)D.patternProperties=N,delete D.additionalProperties;if(typeof D.additionalProperties==="object"&&D.additionalProperties!==null&&Object.keys(D.additionalProperties).length===0)delete D.additionalProperties;return D}case"Union":{let D=_.types.map((B,F)=>H(B,[...q,"types",F]));if(D.length===0)return{not:{}};if(D.length>1){let B=Jg(D);if(B!==void 0)return B}return _.mode==="anyOf"?{anyOf:D}:{oneOf:D}}}}function V(_,q,D){switch(_._tag){case"Reference":{if(!Object.hasOwn(Y,_.$ref))throw _4(`Invalid reference ${_.$ref}`,[...q,"$ref"]);if(D.has(_.$ref))return[];let B=new Set(D).add(_.$ref);return V(Y[_.$ref],["references",_.$ref],B)}case"String":return sF(H(_,q));case"TemplateLiteral":return[`^${_.parts.map(i2).join("")}$`];case"Union":return _.types.flatMap((B,F)=>V(B,[...q,"types",F],D));default:throw _4("Invalid schema representation document",q)}}}function $g(Q){return Q==="string"||Q==="number"||Q==="boolean"||Q==="array"||Q==="object"||Q==="null"||Q==="integer"}function Jg(Q){let X=void 0,Y=[];for(let $ of Q){if(Object.keys($).length!==2||$.type===void 0||!Array.isArray($.enum)||$.enum.length===0)return;if(X===void 0)X=$.type;else if($.type!==X)return;Y.push(...$.enum)}return{type:X,enum:Y}}function sF(Q){let X=[];if(typeof Q.pattern==="string")X.push(Q.pattern);for(let Y of["allOf","anyOf","oneOf"]){let $=Q[Y];if(Array.isArray($)){for(let J of $)if(typeof J==="object"&&J!==null&&!Array.isArray(J))X.push(...sF(J))}}return X}function i2(Q){switch(Q._tag){case"Literal":return y5(globalThis.String(Q.literal));case"String":return YF;case"Number":return w2;case"TemplateLiteral":return Q.parts.map(i2).join("");case"Union":return Q.types.map(i2).join("|");default:throw _4("Invalid schema representation document",[])}}function tF(Q,X){let Y=Yg([Q.representation],[["representation"]],Q.references,X);return{dialect:Y.dialect,schema:Y.schemas[0],definitions:Y.definitions}}function _W(Q){let{references:X,representations:Y}=Gg([Q]);return{representation:Y[0],references:X}}function Gg(Q){return Wg(Q,[])}function d8(Q){return Q===void 0?void 0:{annotations:Q}}function XR(Q){return CX(Q)||xG(Q)||jX(Q)&&Q.types.some(XR)}function eF(Q){let X=R6(Q);if(X!==void 0)return{identifier:X,isFallback:!1};let Y=G2(Q);return Y===void 0?void 0:{identifier:`${Y}JsonEncoding`,isFallback:!0}}function QR(Q,X){if(Q===X)return!0;let Y=Reflect.ownKeys(Q),$=Reflect.ownKeys(X);if(Y.length!==$.length)return!1;for(let J of Y)if(J!=="context"&&Q[J]!==X[J])return!1;return!0}function Wg(Q,X){let Y={},$=new Map,J=[],Z=new Map,G=new Set(X.map((L)=>L.key)),W=new Set,H=new Set,K=new Set;for(let L of X)Z.set(L.key,L.body),$.set(L.original,L.key),$.set(L.encoded,L.key);for(let L of Q)q(L);for(let L of X)q(L.body);let V=Q4(Q,(L)=>B(L));for(let L of X)b(Y,L.key,B(L.body,L.key));return{representations:V,references:Y};function _(L,x){let I=L,W0=0;while(Z.has(I))I=`${L}${++W0}`;return Z.set(I,x),I}function q(L){let x=M6(L);if(H.has(x)){if(XR(x))K.add(x);return}H.add(x);let I=eF(x);if(I!==void 0&&!I.isFallback){let W0=Z.get(I.identifier);if(W0===void 0)Z.set(I.identifier,x);else if($.get(x)!==I.identifier&&!QR(W0,x))throw Error(`Duplicate identifier: ${JSON.stringify(I.identifier)}`)}switch(D(x.checks),x._tag){case"Declaration":case"Arrays":case"Objects":case"Union":x.recur((W0)=>{return q(W0),W0});break;case"TemplateLiteral":x.parts.forEach(q);break;case"Suspend":q(x.thunk());break}}function D(L){L?.forEach((x)=>{if(x.annotations?.representation?.schemas?.forEach((I)=>q(z1(I))),x._tag==="FilterGroup")D(x.checks)})}function B(L,x){let I=$.get(L);if(I!==void 0&&I!==x)return{_tag:"Reference",$ref:I};let W0=M6(L);if(W0!==L)return B(W0,x);let T0=x===void 0?eF(L):void 0;if(T0!==void 0){let x0=F(T0,L);if($.set(L,x0),!Object.hasOwn(Y,x0)&&!G.has(x0))b(Y,x0,N(L));return{_tag:"Reference",$ref:x0}}if(x===void 0&&K.has(L)){let x0=_(`${L._tag}_`,L);return $.set(L,x0),b(Y,x0,N(L)),{_tag:"Reference",$ref:x0}}if(W.has(L)){let x0=_(`${L._tag}_`,L);return $.set(L,x0),{_tag:"Reference",$ref:x0}}W.add(L);let o1=N(L);W.delete(L);let F1=$.get(L);if(F1!==void 0&&F1!==x)return b(Y,F1,o1),{_tag:"Reference",$ref:F1};return o1}function F(L,x){if(!L.isFallback)return L.identifier;for(let[W0,T0]of J)if(QR(W0,x))return T0;let I=_(L.identifier,x);return J.push([x,I]),I}function N(L){let x=M(L.checks);switch(L._tag){case"Declaration":return{_tag:"Declaration",typeParameters:L.typeParameters.map((I)=>B(I)),checks:x,...A(L.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:L._tag,checks:x,...d8(L.annotations)};case"Literal":return{_tag:"Literal",literal:L.literal,checks:x,...d8(L.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:L.symbol,checks:x,...d8(L.annotations)};case"Enum":return{_tag:"Enum",enums:L.enums,checks:x,...d8(L.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:L.parts.map((I)=>B(I)),checks:x,...d8(L.annotations)};case"Arrays":return{_tag:"Arrays",elements:L.elements.map((I)=>{let W0=M6(I),T0=W0.context?.annotations;return{isOptional:f0(W0),type:B(I),...d8(T0)}}),rest:L.rest.map((I)=>B(I)),checks:x,...d8(L.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:L.propertySignatures.map((I)=>{let W0=M6(I.type),T0=W0.context?.annotations;return{name:I.name,type:B(I.type),isOptional:f0(W0),isMutable:sO(W0),...d8(T0)}}),indexSignatures:L.indexSignatures.map((I)=>({parameter:B(I.parameter),type:B(I.type)})),checks:x,...d8(L.annotations)};case"Union":return{_tag:"Union",types:L.types.map((I)=>B(I)),mode:L.mode,checks:x,...d8(L.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:B(L.thunk()),...d8(L.annotations)}}}function M(L){return L?.map(w)??[]}function w(L){switch(L._tag){case"Filter":return{_tag:"Filter",aborted:L.aborted,...s(L.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Q4(L.checks,w),...s(L.annotations)}}}function A(L){if(L===void 0)return;let{representation:x,...I}=L;return{...x===void 0?void 0:{representation:x},...Object.keys(I).length===0?void 0:{annotations:I}}}function s(L){if(L===void 0)return;let{representation:x,...I}=L,W0=x===void 0?void 0:x.schemas===void 0?x:{...x,schemas:x.schemas.map((T0)=>B(z1(T0)))};return{...W0===void 0?void 0:{representation:W0},...Object.keys(I).length===0?void 0:{annotations:I}}}}function n2(Q,X){if(Object.is(Q,X))return[];let Y=[];if(Array.isArray(Q)&&Array.isArray(X)){let $=Q.length,J=X.length,Z=Math.min($,J);for(let G=0;G<Z;G++){let W=`/${G}`,H=n2(Q[G],X[G]);for(let K of H)YR(K,W),Y.push(K)}for(let G=$-1;G>=J;G--)Y.push({op:"remove",path:`/${G}`});for(let G=$;G<J;G++)Y.push({op:"add",path:`/${G}`,value:X[G]});return Y}if(a2(Q)&&a2(X)){let $=Object.keys(Q),J=Object.keys(X),Z=Array.from(new Set([...$,...J])).sort();for(let G of Z){let H=`/${o2(G)}`,K=Object.hasOwn(Q,G),V=Object.hasOwn(X,G);if(K&&V){let _=n2(Q[G],X[G]);for(let q of _)YR(q,H),Y.push(q)}else if(!K&&V)Y.push({op:"add",path:H,value:X[G]});else if(K&&!V)Y.push({op:"remove",path:H})}return Y}return Y.push({op:"replace",path:"",value:X}),Y}function JR(Q,X){let Y=X;for(let $ of Q)switch($.op){case"replace":{Y=$.path===""?$.value:$R(Y,$.path,$.value,"replace");break}case"add":{Y=Vg(Y,$.path,$.value);break}case"remove":{Y=$R(Y,$.path,void 0,"remove");break}}return Y}function YR(Q,X){Q.path=Q.path===""?X:X+Q.path}function a2(Q){return j1(Q)}function Kg(Q){if(Q==="")return[];if(Q.charCodeAt(0)!==47)throw Error(`Invalid JSON Pointer, it must start with "/": ${P(Q)}`);return Q.split("/").slice(1).map(iF)}function qW(Q){if(!/^(0|[1-9]\d*)$/.test(Q))throw Error(`Invalid array index: "${Q}"`);return Number(Q)}function Vg(Q,X,Y){if(X==="")return Y;let $=ZR(Q,X);if($===null)throw Error(`Cannot add at "${X}" (parent not found or not a container).`);let{lastToken:J,parent:Z,stack:G}=$;if(Array.isArray(Z)){let W=J==="-"?Z.length:qW(J);if(W<0||W>Z.length)throw Error(`Array index out of bounds at "${X}".`);let H=Z.slice();return H.splice(W,0,Y),s2(G,H)}if(a2(Z)){let W={...Z};return b(W,J,Y),s2(G,W)}throw Error(`Cannot add at "${X}" (parent not found or not a container).`)}function $R(Q,X,Y,$){if(X===""){if($==="remove"||Y===void 0)throw Error("Unsupported operation at the root");return Y}let J=ZR(Q,X);if(J===null)throw Error(`Cannot ${$} at "${X}" (parent not found or not a container).`);let{lastToken:Z,parent:G,stack:W}=J;if(Array.isArray(G)){if(Z==="-")throw Error(`"-" is not valid for ${$} at "${X}".`);let H=qW(Z);if(H<0||H>=G.length)throw Error(`Array index out of bounds at "${X}".`);let K=G.slice();if($==="remove")K.splice(H,1);else K[H]=Y;return s2(W,K)}if(a2(G)){if(!Object.hasOwn(G,Z))throw Error(`Property "${Z}" does not exist at "${X}".`);let H={...G};if($==="remove")delete H[Z];else b(H,Z,Y);return s2(W,H)}throw Error(`Cannot ${$} at "${X}" (parent not found or not a container).`)}function ZR(Q,X){let Y=Kg(X);if(Y.length===0)return null;let $=Y[Y.length-1],J=[],Z=Q;for(let G=0;G<Y.length-1;G++){let W=Y[G];if(Z==null)return null;if(Array.isArray(Z)){let H=qW(W);if(H<0||H>=Z.length)return null;J.push({container:Z,token:H}),Z=Z[H];continue}if(Z&&typeof Z==="object"){if(!Object.hasOwn(Z,W))return null;J.push({container:Z,token:W}),Z=Z[W];continue}return null}return{stack:J,parent:Z,lastToken:$}}function s2(Q,X){let Y=X;for(let $=Q.length-1;$>=0;$--){let{container:J,token:Z}=Q[$];if(Array.isArray(J)){let G=J.slice();G[Z]=Y,Y=G}else{let G={...J};b(G,Z,Y),Y=G}}return Y}var qg=/^#\/\$defs(?=\/|$)/;function WR(Q){return{dialect:"draft-07",schema:GR(Q.schema),definitions:f7(Q.definitions,GR)}}function GR(Q){return X(Q);function X($){return Y(DW($,(J)=>J.replace(qg,"#/definitions")),!0)}function Y($,J){if(Array.isArray($))return $.map((K)=>Y(K,!1));if(!j1($))return $;let Z=$,G={},W=void 0,H=void 0;for(let K of Object.keys(Z)){let V=Z[K];switch(K){case"$ref":case"type":case"required":case"enum":case"const":case"title":case"description":case"default":case"examples":case"format":case"pattern":case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":case"minLength":case"maxLength":case"minItems":case"maxItems":case"minProperties":case"maxProperties":case"multipleOf":case"uniqueItems":G[K]=V;break;case"properties":case"patternProperties":{let _=Dg(V,Y);G[K]=_??V;break}case"additionalProperties":case"propertyNames":G[K]=Y(V,!1);break;case"allOf":case"anyOf":case"oneOf":G[K]=Array.isArray(V)?V.map((_)=>Y(_,!1)):V;break;case"prefixItems":W=V;break;case"items":H=V;break;default:break}}if(W!==void 0)if(Array.isArray(W)){if(G.items=W.map((K)=>Y(K,!1)),H!==void 0)G.additionalItems=Y(H,!1)}else G.items=Y(W,!1);else if(H!==void 0)G.items=Y(H,!1);return G}}function DW(Q,X){if(Array.isArray(Q))return Q.map(($)=>DW($,X));if(!j1(Q))return Q;let Y={};for(let $ of Object.keys(Q)){let J=Q[$];if($==="$ref")b(Y,$,typeof J==="string"?X(J):J);else if(Array.isArray(J)||j1(J))b(Y,$,DW(J,X));else b(Y,$,J)}return Y}function Dg(Q,X){if(!j1(Q))return;let Y={};for(let $ of Object.keys(Q))b(Y,$,X(Q[$],!1));return Y}function KR(Q,X){return p8(new DR(Q,X))}function HR(Q,X){return p8(new BW(Q,X))}class VR{_tag="IdentityNode"}var _R=new VR;class qR{_tag="CompositionNode";nodes;constructor(Q){this.nodes=Q}}class DR{_tag="IsoNode";get;set;constructor(Q,X){this.get=Q,this.set=X}}class BW{_tag="LensNode";get;set;constructor(Q,X){this.get=Q,this.set=X}}class UR{_tag="PrismNode";get;set;constructor(Q,X){this.get=Q,this.set=X}}class zW{_tag="OptionalNode";get;set;constructor(Q,X){this.get=Q,this.set=X}}class OW{_tag="PathNode";path;constructor(Q){this.path=Q}}class e2{_tag="CheckNode";checks;constructor(Q){this.checks=Q}}function Bg(Q,X){let Y=Q[Q.length-1];if(Y){if(Y._tag==="PathNode"&&X._tag==="PathNode"){Q[Q.length-1]=new OW([...Y.path,...X.path]);return}if(Y._tag==="CheckNode"&&X._tag==="CheckNode"){Q[Q.length-1]=new e2([...Y.checks,...X.checks]);return}}Q.push(X)}function UW(Q,X){if(Q._tag==="IdentityNode")return;if(Q._tag==="CompositionNode"){for(let Y=0;Y<Q.nodes.length;Y++)UW(Q.nodes[Y],X);return}Bg(X,Q)}function j9(Q,X){let Y=[];switch(UW(Q,Y),UW(X,Y),Y.length){case 0:return _R;case 1:return Y[0];default:return new qR(Y)}}function zg(Q,X){return p8(new zW(Q,X))}class cX{node;getResult;replaceResult;constructor(Q,X,Y){this.node=Q,this.getResult=X,this.replaceResult=Y}replace(Q,X){return UQ(this.replaceResult(Q,X),()=>X)}modify(Q){return(X)=>UQ(p7(this.getResult(X),(Y)=>this.replaceResult(Q(Y),X)),()=>X)}compose(Q){return p8(j9(this.node,Q.node))}key(Q){return p8(j9(this.node,new OW([Q])))}optionalKey(Q){return p8(j9(this.node,new BW((X)=>X[Q],(X,Y)=>{let $=Q3(Y);if(X===void 0)if(Array.isArray($)&&typeof Q==="number")$.splice(Q,1);else delete $[Q];else b($,Q,X);return $})))}check(...Q){return p8(j9(this.node,new e2(Q)))}refine(Q,X){return p8(j9(this.node,new e2([S2(Q,X)])))}tag(Q){return p8(j9(this.node,new UR((X)=>X._tag===Q?t(X):i(`Expected ${P(Q)} tag, got ${P(X._tag)}`),u)))}at(Q,...X){let Y=i(`Key ${P(Q)} not found`);return p8(j9(this.node,new zW(($)=>Object.hasOwn($,Q)?t($[Q]):Y,($,J)=>{if(Object.hasOwn(J,Q)){let Z=Q3(J);return b(Z,Q,$),t(Z)}else return Y})))}pick(Q){return this.compose(HR(PF(Q),(X,Y)=>({...Y,...X})))}omit(Q){return this.compose(HR(AF(Q),(X,Y)=>({...Y,...X})))}notUndefined(){return this.refine(_1,{expected:"a value other than `undefined`"})}forEach(Q){let X=Q(X3());return zg((Y)=>X9(this.getResult(Y),($)=>{let J=[];for(let Z=0;Z<$.length;Z++){let G=X.getResult($[Z]);if(E1(G))J.push(G.success)}return J}),(Y,$)=>p7(this.getResult($),(J)=>{let Z=[];for(let W=0;W<J.length;W++)if(E1(X.getResult(J[W])))Z.push(W);if(Y.length!==Z.length)return i(`each: replacement length mismatch: ${Y.length} !== ${Z.length}`);let G=J.slice();for(let W=0;W<Z.length;W++){let H=Z[W],K=X.replaceResult(Y[W],J[H]);if(_0(K))return i(`each: could not set element ${H}`);G[H]=K.success}return this.replaceResult(G,$)}))}modifyAll(Q){return(X)=>UQ(p7(this.getResult(X),(Y)=>this.replaceResult(Y.map(Q),X)),()=>X)}}class BR extends cX{get;set;constructor(Q,X,Y){super(Q,($)=>t(X($)),($)=>t(Y($)));this.get=X,this.set=Y}replace(Q,X){return this.set(Q)}modify(Q){return(X)=>this.set(Q(this.get(X)))}}class zR extends cX{get;constructor(Q,X,Y){super(Q,($)=>t(X($)),($,J)=>t(Y($,J)));this.get=X,this.replace=Y}modify(Q){return(X)=>this.replace(Q(this.get(X)),X)}}class OR extends cX{set;constructor(Q,X,Y){super(Q,X,($,J)=>t(Y($)));this.set=Y}replace(Q,X){return this.set(Q)}modify(Q){return(X)=>UQ(X9(this.getResult(X),(Y)=>this.set(Q(Y))),()=>X)}}function p8(Q){let X=FR(Q);switch(X._tag){case"IsoNode":return new BR(Q,X.get,X.set);case"LensNode":return new zR(Q,X.get,X.set);case"PrismNode":return new OR(Q,X.get,X.set);case"OptionalNode":return new cX(Q,X.get,X.set)}}function Q3(Q){if(Array.isArray(Q))return Q.slice();if(typeof Q==="object"&&Q!==null){let X=Object.getPrototypeOf(Q);if(X!==Object.prototype&&X!==null)throw Error("Cannot clone object with non-Object constructor or null prototype");return{...Q}}return Q}var FR=s0((Q)=>{switch(Q._tag){case"IdentityNode":return{_tag:"IsoNode",get:u,set:u};case"IsoNode":case"LensNode":case"PrismNode":case"OptionalNode":return{_tag:Q._tag,get:Q.get,set:Q.set};case"PathNode":return{_tag:"LensNode",get:(X)=>{let Y=Q.path,$=X;for(let J=0,Z=Y.length;J<Z;J++)$=$[Y[J]];return $},set:(X,Y)=>{let $=Q.path,J=Q3(Y),Z=J,G=0;for(;G<$.length-1;G++){let H=$[G];b(Z,H,Q3(Z[H])),Z=Z[H]}let W=$[G];return b(Z,W,X),J}};case"CheckNode":return{_tag:"PrismNode",get:(X)=>a9(ZF(Q.checks,X),String),set:u};case"CompositionNode":{let X=Q.nodes.map(FR),Y=X.reduce(($,J)=>Og($,J._tag),"IsoNode");return{_tag:Y,get:($)=>{for(let J=0;J<X.length;J++){let Z=X[J],G=Z.get($);if(t2(Z._tag)){if(_0(G))return G;$=G.success}else $=G}return t2(Y)?t($):$},set:($,J)=>{let Z=J,G=X.length,W=Array(G+1);W[0]=J;for(let H=0;H<G;H++){let K=X[H];if(t2(K._tag)){let V=K.get(J);if(_0(V))return Y==="OptionalNode"?V:Z;J=V.success}else J=K.get(J);W[H+1]=J}for(let H=G-1;H>=0;H--){let K=X[H];if(RR(K._tag))$=K.set($);else if(K._tag==="LensNode")$=K.set($,W[H]);else{let V=K.set($,W[H]);if(_0(V))return V;$=V.success}}return Y==="OptionalNode"?t($):$}}}}});function t2(Q){return Q==="PrismNode"||Q==="OptionalNode"}function RR(Q){return Q==="IsoNode"||Q==="PrismNode"}function Og(Q,X){switch(Q){case"IsoNode":return X;case"LensNode":return t2(X)?"OptionalNode":"LensNode";case"PrismNode":return RR(X)?"PrismNode":"OptionalNode";case"OptionalNode":return"OptionalNode"}}var Fg=p8(_R);function X3(){return Fg}var j3={};p6(j3,{webUrl:()=>Il,webSegment:()=>Gw,webQueryParameters:()=>Hw,webPath:()=>Ww,webFragments:()=>Zw,webAuthority:()=>$w,uuid:()=>zl,uniqueArray:()=>v9,ulid:()=>Kl,uint8ClampedArray:()=>rM,uint8Array:()=>oM,uint32Array:()=>lM,uint16Array:()=>uM,tuple:()=>Z0,toStringMethod:()=>l8,subarray:()=>Ql,stringify:()=>o0,stringMatching:()=>zo,string:()=>a0,stream:()=>v6,statistics:()=>Xd,sparseArray:()=>iM,shuffledSubarray:()=>Xl,set:()=>nM,schedulerFor:()=>cl,scheduler:()=>fl,scheduledModelRun:()=>dl,sample:()=>em,resetConfigureGlobal:()=>$m,record:()=>HH,readConfigureGlobal:()=>u8,property:()=>Gm,pre:()=>vg,option:()=>l4,oneof:()=>J1,object:()=>ku,noShrink:()=>M3,noBias:()=>N3,nat:()=>E6,modelRun:()=>hl,mixedCase:()=>Du,memo:()=>Wu,maxSafeNat:()=>Xc,maxSafeInteger:()=>xM,mapToConstant:()=>l5,map:()=>KH,lorem:()=>$u,limitShrink:()=>wo,letrec:()=>yM,jsonValue:()=>eM,json:()=>du,ipV6:()=>kM,ipV4Extended:()=>bM,ipV4:()=>yH,integer:()=>A0,int8Array:()=>cM,int32Array:()=>fM,int16Array:()=>pM,infiniteStream:()=>cu,hash:()=>L3,hasToStringMethod:()=>RH,hasCloneMethod:()=>E9,hasAsyncToStringMethod:()=>NH,getDepthContextFor:()=>PH,gen:()=>Gd,func:()=>sf,float64Array:()=>dM,float32Array:()=>mM,float:()=>EM,falsy:()=>bd,entityGraph:()=>nc,emailAddress:()=>Zf,double:()=>A3,domain:()=>vH,dictionary:()=>TH,defaultReportMessage:()=>tL,date:()=>KM,createDepthIdentifier:()=>AH,context:()=>yd,constantFrom:()=>D4,constant:()=>k0,configureGlobal:()=>Ym,compareFunc:()=>rf,compareBooleanFunc:()=>lf,commands:()=>xl,cloneMethod:()=>Z1,cloneIfNeeded:()=>p5,clone:()=>od,check:()=>XM,chainUntil:()=>VM,boolean:()=>Y7,bigUint64Array:()=>ll,bigInt64Array:()=>ul,bigInt:()=>x6,base64String:()=>au,asyncToStringMethod:()=>u4,asyncStringify:()=>LH,asyncProperty:()=>Zm,asyncModelRun:()=>ml,asyncDefaultReportMessage:()=>eL,assert:()=>sm,array:()=>C0,anything:()=>tM,__version:()=>Ao,__type:()=>Po,__commitHash:()=>Co,VerbosityLevel:()=>Wm,Value:()=>y,Stream:()=>G0,Random:()=>MH,PreconditionFailure:()=>b6,ExecutionStatus:()=>Im,Arbitrary:()=>g0});var Ng=class Q{constructor(X){this.seed=X}clone(){return new Q(this.seed)}next(){let X=FW(this.seed),Y=RW(X),$=FW(X),J=RW($);return this.seed=FW($),RW(this.seed)+(J+(Y<<15)<<15)|0}jump(){this.seed=Math.imul(this.seed,1994129409)+916127744&4294967295}getState(){return[this.seed]}};function FW(Q){return Math.imul(Q,214013)+2531011&4294967295}function RW(Q){return(Q&-2147483649)>>16}function NR(Q){return new Ng(Q)}var Lg=class Q{constructor(X,Y){this.states=X,this.index=Y}clone(){return new Q(this.states.slice(),this.index)}next(){let X=this.states[this.index];return X^=X>>>11,X^=X<<7&2636928640,X^=X<<15&4022730752,X^=X>>>18,this.index=Y3(this.states,this.index),X}getState(){return[this.index,...this.states]}jump(){let X=this.states.slice(),Y=this.index;this.index=Y3(this.states,this.index);for(let $=19932;$>0;--$){if("SUSgbA\\W`E[]KN2RUSo8XVU?HKBFRl11E\\KoWOg5B]XEWG;BE;1:oVK[`B^Z9Qd23^XTnhL>]Unda4f[X;_j9H5QD=cN<5H`3bW>9bk1mjoI2fK0obmAAINOV:>Mek_V9dd<hZ\\gC3?Fm7FEk07QH_3PLm^@?^i\\QMkgP<]oLHmFnlecg5F@7U^@4jhZ?WZS0k@GHehmM36:5^9;>Hmm`co>k:KOSkSbIINb1VFf>LXgP>GUAQTD>Ci>XMGkUflLlb?_FaFUk@?5N7i70@;1o68ah@I<HFH7R2^J:G][Gf962ITWID9GWK8ElD2G5=DcHcL]cA]P2n7A=[<bInM;IHDQnJMReRXDWbVldnGEIPij`E08Xdci3@0c:IBbD4:Nk]?lEN9j^;T`0blZX7eiWE8c`<ak7j05FZi>AjUDh?M1B?^??FAXKThf<aBOXZf7jXYGK>R<;NHk3S9YhM7STJ6`:MIE`S@7298X8W>PNK=@;lLX<i\\TXLL<W@X[X54H]in8M;;n?kkQbajgAMY=Tf9b;ZKf0QUB2FHYWfnfkDoU9YkcLd95T>lK6GM1YL\\lid:J>KYS=iJ]Y>QlF>?R5_[5QeYC=66;A32Ac>OHk_ne^0g>bK:g;KFPgbGUcPR_Z=TX3H9d03bKZ2IhEPKBo>LSGWd0iFdV8C<Y:<>T[O6lC\\blaZ>GoAYP4clf^j1IfnZJ]QeDe2X<HE[LJNWnaCg[P]Co^:IRbWPY?97UePBlZNNHY6LOBM8P>=h?Ye:_f_Sb9Ki5GDYBF4dWeMfdg^ccPllNWM7G1\\UMdoYeOOD5^e@foA22G?ADYo5:FVG[bWo96;>3kc_c1Ab30>30;1@4F8g2hY?DJ4[LOL;ZLLKo2]jo>[KMDUcR279N_kF=3WL@Dd620bMTdA\\U9k``ef2iD9JgJ8CZBHS>F^Uk;<laeaeHS<15OSeS`PcSSKBRBFY]aQ=EgUXGNg=?d56`KA@2BejY0^[_DCX`L=CGMT=BW^6S1i@2ATBVk>3_ocRA>2U:4GPQ6o>5jX2HIcV3S@On6KB<[SKB?FC_AAji9agbBFkAi\\;4I\\UJ]c36Ub@[;gQACVGY<V]SDJBUU]La\\_a@JdOO8gm2T0DJMa:8Hf7>E]noQ[1Kambn??QQ]S?1i0oMGOijb\\aGY6lQ^CJ?9bFle8<eH4UUjBINX;n8@VOA5ah^URV49B[A?ONHhHAC1J5;;h0SXYlG^0W=eJdHh^K4SGe=1HZLLam;D<Q3AOdbPcdX``82\\jo0En8jRVGC73WMCF9`d:0heS?80?C188cSn7H9<daZ]MgS4Pb^1HkA:1PU^5>^h_g[RQV@PnYBRI_]`B]Bh@Uk03eXGY`I16L76H28X`R>IROMeNVUdU[:lghLhPCQZ:4a<30YBZCYnXe[?;jc8gKI2QH2MjnWBm4nGCZW`aVU2a;P<AMI25mlW_Nm][2?b6o851X@lAm]YZ`bWRF1g<Ga:T]1NXH5Veja5P9S9>:aNg:Th1Y=5o78K>LQ8hW@5S?I83Lk5Xk;j5@I3o[d:4RjE^oS30:WP9gC\\i8aSI>QRE@4lP:7lDg8g2`Ql[2I8aBU\\BQ?B4_clL9Q]S;^e1Ob5[>3JER2`c7B=o]fPOWO<DGi;Niba1PoWPPE_Q3aX0OB0mZej\\f_M[J4Y6]1`h2MkF[GiW8Q^d3^_=<I1N2Q7]2<2j[iP7V3V821FaI]A`93bC^Z\\G=WJ;^Ih?B97_iIF@\\Dl<eK1je8SNTWo_=XFMZH<<JYLZ^YQMPgYOV45K_:]kSI8^XlO0]GY=VUfe_C_F6TOcoAlVUH:o=WhhT@K`2KFhe<3\\KXQ>W:M?S_4S5d@J^`[AGA7@3]DnGSCO`\\?E8HT75^d9\\:m\\m1egIfk8cd6bD9\\eU8\\n[Pb0Cgd^S0n9kGJHb]i5XodlKHc34Fhi9K>0U5WK`>7Ff2^KL=WC6:kc?e5C^a1T1:4:^S5flXlGNIj08AfO?Dh7T7dWO>E]NI9?ob7B7P_h[4TEP[EU;GllFTnSmg9:\\[N]<SAoKP_kPlG56A:I3T6EG8Hj=XnUE`KT5U@OQ?]7[N^MFN1_NU4KO_3::Le`8IL9[1Z1H1;V3SC\\N3]S@4U[F2mhT5dYM7[4Pg_Na0_8WTH0`bgceQS8]EG;XgD4Ib4iLTP@kE79Mn>AYRJA1U5^Blhgno:aHVYc03c3J0Vc9FjEV^M75Zfd8kVC9>iJDk`AJ[6f7DK2D^DL\\AX:6b5h31XH;RQB\\N<ZSM=J;6L[`UW^eOIFc1Y]6_dfedIe4ARh72mTXC0WND_IDHVCZRDE0eODARCEETQI5TPUQE=jEH5bS?LP[ai`F5ABRYDo2o\\@=]GT?_9;hc4Lm:\\SF9k1T<0E@fX9BG[]g0nY7k[Qmi@la8`PF0j6@Q?Ii7bLkXQ<lLHf]`:DCh@9JY5>hEVLTdhL\\b1EB0lLh<=WaO@F<;8g<d:@e:LA:cFIEdmQh7hNHfSRToW?8N4:Z1K;XEDRO;OIDh<UdVln?bjgL>?VE98[B\\K<BVjkG8LiSX;fb>jf?DUK00Aih<WY6QD6cEnHBZ8iN_fd<G8Ci`11RUW2QlW]IXV:m?;J0GXXHfGNQ>:D`=fLPbO?VOTEYLj^cNj5PM>jKB5HVjJ4U7lXaTQNL9<@\\1`m\\Ug@VQHd7>jW=ca0`miF7;N0F=GjoQ`RFchKMGTmn8cF@Oh4GGCm7m2`U9j93Tb>=kSERjE_J939F01I1;`<ijk_=_Vn=7RVAI6fnQI5KlF:C44bN<<8K=Z<2TP<1]5?<dB>^LA=ebloE2Y2:9lkh0\\<YKbHD97iE`<C5oj^1>X:??`H6BXF2hG1Q[dF0Q=>W=J?7C\\k1T?<;R44oW?1hY^G8Zm]ZKnfOf0eCFYo6?=D8?<`6HU5SXh1;=:23LmV_FSi;OJfV<^?GkIDPISeHg1LaGE:V3Y3K3H<QJfbY?=;ldZRhnhQT_mGXDLFXXhSONE6Do_0iNZagB:BPGOTH;VhHUTd6LhQm^[;dO]5Hlkg<R:F<Kn\\:I:EGojgWZ2X@SYO_dlH;G8S<>oEKabY`:oU;=JW7ig?S?EYb86b7n8ce\\]IRa]koiWY<RfO;5kUI;7lVeC?[@ZaXDiF04B8R]bg@>O<mQDoUcBLcf^f>m2kMBUloD>Ze@NN^Z11TM`inXYhE_I=kA`:ZF4d\\>`L@;ZP[`ENU5cL[BV6\\Z?Di76:jg3hE6oG6jFc8kP=[GS1;WSedYQW1:U4\\OF32GgmMC<AjO]872bdBb`bKAA?8j78b>T3VfcUB2m4J^CPRU;8dScI]LU]^bBYA5_3:Y0N5i^?200000".charCodeAt($/6|0)-48&1<<$%6)LR(this.states,this.index,X,Y);this.index=Y3(this.states,this.index)}LR(this.states,this.index,X,Y)}};function LR(Q,X,Y,$){let J=0;if($>=X){for(;J<624-$;J++)Q[J+X]^=Y[J+$];for(;J<624-X;J++)Q[J+X]^=Y[J+$-624];for(;J<624;J++)Q[J+X-624]^=Y[J+$-624]}else{for(;J<624-X;J++)Q[J+X]^=Y[J+$];for(;J<624-$;J++)Q[J+X-624]^=Y[J+$];for(;J<624;J++)Q[J+X-624]^=Y[J+$-624]}}function Y3(Q,X){if(X<227){let Y=Q[X]&2147483648|Q[X+1]&2147483647;return Q[X]=Q[X+397]^Y>>>1^-(Y&1)&2567483615,X+1}else if(X<623){let Y=Q[X]&2147483648|Q[X+1]&2147483647;return Q[X]=Q[X+397-624]^Y>>>1^-(Y&1)&2567483615,X+1}else{let Y=Q[X]&2147483648|Q[0]&2147483647;return Q[X]=Q[396]^Y>>>1^-(Y&1)&2567483615,0}}function Mg(Q){for(let X=0;X!==624;++X)Y3(Q,X)}function MR(Q){let X=[Q|0];for(let Y=1;Y!==624;++Y){let $=X[Y-1]^X[Y-1]>>>30;X.push(Math.imul(1812433253,$)+Y|0)}return Mg(X),new Lg(X,0)}var wg=class Q{constructor(X,Y,$,J){this.s01=X,this.s00=Y,this.s11=$,this.s10=J}clone(){return new Q(this.s01,this.s00,this.s11,this.s10)}next(){let X=this.s00^this.s00<<23,Y=this.s01^(this.s01<<23|this.s00>>>9),$=X^this.s10^(X>>>18|Y<<14)^(this.s10>>>5|this.s11<<27),J=Y^this.s11^Y>>>18^this.s11>>>5,Z=this.s00+this.s10|0;return this.s01=this.s11,this.s00=this.s10,this.s11=J,this.s10=$,Z}jump(){let X=0,Y=0,$=0,J=0,Z=[1667051007,2321340297,1548169110,304075285];for(let G=0;G!==4;++G)for(let W=1;W;W<<=1){if(Z[G]&W)X^=this.s01,Y^=this.s00,$^=this.s11,J^=this.s10;this.next()}this.s01=X,this.s00=Y,this.s11=$,this.s10=J}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function NW(Q){return new wg(-1,~Q,Q|0,0)}var Pg=class Q{constructor(X,Y,$,J){this.s01=X,this.s00=Y,this.s11=$,this.s10=J}clone(){return new Q(this.s01,this.s00,this.s11,this.s10)}next(){let X=this.s00+this.s10|0,Y=this.s10^this.s00,$=this.s11^this.s01,J=this.s00,Z=this.s01;return this.s00=J<<24^Z>>>8^Y^Y<<16,this.s01=Z<<24^J>>>8^$^($<<16|Y>>>16),this.s10=$<<5^Y>>>27,this.s11=Y<<5^$>>>27,X}jump(){let X=0,Y=0,$=0,J=0,Z=[3639956645,3750757012,1261568508,386426335];for(let G=0;G!==4;++G)for(let W=1;W;W<<=1){if(Z[G]&W)X^=this.s01,Y^=this.s00,$^=this.s11,J^=this.s10;this.next()}this.s01=X,this.s00=Y,this.s11=$,this.s10=J}getState(){return[this.s01,this.s00,this.s11,this.s10]}};function wR(Q){return new Pg(-1,~Q,Q|0,0)}function PR(Q,X){for(let Y=0;Y!==X;++Y)Q.next()}var AR=BigInt,Ag=4294967296n;function jR(Q,X,Y){let $=Y-X+1n,J=Ag,Z=1;while(J<$)J<<=32n,++Z;let G=CR(Z,Q);if(G<$)return G+X;if(G+$<J)return G%$+X;let W=J-J%$;while(G>=W)G=CR(Z,Q);return G%$+X}function CR(Q,X){let Y=AR(X.next()+2147483648);for(let $=1;$<Q;++$){let J=X.next();Y=(Y<<32n)+AR(J+2147483648)}return Y}function uX(Q,X){let Y=X>2?~~(4294967296/X)*X:4294967296,$=Q.next()+2147483648;while($>=Y)$=Q.next()+2147483648;return $%X}function LW(Q,X){if(X<0){let Y=-X;Q.sign=-1,Q.data[0]=~~(Y/4294967296),Q.data[1]=Y>>>0}else Q.sign=1,Q.data[0]=~~(X/4294967296),Q.data[1]=X>>>0;return Q}function Cg(Q,X,Y){let $=X.data[1],J=X.data[0],Z=X.sign,G=Y.data[1],W=Y.data[0],H=Y.sign;if(Q.sign=1,Z===1&&H===-1){let F=$+G,N=J+W+(F>4294967295?1:0);return Q.data[0]=N>>>0,Q.data[1]=F>>>0,Q}let K=$,V=J,_=G,q=W;if(Z===-1)K=G,V=W,_=$,q=J;let D=0,B=K-_;if(B<0)D=1,B=B>>>0;return Q.data[0]=V-q-D,Q.data[1]=B,Q}function jg(Q,X,Y){let $=Y[0]+1;X[0]=uX(Q,$),X[1]=uX(Q,4294967296);while(X[0]>=Y[0]&&(X[0]!==Y[0]||X[1]>=Y[1]))X[0]=uX(Q,$),X[1]=uX(Q,4294967296);return X}var Tg=Number.MAX_SAFE_INTEGER,Ig={sign:1,data:[0,0]},Eg={sign:1,data:[0,0]},TR={sign:1,data:[0,0]},MW=[0,0];function Sg(Q,X,Y,$){let J=$<=Tg?LW(TR,$):Cg(TR,LW(Ig,Y),LW(Eg,X));if(J.data[1]===4294967295)J.data[0]+=1,J.data[1]=0;else J.data[1]+=1;return jg(Q,MW,J.data),MW[0]*4294967296+MW[1]+X}function $3(Q,X,Y){let $=Y-X;if($<=4294967295)return uX(Q,$+1)+X;return Sg(Q,X,Y,$)}var IR=Symbol.for("fast-check/PreconditionFailure"),b6=class extends Error{constructor(Q=!1){super();this.interruptExecution=Q,this.footprint=IR}static isFailure(Q){return Q!==null&&Q!==void 0&&Q.footprint===IR}};function vg(Q){if(!Q)throw new b6}var xg=class{[Symbol.iterator](){return this}next(Q){return{value:Q,done:!0}}},bg=new xg;function kg(){return bg}function*yg(Q,X){for(let Y of Q)yield X(Y)}function*gg(Q,X){for(let Y of Q)yield*X(Y)}function*hg(Q,X){for(let Y of Q)if(X(Y))yield Y}function*mg(Q,X){for(let Y=0;Y<X;++Y){let $=Q.next();if($.done)break;yield $.value}}function*dg(Q,X){let Y=Q.next();while(!Y.done&&X(Y.value))yield Y.value,Y=Q.next()}function*pg(Q,X){for(let Y=Q.next();!Y.done;Y=Q.next())yield Y.value;for(let Y of X)for(let $=Y.next();!$.done;$=Y.next())yield $.value}var fg=Symbol.iterator,G0=class Q{static nil(){return new Q(kg())}static of(...X){return new Q(X[fg]())}constructor(X){this.g=X}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(X){return new Q(yg(this.g,X))}flatMap(X){return new Q(gg(this.g,X))}dropWhile(X){let Y=!1;function*$(J){if(Y||!X(J))Y=!0,yield J}return this.flatMap($)}drop(X){if(X<=0)return this;let Y=0;function $(){return Y++<X}return this.dropWhile($)}takeWhile(X){return new Q(dg(this.g,X))}take(X){return new Q(mg(this.g,X))}filter(X){return new Q(hg(this.g,X))}every(X){for(let Y of this.g)if(!X(Y))return!1;return!0}has(X){for(let Y of this.g)if(X(Y))return[!0,Y];return[!1,null]}join(...X){return new Q(pg(this.g,X))}getNthOrLast(X){let Y=X,$=null;for(let J of this.g){if(Y--===0)return J;$=J}return $}};function v6(Q){return new G0(Q)}var Z1=Symbol.for("fast-check/cloneMethod");function E9(Q){return Q!==null&&(typeof Q==="object"||typeof Q==="function")&&Z1 in Q&&typeof Q[Z1]==="function"}function p5(Q){return E9(Q)?Q[Z1]():Q}var cg=Object.defineProperty,y=class{constructor(Q,X,Y){if(this.value_=Q,this.context=X,this.hasToBeCloned=Y!==void 0||E9(Q),this.readOnce=!1,this.value=Q,this.hasToBeCloned)cg(this,"value",{get:Y!==void 0?Y:this.getValue,enumerable:!1,configurable:!1})}getValue(){if(this.hasToBeCloned){if(!this.readOnce)return this.readOnce=!0,this.value_;return this.value_[Z1]()}return this.value_}},g0=class{filter(Q){return new og(this,Q)}map(Q,X){return new lg(this,Q,X)}chain(Q){return new ug(this,Q)}},ug=class extends g0{constructor(Q,X){super();this.arb=Q,this.chainer=X}generate(Q,X){let Y=Q.clone(),$=this.arb.generate(Q,X);return this.valueChainer($,Q,Y,X)}canShrinkWithoutContext(Q){return!1}shrink(Q,X){if(this.isSafeContext(X))return(!X.stoppedForOriginal?this.arb.shrink(X.originalValue,X.originalContext).map((Y)=>this.valueChainer(Y,X.clonedMrng.clone(),X.clonedMrng,X.originalBias)):G0.nil()).join(X.chainedArbitrary.shrink(Q,X.chainedContext).map((Y)=>{let $={...X,chainedContext:Y.context,stoppedForOriginal:!0};return new y(Y.value_,$)}));return G0.nil()}valueChainer(Q,X,Y,$){let J=this.chainer(Q.value_),Z=J.generate(X,$),G={originalBias:$,originalValue:Q.value_,originalContext:Q.context,stoppedForOriginal:!1,chainedArbitrary:J,chainedContext:Z.context,clonedMrng:Y};return new y(Z.value_,G)}isSafeContext(Q){return Q!==null&&Q!==void 0&&typeof Q==="object"&&"originalBias"in Q&&"originalValue"in Q&&"originalContext"in Q&&"stoppedForOriginal"in Q&&"chainedArbitrary"in Q&&"chainedContext"in Q&&"clonedMrng"in Q}};function CL(Q,X){let Y=Q.value,$=X(Y);if(Q.hasToBeCloned&&(typeof $==="object"&&$!==null||typeof $==="function")&&Object.isExtensible($)&&!E9($))Object.defineProperty($,Z1,{get:()=>()=>CL(Q,X)[0]});return[$,Y]}function ER(Q,X){let[Y,$]=CL(Q,X);return new y(Y,{originalValue:$,originalContext:Q.context})}var lg=class extends g0{constructor(Q,X,Y){super();this.arb=Q,this.mapper=X,this.unmapper=Y,this.bindValueMapper=($)=>ER($,X)}generate(Q,X){let Y=this.arb.generate(Q,X);if(!Y.hasToBeCloned){let $=Y.value;return new y(this.mapper($),{originalValue:$,originalContext:Y.context})}return ER(Y,this.mapper)}canShrinkWithoutContext(Q){if(this.unmapper!==void 0)try{let X=this.unmapper(Q);return this.arb.canShrinkWithoutContext(X)}catch{return!1}return!1}shrink(Q,X){if(this.isSafeContext(X))return this.arb.shrink(X.originalValue,X.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let Y=this.unmapper(Q);return this.arb.shrink(Y,void 0).map(this.bindValueMapper)}return G0.nil()}isSafeContext(Q){return Q!==null&&Q!==void 0&&typeof Q==="object"&&"originalValue"in Q&&"originalContext"in Q}},og=class extends g0{constructor(Q,X){super();this.arb=Q,this.refinement=X,this.bindRefinementOnValue=(Y)=>this.refinementOnValue(Y)}generate(Q,X){while(!0){let Y=this.arb.generate(Q,X);if(this.refinementOnValue(Y))return Y}}canShrinkWithoutContext(Q){return this.arb.canShrinkWithoutContext(Q)&&this.refinement(Q)}shrink(Q,X){return this.arb.shrink(Q,X).filter(this.bindRefinementOnValue)}refinementOnValue(Q){return this.refinement(Q.value)}};function jL(Q){return typeof Q==="object"&&Q!==null&&"generate"in Q&&"shrink"in Q&&"canShrinkWithoutContext"in Q}function TL(Q){if(!jL(Q))throw Error("Unexpected value received: not an instance of Arbitrary")}var IL=Function.prototype.apply,wW=Symbol("apply");function rg(Q){try{return Q.apply}catch{return}}function ig(Q,X,Y){let $=Q;$[wW]=IL;let J=$[wW](X,Y);return delete $[wW],J}function B0(Q,X,Y){if(rg(Q)===IL)return Q.apply(X,Y);return ig(Q,X,Y)}var EL=Array,k=BigInt,ng=BigInt64Array,ag=BigUint64Array,SL=Boolean,F3=Date,h=Error,vL=Float32Array,xL=Float64Array,sg=Int8Array,tg=Int16Array,eg=Int32Array,f4=Number,x1=String,c8=Set,Qh=Uint8Array,Xh=Uint8ClampedArray,Yh=Uint16Array,$h=Uint32Array,Jh=encodeURIComponent,c4=Map,_3=Symbol,SR=Array.prototype.forEach,vR=Array.prototype.indexOf,xR=Array.prototype.join,bR=Array.prototype.map,kR=Array.prototype.flat,yR=Array.prototype.filter,gR=Array.prototype.push,hR=Array.prototype.pop,mR=Array.prototype.splice,dR=Array.prototype.slice,pR=Array.prototype.sort,fR=Array.prototype.every;function Zh(Q){try{return Q.forEach}catch{return}}function Gh(Q){try{return Q.indexOf}catch{return}}function Wh(Q){try{return Q.join}catch{return}}function Hh(Q){try{return Q.map}catch{return}}function Kh(Q){try{return Q.flat}catch{return}}function Vh(Q){try{return Q.filter}catch{return}}function _h(Q){try{return Q.push}catch{return}}function qh(Q){try{return Q.pop}catch{return}}function Dh(Q){try{return Q.splice}catch{return}}function Uh(Q){try{return Q.slice}catch{return}}function Bh(Q){try{return Q.sort}catch{return}}function zh(Q){try{return Q.every}catch{return}}function bL(Q,X){if(Zh(Q)===SR)return Q.forEach(X);return B0(SR,Q,[X])}function nX(Q,...X){if(Gh(Q)===vR)return Q.indexOf(...X);return B0(vR,Q,X)}function y0(Q,...X){if(Wh(Q)===xR)return Q.join(...X);return B0(xR,Q,X)}function O0(Q,X){if(Hh(Q)===bR)return Q.map(X);return B0(bR,Q,[X])}function Oh(Q,X){if(Kh(Q)===kR)return[].flat(),Q.flat(X);return B0(kR,Q,[X])}function Fh(Q,X){if(Vh(Q)===yR)return Q.filter(X);return B0(yR,Q,[X])}function T(Q,...X){if(_h(Q)===gR)return Q.push(...X);return B0(gR,Q,X)}function kL(Q){if(qh(Q)===hR)return Q.pop();return B0(hR,Q,[])}function yL(Q,...X){if(Dh(Q)===mR)return Q.splice(...X);return B0(mR,Q,X)}function $1(Q,...X){if(Uh(Q)===dR)return Q.slice(...X);return B0(dR,Q,X)}function gL(Q,...X){if(Bh(Q)===pR)return Q.sort(...X);return B0(pR,Q,X)}function hL(Q,...X){if(zh(Q)===fR)return Q.every(...X);return B0(fR,Q,X)}var cR=Date.prototype.getTime,uR=Date.prototype.toISOString;function Rh(Q){try{return Q.getTime}catch{return}}function Nh(Q){try{return Q.toISOString}catch{return}}function R3(Q){if(Rh(Q)===cR)return Q.getTime();return B0(cR,Q,[])}function Lh(Q){if(Nh(Q)===uR)return Q.toISOString();return B0(uR,Q,[])}var lR=Set.prototype.add,oR=Set.prototype.has;function Mh(Q){try{return Q.add}catch{return}}function wh(Q){try{return Q.has}catch(X){return}}function aX(Q,X){if(Mh(Q)===lR)return Q.add(X);return B0(lR,Q,[X])}function I6(Q,X){if(wh(Q)===oR)return Q.has(X);return B0(oR,Q,[X])}var rR=WeakMap.prototype.set,iR=WeakMap.prototype.get;function Ph(Q){try{return Q.set}catch(X){return}}function Ah(Q){try{return Q.get}catch(X){return}}function Ch(Q,X,Y){if(Ph(Q)===rR)return Q.set(X,Y);return B0(rR,Q,[X,Y])}function jh(Q,X){if(Ah(Q)===iR)return Q.get(X);return B0(iR,Q,[X])}var nR=Map.prototype.set,aR=Map.prototype.get,sR=Map.prototype.has;function Th(Q){try{return Q.set}catch(X){return}}function Ih(Q){try{return Q.get}catch(X){return}}function Eh(Q){try{return Q.has}catch(X){return}}function f8(Q,X,Y){if(Th(Q)===nR)return Q.set(X,Y);return B0(nR,Q,[X,Y])}function G8(Q,X){if(Ih(Q)===aR)return Q.get(X);return B0(aR,Q,[X])}function Sh(Q,X){if(Eh(Q)===sR)return Q.has(X);return B0(sR,Q,[X])}var tR=String.prototype.split,eR=String.prototype.startsWith,QN=String.prototype.endsWith,XN=String.prototype.substring,YN=String.prototype.toLowerCase,$N=String.prototype.toUpperCase,JN=String.prototype.padStart,ZN=String.prototype.charCodeAt,GN=String.prototype.normalize,WN=String.prototype.replace;function vh(Q){try{return Q.split}catch{return}}function xh(Q){try{return Q.startsWith}catch{return}}function bh(Q){try{return Q.endsWith}catch{return}}function kh(Q){try{return Q.substring}catch{return}}function yh(Q){try{return Q.toLowerCase}catch{return}}function gh(Q){try{return Q.toUpperCase}catch{return}}function hh(Q){try{return Q.padStart}catch{return}}function mh(Q){try{return Q.charCodeAt}catch{return}}function dh(Q){try{return Q.normalize}catch(X){return}}function ph(Q){try{return Q.replace}catch{return}}function b1(Q,...X){if(vh(Q)===tR)return Q.split(...X);return B0(tR,Q,X)}function fh(Q,...X){if(xh(Q)===eR)return Q.startsWith(...X);return B0(eR,Q,X)}function ch(Q,...X){if(bh(Q)===QN)return Q.endsWith(...X);return B0(QN,Q,X)}function d0(Q,...X){if(kh(Q)===XN)return Q.substring(...X);return B0(XN,Q,X)}function rW(Q){if(yh(Q)===YN)return Q.toLowerCase();return B0(YN,Q,[])}function BH(Q){if(gh(Q)===$N)return Q.toUpperCase();return B0($N,Q,[])}function uh(Q,...X){if(hh(Q)===JN)return Q.padStart(...X);return B0(JN,Q,X)}function f5(Q,X){if(mh(Q)===ZN)return Q.charCodeAt(X);return B0(ZN,Q,[X])}function lh(Q,X){if(dh(Q)===GN)return Q.normalize(X);return B0(GN,Q,[X])}function oh(Q,X,Y){if(ph(Q)===WN)return Q.replace(X,Y);return B0(WN,Q,[X,Y])}var HN=Number.prototype.toString;function rh(Q){try{return Q.toString}catch{return}}function sX(Q,...X){if(rh(Q)===HN)return Q.toString(...X);return B0(HN,Q,X)}var ih=Object.prototype.hasOwnProperty,nh=Object.prototype.toString;function mL(Q,X){return B0(ih,Q,[X])}function iW(Q){return B0(nh,Q,[])}var ah=Error.prototype.toString;function sh(Q){return B0(ah,Q,[])}var th=class{constructor(Q){this.producer=Q}[Symbol.iterator](){if(this.it===void 0)this.it=this.producer();return this.it}next(){if(this.it===void 0)this.it=this.producer();return this.it.next()}};function S6(Q){return new th(Q)}var dL=Array.isArray,eh=Object.defineProperty;function zH(Q,X,Y){return eh(Q,Z1,{value:()=>{let $=[];for(let J=0;J!==Y.length;++J){let Z=Y[J];if(Z===void 0)Z=new y(Q[J],X[J]);T($,Z.value)}return zH($,X,Y),$}})}function pL(Q,X,Y){let $=[],J=dL(Y)?Y:[];for(let Z=0;Z!==Q.length;++Z)T($,S6(()=>Q[Z].shrink(X[Z],J[Z]).map((G)=>{let W=!1,H=[],K=[],V=[];for(let _=0;_!==Q.length;++_){let q=_===Z?G:new y(p5(X[_]),J[_]);if(q.hasToBeCloned)W=!0,V[_]=q;T(H,q.value),T(K,q.context)}if(W)zH(H,K,V);return new y(H,K)})));return G0.nil().join(...$)}var Qm=class extends g0{constructor(Q){super();this.arbs=Q;for(let X=0;X!==Q.length;++X){let Y=Q[X];if(Y===null||Y===void 0||Y.generate===null||Y.generate===void 0)throw Error(`Invalid parameter encountered at index ${X}: expecting an Arbitrary`)}}generate(Q,X){let Y=!1,$=[],J=[],Z=[];for(let G=0;G!==this.arbs.length;++G){let W=this.arbs[G].generate(Q,X);if(W.hasToBeCloned)Y=!0,Z[G]=W;T($,W.value),T(J,W.context)}if(Y)zH($,J,Z);return new y($,J)}canShrinkWithoutContext(Q){if(!dL(Q)||Q.length!==this.arbs.length)return!1;for(let X=0;X!==this.arbs.length;++X)if(!this.arbs[X].canShrinkWithoutContext(Q[X]))return!1;return!0}shrink(Q,X){return pL(this.arbs,Q,X)}};function Z0(...Q){return new Qm(Q)}var Xm=Math.log;function fL(Q){return 2+~~(Xm(Q+1)*0.4342944819032518)}var OH={};function Ym(Q){OH=Q}function u8(){return OH}function $m(){OH={}}var tX=Symbol("UndefinedContextPlaceholder");function c5(Q){if(Q.context!==void 0)return Q;if(Q.hasToBeCloned)return new y(Q.value_,tX,()=>Q.value);return new y(Q.value_,tX)}var KN=()=>{},Jm=class{constructor(Q,X){this.arb=Q,this.predicate=X;let{asyncBeforeEach:Y,asyncAfterEach:$,beforeEach:J,afterEach:Z}=u8()||{};if(Y!==void 0&&J!==void 0)throw h(`Global "asyncBeforeEach" and "beforeEach" parameters can't be set at the same time when running async properties`);if($!==void 0&&Z!==void 0)throw h(`Global "asyncAfterEach" and "afterEach" parameters can't be set at the same time when running async properties`);this.beforeEachHook=Y||J||KN,this.afterEachHook=$||Z||KN}isAsync(){return!0}generate(Q,X){return c5(this.arb.generate(Q,X!==void 0?fL(X):void 0))}shrink(Q){if(Q.context===void 0&&!this.arb.canShrinkWithoutContext(Q.value_))return G0.nil();let X=Q.context!==tX?Q.context:void 0;return this.arb.shrink(Q.value_,X).map(c5)}async runBeforeEach(){await this.beforeEachHook()}async runAfterEach(){await this.afterEachHook()}async run(Q){try{let X=await this.predicate(Q);return X===void 0||X===!0?null:{error:new h("Property failed by returning false")}}catch(X){if(b6.isFailure(X))return X;return{error:X}}}beforeEach(Q){let X=this.beforeEachHook;return this.beforeEachHook=()=>Q(X),this}afterEach(Q){let X=this.afterEachHook;return this.afterEachHook=()=>Q(X),this}},cL=class extends g0{constructor(Q){super();this.arb=Q}generate(Q,X){return c5(this.arb.generate(Q,X))}canShrinkWithoutContext(Q){return!0}shrink(Q,X){if(X===void 0&&!this.arb.canShrinkWithoutContext(Q))return G0.nil();let Y=X!==tX?X:void 0;return this.arb.shrink(Q,Y).map(c5)}};function Zm(...Q){if(Q.length<2)throw Error("asyncProperty expects at least two parameters");let X=$1(Q,0,Q.length-1),Y=Q[Q.length-1];return bL(X,TL),new Jm(Z0(...O0(X,($)=>new cL($))),($)=>Y(...$))}var VN=()=>{},uL=class{constructor(Q,X){this.arb=Q,this.predicate=X;let{beforeEach:Y=VN,afterEach:$=VN,asyncBeforeEach:J,asyncAfterEach:Z}=u8()||{};if(J!==void 0)throw h(`"asyncBeforeEach" can't be set when running synchronous properties`);if(Z!==void 0)throw h(`"asyncAfterEach" can't be set when running synchronous properties`);this.beforeEachHook=Y,this.afterEachHook=$}isAsync(){return!1}generate(Q,X){return c5(this.arb.generate(Q,X!==void 0?fL(X):void 0))}shrink(Q){if(Q.context===void 0&&!this.arb.canShrinkWithoutContext(Q.value_))return G0.nil();let X=Q.context!==tX?Q.context:void 0;return this.arb.shrink(Q.value_,X).map(c5)}runBeforeEach(){this.beforeEachHook()}runAfterEach(){this.afterEachHook()}run(Q){try{let X=this.predicate(Q);return X===void 0||X===!0?null:{error:new h("Property failed by returning false")}}catch(X){if(b6.isFailure(X))return X;return{error:X}}}beforeEach(Q){let X=this.beforeEachHook;return this.beforeEachHook=()=>Q(X),this}afterEach(Q){let X=this.afterEachHook;return this.afterEachHook=()=>Q(X),this}};function Gm(...Q){if(Q.length<2)throw Error("property expects at least two parameters");let X=$1(Q,0,Q.length-1),Y=Q[Q.length-1];return bL(X,TL),new uL(Z0(...O0(X,($)=>new cL($))),($)=>Y(...$))}var Wm=function(Q){return Q[Q.None=0]="None",Q[Q.Verbose=1]="Verbose",Q[Q.VeryVerbose=2]="VeryVerbose",Q}({});function nW(Q){if("unsafeNext"in Q){if(Q.unsafeJump===void 0)return{clone:()=>nW(Q),next:()=>Q.unsafeNext(),getState:()=>Q.getState()};return{clone:()=>nW(Q),next:()=>Q.unsafeNext(),jump:()=>Q.unsafeJump(),getState:()=>Q.getState()}}return Q}function lL(Q){if("jump"in Q&&typeof Q.jump==="function")return Q;return{clone:()=>lL(Q),next:()=>Q.next(),jump:()=>PR(Q,42),getState:()=>Q.getState()}}function P3(Q){return lL(nW(Q))}var Hm=Date.now,Km=Math.min,Vm=Math.random,_m=class{constructor(Q){let X=Q||{};this.seed=qm(X),this.randomType=Dm(X),this.numRuns=Um(X),this.verbose=Bm(X),this.maxSkipsPerRun=X.maxSkipsPerRun!==void 0?X.maxSkipsPerRun:100,this.timeout=AW(X.timeout),this.skipAllAfterTimeLimit=AW(X.skipAllAfterTimeLimit),this.interruptAfterTimeLimit=AW(X.interruptAfterTimeLimit),this.markInterruptAsFailure=X.markInterruptAsFailure===!0,this.skipEqualValues=X.skipEqualValues===!0,this.ignoreEqualValues=X.ignoreEqualValues===!0,this.logger=X.logger!==void 0?X.logger:(Y)=>{console.log(Y)},this.path=X.path!==void 0?X.path:"",this.unbiased=X.unbiased===!0,this.examples=X.examples!==void 0?X.examples:[],this.endOnFailure=X.endOnFailure===!0,this.reporter=X.reporter,this.asyncReporter=X.asyncReporter,this.includeErrorInReport=X.includeErrorInReport===!0}toParameters(){return{seed:this.seed,randomType:this.randomType,numRuns:this.numRuns,maxSkipsPerRun:this.maxSkipsPerRun,timeout:this.timeout,skipAllAfterTimeLimit:this.skipAllAfterTimeLimit,interruptAfterTimeLimit:this.interruptAfterTimeLimit,markInterruptAsFailure:this.markInterruptAsFailure,skipEqualValues:this.skipEqualValues,ignoreEqualValues:this.ignoreEqualValues,path:this.path,logger:this.logger,unbiased:this.unbiased,verbose:this.verbose,examples:this.examples,endOnFailure:this.endOnFailure,reporter:this.reporter,asyncReporter:this.asyncReporter,includeErrorInReport:this.includeErrorInReport}}};function PW(Q){return(X)=>{return P3(Q(X))}}function qm(Q){if(Q.seed===void 0)return Hm()^Vm()*4294967296;let X=Q.seed|0;if(Q.seed===X)return X;return X^(Q.seed-X)*4294967296}function Dm(Q){if(Q.randomType===void 0)return NW;if(typeof Q.randomType==="string")switch(Q.randomType){case"mersenne":return PW(MR);case"congruential":case"congruential32":return PW(NR);case"xorshift128plus":return NW;case"xoroshiro128plus":return wR;default:throw Error(`Invalid random specified: '${Q.randomType}'`)}let X=Q.randomType(0);if("min"in X&&X.min!==-2147483648)throw Error(`Invalid random number generator: min must equal -0x80000000, got ${String(X.min)}`);if("max"in X&&X.max!==2147483647)throw Error(`Invalid random number generator: max must equal 0x7fffffff, got ${String(X.max)}`);if(X===P3(X))return Q.randomType;return PW(Q.randomType)}function Um(Q){if(Q.numRuns!==void 0)return Q.numRuns;if(Q.num_runs!==void 0)return Q.num_runs;return 100}function Bm(Q){if(Q.verbose===void 0)return 0;if(typeof Q.verbose==="boolean")return Q.verbose===!0?1:0;if(Q.verbose<=0)return 0;if(Q.verbose>=2)return 2;return Q.verbose|0}function AW(Q){if(Q===void 0)return;return Km(Q,2147483647)}function FH(Q){return new _m(Q)}function zm(Q,X,Y){let $=null;return{clear:()=>Y($),promise:new Promise((J)=>{$=X(()=>{J(new b6(!0))},Q)})}}var _N=class{constructor(Q,X,Y,$,J,Z){this.property=Q,this.getTime=X,this.interruptExecution=$,this.setTimeoutSafe=J,this.clearTimeoutSafe=Z,this.skipAfterTime=this.getTime()+Y}isAsync(){return this.property.isAsync()}generate(Q,X){return this.property.generate(Q,X)}shrink(Q){return this.property.shrink(Q)}run(Q){let X=this.skipAfterTime-this.getTime();if(X<=0){let Y=new b6(this.interruptExecution);if(this.isAsync())return Promise.resolve(Y);else return Y}if(this.interruptExecution&&this.isAsync()){let Y=zm(X,this.setTimeoutSafe,this.clearTimeoutSafe),$=Promise.race([this.property.run(Q),Y.promise]);return $.then(Y.clear,Y.clear),$}return this.property.run(Q)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},Om=(Q,X,Y)=>{let $=null;return{clear:()=>Y($),promise:new Promise((J)=>{$=X(()=>{J({error:new h(`Property timeout: exceeded limit of ${Q} milliseconds`)})},Q)})}},Fm=class{constructor(Q,X,Y,$){this.property=Q,this.timeMs=X,this.setTimeoutSafe=Y,this.clearTimeoutSafe=$}isAsync(){return!0}generate(Q,X){return this.property.generate(Q,X)}shrink(Q){return this.property.shrink(Q)}async run(Q){let X=Om(this.timeMs,this.setTimeoutSafe,this.clearTimeoutSafe),Y=Promise.race([this.property.run(Q),X.promise]);return Y.then(X.clear,X.clear),Y}runBeforeEach(){return Promise.resolve(this.property.runBeforeEach())}runAfterEach(){return Promise.resolve(this.property.runAfterEach())}},oL=class{constructor(Q){this.property=Q}isAsync(){return this.property.isAsync()}generate(Q,X){return this.property.generate(Q,void 0)}shrink(Q){return this.property.shrink(Q)}run(Q){return this.property.run(Q)}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},qN=Array.from,DN=typeof Buffer<"u"?Buffer.isBuffer:void 0,g5=JSON.stringify,UN=Number.isNaN,Rm=Object.keys,Nm=Object.getOwnPropertySymbols,Lm=Object.getOwnPropertyDescriptor,BN=Object.getPrototypeOf,zN=Number.NEGATIVE_INFINITY,Mm=Number.POSITIVE_INFINITY,l8=Symbol.for("fast-check/toStringMethod");function RH(Q){return Q!==null&&(typeof Q==="object"||typeof Q==="function")&&l8 in Q&&typeof Q[l8]==="function"}var u4=Symbol.for("fast-check/asyncToStringMethod");function NH(Q){return Q!==null&&(typeof Q==="object"||typeof Q==="function")&&u4 in Q&&typeof Q[u4]==="function"}var wm=/^Symbol\((.*)\)$/;function Pm(Q){if(Q.description!==void 0)return Q.description;let X=wm.exec(x1(Q));return X&&X[1].length?X[1]:null}function ON(Q){switch(Q){case 0:return 1/Q===zN?"-0":"0";case zN:return"Number.NEGATIVE_INFINITY";case Mm:return"Number.POSITIVE_INFINITY";default:return Q===Q?x1(Q):"Number.NaN"}}function Am(Q){let X=-1;for(let Y in Q){let $=Number(Y);if($!==X+1)return!0;X=$}return X+1!==Q.length}function Z8(Q,X,Y){let $=[...X,Q];if(typeof Q==="object"){if(nX(X,Q)!==-1)return"[cyclic]"}if(NH(Q)){let J=Y(Q);if(J.state==="fulfilled")return J.value}if(RH(Q))try{return Q[l8]()}catch{}switch(iW(Q)){case"[object Array]":{let J=Q;if(J.length>=50&&Am(J)){let G=[];for(let W in J)if(!UN(Number(W)))T(G,`${W}:${Z8(J[W],$,Y)}`);return G.length!==0?`Object.assign(Array(${J.length}),{${y0(G,",")}})`:`Array(${J.length})`}let Z=y0(O0(J,(G)=>Z8(G,$,Y)),",");return J.length===0||J.length-1 in J?`[${Z}]`:`[${Z},]`}case"[object BigInt]":return`${Q}n`;case"[object Boolean]":{let J=Q==!0?"true":"false";return typeof Q==="boolean"?J:`new Boolean(${J})`}case"[object Date]":{let J=Q;return UN(R3(J))?"new Date(NaN)":`new Date(${g5(Lh(J))})`}case"[object Map]":return`new Map(${Z8(Array.from(Q),$,Y)})`;case"[object Null]":return"null";case"[object Number]":return typeof Q==="number"?ON(Q):`new Number(${ON(Number(Q))})`;case"[object Object]":{try{let Z=Q.toString;if(typeof Z==="function"&&Z!==Object.prototype.toString)return Q.toString()}catch{return"[object Object]"}let J=(Z)=>`${Z==="__proto__"?'["__proto__"]':typeof Z==="symbol"?`[${Z8(Z,$,Y)}]`:g5(Z)}:${Z8(Q[Z],$,Y)}`;return"{"+y0([...BN(Q)===null?["__proto__:null"]:[],...O0(Rm(Q),J),...O0(Fh(Nm(Q),(Z)=>{let G=Lm(Q,Z);return G&&G.enumerable}),J)],",")+"}"}case"[object Set]":return`new Set(${Z8(Array.from(Q),$,Y)})`;case"[object String]":return typeof Q==="string"?g5(Q):`new String(${g5(Q)})`;case"[object Symbol]":{let J=Q;if(_3.keyFor(J)!==void 0)return`Symbol.for(${g5(_3.keyFor(J))})`;let Z=Pm(J);if(Z===null)return"Symbol()";return J===(Z.startsWith("Symbol.")&&_3[Z.substring(7)])?Z:`Symbol(${g5(Z)})`}case"[object Promise]":{let J=Y(Q);switch(J.state){case"fulfilled":return`Promise.resolve(${Z8(J.value,$,Y)})`;case"rejected":return`Promise.reject(${Z8(J.value,$,Y)})`;case"pending":return"new Promise(() => {/*pending*/})";default:return"new Promise(() => {/*unknown*/})"}}case"[object Error]":if(Q instanceof Error)return`new Error(${Z8(Q.message,$,Y)})`;break;case"[object Undefined]":return"undefined";case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":case"[object BigInt64Array]":case"[object BigUint64Array]":{if(typeof DN==="function"&&DN(Q))return`Buffer.from(${Q.buffer.detached?"/*detached ArrayBuffer*/":Z8(qN(Q.values()),$,Y)})`;let J=BN(Q),Z=J&&J.constructor&&J.constructor.name;if(typeof Z==="string"){let G=Q;if(G.buffer.detached)return`${Z}.from(/*detached ArrayBuffer*/)`;let W=G.values();return`${Z}.from(${Z8(qN(W),$,Y)})`}break}}try{return Q.toString()}catch{return iW(Q)}}function o0(Q){return Z8(Q,[],()=>({state:"unknown",value:void 0}))}function rL(Q){let X=_3(),Y=[],$=new c4;function J(){let H=null,K=()=>{if(H!==null)clearTimeout(H)};return{delay:new Promise((V)=>{H=setTimeout(()=>{H=null,V(X)},0)}),cancel:K}}let Z={state:"unknown",value:void 0},G=function(K){let V=K;if($.has(V))return $.get(V);let _=J(),q=u4 in K?Promise.resolve().then(()=>K[u4]()):K;return q.catch(()=>{}),Y.push(Promise.race([q,_.delay]).then((D)=>{if(D===X)$.set(V,{state:"pending",value:void 0});else $.set(V,{state:"fulfilled",value:D});_.cancel()},(D)=>{$.set(V,{state:"rejected",value:D}),_.cancel()})),$.set(V,Z),Z};function W(){let H=Z8(Q,[],G);if(Y.length===0)return H;return Promise.all(Y.splice(0)).then(W)}return W()}async function LH(Q){return Promise.resolve(rL(Q))}function FN(Q){return Q===null?new b6:Q}function Cm(...Q){if(Q[1])return Q[0].then(FN);return FN(Q[0])}function jm(Q,X){return Cm(Q,X)}var RN=class{constructor(Q,X){this.property=Q,this.skipRuns=X,this.coveredCases=new Map}isAsync(){return this.property.isAsync()}generate(Q,X){return this.property.generate(Q,X)}shrink(Q){return this.property.shrink(Q)}run(Q){let X=o0(Q);if(this.coveredCases.has(X)){let $=this.coveredCases.get(X);if(!this.skipRuns)return $;return jm($,this.property.isAsync())}let Y=this.property.run(Q);return this.coveredCases.set(X,Y),Y}runBeforeEach(){return this.property.runBeforeEach()}runAfterEach(){return this.property.runAfterEach()}},NN=Date.now,CW=setTimeout,jW=clearTimeout;function Tm(Q,X){let Y=Q;if(Q.isAsync()&&X.timeout!==void 0)Y=new Fm(Y,X.timeout,CW,jW);if(X.unbiased)Y=new oL(Y);if(X.skipAllAfterTimeLimit!==void 0)Y=new _N(Y,NN,X.skipAllAfterTimeLimit,!1,CW,jW);if(X.interruptAfterTimeLimit!==void 0)Y=new _N(Y,NN,X.interruptAfterTimeLimit,!0,CW,jW);if(X.skipEqualValues)Y=new RN(Y,!0);if(X.ignoreEqualValues)Y=new RN(Y,!1);return Y}var Im=function(Q){return Q[Q.Success=0]="Success",Q[Q.Skipped=-1]="Skipped",Q[Q.Failure=1]="Failure",Q}({}),Em=class Q{constructor(X,Y){this.verbosity=X,this.interruptedAsFailure=Y,this.rootExecutionTrees=[],this.currentLevelExecutionTrees=this.rootExecutionTrees,this.failure=null,this.numSkips=0,this.numSuccesses=0,this.interrupted=!1}appendExecutionTree(X,Y){let $={status:X,value:Y,children:[]};return this.currentLevelExecutionTrees.push($),$}fail(X,Y,$){if(this.verbosity>=1){let J=this.appendExecutionTree(1,X);this.currentLevelExecutionTrees=J.children}if(this.pathToFailure===void 0)this.pathToFailure=`${Y}`;else this.pathToFailure+=`:${Y}`;this.value=X,this.failure=$}skip(X){if(this.verbosity>=2)this.appendExecutionTree(-1,X);if(this.pathToFailure===void 0)++this.numSkips}success(X){if(this.verbosity>=2)this.appendExecutionTree(0,X);if(this.pathToFailure===void 0)++this.numSuccesses}interrupt(){this.interrupted=!0}isSuccess(){return this.pathToFailure===void 0}firstFailure(){return this.pathToFailure!==void 0?+b1(this.pathToFailure,":")[0]:-1}numShrinks(){return this.pathToFailure!==void 0?b1(this.pathToFailure,":").length-1:0}extractFailures(){if(this.isSuccess())return[];let X=[],Y=this.rootExecutionTrees;while(Y.length>0&&Y[Y.length-1].status===1){let $=Y[Y.length-1];X.push($.value),Y=$.children}return X}static mergePaths(X,Y){if(X.length===0)return Y;let $=X.split(":"),J=Y.split(":"),Z=+$[$.length-1]+ +J[0];return[...$.slice(0,$.length-1),`${Z}`,...J.slice(1)].join(":")}toRunDetails(X,Y,$,J){if(!this.isSuccess())return{failed:!0,interrupted:this.interrupted,numRuns:this.firstFailure()+1-this.numSkips,numSkips:this.numSkips,numShrinks:this.numShrinks(),seed:X,counterexample:this.value,counterexamplePath:Q.mergePaths(Y,this.pathToFailure),errorInstance:this.failure.error,failures:this.extractFailures(),executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:J.toParameters()};let Z=this.interruptedAsFailure||this.numSuccesses===0;return{failed:this.numSkips>$||this.interrupted&&Z,interrupted:this.interrupted,numRuns:this.numSuccesses,numSkips:this.numSkips,numShrinks:0,seed:X,counterexample:null,counterexamplePath:null,error:null,errorInstance:null,failures:[],executionSummary:this.rootExecutionTrees,verbose:this.verbosity,runConfiguration:J.toParameters()}}},iL=class{constructor(Q,X,Y,$){this.sourceValues=Q,this.shrink=X,this.runExecution=new Em(Y,$),this.currentIdx=-1,this.nextValues=Q}[Symbol.iterator](){return this}next(){let Q=this.nextValues.next();if(Q.done||this.runExecution.interrupted)return{done:!0,value:void 0};return this.currentValue=Q.value,++this.currentIdx,{done:!1,value:Q.value.value_}}handleResult(Q){if(Q!==null&&typeof Q==="object"&&!b6.isFailure(Q))this.runExecution.fail(this.currentValue.value_,this.currentIdx,Q),this.currentIdx=-1,this.nextValues=this.shrink(this.currentValue);else if(Q!==null)if(!Q.interruptExecution)this.runExecution.skip(this.currentValue.value_),this.sourceValues.skippedOne();else this.runExecution.interrupt();else this.runExecution.success(this.currentValue.value_)}},Sm=class{constructor(Q,X,Y){this.initialValues=Q,this.maxInitialIterations=X,this.remainingSkips=Y}[Symbol.iterator](){return this}next(){if(--this.maxInitialIterations!==-1&&this.remainingSkips>=0){let Q=this.initialValues.next();if(!Q.done)return{value:Q.value,done:!1}}return{value:void 0,done:!0}}skippedOne(){--this.remainingSkips,++this.maxInitialIterations}},vm=-2147483648,xm=2147483647,bm=Math.pow(2,27),km=Math.pow(2,-53),MH=class Q{constructor(X){this.internalRng=P3(X.clone())}clone(){return new Q(this.internalRng)}next(X){return $3(this.internalRng,0,(1<<X)-1)}nextBoolean(){return $3(this.internalRng,0,1)===1}nextInt(X,Y){return $3(this.internalRng,X===void 0?vm:X,Y===void 0?xm:Y)}nextBigInt(X,Y){return jR(this.internalRng,X,Y)}nextDouble(){let X=this.next(26),Y=this.next(27);return(X*bm+Y)*km}getState(){if("getState"in this.internalRng&&typeof this.internalRng.getState==="function")return this.internalRng.getState()}};function ym(Q,X,Y){return X.jump(),Q.generate(new MH(X),Y)}function*nL(Q,X,Y,$){for(let J=0;J!==$.length;++J)yield new y($[J],void 0);for(let J=0,Z=Y(X);;++J)yield ym(Q,Z,J)}function gm(Q,X,Y){return()=>Q.generate(new MH(X),Y)}function*aL(Q,X,Y,$){yield*O0($,(G)=>()=>new y(G,void 0));let J=0,Z=P3(Y(X));for(;;)Z.jump(),yield gm(Q,Z,J++)}function LN(Q){return Q()}function sL(Q,X,Y){let $=X,J=Q.split(":").map((G)=>+G);if(J.length===0)return $.map(LN);if(!J.every((G)=>!Number.isNaN(G)))throw Error(`Unable to replay, got invalid path=${Q}`);let Z=$.drop(J[0]).map(LN);for(let G of J.slice(1)){let W=Z.getNthOrLast(0);if(W===null)throw Error(`Unable to replay, got wrong path=${Q}`);Z=Y(W).drop(G)}return Z}var hm=Object.assign;function mm(Q){if(Q.length===1)return`Hint: ${Q[0]}`;return Q.map((X,Y)=>`Hint (${Y+1}): ${X}`).join(`
|
|
30
|
-
`)}function dm(Q,X){return`Encountered failures were:
|
|
31
|
-
- ${Q.map(X).join(`
|
|
32
|
-
- `)}`}function wH(Q,X){let Y=[],$=[];for(let J=Q.length-1;J>=0;--J)$.push({depth:1,tree:Q[J]});while($.length!==0){let J=$.pop(),Z=J.tree,G=J.depth,W=Z.status===0?"\x1B[32m\u221A\x1B[0m":Z.status===1?"\x1B[31m\xD7\x1B[0m":"\x1B[33m!\x1B[0m",H=G!==0?". ".repeat(G-1):"";Y.push(`${H}${W} ${X(Z.value)}`);for(let K=Z.children.length-1;K>=0;--K)$.push({depth:G+1,tree:Z.children[K]})}return`Execution summary:
|
|
33
|
-
${Y.join(`
|
|
34
|
-
`)}`}function pm(Q,X){let Y=`Failed to run property, too many pre-condition failures encountered
|
|
35
|
-
{ seed: ${Q.seed} }
|
|
36
|
-
|
|
37
|
-
Ran ${Q.numRuns} time(s)
|
|
38
|
-
Skipped ${Q.numSkips} time(s)`,$=null,J=["Try to reduce the number of rejected values by combining map, chain and built-in arbitraries","Increase failure tolerance by setting maxSkipsPerRun to an higher value"];if(Q.verbose>=2)$=wH(Q.executionSummary,X);else T(J,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status");return{message:Y,details:$,hints:J}}function fm(Q){if(Q instanceof h&&Q.stack!==void 0)return Q.stack;try{return x1(Q)}catch(X){}if(Q instanceof h)try{return sh(Q)}catch(X){}if(Q!==null&&typeof Q==="object")try{return iW(Q)}catch(X){}return"Failed to serialize errorInstance"}function cm(Q,X){let Y=Q.runConfiguration.includeErrorInReport?`
|
|
39
|
-
Got ${oh(fm(Q.errorInstance),/^Error: /,"error: ")}`:"",$=`Property failed after ${Q.numRuns} tests
|
|
40
|
-
{ seed: ${Q.seed}, path: "${Q.counterexamplePath}", endOnFailure: true }
|
|
41
|
-
Counterexample: ${X(Q.counterexample)}
|
|
42
|
-
Shrunk ${Q.numShrinks} time(s)${Y}`,J=null,Z=[];if(Q.verbose>=2)J=wH(Q.executionSummary,X);else if(Q.verbose===1)J=dm(Q.failures,X);else T(Z,"Enable verbose mode in order to have the list of all failing values encountered during the run");return{message:$,details:J,hints:Z}}function um(Q,X){let Y=`Property interrupted after ${Q.numRuns} tests
|
|
43
|
-
{ seed: ${Q.seed} }`,$=null,J=[];if(Q.verbose>=2)$=wH(Q.executionSummary,X);else T(J,"Enable verbose mode at level VeryVerbose in order to check all generated values and their associated status");return{message:Y,details:$,hints:J}}function aW(Q,X){if(!Q.failed)return;let{message:Y,details:$,hints:J}=Q.counterexamplePath===null?Q.interrupted?um(Q,X):pm(Q,X):cm(Q,X),Z=Y;if($!==null)Z+=`
|
|
44
|
-
|
|
45
|
-
${$}`;if(J.length>0)Z+=`
|
|
46
|
-
|
|
47
|
-
${mm(J)}`;return Z}function tL(Q){return aW(Q,o0)}async function eL(Q){let X=[];function Y(G){let W=rL(G);if(typeof W==="string")return W;return X.push(Promise.all([G,W])),"\u2026"}let $=aW(Q,Y);if(X.length===0)return $;let J=new c4(await Promise.all(X));function Z(G){let W=G8(J,G);if(W!==void 0)return W;return o0(G)}return aW(Q,Z)}function QM(Q,X){if(X.runConfiguration.includeErrorInReport)throw new h(Q);let Y=new h(Q,{cause:X.errorInstance});if(!("cause"in Y))hm(Y,{cause:X.errorInstance});return Y}function lm(Q){if(!Q.failed)return;throw QM(tL(Q),Q)}async function om(Q){if(!Q.failed)return;throw QM(await eL(Q),Q)}function rm(Q){if(Q.runConfiguration.asyncReporter)return Q.runConfiguration.asyncReporter(Q);else if(Q.runConfiguration.reporter)return Q.runConfiguration.reporter(Q);else return lm(Q)}async function im(Q){if(Q.runConfiguration.asyncReporter)return Q.runConfiguration.asyncReporter(Q);else if(Q.runConfiguration.reporter)return Q.runConfiguration.reporter(Q);else return om(Q)}function nm(Q,X,Y,$,J){let Z=new iL(Y,X,$,J);for(let G of Z){Q.runBeforeEach();let W=Q.run(G);Q.runAfterEach(),Z.handleResult(W)}return Z.runExecution}async function am(Q,X,Y,$,J){let Z=new iL(Y,X,$,J);for(let G of Z){await Q.runBeforeEach();let W=await Q.run(G);await Q.runAfterEach(),Z.handleResult(W)}return Z.runExecution}function XM(Q,X){if(Q===null||Q===void 0||Q.generate===null||Q.generate===void 0)throw Error("Invalid property encountered, please use a valid property");if(Q.run===null||Q.run===void 0)throw Error("Invalid property encountered, please use a valid property not an arbitrary");let Y=FH({...u8(),...X});if(Y.reporter!==void 0&&Y.asyncReporter!==void 0)throw Error("Invalid parameters encountered, reporter and asyncReporter cannot be specified together");if(Y.asyncReporter!==void 0&&!Q.isAsync())throw Error("Invalid parameters encountered, only asyncProperty can be used when asyncReporter specified");let $=Tm(Q,Y),J=Y.path.length===0||Y.path.indexOf(":")===-1?Y.numRuns:-1,Z=Y.numRuns*Y.maxSkipsPerRun,G=(...K)=>$.shrink(...K),W=new Sm(Y.path.length===0?nL($,Y.seed,Y.randomType,Y.examples):sL(Y.path,v6(aL($,Y.seed,Y.randomType,Y.examples)),G),J,Z),H=!Y.endOnFailure?G:G0.nil;return $.isAsync()?am($,H,W,Y.verbose,Y.markInterruptAsFailure).then((K)=>K.toRunDetails(Y.seed,Y.path,Z,Y)):nm($,H,W,Y.verbose,Y.markInterruptAsFailure).toRunDetails(Y.seed,Y.path,Z,Y)}function sm(Q,X){let Y=XM(Q,X);if(Q.isAsync())return Y.then(im);else rm(Y)}function tm(Q,X){let Y=!Object.prototype.hasOwnProperty.call(Q,"isAsync")?new uL(Q,()=>!0):Q;return X.unbiased===!0?new oL(Y):Y}function YM(Q,X){let Y=FH(typeof X==="number"?{...u8(),numRuns:X}:{...u8(),...X}),$=tm(Q,Y),J=$.shrink.bind($);return(Y.path.length===0?v6(nL($,Y.seed,Y.randomType,Y.examples)):sL(Y.path,v6(aL($,Y.seed,Y.randomType,Y.examples)),J)).take(Y.numRuns).map((Z)=>Z.value_)}function em(Q,X){return[...YM(Q,X)]}function Qd(Q){return(Math.round(Q*100)/100).toFixed(2)}function Xd(Q,X,Y){let $=FH(typeof Y==="number"?{...u8(),numRuns:Y}:{...u8(),...Y}),J={};for(let H of YM(Q,Y)){let K=X(H),V=Array.isArray(K)?K:[K];for(let _ of V)J[_]=(J[_]||0)+1}let Z=Object.entries(J).sort((H,K)=>K[1]-H[1]).map((H)=>[H[0],`${Qd(H[1]*100/$.numRuns)}%`]),G=Z.map((H)=>H[0].length).reduce((H,K)=>Math.max(H,K),0),W=Z.map((H)=>H[1].length).reduce((H,K)=>Math.max(H,K),0);for(let H of Z)$.logger(`${H[0].padEnd(G,".")}..${H[1].padStart(W,".")}`)}var Yd=Object.assign;function sW(Q,X,Y,$){let J=Y(),Z=Q.clone(),G={mrng:Q.clone(),biasFactor:X,history:[]},W=(K)=>{let V=J[G.history.length];if(V!==void 0&&V.arb===K){let q=V.value;return T(G.history,{arb:K,value:q,context:V.context,mrng:V.mrng}),Z=V.mrng.clone(),q}let _=K.generate(Z,X);return T(G.history,{arb:K,value:_.value_,context:_.context,mrng:Z.clone()}),_.value};return new y(Yd((K,...V)=>{return W($(K,V))},{values(){return O0(G.history,(K)=>K.value)},[Z1](){return sW(Q,X,Y,$).value},[l8](){return o0(O0(G.history,(K)=>K.value))}}),G)}var TW=Array.isArray,MN=Object.keys,$d=Object.is;function Jd(Q){let X=new c4;return function($,J){let Z=G8(X,$);if(Z===void 0){let H=$(...J);return f8(X,$,[{args:J,value:H}]),H}let G=Z;for(let H of G)if(Q(J,H.args))return H.value;let W=$(...J);return T(G,{args:J,value:W}),W}}function $M(Q,X){if(Q!==null&&typeof Q==="object"&&X!==null&&typeof X==="object"){if(TW(Q)){if(!TW(X))return!1;if(Q.length!==X.length)return!1}else if(TW(X))return!1;if(MN(Q).length!==MN(X).length)return!1;for(let Y in Q){if(!(Y in X))return!1;if(!$M(Q[Y],X[Y]))return!1}return!0}else return $d(Q,X)}var Zd=class extends g0{constructor(...Q){super(...Q);this.arbitraryCache=Jd($M)}generate(Q,X){return sW(Q,X,()=>[],this.arbitraryCache)}canShrinkWithoutContext(Q){return!1}shrink(Q,X){if(X===void 0)return G0.nil();let Y=X,$=Y.mrng,J=Y.biasFactor,Z=Y.history;return pL(Z.map((G)=>G.arb),Z.map((G)=>G.value),Z.map((G)=>G.context)).map((G)=>{function W(){let{value:H,context:K}=G;return O0(Z,(V,_)=>({arb:V.arb,value:H[_],context:K[_],mrng:V.mrng}))}return sW($,J,W,this.arbitraryCache)})}};function Gd(){return new Zd}var{floor:Wd,log:wN}=Math;function Hd(Q){return Wd(wN(Q)/wN(2))}function Kd(Q){if(Q===k(0))return k(0);return k(x1(Q).length)}function JM(Q,X,Y){if(Q===X)return[{min:Q,max:X}];if(Q<0&&X>0){let G=Y(-Q),W=Y(X);return[{min:-G,max:W},{min:X-W,max:X},{min:Q,max:Q+G}]}let $=Y(X-Q),J={min:Q,max:Q+$},Z={min:X-$,max:X};return Q<0?[Z,J]:[J,Z]}var{ceil:Vd,floor:_d}=Math;function PN(Q){return _d(Q/2)}function AN(Q){return Vd(Q/2)}function CN(Q,X,Y){let $=Q-X;function*J(){let G=Y?void 0:X,W=Y?$:PN($);for(let H=W;H>0;H=PN(H)){let K=H===$?X:Q-H;yield new y(K,G),G=K}}function*Z(){let G=Y?void 0:X,W=Y?$:AN($);for(let H=W;H<0;H=AN(H)){let K=H===$?X:Q-H;yield new y(K,G),G=K}}return $>0?v6(J()):v6(Z())}var jN=Math.sign,qd=Number.isInteger,Dd=Object.is,u5=class Q extends g0{constructor(X,Y){super();this.min=X,this.max=Y,this.ranges=JM(X,Y,Hd)}generate(X,Y){if(Y===void 0||X.nextInt(1,Y)!==1)return new y(X.nextInt(this.min,this.max),void 0);let $=this.ranges;if($.length===1){let G=$[0];return new y(X.nextInt(G.min,G.max),void 0)}let J=X.nextInt(-2*($.length-1),$.length-2),Z=J<0?$[0]:$[J+1];return new y(X.nextInt(Z.min,Z.max),void 0)}canShrinkWithoutContext(X){return typeof X==="number"&&qd(X)&&!Dd(X,-0)&&this.min<=X&&X<=this.max}shrink(X,Y){if(!Q.isValidContext(X,Y))return CN(X,this.min<=0&&this.max>=0?0:this.min<0?this.max:this.min,!0);if(this.isLastChanceTry(X,Y))return G0.of(new y(Y,void 0));return CN(X,Y,!1)}isLastChanceTry(X,Y){if(X>0)return X===Y+1&&X>this.min;if(X<0)return X===Y-1&&X<this.max;return!1}static isValidContext(X,Y){if(Y===void 0)return!1;if(typeof Y!=="number")throw Error("Invalid context type passed to IntegerArbitrary (#1)");if(Y!==0&&jN(X)!==jN(Y))throw Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}},TN=Number.isInteger;function Ud(Q){return{min:Q.min!==void 0?Q.min:-2147483648,max:Q.max!==void 0?Q.max:2147483647}}function A0(Q={}){let X=Ud(Q);if(X.min>X.max)throw Error("fc.integer maximum value should be equal or greater than the minimum one");if(!TN(X.min))throw Error("fc.integer minimum value should be an integer");if(!TN(X.max))throw Error("fc.integer maximum value should be an integer");return new u5(X.min,X.max)}var IN=new Map;function PH(Q){if(Q===void 0)return{depth:0};if(typeof Q!=="string")return Q;let X=G8(IN,Q);if(X!==void 0)return X;let Y={depth:0};return f8(IN,Q,Y),Y}function AH(){return{depth:0}}var Bd=class{constructor(Q,X,Y){this.arb=Q,this.mrng=X,this.biasFactor=Y}attemptExact(){}next(){return this.arb.generate(this.mrng,this.biasFactor)}},zd=Math.min,Od=Math.max,Fd=class{constructor(Q,X,Y,$){this.arb=Q,this.mrng=X,this.slices=Y,this.biasFactor=$,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(Q){if(Q!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let X=[];for(let Y=0;Y!==this.slices.length;++Y)if(this.slices[Y].length===Q)T(X,Y);if(X.length===0)return;this.activeSliceIndex=X[this.mrng.nextInt(0,X.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=Q-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new y(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let Q=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=Q.length-1,new y(Q[0],void 0);let X=this.mrng.nextInt(0,Q.length-1),Y=this.mrng.nextInt(0,Q.length-1);return this.nextIndexInSlice=zd(X,Y),this.lastIndexInSlice=Od(X,Y),new y(Q[this.nextIndexInSlice++],void 0)}};function EN(Q,X,Y,$){if($===void 0||Y.length===0||X.nextInt(1,$)!==1)return new Bd(Q,X,$);return new Fd(Q,X,Y,$)}var{floor:Rd,log:SN}=Math,Nd=Array.isArray;function Ld(Q,X){if(Q===X)return Q;return Q+Rd(SN(X-Q)/SN(2))}var ZM=class Q extends g0{constructor(X,Y,$,J,Z,G,W){super();this.arb=X,this.minLength=Y,this.maxGeneratedLength=$,this.maxLength=J,this.setBuilder=G,this.customSlices=W,this.lengthArb=A0({min:Y,max:$}),this.depthContext=PH(Z),this.cachedBiasedMaxLength=Ld(Y,$)}preFilter(X){if(this.setBuilder===void 0)return X;let Y=this.setBuilder();for(let $=0;$!==X.length;++$)Y.tryAdd(X[$]);return Y.getData()}static makeItCloneable(X,Y){return X[Z1]=()=>{let $=[];for(let J=0;J!==Y.length;++J)T($,Y[J].value);return this.makeItCloneable($,Y),$},X}generateNItemsNoDuplicates(X,Y,$,J){let Z=0,G=X(),W=EN(this.arb,$,this.customSlices,J);while(G.size()<Y&&Z<this.maxGeneratedLength){let H=W.next();if(G.tryAdd(H))Z=0;else Z+=1}return G.getData()}safeGenerateNItemsNoDuplicates(X,Y,$,J){let Z=Y-this.cachedBiasedMaxLength;if(Z<=0)return this.generateNItemsNoDuplicates(X,Y,$,J);this.depthContext.depth+=Z;try{return this.generateNItemsNoDuplicates(X,Y,$,J)}finally{this.depthContext.depth-=Z}}generateNItems(X,Y,$){let J=[],Z=EN(this.arb,Y,this.customSlices,$);Z.attemptExact(X);for(let G=0;G!==X;++G)T(J,Z.next());return J}safeGenerateNItems(X,Y,$){let J=X-this.cachedBiasedMaxLength;if(J<=0)return this.generateNItems(X,Y,$);this.depthContext.depth+=J;try{return this.generateNItems(X,Y,$)}finally{this.depthContext.depth-=J}}wrapper(X,Y,$,J){let Z=Y?this.preFilter(X):X,G=!1,W=[],H=[];for(let K=0;K!==Z.length;++K){let V=Z[K];G=G||V.hasToBeCloned,T(W,V.value),T(H,V.context)}if(G)Q.makeItCloneable(W,Z);return new y(W,{shrunkOnce:Y,lengthContext:X.length===Z.length&&$!==void 0?$:void 0,itemsContexts:H,startIndex:J})}generate(X,Y){let $,J;if(Y===void 0)$=this.lengthArb.generate(X,void 0).value;else if(this.minLength===this.maxGeneratedLength)$=this.lengthArb.generate(X,void 0).value,J=Y;else if(X.nextInt(1,Y)!==1)$=this.lengthArb.generate(X,void 0).value;else if(X.nextInt(1,Y)!==1)$=this.lengthArb.generate(X,void 0).value,J=Y;else{let G=this.cachedBiasedMaxLength;$=A0({min:this.minLength,max:G}).generate(X,void 0).value,J=Y}let Z=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,$,X,J):this.safeGenerateNItems($,X,J);return this.wrapper(Z,!1,void 0,0)}canShrinkWithoutContext(X){if(!Nd(X)||this.minLength>X.length||X.length>this.maxLength)return!1;for(let Y=0;Y!==X.length;++Y){if(!(Y in X))return!1;if(!this.arb.canShrinkWithoutContext(X[Y]))return!1}return this.preFilter(O0(X,(Y)=>new y(Y,void 0))).length===X.length}shrinkItemByItem(X,Y,$){let J=[];for(let Z=Y.startIndex;Z<$;++Z)T(J,S6(()=>this.arb.shrink(X[Z],Y.itemsContexts[Z]).map((G)=>{let W=O0($1(X,0,Z),(K,V)=>new y(p5(K),Y.itemsContexts[V])),H=O0($1(X,Z+1),(K,V)=>new y(p5(K),Y.itemsContexts[V+Z+1]));return[[...W,G,...H],void 0,Z]})));return G0.nil().join(...J)}shrinkImpl(X,Y){if(X.length===0)return G0.nil();let $=Y!==void 0?Y:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(X.length,$.lengthContext).drop($.shrunkOnce&&$.lengthContext===void 0&&X.length>this.minLength+1?1:0).map((J)=>{let Z=X.length-J.value;return[O0($1(X,Z),(G,W)=>new y(p5(G),$.itemsContexts[W+Z])),J.context,0]}).join(S6(()=>X.length>this.minLength?this.shrinkItemByItem(X,$,1):this.shrinkItemByItem(X,$,X.length))).join(X.length>this.minLength?S6(()=>{let J={shrunkOnce:!1,lengthContext:void 0,itemsContexts:$1($.itemsContexts,1),startIndex:0};return this.shrinkImpl($1(X,1),J).filter((Z)=>this.minLength<=Z[0].length+1).map((Z)=>{return[[new y(p5(X[0]),$.itemsContexts[0]),...Z[0]],void 0,0]})}):G0.nil())}shrink(X,Y){return this.shrinkImpl(X,Y).map(($)=>this.wrapper($[0],!0,$[1],$[2]))}},Md=Math.floor,wd=Math.min,S9=2147483647,h5=["xsmall","small","medium","large","xlarge"],Pd=["-4","-3","-2","-1","=","+1","+2","+3","+4"],CH="small";function Ad(Q,X){switch(X){case"xsmall":return Md(1.1*Q)+1;case"small":return 2*Q+10;case"medium":return 11*Q+100;case"large":return 101*Q+1000;case"xlarge":return 1001*Q+1e4;default:throw Error(`Unable to compute lengths based on received size: ${X}`)}}function X7(Q,X){let Y=nX(Pd,Q);if(Y===-1)return Q;let $=nX(h5,X);if($===-1)throw Error(`Unable to offset size based on the unknown defaulted one: ${X}`);let J=$+Y-4;return J<0?h5[0]:J>=h5.length?h5[h5.length-1]:h5[J]}function eX(Q,X,Y,$){let{baseSize:J=CH,defaultSizeToMaxWhenMaxSpecified:Z}=u8()||{},G=Q!==void 0?Q:$&&Z?"max":J;if(G==="max")return Y;let W=X7(G,J);return wd(Ad(X,W),Y)}function Cd(Q,X){if(typeof Q==="number")return 1/Q;let{baseSize:Y=CH,defaultSizeToMaxWhenMaxSpecified:$}=u8()||{},J=Q!==void 0?Q:X&&$?"max":Y;if(J==="max")return 0;switch(X7(J,Y)){case"xsmall":return 1;case"small":return 0.5;case"medium":return 0.25;case"large":return 0.125;case"xlarge":return 0.0625}}function jH(Q){let{baseSize:X=CH}=u8()||{};if(Q===void 0)return X;return X7(Q,X)}function C0(Q,X={}){let Y=X.size,$=X.minLength||0,J=X.maxLength,Z=X.depthIdentifier,G=J!==void 0?J:S9;return new ZM(Q,$,eX(Y,$,G,J!==void 0),G,Z,void 0,X.experimentalCustomSlices||[])}function J3(Q){return Q/k(2)}function vN(Q,X,Y){let $=Q-X;function*J(){let G=Y?void 0:X,W=Y?$:J3($);for(let H=W;H>0;H=J3(H)){let K=Q-H;yield new y(K,G),G=K}}function*Z(){let G=Y?void 0:X,W=Y?$:J3($);for(let H=W;H<0;H=J3(H)){let K=Q-H;yield new y(K,G),G=K}}return $>0?v6(J()):v6(Z())}var jd=class Q extends g0{constructor(X,Y){super();this.min=X,this.max=Y}generate(X,Y){let $=this.computeGenerateRange(X,Y);return new y(X.nextBigInt($.min,$.max),void 0)}computeGenerateRange(X,Y){if(Y===void 0||X.nextInt(1,Y)!==1)return{min:this.min,max:this.max};let $=JM(this.min,this.max,Kd);if($.length===1)return $[0];let J=X.nextInt(-2*($.length-1),$.length-2);return J<0?$[0]:$[J+1]}canShrinkWithoutContext(X){return typeof X==="bigint"&&this.min<=X&&X<=this.max}shrink(X,Y){if(!Q.isValidContext(X,Y))return vN(X,this.defaultTarget(),!0);if(this.isLastChanceTry(X,Y))return G0.of(new y(Y,void 0));return vN(X,Y,!1)}defaultTarget(){if(this.min<=0&&this.max>=0)return k(0);return this.min<0?this.max:this.min}isLastChanceTry(X,Y){if(X>0)return X===Y+k(1)&&X>this.min;if(X<0)return X===Y-k(1)&&X<this.max;return!1}static isValidContext(X,Y){if(Y===void 0)return!1;if(typeof Y!=="bigint")throw Error("Invalid context type passed to BigIntArbitrary (#1)");let $=X>0&&Y<0||X<0&&Y>0;if(Y!==k(0)&&$)throw Error("Invalid context value passed to BigIntArbitrary (#2)");return!0}};function Td(Q){let Y=k(-1)<<k(255),$=(k(1)<<k(255))-k(1),J=Q.min,Z=Q.max;return{min:J!==void 0?J:Y-(Z!==void 0&&Z<k(0)?Z*Z:k(0)),max:Z!==void 0?Z:$+(J!==void 0&&J>k(0)?J*J:k(0))}}function Id(Q){if(Q[0]===void 0)return{};if(Q[1]===void 0)return Q[0];return{min:Q[0],max:Q[1]}}function x6(...Q){let X=Td(Id(Q));if(X.min>X.max)throw Error("fc.bigInt expects max to be greater than or equal to min");return new jd(X.min,X.max)}var Ed=Object.getPrototypeOf,lX=class extends g0{constructor(Q){super();this.arb=Q}generate(Q,X){return this.arb.generate(Q,void 0)}canShrinkWithoutContext(Q){return this.arb.canShrinkWithoutContext(Q)}shrink(Q,X){return this.arb.shrink(Q,X)}};function N3(Q){if(Ed(Q)===lX.prototype&&Q.generate===lX.prototype.generate&&Q.canShrinkWithoutContext===lX.prototype.canShrinkWithoutContext&&Q.shrink===lX.prototype.shrink)return Q;return new lX(Q)}function Sd(Q){return Q===1}function vd(Q){if(typeof Q!=="boolean")throw Error("Unsupported input type");return Q===!0?1:0}function Y7(){return N3(A0({min:0,max:1}).map(Sd,vd))}var iX=Object.is,xd=class{constructor(Q){this.values=Q,this.fastValues=new c8(this.values);let X=!1,Y=!1;if(I6(this.fastValues,0))for(let $=0;$!==this.values.length;++$){let J=this.values[$];X=X||iX(J,-0),Y=Y||iX(J,0)}this.hasMinusZero=X,this.hasPlusZero=Y}has(Q){if(Q===0){if(iX(Q,0))return this.hasPlusZero;return this.hasMinusZero}return I6(this.fastValues,Q)}},GM=class extends g0{constructor(Q){super();this.values=Q}generate(Q,X){let Y=this.values.length===1?0:Q.nextInt(0,this.values.length-1),$=this.values[Y];if(!E9($))return new y($,Y);return new y($,Y,()=>$[Z1]())}canShrinkWithoutContext(Q){if(this.values.length===1)return iX(this.values[0],Q);if(this.fastValues===void 0)this.fastValues=new xd(this.values);return this.fastValues.has(Q)}shrink(Q,X){if(X===0||iX(Q,this.values[0]))return G0.nil();return G0.of(new y(this.values[0],0))}};function D4(...Q){if(Q.length===0)throw Error("fc.constantFrom expects at least one parameter");return new GM(Q)}function bd(Q){if(!Q||!Q.withBigInt)return D4(!1,null,void 0,0,"",NaN);return D4(!1,null,void 0,0,"",NaN,k(0))}function k0(Q){return new GM([Q])}var kd=class Q{constructor(){this.receivedLogs=[]}log(X){this.receivedLogs.push(X)}size(){return this.receivedLogs.length}toString(){return JSON.stringify({logs:this.receivedLogs})}[Z1](){return new Q}};function yd(){return k0(new kd)}var gd=NaN,hd=Number.isNaN;function WM(Q){return new F3(Q)}function HM(Q){if(!(Q instanceof F3)||Q.constructor!==F3)throw new h("Not a valid value for date unmapper");return R3(Q)}function md(Q){return(X)=>{return X===Q?new F3(gd):WM(X)}}function dd(Q){return(X)=>{let Y=HM(X);return hd(Y)?Q:Y}}var xN=Number.isNaN;function KM(Q={}){let X=Q.min!==void 0?R3(Q.min):-8640000000000000,Y=Q.max!==void 0?R3(Q.max):8640000000000000,$=Q.noInvalidDate;if(xN(X))throw Error("fc.date min must be valid instance of Date");if(xN(Y))throw Error("fc.date max must be valid instance of Date");if(X>Y)throw Error("fc.date max must be greater or equal to min");if($)return A0({min:X,max:Y}).map(WM,HM);let J=Y+1;return A0({min:X,max:Y+1}).map(md(J),dd(J))}var pd=class extends g0{constructor(Q,X){super();this.startArb=Q,this.chainer=X}generate(Q,X){let Y=[],$=Q.clone(),J=this.startArb.generate(Q,X);Y.push({arbitrary:this.startArb,value:J.value_,context:J.context,clonedMrng:$});while(!0){let G=this.chainer(J.value_);if(G===void 0)break;let W=Q.clone();J=G.generate(Q,X),Y.push({arbitrary:G,value:J.value_,context:J.context,clonedMrng:W})}let Z={biasFactor:X,entries:Y,currentShrinkLevel:0};return new y(J.value_,Z)}canShrinkWithoutContext(Q){return!1}shrink(Q,X){if(!this.isSafeContext(X))return G0.nil();return new G0(this.shrinkIterator(X))}*shrinkIterator(Q){let{entries:X,currentShrinkLevel:Y,biasFactor:$}=Q;for(let J=Y;J<X.length;++J){let Z=X[J],G=Z.arbitrary.shrink(Z.value,Z.context);for(let W of G){let H=X.slice(0,J);H.push({arbitrary:Z.arbitrary,value:W.value_,context:W.context,clonedMrng:Z.clonedMrng});let K=W,V=Z.clonedMrng.clone();while(!0){let D=this.chainer(K.value_);if(D===void 0)break;let B=V.clone(),F=D.generate(V,$);H.push({arbitrary:D,value:F.value_,context:F.context,clonedMrng:B}),K=F}let _=H[H.length-1],q={biasFactor:$,entries:H,currentShrinkLevel:J};yield new y(_.value,q)}}}isSafeContext(Q){return Q!==null&&Q!==void 0&&typeof Q==="object"&&"biasFactor"in Q&&"entries"in Q&&"currentShrinkLevel"in Q}};function VM(Q,X){return new pd(Q,X)}var fd=Symbol.iterator,cd=Array.isArray,ud=Object.is,ld=class Q extends g0{constructor(X,Y){super();this.arb=X,this.numValues=Y}generate(X,Y){let $=[];if(this.numValues<=0)return this.wrapper($);for(let J=0;J!==this.numValues-1;++J)T($,this.arb.generate(X.clone(),Y));return T($,this.arb.generate(X,Y)),this.wrapper($)}canShrinkWithoutContext(X){if(!cd(X)||X.length!==this.numValues)return!1;if(X.length===0)return!0;for(let Y=1;Y<X.length;++Y)if(!ud(X[0],X[Y]))return!1;return this.arb.canShrinkWithoutContext(X[0])}shrink(X,Y){if(X.length===0)return G0.nil();return new G0(this.shrinkImpl(X,Y!==void 0?Y:[])).map(($)=>this.wrapper($))}*shrinkImpl(X,Y){let $=O0(X,(Z,G)=>this.arb.shrink(Z,Y[G])[fd]()),J=O0($,(Z)=>Z.next());while(!J[0].done)yield O0(J,(Z)=>Z.value),J=O0($,(Z)=>Z.next())}static makeItCloneable(X,Y){return X[Z1]=()=>{let $=[];for(let J=0;J!==Y.length;++J)T($,Y[J].value);return this.makeItCloneable($,Y),$},X}wrapper(X){let Y=!1,$=[],J=[];for(let Z=0;Z!==X.length;++Z){let G=X[Z];Y=Y||G.hasToBeCloned,T($,G.value),T(J,G.context)}if(Y)Q.makeItCloneable($,X);return new y($,J)}};function od(Q,X){return new ld(Q,X)}var bN=class{constructor(Q){this.isEqual=Q,this.data=[]}tryAdd(Q){for(let X=0;X!==this.data.length;++X)if(this.isEqual(this.data[X],Q))return!1;return T(this.data,Q),!0}size(){return this.data.length}getData(){return this.data}},rd=Number.isNaN,id=class{constructor(Q){this.selector=Q,this.selectedItemsExceptNaN=new c8,this.data=[]}tryAdd(Q){let X=this.selector(Q);if(rd(X))return T(this.data,Q),!0;let Y=this.selectedItemsExceptNaN.size;if(aX(this.selectedItemsExceptNaN,X),Y!==this.selectedItemsExceptNaN.size)return T(this.data,Q),!0;return!1}size(){return this.data.length}getData(){return this.data}},nd=Object.is,ad=class{constructor(Q){this.selector=Q,this.selectedItemsExceptMinusZero=new c8,this.data=[],this.hasMinusZero=!1}tryAdd(Q){let X=this.selector(Q);if(nd(X,-0)){if(this.hasMinusZero)return!1;return T(this.data,Q),this.hasMinusZero=!0,!0}let Y=this.selectedItemsExceptMinusZero.size;if(aX(this.selectedItemsExceptMinusZero,X),Y!==this.selectedItemsExceptMinusZero.size)return T(this.data,Q),!0;return!1}size(){return this.data.length}getData(){return this.data}},sd=class{constructor(Q){this.selector=Q,this.selectedItems=new c8,this.data=[]}tryAdd(Q){let X=this.selector(Q),Y=this.selectedItems.size;if(aX(this.selectedItems,X),Y!==this.selectedItems.size)return T(this.data,Q),!0;return!1}size(){return this.data.length}getData(){return this.data}};function td(Q){if(typeof Q.comparator==="function"){if(Q.selector===void 0){let W=Q.comparator,H=(K,V)=>W(K.value_,V.value_);return()=>new bN(H)}let{comparator:$,selector:J}=Q,Z=(W)=>J(W.value_),G=(W,H)=>$(Z(W),Z(H));return()=>new bN(G)}let X=Q.selector||(($)=>$),Y=($)=>X($.value_);switch(Q.comparator){case"IsStrictlyEqual":return()=>new id(Y);case"SameValueZero":return()=>new sd(Y);case"SameValue":case void 0:return()=>new ad(Y)}}function v9(Q,X={}){let Y=X.minLength!==void 0?X.minLength:0,$=X.maxLength!==void 0?X.maxLength:S9,J=eX(X.size,Y,$,X.maxLength!==void 0),Z=X.depthIdentifier,G=new ZM(Q,Y,J,$,Z,td(X),[]);if(Y===0)return G;return G.filter((W)=>W.length>=Y)}var{create:ed,defineProperty:Qp,getOwnPropertyDescriptor:Xp,getPrototypeOf:kN,prototype:Yp}=Object,$p=Reflect.ownKeys;function Jp(Q){let X=Q[1]?ed(null):{},Y=Q[0];for(let $=0;$!==Y.length;++$){let J=Y[$][0];if(J==="__proto__")Qp(X,J,{enumerable:!0,configurable:!0,writable:!0,value:Y[$][1]});else X[J]=Y[$][1]}return X}function Zp(Q){return Q!==void 0&&!!Q.configurable&&!!Q.enumerable&&!!Q.writable&&Q.get===void 0&&Q.set===void 0}function Gp(Q){if(typeof Q!=="object"||Q===null)throw new h("Incompatible instance received: should be a non-null object");let X=kN(Q)===null,Y=kN(Q)===Yp;if(!X&&!Y)throw new h("Incompatible instance received: should be of exact type Object");let $=O0($p(Q),(J)=>[J,Xp(Q,J)]);if(!hL($,([,J])=>Zp(J)))throw new h("Incompatible instance received: should contain only c/e/w properties without get/set");return[O0($,([J,Z])=>[J,Z.value]),X]}function Wp(Q){return Q[0]}function TH(Q,X,Y={}){let $=!!Y.noNullPrototype;return Z0(v9(Z0(Q,X),{minLength:Y.minKeys,maxLength:Y.maxKeys,size:Y.size,selector:Wp,depthIdentifier:Y.depthIdentifier}),$?k0(!1):Y7()).map(Jp,Gp)}var{POSITIVE_INFINITY:Hp,MAX_SAFE_INTEGER:Kp,isInteger:Vp}=Number,_p=Math.floor,qp=Math.pow,Dp=Math.min,tW=class Q extends g0{static from(X,Y,$){if(X.length===0)throw Error(`${$} expects at least one weighted arbitrary`);let J=0;for(let G=0;G!==X.length;++G){if(X[G].arbitrary===void 0)throw Error(`${$} expects arbitraries to be specified`);let W=X[G].weight;if(J+=W,!Vp(W))throw Error(`${$} expects weights to be integer values`);if(W<0)throw Error(`${$} expects weights to be superior or equal to 0`)}if(J<=0)throw Error(`${$} expects the sum of weights to be strictly superior to 0`);let Z={depthBias:Cd(Y.depthSize,Y.maxDepth!==void 0),maxDepth:Y.maxDepth!==void 0?Y.maxDepth:Hp,withCrossShrink:!!Y.withCrossShrink};return new Q(X,Z,PH(Y.depthIdentifier))}constructor(X,Y,$){super();this.warbs=X,this.constraints=Y,this.context=$;let J=0;this.cumulatedWeights=[];for(let Z=0;Z!==X.length;++Z)J+=X[Z].weight,T(this.cumulatedWeights,J);this.totalWeight=J}generate(X,Y){if(this.mustGenerateFirst())return this.safeGenerateForIndex(X,0,Y);let $=X.nextInt(this.computeNegDepthBenefit(),this.totalWeight-1);for(let J=0;J!==this.cumulatedWeights.length;++J)if($<this.cumulatedWeights[J])return this.safeGenerateForIndex(X,J,Y);throw Error("Unable to generate from fc.frequency")}canShrinkWithoutContext(X){return this.canShrinkWithoutContextIndex(X)!==-1}shrink(X,Y){if(Y!==void 0){let J=Y,Z=J.selectedIndex,G=J.originalBias,W=this.warbs[Z].arbitrary.shrink(X,J.originalContext).map((H)=>this.mapIntoValue(Z,H,null,G));if(J.clonedMrngForFallbackFirst!==null){if(J.cachedGeneratedForFirst===void 0)J.cachedGeneratedForFirst=this.safeGenerateForIndex(J.clonedMrngForFallbackFirst,0,G);let H=J.cachedGeneratedForFirst;return G0.of(H).join(W)}return W}let $=this.canShrinkWithoutContextIndex(X);if($===-1)return G0.nil();return this.defaultShrinkForFirst($).join(this.warbs[$].arbitrary.shrink(X,void 0).map((J)=>this.mapIntoValue($,J,null,void 0)))}defaultShrinkForFirst(X){++this.context.depth;try{if(!this.mustFallbackToFirstInShrink(X)||this.warbs[0].fallbackValue===void 0)return G0.nil()}finally{--this.context.depth}let Y=new y(this.warbs[0].fallbackValue.default,void 0);return G0.of(this.mapIntoValue(0,Y,null,void 0))}canShrinkWithoutContextIndex(X){if(this.mustGenerateFirst())return this.warbs[0].arbitrary.canShrinkWithoutContext(X)?0:-1;try{++this.context.depth;for(let Y=0;Y!==this.warbs.length;++Y){let $=this.warbs[Y];if($.weight!==0&&$.arbitrary.canShrinkWithoutContext(X))return Y}return-1}finally{--this.context.depth}}mapIntoValue(X,Y,$,J){let Z={selectedIndex:X,originalBias:J,originalContext:Y.context,clonedMrngForFallbackFirst:$};return new y(Y.value,Z)}safeGenerateForIndex(X,Y,$){++this.context.depth;try{let J=this.warbs[Y].arbitrary.generate(X,$),Z=this.mustFallbackToFirstInShrink(Y)?X.clone():null;return this.mapIntoValue(Y,J,Z,$)}finally{--this.context.depth}}mustGenerateFirst(){return this.constraints.maxDepth<=this.context.depth}mustFallbackToFirstInShrink(X){return X!==0&&this.constraints.withCrossShrink&&this.warbs[0].weight!==0}computeNegDepthBenefit(){let X=this.constraints.depthBias;if(X<=0||this.warbs[0].weight===0)return 0;let Y=_p(qp(1+X,this.context.depth))-1;return-Dp(this.totalWeight*Y,Kp)||0}};function Up(Q){return Q!==null&&Q!==void 0&&typeof Q==="object"&&!("generate"in Q)&&!("arbitrary"in Q)&&!("weight"in Q)}function yN(Q){if(jL(Q))return{arbitrary:Q,weight:1};return Q}function J1(...Q){let X=Q[0];if(Up(X)){let $=O0($1(Q,1),yN);return tW.from($,X,"fc.oneof")}let Y=O0(Q,yN);return tW.from(Y,{},"fc.oneof")}var Bp=Number.isInteger;function E6(Q){let X=typeof Q==="number"?Q:Q&&Q.max!==void 0?Q.max:2147483647;if(X<0)throw Error("fc.nat value should be greater than or equal to 0");if(!Bp(X))throw Error("fc.nat maximum value should be an integer");return new u5(0,X)}var zp=Object.is;function Op(Q){let X=0,Y=[];for(let $ of Q){let J=X;X=J+$.num;let Z=X-1;Y.push({from:J,to:Z,entry:$})}return Y}function Fp(Q,X){let Y=0,$=Q.length;while($-Y>1){let J=~~((Y+$)/2);if(X<Q[J].from)$=J;else Y=J}return Q[Y]}function Rp(Q){let X=Op(Q);return function($){let J=Fp(X,$);return J.entry.build($-J.from)}}function Np(Q){let X={mapping:new c4,negativeZeroIndex:void 0},Y=0;for(let $=0;$!==Q.length;++$){let J=Q[$];for(let Z=0;Z!==J.num;++Z){let G=J.build(Z);if(G===0&&1/G===f4.NEGATIVE_INFINITY)X.negativeZeroIndex=Y;else f8(X.mapping,G,Y);++Y}}return X}function Lp(Q){let X=null;return function($){if(X===null)X=Np(Q);let J=zp($,-0)?X.negativeZeroIndex:G8(X.mapping,$);if(J===void 0)throw new h("Unknown value encountered cannot be built using this mapToConstant");return J}}function Mp(Q){if(Q.length===0)throw new h("fc.mapToConstant expects at least one option");let X=0;for(let Y=0;Y!==Q.length;++Y){if(Q[Y].num<0)throw new h("fc.mapToConstant expects all options to have a number of entries greater or equal to zero");X+=Q[Y].num}if(X===0)throw new h("fc.mapToConstant expects at least one choice among options");return X}function l5(...Q){return E6({max:Mp(Q)-1}).map(Rp(Q),Lp(Q))}function _M(Q,X,Y,$){if(X.length===0){if(Y>0)return;return[]}if($<=0)return;let J=[{endIndexChunks:0,nextStartIndex:1,chunks:[]}];while(J.length>0){let Z=kL(J);for(let G=Z.nextStartIndex;G<=X.length;++G){let W=d0(X,Z.endIndexChunks,G);if(Q.canShrinkWithoutContext(W)){let H=[...Z.chunks,W];if(G===X.length){if(H.length<Y)break;return H}if(T(J,{endIndexChunks:Z.endIndexChunks,nextStartIndex:G+1,chunks:Z.chunks}),H.length<$)T(J,{endIndexChunks:G,nextStartIndex:G+1,chunks:H});break}}}}function wp(Q){return y0(Q,"")}function qM(Q){return Q.minLength!==void 0?Q.minLength:0}function DM(Q){return Q.maxLength!==void 0?Q.maxLength:S9}function Pp(Q,X){return qM(X)<=Q.length&&Q.length<=DM(X)}function Ap(Q,X){return function($){if(typeof $!=="string")throw new h("Unsupported value");let J=_M(Q,$,qM(X),DM(X));if(J===void 0)throw new h("Unable to unmap received string");return J}}var UM=["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","__proto__","constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","apply","arguments","bind","call","caller","length","name","prototype","key","ref"];function Cp(Q,X,Y){let $;try{$=Y(Q)}catch{return}for(let J of $)if(!X.canShrinkWithoutContext(J))return;return $}function jp(Q,X){let Y=[];for(let $ of UM){let J=Cp($,Q,X);if(J!==void 0)T(Y,J)}return Y}var gN=new WeakMap;function Tp(Q){let X=[];for(let Y of UM){let $=_M(Q,Y,0,S9);if($!==void 0)T(X,$)}return X}function Ip(Q,X){let Y=jh(gN,Q);if(Y===void 0)Y=Tp(Q),Ch(gN,Q,Y);let $=[];for(let J of Y)if(Pp(J,X))T($,J);return $}var Ep=[[0,127]],Sp=[[0,55295],[57344,1114111]],vp=[[32,126],[160,172],[174,767],[880,887],[890,895],[900,906],[908],[910,929],[931,1154],[1162,1327],[1329,1366],[1369,1418],[1421,1423],[1470],[1472],[1475],[1478],[1488,1514],[1519,1524],[1542,1551],[1563],[1565,1610],[1632,1647],[1649,1749],[1758],[1765,1766],[1769],[1774,1805],[1808],[1810,1839],[1869,1957],[1969],[1984,2026],[2036,2042],[2046,2069],[2074],[2084],[2088],[2096,2110],[2112,2136],[2142],[2144,2154],[2160,2190],[2208,2249],[2308,2361],[2365],[2384],[2392,2401],[2404,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],[2482],[2486,2489],[2493],[2510],[2524,2525],[2527,2529],[2534,2557],[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],[2654],[2662,2671],[2674,2676],[2678],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],[2749],[2768],[2784,2785],[2790,2801],[2809],[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],[2877],[2908,2909],[2911,2913],[2918,2935],[2947],[2949,2954],[2958,2960],[2962,2965],[2969,2970],[2972],[2974,2975],[2979,2980],[2984,2986],[2990,3001],[3024],[3046,3066],[3077,3084],[3086,3088],[3090,3112],[3114,3129],[3133],[3160,3162],[3165],[3168,3169],[3174,3183],[3191,3200],[3204,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],[3261],[3293,3294],[3296,3297],[3302,3311],[3313,3314],[3332,3340],[3342,3344],[3346,3386],[3389],[3407],[3412,3414],[3416,3425],[3430,3455],[3461,3478],[3482,3505],[3507,3515],[3517],[3520,3526],[3558,3567],[3572],[3585,3632],[3634],[3647,3654],[3663,3675],[3713,3714],[3716],[3718,3722],[3724,3747],[3749],[3751,3760],[3762],[3773],[3776,3780],[3782],[3792,3801],[3804,3807],[3840,3863],[3866,3892],[3894],[3896],[3898,3901],[3904,3911],[3913,3948],[3973],[3976,3980],[4030,4037],[4039,4044],[4046,4058],[4096,4138],[4159,4181],[4186,4189],[4193],[4197,4198],[4206,4208],[4213,4225],[4238],[4240,4249],[4254,4293],[4295],[4301],[4304,4351],[4608,4680],[4682,4685],[4688,4694],[4696],[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],[4800],[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4960,4988],[4992,5017],[5024,5109],[5112,5117],[5120,5788],[5792,5880],[5888,5905],[5919,5937],[5941,5942],[5952,5969],[5984,5996],[5998,6000],[6016,6067],[6100,6108],[6112,6121],[6128,6137],[6144,6154],[6160,6169],[6176,6264],[6272,6276],[6279,6312],[6314],[6320,6389],[6400,6430],[6464],[6468,6509],[6512,6516],[6528,6571],[6576,6601],[6608,6618],[6622,6678],[6686,6740],[6784,6793],[6800,6809],[6816,6829],[6917,6963],[6981,6988],[6992,7018],[7028,7038],[7043,7072],[7086,7141],[7164,7203],[7227,7241],[7245,7304],[7312,7354],[7357,7367],[7379],[7401,7404],[7406,7411],[7413,7414],[7418],[7424,7615],[7680,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8061],[8064,8116],[8118,8132],[8134,8147],[8150,8155],[8157,8175],[8178,8180],[8182,8190],[8192,8202],[8208,8233],[8239,8287],[8304,8305],[8308,8334],[8336,8348],[8352,8384],[8448,8587],[8592,9254],[9280,9290],[9312,11123],[11126,11157],[11159,11502],[11506,11507],[11513,11557],[11559],[11565],[11568,11623],[11631,11632],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],[11776,11869],[11904,11929],[11931,12019],[12032,12245],[12272,12329],[12336,12351],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12771],[12783,12830],[12832,13312],[19903,19968],[40959,42124],[42128,42182],[42192,42539],[42560,42606],[42611],[42622,42653],[42656,42735],[42738,42743],[42752,42954],[42960,42961],[42963],[42965,42969],[42994,43009],[43011,43013],[43015,43018],[43020,43042],[43048,43051],[43056,43065],[43072,43127],[43138,43187],[43214,43225],[43250,43262],[43264,43301],[43310,43334],[43359],[43396,43442],[43457,43469],[43471,43481],[43486,43492],[43494,43518],[43520,43560],[43584,43586],[43588,43595],[43600,43609],[43612,43642],[43646,43695],[43697],[43701,43702],[43705,43709],[43712],[43714],[43739,43754],[43760,43764],[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43824,43883],[43888,44002],[44011],[44016,44025],[44032],[55203],[63744,64109],[64112,64217],[64256,64262],[64275,64279],[64285],[64287,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64450],[64467,64911],[64914,64967],[64975],[65008,65023],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65136,65140],[65142,65276],[65281,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65504,65510],[65512,65518],[65532,65533],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[65792,65794],[65799,65843],[65847,65934],[65936,65948],[65952],[66000,66044],[66176,66204],[66208,66256],[66273,66299],[66304,66339],[66349,66378],[66384,66421],[66432,66461],[66463,66499],[66504,66517],[66560,66717],[66720,66729],[66736,66771],[66776,66811],[66816,66855],[66864,66915],[66927,66938],[66940,66954],[66956,66962],[66964,66965],[66967,66977],[66979,66993],[66995,67001],[67003,67004],[67072,67382],[67392,67413],[67424,67431],[67456,67461],[67463,67504],[67506,67514],[67584,67589],[67592],[67594,67637],[67639,67640],[67644],[67647,67669],[67671,67742],[67751,67759],[67808,67826],[67828,67829],[67835,67867],[67871,67897],[67903],[67968,68023],[68028,68047],[68050,68096],[68112,68115],[68117,68119],[68121,68149],[68160,68168],[68176,68184],[68192,68255],[68288,68324],[68331,68342],[68352,68405],[68409,68437],[68440,68466],[68472,68497],[68505,68508],[68521,68527],[68608,68680],[68736,68786],[68800,68850],[68858,68899],[68912,68921],[69216,69246],[69248,69289],[69293],[69296,69297],[69376,69415],[69424,69445],[69457,69465],[69488,69505],[69510,69513],[69552,69579],[69600,69622],[69635,69687],[69703,69709],[69714,69743],[69745,69746],[69749],[69763,69807],[69819,69820],[69822,69825],[69840,69864],[69872,69881],[69891,69926],[69942,69956],[69959],[69968,70002],[70004,70006],[70019,70066],[70081],[70084,70088],[70093],[70096,70111],[70113,70132],[70144,70161],[70163,70187],[70200,70205],[70207,70208],[70272,70278],[70280],[70282,70285],[70287,70301],[70303,70313],[70320,70366],[70384,70393],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],[70461],[70480],[70493,70497],[70656,70708],[70727,70747],[70749],[70751,70753],[70784,70831],[70852,70855],[70864,70873],[71040,71086],[71105,71131],[71168,71215],[71233,71236],[71248,71257],[71264,71276],[71296,71338],[71352,71353],[71360,71369],[71424,71450],[71472,71494],[71680,71723],[71739],[71840,71922],[71935,71942],[71945],[71948,71955],[71957,71958],[71960,71983],[72004,72006],[72016,72025],[72096,72103],[72106,72144],[72161,72163],[72192],[72203,72242],[72255,72262],[72272],[72284,72323],[72346,72354],[72368,72440],[72448,72457],[72704,72712],[72714,72750],[72768,72773],[72784,72812],[72816,72847],[72960,72966],[72968,72969],[72971,73008],[73040,73049],[73056,73061],[73063,73064],[73066,73097],[73112],[73120,73129],[73440,73458],[73463,73464],[73476,73488],[73490,73523],[73539,73561],[73648],[73664,73713],[73727,74649],[74752,74862],[74864,74868],[74880,75075],[77712,77810],[77824,78895],[78913,78918],[82944,83526],[92160,92728],[92736,92766],[92768,92777],[92782,92862],[92864,92873],[92880,92909],[92917],[92928,92975],[92983,92997],[93008,93017],[93019,93025],[93027,93047],[93053,93071],[93760,93850],[93952,94026],[94032],[94099,94111],[94176,94179],[94208],[100343],[100352,101589],[101632],[101640],[110576,110579],[110581,110587],[110589,110590],[110592,110882],[110898],[110928,110930],[110933],[110948,110951],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[113820],[113823],[118608,118723],[118784,119029],[119040,119078],[119081,119140],[119146,119148],[119171,119172],[119180,119209],[119214,119274],[119296,119361],[119365],[119488,119507],[119520,119539],[119552,119638],[119648,119672],[119808,119892],[119894,119964],[119966,119967],[119970],[119973,119974],[119977,119980],[119982,119993],[119995],[119997,120003],[120005,120069],[120071,120074],[120077,120084],[120086,120092],[120094,120121],[120123,120126],[120128,120132],[120134],[120138,120144],[120146,120485],[120488,120779],[120782,121343],[121399,121402],[121453,121460],[121462,121475],[121477,121483],[122624,122654],[122661,122666],[122928,122989],[123136,123180],[123191,123197],[123200,123209],[123214,123215],[123536,123565],[123584,123627],[123632,123641],[123647],[124112,124139],[124144,124153],[124896,124902],[124904,124907],[124909,124910],[124912,124926],[124928,125124],[125127,125135],[125184,125251],[125259],[125264,125273],[125278,125279],[126065,126132],[126209,126269],[126464,126467],[126469,126495],[126497,126498],[126500],[126503],[126505,126514],[126516,126519],[126521],[126523],[126530],[126535],[126537],[126539],[126541,126543],[126545,126546],[126548],[126551],[126553],[126555],[126557],[126559],[126561,126562],[126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[126704,126705],[126976,127019],[127024,127123],[127136,127150],[127153,127167],[127169,127183],[127185,127221],[127232,127405],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127994],[128000,128727],[128732,128748],[128752,128764],[128768,128886],[128891,128985],[128992,129003],[129008],[129024,129035],[129040,129095],[129104,129113],[129120,129159],[129168,129197],[129200,129201],[129280,129619],[129632,129645],[129648,129660],[129664,129672],[129680,129725],[129727,129733],[129742,129755],[129760,129768],[129776,129784],[129792,129938],[129940,129994],[130032,130041],[131072],[173791],[173824],[177977],[177984],[178205],[178208],[183969],[183984],[191456],[191472],[192093],[194560,195101],[196608],[201546],[201552],[205743]],xp=[[192,197],[199,207],[209,214],[217,221],[224,229],[231,239],[241,246],[249,253],[255,271],[274,293],[296,304],[308,311],[313,318],[323,328],[332,337],[340,357],[360,382],[416,417],[431,432],[461,476],[478,483],[486,496],[500,501],[504,539],[542,543],[550,563],[901,902],[904,906],[908],[910,912],[938,944],[970,974],[979,980],[1024,1025],[1027],[1031],[1036,1038],[1049],[1081],[1104,1105],[1107],[1111],[1116,1118],[1142,1143],[1217,1218],[1232,1235],[1238,1239],[1242,1247],[1250,1255],[1258,1269],[1272,1273],[1570,1574],[1728],[1730],[1747],[2345],[2353],[2356],[2392,2399],[2524,2525],[2527],[2611],[2614],[2649,2651],[2654],[2908,2909],[2964],[3907],[3917],[3922],[3927],[3932],[3945],[4134],[6918],[6920],[6922],[6924],[6926],[6930],[7680,7833],[7835],[7840,7929],[7936,7957],[7960,7965],[7968,8005],[8008,8013],[8016,8023],[8025],[8027],[8029],[8031,8048],[8050],[8052],[8054],[8056],[8058],[8060],[8064,8116],[8118,8122],[8124],[8129,8132],[8134,8136],[8138],[8140,8146],[8150,8154],[8157,8162],[8164,8170],[8172,8173],[8178,8180],[8182,8184],[8186],[8188],[8602,8603],[8622],[8653,8655],[8708],[8713],[8716],[8740],[8742],[8769],[8772],[8775],[8777],[8800],[8802],[8813,8817],[8820,8821],[8824,8825],[8832,8833],[8836,8837],[8840,8841],[8876,8879],[8928,8931],[8938,8941],[10972],[12364],[12366],[12368],[12370],[12372],[12374],[12376],[12378],[12380],[12382],[12384],[12386],[12389],[12391],[12393],[12400,12401],[12403,12404],[12406,12407],[12409,12410],[12412,12413],[12436],[12446],[12460],[12462],[12464],[12466],[12468],[12470],[12472],[12474],[12476],[12478],[12480],[12482],[12485],[12487],[12489],[12496,12497],[12499,12500],[12502,12503],[12505,12506],[12508,12509],[12532],[12535,12538],[12542],[44032],[55203],[64285],[64287],[64298,64310],[64312,64316],[64318],[64320,64321],[64323,64324],[64326,64334],[69786],[69788],[69803],[119134,119140],[119227,119232]],hN=String.fromCodePoint,bp=Math.min,kp=Math.max;function eW(Q){if(Q.length===1){let Y=hN(Q[0]);return{num:1,build:()=>Y}}let X=Q[0];return{num:Q[1]-Q[0]+1,build:(Y)=>hN(X+Y)}}function mN(Q,X){let Y=[],$=0,J=0;while($<Q.length&&J<X.length){let Z=Q[$],G=Z[0],W=Z.length===1?Z[0]:Z[1],H=X[J],K=H[0],V=H.length===1?H[0]:H[1];if(W<K)$+=1;else if(V<G)J+=1;else{let _=kp(G,K),q=bp(W,V);if(Y.length>=1){let D=Y[Y.length-1];if((D.length===1?D[0]:D[1])+1===_)_=D[0],kL(Y)}if(T(Y,_===q?[_]:[_,q]),W<=q)$+=1;if(V<=q)J+=1}}return Y}var dN=Object.create(null);function yp(Q){switch(Q){case"full":return Sp;case"ascii":return Ep}}function gp(Q,X){let Y=`${Q}:${X}`,$=dN[Y];if($!==void 0)return $;let J=yp(X),Z=Q==="binary"?J:mN(J,vp),G=[];for(let H of Z)T(G,eW(H));if(Q==="grapheme"){let H=mN(J,xp);for(let K of H){let V=eW(K);T(G,{num:V.num,build:(_)=>lh(V.build(_),"NFD")})}}let W=l5(...G);return dN[Y]=W,W}function oX(Q,X){return gp(Q,X)}function hp(Q){if(typeof Q.unit==="object")return Q.unit;switch(Q.unit){case"grapheme":return oX("grapheme","full");case"grapheme-composite":return oX("composite","full");case"grapheme-ascii":case void 0:return oX("grapheme","ascii");case"binary":return oX("binary","full");case"binary-ascii":return oX("binary","ascii")}}function a0(Q={}){let X=hp(Q),Y=Ap(X,Q),$=Ip(X,Q);return C0(X,{...Q,experimentalCustomSlices:$}).map(wp,Y)}var BM=Map,IH=String.fromCharCode,EH={num:26,build:(Q)=>IH(Q+97)},mp={num:26,build:(Q)=>IH(Q+65)},zM={num:10,build:(Q)=>IH(Q+48)};function dp(Q){let X=Jh(Q);return Q!==X?X:`%${sX(f5(Q,0),16)}`}function pp(Q){if(typeof Q!=="string")throw Error("Unsupported");return decodeURIComponent(Q)}var fp=()=>a0({unit:"binary",minLength:1,maxLength:1}).map(dp,pp),IW=void 0;function cp(){if(IW===void 0)IW=l5(EH);return IW}var Z3=void 0;function QH(Q){if(Z3===void 0)Z3=new BM;let X=G8(Z3,Q);if(X===void 0)X=l5(EH,zM,{num:Q.length,build:(Y)=>Q[Y]}),f8(Z3,Q,X);return X}function up(Q){return l5(EH,mp,zM,{num:Q.length,build:(X)=>Q[X]})}var G3=void 0;function SH(Q){if(G3===void 0)G3=new BM;let X=G8(G3,Q);if(X===void 0)X=J1({weight:10,arbitrary:up(Q)},{weight:1,arbitrary:fp()}),f8(G3,Q,X);return X}function l4(Q,X={}){let Y=X.freq===void 0?6:X.freq,$=mL(X,"nil")?X.nil:null,J=[{arbitrary:k0($),weight:1,fallbackValue:{default:$}},{arbitrary:Q,weight:Y-1}],Z={withCrossShrink:!0,depthSize:X.depthSize,maxDepth:X.maxDepth,depthIdentifier:X.depthIdentifier};return tW.from(J,Z,"fc.option")}function lp(Q){if(Q.length>63)return!1;return Q.length<4||Q[0]!=="x"||Q[1]!=="n"||Q[2]!=="-"||Q[3]!=="-"}var OM=Symbol("adapted-value");function op(Q,X){let Y=X(Q.value_);if(!Y.adapted)return Q;return new y(Y.value,OM)}var rp=class extends g0{constructor(Q,X){super();this.sourceArb=Q,this.adapter=X,this.adaptValue=(Y)=>op(Y,X)}generate(Q,X){let Y=this.sourceArb.generate(Q,X);return this.adaptValue(Y)}canShrinkWithoutContext(Q){return this.sourceArb.canShrinkWithoutContext(Q)&&!this.adapter(Q).adapted}shrink(Q,X){if(X===OM){if(!this.sourceArb.canShrinkWithoutContext(Q))return G0.nil();return this.sourceArb.shrink(Q,void 0).map(this.adaptValue)}return this.sourceArb.shrink(Q,X).map(this.adaptValue)}};function FM(Q,X){return new rp(Q,X)}function ip([Q,X]){return X===null?Q:`${Q}${X[0]}${X[1]}`}function np(Q){if(typeof Q!=="string"||Q.length===0)throw Error("Unsupported");if(Q.length===1)return[Q[0],null];return[Q[0],[d0(Q,1,Q.length-1),Q[Q.length-1]]]}function ap(Q){let X=QH("");return Z0(X,l4(Z0(a0({unit:QH("-"),size:Q,maxLength:61}),X))).map(ip,np).filter(lp)}function sp(Q){return`${y0(Q[0],".")}.${Q[1]}`}function tp(Q){if(typeof Q!=="string")throw Error("Unsupported type");let X=Q.lastIndexOf(".");return[b1(d0(Q,0,X),"."),d0(Q,X+1)]}function ep(Q){let[X,Y]=Q,$=Y.length;for(let J=0;J!==X.length;++J)if($+=1+X[J].length,$>255)return{adapted:!0,value:[$1(X,0,J),Y]};return{adapted:!1,value:Q}}function vH(Q={}){let X=jH(Q.size),Y=X7("-1",X),$=a0({unit:cp(),minLength:2,maxLength:63,size:Y});return FM(Z0(C0(ap(X),{size:Y,minLength:1,maxLength:127}),$),ep).map(sp,tp)}function Qf(Q){let X=Q[0].length;for(let Y=1;Y!==Q.length;++Y)if(X+=1+Q[Y].length,X>64)return{adapted:!0,value:$1(Q,0,Y)};return{adapted:!1,value:Q}}function Xf(Q){return y0(Q,".")}function Yf(Q){if(typeof Q!=="string")throw Error("Unsupported");return b1(Q,".")}function $f(Q){return`${Q[0]}@${Q[1]}`}function Jf(Q){if(typeof Q!=="string")throw Error("Unsupported");return b1(Q,"@",2)}function Zf(Q={}){return Z0(FM(C0(a0({unit:QH("!#$%&'*+-/=?^_`{|}~"),minLength:1,maxLength:64,size:Q.size}),{minLength:1,maxLength:32,size:Q.size}),Qf).map(Xf,Yf),vH({size:Q.size})).map($f,Jf)}var{NEGATIVE_INFINITY:Gf,POSITIVE_INFINITY:XH,EPSILON:RM}=f4,xH=k(2146435072)*k(4294967296),Wf=-xH-k(1),pN=4503599627370496,Hf=k(4503599627370495),fN=k("9007199254740992"),YH=new Float64Array(1),cN=new Uint32Array(YH.buffer,YH.byteOffset);function Kf(Q){return YH[0]=Q,[cN[1],cN[0]]}function Vf(Q){let{0:X,1:Y}=Kf(Q),$=X>>>31,J=X>>>20&2047,Z=(X&1048575)*4294967296+Y,G=J===0?-1022:J-1023,W=J===0?0:1;return W+=Z*RM,W*=$===0?1:-1,{exponent:G,significand:W}}function uN(Q,X){if(Q===-1022)return k(X*pN);return k((X-1)*pN)+(k(Q+1023)<<k(52))}function bH(Q){if(Q===XH)return xH;if(Q===Gf)return Wf;let X=Vf(Q),Y=X.exponent,$=X.significand;if(Q>0||Q===0&&1/Q===XH)return uN(Y,$);else return-uN(Y,-$)-k(1)}function $H(Q){if(Q<0)return-$H(-Q-k(1));if(Q===xH)return XH;if(Q<fN)return f4(Q)*0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005;let X=Q-fN,Y=-1021+f4(X>>k(52));return(1+f4(X&Hf)*RM)*2**Y}var lN=Number.isInteger,oN=Object.is,EW=Number.NEGATIVE_INFINITY,SW=Number.POSITIVE_INFINITY;function NM(Q,X,Y,$){let{noDefaultInfinity:J=!1,minExcluded:Z=!1,maxExcluded:G=!1,min:W=J?-X:EW,max:H=J?X:SW}=Q,K=Z?W<-Y?-$:Math.max(W,-Y):W===EW?Math.max(W,-$):Math.max(W,-Y),V=G?H>Y?$:Math.min(H,Y):H===SW?Math.min(H,$):Math.min(H,Y);return{noDefaultInfinity:!1,minExcluded:Z||(W!==EW||Z)&&lN(K),maxExcluded:G||(H!==SW||G)&&lN(V),min:oN(K,-0)?0:K,max:oN(V,0)?-0:V,noNaN:Q.noNaN||!1}}var{NEGATIVE_INFINITY:LM,POSITIVE_INFINITY:MM,MAX_VALUE:_f}=Number,qf=4503599627370495.5,wM=4503599627370496;function Df(Q){return NM(Q,_f,qf,wM)}function Uf(Q){return Q===4503599627370496?MM:Q===-4503599627370496?LM:Q}function Bf(Q){if(typeof Q!=="number")throw Error("Unsupported type");return Q===MM?wM:Q===LM?-4503599627370496:Q}var{isInteger:zf,isNaN:PM,NEGATIVE_INFINITY:Of,POSITIVE_INFINITY:Ff,MAX_VALUE:rN}=Number,Rf=NaN;function iN(Q,X){if(PM(Q))throw Error("fc.double constraints."+X+" must be a 64-bit float");return bH(Q)}function Nf(Q){if(typeof Q!=="number")throw Error("Unsupported type");return bH(Q)}function Lf(Q){return!zf(Q)}function nN(Q){let{noDefaultInfinity:X=!1,noNaN:Y=!1,minExcluded:$=!1,maxExcluded:J=!1,min:Z=X?-rN:Of,max:G=X?rN:Ff}=Q,W=iN(Z,"min"),H=$?W+k(1):W,K=iN(G,"max"),V=J?K-k(1):K;if(V<H)throw Error("fc.double constraints.min must be smaller or equal to constraints.max");if(Y)return x6({min:H,max:V}).map($H,Nf);let _=V>k(0),q=_?H:H-k(1),D=_?V+k(1):V;return x6({min:q,max:D}).map((B)=>{if(V<B||B<H)return Rf;else return $H(B)},(B)=>{if(typeof B!=="number")throw Error("Unsupported type");if(PM(B))return V!==D?D:q;return bH(B)})}function A3(Q={}){if(!Q.noInteger)return nN(Q);return nN(Df(Q)).map(Uf,Bf).filter(Lf)}var{NEGATIVE_INFINITY:Mf,POSITIVE_INFINITY:JH}=Number,wf=Math.imul,ZH=340282346638528860000000000000000000000,AM=2139095040,Pf=-2139095041,GH=new Float32Array(1),Af=new Uint32Array(GH.buffer,GH.byteOffset);function Cf(Q){return GH[0]=Q,Af[0]}function jf(Q){let X=Cf(Q),Y=X>>>31,$=X>>>23&255,J=X&8388607,Z=$===0?-126:$-127,G=$===0?0:1;return G+=J/8388608,G*=Y===0?1:-1,{exponent:Z,significand:G}}function aN(Q,X){if(Q===-126)return X*8388608;return wf(Q+127,8388608)+(X-1)*8388608}function kH(Q){if(Q===JH)return AM;if(Q===Mf)return Pf;let X=jf(Q),Y=X.exponent,$=X.significand;if(Q>0||Q===0&&1/Q===JH)return aN(Y,$);else return-aN(Y,-$)-1}function WH(Q){if(Q<0)return-WH(-Q-1);if(Q===AM)return JH;if(Q<16777216)return Q*0.000000000000000000000000000000000000000000001401298464324817;let X=Q-16777216,Y=-125+(X>>23);return(1+(X&8388607)/8388608)*2**Y}var{NEGATIVE_INFINITY:CM,POSITIVE_INFINITY:jM}=Number,Tf=ZH,If=8388607.5,TM=8388608;function Ef(Q){return NM(Q,Tf,If,TM)}function Sf(Q){return Q===8388608?jM:Q===-8388608?CM:Q}function vf(Q){if(typeof Q!=="number")throw Error("Unsupported type");return Q===jM?TM:Q===CM?-8388608:Q}var{isInteger:xf,isNaN:IM}=Number,bf=Math.fround,kf=Number.NEGATIVE_INFINITY,yf=Number.POSITIVE_INFINITY,gf=NaN;function sN(Q,X){let Y="fc.float constraints."+X+" must be a 32-bit float - you can convert any double to a 32-bit float by using `Math.fround(myDouble)`";if(IM(Q)||bf(Q)!==Q)throw Error(Y);return kH(Q)}function hf(Q){if(typeof Q!=="number")throw Error("Unsupported type");return kH(Q)}function mf(Q){return!xf(Q)}function tN(Q){let{noDefaultInfinity:X=!1,noNaN:Y=!1,minExcluded:$=!1,maxExcluded:J=!1,min:Z=X?-ZH:kf,max:G=X?ZH:yf}=Q,W=sN(Z,"min"),H=$?W+1:W,K=sN(G,"max"),V=J?K-1:K;if(H>V)throw Error("fc.float constraints.min must be smaller or equal to constraints.max");if(Y)return A0({min:H,max:V}).map(WH,hf);let _=V>0?H:H-1,q=V>0?V+1:V;return A0({min:_,max:q}).map((D)=>{if(D>V||D<H)return gf;else return WH(D)},(D)=>{if(typeof D!=="number")throw Error("Unsupported type");if(IM(D))return V!==q?q:_;return kH(D)})}function EM(Q={}){if(!Q.noInteger)return tN(Q);return tN(Ef(Q)).map(Sf,vf).filter(mf)}function df(Q){return Q.replace(/([$`\\])/g,"\\$1").replace(/\r/g,"\\r")}function SM(Q){return Q.replace(/\*\//g,"*\\/")}var J8=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function L3(Q){let X=4294967295;for(let Y=0;Y<Q.length;++Y){let $=f5(Q,Y);if($<128)X=J8[X&255^$]^X>>8;else if($<2048)X=J8[X&255^(192|$>>6&31)]^X>>8,X=J8[X&255^(128|$&63)]^X>>8;else if($>=55296&&$<57344){let J=f5(Q,++Y);if($>=56320||J<56320||J>57343||Number.isNaN(J))Y-=1,X=J8[X&255^239]^X>>8,X=J8[X&255^191]^X>>8,X=J8[X&255^189]^X>>8;else{let Z=($&1023)+64,G=J&1023;X=J8[X&255^(240|Z>>8&7)]^X>>8,X=J8[X&255^(128|Z>>2&63)]^X>>8,X=J8[X&255^(128|G>>6&15|(Z&3)<<4)]^X>>8,X=J8[X&255^(128|G&63)]^X>>8}}else X=J8[X&255^(224|$>>12&15)]^X>>8,X=J8[X&255^(128|$>>6&63)]^X>>8,X=J8[X&255^(128|$&63)]^X>>8}return(X|0)+2147483648}var pf=Object.getPrototypeOf,rX=class extends g0{constructor(Q){super();this.arb=Q}generate(Q,X){return this.arb.generate(Q,X)}canShrinkWithoutContext(Q){return this.arb.canShrinkWithoutContext(Q)}shrink(Q,X){return G0.nil()}};function M3(Q){if(pf(Q)===rX.prototype&&Q.generate===rX.prototype.generate&&Q.canShrinkWithoutContext===rX.prototype.canShrinkWithoutContext&&Q.shrink===rX.prototype.shrink)return Q;return new rX(Q)}var{assign:ff,keys:cf}=Object;function vM(Q){return Z0(M3(A0()),M3(A0({min:1,max:4294967295}))).map(([X,Y])=>{let $=()=>{let J={};return ff((G,W)=>{let H=o0(G),K=o0(W),V=Q(L3(`${X}${H}`)%Y,L3(`${X}${K}`)%Y);return J[`[${H},${K}]`]=V,V},{toString:()=>{let G=cf(J).sort().map((W)=>`${W} => ${o0(J[W])}`).map((W)=>`/* ${SM(W)} */`);return`function(a, b) {
|
|
48
|
-
// With hash and stringify coming from fast-check${G.length!==0?`
|
|
49
|
-
${y0(G,`
|
|
50
|
-
`)}`:""}
|
|
51
|
-
const cmp = ${Q};
|
|
52
|
-
const hA = hash('${X}' + stringify(a)) % ${Y};
|
|
53
|
-
const hB = hash('${X}' + stringify(b)) % ${Y};
|
|
54
|
-
return cmp(hA, hB);
|
|
55
|
-
}`},[Z1]:$})};return $()})}var uf=Object.assign;function lf(){return vM(uf((Q,X)=>Q<X,{toString(){return"(hA, hB) => hA < hB"}}))}var of=Object.assign;function rf(){return vM(of((Q,X)=>Q-X,{toString(){return"(hA, hB) => hA - hB"}}))}var{defineProperties:nf,keys:af}=Object;function sf(Q){return Z0(C0(Q,{minLength:1}),M3(A0())).map(([X,Y])=>{let $=()=>{let J={},Z=(...W)=>{let H=o0(W),K=X[L3(`${Y}${H}`)%X.length];return J[H]=K,E9(K)?K[Z1]():K};function G(W){let H=O0(O0(gL(af(J)),(K)=>`${K} => ${o0(J[K])}`),(K)=>`/* ${SM(K)} */`);return`function(...args) {
|
|
56
|
-
// With hash and stringify coming from fast-check${H.length!==0?`
|
|
57
|
-
${H.join(`
|
|
58
|
-
`)}`:""}
|
|
59
|
-
const outs = ${W};
|
|
60
|
-
return outs[hash('${Y}' + stringify(args)) % outs.length];
|
|
61
|
-
}`}return nf(Z,{toString:{value:()=>G(o0(X))},[l8]:{value:()=>G(o0(X))},[u4]:{value:async()=>G(await LH(X))},[Z1]:{value:$,configurable:!0}})};return $()})}var{MIN_SAFE_INTEGER:tf,MAX_SAFE_INTEGER:ef}=Number;function xM(){return new u5(tf,ef)}var Qc=Number.MAX_SAFE_INTEGER;function Xc(){return new u5(0,Qc)}var Yc=Number.parseInt;function $c(Q){let[X,Y]=Q;switch(X){case"oct":return`0${sX(Y,8)}`;case"hex":return`0x${sX(Y,16)}`;default:return`${Y}`}}function q3(Q,X){let Y=Yc(Q,X);if(sX(Y,X)!==Q)throw Error("Invalid value");return Y}function Jc(Q){if(typeof Q!=="string")throw Error("Invalid type");if(Q.length>=2&&Q[0]==="0"){if(Q[1]==="x")return["hex",q3(d0(Q,2),16)];return["oct",q3(d0(Q,1),8)]}return["dec",q3(Q,10)]}function Zc(Q){return y0(Q,".")}function Gc(Q){if(typeof Q!=="string")throw Error("Invalid type");return O0(b1(Q,"."),(X)=>q3(X,10))}function yH(){return Z0(E6(255),E6(255),E6(255),E6(255)).map(Zc,Gc)}function q4(Q){return Z0(D4("dec","oct","hex"),E6(Q)).map($c,Jc)}function vW(Q){return y0(Q,".")}function xW(Q){if(typeof Q!=="string")throw Error("Invalid type");return b1(Q,".")}function bM(){return J1(Z0(q4(255),q4(255),q4(255),q4(255)).map(vW,xW),Z0(q4(255),q4(255),q4(65535)).map(vW,xW),Z0(q4(255),q4(16777215)).map(vW,xW),q4(4294967295))}function gH(Q){if(Q.length===0)return[];else return b1(Q,":")}function hH(Q){let X=b1(Q,":");if(X.length>=2&&X[X.length-1].length<=4)return[$1(X,0,X.length-2),`${X[X.length-2]}:${X[X.length-1]}`];return[$1(X,0,X.length-1),X[X.length-1]]}function Wc(Q){return`${y0(Q[0],":")}:${Q[1]}`}function Hc(Q){if(typeof Q!=="string")throw Error("Invalid type");return hH(Q)}function Kc(Q){return`::${y0(Q[0],":")}:${Q[1]}`}function Vc(Q){if(typeof Q!=="string")throw Error("Invalid type");if(!fh(Q,"::"))throw Error("Invalid value");return hH(d0(Q,2))}function D3(Q){return`${y0(Q[0],":")}::${y0(Q[1],":")}:${Q[2]}`}function U3(Q){if(typeof Q!=="string")throw Error("Invalid type");let[X,Y]=b1(Q,"::",2),[$,J]=hH(Y);return[gH(X),$,J]}function _c(Q){return D3([Q[0],[Q[1]],Q[2]])}function qc(Q){let X=U3(Q);return[X[0],y0(X[1],":"),X[2]]}function eN(Q){return`${y0(Q[0],":")}::${Q[1]}`}function QL(Q){if(typeof Q!=="string")throw Error("Invalid type");let[X,Y]=b1(Q,"::",2);return[gH(X),Y]}function Dc(Q){return`${y0(Q[0],":")}::`}function Uc(Q){if(typeof Q!=="string")throw Error("Invalid type");if(!ch(Q,"::"))throw Error("Invalid value");return[gH(d0(Q,0,Q.length-2))]}function Bc([Q,X]){return`${Q}:${X}`}function zc(Q){if(typeof Q!=="string")throw new h("Invalid type");if(!Q.includes(":"))throw new h("Invalid value");return Q.split(":",2)}var Oc="0123456789abcdef",bW=void 0;function Fc(){if(bW===void 0)bW=A0({min:0,max:15}).map((Q)=>Oc[Q],(Q)=>{if(typeof Q!=="string")throw new h("Not a string");if(Q.length!==1)throw new h("Invalid length");let X=f5(Q,0);if(X<=57)return X-48;if(X<97)throw new h("Invalid character");return X-87});return bW}function kM(){let Q=a0({unit:Fc(),minLength:1,maxLength:4,size:"max"}),X=J1(Z0(Q,Q).map(Bc,zc),yH());return J1(Z0(C0(Q,{minLength:6,maxLength:6,size:"max"}),X).map(Wc,Hc),Z0(C0(Q,{minLength:5,maxLength:5,size:"max"}),X).map(Kc,Vc),Z0(C0(Q,{minLength:0,maxLength:1,size:"max"}),C0(Q,{minLength:4,maxLength:4,size:"max"}),X).map(D3,U3),Z0(C0(Q,{minLength:0,maxLength:2,size:"max"}),C0(Q,{minLength:3,maxLength:3,size:"max"}),X).map(D3,U3),Z0(C0(Q,{minLength:0,maxLength:3,size:"max"}),C0(Q,{minLength:2,maxLength:2,size:"max"}),X).map(D3,U3),Z0(C0(Q,{minLength:0,maxLength:4,size:"max"}),Q,X).map(_c,qc),Z0(C0(Q,{minLength:0,maxLength:5,size:"max"}),X).map(eN,QL),Z0(C0(Q,{minLength:0,maxLength:6,size:"max"}),Q).map(eN,QL),Z0(C0(Q,{minLength:0,maxLength:7,size:"max"})).map(Dc,Uc))}var Rc=class extends g0{constructor(Q){super();this.name=Q,this.underlying=null}generate(Q,X){if(this.underlying===null)throw Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.generate(Q,X)}canShrinkWithoutContext(Q){if(this.underlying===null)throw Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.canShrinkWithoutContext(Q)}shrink(Q,X){if(this.underlying===null)throw Error(`Lazy arbitrary ${JSON.stringify(this.name)} not correctly initialized`);return this.underlying.shrink(Q,X)}},Nc=Object.getOwnPropertyNames;function Lc(){let Q=new c4;return(Y)=>{let $=G8(Q,Y);if($!==void 0)return $;return $=new Rc(String(Y)),f8(Q,Y,$),$}}function yM(Q){let X=Lc(),Y=Q(X),$=Nc(Y);for(let J of $){let Z=X(J);Z.underlying=Y[J]}return Y}function Mc(Q,X){for(let Y of Q){let $=X[Y]||{};if($.maxLength===void 0||$.maxLength>0)return!0}return!1}function wc(Q,X){if(Q.length===0)return k0([]);if(!Mc(Q,X))throw new h("Contraints on pool must accept at least one entity, maxLength cannot sum to 0");return Z0(...Q.map((Y)=>C0(k0(Y),X[Y]))).map((Y)=>Oh(Y)).filter((Y)=>Y.length>0)}var{assign:XL,create:B3,defineProperty:gM,getPrototypeOf:YL,prototype:Pc}=Object;function Ac(Q){return gM(B3(null),l8,{configurable:!1,enumerable:!1,writable:!1,value:()=>Q})}function $L(Q,X){return Ac(`<${x1(Q)}#${X}>`)}function Cc(Q,X){let Y=B3(Pc);for(let $ in Q){let J=Q[$],Z=[];for(let G of J){let W=XL(B3(YL(G)),G);Z.push(W)}Y[$]=Z}for(let $ in X){let J=X[$];for(let Z=0;Z!==J.length;++Z){let G=J[Z],W=Y[$][Z];for(let H in G){let K=G[H];W[H]=K.index===void 0?void 0:typeof K.index==="number"?Y[K.type][K.index]:O0(K.index,(V)=>Y[K.type][V])}gM(W,l8,{configurable:!1,enumerable:!1,writable:!1,value:()=>{let H=Q[$][Z],K=XL(B3(YL(H)),H);for(let V in G){let _=G[V];K[V]=_.index===void 0?void 0:typeof _.index==="number"?$L(_.type,_.index):O0(_.index,(q)=>$L(_.type,q))}return o0(K)}})}}return Y}function jc(Q){let X=0,Y=new c4;for(let J in Q){let Z=Q[J];for(let G in Z){let W=Z[G];if(W.arity!=="inverse")continue;let H=G8(Y,W.type);if(H===void 0)H=new c4,f8(Y,W.type,H);if(Sh(H,W.forwardRelationship))throw new h(`Cannot declare multiple inverse relationships for the same forward relationship ${x1(W.forwardRelationship)} on type ${x1(W.type)}`);f8(H,W.forwardRelationship,{type:J,property:G}),X+=1}}let $=new c4;if(X===0)return $;for(let J in Q){let Z=Q[J],G=G8(Y,J);if(G===void 0)continue;for(let W in Z){let H=Z[W];if(H.arity==="inverse")continue;let K=G8(G,W);if(K===void 0)continue;if(K.type!==H.type)throw new h(`Inverse relationship ${x1(K.property)} on type ${x1(K.type)} references forward relationship ${x1(W)} but types do not match`);f8($,H,K)}}if($.size!==X)throw new h("Some inverse relationships could not be matched with their corresponding forward relationships");return $}var{assign:JL,create:w3}=Object;function Tc(Q,X,Y){switch(Q){case"exclusive":return k0(Y);case"successor":return N3(A0({min:X!==void 0?X+1:0,max:Y}));case"any":return N3(A0({min:0,max:Y}))}}function Ic(Q,X,Y,$,J){let Z=Tc(X,Y,$);switch(Q){case"0-1":return l4(Z,{nil:void 0,depthIdentifier:J});case"1":return Z;case"many":{let G=0;return l4(v9(Z,{depthIdentifier:J,selector:(W)=>W===$?W+ ++G:W,minLength:1}),{nil:[],depthIdentifier:J}).map((W)=>{let H=0;return O0(W,(K)=>K===$?K+H++:K)})}}}function hM(Q,X){let Y=w3(null),$=Q[X];for(let J in $){let Z=$[J];if(Z.arity==="inverse")Y[J]={type:Z.type,index:[]}}return Y}function Ec(Q){let X=new c8,Y=new c8;for(let $ in Q){let J=Q[$];for(let Z in J){let G=J[Z];if(G.arity==="inverse")continue;if(G.strategy==="exclusive"){if(I6(X,G.type))throw new h(`Cannot mix exclusive with other strategies for type ${x1(G.type)}`);aX(Y,G.type)}else{if(I6(Y,G.type))throw new h(`Cannot mix exclusive with other strategies for type ${x1(G.type)}`);aX(X,G.type)}if(G.strategy==="successor"&&G.type!==$)throw new h("Cannot mix types for the strategy successor");if(G.strategy==="successor"&&G.arity==="1")throw new h("Cannot use an arity of 1 for the strategy successor")}}}function Sc(Q,X){let{producedLinks:Y,toBeProducedEntities:$}=Q,J=Q.nextIndex+X,Z=JL(w3(null),Y);function G(_){if(Z[_]===Y[_])Z[_]=$1(Y[_]);return Z[_]}function W(_,q){let D=G(_);if(D[q]===Y[_][q])D[q]=JL(w3(null),Y[_][q]);return D[q]}function H(_,q,D){let B=W(_,q),F=Y[_][q];if(F!==void 0&&B[D]===F[D]){let N=B[D];B[D]={type:N.type,index:typeof N.index==="object"?$1(N.index):N.index}}return B[D]}let K=void 0,V=$[J];return{setOutboundLink:(_,q)=>{let D=W(V.type,V.indexInType);D[_]=q},enqueueNewEntity:(_,q)=>{let D=G(q),B=D.length;if(K===void 0)K=$1($);return T(K,{type:q,indexInType:B,depth:V.depth+1}),T(D,hM(_,q)),B},appendBackReference:(_,q,D)=>{let B=H(_,q,D).index;T(B,V.indexInType)},commit:()=>({producedLinks:Z,toBeProducedEntities:K!==void 0?K:$,nextIndex:J+1})}}function vc(Q,X){let Y=w3(null);for(let J in Q)Y[J]=[];let $=[];for(let J of X)T($,{type:J,indexInType:Y[J].length,depth:0}),T(Y[J],hM(Q,J));return{producedLinks:Y,toBeProducedEntities:$,nextIndex:0}}function xc(Q,X,Y,$){let J=Y.producedLinks,Z=Y.toBeProducedEntities[Y.nextIndex+$],G=Q[Z.type],W=AH();W.depth=Z.depth;let H=[],K=[];for(let V in G){let _=G[V];if(_.arity==="inverse")continue;let q=_.type,D=J[q].length;T(H,Ic(_.arity,_.strategy||"any",q===Z.type?Z.indexInType:void 0,D,W)),T(K,{name:V,relation:_,sentinelLinkIndex:D})}if(H.length===0)return;return Z0(...H).map((V)=>{let _=Sc(Y,$);for(let q=0;q!==V.length;++q){let D=V[q],{name:B,relation:F,sentinelLinkIndex:N}=K[q],M=[],w=D===void 0?[]:typeof D==="number"?[D]:D;for(let A of w){let s;if(A>=N)s=_.enqueueNewEntity(Q,F.type);else s=A;T(M,s);let L=G8(X,F);if(L!==void 0)_.appendBackReference(F.type,s,L.property)}_.setOutboundLink(B,{type:F.type,index:D===void 0?void 0:typeof D==="number"?M[0]:M})}return _.commit()})}function bc(Q,X){Ec(Q);let Y=jc(Q);return VM(k0(vc(Q,X)),($)=>{if($.nextIndex>=$.toBeProducedEntities.length)return;let J=0,Z=void 0;while(Z===void 0&&$.nextIndex+J<$.toBeProducedEntities.length)Z=xc(Q,Y,$,J),J+=1;return Z}).map(($)=>{return $.producedLinks})}var{keys:kc,getOwnPropertySymbols:yc,getOwnPropertyDescriptor:gc}=Object;function hc(Q){let X=kc(Q),Y=yc(Q);for(let $=0;$!==Y.length;++$){let J=Y[$],Z=gc(Q,J);if(Z&&Z.enumerable)X.push(J)}return X}var{create:mc,defineProperty:dc,getOwnPropertyDescriptor:pc,getOwnPropertyNames:fc,getOwnPropertySymbols:cc}=Object;function uc(Q,X){return function($){let J=$[$.length-1]?mc(null):{};for(let Z=0;Z!==Q.length;++Z){let G=$[Z];if(G!==X){let W=Q[Z];if(W==="__proto__")dc(J,W,{value:G,configurable:!0,enumerable:!0,writable:!0});else J[W]=G}}return J}}function lc(Q,X){return function($){if(typeof $!=="object"||$===null)throw Error("Incompatible instance received: should be a non-null object");let J=Object.getPrototypeOf($)===null,Z="constructor"in $&&$.constructor===Object;if(!J&&!Z)throw Error("Incompatible instance received: should be of exact type Object");let G=0,W=[];for(let V=0;V!==Q.length;++V){let _=pc($,Q[V]);if(_!==void 0){if(!_.configurable||!_.enumerable||!_.writable)throw Error("Incompatible instance received: should contain only c/e/w properties");if(_.get!==void 0||_.set!==void 0)throw Error("Incompatible instance received: should contain only no get/set properties");++G,T(W,_.value)}else T(W,X)}let H=fc($).length,K=cc($).length;if(G!==H+K)throw Error("Incompatible instance received: should not contain extra properties");return[...W,J]}}var kW=Symbol("no-key");function yW(Q,X,Y){let $=hc(Q),J=[];for(let Z=0;Z!==$.length;++Z){let G=$[Z],W=Q[G];if(X===void 0||nX(X,G)!==-1)T(J,W);else T(J,l4(W,{nil:kW}))}return Z0(...J,Y?k0(!1):Y7()).map(uc($,kW),lc($,kW))}function HH(Q,X){let Y=X!==void 0&&!!X.noNullPrototype;if(X===void 0)return yW(Q,void 0,Y);if(!(("requiredKeys"in X)&&X.requiredKeys!==void 0))return yW(Q,void 0,Y);let $=("requiredKeys"in X?X.requiredKeys:void 0)||[];for(let J=0;J!==$.length;++J){let Z=Object.getOwnPropertyDescriptor(Q,$[J]);if(Z===void 0)throw Error("requiredKeys cannot reference keys that have not been defined in recordModel");if(!Z.enumerable)throw Error("requiredKeys cannot reference keys that are not enumerable in recordModel")}return yW(Q,$,Y)}var oc=Object.create;function rc(Q,X,Y,$){let J=oc(null);for(let Z in Q){let G=Q[Z],W=HH(G,$),H=X(Z),K=Y(Z),V={minLength:H,maxLength:H};J[Z]=K!==void 0?v9(W,{...V,selector:K}):C0(W,V)}return HH(J)}var{create:ZL,keys:ic}=Object;function nc(Q,X,Y={}){let $=ic(Q),J=Y.initialPoolConstraints||ZL(null),Z=Y.unicityConstraints||ZL(null),G={noNullPrototype:Y.noNullPrototype};return wc($,J).chain((W)=>bc(X,W).chain((H)=>rc(Q,(K)=>H[K].length,(K)=>Z[K],G).map((K)=>Cc(K,H))))}function ac(Q){return y0(O0(Q,(X)=>X[X.length-1]===","?d0(X,0,X.length-1):X)," ")}function sc(Q){return function(Y){if(typeof Y!=="string")throw Error("Unsupported type");let $=[];for(let J of b1(Y," "))if(Q.canShrinkWithoutContext(J))T($,J);else if(Q.canShrinkWithoutContext(J+","))T($,J+",");else throw Error("Unsupported word");return $}}function tc(Q){let X=y0(Q," ");if(X[X.length-1]===",")X=d0(X,0,X.length-1);return BH(X[0])+d0(X,1)+"."}function ec(Q){return function(Y){if(typeof Y!=="string")throw Error("Unsupported type");if(Y.length<2||Y[Y.length-1]!=="."||Y[Y.length-2]===","||BH(rW(Y[0]))!==Y[0])throw Error("Unsupported value");let $=rW(Y[0])+d0(Y,1,Y.length-1),J=[],Z=b1($," ");for(let G=0;G!==Z.length;++G){let W=Z[G];if(Q.canShrinkWithoutContext(W))T(J,W);else if(G===Z.length-1&&Q.canShrinkWithoutContext(W+","))T(J,W+",");else throw Error("Unsupported word")}return J}}function Qu(Q){return y0(Q," ")}function Xu(Q){if(typeof Q!=="string")throw Error("Unsupported type");let X=b1(Q,". ");for(let Y=0;Y<X.length-1;++Y)X[Y]+=".";return X}var O=(Q,X)=>{return{arbitrary:k0(Q),weight:X}};function Yu(){return J1(O("non",6),O("adipiscing",5),O("ligula",5),O("enim",5),O("pellentesque",5),O("in",5),O("augue",5),O("et",5),O("nulla",5),O("lorem",4),O("sit",4),O("sed",4),O("diam",4),O("fermentum",4),O("ut",4),O("eu",4),O("aliquam",4),O("mauris",4),O("vitae",4),O("felis",4),O("ipsum",3),O("dolor",3),O("amet,",3),O("elit",3),O("euismod",3),O("mi",3),O("orci",3),O("erat",3),O("praesent",3),O("egestas",3),O("leo",3),O("vel",3),O("sapien",3),O("integer",3),O("curabitur",3),O("convallis",3),O("purus",3),O("risus",2),O("suspendisse",2),O("lectus",2),O("nec,",2),O("ultricies",2),O("sed,",2),O("cras",2),O("elementum",2),O("ultrices",2),O("maecenas",2),O("massa,",2),O("varius",2),O("a,",2),O("semper",2),O("proin",2),O("nec",2),O("nisl",2),O("amet",2),O("duis",2),O("congue",2),O("libero",2),O("vestibulum",2),O("pede",2),O("blandit",2),O("sodales",2),O("ante",2),O("nibh",2),O("ac",2),O("aenean",2),O("massa",2),O("suscipit",2),O("sollicitudin",2),O("fusce",2),O("tempus",2),O("aliquam,",2),O("nunc",2),O("ullamcorper",2),O("rhoncus",2),O("metus",2),O("faucibus,",2),O("justo",2),O("magna",2),O("at",2),O("tincidunt",2),O("consectetur",1),O("tortor,",1),O("dignissim",1),O("congue,",1),O("non,",1),O("porttitor,",1),O("nonummy",1),O("molestie,",1),O("est",1),O("eleifend",1),O("mi,",1),O("arcu",1),O("scelerisque",1),O("vitae,",1),O("consequat",1),O("in,",1),O("pretium",1),O("volutpat",1),O("pharetra",1),O("tempor",1),O("bibendum",1),O("odio",1),O("dui",1),O("primis",1),O("faucibus",1),O("luctus",1),O("posuere",1),O("cubilia",1),O("curae,",1),O("hendrerit",1),O("velit",1),O("mauris,",1),O("gravida",1),O("ornare",1),O("ut,",1),O("pulvinar",1),O("varius,",1),O("turpis",1),O("nibh,",1),O("eros",1),O("id",1),O("aliquet",1),O("quis",1),O("lobortis",1),O("consectetuer",1),O("morbi",1),O("vehicula",1),O("tortor",1),O("tellus,",1),O("id,",1),O("eu,",1),O("quam",1),O("feugiat,",1),O("posuere,",1),O("iaculis",1),O("lectus,",1),O("tristique",1),O("mollis,",1),O("nisl,",1),O("vulputate",1),O("sem",1),O("vivamus",1),O("placerat",1),O("imperdiet",1),O("cursus",1),O("rutrum",1),O("iaculis,",1),O("augue,",1),O("lacus",1))}function $u(Q={}){let{maxCount:X,mode:Y="words",size:$}=Q;if(X!==void 0&&X<1)throw Error("lorem has to produce at least one word/sentence");let J=Yu();if(Y==="sentences")return C0(C0(J,{minLength:1,size:"small"}).map(tc,ec(J)),{minLength:1,maxLength:X,size:$}).map(Qu,Xu);else return C0(J,{minLength:1,maxLength:X,size:$}).map(ac,sc(J))}function Ju(Q){return new Map(Q)}function Zu(Q){if(typeof Q!=="object"||Q===null)throw Error("Incompatible instance received: should be a non-null object");if(!("constructor"in Q)||Q.constructor!==Map)throw Error("Incompatible instance received: should be of exact type Map");return Array.from(Q)}function Gu(Q){return Q[0]}function KH(Q,X,Y={}){return v9(Z0(Q,X),{minLength:Y.minKeys,maxLength:Y.maxKeys,size:Y.size,selector:Gu,depthIdentifier:Y.depthIdentifier,comparator:"SameValueZero"}).map(Ju,Zu)}var W3=10;function Wu(Q){let X={};return(Y)=>{let $=Y!==void 0?Y:W3;if(!mL(X,$)){let J=W3;W3=$-1,X[$]=Q($),W3=J}return X[$]}}function Hu(Q){let X=0;while(Q>k(0)){if(Q&k(1))++X;Q>>=k(1)}return X}function Ku(Q,X){let Y=(k(1)<<k(X))-k(1),$=Q&Y,J=Hu(Q-$),Z=$;for(let G=k(1);G<=Y&&J!==0;G<<=k(1))if(!(Z&G))Z|=G,--J;return Z}function H3(Q,X){let Y=[];for(let $=Q.length-1;$!==-1;--$)if(X(Q[$])!==Q[$])T(Y,$);return Y}function Vu(Q,X,Y){let $=k(0);for(let J=0,Z=k(1);J!==Y.length;++J,Z<<=k(1))if(Q[Y[J]]!==X[Y[J]])$|=Z;return $}function gW(Q,X,Y,$){for(let J=0,Z=k(1);J!==Y.length;++J,Z<<=k(1))if(X&Z)Q[Y[J]]=$(Q[Y[J]])}var _u=class extends g0{constructor(Q,X,Y){super();this.stringArb=Q,this.toggleCase=X,this.untoggleAll=Y}buildContextFor(Q,X){return{rawString:Q.value,rawStringContext:Q.context,flags:X.value,flagsContext:X.context}}generate(Q,X){let Y=this.stringArb.generate(Q,X),$=[...Y.value],J=H3($,this.toggleCase),Z=x6(k(0),(k(1)<<k(J.length))-k(1)).generate(Q,void 0);return gW($,Z.value,J,this.toggleCase),new y(y0($,""),this.buildContextFor(Y,Z))}canShrinkWithoutContext(Q){if(typeof Q!=="string")return!1;return this.untoggleAll!==void 0?this.stringArb.canShrinkWithoutContext(this.untoggleAll(Q)):this.stringArb.canShrinkWithoutContext(Q)}shrink(Q,X){let Y;if(X!==void 0)Y=X;else if(this.untoggleAll!==void 0){let Z=this.untoggleAll(Q),G=[...Q],W=[...Z];Y={rawString:Z,rawStringContext:void 0,flags:Vu(W,G,H3(W,this.toggleCase)),flagsContext:void 0}}else Y={rawString:Q,rawStringContext:void 0,flags:k(0),flagsContext:void 0};let{rawString:$,flags:J}=Y;return this.stringArb.shrink($,Y.rawStringContext).map((Z)=>{let G=[...Z.value],W=H3(G,this.toggleCase),H=Ku(J,W.length);return gW(G,H,W,this.toggleCase),new y(y0(G,""),this.buildContextFor(Z,new y(H,void 0)))}).join(S6(()=>{let Z=[...$],G=H3(Z,this.toggleCase);return x6(k(0),(k(1)<<k(G.length))-k(1)).shrink(J,Y.flagsContext).map((W)=>{let H=$1(Z);return gW(H,W.value,G,this.toggleCase),new y(y0(H,""),this.buildContextFor(new y($,Y.rawStringContext),W))})}))}};function qu(Q){let X=BH(Q);if(X!==Q)return X;return rW(Q)}function Du(Q,X){return new _u(Q,X&&X.toggleCase||qu,X&&X.untoggleAll)}function Uu(Q){return vL.from(Q)}function Bu(Q){if(!(Q instanceof vL))throw Error("Unexpected type");return[...Q]}function mM(Q={}){return C0(EM(Q),Q).map(Uu,Bu)}function zu(Q){return xL.from(Q)}function Ou(Q){if(!(Q instanceof xL))throw Error("Unexpected type");return[...Q]}function dM(Q={}){return C0(A3(Q),Q).map(zu,Ou)}function o4(Q,X,Y,$,J){let Z=$.name,{min:G=X,max:W=Y,...H}=Q;if(G>W)throw Error(`Invalid range passed to ${Z}: min must be lower than or equal to max`);if(G<X)throw Error(`Invalid min value passed to ${Z}: min must be greater than or equal to ${X}`);if(W>Y)throw Error(`Invalid max value passed to ${Z}: max must be lower than or equal to ${Y}`);return C0(J({min:G,max:W}),H).map((K)=>$.from(K),(K)=>{if(!(K instanceof $))throw Error("Invalid type");return[...K]})}function pM(Q={}){return o4(Q,-32768,32767,tg,A0)}function fM(Q={}){return o4(Q,-2147483648,2147483647,eg,A0)}function cM(Q={}){return o4(Q,-128,127,sg,A0)}function uM(Q={}){return o4(Q,0,65535,Yh,A0)}function lM(Q={}){return o4(Q,0,4294967295,$h,A0)}function oM(Q={}){return o4(Q,0,255,Qh,A0)}function rM(Q={}){return o4(Q,0,255,Xh,A0)}function Fu(Q){return Q!==void 0}function GL(Q){if(Q.hasToBeCloned)return new y(Q.value_,{generatorContext:Q.context},()=>Q.value);return new y(Q.value_,{generatorContext:Q.context})}function WL(Q){if(Q.hasToBeCloned)return new y(Q.value_,{shrinkerContext:Q.context},()=>Q.value);return new y(Q.value_,{shrinkerContext:Q.context})}var Ru=class extends g0{constructor(Q,X){super();this.generatorArbitrary=Q,this.shrinkerArbitrary=X}generate(Q,X){return GL(this.generatorArbitrary.generate(Q,X))}canShrinkWithoutContext(Q){return this.shrinkerArbitrary.canShrinkWithoutContext(Q)}shrink(Q,X){if(!Fu(X))return this.shrinkerArbitrary.shrink(Q,void 0).map(WL);if("generatorContext"in X)return this.generatorArbitrary.shrink(Q,X.generatorContext).map(GL);return this.shrinkerArbitrary.shrink(Q,X.shrinkerContext).map(WL)}};function VH(Q,X,Y){let $=A0({min:Q,max:X});if(X===Y)return $;return new Ru($,A0({min:Q,max:Y}))}var{min:Nu,max:_H}=Math,HL=EL.isArray,Lu=Object.entries;function Mu(Q){let X=-1;for(let Y=0;Y!==Q.length;++Y)X=_H(X,Q[Y][0]);return X}function wu(Q,X){let Y=EL(Q);for(let $=0;$!==X.length;++$){let J=X[$];if(J[0]<Q)Y[J[0]]=J[1]}return Y}function iM(Q,X={}){let{size:Y,minNumElements:$=0,maxLength:J=S9,maxNumElements:Z=J,noTrailingHole:G,depthIdentifier:W}=X,H=eX(Y,eX(Y,$,Z,X.maxNumElements!==void 0),J,X.maxLength!==void 0);if($>J)throw Error("The minimal number of non-hole elements cannot be higher than the maximal length of the array");if($>Z)throw Error("The minimal number of non-hole elements cannot be higher than the maximal number of non-holes");let K=Nu(Z,J),V=X.maxNumElements!==void 0||Y!==void 0?Y:"=",_=v9(Z0(VH(0,_H(H-1,0),_H(J-1,0)),Q),{size:V,minLength:$,maxLength:K,selector:(q)=>q[0],depthIdentifier:W}).map((q)=>{return wu(Mu(q)+1,q)},(q)=>{if(!HL(q))throw Error("Not supported entry type");if(G&&q.length!==0&&!(q.length-1 in q))throw Error("No trailing hole");return O0(Lu(q),(D)=>[Number(D[0]),D[1]])});if(G||J===$)return _;return Z0(_,VH($,H,J)).map((q)=>{let D=q[0],B=q[1];if(D.length>=B)return D;let F=$1(D);return F.length=B,F},(q)=>{if(!HL(q))throw Error("Not supported entry type");return[q,q.length]})}function Pu(Q){return new Set(Q)}function Au(Q){if(typeof Q!=="object"||Q===null)throw Error("Incompatible instance received: should be a non-null object");if(!("constructor"in Q)||Q.constructor!==Set)throw Error("Incompatible instance received: should be of exact type Set");return Array.from(Q)}function nM(Q,X={}){return v9(Q,{minLength:X.minLength,maxLength:X.maxLength,size:X.size,depthIdentifier:X.depthIdentifier,comparator:"SameValueZero"}).map(Pu,Au)}function Cu(Q,X,Y,$,J,Z){return TH(Q,X,{maxKeys:Y,noNullPrototype:!Z,size:$,depthIdentifier:J})}function ju(Q){return J1(cM(Q),oM(Q),rM(Q),pM(Q),uM(Q),fM(Q),lM(Q),mM(Q),dM(Q))}function aM(Q){let{values:X,depthSize:Y}=Q,$=AH(),J=Q.maxDepth,Z=Q.maxKeys,G=Q.size,W=J1(...X,...Q.withBigInt?[x6()]:[],...Q.withDate?[KM()]:[]);return yM((H)=>({anything:J1({maxDepth:J,depthSize:Y,depthIdentifier:$},W,H("array"),H("object"),...Q.withMap?[H("map")]:[],...Q.withSet?[H("set")]:[],...Q.withObjectString?[H("anything").map((K)=>o0(K))]:[],...Q.withTypedArray?[ju({maxLength:Z,size:G})]:[],...Q.withSparseArray?[iM(H("anything"),{maxNumElements:Z,size:G,depthIdentifier:$})]:[]),keys:Q.withObjectString?J1({arbitrary:Q.key,weight:10},{arbitrary:H("anything").map((K)=>o0(K)),weight:1}):Q.key,array:C0(H("anything"),{maxLength:Z,size:G,depthIdentifier:$}),set:nM(H("anything"),{maxLength:Z,size:G,depthIdentifier:$}),map:J1(KH(H("keys"),H("anything"),{maxKeys:Z,size:G,depthIdentifier:$}),KH(H("anything"),H("anything"),{maxKeys:Z,size:G,depthIdentifier:$})),object:Cu(H("keys"),H("anything"),Z,G,$,Q.withNullPrototype)})).anything}function Tu(Q){switch(typeof Q){case"boolean":return new SL(Q);case"number":return new f4(Q);case"string":return new x1(Q);default:return Q}}function Iu(Q){if(typeof Q!=="object"||Q===null||!("constructor"in Q))return Q;return Q.constructor===SL||Q.constructor===f4||Q.constructor===x1?Q.valueOf():Q}function Eu(Q){return Q.map(Tu,Iu)}function Su(Q,X){return[Y7(),xM(),A3(),X(Q),J1(X(Q),k0(null),k0(void 0))]}function vu(Q){return Q.map((X)=>Eu(X))}function xu(Q,X){return X?vu(Q).concat(Q):Q}function sM(Q={}){let X={size:Q.size,unit:"stringUnit"in Q?Q.stringUnit:Q.withUnicodeString?"binary":void 0};return{key:Q.key!==void 0?Q.key:a0(X),values:xu(Q.values!==void 0?Q.values:Su(X,a0),Q.withBoxedValues===!0),depthSize:Q.depthSize,maxDepth:Q.maxDepth,maxKeys:Q.maxKeys,size:Q.size,withSet:Q.withSet===!0,withMap:Q.withMap===!0,withObjectString:Q.withObjectString===!0,withNullPrototype:Q.withNullPrototype===!0,withBigInt:Q.withBigInt===!0,withDate:Q.withDate===!0,withTypedArray:Q.withTypedArray===!0,withSparseArray:Q.withSparseArray===!0}}function bu(Q){return TH(Q.key,aM(Q),{maxKeys:Q.maxKeys,noNullPrototype:!Q.withNullPrototype,size:Q.size})}function ku(Q){return bu(sM(Q))}function yu(Q,X){let{depthSize:Y,maxDepth:$}=X;return{key:Q,values:[Y7(),A3({noDefaultInfinity:!0,noNaN:!0}),Q,k0(null)],depthSize:Y,maxDepth:$}}function tM(Q){return aM(sM(Q))}function eM(Q={}){let X=Q.noUnicodeString===void 0||Q.noUnicodeString===!0;return tM(yu("stringUnit"in Q?a0({unit:Q.stringUnit}):X?a0():a0({unit:"binary"}),Q))}var{stringify:gu,parse:hu}=JSON;function mu(Q){if(typeof Q!=="string")throw new h("Cannot unmap the passed value");return hu(Q)}function du(Q={}){return eM(Q).map(gu,mu)}var pu=Object.defineProperties;function hW(Q,X){return`Stream(${X!==void 0?`${y0(X,",")}\u2026`:`${Q} emitted`})`}var fu=class extends g0{constructor(Q,X){super();this.arb=Q,this.history=X}generate(Q,X){let Y=X!==void 0&&Q.nextInt(1,X)===1?X:void 0,$=()=>{let J=this.history?[]:null,Z=0,W=new G0(function*(H,K){while(!0){let V=H.generate(K,Y).value;if(Z++,J!==null)T(J,V);yield V}}(this.arb,Q.clone()));return pu(W,{toString:{value:()=>hW(Z,J!==null?J.map(o0):void 0)},[l8]:{value:()=>hW(Z,J!==null?J.map(o0):void 0)},[u4]:{value:async()=>hW(Z,J!==null?await Promise.all(J.map(LH)):void 0)},[Z1]:{value:$,enumerable:!0}})};return new y($(),void 0)}canShrinkWithoutContext(Q){return!1}shrink(Q,X){return G0.nil()}};function cu(Q,X){return new fu(Q,X!==void 0&&typeof X==="object"&&"noHistory"in X?!X.noHistory:!0)}function uu(Q){return y0(Q,"")}function KL(Q){if(typeof Q!=="string")throw Error("Cannot unmap the passed value");return[...Q]}function lu(Q){switch(Q.length%4){case 0:return Q;case 3:return`${Q}=`;case 2:return`${Q}==`;default:return d0(Q,1)}}function ou(Q){if(typeof Q!=="string"||Q.length%4!==0)throw Error("Invalid string received");let X=Q.indexOf("=");if(X===-1)return Q;if(Q.length-X>2)throw Error("Cannot unmap the passed value");return d0(Q,0,X)}var mW=String.fromCharCode;function ru(Q){if(Q<26)return mW(Q+65);if(Q<52)return mW(Q+97-26);if(Q<62)return mW(Q+48-52);return Q===62?"+":"/"}function iu(Q){if(typeof Q!=="string"||Q.length!==1)throw new h("Invalid entry");let X=f5(Q,0);if(X>=65&&X<=90)return X-65;if(X>=97&&X<=122)return X-97+26;if(X>=48&&X<=57)return X-48+52;return X===43?62:X===47?63:-1}function nu(){return A0({min:0,max:63}).map(ru,iu)}function au(Q={}){let{minLength:X=0,maxLength:Y=S9,size:$}=Q,J=X+3-(X+3)%4,Z=Y-Y%4,G=Q.maxLength===void 0&&$===void 0?"=":$;if(J>Z)throw new h("Minimal length should be inferior or equal to maximal length");if(J%4!==0)throw new h("Minimal length of base64 strings must be a multiple of 4");if(Z%4!==0)throw new h("Maximal length of base64 strings must be a multiple of 4");let W=nu();return C0(W,{minLength:J,maxLength:Z,size:G,experimentalCustomSlices:jp(W,KL)}).map(uu,KL).map(lu,ou)}var VL=Object.is;function su(Q,X){let Y=new c4,$=0;for(let J of Q)if(VL(J,-0))++$;else f8(Y,J,(G8(Y,J)||0)+1);for(let J=0;J!==X.length;++J){if(!(J in X))return!1;let Z=X[J];if(VL(Z,-0)){if($===0)return!1;--$}else{let G=G8(Y,Z)||0;if(G===0)return!1;f8(Y,Z,G-1)}}return!0}var{floor:tu,log:_L}=Math,eu=Array.isArray,Qw=class extends g0{constructor(Q,X,Y,$){super();if(this.originalArray=Q,this.isOrdered=X,this.minLength=Y,this.maxLength=$,Y<0||Y>Q.length)throw Error("fc.*{s|S}ubarrayOf expects the minimal length to be between 0 and the size of the original array");if($<0||$>Q.length)throw Error("fc.*{s|S}ubarrayOf expects the maximal length to be between 0 and the size of the original array");if(Y>$)throw Error("fc.*{s|S}ubarrayOf expects the minimal length to be inferior or equal to the maximal length");this.lengthArb=new u5(Y,$),this.biasedLengthArb=Y!==$?new u5(Y,Y+tu(_L($-Y)/_L(2))):this.lengthArb}generate(Q,X){let Y=(X!==void 0&&Q.nextInt(1,X)===1?this.biasedLengthArb:this.lengthArb).generate(Q,void 0),$=Y.value,J=O0(this.originalArray,(G,W)=>W),Z=[];for(let G=0;G!==$;++G){let W=Q.nextInt(0,J.length-1);T(Z,J[W]),yL(J,W,1)}if(this.isOrdered)gL(Z,(G,W)=>G-W);return new y(O0(Z,(G)=>this.originalArray[G]),Y.context)}canShrinkWithoutContext(Q){if(!eu(Q))return!1;if(!this.lengthArb.canShrinkWithoutContext(Q.length))return!1;return su(this.originalArray,Q)}shrink(Q,X){if(Q.length===0)return G0.nil();return this.lengthArb.shrink(Q.length,X).map((Y)=>{return new y($1(Q,Q.length-Y.value),Y.context)}).join(Q.length>this.minLength?S6(()=>this.shrink($1(Q,1),void 0).filter((Y)=>this.minLength<=Y.value.length+1).map((Y)=>new y([Q[0],...Y.value],void 0))):G0.nil())}};function Ql(Q,X={}){let{minLength:Y=0,maxLength:$=Q.length}=X;return new Qw(Q,!0,Y,$)}function Xl(Q,X={}){let{minLength:Y=0,maxLength:$=Q.length}=X;return new Qw(Q,!1,Y,$)}var Yl={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F",16:"G",17:"H",18:"J",19:"K",20:"M",21:"N",22:"P",23:"Q",24:"R",25:"S",26:"T",27:"V",28:"W",29:"X",30:"Y",31:"Z"},$l={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,J:18,K:19,M:20,N:21,P:22,Q:23,R:24,S:25,T:26,V:27,W:28,X:29,Y:30,Z:31};function Jl(Q){return Q<10?x1(Q):Yl[Q]}function qL(Q,X){let Y="";while(Q.length+Y.length<X)Y+="0";return Y+Q}function DL(Q){let X="";for(let Y=Q;Y!==0;){let $=Y>>5;X=Jl(Y-($<<5))+X,Y=$}return X}function Zl(Q,X){let Y=~~(Q/1073741824),$=Q&1073741823;return qL(DL(Y),X-6)+qL(DL($),6)}function Xw(Q){return function(Y){return Zl(Y,Q)}}function dW(Q){if(typeof Q!=="string")throw new h("Unsupported type");let X=0,Y=1;for(let $=Q.length-1;$>=0;--$){let J=Q[$],Z=$l[J];if(Z===void 0)throw new h("Unsupported type");X+=Z*Y,Y*=32}return X}var Gl=Xw(10),UL=Xw(8);function Wl(Q){return Gl(Q[0])+UL(Q[1])+UL(Q[2])}function Hl(Q){if(typeof Q!=="string"||Q.length!==26)throw Error("Unsupported type");return[dW(Q.slice(0,10)),dW(Q.slice(10,18)),dW(Q.slice(18))]}function Kl(){return Z0(A0({min:0,max:281474976710655}),A0({min:0,max:1099511627775}),A0({min:0,max:1099511627775})).map(Wl,Hl)}function Yw(Q){return uh(sX(Q,16),8,"0")}function Vl(Q){if(typeof Q!=="string")throw Error("Unsupported type");if(Q.length!==8)throw Error("Unsupported value: invalid length");let X=parseInt(Q,16);if(Q!==Yw(X))throw Error("Unsupported value: invalid content");return X}function pW(Q,X){return A0({min:Q,max:X}).map(Yw,Vl)}function _l(Q){return`${Q[0]}-${d0(Q[1],4)}-${d0(Q[1],0,4)}-${d0(Q[2],0,4)}-${d0(Q[2],4)}${Q[3]}`}var ql=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/;function Dl(Q){if(typeof Q!=="string")throw Error("Unsupported type");let X=ql.exec(Q);if(X===null)throw Error("Unsupported type");return[X[1],X[3]+X[2],X[4]+d0(X[5],0,4),d0(X[5],4)]}var BL="0123456789abcdef";function Ul(Q){let X={},Y={};for(let Z=0;Z!==Q.length;++Z){let G=BL[Z],W=BL[Q[Z]];X[G]=W,Y[W]=G}function $(Z){return X[Z[0]]+d0(Z,1)}function J(Z){if(typeof Z!=="string")throw new h("Cannot produce non-string values");let G=Y[Z[0]];if(G===void 0)throw new h("Cannot produce strings not starting by the version in hexa code");return G+d0(Z,1)}return{versionsApplierMapper:$,versionsApplierUnmapper:J}}function Bl(Q){let X={};for(let Y of Q){if(X[Y])throw new h(`Version ${Y} has been requested at least twice for uuid`);if(X[Y]=!0,Y<1||Y>15)throw new h(`Version must be a value in [1-15] for uuid, but received ${Y}`);if(~~Y!==Y)throw new h(`Version must be an integer value for uuid, but received ${Y}`)}if(Q.length===0)throw new h("Must provide at least one version for uuid")}function zl(Q={}){let X=pW(0,4294967295),Y=Q.version!==void 0?typeof Q.version==="number"?[Q.version]:Q.version:[1,2,3,4,5,6,7,8];Bl(Y);let{versionsApplierMapper:$,versionsApplierUnmapper:J}=Ul(Y);return Z0(X,pW(0,268435456*Y.length-1).map($,J),pW(2147483648,3221225471),X).map(_l,Dl)}function Ol(Q){return a0({unit:SH("-._~!$&'()*+,;=:"),size:Q})}function Fl([Q,X,Y]){return(Q===null?"":`${Q}@`)+X+(Y===null?"":`:${Y}`)}function Rl(Q){if(typeof Q!=="string")throw Error("Unsupported");let X=Q.indexOf("@"),Y=X!==-1?Q.substring(0,X):null,$=/:(\d+)$/.exec(Q),J=$!==null?Number($[1]):null;return[Y,$!==null?Q.substring(X+1,Q.length-$[1].length-1):Q.substring(X+1),J]}function Nl(Q){return`[${Q}]`}function Ll(Q){if(typeof Q!=="string"||Q[0]!=="["||Q[Q.length-1]!=="]")throw Error("Unsupported");return Q.substring(1,Q.length-1)}function $w(Q){let X=Q||{},Y=X.size,$=[vH({size:Y}),...X.withIPv4===!0?[yH()]:[],...X.withIPv6===!0?[kM().map(Nl,Ll)]:[],...X.withIPv4Extended===!0?[bM()]:[]];return Z0(X.withUserInfo===!0?l4(Ol(Y)):k0(null),J1(...$),X.withPort===!0?l4(E6(65535)):k0(null)).map(Fl,Rl)}function Jw(Q){return a0({unit:SH("-._~!$&'()*+,;=:@/?"),size:Q})}function Zw(Q={}){return Jw(Q.size)}function Gw(Q={}){return a0({unit:SH("-._~!$&'()*+,;=:@"),size:Q.size})}function Ml(Q){let X="";for(let Y=0;Y!==Q.length;++Y)X+="/"+Q[Y];return X}function wl(Q){if(typeof Q!=="string")throw Error("Incompatible value received: type");if(Q.length!==0&&Q[0]!=="/")throw Error("Incompatible value received: start");return yL(b1(Q,"/"),1)}function Pl(Q){switch(Q){case"xsmall":return["xsmall","xsmall"];case"small":return["small","xsmall"];case"medium":return["small","small"];case"large":return["medium","small"];case"xlarge":return["medium","medium"]}}function fW(Q,X){return C0(Gw({size:Q}),{size:X}).map(Ml,wl)}function Al(Q){let[X,Y]=Pl(Q);if(X===Y)return fW(X,Y);return J1(fW(X,Y),fW(Y,X))}function Ww(Q){return Al(jH((Q||{}).size))}function Hw(Q={}){return Jw(Q.size)}function Cl(Q){let[X,Y,$]=Q;return`${X}://${Y}${$}${Q[3]===null?"":`?${Q[3]}`}${Q[4]===null?"":`#${Q[4]}`}`}var jl=/^([[A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)([^?#]*)(\?[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?(#[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*)?$/;function Tl(Q){if(typeof Q!=="string")throw Error("Incompatible value received: type");let X=jl.exec(Q);if(X===null)throw Error("Incompatible value received");let Y=X[1],$=X[2],J=X[3],Z=X[4],G=X[5];return[Y,$,J,Z!==void 0?Z.substring(1):null,G!==void 0?G.substring(1):null]}function Il(Q){let X=Q||{},Y=jH(X.size),$=X.authoritySettings!==void 0&&X.authoritySettings.size!==void 0?X7(X.authoritySettings.size,Y):Y,J={...X.authoritySettings,size:$};return Z0(D4(...X.validSchemes||["http","https"]),$w(J),Ww({size:Y}),X.withQueryParameters===!0?l4(Hw({size:Y})):k0(null),X.withFragments===!0?l4(Zw({size:Y})):k0(null)).map(Cl,Tl)}var El=class Q{constructor(X,Y){this.commands=X,this.metadataForReplay=Y,this[Z1]=function(){return new Q(this.commands.map(($)=>$.clone()),this.metadataForReplay)}}[Symbol.iterator](){return this.commands[Symbol.iterator]()}toString(){let X=this.commands.filter(($)=>$.hasRan).map(($)=>$.toString()).join(","),Y=this.metadataForReplay();return Y.length!==0?`${X} /*${Y}*/`:X}},Sl=class Q{constructor(X){if(this.cmd=X,this.hasRan=!1,RH(X)){let Y=X[l8];this[l8]=function(){return Y.call(X)}}if(NH(X)){let Y=X[u4];this[u4]=function(){return Y.call(X)}}}check(X){return this.cmd.check(X)}run(X,Y){return this.hasRan=!0,this.cmd.run(X,Y)}clone(){if(E9(this.cmd))return new Q(this.cmd[Z1]());return new Q(this.cmd)}toString(){return this.cmd.toString()}},zL=class{static parse(Q){let[X,Y]=Q.split(":"),$=this.parseCounts(X),J=this.parseChanges(Y);return this.parseOccurences($,J)}static stringify(Q){let X=this.countOccurences(Q);return`${this.stringifyCounts(X)}:${this.stringifyChanges(X)}`}static intToB64(Q){if(Q<26)return String.fromCharCode(Q+65);if(Q<52)return String.fromCharCode(Q+97-26);if(Q<62)return String.fromCharCode(Q+48-52);return String.fromCharCode(Q===62?43:47)}static b64ToInt(Q){if(Q>="a")return Q.charCodeAt(0)-97+26;if(Q>="A")return Q.charCodeAt(0)-65;if(Q>="0")return Q.charCodeAt(0)-48+52;return Q==="+"?62:63}static countOccurences(Q){return Q.reduce((X,Y)=>{if(X.length===0||X[X.length-1].count===64||X[X.length-1].value!==Y)X.push({value:Y,count:1});else X[X.length-1].count+=1;return X},[])}static parseOccurences(Q,X){let Y=[];for(let $=0;$!==Q.length;++$){let J=Q[$],Z=X[$];for(let G=0;G!==J;++G)Y.push(Z)}return Y}static stringifyChanges(Q){let X="";for(let Y=0;Y<Q.length;Y+=6){let $=Q.slice(Y,Y+6).reduceRight((J,Z)=>(J<<1)+(Z.value?1:0),0);X+=this.intToB64($)}return X}static parseChanges(Q){let X=Q.split("").map(($)=>this.b64ToInt($)),Y=[];for(let $=0;$!==X.length;++$){let J=X[$];for(let Z=0;Z!==6;++Z,J>>=1)Y.push(J%2===1)}return Y}static stringifyCounts(Q){return Q.map(({count:X})=>this.intToB64(X-1)).join("")}static parseCounts(Q){return Q.split("").map((X)=>this.b64ToInt(X)+1)}},vl=class extends g0{constructor(Q,X,Y,$,J){super();this.sourceReplayPath=$,this.disableReplayLog=J,this.oneCommandArb=J1(...Q).map((Z)=>new Sl(Z)),this.lengthArb=VH(0,X,Y),this.replayPath=[],this.replayPathPosition=0}metadataForReplay(){return this.disableReplayLog?"":`replayPath=${JSON.stringify(zL.stringify(this.replayPath))}`}buildValueFor(Q,X){let Y=Q.map((J)=>J.value_),$={shrunkOnce:X,items:Q};return new y(new El(Y,()=>this.metadataForReplay()),$)}generate(Q){let X=this.lengthArb.generate(Q,void 0).value,Y=Array(X);for(let $=0;$!==X;++$)Y[$]=this.oneCommandArb.generate(Q,void 0);return this.replayPathPosition=0,this.buildValueFor(Y,!1)}canShrinkWithoutContext(Q){return!1}filterOnExecution(Q){let X=[];for(let Y of Q)if(Y.value_.hasRan)this.replayPath.push(!0),X.push(Y);else this.replayPath.push(!1);return X}filterOnReplay(Q){return Q.filter((X,Y)=>{let $=this.replayPath[this.replayPathPosition+Y];if($===void 0)throw Error("Too short replayPath");if(!$&&X.value_.hasRan)throw Error("Mismatch between replayPath and real execution");return $})}filterForShrinkImpl(Q){if(this.replayPathPosition===0)this.replayPath=this.sourceReplayPath!==null?zL.parse(this.sourceReplayPath):[];let X=this.replayPathPosition<this.replayPath.length?this.filterOnReplay(Q):this.filterOnExecution(Q);return this.replayPathPosition+=Q.length,X}shrink(Q,X){if(X===void 0)return G0.nil();let Y=X,$=Y.shrunkOnce,J=Y.items,Z=this.filterForShrinkImpl(J);if(Z.length===0)return G0.nil();let G=$?G0.nil():new G0([[]][Symbol.iterator]()),W=[];for(let H=0;H!==Z.length;++H)W.push(S6(()=>{let K=Z.slice(0,H);return this.lengthArb.shrink(Z.length-1-H,void 0).map((V)=>K.concat(Z.slice(Z.length-(V.value+1))))}));for(let H=0;H!==Z.length;++H)W.push(S6(()=>this.oneCommandArb.shrink(Z[H].value_,Z[H].context).map((K)=>Z.slice(0,H).concat([K],Z.slice(H+1)))));return G.join(...W).map((H)=>{return this.buildValueFor(H.map((K)=>new y(K.value_.clone(),K.context)),!0)})}};function xl(Q,X={}){let{size:Y,maxCommands:$=S9,disableReplayLog:J=!1,replayPath:Z=null}=X;return new vl(Q,eX(Y,0,$,X.maxCommands!==void 0),$,Z,J)}var bl=class{constructor(Q,X){this.s=Q,this.cmd=X}async check(Q){let X=null,Y=!1;if((await this.s.scheduleSequence([{label:`check@${this.cmd.toString()}`,builder:async()=>{try{Y=await Promise.resolve(this.cmd.check(Q))}catch($){throw X=$,$}}}]).task).faulty)throw X;return Y}async run(Q,X){let Y=null;if((await this.s.scheduleSequence([{label:`run@${this.cmd.toString()}`,builder:async()=>{try{await this.cmd.run(Q,X)}catch($){throw Y=$,$}}}]).task).faulty)throw Y}},kl=function*(Q,X){for(let Y of X)yield new bl(Q,Y)},Kw=(Q,X,Y,$,J)=>{return Q.then((Z)=>{let{model:G,real:W}=Z,H=Y;for(let K of X)H=J(H,()=>{return $(K,G,W)});return H})},yl=(Q,X)=>{return Kw({then:(Z)=>{Z(Q())}},X,void 0,(Z,G,W)=>{if(Z.check(G))Z.run(G,W)},(Z,G)=>G())},gl=(Q)=>{return typeof Q.then==="function"},Vw=async(Q,X,Y=Promise.resolve())=>{return await Kw({then:(G)=>{let W=Q();if(gl(W))return W.then(G);else return G(W)}},X,Y,async(G,W,H)=>{if(await G.check(W))await G.run(W,H)},(G,W)=>G.then(W))};function hl(Q,X){yl(Q,X)}async function ml(Q,X){await Vw(Q,X)}async function dl(Q,X,Y){let $=kl(Q,Y),J=Vw(X,$,Q.schedule(Promise.resolve(),"startModel"));await Q.waitFor(J),await Q.waitAll()}var K3=(Q)=>Q(),_w=class Q{constructor(X,Y){this.act=X,this.taskSelector=Y,this.lastTaskId=0,this.sourceTaskSelector=Y.clone(),this.scheduledTasks=[],this.triggeredTasks=[],this.scheduledWatchers=[],this[Z1]=function(){return new Q(this.act,this.sourceTaskSelector)}}static buildLog(X){return`[task\${${X.taskId}}] ${X.label.length!==0?`${X.schedulingType}::${X.label}`:X.schedulingType} ${X.status}${X.outputValue!==void 0?` with value ${df(X.outputValue)}`:""}`}log(X,Y,$,J,Z,G){this.triggeredTasks.push({status:Z,schedulingType:X,taskId:Y,label:$,metadata:J,outputValue:G!==void 0?o0(G):void 0})}scheduleInternal(X,Y,$,J,Z,G){let W=++this.lastTaskId,H=void 0,K=new Promise((V,_)=>{H=()=>{let q=Promise.resolve(G!==void 0?$.then(()=>G()):$);return q.then((D)=>{this.log(X,W,Y,J,"resolved",D),V(D)},(D)=>{this.log(X,W,Y,J,"rejected",D),_(D)}),q}});if(this.scheduledTasks.push({original:$,trigger:H,schedulingType:X,taskId:W,label:Y,metadata:J,customAct:Z}),this.scheduledWatchers.length!==0)this.scheduledWatchers[0]();return K}schedule(X,Y,$,J){return this.scheduleInternal("promise",Y||"",X,$,J||K3)}scheduleFunction(X,Y){return(...$)=>this.scheduleInternal("function",`${X.name}(${$.map(o0).join(",")})`,X(...$),void 0,Y||K3)}scheduleSequence(X,Y){let $={done:!1,faulty:!1},J={then:(V)=>V()},Z=()=>{},G=new Promise((V)=>{Z=()=>V({done:$.done,faulty:$.faulty})}),W=()=>{$.faulty=!0,Z()},H=()=>{$.done=!0,Z()},K=(V,_)=>{if(V>=X.length){_.then(H,W);return}_.then(()=>{let q=X[V],[D,B,F]=typeof q==="function"?[q,q.name,void 0]:[q.builder,q.label,q.metadata],N=this.scheduleInternal("sequence",B,J,F,Y||K3,()=>D());K(V+1,N)},W)};return K(0,J),Object.assign($,{task:G})}count(){return this.scheduledTasks.length}internalWaitOne(){if(this.scheduledTasks.length===0)throw Error("No task scheduled");let X=this.taskSelector.nextTaskIndex(this.scheduledTasks),[Y]=this.scheduledTasks.splice(X,1);return Y.customAct(()=>{return Y.trigger().catch(($)=>{})})}waitOne(X){let Y=X||K3;return this.act(()=>Y(()=>this.internalWaitOne()))}async waitAll(X){while(this.scheduledTasks.length>0)await this.waitOne(X)}async internalWaitFor(X,Y){let $=!1,J=Y.customAct,Z=Y.onWaitStart,G=Y.onWaitIdle,W=Y.launchAwaiterOnInit,H=void 0,K=void 0,V=0,_=null,q=null,D=async()=>{V=50;for(V=50;!$&&V>0;--V)await Promise.resolve();if(!$&&this.scheduledTasks.length>0){if(Z!==void 0)Z();return q=this.waitOne(J),q.then(()=>{return q=null,D()},(M)=>{throw q=null,$=!0,K(M),M})}if(!$&&G!==void 0)G();_=null},B=()=>{if(_!==null){V=51;return}_=D().catch(()=>{})},F=()=>{let M=this.scheduledWatchers.indexOf(B);if(M!==-1)this.scheduledWatchers.splice(M,1);if(M===0&&this.scheduledWatchers.length!==0)this.scheduledWatchers[0]()},N=new Promise((M,w)=>{H=(A)=>{F(),M(A)},K=(A)=>{F(),w(A)}});if(X.then((M)=>{if($=!0,q===null)H(M);else q.then(()=>H(M),(w)=>K(w))},(M)=>{if($=!0,q===null)K(M);else q.then(()=>K(M),()=>K(M))}),(this.scheduledTasks.length>0||W)&&this.scheduledWatchers.length===0)B();return this.scheduledWatchers.push(B),N}waitNext(X,Y){let $=void 0,J=X,Z=J<=0?Promise.resolve():new Promise((G)=>{$=()=>{if(--J<=0)G()}});return this.internalWaitFor(Z,{customAct:Y,onWaitStart:$,onWaitIdle:void 0,launchAwaiterOnInit:!1})}waitIdle(X){let Y=void 0,$=new Promise((J)=>Y=J);return this.internalWaitFor($,{customAct:X,onWaitStart:void 0,onWaitIdle:Y,launchAwaiterOnInit:!0})}waitFor(X,Y){return this.internalWaitFor(X,{customAct:Y,onWaitStart:void 0,onWaitIdle:void 0,launchAwaiterOnInit:!1})}report(){return[...this.triggeredTasks,...this.scheduledTasks.map((X)=>({status:"pending",schedulingType:X.schedulingType,taskId:X.taskId,label:X.label,metadata:X.metadata}))]}toString(){return"schedulerFor()`\n"+this.report().map(Q.buildLog).map((X)=>`-> ${X}`).join(`
|
|
62
|
-
`)+"`"}};function qw(Q){let X=0;return{clone:()=>qw(Q),nextTaskIndex:(Y)=>{if(Q.length<=X)throw Error("Invalid schedulerFor defined: too many tasks have been scheduled");let $=Y.findIndex((J)=>J.taskId===Q[X]);if($===-1)throw Error("Invalid schedulerFor defined: unable to find next task");return++X,$}}}function OL(Q,X){return new _w(Q,qw(X))}function Dw(Q){let X=Q.clone();return{clone:()=>Dw(X),nextTaskIndex:(Y)=>{return Q.nextInt(0,Y.length-1)}}}var pl=class extends g0{constructor(Q){super();this.act=Q}generate(Q,X){return new y(new _w(this.act,Dw(Q.clone())),void 0)}canShrinkWithoutContext(Q){return!1}shrink(Q,X){return G0.nil()}};function fl(Q){let{act:X=(Y)=>Y()}=Q||{};return new pl(X)}function cl(Q,X){let{act:Y=($)=>$()}=Array.isArray(Q)?X||{}:Q||{};if(Array.isArray(Q))return OL(Y,Q);return function($,...J){return OL(Y,J)}}function ul(Q={}){return o4(Q,k("-9223372036854775808"),k("9223372036854775807"),ng,x6)}function ll(Q={}){return o4(Q,k(0),k("18446744073709551615"),ag,x6)}function ol(Q,X){return X}var{floor:cW,min:rl}=Math;function w8(Q,X){switch(Q.type){case"Char":return{astNode:Q,minLength:1};case"Repetition":switch(Q.quantifier.kind){case"*":{let Y=w8(Q.expression,X);return{astNode:{type:"Repetition",quantifier:{...Q.quantifier,kind:"Range",from:0,to:X},expression:Y.astNode},minLength:0}}case"+":{let Y=w8(Q.expression,X),$=Y.minLength>1?Y.minLength:1;return{astNode:{type:"Repetition",quantifier:{...Q.quantifier,kind:"Range",from:1,to:cW(X/$)},expression:Y.astNode},minLength:Y.minLength}}case"?":{let Y=w8(Q.expression,X);if(X<Y.minLength)return{astNode:{type:"Repetition",quantifier:{...Q.quantifier,kind:"Range",from:0,to:0},expression:Y.astNode},minLength:0};return{astNode:{...Q,expression:Y.astNode},minLength:0}}case"Range":{let Y=Q.quantifier.from>1?cW(X/Q.quantifier.from):X,$=w8(Q.expression,Y),J=$.minLength>1?$.minLength:1;if(Q.quantifier.to===void 0||Q.quantifier.to*J>X)return{astNode:{type:"Repetition",quantifier:{...Q.quantifier,kind:"Range",to:cW(X/J)},expression:$.astNode},minLength:Q.quantifier.from*$.minLength};return{astNode:{...Q,expression:$.astNode},minLength:Q.quantifier.from*$.minLength}}default:return ol(Q.quantifier,{astNode:Q,minLength:0})}case"Quantifier":return{astNode:Q,minLength:0};case"Alternative":{let Y=0,$=[];for(let Z=0;Z!==Q.expressions.length;++Z){let G=X-Y,W=w8(Q.expressions[Z],G);Y+=W.minLength,T($,{value:W,allowance:G})}let J=[];for(let Z=0;Z!==$.length;++Z){let G=$[Z].value,W=$[Z].allowance,H=X-Y+G.minLength;T(J,(H!==W?w8(G.astNode,H):G).astNode)}return{astNode:{...Q,expressions:J},minLength:Y}}case"CharacterClass":return{astNode:Q,minLength:1};case"ClassRange":return{astNode:Q,minLength:1};case"Group":{let Y=w8(Q.expression,X);return{astNode:{...Q,expression:Y.astNode},minLength:Y.minLength}}case"Disjunction":{if(Q.left===null){if(Q.right===null)return{astNode:Q,minLength:0};let J=w8(Q.right,X),Z=J.minLength>X?null:J.astNode;return{astNode:{...Q,left:null,right:Z},minLength:0}}if(Q.right===null){let J=w8(Q.left,X),Z=J.minLength>X?null:J.astNode;return{astNode:{...Q,left:Z,right:null},minLength:0}}let Y=w8(Q.left,X),$=w8(Q.right,X);if(Y.minLength>X)return $;if($.minLength>X)return Y;return{astNode:{...Q,left:Y.astNode,right:$.astNode},minLength:rl(Y.minLength,$.minLength)}}case"Assertion":return{astNode:Q,minLength:0};case"Backreference":return{astNode:Q,minLength:0};case"UnicodeProperty":return{astNode:Q,minLength:1}}}function il(Q,X){return w8(Q,X).astNode}function nl(Q){return Error(`Unsupported AST node! Received: ${o0(Q)}`)}function z3(Q,X,Y){if(!X&&!Y)return Q;let $={hasStart:!1,hasEnd:!1},J=Uw(Q,X,Y,$),Z=X&&!$.hasStart,G=Y&&!$.hasEnd;if(!Z&&!G)return J;let W=[];if(Z)W.push({type:"Assertion",kind:"^"}),W.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}});if(W.push(J),G)W.push({type:"Repetition",quantifier:{type:"Quantifier",kind:"*",greedy:!0},expression:{type:"Char",kind:"meta",symbol:".",value:".",codePoint:NaN}}),W.push({type:"Assertion",kind:"$"});return{type:"Group",capturing:!1,expression:{type:"Alternative",expressions:W}}}function Uw(Q,X,Y,$){switch(Q.type){case"Char":return Q;case"Repetition":return Q;case"Quantifier":throw Error("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":return $.hasStart=!0,$.hasEnd=!0,{...Q,expressions:Q.expressions.map((J,Z)=>z3(J,X&&Z===0,Y&&Z===Q.expressions.length-1))};case"CharacterClass":return Q;case"ClassRange":return Q;case"Group":return{...Q,expression:Uw(Q.expression,X,Y,$)};case"Disjunction":return $.hasStart=!0,$.hasEnd=!0,{...Q,left:Q.left!==null?z3(Q.left,X,Y):null,right:Q.right!==null?z3(Q.right,X,Y):null};case"Assertion":if(Q.kind==="^"||Q.kind==="Lookahead")return $.hasStart=!0,Q;else if(Q.kind==="$"||Q.kind==="Lookbehind")return $.hasEnd=!0,Q;else throw Error(`Assertions of kind ${Q.kind} not implemented yet!`);case"Backreference":return Q;case"UnicodeProperty":return Q;default:throw nl(Q)}}function al(Q){return z3(Q,!0,!0)}function FL(Q,X){return Q[X]>="\uD800"&&Q[X]<="\uDBFF"&&Q[X+1]>="\uDC00"&&Q[X+1]<="\uDFFF"?2:1}function n0(Q){return Q>="0"&&Q<="9"||Q>="a"&&Q<="f"||Q>="A"&&Q<="F"}function qH(Q){return Q>="0"&&Q<="9"}function Bw(Q,X){for(let Y=X;Y!==Q.length;++Y){let $=Q[Y];if($==="\\")Y+=1;else if($==="]")return Y}throw Error("Missing closing ']'")}function sl(Q,X){let Y=0;for(let $=X;$!==Q.length;++$){let J=Q[$];if(J==="\\")$+=1;else if(J===")"){if(Y===0)return $;Y-=1}else if(J==="[")$=Bw(Q,$);else if(J==="(")Y+=1}throw Error("Missing closing ')'")}function tl(Q,X){let Y=!1;for(let $=X;$!==Q.length;++$){let J=Q[$];if(qH(J));else if(X===$)return-1;else if(J===","){if(Y)return-1;Y=!0}else if(J==="}")return $;else return-1}return-1}function el(Q,X,Y,$){switch(Q[X]){case"[":if($===1)return X+1;return Bw(Q,X+1)+1;case"{":{if($===1)return X+1;let J=tl(Q,X+1);if(J===-1)return X+1;return J+1}case"(":if($===1)return X+1;return sl(Q,X+1)+1;case"]":case"}":case")":return X+1;case"\\":{let J=Q[X+1];switch(J){case"x":if(n0(Q[X+2])&&n0(Q[X+3]))return X+4;throw Error(`Unexpected token '${Q.substring(X,X+4)}' found`);case"u":if(Q[X+2]==="{"){if(!Y)return X+2;if(Q[X+4]==="}"){if(n0(Q[X+3]))return X+5;throw Error(`Unexpected token '${Q.substring(X,X+5)}' found`)}if(Q[X+5]==="}"){if(n0(Q[X+3])&&n0(Q[X+4]))return X+6;throw Error(`Unexpected token '${Q.substring(X,X+6)}' found`)}if(Q[X+6]==="}"){if(n0(Q[X+3])&&n0(Q[X+4])&&n0(Q[X+5]))return X+7;throw Error(`Unexpected token '${Q.substring(X,X+7)}' found`)}if(Q[X+7]==="}"){if(n0(Q[X+3])&&n0(Q[X+4])&&n0(Q[X+5])&&n0(Q[X+6]))return X+8;throw Error(`Unexpected token '${Q.substring(X,X+8)}' found`)}if(Q[X+8]==="}"&&n0(Q[X+3])&&n0(Q[X+4])&&n0(Q[X+5])&&n0(Q[X+6])&&n0(Q[X+7]))return X+9;throw Error(`Unexpected token '${Q.substring(X,X+9)}' found`)}if(n0(Q[X+2])&&n0(Q[X+3])&&n0(Q[X+4])&&n0(Q[X+5]))return X+6;throw Error(`Unexpected token '${Q.substring(X,X+6)}' found`);case"p":case"P":{if(!Y)return X+2;let Z=X+2;for(;Z<Q.length&&Q[Z]!=="}";Z+=Q[Z]==="\\"?2:1);if(Q[Z]!=="}")throw Error("Invalid \\P definition");return Z+1}case"k":{let Z=X+2;for(;Z<Q.length&&Q[Z]!==">";++Z);if(Q[Z]!==">"){if(!Y)return X+2;throw Error("Invalid \\k definition")}return Z+1}default:if(qH(J)){let Z=Y?Q.length:Math.min(X+4,Q.length),G=X+2;for(;G<Z&&qH(Q[G]);++G);return G}return X+(Y?FL(Q,X+1):1)+1}}default:return X+(Y?FL(Q,X):1)}}function V3(Q,X,Y,$){let J=el(Q,X,Y,$);return Q.substring(X,J)}var RL={gc:"General_Category",sc:"Script",scx:"Script_Extensions"},C3={ASCII:"ASCII",ASCII_Hex_Digit:"AHex",Alphabetic:"Alpha",Any:"Any",Assigned:"Assigned",Bidi_Control:"Bidi_C",Bidi_Mirrored:"Bidi_M",Case_Ignorable:"CI",Cased:"Cased",Changes_When_Casefolded:"CWCF",Changes_When_Casemapped:"CWCM",Changes_When_Lowercased:"CWL",Changes_When_NFKC_Casefolded:"CWKCF",Changes_When_Titlecased:"CWT",Changes_When_Uppercased:"CWU",Dash:"Dash",Default_Ignorable_Code_Point:"DI",Deprecated:"Dep",Diacritic:"Dia",Emoji:"Emoji",Emoji_Component:"Emoji_Component",Emoji_Modifier:"Emoji_Modifier",Emoji_Modifier_Base:"Emoji_Modifier_Base",Emoji_Presentation:"Emoji_Presentation",Extended_Pictographic:"Extended_Pictographic",Extender:"Ext",Grapheme_Base:"Gr_Base",Grapheme_Extend:"Gr_Ext",Hex_Digit:"Hex",IDS_Binary_Operator:"IDSB",IDS_Trinary_Operator:"IDST",ID_Continue:"IDC",ID_Start:"IDS",Ideographic:"Ideo",Join_Control:"Join_C",Logical_Order_Exception:"LOE",Lowercase:"Lower",Math:"Math",Noncharacter_Code_Point:"NChar",Pattern_Syntax:"Pat_Syn",Pattern_White_Space:"Pat_WS",Quotation_Mark:"QMark",Radical:"Radical",Regional_Indicator:"RI",Sentence_Terminal:"STerm",Soft_Dotted:"SD",Terminal_Punctuation:"Term",Unified_Ideograph:"UIdeo",Uppercase:"Upper",Variation_Selector:"VS",White_Space:"space",XID_Continue:"XIDC",XID_Start:"XIDS"},Q7=dH(C3),mH={Cased_Letter:"LC",Close_Punctuation:"Pe",Connector_Punctuation:"Pc",Control:["Cc","cntrl"],Currency_Symbol:"Sc",Dash_Punctuation:"Pd",Decimal_Number:["Nd","digit"],Enclosing_Mark:"Me",Final_Punctuation:"Pf",Format:"Cf",Initial_Punctuation:"Pi",Letter:"L",Letter_Number:"Nl",Line_Separator:"Zl",Lowercase_Letter:"Ll",Mark:["M","Combining_Mark"],Math_Symbol:"Sm",Modifier_Letter:"Lm",Modifier_Symbol:"Sk",Nonspacing_Mark:"Mn",Number:"N",Open_Punctuation:"Ps",Other:"C",Other_Letter:"Lo",Other_Number:"No",Other_Punctuation:"Po",Other_Symbol:"So",Paragraph_Separator:"Zp",Private_Use:"Co",Punctuation:["P","punct"],Separator:"Z",Space_Separator:"Zs",Spacing_Mark:"Mc",Surrogate:"Cs",Symbol:"S",Titlecase_Letter:"Lt",Unassigned:"Cn",Uppercase_Letter:"Lu"},DH=dH(mH),zw={Adlam:"Adlm",Ahom:"Ahom",Anatolian_Hieroglyphs:"Hluw",Arabic:"Arab",Armenian:"Armn",Avestan:"Avst",Balinese:"Bali",Bamum:"Bamu",Bassa_Vah:"Bass",Batak:"Batk",Bengali:"Beng",Bhaiksuki:"Bhks",Bopomofo:"Bopo",Brahmi:"Brah",Braille:"Brai",Buginese:"Bugi",Buhid:"Buhd",Canadian_Aboriginal:"Cans",Carian:"Cari",Caucasian_Albanian:"Aghb",Chakma:"Cakm",Cham:"Cham",Cherokee:"Cher",Common:"Zyyy",Coptic:["Copt","Qaac"],Cuneiform:"Xsux",Cypriot:"Cprt",Cyrillic:"Cyrl",Deseret:"Dsrt",Devanagari:"Deva",Dogra:"Dogr",Duployan:"Dupl",Egyptian_Hieroglyphs:"Egyp",Elbasan:"Elba",Ethiopic:"Ethi",Georgian:"Geor",Glagolitic:"Glag",Gothic:"Goth",Grantha:"Gran",Greek:"Grek",Gujarati:"Gujr",Gunjala_Gondi:"Gong",Gurmukhi:"Guru",Han:"Hani",Hangul:"Hang",Hanifi_Rohingya:"Rohg",Hanunoo:"Hano",Hatran:"Hatr",Hebrew:"Hebr",Hiragana:"Hira",Imperial_Aramaic:"Armi",Inherited:["Zinh","Qaai"],Inscriptional_Pahlavi:"Phli",Inscriptional_Parthian:"Prti",Javanese:"Java",Kaithi:"Kthi",Kannada:"Knda",Katakana:"Kana",Kayah_Li:"Kali",Kharoshthi:"Khar",Khmer:"Khmr",Khojki:"Khoj",Khudawadi:"Sind",Lao:"Laoo",Latin:"Latn",Lepcha:"Lepc",Limbu:"Limb",Linear_A:"Lina",Linear_B:"Linb",Lisu:"Lisu",Lycian:"Lyci",Lydian:"Lydi",Mahajani:"Mahj",Makasar:"Maka",Malayalam:"Mlym",Mandaic:"Mand",Manichaean:"Mani",Marchen:"Marc",Medefaidrin:"Medf",Masaram_Gondi:"Gonm",Meetei_Mayek:"Mtei",Mende_Kikakui:"Mend",Meroitic_Cursive:"Merc",Meroitic_Hieroglyphs:"Mero",Miao:"Plrd",Modi:"Modi",Mongolian:"Mong",Mro:"Mroo",Multani:"Mult",Myanmar:"Mymr",Nabataean:"Nbat",New_Tai_Lue:"Talu",Newa:"Newa",Nko:"Nkoo",Nushu:"Nshu",Ogham:"Ogam",Ol_Chiki:"Olck",Old_Hungarian:"Hung",Old_Italic:"Ital",Old_North_Arabian:"Narb",Old_Permic:"Perm",Old_Persian:"Xpeo",Old_Sogdian:"Sogo",Old_South_Arabian:"Sarb",Old_Turkic:"Orkh",Oriya:"Orya",Osage:"Osge",Osmanya:"Osma",Pahawh_Hmong:"Hmng",Palmyrene:"Palm",Pau_Cin_Hau:"Pauc",Phags_Pa:"Phag",Phoenician:"Phnx",Psalter_Pahlavi:"Phlp",Rejang:"Rjng",Runic:"Runr",Samaritan:"Samr",Saurashtra:"Saur",Sharada:"Shrd",Shavian:"Shaw",Siddham:"Sidd",SignWriting:"Sgnw",Sinhala:"Sinh",Sogdian:"Sogd",Sora_Sompeng:"Sora",Soyombo:"Soyo",Sundanese:"Sund",Syloti_Nagri:"Sylo",Syriac:"Syrc",Tagalog:"Tglg",Tagbanwa:"Tagb",Tai_Le:"Tale",Tai_Tham:"Lana",Tai_Viet:"Tavt",Takri:"Takr",Tamil:"Taml",Tangut:"Tang",Telugu:"Telu",Thaana:"Thaa",Thai:"Thai",Tibetan:"Tibt",Tifinagh:"Tfng",Tirhuta:"Tirh",Ugaritic:"Ugar",Vai:"Vaii",Warang_Citi:"Wara",Yi:"Yiii",Zanabazar_Square:"Zanb"},NL=dH(zw);function dH(Q){let X={};for(let Y of Object.keys(Q)){let $=Q[Y];if(Array.isArray($))for(let J=0;J!==$.length;++J)X[$[J]]=Y;else X[$]=Y}return X}function Qo(Q){return Q in mH||Q in DH}function Xo(Q){return Q in C3||Q in Q7}function LL(Q){if(Q in RL)return RL[Q];if(Q in Q7)return Q7[Q];if(Q in C3||Q==="General_Category"||Q==="Script"||Q==="Script_Extensions")return Q;throw Error(`Unknown Unicode property name: ${Q}`)}function ML(Q){if(Q in DH)return DH[Q];if(Q in NL)return NL[Q];if(Q in Q7)return Q7[Q];if(Q in mH||Q in zw||Q in C3)return Q;throw Error(`Unknown Unicode property value: ${Q}`)}function Yo(Q,X){let Y=Q.indexOf("=");if(Y!==-1){let $=Q.substring(0,Y),J=Q.substring(Y+1);return{type:"UnicodeProperty",name:$,value:J,negative:X,shorthand:!1,binary:!1,canonicalName:LL($),canonicalValue:ML(J)}}if(Qo(Q))return{type:"UnicodeProperty",name:"General_Category",value:Q,negative:X,shorthand:!0,binary:!1,canonicalName:"General_Category",canonicalValue:ML(Q)};if(Xo(Q)){let $=LL(Q);return{type:"UnicodeProperty",name:Q,value:Q,negative:X,shorthand:!1,binary:!0,canonicalName:$,canonicalValue:$}}throw Error(`Invalid Unicode property: ${Q}`)}var uW=String.fromCodePoint;function lW(Q){let X=Q.pop();if(X===void 0)throw Error("Unable to extract token preceeding the currently parsed one");return X}function Ow(Q){return Q>="0"&&Q<="9"}function O3(Q,X){return{type:"Char",kind:"simple",symbol:Q,value:Q,codePoint:Q.codePointAt(0)||-1,escaped:X}}function m5(Q,X){return{type:"Char",kind:"meta",symbol:X,value:Q,codePoint:X.codePointAt(0)||-1}}function T6(Q,X){if(Q.length>1)return{type:"Alternative",expressions:Q};if(!X&&Q.length===0)throw Error("Unsupported no token");return Q[0]}function oW(Q){if(Q[0]==="\\"){let X=Q[1];switch(X){case"x":{let Y=Q.substring(2),$=Number.parseInt(Y,16);return{type:"Char",kind:"hex",symbol:uW($),value:Q,codePoint:$}}case"u":{if(Q==="\\u")return O3("u",!0);let Y=Q[2]==="{"?Q.substring(3,Q.length-1):Q.substring(2),$=Number.parseInt(Y,16);return{type:"Char",kind:"unicode",symbol:uW($),value:Q,codePoint:$}}case"0":return m5(Q,"\x00");case"n":return m5(Q,`
|
|
63
|
-
`);case"f":return m5(Q,"\f");case"r":return m5(Q,"\r");case"t":return m5(Q,"\t");case"v":return m5(Q,"\v");case"w":case"W":case"d":case"D":case"s":case"S":case"b":case"B":return{type:"Char",kind:"meta",symbol:void 0,value:Q,codePoint:NaN};default:if(Ow(X)){let Y=Q.substring(1),$=Number(Y);return{type:"Char",kind:"decimal",symbol:uW($),value:Q,codePoint:$}}if(Q.length>2&&(X==="p"||X==="P")){let Y=X==="P";return Yo(Q.substring(3,Q.length-1),Y)}return O3(Q.substring(1),!0)}}return O3(Q)}function d5(Q,X,Y,$){let J=null;for(let Z=0,G=V3(X,Z,Y,0);Z!==X.length;Z+=G.length,G=V3(X,Z,Y,0)){let W=G[0];switch(W){case"|":if(J===null)J=[];J.push(T6(Q.splice(0),!0)||null);break;case".":Q.push({type:"Char",kind:"meta",symbol:G,value:G,codePoint:NaN});break;case"*":case"+":{let H=lW(Q);Q.push({type:"Repetition",expression:H,quantifier:{type:"Quantifier",kind:W,greedy:!0}});break}case"?":{let H=lW(Q);if(H.type==="Repetition")H.quantifier.greedy=!1,Q.push(H);else Q.push({type:"Repetition",expression:H,quantifier:{type:"Quantifier",kind:W,greedy:!0}});break}case"{":{if(G==="{"){Q.push(O3(G));break}let H=lW(Q),K=G.substring(1,G.length-1).split(","),V=Number(K[0]),_=K.length===1?V:K[1].length!==0?Number(K[1]):void 0;Q.push({type:"Repetition",expression:H,quantifier:{type:"Quantifier",kind:"Range",greedy:!0,from:V,to:_}});break}case"[":{let H=G.substring(1,G.length-1),K=[],V=void 0,_=!1;for(let q=0,D=V3(H,q,Y,1);q!==H.length;q+=D.length,D=V3(H,q,Y,1)){if(q===0&&D==="^"){V=!0;continue}let B=oW(D);if(D==="-")K.push(B),_=!0;else{let F=K.length>=2?K[K.length-2]:void 0;if(_&&F!==void 0&&F.type==="Char"&&B.type==="Char")K.pop(),K.pop(),K.push({type:"ClassRange",from:F,to:B});else K.push(B);_=!1}}Q.push({type:"CharacterClass",expressions:K,negative:V});break}case"(":{let H=G.substring(1,G.length-1),K=[];if(H[0]==="?")if(H[1]===":")d5(K,H.substring(2),Y,$),Q.push({type:"Group",capturing:!1,expression:T6(K)});else if(H[1]==="="||H[1]==="!")d5(K,H.substring(2),Y,$),Q.push({type:"Assertion",kind:"Lookahead",negative:H[1]==="!"?!0:void 0,assertion:T6(K)});else if(H[1]==="<"&&(H[2]==="="||H[2]==="!"))d5(K,H.substring(3),Y,$),Q.push({type:"Assertion",kind:"Lookbehind",negative:H[2]==="!"?!0:void 0,assertion:T6(K)});else{let V=H.split(">");if(V.length<2||V[0][1]!=="<")throw Error(`Unsupported regex content found at ${JSON.stringify(G)}`);let _=++$.lastIndex,q=V[0].substring(2);$.named.set(q,_),d5(K,V.slice(1).join(">"),Y,$),Q.push({type:"Group",capturing:!0,nameRaw:q,name:q,number:_,expression:T6(K)})}else{let V=++$.lastIndex;d5(K,H,Y,$),Q.push({type:"Group",capturing:!0,number:V,expression:T6(K)})}break}default:if(G==="^")Q.push({type:"Assertion",kind:G});else if(G==="$")Q.push({type:"Assertion",kind:G});else if(G[0]==="\\"&&Ow(G[1])){let H=Number(G.substring(1));if(Y||H<=$.lastIndex)Q.push({type:"Backreference",kind:"number",number:H,reference:H});else Q.push(oW(G))}else if(G[0]==="\\"&&G[1]==="k"&&G.length!==2){let H=G.substring(3,G.length-1);Q.push({type:"Backreference",kind:"name",number:$.named.get(H)||0,referenceRaw:H,reference:H})}else Q.push(oW(G));break}}if(J!==null){J.push(T6(Q.splice(0),!0)||null);let Z={type:"Disjunction",left:J[0],right:J[1]};for(let G=2;G<J.length;++G)Z={type:"Disjunction",left:Z,right:J[G]};Q.push(Z)}}function $o(Q){let X=nX([...Q.flags],"u")!==-1,Y=Q.source,$=[];return d5($,Y,X,{lastIndex:0,named:new Map}),T6($)}var Jo=String.fromCodePoint;function Zo(Q){if(Q.binary||Q.shorthand)return Q.canonicalValue;return`${Q.canonicalName}=${Q.canonicalValue}`}function wL(Q,X,Y,$){let J=-1;for(let Z=X;Z<=Y;++Z)if(Q.test(Jo(Z))){if(J===-1)J=Z}else if(J!==-1){let G=Z-1;$.push(J===G?[G]:[J,G]),J=-1}if(J!==-1)$.push(J===Y?[Y]:[J,Y])}function Go(Q,X){let Y=new RegExp(`^\\${X?"P":"p"}{${Q}}$`,"u"),$=[];return wL(Y,0,55295,$),wL(Y,57344,1114111,$),$}var PL=new Map;function Wo(Q,X){let Y=`${X?"P":"p"}:${Q}`,$=PL.get(Y);if($!==void 0)return $;let J=Go(Q,X);return PL.set(Y,J),J}function Ho(Q){return l5(...O0(Wo(Zo(Q),Q.negative),(X)=>eW(X)))}var Ko=String.fromCodePoint,Fw=[..."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"],Rw=[..."0123456789"],Nw=[...` \r
|
|
64
|
-
\v\f`],UH=[...`\r
|
|
65
|
-
`],Lw=[..."\x1E\x15"],Vo=[...UH,...Lw],_o=new c8(Fw),qo=new c8(Rw),Do=new c8(Nw),Uo=new c8(Lw),Bo=new c8(Vo),T9=()=>a0({unit:"grapheme-ascii",minLength:1,maxLength:1});function AL(Q){return new h(`Unsupported AST node! Received: ${o0(Q)}`)}function I9(Q,X,Y){switch(Q.type){case"Char":if(Q.kind==="meta")switch(Q.value){case"\\w":return D4(...Fw);case"\\W":return T9().filter(($)=>!I6(_o,$));case"\\d":return D4(...Rw);case"\\D":return T9().filter(($)=>!I6(qo,$));case"\\s":return D4(...Nw);case"\\S":return T9().filter(($)=>!I6(Do,$));case"\\b":case"\\B":throw new h(`Meta character ${Q.value} not implemented yet!`);case".":{let $=Y.dotAll?Uo:Bo;return T9().filter((J)=>!I6($,J))}}if(Q.symbol===void 0)throw new h(`Unexpected undefined symbol received for non-meta Char! Received: ${o0(Q)}`);return k0(Q.symbol);case"Repetition":{let $=I9(Q.expression,X,Y);switch(Q.quantifier.kind){case"*":return a0({...X,unit:$});case"+":return a0({...X,minLength:1,unit:$});case"?":return a0({...X,minLength:0,maxLength:1,unit:$});case"Range":return a0({...X,minLength:Q.quantifier.from,maxLength:Q.quantifier.to,unit:$});default:throw AL(Q.quantifier)}}case"Quantifier":throw new h("Wrongly defined AST tree, Quantifier nodes not supposed to be scanned!");case"Alternative":{let $=[],J="";for(let Z of Q.expressions)if(Z.type==="Char"&&Z.kind!=="meta"&&Z.symbol!==void 0)J+=Z.symbol;else if(Y.multiline||Z.type!=="Assertion"||Z.kind!=="^"&&Z.kind!=="$"){if(J!=="")T($,k0(J)),J="";T($,I9(Z,X,Y))}if(J!=="")T($,k0(J));if($.length===0)return k0("");if($.length===1)return $[0];return Z0(...$).map((Z)=>y0(Z,""))}case"CharacterClass":if(Q.negative){let $=O0(Q.expressions,(J)=>I9(J,X,Y));return T9().filter((J)=>hL($,(Z)=>!Z.canShrinkWithoutContext(J)))}return J1(...O0(Q.expressions,($)=>I9($,X,Y)));case"ClassRange":{let $=Q.from.codePoint,J=Q.to.codePoint;return A0({min:$,max:J}).map((Z)=>Ko(Z),(Z)=>{if(typeof Z!=="string")throw new h("Invalid type");if([...Z].length!==1)throw new h("Invalid length");return f5(Z,0)})}case"Group":return I9(Q.expression,X,Y);case"Disjunction":{let $=[Q.left,Q.right],J=[];for(let Z=0;Z!==$.length;++Z){let G=$[Z];if(G===null)T(J,k0(""));else if(G.type==="Disjunction")T($,G.left),T($,G.right);else T(J,I9(G,X,Y))}return J1(...J)}case"Assertion":if(Q.kind==="^"||Q.kind==="$"){if(Y.multiline)if(Q.kind==="^")return J1(k0(""),Z0(a0({unit:T9()}),D4(...UH)).map(($)=>`${$[0]}${$[1]}`,($)=>{if(typeof $!=="string"||$.length===0)throw new h("Invalid type");return[d0($,0,$.length-1),$[$.length-1]]}));else return J1(k0(""),Z0(D4(...UH),a0({unit:T9()})).map(($)=>`${$[0]}${$[1]}`,($)=>{if(typeof $!=="string"||$.length===0)throw new h("Invalid type");return[$[0],d0($,1)]}));return k0("")}throw new h(`Assertions of kind ${Q.kind} not implemented yet!`);case"Backreference":throw new h("Backreference nodes not implemented yet!");case"UnicodeProperty":return Ho(Q);default:throw AL(Q)}}function zo(Q,X={}){for(let W of Q.flags)if(W!=="d"&&W!=="g"&&W!=="m"&&W!=="s"&&W!=="u")throw new h(`Unable to use "stringMatching" against a regex using the flag ${W}`);let Y=X.maxLength,$={size:X.size,maxLength:Y},J={multiline:Q.multiline,dotAll:Q.dotAll},Z=al($o(Q));if(Y!==void 0)Z=il(Z,Y);let G=I9(Z,$,J);if(Y!==void 0)return G.filter((W)=>[...W].length<=Y);return G}function Oo(Q){let X=[];for(let Y=0;Y!==Q.length;++Y)X.push(Q[Y].next());return X}function Fo(Q,X){for(let Y=0;Y!==Q.length;++Y)X[Y]=Q[Y].next()}function Ro(Q){for(let X=0;X!==Q.length;++X)if(Q[X].done)return!0;return!1}function*No(...Q){let X=Oo(Q);while(!Ro(X))yield X.map((Y)=>Y.value),Fo(Q,X)}function*Lo(Q){let X=Q;while(!0)yield X,++X}var Mo=class extends g0{constructor(Q,X){super();this.arb=Q,this.maxShrinks=X}generate(Q,X){let Y=this.arb.generate(Q,X);return this.valueMapper(Y,0)}canShrinkWithoutContext(Q){return this.arb.canShrinkWithoutContext(Q)}shrink(Q,X){if(this.isSafeContext(X))return this.safeShrink(Q,X.originalContext,X.length);return this.safeShrink(Q,void 0,0)}safeShrink(Q,X,Y){let $=this.maxShrinks-Y;if($<=0)return G0.nil();return new G0(No(this.arb.shrink(Q,X),Lo(Y+1))).take($).map((J)=>this.valueMapper(J[0],J[1]))}valueMapper(Q,X){let Y={originalContext:Q.context,length:X};return new y(Q.value,Y)}isSafeContext(Q){return Q!==null&&Q!==void 0&&typeof Q==="object"&&"originalContext"in Q&&"length"in Q}};function wo(Q,X){return new Mo(Q,X)}var Po="module",Ao="4.9.0",Co="0d3c2547dce556f72413607849377530d18ea283";var $7=f2;function H8(){return(Q,X,Y)=>{return E(new P9(Q.map(TX),($)=>X($.map((J)=>E(J))),Y))}}function A8(Q,X){return H8()([],()=>(Y,$)=>Q(Y)?f(Y):p(new u0($,R(Y))),X)}function jo(Q){return Q}function To(Q){return(X)=>X.annotate(Q)}function Io(Q){return(X)=>pH(pH(X).annotate(Q))}function Eo(Q){return(X)=>{return X.rebuild(bX(X.ast,Q))}}function So(Q){return Q}function Mw(Q){return Y1(Q)?Q.value:{issues:[{message:iJ(Q.cause)}]}}function vo(Q,X){let Y=i0(Q),$={errors:"all",...X?.parseOptions},J=Rz(X),Z=(G)=>{let W=new X5,H=F5(SZ(Y(G,$),{onFailure:J,onSuccess:(V)=>({value:V})}),{scheduler:W});H.currentDispatcher?.flush();let K=H.pollUnsafe();if(K)return Mw(K);return new Promise((V)=>{H.addObserver((_)=>{V(Mw(_))})})};if("~standard"in Q){let G=Q;if("validate"in G["~standard"])return G;return Object.assign(G["~standard"],{validate:Z}),G}else return Object.assign(Q,{"~standard":{version:1,vendor:"effect",validate:Z}})}function ww(Q,X){let Y=EA(Q);if(X==="draft-2020-12"){let $=Y.schema;if(Object.keys(Y.definitions).length>0)$.$defs=Y.definitions;return $}else if(X==="draft-07"){let $=WR(Y),J=$.schema;if(Object.keys($.definitions).length>0)J.definitions=$.definitions;return J}throw new globalThis.Error(`Unsupported target: ${X}`)}function xo(Q){let X={input(Y){return ww(Q,Y.target)},output(Y){return ww(k1(Q),Y.target)}};if("~standard"in Q){let Y=Q;if("jsonSchema"in Y["~standard"])return Y;return Object.assign(Y["~standard"],{jsonSchema:X}),Y}else return Object.assign(Q,{"~standard":{version:1,vendor:"effect",jsonSchema:X}})}var kw=VF,bo=qF;function S3(Q,X){let Y=i0(Q,X);return($,J)=>{return c2(Y($,J))}}var ko=S3;function yw(Q,X){let Y;for(let $ of Q.reasons){if(!pQ($)||!eG($.error))throw new globalThis.Error(X,{cause:Q});Y??=$.error}if(Y===void 0)throw new globalThis.Error(X,{cause:Q});return Y}function gw(Q){return mY(Q).then((X)=>{if(Y1(X))return X.value;throw yw(X.cause,"Promise adapter can only reject schema errors")})}function hw(Q){let X=U6(Q);if(Y1(X))return X.value;throw yw(X.cause,"Sync adapter can only throw schema errors")}function mw(Q,X){let Y=DF(Q,X);return($,J)=>{return dw(Y($,J))}}function dw(Q){return Y1(Q)?V9(Q.value):v4(Z4(Q.cause,(X)=>new C6(X)))}var yo=mw,go=XW,ho=UF;function pw(Q,X){let Y=BF(Q,X);return($,J)=>{return a9(Y($,J),(Z)=>new C6(Z))}}var mo=pw;function fw(Q,X){let Y=S3(Q,X);return($,J)=>{return gw(Y($,J))}}var po=fw;function cw(Q,X){let Y=S3(Q,X);return($,J)=>{return hw(Y($,J))}}var fo=cw;function v3(Q,X){let Y=x5(Q,X);return($,J)=>{return c2(Y($,J))}}var uw=v3;function lw(Q,X){let Y=zF(Q,X);return($,J)=>{return dw(Y($,J))}}var co=lw,uo=$W,lo=OF;function ow(Q,X){let Y=FF(Q,X);return($,J)=>{return a9(Y($,J),(Z)=>new C6(Z))}}var oo=ow;function rw(Q,X){let Y=v3(Q,X);return($,J)=>{return gw(Y($,J))}}var ro=rw;function iw(Q,X){let Y=v3(Q,X);return($,J)=>{return hw(Y($,J))}}var io=iw,E=mX;function x3(Q){return C(Q,$7)&&Q[$7]===$7}var k6=P1((Q)=>E(kX(Q.ast),{schema:Q})),no=P1((Q)=>Q.schema),P8=P1((Q)=>k6(y3(Q))),ao=P1((Q)=>Q.schema.members[0]),so=P1((Q)=>E(lG(Q.ast),{schema:Q})),to=P1((Q)=>Q.schema),k1=P1((Q)=>E(z1(Q.ast),{schema:Q})),s5=P1((Q)=>E(O1(Q.ast),{schema:Q})),J7="~effect/Schema/flip";function eo(Q){return C(Q,J7)&&Q[J7]===J7}function pH(Q){if(eo(Q))return Q.schema.rebuild(k8(Q.ast));return E(k8(Q.ast),{[J7]:J7,schema:Q})}function p0(Q){let X=E(new $8(Q),{literal:Q,transform(Y){return X.pipe(l(p0(Y),{decode:Y0(()=>Y),encode:Y0(()=>Q)}))}});return X}function nw(Q){return new yG(Q.map((X)=>x3(X)?X.ast:new $8(X)))}function Qr(Q){return E(nw(Q),{parts:Q})}function Xr(Q){return E(nw(Q).asTemplateLiteralParser(),{parts:Q})}function Yr(Q){return E(new kG(Object.keys(Q).filter((X)=>typeof Q[Q[X]]!=="number").map((X)=>[X,Q[X]])),{enums:Q})}var $r=E(CO),Jr=E(TO),uH=E(N9),F0=E(bG),lH=E(MO),n=E(L6),b3=E(hG),aw=E(yO),sw=E(hO),U4=E(dO),Zr=E(PO),Gr=E(SO);function Wr(Q){return E(new gG(Q))}function oH(Q,X){return E(Q,{fields:X,mapFields(Y,$){let J=Y(this.fields);return oH(j2(J,$?.unsafePreserveChecks?this.ast.checks:void 0),J)}})}function m(Q){return oH(j2(Q,void 0),Q)}function Hr(Q){return P1((X)=>X.mapFields(CF(Q)))}var Kr=(Q)=>typeof Q==="symbol"?Q:globalThis.String(Q);function Vr(Q){return function(X){let Y={},$=Object.create(null),J=Object.create(null),Z=new Set;for(let G of Reflect.ownKeys(X.fields)){let W=s5(X.fields[G]),H=Object.hasOwn(Q,G),K=H?Q[G]:G,V=Kr(K);if(Z.has(V))throw new globalThis.Error(`Duplicate encoded keys: ${O4(K)}`);if(Z.add(V),b(Y,K,W),H)$[G]=K,J[K]=G}return m(Y).pipe(l(X,h0({decode:GW(J),encode:GW($)})))}}function _r(Q,X){return(Y)=>{let $=f7(Y.fields,k1),J=m({...$,...Q});return Y.pipe(l(J,h0({decode:(Z)=>{let G={...Z};for(let W in Q){let H=X[W],K=H(Z);if(L1(K))b(G,W,K.value)}return G},encode:(Z)=>{let G={...Z};for(let W in Q)delete G[W];return G}})))}}function tw(Q,X,Y){let $=Y?.keyValueCombiner?.decode||Y?.keyValueCombiner?.encode?new A2(Y.keyValueCombiner.decode,Y.keyValueCombiner.encode):void 0;return E(aO(Q.ast,X.ast,$),{key:Q,value:X})}function qr(Q,X){return E(pO(Q.ast,X.map(TX)),{schema:Q,records:X})}function ew(Q,X){return E(Q,{elements:X,mapElements(Y,$){let J=Y(this.elements);return ew(pG(J,$?.unsafePreserveChecks?this.ast.checks:void 0),J)}})}function r5(Q){return ew(pG(Q),Q)}function Dr(Q,X){return E(fO(Q.ast,X.map(TX)),{schema:Q,rest:X})}var e0=P1((Q)=>E(new g8(!1,[],[Q.ast]),{value:Q}));var Ur=P1((Q)=>E(new g8(!1,[Q.ast],[Q.ast]),{value:Q}));function Br(Q){return Q1([Q,e0(Q)]).pipe(l(e0(k1(Q)),h0({decode:TV,encode:(X)=>X.length===1?X[0]:X})))}function zr(Q){return e0(Q).check($K())}var Or=P1((Q)=>{return E(new g8(!0,Q.ast.elements,Q.ast.rest),{schema:Q})});function QP(Q,X){return E(Q,{members:X,mapMembers(Y,$){let J=Y(this.members);return QP(T2(J,this.ast.mode,$?.unsafePreserveChecks?this.ast.checks:void 0),J)}})}function Q1(Q,X){return QP(T2(Q,X?.mode??"anyOf",void 0),Q)}function k3(Q){let X=Q.map(p0);return E(T2(X,"anyOf",void 0),{literals:Q,members:X,mapMembers(Y){return Q1(Y(this.members))},pick(Y){return k3(Y)},transform(Y){return Q1(X.map(($,J)=>$.transform(Y[J])))}})}var rH=P1((Q)=>Q1([Q,F0])),y3=P1((Q)=>Q1([Q,lH])),XP=P1((Q)=>Q1([Q,F0,lH]));function YP(Q){return E(new I2(()=>Q().ast))}function Fr(...Q){return(X)=>X.check(...Q)}function Rr(Q,X){return(Y)=>E(h8(Y.ast,[S2(Q,X)]),{schema:Y})}function $P(Q){return(X)=>E(iO(X.ast,Q),{schema:X,identifier:Q})}function Nr(Q,X){return(Y)=>{return(X.checks?Y.check(...X.checks):Y).pipe($P(Q))}}function iH(Q){return(X)=>E(oO(X.ast,new PX(Q,u)),{schema:X})}function JP(Q){return(X)=>E(rO(X.ast,new PX(u,Q)),{schema:X})}function Lr(Q){return ZP(Q)}function ZP(Q){return(X)=>iH(dY(Q))(X)}function Mr(Q){return GP(Q)}function GP(Q){return(X)=>JP(dY(Q))(X)}function l(Q,X){return(Y)=>{return E(b2(Y.ast,Q.ast,X?O2(X):A5()),{from:Y,to:Q})}}function wr(Q){return(X)=>{return l(k1(X),Q)(X)}}function nH(Q,X){return(Y)=>{return X?l(Y,X)(Q):l(Y)(Q)}}function Pr(Q){return(X)=>{return l(X,Q)(s5(X))}}function WP(Q){return(X)=>E(nO(X.ast,aH(Q)),{schema:X})}function aH(Q){return U9(Q,(X)=>D9(()=>Z4(X,(Y)=>Y.issue)))}function sH(Q,X){let Y=X?.encodingStrategy==="omit"?BG():b8();return($)=>{return k6(s5($)).pipe(l($,{decode:MX(aH(Q)),encode:Y}))}}function Ar(Q,X){return(Y)=>{return k1(Y).pipe(sH(Q,X),nH(k6(Y)))}}function HP(Q,X){let Y=X?.encodingStrategy==="omit"?BG():b8();return($)=>{return P8(s5($)).pipe(l($,{decode:MX(aH(Q)),encode:Y}))}}function Cr(Q,X){return(Y)=>{return k1(Y).pipe(HP(Q,X),nH(P8(Y)))}}function x9(Q){return p0(Q).pipe(WP(f(Q)))}function jr(Q){return x9(Q).pipe(sH(f(Q),{encodingStrategy:"omit"}))}function g3(Q,X){return m({_tag:x9(Q),...X})}function KP(Q){return(X)=>{let Y={},$=[],J=new Set,Z={},G=(K)=>(V)=>K.includes(V[Q]);return W(X),Object.assign(X,{cases:Y,discriminants:$,isAnyOf:G,guards:Z,match:H});function W(K){let V=K.ast;if(jX(V)&&"members"in K&&globalThis.Array.isArray(K.members)&&K.members.every(x3))return K.members.forEach(W);let _=IX(V);if(_.length>0){let q=_.find((D)=>D.key===Q)?.literal;if(F7(q)){let D=typeof q==="number"?globalThis.String(q):q;if(J.has(D))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(q)}`);J.add(D),$.push(q),b(Y,q,K),b(Z,q,kw(k1(K)));return}}throw new globalThis.Error("No literal or unique symbol found")}function H(){if(arguments.length===1){let D=arguments[0];return function(B){let F=B[Q];return(Object.hasOwn(D,F)?D[F]:void 0)(B)}}let K=arguments[0],V=arguments[1],_=K[Q];return(Object.hasOwn(V,_)?V[_]:void 0)(K)}}}function Tr(Q){let X={},Y=[];for(let W of Object.keys(Q)){let H=g3(W,Q[W]);b(X,W,H),Y.push(H)}let $=Q1(Y),{guards:J,isAnyOf:Z,match:G}=KP("_tag")($);return E($.ast,{cases:X,isAnyOf:Z,guards:J,match:G})}function Ir(){return(Q)=>{return Q}}function y6(Q,X){return A8((Y)=>Y instanceof Q,X)}function v0(){return(Q,X)=>{return new m0(Q.ast,O2(X))}}var j0=E2;function Er(Q,X=void 0){return new N6(Q,X)}function A1(Q,X){return l1(Q,F0,({annotations:Y})=>Y===void 0?X:X.annotate(Y))}var Pw="^\\S[\\s\\S]*\\S$|^\\S$|^$";function tH(Q){let X=new globalThis.RegExp(Pw);return j0((Y)=>Y.trim()===Y,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[Pw]}},...Q})}var Sr=a("effect/schema/isTrimmed",F0,({annotations:Q})=>tH(Q));function b9(Q,X){let{source:Y,flags:$}=Q,J=$===""?`new RegExp(${P(Y)})`:`new RegExp(${P(Y)}, ${P($)})`;return SX(Q,{toCode:()=>({runtime:`Schema.isPattern(${J})`}),...X})}var vr=m({source:n,flags:n}).check(j0((Q)=>{let X=wV(()=>new globalThis.RegExp(Q.source,Q.flags));return E1(X)&&X.success.source===Q.source&&X.success.flags===Q.flags})),xr={id:"effect/schema/isPattern",payloadSchema:vr,revive:({annotations:Q,payload:X})=>b9(new globalThis.RegExp(X.source,X.flags),Q)};function VP(Q){return rG({toCode:()=>({runtime:"Schema.isStringFinite()"}),...Q})}var br=a("effect/schema/isStringFinite",F0,({annotations:Q})=>VP(Q));function _P(Q){return iG({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...Q})}var kr=a("effect/schema/isStringBigInt",F0,({annotations:Q})=>_P(Q));function qP(Q){return aG({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...Q})}var yr=a("effect/schema/isStringSymbol",F0,({annotations:Q})=>qP(Q)),gr=(Q)=>{if(Q)return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${Q}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/};function DP(Q,X){let Y=gr(Q);return b9(Y,{expected:Q?`a UUID v${Q}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:Q??null}},toJsonSchema:()=>({pattern:Y.source,format:"uuid"}),toCode:()=>({runtime:Q===void 0?"Schema.isUUID()":`Schema.isUUID(${Q})`}),...X})}var hr=a("effect/schema/isUUID",m({version:Q1([k3([1,2,3,4,5,6,7,8]),F0])}),({annotations:Q,payload:X})=>DP(X.version??void 0,Q)),Aw=/^([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 UP(Q){return b9(Aw,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:Aw.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...Q})}var mr=a("effect/schema/isGUID",F0,({annotations:Q})=>UP(Q));function BP(Q){let X=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return b9(X,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isULID()"}),...Q})}var dr=a("effect/schema/isULID",F0,({annotations:Q})=>BP(Q));function eH(Q){let X=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return b9(X,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...Q})}var pr=a("effect/schema/isBase64",F0,({annotations:Q})=>eH(Q));function zP(Q){let X=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return b9(X,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...Q})}var fr=a("effect/schema/isBase64Url",F0,({annotations:Q})=>zP(Q));function OP(Q,X){let Y=JSON.stringify(Q),$=new globalThis.RegExp(`^${y5(Q)}`);return j0((J)=>J.startsWith(Q),{expected:`a string starting with ${Y}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:Q}},toJsonSchema:()=>({pattern:$.source}),toCode:()=>({runtime:`Schema.isStartsWith(${P(Q)})`}),arbitrary:{constraint:{patterns:[$.source]}},...X})}var cr=a("effect/schema/isStartsWith",m({startsWith:n}),({annotations:Q,payload:X})=>OP(X.startsWith,Q));function FP(Q,X){let Y=JSON.stringify(Q),$=new globalThis.RegExp(`${y5(Q)}$`);return j0((J)=>J.endsWith(Q),{expected:`a string ending with ${Y}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:Q}},toJsonSchema:()=>({pattern:$.source}),toCode:()=>({runtime:`Schema.isEndsWith(${P(Q)})`}),arbitrary:{constraint:{patterns:[$.source]}},...X})}var ur=a("effect/schema/isEndsWith",m({endsWith:n}),({annotations:Q,payload:X})=>FP(X.endsWith,Q));function RP(Q,X){let Y=JSON.stringify(Q),$=new globalThis.RegExp(y5(Q));return j0((J)=>J.includes(Q),{expected:`a string including ${Y}`,representation:{id:"effect/schema/isIncludes",payload:{includes:Q}},toJsonSchema:()=>({pattern:$.source}),toCode:()=>({runtime:`Schema.isIncludes(${P(Q)})`}),arbitrary:{constraint:{patterns:[$.source]}},...X})}var lr=a("effect/schema/isIncludes",m({includes:n}),({annotations:Q,payload:X})=>RP(X.includes,Q)),Cw="^[^a-z]*$";function NP(Q){let X=new globalThis.RegExp(Cw);return j0((Y)=>Y.toUpperCase()===Y,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[Cw]}},...Q})}var or=a("effect/schema/isUppercased",F0,({annotations:Q})=>NP(Q)),jw="^[^A-Z]*$";function LP(Q){let X=new globalThis.RegExp(jw);return j0((Y)=>Y.toLowerCase()===Y,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[jw]}},...Q})}var rr=a("effect/schema/isLowercased",F0,({annotations:Q})=>LP(Q)),Tw="^[^a-z]?.*$";function MP(Q){let X=new globalThis.RegExp(Tw);return j0((Y)=>Y.charAt(0).toUpperCase()===Y.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[Tw]}},...Q})}var ir=a("effect/schema/isCapitalized",F0,({annotations:Q})=>MP(Q)),Iw="^[^A-Z]?.*$";function wP(Q){let X=new globalThis.RegExp(Iw);return j0((Y)=>Y.charAt(0).toLowerCase()===Y.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:X.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[Iw]}},...Q})}var nr=a("effect/schema/isUncapitalized",F0,({annotations:Q})=>wP(Q)),o8=E(M2),PP=fG,ar=a("effect/schema/isFinite",F0,({annotations:Q})=>PP(Q));function Z7(Q){let X=Y6(Q.order),Y=Q.formatter??P;return($,J)=>{return j0((Z)=>X(Z,$),{expected:`a value greater than ${Y($)}`,arbitrary:{constraint:{ordered:{order:Q.order,minimum:$,exclusiveMinimum:!0}}},...Q.annotate?.($),...J})}}function G7(Q){let X=DQ(Q.order),Y=Q.formatter??P;return($,J)=>{return j0((Z)=>X(Z,$),{expected:`a value greater than or equal to ${Y($)}`,arbitrary:{constraint:{ordered:{order:Q.order,minimum:$}}},...Q.annotate?.($),...J})}}function W7(Q){let X=o9(Q.order),Y=Q.formatter??P;return($,J)=>{return j0((Z)=>X(Z,$),{expected:`a value less than ${Y($)}`,arbitrary:{constraint:{ordered:{order:Q.order,maximum:$,exclusiveMaximum:!0}}},...Q.annotate?.($),...J})}}function H7(Q){let X=qQ(Q.order),Y=Q.formatter??P;return($,J)=>{return j0((Z)=>X(Z,$),{expected:`a value less than or equal to ${Y($)}`,arbitrary:{constraint:{ordered:{order:Q.order,maximum:$}}},...Q.annotate?.($),...J})}}function K7(Q){let X=DQ(Q.order),Y=Y6(Q.order),$=qQ(Q.order),J=o9(Q.order),Z=Q.formatter??P;return(G,W)=>{let H=G.exclusiveMinimum?Y:X,K=G.exclusiveMaximum?J:$;return j0((V)=>H(V,G.minimum)&&K(V,G.maximum),{expected:`a value between ${Z(G.minimum)}${G.exclusiveMinimum?" (excluded)":""} and ${Z(G.maximum)}${G.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:Q.order,minimum:G.minimum,maximum:G.maximum,...G.exclusiveMinimum&&{exclusiveMinimum:!0},...G.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...Q.annotate?.(G),...W})}}function AP(Q){return(X,Y)=>{let $=Q.formatter??P;return j0((J)=>Q.remainder(J,X)===Q.zero,{expected:`a value that is a multiple of ${$(X)}`,...Q.annotate?.(X),...Y})}}function i5(Q){if(!globalThis.Number.isFinite(Q))throw new globalThis.RangeError(`Expected a finite number, got ${P(Q)}`);return Q}var CP=Z7({order:D1,annotate:(Q)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:i5(Q)}},toJsonSchema:()=>({exclusiveMinimum:Q}),toCode:()=>({runtime:`Schema.isGreaterThan(${P(Q)})`})})}),sr=a("effect/schema/isGreaterThan",m({exclusiveMinimum:o8}),({annotations:Q,payload:X})=>CP(X.exclusiveMinimum,Q)),QK=G7({order:D1,annotate:(Q)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:i5(Q)}},toJsonSchema:()=>({minimum:Q}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${P(Q)})`})})}),tr=a("effect/schema/isGreaterThanOrEqualTo",m({minimum:o8}),({annotations:Q,payload:X})=>QK(X.minimum,Q)),jP=W7({order:D1,annotate:(Q)=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:i5(Q)}},toJsonSchema:()=>({exclusiveMaximum:Q}),toCode:()=>({runtime:`Schema.isLessThan(${P(Q)})`})})}),er=a("effect/schema/isLessThan",m({exclusiveMaximum:o8}),({annotations:Q,payload:X})=>jP(X.exclusiveMaximum,Q)),TP=H7({order:D1,annotate:(Q)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:i5(Q)}},toJsonSchema:()=>({maximum:Q}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${P(Q)})`})})}),Qi=a("effect/schema/isLessThanOrEqualTo",m({maximum:o8}),({annotations:Q,payload:X})=>TP(X.maximum,Q)),h3=K7({order:D1,annotate:(Q)=>{let X=Q.exclusiveMinimum?!0:void 0,Y=Q.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:i5(Q.minimum),maximum:i5(Q.maximum),...X&&{exclusiveMinimum:X},...Y&&{exclusiveMaximum:Y}}},toJsonSchema:()=>({[X?"exclusiveMinimum":"minimum"]:Q.minimum,[Y?"exclusiveMaximum":"maximum"]:Q.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${P(Q.minimum)}, maximum: ${P(Q.maximum)}, exclusiveMinimum: ${P(X)}, exclusiveMaximum: ${P(Y)} })`})}}}),Xi=a("effect/schema/isBetween",m({minimum:o8,maximum:o8,exclusiveMinimum:P8(p0(!0)),exclusiveMaximum:P8(p0(!0))}),({annotations:Q,payload:X})=>h3(X,Q)),IP=AP({remainder:wU,zero:0,annotate:(Q)=>({expected:`a value that is a multiple of ${Q}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:Q}},toJsonSchema:()=>({multipleOf:Q}),toCode:()=>({runtime:`Schema.isMultipleOf(${P(Q)})`})})}),Yi=a("effect/schema/isMultipleOf",m({divisor:o8}),({annotations:Q,payload:X})=>IP(X.divisor,Q));function V7(Q){return j0((X)=>globalThis.Number.isSafeInteger(X),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...Q})}var $i=a("effect/schema/isInt",F0,({annotations:Q})=>V7(Q)),k9=b3.check(V7()),W8=k9.check(QK(0));function Ji(Q){return new N6([V7(),h3({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...Q})}function Zi(Q){return new N6([V7(),h3({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...Q})}function n5(Q){if(globalThis.Number.isNaN(Q.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${P(Q)}`);return Q.toISOString()}function a5(Q){return`new Date(${P(Q.getTime())})`}var EP=Z7({order:t6,annotate:(Q)=>{return{representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:n5(Q)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${a5(Q)})`})}}}),SP=G7({order:t6,annotate:(Q)=>{return{representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:n5(Q)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${a5(Q)})`})}}}),vP=W7({order:t6,annotate:(Q)=>{return{representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:n5(Q)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${a5(Q)})`})}}}),xP=H7({order:t6,annotate:(Q)=>{return{representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:n5(Q)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${a5(Q)})`})}}}),bP=K7({order:t6,annotate:(Q)=>{let X=Q.exclusiveMinimum?!0:void 0,Y=Q.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:n5(Q.minimum),maximum:n5(Q.maximum),...X&&{exclusiveMinimum:X},...Y&&{exclusiveMaximum:Y}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${a5(Q.minimum)}, maximum: ${a5(Q.maximum)}, exclusiveMinimum: ${P(X)}, exclusiveMaximum: ${P(Y)} })`})}}}),kP=Z7({order:_8,annotate:(Q)=>{return{representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:Q.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${P(Q)})`})}}}),yP=G7({order:_8,annotate:(Q)=>{return{representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:Q.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${P(Q)})`})}}}),gP=W7({order:_8,annotate:(Q)=>{return{representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:Q.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${P(Q)})`})}}}),hP=H7({order:_8,annotate:(Q)=>{return{representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:Q.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${P(Q)})`})}}}),mP=K7({order:_8,annotate:(Q)=>{let X=Q.exclusiveMinimum?!0:void 0,Y=Q.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:Q.minimum.toString(10),maximum:Q.maximum.toString(10),...X&&{exclusiveMinimum:X},...Y&&{exclusiveMaximum:Y}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${P(Q.minimum)}, maximum: ${P(Q.maximum)}, exclusiveMinimum: ${P(X)}, exclusiveMaximum: ${P(Y)} })`})}}}),Gi=Z7({order:b4,formatter:(Q)=>W4(Q)}),Wi=G7({order:b4,formatter:(Q)=>W4(Q)}),Hi=W7({order:b4,formatter:(Q)=>W4(Q)}),Ki=H7({order:b4,formatter:(Q)=>W4(Q)}),Vi=K7({order:b4,formatter:(Q)=>W4(Q)});function XK(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Y.length>=Q,{expected:`a value with a length of at least ${Q}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:Q}},toJsonSchema:({type:Y})=>Y==="array"?{minItems:Q}:{minLength:Q},toCode:()=>({runtime:`Schema.isMinLength(${Q})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q}},...X})}var _i=a("effect/schema/isMinLength",m({minLength:W8}),({annotations:Q,payload:X})=>XK(X.minLength,Q));function dP(Q){return XK(1,Q)}function pP(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Y.length<=Q,{expected:`a value with a length of at most ${Q}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:Q}},toJsonSchema:({type:Y})=>Y==="array"?{maxItems:Q}:{maxLength:Q},toCode:()=>({runtime:`Schema.isMaxLength(${Q})`}),[f1]:!0,arbitrary:{constraint:{maxLength:Q}},...X})}var qi=a("effect/schema/isMaxLength",m({maxLength:W8}),({annotations:Q,payload:X})=>pP(X.maxLength,Q));function YK(Q,X,Y){return Q=Math.max(0,Math.floor(Q)),X=Math.max(0,Math.floor(X)),j0(($)=>$.length>=Q&&$.length<=X,{expected:Q===X?`a value with a length of ${Q}`:`a value with a length between ${Q} and ${X}`,representation:{id:"effect/schema/isLengthBetween",payload:{minimum:Q,maximum:X}},toJsonSchema:({type:$})=>$==="array"?{allOf:[{minItems:Q},{maxItems:X}]}:{allOf:[{minLength:Q},{maxLength:X}]},toCode:()=>({runtime:`Schema.isLengthBetween(${Q}, ${X})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q,maxLength:X}},...Y})}var Di=a("effect/schema/isLengthBetween",m({minimum:W8,maximum:W8}),({annotations:Q,payload:X})=>YK(X.minimum,X.maximum,Q));function fP(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Y.size>=Q,{expected:`a value with a size of at least ${Q}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:Q}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${Q})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q}},...X})}var Ui=a("effect/schema/isMinSize",m({minSize:W8}),({annotations:Q,payload:X})=>fP(X.minSize,Q));function cP(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Y.size<=Q,{expected:`a value with a size of at most ${Q}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:Q}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${Q})`}),[f1]:!0,arbitrary:{constraint:{maxLength:Q}},...X})}var Bi=a("effect/schema/isMaxSize",m({maxSize:W8}),({annotations:Q,payload:X})=>cP(X.maxSize,Q));function uP(Q,X,Y){return Q=Math.max(0,Math.floor(Q)),X=Math.max(0,Math.floor(X)),j0(($)=>$.size>=Q&&$.size<=X,{expected:Q===X?`a value with a size of ${Q}`:`a value with a size between ${Q} and ${X}`,representation:{id:"effect/schema/isSizeBetween",payload:{minimum:Q,maximum:X}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${Q}, ${X})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q,maxLength:X}},...Y})}var zi=a("effect/schema/isSizeBetween",m({minimum:W8,maximum:W8}),({annotations:Q,payload:X})=>uP(X.minimum,X.maximum,Q));function lP(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Reflect.ownKeys(Y).length>=Q,{expected:`a value with at least ${Q===1?"1 entry":`${Q} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:Q}},toJsonSchema:()=>({minProperties:Q}),toCode:()=>({runtime:`Schema.isMinProperties(${Q})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q}},...X})}var Oi=a("effect/schema/isMinProperties",m({minProperties:W8}),({annotations:Q,payload:X})=>lP(X.minProperties,Q));function oP(Q,X){return Q=Math.max(0,Math.floor(Q)),j0((Y)=>Reflect.ownKeys(Y).length<=Q,{expected:`a value with at most ${Q===1?"1 entry":`${Q} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:Q}},toJsonSchema:()=>({maxProperties:Q}),toCode:()=>({runtime:`Schema.isMaxProperties(${Q})`}),[f1]:!0,arbitrary:{constraint:{maxLength:Q}},...X})}var Fi=a("effect/schema/isMaxProperties",m({maxProperties:W8}),({annotations:Q,payload:X})=>oP(X.maxProperties,Q));function rP(Q,X,Y){return Q=Math.max(0,Math.floor(Q)),X=Math.max(0,Math.floor(X)),j0(($)=>Reflect.ownKeys($).length>=Q&&Reflect.ownKeys($).length<=X,{expected:Q===X?`a value with exactly ${Q===1?"1 entry":`${Q} entries`}`:`a value with between ${Q} and ${X} entries`,representation:{id:"effect/schema/isPropertiesLengthBetween",payload:{minimum:Q,maximum:X}},toJsonSchema:()=>({minProperties:Q,maxProperties:X}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${Q}, ${X})`}),[f1]:!0,arbitrary:{constraint:{minLength:Q,maxLength:X}},...Y})}var Ri=a("effect/schema/isPropertiesLengthBetween",m({minimum:W8,maximum:W8}),({annotations:Q,payload:X})=>rP(X.minimum,X.maximum,Q));function iP(Q,X){let Y=s5(Q),$=_F(Y.ast);return j0((J,Z,G)=>{let W=Reflect.ownKeys(J),H=[];for(let K of W){let V=$(K,G);if(V!==void 0){if(H.push(new S0([K],V)),G.errors==="first")break}}if(e8(H))return new N0(Z,R(J),H);return!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[Y.ast]},toJsonSchema:({schemas:J})=>({propertyNames:J[0]}),toCode:({schemas:J})=>({runtime:`Schema.isPropertyNames(${J[0].runtime})`}),[f1]:!0,...X})}var Ni=a("effect/schema/isPropertyNames",F0,({annotations:Q,schemas:X})=>iP(X[0],Q));function $K(Q){return j0((X)=>l7(X).length===X.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}},...Q})}var Li=a("effect/schema/isUnique",F0,({annotations:Q})=>$K(Q)),Mi=n.check(dP()),wi=n.check(YK(1,1));function g6(Q){let X=H8()([Q],([Y])=>($,J,Z)=>{if(y7($)){if(I0($))return v8;return K1(i0(Y)($.value,Z),{onSuccess:R,onFailure:(G)=>new N0(J,R($),[new S0(["value"],G)])})}return p(new u0(J,R($)))},{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:Y})=>({runtime:`Schema.Option(${Y[0].runtime})`,Type:`Option.Option<${Y[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([Y])=>v0()(Q1([m({_tag:p0("Some"),value:Y}),m({_tag:p0("None")})]),h0({decode:($)=>$._tag==="None"?d():R($.value),encode:($)=>L1($)?{_tag:"Some",value:$.value}:{_tag:"None"}})),toArbitrary:([Y])=>($,J)=>{let Z=$.constant(d()),G=$.oneof(Z,Y.arbitrary.map(R));return t5($,J,Z,G)},toEquivalence:([Y])=>BV(Y),toFormatter:([Y])=>T8({onNone:()=>"none()",onSome:($)=>`some(${Y($)})`})});return E(X.ast,{value:Q})}var Pi=l1("effect/schema/Option",F0,({annotations:Q,typeParameters:X})=>{let Y=g6(X[0]);return Q===void 0?Y:Y.annotate(Q)});function Ai(Q){return rH(Q).pipe(l(g6(k1(Q)),tz()))}function Ci(Q){return y3(Q).pipe(l(g6(k1(Q)),ez()))}function ji(Q,X){return XP(Q).pipe(l(g6(k1(Q)),QO(X)))}function Ti(Q){return k6(Q).pipe(l(g6(k1(Q)),XO()))}function Ii(Q){return P8(Q).pipe(l(g6(k1(Q)),YO()))}function Ei(Q,X){let Y=X===void 0?"omit":X.onNoneEncoding,$=Y===null?null:void 0;return P8(rH(Q)).pipe(l(g6(k1(Q)),F2({decode:(J)=>J.pipe(n9(R7),R),encode:Y==="omit"?i9:(J)=>R(g7(i9(J),()=>$))})))}function nP(Q,X){let Y=H8()([Q,X],([$,J])=>(Z,G,W)=>{if(!PV(Z))return p(new u0(G,R(Z)));switch(Z._tag){case"Success":return K1(QW($)(Z.success,W),{onSuccess:t,onFailure:(H)=>new N0(G,R(Z),[new S0(["success"],H)])});case"Failure":return K1(QW(J)(Z.failure,W),{onSuccess:i,onFailure:(H)=>new N0(G,R(Z),[new S0(["failure"],H)])})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:$})=>({runtime:`Schema.Result(${$[0].runtime}, ${$[1].runtime})`,Type:`Result.Result<${$[0].Type}, ${$[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([$,J])=>v0()(Q1([m({_tag:p0("Success"),success:$}),m({_tag:p0("Failure"),failure:J})]),h0({decode:(Z)=>Z._tag==="Success"?t(Z.success):i(Z.failure),encode:(Z)=>E1(Z)?{_tag:"Success",success:Z.success}:{_tag:"Failure",failure:Z.failure}})),toArbitrary:([$,J])=>(Z,G)=>{let W=GA(Z,$.terminal?.map((K)=>t(K)),J.terminal?.map((K)=>i(K))),H=Z.oneof($.arbitrary.map((K)=>t(K)),J.arbitrary.map((K)=>i(K)));return t5(Z,G,W,H)},toEquivalence:([$,J])=>AV($,J),toFormatter:([$,J])=>B8({onSuccess:(Z)=>`success(${$(Z)})`,onFailure:(Z)=>`failure(${J(Z)})`})});return E(Y.ast,{success:Q,failure:X})}var Si=l1("effect/schema/Result",F0,({annotations:Q,typeParameters:X})=>{let Y=nP(X[0],X[1]);return Q===void 0?Y:Y.annotate(Q)}),vi=A8((Q)=>{if(!j1(Q))return!1;let X=globalThis.Object.keys(Q);return X.length>0&&X.every((Y)=>{switch(Y){case"label":return typeof Q[Y]==="string";case"disallowJsonEncode":return Q[Y]===!0;default:return!1}})}),xi=Q1([F0,vi]);function JK(Q,X){let Y=typeof X?.label==="string"?X.label:void 0,$=X?.disallowJsonEncode===!0,J=Y!==void 0?$?{label:Y,disallowJsonEncode:!0}:{label:Y}:$?{disallowJsonEncode:!0}:void 0,Z=Y!==void 0?i0(p0(Y)):void 0,G=H8()([Q],([W])=>(H,K,V)=>{if(WG(H)){let _=Z!==void 0?R5(Z(H.label,V),(q)=>new S0(["label"],q)):D6;return F8(_,()=>K1(i0(W)(M5(H),V),{onSuccess:()=>H,onFailure:()=>{let q=R(H);return new N0(K,q,[new S0(["value"],new q0(q))])}}))}return p(new u0(K,R(H)))},{representation:{id:"effect/schema/Redacted",payload:J??null},toCode:({typeParameters:W})=>({runtime:J!==void 0?`Schema.Redacted(${W[0].runtime}, ${P(J)})`:`Schema.Redacted(${W[0].runtime})`,Type:`Redacted.Redacted<${W[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([W])=>v0()(ZK(W),{decode:Y0((H)=>K4(H,{label:Y})),encode:$?DG((H)=>"Cannot serialize Redacted"+(L1(H)&&typeof H.value.label==="string"?` with label: "${H.value.label}"`:"")):Y0(M5)}),toArbitrary:([W])=>()=>({arbitrary:W.arbitrary.map((H)=>K4(H,{label:Y})),terminal:W.terminal?.map((H)=>K4(H,{label:Y}))}),toFormatter:()=>globalThis.String,toEquivalence:([W])=>qz(W)});return E(G.ast,{value:Q})}var bi=l1("effect/schema/Redacted",xi,({annotations:Q,payload:X,typeParameters:Y})=>{let $=JK(Y[0],X??void 0);return Q===void 0?$:$.annotate(Q)});function ZK(Q){return iH(R5(H2))(Q)}function ki(Q,X){return ZK(Q).pipe(l(JK(k1(Q),{label:X?.label,disallowJsonEncode:X?.disallowEncode}),{decode:Y0((Y)=>K4(Y,{label:X?.label})),encode:X?.disallowEncode?DG((Y)=>"Cannot encode Redacted"+(L1(Y)&&typeof Y.value.label==="string"?` with label: "${Y.value.label}"`:"")):Y0(M5)}))}function T3(Q,X){let Y=H8()([Q,X],([$,J])=>(Z,G,W)=>{if(!oJ(Z))return p(new u0(G,R(Z)));switch(Z._tag){case"Fail":return K1(i0($)(Z.error,W),{onSuccess:cQ,onFailure:(H)=>new N0(G,R(Z),[new S0(["error"],H)])});case"Die":return K1(i0(J)(Z.defect,W),{onSuccess:uQ,onFailure:(H)=>new N0(G,R(Z),[new S0(["defect"],H)])});case"Interrupt":return f(Z)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:$})=>({runtime:`Schema.CauseReason(${$[0].runtime}, ${$[1].runtime})`,Type:`Cause.Failure<${$[0].Type}, ${$[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([$,J])=>v0()(Q1([m({_tag:p0("Fail"),error:$}),m({_tag:p0("Die"),defect:J}),m({_tag:p0("Interrupt"),fiberId:y3(o8)})]),h0({decode:(Z)=>{switch(Z._tag){case"Fail":return cQ(Z.error);case"Die":return uQ(Z.defect);case"Interrupt":return lQ(Z.fiberId)}},encode:u})),toArbitrary:([$,J])=>aP($,J),toEquivalence:([$,J])=>sP($,J),toFormatter:([$,J])=>tP($,J)});return E(Y.ast,{error:Q,defect:X})}var yi=l1("effect/schema/CauseReason",F0,({annotations:Q,typeParameters:X})=>{let Y=T3(X[0],X[1]);return Q===void 0?Y:Y.annotate(Q)});function aP(Q,X){return(Y,$)=>{let J=Y.constant(lQ()),Z=Y.oneof(J,Y.integer({min:1}).map(lQ),Q.arbitrary.map((G)=>cQ(G)),X.arbitrary.map((G)=>uQ(G)));return t5(Y,$,J,Z)}}function sP(Q,X){return(Y,$)=>{if(Y._tag!==$._tag)return!1;switch(Y._tag){case"Fail":return Q(Y.error,$.error);case"Die":return X(Y.defect,$.defect);case"Interrupt":return Y.fiberId===$.fiberId}}}function tP(Q,X){return(Y)=>{switch(Y._tag){case"Fail":return`Fail(${Q(Y.error)})`;case"Die":return`Die(${X(Y.defect)})`;case"Interrupt":return"Interrupt"}}}function I3(Q,X){let Y=H8()([Q,X],([$,J])=>{let Z=e0(T3($,J));return(G,W,H)=>{if(!lJ(G))return p(new u0(W,R(G)));return K1(i0(Z)(G.reasons,H),{onSuccess:fQ,onFailure:(K)=>new N0(W,R(G),[new S0(["failures"],K)])})}},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:$})=>({runtime:`Schema.Cause(${$[0].runtime}, ${$[1].runtime})`,Type:`Cause.Cause<${$[0].Type}, ${$[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([$,J])=>v0()(e0(T3($,J)),h0({decode:fQ,encode:({reasons:Z})=>Z})),toArbitrary:([$,J])=>eP($,J),toEquivalence:([$,J])=>QA($,J),toFormatter:([$,J])=>XA($,J)});return E(Y.ast,{error:Q,defect:X})}var gi=l1("effect/schema/Cause",F0,({annotations:Q,typeParameters:X})=>{let Y=I3(X[0],X[1]);return Q===void 0?Y:Y.annotate(Q)});function eP(Q,X){return(Y,$)=>{let J=aP(Q,X)(Y,$),Z=Y.constant(rJ),G=Y.array(J.arbitrary).map(fQ);return t5(Y,$,Z,G)}}function QA(Q,X){let Y=QV(sP(Q,X));return($,J)=>Y($.reasons,J.reasons)}function XA(Q,X){let Y=tP(Q,X);return($)=>`Cause([${$.reasons.map(Y).join(", ")}])`}var hi=A8((Q)=>{if(!j1(Q))return!1;let X=globalThis.Object.keys(Q);return X.length>0&&X.every((Y)=>(Y==="includeStack"||Y==="excludeCause")&&Q[Y]===!0)}),mi=Q1([F0,hi]),YA=(Q)=>(Q?.includeStack===!0?1:0)|(Q?.excludeCause===!0?2:0),$A=(Q)=>{switch(Q){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},Ew=[];function JA(Q){let X=YA(Q),Y=Ew[X];if(Y!==void 0)return Y;let $=$A(X),J=y6(globalThis.Error,{representation:{id:"effect/schema/Error",payload:$??null},toCode:()=>({runtime:$!==void 0?`Schema.Error(${P($)})`:"Schema.Error()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>v0()(Sa,az($)),toArbitrary:()=>(Z)=>Z.string().map((G)=>new globalThis.Error(G))});return Ew[X]=J,J}var di=l1("effect/schema/Error",mi,({annotations:Q,payload:X})=>{let Y=JA(X??void 0);return Q===void 0?Y:Y.annotate(Q)}),Sw=[];function pi(Q){let X=YA(Q),Y=Sw[X];if(Y!==void 0)return Y;let $=p3.pipe(l(uH,sz($A(X))));return Sw[X]=$,$}function ZA(Q,X,Y){let $=H8()([Q,X,Y],([J,Z,G])=>{let W=I3(Z,G);return(H,K,V)=>{if(!nJ(H))return p(new u0(K,R(H)));switch(H._tag){case"Success":return K1(i0(J)(H.value,V),{onSuccess:V9,onFailure:(_)=>new N0(K,R(H),[new S0(["value"],_)])});case"Failure":return K1(i0(W)(H.cause,V),{onSuccess:v4,onFailure:(_)=>new N0(K,R(H),[new S0(["cause"],_)])})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:J})=>({runtime:`Schema.Exit(${J[0].runtime}, ${J[1].runtime}, ${J[2].runtime})`,Type:`Exit.Exit<${J[0].Type}, ${J[1].Type}, ${J[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([J,Z,G])=>v0()(Q1([m({_tag:p0("Success"),value:J}),m({_tag:p0("Failure"),cause:I3(Z,G)})]),h0({decode:(W)=>W._tag==="Success"?V9(W.value):v4(W.cause),encode:(W)=>Y1(W)?{_tag:"Success",value:W.value}:{_tag:"Failure",cause:W.cause}})),toArbitrary:([J,Z,G])=>(W,H)=>{let K=eP(Z,G)(W,H),V=GA(W,J.terminal?.map((q)=>V9(q)),K.terminal?.map((q)=>v4(q))),_=W.oneof(J.arbitrary.map((q)=>V9(q)),K.arbitrary.map((q)=>v4(q)));return t5(W,H,V,_)},toEquivalence:([J,Z,G])=>{let W=QA(Z,G);return(H,K)=>{if(H._tag!==K._tag)return!1;switch(H._tag){case"Success":return J(H.value,K.value);case"Failure":return W(H.cause,K.cause)}}},toFormatter:([J,Z,G])=>{let W=XA(Z,G);return(H)=>{switch(H._tag){case"Success":return`Exit.Success(${J(H.value)})`;case"Failure":return`Exit.Failure(${W(H.cause)})`}}}});return E($.ast,{value:Q,error:X,defect:Y})}var fi=l1("effect/schema/Exit",F0,({annotations:Q,typeParameters:X})=>{let Y=ZA(X[0],X[1],X[2]);return Q===void 0?Y:Y.annotate(Q)});function GA(Q,X,Y){return X===void 0?Y:Y===void 0?X:Q.oneof(X,Y)}function t5(Q,X,Y,$){return{arbitrary:Y===void 0||X.recursion===void 0?$:Q.oneof(X.recursion,Y,$),terminal:Y}}function vw(Q,X,Y,$){return $===void 0?Q.array(X,Y):Q.uniqueArray(X,{...Y,comparator:$})}function m3(Q,X,Y,$,J,Z){let G=X.constraint,W=G===void 0||G.minLength===void 0&&G.maxLength===void 0?void 0:{...G.minLength!==void 0?{minLength:G.minLength}:{},...G.maxLength!==void 0?{maxLength:G.maxLength}:{}};if(W?.minLength!==void 0&&W.maxLength!==void 0&&W.minLength>W.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let H=W?.minLength??0,K=H===0?Q.constant([]):$===void 0?void 0:vw(Q,$,{...W,maxLength:H},Z),V=t5(Q,X,K,vw(Q,Y,W,Z));return{arbitrary:V.arbitrary.map(J),terminal:V.terminal?.map(J)}}function WA(Q,X,Y,$,J){return m3(Q,X,Q.tuple(Y.arbitrary,$.arbitrary),Y.terminal===void 0||$.terminal===void 0?void 0:Q.tuple(Y.terminal,$.terminal),J,([Z],[G])=>o(Z,G))}function HA(Q,X){let Y=H8()([Q,X],([$,J])=>{let Z=e0(r5([$,J]));return(G,W,H)=>{if(G instanceof globalThis.Map)return K1(i0(Z)([...G],H),{onSuccess:(K)=>new globalThis.Map(K),onFailure:(K)=>new N0(W,R(G),[new S0(["entries"],K)])});return p(new u0(W,R(G)))}},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:$})=>({runtime:`Schema.ReadonlyMap(${$[0].runtime}, ${$[1].runtime})`,Type:`globalThis.ReadonlyMap<${$[0].Type}, ${$[1].Type}>`}),expected:"ReadonlyMap",toCodec:([$,J])=>v0()(e0(r5([$,J])),h0({decode:(Z)=>new globalThis.Map(Z),encode:(Z)=>[...Z.entries()]})),toArbitrary:([$,J])=>(Z,G)=>WA(Z,G,$,J,(W)=>new globalThis.Map(W)),toEquivalence:([$,J])=>w7($,J),toFormatter:([$,J])=>(Z)=>{let G=Z.size;if(G===0)return"ReadonlyMap(0) {}";let W=globalThis.Array.from(Z.entries()).sort().map(([H,K])=>`${$(H)} => ${J(K)}`);return`ReadonlyMap(${G}) { ${W.join(", ")} }`}});return E(Y.ast,{key:Q,value:X})}var ci=l1("effect/schema/ReadonlyMap",F0,({annotations:Q,typeParameters:X})=>{let Y=HA(X[0],X[1]);return Q===void 0?Y:Y.annotate(Q)});function KA(Q,X){let Y=H8()([Q,X],([$,J])=>{let Z=e0(r5([$,J]));return(G,W,H)=>{if(Qz(G))return K1(i0(Z)($2(G),H),{onSuccess:Y2,onFailure:(K)=>new N0(W,R(G),[new S0(["entries"],K)])});return p(new u0(W,R(G)))}},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:$})=>({runtime:`Schema.HashMap(${$[0].runtime}, ${$[1].runtime})`,Type:`HashMap.HashMap<${$[0].Type}, ${$[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([$,J])=>v0()(e0(r5([$,J])),h0({decode:Y2,encode:$2})),toArbitrary:([$,J])=>(Z,G)=>WA(Z,G,$,J,Y2),toEquivalence:([$,J])=>w7($,J),toFormatter:([$,J])=>(Z)=>{let G=Xz(Z);if(G===0)return"HashMap(0) {}";let W=$2(Z).sort().map(([H,K])=>`${$(H)} => ${J(K)}`);return`HashMap(${G}) { ${W.join(", ")} }`}});return E(Y.ast,{key:Q,value:X})}var ui=l1("effect/schema/HashMap",F0,({annotations:Q,typeParameters:X})=>{let Y=KA(X[0],X[1]);return Q===void 0?Y:Y.annotate(Q)});function VA(Q){let X=H8()([Q],([Y])=>{let $=e0(Y);return(J,Z,G)=>{if(J instanceof globalThis.Set)return K1(i0($)([...J],G),{onSuccess:(W)=>new globalThis.Set(W),onFailure:(W)=>new N0(Z,R(J),[new S0(["values"],W)])});return p(new u0(Z,R(J)))}},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:Y})=>({runtime:`Schema.ReadonlySet(${Y[0].runtime})`,Type:`globalThis.ReadonlySet<${Y[0].Type}>`}),expected:"ReadonlySet",toCodec:([Y])=>v0()(e0(Y),h0({decode:($)=>new globalThis.Set($),encode:($)=>[...$.values()]})),toArbitrary:([Y])=>($,J)=>m3($,J,Y.arbitrary,Y.terminal,(Z)=>new globalThis.Set(Z),o),toEquivalence:([Y])=>P7(Y),toFormatter:([Y])=>($)=>{let J=$.size;if(J===0)return"ReadonlySet(0) {}";let Z=globalThis.Array.from($.values()).sort().map((G)=>`${Y(G)}`);return`ReadonlySet(${J}) { ${Z.join(", ")} }`}});return E(X.ast,{value:Q})}var li=l1("effect/schema/ReadonlySet",F0,({annotations:Q,typeParameters:X})=>{let Y=VA(X[0]);return Q===void 0?Y:Y.annotate(Q)});function _A(Q){let X=H8()([Q],([Y])=>{let $=e0(Y);return(J,Z,G)=>{if(Zz(J))return K1(i0($)(M1(J),G),{onSuccess:Z2,onFailure:(W)=>new N0(Z,R(J),[new S0(["values"],W)])});return p(new u0(Z,R(J)))}},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:Y})=>({runtime:`Schema.HashSet(${Y[0].runtime})`,Type:`HashSet.HashSet<${Y[0].Type}>`}),expected:"HashSet",toCodec:([Y])=>v0()(e0(Y),h0({decode:Z2,encode:M1})),toArbitrary:([Y])=>($,J)=>m3($,J,Y.arbitrary,Y.terminal,Z2,o),toEquivalence:([Y])=>P7(Y),toFormatter:([Y])=>($)=>{let J=Gz($);if(J===0)return"HashSet(0) {}";let Z=globalThis.Array.from($).sort().map((G)=>`${Y(G)}`);return`HashSet(${J}) { ${Z.join(", ")} }`}});return E(X.ast,{value:Q})}var oi=l1("effect/schema/HashSet",F0,({annotations:Q,typeParameters:X})=>{let Y=_A(X[0]);return Q===void 0?Y:Y.annotate(Q)});function qA(Q){let X=H8()([Q],([Y])=>{let $=e0(Y);return(J,Z,G)=>{if(uY(J))return K1(i0($)(M1(J),G),{onSuccess:lY,onFailure:(W)=>new N0(Z,R(J),[new S0(["values"],W)])});return p(new u0(Z,R(J)))}},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:Y})=>({runtime:`Schema.Chunk(${Y[0].runtime})`,Type:`Chunk.Chunk<${Y[0].Type}>`}),expected:"Chunk",toCodec:([Y])=>v0()(e0(Y),h0({decode:lY,encode:M1})),toArbitrary:([Y])=>($,J)=>m3($,J,Y.arbitrary,Y.terminal,lY),toEquivalence:([Y])=>pZ(Y),toFormatter:([Y])=>($)=>{let J=LB($);if(J===0)return"Chunk(0) {}";let Z=globalThis.Array.from($).sort().map((G)=>`${Y(G)}`);return`Chunk(${J}) { ${Z.join(", ")} }`}});return E(X.ast,{value:Q})}var ri=l1("effect/schema/Chunk",F0,({annotations:Q,typeParameters:X})=>{let Y=qA(X[0]);return Q===void 0?Y:Y.annotate(Q)}),DA=y6(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>v0()(m({source:n,flags:n}),N8({decode:(Q)=>O5({try:()=>new globalThis.RegExp(Q.source,Q.flags),catch:(X)=>new q0(R(X),{message:globalThis.String(X)})}),encode:(Q)=>f({source:Q.source,flags:Q.flags})})),toArbitrary:()=>(Q)=>Q.tuple(Q.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),Q.uniqueArray(Q.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((X)=>X.join(""))).map(([X,Y])=>new globalThis.RegExp(X,Y)),toEquivalence:()=>(Q,X)=>Q.source===X.source&&Q.flags===X.flags}),ii=A1("effect/schema/RegExp",DA),UA=n.annotate({expected:"a string that will be decoded as a URL"}),GK=y6(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>v0()(UA,LG),toArbitrary:()=>(Q)=>Q.webUrl().map((X)=>new globalThis.URL(X)),toEquivalence:()=>(Q,X)=>Q.toString()===X.toString()}),ni=A1("effect/schema/URL",GK),ai=UA.pipe(l(GK,LG));function WK(Q,X,Y){let $={...X};if(Q?.minimum!==void 0){let J=Y===void 0?Q.minimum:Y(Q.minimum),Z=Q.exclusiveMinimum?new globalThis.Date(J.getTime()+1):J;if($.min===void 0||Z.getTime()>$.min.getTime())$.min=Z}if(Q?.maximum!==void 0){let J=Y===void 0?Q.maximum:Y(Q.maximum),Z=Q.exclusiveMaximum?new globalThis.Date(J.getTime()-1):J;if($.max===void 0||Z.getTime()<$.max.getTime())$.max=Z}return $}var BA=n.annotate({expected:"a string that will be decoded as a Date"}),r8=A8((Q)=>Q instanceof globalThis.Date&&!globalThis.Number.isNaN(Q.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>v0()(BA,NG),toArbitrary:()=>(Q,X)=>Q.date(WK(X?.constraint?.ordered?.order===t6?X.constraint.ordered:void 0,{noInvalidDate:!0}))}),si=A1("effect/schema/Date",r8),ti=BA.pipe(l(r8,NG)),ei=k9.pipe(l(r8,cz)),_7=A8(I$,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>v0()(Q1([m({_tag:p0("Infinity")}),m({_tag:p0("NegativeInfinity")}),m({_tag:p0("Nanos"),value:U4}),m({_tag:p0("Millis"),value:k9})]),h0({decode:(Q)=>{switch(Q._tag){case"Infinity":return P4;case"NegativeInfinity":return Y9;case"Nanos":return Y4(Q.value);case"Millis":return G6(Q.value)}},encode:(Q)=>{switch(Q.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:Q.value.nanos};case"Millis":return{_tag:"Millis",value:Q.value.millis}}}})),toArbitrary:()=>(Q)=>Q.oneof(Q.constant(P4),Q.constant(Y9),Q.bigInt().map(Y4),Q.maxSafeInteger().map(G6)),toFormatter:()=>globalThis.String,toEquivalence:()=>E$}),Qn=A1("effect/schema/Duration",_7),Xn=n.annotate({expected:"a string that will be decoded as a Duration"}),Yn=Xn.pipe(l(_7,uz)),$n=U4.pipe(l(_7,lz)),Jn=b3.pipe(l(_7,oz)),zA=n.annotate({expected:"a string that will be decoded as a BigDecimal"}),OA=20,FA="Unable to derive an arbitrary for the ordered BigDecimal constraints";function E3(Q,X){return B6(Q,X).value}function Zn(Q,X,Y){return Y?E3(mZ(Q,X),X)+globalThis.BigInt(1):E3(hZ(Q,X),X)}function Gn(Q,X,Y){return Y?E3(hZ(Q,X),X)-globalThis.BigInt(1):E3(mZ(Q,X),X)}function Wn(Q){return Math.max(OA,Q.minimum?.scale??0,Q.maximum?.scale??0,Q.exclusiveMinimum&&Q.minimum!==void 0?Q.minimum.scale+1:0,Q.exclusiveMaximum&&Q.maximum!==void 0?Q.maximum.scale+1:0)}function fH(Q,X){let Y={};if(Q.minimum!==void 0)Y.min=Zn(Q.minimum,X,Q.exclusiveMinimum===!0);if(Q.maximum!==void 0)Y.max=Gn(Q.maximum,X,Q.exclusiveMaximum===!0);if(Y.min!==void 0&&Y.max!==void 0&&Y.min>Y.max)return;return Y}function Hn(Q){let X=Wn(Q);if(fH(Q,X)===void 0)throw new globalThis.Error(FA);let Y=0,$=X;while(Y<$){let J=Y+Math.floor(($-Y)/2);if(fH(Q,J)===void 0)Y=J+1;else $=J}return{min:Y,max:X}}var HK=A8(cY,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>v0()(zA,MG),toArbitrary:()=>(Q,X)=>{let Y=X.constraint?.ordered?.order===b4?X.constraint.ordered:void 0;if(Y===void 0)return Q.tuple(Q.bigInt(),Q.integer({min:0,max:OA})).map(([$,J])=>p1($,J));return Q.integer(Hn(Y)).chain(($)=>{let J=fH(Y,$);if(J===void 0)throw new globalThis.Error(FA);return Q.bigInt(J).map((Z)=>p1(Z,$))})},toFormatter:()=>(Q)=>W4(Q),toEquivalence:()=>yZ}),Kn=A1("effect/schema/BigDecimal",HK),Vn=zA.pipe(l(HK,MG)),_n=n.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"}),qn=RA(uH);function RA(Q){return _n.pipe(l(Q,WO))}var KK=y6(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>v0()(m({data:n.check(eH()),type:n,name:n,lastModified:k9}),N8({decode:(Q)=>B8(N5(Q.data),{onFailure:(X)=>p(new q0(R(Q.data),{message:X.message})),onSuccess:(X)=>{let Y=new globalThis.Uint8Array(X);return f(new globalThis.File([Y],Q.name,{type:Q.type,lastModified:Q.lastModified}))}}),encode:(Q)=>jZ({try:async()=>{let X=new globalThis.Uint8Array(await Q.arrayBuffer());return{data:sY(X),type:Q.type,name:Q.name,lastModified:Q.lastModified}},catch:(X)=>new q0(R(Q),{message:globalThis.String(X)})})}))}),Dn=A1("effect/schema/File",KK),VK=y6(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>v0()(e0(r5([n,Q1([m({_tag:x9("String"),value:n}),m({_tag:x9("File"),value:KK})])])),N8({decode:(Q)=>{let X=new globalThis.FormData;for(let[Y,$]of Q)X.append(Y,$.value);return f(X)},encode:(Q)=>{return f(globalThis.Array.from(Q.entries()).map(([X,Y])=>{if(typeof Y==="string")return[X,{_tag:"String",value:Y}];else return[X,{_tag:"File",value:Y}]}))}}))}),Un=A1("effect/schema/FormData",VK);function Bn(Q){return VK.pipe(l(Q,HO))}var _K=y6(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>v0()(n.annotate({expected:"a query string that will be decoded as URLSearchParams"}),h0({decode:(Q)=>new globalThis.URLSearchParams(Q),encode:(Q)=>Q.toString()}))}),zn=A1("effect/schema/URLSearchParams",_K);function On(Q){return _K.pipe(l(Q,KO))}var Fn=n.annotate({expected:"a string that will be decoded as a number"}).pipe(l(b3,C5)),Rn=n.annotate({expected:"a string that will be decoded as a finite number"}).pipe(l(o8,C5)),Nn=E(nG).pipe(l(U4,R2)),NA=n.check(tH()),Ln=n.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(l(NA,fz())),Mn=n.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(l(n,$O)),wn=n.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(l(n,JO)),Pn=n.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(l(n,ZO)),An=n.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(l(n,GO)),cH=Q1([o8,sw,n]),Cn=m({issues:e0(m({message:n,path:P8(e0(Q1([cH,m({key:cH})])))}))}),jn=k3([0,1]).pipe(l(aw,h0({decode:(Q)=>Q===1,encode:(Q)=>Q?1:0}))),LA=n.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),q7=y6(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>v0()(LA,wG),toArbitrary:()=>(Q)=>Q.uint8Array()}),Tn=A1("effect/schema/Uint8Array",q7),In=LA.pipe(l(q7,wG)),En=n.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(l(q7,{decode:Ez(),encode:B2()})),Sn=n.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(l(q7,{decode:vz(),encode:z2()})),D7=A8((Q)=>cZ(Q)&&AB(Q),{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:()=>v0()(n,CG),toArbitrary:()=>(Q,X)=>Q.date(WK(X?.constraint?.ordered?.order===lZ?X.constraint.ordered:void 0,{noInvalidDate:!0},iY)).map((Y)=>jB(Y)),toFormatter:()=>(Q)=>Q.toString(),toEquivalence:()=>uZ}),vn=A1("effect/schema/DateTimeUtc",D7),xn=r8.pipe(l(D7,{decode:FG(),encode:Y0(iY)})),bn=n.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(l(D7,CG)),kn=k9.pipe(l(D7,{decode:FG(),encode:Y0(vB)})),MA=A8(wB,{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:()=>v0()(k9,VO),toArbitrary:()=>(Q)=>Q.integer({min:-43200000,max:50400000}).map((X)=>KX(X)),toFormatter:()=>(Q)=>z6(Q),toEquivalence:()=>(Q,X)=>Q.offset===X.offset}),yn=A1("effect/schema/TimeZoneOffset",MA),wA=n.annotate({expected:"an IANA time zone identifier"}),qK=A8(PB,{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:()=>v0()(wA,PG),toArbitrary:()=>(Q)=>Q.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(oZ)),toFormatter:()=>(Q)=>z6(Q),toEquivalence:()=>(Q,X)=>Q.id===X.id}),gn=A1("effect/schema/TimeZoneNamed",qK),hn=wA.pipe(l(qK,PG)),PA=n.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),DK=A8(MB,{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:()=>v0()(PA,AG),toArbitrary:()=>(Q)=>Q.oneof(Q.integer({min:-43200000,max:50400000}).map((X)=>KX(X)),Q.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(oZ))),toFormatter:()=>(Q)=>z6(Q),toEquivalence:()=>(Q,X)=>z6(Q)===z6(X)}),mn=A1("effect/schema/TimeZone",DK),dn=PA.pipe(l(DK,AG)),AA=n.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),UK=A8((Q)=>cZ(Q)&&CB(Q),{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:()=>v0()(AA,jG),toArbitrary:()=>(Q,X)=>Q.tuple(Q.date(WK(X?.constraint?.ordered?.order===lZ?X.constraint.ordered:void 0,{max:new globalThis.Date(8639999949600000),min:new globalThis.Date(-8639999949600000),noInvalidDate:!0},iY)),Q.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([Y,$])=>TB(Y,{timeZone:$})),toFormatter:()=>(Q)=>nY(Q),toEquivalence:()=>uZ}),pn=A1("effect/schema/DateTimeZoned",UK),fn=AA.pipe(l(UK,jG)),cn=globalThis.Symbol.for("immer-draftable"),xw={};function BK(Q,X,Y,$,J){let Z=ln(Y,X,$),G=CA(X),W=class extends Q{constructor(...[H,K]){let _=K?.["~payload"],q=_?.token===xw?_.value:Y.make(H??{},K);super(q,{...K,disableChecks:!0,"~payload":{token:xw,value:q}})}static[$7]=$7;get[G](){return G}static[cn]=!0;static identifier=X;static fields=Y.fields;static get ast(){return Z(this).ast}static pipe(){return H0(this,arguments)}static rebuild(H){return Z(this).rebuild(H)}static make(H,K){return new this(H,K)}static makeOption(H,K){return p2(Z(this))(H??{},K)}static makeEffect(H,K){return Z(this).makeEffect(H??{},K)}static annotate(H){return this.rebuild(V4(this.ast,H))}static annotateKey(H){return this.rebuild(bX(this.ast,H))}static check(...H){return this.rebuild(h8(this.ast,H))}static extend(H){return(K,V)=>{let _=U7(K)?K:m(K),q={...Y.fields,..._.fields},D=j2(q,Y.ast.checks,{identifier:H});return BK(this,H,oH(h8(D,_.ast.checks),q),V,J)}}static mapFields(H,K){return Y.mapFields(H,K)}};if(J!==void 0)Object.assign(W.prototype,J(X));return W}function un(Q){return new z0(Y0((X)=>new Q(X)),b8())}function CA(Q){return`~effect/Schema/Class/${Q}`}function ln(Q,X,Y){let $;return(J)=>{if($!==void 0)return $;let Z=un(J),G=E(new P9([Q.ast],()=>(W,H)=>{return W instanceof J||C(W,CA(X))?f(W):p(new u0(H,R(W)))},{identifier:X,[h2]:([W])=>new m0(W,Z),toCodec:([W])=>new m0(W.ast,Z),toArbitrary:([W])=>()=>({arbitrary:W.arbitrary.map((H)=>new J(H)),terminal:W.terminal?.map((H)=>new J(H))}),toFormatter:([W])=>(H)=>`${J.identifier}(${W(H)})`,[OX]:IX(Q.ast),...Y}));return $=l(G,Z)(Q)}}function U7(Q){return x3(Q)}var jA=(Q)=>(X,Y)=>{let $=U7(X)?X:m(X);return BK(WU,Q,$,Y,(J)=>({toString(){return`${J}(${P({...this})})`}}))},on=(Q)=>{return(X,Y,$)=>{let J=U7(Y)?Y.mapFields((Z)=>({_tag:x9(X),...Z}),{unsafePreserveChecks:!0}):g3(X,Y);return jA(Q??X)(J,$)}},TA=(Q)=>(X,Y)=>{let $=U7(X)?X:m(X);return BK(S7,Q,$,Y,(Z)=>({name:Z}))},rn=(Q)=>{return(X,Y,$)=>{let J=U7(Y)?Y.mapFields((Z)=>({_tag:x9(X),...Z}),{unsafePreserveChecks:!0}):g3(X,Y);return TA(Q??X)(J,$)}};function IA(Q){let X=VW(Q.ast);return(Y)=>X(Y,{})}function nn(Q,X){if(X?.report===!0){let Y=VW(Q.ast),$=pF();return oF(Q.ast,$),{value:Y(j3,{}),report:fF($)}}return IA(Q)(j3)}function an(Q){return(X)=>{return X.annotate({toFormatter:Q})}}function sn(Q,X){return Y(Q.ast);function Y(J){let Z=h4(J)?.toFormatter;if(typeof Z==="function")return Z(M9(J)?J.typeParameters.map(Y):[]);if(X?.onBefore){let G=X.onBefore(J,Y);if(G!==void 0)return G}return $(J)}function $(J){switch(J._tag){default:return P;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let Z=J.elements.map(Y),G=J.rest.map(Y);return(W)=>{let H=[],K=0;for(;K<Z.length;K++)if(W.length<K+1){if(f0(J.elements[K]))continue}else H.push(Z[K](W[K]));if(G.length>0){let[V,..._]=G;for(;K<W.length-_.length;K++)H.push(V(W[K]));for(let q=0;q<_.length;q++)H.push(_[q](W[K+q]))}return"["+H.join(", ")+"]"}}case"Objects":{let Z=J.propertySignatures.map((W)=>Y(W.type)),G=J.indexSignatures.map((W)=>Y(W.type));if(J.propertySignatures.length===0&&J.indexSignatures.length===0)return P;return(W)=>{let H=[],K=new Set;for(let V=0;V<Z.length;V++){let _=J.propertySignatures[V],q=_.name;if(K.add(q),f0(_.type)&&!Object.hasOwn(W,q))continue;H.push(`${O4(q)}: ${Z[V](W[q])}`)}for(let V=0;V<G.length;V++){let _=I5(W,J.indexSignatures[V].parameter);for(let q of _){if(K.has(q))continue;K.add(q),H.push(`${O4(q)}: ${G[V](W[q])}`)}}return H.length>0?"{ "+H.join(", ")+" }":"{}"}}case"Union":{let Z=z1(J).types,G=(H)=>EX(H,Z),W=new Map(Z.map((H,K)=>[H,[hX(H),Y(J.types[K])]]));return(H)=>{let K=G(H);for(let V=0;V<K.length;V++){let[_,q]=W.get(K[V]);if(_(H))return q(H)}return P(H)}}case"Suspend":{let Z=A9(()=>Y(J.thunk()));return(G)=>Z()(G)}}}}function tn(Q){return(X)=>X.annotate({toEquivalence:Q})}function en(Q){return rF(Q.ast)}function Qa(Q){return _W(Q.ast)}function EA(Q,X){let Y=_W(d3(Q.ast));return tF(Y,X)}function SA(Q){return E(d3(Q.ast),{schema:Q})}var Xa=P6((Q)=>{let X=$a(Q,d3),Y=Q.context;if(X===Q||Y===void 0)return X;return x2(X,zK(Y))}),d3=s0((Q)=>{let X=R6(Q),Y=Xa(Q);if(X===void 0||Y.encoding===void 0)return Y;let $=M6(Y);if(R6($)!==void 0||G2($)===X)return Y;let J=V4($,{[zX]:X});return P6(()=>J)(Y)});function zK(Q){return Q.defaultValue===void 0?Q:new y8(Q.isOptional,Q.isMutable,void 0,Q.annotations)}function vA(Q){if(Q.propertySignatures.some((X)=>typeof X.name!=="string"))throw new globalThis.Error("Objects property names must be strings",{cause:Q})}function xA(Q){return(X)=>{let Y=new Map;for(let Z=0;Z<X.length;Z++)Y.set(O1(X[Z]),Z);let $=[...X].sort((Z,G)=>{Z=O1(Z),G=O1(G);let W=Q(Z),H=Q(G);if(W!==H)return W-H;return Y.get(Z)-Y.get(G)});if(!$.some((Z,G)=>Z!==X[G]))return X;return $}}var Ya=xA((Q)=>{switch(Q._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function $a(Q,X){switch(Q._tag){case"Declaration":{let Y=Q.annotations?.toCodecJson??Q.annotations?.toCodec;if(!r1(Y))return L0(Q,[sG]);let $=Q.typeParameters.map((Z)=>mX(O1(Z))),J=Y($);return J===void 0?Q:L0(Q,[w6(J,X)])}case"Unknown":return L0(Q,[sG]);case"ObjectKeyword":return L0(Q,[HF]);case"Undefined":case"Void":case"Literal":case"Number":return Q.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return Q.toCodecStringTree();case"Objects":return vA(Q),Q.recur(X,g2);case"Union":{let Y=Ya(Q.types);if(Y!==Q.types)return new u1(Y,Q.mode,Q.annotations,Q.checks,Q.encoding,Q.context,Q.encodingChecks).recur(X);return Q.recur(X)}case"Arrays":case"Suspend":return Q.recur(X)}return Q}function bA(Q){return E(kA(z1(Q.ast)))}var kA=s0((Q)=>{let X=Ja(Q,kA);return X!==Q&&Q.context!==void 0?x2(X,zK(Q.context)):X});function Ja(Q,X){switch(Q._tag){case"Declaration":{let Y=Q.annotations?.toCodecIso??Q.annotations?.toCodec;if(r1(Y)){let $=Y(Q.typeParameters.map((J)=>mX(J)));return L0(Q,[w6($,X)])}return Q}case"Arrays":case"Objects":case"Union":case"Suspend":return Q.recur(X)}return Q}function yA(Q){return E(mA(Q.ast),{schema:Q})}function Za(Q){return E(dA(Q.ast))}function Ga(Q,X){let Y=R6(Q.ast)??GG(Q.ast),$=uw(yA(Q));return(J)=>$(J).pipe(EZ((Z)=>Wa(Z,{rootName:Y,...X})))}function Wa(Q,X){let Y=X.rootName??"root",$=X.arrayItemName??"item",J=X.pretty??!0,Z=X.indent??" ",G=X.sortKeys??!0,W=new Set,H=[];return V(Y,Q,0),H.join(J?`
|
|
66
|
-
`:"");function K(_,q){H.push(J?Z.repeat(_)+q:q)}function V(_,q,D,B){let{attrs:F,safe:N}=o5.tagInfo(_,B);if(q===void 0)K(D,`<${N}${F}/>`);else if(typeof q==="string")K(D,`<${N}${F}>${o5.escapeText(q)}</${N}>`);else if(typeof q!=="object"||q===null)K(D,`<${N}${F}>${o5.escapeText(P(q))}</${N}>`);else{if(W.has(q))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:q});W.add(q);try{if(globalThis.globalThis.Array.isArray(q)){if(q.length===0){K(D,`<${N}${F}/>`);return}K(D,`<${N}${F}>`);for(let A of q)V($,A,D+1);K(D,`</${N}>`);return}let M=q,w=Object.keys(M);if(G)w.sort();if(w.length===0){K(D,`<${N}${F}/>`);return}K(D,`<${N}${F}>`);for(let A of w)V(o5.parseTagName(A).safe,M[A],D+1,A);K(D,`</${N}>`)}finally{W.delete(q)}}}}var o5={escapeText(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(Q){return Q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(Q){let X=Q,Y=Q;if(!/^[A-Za-z_]/.test(Y))Y="_"+Y;if(Y=Y.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(Y))Y="_"+Y;return{safe:Y,changed:Y!==X}},tagInfo(Q,X){let{changed:Y,safe:$}=o5.parseTagName(Q),Z=Y||X&&X!==Q?` data-name="${o5.escapeAttribute(X??Q)}"`:"";return{safe:$,attrs:Z}}},Ha=xA((Q)=>{switch(Q._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function Ka(Q,X,Y){switch(Q._tag){case"Declaration":{let $=Q.typeParameters.map((K)=>E(X(O1(K)))),J=Q.annotations?.toCodecStringTree;if(r1(J)){let K=J($);if(K===void 0)return Q;return L0(Q,[w6(K,X)])}let Z=Q.annotations?.toCodecJson,G=r1(Z)?Z($):void 0,W=G===void 0?Q.annotations?.toCodec:void 0,H=G??(r1(W)?W($):void 0);return H===void 0?Y(Q):L0(Q,[w6(H,X)])}case"Null":return L0(Q,[Va]);case"Boolean":return L0(Q,[_a]);case"Unknown":case"ObjectKeyword":return L0(Q,[tG]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return Q.toCodecStringTree();case"Objects":return vA(Q),Q.recur(X,g2);case"Union":{let $=Ha(Q.types);if($!==Q.types)return new u1($,Q.mode,Q.annotations,Q.checks,Q.encoding,Q.context,Q.encodingChecks).recur(X);return Q.recur(X)}case"Arrays":case"Suspend":return Q.recur(X)}return Q}var Va=new m0(new $8("null"),new z0(Y0(()=>null),Y0(()=>"null"))),_a=new m0(new u1([new $8("true"),new $8("false")],"anyOf"),new z0(Y0((Q)=>Q==="true"),R9())),gA="~effect/Schema/SERIALIZER_ENSURE_ARRAY",hA=(Q)=>jX(Q)&&Q.annotations?.[gA]===!0,mA=P6((Q)=>{if(hA(Q))return Q;let X=Ka(Q,mA,(Y)=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:Y})});if(X!==Q&&Q.context!==void 0)return x2(X,zK(Q.context));return X}),bw=(Q)=>f0(Q)?kX(N9):N9,qa=new z0(Y0((Q)=>typeof Q==="string"?[Q]:Q),b8()),dA=P6((Q)=>{if(hA(Q))return Q;let X=Da(Q);if(CX(X)){let Y=b2(new u1([new g8(X.isMutable,X.elements.map(bw),X.rest.map(bw)),L6],"anyOf",{[gA]:!0}),X,qa);return f0(Q)?kX(Y):Y}return X});function Da(Q){return Q._tag==="Declaration"||Q._tag==="Arrays"||Q._tag==="Objects"||Q._tag==="Union"||Q._tag==="Suspend"?Q.recur(dA):Q}var Ua=a("effect/schema/isGreaterThanDate",m({exclusiveMinimum:r8}),({annotations:Q,payload:X})=>EP(X.exclusiveMinimum,Q)),Ba=a("effect/schema/isGreaterThanOrEqualToDate",m({minimum:r8}),({annotations:Q,payload:X})=>SP(X.minimum,Q)),za=a("effect/schema/isLessThanDate",m({exclusiveMaximum:r8}),({annotations:Q,payload:X})=>vP(X.exclusiveMaximum,Q)),Oa=a("effect/schema/isLessThanOrEqualToDate",m({maximum:r8}),({annotations:Q,payload:X})=>xP(X.maximum,Q)),Fa=a("effect/schema/isBetweenDate",m({minimum:r8,maximum:r8,exclusiveMinimum:P8(p0(!0)),exclusiveMaximum:P8(p0(!0))}),({annotations:Q,payload:X})=>bP(X,Q)),Ra=a("effect/schema/isGreaterThanBigInt",m({exclusiveMinimum:U4}),({annotations:Q,payload:X})=>kP(X.exclusiveMinimum,Q)),Na=a("effect/schema/isGreaterThanOrEqualToBigInt",m({minimum:U4}),({annotations:Q,payload:X})=>yP(X.minimum,Q)),La=a("effect/schema/isLessThanBigInt",m({exclusiveMaximum:U4}),({annotations:Q,payload:X})=>gP(X.exclusiveMaximum,Q)),Ma=a("effect/schema/isLessThanOrEqualToBigInt",m({maximum:U4}),({annotations:Q,payload:X})=>hP(X.maximum,Q)),wa=a("effect/schema/isBetweenBigInt",m({minimum:U4,maximum:U4,exclusiveMinimum:P8(p0(!0)),exclusiveMaximum:P8(p0(!0))}),({annotations:Q,payload:X})=>mP(X,Q));function Pa(Q){let X=bA(Q);return KR(JW(X),YW(X))}function Aa(Q){return X3()}function Ca(Q){return X3()}function ja(Q,X){return(Y)=>{return E(V4(Y.ast,{toCodecIso:()=>new m0(Q.ast,O2(X))}),{schema:Y})}}function Ta(Q){let X=SA(Q),Y=JW(X),$=YW(X);return{empty:[],diff:(J,Z)=>n2(Y(J),Y(Z)),combine:(J,Z)=>[...J,...Z],patch:(J,Z)=>{let G=Y(J),W=JR(Z,G);return Object.is(W,G)?J:$(W)}}}function Ia(Q){let X=YP(()=>Y),Y=Q1([Q,e0(X),tw(n,X)]);return Y}var p3=E(V4(T5,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),Ea=A1("effect/schema/Json",p3),Sa=m({message:n,name:k6(n),stack:k6(n),cause:k6(p3)}),pA=E(V4(WF,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),va=A1("effect/schema/MutableJson",pA);function xa(Q){return h4(Q.ast)}function ba(Q){return Q.ast.context?.annotations}var i4=z(tA(),1),la=["dist","build","_build","out","target",".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless","coverage",".nyc_output",".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox","__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target","tmp",".tmp",".state",".terraform",".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"],YC=["/tmp","/var/tmp","/var/folders","/private/tmp","/private/var/tmp","/private/var/folders"],$C=new Set([">",">>","<","<<","<<<","<>",">&","<&","&>","&>>"]),JC=new Set([";","&&","||","|","|&","&"]),ZC=(Q)=>typeof Q==="string",r4=(Q)=>{if(typeof Q==="object"&&"op"in Q&&typeof Q.op==="string")return Q.op;return null},oa=(Q)=>typeof Q==="object"&&("comment"in Q),ra=(Q)=>{try{let X=[...new Bun.Glob(Q).scanSync({onlyFiles:!1,dot:!0})];if(X.length>0)return X}catch{}return[Q]},ia=(Q)=>{if(ZC(Q))return[Q];if(typeof Q==="object"&&"op"in Q&&Q.op==="glob"&&"pattern"in Q)return ra(String(Q.pattern));let X=r4(Q);if(X!==null){if($C.has(X)||JC.has(X))return[];return[`__op_${X}__`]}if(oa(Q))return[];return["__tripwire_cmd_sub__"]},eA=(Q,X)=>{let Y=[],$=[],J=[],Z=[],G=0;while(G<Q.length){let V=Q[G],_=r4(V);if(_!==null&&$C.has(_)){let q=Y.at(-1);if(q!==void 0&&/^[0-9]+$/.test(q)&&X.remaining>0)Y.pop(),X.remaining--;let D=Q[G+1];if(D!==void 0&&ZC(D)){Z.push({op:_,target:D}),G+=2;continue}G++;continue}for(let q of ia(V))Y.push(q);G++}if(Y.length===0)return null;for(let V=1;V<Y.length;V++){let _=Y[V];if(_.startsWith("-")&&_!=="-")J.push(_);else $.push(_)}let W=Y[0],H=W.lastIndexOf("/");return{head:H===-1?W:W.slice(H+1),tokens:Y,args:$,flags:J,redirects:Z,raw:Y.join(" ")}},na=(Q)=>`$${Q}`,aa=(Q)=>{let X=[];for(let Y=0;Y<Q.length;Y++){let $=Q[Y],J=Q[Y+1];if(r4($)==="&"&&J!==void 0&&(r4(J)===">"||r4(J)===">>")){let Z={op:r4(J)===">"?"&>":"&>>"};X.push(Z),Y++;continue}if(r4($)===">"&&J!==void 0&&r4(J)==="|"){X.push({op:">"}),Y++;continue}X.push($)}return X},sa=(Q)=>{return Q.match(/(?<![\w$])\d+(?=[<>])/g)?.length??0},RK=(Q)=>{let X=/<<-?\s*(?:"(?<quoted>[^"]+)"|'(?<single>[^']+)'|(?<unquoted>[A-Za-z_][A-Za-z0-9_]*))/u.exec(Q);return X?.groups?.quoted??X?.groups?.single??X?.groups?.unquoted??null},ta=/(?:^|[|;&]\s*)(?:\/(?:usr\/bin|bin|usr\/local\/bin|opt\/homebrew\/bin)\/)?(?:sh|bash|zsh|dash|ksh|ash)(?:\s|$)/u,NK=(Q)=>ta.test(Q),GC=(Q)=>{let X=Q.split(`
|
|
67
|
-
`),Y=[];for(let $=0;$<X.length;$++){let J=X[$];Y.push(J);let Z=RK(J);if(Z===null||NK(J))continue;$++;while($<X.length&&X[$].trim()!==Z)$++;if($<X.length)Y.push("__HEREDOC_BODY__"),Y.push(X[$])}return Y.join(`
|
|
68
|
-
`)},WC=(Q)=>{let X=new Map,Y=Q.split(`
|
|
69
|
-
`);for(let $=0;$<Y.length;$++){let J=Y[$],Z=RK(J);if(Z===null||NK(J))continue;let G=[];$++;while($<Y.length&&Y[$].trim()!==Z)G.push(Y[$]),$++;if(!X.has(Z))X.set(Z,G.join(`
|
|
70
|
-
`))}return X},ea=(Q)=>{let X=Q.split(`
|
|
71
|
-
`),Y=[];for(let $=0;$<X.length;$++){let J=X[$],Z=RK(J);if(Z===null||!NK(J))continue;let G=[];$++;while($<X.length&&X[$].trim()!==Z)G.push(X[$]),$++;if(G.length>0)Y.push(G.join(`
|
|
72
|
-
`))}return Y},Qs=(Q,X)=>{for(let Y=X;Y<Q.length;Y++){let $=Q[Y];if($==="\\"){Y++;continue}if($==="`")return Y}return null},Xs=(Q,X)=>{let Y=1,$=null;for(let J=X;J<Q.length;J++){let Z=Q[J];if(Z==="\\"){J++;continue}if($==="single"){if(Z==="'")$=null;continue}if(Z==="'"){$??="single";continue}if(Z==='"'){$=$==="double"?null:"double";continue}if(Z==="("){Y++;continue}if(Z===")"){if(Y--,Y===0)return J}}return null},Ys=(Q)=>{let X=[],Y=null;for(let $=0;$<Q.length;$++){let J=Q[$];if(J==="\\"){$++;continue}if(Y==="single"){if(J==="'")Y=null;continue}if(J==="'"){Y??="single";continue}if(J==='"'){Y=Y==="double"?null:"double";continue}if(J==="`"){let K=Qs(Q,$+1);if(K!==null)X.push(Q.slice($+1,K)),$=K;continue}let Z=Q[$+1];if(!(J==="$"&&Z==="(")&&!(Y===null&&(J==="<"||J===">")&&Z==="("))continue;let H=Xs(Q,$+2);if(H!==null)X.push(Q.slice($+2,H)),$=H}return X},HC=/^\$\{?HOME\}?(?:\/|$)/,KC=(Q)=>{if(Q===""||Q==="-")return!1;if(Q==="/"||Q==="~"||Q==="."||Q==="..")return!0;if(Q.startsWith("/")||Q.startsWith("~")||Q.startsWith("./")||Q.startsWith("../")||HC.test(Q))return!0;return!1},c3=(Q)=>{if(Q==="/")return 100;if(Q==="~"||HC.test(Q))return 90;if(/^\/(?<dir>etc|usr|bin|sbin|System|Library|var|boot|root|home)(?<suffix>\/|$)/.test(Q))return 80;if(Q.startsWith("/Users/"))return 70;if(Q.startsWith("/")||Q.startsWith("~"))return 60;if(Q.startsWith("../"))return 40;if(Q===".."||Q==="."||Q.startsWith("./"))return 10;return 50},$s=new Set(["-e","--extension","-t","--type","-E","--exclude","-d","--max-depth","--min-depth","--exact-depth","-c","--color","--changed-within","--changed-before","-S","--size","-o","--owner","-j","--threads","-g","--glob","--format","--max-results","--ignore-file","--search-path","--base-directory","--path-separator","--and"]),Js=(Q,X)=>{let Y=[],$=1;while($<X){let J=Q[$];if($s.has(J)){$+=2;continue}if(J.startsWith("-")){$++;continue}if(KC(J))Y.push(J);$++}if(Y.length===0)return".";return Y.sort((J,Z)=>c3(Z)-c3(J)),Y[0]},Zs=(Q,X)=>{let Y=[];for(let $=1;$<X;$++){let J=Q[$];if(J.startsWith("-"))break;if(KC(J))Y.push(J)}if(Y.length===0)return".";return Y.sort(($,J)=>c3(J)-c3($)),Y[0]},QC={execFlags:new Set(["-x","-X","--exec","--exec-batch"]),placeholders:new Set(["{}","{/}","{//}","{.}","{/.}"]),pickRoot:Js},XC={execFlags:new Set(["-exec","-execdir","-ok","-okdir"]),placeholders:new Set(["{}"]),pickRoot:Zs},Gs=Object.assign(Object.create(null),{fd:QC,fdfind:QC,find:XC,gfind:XC}),Ws=(Q,X,Y)=>Q.map(($)=>X.placeholders.has($)?Y:$),Hs=(Q)=>{let X=Gs[Q.head];if(X===void 0)return[];let Y=[],$=Q.tokens;for(let J=1;J<$.length;J++){if(!X.execFlags.has($[J]))continue;let Z=[],G=J+1;while(G<$.length){let K=$[G];if(K===";"||K==="+")break;Z.push(K),G++}if(Z.length===0)continue;let W=Z[0];if(X.placeholders.has(W))continue;let H=X.pickRoot($,J);Y.push(i4.quote(Ws(Z,X,H))),J=G}return Y},Ks=/\$\(\s*cat\s+<<-?\s*['"]?(?<delimiter>\w+)['"]?\s*\n(?<body>[\s\S]*?)\n\s*\k<delimiter>\s*\)/u,Vs=/\$\(\s*(?:printf|echo)\s+(?:-[a-zA-Z]+\s+)*'(?<content>[^']*)'/u,u3=(Q,X)=>{let Y=Ks.exec(Q);if(Y!==null){let J=Y.groups?.body??Q;if(X!==void 0&&J.trim()==="__HEREDOC_BODY__"){let Z=Y.groups?.delimiter,G=Z===void 0?void 0:X.get(Z);if(G!==void 0)return G}return J}let $=Vs.exec(Q);if($!==null)return $.groups?.content??Q;return Q},_s=new Set(["sh","bash","zsh","dash","ksh","ash"]),qs=(Q)=>{if(!_s.has(Q.head))return[];let X=Q.tokens;for(let Y=1;Y<X.length;Y++){let $=X[Y];if($==="-c"&&Y+1<X.length)return[X[Y+1]];if($.startsWith("-")&&!$.startsWith("--")&&$.endsWith("c")&&$.length>2&&Y+1<X.length)return[X[Y+1]]}return[]},Ds=new Set(["command","exec","env","time","nohup","setsid","nice","ionice","chronic","stdbuf","unbuffer","script","taskset","sudo","doas","xargs","watch"]),Us={command:new Set,env:new Set(["-u","--unset","-C","--chdir","-S","--split-string","--block-signal"]),time:new Set(["-f","--format","-o","--output"]),nice:new Set(["-n","--adjustment"]),ionice:new Set(["-c","--class","-n","--classdata","-p","--pid"]),stdbuf:new Set(["-i","--input","-o","--output","-e","--error"]),script:new Set(["-c","--command"]),taskset:new Set,sudo:new Set(["-u","--user","-g","--group","-C","--close-from","-D","--chdir","-h","--host","-p","--prompt","-r","--role","-t","--type","-U","--other-user","-R","--chroot","-T","--command-timeout"]),doas:new Set(["-a","-C","-u"]),xargs:new Set(["-I","-i","-J","-n","--max-args","-P","--max-procs","-s","--max-chars","-L","--max-lines","-E","--eof","-d","--delimiter","-a","--arg-file","--replace"]),watch:new Set(["-n","--interval"])},Bs=(Q)=>/^[A-Za-z_][A-Za-z0-9_]*=.*/u.test(Q),zs=(Q)=>{let X=Q[0],Y=Us[X]??new Set,$=1;while($<Q.length){let J=Q[$];if(X==="env"&&Bs(J)){$++;continue}if(Y.has(J)){$+=2;continue}if(J.includes("=")&&Y.has(J.slice(0,J.indexOf("=")))){$++;continue}if(J.startsWith("--")&&J!=="--"){$++;continue}if(J.startsWith("-")&&J!=="-"){$++;continue}break}return $},Os=(Q)=>{if(!Ds.has(Q.head))return[];if(Q.head==="script")for(let $=1;$<Q.tokens.length-1;$++){let J=Q.tokens[$];if(J==="-c"||J==="--command")return[Q.tokens[$+1]];if(J.startsWith("--command="))return[J.slice(10)]}let X=zs(Q.tokens),Y=i4.quote(Q.tokens.slice(X));return Y===""?[]:[Y]},Fs=new Set(["eval"]),Rs=(Q)=>{if(!Fs.has(Q.head))return[];if(Q.tokens.length===2)return[Q.tokens[1]];let X=i4.quote(Q.tokens.slice(1));return X===""?[]:[X]},Ns=new Set(["run","proxy","err","test","summary"]),Ls=(Q)=>Q==="rtk",Ms=(Q)=>{let X=1;while(X<Q.length){let Y=Q[X];if(Y.startsWith("-")&&Y!=="-"&&Y!=="--"){X++;continue}break}return X},VC=(Q,X)=>{for(let Y=X;Y<Q.length;Y++){let $=Q[Y];if(($==="-c"||$==="--command")&&Y+1<Q.length)return Q[Y+1];if($.startsWith("--command="))return $.slice(10)}return null},ws=(Q)=>{if(!Ls(Q.head))return[];let X=Ms(Q.tokens),Y=Q.tokens[X];if(Y===void 0)return[];if(Ns.has(Y)){let J=VC(Q.tokens,X+1);if(J!==null)return J===""?[]:[J];let Z=X+1;while(Z<Q.tokens.length){let W=Q.tokens[Z];if(W==="--"){Z++;break}if(W.startsWith("-")&&W!=="-"){Z++;continue}break}let G=i4.quote(Q.tokens.slice(Z));return G===""?[]:[G]}let $=i4.quote(Q.tokens.slice(X));return $===""?[]:[$]},Ps={timeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,dashCommand:!1},gtimeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,dashCommand:!1},chroot:{valueFlags:new Set(["--userspec","--groups"]),skipPositionals:1,dashCommand:!1},flock:{valueFlags:new Set(["-w","--wait","--timeout","-E","--conflict-exit-code"]),skipPositionals:1,dashCommand:!0},su:{valueFlags:new Set,skipPositionals:0,dashCommand:!0}},As=(Q)=>{let X=Ps[Q.head];if(X===void 0)return[];if(X.dashCommand){let J=VC(Q.tokens,1);if(J!==null)return J===""?[]:[J]}let Y=1;while(Y<Q.tokens.length){let J=Q.tokens[Y];if(X.valueFlags.has(J)){Y+=2;continue}if(J.includes("=")&&X.valueFlags.has(J.slice(0,J.indexOf("=")))){Y++;continue}if(J==="--"){Y++;break}if(J.startsWith("-")&&J!=="-"){Y++;continue}break}Y+=X.skipPositionals;let $=i4.quote(Q.tokens.slice(Y));return $===""?[]:[$]},Cs=[Hs,qs,Os,Rs,ws,As],js=(Q)=>{let X="",Y=!1,$=!1,J=!1;for(let Z of Q){if(J){X+=Z,J=!1;continue}if(Z==="\\"){X+=Z,J=!0;continue}if(Z==="'"&&!$){Y=!Y,X+=Z;continue}if(Z==='"'&&!Y){$=!$,X+=Z;continue}X+=Z===`
|
|
73
|
-
`&&!Y&&!$?" ; ":Z}return X},QQ=(Q)=>{let X,Y=js(GC(Q));try{X=i4.parse(Y,na)}catch{return[]}X=aa(X);let $={remaining:sa(Y)},J=[],Z=[];for(let H of X){let K=r4(H);if(K!==null&&JC.has(K)){let V=eA(Z,$);if(V!==null)J.push(V);Z=[];continue}Z.push(H)}let G=eA(Z,$);if(G!==null)J.push(G);for(let H of[...Ys(Q),...ea(Q)])for(let K of QQ(H))J.push(K);let W=J.length;for(let H=0;H<W;H++){let K=J[H];for(let V of Cs)for(let _ of V(K))for(let q of QQ(_))J.push(q)}return J},Ts=(Q)=>Q.startsWith("./")?Q.slice(2):Q,LK=(Q,X=[],Y=[])=>{if(Q==="")return!1;let $=Ts(Q);if($===".."||$.startsWith("../")||$.includes("/../"))return!1;for(let J of[...YC,...Y])if($===J||$.startsWith(`${J}/`))return!0;for(let J of[...la,...X])if($===J||$.startsWith(`${J}/`))return!0;return!1},_C=(Q=[],X=[])=>{let Y={"build outputs":["dist","build","_build","out","target"],"js framework outputs":[".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless"],"tests / coverage":["coverage",".nyc_output"],caches:[".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox"],"language / package":["__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target"],"tmp / state":["tmp",".tmp",".state",...YC],iac:[".terraform"],"bundler dev":[".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"]};if(Q.length>0)Y["custom relative"]=Q;if(X.length>0)Y["custom absolute"]=X;return Object.entries(Y).map(([$,J])=>` ${$}: ${J.join(", ")}`).join(`
|
|
74
|
-
`)},C1=(Q)=>/(?<prefix>^|\s)#\s*tripwire-allow\b/.test(GC(Q));var XQ=require("fs"),DC=require("os");var qC=g.Struct({pattern:g.String,message:g.String,action:g.optional(g.Union([g.Literal("deny"),g.Literal("ask")])),requiresFlags:g.optional(g.Array(g.String)),forbidsFlagValues:g.optional(g.Array(g.Struct({flag:g.String,values:g.Array(g.String)})))}),Is=g.Struct({protectedBranches:g.optional(g.Array(g.String)),enforceConventionalCommits:g.optional(g.Boolean)}),Es=g.Struct({relative:g.optional(g.Array(g.String)),absolute:g.optional(g.Array(g.String))}),Ss=g.Struct({git:g.optional(Is),safePaths:g.optional(Es),blockedCommands:g.optional(g.Array(qC)),allowedCommands:g.optional(g.Array(qC))}),MK=`${DC.homedir()}/.config/tripwire/config.json`,vs=(Q)=>w0.sync(()=>{try{return XQ.accessSync(Q,XQ.constants.R_OK),!0}catch{return!1}}),xs=(Q)=>w0.try({try:()=>XQ.readFileSync(Q,"utf8"),catch:(X)=>X}),bs=(Q)=>w0.try({try:()=>JSON.parse(Q),catch:(X)=>X}),ks=(Q)=>g.decodeUnknownEffect(Ss)(Q,{onExcessProperty:"error"}),g9=()=>({git:{protectedBranches:["main","master","develop","production","release"],enforceConventionalCommits:!0},safePaths:{},blockedCommands:[],allowedCommands:[]}),wK=(Q)=>({git:Q.git??g9().git,safePaths:Q.safePaths??g9().safePaths,blockedCommands:Q.blockedCommands??g9().blockedCommands,allowedCommands:Q.allowedCommands??g9().allowedCommands}),UC=(Q=MK)=>w0.gen(function*(){if(!(yield*vs(Q)))return{ok:!0,config:g9()};let Y=yield*xs(Q),$=yield*bs(Y),J=yield*ks($);return{ok:!0,config:wK(J)}}).pipe(w0.timeout(1000),w0.catchCause((X)=>{let Y={ok:!1,error:B1.pretty(X)};return w0.succeed(Y)}));var BC={allow:0,warn:1,ask:2,deny:3},v=(Q)=>({kind:"allow",rule:Q,message:""}),h6=(Q,X)=>({kind:"warn",rule:Q,message:X}),G1=(Q,X)=>({kind:"ask",rule:Q,message:X}),c=(Q,X)=>({kind:"deny",rule:Q,message:X}),B7=(Q)=>{let X=v("none");for(let Y of Q)if(BC[Y.kind]>BC[X.kind])X=Y;return X};var zC=g.Struct({hook_event_name:g.String,tool_name:g.optional(g.String),tool_input:g.optional(g.Unknown),tool_response:g.optional(g.Unknown),cwd:g.optional(g.String),session_id:g.optional(g.String),turn_id:g.optional(g.String),tool_use_id:g.optional(g.String)}),OC=(Q)=>typeof Q==="object"&&Q!==null&&typeof Q.command==="string",FC=(Q)=>typeof Q==="object"&&Q!==null&&typeof Q.file_path==="string"&&typeof Q.old_string==="string"&&typeof Q.new_string==="string",RC=(Q)=>typeof Q==="object"&&Q!==null&&typeof Q.file_path==="string"&&typeof Q.content==="string",NC=(Q)=>typeof Q==="object"&&Q!==null&&typeof Q.file_path==="string",LC=(Q,X)=>{if(typeof X!=="object"||X===null)return"";if(Q==="Bash"){let Y=X;return[Y.stdout??"",Y.stderr??""].filter(($)=>$.length>0).join(`
|
|
75
|
-
`)}if(Q==="Read"){let Y=X;return Y.content??Y.file?.content??""}if(typeof X.content==="string")return X.content??"";return""};var l3=require("fs"),MC=require("os"),wC=require("path"),PC=`${MC.homedir()}/.claude/tripwire.log`;try{l3.mkdirSync(wC.dirname(PC),{recursive:!0})}catch{}var z7=(Q,X)=>{let Y=new Date().toISOString(),$=X instanceof Error?X.stack??X.message:String(X);try{l3.appendFileSync(PC,`[${Y}] [${Q}] ${$}
|
|
76
|
-
`)}catch{}};var ys=(Q)=>Q.tokens.slice(1).join(" "),AC=(Q,...X)=>Q.flags.some((Y)=>X.includes(Y)),gs=[{rule:"rm-rf-root",action:"deny",message:"rm -rf / is catastrophic. If the goal is cleaning a subdirectory, scope the path inside the project (e.g. ./dist).",match:(Q)=>Q.head==="rm"&&AC(Q,"-rf","-fr","-Rf","-fR")&&Q.tokens.includes("/")},{rule:"rm-rf-home",action:"deny",message:"rm -rf on $HOME / ~ would erase the home directory. Refuse.",match:(Q)=>Q.head==="rm"&&AC(Q,"-rf","-fr","-Rf","-fR")&&Q.tokens.some((X)=>/^(?<home>~|\$HOME|\$\{HOME\})$/.test(X))},{rule:"fork-bomb",action:"deny",message:"Fork bomb pattern detected. Refuse.",match:(Q,X)=>/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/.test(X)},{rule:"source-script",action:"deny",message:"`source` / `.` executes a file in the current shell. Refuse arbitrary sourced scripts.",match:(Q)=>(Q.head==="source"||Q.head===".")&&Q.tokens.length>1},{rule:"dd-raw-device",action:"deny",message:"dd writing to a raw block device wipes the disk. Refuse.",match:(Q)=>Q.head==="dd"&&/\bof=\/dev\/(?<type>disk|sd|nvme|rdisk)/i.test(ys(Q))},{rule:"mkfs",action:"deny",message:"mkfs formats a filesystem. Refuse.",match:(Q)=>/^mkfs(?<ext>\.[a-z0-9]+)?$/i.test(Q.head)},{rule:"kill-all",action:"deny",message:"kill -9 -1 kills every process you own. Refuse.",match:(Q)=>Q.head==="kill"&&Q.tokens.includes("-9")&&Q.tokens.includes("-1")},{rule:"chmod-777-recursive",action:"deny",message:"Recursive chmod 777 makes everything world-writable. Use 755 for directories, 644 for files, scoped narrowly.",match:(Q)=>Q.head==="chmod"&&Q.flags.some((X)=>X.includes("R"))&&Q.tokens.includes("777")},{rule:"no-verify",action:"deny",message:"--no-verify skips git hooks. Per policy: never skip hooks. Fix the underlying issue.",match:(Q)=>Q.tokens.includes("--no-verify")},{rule:"no-gpg-sign",action:"deny",message:"Bypassing GPG signing is off-limits unless explicitly requested.",match:(Q,X)=>/--no-gpg-sign\b|-c\s+commit\.gpgsign=false/.test(X)},{rule:"sudo",action:"ask",message:"sudo escalates privileges and is almost never needed in a coding session. If genuinely required, explain why; otherwise find a non-sudo path.",match:(Q)=>Q.head==="sudo"},{rule:"shutdown",action:"deny",message:"shutdown / reboot / halt control the machine. Refuse \u2014 system control should be done manually.",match:(Q)=>["shutdown","reboot","halt","poweroff"].includes(Q.head)},{rule:"launchctl-mutation",action:"deny",message:"launchctl load/unload/bootstrap/bootout/kickstart mutates system services. Refuse \u2014 surface the intent instead.",match:(Q)=>Q.head==="launchctl"&&typeof Q.tokens[1]==="string"&&["load","unload","bootstrap","bootout","kickstart","enable","disable"].includes(Q.tokens[1])},{rule:"defaults-write",action:"deny",message:"`defaults write` mutates macOS preferences. Refuse \u2014 surface the intent.",match:(Q)=>Q.head==="defaults"&&Q.tokens[1]==="write"},{rule:"csrutil",action:"deny",message:"csrutil controls System Integrity Protection. Refuse.",match:(Q)=>Q.head==="csrutil"},{rule:"nvram",action:"deny",message:"nvram modifies firmware variables. Refuse.",match:(Q)=>Q.head==="nvram"},{rule:"diskutil-destructive",action:"deny",message:"diskutil eraseDisk / reformat / partitionDisk wipes disks. Refuse.",match:(Q)=>Q.head==="diskutil"&&typeof Q.tokens[1]==="string"&&["eraseDisk","reformat","partitionDisk","eraseVolume","secureErase"].includes(Q.tokens[1])},{rule:"tmutil-destructive",action:"deny",message:"tmutil delete / disablelocal touches Time Machine. Refuse.",match:(Q)=>Q.head==="tmutil"&&typeof Q.tokens[1]==="string"&&["delete","disablelocal"].includes(Q.tokens[1])},{rule:"osascript",action:"ask",message:"osascript runs arbitrary AppleScript and can do almost anything (move files, send emails, drive apps). Confirm with the user what you want done before running it.",match:(Q)=>Q.head==="osascript"},{rule:"topgrade",action:"deny",message:"topgrade upgrades everything (brew, mas, npm globals, rust, mise). System upgrades should be done manually.",match:(Q)=>Q.head==="topgrade"},{rule:"rsync-delete",action:"deny",message:"rsync --delete removes files at the destination. High blast radius \u2014 surface the intent instead.",match:(Q)=>Q.head==="rsync"&&Q.flags.includes("--delete")},{rule:"softwareupdate-install",action:"deny",message:"`softwareupdate --install / -i / -d` triggers macOS system updates. Refuse \u2014 system updates should be done manually.",match:(Q)=>Q.head==="softwareupdate"&&Q.flags.some((X)=>X==="--install"||X==="-i"||X==="-d"||X.startsWith("--download"))},{rule:"pmset-write",action:"deny",message:"`pmset` (with arguments) writes power-management settings. Read-only `pmset -g` is fine; mutations need the user.",match:(Q)=>Q.head==="pmset"&&Q.tokens.length>1&&!Q.tokens.includes("-g")&&!Q.tokens.includes("-G")},{rule:"dscl-mutate",action:"deny",message:"`dscl . -create / -delete / -append / -change / -merge` modifies the local directory service (your user account, groups, etc.). Refuse.",match:(Q)=>Q.head==="dscl"&&Q.tokens.some((X)=>["-create","-delete","-append","-change","-merge","-passwd"].includes(X))},{rule:"xattr-quarantine-bypass",action:"deny",message:"`xattr -d com.apple.quarantine` removes Gatekeeper's quarantine bit \u2014 the macOS protection against running untrusted binaries. Refuse.",match:(Q)=>Q.head==="xattr"&&Q.tokens.includes("-d")&&Q.tokens.some((X)=>X.includes("com.apple.quarantine"))},{rule:"spctl-disable",action:"deny",message:"`spctl --master-disable` / `--global-disable` disables Gatekeeper system-wide. Refuse.",match:(Q)=>Q.head==="spctl"&&Q.flags.some((X)=>X==="--master-disable"||X==="--global-disable"||X==="--disable")},{rule:"kextload",action:"deny",message:"Loading a kernel extension (`kextload`, `kmutil load`) is a system-level mutation. Refuse \u2014 the user handles this manually.",match:(Q)=>Q.head==="kextload"||Q.head==="kextunload"||Q.head==="kmutil"&&(Q.tokens[1]==="load"||Q.tokens[1]==="unload")},{rule:"security-keychain-destructive",action:"deny",message:"`security delete-keychain / delete-generic-password / delete-internet-password / set-keychain-settings` mutates your Keychain (where CLIs store their secrets). Refuse \u2014 Keychain should be managed manually.",match:(Q)=>Q.head==="security"&&typeof Q.tokens[1]==="string"&&["delete-keychain","delete-generic-password","delete-internet-password","delete-certificate","delete-identity","set-keychain-settings","unlock-keychain","lock-keychain","create-keychain"].includes(Q.tokens[1])},{rule:"security-keychain-add-write",action:"ask",message:"`security add-generic-password / add-internet-password / add-certificate` writes to your Keychain. Other tools manage their own entries \u2014 confirm this is the right path before adding anything else manually.",match:(Q)=>Q.head==="security"&&typeof Q.tokens[1]==="string"&&["add-generic-password","add-internet-password","add-certificate"].includes(Q.tokens[1])},{rule:"systemsetup",action:"deny",message:"`systemsetup -set...` writes machine-wide settings (timezone, sleep, network time, restart-on-power-failure). Refuse.",match:(Q)=>Q.head==="systemsetup"&&Q.tokens.some((X)=>X.startsWith("-set"))},{rule:"scutil-set",action:"deny",message:"`scutil --set` writes system configuration (computer name, hostname, LocalHostName). Refuse \u2014 read-only `scutil --get` is fine.",match:(Q)=>Q.head==="scutil"&&Q.tokens.includes("--set")},{rule:"brew-mutation",action:"ask",message:"`brew install/uninstall/upgrade/untap` modifies the machine globally. Confirm before running.",match:(Q)=>Q.head==="brew"&&typeof Q.tokens[1]==="string"&&["install","uninstall","upgrade","reinstall","untap","tap"].includes(Q.tokens[1])},{rule:"mas-mutation",action:"ask",message:"`mas install/uninstall` changes installed Mac App Store apps. Confirm.",match:(Q)=>Q.head==="mas"&&typeof Q.tokens[1]==="string"&&["install","uninstall","purchase"].includes(Q.tokens[1])},{rule:"gh-destructive",action:"deny",message:"gh repo/release/issue delete is destructive on shared state. Refuse.",match:(Q)=>Q.head==="gh"&&typeof Q.tokens[1]==="string"&&typeof Q.tokens[2]==="string"&&["repo","release","issue","pr"].includes(Q.tokens[1])&&["delete","destroy","remove"].includes(Q.tokens[2])},{rule:"flyctl-destroy",action:"deny",message:"flyctl apps destroy / volumes destroy nukes deployed infra. Refuse.",match:(Q)=>Q.head==="flyctl"&&Q.tokens.some((X)=>X==="destroy"||X==="delete")},{rule:"gcloud-delete",action:"deny",message:"`gcloud ... delete` affects cloud resources. Refuse.",match:(Q)=>Q.head==="gcloud"&&Q.tokens.includes("delete")}],hs=new Set(["rm-rf-root","rm-rf-home","fork-bomb","dd-raw-device","mkfs","kill-all","diskutil-destructive","tmutil-destructive","shutdown","csrutil","nvram","kextload","spctl-disable","xattr-quarantine-bypass","topgrade","softwareupdate-install","systemsetup","scutil-set","security-keychain-destructive","no-verify","no-gpg-sign"]),CC=(Q,X)=>{let Y=C1(X),$=[];for(let J of Q)for(let Z of gs){if(!Z.match(J,X))continue;if(Y&&!hs.has(Z.rule))continue;$.push(Z.action==="deny"?c(Z.rule,Z.message):G1(Z.rule,Z.message));break}return $.length===0?v("bash-deny"):B7($)};var ms=["main","master","develop","production","release"],PK=(Q)=>Q.protectedBranches??ms,ds=/^(?<type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?<scope>\([\w./\- ]+\))?!?:\s+\S/,ps=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--super-prefix"]),fs=new Set(["--bare","--paginate","-p","--no-pager","--no-replace-objects","--literal-pathspecs","--glob-pathspecs","--noglob-pathspecs","--icase-pathspecs","--no-optional-locks","--exec-path","--html-path","--man-path","--info-path"]),cs=(Q)=>{if(Q.head!=="git")return null;let X=Q.tokens.slice(1),Y=0;while(Y<X.length){let $=X[Y];if(ps.has($)){Y+=2;continue}if(fs.has($)){Y++;continue}if($.startsWith("--git-dir=")||$.startsWith("--work-tree=")||$.startsWith("--namespace=")||$.startsWith("--super-prefix=")||$.startsWith("--exec-path=")){Y++;continue}if($.startsWith("-")){Y++;continue}return{subcommand:$,subArgs:X.slice(Y+1)}}return null},us=(Q,X)=>{for(let Y=0;Y<Q.length;Y++){let $=Q[Y];if($==="-m"||$==="--message"){let J=Q[Y+1];return J===void 0?null:u3(J,X)}if($.startsWith("--message="))return u3($.slice(10),X);if(/^-[a-zA-Z]*m[a-zA-Z]*$/.test($)){let J=Q[Y+1];return J===void 0?null:u3(J,X)}}return null},ls=(Q,X)=>{let Y=PK(X);for(let $ of Q)for(let J of Y)if($===J||$.endsWith(`:${J}`)||$.endsWith(`/${J}`))return J;return null},os=(Q)=>Q.filter((X)=>!X.startsWith("-")),rs=(Q)=>Q.filter((X)=>X.startsWith("-")),r0=(Q,...X)=>X.some((Y)=>Q.includes(Y)),is=({subArgs:Q,positional:X})=>{if(r0(Q,"--global","--system"))return c("git-config-global","Modifying global / system git config is off-limits \u2014 that is your personal identity. Read-only `git config --get` is fine.");if(!r0(Q,"--get","-l","--list","--get-all","--get-regexp")&&X.length>=2)return c("git-config-write","Local git config writes should be done explicitly. To read a value, use `git config --get <key>`.");return v("bash-git")},ns=({subArgs:Q})=>{if(r0(Q,"--cached"))return v("bash-git");return G1("git-rm","`git rm <path>` removes from the index AND the working tree. To untrack-only, use `git rm --cached <path>`. To delete the file separately, use `trash` / `rip`. Confirm intent.")},as=({subArgs:Q,positional:X})=>{if(r0(Q,"--staged","-S")&&!r0(Q,"--worktree","-W"))return v("bash-git");if(X.length>0)return c("git-restore-discard","`git restore <path>` discards uncommitted changes in the working tree. Refuse \u2014 `git diff <path>` to inspect first, or `git stash push <path>` to preserve.");return v("bash-git")},ss=({subArgs:Q,positional:X})=>{if(r0(Q,"-b","-B"))return v("bash-git");if(r0(Q,"-f","--force"))return c("git-checkout-force","`git checkout -f` overwrites the working tree without preserving uncommitted changes. Refuse.");if(Q.includes("--"))return c("git-checkout-discard","`git checkout -- <path>` discards uncommitted working-tree changes. Refuse \u2014 use `git stash push <path>` to preserve, or `git diff <path>` to inspect first.");if(X.length===1&&(X[0]==="."||X[0].startsWith("./")))return c("git-checkout-discard-all","`git checkout .` discards ALL uncommitted working-tree changes. Refuse \u2014 `git stash` to preserve, or `git diff` to inspect first.");return v("bash-git")},ts=({subArgs:Q})=>{if(r0(Q,"-f","--force","--discard-changes"))return c("git-switch-force","`git switch -f / --discard-changes` throws away uncommitted working-tree changes. Refuse.");return v("bash-git")},es=({subArgs:Q,flags:X,positional:Y})=>{if(r0(Q,"--hard"))return c("git-reset-hard","`git reset --hard` discards all uncommitted changes AND moves HEAD. Refuse \u2014 describe the intent in chat. If undoing a published commit, `git revert <sha>` is safer.");if(r0(Q,"--keep"))return G1("git-reset-keep","`git reset --keep` resets HEAD but preserves uncommitted local changes. Confirm intent.");if(Y.length===0&&X.length===0)return v("bash-git");return G1("git-reset-mixed","`git reset` moves HEAD. Confirm intent \u2014 if undoing a commit, `git revert` is usually safer.")},Qt=({flags:Q})=>{if(Q.some((X)=>/^-[a-zA-Z]*[df]/.test(X)||X==="--force"))return c("git-clean-fd","`git clean -fd` deletes untracked files (often your in-progress work). Refuse \u2014 inspect with `git clean -dn` (dry run) first. If genuinely needed, append ` # tripwire-allow: <reason>`.");return v("bash-git")},Xt=({subArgs:Q,positional:X,config:Y})=>{if(r0(Q,"--abort","--quit","--continue","--skip","--edit-todo"))return v("bash-git");if(r0(Q,"-i","--interactive"))return c("git-rebase-interactive","`git rebase -i` rewrites history interactively. Refuse \u2014 too easy to lose commits in the agent loop. If this is genuinely required, do it manually outside the agent.");let $=X[0],J=PK(Y);if($!==void 0&&J.includes($))return G1("git-rebase-onto-protected",`Rebasing onto \`${$}\` rewrites history of the current branch. \`git merge ${$}\` is usually safer. Confirm intent.`);return G1("git-rebase","`git rebase` rewrites commit history. `git merge` is usually safer. Confirm intent.")},Yt=({subArgs:Q})=>{if(r0(Q,"--abort","--quit","--continue","--skip"))return v("bash-git");return G1("git-cherry-pick","`git cherry-pick` applies commits onto the current branch and can create conflicts. Confirm intent.")},$t=({subArgs:Q})=>{if(r0(Q,"--abort","--continue","--quit"))return v("bash-git");return G1("git-merge","`git merge <branch>` may create merge conflicts. Confirm intent.")},Jt=({subArgs:Q,config:X,heredocBodies:Y})=>{if(r0(Q,"--amend"))return c("git-commit-amend","`git commit --amend` rewrites the last commit. If it has been pushed, this causes upstream divergence. Refuse \u2014 surface the intent.");let $=us(Q,Y),J=r0(Q,"-F","--file","-c","-C","--reuse-message","--reedit-message"),Z=r0(Q,"--no-edit");if($===null&&!J&&!Z)return c("git-commit-no-message",'`git commit` without `-m "..."` opens an editor and hangs the agent. Use `git commit -m "<conventional message>"`.');if($!==null&&X.enforceConventionalCommits!==!1&&!ds.test($))return c("git-commit-non-conventional",["Commit message must follow Conventional Commits format:"," `<type>(<scope>)?(!)?: <description>`","Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.","Examples:"," `fix(auth): handle expired token refresh`"," `feat: add bash-git rule`"," `chore: bump deps`",`Got: ${JSON.stringify($)}`].join(`
|
|
77
|
-
`));if(r0(Q,"-a","--all")||Q.some((G)=>/^-[a-zA-Z]*a[a-zA-Z]*$/.test(G)))return G1("git-commit-auto-stage","`git commit -a / --all` auto-stages every tracked change. Explicit `git add <files>` first is usually clearer about what is being committed. Confirm.");return v("bash-git")},Zt=({subArgs:Q,flags:X,positional:Y,config:$})=>{if(X.some((Z)=>Z==="--force"||Z==="-f"||Z.startsWith("--force-with-lease")))return c("git-force-push","Force push is forbidden. If a branch needs to be reset upstream, surface the intent \u2014 there is almost always a non-force path.");if(r0(Q,"--delete","--mirror")||Q.some((Z)=>Z.startsWith(":")))return c("git-push-delete","Refusing to delete a remote branch via push. If genuinely needed, surface the intent.");let J=ls(Y,$);if(J!==null)return c("git-push-protected",`Refusing to push directly to protected branch \`${J}\`. Open a PR instead: \`gh pr create\`.`);return v("bash-git")},Gt=({subArgs:Q,flags:X,positional:Y,config:$})=>{let J=X.find((Z)=>Z==="-D"||Z==="-d"||Z==="--delete"||/^-[a-zA-Z]*D/.test(Z)||/^-[a-zA-Z]*d/.test(Z));if(J!==void 0){let Z=Y,G=PK($),W=Z.find((H)=>G.includes(H));if(W!==void 0)return c("git-branch-delete-protected",`Refusing to delete protected branch \`${W}\`.`);if(J==="-D"||J.includes("D"))return c("git-branch-force-delete",`\`git branch -D ${Z.join(" ")}\` force-deletes branches even if unmerged (potential data loss). To delete a merged branch, use \`-d\`. To force, append \` # tripwire-allow: <reason>\`.`);return G1("git-branch-delete",`\`git branch -d ${Z.join(" ")}\` deletes a branch (merged-only check). Confirm intent.`)}if(r0(Q,"-m","-M","--move"))return G1("git-branch-move","Renaming a branch can confuse pushed remotes. Confirm intent.");return v("bash-git")},Wt=({subArgs:Q})=>{if(r0(Q,"-d","--delete"))return c("git-tag-delete","`git tag -d` deletes a tag. Refuse \u2014 surface intent.");return v("bash-git")},Ht=({subArgs:Q})=>{let X=Q[0]??"push";if(X==="drop"||X==="clear")return c("git-stash-drop",`\`git stash ${X}\` discards stashed work. Refuse \u2014 \`git stash list\` and \`git stash show\` to inspect first.`);return v("bash-git")},Kt=({flags:Q})=>{if(Q.some((X)=>X.startsWith("--prune=")||X==="--aggressive"))return c("git-gc-prune","`git gc --prune=now` / `--aggressive` destroys reflog recovery options. Refuse.");return v("bash-git")},Vt=({subArgs:Q})=>{let X=Q[0];if(X==="add"||X==="remove"||X==="rm"||X==="set-url"||X==="rename")return G1("git-remote-mutate",`\`git remote ${X}\` changes which remote you're pushing to. Confirm \u2014 accidentally pointing at the wrong remote is high blast-radius.`);return v("bash-git")},jC=({subcommand:Q,subArgs:X})=>{let Y=X[0]??"";if(["add","remove","rm","deinit","sync","set-url"].includes(Y))return G1("git-submodule-worktree-mutate",`\`git ${Q} ${Y}\` modifies repo structure. Confirm intent.`);return v("bash-git")},_t=new Map([["config",is],["add",()=>v("bash-git")],["mv",()=>v("bash-git")],["rm",ns],["restore",as],["checkout",ss],["switch",ts],["reset",es],["clean",Qt],["rebase",Xt],["cherry-pick",Yt],["merge",$t],["commit",Jt],["push",Zt],["branch",Gt],["tag",Wt],["stash",Ht],["filter-branch",({subcommand:Q})=>c("git-filter",`\`git ${Q}\` rewrites entire repo history. Refuse.`)],["filter-repo",({subcommand:Q})=>c("git-filter",`\`git ${Q}\` rewrites entire repo history. Refuse.`)],["gc",Kt],["update-ref",()=>c("git-update-ref","`git update-ref` directly mutates refs and bypasses normal git operations. Refuse.")],["remote",Vt],["submodule",jC],["worktree",jC],["init",({subcommand:Q})=>h6(`git-${Q}`,`\`git ${Q}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)],["clone",({subcommand:Q})=>h6(`git-${Q}`,`\`git ${Q}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)]]),qt=(Q,X,Y)=>{let{subcommand:$,subArgs:J}=Q,Z=rs(J),G=os(J);if(new Set(["status","diff","log","show","blame","rev-parse","rev-list","ls-files","ls-tree","cat-file","reflog","describe","shortlog","whatchanged","archive","bundle","fsck","fetch","ls-remote","help","version","grep","name-rev","merge-base","symbolic-ref","check-ignore","count-objects","verify-commit","verify-tag"]).has($)){if($==="reflog"&&(J[0]==="expire"||r0(J,"--expire")))return c("git-reflog-expire","`git reflog expire` destroys git's recovery history. Refuse \u2014 surface the intent.");if($==="symbolic-ref"&&G.length>=2)return c("git-symbolic-ref-write","`git symbolic-ref <name> <ref>` rewrites a symbolic ref. Refuse.");return v("bash-git")}let H=_t.get($);if(H!==void 0)return H({subcommand:$,subArgs:J,flags:Z,positional:G,config:X,heredocBodies:Y});return h6("git-unknown-subcommand",`\`git ${$}\` is not classified by tripwire. Allowing \u2014 flag if this looks like history-rewriting or data-loss territory.`)},TC=(Q,X,Y)=>{if(C1(X))return v("bash-git");let $=WC(X);for(let J of Q){let Z=cs(J);if(Z===null)continue;let G=qt(Z,Y,$);if(G!==null&&G.kind!=="allow")return G}return v("bash-git")};var Dt=new Set(["curl","wget","wget2","aria2c","xh"]),Ut=new Set(["bash","sh","zsh","fish"]),Bt=(Q)=>{for(let X=0;X<Q.length-1;X++){let Y=Q[X],$=Q[X+1];if(Dt.has(Y.head)&&Ut.has($.head))return!0}return!1},zt=[{head:"cargo",subcommand:"install",rule:"cargo-install",message:"Confirm before `cargo install <crate>`: this builds and installs arbitrary code from crates.io into ~/.cargo/bin globally."},{head:"go",subcommand:"install",rule:"go-install",message:"Confirm before `go install`: this fetches and installs arbitrary Go code globally."},{head:"gem",subcommand:"install",rule:"gem-install",message:"Confirm before `gem install`: pulls arbitrary code from rubygems.org."}],IC=(Q,X)=>{if(C1(X))return v("bash-network-install");if(Bt(Q))return c("curl-pipe-shell","Piping `curl` / `wget` directly into a shell runs whatever the remote URL serves. Refuse \u2014 download to a file, inspect, then run if appropriate. If you genuinely need this, append ` # tripwire-allow: <reason>` (and explain to the user what you're running).");for(let Y of Q)for(let $ of zt)if(Y.head===$.head&&Y.tokens[1]===$.subcommand)return G1($.rule,$.message);return v("bash-network-install")};var Ot=[{rule:"redirect-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,message:"Refusing to write into a .env file via shell redirect / tee / cp / mv. .env files hold secrets \u2014 never overwrite from a tool call."},{rule:"redirect-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,message:"Refusing to write into .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"redirect-ssh",pattern:/(?<prefix>^|\/)\.ssh\//,message:"Refusing to write into ~/.ssh/ via shell."},{rule:"redirect-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/i,message:"Refusing to overwrite a private-key-shaped file via shell."},{rule:"redirect-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/,message:"Refusing to write into ~/.aws/credentials via shell."},{rule:"redirect-netrc",pattern:/(?<prefix>^|\/)\.netrc$/,message:"Refusing to write into ~/.netrc via shell."},{rule:"redirect-block-device",pattern:/^\/dev\/(?<type>sd|disk|nvme|rdisk)/i,message:"Redirecting into a raw block device wipes the disk. Refuse."}],AK=(Q)=>{for(let X of Ot)if(X.pattern.test(Q))return c(X.rule,X.message);return null},EC=(Q,X)=>{if(C1(X))return v("bash-redirect");for(let Y of Q){for(let $ of Y.redirects)if($.op===">"||$.op===">>"){let J=AK($.target);if(J!==null)return J}if(Y.head==="tee")for(let $ of Y.args){let J=AK($);if(J!==null)return J}if(Y.head==="cp"||Y.head==="mv"){let $=Y.args.at(-1);if($!==void 0){let J=AK($);if(J!==null)return J}}}return v("bash-redirect")};var Ft=(Q,X)=>{let Y=!1,$=[];for(let G of Q.tokens.slice(1)){if(!Y&&G==="--"){Y=!0;continue}if(!Y&&G.startsWith("-")&&G!=="-")continue;$.push(G)}let J=X.relative??[],Z=X.absolute??[];return $.filter((G)=>!LK(G,J,Z))},Rt=(Q,X)=>{if(!Q.tokens.includes("-delete"))return null;let Y=[];for(let G of Q.tokens.slice(1)){if(G.startsWith("-"))break;Y.push(G)}let $=Y.length===0?["."]:Y,J=X.relative??[],Z=X.absolute??[];return $.filter((G)=>!LK(G,J,Z))},SC=(Q,X,Y)=>{if(C1(X))return v("bash-scoped-rm");let $=[];for(let W of Q){if(W.head==="rm"){let H=Ft(W,Y);if(H.length>0)$.push({kind:"rm",targets:H});continue}if(W.head==="find"){let H=Rt(W,Y);if(H!==null&&H.length>0)$.push({kind:"find -delete",targets:H})}}if($.length===0)return v("bash-scoped-rm");let J=Y.relative??[],Z=Y.absolute??[],G=$.map((W)=>` \u2022 ${W.kind} on: ${W.targets.map((H)=>JSON.stringify(H)).join(", ")}`).join(`
|
|
78
|
-
`);return c("destructive-outside-safe-paths",`Destructive deletion outside known-safe scopes is blocked. Use \`trash\` (macOS Trash, recoverable) or \`rip\` (graveyard at /tmp/graveyard-$USER, recoverable until reboot) instead. Real \`rm\` and \`find -delete\` are allowed only inside ephemeral build / cache / state directories:
|
|
79
|
-
${_C(J,Z)}
|
|
80
|
-
|
|
81
|
-
Flagged targets:
|
|
82
|
-
${G}
|
|
83
|
-
|
|
84
|
-
If raw \`rm\` is genuinely needed, append \` # tripwire-allow: <reason>\` to the command.`)};var Nt=(Q)=>Q==="-x"||Q==="-xf"||Q==="-xzf"||Q==="-xjf"||Q==="-xJf"||Q==="-xvf"||Q==="-xvzf"||Q==="-xvjf"||Q==="--extract"||/^-[xvzjJtf]+$/.test(Q),Lt=(Q)=>{for(let X=0;X<Q.tokens.length;X++){let Y=Q.tokens[X];if(Y==="-C"||Y==="--directory")return Q.tokens[X+1]??null;if(Y.startsWith("--directory="))return Y.slice(12)}return null},vC=(Q)=>{return Q==="/"||/^(?<home>~|\$HOME|\$\{HOME\})$/.test(Q)},xC=(Q,X)=>{if(C1(X))return v("bash-tar-explosion");for(let Y of Q){if(Y.head!=="tar")continue;if(!(Y.flags.some(Nt)||Y.tokens.includes("--extract")))continue;let J=Lt(Y);if(J!==null&&vC(J))return c("tar-extract-to-root",`tar -x with -C ${J} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory (e.g. ./tmp/extract) and inspect before moving anything elsewhere.`)}for(let Y of Q){if(Y.head!=="unzip")continue;for(let $=0;$<Y.tokens.length;$++)if(Y.tokens[$]==="-d"){let J=Y.tokens[$+1];if(J!==void 0&&vC(J))return c("unzip-to-root",`unzip -d ${J} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory.`)}}return v("bash-tar-explosion")};var Mt=[{rule:"use-bun-not-npm",action:"deny",message:"Use `bun` instead of `npm`. Translations: `npm install` \u2192 `bun install`, `npm install <pkg>` \u2192 `bun add <pkg>`, `npm install -D <pkg>` \u2192 `bun add -d <pkg>`, `npm run X` \u2192 `bun run X` (or `bun X` for bin scripts), `npm test` \u2192 `bun test`. If you genuinely need npm (publishing to a registry that requires it, working in a different repo), append ` # tripwire-allow: <reason>` to the command.",fires:(Q)=>Q.head==="npm"},{rule:"use-bunx-not-npx",action:"deny",message:"Use `bunx` instead of `npx`. Same usage shape, faster, no implicit npm cache.",fires:(Q)=>Q.head==="npx"},{rule:"use-bun-not-pnpm",action:"deny",message:"Use `bun` instead of `pnpm`. The user is bun-only across their repos.",fires:(Q)=>Q.head==="pnpm"},{rule:"use-bun-not-yarn",action:"deny",message:"Use `bun` instead of `yarn`. The user is bun-only.",fires:(Q)=>Q.head==="yarn"},{rule:"use-uv-not-pip",action:"deny",message:"Use `uv` instead of `pip`. Translations: `pip install <pkg>` \u2192 `uv add <pkg>` (project dependency) or `uv pip install <pkg>` (env-only escape hatch). `pip freeze` \u2192 `uv pip freeze`. `pip list` \u2192 `uv pip list`. The user is uv-only across Python repos.",fires:(Q)=>Q.head==="pip"||Q.head==="pip3"},{rule:"use-uv-sync-not-venv",action:"deny",message:"`python -m venv` creates a bare venv; use `uv sync` instead. uv sync creates the venv AND installs from pyproject.toml + uv.lock in one atomic step. To activate: `source .venv/bin/activate` after.",fires:(Q)=>(Q.head==="python"||Q.head==="python3")&&Q.tokens.includes("-m")&&Q.tokens.includes("venv")},{rule:"uv-sync-over-uv-venv",action:"deny",message:"Use `uv sync` instead of `uv venv`. `uv venv` creates an empty venv that you then have to populate; `uv sync` creates the venv AND resolves+installs from pyproject.toml + uv.lock in one step. The only reason to use `uv venv` standalone is when there is no pyproject.toml \u2014 and in that case, `uv init` first.",fires:(Q)=>Q.head==="uv"&&Q.tokens[1]==="venv"},{rule:"use-bun-patch-not-patch-package",action:"deny",message:"Use `bun patch` instead of `patch-package`. Bun has built-in patch support that integrates with bun.lock; patch-package is npm-era and produces patches in a different format.",fires:(Q)=>Q.head==="patch-package"},{rule:"consider-fd",action:"warn",message:'Consider `fd` instead of `find`. Faster, simpler syntax, respects .gitignore by default. Examples: `find . -name "*.ts"` \u2192 `fd -e ts`, `find . -type f -name "X"` \u2192 `fd -t f X`, `find PATH ...` \u2192 `fd ... PATH`. The user has both installed; either works.',fires:(Q)=>Q.head==="find"},{rule:"consider-rg",action:"warn",message:'Consider `rg` (ripgrep) instead of `grep`. Faster; recurses by default; respects .gitignore by default (use `-u`/`-uu` to include ignored/hidden files); searches the CWD when no path is given. NOT a clean flag-for-flag swap; some flags differ or are unneeded. Carry over fine: `-i`, `-n`, `-v`, `-l`, `-c`. WATCH OUT: `-r` is NOT recursive in rg, it means `--replace` (rg already recurses), so `rg -rn "PATTERN" dir/` silently parses as `--replace=n` and rewrites every match to the literal "n" while exiting 0. Drop the `-r`: `grep -rn PATTERN .` \u2192 `rg -n PATTERN`. And `grep --include`/`--exclude` become `rg -g GLOB`/`-g !GLOB`.',fires:(Q)=>Q.head==="grep"||Q.head==="egrep"||Q.head==="fgrep"},{rule:"rg-r-is-replace",action:"warn",message:'STOP \u2014 your rg output is probably mangled. `-r` in rg means `--replace`, NOT recursive, so any `-r{X}` flag combo silently rewrites every match to the literal string "{X}" and exits 0 with no error. ripgrep is always recursive by default \u2014 there is no `-r` for recursion. If you want to search: drop the `-r` entirely (`rg -rn PATTERN` \u2192 `rg -n PATTERN`). If you genuinely want text substitution: use `--replace` explicitly.',fires:(Q)=>{if(Q.head!=="rg")return!1;return Q.flags.some((X)=>X.startsWith("-")&&!X.startsWith("--")&&X.includes("r"))}},{rule:"consider-btop",action:"warn",message:"Consider `btop` instead of `top`. Better UI, more info, modern.",fires:(Q)=>Q.head==="top"},{rule:"consider-dust",action:"warn",message:"Consider `dust` instead of `du -sh`. Sorted, colorful, faster.",fires:(Q)=>Q.head==="du"},{rule:"consider-duf",action:"warn",message:"Consider `duf` instead of `df -h`. Better formatting, more readable.",fires:(Q)=>Q.head==="df"},{rule:"consider-procs",action:"warn",message:"Consider `procs` instead of `ps aux`. Better filtering and output.",fires:(Q)=>Q.head==="ps"}],bC=(Q,X)=>{if(C1(X))return v("bash-tool-policy");for(let Y of Q)for(let $ of Mt)if($.fires(Y))return $.action==="deny"?c($.rule,$.message):h6($.rule,$.message);return v("bash-tool-policy")};var wt="If this is intentional, append ` # tripwire-allow: <reason>` to the command.",Pt=new Map([["add","create"],["new","create"],["edit","update"],["set","update"],["rm","delete"],["del","delete"],["remove","delete"]]),kC=(Q)=>Pt.get(Q)??Q,yC=(Q)=>{let X=Q.lastIndexOf("/");return X===-1?Q:Q.slice(X+1)},At=(Q,X)=>Q.some((Y)=>Y===X||Y.startsWith(`${X}=`)),Ct=(Q,X)=>{for(let Y=0;Y<Q.length;Y++){let $=Q[Y];if($===X)return Q[Y+1]??"";if($.startsWith(`${X}=`))return $.slice(X.length+1)}return null},jt=(Q)=>{let X=[],Y=Q.tokens.slice(1);for(let $=0;$<Y.length;$++){let J=Y[$];if(J.startsWith("-")){if(!J.includes("=")&&Y[$+1]!==void 0&&!Y[$+1].startsWith("-"))$++;continue}X.push(J)}return X},gC=(Q,X)=>{let Y=X.pattern,$=QQ(Y);if($.length===0)return!1;let J=$[0].tokens,Z=J[0];if(Z===void 0)return!1;let G=J.slice(1);for(let W of Q){if(yC(W.head)!==yC(Z))continue;if(G.length>0){let V=jt(W);if(!G.every((q,D)=>V[D]!==void 0&&kC(V[D])===kC(q)))continue}if((X.requiresFlags??[]).some((V)=>!At(W.tokens,V)))continue;if(!(X.forbidsFlagValues??[]).every((V)=>{let _=Ct(W.tokens,V.flag);return _!==null&&V.values.includes(_)}))continue;if(G.length===0&&X.requiresFlags===void 0&&X.forbidsFlagValues===void 0)return!0;return!0}return!1},hC=(Q,X,Y,$)=>{if(C1(X))return v("config-custom");for(let J of $)if(gC(Q,J))return v("config-custom");for(let J of Y)if(gC(Q,J)){let Z=J.message.includes("tripwire-allow")?J.message:`${J.message} ${wt}`;return J.action==="ask"?G1("config-custom",Z):c("config-custom",Z)}return v("config-custom")};var mC=require("fs"),dC=(Q,X)=>{let Y=new Set(Q.split(`
|
|
85
|
-
`).map(($)=>$.trim()).filter(($)=>$.length>0));return X.split(`
|
|
86
|
-
`).filter(($)=>$.trim().length>0).filter(($)=>!Y.has($.trim()))},pC=(Q)=>{try{return mC.readFileSync(Q,"utf8")}catch{return""}};var Tt=[/\bTODO\s*:/i,/\bFIXME\s*:/i,/\bXXX\s*:/i,/\bHACK\s*:/i,/\bfor now\b/i,/\bnot implemented\b/i,/\bNotImplementedError\b/,/\btemp fix\b/i,/\bfallback\b/i,/\bplaceholder\b/i,/\bbackwards?[ -]?compat(?<ibility>ibility)?\b/i,/\bfor later\b/i,/\blater on\b/i,/\bget back to\b/i,/\bI'?ll fix\b/i,/\bto be implemented\b/i,/\bnot yet (?<state>implemented|done)\b/i,/\bstubbed\b/i],It=/\.(?<ext>ts|tsx|js|jsx|mjs|cjs|py|rs|go|rb|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|zsh|bash|lua|ex|exs|clj|scala|dart)$/i,Et=/(?<prefix>^|\/)(?<dir>__tests__|tests?|spec|fixtures?|mocks?|__mocks__|stories)(?<suffix>\/|$)|\.(?<ext>test|spec|fixture|mock|stories)\.[^/]+$/i,St=/tripwire-allow\b/,vt=(Q)=>{if(St.test(Q))return!1;for(let X of Tt)if(X.test(Q))return!0;return!1},CK=(Q)=>{let X=Q.file_path;if(!It.test(X)||Et.test(X))return v("lazy-code");let Y="content"in Q?Q.content:Q.new_string,$="content"in Q?pC(X):Q.old_string,J=[];for(let W of dC($,Y))if(vt(W))J.push(W.slice(0,200));if(J.length===0)return v("lazy-code");let Z=J.slice(0,3).map((W)=>` \u2022 ${W}`).join(`
|
|
87
|
-
`),G=J.length>3?`
|
|
88
|
-
\u2026and ${J.length-3} more`:"";return h6("lazy-code-marker",["Heads up: line(s) you just added contain words that often signal incomplete or deferred work. The write went through \u2014 this is a flag, not a block.","",'Why this exists: AI coding agents have a strong pull toward stubbing things, deferring "for now," and shipping half-built fallbacks instead of finishing the work in the same turn. The point of this warning is to push back on that pull on every iteration. If you stubbed something out for time, finish it this turn rather than leaving deferred work for later.',"",'If the marker is genuinely permanent \u2014 a real product term ("auth fallback flow", "retry fallback chain", an HTML input placeholder, a public API field literally named "placeholder"), a logging tag, or a comment intentionally left for a human reader \u2014 no action needed. To silence the flag on subsequent edits of that line, append `tripwire-allow: <one-line reason>` (any comment syntax: `//`, `#`, `--`, etc.).',"","Flagged additions:",Z+G].join(`
|
|
89
|
-
`))};var fC=require("path");var xt=[{pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,rule:"env-file",message:".env files hold secrets that should never be sent to the model. Refuse to write or edit. If an example is needed, create .env.example with redacted placeholders."},{pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,rule:"dev-vars",message:".dev.vars holds Cloudflare/Wrangler secrets. Do not modify."},{pattern:/(?<prefix>^|\/)\.ssh\//,rule:"ssh-dir",message:"Never write into ~/.ssh/. Refuse."},{pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)(?<pub>\.pub)?$/,rule:"ssh-key",message:"SSH key file. Refuse."},{pattern:/\.(?<ext>pem|key|p12|pfx)$/i,rule:"private-key",message:"Private key file. Refuse to overwrite. If generating a new key, use a different filename and let the user review."},{pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/i,rule:"secrets-file",message:"Secrets file. Refuse."},{pattern:/(?<prefix>^|\/)\.aws\/credentials$/,rule:"aws-credentials",message:"AWS credentials file. Refuse."},{pattern:/(?<prefix>^|\/)\.netrc$/,rule:"netrc",message:".netrc holds host credentials. Refuse."}],jK=(Q)=>{let X=fC.resolve(Q.file_path);for(let Y of xt)if(Y.pattern.test(X))return c(Y.rule,Y.message);return v("path-protect")};var cC=require("child_process"),m6=require("fs"),uC=require("os"),o3=require("path"),bt="/opt/homebrew/bin/betterleaks",kt=(Q)=>{let X=new Map;for(let Y of Q)X.set(Y.RuleID,(X.get(Y.RuleID)??0)+1);return[...X.entries()].map(([Y,$])=>({rule:Y,count:$}))};var yt=(Q,X)=>{let Y=Q,$=[...X].toSorted((J,Z)=>Z.Secret.length-J.Secret.length);for(let J of $){if(J.Secret==="")continue;Y=Y.replaceAll(J.Secret,`[REDACTED:${J.RuleID}]`)}return Y},lC=(Q,X=5000)=>{if(Q.length===0)return{hits:[],redacted:Q};let Y=m6.mkdtempSync(o3.join(uC.tmpdir(),"tripwire-scan-")),$=o3.join(Y,"input"),J=o3.join(Y,"report.json");try{if(m6.writeFileSync($,Q),cC.spawnSync(bt,["detect","--no-git","--no-banner","--no-color","--report-format","json","--report-path",J,"--source",$,"--exit-code","0","--log-level","error"],{encoding:"utf8",timeout:X,maxBuffer:67108864}).error!==void 0)return{hits:[],redacted:Q};let G;try{let W=m6.readFileSync(J,"utf8"),H=JSON.parse(W||"[]");G=Array.isArray(H)?H:[]}catch{return{hits:[],redacted:Q}}if(G.length===0)return{hits:[],redacted:Q};return{hits:kt(G),redacted:yt(Q,G)}}finally{try{m6.rmSync(Y,{recursive:!0,force:!0})}catch{}}};var oC=(Q)=>{let X=LC(Q.toolName,Q.response);if(X.length===0)return v("post-secret-scrub");let{hits:Y,redacted:$}=lC(X);if(Y.length===0)return v("post-secret-scrub");let J=Y.map((Z)=>`${Z.rule}\xD7${Z.count}`).join(", ");return c("secrets-in-output",[`tripwire intercepted ${Y.length} secret pattern(s) in this tool's output (${J}). The original output was withheld so the secret never enters the model context. A redacted form is below \u2014 work from this, do not re-run the same command in a way that re-fetches the underlying secret.`,"","Redacted output:",$.slice(0,16000)+($.length>16000?`
|
|
90
|
-
\u2026[truncated]`:"")].join(`
|
|
91
|
-
`))};var rC=require("path");var gt=[{rule:"read-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/,message:".env files hold secrets that should never enter the model context. Refuse to read. If the goal is documenting required env vars, look at .env.example or describe the schema from memory."},{rule:"read-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/,message:"Refuse to read .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"read-ssh",pattern:/(?<prefix>^|\/)\.ssh\//,message:"Refuse to read files inside ~/.ssh/."},{rule:"read-ssh-key",pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)$/,message:"Refuse to read SSH private key files."},{rule:"read-private-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/i,message:"Refuse to read private-key-shaped files."},{rule:"read-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/,message:"Refuse to read ~/.aws/credentials."},{rule:"read-netrc",pattern:/(?<prefix>^|\/)\.netrc$/,message:"Refuse to read ~/.netrc (host credentials)."},{rule:"read-secrets-file",pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/i,message:"Refuse to read a file named secrets.{json,yaml,toml,env}."}],iC=(Q)=>{let X=rC.resolve(Q.file_path);for(let Y of gt)if(Y.pattern.test(X))return c(Y.rule,Y.message);return v("read-protect")};var ht=async()=>{let Q=[];for await(let X of process.stdin)Q.push(X);return Buffer.concat(Q).toString("utf8")},d6=()=>{process.stdout.write(`{"continue": true}
|
|
92
|
-
`)},mt=(Q)=>Q.turn_id!==void 0,aC=(Q,X)=>{let Y=Q.hook_event_name,$=`[tripwire:${X.rule}] ${X.message}`;if(mt(Q)){process.stdout.write(`${JSON.stringify({continue:!0,systemMessage:$})}
|
|
93
|
-
`);return}let J={hookEventName:Y,additionalContext:$};process.stdout.write(`${JSON.stringify({continue:!0,hookSpecificOutput:J})}
|
|
94
|
-
`)},nC=(Q,X)=>{let Y={hookSpecificOutput:{hookEventName:Q,permissionDecision:X.kind==="deny"?"deny":"ask",permissionDecisionReason:`[tripwire:${X.rule}] ${X.message}`}};process.stdout.write(`${JSON.stringify(Y)}
|
|
95
|
-
`)},dt=(Q)=>{let X={continue:!0,decision:"block",reason:`[tripwire:${Q.rule}] ${Q.message}`};process.stdout.write(`${JSON.stringify(X)}
|
|
96
|
-
`)},EK=(Q)=>{let X=Q.toLowerCase();if(X==="bash"||X==="exec"||X==="shell"||X==="run_command")return"Bash";if(X==="read"||X==="read_file")return"Read";if(X==="write"||X==="write_file")return"Write";if(X==="edit"||X==="edit_file"||X==="multiedit"||X==="apply_patch")return"Edit";if(X==="webfetch"||X==="web_fetch"||X==="fetch")return"WebFetch";return Q},pt=(Q,X,Y)=>w0.gen(function*(){let $=yield*w0.exit(w0.try({try:X,catch:(J)=>J}).pipe(w0.timeout(Y)));if(S8.isSuccess($))return $.value;return z7(Q,B1.pretty($.cause)),v(Q)}),sC=(Q,X,Y)=>{let $=[];if(Q==="Bash"&&OC(X)){let G=X,W=QQ(G.command);return $.push({name:"bash-deny",fn:()=>CC(W,G.command)}),$.push({name:"bash-git",fn:()=>TC(W,G.command,Y.git??{enforceConventionalCommits:!0})}),$.push({name:"bash-scoped-rm",fn:()=>SC(W,G.command,Y.safePaths??{})}),$.push({name:"bash-redirect",fn:()=>EC(W,G.command)}),$.push({name:"bash-network-install",fn:()=>IC(W,G.command)}),$.push({name:"bash-tar-explosion",fn:()=>xC(W,G.command)}),$.push({name:"bash-tool-policy",fn:()=>bC(W,G.command)}),$.push({name:"config-custom",fn:()=>hC(W,G.command,Y.blockedCommands??[],Y.allowedCommands??[])}),$}if(Q==="Read"&&NC(X)){let G=X;return $.push({name:"read-protect",fn:()=>iC(G)}),$}let J=(Q==="Edit"||Q==="MultiEdit")&&FC(X),Z=Q==="Write"&&RC(X);if(J){let G=X;$.push({name:"path-protect",fn:()=>jK(G)}),$.push({name:"lazy-code",fn:()=>CK(G)})}else if(Z){let G=X;$.push({name:"path-protect",fn:()=>jK(G)}),$.push({name:"lazy-code",fn:()=>CK(G)})}return $},tC=(Q,X)=>{if(Q==="Bash"||Q==="Read"||Q==="WebFetch")return[{name:"post-secret-scrub",fn:()=>oC({toolName:Q,response:X})}];return[]},ft=(Q,X)=>w0.gen(function*(){if(Q.length===0)return v("no-rules");let Y=[];for(let $ of Q)Y.push(yield*pt($.name,$.fn,X));return B7(Y)}),TK=(Q)=>{if(Q.length===0)return v("no-rules");return B7(Q.map((X)=>X.fn()))},IK=(Q,X=g9())=>{let Y=wK(X),$=EK(Q.tool_name??"");if(Q.hook_event_name==="PreToolUse")return TK(sC($,Q.tool_input,Y));if(Q.hook_event_name==="PostToolUse")return TK(tC($,Q.tool_response));return v("no-rules")},ct=(Q,X,Y)=>{if(X.kind==="warn"){aC(Q,X);return}d6()},ut=(Q,X,Y)=>{let $=Q.hook_event_name,J=EK(Q.tool_name??"");if($==="PreToolUse"&&J==="Bash"){ct(Q,X,Y);return}if(X.kind==="warn"){aC(Q,X);return}d6()},lt=(Q)=>`tripwire config at ${MK} failed to load, so ALL custom safety policy is inactive. Failing closed until it is fixed. Fix the JSON, then this clears on the next `+`call (the shim daemon caches config at warm \u2014 restart it there). Error: ${Q}`,ot=w0.gen(function*(){let Q=yield*UC(),X=yield*w0.promise(ht),Y=yield*w0.exit(w0.try({try:()=>JSON.parse(X),catch:(G)=>G}));if(S8.isFailure(Y)){z7("parse",B1.pretty(Y.cause)),d6();return}let $=yield*w0.exit(g.decodeUnknownEffect(zC)(Y.value));if(S8.isFailure($)){z7("decode",B1.pretty($.cause)),d6();return}let J=$.value;if(!Q.ok){if(J.hook_event_name==="PreToolUse"){nC(J.hook_event_name,c("config-error",lt(Q.error)));return}d6();return}let Z=Q.config;if(J.hook_event_name==="PreToolUse"){let G=IK(J,Z);if(G.kind==="deny"||G.kind==="ask"){nC(J.hook_event_name,G);return}ut(J,G,Z);return}if(J.hook_event_name==="PostToolUse"){let G=IK(J,Z);if(G.kind==="deny"){dt(G);return}d6();return}d6()}),rt=ot.pipe(w0.catchCause((Q)=>{return z7("dispatch-fatal",B1.pretty(Q)),d6(),w0.void}));if(require.main==module)pY.runMain(rt);})
|