@mavenagi/apps 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/next.js +0 -1
package/package.json
CHANGED
package/dist/next.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const compiledUserWorkerEntrypointScript=`var Br=Object.defineProperty;var eo=(e,r,t)=>r in e?Br(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ro=(e,r)=>{for(var t in r)Br(e,t,{get:r[t],enumerable:!0})};var j=(e,r,t)=>(eo(e,typeof r!="symbol"?r+"":r,t),t);var X=new TextEncoder,B=new TextDecoder,Oa=2**32;function Wr(...e){let r=e.reduce((o,{length:a})=>o+a,0),t=new Uint8Array(r),n=0;for(let o of e)t.set(o,n),n+=o.length;return t}function Jr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t}function L(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:B.decode(e),{alphabet:"base64url"});let r=e;r instanceof Uint8Array&&(r=B.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return Jr(r)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var P=class extends Error{code="ERR_JOSE_GENERIC";constructor(r,t){super(r,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};j(P,"code","ERR_JOSE_GENERIC");var T=class extends P{code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(r,t,n="unspecified",o="unspecified"){super(r,{cause:{claim:n,reason:o,payload:t}}),this.claim=n,this.reason=o,this.payload=t}};j(T,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Z=class extends P{code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(r,t,n="unspecified",o="unspecified"){super(r,{cause:{claim:n,reason:o,payload:t}}),this.claim=n,this.reason=o,this.payload=t}};j(Z,"code","ERR_JWT_EXPIRED");var se=class extends P{code="ERR_JOSE_ALG_NOT_ALLOWED"};j(se,"code","ERR_JOSE_ALG_NOT_ALLOWED");var A=class extends P{code="ERR_JOSE_NOT_SUPPORTED"};j(A,"code","ERR_JOSE_NOT_SUPPORTED");var S=class extends P{code="ERR_JWS_INVALID"};j(S,"code","ERR_JWS_INVALID");var G=class extends P{code="ERR_JWT_INVALID"};j(G,"code","ERR_JWT_INVALID");var Q=class extends P{code="ERR_JWKS_INVALID"};j(Q,"code","ERR_JWKS_INVALID");var \$=class extends P{code="ERR_JWKS_NO_MATCHING_KEY";constructor(r="no applicable key found in the JSON Web Key Set",t){super(r,t)}};j(\$,"code","ERR_JWKS_NO_MATCHING_KEY");var ce=class extends P{[Symbol.asyncIterator];code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(r="multiple matching keys found in the JSON Web Key Set",t){super(r,t)}};j(ce,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var ue=class extends P{code="ERR_JWKS_TIMEOUT";constructor(r="request timed out",t){super(r,t)}};j(ue,"code","ERR_JWKS_TIMEOUT");var fe=class extends P{code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(r="signature verification failed",t){super(r,t)}};j(fe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function W(e,r="algorithm.name"){return new TypeError(\`CryptoKey does not support this operation, its \${r} must be \${e}\`)}function le(e,r){return e.name===r}function Ye(e){return parseInt(e.name.slice(4),10)}function oo(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function io(e,r){if(r&&!e.usages.includes(r))throw new TypeError(\`CryptoKey does not support this operation, its usages must include \${r}.\`)}function Lr(e,r,t){switch(r){case"HS256":case"HS384":case"HS512":{if(!le(e.algorithm,"HMAC"))throw W("HMAC");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!le(e.algorithm,"RSASSA-PKCS1-v1_5"))throw W("RSASSA-PKCS1-v1_5");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!le(e.algorithm,"RSA-PSS"))throw W("RSA-PSS");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!le(e.algorithm,"Ed25519"))throw W("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!le(e.algorithm,"ECDSA"))throw W("ECDSA");let n=oo(r);if(e.algorithm.namedCurve!==n)throw W(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}io(e,t)}function Vr(e,r,...t){if(t=t.filter(Boolean),t.length>2){let n=t.pop();e+=\`one of type \${t.join(", ")}, or \${n}.\`}else t.length===2?e+=\`one of type \${t[0]} or \${t[1]}.\`:e+=\`of type \${t[0]}.\`;return r==null?e+=\` Received \${r}\`:typeof r=="function"&&r.name?e+=\` Received function \${r.name}\`:typeof r=="object"&&r!=null&&r.constructor?.name&&(e+=\` Received an instance of \${r.constructor.name}\`),e}var Hr=(e,...r)=>Vr("Key must be ",e,...r);function Xe(e,r,...t){return Vr(\`Key for the \${e} algorithm must be \`,r,...t)}function Ze(e){return e?.[Symbol.toStringTag]==="CryptoKey"}function Qe(e){return e?.[Symbol.toStringTag]==="KeyObject"}var er=e=>Ze(e)||Qe(e);var Fr=(...e)=>{let r=e.filter(Boolean);if(r.length===0||r.length===1)return!0;let t;for(let n of r){let o=Object.keys(n);if(!t||t.size===0){t=new Set(o);continue}for(let a of o){if(t.has(a))return!1;t.add(a)}}return!0};function ao(e){return typeof e=="object"&&e!==null}var z=e=>{if(!ao(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r};var Gr=(e,r)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:t}=r.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(\`\${e} requires key modulusLength to be 2048 bits or larger\`)}};function so(e){let r,t;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:\`SHA-\${parseInt(e.alg.slice(-3),10)||1}\`},t=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":r={name:"ECDSA",namedCurve:"P-256"},t=e.d?["sign"]:["verify"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},t=e.d?["sign"]:["verify"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new A('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:t}}var Pe=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:t}=so(e),n={...e};return delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,r,e.ext??!e.d,e.key_ops??t)};async function \$r(e,r,t){if(!z(e))throw new TypeError("JWK must be an object");let n;switch(r??=e.alg,n??=t?.extractable??e.ext,e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return L(e.k);case"RSA":if("oth"in e&&e.oth!==void 0)throw new A('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return Pe({...e,alg:r,ext:n});default:throw new A('Unsupported "kty" (Key Type) Parameter value')}}var qr=(e,r,t,n,o)=>{if(o.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(c=>typeof c!="string"||c.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;t!==void 0?a=new Map([...Object.entries(t),...r.entries()]):a=r;for(let c of n.crit){if(!a.has(c))throw new A(\`Extension Header Parameter "\${c}" is not recognized\`);if(o[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" is missing\`);if(a.get(c)&&n[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" MUST be integrity protected\`)}return new Set(n.crit)};var Yr=(e,r)=>{if(r!==void 0&&(!Array.isArray(r)||r.some(t=>typeof t!="string")))throw new TypeError(\`"\${e}" option must be an array of strings\`);if(r)return new Set(r)};function pe(e){return z(e)&&typeof e.kty=="string"}function Xr(e){return e.kty!=="oct"&&typeof e.d=="string"}function Zr(e){return e.kty!=="oct"&&typeof e.d>"u"}function Qr(e){return e.kty==="oct"&&typeof e.k=="string"}var ee,et=async(e,r,t,n=!1)=>{ee||=new WeakMap;let o=ee.get(e);if(o?.[t])return o[t];let a=await Pe({...r,alg:t});return n&&Object.freeze(e),o?o[t]=a:ee.set(e,{[t]:a}),a},uo=(e,r)=>{ee||=new WeakMap;let t=ee.get(e);if(t?.[r])return t[r];let n=e.type==="public",o=!!n,a;if(e.asymmetricKeyType==="x25519"){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}a=e.toCryptoKey(e.asymmetricKeyType,o,n?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(r!=="EdDSA"&&r!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");a=e.toCryptoKey(e.asymmetricKeyType,o,[n?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let c;switch(r){case"RSA-OAEP":c="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":c="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":c="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":c="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(r.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:c},o,n?["encrypt"]:["decrypt"]);a=e.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:c},o,[n?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){let s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");r==="ES256"&&s==="P-256"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r==="ES384"&&s==="P-384"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r==="ES512"&&s==="P-521"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(a=e.toCryptoKey({name:"ECDH",namedCurve:s},o,n?[]:["deriveBits"]))}if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return t?t[r]=a:ee.set(e,{[r]:a}),a},rt=async(e,r)=>{if(e instanceof Uint8Array||Ze(e))return e;if(Qe(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return uo(e,r)}catch(n){if(n instanceof TypeError)throw n}let t=e.export({format:"jwk"});return et(e,t,r)}if(pe(e))return e.k?L(e.k):et(e,e,r,!0);throw new Error("unreachable")};var re=e=>e?.[Symbol.toStringTag],rr=(e,r,t)=>{if(r.use!==void 0){let n;switch(t){case"sign":case"verify":n="sig";break;case"encrypt":case"decrypt":n="enc";break}if(r.use!==n)throw new TypeError(\`Invalid key for this operation, its "use" must be "\${n}" when present\`)}if(r.alg!==void 0&&r.alg!==e)throw new TypeError(\`Invalid key for this operation, its "alg" must be "\${e}" when present\`);if(Array.isArray(r.key_ops)){let n;switch(!0){case(t==="sign"||t==="verify"):case e==="dir":case e.includes("CBC-HS"):n=t;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\\d{3}(?:GCM)?(?:KW)?\$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?n=t==="encrypt"?"wrapKey":"unwrapKey":n=t;break;case(t==="encrypt"&&e.startsWith("RSA")):n="wrapKey";break;case t==="decrypt":n=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(n&&r.key_ops?.includes?.(n)===!1)throw new TypeError(\`Invalid key for this operation, its "key_ops" must include "\${n}" when present\`)}return!0},fo=(e,r,t)=>{if(!(r instanceof Uint8Array)){if(pe(r)){if(Qr(r)&&rr(e,r,t))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!er(r))throw new TypeError(Xe(e,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(r.type!=="secret")throw new TypeError(\`\${re(r)} instances for symmetric algorithms must be of type "secret"\`)}},lo=(e,r,t)=>{if(pe(r))switch(t){case"decrypt":case"sign":if(Xr(r)&&rr(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Zr(r)&&rr(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!er(r))throw new TypeError(Xe(e,r,"CryptoKey","KeyObject","JSON Web Key"));if(r.type==="secret")throw new TypeError(\`\${re(r)} instances for asymmetric algorithms must not be of type "secret"\`);if(r.type==="public")switch(t){case"sign":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm signing must be of type "private"\`);case"decrypt":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm decryption must be of type "private"\`);default:break}if(r.type==="private")switch(t){case"verify":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm verifying must be of type "public"\`);case"encrypt":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm encryption must be of type "public"\`);default:break}},tt=(e,r,t)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?\$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)\$/.test(e)?fo(e,r,t):lo(e,r,t)};var nt=(e,r)=>{let t=\`SHA-\${e.slice(-3)}\`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:r.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new A(\`alg \${e} is not supported either by JOSE or your javascript runtime\`)}};var ot=async(e,r,t)=>{if(r instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Hr(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:\`SHA-\${e.slice(-3)}\`,name:"HMAC"},!1,[t])}return Lr(r,e,t),r};var it=async(e,r,t,n)=>{let o=await ot(e,r,"verify");Gr(e,o);let a=nt(e,o.algorithm);try{return await crypto.subtle.verify(a,o,t,n)}catch{return!1}};async function at(e,r,t){if(!z(e))throw new S("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new S('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new S("JWS Protected Header incorrect type");if(e.payload===void 0)throw new S("JWS Payload missing");if(typeof e.signature!="string")throw new S("JWS Signature missing or incorrect type");if(e.header!==void 0&&!z(e.header))throw new S("JWS Unprotected Header incorrect type");let n={};if(e.protected)try{let O=L(e.protected);n=JSON.parse(B.decode(O))}catch{throw new S("JWS Protected Header is invalid")}if(!Fr(n,e.header))throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...n,...e.header},a=qr(S,new Map([["b64",!0]]),t?.crit,n,o),c=!0;if(a.has("b64")&&(c=n.b64,typeof c!="boolean"))throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=o;if(typeof s!="string"||!s)throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');let l=t&&Yr("algorithms",t.algorithms);if(l&&!l.has(s))throw new se('"alg" (Algorithm) Header Parameter value not allowed');if(c){if(typeof e.payload!="string")throw new S("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new S("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof r=="function"&&(r=await r(n,e),f=!0),tt(s,r,"verify");let p=Wr(X.encode(e.protected??""),X.encode("."),typeof e.payload=="string"?X.encode(e.payload):e.payload),d;try{d=L(e.signature)}catch{throw new S("Failed to base64url decode the signature")}let _=await rt(r,s);if(!await it(s,_,d,p))throw new fe;let y;if(c)try{y=L(e.payload)}catch{throw new S("Failed to base64url decode the payload")}else typeof e.payload=="string"?y=X.encode(e.payload):y=e.payload;let g={payload:y};return e.protected!==void 0&&(g.protectedHeader=n),e.header!==void 0&&(g.unprotectedHeader=e.header),f?{...g,key:_}:g}async function st(e,r,t){if(e instanceof Uint8Array&&(e=B.decode(e)),typeof e!="string")throw new S("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:a,length:c}=e.split(".");if(c!==3)throw new S("Invalid Compact JWS");let s=await at({payload:o,protected:n,signature:a},r,t),l={payload:s.payload,protectedHeader:s.protectedHeader};return typeof r=="function"?{...l,key:s.key}:l}var ct=e=>Math.floor(e.getTime()/1e3);var po=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?\$/i,tr=e=>{let r=po.exec(e);if(!r||r[4]&&r[1])throw new TypeError("Invalid time period format");let t=parseFloat(r[2]),n=r[3].toLowerCase(),o;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(t*3600);break;case"day":case"days":case"d":o=Math.round(t*86400);break;case"week":case"weeks":case"w":o=Math.round(t*604800);break;default:o=Math.round(t*31557600);break}return r[1]==="-"||r[4]==="ago"?-o:o};var ut=e=>e.toLowerCase().replace(/^application\\//,""),mo=(e,r)=>typeof e=="string"?r.includes(e):Array.isArray(e)?r.some(Set.prototype.has.bind(new Set(e))):!1,ft=(e,r,t={})=>{let n;try{n=JSON.parse(B.decode(r))}catch{}if(!z(n))throw new G("JWT Claims Set must be a top-level JSON object");let{typ:o}=t;if(o&&(typeof e.typ!="string"||ut(e.typ)!==ut(o)))throw new T('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:a=[],issuer:c,subject:s,audience:l,maxTokenAge:f}=t,p=[...a];f!==void 0&&p.push("iat"),l!==void 0&&p.push("aud"),s!==void 0&&p.push("sub"),c!==void 0&&p.push("iss");for(let y of new Set(p.reverse()))if(!(y in n))throw new T(\`missing required "\${y}" claim\`,n,y,"missing");if(c&&!(Array.isArray(c)?c:[c]).includes(n.iss))throw new T('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new T('unexpected "sub" claim value',n,"sub","check_failed");if(l&&!mo(n.aud,typeof l=="string"?[l]:l))throw new T('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof t.clockTolerance){case"string":d=tr(t.clockTolerance);break;case"number":d=t.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:_}=t,h=ct(_||new Date);if((n.iat!==void 0||f)&&typeof n.iat!="number")throw new T('"iat" claim must be a number',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new T('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>h+d)throw new T('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new T('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=h-d)throw new Z('"exp" claim timestamp check failed',n,"exp","check_failed")}if(f){let y=h-n.iat,g=typeof f=="number"?f:tr(f);if(y-d>g)throw new Z('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(y<0-d)throw new T('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n};async function nr(e,r,t){let n=await st(e,r,t);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new G("JWTs MUST NOT use unencoded payload");let a={payload:ft(n.protectedHeader,n.payload,t),protectedHeader:n.protectedHeader};return typeof r=="function"?{...a,key:n.key}:a}function yo(e){switch(typeof e=="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new A('Unsupported "alg" value for a JSON Web Key Set')}}function bo(e){return e&&typeof e=="object"&&Array.isArray(e.keys)&&e.keys.every(ho)}function ho(e){return z(e)}function pt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}var or=class{_jwks;_cached=new WeakMap;constructor(r){if(!bo(r))throw new Q("JSON Web Key Set malformed");this._jwks=pt(r)}async getKey(r,t){let{alg:n,kid:o}={...r,...t?.header},a=yo(n),c=this._jwks.keys.filter(f=>{let p=a===f.kty;if(p&&typeof o=="string"&&(p=o===f.kid),p&&typeof f.alg=="string"&&(p=n===f.alg),p&&typeof f.use=="string"&&(p=f.use==="sig"),p&&Array.isArray(f.key_ops)&&(p=f.key_ops.includes("verify")),p)switch(n){case"ES256":p=f.crv==="P-256";break;case"ES384":p=f.crv==="P-384";break;case"ES512":p=f.crv==="P-521";break;case"Ed25519":case"EdDSA":p=f.crv==="Ed25519";break}return p}),{0:s,length:l}=c;if(l===0)throw new \$;if(l!==1){let f=new ce,{_cached:p}=this;throw f[Symbol.asyncIterator]=async function*(){for(let d of c)try{yield await lt(p,d,n)}catch{}},f}return lt(this._cached,s,n)}};async function lt(e,r,t){let n=e.get(r)||e.set(r,{}).get(r);if(n[t]===void 0){let o=await \$r({...r,ext:!0},t);if(o instanceof Uint8Array||o.type!=="public")throw new Q("JSON Web Key Set members must be public keys");n[t]=o}return n[t]}function ir(e){let r=new or(e),t=async(n,o)=>r.getKey(n,o);return Object.defineProperties(t,{jwks:{value:()=>pt(r._jwks),enumerable:!0,configurable:!1,writable:!1}}),t}function go(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var ar;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(ar="jose/v6.0.8");var me=Symbol();async function vo(e,r,t,n=fetch){let o=await n(e,{method:"GET",signal:t,redirect:"manual",headers:r}).catch(a=>{throw a.name==="TimeoutError"?new ue:a});if(o.status!==200)throw new P("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new P("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var Ae=Symbol();function _o(e,r){return!(typeof e!="object"||e===null||!("uat"in e)||typeof e.uat!="number"||Date.now()-e.uat>=r||!("jwks"in e)||!z(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,z))}var sr=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_headers;[me];_local;_cache;constructor(r,t){if(!(r instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(r.href),this._timeoutDuration=typeof t?.timeoutDuration=="number"?t?.timeoutDuration:5e3,this._cooldownDuration=typeof t?.cooldownDuration=="number"?t?.cooldownDuration:3e4,this._cacheMaxAge=typeof t?.cacheMaxAge=="number"?t?.cacheMaxAge:6e5,this._headers=new Headers(t?.headers),ar&&!this._headers.has("User-Agent")&&this._headers.set("User-Agent",ar),this._headers.has("accept")||(this._headers.set("accept","application/json"),this._headers.append("accept","application/jwk-set+json")),this[me]=t?.[me],t?.[Ae]!==void 0&&(this._cache=t?.[Ae],_o(t?.[Ae],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=ir(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(r,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(r,t)}catch(n){if(n instanceof \$&&this.coolingDown()===!1)return await this.reload(),this._local(r,t);throw n}}async reload(){this._pendingFetch&&go()&&(this._pendingFetch=void 0),this._pendingFetch||=vo(this._url.href,this._headers,AbortSignal.timeout(this._timeoutDuration),this[me]).then(r=>{this._local=ir(r),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=r),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(r=>{throw this._pendingFetch=void 0,r}),await this._pendingFetch}};function cr(e,r){let t=new sr(e,r),n=async(o,a)=>t.getKey(o,a);return Object.defineProperties(n,{coolingDown:{get:()=>t.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>t.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>t.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!t._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>t._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}function wo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var ur,fr,lr,pr,mr,dr,yr,br,So=typeof window<"u"&&typeof window.document<"u",xo=(typeof self>"u"?"undefined":wo(self))==="object"&&typeof((ur=self)===null||ur===void 0?void 0:ur.importScripts)=="function"&&(((fr=self.constructor)===null||fr===void 0?void 0:fr.name)==="DedicatedWorkerGlobalScope"||((lr=self.constructor)===null||lr===void 0?void 0:lr.name)==="ServiceWorkerGlobalScope"||((pr=self.constructor)===null||pr===void 0?void 0:pr.name)==="SharedWorkerGlobalScope"),mt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",dt=typeof Bun<"u"&&typeof Bun.version<"u",Oo=typeof process<"u"&&!!process.version&&!!(!((mr=process.versions)===null||mr===void 0)&&mr.node)&&!mt&&!dt,Eo=typeof navigator<"u"&&((dr=navigator)===null||dr===void 0?void 0:dr.product)==="ReactNative",Po=typeof globalThis<"u"&&((br=globalThis)===null||br===void 0||(yr=br.navigator)===null||yr===void 0?void 0:yr.userAgent)==="Cloudflare-Workers",hr=Ao();function Ao(){return So?{type:"browser",version:window.navigator.userAgent}:Po?{type:"workerd"}:xo?{type:"web-worker"}:mt?{type:"deno",version:Deno.version.deno}:dt?{type:"bun",version:Bun.version}:Oo?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:Eo?{type:"react-native"}:{type:"unknown"}}var i={};ro(i,{JsonError:()=>ze,ParseError:()=>je,any:()=>Dt,bigint:()=>gt,boolean:()=>Nt,booleanLiteral:()=>Kt,date:()=>vt,discriminant:()=>Xt,enum_:()=>ke,getObjectLikeUtils:()=>D,getObjectUtils:()=>q,getSchemaUtils:()=>v,isProperty:()=>H,lazy:()=>_t,lazyObject:()=>jt,list:()=>Ce,number:()=>Mt,object:()=>Ue,objectWithoutOptionalProperties:()=>zt,optional:()=>xr,property:()=>Et,record:()=>Ht,set:()=>Ft,string:()=>Bt,stringLiteral:()=>Ct,transform:()=>Or,undiscriminatedUnion:()=>Yt,union:()=>Qt,unknown:()=>Wt,withParsedProperties:()=>Ar});var m={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function Io(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function yt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function b(e,r){return"Expected ".concat(r,". Received ").concat(To(e),".")}function To(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(Io(e,BigInt))return"BigInt";switch(typeof e>"u"?"undefined":yt(e)){case"string":return'"'.concat(e,'"');case"bigint":case"number":case"boolean":case"undefined":return"".concat(e)}return typeof e>"u"?"undefined":yt(e)}function gr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function zo(e){if(Array.isArray(e))return gr(e)}function Ro(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function jo(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ko(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Uo(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ro(e,o,t[o])})}return e}function Co(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Ko(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Do(e){return zo(e)||jo(e)||No(e)||ko()}function No(e,r){if(e){if(typeof e=="string")return gr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return gr(e,r)}}function E(e){return Ko(Uo({},e),{json:bt(e.json),parse:bt(e.parse)})}function bt(e){return function(r,t){var n=e(r,t),o=t??{},a=o.skipValidation,c=a===void 0?!1:a;return!n.ok&&c?(console.warn(["Failed to validate."].concat(Do(n.errors.map(function(s){return" - "+(s.path.length>0?"".concat(s.path.join("."),": ").concat(s.message):s.message)}))).join(\`\n\`)),{ok:!0,value:r}):n}}function Ie(e){return e.path.length===0?e.message:"".concat(e.path.join(" -> "),": ").concat(e.message)}function Mo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bo(e,r,t){return r=de(r),Ho(e,_r()?Reflect.construct(r,t||[],de(e).constructor):r.apply(e,t))}function Wo(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Te(e,r,t){return _r()?Te=Reflect.construct:Te=function(o,a,c){var s=[null];s.push.apply(s,a);var l=Function.bind.apply(o,s),f=new l;return c&&ye(f,c.prototype),f},Te.apply(null,arguments)}function Jo(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function de(e){return de=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},de(e)}function Lo(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&ye(e,r)}function Vo(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Ho(e,r){return r&&(Fo(r)==="object"||typeof r=="function")?r:Mo(e)}function ye(e,r){return ye=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},ye(e,r)}function Fo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function vr(e){var r=typeof Map=="function"?new Map:void 0;return vr=function(n){if(n===null||!Vo(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(n))return r.get(n);r.set(n,o)}function o(){return Te(n,arguments,de(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),ye(o,n)},vr(e)}function _r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_r=function(){return!!e})()}var ze=function(e){"use strict";Lo(r,e);function r(t){Wo(this,r);var n;return n=Bo(this,r,[t.map(Ie).join("; ")]),Jo(n,"errors",void 0),n.errors=t,Object.setPrototypeOf(n,r.prototype),n}return r}(vr(Error));function Go(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function \$o(e,r,t){return r=be(r),Qo(e,Sr()?Reflect.construct(r,t||[],be(e).constructor):r.apply(e,t))}function qo(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Re(e,r,t){return Sr()?Re=Reflect.construct:Re=function(o,a,c){var s=[null];s.push.apply(s,a);var l=Function.bind.apply(o,s),f=new l;return c&&he(f,c.prototype),f},Re.apply(null,arguments)}function Yo(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},be(e)}function Xo(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&he(e,r)}function Zo(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Qo(e,r){return r&&(ei(r)==="object"||typeof r=="function")?r:Go(e)}function he(e,r){return he=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},he(e,r)}function ei(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function wr(e){var r=typeof Map=="function"?new Map:void 0;return wr=function(n){if(n===null||!Zo(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(n))return r.get(n);r.set(n,o)}function o(){return Re(n,arguments,be(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),he(o,n)},wr(e)}function Sr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Sr=function(){return!!e})()}var je=function(e){"use strict";Xo(r,e);function r(t){qo(this,r);var n;return n=\$o(this,r,[t.map(Ie).join("; ")]),Yo(n,"errors",void 0),n.errors=t,Object.setPrototypeOf(n,r.prototype),n}return r}(wr(Error));function ri(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ht(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ri(e,o,t[o])})}return e}function v(e){return{optional:function(){return xr(e)},transform:function(r){return Or(e,r)},parseOrThrow:function(r,t){var n=e.parse(r,t);if(n.ok)return n.value;throw new je(n.errors)},jsonOrThrow:function(r,t){var n=e.json(r,t);if(n.ok)return n.value;throw new ze(n.errors)}}}function xr(e){var r={parse:function(t,n){return t==null?{ok:!0,value:void 0}:e.parse(t,n)},json:function(t,n){return n?.omitUndefined&&t===void 0?{ok:!0,value:void 0}:t==null?{ok:!0,value:null}:e.json(t,n)},getType:function(){return m.OPTIONAL}};return ht({},r,v(r))}function Or(e,r){var t={parse:function(n,o){var a=e.parse(n,o);return a.ok?{ok:!0,value:r.transform(a.value)}:a},json:function(n,o){var a=r.untransform(n);return e.json(a,o)},getType:function(){return e.getType()}};return ht({},t,v(t))}function ti(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ni(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ti(e,o,t[o])})}return e}function oi(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function gt(){var e={parse:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return typeof r!="string"?{ok:!1,errors:[{path:o,message:b(r,"string")}]}:{ok:!0,value:BigInt(r)}},json:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return(typeof r>"u"?"undefined":oi(r))==="bigint"?{ok:!0,value:r.toString()}:{ok:!1,errors:[{path:o,message:b(r,"bigint")}]}},getType:function(){return m.BIGINT}};return ni({},E(e),v(e))}function ii(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ai(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function si(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ii(e,o,t[o])})}return e}var ci=/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?\$/;function vt(){var e={parse:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return typeof r!="string"?{ok:!1,errors:[{path:o,message:b(r,"string")}]}:ci.test(r)?{ok:!0,value:new Date(r)}:{ok:!1,errors:[{path:o,message:b(r,"ISO 8601 date string")}]}},json:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return ai(r,Date)?{ok:!0,value:r.toISOString()}:{ok:!1,errors:[{path:o,message:b(r,"Date object")}]}},getType:function(){return m.DATE}};return si({},E(e),v(e))}function ui(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function fi(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ui(e,o,t[o])})}return e}function I(e,r){return function(){var t={parse:r,json:r,getType:function(){return e}};return fi({},E(t),v(t))}}function ke(e){var r=new Set(e),t=I(m.ENUM,function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=o.allowUnrecognizedEnumValues,c=o.breadcrumbsPrefix,s=c===void 0?[]:c;return typeof n!="string"?{ok:!1,errors:[{path:s,message:b(n,"string")}]}:!r.has(n)&&!a?{ok:!1,errors:[{path:s,message:b(n,"enum")}]}:{ok:!0,value:n}});return t()}function li(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function pi(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){li(e,o,t[o])})}return e}function _t(e){var r=Er(e);return pi({},r,v(r))}function Er(e){return{parse:function(r,t){return te(e).parse(r,t)},json:function(r,t){return te(e).json(r,t)},getType:function(){return te(e).getType()}}}function te(e){var r=e;return r.__zurg_memoized==null&&(r.__zurg_memoized=e()),r.__zurg_memoized}function ge(e){return Object.entries(e)}function wt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function mi(e){if(Array.isArray(e))return e}function di(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function yi(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bi(e,r){return mi(e)||di(e,r)||hi(e,r)||yi()}function hi(e,r){if(e){if(typeof e=="string")return wt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return wt(e,r)}}function ve(e,r){var t=new Set(r);return Object.entries(e).reduce(function(n,o){var a=bi(o,2),c=a[0],s=a[1];return t.has(c)&&(n[c]=s),n},{})}function gi(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function V(e){if((typeof e>"u"?"undefined":gi(e))!=="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function _e(e){return Object.keys(e)}function St(e,r){var t=[],n=[],o=!0,a=!1,c=void 0;try{for(var s=e[Symbol.iterator](),l;!(o=(l=s.next()).done);o=!0){var f=l.value;r(f)?t.push(f):n.push(f)}}catch(p){a=!0,c=p}finally{try{!o&&s.return!=null&&s.return()}finally{if(a)throw c}}return[t,n]}function xt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function vi(e){if(Array.isArray(e))return e}function Ot(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _i(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function wi(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Pr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ot(e,o,t[o])})}return e}function Si(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function xi(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Si(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Oi(e,r){return vi(e)||_i(e,r)||Ei(e,r)||wi()}function Ei(e,r){if(e){if(typeof e=="string")return xt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return xt(e,r)}}function D(e){return{withParsedProperties:function(r){return Ar(e,r)}}}function Ar(e,r){var t={parse:function(n,o){var a=e.parse(n,o);if(!a.ok)return a;var c=Object.entries(r).reduce(function(s,l){var f=Oi(l,2),p=f[0],d=f[1];return xi(Pr({},s),Ot({},p,typeof d=="function"?d(a.value):d))},{});return{ok:!0,value:Pr({},a.value,c)}},json:function(n,o){if(!V(n)){var a;return{ok:!1,errors:[{path:(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],message:b(n,"object")}]}}var c=new Set(Object.keys(r)),s=ve(n,Object.keys(n).filter(function(l){return!c.has(l)}));return e.json(s,o)},getType:function(){return e.getType()}};return Pr({},t,v(t),D(t))}function Et(e,r){return{rawKey:e,valueSchema:r,isProperty:!0}}function H(e){return e.isProperty}function Ir(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Pi(e){if(Array.isArray(e))return e}function Ai(e){if(Array.isArray(e))return Ir(e)}function Ii(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Ti(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zi(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function Ri(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ji(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function N(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ii(e,o,t[o])})}return e}function ki(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function we(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ki(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Se(e,r){return Pi(e)||zi(e,r)||Tt(e,r)||Ri()}function U(e){return Ai(e)||Ti(e)||Tt(e)||ji()}function Tt(e,r){if(e){if(typeof e=="string")return Ir(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Ir(e,r)}}function Ue(e){var r={_getRawProperties:function(){return Object.entries(e).map(function(t){var n=Se(t,2),o=n[0],a=n[1];return H(a)?a.rawKey:o})},_getParsedProperties:function(){return _e(e)},parse:function(t,n){var o={},a=[],c=!0,s=!1,l=void 0;try{for(var f=ge(e)[Symbol.iterator](),p;!(c=(p=f.next()).done);c=!0){var d=Se(p.value,2),_=d[0],h=d[1],y=H(h)?h.rawKey:_,g=H(h)?h.valueSchema:h,O={rawKey:y,parsedKey:_,valueSchema:g};o[y]=O,It(g)&&a.push(y)}}catch(w){s=!0,l=w}finally{try{!c&&f.return!=null&&f.return()}finally{if(s)throw l}}return Pt({value:t,requiredKeys:a,getProperty:function(w){var k=o[w];if(k!=null)return{transformedKey:k.parsedKey,transform:function(K){var R;return k.valueSchema.parse(K,we(N({},n),{breadcrumbsPrefix:U((R=n?.breadcrumbsPrefix)!==null&&R!==void 0?R:[]).concat([w])}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:function(t,n){var o=[],a=!0,c=!1,s=void 0;try{for(var l=ge(e)[Symbol.iterator](),f;!(a=(f=l.next()).done);a=!0){var p=Se(f.value,2),d=p[0],_=p[1],h=H(_)?_.valueSchema:_;It(h)&&o.push(d)}}catch(y){c=!0,s=y}finally{try{!a&&l.return!=null&&l.return()}finally{if(c)throw s}}return Pt({value:t,requiredKeys:o,getProperty:function(y){var g=e[y];if(g!=null)return H(g)?{transformedKey:g.rawKey,transform:function(O){var w;return g.valueSchema.json(O,we(N({},n),{breadcrumbsPrefix:U((w=n?.breadcrumbsPrefix)!==null&&w!==void 0?w:[]).concat([y])}))}}:{transformedKey:y,transform:function(O){var w;return g.json(O,we(N({},n),{breadcrumbsPrefix:U((w=n?.breadcrumbsPrefix)!==null&&w!==void 0?w:[]).concat([y])}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:function(){return m.OBJECT}};return N({},E(r),v(r),D(r),q(r))}function Pt(e){var r=e.value,t=e.requiredKeys,n=e.getProperty,o=e.unrecognizedObjectKeys,a=o===void 0?"fail":o,c=e.skipValidation,s=c===void 0?!1:c,l=e.breadcrumbsPrefix,f=l===void 0?[]:l,p;if(!V(r))return{ok:!1,errors:[{path:f,message:b(r,"object")}]};var d=new Set(t),_=[],h={},y=!0,g=!1,O=void 0;try{for(var w=Object.entries(r)[Symbol.iterator](),k;!(y=(k=w.next()).done);y=!0){var K=Se(k.value,2),R=K[0],Ge=K[1],\$e=n(R);if(\$e!=null){d.delete(R);var qe=\$e.transform(Ge);if(qe.ok)h[\$e.transformedKey]=qe.value;else{var Mr;h[R]=Ge,(Mr=_).push.apply(Mr,U(qe.errors))}}else switch(a){case"fail":_.push({path:U(f).concat([R]),message:'Unexpected key "'.concat(R,'"')});break;case"strip":break;case"passthrough":h[R]=Ge;break}}}catch(ae){g=!0,O=ae}finally{try{!y&&w.return!=null&&w.return()}finally{if(g)throw O}}return(p=_).push.apply(p,U(t.filter(function(ae){return d.has(ae)}).map(function(ae){return{path:f,message:'Missing required key "'.concat(ae,'"')}}))),_.length===0||s?{ok:!0,value:h}:{ok:!1,errors:_}}function q(e){return{extend:function(r){var t={_getParsedProperties:function(){return U(e._getParsedProperties()).concat(U(r._getParsedProperties()))},_getRawProperties:function(){return U(e._getRawProperties()).concat(U(r._getRawProperties()))},parse:function(n,o){return At({extensionKeys:r._getRawProperties(),value:n,transformBase:function(a){return e.parse(a,o)},transformExtension:function(a){return r.parse(a,o)}})},json:function(n,o){return At({extensionKeys:r._getParsedProperties(),value:n,transformBase:function(a){return e.json(a,o)},transformExtension:function(a){return r.json(a,o)}})},getType:function(){return m.OBJECT}};return N({},t,v(t),D(t),q(t))},passthrough:function(){var r={_getParsedProperties:function(){return e._getParsedProperties()},_getRawProperties:function(){return e._getRawProperties()},parse:function(t,n){var o=e.parse(t,we(N({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:N({},t,o.value)}:o},json:function(t,n){var o=e.json(t,we(N({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:N({},t,o.value)}:o},getType:function(){return m.OBJECT}};return N({},r,v(r),D(r),q(r))}}}function At(e){var r=e.extensionKeys,t=e.value,n=e.transformBase,o=e.transformExtension,a=new Set(r),c=Se(St(_e(t),function(d){return a.has(d)}),2),s=c[0],l=c[1],f=n(ve(t,l)),p=o(ve(t,s));return f.ok&&p.ok?{ok:!0,value:N({},f.value,p.value)}:{ok:!1,errors:U(f.ok?[]:f.errors).concat(U(p.ok?[]:p.errors))}}function It(e){return!Ui(e)}function Ui(e){switch(e.getType()){case m.ANY:case m.UNKNOWN:case m.OPTIONAL:return!0;default:return!1}}function zt(e){return Ue(e)}function Ci(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Rt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ci(e,o,t[o])})}return e}function Ki(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Di(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function jt(e){var r=Di(Rt({},Er(e)),{_getRawProperties:function(){return te(e)._getRawProperties()},_getParsedProperties:function(){return te(e)._getParsedProperties()}});return Rt({},r,v(r),D(r),q(r))}function zr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Ni(e){if(Array.isArray(e))return zr(e)}function Mi(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Bi(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wi(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Mi(e,o,t[o])})}return e}function Ji(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function kt(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ji(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function xe(e){return Ni(e)||Bi(e)||Li(e)||Wi()}function Li(e,r){if(e){if(typeof e=="string")return zr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return zr(e,r)}}function Ce(e){var r={parse:function(t,n){return Ut(t,function(o,a){var c;return e.parse(o,kt(Tr({},n),{breadcrumbsPrefix:xe((c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["[".concat(a,"]")])}))})},json:function(t,n){return Ut(t,function(o,a){var c;return e.json(o,kt(Tr({},n),{breadcrumbsPrefix:xe((c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["[".concat(a,"]")])}))})},getType:function(){return m.LIST}};return Tr({},E(r),v(r))}function Ut(e,r){if(!Array.isArray(e))return{ok:!1,errors:[{message:b(e,"list"),path:[]}]};var t=e.map(function(n,o){return r(n,o)});return t.reduce(function(n,o){if(n.ok&&o.ok)return{ok:!0,value:xe(n.value).concat([o.value])};var a=[];if(!n.ok){var c;(c=a).push.apply(c,xe(n.errors))}if(!o.ok){var s;(s=a).push.apply(s,xe(o.errors))}return{ok:!1,errors:a}},{ok:!0,value:[]})}function Ct(e){var r=I(m.STRING_LITERAL,function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.breadcrumbsPrefix,a=o===void 0?[]:o;return t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:a,message:b(t,'"'.concat(e,'"'))}]}});return r()}function Kt(e){var r=I(m.BOOLEAN_LITERAL,function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.breadcrumbsPrefix,a=o===void 0?[]:o;return t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:a,message:b(t,"".concat(e.toString()))}]}});return r()}var Dt=I(m.ANY,function(e){return{ok:!0,value:e}});var Nt=I(m.BOOLEAN,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"boolean")}]}});var Mt=I(m.NUMBER,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"number")}]}});var Bt=I(m.STRING,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"string")}]}});var Wt=I(m.UNKNOWN,function(e){return{ok:!0,value:e}});function Rr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Vi(e){if(Array.isArray(e))return e}function Hi(e){if(Array.isArray(e))return Rr(e)}function Lt(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Fi(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gi(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function \$i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qi(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ne(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Lt(e,o,t[o])})}return e}function Yi(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Oe(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yi(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Xi(e,r){return Vi(e)||Gi(e,r)||Vt(e,r)||\$i()}function Y(e){return Hi(e)||Fi(e)||Vt(e)||qi()}function Vt(e,r){if(e){if(typeof e=="string")return Rr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Rr(e,r)}}function Ht(e,r){var t={parse:function(n,o){return Jt({value:n,isKeyNumeric:e.getType()===m.NUMBER,transformKey:function(a){var c;return e.parse(a,Oe(ne({},o),{breadcrumbsPrefix:Y((c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["".concat(a," (key)")])}))},transformValue:function(a,c){var s;return r.parse(a,Oe(ne({},o),{breadcrumbsPrefix:Y((s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[]).concat(["".concat(c)])}))},breadcrumbsPrefix:o?.breadcrumbsPrefix})},json:function(n,o){return Jt({value:n,isKeyNumeric:e.getType()===m.NUMBER,transformKey:function(a){var c;return e.json(a,Oe(ne({},o),{breadcrumbsPrefix:Y((c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["".concat(a," (key)")])}))},transformValue:function(a,c){var s;return r.json(a,Oe(ne({},o),{breadcrumbsPrefix:Y((s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[]).concat(["".concat(c)])}))},breadcrumbsPrefix:o?.breadcrumbsPrefix})},getType:function(){return m.RECORD}};return ne({},E(t),v(t))}function Jt(e){var r=e.value,t=e.isKeyNumeric,n=e.transformKey,o=e.transformValue,a=e.breadcrumbsPrefix,c=a===void 0?[]:a;return V(r)?ge(r).reduce(function(s,l){var f=Xi(l,2),p=f[0],d=f[1];if(d==null)return s;var _=s,h=p;if(t){var y=p.length>0?Number(p):NaN;isNaN(y)||(h=y)}var g=n(h),O=o(d,h);if(_.ok&&g.ok&&O.ok)return{ok:!0,value:Oe(ne({},_.value),Lt({},g.value,O.value))};var w=[];if(!_.ok){var k;(k=w).push.apply(k,Y(_.errors))}if(!g.ok){var K;(K=w).push.apply(K,Y(g.errors))}if(!O.ok){var R;(R=w).push.apply(R,Y(O.errors))}return{ok:!1,errors:w}},{ok:!0,value:{}}):{ok:!1,errors:[{path:c,message:b(r,"object")}]}}function jr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Zi(e){if(Array.isArray(e))return jr(e)}function Qi(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ea(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function ra(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ta(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function na(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Qi(e,o,t[o])})}return e}function oa(e){return Zi(e)||ra(e)||ia(e)||ta()}function ia(e,r){if(e){if(typeof e=="string")return jr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return jr(e,r)}}function Ft(e){var r=Ce(e),t={parse:function(n,o){var a=r.parse(n,o);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:function(n,o){if(!ea(n,Set)){var a;return{ok:!1,errors:[{path:(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],message:b(n,"Set")}]}}var c=r.json(oa(n),o);return c},getType:function(){return m.SET}};return na({},E(t),v(t))}function Gt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function aa(e){if(Array.isArray(e))return e}function sa(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ca(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function ua(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){sa(e,o,t[o])})}return e}function fa(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function la(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fa(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function pa(e,r){return aa(e)||ca(e,r)||ma(e,r)||ua()}function ma(e,r){if(e){if(typeof e=="string")return Gt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Gt(e,r)}}function Yt(e){var r={parse:function(t,n){return \$t(function(o,a){return o.parse(t,a)},e,n)},json:function(t,n){return \$t(function(o,a){return o.json(t,a)},e,n)},getType:function(){return m.UNDISCRIMINATED_UNION}};return qt({},E(r),v(r))}function \$t(e,r,t){var n=[],o=!0,a=!1,c=void 0;try{for(var s=r.entries()[Symbol.iterator](),l;!(o=(l=s.next()).done);o=!0){var f=pa(l.value,2),p=f[0],d=f[1],_=e(d,la(qt({},t),{skipValidation:!1}));if(_.ok)return _;var h=!0,y=!1,g=void 0;try{for(var O=_.errors[Symbol.iterator](),w;!(h=(w=O.next()).done);h=!0){var k=w.value;n.push({path:k.path,message:"[Variant ".concat(p,"] ").concat(k.message)})}}catch(K){y=!0,g=K}finally{try{!h&&O.return!=null&&O.return()}finally{if(y)throw g}}}}catch(K){a=!0,c=K}finally{try{!o&&s.return!=null&&s.return()}finally{if(a)throw c}}return{ok:!1,errors:n}}function Xt(e,r){return{parsedDiscriminant:e,rawDiscriminant:r}}function kr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function da(e){if(Array.isArray(e))return kr(e)}function Ur(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ya(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ba(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Cr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ur(e,o,t[o])})}return e}function ha(e,r){if(e==null)return{};var t=ga(e,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function ga(e,r){if(e==null)return{};var t={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(r.indexOf(o)>=0)&&(t[o]=e[o]);return t}function Kr(e){return da(e)||ya(e)||wa(e)||ba()}function va(e,r){if(Dr(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(Dr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function _a(e){var r=va(e,"string");return Dr(r)==="symbol"?r:String(r)}function Dr(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function wa(e,r){if(e){if(typeof e=="string")return kr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return kr(e,r)}}function Qt(e,r){var t=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,o=ke(_e(r)),a={parse:function(c,s){return Zt({value:c,discriminant:t,transformedDiscriminant:n,transformDiscriminantValue:function(l){var f;return o.parse(l,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:Kr((f=s?.breadcrumbsPrefix)!==null&&f!==void 0?f:[]).concat([t])})},getAdditionalPropertiesSchema:function(l){return r[l]},allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:function(l,f){return f.parse(l,s)},breadcrumbsPrefix:s?.breadcrumbsPrefix})},json:function(c,s){return Zt({value:c,discriminant:n,transformedDiscriminant:t,transformDiscriminantValue:function(l){var f;return o.json(l,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:Kr((f=s?.breadcrumbsPrefix)!==null&&f!==void 0?f:[]).concat([n])})},getAdditionalPropertiesSchema:function(l){return r[l]},allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:function(l,f){return f.json(l,s)},breadcrumbsPrefix:s?.breadcrumbsPrefix})},getType:function(){return m.UNION}};return Cr({},E(a),v(a),D(a))}function Zt(e){var r=e.value,t=e.discriminant,n=e.transformedDiscriminant,o=e.transformDiscriminantValue,a=e.getAdditionalPropertiesSchema,c=e.allowUnrecognizedUnionMembers,s=c===void 0?!1:c,l=e.transformAdditionalProperties,f=e.breadcrumbsPrefix,p=f===void 0?[]:f;if(!V(r))return{ok:!1,errors:[{path:p,message:b(r,"object")}]};var d=r[t],_=ha(r,[t].map(_a));if(d==null)return{ok:!1,errors:[{path:p,message:'Missing discriminant ("'.concat(t,'")')}]};var h=o(d);if(!h.ok)return{ok:!1,errors:h.errors};var y=a(h.value);if(y==null)return s?{ok:!0,value:Cr(Ur({},n,h.value),_)}:{ok:!1,errors:[{path:Kr(p).concat([t]),message:"Unexpected discriminant value"}]};var g=l(_,y);return g.ok?{ok:!0,value:Cr(Ur({},n,d),g.value)}:g}var C=i.object({organizationId:i.string(),agentId:i.string(),settings:i.record(i.string(),i.unknown())});var en=i.object({}).extend(C);var rn=i.object({}).extend(C);var tn=i.enum_(["CONVERSATION","CONVERSATION_MESSAGE","KNOWLEDGE_BASE","KNOWLEDGE_DOCUMENT","ACTION","USER","EVENT","EVENT_TRIGGER","USER_PROFILE","FEEDBACK"]);var M=i.object({referenceId:i.string()});var J=i.object({type:tn,appId:i.string()}).extend(M);var x=i.object({organizationId:i.string(),agentId:i.string()}).extend(J);var nn=i.enum_(["THUMBS_UP","THUMBS_DOWN","INSERT","HANDOFF"]);var on=i.object({type:nn,text:i.string().optional()});var an=i.object({feedbackId:x,conversationId:x,conversationMessageId:x,userId:x.optional(),createdAt:i.date().optional()}).extend(on);var sn=i.object({feedbacks:i.list(an)}).extend(C);var cn=i.object({conversations:i.list(x)}).extend(C);var un=i.enum_(["EMAIL","PHONE_NUMBER"]);var Ke=i.object({value:i.string(),type:un});var fn=i.object({userId:M.optional(),userIdentifiers:i.list(Ke),allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())});var ln=i.object({actionId:i.string(),conversationId:x.optional(),conversationMetadata:i.record(i.string(),i.string()),parameters:i.record(i.string(),i.unknown()),user:fn,transientData:i.record(i.string(),i.string()).optional()}).extend(C);var jp=i.object({response:i.string()});var pn=i.object({knowledgeBaseId:M}).extend(C);var Fp=i.object({message:i.string().optional()});var \$p=i.object({referenceId:i.string(),appId:i.string()});var mn=i.enum_(["text","array","color","image","multiline","section"]);var De=i.enum_(["VISIBLE","PARTIALLY_VISIBLE","HIDDEN"]);var dn=i.object({key:i.string(),displayName:i.string(),description:i.string().optional(),type:mn,visibility:De.optional(),fields:i.lazy(function(){return yn}).optional()});var yn=i.list(i.lazyObject(function(){return dn}));var bn=i.object({value:i.string(),visibility:De});var Ne=i.object({identifiers:i.list(Ke),data:i.record(i.string(),bn)});var um=i.object({userId:M}).extend(Ne);var mm=i.object({userId:x,allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())}).extend(Ne);var hn=i.enum_(["CONVERSATION_CREATED","FEEDBACK_CREATED"]);var gn=i.object({description:i.string(),type:hn});var _m=i.object({triggerId:x}).extend(gn);var Sm=i.object({number:i.number(),size:i.number(),totalElements:i.number(),totalPages:i.number()});var Om=i.object({page:i.number().optional(),size:i.number().optional(),sortId:i.string().optional(),sortDesc:i.boolean().optional()});var Me=i.enum_(["STRING","BOOLEAN","NUMBER"]);var Be=i.object({label:i.string(),value:i.unknown()});var vn=i.enum_(["POSITIVE","NEGATIVE","NEUTRAL","MIXED","UNKNOWN"]);var _n=i.object({actionIds:i.list(J),incompleteActionIds:i.list(J)});var wn=i.object({userRequest:i.string().optional(),agentResponse:i.string().optional(),resolutionStatus:i.string().optional(),category:i.string().optional(),sentiment:vn.optional()});var We=i.enum_(["SHORT","MEDIUM","LONG"]);var Sn=i.enum_(["MARKDOWN","FORMS","IMAGES","CHARTS_HIGHCHARTS_TS"]);var xn=i.object({capabilities:i.list(Sn),isCopilot:i.boolean(),responseLength:We});var On=i.object({responseConfig:xn.optional(),subject:i.string().optional(),url:i.string().optional(),createdAt:i.date().optional(),updatedAt:i.date().optional(),tags:i.set(i.string()).optional(),metadata:i.record(i.string(),i.string()).optional()});var En=i.object({url:i.string()});var Pn=i.enum_(["USER","HUMAN_AGENT","EXTERNAL_SYSTEM"]);var Je=i.object({createdAt:i.date().optional(),updatedAt:i.date().optional()});var An=i.object({userId:M,text:i.string(),userMessageType:Pn}).extend(Je);var In=i.object({conversationMessageId:x,language:i.string().optional(),attachments:i.list(En)}).extend(An);var Tn=i.enum_(["BOT_RESPONSE","BOT_SUGGESTION"]);var zn=i.object({text:i.string()});var Rn=i.object({id:i.string(),label:i.string(),description:i.string(),required:i.boolean(),suggestion:i.unknown().optional(),type:Me,enumOptions:i.list(Be).optional()});var jn=i.object({id:i.string(),formLabel:i.string(),fields:i.list(Rn),submitLabel:i.string()});var kn=i.enum_(["HIGHCHARTS_TS"]);var Un=i.object({label:i.string(),specSchema:kn,spec:i.string()});var Cn=i.union("type",{text:zn,actionForm:jn,chart:Un}).transform({transform:function(e){return e},untransform:function(e){return e}});var Kn=i.object({title:i.string(),url:i.string()});var Dn=i.object({followupQuestions:i.list(i.string()),sources:i.list(Kn),language:i.string().optional()});var Nn=i.object({conversationMessageId:x,botMessageType:Tn,responses:i.list(Cn),metadata:Dn}).extend(Je);var Mn=i.union("type",{user:In,bot:Nn}).transform({transform:function(e){return e},untransform:function(e){return e}});var Id=i.object({conversationId:x,messages:i.list(Mn),analysis:wn,summary:_n,deleted:i.boolean()}).extend(On);var Nr=i.object({documentId:J,documentName:i.string(),documentExcerpt:i.string(),legacyCorpusMavenId:i.string(),legacyDocumentMavenId:i.string()});var Bn=i.object({knowledgeReviewed:i.list(Nr),knowledgeUtilized:i.list(Nr)});var Le=i.object({actionId:J,actionName:i.string()});var Ve=i.object({actionParameters:i.record(i.string(),i.unknown()),executionResult:i.string().optional(),executionError:i.string().optional()}).extend(Le);var Wn=i.object({actionsReviewed:i.list(Le),actionsExecuted:i.list(Ve)});var Jn=i.object({}).extend(Ve);var Ln=i.object({safetyCheckPassed:i.boolean()});var Vn=i.union("type",{knowledge:Bn,actions:Wn,form:Jn,safety:Ln}).transform({transform:function(e){return e},untransform:function(e){return e}});var Yd=i.object({items:i.list(Vn)});var Hn=i.object({id:i.string(),label:i.string(),description:i.string(),required:i.boolean(),type:Me.optional(),enumOptions:i.list(Be).optional()});var Fn=i.object({name:i.string(),description:i.string(),userInteractionRequired:i.boolean(),buttonName:i.string().optional(),precondition:i.lazy(function(){return He}).optional(),userFormParameters:i.list(Hn)});var iy=i.object({actionId:x}).extend(Fn);var Gn=i.enum_(["NOT"]);var F=i.object({operator:Gn.optional()});var Fe=i.object({key:i.string(),value:i.string().optional()}).extend(F);var \$n=i.object({tags:i.set(i.string())}).extend(F);var qn=i.object({actionId:i.string(),appId:i.string().optional()}).extend(F);var Yn=i.object({useMarkdown:i.boolean().optional(),useForms:i.boolean().optional(),useImages:i.boolean().optional(),isCopilot:i.boolean().optional(),responseLength:We.optional()}).extend(F);var Xn=i.union("conversationPreconditionType",{tags:\$n,metadata:Fe,actionExecuted:qn,responseConfig:Yn}).transform({transform:function(e){return e},untransform:function(e){return e}});var He=i.union("preconditionType",{user:Fe,conversation:i.object({value:Xn}),group:i.lazyObject(function(){return Zn})}).transform({transform:function(e){return e},untransform:function(e){return e}});var Qn=i.enum_(["AND","OR"]);var Zn=i.object({operator:Qn,preconditions:i.list(i.lazy(function(){return He}))});import oe from"../..";async function ie(e){let t=\`https://developers\${process.env.ENVIRONMENT===void 0?"":\`.\${process.env.ENVIRONMENT==="sandbox"?\`\${process.env.SANDBOX_USER}.sb\`:process.env.ENVIRONMENT}\`}.mavenagi-apis.com/.well-known/jwks\`,n=cr(new URL(t)),o=e.headers.get("authorization").replace("Bearer ","");await nr(o,n,{issuer:"https://developers.mavenagi.com",audience:process.env.MAVENAGI_APP_ID})}async function oh(e){await ie(e);let{organizationId:r,agentId:t,settings:n,actionId:o,conversationId:a,conversationMetadata:c,parameters:s,user:l,transientData:f}=ln.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{let p=await oe.executeAction?.({organizationId:r,agentId:t,settings:n,actionId:o,conversationId:a,conversationMetadata:c,parameters:s,user:l,transientData:f});return new Response(JSON.stringify({response:p}),{status:200,headers:{"Content-Type":"application/json"}})}catch(p){return console.error(p),p instanceof Error?new Response(p.message,{status:500}):new Response("No result returned",{status:204})}}async function ih(e){await ie(e);let{organizationId:r,agentId:t,settings:n,feedbacks:o}=sn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.feedbackCreatedOrUpdated?.({organizationId:r,agentId:t,settings:n,feedbacks:o}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function ah(e){await ie(e);let{organizationId:r,agentId:t,settings:n,conversations:o}=cn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.conversationCreatedOrUpdated?.({organizationId:r,agentId:t,settings:n,conversations:o}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function sh(e){await ie(e);let{organizationId:r,agentId:t,settings:n,knowledgeBaseId:o}=pn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.knowledgeBaseRefreshed?.({organizationId:r,agentId:t,knowledgeBaseId:o,settings:n}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function ch(e){await ie(e);let{organizationId:r,agentId:t,settings:n}=rn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.postInstall?.({organizationId:r,agentId:t,settings:n}),new Response(null)}catch(o){return console.error(o),o instanceof Error?new Response(o.message,{status:400}):new Response("Unknown error",{status:500})}}async function uh(e){await ie(e);let{organizationId:r,agentId:t,settings:n}=en.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.preInstall?.({organizationId:r,agentId:t,settings:n}),new Response(null)}catch(o){return console.error(o),o instanceof Error?new Response(o.message,{status:400}):new Response("Unknown error",{status:500})}}export{ah as conversationCreatedOrUpdated,oh as executeAction,ih as feedbackCreatedOrUpdated,sh as knowledgeBaseRefreshed,ch as postInstall,uh as preInstall};\n`;
|