@zuplo/runtime 6.70.21 → 6.70.23

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.
@@ -22,7 +22,7 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{d as ze,f as Ka,g as Qa}from"./chunk-2ZQVIVZ3.js";import{a as $e,b as $h}from"./chunk-ZS34EO4B.js";import{A as yi,B as bi,C as vi,D as vh,E as wh,F as xh,G as wi,H as Rh,I as Ph,J as xi,K as Ri,L as Ih,M as Pi,N as Ii,O as Sh,P as Th,Q as kh,R as Eh,S as _h,T as Oh,U as Ch,V as Si,W as ge,X as z,Y as R,Z as T,_ as D,a,b as K,c as zR,d as Ft,e as ZR,f as fi,g as ke,h as oh,i as jr,j as ih,k as zr,l as sh,m as ah,n as uh,o as ch,p as lh,q as dh,r as ph,s as mh,t as fh,u as gh,v as hh,w as yh,x as bh,y as gi,z as hi}from"./chunk-YGYFQCBA.js";var hy=zR(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.parse=kP;Fi.serialize=EP;var xP=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,RP=/^[\u0021-\u003A\u003C-\u007E]*$/,PP=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,IP=/^[\u0020-\u003A\u003D-\u007E]*$/,SP=Object.prototype.toString,TP=(()=>{let t=a(function(){},"C");return t.prototype=Object.create(null),t})();function kP(t,e){let r=new TP,o=t.length;if(o<2)return r;let n=e?.decode||_P,i=0;do{let s=t.indexOf("=",i);if(s===-1)break;let u=t.indexOf(";",i),c=u===-1?o:u;if(s>c){i=t.lastIndexOf(";",s-1)+1;continue}let l=fy(t,i,s),d=gy(t,s,l),p=t.slice(l,d);if(r[p]===void 0){let m=fy(t,s+1,c),y=gy(t,c,m),g=n(t.slice(m,y));r[p]=g}i=c+1}while(i<o);return r}a(kP,"parse");function fy(t,e,r){do{let o=t.charCodeAt(e);if(o!==32&&o!==9)return e}while(++e<r);return r}a(fy,"startIndex");function gy(t,e,r){for(;e>r;){let o=t.charCodeAt(--e);if(o!==32&&o!==9)return e+1}return r}a(gy,"endIndex");function EP(t,e,r){let o=r?.encode||encodeURIComponent;if(!xP.test(t))throw new TypeError(`argument name is invalid: ${t}`);let n=o(e);if(!RP.test(n))throw new TypeError(`argument val is invalid: ${e}`);let i=t+"="+n;if(!r)return i;if(r.maxAge!==void 0){if(!Number.isInteger(r.maxAge))throw new TypeError(`option maxAge is invalid: ${r.maxAge}`);i+="; Max-Age="+r.maxAge}if(r.domain){if(!PP.test(r.domain))throw new TypeError(`option domain is invalid: ${r.domain}`);i+="; Domain="+r.domain}if(r.path){if(!IP.test(r.path))throw new TypeError(`option path is invalid: ${r.path}`);i+="; Path="+r.path}if(r.expires){if(!OP(r.expires)||!Number.isFinite(r.expires.valueOf()))throw new TypeError(`option expires is invalid: ${r.expires}`);i+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.partitioned&&(i+="; Partitioned"),r.priority)switch(typeof r.priority=="string"?r.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${r.priority}`)}if(r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${r.sameSite}`)}return i}a(EP,"serialize");function _P(t){if(t.indexOf("%")===-1)return t;try{return decodeURIComponent(t)}catch{return t}}a(_P,"decode");function OP(t){return SP.call(t)==="[object Date]"}a(OP,"isDate")});function E(t,e,r){function o(u,c){var l;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(l=u._zod).traits??(l.traits=new Set),u._zod.traits.add(t),e(u,c);for(let d in s.prototype)d in u||Object.defineProperty(u,d,{value:s.prototype[d].bind(u)});u._zod.constr=s,u._zod.def=c}a(o,"init");let n=r?.Parent??Object;class i extends n{static{a(this,"Definition")}}Object.defineProperty(i,"name",{value:t});function s(u){var c;let l=r?.Parent?new i:this;o(l,u),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return a(s,"_"),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a(u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t),"value")}),Object.defineProperty(s,"name",{value:t}),s}function qe(t){return t&&Object.assign(ao,t),ao}var Yu,Xu,Mt,ao,rn=K(()=>{Yu=Object.freeze({status:"aborted"});a(E,"$constructor");Xu=Symbol("zod_brand"),Mt=class extends Error{static{a(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ao={};a(qe,"config")});var W={};Ft(W,{BIGINT_FORMAT_RANGES:()=>cc,Class:()=>tc,NUMBER_FORMAT_RANGES:()=>uc,aborted:()=>Tr,allowsEval:()=>ic,assert:()=>_I,assertEqual:()=>SI,assertIs:()=>kI,assertNever:()=>EI,assertNotEqual:()=>TI,assignProp:()=>oc,cached:()=>lo,captureStackTrace:()=>as,cleanEnum:()=>qI,cleanRegex:()=>po,clone:()=>pt,createTransparentProxy:()=>NI,defineLazy:()=>Pe,esc:()=>Sr,escapeRegex:()=>Vt,extend:()=>UI,finalizeIssue:()=>mt,floatSafeRemainder:()=>nc,getElementAtPath:()=>OI,getEnumValues:()=>co,getLengthableOrigin:()=>go,getParsedType:()=>LI,getSizableOrigin:()=>fo,isObject:()=>nn,isPlainObject:()=>on,issue:()=>lc,joinValues:()=>N,jsonStringifyReplacer:()=>rc,merge:()=>jI,normalizeParams:()=>H,nullish:()=>ar,numKeys:()=>AI,omit:()=>MI,optionalKeys:()=>ac,partial:()=>zI,pick:()=>DI,prefixIssues:()=>it,primitiveTypes:()=>sc,promiseAllObject:()=>CI,propertyKeyTypes:()=>mo,randomString:()=>$I,required:()=>ZI,stringifyPrimitive:()=>J,unwrapMessage:()=>uo});function SI(t){return t}function TI(t){return t}function kI(t){}function EI(t){throw new Error}function _I(t){}function co(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function N(t,e="|"){return t.map(r=>J(r)).join(e)}function rc(t,e){return typeof e=="bigint"?e.toString():e}function lo(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(t){return t==null}function po(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function nc(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}function Pe(t,e,r){Object.defineProperty(t,e,{get(){{let n=r();return t[e]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function oc(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function OI(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function CI(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function $I(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function Sr(t){return JSON.stringify(t)}function nn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function on(t){if(nn(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(nn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function AI(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function Vt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function H(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:a(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:a(()=>e.error,"error")}:e}function NI(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function J(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ac(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function DI(t,e){let r={},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=o.shape[n])}return pt(t,{...t._zod.def,shape:r,checks:[]})}function MI(t,e){let r={...t._zod.def.shape},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return pt(t,{...t._zod.def,shape:r,checks:[]})}function UI(t,e){if(!on(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let o={...t._zod.def.shape,...e};return oc(this,"shape",o),o},checks:[]};return pt(t,r)}function jI(t,e){return pt(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return oc(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function zI(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(n[i]=t?new t({type:"optional",innerType:o[i]}):o[i])}else for(let i in o)n[i]=t?new t({type:"optional",innerType:o[i]}):o[i];return pt(e,{...e._zod.def,shape:n,checks:[]})}function ZI(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(n[i]=new t({type:"nonoptional",innerType:o[i]}))}else for(let i in o)n[i]=new t({type:"nonoptional",innerType:o[i]});return pt(e,{...e._zod.def,shape:n,checks:[]})}function Tr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function it(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function uo(t){return typeof t=="string"?t:t?.message}function mt(t,e,r){let o={...t,path:t.path??[]};if(!t.message){let n=uo(t.inst?._zod.def?.error?.(t))??uo(e?.error?.(t))??uo(r.customError?.(t))??uo(r.localeError?.(t))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function fo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function go(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lc(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function qI(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var as,ic,LI,mo,sc,uc,cc,tc,ue=K(()=>{a(SI,"assertEqual");a(TI,"assertNotEqual");a(kI,"assertIs");a(EI,"assertNever");a(_I,"assert");a(co,"getEnumValues");a(N,"joinValues");a(rc,"jsonStringifyReplacer");a(lo,"cached");a(ar,"nullish");a(po,"cleanRegex");a(nc,"floatSafeRemainder");a(Pe,"defineLazy");a(oc,"assignProp");a(OI,"getElementAtPath");a(CI,"promiseAllObject");a($I,"randomString");a(Sr,"esc");as=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};a(nn,"isObject");ic=lo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});a(on,"isPlainObject");a(AI,"numKeys");LI=a(t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},"getParsedType"),mo=new Set(["string","number","symbol"]),sc=new Set(["string","number","bigint","boolean","symbol","undefined"]);a(Vt,"escapeRegex");a(pt,"clone");a(H,"normalizeParams");a(NI,"createTransparentProxy");a(J,"stringifyPrimitive");a(ac,"optionalKeys");uc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};a(DI,"pick");a(MI,"omit");a(UI,"extend");a(jI,"merge");a(zI,"partial");a(ZI,"required");a(Tr,"aborted");a(it,"prefixIssues");a(uo,"unwrapMessage");a(mt,"finalizeIssue");a(fo,"getSizableOrigin");a(go,"getLengthableOrigin");a(lc,"issue");a(qI,"cleanEnum");tc=class{static{a(this,"Class")}constructor(...e){}}});function yo(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function bo(t,e){let r=e||function(i){return i.message},o={_errors:[]},n=a(i=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>n({issues:u}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)o._errors.push(r(s));else{let u=o,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(r(s))):u[l]=u[l]||{_errors:[]},u=u[l],c++}}},"processError");return n(t),o}function dc(t,e){let r=e||function(i){return i.message},o={errors:[]},n=a((i,s=[])=>{var u,c;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(d=>n({issues:d},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({issues:l.issues},l.path);else{let d=[...s,...l.path];if(d.length===0){o.errors.push(r(l));continue}let p=o,m=0;for(;m<d.length;){let y=d[m],g=m===d.length-1;typeof y=="string"?(p.properties??(p.properties={}),(u=p.properties)[y]??(u[y]={errors:[]}),p=p.properties[y]):(p.items??(p.items=[]),(c=p.items)[y]??(c[y]={errors:[]}),p=p.items[y]),g&&p.errors.push(r(l)),m++}}},"processError");return n(t),o}function nb(t){let e=[];for(let r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function pc(t){let e=[],r=[...t.issues].sort((o,n)=>o.path.length-n.path.length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${nb(o.path)}`);return e.join(`
25
+ import{d as ze,f as Ka,g as Qa}from"./chunk-GDWI24KD.js";import{a as $e,b as $h}from"./chunk-NW4YQXGC.js";import{A as yi,B as bi,C as vi,D as vh,E as wh,F as xh,G as wi,H as Rh,I as Ph,J as xi,K as Ri,L as Ih,M as Pi,N as Ii,O as Sh,P as Th,Q as kh,R as Eh,S as _h,T as Oh,U as Ch,V as Si,W as ge,X as z,Y as R,Z as T,_ as D,a,b as K,c as zR,d as Ft,e as ZR,f as fi,g as ke,h as oh,i as jr,j as ih,k as zr,l as sh,m as ah,n as uh,o as ch,p as lh,q as dh,r as ph,s as mh,t as fh,u as gh,v as hh,w as yh,x as bh,y as gi,z as hi}from"./chunk-JAEQKE5H.js";var hy=zR(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.parse=kP;Fi.serialize=EP;var xP=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,RP=/^[\u0021-\u003A\u003C-\u007E]*$/,PP=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,IP=/^[\u0020-\u003A\u003D-\u007E]*$/,SP=Object.prototype.toString,TP=(()=>{let t=a(function(){},"C");return t.prototype=Object.create(null),t})();function kP(t,e){let r=new TP,o=t.length;if(o<2)return r;let n=e?.decode||_P,i=0;do{let s=t.indexOf("=",i);if(s===-1)break;let u=t.indexOf(";",i),c=u===-1?o:u;if(s>c){i=t.lastIndexOf(";",s-1)+1;continue}let l=fy(t,i,s),d=gy(t,s,l),p=t.slice(l,d);if(r[p]===void 0){let m=fy(t,s+1,c),y=gy(t,c,m),g=n(t.slice(m,y));r[p]=g}i=c+1}while(i<o);return r}a(kP,"parse");function fy(t,e,r){do{let o=t.charCodeAt(e);if(o!==32&&o!==9)return e}while(++e<r);return r}a(fy,"startIndex");function gy(t,e,r){for(;e>r;){let o=t.charCodeAt(--e);if(o!==32&&o!==9)return e+1}return r}a(gy,"endIndex");function EP(t,e,r){let o=r?.encode||encodeURIComponent;if(!xP.test(t))throw new TypeError(`argument name is invalid: ${t}`);let n=o(e);if(!RP.test(n))throw new TypeError(`argument val is invalid: ${e}`);let i=t+"="+n;if(!r)return i;if(r.maxAge!==void 0){if(!Number.isInteger(r.maxAge))throw new TypeError(`option maxAge is invalid: ${r.maxAge}`);i+="; Max-Age="+r.maxAge}if(r.domain){if(!PP.test(r.domain))throw new TypeError(`option domain is invalid: ${r.domain}`);i+="; Domain="+r.domain}if(r.path){if(!IP.test(r.path))throw new TypeError(`option path is invalid: ${r.path}`);i+="; Path="+r.path}if(r.expires){if(!OP(r.expires)||!Number.isFinite(r.expires.valueOf()))throw new TypeError(`option expires is invalid: ${r.expires}`);i+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.partitioned&&(i+="; Partitioned"),r.priority)switch(typeof r.priority=="string"?r.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${r.priority}`)}if(r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${r.sameSite}`)}return i}a(EP,"serialize");function _P(t){if(t.indexOf("%")===-1)return t;try{return decodeURIComponent(t)}catch{return t}}a(_P,"decode");function OP(t){return SP.call(t)==="[object Date]"}a(OP,"isDate")});function E(t,e,r){function o(u,c){var l;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(l=u._zod).traits??(l.traits=new Set),u._zod.traits.add(t),e(u,c);for(let d in s.prototype)d in u||Object.defineProperty(u,d,{value:s.prototype[d].bind(u)});u._zod.constr=s,u._zod.def=c}a(o,"init");let n=r?.Parent??Object;class i extends n{static{a(this,"Definition")}}Object.defineProperty(i,"name",{value:t});function s(u){var c;let l=r?.Parent?new i:this;o(l,u),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return a(s,"_"),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a(u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(t),"value")}),Object.defineProperty(s,"name",{value:t}),s}function qe(t){return t&&Object.assign(ao,t),ao}var Yu,Xu,Mt,ao,rn=K(()=>{Yu=Object.freeze({status:"aborted"});a(E,"$constructor");Xu=Symbol("zod_brand"),Mt=class extends Error{static{a(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ao={};a(qe,"config")});var W={};Ft(W,{BIGINT_FORMAT_RANGES:()=>cc,Class:()=>tc,NUMBER_FORMAT_RANGES:()=>uc,aborted:()=>Tr,allowsEval:()=>ic,assert:()=>_I,assertEqual:()=>SI,assertIs:()=>kI,assertNever:()=>EI,assertNotEqual:()=>TI,assignProp:()=>oc,cached:()=>lo,captureStackTrace:()=>as,cleanEnum:()=>qI,cleanRegex:()=>po,clone:()=>pt,createTransparentProxy:()=>NI,defineLazy:()=>Pe,esc:()=>Sr,escapeRegex:()=>Vt,extend:()=>UI,finalizeIssue:()=>mt,floatSafeRemainder:()=>nc,getElementAtPath:()=>OI,getEnumValues:()=>co,getLengthableOrigin:()=>go,getParsedType:()=>LI,getSizableOrigin:()=>fo,isObject:()=>nn,isPlainObject:()=>on,issue:()=>lc,joinValues:()=>N,jsonStringifyReplacer:()=>rc,merge:()=>jI,normalizeParams:()=>H,nullish:()=>ar,numKeys:()=>AI,omit:()=>MI,optionalKeys:()=>ac,partial:()=>zI,pick:()=>DI,prefixIssues:()=>it,primitiveTypes:()=>sc,promiseAllObject:()=>CI,propertyKeyTypes:()=>mo,randomString:()=>$I,required:()=>ZI,stringifyPrimitive:()=>J,unwrapMessage:()=>uo});function SI(t){return t}function TI(t){return t}function kI(t){}function EI(t){throw new Error}function _I(t){}function co(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function N(t,e="|"){return t.map(r=>J(r)).join(e)}function rc(t,e){return typeof e=="bigint"?e.toString():e}function lo(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function ar(t){return t==null}function po(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function nc(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}function Pe(t,e,r){Object.defineProperty(t,e,{get(){{let n=r();return t[e]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function oc(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function OI(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function CI(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function $I(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function Sr(t){return JSON.stringify(t)}function nn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function on(t){if(nn(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(nn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function AI(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function Vt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function H(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:a(()=>e,"error")};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:a(()=>e.error,"error")}:e}function NI(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function J(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ac(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function DI(t,e){let r={},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=o.shape[n])}return pt(t,{...t._zod.def,shape:r,checks:[]})}function MI(t,e){let r={...t._zod.def.shape},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return pt(t,{...t._zod.def,shape:r,checks:[]})}function UI(t,e){if(!on(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let o={...t._zod.def.shape,...e};return oc(this,"shape",o),o},checks:[]};return pt(t,r)}function jI(t,e){return pt(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return oc(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function zI(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(n[i]=t?new t({type:"optional",innerType:o[i]}):o[i])}else for(let i in o)n[i]=t?new t({type:"optional",innerType:o[i]}):o[i];return pt(e,{...e._zod.def,shape:n,checks:[]})}function ZI(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(n[i]=new t({type:"nonoptional",innerType:o[i]}))}else for(let i in o)n[i]=new t({type:"nonoptional",innerType:o[i]});return pt(e,{...e._zod.def,shape:n,checks:[]})}function Tr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function it(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function uo(t){return typeof t=="string"?t:t?.message}function mt(t,e,r){let o={...t,path:t.path??[]};if(!t.message){let n=uo(t.inst?._zod.def?.error?.(t))??uo(e?.error?.(t))??uo(r.customError?.(t))??uo(r.localeError?.(t))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function fo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function go(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lc(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function qI(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var as,ic,LI,mo,sc,uc,cc,tc,ue=K(()=>{a(SI,"assertEqual");a(TI,"assertNotEqual");a(kI,"assertIs");a(EI,"assertNever");a(_I,"assert");a(co,"getEnumValues");a(N,"joinValues");a(rc,"jsonStringifyReplacer");a(lo,"cached");a(ar,"nullish");a(po,"cleanRegex");a(nc,"floatSafeRemainder");a(Pe,"defineLazy");a(oc,"assignProp");a(OI,"getElementAtPath");a(CI,"promiseAllObject");a($I,"randomString");a(Sr,"esc");as=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};a(nn,"isObject");ic=lo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});a(on,"isPlainObject");a(AI,"numKeys");LI=a(t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},"getParsedType"),mo=new Set(["string","number","symbol"]),sc=new Set(["string","number","bigint","boolean","symbol","undefined"]);a(Vt,"escapeRegex");a(pt,"clone");a(H,"normalizeParams");a(NI,"createTransparentProxy");a(J,"stringifyPrimitive");a(ac,"optionalKeys");uc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};a(DI,"pick");a(MI,"omit");a(UI,"extend");a(jI,"merge");a(zI,"partial");a(ZI,"required");a(Tr,"aborted");a(it,"prefixIssues");a(uo,"unwrapMessage");a(mt,"finalizeIssue");a(fo,"getSizableOrigin");a(go,"getLengthableOrigin");a(lc,"issue");a(qI,"cleanEnum");tc=class{static{a(this,"Class")}constructor(...e){}}});function yo(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function bo(t,e){let r=e||function(i){return i.message},o={_errors:[]},n=a(i=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>n({issues:u}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)o._errors.push(r(s));else{let u=o,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(r(s))):u[l]=u[l]||{_errors:[]},u=u[l],c++}}},"processError");return n(t),o}function dc(t,e){let r=e||function(i){return i.message},o={errors:[]},n=a((i,s=[])=>{var u,c;for(let l of i.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(d=>n({issues:d},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({issues:l.issues},l.path);else{let d=[...s,...l.path];if(d.length===0){o.errors.push(r(l));continue}let p=o,m=0;for(;m<d.length;){let y=d[m],g=m===d.length-1;typeof y=="string"?(p.properties??(p.properties={}),(u=p.properties)[y]??(u[y]={errors:[]}),p=p.properties[y]):(p.items??(p.items=[]),(c=p.items)[y]??(c[y]={errors:[]}),p=p.items[y]),g&&p.errors.push(r(l)),m++}}},"processError");return n(t),o}function nb(t){let e=[];for(let r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function pc(t){let e=[],r=[...t.issues].sort((o,n)=>o.path.length-n.path.length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${nb(o.path)}`);return e.join(`
26
26
  `)}var rb,ho,sn,mc=K(()=>{rn();ue();rb=a((t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,rc,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:a(()=>t.message,"value"),enumerable:!1})},"initializer"),ho=E("$ZodError",rb),sn=E("$ZodError",rb,{Parent:Error});a(yo,"flattenError");a(bo,"formatError");a(dc,"treeifyError");a(nb,"toDotPath");a(pc,"prettifyError")});var us,cs,ls,ds,ps,fc,ms,gc,fs=K(()=>{rn();mc();ue();us=a(t=>(e,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Mt;if(s.issues.length){let u=new(n?.Err??t)(s.issues.map(c=>mt(c,i,qe())));throw as(u,n?.callee),u}return s.value},"_parse"),cs=us(sn),ls=a(t=>async(e,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let u=new(n?.Err??t)(s.issues.map(c=>mt(c,i,qe())));throw as(u,n?.callee),u}return s.value},"_parseAsync"),ds=ls(sn),ps=a(t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Mt;return i.issues.length?{success:!1,error:new(t??ho)(i.issues.map(s=>mt(s,n,qe())))}:{success:!0,data:i.value}},"_safeParse"),fc=ps(sn),ms=a(t=>async(e,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(s=>mt(s,n,qe())))}:{success:!0,data:i.value}},"_safeParseAsync"),gc=ms(sn)});var Er={};Ft(Er,{_emoji:()=>ob,base64:()=>Oc,base64url:()=>gs,bigint:()=>Mc,boolean:()=>zc,browserEmail:()=>QI,cidrv4:()=>Ec,cidrv6:()=>_c,cuid:()=>hc,cuid2:()=>yc,date:()=>Ac,datetime:()=>Nc,domain:()=>YI,duration:()=>Rc,e164:()=>$c,email:()=>Ic,emoji:()=>Sc,extendedDuration:()=>HI,guid:()=>Pc,hostname:()=>Cc,html5Email:()=>JI,integer:()=>Uc,ipv4:()=>Tc,ipv6:()=>kc,ksuid:()=>wc,lowercase:()=>Fc,nanoid:()=>xc,null:()=>Zc,number:()=>jc,rfc5322Email:()=>WI,string:()=>Dc,time:()=>Lc,ulid:()=>bc,undefined:()=>qc,unicodeEmail:()=>KI,uppercase:()=>Hc,uuid:()=>kr,uuid4:()=>GI,uuid6:()=>BI,uuid7:()=>VI,xid:()=>vc});function Sc(){return new RegExp(ob,"u")}function sb(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Lc(t){return new RegExp(`^${sb(t)}$`)}function Nc(t){let e=sb({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${ib}T(?:${o})$`)}var hc,yc,bc,vc,wc,xc,Rc,HI,Pc,kr,GI,BI,VI,Ic,JI,WI,KI,QI,ob,Tc,kc,Ec,_c,Oc,gs,Cc,YI,$c,ib,Ac,Dc,Mc,Uc,jc,zc,Zc,qc,Fc,Hc,hs=K(()=>{hc=/^[cC][^\s-]{8,}$/,yc=/^[0-9a-z]+$/,bc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vc=/^[0-9a-vA-V]{20}$/,wc=/^[A-Za-z0-9]{27}$/,xc=/^[a-zA-Z0-9_-]{21}$/,Rc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,HI=/^[-+]?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)?)??$/,Pc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,kr=a(t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,"uuid"),GI=kr(4),BI=kr(6),VI=kr(7),Ic=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,JI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,WI=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,KI=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,QI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ob="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";a(Sc,"emoji");Tc=/^(?:(?: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])$/,kc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Ec=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,_c=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Oc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^[A-Za-z0-9_-]*$/,Cc=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,YI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,$c=/^\+(?:[0-9]){6,14}[0-9]$/,ib="(?:(?:\\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])))",Ac=new RegExp(`^${ib}$`);a(sb,"timeSource");a(Lc,"time");a(Nc,"datetime");Dc=a(t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},"string"),Mc=/^\d+n?$/,Uc=/^\d+$/,jc=/^-?\d+(?:\.\d+)?/i,zc=/true|false/i,Zc=/null/i,qc=/undefined/i,Fc=/^[^A-Z]*$/,Hc=/^[^a-z]*$/});function ab(t,e,r){t.issues.length&&e.issues.push(...it(r,t.issues))}var Ne,ub,ys,bs,Gc,Bc,Vc,Jc,Wc,Kc,Qc,Yc,Xc,an,el,tl,rl,nl,ol,il,sl,al,ul,vs=K(()=>{rn();hs();ue();Ne=E("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ub={number:"number",bigint:"bigint",object:"date"},ys=E("$ZodCheckLessThan",(t,e)=>{Ne.init(t,e);let r=ub[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,i=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),bs=E("$ZodCheckGreaterThan",(t,e)=>{Ne.init(t,e);let r=ub[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,i=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Gc=E("$ZodCheckMultipleOf",(t,e)=>{Ne.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):nc(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Bc=E("$ZodCheckNumberFormat",(t,e)=>{Ne.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,i]=uc[e.format];t._zod.onattach.push(s=>{let u=s._zod.bag;u.format=e.format,u.minimum=n,u.maximum=i,r&&(u.pattern=Uc)}),t._zod.check=s=>{let u=s.value;if(r){if(!Number.isInteger(u)){s.issues.push({expected:o,format:e.format,code:"invalid_type",input:u,inst:t});return}if(!Number.isSafeInteger(u)){u>0?s.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort}):s.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort});return}}u<n&&s.issues.push({origin:"number",input:u,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),u>i&&s.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inst:t})}}),Vc=E("$ZodCheckBigIntFormat",(t,e)=>{Ne.init(t,e);let[r,o]=cc[e.format];t._zod.onattach.push(n=>{let i=n._zod.bag;i.format=e.format,i.minimum=r,i.maximum=o}),t._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:t})}}),Jc=E("$ZodCheckMaxSize",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;n.size<=e.maximum||o.issues.push({origin:fo(n),code:"too_big",maximum:e.maximum,input:n,inst:t,continue:!e.abort})}}),Wc=E("$ZodCheckMinSize",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;n.size>=e.minimum||o.issues.push({origin:fo(n),code:"too_small",minimum:e.minimum,input:n,inst:t,continue:!e.abort})}}),Kc=E("$ZodCheckSizeEquals",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.size!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.size,n.maximum=e.size,n.size=e.size}),t._zod.check=o=>{let n=o.value,i=n.size;if(i===e.size)return;let s=i>e.size;o.issues.push({origin:fo(n),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),Qc=E("$ZodCheckMaxLength",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let s=go(n);o.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Yc=E("$ZodCheckMinLength",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let s=go(n);o.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Xc=E("$ZodCheckLengthEquals",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!ar(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,i=n.length;if(i===e.length)return;let s=go(n),u=i>e.length;o.issues.push({origin:s,...u?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),an=E("$ZodCheckStringFormat",(t,e)=>{var r,o;Ne.init(t,e),t._zod.onattach.push(n=>{let i=n._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),el=E("$ZodCheckRegex",(t,e)=>{an.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),tl=E("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Fc),an.init(t,e)}),rl=E("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Hc),an.init(t,e)}),nl=E("$ZodCheckIncludes",(t,e)=>{Ne.init(t,e);let r=Vt(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),ol=E("$ZodCheckStartsWith",(t,e)=>{Ne.init(t,e);let r=new RegExp(`^${Vt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),il=E("$ZodCheckEndsWith",(t,e)=>{Ne.init(t,e);let r=new RegExp(`.*${Vt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});a(ab,"handleCheckPropertyResult");sl=E("$ZodCheckProperty",(t,e)=>{Ne.init(t,e),t._zod.check=r=>{let o=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>ab(n,r,e.property));ab(o,r,e.property)}}),al=E("$ZodCheckMimeType",(t,e)=>{Ne.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(o=>{o._zod.bag.mime=e.mime}),t._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:e.mime,input:o.value.type,inst:t})}}),ul=E("$ZodCheckOverwrite",(t,e)=>{Ne.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var vo,cl=K(()=>{vo=class{static{a(this,"Doc")}constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
27
27
  `).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,n.join(`
28
28
  `))}}});var ll,dl=K(()=>{ll={major:4,minor:0,patch:0}});function $l(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function xb(t){if(!gs.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return $l(r)}function Rb(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}function lb(t,e,r){t.issues.length&&e.issues.push(...it(r,t.issues)),e.value[r]=t.value}function ws(t,e,r){t.issues.length&&e.issues.push(...it(r,t.issues)),e.value[r]=t.value}function db(t,e,r,o){t.issues.length?o[r]===void 0?r in o?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...it(r,t.issues)):t.value===void 0?r in o&&(e.value[r]=void 0):e.value[r]=t.value}function pb(t,e,r,o){for(let n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(i=>mt(i,o,qe())))}),e}function pl(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(on(t)&&on(e)){let r=Object.keys(e),o=Object.keys(t).filter(i=>r.indexOf(i)!==-1),n={...t,...e};for(let i of o){let s=pl(t[i],e[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],i=e[o],s=pl(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mb(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Tr(t))return t;let o=pl(e.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}function xs(t,e,r){t.issues.length&&e.issues.push(...it(r,t.issues)),e.value[r]=t.value}function fb(t,e,r,o,n,i,s){t.issues.length&&(mo.has(typeof o)?r.issues.push(...it(o,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:i,issues:t.issues.map(u=>mt(u,s,qe()))})),e.issues.length&&(mo.has(typeof o)?r.issues.push(...it(o,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:e.issues.map(u=>mt(u,s,qe()))})),r.value.set(t.value,e.value)}function gb(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function hb(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function yb(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function bb(t,e,r){return Tr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function vb(t){return t.value=Object.freeze(t.value),t}function wb(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(lc(n))}}var ce,_r,Ee,ml,fl,gl,hl,yl,bl,vl,wl,xl,Rl,Pl,Il,Sl,Tl,kl,El,_l,Ol,Cl,Al,Ll,Nl,Dl,Ml,Rs,Ul,wo,Ps,jl,zl,Zl,ql,Fl,un,Hl,Gl,Bl,xo,Vl,Is,Jl,Wl,Or,Kl,Ql,Yl,Xl,ed,td,Ro,rd,nd,od,id,sd,ad,ud,cd,Po,ld,dd,pd,md,fd,Io=K(()=>{vs();rn();cl();fs();hs();ue();dl();ue();ce=E("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ll;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let i of n._zod.onattach)i(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=a((i,s,u)=>{let c=Tr(i),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(c)continue;let p=i.issues.length,m=d._zod.check(i);if(m instanceof Promise&&u?.async===!1)throw new Mt;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,i.issues.length!==p&&(c||(c=Tr(i,p)))});else{if(i.issues.length===p)continue;c||(c=Tr(i,p))}}return l?l.then(()=>i):i},"runChecks");t._zod.run=(i,s)=>{let u=t._zod.parse(i,s);if(u instanceof Promise){if(s.async===!1)throw new Mt;return u.then(c=>n(c,o,s))}return n(u,o,s)}}t["~standard"]={validate:a(n=>{try{let i=fc(t,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return gc(t,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},"validate"),vendor:"zod",version:1}}),_r=E("$ZodString",(t,e)=>{ce.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Dc(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Ee=E("$ZodStringFormat",(t,e)=>{an.init(t,e),_r.init(t,e)}),ml=E("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Pc),Ee.init(t,e)}),fl=E("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=kr(o))}else e.pattern??(e.pattern=kr());Ee.init(t,e)}),gl=E("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ic),Ee.init(t,e)}),hl=E("$ZodURL",(t,e)=>{Ee.init(t,e),t._zod.check=r=>{try{let o=r.value,n=new URL(o),i=n.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Cc.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!o.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),yl=E("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Sc()),Ee.init(t,e)}),bl=E("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=xc),Ee.init(t,e)}),vl=E("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=hc),Ee.init(t,e)}),wl=E("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=yc),Ee.init(t,e)}),xl=E("$ZodULID",(t,e)=>{e.pattern??(e.pattern=bc),Ee.init(t,e)}),Rl=E("$ZodXID",(t,e)=>{e.pattern??(e.pattern=vc),Ee.init(t,e)}),Pl=E("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=wc),Ee.init(t,e)}),Il=E("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Nc(e)),Ee.init(t,e)}),Sl=E("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Ac),Ee.init(t,e)}),Tl=E("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Lc(e)),Ee.init(t,e)}),kl=E("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Rc),Ee.init(t,e)}),El=E("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Tc),Ee.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv4"})}),_l=E("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=kc),Ee.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Ol=E("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Ec),Ee.init(t,e)}),Cl=E("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=_c),Ee.init(t,e),t._zod.check=r=>{let[o,n]=r.value.split("/");try{if(!n)throw new Error;let i=Number(n);if(`${i}`!==n)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});a($l,"isValidBase64");Al=E("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Oc),Ee.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{$l(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});a(xb,"isValidBase64URL");Ll=E("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=gs),Ee.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{xb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Nl=E("$ZodE164",(t,e)=>{e.pattern??(e.pattern=$c),Ee.init(t,e)});a(Rb,"isValidJWT");Dl=E("$ZodJWT",(t,e)=>{Ee.init(t,e),t._zod.check=r=>{Rb(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Ml=E("$ZodCustomStringFormat",(t,e)=>{Ee.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),Rs=E("$ZodNumber",(t,e)=>{ce.init(t,e),t._zod.pattern=t._zod.bag.pattern??jc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...i?{received:i}:{}}),r}}),Ul=E("$ZodNumber",(t,e)=>{Bc.init(t,e),Rs.init(t,e)}),wo=E("$ZodBoolean",(t,e)=>{ce.init(t,e),t._zod.pattern=zc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),Ps=E("$ZodBigInt",(t,e)=>{ce.init(t,e),t._zod.pattern=Mc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),jl=E("$ZodBigInt",(t,e)=>{Vc.init(t,e),Ps.init(t,e)}),zl=E("$ZodSymbol",(t,e)=>{ce.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Zl=E("$ZodUndefined",(t,e)=>{ce.init(t,e),t._zod.pattern=qc,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),ql=E("$ZodNull",(t,e)=>{ce.init(t,e),t._zod.pattern=Zc,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Fl=E("$ZodAny",(t,e)=>{ce.init(t,e),t._zod.parse=r=>r}),un=E("$ZodUnknown",(t,e)=>{ce.init(t,e),t._zod.parse=r=>r}),Hl=E("$ZodNever",(t,e)=>{ce.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Gl=E("$ZodVoid",(t,e)=>{ce.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),Bl=E("$ZodDate",(t,e)=>{ce.init(t,e),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:t}),r}});a(lb,"handleArrayResult");xo=E("$ZodArray",(t,e)=>{ce.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let u=n[s],c=e.element._zod.run({value:u,issues:[]},o);c instanceof Promise?i.push(c.then(l=>lb(l,r,s))):lb(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});a(ws,"handleObjectResult");a(db,"handleOptionalObjectResult");Vl=E("$ZodObject",(t,e)=>{ce.init(t,e);let r=lo(()=>{let p=Object.keys(e.shape);for(let y of p)if(!(e.shape[y]instanceof ce))throw new Error(`Invalid element at key "${y}": expected a Zod schema`);let m=ac(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(m)}});Pe(t._zod,"propValues",()=>{let p=e.shape,m={};for(let y in p){let g=p[y]._zod;if(g.values){m[y]??(m[y]=new Set);for(let w of g.values)m[y].add(w)}}return m});let o=a(p=>{let m=new vo(["shape","payload","ctx"]),y=r.value,g=a(P=>{let k=Sr(P);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`},"parseStr");m.write("const input = payload.value;");let w=Object.create(null),v=0;for(let P of y.keys)w[P]=`key_${v++}`;m.write("const newResult = {}");for(let P of y.keys)if(y.optionalKeys.has(P)){let k=w[P];m.write(`const ${k} = ${g(P)};`);let _=Sr(P);m.write(`
@@ -313,6 +313,6 @@ Signature verification is impossible without access to the original signed mater
313
313
  `)}a(x,"buildSignedData"),ee(x,"buildSignedData");var P="./well-known/http-message-signatures-directory",k=(B=>(B.HTTP_MESSAGE_SIGNATURES_DIRECTORY="application/http-message-signatures-directory",B))(k||{});function _(B,oe){let F=oe.indexOf("=");if(F===-1)return[oe.trim(),!0];let X=oe.slice(0,F),Y=oe.slice(F+1).trim();if(X.length===0)throw new Error(`Invalid ${B} header. Invalid value ${oe}`);if(Y.match(/^".*"$/))return[X.trim(),Y.slice(1,-1)];if(Y.match(/^\d+$/))return[X.trim(),parseInt(Y)];if(Y.match(/^\(.*\)$/)){let fe=Y.slice(1,-1).split(/\s+/).map(Ie=>{var ye;return((ye=Ie.match(/^"(.*)"$/))==null?void 0:ye[1])??parseInt(Ie)});if(fe.some(Ie=>typeof Ie=="number"&&isNaN(Ie)))throw new Error(`Invalid ${B} header. Invalid value ${X}=${Y}`);return[X.trim(),fe]}throw new Error(`Invalid ${B} header. Invalid value ${X}=${Y}`)}a(_,"parseEntry"),ee(_,"parseEntry");function $(B,oe){var F;let X=(F=oe.toString().match(/(?:[^;"]+|"[^"]+")+/g))==null?void 0:F.map(Ke=>_(B,Ke.trim()));if(!X)throw new Error(`Invalid ${B} header. Invalid value`);let Y=X.findIndex(([,Ke])=>Array.isArray(Ke));if(Y===-1)throw new Error(`Invalid ${B} header. Missing components`);let[[fe,Ie]]=X.splice(Y,1);if(X.some(([,Ke])=>Array.isArray(Ke)))throw new Error("Multiple signatures is not supported");let ye=Object.fromEntries(X);return typeof ye.created=="number"&&(ye.created=new Date(ye.created*1e3)),typeof ye.expires=="number"&&(ye.expires=new Date(ye.expires*1e3)),{key:fe,components:Ie,parameters:ye}}a($,"parseParametersHeader"),ee($,"parseParametersHeader");function Z(B){return $("Signature-Input",B)}a(Z,"parseSignatureInputHeader"),ee(Z,"parseSignatureInputHeader");function V(B){return $("Accept-Signature",B)}a(V,"parseAcceptSignatureHeader"),ee(V,"parseAcceptSignatureHeader");function Q(B,oe){let F=oe.toString().match(/^([\w-]+)=:([A-Za-z0-9+/=]+):$/);if(!F)throw new Error("Invalid Signature header");let[,X,Y]=F;if(X!==B)throw new Error(`Invalid Signature header. Key mismatch ${X} !== ${B}`);return m(Y)}a(Q,"parseSignatureHeader"),ee(Q,"parseSignatureHeader");var te=["@method","@path","@query","@authority","content-type","digest"],re=["@status","content-type","digest"];async function ie(B,oe){let{signer:F,components:X,key:Y,...fe}=oe,Ie=X??("status"in B?re:te),ye=Y??"sig1",Ke={created:new Date,keyid:F.keyid,alg:F.alg,...fe},$t=v(Ie,Ke),ht=x(B,Ie,$t),rr=await F.sign(ht),Dr=p(rr);return{Signature:`${ye}=:${Dr}:`,"Signature-Input":`${ye}=${$t}`}}a(ie,"signatureHeaders2"),ee(ie,"signatureHeaders");function Te(B,oe){let{signer:F,components:X,key:Y,...fe}=oe,Ie=X??("status"in B?re:te),ye=Y??"sig1",Ke={created:new Date,keyid:F.keyid,alg:F.alg,...fe},$t=v(Ie,Ke),ht=x(B,Ie,$t),rr=F.signSync(ht),Dr=p(rr);return{Signature:`${ye}=:${Dr}:`,"Signature-Input":`${ye}=${$t}`}}a(Te,"signatureHeadersSync2"),ee(Te,"signatureHeadersSync");async function Be(B,oe){let F=y(B,"signature-input");if(!F)throw new Error("Message does not contain Signature-Input header");let{key:X,components:Y,parameters:fe}=Z(F);if(fe.expires&&fe.expires<new Date)throw new Error("Signature expired");let Ie=y(B,"signature");if(!Ie)throw new Error("Message does not contain Signature header");let ye=Q(X,Ie),Ke=F.toString().replace(/^[^=]+=/,""),$t=x(B,Y,Ke);return oe($t,ye,fe)}a(Be,"verify2"),ee(Be,"verify")}}),IR=Fg({"node_modules/jsonwebkey-thumbprint/dist/index.js"(t,e){var r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,s=ee((m,y)=>{for(var g in y)r(m,g,{get:y[g],enumerable:!0})},"__export"),u=ee((m,y,g,w)=>{if(y&&typeof y=="object"||typeof y=="function")for(let v of n(y))!i.call(m,v)&&v!==g&&r(m,v,{get:ee(()=>y[v],"get"),enumerable:!(w=o(y,v))||w.enumerable});return m},"__copyProps"),c=ee(m=>u(r({},"__esModule",{value:!0}),m),"__toCommonJS"),l={};s(l,{jwkThumbprint:ee(()=>p,"jwkThumbprint"),jwkThumbprintPreCompute:ee(()=>d,"jwkThumbprintPreCompute")}),e.exports=c(l);var d=ee(m=>{let y=new TextEncoder;switch(m.kty){case"EC":return y.encode(`{"crv":"${m.crv}","kty":"EC","x":"${m.x}","y":"${m.y}"}`);case"OKP":return y.encode(`{"crv":"${m.crv}","kty":"OKP","x":"${m.x}"}`);case"RSA":return y.encode(`{"e":"${m.e}","kty":"RSA","n":"${m.n}"}`);default:throw new Error("Unsupported key type")}},"jwkThumbprintPreCompute"),p=ee(async(m,y,g)=>{let w=d(m),v=await y(w);return g(v)},"jwkThumbprint")}}),l$=Fg({"node_modules/web-bot-auth/dist/index.js"(t,e){var r=Object.create,o=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=ee((F,X)=>{for(var Y in X)o(F,Y,{get:X[Y],enumerable:!0})},"__export"),l=ee((F,X,Y,fe)=>{if(X&&typeof X=="object"||typeof X=="function")for(let Ie of i(X))!u.call(F,Ie)&&Ie!==Y&&o(F,Ie,{get:ee(()=>X[Ie],"get"),enumerable:!(fe=n(X,Ie))||fe.enumerable});return F},"__copyProps"),d=ee((F,X,Y)=>(Y=F!=null?r(s(F)):{},l(X||!F||!F.__esModule?o(Y,"default",{value:F,enumerable:!0}):Y,F)),"__toESM"),p=ee(F=>l(o({},"__esModule",{value:!0}),F),"__toCommonJS"),m={};c(m,{HTTP_MESSAGE_SIGNAGURE_TAG:ee(()=>Z,"HTTP_MESSAGE_SIGNAGURE_TAG"),HTTP_MESSAGE_SIGNATURES_DIRECTORY:ee(()=>g.HTTP_MESSAGE_SIGNATURES_DIRECTORY,"HTTP_MESSAGE_SIGNATURES_DIRECTORY"),MediaType:ee(()=>g.MediaType,"MediaType"),NONCE_LENGTH_IN_BYTES:ee(()=>re,"NONCE_LENGTH_IN_BYTES"),REQUEST_COMPONENTS:ee(()=>te,"REQUEST_COMPONENTS"),REQUEST_COMPONENTS_WITHOUT_SIGNATURE_AGENT:ee(()=>Q,"REQUEST_COMPONENTS_WITHOUT_SIGNATURE_AGENT"),SIGNATURE_AGENT_HEADER:ee(()=>V,"SIGNATURE_AGENT_HEADER"),generateNonce:ee(()=>ie,"generateNonce"),helpers:ee(()=>$,"helpers"),jwkToKeyID:ee(()=>w.jwkThumbprint,"jwkToKeyID"),signatureHeaders:ee(()=>Be,"signatureHeaders"),signatureHeadersSync:ee(()=>B,"signatureHeadersSync"),validateNonce:ee(()=>Te,"validateNonce"),verify:ee(()=>oe,"verify")}),e.exports=p(m);var y=d(PR()),g=PR(),w=IR();function v(F){return btoa(String.fromCharCode(...F))}a(v,"u8ToB64"),ee(v,"u8ToB64");function x(F){return Uint8Array.from(atob(F),X=>X.charCodeAt(0))}a(x,"b64Tou8"),ee(x,"b64Tou8");function P(F){return F.replace(/\+/g,"-").replace(/\//g,"_")}a(P,"b64ToB64URL"),ee(P,"b64ToB64URL");function k(F){return F.replace(/=/g,"")}a(k,"b64ToB64NoPadding"),ee(k,"b64ToB64NoPadding");var _=IR(),$={WEBCRYPTO_SHA256:ee(F=>crypto.subtle.digest("SHA-256",F),"WEBCRYPTO_SHA256"),BASE64URL_DECODE:ee(F=>P(k(v(new Uint8Array(F)))),"BASE64URL_DECODE")},Z="web-bot-auth",V="signature-agent",Q=["@authority"],te=["@authority",V],re=64;function ie(){let F=new Uint8Array(re);return crypto.getRandomValues(F),v(F)}a(ie,"generateNonce"),ee(ie,"generateNonce");function Te(F){try{return x(F).length===re}catch{return!1}}a(Te,"validateNonce"),ee(Te,"validateNonce");function Be(F,X,Y){if(Y.created.getTime()>Y.expires.getTime())throw new Error("created should happen before expires");let fe=Y.nonce;if(!fe)fe=ie();else if(!Te(fe))throw new Error("nonce is not a valid uint32");let Ie=y.extractHeader(F,V),ye=te;return Ie||(ye=Q),y.signatureHeaders(F,{signer:X,components:ye,created:Y.created,expires:Y.expires,nonce:fe,keyid:X.keyid,key:Y.key,tag:Z})}a(Be,"signatureHeaders2"),ee(Be,"signatureHeaders2");function B(F,X,Y){if(Y.created.getTime()>Y.expires.getTime())throw new Error("created should happen before expires");let fe=Y.nonce;if(!fe)fe=ie();else if(!Te(fe))throw new Error("nonce is not a valid uint32");let Ie=y.extractHeader(F,V),ye=te;return Ie||(ye=Q),y.signatureHeadersSync(F,{signer:X,components:ye,created:Y.created,expires:Y.expires,nonce:fe,keyid:X.keyid,tag:Z})}a(B,"signatureHeadersSync2"),ee(B,"signatureHeadersSync2");function oe(F,X){let Y=ee((fe,Ie,ye)=>{if(ye.tag!==Z)throw new Error(`tag must be '${Z}'`);if(ye.created.getTime()>Date.now())throw new Error("created in the future");if(ye.expires.getTime()<Date.now())throw new Error("signature has expired");if(ye.keyid===void 0)throw new Error("keyid MUST be defined");let Ke={keyid:ye.keyid,created:ye.created,expires:ye.expires,tag:ye.tag,nonce:ye.nonce};return X(fe,Ie,Ke)},"v");return y.verify(F,Y)}a(oe,"verify2"),ee(oe,"verify2")}}),Nr=l$();var d$=Nr.verify,ane=Nr.signatureHeaders,une=Nr.signatureHeadersSync,SR=d$;var cne=Nr.generateNonce,lne=Nr.validateNonce,dne=Nr.Algorithm;var at=class extends Error{constructor(r,o=401,n){super(r);this.status=o;this.botId=n;this.name="BotAuthenticationError"}static{a(this,"BotAuthenticationError")}};async function p$(t,e,r,o,n,i){try{let s=await D.fetch(o);if(!s.ok)throw new at(`Failed to fetch directory: ${s.status}`,500);let c=(await s.json())[t];if(!c)throw new at(`Bot ${t} not found in directory`,403,t);n.log.info(`${i}: Bot ${t} found in directory`);let l=await crypto.subtle.importKey("jwk",c,{name:"Ed25519"},!0,["verify"]),d=new TextEncoder().encode(e);if(!await crypto.subtle.verify({name:"Ed25519"},l,r,d))throw new at("Invalid signature",401,t)}catch(s){throw s instanceof at?s:(n.log.error(`${i}: Error verifying signature: ${s}`),new at(`Error verifying signature: ${s.message}`,500,t))}}a(p$,"verifyWithDirectory");async function TR(t,e,r,o){let n=t.headers.get("Signature"),i=t.headers.get("Signature-Input");if(!n||!i)throw new at("Bot authentication required");try{let s;async function u(c,l,d){let p=d.keyid;if(s=p,!e.allowedBots.includes(p)&&e.blockUnknownBots)throw new at(`Bot ${p} is not in the allowed list`,403,p);r.log.info(`${o}: Verifying signature for bot ${p}`),e.directoryUrl?await p$(p,c,l,e.directoryUrl,r,o):r.log.info(`${o}: No directory URL provided, using default verification`),r.log.info(`${o}: Bot ${p} authenticated successfully`)}if(a(u,"verifySignature"),await SR(t,u),!s)throw new at("Could not extract bot ID from signature");return s}catch(s){throw s instanceof at?s:new at(`Bot authentication failed: ${s.message}`)}}a(TR,"verifyBotSignature");var m$=Symbol("botId"),f$=new pe(m$);var g$=a(async(t,e,r,o)=>{I("policy.inbound.web-bot-auth");let n=t.headers.get("Signature"),i=t.headers.get("Signature-Input");if(!n||!i)return r.allowUnauthenticatedRequests?(e.log.info(`${o}: No bot signature found, allowing unauthenticated request`),t):(e.log.warn(`${o}: No bot signature found, rejecting request`),new Response("Bot authentication required",{status:401}));try{let s=await TR(t,r,e,o);return f$.set(e,s),t}catch(s){return s instanceof at?(e.log.error(`${o}: Bot authentication failed: ${s.message}`),new Response(`Bot authentication failed: ${s.message}`,{status:s.status})):(e.log.error(`${o}: Bot authentication failed: ${s}`),new Response(`Bot authentication failed: ${s.message}`,{status:401}))}},"WebBotAuthInboundPolicy");var kR=a(t=>{var e=Object.defineProperty,r=a((f,b)=>e(f,"name",{value:b,configurable:!0}),"__name"),o={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:r(function(f,b){return b},"tagValueProcessor"),attributeValueProcessor:r(function(f,b){return b},"attributeValueProcessor"),stopNodes:[],alwaysCreateTextNode:!1,isArray:r(()=>!1,"isArray"),commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:r(function(f,b,S){return f},"updateTag"),captureMetaData:!1};function n(f){return typeof f=="boolean"?{enabled:f,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof f=="object"&&f!==null?{enabled:f.enabled!==!1,maxEntitySize:f.maxEntitySize??1e4,maxExpansionDepth:f.maxExpansionDepth??10,maxTotalExpansions:f.maxTotalExpansions??1e3,maxExpandedLength:f.maxExpandedLength??1e5,allowedTags:f.allowedTags??null,tagFilter:f.tagFilter??null}:n(!0)}a(n,"normalizeProcessEntities"),r(n,"normalizeProcessEntities");var i=r(function(f){let b=Object.assign({},o,f);return b.processEntities=n(b.processEntities),b},"buildOptions"),s=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",u=s+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",c="["+s+"]["+u+"]*",l=new RegExp("^"+c+"$");function d(f,b){let S=[],O=b.exec(f);for(;O;){let A=[];A.startIndex=b.lastIndex-O[0].length;let C=O.length;for(let U=0;U<C;U++)A.push(O[U]);S.push(A),O=b.exec(f)}return S}a(d,"getAllMatches"),r(d,"getAllMatches");var p=r(function(f){let b=l.exec(f);return!(b===null||typeof b>"u")},"isName");function m(f){return typeof f<"u"}a(m,"isExist"),r(m,"isExist");var y;typeof Symbol!="function"?y="@@xmlMetadata":y=Symbol("XML Node Metadata");var g=class{static{a(this,"XmlNode")}static{r(this,"XmlNode")}constructor(f){this.tagname=f,this.child=[],this[":@"]={}}add(f,b){f==="__proto__"&&(f="#__proto__"),this.child.push({[f]:b})}addChild(f,b){f.tagname==="__proto__"&&(f.tagname="#__proto__"),f[":@"]&&Object.keys(f[":@"]).length>0?this.child.push({[f.tagname]:f.child,":@":f[":@"]}):this.child.push({[f.tagname]:f.child}),b!==void 0&&(this.child[this.child.length-1][y]={startIndex:b})}static getMetaDataSymbol(){return y}},w=class{static{a(this,"DocTypeReader")}static{r(this,"DocTypeReader")}constructor(f){this.suppressValidationErr=!f,this.options=f}readDocType(f,b){let S={};if(f[b+3]==="O"&&f[b+4]==="C"&&f[b+5]==="T"&&f[b+6]==="Y"&&f[b+7]==="P"&&f[b+8]==="E"){b=b+9;let O=1,A=!1,C=!1,U="";for(;b<f.length;b++)if(f[b]==="<"&&!C){if(A&&x(f,"!ENTITY",b)){b+=7;let ne,q;if([ne,q,b]=this.readEntityExp(f,b+1,this.suppressValidationErr),q.indexOf("&")===-1){let j=ne.replace(/[.\-+*:]/g,"\\.");S[ne]={regx:RegExp(`&${j};`,"g"),val:q}}}else if(A&&x(f,"!ELEMENT",b)){b+=8;let{index:ne}=this.readElementExp(f,b+1);b=ne}else if(A&&x(f,"!ATTLIST",b))b+=8;else if(A&&x(f,"!NOTATION",b)){b+=9;let{index:ne}=this.readNotationExp(f,b+1,this.suppressValidationErr);b=ne}else if(x(f,"!--",b))C=!0;else throw new Error("Invalid DOCTYPE");O++,U=""}else if(f[b]===">"){if(C?f[b-1]==="-"&&f[b-2]==="-"&&(C=!1,O--):O--,O===0)break}else f[b]==="["?A=!0:U+=f[b];if(O!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:S,i:b}}readEntityExp(f,b){b=v(f,b);let S="";for(;b<f.length&&!/\s/.test(f[b])&&f[b]!=='"'&&f[b]!=="'";)S+=f[b],b++;if(P(S),b=v(f,b),!this.suppressValidationErr){if(f.substring(b,b+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(f[b]==="%")throw new Error("Parameter entities are not supported")}let O="";if([b,O]=this.readIdentifierVal(f,b,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&O.length>this.options.maxEntitySize)throw new Error(`Entity "${S}" size (${O.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return b--,[S,O,b]}readNotationExp(f,b){b=v(f,b);let S="";for(;b<f.length&&!/\s/.test(f[b]);)S+=f[b],b++;!this.suppressValidationErr&&P(S),b=v(f,b);let O=f.substring(b,b+6).toUpperCase();if(!this.suppressValidationErr&&O!=="SYSTEM"&&O!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${O}"`);b+=O.length,b=v(f,b);let A=null,C=null;if(O==="PUBLIC")[b,A]=this.readIdentifierVal(f,b,"publicIdentifier"),b=v(f,b),(f[b]==='"'||f[b]==="'")&&([b,C]=this.readIdentifierVal(f,b,"systemIdentifier"));else if(O==="SYSTEM"&&([b,C]=this.readIdentifierVal(f,b,"systemIdentifier"),!this.suppressValidationErr&&!C))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:S,publicIdentifier:A,systemIdentifier:C,index:--b}}readIdentifierVal(f,b,S){let O="",A=f[b];if(A!=='"'&&A!=="'")throw new Error(`Expected quoted string, found "${A}"`);for(b++;b<f.length&&f[b]!==A;)O+=f[b],b++;if(f[b]!==A)throw new Error(`Unterminated ${S} value`);return b++,[b,O]}readElementExp(f,b){b=v(f,b);let S="";for(;b<f.length&&!/\s/.test(f[b]);)S+=f[b],b++;if(!this.suppressValidationErr&&!p(S))throw new Error(`Invalid element name: "${S}"`);b=v(f,b);let O="";if(f[b]==="E"&&x(f,"MPTY",b))b+=4;else if(f[b]==="A"&&x(f,"NY",b))b+=2;else if(f[b]==="("){for(b++;b<f.length&&f[b]!==")";)O+=f[b],b++;if(f[b]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${f[b]}"`);return{elementName:S,contentModel:O.trim(),index:b}}readAttlistExp(f,b){b=v(f,b);let S="";for(;b<f.length&&!/\s/.test(f[b]);)S+=f[b],b++;P(S),b=v(f,b);let O="";for(;b<f.length&&!/\s/.test(f[b]);)O+=f[b],b++;if(!P(O))throw new Error(`Invalid attribute name: "${O}"`);b=v(f,b);let A="";if(f.substring(b,b+8).toUpperCase()==="NOTATION"){if(A="NOTATION",b+=8,b=v(f,b),f[b]!=="(")throw new Error(`Expected '(', found "${f[b]}"`);b++;let U=[];for(;b<f.length&&f[b]!==")";){let ne="";for(;b<f.length&&f[b]!=="|"&&f[b]!==")";)ne+=f[b],b++;if(ne=ne.trim(),!P(ne))throw new Error(`Invalid notation name: "${ne}"`);U.push(ne),f[b]==="|"&&(b++,b=v(f,b))}if(f[b]!==")")throw new Error("Unterminated list of notations");b++,A+=" ("+U.join("|")+")"}else{for(;b<f.length&&!/\s/.test(f[b]);)A+=f[b],b++;let U=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!U.includes(A.toUpperCase()))throw new Error(`Invalid attribute type: "${A}"`)}b=v(f,b);let C="";return f.substring(b,b+8).toUpperCase()==="#REQUIRED"?(C="#REQUIRED",b+=8):f.substring(b,b+7).toUpperCase()==="#IMPLIED"?(C="#IMPLIED",b+=7):[b,C]=this.readIdentifierVal(f,b,"ATTLIST"),{elementName:S,attributeName:O,attributeType:A,defaultValue:C,index:b}}},v=r((f,b)=>{for(;b<f.length&&/\s/.test(f[b]);)b++;return b},"skipWhitespace");function x(f,b,S){for(let O=0;O<b.length;O++)if(b[O]!==f[S+O+1])return!1;return!0}a(x,"hasSeq"),r(x,"hasSeq");function P(f){if(p(f))return f;throw new Error(`Invalid entity name ${f}`)}a(P,"validateEntityName"),r(P,"validateEntityName");var k=/^[-+]?0x[a-fA-F0-9]+$/,_=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,$={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Z(f,b={}){if(b=Object.assign({},$,b),!f||typeof f!="string")return f;let S=f.trim();if(b.skipLike!==void 0&&b.skipLike.test(S))return f;if(f==="0")return 0;if(b.hex&&k.test(S))return re(S,16);if(S.includes("e")||S.includes("E"))return Q(f,S,b);{let O=_.exec(S);if(O){let A=O[1]||"",C=O[2],U=te(O[3]),ne=A?f[C.length+1]===".":f[C.length]===".";if(!b.leadingZeros&&(C.length>1||C.length===1&&!ne))return f;{let q=Number(S),j=String(q);if(q===0)return q;if(j.search(/[eE]/)!==-1)return b.eNotation?q:f;if(S.indexOf(".")!==-1)return j==="0"||j===U||j===`${A}${U}`?q:f;let xe=C?U:S;return C?xe===j||A+xe===j?q:f:xe===j||xe===A+j?q:f}}else return f}}a(Z,"toNumber"),r(Z,"toNumber");var V=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Q(f,b,S){if(!S.eNotation)return f;let O=b.match(V);if(O){let A=O[1]||"",C=O[3].indexOf("e")===-1?"E":"e",U=O[2],ne=A?f[U.length+1]===C:f[U.length]===C;return U.length>1&&ne?f:U.length===1&&(O[3].startsWith(`.${C}`)||O[3][0]===C)?Number(b):S.leadingZeros&&!ne?(b=(O[1]||"")+O[3],Number(b)):f}else return f}a(Q,"resolveEnotation"),r(Q,"resolveEnotation");function te(f){return f&&f.indexOf(".")!==-1&&(f=f.replace(/0+$/,""),f==="."?f="0":f[0]==="."?f="0"+f:f[f.length-1]==="."&&(f=f.substring(0,f.length-1))),f}a(te,"trimZeros"),r(te,"trimZeros");function re(f,b){if(parseInt)return parseInt(f,b);if(Number.parseInt)return Number.parseInt(f,b);if(window&&window.parseInt)return window.parseInt(f,b);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}a(re,"parse_int"),r(re,"parse_int");function ie(f){return typeof f=="function"?f:Array.isArray(f)?b=>{for(let S of f)if(typeof S=="string"&&b===S||S instanceof RegExp&&S.test(b))return!0}:()=>!1}a(ie,"getIgnoreAttributesFn"),r(ie,"getIgnoreAttributesFn");var Te=class{static{a(this,"OrderedObjParser")}static{r(this,"OrderedObjParser")}constructor(f){if(this.options=f,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:r((b,S)=>Za(S,10,"&#"),"val")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:r((b,S)=>Za(S,16,"&#x"),"val")}},this.addExternalEntities=Be,this.parseXml=Y,this.parseTextData=B,this.resolveNameSpace=oe,this.buildAttributesMap=X,this.isItStopNode=Ke,this.replaceEntitiesValue=Ie,this.readStopNodeData=Dr,this.saveTextToParentTag=ye,this.addChild=fe,this.ignoreAttributesFn=ie(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let b=0;b<this.options.stopNodes.length;b++){let S=this.options.stopNodes[b];typeof S=="string"&&(S.startsWith("*.")?this.stopNodesWildcard.add(S.substring(2)):this.stopNodesExact.add(S))}}}};function Be(f){let b=Object.keys(f);for(let S=0;S<b.length;S++){let O=b[S],A=O.replace(/[.\-+*:]/g,"\\.");this.lastEntities[O]={regex:new RegExp("&"+A+";","g"),val:f[O]}}}a(Be,"addExternalEntities"),r(Be,"addExternalEntities");function B(f,b,S,O,A,C,U){if(f!==void 0&&(this.options.trimValues&&!O&&(f=f.trim()),f.length>0)){U||(f=this.replaceEntitiesValue(f,b,S));let ne=this.options.tagValueProcessor(b,f,S,A,C);return ne==null?f:typeof ne!=typeof f||ne!==f?ne:this.options.trimValues?mi(f,this.options.parseTagValue,this.options.numberParseOptions):f.trim()===f?mi(f,this.options.parseTagValue,this.options.numberParseOptions):f}}a(B,"parseTextData"),r(B,"parseTextData");function oe(f){if(this.options.removeNSPrefix){let b=f.split(":"),S=f.charAt(0)==="/"?"/":"";if(b[0]==="xmlns")return"";b.length===2&&(f=S+b[1])}return f}a(oe,"resolveNameSpace"),r(oe,"resolveNameSpace");var F=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function X(f,b,S){if(this.options.ignoreAttributes!==!0&&typeof f=="string"){let O=d(f,F),A=O.length,C={};for(let U=0;U<A;U++){let ne=this.resolveNameSpace(O[U][1]);if(this.ignoreAttributesFn(ne,b))continue;let q=O[U][4],j=this.options.attributeNamePrefix+ne;if(ne.length)if(this.options.transformAttributeName&&(j=this.options.transformAttributeName(j)),j==="__proto__"&&(j="#__proto__"),q!==void 0){this.options.trimValues&&(q=q.trim()),q=this.replaceEntitiesValue(q,S,b);let xe=this.options.attributeValueProcessor(ne,q,b);xe==null?C[j]=q:typeof xe!=typeof q||xe!==q?C[j]=xe:C[j]=mi(q,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(C[j]=!0)}if(!Object.keys(C).length)return;if(this.options.attributesGroupName){let U={};return U[this.options.attributesGroupName]=C,U}return C}}a(X,"buildAttributesMap"),r(X,"buildAttributesMap");var Y=r(function(f){f=f.replace(/\r\n?/g,`
314
314
  `);let b=new g("!xml"),S=b,O="",A="";this.entityExpansionCount=0,this.currentExpandedLength=0;let C=new w(this.options.processEntities);for(let U=0;U<f.length;U++)if(f[U]==="<")if(f[U+1]==="/"){let q=ht(f,">",U,"Closing Tag is not closed."),j=f.substring(U+2,q).trim();if(this.options.removeNSPrefix){let Ye=j.indexOf(":");Ye!==-1&&(j=j.substr(Ye+1))}this.options.transformTagName&&(j=this.options.transformTagName(j)),S&&(O=this.saveTextToParentTag(O,S,A));let xe=A.substring(A.lastIndexOf(".")+1);if(j&&this.options.unpairedTags.indexOf(j)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${j}>`);let se=0;xe&&this.options.unpairedTags.indexOf(xe)!==-1?(se=A.lastIndexOf(".",A.lastIndexOf(".")-1),this.tagsNodeStack.pop()):se=A.lastIndexOf("."),A=A.substring(0,se),S=this.tagsNodeStack.pop(),O="",U=q}else if(f[U+1]==="?"){let q=rr(f,U,!1,"?>");if(!q)throw new Error("Pi Tag is not closed.");if(O=this.saveTextToParentTag(O,S,A),!(this.options.ignoreDeclaration&&q.tagName==="?xml"||this.options.ignorePiTags)){let j=new g(q.tagName);j.add(this.options.textNodeName,""),q.tagName!==q.tagExp&&q.attrExpPresent&&(j[":@"]=this.buildAttributesMap(q.tagExp,A,q.tagName)),this.addChild(S,j,A,U)}U=q.closeIndex+1}else if(f.substr(U+1,3)==="!--"){let q=ht(f,"-->",U+4,"Comment is not closed.");if(this.options.commentPropName){let j=f.substring(U+4,q-2);O=this.saveTextToParentTag(O,S,A),S.add(this.options.commentPropName,[{[this.options.textNodeName]:j}])}U=q}else if(f.substr(U+1,2)==="!D"){let q=C.readDocType(f,U);this.docTypeEntities=q.entities,U=q.i}else if(f.substr(U+1,2)==="!["){let q=ht(f,"]]>",U,"CDATA is not closed.")-2,j=f.substring(U+9,q);O=this.saveTextToParentTag(O,S,A);let xe=this.parseTextData(j,S.tagname,A,!0,!1,!0,!0);xe==null&&(xe=""),this.options.cdataPropName?S.add(this.options.cdataPropName,[{[this.options.textNodeName]:j}]):S.add(this.options.textNodeName,xe),U=q+2}else{let q=rr(f,U,this.options.removeNSPrefix),j=q.tagName,xe=q.rawTagName,se=q.tagExp,Ye=q.attrExpPresent,rh=q.closeIndex;if(this.options.transformTagName){let Xe=this.options.transformTagName(j);se===j&&(se=Xe),j=Xe}S&&O&&S.tagname!=="!xml"&&(O=this.saveTextToParentTag(O,S,A,!1));let nh=S;nh&&this.options.unpairedTags.indexOf(nh.tagname)!==-1&&(S=this.tagsNodeStack.pop(),A=A.substring(0,A.lastIndexOf("."))),j!==b.tagname&&(A+=A?"."+j:j);let Ja=U;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,A,j)){let Xe="";if(se.length>0&&se.lastIndexOf("/")===se.length-1)j[j.length-1]==="/"?(j=j.substr(0,j.length-1),A=A.substr(0,A.length-1),se=j):se=se.substr(0,se.length-1),U=q.closeIndex;else if(this.options.unpairedTags.indexOf(j)!==-1)U=q.closeIndex;else{let Wa=this.readStopNodeData(f,xe,rh+1);if(!Wa)throw new Error(`Unexpected end of ${xe}`);U=Wa.i,Xe=Wa.tagContent}let Ur=new g(j);j!==se&&Ye&&(Ur[":@"]=this.buildAttributesMap(se,A,j)),Xe&&(Xe=this.parseTextData(Xe,j,A,!0,Ye,!0,!0)),A=A.substr(0,A.lastIndexOf(".")),Ur.add(this.options.textNodeName,Xe),this.addChild(S,Ur,A,Ja)}else{if(se.length>0&&se.lastIndexOf("/")===se.length-1){if(j[j.length-1]==="/"?(j=j.substr(0,j.length-1),A=A.substr(0,A.length-1),se=j):se=se.substr(0,se.length-1),this.options.transformTagName){let Ur=this.options.transformTagName(j);se===j&&(se=Ur),j=Ur}let Xe=new g(j);j!==se&&Ye&&(Xe[":@"]=this.buildAttributesMap(se,A,j)),this.addChild(S,Xe,A,Ja),A=A.substr(0,A.lastIndexOf("."))}else{let Xe=new g(j);this.tagsNodeStack.push(S),j!==se&&Ye&&(Xe[":@"]=this.buildAttributesMap(se,A,j)),this.addChild(S,Xe,A,Ja),S=Xe}O="",U=rh}}else O+=f[U];return b.child},"parseXml");function fe(f,b,S,O){this.options.captureMetaData||(O=void 0);let A=this.options.updateTag(b.tagname,S,b[":@"]);A===!1||(typeof A=="string"&&(b.tagname=A),f.addChild(b,O))}a(fe,"addChild"),r(fe,"addChild");var Ie=r(function(f,b,S){if(f.indexOf("&")===-1)return f;let O=this.options.processEntities;if(!O.enabled||O.allowedTags&&!O.allowedTags.includes(b)||O.tagFilter&&!O.tagFilter(b,S))return f;for(let A in this.docTypeEntities){let C=this.docTypeEntities[A],U=f.match(C.regx);if(U){if(this.entityExpansionCount+=U.length,O.maxTotalExpansions&&this.entityExpansionCount>O.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${O.maxTotalExpansions}`);let ne=f.length;if(f=f.replace(C.regx,C.val),O.maxExpandedLength&&(this.currentExpandedLength+=f.length-ne,this.currentExpandedLength>O.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${O.maxExpandedLength}`)}}if(f.indexOf("&")===-1)return f;for(let A in this.lastEntities){let C=this.lastEntities[A];f=f.replace(C.regex,C.val)}if(f.indexOf("&")===-1)return f;if(this.options.htmlEntities)for(let A in this.htmlEntities){let C=this.htmlEntities[A];f=f.replace(C.regex,C.val)}return f=f.replace(this.ampEntity.regex,this.ampEntity.val),f},"replaceEntitiesValue");function ye(f,b,S,O){return f&&(O===void 0&&(O=b.child.length===0),f=this.parseTextData(f,b.tagname,S,!1,b[":@"]?Object.keys(b[":@"]).length!==0:!1,O),f!==void 0&&f!==""&&b.add(this.options.textNodeName,f),f=""),f}a(ye,"saveTextToParentTag"),r(ye,"saveTextToParentTag");function Ke(f,b,S,O){return!!(b&&b.has(O)||f&&f.has(S))}a(Ke,"isItStopNode"),r(Ke,"isItStopNode");function $t(f,b,S=">"){let O,A="";for(let C=b;C<f.length;C++){let U=f[C];if(O)U===O&&(O="");else if(U==='"'||U==="'")O=U;else if(U===S[0])if(S[1]){if(f[C+1]===S[1])return{data:A,index:C}}else return{data:A,index:C};else U===" "&&(U=" ");A+=U}}a($t,"tagExpWithClosingIndex"),r($t,"tagExpWithClosingIndex");function ht(f,b,S,O){let A=f.indexOf(b,S);if(A===-1)throw new Error(O);return A+b.length-1}a(ht,"findClosingIndex"),r(ht,"findClosingIndex");function rr(f,b,S,O=">"){let A=$t(f,b+1,O);if(!A)return;let C=A.data,U=A.index,ne=C.search(/\s/),q=C,j=!0;ne!==-1&&(q=C.substring(0,ne),C=C.substring(ne+1).trimStart());let xe=q;if(S){let se=q.indexOf(":");se!==-1&&(q=q.substr(se+1),j=q!==A.data.substr(se+1))}return{tagName:q,tagExp:C,closeIndex:U,attrExpPresent:j,rawTagName:xe}}a(rr,"readTagExp"),r(rr,"readTagExp");function Dr(f,b,S){let O=S,A=1;for(;S<f.length;S++)if(f[S]==="<")if(f[S+1]==="/"){let C=ht(f,">",S,`${b} is not closed`);if(f.substring(S+2,C).trim()===b&&(A--,A===0))return{tagContent:f.substring(O,S),i:C};S=C}else if(f[S+1]==="?")S=ht(f,"?>",S+1,"StopNode is not closed.");else if(f.substr(S+1,3)==="!--")S=ht(f,"-->",S+3,"StopNode is not closed.");else if(f.substr(S+1,2)==="![")S=ht(f,"]]>",S,"StopNode is not closed.")-2;else{let C=rr(f,S,">");C&&((C&&C.tagName)===b&&C.tagExp[C.tagExp.length-1]!=="/"&&A++,S=C.closeIndex)}}a(Dr,"readStopNodeData"),r(Dr,"readStopNodeData");function mi(f,b,S){if(b&&typeof f=="string"){let O=f.trim();return O==="true"?!0:O==="false"?!1:Z(f,S)}else return m(f)?f:""}a(mi,"parseValue"),r(mi,"parseValue");function Za(f,b,S){let O=Number.parseInt(f,b);return O>=0&&O<=1114111?String.fromCodePoint(O):S+f+";"}a(Za,"fromCodePoint"),r(Za,"fromCodePoint");var qa=g.getMetaDataSymbol();function Vg(f,b){return Fa(f,b)}a(Vg,"prettify"),r(Vg,"prettify");function Fa(f,b,S){let O,A={};for(let C=0;C<f.length;C++){let U=f[C],ne=Jg(U),q="";if(S===void 0?q=ne:q=S+"."+ne,ne===b.textNodeName)O===void 0?O=U[ne]:O+=""+U[ne];else{if(ne===void 0)continue;if(U[ne]){let j=Fa(U[ne],b,q),xe=Kg(j,b);U[qa]!==void 0&&(j[qa]=U[qa]),U[":@"]?Wg(j,U[":@"],q,b):Object.keys(j).length===1&&j[b.textNodeName]!==void 0&&!b.alwaysCreateTextNode?j=j[b.textNodeName]:Object.keys(j).length===0&&(b.alwaysCreateTextNode?j[b.textNodeName]="":j=""),A[ne]!==void 0&&A.hasOwnProperty(ne)?(Array.isArray(A[ne])||(A[ne]=[A[ne]]),A[ne].push(j)):b.isArray(ne,q,xe)?A[ne]=[j]:A[ne]=j}}}return typeof O=="string"?O.length>0&&(A[b.textNodeName]=O):O!==void 0&&(A[b.textNodeName]=O),A}a(Fa,"compress"),r(Fa,"compress");function Jg(f){let b=Object.keys(f);for(let S=0;S<b.length;S++){let O=b[S];if(O!==":@")return O}}a(Jg,"propName"),r(Jg,"propName");function Wg(f,b,S,O){if(b){let A=Object.keys(b),C=A.length;for(let U=0;U<C;U++){let ne=A[U];O.isArray(ne,S+"."+ne,!0,!0)?f[ne]=[b[ne]]:f[ne]=b[ne]}}}a(Wg,"assignAttributes"),r(Wg,"assignAttributes");function Kg(f,b){let{textNodeName:S}=b,O=Object.keys(f).length;return!!(O===0||O===1&&(f[S]||typeof f[S]=="boolean"||f[S]===0))}a(Kg,"isLeafTag"),r(Kg,"isLeafTag");var NR={allowBooleanAttributes:!1,unpairedTags:[]};function Qg(f,b){b=Object.assign({},NR,b);let S=[],O=!1,A=!1;f[0]==="\uFEFF"&&(f=f.substr(1));for(let C=0;C<f.length;C++)if(f[C]==="<"&&f[C+1]==="?"){if(C+=2,C=Ga(f,C),C.err)return C}else if(f[C]==="<"){let U=C;if(C++,f[C]==="!"){C=Ba(f,C);continue}else{let ne=!1;f[C]==="/"&&(ne=!0,C++);let q="";for(;C<f.length&&f[C]!==">"&&f[C]!==" "&&f[C]!==" "&&f[C]!==`
315
315
  `&&f[C]!=="\r";C++)q+=f[C];if(q=q.trim(),q[q.length-1]==="/"&&(q=q.substring(0,q.length-1),C--),!L(q)){let se;return q.trim().length===0?se="Invalid space after '<'.":se="Tag '"+q+"' is an invalid name.",De("InvalidTag",se,Qe(f,C))}let j=Yg(f,C);if(j===!1)return De("InvalidAttr","Attributes for '"+q+"' have open quote.",Qe(f,C));let xe=j.value;if(C=j.index,xe[xe.length-1]==="/"){let se=C-xe.length;xe=xe.substring(0,xe.length-1);let Ye=Va(xe,b);if(Ye===!0)O=!0;else return De(Ye.err.code,Ye.err.msg,Qe(f,se+Ye.err.line))}else if(ne)if(j.tagClosed){if(xe.trim().length>0)return De("InvalidTag","Closing tag '"+q+"' can't have attributes or invalid starting.",Qe(f,U));if(S.length===0)return De("InvalidTag","Closing tag '"+q+"' has not been opened.",Qe(f,U));{let se=S.pop();if(q!==se.tagName){let Ye=Qe(f,se.tagStartPos);return De("InvalidTag","Expected closing tag '"+se.tagName+"' (opened in line "+Ye.line+", col "+Ye.col+") instead of closing tag '"+q+"'.",Qe(f,U))}S.length==0&&(A=!0)}}else return De("InvalidTag","Closing tag '"+q+"' doesn't have proper closing.",Qe(f,C));else{let se=Va(xe,b);if(se!==!0)return De(se.err.code,se.err.msg,Qe(f,C-xe.length+se.err.line));if(A===!0)return De("InvalidXml","Multiple possible root nodes found.",Qe(f,C));b.unpairedTags.indexOf(q)!==-1||S.push({tagName:q,tagStartPos:U}),O=!0}for(C++;C<f.length;C++)if(f[C]==="<")if(f[C+1]==="!"){C++,C=Ba(f,C);continue}else if(f[C+1]==="?"){if(C=Ga(f,++C),C.err)return C}else break;else if(f[C]==="&"){let se=eh(f,C);if(se==-1)return De("InvalidChar","char '&' is not expected.",Qe(f,C));C=se}else if(A===!0&&!Ha(f[C]))return De("InvalidXml","Extra text at the end",Qe(f,C));f[C]==="<"&&C--}}else{if(Ha(f[C]))continue;return De("InvalidChar","char '"+f[C]+"' is not expected.",Qe(f,C))}if(O){if(S.length==1)return De("InvalidTag","Unclosed tag '"+S[0].tagName+"'.",Qe(f,S[0].tagStartPos));if(S.length>0)return De("InvalidXml","Invalid '"+JSON.stringify(S.map(C=>C.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return De("InvalidXml","Start tag expected.",1);return!0}a(Qg,"validate"),r(Qg,"validate");function Ha(f){return f===" "||f===" "||f===`
316
- `||f==="\r"}a(Ha,"isWhiteSpace"),r(Ha,"isWhiteSpace");function Ga(f,b){let S=b;for(;b<f.length;b++)if(f[b]=="?"||f[b]==" "){let O=f.substr(S,b-S);if(b>5&&O==="xml")return De("InvalidXml","XML declaration allowed only at the start of the document.",Qe(f,b));if(f[b]=="?"&&f[b+1]==">"){b++;break}else continue}return b}a(Ga,"readPI"),r(Ga,"readPI");function Ba(f,b){if(f.length>b+5&&f[b+1]==="-"&&f[b+2]==="-"){for(b+=3;b<f.length;b++)if(f[b]==="-"&&f[b+1]==="-"&&f[b+2]===">"){b+=2;break}}else if(f.length>b+8&&f[b+1]==="D"&&f[b+2]==="O"&&f[b+3]==="C"&&f[b+4]==="T"&&f[b+5]==="Y"&&f[b+6]==="P"&&f[b+7]==="E"){let S=1;for(b+=8;b<f.length;b++)if(f[b]==="<")S++;else if(f[b]===">"&&(S--,S===0))break}else if(f.length>b+9&&f[b+1]==="["&&f[b+2]==="C"&&f[b+3]==="D"&&f[b+4]==="A"&&f[b+5]==="T"&&f[b+6]==="A"&&f[b+7]==="["){for(b+=8;b<f.length;b++)if(f[b]==="]"&&f[b+1]==="]"&&f[b+2]===">"){b+=2;break}}return b}a(Ba,"readCommentAndCDATA"),r(Ba,"readCommentAndCDATA");var DR='"',MR="'";function Yg(f,b){let S="",O="",A=!1;for(;b<f.length;b++){if(f[b]===DR||f[b]===MR)O===""?O=f[b]:O!==f[b]||(O="");else if(f[b]===">"&&O===""){A=!0;break}S+=f[b]}return O!==""?!1:{value:S,index:b,tagClosed:A}}a(Yg,"readAttributeStr"),r(Yg,"readAttributeStr");var UR=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Va(f,b){let S=d(f,UR),O={};for(let A=0;A<S.length;A++){if(S[A][1].length===0)return De("InvalidAttr","Attribute '"+S[A][2]+"' has no space in starting.",Mr(S[A]));if(S[A][3]!==void 0&&S[A][4]===void 0)return De("InvalidAttr","Attribute '"+S[A][2]+"' is without value.",Mr(S[A]));if(S[A][3]===void 0&&!b.allowBooleanAttributes)return De("InvalidAttr","boolean attribute '"+S[A][2]+"' is not allowed.",Mr(S[A]));let C=S[A][2];if(!th(C))return De("InvalidAttr","Attribute '"+C+"' is an invalid name.",Mr(S[A]));if(!O.hasOwnProperty(C))O[C]=1;else return De("InvalidAttr","Attribute '"+C+"' is repeated.",Mr(S[A]))}return!0}a(Va,"validateAttributeString"),r(Va,"validateAttributeString");function Xg(f,b){let S=/\d/;for(f[b]==="x"&&(b++,S=/[\da-fA-F]/);b<f.length;b++){if(f[b]===";")return b;if(!f[b].match(S))break}return-1}a(Xg,"validateNumberAmpersand"),r(Xg,"validateNumberAmpersand");function eh(f,b){if(b++,f[b]===";")return-1;if(f[b]==="#")return b++,Xg(f,b);let S=0;for(;b<f.length;b++,S++)if(!(f[b].match(/\w/)&&S<20)){if(f[b]===";")break;return-1}return b}a(eh,"validateAmpersand"),r(eh,"validateAmpersand");function De(f,b,S){return{err:{code:f,msg:b,line:S.line||S,col:S.col}}}a(De,"getErrorObject"),r(De,"getErrorObject");function th(f){return p(f)}a(th,"validateAttrName"),r(th,"validateAttrName");function L(f){return p(f)}a(L,"validateTagName"),r(L,"validateTagName");function Qe(f,b){let S=f.substring(0,b).split(/\r?\n/);return{line:S.length,col:S[S.length-1].length+1}}a(Qe,"getLineNumberForPosition"),r(Qe,"getLineNumberForPosition");function Mr(f){return f.startIndex+f[1].length}a(Mr,"getPositionFromMatch"),r(Mr,"getPositionFromMatch");var jR=class{static{a(this,"XMLParser")}static{r(this,"XMLParser")}constructor(f){this.externalEntities={},this.options=i(f)}parse(f,b){if(typeof f!="string"&&f.toString)f=f.toString();else if(typeof f!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(b){b===!0&&(b={});let A=Qg(f,b);if(A!==!0)throw Error(`${A.err.msg}:${A.err.line}:${A.err.col}`)}let S=new Te(this.options);S.addExternalEntities(this.externalEntities);let O=S.parseXml(f);return this.options.preserveOrder||O===void 0?O:Vg(O,this.options)}addEntity(f,b){if(b.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(f.indexOf("&")!==-1||f.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(b==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[f]=b}static getMetaDataSymbol(){return g.getMetaDataSymbol()}};return new jR(t)},"getXmlParser");var Hg=class extends or{static{a(this,"XmlToJsonOutboundPolicy")}parser;parseOnStatusCodes;constructor(e,r){super(e,r),I("policy.outbound.xml-to-json"),me(this.options,this.policyName).optional("removeNSPrefix","boolean").optional("ignoreProcessingInstructions","boolean").optional("ignoreDeclarations","boolean").optional("ignoreAttributes","boolean").optional("stopNodes","array").optional("attributeNamePrefix","string").optional("textNodeName","string").optional("trimValues","boolean"),this.parseOnStatusCodes=e.parseOnStatusCodes?Dt(e.parseOnStatusCodes):void 0,this.parser=kR({removeNSPrefix:e?.removeNSPrefix??!0,ignorePiTags:e?.ignoreProcessingInstructions??!0,ignoreDeclaration:e?.ignoreDeclarations??!0,ignoreAttributes:e?.ignoreAttributes??!0,stopNodes:e?.stopNodes??[],attributeNamePrefix:e?.attributeNamePrefix??"@_",textNodeName:e?.textNodeName??"#text",trimValues:e?.trimValues??!0})}async handler(e,r,o){if(this.parseOnStatusCodes&&!this.parseOnStatusCodes.includes(e.status))return e;let n;try{let u=await e.text();n=this.parser.parse(u)}catch(u){let c=`XmlToJsonOutboundPolicy - Error parsing XML contents in policy '${this.policyName}'.`;throw o.log.error(c,u),new z(c)}let i=new Headers(e.headers);return i.set("content-type","application/json"),new Response(JSON.stringify(n),{status:e.status,statusText:e.statusText,headers:i})}};var Gg=class{static{a(this,"ServiceProviderImpl")}services=new Map;addService(e,r){if(this.services.get(e))throw new ge(`A service with the name ${e} already exists -- you cannot have duplicate services`);this.services.set(e,r)}getService(e){return this.services.get(e)}};var Bg=class{static{a(this,"ApiKeyConsumerClient")}bucketId;cacheDurationSeconds;cacheNamePromise;constructor(e){this.bucketId=e?.bucketId,this.cacheDurationSeconds=e?.cacheDurationSeconds??60}getCacheName(e){return this.cacheNamePromise||(this.cacheNamePromise=we("zuplo-get-consumer",void 0,{bucketId:e})),this.cacheNamePromise}async get(e){I("utility.get-consumer");let r=Ey(),o=this.bucketId??ze.ZUPLO_SERVICE_BUCKET_ID;if(!o)throw new R("ApiKeyConsumerClient - no bucketId provided and ZUPLO_SERVICE_BUCKET_ID environment variable is not set");if(!e||e.trim()==="")throw new R("ApiKeyConsumerClient.get - consumerId is required and cannot be empty");let n=await this.getCacheName(o),i=new be(n,r);if(this.cacheDurationSeconds>0){let l=await i.get(e);if(l)return l}let s=`/v2/key-auth/${encodeURIComponent(o)}/consumers/${encodeURIComponent(e)}`,u=await Ya(s),c={id:u.id,name:u.name,createdOn:u.createdOn,updatedOn:u.updatedOn};return u.description!==void 0&&(c.description=u.description),u.metadata!==void 0&&(c.metadata=u.metadata),this.cacheDurationSeconds>0&&i.put(e,c,this.cacheDurationSeconds),c}};var ER=10,_R=3e4,ii=class{static{a(this,"BackgroundLoader")}#e=new Map;#t;#n;#r;#o;#i={};constructor(e,r){if(typeof r=="number"){let o=r;this.#n=o*1e3,this.#o=_R,this.#r=ER}else{let o=r;this.#n=o.ttlSeconds*1e3,this.#o=o.loaderTimeoutSeconds?o.loaderTimeoutSeconds*1e3:_R,this.#r=ER}this.#t=e}#s(e){return e.expiry<=new Date}#a(e){let r=this.#i[e];return!(r===void 0||r===0)}#c(e){let r=this.#e.get(e);if(r&&!this.#s(r))return r.data}async get(e){let r=this.#c(e);if(r)return this.#l(e),r;if(this.#a(e))try{await h$(()=>this.#c(e)!==void 0||!this.#a(e),this.#o+this.#r+1,this.#r);let o=this.#c(e);if(o)return o}catch{}return this.#u(e)}#l(e){if(!this.#a(e)){let r=this.#u(e);sr().waitUntil(r)}}async#u(e){try{this.#i[e]===void 0&&(this.#i[e]=0),this.#i[e]++;let r=await Promise.race([this.#t(e),scheduler.wait(this.#o)]);if(r===void 0)throw new R(`BackgroundLoader: Loader timed out after ${this.#o} ms.`);return this.#e.set(e,{data:r,expiry:new Date(Date.now()+this.#n)}),r}finally{this.#i[e]--}}};async function h$(t,e,r){let o=Date.now();for(;!t();){let n=Date.now()-o;if(n>e)throw new R(`BackgroundLoader: Timeout waiting for an on-going loader after ${n} ms.`);await scheduler.wait(r)}}a(h$,"waitUntilTrue");import{SpanStatusCode as OR,trace as CR}from"@opentelemetry/api";var $R=a(async(t,e,r)=>{let o=Re.instance.routeData.policies,n=Vn([t],o);if(n.length===0)throw new z(`Invalid 'invokeInboundPolicy call' - no policy '${t}' found.`);let i=n[0];return await CR.getTracer("pipeline").startActiveSpan(`policy:${i.policyName}`,async c=>{try{let l=await i.handler(e,r);if(l instanceof Request||l instanceof de||l instanceof Response)return l instanceof Response||l instanceof de?l:new de(l);{let d=new R(`Invalid state - invalid handler on policy '${i.policyName}' invoked via 'invokeInboundPolicy' on route '${r.route.path}'. The result of an inbound policy must be a Response or Request.`);throw c.setStatus({code:OR.ERROR}),c.recordException(d),d}}finally{c.end()}})},"invokeInboundPolicy"),AR=a(async(t,e,r,o)=>{let n=Re.instance.routeData.policies,i=Jn([t],n);if(i.length===0)throw new z(`Invalid 'invokeOutboundPolicy call' - no policy '${t}' found.`);let s=i[0];return await CR.getTracer("pipeline").startActiveSpan(`policy:${s.policyName}`,async l=>{try{let d=await s.handler(e,r,o);if(d instanceof Response)return d;{let p=new R(`Invalid state - invalid handler on policy '${s.policyName}' invoked via 'invokeOutboundPolicy' on route '${o.route.path}. The result of an outbound policy must be a Response.`);throw l.setStatus({code:OR.ERROR}),l.recordException(p),p}}finally{l.end()}})},"invokeOutboundPolicy");function y$(t){let e={};if(!t)return e;try{let r=t.split(","),o={};return r.forEach(n=>{let[i,s]=n.split("=");i&&s&&(o[i.trim()]=s.trim())}),o.asnum&&(e[wi]=o.asnum),o.zip&&(e[xi]=o.zip.split("+")[0]),o.dma&&(e[Ri]=o.dma),o.region_code&&(e[Pi]=o.region_code),o.timezone&&(e[Ii]=o.timezone),o.city&&(e[gi]=o.city),o.continent&&(e[hi]=o.continent),o.country_code&&(e[yi]=o.country_code),o.long&&(e[bi]=o.long),o.lat&&(e[vi]=o.lat),e}catch{return{}}}a(y$,"parseEdgeScapeHeader");function LR(t,e){let r=y$(e);for(let[o,n]of Object.entries(r))t.has(o)||t.set(o,n)}a(LR,"setZpHeadersFromAkamaiEdgeScapeHeader");var Qi=class{static{a(this,"HeaderIncomingRequestProperties")}#e;constructor(e){this.#e=e;let r=e.get(kh);if(r){let o=new Headers(e);LR(o,r),this.#e=o}}get asn(){try{let e=this.#e.get(wi);if(typeof e=="string")return parseInt(e,10)}catch{}}get asOrganization(){return this.#e.get(Rh)??void 0}get city(){return this.#e.get(ch)??this.#e.get(gi)??void 0}get continent(){return this.#e.get(lh)??this.#e.get(hi)??void 0}get country(){return this.#e.get(dh)??this.#e.get(yi)??void 0}get latitude(){return this.#e.get(mh)??this.#e.get(vi)??void 0}get longitude(){return this.#e.get(ph)??this.#e.get(bi)??void 0}get colo(){return this.#e.get(Ph)??void 0}get postalCode(){return this.#e.get(yh)??this.#e.get(xi)??void 0}get metroCode(){return this.#e.get(hh)??this.#e.get(Ri)??void 0}get region(){return this.#e.get(fh)??this.#e.get(Ih)??void 0}get regionCode(){return this.#e.get(gh)??this.#e.get(Pi)??void 0}get timezone(){return this.#e.get(bh)??this.#e.get(Ii)??void 0}get httpProtocol(){return this.#e.get(Sh)??void 0}get clientCert(){return this.#e.get(vh)??void 0}get clientMtlsVerificationStatus(){return this.#e.get(wh)??void 0}get clientMtlsVerificationReason(){return this.#e.get(xh)??void 0}toJSON(){return{asn:this.asn,asOrganization:this.asOrganization,city:this.city,continent:this.continent,country:this.country,latitude:this.latitude,longitude:this.longitude,colo:this.colo,postalCode:this.postalCode,metroCode:this.metroCode,region:this.region,regionCode:this.regionCode,timezone:this.timezone,httpProtocol:this.httpProtocol,clientCert:this.clientCert,clientMtlsVerificationStatus:this.clientMtlsVerificationStatus,clientMtlsVerificationReason:this.clientMtlsVerificationReason}}};function hr(t){return{contextId:t.contextId,incomingRequestProperties:t.incomingRequestProperties,requestId:t.requestId,route:t.route,custom:t.custom,parentContext:t.parentContext,analyticsContext:t.analyticsContext}}a(hr,"createRewriteContext");var Gn=class extends Event{static{a(this,"ResponseSendingEvent")}constructor(e,r){super("responseSending"),this.request=e,this.mutableResponse=r}request;mutableResponse},Bn=class extends Event{static{a(this,"ResponseSentEvent")}constructor(e,r){super("responseSent"),this.request=e,this.response=r}request;response},tt=class t{static{a(this,"ZuploContextExtensions")}static#e=new WeakMap;static initialize(e,r){if(!t.#e.has(e)){let o=new t(r);return t.#e.set(e,o),o}throw new Error(`ZuploContextExtensions already initialized for context with requestId '${e.requestId}'`)}static getContextExtensions(e){let r=t.#e.get(e);if(!r)throw new z(`Invalid state, could not get ZuploContext extensions for context with requestId '${e.requestId}'`);return r}latestRequest;#t;#n;#r;constructor(e){this.latestRequest=e,this.#t=[],this.#n=[],this.#r=[]}addResponseSendingHook(e){this.#n.push(e)}addResponseSendingFinalHook(e){this.#t.push(e)}addHandlerResponseHook(e){this.#r.push(e)}onResponseSendingFinal=a(async(e,r,o)=>{for(let n of this.#t)await n(e,r,o)},"onResponseSendingFinal");onResponseSending=a(async(e,r,o)=>{let n=e,i=T.instance.build.COMPATIBILITY_FLAGS.chainResponseSendingHooks;for(let s of this.#n)n=await s(i?n:e,r,o);return n},"onResponseSending");onHandlerResponse=a(async(e,r,o)=>{for(let n of this.#r)await n(e,r,o)},"onHandlerResponse")},Yi=class extends EventTarget{static{a(this,"SystemZuploContext")}constructor({logger:e,route:r,requestId:o,event:n,custom:i,incomingRequestProperties:s,parentContext:u}){super(),this.log=Object.freeze(e),this.route=r,this.requestId=o,this.custom=i,this.incomingRequestProperties=s,this.parentContext=u,this.#e=n,this.invokeInboundPolicy=(c,l)=>$R(c,l,this),this.contextId=crypto.randomUUID(),this.invokeOutboundPolicy=(c,l,d)=>AR(c,l,d,this),this.invokeRoute=async(c,l)=>{let d=c;typeof c=="string"&&c.startsWith("/")&&(d=new URL(c,"http://localhost"));let p=new de(d,l);return Re.instance.handleRequest(p,this,{parentContext:this})},this.waitUntil=c=>{this.#e.waitUntil(c)},this.addResponseSendingHook=c=>{tt.getContextExtensions(this).addResponseSendingHook(c)},this.addResponseSendingFinalHook=c=>{tt.getContextExtensions(this).addResponseSendingFinalHook(c)},this.analyticsContext=new $h(o),Object.freeze(this)}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;invokeInboundPolicy;invokeOutboundPolicy;invokeRoute;waitUntil;addResponseSendingHook;addResponseSendingFinalHook;addEventListener(e,r,o){I("context.addEventListener");let n=a(i=>{try{typeof r=="function"?r(i):r.handleEvent(i)}catch(s){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),s}},"wrapped");super.addEventListener(e,n,o)}removeEventListener(e,r,o){I("context.removeEventListener"),super.removeEventListener(e,r,o)}};export{I as a,Ae as b,Ya as c,Mn as d,be as e,ru as f,Un as g,jn as h,br as i,M as j,Me as k,vr as l,de as m,ou as n,iu as o,ae as p,ct as q,Ht as r,Se as s,or as t,pu as u,yu as v,Hr as w,Gn as x,Bn as y,pe as z,Fu as A,nt as B,oI as C,gI as D,hI as E,tb as F,II as G,Yu as H,fc as I,ft as J,Ys as K,om as L,yT as M,yv as N,bv as O,Rv as P,FT as Q,ra as R,Sm as S,VT as T,WT as U,ca as V,KT as W,Ov as X,$v as Y,Nv as Z,Mv as _,na as $,uk as aa,pk as ba,mk as ca,Am as da,h as ea,Ue as fa,bE as ga,wE as ha,RE as ia,PE as ja,SE as ka,kE as la,_E as ma,AE as na,tf as oa,nf as pa,sf as qa,cf as ra,df as sa,mf as ta,gf as ua,yf as va,wf as wa,Pf as xa,Tf as ya,_f as za,Cf as Aa,$f as Ba,ti as Ca,ri as Da,ni as Ea,Mf as Fa,si as Ga,zf as Ha,Zf as Ia,f_ as Ja,qf as Ka,Ff as La,y_ as Ma,v_ as Na,x_ as Oa,I_ as Pa,S_ as Qa,T_ as Ra,k_ as Sa,M_ as Ta,j_ as Ua,Yf as Va,z_ as Wa,Xf as Xa,F_ as Ya,ot as Za,Q_ as _a,og as $a,ig as ab,X_ as bb,ug as cb,lO as db,dO as eb,pO as fb,mO as gb,fO as hb,gO as ib,RO as jb,hg as kb,CO as lb,$O as mb,AO as nb,NO as ob,DO as pb,jO as qb,zO as rb,qO as sb,FO as tb,HO as ub,JO as vb,QO as wb,Rg as xb,oC as yb,Pg as zb,cC as Ab,Ig as Bb,Tg as Cb,lC as Db,pC as Eb,mC as Fb,_g as Gb,sR as Hb,vC as Ib,wC as Jb,xC as Kb,RC as Lb,PC as Mb,IC as Nb,fR as Ob,SC as Pb,TC as Qb,EC as Rb,LC as Sb,NC as Tb,DC as Ub,MC as Vb,UC as Wb,jC as Xb,ZC as Yb,Ng as Zb,QC as _b,YC as $b,e$ as ac,n$ as bc,pi as cc,Ug as dc,o$ as ec,s$ as fc,qg as gc,a$ as hc,g$ as ic,Hg as jc,Gg as kc,Bg as lc,ii as mc};
317
- /*! For license information please see chunk-UMZORQLU.js.LEGAL.txt */
318
- //# sourceMappingURL=chunk-UMZORQLU.js.map
316
+ `||f==="\r"}a(Ha,"isWhiteSpace"),r(Ha,"isWhiteSpace");function Ga(f,b){let S=b;for(;b<f.length;b++)if(f[b]=="?"||f[b]==" "){let O=f.substr(S,b-S);if(b>5&&O==="xml")return De("InvalidXml","XML declaration allowed only at the start of the document.",Qe(f,b));if(f[b]=="?"&&f[b+1]==">"){b++;break}else continue}return b}a(Ga,"readPI"),r(Ga,"readPI");function Ba(f,b){if(f.length>b+5&&f[b+1]==="-"&&f[b+2]==="-"){for(b+=3;b<f.length;b++)if(f[b]==="-"&&f[b+1]==="-"&&f[b+2]===">"){b+=2;break}}else if(f.length>b+8&&f[b+1]==="D"&&f[b+2]==="O"&&f[b+3]==="C"&&f[b+4]==="T"&&f[b+5]==="Y"&&f[b+6]==="P"&&f[b+7]==="E"){let S=1;for(b+=8;b<f.length;b++)if(f[b]==="<")S++;else if(f[b]===">"&&(S--,S===0))break}else if(f.length>b+9&&f[b+1]==="["&&f[b+2]==="C"&&f[b+3]==="D"&&f[b+4]==="A"&&f[b+5]==="T"&&f[b+6]==="A"&&f[b+7]==="["){for(b+=8;b<f.length;b++)if(f[b]==="]"&&f[b+1]==="]"&&f[b+2]===">"){b+=2;break}}return b}a(Ba,"readCommentAndCDATA"),r(Ba,"readCommentAndCDATA");var DR='"',MR="'";function Yg(f,b){let S="",O="",A=!1;for(;b<f.length;b++){if(f[b]===DR||f[b]===MR)O===""?O=f[b]:O!==f[b]||(O="");else if(f[b]===">"&&O===""){A=!0;break}S+=f[b]}return O!==""?!1:{value:S,index:b,tagClosed:A}}a(Yg,"readAttributeStr"),r(Yg,"readAttributeStr");var UR=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Va(f,b){let S=d(f,UR),O={};for(let A=0;A<S.length;A++){if(S[A][1].length===0)return De("InvalidAttr","Attribute '"+S[A][2]+"' has no space in starting.",Mr(S[A]));if(S[A][3]!==void 0&&S[A][4]===void 0)return De("InvalidAttr","Attribute '"+S[A][2]+"' is without value.",Mr(S[A]));if(S[A][3]===void 0&&!b.allowBooleanAttributes)return De("InvalidAttr","boolean attribute '"+S[A][2]+"' is not allowed.",Mr(S[A]));let C=S[A][2];if(!th(C))return De("InvalidAttr","Attribute '"+C+"' is an invalid name.",Mr(S[A]));if(!O.hasOwnProperty(C))O[C]=1;else return De("InvalidAttr","Attribute '"+C+"' is repeated.",Mr(S[A]))}return!0}a(Va,"validateAttributeString"),r(Va,"validateAttributeString");function Xg(f,b){let S=/\d/;for(f[b]==="x"&&(b++,S=/[\da-fA-F]/);b<f.length;b++){if(f[b]===";")return b;if(!f[b].match(S))break}return-1}a(Xg,"validateNumberAmpersand"),r(Xg,"validateNumberAmpersand");function eh(f,b){if(b++,f[b]===";")return-1;if(f[b]==="#")return b++,Xg(f,b);let S=0;for(;b<f.length;b++,S++)if(!(f[b].match(/\w/)&&S<20)){if(f[b]===";")break;return-1}return b}a(eh,"validateAmpersand"),r(eh,"validateAmpersand");function De(f,b,S){return{err:{code:f,msg:b,line:S.line||S,col:S.col}}}a(De,"getErrorObject"),r(De,"getErrorObject");function th(f){return p(f)}a(th,"validateAttrName"),r(th,"validateAttrName");function L(f){return p(f)}a(L,"validateTagName"),r(L,"validateTagName");function Qe(f,b){let S=f.substring(0,b).split(/\r?\n/);return{line:S.length,col:S[S.length-1].length+1}}a(Qe,"getLineNumberForPosition"),r(Qe,"getLineNumberForPosition");function Mr(f){return f.startIndex+f[1].length}a(Mr,"getPositionFromMatch"),r(Mr,"getPositionFromMatch");var jR=class{static{a(this,"XMLParser")}static{r(this,"XMLParser")}constructor(f){this.externalEntities={},this.options=i(f)}parse(f,b){if(typeof f!="string"&&f.toString)f=f.toString();else if(typeof f!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(b){b===!0&&(b={});let A=Qg(f,b);if(A!==!0)throw Error(`${A.err.msg}:${A.err.line}:${A.err.col}`)}let S=new Te(this.options);S.addExternalEntities(this.externalEntities);let O=S.parseXml(f);return this.options.preserveOrder||O===void 0?O:Vg(O,this.options)}addEntity(f,b){if(b.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(f.indexOf("&")!==-1||f.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(b==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[f]=b}static getMetaDataSymbol(){return g.getMetaDataSymbol()}};return new jR(t)},"getXmlParser");var Hg=class extends or{static{a(this,"XmlToJsonOutboundPolicy")}parser;parseOnStatusCodes;constructor(e,r){super(e,r),I("policy.outbound.xml-to-json"),me(this.options,this.policyName).optional("removeNSPrefix","boolean").optional("ignoreProcessingInstructions","boolean").optional("ignoreDeclarations","boolean").optional("ignoreAttributes","boolean").optional("stopNodes","array").optional("attributeNamePrefix","string").optional("textNodeName","string").optional("trimValues","boolean"),this.parseOnStatusCodes=e.parseOnStatusCodes?Dt(e.parseOnStatusCodes):void 0,this.parser=kR({removeNSPrefix:e?.removeNSPrefix??!0,ignorePiTags:e?.ignoreProcessingInstructions??!0,ignoreDeclaration:e?.ignoreDeclarations??!0,ignoreAttributes:e?.ignoreAttributes??!0,stopNodes:e?.stopNodes??[],attributeNamePrefix:e?.attributeNamePrefix??"@_",textNodeName:e?.textNodeName??"#text",trimValues:e?.trimValues??!0})}async handler(e,r,o){if(this.parseOnStatusCodes&&!this.parseOnStatusCodes.includes(e.status))return e;let n;try{let u=await e.text();n=this.parser.parse(u)}catch(u){let c=`XmlToJsonOutboundPolicy - Error parsing XML contents in policy '${this.policyName}'.`;throw o.log.error(c,u),new z(c)}let i=new Headers(e.headers);return i.set("content-type","application/json"),new Response(JSON.stringify(n),{status:e.status,statusText:e.statusText,headers:i})}};var Gg=class{static{a(this,"ServiceProviderImpl")}services=new Map;addService(e,r){if(this.services.get(e))throw new ge(`A service with the name ${e} already exists -- you cannot have duplicate services`);this.services.set(e,r)}getService(e){return this.services.get(e)}};var Bg=class{static{a(this,"ApiKeyConsumerClient")}bucketId;cacheDurationSeconds;cacheNamePromise;constructor(e){this.bucketId=e?.bucketId,this.cacheDurationSeconds=e?.cacheDurationSeconds??60}getCacheName(e){return this.cacheNamePromise||(this.cacheNamePromise=we("zuplo-get-consumer",void 0,{bucketId:e})),this.cacheNamePromise}async get(e){I("utility.get-consumer");let r=Ey(),o=this.bucketId??ze.ZUPLO_SERVICE_BUCKET_ID;if(!o)throw new R("ApiKeyConsumerClient - no bucketId provided and no default bucket is configured for this environment. Pass `bucketId` explicitly (find it in the Zuplo portal under Settings > API Key Buckets).");if(!o.startsWith("bckt_"))throw new R(`ApiKeyConsumerClient - bucketId "${o}" is not a valid bucket id. Bucket ids start with "bckt_" (e.g. "bckt_2HaK3odRyJle6NJSu8mzNKBC30BYxllxL"); a bucket name (e.g. "zprj-...-working-copy") is not accepted here. Find the bucket id in the Zuplo portal under Settings > API Key Buckets.`);if(!e||e.trim()==="")throw new R("ApiKeyConsumerClient.get - consumerId is required and cannot be empty");let n=await this.getCacheName(o),i=new be(n,r);if(this.cacheDurationSeconds>0){let l=await i.get(e);if(l)return l}let s=`/v2/key-auth/${encodeURIComponent(o)}/consumers/${encodeURIComponent(e)}`,u=await Ya(s),c={id:u.id,name:u.name,createdOn:u.createdOn,updatedOn:u.updatedOn};return u.description!==void 0&&(c.description=u.description),u.metadata!==void 0&&(c.metadata=u.metadata),this.cacheDurationSeconds>0&&i.put(e,c,this.cacheDurationSeconds),c}};var ER=10,_R=3e4,ii=class{static{a(this,"BackgroundLoader")}#e=new Map;#t;#n;#r;#o;#i={};constructor(e,r){if(typeof r=="number"){let o=r;this.#n=o*1e3,this.#o=_R,this.#r=ER}else{let o=r;this.#n=o.ttlSeconds*1e3,this.#o=o.loaderTimeoutSeconds?o.loaderTimeoutSeconds*1e3:_R,this.#r=ER}this.#t=e}#s(e){return e.expiry<=new Date}#a(e){let r=this.#i[e];return!(r===void 0||r===0)}#c(e){let r=this.#e.get(e);if(r&&!this.#s(r))return r.data}async get(e){let r=this.#c(e);if(r)return this.#l(e),r;if(this.#a(e))try{await h$(()=>this.#c(e)!==void 0||!this.#a(e),this.#o+this.#r+1,this.#r);let o=this.#c(e);if(o)return o}catch{}return this.#u(e)}#l(e){if(!this.#a(e)){let r=this.#u(e);sr().waitUntil(r)}}async#u(e){try{this.#i[e]===void 0&&(this.#i[e]=0),this.#i[e]++;let r=await Promise.race([this.#t(e),scheduler.wait(this.#o)]);if(r===void 0)throw new R(`BackgroundLoader: Loader timed out after ${this.#o} ms.`);return this.#e.set(e,{data:r,expiry:new Date(Date.now()+this.#n)}),r}finally{this.#i[e]--}}};async function h$(t,e,r){let o=Date.now();for(;!t();){let n=Date.now()-o;if(n>e)throw new R(`BackgroundLoader: Timeout waiting for an on-going loader after ${n} ms.`);await scheduler.wait(r)}}a(h$,"waitUntilTrue");import{SpanStatusCode as OR,trace as CR}from"@opentelemetry/api";var $R=a(async(t,e,r)=>{let o=Re.instance.routeData.policies,n=Vn([t],o);if(n.length===0)throw new z(`Invalid 'invokeInboundPolicy call' - no policy '${t}' found.`);let i=n[0];return await CR.getTracer("pipeline").startActiveSpan(`policy:${i.policyName}`,async c=>{try{let l=await i.handler(e,r);if(l instanceof Request||l instanceof de||l instanceof Response)return l instanceof Response||l instanceof de?l:new de(l);{let d=new R(`Invalid state - invalid handler on policy '${i.policyName}' invoked via 'invokeInboundPolicy' on route '${r.route.path}'. The result of an inbound policy must be a Response or Request.`);throw c.setStatus({code:OR.ERROR}),c.recordException(d),d}}finally{c.end()}})},"invokeInboundPolicy"),AR=a(async(t,e,r,o)=>{let n=Re.instance.routeData.policies,i=Jn([t],n);if(i.length===0)throw new z(`Invalid 'invokeOutboundPolicy call' - no policy '${t}' found.`);let s=i[0];return await CR.getTracer("pipeline").startActiveSpan(`policy:${s.policyName}`,async l=>{try{let d=await s.handler(e,r,o);if(d instanceof Response)return d;{let p=new R(`Invalid state - invalid handler on policy '${s.policyName}' invoked via 'invokeOutboundPolicy' on route '${o.route.path}. The result of an outbound policy must be a Response.`);throw l.setStatus({code:OR.ERROR}),l.recordException(p),p}}finally{l.end()}})},"invokeOutboundPolicy");function y$(t){let e={};if(!t)return e;try{let r=t.split(","),o={};return r.forEach(n=>{let[i,s]=n.split("=");i&&s&&(o[i.trim()]=s.trim())}),o.asnum&&(e[wi]=o.asnum),o.zip&&(e[xi]=o.zip.split("+")[0]),o.dma&&(e[Ri]=o.dma),o.region_code&&(e[Pi]=o.region_code),o.timezone&&(e[Ii]=o.timezone),o.city&&(e[gi]=o.city),o.continent&&(e[hi]=o.continent),o.country_code&&(e[yi]=o.country_code),o.long&&(e[bi]=o.long),o.lat&&(e[vi]=o.lat),e}catch{return{}}}a(y$,"parseEdgeScapeHeader");function LR(t,e){let r=y$(e);for(let[o,n]of Object.entries(r))t.has(o)||t.set(o,n)}a(LR,"setZpHeadersFromAkamaiEdgeScapeHeader");var Qi=class{static{a(this,"HeaderIncomingRequestProperties")}#e;constructor(e){this.#e=e;let r=e.get(kh);if(r){let o=new Headers(e);LR(o,r),this.#e=o}}get asn(){try{let e=this.#e.get(wi);if(typeof e=="string")return parseInt(e,10)}catch{}}get asOrganization(){return this.#e.get(Rh)??void 0}get city(){return this.#e.get(ch)??this.#e.get(gi)??void 0}get continent(){return this.#e.get(lh)??this.#e.get(hi)??void 0}get country(){return this.#e.get(dh)??this.#e.get(yi)??void 0}get latitude(){return this.#e.get(mh)??this.#e.get(vi)??void 0}get longitude(){return this.#e.get(ph)??this.#e.get(bi)??void 0}get colo(){return this.#e.get(Ph)??void 0}get postalCode(){return this.#e.get(yh)??this.#e.get(xi)??void 0}get metroCode(){return this.#e.get(hh)??this.#e.get(Ri)??void 0}get region(){return this.#e.get(fh)??this.#e.get(Ih)??void 0}get regionCode(){return this.#e.get(gh)??this.#e.get(Pi)??void 0}get timezone(){return this.#e.get(bh)??this.#e.get(Ii)??void 0}get httpProtocol(){return this.#e.get(Sh)??void 0}get clientCert(){return this.#e.get(vh)??void 0}get clientMtlsVerificationStatus(){return this.#e.get(wh)??void 0}get clientMtlsVerificationReason(){return this.#e.get(xh)??void 0}toJSON(){return{asn:this.asn,asOrganization:this.asOrganization,city:this.city,continent:this.continent,country:this.country,latitude:this.latitude,longitude:this.longitude,colo:this.colo,postalCode:this.postalCode,metroCode:this.metroCode,region:this.region,regionCode:this.regionCode,timezone:this.timezone,httpProtocol:this.httpProtocol,clientCert:this.clientCert,clientMtlsVerificationStatus:this.clientMtlsVerificationStatus,clientMtlsVerificationReason:this.clientMtlsVerificationReason}}};function hr(t){return{contextId:t.contextId,incomingRequestProperties:t.incomingRequestProperties,requestId:t.requestId,route:t.route,custom:t.custom,parentContext:t.parentContext,analyticsContext:t.analyticsContext}}a(hr,"createRewriteContext");var Gn=class extends Event{static{a(this,"ResponseSendingEvent")}constructor(e,r){super("responseSending"),this.request=e,this.mutableResponse=r}request;mutableResponse},Bn=class extends Event{static{a(this,"ResponseSentEvent")}constructor(e,r){super("responseSent"),this.request=e,this.response=r}request;response},tt=class t{static{a(this,"ZuploContextExtensions")}static#e=new WeakMap;static initialize(e,r){if(!t.#e.has(e)){let o=new t(r);return t.#e.set(e,o),o}throw new Error(`ZuploContextExtensions already initialized for context with requestId '${e.requestId}'`)}static getContextExtensions(e){let r=t.#e.get(e);if(!r)throw new z(`Invalid state, could not get ZuploContext extensions for context with requestId '${e.requestId}'`);return r}latestRequest;#t;#n;#r;constructor(e){this.latestRequest=e,this.#t=[],this.#n=[],this.#r=[]}addResponseSendingHook(e){this.#n.push(e)}addResponseSendingFinalHook(e){this.#t.push(e)}addHandlerResponseHook(e){this.#r.push(e)}onResponseSendingFinal=a(async(e,r,o)=>{for(let n of this.#t)await n(e,r,o)},"onResponseSendingFinal");onResponseSending=a(async(e,r,o)=>{let n=e,i=T.instance.build.COMPATIBILITY_FLAGS.chainResponseSendingHooks;for(let s of this.#n)n=await s(i?n:e,r,o);return n},"onResponseSending");onHandlerResponse=a(async(e,r,o)=>{for(let n of this.#r)await n(e,r,o)},"onHandlerResponse")},Yi=class extends EventTarget{static{a(this,"SystemZuploContext")}constructor({logger:e,route:r,requestId:o,event:n,custom:i,incomingRequestProperties:s,parentContext:u}){super(),this.log=Object.freeze(e),this.route=r,this.requestId=o,this.custom=i,this.incomingRequestProperties=s,this.parentContext=u,this.#e=n,this.invokeInboundPolicy=(c,l)=>$R(c,l,this),this.contextId=crypto.randomUUID(),this.invokeOutboundPolicy=(c,l,d)=>AR(c,l,d,this),this.invokeRoute=async(c,l)=>{let d=c;typeof c=="string"&&c.startsWith("/")&&(d=new URL(c,"http://localhost"));let p=new de(d,l);return Re.instance.handleRequest(p,this,{parentContext:this})},this.waitUntil=c=>{this.#e.waitUntil(c)},this.addResponseSendingHook=c=>{tt.getContextExtensions(this).addResponseSendingHook(c)},this.addResponseSendingFinalHook=c=>{tt.getContextExtensions(this).addResponseSendingFinalHook(c)},this.analyticsContext=new $h(o),Object.freeze(this)}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;invokeInboundPolicy;invokeOutboundPolicy;invokeRoute;waitUntil;addResponseSendingHook;addResponseSendingFinalHook;addEventListener(e,r,o){I("context.addEventListener");let n=a(i=>{try{typeof r=="function"?r(i):r.handleEvent(i)}catch(s){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),s}},"wrapped");super.addEventListener(e,n,o)}removeEventListener(e,r,o){I("context.removeEventListener"),super.removeEventListener(e,r,o)}};export{I as a,Ae as b,Ya as c,Mn as d,be as e,ru as f,Un as g,jn as h,br as i,M as j,Me as k,vr as l,de as m,ou as n,iu as o,ae as p,ct as q,Ht as r,Se as s,or as t,pu as u,yu as v,Hr as w,Gn as x,Bn as y,pe as z,Fu as A,nt as B,oI as C,gI as D,hI as E,tb as F,II as G,Yu as H,fc as I,ft as J,Ys as K,om as L,yT as M,yv as N,bv as O,Rv as P,FT as Q,ra as R,Sm as S,VT as T,WT as U,ca as V,KT as W,Ov as X,$v as Y,Nv as Z,Mv as _,na as $,uk as aa,pk as ba,mk as ca,Am as da,h as ea,Ue as fa,bE as ga,wE as ha,RE as ia,PE as ja,SE as ka,kE as la,_E as ma,AE as na,tf as oa,nf as pa,sf as qa,cf as ra,df as sa,mf as ta,gf as ua,yf as va,wf as wa,Pf as xa,Tf as ya,_f as za,Cf as Aa,$f as Ba,ti as Ca,ri as Da,ni as Ea,Mf as Fa,si as Ga,zf as Ha,Zf as Ia,f_ as Ja,qf as Ka,Ff as La,y_ as Ma,v_ as Na,x_ as Oa,I_ as Pa,S_ as Qa,T_ as Ra,k_ as Sa,M_ as Ta,j_ as Ua,Yf as Va,z_ as Wa,Xf as Xa,F_ as Ya,ot as Za,Q_ as _a,og as $a,ig as ab,X_ as bb,ug as cb,lO as db,dO as eb,pO as fb,mO as gb,fO as hb,gO as ib,RO as jb,hg as kb,CO as lb,$O as mb,AO as nb,NO as ob,DO as pb,jO as qb,zO as rb,qO as sb,FO as tb,HO as ub,JO as vb,QO as wb,Rg as xb,oC as yb,Pg as zb,cC as Ab,Ig as Bb,Tg as Cb,lC as Db,pC as Eb,mC as Fb,_g as Gb,sR as Hb,vC as Ib,wC as Jb,xC as Kb,RC as Lb,PC as Mb,IC as Nb,fR as Ob,SC as Pb,TC as Qb,EC as Rb,LC as Sb,NC as Tb,DC as Ub,MC as Vb,UC as Wb,jC as Xb,ZC as Yb,Ng as Zb,QC as _b,YC as $b,e$ as ac,n$ as bc,pi as cc,Ug as dc,o$ as ec,s$ as fc,qg as gc,a$ as hc,g$ as ic,Hg as jc,Gg as kc,Bg as lc,ii as mc};
317
+ /*! For license information please see chunk-RQLHORT4.js.LEGAL.txt */
318
+ //# sourceMappingURL=chunk-RQLHORT4.js.map