@mattrglobal/verifier-sdk-web 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright 2021 - MATTR Limited
3
+ * All rights reserved
4
+ * Confidential and proprietary
5
+ *
6
+ * THIRD PARTY SOFTWARE NOTICES AND INFORMATION
7
+ * Do Not Translate or Localize
8
+ *
9
+ * Bundle of @mattrglobal/verifier-sdk-web
10
+ * Generated: 2024-08-09
11
+ * Version: 0.1.0
12
+ * Dependencies:
13
+ *
14
+ * neverthrow -- 4.3.0
15
+ *
16
+ * zod -- 3.22.3
17
+ */
18
+
19
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MATTRVerifierSDK={})}(this,(function(e){"use strict";class t extends Error{constructor(e,t){const n="string"==typeof e?e:"Exception";super(n),Object.setPrototypeOf(this,new.target.prototype),this.cause=t||e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(n).stack}}
20
+ /*! *****************************************************************************
21
+ Copyright (c) Microsoft Corporation.
22
+
23
+ Permission to use, copy, modify, and/or distribute this software for any
24
+ purpose with or without fee is hereby granted.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
27
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
28
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
29
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
30
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
31
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
32
+ PERFORMANCE OF THIS SOFTWARE.
33
+ ***************************************************************************** */
34
+ function n(e,t,n,r){return new(n||(n=Promise))((function(a,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,u)}s((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}var i,o={withStackTrace:!1},u=function(e,t,n){return void 0===n&&(n=o),{data:t.isOk()?{type:"Ok",value:t.value}:{type:"Err",value:t.error},message:e,stack:n.withStackTrace?(new Error).stack:void 0}};!function(e){e.fromThrowable=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];try{var i=e.apply(void 0,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(a(arguments[t]));return e}(n));return s(i)}catch(e){return c(t?t(e):e)}}}}(i||(i={}));var s=function(e){return new l(e)},c=function(e){return new d(e)},l=function(){function e(e){this.value=e}return e.prototype.isOk=function(){return!0},e.prototype.isErr=function(){return!this.isOk()},e.prototype.map=function(e){return s(e(this.value))},e.prototype.mapErr=function(e){return s(this.value)},e.prototype.andThen=function(e){return e(this.value)},e.prototype.orElse=function(e){return s(this.value)},e.prototype.asyncAndThen=function(e){return e(this.value)},e.prototype.asyncMap=function(e){return f.fromSafePromise(e(this.value))},e.prototype.unwrapOr=function(e){return this.value},e.prototype.match=function(e,t){return e(this.value)},e.prototype._unsafeUnwrap=function(e){return this.value},e.prototype._unsafeUnwrapErr=function(e){throw u("Called `_unsafeUnwrapErr` on an Ok",this,e)},e}(),d=function(){function e(e){this.error=e}return e.prototype.isOk=function(){return!1},e.prototype.isErr=function(){return!this.isOk()},e.prototype.map=function(e){return c(this.error)},e.prototype.mapErr=function(e){return c(e(this.error))},e.prototype.andThen=function(e){return c(this.error)},e.prototype.orElse=function(e){return e(this.error)},e.prototype.asyncAndThen=function(e){return p(this.error)},e.prototype.asyncMap=function(e){return p(this.error)},e.prototype.unwrapOr=function(e){return e},e.prototype.match=function(e,t){return t(this.error)},e.prototype._unsafeUnwrap=function(e){throw u("Called `_unsafeUnwrap` on an Err",this,e)},e.prototype._unsafeUnwrapErr=function(e){return this.error},e}();i.fromThrowable;var f=function(){function e(e){this._promise=e}return e.fromSafePromise=function(t){return new e(t.then((function(e){return new l(e)})))},e.fromPromise=function(t,n){return new e(t.then((function(e){return new l(e)})).catch((function(e){return new d(n(e))})))},e.prototype.map=function(t){var a=this;return new e(this._promise.then((function(e){return n(a,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return e.isErr()?[2,new d(e.error)]:(n=l.bind,[4,t(e.value)]);case 1:return[2,new(n.apply(l,[void 0,r.sent()]))]}}))}))})))},e.prototype.mapErr=function(t){var a=this;return new e(this._promise.then((function(e){return n(a,void 0,void 0,(function(){var n;return r(this,(function(r){switch(r.label){case 0:return e.isOk()?[2,new l(e.value)]:(n=d.bind,[4,t(e.error)]);case 1:return[2,new(n.apply(d,[void 0,r.sent()]))]}}))}))})))},e.prototype.andThen=function(t){return new e(this._promise.then((function(n){if(n.isErr())return new d(n.error);var r=t(n.value);return r instanceof e?r._promise:r})))},e.prototype.orElse=function(t){var a=this;return new e(this._promise.then((function(e){return n(a,void 0,void 0,(function(){return r(this,(function(n){return e.isErr()?[2,t(e.error)]:[2,new l(e.value)]}))}))})))},e.prototype.match=function(e,t){return this._promise.then((function(n){return n.match(e,t)}))},e.prototype.unwrapOr=function(e){return this._promise.then((function(t){return t.unwrapOr(e)}))},e.prototype.then=function(e,t){return this._promise.then(e,t)},e}(),p=function(e){return new f(Promise.resolve(new d(e)))};f.fromPromise,f.fromSafePromise;const h=e=>t=>e.safeParse(t).success,v=(e,n)=>r=>{const a=((e,t)=>{const n=t.safeParse(e);return n.success?s(n.data):c(n.error.issues.map((({message:e,path:t})=>({message:e,path:t}))))})(r,e);if(a.isErr())throw new t(n)};var y,m;!function(e){e.UnexpectedRespond="UnexpectedRespond"}(y||(y={})),function(e){e.HttpError="HttpError",e.UnknownError="UnknownError"}(m||(m={}));const g=async(e,t)=>{try{const n=await fetch(e,t);return n.status>299||n.status<200?c({type:m.HttpError,message:`HTTP error, status = ${n.status}`}):s(n)}catch(e){return c({type:m.UnknownError,message:"Unknown error",cause:e})}};function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function b(){b=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,o=Object.create(i.prototype),u=new D(r||[]);return a(o,"_invoke",{value:C(e,n,u)}),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",p="suspendedYield",h="executing",v="completed",y={};function m(){}function g(){}function _(){}var k={};c(k,o,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(N([])));x&&x!==n&&r.call(x,o)&&(k=x);var T=_.prototype=m.prototype=Object.create(k);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(a,i,o,u){var s=d(e[a],e,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,o,u)}),(function(e){n("throw",e,o,u)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return n("throw",e,o,u)}))}u(s.arg)}var i;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return i=i?i.then(a,a):a()}})}function C(t,n,r){var a=f;return function(i,o){if(a===h)throw new Error("Generator is already running");if(a===v){if("throw"===i)throw o;return{value:e,done:!0}}for(r.method=i,r.arg=o;;){var u=r.delegate;if(u){var s=S(u,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=h;var c=d(t,n,r);if("normal"===c.type){if(a=r.done?v:p,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=v,r.method="throw",r.arg=c.arg)}}}function S(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=d(a,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function Z(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(Z,this),this.reset(!0)}function N(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=_,a(T,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:g,configurable:!0}),g.displayName=c(_,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,c(e,s,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},E(O.prototype),c(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,a,i){void 0===i&&(i=Promise);var o=new O(l(e,n,r,a),i);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(T),c(T,s,"Generator"),c(T,o,(function(){return this})),c(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=N,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(j),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return u.type="throw",u.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],u=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;j(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function x(e,t,n,r,a,i,o){try{var u=e[i](o),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,a)}function T(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){x(i,r,a,o,u,"next",e)}function u(e){x(i,r,a,o,u,"throw",e)}o(void 0)}))}}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V(r.key),r)}}function C(e,t,n){return t&&O(e.prototype,t),n&&O(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t,n){return(t=V(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D(e,t)}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function D(e,t){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},D(e,t)}function N(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function P(e,t,n){return P=N()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&D(a,n.prototype),a},P.apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return R=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return P(e,arguments,j(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),D(r,e)},R(e)}function I(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){var t=N();return function(){var n,r=j(e);if(t){var a=j(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return I(e)}(this,n)}}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,u=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return u}}(e,t)||M(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e){return function(e){if(Array.isArray(e))return U(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||M(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function B(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=M(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw i}}}}function V(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var z,K;!function(e){e.assertEqual=function(e){return e},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=function(e){var t,n={},r=B(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;n[a]=a}}catch(e){r.e(e)}finally{r.f()}return n},e.getValidEnumValues=function(t){var n,r=e.objectKeys(t).filter((function(e){return"number"!=typeof t[t[e]]})),a={},i=B(r);try{for(i.s();!(n=i.n()).done;){var o=n.value;a[o]=t[o]}}catch(e){i.e(e)}finally{i.f()}return e.objectValues(a)},e.objectValues=function(t){return e.objectKeys(t).map((function(e){return t[e]}))},e.objectKeys="function"==typeof Object.keys?function(e){return Object.keys(e)}:function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=function(e,t){var n,r=B(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(t(a))return a}}catch(e){r.e(e)}finally{r.f()}},e.isInteger="function"==typeof Number.isInteger?function(e){return Number.isInteger(e)}:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.joinValues=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" | ";return e.map((function(e){return"string"==typeof e?"'".concat(e,"'"):e})).join(t)},e.jsonStringifyReplacer=function(e,t){return"bigint"==typeof t?t.toString():t}}(z||(z={})),function(e){e.mergeShapes=function(e,t){return k(k({},e),t)}}(K||(K={}));var q=z.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),H=function(e){switch(w(e)){case"undefined":return q.undefined;case"string":return q.string;case"number":return isNaN(e)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(e)?q.array:null===e?q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?q.promise:"undefined"!=typeof Map&&e instanceof Map?q.map:"undefined"!=typeof Set&&e instanceof Set?q.set:"undefined"!=typeof Date&&e instanceof Date?q.date:q.object;default:return q.unknown}},$=z.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"]),W=function(e){Z(n,e);var t=A(n);function n(e){var r;E(this,n),(r=t.call(this)).issues=[],r.addIssue=function(e){r.issues=[].concat(L(r.issues),[e])},r.addIssues=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r.issues=[].concat(L(r.issues),L(e))};var a=(this instanceof n?this.constructor:void 0).prototype;return Object.setPrototypeOf?Object.setPrototypeOf(I(r),a):r.__proto__=a,r.name="ZodError",r.issues=e,r}return C(n,[{key:"errors",get:function(){return this.issues}},{key:"format",value:function(e){var t=e||function(e){return e.message},n={_errors:[]};return function e(r){var a,i=B(r.issues);try{for(i.s();!(a=i.n()).done;){var o=a.value;if("invalid_union"===o.code)o.unionErrors.map(e);else if("invalid_return_type"===o.code)e(o.returnTypeError);else if("invalid_arguments"===o.code)e(o.argumentsError);else if(0===o.path.length)n._errors.push(t(o));else for(var u=n,s=0;s<o.path.length;){var c=o.path[s];s===o.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(t(o))):u[c]=u[c]||{_errors:[]},u=u[c],s++}}}catch(e){i.e(e)}finally{i.f()}}(this),n}},{key:"toString",value:function(){return this.message}},{key:"message",get:function(){return JSON.stringify(this.issues,z.jsonStringifyReplacer,2)}},{key:"isEmpty",get:function(){return 0===this.issues.length}},{key:"flatten",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e.message},n={},r=[],a=B(this.issues);try{for(a.s();!(e=a.n()).done;){var i=e.value;i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i))}}catch(e){a.e(e)}finally{a.f()}return{formErrors:r,fieldErrors:n}}},{key:"formErrors",get:function(){return this.flatten()}}]),n}(R(Error));W.create=function(e){return new W(e)};var G=function(e,t){var n;switch(e.code){case $.invalid_type:n=e.received===q.undefined?"Required":"Expected ".concat(e.expected,", received ").concat(e.received);break;case $.invalid_literal:n="Invalid literal value, expected ".concat(JSON.stringify(e.expected,z.jsonStringifyReplacer));break;case $.unrecognized_keys:n="Unrecognized key(s) in object: ".concat(z.joinValues(e.keys,", "));break;case $.invalid_union:n="Invalid input";break;case $.invalid_union_discriminator:n="Invalid discriminator value. Expected ".concat(z.joinValues(e.options));break;case $.invalid_enum_value:n="Invalid enum value. Expected ".concat(z.joinValues(e.options),", received '").concat(e.received,"'");break;case $.invalid_arguments:n="Invalid function arguments";break;case $.invalid_return_type:n="Invalid function return type";break;case $.invalid_date:n="Invalid date";break;case $.invalid_string:"object"===w(e.validation)?"includes"in e.validation?(n='Invalid input: must include "'.concat(e.validation.includes,'"'),"number"==typeof e.validation.position&&(n="".concat(n," at one or more positions greater than or equal to ").concat(e.validation.position))):"startsWith"in e.validation?n='Invalid input: must start with "'.concat(e.validation.startsWith,'"'):"endsWith"in e.validation?n='Invalid input: must end with "'.concat(e.validation.endsWith,'"'):z.assertNever(e.validation):n="regex"!==e.validation?"Invalid ".concat(e.validation):"Invalid";break;case $.too_small:n="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"more than"," ").concat(e.minimum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"over"," ").concat(e.minimum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(e.minimum):"date"===e.type?"Date must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(e.minimum))):"Invalid input";break;case $.too_big:n="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"less than"," ").concat(e.maximum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"under"," ").concat(e.maximum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"bigint"===e.type?"BigInt must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"date"===e.type?"Date must be ".concat(e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(e.maximum))):"Invalid input";break;case $.custom:n="Invalid input";break;case $.invalid_intersection_types:n="Intersection results could not be merged";break;case $.not_multiple_of:n="Number must be a multiple of ".concat(e.multipleOf);break;case $.not_finite:n="Number must be finite";break;default:n=t.defaultError,z.assertNever(e)}return{message:n}},J=G;function Q(){return J}var Y=function(e){var t,n=e.data,r=e.path,a=e.errorMaps,i=e.issueData,o=[].concat(L(r),L(i.path||[])),u=k(k({},i),{},{path:o}),s="",c=B(a.filter((function(e){return!!e})).slice().reverse());try{for(c.s();!(t=c.n()).done;){s=(0,t.value)(u,{data:n,defaultError:s}).message}}catch(e){c.e(e)}finally{c.f()}return k(k({},i),{},{path:o,message:i.message||s})};function X(e,t){var n=Y({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Q(),G].filter((function(e){return!!e}))});e.common.issues.push(n)}var ee,te=function(){function e(){E(this,e),this.value="valid"}var t;return C(e,[{key:"dirty",value:function(){"valid"===this.value&&(this.value="dirty")}},{key:"abort",value:function(){"aborted"!==this.value&&(this.value="aborted")}}],[{key:"mergeArray",value:function(e,t){var n,r=[],a=B(t);try{for(a.s();!(n=a.n()).done;){var i=n.value;if("aborted"===i.status)return ne;"dirty"===i.status&&e.dirty(),r.push(i.value)}}catch(e){a.e(e)}finally{a.f()}return{status:e.value,value:r}}},{key:"mergeObjectAsync",value:(t=T(b().mark((function t(n,r){var a,i,o,u;return b().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=[],i=B(r),t.prev=2,i.s();case 4:if((o=i.n()).done){t.next=17;break}return u=o.value,t.t0=a,t.next=9,u.key;case 9:return t.t1=t.sent,t.next=12,u.value;case 12:t.t2=t.sent,t.t3={key:t.t1,value:t.t2},t.t0.push.call(t.t0,t.t3);case 15:t.next=4;break;case 17:t.next=22;break;case 19:t.prev=19,t.t4=t.catch(2),i.e(t.t4);case 22:return t.prev=22,i.f(),t.finish(22);case 25:return t.abrupt("return",e.mergeObjectSync(n,a));case 26:case"end":return t.stop()}}),t,null,[[2,19,22,25]])}))),function(e,n){return t.apply(this,arguments)})},{key:"mergeObjectSync",value:function(e,t){var n,r={},a=B(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,o=i.key,u=i.value;if("aborted"===o.status)return ne;if("aborted"===u.status)return ne;"dirty"===o.status&&e.dirty(),"dirty"===u.status&&e.dirty(),"__proto__"===o.value||void 0===u.value&&!i.alwaysSet||(r[o.value]=u.value)}}catch(e){a.e(e)}finally{a.f()}return{status:e.value,value:r}}}]),e}(),ne=Object.freeze({status:"aborted"}),re=function(e){return{status:"dirty",value:e}},ae=function(e){return{status:"valid",value:e}},ie=function(e){return"aborted"===e.status},oe=function(e){return"dirty"===e.status},ue=function(e){return"valid"===e.status},se=function(e){return"undefined"!=typeof Promise&&e instanceof Promise};!function(e){e.errToObj=function(e){return"string"==typeof e?{message:e}:e||{}},e.toString=function(e){return"string"==typeof e?e:null==e?void 0:e.message}}(ee||(ee={}));var ce=function(){function e(t,n,r,a){E(this,e),this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}return C(e,[{key:"path",get:function(){var e,t;this._cachedPath.length||(this._key instanceof Array?(e=this._cachedPath).push.apply(e,L(this._path).concat(L(this._key))):(t=this._cachedPath).push.apply(t,L(this._path).concat([this._key])));return this._cachedPath}}]),e}(),le=function(e,t){if(ue(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;var t=new W(e.common.issues);return this._error=t,this._error}}};function de(e){if(!e)return{};var t=e.errorMap,n=e.invalid_type_error,r=e.required_error,a=e.description;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:function(e,t){return"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError}},description:a}}var fe=function(){function e(t){E(this,e),this.spa=this.safeParseAsync,this._def=t,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)}var t,n;return C(e,[{key:"description",get:function(){return this._def.description}},{key:"_getType",value:function(e){return H(e.data)}},{key:"_getOrReturnCtx",value:function(e,t){return t||{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}},{key:"_processInputParams",value:function(e){return{status:new te,ctx:{common:e.parent.common,data:e.data,parsedType:H(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}},{key:"_parseSync",value:function(e){var t=this._parse(e);if(se(t))throw new Error("Synchronous parse encountered promise.");return t}},{key:"_parseAsync",value:function(e){var t=this._parse(e);return Promise.resolve(t)}},{key:"parse",value:function(e,t){var n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}},{key:"safeParse",value:function(e,t){var n,r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:H(e)},a=this._parseSync({data:e,path:r.path,parent:r});return le(r,a)}},{key:"parseAsync",value:(n=T(b().mark((function e(t,n){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.safeParseAsync(t,n);case 2:if(!(r=e.sent).success){e.next=5;break}return e.abrupt("return",r.data);case 5:throw r.error;case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"safeParseAsync",value:(t=T(b().mark((function e(t,n){var r,a,i;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={common:{issues:[],contextualErrorMap:null==n?void 0:n.errorMap,async:!0},path:(null==n?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:H(t)},a=this._parse({data:t,path:r.path,parent:r}),e.next=4,se(a)?a:Promise.resolve(a);case 4:return i=e.sent,e.abrupt("return",le(r,i));case 6:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"refine",value:function(e,t){return this._refinement((function(n,r){var a=e(n),i=function(){return r.addIssue(k({code:$.custom},function(e){return"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t}(n)))};return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return!!e||(i(),!1)})):!!a||(i(),!1)}))}},{key:"refinement",value:function(e,t){return this._refinement((function(n,r){return!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)}))}},{key:"_refinement",value:function(e){return new Ye({schema:this,typeName:st.ZodEffects,effect:{type:"refinement",refinement:e}})}},{key:"superRefine",value:function(e){return this._refinement(e)}},{key:"optional",value:function(){return Xe.create(this,this._def)}},{key:"nullable",value:function(){return et.create(this,this._def)}},{key:"nullish",value:function(){return this.nullable().optional()}},{key:"array",value:function(){return Pe.create(this,this._def)}},{key:"promise",value:function(){return Qe.create(this,this._def)}},{key:"or",value:function(e){return Ae.create([this,e],this._def)}},{key:"and",value:function(e){return Ue.create(this,e,this._def)}},{key:"transform",value:function(e){return new Ye(k(k({},de(this._def)),{},{schema:this,typeName:st.ZodEffects,effect:{type:"transform",transform:e}}))}},{key:"default",value:function(e){var t="function"==typeof e?e:function(){return e};return new tt(k(k({},de(this._def)),{},{innerType:this,defaultValue:t,typeName:st.ZodDefault}))}},{key:"brand",value:function(){return new it(k({typeName:st.ZodBranded,type:this},de(this._def)))}},{key:"catch",value:function(e){var t="function"==typeof e?e:function(){return e};return new nt(k(k({},de(this._def)),{},{innerType:this,catchValue:t,typeName:st.ZodCatch}))}},{key:"describe",value:function(e){return new(0,this.constructor)(k(k({},this._def),{},{description:e}))}},{key:"pipe",value:function(e){return ot.create(this,e)}},{key:"readonly",value:function(){return ut.create(this)}},{key:"isOptional",value:function(){return this.safeParse(void 0).success}},{key:"isNullable",value:function(){return this.safeParse(null).success}}]),e}(),pe=/^c[^\s-]{8,}$/i,he=/^[a-z][a-z0-9]*$/,ve=/[0-9A-HJKMNP-TV-Z]{26}/,ye=/^[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,me=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ge=/^((?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])|(?:[#\*0-9\u200D\u20E3\uFE0F]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uD83E[\uDDB0-\uDDB3]|\uDB40[\uDC20-\uDC7F]))+$/,_e=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ke=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;var be=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._regex=function(t,n,r){return e.refinement((function(e){return t.test(e)}),k({validation:n,code:$.invalid_string},ee.errToObj(r)))},e.nonempty=function(t){return e.min(1,ee.errToObj(t))},e.trim=function(){return new n(k(k({},e._def),{},{checks:[].concat(L(e._def.checks),[{kind:"trim"}])}))},e.toLowerCase=function(){return new n(k(k({},e._def),{},{checks:[].concat(L(e._def.checks),[{kind:"toLowerCase"}])}))},e.toUpperCase=function(){return new n(k(k({},e._def),{},{checks:[].concat(L(e._def.checks),[{kind:"toUpperCase"}])}))},e}return C(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.string,received:t.parsedType}),ne}var n,r,a,i,o=new te,u=void 0,s=B(this._def.checks);try{for(s.s();!(n=s.n()).done;){var c=n.value;if("min"===c.kind)e.data.length<c.value&&(X(u=this._getOrReturnCtx(e,u),{code:$.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),o.dirty());else if("max"===c.kind)e.data.length>c.value&&(X(u=this._getOrReturnCtx(e,u),{code:$.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),o.dirty());else if("length"===c.kind){var l=e.data.length>c.value,d=e.data.length<c.value;(l||d)&&(u=this._getOrReturnCtx(e,u),l?X(u,{code:$.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&X(u,{code:$.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),o.dirty())}else if("email"===c.kind)me.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"email",code:$.invalid_string,message:c.message}),o.dirty());else if("emoji"===c.kind)ge.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"emoji",code:$.invalid_string,message:c.message}),o.dirty());else if("uuid"===c.kind)ye.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"uuid",code:$.invalid_string,message:c.message}),o.dirty());else if("cuid"===c.kind)pe.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"cuid",code:$.invalid_string,message:c.message}),o.dirty());else if("cuid2"===c.kind)he.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"cuid2",code:$.invalid_string,message:c.message}),o.dirty());else if("ulid"===c.kind)ve.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"ulid",code:$.invalid_string,message:c.message}),o.dirty());else if("url"===c.kind)try{new URL(e.data)}catch(t){X(u=this._getOrReturnCtx(e,u),{validation:"url",code:$.invalid_string,message:c.message}),o.dirty()}else if("regex"===c.kind){c.regex.lastIndex=0,c.regex.test(e.data)||(X(u=this._getOrReturnCtx(e,u),{validation:"regex",code:$.invalid_string,message:c.message}),o.dirty())}else if("trim"===c.kind)e.data=e.data.trim();else if("includes"===c.kind)e.data.includes(c.value,c.position)||(X(u=this._getOrReturnCtx(e,u),{code:$.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),o.dirty());else if("toLowerCase"===c.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===c.kind)e.data=e.data.toUpperCase();else if("startsWith"===c.kind)e.data.startsWith(c.value)||(X(u=this._getOrReturnCtx(e,u),{code:$.invalid_string,validation:{startsWith:c.value},message:c.message}),o.dirty());else if("endsWith"===c.kind)e.data.endsWith(c.value)||(X(u=this._getOrReturnCtx(e,u),{code:$.invalid_string,validation:{endsWith:c.value},message:c.message}),o.dirty());else if("datetime"===c.kind){((i=c).precision?i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{".concat(i.precision,"}(([+-]\\d{2}(:?\\d{2})?)|Z)$")):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{".concat(i.precision,"}Z$")):0===i.precision?i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):i.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(X(u=this._getOrReturnCtx(e,u),{code:$.invalid_string,validation:"datetime",message:c.message}),o.dirty())}else"ip"===c.kind?(r=e.data,("v4"!==(a=c.version)&&a||!_e.test(r))&&("v6"!==a&&a||!ke.test(r))&&(X(u=this._getOrReturnCtx(e,u),{validation:"ip",code:$.invalid_string,message:c.message}),o.dirty())):z.assertNever(c)}}catch(e){s.e(e)}finally{s.f()}return{status:o.value,value:e.data}}},{key:"_addCheck",value:function(e){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[e])}))}},{key:"email",value:function(e){return this._addCheck(k({kind:"email"},ee.errToObj(e)))}},{key:"url",value:function(e){return this._addCheck(k({kind:"url"},ee.errToObj(e)))}},{key:"emoji",value:function(e){return this._addCheck(k({kind:"emoji"},ee.errToObj(e)))}},{key:"uuid",value:function(e){return this._addCheck(k({kind:"uuid"},ee.errToObj(e)))}},{key:"cuid",value:function(e){return this._addCheck(k({kind:"cuid"},ee.errToObj(e)))}},{key:"cuid2",value:function(e){return this._addCheck(k({kind:"cuid2"},ee.errToObj(e)))}},{key:"ulid",value:function(e){return this._addCheck(k({kind:"ulid"},ee.errToObj(e)))}},{key:"ip",value:function(e){return this._addCheck(k({kind:"ip"},ee.errToObj(e)))}},{key:"datetime",value:function(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(k({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},ee.errToObj(null==e?void 0:e.message)))}},{key:"regex",value:function(e,t){return this._addCheck(k({kind:"regex",regex:e},ee.errToObj(t)))}},{key:"includes",value:function(e,t){return this._addCheck(k({kind:"includes",value:e,position:null==t?void 0:t.position},ee.errToObj(null==t?void 0:t.message)))}},{key:"startsWith",value:function(e,t){return this._addCheck(k({kind:"startsWith",value:e},ee.errToObj(t)))}},{key:"endsWith",value:function(e,t){return this._addCheck(k({kind:"endsWith",value:e},ee.errToObj(t)))}},{key:"min",value:function(e,t){return this._addCheck(k({kind:"min",value:e},ee.errToObj(t)))}},{key:"max",value:function(e,t){return this._addCheck(k({kind:"max",value:e},ee.errToObj(t)))}},{key:"length",value:function(e,t){return this._addCheck(k({kind:"length",value:e},ee.errToObj(t)))}},{key:"isDatetime",get:function(){return!!this._def.checks.find((function(e){return"datetime"===e.kind}))}},{key:"isEmail",get:function(){return!!this._def.checks.find((function(e){return"email"===e.kind}))}},{key:"isURL",get:function(){return!!this._def.checks.find((function(e){return"url"===e.kind}))}},{key:"isEmoji",get:function(){return!!this._def.checks.find((function(e){return"emoji"===e.kind}))}},{key:"isUUID",get:function(){return!!this._def.checks.find((function(e){return"uuid"===e.kind}))}},{key:"isCUID",get:function(){return!!this._def.checks.find((function(e){return"cuid"===e.kind}))}},{key:"isCUID2",get:function(){return!!this._def.checks.find((function(e){return"cuid2"===e.kind}))}},{key:"isULID",get:function(){return!!this._def.checks.find((function(e){return"ulid"===e.kind}))}},{key:"isIP",get:function(){return!!this._def.checks.find((function(e){return"ip"===e.kind}))}},{key:"minLength",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"min"===r.kind&&(null===t||r.value>t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"maxLength",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"max"===r.kind&&(null===t||r.value<t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}}]),n}(fe);be.create=function(e){var t;return new be(k({checks:[],typeName:st.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},de(e)))};var we=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).min=e.gte,e.max=e.lte,e.step=e.multipleOf,e}return C(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==q.number){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.number,received:t.parsedType}),ne}var n,r,a,i,o,u,s=void 0,c=new te,l=B(this._def.checks);try{for(l.s();!(n=l.n()).done;){var d=n.value;if("int"===d.kind)z.isInteger(e.data)||(X(s=this._getOrReturnCtx(e,s),{code:$.invalid_type,expected:"integer",received:"float",message:d.message}),c.dirty());else if("min"===d.kind){(d.inclusive?e.data<d.value:e.data<=d.value)&&(X(s=this._getOrReturnCtx(e,s),{code:$.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),c.dirty())}else if("max"===d.kind){(d.inclusive?e.data>d.value:e.data>=d.value)&&(X(s=this._getOrReturnCtx(e,s),{code:$.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),c.dirty())}else"multipleOf"===d.kind?0!=(r=e.data,a=d.value,i=void 0,o=void 0,u=void 0,i=(r.toString().split(".")[1]||"").length,o=(a.toString().split(".")[1]||"").length,u=i>o?i:o,parseInt(r.toFixed(u).replace(".",""))%parseInt(a.toFixed(u).replace(".",""))/Math.pow(10,u))&&(X(s=this._getOrReturnCtx(e,s),{code:$.not_multiple_of,multipleOf:d.value,message:d.message}),c.dirty()):"finite"===d.kind?Number.isFinite(e.data)||(X(s=this._getOrReturnCtx(e,s),{code:$.not_finite,message:d.message}),c.dirty()):z.assertNever(d)}}catch(e){l.e(e)}finally{l.f()}return{status:c.value,value:e.data}}},{key:"gte",value:function(e,t){return this.setLimit("min",e,!0,ee.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,ee.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,ee.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,ee.toString(t))}},{key:"setLimit",value:function(e,t,r,a){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[{kind:e,value:t,inclusive:r,message:ee.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[e])}))}},{key:"int",value:function(e){return this._addCheck({kind:"int",message:ee.toString(e)})}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ee.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ee.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ee.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ee.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ee.toString(t)})}},{key:"finite",value:function(e){return this._addCheck({kind:"finite",message:ee.toString(e)})}},{key:"safe",value:function(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ee.toString(e)})}},{key:"minValue",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"min"===r.kind&&(null===t||r.value>t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"maxValue",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"max"===r.kind&&(null===t||r.value<t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"isInt",get:function(){return!!this._def.checks.find((function(e){return"int"===e.kind||"multipleOf"===e.kind&&z.isInteger(e.value)}))}},{key:"isFinite",get:function(){var e,t=null,n=null,r=B(this._def.checks);try{for(r.s();!(e=r.n()).done;){var a=e.value;if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===n||a.value>n)&&(n=a.value):"max"===a.kind&&(null===t||a.value<t)&&(t=a.value)}}catch(e){r.e(e)}finally{r.f()}return Number.isFinite(n)&&Number.isFinite(t)}}]),n}(fe);we.create=function(e){return new we(k({checks:[],typeName:st.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1},de(e)))};var xe=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).min=e.gte,e.max=e.lte,e}return C(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==q.bigint){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.bigint,received:t.parsedType}),ne}var n,r=void 0,a=new te,i=B(this._def.checks);try{for(i.s();!(n=i.n()).done;){var o=n.value;if("min"===o.kind)(o.inclusive?e.data<o.value:e.data<=o.value)&&(X(r=this._getOrReturnCtx(e,r),{code:$.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty());else if("max"===o.kind){(o.inclusive?e.data>o.value:e.data>=o.value)&&(X(r=this._getOrReturnCtx(e,r),{code:$.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty())}else"multipleOf"===o.kind?e.data%o.value!==BigInt(0)&&(X(r=this._getOrReturnCtx(e,r),{code:$.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):z.assertNever(o)}}catch(e){i.e(e)}finally{i.f()}return{status:a.value,value:e.data}}},{key:"gte",value:function(e,t){return this.setLimit("min",e,!0,ee.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,ee.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,ee.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,ee.toString(t))}},{key:"setLimit",value:function(e,t,r,a){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[{kind:e,value:t,inclusive:r,message:ee.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[e])}))}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ee.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ee.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ee.toString(t)})}},{key:"minValue",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"min"===r.kind&&(null===t||r.value>t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"maxValue",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"max"===r.kind&&(null===t||r.value<t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return t}}]),n}(fe);xe.create=function(e){var t;return new xe(k({checks:[],typeName:st.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},de(e)))};var Te=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==q.boolean){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.boolean,received:t.parsedType}),ne}return ae(e.data)}}]),n}(fe);Te.create=function(e){return new Te(k({typeName:st.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1},de(e)))};var Ee=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.date,received:t.parsedType}),ne}if(isNaN(e.data.getTime()))return X(this._getOrReturnCtx(e),{code:$.invalid_date}),ne;var n,r=new te,a=void 0,i=B(this._def.checks);try{for(i.s();!(n=i.n()).done;){var o=n.value;"min"===o.kind?e.data.getTime()<o.value&&(X(a=this._getOrReturnCtx(e,a),{code:$.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):"max"===o.kind?e.data.getTime()>o.value&&(X(a=this._getOrReturnCtx(e,a),{code:$.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):z.assertNever(o)}}catch(e){i.e(e)}finally{i.f()}return{status:r.value,value:new Date(e.data.getTime())}}},{key:"_addCheck",value:function(e){return new n(k(k({},this._def),{},{checks:[].concat(L(this._def.checks),[e])}))}},{key:"min",value:function(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ee.toString(t)})}},{key:"max",value:function(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ee.toString(t)})}},{key:"minDate",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"min"===r.kind&&(null===t||r.value>t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return null!=t?new Date(t):null}},{key:"maxDate",get:function(){var e,t=null,n=B(this._def.checks);try{for(n.s();!(e=n.n()).done;){var r=e.value;"max"===r.kind&&(null===t||r.value<t)&&(t=r.value)}}catch(e){n.e(e)}finally{n.f()}return null!=t?new Date(t):null}}]),n}(fe);Ee.create=function(e){return new Ee(k({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:st.ZodDate},de(e)))};var Oe=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._getType(e)!==q.symbol){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.symbol,received:t.parsedType}),ne}return ae(e.data)}}]),n}(fe);Oe.create=function(e){return new Oe(k({typeName:st.ZodSymbol},de(e)))};var Ce=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._getType(e)!==q.undefined){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.undefined,received:t.parsedType}),ne}return ae(e.data)}}]),n}(fe);Ce.create=function(e){return new Ce(k({typeName:st.ZodUndefined},de(e)))};var Se=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._getType(e)!==q.null){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.null,received:t.parsedType}),ne}return ae(e.data)}}]),n}(fe);Se.create=function(e){return new Se(k({typeName:st.ZodNull},de(e)))};var Ze=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._any=!0,e}return C(n,[{key:"_parse",value:function(e){return ae(e.data)}}]),n}(fe);Ze.create=function(e){return new Ze(k({typeName:st.ZodAny},de(e)))};var je=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._unknown=!0,e}return C(n,[{key:"_parse",value:function(e){return ae(e.data)}}]),n}(fe);je.create=function(e){return new je(k({typeName:st.ZodUnknown},de(e)))};var De=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.never,received:t.parsedType}),ne}}]),n}(fe);De.create=function(e){return new De(k({typeName:st.ZodNever},de(e)))};var Ne=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._getType(e)!==q.undefined){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.void,received:t.parsedType}),ne}return ae(e.data)}}]),n}(fe);Ne.create=function(e){return new Ne(k({typeName:st.ZodVoid},de(e)))};var Pe=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.ctx,r=t.status,a=this._def;if(n.parsedType!==q.array)return X(n,{code:$.invalid_type,expected:q.array,received:n.parsedType}),ne;if(null!==a.exactLength){var i=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(i||o)&&(X(n,{code:i?$.too_big:$.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&n.data.length<a.minLength.value&&(X(n,{code:$.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&n.data.length>a.maxLength.value&&(X(n,{code:$.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all(L(n.data).map((function(e,t){return a.type._parseAsync(new ce(n,e,n.path,t))}))).then((function(e){return te.mergeArray(r,e)}));var u=L(n.data).map((function(e,t){return a.type._parseSync(new ce(n,e,n.path,t))}));return te.mergeArray(r,u)}},{key:"element",get:function(){return this._def.type}},{key:"min",value:function(e,t){return new n(k(k({},this._def),{},{minLength:{value:e,message:ee.toString(t)}}))}},{key:"max",value:function(e,t){return new n(k(k({},this._def),{},{maxLength:{value:e,message:ee.toString(t)}}))}},{key:"length",value:function(e,t){return new n(k(k({},this._def),{},{exactLength:{value:e,message:ee.toString(t)}}))}},{key:"nonempty",value:function(e){return this.min(1,e)}}]),n}(fe);function Re(e){if(e instanceof Ie){var t={};for(var n in e.shape){var r=e.shape[n];t[n]=Xe.create(Re(r))}return new Ie(k(k({},e._def),{},{shape:function(){return t}}))}return e instanceof Pe?new Pe(k(k({},e._def),{},{type:Re(e.element)})):e instanceof Xe?Xe.create(Re(e.unwrap())):e instanceof et?et.create(Re(e.unwrap())):e instanceof Be?Be.create(e.items.map((function(e){return Re(e)}))):e}Pe.create=function(e,t){return new Pe(k({type:e,minLength:null,maxLength:null,exactLength:null,typeName:st.ZodArray},de(t)))};var Ie=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._cached=null,e.nonstrict=e.passthrough,e.augment=e.extend,e}return C(n,[{key:"_getCached",value:function(){if(null!==this._cached)return this._cached;var e=this._def.shape(),t=z.objectKeys(e);return this._cached={shape:e,keys:t}}},{key:"_parse",value:function(e){if(this._getType(e)!==q.object){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.object,received:t.parsedType}),ne}var n=this._processInputParams(e),r=n.status,a=n.ctx,i=this._getCached(),o=i.shape,u=i.keys,s=[];if(!(this._def.catchall instanceof De&&"strip"===this._def.unknownKeys))for(var c in a.data)u.includes(c)||s.push(c);var l,d=[],f=B(u);try{for(f.s();!(l=f.n()).done;){var p=l.value,h=o[p],v=a.data[p];d.push({key:{status:"valid",value:p},value:h._parse(new ce(a,v,a.path,p)),alwaysSet:p in a.data})}}catch(e){f.e(e)}finally{f.f()}if(this._def.catchall instanceof De){var y=this._def.unknownKeys;if("passthrough"===y){var m,g=B(s);try{for(g.s();!(m=g.n()).done;){var _=m.value;d.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}})}}catch(e){g.e(e)}finally{g.f()}}else if("strict"===y)s.length>0&&(X(a,{code:$.unrecognized_keys,keys:s}),r.dirty());else if("strip"!==y)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{var k,w=this._def.catchall,x=B(s);try{for(x.s();!(k=x.n()).done;){var E=k.value,O=a.data[E];d.push({key:{status:"valid",value:E},value:w._parse(new ce(a,O,a.path,E)),alwaysSet:E in a.data})}}catch(e){x.e(e)}finally{x.f()}}return a.common.async?Promise.resolve().then(T(b().mark((function e(){var t,n,r,a,i;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=B(d),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=19;break}return a=r.value,e.next=8,a.key;case 8:return i=e.sent,e.t0=t,e.t1=i,e.next=13,a.value;case 13:e.t2=e.sent,e.t3=a.alwaysSet,e.t4={key:e.t1,value:e.t2,alwaysSet:e.t3},e.t0.push.call(e.t0,e.t4);case 17:e.next=4;break;case 19:e.next=24;break;case 21:e.prev=21,e.t5=e.catch(2),n.e(e.t5);case 24:return e.prev=24,n.f(),e.finish(24);case 27:return e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[2,21,24,27]])})))).then((function(e){return te.mergeObjectSync(r,e)})):te.mergeObjectSync(r,d)}},{key:"shape",get:function(){return this._def.shape()}},{key:"strict",value:function(e){var t=this;return ee.errToObj,new n(k(k({},this._def),{},{unknownKeys:"strict"},void 0!==e?{errorMap:function(n,r){var a,i,o,u,s=null!==(o=null===(i=(a=t._def).errorMap)||void 0===i?void 0:i.call(a,n,r).message)&&void 0!==o?o:r.defaultError;return"unrecognized_keys"===n.code?{message:null!==(u=ee.errToObj(e).message)&&void 0!==u?u:s}:{message:s}}}:{}))}},{key:"strip",value:function(){return new n(k(k({},this._def),{},{unknownKeys:"strip"}))}},{key:"passthrough",value:function(){return new n(k(k({},this._def),{},{unknownKeys:"passthrough"}))}},{key:"extend",value:function(e){var t=this;return new n(k(k({},this._def),{},{shape:function(){return k(k({},t._def.shape()),e)}}))}},{key:"merge",value:function(e){var t=this;return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:function(){return k(k({},t._def.shape()),e._def.shape())},typeName:st.ZodObject})}},{key:"setKey",value:function(e,t){return this.augment(S({},e,t))}},{key:"catchall",value:function(e){return new n(k(k({},this._def),{},{catchall:e}))}},{key:"pick",value:function(e){var t=this,r={};return z.objectKeys(e).forEach((function(n){e[n]&&t.shape[n]&&(r[n]=t.shape[n])})),new n(k(k({},this._def),{},{shape:function(){return r}}))}},{key:"omit",value:function(e){var t=this,r={};return z.objectKeys(this.shape).forEach((function(n){e[n]||(r[n]=t.shape[n])})),new n(k(k({},this._def),{},{shape:function(){return r}}))}},{key:"deepPartial",value:function(){return Re(this)}},{key:"partial",value:function(e){var t=this,r={};return z.objectKeys(this.shape).forEach((function(n){var a=t.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()})),new n(k(k({},this._def),{},{shape:function(){return r}}))}},{key:"required",value:function(e){var t=this,r={};return z.objectKeys(this.shape).forEach((function(n){if(e&&!e[n])r[n]=t.shape[n];else{for(var a=t.shape[n];a instanceof Xe;)a=a._def.innerType;r[n]=a}})),new n(k(k({},this._def),{},{shape:function(){return r}}))}},{key:"keyof",value:function(){return We(z.objectKeys(this.shape))}}]),n}(fe);Ie.create=function(e,t){return new Ie(k({shape:function(){return e},unknownKeys:"strip",catchall:De.create(),typeName:st.ZodObject},de(t)))},Ie.strictCreate=function(e,t){return new Ie(k({shape:function(){return e},unknownKeys:"strict",catchall:De.create(),typeName:st.ZodObject},de(t)))},Ie.lazycreate=function(e,t){return new Ie(k({shape:e,unknownKeys:"strip",catchall:De.create(),typeName:st.ZodObject},de(t)))};var Ae=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,n=this._def.options;if(t.common.async)return Promise.all(n.map(function(){var e=T(b().mark((function e(n){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=k(k({},t),{},{common:k(k({},t.common),{},{issues:[]}),parent:null}),e.next=3,n._parseAsync({data:t.data,path:t.path,parent:r});case 3:return e.t0=e.sent,e.t1=r,e.abrupt("return",{result:e.t0,ctx:e.t1});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())).then((function(e){var n,r=B(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;if("valid"===a.result.status)return a.result}}catch(e){r.e(e)}finally{r.f()}var i,o=B(e);try{for(o.s();!(i=o.n()).done;){var u,s=i.value;if("dirty"===s.result.status)return(u=t.common.issues).push.apply(u,L(s.ctx.common.issues)),s.result}}catch(e){o.e(e)}finally{o.f()}var c=e.map((function(e){return new W(e.ctx.common.issues)}));return X(t,{code:$.invalid_union,unionErrors:c}),ne}));var r,a,i=void 0,o=[],u=B(n);try{for(u.s();!(r=u.n()).done;){var s=r.value,c=k(k({},t),{},{common:k(k({},t.common),{},{issues:[]}),parent:null}),l=s._parseSync({data:t.data,path:t.path,parent:c});if("valid"===l.status)return l;"dirty"!==l.status||i||(i={result:l,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}}catch(e){u.e(e)}finally{u.f()}if(i)return(a=t.common.issues).push.apply(a,L(i.ctx.common.issues)),i.result;var d=o.map((function(e){return new W(e)}));return X(t,{code:$.invalid_union,unionErrors:d}),ne}},{key:"options",get:function(){return this._def.options}}]),n}(fe);Ae.create=function(e,t){return new Ae(k({options:e,typeName:st.ZodUnion},de(t)))};var Fe=function e(t){return t instanceof He?e(t.schema):t instanceof Ye?e(t.innerType()):t instanceof $e?[t.value]:t instanceof Ge?t.options:t instanceof Je?Object.keys(t.enum):t instanceof tt?e(t._def.innerType):t instanceof Ce?[void 0]:t instanceof Se?[null]:null},Le=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;if(t.parsedType!==q.object)return X(t,{code:$.invalid_type,expected:q.object,received:t.parsedType}),ne;var n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(X(t,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ne)}},{key:"discriminator",get:function(){return this._def.discriminator}},{key:"options",get:function(){return this._def.options}},{key:"optionsMap",get:function(){return this._def.optionsMap}}],[{key:"create",value:function(e,t,r){var a,i=new Map,o=B(t);try{for(o.s();!(a=o.n()).done;){var u=a.value,s=Fe(u.shape[e]);if(!s)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));var c,l=B(s);try{for(l.s();!(c=l.n()).done;){var d=c.value;if(i.has(d))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(d)));i.set(d,u)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){o.e(e)}finally{o.f()}return new n(k({typeName:st.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i},de(r)))}}]),n}(fe);function Me(e,t){var n=H(e),r=H(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){var a,i=z.objectKeys(t),o=z.objectKeys(e).filter((function(e){return-1!==i.indexOf(e)})),u=k(k({},e),t),s=B(o);try{for(s.s();!(a=s.n()).done;){var c=a.value,l=Me(e[c],t[c]);if(!l.valid)return{valid:!1};u[c]=l.data}}catch(e){s.e(e)}finally{s.f()}return{valid:!0,data:u}}if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};for(var d=[],f=0;f<e.length;f++){var p=Me(e[f],t[f]);if(!p.valid)return{valid:!1};d.push(p.data)}return{valid:!0,data:d}}return n===q.date&&r===q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ue=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx,a=function(e,t){if(ie(e)||ie(t))return ne;var a=Me(e.value,t.value);return a.valid?((oe(e)||oe(t))&&n.dirty(),{status:n.value,value:a.data}):(X(r,{code:$.invalid_intersection_types}),ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((function(e){var t=F(e,2),n=t[0],r=t[1];return a(n,r)})):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}]),n}(fe);Ue.create=function(e,t,n){return new Ue(k({left:e,right:t,typeName:st.ZodIntersection},de(n)))};var Be=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),r=n.status,a=n.ctx;if(a.parsedType!==q.array)return X(a,{code:$.invalid_type,expected:q.array,received:a.parsedType}),ne;if(a.data.length<this._def.items.length)return X(a,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&a.data.length>this._def.items.length&&(X(a,{code:$.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());var i=L(a.data).map((function(e,n){var r=t._def.items[n]||t._def.rest;return r?r._parse(new ce(a,e,a.path,n)):null})).filter((function(e){return!!e}));return a.common.async?Promise.all(i).then((function(e){return te.mergeArray(r,e)})):te.mergeArray(r,i)}},{key:"items",get:function(){return this._def.items}},{key:"rest",value:function(e){return new n(k(k({},this._def),{},{rest:e}))}}]),n}(fe);Be.create=function(e,t){if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Be(k({items:e,typeName:st.ZodTuple,rest:null},de(t)))};var Ve=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"keySchema",get:function(){return this._def.keyType}},{key:"valueSchema",get:function(){return this._def.valueType}},{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx;if(r.parsedType!==q.object)return X(r,{code:$.invalid_type,expected:q.object,received:r.parsedType}),ne;var a=[],i=this._def.keyType,o=this._def.valueType;for(var u in r.data)a.push({key:i._parse(new ce(r,u,r.path,u)),value:o._parse(new ce(r,r.data[u],r.path,u))});return r.common.async?te.mergeObjectAsync(n,a):te.mergeObjectSync(n,a)}},{key:"element",get:function(){return this._def.valueType}}],[{key:"create",value:function(e,t,r){return new n(t instanceof fe?k({keyType:e,valueType:t,typeName:st.ZodRecord},de(r)):k({keyType:be.create(),valueType:e,typeName:st.ZodRecord},de(t)))}}]),n}(fe),ze=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"keySchema",get:function(){return this._def.keyType}},{key:"valueSchema",get:function(){return this._def.valueType}},{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx;if(r.parsedType!==q.map)return X(r,{code:$.invalid_type,expected:q.map,received:r.parsedType}),ne;var a=this._def.keyType,i=this._def.valueType,o=L(r.data.entries()).map((function(e,t){var n=F(e,2),o=n[0],u=n[1];return{key:a._parse(new ce(r,o,r.path,[t,"key"])),value:i._parse(new ce(r,u,r.path,[t,"value"]))}}));if(r.common.async){var u=new Map;return Promise.resolve().then(T(b().mark((function e(){var t,r,a,i,s;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=B(o),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=17;break}return a=r.value,e.next=7,a.key;case 7:return i=e.sent,e.next=10,a.value;case 10:if(s=e.sent,"aborted"!==i.status&&"aborted"!==s.status){e.next=13;break}return e.abrupt("return",ne);case 13:"dirty"!==i.status&&"dirty"!==s.status||n.dirty(),u.set(i.value,s.value);case 15:e.next=3;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(1),t.e(e.t0);case 22:return e.prev=22,t.f(),e.finish(22);case 25:return e.abrupt("return",{status:n.value,value:u});case 26:case"end":return e.stop()}}),e,null,[[1,19,22,25]])}))))}var s,c=new Map,l=B(o);try{for(l.s();!(s=l.n()).done;){var d=s.value,f=d.key,p=d.value;if("aborted"===f.status||"aborted"===p.status)return ne;"dirty"!==f.status&&"dirty"!==p.status||n.dirty(),c.set(f.value,p.value)}}catch(e){l.e(e)}finally{l.f()}return{status:n.value,value:c}}}]),n}(fe);ze.create=function(e,t,n){return new ze(k({valueType:t,keyType:e,typeName:st.ZodMap},de(n)))};var Ke=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx;if(r.parsedType!==q.set)return X(r,{code:$.invalid_type,expected:q.set,received:r.parsedType}),ne;var a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(X(r,{code:$.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(X(r,{code:$.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());var i=this._def.valueType;function o(e){var t,r=new Set,a=B(e);try{for(a.s();!(t=a.n()).done;){var i=t.value;if("aborted"===i.status)return ne;"dirty"===i.status&&n.dirty(),r.add(i.value)}}catch(e){a.e(e)}finally{a.f()}return{status:n.value,value:r}}var u=L(r.data.values()).map((function(e,t){return i._parse(new ce(r,e,r.path,t))}));return r.common.async?Promise.all(u).then((function(e){return o(e)})):o(u)}},{key:"min",value:function(e,t){return new n(k(k({},this._def),{},{minSize:{value:e,message:ee.toString(t)}}))}},{key:"max",value:function(e,t){return new n(k(k({},this._def),{},{maxSize:{value:e,message:ee.toString(t)}}))}},{key:"size",value:function(e,t){return this.min(e,t).max(e,t)}},{key:"nonempty",value:function(e){return this.min(1,e)}}]),n}(fe);Ke.create=function(e,t){return new Ke(k({valueType:e,minSize:null,maxSize:null,typeName:st.ZodSet},de(t)))};var qe=function(e){Z(n,e);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).validate=e.implement,e}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;if(t.parsedType!==q.function)return X(t,{code:$.invalid_type,expected:q.function,received:t.parsedType}),ne;function n(e,n){return Y({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Q(),G].filter((function(e){return!!e})),issueData:{code:$.invalid_arguments,argumentsError:n}})}function r(e,n){return Y({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Q(),G].filter((function(e){return!!e})),issueData:{code:$.invalid_return_type,returnTypeError:n}})}var a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Qe){var o=this;return ae(T(b().mark((function e(){var t,u,s,c,l,d,f,p=arguments;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=p.length,u=new Array(t),s=0;s<t;s++)u[s]=p[s];return c=new W([]),e.next=4,o._def.args.parseAsync(u,a).catch((function(e){throw c.addIssue(n(u,e)),c}));case 4:return l=e.sent,e.next=7,Reflect.apply(i,this,l);case 7:return d=e.sent,e.next=10,o._def.returns._def.type.parseAsync(d,a).catch((function(e){throw c.addIssue(r(d,e)),c}));case 10:return f=e.sent,e.abrupt("return",f);case 12:case"end":return e.stop()}}),e,this)}))))}var u=this;return ae((function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var s=u._def.args.safeParse(t,a);if(!s.success)throw new W([n(t,s.error)]);var c=Reflect.apply(i,this,s.data),l=u._def.returns.safeParse(c,a);if(!l.success)throw new W([r(c,l.error)]);return l.data}))}},{key:"parameters",value:function(){return this._def.args}},{key:"returnType",value:function(){return this._def.returns}},{key:"args",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new n(k(k({},this._def),{},{args:Be.create(t).rest(je.create())}))}},{key:"returns",value:function(e){return new n(k(k({},this._def),{},{returns:e}))}},{key:"implement",value:function(e){return this.parse(e)}},{key:"strictImplement",value:function(e){return this.parse(e)}}],[{key:"create",value:function(e,t,r){return new n(k({args:e||Be.create([]).rest(je.create()),returns:t||je.create(),typeName:st.ZodFunction},de(r)))}}]),n}(fe),He=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"schema",get:function(){return this._def.getter()}},{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}]),n}(fe);He.create=function(e,t){return new He(k({getter:e,typeName:st.ZodLazy},de(t)))};var $e=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(e.data!==this._def.value){var t=this._getOrReturnCtx(e);return X(t,{received:t.data,code:$.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}},{key:"value",get:function(){return this._def.value}}]),n}(fe);function We(e,t){return new Ge(k({values:e,typeName:st.ZodEnum},de(t)))}$e.create=function(e,t){return new $e(k({value:e,typeName:st.ZodLiteral},de(t)))};var Ge=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if("string"!=typeof e.data){var t=this._getOrReturnCtx(e),n=this._def.values;return X(t,{expected:z.joinValues(n),received:t.parsedType,code:$.invalid_type}),ne}if(-1===this._def.values.indexOf(e.data)){var r=this._getOrReturnCtx(e),a=this._def.values;return X(r,{received:r.data,code:$.invalid_enum_value,options:a}),ne}return ae(e.data)}},{key:"options",get:function(){return this._def.values}},{key:"enum",get:function(){var e,t={},n=B(this._def.values);try{for(n.s();!(e=n.n()).done;){var r=e.value;t[r]=r}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"Values",get:function(){var e,t={},n=B(this._def.values);try{for(n.s();!(e=n.n()).done;){var r=e.value;t[r]=r}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"Enum",get:function(){var e,t={},n=B(this._def.values);try{for(n.s();!(e=n.n()).done;){var r=e.value;t[r]=r}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"extract",value:function(e){return n.create(e)}},{key:"exclude",value:function(e){return n.create(this.options.filter((function(t){return!e.includes(t)})))}}]),n}(fe);Ge.create=We;var Je=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=z.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==q.string&&n.parsedType!==q.number){var r=z.objectValues(t);return X(n,{expected:z.joinValues(r),received:n.parsedType,code:$.invalid_type}),ne}if(-1===t.indexOf(e.data)){var a=z.objectValues(t);return X(n,{received:n.data,code:$.invalid_enum_value,options:a}),ne}return ae(e.data)}},{key:"enum",get:function(){return this._def.values}}]),n}(fe);Je.create=function(e,t){return new Je(k({values:e,typeName:st.ZodNativeEnum},de(t)))};var Qe=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"unwrap",value:function(){return this._def.type}},{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e).ctx;if(n.parsedType!==q.promise&&!1===n.common.async)return X(n,{code:$.invalid_type,expected:q.promise,received:n.parsedType}),ne;var r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return ae(r.then((function(e){return t._def.type.parseAsync(e,{path:n.path,errorMap:n.common.contextualErrorMap})})))}}]),n}(fe);Qe.create=function(e,t){return new Qe(k({type:e,typeName:st.ZodPromise},de(t)))};var Ye=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"innerType",value:function(){return this._def.schema}},{key:"sourceType",value:function(){return this._def.schema._def.typeName===st.ZodEffects?this._def.schema.sourceType():this._def.schema}},{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),r=n.status,a=n.ctx,i=this._def.effect||null,o={addIssue:function(e){X(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===i.type){var u=i.transform(a.data,o);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(u).then((function(e){return t._def.schema._parseAsync({data:e,path:a.path,parent:a})})):this._def.schema._parseSync({data:u,path:a.path,parent:a})}if("refinement"===i.type){var s=function(e){var t=i.refinement(e,o);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){var c=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===c.status?ne:("dirty"===c.status&&r.dirty(),s(c.value),{status:r.value,value:c.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((function(e){return"aborted"===e.status?ne:("dirty"===e.status&&r.dirty(),s(e.value).then((function(){return{status:r.value,value:e.value}})))}))}if("transform"===i.type){if(!1===a.common.async){var l=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!ue(l))return l;var d=i.transform(l.value,o);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:d}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((function(e){return ue(e)?Promise.resolve(i.transform(e.value,o)).then((function(e){return{status:r.value,value:e}})):e}))}z.assertNever(i)}}]),n}(fe);Ye.create=function(e,t,n){return new Ye(k({schema:e,typeName:st.ZodEffects,effect:t},de(n)))},Ye.createWithPreprocess=function(e,t,n){return new Ye(k({schema:t,effect:{type:"preprocess",transform:e},typeName:st.ZodEffects},de(n)))};var Xe=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){return this._getType(e)===q.undefined?ae(void 0):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),n}(fe);Xe.create=function(e,t){return new Xe(k({innerType:e,typeName:st.ZodOptional},de(t)))};var et=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){return this._getType(e)===q.null?ae(null):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),n}(fe);et.create=function(e,t){return new et(k({innerType:e,typeName:st.ZodNullable},de(t)))};var tt=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,n=t.data;return t.parsedType===q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}},{key:"removeDefault",value:function(){return this._def.innerType}}]),n}(fe);tt.create=function(e,t){return new tt(k({innerType:e,typeName:st.ZodDefault,defaultValue:"function"==typeof t.default?t.default:function(){return t.default}},de(t)))};var nt=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e).ctx,r=k(k({},n),{},{common:k(k({},n.common),{},{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:k({},r)});return se(a)?a.then((function(e){return{status:"valid",value:"valid"===e.status?e.value:t._def.catchValue({get error(){return new W(r.common.issues)},input:r.data})}})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new W(r.common.issues)},input:r.data})}}},{key:"removeCatch",value:function(){return this._def.innerType}}]),n}(fe);nt.create=function(e,t){return new nt(k({innerType:e,typeName:st.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:function(){return t.catch}},de(t)))};var rt=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){if(this._getType(e)!==q.nan){var t=this._getOrReturnCtx(e);return X(t,{code:$.invalid_type,expected:q.nan,received:t.parsedType}),ne}return{status:"valid",value:e.data}}}]),n}(fe);rt.create=function(e){return new rt(k({typeName:st.ZodNaN},de(e)))};var at=Symbol("zod_brand"),it=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}},{key:"unwrap",value:function(){return this._def.type}}]),n}(fe),ot=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),r=n.status,a=n.ctx;if(a.common.async){var i=function(){var e=T(b().mark((function e(){var n;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._def.in._parseAsync({data:a.data,path:a.path,parent:a});case 2:if("aborted"!==(n=e.sent).status){e.next=5;break}return e.abrupt("return",ne);case 5:if("dirty"!==n.status){e.next=10;break}return r.dirty(),e.abrupt("return",re(n.value));case 10:return e.abrupt("return",t._def.out._parseAsync({data:n.value,path:a.path,parent:a}));case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return i()}var o=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===o.status?ne:"dirty"===o.status?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:a.path,parent:a})}}],[{key:"create",value:function(e,t){return new n({in:e,out:t,typeName:st.ZodPipeline})}}]),n}(fe),ut=function(e){Z(n,e);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return C(n,[{key:"_parse",value:function(e){var t=this._def.innerType._parse(e);return ue(t)&&(t.value=Object.freeze(t.value)),t}}]),n}(fe);ut.create=function(e,t){return new ut(k({innerType:e,typeName:st.ZodReadonly},de(t)))};var st,ct=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return e?Ze.create().superRefine((function(r,a){var i,o;if(!e(r)){var u="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=u.fatal)&&void 0!==i?i:n)||void 0===o||o,c="string"==typeof u?{message:u}:u;a.addIssue(k(k({code:"custom"},c),{},{fatal:s}))}})):Ze.create()},lt={object:Ie.lazycreate};!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"}(st||(st={}));var dt,ft,pt,ht,vt=be.create,yt=we.create,mt=rt.create,gt=xe.create,_t=Te.create,kt=Ee.create,bt=Oe.create,wt=Ce.create,xt=Se.create,Tt=Ze.create,Et=je.create,Ot=De.create,Ct=Ne.create,St=Pe.create,Zt=Ie.create,jt=Ie.strictCreate,Dt=Ae.create,Nt=Le.create,Pt=Ue.create,Rt=Be.create,It=Ve.create,At=ze.create,Ft=Ke.create,Lt=qe.create,Mt=He.create,Ut=$e.create,Bt=Ge.create,Vt=Je.create,zt=Qe.create,Kt=Ye.create,qt=Xe.create,Ht=et.create,$t=Ye.createWithPreprocess,Wt=ot.create,Gt={string:function(e){return be.create(k(k({},e),{},{coerce:!0}))},number:function(e){return we.create(k(k({},e),{},{coerce:!0}))},boolean:function(e){return Te.create(k(k({},e),{},{coerce:!0}))},bigint:function(e){return xe.create(k(k({},e),{},{coerce:!0}))},date:function(e){return Ee.create(k(k({},e),{},{coerce:!0}))}},Jt=ne,Qt=Object.freeze({__proto__:null,defaultErrorMap:G,setErrorMap:function(e){J=e},getErrorMap:Q,makeIssue:Y,EMPTY_PATH:[],addIssueToContext:X,ParseStatus:te,INVALID:ne,DIRTY:re,OK:ae,isAborted:ie,isDirty:oe,isValid:ue,isAsync:se,get util(){return z},get objectUtil(){return K},ZodParsedType:q,getParsedType:H,ZodType:fe,ZodString:be,ZodNumber:we,ZodBigInt:xe,ZodBoolean:Te,ZodDate:Ee,ZodSymbol:Oe,ZodUndefined:Ce,ZodNull:Se,ZodAny:Ze,ZodUnknown:je,ZodNever:De,ZodVoid:Ne,ZodArray:Pe,ZodObject:Ie,ZodUnion:Ae,ZodDiscriminatedUnion:Le,ZodIntersection:Ue,ZodTuple:Be,ZodRecord:Ve,ZodMap:ze,ZodSet:Ke,ZodFunction:qe,ZodLazy:He,ZodLiteral:$e,ZodEnum:Ge,ZodNativeEnum:Je,ZodPromise:Qe,ZodEffects:Ye,ZodTransformer:Ye,ZodOptional:Xe,ZodNullable:et,ZodDefault:tt,ZodCatch:nt,ZodNaN:rt,BRAND:at,ZodBranded:it,ZodPipeline:ot,ZodReadonly:ut,custom:ct,Schema:fe,ZodSchema:fe,late:lt,get ZodFirstPartyTypeKind(){return st},coerce:Gt,any:Tt,array:St,bigint:gt,boolean:_t,date:kt,discriminatedUnion:Nt,effect:Kt,enum:Bt,function:Lt,instanceof:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{message:"Input not instance of ".concat(e.name)};return ct((function(t){return t instanceof e}),t)},intersection:Pt,lazy:Mt,literal:Ut,map:At,nan:mt,nativeEnum:Vt,never:Ot,null:xt,nullable:Ht,number:yt,object:Zt,oboolean:function(){return _t().optional()},onumber:function(){return yt().optional()},optional:qt,ostring:function(){return vt().optional()},pipeline:Wt,preprocess:$t,promise:zt,record:It,set:Ft,strictObject:jt,string:vt,symbol:bt,transformer:Kt,tuple:Rt,undefined:wt,union:Dt,unknown:Et,void:Ct,NEVER:Jt,ZodIssueCode:$,quotelessJson:function(e){return JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:")},ZodError:W});e.MobileCredentialVerificationReasonType=void 0,(dt=e.MobileCredentialVerificationReasonType||(e.MobileCredentialVerificationReasonType={})).Expired="expired",dt.Inactive="inactive",e.ClaimType=void 0,(ft=e.ClaimType||(e.ClaimType={})).Boolean="boolean",ft.Number="number",ft.String="string",ft.Binary="binary",ft.Date="date",ft.DateTime="dateTime",ft.Array="array",ft.Object="object",e.CredentialBrandingImageFormat=void 0,(pt=e.CredentialBrandingImageFormat||(e.CredentialBrandingImageFormat={})).svg="svg",pt.png="png",function(e){e.NotReturned="notReturned"}(ht||(ht={})),e.OpenidPresentationCredentialProfileSupported=void 0,(e.OpenidPresentationCredentialProfileSupported||(e.OpenidPresentationCredentialProfileSupported={})).MOBILE="mobile";const Yt=Qt.object({profile:Qt.enum([e.OpenidPresentationCredentialProfileSupported.MOBILE]),docType:Qt.string(),nameSpaces:Qt.record(Qt.record(Qt.object({intentToRetain:Qt.boolean().optional()}).strict()))});var Xt;!function(e){e.SessionAborted="SessionAborted",e.VerificationError="VerificationError",e.ResponseError="ResponseError",e.Unknown="Unknown"}(Xt||(Xt={}));const en=Qt.object({sessionId:Qt.string(),challenge:Qt.string(),credentialQuery:Qt.unknown().optional(),credentials:Qt.unknown().optional(),credentialErrors:Qt.unknown().optional()});Qt.object({credentialQuery:Yt.array(),challenge:Qt.string(),redirectUri:Qt.string().optional()});const tn=Qt.object({sessionId:Qt.string(),sessionUrl:Qt.string()});var nn,rn;!function(e){e.challenge="mattr_chg",e.sessionId="mattr_sid"}(nn||(nn={})),e.Mode=void 0,(rn=e.Mode||(e.Mode={})).sameDevice="sameDevice",rn.crossDevice="crossDevice";const an=Qt.object({credentialQuery:Qt.array(Yt).nonempty(),challenge:Qt.string().optional(),redirectUri:Qt.string(),mode:Qt.enum([e.Mode.sameDevice]).optional()}),on=Qt.object({apiBaseUrl:Qt.string()});let un;var sn;!function(e){e.SdkNotInitialised="SDK not initialised"}(sn||(sn={}));const cn=()=>un,ln=()=>{const e=window.crypto.getRandomValues(new Uint8Array(32)),t=String.fromCharCode(...Array.from(e));return window.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")};var dn;e.RequestCredentialsErrorType=void 0,(e.RequestCredentialsErrorType||(e.RequestCredentialsErrorType={})).RequestCredentialsFailed="RequestCredentialsFailed",function(e){e.FailedToStoreChallenge="Failed to store challenge",e.FailedToCreateSession="Failed to create session"}(dn||(dn={}));const fn=async n=>{const r=cn();if(!r)throw new t(sn.SdkNotInitialised);v(an,"Invalid same device request credential options")(n);const{apiBaseUrl:a}=r,{challenge:i=ln(),credentialQuery:o,redirectUri:u}=n;window.localStorage.setItem(nn.challenge,i);const l=window.localStorage.getItem(nn.challenge);if(!l)return c({type:e.RequestCredentialsErrorType.RequestCredentialsFailed,message:dn.FailedToStoreChallenge});const d=await(async({credentialQuery:e,challenge:t,redirectUri:n,apiBaseUrl:r})=>{const a=Object.assign({credentialQuery:e,challenge:t},n?{redirectUri:n}:{}),i=await g(`${r}/v2/presentations/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(i.isErr())return c(i.error);const o=await i.value.json();return h(tn)(o)?s(o):c({type:y.UnexpectedRespond,message:"Create session return unsupported response"})})({credentialQuery:o,challenge:l,redirectUri:u,apiBaseUrl:a});if(d.isErr())return c({type:e.RequestCredentialsErrorType.RequestCredentialsFailed,message:dn.FailedToCreateSession,cause:d.error});const{sessionUrl:f,sessionId:p}=d.value;return window.localStorage.setItem(nn.sessionId,p),window.location.assign(f),s({sessionId:p})};var pn;e.HandleRedirectCallbackErrorType=void 0,(e.HandleRedirectCallbackErrorType||(e.HandleRedirectCallbackErrorType={})).HandleRedirectCallbackFailed="HandleRedirectCallbackFailed",function(e){e.FailedToFindResponseCode="Failed to find response code",e.FailedToFindChallenge="Failed to find challenge",e.FailedToFindSessionId="Failed to find sessionId",e.FailedToGetSessionResult="Failed to get session result"}(pn||(pn={}));const hn={generateChallenge:ln,unwrap:(e,n)=>{if(e.isOk())return e.value;throw new t(null!=n?n:"Error unwrapping result",e.error)}};e.handleRedirectCallback=async()=>{const n=cn();if(!n)throw new t(sn.SdkNotInitialised);const{apiBaseUrl:r}=n,a=(i=window.location.hash,o="response_code",new URLSearchParams(i.split("#")[1]).get(o));var i,o;if(!a)return c({type:e.HandleRedirectCallbackErrorType.HandleRedirectCallbackFailed,message:pn.FailedToFindResponseCode});const u=window.localStorage.getItem(nn.challenge);if(!u)return c({type:e.HandleRedirectCallbackErrorType.HandleRedirectCallbackFailed,message:pn.FailedToFindChallenge});const l=window.localStorage.getItem(nn.sessionId);if(!l)return c({type:e.HandleRedirectCallbackErrorType.HandleRedirectCallbackFailed,message:pn.FailedToFindSessionId});const d=await(async({challenge:e,responseCode:t,sessionId:n,apiBaseUrl:r})=>{const a={challenge:e,responseCode:t},i=await g(`${r}/v2/presentations/sessions/${n}/result`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(i.isErr())return c(i.error);const o=await i.value.json();return h(en)(o)?s(o):c({type:y.UnexpectedRespond,message:"Get session result return unsupported response",details:{data:o}})})({challenge:u,responseCode:a,sessionId:l,apiBaseUrl:r});return d.isErr()?c({type:e.HandleRedirectCallbackErrorType.HandleRedirectCallbackFailed,message:pn.FailedToGetSessionResult,cause:d.error}):s({result:d.value})},e.initialise=e=>{v(on,"Invalid initialise options")(e),un=e},e.requestCredentials=async t=>{if(e.Mode.sameDevice===e.Mode.sameDevice)return await fn(t);throw new Error("Not implemented cross device mode yet")},e.utils=hn,Object.defineProperty(e,"__esModule",{value:!0})}));
35
+ //# sourceMappingURL=verifier-js.production.js.map