@pi-oxide/extension-js 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content-script.js +2 -2
- package/extension_js.d.ts +10 -6
- package/extension_js.js +62367 -61669
- package/index.js +2242 -1110
- package/package.json +1 -1
- package/worker.js +469 -325
package/content-script.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";function ie(r){return r==null?{}:r instanceof Map?Object.fromEntries([...r.entries()].map(([e,t])=>[e,ie(t)])):Array.isArray(r)?r.map(ie):r}async function et(r,e,t,n,s){const a=r.safeParse(ie(n));if(!a.success){const i=a.error.issues.map(o=>`invalid value for field '${o.path.join(".")}' (${o.message})`);return{ok:!1,error:{message:`Invalid parameters for ${s}: ${i.join("; ")}`,code:"E_INVALID_PARAMS",category:"validation"}}}try{const i=await t(a.data),o=e.safeParse(i);if(!o.success){const d=o.error.issues.map(m=>{const b=m.path.join(".");return`invalid return value${b?` at '${b}'`:""} (${m.message})`});return{ok:!1,error:{message:`Invalid return value for ${s}: ${d.join("; ")}`,code:"E_INVALID_RETURN",category:"validation"}}}return{ok:!0,value:o.data}}catch(i){const o=i instanceof Error?i.message:String(i),d=typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="string"?i.code:"E_HANDLER";return{ok:!1,error:{message:o,code:d}}}}const Re=new Map,oe=new Map;function tt(r){Re.set(r.registryAction,r)}function ve(r){return Re.get(r)}function rt(r){for(const e of r)tt(e);try{chrome.runtime.sendMessage({type:"contentScriptReady"})}catch{}}function nt(r){const e=oe.get(r);return e?(e.abort(),oe.delete(r),!0):!1}async function st(r,e,t,n,s){const a=ve(r);if(!a)return{ok:!1,error:{message:`No schema registered for content-script action: ${r}`,code:"E_INTERNAL"}};const i=new AbortController;s&&oe.set(s,i);try{return await et(a.params,a.returns,async o=>t(o,i.signal),ie(n),r)}finally{s&&oe.delete(s)}}var w;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(w||(w={}));var je;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(je||(je={}));const p=w.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),U=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},u=w.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 M extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,d=0;for(;d<i.path.length;){const m=i.path[d];d===i.path.length-1?(o[m]=o[m]||{_errors:[]},o[m]._errors.push(t(i))):o[m]=o[m]||{_errors:[]},o=o[m],d++}}};return s(this),n}static assert(e){if(!(e instanceof M))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,w.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}M.create=r=>new M(r);const be=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,w.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${w.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${w.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${w.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:w.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,w.assertNever(r)}return{message:t}};let at=be;function it(){return at}const ot=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const d=n.filter(m=>!!m).slice().reverse();for(const m of d)o=m(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function f(r,e){const t=it(),n=ot({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===be?void 0:be].filter(s=>!!s)});r.common.issues.push(n)}class O{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return v;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return O.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const v=Object.freeze({status:"aborted"}),ne=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),$e=r=>r.status==="aborted",Ze=r=>r.status==="dirty",G=r=>r.status==="valid",ce=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 P{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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 Pe=(r,e)=>{if(G(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 t=new M(r.common.issues);return this._error=t,this._error}}};function k(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))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:(i,o)=>{const{message:d}=r;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return U(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:U(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ce(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={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:U(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Pe(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:U(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return G(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>G(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:U(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ce(s)?s:Promise.resolve(s));return Pe(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:u.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new ee({schema:this,typeName:_.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 F.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return he.create(this,this._def)}or(e){return ue.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new ee({...k(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ce({...k(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Nt({typeName:_.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ee({...k(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return Ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ct=/^c[^\s-]{8,}$/i,lt=/^[0-9a-z]+$/,ut=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dt=/^[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,ft=/^[a-z0-9_-]{21}$/i,ht=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mt=/^[-+]?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)?)??$/,pt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ke;const yt=/^(?:(?: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])$/,_t=/^(?:(?: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])$/,vt=/^(([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]))$/,bt=/^(([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])$/,kt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Le="((\\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])))",wt=new RegExp(`^${Le}$`);function Me(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function St(r){return new RegExp(`^${Me(r)}$`)}function Tt(r){let e=`${Le}T${Me(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ct(r,e){return!!((e==="v4"||!e)&&yt.test(r)||(e==="v6"||!e)&&vt.test(r))}function Et(r,e){if(!ht.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));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 It(r,e){return!!((e==="v4"||!e)&&_t.test(r)||(e==="v6"||!e)&&bt.test(r))}class V extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:p.string,received:a.parsedType}),v}const n=new O;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?f(s,{code:u.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:u.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")pt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")ke||(ke=new RegExp(gt,"u")),ke.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")dt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ft.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ct.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")lt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ut.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:u.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:u.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:u.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Tt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?wt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?St(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:u.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?mt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ct(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Et(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?It(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?kt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:u.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?xt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:u.invalid_string,message:a.message}),n.dirty()):w.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:u.invalid_string,...g.errToObj(n)})}_addCheck(e){return new V({...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,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...g.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...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}}V.create=r=>new V({checks:[],typeName:_.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});function At(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class Y extends x{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)!==p.number){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:p.number,received:a.parsedType}),v}let n;const s=new O;for(const a of this._def.checks)a.kind==="int"?w.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?At(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_finite,message:a.message}),s.dirty()):w.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,s){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(s)}]})}_addCheck(e){return new Y({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}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 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"&&w.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Y.create=r=>new Y({checks:[],typeName:_.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class K extends x{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)!==p.bigint)return this._getInvalidInput(e);let n;const s=new O;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):w.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,s){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(s)}]})}_addCheck(e){return new K({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}}K.create=r=>new K({checks:[],typeName:_.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});class xe extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.boolean,received:n.parsedType}),v}return R(e.data)}}xe.create=r=>new xe({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class le extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_type,expected:p.date,received:a.parsedType}),v}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:u.invalid_date}),v}const n=new O;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:u.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):w.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}}le.create=r=>new le({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:_.ZodDate,...k(r)});class Ve extends x{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.symbol,received:n.parsedType}),v}return R(e.data)}}Ve.create=r=>new Ve({typeName:_.ZodSymbol,...k(r)});class De extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.undefined,received:n.parsedType}),v}return R(e.data)}}De.create=r=>new De({typeName:_.ZodUndefined,...k(r)});class we extends x{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.null,received:n.parsedType}),v}return R(e.data)}}we.create=r=>new we({typeName:_.ZodNull,...k(r)});class ze extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}ze.create=r=>new ze({typeName:_.ZodAny,...k(r)});class Se extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}Se.create=r=>new Se({typeName:_.ZodUnknown,...k(r)});class B extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:p.never,received:t.parsedType}),v}}B.create=r=>new B({typeName:_.ZodNever,...k(r)});class Ue extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.void,received:n.parsedType}),v}return R(e.data)}}Ue.create=r=>new Ue({typeName:_.ZodVoid,...k(r)});class L extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return f(t,{code:u.invalid_type,expected:p.array,received:t.parsedType}),v;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?u.too_big:u.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(f(t,{code:u.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(f(t,{code:u.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new P(t,i,t.path,o)))).then(i=>O.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new P(t,i,t.path,o)));return O.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new L({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new L({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new L({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}L.create=(r,e)=>new L({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...k(e)});function Q(r){if(r instanceof E){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=F.create(Q(n))}return new E({...r._def,shape:()=>e})}else return r instanceof L?new L({...r._def,type:Q(r.element)}):r instanceof F?F.create(Q(r.unwrap())):r instanceof te?te.create(Q(r.unwrap())):r instanceof W?W.create(r.items.map(e=>Q(e))):r}class E extends x{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=w.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const m=this._getOrReturnCtx(e);return f(m,{code:u.invalid_type,expected:p.object,received:m.parsedType}),v}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const m in s.data)i.includes(m)||o.push(m);const d=[];for(const m of i){const b=a[m],N=s.data[m];d.push({key:{status:"valid",value:m},value:b._parse(new P(s,N,s.path,m)),alwaysSet:m in s.data})}if(this._def.catchall instanceof B){const m=this._def.unknownKeys;if(m==="passthrough")for(const b of o)d.push({key:{status:"valid",value:b},value:{status:"valid",value:s.data[b]}});else if(m==="strict")o.length>0&&(f(s,{code:u.unrecognized_keys,keys:o}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const b of o){const N=s.data[b];d.push({key:{status:"valid",value:b},value:m._parse(new P(s,N,s.path,b)),alwaysSet:b in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const m=[];for(const b of d){const N=await b.key,j=await b.value;m.push({key:N,value:j,alwaysSet:b.alwaysSet})}return m}).then(m=>O.mergeObjectSync(n,m)):O.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new E({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:g.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new E({...this._def,unknownKeys:"strip"})}passthrough(){return new E({...this._def,unknownKeys:"passthrough"})}extend(e){return new E({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new E({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new E({...this._def,catchall:e})}pick(e){const t={};for(const n of w.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new E({...this._def,shape:()=>t})}omit(e){const t={};for(const n of w.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new E({...this._def,shape:()=>t})}deepPartial(){return Q(this)}partial(e){const t={};for(const n of w.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new E({...this._def,shape:()=>t})}required(e){const t={};for(const n of w.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof F;)a=a._def.innerType;t[n]=a}return new E({...this._def,shape:()=>t})}keyof(){return We(w.objectKeys(this.shape))}}E.create=(r,e)=>new E({shape:()=>r,unknownKeys:"strip",catchall:B.create(),typeName:_.ZodObject,...k(e)}),E.strictCreate=(r,e)=>new E({shape:()=>r,unknownKeys:"strict",catchall:B.create(),typeName:_.ZodObject,...k(e)}),E.lazycreate=(r,e)=>new E({shape:r,unknownKeys:"strip",catchall:B.create(),typeName:_.ZodObject,...k(e)});class ue extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new M(o.ctx.common.issues));return f(t,{code:u.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const d of n){const m={...t,common:{...t.common,issues:[]},parent:null},b=d._parseSync({data:t.data,path:t.path,parent:m});if(b.status==="valid")return b;b.status==="dirty"&&!a&&(a={result:b,ctx:m}),m.common.issues.length&&i.push(m.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new M(d));return f(t,{code:u.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}ue.create=(r,e)=>new ue({options:r,typeName:_.ZodUnion,...k(e)});function Te(r,e){const t=U(r),n=U(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&n===p.object){const s=w.objectKeys(e),a=w.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=Te(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===p.array&&n===p.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=Te(i,o);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===p.date&&n===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class de extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if($e(a)||$e(i))return v;const o=Te(a.value,i.value);return o.valid?((Ze(a)||Ze(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:u.invalid_intersection_types}),v)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}de.create=(r,e,t)=>new de({left:r,right:e,typeName:_.ZodIntersection,...k(t)});class W extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return f(n,{code:u.invalid_type,expected:p.array,received:n.parsedType}),v;if(n.data.length<this._def.items.length)return f(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new P(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>O.mergeArray(t,i)):O.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:r,typeName:_.ZodTuple,rest:null,...k(e)})};class fe extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return f(n,{code:u.invalid_type,expected:p.object,received:n.parsedType}),v;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new P(n,o,n.path,o)),value:i._parse(new P(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?O.mergeObjectAsync(t,s):O.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new fe({keyType:e,valueType:t,typeName:_.ZodRecord,...k(n)}):new fe({keyType:V.create(),valueType:e,typeName:_.ZodRecord,...k(t)})}}class Be extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return f(n,{code:u.invalid_type,expected:p.map,received:n.parsedType}),v;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],m)=>({key:s._parse(new P(n,o,n.path,[m,"key"])),value:a._parse(new P(n,d,n.path,[m,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const m=await d.key,b=await d.value;if(m.status==="aborted"||b.status==="aborted")return v;(m.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(m.value,b.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const m=d.key,b=d.value;if(m.status==="aborted"||b.status==="aborted")return v;(m.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(m.value,b.value)}return{status:t.value,value:o}}}}Be.create=(r,e,t)=>new Be({valueType:e,keyType:r,typeName:_.ZodMap,...k(t)});class se extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return f(n,{code:u.invalid_type,expected:p.set,received:n.parsedType}),v;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:u.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(f(n,{code:u.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const m=new Set;for(const b of d){if(b.status==="aborted")return v;b.status==="dirty"&&t.dirty(),m.add(b.value)}return{status:t.value,value:m}}const o=[...n.data.values()].map((d,m)=>a._parse(new P(n,d,n.path,m)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new se({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(r,e)=>new se({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...k(e)});class Fe extends x{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})}}Fe.create=(r,e)=>new Fe({getter:r,typeName:_.ZodLazy,...k(e)});class qe extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}qe.create=(r,e)=>new qe({value:r,typeName:_.ZodLiteral,...k(e)});function We(r,e){return new X({values:r,typeName:_.ZodEnum,...k(e)})}class X extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:w.joinValues(n),received:t.parsedType,code:u.invalid_type}),v}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:u.invalid_enum_value,options:n}),v}return R(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 X.create(e,{...this._def,...t})}exclude(e,t=this._def){return X.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}X.create=We;class He extends x{_parse(e){const t=w.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const s=w.objectValues(t);return f(n,{expected:w.joinValues(s),received:n.parsedType,code:u.invalid_type}),v}if(this._cache||(this._cache=new Set(w.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=w.objectValues(t);return f(n,{received:n.data,code:u.invalid_enum_value,options:s}),v}return R(e.data)}get enum(){return this._def.values}}He.create=(r,e)=>new He({values:r,typeName:_.ZodNativeEnum,...k(e)});class he extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return f(t,{code:u.invalid_type,expected:p.promise,received:t.parsedType}),v;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return R(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:_.ZodPromise,...k(e)});class ee extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{f(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;const d=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return d.status==="aborted"?v:d.status==="dirty"||t.value==="dirty"?ne(d.value):d});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ne(o.value):o}}if(s.type==="refinement"){const i=o=>{const d=s.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!G(i))return v;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>G(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):v);w.assertNever(s)}}ee.create=(r,e,t)=>new ee({schema:r,typeName:_.ZodEffects,effect:e,...k(t)}),ee.createWithPreprocess=(r,e,t)=>new ee({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...k(t)});class F extends x{_parse(e){return this._getType(e)===p.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(r,e)=>new F({innerType:r,typeName:_.ZodOptional,...k(e)});class te extends x{_parse(e){return this._getType(e)===p.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(r,e)=>new te({innerType:r,typeName:_.ZodNullable,...k(e)});class Ce extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class Ee extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ce(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new M(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class Je extends x{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:p.nan,received:n.parsedType}),v}return{status:"valid",value:e.data}}}Je.create=r=>new Je({typeName:_.ZodNaN,...k(r)});class Nt extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ie extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ne(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?v:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ie({in:e,out:t,typeName:_.ZodPipeline})}}class Ae extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(G(s)&&(s.value=Object.freeze(s.value)),s);return ce(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ae.create=(r,e)=>new Ae({innerType:r,typeName:_.ZodReadonly,...k(e)});var _;(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"})(_||(_={}));const h=V.create,S=Y.create,Ge=K.create,$=xe.create,Ot=we.create,c=Se.create;B.create;const I=L.create,y=E.create,T=ue.create;de.create;const Rt=W.create,l=fe.create;X.create,he.create,F.create,te.create;const Z=()=>T([Ge(),S().finite()]).transform(r=>BigInt(r));y({key:h()}),y({key:h(),value:h()}),y({key:h()}),y({}),y({items:l(c())}),y({keys:I(h()),defaults:l(c()).optional()}),y({}),y({keys:I(h())}),y({}),y({}),T([Rt([T([y({text:h()}),h()])]),y({text:h().optional(),value:h().optional()})]),y({url:h(),method:h().default("GET"),headers:l(h()).default({}),body:h().nullable().default(null),timeout:Z().default(30000n)}),y({duration:Z()});const jt=(r,e)=>{!r.refId&&!r.label&&e.addIssue({code:u.custom,message:"Either refId or label is required"})},me=r=>y({refId:h().optional(),label:h().optional(),...r}).superRefine(jt),ae=r=>y({refId:h(),...r}),pe={tabId:T([S(),Ge()]).optional()},q=r=>y({...pe,refId:h(),...r}),$t=y({}),Zt=y({});y({url:h()});const Pt=y({});y({}),y({}),y({duration:Z().default(1000n)});const Lt=me(),Mt=me({value:h()}),Vt=me({text:h()}),Dt=me({text:h()}),zt=y({key:h()}),Ut=ae({value:h()}),Bt=ae({checked:$().optional()}),Ft=ae(),qt=y({}),Wt=y({direction:h().default("down"),amount:S().default(300)}),Ht=ae({x:S().optional(),y:S().optional()}),Jt=ae();y({selector:h()}),y({selector:h(),timeout:Z().default(30000n)}),y({fields:I(h())}),T([S(),I(c()),l(c())]),y({}),l(c()),l(c()),T([S(),I(c()),l(c())]),T([S(),I(c()),l(c())]),l(c());const Gt=q(),Yt=q({value:h()}),Kt=q({x:S().optional(),y:S().optional()}),Qt=q({text:h()}),Xt=y({...pe,key:h()}),er=q({value:h()}),tr=q({checked:$().optional()}),rr=q(),nr=y({...pe}),sr=y({...pe,direction:h().default("down"),amount:S().default(300)}),ar=q();l(c());const ir=l(c());l(c()),l(c()),l(c()),l(c()),l(c()),T([h(),l(c())]),T([h(),l(c())]),l(c()),l(c()),l(c()),l(c()),l(c()),T([h(),l(c())]),T([h(),l(c())]),l(c()),T([h(),l(c())]),l(c()),y({}),y({}),y({duration:Z().default(1000n)}),y({interactive_only:$().default(!1),max_nodes:Z().default(500n)}),y({interactive_only:$().default(!1),max_nodes:Z().default(500n)}),y({interactive_only:$().default(!1),max_nodes:Z().default(500n)}),y({interactive_only:$().default(!1),max_nodes:Z().default(500n)}),y({snapshot:c(),format:h().optional()});const or=l(c());l(c()),l(c()),y({path:h()}),y({from:h(),to:h()}),y({path:h(),data:h()}),y({path:h(),offset:Z(),len:S()}),y({path:h(),offset:Z(),data:h()}),y({path:h(),algo:h().default("sha256")}),l(c()),l(c()),l(c()),l(c()),T([S(),l(c())]),T([S(),l(c())]),l(c()),l(c()),l(c()),T([h(),l(c())]),l(c()),l(c()),l(c()),l(c()),l(c()),T([h(),S(),l(c())]),l(c()),l(c()),l(c()),T([S(),l(c())]),l(c()),l(c()),l(c()),l(c()),l(c()),I(c()),T([h(),l(c())]),l(c()),T([h(),l(c())]),l(c()),T([h(),l(c())]),l(c()),T([h(),l(c())]),l(c()),l(c()),T([S(),l(c())]),l(c()),l(c()),T([S(),l(c())]),l(c()),T([h(),S(),l(c())]),l(c()),l(c()),l(c()),l(c()),T([S(),l(c())]),T([S(),l(c())]),T([S(),l(c())]),T([S(),l(c())]),T([S(),l(c())]),l(c()),l(c()),l(c()),l(c()),y({status:S(),ok:$(),headers:l(h()),body:h()}),y({data:c(),text:h()});const cr=y({refId:S(),role:h(),tag:h(),name:h().optional()}),lr=y({text:h(),nodes:I(cr),url:h(),title:h(),viewport:y({width:S(),height:S()})}),ur=l(c());I(ur);const dr=l(c());I(dr),l(c()).nullable(),I(l(c())),I(l(c())),I(l(c())),I(l(c())),h(),$(),T([h(),S()]),$();const fr=l(c());I(fr),I(l(c())),I(l(c()));const hr=l(c());I(hr),S(),l(c()),l(c()),I(l(c()));const mr=new Set(["page_url","page_title","page_click","page_fill","page_type","page_append","page_press","page_select","page_check","page_hover","page_unhover","page_scroll","page_scroll_to","page_dblclick","page_back","tab_click","tab_fill","tab_type","tab_press","tab_select","tab_check","tab_hover","tab_unhover","tab_scroll","tab_scroll_to","tab_dblclick","tab_back"]);function pr(r){if(r.startsWith("page_")||r.startsWith("tab_")){const e=r.indexOf("_");if(e>=0)return r.slice(e+1)}return r}const C={string:h(),null:Ot(),boolean:$()},gr={page_url:{params:$t,returns:C.string},page_title:{params:Zt,returns:C.string},page_click:{params:Lt,returns:C.null},page_fill:{params:Mt,returns:C.null},page_type:{params:Vt,returns:C.null},page_append:{params:Dt,returns:C.null},page_press:{params:zt,returns:C.null},page_select:{params:Ut,returns:C.null},page_check:{params:Bt,returns:C.null},page_hover:{params:Ft,returns:C.null},page_unhover:{params:qt,returns:C.null},page_scroll:{params:Wt,returns:C.boolean},page_scroll_to:{params:Ht,returns:C.boolean},page_dblclick:{params:Jt,returns:C.null},page_back:{params:Pt,returns:C.boolean},tab_click:{params:Gt,returns:C.null},tab_fill:{params:Yt,returns:C.null},tab_type:{params:Qt,returns:C.null},tab_press:{params:Xt,returns:C.null},tab_select:{params:er,returns:C.null},tab_check:{params:tr,returns:C.null},tab_hover:{params:rr,returns:C.null},tab_unhover:{params:nr,returns:C.null},tab_scroll:{params:sr,returns:C.boolean},tab_scroll_to:{params:Kt,returns:C.boolean},tab_dblclick:{params:ar,returns:C.null},tab_back:{params:ir,returns:C.boolean}};function yr(){return[{registryAction:"ping",handlerKey:"ping",params:y({}),returns:y({ok:$()})},{registryAction:"snapshot",handlerKey:"snapshot",params:or,returns:lr}]}function _r(){const r=[];for(const e of mr){const t=gr[e];if(!t)throw new Error(`Missing content-script schemas for action: ${e}`);const n=e.indexOf("_"),s=n>=0?e.slice(n+1):e;r.push({registryAction:e,handlerKey:s,params:t.params,returns:t.returns})}return r}const D={debug:0,info:1,warn:2,error:3,none:4};let Ye=D.error;function vr(r){if(!r)return"";const e=[];for(const[t,n]of Object.entries(r)){let s;if(n===null)s="null";else if(n===void 0)s="undefined";else if(typeof n=="string")s=n;else if(typeof n=="number"||typeof n=="boolean")s=String(n);else try{s=JSON.stringify(n)}catch{s="[Circular]"}e.push(`${t}=${s}`)}return e.length>0?` ${e.join(" ")}`:""}function ge(r,e,t){if(r<Ye)return;const n=vr(t),s=`[extension-js][content-script] ${e}${n}`;r>=D.error?console.error(s):r===D.warn?console.warn(s):console.log(s)}const H={debug:(r,e)=>{ge(D.debug,r,e)},info:(r,e)=>{ge(D.info,r,e)},warn:(r,e)=>{ge(D.warn,r,e)},error:(r,e)=>{ge(D.error,r,e)}};function br(){window.__jsNotebookSetLogLevel=r=>{Ye=D[r]??D.error}}function z(r){return document.querySelector(`[data-ref-id='${CSS.escape(String(r))}']`)}function ye(r){var n,s,a;const e=r.toLowerCase().trim();if(!e)return null;const t=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const i of t){const o=i.getAttribute("aria-label");if(o&&o.toLowerCase().trim()===e)return i;const d=i.placeholder;if(d&&d.toLowerCase().trim()===e)return i;const m=i.id;if(m){const j=document.querySelector(`label[for='${CSS.escape(m)}']`);if(j&&((n=j.textContent)==null?void 0:n.trim().toLowerCase())===e)return i}const b=i.closest("label");if(b&&((s=b.textContent)==null?void 0:s.trim().toLowerCase())===e||(((a=i.textContent)==null?void 0:a.trim().toLowerCase())||"")===e)return i}return null}function _e(r){var s;const e=r.toLowerCase().trim(),t=new Set,n=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const a of n){const i=a.getAttribute("aria-label");i&&t.add(i.trim());const o=a.placeholder;o&&t.add(o.trim());const d=((s=a.textContent)==null?void 0:s.trim())||"";d&&t.add(d)}return Array.from(t).filter(a=>a.toLowerCase().includes(e)).slice(0,5)}function J(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}function A(r,e){const t=J(r)[e];return typeof t=="string"?t:""}function Ke(r,e,t){const n=J(r)[e];return typeof n=="number"?n:t}function Ne(r){const e=r.tagName.toLowerCase(),t=r.getAttribute("role");if(t)return t;if(e==="button"||e==="input"&&r.type==="submit")return"button";if(e==="a")return"link";if(e==="input"){const n=r.type;if(n==="text"||n==="email"||n==="password"||n==="search")return"textbox";if(n==="checkbox")return"checkbox";if(n==="radio")return"radio";if(n==="submit"||n==="button")return"button"}return e==="textarea"?"textbox":e==="select"?"combobox":e==="img"?"img":e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6"?"heading":e==="li"?"listitem":e==="ul"||e==="ol"?"list":e==="table"?"table":e==="tr"?"row":e==="td"||e==="th"?"cell":e==="nav"?"navigation":e==="main"?"main":e==="article"?"article":e==="section"?"region":e==="aside"?"complementary":e==="form"?"form":e==="dialog"||e==="modal"?"dialog":e==="figure"?"figure":e==="figcaption"?"caption":r.getAttribute("onclick")||r.onclick?"button":"generic"}function kr(r){var i,o;const e=r.getAttribute("aria-label");if(e)return e;const t=r.getAttribute("aria-labelledby");if(t){const d=document.getElementById(t);if(d)return((i=d.textContent)==null?void 0:i.slice(0,60))||""}if(r.tagName.toLowerCase()==="img"){const d=r.getAttribute("alt");if(d)return d}const s=r.title;if(s)return s;const a=Ne(r);return a!=="generic"&&a!=="list"&&a!=="table"&&a!=="row"&&a!=="region"&&a!=="navigation"&&a!=="main"&&((o=r.textContent)==null?void 0:o.trim().slice(0,60))||""}function xr(r){const e=Ne(r);if(e==="generic"||e==="presentation"||e==="none"||r.hidden)return!1;const t=window.getComputedStyle(r);return!(t.display==="none"||t.visibility==="hidden")}function wr(r){let e=1;const t=[],n=[];function s(i,o){if(t.length>=r)return;const d=i.tagName.toLowerCase();if(d==="script"||d==="style"||d==="noscript"||d==="template")return;const m=xr(i);let b=o;if(m){const N=e++;i.setAttribute("data-ref-id",String(N));const j=Ne(i),re=kr(i),Xe={refId:N,role:j,tag:d};re&&(Xe.name=re),t.push(Xe);const Oe=[`${" ".repeat(o)}- ${j}`];re&&Oe.push(`"${re.replace(/"/g,'\\"')}"`),Oe.push(`[ref=${N}]`),n.push(Oe.join(" ")),b=o+1}for(const N of i.children)s(N,b)}return document.body&&s(document.body,0),{text:[`URL: ${window.location.href}`,`Title: ${document.title}`,""].concat(n).join(`
|
|
2
|
-
`),nodes:t,url:window.location.href,title:document.title,viewport:{width:window.innerWidth,height:window.innerHeight}}}const
|
|
1
|
+
(function(){"use strict";function fe(r){return r==null?{}:r instanceof Map?Object.fromEntries([...r.entries()].map(([e,t])=>[e,fe(t)])):Array.isArray(r)?r.map(fe):r}function st(r){return r===null?"null":r===void 0?"undefined":Array.isArray(r)?"array":typeof r}function N(r,e=0){if(e>2)return"...";const t=r._def;switch(t.typeName){case"ZodObject":{const n=t.shape(),s=Object.keys(n);return s.length===0?"{ }":e>=1?"{ ... }":`{ ${s.map(i=>{const o=n[i],c=o._def.typeName==="ZodOptional",f=N(c?o._def.innerType:o,e+1);return`${i}${c?"?":""}: ${f}`}).join(", ")} }`}case"ZodUnion":return t.options.map(s=>N(s,e)).join(" or ");case"ZodString":return"string";case"ZodNumber":return"number";case"ZodBoolean":return"boolean";case"ZodBigInt":return"bigint";case"ZodNull":return"null";case"ZodArray":return`${N(t.type,e+1)}[]`;case"ZodTuple":return`[${t.items.map(s=>N(s,e+1)).join(", ")}]`;case"ZodRecord":return"object";case"ZodOptional":return`${N(t.innerType,e)}?`;case"ZodLiteral":return JSON.stringify(t.value);case"ZodEnum":return t.values.map(n=>`"${n}"`).join(" | ");case"ZodAny":return"any";case"ZodUnknown":return"unknown";case"ZodVoid":return"void";case"ZodUndefined":return"undefined";case"ZodEffects":return N(t.schema,e);case"ZodDefault":return N(t.innerType,e);case"ZodNullable":return`${N(t.innerType,e)} | null`;case"ZodLazy":return"lazy";case"ZodPromise":return`Promise<${N(t.type,e+1)}>`;case"ZodFunction":return"function";case"ZodDate":return"Date";case"ZodMap":return"Map";case"ZodSet":return"Set";case"ZodIntersection":return`${N(t.left,e)} & ${N(t.right,e)}`;case"ZodDiscriminatedUnion":return t.options.map(s=>N(s,e)).join(" or ");case"ZodBranded":return N(t.type,e);case"ZodNaN":return"NaN";case"ZodCatch":return N(t.innerType,e);case"ZodPipeline":return N(t.in,e);case"ZodReadonly":return`readonly ${N(t.innerType,e)}`;default:return"unknown"}}function at(r,e,t,n){const s=t.filter(o=>o.path.length===0),a=t.filter(o=>o.path.length>0);if(s.length>0&&a.length===0){const o=s.some(f=>f.code==="custom"),c=s.some(f=>f.code!=="invalid_type"&&f.code!=="invalid_literal"&&f.code!=="invalid_union");if(!o&&!c){const f=N(e),b=st(n);return`Invalid parameters for ${r}: expected ${f}${f==="{ }"?" or no args":""}, received ${b}`}}const i=t.map(o=>`at '${o.path.length>0?o.path.join("."):"root"}': ${o.message}`);return`Invalid parameters for ${r}: ${i.join("; ")}`}async function it(r,e,t,n,s){const a=r.safeParse(fe(n));if(!a.success)return{ok:!1,error:{message:at(s,r,a.error.issues,n),code:"E_INVALID_PARAMS",category:"validation"}};try{const i=await t(a.data),o=e.safeParse(i);if(!o.success){const c=o.error.issues.map(f=>{const b=f.path.join(".");return`invalid return value${b?` at '${b}'`:""} (${f.message})`});return{ok:!1,error:{message:`Invalid return value for ${s}: ${c.join("; ")}`,code:"E_INVALID_RETURN",category:"validation"}}}return{ok:!0,value:o.data}}catch(i){const o=i instanceof Error?i.message:String(i),c=typeof i=="object"&&i!==null&&"code"in i&&typeof i.code=="string"?i.code:"E_HANDLER",f=typeof i=="object"&&i!==null&&"category"in i&&typeof i.category=="string"?i.category:void 0;return{ok:!1,error:{message:`${s}: ${o}`,code:c,category:f}}}}const $e=new Map,he=new Map;function ot(r){$e.set(r.registryAction,r)}function ke(r){return $e.get(r)}function ct(r){for(const e of r)ot(e);try{chrome.runtime.sendMessage({type:"contentScriptReady"})}catch{}}function lt(r){const e=he.get(r);return e?(e.abort(),he.delete(r),!0):!1}async function ut(r,e,t,n,s){const a=ke(r);if(!a)return{ok:!1,error:{message:`No schema registered for content-script action: ${r}`,code:"E_INTERNAL"}};const i=new AbortController;s&&he.set(s,i);try{return await it(a.params,a.returns,async o=>t(o,i.signal),fe(n),r)}finally{s&&he.delete(s)}}var S;(function(r){r.assertEqual=s=>{};function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(S||(S={}));var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));const p=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),H=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},l=S.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 D extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){const f=i.path[c];c===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],c++}}};return s(this),n}static assert(e){if(!(e instanceof D))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}D.create=r=>new D(r);const xe=(r,e)=>{let t;switch(r.code){case l.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case l.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,S.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:t=`Unrecognized key(s) in object: ${S.joinValues(r.keys,", ")}`;break;case l.invalid_union:t="Invalid input";break;case l.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${S.joinValues(r.options)}`;break;case l.invalid_enum_value:t=`Invalid enum value. Expected ${S.joinValues(r.options)}, received '${r.received}'`;break;case l.invalid_arguments:t="Invalid function arguments";break;case l.invalid_return_type:t="Invalid function return type";break;case l.invalid_date:t="Invalid date";break;case l.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:S.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case l.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case l.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case l.custom:t="Invalid input";break;case l.invalid_intersection_types:t="Intersection results could not be merged";break;case l.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case l.not_finite:t="Number must be finite";break;default:t=e.defaultError,S.assertNever(r)}return{message:t}};let dt=xe;function ft(){return dt}const ht=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(f=>!!f).slice().reverse();for(const f of c)o=f(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function m(r,e){const t=ft(),n=ht({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===xe?void 0:xe].filter(s=>!!s)});r.common.issues.push(n)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return v;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return R.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const v=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),$=r=>({status:"valid",value:r}),Le=r=>r.status==="aborted",Me=r=>r.status==="dirty",te=r=>r.status==="valid",me=r=>typeof Promise<"u"&&r instanceof Promise;var y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class M{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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 Ve=(r,e)=>{if(te(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 t=new D(r.common.issues);return this._error=t,this._error}}};function k(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))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:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return H(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(me(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={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:H(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Ve(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return te(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>te(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:H(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(me(s)?s:Promise.resolve(s));return Ve(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:l.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new K({schema:this,typeName:_.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 G.create(this,this._def)}nullable(){return ie.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return ve.create(this,this._def)}or(e){return ye.create([this,e],this._def)}and(e){return ge.create(this,e,this._def)}transform(e){return new K({...k(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ie({...k(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new Pt({typeName:_.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ee({...k(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ne.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mt=/^c[^\s-]{8,}$/i,pt=/^[0-9a-z]+$/,yt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gt=/^[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,_t=/^[a-z0-9_-]{21}$/i,vt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bt=/^[-+]?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)?)??$/,kt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let we;const wt=/^(?:(?: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])$/,St=/^(?:(?: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])$/,Tt=/^(([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]))$/,Ct=/^(([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])$/,At=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,It=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,De="((\\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])))",Et=new RegExp(`^${De}$`);function ze(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Nt(r){return new RegExp(`^${ze(r)}$`)}function Zt(r){let e=`${De}T${ze(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ot(r,e){return!!((e==="v4"||!e)&&wt.test(r)||(e==="v6"||!e)&&Tt.test(r))}function Rt(r,e){if(!vt.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));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 jt(r,e){return!!((e==="v4"||!e)&&St.test(r)||(e==="v6"||!e)&&Ct.test(r))}class z extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),v}const n=new R;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?m(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&m(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"email",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")we||(we=new RegExp(xt,"u")),we.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"emoji",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")gt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"uuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")_t.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"nanoid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")mt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")pt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")yt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ulid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),m(s,{validation:"url",code:l.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"regex",code:l.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Zt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Et.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Nt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{code:l.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?bt.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"duration",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Ot(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"ip",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Rt(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"jwt",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?jt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"cidr",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?At.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64",code:l.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?It.test(e.data)||(s=this._getOrReturnCtx(e,s),m(s,{validation:"base64url",code:l.invalid_string,message:a.message}),n.dirty()):S.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:l.invalid_string,...y.errToObj(n)})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.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,...y.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,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new z({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new z({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new z({...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}}z.create=r=>new z({checks:[],typeName:_.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});function $t(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class re extends x{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)!==p.number){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),v}let n;const s=new R;for(const a of this._def.checks)a.kind==="int"?S.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?$t(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_finite,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,s){return new re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(s)}]})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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"&&S.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}re.create=r=>new re({checks:[],typeName:_.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class ne extends x{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)!==p.bigint)return this._getInvalidInput(e);let n;const s=new R;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),m(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return m(t,{code:l.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,s){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(s)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.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}}ne.create=r=>new ne({checks:[],typeName:_.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...k(r)});class Se extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.boolean,received:n.parsedType}),v}return $(e.data)}}Se.create=r=>new Se({typeName:_.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...k(r)});class pe extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),v}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return m(a,{code:l.invalid_date}),v}const n=new R;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),m(s,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):S.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.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}}pe.create=r=>new pe({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:_.ZodDate,...k(r)});class Ue extends x{_parse(e){if(this._getType(e)!==p.symbol){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.symbol,received:n.parsedType}),v}return $(e.data)}}Ue.create=r=>new Ue({typeName:_.ZodSymbol,...k(r)});class Be extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.undefined,received:n.parsedType}),v}return $(e.data)}}Be.create=r=>new Be({typeName:_.ZodUndefined,...k(r)});class Te extends x{_parse(e){if(this._getType(e)!==p.null){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.null,received:n.parsedType}),v}return $(e.data)}}Te.create=r=>new Te({typeName:_.ZodNull,...k(r)});class Fe extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return $(e.data)}}Fe.create=r=>new Fe({typeName:_.ZodAny,...k(r)});class Ce extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $(e.data)}}Ce.create=r=>new Ce({typeName:_.ZodUnknown,...k(r)});class J extends x{_parse(e){const t=this._getOrReturnCtx(e);return m(t,{code:l.invalid_type,expected:p.never,received:t.parsedType}),v}}J.create=r=>new J({typeName:_.ZodNever,...k(r)});class qe extends x{_parse(e){if(this._getType(e)!==p.undefined){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.void,received:n.parsedType}),v}return $(e.data)}}qe.create=r=>new qe({typeName:_.ZodVoid,...k(r)});class V extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==p.array)return m(t,{code:l.invalid_type,expected:p.array,received:t.parsedType}),v;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(m(t,{code:i?l.too_big:l.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(m(t,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(m(t,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new M(t,i,t.path,o)))).then(i=>R.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new M(t,i,t.path,o)));return R.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new V({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new V({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new V({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}V.create=(r,e)=>new V({type:r,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...k(e)});function se(r){if(r instanceof I){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=G.create(se(n))}return new I({...r._def,shape:()=>e})}else return r instanceof V?new V({...r._def,type:se(r.element)}):r instanceof G?G.create(se(r.unwrap())):r instanceof ie?ie.create(se(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>se(e))):r}class I extends x{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=S.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const f=this._getOrReturnCtx(e);return m(f,{code:l.invalid_type,expected:p.object,received:f.parsedType}),v}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const f in s.data)i.includes(f)||o.push(f);const c=[];for(const f of i){const b=a[f],Z=s.data[f];c.push({key:{status:"valid",value:f},value:b._parse(new M(s,Z,s.path,f)),alwaysSet:f in s.data})}if(this._def.catchall instanceof J){const f=this._def.unknownKeys;if(f==="passthrough")for(const b of o)c.push({key:{status:"valid",value:b},value:{status:"valid",value:s.data[b]}});else if(f==="strict")o.length>0&&(m(s,{code:l.unrecognized_keys,keys:o}),n.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const b of o){const Z=s.data[b];c.push({key:{status:"valid",value:b},value:f._parse(new M(s,Z,s.path,b)),alwaysSet:b in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const f=[];for(const b of c){const Z=await b.key,L=await b.value;f.push({key:Z,value:L,alwaysSet:b.alwaysSet})}return f}).then(f=>R.mergeObjectSync(n,f)):R.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new I({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new I({...this._def,unknownKeys:"strip"})}passthrough(){return new I({...this._def,unknownKeys:"passthrough"})}extend(e){return new I({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new I({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new I({...this._def,catchall:e})}pick(e){const t={};for(const n of S.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new I({...this._def,shape:()=>t})}omit(e){const t={};for(const n of S.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new I({...this._def,shape:()=>t})}deepPartial(){return se(this)}partial(e){const t={};for(const n of S.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new I({...this._def,shape:()=>t})}required(e){const t={};for(const n of S.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof G;)a=a._def.innerType;t[n]=a}return new I({...this._def,shape:()=>t})}keyof(){return Ge(S.objectKeys(this.shape))}}I.create=(r,e)=>new I({shape:()=>r,unknownKeys:"strip",catchall:J.create(),typeName:_.ZodObject,...k(e)}),I.strictCreate=(r,e)=>new I({shape:()=>r,unknownKeys:"strict",catchall:J.create(),typeName:_.ZodObject,...k(e)}),I.lazycreate=(r,e)=>new I({shape:r,unknownKeys:"strip",catchall:J.create(),typeName:_.ZodObject,...k(e)});class ye extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new D(o.ctx.common.issues));return m(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const f={...t,common:{...t.common,issues:[]},parent:null},b=c._parseSync({data:t.data,path:t.path,parent:f});if(b.status==="valid")return b;b.status==="dirty"&&!a&&(a={result:b,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new D(c));return m(t,{code:l.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}ye.create=(r,e)=>new ye({options:r,typeName:_.ZodUnion,...k(e)});function Ae(r,e){const t=H(r),n=H(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&n===p.object){const s=S.objectKeys(e),a=S.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Ae(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===p.array&&n===p.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Ae(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===p.date&&n===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ge extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Le(a)||Le(i))return v;const o=Ae(a.value,i.value);return o.valid?((Me(a)||Me(i))&&t.dirty(),{status:t.value,value:o.data}):(m(n,{code:l.invalid_intersection_types}),v)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ge.create=(r,e,t)=>new ge({left:r,right:e,typeName:_.ZodIntersection,...k(t)});class Y extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return m(n,{code:l.invalid_type,expected:p.array,received:n.parsedType}),v;if(n.data.length<this._def.items.length)return m(n,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new M(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>R.mergeArray(t,i)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Y({...this._def,rest:e})}}Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:_.ZodTuple,rest:null,...k(e)})};class _e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return m(n,{code:l.invalid_type,expected:p.object,received:n.parsedType}),v;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new M(n,o,n.path,o)),value:i._parse(new M(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?R.mergeObjectAsync(t,s):R.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new _e({keyType:e,valueType:t,typeName:_.ZodRecord,...k(n)}):new _e({keyType:z.create(),valueType:e,typeName:_.ZodRecord,...k(t)})}}class We extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return m(n,{code:l.invalid_type,expected:p.map,received:n.parsedType}),v;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],f)=>({key:s._parse(new M(n,o,n.path,[f,"key"])),value:a._parse(new M(n,c,n.path,[f,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const f=await c.key,b=await c.value;if(f.status==="aborted"||b.status==="aborted")return v;(f.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(f.value,b.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const f=c.key,b=c.value;if(f.status==="aborted"||b.status==="aborted")return v;(f.status==="dirty"||b.status==="dirty")&&t.dirty(),o.set(f.value,b.value)}return{status:t.value,value:o}}}}We.create=(r,e,t)=>new We({valueType:e,keyType:r,typeName:_.ZodMap,...k(t)});class le extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return m(n,{code:l.invalid_type,expected:p.set,received:n.parsedType}),v;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(m(n,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(m(n,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const f=new Set;for(const b of c){if(b.status==="aborted")return v;b.status==="dirty"&&t.dirty(),f.add(b.value)}return{status:t.value,value:f}}const o=[...n.data.values()].map((c,f)=>a._parse(new M(n,c,n.path,f)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new le({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new le({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}le.create=(r,e)=>new le({valueType:r,minSize:null,maxSize:null,typeName:_.ZodSet,...k(e)});class He extends x{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})}}He.create=(r,e)=>new He({getter:r,typeName:_.ZodLazy,...k(e)});class Je extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:l.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}Je.create=(r,e)=>new Je({value:r,typeName:_.ZodLiteral,...k(e)});function Ge(r,e){return new ae({values:r,typeName:_.ZodEnum,...k(e)})}class ae extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:S.joinValues(n),received:t.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{received:t.data,code:l.invalid_enum_value,options:n}),v}return $(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 ae.create(e,{...this._def,...t})}exclude(e,t=this._def){return ae.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ae.create=Ge;class Ye extends x{_parse(e){const t=S.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const s=S.objectValues(t);return m(n,{expected:S.joinValues(s),received:n.parsedType,code:l.invalid_type}),v}if(this._cache||(this._cache=new Set(S.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=S.objectValues(t);return m(n,{received:n.data,code:l.invalid_enum_value,options:s}),v}return $(e.data)}get enum(){return this._def.values}}Ye.create=(r,e)=>new Ye({values:r,typeName:_.ZodNativeEnum,...k(e)});class ve extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return m(t,{code:l.invalid_type,expected:p.promise,received:t.parsedType}),v;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return $(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ve.create=(r,e)=>new ve({type:r,typeName:_.ZodPromise,...k(e)});class K extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{m(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?v:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!te(i))return v;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>te(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):v);S.assertNever(s)}}K.create=(r,e,t)=>new K({schema:r,typeName:_.ZodEffects,effect:e,...k(t)}),K.createWithPreprocess=(r,e,t)=>new K({schema:e,effect:{type:"preprocess",transform:r},typeName:_.ZodEffects,...k(t)});class G extends x{_parse(e){return this._getType(e)===p.undefined?$(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:_.ZodOptional,...k(e)});class ie extends x{_parse(e){return this._getType(e)===p.null?$(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ie.create=(r,e)=>new ie({innerType:r,typeName:_.ZodNullable,...k(e)});class Ie extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ie.create=(r,e)=>new Ie({innerType:r,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class Ee extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return me(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new D(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class Ke extends x{_parse(e){if(this._getType(e)!==p.nan){const n=this._getOrReturnCtx(e);return m(n,{code:l.invalid_type,expected:p.nan,received:n.parsedType}),v}return{status:"valid",value:e.data}}}Ke.create=r=>new Ke({typeName:_.ZodNaN,...k(r)});class Pt extends x{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ne extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ce(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?v:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ne({in:e,out:t,typeName:_.ZodPipeline})}}class Ze extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(te(s)&&(s.value=Object.freeze(s.value)),s);return me(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:_.ZodReadonly,...k(e)});var _;(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"})(_||(_={}));const h=z.create,w=re.create,Qe=ne.create,j=Se.create,Lt=Te.create,u=Ce.create;J.create;const E=V.create,g=I.create,T=ye.create;ge.create;const Mt=Y.create,d=_e.create;ae.create,ve.create,G.create,ie.create;const U=K.createWithPreprocess,P=()=>T([Qe(),w().finite()]).transform(r=>BigInt(r));g({key:h()}),g({key:h(),value:h()}),g({key:h()}),g({});const Vt=g({items:d(u())});U(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)&&!("items"in r)?{items:r}:r,Vt);const Dt=g({keys:E(h()),defaults:d(u()).optional()});U(r=>Array.isArray(r)?{keys:r}:r,Dt),g({});const zt=g({keys:E(h())});U(r=>Array.isArray(r)?{keys:r}:r,zt),g({}),g({}),T([Mt([T([g({text:h()}),h()])]),g({text:h().optional(),value:h().optional()})]),g({url:h(),method:h().default("GET"),headers:d(h()).default({}),body:h().nullable().default(null),timeout:P().default(30000n)}),g({duration:P()});const ue=()=>h().regex(/^e\d+$/),Ut='use { refId: "e2" } or { label: "..." } object form, not positional arguments',Oe=(r,e)=>{if(r.__invalidPositional!==void 0){e.addIssue({code:l.custom,message:Ut});return}!r.refId&&!r.label&&e.addIssue({code:l.custom,message:"Either refId or label is required"})},Xe=(r,e)=>{r.x!==void 0||r.y!==void 0||Oe(r,e)},O=r=>U(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,g({__invalidPositional:T([h(),w()]).optional(),refId:ue().optional(),label:h().optional(),...r}).superRefine(Oe)),de={tabId:T([w(),Qe()]).optional()},Q=r=>U(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,g({__invalidPositional:T([h(),w()]).optional(),...de,refId:ue().optional(),label:h().optional(),...r}).superRefine(Oe)),Bt=g({}),Ft=g({});g({url:h(),timeout:P().optional()});const qt=g({});g({}),g({}),g({duration:P().default(1000n)});const Wt=O(),Ht=O({value:h()}),Jt=O({text:h()}),Gt=O({text:h()}),Yt=g({key:h()}),Kt=O({value:h()}),Qt=O({checked:j().optional()}),Xt=O(),er=g({}),tr=g({direction:h().default("down"),amount:w().default(300)}),rr=U(r=>typeof r=="string"||typeof r=="number"?{__invalidPositional:r}:r,g({__invalidPositional:T([h(),w()]).optional(),refId:ue().optional(),label:h().optional(),x:w().optional(),y:w().optional()}).superRefine(Xe)),nr=O();g({selector:h()}),g({selector:h(),timeout:P().default(30000n)});const sr=g({fields:E(h())});U(r=>Array.isArray(r)?{fields:r}:r,sr),T([w(),E(u()),d(u())]),g({}),d(u()),U(r=>typeof r=="string"?{url:r}:r,g({url:h().optional(),active:j().optional()})),T([w(),E(u()),d(u())]),T([w(),E(u()),d(u())]),d(u());const ar=Q(),ir=Q({value:h()}),or=U(r=>typeof r=="string"||typeof r=="number"?{__invalidPositional:r}:r,g({__invalidPositional:T([h(),w()]).optional(),...de,refId:ue().optional(),label:h().optional(),x:w().optional(),y:w().optional()}).superRefine(Xe)),cr=Q({text:h()}),lr=g({...de,key:h()}),ur=Q({value:h()}),dr=Q({checked:j().optional()}),fr=Q(),hr=g({...de}),mr=g({...de,direction:h().default("down"),amount:w().default(300)}),pr=Q();d(u());const yr=d(u());d(u()),d(u()),d(u()),d(u()),d(u()),O(),O(),O({value:h().optional()}),O({text:h().optional()}),g({key:h().optional()}),O({value:h().optional()}),O({checked:j().optional()}),O(),g({}),g({direction:h().optional(),amount:w().optional()}),O(),O({text:h().optional()}),g({}),g({}),g({duration:P().default(1000n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({interactive_only:j().default(!1),max_nodes:P().default(500n)}),g({snapshot:u(),format:h().optional()});const gr=d(u());d(u()),d(u()),g({path:h()}),g({from:h(),to:h()}),g({path:h(),data:h()}),g({path:h(),offset:P(),len:w()}),g({path:h(),offset:P(),data:h()}),g({path:h(),algo:h().default("sha256")}),d(u()),d(u()),d(u()),d(u()),T([w(),d(u())]),T([w(),d(u())]),d(u()),d(u()),d(u()),T([h(),d(u())]),d(u()),d(u()),d(u()),d(u()),d(u()),T([h(),w(),d(u())]),d(u()),d(u()),d(u()),T([w(),d(u())]),d(u()),d(u()),d(u()),d(u()),d(u()),E(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),T([h(),d(u())]),d(u()),d(u()),T([w(),d(u())]),d(u()),d(u()),T([w(),d(u())]),d(u()),T([h(),w(),d(u())]),d(u()),d(u()),d(u()),d(u()),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),T([w(),d(u())]),d(u()),d(u()),d(u()),d(u()),g({status:w(),ok:j(),headers:d(h()),body:h()}),g({data:u(),text:h()});const _r=g({refId:ue(),role:h(),tag:h(),name:h().optional()}),vr=g({text:h(),nodes:E(_r),url:h(),title:h(),viewport:g({width:w(),height:w()})}),br=d(u());E(br);const kr=d(u());E(kr),d(u()).nullable(),E(d(u())),E(d(u())),E(d(u())),E(d(u())),h(),j(),T([h(),w()]),j();const xr=d(u());E(xr),E(d(u())),E(d(u()));const wr=d(u());E(wr),w(),d(u()),d(u()),E(d(u()));const Sr=new Set(["page_url","page_title","page_click","page_fill","page_type","page_append","page_press","page_select","page_check","page_hover","page_unhover","page_scroll","page_scroll_to","page_dblclick","page_back","tab_click","tab_fill","tab_type","tab_press","tab_select","tab_check","tab_hover","tab_unhover","tab_scroll","tab_scroll_to","tab_dblclick","tab_back"]);function Tr(r){if(r.startsWith("page_")||r.startsWith("tab_")){const e=r.indexOf("_");if(e>=0)return r.slice(e+1)}return r}const C={string:h(),null:Lt(),boolean:j()},Cr={page_url:{params:Bt,returns:C.string},page_title:{params:Ft,returns:C.string},page_click:{params:Wt,returns:C.null},page_fill:{params:Ht,returns:C.null},page_type:{params:Jt,returns:C.null},page_append:{params:Gt,returns:C.null},page_press:{params:Yt,returns:C.null},page_select:{params:Kt,returns:C.null},page_check:{params:Qt,returns:C.null},page_hover:{params:Xt,returns:C.null},page_unhover:{params:er,returns:C.null},page_scroll:{params:tr,returns:C.boolean},page_scroll_to:{params:rr,returns:C.boolean},page_dblclick:{params:nr,returns:C.null},page_back:{params:qt,returns:C.boolean},tab_click:{params:ar,returns:C.null},tab_fill:{params:ir,returns:C.null},tab_type:{params:cr,returns:C.null},tab_press:{params:lr,returns:C.null},tab_select:{params:ur,returns:C.null},tab_check:{params:dr,returns:C.null},tab_hover:{params:fr,returns:C.null},tab_unhover:{params:hr,returns:C.null},tab_scroll:{params:mr,returns:C.boolean},tab_scroll_to:{params:or,returns:C.boolean},tab_dblclick:{params:pr,returns:C.null},tab_back:{params:yr,returns:C.boolean}};function Ar(){return[{registryAction:"ping",handlerKey:"ping",params:g({}),returns:g({ok:j()})},{registryAction:"snapshot",handlerKey:"snapshot",params:gr,returns:vr}]}function Ir(){const r=[];for(const e of Sr){const t=Cr[e];if(!t)throw new Error(`Missing content-script schemas for action: ${e}`);const n=e.indexOf("_"),s=n>=0?e.slice(n+1):e;r.push({registryAction:e,handlerKey:s,params:t.params,returns:t.returns})}return r}const B={debug:0,info:1,warn:2,error:3,none:4};let et=B.error;function Er(r){if(!r)return"";const e=[];for(const[t,n]of Object.entries(r)){let s;if(n===null)s="null";else if(n===void 0)s="undefined";else if(typeof n=="string")s=n;else if(typeof n=="number"||typeof n=="boolean")s=String(n);else try{s=JSON.stringify(n)}catch{s="[Circular]"}e.push(`${t}=${s}`)}return e.length>0?` ${e.join(" ")}`:""}function be(r,e,t){if(r<et)return;const n=Er(t),s=`[extension-js][content-script] ${e}${n}`;r>=B.error?console.error(s):r===B.warn?console.warn(s):console.log(s)}const X={debug:(r,e)=>{be(B.debug,r,e)},info:(r,e)=>{be(B.info,r,e)},warn:(r,e)=>{be(B.warn,r,e)},error:(r,e)=>{be(B.error,r,e)}};function Nr(){window.__jsNotebookSetLogLevel=r=>{et=B[r]??B.error}}function F(r){return document.querySelector(`[data-ref-id='${CSS.escape(r)}']`)}function q(r){var n,s,a;const e=r.toLowerCase().trim();if(!e)return null;const t=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const i of t){const o=i.getAttribute("aria-label");if(o&&o.toLowerCase().trim()===e)return i;const c=i.placeholder;if(c&&c.toLowerCase().trim()===e)return i;const f=i.id;if(f){const L=document.querySelector(`label[for='${CSS.escape(f)}']`);if(L&&((n=L.textContent)==null?void 0:n.trim().toLowerCase())===e)return i}const b=i.closest("label");if(b&&((s=b.textContent)==null?void 0:s.trim().toLowerCase())===e||(((a=i.textContent)==null?void 0:a.trim().toLowerCase())||"")===e)return i}return null}function Zr(r){var s;const e=r.toLowerCase().trim(),t=new Set,n=Array.from(document.querySelectorAll('input, textarea, select, button, a, [role="button"], [role="link"]'));for(const a of n){const i=a.getAttribute("aria-label");i&&t.add(i.trim());const o=a.placeholder;o&&t.add(o.trim());const c=((s=a.textContent)==null?void 0:s.trim())||"";c&&t.add(c)}return Array.from(t).filter(a=>a.toLowerCase().includes(e)).slice(0,5)}function ee(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}function A(r,e){const t=ee(r)[e];return typeof t=="string"?t:""}function tt(r,e,t){const n=ee(r)[e];return typeof n=="number"?n:t}function W(r,e,t=!1,n){const s=r?"refId":e?"label":null,a=r||e;let i=`Element not found${s?` by ${s} "${a}"`:""}`;if(t&&a){const c=Zr(a);i+=`. Candidates: ${c.join(", ")||"none"}`}throw new Error(i)}function Re(r){const e=r.tagName.toLowerCase(),t=r.getAttribute("role");if(t)return t;if(e==="button"||e==="input"&&r.type==="submit")return"button";if(e==="a")return"link";if(e==="input"){const n=r.type;if(n==="text"||n==="email"||n==="password"||n==="search")return"textbox";if(n==="checkbox")return"checkbox";if(n==="radio")return"radio";if(n==="submit"||n==="button")return"button"}return e==="textarea"?"textbox":e==="select"?"combobox":e==="img"?"img":e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6"?"heading":e==="li"?"listitem":e==="ul"||e==="ol"?"list":e==="table"?"table":e==="tr"?"row":e==="td"||e==="th"?"cell":e==="nav"?"navigation":e==="main"?"main":e==="article"?"article":e==="section"?"region":e==="aside"?"complementary":e==="form"?"form":e==="dialog"||e==="modal"?"dialog":e==="figure"?"figure":e==="figcaption"?"caption":r.getAttribute("onclick")||r.onclick?"button":"generic"}function Or(r){var i,o;const e=r.getAttribute("aria-label");if(e)return e;const t=r.getAttribute("aria-labelledby");if(t){const c=document.getElementById(t);if(c)return((i=c.textContent)==null?void 0:i.slice(0,60))||""}if(r.tagName.toLowerCase()==="img"){const c=r.getAttribute("alt");if(c)return c}const s=r.title;if(s)return s;const a=Re(r);return a!=="generic"&&a!=="list"&&a!=="table"&&a!=="row"&&a!=="region"&&a!=="navigation"&&a!=="main"&&((o=r.textContent)==null?void 0:o.trim().slice(0,60))||""}function Rr(r){const e=Re(r);if(e==="generic"||e==="presentation"||e==="none"||r.hidden)return!1;const t=window.getComputedStyle(r);return!(t.display==="none"||t.visibility==="hidden")}function jr(r){let e=1;const t=[],n=[];function s(i,o){if(t.length>=r)return;const c=i.tagName.toLowerCase();if(c==="script"||c==="style"||c==="noscript"||c==="template")return;const f=Rr(i);let b=o;if(f){const Z="e"+e++;i.setAttribute("data-ref-id",Z);const L=Re(i),oe=Or(i),nt={refId:Z,role:L,tag:c};oe&&(nt.name=oe),t.push(nt);const je=[`${" ".repeat(o)}- ${L}`];oe&&je.push(`"${oe.replace(/"/g,'\\"')}"`),je.push(`[${Z}]`),n.push(je.join(" ")),b=o+1}for(const Z of i.children)s(Z,b)}return document.body&&s(document.body,0),{text:[`URL: ${window.location.href}`,`Title: ${document.title}`,""].concat(n).join(`
|
|
2
|
+
`),nodes:t,url:window.location.href,title:document.title,viewport:{width:window.innerWidth,height:window.innerHeight}}}const $r=3e4,Pr={click:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;return!n&&t&&(n=q(t)),n||W(e,t,!0),n.click(),null},fill:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"value");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},type:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"text");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},append:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"text");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t,!0),s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement){s.value+=n;const a=new InputEvent("input",{bubbles:!0});return s.dispatchEvent(a),null}throw new Error("Element is not an input")},press:r=>{const e=A(r,"key"),t=new KeyboardEvent("keydown",{key:e,bubbles:!0});document.dispatchEvent(t);const n=new KeyboardEvent("keyup",{key:e,bubbles:!0});return document.dispatchEvent(n),null},select:r=>{const e=A(r,"refId"),t=A(r,"label"),n=A(r,"value");let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t),s instanceof HTMLSelectElement)return s.value=n,null;throw new Error("Element is not a select")},check:r=>{const e=A(r,"refId"),t=A(r,"label"),n=(()=>{const a=ee(r);return typeof a.checked=="boolean"?a.checked:!0})();let s=e?F(e):null;if(!s&&t&&(s=q(t)),s||W(e,t),s instanceof HTMLInputElement&&s.type==="checkbox")return s.checked=n,null;throw new Error("Element is not a checkbox")},hover:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;!n&&t&&(n=q(t)),n||W(e,t);const s=new MouseEvent("mouseenter",{bubbles:!0});return n.dispatchEvent(s),null},unhover:()=>{const r=new MouseEvent("mouseleave",{bubbles:!0});return document.body.dispatchEvent(r),null},scroll:r=>{const e=ee(r),t=e.direction??"down",n=typeof e.amount=="number"?e.amount:300;return window.scrollBy({top:t==="down"?n:-n,behavior:"smooth"}),!0},dblclick:r=>{const e=A(r,"refId"),t=A(r,"label");let n=e?F(e):null;!n&&t&&(n=q(t)),n||W(e,t);const s=new MouseEvent("dblclick",{bubbles:!0});return n.dispatchEvent(s),null},forward:()=>(window.history.forward(),!0),reload:()=>(window.location.reload(),!0),scroll_to:r=>{const e=A(r,"refId"),t=A(r,"label"),n=tt(r,"x",0),s=tt(r,"y",0);if(e||t){let a=e?F(e):null;if(!a&&t&&(a=q(t)),a)return a.scrollIntoView({behavior:"smooth"}),!0;W(e,t)}return window.scrollTo({top:s,left:n,behavior:"smooth"}),!0},evaluate:r=>{const e=A(r,"code");if(typeof e!="string")throw new Error("evaluate requires a string argument");return new Function(e)()},back:()=>(window.history.back(),!0),url:()=>window.location.href,title:()=>document.title,ping:()=>({ok:!0}),snapshot:async r=>{const e=ee(r),t=typeof e.max_nodes=="number"?e.max_nodes:500;X.debug("snapshot",{maxNodes:t,hasBody:!!document.body});const n=jr(t);return X.debug("snapshot_result",{nodeCount:n.nodes.length}),n},fetch:async(r,e)=>{const t=ee(r),n=t.url,s=(t.method||"GET").toString().toUpperCase(),a=t.headers||{},i=t.body??null,o=typeof t.timeout=="number"?t.timeout:$r,c=new AbortController,f=()=>c.abort();if(e){if(e.aborted)throw new DOMException("Aborted","AbortError");e.addEventListener("abort",f,{once:!0})}const b=setTimeout(()=>c.abort(),o);try{const Z={method:s,headers:typeof a=="object"&&a!==null?a:{},signal:c.signal};i!=null&&(Z.body=typeof i=="string"?i:String(i));const L=await fetch(n,Z),oe=await L.text();return{status:L.status,ok:L.ok,headers:Object.fromEntries(L.headers.entries()),body:oe}}catch(Z){throw Z}finally{clearTimeout(b),e==null||e.removeEventListener("abort",f)}}};function Lr(r,e){if(ke(r))return r;const t=`page_${e}`;return ke(t)?t:r}function rt(r,e,t,n,s){const a=Lr(r,e),i=Pr[e];return i?(ut(a,e,i,t,s).then(c=>{X.debug("dispatch_response",{registryAction:r,handlerAction:e,ok:c.ok}),n(c)}).catch(c=>{const f=c instanceof Error?c.message:String(c);X.debug("dispatch_error",{registryAction:r,handlerAction:e,error:f}),n({ok:!1,error:f||String(c)})}),!0):(X.debug("no_handler",{action:e,registryAction:r}),n({ok:!1,error:`Unknown content script action: ${e}`}),!1)}function Mr(){chrome.runtime.onMessage.addListener((r,e,t)=>{if(e.id!==chrome.runtime.id)return X.warn("unauthorized_sender",{senderId:e.id,expected:chrome.runtime.id}),t({ok:!1,error:"Unauthorized sender"}),!1;const n=ee(r),s=String(n.type??""),a=String(n.action??"");if(X.debug("received",{messageType:s,action:a,hasParams:!!n.params}),s==="registryCallCancel"){const i=String(n.id??"");return lt(i),t({ok:!0}),!1}if(s==="registryCall"){const i=Tr(a),o=typeof n.id=="string"?n.id:void 0;return rt(a,i,n.params,t,o)}return!a&&s==="contract-ping"?(t({ok:!0}),!1):a?rt(a,a,n.params,t):(t({ok:!1,error:"Missing action"}),!1)})}if(Nr(),window.__jsNotebookContentScriptInjected)throw new Error("Content script already injected");window.__jsNotebookContentScriptInjected=!0,ct([...Ir(),...Ar()]),Mr()})();
|
package/extension_js.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export type WasmCellStatus = "done" | "async_pending";
|
|
|
65
65
|
/**
|
|
66
66
|
* Structured error from running a cell.
|
|
67
67
|
*/
|
|
68
|
-
export type WasmCellError = { kind: "compile"; message: string; line: number | null } | { kind: "runtime"; message: string; line: number | null } | { kind: "fuel_exhausted" } | { kind: "internal"; message: string };
|
|
68
|
+
export type WasmCellError = { kind: "compile"; name: string | null; message: string; line: number | null } | { kind: "runtime"; name: string | null; message: string; line: number | null; action: string | null; code: string | null } | { kind: "fuel_exhausted" } | { kind: "internal"; message: string };
|
|
69
69
|
|
|
70
70
|
export interface CollectOptions {
|
|
71
71
|
includeHidden?: boolean;
|
|
@@ -162,6 +162,8 @@ export interface JsManifestEntry {
|
|
|
162
162
|
returnsDoc: JsReturnDoc;
|
|
163
163
|
errorCode: string;
|
|
164
164
|
errorCategory: string | null;
|
|
165
|
+
permission: string | null;
|
|
166
|
+
example: string | null;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
export interface JsParamDoc {
|
|
@@ -254,6 +256,10 @@ export type SnapshotFormat = "compact-text" | "json" | "json-pretty";
|
|
|
254
256
|
export class ExtensionSession {
|
|
255
257
|
free(): void;
|
|
256
258
|
[Symbol.dispose](): void;
|
|
259
|
+
/**
|
|
260
|
+
* Generate API documentation for every registered public API.
|
|
261
|
+
*/
|
|
262
|
+
apiDocs(format: string): string;
|
|
257
263
|
fsAppend(params: FsWriteParams): Promise<FsBoolResult>;
|
|
258
264
|
fsAppendBase64(params: FsWriteParams): Promise<FsBoolResult>;
|
|
259
265
|
fsAppendText(params: FsWriteParams): Promise<FsBoolResult>;
|
|
@@ -321,8 +327,6 @@ export function format_snapshot_js(snapshot: TreeSnapshot, format?: SnapshotForm
|
|
|
321
327
|
|
|
322
328
|
export function freezeManifest(): void;
|
|
323
329
|
|
|
324
|
-
export function generateApiDocs(format: string): string;
|
|
325
|
-
|
|
326
330
|
export function importManifestEntries(entries: Array<any>): void;
|
|
327
331
|
|
|
328
332
|
export function main(): void;
|
|
@@ -334,7 +338,7 @@ export function registerJsCallBatch(items: Array<any>): void;
|
|
|
334
338
|
export function registerSharedDispatch(callback: Function): void;
|
|
335
339
|
|
|
336
340
|
/**
|
|
337
|
-
* 0=
|
|
341
|
+
* 0=trace, 1=debug, 2=info, 3=warn, 4=error, 5=none
|
|
338
342
|
*/
|
|
339
343
|
export function setLogLevel(level: number): void;
|
|
340
344
|
|
|
@@ -343,6 +347,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
343
347
|
export interface InitOutput {
|
|
344
348
|
readonly memory: WebAssembly.Memory;
|
|
345
349
|
readonly __wbg_extensionsession_free: (a: number, b: number) => void;
|
|
350
|
+
readonly extensionsession_apiDocs: (a: number, b: number, c: number) => [number, number, number, number];
|
|
346
351
|
readonly extensionsession_fsAppend: (a: number, b: any) => any;
|
|
347
352
|
readonly extensionsession_fsAppendBase64: (a: number, b: any) => any;
|
|
348
353
|
readonly extensionsession_fsAppendText: (a: number, b: any) => any;
|
|
@@ -371,8 +376,7 @@ export interface InitOutput {
|
|
|
371
376
|
readonly extensionsession_setAborted: (a: number, b: number) => void;
|
|
372
377
|
readonly extensionsession_set_fuel_limit: (a: number, b: number) => void;
|
|
373
378
|
readonly extensionsession_stopWith: (a: number) => void;
|
|
374
|
-
readonly freezeManifest: () =>
|
|
375
|
-
readonly generateApiDocs: (a: number, b: number) => [number, number, number, number];
|
|
379
|
+
readonly freezeManifest: () => [number, number];
|
|
376
380
|
readonly importManifestEntries: (a: any) => [number, number];
|
|
377
381
|
readonly main: () => void;
|
|
378
382
|
readonly registerJsCall: (a: any, b: any) => [number, number];
|