@authhero/widget 0.7.1 → 0.7.2
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/authhero-widget/authhero-widget.esm.js +1 -1
- package/dist/authhero-widget/index.esm.js +1 -1
- package/dist/authhero-widget/{p-29e844e0.entry.js → p-188ffffd.entry.js} +1 -1
- package/dist/authhero-widget/p-BzFenraS.js +2 -0
- package/dist/authhero-widget/{p-553c2cbe.entry.js → p-ea2660b2.entry.js} +1 -1
- package/dist/cjs/authhero-node.cjs.entry.js +1 -1
- package/dist/cjs/authhero-widget.cjs.entry.js +1 -1
- package/dist/cjs/authhero-widget.cjs.js +2 -2
- package/dist/cjs/{index-CFDpaA1R.js → index-xXst3JOw.js} +132 -1830
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/components/authhero-node.js +1 -1
- package/dist/components/authhero-widget.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-7EkYyes4.js +1 -0
- package/dist/components/{p-uGYnrdy5.js → p-DnNvVt9e.js} +1 -1
- package/dist/esm/authhero-node.entry.js +1 -1
- package/dist/esm/authhero-widget.entry.js +1 -1
- package/dist/esm/authhero-widget.js +3 -3
- package/dist/esm/{index-DKg5ozw7.js → index-BzFenraS.js} +132 -1830
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +2 -2
- package/hydrate/index.js +3739 -3761
- package/hydrate/index.mjs +3739 -3761
- package/package.json +2 -2
- package/dist/authhero-widget/p-DKg5ozw7.js +0 -2
- package/dist/components/p-JzMtjMQb.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var t={};function i(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(i[n[s]]=e[n[s]])}return i}function n(e,t){var i;return(null===(i=null==e?void 0:e._def)||void 0===i?void 0:i.typeName)===t}function s(e,t){const i=e.ZodType.prototype[t];e.ZodType.prototype[t]=function(...e){const t=i.apply(this,e);return t._def.openapi=this._def.openapi,t}}function r(e){if(void 0!==e.ZodType.prototype.openapi)return;e.ZodType.prototype.openapi=function(e,t){var s,r,o,a,c,u;const d="string"==typeof e?t:e,l=null!=d?d:{},{param:h}=l,_=i(l,["param"]),p=Object.assign(Object.assign({},null===(s=this._def.openapi)||void 0===s?void 0:s._internal),"string"==typeof e?{refId:e}:void 0),f=Object.assign(Object.assign(Object.assign({},null===(r=this._def.openapi)||void 0===r?void 0:r.metadata),_),(null===(a=null===(o=this._def.openapi)||void 0===o?void 0:o.metadata)||void 0===a?void 0:a.param)||h?{param:Object.assign(Object.assign({},null===(u=null===(c=this._def.openapi)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.param),h)}:void 0),m=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys(p).length>0?{_internal:p}:void 0),Object.keys(f).length>0?{metadata:f}:void 0)}));if(n(this,"ZodObject")){const e=this.extend;m.extend=function(...t){var i,n,s,r,o,a,c;const u=e.apply(this,t);return u._def.openapi={_internal:{extendedFrom:(null===(n=null===(i=this._def.openapi)||void 0===i?void 0:i._internal)||void 0===n?void 0:n.refId)?{refId:null===(r=null===(s=this._def.openapi)||void 0===s?void 0:s._internal)||void 0===r?void 0:r.refId,schema:this}:null===(a=null===(o=this._def.openapi)||void 0===o?void 0:o._internal)||void 0===a?void 0:a.extendedFrom},metadata:null===(c=u._def.openapi)||void 0===c?void 0:c.metadata},u}}return m},s(e,"optional"),s(e,"nullable"),s(e,"default"),s(e,"transform"),s(e,"refine");const t=e.ZodObject.prototype.deepPartial;e.ZodObject.prototype.deepPartial=function(){const e=this._def.shape(),i=t.apply(this),n=i._def.shape();return Object.entries(n).forEach((([t,i])=>{var n,s;i._def.openapi=null===(s=null===(n=e[t])||void 0===n?void 0:n._def)||void 0===s?void 0:s.openapi})),i._def.openapi=void 0,i};const r=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...e){const t=r.apply(this,e);return t._def.openapi=void 0,t};const o=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...e){const t=o.apply(this,e);return t._def.openapi=void 0,t}}function o(e,t){if(null==e||null==t)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1}if(!(e instanceof Object&&t instanceof Object))return!1;const i=Object.keys(e);return Object.keys(t).every((e=>-1!==i.indexOf(e)))&&i.every((i=>o(e[i],t[i])))}"function"==typeof SuppressedError&&SuppressedError;class a{constructor(){this.buckets=new Map}put(e){const t=this.hashCodeOf(e),i=this.buckets.get(t);i?i.some((t=>o(t,e)))||i.push(e):this.buckets.set(t,[e])}contains(e){const t=this.hashCodeOf(e),i=this.buckets.get(t);return!!i&&i.some((t=>o(t,e)))}values(){return[...this.buckets.values()].flat()}stats(){let e=0,t=0,i=0;for(const n of this.buckets.values())e+=1,t+=n.length,n.length>1&&(i+=1);return{totalBuckets:e,collisions:i,totalValues:t,hashEffectiveness:e/t}}hashCodeOf(e){let t=0;if(Array.isArray(e)){for(let i=0;i<e.length;i++)t^=this.hashCodeOf(e[i])*i;return t}if("string"==typeof e){for(let i=0;i<e.length;i++)t^=e.charCodeAt(i)*i;return t}if("number"==typeof e)return e;if("object"==typeof e)for(const[i,n]of Object.entries(e))t^=this.hashCodeOf(i)+this.hashCodeOf(null!=n?n:"");return t}}function c(e){return void 0===e}function u(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{i[e]=t(n)})),i}function d(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{t(n,e)||(i[e]=n)})),i}function l(e){return e.filter((e=>!c(e)))}const h=o;function _(e){return"string"==typeof e}class p{constructor(e){this.parents=e,this._definitions=[]}get definitions(){var e,t;return[...null!==(t=null===(e=this.parents)||void 0===e?void 0:e.flatMap((e=>e.definitions)))&&void 0!==t?t:[],...this._definitions]}register(e,t){const i=this.schemaWithRefId(e,t);return this._definitions.push({type:"schema",schema:i}),i}registerParameter(e,t){var i,n,s;const r=this.schemaWithRefId(e,t),o=null===(i=r._def.openapi)||void 0===i?void 0:i.metadata,a=r.openapi(Object.assign(Object.assign({},o),{param:Object.assign(Object.assign({},null==o?void 0:o.param),{name:null!==(s=null===(n=null==o?void 0:o.param)||void 0===n?void 0:n.name)&&void 0!==s?s:e})}));return this._definitions.push({type:"parameter",schema:a}),a}registerPath(e){this._definitions.push({type:"route",route:e})}registerWebhook(e){this._definitions.push({type:"webhook",webhook:e})}registerComponent(e,t,i){return this._definitions.push({type:"component",componentType:e,name:t,component:i}),{name:t,ref:{$ref:`#/components/${e}/${t}`}}}schemaWithRefId(e,t){return t.openapi(e)}}class f{constructor(e){this.message=e}}class m extends f{constructor(e,t){super(e),this.data=t}}class g extends f{constructor(e){super(`Missing parameter data, please specify \`${e.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`ZodSchema.openapi\``),this.data=e}}function y(e,t){try{return e()}catch(e){if(e instanceof g)throw new g(Object.assign(Object.assign({},e.data),t));throw e}}class E extends f{constructor(e){super("Unknown zod object type, please specify `type` and other OpenAPI props using `ZodSchema.openapi`."),this.data=e}}class v{static getMetadata(e){var t;const i=this.unwrapChained(e),n=e._def.openapi?e._def.openapi:i._def.openapi,s=null!==(t=e.description)&&void 0!==t?t:i.description;return{_internal:null==n?void 0:n._internal,metadata:Object.assign({description:s},null==n?void 0:n.metadata)}}static getInternalMetadata(e){const t=this.unwrapChained(e),i=e._def.openapi?e._def.openapi:t._def.openapi;return null==i?void 0:i._internal}static getParamMetadata(e){var t,i;const n=this.unwrapChained(e),s=e._def.openapi?e._def.openapi:n._def.openapi,r=null!==(t=e.description)&&void 0!==t?t:n.description;return{_internal:null==s?void 0:s._internal,metadata:Object.assign(Object.assign({},null==s?void 0:s.metadata),{param:Object.assign({description:r},null===(i=null==s?void 0:s.metadata)||void 0===i?void 0:i.param)})}}static buildSchemaMetadata(e){return d(function(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{t.some((t=>t===e))||(i[e]=n)})),i}(e,["param"]),c)}static buildParameterMetadata(e){return d(e,c)}static applySchemaMetadata(e,t){return d(Object.assign(Object.assign({},e),this.buildSchemaMetadata(t)),c)}static getRefId(e){var t;return null===(t=this.getInternalMetadata(e))||void 0===t?void 0:t.refId}static unwrapChained(e){return this.unwrapUntil(e)}static getDefaultValue(e){const t=this.unwrapUntil(e,"ZodDefault");return null==t?void 0:t._def.defaultValue()}static unwrapUntil(e,t){return t&&n(e,t)?e:n(e,"ZodOptional")||n(e,"ZodNullable")||n(e,"ZodBranded")?this.unwrapUntil(e.unwrap(),t):n(e,"ZodDefault")||n(e,"ZodReadonly")?this.unwrapUntil(e._def.innerType,t):n(e,"ZodEffects")?this.unwrapUntil(e._def.schema,t):n(e,"ZodPipeline")?this.unwrapUntil(e._def.in,t):t?void 0:e}static isOptionalSchema(e){return e.isOptional()}}class b{transform(e,t,i){var n,s;const r=e._def.type;return Object.assign(Object.assign({},t("array")),{items:i(r),minItems:null===(n=e._def.minLength)||void 0===n?void 0:n.value,maxItems:null===(s=e._def.maxLength)||void 0===s?void 0:s.value})}}class w{transform(e){return Object.assign(Object.assign({},e("string")),{pattern:"^d+$"})}}class O{transform(e,t,i,n,s){const r=[...e.options.values()],o=r.map(n);return t?{oneOf:i(o,t)}:{oneOf:o,discriminator:this.mapDiscriminator(r,e.discriminator,s)}}mapDiscriminator(e,t,i){if(e.some((e=>void 0===v.getRefId(e))))return;const s={};return e.forEach((e=>{var r;const o=v.getRefId(e),a=null===(r=e.shape)||void 0===r?void 0:r[t];if(n(a,"ZodEnum")||n(a,"ZodNativeEnum"))return void Object.values(a.enum).filter(_).forEach((e=>{s[e]=i(o)}));const c=null==a?void 0:a._def.value;if("string"!=typeof c)throw new Error(`Discriminator ${t} could not be found in one of the values of a discriminated union`);s[c]=i(o)})),{propertyName:t,mapping:s}}}class A{transform(e,t){return Object.assign(Object.assign({},t("string")),{enum:e._def.values})}}class S{transform(e,t,i,n){const s={allOf:this.flattenIntersectionTypes(e).map(n)};return t?{anyOf:i([s],t)}:s}flattenIntersectionTypes(e){return n(e,"ZodIntersection")?[...this.flattenIntersectionTypes(e._def.left),...this.flattenIntersectionTypes(e._def.right)]:[e]}}class I{transform(e,t){return Object.assign(Object.assign({},t(typeof e._def.value)),{enum:[e._def.value]})}}class N{transform(e,t){const{type:i,values:n}=function(e){const t=Object.keys(e).filter((t=>"number"!=typeof e[e[t]])).map((t=>e[t])),i=t.filter((e=>"number"==typeof e)).length;return{values:t,type:0===i?"string":i===t.length?"numeric":"mixed"}}(e._def.values);if("mixed"===i)throw new f("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},t("numeric"===i?"integer":"string")),{enum:n})}}class C{transform(e,t,i){return Object.assign(Object.assign({},t(e.isInt?"integer":"number")),i(e._def.checks))}}class T{transform(e,t,i,n){var s;const r=null===(s=v.getInternalMetadata(e))||void 0===s?void 0:s.extendedFrom,o=this.requiredKeysOf(e),a=u(e._def.shape(),n);if(!r)return Object.assign(Object.assign(Object.assign(Object.assign({},i("object")),{properties:a,default:t}),o.length>0?{required:o}:{}),this.generateAdditionalProperties(e,n));const c=r.schema;n(c);const d=this.requiredKeysOf(c),l=u(null==c?void 0:c._def.shape(),n),_=Object.fromEntries(Object.entries(a).filter((([e,t])=>!h(l[e],t)))),p=o.filter((e=>!d.includes(e))),f=Object.assign(Object.assign(Object.assign(Object.assign({},i("object")),{default:t,properties:_}),p.length>0?{required:p}:{}),this.generateAdditionalProperties(e,n));return{allOf:[{$ref:`#/components/schemas/${r.refId}`},f]}}generateAdditionalProperties(e,t){const i=e._def.unknownKeys,s=e._def.catchall;return n(s,"ZodNever")?"strict"===i?{additionalProperties:!1}:{}:{additionalProperties:t(s)}}requiredKeysOf(e){return Object.entries(e._def.shape()).filter((([e,t])=>!v.isOptionalSchema(t))).map((([e,t])=>e))}}class x{transform(e,t,i){const s=e._def.keyType,r=i(e._def.valueType);if(n(s,"ZodEnum")||n(s,"ZodNativeEnum")){const e=Object.values(s.enum).filter(_).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r})),{});return Object.assign(Object.assign({},t("object")),{properties:e})}return Object.assign(Object.assign({},t("object")),{additionalProperties:r})}}class R{transform(e,t){var i,n,s;const r=this.getZodStringCheck(e,"regex"),o=null===(i=this.getZodStringCheck(e,"length"))||void 0===i?void 0:i.value,a=Number.isFinite(e.minLength)&&null!==(n=e.minLength)&&void 0!==n?n:void 0,c=Number.isFinite(e.maxLength)&&null!==(s=e.maxLength)&&void 0!==s?s:void 0;return Object.assign(Object.assign({},t("string")),{minLength:null!=o?o:a,maxLength:null!=o?o:c,format:this.mapStringFormat(e),pattern:null==r?void 0:r.regex.source})}mapStringFormat(e){return e.isUUID?"uuid":e.isEmail?"email":e.isURL?"uri":e.isDate?"date":e.isDatetime?"date-time":e.isCUID?"cuid":e.isCUID2?"cuid2":e.isULID?"ulid":e.isIP?"ip":e.isEmoji?"emoji":void 0}getZodStringCheck(e,t){return e._def.checks.find((e=>e.kind===t))}}class k{constructor(e){this.versionSpecifics=e}transform(e,t,i){const{items:n}=e._def,s=n.map(i);return Object.assign(Object.assign({},t("array")),this.versionSpecifics.mapTupleItems(s))}}class D{transform(e,t,i){return{anyOf:t(this.flattenUnionTypes(e).map((e=>{const t=this.unwrapNullable(e);return i(t)})))}}flattenUnionTypes(e){return n(e,"ZodUnion")?e._def.options.flatMap((e=>this.flattenUnionTypes(e))):[e]}unwrapNullable(e){return n(e,"ZodNullable")?this.unwrapNullable(e.unwrap()):e}}class L{constructor(e){this.versionSpecifics=e,this.objectTransformer=new T,this.stringTransformer=new R,this.numberTransformer=new C,this.bigIntTransformer=new w,this.literalTransformer=new I,this.enumTransformer=new A,this.nativeEnumTransformer=new N,this.arrayTransformer=new b,this.unionTransformer=new D,this.discriminatedUnionTransformer=new O,this.intersectionTransformer=new S,this.recordTransformer=new x,this.tupleTransformer=new k(e)}transform(e,t,i,s,r){if(n(e,"ZodNull"))return this.versionSpecifics.nullType;if(n(e,"ZodUnknown")||n(e,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,t);if(n(e,"ZodObject"))return this.objectTransformer.transform(e,r,(e=>this.versionSpecifics.mapNullableType(e,t)),i);const o=this.transformSchemaWithoutDefault(e,t,i,s);return Object.assign(Object.assign({},o),{default:r})}transformSchemaWithoutDefault(e,t,i,s){if(n(e,"ZodUnknown")||n(e,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,t);if(n(e,"ZodString"))return this.stringTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodNumber"))return this.numberTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),(e=>this.versionSpecifics.getNumberChecks(e)));if(n(e,"ZodBigInt"))return this.bigIntTransformer.transform((e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",t);if(n(e,"ZodLiteral"))return this.literalTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodEnum"))return this.enumTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodNativeEnum"))return this.nativeEnumTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodArray"))return this.arrayTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodTuple"))return this.tupleTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodUnion"))return this.unionTransformer.transform(e,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i);if(n(e,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(e,t,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i,s);if(n(e,"ZodIntersection"))return this.intersectionTransformer.transform(e,t,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i);if(n(e,"ZodRecord"))return this.recordTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodDate"))return this.versionSpecifics.mapNullableType("string",t);const r=v.getRefId(e);throw new E({currentSchema:e._def,schemaName:r})}}class j{constructor(e,t){this.definitions=e,this.versionSpecifics=t,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new L(t),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach((e=>this.generateSingle(e))),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach((e=>this.generateSingle(e))),{components:this.buildComponents()}}buildComponents(){var e,t;const i={};return this.rawComponents.forEach((({componentType:e,name:t,component:n})=>{var s;null!==(s=i[e])&&void 0!==s||(i[e]={}),i[e][t]=n})),Object.assign(Object.assign({},i),{schemas:Object.assign(Object.assign({},null!==(e=i.schemas)&&void 0!==e?e:{}),this.schemaRefs),parameters:Object.assign(Object.assign({},null!==(t=i.parameters)&&void 0!==t?t:{}),this.paramRefs)})}sortDefinitions(){const e=["schema","parameter","component","route"];this.definitions.sort(((t,i)=>"type"in t?"type"in i?e.findIndex((e=>e===t.type))-e.findIndex((e=>e===i.type)):1:"type"in i?-1:0))}generateSingle(e){if("type"in e)switch(e.type){case"parameter":return void this.generateParameterDefinition(e.schema);case"schema":return void this.generateSchemaWithRef(e.schema);case"route":return void this.generateSingleRoute(e.route);case"component":return void this.rawComponents.push(e)}else this.generateSchemaWithRef(e)}generateParameterDefinition(e){const t=v.getRefId(e),i=this.generateParameter(e);return t&&(this.paramRefs[t]=i),i}getParameterRef(e,t){var i,n,s,r,o;const a=null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.param,c=(null===(n=null==e?void 0:e._internal)||void 0===n?void 0:n.refId)?this.paramRefs[null===(s=e._internal)||void 0===s?void 0:s.refId]:void 0;if((null===(r=null==e?void 0:e._internal)||void 0===r?void 0:r.refId)&&c){if(a&&c.in!==a.in||(null==t?void 0:t.in)&&c.in!==t.in)throw new m(`Conflicting location for parameter ${c.name}`,{key:"in",values:l([c.in,null==t?void 0:t.in,null==a?void 0:a.in])});if(a&&c.name!==a.name||(null==t?void 0:t.name)&&c.name!==(null==t?void 0:t.name))throw new m("Conflicting names for parameter",{key:"name",values:l([c.name,null==t?void 0:t.name,null==a?void 0:a.name])});return{$ref:`#/components/parameters/${null===(o=e._internal)||void 0===o?void 0:o.refId}`}}}generateInlineParameters(e,t){var i;const s=v.getMetadata(e),r=null===(i=null==s?void 0:s.metadata)||void 0===i?void 0:i.param,o=this.getParameterRef(s,{in:t});if(o)return[o];if(n(e,"ZodObject")){const i=e._def.shape(),n=Object.entries(i).map((([e,i])=>{var n,s;const r=v.getMetadata(i),o=this.getParameterRef(r,{in:t,name:e});if(o)return o;const a=null===(n=null==r?void 0:r.metadata)||void 0===n?void 0:n.param;if((null==a?void 0:a.name)&&a.name!==e)throw new m("Conflicting names for parameter",{key:"name",values:[e,a.name]});if((null==a?void 0:a.in)&&a.in!==t)throw new m(`Conflicting location for parameter ${null!==(s=a.name)&&void 0!==s?s:e}`,{key:"in",values:[t,a.in]});return this.generateParameter(i.openapi({param:{name:e,in:t}}))}));return n}if((null==r?void 0:r.in)&&r.in!==t)throw new m(`Conflicting location for parameter ${r.name}`,{key:"in",values:[t,r.in]});return[this.generateParameter(e.openapi({param:{in:t}}))]}generateSimpleParameter(e){var t;const i=v.getParamMetadata(e),n=null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.param,s=!v.isOptionalSchema(e)&&!e.isNullable(),r=this.generateSchemaWithRef(e);return Object.assign({schema:r,required:s},n?v.buildParameterMetadata(n):{})}generateParameter(e){var t;const i=v.getMetadata(e),n=null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.param,s=null==n?void 0:n.name,r=null==n?void 0:n.in;if(!s)throw new g({missingField:"name"});if(!r)throw new g({missingField:"in",paramName:s});const o=this.generateSimpleParameter(e);return Object.assign(Object.assign({},o),{in:r,name:s})}generateSchemaWithMetadata(e){var t;const i=v.unwrapChained(e),n=v.getMetadata(e),s=v.getDefaultValue(e),r=(null===(t=null==n?void 0:n.metadata)||void 0===t?void 0:t.type)?{type:null==n?void 0:n.metadata.type}:this.toOpenAPISchema(i,e.isNullable(),s);return(null==n?void 0:n.metadata)?v.applySchemaMetadata(r,n.metadata):d(r,c)}constructReferencedOpenAPISchema(e){var t;const i=v.getMetadata(e),n=v.unwrapChained(e),s=v.getDefaultValue(e),r=e.isNullable();return(null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.type)?this.versionSpecifics.mapNullableType(i.metadata.type,r):this.toOpenAPISchema(n,r,s)}generateSimpleSchema(e){var t;const i=v.getMetadata(e),n=v.getRefId(e);if(!n||!this.schemaRefs[n])return this.generateSchemaWithMetadata(e);const s=this.schemaRefs[n],r={$ref:this.generateSchemaRef(n)},o=d(v.buildSchemaMetadata(null!==(t=null==i?void 0:i.metadata)&&void 0!==t?t:{}),((e,t)=>void 0===e||h(e,s[t])));if(o.type)return{allOf:[r,o]};const a=d(this.constructReferencedOpenAPISchema(e),((e,t)=>void 0===e||h(e,s[t]))),c=v.applySchemaMetadata(a,o);return Object.keys(c).length>0?{allOf:[r,c]}:r}generateSchemaWithRef(e){const t=v.getRefId(e),i=this.generateSimpleSchema(e);return t&&void 0===this.schemaRefs[t]?(this.schemaRefs[t]=i,{$ref:this.generateSchemaRef(t)}):i}generateSchemaRef(e){return`#/components/schemas/${e}`}getRequestBody(e){if(!e)return;const{content:t}=e,n=i(e,["content"]),s=this.getBodyContent(t);return Object.assign(Object.assign({},n),{content:s})}getParameters(e){if(!e)return[];const{headers:t}=e,i=this.cleanParameter(e.query),n=this.cleanParameter(e.params),s=this.cleanParameter(e.cookies),r=y((()=>i?this.generateInlineParameters(i,"query"):[]),{location:"query"}),o=y((()=>n?this.generateInlineParameters(n,"path"):[]),{location:"path"}),a=y((()=>s?this.generateInlineParameters(s,"cookie"):[]),{location:"cookie"});return[...o,...r,...y((()=>{if(Array.isArray(t))return t.flatMap((e=>this.generateInlineParameters(e,"header")));const e=this.cleanParameter(t);return e?this.generateInlineParameters(e,"header"):[]}),{location:"header"}),...a]}cleanParameter(e){if(e)return n(e,"ZodEffects")?this.cleanParameter(e._def.schema):e}generatePath(e){const{method:t,path:n,request:s,responses:r}=e,o=i(e,["method","path","request","responses"]),a=u(r,(e=>this.getResponse(e))),c=y((()=>this.getParameters(s)),{route:`${t} ${n}`}),d=this.getRequestBody(null==s?void 0:s.body);return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},o),c.length>0?{parameters:[...o.parameters||[],...c]}:{}),d?{requestBody:d}:{}),{responses:a})}}generateSingleRoute(e){const t=this.generatePath(e);return this.pathRefs[e.path]=Object.assign(Object.assign({},this.pathRefs[e.path]),t),t}getResponse(e){if(this.isReferenceObject(e))return e;const{content:t,headers:s}=e,r=i(e,["content","headers"]),o=t?{content:this.getBodyContent(t)}:{};if(!s)return Object.assign(Object.assign({},r),o);const a=n(s,"ZodObject")?this.getResponseHeaders(s):s;return Object.assign(Object.assign(Object.assign({},r),{headers:a}),o)}isReferenceObject(e){return"$ref"in e}getResponseHeaders(e){return u(e._def.shape(),(e=>this.generateSimpleParameter(e)))}getBodyContent(e){return u(e,(e=>{if(!e||!function(e){return"_def"in e}(e.schema))return e;const{schema:t}=e,n=i(e,["schema"]),s=this.generateSchemaWithRef(t);return Object.assign({schema:s},n)}))}toOpenAPISchema(e,t,i){return this.openApiTransformer.transform(e,t,(e=>this.generateSchemaWithRef(e)),(e=>this.generateSchemaRef(e)),i)}}class F{get nullType(){return{nullable:!0}}mapNullableOfArray(e,t){return t?[...e,this.nullType]:e}mapNullableType(e,t){return Object.assign(Object.assign({},e?{type:e}:void 0),t?this.nullType:void 0)}mapTupleItems(e){const t=function(e){const t=new a;return e.forEach((e=>t.put(e))),[...t.values()]}(e);return{items:1===t.length?t[0]:{anyOf:t},minItems:e.length,maxItems:e.length}}getNumberChecks(e){return Object.assign({},...e.map((e=>{switch(e.kind){case"min":return e.inclusive?{minimum:Number(e.value)}:{minimum:Number(e.value),exclusiveMinimum:!0};case"max":return e.inclusive?{maximum:Number(e.value)}:{maximum:Number(e.value),exclusiveMaximum:!0};default:return{}}})))}}class U{constructor(e){const t=new F;this.generator=new j(e,t)}generateDocument(e){const t=this.generator.generateDocumentData();return Object.assign(Object.assign({},e),t)}generateComponents(){return this.generator.generateComponents()}}class P{get nullType(){return{type:"null"}}mapNullableOfArray(e,t){return t?[...e,this.nullType]:e}mapNullableType(e,t){return e?t?{type:Array.isArray(e)?[...e,"null"]:[e,"null"]}:{type:e}:{}}mapTupleItems(e){return{prefixItems:e}}getNumberChecks(e){return Object.assign({},...e.map((e=>{switch(e.kind){case"min":return e.inclusive?{minimum:Number(e.value)}:{exclusiveMinimum:Number(e.value)};case"max":return e.inclusive?{maximum:Number(e.value)}:{exclusiveMaximum:Number(e.value)};default:return{}}})))}}function M(e){return"type"in e&&"webhook"===e.type}class Z{constructor(e){this.definitions=e,this.webhookRefs={};const t=new P;this.generator=new j(this.definitions,t)}generateDocument(e){const t=this.generator.generateDocumentData();return this.definitions.filter(M).forEach((e=>this.generateSingleWebhook(e.webhook))),Object.assign(Object.assign(Object.assign({},e),t),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateSingleWebhook(e){const t=this.generator.generatePath(e);return this.webhookRefs[e.path]=Object.assign(Object.assign({},this.webhookRefs[e.path]),t),t}}var $=e=>{const t=e.split("/");return""===t[0]&&t.shift(),t},H={},z=(e,t)=>{if("*"===e)return"*";const i=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(i){const n=`${e}#${t}`;return H[n]||(H[n]=i[2]?t&&":"!==t[0]&&"*"!==t[0]?[n,i[1],new RegExp(`^${i[2]}(?=/${t})`)]:[e,i[1],new RegExp(`^${i[2]}$`)]:[e,i[1],!0]),H[n]}return null},G=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(e=>{try{return t(e)}catch{return e}}))}},B=e=>{const t=e.url,i=t.indexOf("/",t.indexOf(":")+4);let n=i;for(;n<t.length;n++){const e=t.charCodeAt(n);if(37===e){const e=t.indexOf("?",n),r=t.slice(i,-1===e?void 0:e);return s=r.includes("%25")?r.replace(/%25/g,"%2525"):r,G(s,decodeURI)}if(63===e)break}var s;return t.slice(i,n)},q=e=>{const t=B(e);return t.length>1&&"/"===t.at(-1)?t.slice(0,-1):t},K=(e,t,...i)=>(i.length&&(t=K(t,...i)),`${"/"===e?.[0]?"":"/"}${e}${"/"===t?"":`${"/"===e?.at(-1)?"":"/"}${"/"===t?.[0]?t.slice(1):t}`}`),W=e=>{if(63!==e.charCodeAt(e.length-1)||!e.includes(":"))return null;const t=e.split("/"),i=[];let n="";return t.forEach((e=>{if(""===e||/\:/.test(e)){if(/\:/.test(e))if(/\?/.test(e)){i.push(0===i.length&&""===n?"/":n);const t=e.replace("?","");n+="/"+t,i.push(n)}else n+="/"+e}else n+="/"+e})),i.filter(((e,t,i)=>i.indexOf(e)===t))},V=e=>/[%+]/.test(e)?(-1!==e.indexOf("+")&&(e=e.replace(/\+/g," ")),-1!==e.indexOf("%")?G(e,J):e):e,X=(e,t,i)=>{let n;if(!i&&t&&!/[%+]/.test(t)){let i=e.indexOf("?",8);if(-1===i)return;for(e.startsWith(t,i+1)||(i=e.indexOf(`&${t}`,i+1));-1!==i;){const n=e.charCodeAt(i+t.length+1);if(61===n){const n=i+t.length+2,s=e.indexOf("&",n);return V(e.slice(n,-1===s?void 0:s))}if(38==n||isNaN(n))return"";i=e.indexOf(`&${t}`,i+1)}if(n=/[%+]/.test(e),!n)return}const s={};n??=/[%+]/.test(e);let r=e.indexOf("?",8);for(;-1!==r;){const t=e.indexOf("&",r+1);let o=e.indexOf("=",r);o>t&&-1!==t&&(o=-1);let a,c=e.slice(r+1,-1===o?-1===t?void 0:t:o);n&&(c=V(c)),r=t,""!==c&&(-1===o?a="":(a=e.slice(o+1,-1===t?void 0:t),n&&(a=V(a))),i?(s[c]&&Array.isArray(s[c])||(s[c]=[]),s[c].push(a)):s[c]??=a)}return t?s[t]:s},Y=X,J=decodeURIComponent,Q=/^[\w!#$%&'*.^`|~+-]+$/,ee=/^[ !#-:<-[\]-~]*$/,te=class extends Error{res;status;constructor(e=500,t){super(t?.message,{cause:t?.cause}),this.res=t?.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},ie=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,ne=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/,se=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,re=(e,t)=>async(i,n)=>{let s={};const r=i.req.header("Content-Type");switch(e){case"json":if(!r||!ie.test(r))break;try{s=await i.req.json()}catch{throw new te(400,{message:"Malformed JSON in request body"})}break;case"form":{if(!r||!ne.test(r)&&!se.test(r))break;let e;if(i.req.bodyCache.formData)e=await i.req.bodyCache.formData;else try{const t=await i.req.arrayBuffer();e=await((e,t)=>new Response(e,{headers:{"Content-Type":t}}).formData())(t,r),i.req.bodyCache.formData=e}catch(e){let t="Malformed FormData request.";throw t+=e instanceof Error?` ${e.message}`:` ${String(e)}`,new te(400,{message:t})}const t={};e.forEach(((e,i)=>{i.endsWith("[]")?(t[i]??=[]).push(e):Array.isArray(t[i])?t[i].push(e):t[i]=i in t?[t[i],e]:e})),s=t;break}case"query":s=Object.fromEntries(Object.entries(i.req.queries()).map((([e,t])=>1===t.length?[e,t[0]]:[e,t])));break;case"param":s=i.req.param();break;case"header":s=i.req.header();break;case"cookie":s=(e=>{const t=e.req.raw.headers.get("Cookie");if(!t)return{};return(e=>{const t=e.trim().split(";"),i={};for(let e of t){e=e.trim();const t=e.indexOf("=");if(-1===t)continue;const n=e.substring(0,t).trim();if(!Q.test(n))continue;let s=e.substring(t+1).trim();s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),ee.test(s)&&(i[n]=-1!==s.indexOf("%")?G(s,J):s)}return i})(t)})(i)}const o=await t(s,i);return o instanceof Response?o:(i.req.addValidatedData(e,o),await n())};const oe=function(e,t,i,n){return re(e,(async(s,r)=>{let o=s;if("header"===e&&"_def"in t||"header"===e&&"_zod"in t){const e=Object.keys("in"in t?t.in.shape:t.shape),i=Object.fromEntries(e.map((e=>[e.toLowerCase(),e])));o=Object.fromEntries(Object.entries(s).map((([e,t])=>[i[e]||e,t])))}const a=n&&n.validationFunction?await n.validationFunction(t,o):await t.safeParseAsync(o);if(i){const t=await i({data:o,...a,target:e},r);if(t){if(t instanceof Response)return t;if("response"in t)return t.response}}return a.success?a.data:r.json(a,400)}))};var ae=(e,t,i)=>(n,s)=>{let r=-1;return async function o(a){if(a<=r)throw new Error("next() called multiple times");let c;r=a;let u,d=!1;if(e[a]?(u=e[a][0][0],n.req.routeIndex=a):u=a===e.length&&s||void 0,u)try{c=await u(n,(()=>o(a+1)))}catch(e){if(!(e instanceof Error&&t))throw e;n.error=e,c=await t(e,n),d=!0}else!1===n.finalized&&i&&(c=await i(n));return c&&(!1===n.finalized||d)&&(n.res=c),n}(0)},ce=Symbol(),ue=(e,t,i)=>{void 0!==e[t]?Array.isArray(e[t])?e[t].push(i):e[t]=[e[t],i]:e[t]=t.endsWith("[]")?[i]:i},de=(e,t,i)=>{let n=e;const s=t.split(".");s.forEach(((e,t)=>{t===s.length-1?n[e]=i:((!n[e]||"object"!=typeof n[e]||Array.isArray(n[e])||n[e]instanceof File)&&(n[e]=Object.create(null)),n=n[e])}))},le=e=>G(e,J),he=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",i=[[]]){this.raw=e,this.path=t,this.#t=i,this.#e={}}param(e){return e?this.#i(e):this.#n()}#i(e){const t=this.#t[0][this.routeIndex][1][e],i=this.#s(t);return i&&/\%/.test(i)?le(i):i}#n(){const e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(const i of t){const t=this.#s(this.#t[0][this.routeIndex][1][i]);void 0!==t&&(e[i]=/\%/.test(t)?le(t):t)}return e}#s(e){return this.#t[1]?this.#t[1][e]:e}query(e){return Y(this.url,e)}queries(e){return((e,t)=>X(this.url,t,!0))(0,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;const t={};return this.raw.headers.forEach(((e,i)=>{t[i]=e})),t}async parseBody(e){return this.bodyCache.parsedBody??=await(async(e,t=Object.create(null))=>{const{all:i=!1,dot:n=!1}=t,s=(e instanceof he?e.raw.headers:e.headers).get("Content-Type");return s?.startsWith("multipart/form-data")||s?.startsWith("application/x-www-form-urlencoded")?async function(e,t){const i=await e.formData();return i?function(e,t){const i=Object.create(null);return e.forEach(((e,n)=>{t.all||n.endsWith("[]")?ue(i,n,e):i[n]=e})),t.dot&&Object.entries(i).forEach((([e,t])=>{e.includes(".")&&(de(i,e,t),delete i[e])})),i}(i,t):{}}(e,{all:i,dot:n}):{}})(this,e)}#r=e=>{const{bodyCache:t,raw:i}=this,n=t[e];if(n)return n;const s=Object.keys(t)[0];return s?t[s].then((t=>("json"===s&&(t=JSON.stringify(t)),new Response(t)[e]()))):t[e]=i[e]()};json(){return this.#r("text").then((e=>JSON.parse(e)))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[ce](){return this.#t}get matchedRoutes(){return this.#t[0].map((([[,e]])=>e))}get routePath(){return this.#t[0].map((([[,e]])=>e))[this.routeIndex].path}},_e=async(e,t,i,n,s)=>{"object"!=typeof e||e instanceof String||(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const r=e.callbacks;return r?.length?(s?s[0]+=e:s=[e],Promise.all(r.map((e=>e({phase:t,buffer:s,context:n})))).then((e=>Promise.all(e.filter(Boolean).map((e=>_e(e,t,!1,n,s)))).then((()=>s[0]))))):Promise.resolve(e)},pe=(e,t)=>({"Content-Type":e,...t}),fe=class{#o;#a;env={};#c;finalized=!1;error;#u;#d;#l;#h;#_;#p;#f;#t;#m;constructor(e,t){this.#o=e,t&&(this.#d=t.executionCtx,this.env=t.env,this.#p=t.notFoundHandler,this.#m=t.path,this.#t=t.matchResult)}get req(){return this.#a??=new he(this.#o,this.#m,this.#t),this.#a}get event(){if(this.#d&&"respondWith"in this.#d)return this.#d;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#d)return this.#d;throw Error("This context has no ExecutionContext")}get res(){return this.#l||=new Response(null,{headers:this.#f??=new Headers})}set res(e){if(this.#l&&e){e=new Response(e.body,e);for(const[t,i]of this.#l.headers.entries())if("content-type"!==t)if("set-cookie"===t){const t=this.#l.headers.getSetCookie();e.headers.delete("set-cookie");for(const i of t)e.headers.append("set-cookie",i)}else e.headers.set(t,i)}this.#l=e,this.finalized=!0}render=(...e)=>(this.#_??=e=>this.html(e),this.#_(...e));setLayout=e=>this.#h=e;getLayout=()=>this.#h;setRenderer=e=>{this.#_=e};header=(e,t,i)=>{this.finalized&&(this.#l=new Response(this.#l.body,this.#l));const n=this.#l?this.#l.headers:this.#f??=new Headers;void 0===t?n.delete(e):i?.append?n.append(e,t):n.set(e,t)};status=e=>{this.#u=e};set=(e,t)=>{this.#c??=new Map,this.#c.set(e,t)};get=e=>this.#c?this.#c.get(e):void 0;get var(){return this.#c?Object.fromEntries(this.#c):{}}#g(e,t,i){const n=this.#l?new Headers(this.#l.headers):this.#f??new Headers;if("object"==typeof t&&"headers"in t){const e=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(const[t,i]of e)"set-cookie"===t.toLowerCase()?n.append(t,i):n.set(t,i)}if(i)for(const[e,t]of Object.entries(i))if("string"==typeof t)n.set(e,t);else{n.delete(e);for(const i of t)n.append(e,i)}const s="number"==typeof t?t:t?.status??this.#u;return new Response(e,{status:s,headers:n})}newResponse=(...e)=>this.#g(...e);body=(e,t,i)=>this.#g(e,t,i);text=(e,t,i)=>this.#f||this.#u||t||i||this.finalized?this.#g(e,t,pe("text/plain; charset=UTF-8",i)):new Response(e);json=(e,t,i)=>this.#g(JSON.stringify(e),t,pe("application/json",i));html=(e,t,i)=>{const n=e=>this.#g(e,t,pe("text/html; charset=UTF-8",i));return"object"==typeof e?_e(e,1,!1,{}).then(n):n(e)};redirect=(e,t)=>{const i=String(e);return this.header("Location",/[^\x00-\xFF]/.test(i)?encodeURI(i):i),this.newResponse(null,t??302)};notFound=()=>(this.#p??=()=>new Response,this.#p(this))},me="ALL",ge=["get","post","put","delete","options","patch"],ye="Can not add a route since the matcher is already built.",Ee=class extends Error{},ve=e=>e.text("404 Not Found",404),be=(e,t)=>{if("getResponse"in e){const i=e.getResponse();return t.newResponse(i.body,i)}return console.error(e),t.text("Internal Server Error",500)},we=class e{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#m="/";routes=[];constructor(e={}){[...ge,"all"].forEach((e=>{this[e]=(t,...i)=>("string"==typeof t?this.#m=t:this.#y(e,this.#m,t),i.forEach((t=>{this.#y(e,this.#m,t)})),this)})),this.on=(e,t,...i)=>{for(const n of[t].flat()){this.#m=n;for(const t of[e].flat())i.map((e=>{this.#y(t.toUpperCase(),this.#m,e)}))}return this},this.use=(e,...t)=>("string"==typeof e?this.#m=e:(this.#m="*",t.unshift(e)),t.forEach((e=>{this.#y(me,this.#m,e)})),this);const{strict:t,...i}=e;Object.assign(this,i),this.getPath=t??1?e.getPath??B:q}#E(){const t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#p=this.#p,t.routes=this.routes,t}#p=ve;errorHandler=be;route(e,t){const i=this.basePath(e);return t.routes.map((e=>{let n;t.errorHandler===be?n=e.handler:(n=async(i,n)=>(await ae([],t.errorHandler)(i,(()=>e.handler(i,n)))).res,n.__COMPOSED_HANDLER=e.handler),i.#y(e.method,e.path,n)})),this}basePath(e){const t=this.#E();return t._basePath=K(this._basePath,e),t}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#p=e,this);mount(e,t,i){let n,s;i&&("function"==typeof i?s=i:(s=i.optionHandler,n=!1===i.replaceRequest?e=>e:i.replaceRequest));const r=s?e=>{const t=s(e);return Array.isArray(t)?t:[t]}:e=>{let t;try{t=e.executionCtx}catch{}return[e.env,t]};return n||=(()=>{const t=K(this._basePath,e),i="/"===t?0:t.length;return e=>{const t=new URL(e.url);return t.pathname=t.pathname.slice(i)||"/",new Request(t,e)}})(),this.#y(me,K(e,"*"),(async(e,i)=>{const s=await t(n(e.req.raw),...r(e));if(s)return s;await i()})),this}#y(e,t,i){e=e.toUpperCase(),t=K(this._basePath,t);const n={basePath:this._basePath,path:t,method:e,handler:i};this.router.add(e,t,[i,n]),this.routes.push(n)}#v(e,t){if(e instanceof Error)return this.errorHandler(e,t);throw e}#b(e,t,i,n){if("HEAD"===n)return(async()=>new Response(null,await this.#b(e,t,i,"GET")))();const s=this.getPath(e,{env:i}),r=this.router.match(n,s),o=new fe(e,{path:s,matchResult:r,env:i,executionCtx:t,notFoundHandler:this.#p});if(1===r[0].length){let e;try{e=r[0][0][0][0](o,(async()=>{o.res=await this.#p(o)}))}catch(e){return this.#v(e,o)}return e instanceof Promise?e.then((e=>e||(o.finalized?o.res:this.#p(o)))).catch((e=>this.#v(e,o))):e??this.#p(o)}const a=ae(r[0],this.errorHandler,this.#p);return(async()=>{try{const e=await a(o);if(!e.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return e.res}catch(e){return this.#v(e,o)}})()}fetch=(e,...t)=>this.#b(e,t[1],t[0],e.method);request=(e,t,i,n)=>e instanceof Request?this.fetch(t?new Request(e,t):e,i,n):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${K("/",e)}`,t),i,n));fire=()=>{addEventListener("fetch",(e=>{e.respondWith(this.#b(e.request,e,void 0,e.request.method))}))}},Oe=[];function Ae(e,t){const i=this.buildAllMatchers(),n=(e,t)=>{const n=i[e]||i[me],s=n[2][t];if(s)return s;const r=t.match(n[0]);if(!r)return[[],Oe];const o=r.indexOf("",1);return[n[1][o],r]};return this.match=n,n(e,t)}var Se="[^/]+",Ie=".*",Ne="(?:|/.*)",Ce=Symbol(),Te=new Set(".\\+*[^]$()");function xe(e,t){return 1===e.length?1===t.length?e<t?-1:1:-1:1===t.length||e===Ie||e===Ne?1:t===Ie||t===Ne?-1:e===Se?1:t===Se?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Re=class e{#w;#O;#A=Object.create(null);insert(t,i,n,s,r){if(0===t.length){if(void 0!==this.#w)throw Ce;if(r)return;return void(this.#w=i)}const[o,...a]=t,c="*"===o?0===a.length?["","",Ie]:["","",Se]:"/*"===o?["","",Ne]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let u;if(c){const t=c[1];let i=c[2]||Se;if(t&&c[2]){if(".*"===i)throw Ce;if(i=i.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(i))throw Ce}if(u=this.#A[i],!u){if(Object.keys(this.#A).some((e=>e!==Ie&&e!==Ne)))throw Ce;if(r)return;u=this.#A[i]=new e,""!==t&&(u.#O=s.varIndex++)}r||""===t||n.push([t,u.#O])}else if(u=this.#A[o],!u){if(Object.keys(this.#A).some((e=>e.length>1&&e!==Ie&&e!==Ne)))throw Ce;if(r)return;u=this.#A[o]=new e}u.insert(a,i,n,s,r)}buildRegExpStr(){const e=Object.keys(this.#A).sort(xe).map((e=>{const t=this.#A[e];return("number"==typeof t.#O?`(${e})@${t.#O}`:Te.has(e)?`\\${e}`:e)+t.buildRegExpStr()}));return"number"==typeof this.#w&&e.unshift(`#${this.#w}`),0===e.length?"":1===e.length?e[0]:"(?:"+e.join("|")+")"}},ke=class{#S={varIndex:0};#I=new Re;insert(e,t,i){const n=[],s=[];for(let t=0;;){let i=!1;if(e=e.replace(/\{[^}]+\}/g,(e=>{const n=`@\\${t}`;return s[t]=[n,e],t++,i=!0,n})),!i)break}const r=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let e=s.length-1;e>=0;e--){const[t]=s[e];for(let i=r.length-1;i>=0;i--)if(-1!==r[i].indexOf(t)){r[i]=r[i].replace(t,s[e][1]);break}}return this.#I.insert(r,t,n,this.#S,i),n}buildRegExp(){let e=this.#I.buildRegExpStr();if(""===e)return[/^$/,[],[]];let t=0;const i=[],n=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,((e,s,r)=>void 0!==s?(i[++t]=Number(s),"$()"):void 0!==r?(n[Number(r)]=++t,""):"")),[new RegExp(`^${e}`),i,n]}},De=[/^$/,[],Object.create(null)],Le=Object.create(null);function je(e){return Le[e]??=new RegExp("*"===e?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,((e,t)=>t?`\\${t}`:"(?:|/.*)"))}$`)}function Fe(e,t){if(e)for(const i of Object.keys(e).sort(((e,t)=>t.length-e.length)))if(je(i).test(t))return[...e[i]]}var Ue,Pe,Me=class{name="RegExpRouter";#N;#C;constructor(){this.#N={[me]:Object.create(null)},this.#C={[me]:Object.create(null)}}add(e,t,i){const n=this.#N,s=this.#C;if(!n||!s)throw new Error(ye);n[e]||[n,s].forEach((t=>{t[e]=Object.create(null),Object.keys(t[me]).forEach((i=>{t[e][i]=[...t[me][i]]}))})),"/*"===t&&(t="*");const r=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){const o=je(t);return e===me?Object.keys(n).forEach((e=>{n[e][t]||=Fe(n[e],t)||Fe(n[me],t)||[]})):n[e][t]||=Fe(n[e],t)||Fe(n[me],t)||[],Object.keys(n).forEach((t=>{e!==me&&e!==t||Object.keys(n[t]).forEach((e=>{o.test(e)&&n[t][e].push([i,r])}))})),void Object.keys(s).forEach((t=>{e!==me&&e!==t||Object.keys(s[t]).forEach((e=>o.test(e)&&s[t][e].push([i,r])))}))}const o=W(t)||[t];for(let t=0,a=o.length;t<a;t++){const c=o[t];Object.keys(s).forEach((o=>{e!==me&&e!==o||(s[o][c]||=[...Fe(n[o],c)||Fe(n[me],c)||[]],s[o][c].push([i,r-a+t+1]))}))}}match=Ae;buildAllMatchers(){const e=Object.create(null);return Object.keys(this.#C).concat(Object.keys(this.#N)).forEach((t=>{e[t]||=this.#T(t)})),this.#N=this.#C=void 0,Le=Object.create(null),e}#T(e){const t=[];let i=e===me;return[this.#N,this.#C].forEach((n=>{const s=n[e]?Object.keys(n[e]).map((t=>[t,n[e][t]])):[];0!==s.length?(i||=!0,t.push(...s)):e!==me&&t.push(...Object.keys(n[me]).map((e=>[e,n[me][e]])))})),i?function(e){const t=new ke,i=[];if(0===e.length)return De;const n=e.map((e=>[!/\*|\/:/.test(e[0]),...e])).sort((([e,t],[i,n])=>e?1:i?-1:t.length-n.length)),s=Object.create(null);for(let e=0,r=-1,o=n.length;e<o;e++){const[o,a,c]=n[e];let u;o?s[a]=[c.map((([e])=>[e,Object.create(null)])),Oe]:r++;try{u=t.insert(a,r,o)}catch(e){throw e===Ce?new Ee(a):e}o||(i[r]=c.map((([e,t])=>{const i=Object.create(null);for(t-=1;t>=0;t--){const[e,n]=u[t];i[e]=n}return[e,i]})))}const[r,o,a]=t.buildRegExp();for(let e=0,t=i.length;e<t;e++)for(let t=0,n=i[e].length;t<n;t++){const n=i[e][t]?.[1];if(!n)continue;const s=Object.keys(n);for(let e=0,t=s.length;e<t;e++)n[s[e]]=a[n[s[e]]]}const c=[];for(const e in o)c[e]=i[o[e]];return[r,c,s]}(t):null}},Ze=class{name="SmartRouter";#x=[];#C=[];constructor(e){this.#x=e.routers}add(e,t,i){if(!this.#C)throw new Error(ye);this.#C.push([e,t,i])}match(e,t){if(!this.#C)throw new Error("Fatal error");const i=this.#x,n=this.#C,s=i.length;let r,o=0;for(;o<s;o++){const s=i[o];try{for(let e=0,t=n.length;e<t;e++)s.add(...n[e]);r=s.match(e,t)}catch(e){if(e instanceof Ee)continue;throw e}this.match=s.match.bind(s),this.#x=[s],this.#C=void 0;break}if(o===s)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,r}get activeRouter(){if(this.#C||1!==this.#x.length)throw new Error("No active router has been determined yet.");return this.#x[0]}},$e=Object.create(null),He=class e{#R;#A;#k;#D=0;#L=$e;constructor(e,t,i){if(this.#A=i||Object.create(null),this.#R=[],e&&t){const i=Object.create(null);i[e]={handler:t,possibleKeys:[],score:0},this.#R=[i]}this.#k=[]}insert(t,i,n){this.#D=++this.#D;let s=this;const r=(e=>{const{groups:t,path:i}=(e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,((e,i)=>{const n=`@${i}`;return t.push([n,e]),n})),{groups:t,path:e}})(e);return((e,t)=>{for(let i=t.length-1;i>=0;i--){const[n]=t[i];for(let s=e.length-1;s>=0;s--)if(e[s].includes(n)){e[s]=e[s].replace(n,t[i][1]);break}}return e})($(i),t)})(i),o=[];for(let t=0,i=r.length;t<i;t++){const i=r[t],n=z(i,r[t+1]),a=Array.isArray(n)?n[0]:i;a in s.#A?(s=s.#A[a],n&&o.push(n[1])):(s.#A[a]=new e,n&&(s.#k.push(n),o.push(n[1])),s=s.#A[a])}return s.#R.push({[t]:{handler:n,possibleKeys:o.filter(((e,t,i)=>i.indexOf(e)===t)),score:this.#D}}),s}#j(e,t,i,n){const s=[];for(let r=0,o=e.#R.length;r<o;r++){const o=e.#R[r],a=o[t]||o[me],c={};if(void 0!==a&&(a.params=Object.create(null),s.push(a),i!==$e||n&&n!==$e))for(let e=0,t=a.possibleKeys.length;e<t;e++){const t=a.possibleKeys[e],s=c[a.score];a.params[t]=n?.[t]&&!s?n[t]:i[t]??n?.[t],c[a.score]=!0}}return s}search(e,t){const i=[];this.#L=$e;let n=[this];const s=$(t),r=[];for(let t=0,o=s.length;t<o;t++){const a=s[t],c=t===o-1,u=[];for(let o=0,d=n.length;o<d;o++){const d=n[o],l=d.#A[a];l&&(l.#L=d.#L,c?(l.#A["*"]&&i.push(...this.#j(l.#A["*"],e,d.#L)),i.push(...this.#j(l,e,d.#L))):u.push(l));for(let n=0,o=d.#k.length;n<o;n++){const o=d.#k[n],l=d.#L===$e?{}:{...d.#L};if("*"===o){const t=d.#A["*"];t&&(i.push(...this.#j(t,e,d.#L)),t.#L=l,u.push(t));continue}const[h,_,p]=o;if(!(a||p instanceof RegExp))continue;const f=d.#A[h],m=s.slice(t).join("/");if(p instanceof RegExp){const t=p.exec(m);if(t){if(l[_]=t[0],i.push(...this.#j(f,e,d.#L,l)),Object.keys(f.#A).length){f.#L=l;const e=t[0].match(/\//)?.length??0;(r[e]||=[]).push(f)}continue}}(!0===p||p.test(a))&&(l[_]=a,c?(i.push(...this.#j(f,e,l,d.#L)),f.#A["*"]&&i.push(...this.#j(f.#A["*"],e,l,d.#L))):(f.#L=l,u.push(f)))}}n=u.concat(r.shift()??[])}return i.length>1&&i.sort(((e,t)=>e.score-t.score)),[i.map((({handler:e,params:t})=>[e,t]))]}},ze=class{name="TrieRouter";#F;constructor(){this.#F=new He}add(e,t,i){const n=W(t);if(n)for(let t=0,s=n.length;t<s;t++)this.#F.insert(e,n[t],i);else this.#F.insert(e,t,i)}match(e,t){return this.#F.search(e,t)}},Ge=class extends we{constructor(e={}){super(e),this.router=e.router??new Ze({routers:[new Me,new ze]})}};!function(e){e.assertEqual=()=>{},e.assertIs=function(){},e.assertNever=function(){throw new Error},e.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},e.getValidEnumValues=t=>{const i=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of i)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},e.find=(e,t)=>{for(const i of e)if(t(i))return i},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ue||(Ue={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Pe||(Pe={}));const Be=Ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qe=e=>{switch(typeof e){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return Number.isNaN(e)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(e)?Be.array:null===e?Be.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Be.promise:"undefined"!=typeof Map&&e instanceof Map?Be.map:"undefined"!=typeof Set&&e instanceof Set?Be.set:"undefined"!=typeof Date&&e instanceof Date?Be.date:Be.object;default:return Be.unknown}},Ke=Ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class We extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)i._errors.push(t(s));else{let e=i,n=0;for(;n<s.path.length;){const i=s.path[n];n===s.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(s))):e[i]=e[i]||{_errors:[]},e=e[i],n++}}};return n(this),i}static assert(e){if(!(e instanceof We))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const n of this.issues)if(n.path.length>0){const i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}We.create=e=>new We(e);const Ve=(e,t)=>{let i;switch(e.code){case Ke.invalid_type:i=e.received===Be.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,Ue.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:i=`Unrecognized key(s) in object: ${Ue.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:i="Invalid input";break;case Ke.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Ue.joinValues(e.options)}`;break;case Ke.invalid_enum_value:i=`Invalid enum value. Expected ${Ue.joinValues(e.options)}, received '${e.received}'`;break;case Ke.invalid_arguments:i="Invalid function arguments";break;case Ke.invalid_return_type:i="Invalid function return type";break;case Ke.invalid_date:i="Invalid date";break;case Ke.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:Ue.assertNever(e.validation):i="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ke.too_small:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ke.too_big:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ke.custom:i="Invalid input";break;case Ke.invalid_intersection_types:i="Intersection results could not be merged";break;case Ke.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case Ke.not_finite:i="Number must be finite";break;default:i=t.defaultError,Ue.assertNever(e)}return{message:i}};let Xe=Ve;function Ye(){return Xe}const Je=e=>{const{data:t,path:i,errorMaps:n,issueData:s}=e,r=[...i,...s.path||[]],o={...s,path:r};if(void 0!==s.message)return{...s,path:r,message:s.message};let a="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)a=e(o,{data:t,defaultError:a}).message;return{...s,path:r,message:a}};function Qe(e,t){const i=Ye(),n=Je({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Ve?void 0:Ve].filter((e=>!!e))});e.common.issues.push(n)}class et{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if("aborted"===n.status)return tt;"dirty"===n.status&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const e of t){const t=await e.key,n=await e.value;i.push({key:t,value:n})}return et.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return tt;if("aborted"===s.status)return tt;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(i[t.value]=s.value)}return{status:e.value,value:i}}}const tt=Object.freeze({status:"aborted"}),it=e=>({status:"dirty",value:e}),nt=e=>({status:"valid",value:e}),st=e=>"aborted"===e.status,rt=e=>"dirty"===e.status,ot=e=>"valid"===e.status,at=e=>"undefined"!=typeof Promise&&e instanceof Promise;var ct;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(ct||(ct={}));class ut{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const dt=(e,t)=>{if(ot(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new We(e.common.issues);return this._error=t,this._error}}};function lt(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:n,description:s}=e;if(t&&(i||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??s.defaultError}:void 0===s.data?{message:r??n??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:r??i??s.defaultError}},description:s}}class ht{get description(){return this._def.description}_getType(e){return qe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:qe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new et,ctx:{common:e.parent.common,data:e.data,parsedType:qe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(at(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)},n=this._parseSync({data:e,path:i.path,parent:i});return dt(i,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return ot(i)?{value:i.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>ot(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)},n=this._parse({data:e,path:i.path,parent:i}),s=await(at(n)?n:Promise.resolve(n));return dt(i,s)}refine(e,t){const i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),r=()=>n.addIssue({code:Ke.custom,...i(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(r(),!1))):!!s||(r(),!1)}))}refinement(e,t){return this._refinement(((i,n)=>!!e(i)||(n.addIssue("function"==typeof t?t(i,n):t),!1)))}_refinement(e){return new hi({schema:this,typeName:Si.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return _i.create(this,this._def)}nullable(){return pi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kt.create(this)}promise(){return li.create(this,this._def)}or(e){return Xt.create([this,e],this._def)}and(e){return ei.create(this,e,this._def)}transform(e){return new hi({...lt(this._def),schema:this,typeName:Si.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new fi({...lt(this._def),innerType:this,defaultValue:t,typeName:Si.ZodDefault})}brand(){return new Ei({typeName:Si.ZodBranded,type:this,...lt(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new mi({...lt(this._def),innerType:this,catchValue:t,typeName:Si.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return vi.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _t=/^c[^\s-]{8,}$/i,pt=/^[0-9a-z]+$/,ft=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gt=/^[a-z0-9_-]{21}$/i,yt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Et=/^[-+]?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)?)??$/,vt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let bt;const wt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ot=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,At=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,St=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,It=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ct="((\\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])))",Tt=new RegExp(`^${Ct}$`);function xt(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Rt(e){let t=`${Ct}T${xt(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function kt(e,t){if(!yt.test(e))return!1;try{const[i]=e.split(".");if(!i)return!1;const n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==s?.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function Dt(e,t){return!("v4"!==t&&t||!Ot.test(e))||!("v6"!==t&&t||!St.test(e))}class Lt extends ht{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.string){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.string,received:t.parsedType}),tt}const t=new et;let i;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(i=this._getOrReturnCtx(e,i),n?Qe(i,{code:Ke.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&Qe(i,{code:Ke.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)vt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"email",code:Ke.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)bt||(bt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"emoji",code:Ke.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)mt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"uuid",code:Ke.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)gt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"nanoid",code:Ke.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cuid",code:Ke.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)pt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cuid2",code:Ke.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)ft.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"ulid",code:Ke.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Qe(i,{validation:"url",code:Ke.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"regex",code:Ke.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?Rt(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?Tt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?new RegExp(`^${xt(r)}$`).test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?Et.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"duration",code:Ke.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?(n=e.data,("v4"!==(s=r.version)&&s||!wt.test(n))&&("v6"!==s&&s||!At.test(n))&&(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"ip",code:Ke.invalid_string,message:r.message}),t.dirty())):"jwt"===r.kind?kt(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"jwt",code:Ke.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?Dt(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cidr",code:Ke.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?It.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"base64",code:Ke.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?Nt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"base64url",code:Ke.invalid_string,message:r.message}),t.dirty()):Ue.assertNever(r);var n,s;return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement((t=>e.test(t)),{validation:t,code:Ke.invalid_string,...ct.errToObj(i)})}_addCheck(e){return new Lt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ct.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ct.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ct.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ct.errToObj(e)})}datetime(e){return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ct.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===e?.precision?null:e?.precision,...ct.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ct.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ct.errToObj(t)})}nonempty(e){return this.min(1,ct.errToObj(e))}trim(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function jt(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=i>n?i:n;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}Lt.create=e=>new Lt({checks:[],typeName:Si.ZodString,coerce:e?.coerce??!1,...lt(e)});class Ft extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Be.number){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.number,received:t.parsedType}),tt}let t;const i=new et;for(const n of this._def.checks)"int"===n.kind?Ue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):"multipleOf"===n.kind?0!==jt(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.not_finite,message:n.message}),i.dirty()):Ue.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ct.toString(t))}setLimit(e,t,i,n){return new Ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:ct.toString(n)}]})}_addCheck(e){return new Ft({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Ue.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Ft.create=e=>new Ft({checks:[],typeName:Si.ZodNumber,coerce:e?.coerce||!1,...lt(e)});class Ut extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Be.bigint)return this._getInvalidInput(e);let t;const i=new et;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:Ke.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):Ue.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.bigint,received:t.parsedType}),tt}gte(e,t){return this.setLimit("min",e,!0,ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ct.toString(t))}setLimit(e,t,i,n){return new Ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:ct.toString(n)}]})}_addCheck(e){return new Ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ut.create=e=>new Ut({checks:[],typeName:Si.ZodBigInt,coerce:e?.coerce??!1,...lt(e)});class Pt extends ht{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Be.boolean){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.boolean,received:t.parsedType}),tt}return nt(e.data)}}Pt.create=e=>new Pt({typeName:Si.ZodBoolean,coerce:e?.coerce||!1,...lt(e)});class Mt extends ht{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.date){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.date,received:t.parsedType}),tt}if(Number.isNaN(e.data.getTime()))return Qe(this._getOrReturnCtx(e),{code:Ke.invalid_date}),tt;const t=new et;let i;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:Ke.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Ue.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Mt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Mt.create=e=>new Mt({checks:[],coerce:e?.coerce||!1,typeName:Si.ZodDate,...lt(e)});class Zt extends ht{_parse(e){if(this._getType(e)!==Be.symbol){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.symbol,received:t.parsedType}),tt}return nt(e.data)}}Zt.create=e=>new Zt({typeName:Si.ZodSymbol,...lt(e)});class $t extends ht{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.undefined,received:t.parsedType}),tt}return nt(e.data)}}$t.create=e=>new $t({typeName:Si.ZodUndefined,...lt(e)});class Ht extends ht{_parse(e){if(this._getType(e)!==Be.null){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.null,received:t.parsedType}),tt}return nt(e.data)}}Ht.create=e=>new Ht({typeName:Si.ZodNull,...lt(e)});class zt extends ht{constructor(){super(...arguments),this._any=!0}_parse(e){return nt(e.data)}}zt.create=e=>new zt({typeName:Si.ZodAny,...lt(e)});class Gt extends ht{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nt(e.data)}}Gt.create=e=>new Gt({typeName:Si.ZodUnknown,...lt(e)});class Bt extends ht{_parse(e){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.never,received:t.parsedType}),tt}}Bt.create=e=>new Bt({typeName:Si.ZodNever,...lt(e)});class qt extends ht{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.void,received:t.parsedType}),tt}return nt(e.data)}}qt.create=e=>new qt({typeName:Si.ZodVoid,...lt(e)});class Kt extends ht{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==Be.array)return Qe(t,{code:Ke.invalid_type,expected:Be.array,received:t.parsedType}),tt;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(Qe(t,{code:e?Ke.too_big:Ke.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Qe(t,{code:Ke.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Qe(t,{code:Ke.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map(((e,i)=>n.type._parseAsync(new ut(t,e,t.path,i))))).then((e=>et.mergeArray(i,e)));const s=[...t.data].map(((e,i)=>n.type._parseSync(new ut(t,e,t.path,i))));return et.mergeArray(i,s)}get element(){return this._def.type}min(e,t){return new Kt({...this._def,minLength:{value:e,message:ct.toString(t)}})}max(e,t){return new Kt({...this._def,maxLength:{value:e,message:ct.toString(t)}})}length(e,t){return new Kt({...this._def,exactLength:{value:e,message:ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function Wt(e){if(e instanceof Vt){const t={};for(const i in e.shape)t[i]=_i.create(Wt(e.shape[i]));return new Vt({...e._def,shape:()=>t})}return e instanceof Kt?new Kt({...e._def,type:Wt(e.element)}):e instanceof _i?_i.create(Wt(e.unwrap())):e instanceof pi?pi.create(Wt(e.unwrap())):e instanceof ti?ti.create(e.items.map((e=>Wt(e)))):e}Kt.create=(e,t)=>new Kt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Si.ZodArray,...lt(t)});class Vt extends ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ue.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Be.object){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.object,received:t.parsedType}),tt}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),r=[];if(!(this._def.catchall instanceof Bt&&"strip"===this._def.unknownKeys))for(const e in i.data)s.includes(e)||r.push(e);const o=[];for(const e of s)o.push({key:{status:"valid",value:e},value:n[e]._parse(new ut(i,i.data[e],i.path,e)),alwaysSet:e in i.data});if(this._def.catchall instanceof Bt){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:i.data[e]}});else if("strict"===e)r.length>0&&(Qe(i,{code:Ke.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r)o.push({key:{status:"valid",value:t},value:e._parse(new ut(i,i.data[t],i.path,t)),alwaysSet:t in i.data})}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const i=await t.key,n=await t.value;e.push({key:i,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>et.mergeObjectSync(t,e))):et.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return new Vt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,i)=>{const n=this._def.errorMap?.(t,i).message??i.defaultError;return"unrecognized_keys"===t.code?{message:ct.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Si.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Vt({...this._def,catchall:e})}pick(e){const t={};for(const i of Ue.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new Vt({...this._def,shape:()=>t})}omit(e){const t={};for(const i of Ue.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new Vt({...this._def,shape:()=>t})}deepPartial(){return Wt(this)}partial(e){const t={};for(const i of Ue.objectKeys(this.shape)){const n=this.shape[i];t[i]=e&&!e[i]?n:n.optional()}return new Vt({...this._def,shape:()=>t})}required(e){const t={};for(const i of Ue.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let e=this.shape[i];for(;e instanceof _i;)e=e._def.innerType;t[i]=e}return new Vt({...this._def,shape:()=>t})}keyof(){return ci(Ue.objectKeys(this.shape))}}Vt.create=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strip",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)}),Vt.strictCreate=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strict",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)}),Vt.lazycreate=(e,t)=>new Vt({shape:e,unknownKeys:"strip",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)});class Xt extends ht{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;if(t.common.async)return Promise.all(i.map((async e=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const i=e.map((e=>new We(e.ctx.common.issues)));return Qe(t,{code:Ke.invalid_union,unionErrors:i}),tt}));{let e;const n=[];for(const s of i){const i={...t,common:{...t.common,issues:[]},parent:null},r=s._parseSync({data:t.data,path:t.path,parent:i});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:i}),i.common.issues.length&&n.push(i.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new We(e)));return Qe(t,{code:Ke.invalid_union,unionErrors:s}),tt}}get options(){return this._def.options}}Xt.create=(e,t)=>new Xt({options:e,typeName:Si.ZodUnion,...lt(t)});const Yt=e=>e instanceof oi?Yt(e.schema):e instanceof hi?Yt(e.innerType()):e instanceof ai?[e.value]:e instanceof ui?e.options:e instanceof di?Ue.objectValues(e.enum):e instanceof fi?Yt(e._def.innerType):e instanceof $t?[void 0]:e instanceof Ht?[null]:e instanceof _i?[void 0,...Yt(e.unwrap())]:e instanceof pi?[null,...Yt(e.unwrap())]:e instanceof Ei||e instanceof bi?Yt(e.unwrap()):e instanceof mi?Yt(e._def.innerType):[];class Jt extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.object)return Qe(t,{code:Ke.invalid_type,expected:Be.object,received:t.parsedType}),tt;const i=this.discriminator,n=this.optionsMap.get(t.data[i]);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(Qe(t,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const n=new Map;for(const i of t){const t=Yt(i.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new Jt({typeName:Si.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...lt(i)})}}function Qt(e,t){const i=qe(e),n=qe(t);if(e===t)return{valid:!0,data:e};if(i===Be.object&&n===Be.object){const i=Ue.objectKeys(t),n=Ue.objectKeys(e).filter((e=>-1!==i.indexOf(e))),s={...e,...t};for(const i of n){const n=Qt(e[i],t[i]);if(!n.valid)return{valid:!1};s[i]=n.data}return{valid:!0,data:s}}if(i===Be.array&&n===Be.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let n=0;n<e.length;n++){const s=Qt(e[n],t[n]);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}return i===Be.date&&n===Be.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ei extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(e,n)=>{if(st(e)||st(n))return tt;const s=Qt(e.value,n.value);return s.valid?((rt(e)||rt(n))&&t.dirty(),{status:t.value,value:s.data}):(Qe(i,{code:Ke.invalid_intersection_types}),tt)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}ei.create=(e,t,i)=>new ei({left:e,right:t,typeName:Si.ZodIntersection,...lt(i)});class ti extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.array)return Qe(i,{code:Ke.invalid_type,expected:Be.array,received:i.parsedType}),tt;if(i.data.length<this._def.items.length)return Qe(i,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tt;!this._def.rest&&i.data.length>this._def.items.length&&(Qe(i,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ut(i,e,i.path,t)):null})).filter((e=>!!e));return i.common.async?Promise.all(n).then((e=>et.mergeArray(t,e))):et.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ti({...this._def,rest:e})}}ti.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ti({items:e,typeName:Si.ZodTuple,rest:null,...lt(t)})};class ii extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.object)return Qe(i,{code:Ke.invalid_type,expected:Be.object,received:i.parsedType}),tt;const n=[],s=this._def.keyType,r=this._def.valueType;for(const e in i.data)n.push({key:s._parse(new ut(i,e,i.path,e)),value:r._parse(new ut(i,i.data[e],i.path,e)),alwaysSet:e in i.data});return i.common.async?et.mergeObjectAsync(t,n):et.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return new ii(t instanceof ht?{keyType:e,valueType:t,typeName:Si.ZodRecord,...lt(i)}:{keyType:Lt.create(),valueType:e,typeName:Si.ZodRecord,...lt(t)})}}class ni extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.map)return Qe(i,{code:Ke.invalid_type,expected:Be.map,received:i.parsedType}),tt;const n=this._def.keyType,s=this._def.valueType,r=[...i.data.entries()].map((([e,t],r)=>({key:n._parse(new ut(i,e,i.path,[r,"key"])),value:s._parse(new ut(i,t,i.path,[r,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of r){const n=await i.key,s=await i.value;if("aborted"===n.status||"aborted"===s.status)return tt;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const i of r){const n=i.key,s=i.value;if("aborted"===n.status||"aborted"===s.status)return tt;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}ni.create=(e,t,i)=>new ni({valueType:t,keyType:e,typeName:Si.ZodMap,...lt(i)});class si extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.set)return Qe(i,{code:Ke.invalid_type,expected:Be.set,received:i.parsedType}),tt;const n=this._def;null!==n.minSize&&i.data.size<n.minSize.value&&(Qe(i,{code:Ke.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&i.data.size>n.maxSize.value&&(Qe(i,{code:Ke.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function r(e){const i=new Set;for(const n of e){if("aborted"===n.status)return tt;"dirty"===n.status&&t.dirty(),i.add(n.value)}return{status:t.value,value:i}}const o=[...i.data.values()].map(((e,t)=>s._parse(new ut(i,e,i.path,t))));return i.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new si({...this._def,minSize:{value:e,message:ct.toString(t)}})}max(e,t){return new si({...this._def,maxSize:{value:e,message:ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}si.create=(e,t)=>new si({valueType:e,minSize:null,maxSize:null,typeName:Si.ZodSet,...lt(t)});class ri extends ht{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.function)return Qe(t,{code:Ke.invalid_type,expected:Be.function,received:t.parsedType}),tt;function i(e,i){return Je({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ve].filter((e=>!!e)),issueData:{code:Ke.invalid_arguments,argumentsError:i}})}function n(e,i){return Je({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ve].filter((e=>!!e)),issueData:{code:Ke.invalid_return_type,returnTypeError:i}})}const s={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof li){const e=this;return nt((async function(...t){const o=new We([]),a=await e._def.args.parseAsync(t,s).catch((e=>{throw o.addIssue(i(t,e)),o})),c=await Reflect.apply(r,this,a);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return nt((function(...t){const o=e._def.args.safeParse(t,s);if(!o.success)throw new We([i(t,o.error)]);const a=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(a,s);if(!c.success)throw new We([n(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ri({...this._def,args:ti.create(e).rest(Gt.create())})}returns(e){return new ri({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ri({args:e||ti.create([]).rest(Gt.create()),returns:t||Gt.create(),typeName:Si.ZodFunction,...lt(i)})}}class oi extends ht{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oi.create=(e,t)=>new oi({getter:e,typeName:Si.ZodLazy,...lt(t)});class ai extends ht{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:Ke.invalid_literal,expected:this._def.value}),tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ci(e,t){return new ui({values:e,typeName:Si.ZodEnum,...lt(t)})}ai.create=(e,t)=>new ai({value:e,typeName:Si.ZodLiteral,...lt(t)});class ui extends ht{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Qe(t,{expected:Ue.joinValues(this._def.values),received:t.parsedType,code:Ke.invalid_type}),tt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:Ke.invalid_enum_value,options:this._def.values}),tt}return nt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ui.create(e,{...this._def,...t})}exclude(e,t=this._def){return ui.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ui.create=ci;class di extends ht{_parse(e){const t=Ue.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Be.string&&i.parsedType!==Be.number){const e=Ue.objectValues(t);return Qe(i,{expected:Ue.joinValues(e),received:i.parsedType,code:Ke.invalid_type}),tt}if(this._cache||(this._cache=new Set(Ue.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Ue.objectValues(t);return Qe(i,{received:i.data,code:Ke.invalid_enum_value,options:e}),tt}return nt(e.data)}get enum(){return this._def.values}}di.create=(e,t)=>new di({values:e,typeName:Si.ZodNativeEnum,...lt(t)});class li extends ht{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.promise&&!1===t.common.async)return Qe(t,{code:Ke.invalid_type,expected:Be.promise,received:t.parsedType}),tt;const i=t.parsedType===Be.promise?t.data:Promise.resolve(t.data);return nt(i.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}li.create=(e,t)=>new li({type:e,typeName:Si.ZodPromise,...lt(t)});class hi extends ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{Qe(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(i.data,s);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return tt;const n=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===n.status?tt:"dirty"===n.status||"dirty"===t.value?it(n.value):n}));{if("aborted"===t.value)return tt;const n=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===n.status?tt:"dirty"===n.status||"dirty"===t.value?it(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===n.status?tt:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?tt:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===n.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ot(e))return tt;const r=n.transform(e.value,s);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>ot(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):tt))}Ue.assertNever(n)}}hi.create=(e,t,i)=>new hi({schema:e,typeName:Si.ZodEffects,effect:t,...lt(i)}),hi.createWithPreprocess=(e,t,i)=>new hi({schema:t,effect:{type:"preprocess",transform:e},typeName:Si.ZodEffects,...lt(i)});class _i extends ht{_parse(e){return this._getType(e)===Be.undefined?nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_i.create=(e,t)=>new _i({innerType:e,typeName:Si.ZodOptional,...lt(t)});class pi extends ht{_parse(e){return this._getType(e)===Be.null?nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pi.create=(e,t)=>new pi({innerType:e,typeName:Si.ZodNullable,...lt(t)});class fi extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===Be.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fi.create=(e,t)=>new fi({innerType:e,typeName:Si.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...lt(t)});class mi extends ht{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return at(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new We(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new We(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}mi.create=(e,t)=>new mi({innerType:e,typeName:Si.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...lt(t)});class gi extends ht{_parse(e){if(this._getType(e)!==Be.nan){const t=this._getOrReturnCtx(e);return Qe(t,{code:Ke.invalid_type,expected:Be.nan,received:t.parsedType}),tt}return{status:"valid",value:e.data}}}gi.create=e=>new gi({typeName:Si.ZodNaN,...lt(e)});const yi=Symbol("zod_brand");class Ei extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class vi extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?tt:"dirty"===e.status?(t.dirty(),it(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})();{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?tt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(e,t){return new vi({in:e,out:t,typeName:Si.ZodPipeline})}}class bi extends ht{_parse(e){const t=this._def.innerType._parse(e),i=e=>(ot(e)&&(e.value=Object.freeze(e.value)),e);return at(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}}function wi(e,t){const i="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof i?{message:i}:i}function Oi(e,t={},i){return e?zt.create().superRefine(((n,s)=>{const r=e(n);if(r instanceof Promise)return r.then((e=>{if(!e){const e=wi(t,n),r=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:r})}}));if(!r){const e=wi(t,n),r=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:r})}})):zt.create()}bi.create=(e,t)=>new bi({innerType:e,typeName:Si.ZodReadonly,...lt(t)});const Ai={object:Vt.lazycreate};var Si;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Si||(Si={}));const Ii=Lt.create,Ni=Ft.create,Ci=gi.create,Ti=Ut.create,xi=Pt.create,Ri=Mt.create,ki=Zt.create,Di=$t.create,Li=Ht.create,ji=zt.create,Fi=Gt.create,Ui=Bt.create,Pi=qt.create,Mi=Kt.create,Zi=Vt.create,$i=Vt.strictCreate,Hi=Xt.create,zi=Jt.create,Gi=ei.create,Bi=ti.create,qi=ii.create,Ki=ni.create,Wi=si.create,Vi=ri.create,Xi=oi.create,Yi=ai.create,Ji=ui.create,Qi=di.create,en=li.create,tn=hi.create,nn=_i.create,sn=pi.create,rn=hi.createWithPreprocess,on=vi.create,an={string:e=>Lt.create({...e,coerce:!0}),number:e=>Ft.create({...e,coerce:!0}),boolean:e=>Pt.create({...e,coerce:!0}),bigint:e=>Ut.create({...e,coerce:!0}),date:e=>Mt.create({...e,coerce:!0})};var cn=Object.freeze({__proto__:null,BRAND:yi,DIRTY:it,EMPTY_PATH:[],INVALID:tt,NEVER:tt,OK:nt,ParseStatus:et,Schema:ht,ZodAny:zt,ZodArray:Kt,ZodBigInt:Ut,ZodBoolean:Pt,ZodBranded:Ei,ZodCatch:mi,ZodDate:Mt,ZodDefault:fi,ZodDiscriminatedUnion:Jt,ZodEffects:hi,ZodEnum:ui,ZodError:We,get ZodFirstPartyTypeKind(){return Si},ZodFunction:ri,ZodIntersection:ei,ZodIssueCode:Ke,ZodLazy:oi,ZodLiteral:ai,ZodMap:ni,ZodNaN:gi,ZodNativeEnum:di,ZodNever:Bt,ZodNull:Ht,ZodNullable:pi,ZodNumber:Ft,ZodObject:Vt,ZodOptional:_i,ZodParsedType:Be,ZodPipeline:vi,ZodPromise:li,ZodReadonly:bi,ZodRecord:ii,ZodSchema:ht,ZodSet:si,ZodString:Lt,ZodSymbol:Zt,ZodTransformer:hi,ZodTuple:ti,ZodType:ht,ZodUndefined:$t,ZodUnion:Xt,ZodUnknown:Gt,ZodVoid:qt,addIssueToContext:Qe,any:ji,array:Mi,bigint:Ti,boolean:xi,coerce:an,custom:Oi,date:Ri,datetimeRegex:Rt,defaultErrorMap:Ve,discriminatedUnion:zi,effect:tn,enum:Ji,function:Vi,getErrorMap:Ye,getParsedType:qe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Oi((t=>t instanceof e),t),intersection:Gi,isAborted:st,isAsync:at,isDirty:rt,isValid:ot,late:Ai,lazy:Xi,literal:Yi,makeIssue:Je,map:Ki,nan:Ci,nativeEnum:Qi,never:Ui,null:Li,nullable:sn,number:Ni,object:Zi,get objectUtil(){return Pe},oboolean:()=>xi().optional(),onumber:()=>Ni().optional(),optional:nn,ostring:()=>Ii().optional(),pipeline:on,preprocess:rn,promise:en,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),record:qi,set:Wi,setErrorMap:function(e){Xe=e},strictObject:$i,string:Ii,symbol:ki,transformer:tn,tuple:Bi,undefined:Di,union:Hi,unknown:Fi,get util(){return Ue},void:Pi});function un(e,t){const i={};return Object.keys(e.paths).forEach((n=>{i[K(t.replaceAll(/:([^\/]+)/g,"{$1}"),n)]=e.paths[n]})),{...e,paths:i}}function dn(e){return/^application\/([a-z-\.]+\+)?json/.test(e)}function ln(e){return e.startsWith("multipart/form-data")||e.startsWith("application/x-www-form-urlencoded")}r(cn);var hn,_n=Object.freeze({__proto__:null,OpenAPIHono:class e extends Ge{openAPIRegistry;defaultHook;constructor(e){super(e),this.openAPIRegistry=new p,this.defaultHook=e?.defaultHook}openapi=({middleware:e,hide:t,...i},n,s=this.defaultHook)=>{t||this.openAPIRegistry.registerPath(i);const r=[];if(i.request?.query){const e=oe("query",i.request.query,s);r.push(e)}if(i.request?.params){const e=oe("param",i.request.params,s);r.push(e)}if(i.request?.headers){const e=oe("header",i.request.headers,s);r.push(e)}if(i.request?.cookies){const e=oe("cookie",i.request.cookies,s);r.push(e)}const o=i.request?.body?.content;if(o)for(const e of Object.keys(o)){if(!o[e])continue;const t=o[e].schema;if(t instanceof ht){if(dn(e)){const e=oe("json",t,s);r.push(i.request?.body?.required?e:async(t,i)=>{if(t.req.header("content-type")&&dn(t.req.header("content-type")))return await e(t,i);t.req.addValidatedData("json",{}),await i()})}if(ln(e)){const e=oe("form",t,s);r.push(i.request?.body?.required?e:async(t,i)=>{if(t.req.header("content-type")&&ln(t.req.header("content-type")))return await e(t,i);t.req.addValidatedData("form",{}),await i()})}}}const a=e?Array.isArray(e)?e:[e]:[];return this.on([i.method],i.path.replaceAll(/\/{(.+?)}/g,"/:$1"),...a,...r,n),this};getOpenAPIDocument=e=>{const t=new U(this.openAPIRegistry.definitions).generateDocument(e);return this._basePath?un(t,this._basePath):t};getOpenAPI31Document=e=>{const t=new Z(this.openAPIRegistry.definitions).generateDocument(e);return this._basePath?un(t,this._basePath):t};doc=(e,t)=>this.get(e,(e=>{const i="function"==typeof t?t(e):t;try{const t=this.getOpenAPIDocument(i);return e.json(t)}catch(t){return e.json(t,500)}}));doc31=(e,t)=>this.get(e,(e=>{const i="function"==typeof t?t(e):t;try{const t=this.getOpenAPI31Document(i);return e.json(t)}catch(t){return e.json(t,500)}}));route(t,i){const n=t.replaceAll(/:([^\/]+)/g,"{$1}");return super.route(t,i),i instanceof e?(i.openAPIRegistry.definitions.forEach((e=>{switch(e.type){case"component":return this.openAPIRegistry.registerComponent(e.componentType,e.name,e.component);case"route":return void this.openAPIRegistry.registerPath({...e.route,path:K(n,i._basePath.replaceAll(/:([^\/]+)/g,"{$1}"),e.route.path)});case"webhook":return void this.openAPIRegistry.registerWebhook({...e.webhook,path:K(n,i._basePath.replaceAll(/:([^\/]+)/g,"{$1}"),e.webhook.path)});case"schema":return this.openAPIRegistry.register(e.schema._def.openapi._internal.refId,e.schema);case"parameter":return this.openAPIRegistry.registerParameter(e.schema._def.openapi._internal.refId,e.schema);default:throw new Error(`Unknown registry type: ${e}`)}})),this):this}basePath(t){return new e({...super.basePath(t),defaultHook:this.defaultHook})}},createRoute:e=>{const t={...e,getRoutingPath:()=>e.path.replaceAll(/\/{(.+?)}/g,"/:$1")};return Object.defineProperty(t,"getRoutingPath",{enumerable:!1})},extendZodWithOpenApi:r,z:cn}),pn=e(_n),fn=(hn||(hn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=pn,i=t.z.object({created_at:t.z.string(),updated_at:t.z.string()}),n=t.z.enum(["AUTH0","EMAIL","REDIRECT"]),s=t.z.enum(["CREATE_USER","GET_USER","UPDATE_USER","SEND_REQUEST","SEND_EMAIL"]),r=t.z.enum(["VERIFY_EMAIL"]),o=t.z.object({require_mx_record:t.z.boolean().optional(),block_aliases:t.z.boolean().optional(),block_free_emails:t.z.boolean().optional(),block_disposable_emails:t.z.boolean().optional(),blocklist:t.z.array(t.z.string()).optional(),allowlist:t.z.array(t.z.string()).optional()}),a=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("AUTH0"),action:t.z.literal("UPDATE_USER"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({connection_id:t.z.string().optional(),user_id:t.z.string(),changes:t.z.record(t.z.string(),t.z.any())})}),c=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("EMAIL"),action:t.z.literal("VERIFY_EMAIL"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({email:t.z.string(),rules:o.optional()})}),u=t.z.enum(["change-email","account","custom"]),d=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("REDIRECT"),action:t.z.literal("REDIRECT_USER"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({target:u.openapi({description:"The predefined target to redirect to, or 'custom' for a custom URL"}),custom_url:t.z.string().optional().openapi({description:"Custom URL to redirect to when target is 'custom'"})})}),l=t.z.union([a,c,d]),h=t.z.object({name:t.z.string().min(1).max(150).openapi({description:"The name of the flow"}),actions:t.z.array(l).optional().default([]).openapi({description:"The list of actions to execute in sequence"})}),_=h.extend({...i.shape,id:t.z.string().openapi({description:"Unique identifier for the flow",example:"af_12tMpdJ3iek7svMyZkSh5M"})}),p=t.z.object({page:t.z.string().min(0).optional().default("0").transform((e=>parseInt(e,10))).openapi({description:"The page number where 0 is the first page"}),per_page:t.z.string().min(1).optional().default("10").transform((e=>parseInt(e,10))).openapi({description:"The number of items per page"}),include_totals:t.z.string().optional().default("false").transform((e=>"true"===e)).openapi({description:"If the total number of items should be included in the response"}),sort:t.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:t.z.string().optional().openapi({description:"A lucene query string used to filter the results"})}),f=t.z.object({start:t.z.number(),limit:t.z.number(),length:t.z.number(),total:t.z.number().optional()}),m=t.z.object({email:t.z.string().optional(),email_verified:t.z.boolean().optional(),name:t.z.string().optional(),username:t.z.string().optional(),given_name:t.z.string().optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),family_name:t.z.string().optional()}).catchall(t.z.any()),g=t.z.object({connection:t.z.string(),user_id:t.z.string(),provider:t.z.string(),isSocial:t.z.boolean(),access_token:t.z.string().optional(),access_token_secret:t.z.string().optional(),refresh_token:t.z.string().optional(),profileData:m.optional()}),y=t.z.object({email:t.z.string().optional().transform((e=>e&&e.toLowerCase())),username:t.z.string().optional(),phone_number:t.z.string().optional(),given_name:t.z.string().optional(),family_name:t.z.string().optional(),nickname:t.z.string().optional(),name:t.z.string().optional(),picture:t.z.string().optional(),locale:t.z.string().optional(),linked_to:t.z.string().optional(),profileData:t.z.string().optional(),user_id:t.z.string().optional(),app_metadata:t.z.any().default({}).optional(),user_metadata:t.z.any().default({}).optional()}),E=y.extend({email_verified:t.z.boolean().default(!1),verify_email:t.z.boolean().optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string().optional(),provider:t.z.string().optional(),connection:t.z.string(),is_social:t.z.boolean().optional()}),v=t.z.object({...E.shape,...i.shape,user_id:t.z.string(),provider:t.z.string(),is_social:t.z.boolean(),email:t.z.string().optional(),login_count:t.z.number().default(0),identities:t.z.array(g).optional()}),b=v,w=y.extend({login_count:t.z.number(),multifactor:t.z.array(t.z.string()).optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string()}).catchall(t.z.any()),O=t.z.object({client_id:t.z.string().openapi({description:"ID of this client."}),name:t.z.string().min(1).openapi({description:"Name of this client (min length: 1 character, does not allow < or >)."}),description:t.z.string().max(140).optional().openapi({description:"Free text description of this client (max length: 140 characters)."}),global:t.z.boolean().default(!1).openapi({description:"Whether this is your global 'All Applications' client representing legacy tenant settings (true) or a regular client (false)."}),client_secret:t.z.string().default((()=>((e=21)=>{let t="",i=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&i[e]];return t})())).optional().openapi({description:"Client secret (which you must not make public)."}),app_type:t.z.enum(["native","spa","regular_web","non_interactive","resource_server","express_configuration","rms","box","cloudbees","concur","dropbox","mscrm","echosign","egnyte","newrelic","office365","salesforce","sentry","sharepoint","slack","springcm","zendesk","zoom","sso_integration","oag"]).default("regular_web").optional().openapi({description:"The type of application this client represents"}),logo_uri:t.z.string().url().optional().openapi({description:"URL of the logo to display for this client. Recommended size is 150x150 pixels."}),is_first_party:t.z.boolean().default(!1).openapi({description:"Whether this client a first party client (true) or not (false)."}),oidc_conformant:t.z.boolean().default(!0).openapi({description:"Whether this client conforms to strict OIDC specifications (true) or uses legacy features (false)."}),callbacks:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication."}),allowed_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs."}),web_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),client_aliases:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of audiences/realms for SAML protocol. Used by the wsfed addon."}),allowed_clients:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed."}),connections:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of connection IDs enabled for this client. The order determines the display order on the login page."}),allowed_logout_urls:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),session_transfer:t.z.record(t.z.any()).default({}).optional().openapi({description:"Native to Web SSO Configuration"}),oidc_logout:t.z.record(t.z.any()).default({}).optional().openapi({description:"Configuration for OIDC backchannel logout"}),grant_types:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of grant types supported for this application. Can include authorization_code, implicit, refresh_token, client_credentials, password, http://auth0.com/oauth/grant-type/password-realm, http://auth0.com/oauth/grant-type/mfa-oob, http://auth0.com/oauth/grant-type/mfa-otp, http://auth0.com/oauth/grant-type/mfa-recovery-code, urn:openid:params:grant-type:ciba, and urn:ietf:params:oauth:grant-type:device_code."}),jwt_configuration:t.z.record(t.z.any()).default({}).optional().openapi({description:"Configuration related to JWTs for the client."}),signing_keys:t.z.array(t.z.record(t.z.any())).default([]).optional().openapi({description:"Signing certificates associated with this client."}),encryption_key:t.z.record(t.z.any()).default({}).optional().openapi({description:"Encryption used for WsFed responses with this client."}),sso:t.z.boolean().default(!1).openapi({description:"Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false)."}),sso_disabled:t.z.boolean().default(!0).openapi({description:"Whether Single Sign On is disabled (true) or enabled (true). Defaults to true."}),cross_origin_authentication:t.z.boolean().default(!1).openapi({description:"Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false)."}),cross_origin_loc:t.z.string().url().optional().openapi({description:"URL of the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page."}),custom_login_page_on:t.z.boolean().default(!1).openapi({description:"Whether a custom login page is to be used (true) or the default provided login page (false)."}),custom_login_page:t.z.string().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page."}),custom_login_page_preview:t.z.string().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page. (Used on Previews)"}),form_template:t.z.string().optional().openapi({description:"HTML form template to be used for WS-Federation."}),addons:t.z.record(t.z.any()).default({}).optional().openapi({description:"Addons enabled for this client and their associated configurations."}),token_endpoint_auth_method:t.z.enum(["none","client_secret_post","client_secret_basic"]).default("client_secret_basic").optional().openapi({description:"Defines the requested authentication method for the token endpoint. Can be none (public client without a client secret), client_secret_post (client uses HTTP POST parameters), or client_secret_basic (client uses HTTP Basic)."}),client_metadata:t.z.record(t.z.string().max(255)).default({}).optional().openapi({description:'Metadata associated with the client, in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed. Field names (max 255 chars) are alphanumeric and may only include the following special characters: :,-+=_*?"/()<>@ [Tab][Space]'}),mobile:t.z.record(t.z.any()).default({}).optional().openapi({description:"Additional configuration for native mobile apps."}),initiate_login_uri:t.z.string().url().optional().openapi({description:"Initiate login uri, must be https"}),native_social_login:t.z.record(t.z.any()).default({}).optional(),refresh_token:t.z.record(t.z.any()).default({}).optional().openapi({description:"Refresh token configuration"}),default_organization:t.z.record(t.z.any()).default({}).optional().openapi({description:"Defines the default Organization ID and flows"}),organization_usage:t.z.enum(["deny","allow","require"]).default("deny").optional().openapi({description:"Defines how to proceed during an authentication transaction with regards an organization. Can be deny (default), allow or require."}),organization_require_behavior:t.z.enum(["no_prompt","pre_login_prompt","post_login_prompt"]).default("no_prompt").optional().openapi({description:"Defines how to proceed during an authentication transaction when client.organization_usage: 'require'. Can be no_prompt (default), pre_login_prompt or post_login_prompt. post_login_prompt requires oidc_conformant: true."}),client_authentication_methods:t.z.record(t.z.any()).default({}).optional().openapi({description:"Defines client authentication methods."}),require_pushed_authorization_requests:t.z.boolean().default(!1).openapi({description:"Makes the use of Pushed Authorization Requests mandatory for this client"}),require_proof_of_possession:t.z.boolean().default(!1).openapi({description:"Makes the use of Proof-of-Possession mandatory for this client"}),signed_request_object:t.z.record(t.z.any()).default({}).optional().openapi({description:"JWT-secured Authorization Requests (JAR) settings."}),compliance_level:t.z.enum(["none","fapi1_adv_pkj_par","fapi1_adv_mtls_par","fapi2_sp_pkj_mtls","fapi2_sp_mtls_mtls"]).optional().openapi({description:"Defines the compliance level for this client, which may restrict it's capabilities"}),par_request_expiry:t.z.number().optional().openapi({description:"Specifies how long, in seconds, a Pushed Authorization Request URI remains valid"}),token_quota:t.z.record(t.z.any()).default({}).optional()}),A=t.z.object({created_at:t.z.string(),updated_at:t.z.string(),...O.shape}),S=t.z.object({client_id:t.z.string().min(1).openapi({description:"ID of the client."}),audience:t.z.string().min(1).openapi({description:"The audience (API identifier) of this client grant."}),scope:t.z.array(t.z.string()).optional().openapi({description:"Scopes allowed for this client grant."}),organization_usage:t.z.enum(["deny","allow","require"]).optional().openapi({description:"Defines whether organizations can be used with client credentials exchanges for this grant."}),allow_any_organization:t.z.boolean().optional().openapi({description:"If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations."}),is_system:t.z.boolean().optional().openapi({description:"If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly."}),subject_type:t.z.enum(["client","user"]).optional().openapi({description:"The type of application access the client grant allows. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."}),authorization_details_types:t.z.array(t.z.string()).optional().openapi({description:"Types of authorization_details allowed for this client grant. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."})}),I=t.z.object({id:t.z.string().openapi({description:"ID of the client grant."}),...S.shape,created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),N=t.z.array(I),C=t.z.object({x:t.z.number(),y:t.z.number()});var T,x=((T=x||{}).RICH_TEXT="RICH_TEXT",T.NEXT_BUTTON="NEXT_BUTTON",T.BACK_BUTTON="BACK_BUTTON",T.SUBMIT_BUTTON="SUBMIT_BUTTON",T.DIVIDER="DIVIDER",T.TEXT="TEXT",T.EMAIL="EMAIL",T.PASSWORD="PASSWORD",T.NUMBER="NUMBER",T.PHONE="PHONE",T.DATE="DATE",T.CHECKBOX="CHECKBOX",T.RADIO="RADIO",T.SELECT="SELECT",T.HIDDEN="HIDDEN",T.LEGAL="LEGAL",T),R=(e=>(e.BLOCK="BLOCK",e.FIELD="FIELD",e))(R||{});const k=t.z.object({id:t.z.string(),category:t.z.nativeEnum(R),type:t.z.nativeEnum(x)}),D=k.extend({category:t.z.literal("BLOCK"),type:t.z.literal("RICH_TEXT"),config:t.z.object({content:t.z.string()}).passthrough()}),L=k.extend({category:t.z.literal("BLOCK"),type:t.z.union([t.z.literal("NEXT_BUTTON"),t.z.literal("BACK_BUTTON"),t.z.literal("SUBMIT_BUTTON")]),config:t.z.object({text:t.z.string()}).passthrough()}),j=k.extend({category:t.z.literal("FIELD"),type:t.z.literal("LEGAL"),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({text:t.z.string()}).passthrough()}),F=k.extend({category:t.z.literal("FIELD"),type:t.z.union([t.z.literal("TEXT"),t.z.literal("EMAIL"),t.z.literal("PASSWORD"),t.z.literal("NUMBER"),t.z.literal("PHONE"),t.z.literal("DATE"),t.z.literal("CHECKBOX"),t.z.literal("RADIO"),t.z.literal("SELECT"),t.z.literal("HIDDEN")]),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({label:t.z.string().optional(),placeholder:t.z.string().optional()}).passthrough()}),U=t.z.object({id:t.z.string(),category:t.z.string(),type:t.z.string()}).passthrough(),P=t.z.union([D,L,j,F,U]);var M=(e=>(e.STEP="STEP",e.FLOW="FLOW",e.CONDITION="CONDITION",e.ACTION="ACTION",e))(M||{});const Z=t.z.object({id:t.z.string(),type:t.z.literal("STEP"),coordinates:C,alias:t.z.string().optional(),config:t.z.object({components:t.z.array(P),next_node:t.z.string()}).passthrough()}),$=t.z.object({id:t.z.string(),type:t.z.literal("FLOW"),coordinates:C,alias:t.z.string().optional(),config:t.z.object({flow_id:t.z.string(),next_node:t.z.string()})}),H=t.z.object({id:t.z.string(),type:t.z.literal("ACTION"),coordinates:C,alias:t.z.string().optional(),config:t.z.object({action_type:t.z.enum(["REDIRECT"]).openapi({description:"The type of action to perform"}),target:t.z.enum(["change-email","account","custom"]).openapi({description:"The predefined target to redirect to"}),custom_url:t.z.string().optional().openapi({description:"Custom URL when target is 'custom'"}),next_node:t.z.string().openapi({description:"The next node to navigate to after action (for non-redirect actions)"})}).passthrough()}),z=t.z.object({id:t.z.string(),type:t.z.string(),coordinates:C}).passthrough(),G=t.z.union([Z,$,H,z]),B=t.z.object({next_node:t.z.string(),coordinates:C}).passthrough(),q=t.z.object({resume_flow:t.z.boolean().optional(),coordinates:C}).passthrough(),K=t.z.object({id:t.z.string(),name:t.z.string(),languages:t.z.object({primary:t.z.string()}).passthrough(),nodes:t.z.array(G),start:B,ending:q,created_at:t.z.string(),updated_at:t.z.string(),links:t.z.object({sdkSrc:t.z.string().optional(),sdk_src:t.z.string().optional()}).passthrough()}).passthrough(),W=K.omit({id:!0,created_at:!0,updated_at:!0});var V=(e=>(e.TOKEN="token",e.TOKEN_ID_TOKEN="token id_token",e.CODE="code",e))(V||{}),X=(e=>(e.QUERY="query",e.FRAGMENT="fragment",e.FORM_POST="form_post",e.WEB_MESSAGE="web_message",e.SAML_POST="saml_post",e))(X||{}),Y=(e=>(e.S256="S256",e.Plain="plain",e))(Y||{});const J=t.z.object({client_id:t.z.string(),act_as:t.z.string().optional(),response_type:t.z.nativeEnum(V).optional(),response_mode:t.z.nativeEnum(X).optional(),redirect_uri:t.z.string().optional(),audience:t.z.string().optional(),organization:t.z.string().optional(),state:t.z.string().optional(),nonce:t.z.string().optional(),scope:t.z.string().optional(),prompt:t.z.string().optional(),code_challenge_method:t.z.nativeEnum(Y).optional(),code_challenge:t.z.string().optional(),username:t.z.string().optional(),ui_locales:t.z.string().optional(),vendor_id:t.z.string().optional()}),Q=t.z.object({colors:t.z.object({primary:t.z.string(),page_background:t.z.object({type:t.z.string().optional(),start:t.z.string().optional(),end:t.z.string().optional(),angle_deg:t.z.number().optional()}).optional()}).optional(),logo_url:t.z.string().optional(),favicon_url:t.z.string().optional(),powered_by_logo_url:t.z.string().optional(),font:t.z.object({url:t.z.string()}).optional()}),ee=t.z.object({kid:t.z.string().optional(),team_id:t.z.string().optional(),realms:t.z.string().optional(),authentication_method:t.z.string().optional(),client_id:t.z.string().optional(),client_secret:t.z.string().optional(),app_secret:t.z.string().optional(),scope:t.z.string().optional(),authorization_endpoint:t.z.string().optional(),token_endpoint:t.z.string().optional(),userinfo_endpoint:t.z.string().optional(),jwks_uri:t.z.string().optional(),discovery_url:t.z.string().optional(),issuer:t.z.string().optional(),provider:t.z.string().optional(),from:t.z.string().optional(),twilio_sid:t.z.string().optional(),twilio_token:t.z.string().optional(),icon_url:t.z.string().optional()}),te=t.z.object({id:t.z.string().optional(),name:t.z.string(),display_name:t.z.string().optional(),strategy:t.z.string(),options:ee.default({}),enabled_clients:t.z.array(t.z.string()).default([]).optional(),response_type:t.z.custom().optional(),response_mode:t.z.custom().optional(),is_domain_connection:t.z.boolean().optional(),show_as_button:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional(),is_system:t.z.boolean().optional()}),ie=t.z.object({id:t.z.string(),created_at:t.z.string().transform((e=>null===e?"":e)),updated_at:t.z.string().transform((e=>null===e?"":e))}).extend(te.shape),ne=t.z.object({id:t.z.string().optional(),audience:t.z.string(),friendly_name:t.z.string(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sender_email:t.z.string().email(),sender_name:t.z.string(),session_lifetime:t.z.number().optional(),idle_session_lifetime:t.z.number().optional(),ephemeral_session_lifetime:t.z.number().optional(),idle_ephemeral_session_lifetime:t.z.number().optional(),session_cookie:t.z.object({mode:t.z.enum(["persistent","non-persistent"]).optional()}).optional(),allowed_logout_urls:t.z.array(t.z.string()).optional(),default_redirection_uri:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).optional(),flags:t.z.object({allow_changing_enable_sso:t.z.boolean().optional(),allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),change_pwd_flow_v1:t.z.boolean().optional(),custom_domains_provisioning:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),disable_impersonation:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),enable_sso:t.z.boolean().optional(),enforce_client_authentication_on_passwordless_start:t.z.boolean().optional(),genai_trial:t.z.boolean().optional(),improved_signup_bot_detection_in_classic:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional(),no_disclose_enterprise_connections:t.z.boolean().optional(),remove_alg_from_jwks:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),trust_azure_adfs_email_verified_connection_property:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),inherit_global_permissions_in_organizations:t.z.boolean().optional()}).optional(),sandbox_version:t.z.string().optional(),legacy_sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),device_flow:t.z.object({charset:t.z.enum(["base20","digits"]).optional(),mask:t.z.string().max(20).optional()}).optional(),default_token_quota:t.z.object({clients:t.z.object({client_credentials:t.z.record(t.z.any()).optional()}).optional(),organizations:t.z.object({client_credentials:t.z.record(t.z.any()).optional()}).optional()}).optional(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional(),oidc_logout:t.z.object({rp_logout_end_session_endpoint_discovery:t.z.boolean().optional()}).optional(),allow_organization_name_in_authentication_api:t.z.boolean().optional(),customize_mfa_in_postlogin_action:t.z.boolean().optional(),acr_values_supported:t.z.array(t.z.string()).optional(),mtls:t.z.object({enable_endpoint_aliases:t.z.boolean().optional()}).optional(),pushed_authorization_requests_supported:t.z.boolean().optional(),authorization_response_iss_parameter_supported:t.z.boolean().optional()}),se=t.z.object({created_at:t.z.string().nullable().transform((e=>e??"")),updated_at:t.z.string().nullable().transform((e=>e??"")),...ne.shape,id:t.z.string()}),re=t.z.object({...A.shape,tenant:se,connections:t.z.array(ie)}),oe=t.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),ae=t.z.object({code_id:t.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:t.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:t.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:oe,code_verifier:t.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:t.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:t.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:t.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:t.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:t.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:t.z.string(),used_at:t.z.string().optional(),user_id:t.z.string().optional()}),ce=t.z.object({...ae.shape,created_at:t.z.string()}),ue=t.z.object({domain:t.z.string(),custom_domain_id:t.z.string().optional(),type:t.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:t.z.enum(["txt"]).optional(),tls_policy:t.z.enum(["recommended"]).optional(),custom_client_ip_header:t.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:t.z.record(t.z.string().max(255)).optional()}),de=t.z.object({name:t.z.literal("txt"),record:t.z.string(),domain:t.z.string()}),le=t.z.object({...ue.shape,custom_domain_id:t.z.string(),primary:t.z.boolean(),status:t.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:t.z.string().optional(),verification:t.z.object({methods:t.z.array(de)}).optional(),tls_policy:t.z.string().optional()}),he=le.extend({tenant_id:t.z.string()}),_e=t.z.object({id:t.z.string(),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0)}),pe=_e.extend({category:t.z.literal("BLOCK").optional()}),fe=pe.extend({type:t.z.literal("DIVIDER"),config:t.z.object({}).optional()}),me=pe.extend({type:t.z.literal("HTML"),config:t.z.object({content:t.z.string().optional()}).optional()}),ge=pe.extend({type:t.z.literal("IMAGE"),config:t.z.object({src:t.z.string().optional(),alt:t.z.string().optional(),width:t.z.number().optional(),height:t.z.number().optional()}).optional()}),ye=pe.extend({type:t.z.literal("JUMP_BUTTON"),config:t.z.object({text:t.z.string().optional(),target_step:t.z.string().optional()})}),Ee=pe.extend({type:t.z.literal("RESEND_BUTTON"),config:t.z.object({text:t.z.string().optional(),resend_action:t.z.string().optional()})}),ve=pe.extend({type:t.z.literal("NEXT_BUTTON"),config:t.z.object({text:t.z.string().optional()})}),be=pe.extend({type:t.z.literal("PREVIOUS_BUTTON"),config:t.z.object({text:t.z.string().optional()})}),we=pe.extend({type:t.z.literal("RICH_TEXT"),config:t.z.object({content:t.z.string().optional()}).optional()}),Oe=_e.extend({category:t.z.literal("WIDGET").optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),Ae=Oe.extend({type:t.z.literal("AUTH0_VERIFIABLE_CREDENTIALS"),config:t.z.object({credential_type:t.z.string().optional()})}),Se=Oe.extend({type:t.z.literal("GMAPS_ADDRESS"),config:t.z.object({api_key:t.z.string().optional()})}),Ie=Oe.extend({type:t.z.literal("RECAPTCHA"),config:t.z.object({site_key:t.z.string().optional()})}),Ne=_e.extend({category:t.z.literal("FIELD").optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),Ce=Ne.extend({type:t.z.literal("BOOLEAN"),config:t.z.object({default_value:t.z.boolean().optional()}).optional()}),Te=Ne.extend({type:t.z.literal("CARDS"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string(),description:t.z.string().optional(),image:t.z.string().optional()})).optional(),multi_select:t.z.boolean().optional()}).optional()}),xe=Ne.extend({type:t.z.literal("CHOICE"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),display:t.z.enum(["radio","checkbox"]).optional()}).optional()}),Re=Ne.extend({type:t.z.literal("CUSTOM"),config:t.z.object({component:t.z.string().optional(),props:t.z.record(t.z.any()).optional()})}),ke=Ne.extend({type:t.z.literal("DATE"),config:t.z.object({format:t.z.string().optional(),min:t.z.string().optional(),max:t.z.string().optional()}).optional()}),De=Ne.extend({type:t.z.literal("DROPDOWN"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),placeholder:t.z.string().optional(),searchable:t.z.boolean().optional()}).optional()}),Le=Ne.extend({type:t.z.literal("EMAIL"),config:t.z.object({placeholder:t.z.string().optional()}).optional()}),je=Ne.extend({type:t.z.literal("FILE"),config:t.z.object({accept:t.z.string().optional(),max_size:t.z.number().optional(),multiple:t.z.boolean().optional()}).optional()}),Fe=Ne.extend({type:t.z.literal("LEGAL"),config:t.z.object({text:t.z.string(),html:t.z.boolean().optional()}).optional()}),Ue=Ne.extend({type:t.z.literal("NUMBER"),config:t.z.object({placeholder:t.z.string().optional(),min:t.z.number().optional(),max:t.z.number().optional(),step:t.z.number().optional()}).optional()}),Pe=Ne.extend({type:t.z.literal("PASSWORD"),config:t.z.object({placeholder:t.z.string().optional(),min_length:t.z.number().optional(),show_toggle:t.z.boolean().optional(),forgot_password_link:t.z.string().optional()}).optional()}),Me=Ne.extend({type:t.z.literal("PAYMENT"),config:t.z.object({provider:t.z.string().optional(),currency:t.z.string().optional()}).optional()}),Ze=Ne.extend({type:t.z.literal("SOCIAL"),config:t.z.object({providers:t.z.array(t.z.string()).optional()}).optional()}),$e=Ne.extend({type:t.z.literal("TEL"),config:t.z.object({placeholder:t.z.string().optional(),default_country:t.z.string().optional()}).optional()}),He=Ne.extend({type:t.z.literal("TEXT"),config:t.z.object({placeholder:t.z.string().optional(),multiline:t.z.boolean().optional(),max_length:t.z.number().optional()}).optional()}),ze=Ne.extend({type:t.z.literal("URL"),config:t.z.object({placeholder:t.z.string().optional()}).optional()}),Ge=t.z.discriminatedUnion("type",[fe,me,ge,ye,Ee,ve,be,we]),Be=t.z.discriminatedUnion("type",[Ae,Se,Ie]),qe=t.z.discriminatedUnion("type",[Ce,Te,xe,Re,ke,De,Le,je,Fe,Ue,Pe,Me,Ze,$e,He,ze]),Ke=t.z.union([Ge,Be,qe]),We=t.z.object({id:t.z.string(),type:t.z.literal("submit"),label:t.z.string(),className:t.z.string().optional(),disabled:t.z.boolean().optional().default(!1),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0),customizations:t.z.record(t.z.string(),t.z.any()).optional()}),Ve=t.z.object({x:t.z.number(),y:t.z.number()}),Xe=t.z.object({id:t.z.string(),type:t.z.literal("FLOW"),coordinates:Ve,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({flow_id:t.z.string().max(30),next_node:t.z.string().optional()})}),Ye=t.z.object({id:t.z.string(),type:t.z.literal("ROUTER"),coordinates:Ve,alias:t.z.string().min(1).max(150),config:t.z.object({rules:t.z.array(t.z.object({id:t.z.string(),alias:t.z.string().min(1).max(150).optional(),condition:t.z.any(),next_node:t.z.string()})),fallback:t.z.string()})}),Je=t.z.object({id:t.z.string(),type:t.z.literal("STEP"),coordinates:Ve,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({components:t.z.array(Ke),next_node:t.z.string().optional()})}),Qe=t.z.discriminatedUnion("type",[Xe,Ye,Je]),et=t.z.object({name:t.z.string().openapi({description:"The name of the form"}),messages:t.z.object({errors:t.z.record(t.z.string(),t.z.any()).optional(),custom:t.z.record(t.z.string(),t.z.any()).optional()}).optional(),languages:t.z.object({primary:t.z.string().optional(),default:t.z.string().optional()}).optional(),translations:t.z.record(t.z.string(),t.z.any()).optional(),nodes:t.z.array(Qe).optional(),start:t.z.object({hidden_fields:t.z.array(t.z.object({key:t.z.string(),value:t.z.string()})).optional(),next_node:t.z.string().optional(),coordinates:Ve.optional()}).optional(),ending:t.z.object({redirection:t.z.object({delay:t.z.number().optional(),target:t.z.string().optional()}).optional(),after_submit:t.z.object({flow_id:t.z.string().optional()}).optional(),coordinates:Ve.optional(),resume_flow:t.z.boolean().optional()}).optional(),style:t.z.object({css:t.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches Auth0 Forms structure)"}),tt=t.z.object({...i.shape,...et.shape,id:t.z.string()}),it=t.z.object({id:t.z.number().optional(),text:t.z.string(),type:t.z.enum(["info","error","success","warning"])}),nt=t.z.object({id:t.z.string().optional(),text:t.z.string(),href:t.z.string(),linkText:t.z.string().optional()}),st=t.z.object({action:t.z.string(),method:t.z.enum(["POST","GET"]),title:t.z.string().optional(),description:t.z.string().optional(),components:t.z.array(Ke),messages:t.z.array(it).optional(),links:t.z.array(nt).optional()}),rt=t.z.enum(["pre-user-registration","post-user-registration","post-user-login","validate-registration-username","pre-user-deletion","post-user-deletion"]),ot=t.z.enum(["pre-user-registration","post-user-registration","post-user-login","validate-registration-username","pre-user-deletion","post-user-deletion"]),at={enabled:t.z.boolean().default(!1),synchronous:t.z.boolean().default(!1),priority:t.z.number().optional(),hook_id:t.z.string().optional()},ct=t.z.object({...at,trigger_id:rt,url:t.z.string()}),ut=t.z.object({...at,trigger_id:ot,form_id:t.z.string()}),dt=t.z.union([ct,ut]),lt=t.z.object({...at,trigger_id:rt,...i.shape,hook_id:t.z.string(),url:t.z.string()}),ht=t.z.object({...at,trigger_id:ot,...i.shape,hook_id:t.z.string(),form_id:t.z.string()}),_t=t.z.union([lt,ht]),pt=t.z.object({name:t.z.string().optional()}),ft=t.z.object({email:t.z.string().optional()}),mt=t.z.object({organization_id:t.z.string().max(50),inviter:pt,invitee:ft,invitation_url:t.z.string().url(),client_id:t.z.string(),connection_id:t.z.string().optional(),app_metadata:t.z.record(t.z.any()).default({}).optional(),user_metadata:t.z.record(t.z.any()).default({}).optional(),ttl_sec:t.z.number().int().max(2592e3).default(604800).optional(),roles:t.z.array(t.z.string()).default([]).optional(),send_invitation_email:t.z.boolean().default(!0).optional()}),gt=t.z.object({id:t.z.string(),organization_id:t.z.string().max(50),created_at:t.z.string().datetime(),expires_at:t.z.string().datetime(),ticket_id:t.z.string().optional()}).extend(mt.shape),yt=t.z.object({alg:t.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:t.z.string(),kid:t.z.string(),kty:t.z.enum(["RSA","EC","oct"]),n:t.z.string(),x5t:t.z.string().optional(),x5c:t.z.array(t.z.string()).optional(),use:t.z.enum(["sig","enc"]).optional()}),Et=t.z.object({keys:t.z.array(yt)}),vt=t.z.object({issuer:t.z.string(),authorization_endpoint:t.z.string(),token_endpoint:t.z.string(),device_authorization_endpoint:t.z.string(),userinfo_endpoint:t.z.string(),mfa_challenge_endpoint:t.z.string(),jwks_uri:t.z.string(),registration_endpoint:t.z.string(),revocation_endpoint:t.z.string(),scopes_supported:t.z.array(t.z.string()),response_types_supported:t.z.array(t.z.string()),code_challenge_methods_supported:t.z.array(t.z.string()),response_modes_supported:t.z.array(t.z.string()),subject_types_supported:t.z.array(t.z.string()),id_token_signing_alg_values_supported:t.z.array(t.z.string()),token_endpoint_auth_methods_supported:t.z.array(t.z.string()),claims_supported:t.z.array(t.z.string()),request_uri_parameter_supported:t.z.boolean(),request_parameter_supported:t.z.boolean(),token_endpoint_auth_signing_alg_values_supported:t.z.array(t.z.string())});var bt=(e=>(e.PENDING="pending",e.AUTHENTICATED="authenticated",e.AWAITING_EMAIL_VERIFICATION="awaiting_email_verification",e.AWAITING_HOOK="awaiting_hook",e.AWAITING_CONTINUATION="awaiting_continuation",e.COMPLETED="completed",e.FAILED="failed",e.EXPIRED="expired",e))(bt||{});const wt=t.z.nativeEnum(bt),Ot=t.z.object({csrf_token:t.z.string(),auth0Client:t.z.string().optional(),authParams:J,expires_at:t.z.string(),deleted_at:t.z.string().optional(),ip:t.z.string().optional(),useragent:t.z.string().optional(),session_id:t.z.string().optional(),authorization_url:t.z.string().optional(),state:wt.optional().default("pending"),state_data:t.z.string().optional(),failure_reason:t.z.string().optional(),user_id:t.z.string().optional()}).openapi({description:"This represents a login sesion"}),At=t.z.object({...Ot.shape,id:t.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:t.z.string(),updated_at:t.z.string()}),St={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_IMPERSONATION:"fimp",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESS_IMPERSONATION:"simp",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},It=t.z.string().refine((e=>Object.values(St).includes(e)),{message:"Invalid log type"}),Nt=t.z.object({name:t.z.string(),version:t.z.string(),env:t.z.object({node:t.z.string().optional()}).optional()}),Ct=t.z.object({country_code:t.z.string().length(2),city_name:t.z.string(),latitude:t.z.string(),longitude:t.z.string(),time_zone:t.z.string(),continent_code:t.z.string()}),Tt=t.z.object({type:It,date:t.z.string(),description:t.z.string().optional(),ip:t.z.string().optional(),user_agent:t.z.string().optional(),details:t.z.any().optional(),isMobile:t.z.boolean(),user_id:t.z.string().optional(),user_name:t.z.string().optional(),connection:t.z.string().optional(),connection_id:t.z.string().optional(),client_id:t.z.string().optional(),client_name:t.z.string().optional(),audience:t.z.string().optional(),scope:t.z.string().optional(),strategy:t.z.string().optional(),strategy_type:t.z.string().optional(),hostname:t.z.string().optional(),auth0_client:Nt.optional(),log_id:t.z.string().optional(),location_info:Ct.optional()}),xt=t.z.object({...Tt.shape,log_id:t.z.string()}),Rt=t.z.object({id:t.z.string().optional(),user_id:t.z.string(),password:t.z.string(),algorithm:t.z.enum(["bcrypt","argon2id"]).default("argon2id"),is_current:t.z.boolean().default(!0)}),kt=Rt.extend({id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()}),Dt=t.z.object({initial_user_agent:t.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:t.z.string().describe("First IP address associated with this session"),initial_asn:t.z.string().describe("First autonomous system number associated with this session"),last_user_agent:t.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:t.z.string().describe("Last IP address from which this user logged in"),last_asn:t.z.string().describe("Last autonomous system number from which this user logged in")}),Lt=t.z.object({id:t.z.string(),revoked_at:t.z.string().optional(),used_at:t.z.string().optional(),user_id:t.z.string().describe("The user ID associated with the session"),expires_at:t.z.string().optional(),login_session_id:t.z.string(),idle_expires_at:t.z.string().optional(),device:Dt.describe("Metadata related to the device used in the session"),clients:t.z.array(t.z.string()).describe("List of client details for the session")}),jt=t.z.object({created_at:t.z.string(),updated_at:t.z.string(),authenticated_at:t.z.string(),last_interaction_at:t.z.string(),...Lt.shape}),Ft=t.z.object({kid:t.z.string().openapi({description:"The key id of the signing key"}),cert:t.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:t.z.string().openapi({description:"The cert fingerprint"}),thumbprint:t.z.string().openapi({description:"The cert thumbprint"}),pkcs7:t.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:t.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:t.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:t.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:t.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:t.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:t.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:t.z.string().optional().openapi({description:"The date and time when the key was revoked"}),connection:t.z.string().optional().openapi({description:"The connection identifier associated with the key"}),type:t.z.enum(["jwt_signing","saml_encryption"]).openapi({description:"The type of the signing key"})});var Ut=(e=>(e.RefreshToken="refresh_token",e.AuthorizationCode="authorization_code",e.ClientCredential="client_credentials",e.Passwordless="passwordless",e.Password="password",e.OTP="http://auth0.com/oauth/grant-type/passwordless/otp",e))(Ut||{});const Pt=t.z.object({access_token:t.z.string(),id_token:t.z.string().optional(),scope:t.z.string().optional(),state:t.z.string().optional(),refresh_token:t.z.string().optional(),token_type:t.z.string(),expires_in:t.z.number()});t.z.object({code:t.z.string(),state:t.z.string().optional()});const Mt=t.z.object({button_border_radius:t.z.number(),button_border_weight:t.z.number(),buttons_style:t.z.enum(["pill","rounded","sharp"]),input_border_radius:t.z.number(),input_border_weight:t.z.number(),inputs_style:t.z.enum(["pill","rounded","sharp"]),show_widget_shadow:t.z.boolean(),widget_border_weight:t.z.number(),widget_corner_radius:t.z.number()}),Zt=t.z.object({base_focus_color:t.z.string(),base_hover_color:t.z.string(),body_text:t.z.string(),captcha_widget_theme:t.z.enum(["auto","dark","light"]),error:t.z.string(),header:t.z.string(),icons:t.z.string(),input_background:t.z.string(),input_border:t.z.string(),input_filled_text:t.z.string(),input_labels_placeholders:t.z.string(),links_focused_components:t.z.string(),primary_button:t.z.string(),primary_button_label:t.z.string(),secondary_button_border:t.z.string(),secondary_button_label:t.z.string(),success:t.z.string(),widget_background:t.z.string(),widget_border:t.z.string()}),$t=t.z.object({bold:t.z.boolean(),size:t.z.number()}),Ht=t.z.object({body_text:$t,buttons_text:$t,font_url:t.z.string(),input_labels:$t,links:$t,links_style:t.z.enum(["normal","underlined"]),reference_text_size:t.z.number(),subtitle:$t,title:$t}),zt=t.z.object({background_color:t.z.string(),background_image_url:t.z.string(),page_layout:t.z.enum(["center","left","right"])}),Gt=t.z.object({header_text_alignment:t.z.enum(["center","left","right"]),logo_height:t.z.number(),logo_position:t.z.enum(["center","left","none","right"]),logo_url:t.z.string(),social_buttons_layout:t.z.enum(["bottom","top"])}),Bt=t.z.object({borders:Mt,colors:Zt,displayName:t.z.string(),fonts:Ht,page_background:zt,widget:Gt}),qt=Bt.extend({themeId:t.z.string()}),Kt=t.z.object({universal_login_experience:t.z.enum(["new","classic"]).default("new"),identifier_first:t.z.boolean().default(!0),password_first:t.z.boolean().default(!1),webauthn_platform_first_factor:t.z.boolean()}),Wt=t.z.object({name:t.z.string(),enabled:t.z.boolean().optional().default(!0),default_from_address:t.z.string().optional(),credentials:t.z.union([t.z.object({accessKeyId:t.z.string(),secretAccessKey:t.z.string(),region:t.z.string()}),t.z.object({smtp_host:t.z.array(t.z.string()),smtp_port:t.z.number(),smtp_user:t.z.string(),smtp_pass:t.z.string()}),t.z.object({api_key:t.z.string(),domain:t.z.string().optional()}),t.z.object({connectionString:t.z.string()}),t.z.object({tenantId:t.z.string(),clientId:t.z.string(),clientSecret:t.z.string()})]),settings:t.z.object({}).optional()}),Vt=t.z.object({id:t.z.string(),session_id:t.z.string(),user_id:t.z.string(),client_id:t.z.string(),expires_at:t.z.string().optional(),idle_expires_at:t.z.string().optional(),last_exchanged_at:t.z.string().optional(),device:Dt,resource_servers:t.z.array(t.z.object({audience:t.z.string(),scopes:t.z.string()})),rotating:t.z.boolean()}),Xt=t.z.object({created_at:t.z.string(),...Vt.shape}),Yt=t.z.object({to:t.z.string(),message:t.z.string()}),Jt=t.z.object({name:t.z.string(),options:t.z.object({})}),Qt=t.z.object({value:t.z.string(),description:t.z.string().optional()}),ei=t.z.object({token_dialect:t.z.enum(["access_token","access_token_authz"]).optional(),enforce_policies:t.z.boolean().optional(),allow_skipping_userinfo:t.z.boolean().optional(),skip_userinfo:t.z.boolean().optional(),persist_client_authorization:t.z.boolean().optional(),enable_introspection_endpoint:t.z.boolean().optional(),mtls:t.z.object({bound_access_tokens:t.z.boolean().optional()}).optional()}),ti=t.z.object({id:t.z.string().optional(),name:t.z.string(),identifier:t.z.string(),scopes:t.z.array(Qt).optional(),signing_alg:t.z.string().optional(),signing_secret:t.z.string().optional(),token_lifetime:t.z.number().optional(),token_lifetime_for_web:t.z.number().optional(),skip_consent_for_verifiable_first_party_clients:t.z.boolean().optional(),allow_offline_access:t.z.boolean().optional(),verificationKey:t.z.string().optional(),options:ei.optional(),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional()}),ii=t.z.object({...ti.shape,created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),ni=t.z.array(ii),si=t.z.object({role_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string()}),ri=t.z.object({...si.shape,created_at:t.z.string()}),oi=t.z.array(ri),ai=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string(),organization_id:t.z.string().optional()}),ci=t.z.object({...ai.shape,tenant_id:t.z.string(),created_at:t.z.string().optional()}),ui=t.z.array(ci),di=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),resource_server_name:t.z.string(),permission_name:t.z.string(),description:t.z.string().nullable().optional(),created_at:t.z.string().optional(),organization_id:t.z.string().optional()}),li=t.z.array(di),hi=t.z.object({user_id:t.z.string(),role_id:t.z.string(),organization_id:t.z.string().optional()}),_i=t.z.object({...hi.shape,tenant_id:t.z.string(),created_at:t.z.string().optional()}),pi=t.z.array(_i),fi=t.z.object({id:t.z.string().optional().openapi({description:"The unique identifier of the role. If not provided, one will be generated."}),name:t.z.string().min(1).max(50).openapi({description:"The name of the role. Cannot include '<' or '>'"}),description:t.z.string().max(255).optional().openapi({description:"The description of the role"}),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional().openapi({description:"Metadata associated with the role. Can be used to control sync behavior in multi-tenancy scenarios."})}),mi=fi.extend({id:t.z.string().openapi({description:"The unique identifier of the role"}),created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),gi=t.z.array(mi),yi=t.z.object({logo_url:t.z.string().optional().openapi({description:"URL of the organization's logo"}),colors:t.z.object({primary:t.z.string().optional().openapi({description:"Primary color in hex format (e.g., #FF0000)"}),page_background:t.z.string().optional().openapi({description:"Page background color in hex format (e.g., #FFFFFF)"})}).optional()}).optional(),Ei=t.z.object({connection_id:t.z.string().openapi({description:"ID of the connection"}),assign_membership_on_login:t.z.boolean().default(!1).openapi({description:"Whether to assign membership to the organization on login"}),show_as_button:t.z.boolean().default(!0).openapi({description:"Whether to show this connection as a button in the login screen"}),is_signup_enabled:t.z.boolean().default(!0).openapi({description:"Whether signup is enabled for this connection"})}),vi=t.z.object({client_credentials:t.z.object({enforce:t.z.boolean().default(!1).openapi({description:"Whether to enforce token quota limits"}),per_day:t.z.number().min(0).default(0).openapi({description:"Maximum tokens per day (0 = unlimited)"}),per_hour:t.z.number().min(0).default(0).openapi({description:"Maximum tokens per hour (0 = unlimited)"})}).optional()}).optional(),bi=t.z.object({id:t.z.string().optional(),name:t.z.string().min(1).regex(/^[a-z0-9_-]+$/,{message:"Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores"}).openapi({description:"The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores."}),display_name:t.z.string().optional().openapi({description:"The display name of the organization"}),branding:yi,metadata:t.z.record(t.z.any()).default({}).optional().openapi({description:"Custom metadata for the organization"}),enabled_connections:t.z.array(Ei).default([]).optional().openapi({description:"List of enabled connections for the organization"}),token_quota:vi}),wi=t.z.object({...bi.shape,...i.shape,id:t.z.string(),name:t.z.string().min(1).openapi({description:"The name of the organization"})}),Oi=t.z.object({user_id:t.z.string().openapi({description:"ID of the user"}),organization_id:t.z.string().openapi({description:"ID of the organization"})}),Ai=t.z.object({...Oi.shape,...i.shape,id:t.z.string()}),Si=t.z.object({idle_session_lifetime:t.z.number().optional(),session_lifetime:t.z.number().optional(),session_cookie:t.z.object({mode:t.z.enum(["persistent","non-persistent"]).optional()}).optional(),enable_client_connections:t.z.boolean().optional(),default_redirection_uri:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).optional(),flags:t.z.object({allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional()}).optional(),friendly_name:t.z.string().optional(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional()}),Ii=t.z.object({date:t.z.string().openapi({description:"Date these events occurred in ISO 8601 format",example:"2025-12-19"}),logins:t.z.number().openapi({description:"Number of logins on this date",example:150}),signups:t.z.number().openapi({description:"Number of signups on this date",example:25}),leaked_passwords:t.z.number().openapi({description:"Number of breached-password detections on this date (subscription required)",example:0}),updated_at:t.z.string().openapi({description:"Date and time this stats entry was last updated in ISO 8601 format",example:"2025-12-19T10:30:00.000Z"}),created_at:t.z.string().openapi({description:"Approximate date and time the first event occurred in ISO 8601 format",example:"2025-12-19T00:00:00.000Z"})}),Ni=t.z.number().openapi({description:"Number of active users in the last 30 days",example:1234});e.Auth0ActionEnum=s,e.Auth0Client=Nt,e.AuthorizationResponseMode=X,e.AuthorizationResponseType=V,e.CodeChallengeMethod=Y,e.ComponentCategory=R,e.ComponentType=x,e.EmailActionEnum=r,e.FlowActionTypeEnum=n,e.GrantType=Ut,e.LocationInfo=Ct,e.LogTypes=St,e.LoginSessionState=bt,e.NodeType=M,e.RedirectTargetEnum=u,e.actionNodeSchema=H,e.activeUsersResponseSchema=Ni,e.auth0FlowInsertSchema=W,e.auth0FlowSchema=K,e.auth0QuerySchema=p,e.auth0UpdateUserActionSchema=a,e.auth0UserResponseSchema=b,e.authParamsSchema=J,e.baseUserSchema=y,e.blockComponentSchema=Ge,e.bordersSchema=Mt,e.brandingSchema=Q,e.buttonComponentSchema=L,e.clientGrantInsertSchema=S,e.clientGrantListSchema=N,e.clientGrantSchema=I,e.clientInsertSchema=O,e.clientSchema=A,e.codeInsertSchema=ae,e.codeSchema=ce,e.codeTypeSchema=oe,e.colorsSchema=Zt,e.componentMessageSchema=it,e.componentSchema=P,e.connectionInsertSchema=te,e.connectionOptionsSchema=ee,e.connectionSchema=ie,e.coordinatesSchema=C,e.createPassthroughAdapter=function(e){const{primary:t,secondaries:i,syncMethods:n=["create","update","remove","delete","set"]}=e,s={get(e,t){if("symbol"==typeof t)return e[t];const s=e[t];return"function"!=typeof s?s:n.includes(t)?async(...n)=>{const r=await s.apply(e,n),o=[];for(const e of i){const i=e.adapter[t];if("function"!=typeof i)continue;const s=(async()=>{try{await i.apply(e.adapter,n)}catch(i){try{e.onError?e.onError(i,t,n):console.error(`Passthrough adapter: secondary write failed for ${t}:`,i)}catch(e){console.error(`Passthrough adapter: onError handler threw for ${t}:`,e)}}})();e.blocking&&o.push(s)}return o.length>0&&await Promise.all(o),r}:s.bind(e)}};return new Proxy(t,s)},e.createWriteOnlyAdapter=function(e){return e},e.customDomainInsertSchema=ue,e.customDomainSchema=le,e.customDomainWithTenantIdSchema=he,e.dailyStatsSchema=Ii,e.emailProviderSchema=Wt,e.emailVerificationRulesSchema=o,e.emailVerifyActionSchema=c,e.endingSchema=q,e.fieldComponentSchema=qe,e.flowActionStepSchema=l,e.flowInsertSchema=h,e.flowSchema=_,e.flowsFieldComponentSchema=F,e.flowsFlowNodeSchema=$,e.flowsStepNodeSchema=Z,e.fontDetailsSchema=$t,e.fontsSchema=Ht,e.formControlSchema=We,e.formInsertSchema=et,e.formNodeComponentDefinition=Ke,e.formNodeSchema=Qe,e.formSchema=tt,e.genericComponentSchema=U,e.genericNodeSchema=z,e.hookInsertSchema=dt,e.hookSchema=_t,e.identitySchema=g,e.inviteInsertSchema=mt,e.inviteSchema=gt,e.inviteeSchema=ft,e.inviterSchema=pt,e.isBlockComponent=function(e){return"BLOCK"===e.category},e.isFieldComponent=function(e){return"FIELD"===e.category},e.isWidgetComponent=function(e){return"WIDGET"===e.category},e.jwksKeySchema=Et,e.jwksSchema=yt,e.legacyClientSchema=re,e.legalComponentSchema=j,e.logInsertSchema=Tt,e.logSchema=xt,e.loginSessionInsertSchema=Ot,e.loginSessionSchema=At,e.loginSessionStateSchema=wt,e.nodeSchema=G,e.openIDConfigurationSchema=vt,e.organizationBrandingSchema=yi,e.organizationEnabledConnectionSchema=Ei,e.organizationInsertSchema=bi,e.organizationSchema=wi,e.organizationTokenQuotaSchema=vi,e.pageBackgroundSchema=zt,e.parseUserId=function(e){const[t,i]=e.split("|");if(!t||!i)throw new Error(`Invalid user_id: ${e}`);return{connection:t,id:i}},e.passwordInsertSchema=Rt,e.passwordSchema=kt,e.profileDataSchema=m,e.promptSettingSchema=Kt,e.redirectActionSchema=d,e.refreshTokenInsertSchema=Vt,e.refreshTokenSchema=Xt,e.resourceServerInsertSchema=ti,e.resourceServerListSchema=ni,e.resourceServerOptionsSchema=ei,e.resourceServerSchema=ii,e.resourceServerScopeSchema=Qt,e.richTextComponentSchema=D,e.roleInsertSchema=fi,e.roleListSchema=gi,e.rolePermissionInsertSchema=si,e.rolePermissionListSchema=oi,e.rolePermissionSchema=ri,e.roleSchema=mi,e.screenLinkSchema=nt,e.sessionInsertSchema=Lt,e.sessionSchema=jt,e.signingKeySchema=Ft,e.smsProviderSchema=Jt,e.smsSendParamsSchema=Yt,e.startSchema=B,e.tenantInsertSchema=ne,e.tenantSchema=se,e.tenantSettingsSchema=Si,e.themeInsertSchema=Bt,e.themeSchema=qt,e.tokenResponseSchema=Pt,e.totalsSchema=f,e.uiScreenSchema=st,e.userInsertSchema=E,e.userOrganizationInsertSchema=Oi,e.userOrganizationSchema=Ai,e.userPermissionInsertSchema=ai,e.userPermissionListSchema=ui,e.userPermissionSchema=ci,e.userPermissionWithDetailsListSchema=li,e.userPermissionWithDetailsSchema=di,e.userResponseSchema=w,e.userRoleInsertSchema=hi,e.userRoleListSchema=pi,e.userRoleSchema=_i,e.userSchema=v,e.verificationMethodsSchema=de,e.widgetComponentSchema=Be,e.widgetSchema=Gt}(t)),t),mn=fn.isBlockComponent,gn=fn.isFieldComponent,yn=fn.isWidgetComponent;export{mn as isBlockComponent,gn as isFieldComponent,yn as isWidgetComponent}
|
|
1
|
+
function e(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var t={};function i(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(i[n[s]]=e[n[s]])}return i}function n(e,t){var i;return(null===(i=null==e?void 0:e._def)||void 0===i?void 0:i.typeName)===t}function s(e,t){const i=e.ZodType.prototype[t];e.ZodType.prototype[t]=function(...e){const t=i.apply(this,e);return t._def.openapi=this._def.openapi,t}}function r(e){if(void 0!==e.ZodType.prototype.openapi)return;e.ZodType.prototype.openapi=function(e,t){var s,r,o,a,c,u;const d="string"==typeof e?t:e,l=null!=d?d:{},{param:h}=l,_=i(l,["param"]),p=Object.assign(Object.assign({},null===(s=this._def.openapi)||void 0===s?void 0:s._internal),"string"==typeof e?{refId:e}:void 0),f=Object.assign(Object.assign(Object.assign({},null===(r=this._def.openapi)||void 0===r?void 0:r.metadata),_),(null===(a=null===(o=this._def.openapi)||void 0===o?void 0:o.metadata)||void 0===a?void 0:a.param)||h?{param:Object.assign(Object.assign({},null===(u=null===(c=this._def.openapi)||void 0===c?void 0:c.metadata)||void 0===u?void 0:u.param),h)}:void 0),m=new this.constructor(Object.assign(Object.assign({},this._def),{openapi:Object.assign(Object.assign({},Object.keys(p).length>0?{_internal:p}:void 0),Object.keys(f).length>0?{metadata:f}:void 0)}));if(n(this,"ZodObject")){const e=this.extend;m.extend=function(...t){var i,n,s,r,o,a,c;const u=e.apply(this,t);return u._def.openapi={_internal:{extendedFrom:(null===(n=null===(i=this._def.openapi)||void 0===i?void 0:i._internal)||void 0===n?void 0:n.refId)?{refId:null===(r=null===(s=this._def.openapi)||void 0===s?void 0:s._internal)||void 0===r?void 0:r.refId,schema:this}:null===(a=null===(o=this._def.openapi)||void 0===o?void 0:o._internal)||void 0===a?void 0:a.extendedFrom},metadata:null===(c=u._def.openapi)||void 0===c?void 0:c.metadata},u}}return m},s(e,"optional"),s(e,"nullable"),s(e,"default"),s(e,"transform"),s(e,"refine");const t=e.ZodObject.prototype.deepPartial;e.ZodObject.prototype.deepPartial=function(){const e=this._def.shape(),i=t.apply(this),n=i._def.shape();return Object.entries(n).forEach((([t,i])=>{var n,s;i._def.openapi=null===(s=null===(n=e[t])||void 0===n?void 0:n._def)||void 0===s?void 0:s.openapi})),i._def.openapi=void 0,i};const r=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...e){const t=r.apply(this,e);return t._def.openapi=void 0,t};const o=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...e){const t=o.apply(this,e);return t._def.openapi=void 0,t}}function o(e,t){if(null==e||null==t)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1}if(!(e instanceof Object&&t instanceof Object))return!1;const i=Object.keys(e);return Object.keys(t).every((e=>-1!==i.indexOf(e)))&&i.every((i=>o(e[i],t[i])))}"function"==typeof SuppressedError&&SuppressedError;class a{constructor(){this.buckets=new Map}put(e){const t=this.hashCodeOf(e),i=this.buckets.get(t);i?i.some((t=>o(t,e)))||i.push(e):this.buckets.set(t,[e])}contains(e){const t=this.hashCodeOf(e),i=this.buckets.get(t);return!!i&&i.some((t=>o(t,e)))}values(){return[...this.buckets.values()].flat()}stats(){let e=0,t=0,i=0;for(const n of this.buckets.values())e+=1,t+=n.length,n.length>1&&(i+=1);return{totalBuckets:e,collisions:i,totalValues:t,hashEffectiveness:e/t}}hashCodeOf(e){let t=0;if(Array.isArray(e)){for(let i=0;i<e.length;i++)t^=this.hashCodeOf(e[i])*i;return t}if("string"==typeof e){for(let i=0;i<e.length;i++)t^=e.charCodeAt(i)*i;return t}if("number"==typeof e)return e;if("object"==typeof e)for(const[i,n]of Object.entries(e))t^=this.hashCodeOf(i)+this.hashCodeOf(null!=n?n:"");return t}}function c(e){return void 0===e}function u(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{i[e]=t(n)})),i}function d(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{t(n,e)||(i[e]=n)})),i}function l(e){return e.filter((e=>!c(e)))}const h=o;function _(e){return"string"==typeof e}class p{constructor(e){this.parents=e,this._definitions=[]}get definitions(){var e,t;return[...null!==(t=null===(e=this.parents)||void 0===e?void 0:e.flatMap((e=>e.definitions)))&&void 0!==t?t:[],...this._definitions]}register(e,t){const i=this.schemaWithRefId(e,t);return this._definitions.push({type:"schema",schema:i}),i}registerParameter(e,t){var i,n,s;const r=this.schemaWithRefId(e,t),o=null===(i=r._def.openapi)||void 0===i?void 0:i.metadata,a=r.openapi(Object.assign(Object.assign({},o),{param:Object.assign(Object.assign({},null==o?void 0:o.param),{name:null!==(s=null===(n=null==o?void 0:o.param)||void 0===n?void 0:n.name)&&void 0!==s?s:e})}));return this._definitions.push({type:"parameter",schema:a}),a}registerPath(e){this._definitions.push({type:"route",route:e})}registerWebhook(e){this._definitions.push({type:"webhook",webhook:e})}registerComponent(e,t,i){return this._definitions.push({type:"component",componentType:e,name:t,component:i}),{name:t,ref:{$ref:`#/components/${e}/${t}`}}}schemaWithRefId(e,t){return t.openapi(e)}}class f{constructor(e){this.message=e}}class m extends f{constructor(e,t){super(e),this.data=t}}class g extends f{constructor(e){super(`Missing parameter data, please specify \`${e.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`ZodSchema.openapi\``),this.data=e}}function y(e,t){try{return e()}catch(e){if(e instanceof g)throw new g(Object.assign(Object.assign({},e.data),t));throw e}}class E extends f{constructor(e){super("Unknown zod object type, please specify `type` and other OpenAPI props using `ZodSchema.openapi`."),this.data=e}}class v{static getMetadata(e){var t;const i=this.unwrapChained(e),n=e._def.openapi?e._def.openapi:i._def.openapi,s=null!==(t=e.description)&&void 0!==t?t:i.description;return{_internal:null==n?void 0:n._internal,metadata:Object.assign({description:s},null==n?void 0:n.metadata)}}static getInternalMetadata(e){const t=this.unwrapChained(e),i=e._def.openapi?e._def.openapi:t._def.openapi;return null==i?void 0:i._internal}static getParamMetadata(e){var t,i;const n=this.unwrapChained(e),s=e._def.openapi?e._def.openapi:n._def.openapi,r=null!==(t=e.description)&&void 0!==t?t:n.description;return{_internal:null==s?void 0:s._internal,metadata:Object.assign(Object.assign({},null==s?void 0:s.metadata),{param:Object.assign({description:r},null===(i=null==s?void 0:s.metadata)||void 0===i?void 0:i.param)})}}static buildSchemaMetadata(e){return d(function(e,t){const i={};return Object.entries(e).forEach((([e,n])=>{t.some((t=>t===e))||(i[e]=n)})),i}(e,["param"]),c)}static buildParameterMetadata(e){return d(e,c)}static applySchemaMetadata(e,t){return d(Object.assign(Object.assign({},e),this.buildSchemaMetadata(t)),c)}static getRefId(e){var t;return null===(t=this.getInternalMetadata(e))||void 0===t?void 0:t.refId}static unwrapChained(e){return this.unwrapUntil(e)}static getDefaultValue(e){const t=this.unwrapUntil(e,"ZodDefault");return null==t?void 0:t._def.defaultValue()}static unwrapUntil(e,t){return t&&n(e,t)?e:n(e,"ZodOptional")||n(e,"ZodNullable")||n(e,"ZodBranded")?this.unwrapUntil(e.unwrap(),t):n(e,"ZodDefault")||n(e,"ZodReadonly")?this.unwrapUntil(e._def.innerType,t):n(e,"ZodEffects")?this.unwrapUntil(e._def.schema,t):n(e,"ZodPipeline")?this.unwrapUntil(e._def.in,t):t?void 0:e}static isOptionalSchema(e){return e.isOptional()}}class b{transform(e,t,i){var n,s;const r=e._def.type;return Object.assign(Object.assign({},t("array")),{items:i(r),minItems:null===(n=e._def.minLength)||void 0===n?void 0:n.value,maxItems:null===(s=e._def.maxLength)||void 0===s?void 0:s.value})}}class w{transform(e){return Object.assign(Object.assign({},e("string")),{pattern:"^d+$"})}}class O{transform(e,t,i,n,s){const r=[...e.options.values()],o=r.map(n);return t?{oneOf:i(o,t)}:{oneOf:o,discriminator:this.mapDiscriminator(r,e.discriminator,s)}}mapDiscriminator(e,t,i){if(e.some((e=>void 0===v.getRefId(e))))return;const s={};return e.forEach((e=>{var r;const o=v.getRefId(e),a=null===(r=e.shape)||void 0===r?void 0:r[t];if(n(a,"ZodEnum")||n(a,"ZodNativeEnum"))return void Object.values(a.enum).filter(_).forEach((e=>{s[e]=i(o)}));const c=null==a?void 0:a._def.value;if("string"!=typeof c)throw new Error(`Discriminator ${t} could not be found in one of the values of a discriminated union`);s[c]=i(o)})),{propertyName:t,mapping:s}}}class A{transform(e,t){return Object.assign(Object.assign({},t("string")),{enum:e._def.values})}}class S{transform(e,t,i,n){const s={allOf:this.flattenIntersectionTypes(e).map(n)};return t?{anyOf:i([s],t)}:s}flattenIntersectionTypes(e){return n(e,"ZodIntersection")?[...this.flattenIntersectionTypes(e._def.left),...this.flattenIntersectionTypes(e._def.right)]:[e]}}class I{transform(e,t){return Object.assign(Object.assign({},t(typeof e._def.value)),{enum:[e._def.value]})}}class C{transform(e,t){const{type:i,values:n}=function(e){const t=Object.keys(e).filter((t=>"number"!=typeof e[e[t]])).map((t=>e[t])),i=t.filter((e=>"number"==typeof e)).length;return{values:t,type:0===i?"string":i===t.length?"numeric":"mixed"}}(e._def.values);if("mixed"===i)throw new f("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},t("numeric"===i?"integer":"string")),{enum:n})}}class N{transform(e,t,i){return Object.assign(Object.assign({},t(e.isInt?"integer":"number")),i(e._def.checks))}}class T{transform(e,t,i,n){var s;const r=null===(s=v.getInternalMetadata(e))||void 0===s?void 0:s.extendedFrom,o=this.requiredKeysOf(e),a=u(e._def.shape(),n);if(!r)return Object.assign(Object.assign(Object.assign(Object.assign({},i("object")),{properties:a,default:t}),o.length>0?{required:o}:{}),this.generateAdditionalProperties(e,n));const c=r.schema;n(c);const d=this.requiredKeysOf(c),l=u(null==c?void 0:c._def.shape(),n),_=Object.fromEntries(Object.entries(a).filter((([e,t])=>!h(l[e],t)))),p=o.filter((e=>!d.includes(e))),f=Object.assign(Object.assign(Object.assign(Object.assign({},i("object")),{default:t,properties:_}),p.length>0?{required:p}:{}),this.generateAdditionalProperties(e,n));return{allOf:[{$ref:`#/components/schemas/${r.refId}`},f]}}generateAdditionalProperties(e,t){const i=e._def.unknownKeys,s=e._def.catchall;return n(s,"ZodNever")?"strict"===i?{additionalProperties:!1}:{}:{additionalProperties:t(s)}}requiredKeysOf(e){return Object.entries(e._def.shape()).filter((([e,t])=>!v.isOptionalSchema(t))).map((([e,t])=>e))}}class x{transform(e,t,i){const s=e._def.keyType,r=i(e._def.valueType);if(n(s,"ZodEnum")||n(s,"ZodNativeEnum")){const e=Object.values(s.enum).filter(_).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r})),{});return Object.assign(Object.assign({},t("object")),{properties:e})}return Object.assign(Object.assign({},t("object")),{additionalProperties:r})}}class k{transform(e,t){var i,n,s;const r=this.getZodStringCheck(e,"regex"),o=null===(i=this.getZodStringCheck(e,"length"))||void 0===i?void 0:i.value,a=Number.isFinite(e.minLength)&&null!==(n=e.minLength)&&void 0!==n?n:void 0,c=Number.isFinite(e.maxLength)&&null!==(s=e.maxLength)&&void 0!==s?s:void 0;return Object.assign(Object.assign({},t("string")),{minLength:null!=o?o:a,maxLength:null!=o?o:c,format:this.mapStringFormat(e),pattern:null==r?void 0:r.regex.source})}mapStringFormat(e){return e.isUUID?"uuid":e.isEmail?"email":e.isURL?"uri":e.isDate?"date":e.isDatetime?"date-time":e.isCUID?"cuid":e.isCUID2?"cuid2":e.isULID?"ulid":e.isIP?"ip":e.isEmoji?"emoji":void 0}getZodStringCheck(e,t){return e._def.checks.find((e=>e.kind===t))}}class R{constructor(e){this.versionSpecifics=e}transform(e,t,i){const{items:n}=e._def,s=n.map(i);return Object.assign(Object.assign({},t("array")),this.versionSpecifics.mapTupleItems(s))}}class D{transform(e,t,i){return{anyOf:t(this.flattenUnionTypes(e).map((e=>{const t=this.unwrapNullable(e);return i(t)})))}}flattenUnionTypes(e){return n(e,"ZodUnion")?e._def.options.flatMap((e=>this.flattenUnionTypes(e))):[e]}unwrapNullable(e){return n(e,"ZodNullable")?this.unwrapNullable(e.unwrap()):e}}class L{constructor(e){this.versionSpecifics=e,this.objectTransformer=new T,this.stringTransformer=new k,this.numberTransformer=new N,this.bigIntTransformer=new w,this.literalTransformer=new I,this.enumTransformer=new A,this.nativeEnumTransformer=new C,this.arrayTransformer=new b,this.unionTransformer=new D,this.discriminatedUnionTransformer=new O,this.intersectionTransformer=new S,this.recordTransformer=new x,this.tupleTransformer=new R(e)}transform(e,t,i,s,r){if(n(e,"ZodNull"))return this.versionSpecifics.nullType;if(n(e,"ZodUnknown")||n(e,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,t);if(n(e,"ZodObject"))return this.objectTransformer.transform(e,r,(e=>this.versionSpecifics.mapNullableType(e,t)),i);const o=this.transformSchemaWithoutDefault(e,t,i,s);return Object.assign(Object.assign({},o),{default:r})}transformSchemaWithoutDefault(e,t,i,s){if(n(e,"ZodUnknown")||n(e,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,t);if(n(e,"ZodString"))return this.stringTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodNumber"))return this.numberTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),(e=>this.versionSpecifics.getNumberChecks(e)));if(n(e,"ZodBigInt"))return this.bigIntTransformer.transform((e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",t);if(n(e,"ZodLiteral"))return this.literalTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodEnum"))return this.enumTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodNativeEnum"))return this.nativeEnumTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)));if(n(e,"ZodArray"))return this.arrayTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodTuple"))return this.tupleTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodUnion"))return this.unionTransformer.transform(e,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i);if(n(e,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(e,t,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i,s);if(n(e,"ZodIntersection"))return this.intersectionTransformer.transform(e,t,(e=>this.versionSpecifics.mapNullableOfArray(e,t)),i);if(n(e,"ZodRecord"))return this.recordTransformer.transform(e,(e=>this.versionSpecifics.mapNullableType(e,t)),i);if(n(e,"ZodDate"))return this.versionSpecifics.mapNullableType("string",t);const r=v.getRefId(e);throw new E({currentSchema:e._def,schemaName:r})}}class j{constructor(e,t){this.definitions=e,this.versionSpecifics=t,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new L(t),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach((e=>this.generateSingle(e))),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach((e=>this.generateSingle(e))),{components:this.buildComponents()}}buildComponents(){var e,t;const i={};return this.rawComponents.forEach((({componentType:e,name:t,component:n})=>{var s;null!==(s=i[e])&&void 0!==s||(i[e]={}),i[e][t]=n})),Object.assign(Object.assign({},i),{schemas:Object.assign(Object.assign({},null!==(e=i.schemas)&&void 0!==e?e:{}),this.schemaRefs),parameters:Object.assign(Object.assign({},null!==(t=i.parameters)&&void 0!==t?t:{}),this.paramRefs)})}sortDefinitions(){const e=["schema","parameter","component","route"];this.definitions.sort(((t,i)=>"type"in t?"type"in i?e.findIndex((e=>e===t.type))-e.findIndex((e=>e===i.type)):1:"type"in i?-1:0))}generateSingle(e){if("type"in e)switch(e.type){case"parameter":return void this.generateParameterDefinition(e.schema);case"schema":return void this.generateSchemaWithRef(e.schema);case"route":return void this.generateSingleRoute(e.route);case"component":return void this.rawComponents.push(e)}else this.generateSchemaWithRef(e)}generateParameterDefinition(e){const t=v.getRefId(e),i=this.generateParameter(e);return t&&(this.paramRefs[t]=i),i}getParameterRef(e,t){var i,n,s,r,o;const a=null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.param,c=(null===(n=null==e?void 0:e._internal)||void 0===n?void 0:n.refId)?this.paramRefs[null===(s=e._internal)||void 0===s?void 0:s.refId]:void 0;if((null===(r=null==e?void 0:e._internal)||void 0===r?void 0:r.refId)&&c){if(a&&c.in!==a.in||(null==t?void 0:t.in)&&c.in!==t.in)throw new m(`Conflicting location for parameter ${c.name}`,{key:"in",values:l([c.in,null==t?void 0:t.in,null==a?void 0:a.in])});if(a&&c.name!==a.name||(null==t?void 0:t.name)&&c.name!==(null==t?void 0:t.name))throw new m("Conflicting names for parameter",{key:"name",values:l([c.name,null==t?void 0:t.name,null==a?void 0:a.name])});return{$ref:`#/components/parameters/${null===(o=e._internal)||void 0===o?void 0:o.refId}`}}}generateInlineParameters(e,t){var i;const s=v.getMetadata(e),r=null===(i=null==s?void 0:s.metadata)||void 0===i?void 0:i.param,o=this.getParameterRef(s,{in:t});if(o)return[o];if(n(e,"ZodObject")){const i=e._def.shape(),n=Object.entries(i).map((([e,i])=>{var n,s;const r=v.getMetadata(i),o=this.getParameterRef(r,{in:t,name:e});if(o)return o;const a=null===(n=null==r?void 0:r.metadata)||void 0===n?void 0:n.param;if((null==a?void 0:a.name)&&a.name!==e)throw new m("Conflicting names for parameter",{key:"name",values:[e,a.name]});if((null==a?void 0:a.in)&&a.in!==t)throw new m(`Conflicting location for parameter ${null!==(s=a.name)&&void 0!==s?s:e}`,{key:"in",values:[t,a.in]});return this.generateParameter(i.openapi({param:{name:e,in:t}}))}));return n}if((null==r?void 0:r.in)&&r.in!==t)throw new m(`Conflicting location for parameter ${r.name}`,{key:"in",values:[t,r.in]});return[this.generateParameter(e.openapi({param:{in:t}}))]}generateSimpleParameter(e){var t;const i=v.getParamMetadata(e),n=null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.param,s=!v.isOptionalSchema(e)&&!e.isNullable(),r=this.generateSchemaWithRef(e);return Object.assign({schema:r,required:s},n?v.buildParameterMetadata(n):{})}generateParameter(e){var t;const i=v.getMetadata(e),n=null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.param,s=null==n?void 0:n.name,r=null==n?void 0:n.in;if(!s)throw new g({missingField:"name"});if(!r)throw new g({missingField:"in",paramName:s});const o=this.generateSimpleParameter(e);return Object.assign(Object.assign({},o),{in:r,name:s})}generateSchemaWithMetadata(e){var t;const i=v.unwrapChained(e),n=v.getMetadata(e),s=v.getDefaultValue(e),r=(null===(t=null==n?void 0:n.metadata)||void 0===t?void 0:t.type)?{type:null==n?void 0:n.metadata.type}:this.toOpenAPISchema(i,e.isNullable(),s);return(null==n?void 0:n.metadata)?v.applySchemaMetadata(r,n.metadata):d(r,c)}constructReferencedOpenAPISchema(e){var t;const i=v.getMetadata(e),n=v.unwrapChained(e),s=v.getDefaultValue(e),r=e.isNullable();return(null===(t=null==i?void 0:i.metadata)||void 0===t?void 0:t.type)?this.versionSpecifics.mapNullableType(i.metadata.type,r):this.toOpenAPISchema(n,r,s)}generateSimpleSchema(e){var t;const i=v.getMetadata(e),n=v.getRefId(e);if(!n||!this.schemaRefs[n])return this.generateSchemaWithMetadata(e);const s=this.schemaRefs[n],r={$ref:this.generateSchemaRef(n)},o=d(v.buildSchemaMetadata(null!==(t=null==i?void 0:i.metadata)&&void 0!==t?t:{}),((e,t)=>void 0===e||h(e,s[t])));if(o.type)return{allOf:[r,o]};const a=d(this.constructReferencedOpenAPISchema(e),((e,t)=>void 0===e||h(e,s[t]))),c=v.applySchemaMetadata(a,o);return Object.keys(c).length>0?{allOf:[r,c]}:r}generateSchemaWithRef(e){const t=v.getRefId(e),i=this.generateSimpleSchema(e);return t&&void 0===this.schemaRefs[t]?(this.schemaRefs[t]=i,{$ref:this.generateSchemaRef(t)}):i}generateSchemaRef(e){return`#/components/schemas/${e}`}getRequestBody(e){if(!e)return;const{content:t}=e,n=i(e,["content"]),s=this.getBodyContent(t);return Object.assign(Object.assign({},n),{content:s})}getParameters(e){if(!e)return[];const{headers:t}=e,i=this.cleanParameter(e.query),n=this.cleanParameter(e.params),s=this.cleanParameter(e.cookies),r=y((()=>i?this.generateInlineParameters(i,"query"):[]),{location:"query"}),o=y((()=>n?this.generateInlineParameters(n,"path"):[]),{location:"path"}),a=y((()=>s?this.generateInlineParameters(s,"cookie"):[]),{location:"cookie"});return[...o,...r,...y((()=>{if(Array.isArray(t))return t.flatMap((e=>this.generateInlineParameters(e,"header")));const e=this.cleanParameter(t);return e?this.generateInlineParameters(e,"header"):[]}),{location:"header"}),...a]}cleanParameter(e){if(e)return n(e,"ZodEffects")?this.cleanParameter(e._def.schema):e}generatePath(e){const{method:t,path:n,request:s,responses:r}=e,o=i(e,["method","path","request","responses"]),a=u(r,(e=>this.getResponse(e))),c=y((()=>this.getParameters(s)),{route:`${t} ${n}`}),d=this.getRequestBody(null==s?void 0:s.body);return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},o),c.length>0?{parameters:[...o.parameters||[],...c]}:{}),d?{requestBody:d}:{}),{responses:a})}}generateSingleRoute(e){const t=this.generatePath(e);return this.pathRefs[e.path]=Object.assign(Object.assign({},this.pathRefs[e.path]),t),t}getResponse(e){if(this.isReferenceObject(e))return e;const{content:t,headers:s}=e,r=i(e,["content","headers"]),o=t?{content:this.getBodyContent(t)}:{};if(!s)return Object.assign(Object.assign({},r),o);const a=n(s,"ZodObject")?this.getResponseHeaders(s):s;return Object.assign(Object.assign(Object.assign({},r),{headers:a}),o)}isReferenceObject(e){return"$ref"in e}getResponseHeaders(e){return u(e._def.shape(),(e=>this.generateSimpleParameter(e)))}getBodyContent(e){return u(e,(e=>{if(!e||!function(e){return"_def"in e}(e.schema))return e;const{schema:t}=e,n=i(e,["schema"]),s=this.generateSchemaWithRef(t);return Object.assign({schema:s},n)}))}toOpenAPISchema(e,t,i){return this.openApiTransformer.transform(e,t,(e=>this.generateSchemaWithRef(e)),(e=>this.generateSchemaRef(e)),i)}}class F{get nullType(){return{nullable:!0}}mapNullableOfArray(e,t){return t?[...e,this.nullType]:e}mapNullableType(e,t){return Object.assign(Object.assign({},e?{type:e}:void 0),t?this.nullType:void 0)}mapTupleItems(e){const t=function(e){const t=new a;return e.forEach((e=>t.put(e))),[...t.values()]}(e);return{items:1===t.length?t[0]:{anyOf:t},minItems:e.length,maxItems:e.length}}getNumberChecks(e){return Object.assign({},...e.map((e=>{switch(e.kind){case"min":return e.inclusive?{minimum:Number(e.value)}:{minimum:Number(e.value),exclusiveMinimum:!0};case"max":return e.inclusive?{maximum:Number(e.value)}:{maximum:Number(e.value),exclusiveMaximum:!0};default:return{}}})))}}class U{constructor(e){const t=new F;this.generator=new j(e,t)}generateDocument(e){const t=this.generator.generateDocumentData();return Object.assign(Object.assign({},e),t)}generateComponents(){return this.generator.generateComponents()}}class P{get nullType(){return{type:"null"}}mapNullableOfArray(e,t){return t?[...e,this.nullType]:e}mapNullableType(e,t){return e?t?{type:Array.isArray(e)?[...e,"null"]:[e,"null"]}:{type:e}:{}}mapTupleItems(e){return{prefixItems:e}}getNumberChecks(e){return Object.assign({},...e.map((e=>{switch(e.kind){case"min":return e.inclusive?{minimum:Number(e.value)}:{exclusiveMinimum:Number(e.value)};case"max":return e.inclusive?{maximum:Number(e.value)}:{exclusiveMaximum:Number(e.value)};default:return{}}})))}}function M(e){return"type"in e&&"webhook"===e.type}class Z{constructor(e){this.definitions=e,this.webhookRefs={};const t=new P;this.generator=new j(this.definitions,t)}generateDocument(e){const t=this.generator.generateDocumentData();return this.definitions.filter(M).forEach((e=>this.generateSingleWebhook(e.webhook))),Object.assign(Object.assign(Object.assign({},e),t),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateSingleWebhook(e){const t=this.generator.generatePath(e);return this.webhookRefs[e.path]=Object.assign(Object.assign({},this.webhookRefs[e.path]),t),t}}var $=e=>{const t=e.split("/");return""===t[0]&&t.shift(),t},H={},z=(e,t)=>{if("*"===e)return"*";const i=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(i){const n=`${e}#${t}`;return H[n]||(H[n]=i[2]?t&&":"!==t[0]&&"*"!==t[0]?[n,i[1],new RegExp(`^${i[2]}(?=/${t})`)]:[e,i[1],new RegExp(`^${i[2]}$`)]:[e,i[1],!0]),H[n]}return null},G=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(e=>{try{return t(e)}catch{return e}}))}},B=e=>{const t=e.url,i=t.indexOf("/",t.indexOf(":")+4);let n=i;for(;n<t.length;n++){const e=t.charCodeAt(n);if(37===e){const e=t.indexOf("?",n),r=t.slice(i,-1===e?void 0:e);return s=r.includes("%25")?r.replace(/%25/g,"%2525"):r,G(s,decodeURI)}if(63===e)break}var s;return t.slice(i,n)},q=e=>{const t=B(e);return t.length>1&&"/"===t.at(-1)?t.slice(0,-1):t},W=(e,t,...i)=>(i.length&&(t=W(t,...i)),`${"/"===e?.[0]?"":"/"}${e}${"/"===t?"":`${"/"===e?.at(-1)?"":"/"}${"/"===t?.[0]?t.slice(1):t}`}`),K=e=>{if(63!==e.charCodeAt(e.length-1)||!e.includes(":"))return null;const t=e.split("/"),i=[];let n="";return t.forEach((e=>{if(""===e||/\:/.test(e)){if(/\:/.test(e))if(/\?/.test(e)){i.push(0===i.length&&""===n?"/":n);const t=e.replace("?","");n+="/"+t,i.push(n)}else n+="/"+e}else n+="/"+e})),i.filter(((e,t,i)=>i.indexOf(e)===t))},V=e=>/[%+]/.test(e)?(-1!==e.indexOf("+")&&(e=e.replace(/\+/g," ")),-1!==e.indexOf("%")?G(e,J):e):e,X=(e,t,i)=>{let n;if(!i&&t&&!/[%+]/.test(t)){let i=e.indexOf("?",8);if(-1===i)return;for(e.startsWith(t,i+1)||(i=e.indexOf(`&${t}`,i+1));-1!==i;){const n=e.charCodeAt(i+t.length+1);if(61===n){const n=i+t.length+2,s=e.indexOf("&",n);return V(e.slice(n,-1===s?void 0:s))}if(38==n||isNaN(n))return"";i=e.indexOf(`&${t}`,i+1)}if(n=/[%+]/.test(e),!n)return}const s={};n??=/[%+]/.test(e);let r=e.indexOf("?",8);for(;-1!==r;){const t=e.indexOf("&",r+1);let o=e.indexOf("=",r);o>t&&-1!==t&&(o=-1);let a,c=e.slice(r+1,-1===o?-1===t?void 0:t:o);n&&(c=V(c)),r=t,""!==c&&(-1===o?a="":(a=e.slice(o+1,-1===t?void 0:t),n&&(a=V(a))),i?(s[c]&&Array.isArray(s[c])||(s[c]=[]),s[c].push(a)):s[c]??=a)}return t?s[t]:s},Y=X,J=decodeURIComponent,Q=/^[\w!#$%&'*.^`|~+-]+$/,ee=/^[ !#-:<-[\]-~]*$/,te=class extends Error{res;status;constructor(e=500,t){super(t?.message,{cause:t?.cause}),this.res=t?.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},ie=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,ne=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/,se=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,re=(e,t)=>async(i,n)=>{let s={};const r=i.req.header("Content-Type");switch(e){case"json":if(!r||!ie.test(r))break;try{s=await i.req.json()}catch{throw new te(400,{message:"Malformed JSON in request body"})}break;case"form":{if(!r||!ne.test(r)&&!se.test(r))break;let e;if(i.req.bodyCache.formData)e=await i.req.bodyCache.formData;else try{const t=await i.req.arrayBuffer();e=await((e,t)=>new Response(e,{headers:{"Content-Type":t}}).formData())(t,r),i.req.bodyCache.formData=e}catch(e){let t="Malformed FormData request.";throw t+=e instanceof Error?` ${e.message}`:` ${String(e)}`,new te(400,{message:t})}const t={};e.forEach(((e,i)=>{i.endsWith("[]")?(t[i]??=[]).push(e):Array.isArray(t[i])?t[i].push(e):t[i]=i in t?[t[i],e]:e})),s=t;break}case"query":s=Object.fromEntries(Object.entries(i.req.queries()).map((([e,t])=>1===t.length?[e,t[0]]:[e,t])));break;case"param":s=i.req.param();break;case"header":s=i.req.header();break;case"cookie":s=(e=>{const t=e.req.raw.headers.get("Cookie");if(!t)return{};return(e=>{const t=e.trim().split(";"),i={};for(let e of t){e=e.trim();const t=e.indexOf("=");if(-1===t)continue;const n=e.substring(0,t).trim();if(!Q.test(n))continue;let s=e.substring(t+1).trim();s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),ee.test(s)&&(i[n]=-1!==s.indexOf("%")?G(s,J):s)}return i})(t)})(i)}const o=await t(s,i);return o instanceof Response?o:(i.req.addValidatedData(e,o),await n())};const oe=function(e,t,i,n){return re(e,(async(s,r)=>{let o=s;if("header"===e&&"_def"in t||"header"===e&&"_zod"in t){const e=Object.keys("in"in t?t.in.shape:t.shape),i=Object.fromEntries(e.map((e=>[e.toLowerCase(),e])));o=Object.fromEntries(Object.entries(s).map((([e,t])=>[i[e]||e,t])))}const a=n&&n.validationFunction?await n.validationFunction(t,o):await t.safeParseAsync(o);if(i){const t=await i({data:o,...a,target:e},r);if(t){if(t instanceof Response)return t;if("response"in t)return t.response}}return a.success?a.data:r.json(a,400)}))};var ae=(e,t,i)=>(n,s)=>{let r=-1;return async function o(a){if(a<=r)throw new Error("next() called multiple times");let c;r=a;let u,d=!1;if(e[a]?(u=e[a][0][0],n.req.routeIndex=a):u=a===e.length&&s||void 0,u)try{c=await u(n,(()=>o(a+1)))}catch(e){if(!(e instanceof Error&&t))throw e;n.error=e,c=await t(e,n),d=!0}else!1===n.finalized&&i&&(c=await i(n));return c&&(!1===n.finalized||d)&&(n.res=c),n}(0)},ce=Symbol(),ue=(e,t,i)=>{void 0!==e[t]?Array.isArray(e[t])?e[t].push(i):e[t]=[e[t],i]:e[t]=t.endsWith("[]")?[i]:i},de=(e,t,i)=>{let n=e;const s=t.split(".");s.forEach(((e,t)=>{t===s.length-1?n[e]=i:((!n[e]||"object"!=typeof n[e]||Array.isArray(n[e])||n[e]instanceof File)&&(n[e]=Object.create(null)),n=n[e])}))},le=e=>G(e,J),he=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",i=[[]]){this.raw=e,this.path=t,this.#t=i,this.#e={}}param(e){return e?this.#i(e):this.#n()}#i(e){const t=this.#t[0][this.routeIndex][1][e],i=this.#s(t);return i&&/\%/.test(i)?le(i):i}#n(){const e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(const i of t){const t=this.#s(this.#t[0][this.routeIndex][1][i]);void 0!==t&&(e[i]=/\%/.test(t)?le(t):t)}return e}#s(e){return this.#t[1]?this.#t[1][e]:e}query(e){return Y(this.url,e)}queries(e){return((e,t)=>X(this.url,t,!0))(0,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;const t={};return this.raw.headers.forEach(((e,i)=>{t[i]=e})),t}async parseBody(e){return this.bodyCache.parsedBody??=await(async(e,t=Object.create(null))=>{const{all:i=!1,dot:n=!1}=t,s=(e instanceof he?e.raw.headers:e.headers).get("Content-Type");return s?.startsWith("multipart/form-data")||s?.startsWith("application/x-www-form-urlencoded")?async function(e,t){const i=await e.formData();return i?function(e,t){const i=Object.create(null);return e.forEach(((e,n)=>{t.all||n.endsWith("[]")?ue(i,n,e):i[n]=e})),t.dot&&Object.entries(i).forEach((([e,t])=>{e.includes(".")&&(de(i,e,t),delete i[e])})),i}(i,t):{}}(e,{all:i,dot:n}):{}})(this,e)}#r=e=>{const{bodyCache:t,raw:i}=this,n=t[e];if(n)return n;const s=Object.keys(t)[0];return s?t[s].then((t=>("json"===s&&(t=JSON.stringify(t)),new Response(t)[e]()))):t[e]=i[e]()};json(){return this.#r("text").then((e=>JSON.parse(e)))}text(){return this.#r("text")}arrayBuffer(){return this.#r("arrayBuffer")}blob(){return this.#r("blob")}formData(){return this.#r("formData")}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[ce](){return this.#t}get matchedRoutes(){return this.#t[0].map((([[,e]])=>e))}get routePath(){return this.#t[0].map((([[,e]])=>e))[this.routeIndex].path}},_e=async(e,t,i,n,s)=>{"object"!=typeof e||e instanceof String||(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const r=e.callbacks;return r?.length?(s?s[0]+=e:s=[e],Promise.all(r.map((e=>e({phase:t,buffer:s,context:n})))).then((e=>Promise.all(e.filter(Boolean).map((e=>_e(e,t,!1,n,s)))).then((()=>s[0]))))):Promise.resolve(e)},pe=(e,t)=>({"Content-Type":e,...t}),fe=class{#o;#a;env={};#c;finalized=!1;error;#u;#d;#l;#h;#_;#p;#f;#t;#m;constructor(e,t){this.#o=e,t&&(this.#d=t.executionCtx,this.env=t.env,this.#p=t.notFoundHandler,this.#m=t.path,this.#t=t.matchResult)}get req(){return this.#a??=new he(this.#o,this.#m,this.#t),this.#a}get event(){if(this.#d&&"respondWith"in this.#d)return this.#d;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#d)return this.#d;throw Error("This context has no ExecutionContext")}get res(){return this.#l||=new Response(null,{headers:this.#f??=new Headers})}set res(e){if(this.#l&&e){e=new Response(e.body,e);for(const[t,i]of this.#l.headers.entries())if("content-type"!==t)if("set-cookie"===t){const t=this.#l.headers.getSetCookie();e.headers.delete("set-cookie");for(const i of t)e.headers.append("set-cookie",i)}else e.headers.set(t,i)}this.#l=e,this.finalized=!0}render=(...e)=>(this.#_??=e=>this.html(e),this.#_(...e));setLayout=e=>this.#h=e;getLayout=()=>this.#h;setRenderer=e=>{this.#_=e};header=(e,t,i)=>{this.finalized&&(this.#l=new Response(this.#l.body,this.#l));const n=this.#l?this.#l.headers:this.#f??=new Headers;void 0===t?n.delete(e):i?.append?n.append(e,t):n.set(e,t)};status=e=>{this.#u=e};set=(e,t)=>{this.#c??=new Map,this.#c.set(e,t)};get=e=>this.#c?this.#c.get(e):void 0;get var(){return this.#c?Object.fromEntries(this.#c):{}}#g(e,t,i){const n=this.#l?new Headers(this.#l.headers):this.#f??new Headers;if("object"==typeof t&&"headers"in t){const e=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(const[t,i]of e)"set-cookie"===t.toLowerCase()?n.append(t,i):n.set(t,i)}if(i)for(const[e,t]of Object.entries(i))if("string"==typeof t)n.set(e,t);else{n.delete(e);for(const i of t)n.append(e,i)}const s="number"==typeof t?t:t?.status??this.#u;return new Response(e,{status:s,headers:n})}newResponse=(...e)=>this.#g(...e);body=(e,t,i)=>this.#g(e,t,i);text=(e,t,i)=>this.#f||this.#u||t||i||this.finalized?this.#g(e,t,pe("text/plain; charset=UTF-8",i)):new Response(e);json=(e,t,i)=>this.#g(JSON.stringify(e),t,pe("application/json",i));html=(e,t,i)=>{const n=e=>this.#g(e,t,pe("text/html; charset=UTF-8",i));return"object"==typeof e?_e(e,1,!1,{}).then(n):n(e)};redirect=(e,t)=>{const i=String(e);return this.header("Location",/[^\x00-\xFF]/.test(i)?encodeURI(i):i),this.newResponse(null,t??302)};notFound=()=>(this.#p??=()=>new Response,this.#p(this))},me="ALL",ge=["get","post","put","delete","options","patch"],ye="Can not add a route since the matcher is already built.",Ee=class extends Error{},ve=e=>e.text("404 Not Found",404),be=(e,t)=>{if("getResponse"in e){const i=e.getResponse();return t.newResponse(i.body,i)}return console.error(e),t.text("Internal Server Error",500)},we=class e{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#m="/";routes=[];constructor(e={}){[...ge,"all"].forEach((e=>{this[e]=(t,...i)=>("string"==typeof t?this.#m=t:this.#y(e,this.#m,t),i.forEach((t=>{this.#y(e,this.#m,t)})),this)})),this.on=(e,t,...i)=>{for(const n of[t].flat()){this.#m=n;for(const t of[e].flat())i.map((e=>{this.#y(t.toUpperCase(),this.#m,e)}))}return this},this.use=(e,...t)=>("string"==typeof e?this.#m=e:(this.#m="*",t.unshift(e)),t.forEach((e=>{this.#y(me,this.#m,e)})),this);const{strict:t,...i}=e;Object.assign(this,i),this.getPath=t??1?e.getPath??B:q}#E(){const t=new e({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#p=this.#p,t.routes=this.routes,t}#p=ve;errorHandler=be;route(e,t){const i=this.basePath(e);return t.routes.map((e=>{let n;t.errorHandler===be?n=e.handler:(n=async(i,n)=>(await ae([],t.errorHandler)(i,(()=>e.handler(i,n)))).res,n.__COMPOSED_HANDLER=e.handler),i.#y(e.method,e.path,n)})),this}basePath(e){const t=this.#E();return t._basePath=W(this._basePath,e),t}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#p=e,this);mount(e,t,i){let n,s;i&&("function"==typeof i?s=i:(s=i.optionHandler,n=!1===i.replaceRequest?e=>e:i.replaceRequest));const r=s?e=>{const t=s(e);return Array.isArray(t)?t:[t]}:e=>{let t;try{t=e.executionCtx}catch{}return[e.env,t]};return n||=(()=>{const t=W(this._basePath,e),i="/"===t?0:t.length;return e=>{const t=new URL(e.url);return t.pathname=t.pathname.slice(i)||"/",new Request(t,e)}})(),this.#y(me,W(e,"*"),(async(e,i)=>{const s=await t(n(e.req.raw),...r(e));if(s)return s;await i()})),this}#y(e,t,i){e=e.toUpperCase(),t=W(this._basePath,t);const n={basePath:this._basePath,path:t,method:e,handler:i};this.router.add(e,t,[i,n]),this.routes.push(n)}#v(e,t){if(e instanceof Error)return this.errorHandler(e,t);throw e}#b(e,t,i,n){if("HEAD"===n)return(async()=>new Response(null,await this.#b(e,t,i,"GET")))();const s=this.getPath(e,{env:i}),r=this.router.match(n,s),o=new fe(e,{path:s,matchResult:r,env:i,executionCtx:t,notFoundHandler:this.#p});if(1===r[0].length){let e;try{e=r[0][0][0][0](o,(async()=>{o.res=await this.#p(o)}))}catch(e){return this.#v(e,o)}return e instanceof Promise?e.then((e=>e||(o.finalized?o.res:this.#p(o)))).catch((e=>this.#v(e,o))):e??this.#p(o)}const a=ae(r[0],this.errorHandler,this.#p);return(async()=>{try{const e=await a(o);if(!e.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return e.res}catch(e){return this.#v(e,o)}})()}fetch=(e,...t)=>this.#b(e,t[1],t[0],e.method);request=(e,t,i,n)=>e instanceof Request?this.fetch(t?new Request(e,t):e,i,n):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${W("/",e)}`,t),i,n));fire=()=>{addEventListener("fetch",(e=>{e.respondWith(this.#b(e.request,e,void 0,e.request.method))}))}},Oe=[];function Ae(e,t){const i=this.buildAllMatchers(),n=(e,t)=>{const n=i[e]||i[me],s=n[2][t];if(s)return s;const r=t.match(n[0]);if(!r)return[[],Oe];const o=r.indexOf("",1);return[n[1][o],r]};return this.match=n,n(e,t)}var Se="[^/]+",Ie=".*",Ce="(?:|/.*)",Ne=Symbol(),Te=new Set(".\\+*[^]$()");function xe(e,t){return 1===e.length?1===t.length?e<t?-1:1:-1:1===t.length||e===Ie||e===Ce?1:t===Ie||t===Ce?-1:e===Se?1:t===Se?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var ke=class e{#w;#O;#A=Object.create(null);insert(t,i,n,s,r){if(0===t.length){if(void 0!==this.#w)throw Ne;if(r)return;return void(this.#w=i)}const[o,...a]=t,c="*"===o?0===a.length?["","",Ie]:["","",Se]:"/*"===o?["","",Ce]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let u;if(c){const t=c[1];let i=c[2]||Se;if(t&&c[2]){if(".*"===i)throw Ne;if(i=i.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(i))throw Ne}if(u=this.#A[i],!u){if(Object.keys(this.#A).some((e=>e!==Ie&&e!==Ce)))throw Ne;if(r)return;u=this.#A[i]=new e,""!==t&&(u.#O=s.varIndex++)}r||""===t||n.push([t,u.#O])}else if(u=this.#A[o],!u){if(Object.keys(this.#A).some((e=>e.length>1&&e!==Ie&&e!==Ce)))throw Ne;if(r)return;u=this.#A[o]=new e}u.insert(a,i,n,s,r)}buildRegExpStr(){const e=Object.keys(this.#A).sort(xe).map((e=>{const t=this.#A[e];return("number"==typeof t.#O?`(${e})@${t.#O}`:Te.has(e)?`\\${e}`:e)+t.buildRegExpStr()}));return"number"==typeof this.#w&&e.unshift(`#${this.#w}`),0===e.length?"":1===e.length?e[0]:"(?:"+e.join("|")+")"}},Re=class{#S={varIndex:0};#I=new ke;insert(e,t,i){const n=[],s=[];for(let t=0;;){let i=!1;if(e=e.replace(/\{[^}]+\}/g,(e=>{const n=`@\\${t}`;return s[t]=[n,e],t++,i=!0,n})),!i)break}const r=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let e=s.length-1;e>=0;e--){const[t]=s[e];for(let i=r.length-1;i>=0;i--)if(-1!==r[i].indexOf(t)){r[i]=r[i].replace(t,s[e][1]);break}}return this.#I.insert(r,t,n,this.#S,i),n}buildRegExp(){let e=this.#I.buildRegExpStr();if(""===e)return[/^$/,[],[]];let t=0;const i=[],n=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,((e,s,r)=>void 0!==s?(i[++t]=Number(s),"$()"):void 0!==r?(n[Number(r)]=++t,""):"")),[new RegExp(`^${e}`),i,n]}},De=[/^$/,[],Object.create(null)],Le=Object.create(null);function je(e){return Le[e]??=new RegExp("*"===e?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,((e,t)=>t?`\\${t}`:"(?:|/.*)"))}$`)}function Fe(e,t){if(e)for(const i of Object.keys(e).sort(((e,t)=>t.length-e.length)))if(je(i).test(t))return[...e[i]]}var Ue,Pe,Me=class{name="RegExpRouter";#C;#N;constructor(){this.#C={[me]:Object.create(null)},this.#N={[me]:Object.create(null)}}add(e,t,i){const n=this.#C,s=this.#N;if(!n||!s)throw new Error(ye);n[e]||[n,s].forEach((t=>{t[e]=Object.create(null),Object.keys(t[me]).forEach((i=>{t[e][i]=[...t[me][i]]}))})),"/*"===t&&(t="*");const r=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){const o=je(t);return e===me?Object.keys(n).forEach((e=>{n[e][t]||=Fe(n[e],t)||Fe(n[me],t)||[]})):n[e][t]||=Fe(n[e],t)||Fe(n[me],t)||[],Object.keys(n).forEach((t=>{e!==me&&e!==t||Object.keys(n[t]).forEach((e=>{o.test(e)&&n[t][e].push([i,r])}))})),void Object.keys(s).forEach((t=>{e!==me&&e!==t||Object.keys(s[t]).forEach((e=>o.test(e)&&s[t][e].push([i,r])))}))}const o=K(t)||[t];for(let t=0,a=o.length;t<a;t++){const c=o[t];Object.keys(s).forEach((o=>{e!==me&&e!==o||(s[o][c]||=[...Fe(n[o],c)||Fe(n[me],c)||[]],s[o][c].push([i,r-a+t+1]))}))}}match=Ae;buildAllMatchers(){const e=Object.create(null);return Object.keys(this.#N).concat(Object.keys(this.#C)).forEach((t=>{e[t]||=this.#T(t)})),this.#C=this.#N=void 0,Le=Object.create(null),e}#T(e){const t=[];let i=e===me;return[this.#C,this.#N].forEach((n=>{const s=n[e]?Object.keys(n[e]).map((t=>[t,n[e][t]])):[];0!==s.length?(i||=!0,t.push(...s)):e!==me&&t.push(...Object.keys(n[me]).map((e=>[e,n[me][e]])))})),i?function(e){const t=new Re,i=[];if(0===e.length)return De;const n=e.map((e=>[!/\*|\/:/.test(e[0]),...e])).sort((([e,t],[i,n])=>e?1:i?-1:t.length-n.length)),s=Object.create(null);for(let e=0,r=-1,o=n.length;e<o;e++){const[o,a,c]=n[e];let u;o?s[a]=[c.map((([e])=>[e,Object.create(null)])),Oe]:r++;try{u=t.insert(a,r,o)}catch(e){throw e===Ne?new Ee(a):e}o||(i[r]=c.map((([e,t])=>{const i=Object.create(null);for(t-=1;t>=0;t--){const[e,n]=u[t];i[e]=n}return[e,i]})))}const[r,o,a]=t.buildRegExp();for(let e=0,t=i.length;e<t;e++)for(let t=0,n=i[e].length;t<n;t++){const n=i[e][t]?.[1];if(!n)continue;const s=Object.keys(n);for(let e=0,t=s.length;e<t;e++)n[s[e]]=a[n[s[e]]]}const c=[];for(const e in o)c[e]=i[o[e]];return[r,c,s]}(t):null}},Ze=class{name="SmartRouter";#x=[];#N=[];constructor(e){this.#x=e.routers}add(e,t,i){if(!this.#N)throw new Error(ye);this.#N.push([e,t,i])}match(e,t){if(!this.#N)throw new Error("Fatal error");const i=this.#x,n=this.#N,s=i.length;let r,o=0;for(;o<s;o++){const s=i[o];try{for(let e=0,t=n.length;e<t;e++)s.add(...n[e]);r=s.match(e,t)}catch(e){if(e instanceof Ee)continue;throw e}this.match=s.match.bind(s),this.#x=[s],this.#N=void 0;break}if(o===s)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,r}get activeRouter(){if(this.#N||1!==this.#x.length)throw new Error("No active router has been determined yet.");return this.#x[0]}},$e=Object.create(null),He=class e{#k;#A;#R;#D=0;#L=$e;constructor(e,t,i){if(this.#A=i||Object.create(null),this.#k=[],e&&t){const i=Object.create(null);i[e]={handler:t,possibleKeys:[],score:0},this.#k=[i]}this.#R=[]}insert(t,i,n){this.#D=++this.#D;let s=this;const r=(e=>{const{groups:t,path:i}=(e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,((e,i)=>{const n=`@${i}`;return t.push([n,e]),n})),{groups:t,path:e}})(e);return((e,t)=>{for(let i=t.length-1;i>=0;i--){const[n]=t[i];for(let s=e.length-1;s>=0;s--)if(e[s].includes(n)){e[s]=e[s].replace(n,t[i][1]);break}}return e})($(i),t)})(i),o=[];for(let t=0,i=r.length;t<i;t++){const i=r[t],n=z(i,r[t+1]),a=Array.isArray(n)?n[0]:i;a in s.#A?(s=s.#A[a],n&&o.push(n[1])):(s.#A[a]=new e,n&&(s.#R.push(n),o.push(n[1])),s=s.#A[a])}return s.#k.push({[t]:{handler:n,possibleKeys:o.filter(((e,t,i)=>i.indexOf(e)===t)),score:this.#D}}),s}#j(e,t,i,n){const s=[];for(let r=0,o=e.#k.length;r<o;r++){const o=e.#k[r],a=o[t]||o[me],c={};if(void 0!==a&&(a.params=Object.create(null),s.push(a),i!==$e||n&&n!==$e))for(let e=0,t=a.possibleKeys.length;e<t;e++){const t=a.possibleKeys[e],s=c[a.score];a.params[t]=n?.[t]&&!s?n[t]:i[t]??n?.[t],c[a.score]=!0}}return s}search(e,t){const i=[];this.#L=$e;let n=[this];const s=$(t),r=[];for(let t=0,o=s.length;t<o;t++){const a=s[t],c=t===o-1,u=[];for(let o=0,d=n.length;o<d;o++){const d=n[o],l=d.#A[a];l&&(l.#L=d.#L,c?(l.#A["*"]&&i.push(...this.#j(l.#A["*"],e,d.#L)),i.push(...this.#j(l,e,d.#L))):u.push(l));for(let n=0,o=d.#R.length;n<o;n++){const o=d.#R[n],l=d.#L===$e?{}:{...d.#L};if("*"===o){const t=d.#A["*"];t&&(i.push(...this.#j(t,e,d.#L)),t.#L=l,u.push(t));continue}const[h,_,p]=o;if(!(a||p instanceof RegExp))continue;const f=d.#A[h],m=s.slice(t).join("/");if(p instanceof RegExp){const t=p.exec(m);if(t){if(l[_]=t[0],i.push(...this.#j(f,e,d.#L,l)),Object.keys(f.#A).length){f.#L=l;const e=t[0].match(/\//)?.length??0;(r[e]||=[]).push(f)}continue}}(!0===p||p.test(a))&&(l[_]=a,c?(i.push(...this.#j(f,e,l,d.#L)),f.#A["*"]&&i.push(...this.#j(f.#A["*"],e,l,d.#L))):(f.#L=l,u.push(f)))}}n=u.concat(r.shift()??[])}return i.length>1&&i.sort(((e,t)=>e.score-t.score)),[i.map((({handler:e,params:t})=>[e,t]))]}},ze=class{name="TrieRouter";#F;constructor(){this.#F=new He}add(e,t,i){const n=K(t);if(n)for(let t=0,s=n.length;t<s;t++)this.#F.insert(e,n[t],i);else this.#F.insert(e,t,i)}match(e,t){return this.#F.search(e,t)}},Ge=class extends we{constructor(e={}){super(e),this.router=e.router??new Ze({routers:[new Me,new ze]})}};!function(e){e.assertEqual=()=>{},e.assertIs=function(){},e.assertNever=function(){throw new Error},e.arrayToEnum=e=>{const t={};for(const i of e)t[i]=i;return t},e.getValidEnumValues=t=>{const i=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of i)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t},e.find=(e,t)=>{for(const i of e)if(t(i))return i},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ue||(Ue={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Pe||(Pe={}));const Be=Ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qe=e=>{switch(typeof e){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return Number.isNaN(e)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(e)?Be.array:null===e?Be.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Be.promise:"undefined"!=typeof Map&&e instanceof Map?Be.map:"undefined"!=typeof Set&&e instanceof Set?Be.set:"undefined"!=typeof Date&&e instanceof Date?Be.date:Be.object;default:return Be.unknown}},We=Ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ke extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},i={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)i._errors.push(t(s));else{let e=i,n=0;for(;n<s.path.length;){const i=s.path[n];n===s.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(t(s))):e[i]=e[i]||{_errors:[]},e=e[i],n++}}};return n(this),i}static assert(e){if(!(e instanceof Ke))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},i=[];for(const n of this.issues)if(n.path.length>0){const i=n.path[0];t[i]=t[i]||[],t[i].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}Ke.create=e=>new Ke(e);const Ve=(e,t)=>{let i;switch(e.code){case We.invalid_type:i=e.received===Be.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case We.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,Ue.jsonStringifyReplacer)}`;break;case We.unrecognized_keys:i=`Unrecognized key(s) in object: ${Ue.joinValues(e.keys,", ")}`;break;case We.invalid_union:i="Invalid input";break;case We.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Ue.joinValues(e.options)}`;break;case We.invalid_enum_value:i=`Invalid enum value. Expected ${Ue.joinValues(e.options)}, received '${e.received}'`;break;case We.invalid_arguments:i="Invalid function arguments";break;case We.invalid_return_type:i="Invalid function return type";break;case We.invalid_date:i="Invalid date";break;case We.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:Ue.assertNever(e.validation):i="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case We.too_small:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case We.too_big:i="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case We.custom:i="Invalid input";break;case We.invalid_intersection_types:i="Intersection results could not be merged";break;case We.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case We.not_finite:i="Number must be finite";break;default:i=t.defaultError,Ue.assertNever(e)}return{message:i}};let Xe=Ve;function Ye(){return Xe}const Je=e=>{const{data:t,path:i,errorMaps:n,issueData:s}=e,r=[...i,...s.path||[]],o={...s,path:r};if(void 0!==s.message)return{...s,path:r,message:s.message};let a="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)a=e(o,{data:t,defaultError:a}).message;return{...s,path:r,message:a}};function Qe(e,t){const i=Ye(),n=Je({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Ve?void 0:Ve].filter((e=>!!e))});e.common.issues.push(n)}class et{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if("aborted"===n.status)return tt;"dirty"===n.status&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const e of t){const t=await e.key,n=await e.value;i.push({key:t,value:n})}return et.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return tt;if("aborted"===s.status)return tt;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!n.alwaysSet||(i[t.value]=s.value)}return{status:e.value,value:i}}}const tt=Object.freeze({status:"aborted"}),it=e=>({status:"dirty",value:e}),nt=e=>({status:"valid",value:e}),st=e=>"aborted"===e.status,rt=e=>"dirty"===e.status,ot=e=>"valid"===e.status,at=e=>"undefined"!=typeof Promise&&e instanceof Promise;var ct;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(ct||(ct={}));class ut{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const dt=(e,t)=>{if(ot(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ke(e.common.issues);return this._error=t,this._error}}};function lt(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:n,description:s}=e;if(t&&(i||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??s.defaultError}:void 0===s.data?{message:r??n??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:r??i??s.defaultError}},description:s}}class ht{get description(){return this._def.description}_getType(e){return qe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:qe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new et,ctx:{common:e.parent.common,data:e.data,parsedType:qe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(at(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)},n=this._parseSync({data:e,path:i.path,parent:i});return dt(i,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return ot(i)?{value:i.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>ot(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qe(e)},n=this._parse({data:e,path:i.path,parent:i}),s=await(at(n)?n:Promise.resolve(n));return dt(i,s)}refine(e,t){const i=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const s=e(t),r=()=>n.addIssue({code:We.custom,...i(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(r(),!1))):!!s||(r(),!1)}))}refinement(e,t){return this._refinement(((i,n)=>!!e(i)||(n.addIssue("function"==typeof t?t(i,n):t),!1)))}_refinement(e){return new hi({schema:this,typeName:Si.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return _i.create(this,this._def)}nullable(){return pi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wt.create(this)}promise(){return li.create(this,this._def)}or(e){return Xt.create([this,e],this._def)}and(e){return ei.create(this,e,this._def)}transform(e){return new hi({...lt(this._def),schema:this,typeName:Si.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new fi({...lt(this._def),innerType:this,defaultValue:t,typeName:Si.ZodDefault})}brand(){return new Ei({typeName:Si.ZodBranded,type:this,...lt(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new mi({...lt(this._def),innerType:this,catchValue:t,typeName:Si.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return vi.create(this,e)}readonly(){return bi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _t=/^c[^\s-]{8,}$/i,pt=/^[0-9a-z]+$/,ft=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gt=/^[a-z0-9_-]{21}$/i,yt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Et=/^[-+]?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)?)??$/,vt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let bt;const wt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ot=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,At=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,St=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,It=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Tt=new RegExp(`^${Nt}$`);function xt(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function kt(e){let t=`${Nt}T${xt(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function Rt(e,t){if(!yt.test(e))return!1;try{const[i]=e.split(".");if(!i)return!1;const n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),s=JSON.parse(atob(n));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==s?.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function Dt(e,t){return!("v4"!==t&&t||!Ot.test(e))||!("v6"!==t&&t||!St.test(e))}class Lt extends ht{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Be.string){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.string,received:t.parsedType}),tt}const t=new et;let i;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(i=this._getOrReturnCtx(e,i),n?Qe(i,{code:We.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&Qe(i,{code:We.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)vt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"email",code:We.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)bt||(bt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"emoji",code:We.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)mt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"uuid",code:We.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)gt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"nanoid",code:We.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cuid",code:We.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)pt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cuid2",code:We.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)ft.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"ulid",code:We.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Qe(i,{validation:"url",code:We.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"regex",code:We.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?kt(r).test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?Tt.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?new RegExp(`^${xt(r)}$`).test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?Et.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"duration",code:We.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?(n=e.data,("v4"!==(s=r.version)&&s||!wt.test(n))&&("v6"!==s&&s||!At.test(n))&&(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"ip",code:We.invalid_string,message:r.message}),t.dirty())):"jwt"===r.kind?Rt(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"jwt",code:We.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?Dt(e.data,r.version)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"cidr",code:We.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?It.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"base64",code:We.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?Ct.test(e.data)||(i=this._getOrReturnCtx(e,i),Qe(i,{validation:"base64url",code:We.invalid_string,message:r.message}),t.dirty()):Ue.assertNever(r);var n,s;return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement((t=>e.test(t)),{validation:t,code:We.invalid_string,...ct.errToObj(i)})}_addCheck(e){return new Lt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ct.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ct.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ct.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ct.errToObj(e)})}datetime(e){return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ct.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===e?.precision?null:e?.precision,...ct.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ct.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ct.errToObj(t)})}nonempty(e){return this.min(1,ct.errToObj(e))}trim(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Lt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function jt(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=i>n?i:n;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}Lt.create=e=>new Lt({checks:[],typeName:Si.ZodString,coerce:e?.coerce??!1,...lt(e)});class Ft extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Be.number){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.number,received:t.parsedType}),tt}let t;const i=new et;for(const n of this._def.checks)"int"===n.kind?Ue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):"multipleOf"===n.kind?0!==jt(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.not_finite,message:n.message}),i.dirty()):Ue.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ct.toString(t))}setLimit(e,t,i,n){return new Ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:ct.toString(n)}]})}_addCheck(e){return new Ft({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Ue.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===t||i.value>t)&&(t=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Ft.create=e=>new Ft({checks:[],typeName:Si.ZodNumber,coerce:e?.coerce||!1,...lt(e)});class Ut extends ht{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Be.bigint)return this._getInvalidInput(e);let t;const i=new et;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Qe(t,{code:We.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):Ue.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.bigint,received:t.parsedType}),tt}gte(e,t){return this.setLimit("min",e,!0,ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ct.toString(t))}setLimit(e,t,i,n){return new Ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:ct.toString(n)}]})}_addCheck(e){return new Ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ut.create=e=>new Ut({checks:[],typeName:Si.ZodBigInt,coerce:e?.coerce??!1,...lt(e)});class Pt extends ht{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Be.boolean){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.boolean,received:t.parsedType}),tt}return nt(e.data)}}Pt.create=e=>new Pt({typeName:Si.ZodBoolean,coerce:e?.coerce||!1,...lt(e)});class Mt extends ht{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Be.date){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.date,received:t.parsedType}),tt}if(Number.isNaN(e.data.getTime()))return Qe(this._getOrReturnCtx(e),{code:We.invalid_date}),tt;const t=new et;let i;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),Qe(i,{code:We.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Ue.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Mt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Mt.create=e=>new Mt({checks:[],coerce:e?.coerce||!1,typeName:Si.ZodDate,...lt(e)});class Zt extends ht{_parse(e){if(this._getType(e)!==Be.symbol){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.symbol,received:t.parsedType}),tt}return nt(e.data)}}Zt.create=e=>new Zt({typeName:Si.ZodSymbol,...lt(e)});class $t extends ht{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.undefined,received:t.parsedType}),tt}return nt(e.data)}}$t.create=e=>new $t({typeName:Si.ZodUndefined,...lt(e)});class Ht extends ht{_parse(e){if(this._getType(e)!==Be.null){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.null,received:t.parsedType}),tt}return nt(e.data)}}Ht.create=e=>new Ht({typeName:Si.ZodNull,...lt(e)});class zt extends ht{constructor(){super(...arguments),this._any=!0}_parse(e){return nt(e.data)}}zt.create=e=>new zt({typeName:Si.ZodAny,...lt(e)});class Gt extends ht{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nt(e.data)}}Gt.create=e=>new Gt({typeName:Si.ZodUnknown,...lt(e)});class Bt extends ht{_parse(e){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.never,received:t.parsedType}),tt}}Bt.create=e=>new Bt({typeName:Si.ZodNever,...lt(e)});class qt extends ht{_parse(e){if(this._getType(e)!==Be.undefined){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.void,received:t.parsedType}),tt}return nt(e.data)}}qt.create=e=>new qt({typeName:Si.ZodVoid,...lt(e)});class Wt extends ht{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==Be.array)return Qe(t,{code:We.invalid_type,expected:Be.array,received:t.parsedType}),tt;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(Qe(t,{code:e?We.too_big:We.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Qe(t,{code:We.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Qe(t,{code:We.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map(((e,i)=>n.type._parseAsync(new ut(t,e,t.path,i))))).then((e=>et.mergeArray(i,e)));const s=[...t.data].map(((e,i)=>n.type._parseSync(new ut(t,e,t.path,i))));return et.mergeArray(i,s)}get element(){return this._def.type}min(e,t){return new Wt({...this._def,minLength:{value:e,message:ct.toString(t)}})}max(e,t){return new Wt({...this._def,maxLength:{value:e,message:ct.toString(t)}})}length(e,t){return new Wt({...this._def,exactLength:{value:e,message:ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function Kt(e){if(e instanceof Vt){const t={};for(const i in e.shape)t[i]=_i.create(Kt(e.shape[i]));return new Vt({...e._def,shape:()=>t})}return e instanceof Wt?new Wt({...e._def,type:Kt(e.element)}):e instanceof _i?_i.create(Kt(e.unwrap())):e instanceof pi?pi.create(Kt(e.unwrap())):e instanceof ti?ti.create(e.items.map((e=>Kt(e)))):e}Wt.create=(e,t)=>new Wt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Si.ZodArray,...lt(t)});class Vt extends ht{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ue.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Be.object){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.object,received:t.parsedType}),tt}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),r=[];if(!(this._def.catchall instanceof Bt&&"strip"===this._def.unknownKeys))for(const e in i.data)s.includes(e)||r.push(e);const o=[];for(const e of s)o.push({key:{status:"valid",value:e},value:n[e]._parse(new ut(i,i.data[e],i.path,e)),alwaysSet:e in i.data});if(this._def.catchall instanceof Bt){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:i.data[e]}});else if("strict"===e)r.length>0&&(Qe(i,{code:We.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r)o.push({key:{status:"valid",value:t},value:e._parse(new ut(i,i.data[t],i.path,t)),alwaysSet:t in i.data})}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const i=await t.key,n=await t.value;e.push({key:i,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>et.mergeObjectSync(t,e))):et.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return new Vt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,i)=>{const n=this._def.errorMap?.(t,i).message??i.defaultError;return"unrecognized_keys"===t.code?{message:ct.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Si.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Vt({...this._def,catchall:e})}pick(e){const t={};for(const i of Ue.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new Vt({...this._def,shape:()=>t})}omit(e){const t={};for(const i of Ue.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new Vt({...this._def,shape:()=>t})}deepPartial(){return Kt(this)}partial(e){const t={};for(const i of Ue.objectKeys(this.shape)){const n=this.shape[i];t[i]=e&&!e[i]?n:n.optional()}return new Vt({...this._def,shape:()=>t})}required(e){const t={};for(const i of Ue.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let e=this.shape[i];for(;e instanceof _i;)e=e._def.innerType;t[i]=e}return new Vt({...this._def,shape:()=>t})}keyof(){return ci(Ue.objectKeys(this.shape))}}Vt.create=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strip",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)}),Vt.strictCreate=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strict",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)}),Vt.lazycreate=(e,t)=>new Vt({shape:e,unknownKeys:"strip",catchall:Bt.create(),typeName:Si.ZodObject,...lt(t)});class Xt extends ht{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;if(t.common.async)return Promise.all(i.map((async e=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const i=e.map((e=>new Ke(e.ctx.common.issues)));return Qe(t,{code:We.invalid_union,unionErrors:i}),tt}));{let e;const n=[];for(const s of i){const i={...t,common:{...t.common,issues:[]},parent:null},r=s._parseSync({data:t.data,path:t.path,parent:i});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:i}),i.common.issues.length&&n.push(i.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map((e=>new Ke(e)));return Qe(t,{code:We.invalid_union,unionErrors:s}),tt}}get options(){return this._def.options}}Xt.create=(e,t)=>new Xt({options:e,typeName:Si.ZodUnion,...lt(t)});const Yt=e=>e instanceof oi?Yt(e.schema):e instanceof hi?Yt(e.innerType()):e instanceof ai?[e.value]:e instanceof ui?e.options:e instanceof di?Ue.objectValues(e.enum):e instanceof fi?Yt(e._def.innerType):e instanceof $t?[void 0]:e instanceof Ht?[null]:e instanceof _i?[void 0,...Yt(e.unwrap())]:e instanceof pi?[null,...Yt(e.unwrap())]:e instanceof Ei||e instanceof bi?Yt(e.unwrap()):e instanceof mi?Yt(e._def.innerType):[];class Jt extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.object)return Qe(t,{code:We.invalid_type,expected:Be.object,received:t.parsedType}),tt;const i=this.discriminator,n=this.optionsMap.get(t.data[i]);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(Qe(t,{code:We.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const n=new Map;for(const i of t){const t=Yt(i.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new Jt({typeName:Si.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...lt(i)})}}function Qt(e,t){const i=qe(e),n=qe(t);if(e===t)return{valid:!0,data:e};if(i===Be.object&&n===Be.object){const i=Ue.objectKeys(t),n=Ue.objectKeys(e).filter((e=>-1!==i.indexOf(e))),s={...e,...t};for(const i of n){const n=Qt(e[i],t[i]);if(!n.valid)return{valid:!1};s[i]=n.data}return{valid:!0,data:s}}if(i===Be.array&&n===Be.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let n=0;n<e.length;n++){const s=Qt(e[n],t[n]);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}return i===Be.date&&n===Be.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ei extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(e,n)=>{if(st(e)||st(n))return tt;const s=Qt(e.value,n.value);return s.valid?((rt(e)||rt(n))&&t.dirty(),{status:t.value,value:s.data}):(Qe(i,{code:We.invalid_intersection_types}),tt)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}ei.create=(e,t,i)=>new ei({left:e,right:t,typeName:Si.ZodIntersection,...lt(i)});class ti extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.array)return Qe(i,{code:We.invalid_type,expected:Be.array,received:i.parsedType}),tt;if(i.data.length<this._def.items.length)return Qe(i,{code:We.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tt;!this._def.rest&&i.data.length>this._def.items.length&&(Qe(i,{code:We.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ut(i,e,i.path,t)):null})).filter((e=>!!e));return i.common.async?Promise.all(n).then((e=>et.mergeArray(t,e))):et.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ti({...this._def,rest:e})}}ti.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ti({items:e,typeName:Si.ZodTuple,rest:null,...lt(t)})};class ii extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.object)return Qe(i,{code:We.invalid_type,expected:Be.object,received:i.parsedType}),tt;const n=[],s=this._def.keyType,r=this._def.valueType;for(const e in i.data)n.push({key:s._parse(new ut(i,e,i.path,e)),value:r._parse(new ut(i,i.data[e],i.path,e)),alwaysSet:e in i.data});return i.common.async?et.mergeObjectAsync(t,n):et.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return new ii(t instanceof ht?{keyType:e,valueType:t,typeName:Si.ZodRecord,...lt(i)}:{keyType:Lt.create(),valueType:e,typeName:Si.ZodRecord,...lt(t)})}}class ni extends ht{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.map)return Qe(i,{code:We.invalid_type,expected:Be.map,received:i.parsedType}),tt;const n=this._def.keyType,s=this._def.valueType,r=[...i.data.entries()].map((([e,t],r)=>({key:n._parse(new ut(i,e,i.path,[r,"key"])),value:s._parse(new ut(i,t,i.path,[r,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of r){const n=await i.key,s=await i.value;if("aborted"===n.status||"aborted"===s.status)return tt;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const i of r){const n=i.key,s=i.value;if("aborted"===n.status||"aborted"===s.status)return tt;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}ni.create=(e,t,i)=>new ni({valueType:t,keyType:e,typeName:Si.ZodMap,...lt(i)});class si extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==Be.set)return Qe(i,{code:We.invalid_type,expected:Be.set,received:i.parsedType}),tt;const n=this._def;null!==n.minSize&&i.data.size<n.minSize.value&&(Qe(i,{code:We.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&i.data.size>n.maxSize.value&&(Qe(i,{code:We.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function r(e){const i=new Set;for(const n of e){if("aborted"===n.status)return tt;"dirty"===n.status&&t.dirty(),i.add(n.value)}return{status:t.value,value:i}}const o=[...i.data.values()].map(((e,t)=>s._parse(new ut(i,e,i.path,t))));return i.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new si({...this._def,minSize:{value:e,message:ct.toString(t)}})}max(e,t){return new si({...this._def,maxSize:{value:e,message:ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}si.create=(e,t)=>new si({valueType:e,minSize:null,maxSize:null,typeName:Si.ZodSet,...lt(t)});class ri extends ht{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.function)return Qe(t,{code:We.invalid_type,expected:Be.function,received:t.parsedType}),tt;function i(e,i){return Je({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ve].filter((e=>!!e)),issueData:{code:We.invalid_arguments,argumentsError:i}})}function n(e,i){return Je({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Ve].filter((e=>!!e)),issueData:{code:We.invalid_return_type,returnTypeError:i}})}const s={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof li){const e=this;return nt((async function(...t){const o=new Ke([]),a=await e._def.args.parseAsync(t,s).catch((e=>{throw o.addIssue(i(t,e)),o})),c=await Reflect.apply(r,this,a);return await e._def.returns._def.type.parseAsync(c,s).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return nt((function(...t){const o=e._def.args.safeParse(t,s);if(!o.success)throw new Ke([i(t,o.error)]);const a=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(a,s);if(!c.success)throw new Ke([n(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ri({...this._def,args:ti.create(e).rest(Gt.create())})}returns(e){return new ri({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ri({args:e||ti.create([]).rest(Gt.create()),returns:t||Gt.create(),typeName:Si.ZodFunction,...lt(i)})}}class oi extends ht{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oi.create=(e,t)=>new oi({getter:e,typeName:Si.ZodLazy,...lt(t)});class ai extends ht{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:We.invalid_literal,expected:this._def.value}),tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ci(e,t){return new ui({values:e,typeName:Si.ZodEnum,...lt(t)})}ai.create=(e,t)=>new ai({value:e,typeName:Si.ZodLiteral,...lt(t)});class ui extends ht{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Qe(t,{expected:Ue.joinValues(this._def.values),received:t.parsedType,code:We.invalid_type}),tt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:We.invalid_enum_value,options:this._def.values}),tt}return nt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ui.create(e,{...this._def,...t})}exclude(e,t=this._def){return ui.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ui.create=ci;class di extends ht{_parse(e){const t=Ue.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Be.string&&i.parsedType!==Be.number){const e=Ue.objectValues(t);return Qe(i,{expected:Ue.joinValues(e),received:i.parsedType,code:We.invalid_type}),tt}if(this._cache||(this._cache=new Set(Ue.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Ue.objectValues(t);return Qe(i,{received:i.data,code:We.invalid_enum_value,options:e}),tt}return nt(e.data)}get enum(){return this._def.values}}di.create=(e,t)=>new di({values:e,typeName:Si.ZodNativeEnum,...lt(t)});class li extends ht{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Be.promise&&!1===t.common.async)return Qe(t,{code:We.invalid_type,expected:Be.promise,received:t.parsedType}),tt;const i=t.parsedType===Be.promise?t.data:Promise.resolve(t.data);return nt(i.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}li.create=(e,t)=>new li({type:e,typeName:Si.ZodPromise,...lt(t)});class hi extends ht{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Si.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:e=>{Qe(i,e),e.fatal?t.abort():t.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===n.type){const e=n.transform(i.data,s);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return tt;const n=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===n.status?tt:"dirty"===n.status||"dirty"===t.value?it(n.value):n}));{if("aborted"===t.value)return tt;const n=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===n.status?tt:"dirty"===n.status||"dirty"===t.value?it(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,s);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===n.status?tt:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((i=>"aborted"===i.status?tt:("dirty"===i.status&&t.dirty(),e(i.value).then((()=>({status:t.value,value:i.value}))))))}if("transform"===n.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ot(e))return tt;const r=n.transform(e.value,s);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>ot(e)?Promise.resolve(n.transform(e.value,s)).then((e=>({status:t.value,value:e}))):tt))}Ue.assertNever(n)}}hi.create=(e,t,i)=>new hi({schema:e,typeName:Si.ZodEffects,effect:t,...lt(i)}),hi.createWithPreprocess=(e,t,i)=>new hi({schema:t,effect:{type:"preprocess",transform:e},typeName:Si.ZodEffects,...lt(i)});class _i extends ht{_parse(e){return this._getType(e)===Be.undefined?nt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_i.create=(e,t)=>new _i({innerType:e,typeName:Si.ZodOptional,...lt(t)});class pi extends ht{_parse(e){return this._getType(e)===Be.null?nt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pi.create=(e,t)=>new pi({innerType:e,typeName:Si.ZodNullable,...lt(t)});class fi extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===Be.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fi.create=(e,t)=>new fi({innerType:e,typeName:Si.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...lt(t)});class mi extends ht{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return at(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Ke(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new Ke(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}mi.create=(e,t)=>new mi({innerType:e,typeName:Si.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...lt(t)});class gi extends ht{_parse(e){if(this._getType(e)!==Be.nan){const t=this._getOrReturnCtx(e);return Qe(t,{code:We.invalid_type,expected:Be.nan,received:t.parsedType}),tt}return{status:"valid",value:e.data}}}gi.create=e=>new gi({typeName:Si.ZodNaN,...lt(e)});const yi=Symbol("zod_brand");class Ei extends ht{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class vi extends ht{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?tt:"dirty"===e.status?(t.dirty(),it(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})();{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?tt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(e,t){return new vi({in:e,out:t,typeName:Si.ZodPipeline})}}class bi extends ht{_parse(e){const t=this._def.innerType._parse(e),i=e=>(ot(e)&&(e.value=Object.freeze(e.value)),e);return at(t)?t.then((e=>i(e))):i(t)}unwrap(){return this._def.innerType}}function wi(e,t){const i="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof i?{message:i}:i}function Oi(e,t={},i){return e?zt.create().superRefine(((n,s)=>{const r=e(n);if(r instanceof Promise)return r.then((e=>{if(!e){const e=wi(t,n),r=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:r})}}));if(!r){const e=wi(t,n),r=e.fatal??i??!0;s.addIssue({code:"custom",...e,fatal:r})}})):zt.create()}bi.create=(e,t)=>new bi({innerType:e,typeName:Si.ZodReadonly,...lt(t)});const Ai={object:Vt.lazycreate};var Si;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Si||(Si={}));const Ii=Lt.create,Ci=Ft.create,Ni=gi.create,Ti=Ut.create,xi=Pt.create,ki=Mt.create,Ri=Zt.create,Di=$t.create,Li=Ht.create,ji=zt.create,Fi=Gt.create,Ui=Bt.create,Pi=qt.create,Mi=Wt.create,Zi=Vt.create,$i=Vt.strictCreate,Hi=Xt.create,zi=Jt.create,Gi=ei.create,Bi=ti.create,qi=ii.create,Wi=ni.create,Ki=si.create,Vi=ri.create,Xi=oi.create,Yi=ai.create,Ji=ui.create,Qi=di.create,en=li.create,tn=hi.create,nn=_i.create,sn=pi.create,rn=hi.createWithPreprocess,on=vi.create,an={string:e=>Lt.create({...e,coerce:!0}),number:e=>Ft.create({...e,coerce:!0}),boolean:e=>Pt.create({...e,coerce:!0}),bigint:e=>Ut.create({...e,coerce:!0}),date:e=>Mt.create({...e,coerce:!0})};var cn=Object.freeze({__proto__:null,BRAND:yi,DIRTY:it,EMPTY_PATH:[],INVALID:tt,NEVER:tt,OK:nt,ParseStatus:et,Schema:ht,ZodAny:zt,ZodArray:Wt,ZodBigInt:Ut,ZodBoolean:Pt,ZodBranded:Ei,ZodCatch:mi,ZodDate:Mt,ZodDefault:fi,ZodDiscriminatedUnion:Jt,ZodEffects:hi,ZodEnum:ui,ZodError:Ke,get ZodFirstPartyTypeKind(){return Si},ZodFunction:ri,ZodIntersection:ei,ZodIssueCode:We,ZodLazy:oi,ZodLiteral:ai,ZodMap:ni,ZodNaN:gi,ZodNativeEnum:di,ZodNever:Bt,ZodNull:Ht,ZodNullable:pi,ZodNumber:Ft,ZodObject:Vt,ZodOptional:_i,ZodParsedType:Be,ZodPipeline:vi,ZodPromise:li,ZodReadonly:bi,ZodRecord:ii,ZodSchema:ht,ZodSet:si,ZodString:Lt,ZodSymbol:Zt,ZodTransformer:hi,ZodTuple:ti,ZodType:ht,ZodUndefined:$t,ZodUnion:Xt,ZodUnknown:Gt,ZodVoid:qt,addIssueToContext:Qe,any:ji,array:Mi,bigint:Ti,boolean:xi,coerce:an,custom:Oi,date:ki,datetimeRegex:kt,defaultErrorMap:Ve,discriminatedUnion:zi,effect:tn,enum:Ji,function:Vi,getErrorMap:Ye,getParsedType:qe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Oi((t=>t instanceof e),t),intersection:Gi,isAborted:st,isAsync:at,isDirty:rt,isValid:ot,late:Ai,lazy:Xi,literal:Yi,makeIssue:Je,map:Wi,nan:Ni,nativeEnum:Qi,never:Ui,null:Li,nullable:sn,number:Ci,object:Zi,get objectUtil(){return Pe},oboolean:()=>xi().optional(),onumber:()=>Ci().optional(),optional:nn,ostring:()=>Ii().optional(),pipeline:on,preprocess:rn,promise:en,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),record:qi,set:Ki,setErrorMap:function(e){Xe=e},strictObject:$i,string:Ii,symbol:Ri,transformer:tn,tuple:Bi,undefined:Di,union:Hi,unknown:Fi,get util(){return Ue},void:Pi});function un(e,t){const i={};return Object.keys(e.paths).forEach((n=>{i[W(t.replaceAll(/:([^\/]+)/g,"{$1}"),n)]=e.paths[n]})),{...e,paths:i}}function dn(e){return/^application\/([a-z-\.]+\+)?json/.test(e)}function ln(e){return e.startsWith("multipart/form-data")||e.startsWith("application/x-www-form-urlencoded")}r(cn);var hn,_n=Object.freeze({__proto__:null,OpenAPIHono:class e extends Ge{openAPIRegistry;defaultHook;constructor(e){super(e),this.openAPIRegistry=new p,this.defaultHook=e?.defaultHook}openapi=({middleware:e,hide:t,...i},n,s=this.defaultHook)=>{t||this.openAPIRegistry.registerPath(i);const r=[];if(i.request?.query){const e=oe("query",i.request.query,s);r.push(e)}if(i.request?.params){const e=oe("param",i.request.params,s);r.push(e)}if(i.request?.headers){const e=oe("header",i.request.headers,s);r.push(e)}if(i.request?.cookies){const e=oe("cookie",i.request.cookies,s);r.push(e)}const o=i.request?.body?.content;if(o)for(const e of Object.keys(o)){if(!o[e])continue;const t=o[e].schema;if(t instanceof ht){if(dn(e)){const e=oe("json",t,s);r.push(i.request?.body?.required?e:async(t,i)=>{if(t.req.header("content-type")&&dn(t.req.header("content-type")))return await e(t,i);t.req.addValidatedData("json",{}),await i()})}if(ln(e)){const e=oe("form",t,s);r.push(i.request?.body?.required?e:async(t,i)=>{if(t.req.header("content-type")&&ln(t.req.header("content-type")))return await e(t,i);t.req.addValidatedData("form",{}),await i()})}}}const a=e?Array.isArray(e)?e:[e]:[];return this.on([i.method],i.path.replaceAll(/\/{(.+?)}/g,"/:$1"),...a,...r,n),this};getOpenAPIDocument=e=>{const t=new U(this.openAPIRegistry.definitions).generateDocument(e);return this._basePath?un(t,this._basePath):t};getOpenAPI31Document=e=>{const t=new Z(this.openAPIRegistry.definitions).generateDocument(e);return this._basePath?un(t,this._basePath):t};doc=(e,t)=>this.get(e,(e=>{const i="function"==typeof t?t(e):t;try{const t=this.getOpenAPIDocument(i);return e.json(t)}catch(t){return e.json(t,500)}}));doc31=(e,t)=>this.get(e,(e=>{const i="function"==typeof t?t(e):t;try{const t=this.getOpenAPI31Document(i);return e.json(t)}catch(t){return e.json(t,500)}}));route(t,i){const n=t.replaceAll(/:([^\/]+)/g,"{$1}");return super.route(t,i),i instanceof e?(i.openAPIRegistry.definitions.forEach((e=>{switch(e.type){case"component":return this.openAPIRegistry.registerComponent(e.componentType,e.name,e.component);case"route":return void this.openAPIRegistry.registerPath({...e.route,path:W(n,i._basePath.replaceAll(/:([^\/]+)/g,"{$1}"),e.route.path)});case"webhook":return void this.openAPIRegistry.registerWebhook({...e.webhook,path:W(n,i._basePath.replaceAll(/:([^\/]+)/g,"{$1}"),e.webhook.path)});case"schema":return this.openAPIRegistry.register(e.schema._def.openapi._internal.refId,e.schema);case"parameter":return this.openAPIRegistry.registerParameter(e.schema._def.openapi._internal.refId,e.schema);default:throw new Error(`Unknown registry type: ${e}`)}})),this):this}basePath(t){return new e({...super.basePath(t),defaultHook:this.defaultHook})}},createRoute:e=>{const t={...e,getRoutingPath:()=>e.path.replaceAll(/\/{(.+?)}/g,"/:$1")};return Object.defineProperty(t,"getRoutingPath",{enumerable:!1})},extendZodWithOpenApi:r,z:cn}),pn=e(_n),fn=(hn||(hn=1,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=pn,i=t.z.object({created_at:t.z.string(),updated_at:t.z.string()}),n=t.z.enum(["AUTH0","EMAIL","REDIRECT"]),s=t.z.enum(["CREATE_USER","GET_USER","UPDATE_USER","SEND_REQUEST","SEND_EMAIL"]),r=t.z.enum(["VERIFY_EMAIL"]),o=t.z.object({require_mx_record:t.z.boolean().optional(),block_aliases:t.z.boolean().optional(),block_free_emails:t.z.boolean().optional(),block_disposable_emails:t.z.boolean().optional(),blocklist:t.z.array(t.z.string()).optional(),allowlist:t.z.array(t.z.string()).optional()}),a=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("AUTH0"),action:t.z.literal("UPDATE_USER"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({connection_id:t.z.string().optional(),user_id:t.z.string(),changes:t.z.record(t.z.string(),t.z.any())})}),c=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("EMAIL"),action:t.z.literal("VERIFY_EMAIL"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({email:t.z.string(),rules:o.optional()})}),u=t.z.enum(["change-email","account","custom"]),d=t.z.object({id:t.z.string(),alias:t.z.string().max(100).optional(),type:t.z.literal("REDIRECT"),action:t.z.literal("REDIRECT_USER"),allow_failure:t.z.boolean().optional(),mask_output:t.z.boolean().optional(),params:t.z.object({target:u.openapi({description:"The predefined target to redirect to, or 'custom' for a custom URL"}),custom_url:t.z.string().optional().openapi({description:"Custom URL to redirect to when target is 'custom'"})})}),l=t.z.union([a,c,d]),h=t.z.object({name:t.z.string().min(1).max(150).openapi({description:"The name of the flow"}),actions:t.z.array(l).optional().default([]).openapi({description:"The list of actions to execute in sequence"})}),_=h.extend({...i.shape,id:t.z.string().openapi({description:"Unique identifier for the flow",example:"af_12tMpdJ3iek7svMyZkSh5M"})}),p=t.z.object({page:t.z.string().min(0).optional().default("0").transform((e=>parseInt(e,10))).openapi({description:"The page number where 0 is the first page"}),per_page:t.z.string().min(1).optional().default("10").transform((e=>parseInt(e,10))).openapi({description:"The number of items per page"}),include_totals:t.z.string().optional().default("false").transform((e=>"true"===e)).openapi({description:"If the total number of items should be included in the response"}),sort:t.z.string().regex(/^.+:(-1|1)$/).optional().openapi({description:"A property that should have the format 'string:-1' or 'string:1'"}),q:t.z.string().optional().openapi({description:"A lucene query string used to filter the results"})}),f=t.z.object({start:t.z.number(),limit:t.z.number(),length:t.z.number(),total:t.z.number().optional()}),m=t.z.object({email:t.z.string().optional(),email_verified:t.z.boolean().optional(),name:t.z.string().optional(),username:t.z.string().optional(),given_name:t.z.string().optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),family_name:t.z.string().optional()}).catchall(t.z.any()),g=t.z.object({connection:t.z.string(),user_id:t.z.string(),provider:t.z.string(),isSocial:t.z.boolean(),access_token:t.z.string().optional(),access_token_secret:t.z.string().optional(),refresh_token:t.z.string().optional(),profileData:m.optional()}),y=t.z.object({formatted:t.z.string().optional(),street_address:t.z.string().optional(),locality:t.z.string().optional(),region:t.z.string().optional(),postal_code:t.z.string().optional(),country:t.z.string().optional()}).optional(),E=t.z.object({email:t.z.string().optional().transform((e=>e&&e.toLowerCase())),username:t.z.string().optional(),phone_number:t.z.string().optional(),phone_verified:t.z.boolean().optional(),given_name:t.z.string().optional(),family_name:t.z.string().optional(),nickname:t.z.string().optional(),name:t.z.string().optional(),picture:t.z.string().optional(),locale:t.z.string().optional(),linked_to:t.z.string().optional(),profileData:t.z.string().optional(),user_id:t.z.string().optional(),app_metadata:t.z.any().default({}).optional(),user_metadata:t.z.any().default({}).optional(),middle_name:t.z.string().optional(),preferred_username:t.z.string().optional(),profile:t.z.string().optional(),website:t.z.string().optional(),gender:t.z.string().optional(),birthdate:t.z.string().optional(),zoneinfo:t.z.string().optional(),address:y}),v=E.extend({email_verified:t.z.boolean().default(!1),verify_email:t.z.boolean().optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string().optional(),provider:t.z.string().optional(),connection:t.z.string(),is_social:t.z.boolean().optional()}),b=t.z.object({...v.shape,...i.shape,user_id:t.z.string(),provider:t.z.string(),is_social:t.z.boolean(),email:t.z.string().optional(),login_count:t.z.number().default(0),identities:t.z.array(g).optional()}),w=b,O=E.extend({login_count:t.z.number(),multifactor:t.z.array(t.z.string()).optional(),last_ip:t.z.string().optional(),last_login:t.z.string().optional(),user_id:t.z.string()}).catchall(t.z.any()),A=t.z.object({client_id:t.z.string().openapi({description:"ID of this client."}),name:t.z.string().min(1).openapi({description:"Name of this client (min length: 1 character, does not allow < or >)."}),description:t.z.string().max(140).optional().openapi({description:"Free text description of this client (max length: 140 characters)."}),global:t.z.boolean().default(!1).openapi({description:"Whether this is your global 'All Applications' client representing legacy tenant settings (true) or a regular client (false)."}),client_secret:t.z.string().default((()=>((e=21)=>{let t="",i=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&i[e]];return t})())).optional().openapi({description:"Client secret (which you must not make public)."}),app_type:t.z.enum(["native","spa","regular_web","non_interactive","resource_server","express_configuration","rms","box","cloudbees","concur","dropbox","mscrm","echosign","egnyte","newrelic","office365","salesforce","sentry","sharepoint","slack","springcm","zendesk","zoom","sso_integration","oag"]).default("regular_web").optional().openapi({description:"The type of application this client represents"}),logo_uri:t.z.string().url().optional().openapi({description:"URL of the logo to display for this client. Recommended size is 150x150 pixels."}),is_first_party:t.z.boolean().default(!1).openapi({description:"Whether this client a first party client (true) or not (false)."}),oidc_conformant:t.z.boolean().default(!0).openapi({description:"Whether this client conforms to strict OIDC specifications (true) or uses legacy features (false)."}),auth0_conformant:t.z.boolean().default(!0).openapi({description:"Whether this client follows Auth0-compatible behavior (true) or strict OIDC behavior (false). When true, profile/email claims are included in the ID token when scopes are requested. When false, these claims are only available from the userinfo endpoint (strict OIDC 5.4 compliance)."}),callbacks:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs whitelisted for Auth0 to use as a callback to the client after authentication."}),allowed_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs."}),web_origins:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."}),client_aliases:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of audiences/realms for SAML protocol. Used by the wsfed addon."}),allowed_clients:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of allow clients and API ids that are allowed to make delegation requests. Empty means all all your clients are allowed."}),connections:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of connection IDs enabled for this client. The order determines the display order on the login page."}),allowed_logout_urls:t.z.array(t.z.string()).default([]).optional().openapi({description:"Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."}),session_transfer:t.z.record(t.z.any()).default({}).optional().openapi({description:"Native to Web SSO Configuration"}),oidc_logout:t.z.record(t.z.any()).default({}).optional().openapi({description:"Configuration for OIDC backchannel logout"}),grant_types:t.z.array(t.z.string()).default([]).optional().openapi({description:"List of grant types supported for this application. Can include authorization_code, implicit, refresh_token, client_credentials, password, http://auth0.com/oauth/grant-type/password-realm, http://auth0.com/oauth/grant-type/mfa-oob, http://auth0.com/oauth/grant-type/mfa-otp, http://auth0.com/oauth/grant-type/mfa-recovery-code, urn:openid:params:grant-type:ciba, and urn:ietf:params:oauth:grant-type:device_code."}),jwt_configuration:t.z.record(t.z.any()).default({}).optional().openapi({description:"Configuration related to JWTs for the client."}),signing_keys:t.z.array(t.z.record(t.z.any())).default([]).optional().openapi({description:"Signing certificates associated with this client."}),encryption_key:t.z.record(t.z.any()).default({}).optional().openapi({description:"Encryption used for WsFed responses with this client."}),sso:t.z.boolean().default(!1).openapi({description:"Applies only to SSO clients and determines whether Auth0 will handle Single Sign On (true) or whether the Identity Provider will (false)."}),sso_disabled:t.z.boolean().default(!0).openapi({description:"Whether Single Sign On is disabled (true) or enabled (true). Defaults to true."}),cross_origin_authentication:t.z.boolean().default(!1).openapi({description:"Whether this client can be used to make cross-origin authentication requests (true) or it is not allowed to make such requests (false)."}),cross_origin_loc:t.z.string().url().optional().openapi({description:"URL of the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page."}),custom_login_page_on:t.z.boolean().default(!1).openapi({description:"Whether a custom login page is to be used (true) or the default provided login page (false)."}),custom_login_page:t.z.string().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page."}),custom_login_page_preview:t.z.string().optional().openapi({description:"The content (HTML, CSS, JS) of the custom login page. (Used on Previews)"}),form_template:t.z.string().optional().openapi({description:"HTML form template to be used for WS-Federation."}),addons:t.z.record(t.z.any()).default({}).optional().openapi({description:"Addons enabled for this client and their associated configurations."}),token_endpoint_auth_method:t.z.enum(["none","client_secret_post","client_secret_basic"]).default("client_secret_basic").optional().openapi({description:"Defines the requested authentication method for the token endpoint. Can be none (public client without a client secret), client_secret_post (client uses HTTP POST parameters), or client_secret_basic (client uses HTTP Basic)."}),client_metadata:t.z.record(t.z.string().max(255)).default({}).optional().openapi({description:'Metadata associated with the client, in the form of an object with string values (max 255 chars). Maximum of 10 metadata properties allowed. Field names (max 255 chars) are alphanumeric and may only include the following special characters: :,-+=_*?"/()<>@ [Tab][Space]'}),mobile:t.z.record(t.z.any()).default({}).optional().openapi({description:"Additional configuration for native mobile apps."}),initiate_login_uri:t.z.string().url().optional().openapi({description:"Initiate login uri, must be https"}),native_social_login:t.z.record(t.z.any()).default({}).optional(),refresh_token:t.z.record(t.z.any()).default({}).optional().openapi({description:"Refresh token configuration"}),default_organization:t.z.record(t.z.any()).default({}).optional().openapi({description:"Defines the default Organization ID and flows"}),organization_usage:t.z.enum(["deny","allow","require"]).default("deny").optional().openapi({description:"Defines how to proceed during an authentication transaction with regards an organization. Can be deny (default), allow or require."}),organization_require_behavior:t.z.enum(["no_prompt","pre_login_prompt","post_login_prompt"]).default("no_prompt").optional().openapi({description:"Defines how to proceed during an authentication transaction when client.organization_usage: 'require'. Can be no_prompt (default), pre_login_prompt or post_login_prompt. post_login_prompt requires oidc_conformant: true."}),client_authentication_methods:t.z.record(t.z.any()).default({}).optional().openapi({description:"Defines client authentication methods."}),require_pushed_authorization_requests:t.z.boolean().default(!1).openapi({description:"Makes the use of Pushed Authorization Requests mandatory for this client"}),require_proof_of_possession:t.z.boolean().default(!1).openapi({description:"Makes the use of Proof-of-Possession mandatory for this client"}),signed_request_object:t.z.record(t.z.any()).default({}).optional().openapi({description:"JWT-secured Authorization Requests (JAR) settings."}),compliance_level:t.z.enum(["none","fapi1_adv_pkj_par","fapi1_adv_mtls_par","fapi2_sp_pkj_mtls","fapi2_sp_mtls_mtls"]).optional().openapi({description:"Defines the compliance level for this client, which may restrict it's capabilities"}),par_request_expiry:t.z.number().optional().openapi({description:"Specifies how long, in seconds, a Pushed Authorization Request URI remains valid"}),token_quota:t.z.record(t.z.any()).default({}).optional()}),S=t.z.object({created_at:t.z.string(),updated_at:t.z.string(),...A.shape}),I=t.z.object({client_id:t.z.string().min(1).openapi({description:"ID of the client."}),audience:t.z.string().min(1).openapi({description:"The audience (API identifier) of this client grant."}),scope:t.z.array(t.z.string()).optional().openapi({description:"Scopes allowed for this client grant."}),organization_usage:t.z.enum(["deny","allow","require"]).optional().openapi({description:"Defines whether organizations can be used with client credentials exchanges for this grant."}),allow_any_organization:t.z.boolean().optional().openapi({description:"If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations."}),is_system:t.z.boolean().optional().openapi({description:"If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly."}),subject_type:t.z.enum(["client","user"]).optional().openapi({description:"The type of application access the client grant allows. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."}),authorization_details_types:t.z.array(t.z.string()).optional().openapi({description:"Types of authorization_details allowed for this client grant. Use of this field is subject to the applicable Free Trial terms in Okta's Master Subscription Agreement."})}),C=t.z.object({id:t.z.string().openapi({description:"ID of the client grant."}),...I.shape,created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),N=t.z.array(C),T=t.z.object({x:t.z.number(),y:t.z.number()});var x,k=((x=k||{}).RICH_TEXT="RICH_TEXT",x.NEXT_BUTTON="NEXT_BUTTON",x.BACK_BUTTON="BACK_BUTTON",x.SUBMIT_BUTTON="SUBMIT_BUTTON",x.DIVIDER="DIVIDER",x.TEXT="TEXT",x.EMAIL="EMAIL",x.PASSWORD="PASSWORD",x.NUMBER="NUMBER",x.PHONE="PHONE",x.DATE="DATE",x.CHECKBOX="CHECKBOX",x.RADIO="RADIO",x.SELECT="SELECT",x.HIDDEN="HIDDEN",x.LEGAL="LEGAL",x),R=(e=>(e.BLOCK="BLOCK",e.FIELD="FIELD",e))(R||{});const D=t.z.object({id:t.z.string(),category:t.z.nativeEnum(R),type:t.z.nativeEnum(k)}),L=D.extend({category:t.z.literal("BLOCK"),type:t.z.literal("RICH_TEXT"),config:t.z.object({content:t.z.string()}).passthrough()}),j=D.extend({category:t.z.literal("BLOCK"),type:t.z.union([t.z.literal("NEXT_BUTTON"),t.z.literal("BACK_BUTTON"),t.z.literal("SUBMIT_BUTTON")]),config:t.z.object({text:t.z.string()}).passthrough()}),F=D.extend({category:t.z.literal("FIELD"),type:t.z.literal("LEGAL"),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({text:t.z.string()}).passthrough()}),U=D.extend({category:t.z.literal("FIELD"),type:t.z.union([t.z.literal("TEXT"),t.z.literal("EMAIL"),t.z.literal("PASSWORD"),t.z.literal("NUMBER"),t.z.literal("PHONE"),t.z.literal("DATE"),t.z.literal("CHECKBOX"),t.z.literal("RADIO"),t.z.literal("SELECT"),t.z.literal("HIDDEN")]),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional(),config:t.z.object({label:t.z.string().optional(),placeholder:t.z.string().optional()}).passthrough()}),P=t.z.object({id:t.z.string(),category:t.z.string(),type:t.z.string()}).passthrough(),M=t.z.union([L,j,F,U,P]);var Z=(e=>(e.STEP="STEP",e.FLOW="FLOW",e.CONDITION="CONDITION",e.ACTION="ACTION",e))(Z||{});const $=t.z.object({id:t.z.string(),type:t.z.literal("STEP"),coordinates:T,alias:t.z.string().optional(),config:t.z.object({components:t.z.array(M),next_node:t.z.string()}).passthrough()}),H=t.z.object({id:t.z.string(),type:t.z.literal("FLOW"),coordinates:T,alias:t.z.string().optional(),config:t.z.object({flow_id:t.z.string(),next_node:t.z.string()})}),z=t.z.object({id:t.z.string(),type:t.z.literal("ACTION"),coordinates:T,alias:t.z.string().optional(),config:t.z.object({action_type:t.z.enum(["REDIRECT"]).openapi({description:"The type of action to perform"}),target:t.z.enum(["change-email","account","custom"]).openapi({description:"The predefined target to redirect to"}),custom_url:t.z.string().optional().openapi({description:"Custom URL when target is 'custom'"}),next_node:t.z.string().openapi({description:"The next node to navigate to after action (for non-redirect actions)"})}).passthrough()}),G=t.z.object({id:t.z.string(),type:t.z.string(),coordinates:T}).passthrough(),B=t.z.union([$,H,z,G]),q=t.z.object({next_node:t.z.string(),coordinates:T}).passthrough(),W=t.z.object({resume_flow:t.z.boolean().optional(),coordinates:T}).passthrough(),K=t.z.object({id:t.z.string(),name:t.z.string(),languages:t.z.object({primary:t.z.string()}).passthrough(),nodes:t.z.array(B),start:q,ending:W,created_at:t.z.string(),updated_at:t.z.string(),links:t.z.object({sdkSrc:t.z.string().optional(),sdk_src:t.z.string().optional()}).passthrough()}).passthrough(),V=K.omit({id:!0,created_at:!0,updated_at:!0});var X=(e=>(e.TOKEN="token",e.ID_TOKEN="id_token",e.TOKEN_ID_TOKEN="token id_token",e.CODE="code",e))(X||{}),Y=(e=>(e.QUERY="query",e.FRAGMENT="fragment",e.FORM_POST="form_post",e.WEB_MESSAGE="web_message",e.SAML_POST="saml_post",e))(Y||{}),J=(e=>(e.S256="S256",e.Plain="plain",e))(J||{});const Q=t.z.object({client_id:t.z.string(),act_as:t.z.string().optional(),response_type:t.z.nativeEnum(X).optional(),response_mode:t.z.nativeEnum(Y).optional(),redirect_uri:t.z.string().optional(),audience:t.z.string().optional(),organization:t.z.string().optional(),state:t.z.string().optional(),nonce:t.z.string().optional(),scope:t.z.string().optional(),prompt:t.z.string().optional(),code_challenge_method:t.z.nativeEnum(J).optional(),code_challenge:t.z.string().optional(),username:t.z.string().optional(),ui_locales:t.z.string().optional(),max_age:t.z.number().optional(),acr_values:t.z.string().optional(),vendor_id:t.z.string().optional()}),ee=t.z.object({colors:t.z.object({primary:t.z.string(),page_background:t.z.object({type:t.z.string().optional(),start:t.z.string().optional(),end:t.z.string().optional(),angle_deg:t.z.number().optional()}).optional()}).optional(),logo_url:t.z.string().optional(),favicon_url:t.z.string().optional(),powered_by_logo_url:t.z.string().optional(),font:t.z.object({url:t.z.string()}).optional()}),te=t.z.object({kid:t.z.string().optional(),team_id:t.z.string().optional(),realms:t.z.string().optional(),authentication_method:t.z.string().optional(),client_id:t.z.string().optional(),client_secret:t.z.string().optional(),app_secret:t.z.string().optional(),scope:t.z.string().optional(),authorization_endpoint:t.z.string().optional(),token_endpoint:t.z.string().optional(),userinfo_endpoint:t.z.string().optional(),jwks_uri:t.z.string().optional(),discovery_url:t.z.string().optional(),issuer:t.z.string().optional(),provider:t.z.string().optional(),from:t.z.string().optional(),twilio_sid:t.z.string().optional(),twilio_token:t.z.string().optional(),icon_url:t.z.string().optional()}),ie=t.z.object({id:t.z.string().optional(),name:t.z.string(),display_name:t.z.string().optional(),strategy:t.z.string(),options:te.default({}),enabled_clients:t.z.array(t.z.string()).default([]).optional(),response_type:t.z.custom().optional(),response_mode:t.z.custom().optional(),is_domain_connection:t.z.boolean().optional(),show_as_button:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional(),is_system:t.z.boolean().optional()}),ne=t.z.object({id:t.z.string(),created_at:t.z.string().transform((e=>null===e?"":e)),updated_at:t.z.string().transform((e=>null===e?"":e))}).extend(ie.shape),se=t.z.object({id:t.z.string().optional(),audience:t.z.string(),friendly_name:t.z.string(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sender_email:t.z.string().email(),sender_name:t.z.string(),session_lifetime:t.z.number().optional(),idle_session_lifetime:t.z.number().optional(),ephemeral_session_lifetime:t.z.number().optional(),idle_ephemeral_session_lifetime:t.z.number().optional(),session_cookie:t.z.object({mode:t.z.enum(["persistent","non-persistent"]).optional()}).optional(),allowed_logout_urls:t.z.array(t.z.string()).optional(),default_redirection_uri:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).optional(),flags:t.z.object({allow_changing_enable_sso:t.z.boolean().optional(),allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),change_pwd_flow_v1:t.z.boolean().optional(),custom_domains_provisioning:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),disable_impersonation:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),enable_sso:t.z.boolean().optional(),enforce_client_authentication_on_passwordless_start:t.z.boolean().optional(),genai_trial:t.z.boolean().optional(),improved_signup_bot_detection_in_classic:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional(),no_disclose_enterprise_connections:t.z.boolean().optional(),remove_alg_from_jwks:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),trust_azure_adfs_email_verified_connection_property:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),inherit_global_permissions_in_organizations:t.z.boolean().optional()}).optional(),sandbox_version:t.z.string().optional(),legacy_sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean().optional(),html:t.z.string().optional()}).optional(),device_flow:t.z.object({charset:t.z.enum(["base20","digits"]).optional(),mask:t.z.string().max(20).optional()}).optional(),default_token_quota:t.z.object({clients:t.z.object({client_credentials:t.z.record(t.z.any()).optional()}).optional(),organizations:t.z.object({client_credentials:t.z.record(t.z.any()).optional()}).optional()}).optional(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional(),oidc_logout:t.z.object({rp_logout_end_session_endpoint_discovery:t.z.boolean().optional()}).optional(),allow_organization_name_in_authentication_api:t.z.boolean().optional(),customize_mfa_in_postlogin_action:t.z.boolean().optional(),acr_values_supported:t.z.array(t.z.string()).optional(),mtls:t.z.object({enable_endpoint_aliases:t.z.boolean().optional()}).optional(),pushed_authorization_requests_supported:t.z.boolean().optional(),authorization_response_iss_parameter_supported:t.z.boolean().optional()}),re=t.z.object({created_at:t.z.string().nullable().transform((e=>e??"")),updated_at:t.z.string().nullable().transform((e=>e??"")),...se.shape,id:t.z.string()}),oe=t.z.object({...S.shape,tenant:re,connections:t.z.array(ne)}),ae=t.z.enum(["password_reset","email_verification","otp","authorization_code","oauth2_state","ticket"]),ce=t.z.object({code_id:t.z.string().openapi({description:"The code that will be used in for instance an email verification flow"}),login_id:t.z.string().openapi({description:"The id of the login session that the code is connected to"}),connection_id:t.z.string().optional().openapi({description:"The connection that the code is connected to"}),code_type:ae,code_verifier:t.z.string().optional().openapi({description:"The code verifier used in PKCE in outbound flows"}),code_challenge:t.z.string().optional().openapi({description:"The code challenge used in PKCE in outbound flows"}),code_challenge_method:t.z.enum(["plain","S256"]).optional().openapi({description:"The code challenge method used in PKCE in outbound flows"}),redirect_uri:t.z.string().optional().openapi({description:"The redirect URI associated with the code"}),nonce:t.z.string().optional().openapi({description:"The nonce value used for security in OIDC flows"}),state:t.z.string().optional().openapi({description:"The state parameter used for CSRF protection in OAuth flows"}),expires_at:t.z.string(),used_at:t.z.string().optional(),user_id:t.z.string().optional()}),ue=t.z.object({...ce.shape,created_at:t.z.string()}),de=t.z.object({domain:t.z.string(),custom_domain_id:t.z.string().optional(),type:t.z.enum(["auth0_managed_certs","self_managed_certs"]),verification_method:t.z.enum(["txt"]).optional(),tls_policy:t.z.enum(["recommended"]).optional(),custom_client_ip_header:t.z.enum(["true-client-ip","cf-connecting-ip","x-forwarded-for","x-azure-clientip","null"]).optional(),domain_metadata:t.z.record(t.z.string().max(255)).optional()}),le=t.z.object({name:t.z.literal("txt"),record:t.z.string(),domain:t.z.string()}),he=t.z.object({...de.shape,custom_domain_id:t.z.string(),primary:t.z.boolean(),status:t.z.enum(["disabled","pending","pending_verification","ready"]),origin_domain_name:t.z.string().optional(),verification:t.z.object({methods:t.z.array(le)}).optional(),tls_policy:t.z.string().optional()}),_e=he.extend({tenant_id:t.z.string()}),pe=t.z.object({id:t.z.string(),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0)}),fe=pe.extend({category:t.z.literal("BLOCK").optional()}),me=fe.extend({type:t.z.literal("DIVIDER"),config:t.z.object({}).optional()}),ge=fe.extend({type:t.z.literal("HTML"),config:t.z.object({content:t.z.string().optional()}).optional()}),ye=fe.extend({type:t.z.literal("IMAGE"),config:t.z.object({src:t.z.string().optional(),alt:t.z.string().optional(),width:t.z.number().optional(),height:t.z.number().optional()}).optional()}),Ee=fe.extend({type:t.z.literal("JUMP_BUTTON"),config:t.z.object({text:t.z.string().optional(),target_step:t.z.string().optional()})}),ve=fe.extend({type:t.z.literal("RESEND_BUTTON"),config:t.z.object({text:t.z.string().optional(),resend_action:t.z.string().optional()})}),be=fe.extend({type:t.z.literal("NEXT_BUTTON"),config:t.z.object({text:t.z.string().optional()})}),we=fe.extend({type:t.z.literal("PREVIOUS_BUTTON"),config:t.z.object({text:t.z.string().optional()})}),Oe=fe.extend({type:t.z.literal("RICH_TEXT"),config:t.z.object({content:t.z.string().optional()}).optional()}),Ae=pe.extend({category:t.z.literal("WIDGET").optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),Se=Ae.extend({type:t.z.literal("AUTH0_VERIFIABLE_CREDENTIALS"),config:t.z.object({credential_type:t.z.string().optional()})}),Ie=Ae.extend({type:t.z.literal("GMAPS_ADDRESS"),config:t.z.object({api_key:t.z.string().optional()})}),Ce=Ae.extend({type:t.z.literal("RECAPTCHA"),config:t.z.object({site_key:t.z.string().optional()})}),Ne=pe.extend({category:t.z.literal("FIELD").optional(),label:t.z.string().min(1).optional(),hint:t.z.string().min(1).max(500).optional(),required:t.z.boolean().optional(),sensitive:t.z.boolean().optional()}),Te=Ne.extend({type:t.z.literal("BOOLEAN"),config:t.z.object({default_value:t.z.boolean().optional()}).optional()}),xe=Ne.extend({type:t.z.literal("CARDS"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string(),description:t.z.string().optional(),image:t.z.string().optional()})).optional(),multi_select:t.z.boolean().optional()}).optional()}),ke=Ne.extend({type:t.z.literal("CHOICE"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),display:t.z.enum(["radio","checkbox"]).optional()}).optional()}),Re=Ne.extend({type:t.z.literal("CUSTOM"),config:t.z.object({component:t.z.string().optional(),props:t.z.record(t.z.any()).optional()})}),De=Ne.extend({type:t.z.literal("DATE"),config:t.z.object({format:t.z.string().optional(),min:t.z.string().optional(),max:t.z.string().optional()}).optional()}),Le=Ne.extend({type:t.z.literal("DROPDOWN"),config:t.z.object({options:t.z.array(t.z.object({value:t.z.string(),label:t.z.string()})).optional(),placeholder:t.z.string().optional(),searchable:t.z.boolean().optional()}).optional()}),je=Ne.extend({type:t.z.literal("EMAIL"),config:t.z.object({placeholder:t.z.string().optional()}).optional()}),Fe=Ne.extend({type:t.z.literal("FILE"),config:t.z.object({accept:t.z.string().optional(),max_size:t.z.number().optional(),multiple:t.z.boolean().optional()}).optional()}),Ue=Ne.extend({type:t.z.literal("LEGAL"),config:t.z.object({text:t.z.string(),html:t.z.boolean().optional()}).optional()}),Pe=Ne.extend({type:t.z.literal("NUMBER"),config:t.z.object({placeholder:t.z.string().optional(),min:t.z.number().optional(),max:t.z.number().optional(),step:t.z.number().optional()}).optional()}),Me=Ne.extend({type:t.z.literal("PASSWORD"),config:t.z.object({placeholder:t.z.string().optional(),min_length:t.z.number().optional(),show_toggle:t.z.boolean().optional(),forgot_password_link:t.z.string().optional()}).optional()}),Ze=Ne.extend({type:t.z.literal("PAYMENT"),config:t.z.object({provider:t.z.string().optional(),currency:t.z.string().optional()}).optional()}),$e=Ne.extend({type:t.z.literal("SOCIAL"),config:t.z.object({providers:t.z.array(t.z.string()).optional()}).optional()}),He=Ne.extend({type:t.z.literal("TEL"),config:t.z.object({placeholder:t.z.string().optional(),default_country:t.z.string().optional()}).optional()}),ze=Ne.extend({type:t.z.literal("TEXT"),config:t.z.object({placeholder:t.z.string().optional(),multiline:t.z.boolean().optional(),max_length:t.z.number().optional()}).optional()}),Ge=Ne.extend({type:t.z.literal("URL"),config:t.z.object({placeholder:t.z.string().optional()}).optional()}),Be=t.z.discriminatedUnion("type",[me,ge,ye,Ee,ve,be,we,Oe]),qe=t.z.discriminatedUnion("type",[Se,Ie,Ce]),We=t.z.discriminatedUnion("type",[Te,xe,ke,Re,De,Le,je,Fe,Ue,Pe,Me,Ze,$e,He,ze,Ge]),Ke=t.z.union([Be,qe,We]),Ve=t.z.object({id:t.z.string(),type:t.z.literal("submit"),label:t.z.string(),className:t.z.string().optional(),disabled:t.z.boolean().optional().default(!1),order:t.z.number().optional(),visible:t.z.boolean().optional().default(!0),customizations:t.z.record(t.z.string(),t.z.any()).optional()}),Xe=t.z.object({x:t.z.number(),y:t.z.number()}),Ye=t.z.object({id:t.z.string(),type:t.z.literal("FLOW"),coordinates:Xe,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({flow_id:t.z.string().max(30),next_node:t.z.string().optional()})}),Je=t.z.object({id:t.z.string(),type:t.z.literal("ROUTER"),coordinates:Xe,alias:t.z.string().min(1).max(150),config:t.z.object({rules:t.z.array(t.z.object({id:t.z.string(),alias:t.z.string().min(1).max(150).optional(),condition:t.z.any(),next_node:t.z.string()})),fallback:t.z.string()})}),Qe=t.z.object({id:t.z.string(),type:t.z.literal("STEP"),coordinates:Xe,alias:t.z.string().min(1).max(150).optional(),config:t.z.object({components:t.z.array(Ke),next_node:t.z.string().optional()})}),et=t.z.discriminatedUnion("type",[Ye,Je,Qe]),tt=t.z.object({name:t.z.string().openapi({description:"The name of the form"}),messages:t.z.object({errors:t.z.record(t.z.string(),t.z.any()).optional(),custom:t.z.record(t.z.string(),t.z.any()).optional()}).optional(),languages:t.z.object({primary:t.z.string().optional(),default:t.z.string().optional()}).optional(),translations:t.z.record(t.z.string(),t.z.any()).optional(),nodes:t.z.array(et).optional(),start:t.z.object({hidden_fields:t.z.array(t.z.object({key:t.z.string(),value:t.z.string()})).optional(),next_node:t.z.string().optional(),coordinates:Xe.optional()}).optional(),ending:t.z.object({redirection:t.z.object({delay:t.z.number().optional(),target:t.z.string().optional()}).optional(),after_submit:t.z.object({flow_id:t.z.string().optional()}).optional(),coordinates:Xe.optional(),resume_flow:t.z.boolean().optional()}).optional(),style:t.z.object({css:t.z.string().optional()}).optional()}).openapi({description:"Schema for flow-based forms (matches Auth0 Forms structure)"}),it=t.z.object({...i.shape,...tt.shape,id:t.z.string()}),nt=t.z.object({id:t.z.number().optional(),text:t.z.string(),type:t.z.enum(["info","error","success","warning"])}),st=t.z.object({id:t.z.string().optional(),text:t.z.string(),href:t.z.string(),linkText:t.z.string().optional()}),rt=t.z.object({action:t.z.string(),method:t.z.enum(["POST","GET"]),title:t.z.string().optional(),description:t.z.string().optional(),components:t.z.array(Ke),messages:t.z.array(nt).optional(),links:t.z.array(st).optional()}),ot=t.z.enum(["pre-user-registration","post-user-registration","post-user-login","validate-registration-username","pre-user-deletion","post-user-deletion"]),at=t.z.enum(["pre-user-registration","post-user-registration","post-user-login","validate-registration-username","pre-user-deletion","post-user-deletion"]),ct={enabled:t.z.boolean().default(!1),synchronous:t.z.boolean().default(!1),priority:t.z.number().optional(),hook_id:t.z.string().optional()},ut=t.z.object({...ct,trigger_id:ot,url:t.z.string()}),dt=t.z.object({...ct,trigger_id:at,form_id:t.z.string()}),lt=t.z.union([ut,dt]),ht=t.z.object({...ct,trigger_id:ot,...i.shape,hook_id:t.z.string(),url:t.z.string()}),_t=t.z.object({...ct,trigger_id:at,...i.shape,hook_id:t.z.string(),form_id:t.z.string()}),pt=t.z.union([ht,_t]),ft=t.z.object({name:t.z.string().optional()}),mt=t.z.object({email:t.z.string().optional()}),gt=t.z.object({organization_id:t.z.string().max(50),inviter:ft,invitee:mt,invitation_url:t.z.string().url(),client_id:t.z.string(),connection_id:t.z.string().optional(),app_metadata:t.z.record(t.z.any()).default({}).optional(),user_metadata:t.z.record(t.z.any()).default({}).optional(),ttl_sec:t.z.number().int().max(2592e3).default(604800).optional(),roles:t.z.array(t.z.string()).default([]).optional(),send_invitation_email:t.z.boolean().default(!0).optional()}),yt=t.z.object({id:t.z.string(),organization_id:t.z.string().max(50),created_at:t.z.string().datetime(),expires_at:t.z.string().datetime(),ticket_id:t.z.string().optional()}).extend(gt.shape),Et=t.z.object({alg:t.z.enum(["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512"]),e:t.z.string(),kid:t.z.string(),kty:t.z.enum(["RSA","EC","oct"]),n:t.z.string(),x5t:t.z.string().optional(),x5c:t.z.array(t.z.string()).optional(),use:t.z.enum(["sig","enc"]).optional()}),vt=t.z.object({keys:t.z.array(Et)}),bt=t.z.object({issuer:t.z.string(),authorization_endpoint:t.z.string(),token_endpoint:t.z.string(),device_authorization_endpoint:t.z.string(),userinfo_endpoint:t.z.string(),mfa_challenge_endpoint:t.z.string(),jwks_uri:t.z.string(),registration_endpoint:t.z.string(),revocation_endpoint:t.z.string(),scopes_supported:t.z.array(t.z.string()),response_types_supported:t.z.array(t.z.string()),code_challenge_methods_supported:t.z.array(t.z.string()),response_modes_supported:t.z.array(t.z.string()),subject_types_supported:t.z.array(t.z.string()),id_token_signing_alg_values_supported:t.z.array(t.z.string()),token_endpoint_auth_methods_supported:t.z.array(t.z.string()),claims_supported:t.z.array(t.z.string()),request_uri_parameter_supported:t.z.boolean(),request_parameter_supported:t.z.boolean(),token_endpoint_auth_signing_alg_values_supported:t.z.array(t.z.string())});var wt=(e=>(e.PENDING="pending",e.AUTHENTICATED="authenticated",e.AWAITING_EMAIL_VERIFICATION="awaiting_email_verification",e.AWAITING_HOOK="awaiting_hook",e.AWAITING_CONTINUATION="awaiting_continuation",e.COMPLETED="completed",e.FAILED="failed",e.EXPIRED="expired",e))(wt||{});const Ot=t.z.nativeEnum(wt),At=t.z.object({csrf_token:t.z.string(),auth0Client:t.z.string().optional(),authParams:Q,expires_at:t.z.string(),deleted_at:t.z.string().optional(),ip:t.z.string().optional(),useragent:t.z.string().optional(),session_id:t.z.string().optional(),authorization_url:t.z.string().optional(),state:Ot.optional().default("pending"),state_data:t.z.string().optional(),failure_reason:t.z.string().optional(),user_id:t.z.string().optional()}).openapi({description:"This represents a login sesion"}),St=t.z.object({...At.shape,id:t.z.string().openapi({description:"This is is used as the state in the universal login"}),created_at:t.z.string(),updated_at:t.z.string()}),It={ACLS_SUMMARY:"acls_summary",ACTIONS_EXECUTION_FAILED:"actions_execution_failed",API_LIMIT:"api_limit",API_LIMIT_WARNING:"api_limit_warning",APPI:"appi",CIBA_EXCHANGE_FAILED:"ciba_exchange_failed",CIBA_EXCHANGE_SUCCEEDED:"ciba_exchange_succeeded",CIBA_START_FAILED:"ciba_start_failed",CIBA_START_SUCCEEDED:"ciba_start_succeeded",CODE_LINK_SENT:"cls",CODE_SENT:"cs",DEPRECATION_NOTICE:"depnote",FAILED_LOGIN:"f",FAILED_BY_CONNECTOR:"fc",FAILED_CHANGE_EMAIL:"fce",FAILED_BY_CORS:"fco",FAILED_CROSS_ORIGIN_AUTHENTICATION:"fcoa",FAILED_CHANGE_PASSWORD:"fcp",FAILED_POST_CHANGE_PASSWORD_HOOK:"fcph",FAILED_CHANGE_PHONE_NUMBER:"fcpn",FAILED_CHANGE_PASSWORD_REQUEST:"fcpr",FAILED_CONNECTOR_PROVISIONING:"fcpro",FAILED_CHANGE_USERNAME:"fcu",FAILED_DELEGATION:"fd",FAILED_DEVICE_ACTIVATION:"fdeac",FAILED_DEVICE_AUTHORIZATION_REQUEST:"fdeaz",USER_CANCELED_DEVICE_CONFIRMATION:"fdecc",FAILED_USER_DELETION:"fdu",FAILED_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"feacft",FAILED_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"feccft",FAILED_EXCHANGE_CUSTOM_TOKEN:"fecte",FAILED_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"fede",FAILED_FEDERATED_LOGOUT:"federated_logout_failed",FAILED_EXCHANGE_NATIVE_SOCIAL_LOGIN:"fens",FAILED_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"feoobft",FAILED_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"feotpft",FAILED_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"fepft",FAILED_EXCHANGE_PASSWORDLESS_OTP_FOR_ACCESS_TOKEN:"fepotpft",FAILED_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"fercft",FAILED_EXCHANGE_ROTATING_REFRESH_TOKEN:"ferrt",FAILED_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"fertft",FAILED_HOOK:"fh",FAILED_IMPERSONATION:"fimp",FAILED_INVITE_ACCEPT:"fi",FAILED_LOGOUT:"flo",FLOWS_EXECUTION_COMPLETED:"flows_execution_completed",FLOWS_EXECUTION_FAILED:"flows_execution_failed",FAILED_SENDING_NOTIFICATION:"fn",FORMS_SUBMISSION_FAILED:"forms_submission_failed",FORMS_SUBMISSION_SUCCEEDED:"forms_submission_succeeded",FAILED_LOGIN_INCORRECT_PASSWORD:"fp",FAILED_PUSHED_AUTHORIZATION_REQUEST:"fpar",FAILED_POST_USER_REGISTRATION_HOOK:"fpurh",FAILED_SIGNUP:"fs",FAILED_SILENT_AUTH:"fsa",FAILED_LOGIN_INVALID_EMAIL_USERNAME:"fu",FAILED_USERS_IMPORT:"fui",FAILED_VERIFICATION_EMAIL:"fv",FAILED_VERIFICATION_EMAIL_REQUEST:"fvr",EMAIL_VERIFICATION_CONFIRMED:"gd_auth_email_verification",EMAIL_VERIFICATION_FAILED:"gd_auth_fail_email_verification",MFA_AUTH_FAILED:"gd_auth_failed",MFA_AUTH_REJECTED:"gd_auth_rejected",MFA_AUTH_SUCCESS:"gd_auth_succeed",MFA_ENROLLMENT_COMPLETE:"gd_enrollment_complete",TOO_MANY_MFA_FAILURES:"gd_otp_rate_limit_exceed",MFA_RECOVERY_FAILED:"gd_recovery_failed",MFA_RECOVERY_RATE_LIMIT_EXCEED:"gd_recovery_rate_limit_exceed",MFA_RECOVERY_SUCCESS:"gd_recovery_succeed",MFA_EMAIL_SENT:"gd_send_email",EMAIL_VERIFICATION_SENT:"gd_send_email_verification",EMAIL_VERIFICATION_SEND_FAILURE:"gd_send_email_verification_failure",PUSH_NOTIFICATION_SENT:"gd_send_pn",ERROR_SENDING_MFA_PUSH_NOTIFICATION:"gd_send_pn_failure",MFA_SMS_SENT:"gd_send_sms",ERROR_SENDING_MFA_SMS:"gd_send_sms_failure",MFA_VOICE_CALL_SUCCESS:"gd_send_voice",MFA_VOICE_CALL_FAILED:"gd_send_voice_failure",SECOND_FACTOR_STARTED:"gd_start_auth",MFA_ENROLL_STARTED:"gd_start_enroll",MFA_ENROLLMENT_FAILED:"gd_start_enroll_failed",GUARDIAN_TENANT_UPDATE:"gd_tenant_update",UNENROLL_DEVICE_ACCOUNT:"gd_unenroll",UPDATE_DEVICE_ACCOUNT:"gd_update_device_account",WEBAUTHN_CHALLENGE_FAILED:"gd_webauthn_challenge_failed",WEBAUTHN_ENROLLMENT_FAILED:"gd_webauthn_enrollment_failed",FAILED_KMS_API_OPERATION:"kms_key_management_failure",SUCCESS_KMS_API_OPERATION:"kms_key_management_success",KMS_KEY_STATE_CHANGED:"kms_key_state_changed",TOO_MANY_CALLS_TO_DELEGATION:"limit_delegation",BLOCKED_IP_ADDRESS:"limit_mu",BLOCKED_ACCOUNT_IP:"limit_sul",BLOCKED_ACCOUNT_EMAIL:"limit_wc",MFA_REQUIRED:"mfar",MANAGEMENT_API_READ_OPERATION:"mgmt_api_read",FAILED_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_failed",SUCCESSFUL_AUTHENTICATION_METHOD_OPERATION_MY_ACCOUNT:"my_account_authentication_method_succeeded",FAILED_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_failed",SUCCESSFUL_OIDC_BACKCHANNEL_LOGOUT:"oidc_backchannel_logout_succeeded",ORGANIZATION_MEMBER_ADDED:"organization_member_added",PASSKEY_CHALLENGE_FAILED:"passkey_challenge_failed",PASSKEY_CHALLENGE_STARTED:"passkey_challenge_started",PRE_LOGIN_ASSESSMENT:"pla",BREACHED_PASSWORD:"pwd_leak",BREACHED_PASSWORD_ON_RESET:"reset_pwd_leak",SUCCESS_RESOURCE_CLEANUP:"resource_cleanup",RICH_CONSENTS_ACCESS_ERROR:"rich_consents_access_error",SUCCESS_LOGIN:"s",SUCCESS_API_OPERATION:"sapi",SUCCESS_CHANGE_EMAIL:"sce",SUCCESS_CROSS_ORIGIN_AUTHENTICATION:"scoa",SUCCESS_CHANGE_PASSWORD:"scp",SUCCESS_CHANGE_PHONE_NUMBER:"scpn",SUCCESS_CHANGE_PASSWORD_REQUEST:"scpr",SUCCESS_CHANGE_USERNAME:"scu",SUCCESS_CREDENTIAL_VALIDATION:"scv",SUCCESS_DELEGATION:"sd",SUCCESS_USER_DELETION:"sdu",SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN:"seacft",SUCCESS_EXCHANGE_ACCESS_TOKEN_FOR_CLIENT_CREDENTIALS:"seccft",SUCCESS_EXCHANGE_CUSTOM_TOKEN:"secte",SUCCESS_EXCHANGE_DEVICE_CODE_FOR_ACCESS_TOKEN:"sede",SUCCESS_EXCHANGE_NATIVE_SOCIAL_LOGIN:"sens",SUCCESS_EXCHANGE_PASSWORD_OOB_FOR_ACCESS_TOKEN:"seoobft",SUCCESS_EXCHANGE_PASSWORD_OTP_FOR_ACCESS_TOKEN:"seotpft",SUCCESS_EXCHANGE_PASSWORD_FOR_ACCESS_TOKEN:"sepft",SUCCESS_EXCHANGE_PASSKEY_OOB_FOR_ACCESS_TOKEN:"sepkoobft",SUCCESS_EXCHANGE_PASSKEY_OTP_FOR_ACCESS_TOKEN:"sepkotpft",SUCCESS_EXCHANGE_PASSKEY_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sepkrcft",SUCCESS_EXCHANGE_PASSWORD_MFA_RECOVERY_FOR_ACCESS_TOKEN:"sercft",SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN:"sertft",SUCCESS_IMPERSONATION:"simp",SUCCESSFULLY_ACCEPTED_USER_INVITE:"si",BREACHED_PASSWORD_ON_SIGNUP:"signup_pwd_leak",SUCCESS_LOGOUT:"slo",SUCCESS_REVOCATION:"srrt",SUCCESS_SIGNUP:"ss",FAILED_SS_SSO_OPERATION:"ss_sso_failure",INFORMATION_FROM_SS_SSO_OPERATION:"ss_sso_info",SUCCESS_SS_SSO_OPERATION:"ss_sso_success",SUCCESS_SILENT_AUTH:"ssa",SUCCESSFUL_SCIM_OPERATION:"sscim",SUCCESSFULLY_IMPORTED_USERS:"sui",SUCCESS_VERIFICATION_EMAIL:"sv",SUCCESS_VERIFICATION_EMAIL_REQUEST:"svr",MAX_AMOUNT_OF_AUTHENTICATORS:"too_many_records",USER_LOGIN_BLOCK_RELEASED:"ublkdu",FAILED_UNIVERSAL_LOGOUT:"universal_logout_failed",SUCCESSFUL_UNIVERSAL_LOGOUT:"universal_logout_succeeded",WARNING_DURING_LOGIN:"w",WARNING_SENDING_NOTIFICATION:"wn",WARNING_USER_MANAGEMENT:"wum"},Ct=t.z.string().refine((e=>Object.values(It).includes(e)),{message:"Invalid log type"}),Nt=t.z.object({name:t.z.string(),version:t.z.string(),env:t.z.object({node:t.z.string().optional()}).optional()}),Tt=t.z.object({country_code:t.z.string().length(2),city_name:t.z.string(),latitude:t.z.string(),longitude:t.z.string(),time_zone:t.z.string(),continent_code:t.z.string()}),xt=t.z.object({type:Ct,date:t.z.string(),description:t.z.string().optional(),ip:t.z.string().optional(),user_agent:t.z.string().optional(),details:t.z.any().optional(),isMobile:t.z.boolean(),user_id:t.z.string().optional(),user_name:t.z.string().optional(),connection:t.z.string().optional(),connection_id:t.z.string().optional(),client_id:t.z.string().optional(),client_name:t.z.string().optional(),audience:t.z.string().optional(),scope:t.z.string().optional(),strategy:t.z.string().optional(),strategy_type:t.z.string().optional(),hostname:t.z.string().optional(),auth0_client:Nt.optional(),log_id:t.z.string().optional(),location_info:Tt.optional()}),kt=t.z.object({...xt.shape,log_id:t.z.string()}),Rt=t.z.object({id:t.z.string().optional(),user_id:t.z.string(),password:t.z.string(),algorithm:t.z.enum(["bcrypt","argon2id"]).default("argon2id"),is_current:t.z.boolean().default(!0)}),Dt=Rt.extend({id:t.z.string(),created_at:t.z.string(),updated_at:t.z.string()}),Lt=t.z.object({initial_user_agent:t.z.string().describe("First user agent of the device from which this user logged in"),initial_ip:t.z.string().describe("First IP address associated with this session"),initial_asn:t.z.string().describe("First autonomous system number associated with this session"),last_user_agent:t.z.string().describe("Last user agent of the device from which this user logged in"),last_ip:t.z.string().describe("Last IP address from which this user logged in"),last_asn:t.z.string().describe("Last autonomous system number from which this user logged in")}),jt=t.z.object({id:t.z.string(),revoked_at:t.z.string().optional(),used_at:t.z.string().optional(),user_id:t.z.string().describe("The user ID associated with the session"),expires_at:t.z.string().optional(),login_session_id:t.z.string(),idle_expires_at:t.z.string().optional(),device:Lt.describe("Metadata related to the device used in the session"),clients:t.z.array(t.z.string()).describe("List of client details for the session")}),Ft=t.z.object({created_at:t.z.string(),updated_at:t.z.string(),authenticated_at:t.z.string(),last_interaction_at:t.z.string(),...jt.shape}),Ut=t.z.object({kid:t.z.string().openapi({description:"The key id of the signing key"}),cert:t.z.string().openapi({description:"The public certificate of the signing key"}),fingerprint:t.z.string().openapi({description:"The cert fingerprint"}),thumbprint:t.z.string().openapi({description:"The cert thumbprint"}),pkcs7:t.z.string().optional().openapi({description:"The private key in pkcs7 format"}),current:t.z.boolean().optional().openapi({description:"True if the key is the current key"}),next:t.z.boolean().optional().openapi({description:"True if the key is the next key"}),previous:t.z.boolean().optional().openapi({description:"True if the key is the previous key"}),current_since:t.z.string().optional().openapi({description:"The date and time when the key became the current key"}),current_until:t.z.string().optional().openapi({description:"The date and time when the current key was rotated"}),revoked:t.z.boolean().optional().openapi({description:"True if the key is revoked"}),revoked_at:t.z.string().optional().openapi({description:"The date and time when the key was revoked"}),connection:t.z.string().optional().openapi({description:"The connection identifier associated with the key"}),type:t.z.enum(["jwt_signing","saml_encryption"]).openapi({description:"The type of the signing key"})});var Pt=(e=>(e.RefreshToken="refresh_token",e.AuthorizationCode="authorization_code",e.ClientCredential="client_credentials",e.Passwordless="passwordless",e.Password="password",e.OTP="http://auth0.com/oauth/grant-type/passwordless/otp",e))(Pt||{});const Mt=t.z.object({access_token:t.z.string(),id_token:t.z.string().optional(),scope:t.z.string().optional(),state:t.z.string().optional(),refresh_token:t.z.string().optional(),token_type:t.z.string(),expires_in:t.z.number()});t.z.object({code:t.z.string(),state:t.z.string().optional()});const Zt=t.z.object({button_border_radius:t.z.number(),button_border_weight:t.z.number(),buttons_style:t.z.enum(["pill","rounded","sharp"]),input_border_radius:t.z.number(),input_border_weight:t.z.number(),inputs_style:t.z.enum(["pill","rounded","sharp"]),show_widget_shadow:t.z.boolean(),widget_border_weight:t.z.number(),widget_corner_radius:t.z.number()}),$t=t.z.object({base_focus_color:t.z.string(),base_hover_color:t.z.string(),body_text:t.z.string(),captcha_widget_theme:t.z.enum(["auto","dark","light"]),error:t.z.string(),header:t.z.string(),icons:t.z.string(),input_background:t.z.string(),input_border:t.z.string(),input_filled_text:t.z.string(),input_labels_placeholders:t.z.string(),links_focused_components:t.z.string(),primary_button:t.z.string(),primary_button_label:t.z.string(),secondary_button_border:t.z.string(),secondary_button_label:t.z.string(),success:t.z.string(),widget_background:t.z.string(),widget_border:t.z.string()}),Ht=t.z.object({bold:t.z.boolean(),size:t.z.number()}),zt=t.z.object({body_text:Ht,buttons_text:Ht,font_url:t.z.string(),input_labels:Ht,links:Ht,links_style:t.z.enum(["normal","underlined"]),reference_text_size:t.z.number(),subtitle:Ht,title:Ht}),Gt=t.z.object({background_color:t.z.string(),background_image_url:t.z.string(),page_layout:t.z.enum(["center","left","right"])}),Bt=t.z.object({header_text_alignment:t.z.enum(["center","left","right"]),logo_height:t.z.number(),logo_position:t.z.enum(["center","left","none","right"]),logo_url:t.z.string(),social_buttons_layout:t.z.enum(["bottom","top"])}),qt=t.z.object({borders:Zt,colors:$t,displayName:t.z.string(),fonts:zt,page_background:Gt,widget:Bt}),Wt=qt.extend({themeId:t.z.string()}),Kt=t.z.object({universal_login_experience:t.z.enum(["new","classic"]).default("new"),identifier_first:t.z.boolean().default(!0),password_first:t.z.boolean().default(!1),webauthn_platform_first_factor:t.z.boolean()}),Vt=t.z.object({name:t.z.string(),enabled:t.z.boolean().optional().default(!0),default_from_address:t.z.string().optional(),credentials:t.z.union([t.z.object({accessKeyId:t.z.string(),secretAccessKey:t.z.string(),region:t.z.string()}),t.z.object({smtp_host:t.z.array(t.z.string()),smtp_port:t.z.number(),smtp_user:t.z.string(),smtp_pass:t.z.string()}),t.z.object({api_key:t.z.string(),domain:t.z.string().optional()}),t.z.object({connectionString:t.z.string()}),t.z.object({tenantId:t.z.string(),clientId:t.z.string(),clientSecret:t.z.string()})]),settings:t.z.object({}).optional()}),Xt=t.z.object({id:t.z.string(),session_id:t.z.string(),user_id:t.z.string(),client_id:t.z.string(),expires_at:t.z.string().optional(),idle_expires_at:t.z.string().optional(),last_exchanged_at:t.z.string().optional(),device:Lt,resource_servers:t.z.array(t.z.object({audience:t.z.string(),scopes:t.z.string()})),rotating:t.z.boolean()}),Yt=t.z.object({created_at:t.z.string(),...Xt.shape}),Jt=t.z.object({to:t.z.string(),message:t.z.string()}),Qt=t.z.object({name:t.z.string(),options:t.z.object({})}),ei=t.z.object({value:t.z.string(),description:t.z.string().optional()}),ti=t.z.object({token_dialect:t.z.enum(["access_token","access_token_authz"]).optional(),enforce_policies:t.z.boolean().optional(),allow_skipping_userinfo:t.z.boolean().optional(),skip_userinfo:t.z.boolean().optional(),persist_client_authorization:t.z.boolean().optional(),enable_introspection_endpoint:t.z.boolean().optional(),mtls:t.z.object({bound_access_tokens:t.z.boolean().optional()}).optional()}),ii=t.z.object({id:t.z.string().optional(),name:t.z.string(),identifier:t.z.string(),scopes:t.z.array(ei).optional(),signing_alg:t.z.string().optional(),signing_secret:t.z.string().optional(),token_lifetime:t.z.number().optional(),token_lifetime_for_web:t.z.number().optional(),skip_consent_for_verifiable_first_party_clients:t.z.boolean().optional(),allow_offline_access:t.z.boolean().optional(),verificationKey:t.z.string().optional(),options:ti.optional(),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional()}),ni=t.z.object({...ii.shape,created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),si=t.z.array(ni),ri=t.z.object({role_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string()}),oi=t.z.object({...ri.shape,created_at:t.z.string()}),ai=t.z.array(oi),ci=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),permission_name:t.z.string(),organization_id:t.z.string().optional()}),ui=t.z.object({...ci.shape,tenant_id:t.z.string(),created_at:t.z.string().optional()}),di=t.z.array(ui),li=t.z.object({user_id:t.z.string(),resource_server_identifier:t.z.string(),resource_server_name:t.z.string(),permission_name:t.z.string(),description:t.z.string().nullable().optional(),created_at:t.z.string().optional(),organization_id:t.z.string().optional()}),hi=t.z.array(li),_i=t.z.object({user_id:t.z.string(),role_id:t.z.string(),organization_id:t.z.string().optional()}),pi=t.z.object({..._i.shape,tenant_id:t.z.string(),created_at:t.z.string().optional()}),fi=t.z.array(pi),mi=t.z.object({id:t.z.string().optional().openapi({description:"The unique identifier of the role. If not provided, one will be generated."}),name:t.z.string().min(1).max(50).openapi({description:"The name of the role. Cannot include '<' or '>'"}),description:t.z.string().max(255).optional().openapi({description:"The description of the role"}),is_system:t.z.boolean().optional(),metadata:t.z.record(t.z.any()).optional().openapi({description:"Metadata associated with the role. Can be used to control sync behavior in multi-tenancy scenarios."})}),gi=mi.extend({id:t.z.string().openapi({description:"The unique identifier of the role"}),created_at:t.z.string().optional(),updated_at:t.z.string().optional()}),yi=t.z.array(gi),Ei=t.z.object({logo_url:t.z.string().optional().openapi({description:"URL of the organization's logo"}),colors:t.z.object({primary:t.z.string().optional().openapi({description:"Primary color in hex format (e.g., #FF0000)"}),page_background:t.z.string().optional().openapi({description:"Page background color in hex format (e.g., #FFFFFF)"})}).optional()}).optional(),vi=t.z.object({connection_id:t.z.string().openapi({description:"ID of the connection"}),assign_membership_on_login:t.z.boolean().default(!1).openapi({description:"Whether to assign membership to the organization on login"}),show_as_button:t.z.boolean().default(!0).openapi({description:"Whether to show this connection as a button in the login screen"}),is_signup_enabled:t.z.boolean().default(!0).openapi({description:"Whether signup is enabled for this connection"})}),bi=t.z.object({client_credentials:t.z.object({enforce:t.z.boolean().default(!1).openapi({description:"Whether to enforce token quota limits"}),per_day:t.z.number().min(0).default(0).openapi({description:"Maximum tokens per day (0 = unlimited)"}),per_hour:t.z.number().min(0).default(0).openapi({description:"Maximum tokens per hour (0 = unlimited)"})}).optional()}).optional(),wi=t.z.object({id:t.z.string().optional(),name:t.z.string().min(1).regex(/^[a-z0-9_-]+$/,{message:"Organization name must be lowercase and can only contain letters, numbers, hyphens, and underscores"}).openapi({description:"The name of the organization. Must be lowercase and can only contain letters, numbers, hyphens, and underscores."}),display_name:t.z.string().optional().openapi({description:"The display name of the organization"}),branding:Ei,metadata:t.z.record(t.z.any()).default({}).optional().openapi({description:"Custom metadata for the organization"}),enabled_connections:t.z.array(vi).default([]).optional().openapi({description:"List of enabled connections for the organization"}),token_quota:bi}),Oi=t.z.object({...wi.shape,...i.shape,id:t.z.string(),name:t.z.string().min(1).openapi({description:"The name of the organization"})}),Ai=t.z.object({user_id:t.z.string().openapi({description:"ID of the user"}),organization_id:t.z.string().openapi({description:"ID of the organization"})}),Si=t.z.object({...Ai.shape,...i.shape,id:t.z.string()}),Ii=t.z.object({idle_session_lifetime:t.z.number().optional(),session_lifetime:t.z.number().optional(),session_cookie:t.z.object({mode:t.z.enum(["persistent","non-persistent"]).optional()}).optional(),enable_client_connections:t.z.boolean().optional(),default_redirection_uri:t.z.string().optional(),enabled_locales:t.z.array(t.z.string()).optional(),default_directory:t.z.string().optional(),error_page:t.z.object({html:t.z.string().optional(),show_log_link:t.z.boolean().optional(),url:t.z.string().optional()}).optional(),flags:t.z.object({allow_legacy_delegation_grant_types:t.z.boolean().optional(),allow_legacy_ro_grant_types:t.z.boolean().optional(),allow_legacy_tokeninfo_endpoint:t.z.boolean().optional(),disable_clickjack_protection_headers:t.z.boolean().optional(),enable_apis_section:t.z.boolean().optional(),enable_client_connections:t.z.boolean().optional(),enable_custom_domain_in_emails:t.z.boolean().optional(),enable_dynamic_client_registration:t.z.boolean().optional(),enable_idtoken_api2:t.z.boolean().optional(),enable_legacy_logs_search_v2:t.z.boolean().optional(),enable_legacy_profile:t.z.boolean().optional(),enable_pipeline2:t.z.boolean().optional(),enable_public_signup_user_exists_error:t.z.boolean().optional(),use_scope_descriptions_for_consent:t.z.boolean().optional(),disable_management_api_sms_obfuscation:t.z.boolean().optional(),enable_adfs_waad_email_verification:t.z.boolean().optional(),revoke_refresh_token_grant:t.z.boolean().optional(),dashboard_log_streams_next:t.z.boolean().optional(),dashboard_insights_view:t.z.boolean().optional(),disable_fields_map_fix:t.z.boolean().optional(),mfa_show_factor_list_on_enrollment:t.z.boolean().optional()}).optional(),friendly_name:t.z.string().optional(),picture_url:t.z.string().optional(),support_email:t.z.string().optional(),support_url:t.z.string().optional(),sandbox_version:t.z.string().optional(),sandbox_versions_available:t.z.array(t.z.string()).optional(),change_password:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),guardian_mfa_page:t.z.object({enabled:t.z.boolean(),html:t.z.string()}).optional(),default_audience:t.z.string().optional(),default_organization:t.z.string().optional(),sessions:t.z.object({oidc_logout_prompt_enabled:t.z.boolean().optional()}).optional()}),Ci=t.z.object({date:t.z.string().openapi({description:"Date these events occurred in ISO 8601 format",example:"2025-12-19"}),logins:t.z.number().openapi({description:"Number of logins on this date",example:150}),signups:t.z.number().openapi({description:"Number of signups on this date",example:25}),leaked_passwords:t.z.number().openapi({description:"Number of breached-password detections on this date (subscription required)",example:0}),updated_at:t.z.string().openapi({description:"Date and time this stats entry was last updated in ISO 8601 format",example:"2025-12-19T10:30:00.000Z"}),created_at:t.z.string().openapi({description:"Approximate date and time the first event occurred in ISO 8601 format",example:"2025-12-19T00:00:00.000Z"})}),Ni=t.z.number().openapi({description:"Number of active users in the last 30 days",example:1234});e.Auth0ActionEnum=s,e.Auth0Client=Nt,e.AuthorizationResponseMode=Y,e.AuthorizationResponseType=X,e.CodeChallengeMethod=J,e.ComponentCategory=R,e.ComponentType=k,e.EmailActionEnum=r,e.FlowActionTypeEnum=n,e.GrantType=Pt,e.LocationInfo=Tt,e.LogTypes=It,e.LoginSessionState=wt,e.NodeType=Z,e.RedirectTargetEnum=u,e.actionNodeSchema=z,e.activeUsersResponseSchema=Ni,e.addressSchema=y,e.auth0FlowInsertSchema=V,e.auth0FlowSchema=K,e.auth0QuerySchema=p,e.auth0UpdateUserActionSchema=a,e.auth0UserResponseSchema=w,e.authParamsSchema=Q,e.baseUserSchema=E,e.blockComponentSchema=Be,e.bordersSchema=Zt,e.brandingSchema=ee,e.buttonComponentSchema=j,e.clientGrantInsertSchema=I,e.clientGrantListSchema=N,e.clientGrantSchema=C,e.clientInsertSchema=A,e.clientSchema=S,e.codeInsertSchema=ce,e.codeSchema=ue,e.codeTypeSchema=ae,e.colorsSchema=$t,e.componentMessageSchema=nt,e.componentSchema=M,e.connectionInsertSchema=ie,e.connectionOptionsSchema=te,e.connectionSchema=ne,e.coordinatesSchema=T,e.createPassthroughAdapter=function(e){const{primary:t,secondaries:i,syncMethods:n=["create","update","remove","delete","set"]}=e,s={get(e,t){if("symbol"==typeof t)return e[t];const s=e[t];return"function"!=typeof s?s:n.includes(t)?async(...n)=>{const r=await s.apply(e,n),o=[];for(const e of i){const i=e.adapter[t];if("function"!=typeof i)continue;const s=(async()=>{try{await i.apply(e.adapter,n)}catch(i){try{e.onError?e.onError(i,t,n):console.error(`Passthrough adapter: secondary write failed for ${t}:`,i)}catch(e){console.error(`Passthrough adapter: onError handler threw for ${t}:`,e)}}})();e.blocking&&o.push(s)}return o.length>0&&await Promise.all(o),r}:s.bind(e)}};return new Proxy(t,s)},e.createWriteOnlyAdapter=function(e){return e},e.customDomainInsertSchema=de,e.customDomainSchema=he,e.customDomainWithTenantIdSchema=_e,e.dailyStatsSchema=Ci,e.emailProviderSchema=Vt,e.emailVerificationRulesSchema=o,e.emailVerifyActionSchema=c,e.endingSchema=W,e.fieldComponentSchema=We,e.flowActionStepSchema=l,e.flowInsertSchema=h,e.flowSchema=_,e.flowsFieldComponentSchema=U,e.flowsFlowNodeSchema=H,e.flowsStepNodeSchema=$,e.fontDetailsSchema=Ht,e.fontsSchema=zt,e.formControlSchema=Ve,e.formInsertSchema=tt,e.formNodeComponentDefinition=Ke,e.formNodeSchema=et,e.formSchema=it,e.genericComponentSchema=P,e.genericNodeSchema=G,e.hookInsertSchema=lt,e.hookSchema=pt,e.identitySchema=g,e.inviteInsertSchema=gt,e.inviteSchema=yt,e.inviteeSchema=mt,e.inviterSchema=ft,e.isBlockComponent=function(e){return"BLOCK"===e.category},e.isFieldComponent=function(e){return"FIELD"===e.category},e.isWidgetComponent=function(e){return"WIDGET"===e.category},e.jwksKeySchema=vt,e.jwksSchema=Et,e.legacyClientSchema=oe,e.legalComponentSchema=F,e.logInsertSchema=xt,e.logSchema=kt,e.loginSessionInsertSchema=At,e.loginSessionSchema=St,e.loginSessionStateSchema=Ot,e.nodeSchema=B,e.openIDConfigurationSchema=bt,e.organizationBrandingSchema=Ei,e.organizationEnabledConnectionSchema=vi,e.organizationInsertSchema=wi,e.organizationSchema=Oi,e.organizationTokenQuotaSchema=bi,e.pageBackgroundSchema=Gt,e.parseUserId=function(e){const[t,i]=e.split("|");if(!t||!i)throw new Error(`Invalid user_id: ${e}`);return{connection:t,id:i}},e.passwordInsertSchema=Rt,e.passwordSchema=Dt,e.profileDataSchema=m,e.promptSettingSchema=Kt,e.redirectActionSchema=d,e.refreshTokenInsertSchema=Xt,e.refreshTokenSchema=Yt,e.resourceServerInsertSchema=ii,e.resourceServerListSchema=si,e.resourceServerOptionsSchema=ti,e.resourceServerSchema=ni,e.resourceServerScopeSchema=ei,e.richTextComponentSchema=L,e.roleInsertSchema=mi,e.roleListSchema=yi,e.rolePermissionInsertSchema=ri,e.rolePermissionListSchema=ai,e.rolePermissionSchema=oi,e.roleSchema=gi,e.screenLinkSchema=st,e.sessionInsertSchema=jt,e.sessionSchema=Ft,e.signingKeySchema=Ut,e.smsProviderSchema=Qt,e.smsSendParamsSchema=Jt,e.startSchema=q,e.tenantInsertSchema=se,e.tenantSchema=re,e.tenantSettingsSchema=Ii,e.themeInsertSchema=qt,e.themeSchema=Wt,e.tokenResponseSchema=Mt,e.totalsSchema=f,e.uiScreenSchema=rt,e.userInsertSchema=v,e.userOrganizationInsertSchema=Ai,e.userOrganizationSchema=Si,e.userPermissionInsertSchema=ci,e.userPermissionListSchema=di,e.userPermissionSchema=ui,e.userPermissionWithDetailsListSchema=hi,e.userPermissionWithDetailsSchema=li,e.userResponseSchema=O,e.userRoleInsertSchema=_i,e.userRoleListSchema=fi,e.userRoleSchema=pi,e.userSchema=b,e.verificationMethodsSchema=le,e.widgetComponentSchema=qe,e.widgetSchema=Bt}(t)),t),mn=fn.isBlockComponent,gn=fn.isFieldComponent,yn=fn.isWidgetComponent;export{mn as isBlockComponent,gn as isFieldComponent,yn as isWidgetComponent}
|