iom-sdk 0.1.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.
@@ -0,0 +1,2 @@
1
+ import*as e from"https";import t from"axios";var a;!function(e){e.IS_PARENT_OF="IS_PARENT_OF",e.IS_CHILD_OF="IS_CHILD_OF",e.IS_INPUT_OF="IS_INPUT_OF",e.IS_OUTPUT_OF="IS_OUTPUT_OF",e.IS_SOURCE_TEMPLATE_OF="IS_SOURCE_TEMPLATE_OF",e.IS_TEMPLATE_INSTANCE_OF="IS_TEMPLATE_INSTANCE_OF",e.IS_PROPERTY_OF="IS_PROPERTY_OF",e.HAS_PROPERTY="HAS_PROPERTY",e.IS_VALUE_OF="IS_VALUE_OF",e.HAS_VALUE="HAS_VALUE",e.IS_FILE_OF="IS_FILE_OF",e.HAS_FILE="HAS_FILE",e.HAS_ADDRESS="HAS_ADDRESS",e.IS_ADDRESS_OF="IS_ADDRESS_OF"}(a||(a={}));var s=Object.freeze({__proto__:null,get Predicate(){return a}});function r(e,t,a,s){return new(a||(a=Promise))((function(r,i){function n(e){try{d(s.next(e))}catch(e){i(e)}}function o(e){try{d(s.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(n,o)}d((s=s.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;let i={enabled:!1,logLevel:"error",logToConsole:!0,logCallback:null};const n=e=>{var t,a,s;e&&(i={enabled:null!==(t=e.enabled)&&void 0!==t?t:i.enabled,logLevel:"info"===e.logLevel?"info":"error",logToConsole:null!==(a=e.logToConsole)&&void 0!==a?a:i.logToConsole,logCallback:null!==(s=e.logCallback)&&void 0!==s?s:i.logCallback})},o=(e,t,a)=>{if(!i.enabled)return;if("error"===i.logLevel&&"error"!==e)return;const s=`[IoM Client] ${t}`;i.logToConsole&&("error"===e?console.error(s,a||""):console.log(s,a||"")),i.logCallback&&i.logCallback(s,a)},d=(e,t,a,s)=>{if(!i.enabled)return;o("info",a?`${e} ${t} (${a})`:`${e} ${t}`,s)},u=(e,t)=>{i.enabled&&o("error",`Error in ${e}`,t)},c=a=>{a.debug&&n(a.debug);const s={withCredentials:!0,baseURL:a.baseUrl,timeout:a.timeout||3e4,headers:Object.assign({"Content-Type":"application/json",Accept:"application/json"},a.headers)};a.certificate&&(s.httpsAgent=new e.Agent({cert:a.certificate.cert,key:a.certificate.key,rejectUnauthorized:!0}));const i=t.create(s),o=e=>{var t;return e.response?{status:e.response.status,statusText:e.response.statusText,message:(null===(t=e.response.data)||void 0===t?void 0:t.message)||"Server error",details:e.response.data}:e.request?{status:0,statusText:"No Response",message:"No response received from server",details:e.request}:{status:0,statusText:"Request Error",message:e.message||"Error making request",details:e}};return{get:(e,t)=>r(void 0,void 0,void 0,(function*(){try{d("GET",e);const a=yield i.get(e,{params:t});return d("GET",e,a.status),{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(t){throw u(`GET ${e}`,t),o(t)}})),getBinary:e=>r(void 0,void 0,void 0,(function*(){try{d("GET",e);const t=yield i.get(e,{responseType:"arraybuffer"});return d("GET",e,t.status),{data:t.data,status:t.status,statusText:t.statusText,headers:t.headers}}catch(t){throw u(`GET ${e} (binary)`,t),o(t)}})),post:(e,t,a)=>r(void 0,void 0,void 0,(function*(){try{d("POST",e);const s=yield i.post(e,t,a);return d("POST",e,s.status),{data:s.data,status:s.status,statusText:s.statusText,headers:s.headers}}catch(t){throw u(`POST ${e}`,t),o(t)}})),postForm:(e,t)=>r(void 0,void 0,void 0,(function*(){try{d("POST",e);const a=yield i.post(e,t,{timeout:12e4,headers:{"Content-Type":"multipart/form-data"}});return d("POST",e,a.status),{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(t){throw u(`POST ${e} (form)`,t),o(t)}})),put:(e,t)=>r(void 0,void 0,void 0,(function*(){try{d("PUT",e);const a=yield i.put(e,t);return d("PUT",e,a.status),{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(t){throw u(`PUT ${e}`,t),o(t)}})),delete:(e,t)=>r(void 0,void 0,void 0,(function*(){try{d("DELETE",e);const a=yield i.delete(e,t?{data:t}:void 0);return d("DELETE",e,a.status),{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(t){throw u(`DELETE ${e}`,t),o(t)}})),config:a}};let l=c({baseUrl:""});const h=e=>{l=c(e)};var p,f;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},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 a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&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}(p||(p={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(f||(f={}));const m=p.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),v=e=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(e)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(e)?m.array:null===e?m.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?m.promise:"undefined"!=typeof Map&&e instanceof Map?m.map:"undefined"!=typeof Set&&e instanceof Set?m.set:"undefined"!=typeof Date&&e instanceof Date?m.date:m.object;default:return m.unknown}},g=p.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 y 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},a={_errors:[]},s=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(s);else if("invalid_return_type"===r.code)s(r.returnTypeError);else if("invalid_arguments"===r.code)s(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,s=0;for(;s<r.path.length;){const a=r.path[s];s===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],s++}}};return s(this),a}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,p.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let a;switch(e.code){case g.invalid_type:a=e.received===m.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case g.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,p.jsonStringifyReplacer)}`;break;case g.unrecognized_keys:a=`Unrecognized key(s) in object: ${p.joinValues(e.keys,", ")}`;break;case g.invalid_union:a="Invalid input";break;case g.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${p.joinValues(e.options)}`;break;case g.invalid_enum_value:a=`Invalid enum value. Expected ${p.joinValues(e.options)}, received '${e.received}'`;break;case g.invalid_arguments:a="Invalid function arguments";break;case g.invalid_return_type:a="Invalid function return type";break;case g.invalid_date:a="Invalid date";break;case g.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:p.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case g.too_small:a="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?`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 g.too_big:a="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 g.custom:a="Invalid input";break;case g.invalid_intersection_types:a="Intersection results could not be merged";break;case g.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case g.not_finite:a="Number must be finite";break;default:a=t.defaultError,p.assertNever(e)}return{message:a}};let b=_;function x(){return b}const k=e=>{const{data:t,path:a,errorMaps:s,issueData:r}=e,i=[...a,...r.path||[]],n={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let o="";const d=s.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(n,{data:t,defaultError:o}).message;return{...r,path:i,message:o}};function w(e,t){const a=x(),s=k({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===_?void 0:_].filter((e=>!!e))});e.common.issues.push(s)}class T{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return j;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,s=await e.value;a.push({key:t,value:s})}return T.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:r}=s;if("aborted"===t.status)return j;if("aborted"===r.status)return j;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!s.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const j=Object.freeze({status:"aborted"}),O=e=>({status:"dirty",value:e}),E=e=>({status:"valid",value:e}),A=e=>"aborted"===e.status,S=e=>"dirty"===e.status,I=e=>"valid"===e.status,Z=e=>"undefined"!=typeof Promise&&e instanceof Promise;function U(e,t,a,s){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function P(e,t,a,s,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,a),a}var C,F,R;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(C||(C={}));class N{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const D=(e,t)=>{if(I(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 y(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:r}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var i,n;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!==(i=null!=o?o:s)&&void 0!==i?i:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!==(n=null!=o?o:a)&&void 0!==n?n:r.defaultError}},description:r}}class L{get description(){return this._def.description}_getType(e){return v(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Z(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 a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const s={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},r=this._parseSync({data:e,path:s.path,parent:s});return D(s,r)}"~validate"(e){var t,a;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:s});return I(t)?{value:t.value}:{issues:s.common.issues}}catch(e){(null===(a=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===a?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then((e=>I(e)?{value:e.value}:{issues:s.common.issues}))}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},s=this._parse({data:e,path:a.path,parent:a}),r=await(Z(s)?s:Promise.resolve(s));return D(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,s)=>{const r=e(t),i=()=>s.addIssue({code:g.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(i(),!1))):!!r||(i(),!1)}))}refinement(e,t){return this._refinement(((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1)))}_refinement(e){return new Le({schema:this,typeName:Qe.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 Me.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xe.create(this)}promise(){return $e.create(this,this._def)}or(e){return Te.create([this,e],this._def)}and(e){return Ae.create(this,e,this._def)}transform(e){return new Le({...$(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ve({...$(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new Ke({typeName:Qe.ZodBranded,type:this,...$(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Be({...$(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return We.create(this,e)}readonly(){return Ye.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const M=/^c[^\s-]{8,}$/i,z=/^[0-9a-z]+$/,V=/^[0-9A-HJKMNP-TV-Z]{26}$/i,B=/^[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,H=/^[a-z0-9_-]{21}$/i,q=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K=/^[-+]?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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Y;const G=/^(?:(?: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])$/,J=/^(?:(?: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])$/,X=/^(([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]))$/,Q=/^(([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])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ae="((\\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])))",se=new RegExp(`^${ae}$`);function re(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function ie(e){let t=`${ae}T${re(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function ne(e,t){if(!q.test(e))return!1;try{const[a]=e.split("."),s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(s));return"object"==typeof r&&null!==r&&(!(!r.typ||!r.alg)&&(!t||r.alg===t))}catch(e){return!1}}function oe(e,t){return!("v4"!==t&&t||!J.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==m.string){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.string,received:t.parsedType}),j}const t=new T;let a;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const s=e.data.length>i.value,r=e.data.length<i.value;(s||r)&&(a=this._getOrReturnCtx(e,a),s?w(a,{code:g.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&w(a,{code:g.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)W.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"email",code:g.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Y||(Y=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Y.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"emoji",code:g.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)B.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"uuid",code:g.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)H.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"nanoid",code:g.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)M.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid",code:g.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)z.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cuid2",code:g.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)V.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"ulid",code:g.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(s){a=this._getOrReturnCtx(e,a),w(a,{validation:"url",code:g.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"regex",code:g.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){ie(i).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){se.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){new RegExp(`^${re(i)}$`).test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{code:g.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?K.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"duration",code:g.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(s=e.data,("v4"!==(r=i.version)&&r||!G.test(s))&&("v6"!==r&&r||!X.test(s))&&(a=this._getOrReturnCtx(e,a),w(a,{validation:"ip",code:g.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?ne(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"jwt",code:g.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?oe(e.data,i.version)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"cidr",code:g.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?ee.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"base64",code:g.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?te.test(e.data)||(a=this._getOrReturnCtx(e,a),w(a,{validation:"base64url",code:g.invalid_string,message:i.message}),t.dirty()):p.assertNever(i);var s,r;return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement((t=>e.test(t)),{validation:t,code:g.invalid_string,...C.errToObj(a)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...C.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...C.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...C.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...C.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(a=null==e?void 0:e.local)&&void 0!==a&&a,...C.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...C.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...C.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...C.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errToObj(t)})}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...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 ue(e,t){const a=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,r=a>s?a:s;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class ce extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==m.number){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.number,received:t.parsedType}),j}let t;const a=new T;for(const s of this._def.checks)if("int"===s.kind)p.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:g.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty());else if("min"===s.kind){(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty())}else if("max"===s.kind){(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty())}else"multipleOf"===s.kind?0!==ue(e.data,s.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_finite,message:s.message}),a.dirty()):p.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,a,s){return new ce({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:C.toString(s)}]})}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.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&&p.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ce.create=e=>new ce({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class le extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let t;const a=new T;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty())}else if("max"===s.kind){(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty())}else"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):p.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,a,s){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:C.toString(s)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.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}}le.create=e=>{var t;return new le({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class he extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==m.boolean){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.boolean,received:t.parsedType}),j}return E(e.data)}}he.create=e=>new he({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class pe extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==m.date){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.date,received:t.parsedType}),j}if(isNaN(e.data.getTime())){return w(this._getOrReturnCtx(e),{code:g.invalid_date}),j}const t=new T;let a;for(const s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:g.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),w(a,{code:g.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):p.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.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}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...$(e)});class fe extends L{_parse(e){if(this._getType(e)!==m.symbol){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.symbol,received:t.parsedType}),j}return E(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodSymbol,...$(e)});class me extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.undefined,received:t.parsedType}),j}return E(e.data)}}me.create=e=>new me({typeName:Qe.ZodUndefined,...$(e)});class ve extends L{_parse(e){if(this._getType(e)!==m.null){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.null,received:t.parsedType}),j}return E(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodNull,...$(e)});class ge extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodAny,...$(e)});class ye extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodUnknown,...$(e)});class _e extends L{_parse(e){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.never,received:t.parsedType}),j}}_e.create=e=>new _e({typeName:Qe.ZodNever,...$(e)});class be extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.void,received:t.parsedType}),j}return E(e.data)}}be.create=e=>new be({typeName:Qe.ZodVoid,...$(e)});class xe extends L{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return w(t,{code:g.invalid_type,expected:m.array,received:t.parsedType}),j;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,r=t.data.length<s.exactLength.value;(e||r)&&(w(t,{code:e?g.too_big:g.too_small,minimum:r?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),a.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(w(t,{code:g.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),a.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(w(t,{code:g.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>s.type._parseAsync(new N(t,e,t.path,a))))).then((e=>T.mergeArray(a,e)));const r=[...t.data].map(((e,a)=>s.type._parseSync(new N(t,e,t.path,a))));return T.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new xe({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new xe({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new xe({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}}function ke(e){if(e instanceof we){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=Me.create(ke(s))}return new we({...e._def,shape:()=>t})}return e instanceof xe?new xe({...e._def,type:ke(e.element)}):e instanceof Me?Me.create(ke(e.unwrap())):e instanceof ze?ze.create(ke(e.unwrap())):e instanceof Se?Se.create(e.items.map((e=>ke(e)))):e}xe.create=(e,t)=>new xe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...$(t)});class we extends L{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=p.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.object,received:t.parsedType}),j}const{status:t,ctx:a}=this._processInputParams(e),{shape:s,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof _e&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||i.push(e);const n=[];for(const e of r){const t=s[e],r=a.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new N(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof _e){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)i.length>0&&(w(a,{code:g.unrecognized_keys,keys:i}),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 i){const s=a.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new N(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of n){const a=await t.key,s=await t.value;e.push({key:a,value:s,alwaysSet:t.alwaysSet})}return e})).then((e=>T.mergeObjectSync(t,e))):T.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new we({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var s,r,i,n;const o=null!==(i=null===(r=(s=this._def).errorMap)||void 0===r?void 0:r.call(s,t,a).message)&&void 0!==i?i:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(n=C.errToObj(e).message)&&void 0!==n?n:o}:{message:o}}}:{}})}strip(){return new we({...this._def,unknownKeys:"strip"})}passthrough(){return new we({...this._def,unknownKeys:"passthrough"})}extend(e){return new we({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new we({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new we({...this._def,catchall:e})}pick(e){const t={};return p.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new we({...this._def,shape:()=>t})}omit(e){const t={};return p.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new we({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){const t={};return p.objectKeys(this.shape).forEach((a=>{const s=this.shape[a];e&&!e[a]?t[a]=s:t[a]=s.optional()})),new we({...this._def,shape:()=>t})}required(e){const t={};return p.objectKeys(this.shape).forEach((a=>{if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Me;)e=e._def.innerType;t[a]=e}})),new we({...this._def,shape:()=>t})}keyof(){return Re(p.objectKeys(this.shape))}}we.create=(e,t)=>new we({shape:()=>e,unknownKeys:"strip",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)}),we.strictCreate=(e,t)=>new we({shape:()=>e,unknownKeys:"strict",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)}),we.lazycreate=(e,t)=>new we({shape:e,unknownKeys:"strip",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)});class Te extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new y(e.ctx.common.issues)));return w(t,{code:g.invalid_union,unionErrors:a}),j}));{let e;const s=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=s.map((e=>new y(e)));return w(t,{code:g.invalid_union,unionErrors:r}),j}}get options(){return this._def.options}}Te.create=(e,t)=>new Te({options:e,typeName:Qe.ZodUnion,...$(t)});const je=e=>e instanceof Ce?je(e.schema):e instanceof Le?je(e.innerType()):e instanceof Fe?[e.value]:e instanceof Ne?e.options:e instanceof De?p.objectValues(e.enum):e instanceof Ve?je(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof Me?[void 0,...je(e.unwrap())]:e instanceof ze?[null,...je(e.unwrap())]:e instanceof Ke||e instanceof Ye?je(e.unwrap()):e instanceof Be?je(e._def.innerType):[];class Oe extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return w(t,{code:g.invalid_type,expected:m.object,received:t.parsedType}),j;const a=this.discriminator,s=t.data[a],r=this.optionsMap.get(s);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(w(t,{code:g.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=je(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(s.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);s.set(r,a)}}return new Oe({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...$(a)})}}function Ee(e,t){const a=v(e),s=v(t);if(e===t)return{valid:!0,data:e};if(a===m.object&&s===m.object){const a=p.objectKeys(t),s=p.objectKeys(e).filter((e=>-1!==a.indexOf(e))),r={...e,...t};for(const a of s){const s=Ee(e[a],t[a]);if(!s.valid)return{valid:!1};r[a]=s.data}return{valid:!0,data:r}}if(a===m.array&&s===m.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let s=0;s<e.length;s++){const r=Ee(e[s],t[s]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===m.date&&s===m.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ae extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=(e,s)=>{if(A(e)||A(s))return j;const r=Ee(e.value,s.value);return r.valid?((S(e)||S(s))&&t.dirty(),{status:t.value,value:r.data}):(w(a,{code:g.invalid_intersection_types}),j)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>s(e,t))):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}Ae.create=(e,t,a)=>new Ae({left:e,right:t,typeName:Qe.ZodIntersection,...$(a)});class Se extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.array)return w(a,{code:g.invalid_type,expected:m.array,received:a.parsedType}),j;if(a.data.length<this._def.items.length)return w(a,{code:g.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&a.data.length>this._def.items.length&&(w(a,{code:g.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new N(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(s).then((e=>T.mergeArray(t,e))):T.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Se({...this._def,rest:e})}}Se.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se({items:e,typeName:Qe.ZodTuple,rest:null,...$(t)})};class Ie extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.object)return w(a,{code:g.invalid_type,expected:m.object,received:a.parsedType}),j;const s=[],r=this._def.keyType,i=this._def.valueType;for(const e in a.data)s.push({key:r._parse(new N(a,e,a.path,e)),value:i._parse(new N(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?T.mergeObjectAsync(t,s):T.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,a){return new Ie(t instanceof L?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...$(a)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...$(t)})}}class Ze extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.map)return w(a,{code:g.invalid_type,expected:m.map,received:a.parsedType}),j;const s=this._def.keyType,r=this._def.valueType,i=[...a.data.entries()].map((([e,t],i)=>({key:s._parse(new N(a,e,a.path,[i,"key"])),value:r._parse(new N(a,t,a.path,[i,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of i){const s=await a.key,r=await a.value;if("aborted"===s.status||"aborted"===r.status)return j;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of i){const s=a.key,r=a.value;if("aborted"===s.status||"aborted"===r.status)return j;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}}}Ze.create=(e,t,a)=>new Ze({valueType:t,keyType:e,typeName:Qe.ZodMap,...$(a)});class Ue extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.set)return w(a,{code:g.invalid_type,expected:m.set,received:a.parsedType}),j;const s=this._def;null!==s.minSize&&a.data.size<s.minSize.value&&(w(a,{code:g.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&a.data.size>s.maxSize.value&&(w(a,{code:g.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const a=new Set;for(const s of e){if("aborted"===s.status)return j;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const n=[...a.data.values()].map(((e,t)=>r._parse(new N(a,e,a.path,t))));return a.common.async?Promise.all(n).then((e=>i(e))):i(n)}min(e,t){return new Ue({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new Ue({...this._def,maxSize:{value:e,message:C.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ue.create=(e,t)=>new Ue({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...$(t)});class Pe extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return w(t,{code:g.invalid_type,expected:m.function,received:t.parsedType}),j;function a(e,a){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:g.invalid_arguments,argumentsError:a}})}function s(e,a){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,x(),_].filter((e=>!!e)),issueData:{code:g.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof $e){const e=this;return E((async function(...t){const n=new y([]),o=await e._def.args.parseAsync(t,r).catch((e=>{throw n.addIssue(a(t,e)),n})),d=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(d,r).catch((e=>{throw n.addIssue(s(d,e)),n}))}))}{const e=this;return E((function(...t){const n=e._def.args.safeParse(t,r);if(!n.success)throw new y([a(t,n.error)]);const o=Reflect.apply(i,this,n.data),d=e._def.returns.safeParse(o,r);if(!d.success)throw new y([s(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pe({...this._def,args:Se.create(e).rest(ye.create())})}returns(e){return new Pe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new Pe({args:e||Se.create([]).rest(ye.create()),returns:t||ye.create(),typeName:Qe.ZodFunction,...$(a)})}}class Ce extends L{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})}}Ce.create=(e,t)=>new Ce({getter:e,typeName:Qe.ZodLazy,...$(t)});class Fe extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return w(t,{received:t.data,code:g.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Re(e,t){return new Ne({values:e,typeName:Qe.ZodEnum,...$(t)})}Fe.create=(e,t)=>new Fe({value:e,typeName:Qe.ZodLiteral,...$(t)});class Ne extends L{constructor(){super(...arguments),F.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return w(t,{expected:p.joinValues(a),received:t.parsedType,code:g.invalid_type}),j}if(U(this,F)||P(this,F,new Set(this._def.values)),!U(this,F).has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return w(t,{received:t.data,code:g.invalid_enum_value,options:a}),j}return E(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 Ne.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ne.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}F=new WeakMap,Ne.create=Re;class De extends L{constructor(){super(...arguments),R.set(this,void 0)}_parse(e){const t=p.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==m.string&&a.parsedType!==m.number){const e=p.objectValues(t);return w(a,{expected:p.joinValues(e),received:a.parsedType,code:g.invalid_type}),j}if(U(this,R)||P(this,R,new Set(p.getValidEnumValues(this._def.values))),!U(this,R).has(e.data)){const e=p.objectValues(t);return w(a,{received:a.data,code:g.invalid_enum_value,options:e}),j}return E(e.data)}get enum(){return this._def.values}}R=new WeakMap,De.create=(e,t)=>new De({values:e,typeName:Qe.ZodNativeEnum,...$(t)});class $e extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&!1===t.common.async)return w(t,{code:g.invalid_type,expected:m.promise,received:t.parsedType}),j;const a=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return E(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}$e.create=(e,t)=>new $e({type:e,typeName:Qe.ZodPromise,...$(t)});class Le extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:e=>{w(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===s.type){const e=s.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return j;const s=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===s.status?j:"dirty"===s.status||"dirty"===t.value?O(s.value):s}));{if("aborted"===t.value)return j;const s=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===s.status?j:"dirty"===s.status||"dirty"===t.value?O(s.value):s}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,r);if(a.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===a.common.async){const s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===s.status?j:("dirty"===s.status&&t.dirty(),e(s.value),{status:t.value,value:s.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((a=>"aborted"===a.status?j:("dirty"===a.status&&t.dirty(),e(a.value).then((()=>({status:t.value,value:a.value}))))))}if("transform"===s.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!I(e))return e;const i=s.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>I(e)?Promise.resolve(s.transform(e.value,r)).then((e=>({status:t.value,value:e}))):e))}p.assertNever(s)}}Le.create=(e,t,a)=>new Le({schema:e,typeName:Qe.ZodEffects,effect:t,...$(a)}),Le.createWithPreprocess=(e,t,a)=>new Le({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...$(a)});class Me extends L{_parse(e){return this._getType(e)===m.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Me.create=(e,t)=>new Me({innerType:e,typeName:Qe.ZodOptional,...$(t)});class ze extends L{_parse(e){return this._getType(e)===m.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodNullable,...$(t)});class Ve extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===m.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class Be extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Z(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new y(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Be.create=(e,t)=>new Be({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class He extends L{_parse(e){if(this._getType(e)!==m.nan){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.nan,received:t.parsedType}),j}return{status:"valid",value:e.data}}}He.create=e=>new He({typeName:Qe.ZodNaN,...$(e)});const qe=Symbol("zod_brand");class Ke extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class We extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?j:"dirty"===e.status?(t.dirty(),O(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?j:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new We({in:e,out:t,typeName:Qe.ZodPipeline})}}class Ye extends L{_parse(e){const t=this._def.innerType._parse(e),a=e=>(I(e)&&(e.value=Object.freeze(e.value)),e);return Z(t)?t.then((e=>a(e))):a(t)}unwrap(){return this._def.innerType}}function Ge(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function Je(e,t={},a){return e?ge.create().superRefine(((s,r)=>{var i,n;const o=e(s);if(o instanceof Promise)return o.then((e=>{var i,n;if(!e){const e=Ge(t,s),o=null===(n=null!==(i=e.fatal)&&void 0!==i?i:a)||void 0===n||n;r.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=Ge(t,s),o=null===(n=null!==(i=e.fatal)&&void 0!==i?i:a)||void 0===n||n;r.addIssue({code:"custom",...e,fatal:o})}})):ge.create()}Ye.create=(e,t)=>new Ye({innerType:e,typeName:Qe.ZodReadonly,...$(t)});const Xe={object:we.lazycreate};var Qe;!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"}(Qe||(Qe={}));const et=de.create,tt=ce.create,at=He.create,st=le.create,rt=he.create,it=pe.create,nt=fe.create,ot=me.create,dt=ve.create,ut=ge.create,ct=ye.create,lt=_e.create,ht=be.create,pt=xe.create,ft=we.create,mt=we.strictCreate,vt=Te.create,gt=Oe.create,yt=Ae.create,_t=Se.create,bt=Ie.create,xt=Ze.create,kt=Ue.create,wt=Pe.create,Tt=Ce.create,jt=Fe.create,Ot=Ne.create,Et=De.create,At=$e.create,St=Le.create,It=Me.create,Zt=ze.create,Ut=Le.createWithPreprocess,Pt=We.create,Ct={string:e=>de.create({...e,coerce:!0}),number:e=>ce.create({...e,coerce:!0}),boolean:e=>he.create({...e,coerce:!0}),bigint:e=>le.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},Ft=j;var Rt=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:function(e){b=e},getErrorMap:x,makeIssue:k,EMPTY_PATH:[],addIssueToContext:w,ParseStatus:T,INVALID:j,DIRTY:O,OK:E,isAborted:A,isDirty:S,isValid:I,isAsync:Z,get util(){return p},get objectUtil(){return f},ZodParsedType:m,getParsedType:v,ZodType:L,datetimeRegex:ie,ZodString:de,ZodNumber:ce,ZodBigInt:le,ZodBoolean:he,ZodDate:pe,ZodSymbol:fe,ZodUndefined:me,ZodNull:ve,ZodAny:ge,ZodUnknown:ye,ZodNever:_e,ZodVoid:be,ZodArray:xe,ZodObject:we,ZodUnion:Te,ZodDiscriminatedUnion:Oe,ZodIntersection:Ae,ZodTuple:Se,ZodRecord:Ie,ZodMap:Ze,ZodSet:Ue,ZodFunction:Pe,ZodLazy:Ce,ZodLiteral:Fe,ZodEnum:Ne,ZodNativeEnum:De,ZodPromise:$e,ZodEffects:Le,ZodTransformer:Le,ZodOptional:Me,ZodNullable:ze,ZodDefault:Ve,ZodCatch:Be,ZodNaN:He,BRAND:qe,ZodBranded:Ke,ZodPipeline:We,ZodReadonly:Ye,custom:Je,Schema:L,ZodSchema:L,late:Xe,get ZodFirstPartyTypeKind(){return Qe},coerce:Ct,any:ut,array:pt,bigint:st,boolean:rt,date:it,discriminatedUnion:gt,effect:St,enum:Ot,function:wt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Je((t=>t instanceof e),t),intersection:yt,lazy:Tt,literal:jt,map:xt,nan:at,nativeEnum:Et,never:lt,null:dt,nullable:Zt,number:tt,object:ft,oboolean:()=>rt().optional(),onumber:()=>tt().optional(),optional:It,ostring:()=>et().optional(),pipeline:Pt,preprocess:Ut,promise:At,record:bt,set:kt,strictObject:mt,string:et,symbol:nt,transformer:St,tuple:_t,undefined:ot,union:vt,unknown:ct,void:ht,NEVER:Ft,ZodIssueCode:g,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});class Nt extends Error{constructor(e){super("Validation Error"),this.name="ValidationError",this.errors=Dt(e)}}function Dt(e){const t={};for(const a of e.errors){const e=a.path.join(".")||"general";t[e]||(t[e]=[]),t[e].push(a.message)}return t}function $t(e,t){try{return e.parse(t)}catch(e){if(e instanceof Rt.ZodError){const t=new Nt(e);throw u("validation",{errors:t.errors}),t}throw e}}function Lt(e,t){const a=e.safeParse(t);if(a.success)return{success:!0,data:a.data};const s=Dt(a.error);return u("validation",{errors:s}),{success:!1,errors:s}}const Mt=e=>{if(!e)return;const t={uuid:e.uuid?$t(Rt.string().uuid(),e.uuid):void 0,softDeleted:$t(Rt.boolean().optional(),e.softDeleted)};return Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t)))},zt=e=>{if(!e)return;const t={subject:e.subject?$t(Rt.string().uuid(),e.subject):void 0,predicate:e.predicate?$t(Rt.nativeEnum(a),e.predicate):void 0,object:e.object?$t(Rt.string().uuid(),e.object):void 0,softDeleted:$t(Rt.boolean().optional(),e.softDeleted)};return Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t)))},Vt=e=>{if(!e)return;const t={page:void 0!==e.page?$t(Rt.number().int().min(0),e.page):void 0,size:void 0!==e.size?$t(Rt.number().int().min(1).max(1e3),e.size):void 0,hasChildrenFull:$t(Rt.boolean().optional(),e.hasChildrenFull),hasHistory:$t(Rt.boolean().optional(),e.hasHistory),hasParentUUIDFilter:$t(Rt.boolean().optional(),e.hasParentUUIDFilter),parentUUID:e.parentUUID?$t(Rt.string().uuid(),e.parentUUID):void 0,searchTerm:$t(Rt.string().optional(),e.searchTerm),searchBy:$t(Rt.record(Rt.any()).optional(),e.searchBy)};return Object.fromEntries(Object.entries(t).filter((([e,t])=>void 0!==t)))},Bt=e=>$t(Rt.string().uuid(),e),Ht=Rt.string().uuid({message:"Invalid UUID format. Must be a valid UUID string."}),qt=Rt.object({uuid:Ht,name:Rt.string().optional(),abbreviation:Rt.string().optional(),version:Rt.string().optional(),description:Rt.string().optional(),isTemplate:Rt.boolean().optional()}),Kt=Rt.object({value:Rt.string().optional()}),Wt=Rt.object({key:Rt.string().optional(),values:Rt.array(Kt).optional()}),Yt=Rt.object({subject:Ht,predicate:Rt.nativeEnum(a,{errorMap:(e,t)=>({message:`Invalid predicate value. Must be one of: ${Object.values(a).join(", ")}`})}),object:Ht,properties:Rt.array(Wt).optional()}),Gt=Rt.object({uuid:Ht,key:Rt.string().min(1,"Property key is required"),version:Rt.string().optional(),label:Rt.string().optional(),description:Rt.string().optional(),type:Rt.string().optional(),inputType:Rt.string().optional(),formula:Rt.string().optional(),inputOrderPosition:Rt.number().optional(),processingOrderPosition:Rt.number().optional(),viewOrderPosition:Rt.number().optional()}),Jt=Rt.object({uuid:Ht,value:Rt.string().optional(),valueTypeCast:Rt.string().optional(),sourceType:Rt.string().optional()}),Xt=Rt.object({uuid:Ht,fileName:Rt.string().optional(),fileReference:Rt.string().min(1,"File reference is required"),label:Rt.string().optional()}),Qt=Rt.object({uuid:Ht,fullAddress:Rt.string().optional(),street:Rt.string().optional(),houseNumber:Rt.string().optional(),city:Rt.string().optional(),postalCode:Rt.string().optional(),country:Rt.string().optional(),state:Rt.string().optional(),district:Rt.string().optional()});Rt.object({subject:Ht.optional(),predicate:Rt.nativeEnum(a).optional(),object:Ht.optional()}).refine((e=>e.subject||e.predicate||e.object),{message:"At least one search parameter (subject, predicate, or object) must be provided"}),Rt.object({object:qt,properties:Rt.array(Rt.object({property:Gt,value:Jt.optional()})),children:Rt.array(qt).optional(),files:Rt.array(Xt).optional()});const ea=Rt.object({file:Rt.object({fileName:Rt.string().min(1,"Filename is required"),fileReference:Rt.string().min(1,"File reference is required"),label:Rt.string().optional()})}),ta=Rt.object({value:Jt.omit({uuid:!0}),files:Rt.array(ea).optional()}),aa=Rt.object({property:Gt.omit({uuid:!0}).extend({key:Rt.string().min(1,"Property key is required")}),values:Rt.array(ta).optional(),files:Rt.array(ea).optional()}),sa=Rt.object({object:qt.omit({uuid:!0}),parents:Rt.array(Ht).optional(),files:Rt.array(ea).optional(),properties:Rt.array(aa).optional(),address:Qt.omit({uuid:!0}).optional()}),ra="/api/UUObject",ia=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Mt(t);return yield e.get(ra,a)}catch(e){throw u("getObjects",e),e}})),na=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(qt,t);return yield e.post(ra,a)}catch(e){throw u("createOrUpdateObject",e),e}})),oa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.delete(`${ra}/${a}`)}catch(e){throw u("softDeleteObject",e),e}})),da="/api/UUStatements",ua=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=zt(t);return yield e.get(da,a)}catch(e){throw u("getStatements",e),e}})),ca=(e=l)=>t=>{const a=$t(Rt.array(Yt),t);return e.post(da,a)},la=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Yt,t),s=yield e.post(da,[a]);return Object.assign(Object.assign({},s),{data:Array.isArray(s.data)&&s.data.length>0?s.data[0]:null})}catch(e){throw u("createStatement",e),e}})),ha=(e=l)=>(t,s,i)=>r(void 0,void 0,void 0,(function*(){try{const r=$t(Rt.string().uuid(),t),n={subject:r,predicate:$t(Rt.nativeEnum(a),s),softDeleted:null==i?void 0:i.softDeleted};return ua(e)(n)}catch(e){throw u("getStatementsByUuidAndPredicate",e),e}})),pa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Yt,t);return yield e.delete(da,a)}catch(e){throw u("softDeleteStatement",e),e}})),fa=(e=l)=>(t,s)=>{const r=$t(Rt.string().uuid(),t);return ha(e)(r,a.IS_PARENT_OF,s)},ma=(e=l)=>(t,s)=>{const r=$t(Rt.string().uuid(),t);return ha(e)(r,a.IS_CHILD_OF,s)},va=(e=l)=>(t,s)=>{const r=$t(Rt.string().uuid(),t);return ha(e)(r,a.HAS_PROPERTY,s)},ga=(e=l)=>(t,s)=>{const r=$t(Rt.string().uuid(),t);return ha(e)(r,a.HAS_VALUE,s)},ya=(e=l)=>(t,s)=>{const r=$t(Rt.string().uuid(),t);return ha(e)(r,a.HAS_FILE,s)};var _a=Object.freeze({__proto__:null,createOrFindStatements:ca,createStatement:la,findChildren:fa,findFiles:ya,findParents:ma,findProperties:va,findPropertyValues:ga,getStatements:ua,getStatementsByUuidAndPredicate:ha,softDeleteStatement:pa});const ba="/api/UUProperty",xa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Mt(t);return yield e.get(ba,a)}catch(e){throw u("getProperties",e),e}})),ka=(e=l)=>(t,a)=>r(void 0,void 0,void 0,(function*(){try{const s=$t(Rt.string().min(1),t),r=yield xa(e)(a);if(!r.data)return Object.assign(Object.assign({},r),{data:null});const i=r.data.find((e=>e.key===s))||null;return Object.assign(Object.assign({},r),{data:i})}catch(e){throw u("getPropertyByKey",e),e}})),wa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Gt,t);return yield e.post(ba,a)}catch(e){throw u("createOrUpdateProperty",e),e}})),Ta=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.delete(`${ba}/${a}`)}catch(e){throw u("softDeleteProperty",e),e}})),ja="/api/UUPropertyValue",Oa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Mt(t);return yield e.get(ja,a)}catch(e){throw u("getPropertyValues",e),e}})),Ea=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Jt,t);return yield e.post(ja,a)}catch(e){throw u("createOrUpdatePropertyValue",e),e}})),Aa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.delete(`${ja}/${a}`)}catch(e){throw u("softDeletePropertyValue",e),e}})),Sa="/api/UUFile",Ia=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Mt(t);return yield e.get(Sa,a)}catch(e){throw u("getFiles",e),e}})),Za=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Xt,t);return yield e.post(Sa,a)}catch(e){throw u("createOrUpdateFile",e),e}})),Ua=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.delete(`${Sa}/${a}`)}catch(e){throw u("softDeleteFile",e),e}})),Pa=(e=l)=>(t,a,s,...i)=>r(void 0,[t,a,s,...i],void 0,(function*(t,a,s,r="file"){try{const i=Bt(t),n=Bt(a),o=globalThis.FormData;if(!o)throw new Error("FormData is not available in this environment. Please provide a global FormData (e.g., Node 18+), or polyfill it.");const d=new o;d.append(r,s);const u=`${Sa}/upload?uuidFile=${i}&uuidToAttach=${n}`;return yield e.postForm(u,d)}catch(e){throw u("uploadFileBinary",e),e}})),Ca=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.getBinary(`${Sa}/download/${a}`)}catch(e){throw u("downloadFileBinary",e),e}})),Fa=(e=l,t)=>{var a;const s=t||(null===(a=e.config)||void 0===a?void 0:a.uuidServiceBaseUrl);if(!s)return e;const r=Object.assign(Object.assign({},e.config),{baseUrl:s});return c(r)},Ra=(e=l,t)=>()=>r(void 0,void 0,void 0,(function*(){try{const a=Fa(e,t),s="/api/UUID/own";return yield a.get(s)}catch(e){throw u("getOwnedUUIDs",e),e}})),Na=(e=l,t)=>()=>r(void 0,void 0,void 0,(function*(){try{const a=Fa(e,t),s="/api/UUID";return yield a.post(s)}catch(e){throw u("createUUID",e),e}})),Da=(e=l,t)=>a=>r(void 0,void 0,void 0,(function*(){try{const s=Fa(e,t),r=`/api/UUID/${a}`;return yield s.get(r)}catch(e){throw u("getUUIDRecord",e),e}})),$a=(e=l,t)=>a=>r(void 0,void 0,void 0,(function*(){try{const s=Fa(e,t),r="/api/UUID/UUIDRecordMeta";return yield s.put(r,a)}catch(e){throw u("updateUUIDRecordMeta",e),e}})),La=(e=l,t)=>a=>r(void 0,void 0,void 0,(function*(){try{const s=Fa(e,t),r="/api/UUID/authorize";return yield s.post(r,a)}catch(e){throw u("authorizeUUIDRecord",e),e}}));var Ma=Object.freeze({__proto__:null,authorizeUUIDRecord:La,createUUID:Na,getOwnedUUIDs:Ra,getUUIDRecord:Da,updateUUIDRecordMeta:$a});const za="/api/UUAddress",Va=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Mt(t);return yield e.get(za,a)}catch(e){throw u("getAddresses",e),e}})),Ba=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){var a;try{const{createUUID:s}=yield Promise.resolve().then((function(){return Ma})),r=yield s(e)();if(!(null===(a=r.data)||void 0===a?void 0:a.uuid))throw new Error("Failed to generate UUID for address");const i=Object.assign({uuid:r.data.uuid},t),n=$t(Qt,i);return yield e.post(za,n)}catch(e){throw u("createAddress",e),e}})),Ha=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=$t(Qt,t);return yield e.post(za,a)}catch(e){throw u("updateAddress",e),e}})),qa=(e=l)=>(t,a)=>r(void 0,void 0,void 0,(function*(){try{const{createStatement:r}=yield Promise.resolve().then((function(){return _a})),{Predicate:i}=yield Promise.resolve().then((function(){return s})),n=yield Ba(e)(a);if(!n.data)throw new Error("Failed to create address");const o={subject:t,predicate:i.HAS_ADDRESS,object:n.data.uuid},d=yield r(e)(o);return{data:{address:n.data,statement:d.data},status:n.status,statusText:n.statusText,headers:n.headers}}catch(e){throw u("createAddressForObject",e),e}})),Ka=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t);return yield e.delete(`${za}/${a}`)}catch(e){throw u("softDeleteAddress",e),e}})),Wa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){var s,r,i,n,o,d;try{const u=$t(sa,t),c=[],l=[];let h;const p=yield Na(e)();if(!(null===(s=p.data)||void 0===s?void 0:s.uuid))throw new Error("Failed to obtain UUID for object");const f=Object.assign(Object.assign({},u.object),{uuid:p.data.uuid}),m=yield na(e)(f);if(!m.data)throw new Error("Failed to create object");const v=m.data,g=v.uuid;if(u.parents&&u.parents.length>0)for(const t of u.parents){const s=yield ia(e)({uuid:t});s.data&&s.data.length>0&&(l.push(s.data[0]),yield la(e)({subject:t,predicate:a.IS_PARENT_OF,object:g}),yield la(e)({subject:g,predicate:a.IS_CHILD_OF,object:t}))}if(u.address){const t=yield Ba(e)(u.address);if(t.data){const s={subject:g,predicate:a.HAS_ADDRESS,object:t.data.uuid};yield la(e)(s),h=t.data}}const y=[];if(u.files&&u.files.length>0)for(const t of u.files){const s=yield Na(e)();if(!(null===(r=s.data)||void 0===r?void 0:r.uuid))continue;const i=Object.assign(Object.assign({},t.file),{uuid:s.data.uuid}),n=yield Za(e)(i);n.data&&(y.push(n.data),yield la(e)({subject:g,predicate:a.HAS_FILE,object:n.data.uuid}),yield la(e)({subject:n.data.uuid,predicate:a.IS_FILE_OF,object:g}))}if(u.properties&&u.properties.length>0)for(const t of u.properties){const s=yield Na(e)();if(!(null===(i=s.data)||void 0===i?void 0:i.uuid))continue;const r=Object.assign(Object.assign({},t.property),{uuid:s.data.uuid}),u=yield wa(e)(r);if(u.data){const s=u.data.uuid,r=u.data;yield la(e)({subject:g,predicate:a.HAS_PROPERTY,object:s}),yield la(e)({subject:s,predicate:a.IS_PROPERTY_OF,object:g});const i=[];if(t.files&&t.files.length>0)for(const r of t.files){const t=yield Na(e)();if(!(null===(n=t.data)||void 0===n?void 0:n.uuid))continue;const o=Object.assign(Object.assign({},r.file),{uuid:t.data.uuid}),d=yield Za(e)(o);d.data&&(i.push(d.data),yield la(e)({subject:s,predicate:a.HAS_FILE,object:d.data.uuid}),yield la(e)({subject:d.data.uuid,predicate:a.IS_FILE_OF,object:s}))}const l=[];if(t.values&&t.values.length>0)for(const r of t.values){const t=yield Na(e)();if(!(null===(o=t.data)||void 0===o?void 0:o.uuid))continue;const i=Object.assign(Object.assign({},r.value),{uuid:t.data.uuid}),n=yield Ea(e)(i);if(n.data){const t=n.data.uuid,i=n.data;yield la(e)({subject:s,predicate:a.HAS_VALUE,object:t}),yield la(e)({subject:t,predicate:a.IS_VALUE_OF,object:s});const o=[];if(r.files&&r.files.length>0)for(const s of r.files){const r=yield Na(e)();if(!(null===(d=r.data)||void 0===d?void 0:d.uuid))continue;const i=Object.assign(Object.assign({},s.file),{uuid:r.data.uuid}),n=yield Za(e)(i);n.data&&(o.push(n.data),yield la(e)({subject:t,predicate:a.HAS_FILE,object:n.data.uuid}),yield la(e)({subject:n.data.uuid,predicate:a.IS_FILE_OF,object:t}))}l.push({value:i,files:o})}}c.push({property:r,values:l,files:i})}}return{data:{object:v,properties:c,files:y,address:h,parents:l},status:m.status,statusText:m.statusText,headers:m.headers}}catch(e){return u("createFullObject",e),{data:null,status:500,statusText:e.message||"Error creating complex object"}}})),Ya=(e=l)=>()=>r(void 0,void 0,void 0,(function*(){try{const t=yield e.get("/api/User");return{data:t.data,status:t.status,statusText:t.statusText,headers:t.headers}}catch(e){return u("requestBaseAuth",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error authenticating with base service",headers:{}}}})),Ga=(e=l)=>()=>r(void 0,void 0,void 0,(function*(){var t;try{const a=((e=l)=>{var t;const a=null===(t=e.config)||void 0===t?void 0:t.uuidServiceBaseUrl;if(!a)return e;const s=Object.assign(Object.assign({},e.config),{baseUrl:a});return c(s)})(e);if(a===e&&!(null===(t=e.config)||void 0===t?void 0:t.uuidServiceBaseUrl))return{data:null,status:400,statusText:"UUID service URL not configured",headers:{}};const s=yield a.get("/api/User");return{data:s.data,status:s.status,statusText:s.statusText,headers:s.headers}}catch(e){return u("requestUuidAuth",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error authenticating with UUID service",headers:{}}}})),Ja="/api/Aggregate",Xa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Bt(t),s=yield e.get(`${Ja}/${a}`);return{data:s.data,status:s.status,statusText:s.statusText,headers:s.headers}}catch(e){return u("findByUUID",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error finding entity by UUID"}}})),Qa=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=Vt(t),s=yield e.post(`${Ja}/search`,a||{});return{data:s.data,status:s.status,statusText:s.statusText,headers:s.headers}}catch(e){throw u("getAggregateEntities",e),e}})),es=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=yield e.post(Ja,t);return{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(e){return u("createAggregateObject",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error creating aggregate object",headers:{}}}})),ts=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=yield e.post(`${Ja}/Import`,t);return{data:a.data,status:a.status,statusText:a.statusText,headers:a.headers}}catch(e){return u("importAggregateObjects",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error importing aggregate objects",headers:{}}}})),as=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{return Xa(e)(t)}catch(e){return u("findByUUID (aggregate facade)",e),{data:null,status:500,statusText:e.message||"Error finding entity by UUID"}}})),ss=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{return Qa(e)(t)}catch(e){throw u("getAggregateEntities (aggregate facade)",e),e}})),rs=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{return es(e)(t)}catch(e){return u("createAggregateObject (aggregate facade)",e),{data:null,status:500,statusText:e.message||"Error creating aggregate object"}}})),is=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{return ts(e)(t)}catch(e){return u("importAggregateObjects (aggregate facade)",e),{data:null,status:500,statusText:e.message||"Error importing aggregate objects"}}})),ns=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){var s;try{const r=yield Na(e)();if(!(null===(s=r.data)||void 0===s?void 0:s.uuid))throw new Error("Failed to obtain UUID for file");const i=r.data.uuid,n={uuid:i,fileReference:t.fileReference,label:t.label},o=$t(Xt,n),d=yield Za(e)(o);if(!d.data)throw new Error("Failed to create UUFile record");return yield la(e)({subject:t.uuidToAttach,predicate:a.HAS_FILE,object:i}),{data:d.data,status:d.status,statusText:d.statusText,headers:d.headers}}catch(e){return u("uploadByReference (facade)",e),{data:null,status:e.status||500,statusText:e.statusText||e.message||"Error uploading file by reference",headers:e.headers||{}}}})),os=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){var s;try{const r=yield Na(e)();if(!(null===(s=r.data)||void 0===s?void 0:s.uuid))throw new Error("Failed to obtain UUID for file");const i=r.data.uuid,n=yield Pa(e)(i,t.uuidToAttach,t.file);return yield la(e)({subject:t.uuidToAttach,predicate:a.HAS_FILE,object:i}),{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}catch(e){return u("uploadDirect (facade)",e),{data:null,status:500,statusText:e.message||"Error uploading file binary"}}})),ds=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{const a=`/api/UUFile/upload?uuidFile=${t.uuidFile}&uuidToAttach=${t.uuidToAttach}`;return yield e.postForm(a,t.formData)}catch(e){throw u("uploadFormData (facade)",e),e}})),us=(e=l)=>t=>r(void 0,void 0,void 0,(function*(){try{return yield Ca(e)(t)}catch(e){throw u("download (facade)",e),e}})),cs=e=>{h(e),e.debug&&n(e.debug)},ls=e=>(h(e),e.debug&&n(e.debug),{debug:{configure:e=>{n(e)}},auth:{requestBaseAuth:()=>((e=l)=>()=>r(void 0,void 0,void 0,(function*(){try{return Ya(e)()}catch(e){return u("requestBaseAuth (facade)",e),{data:null,status:500,statusText:e.message||"Error authenticating with base service"}}})))()(),requestUuidAuth:()=>((e=l)=>()=>r(void 0,void 0,void 0,(function*(){try{return Ga(e)()}catch(e){return u("requestUuidAuth (facade)",e),{data:null,status:500,statusText:e.message||"Error authenticating with UUID service"}}})))()()},aggregate:{findByUUID:e=>as()(e),getAggregateEntities:e=>ss()(e),createAggregateObject:e=>rs()(e),importAggregateObjects:e=>is()(e)},objects:{create:e=>na()(e),createFullObject:e=>Wa()(e),getObjects:e=>ia()(e),delete:e=>oa()(e)},properties:{addToObject:(e,t)=>r(void 0,void 0,void 0,(function*(){var s;let r;if("uuid"in t&&t.uuid)r=t;else{const e=yield Na()();if(!(null===(s=e.data)||void 0===s?void 0:s.uuid))throw new Error("Failed to obtain UUID for property");r=Object.assign(Object.assign({},t),{uuid:e.data.uuid})}const i=yield wa()(r);return i.data&&(yield la()({subject:e,predicate:a.HAS_PROPERTY,object:i.data.uuid}),yield la()({subject:i.data.uuid,predicate:a.IS_PROPERTY_OF,object:e})),i})),create:e=>wa()(e),getProperties:e=>xa()(e),getPropertyByKey:(e,t)=>ka()(e,t),delete:e=>Ta()(e)},values:{setForProperty:(e,t)=>r(void 0,void 0,void 0,(function*(){var s;let r;if("uuid"in t&&t.uuid)r=t;else{const e=yield Na()();if(!(null===(s=e.data)||void 0===s?void 0:s.uuid))throw new Error("Failed to obtain UUID for property value");r=Object.assign(Object.assign({},t),{uuid:e.data.uuid})}const i=yield Ea()(r);return i.data&&(yield la()({subject:e,predicate:a.HAS_VALUE,object:i.data.uuid}),yield la()({subject:i.data.uuid,predicate:a.IS_VALUE_OF,object:e})),i})),create:e=>Ea()(e),getPropertyValues:e=>Oa()(e),delete:e=>Aa()(e)},files:{create:e=>Za()(e),getFiles:e=>Ia()(e),delete:e=>Ua()(e),uploadByReference:e=>ns()(e),uploadDirect:e=>os()(e),uploadFormData:e=>ds()(e),download:e=>us()(e)},statements:{getStatements:e=>ua()(e),create:e=>la()(e),delete:e=>pa()(e)},uuid:{create:()=>Na()(),getOwned:()=>Ra()(),getRecord:e=>Da()(e),updateRecordMeta:e=>$a()(e),authorize:e=>La()(e)},addresses:{create:e=>Ba()(e),update:e=>Ha()(e),get:e=>Va()(e),delete:e=>Ka()(e),createForObject:(e,t)=>qa()(e,t)}}),hs=(e=l)=>(t,s)=>r(void 0,void 0,void 0,(function*(){var r;const i=$t(Rt.string().uuid(),t);let n;if("uuid"in s&&s.uuid)n=s;else{const t=yield Na(e)();if(!(null===(r=t.data)||void 0===r?void 0:r.uuid))throw new Error("Failed to obtain UUID for property");n=Object.assign(Object.assign({},s),{uuid:t.data.uuid})}const o=yield wa(e)(n);return o.data&&(yield la(e)({subject:i,predicate:a.HAS_PROPERTY,object:o.data.uuid}),yield la(e)({subject:o.data.uuid,predicate:a.IS_PROPERTY_OF,object:i})),o})),ps=(e=l)=>(t,a)=>r(void 0,void 0,void 0,(function*(){const s=$t(Rt.string().uuid(),t),r=yield va(e)(s,a);if(!r.data||0===r.data.length)return{data:[],status:r.status,statusText:r.statusText,headers:r.headers};const i=[];for(const t of r.data){const s=t.object,r=yield xa(e)(Object.assign({uuid:s},a));r.data&&r.data.length>0&&i.push(r.data[0])}return{data:i,status:r.status,statusText:r.statusText,headers:r.headers}})),fs=(e=l)=>(t,s)=>r(void 0,void 0,void 0,(function*(){var r;const i=$t(Rt.string().uuid(),t);let n;if("uuid"in s&&s.uuid)n=s;else{const t=yield Na(e)();if(!(null===(r=t.data)||void 0===r?void 0:r.uuid))throw new Error("Failed to obtain UUID for property value");n=Object.assign(Object.assign({},s),{uuid:t.data.uuid})}const o=yield Ea(e)(n);return o.data&&(yield la(e)({subject:i,predicate:a.HAS_VALUE,object:o.data.uuid}),yield la(e)({subject:o.data.uuid,predicate:a.IS_VALUE_OF,object:i})),o})),ms=(e=l)=>(t,a)=>r(void 0,void 0,void 0,(function*(){const s=$t(Rt.string().uuid(),t),r=yield ga(e)(s,a);if(!r.data||0===r.data.length)return{data:[],status:r.status,statusText:r.statusText,headers:r.headers};const i=[];for(const t of r.data){const s=t.object,r=yield Oa(e)(Object.assign({uuid:s},a));r.data&&r.data.length>0&&i.push(r.data[0])}return{data:i,status:r.status,statusText:r.statusText,headers:r.headers}}));export{a as Predicate,Nt as ValidationError,hs as addPropertyToObject,Xa as aggregateFindByUUID,as as aggregateSearch,La as authorizeUUIDRecord,n as configureLogger,Ba as createAddress,qa as createAddressForObject,rs as createAggregate,es as createAggregateObject,ls as createClient,Wa as createFullObject,ca as createOrFindStatements,Za as createOrUpdateFile,na as createOrUpdateObject,wa as createOrUpdateProperty,Ea as createOrUpdatePropertyValue,la as createStatement,Na as createUUID,us as downloadFile,Ca as downloadFileBinary,fa as findChildren,ya as findFiles,ma as findParents,va as findProperties,ga as findPropertyValues,Va as getAddresses,Qa as getAggregateEntities,Ia as getFiles,ia as getObjects,Ra as getOwnedUUIDs,xa as getProperties,ps as getPropertiesForObject,ka as getPropertyByKey,Oa as getPropertyValues,ua as getStatements,ha as getStatementsByUuidAndPredicate,Da as getUUIDRecord,ms as getValuesForProperty,ts as importAggregateObjects,is as importAggregates,cs as initializeClient,Ya as requestBaseAuth,Ga as requestUuidAuth,ss as searchAggregateEntities,h as setHttpClient,fs as setValueForProperty,Ka as softDeleteAddress,Ua as softDeleteFile,oa as softDeleteObject,Ta as softDeleteProperty,Aa as softDeletePropertyValue,pa as softDeleteStatement,Ha as updateAddress,$a as updateUUIDRecordMeta,Pa as uploadFileBinary,ns as uploadFileByReference,os as uploadFileDirect,ds as uploadFileFormData,$t as validate,Vt as validateAggregateParams,Mt as validateQueryParams,Lt as validateSafe,zt as validateStatementQueryParams,Bt as validateUuid};
2
+ //# sourceMappingURL=index.esm.js.map