scordi-extension 1.14.7 → 1.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/ClearValueFormBlock.d.ts +8 -8
- package/dist/blocks/DataExtractBlock.d.ts +2 -2
- package/dist/blocks/ElementExistsBlock.d.ts +8 -8
- package/dist/blocks/EventClickBlock.d.ts +12 -12
- package/dist/blocks/FetchApiBlock.d.ts +2 -2
- package/dist/blocks/GetAttributeValueBlock.d.ts +8 -8
- package/dist/blocks/GetElementDataBlock.d.ts +14 -14
- package/dist/blocks/GetTextBlock.d.ts +10 -10
- package/dist/blocks/GetValueFormBlock.d.ts +8 -8
- package/dist/blocks/SaveAssetsBlock.d.ts +8 -8
- package/dist/blocks/ScrollBlock.d.ts +8 -8
- package/dist/blocks/SetValueFormBlock.d.ts +8 -8
- package/dist/blocks/index.d.ts +96 -96
- package/dist/blocks/types.d.ts +25 -8
- package/dist/blocks/types.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/sdk/index.cjs +4 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +5565 -1434
- package/dist/sdk/types.d.ts +2 -2
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/src/blocks/types.ts.js +1 -0
- package/dist/vendor/vite-client.js +1 -1
- package/package.json +1 -1
package/dist/sdk/index.cjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
"use strict";var Ce=Object.defineProperty;var Se=(s,e,t)=>e in s?Ce(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var _=(s,e,t)=>Se(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class A extends Error{constructor(e,t,r){super(e),this.code=t,this.details=r,this.name="EightGError"}static extensionNotInstalled(){return new A("8G Extension is not installed or not responding","EXTENSION_NOT_FOUND")}static invalidRequest(e){return new A(`Invalid request: ${e}`,"INVALID_REQUEST")}static collectionFailed(e){return new A(`Data collection failed: ${e}`,"COLLECTION_FAILED")}static requestTimeout(){return new A("Request timeout - Extension did not respond within 30 seconds","REQUEST_TIMEOUT")}}function Oe(s){return s&&s.type==="8G_EXTENSION_RESPONSE"}class Ne{constructor(){}async checkExtension(){return new Promise((e,t)=>{const r=setTimeout(()=>{t(A.extensionNotInstalled())},5e3),a=n=>{Oe(n.data)&&(clearTimeout(r),window.removeEventListener("message",a),e(n.data))};window.addEventListener("message",a),window.postMessage({type:"8G_EXTENSION_CHECK"},"*")})}async collectWorkflow(e){return new Promise((t,r)=>{const a=`8g_wf_${Date.now()}_${Math.random()}`,n=setTimeout(()=>{r(A.requestTimeout())},6e4),i=d=>{var f,h,y,O;if(((f=d.data)==null?void 0:f.type)==="8G_COLLECT_RESPONSE"&&d.data.requestId===a){clearTimeout(n),window.removeEventListener("message",i);const T=d.data,Te=((h=T==null?void 0:T.result)==null?void 0:h.steps)??((O=(y=T==null?void 0:T.result)==null?void 0:y.result)==null?void 0:O.steps)??[];t({success:T.success,steps:Te,error:T.success?void 0:"Workflow failed",timestamp:new Date().toISOString(),targetUrl:e.targetUrl})}};window.addEventListener("message",i),window.postMessage({type:"8G_COLLECT_WORKFLOW",requestId:a,targetUrl:e.targetUrl,workflow:e.workflow,closeTabAfterCollection:e.closeTabAfterCollection!==!1,activateTab:e.activateTab===!0},"*")})}}var x;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),i={};for(const d of n)i[d]=a[d];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(x||(x={}));var re;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(re||(re={}));const u=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=s=>{switch(typeof s){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(s)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(s)?u.array:s===null?u.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?u.promise:typeof Map<"u"&&s instanceof Map?u.map:typeof Set<"u"&&s instanceof Set?u.set:typeof Date<"u"&&s instanceof Date?u.date:u.object;default:return u.unknown}},o=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class S extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let d=r,f=0;for(;f<i.path.length;){const h=i.path[f];f===i.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(t(i))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return a(this),r}static assert(e){if(!(e instanceof S))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}S.create=s=>new S(s);const X=(s,e)=>{let t;switch(s.code){case o.invalid_type:s.received===u.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case o.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,x.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(s.keys,", ")}`;break;case o.invalid_union:t="Invalid input";break;case o.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(s.options)}`;break;case o.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(s.options)}, received '${s.received}'`;break;case o.invalid_arguments:t="Invalid function arguments";break;case o.invalid_return_type:t="Invalid function return type";break;case o.invalid_date:t="Invalid date";break;case o.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:x.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case o.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case o.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case o.custom:t="Invalid input";break;case o.invalid_intersection_types:t="Intersection results could not be merged";break;case o.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case o.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(s)}return{message:t}};let Ae=X;function Re(){return Ae}const Ee=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let d="";const f=r.filter(h=>!!h).slice().reverse();for(const h of f)d=h(i,{data:e,defaultError:d}).message;return{...a,path:n,message:d}};function c(s,e){const t=Re(),r=Ee({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===X?void 0:X].filter(a=>!!a)});s.common.issues.push(r)}class b{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return m;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return b.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return m;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),D=s=>({status:"dirty",value:s}),w=s=>({status:"valid",value:s}),ae=s=>s.status==="aborted",ne=s=>s.status==="dirty",L=s=>s.status==="valid",W=s=>typeof Promise<"u"&&s instanceof Promise;var l;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class Z{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ie=(s,e)=>{if(L(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new S(s.common.issues);return this._error=t,this._error}}};function g(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,d)=>{const{message:f}=s;return i.code==="invalid_enum_value"?{message:f??d.defaultError}:typeof d.data>"u"?{message:f??r??d.defaultError}:i.code!=="invalid_type"?{message:d.defaultError}:{message:f??t??d.defaultError}},description:a}}class v{get description(){return this._def.description}_getType(e){return N(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(W(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},a=this._parseSync({data:e,path:r.path,parent:r});return ie(r,a)}"~validate"(e){var r,a;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return L(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(a=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>L(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(W(a)?a:Promise.resolve(a));return ie(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),d=()=>n.addIssue({code:o.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(d(),!1)):i?!0:(d(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new P({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return J.create(this,this._def)}or(e){return q.create([this,e],this._def)}and(e){return G.create(this,e,this._def)}transform(e){return new P({...g(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new K({...g(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new et({typeName:p.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ee({...g(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return se.create(this,e)}readonly(){return te.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ze=/^c[^\s-]{8,}$/i,Ie=/^[0-9a-z]+$/,je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Le=/^[a-z0-9_-]{21}$/i,Me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ve=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ze="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let H;const De=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ue=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Be=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,We=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ke="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ge=new RegExp(`^${ke}$`);function be(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Je(s){return new RegExp(`^${be(s)}$`)}function He(s){let e=`${ke}T${be(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xe(s,e){return!!((e==="v4"||!e)&&De.test(s)||(e==="v6"||!e)&&Be.test(s))}function Ye(s,e){if(!Me.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Qe(s,e){return!!((e==="v4"||!e)&&Ue.test(s)||(e==="v6"||!e)&&We.test(s))}class R extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.string,received:n.parsedType}),m}const r=new b;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,d=e.data.length<n.value;(i||d)&&(a=this._getOrReturnCtx(e,a),i?c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):d&&c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"email",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")H||(H=new RegExp(ze,"u")),H.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"emoji",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")$e.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"uuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")Le.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"nanoid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid2",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")je.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ulid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),c(a,{validation:"url",code:o.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"regex",code:o.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?He(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?Ge.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Je(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?Ve.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"duration",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?Xe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ip",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Ye(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"jwt",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Qe(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cidr",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?Fe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64",code:o.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?qe.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"base64url",code:o.invalid_string,message:n.message}),r.dirty()):x.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:o.invalid_string,...l.errToObj(r)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}R.create=s=>new R({checks:[],typeName:p.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});function Ke(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class M extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.number,received:n.parsedType}),m}let r;const a=new b;for(const n of this._def.checks)n.kind==="int"?x.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Ke(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_finite,message:n.message}),a.dirty()):x.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,a){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(a)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}M.create=s=>new M({checks:[],typeName:p.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class U extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let r;const a=new b;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):x.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,r,a){return new U({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:l.toString(a)}]})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}U.create=s=>new U({checks:[],typeName:p.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...g(s)});class Y extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.boolean,received:r.parsedType}),m}return w(e.data)}}Y.create=s=>new Y({typeName:p.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...g(s)});class F extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:u.date,received:n.parsedType}),m}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_date}),m}const r=new b;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):x.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}F.create=s=>new F({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:p.ZodDate,...g(s)});class de extends v{_parse(e){if(this._getType(e)!==u.symbol){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.symbol,received:r.parsedType}),m}return w(e.data)}}de.create=s=>new de({typeName:p.ZodSymbol,...g(s)});class oe extends v{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.undefined,received:r.parsedType}),m}return w(e.data)}}oe.create=s=>new oe({typeName:p.ZodUndefined,...g(s)});class ce extends v{_parse(e){if(this._getType(e)!==u.null){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.null,received:r.parsedType}),m}return w(e.data)}}ce.create=s=>new ce({typeName:p.ZodNull,...g(s)});class ue extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}}ue.create=s=>new ue({typeName:p.ZodAny,...g(s)});class le extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}}le.create=s=>new le({typeName:p.ZodUnknown,...g(s)});class I extends v{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:o.invalid_type,expected:u.never,received:t.parsedType}),m}}I.create=s=>new I({typeName:p.ZodNever,...g(s)});class fe extends v{_parse(e){if(this._getType(e)!==u.undefined){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.void,received:r.parsedType}),m}return w(e.data)}}fe.create=s=>new fe({typeName:p.ZodVoid,...g(s)});class C extends v{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return c(t,{code:o.invalid_type,expected:u.array,received:t.parsedType}),m;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,d=t.data.length<a.exactLength.value;(i||d)&&(c(t,{code:i?o.too_big:o.too_small,minimum:d?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(c(t,{code:o.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(c(t,{code:o.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,d)=>a.type._parseAsync(new Z(t,i,t.path,d)))).then(i=>b.mergeArray(r,i));const n=[...t.data].map((i,d)=>a.type._parseSync(new Z(t,i,t.path,d)));return b.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(s,e)=>new C({type:s,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...g(e)});function $(s){if(s instanceof k){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=E.create($(r))}return new k({...s._def,shape:()=>e})}else return s instanceof C?new C({...s._def,type:$(s.element)}):s instanceof E?E.create($(s.unwrap())):s instanceof z?z.create($(s.unwrap())):s instanceof j?j.create(s.items.map(e=>$(e))):s}class k extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const h=this._getOrReturnCtx(e);return c(h,{code:o.invalid_type,expected:u.object,received:h.parsedType}),m}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(const h in a.data)i.includes(h)||d.push(h);const f=[];for(const h of i){const y=n[h],O=a.data[h];f.push({key:{status:"valid",value:h},value:y._parse(new Z(a,O,a.path,h)),alwaysSet:h in a.data})}if(this._def.catchall instanceof I){const h=this._def.unknownKeys;if(h==="passthrough")for(const y of d)f.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(h==="strict")d.length>0&&(c(a,{code:o.unrecognized_keys,keys:d}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const y of d){const O=a.data[y];f.push({key:{status:"valid",value:y},value:h._parse(new Z(a,O,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const h=[];for(const y of f){const O=await y.key,T=await y.value;h.push({key:O,value:T,alwaysSet:y.alwaysSet})}return h}).then(h=>b.mergeObjectSync(r,h)):b.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,i;const a=((i=(n=this._def).errorMap)==null?void 0:i.call(n,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}extend(e){return new k({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new k({...this._def,catchall:e})}pick(e){const t={};for(const r of x.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new k({...this._def,shape:()=>t})}omit(e){const t={};for(const r of x.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new k({...this._def,shape:()=>t})}deepPartial(){return $(this)}partial(e){const t={};for(const r of x.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new k({...this._def,shape:()=>t})}required(e){const t={};for(const r of x.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof E;)n=n._def.innerType;t[r]=n}return new k({...this._def,shape:()=>t})}keyof(){return we(x.objectKeys(this.shape))}}k.create=(s,e)=>new k({shape:()=>s,unknownKeys:"strip",catchall:I.create(),typeName:p.ZodObject,...g(e)});k.strictCreate=(s,e)=>new k({shape:()=>s,unknownKeys:"strict",catchall:I.create(),typeName:p.ZodObject,...g(e)});k.lazycreate=(s,e)=>new k({shape:s,unknownKeys:"strip",catchall:I.create(),typeName:p.ZodObject,...g(e)});class q extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const d of n)if(d.result.status==="valid")return d.result;for(const d of n)if(d.result.status==="dirty")return t.common.issues.push(...d.ctx.common.issues),d.result;const i=n.map(d=>new S(d.ctx.common.issues));return c(t,{code:o.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const f of r){const h={...t,common:{...t.common,issues:[]},parent:null},y=f._parseSync({data:t.data,path:t.path,parent:h});if(y.status==="valid")return y;y.status==="dirty"&&!n&&(n={result:y,ctx:h}),h.common.issues.length&&i.push(h.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const d=i.map(f=>new S(f));return c(t,{code:o.invalid_union,unionErrors:d}),m}}get options(){return this._def.options}}q.create=(s,e)=>new q({options:s,typeName:p.ZodUnion,...g(e)});function Q(s,e){const t=N(s),r=N(e);if(s===e)return{valid:!0,data:s};if(t===u.object&&r===u.object){const a=x.objectKeys(e),n=x.objectKeys(s).filter(d=>a.indexOf(d)!==-1),i={...s,...e};for(const d of n){const f=Q(s[d],e[d]);if(!f.valid)return{valid:!1};i[d]=f.data}return{valid:!0,data:i}}else if(t===u.array&&r===u.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<s.length;n++){const i=s[n],d=e[n],f=Q(i,d);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return t===u.date&&r===u.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class G extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(n,i)=>{if(ae(n)||ae(i))return m;const d=Q(n.value,i.value);return d.valid?((ne(n)||ne(i))&&t.dirty(),{status:t.value,value:d.data}):(c(r,{code:o.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}G.create=(s,e,t)=>new G({left:s,right:e,typeName:p.ZodIntersection,...g(t)});class j extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return c(r,{code:o.invalid_type,expected:u.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return c(r,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(c(r,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,d)=>{const f=this._def.items[d]||this._def.rest;return f?f._parse(new Z(r,i,r.path,d)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>b.mergeArray(t,i)):b.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new j({...this._def,rest:e})}}j.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:s,typeName:p.ZodTuple,rest:null,...g(e)})};class he extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.map)return c(r,{code:o.invalid_type,expected:u.map,received:r.parsedType}),m;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([d,f],h)=>({key:a._parse(new Z(r,d,r.path,[h,"key"])),value:n._parse(new Z(r,f,r.path,[h,"value"]))}));if(r.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of i){const h=await f.key,y=await f.value;if(h.status==="aborted"||y.status==="aborted")return m;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),d.set(h.value,y.value)}return{status:t.value,value:d}})}else{const d=new Map;for(const f of i){const h=f.key,y=f.value;if(h.status==="aborted"||y.status==="aborted")return m;(h.status==="dirty"||y.status==="dirty")&&t.dirty(),d.set(h.value,y.value)}return{status:t.value,value:d}}}}he.create=(s,e,t)=>new he({valueType:e,keyType:s,typeName:p.ZodMap,...g(t)});class B extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return c(r,{code:o.invalid_type,expected:u.set,received:r.parsedType}),m;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(c(r,{code:o.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(c(r,{code:o.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(f){const h=new Set;for(const y of f){if(y.status==="aborted")return m;y.status==="dirty"&&t.dirty(),h.add(y.value)}return{status:t.value,value:h}}const d=[...r.data.values()].map((f,h)=>n._parse(new Z(r,f,r.path,h)));return r.common.async?Promise.all(d).then(f=>i(f)):i(d)}min(e,t){return new B({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new B({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}B.create=(s,e)=>new B({valueType:s,minSize:null,maxSize:null,typeName:p.ZodSet,...g(e)});class me extends v{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}me.create=(s,e)=>new me({getter:s,typeName:p.ZodLazy,...g(e)});class pe extends v{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}pe.create=(s,e)=>new pe({value:s,typeName:p.ZodLiteral,...g(e)});function we(s,e){return new V({values:s,typeName:p.ZodEnum,...g(e)})}class V extends v{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{expected:x.joinValues(r),received:t.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return c(t,{received:t.data,code:o.invalid_enum_value,options:r}),m}return w(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}V.create=we;class _e extends v{_parse(e){const t=x.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==u.string&&r.parsedType!==u.number){const a=x.objectValues(t);return c(r,{expected:x.joinValues(a),received:r.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=x.objectValues(t);return c(r,{received:r.data,code:o.invalid_enum_value,options:a}),m}return w(e.data)}get enum(){return this._def.values}}_e.create=(s,e)=>new _e({values:s,typeName:p.ZodNativeEnum,...g(e)});class J extends v{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:o.invalid_type,expected:u.promise,received:t.parsedType}),m;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return w(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}J.create=(s,e)=>new J({type:s,typeName:p.ZodPromise,...g(e)});class P extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{c(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async d=>{if(t.value==="aborted")return m;const f=await this._def.schema._parseAsync({data:d,path:r.path,parent:r});return f.status==="aborted"?m:f.status==="dirty"||t.value==="dirty"?D(f.value):f});{if(t.value==="aborted")return m;const d=this._def.schema._parseSync({data:i,path:r.path,parent:r});return d.status==="aborted"?m:d.status==="dirty"||t.value==="dirty"?D(d.value):d}}if(a.type==="refinement"){const i=d=>{const f=a.refinement(d,n);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(r.common.async===!1){const d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value),{status:t.value,value:d.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>d.status==="aborted"?m:(d.status==="dirty"&&t.dirty(),i(d.value).then(()=>({status:t.value,value:d.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!L(i))return m;const d=a.transform(i.value,n);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:d}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>L(i)?Promise.resolve(a.transform(i.value,n)).then(d=>({status:t.value,value:d})):m);x.assertNever(a)}}P.create=(s,e,t)=>new P({schema:s,typeName:p.ZodEffects,effect:e,...g(t)});P.createWithPreprocess=(s,e,t)=>new P({schema:e,effect:{type:"preprocess",transform:s},typeName:p.ZodEffects,...g(t)});class E extends v{_parse(e){return this._getType(e)===u.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}E.create=(s,e)=>new E({innerType:s,typeName:p.ZodOptional,...g(e)});class z extends v{_parse(e){return this._getType(e)===u.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}z.create=(s,e)=>new z({innerType:s,typeName:p.ZodNullable,...g(e)});class K extends v{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}K.create=(s,e)=>new K({innerType:s,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ee extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return W(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new S(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new S(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ee.create=(s,e)=>new ee({innerType:s,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class ge extends v{_parse(e){if(this._getType(e)!==u.nan){const r=this._getOrReturnCtx(e);return c(r,{code:o.invalid_type,expected:u.nan,received:r.parsedType}),m}return{status:"valid",value:e.data}}}ge.create=s=>new ge({typeName:p.ZodNaN,...g(s)});class et extends v{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class se extends v{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),D(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new se({in:e,out:t,typeName:p.ZodPipeline})}}class te extends v{_parse(e){const t=this._def.innerType._parse(e),r=a=>(L(a)&&(a.value=Object.freeze(a.value)),a);return W(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}te.create=(s,e)=>new te({innerType:s,typeName:p.ZodReadonly,...g(e)});var p;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(p||(p={}));const ye=R.create,tt=M.create,ve=Y.create;I.create;C.create;const xe=k.create;q.create;G.create;j.create;const st=V.create;J.create;E.create;z.create;const rt=xe({name:ye(),selector:ye(),findBy:st(["cssSelector","xpath"]),option:xe({waitForSelector:ve().optional(),waitSelectorTimeout:tt().optional(),multiple:ve().optional()})});class at{constructor(){_(this,"expr");_(this,"json")}}class nt{constructor(){_(this,"template");_(this,"valueFrom");_(this,"default")}}class it{constructor(){_(this,"id");_(this,"title");_(this,"when");_(this,"block");_(this,"repeat");_(this,"next");_(this,"onSuccess");_(this,"onFailure");_(this,"switch");_(this,"timeoutMs");_(this,"retry");_(this,"delayAfterMs")}}class dt{constructor(){_(this,"version");_(this,"id");_(this,"title");_(this,"description");_(this,"start");_(this,"steps");_(this,"vars");_(this,"defaultDelayMs")}}class ot{constructor(){_(this,"stepId");_(this,"skipped");_(this,"success");_(this,"message");_(this,"result");_(this,"startedAt");_(this,"finishedAt");_(this,"attempts")}}class ct{constructor(){_(this,"success");_(this,"steps");_(this,"targetUrl");_(this,"timestamp");_(this,"error")}}exports.BaseBlockSchema=rt;exports.Binding=nt;exports.CollectWorkflowResult=ct;exports.Condition=at;exports.EightGClient=Ne;exports.EightGError=A;exports.Workflow=dt;exports.WorkflowStep=it;exports.WorkflowStepRunResult=ot;
|
|
1
|
+
"use strict";var tr=Object.defineProperty;var nr=(r,e,n)=>e in r?tr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var fe=(r,e,n)=>nr(r,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class At extends Error{constructor(e,n,i){super(e),this.code=n,this.details=i,this.name="EightGError"}static extensionNotInstalled(){return new At("8G Extension is not installed or not responding","EXTENSION_NOT_FOUND")}static invalidRequest(e){return new At(`Invalid request: ${e}`,"INVALID_REQUEST")}static collectionFailed(e){return new At(`Data collection failed: ${e}`,"COLLECTION_FAILED")}static requestTimeout(){return new At("Request timeout - Extension did not respond within 30 seconds","REQUEST_TIMEOUT")}}function rr(r){return r&&r.type==="8G_EXTENSION_RESPONSE"}class ar{constructor(){}async checkExtension(){return new Promise((e,n)=>{const i=setTimeout(()=>{n(At.extensionNotInstalled())},5e3),s=u=>{rr(u.data)&&(clearTimeout(i),window.removeEventListener("message",s),e(u.data))};window.addEventListener("message",s),window.postMessage({type:"8G_EXTENSION_CHECK"},"*")})}async collectWorkflow(e){return new Promise((n,i)=>{const s=`8g_wf_${Date.now()}_${Math.random()}`,u=setTimeout(()=>{i(At.requestTimeout())},6e4),f=v=>{var C,S,V,j;if(((C=v.data)==null?void 0:C.type)==="8G_COLLECT_RESPONSE"&&v.data.requestId===s){clearTimeout(u),window.removeEventListener("message",f);const x=v.data,E=((S=x==null?void 0:x.result)==null?void 0:S.steps)??((j=(V=x==null?void 0:x.result)==null?void 0:V.result)==null?void 0:j.steps)??[];n({success:x.success,steps:E,error:x.success?void 0:"Workflow failed",timestamp:new Date().toISOString(),targetUrl:e.targetUrl})}};window.addEventListener("message",f),window.postMessage({type:"8G_COLLECT_WORKFLOW",requestId:s,targetUrl:e.targetUrl,workflow:e.workflow,closeTabAfterCollection:e.closeTabAfterCollection!==!1,activateTab:e.activateTab===!0},"*")})}}var ye;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function n(s){throw new Error}r.assertNever=n,r.arrayToEnum=s=>{const u={};for(const f of s)u[f]=f;return u},r.getValidEnumValues=s=>{const u=r.objectKeys(s).filter(v=>typeof s[s[v]]!="number"),f={};for(const v of u)f[v]=s[v];return r.objectValues(f)},r.objectValues=s=>r.objectKeys(s).map(function(u){return s[u]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const u=[];for(const f in s)Object.prototype.hasOwnProperty.call(s,f)&&u.push(f);return u},r.find=(s,u)=>{for(const f of s)if(u(f))return f},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function i(s,u=" | "){return s.map(f=>typeof f=="string"?`'${f}'`:f).join(u)}r.joinValues=i,r.jsonStringifyReplacer=(s,u)=>typeof u=="bigint"?u.toString():u})(ye||(ye={}));var Cn;(function(r){r.mergeShapes=(e,n)=>({...e,...n})})(Cn||(Cn={}));const $=ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wt=r=>{switch(typeof r){case"undefined":return $.undefined;case"string":return $.string;case"number":return Number.isNaN(r)?$.nan:$.number;case"boolean":return $.boolean;case"function":return $.function;case"bigint":return $.bigint;case"symbol":return $.symbol;case"object":return Array.isArray(r)?$.array:r===null?$.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?$.promise:typeof Map<"u"&&r instanceof Map?$.map:typeof Set<"u"&&r instanceof Set?$.set:typeof Date<"u"&&r instanceof Date?$.date:$.object;default:return $.unknown}},O=ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ir=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class rt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(u){return u.message},i={_errors:[]},s=u=>{for(const f of u.issues)if(f.code==="invalid_union")f.unionErrors.map(s);else if(f.code==="invalid_return_type")s(f.returnTypeError);else if(f.code==="invalid_arguments")s(f.argumentsError);else if(f.path.length===0)i._errors.push(n(f));else{let v=i,C=0;for(;C<f.path.length;){const S=f.path[C];C===f.path.length-1?(v[S]=v[S]||{_errors:[]},v[S]._errors.push(n(f))):v[S]=v[S]||{_errors:[]},v=v[S],C++}}};return s(this),i}static assert(e){if(!(e instanceof rt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const s of this.issues)if(s.path.length>0){const u=s.path[0];n[u]=n[u]||[],n[u].push(e(s))}else i.push(e(s));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}rt.create=r=>new rt(r);const Vt=(r,e)=>{let n;switch(r.code){case O.invalid_type:r.received===$.undefined?n="Required":n=`Expected ${r.expected}, received ${r.received}`;break;case O.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(r.expected,ye.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:n=`Unrecognized key(s) in object: ${ye.joinValues(r.keys,", ")}`;break;case O.invalid_union:n="Invalid input";break;case O.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ye.joinValues(r.options)}`;break;case O.invalid_enum_value:n=`Invalid enum value. Expected ${ye.joinValues(r.options)}, received '${r.received}'`;break;case O.invalid_arguments:n="Invalid function arguments";break;case O.invalid_return_type:n="Invalid function return type";break;case O.invalid_date:n="Invalid date";break;case O.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(n=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?n=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?n=`Invalid input: must end with "${r.validation.endsWith}"`:ye.assertNever(r.validation):r.validation!=="regex"?n=`Invalid ${r.validation}`:n="Invalid";break;case O.too_small:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?n=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:n="Invalid input";break;case O.too_big:r.type==="array"?n=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?n=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?n=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?n=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?n=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:n="Invalid input";break;case O.custom:n="Invalid input";break;case O.invalid_intersection_types:n="Intersection results could not be merged";break;case O.not_multiple_of:n=`Number must be a multiple of ${r.multipleOf}`;break;case O.not_finite:n="Number must be finite";break;default:n=e.defaultError,ye.assertNever(r)}return{message:n}};let Bn=Vt;function sr(r){Bn=r}function gn(){return Bn}const bn=r=>{const{data:e,path:n,errorMaps:i,issueData:s}=r,u=[...n,...s.path||[]],f={...s,path:u};if(s.message!==void 0)return{...s,path:u,message:s.message};let v="";const C=i.filter(S=>!!S).slice().reverse();for(const S of C)v=S(f,{data:e,defaultError:v}).message;return{...s,path:u,message:v}},or=[];function F(r,e){const n=gn(),i=bn({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n,n===Vt?void 0:Vt].filter(s=>!!s)});r.common.issues.push(i)}class He{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const s of n){if(s.status==="aborted")return ee;s.status==="dirty"&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const s of n){const u=await s.key,f=await s.value;i.push({key:u,value:f})}return He.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const s of n){const{key:u,value:f}=s;if(u.status==="aborted"||f.status==="aborted")return ee;u.status==="dirty"&&e.dirty(),f.status==="dirty"&&e.dirty(),u.value!=="__proto__"&&(typeof f.value<"u"||s.alwaysSet)&&(i[u.value]=f.value)}return{status:e.value,value:i}}}const ee=Object.freeze({status:"aborted"}),Lt=r=>({status:"dirty",value:r}),Je=r=>({status:"valid",value:r}),Dn=r=>r.status==="aborted",Pn=r=>r.status==="dirty",jt=r=>r.status==="valid",Jt=r=>typeof Promise<"u"&&r instanceof Promise;var G;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(G||(G={}));class mt{constructor(e,n,i,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Zn=(r,e)=>{if(jt(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new rt(r.common.issues);return this._error=n,this._error}}};function ie(r){if(!r)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:s}=r;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(f,v)=>{const{message:C}=r;return f.code==="invalid_enum_value"?{message:C??v.defaultError}:typeof v.data>"u"?{message:C??i??v.defaultError}:f.code!=="invalid_type"?{message:v.defaultError}:{message:C??n??v.defaultError}},description:s}}class oe{get description(){return this._def.description}_getType(e){return wt(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:wt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new He,ctx:{common:e.parent.common,data:e.data,parsedType:wt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Jt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wt(e)},s=this._parseSync({data:e,path:i.path,parent:i});return Zn(i,s)}"~validate"(e){var i,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wt(e)};if(!this["~standard"].async)try{const u=this._parseSync({data:e,path:[],parent:n});return jt(u)?{value:u.value}:{issues:n.common.issues}}catch(u){(s=(i=u==null?void 0:u.message)==null?void 0:i.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(u=>jt(u)?{value:u.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wt(e)},s=this._parse({data:e,path:i.path,parent:i}),u=await(Jt(s)?s:Promise.resolve(s));return Zn(i,u)}refine(e,n){const i=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,u)=>{const f=e(s),v=()=>u.addIssue({code:O.custom,...i(s)});return typeof Promise<"u"&&f instanceof Promise?f.then(C=>C?!0:(v(),!1)):f?!0:(v(),!1)})}refinement(e,n){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof n=="function"?n(i,s):n),!1))}_refinement(e){return new lt({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return pt.create(this,this._def)}nullable(){return Ct.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ft.create(this)}promise(){return Wt.create(this,this._def)}or(e){return en.create([this,e],this._def)}and(e){return tn.create(this,e,this._def)}transform(e){return new lt({...ie(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new on({...ie(this._def),innerType:this,defaultValue:n,typeName:ne.ZodDefault})}brand(){return new Rn({typeName:ne.ZodBranded,type:this,...ie(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new un({...ie(this._def),innerType:this,catchValue:n,typeName:ne.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return fn.create(this,e)}readonly(){return cn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ur=/^c[^\s-]{8,}$/i,cr=/^[0-9a-z]+$/,fr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dr=/^[a-z0-9_-]{21}$/i,hr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Sn;const vr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,gr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,br=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,wr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wn="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",xr=new RegExp(`^${Wn}$`);function qn(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const n=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Tr(r){return new RegExp(`^${qn(r)}$`)}function Yn(r){let e=`${Wn}T${qn(r)}`;const n=[];return n.push(r.local?"Z?":"Z"),r.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ar(r,e){return!!((e==="v4"||!e)&&vr.test(r)||(e==="v6"||!e)&&br.test(r))}function Er(r,e){if(!hr.test(r))return!1;try{const[n]=r.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(i));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Sr(r,e){return!!((e==="v4"||!e)&&gr.test(r)||(e==="v6"||!e)&&wr.test(r))}class ct extends oe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$.string){const u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_type,expected:$.string,received:u.parsedType}),ee}const i=new He;let s;for(const u of this._def.checks)if(u.kind==="min")e.data.length<u.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:O.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),i.dirty());else if(u.kind==="max")e.data.length>u.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:O.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!1,message:u.message}),i.dirty());else if(u.kind==="length"){const f=e.data.length>u.value,v=e.data.length<u.value;(f||v)&&(s=this._getOrReturnCtx(e,s),f?F(s,{code:O.too_big,maximum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}):v&&F(s,{code:O.too_small,minimum:u.value,type:"string",inclusive:!0,exact:!0,message:u.message}),i.dirty())}else if(u.kind==="email")mr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"email",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="emoji")Sn||(Sn=new RegExp(yr,"u")),Sn.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"emoji",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="uuid")lr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"uuid",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="nanoid")dr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"nanoid",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="cuid")ur.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cuid",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="cuid2")cr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cuid2",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="ulid")fr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"ulid",code:O.invalid_string,message:u.message}),i.dirty());else if(u.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),F(s,{validation:"url",code:O.invalid_string,message:u.message}),i.dirty()}else u.kind==="regex"?(u.regex.lastIndex=0,u.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"regex",code:O.invalid_string,message:u.message}),i.dirty())):u.kind==="trim"?e.data=e.data.trim():u.kind==="includes"?e.data.includes(u.value,u.position)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:{includes:u.value,position:u.position},message:u.message}),i.dirty()):u.kind==="toLowerCase"?e.data=e.data.toLowerCase():u.kind==="toUpperCase"?e.data=e.data.toUpperCase():u.kind==="startsWith"?e.data.startsWith(u.value)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:{startsWith:u.value},message:u.message}),i.dirty()):u.kind==="endsWith"?e.data.endsWith(u.value)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:{endsWith:u.value},message:u.message}),i.dirty()):u.kind==="datetime"?Yn(u).test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:"datetime",message:u.message}),i.dirty()):u.kind==="date"?xr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:"date",message:u.message}),i.dirty()):u.kind==="time"?Tr(u).test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:O.invalid_string,validation:"time",message:u.message}),i.dirty()):u.kind==="duration"?pr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"duration",code:O.invalid_string,message:u.message}),i.dirty()):u.kind==="ip"?Ar(e.data,u.version)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"ip",code:O.invalid_string,message:u.message}),i.dirty()):u.kind==="jwt"?Er(e.data,u.alg)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"jwt",code:O.invalid_string,message:u.message}),i.dirty()):u.kind==="cidr"?Sr(e.data,u.version)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cidr",code:O.invalid_string,message:u.message}),i.dirty()):u.kind==="base64"?kr.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"base64",code:O.invalid_string,message:u.message}),i.dirty()):u.kind==="base64url"?_r.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"base64url",code:O.invalid_string,message:u.message}),i.dirty()):ye.assertNever(u);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(s=>e.test(s),{validation:n,code:O.invalid_string,...G.errToObj(i)})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...G.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...G.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...G.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...G.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...G.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...G.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...G.errToObj(n)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new ct({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ct({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ct.create=r=>new ct({checks:[],typeName:ne.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...ie(r)});function Or(r,e){const n=(r.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=n>i?n:i,u=Number.parseInt(r.toFixed(s).replace(".","")),f=Number.parseInt(e.toFixed(s).replace(".",""));return u%f/10**s}class Et extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==$.number){const u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_type,expected:$.number,received:u.parsedType}),ee}let i;const s=new He;for(const u of this._def.checks)u.kind==="int"?ye.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:O.invalid_type,expected:"integer",received:"float",message:u.message}),s.dirty()):u.kind==="min"?(u.inclusive?e.data<u.value:e.data<=u.value)&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.too_small,minimum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),s.dirty()):u.kind==="max"?(u.inclusive?e.data>u.value:e.data>=u.value)&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.too_big,maximum:u.value,type:"number",inclusive:u.inclusive,exact:!1,message:u.message}),s.dirty()):u.kind==="multipleOf"?Or(e.data,u.value)!==0&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.not_multiple_of,multipleOf:u.value,message:u.message}),s.dirty()):u.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),F(i,{code:O.not_finite,message:u.message}),s.dirty()):ye.assertNever(u);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,G.toString(n))}gt(e,n){return this.setLimit("min",e,!1,G.toString(n))}lte(e,n){return this.setLimit("max",e,!0,G.toString(n))}lt(e,n){return this.setLimit("max",e,!1,G.toString(n))}setLimit(e,n,i,s){return new Et({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:G.toString(s)}]})}_addCheck(e){return new Et({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ye.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Et.create=r=>new Et({checks:[],typeName:ne.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class St extends oe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==$.bigint)return this._getInvalidInput(e);let i;const s=new He;for(const u of this._def.checks)u.kind==="min"?(u.inclusive?e.data<u.value:e.data<=u.value)&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),s.dirty()):u.kind==="max"?(u.inclusive?e.data>u.value:e.data>=u.value)&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),s.dirty()):u.kind==="multipleOf"?e.data%u.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),F(i,{code:O.not_multiple_of,multipleOf:u.value,message:u.message}),s.dirty()):ye.assertNever(u);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return F(n,{code:O.invalid_type,expected:$.bigint,received:n.parsedType}),ee}gte(e,n){return this.setLimit("min",e,!0,G.toString(n))}gt(e,n){return this.setLimit("min",e,!1,G.toString(n))}lte(e,n){return this.setLimit("max",e,!0,G.toString(n))}lt(e,n){return this.setLimit("max",e,!1,G.toString(n))}setLimit(e,n,i,s){return new St({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:G.toString(s)}]})}_addCheck(e){return new St({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}St.create=r=>new St({checks:[],typeName:ne.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...ie(r)});class Xt extends oe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==$.boolean){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.boolean,received:i.parsedType}),ee}return Je(e.data)}}Xt.create=r=>new Xt({typeName:ne.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...ie(r)});class Rt extends oe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$.date){const u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_type,expected:$.date,received:u.parsedType}),ee}if(Number.isNaN(e.data.getTime())){const u=this._getOrReturnCtx(e);return F(u,{code:O.invalid_date}),ee}const i=new He;let s;for(const u of this._def.checks)u.kind==="min"?e.data.getTime()<u.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:O.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),i.dirty()):u.kind==="max"?e.data.getTime()>u.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:O.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),i.dirty()):ye.assertNever(u);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Rt({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Rt.create=r=>new Rt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:ne.ZodDate,...ie(r)});class wn extends oe{_parse(e){if(this._getType(e)!==$.symbol){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.symbol,received:i.parsedType}),ee}return Je(e.data)}}wn.create=r=>new wn({typeName:ne.ZodSymbol,...ie(r)});class Qt extends oe{_parse(e){if(this._getType(e)!==$.undefined){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.undefined,received:i.parsedType}),ee}return Je(e.data)}}Qt.create=r=>new Qt({typeName:ne.ZodUndefined,...ie(r)});class Kt extends oe{_parse(e){if(this._getType(e)!==$.null){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.null,received:i.parsedType}),ee}return Je(e.data)}}Kt.create=r=>new Kt({typeName:ne.ZodNull,...ie(r)});class Bt extends oe{constructor(){super(...arguments),this._any=!0}_parse(e){return Je(e.data)}}Bt.create=r=>new Bt({typeName:ne.ZodAny,...ie(r)});class Nt extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Je(e.data)}}Nt.create=r=>new Nt({typeName:ne.ZodUnknown,...ie(r)});class kt extends oe{_parse(e){const n=this._getOrReturnCtx(e);return F(n,{code:O.invalid_type,expected:$.never,received:n.parsedType}),ee}}kt.create=r=>new kt({typeName:ne.ZodNever,...ie(r)});class kn extends oe{_parse(e){if(this._getType(e)!==$.undefined){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.void,received:i.parsedType}),ee}return Je(e.data)}}kn.create=r=>new kn({typeName:ne.ZodVoid,...ie(r)});class ft extends oe{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),s=this._def;if(n.parsedType!==$.array)return F(n,{code:O.invalid_type,expected:$.array,received:n.parsedType}),ee;if(s.exactLength!==null){const f=n.data.length>s.exactLength.value,v=n.data.length<s.exactLength.value;(f||v)&&(F(n,{code:f?O.too_big:O.too_small,minimum:v?s.exactLength.value:void 0,maximum:f?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(F(n,{code:O.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(F(n,{code:O.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((f,v)=>s.type._parseAsync(new mt(n,f,n.path,v)))).then(f=>He.mergeArray(i,f));const u=[...n.data].map((f,v)=>s.type._parseSync(new mt(n,f,n.path,v)));return He.mergeArray(i,u)}get element(){return this._def.type}min(e,n){return new ft({...this._def,minLength:{value:e,message:G.toString(n)}})}max(e,n){return new ft({...this._def,maxLength:{value:e,message:G.toString(n)}})}length(e,n){return new ft({...this._def,exactLength:{value:e,message:G.toString(n)}})}nonempty(e){return this.min(1,e)}}ft.create=(r,e)=>new ft({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ie(e)});function $t(r){if(r instanceof Me){const e={};for(const n in r.shape){const i=r.shape[n];e[n]=pt.create($t(i))}return new Me({...r._def,shape:()=>e})}else return r instanceof ft?new ft({...r._def,type:$t(r.element)}):r instanceof pt?pt.create($t(r.unwrap())):r instanceof Ct?Ct.create($t(r.unwrap())):r instanceof yt?yt.create(r.items.map(e=>$t(e))):r}class Me extends oe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=ye.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==$.object){const S=this._getOrReturnCtx(e);return F(S,{code:O.invalid_type,expected:$.object,received:S.parsedType}),ee}const{status:i,ctx:s}=this._processInputParams(e),{shape:u,keys:f}=this._getCached(),v=[];if(!(this._def.catchall instanceof kt&&this._def.unknownKeys==="strip"))for(const S in s.data)f.includes(S)||v.push(S);const C=[];for(const S of f){const V=u[S],j=s.data[S];C.push({key:{status:"valid",value:S},value:V._parse(new mt(s,j,s.path,S)),alwaysSet:S in s.data})}if(this._def.catchall instanceof kt){const S=this._def.unknownKeys;if(S==="passthrough")for(const V of v)C.push({key:{status:"valid",value:V},value:{status:"valid",value:s.data[V]}});else if(S==="strict")v.length>0&&(F(s,{code:O.unrecognized_keys,keys:v}),i.dirty());else if(S!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const S=this._def.catchall;for(const V of v){const j=s.data[V];C.push({key:{status:"valid",value:V},value:S._parse(new mt(s,j,s.path,V)),alwaysSet:V in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const S=[];for(const V of C){const j=await V.key,x=await V.value;S.push({key:j,value:x,alwaysSet:V.alwaysSet})}return S}).then(S=>He.mergeObjectSync(i,S)):He.mergeObjectSync(i,C)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new Me({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{var u,f;const s=((f=(u=this._def).errorMap)==null?void 0:f.call(u,n,i).message)??i.defaultError;return n.code==="unrecognized_keys"?{message:G.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Me({...this._def,unknownKeys:"strip"})}passthrough(){return new Me({...this._def,unknownKeys:"passthrough"})}extend(e){return new Me({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Me({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Me({...this._def,catchall:e})}pick(e){const n={};for(const i of ye.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new Me({...this._def,shape:()=>n})}omit(e){const n={};for(const i of ye.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new Me({...this._def,shape:()=>n})}deepPartial(){return $t(this)}partial(e){const n={};for(const i of ye.objectKeys(this.shape)){const s=this.shape[i];e&&!e[i]?n[i]=s:n[i]=s.optional()}return new Me({...this._def,shape:()=>n})}required(e){const n={};for(const i of ye.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let u=this.shape[i];for(;u instanceof pt;)u=u._def.innerType;n[i]=u}return new Me({...this._def,shape:()=>n})}keyof(){return Gn(ye.objectKeys(this.shape))}}Me.create=(r,e)=>new Me({shape:()=>r,unknownKeys:"strip",catchall:kt.create(),typeName:ne.ZodObject,...ie(e)});Me.strictCreate=(r,e)=>new Me({shape:()=>r,unknownKeys:"strict",catchall:kt.create(),typeName:ne.ZodObject,...ie(e)});Me.lazycreate=(r,e)=>new Me({shape:r,unknownKeys:"strip",catchall:kt.create(),typeName:ne.ZodObject,...ie(e)});class en extends oe{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function s(u){for(const v of u)if(v.result.status==="valid")return v.result;for(const v of u)if(v.result.status==="dirty")return n.common.issues.push(...v.ctx.common.issues),v.result;const f=u.map(v=>new rt(v.ctx.common.issues));return F(n,{code:O.invalid_union,unionErrors:f}),ee}if(n.common.async)return Promise.all(i.map(async u=>{const f={...n,common:{...n.common,issues:[]},parent:null};return{result:await u._parseAsync({data:n.data,path:n.path,parent:f}),ctx:f}})).then(s);{let u;const f=[];for(const C of i){const S={...n,common:{...n.common,issues:[]},parent:null},V=C._parseSync({data:n.data,path:n.path,parent:S});if(V.status==="valid")return V;V.status==="dirty"&&!u&&(u={result:V,ctx:S}),S.common.issues.length&&f.push(S.common.issues)}if(u)return n.common.issues.push(...u.ctx.common.issues),u.result;const v=f.map(C=>new rt(C));return F(n,{code:O.invalid_union,unionErrors:v}),ee}}get options(){return this._def.options}}en.create=(r,e)=>new en({options:r,typeName:ne.ZodUnion,...ie(e)});const bt=r=>r instanceof rn?bt(r.schema):r instanceof lt?bt(r.innerType()):r instanceof an?[r.value]:r instanceof Ot?r.options:r instanceof sn?ye.objectValues(r.enum):r instanceof on?bt(r._def.innerType):r instanceof Qt?[void 0]:r instanceof Kt?[null]:r instanceof pt?[void 0,...bt(r.unwrap())]:r instanceof Ct?[null,...bt(r.unwrap())]:r instanceof Rn||r instanceof cn?bt(r.unwrap()):r instanceof un?bt(r._def.innerType):[];class En extends oe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==$.object)return F(n,{code:O.invalid_type,expected:$.object,received:n.parsedType}),ee;const i=this.discriminator,s=n.data[i],u=this.optionsMap.get(s);return u?n.common.async?u._parseAsync({data:n.data,path:n.path,parent:n}):u._parseSync({data:n.data,path:n.path,parent:n}):(F(n,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const s=new Map;for(const u of n){const f=bt(u.shape[e]);if(!f.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const v of f){if(s.has(v))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(v)}`);s.set(v,u)}}return new En({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...ie(i)})}}function Nn(r,e){const n=wt(r),i=wt(e);if(r===e)return{valid:!0,data:r};if(n===$.object&&i===$.object){const s=ye.objectKeys(e),u=ye.objectKeys(r).filter(v=>s.indexOf(v)!==-1),f={...r,...e};for(const v of u){const C=Nn(r[v],e[v]);if(!C.valid)return{valid:!1};f[v]=C.data}return{valid:!0,data:f}}else if(n===$.array&&i===$.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let u=0;u<r.length;u++){const f=r[u],v=e[u],C=Nn(f,v);if(!C.valid)return{valid:!1};s.push(C.data)}return{valid:!0,data:s}}else return n===$.date&&i===$.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class tn extends oe{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),s=(u,f)=>{if(Dn(u)||Dn(f))return ee;const v=Nn(u.value,f.value);return v.valid?((Pn(u)||Pn(f))&&n.dirty(),{status:n.value,value:v.data}):(F(i,{code:O.invalid_intersection_types}),ee)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([u,f])=>s(u,f)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}tn.create=(r,e,n)=>new tn({left:r,right:e,typeName:ne.ZodIntersection,...ie(n)});class yt extends oe{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==$.array)return F(i,{code:O.invalid_type,expected:$.array,received:i.parsedType}),ee;if(i.data.length<this._def.items.length)return F(i,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&i.data.length>this._def.items.length&&(F(i,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const u=[...i.data].map((f,v)=>{const C=this._def.items[v]||this._def.rest;return C?C._parse(new mt(i,f,i.path,v)):null}).filter(f=>!!f);return i.common.async?Promise.all(u).then(f=>He.mergeArray(n,f)):He.mergeArray(n,u)}get items(){return this._def.items}rest(e){return new yt({...this._def,rest:e})}}yt.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yt({items:r,typeName:ne.ZodTuple,rest:null,...ie(e)})};class nn extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==$.object)return F(i,{code:O.invalid_type,expected:$.object,received:i.parsedType}),ee;const s=[],u=this._def.keyType,f=this._def.valueType;for(const v in i.data)s.push({key:u._parse(new mt(i,v,i.path,v)),value:f._parse(new mt(i,i.data[v],i.path,v)),alwaysSet:v in i.data});return i.common.async?He.mergeObjectAsync(n,s):He.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof oe?new nn({keyType:e,valueType:n,typeName:ne.ZodRecord,...ie(i)}):new nn({keyType:ct.create(),valueType:e,typeName:ne.ZodRecord,...ie(n)})}}class _n extends oe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==$.map)return F(i,{code:O.invalid_type,expected:$.map,received:i.parsedType}),ee;const s=this._def.keyType,u=this._def.valueType,f=[...i.data.entries()].map(([v,C],S)=>({key:s._parse(new mt(i,v,i.path,[S,"key"])),value:u._parse(new mt(i,C,i.path,[S,"value"]))}));if(i.common.async){const v=new Map;return Promise.resolve().then(async()=>{for(const C of f){const S=await C.key,V=await C.value;if(S.status==="aborted"||V.status==="aborted")return ee;(S.status==="dirty"||V.status==="dirty")&&n.dirty(),v.set(S.value,V.value)}return{status:n.value,value:v}})}else{const v=new Map;for(const C of f){const S=C.key,V=C.value;if(S.status==="aborted"||V.status==="aborted")return ee;(S.status==="dirty"||V.status==="dirty")&&n.dirty(),v.set(S.value,V.value)}return{status:n.value,value:v}}}}_n.create=(r,e,n)=>new _n({valueType:e,keyType:r,typeName:ne.ZodMap,...ie(n)});class Mt extends oe{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==$.set)return F(i,{code:O.invalid_type,expected:$.set,received:i.parsedType}),ee;const s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(F(i,{code:O.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(F(i,{code:O.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const u=this._def.valueType;function f(C){const S=new Set;for(const V of C){if(V.status==="aborted")return ee;V.status==="dirty"&&n.dirty(),S.add(V.value)}return{status:n.value,value:S}}const v=[...i.data.values()].map((C,S)=>u._parse(new mt(i,C,i.path,S)));return i.common.async?Promise.all(v).then(C=>f(C)):f(v)}min(e,n){return new Mt({...this._def,minSize:{value:e,message:G.toString(n)}})}max(e,n){return new Mt({...this._def,maxSize:{value:e,message:G.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Mt.create=(r,e)=>new Mt({valueType:r,minSize:null,maxSize:null,typeName:ne.ZodSet,...ie(e)});class zt extends oe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==$.function)return F(n,{code:O.invalid_type,expected:$.function,received:n.parsedType}),ee;function i(v,C){return bn({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,gn(),Vt].filter(S=>!!S),issueData:{code:O.invalid_arguments,argumentsError:C}})}function s(v,C){return bn({data:v,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,gn(),Vt].filter(S=>!!S),issueData:{code:O.invalid_return_type,returnTypeError:C}})}const u={errorMap:n.common.contextualErrorMap},f=n.data;if(this._def.returns instanceof Wt){const v=this;return Je(async function(...C){const S=new rt([]),V=await v._def.args.parseAsync(C,u).catch(E=>{throw S.addIssue(i(C,E)),S}),j=await Reflect.apply(f,this,V);return await v._def.returns._def.type.parseAsync(j,u).catch(E=>{throw S.addIssue(s(j,E)),S})})}else{const v=this;return Je(function(...C){const S=v._def.args.safeParse(C,u);if(!S.success)throw new rt([i(C,S.error)]);const V=Reflect.apply(f,this,S.data),j=v._def.returns.safeParse(V,u);if(!j.success)throw new rt([s(V,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new zt({...this._def,args:yt.create(e).rest(Nt.create())})}returns(e){return new zt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new zt({args:e||yt.create([]).rest(Nt.create()),returns:n||Nt.create(),typeName:ne.ZodFunction,...ie(i)})}}class rn extends oe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}rn.create=(r,e)=>new rn({getter:r,typeName:ne.ZodLazy,...ie(e)});class an extends oe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return F(n,{received:n.data,code:O.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:e.data}}get value(){return this._def.value}}an.create=(r,e)=>new an({value:r,typeName:ne.ZodLiteral,...ie(e)});function Gn(r,e){return new Ot({values:r,typeName:ne.ZodEnum,...ie(e)})}class Ot extends oe{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return F(n,{expected:ye.joinValues(i),received:n.parsedType,code:O.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return F(n,{received:n.data,code:O.invalid_enum_value,options:i}),ee}return Je(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ot.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ot.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}Ot.create=Gn;class sn extends oe{_parse(e){const n=ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==$.string&&i.parsedType!==$.number){const s=ye.objectValues(n);return F(i,{expected:ye.joinValues(s),received:i.parsedType,code:O.invalid_type}),ee}if(this._cache||(this._cache=new Set(ye.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=ye.objectValues(n);return F(i,{received:i.data,code:O.invalid_enum_value,options:s}),ee}return Je(e.data)}get enum(){return this._def.values}}sn.create=(r,e)=>new sn({values:r,typeName:ne.ZodNativeEnum,...ie(e)});class Wt extends oe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==$.promise&&n.common.async===!1)return F(n,{code:O.invalid_type,expected:$.promise,received:n.parsedType}),ee;const i=n.parsedType===$.promise?n.data:Promise.resolve(n.data);return Je(i.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Wt.create=(r,e)=>new Wt({type:r,typeName:ne.ZodPromise,...ie(e)});class lt extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),s=this._def.effect||null,u={addIssue:f=>{F(i,f),f.fatal?n.abort():n.dirty()},get path(){return i.path}};if(u.addIssue=u.addIssue.bind(u),s.type==="preprocess"){const f=s.transform(i.data,u);if(i.common.async)return Promise.resolve(f).then(async v=>{if(n.value==="aborted")return ee;const C=await this._def.schema._parseAsync({data:v,path:i.path,parent:i});return C.status==="aborted"?ee:C.status==="dirty"||n.value==="dirty"?Lt(C.value):C});{if(n.value==="aborted")return ee;const v=this._def.schema._parseSync({data:f,path:i.path,parent:i});return v.status==="aborted"?ee:v.status==="dirty"||n.value==="dirty"?Lt(v.value):v}}if(s.type==="refinement"){const f=v=>{const C=s.refinement(v,u);if(i.common.async)return Promise.resolve(C);if(C instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return v};if(i.common.async===!1){const v=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return v.status==="aborted"?ee:(v.status==="dirty"&&n.dirty(),f(v.value),{status:n.value,value:v.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(v=>v.status==="aborted"?ee:(v.status==="dirty"&&n.dirty(),f(v.value).then(()=>({status:n.value,value:v.value}))))}if(s.type==="transform")if(i.common.async===!1){const f=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!jt(f))return ee;const v=s.transform(f.value,u);if(v instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:v}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(f=>jt(f)?Promise.resolve(s.transform(f.value,u)).then(v=>({status:n.value,value:v})):ee);ye.assertNever(s)}}lt.create=(r,e,n)=>new lt({schema:r,typeName:ne.ZodEffects,effect:e,...ie(n)});lt.createWithPreprocess=(r,e,n)=>new lt({schema:e,effect:{type:"preprocess",transform:r},typeName:ne.ZodEffects,...ie(n)});class pt extends oe{_parse(e){return this._getType(e)===$.undefined?Je(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pt.create=(r,e)=>new pt({innerType:r,typeName:ne.ZodOptional,...ie(e)});class Ct extends oe{_parse(e){return this._getType(e)===$.null?Je(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ct.create=(r,e)=>new Ct({innerType:r,typeName:ne.ZodNullable,...ie(e)});class on extends oe{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===$.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}on.create=(r,e)=>new on({innerType:r,typeName:ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ie(e)});class un extends oe{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Jt(s)?s.then(u=>({status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new rt(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}un.create=(r,e)=>new un({innerType:r,typeName:ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ie(e)});class xn extends oe{_parse(e){if(this._getType(e)!==$.nan){const i=this._getOrReturnCtx(e);return F(i,{code:O.invalid_type,expected:$.nan,received:i.parsedType}),ee}return{status:"valid",value:e.data}}}xn.create=r=>new xn({typeName:ne.ZodNaN,...ie(r)});const Cr=Symbol("zod_brand");class Rn extends oe{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class fn extends oe{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const u=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return u.status==="aborted"?ee:u.status==="dirty"?(n.dirty(),Lt(u.value)):this._def.out._parseAsync({data:u.value,path:i.path,parent:i})})();{const s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ee:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,n){return new fn({in:e,out:n,typeName:ne.ZodPipeline})}}class cn extends oe{_parse(e){const n=this._def.innerType._parse(e),i=s=>(jt(s)&&(s.value=Object.freeze(s.value)),s);return Jt(n)?n.then(s=>i(s)):i(n)}unwrap(){return this._def.innerType}}cn.create=(r,e)=>new cn({innerType:r,typeName:ne.ZodReadonly,...ie(e)});function $n(r,e){const n=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof n=="string"?{message:n}:n}function Hn(r,e={},n){return r?Bt.create().superRefine((i,s)=>{const u=r(i);if(u instanceof Promise)return u.then(f=>{if(!f){const v=$n(e,i),C=v.fatal??n??!0;s.addIssue({code:"custom",...v,fatal:C})}});if(!u){const f=$n(e,i),v=f.fatal??n??!0;s.addIssue({code:"custom",...f,fatal:v})}}):Bt.create()}const Dr={object:Me.lazycreate};var ne;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ne||(ne={}));const Pr=(r,e={message:`Input not instance of ${r.name}`})=>Hn(n=>n instanceof r,e),Tn=ct.create,Mn=Et.create,Nr=xn.create,jr=St.create,An=Xt.create,Rr=Rt.create,Mr=wn.create,Ir=Qt.create,Fr=Kt.create,Ur=Bt.create,Zr=Nt.create,$r=kt.create,Lr=kn.create,zr=ft.create,jn=Me.create,Vr=Me.strictCreate,Br=en.create,Wr=En.create,qr=tn.create,Yr=yt.create,Gr=nn.create,Hr=_n.create,Jr=Mt.create,Xr=zt.create,Qr=rn.create,Kr=an.create,Jn=Ot.create,ea=sn.create,ta=Wt.create,Ln=lt.create,na=pt.create,ra=Ct.create,aa=lt.createWithPreprocess,ia=fn.create,sa=()=>Tn().optional(),oa=()=>Mn().optional(),ua=()=>An().optional(),ca={string:(r=>ct.create({...r,coerce:!0})),number:(r=>Et.create({...r,coerce:!0})),boolean:(r=>Xt.create({...r,coerce:!0})),bigint:(r=>St.create({...r,coerce:!0})),date:(r=>Rt.create({...r,coerce:!0}))},fa=ee,A=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Cr,DIRTY:Lt,EMPTY_PATH:or,INVALID:ee,NEVER:fa,OK:Je,ParseStatus:He,Schema:oe,ZodAny:Bt,ZodArray:ft,ZodBigInt:St,ZodBoolean:Xt,ZodBranded:Rn,ZodCatch:un,ZodDate:Rt,ZodDefault:on,ZodDiscriminatedUnion:En,ZodEffects:lt,ZodEnum:Ot,ZodError:rt,get ZodFirstPartyTypeKind(){return ne},ZodFunction:zt,ZodIntersection:tn,ZodIssueCode:O,ZodLazy:rn,ZodLiteral:an,ZodMap:_n,ZodNaN:xn,ZodNativeEnum:sn,ZodNever:kt,ZodNull:Kt,ZodNullable:Ct,ZodNumber:Et,ZodObject:Me,ZodOptional:pt,ZodParsedType:$,ZodPipeline:fn,ZodPromise:Wt,ZodReadonly:cn,ZodRecord:nn,ZodSchema:oe,ZodSet:Mt,ZodString:ct,ZodSymbol:wn,ZodTransformer:lt,ZodTuple:yt,ZodType:oe,ZodUndefined:Qt,ZodUnion:en,ZodUnknown:Nt,ZodVoid:kn,addIssueToContext:F,any:Ur,array:zr,bigint:jr,boolean:An,coerce:ca,custom:Hn,date:Rr,datetimeRegex:Yn,defaultErrorMap:Vt,discriminatedUnion:Wr,effect:Ln,enum:Jn,function:Xr,getErrorMap:gn,getParsedType:wt,instanceof:Pr,intersection:qr,isAborted:Dn,isAsync:Jt,isDirty:Pn,isValid:jt,late:Dr,lazy:Qr,literal:Kr,makeIssue:bn,map:Hr,nan:Nr,nativeEnum:ea,never:$r,null:Fr,nullable:ra,number:Mn,object:jn,get objectUtil(){return Cn},oboolean:ua,onumber:oa,optional:na,ostring:sa,pipeline:ia,preprocess:aa,promise:ta,quotelessJson:ir,record:Gr,set:Jr,setErrorMap:sr,strictObject:Vr,string:Tn,symbol:Mr,transformer:Ln,tuple:Yr,undefined:Ir,union:Br,unknown:Zr,get util(){return ye},void:Lr},Symbol.toStringTag,{value:"Module"})),la=A.object({type:A.literal("object"),shape:A.record(A.string(),A.any())}),da=A.object({type:A.literal("array"),items:A.any()}),ha=A.discriminatedUnion("type",[la,da]),pa=A.object({name:A.literal("ai-parse-data"),sourceData:A.any().optional(),schemaDefinition:ha,prompt:A.string().optional(),model:A.string().optional(),apiKey:A.string().min(1,"OpenAI API key is required")}),ma=dt.extend({name:A.literal("get-text"),includeTags:A.boolean().optional(),useTextContent:A.boolean().optional(),regex:A.string().optional(),prefixText:A.string().optional(),suffixText:A.string().optional(),filterEmpty:A.boolean().optional(),scrollToCollect:A.boolean().optional(),scrollDistance:A.number().optional(),scrollWaitMs:A.number().optional(),maxScrollAttempts:A.number().optional()}),ya=dt.extend({name:A.literal("attribute-value"),attributeName:A.string()}),va=dt.extend({name:A.literal("get-value-form"),type:A.enum(["text-field","select","checkbox"]).optional()}),ga=dt.extend({name:A.literal("set-value-form"),setValue:A.string(),type:A.enum(["text-field","select","checkbox"]).optional()}),ba=dt.extend({name:A.literal("clear-value-form"),type:A.enum(["text-field","select","checkbox"]).optional()}),wa=dt.extend({name:A.literal("element-exists")}),ka=dt.extend({name:A.literal("event-click"),textFilter:A.object({text:A.union([A.string(),A.array(A.string())]),mode:A.enum(["exact","contains","startsWith","endsWith","regex"])}).optional()}),_a=A.object({name:A.literal("keypress"),key:A.string(),code:A.string().optional(),keyCode:A.number().optional(),modifiers:A.array(A.enum(["Alt","Control","Meta","Shift"])).optional()}),xa=A.object({name:A.literal("wait"),duration:A.number().min(0)}),Ta=A.object({name:A.literal("wait-for-condition"),conditions:A.object({urlPattern:A.string().optional(),elementExists:A.object({selector:A.string(),findBy:A.enum(["cssSelector","xpath"])}).optional(),cookieExists:A.string().optional(),storageKey:A.object({type:A.enum(["localStorage","sessionStorage"]),key:A.string()}).optional(),userConfirmation:A.boolean().optional(),message:A.string().optional(),buttonText:A.string().optional()}).refine(r=>r.urlPattern!==void 0||r.elementExists!==void 0||r.cookieExists!==void 0||r.storageKey!==void 0||r.userConfirmation===!0,{message:"At least one condition must be specified"}),mode:A.enum(["auto","manual","auto-or-manual"]).optional(),pollingIntervalMs:A.number().min(100).optional(),timeoutMs:A.number().min(1e3).optional(),position:A.enum(["top-left","top-right","bottom-left","bottom-right"]).optional()}),Aa=dt.extend({name:A.literal("save-assets")}),Ea=dt.extend({name:A.literal("get-element-data"),includeText:A.boolean().optional(),includeTags:A.boolean().optional(),useTextContent:A.boolean().optional(),regex:A.string().optional(),prefixText:A.string().optional(),suffixText:A.string().optional(),attributes:A.array(A.string()).optional(),includeSelector:A.boolean().optional(),includeXPath:A.boolean().optional()}),Sa=dt.extend({name:A.literal("scroll"),scrollType:A.enum(["toElement","toBottom","byDistance","untilLoaded"]).optional(),distance:A.number().optional(),behavior:A.enum(["auto","smooth"]).optional(),maxScrolls:A.number().optional(),waitAfterScroll:A.number().optional()}),Oa=A.object({name:A.literal("fetch-api"),url:A.string(),method:A.enum(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"]).optional(),headers:A.record(A.string(),A.string()).optional(),body:A.record(A.string(),A.any()).optional(),timeout:A.number().min(0).optional(),parseJson:A.boolean().optional(),returnHeaders:A.boolean().optional()});var zn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vn(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var On={exports:{}},Vn;function Ca(){return Vn||(Vn=1,(function(r,e){(function(n){r.exports=n()})(function(){return(function(){function n(i,s,u){function f(S,V){if(!s[S]){if(!i[S]){var j=typeof vn=="function"&&vn;if(!V&&j)return j(S,!0);if(v)return v(S,!0);var x=new Error("Cannot find module '"+S+"'");throw x.code="MODULE_NOT_FOUND",x}var E=s[S]={exports:{}};i[S][0].call(E.exports,function(q){var be=i[S][1][q];return f(be||q)},E,E.exports,n,i,s,u)}return s[S].exports}for(var v=typeof vn=="function"&&vn,C=0;C<u.length;C++)f(u[C]);return f}return n})()({1:[function(n,i,s){const u=n("./utils"),f=(function(){const v=u.stringToArray,C=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],S=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],V=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],j=["Thousand","Million","Billion","Trillion"];function x(g,_){var b=function(I,R,T){var M="";if(I<=19)M=(R?" and ":"")+(T?S[I]:C[I]);else if(I<100){const pe=Math.floor(I/10),ve=I%10;M=(R?" and ":"")+V[pe-2],ve>0?M+="-"+b(ve,!1,T):T&&(M=M.substring(0,M.length-1)+"ieth")}else if(I<1e3){const pe=Math.floor(I/100),ve=I%100;M=(R?", ":"")+C[pe]+" Hundred",ve>0?M+=b(ve,!0,T):T&&(M+="th")}else{var J=Math.floor(Math.log10(I)/3);J>j.length&&(J=j.length);const pe=Math.pow(10,J*3),ve=Math.floor(I/pe),H=I-ve*pe;M=(R?", ":"")+b(ve,!1,!1)+" "+j[J-1],H>0?M+=b(H,!0,T):T&&(M+="th")}return M},D=b(g,!1,_);return D}const E={};C.forEach(function(g,_){E[g.toLowerCase()]=_}),S.forEach(function(g,_){E[g.toLowerCase()]=_}),V.forEach(function(g,_){const b=g.toLowerCase();E[b]=(_+2)*10,E[b.substring(0,g.length-1)+"ieth"]=E[b]}),E.hundredth=100,j.forEach(function(g,_){const b=g.toLowerCase(),D=Math.pow(10,(_+1)*3);E[b]=D,E[b+"th"]=D});function q(g){const b=g.split(/,\s|\sand\s|[\s\\-]/).map(R=>E[R]);let D=[0];return b.forEach(R=>{if(R<100){let T=D.pop();T>=1e3&&(D.push(T),T=0),D.push(T+R)}else D.push(D.pop()*R)}),D.reduce((R,T)=>R+T,0)}const be=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],Pe={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function Ce(g){for(var _=0;_<be.length;_++){const b=be[_];if(g>=b[0])return b[1]+Ce(g-b[0])}return""}function Q(g){for(var _=0,b=1,D=g.length-1;D>=0;D--){const I=g[D],R=Pe[I];R<b?_-=R:(b=R,_+=R)}return _}function P(g,_){for(var b=[],D=_.charCodeAt(0);g>0;)b.unshift(String.fromCharCode((g-1)%26+D)),g=Math.floor((g-1)/26);return b.join("")}function ae(g,_){for(var b=_.charCodeAt(0),D=0,I=0;I<g.length;I++)D+=(g.charCodeAt(g.length-I-1)-b+1)*Math.pow(26,I);return D}function L(g,_){if(typeof g>"u")return;g=Math.floor(g);const b=we(_);return B(g,b)}const k={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},U={UPPER:"upper",LOWER:"lower",TITLE:"title"};function B(g,_){let b;const D=g<0;switch(g=Math.abs(g),_.primary){case k.LETTERS:b=P(g,_.case===U.UPPER?"A":"a");break;case k.ROMAN:b=Ce(g),_.case===U.UPPER&&(b=b.toUpperCase());break;case k.WORDS:b=x(g,_.ordinal),_.case===U.UPPER?b=b.toUpperCase():_.case===U.LOWER&&(b=b.toLowerCase());break;case k.DECIMAL:b=""+g;var I=_.mandatoryDigits-b.length;if(I>0){var R=new Array(I+1).join("0");b=R+b}if(_.zeroCode!==48&&(b=v(b).map(pe=>String.fromCodePoint(pe.codePointAt(0)+_.zeroCode-48)).join("")),_.regular){const pe=Math.floor((b.length-1)/_.groupingSeparators.position);for(let ve=pe;ve>0;ve--){const H=b.length-ve*_.groupingSeparators.position;b=b.substr(0,H)+_.groupingSeparators.character+b.substr(H)}}else _.groupingSeparators.reverse().forEach(pe=>{const ve=b.length-pe.position;b=b.substr(0,ve)+pe.character+b.substr(ve)});if(_.ordinal){var T={1:"st",2:"nd",3:"rd"},M=b[b.length-1],J=T[M];(!J||b.length>1&&b[b.length-2]==="1")&&(J="th"),b=b+J}break;case k.SEQUENCE:throw{code:"D3130",value:_.token}}return D&&(b="-"+b),b}const le=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function we(g){const _={type:"integer",primary:k.DECIMAL,case:U.LOWER,ordinal:!1};let b,D;const I=g.lastIndexOf(";");switch(I===-1?b=g:(b=g.substring(0,I),D=g.substring(I+1),D[0]==="o"&&(_.ordinal=!0)),b){case"A":_.case=U.UPPER;case"a":_.primary=k.LETTERS;break;case"I":_.case=U.UPPER;case"i":_.primary=k.ROMAN;break;case"W":_.case=U.UPPER,_.primary=k.WORDS;break;case"Ww":_.case=U.TITLE,_.primary=k.WORDS;break;case"w":_.primary=k.WORDS;break;default:{let R=null,T=0,M=0,J=[],pe=0;if(v(b).map(H=>H.codePointAt(0)).reverse().forEach(H=>{let K=!1;for(let de=0;de<le.length;de++){const Y=le[de];if(H>=Y&&H<=Y+9){if(K=!0,T++,pe++,R===null)R=Y;else if(Y!==R)throw{code:"D3131"};break}}K||(H===35?(pe++,M++):J.push({position:pe,character:String.fromCodePoint(H)}))}),T>0){_.primary=k.DECIMAL,_.zeroCode=R,_.mandatoryDigits=T,_.optionalDigits=M;const K=function(de){if(de.length===0)return 0;const Y=de[0].character;for(let Ze=1;Ze<de.length;Ze++)if(de[Ze].character!==Y)return 0;const Le=de.map(Ze=>Ze.position),it=function(Ze,qe){return qe===0?Ze:it(qe,Ze%qe)},We=Le.reduce(it);for(let Ze=1;Ze<=Le.length;Ze++)if(Le.indexOf(Ze*We)===-1)return 0;return We}(J);K>0?(_.regular=!0,_.groupingSeparators={position:K,character:J[0].character}):(_.regular=!1,_.groupingSeparators=J)}else _.primary=k.SEQUENCE,_.token=b}}return _}const xe={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function Te(g){var _=[];const b={type:"datetime",parts:_},D=function(K,de){if(de>K){let Y=g.substring(K,de);Y=Y.split("]]").join("]"),_.push({type:"literal",value:Y})}};for(var I=0,R=0;R<g.length;){if(g.charAt(R)==="["){if(g.charAt(R+1)==="["){D(I,R),_.push({type:"literal",value:"["}),R+=2,I=R;continue}if(D(I,R),I=R,R=g.indexOf("]",I),R===-1)throw{code:"D3135"};let K=g.substring(I+1,R);K=K.split(/\s+/).join("");var T={type:"marker",component:K.charAt(0)},M=K.lastIndexOf(","),J;if(M!==-1){const de=K.substring(M+1),Y=de.indexOf("-");let Le,it;const We=function(qe){if(!(typeof qe>"u"||qe==="*"))return parseInt(qe)};Y===-1?Le=de:(Le=de.substring(0,Y),it=de.substring(Y+1));const Ze={min:We(Le),max:We(it)};T.width=Ze,J=K.substring(1,M)}else J=K.substring(1);if(J.length===1)T.presentation1=J;else if(J.length>1){var pe=J.charAt(J.length-1);"atco".indexOf(pe)!==-1?(T.presentation2=pe,pe==="o"&&(T.ordinal=!0),T.presentation1=J.substring(0,J.length-1)):T.presentation1=J}else T.presentation1=xe[T.component];if(typeof T.presentation1>"u")throw{code:"D3132",value:T.component};if(T.presentation1[0]==="n")T.names=U.LOWER;else if(T.presentation1[0]==="N")T.presentation1[1]==="n"?T.names=U.TITLE:T.names=U.UPPER;else if("YMDdFWwXxHhmsf".indexOf(T.component)!==-1){var ve=T.presentation1;if(T.presentation2&&(ve+=";"+T.presentation2),T.integerFormat=we(ve),T.width&&T.width.min!==void 0&&T.integerFormat.mandatoryDigits<T.width.min&&(T.integerFormat.mandatoryDigits=T.width.min),T.component==="Y")if(T.n=-1,T.width&&T.width.max!==void 0)T.n=T.width.max,T.integerFormat.mandatoryDigits=T.n;else{var H=T.integerFormat.mandatoryDigits+T.integerFormat.optionalDigits;H>=2&&(T.n=H)}const de=_[_.length-1];de&&de.integerFormat&&(de.integerFormat.parseWidth=de.integerFormat.mandatoryDigits)}(T.component==="Z"||T.component==="z")&&(T.integerFormat=we(T.presentation1)),_.push(T),I=R+1}R++}return D(I,R),b}const me=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],je=["January","February","March","April","May","June","July","August","September","October","November","December"],Ke=1e3*60*60*24,ke=function(g){const _=Date.UTC(g.year,g.month);var b=new Date(_).getUTCDay();return b===0&&(b=7),b>4?_+(8-b)*Ke:_-(b-1)*Ke},ue=function(g,_){return{year:g,month:_,nextMonth:function(){return _===11?ue(g+1,0):ue(g,_+1)},previousMonth:function(){return _===0?ue(g-1,11):ue(g,_-1)},nextYear:function(){return ue(g+1,_)},previousYear:function(){return ue(g-1,_)}}},et=function(g,_){return(_-g)/(Ke*7)+1},re=(g,_)=>{let b;switch(_){case"Y":b=g.getUTCFullYear();break;case"M":b=g.getUTCMonth()+1;break;case"D":b=g.getUTCDate();break;case"d":{const D=Date.UTC(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate()),I=Date.UTC(g.getUTCFullYear(),0);b=(D-I)/Ke+1;break}case"F":b=g.getUTCDay(),b===0&&(b=7);break;case"W":{const D=ue(g.getUTCFullYear(),0),I=ke(D),R=Date.UTC(D.year,g.getUTCMonth(),g.getUTCDate());let T=et(I,R);if(T>52){const M=ke(D.nextYear());R>=M&&(T=1)}else if(T<1){const M=ke(D.previousYear());T=et(M,R)}b=Math.floor(T);break}case"w":{const D=ue(g.getUTCFullYear(),g.getUTCMonth()),I=ke(D),R=Date.UTC(D.year,D.month,g.getUTCDate());let T=et(I,R);if(T>4){const M=ke(D.nextMonth());R>=M&&(T=1)}else if(T<1){const M=ke(D.previousMonth());T=et(M,R)}b=Math.floor(T);break}case"X":{const D=ue(g.getUTCFullYear(),0),I=ke(D),R=ke(D.nextYear()),T=g.getTime();T<I?b=D.year-1:T>=R?b=D.year+1:b=D.year;break}case"x":{const D=ue(g.getUTCFullYear(),g.getUTCMonth()),I=ke(D),R=D.nextMonth(),T=ke(R),M=g.getTime();M<I?b=D.previousMonth().month+1:M>=T?b=R.month+1:b=D.month+1;break}case"H":b=g.getUTCHours();break;case"h":b=g.getUTCHours(),b=b%12,b===0&&(b=12);break;case"P":b=g.getUTCHours()>=12?"pm":"am";break;case"m":b=g.getUTCMinutes();break;case"s":b=g.getUTCSeconds();break;case"f":b=g.getUTCMilliseconds();break;case"Z":case"z":break;case"C":b="ISO";break;case"E":b="ISO";break}return b};let Fe=null;function at(g,_,b){var D=0,I=0;if(typeof b<"u"){const ve=parseInt(b);D=Math.floor(ve/100),I=ve%100}var R=function(ve,H){var K=re(ve,H.component);if("YMDdFWwXxHhms".indexOf(H.component)!==-1)if(H.component==="Y"&&H.n!==-1&&(K=K%Math.pow(10,H.n)),H.names){if(H.component==="M"||H.component==="x")K=je[K-1];else if(H.component==="F")K=me[K];else throw{code:"D3133",value:H.component};H.names===U.UPPER?K=K.toUpperCase():H.names===U.LOWER&&(K=K.toLowerCase()),H.width&&K.length>H.width.max&&(K=K.substring(0,H.width.max))}else K=B(K,H.integerFormat);else if(H.component==="f")K=B(K,H.integerFormat);else if(H.component==="Z"||H.component==="z"){const de=D*100+I;if(H.integerFormat.regular)K=B(de,H.integerFormat);else{const Y=H.integerFormat.mandatoryDigits;if(Y===1||Y===2)K=B(D,H.integerFormat),I!==0&&(K+=":"+L(I,"00"));else if(Y===3||Y===4)K=B(de,H.integerFormat);else throw{code:"D3134",value:Y}}de>=0&&(K="+"+K),H.component==="z"&&(K="GMT"+K),de===0&&H.presentation2==="t"&&(K="Z")}else H.component==="P"&&H.names===U.UPPER&&(K=K.toUpperCase());return K};let T;typeof _>"u"?(Fe===null&&(Fe=Te("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),T=Fe):T=Te(_);const M=(60*D+I)*60*1e3,J=new Date(g+M);let pe="";return T.parts.forEach(function(ve){ve.type==="literal"?pe+=ve.value:pe+=R(J,ve)}),pe}function l(g){var _={};if(g.type==="datetime")_.type="datetime",_.parts=g.parts.map(function(b){var D={};if(b.type==="literal")D.regex=b.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(b.component==="Z"||b.component==="z"){let R;Array.isArray(b.integerFormat.groupingSeparators)||(R=b.integerFormat.groupingSeparators),D.regex="",b.component==="z"&&(D.regex="GMT"),D.regex+="[-+][0-9]+",R&&(D.regex+=R.character+"[0-9]+"),D.parse=function(T){b.component==="z"&&(T=T.substring(3));let M=0,J=0;return R?(M=Number.parseInt(T.substring(0,T.indexOf(R.character))),J=Number.parseInt(T.substring(T.indexOf(R.character)+1))):T.length-1<=2?M=Number.parseInt(T):(M=Number.parseInt(T.substring(0,3)),J=Number.parseInt(T.substring(3))),M*60+J}}else if(b.integerFormat)D=l(b.integerFormat);else{D.regex="[a-zA-Z]+";var I={};if(b.component==="M"||b.component==="x")je.forEach(function(R,T){b.width&&b.width.max?I[R.substring(0,b.width.max)]=T+1:I[R]=T+1});else if(b.component==="F")me.forEach(function(R,T){T>0&&(b.width&&b.width.max?I[R.substring(0,b.width.max)]=T:I[R]=T)});else if(b.component==="P")I={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:b.component};D.parse=function(R){return I[R]}}return D.component=b.component,D});else{_.type="integer";const b=g.case===U.UPPER;switch(g.primary){case k.LETTERS:_.regex=b?"[A-Z]+":"[a-z]+",_.parse=function(D){return ae(D,b?"A":"a")};break;case k.ROMAN:_.regex=b?"[MDCLXVI]+":"[mdclxvi]+",_.parse=function(D){return Q(b?D:D.toUpperCase())};break;case k.WORDS:_.regex="(?:"+Object.keys(E).concat("and","[\\-, ]").join("|")+")+",_.parse=function(D){return q(D.toLowerCase())};break;case k.DECIMAL:_.regex="[0-9]",g.parseWidth?_.regex+=`{${g.parseWidth}}`:_.regex+="+",g.ordinal&&(_.regex+="(?:th|st|nd|rd)"),_.parse=function(D){let I=D;return g.ordinal&&(I=D.substring(0,D.length-2)),g.regular?I=I.split(",").join(""):g.groupingSeparators.forEach(R=>{I=I.split(R.character).join("")}),g.zeroCode!==48&&(I=I.split("").map(R=>String.fromCodePoint(R.codePointAt(0)-g.zeroCode+48)).join("")),parseInt(I)};break;case k.SEQUENCE:throw{code:"D3130",value:g.token}}}return _}function p(g,_){if(typeof g>"u")return;const b=we(_);return l(b).parse(g)}function z(g,_){const b=Te(_),D=l(b),I="^"+D.parts.map(J=>"("+J.regex+")").join("")+"$";var T=new RegExp(I,"i").exec(g);if(T!==null){const Y={};for(let Ee=1;Ee<T.length;Ee++){const o=D.parts[Ee-1];o.parse&&(Y[o.component]=o.parse(T[Ee]))}if(Object.getOwnPropertyNames(Y).length===0)return;let Le=0;const it=Ee=>{Le<<=1,Le+=Ee?1:0},We=Ee=>!(~Ee&Le)&&!!(Ee&Le);"YXMxWwdD".split("").forEach(Ee=>it(Y[Ee]));const qe=!We(161)&&We(130),vt=We(84),_t=!vt&&We(72);Le=0,"PHhmsf".split("").forEach(Ee=>it(Y[Ee]));const xt=!We(23)&&We(47),qt=(qe?"YD":vt?"XxwF":_t?"XWF":"YMD")+(xt?"Phmsf":"Hmsf"),ot=this.environment.timestamp;let It=!1,ht=!1;if(qt.split("").forEach(Ee=>{if(typeof Y[Ee]>"u")It?(Y[Ee]="MDd".indexOf(Ee)!==-1?1:0,ht=!0):Y[Ee]=re(ot,Ee);else if(It=!0,ht)throw{code:"D3136"}}),Y.M>0?Y.M-=1:Y.M=0,qe){const Ee=Date.UTC(Y.Y,0),o=(Y.d-1)*1e3*60*60*24,d=new Date(Ee+o);Y.M=d.getUTCMonth(),Y.D=d.getUTCDate()}if(vt)throw{code:"D3136"};if(_t)throw{code:"D3136"};xt&&(Y.H=Y.h===12?0:Y.h,Y.P===1&&(Y.H+=12));var M=Date.UTC(Y.Y,Y.M,Y.D,Y.H,Y.m,Y.s,Y.f);return(Y.Z||Y.z)&&(M-=(Y.Z||Y.z)*60*1e3),M}}var ce=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function Oe(g,_){if(!(typeof g>"u"))if(typeof _>"u"){if(!ce.test(g))throw{stack:new Error().stack,code:"D3110",value:g};return Date.parse(g)}else return z.call(this,g,_)}function _e(g,_,b){if(!(typeof g>"u"))return at.call(this,g,_,b)}return{formatInteger:L,parseInteger:p,fromMillis:_e,toMillis:Oe}})();i.exports=f},{"./utils":6}],2:[function(n,i,s){(function(u){(function(){var f=n("./utils");const v=(()=>{var C=f.isNumeric,S=f.isArrayOfStrings,V=f.isArrayOfNumbers,j=f.createSequence,x=f.isSequence,E=f.isFunction,q=f.isLambda,be=f.isPromise,Pe=f.getFunctionArity,Ce=f.isDeepEqual,Q=f.stringToArray;function P(t){if(!(typeof t>"u")){var a=0;return t.forEach(function(c){a+=c}),a}}function ae(t){return typeof t>"u"?0:t.length}function L(t){if(!(typeof t>"u"||t.length===0))return Math.max.apply(Math,t)}function k(t){if(!(typeof t>"u"||t.length===0))return Math.min.apply(Math,t)}function U(t){if(!(typeof t>"u"||t.length===0)){var a=0;return t.forEach(function(c){a+=c}),a/t.length}}function B(t,a=!1){if(!(typeof t>"u")){var c;if(typeof t=="string")c=t;else if(E(t))c="";else{if(typeof t=="number"&&!isFinite(t))throw{code:"D3001",value:t,stack:new Error().stack};var y=a?2:0;Array.isArray(t)&&t.outerWrapper&&(t=t[0]),c=JSON.stringify(t,function(h,w){return typeof w<"u"&&w!==null&&w.toPrecision&&C(w)?Number(w.toPrecision(15)):w&&E(w)?"":w},y)}return c}}function le(t,a,c){if(!(typeof t>"u")){var y=Q(t),h=y.length;if(h+a<0&&(a=0),typeof c<"u"){if(c<=0)return"";var w=a>=0?a+c:h+a+c;return y.slice(a,w).join("")}return y.slice(a).join("")}}function we(t,a){if(!(typeof t>"u")){var c=t.indexOf(a);return c>-1?t.substr(0,c):t}}function xe(t,a){if(!(typeof t>"u")){var c=t.indexOf(a);return c>-1?t.substr(c+a.length):t}}function Te(t){if(!(typeof t>"u"))return t.toLowerCase()}function me(t){if(!(typeof t>"u"))return t.toUpperCase()}function je(t){if(!(typeof t>"u"))return Q(t).length}function Ke(t){if(!(typeof t>"u")){var a=t.replace(/[ \t\n\r]+/gm," ");return a.charAt(0)===" "&&(a=a.substring(1)),a.charAt(a.length-1)===" "&&(a=a.substring(0,a.length-1)),a}}function ke(t,a,c){if(!(typeof t>"u")){(typeof c>"u"||c.length===0)&&(c=" ");var y;a=Math.trunc(a);var h=Math.abs(a)-je(t);if(h>0){var w=new Array(h+1).join(c);c.length>1&&(w=le(w,0,h)),a>0?y=t+w:y=w+t}else y=t;return y}}async function ue(t,a){var c=t.apply(this,[a]);if(be(c)&&(c=await c),c&&!(typeof c.start=="number"||c.end==="number"||Array.isArray(c.groups)||E(c.next)))throw{code:"T1010",stack:new Error().stack};return c}async function et(t,a){if(!(typeof t>"u")){var c;if(typeof a=="string")c=t.indexOf(a)!==-1;else{var y=await ue(a,t);c=typeof y<"u"}return c}}async function re(t,a,c){if(!(typeof t>"u")){if(c<0)throw{stack:new Error().stack,value:c,code:"D3040",index:3};var y=j();if(typeof c>"u"||c>0){var h=0,w=await ue(a,t);if(typeof w<"u")for(;typeof w<"u"&&(typeof c>"u"||h<c);)y.push({match:w.match,index:w.start,groups:w.groups}),w=await ue(w.next),h++}return y}}async function Fe(t,a,c,y){if(!(typeof t>"u")){var h=this;if(a==="")throw{code:"D3010",stack:new Error().stack,value:a,index:2};if(y<0)throw{code:"D3011",stack:new Error().stack,value:y,index:4};var w;typeof c=="string"?w=function(Ae){for(var ze="",ge=0,Ie=c.indexOf("$",ge);Ie!==-1&&ge<c.length;){ze+=c.substring(ge,Ie),ge=Ie+1;var st=c.charAt(ge);if(st==="$")ze+="$",ge++;else if(st==="0")ze+=Ae.match,ge++;else{var Ve;if(Ae.groups.length===0?Ve=1:Ve=Math.floor(Math.log(Ae.groups.length)*Math.LOG10E)+1,Ie=parseInt(c.substring(ge,ge+Ve),10),Ve>1&&Ie>Ae.groups.length&&(Ie=parseInt(c.substring(ge,ge+Ve-1),10)),isNaN(Ie))ze+="$";else{if(Ae.groups.length>0){var Ft=Ae.groups[Ie-1];typeof Ft<"u"&&(ze+=Ft)}ge+=Ie.toString().length}}Ie=c.indexOf("$",ge)}return ze+=c.substring(ge),ze}:w=c;var N="",W=0;if(typeof y>"u"||y>0){var X=0;if(typeof a=="string"){for(var Se=t.indexOf(a,W);Se!==-1&&(typeof y>"u"||X<y);)N+=t.substring(W,Se),N+=c,W=Se+a.length,X++,Se=t.indexOf(a,W);N+=t.substring(W)}else{var he=await ue(a,t);if(typeof he<"u"){for(;typeof he<"u"&&(typeof y>"u"||X<y);){N+=t.substring(W,he.start);var De=w.apply(h,[he]);if(be(De)&&(De=await De),typeof De=="string")N+=De;else throw{code:"D3012",stack:new Error().stack,value:De};W=he.start+he.match.length,X++,he=await ue(he.next)}N+=t.substring(W)}else N=t}}else N=t;return N}}function at(t){if(!(typeof t>"u")){var a=typeof window<"u"?window.btoa:function(c){return new u.Buffer.from(c,"binary").toString("base64")};return a(t)}}function l(t){if(!(typeof t>"u")){var a=typeof window<"u"?window.atob:function(c){return new u.Buffer.from(c,"base64").toString("binary")};return a(t)}}function p(t){if(!(typeof t>"u")){var a;try{a=encodeURIComponent(t)}catch{throw{code:"D3140",stack:new Error().stack,value:t,functionName:"encodeUrlComponent"}}return a}}function z(t){if(!(typeof t>"u")){var a;try{a=encodeURI(t)}catch{throw{code:"D3140",stack:new Error().stack,value:t,functionName:"encodeUrl"}}return a}}function ce(t){if(!(typeof t>"u")){var a;try{a=decodeURIComponent(t)}catch{throw{code:"D3140",stack:new Error().stack,value:t,functionName:"decodeUrlComponent"}}return a}}function Oe(t){if(!(typeof t>"u")){var a;try{a=decodeURI(t)}catch{throw{code:"D3140",stack:new Error().stack,value:t,functionName:"decodeUrl"}}return a}}async function _e(t,a,c){if(!(typeof t>"u")){if(c<0)throw{code:"D3020",stack:new Error().stack,value:c,index:3};var y=[];if(typeof c>"u"||c>0)if(typeof a=="string")y=t.split(a,c);else{var h=0,w=await ue(a,t);if(typeof w<"u"){for(var N=0;typeof w<"u"&&(typeof c>"u"||h<c);)y.push(t.substring(N,w.start)),N=w.end,w=await ue(w.next),h++;(typeof c>"u"||h<c)&&y.push(t.substring(N))}else y.push(t)}return y}}function g(t,a){if(!(typeof t>"u"))return typeof a>"u"&&(a=""),t.join(a)}function _(t,a,c){if(!(typeof t>"u")){var y={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},h=y;typeof c<"u"&&Object.keys(c).forEach(function(te){h[te]=c[te]});for(var w=[],N=h["zero-digit"].charCodeAt(0),W=N;W<N+10;W++)w.push(String.fromCharCode(W));var X=w.concat([h["decimal-separator"],h["exponent-separator"],h["grouping-separator"],h.digit,h["pattern-separator"]]),Se=a.split(h["pattern-separator"]);if(Se.length>2)throw{code:"D3080",stack:new Error().stack};var he=function(te){var Re=(function(){for(var $e,nt=0;nt<te.length;nt++)if($e=te.charAt(nt),X.indexOf($e)!==-1&&$e!==h["exponent-separator"])return te.substring(0,nt)})(),Ge=(function(){for(var $e,nt=te.length-1;nt>=0;nt--)if($e=te.charAt(nt),X.indexOf($e)!==-1&&$e!==h["exponent-separator"])return te.substring(nt+1)})(),Ne=te.substring(Re.length,te.length-Ge.length),Xe,Tt,Qe,Pt,tt=te.indexOf(h["exponent-separator"],Re.length);tt===-1||tt>te.length-Ge.length?(Xe=Ne,Tt=void 0):(Xe=Ne.substring(0,tt),Tt=Ne.substring(tt+1));var ut=Xe.indexOf(h["decimal-separator"]);return ut===-1?(Qe=Xe,Pt=Ge):(Qe=Xe.substring(0,ut),Pt=Xe.substring(ut+1)),{prefix:Re,suffix:Ge,activePart:Ne,mantissaPart:Xe,exponentPart:Tt,integerPart:Qe,fractionalPart:Pt,subpicture:te}},De=function(te){var Re,Ge,Ne=te.subpicture,Xe=Ne.indexOf(h["decimal-separator"]);Xe!==Ne.lastIndexOf(h["decimal-separator"])&&(Re="D3081"),Ne.indexOf(h.percent)!==Ne.lastIndexOf(h.percent)&&(Re="D3082"),Ne.indexOf(h["per-mille"])!==Ne.lastIndexOf(h["per-mille"])&&(Re="D3083"),Ne.indexOf(h.percent)!==-1&&Ne.indexOf(h["per-mille"])!==-1&&(Re="D3084");var Tt=!1;for(Ge=0;Ge<te.mantissaPart.length;Ge++){var Qe=te.mantissaPart.charAt(Ge);if(w.indexOf(Qe)!==-1||Qe===h.digit){Tt=!0;break}}Tt||(Re="D3085");var Pt=te.activePart.split("").map(function($e){return X.indexOf($e)===-1?"p":"a"}).join("");Pt.indexOf("p")!==-1&&(Re="D3086"),Xe!==-1?(Ne.charAt(Xe-1)===h["grouping-separator"]||Ne.charAt(Xe+1)===h["grouping-separator"])&&(Re="D3087"):te.integerPart.charAt(te.integerPart.length-1)===h["grouping-separator"]&&(Re="D3088"),Ne.indexOf(h["grouping-separator"]+h["grouping-separator"])!==-1&&(Re="D3089");var tt=te.integerPart.indexOf(h.digit);tt!==-1&&te.integerPart.substring(0,tt).split("").filter(function($e){return w.indexOf($e)>-1}).length>0&&(Re="D3090"),tt=te.fractionalPart.lastIndexOf(h.digit),tt!==-1&&te.fractionalPart.substring(tt).split("").filter(function($e){return w.indexOf($e)>-1}).length>0&&(Re="D3091");var ut=typeof te.exponentPart=="string";if(ut&&te.exponentPart.length>0&&(Ne.indexOf(h.percent)!==-1||Ne.indexOf(h["per-mille"])!==-1)&&(Re="D3092"),ut&&(te.exponentPart.length===0||te.exponentPart.split("").filter(function($e){return w.indexOf($e)===-1}).length>0)&&(Re="D3093"),Re)throw{code:Re,stack:new Error().stack}},Ae=function(te){var Re=function(Be,mn){for(var Ht=[],gt=Be.indexOf(h["grouping-separator"]);gt!==-1;){var yn=(mn?Be.substring(0,gt):Be.substring(gt)).split("").filter(function(Zt){return w.indexOf(Zt)!==-1||Zt===h.digit}).length;Ht.push(yn),gt=te.integerPart.indexOf(h["grouping-separator"],gt+1)}return Ht},Ge=Re(te.integerPart),Ne=function(Be){if(Be.length===0)return 0;for(var mn=function(yn,Zt){return Zt===0?yn:mn(Zt,yn%Zt)},Ht=Be.reduce(mn),gt=1;gt<=Be.length;gt++)if(Be.indexOf(gt*Ht)===-1)return 0;return Ht},Xe=Ne(Ge),Tt=Re(te.fractionalPart,!0),Qe=te.integerPart.split("").filter(function(Be){return w.indexOf(Be)!==-1}).length,Pt=Qe,tt=te.fractionalPart.split(""),ut=tt.filter(function(Be){return w.indexOf(Be)!==-1}).length,$e=tt.filter(function(Be){return w.indexOf(Be)!==-1||Be===h.digit}).length,nt=typeof te.exponentPart=="string";Qe===0&&$e===0&&(nt?(ut=1,$e=1):Qe=1),nt&&Qe===0&&te.integerPart.indexOf(h.digit)!==-1&&(Qe=1),Qe===0&&ut===0&&(ut=1);var Un=0;return nt&&(Un=te.exponentPart.split("").filter(function(Be){return w.indexOf(Be)!==-1}).length),{integerPartGroupingPositions:Ge,regularGrouping:Xe,minimumIntegerPartSize:Qe,scalingFactor:Pt,prefix:te.prefix,fractionalPartGroupingPositions:Tt,minimumFactionalPartSize:ut,maximumFactionalPartSize:$e,minimumExponentSize:Un,suffix:te.suffix,picture:te.subpicture}},ze=Se.map(he);ze.forEach(De);var ge=ze.map(Ae),Ie=h["minus-sign"],st=h["zero-digit"],Ve=h["decimal-separator"],Ft=h["grouping-separator"];ge.length===1&&(ge.push(JSON.parse(JSON.stringify(ge[0]))),ge[1].prefix=Ie+ge[1].prefix);var Ue;t>=0?Ue=ge[0]:Ue=ge[1];var Yt;Ue.picture.indexOf(h.percent)!==-1?Yt=t*100:Ue.picture.indexOf(h["per-mille"])!==-1?Yt=t*1e3:Yt=t;var Dt,Ut;if(Ue.minimumExponentSize===0)Dt=Yt;else{var Xn=Math.pow(10,Ue.scalingFactor),Qn=Math.pow(10,Ue.scalingFactor-1);for(Dt=Yt,Ut=0;Dt<Qn;)Dt*=10,Ut-=1;for(;Dt>Xn;)Dt/=10,Ut+=1}var Kn=M(Dt,Ue.maximumFactionalPartSize),In=function(te,Re){var Ge=Math.abs(te).toFixed(Re);return st!=="0"&&(Ge=Ge.split("").map(function(Ne){return Ne>="0"&&Ne<="9"?w[Ne.charCodeAt(0)-48]:Ne}).join("")),Ge},se=In(Kn,Ue.maximumFactionalPartSize),Ye=se.indexOf(".");for(Ye===-1?se=se+Ve:se=se.replace(".",Ve);se.charAt(0)===st;)se=se.substring(1);for(;se.charAt(se.length-1)===st;)se=se.substring(0,se.length-1);Ye=se.indexOf(Ve);var Gt=Ue.minimumIntegerPartSize-Ye,Fn=Ue.minimumFactionalPartSize-(se.length-Ye-1);if(se=(Gt>0?new Array(Gt+1).join(st):"")+se,se=se+(Fn>0?new Array(Fn+1).join(st):""),Ye=se.indexOf(Ve),Ue.regularGrouping>0)for(var er=Math.floor((Ye-1)/Ue.regularGrouping),hn=1;hn<=er;hn++)se=[se.slice(0,Ye-hn*Ue.regularGrouping),Ft,se.slice(Ye-hn*Ue.regularGrouping)].join("");else Ue.integerPartGroupingPositions.forEach(function(te){se=[se.slice(0,Ye-te),Ft,se.slice(Ye-te)].join(""),Ye++});if(Ye=se.indexOf(Ve),Ue.fractionalPartGroupingPositions.forEach(function(te){se=[se.slice(0,te+Ye+1),Ft,se.slice(te+Ye+1)].join("")}),Ye=se.indexOf(Ve),(Ue.picture.indexOf(Ve)===-1||Ye===se.length-1)&&(se=se.substring(0,se.length-1)),typeof Ut<"u"){var pn=In(Ut,0);Gt=Ue.minimumExponentSize-pn.length,Gt>0&&(pn=new Array(Gt+1).join(st)+pn),se=se+h["exponent-separator"]+(Ut<0?Ie:"")+pn}return se=Ue.prefix+se+Ue.suffix,se}}function b(t,a){if(!(typeof t>"u")){if(t=M(t),typeof a>"u"?a=10:a=M(a),a<2||a>36)throw{code:"D3100",stack:new Error().stack,value:a};var c=t.toString(a);return c}}function D(t){var a;if(!(typeof t>"u")){if(typeof t=="number")a=t;else if(typeof t=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(t)&&!isNaN(parseFloat(t))&&isFinite(t))a=parseFloat(t);else if(typeof t=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(t))a=Number(t);else if(t===!0)a=1;else if(t===!1)a=0;else throw{code:"D3030",value:t,stack:new Error().stack,index:1};return a}}function I(t){var a;if(!(typeof t>"u"))return a=Math.abs(t),a}function R(t){var a;if(!(typeof t>"u"))return a=Math.floor(t),a}function T(t){var a;if(!(typeof t>"u"))return a=Math.ceil(t),a}function M(t,a){var c;if(!(typeof t>"u")){if(a){var y=t.toString().split("e");t=+(y[0]+"e"+(y[1]?+y[1]+a:a))}c=Math.round(t);var h=c-t;return Math.abs(h)===.5&&Math.abs(c%2)===1&&(c=c-1),a&&(y=c.toString().split("e"),c=+(y[0]+"e"+(y[1]?+y[1]-a:-a))),Object.is(c,-0)&&(c=0),c}}function J(t){var a;if(!(typeof t>"u")){if(t<0)throw{stack:new Error().stack,code:"D3060",index:1,value:t};return a=Math.sqrt(t),a}}function pe(t,a){var c;if(!(typeof t>"u")){if(c=Math.pow(t,a),!isFinite(c))throw{stack:new Error().stack,code:"D3061",index:1,value:t,exp:a};return c}}function ve(){return Math.random()}function H(t){if(!(typeof t>"u")){var a=!1;if(Array.isArray(t)){if(t.length===1)a=H(t[0]);else if(t.length>1){var c=t.filter(function(y){return H(y)});a=c.length>0}}else typeof t=="string"?t.length>0&&(a=!0):C(t)?t!==0&&(a=!0):t!==null&&typeof t=="object"&&!E(t)?Object.keys(t).length>0&&(a=!0):typeof t=="boolean"&&t===!0&&(a=!0);return a}}function K(t){if(!(typeof t>"u"))return!H(t)}function de(t,a,c,y){var h=[a],w=Pe(t);return w>=2&&h.push(c),w>=3&&h.push(y),h}async function Y(t,a){if(!(typeof t>"u")){for(var c=j(),y=0;y<t.length;y++){var h=de(a,t[y],y,t),w=await a.apply(this,h);typeof w<"u"&&c.push(w)}return c}}async function Le(t,a){if(!(typeof t>"u")){for(var c=j(),y=0;y<t.length;y++){var h=t[y],w=de(a,h,y,t),N=await a.apply(this,w);H(N)&&c.push(h)}return c}}async function it(t,a){if(!(typeof t>"u")){for(var c=!1,y,h=0;h<t.length;h++){var w=t[h],N=!0;if(typeof a<"u"){var W=de(a,w,h,t),X=await a.apply(this,W);N=H(X)}if(N)if(!c)y=w,c=!0;else throw{stack:new Error().stack,code:"D3138",index:h}}if(!c)throw{stack:new Error().stack,code:"D3139"};return y}}function We(){for(var t=[],a=Array.prototype.slice.call(arguments),c=Math.min.apply(Math,a.map(function(w){return Array.isArray(w)?w.length:0})),y=0;y<c;y++){var h=a.map(w=>w[y]);t.push(h)}return t}async function Ze(t,a,c){if(!(typeof t>"u")){var y,h=Pe(a);if(h<2)throw{stack:new Error().stack,code:"D3050",index:1};var w;for(typeof c>"u"&&t.length>0?(y=t[0],w=1):(y=c,w=0);w<t.length;){var N=[y,t[w]];h>=3&&N.push(w),h>=4&&N.push(t),y=await a.apply(this,N),w++}return y}}function qe(t){var a=j();if(Array.isArray(t)){var c={};t.forEach(function(y){var h=qe(y);h.forEach(function(w){c[w]=!0})}),a=qe(c)}else t!==null&&typeof t=="object"&&!E(t)&&Object.keys(t).forEach(y=>a.push(y));return a}function vt(t,a){var c;if(Array.isArray(t)){c=j();for(var y=0;y<t.length;y++){var h=vt(t[y],a);typeof h<"u"&&(Array.isArray(h)?h.forEach(w=>c.push(w)):c.push(h))}}else t!==null&&typeof t=="object"&&!E(t)&&(c=t[a]);return c}function _t(t,a){return typeof t>"u"?a:typeof a>"u"?t:(Array.isArray(t)||(t=j(t)),Array.isArray(a)||(a=[a]),t.concat(a))}function ln(t){return!(typeof t>"u")}function xt(t){var a=j();if(Array.isArray(t))t.forEach(function(h){a=_t(a,xt(h))});else if(t!==null&&typeof t=="object"&&!q(t))for(var c in t){var y={};y[c]=t[c],a.push(y)}else a=t;return a}function Z(t){if(!(typeof t>"u")){var a={};return t.forEach(function(c){for(var y in c)a[y]=c[y]}),a}}function dn(t){if(!(typeof t>"u")){if(t.length<=1)return t;for(var a=t.length,c=new Array(a),y=0;y<a;y++)c[a-y-1]=t[y];return c}}async function qt(t,a){var c=j();for(var y in t){var h=de(a,t[y],y,t),w=await a.apply(this,h);typeof w<"u"&&c.push(w)}return c}function ot(t){throw{code:"D3137",stack:new Error().stack,message:t||"$error() function evaluated"}}function It(t,a){if(!t)throw{code:"D3141",stack:new Error().stack,message:a||"$assert() statement failed"}}function ht(t){if(t!==void 0)return t===null?"null":C(t)?"number":typeof t=="string"?"string":typeof t=="boolean"?"boolean":Array.isArray(t)?"array":E(t)?"function":"object"}async function Ee(t,a){if(!(typeof t>"u")){if(t.length<=1)return t;var c;if(typeof a>"u"){if(!V(t)&&!S(t))throw{stack:new Error().stack,code:"D3070",index:1};c=async function(N,W){return N>W}}else c=a;var y=async function(N,W){var X=async function(he,De,Ae){De.length===0?Array.prototype.push.apply(he,Ae):Ae.length===0?Array.prototype.push.apply(he,De):await c(De[0],Ae[0])?(he.push(Ae[0]),await X(he,De,Ae.slice(1))):(he.push(De[0]),await X(he,De.slice(1),Ae))},Se=[];return await X(Se,N,W),Se},h=async function(N){if(!Array.isArray(N)||N.length<=1)return N;var W=Math.floor(N.length/2),X=N.slice(0,W),Se=N.slice(W);return X=await h(X),Se=await h(Se),await y(X,Se)},w=await h(t);return w}}function o(t){if(!(typeof t>"u")){if(t.length<=1)return t;for(var a=new Array(t.length),c=0;c<t.length;c++){var y=Math.floor(Math.random()*(c+1));c!==y&&(a[c]=a[y]),a[y]=t[c]}return a}}function d(t){if(!(typeof t>"u")){if(!Array.isArray(t)||t.length<=1)return t;for(var a=x(t)?j():[],c=0;c<t.length;c++){for(var y=t[c],h=!1,w=0;w<a.length;w++)if(Ce(y,a[w])){h=!0;break}h||a.push(y)}return a}}async function m(t,a){var c={};for(var y in t){var h=t[y],w=de(a,h,y,t),N=await a.apply(this,w);H(N)&&(c[y]=h)}return Object.keys(c).length===0&&(c=void 0),c}return{sum:P,count:ae,max:L,min:k,average:U,string:B,substring:le,substringBefore:we,substringAfter:xe,lowercase:Te,uppercase:me,length:je,trim:Ke,pad:ke,match:re,contains:et,replace:Fe,split:_e,join:g,formatNumber:_,formatBase:b,number:D,floor:R,ceil:T,round:M,abs:I,sqrt:J,power:pe,random:ve,boolean:H,not:K,map:Y,zip:We,filter:Le,single:it,foldLeft:Ze,sift:m,keys:qe,lookup:vt,append:_t,exists:ln,spread:xt,merge:Z,reverse:dn,each:qt,error:ot,assert:It,type:ht,sort:Ee,shuffle:o,distinct:d,base64encode:at,base64decode:l,encodeUrlComponent:p,encodeUrl:z,decodeUrlComponent:ce,decodeUrl:Oe}})();i.exports=v}).call(this)}).call(this,typeof zn<"u"?zn:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(n,i,s){var u=n("./datetime"),f=n("./functions"),v=n("./utils"),C=n("./parser"),S=n("./signature"),V=(function(){var j=v.isNumeric,x=v.isArrayOfStrings,E=v.isArrayOfNumbers,q=v.createSequence,be=v.isSequence,Pe=v.isFunction,Ce=v.isLambda,Q=v.isIterable,P=v.isPromise,ae=v.getFunctionArity,L=v.isDeepEqual,k=ot(null);async function U(o,d,m){var t,a=m.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(a&&await a(o,d,m),o.type){case"path":t=await B(o,d,m);break;case"binary":t=await je(o,d,m);break;case"unary":t=await Ke(o,d,m);break;case"name":t=ke(o,d);break;case"string":case"number":case"value":t=ue(o);break;case"wildcard":t=et(o,d);break;case"descendant":t=Fe(o,d);break;case"parent":t=m.lookup(o.slot.label);break;case"condition":t=await R(o,d,m);break;case"block":t=await T(o,d,m);break;case"bind":t=await I(o,d,m);break;case"regex":t=M(o);break;case"function":t=await de(o,d,m);break;case"variable":t=J(o,d,m);break;case"lambda":t=it(o,d,m);break;case"partial":t=await We(o,d,m);break;case"apply":t=await K(o,d,m);break;case"transform":t=ve(o,d,m);break}if(Object.prototype.hasOwnProperty.call(o,"predicate"))for(var c=0;c<o.predicate.length;c++)t=await me(o.predicate[c].expr,t,m);o.type!=="path"&&Object.prototype.hasOwnProperty.call(o,"group")&&(t=await _(o.group,t,m));var y=m.lookup(Symbol.for("jsonata.__evaluate_exit"));return y&&await y(o,d,m,t),t&&be(t)&&!t.tupleStream&&(o.keepArray&&(t.keepSingleton=!0),t.length===0?t=void 0:t.length===1&&(t=t.keepSingleton?t:t[0])),t}async function B(o,d,m){var t;Array.isArray(d)&&o.steps[0].type!=="variable"?t=d:t=q(d);for(var a,c=!1,y=void 0,h=0;h<o.steps.length;h++){var w=o.steps[h];if(w.tuple&&(c=!0),h===0&&w.consarray?a=await U(w,t,m):c?y=await Te(w,t,y,m):a=await we(w,t,m,h===o.steps.length-1),!c&&(typeof a>"u"||a.length===0))break;typeof w.focus>"u"&&(t=a)}if(c)if(o.tuple)a=y;else for(a=q(),h=0;h<y.length;h++)a.push(y[h]["@"]);return o.keepSingletonArray&&(Array.isArray(a)&&a.cons&&!a.sequence&&(a=q(a)),a.keepSingleton=!0),o.hasOwnProperty("group")&&(a=await _(o.group,c?y:a,m)),a}function le(o,d){var m=ot(o);for(const t in d)m.bind(t,d[t]);return m}async function we(o,d,m,t){var a;if(o.type==="sort")return a=await pe(o,d,m),o.stages&&(a=await xe(o.stages,a,m)),a;a=q();for(var c=0;c<d.length;c++){var y=await U(o,d[c],m);if(o.stages)for(var h=0;h<o.stages.length;h++)y=await me(o.stages[h].expr,y,m);typeof y<"u"&&a.push(y)}var w=q();return t&&a.length===1&&Array.isArray(a[0])&&!be(a[0])?w=a[0]:a.forEach(function(N){!Array.isArray(N)||N.cons?w.push(N):N.forEach(W=>w.push(W))}),w}async function xe(o,d,m){for(var t=d,a=0;a<o.length;a++){var c=o[a];switch(c.type){case"filter":t=await me(c.expr,t,m);break;case"index":for(var y=0;y<t.length;y++){var h=t[y];h[c.value]=y}break}}return t}async function Te(o,d,m,t){var a;if(o.type==="sort"){if(m)a=await pe(o,m,t);else{var c=await pe(o,d,t);a=q(),a.tupleStream=!0;for(var y=0;y<c.length;y++){var h={"@":c[y]};h[o.index]=y,a.push(h)}}return o.stages&&(a=await xe(o.stages,a,t)),a}a=q(),a.tupleStream=!0;var w=t;m===void 0&&(m=d.map(Se=>({"@":Se})));for(var N=0;N<m.length;N++){w=le(t,m[N]);var W=await U(o,m[N]["@"],w);if(typeof W<"u"){Array.isArray(W)||(W=[W]);for(var X=0;X<W.length;X++)h={},Object.assign(h,m[N]),W.tupleStream?Object.assign(h,W[X]):(o.focus?(h[o.focus]=W[X],h["@"]=m[N]["@"]):h["@"]=W[X],o.index&&(h[o.index]=X),o.ancestor&&(h[o.ancestor.label]=m[N]["@"])),a.push(h)}}return o.stages&&(a=await xe(o.stages,a,t)),a}async function me(o,d,m){var t=q();if(d&&d.tupleStream&&(t.tupleStream=!0),Array.isArray(d)||(d=q(d)),o.type==="number"){var a=Math.floor(o.value);a<0&&(a=d.length+a);var c=await d[a];typeof c<"u"&&(Array.isArray(c)?t=c:t.push(c))}else for(a=0;a<d.length;a++){var c=d[a],y=c,h=m;d.tupleStream&&(y=c["@"],h=le(m,c));var w=await U(o,y,h);j(w)&&(w=[w]),E(w)?w.forEach(function(W){var X=Math.floor(W);X<0&&(X=d.length+X),X===a&&t.push(c)}):f.boolean(w)&&t.push(c)}return t}async function je(o,d,m){var t,a=await U(o.lhs,d,m),c=o.value,y=async()=>await U(o.rhs,d,m);if(c==="and"||c==="or")try{return await Oe(a,y,c)}catch(w){throw w.position=o.position,w.token=c,w}var h=await y();try{switch(c){case"+":case"-":case"*":case"/":case"%":t=l(a,h,c);break;case"=":case"!=":t=p(a,h,c);break;case"<":case"<=":case">":case">=":t=z(a,h,c);break;case"&":t=g(a,h);break;case"..":t=D(a,h);break;case"in":t=ce(a,h);break}}catch(w){throw w.position=o.position,w.token=c,w}return t}async function Ke(o,d,m){var t;switch(o.value){case"-":if(t=await U(o.expression,d,m),typeof t>"u")t=void 0;else if(j(t))t=-t;else throw{code:"D1002",stack:new Error().stack,position:o.position,token:o.value,value:t};break;case"[":t=[];let y=await Promise.all(o.expressions.map(async(h,w)=>(m.isParallelCall=w>0,[h,await U(h,d,m)])));for(let h of y){var[a,c]=h;typeof c<"u"&&(a.value==="["?t.push(c):t=f.append(t,c))}o.consarray&&Object.defineProperty(t,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":t=await _(o,d,m);break}return t}function ke(o,d,m){return f.lookup(d,o.value)}function ue(o){return o.value}function et(o,d){var m=q();return Array.isArray(d)&&d.outerWrapper&&d.length>0&&(d=d[0]),d!==null&&typeof d=="object"&&Object.keys(d).forEach(function(t){var a=d[t];Array.isArray(a)?(a=re(a),m=f.append(m,a)):m.push(a)}),m}function re(o,d){return typeof d>"u"&&(d=[]),Array.isArray(o)?o.forEach(function(m){re(m,d)}):d.push(o),d}function Fe(o,d){var m,t=q();return typeof d<"u"&&(at(d,t),t.length===1?m=t[0]:m=t),m}function at(o,d){Array.isArray(o)||d.push(o),Array.isArray(o)?o.forEach(function(m){at(m,d)}):o!==null&&typeof o=="object"&&Object.keys(o).forEach(function(m){at(o[m],d)})}function l(o,d,m){var t;if(typeof o<"u"&&!j(o))throw{code:"T2001",stack:new Error().stack,value:o};if(typeof d<"u"&&!j(d))throw{code:"T2002",stack:new Error().stack,value:d};if(typeof o>"u"||typeof d>"u")return t;switch(m){case"+":t=o+d;break;case"-":t=o-d;break;case"*":t=o*d;break;case"/":t=o/d;break;case"%":t=o%d;break}return t}function p(o,d,m){var t,a=typeof o,c=typeof d;if(a==="undefined"||c==="undefined")return!1;switch(m){case"=":t=L(o,d);break;case"!=":t=!L(o,d);break}return t}function z(o,d,m){var t,a=typeof o,c=typeof d,y=a==="undefined"||a==="string"||a==="number",h=c==="undefined"||c==="string"||c==="number";if(!y||!h)throw{code:"T2010",stack:new Error().stack,value:a==="string"||a==="number"?d:o};if(!(a==="undefined"||c==="undefined")){if(a!==c)throw{code:"T2009",stack:new Error().stack,value:o,value2:d};switch(m){case"<":t=o<d;break;case"<=":t=o<=d;break;case">":t=o>d;break;case">=":t=o>=d;break}return t}}function ce(o,d){var m=!1;if(typeof o>"u"||typeof d>"u")return!1;Array.isArray(d)||(d=[d]);for(var t=0;t<d.length;t++)if(d[t]===o){m=!0;break}return m}async function Oe(o,d,m){var t,a=_e(o);switch(m){case"and":t=a&&_e(await d());break;case"or":t=a||_e(await d());break}return t}function _e(o){var d=f.boolean(o);return typeof d>"u"?!1:d}function g(o,d){var m,t="",a="";return typeof o<"u"&&(t=f.string(o)),typeof d<"u"&&(a=f.string(d)),m=t.concat(a),m}async function _(o,d,m){var t={},a={},c=!!(d&&d.tupleStream);Array.isArray(d)||(d=q(d)),d.length===0&&d.push(void 0);for(var y=0;y<d.length;y++)for(var h=d[y],w=c?le(m,h):m,N=0;N<o.lhs.length;N++){var W=o.lhs[N],X=await U(W[0],c?h["@"]:h,w);if(typeof X!="string"&&X!==void 0)throw{code:"T1003",stack:new Error().stack,position:o.position,value:X};if(X!==void 0){var Se={data:h,exprIndex:N};if(a.hasOwnProperty(X)){if(a[X].exprIndex!==N)throw{code:"D1009",stack:new Error().stack,position:o.position,value:X};a[X].data=f.append(a[X].data,h)}else a[X]=Se}}let he=await Promise.all(Object.keys(a).map(async(Ae,ze)=>{let ge=a[Ae];var Ie=ge.data,st=m;if(c){var Ve=b(ge.data);Ie=Ve["@"],delete Ve["@"],st=le(m,Ve)}return m.isParallelCall=ze>0,[Ae,await U(o.lhs[ge.exprIndex][1],Ie,st)]}));for(let Ae of he){var[X,De]=await Ae;typeof De<"u"&&(t[X]=De)}return t}function b(o){if(!Array.isArray(o))return o;var d={};Object.assign(d,o[0]);for(var m=1;m<o.length;m++)for(const t in o[m])d[t]=f.append(d[t],o[m][t]);return d}function D(o,d){var m;if(typeof o<"u"&&!Number.isInteger(o))throw{code:"T2003",stack:new Error().stack,value:o};if(typeof d<"u"&&!Number.isInteger(d))throw{code:"T2004",stack:new Error().stack,value:d};if(typeof o>"u"||typeof d>"u"||o>d)return m;var t=d-o+1;if(t>1e7)throw{code:"D2014",stack:new Error().stack,value:t};m=new Array(t);for(var a=o,c=0;a<=d;a++,c++)m[c]=a;return m.sequence=!0,m}async function I(o,d,m){var t=await U(o.rhs,d,m);return m.bind(o.lhs.value,t),t}async function R(o,d,m){var t,a=await U(o.condition,d,m);return f.boolean(a)?t=await U(o.then,d,m):typeof o.else<"u"&&(t=await U(o.else,d,m)),t}async function T(o,d,m){for(var t,a=ot(m),c=0;c<o.expressions.length;c++)t=await U(o.expressions[c],d,a);return t}function M(o){var d=new Ee.RegexEngine(o.value),m=function(t,a){var c;d.lastIndex=a||0;var y=d.exec(t);if(y!==null){if(c={match:y[0],start:y.index,end:y.index+y[0].length,groups:[]},y.length>1)for(var h=1;h<y.length;h++)c.groups.push(y[h]);c.next=function(){if(!(d.lastIndex>=t.length)){var w=m(t,d.lastIndex);if(w&&w.match==="")throw{code:"D1004",stack:new Error().stack,position:o.position,value:o.value.source};return w}}}return c};return m}function J(o,d,m){var t;return o.value===""?t=d&&d.outerWrapper?d[0]:d:t=m.lookup(o.value),t}async function pe(o,d,m){var t,a=d,c=!!d.tupleStream,y=async function(w,N){for(var W=0,X=0;W===0&&X<o.terms.length;X++){var Se=o.terms[X],he=w,De=m;c&&(he=w["@"],De=le(m,w));var Ae=await U(Se.expression,he,De);he=N,De=m,c&&(he=N["@"],De=le(m,N));var ze=await U(Se.expression,he,De),ge=typeof Ae,Ie=typeof ze;if(ge==="undefined"){W=Ie==="undefined"?0:1;continue}if(Ie==="undefined"){W=-1;continue}if(!(ge==="string"||ge==="number")||!(Ie==="string"||Ie==="number"))throw{code:"T2008",stack:new Error().stack,position:o.position,value:ge==="string"||ge==="number"?ze:Ae};if(ge!==Ie)throw{code:"T2007",stack:new Error().stack,position:o.position,value:Ae,value2:ze};Ae!==ze&&(Ae<ze?W=-1:W=1,Se.descending===!0&&(W=-W))}return W===1},h={environment:m,input:d};return t=await f.sort.apply(h,[a,y]),t}function ve(o,d,m){var t=async function(a){if(!(typeof a>"u")){var c=m.lookup("clone");if(!Pe(c))throw{code:"T2013",stack:new Error().stack,position:o.position};var y=await Y(c,[a],null,m),h=await U(o.pattern,y,m);if(typeof h<"u"){Array.isArray(h)||(h=[h]);for(var w=0;w<h.length;w++){var N=h[w];if(N&&(N.isPrototypeOf(y)||N instanceof Object.constructor))throw{code:"D1010",stack:new Error().stack,position:o.position};var W=await U(o.update,N,m),X=typeof W;if(X!=="undefined"){if(X!=="object"||W===null||Array.isArray(W))throw{code:"T2011",stack:new Error().stack,position:o.update.position,value:W};for(var Se in W)N[Se]=W[Se]}if(typeof o.delete<"u"){var he=await U(o.delete,N,m);if(typeof he<"u"){var De=he;if(Array.isArray(he)||(he=[he]),!x(he))throw{code:"T2012",stack:new Error().stack,position:o.delete.position,value:De};for(var Ae=0;Ae<he.length;Ae++)typeof N=="object"&&N!==null&&delete N[he[Ae]]}}}}return y}};return Z(t,"<(oa):o>")}var H=C("function($f, $g) { function($x){ $g($f($x)) } }");async function K(o,d,m){var t,a=await U(o.lhs,d,m);if(o.rhs.type==="function")t=await de(o.rhs,d,m,{context:a});else{var c=await U(o.rhs,d,m);if(!Pe(c))throw{code:"T2006",stack:new Error().stack,position:o.position,value:c};if(Pe(a)){var y=await U(H,null,m);t=await Y(y,[a,c],null,m)}else t=await Y(c,[a],null,m)}return t}async function de(o,d,m,t){var a,c=await U(o.procedure,d,m);if(typeof c>"u"&&o.procedure.type==="path"&&m.lookup(o.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:o.position,token:o.procedure.steps[0].value};var y=[];typeof t<"u"&&y.push(t.context);for(var h=0;h<o.arguments.length;h++){const N=await U(o.arguments[h],d,m);if(Pe(N)){const W=async function(...X){return await Y(N,X,null,m)};W.arity=ae(N),y.push(W)}else y.push(N)}var w=o.procedure.type==="path"?o.procedure.steps[0].value:o.procedure.value;try{typeof c=="object"&&(c.token=w,c.position=o.position),a=await Y(c,y,d,m)}catch(N){throw N.position||(N.position=o.position),N.token||(N.token=w),N}return a}async function Y(o,d,m,t){var a;for(a=await Le(o,d,m,t);Ce(a)&&a.thunk===!0;){var c=await U(a.body.procedure,a.input,a.environment);a.body.procedure.type==="variable"&&(c.token=a.body.procedure.value),c.position=a.body.procedure.position;for(var y=[],h=0;h<a.body.arguments.length;h++)y.push(await U(a.body.arguments[h],a.input,a.environment));a=await Le(c,y,m,t)}return a}async function Le(o,d,m,t){var a;try{var c=d;if(o&&(c=Ze(o.signature,d,m)),Ce(o))a=await qe(o,c);else if(o&&o._jsonata_function===!0){var y={environment:t,input:m};a=o.implementation.apply(y,c),Q(a)&&(a=a.next().value),P(a)&&(a=await a)}else if(typeof o=="function")a=o.apply(m,c),P(a)&&(a=await a);else throw{code:"T1006",stack:new Error().stack}}catch(h){throw o&&(typeof h.token>"u"&&typeof o.token<"u"&&(h.token=o.token),h.position=o.position||h.position),h}return a}function it(o,d,m){var t={_jsonata_lambda:!0,input:d,environment:m,arguments:o.arguments,signature:o.signature,body:o.body};return o.thunk===!0&&(t.thunk=!0),t.apply=async function(a,c){return await Y(t,c,d,a?a.environment:m)},t}async function We(o,d,m){for(var t,a=[],c=0;c<o.arguments.length;c++){var y=o.arguments[c];y.type==="operator"&&y.value==="?"?a.push(y):a.push(await U(y,d,m))}var h=await U(o.procedure,d,m);if(typeof h>"u"&&o.procedure.type==="path"&&m.lookup(o.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:o.position,token:o.procedure.steps[0].value};if(Ce(h))t=vt(h,a);else if(h&&h._jsonata_function===!0)t=_t(h.implementation,a);else if(typeof h=="function")t=_t(h,a);else throw{code:"T1008",stack:new Error().stack,position:o.position,token:o.procedure.type==="path"?o.procedure.steps[0].value:o.procedure.value};return t}function Ze(o,d,m){if(typeof o>"u")return d;var t=o.validate(d,m);return t}async function qe(o,d){var m,t=ot(o.environment);return o.arguments.forEach(function(a,c){t.bind(a.value,d[c])}),typeof o.body=="function"?m=await ln(o.body,t):m=await U(o.body,o.input,t),m}function vt(o,d){var m=ot(o.environment),t=[];o.arguments.forEach(function(c,y){var h=d[y];h&&h.type==="operator"&&h.value==="?"?t.push(c):m.bind(c.value,h)});var a={_jsonata_lambda:!0,input:o.input,environment:m,arguments:t,body:o.body};return a}function _t(o,d){var m=xt(o);m=m.map(function(y){return"$"+y.trim()});var t="function("+m.join(", ")+"){ _ }",a=C(t);a.body=o;var c=vt(a,d);return c}async function ln(o,d){var m=xt(o),t=m.map(function(y){return d.lookup(y.trim())}),a={environment:d},c=o.apply(a,t);return P(c)&&(c=await c),c}function xt(o){var d=o.toString(),m=/\(([^)]*)\)/.exec(d)[1],t=m.split(",");return t}function Z(o,d){var m={_jsonata_function:!0,implementation:o};return typeof d<"u"&&(m.signature=S(d)),m}async function dn(o,d){if(!(typeof o>"u")){var m=this.input;typeof d<"u"&&(m=d,Array.isArray(m)&&!be(m)&&(m=q(m),m.outerWrapper=!0));try{var t=C(o,!1)}catch(c){throw ht(c),{stack:new Error().stack,code:"D3120",value:c.message,error:c}}try{var a=await U(t,m,this.environment)}catch(c){throw ht(c),{stack:new Error().stack,code:"D3121",value:c.message,error:c}}return a}}function qt(o){if(!(typeof o>"u"))return JSON.parse(f.string(o))}function ot(o){var d={};const m={bind:function(a,c){d[a]=c},lookup:function(a){var c;return d.hasOwnProperty(a)?c=d[a]:o&&(c=o.lookup(a)),c},timestamp:o?o.timestamp:null,async:o?o.async:!1,isParallelCall:o?o.isParallelCall:!1,global:o?o.global:{ancestry:[null]}};if(o){var t=o.lookup(Symbol.for("jsonata.__createFrame_push"));t&&t(o,m)}return m}k.bind("sum",Z(f.sum,"<a<n>:n>")),k.bind("count",Z(f.count,"<a:n>")),k.bind("max",Z(f.max,"<a<n>:n>")),k.bind("min",Z(f.min,"<a<n>:n>")),k.bind("average",Z(f.average,"<a<n>:n>")),k.bind("string",Z(f.string,"<x-b?:s>")),k.bind("substring",Z(f.substring,"<s-nn?:s>")),k.bind("substringBefore",Z(f.substringBefore,"<s-s:s>")),k.bind("substringAfter",Z(f.substringAfter,"<s-s:s>")),k.bind("lowercase",Z(f.lowercase,"<s-:s>")),k.bind("uppercase",Z(f.uppercase,"<s-:s>")),k.bind("length",Z(f.length,"<s-:n>")),k.bind("trim",Z(f.trim,"<s-:s>")),k.bind("pad",Z(f.pad,"<s-ns?:s>")),k.bind("match",Z(f.match,"<s-f<s:o>n?:a<o>>")),k.bind("contains",Z(f.contains,"<s-(sf):b>")),k.bind("replace",Z(f.replace,"<s-(sf)(sf)n?:s>")),k.bind("split",Z(f.split,"<s-(sf)n?:a<s>>")),k.bind("join",Z(f.join,"<a<s>s?:s>")),k.bind("formatNumber",Z(f.formatNumber,"<n-so?:s>")),k.bind("formatBase",Z(f.formatBase,"<n-n?:s>")),k.bind("formatInteger",Z(u.formatInteger,"<n-s:s>")),k.bind("parseInteger",Z(u.parseInteger,"<s-s:n>")),k.bind("number",Z(f.number,"<(nsb)-:n>")),k.bind("floor",Z(f.floor,"<n-:n>")),k.bind("ceil",Z(f.ceil,"<n-:n>")),k.bind("round",Z(f.round,"<n-n?:n>")),k.bind("abs",Z(f.abs,"<n-:n>")),k.bind("sqrt",Z(f.sqrt,"<n-:n>")),k.bind("power",Z(f.power,"<n-n:n>")),k.bind("random",Z(f.random,"<:n>")),k.bind("boolean",Z(f.boolean,"<x-:b>")),k.bind("not",Z(f.not,"<x-:b>")),k.bind("map",Z(f.map,"<af>")),k.bind("zip",Z(f.zip,"<a+>")),k.bind("filter",Z(f.filter,"<af>")),k.bind("single",Z(f.single,"<af?>")),k.bind("reduce",Z(f.foldLeft,"<afj?:j>")),k.bind("sift",Z(f.sift,"<o-f?:o>")),k.bind("keys",Z(f.keys,"<x-:a<s>>")),k.bind("lookup",Z(f.lookup,"<x-s:x>")),k.bind("append",Z(f.append,"<xx:a>")),k.bind("exists",Z(f.exists,"<x:b>")),k.bind("spread",Z(f.spread,"<x-:a<o>>")),k.bind("merge",Z(f.merge,"<a<o>:o>")),k.bind("reverse",Z(f.reverse,"<a:a>")),k.bind("each",Z(f.each,"<o-f:a>")),k.bind("error",Z(f.error,"<s?:x>")),k.bind("assert",Z(f.assert,"<bs?:x>")),k.bind("type",Z(f.type,"<x:s>")),k.bind("sort",Z(f.sort,"<af?:a>")),k.bind("shuffle",Z(f.shuffle,"<a:a>")),k.bind("distinct",Z(f.distinct,"<x:x>")),k.bind("base64encode",Z(f.base64encode,"<s-:s>")),k.bind("base64decode",Z(f.base64decode,"<s-:s>")),k.bind("encodeUrlComponent",Z(f.encodeUrlComponent,"<s-:s>")),k.bind("encodeUrl",Z(f.encodeUrl,"<s-:s>")),k.bind("decodeUrlComponent",Z(f.decodeUrlComponent,"<s-:s>")),k.bind("decodeUrl",Z(f.decodeUrl,"<s-:s>")),k.bind("eval",Z(dn,"<sx?:x>")),k.bind("toMillis",Z(u.toMillis,"<s-s?:n>")),k.bind("fromMillis",Z(u.fromMillis,"<n-s?s?:s>")),k.bind("clone",Z(qt,"<(oa)-:o>"));var It={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function ht(o){var d=It[o.code];if(typeof d<"u"){var m=d.replace(/\{\{\{([^}]+)}}}/g,function(){return o[arguments[1]]});m=m.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(o[arguments[1]])}),o.message=m}}function Ee(o,d){var m,t;try{m=C(o,d&&d.recover),t=m.errors,delete m.errors}catch(y){throw ht(y),y}var a=ot(k),c=new Date;return a.bind("now",Z(function(y,h){return u.fromMillis(c.getTime(),y,h)},"<s?s?:s>")),a.bind("millis",Z(function(){return c.getTime()},"<:n>")),d&&d.RegexEngine?Ee.RegexEngine=d.RegexEngine:Ee.RegexEngine=RegExp,{evaluate:async function(y,h,w){if(typeof t<"u"){var N={code:"S0500",position:0};throw ht(N),N}if(typeof h<"u"){var W;W=ot(a);for(var X in h)W.bind(X,h[X])}else W=a;W.bind("$",y),c=new Date,W.timestamp=c,Array.isArray(y)&&!be(y)&&(y=q(y),y.outerWrapper=!0);var Se;try{return Se=await U(m,y,W),typeof w=="function"&&w(null,Se),Se}catch(he){throw ht(he),he}},assign:function(y,h){a.bind(y,h)},registerFunction:function(y,h,w){var N=Z(h,w);a.bind(y,N)},ast:function(){return m},errors:function(){return t}}}return Ee.parser=C,Ee})();i.exports=V},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(n,i,s){var u=n("./signature");const f=(()=>{var v={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},C={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" "},S=function(j){var x=0,E=j.length,q=function(Ce,Q){var P={type:Ce,value:Q,position:x};return P},be=function(){for(var Ce=x,Q=0,P,ae,L=function(U){if(j.charAt(U)==="/"&&Q===0){for(var B=0;j.charAt(U-(B+1))==="\\";)B++;if(B%2===0)return!0}return!1};x<E;){var k=j.charAt(x);if(L(x)){if(P=j.substring(Ce,x),P==="")throw{code:"S0301",stack:new Error().stack,position:x};for(x++,k=j.charAt(x),Ce=x;k==="i"||k==="m";)x++,k=j.charAt(x);return ae=j.substring(Ce,x)+"g",new RegExp(P,ae)}(k==="("||k==="["||k==="{")&&j.charAt(x-1)!=="\\"&&Q++,(k===")"||k==="]"||k==="}")&&j.charAt(x-1)!=="\\"&&Q--,x++}throw{code:"S0302",stack:new Error().stack,position:x}},Pe=function(Ce){if(x>=E)return null;for(var Q=j.charAt(x);x<E&&`
|
|
3
|
+
\r\v`.indexOf(Q)>-1;)x++,Q=j.charAt(x);if(Q==="/"&&j.charAt(x+1)==="*"){var P=x;for(x+=2,Q=j.charAt(x);!(Q==="*"&&j.charAt(x+1)==="/");)if(Q=j.charAt(++x),x>=E)throw{code:"S0106",stack:new Error().stack,position:P};return x+=2,Q=j.charAt(x),Pe(Ce)}if(Ce!==!0&&Q==="/")return x++,q("regex",be());if(Q==="."&&j.charAt(x+1)===".")return x+=2,q("operator","..");if(Q===":"&&j.charAt(x+1)==="=")return x+=2,q("operator",":=");if(Q==="!"&&j.charAt(x+1)==="=")return x+=2,q("operator","!=");if(Q===">"&&j.charAt(x+1)==="=")return x+=2,q("operator",">=");if(Q==="<"&&j.charAt(x+1)==="=")return x+=2,q("operator","<=");if(Q==="*"&&j.charAt(x+1)==="*")return x+=2,q("operator","**");if(Q==="~"&&j.charAt(x+1)===">")return x+=2,q("operator","~>");if(Q==="?"&&j.charAt(x+1)===":")return x+=2,q("operator","?:");if(Q==="?"&&j.charAt(x+1)==="?")return x+=2,q("operator","??");if(Object.prototype.hasOwnProperty.call(v,Q))return x++,q("operator",Q);if(Q==='"'||Q==="'"){var ae=Q;x++;for(var L="";x<E;){if(Q=j.charAt(x),Q==="\\")if(x++,Q=j.charAt(x),Object.prototype.hasOwnProperty.call(C,Q))L+=C[Q];else if(Q==="u"){var k=j.substr(x+1,4);if(/^[0-9a-fA-F]+$/.test(k)){var U=parseInt(k,16);L+=String.fromCharCode(U),x+=4}else throw{code:"S0104",stack:new Error().stack,position:x}}else throw{code:"S0103",stack:new Error().stack,position:x,token:Q};else{if(Q===ae)return x++,q("string",L);L+=Q}x++}throw{code:"S0101",stack:new Error().stack,position:x}}var B=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,le=B.exec(j.substring(x));if(le!==null){var we=parseFloat(le[0]);if(!isNaN(we)&&isFinite(we))return x+=le[0].length,q("number",we);throw{code:"S0102",stack:new Error().stack,position:x,token:le[0]}}var xe;if(Q==="`"){x++;var Te=j.indexOf("`",x);if(Te!==-1)return xe=j.substring(x,Te),x=Te+1,q("name",xe);throw x=E,{code:"S0105",stack:new Error().stack,position:x}}for(var me=x,je;;)if(je=j.charAt(me),me===E||`
|
|
4
|
+
\r\v`.indexOf(je)>-1||Object.prototype.hasOwnProperty.call(v,je)){if(j.charAt(x)==="$")return xe=j.substring(x+1,me),x=me,q("variable",xe);switch(xe=j.substring(x,me),x=me,xe){case"or":case"in":case"and":return q("operator",xe);case"true":return q("value",!0);case"false":return q("value",!1);case"null":return q("value",null);default:return x===E&&xe===""?null:q("name",xe)}}else me++};return Pe},V=function(j,x){var E,q,be={},Pe=[],Ce=function(){var l=[];E.id!=="(end)"&&l.push({type:E.type,value:E.value,position:E.position});for(var p=q();p!==null;)l.push(p),p=q();return l},Q={nud:function(){var l={code:"S0211",token:this.value,position:this.position};if(x)return l.remaining=Ce(),l.type="error",Pe.push(l),l;throw l.stack=new Error().stack,l}},P=function(l,p){var z=be[l];return p=p||0,z?p>=z.lbp&&(z.lbp=p):(z=Object.create(Q),z.id=z.value=l,z.lbp=p,be[l]=z),z},ae=function(l){if(x){l.remaining=Ce(),Pe.push(l);var p=be["(error)"];return E=Object.create(p),E.error=l,E.type="(error)",E}else throw l.stack=new Error().stack,l},L=function(l,p){if(l&&E.id!==l){var z;E.id==="(end)"?z="S0203":z="S0202";var ce={code:z,position:E.position,token:E.value,value:l};return ae(ce)}var Oe=q(p);if(Oe===null)return E=be["(end)"],E.position=j.length,E;var _e=Oe.value,g=Oe.type,_;switch(g){case"name":case"variable":_=be["(name)"];break;case"operator":if(_=be[_e],!_)return ae({code:"S0204",stack:new Error().stack,position:Oe.position,token:_e});break;case"string":case"number":case"value":_=be["(literal)"];break;case"regex":g="regex",_=be["(regex)"];break;default:return ae({code:"S0205",stack:new Error().stack,position:Oe.position,token:_e})}return E=Object.create(_),E.value=_e,E.type=g,E.position=Oe.position,E},k=function(l){var p,z=E;for(L(null,!0),p=z.nud();l<E.lbp;)z=E,L(),p=z.led(p);return p},U=function(l){var p=P(l,0);p.nud=function(){return this}},B=function(l,p,z){var ce=p||v[l],Oe=P(l,ce);return Oe.led=z||function(_e){return this.lhs=_e,this.rhs=k(ce),this.type="binary",this},Oe},le=function(l,p,z){var ce=P(l,p);return ce.led=z,ce},we=function(l,p){var z=P(l);return z.nud=p||function(){return this.expression=k(70),this.type="unary",this},z};U("(end)"),U("(name)"),U("(literal)"),U("(regex)"),P(":"),P(";"),P(","),P(")"),P("]"),P("}"),P(".."),B("."),B("+"),B("-"),B("*"),B("/"),B("%"),B("="),B("<"),B(">"),B("!="),B("<="),B(">="),B("&"),B("and"),B("or"),B("in"),U("and"),U("or"),U("in"),we("-"),B("~>"),B("??",v["??"],function(l){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[l]},this.then=l,this.else=k(0),this}),le("(error)",10,function(l){return this.lhs=l,this.error=E.error,this.remaining=Ce(),this.type="error",this}),we("*",function(){return this.type="wildcard",this}),we("**",function(){return this.type="descendant",this}),we("%",function(){return this.type="parent",this}),B("(",v["("],function(l){if(this.procedure=l,this.type="function",this.arguments=[],E.id!==")")for(;E.type==="operator"&&E.id==="?"?(this.type="partial",this.arguments.push(E),L("?")):this.arguments.push(k(0)),E.id===",";)L(",");if(L(")",!0),l.type==="name"&&(l.value==="function"||l.value==="λ")){if(this.arguments.forEach(function(_e,g){if(_e.type!=="variable")return ae({code:"S0208",stack:new Error().stack,position:_e.position,token:_e.value,value:g+1})}),this.type="lambda",E.id==="<"){for(var p=E.position,z=1,ce="<";z>0&&E.id!=="{"&&E.id!=="(end)";){var Oe=L();Oe.id===">"?z--:Oe.id==="<"&&z++,ce+=Oe.value}L(">");try{this.signature=u(ce)}catch(_e){return _e.position=p+_e.offset,ae(_e)}}L("{"),this.body=k(0),L("}")}return this}),we("(",function(){for(var l=[];E.id!==")"&&(l.push(k(0)),E.id===";");)L(";");return L(")",!0),this.type="block",this.expressions=l,this}),we("[",function(){var l=[];if(E.id!=="]")for(;;){var p=k(0);if(E.id===".."){var z={type:"binary",value:"..",position:E.position,lhs:p};L(".."),z.rhs=k(0),p=z}if(l.push(p),E.id!==",")break;L(",")}return L("]",!0),this.expressions=l,this.type="unary",this}),B("[",v["["],function(l){if(E.id==="]"){for(var p=l;p&&p.type==="binary"&&p.value==="[";)p=p.lhs;return p.keepArray=!0,L("]"),l}else return this.lhs=l,this.rhs=k(v["]"]),this.type="binary",L("]",!0),this}),B("^",v["^"],function(l){L("(");for(var p=[];;){var z={descending:!1};if(E.id==="<"?L("<"):E.id===">"&&(z.descending=!0,L(">")),z.expression=k(0),p.push(z),E.id!==",")break;L(",")}return L(")"),this.lhs=l,this.rhs=p,this.type="binary",this});var xe=function(l){var p=[];if(E.id!=="}")for(;;){var z=k(0);L(":");var ce=k(0);if(p.push([z,ce]),E.id!==",")break;L(",")}return L("}",!0),typeof l>"u"?(this.lhs=p,this.type="unary"):(this.lhs=l,this.rhs=p,this.type="binary"),this};we("{",xe),B("{",v["{"],xe),le(":=",v[":="],function(l){return l.type!=="variable"?ae({code:"S0212",stack:new Error().stack,position:l.position,token:l.value}):(this.lhs=l,this.rhs=k(v[":="]-1),this.type="binary",this)}),B("@",v["@"],function(l){return this.lhs=l,this.rhs=k(v["@"]),this.rhs.type!=="variable"?ae({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),B("#",v["#"],function(l){return this.lhs=l,this.rhs=k(v["#"]),this.rhs.type!=="variable"?ae({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),B("?",v["?"],function(l){return this.type="condition",this.condition=l,this.then=k(0),E.id===":"&&(L(":"),this.else=k(0)),this}),B("?:",v["?:"],function(l){return this.type="condition",this.condition=l,this.then=l,this.else=k(0),this}),we("|",function(){return this.type="transform",this.pattern=k(0),L("|"),this.update=k(0),E.id===","&&(L(","),this.delete=k(0)),L("|"),this});var Te=function(l){var p;if(l.type==="function"&&!l.predicate){var z={type:"lambda",thunk:!0,arguments:[],position:l.position};z.body=l,p=z}else if(l.type==="condition")l.then=Te(l.then),typeof l.else<"u"&&(l.else=Te(l.else)),p=l;else if(l.type==="block"){var ce=l.expressions.length;ce>0&&(l.expressions[ce-1]=Te(l.expressions[ce-1])),p=l}else p=l;return p},me=0,je=0,Ke=[],ke=function(l,p){switch(l.type){case"name":case"wildcard":p.level--,p.level===0&&(typeof l.ancestor>"u"||(Ke[p.index].slot.label=l.ancestor.label),l.ancestor=p,l.tuple=!0);break;case"parent":p.level++;break;case"block":l.expressions.length>0&&(l.tuple=!0,p=ke(l.expressions[l.expressions.length-1],p));break;case"path":l.tuple=!0;var z=l.steps.length-1;for(p=ke(l.steps[z--],p);p.level>0&&z>=0;)p=ke(l.steps[z--],p);break;default:throw{code:"S0217",token:l.type,position:l.position}}return p},ue=function(l,p){if(typeof p.seekingParent<"u"||p.type==="parent"){var z=typeof p.seekingParent<"u"?p.seekingParent:[];p.type==="parent"&&z.push(p.slot),typeof l.seekingParent>"u"?l.seekingParent=z:Array.prototype.push.apply(l.seekingParent,z)}},et=function(l){var p=l.steps.length-1,z=l.steps[p],ce=typeof z.seekingParent<"u"?z.seekingParent:[];z.type==="parent"&&ce.push(z.slot);for(var Oe=0;Oe<ce.length;Oe++){var _e=ce[Oe];for(p=l.steps.length-2;_e.level>0;){if(p<0){typeof l.seekingParent>"u"?l.seekingParent=[_e]:l.seekingParent.push(_e);break}for(var g=l.steps[p--];p>=0&&g.focus&&l.steps[p].focus;)g=l.steps[p--];_e=ke(g,_e)}}},re=function(l){var p;switch(l.type){case"binary":switch(l.value){case".":var z=re(l.lhs);z.type==="path"?p=z:p={type:"path",steps:[z]},z.type==="parent"&&(p.seekingParent=[z.slot]);var ce=re(l.rhs);ce.type==="function"&&ce.procedure.type==="path"&&ce.procedure.steps.length===1&&ce.procedure.steps[0].type==="name"&&p.steps[p.steps.length-1].type==="function"&&(p.steps[p.steps.length-1].nextFunction=ce.procedure.steps[0].value),ce.type==="path"?Array.prototype.push.apply(p.steps,ce.steps):(typeof ce.predicate<"u"&&(ce.stages=ce.predicate,delete ce.predicate),p.steps.push(ce)),p.steps.filter(function(M){if(M.type==="number"||M.type==="value")throw{code:"S0213",stack:new Error().stack,position:M.position,value:M.value};return M.type==="string"}).forEach(function(M){M.type="name"}),p.steps.filter(function(M){return M.keepArray===!0}).length>0&&(p.keepSingletonArray=!0);var Oe=p.steps[0];Oe.type==="unary"&&Oe.value==="["&&(Oe.consarray=!0);var _e=p.steps[p.steps.length-1];_e.type==="unary"&&_e.value==="["&&(_e.consarray=!0),et(p);break;case"[":p=re(l.lhs);var g=p,_="predicate";if(p.type==="path"&&(g=p.steps[p.steps.length-1],_="stages"),typeof g.group<"u")throw{code:"S0209",stack:new Error().stack,position:l.position};typeof g[_]>"u"&&(g[_]=[]);var b=re(l.rhs);typeof b.seekingParent<"u"&&(b.seekingParent.forEach(M=>{M.level===1?ke(g,M):M.level--}),ue(g,b)),g[_].push({type:"filter",expr:b,position:l.position});break;case"{":if(p=re(l.lhs),typeof p.group<"u")throw{code:"S0210",stack:new Error().stack,position:l.position};p.group={lhs:l.rhs.map(function(M){return[re(M[0]),re(M[1])]}),position:l.position};break;case"^":p=re(l.lhs),p.type!=="path"&&(p={type:"path",steps:[p]});var D={type:"sort",position:l.position};D.terms=l.rhs.map(function(M){var J=re(M.expression);return ue(D,J),{descending:M.descending,expression:J}}),p.steps.push(D),et(p);break;case":=":p={type:"bind",value:l.value,position:l.position},p.lhs=re(l.lhs),p.rhs=re(l.rhs),ue(p,p.rhs);break;case"@":if(p=re(l.lhs),g=p,p.type==="path"&&(g=p.steps[p.steps.length-1]),typeof g.stages<"u"||typeof g.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:l.position};if(g.type==="sort")throw{code:"S0216",stack:new Error().stack,position:l.position};l.keepArray&&(g.keepArray=!0),g.focus=l.rhs.value,g.tuple=!0;break;case"#":p=re(l.lhs),g=p,p.type==="path"?g=p.steps[p.steps.length-1]:(p={type:"path",steps:[p]},typeof g.predicate<"u"&&(g.stages=g.predicate,delete g.predicate)),typeof g.stages>"u"?g.index=l.rhs.value:g.stages.push({type:"index",value:l.rhs.value,position:l.position}),g.tuple=!0;break;case"~>":p={type:"apply",value:l.value,position:l.position},p.lhs=re(l.lhs),p.rhs=re(l.rhs),p.keepArray=p.lhs.keepArray||p.rhs.keepArray;break;default:p={type:l.type,value:l.value,position:l.position},p.lhs=re(l.lhs),p.rhs=re(l.rhs),ue(p,p.lhs),ue(p,p.rhs)}break;case"unary":p={type:l.type,value:l.value,position:l.position},l.value==="["?p.expressions=l.expressions.map(function(M){var J=re(M);return ue(p,J),J}):l.value==="{"?p.lhs=l.lhs.map(function(M){var J=re(M[0]);ue(p,J);var pe=re(M[1]);return ue(p,pe),[J,pe]}):(p.expression=re(l.expression),l.value==="-"&&p.expression.type==="number"?(p=p.expression,p.value=-p.value):ue(p,p.expression));break;case"function":case"partial":p={type:l.type,name:l.name,value:l.value,position:l.position},p.arguments=l.arguments.map(function(M){var J=re(M);return ue(p,J),J}),p.procedure=re(l.procedure);break;case"lambda":p={type:l.type,arguments:l.arguments,signature:l.signature,position:l.position};var I=re(l.body);p.body=Te(I);break;case"condition":p={type:l.type,position:l.position},p.condition=re(l.condition),ue(p,p.condition),p.then=re(l.then),ue(p,p.then),typeof l.else<"u"&&(p.else=re(l.else),ue(p,p.else));break;case"transform":p={type:l.type,position:l.position},p.pattern=re(l.pattern),p.update=re(l.update),typeof l.delete<"u"&&(p.delete=re(l.delete));break;case"block":p={type:l.type,position:l.position},p.expressions=l.expressions.map(function(M){var J=re(M);return ue(p,J),(J.consarray||J.type==="path"&&J.steps[0].consarray)&&(p.consarray=!0),J});break;case"name":p={type:"path",steps:[l]},l.keepArray&&(p.keepSingletonArray=!0);break;case"parent":p={type:"parent",slot:{label:"!"+me++,level:1,index:je++}},Ke.push(p);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":p=l;break;case"operator":if(l.value==="and"||l.value==="or"||l.value==="in")l.type="name",p=re(l);else if(l.value==="?")p=l;else throw{code:"S0201",stack:new Error().stack,position:l.position,token:l.value};break;case"error":p=l,l.lhs&&(p=re(l.lhs));break;default:var R="S0206";l.id==="(end)"&&(R="S0207");var T={code:R,position:l.position,token:l.value};if(x)return Pe.push(T),{type:"error",error:T};throw T.stack=new Error().stack,T}return l.keepArray&&(p.keepArray=!0),p};q=S(j),L();var Fe=k(0);if(E.id!=="(end)"){var at={code:"S0201",position:E.position,token:E.value};ae(at)}if(Fe=re(Fe),Fe.type==="parent"||typeof Fe.seekingParent<"u")throw{code:"S0217",token:Fe.type,position:Fe.position};return Pe.length>0&&(Fe.errors=Pe),Fe};return V})();i.exports=f},{"./signature":5}],5:[function(n,i,s){var u=n("./utils");const f=(()=>{var v={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function C(S){for(var V=1,j=[],x={},E=x;V<S.length;){var q=S.charAt(V);if(q===":")break;var be=function(){j.push(x),E=x,x={}},Pe=function(B,le,we,xe){for(var Te=1,me=le;me<B.length;)if(me++,q=B.charAt(me),q===xe){if(Te--,Te===0)break}else q===we&&Te++;return me};switch(q){case"s":case"n":case"b":case"l":case"o":x.regex="["+q+"m]",x.type=q,be();break;case"a":x.regex="[asnblfom]",x.type=q,x.array=!0,be();break;case"f":x.regex="f",x.type=q,be();break;case"j":x.regex="[asnblom]",x.type=q,be();break;case"x":x.regex="[asnblfom]",x.type=q,be();break;case"-":E.context=!0,E.contextRegex=new RegExp(E.regex),E.regex+="?";break;case"?":case"+":E.regex+=q;break;case"(":var Ce=Pe(S,V,"(",")"),Q=S.substring(V+1,Ce);if(Q.indexOf("<")===-1)x.regex="["+Q+"m]";else throw{code:"S0402",stack:new Error().stack,value:Q,offset:V};x.type="("+Q+")",V=Ce,be();break;case"<":if(E.type==="a"||E.type==="f"){var P=Pe(S,V,"<",">");E.subtype=S.substring(V+1,P),V=P}else throw{code:"S0401",stack:new Error().stack,value:E.type,offset:V};break}V++}var ae="^"+j.map(function(B){return"("+B.regex+")"}).join("")+"$",L=new RegExp(ae),k=function(B){var le;if(u.isFunction(B))le="f";else{var we=typeof B;switch(we){case"string":le="s";break;case"number":le="n";break;case"boolean":le="b";break;case"object":B===null?le="l":Array.isArray(B)?le="a":le="o";break;case"undefined":default:le="m"}}return le},U=function(B,le){for(var we="^",xe=0,Te=0;Te<j.length;Te++){we+=j[Te].regex;var me=le.match(we);if(me===null)throw{code:"T0410",stack:new Error().stack,value:B[xe],index:xe+1};xe=me[0].length}throw{code:"T0410",stack:new Error().stack,value:B[xe],index:xe+1}};return{definition:S,validate:function(B,le){var we="";B.forEach(function(je){we+=k(je)});var xe=L.exec(we);if(xe){var Te=[],me=0;return j.forEach(function(je,Ke){var ke=B[me],ue=xe[Ke+1];if(ue==="")if(je.context&&je.contextRegex){var et=k(le);if(je.contextRegex.test(et))Te.push(le);else throw{code:"T0411",stack:new Error().stack,value:le,index:me+1}}else Te.push(ke),me++;else ue.split("").forEach(function(re){if(je.type==="a"){if(re==="m")ke=void 0;else{ke=B[me];var Fe=!0;if(typeof je.subtype<"u"){if(re!=="a"&&ue!==je.subtype)Fe=!1;else if(re==="a"&&ke.length>0){var at=k(ke[0]);if(at!==je.subtype.charAt(0))Fe=!1;else{var l=ke.filter(function(p){return k(p)!==at});Fe=l.length===0}}}if(!Fe)throw{code:"T0412",stack:new Error().stack,value:ke,index:me+1,type:v[je.subtype]};re!=="a"&&(ke=[ke])}Te.push(ke),me++}else Te.push(ke),me++})}),Te}U(B,we)}}}return C})();i.exports=f},{"./utils":6}],6:[function(n,i,s){const u=(()=>{function f(P){var ae=!1;if(typeof P=="number"&&(ae=!isNaN(P),ae&&!isFinite(P)))throw{code:"D1001",value:P,stack:new Error().stack};return ae}function v(P){var ae=!1;return Array.isArray(P)&&(ae=P.filter(function(L){return typeof L!="string"}).length===0),ae}function C(P){var ae=!1;return Array.isArray(P)&&(ae=P.filter(function(L){return!f(L)}).length===0),ae}function S(){var P=[];return P.sequence=!0,arguments.length===1&&P.push(arguments[0]),P}function V(P){return P.sequence===!0&&Array.isArray(P)}function j(P){return P&&(P._jsonata_function===!0||P._jsonata_lambda===!0)||typeof P=="function"}function x(P){var ae=typeof P.arity=="number"?P.arity:typeof P.implementation=="function"?P.implementation.length:typeof P.length=="number"?P.length:P.arguments.length;return ae}function E(P){return P&&P._jsonata_lambda===!0}var q=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function be(P){return typeof P=="object"&&P!==null&&q in P&&"next"in P&&typeof P.next=="function"}function Pe(P,ae){if(P===ae)return!0;if(typeof P=="object"&&typeof ae=="object"&&P!==null&&ae!==null){if(Array.isArray(P)&&Array.isArray(ae)){if(P.length!==ae.length)return!1;for(var L=0;L<P.length;L++)if(!Pe(P[L],ae[L]))return!1;return!0}var k=Object.getOwnPropertyNames(P),U=Object.getOwnPropertyNames(ae);if(k.length!==U.length)return!1;for(k=k.sort(),U=U.sort(),L=0;L<k.length;L++)if(k[L]!==U[L])return!1;for(L=0;L<k.length;L++){var B=k[L];if(!Pe(P[B],ae[B]))return!1}return!0}return!1}function Ce(P){return typeof P=="object"&&P!==null&&"then"in P&&typeof P.then=="function"}function Q(P){var ae=[];for(let L of P)ae.push(L);return ae}return{isNumeric:f,isArrayOfStrings:v,isArrayOfNumbers:C,createSequence:S,isSequence:V,isFunction:j,isLambda:E,isIterable:be,getFunctionArity:x,isDeepEqual:Pe,stringToArray:Q,isPromise:Ce}})();i.exports=u},{}]},{},[3])(3)})})(On)),On.exports}Ca();const Da=A.object({name:A.literal("data-extract"),code:A.string(),inputData:A.any().optional()}),Pa={"get-text":ma,"attribute-value":ya,"get-value-form":va,"set-value-form":ga,"clear-value-form":ba,"element-exists":wa,"event-click":ka,keypress:_a,wait:xa,"wait-for-condition":Ta,"save-assets":Aa,"get-element-data":Ea,scroll:Sa,"ai-parse-data":pa,"fetch-api":Oa,"data-extract":Da},dt=jn({name:Tn(),selector:Tn(),findBy:Jn(["cssSelector","xpath"]),option:jn({waitForSelector:An().optional(),waitSelectorTimeout:Mn().optional(),multiple:An().optional()})});class Na{constructor(){fe(this,"expr");fe(this,"json")}}class ja{constructor(){fe(this,"template");fe(this,"valueFrom");fe(this,"default")}}class Ra{constructor(){fe(this,"id");fe(this,"title");fe(this,"when");fe(this,"block");fe(this,"repeat");fe(this,"next");fe(this,"onSuccess");fe(this,"onFailure");fe(this,"switch");fe(this,"timeoutMs");fe(this,"retry");fe(this,"delayAfterMs")}}class Ma{constructor(){fe(this,"version");fe(this,"id");fe(this,"title");fe(this,"description");fe(this,"start");fe(this,"steps");fe(this,"vars");fe(this,"defaultDelayMs")}}class Ia{constructor(){fe(this,"stepId");fe(this,"skipped");fe(this,"success");fe(this,"message");fe(this,"result");fe(this,"startedAt");fe(this,"finishedAt");fe(this,"attempts")}}class Fa{constructor(){fe(this,"success");fe(this,"steps");fe(this,"targetUrl");fe(this,"timestamp");fe(this,"error")}}exports.AllBlockSchemas=Pa;exports.BaseBlockSchema=dt;exports.Binding=ja;exports.CollectWorkflowResult=Fa;exports.Condition=Na;exports.EightGClient=ar;exports.EightGError=At;exports.Workflow=Ma;exports.WorkflowStep=Ra;exports.WorkflowStepRunResult=Ia;
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { EightGClient } from './EightGClient';
|
|
|
2
2
|
export * from './types';
|
|
3
3
|
export { EightGError } from './errors';
|
|
4
4
|
export type { Block, BlockResult } from '../blocks/types';
|
|
5
|
+
export type { GetTextBlock, GetAttributeValueBlock, GetValueFormsBlock, SetValueFormsBlock, ClearValueFormsBlock, ElementExistsBlock, EventClickBlock, KeypressBlock, WaitBlock, WaitForConditionBlock, WaitForConditionResult, SaveAssetsBlock, GetElementDataBlock, ElementData, ScrollBlock, AiParseDataBlock, SchemaField, SchemaDefinition, ObjectSchemaDefinition, ArraySchemaDefinition, FetchApiBlock, FetchApiResponse, DataExtractBlock, } from '../blocks';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACV,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,WAAW,CAAC"}
|