@xpert-ai/plugin-live-dashboard 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.xpertai-plugin/plugin.json +1 -1
  2. package/README.md +4 -2
  3. package/dist/index.js +3 -1
  4. package/dist/lib/agent.schema.d.ts +9 -9
  5. package/dist/lib/agent.schema.js +2 -1
  6. package/dist/lib/archive.service.d.ts +26 -2
  7. package/dist/lib/archive.service.js +17 -3
  8. package/dist/lib/bounded-map.d.ts +2 -0
  9. package/dist/lib/bounded-map.js +25 -0
  10. package/dist/lib/capacity.d.ts +14 -0
  11. package/dist/lib/capacity.js +16 -0
  12. package/dist/lib/dashboard-archive.d.ts +1 -1
  13. package/dist/lib/dashboard-queries.d.ts +1 -1
  14. package/dist/lib/dashboard-queries.js +11 -6
  15. package/dist/lib/dashboard-receipt.js +1 -1
  16. package/dist/lib/dashboard-sources.js +3 -2
  17. package/dist/lib/dashboard-view.schema.d.ts +20 -20
  18. package/dist/lib/dashboard.schema.d.ts +18 -18
  19. package/dist/lib/dashboard.schema.js +2 -1
  20. package/dist/lib/dashboard.service.d.ts +24 -5
  21. package/dist/lib/dashboard.service.js +58 -8
  22. package/dist/lib/definition-tools.d.ts +4 -4
  23. package/dist/lib/document-host.js +1 -1
  24. package/dist/lib/document-package.d.ts +1 -1
  25. package/dist/lib/editing-patch.js +2 -1
  26. package/dist/lib/editing.d.ts +11 -10
  27. package/dist/lib/editing.js +5 -1
  28. package/dist/lib/filter-evidence.d.ts +28 -0
  29. package/dist/lib/filter-evidence.js +3 -2
  30. package/dist/lib/html-guidance.d.ts +1 -0
  31. package/dist/lib/html-guidance.js +2 -1
  32. package/dist/lib/html-validation.js +1 -1
  33. package/dist/lib/middleware.d.ts +3 -1
  34. package/dist/lib/middleware.js +89 -11
  35. package/dist/lib/plugin.js +2 -1
  36. package/dist/lib/presentation.provider.d.ts +1 -1
  37. package/dist/lib/preview-retry.d.ts +4 -3
  38. package/dist/lib/preview-retry.js +13 -7
  39. package/dist/lib/prompt-workflows.js +1 -1
  40. package/dist/lib/query-session.d.ts +9 -0
  41. package/dist/lib/query-session.js +64 -0
  42. package/dist/lib/save-requests.d.ts +118 -0
  43. package/dist/lib/save-requests.js +199 -0
  44. package/dist/lib/source-executions.d.ts +243 -2
  45. package/dist/lib/source-executions.js +29 -5
  46. package/dist/lib/view.provider.d.ts +38 -3
  47. package/dist/lib/view.provider.js +20 -4
  48. package/dist/remote/app.js +114 -65
  49. package/dist/remote/build-manifest.json +37 -32
  50. package/dist/sandbox-actions/action.json +1 -1
  51. package/dist/sandbox-actions/bundle/host.js +63 -14
  52. package/dist/sandbox-actions/bundle/validate.mjs +2 -2
  53. package/dist/validation/host-entry.d.ts +5 -1
  54. package/dist/validation/host-entry.js +21 -4
  55. package/docs/docs.json +2 -0
  56. package/docs/large-dashboards-acceptance.mdx +74 -0
  57. package/docs/large-dashboards.mdx +80 -0
  58. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},s.getValidEnumValues=n=>{const a=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return s.objectValues(i)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},s.find=(n,a)=>{for(const i of n)if(a(i))return i},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(v||(v={}));var we;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(we||(we={}));const l=v.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=s=>{switch(typeof s){case"undefined":return l.undefined;case"string":return l.string;case"number":return Number.isNaN(s)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(s)?l.array:s===null?l.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?l.promise:typeof Map<"u"&&s instanceof Map?l.map:typeof Set<"u"&&s instanceof Set?l.set:typeof Date<"u"&&s instanceof Date?l.date:l.object;default:return l.unknown}},c=v.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 j extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,u=0;for(;u<i.path.length;){const f=i.path[u];u===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],u++}}};return n(this),r}static assert(e){if(!(e instanceof j))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,v.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}j.create=s=>new j(s);const fe=(s,e)=>{let t;switch(s.code){case c.invalid_type:s.received===l.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,v.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${v.joinValues(s.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${v.joinValues(s.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${v.joinValues(s.options)}, received '${s.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:v.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case c.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case c.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,v.assertNever(s)}return{message:t}};let We=fe;function Ye(){return We}const He=s=>{const{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function d(s,e){const t=Ye(),r=He({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===fe?void 0:fe].filter(n=>!!n)});s.common.issues.push(r)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if(n.status==="aborted")return p;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t){const a=await n.key,i=await n.value;r.push({key:a,value:i})}return I.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return p;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const p=Object.freeze({status:"aborted"}),ee=s=>({status:"dirty",value:s}),C=s=>({status:"valid",value:s}),Ie=s=>s.status==="aborted",Te=s=>s.status==="dirty",B=s=>s.status==="valid",re=s=>typeof Promise<"u"&&s instanceof Promise;var h;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));class A{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 Ee=(s,e)=>{if(B(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new j(s.common.issues);return this._error=t,this._error}}};function g(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:u}=s;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:n}}class _{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Ee(r,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return B(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>B(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(re(n)?n:Promise.resolve(n));return Ee(r,a)}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:c.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new H({schema:this,typeName:m.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 P.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return R.create(this)}promise(){return ce.create(this,this._def)}or(e){return ae.create([this,e],this._def)}and(e){return ie.create(this,e,this._def)}transform(e){return new H({...g(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new _e({...g(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new gt({typeName:m.ZodBranded,type:this,...g(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ve({...g(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ge=/^c[^\s-]{8,}$/i,Je=/^[0-9a-z]+$/,Qe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[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,Ke=/^[a-z0-9_-]{21}$/i,et=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tt=/^[-+]?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)?)??$/,st=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let he;const nt=/^(?:(?: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])$/,at=/^(?:(?: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])$/,it=/^(([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]))$/,ot=/^(([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])$/,ct=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ne="((\\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])))",ut=new RegExp(`^${Ne}$`);function Ce(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function lt(s){return new RegExp(`^${Ce(s)}$`)}function ft(s){let e=`${Ne}T${Ce(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ht(s,e){return!!((e==="v4"||!e)&&nt.test(s)||(e==="v6"||!e)&&it.test(s))}function mt(s,e){if(!et.test(s))return!1;try{const[t]=s.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function pt(s,e){return!!((e==="v4"||!e)&&at.test(s)||(e==="v6"||!e)&&ot.test(s))}class M extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.string,received:a.parsedType}),p}const r=new I;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")st.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")he||(he=new RegExp(rt,"u")),he.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ke.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Je.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Qe.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?ft(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?ut.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?lt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?tt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?ht(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?mt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?pt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?ct.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?dt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),r.dirty()):v.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(r)})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(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?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new M({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new M({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new M({...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}}M.create=s=>new M({checks:[],typeName:m.ZodString,coerce:s?.coerce??!1,...g(s)});function yt(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class F extends _{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)!==l.number){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.number,received:a.parsedType}),p}let r;const n=new I;for(const a of this._def.checks)a.kind==="int"?v.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?yt(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_finite,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,n){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(n)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&v.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}F.create=s=>new F({checks:[],typeName:m.ZodNumber,coerce:s?.coerce||!1,...g(s)});class te extends _{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)!==l.bigint)return this._getInvalidInput(e);let r;const n=new I;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),d(r,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):v.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,r,n){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:h.toString(n)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}te.create=s=>new te({checks:[],typeName:m.ZodBigInt,coerce:s?.coerce??!1,...g(s)});class me extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.boolean,received:r.parsedType}),p}return C(e.data)}}me.create=s=>new me({typeName:m.ZodBoolean,coerce:s?.coerce||!1,...g(s)});class ne extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:l.date,received:a.parsedType}),p}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),p}const r=new I;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):v.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}ne.create=s=>new ne({checks:[],coerce:s?.coerce||!1,typeName:m.ZodDate,...g(s)});class Se extends _{_parse(e){if(this._getType(e)!==l.symbol){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.symbol,received:r.parsedType}),p}return C(e.data)}}Se.create=s=>new Se({typeName:m.ZodSymbol,...g(s)});class Oe extends _{_parse(e){if(this._getType(e)!==l.undefined){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.undefined,received:r.parsedType}),p}return C(e.data)}}Oe.create=s=>new Oe({typeName:m.ZodUndefined,...g(s)});class pe extends _{_parse(e){if(this._getType(e)!==l.null){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.null,received:r.parsedType}),p}return C(e.data)}}pe.create=s=>new pe({typeName:m.ZodNull,...g(s)});class Ae extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return C(e.data)}}Ae.create=s=>new Ae({typeName:m.ZodAny,...g(s)});class Re extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return C(e.data)}}Re.create=s=>new Re({typeName:m.ZodUnknown,...g(s)});class U extends _{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:l.never,received:t.parsedType}),p}}U.create=s=>new U({typeName:m.ZodNever,...g(s)});class De extends _{_parse(e){if(this._getType(e)!==l.undefined){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.void,received:r.parsedType}),p}return C(e.data)}}De.create=s=>new De({typeName:m.ZodVoid,...g(s)});class R extends _{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return d(t,{code:c.invalid_type,expected:l.array,received:t.parsedType}),p;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new A(t,i,t.path,o)))).then(i=>I.mergeArray(r,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new A(t,i,t.path,o)));return I.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new R({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new R({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new R({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}R.create=(s,e)=>new R({type:s,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,...g(e)});function W(s){if(s instanceof x){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=P.create(W(r))}return new x({...s._def,shape:()=>e})}else return s instanceof R?new R({...s._def,type:W(s.element)}):s instanceof P?P.create(W(s.unwrap())):s instanceof G?G.create(W(s.unwrap())):s instanceof z?z.create(s.items.map(e=>W(e))):s}class x extends _{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=v.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.object){const f=this._getOrReturnCtx(e);return d(f,{code:c.invalid_type,expected:l.object,received:f.parsedType}),p}const{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(const f in n.data)i.includes(f)||o.push(f);const u=[];for(const f of i){const y=a[f],N=n.data[f];u.push({key:{status:"valid",value:f},value:y._parse(new A(n,N,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof U){const f=this._def.unknownKeys;if(f==="passthrough")for(const y of o)u.push({key:{status:"valid",value:y},value:{status:"valid",value:n.data[y]}});else if(f==="strict")o.length>0&&(d(n,{code:c.unrecognized_keys,keys:o}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const y of o){const N=n.data[y];u.push({key:{status:"valid",value:y},value:f._parse(new A(n,N,n.path,y)),alwaysSet:y in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const f=[];for(const y of u){const N=await y.key,T=await y.value;f.push({key:N,value:T,alwaysSet:y.alwaysSet})}return f}).then(f=>I.mergeObjectSync(r,f)):I.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{const n=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const r of v.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const r of v.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new x({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};for(const r of v.objectKeys(this.shape)){const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const r of v.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof P;)a=a._def.innerType;t[r]=a}return new x({...this._def,shape:()=>t})}keyof(){return Me(v.objectKeys(this.shape))}}x.create=(s,e)=>new x({shape:()=>s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...g(e)}),x.strictCreate=(s,e)=>new x({shape:()=>s,unknownKeys:"strict",catchall:U.create(),typeName:m.ZodObject,...g(e)}),x.lazycreate=(s,e)=>new x({shape:s,unknownKeys:"strip",catchall:U.create(),typeName:m.ZodObject,...g(e)});class ae extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(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 j(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),p}if(t.common.async)return Promise.all(r.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(n);{let a;const i=[];for(const u of r){const f={...t,common:{...t.common,issues:[]},parent:null},y=u._parseSync({data:t.data,path:t.path,parent:f});if(y.status==="valid")return y;y.status==="dirty"&&!a&&(a={result:y,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(u=>new j(u));return d(t,{code:c.invalid_union,unionErrors:o}),p}}get options(){return this._def.options}}ae.create=(s,e)=>new ae({options:s,typeName:m.ZodUnion,...g(e)});function ye(s,e){const t=L(s),r=L(e);if(s===e)return{valid:!0,data:s};if(t===l.object&&r===l.object){const n=v.objectKeys(e),a=v.objectKeys(s).filter(o=>n.indexOf(o)!==-1),i={...s,...e};for(const o of a){const u=ye(s[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===l.array&&r===l.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<s.length;a++){const i=s[a],o=e[a],u=ye(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===l.date&&r===l.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class ie extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(Ie(a)||Ie(i))return p;const o=ye(a.value,i.value);return o.valid?((Te(a)||Te(i))&&t.dirty(),{status:t.value,value:o.data}):(d(r,{code:c.invalid_intersection_types}),p)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ie.create=(s,e,t)=>new ie({left:s,right:e,typeName:m.ZodIntersection,...g(t)});class z extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.array)return d(r,{code:c.invalid_type,expected:l.array,received:r.parsedType}),p;if(r.data.length<this._def.items.length)return d(r,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&r.data.length>this._def.items.length&&(d(r,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new A(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>I.mergeArray(t,i)):I.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new z({...this._def,rest:e})}}z.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:s,typeName:m.ZodTuple,rest:null,...g(e)})};class oe extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.object)return d(r,{code:c.invalid_type,expected:l.object,received:r.parsedType}),p;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)n.push({key:a._parse(new A(r,o,r.path,o)),value:i._parse(new A(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?I.mergeObjectAsync(t,n):I.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof _?new oe({keyType:e,valueType:t,typeName:m.ZodRecord,...g(r)}):new oe({keyType:M.create(),valueType:e,typeName:m.ZodRecord,...g(t)})}}class Ze extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.map)return d(r,{code:c.invalid_type,expected:l.map,received:r.parsedType}),p;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],f)=>({key:n._parse(new A(r,o,r.path,[f,"key"])),value:a._parse(new A(r,u,r.path,[f,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const f=await u.key,y=await u.value;if(f.status==="aborted"||y.status==="aborted")return p;(f.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(f.value,y.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const f=u.key,y=u.value;if(f.status==="aborted"||y.status==="aborted")return p;(f.status==="dirty"||y.status==="dirty")&&t.dirty(),o.set(f.value,y.value)}return{status:t.value,value:o}}}}Ze.create=(s,e,t)=>new Ze({valueType:e,keyType:s,typeName:m.ZodMap,...g(t)});class se extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.set)return d(r,{code:c.invalid_type,expected:l.set,received:r.parsedType}),p;const n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(d(r,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(d(r,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const f=new Set;for(const y of u){if(y.status==="aborted")return p;y.status==="dirty"&&t.dirty(),f.add(y.value)}return{status:t.value,value:f}}const o=[...r.data.values()].map((u,f)=>a._parse(new A(r,u,r.path,f)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new se({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new se({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}se.create=(s,e)=>new se({valueType:s,minSize:null,maxSize:null,typeName:m.ZodSet,...g(e)});class je extends _{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})}}je.create=(s,e)=>new je({getter:s,typeName:m.ZodLazy,...g(e)});class ge extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}ge.create=(s,e)=>new ge({value:s,typeName:m.ZodLiteral,...g(e)});function Me(s,e){return new Y({values:s,typeName:m.ZodEnum,...g(e)})}class Y extends _{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return d(t,{expected:v.joinValues(r),received:t.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:r}),p}return C(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 Y.create(e,{...this._def,...t})}exclude(e,t=this._def){return Y.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}Y.create=Me;class $e extends _{_parse(e){const t=v.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==l.string&&r.parsedType!==l.number){const n=v.objectValues(t);return d(r,{expected:v.joinValues(n),received:r.parsedType,code:c.invalid_type}),p}if(this._cache||(this._cache=new Set(v.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=v.objectValues(t);return d(r,{received:r.data,code:c.invalid_enum_value,options:n}),p}return C(e.data)}get enum(){return this._def.values}}$e.create=(s,e)=>new $e({values:s,typeName:m.ZodNativeEnum,...g(e)});class ce extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:l.promise,received:t.parsedType}),p;const r=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return C(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ce.create=(s,e)=>new ce({type:s,typeName:m.ZodPromise,...g(e)});class H extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{d(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return p;const u=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?p:u.status==="dirty"||t.value==="dirty"?ee(u.value):u});{if(t.value==="aborted")return p;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?p:o.status==="dirty"||t.value==="dirty"?ee(o.value):o}}if(n.type==="refinement"){const i=o=>{const u=n.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?p:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!B(i))return p;const o=n.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:r.data,path:r.path,parent:r}).then(i=>B(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):p);v.assertNever(n)}}H.create=(s,e,t)=>new H({schema:s,typeName:m.ZodEffects,effect:e,...g(t)}),H.createWithPreprocess=(s,e,t)=>new H({schema:e,effect:{type:"preprocess",transform:s},typeName:m.ZodEffects,...g(t)});class P extends _{_parse(e){return this._getType(e)===l.undefined?C(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P.create=(s,e)=>new P({innerType:s,typeName:m.ZodOptional,...g(e)});class G extends _{_parse(e){return this._getType(e)===l.null?C(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(s,e)=>new G({innerType:s,typeName:m.ZodNullable,...g(e)});class _e extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===l.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}_e.create=(s,e)=>new _e({innerType:s,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});class ve extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return re(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new j(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new j(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ve.create=(s,e)=>new ve({innerType:s,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});class Le extends _{_parse(e){if(this._getType(e)!==l.nan){const r=this._getOrReturnCtx(e);return d(r,{code:c.invalid_type,expected:l.nan,received:r.parsedType}),p}return{status:"valid",value:e.data}}}Le.create=s=>new Le({typeName:m.ZodNaN,...g(s)});class gt extends _{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends _{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?p:a.status==="dirty"?(t.dirty(),ee(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?p:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new xe({in:e,out:t,typeName:m.ZodPipeline})}}class be extends _{_parse(e){const t=this._def.innerType._parse(e),r=n=>(B(n)&&(n.value=Object.freeze(n.value)),n);return re(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}}be.create=(s,e)=>new be({innerType:s,typeName:m.ZodReadonly,...g(e)});var m;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(m||(m={}));const O=M.create,_t=F.create,vt=me.create,xt=pe.create;U.create;const de=R.create,J=x.create,bt=ae.create;ie.create,z.create;const kt=oe.create,q=ge.create,Ue=Y.create;ce.create,P.create,G.create;function wt(s,e){if(s==null)return{};var t={},r=Object.keys(s),n,a;for(a=0;a<r.length;a++)n=r[a],!(e.indexOf(n)>=0)&&(t[n]=s[n]);return t}const Pe="xpert.artifact-document",Ve=1,ue=O().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,79}$/),It=bt([O().max(4e3),_t().finite(),vt(),xt()]),ze=kt(ue,It).refine(s=>Object.keys(s).length<=24,"Too many controls"),Tt=J({type:q("query"),requestId:O().min(1).max(80),bindingId:ue,controls:ze}).strict(),Et=J({bindingIds:de(ue).max(64).refine(s=>new Set(s).size===s.length,"Duplicate binding IDs"),defaults:ze,theme:Ue(["light","dark"]),locale:O().min(1).max(80)}).strict(),Nt=O().min(1).max(3e5).superRefine((s,e)=>{(new TextEncoder().encode(s).byteLength>3e5||!/<html[\s>]/i.test(s)||!/<body[\s>]/i.test(s))&&e.addIssue({code:"custom",message:"Supply a complete UTF-8 HTML document, at most 300 KB"})}),Ct=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D=(s,e)=>s>>>e|s<<32-e;function St(s){const e=new Uint8Array(Math.ceil((s.length+9)/64)*64);e.set(s),e[s.length]=128;const t=new DataView(e.buffer);t.setUint32(e.length-8,Math.floor(s.length/536870912)),t.setUint32(e.length-4,s.length*8>>>0);const r=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),n=new Uint32Array(64);for(let a=0;a<e.length;a+=64){for(let b=0;b<16;b++)n[b]=t.getUint32(a+b*4);for(let b=16;b<64;b++){const E=n[b-15],Z=n[b-2],V=D(E,7)^D(E,18)^E>>>3,X=D(Z,17)^D(Z,19)^Z>>>10;n[b]=n[b-16]+V+n[b-7]+X>>>0}let[i,o,u,f,y,N,T,Q]=r;for(let b=0;b<64;b++){const E=D(y,6)^D(y,11)^D(y,25),Z=y&N^~y&T,V=Q+E+Z+Ct[b]+n[b]>>>0,X=D(i,2)^D(i,13)^D(i,22),w=i&o^i&u^o&u,S=X+w>>>0;Q=T,T=N,N=y,y=f+V>>>0,f=u,u=o,o=i,i=V+S>>>0}r[0]=r[0]+i>>>0,r[1]=r[1]+o>>>0,r[2]=r[2]+u>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+y>>>0,r[5]=r[5]+N>>>0,r[6]=r[6]+T>>>0,r[7]=r[7]+Q>>>0}return Array.from(r,a=>a.toString(16).padStart(8,"0")).join("")}const qe=J({id:ue,version:O().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),format:q("classic-script"),global:O().regex(/^[A-Za-z_$][A-Za-z0-9_$]{0,79}$/).refine(s=>!["window","self","globalThis","document","parent","top","location","xpertLiveArtifact","__proto__","constructor","prototype"].includes(s)),sha256:O().regex(/^[a-f0-9]{64}$/)}).strict(),Ot=qe.transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256})),At=de(Ot).max(8).superRefine((s,e)=>{(new Set(s.map(t=>t.id)).size!==s.length||new Set(s.map(t=>t.global)).size!==s.length)&&e.addIssue({code:"custom",message:"Duplicate dependency ID or global"})}),Rt=de(qe.extend({source:O().min(1).max(4e6)}).strict().transform(s=>({id:s.id,version:s.version,format:"classic-script",global:s.global,sha256:s.sha256,source:s.source}))).max(8);function Dt(s,e){const t=Rt.parse(s);At.parse(t.map(n=>{var{source:a}=n,i=wt(n,["source"]);return i}));let r=0;for(const n of t){const a=new TextEncoder().encode(n.source);if(r+=a.length,a.length>4e6||r>8e6)throw new Error("DOCUMENT_DEPENDENCY_TOO_LARGE");if(St(a)!==n.sha256)throw new Error("DOCUMENT_DEPENDENCY_INTEGRITY_FAILED")}return t.map(n=>({id:n.id,version:n.version,global:n.global,sha256:n.sha256,source:n.source,format:"classic-script"}))}function Zt(s){const e=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/>/g,"\\u003e");return Dt(s).map(t=>`<script>(()=>{const s=document.createElement('script');s.textContent=${e(t.source)};document.head.appendChild(s);s.remove();if(typeof window[${e(t.global)}]==='undefined')throw new Error('DOCUMENT_DEPENDENCY_GLOBAL_MISSING');})();<\/script>`).join("")}const jt=O().max(250).refine(s=>{try{const e=new URL(s);return e.protocol==="https:"&&e.origin===s&&!e.username&&!e.password&&/^(?:[a-z0-9.-]+|\[[a-f0-9:]+\])$/i.test(e.hostname)}catch{return!1}},"Use an exact HTTPS origin without a path, credentials or wildcard"),le=de(jt).max(16),Mt=J({mode:Ue(["restricted","unrestricted"]).optional(),scripts:le.optional(),styles:le.optional(),fonts:le.optional(),images:le.optional()}).strict();function Be(s){const e=Mt.parse(s??{});if(e.mode==="unrestricted")return["default-src * data: blob:","script-src * data: blob: 'unsafe-inline'","style-src * data: blob: 'unsafe-inline'","img-src * data: blob:","font-src * data: blob:","connect-src * data: blob: ws: wss:","media-src * data: blob:","frame-src * data: blob:","worker-src * data: blob:","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ");const t=r=>r?.length?` ${[...new Set(r)].join(" ")}`:"";return["default-src 'none'",`script-src 'unsafe-inline'${t(e.scripts)}`,`style-src 'unsafe-inline'${t(e.styles)}`,`img-src data: blob:${t(e.images)}`,`font-src data:${t(e.fonts)}`,"connect-src 'none'","frame-src 'none'","worker-src 'none'","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ")}function $t(s,e,t){let r;try{r=new URL(t)}catch{return!1}if(s.mode==="unrestricted")return["http:","https:","ws:","wss:","data:","blob:"].includes(r.protocol);if(r.protocol!=="https:"||r.username||r.password)return!1;const n=e==="script"?s.scripts:e==="stylesheet"?s.styles:e==="font"?s.fonts:e==="image"?s.images:void 0;var a;return(a=n?.includes(r.origin))!=null?a:!1}Be();function Lt(s,e,t=[],r){if(Nt.parse(s),!/^[a-f0-9]{32}$/.test(e))throw new Error("Invalid Artifact document session ID");return`<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Be(r)}"><script>${Ut.replace("__XPERT_DOCUMENT_SESSION__",e)}<\/script>${Zt(t)}${s}`}const Ut=String.raw`
1
+ var DocumentHost=(function(se){"use strict";var k;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(k||(k={}));var Se;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Se||(Se={}));const f=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},c=k.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 q extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,u=0;for(;u<i.path.length;){const l=i.path[u];u===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof q))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}q.create=r=>new q(r);const ye=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.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}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.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==="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 c.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 c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}};let et=ye;function tt(){return et}const rt=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const u=s.filter(l=>!!l).slice().reverse();for(const l of u)o=l(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function d(r,e){const t=tt(),s=rt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ye?void 0:ye].filter(n=>!!n)});r.common.issues.push(s)}class A{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return g;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return A.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return g;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const g=Object.freeze({status:"aborted"}),ne=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),Ce=r=>r.status==="aborted",Ae=r=>r.status==="dirty",H=r=>r.status==="valid",ce=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));class U{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}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 De=(r,e)=>{if(H(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 q(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:u}=r;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:n}}class b{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new A,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ce(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parseSync({data:e,path:s.path,parent:s});return De(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return H(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>H(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ce(n)?n:Promise.resolve(n));return De(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new ee({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return B.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return he.create(this,this._def)}or(e){return ue.create([this,e],this._def)}and(e){return le.create(this,e,this._def)}transform(e){return new ee({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new we({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new It({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ee({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return Te.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const st=/^c[^\s-]{8,}$/i,nt=/^[0-9a-z]+$/,at=/^[0-9A-HJKMNP-TV-Z]{26}$/i,it=/^[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,ot=/^[a-z0-9_-]{21}$/i,ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dt=/^[-+]?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)?)??$/,ut=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _e;const ft=/^(?:(?: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])$/,ht=/^(?:(?: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])$/,mt=/^(([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]))$/,pt=/^(([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])$/,gt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Re="((\\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])))",_t=new RegExp(`^${Re}$`);function Me(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function vt(r){return new RegExp(`^${Me(r)}$`)}function xt(r){let e=`${Re}T${Me(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function bt(r,e){return!!((e==="v4"||!e)&&ft.test(r)||(e==="v6"||!e)&&mt.test(r))}function kt(r,e){if(!ct.test(r))return!1;try{const[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function wt(r,e){return!!((e==="v4"||!e)&&ht.test(r)||(e==="v6"||!e)&&pt.test(r))}class P extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),g}const s=new A;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?d(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&d(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")ut.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")_e||(_e=new RegExp(lt,"u")),_e.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")it.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")ot.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")st.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")nt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")at.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),d(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?xt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?_t.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?dt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?kt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?wt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?gt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?yt.test(e.data)||(n=this._getOrReturnCtx(e,n),d(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):k.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(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?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...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}}P.create=r=>new P({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,..._(r)});function Et(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class J extends b{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)!==f.number){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),g}let s;const n=new A;for(const a of this._def.checks)a.kind==="int"?k.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Et(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_finite,message:a.message}),n.dirty()):k.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new J({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.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"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}J.create=r=>new J({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,..._(r)});class ae extends b{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)!==f.bigint)return this._getInvalidInput(e);let s;const n=new A;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),d(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):k.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.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}}ae.create=r=>new ae({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,..._(r)});class ve extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),g}return R(e.data)}}ve.create=r=>new ve({typeName:p.ZodBoolean,coerce:r?.coerce||!1,..._(r)});class de extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),g}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return d(a,{code:c.invalid_date}),g}const s=new A;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),d(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):k.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.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}}de.create=r=>new de({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,..._(r)});class je extends b{_parse(e){if(this._getType(e)!==f.symbol){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),g}return R(e.data)}}je.create=r=>new je({typeName:p.ZodSymbol,..._(r)});class Ue extends b{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),g}return R(e.data)}}Ue.create=r=>new Ue({typeName:p.ZodUndefined,..._(r)});class xe extends b{_parse(e){if(this._getType(e)!==f.null){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),g}return R(e.data)}}xe.create=r=>new xe({typeName:p.ZodNull,..._(r)});class Ze extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}}Ze.create=r=>new Ze({typeName:p.ZodAny,..._(r)});class Le extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}}Le.create=r=>new Le({typeName:p.ZodUnknown,..._(r)});class z extends b{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),g}}z.create=r=>new z({typeName:p.ZodNever,..._(r)});class qe extends b{_parse(e){if(this._getType(e)!==f.undefined){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),g}return R(e.data)}}qe.create=r=>new qe({typeName:p.ZodVoid,..._(r)});class Z extends b{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return d(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),g;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(d(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(d(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(d(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new U(t,i,t.path,o)))).then(i=>A.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new U(t,i,t.path,o)));return A.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}}Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function X(r){if(r instanceof O){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=B.create(X(s))}return new O({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:X(r.element)}):r instanceof B?B.create(X(r.unwrap())):r instanceof te?te.create(X(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>X(e))):r}class O extends b{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=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){const l=this._getOrReturnCtx(e);return d(l,{code:c.invalid_type,expected:f.object,received:l.parsedType}),g}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof z&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const u=[];for(const l of i){const m=a[l],S=n.data[l];u.push({key:{status:"valid",value:l},value:m._parse(new U(n,S,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof z){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of o)u.push({key:{status:"valid",value:m},value:{status:"valid",value:n.data[m]}});else if(l==="strict")o.length>0&&(d(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of o){const S=n.data[m];u.push({key:{status:"valid",value:m},value:l._parse(new U(n,S,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of u){const S=await m.key,D=await m.value;l.push({key:S,value:D,alwaysSet:m.alwaysSet})}return l}).then(l=>A.mergeObjectSync(s,l)):A.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new O({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}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:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new O({...this._def,catchall:e})}pick(e){const t={};for(const s of k.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new O({...this._def,shape:()=>t})}omit(e){const t={};for(const s of k.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new O({...this._def,shape:()=>t})}deepPartial(){return X(this)}partial(e){const t={};for(const s of k.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new O({...this._def,shape:()=>t})}required(e){const t={};for(const s of k.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof B;)a=a._def.innerType;t[s]=a}return new O({...this._def,shape:()=>t})}keyof(){return Ve(k.objectKeys(this.shape))}}O.create=(r,e)=>new O({shape:()=>r,unknownKeys:"strip",catchall:z.create(),typeName:p.ZodObject,..._(e)}),O.strictCreate=(r,e)=>new O({shape:()=>r,unknownKeys:"strict",catchall:z.create(),typeName:p.ZodObject,..._(e)}),O.lazycreate=(r,e)=>new O({shape:r,unknownKeys:"strip",catchall:z.create(),typeName:p.ZodObject,..._(e)});class ue extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(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 q(o.ctx.common.issues));return d(t,{code:c.invalid_union,unionErrors:i}),g}if(t.common.async)return Promise.all(s.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(n);{let a;const i=[];for(const u of s){const l={...t,common:{...t.common,issues:[]},parent:null},m=u._parseSync({data:t.data,path:t.path,parent:l});if(m.status==="valid")return m;m.status==="dirty"&&!a&&(a={result:m,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new q(u));return d(t,{code:c.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}ue.create=(r,e)=>new ue({options:r,typeName:p.ZodUnion,..._(e)});function be(r,e){const t=V(r),s=V(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){const n=k.objectKeys(e),a=k.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=be(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],u=be(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class le extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Ce(a)||Ce(i))return g;const o=be(a.value,i.value);return o.valid?((Ae(a)||Ae(i))&&t.dirty(),{status:t.value,value:o.data}):(d(s,{code:c.invalid_intersection_types}),g)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}le.create=(r,e,t)=>new le({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class Y extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return d(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),g;if(s.data.length<this._def.items.length)return d(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&s.data.length>this._def.items.length&&(d(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new U(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>A.mergeArray(t,i)):A.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:p.ZodTuple,rest:null,..._(e)})};class fe extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return d(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),g;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new U(s,o,s.path,o)),value:i._parse(new U(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?A.mergeObjectAsync(t,n):A.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof b?new fe({keyType:e,valueType:t,typeName:p.ZodRecord,..._(s)}):new fe({keyType:P.create(),valueType:e,typeName:p.ZodRecord,..._(t)})}}class Pe extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return d(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),g;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,u],l)=>({key:n._parse(new U(s,o,s.path,[l,"key"])),value:a._parse(new U(s,u,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const l=await u.key,m=await u.value;if(l.status==="aborted"||m.status==="aborted")return g;(l.status==="dirty"||m.status==="dirty")&&t.dirty(),o.set(l.value,m.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const l=u.key,m=u.value;if(l.status==="aborted"||m.status==="aborted")return g;(l.status==="dirty"||m.status==="dirty")&&t.dirty(),o.set(l.value,m.value)}return{status:t.value,value:o}}}}Pe.create=(r,e,t)=>new Pe({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class ie extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return d(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),g;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(d(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(d(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const l=new Set;for(const m of u){if(m.status==="aborted")return g;m.status==="dirty"&&t.dirty(),l.add(m.value)}return{status:t.value,value:l}}const o=[...s.data.values()].map((u,l)=>a._parse(new U(s,u,s.path,l)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new ie({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new ie({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ie.create=(r,e)=>new ie({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class $e extends b{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})}}$e.create=(r,e)=>new $e({getter:r,typeName:p.ZodLazy,..._(e)});class ke extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}ke.create=(r,e)=>new ke({value:r,typeName:p.ZodLiteral,..._(e)});function Ve(r,e){return new K({values:r,typeName:p.ZodEnum,..._(e)})}class K extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{expected:k.joinValues(s),received:t.parsedType,code:c.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return d(t,{received:t.data,code:c.invalid_enum_value,options:s}),g}return R(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return K.create(e,{...this._def,...t})}exclude(e,t=this._def){return K.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}K.create=Ve;class ze extends b{_parse(e){const t=k.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){const n=k.objectValues(t);return d(s,{expected:k.joinValues(n),received:s.parsedType,code:c.invalid_type}),g}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=k.objectValues(t);return d(s,{received:s.data,code:c.invalid_enum_value,options:n}),g}return R(e.data)}get enum(){return this._def.values}}ze.create=(r,e)=>new ze({values:r,typeName:p.ZodNativeEnum,..._(e)});class he extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return d(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),g;const s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return R(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:p.ZodPromise,..._(e)});class ee extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{d(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return g;const u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?g:u.status==="dirty"||t.value==="dirty"?ne(u.value):u});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?g:o.status==="dirty"||t.value==="dirty"?ne(o.value):o}}if(n.type==="refinement"){const i=o=>{const u=n.refinement(o,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!H(i))return g;const o=n.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:s.data,path:s.path,parent:s}).then(i=>H(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):g);k.assertNever(n)}}ee.create=(r,e,t)=>new ee({schema:r,typeName:p.ZodEffects,effect:e,..._(t)}),ee.createWithPreprocess=(r,e,t)=>new ee({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class B extends b{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}B.create=(r,e)=>new B({innerType:r,typeName:p.ZodOptional,..._(e)});class te extends b{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(r,e)=>new te({innerType:r,typeName:p.ZodNullable,..._(e)});class we extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}we.create=(r,e)=>new we({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class Ee extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ce(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new q(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new q(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Be extends b{_parse(e){if(this._getType(e)!==f.nan){const s=this._getOrReturnCtx(e);return d(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),g}return{status:"valid",value:e.data}}}Be.create=r=>new Be({typeName:p.ZodNaN,..._(r)});class It extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ie extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?g:a.status==="dirty"?(t.dirty(),ne(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?g:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Ie({in:e,out:t,typeName:p.ZodPipeline})}}class Te extends b{_parse(e){const t=this._def.innerType._parse(e),s=n=>(H(n)&&(n.value=Object.freeze(n.value)),n);return ce(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Te.create=(r,e)=>new Te({innerType:r,typeName:p.ZodReadonly,..._(e)});var p;(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"})(p||(p={}));const j=P.create,Tt=J.create,Nt=ve.create,Ot=xe.create;z.create;const me=Z.create,re=O.create,St=ue.create;le.create,Y.create;const Ct=fe.create,Q=ke.create,Ne=K.create;he.create,B.create,te.create;function At(r,e){if(r==null)return{};var t={},s=Object.keys(r),n,a;for(a=0;a<s.length;a++)n=s[a],!(e.indexOf(n)>=0)&&(t[n]=r[n]);return t}function F(){return F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},F.apply(this,arguments)}const Fe="xpert.artifact-document",We=1,pe=j().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,79}$/),Dt=St([j().max(4e3),Tt().finite(),Nt(),Ot()]),Ye=Ct(pe,Dt).refine(r=>Object.keys(r).length<=24,"Too many controls"),Rt=re({type:Q("query"),requestId:j().min(1).max(80),bindingId:pe,controls:Ye,priority:Ne(["interactive","initial","refresh"]).optional()}).strict(),Mt=re({bindingIds:me(pe).max(64).refine(r=>new Set(r).size===r.length,"Duplicate binding IDs"),defaults:Ye,theme:Ne(["light","dark"]),locale:j().min(1).max(80)}).strict(),jt=j().min(1).max(3e5).superRefine((r,e)=>{(new TextEncoder().encode(r).byteLength>3e5||!/<html[\s>]/i.test(r)||!/<body[\s>]/i.test(r))&&e.addIssue({code:"custom",message:"Supply a complete UTF-8 HTML document, at most 300 KB"})}),Ut=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),L=(r,e)=>r>>>e|r<<32-e;function Zt(r){const e=new Uint8Array(Math.ceil((r.length+9)/64)*64);e.set(r),e[r.length]=128;const t=new DataView(e.buffer);t.setUint32(e.length-8,Math.floor(r.length/536870912)),t.setUint32(e.length-4,r.length*8>>>0);const s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),n=new Uint32Array(64);for(let a=0;a<e.length;a+=64){for(let w=0;w<16;w++)n[w]=t.getUint32(a+w*4);for(let w=16;w<64;w++){const v=n[w-15],y=n[w-2],E=L(v,7)^L(v,18)^v>>>3,N=L(y,17)^L(y,19)^y>>>10;n[w]=n[w-16]+E+n[w-7]+N>>>0}let[i,o,u,l,m,S,D,M]=s;for(let w=0;w<64;w++){const v=L(m,6)^L(m,11)^L(m,25),y=m&S^~m&D,E=M+v+y+Ut[w]+n[w]>>>0,N=L(i,2)^L(i,13)^L(i,22),W=i&o^i&u^o&u,G=N+W>>>0;M=D,D=S,S=m,m=l+E>>>0,l=u,u=o,o=i,i=E+G>>>0}s[0]=s[0]+i>>>0,s[1]=s[1]+o>>>0,s[2]=s[2]+u>>>0,s[3]=s[3]+l>>>0,s[4]=s[4]+m>>>0,s[5]=s[5]+S>>>0,s[6]=s[6]+D>>>0,s[7]=s[7]+M>>>0}return Array.from(s,a=>a.toString(16).padStart(8,"0")).join("")}const Qe=re({id:pe,version:j().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),format:Q("classic-script"),global:j().regex(/^[A-Za-z_$][A-Za-z0-9_$]{0,79}$/).refine(r=>!["window","self","globalThis","document","parent","top","location","xpertLiveArtifact","__proto__","constructor","prototype"].includes(r)),sha256:j().regex(/^[a-f0-9]{64}$/)}).strict(),Lt=Qe.transform(r=>({id:r.id,version:r.version,format:"classic-script",global:r.global,sha256:r.sha256})),qt=me(Lt).max(8).superRefine((r,e)=>{(new Set(r.map(t=>t.id)).size!==r.length||new Set(r.map(t=>t.global)).size!==r.length)&&e.addIssue({code:"custom",message:"Duplicate dependency ID or global"})}),Pt=me(Qe.extend({source:j().min(1).max(4e6)}).strict().transform(r=>({id:r.id,version:r.version,format:"classic-script",global:r.global,sha256:r.sha256,source:r.source}))).max(8);function $t(r,e){const t=Pt.parse(r);qt.parse(t.map(n=>{var{source:a}=n,i=At(n,["source"]);return i}));let s=0;for(const n of t){const a=new TextEncoder().encode(n.source);if(s+=a.length,a.length>4e6||s>8e6)throw new Error("DOCUMENT_DEPENDENCY_TOO_LARGE");if(Zt(a)!==n.sha256)throw new Error("DOCUMENT_DEPENDENCY_INTEGRITY_FAILED")}return t.map(n=>({id:n.id,version:n.version,global:n.global,sha256:n.sha256,source:n.source,format:"classic-script"}))}function Vt(r){const e=t=>JSON.stringify(t).replace(/</g,"\\u003c").replace(/>/g,"\\u003e");return $t(r).map(t=>`<script>(()=>{const s=document.createElement('script');s.textContent=${e(t.source)};document.head.appendChild(s);s.remove();if(typeof window[${e(t.global)}]==='undefined')throw new Error('DOCUMENT_DEPENDENCY_GLOBAL_MISSING');})();<\/script>`).join("")}const zt=j().max(250).refine(r=>{try{const e=new URL(r);return e.protocol==="https:"&&e.origin===r&&!e.username&&!e.password&&/^(?:[a-z0-9.-]+|\[[a-f0-9:]+\])$/i.test(e.hostname)}catch{return!1}},"Use an exact HTTPS origin without a path, credentials or wildcard"),ge=me(zt).max(16),Bt=re({mode:Ne(["restricted","unrestricted"]).optional(),scripts:ge.optional(),styles:ge.optional(),fonts:ge.optional(),images:ge.optional()}).strict();function Ge(r){const e=Bt.parse(r??{});if(e.mode==="unrestricted")return["default-src * data: blob:","script-src * data: blob: 'unsafe-inline'","style-src * data: blob: 'unsafe-inline'","img-src * data: blob:","font-src * data: blob:","connect-src * data: blob: ws: wss:","media-src * data: blob:","frame-src * data: blob:","worker-src * data: blob:","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ");const t=s=>s?.length?` ${[...new Set(s)].join(" ")}`:"";return["default-src 'none'",`script-src 'unsafe-inline'${t(e.scripts)}`,`style-src 'unsafe-inline'${t(e.styles)}`,`img-src data: blob:${t(e.images)}`,`font-src data:${t(e.fonts)}`,"connect-src 'none'","frame-src 'none'","worker-src 'none'","object-src 'none'","base-uri 'none'","form-action 'none'"].join("; ")}function Ft(r,e,t){let s;try{s=new URL(t)}catch{return!1}if(r.mode==="unrestricted")return["http:","https:","ws:","wss:","data:","blob:"].includes(s.protocol);if(s.protocol!=="https:"||s.username||s.password)return!1;const n=e==="script"?r.scripts:e==="stylesheet"?r.styles:e==="font"?r.fonts:e==="image"?r.images:void 0;var a;return(a=n?.includes(s.origin))!=null?a:!1}Ge();function Wt(r,e,t=[],s){if(jt.parse(r),!/^[a-f0-9]{32}$/.test(e))throw new Error("Invalid Artifact document session ID");return`<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Ge(s)}"><script>${Yt.replace("__XPERT_DOCUMENT_SESSION__",e)}<\/script>${Vt(t)}${r}`}const Yt=String.raw`
2
2
  ;(() => {
3
3
  'use strict'
4
4
  const SESSION_ID = '__XPERT_DOCUMENT_SESSION__'
@@ -7,7 +7,10 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
7
7
  pending = new Map(),
8
8
  listeners = new Map(),
9
9
  lastControls = new Map(),
10
- latest = new Map()
10
+ latest = new Map(),
11
+ inFlight = new Map(),
12
+ deliveryLocks = new Map()
13
+ let refreshing = false
11
14
  let port,
12
15
  context,
13
16
  sequence = 0,
@@ -22,24 +25,33 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
22
25
  }
23
26
  }
24
27
  const fail = (code) => Object.assign(new Error(code), { code })
25
- const query = async (bindingId, controls = {}) => {
28
+ const query = async (bindingId, controls = {}, priority, owner) => {
26
29
  await ready
27
30
  if (!context.bindingIds.includes(bindingId)) {
28
31
  port.postMessage({ type: 'diagnostic', code: 'DOCUMENT_BINDING_DENIED' })
29
32
  throw fail('DOCUMENT_BINDING_DENIED')
30
33
  }
31
- const requestId = 'q' + ++sequence,
32
- values = { ...context.defaults, ...controls }
34
+ if (deliveryLocks.has(bindingId) && deliveryLocks.get(bindingId) !== owner) deliveryLocks.delete(bindingId)
35
+ const values = { ...context.defaults, ...controls },
36
+ key = JSON.stringify(Object.keys(values).sort().map(id => [id, values[id]])),
37
+ previous = inFlight.get(bindingId)
38
+ if (previous && previous.key === key) return previous.promise
39
+ priority = priority || (lastControls.has(bindingId) ? 'interactive' : 'initial')
40
+ const requestId = 'q' + ++sequence
33
41
  lastControls.set(bindingId, values)
34
42
  latest.set(bindingId, requestId)
35
- return new Promise((resolve, reject) => {
43
+ const promise = new Promise((resolve, reject) => {
36
44
  const timer = setTimeout(() => {
37
45
  pending.delete(requestId)
38
- reject(fail('DOCUMENT_QUERY_TIMEOUT'))
39
- }, 45000)
46
+ reject(fail('DOCUMENT_QUEUE_TIMEOUT'))
47
+ }, 185000)
40
48
  pending.set(requestId, { resolve, reject, timer, bindingId })
41
- port.postMessage({ type: 'query', requestId, bindingId, controls: values })
49
+ port.postMessage({ type: 'query', requestId, bindingId, controls: values, priority })
42
50
  })
51
+ inFlight.set(bindingId, { key, promise })
52
+ try { return await promise } finally {
53
+ if (inFlight.get(bindingId)?.promise === promise) inFlight.delete(bindingId)
54
+ }
43
55
  }
44
56
  const subscribe = (id, fn) => {
45
57
  if (typeof fn !== 'function') throw fail('DOCUMENT_INVALID_LISTENER')
@@ -48,7 +60,28 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
48
60
  listeners.set(id, set)
49
61
  return () => set.delete(fn)
50
62
  }
51
- const refresh = async (id) => query(id, lastControls.get(id) || {})
63
+ const refresh = async (id) => query(id, lastControls.get(id) || {}, 'refresh')
64
+ const queryGroup = async (requests, priority) => {
65
+ await ready
66
+ const ids = requests.map(request => request.bindingId)
67
+ if (!ids.length) return { datasets: [], failures: [] }
68
+ if (ids.length > 64 || new Set(ids).size !== ids.length || ids.some(id => !context.bindingIds.includes(id)))
69
+ throw fail('DOCUMENT_BINDING_DENIED')
70
+ const owner = Symbol('query-group')
71
+ ids.forEach(id => deliveryLocks.set(id, owner))
72
+ const results = await Promise.allSettled(requests.map(request => query(request.bindingId, request.controls, priority, owner)))
73
+ const current = ids.every(id => deliveryLocks.get(id) === owner)
74
+ ids.forEach(id => { if (deliveryLocks.get(id) === owner) deliveryLocks.delete(id) })
75
+ if (!current) throw fail('DOCUMENT_QUERY_SUPERSEDED')
76
+ const datasets = [], failures = []
77
+ results.forEach((result, index) => {
78
+ if (result.status === 'fulfilled') { datasets.push(result.value); emit(ids[index], result.value) }
79
+ else failures.push({ bindingId: ids[index], code: result.reason?.code || 'DOCUMENT_QUERY_FAILED' })
80
+ })
81
+ return { datasets, failures }
82
+ }
83
+ // Subscribers see successful members of one filter round together, after it settles.
84
+ const queryMany = (ids, controls = {}) => queryGroup(ids.map(bindingId => ({ bindingId, controls })), 'interactive')
52
85
  const bindSelect = (element, config) => {
53
86
  if (
54
87
  !element ||
@@ -100,7 +133,7 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
100
133
  }
101
134
  }
102
135
  Object.defineProperty(window, 'xpertLiveArtifact', {
103
- value: Object.freeze({ ready: () => ready, query, subscribe, refresh, bindSelect }),
136
+ value: Object.freeze({ ready: () => ready, query, queryMany, subscribe, refresh, bindSelect }),
104
137
  writable: false,
105
138
  configurable: false
106
139
  })
@@ -124,7 +157,23 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
124
157
  port.onmessage = (event) => {
125
158
  const data = event.data
126
159
  if (data.type === 'refresh') {
127
- for (const id of new Set([...listeners.keys(), ...lastControls.keys()])) refresh(id).catch(console.error)
160
+ if (data.bindingId) { refresh(data.bindingId).catch(console.error); return }
161
+ if (refreshing) return
162
+ refreshing = true
163
+ queryGroup([...new Set([...listeners.keys(), ...lastControls.keys()])].map(bindingId => ({ bindingId, controls: lastControls.get(bindingId) || {} })), 'refresh')
164
+ .catch(error => { if (error.code !== 'DOCUMENT_QUERY_SUPERSEDED') console.error(error) })
165
+ .finally(() => { refreshing = false })
166
+ return
167
+ }
168
+ if (data.type === 'query-state') {
169
+ const entry = pending.get(data.requestId)
170
+ if (entry && data.state === 'running') {
171
+ clearTimeout(entry.timer)
172
+ entry.timer = setTimeout(() => {
173
+ pending.delete(data.requestId)
174
+ entry.reject(fail('DOCUMENT_QUERY_TIMEOUT'))
175
+ }, 50000)
176
+ }
128
177
  return
129
178
  }
130
179
  if (data.type !== 'result') return
@@ -137,7 +186,7 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
137
186
  return
138
187
  }
139
188
  if (data.ok) {
140
- emit(entry.bindingId, data.dataset)
189
+ if (!deliveryLocks.has(entry.bindingId)) emit(entry.bindingId, data.dataset)
141
190
  entry.resolve(data.dataset)
142
191
  } else entry.reject(fail(data.code || 'DOCUMENT_QUERY_FAILED'))
143
192
  }
@@ -146,4 +195,4 @@ var DocumentHost=(function(K){"use strict";var v;(function(s){s.assertEqual=n=>{
146
195
  })
147
196
  parent.postMessage({ channel: CHANNEL, version: VERSION, type: 'ready', sessionId: SESSION_ID }, '*')
148
197
  })()
149
- `,Pt=J({channel:q(Pe),version:q(Ve),type:q("ready"),sessionId:O().regex(/^[a-f0-9]{32}$/)}).strict(),Vt=J({type:q("diagnostic"),code:q("DOCUMENT_BINDING_DENIED")}).strict();function zt(s,e){if(!s.ownerDocument.querySelector("meta[data-xpert-document-policy]"))throw new Error("Install the Artifact document frame policy before mounting a document");const t=Et.parse(e.context),r=Array.from(crypto.getRandomValues(new Uint8Array(16)),w=>w.toString(16).padStart(2,"0")).join(""),n=Lt(e.html,r,e.dependencies,e.networkPolicy),a=new MessageChannel,i=new Set(t.bindingIds),o=new Set,u=new Set,f=new Map,y=s.ownerDocument.defaultView;let N=!1,T=!1,Q=0,b=Date.now();s.setAttribute("sandbox","allow-scripts"),s.referrerPolicy="no-referrer";const E=(w,S)=>{try{w?.(S)}catch{}},Z=w=>{T||a.port1.postMessage(w)},V=(w,S)=>{Z({type:"result",requestId:w,ok:!1,code:S}),E(e.onError,S)};a.port1.onmessage=async w=>{if(T)return;const S=Vt.safeParse(w.data);if(S.success){E(e.onError,S.data.code);return}const $=Tt.safeParse(w.data);if(!$.success){E(e.onError,"DOCUMENT_INVALID_REQUEST");return}const k={type:$.data.type,requestId:$.data.requestId,bindingId:$.data.bindingId,controls:$.data.controls};if(!i.has(k.bindingId)){V(k.requestId,"DOCUMENT_BINDING_DENIED");return}if(Date.now()-b>=6e4&&(Q=0,b=Date.now(),o.clear()),u.has(k.requestId)||o.has(k.requestId)){V(k.requestId,"DOCUMENT_REQUEST_REPLAY");return}if(u.size>=8||++Q>60){V(k.requestId,"DOCUMENT_QUERY_LIMIT");return}o.add(k.requestId),u.add(k.requestId),f.set(k.bindingId,k.requestId),E(e.onBusy,!0);try{const ke=await e.query(k);T||(Z({type:"result",requestId:k.requestId,ok:!0,dataset:ke}),f.get(k.bindingId)===k.requestId&&E(e.onResult,ke))}catch{T||(Z({type:"result",requestId:k.requestId,ok:!1,code:"DOCUMENT_QUERY_FAILED"}),f.get(k.bindingId)===k.requestId&&E(e.onError,"DOCUMENT_QUERY_FAILED"))}finally{u.delete(k.requestId),T||E(e.onBusy,u.size>0)}};const X=w=>{var S;if(T||N||w.source!==s.contentWindow)return;const $=Pt.safeParse(w.data);!$.success||$.data.sessionId!==r||(N=!0,(S=s.contentWindow)==null||S.postMessage({channel:Pe,version:Ve,type:"init",sessionId:r,context:t},"*",[a.port2]))};return y.addEventListener("message",X),a.port1.start(),s.srcdoc=n,{refresh(){Z({type:"refresh"})},dispose(){T||(T=!0,y.removeEventListener("message",X),a.port1.close(),a.port2.close(),E(e.onBusy,!1))}}}function qt(s){if(s.querySelector("meta[data-xpert-document-policy]"))return;const e=s.createElement("meta");e.httpEquiv="Content-Security-Policy",e.content="frame-src 'none'",e.dataset.xpertDocumentPolicy="1",s.head.prepend(e)}const Fe={mode:"unrestricted"};function Bt(s,e){return zt(s,{...e,networkPolicy:Fe})}function Ft(s,e){return $t(Fe,s,e)}return K.installArtifactDocumentFramePolicy=qt,K.isDashboardResourceAllowed=Ft,K.mountArtifactDocument=Bt,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),K})({});
198
+ `,Oe=r=>Object.assign(new Error(r),{code:r}),Qt=r=>JSON.stringify([r.bindingId,Object.keys(r.controls).sort().map(e=>[e,r.controls[e]])]),He={interactive:0,initial:1,refresh:2},Gt=18e4,Ht=45e3,Je=6e4;function Jt(r){const e=(v,y,E)=>Number.isFinite(v)?Math.max(1,Math.min(E,Math.floor(v))):y,t=e(r.concurrency,4,8),s=e(r.dispatchesPerMinute,60,1024),n=[],a=new Set,i=new Map,o=[];let u=!1,l;const m=(v,y)=>{try{v?.(y)}catch{}},S=()=>m(r.onBusy,!u&&(n.length>0||a.size>0)),D=(v,y,E)=>{v.state=F({},v.state,{state:y},y==="running"?{startedAt:Date.now()}:y!=="queued"?{finishedAt:Date.now()}:{},E?{code:E}:{}),m(r.onState,F({},v.state))},M=(v,y)=>{v.settled||(v.settled=!0,clearTimeout(v.timer),v.controller.abort(),D(v,y==="DOCUMENT_QUERY_SUPERSEDED"?"superseded":"failed",y),v.reject(Oe(y)),i.get(v.input.bindingId)===v&&i.delete(v.input.bindingId))},w=()=>{if(clearTimeout(l),u)return;const v=Date.now();for(;o.length&&o[0]<=v-Je;)o.shift();for(;n.length&&a.size<t&&o.length<s;){n.sort((E,N)=>E.priority-N.priority||E.state.queuedAt-N.state.queuedAt);const y=n.shift();clearTimeout(y.timer),a.add(y),o.push(Date.now()),D(y,"running"),y.timer=setTimeout(()=>M(y,"DOCUMENT_QUERY_TIMEOUT"),Ht),Promise.resolve().then(()=>r.execute(y.input,y.controller.signal)).then(E=>{u||y.settled||(y.settled=!0,D(y,"succeeded"),y.resolve(E))},()=>M(y,"DOCUMENT_QUERY_FAILED")).finally(()=>{clearTimeout(y.timer),a.delete(y),i.get(y.input.bindingId)===y&&i.delete(y.input.bindingId),w()})}n.length&&o.length>=s&&(l=setTimeout(w,Math.max(1,o[0]+Je-Date.now()))),S()};return{query(v,y="interactive"){if(u)return Promise.reject(Oe("DOCUMENT_DISPOSED"));const E=Qt(v),N=i.get(v.bindingId);if(N?.key===E&&!N.settled)return N.priority=Math.min(N.priority,He[y]),N.promise;if(N){const T=n.indexOf(N);T>=0&&n.splice(T,1),M(N,"DOCUMENT_QUERY_SUPERSEDED")}if(n.length>=64)return Promise.reject(Oe("DOCUMENT_QUEUE_LIMIT"));let W,G;const oe=new Promise((T,C)=>{W=T,G=C}),x={input:{bindingId:v.bindingId,controls:F({},v.controls)},key:E,priority:He[y],controller:new AbortController,promise:oe,resolve:W,reject:G,state:F({},v,{controls:F({},v.controls),state:"queued",queuedAt:Date.now()}),settled:!1};return x.timer=setTimeout(()=>{const T=n.indexOf(x);T>=0&&n.splice(T,1),M(x,"DOCUMENT_QUEUE_TIMEOUT"),w()},Gt),i.set(v.bindingId,x),n.push(x),D(x,"queued"),w(),oe},get busy(){return n.length>0||a.size>0},dispose(){if(!u){u=!0,clearTimeout(l);for(const v of[...n,...a])M(v,"DOCUMENT_DISPOSED");n.length=0,i.clear(),S()}}}}const Xt=re({channel:Q(Fe),version:Q(We),type:Q("ready"),sessionId:j().regex(/^[a-f0-9]{32}$/)}).strict(),Kt=re({type:Q("diagnostic"),code:Q("DOCUMENT_BINDING_DENIED")}).strict();function er(r,e){if(!r.ownerDocument.querySelector("meta[data-xpert-document-policy]"))throw new Error("Install the Artifact document frame policy before mounting a document");const t=Mt.parse(e.context),s=Array.from(crypto.getRandomValues(new Uint8Array(16)),x=>x.toString(16).padStart(2,"0")).join(""),n=Wt(e.html,s,e.dependencies,e.networkPolicy),a=new MessageChannel,i=new Set(t.bindingIds),o=Number.isFinite(e.dispatchesPerMinute)?Math.max(256,Math.min(1024,e.dispatchesPerMinute)):256,u=new Set,l=new Map,m=new Set,S=new Map,D=r.ownerDocument.defaultView;let M=!1,w=!1,v=0,y=Date.now();r.setAttribute("sandbox","allow-scripts"),r.referrerPolicy="no-referrer";const E=(x,T)=>{try{x?.(T)}catch{}},N=x=>{w||a.port1.postMessage(x)},W=(x,T)=>{N({type:"result",requestId:x,ok:!1,code:T}),E(e.onError,T)},G=Jt({concurrency:e.concurrency,dispatchesPerMinute:e.dispatchesPerMinute,execute:async(x,T)=>{if(T.aborted)throw new Error("DOCUMENT_QUERY_SUPERSEDED");const C=[...l.values()].find(I=>I.bindingId===x.bindingId&&Object.keys(I.controls).length===Object.keys(x.controls).length&&Object.keys(x.controls).every($=>I.controls[$]===x.controls[$]));if(!C)throw new Error("DOCUMENT_QUERY_SUPERSEDED");m.add(C.requestId);try{return await e.query(C,T)}finally{m.delete(C.requestId)}},onBusy:x=>E(e.onBusy,x),onState:x=>{if(E(e.onQueryState,x),x.state==="running")for(const T of l.values())T.bindingId===x.bindingId&&N({type:"query-state",requestId:T.requestId,state:"running"})}});a.port1.onmessage=async x=>{if(w)return;const T=Kt.safeParse(x.data);if(T.success){E(e.onError,T.data.code);return}const C=Rt.safeParse(x.data);if(!C.success){E(e.onError,"DOCUMENT_INVALID_REQUEST");return}const I={type:C.data.type,requestId:C.data.requestId,bindingId:C.data.bindingId,controls:C.data.controls,priority:C.data.priority};if(!i.has(I.bindingId)){W(I.requestId,"DOCUMENT_BINDING_DENIED");return}if(Date.now()-y>=6e4&&(v=0,y=Date.now(),u.clear()),l.has(I.requestId)||m.has(I.requestId)||u.has(I.requestId)){W(I.requestId,"DOCUMENT_REQUEST_REPLAY");return}if(l.size>=128||++v>o){W(I.requestId,"DOCUMENT_QUERY_LIMIT");return}u.add(I.requestId),l.set(I.requestId,I),S.set(I.bindingId,I.requestId),N({type:"query-state",requestId:I.requestId,state:"queued"});try{const $=await G.query(I,I.priority);w||(N({type:"result",requestId:I.requestId,ok:!0,dataset:$}),S.get(I.bindingId)===I.requestId&&E(e.onResult,$))}catch($){if(!w){const Ke=$ instanceof Error&&/^DOCUMENT_[A-Z_]+$/.test($.message)?$.message:"DOCUMENT_QUERY_FAILED";N({type:"result",requestId:I.requestId,ok:!1,code:Ke}),S.get(I.bindingId)===I.requestId&&E(e.onError,Ke)}}finally{l.delete(I.requestId)}};const oe=x=>{var T;if(w||M||x.source!==r.contentWindow)return;const C=Xt.safeParse(x.data);!C.success||C.data.sessionId!==s||(M=!0,(T=r.contentWindow)==null||T.postMessage({channel:Fe,version:We,type:"init",sessionId:s,context:t},"*",[a.port2]))};return D.addEventListener("message",oe),a.port1.start(),r.srcdoc=n,{refresh(x){if(x!==void 0&&!i.has(x))throw new Error("DOCUMENT_BINDING_DENIED");N(F({type:"refresh"},x?{bindingId:x}:{}))},dispose(){w||(w=!0,G.dispose(),l.clear(),D.removeEventListener("message",oe),a.port1.close(),a.port2.close(),E(e.onBusy,!1))}}}function tr(r){if(r.querySelector("meta[data-xpert-document-policy]"))return;const e=r.createElement("meta");e.httpEquiv="Content-Security-Policy",e.content="frame-src 'none'",e.dataset.xpertDocumentPolicy="1",r.head.prepend(e)}const Xe={mode:"unrestricted"};function rr(r,e){return Ft(Xe,r,e)}function sr(r,e){const t=new Map;return er(r,{...e,dispatchesPerMinute:Math.max(60,e.context.bindingIds.length*16),networkPolicy:Xe,query:async(s,n)=>{const a=(t.get(s.bindingId)??0)+1;if(t.set(s.bindingId,a),a>16)throw e.onError?.("DOCUMENT_SNAPSHOT_REPLAY_LIMIT"),new Error("DOCUMENT_SNAPSHOT_REPLAY_LIMIT");return e.query(s,n)}})}return se.installArtifactDocumentFramePolicy=tr,se.isDashboardResourceAllowed=rr,se.mountArtifactDocument=sr,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"}),se})({});
@@ -1,5 +1,5 @@
1
- // Invariants: the SDK's per-document rate/concurrency limits also apply in preflight.
2
- // Independent synthetic interactions need fresh mounts, not a larger production quota.
1
+ // Immutable snapshot replay has a per-Binding interaction budget, independent of live I/O.
2
+ // Independent synthetic interactions use fresh mounts; production retains 60 dispatches/minute.
3
3
  // Each scenario still validates initial load, its interaction sequence and host refresh.
4
4
  import { createResourceCache } from './resource-cache.mjs'
5
5
 
@@ -1,3 +1,7 @@
1
1
  export { installArtifactDocumentFramePolicy } from '@xpert-ai/plugin-sdk/artifact-document';
2
- export { mountDashboardDocument as mountArtifactDocument } from '../lib/document-host';
3
2
  export { isDashboardResourceAllowed } from '../lib/document-host';
3
+ import { type ArtifactDocumentHostOptions } from '@xpert-ai/plugin-sdk/artifact-document';
4
+ /** Sandbox-only immutable Dataset replay. No provider or host query API exists here.
5
+ * Bound each source to 16 replays (initial, up to 12 button transitions, refresh).
6
+ * Live rendering retains its independent 60/minute dispatch protection. */
7
+ export declare function mountArtifactDocument<T>(frame: HTMLIFrameElement, options: ArtifactDocumentHostOptions<T>): import("@xpert-ai/plugin-sdk/artifact-document").ArtifactDocumentHost;
@@ -1,9 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDashboardResourceAllowed = exports.mountArtifactDocument = exports.installArtifactDocumentFramePolicy = void 0;
3
+ exports.isDashboardResourceAllowed = exports.installArtifactDocumentFramePolicy = void 0;
4
+ exports.mountArtifactDocument = mountArtifactDocument;
4
5
  var artifact_document_1 = require("@xpert-ai/plugin-sdk/artifact-document");
5
6
  Object.defineProperty(exports, "installArtifactDocumentFramePolicy", { enumerable: true, get: function () { return artifact_document_1.installArtifactDocumentFramePolicy; } });
6
7
  var document_host_1 = require("../lib/document-host");
7
- Object.defineProperty(exports, "mountArtifactDocument", { enumerable: true, get: function () { return document_host_1.mountDashboardDocument; } });
8
- var document_host_2 = require("../lib/document-host");
9
- Object.defineProperty(exports, "isDashboardResourceAllowed", { enumerable: true, get: function () { return document_host_2.isDashboardResourceAllowed; } });
8
+ Object.defineProperty(exports, "isDashboardResourceAllowed", { enumerable: true, get: function () { return document_host_1.isDashboardResourceAllowed; } });
9
+ const artifact_document_2 = require("@xpert-ai/plugin-sdk/artifact-document");
10
+ const document_network_1 = require("../lib/document-network");
11
+ /** Sandbox-only immutable Dataset replay. No provider or host query API exists here.
12
+ * Bound each source to 16 replays (initial, up to 12 button transitions, refresh).
13
+ * Live rendering retains its independent 60/minute dispatch protection. */
14
+ function mountArtifactDocument(frame, options) {
15
+ const calls = new Map();
16
+ return (0, artifact_document_2.mountArtifactDocument)(frame, { ...options, dispatchesPerMinute: Math.max(60, options.context.bindingIds.length * 16),
17
+ networkPolicy: document_network_1.DASHBOARD_NETWORK_POLICY, query: async (input, signal) => {
18
+ const count = (calls.get(input.bindingId) ?? 0) + 1;
19
+ calls.set(input.bindingId, count);
20
+ if (count > 16) {
21
+ options.onError?.('DOCUMENT_SNAPSHOT_REPLAY_LIMIT');
22
+ throw new Error('DOCUMENT_SNAPSHOT_REPLAY_LIMIT');
23
+ }
24
+ return options.query(input, signal);
25
+ } });
26
+ }
package/docs/docs.json CHANGED
@@ -16,6 +16,8 @@
16
16
  "group": "接入与验证",
17
17
  "pages": [
18
18
  "index",
19
+ "large-dashboards",
20
+ "large-dashboards-acceptance",
19
21
  "quick-start",
20
22
  "superstore",
21
23
  "visual-styles",
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: 大型看板验收记录
3
+ description: 2026-11-05 容量边界、调度、后台保存、真实 BW 数据与 Workbench 浏览器验证。
4
+ ---
5
+
6
+ ## 环境与结果
7
+
8
+ 本次升级已实现,并在本地 Xpert Pro / Data Xpert 中验证。原采购、库存、销售演示定义未修改;容量验收使用既有隔离项目中的新草稿,不发布或新增数据权限。
9
+
10
+ - 插件源基线:`xpert-plugins` develop `4fd9fea0`,插件包版本仍为 `0.4.1`,新增 minor changeset。
11
+ - 平台源基线:`xpert-pro` develop `ed7d53b03`,配套 Artifact Document SDK 修改及 minor changeset。
12
+ - Data Xpert:develop `670163c`;ChatKit:develop `4e4907e`。
13
+ - 相关仓库已检查工作区、快进拉取并冻结安装依赖;API 3000、API 3001、Web 5174、ChatKit 5173 已重启并完成健康检查。
14
+ - 插件使用正常登录及 `plugin:deploy:local` 部署,重启平台后执行真实 View action,证明不是仅构建或 staged 状态。
15
+
16
+ ## 自动化验证
17
+
18
+ | 层次 | 实际结果 |
19
+ | --- | --- |
20
+ | Live Dashboard 最终构建与测试 | 259 项通过,0 失败 |
21
+ | SDK 完整回归 | 70 suites / 453 项通过 |
22
+ | SDK 最后一次宿主修正后定向回归 | 6 suites / 37 项通过 |
23
+ | 产物一致性 | `verify:dist` 通过,包含远程组件、Action 和前端库 |
24
+ | 插件注册 | 元数据检查、dist-first 生命周期加载及关闭通过 |
25
+ | Data Xpert 依赖与 Analysis App | contracts 编译通过;单文档构建 2,080,476 字节,低于保留的 2 MiB 上限 |
26
+
27
+ 覆盖 8/9/16/32/64 的 schema、Sources 关联和档案往返;65 拒绝;降低策略后的历史维护;相同请求复用、4 并发、分钟限额、慢请求、超时、快速筛选、旧结果隔离、部分失败、卸载及结果内存限制。HTML 快照预检使用受控浏览器桩覆盖 4/8/9/16/32/64 的控件与刷新回放;这不是 64 个真实数据库来源的浏览器性能实测。
28
+
29
+ 后台任务覆盖幂等、跨作用域拒绝、权限撤销、观察者取消、入队中断恢复、CAS 成功后的状态恢复,以及批量预览凭证与原重试规则。
30
+
31
+ 前一轮 Nx 构建/测试通过。最终 UI 观察者清理及重复刷新状态修正后,工作区 Nx 项目图被其他插件中三个无名称模板 package 阻挡,改为执行同一插件的 `pnpm -F @xpert-ai/plugin-live-dashboard test`(含完整 build)。没有通过忽略测试或修改其他模板绕过验证。
32
+
33
+ ## 真实后台与数据验收
34
+
35
+ 在已有 `Sources 导入验收|2026-11-05` 项目创建 `容量验收 · 9 Sources · 公网库存(查询复用场景)`。这九个 Binding 复用已授权的公网 BW 库存查询,专门检验来源容量与调度,不代表九个独立业务指标。
36
+
37
+ - requestId:`5f37c13b-8ade-4230-9f8d-877ac1352d4c`。
38
+ - 新 Artifact:`a45d0fbf-8818-4897-bb08-285bae9fcea2`,草稿修订 `1`,9 个来源。
39
+ - 观察到 queued → queries 0/9 → 2/9 → 6/9 → saved;提交、验证、读取和后续查询共约 13.7 秒。
40
+ - 重复提交返回同一个 requestId,没有第二次草稿修订。
41
+ - 保存后单来源真实查询返回 100 行,`truncated=false`、`totalAccuracy=exact`。
42
+ - 默认策略下提交 33 个 Binding 返回 HTTP 400 / `DASHBOARD_BINDING_CAPACITY`,未启动新保存任务。
43
+
44
+ ## Workbench 浏览器验收
45
+
46
+ 在本地 Bosi 工作台打开九来源草稿,确认九张表均有真实数据。Sources 的完成时间显示 4、4、1 的加载批次。
47
+
48
+ - 搜索“来源 9”后只保留对应来源;自定义 Select 选择“已更新”状态正常。
49
+ - 来源详情显示对应 Binding、Dataset、Provider、请求配置、排队时间和执行时间。
50
+ - 单独刷新来源 9:经历查询中 → 已更新,运行约 2.2 秒,其余来源不随之重查。
51
+ - 使用原始库存查询返回的真实工厂成员 `[2CIPLANT].[0018]` 应用筛选,九个相关来源全部更新;来源 1 的结果从 100 行变为 2 行,完整性仍为 exact / 未截断,当前参数和审计引用可在结果详情中核对。
52
+ - 私有验收截图及机器可读记录保存在本地 `.xpert-local-environment/dashboard-scale-20261105/`,不将业务数据或登录信息加入插件仓库。
53
+
54
+ ## 验证边界
55
+
56
+ 64 是协议上限;本次真实数据宿主验收到 9 个 Binding。32/64 的边界和调度行为由自动化测试覆盖,未对 64 个独立外部数据库或多用户同时访问作性能承诺。分钟额度、源系统速度、返回体大小都会影响首屏时间。自动刷新隐藏页行为、故障和队列恢复的异常路径以自动化测试证据为主。
57
+
58
+ 本次没有运行一个新的完整 LLM 对话来覆盖所有批量工具;Agent 工具路径由集成测试验证,真实保存通过同一领域服务和 Managed Queue 完成。以上首次验收时,配套 SDK 尚待发布,插件使用临时 pnpm patch;当时的本地成功不等同于已完成 npm 发布。后续正式 SDK 依赖迁移见下文。
59
+
60
+ 联调额外修复 Data Xpert 的两个启动阻塞:contracts 依赖升级至提供现有源码所需类型的 3.32.0;Analysis App 使用显式 Terser 压缩。没有扩大文件传输上限、关闭鉴权或复用过期产物。
61
+
62
+ ## 正式 SDK 依赖迁移(2026-11-05)
63
+
64
+ 插件仓库快进更新至 develop `6fc3fe99`,保留原暂存改动。确认 npm 已发布 `@xpert-ai/plugin-sdk@3.33.0` 与 `@xpert-ai/contracts@3.33.0` 后,将 `xpertai` 工作区和 Live Dashboard 的开发依赖升级至 3.33.0,本插件 peer 依赖同步要求 `^3.33.0`。移除 SDK 3.31.0 临时 patch、工作区配置及锁文件中的 patch 引用;独立的 Changesets CLI patch 保留。
65
+
66
+ | 检查 | 实际结果 |
67
+ | --- | --- |
68
+ | 正式包解析 | 工作区与插件均解析到 SDK/contracts 3.33.0;正式包提供调度器、宿主与 `queryMany` 运行时 |
69
+ | 依赖安装 | 更新锁文件后 `pnpm install --frozen-lockfile` 通过 |
70
+ | Nx 构建与回归 | 跳过缓存运行 Live Dashboard `test`,完整构建及 259 项测试通过,0 失败 |
71
+ | 产物一致性 | Nx `verify:dist` 通过,viewer、Action 与前端库已重建并校验 |
72
+ | 插件注册 | 元数据检查通过,dist-first 生命周期加载及关闭通过(Harness 基础设施 mock) |
73
+
74
+ 本次是正式包依赖迁移与构建回归,未重新部署插件或重跑真实数据、浏览器及 LLM 验收。以上真实宿主记录仍对应首次部署,不能作为 3.33.0 已部署的证明。