@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.
- package/README.md +31 -0
- package/dist/dependencies.txt +67 -0
- package/dist/lib/verifier-js.cjs.js +6685 -0
- package/dist/lib/verifier-js.cjs.js.map +1 -0
- package/dist/typings/common/error.d.ts +74 -0
- package/dist/typings/common/index.d.ts +3 -0
- package/dist/typings/common/safeFetch.d.ts +23 -0
- package/dist/typings/common/validation.d.ts +11 -0
- package/dist/typings/index.d.ts +11 -0
- package/dist/typings/verifier/handleRedirectCallback.d.ts +14 -0
- package/dist/typings/verifier/index.d.ts +5 -0
- package/dist/typings/verifier/initialise.d.ts +7 -0
- package/dist/typings/verifier/requestCredentials.d.ts +12 -0
- package/dist/typings/verifier/types/credential-presentation.d.ts +222 -0
- package/dist/typings/verifier/types/index.d.ts +4 -0
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +29 -0
- package/dist/typings/verifier/utils.d.ts +23 -0
- package/dist/verifier-js.development.js +6419 -0
- package/dist/verifier-js.development.js.map +1 -0
- package/dist/verifier-js.production.esm.js +35 -0
- package/dist/verifier-js.production.esm.js.map +1 -0
- package/dist/verifier-js.production.js +35 -0
- package/dist/verifier-js.production.js.map +1 -0
- package/package.json +33 -0
|
@@ -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
|
+
class e 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 t(e,t,n,r){return new(n||(n=Promise))((function(a,i){function u(e){try{s(r.next(e))}catch(e){i(e)}}function o(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(u,o)}s((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,a,i,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(i){return function(o){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)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 u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(a=u.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){u.label=i[1];break}if(6===i[0]&&u.label<a[1]){u.label=a[1],a=i;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(i);break}a[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}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,o])}}}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.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 u}var a,i={withStackTrace:!1},u=function(e,t,n){return void 0===n&&(n=i),{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=[],a=0;a<arguments.length;a++)n[a]=arguments[a];try{var i=e.apply(void 0,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e}(n));return o(i)}catch(e){return s(t?t(e):e)}}}}(a||(a={}));var o=function(e){return new c(e)},s=function(e){return new l(e)},c=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 o(e(this.value))},e.prototype.mapErr=function(e){return o(this.value)},e.prototype.andThen=function(e){return e(this.value)},e.prototype.orElse=function(e){return o(this.value)},e.prototype.asyncAndThen=function(e){return e(this.value)},e.prototype.asyncMap=function(e){return d.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}(),l=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 s(this.error)},e.prototype.mapErr=function(e){return s(e(this.error))},e.prototype.andThen=function(e){return s(this.error)},e.prototype.orElse=function(e){return e(this.error)},e.prototype.asyncAndThen=function(e){return f(this.error)},e.prototype.asyncMap=function(e){return f(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}();a.fromThrowable;var d=function(){function e(e){this._promise=e}return e.fromSafePromise=function(t){return new e(t.then((function(e){return new c(e)})))},e.fromPromise=function(t,n){return new e(t.then((function(e){return new c(e)})).catch((function(e){return new l(n(e))})))},e.prototype.map=function(r){var a=this;return new e(this._promise.then((function(e){return t(a,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return e.isErr()?[2,new l(e.error)]:(t=c.bind,[4,r(e.value)]);case 1:return[2,new(t.apply(c,[void 0,n.sent()]))]}}))}))})))},e.prototype.mapErr=function(r){var a=this;return new e(this._promise.then((function(e){return t(a,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return e.isOk()?[2,new c(e.value)]:(t=l.bind,[4,r(e.error)]);case 1:return[2,new(t.apply(l,[void 0,n.sent()]))]}}))}))})))},e.prototype.andThen=function(t){return new e(this._promise.then((function(n){if(n.isErr())return new l(n.error);var r=t(n.value);return r instanceof e?r._promise:r})))},e.prototype.orElse=function(r){var a=this;return new e(this._promise.then((function(e){return t(a,void 0,void 0,(function(){return n(this,(function(t){return e.isErr()?[2,r(e.error)]:[2,new c(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}(),f=function(e){return new d(Promise.resolve(new l(e)))};d.fromPromise,d.fromSafePromise;const p=e=>t=>e.safeParse(t).success,h=(t,n)=>r=>{const a=((e,t)=>{const n=t.safeParse(e);return n.success?o(n.data):s(n.error.issues.map((({message:e,path:t})=>({message:e,path:t}))))})(r,t);if(a.isErr())throw new e(n)};var v,y;!function(e){e.UnexpectedRespond="UnexpectedRespond"}(v||(v={})),function(e){e.HttpError="HttpError",e.UnknownError="UnknownError"}(y||(y={}));const m=async(e,t)=>{try{const n=await fetch(e,t);return n.status>299||n.status<200?s({type:y.HttpError,message:`HTTP error, status = ${n.status}`}):o(n)}catch(e){return s({type:y.UnknownError,message:"Unknown error",cause:e})}};function g(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 _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(){k=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:{},u=i.iterator||"@@iterator",o=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,u=Object.create(i.prototype),o=new D(r||[]);return a(u,"_invoke",{value:S(e,n,o)}),u}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 b={};c(b,u,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(N([])));x&&x!==n&&r.call(x,u)&&(b=x);var E=_.prototype=m.prototype=Object.create(b);function O(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(a,i,u,o){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,u,o)}),(function(e){n("throw",e,u,o)})):t.resolve(l).then((function(e){c.value=e,u(c)}),(function(e){return n("throw",e,u,o)}))}o(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 S(t,n,r){var a=f;return function(i,u){if(a===h)throw new Error("Generator is already running");if(a===v){if("throw"===i)throw u;return{value:e,done:!0}}for(r.method=i,r.arg=u;;){var o=r.delegate;if(o){var s=Z(o,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 Z(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,Z(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 u=i.arg;return u?u.done?(n[t.resultName]=u.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):u:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function C(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(C,this),this.reset(!0)}function N(t){if(t||""===t){var n=t[u];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(E,"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(E),e},t.awrap=function(e){return{__await:e}},O(T.prototype),c(T.prototype,o,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,a,i){void 0===i&&(i=Promise);var u=new T(l(e,n,r,a),i);return t.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},O(E),c(E,s,"Generator"),c(E,u,(function(){return this})),c(E,"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 o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],o=u.completion;if("root"===u.tryLoc)return a("end");if(u.tryLoc<=this.prev){var s=r.call(u,"catchLoc"),c=r.call(u,"finallyLoc");if(s&&c){if(this.prev<u.catchLoc)return a(u.catchLoc,!0);if(this.prev<u.finallyLoc)return a(u.finallyLoc)}else if(s){if(this.prev<u.catchLoc)return a(u.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return a(u.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 u=i?i.completion:{};return u.type=e,u.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(u)},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 b(e){return b="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},b(e)}function w(e,t,n,r,a,i,u){try{var o=e[i](u),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,a)}function x(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function u(e){w(i,r,a,u,o,"next",e)}function o(e){w(i,r,a,u,o,"throw",e)}u(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,B(r.key),r)}}function T(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=B(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&&j(e,t)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function j(e,t){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},j(e,t)}function D(){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 N(e,t,n){return N=D()?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&&j(a,n.prototype),a},N.apply(null,arguments)}function I(e){var t="function"==typeof Map?new Map:void 0;return I=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 N(e,arguments,C(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),j(r,e)},I(e)}function P(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=D();return function(){var n,r=C(e);if(t){var a=C(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 P(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,u,o=[],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)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){c=!0,a=e}finally{try{if(!s&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(c)throw a}}return o}}(e,t)||L(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 R(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)||L(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 L(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 M(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=L(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,u=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){o=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(o)throw i}}}}function B(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 V,z;!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=M(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=M(r);try{for(i.s();!(n=i.n()).done;){var u=n.value;a[u]=t[u]}}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=M(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}}(V||(V={})),function(e){e.mergeShapes=function(e,t){return _(_({},e),t)}}(z||(z={}));var K=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),q=function(e){switch(b(e)){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(e)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(e)?K.array:null===e?K.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?K.promise:"undefined"!=typeof Map&&e instanceof Map?K.map:"undefined"!=typeof Set&&e instanceof Set?K.set:"undefined"!=typeof Date&&e instanceof Date?K.date:K.object;default:return K.unknown}},$=V.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,I(Error));var t=A(n);function n(e){var r;E(this,n),(r=t.call(this)).issues=[],r.addIssue=function(e){r.issues=[].concat(R(r.issues),[e])},r.addIssues=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r.issues=[].concat(R(r.issues),R(e))};var a=(this instanceof n?this.constructor:void 0).prototype;return Object.setPrototypeOf?Object.setPrototypeOf(P(r),a):r.__proto__=a,r.name="ZodError",r.issues=e,r}return T(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=M(r.issues);try{for(i.s();!(a=i.n()).done;){var u=a.value;if("invalid_union"===u.code)u.unionErrors.map(e);else if("invalid_return_type"===u.code)e(u.returnTypeError);else if("invalid_arguments"===u.code)e(u.argumentsError);else if(0===u.path.length)n._errors.push(t(u));else for(var o=n,s=0;s<u.path.length;){var c=u.path[s];s===u.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(u))):o[c]=o[c]||{_errors:[]},o=o[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,V.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=M(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}();W.create=function(e){return new W(e)};var G=function(e,t){var n;switch(e.code){case $.invalid_type:n=e.received===K.undefined?"Required":"Expected ".concat(e.expected,", received ").concat(e.received);break;case $.invalid_literal:n="Invalid literal value, expected ".concat(JSON.stringify(e.expected,V.jsonStringifyReplacer));break;case $.unrecognized_keys:n="Unrecognized key(s) in object: ".concat(V.joinValues(e.keys,", "));break;case $.invalid_union:n="Invalid input";break;case $.invalid_union_discriminator:n="Invalid discriminator value. Expected ".concat(V.joinValues(e.options));break;case $.invalid_enum_value:n="Invalid enum value. Expected ".concat(V.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"===b(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,'"'):V.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,V.assertNever(e)}return{message:n}},H=G;function J(){return H}var Q=function(e){var t,n=e.data,r=e.path,a=e.errorMaps,i=e.issueData,u=[].concat(R(r),R(i.path||[])),o=_(_({},i),{},{path:u}),s="",c=M(a.filter((function(e){return!!e})).slice().reverse());try{for(c.s();!(t=c.n()).done;){s=(0,t.value)(o,{data:n,defaultError:s}).message}}catch(e){c.e(e)}finally{c.f()}return _(_({},i),{},{path:u,message:i.message||s})};function Y(e,t){var n=Q({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,J(),G].filter((function(e){return!!e}))});e.common.issues.push(n)}var X,ee=function(){function e(){E(this,e),this.value="valid"}var t;return T(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=M(t);try{for(a.s();!(n=a.n()).done;){var i=n.value;if("aborted"===i.status)return te;"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=x(k().mark((function t(n,r){var a,i,u,o;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=[],i=M(r),t.prev=2,i.s();case 4:if((u=i.n()).done){t.next=17;break}return o=u.value,t.t0=a,t.next=9,o.key;case 9:return t.t1=t.sent,t.next=12,o.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=M(t);try{for(a.s();!(n=a.n()).done;){var i=n.value,u=i.key,o=i.value;if("aborted"===u.status)return te;if("aborted"===o.status)return te;"dirty"===u.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===u.value||void 0===o.value&&!i.alwaysSet||(r[u.value]=o.value)}}catch(e){a.e(e)}finally{a.f()}return{status:e.value,value:r}}}]),e}(),te=Object.freeze({status:"aborted"}),ne=function(e){return{status:"dirty",value:e}},re=function(e){return{status:"valid",value:e}},ae=function(e){return"aborted"===e.status},ie=function(e){return"dirty"===e.status},ue=function(e){return"valid"===e.status},oe=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}}(X||(X={}));var se=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 T(e,[{key:"path",get:function(){var e,t;this._cachedPath.length||(this._key instanceof Array?(e=this._cachedPath).push.apply(e,R(this._path).concat(R(this._key))):(t=this._cachedPath).push.apply(t,R(this._path).concat([this._key])));return this._cachedPath}}]),e}(),ce=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 le(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 de=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 T(e,[{key:"description",get:function(){return this._def.description}},{key:"_getType",value:function(e){return q(e.data)}},{key:"_getOrReturnCtx",value:function(e,t){return t||{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}},{key:"_processInputParams",value:function(e){return{status:new ee,ctx:{common:e.parent.common,data:e.data,parsedType:q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}},{key:"_parseSync",value:function(e){var t=this._parse(e);if(oe(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:q(e)},a=this._parseSync({data:e,path:r.path,parent:r});return ce(r,a)}},{key:"parseAsync",value:(n=x(k().mark((function e(t,n){var r;return k().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=x(k().mark((function e(t,n){var r,a,i;return k().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:q(t)},a=this._parse({data:t,path:r.path,parent:r}),e.next=4,oe(a)?a:Promise.resolve(a);case 4:return i=e.sent,e.abrupt("return",ce(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(_({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 Qe({schema:this,typeName:ot.ZodEffects,effect:{type:"refinement",refinement:e}})}},{key:"superRefine",value:function(e){return this._refinement(e)}},{key:"optional",value:function(){return Ye.create(this,this._def)}},{key:"nullable",value:function(){return Xe.create(this,this._def)}},{key:"nullish",value:function(){return this.nullable().optional()}},{key:"array",value:function(){return Ne.create(this,this._def)}},{key:"promise",value:function(){return Je.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 Qe(_(_({},le(this._def)),{},{schema:this,typeName:ot.ZodEffects,effect:{type:"transform",transform:e}}))}},{key:"default",value:function(e){var t="function"==typeof e?e:function(){return e};return new et(_(_({},le(this._def)),{},{innerType:this,defaultValue:t,typeName:ot.ZodDefault}))}},{key:"brand",value:function(){return new at(_({typeName:ot.ZodBranded,type:this},le(this._def)))}},{key:"catch",value:function(e){var t="function"==typeof e?e:function(){return e};return new tt(_(_({},le(this._def)),{},{innerType:this,catchValue:t,typeName:ot.ZodCatch}))}},{key:"describe",value:function(e){return new(0,this.constructor)(_(_({},this._def),{},{description:e}))}},{key:"pipe",value:function(e){return it.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}(),fe=/^c[^\s-]{8,}$/i,pe=/^[a-z][a-z0-9]*$/,he=/[0-9A-HJKMNP-TV-Z]{26}/,ve=/^[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,ye=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,me=/^((?:[\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]))+$/,ge=/^(((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}))$/,_e=/^(([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 ke=function(e){Z(n,de);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)}),_({validation:n,code:$.invalid_string},X.errToObj(r)))},e.nonempty=function(t){return e.min(1,X.errToObj(t))},e.trim=function(){return new n(_(_({},e._def),{},{checks:[].concat(R(e._def.checks),[{kind:"trim"}])}))},e.toLowerCase=function(){return new n(_(_({},e._def),{},{checks:[].concat(R(e._def.checks),[{kind:"toLowerCase"}])}))},e.toUpperCase=function(){return new n(_(_({},e._def),{},{checks:[].concat(R(e._def.checks),[{kind:"toUpperCase"}])}))},e}return T(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.string,received:t.parsedType}),te}var n,r,a,i,u=new ee,o=void 0,s=M(this._def.checks);try{for(s.s();!(n=s.n()).done;){var c=n.value;if("min"===c.kind)e.data.length<c.value&&(Y(o=this._getOrReturnCtx(e,o),{code:$.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),u.dirty());else if("max"===c.kind)e.data.length>c.value&&(Y(o=this._getOrReturnCtx(e,o),{code:$.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),u.dirty());else if("length"===c.kind){var l=e.data.length>c.value,d=e.data.length<c.value;(l||d)&&(o=this._getOrReturnCtx(e,o),l?Y(o,{code:$.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&Y(o,{code:$.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),u.dirty())}else if("email"===c.kind)ye.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"email",code:$.invalid_string,message:c.message}),u.dirty());else if("emoji"===c.kind)me.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:$.invalid_string,message:c.message}),u.dirty());else if("uuid"===c.kind)ve.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:$.invalid_string,message:c.message}),u.dirty());else if("cuid"===c.kind)fe.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:$.invalid_string,message:c.message}),u.dirty());else if("cuid2"===c.kind)pe.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:$.invalid_string,message:c.message}),u.dirty());else if("ulid"===c.kind)he.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:$.invalid_string,message:c.message}),u.dirty());else if("url"===c.kind)try{new URL(e.data)}catch(t){Y(o=this._getOrReturnCtx(e,o),{validation:"url",code:$.invalid_string,message:c.message}),u.dirty()}else if("regex"===c.kind){c.regex.lastIndex=0,c.regex.test(e.data)||(Y(o=this._getOrReturnCtx(e,o),{validation:"regex",code:$.invalid_string,message:c.message}),u.dirty())}else if("trim"===c.kind)e.data=e.data.trim();else if("includes"===c.kind)e.data.includes(c.value,c.position)||(Y(o=this._getOrReturnCtx(e,o),{code:$.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),u.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)||(Y(o=this._getOrReturnCtx(e,o),{code:$.invalid_string,validation:{startsWith:c.value},message:c.message}),u.dirty());else if("endsWith"===c.kind)e.data.endsWith(c.value)||(Y(o=this._getOrReturnCtx(e,o),{code:$.invalid_string,validation:{endsWith:c.value},message:c.message}),u.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)||(Y(o=this._getOrReturnCtx(e,o),{code:$.invalid_string,validation:"datetime",message:c.message}),u.dirty())}else"ip"===c.kind?(r=e.data,("v4"!==(a=c.version)&&a||!ge.test(r))&&("v6"!==a&&a||!_e.test(r))&&(Y(o=this._getOrReturnCtx(e,o),{validation:"ip",code:$.invalid_string,message:c.message}),u.dirty())):V.assertNever(c)}}catch(e){s.e(e)}finally{s.f()}return{status:u.value,value:e.data}}},{key:"_addCheck",value:function(e){return new n(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[e])}))}},{key:"email",value:function(e){return this._addCheck(_({kind:"email"},X.errToObj(e)))}},{key:"url",value:function(e){return this._addCheck(_({kind:"url"},X.errToObj(e)))}},{key:"emoji",value:function(e){return this._addCheck(_({kind:"emoji"},X.errToObj(e)))}},{key:"uuid",value:function(e){return this._addCheck(_({kind:"uuid"},X.errToObj(e)))}},{key:"cuid",value:function(e){return this._addCheck(_({kind:"cuid"},X.errToObj(e)))}},{key:"cuid2",value:function(e){return this._addCheck(_({kind:"cuid2"},X.errToObj(e)))}},{key:"ulid",value:function(e){return this._addCheck(_({kind:"ulid"},X.errToObj(e)))}},{key:"ip",value:function(e){return this._addCheck(_({kind:"ip"},X.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(_({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},X.errToObj(null==e?void 0:e.message)))}},{key:"regex",value:function(e,t){return this._addCheck(_({kind:"regex",regex:e},X.errToObj(t)))}},{key:"includes",value:function(e,t){return this._addCheck(_({kind:"includes",value:e,position:null==t?void 0:t.position},X.errToObj(null==t?void 0:t.message)))}},{key:"startsWith",value:function(e,t){return this._addCheck(_({kind:"startsWith",value:e},X.errToObj(t)))}},{key:"endsWith",value:function(e,t){return this._addCheck(_({kind:"endsWith",value:e},X.errToObj(t)))}},{key:"min",value:function(e,t){return this._addCheck(_({kind:"min",value:e},X.errToObj(t)))}},{key:"max",value:function(e,t){return this._addCheck(_({kind:"max",value:e},X.errToObj(t)))}},{key:"length",value:function(e,t){return this._addCheck(_({kind:"length",value:e},X.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=M(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=M(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}();ke.create=function(e){var t;return new ke(_({checks:[],typeName:ot.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},le(e)))};var be=function(e){Z(n,de);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 T(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.number,received:t.parsedType}),te}var n,r,a,i,u,o,s=void 0,c=new ee,l=M(this._def.checks);try{for(l.s();!(n=l.n()).done;){var d=n.value;if("int"===d.kind)V.isInteger(e.data)||(Y(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)&&(Y(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)&&(Y(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,u=void 0,o=void 0,i=(r.toString().split(".")[1]||"").length,u=(a.toString().split(".")[1]||"").length,o=i>u?i:u,parseInt(r.toFixed(o).replace(".",""))%parseInt(a.toFixed(o).replace(".",""))/Math.pow(10,o))&&(Y(s=this._getOrReturnCtx(e,s),{code:$.not_multiple_of,multipleOf:d.value,message:d.message}),c.dirty()):"finite"===d.kind?Number.isFinite(e.data)||(Y(s=this._getOrReturnCtx(e,s),{code:$.not_finite,message:d.message}),c.dirty()):V.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,X.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,X.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,X.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,X.toString(t))}},{key:"setLimit",value:function(e,t,r,a){return new n(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[{kind:e,value:t,inclusive:r,message:X.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new n(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[e])}))}},{key:"int",value:function(e){return this._addCheck({kind:"int",message:X.toString(e)})}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}},{key:"finite",value:function(e){return this._addCheck({kind:"finite",message:X.toString(e)})}},{key:"safe",value:function(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.toString(e)})}},{key:"minValue",get:function(){var e,t=null,n=M(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=M(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&&V.isInteger(e.value)}))}},{key:"isFinite",get:function(){var e,t=null,n=null,r=M(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}();be.create=function(e){return new be(_({checks:[],typeName:ot.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1},le(e)))};var we=function(e){Z(n,de);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 T(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==K.bigint){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.bigint,received:t.parsedType}),te}var n,r=void 0,a=new ee,i=M(this._def.checks);try{for(i.s();!(n=i.n()).done;){var u=n.value;if("min"===u.kind)(u.inclusive?e.data<u.value:e.data<=u.value)&&(Y(r=this._getOrReturnCtx(e,r),{code:$.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),a.dirty());else if("max"===u.kind){(u.inclusive?e.data>u.value:e.data>=u.value)&&(Y(r=this._getOrReturnCtx(e,r),{code:$.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),a.dirty())}else"multipleOf"===u.kind?e.data%u.value!==BigInt(0)&&(Y(r=this._getOrReturnCtx(e,r),{code:$.not_multiple_of,multipleOf:u.value,message:u.message}),a.dirty()):V.assertNever(u)}}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,X.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,X.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,X.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,X.toString(t))}},{key:"setLimit",value:function(e,t,r,a){return new n(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[{kind:e,value:t,inclusive:r,message:X.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new n(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[e])}))}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}},{key:"minValue",get:function(){var e,t=null,n=M(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=M(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}();we.create=function(e){var t;return new we(_({checks:[],typeName:ot.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},le(e)))};var xe=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==K.boolean){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.boolean,received:t.parsedType}),te}return re(e.data)}}]),n}();xe.create=function(e){return new xe(_({typeName:ot.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1},le(e)))};var Ee=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.date,received:t.parsedType}),te}if(isNaN(e.data.getTime()))return Y(this._getOrReturnCtx(e),{code:$.invalid_date}),te;var n,r=new ee,a=void 0,i=M(this._def.checks);try{for(i.s();!(n=i.n()).done;){var u=n.value;"min"===u.kind?e.data.getTime()<u.value&&(Y(a=this._getOrReturnCtx(e,a),{code:$.too_small,message:u.message,inclusive:!0,exact:!1,minimum:u.value,type:"date"}),r.dirty()):"max"===u.kind?e.data.getTime()>u.value&&(Y(a=this._getOrReturnCtx(e,a),{code:$.too_big,message:u.message,inclusive:!0,exact:!1,maximum:u.value,type:"date"}),r.dirty()):V.assertNever(u)}}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(_(_({},this._def),{},{checks:[].concat(R(this._def.checks),[e])}))}},{key:"min",value:function(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:X.toString(t)})}},{key:"max",value:function(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.toString(t)})}},{key:"minDate",get:function(){var e,t=null,n=M(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=M(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}();Ee.create=function(e){return new Ee(_({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ot.ZodDate},le(e)))};var Oe=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._getType(e)!==K.symbol){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.symbol,received:t.parsedType}),te}return re(e.data)}}]),n}();Oe.create=function(e){return new Oe(_({typeName:ot.ZodSymbol},le(e)))};var Te=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._getType(e)!==K.undefined){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.undefined,received:t.parsedType}),te}return re(e.data)}}]),n}();Te.create=function(e){return new Te(_({typeName:ot.ZodUndefined},le(e)))};var Se=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._getType(e)!==K.null){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.null,received:t.parsedType}),te}return re(e.data)}}]),n}();Se.create=function(e){return new Se(_({typeName:ot.ZodNull},le(e)))};var Ze=function(e){Z(n,de);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._any=!0,e}return T(n,[{key:"_parse",value:function(e){return re(e.data)}}]),n}();Ze.create=function(e){return new Ze(_({typeName:ot.ZodAny},le(e)))};var Ce=function(e){Z(n,de);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments))._unknown=!0,e}return T(n,[{key:"_parse",value:function(e){return re(e.data)}}]),n}();Ce.create=function(e){return new Ce(_({typeName:ot.ZodUnknown},le(e)))};var je=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.never,received:t.parsedType}),te}}]),n}();je.create=function(e){return new je(_({typeName:ot.ZodNever},le(e)))};var De=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._getType(e)!==K.undefined){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.void,received:t.parsedType}),te}return re(e.data)}}]),n}();De.create=function(e){return new De(_({typeName:ot.ZodVoid},le(e)))};var Ne=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.ctx,r=t.status,a=this._def;if(n.parsedType!==K.array)return Y(n,{code:$.invalid_type,expected:K.array,received:n.parsedType}),te;if(null!==a.exactLength){var i=n.data.length>a.exactLength.value,u=n.data.length<a.exactLength.value;(i||u)&&(Y(n,{code:i?$.too_big:$.too_small,minimum:u?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&&(Y(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&&(Y(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(R(n.data).map((function(e,t){return a.type._parseAsync(new se(n,e,n.path,t))}))).then((function(e){return ee.mergeArray(r,e)}));var o=R(n.data).map((function(e,t){return a.type._parseSync(new se(n,e,n.path,t))}));return ee.mergeArray(r,o)}},{key:"element",get:function(){return this._def.type}},{key:"min",value:function(e,t){return new n(_(_({},this._def),{},{minLength:{value:e,message:X.toString(t)}}))}},{key:"max",value:function(e,t){return new n(_(_({},this._def),{},{maxLength:{value:e,message:X.toString(t)}}))}},{key:"length",value:function(e,t){return new n(_(_({},this._def),{},{exactLength:{value:e,message:X.toString(t)}}))}},{key:"nonempty",value:function(e){return this.min(1,e)}}]),n}();function Ie(e){if(e instanceof Pe){var t={};for(var n in e.shape){var r=e.shape[n];t[n]=Ye.create(Ie(r))}return new Pe(_(_({},e._def),{},{shape:function(){return t}}))}return e instanceof Ne?new Ne(_(_({},e._def),{},{type:Ie(e.element)})):e instanceof Ye?Ye.create(Ie(e.unwrap())):e instanceof Xe?Xe.create(Ie(e.unwrap())):e instanceof Me?Me.create(e.items.map((function(e){return Ie(e)}))):e}Ne.create=function(e,t){return new Ne(_({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ot.ZodArray},le(t)))};var Pe=function(e){Z(n,de);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 T(n,[{key:"_getCached",value:function(){if(null!==this._cached)return this._cached;var e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t}}},{key:"_parse",value:function(e){if(this._getType(e)!==K.object){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.object,received:t.parsedType}),te}var n=this._processInputParams(e),r=n.status,a=n.ctx,i=this._getCached(),u=i.shape,o=i.keys,s=[];if(!(this._def.catchall instanceof je&&"strip"===this._def.unknownKeys))for(var c in a.data)o.includes(c)||s.push(c);var l,d=[],f=M(o);try{for(f.s();!(l=f.n()).done;){var p=l.value,h=u[p],v=a.data[p];d.push({key:{status:"valid",value:p},value:h._parse(new se(a,v,a.path,p)),alwaysSet:p in a.data})}}catch(e){f.e(e)}finally{f.f()}if(this._def.catchall instanceof je){var y=this._def.unknownKeys;if("passthrough"===y){var m,g=M(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&&(Y(a,{code:$.unrecognized_keys,keys:s}),r.dirty());else if("strip"!==y)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{var b,w=this._def.catchall,E=M(s);try{for(E.s();!(b=E.n()).done;){var O=b.value,T=a.data[O];d.push({key:{status:"valid",value:O},value:w._parse(new se(a,T,a.path,O)),alwaysSet:O in a.data})}}catch(e){E.e(e)}finally{E.f()}}return a.common.async?Promise.resolve().then(x(k().mark((function e(){var t,n,r,a,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=M(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 ee.mergeObjectSync(r,e)})):ee.mergeObjectSync(r,d)}},{key:"shape",get:function(){return this._def.shape()}},{key:"strict",value:function(e){var t=this;return X.errToObj,new n(_(_({},this._def),{},{unknownKeys:"strict"},void 0!==e?{errorMap:function(n,r){var a,i,u,o,s=null!==(u=null===(i=(a=t._def).errorMap)||void 0===i?void 0:i.call(a,n,r).message)&&void 0!==u?u:r.defaultError;return"unrecognized_keys"===n.code?{message:null!==(o=X.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}))}},{key:"strip",value:function(){return new n(_(_({},this._def),{},{unknownKeys:"strip"}))}},{key:"passthrough",value:function(){return new n(_(_({},this._def),{},{unknownKeys:"passthrough"}))}},{key:"extend",value:function(e){var t=this;return new n(_(_({},this._def),{},{shape:function(){return _(_({},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 _(_({},t._def.shape()),e._def.shape())},typeName:ot.ZodObject})}},{key:"setKey",value:function(e,t){return this.augment(S({},e,t))}},{key:"catchall",value:function(e){return new n(_(_({},this._def),{},{catchall:e}))}},{key:"pick",value:function(e){var t=this,r={};return V.objectKeys(e).forEach((function(n){e[n]&&t.shape[n]&&(r[n]=t.shape[n])})),new n(_(_({},this._def),{},{shape:function(){return r}}))}},{key:"omit",value:function(e){var t=this,r={};return V.objectKeys(this.shape).forEach((function(n){e[n]||(r[n]=t.shape[n])})),new n(_(_({},this._def),{},{shape:function(){return r}}))}},{key:"deepPartial",value:function(){return Ie(this)}},{key:"partial",value:function(e){var t=this,r={};return V.objectKeys(this.shape).forEach((function(n){var a=t.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()})),new n(_(_({},this._def),{},{shape:function(){return r}}))}},{key:"required",value:function(e){var t=this,r={};return V.objectKeys(this.shape).forEach((function(n){if(e&&!e[n])r[n]=t.shape[n];else{for(var a=t.shape[n];a instanceof Ye;)a=a._def.innerType;r[n]=a}})),new n(_(_({},this._def),{},{shape:function(){return r}}))}},{key:"keyof",value:function(){return We(V.objectKeys(this.shape))}}]),n}();Pe.create=function(e,t){return new Pe(_({shape:function(){return e},unknownKeys:"strip",catchall:je.create(),typeName:ot.ZodObject},le(t)))},Pe.strictCreate=function(e,t){return new Pe(_({shape:function(){return e},unknownKeys:"strict",catchall:je.create(),typeName:ot.ZodObject},le(t)))},Pe.lazycreate=function(e,t){return new Pe(_({shape:e,unknownKeys:"strip",catchall:je.create(),typeName:ot.ZodObject},le(t)))};var Ae=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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=x(k().mark((function e(n){var r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=_(_({},t),{},{common:_(_({},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=M(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,u=M(e);try{for(u.s();!(i=u.n()).done;){var o,s=i.value;if("dirty"===s.result.status)return(o=t.common.issues).push.apply(o,R(s.ctx.common.issues)),s.result}}catch(e){u.e(e)}finally{u.f()}var c=e.map((function(e){return new W(e.ctx.common.issues)}));return Y(t,{code:$.invalid_union,unionErrors:c}),te}));var r,a,i=void 0,u=[],o=M(n);try{for(o.s();!(r=o.n()).done;){var s=r.value,c=_(_({},t),{},{common:_(_({},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&&u.push(c.common.issues)}}catch(e){o.e(e)}finally{o.f()}if(i)return(a=t.common.issues).push.apply(a,R(i.ctx.common.issues)),i.result;var d=u.map((function(e){return new W(e)}));return Y(t,{code:$.invalid_union,unionErrors:d}),te}},{key:"options",get:function(){return this._def.options}}]),n}();Ae.create=function(e,t){return new Ae(_({options:e,typeName:ot.ZodUnion},le(t)))};var Fe=function e(t){return t instanceof qe?e(t.schema):t instanceof Qe?e(t.innerType()):t instanceof $e?[t.value]:t instanceof Ge?t.options:t instanceof He?Object.keys(t.enum):t instanceof et?e(t._def.innerType):t instanceof Te?[void 0]:t instanceof Se?[null]:null},Re=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;if(t.parsedType!==K.object)return Y(t,{code:$.invalid_type,expected:K.object,received:t.parsedType}),te;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}):(Y(t,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),te)}},{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,u=M(t);try{for(u.s();!(a=u.n()).done;){var o=a.value,s=Fe(o.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=M(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,o)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){u.e(e)}finally{u.f()}return new n(_({typeName:ot.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i},le(r)))}}]),n}();function Le(e,t){var n=q(e),r=q(t);if(e===t)return{valid:!0,data:e};if(n===K.object&&r===K.object){var a,i=V.objectKeys(t),u=V.objectKeys(e).filter((function(e){return-1!==i.indexOf(e)})),o=_(_({},e),t),s=M(u);try{for(s.s();!(a=s.n()).done;){var c=a.value,l=Le(e[c],t[c]);if(!l.valid)return{valid:!1};o[c]=l.data}}catch(e){s.e(e)}finally{s.f()}return{valid:!0,data:o}}if(n===K.array&&r===K.array){if(e.length!==t.length)return{valid:!1};for(var d=[],f=0;f<e.length;f++){var p=Le(e[f],t[f]);if(!p.valid)return{valid:!1};d.push(p.data)}return{valid:!0,data:d}}return n===K.date&&r===K.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ue=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx,a=function(e,t){if(ae(e)||ae(t))return te;var a=Le(e.value,t.value);return a.valid?((ie(e)||ie(t))&&n.dirty(),{status:n.value,value:a.data}):(Y(r,{code:$.invalid_intersection_types}),te)};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}();Ue.create=function(e,t,n){return new Ue(_({left:e,right:t,typeName:ot.ZodIntersection},le(n)))};var Me=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),r=n.status,a=n.ctx;if(a.parsedType!==K.array)return Y(a,{code:$.invalid_type,expected:K.array,received:a.parsedType}),te;if(a.data.length<this._def.items.length)return Y(a,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),te;!this._def.rest&&a.data.length>this._def.items.length&&(Y(a,{code:$.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());var i=R(a.data).map((function(e,n){var r=t._def.items[n]||t._def.rest;return r?r._parse(new se(a,e,a.path,n)):null})).filter((function(e){return!!e}));return a.common.async?Promise.all(i).then((function(e){return ee.mergeArray(r,e)})):ee.mergeArray(r,i)}},{key:"items",get:function(){return this._def.items}},{key:"rest",value:function(e){return new n(_(_({},this._def),{},{rest:e}))}}]),n}();Me.create=function(e,t){if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Me(_({items:e,typeName:ot.ZodTuple,rest:null},le(t)))};var Be=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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!==K.object)return Y(r,{code:$.invalid_type,expected:K.object,received:r.parsedType}),te;var a=[],i=this._def.keyType,u=this._def.valueType;for(var o in r.data)a.push({key:i._parse(new se(r,o,r.path,o)),value:u._parse(new se(r,r.data[o],r.path,o))});return r.common.async?ee.mergeObjectAsync(n,a):ee.mergeObjectSync(n,a)}},{key:"element",get:function(){return this._def.valueType}}],[{key:"create",value:function(e,t,r){return new n(t instanceof de?_({keyType:e,valueType:t,typeName:ot.ZodRecord},le(r)):_({keyType:ke.create(),valueType:e,typeName:ot.ZodRecord},le(t)))}}]),n}(),Ve=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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!==K.map)return Y(r,{code:$.invalid_type,expected:K.map,received:r.parsedType}),te;var a=this._def.keyType,i=this._def.valueType,u=R(r.data.entries()).map((function(e,t){var n=F(e,2),u=n[0],o=n[1];return{key:a._parse(new se(r,u,r.path,[t,"key"])),value:i._parse(new se(r,o,r.path,[t,"value"]))}}));if(r.common.async){var o=new Map;return Promise.resolve().then(x(k().mark((function e(){var t,r,a,i,s;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=M(u),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",te);case 13:"dirty"!==i.status&&"dirty"!==s.status||n.dirty(),o.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:o});case 26:case"end":return e.stop()}}),e,null,[[1,19,22,25]])}))))}var s,c=new Map,l=M(u);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 te;"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}();Ve.create=function(e,t,n){return new Ve(_({valueType:t,keyType:e,typeName:ot.ZodMap},le(n)))};var ze=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,r=t.ctx;if(r.parsedType!==K.set)return Y(r,{code:$.invalid_type,expected:K.set,received:r.parsedType}),te;var a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(Y(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&&(Y(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 u(e){var t,r=new Set,a=M(e);try{for(a.s();!(t=a.n()).done;){var i=t.value;if("aborted"===i.status)return te;"dirty"===i.status&&n.dirty(),r.add(i.value)}}catch(e){a.e(e)}finally{a.f()}return{status:n.value,value:r}}var o=R(r.data.values()).map((function(e,t){return i._parse(new se(r,e,r.path,t))}));return r.common.async?Promise.all(o).then((function(e){return u(e)})):u(o)}},{key:"min",value:function(e,t){return new n(_(_({},this._def),{},{minSize:{value:e,message:X.toString(t)}}))}},{key:"max",value:function(e,t){return new n(_(_({},this._def),{},{maxSize:{value:e,message:X.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}();ze.create=function(e,t){return new ze(_({valueType:e,minSize:null,maxSize:null,typeName:ot.ZodSet},le(t)))};var Ke=function(e){Z(n,de);var t=A(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).validate=e.implement,e}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;if(t.parsedType!==K.function)return Y(t,{code:$.invalid_type,expected:K.function,received:t.parsedType}),te;function n(e,n){return Q({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,J(),G].filter((function(e){return!!e})),issueData:{code:$.invalid_arguments,argumentsError:n}})}function r(e,n){return Q({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,J(),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 Je){var u=this;return re(x(k().mark((function e(){var t,o,s,c,l,d,f,p=arguments;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=p.length,o=new Array(t),s=0;s<t;s++)o[s]=p[s];return c=new W([]),e.next=4,u._def.args.parseAsync(o,a).catch((function(e){throw c.addIssue(n(o,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,u._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 o=this;return re((function(){for(var e=arguments.length,t=new Array(e),u=0;u<e;u++)t[u]=arguments[u];var s=o._def.args.safeParse(t,a);if(!s.success)throw new W([n(t,s.error)]);var c=Reflect.apply(i,this,s.data),l=o._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(_(_({},this._def),{},{args:Me.create(t).rest(Ce.create())}))}},{key:"returns",value:function(e){return new n(_(_({},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(_({args:e||Me.create([]).rest(Ce.create()),returns:t||Ce.create(),typeName:ot.ZodFunction},le(r)))}}]),n}(),qe=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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}();qe.create=function(e,t){return new qe(_({getter:e,typeName:ot.ZodLazy},le(t)))};var $e=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(e.data!==this._def.value){var t=this._getOrReturnCtx(e);return Y(t,{received:t.data,code:$.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:e.data}}},{key:"value",get:function(){return this._def.value}}]),n}();function We(e,t){return new Ge(_({values:e,typeName:ot.ZodEnum},le(t)))}$e.create=function(e,t){return new $e(_({value:e,typeName:ot.ZodLiteral},le(t)))};var Ge=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if("string"!=typeof e.data){var t=this._getOrReturnCtx(e),n=this._def.values;return Y(t,{expected:V.joinValues(n),received:t.parsedType,code:$.invalid_type}),te}if(-1===this._def.values.indexOf(e.data)){var r=this._getOrReturnCtx(e),a=this._def.values;return Y(r,{received:r.data,code:$.invalid_enum_value,options:a}),te}return re(e.data)}},{key:"options",get:function(){return this._def.values}},{key:"enum",get:function(){var e,t={},n=M(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=M(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=M(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}();Ge.create=We;var He=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=V.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==K.string&&n.parsedType!==K.number){var r=V.objectValues(t);return Y(n,{expected:V.joinValues(r),received:n.parsedType,code:$.invalid_type}),te}if(-1===t.indexOf(e.data)){var a=V.objectValues(t);return Y(n,{received:n.data,code:$.invalid_enum_value,options:a}),te}return re(e.data)}},{key:"enum",get:function(){return this._def.values}}]),n}();He.create=function(e,t){return new He(_({values:e,typeName:ot.ZodNativeEnum},le(t)))};var Je=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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!==K.promise&&!1===n.common.async)return Y(n,{code:$.invalid_type,expected:K.promise,received:n.parsedType}),te;var r=n.parsedType===K.promise?n.data:Promise.resolve(n.data);return re(r.then((function(e){return t._def.type.parseAsync(e,{path:n.path,errorMap:n.common.contextualErrorMap})})))}}]),n}();Je.create=function(e,t){return new Je(_({type:e,typeName:ot.ZodPromise},le(t)))};var Qe=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"innerType",value:function(){return this._def.schema}},{key:"sourceType",value:function(){return this._def.schema._def.typeName===ot.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,u={addIssue:function(e){Y(a,e),e.fatal?r.abort():r.dirty()},get path(){return a.path}};if(u.addIssue=u.addIssue.bind(u),"preprocess"===i.type){var o=i.transform(a.data,u);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(o).then((function(e){return t._def.schema._parseAsync({data:e,path:a.path,parent:a})})):this._def.schema._parseSync({data:o,path:a.path,parent:a})}if("refinement"===i.type){var s=function(e){var t=i.refinement(e,u);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?te:("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?te:("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,u);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,u)).then((function(e){return{status:r.value,value:e}})):e}))}V.assertNever(i)}}]),n}();Qe.create=function(e,t,n){return new Qe(_({schema:e,typeName:ot.ZodEffects,effect:t},le(n)))},Qe.createWithPreprocess=function(e,t,n){return new Qe(_({schema:t,effect:{type:"preprocess",transform:e},typeName:ot.ZodEffects},le(n)))};var Ye=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){return this._getType(e)===K.undefined?re(void 0):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),n}();Ye.create=function(e,t){return new Ye(_({innerType:e,typeName:ot.ZodOptional},le(t)))};var Xe=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){return this._getType(e)===K.null?re(null):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),n}();Xe.create=function(e,t){return new Xe(_({innerType:e,typeName:ot.ZodNullable},le(t)))};var et=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,n=t.data;return t.parsedType===K.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}();et.create=function(e,t){return new et(_({innerType:e,typeName:ot.ZodDefault,defaultValue:"function"==typeof t.default?t.default:function(){return t.default}},le(t)))};var tt=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e).ctx,r=_(_({},n),{},{common:_(_({},n.common),{},{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:_({},r)});return oe(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}();tt.create=function(e,t){return new tt(_({innerType:e,typeName:ot.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:function(){return t.catch}},le(t)))};var nt=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){if(this._getType(e)!==K.nan){var t=this._getOrReturnCtx(e);return Y(t,{code:$.invalid_type,expected:K.nan,received:t.parsedType}),te}return{status:"valid",value:e.data}}}]),n}();nt.create=function(e){return new nt(_({typeName:ot.ZodNaN},le(e)))};var rt=Symbol("zod_brand"),at=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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}(),it=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(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=x(k().mark((function e(){var n;return k().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",te);case 5:if("dirty"!==n.status){e.next=10;break}return r.dirty(),e.abrupt("return",ne(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 u=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===u.status?te:"dirty"===u.status?(r.dirty(),{status:"dirty",value:u.value}):this._def.out._parseSync({data:u.value,path:a.path,parent:a})}}],[{key:"create",value:function(e,t){return new n({in:e,out:t,typeName:ot.ZodPipeline})}}]),n}(),ut=function(e){Z(n,de);var t=A(n);function n(){return E(this,n),t.apply(this,arguments)}return T(n,[{key:"_parse",value:function(e){var t=this._def.innerType._parse(e);return ue(t)&&(t.value=Object.freeze(t.value)),t}}]),n}();ut.create=function(e,t){return new ut(_({innerType:e,typeName:ot.ZodReadonly},le(t)))};var ot,st=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,u;if(!e(r)){var o="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(u=null!==(i=o.fatal)&&void 0!==i?i:n)||void 0===u||u,c="string"==typeof o?{message:o}:o;a.addIssue(_(_({code:"custom"},c),{},{fatal:s}))}})):Ze.create()},ct={object:Pe.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"}(ot||(ot={}));var lt,dt,ft,pt,ht,vt=ke.create,yt=be.create,mt=nt.create,gt=we.create,_t=xe.create,kt=Ee.create,bt=Oe.create,wt=Te.create,xt=Se.create,Et=Ze.create,Ot=Ce.create,Tt=je.create,St=De.create,Zt=Ne.create,Ct=Pe.create,jt=Pe.strictCreate,Dt=Ae.create,Nt=Re.create,It=Ue.create,Pt=Me.create,At=Be.create,Ft=Ve.create,Rt=ze.create,Lt=Ke.create,Ut=qe.create,Mt=$e.create,Bt=Ge.create,Vt=He.create,zt=Je.create,Kt=Qe.create,qt=Ye.create,$t=Xe.create,Wt=Qe.createWithPreprocess,Gt=it.create,Ht={string:function(e){return ke.create(_(_({},e),{},{coerce:!0}))},number:function(e){return be.create(_(_({},e),{},{coerce:!0}))},boolean:function(e){return xe.create(_(_({},e),{},{coerce:!0}))},bigint:function(e){return we.create(_(_({},e),{},{coerce:!0}))},date:function(e){return Ee.create(_(_({},e),{},{coerce:!0}))}},Jt=te,Qt=Object.freeze({__proto__:null,defaultErrorMap:G,setErrorMap:function(e){H=e},getErrorMap:J,makeIssue:Q,EMPTY_PATH:[],addIssueToContext:Y,ParseStatus:ee,INVALID:te,DIRTY:ne,OK:re,isAborted:ae,isDirty:ie,isValid:ue,isAsync:oe,get util(){return V},get objectUtil(){return z},ZodParsedType:K,getParsedType:q,ZodType:de,ZodString:ke,ZodNumber:be,ZodBigInt:we,ZodBoolean:xe,ZodDate:Ee,ZodSymbol:Oe,ZodUndefined:Te,ZodNull:Se,ZodAny:Ze,ZodUnknown:Ce,ZodNever:je,ZodVoid:De,ZodArray:Ne,ZodObject:Pe,ZodUnion:Ae,ZodDiscriminatedUnion:Re,ZodIntersection:Ue,ZodTuple:Me,ZodRecord:Be,ZodMap:Ve,ZodSet:ze,ZodFunction:Ke,ZodLazy:qe,ZodLiteral:$e,ZodEnum:Ge,ZodNativeEnum:He,ZodPromise:Je,ZodEffects:Qe,ZodTransformer:Qe,ZodOptional:Ye,ZodNullable:Xe,ZodDefault:et,ZodCatch:tt,ZodNaN:nt,BRAND:rt,ZodBranded:at,ZodPipeline:it,ZodReadonly:ut,custom:st,Schema:de,ZodSchema:de,late:ct,get ZodFirstPartyTypeKind(){return ot},coerce:Ht,any:Et,array:Zt,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 st((function(t){return t instanceof e}),t)},intersection:It,lazy:Ut,literal:Mt,map:Ft,nan:mt,nativeEnum:Vt,never:Tt,null:xt,nullable:$t,number:yt,object:Ct,oboolean:function(){return _t().optional()},onumber:function(){return yt().optional()},optional:qt,ostring:function(){return vt().optional()},pipeline:Gt,preprocess:Wt,promise:zt,record:At,set:Rt,strictObject:jt,string:vt,symbol:bt,transformer:Kt,tuple:Pt,undefined:wt,union:Dt,unknown:Ot,void:St,NEVER:Jt,ZodIssueCode:$,quotelessJson:function(e){return JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:")},ZodError:W});!function(e){e.Expired="expired",e.Inactive="inactive"}(lt||(lt={})),function(e){e.Boolean="boolean",e.Number="number",e.String="string",e.Binary="binary",e.Date="date",e.DateTime="dateTime",e.Array="array",e.Object="object"}(dt||(dt={})),function(e){e.svg="svg",e.png="png"}(ft||(ft={})),function(e){e.NotReturned="notReturned"}(pt||(pt={})),function(e){e.MOBILE="mobile"}(ht||(ht={}));const Yt=Qt.object({profile:Qt.enum([ht.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={})),function(e){e.sameDevice="sameDevice",e.crossDevice="crossDevice"}(rn||(rn={}));const an=Qt.object({credentialQuery:Qt.array(Yt).nonempty(),challenge:Qt.string().optional(),redirectUri:Qt.string(),mode:Qt.enum([rn.sameDevice]).optional()}),un=Qt.object({apiBaseUrl:Qt.string()});let on;var sn;!function(e){e.SdkNotInitialised="SDK not initialised"}(sn||(sn={}));const cn=e=>{h(un,"Invalid initialise options")(e),on=e},ln=()=>on,dn=()=>{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 fn,pn;!function(e){e.RequestCredentialsFailed="RequestCredentialsFailed"}(fn||(fn={})),function(e){e.FailedToStoreChallenge="Failed to store challenge",e.FailedToCreateSession="Failed to create session"}(pn||(pn={}));const hn=async t=>{const n=ln();if(!n)throw new e(sn.SdkNotInitialised);h(an,"Invalid same device request credential options")(t);const{apiBaseUrl:r}=n,{challenge:a=dn(),credentialQuery:i,redirectUri:u}=t;window.localStorage.setItem(nn.challenge,a);const c=window.localStorage.getItem(nn.challenge);if(!c)return s({type:fn.RequestCredentialsFailed,message:pn.FailedToStoreChallenge});const l=await(async({credentialQuery:e,challenge:t,redirectUri:n,apiBaseUrl:r})=>{const a=Object.assign({credentialQuery:e,challenge:t},n?{redirectUri:n}:{}),i=await m(`${r}/v2/presentations/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(i.isErr())return s(i.error);const u=await i.value.json();return p(tn)(u)?o(u):s({type:v.UnexpectedRespond,message:"Create session return unsupported response"})})({credentialQuery:i,challenge:c,redirectUri:u,apiBaseUrl:r});if(l.isErr())return s({type:fn.RequestCredentialsFailed,message:pn.FailedToCreateSession,cause:l.error});const{sessionUrl:d,sessionId:f}=l.value;return window.localStorage.setItem(nn.sessionId,f),window.location.assign(d),o({sessionId:f})},vn=async e=>{if(rn.sameDevice===rn.sameDevice)return await hn(e);throw new Error("Not implemented cross device mode yet")};var yn,mn;!function(e){e.HandleRedirectCallbackFailed="HandleRedirectCallbackFailed"}(yn||(yn={})),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"}(mn||(mn={}));const gn=async()=>{const t=ln();if(!t)throw new e(sn.SdkNotInitialised);const{apiBaseUrl:n}=t,r=(a=window.location.hash,i="response_code",new URLSearchParams(a.split("#")[1]).get(i));var a,i;if(!r)return s({type:yn.HandleRedirectCallbackFailed,message:mn.FailedToFindResponseCode});const u=window.localStorage.getItem(nn.challenge);if(!u)return s({type:yn.HandleRedirectCallbackFailed,message:mn.FailedToFindChallenge});const c=window.localStorage.getItem(nn.sessionId);if(!c)return s({type:yn.HandleRedirectCallbackFailed,message:mn.FailedToFindSessionId});const l=await(async({challenge:e,responseCode:t,sessionId:n,apiBaseUrl:r})=>{const a={challenge:e,responseCode:t},i=await m(`${r}/v2/presentations/sessions/${n}/result`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(i.isErr())return s(i.error);const u=await i.value.json();return p(en)(u)?o(u):s({type:v.UnexpectedRespond,message:"Get session result return unsupported response",details:{data:u}})})({challenge:u,responseCode:r,sessionId:c,apiBaseUrl:n});return l.isErr()?s({type:yn.HandleRedirectCallbackFailed,message:mn.FailedToGetSessionResult,cause:l.error}):o({result:l.value})},_n={generateChallenge:dn,unwrap:(t,n)=>{if(t.isOk())return t.value;throw new e(null!=n?n:"Error unwrapping result",t.error)}};export{dt as ClaimType,ft as CredentialBrandingImageFormat,yn as HandleRedirectCallbackErrorType,lt as MobileCredentialVerificationReasonType,rn as Mode,ht as OpenidPresentationCredentialProfileSupported,fn as RequestCredentialsErrorType,gn as handleRedirectCallback,cn as initialise,vn as requestCredentials,_n as utils};
|
|
35
|
+
//# sourceMappingURL=verifier-js.production.esm.js.map
|