@pi-oxide/extension-js 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content-script.js +2 -2
- package/extension_js.d.ts +8 -0
- package/extension_js.js +62297 -62078
- package/index.js +2567 -2012
- package/package.json +1 -1
- package/worker.js +119 -143
package/content-script.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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:
|
|
1
|
+
(function(){"use strict";function Ce(t){return t==null?{}:t instanceof Map?Object.fromEntries([...t.entries()].map(([e,r])=>[e,Ce(r)])):Array.isArray(t)?t.map(Ce):t}function _t(t,e){const r=t?"refId":null,n=t||(e==null?void 0:e.label)||"";return{message:`Element not found${r?` by ${r} "${n}"`:""}`,code:"E_STALE",category:"resource",hint:"RefIds are ephemeral. They are assigned at snapshot time and invalidated when the DOM is replaced (navigation, SPA rerender, autocomplete).",recovery:["const d = await page.snapshot_data(); find the target in d.nodes","Use a fresh refId from that snapshot only","Do not reuse refIds from before press/click/navigation"],details:{staleRefId:t||void 0}}}function kt(t,e,r){return{message:`${t} on ${e} returned no effect.`,code:"E_NOT_INTERACTABLE",category:"resource",hint:"Some sites ignore programmatic value assignment; value may not appear in snapshot_data.",recovery:[`await page.click({ refId: ${JSON.stringify(e)} }) then await page.type({ refId: ${JSON.stringify(e)}, text: "..." })`,'Or await page.press({ key: "Enter" }) after fill',"Re-snapshot and confirm URL or node state changed"],details:{refId:e,...r}}}function wt(t){return t.includes("Could not establish connection")||t.includes("Receiving end does not exist")||t.includes("Timeout waiting for content-script ping")||t.includes("content script not available")}function Ae(t){const e=new Error(t.message);throw e.code=t.code,t.category&&(e.category=t.category),t.hint&&(e.hint=t.hint),t.recovery&&(e.recovery=t.recovery),t.details&&(e.details=t.details),e}function xt(t,e){let r=`Element not found by label "${t}"`;if(e!=null&&e.length){const n=e.map(a=>a.name||a.refId).filter(Boolean).slice(0,5);r+=n.length>0?`. Candidates: ${n.join(", ")}`:". Candidates: none"}return{message:r,code:"E_NOT_FOUND",category:"resource",hint:"No element matched this label. Check candidates or snapshot for visible controls.",recovery:["const d = await page.snapshot_data(); find the target in d.nodes","Try a more specific label or use refId from snapshot"],details:e!=null&&e.length?{label:t,candidates:e}:{label:t}}}function It(t,e){if(typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="string"&&"message"in t&&typeof t.message=="string"){const n=t;return n.hint||n.recovery||n.code==="E_CONTENT_SCRIPT"&&(e==null?void 0:e.tabId)!=null,n}const r=(t instanceof Error?t.message:String(t))||"";return wt(r)?{message:"Content script is not connected on this tab.",code:"E_CONTENT_SCRIPT",category:"content-script",hint:"page.snapshot() uses script injection and can succeed even when fill/click cannot. This tab was likely open before the extension loaded (MV3 does not retro-inject).",recovery:[`await page.goto(${JSON.stringify("")})`,"Or ask the user to refresh the target tab, then retry fill/click"]}:r.includes("permission")||r.includes("Permission")?{message:r,code:"E_PERMISSION",category:"permission"}:r.includes("not found")||r.includes("No tab")||r.includes("No active tab")?{message:r,code:"E_NOT_FOUND",category:"resource"}:{message:r,code:"E_EXTENSION",category:"extension"}}var S;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return t.objectValues(s)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(const s of a)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(S||(S={}));var Qe;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Qe||(Qe={}));const m=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ee=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},u=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 L 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 r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,l=0;for(;l<s.path.length;){const f=s.path[l];l===s.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(r(s))):o[f]=o[f]||{_errors:[]},o=o[f],l++}}};return a(this),n}static assert(e){if(!(e instanceof L))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=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}L.create=t=>new L(t);const me=(t,e)=>{let r;switch(t.code){case u.invalid_type:t.received===m.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case u.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,S.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:r=`Unrecognized key(s) in object: ${S.joinValues(t.keys,", ")}`;break;case u.invalid_union:r="Invalid input";break;case u.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${S.joinValues(t.options)}`;break;case u.invalid_enum_value:r=`Invalid enum value. Expected ${S.joinValues(t.options)}, received '${t.received}'`;break;case u.invalid_arguments:r="Invalid function arguments";break;case u.invalid_return_type:r="Invalid function return type";break;case u.invalid_date:r="Invalid date";break;case u.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:S.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case u.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case u.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case u.custom:r="Invalid input";break;case u.invalid_intersection_types:r="Intersection results could not be merged";break;case u.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case u.not_finite:r="Number must be finite";break;default:r=e.defaultError,S.assertNever(t)}return{message:r}};let Tt=me;function Le(){return Tt}const qe=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const l=n.filter(f=>!!f).slice().reverse();for(const f of l)o=f(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}};function h(t,e){const r=Le(),n=qe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===me?void 0:me].filter(a=>!!a)});t.common.issues.push(n)}class P{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return _;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return P.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return _;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),be=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),et=t=>t.status==="aborted",tt=t=>t.status==="dirty",le=t=>t.status==="valid",Ne=t=>typeof Promise<"u"&&t instanceof Promise;var b;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(b||(b={}));class B{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const rt=(t,e)=>{if(le(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new L(t.common.issues);return this._error=r,this._error}}};function w(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}class T{get description(){return this._def.description}_getType(e){return ee(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Ne(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},a=this._parseSync({data:e,path:n.path,parent:n});return rt(n,a)}"~validate"(e){var n,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return le(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(a=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>le(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(Ne(a)?a:Promise.resolve(a));return rt(n,i)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const s=e(a),o=()=>i.addIssue({code:u.custom,...n(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new K({schema:this,typeName:k.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:r=>this["~validate"](r)}}optional(){return V.create(this,this._def)}nullable(){return ne.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return pe.create(this,this._def)}or(e){return ve.create([this,e],this._def)}and(e){return _e.create(this,e,this._def)}transform(e){return new K({...w(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Ie({...w(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new Ke({typeName:k.ZodBranded,type:this,...w(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Te({...w(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Me.create(this,e)}readonly(){return Se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const St=/^c[^\s-]{8,}$/i,Et=/^[0-9a-z]+$/,Ct=/^[0-9A-HJKMNP-TV-Z]{26}$/i,At=/^[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,Nt=/^[a-z0-9_-]{21}$/i,Ot=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rt=/^[-+]?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)?)??$/,Dt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ze;const Pt=/^(?:(?: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])$/,jt=/^(?:(?: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])$/,$t=/^(([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]))$/,Lt=/^(([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])$/,qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nt="((\\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])))",Vt=new RegExp(`^${nt}$`);function at(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Bt(t){return new RegExp(`^${at(t)}$`)}function Ut(t){let e=`${nt}T${at(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Wt(t,e){return!!((e==="v4"||!e)&&Pt.test(t)||(e==="v6"||!e)&&$t.test(t))}function Ft(t,e){if(!Ot.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function zt(t,e){return!!((e==="v4"||!e)&&jt.test(t)||(e==="v6"||!e)&&Lt.test(t))}class U extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return h(i,{code:u.invalid_type,expected:m.string,received:i.parsedType}),_}const n=new P;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?h(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&h(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Dt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"email",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ze||(Ze=new RegExp(Mt,"u")),Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"emoji",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")At.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"uuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Nt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"nanoid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")St.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Et.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid2",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ct.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ulid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),h(a,{validation:"url",code:u.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"regex",code:u.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ut(i).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Vt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Bt(i).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:u.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Rt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"duration",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Wt(e.data,i.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ip",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Ft(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"jwt",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?zt(e.data,i.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cidr",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?qt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Zt.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64url",code:u.invalid_string,message:i.message}),n.dirty()):S.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:u.invalid_string,...b.errToObj(n)})}_addCheck(e){return new U({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.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,...b.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,...b.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...b.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...b.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...b.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...b.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...b.errToObj(r)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new U({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new U({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new U({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}U.create=t=>new U({checks:[],typeName:k.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...w(t)});function Ht(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,i=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}class ae extends T{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)!==m.number){const i=this._getOrReturnCtx(e);return h(i,{code:u.invalid_type,expected:m.number,received:i.parsedType}),_}let n;const a=new P;for(const i of this._def.checks)i.kind==="int"?S.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Ht(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:u.not_finite,message:i.message}),a.dirty()):S.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,b.toString(r))}gt(e,r){return this.setLimit("min",e,!1,b.toString(r))}lte(e,r){return this.setLimit("max",e,!0,b.toString(r))}lt(e,r){return this.setLimit("max",e,!1,b.toString(r))}setLimit(e,r,n,a){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:b.toString(a)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.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,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}ae.create=t=>new ae({checks:[],typeName:k.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...w(t)});class ie extends T{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)!==m.bigint)return this._getInvalidInput(e);let n;const a=new P;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):S.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return h(r,{code:u.invalid_type,expected:m.bigint,received:r.parsedType}),_}gte(e,r){return this.setLimit("min",e,!0,b.toString(r))}gt(e,r){return this.setLimit("min",e,!1,b.toString(r))}lte(e,r){return this.setLimit("max",e,!0,b.toString(r))}lt(e,r){return this.setLimit("max",e,!1,b.toString(r))}setLimit(e,r,n,a){return new ie({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:b.toString(a)}]})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ie.create=t=>new ie({checks:[],typeName:k.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...w(t)});class Oe extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.boolean,received:n.parsedType}),_}return j(e.data)}}Oe.create=t=>new Oe({typeName:k.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...w(t)});class ge extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return h(i,{code:u.invalid_type,expected:m.date,received:i.parsedType}),_}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return h(i,{code:u.invalid_date}),_}const n=new P;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):S.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ge.create=t=>new ge({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:k.ZodDate,...w(t)});class it extends T{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.symbol,received:n.parsedType}),_}return j(e.data)}}it.create=t=>new it({typeName:k.ZodSymbol,...w(t)});class Re extends T{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.undefined,received:n.parsedType}),_}return j(e.data)}}Re.create=t=>new Re({typeName:k.ZodUndefined,...w(t)});class ye extends T{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.null,received:n.parsedType}),_}return j(e.data)}}ye.create=t=>new ye({typeName:k.ZodNull,...w(t)});class Ve extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}}Ve.create=t=>new Ve({typeName:k.ZodAny,...w(t)});class se extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}}se.create=t=>new se({typeName:k.ZodUnknown,...w(t)});class te extends T{_parse(e){const r=this._getOrReturnCtx(e);return h(r,{code:u.invalid_type,expected:m.never,received:r.parsedType}),_}}te.create=t=>new te({typeName:k.ZodNever,...w(t)});class Be extends T{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.void,received:n.parsedType}),_}return j(e.data)}}Be.create=t=>new Be({typeName:k.ZodVoid,...w(t)});class Z extends T{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==m.array)return h(r,{code:u.invalid_type,expected:m.array,received:r.parsedType}),_;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(h(r,{code:s?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(h(r,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(h(r,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,o)=>a.type._parseAsync(new B(r,s,r.path,o)))).then(s=>P.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new B(r,s,r.path,o)));return P.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new Z({...this._def,minLength:{value:e,message:b.toString(r)}})}max(e,r){return new Z({...this._def,maxLength:{value:e,message:b.toString(r)}})}length(e,r){return new Z({...this._def,exactLength:{value:e,message:b.toString(r)}})}nonempty(e){return this.min(1,e)}}Z.create=(t,e)=>new Z({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...w(e)});function ue(t){if(t instanceof O){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=V.create(ue(n))}return new O({...t._def,shape:()=>e})}else return t instanceof Z?new Z({...t._def,type:ue(t.element)}):t instanceof V?V.create(ue(t.unwrap())):t instanceof ne?ne.create(ue(t.unwrap())):t instanceof W?W.create(t.items.map(e=>ue(e))):t}class O extends T{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(),r=S.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==m.object){const f=this._getOrReturnCtx(e);return h(f,{code:u.invalid_type,expected:m.object,received:f.parsedType}),_}const{status:n,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof te&&this._def.unknownKeys==="strip"))for(const f in a.data)s.includes(f)||o.push(f);const l=[];for(const f of s){const v=i[f],E=a.data[f];l.push({key:{status:"valid",value:f},value:v._parse(new B(a,E,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof te){const f=this._def.unknownKeys;if(f==="passthrough")for(const v of o)l.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(f==="strict")o.length>0&&(h(a,{code:u.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 v of o){const E=a.data[v];l.push({key:{status:"valid",value:v},value:f._parse(new B(a,E,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const f=[];for(const v of l){const E=await v.key,$=await v.value;f.push({key:E,value:$,alwaysSet:v.alwaysSet})}return f}).then(f=>P.mergeObjectSync(n,f)):P.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new O({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s;const a=((s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:b.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new O({...this._def,unknownKeys:"strip"})}passthrough(){return new O({...this._def,unknownKeys:"passthrough"})}extend(e){return new O({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new O({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:k.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new O({...this._def,catchall:e})}pick(e){const r={};for(const n of S.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new O({...this._def,shape:()=>r})}omit(e){const r={};for(const n of S.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new O({...this._def,shape:()=>r})}deepPartial(){return ue(this)}partial(e){const r={};for(const n of S.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new O({...this._def,shape:()=>r})}required(e){const r={};for(const n of S.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof V;)i=i._def.innerType;r[n]=i}return new O({...this._def,shape:()=>r})}keyof(){return st(S.objectKeys(this.shape))}}O.create=(t,e)=>new O({shape:()=>t,unknownKeys:"strip",catchall:te.create(),typeName:k.ZodObject,...w(e)}),O.strictCreate=(t,e)=>new O({shape:()=>t,unknownKeys:"strict",catchall:te.create(),typeName:k.ZodObject,...w(e)}),O.lazycreate=(t,e)=>new O({shape:t,unknownKeys:"strip",catchall:te.create(),typeName:k.ZodObject,...w(e)});class ve extends T{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(o=>new L(o.ctx.common.issues));return h(r,{code:u.invalid_union,unionErrors:s}),_}if(r.common.async)return Promise.all(n.map(async i=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(a);{let i;const s=[];for(const l of n){const f={...r,common:{...r.common,issues:[]},parent:null},v=l._parseSync({data:r.data,path:r.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!i&&(i={result:v,ctx:f}),f.common.issues.length&&s.push(f.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(l=>new L(l));return h(r,{code:u.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}ve.create=(t,e)=>new ve({options:t,typeName:k.ZodUnion,...w(e)});const H=t=>t instanceof De?H(t.schema):t instanceof K?H(t.innerType()):t instanceof xe?[t.value]:t instanceof re?t.options:t instanceof ze?S.objectValues(t.enum):t instanceof Ie?H(t._def.innerType):t instanceof Re?[void 0]:t instanceof ye?[null]:t instanceof V?[void 0,...H(t.unwrap())]:t instanceof ne?[null,...H(t.unwrap())]:t instanceof Ke||t instanceof Se?H(t.unwrap()):t instanceof Te?H(t._def.innerType):[];class Ue extends T{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return h(r,{code:u.invalid_type,expected:m.object,received:r.parsedType}),_;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(h(r,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const i of r){const s=H(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new Ue({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...w(n)})}}function We(t,e){const r=ee(t),n=ee(e);if(t===e)return{valid:!0,data:t};if(r===m.object&&n===m.object){const a=S.objectKeys(e),i=S.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(const o of i){const l=We(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(r===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const s=t[i],o=e[i],l=We(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class _e extends T{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(i,s)=>{if(et(i)||et(s))return _;const o=We(i.value,s.value);return o.valid?((tt(i)||tt(s))&&r.dirty(),{status:r.value,value:o.data}):(h(n,{code:u.invalid_intersection_types}),_)};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(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}_e.create=(t,e,r)=>new _e({left:t,right:e,typeName:k.ZodIntersection,...w(r)});class W extends T{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:u.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return h(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((s,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new B(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>P.mergeArray(r,s)):P.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:t,typeName:k.ZodTuple,rest:null,...w(e)})};class ke extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:u.invalid_type,expected:m.object,received:n.parsedType}),_;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new B(n,o,n.path,o)),value:s._parse(new B(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?P.mergeObjectAsync(r,a):P.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof T?new ke({keyType:e,valueType:r,typeName:k.ZodRecord,...w(n)}):new ke({keyType:U.create(),valueType:e,typeName:k.ZodRecord,...w(r)})}}class Fe extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:u.invalid_type,expected:m.map,received:n.parsedType}),_;const a=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([o,l],f)=>({key:a._parse(new B(n,o,n.path,[f,"key"])),value:i._parse(new B(n,l,n.path,[f,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of s){const f=await l.key,v=await l.value;if(f.status==="aborted"||v.status==="aborted")return _;(f.status==="dirty"||v.status==="dirty")&&r.dirty(),o.set(f.value,v.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const l of s){const f=l.key,v=l.value;if(f.status==="aborted"||v.status==="aborted")return _;(f.status==="dirty"||v.status==="dirty")&&r.dirty(),o.set(f.value,v.value)}return{status:r.value,value:o}}}}Fe.create=(t,e,r)=>new Fe({valueType:e,keyType:t,typeName:k.ZodMap,...w(r)});class fe extends T{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:u.invalid_type,expected:m.set,received:n.parsedType}),_;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(h(n,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(h(n,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(l){const f=new Set;for(const v of l){if(v.status==="aborted")return _;v.status==="dirty"&&r.dirty(),f.add(v.value)}return{status:r.value,value:f}}const o=[...n.data.values()].map((l,f)=>i._parse(new B(n,l,n.path,f)));return n.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,r){return new fe({...this._def,minSize:{value:e,message:b.toString(r)}})}max(e,r){return new fe({...this._def,maxSize:{value:e,message:b.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}fe.create=(t,e)=>new fe({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...w(e)});class we extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.function)return h(r,{code:u.invalid_type,expected:m.function,received:r.parsedType}),_;function n(o,l){return qe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Le(),me].filter(f=>!!f),issueData:{code:u.invalid_arguments,argumentsError:l}})}function a(o,l){return qe({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Le(),me].filter(f=>!!f),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof pe){const o=this;return j(async function(...l){const f=new L([]),v=await o._def.args.parseAsync(l,i).catch(z=>{throw f.addIssue(n(l,z)),f}),E=await Reflect.apply(s,this,v);return await o._def.returns._def.type.parseAsync(E,i).catch(z=>{throw f.addIssue(a(E,z)),f})})}else{const o=this;return j(function(...l){const f=o._def.args.safeParse(l,i);if(!f.success)throw new L([n(l,f.error)]);const v=Reflect.apply(s,this,f.data),E=o._def.returns.safeParse(v,i);if(!E.success)throw new L([a(v,E.error)]);return E.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new we({...this._def,args:W.create(e).rest(se.create())})}returns(e){return new we({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new we({args:e||W.create([]).rest(se.create()),returns:r||se.create(),typeName:k.ZodFunction,...w(n)})}}class De extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}De.create=(t,e)=>new De({getter:t,typeName:k.ZodLazy,...w(e)});class xe extends T{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return h(r,{received:r.data,code:u.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}xe.create=(t,e)=>new xe({value:t,typeName:k.ZodLiteral,...w(e)});function st(t,e){return new re({values:t,typeName:k.ZodEnum,...w(e)})}class re extends T{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{expected:S.joinValues(n),received:r.parsedType,code:u.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{received:r.data,code:u.invalid_enum_value,options:n}),_}return j(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return re.create(e,{...this._def,...r})}exclude(e,r=this._def){return re.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}re.create=st;class ze extends T{_parse(e){const r=S.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const a=S.objectValues(r);return h(n,{expected:S.joinValues(a),received:n.parsedType,code:u.invalid_type}),_}if(this._cache||(this._cache=new Set(S.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=S.objectValues(r);return h(n,{received:n.data,code:u.invalid_enum_value,options:a}),_}return j(e.data)}get enum(){return this._def.values}}ze.create=(t,e)=>new ze({values:t,typeName:k.ZodNativeEnum,...w(e)});class pe extends T{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.promise&&r.common.async===!1)return h(r,{code:u.invalid_type,expected:m.promise,received:r.parsedType}),_;const n=r.parsedType===m.promise?r.data:Promise.resolve(r.data);return j(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}pe.create=(t,e)=>new pe({type:t,typeName:k.ZodPromise,...w(e)});class K extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{h(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return _;const l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?_:l.status==="dirty"||r.value==="dirty"?be(l.value):l});{if(r.value==="aborted")return _;const o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||r.value==="dirty"?be(o.value):o}}if(a.type==="refinement"){const s=o=>{const l=a.refinement(o,i);if(n.common.async)return Promise.resolve(l);if(l 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"?_:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!le(s))return _;const o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>le(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:r.value,value:o})):_);S.assertNever(a)}}K.create=(t,e,r)=>new K({schema:t,typeName:k.ZodEffects,effect:e,...w(r)}),K.createWithPreprocess=(t,e,r)=>new K({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...w(r)});class V extends T{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(t,e)=>new V({innerType:t,typeName:k.ZodOptional,...w(e)});class ne extends T{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ne.create=(t,e)=>new ne({innerType:t,typeName:k.ZodNullable,...w(e)});class Ie extends T{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Ie.create=(t,e)=>new Ie({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...w(e)});class Te extends T{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ne(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Te.create=(t,e)=>new Te({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...w(e)});class He extends T{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return h(n,{code:u.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}He.create=t=>new He({typeName:k.ZodNaN,...w(t)});class Ke extends T{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Me extends T{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(r.dirty(),be(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?_:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Me({in:e,out:r,typeName:k.ZodPipeline})}}class Se extends T{_parse(e){const r=this._def.innerType._parse(e),n=a=>(le(a)&&(a.value=Object.freeze(a.value)),a);return Ne(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Se.create=(t,e)=>new Se({innerType:t,typeName:k.ZodReadonly,...w(e)});var k;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(k||(k={}));const c=U.create,p=ae.create,F=ie.create,x=Oe.create,ot=ye.create,y=se.create;te.create;const N=Z.create,d=O.create,I=ve.create;_e.create;const Kt=W.create,g=ke.create,Gt=xe.create,ct=re.create;pe.create,V.create,ne.create;const G=K.createWithPreprocess;function R(t,e=0,r=2){if(e>r)return"...";if(t instanceof O){const n=t.shape,a=Object.keys(n).filter(s=>!s.startsWith("__"));return a.length===0?"{ }":e>=r-1?"{ ... }":`{ ${a.map(s=>{const o=n[s],l=o instanceof V,f=R(l?o.unwrap():o,e+1,r);return`${s}${l?"?":""}: ${f}`}).join(", ")} }`}if(t instanceof ve)return t.options.map(n=>R(n,e,r)).join(" or ");if(t instanceof U)return"string";if(t instanceof ae)return"number";if(t instanceof Oe)return"boolean";if(t instanceof ie)return"bigint";if(t instanceof ye)return"null";if(t instanceof Z){const n=R(t.element,e+1,r);return n==="unknown"||n==="any"?"array":`${n}[]`}if(t instanceof W)return`[${t.items.map(n=>R(n,e+1,r)).join(", ")}]`;if(t instanceof ke){const n=R(t._def.valueType,e+1,r);return n==="unknown"||n==="any"?"{ [key: string]: unknown }":`{ [key: string]: ${n} }`}return t instanceof V?`${R(t.unwrap(),e,r)}?`:t instanceof xe?JSON.stringify(t.value):t instanceof re?t.options.map(n=>`"${n}"`).join(" | "):t instanceof Ve?"any":t instanceof se?"unknown":t instanceof Be?"void":t instanceof Re?"undefined":t instanceof K?R(t.innerType(),e,r):t instanceof Ie?R(t.removeDefault(),e,r):t instanceof ne?`${R(t.unwrap(),e,r)} | null`:t instanceof De?"lazy":t instanceof pe?`Promise<${R(t.unwrap(),e+1,r)}>`:t instanceof we?"function":t instanceof ge?"Date":t instanceof Fe?"Map":t instanceof fe?"Set":t instanceof _e?`${R(t._def.left,e,r)} & ${R(t._def.right,e,r)}`:t instanceof Ue?t.options.map(n=>R(n,e,r)).join(" or "):t instanceof Ke?R(t.unwrap(),e,r):t instanceof He?"NaN":t instanceof Te?R(t.removeCatch(),e,r):t instanceof Me?R(t._def.in,e,r):t instanceof Se?`readonly ${R(t.unwrap(),e,r)}`:"unknown"}function Jt(t){return t===null?"null":t===void 0?"undefined":Array.isArray(t)?"array":typeof t}function Yt(t,e,r,n){const a=r.filter(o=>o.path.length===0),i=r.filter(o=>o.path.length>0);if(a.length>0&&i.length===0){const o=a.some(f=>f.code==="custom"),l=a.some(f=>f.code!=="invalid_type"&&f.code!=="invalid_literal"&&f.code!=="invalid_union");if(!o&&!l){const f=R(e),v=Jt(n);return`Invalid parameters for ${t}: expected ${f}${f==="{ }"?" or no args":""}, received ${v}`}}const s=r.map(o=>`at '${o.path.length>0?o.path.join("."):"root"}': ${o.message}`);return`Invalid parameters for ${t}: ${s.join("; ")}`}async function Xt(t,e,r,n,a){const i=t.safeParse(Ce(n));if(!i.success)return{ok:!1,error:{message:Yt(a,t,i.error.issues,n),code:"E_INVALID_PARAMS",category:"validation"}};try{const s=await r(i.data),o=e.safeParse(s);if(!o.success){const l=o.error.issues.map(f=>{const v=f.path.join(".");return`invalid return value${v?` at '${v}'`:""} (${f.message})`});return{ok:!1,error:{message:`Invalid return value for ${a}: ${l.join("; ")}`,code:"E_INVALID_RETURN",category:"validation"}}}return{ok:!0,value:o.data}}catch(s){const o=It(s),l=o.code==="E_EXTENSION"&&(typeof s!="object"||s===null||!("code"in s));return{ok:!1,error:{...o,code:l?"E_HANDLER":o.code,message:`${a}: ${o.message}`}}}}const dt=new Map,Pe=new Map;function Qt(t){dt.set(t.registryAction,t)}function Ge(t){return dt.get(t)}function er(t){for(const e of t)Qt(e);try{chrome.runtime.sendMessage({type:"contentScriptReady"})}catch{}}function tr(t){const e=Pe.get(t);return e?(e.abort(),Pe.delete(t),!0):!1}async function rr(t,e,r,n,a){const i=Ge(t);if(!i)return{ok:!1,error:{message:`No schema registered for content-script action: ${t}`,code:"E_INTERNAL"}};const s=new AbortController;a&&Pe.set(a,s);try{return await Xt(i.params,i.returns,async o=>r(o,s.signal),Ce(n),t)}finally{a&&Pe.delete(a)}}const q=()=>I([F(),p().finite()]).transform(t=>BigInt(t));d({key:c().describe("Storage key to retrieve")}),d({key:c().describe("Storage key to set"),value:c().describe("Value to store")}),d({key:c().describe("Storage key to delete")}),d({});const nr=d({items:g(c()).describe("Record of key-value string pairs to store")});G(t=>t!==null&&typeof t=="object"&&!Array.isArray(t)&&!("items"in t)?{items:t}:t,nr);const ar=d({keys:N(c()).describe("Array of storage keys to retrieve"),defaults:g(c()).optional().describe("Default string values for missing keys")});G(t=>Array.isArray(t)?{keys:t}:t,ar),d({});const ir=d({keys:N(c()).describe("Array of storage keys to delete")});G(t=>Array.isArray(t)?{keys:t}:t,ir),d({}),d({}),I([Kt([I([d({text:c()}),c()])]),d({text:c().optional(),value:c().optional()})]),d({url:c().describe("URL to fetch"),method:c().default("GET").describe("HTTP method (GET, POST, PUT, DELETE, etc.)"),headers:g(c()).default({}).describe("Request headers as key-value pairs"),body:c().nullable().default(null).describe("Request body string"),timeout:q().default(30000n).describe("Timeout in milliseconds")}),d({duration:q().describe("Duration to sleep in milliseconds")});const he=()=>c().regex(/^e\d+$/),sr='use { refId: "e2" } or { label: "..." } object form, not positional arguments',Je=(t,e)=>{if(t.__invalidPositional!==void 0){e.addIssue({code:u.custom,message:sr});return}!t.refId&&!t.label&&e.addIssue({code:u.custom,message:"Either refId or label is required"})},lt=(t,e)=>{t.x!==void 0||t.y!==void 0||Je(t,e)},D=t=>G(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,d({__invalidPositional:I([c(),p()]).optional().describe("Internal flag for positional argument rejection"),refId:he().optional().describe("Element reference ID (e.g. e2)"),label:c().optional().describe("Human-readable element label"),...t}).superRefine(Je)),Ee={tabId:I([p(),F()]).optional().describe("Target tab ID")},oe=t=>G(e=>typeof e=="string"||typeof e=="number"?{__invalidPositional:e}:e,d({__invalidPositional:I([c(),p()]).optional().describe("Internal flag for positional argument rejection"),...Ee,refId:he().optional().describe("Element reference ID (e.g. e2)"),label:c().optional().describe("Human-readable element label"),...t}).superRefine(Je));d({}),d({}),d({url:c().describe("URL to navigate to"),timeout:q().optional().describe("Navigation timeout in milliseconds")});const or=d({});d({}),d({}),d({duration:q().default(1000n).describe("Duration to wait in milliseconds")});const cr=D(),dr=D({value:c().describe("Value to fill into the element")}),lr=D({text:c().describe("Text to type into the element")}),ur=D({text:c().describe("Text to append into the element")}),fr=d({key:c().describe("Key to press (e.g. Enter, Escape, ArrowDown)")}),pr=D({value:c().describe("Value to select in the dropdown")}),hr=D({checked:x().optional().describe("Desired checked state (true to check, false to uncheck)")}),mr=D(),br=d({}),gr=d({direction:c().default("down").describe("Scroll direction: up, down, left, or right"),amount:p().default(300).describe("Pixels to scroll")}),yr=G(t=>typeof t=="string"||typeof t=="number"?{__invalidPositional:t}:t,d({__invalidPositional:I([c(),p()]).optional().describe("Internal flag for positional argument rejection"),refId:he().optional().describe("Element reference ID (e.g. e2)"),label:c().optional().describe("Human-readable element label"),x:p().optional().describe("X coordinate to scroll to"),y:p().optional().describe("Y coordinate to scroll to")}).superRefine(lt)),vr=D();d({selector:c().describe("CSS selector to find elements")}),d({selector:c().describe("CSS selector to wait for"),timeout:q().default(30000n).describe("Timeout in milliseconds")});const _r=d({fields:N(c()).describe("Array of field names to extract")});G(t=>Array.isArray(t)?{fields:t}:t,_r),I([p(),N(d({}).passthrough()),d({}).passthrough()]),d({}),d({active:x().optional().describe("Whether the tabs are active"),currentWindow:x().optional().describe("Whether the tabs are in the current window"),url:c().optional().describe("URL pattern to match tabs against")}).passthrough(),G(t=>typeof t=="string"?{url:t}:t,d({url:c().optional().describe("URL to open in the new tab"),active:x().optional().describe("Whether to focus the new tab")})),I([p(),N(d({id:p().optional(),tabId:p().optional(),tab_id:p().optional()}).passthrough()),d({id:p().optional(),tabId:p().optional(),tab_id:p().optional()}).passthrough()]),d({tabId:I([p(),F()]).optional().describe("Target tab ID"),script:c().optional().describe("Script to execute")}).passthrough();const kr=oe(),wr=oe({value:c().describe("Value to fill into the element")}),xr=G(t=>typeof t=="string"||typeof t=="number"?{__invalidPositional:t}:t,d({__invalidPositional:I([c(),p()]).optional().describe("Internal flag for positional argument rejection"),...Ee,refId:he().optional().describe("Element reference ID (e.g. e2)"),label:c().optional().describe("Human-readable element label"),x:p().optional().describe("X coordinate to scroll to"),y:p().optional().describe("Y coordinate to scroll to")}).superRefine(lt)),Ir=oe({text:c().describe("Text to type into the element")}),Tr=d({...Ee,key:c().describe("Key to press (e.g. Enter, Escape, ArrowDown)")}),Sr=oe({value:c().describe("Value to select in the dropdown")}),Er=oe({checked:x().optional().describe("Desired checked state (true to check, false to uncheck)")}),Cr=oe(),Ar=d({...Ee}),Nr=d({...Ee,direction:c().default("down").describe("Scroll direction: up, down, left, or right"),amount:p().default(300).describe("Pixels to scroll")}),Or=oe();d({tabId:I([p(),F()]).optional().describe("Target tab ID"),script:c().optional().describe("Script to evaluate"),code:c().optional().describe("Alternative script code"),js:c().optional().describe("Alternative JS code")}).passthrough();const Rr=d({tabId:I([p(),F()]).optional().describe("Target tab ID")}).passthrough();d({tabId:I([p(),F()]).optional().describe("Target tab ID"),timeout:p().optional().describe("Timeout in milliseconds")}).passthrough(),d({tabId:I([p(),F()]).optional().describe("Target tab ID"),url:c().optional().describe("URL to fetch"),options:d({}).passthrough().optional().describe("Fetch options")}).passthrough(),d({tabId:I([p(),F()]).optional().describe("Target tab ID"),max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough(),d({tabId:I([p(),F()]).optional().describe("Target tab ID"),max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough(),d({tabId:I([p(),F()]).optional().describe("Target tab ID"),max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough(),D(),D(),D({value:c().optional().describe("Value to fill into the element")}),D({text:c().optional().describe("Text to type into the element")}),d({key:c().optional().describe("Key to press (e.g. Enter, Escape, ArrowDown)")}),D({value:c().optional().describe("Value to select in the dropdown")}),D({checked:x().optional().describe("Desired checked state (true to check, false to uncheck)")}),D(),d({}),d({direction:c().optional().describe("Scroll direction: up, down, left, or right"),amount:p().optional().describe("Pixels to scroll")}),D(),D({text:c().optional().describe("Text to append into the element")}),d({}),d({}),d({duration:q().default(1000n).describe("Duration to wait in milliseconds")}),d({interactive_only:x().default(!1).describe("Only include interactive elements"),max_nodes:q().default(500n).describe("Maximum number of nodes to include in snapshot")}),d({interactive_only:x().default(!1).describe("Only include interactive elements"),max_nodes:q().default(500n).describe("Maximum number of nodes to include in snapshot")}),d({interactive_only:x().default(!1).describe("Only include interactive elements"),max_nodes:q().default(500n).describe("Maximum number of nodes to include in snapshot")}),d({interactive_only:x().default(!1).describe("Only include interactive elements"),max_nodes:q().default(500n).describe("Maximum number of nodes to include in snapshot")}),d({snapshot:d({}).passthrough().describe("Raw DOM snapshot data to format"),format:c().optional().describe("Output format (e.g. markdown, html)")});const Dr=d({max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough();d({max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough(),d({max_nodes:p().optional().describe("Maximum nodes to include"),options:d({}).passthrough().optional().describe("Snapshot options")}).passthrough(),d({path:c().describe("File or directory path")}),d({from:c().describe("Source path"),to:c().describe("Destination path")}),d({path:c().describe("File path to write to"),data:c().describe("Data to write")}),d({path:c().describe("File path to read from"),offset:q().describe("Byte offset to start reading"),len:p().describe("Number of bytes to read")}),d({path:c().describe("File path to update"),offset:q().describe("Byte offset to start writing"),data:c().describe("Data to write")}),d({path:c().describe("File path to hash"),algo:c().default("sha256").describe("Hash algorithm (e.g. sha256, md5)")}),g(y()),g(y()),g(y()),g(y()),I([p(),g(y())]),I([p(),g(y())]),g(y()),g(y()),g(y()),I([c(),g(y())]),g(y()),g(y()),g(y()),g(y()),g(y()),I([c(),p(),g(y())]),g(y()),g(y()),g(y()),I([p(),g(y())]),g(y()),g(y()),g(y()),g(y()),g(y()),N(y()),I([c(),g(y())]),g(y()),I([c(),g(y())]),g(y()),I([c(),g(y())]),g(y()),I([c(),g(y())]),g(y()),g(y()),I([p(),g(y())]),g(y()),g(y()),I([p(),g(y())]),g(y()),I([c(),p(),g(y())]),g(y()),g(y()),g(y()),g(y()),I([p(),g(y())]),I([p(),g(y())]),I([p(),g(y())]),I([p(),g(y())]),I([p(),g(y())]),g(y()),g(y()),g(y()),d({action:c().describe("Host action name"),params:d({}).passthrough().optional().describe("Parameters for the host action")}).passthrough(),I([c(),p(),x(),ot(),N(y()),g(y())]);const C=d({ok:Gt(!0).describe("Whether the action succeeded"),action:c().describe("Action identifier (e.g. 'page_fill')"),refId:he().optional().describe("Element reference ID that was acted upon (e.g. e2)"),tag:c().optional().describe("HTML tag name of the element"),role:c().optional().describe("ARIA role of the element"),name:c().optional().describe("Accessible name of the element"),value:c().optional().describe("Final value of the element after the action"),checked:x().optional().describe("Checked state after the action"),disabled:x().optional().describe("Whether the element is disabled"),readOnly:x().optional().describe("Whether the element is read-only"),text:c().optional().describe("Text content of the element"),key:c().optional().describe("Key that was pressed (for press actions)"),direction:c().optional().describe("Scroll direction (for scroll actions)"),amount:p().optional().describe("Scroll amount in pixels (for scroll actions)")});I([C,ot()]),d({status:p().describe("HTTP response status code"),ok:x().describe("Whether the response status is 2xx"),headers:g(c()).describe("Response headers as key-value pairs"),body:c().describe("Response body as string")}),d({data:d({}).passthrough().describe("Structured snapshot data"),text:c().describe("Plain text representation of the snapshot")}),d({}),d({tabId:p(),url:c(),title:c(),contentScript:ct(["connected","missing"]),scripting:ct(["ok","blocked"]),mutationsReady:x(),hint:c().optional(),recovery:N(c()).optional()});const Mr=d({refId:he().describe("Element reference ID (e.g. e2)"),role:c().describe("ARIA role of the element"),tag:c().describe("HTML tag name"),name:c().optional().describe("Accessible name of the element"),value:c().optional().describe("Element value"),checked:x().optional().describe("Checked state"),disabled:x().optional().describe("Whether the element is disabled"),readOnly:x().optional().describe("Whether the element is read-only")}),Pr=d({text:c().describe("Plain text representation of the page"),nodes:N(Mr).describe("Array of interactive nodes"),url:c().describe("Current page URL"),title:c().describe("Current page title"),viewport:d({width:p().describe("Viewport width in pixels"),height:p().describe("Viewport height in pixels")}).describe("Viewport dimensions")}),ut=d({id:p().optional().describe("Tab ID"),tabId:p().optional().describe("Tab ID (added by runner)"),index:p().optional().describe("Tab index in the window"),windowId:p().optional().describe("Window ID"),url:c().optional().describe("Tab URL"),title:c().optional().describe("Tab title"),status:c().optional().describe("Tab status (loading or complete)"),active:x().optional().describe("Whether the tab is active"),pinned:x().optional().describe("Whether the tab is pinned"),highlighted:x().optional().describe("Whether the tab is highlighted"),incognito:x().optional().describe("Whether the tab is incognito"),favIconUrl:c().optional().describe("Favicon URL"),audible:x().optional().describe("Whether the tab is audible"),groupId:p().optional().describe("Group ID"),openerTabId:p().optional().describe("Opener tab ID"),discarded:x().optional().describe("Whether the tab is discarded"),autoDiscardable:x().optional().describe("Whether the tab is auto-discardable"),width:p().optional().describe("Tab width"),height:p().optional().describe("Tab height"),sessionId:c().optional().describe("Session ID")}).passthrough(),jr=N(ut),ft=d({id:p().optional().describe("Window ID"),focused:x().optional().describe("Whether the window is focused"),top:p().optional().describe("Window top position"),left:p().optional().describe("Window left position"),width:p().optional().describe("Window width"),height:p().optional().describe("Window height"),tabs:jr.optional().describe("Array of tabs in the window"),incognito:x().optional().describe("Whether the window is incognito"),type:c().optional().describe("Window type"),state:c().optional().describe("Window state"),alwaysOnTop:x().optional().describe("Whether the window is always on top"),sessionId:c().optional().describe("Session ID")}).passthrough();N(ft);const $r=d({name:c().describe("Cookie name"),value:c().describe("Cookie value"),domain:c().optional().describe("Cookie domain"),hostOnly:x().optional().describe("Whether the cookie is host-only"),path:c().optional().describe("Cookie path"),secure:x().optional().describe("Whether the cookie is secure"),httpOnly:x().optional().describe("Whether the cookie is HTTP-only"),sameSite:c().optional().describe("SameSite policy"),session:x().optional().describe("Whether the cookie is a session cookie"),expirationDate:p().optional().describe("Expiration date as Unix timestamp"),storeId:c().optional().describe("Store ID")}).nullable();N($r.nullable().unwrap());const Lr=d({id:c().describe("Bookmark ID"),parentId:c().optional().describe("Parent folder ID"),index:p().optional().describe("Bookmark index"),url:c().optional().describe("Bookmark URL"),title:c().describe("Bookmark title"),dateAdded:p().optional().describe("Date added"),dateGroupModified:p().optional().describe("Date group modified"),children:N(d({id:c()}).passthrough()).optional().describe("Child bookmarks")}).passthrough();N(Lr);const qr=d({id:c().describe("History item ID"),url:c().optional().describe("URL"),title:c().optional().describe("Title"),lastVisitTime:p().optional().describe("Last visit time"),visitCount:p().optional().describe("Visit count"),typedCount:p().optional().describe("Typed count")}).passthrough();N(qr);const Zr=d({frameId:p().describe("Frame ID"),result:y().optional().describe("Script result")});N(Zr),c(),x(),I([c(),p()]),x();const Vr=d({id:p().optional().describe("Group ID"),collapsed:x().optional().describe("Whether the group is collapsed"),color:c().optional().describe("Group color"),title:c().optional().describe("Group title"),windowId:p().optional().describe("Window ID")}).passthrough();N(Vr);const Br=d({lastModified:p().optional().describe("Last modified time"),tab:ut.optional().describe("Tab info"),window:ft.optional().describe("Window info")}).passthrough(),Ur=N(Br),Wr=d({deviceName:c().optional().describe("Device name"),sessions:Ur.optional().describe("Sessions")}).passthrough();N(Wr);const Fr=d({id:p().optional().describe("Download ID"),url:c().optional().describe("Download URL"),filename:c().optional().describe("Filename"),startTime:c().optional().describe("Start time"),endTime:c().optional().describe("End time"),state:c().optional().describe("Download state"),danger:c().optional().describe("Danger type"),paused:x().optional().describe("Whether the download is paused"),error:c().optional().describe("Error message"),bytesReceived:p().optional().describe("Bytes received"),totalBytes:p().optional().describe("Total bytes"),fileSize:p().optional().describe("File size"),mime:c().optional().describe("MIME type"),incognito:x().optional().describe("Whether the download is incognito"),referrer:c().optional().describe("Referrer URL"),byExtensionId:c().optional().describe("Extension ID"),byExtensionName:c().optional().describe("Extension name")}).passthrough();N(Fr),p(),d({archName:c().describe("CPU architecture"),modelName:c().describe("CPU model"),numOfProcessors:p().describe("Number of processors"),features:N(c()).describe("CPU features")}),d({capacity:p().describe("Total memory capacity"),availableCapacity:p().describe("Available memory capacity")}),N(d({id:c().describe("Storage ID"),name:c().describe("Storage name"),type:c().describe("Storage type"),capacity:p().describe("Storage capacity")}));const zr=[{action:"page_back",namespace:"page",name:"back",description:"Go back in the active tab",params:or,returns:C,paramTypes:[],returnDoc:"Navigation result",errorCode:"E_NO_TAB",example:"page.back()",handlerKey:"back"},{action:"page_click",namespace:"page",name:"click",description:"Click an element in the active tab",params:cr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label to click (label)"}],returnDoc:"{ ok: true, action: 'click', refId? }",errorCode:"E_MISSING_PARAM",example:'page.click({ refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.click"]},handlerKey:"click"},{action:"page_fill",namespace:"page",name:"fill",description:"Fill an element in the active tab",params:dr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"value",type:"string",required:!1,description:"Value to fill (literal)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'fill', refId?, value? }",errorCode:"E_MISSING_PARAM",example:'page.fill({ refId: "e2", value: "hello" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.fill"]},handlerKey:"fill"},{action:"page_type",namespace:"page",name:"type",description:"Type into an element in the active tab",params:lr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"text",type:"string",required:!1,description:"Text to type (literal)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'type', refId?, value? }",errorCode:"E_MISSING_PARAM",example:'page.type({ refId: "e2", text: "hello" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.type"]},handlerKey:"type"},{action:"page_append",namespace:"page",name:"append",description:"Append text to an element in the active tab",params:ur,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"text",type:"string",required:!1,description:"Text to append (literal)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'append', refId?, value? }",errorCode:"E_MISSING_PARAM",example:'page.append({ refId: "e2", text: " world" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"]},handlerKey:"append"},{action:"page_press",namespace:"page",name:"press",description:"Press a key in the active tab",params:fr,returns:C,fields:["key"],paramTypes:[{name:"key",type:"string",required:!0,description:"Key to press (literal)"}],returnDoc:"{ ok: true, action: 'press', key? }",errorCode:"E_NO_TAB",example:'page.press("Enter")',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.press"]},handlerKey:"press"},{action:"page_select",namespace:"page",name:"select",description:"Select an option in the active tab",params:pr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"},{name:"value",type:"string",required:!1,description:"Option value to select (literal)"}],returnDoc:"{ ok: true, action: 'select', refId?, value? }",errorCode:"E_MISSING_PARAM",example:'page.select({ refId: "e2", value: "option1" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.select"]},handlerKey:"select"},{action:"page_check",namespace:"page",name:"check",description:"Check/uncheck an element in the active tab",params:hr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"},{name:"checked",type:"boolean",required:!1,description:"Whether to check or uncheck (literal)"}],returnDoc:"{ ok: true, action: 'check', refId?, checked? }",errorCode:"E_MISSING_PARAM",example:'page.check({ refId: "e2", checked: true })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.check"]},handlerKey:"check"},{action:"page_hover",namespace:"page",name:"hover",description:"Hover over an element in the active tab",params:mr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'hover', refId? }",errorCode:"E_MISSING_PARAM",example:'page.hover({ refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.hover"]},handlerKey:"hover"},{action:"page_unhover",namespace:"page",name:"unhover",description:"Unhover in the active tab",params:br,returns:C,paramTypes:[],returnDoc:"{ ok: true, action: 'unhover' }",errorCode:"E_NO_TAB",example:"page.unhover()",agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.unhover"]},handlerKey:"unhover"},{action:"page_scroll",namespace:"page",name:"scroll",description:"Scroll the active tab",params:gr,returns:C,fields:["direction","amount"],paramTypes:[{name:"direction",type:"string",required:!1,description:"Scroll direction (up or down) (literal)"},{name:"amount",type:"number",required:!1,description:"Scroll amount in pixels (literal)"}],returnDoc:"Scroll result",errorCode:"E_NO_TAB",example:'page.scroll("down", 500)',handlerKey:"scroll"},{action:"page_scroll_to",namespace:"page",name:"scroll_to",description:"Scroll to an element in the active tab",params:yr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID to scroll to (refId)"},{name:"label",type:"string",required:!1,description:"Element label to scroll to (label)"}],returnDoc:"Scroll to result",errorCode:"E_MISSING_PARAM",example:'page.scroll_to({ refId: "e2" })',handlerKey:"scroll_to"},{action:"page_dblclick",namespace:"page",name:"dblclick",description:"Double-click an element in the active tab",params:vr,returns:C,paramTypes:[{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'dblclick', refId? }",errorCode:"E_MISSING_PARAM",example:'page.dblclick({ refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab is active and the content script is ready before mutating"],notes:["Same content-script path as web.tab.*","Always operates on the active tab; use web.tab.* if you need to target a specific tabId"],tags:["mutation","write"],relatedApis:["web.tab.dblclick"]},handlerKey:"dblclick"},{action:"tab_click",namespace:"web.tab",name:"click",description:"Click in a tab",params:kr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'click', refId? }",errorCode:"E_NO_TAB",example:'web.tab.click({ tabId: 123, refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.click"]},handlerKey:"click"},{action:"tab_fill",namespace:"web.tab",name:"fill",description:"Fill in a tab",params:wr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"value",type:"string",required:!1,description:"Value to fill (literal)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'fill', refId?, value? }",errorCode:"E_NO_TAB",example:'web.tab.fill({ tabId: 123, refId: "e2", value: "hello" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.fill"]},handlerKey:"fill"},{action:"tab_scroll_to",namespace:"web.tab",name:"scroll_to",description:"Scroll to position in a tab",params:xr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"x",type:"number",required:!1,description:"X coordinate (literal)"},{name:"y",type:"number",required:!1,description:"Y coordinate (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"Scroll to result",errorCode:"E_NO_TAB",example:'web.tab.scroll_to({ tabId: 123, refId: "e2" })',handlerKey:"scroll_to"},{action:"tab_type",namespace:"web.tab",name:"type",description:"Type in a tab",params:Ir,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"text",type:"string",required:!1,description:"Text to type (literal)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'type', refId?, value? }",errorCode:"E_NO_TAB",example:'web.tab.type({ tabId: 123, refId: "e2", text: "hello" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.type"]},handlerKey:"type"},{action:"tab_press",namespace:"web.tab",name:"press",description:"Press a key in a tab",params:Tr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"key",type:"string",required:!1,description:"Key to press (literal)"}],returnDoc:"{ ok: true, action: 'press', key? }",errorCode:"E_NO_TAB",example:'web.tab.press({ tabId: 123, key: "Enter" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.press"]},handlerKey:"press"},{action:"tab_select",namespace:"web.tab",name:"select",description:"Select an option in a tab",params:Sr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"},{name:"value",type:"string",required:!1,description:"Option value to select (literal)"}],returnDoc:"{ ok: true, action: 'select', refId?, value? }",errorCode:"E_NO_TAB",example:'web.tab.select({ tabId: 123, refId: "e2", value: "option1" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.select"]},handlerKey:"select"},{action:"tab_check",namespace:"web.tab",name:"check",description:"Check/uncheck in a tab",params:Er,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"},{name:"checked",type:"boolean",required:!1,description:"Whether to check or uncheck (literal)"}],returnDoc:"{ ok: true, action: 'check', refId?, checked? }",errorCode:"E_NO_TAB",example:'web.tab.check({ tabId: 123, refId: "e2", checked: true })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.check"]},handlerKey:"check"},{action:"tab_hover",namespace:"web.tab",name:"hover",description:"Hover in a tab",params:Cr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'hover', refId? }",errorCode:"E_NO_TAB",example:'web.tab.hover({ tabId: 123, refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.hover"]},handlerKey:"hover"},{action:"tab_unhover",namespace:"web.tab",name:"unhover",description:"Unhover in a tab",params:Ar,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"}],returnDoc:"{ ok: true, action: 'unhover' }",errorCode:"E_NO_TAB",example:"web.tab.unhover({ tabId: 123 })",agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.unhover"]},handlerKey:"unhover"},{action:"tab_scroll",namespace:"web.tab",name:"scroll",description:"Scroll in a tab",params:Nr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"direction",type:"string",required:!1,description:"Scroll direction (up or down) (literal)"},{name:"amount",type:"number",required:!1,description:"Scroll amount in pixels (literal)"}],returnDoc:"Scroll result",errorCode:"E_NO_TAB",example:'web.tab.scroll({ tabId: 123, direction: "down", amount: 500 })',handlerKey:"scroll"},{action:"tab_dblclick",namespace:"web.tab",name:"dblclick",description:"Double-click in a tab",params:Or,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"},{name:"refId",type:"string",required:!1,description:"Element reference ID (refId)"},{name:"label",type:"string",required:!1,description:"Element label (label)"}],returnDoc:"{ ok: true, action: 'dblclick', refId? }",errorCode:"E_NO_TAB",example:'web.tab.dblclick({ tabId: 123, refId: "e2" })',agentMeta:{prerequisites:["Ensure the target tab exists and the content script is ready before mutating"],notes:["Explicit tabId required; same handlers as page.*"],tags:["mutation","write"],relatedApis:["page.dblclick"]},handlerKey:"dblclick"},{action:"tab_back",namespace:"web.tab",name:"back",description:"Go back in a tab",params:Rr,returns:C,paramTypes:[{name:"tabId",type:"number",required:!0,description:"Tab ID (literal)"}],returnDoc:"Back result",errorCode:"E_NO_TAB",example:"web.tab.back({ tabId: 123 })",handlerKey:"back"}];function Hr(){return[{registryAction:"ping",handlerKey:"ping",params:d({}),returns:d({ok:x()})},{registryAction:"snapshot",handlerKey:"snapshot",params:Dr,returns:Pr}]}function Kr(){return zr.map(t=>({registryAction:t.action,handlerKey:t.handlerKey,params:t.params,returns:t.returns}))}const J={debug:0,info:1,warn:2,error:3,none:4};let pt=J.error;function Gr(t){if(!t)return"";const e=[];for(const[r,n]of Object.entries(t)){let a;if(n===null)a="null";else if(n===void 0)a="undefined";else if(typeof n=="string")a=n;else if(typeof n=="number"||typeof n=="boolean")a=String(n);else try{a=JSON.stringify(n)}catch{a="[Circular]"}e.push(`${r}=${a}`)}return e.length>0?` ${e.join(" ")}`:""}function je(t,e,r){if(t<pt)return;const n=Gr(r),a=`[extension-js][content-script] ${e}${n}`;t>=J.error?console.error(a):t===J.warn?console.warn(a):console.log(a)}const ce={debug:(t,e)=>{je(J.debug,t,e)},info:(t,e)=>{je(J.info,t,e)},warn:(t,e)=>{je(J.warn,t,e)},error:(t,e)=>{je(J.error,t,e)}};function Jr(){window.__jsNotebookSetLogLevel=t=>{pt=J[t]??J.error}}function Yr(t){if(t.startsWith("page_")||t.startsWith("tab_")){const e=t.indexOf("_");if(e>=0)return t.slice(e+1)}return t}const ht='input, textarea, select, button, a, [role="button"], [role="link"]';function mt(t){const e={};return t instanceof HTMLInputElement?(e.value=t.value,(t.type==="checkbox"||t.type==="radio")&&(e.checked=t.checked),e.disabled=t.disabled,e.readOnly=t.readOnly):t instanceof HTMLTextAreaElement?(e.value=t.value,e.disabled=t.disabled,e.readOnly=t.readOnly):t instanceof HTMLSelectElement&&(e.value=t.value,e.disabled=t.disabled),e}function Xr(t,e){const r=t.tagName.toLowerCase();r!=="input"&&r!=="textarea"&&r!=="select"||Object.assign(e,mt(t))}function $e(t){const e=t.tagName.toLowerCase(),r=t.getAttribute("role");if(r)return r;if(e==="button"||e==="input"&&t.type==="submit")return"button";if(e==="a")return"link";if(e==="input"){const n=t.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":t.getAttribute("onclick")||t.onclick?"button":"generic"}function bt(t){var s,o;const e=t.getAttribute("aria-label");if(e)return e;const r=t.getAttribute("aria-labelledby");if(r){const l=document.getElementById(r);if(l)return((s=l.textContent)==null?void 0:s.slice(0,60))||""}if(t.tagName.toLowerCase()==="img"){const l=t.getAttribute("alt");if(l)return l}const a=t.title;if(a)return a;const i=$e(t);return i!=="generic"&&i!=="list"&&i!=="table"&&i!=="row"&&i!=="region"&&i!=="navigation"&&i!=="main"&&((o=t.textContent)==null?void 0:o.trim().slice(0,60))||""}function Qr(t){const e=$e(t);if(e==="generic"||e==="presentation"||e==="none"||t.hidden)return!1;const r=window.getComputedStyle(t);return!(r.display==="none"||r.visibility==="hidden")}function Y(t){return document.querySelector(`[data-ref-id='${CSS.escape(t)}']`)}function X(t){var n,a,i;const e=t.toLowerCase().trim();if(!e)return null;const r=Array.from(document.querySelectorAll(ht));for(const s of r){const o=s.getAttribute("aria-label");if(o&&o.toLowerCase().trim()===e)return s;const l=s.placeholder;if(l&&l.toLowerCase().trim()===e)return s;const f=s.id;if(f){const $=document.querySelector(`label[for='${CSS.escape(f)}']`);if($&&((n=$.textContent)==null?void 0:n.trim().toLowerCase())===e)return s}const v=s.closest("label");if(v&&((a=v.textContent)==null?void 0:a.trim().toLowerCase())===e||(((i=s.textContent)==null?void 0:i.trim().toLowerCase())||"")===e)return s}return null}function en(t){var a;const e=t.toLowerCase().trim();if(!e)return[];const r=Array.from(document.querySelectorAll(ht)),n=[];for(const i of r){const s=i.getAttribute("aria-label"),o=i.placeholder,l=((a=i.textContent)==null?void 0:a.trim())||"";if(![s,o,l].filter(Boolean).some(E=>E.toLowerCase().includes(e)))continue;const v=i.getAttribute("data-ref-id");if(v&&(n.push({refId:v,role:$e(i),name:bt(i)||void 0}),n.length>=5))break}return n}function de(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}function A(t,e){const r=de(t)[e];return typeof r=="string"?r:""}function gt(t,e,r){const n=de(t)[e];return typeof n=="number"?n:r}function Q(t,e,r=!1){if(t&&Ae(_t(t)),e){const n=r?en(e):[];Ae(xt(e,n))}Ae({message:"Element not found",code:"E_NOT_FOUND",category:"resource"})}function tn(t){let e=1;const r=[],n=[];function a(s,o){if(r.length>=t)return;const l=s.tagName.toLowerCase();if(l==="script"||l==="style"||l==="noscript"||l==="template")return;const f=Qr(s);let v=o;if(f){const E="e"+e++;s.setAttribute("data-ref-id",E);const $=$e(s),z=bt(s),Ye={refId:E,role:$,tag:l};z&&(Ye.name=z),Xr(s,Ye),r.push(Ye);const Xe=[`${" ".repeat(o)}- ${$}`];z&&Xe.push(`"${z.replace(/"/g,'\\"')}"`),Xe.push(`[${E}]`),n.push(Xe.join(" ")),v=o+1}for(const E of s.children)a(E,v)}return document.body&&a(document.body,0),{text:[`URL: ${window.location.href}`,`Title: ${document.title}`,""].concat(n).join(`
|
|
2
|
+
`),nodes:r,url:window.location.href,title:document.title,viewport:{width:window.innerWidth,height:window.innerHeight}}}function M(t,e,r){const n=(e==null?void 0:e.getAttribute("data-ref-id"))??void 0;return{ok:!0,action:t,...n?{refId:n}:{},...e?mt(e):{},...r}}function yt(t,e,r,n){(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.value!==n&&Ae(kt(t,r,{requested:n,actual:e.value}))}const rn=3e4,nn={click:t=>{const e=A(t,"refId"),r=A(t,"label");let n=e?Y(e):null;return!n&&r&&(n=X(r)),n||Q(e,r,!0),n.click(),M("click",n)},fill:t=>{const e=A(t,"refId"),r=A(t,"label"),n=A(t,"value");let a=e?Y(e):null;if(!a&&r&&(a=X(r)),a||Q(e,r,!0),a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement){a.value=n;const i=new InputEvent("input",{bubbles:!0});a.dispatchEvent(i);const s=e||a.getAttribute("data-ref-id")||"";return yt("fill",a,s,n),M("fill",a,{value:a.value})}throw new Error("Element is not an input")},type:t=>{const e=A(t,"refId"),r=A(t,"label"),n=A(t,"text");let a=e?Y(e):null;if(!a&&r&&(a=X(r)),a||Q(e,r,!0),a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement){a.value=n;const i=new InputEvent("input",{bubbles:!0});a.dispatchEvent(i);const s=e||a.getAttribute("data-ref-id")||"";return yt("type",a,s,n),M("type",a,{text:a.value})}throw new Error("Element is not an input")},append:t=>{const e=A(t,"refId"),r=A(t,"label"),n=A(t,"text");let a=e?Y(e):null;if(!a&&r&&(a=X(r)),a||Q(e,r,!0),a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement){a.value+=n;const i=new InputEvent("input",{bubbles:!0});return a.dispatchEvent(i),M("append",a,{text:a.value})}throw new Error("Element is not an input")},press:t=>{const e=A(t,"key"),r=new KeyboardEvent("keydown",{key:e,bubbles:!0});document.dispatchEvent(r);const n=new KeyboardEvent("keyup",{key:e,bubbles:!0});return document.dispatchEvent(n),M("press",null,{key:e})},select:t=>{const e=A(t,"refId"),r=A(t,"label"),n=A(t,"value");let a=e?Y(e):null;if(!a&&r&&(a=X(r)),a||Q(e,r,!0),a instanceof HTMLSelectElement)return a.value=n,a.dispatchEvent(new Event("change",{bubbles:!0})),M("select",a,{value:a.value});throw new Error("Element is not a select")},check:t=>{const e=A(t,"refId"),r=A(t,"label"),n=(()=>{const i=de(t);return typeof i.checked=="boolean"?i.checked:!0})();let a=e?Y(e):null;if(!a&&r&&(a=X(r)),a||Q(e,r,!0),a instanceof HTMLInputElement&&(a.type==="checkbox"||a.type==="radio"))return a.checked=n,a.dispatchEvent(new Event("change",{bubbles:!0})),M("check",a,{checked:a.checked});throw new Error("Element is not a checkbox or radio")},hover:t=>{const e=A(t,"refId"),r=A(t,"label");let n=e?Y(e):null;!n&&r&&(n=X(r)),n||Q(e,r,!0);const a=new MouseEvent("mouseenter",{bubbles:!0});return n.dispatchEvent(a),M("hover",n)},unhover:()=>{const t=new MouseEvent("mouseleave",{bubbles:!0});return document.body.dispatchEvent(t),M("unhover",null)},scroll:t=>{const e=de(t),r=e.direction??"down",n=typeof e.amount=="number"?e.amount:300;return window.scrollBy({top:r==="down"?n:-n,behavior:"smooth"}),M("scroll",null,{direction:r,amount:n})},dblclick:t=>{const e=A(t,"refId"),r=A(t,"label");let n=e?Y(e):null;!n&&r&&(n=X(r)),n||Q(e,r,!0);const a=new MouseEvent("dblclick",{bubbles:!0});return n.dispatchEvent(a),M("dblclick",n)},forward:()=>(window.history.forward(),M("forward",null)),reload:()=>(window.location.reload(),M("reload",null)),scroll_to:t=>{const e=A(t,"refId"),r=A(t,"label"),n=gt(t,"x",0),a=gt(t,"y",0);if(e||r){let i=e?Y(e):null;if(!i&&r&&(i=X(r)),i)return i.scrollIntoView({behavior:"smooth"}),M("scroll_to",i);Q(e,r,!0)}return window.scrollTo({top:a,left:n,behavior:"smooth"}),M("scroll_to",null,{amount:a})},evaluate:t=>{const e=A(t,"code");if(typeof e!="string")throw new Error("evaluate requires a string argument");return new Function(e)()},back:()=>(window.history.back(),M("back",null)),ping:()=>({ok:!0}),snapshot:async t=>{const e=de(t),r=typeof e.max_nodes=="number"?e.max_nodes:500;ce.debug("snapshot",{maxNodes:r,hasBody:!!document.body});const n=tn(r);return ce.debug("snapshot_result",{nodeCount:n.nodes.length}),n},fetch:async(t,e)=>{const r=de(t),n=r.url,a=(r.method||"GET").toString().toUpperCase(),i=r.headers||{},s=r.body??null,o=typeof r.timeout=="number"?r.timeout:rn,l=new AbortController,f=()=>l.abort();if(e){if(e.aborted)throw new DOMException("Aborted","AbortError");e.addEventListener("abort",f,{once:!0})}const v=setTimeout(()=>l.abort(),o);try{const E={method:a,headers:typeof i=="object"&&i!==null?i:{},signal:l.signal};s!=null&&(E.body=typeof s=="string"?s:String(s));const $=await fetch(n,E),z=await $.text();return{status:$.status,ok:$.ok,headers:Object.fromEntries($.headers.entries()),body:z}}catch(E){throw E}finally{clearTimeout(v),e==null||e.removeEventListener("abort",f)}}};function an(t,e){if(Ge(t))return t;const r=`page_${e}`;return Ge(r)?r:t}function vt(t,e,r,n,a){const i=an(t,e),s=nn[e];return s?(rr(i,e,s,r,a).then(l=>{ce.debug("dispatch_response",{registryAction:t,handlerAction:e,ok:l.ok}),n(l)}).catch(l=>{const f=l instanceof Error?l.message:String(l);ce.debug("dispatch_error",{registryAction:t,handlerAction:e,error:f}),n({ok:!1,error:f||String(l)})}),!0):(ce.debug("no_handler",{action:e,registryAction:t}),n({ok:!1,error:`Unknown content script action: ${e}`}),!1)}function sn(){chrome.runtime.onMessage.addListener((t,e,r)=>{if(e.id!==chrome.runtime.id)return ce.warn("unauthorized_sender",{senderId:e.id,expected:chrome.runtime.id}),r({ok:!1,error:"Unauthorized sender"}),!1;const n=de(t),a=String(n.type??""),i=String(n.action??"");if(ce.debug("received",{messageType:a,action:i,hasParams:!!n.params}),a==="registryCallCancel"){const s=String(n.id??"");return tr(s),r({ok:!0}),!1}if(a==="registryCall"){const s=Yr(i),o=typeof n.id=="string"?n.id:void 0;return vt(i,s,n.params,r,o)}return!i&&a==="contract-ping"?(r({ok:!0}),!1):i?vt(i,i,n.params,r):(r({ok:!1,error:"Missing action"}),!1)})}if(Jr(),window.__jsNotebookContentScriptInjected)throw new Error("Content script already injected");window.__jsNotebookContentScriptInjected=!0,er([...Kr(),...Hr()]),sn()})();
|
package/extension_js.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export type CellResult = { status: "ok"; stdout: string[]; stderr: string[]; res
|
|
|
32
32
|
export interface WasmAsyncError {
|
|
33
33
|
message: string;
|
|
34
34
|
code: string;
|
|
35
|
+
category?: string;
|
|
36
|
+
hint?: string;
|
|
37
|
+
recovery?: string[];
|
|
38
|
+
details?: Value;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
/**
|
|
@@ -164,6 +168,10 @@ export interface JsManifestEntry {
|
|
|
164
168
|
errorCategory: string | null;
|
|
165
169
|
permission: string | null;
|
|
166
170
|
example: string | null;
|
|
171
|
+
prerequisites?: string[] | null;
|
|
172
|
+
notes?: string[] | null;
|
|
173
|
+
tags?: string[] | null;
|
|
174
|
+
relatedApis?: string[] | null;
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
export interface JsParamDoc {
|