Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typeson-registry

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeson-registry - npm Package Compare versions

Comparing version 7.2.0 to 7.2.1

2

dist/index.min.js

@@ -1,2 +0,2 @@

function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="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},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;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 e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var a=t(o,"constructor")&&o.constructor;return"function"!=typeof a?null===n:n===a||null!==n&&Function.prototype.toString.call(a)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof a.__typeson__type__&&a.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,a=Array.isArray,i=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,a=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),a&&(a=a.length),o>a?-1:o<a?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}var c=function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),l=u.sync,f={},y=[],p=[],d=[],v=!("cyclic"in u)||u.cyclic,b=u.encapsulateObserver,h=function finish(e){var t=Object.values(f);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=f:e={$:e,$types:{$:f}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},g=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,a=[],i=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(i[0],7),s=c[0],u=c[2],l=c[3],f=c[4],y=c[5],p=c[6],d=_(s,n,u,l,a,!0,p),v=hasConstructorOf(d,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&v)return _await(d.p,(function(e){f[y]=e;var r=g(t,a);return o=!0,r}))}),(function(e){return o?e:(s?f[y]=d:t=v?d.p:d,g(t,a))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=i.map((function(t){var r=e[t];return delete e[t],r}));r(),i.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,i,c,l,d,v){var h,g={},_=_typeof(r),w=b?function(n){var o,a=null!==(o=null!=v?v:c.type)&&void 0!==o?o:getJSONType(r);b(Object.assign(null!=n?n:g,{keypath:t,value:r,cyclic:i,stateObj:c,promisesData:l,resolvingTypesonPromise:d,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(h=c.replaced?r:O(t,r,c,l,!1,d,w))!==r&&(g={replaced:h}):h=r,w&&w(),h;if(null===r)return w&&w(),r;if(i&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=y.indexOf(r);if(!(A<0))return f[t]="#",w&&w({cyclicKeypath:p[A]}),"#"+p[A];!0===i&&(y.push(r),p.push(t))}var S,j,T=isPlainObject(r),I=a(r),N=(T||I)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,l,T||I,null,w);if(N!==r?(h=N,g={replaced:N}):""===t&&hasConstructorOf(r,e)?(l.push([t,r,i,c,void 0,void 0,c.type]),h=r):I&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),g={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=r:(S={},c.addLength&&(S.length=r.length),g={clone:S}),w&&w(),u.iterateNone)return null!==(j=S)&&void 0!==j?j:h;if(!S)return h;if(c.iterateIn){var P=function _loop(n){var a={ownKeys:o(r,n)};m(c,a,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),a=_encapsulate(o,r[n],Boolean(i),c,l,d);hasConstructorOf(a,e)?l.push([o,a,Boolean(i),c,S,n,c.type]):void 0!==a&&(S[n]=a)}))};for(var E in r)P(E);w&&w({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(i),c,l,d);hasConstructorOf(t,e)?l.push([o,t,Boolean(i),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),w&&w({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var C=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(i),c,l,d);hasConstructorOf(t,e)?l.push([o,t,Boolean(i),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},k=0;k<C;k++)x(k);w&&w({endIterateUnsetNumeric:!0,end:!0})}return S},O=function replace(e,t,r,n,o,a,i){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var y=c[u];if(y.test(t,r)){var p=y.type;if(s.revivers[p]){var d=f[e];f[e]=d?[p].concat(d):p}if(Object.assign(r,{type:p,replaced:!0}),(l||!y.replaceAsync)&&!y.replace)return i&&i({typeDetected:!0}),_(e,t,v&&"readonly",r,n,a,p);i&&i({replacing:!0});var b=void 0;if(l||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");b=y.replace(t,r)}else b=y.replaceAsync(t,r);return _(e,b,v&&"readonly",r,n,a,p)}}return t},w=_("",t,v,null!=r?r:{},d);if(d.length)return l&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(g(w,d)).then(h);if(!l&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&l?[h(w)]:l?h(w):Promise.resolve(h(w))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),r),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var l=[],f={},y=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(c&&!("revive"in n))return t;if(!c&&n.reviveAsync)return n.reviveAsync(t,f);if(n.revive)return n.revive(t,f);throw new Error("Missing reviver")},d=[];function checkUndefined(e){return hasConstructorOf(e,s)?void 0:e}var v,b=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],a=t[1];"#"!==a&&[].concat(a).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,a=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:a})}));var i=getByKeyPath(t,o);if(hasConstructorOf(i=p(a,i),e))return i.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,i);c===i&&(t=c)}),void 0)}();return hasConstructorOf(b,e)?v=b.then((function(){return t})):(v=function _revive(t,r,o,i,c){if(!y||"$types"!==t){var f=u[t],v=a(r);if(v||isPlainObject(r)){var b=v?new Array(r.length):{};for(n(r).forEach((function(n){var a=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:b,b,n),i=function set(e){return hasConstructorOf(e,s)?b[n]=void 0:void 0!==e&&(b[n]=e),e};hasConstructorOf(a,e)?d.push(a.then((function(e){return i(e)}))):i(a)})),r=b;l.length;){var h=_slicedToArray(l[0],4),g=h[0],m=h[1],_=h[2],O=h[3],w=getByKeyPath(g,m);if(void 0===w)break;_[O]=w,l.splice(0,1)}}if(!f)return r;if("#"===f){var A=getByKeyPath(o,r.slice(1));return void 0===A&&l.push([o,r.slice(1),i,c]),A}return[].concat(f).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),d.length&&(v=e.resolve(v).then((function(t){return e.all([t].concat(d))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(v)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(v,e)?v.p.then(checkUndefined):v:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(v):Promise.resolve(checkUndefined(v))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[t],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof i){var l=i;i={test:function test(e){return e&&e.constructor===l},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(l.prototype),e)}}}else if(a(i)){var f=_slicedToArray(i,3);i={test:f[0],replace:f[1],revive:f[2]}}if(null!==(n=i)&&void 0!==n&&n.test){var y={type:t,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var d={};i.revive&&(d.revive=i.revive.bind(i)),i.reviveAsync&&(d.reviveAsync=i.reviveAsync.bind(i)),r.revivers[t]=[d,{plain:i.testPlainObjects}]}r.types[t]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=new Uint8Array(256),y=0;y<l.length;y++)f[l.codePointAt(y)]=y;var p=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,a="",i=0;i<o;i+=3)a+=l[n[i]>>2],a+=l[(3&n[i])<<4|n[i+1]>>4],a+=l[(15&n[i+1])<<2|n[i+2]>>6],a+=l[63&n[i+2]];return o%3==2?a=a.slice(0,-1)+"=":o%3==1&&(a=a.slice(0,-2)+"=="),a},d=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,a,i=.75*e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);for(var s=new ArrayBuffer(i),u=new Uint8Array(s),l=0;l<t;l+=4)r=f[e.codePointAt(l)],n=f[e.codePointAt(l+1)],o=f[e.codePointAt(l+2)],a=f[e.codePointAt(l+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|o>>2,u[c++]=(3&o)<<6|63&a;return s};const v={arraybuffer:{test:e=>"ArrayBuffer"===toStringTag(e),replace(e,t){t.buffers||(t.buffers=[]);const r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),p(e))},revive(e,t){if(t.buffers||(t.buffers=[]),"object"==typeof e)return t.buffers[e.index];const r=d(e);return t.buffers.push(r),r}}},b={bigintObject:{test:e=>"object"==typeof e&&hasConstructorOf(e,BigInt),replace:String,revive:e=>new Object(BigInt(e))}},h={bigint:{test:e=>"bigint"==typeof e,replace:String,revive:e=>BigInt(e)}};function string2arraybuffer(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}const g={blob:{test:e=>"Blob"===toStringTag(e),replace(e){const t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive(e){const{type:t,stringContents:r}=e;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:t=>new e(((e,r)=>{const n=new FileReader;n.addEventListener("load",(()=>{e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(()=>{r(n.error)})),n.readAsBinaryString(t)}))}};function generateUUID(){let e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(function(t){const r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}const m={},_={cloneable:{test:e=>e&&"object"==typeof e&&"function"==typeof e[Symbol.for("cloneEncapsulate")],replace(e){const t=e[Symbol.for("cloneEncapsulate")](),r=generateUUID();return m[r]=e,{uuid:r,encapsulated:t}},revive(e){const{uuid:t,encapsulated:r}=e;return m[t][Symbol.for("cloneRevive")](r)}}},O={cryptokey:{test:e=>"CryptoKey"===toStringTag(e)&&e.extractable,replaceAsync:t=>new e((async(e,r)=>{let n;try{n=await crypto.subtle.exportKey("jwk",t)}catch(e){return void r(e)}e({jwk:n,algorithm:t.algorithm,usages:t.usages})})),revive(e){const{jwk:t,algorithm:r,usages:n}=e;return crypto.subtle.importKey("jwk",t,r,!0,n)}}},w={dataview:{test:e=>"DataView"===toStringTag(e),replace({buffer:e,byteOffset:t,byteLength:r},n){n.buffers||(n.buffers=[]);const o=n.buffers.indexOf(e);return o>-1?{index:o,byteOffset:t,byteLength:r}:(n.buffers.push(e),{encoded:p(e),byteOffset:t,byteLength:r})},revive(e,t){t.buffers||(t.buffers=[]);const{byteOffset:r,byteLength:n,encoded:o,index:a}=e;let i;return"index"in e?i=t.buffers[a]:(i=d(o),t.buffers.push(i)),new DataView(i,r,n)}}},A={date:{test:e=>"Date"===toStringTag(e),replace(e){const t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:e=>"NaN"===e?new Date(Number.NaN):new Date(e)}},S={error:{test:e=>"Error"===toStringTag(e),replace:({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i})=>({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i}),revive(e){const t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},j={};function create$2(e){j[e.name.toLowerCase()]={test:t=>hasConstructorOf(t,e),replace:({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i,errors:c})=>({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i,errors:c}),revive(t){const r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((e=>create$2(e))),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);const T={file:{test:e=>"File"===toStringTag(e),replace(e){const t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:({name:e,type:t,stringContents:r,lastModified:n})=>new File([string2arraybuffer(r)],e,{type:t,lastModified:n}),replaceAsync:t=>new e((function(e,r){const n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}},I={file:T.file,filelist:{test:e=>"FileList"===toStringTag(e),replace(e){const t=[];for(let r=0;r<e.length;r++)t[r]=e.item(r);return t},revive(e){class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(e){return this._files[e]}get[Symbol.toStringTag](){return"FileList"}}return new FileList(e)}}},N={imagebitmap:{test:e=>"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag,replace(e){const t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive(e){const t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync(t){const r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e((async(e,t)=>{try{e(await createImageBitmap(r))}catch(e){t(e)}}))}}},P={imagedata:{test:e=>"ImageData"===toStringTag(e),replace:e=>({array:[...e.data],width:e.width,height:e.height}),revive:e=>new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}},E={infinity:{test:e=>e===Number.POSITIVE_INFINITY,replace:e=>"Infinity",revive:e=>Number.POSITIVE_INFINITY}},C={test:e=>hasConstructorOf(e,Intl.Collator),replace:e=>e.resolvedOptions(),revive:e=>new Intl.Collator(e.locale,e)},x={IntlCollator:C,IntlDateTimeFormat:{test:e=>hasConstructorOf(e,Intl.DateTimeFormat),replace:e=>e.resolvedOptions(),revive:e=>new Intl.DateTimeFormat(e.locale,e)},IntlNumberFormat:{test:e=>hasConstructorOf(e,Intl.NumberFormat),replace:e=>e.resolvedOptions(),revive:e=>new Intl.NumberFormat(e.locale,e)}},k={map:{test:e=>"Map"===toStringTag(e),replace:e=>[...e.entries()],revive:e=>new Map(e)}},B={nan:{test:e=>Number.isNaN(e),replace:e=>"NaN",revive:e=>Number.NaN}},U={negativeInfinity:{test:e=>e===Number.NEGATIVE_INFINITY,replace:e=>"-Infinity",revive:e=>Number.NEGATIVE_INFINITY}},K={negativeZero:{test:e=>Object.is(e,-0),replace:e=>0,revive:e=>-0}},L={nonbuiltinIgnore:{test:e=>e&&"object"==typeof e&&!Array.isArray(e)&&!["Object","Boolean","Number","String","Error","RegExp","Math","Date","Map","Set","JSON","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Promise","String Iterator","Array Iterator","Map Iterator","Set Iterator","WeakMap","WeakSet","Atomics","Module"].includes(toStringTag(e)),replace(e){}}},F={StringObject:{test:e=>"String"===toStringTag(e)&&"object"==typeof e,replace:String,revive:e=>new String(e)},BooleanObject:{test:e=>"Boolean"===toStringTag(e)&&"object"==typeof e,replace:Boolean,revive:e=>new Boolean(e)},NumberObject:{test:e=>"Number"===toStringTag(e)&&"object"==typeof e,replace:Number,revive:e=>new Number(e)}},M={regexp:{test:e=>"RegExp"===toStringTag(e),replace:e=>({source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}),revive:({source:e,flags:t})=>new RegExp(e,t)}},D={},$={resurrectable:{test:e=>e&&!Array.isArray(e)&&["object","function","symbol"].includes(typeof e),replace(e){const t=generateUUID();return D[t]=e,t},revive:e=>D[e]}},J={set:{test:e=>"Set"===toStringTag(e),replace:e=>[...e.values()],revive:e=>new Set(e)}},V={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((e=>function create$1(e){const t=e.name;V[t.toLowerCase()]={test:e=>toStringTag(e)===t,replace:e=>(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer,revive:t=>"ArrayBuffer"===toStringTag(t)?new e(t):t}}(e)));const Y={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((e=>function create(e){const t=e.name;Y[t.toLowerCase()]={test:e=>toStringTag(e)===t,replace({buffer:e,byteOffset:t,length:r},n){n.buffers||(n.buffers=[]);const o=n.buffers.indexOf(e);return o>-1?{index:o,byteOffset:t,length:r}:(n.buffers.push(e),{encoded:p(e),byteOffset:t,length:r})},revive(t,r){r.buffers||(r.buffers=[]);const{byteOffset:n,length:o,encoded:a,index:i}=t;let c;return"index"in t?c=r.buffers[i]:(c=d(a),r.buffers.push(c)),new e(c,n,o)}}}(e)));const q={undef:{test:(e,t)=>void 0===e&&(t.ownKeys||!("ownKeys"in t)),replace:e=>0,revive:e=>new s}},W={userObject:{test:(e,t)=>isUserObject(e),replace:e=>({...e}),revive:e=>e}},G=[{arrayNonindexKeys:{testPlainObjects:!0,test:(e,t)=>!!Array.isArray(e)&&(Object.keys(e).some((e=>String(Number.parseInt(e))!==e))&&(t.iterateIn="object",t.addLength=!0),!0),replace:(e,t)=>(t.iterateUnsetNumeric=!0,e),revive(e){if(Array.isArray(e))return e;const t=[];return Object.entries(e).forEach((([e,r])=>{t[e]=r})),t}}},{sparseUndefined:{test:(e,t)=>void 0===e&&!1===t.ownKeys,replace:e=>0,revive(e){}}}],H=[B,E,U,K],X=[q,G,F,H,A,S,j,M].concat("function"==typeof Map?k:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?Y:[],"function"==typeof DataView?w:[],"undefined"!=typeof Intl?x:[],"undefined"!=typeof BigInt?[h,b]:[]),Z=[S,j],z=[X,{arraybuffer:null},V],Q=[{sparseArrays:{testPlainObjects:!0,test:e=>Array.isArray(e),replace:(e,t)=>(t.iterateUnsetNumeric=!0,e)}},{sparseUndefined:{test:(e,t)=>void 0===e&&!1===t.ownKeys,replace:e=>0,revive(e){}}}],ee=[W,q,G,F,H,A,M,P,N,T,I,g,S,j].concat("function"==typeof Map?k:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?Y:[],"function"==typeof DataView?w:[],"undefined"!=typeof Intl?x:[],"undefined"!=typeof crypto?O:[],"undefined"!=typeof BigInt?[h,b]:[]),te=ee.concat({checkDataCloneException:{test(e){const t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(typeof e)||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"==typeof e&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}}),re=[Q,q],ne=[X];export{u as JSON_TYPES,c as Typeson,e as TypesonPromise,s as Undefined,G as arrayNonindexKeys,v as arraybuffer,h as bigint,b as bigintObject,g as blob,X as builtin,_ as cloneable,O as cryptokey,w as dataview,A as date,S as error,j as errors,escapeKeyPathComponent,T as file,I as filelist,getByKeyPath,getJSONType,hasConstructorOf,N as imagebitmap,P as imagedata,E as infinity,x as intlTypes,isObject,isPlainObject,isThenable,isUserObject,k as map,B as nan,U as negativeInfinity,K as negativeZero,L as nonbuiltinIgnore,Z as postmessage,F as primitiveObjects,M as regexp,$ as resurrectable,J as set,setAtKeyPath,z as socketio,Q as sparseUndefined,H as specialNumbers,ee as structuredCloning,te as structuredCloningThrowing,toStringTag,Y as typedArrays,V as typedArraysSocketio,q as undef,re as undefPreset,unescapeKeyPathComponent,ne as universal,W as userObject};
function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="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},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;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 e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var a=t(o,"constructor")&&o.constructor;return"function"!=typeof a?null===n:n===a||null!==n&&Function.prototype.toString.call(a)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof a.__typeson__type__&&a.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,a=Array.isArray,i=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,a=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),a&&(a=a.length),o>a?-1:o<a?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}var c=function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),l=u.sync,f={},y=[],p=[],d=[],v=!("cyclic"in u)||u.cyclic,b=u.encapsulateObserver,h=function finish(e){var t=Object.values(f);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=f:e={$:e,$types:{$:f}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},g=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,a=[],i=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(i[0],7),s=c[0],u=c[2],l=c[3],f=c[4],y=c[5],p=c[6],d=_(s,n,u,l,a,!0,p),v=hasConstructorOf(d,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&v)return _await(d.p,(function(e){f[y]=e;var r=g(t,a);return o=!0,r}))}),(function(e){return o?e:(s?f[y]=d:t=v?d.p:d,g(t,a))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=i.map((function(t){var r=e[t];return delete e[t],r}));r(),i.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,i,c,l,d,v){var h,g={},_=_typeof(r),w=b?function(n){var o,a=null!==(o=null!=v?v:c.type)&&void 0!==o?o:getJSONType(r);b(Object.assign(null!=n?n:g,{keypath:t,value:r,cyclic:i,stateObj:c,promisesData:l,resolvingTypesonPromise:d,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(h=c.replaced?r:O(t,r,c,l,!1,d,w))!==r&&(g={replaced:h}):h=r,w&&w(),h;if(null===r)return w&&w(),r;if(i&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=y.indexOf(r);if(!(A<0))return f[t]="#",w&&w({cyclicKeypath:p[A]}),"#"+p[A];!0===i&&(y.push(r),p.push(t))}var S,j,T=isPlainObject(r),I=a(r),N=(T||I)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,l,T||I,null,w);if(N!==r?(h=N,g={replaced:N}):""===t&&hasConstructorOf(r,e)?(l.push([t,r,i,c,void 0,void 0,c.type]),h=r):I&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),g={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=r:(S={},c.addLength&&(S.length=r.length),g={clone:S}),w&&w(),u.iterateNone)return null!==(j=S)&&void 0!==j?j:h;if(!S)return h;if(c.iterateIn){var P=function _loop(n){var a={ownKeys:o(r,n)};m(c,a,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),a=_encapsulate(o,r[n],Boolean(i),c,l,d);hasConstructorOf(a,e)?l.push([o,a,Boolean(i),c,S,n,c.type]):void 0!==a&&(S[n]=a)}))};for(var E in r)P(E);w&&w({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(i),c,l,d);hasConstructorOf(t,e)?l.push([o,t,Boolean(i),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),w&&w({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var C=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(i),c,l,d);hasConstructorOf(t,e)?l.push([o,t,Boolean(i),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},k=0;k<C;k++)x(k);w&&w({endIterateUnsetNumeric:!0,end:!0})}return S},O=function replace(e,t,r,n,o,a,i){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var y=c[u];if(y.test(t,r)){var p=y.type;if(s.revivers[p]){var d=f[e];f[e]=d?[p].concat(d):p}if(Object.assign(r,{type:p,replaced:!0}),(l||!y.replaceAsync)&&!y.replace)return i&&i({typeDetected:!0}),_(e,t,v&&"readonly",r,n,a,p);i&&i({replacing:!0});var b=void 0;if(l||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");b=y.replace(t,r)}else b=y.replaceAsync(t,r);return _(e,b,v&&"readonly",r,n,a,p)}}return t},w=_("",t,v,null!=r?r:{},d);if(d.length)return l&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(g(w,d)).then(h);if(!l&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&l?[h(w)]:l?h(w):Promise.resolve(h(w))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),r),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var l=[],f={},y=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(c&&!("revive"in n))return t;if(!c&&n.reviveAsync)return n.reviveAsync(t,f);if(n.revive)return n.revive(t,f);throw new Error("Missing reviver")},d=[];function checkUndefined(e){return hasConstructorOf(e,s)?void 0:e}var v,b=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],a=t[1];"#"!==a&&[].concat(a).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,a=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:a})}));var i=getByKeyPath(t,o);if(hasConstructorOf(i=p(a,i),e))return i.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,i);c===i&&(t=c)}),void 0)}();return hasConstructorOf(b,e)?v=b.then((function(){return t})):(v=function _revive(t,r,o,i,c){if(!y||"$types"!==t){var f=u[t],v=a(r);if(v||isPlainObject(r)){var b=v?new Array(r.length):{};for(n(r).forEach((function(n){var a=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:b,b,n),i=function set(e){return hasConstructorOf(e,s)?b[n]=void 0:void 0!==e&&(b[n]=e),e};hasConstructorOf(a,e)?d.push(a.then((function(e){return i(e)}))):i(a)})),r=b;l.length;){var h=_slicedToArray(l[0],4),g=h[0],m=h[1],_=h[2],O=h[3],w=getByKeyPath(g,m);if(void 0===w)break;_[O]=w,l.splice(0,1)}}if(!f)return r;if("#"===f){var A=getByKeyPath(o,r.slice(1));return void 0===A&&l.push([o,r.slice(1),i,c]),A}return[].concat(f).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),d.length&&(v=e.resolve(v).then((function(t){return e.all([t].concat(d))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(v)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(v,e)?v.p.then(checkUndefined):v:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(v):Promise.resolve(checkUndefined(v))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[t],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof i){var l=i;i={test:function test(e){return e&&e.constructor===l},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(l.prototype),e)}}}else if(a(i)){var f=_slicedToArray(i,3);i={test:f[0],replace:f[1],revive:f[2]}}if(null!==(n=i)&&void 0!==n&&n.test){var y={type:t,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var d={};i.revive&&(d.revive=i.revive.bind(i)),i.reviveAsync&&(d.reviveAsync=i.reviveAsync.bind(i)),r.revivers[t]=[d,{plain:i.testPlainObjects}]}r.types[t]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=new Uint8Array(256),y=0;y<64;y++)f[l.codePointAt(y)]=y;var p=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,a="",i=0;i<o;i+=3)a+=l[n[i]>>2],a+=l[(3&n[i])<<4|n[i+1]>>4],a+=l[(15&n[i+1])<<2|n[i+2]>>6],a+=l[63&n[i+2]];return o%3==2?a=a.slice(0,-1)+"=":o%3==1&&(a=a.slice(0,-2)+"=="),a},d=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,a,i=.75*e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);for(var s=new ArrayBuffer(i),u=new Uint8Array(s),l=0;l<t;l+=4)r=f[e.codePointAt(l)],n=f[e.codePointAt(l+1)],o=f[e.codePointAt(l+2)],a=f[e.codePointAt(l+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|o>>2,u[c++]=(3&o)<<6|63&a;return s};const v={arraybuffer:{test:e=>"ArrayBuffer"===toStringTag(e),replace(e,t){t.buffers||(t.buffers=[]);const r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),p(e))},revive(e,t){if(t.buffers||(t.buffers=[]),"object"==typeof e)return t.buffers[e.index];const r=d(e);return t.buffers.push(r),r}}},b={bigintObject:{test:e=>"object"==typeof e&&hasConstructorOf(e,BigInt),replace:String,revive:e=>new Object(BigInt(e))}},h={bigint:{test:e=>"bigint"==typeof e,replace:String,revive:e=>BigInt(e)}};function string2arraybuffer(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}const g={blob:{test:e=>"Blob"===toStringTag(e),replace(e){const t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive(e){const{type:t,stringContents:r}=e;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:t=>new e(((e,r)=>{const n=new FileReader;n.addEventListener("load",(()=>{e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(()=>{r(n.error)})),n.readAsBinaryString(t)}))}};function generateUUID(){let e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(function(t){const r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}const m={},_={cloneable:{test:e=>e&&"object"==typeof e&&"function"==typeof e[Symbol.for("cloneEncapsulate")],replace(e){const t=e[Symbol.for("cloneEncapsulate")](),r=generateUUID();return m[r]=e,{uuid:r,encapsulated:t}},revive(e){const{uuid:t,encapsulated:r}=e;return m[t][Symbol.for("cloneRevive")](r)}}},O={cryptokey:{test:e=>"CryptoKey"===toStringTag(e)&&e.extractable,replaceAsync:t=>new e((async(e,r)=>{let n;try{n=await crypto.subtle.exportKey("jwk",t)}catch(e){return void r(e)}e({jwk:n,algorithm:t.algorithm,usages:t.usages})})),revive(e){const{jwk:t,algorithm:r,usages:n}=e;return crypto.subtle.importKey("jwk",t,r,!0,n)}}},w={dataview:{test:e=>"DataView"===toStringTag(e),replace({buffer:e,byteOffset:t,byteLength:r},n){n.buffers||(n.buffers=[]);const o=n.buffers.indexOf(e);return o>-1?{index:o,byteOffset:t,byteLength:r}:(n.buffers.push(e),{encoded:p(e),byteOffset:t,byteLength:r})},revive(e,t){t.buffers||(t.buffers=[]);const{byteOffset:r,byteLength:n,encoded:o,index:a}=e;let i;return"index"in e?i=t.buffers[a]:(i=d(o),t.buffers.push(i)),new DataView(i,r,n)}}},A={date:{test:e=>"Date"===toStringTag(e),replace(e){const t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:e=>"NaN"===e?new Date(Number.NaN):new Date(e)}},S={error:{test:e=>"Error"===toStringTag(e),replace:({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i})=>({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i}),revive(e){const t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},j={};function create$2(e){j[e.name.toLowerCase()]={test:t=>hasConstructorOf(t,e),replace:({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i,errors:c})=>({name:e,message:t,cause:r,stack:n,fileName:o,lineNumber:a,columnNumber:i,errors:c}),revive(t){const r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((e=>create$2(e))),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);const T={file:{test:e=>"File"===toStringTag(e),replace(e){const t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:({name:e,type:t,stringContents:r,lastModified:n})=>new File([string2arraybuffer(r)],e,{type:t,lastModified:n}),replaceAsync:t=>new e((function(e,r){const n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}},I={file:T.file,filelist:{test:e=>"FileList"===toStringTag(e),replace(e){const t=[];for(let r=0;r<e.length;r++)t[r]=e.item(r);return t},revive(e){class FileList{constructor(){this._files=arguments[0],this.length=this._files.length}item(e){return this._files[e]}get[Symbol.toStringTag](){return"FileList"}}return new FileList(e)}}},N={imagebitmap:{test:e=>"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag,replace(e){const t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive(e){const t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync(t){const r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e((async(e,t)=>{try{e(await createImageBitmap(r))}catch(e){t(e)}}))}}},P={imagedata:{test:e=>"ImageData"===toStringTag(e),replace:e=>({array:[...e.data],width:e.width,height:e.height}),revive:e=>new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}},E={infinity:{test:e=>e===Number.POSITIVE_INFINITY,replace:e=>"Infinity",revive:e=>Number.POSITIVE_INFINITY}},C={test:e=>hasConstructorOf(e,Intl.Collator),replace:e=>e.resolvedOptions(),revive:e=>new Intl.Collator(e.locale,e)},x={IntlCollator:C,IntlDateTimeFormat:{test:e=>hasConstructorOf(e,Intl.DateTimeFormat),replace:e=>e.resolvedOptions(),revive:e=>new Intl.DateTimeFormat(e.locale,e)},IntlNumberFormat:{test:e=>hasConstructorOf(e,Intl.NumberFormat),replace:e=>e.resolvedOptions(),revive:e=>new Intl.NumberFormat(e.locale,e)}},k={map:{test:e=>"Map"===toStringTag(e),replace:e=>[...e.entries()],revive:e=>new Map(e)}},B={nan:{test:e=>Number.isNaN(e),replace:e=>"NaN",revive:e=>Number.NaN}},U={negativeInfinity:{test:e=>e===Number.NEGATIVE_INFINITY,replace:e=>"-Infinity",revive:e=>Number.NEGATIVE_INFINITY}},K={negativeZero:{test:e=>Object.is(e,-0),replace:e=>0,revive:e=>-0}},L={nonbuiltinIgnore:{test:e=>e&&"object"==typeof e&&!Array.isArray(e)&&!["Object","Boolean","Number","String","Error","RegExp","Math","Date","Map","Set","JSON","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Promise","String Iterator","Array Iterator","Map Iterator","Set Iterator","WeakMap","WeakSet","Atomics","Module"].includes(toStringTag(e)),replace(e){}}},F={StringObject:{test:e=>"String"===toStringTag(e)&&"object"==typeof e,replace:String,revive:e=>new String(e)},BooleanObject:{test:e=>"Boolean"===toStringTag(e)&&"object"==typeof e,replace:Boolean,revive:e=>new Boolean(e)},NumberObject:{test:e=>"Number"===toStringTag(e)&&"object"==typeof e,replace:Number,revive:e=>new Number(e)}},M={regexp:{test:e=>"RegExp"===toStringTag(e),replace:e=>({source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}),revive:({source:e,flags:t})=>new RegExp(e,t)}},D={},$={resurrectable:{test:e=>e&&!Array.isArray(e)&&["object","function","symbol"].includes(typeof e),replace(e){const t=generateUUID();return D[t]=e,t},revive:e=>D[e]}},J={set:{test:e=>"Set"===toStringTag(e),replace:e=>[...e.values()],revive:e=>new Set(e)}},V={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((e=>function create$1(e){const t=e.name;V[t.toLowerCase()]={test:e=>toStringTag(e)===t,replace:e=>(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer,revive:t=>"ArrayBuffer"===toStringTag(t)?new e(t):t}}(e)));const Y={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,..."function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[]].forEach((e=>function create(e){const t=e.name;Y[t.toLowerCase()]={test:e=>toStringTag(e)===t,replace({buffer:e,byteOffset:t,length:r},n){n.buffers||(n.buffers=[]);const o=n.buffers.indexOf(e);return o>-1?{index:o,byteOffset:t,length:r}:(n.buffers.push(e),{encoded:p(e),byteOffset:t,length:r})},revive(t,r){r.buffers||(r.buffers=[]);const{byteOffset:n,length:o,encoded:a,index:i}=t;let c;return"index"in t?c=r.buffers[i]:(c=d(a),r.buffers.push(c)),new e(c,n,o)}}}(e)));const q={undef:{test:(e,t)=>void 0===e&&(t.ownKeys||!("ownKeys"in t)),replace:e=>0,revive:e=>new s}},W={userObject:{test:(e,t)=>isUserObject(e),replace:e=>({...e}),revive:e=>e}},G=[{arrayNonindexKeys:{testPlainObjects:!0,test:(e,t)=>!!Array.isArray(e)&&(Object.keys(e).some((e=>String(Number.parseInt(e))!==e))&&(t.iterateIn="object",t.addLength=!0),!0),replace:(e,t)=>(t.iterateUnsetNumeric=!0,e),revive(e){if(Array.isArray(e))return e;const t=[];return Object.entries(e).forEach((([e,r])=>{t[e]=r})),t}}},{sparseUndefined:{test:(e,t)=>void 0===e&&!1===t.ownKeys,replace:e=>0,revive(e){}}}],H=[B,E,U,K],X=[q,G,F,H,A,S,j,M].concat("function"==typeof Map?k:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?Y:[],"function"==typeof DataView?w:[],"undefined"!=typeof Intl?x:[],"undefined"!=typeof BigInt?[h,b]:[]),Z=[S,j],z=[X,{arraybuffer:null},V],Q=[{sparseArrays:{testPlainObjects:!0,test:e=>Array.isArray(e),replace:(e,t)=>(t.iterateUnsetNumeric=!0,e)}},{sparseUndefined:{test:(e,t)=>void 0===e&&!1===t.ownKeys,replace:e=>0,revive(e){}}}],ee=[W,q,G,F,H,A,M,P,N,T,I,g,S,j].concat("function"==typeof Map?k:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?v:[],"function"==typeof Uint8Array?Y:[],"function"==typeof DataView?w:[],"undefined"!=typeof Intl?x:[],"undefined"!=typeof crypto?O:[],"undefined"!=typeof BigInt?[h,b]:[]),te=ee.concat({checkDataCloneException:{test(e){const t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(typeof e)||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"==typeof e&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}}),re=[Q,q],ne=[X];export{u as JSON_TYPES,c as Typeson,e as TypesonPromise,s as Undefined,G as arrayNonindexKeys,v as arraybuffer,h as bigint,b as bigintObject,g as blob,X as builtin,_ as cloneable,O as cryptokey,w as dataview,A as date,S as error,j as errors,escapeKeyPathComponent,T as file,I as filelist,getByKeyPath,getJSONType,hasConstructorOf,N as imagebitmap,P as imagedata,E as infinity,x as intlTypes,isObject,isPlainObject,isThenable,isUserObject,k as map,B as nan,U as negativeInfinity,K as negativeZero,L as nonbuiltinIgnore,Z as postmessage,F as primitiveObjects,M as regexp,$ as resurrectable,J as set,setAtKeyPath,z as socketio,Q as sparseUndefined,H as specialNumbers,ee as structuredCloning,te as structuredCloningThrowing,toStringTag,Y as typedArrays,V as typedArraysSocketio,q as undef,re as undefPreset,unescapeKeyPathComponent,ne as universal,W as userObject};
//# sourceMappingURL=index.min.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TypesonNamespace={})}(this,(function(e){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var t=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));t.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(t.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),t.prototype.then=function(e,r){var n=this;return new t((function(t,o){n.p.then((function(r){t(e?e(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(t,o)}))},t.prototype.catch=function(e){return this.then((function(){}),e)},t.resolve=function(e){return new t((function(t){t(e)}))},t.reject=function(e){return new t((function(t,r){r(e)}))},t.all=function(e){return new t((function(t,r){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))},t.race=function(e){return new t((function(t,r){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))},t.allSettled=function(e){return new t((function(t,r){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))};var r=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,t){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===t;var i=r(o,"constructor")&&o.constructor;return"function"!=typeof i?null===t:t===i||null!==t&&Function.prototype.toString.call(i)===Function.prototype.toString.call(t)||"function"==typeof t&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===t.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=n(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}var u=function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(e,r,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],d=!("cyclic"in s)||s.cyclic,h=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},g=_async((function(e,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),d=hasConstructorOf(v,t);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&d)return _await(v.p,(function(t){l[y]=t;var r=g(e,i);return o=!0,r}))}),(function(t){return o?t:(u?l[y]=v:e=d?v.p:v,g(e,i))}))})))),(function(){return e}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=c.map((function(t){var r=e[t];return delete e[t],r}));r(),c.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(e,r,n,c,f,v,d){var b,g={},_=_typeof(r),O=h?function(o){var i,a=null!==(i=null!=d?d:c.type)&&void 0!==i?i:getJSONType(r);h(Object.assign(null!=o?o:g,{keypath:e,value:r,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,t)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(e,r,c,f,!1,v,O))!==r&&(g={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=y.indexOf(r);if(!(A<0))return l[e]="#",O&&O({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(r),p.push(e))}var j,S,T=isPlainObject(r),P=a(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(e,r,c,f,T||P,null,O);if(I!==r?(b=I,g={replaced:I}):""===e&&hasConstructorOf(r,t)?(f.push([e,r,n,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(r.length),g={clone:j}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,t)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(j={},c.addLength&&(j.length=r.length),g={clone:j}),O&&O(),s.iterateNone)return null!==(S=j)&&void 0!==S?S:b;if(!j)return b;if(c.iterateIn){var x=function _loop(o){var a={ownKeys:i(r,o)};m(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,r[o],Boolean(n),c,f,v);hasConstructorOf(a,t)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var N in r)x(N);O&&O({endIterateIn:!0,end:!0})}else o(r).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);m(c,{ownKeys:!0},(function(){var e=_encapsulate(i,r[o],Boolean(n),c,f,v);hasConstructorOf(e,t)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var E=r.length,k=function _loop2(o){if(!(o in r)){var i="".concat(e).concat(e?".":"").concat(o);m(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,t)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},C=0;C<E;C++)k(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return j},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,d&&"readonly",r,n,i,p);a&&a({replacing:!0});var h=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");h=y.replace(t,r)}else h=y.replaceAsync(t,r);return _(e,h,d&&"readonly",r,n,i,p)}}return t},O=_("",e,d,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(g(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(e,r){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),r),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var u=e.$types;if(!0===u)return finishRevival(e.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(e);var f=[],l={},y=!0;u.$&&isPlainObject(u.$)&&(e=e.$,u=u.$,y=!1);var p=function executeReviver(e,t){var r,o=_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return t;if(!c&&o.reviveAsync)return o.reviveAsync(t,l);if(o.revive)return o.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,s)?void 0:e}var d,h=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),o=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:o,type:e}),delete u[o])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),t))return a.then((function(t){var r=setAtKeyPath(e,o,t);r===t&&(e=r)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(h,t)?d=h.then((function(){return e})):(d=function _revive(e,r,n,i,c){if(!y||"$types"!==e){var l=u[e],d=a(r);if(d||isPlainObject(r)){var h=d?new Array(r.length):{};for(o(r).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),r[o],null!=n?n:h,h,o),a=function set(e){return hasConstructorOf(e,s)?h[o]=void 0:void 0!==e&&(h[o]=e),e};hasConstructorOf(i,t)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=h;f.length;){var b=_slicedToArray(f[0],4),g=b[0],m=b[1],_=b[2],w=b[3],O=getByKeyPath(g,m);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var A=getByKeyPath(n,r.slice(1));return void 0===A&&f.push([n,r.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,r){if(hasConstructorOf(e,t))return e.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,e)}),r)}}("",e,null),v.length&&(d=t.resolve(d).then((function(e){return t.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(d)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(d,t)?d.p.then(checkUndefined):d:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(d):Promise.resolve(checkUndefined(d))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,n=null!=t?t:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(t){var o;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(f.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[t],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof i){var s=i;i={test:function test(e){return e&&e.constructor===s},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(s.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:t,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),r.revivers[t]=[v,{plain:i.testPlainObjects}]}r.types[t]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var f=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),p=0;p<l.length;p++)y[l.codePointAt(p)]=p;var v=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=l[n[a]>>2],i+=l[(3&n[a])<<4|n[a+1]>>4],i+=l[(15&n[a+1])<<2|n[a+2]>>6],i+=l[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},d=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=y[e.codePointAt(f)],n=y[e.codePointAt(f+1)],o=y[e.codePointAt(f+2)],i=y[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},h={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),v(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=d(e);return t.buffers.push(r),r}}},b={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},g={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var m={blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(e){return new t((function(t,r){var n=new FileReader;n.addEventListener("load",(function(){t({type:e.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(e)}))}}};function generateUUID(){var e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}var _={},w={cloneable:{test:function test(e){return e&&"object"===_typeof$1(e)&&"function"==typeof e[Symbol.for("cloneEncapsulate")]},replace:function replace(e){var t=e[Symbol.for("cloneEncapsulate")](),r=generateUUID();return _[r]=e,{uuid:r,encapsulated:t}},revive:function revive(e){var t=e.uuid,r=e.encapsulated;return _[t][Symbol.for("cloneRevive")](r)}}},O={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(e){return new t(function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(t,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",e);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:t({jwk:n,algorithm:e.algorithm,usages:e.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}},A={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:v(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=d(i),t.buffers.push(r)),new DataView(r,n,o)}}},j={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},S={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},T={};function create$2(e){T[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$2(e)})),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);var P={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(e){return new t((function(t,r){var n=new FileReader;n.addEventListener("load",(function(){t({type:e.type,stringContents:n.result,name:e.name,lastModified:e.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(e)}))}}},I={file:P.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){_classCallCheck$1(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},x={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(e){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=e,new t(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}},N={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},E={infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},k={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},C={IntlCollator:k,IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},$={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},L={nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},B={negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},U={negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}},F={nonbuiltinIgnore:{test:function test(e){return e&&"object"===_typeof$1(e)&&!Array.isArray(e)&&!["Object","Boolean","Number","String","Error","RegExp","Math","Date","Map","Set","JSON","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Promise","String Iterator","Array Iterator","Map Iterator","Set Iterator","WeakMap","WeakSet","Atomics","Module"].includes(toStringTag(e))},replace:function replace(e){}}},K={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},M={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},G={},D={resurrectable:{test:function test(e){return e&&!Array.isArray(e)&&["object","function","symbol"].includes(_typeof$1(e))},replace:function replace(e){var t=generateUUID();return G[t]=e,t},revive:function revive(e){return G[e]}}},J={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},V={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create$1(e){var t=e.name;V[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e){return(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer},revive:function revive(t){return"ArrayBuffer"===toStringTag(t)?new e(t):t}}}(e)}));var W={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;W[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:v(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=d(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var Y={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new s}}},q={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},H=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],X=[L,E,B,U],Z=[Y,H,K,X,j,S,T,M].concat("function"==typeof Map?$:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?h:[],"function"==typeof Uint8Array?W:[],"function"==typeof DataView?A:[],"undefined"!=typeof Intl?C:[],"undefined"!=typeof BigInt?[g,b]:[]),z=[S,T],Q=[Z,{arraybuffer:null},V],ee=[{sparseArrays:{testPlainObjects:!0,test:function test(e){return Array.isArray(e)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],te=[q,Y,H,K,X,j,M,N,x,P,I,m,S,T].concat("function"==typeof Map?$:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?h:[],"function"==typeof Uint8Array?W:[],"function"==typeof DataView?A:[],"undefined"!=typeof Intl?C:[],"undefined"!=typeof crypto?O:[],"undefined"!=typeof BigInt?[g,b]:[]),re=te.concat({checkDataCloneException:{test:function test(e){var t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(_typeof$1(e))||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"===_typeof$1(e)&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}}),ne=[ee,Y],oe=[Z];e.JSON_TYPES=f,e.Typeson=u,e.TypesonPromise=t,e.Undefined=s,e.arrayNonindexKeys=H,e.arraybuffer=h,e.bigint=g,e.bigintObject=b,e.blob=m,e.builtin=Z,e.cloneable=w,e.cryptokey=O,e.dataview=A,e.date=j,e.error=S,e.errors=T,e.escapeKeyPathComponent=escapeKeyPathComponent,e.file=P,e.filelist=I,e.getByKeyPath=getByKeyPath,e.getJSONType=getJSONType,e.hasConstructorOf=hasConstructorOf,e.imagebitmap=x,e.imagedata=N,e.infinity=E,e.intlTypes=C,e.isObject=isObject,e.isPlainObject=isPlainObject,e.isThenable=isThenable,e.isUserObject=isUserObject,e.map=$,e.nan=L,e.negativeInfinity=B,e.negativeZero=U,e.nonbuiltinIgnore=F,e.postmessage=z,e.primitiveObjects=K,e.regexp=M,e.resurrectable=D,e.set=J,e.setAtKeyPath=setAtKeyPath,e.socketio=Q,e.sparseUndefined=ee,e.specialNumbers=X,e.structuredCloning=te,e.structuredCloningThrowing=re,e.toStringTag=toStringTag,e.typedArrays=W,e.typedArraysSocketio=V,e.undef=Y,e.undefPreset=ne,e.unescapeKeyPathComponent=unescapeKeyPathComponent,e.universal=oe,e.userObject=q}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TypesonNamespace={})}(this,(function(e){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var t=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));t.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(t.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),t.prototype.then=function(e,r){var n=this;return new t((function(t,o){n.p.then((function(r){t(e?e(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(t,o)}))},t.prototype.catch=function(e){return this.then((function(){}),e)},t.resolve=function(e){return new t((function(t){t(e)}))},t.reject=function(e){return new t((function(t,r){r(e)}))},t.all=function(e){return new t((function(t,r){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))},t.race=function(e){return new t((function(t,r){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))},t.allSettled=function(e){return new t((function(t,r){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(t,r)}))};var r=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,t){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===t;var i=r(o,"constructor")&&o.constructor;return"function"!=typeof i?null===t:t===i||null!==t&&Function.prototype.toString.call(i)===Function.prototype.toString.call(t)||"function"==typeof t&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===t.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=n(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}var u=function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}return _createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(e,r,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],d=!("cyclic"in s)||s.cyclic,h=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},g=_async((function(e,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),d=hasConstructorOf(v,t);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&d)return _await(v.p,(function(t){l[y]=t;var r=g(e,i);return o=!0,r}))}),(function(t){return o?t:(u?l[y]=v:e=d?v.p:v,g(e,i))}))})))),(function(){return e}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=c.map((function(t){var r=e[t];return delete e[t],r}));r(),c.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(e,r,n,c,f,v,d){var b,g={},_=_typeof(r),O=h?function(o){var i,a=null!==(i=null!=d?d:c.type)&&void 0!==i?i:getJSONType(r);h(Object.assign(null!=o?o:g,{keypath:e,value:r,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,t)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(e,r,c,f,!1,v,O))!==r&&(g={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=y.indexOf(r);if(!(A<0))return l[e]="#",O&&O({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(r),p.push(e))}var j,S,T=isPlainObject(r),P=a(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(e,r,c,f,T||P,null,O);if(I!==r?(b=I,g={replaced:I}):""===e&&hasConstructorOf(r,t)?(f.push([e,r,n,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(r.length),g={clone:j}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,t)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(j={},c.addLength&&(j.length=r.length),g={clone:j}),O&&O(),s.iterateNone)return null!==(S=j)&&void 0!==S?S:b;if(!j)return b;if(c.iterateIn){var x=function _loop(o){var a={ownKeys:i(r,o)};m(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,r[o],Boolean(n),c,f,v);hasConstructorOf(a,t)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var N in r)x(N);O&&O({endIterateIn:!0,end:!0})}else o(r).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);m(c,{ownKeys:!0},(function(){var e=_encapsulate(i,r[o],Boolean(n),c,f,v);hasConstructorOf(e,t)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var E=r.length,k=function _loop2(o){if(!(o in r)){var i="".concat(e).concat(e?".":"").concat(o);m(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,t)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},C=0;C<E;C++)k(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return j},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,d&&"readonly",r,n,i,p);a&&a({replacing:!0});var h=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");h=y.replace(t,r)}else h=y.replaceAsync(t,r);return _(e,h,d&&"readonly",r,n,i,p)}}return t},O=_("",e,d,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(g(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(e,r){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),r),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var u=e.$types;if(!0===u)return finishRevival(e.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(e);var f=[],l={},y=!0;u.$&&isPlainObject(u.$)&&(e=e.$,u=u.$,y=!1);var p=function executeReviver(e,t){var r,o=_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return t;if(!c&&o.reviveAsync)return o.reviveAsync(t,l);if(o.revive)return o.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,s)?void 0:e}var d,h=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),o=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:o,type:e}),delete u[o])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),t))return a.then((function(t){var r=setAtKeyPath(e,o,t);r===t&&(e=r)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(h,t)?d=h.then((function(){return e})):(d=function _revive(e,r,n,i,c){if(!y||"$types"!==e){var l=u[e],d=a(r);if(d||isPlainObject(r)){var h=d?new Array(r.length):{};for(o(r).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),r[o],null!=n?n:h,h,o),a=function set(e){return hasConstructorOf(e,s)?h[o]=void 0:void 0!==e&&(h[o]=e),e};hasConstructorOf(i,t)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=h;f.length;){var b=_slicedToArray(f[0],4),g=b[0],m=b[1],_=b[2],w=b[3],O=getByKeyPath(g,m);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var A=getByKeyPath(n,r.slice(1));return void 0===A&&f.push([n,r.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,r){if(hasConstructorOf(e,t))return e.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,e)}),r)}}("",e,null),v.length&&(d=t.resolve(d).then((function(e){return t.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(d)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(d,t)?d.p.then(checkUndefined):d:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(d):Promise.resolve(checkUndefined(d))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,n=null!=t?t:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(t){var o;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(f.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[t],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof i){var s=i;i={test:function test(e){return e&&e.constructor===s},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(s.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:t,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),r.revivers[t]=[v,{plain:i.testPlainObjects}]}r.types[t]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}]),Typeson}(),s=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));s.__typeson__type__="TypesonUndefined";for(var f=["null","boolean","number","string","array","object"],l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),p=0;p<64;p++)y[l.codePointAt(p)]=p;var v=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=l[n[a]>>2],i+=l[(3&n[a])<<4|n[a+1]>>4],i+=l[(15&n[a+1])<<2|n[a+2]>>6],i+=l[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},d=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=y[e.codePointAt(f)],n=y[e.codePointAt(f+1)],o=y[e.codePointAt(f+2)],i=y[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},h={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),v(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=d(e);return t.buffers.push(r),r}}},b={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},g={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var m={blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(e){return new t((function(t,r){var n=new FileReader;n.addEventListener("load",(function(){t({type:e.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(e)}))}}};function generateUUID(){var e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}var _={},w={cloneable:{test:function test(e){return e&&"object"===_typeof$1(e)&&"function"==typeof e[Symbol.for("cloneEncapsulate")]},replace:function replace(e){var t=e[Symbol.for("cloneEncapsulate")](),r=generateUUID();return _[r]=e,{uuid:r,encapsulated:t}},revive:function revive(e){var t=e.uuid,r=e.encapsulated;return _[t][Symbol.for("cloneRevive")](r)}}},O={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(e){return new t(function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(t,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",e);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:t({jwk:n,algorithm:e.algorithm,usages:e.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(e,r){return t.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}},A={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:v(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=d(i),t.buffers.push(r)),new DataView(r,n,o)}}},j={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},S={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},T={};function create$2(e){T[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$2(e)})),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);var P={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(e){return new t((function(t,r){var n=new FileReader;n.addEventListener("load",(function(){t({type:e.type,stringContents:n.result,name:e.name,lastModified:e.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(e)}))}}},I={file:P.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){!function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},x={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(e){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=e,new t(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}},N={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},E={infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},k={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},C={IntlCollator:k,IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},$={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},L={nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},B={negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},U={negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}},F={nonbuiltinIgnore:{test:function test(e){return e&&"object"===_typeof$1(e)&&!Array.isArray(e)&&!["Object","Boolean","Number","String","Error","RegExp","Math","Date","Map","Set","JSON","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","Promise","String Iterator","Array Iterator","Map Iterator","Set Iterator","WeakMap","WeakSet","Atomics","Module"].includes(toStringTag(e))},replace:function replace(e){}}},K={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},M={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},G={},D={resurrectable:{test:function test(e){return e&&!Array.isArray(e)&&["object","function","symbol"].includes(_typeof$1(e))},replace:function replace(e){var t=generateUUID();return G[t]=e,t},revive:function revive(e){return G[e]}}},J={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},V={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create$1(e){var t=e.name;V[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e){return(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer},revive:function revive(t){return"ArrayBuffer"===toStringTag(t)?new e(t):t}}}(e)}));var W={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;W[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:v(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=d(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var Y={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new s}}},q={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},H=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],X=[L,E,B,U],Z=[Y,H,K,X,j,S,T,M].concat("function"==typeof Map?$:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?h:[],"function"==typeof Uint8Array?W:[],"function"==typeof DataView?A:[],"undefined"!=typeof Intl?C:[],"undefined"!=typeof BigInt?[g,b]:[]),z=[S,T],Q=[Z,{arraybuffer:null},V],ee=[{sparseArrays:{testPlainObjects:!0,test:function test(e){return Array.isArray(e)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],te=[q,Y,H,K,X,j,M,N,x,P,I,m,S,T].concat("function"==typeof Map?$:[],"function"==typeof Set?J:[],"function"==typeof ArrayBuffer?h:[],"function"==typeof Uint8Array?W:[],"function"==typeof DataView?A:[],"undefined"!=typeof Intl?C:[],"undefined"!=typeof crypto?O:[],"undefined"!=typeof BigInt?[g,b]:[]),re=te.concat({checkDataCloneException:{test:function test(e){var t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(_typeof$1(e))||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"===_typeof$1(e)&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}}),ne=[ee,Y],oe=[Z];e.JSON_TYPES=f,e.Typeson=u,e.TypesonPromise=t,e.Undefined=s,e.arrayNonindexKeys=H,e.arraybuffer=h,e.bigint=g,e.bigintObject=b,e.blob=m,e.builtin=Z,e.cloneable=w,e.cryptokey=O,e.dataview=A,e.date=j,e.error=S,e.errors=T,e.escapeKeyPathComponent=escapeKeyPathComponent,e.file=P,e.filelist=I,e.getByKeyPath=getByKeyPath,e.getJSONType=getJSONType,e.hasConstructorOf=hasConstructorOf,e.imagebitmap=x,e.imagedata=N,e.infinity=E,e.intlTypes=C,e.isObject=isObject,e.isPlainObject=isPlainObject,e.isThenable=isThenable,e.isUserObject=isUserObject,e.map=$,e.nan=L,e.negativeInfinity=B,e.negativeZero=U,e.nonbuiltinIgnore=F,e.postmessage=z,e.primitiveObjects=K,e.regexp=M,e.resurrectable=D,e.set=J,e.setAtKeyPath=setAtKeyPath,e.socketio=Q,e.sparseUndefined=ee,e.specialNumbers=X,e.structuredCloning=te,e.structuredCloningThrowing=re,e.toStringTag=toStringTag,e.typedArrays=W,e.typedArraysSocketio=V,e.undef=Y,e.undefPreset=ne,e.unescapeKeyPathComponent=unescapeKeyPathComponent,e.universal=oe,e.userObject=q}));
//# sourceMappingURL=index.umd.min.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).builtin=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),S=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,S))!==t&&(m={replaced:h}):h=t,S&&S(),h;if(null===t)return S&&S(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var A=y.indexOf(t);if(!(A<0))return l[e]="#",S&&S({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,S);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),S&&S(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var E in t)P(E);S&&S({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),S&&S({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=t.length,C=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<k;$++)C($);S&&S({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},S=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(S,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(S)]:f?h(S):Promise.resolve(h(S))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],S=getByKeyPath(m,_);if(void 0===S)break;g[O]=S,f.splice(0,1)}}if(!l)return t;if("#"===l){var A=getByKeyPath(n,t.slice(1));return void 0===A&&f.push([n,t.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$1(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<_.length;O++)g[_.codePointAt(O)]=O;var S=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},A=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),S(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=A(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=A(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=A(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},E={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},k={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}};return[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[E,k]:[])}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).builtin=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),S=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,S))!==t&&(m={replaced:h}):h=t,S&&S(),h;if(null===t)return S&&S(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var A=y.indexOf(t);if(!(A<0))return l[e]="#",S&&S({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,S);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),S&&S(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var E in t)P(E);S&&S({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),S&&S({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=t.length,C=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<k;$++)C($);S&&S({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},S=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(S,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(S)]:f?h(S):Promise.resolve(h(S))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],S=getByKeyPath(m,_);if(void 0===S)break;g[O]=S,f.splice(0,1)}}if(!l)return t;if("#"===l){var A=getByKeyPath(n,t.slice(1));return void 0===A&&f.push([n,t.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$1(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<64;O++)g[_.codePointAt(O)]=O;var S=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},A=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),S(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=A(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=A(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=A(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},E={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},k={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}};return[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[E,k]:[])}));
//# sourceMappingURL=builtin.umd.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).socketio=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),A=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,A))!==t&&(m={replaced:h}):h=t,A&&A(),h;if(null===t)return A&&A(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var S=y.indexOf(t);if(!(S<0))return l[e]="#",A&&A({cyclicKeypath:p[S]}),"#"+p[S];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,A);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),A&&A(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var C in t)P(C);A&&A({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),A&&A({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var E=t.length,k=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<E;$++)k($);A&&A({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},A=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(A,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(A)]:f?h(A):Promise.resolve(h(A))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],A=getByKeyPath(m,_);if(void 0===A)break;g[O]=A,f.splice(0,1)}}if(!l)return t;if("#"===l){var S=getByKeyPath(n,t.slice(1));return void 0===S&&f.push([n,t.slice(1),i,c]),S}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$2(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$2(e)})),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<_.length;O++)g[_.codePointAt(O)]=O;var A=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),A(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=S(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create$1(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:A(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=S(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:A(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=S(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},E={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},k=[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[C,E]:[]),$={};return"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;$[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e){return(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer},revive:function revive(r){return"ArrayBuffer"===toStringTag(r)?new e(r):r}}}(e)})),[k,{arraybuffer:null},$]}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).socketio=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),A=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,A))!==t&&(m={replaced:h}):h=t,A&&A(),h;if(null===t)return A&&A(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var S=y.indexOf(t);if(!(S<0))return l[e]="#",A&&A({cyclicKeypath:p[S]}),"#"+p[S];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,A);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),A&&A(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var C in t)P(C);A&&A({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),A&&A({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var E=t.length,k=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<E;$++)k($);A&&A({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},A=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(A,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(A)]:f?h(A):Promise.resolve(h(A))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],A=getByKeyPath(m,_);if(void 0===A)break;g[O]=A,f.splice(0,1)}}if(!l)return t;if("#"===l){var S=getByKeyPath(n,t.slice(1));return void 0===S&&f.push([n,t.slice(1),i,c]),S}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$2(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$2(e)})),"undefined"!=typeof AggregateError&&create$2(AggregateError),"function"==typeof InternalError&&create$2(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<64;O++)g[_.codePointAt(O)]=O;var A=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),A(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=S(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create$1(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:A(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=S(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:A(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=S(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},E={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},k=[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[C,E]:[]),$={};return"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;$[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e){return(0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e:e.slice(0)).buffer},revive:function revive(r){return"ArrayBuffer"===toStringTag(r)?new e(r):r}}}(e)})),[k,{arraybuffer:null},$]}));
//# sourceMappingURL=socketio.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).structuredCloningThrowing=t()}(this,(function(){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),f=s.sync,l={},y=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[y]=e;var r=m(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[y]=v:t=h?v.p:v,m(t,i))}))})))),(function(){return t}))}))})),g=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,a,c,f,v,h){var b,m={},_=_typeof(r),O=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:m,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(t,r,c,f,!1,v,O))!==r&&(m={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var j=y.indexOf(r);if(!(j<0))return l[t]="#",O&&O({cyclicKeypath:p[j]}),"#"+p[j];!0===a&&(y.push(r),p.push(t))}var S,A,T=isPlainObject(r),P=i(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(t,r,c,f,T||P,null,O);if(I!==r?(b=I,m={replaced:I}):""===t&&hasConstructorOf(r,e)?(f.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),m={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),m={clone:S}),O&&O(),s.iterateNone)return null!==(A=S)&&void 0!==A?A:b;if(!S)return b;if(c.iterateIn){var E=function _loop(n){var i={ownKeys:o(r,n)};g(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(i,e)?f.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var N in r)E(N);O&&O({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);g(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);g(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},C=0;C<k;C++)x(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return S},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(t,r)}else d=y.replaceAsync(t,r);return _(e,d,h&&"readonly",r,n,i,p)}}return t},O=_("",t,h,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!y||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;f.length;){var b=_slicedToArray(f[0],4),m=b[0],g=b[1],_=b[2],w=b[3],O=getByKeyPath(m,g);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var j=getByKeyPath(o,r.slice(1));return void 0===j&&f.push([o,r.slice(1),a,u]),j}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var f=a;a={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var y={type:t,test:a.test.bind(a)};a.replace&&(y.replace=a.replace.bind(a)),a.replaceAsync&&(y.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var u=["null","boolean","number","string","array","object"],s={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},f=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],l={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new c}}},y={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},p=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],v={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},h={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},d={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},b={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},m={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},g={};function create$1(e){g[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=new Uint8Array(256),O=0;O<_.length;O++)w[_.codePointAt(O)]=O;var j=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=w[e.codePointAt(f)],n=w[e.codePointAt(f+1)],o=w[e.codePointAt(f+2)],i=w[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},A={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),j(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=S(e);return t.buffers.push(r),r}}},T={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;T[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=S(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var P={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=S(i),t.buffers.push(r)),new DataView(r,n,o)}}},I={IntlCollator:{test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},E={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},N={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(t){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var k={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},x={file:k.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){_classCallCheck$1(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},$={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},L={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(t){return new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",t);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:e({jwk:n,algorithm:t.algorithm,usages:t.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}};return[s,l,f,y,p,v,h,E,N,k,x,{blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},m,g].concat("function"==typeof Map?d:[],"function"==typeof Set?b:[],"function"==typeof ArrayBuffer?A:[],"function"==typeof Uint8Array?T:[],"function"==typeof DataView?P:[],"undefined"!=typeof Intl?I:[],"undefined"!=typeof crypto?L:[],"undefined"!=typeof BigInt?[C,$]:[]).concat({checkDataCloneException:{test:function test(e){var t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(_typeof$1(e))||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"===_typeof$1(e)&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).structuredCloningThrowing=t()}(this,(function(){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),f=s.sync,l={},y=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[y]=e;var r=m(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[y]=v:t=h?v.p:v,m(t,i))}))})))),(function(){return t}))}))})),g=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,a,c,f,v,h){var b,m={},_=_typeof(r),O=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:m,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(t,r,c,f,!1,v,O))!==r&&(m={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var j=y.indexOf(r);if(!(j<0))return l[t]="#",O&&O({cyclicKeypath:p[j]}),"#"+p[j];!0===a&&(y.push(r),p.push(t))}var S,A,T=isPlainObject(r),P=i(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(t,r,c,f,T||P,null,O);if(I!==r?(b=I,m={replaced:I}):""===t&&hasConstructorOf(r,e)?(f.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),m={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),m={clone:S}),O&&O(),s.iterateNone)return null!==(A=S)&&void 0!==A?A:b;if(!S)return b;if(c.iterateIn){var E=function _loop(n){var i={ownKeys:o(r,n)};g(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(i,e)?f.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var N in r)E(N);O&&O({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);g(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);g(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},C=0;C<k;C++)x(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return S},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(t,r)}else d=y.replaceAsync(t,r);return _(e,d,h&&"readonly",r,n,i,p)}}return t},O=_("",t,h,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!y||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;f.length;){var b=_slicedToArray(f[0],4),m=b[0],g=b[1],_=b[2],w=b[3],O=getByKeyPath(m,g);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var j=getByKeyPath(o,r.slice(1));return void 0===j&&f.push([o,r.slice(1),a,u]),j}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var f=a;a={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var y={type:t,test:a.test.bind(a)};a.replace&&(y.replace=a.replace.bind(a)),a.replaceAsync&&(y.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var u=["null","boolean","number","string","array","object"],s={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},f=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],l={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new c}}},y={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},p=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],v={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},h={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},d={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},b={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},m={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},g={};function create$1(e){g[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=new Uint8Array(256),O=0;O<64;O++)w[_.codePointAt(O)]=O;var j=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=w[e.codePointAt(f)],n=w[e.codePointAt(f+1)],o=w[e.codePointAt(f+2)],i=w[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},A={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),j(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=S(e);return t.buffers.push(r),r}}},T={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;T[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=S(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var P={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=S(i),t.buffers.push(r)),new DataView(r,n,o)}}},I={IntlCollator:{test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},E={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},N={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(t){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var k={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},x={file:k.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){!function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},$={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},L={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(t){return new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",t);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:e({jwk:n,algorithm:t.algorithm,usages:t.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}};return[s,l,f,y,p,v,h,E,N,k,x,{blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},m,g].concat("function"==typeof Map?d:[],"function"==typeof Set?b:[],"function"==typeof ArrayBuffer?A:[],"function"==typeof Uint8Array?T:[],"function"==typeof DataView?P:[],"undefined"!=typeof Intl?I:[],"undefined"!=typeof crypto?L:[],"undefined"!=typeof BigInt?[C,$]:[]).concat({checkDataCloneException:{test:function test(e){var t={}.toString.call(e).slice(8,-1);if(["symbol","function"].includes(_typeof$1(e))||["Arguments","Module","Error","Promise","WeakMap","WeakSet","Event","MessageChannel"].includes(t)||e&&"object"===_typeof$1(e)&&"number"==typeof e.nodeType&&"function"==typeof e.insertBefore)throw new DOMException("The object cannot be cloned.","DataCloneError");return!1}}})}));
//# sourceMappingURL=structured-cloning-throwing.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).structuredCloning=t()}(this,(function(){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),f=s.sync,l={},y=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[y]=e;var r=m(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[y]=v:t=h?v.p:v,m(t,i))}))})))),(function(){return t}))}))})),g=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,a,c,f,v,h){var b,m={},_=_typeof(r),O=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:m,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(t,r,c,f,!1,v,O))!==r&&(m={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var j=y.indexOf(r);if(!(j<0))return l[t]="#",O&&O({cyclicKeypath:p[j]}),"#"+p[j];!0===a&&(y.push(r),p.push(t))}var S,A,T=isPlainObject(r),P=i(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(t,r,c,f,T||P,null,O);if(I!==r?(b=I,m={replaced:I}):""===t&&hasConstructorOf(r,e)?(f.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),m={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),m={clone:S}),O&&O(),s.iterateNone)return null!==(A=S)&&void 0!==A?A:b;if(!S)return b;if(c.iterateIn){var N=function _loop(n){var i={ownKeys:o(r,n)};g(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(i,e)?f.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var E in r)N(E);O&&O({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);g(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);g(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},C=0;C<k;C++)x(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return S},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(t,r)}else d=y.replaceAsync(t,r);return _(e,d,h&&"readonly",r,n,i,p)}}return t},O=_("",t,h,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!y||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;f.length;){var b=_slicedToArray(f[0],4),m=b[0],g=b[1],_=b[2],w=b[3],O=getByKeyPath(m,g);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var j=getByKeyPath(o,r.slice(1));return void 0===j&&f.push([o,r.slice(1),a,u]),j}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var f=a;a={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var y={type:t,test:a.test.bind(a)};a.replace&&(y.replace=a.replace.bind(a)),a.replaceAsync&&(y.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var u=["null","boolean","number","string","array","object"],s={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},f=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],l={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new c}}},y={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},p=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],v={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},h={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},d={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},b={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},m={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},g={};function create$1(e){g[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=new Uint8Array(256),O=0;O<_.length;O++)w[_.codePointAt(O)]=O;var j=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=w[e.codePointAt(f)],n=w[e.codePointAt(f+1)],o=w[e.codePointAt(f+2)],i=w[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},A={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),j(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=S(e);return t.buffers.push(r),r}}},T={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;T[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=S(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var P={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=S(i),t.buffers.push(r)),new DataView(r,n,o)}}},I={IntlCollator:{test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},N={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},E={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(t){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var k={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},x={file:k.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){_classCallCheck$1(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},L={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},$={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(t){return new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",t);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:e({jwk:n,algorithm:t.algorithm,usages:t.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}};return[s,l,f,y,p,v,h,N,E,k,x,{blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},m,g].concat("function"==typeof Map?d:[],"function"==typeof Set?b:[],"function"==typeof ArrayBuffer?A:[],"function"==typeof Uint8Array?T:[],"function"==typeof DataView?P:[],"undefined"!=typeof Intl?I:[],"undefined"!=typeof crypto?$:[],"undefined"!=typeof BigInt?[C,L]:[])}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).structuredCloning=t()}(this,(function(){"use strict";function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,o){var i=t&&t.prototype instanceof Generator?t:Generator,a=Object.create(i.prototype),c=new Context(o||[]);return n(a,"_invoke",{value:makeInvokeMethod(e,r,c)}),a}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var s={};define(s,i,(function(){return this}));var f=Object.getPrototypeOf,l=f&&f(f(values([])));l&&l!==t&&r.call(l,i)&&(s=l);var y=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(s);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,o,i,a){var c=tryCatch(e[n],e,o);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==typeof s&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){invoke("next",e,i,a)}),(function(e){invoke("throw",e,i,a)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return invoke("throw",e,i,a)}))}a(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return doneResult()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=maybeInvokeDelegate(a,r);if(c){if(c===u)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=tryCatch(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var o=tryCatch(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,u;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return o.next=o}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(y,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,c,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},defineIteratorMethods(y),define(y,c,"Generator"),define(y,i,(function(){return this})),define(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return handle("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0);if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return handle(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return handle(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(a)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _defineProperty$1(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$1(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray$1(e,t)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey$1(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isUserObject(e){if(!e||"Object"!==toStringTag(e))return!1;var t=r(e);return!t||hasConstructorOf(e,Object)||isUserObject(t)}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),f=s.sync,l={},y=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=_(u,n,s,f,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[y]=e;var r=m(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[y]=v:t=h?v.p:v,m(t,i))}))})))),(function(){return t}))}))})),g=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},_=function _encapsulate(t,r,a,c,f,v,h){var b,m={},_=_typeof(r),O=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:m,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(_))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:w(t,r,c,f,!1,v,O))!==r&&(m={replaced:b}):b=r,O&&O(),b;if(null===r)return O&&O(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var j=y.indexOf(r);if(!(j<0))return l[t]="#",O&&O({cyclicKeypath:p[j]}),"#"+p[j];!0===a&&(y.push(r),p.push(t))}var S,A,T=isPlainObject(r),P=i(r),I=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:w(t,r,c,f,T||P,null,O);if(I!==r?(b=I,m={replaced:I}):""===t&&hasConstructorOf(r,e)?(f.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),m={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),m={clone:S}),O&&O(),s.iterateNone)return null!==(A=S)&&void 0!==A?A:b;if(!S)return b;if(c.iterateIn){var N=function _loop(n){var i={ownKeys:o(r,n)};g(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(i,e)?f.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var E in r)N(E);O&&O({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);g(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),O&&O({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=r.length,x=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);g(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,f,v);hasConstructorOf(t,e)?f.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},C=0;C<k;C++)x(C);O&&O({endIterateUnsetNumeric:!0,end:!0})}return S},w=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(t,r)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),_(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(t,r)}else d=y.replaceAsync(t,r);return _(e,d,h&&"readonly",r,n,i,p)}}return t},O=_("",t,h,null!=r?r:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(O,v)).then(b);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[b(O)]:f?b(O):Promise.resolve(b(O))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,y=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!y||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;f.length;){var b=_slicedToArray(f[0],4),m=b[0],g=b[1],_=b[2],w=b[3],O=getByKeyPath(m,g);if(void 0===O)break;_[w]=O,f.splice(0,1)}}if(!l)return r;if("#"===l){var j=getByKeyPath(o,r.slice(1));return void 0===j&&f.push([o,r.slice(1),a,u]),j}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var f=a;a={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var y={type:t,test:a.test.bind(a)};a.replace&&(y.replace=a.replace.bind(a)),a.replaceAsync&&(y.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,y):r.nonplainObjectReplacers.splice(p,0,y),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var u=["null","boolean","number","string","array","object"],s={userObject:{test:function test(e,t){return isUserObject(e)},replace:function replace(e){return function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$1(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)},revive:function revive(e){return e}}},f=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,t){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(t.iterateIn="object",t.addLength=!0),!0)},replace:function replace(e,t){return t.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var t=[];return Object.entries(e).forEach((function(e){var r=_slicedToArray$1(e,2),n=r[0],o=r[1];t[n]=o})),t}}},{sparseUndefined:{test:function test(e,t){return void 0===e&&!1===t.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}],l={undef:{test:function test(e,t){return void 0===e&&(t.ownKeys||!("ownKeys"in t))},replace:function replace(e){return 0},revive:function revive(e){return new c}}},y={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},p=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],v={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var t=e.getTime();return Number.isNaN(t)?"NaN":t},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},h={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var t=e.source,r=e.flags;return new RegExp(t,r)}}},d={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},b={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},m={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var t=new Error(e.message);return t.name=e.name,t.cause=e.cause,t.stack=e.stack,t.fileName=e.fileName,t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}}},g={};function create$1(e){g[e.name.toLowerCase()]={test:function test(t){return hasConstructorOf(t,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(t){var r="undefined"!=typeof AggregateError&&e===AggregateError,n=r?new e(t.errors,t.message):new e(t.message);return n.name=t.name,n.cause=t.cause,n.stack=t.stack,n.fileName=t.fileName,n.lineNumber=t.lineNumber,n.columnNumber=t.columnNumber,r&&(n.errors=t.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=new Uint8Array(256),O=0;O<64;O++)w[_.codePointAt(O)]=O;var j=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},S=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<t;f+=4)r=w[e.codePointAt(f)],n=w[e.codePointAt(f+1)],o=w[e.codePointAt(f+2)],i=w[e.codePointAt(f+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},A={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),j(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=S(e);return t.buffers.push(r),r}}},T={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var t=e.name;T[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=S(a),r.buffers.push(n)),new e(n,o,i)}}}(e)}));var P={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:j(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=S(i),t.buffers.push(r)),new DataView(r,n,o)}}},I={IntlCollator:{test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},IntlDateTimeFormat:{test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},IntlNumberFormat:{test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}}},N={imagedata:{test:function test(e){return"ImageData"===toStringTag(e)},replace:function replace(e){return{array:_toConsumableArray$1(e.data),width:e.width,height:e.height}},revive:function revive(e){return new ImageData(new Uint8ClampedArray(e.array),e.width,e.height)}}},E={imagebitmap:{test:function test(e){return"ImageBitmap"===toStringTag(e)||e&&e.dataset&&"ImageBitmap"===e.dataset.toStringTag},replace:function replace(e){var t=document.createElement("canvas");return t.getContext("2d").drawImage(e,0,0),t.toDataURL()},revive:function revive(e){var t=document.createElement("canvas"),r=t.getContext("2d"),n=document.createElement("img");return n.addEventListener("load",(function(){r.drawImage(n,0,0)})),n.src=e,t},reviveAsync:function reviveAsync(t){var r=document.createElement("canvas"),n=r.getContext("2d"),o=document.createElement("img");return o.addEventListener("load",(function(){n.drawImage(o,0,0)})),o.src=t,new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,t){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,createImageBitmap(r);case 3:n=o.sent,e(n),o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),t(o.t0);case 10:case"end":return o.stop()}}),_callee,null,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}())}}};function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var k={file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},x={file:k.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){!function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}},C={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},L={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}},$={cryptokey:{test:function test(e){return"CryptoKey"===toStringTag(e)&&e.extractable},replaceAsync:function replaceAsync(t){return new e(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e,r){var n;return _regeneratorRuntime().wrap((function _callee$(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,crypto.subtle.exportKey("jwk",t);case 3:n=o.sent,o.next=10;break;case 6:return o.prev=6,o.t0=o.catch(0),r(o.t0),o.abrupt("return");case 10:e({jwk:n,algorithm:t.algorithm,usages:t.usages});case 11:case"end":return o.stop()}}),_callee,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}())},revive:function revive(e){var t=e.jwk,r=e.algorithm,n=e.usages;return crypto.subtle.importKey("jwk",t,r,!0,n)}}};return[s,l,f,y,p,v,h,N,E,k,x,{blob:{test:function test(e){return"Blob"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad Blob access: "+t.status);return{type:e.type,stringContents:t.responseText}},revive:function revive(e){var t=e.type,r=e.stringContents;return new Blob([string2arraybuffer(r)],{type:t})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}},m,g].concat("function"==typeof Map?d:[],"function"==typeof Set?b:[],"function"==typeof ArrayBuffer?A:[],"function"==typeof Uint8Array?T:[],"function"==typeof DataView?P:[],"undefined"!=typeof Intl?I:[],"undefined"!=typeof crypto?$:[],"undefined"!=typeof BigInt?[C,L]:[])}));
//# sourceMappingURL=structured-cloning.umd.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).universal=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),S=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,S))!==t&&(m={replaced:h}):h=t,S&&S(),h;if(null===t)return S&&S(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var A=y.indexOf(t);if(!(A<0))return l[e]="#",S&&S({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,S);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),S&&S(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var E in t)P(E);S&&S({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),S&&S({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=t.length,C=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<k;$++)C($);S&&S({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},S=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(S,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(S)]:f?h(S):Promise.resolve(h(S))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],S=getByKeyPath(m,_);if(void 0===S)break;g[O]=S,f.splice(0,1)}}if(!l)return t;if("#"===l){var A=getByKeyPath(n,t.slice(1));return void 0===A&&f.push([n,t.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$1(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<_.length;O++)g[_.codePointAt(O)]=O;var S=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},A=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),S(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=A(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=A(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=A(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},E={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},k={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}};return[[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[E,k]:[])]}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).universal=r()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _slicedToArray$1(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray$1(e,r)||function _nonIterableRest(){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 _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray$1(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray$1(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray$1(e,r):void 0}}function _arrayLikeToArray$1(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var e=[{arrayNonindexKeys:{testPlainObjects:!0,test:function test(e,r){return!!Array.isArray(e)&&(Object.keys(e).some((function(e){return String(Number.parseInt(e))!==e}))&&(r.iterateIn="object",r.addLength=!0),!0)},replace:function replace(e,r){return r.iterateUnsetNumeric=!0,e},revive:function revive(e){if(Array.isArray(e))return e;var r=[];return Object.entries(e).forEach((function(e){var t=_slicedToArray$1(e,2),n=t[0],o=t[1];r[n]=o})),r}}},{sparseUndefined:{test:function test(e,r){return void 0===e&&!1===r.ownKeys},replace:function replace(e){return 0},revive:function revive(e){}}}];function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||_unsupportedIterableToArray(e,r)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _toPropertyKey(e){var r=function _toPrimitive(e,r){if("object"!=_typeof$1(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(r)?r:String(r)}var r=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));r.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(r.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),r.prototype.then=function(e,t){var n=this;return new r((function(r,o){n.p.then((function(t){r(e?e(t):t)})).catch((function(e){return t?t(e):Promise.reject(e)})).then(r,o)}))},r.prototype.catch=function(e){return this.then((function(){}),e)},r.resolve=function(e){return new r((function(r){r(e)}))},r.reject=function(e){return new r((function(r,t){t(e)}))},r.all=function(e){return new r((function(r,t){Promise.all(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.race=function(e){return new r((function(r,t){Promise.race(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))},r.allSettled=function(e){return new r((function(r,t){Promise.allSettled(e.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(r,t)}))};var t=Object.hasOwn,n=Object.getPrototypeOf;function isThenable(e,r){return isObject(e)&&"function"==typeof e.then&&(!r||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,r){if(!e||"object"!==_typeof(e))return!1;var o=n(e);if(!o)return null===r;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===r:r===i||null!==r&&Function.prototype.toString.call(i)===Function.prototype.toString.call(r)||"function"==typeof r&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===r.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!n(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,r){if(""===r)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var t=r.indexOf(".");if(t>-1){var n=e[unescapeKeyPathComponent(r.slice(0,t))];return void 0===n?void 0:getByKeyPath(n,r.slice(t+1))}return e[unescapeKeyPathComponent(r)]}function setAtKeyPath(e,r,t){if(""===r)return t;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=r.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(r.slice(0,n))],r.slice(n+1),t):(e[unescapeKeyPathComponent(r)]=t,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,r,t){return t?r?r(e):e:(e&&e.then||(e=Promise.resolve(e)),r?e.then(r):e)}var o=Object.keys,i=Object.hasOwn,a=Array.isArray,c=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];try{return Promise.resolve(e.apply(this,r))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,r){var t,n;if(""===e.keypath)return-1;var o=null!==(t=e.keypath.match(/\./g))&&void 0!==t?t:0,i=null!==(n=r.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<r.keypath?-1:e.keypath>r.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,r,t,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return a(o)?JSON.stringify(o[0],r,t):o.then((function(e){return JSON.stringify(e,r,t)}))}},{key:"stringifySync",value:function stringifySync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,r,t,n){return this.stringify(e,r,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,r,t){return t=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),t),{},{parse:!0}),this.revive(JSON.parse(e,r),t)}},{key:"parseSync",value:function parseSync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,r,t){return this.parse(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.returnTypeNames=!0,this.encapsulate(e,r,t)}},{key:"rootTypeName",value:function rootTypeName(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.iterateNone=!0,this.encapsulate(e,r,t)}},{key:"encapsulate",value:function encapsulate(e,t,n){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),n),f=s.sync,l={},y=[],p=[],v=[],b=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,h=function finish(e){var r=Object.values(l);if(s.iterateNone)return r.length?r[0]:getJSONType(e);if(r.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(r));e&&isPlainObject(e)&&!i(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&i(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},m=_async((function(e,t){return _await(Promise.all(t.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(t.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],f=c[3],l=c[4],y=c[5],p=c[6],v=g(u,n,s,f,i,!0,p),b=hasConstructorOf(v,r);return function _invoke(e,r){var t=e();return t&&t.then?t.then(r):r(t)}((function(){if(u&&b)return _await(v.p,(function(r){l[y]=r;var t=m(e,i);return o=!0,t}))}),(function(r){return o?r:(u?l[y]=v:e=b?v.p:v,m(e,i))}))})))),(function(){return e}))}))})),_=function _adaptBuiltinStateObjectProperties(e,r,t){Object.assign(e,r);var n=c.map((function(r){var t=e[r];return delete e[r],t}));t(),c.forEach((function(r,t){e[r]=n[t]}))},g=function _encapsulate(e,t,n,c,f,v,b){var h,m={},g=_typeof(t),S=d?function(o){var i,a=null!==(i=null!=b?b:c.type)&&void 0!==i?i:getJSONType(t);d(Object.assign(null!=o?o:m,{keypath:e,value:t,cyclic:n,stateObj:c,promisesData:f,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(t,r)},{type:a}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===t||Number.isNaN(t)||t===Number.NEGATIVE_INFINITY||t===Number.POSITIVE_INFINITY||0===t?(h=c.replaced?t:O(e,t,c,f,!1,v,S))!==t&&(m={replaced:h}):h=t,S&&S(),h;if(null===t)return S&&S(),t;if(n&&!c.iterateIn&&!c.iterateUnsetNumeric&&t&&"object"===_typeof(t)){var A=y.indexOf(t);if(!(A<0))return l[e]="#",S&&S({cyclicKeypath:p[A]}),"#"+p[A];!0===n&&(y.push(t),p.push(e))}var j,w,T=isPlainObject(t),N=a(t),I=(T||N)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?t:O(e,t,c,f,T||N,null,S);if(I!==t?(h=I,m={replaced:I}):""===e&&hasConstructorOf(t,r)?(f.push([e,t,n,c,void 0,void 0,c.type]),h=t):N&&"object"!==c.iterateIn||"array"===c.iterateIn?(j=new Array(t.length),m={clone:j}):(["function","symbol"].includes(_typeof(t))||"toJSON"in t||hasConstructorOf(t,r)||hasConstructorOf(t,Promise)||hasConstructorOf(t,ArrayBuffer))&&!T&&"object"!==c.iterateIn?h=t:(j={},c.addLength&&(j.length=t.length),m={clone:j}),S&&S(),s.iterateNone)return null!==(w=j)&&void 0!==w?w:h;if(!j)return h;if(c.iterateIn){var P=function _loop(o){var a={ownKeys:i(t,o)};_(c,a,(function(){var i=e+(e?".":"")+escapeKeyPathComponent(o),a=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(a,r)?f.push([i,a,Boolean(n),c,j,o,c.type]):void 0!==a&&(j[o]=a)}))};for(var E in t)P(E);S&&S({endIterateIn:!0,end:!0})}else o(t).forEach((function(o){var i=e+(e?".":"")+escapeKeyPathComponent(o);_(c,{ownKeys:!0},(function(){var e=_encapsulate(i,t[o],Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))})),S&&S({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var k=t.length,C=function _loop2(o){if(!(o in t)){var i="".concat(e).concat(e?".":"").concat(o);_(c,{ownKeys:!1},(function(){var e=_encapsulate(i,void 0,Boolean(n),c,f,v);hasConstructorOf(e,r)?f.push([i,e,Boolean(n),c,j,o,c.type]):void 0!==e&&(j[o]=e)}))}},$=0;$<k;$++)C($);S&&S({endIterateUnsetNumeric:!0,end:!0})}return j},O=function replace(e,r,t,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var y=c[s];if(y.test(r,t)){var p=y.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(t,{type:p,replaced:!0}),(f||!y.replaceAsync)&&!y.replace)return a&&a({typeDetected:!0}),g(e,r,b&&"readonly",t,n,i,p);a&&a({replacing:!0});var d=void 0;if(f||!y.replaceAsync){if(void 0===y.replace)throw new TypeError("Missing replacer");d=y.replace(r,t)}else d=y.replaceAsync(r,t);return g(e,d,b&&"readonly",t,n,i,p)}}return r},S=g("",e,b,null!=t?t:{},v);if(v.length)return f&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(m(S,v)).then(h);if(!f&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&f?[h(S)]:f?h(S):Promise.resolve(h(S))}},{key:"encapsulateSync",value:function encapsulateSync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,r,t){return this.encapsulate(e,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"revive",value:function revive(e,t){var n=this,i=_objectSpread2(_objectSpread2({sync:!0},this.options),t),c=i.sync;function finishRevival(e){if(c)return e;if(i.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!e||"object"!==_typeof(e)||Array.isArray(e))return finishRevival(e);var s=e.$types;if(!0===s)return finishRevival(e.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(e);var f=[],l={},y=!0;s.$&&isPlainObject(s.$)&&(e=e.$,s=s.$,y=!1);var p=function executeReviver(e,r){var t,o=_slicedToArray(null!==(t=n.revivers[e])&&void 0!==t?t:[],1)[0];if(!o)throw new Error("Unregistered type: "+e);if(c&&!("revive"in o))return r;if(!c&&o.reviveAsync)return o.reviveAsync(r,l);if(o.revive)return o.revive(r,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,u)?void 0:e}var b,d=function revivePlainObjects(){var t=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var r=_slicedToArray(e,2),o=r[0],i=r[1];"#"!==i&&[].concat(i).forEach((function(e){var r;_slicedToArray(null!==(r=n.revivers[e])&&void 0!==r?r:[null,{}],2)[1].plain&&(t.push({keypath:o,type:e}),delete s[o])}))})),t.length)return t.sort(nestedPathsFirst).reduce((function reducer(t,n){var o=n.keypath,i=n.type;if(isThenable(t))return t.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(e,o);if(hasConstructorOf(a=p(i,a),r))return a.then((function(r){var t=setAtKeyPath(e,o,r);t===r&&(e=t)}));var c=setAtKeyPath(e,o,a);c===a&&(e=c)}),void 0)}();return hasConstructorOf(d,r)?b=d.then((function(){return e})):(b=function _revive(e,t,n,i,c){if(!y||"$types"!==e){var l=s[e],b=a(t);if(b||isPlainObject(t)){var d=b?new Array(t.length):{};for(o(t).forEach((function(o){var i=_revive(e+(e?".":"")+escapeKeyPathComponent(o),t[o],null!=n?n:d,d,o),a=function set(e){return hasConstructorOf(e,u)?d[o]=void 0:void 0!==e&&(d[o]=e),e};hasConstructorOf(i,r)?v.push(i.then((function(e){return a(e)}))):a(i)})),t=d;f.length;){var h=_slicedToArray(f[0],4),m=h[0],_=h[1],g=h[2],O=h[3],S=getByKeyPath(m,_);if(void 0===S)break;g[O]=S,f.splice(0,1)}}if(!l)return t;if("#"===l){var A=getByKeyPath(n,t.slice(1));return void 0===A&&f.push([n,t.slice(1),i,c]),A}return[].concat(l).reduce((function reducer(e,t){if(hasConstructorOf(e,r))return e.then((function(e){return reducer(e,t)}));if("string"!=typeof t)throw new TypeError("Bad type JSON");return p(t,e)}),t)}}("",e,null),v.length&&(b=r.resolve(b).then((function(e){return r.all([e].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(b)?c&&i.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(b,r)?b.p.then(checkUndefined):b:!c&&i.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():c?checkUndefined(b):Promise.resolve(checkUndefined(b))}},{key:"reviveSync",value:function reviveSync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,r){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"register",value:function register(e,r){var t=this,n=null!=r?r:{},i=function R(e){a(e)?e.forEach((function(e){return R(e)})):o(e).forEach((function(r){var o;if("#"===r)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(r))throw new TypeError("Plain JSON object types are reserved as type names");var i=e[r],c=i&&"function"!=typeof i&&!Array.isArray(i)&&i.testPlainObjects?t.plainObjectReplacers:t.nonplainObjectReplacers,u=c.filter((function(e){return e.type===r}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete t.revivers[r],delete t.types[r]),"function"==typeof i){var f=i;i={test:function test(e){return e&&e.constructor===f},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(f.prototype),e)}}}else if(a(i)){var l=_slicedToArray(i,3);i={test:l[0],replace:l[1],revive:l[2]}}if(null!==(o=i)&&void 0!==o&&o.test){var y={type:r,test:i.test.bind(i)};i.replace&&(y.replace=i.replace.bind(i)),i.replaceAsync&&(y.replaceAsync=i.replaceAsync.bind(i));var p="number"==typeof n.fallback?n.fallback:n.fallback?0:Number.POSITIVE_INFINITY;if(i.testPlainObjects?t.plainObjectReplacers.splice(p,0,y):t.nonplainObjectReplacers.splice(p,0,y),i.revive||i.reviveAsync){var v={};i.revive&&(v.revive=i.revive.bind(i)),i.reviveAsync&&(v.reviveAsync=i.reviveAsync.bind(i)),t.revivers[r]=[v,{plain:i.testPlainObjects}]}t.types[r]=i}}))};return[].concat(e).forEach((function(e){return i(e)})),this}}])}();var u=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));u.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"],f={undef:{test:function test(e,r){return void 0===e&&(r.ownKeys||!("ownKeys"in r))},replace:function replace(e){return 0},revive:function revive(e){return new u}}},l={StringObject:{test:function test(e){return"String"===toStringTag(e)&&"object"===_typeof$1(e)},replace:String,revive:function revive(e){return new String(e)}},BooleanObject:{test:function test(e){return"Boolean"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Boolean,revive:function revive(e){return new Boolean(e)}},NumberObject:{test:function test(e){return"Number"===toStringTag(e)&&"object"===_typeof$1(e)},replace:Number,revive:function revive(e){return new Number(e)}}},y=[{nan:{test:function test(e){return Number.isNaN(e)},replace:function replace(e){return"NaN"},revive:function revive(e){return Number.NaN}}},{infinity:{test:function test(e){return e===Number.POSITIVE_INFINITY},replace:function replace(e){return"Infinity"},revive:function revive(e){return Number.POSITIVE_INFINITY}}},{negativeInfinity:{test:function test(e){return e===Number.NEGATIVE_INFINITY},replace:function replace(e){return"-Infinity"},revive:function revive(e){return Number.NEGATIVE_INFINITY}}},{negativeZero:{test:function test(e){return Object.is(e,-0)},replace:function replace(e){return 0},revive:function revive(e){return-0}}}],p={date:{test:function test(e){return"Date"===toStringTag(e)},replace:function replace(e){var r=e.getTime();return Number.isNaN(r)?"NaN":r},revive:function revive(e){return"NaN"===e?new Date(Number.NaN):new Date(e)}}},v={error:{test:function test(e){return"Error"===toStringTag(e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber}},revive:function revive(e){var r=new Error(e.message);return r.name=e.name,r.cause=e.cause,r.stack=e.stack,r.fileName=e.fileName,r.lineNumber=e.lineNumber,r.columnNumber=e.columnNumber,r}}},b={};function create$1(e){b[e.name.toLowerCase()]={test:function test(r){return hasConstructorOf(r,e)},replace:function replace(e){return{name:e.name,message:e.message,cause:e.cause,stack:e.stack,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,errors:e.errors}},revive:function revive(r){var t="undefined"!=typeof AggregateError&&e===AggregateError,n=t?new e(r.errors,r.message):new e(r.message);return n.name=r.name,n.cause=r.cause,n.stack=r.stack,n.fileName=r.fileName,n.lineNumber=r.lineNumber,n.columnNumber=r.columnNumber,t&&(n.errors=r.errors),n}}}[TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError].forEach((function(e){return create$1(e)})),"undefined"!=typeof AggregateError&&create$1(AggregateError),"function"==typeof InternalError&&create$1(InternalError);for(var d={regexp:{test:function test(e){return"RegExp"===toStringTag(e)},replace:function replace(e){return{source:e.source,flags:(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":"")}},revive:function revive(e){var r=e.source,t=e.flags;return new RegExp(r,t)}}},h={map:{test:function test(e){return"Map"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.entries())},revive:function revive(e){return new Map(e)}}},m={set:{test:function test(e){return"Set"===toStringTag(e)},replace:function replace(e){return _toConsumableArray$1(e.values())},revive:function revive(e){return new Set(e)}}},_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",g=new Uint8Array(256),O=0;O<64;O++)g[_.codePointAt(O)]=O;var S=function encode(e,r,t){null==t&&(t=e.byteLength);for(var n=new Uint8Array(e,r||0,t),o=n.length,i="",a=0;a<o;a+=3)i+=_[n[a]>>2],i+=_[(3&n[a])<<4|n[a+1]>>4],i+=_[(15&n[a+1])<<2|n[a+2]>>6],i+=_[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},A=function decode(e){var r=e.length;if(r%4)throw new Error("Bad base64 length: not divisible by four");var t,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),f=0;f<r;f+=4)t=g[e.codePointAt(f)],n=g[e.codePointAt(f+1)],o=g[e.codePointAt(f+2)],i=g[e.codePointAt(f+3)],s[c++]=t<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u},j={arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,r){r.buffers||(r.buffers=[]);var t=r.buffers.indexOf(e);return t>-1?{index:t}:(r.buffers.push(e),S(e))},revive:function revive(e,r){if(r.buffers||(r.buffers=[]),"object"===_typeof$1(e))return r.buffers[e.index];var t=A(e);return r.buffers.push(t),t}}},w={};"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(_toConsumableArray$1("function"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return function create(e){var r=e.name;w[r.toLowerCase()]={test:function test(e){return toStringTag(e)===r},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.length;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,length:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,length:o})},revive:function revive(r,t){t.buffers||(t.buffers=[]);var n,o=r.byteOffset,i=r.length,a=r.encoded,c=r.index;return"index"in r?n=t.buffers[c]:(n=A(a),t.buffers.push(n)),new e(n,o,i)}}}(e)}));var T={dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,r){var t=e.buffer,n=e.byteOffset,o=e.byteLength;r.buffers||(r.buffers=[]);var i=r.buffers.indexOf(t);return i>-1?{index:i,byteOffset:n,byteLength:o}:(r.buffers.push(t),{encoded:S(t),byteOffset:n,byteLength:o})},revive:function revive(e,r){r.buffers||(r.buffers=[]);var t,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?t=r.buffers[a]:(t=A(i),r.buffers.push(t)),new DataView(t,n,o)}}},N={test:function test(e){return hasConstructorOf(e,Intl.Collator)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.Collator(e.locale,e)}},I={test:function test(e){return hasConstructorOf(e,Intl.DateTimeFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.DateTimeFormat(e.locale,e)}},P={test:function test(e){return hasConstructorOf(e,Intl.NumberFormat)},replace:function replace(e){return e.resolvedOptions()},revive:function revive(e){return new Intl.NumberFormat(e.locale,e)}},E={bigint:{test:function test(e){return"bigint"==typeof e},replace:String,revive:function revive(e){return BigInt(e)}}},k={bigintObject:{test:function test(e){return"object"===_typeof$1(e)&&hasConstructorOf(e,BigInt)},replace:String,revive:function revive(e){return new Object(BigInt(e))}}};return[[f,e,l,y,p,v,b,d].concat("function"==typeof Map?h:[],"function"==typeof Set?m:[],"function"==typeof ArrayBuffer?j:[],"function"==typeof Uint8Array?w:[],"function"==typeof DataView?T:[],"undefined"!=typeof Intl?{IntlCollator:N,IntlDateTimeFormat:I,IntlNumberFormat:P}:[],"undefined"!=typeof BigInt?[E,k]:[])]}));
//# sourceMappingURL=universal.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).arraybuffer=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=s.sync,l={},p=[],f=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],y=c[3],l=c[4],p=c[5],f=c[6],v=O(u,n,s,y,i,!0,f),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[p]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},O=function _encapsulate(t,r,a,c,y,v,h){var b,_={},O=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(O))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:g(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return l[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,P,T=isPlainObject(r),A=i(r),k=(T||A)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:g(t,r,c,y,T||A,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),s.iterateNone)return null!==(P=w)&&void 0!==P?P:b;if(!w)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var N in r)C(N);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var I=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},B=0;B<I;B++)E(B);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},g=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var p=c[s];if(p.test(t,r)){var f=p.type;if(u.revivers[f]){var v=l[e];l[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(y||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),O(e,t,h&&"readonly",r,n,i,f);a&&a({replacing:!0});var d=void 0;if(y||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");d=p.replace(t,r)}else d=p.replaceAsync(t,r);return O(e,d,h&&"readonly",r,n,i,f)}}return t},j=O("",t,h,null!=r?r:{},v);if(v.length)return y&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var y=[],l={},p=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!p||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],O=b[2],g=b[3],j=getByKeyPath(_,m);if(void 0===j)break;O[g]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var S=getByKeyPath(o,r.slice(1));return void 0===S&&y.push([o,r.slice(1),a,u]),S}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<s.length;l++)y[s.codePointAt(l)]=l;return{arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=s[n[a]>>2],i+=s[(3&n[a])<<4|n[a+1]>>4],i+=s[(15&n[a+1])<<2|n[a+2]>>6],i+=s[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i}(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u}(e);return t.buffers.push(r),r}}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).arraybuffer=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=s.sync,l={},p=[],f=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],y=c[3],l=c[4],p=c[5],f=c[6],v=O(u,n,s,y,i,!0,f),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[p]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},O=function _encapsulate(t,r,a,c,y,v,h){var b,_={},O=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(O))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:g(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return l[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,P,T=isPlainObject(r),A=i(r),k=(T||A)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:g(t,r,c,y,T||A,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),s.iterateNone)return null!==(P=w)&&void 0!==P?P:b;if(!w)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var N in r)C(N);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var I=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},B=0;B<I;B++)E(B);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},g=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var p=c[s];if(p.test(t,r)){var f=p.type;if(u.revivers[f]){var v=l[e];l[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(y||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),O(e,t,h&&"readonly",r,n,i,f);a&&a({replacing:!0});var d=void 0;if(y||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");d=p.replace(t,r)}else d=p.replaceAsync(t,r);return O(e,d,h&&"readonly",r,n,i,f)}}return t},j=O("",t,h,null!=r?r:{},v);if(v.length)return y&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var y=[],l={},p=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!p||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],O=b[2],g=b[3],j=getByKeyPath(_,m);if(void 0===j)break;O[g]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var S=getByKeyPath(o,r.slice(1));return void 0===S&&y.push([o,r.slice(1),a,u]),S}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<64;l++)y[s.codePointAt(l)]=l;return{arraybuffer:{test:function test(e){return"ArrayBuffer"===toStringTag(e)},replace:function replace(e,t){t.buffers||(t.buffers=[]);var r=t.buffers.indexOf(e);return r>-1?{index:r}:(t.buffers.push(e),function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=s[n[a]>>2],i+=s[(3&n[a])<<4|n[a+1]>>4],i+=s[(15&n[a+1])<<2|n[a+2]>>6],i+=s[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i}(e))},revive:function revive(e,t){if(t.buffers||(t.buffers=[]),"object"===_typeof$1(e))return t.buffers[e.index];var r=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u}(e);return t.buffers.push(r),r}}}}));
//# sourceMappingURL=arraybuffer.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dataview=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=u.sync,l={},p=[],f=[],v=[],h=!("cyclic"in u)||u.cyclic,d=u.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),s=c[0],u=c[2],y=c[3],l=c[4],p=c[5],f=c[6],v=O(s,n,u,y,i,!0,f),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&h)return _await(v.p,(function(e){l[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(s?l[p]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},O=function _encapsulate(t,r,a,c,y,v,h){var b,_={},O=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(O))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:g(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return l[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,P,T=isPlainObject(r),A=i(r),k=(T||A)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:g(t,r,c,y,T||A,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),u.iterateNone)return null!==(P=w)&&void 0!==P?P:b;if(!w)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var N in r)C(N);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var I=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},B=0;B<I;B++)E(B);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},g=function replace(e,t,r,n,o,i,a){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var p=c[u];if(p.test(t,r)){var f=p.type;if(s.revivers[f]){var v=l[e];l[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(y||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),O(e,t,h&&"readonly",r,n,i,f);a&&a({replacing:!0});var d=void 0;if(y||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");d=p.replace(t,r)}else d=p.replaceAsync(t,r);return O(e,d,h&&"readonly",r,n,i,f)}}return t},j=O("",t,h,null!=r?r:{},v);if(v.length)return y&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),s=a.sync;function finishRevival(e){if(s)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var y=[],l={},p=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(s&&!("revive"in n))return t;if(!s&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,s){if(!p||"$types"!==t){var l=u[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],O=b[2],g=b[3],j=getByKeyPath(_,m);if(void 0===j)break;O[g]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var S=getByKeyPath(o,r.slice(1));return void 0===S&&y.push([o,r.slice(1),a,s]),S}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?s&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!s&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():s?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var s=["null","boolean","number","string","array","object"],u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<u.length;l++)y[u.codePointAt(l)]=l;var p=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=u[n[a]>>2],i+=u[(3&n[a])<<4|n[a+1]>>4],i+=u[(15&n[a+1])<<2|n[a+2]>>6],i+=u[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i};return{dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:p(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var s=new ArrayBuffer(a),u=new Uint8Array(s),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|o>>2,u[c++]=(3&o)<<6|63&i;return s}(i),t.buffers.push(r)),new DataView(r,n,o)}}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).dataview=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=u.sync,l={},p=[],f=[],v=[],h=!("cyclic"in u)||u.cyclic,d=u.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),s=c[0],u=c[2],y=c[3],l=c[4],p=c[5],f=c[6],v=O(s,n,u,y,i,!0,f),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&h)return _await(v.p,(function(e){l[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(s?l[p]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},O=function _encapsulate(t,r,a,c,y,v,h){var b,_={},O=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(O))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:g(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return l[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,P,T=isPlainObject(r),A=i(r),k=(T||A)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:g(t,r,c,y,T||A,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),u.iterateNone)return null!==(P=w)&&void 0!==P?P:b;if(!w)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var N in r)C(N);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var I=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},B=0;B<I;B++)E(B);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},g=function replace(e,t,r,n,o,i,a){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var p=c[u];if(p.test(t,r)){var f=p.type;if(s.revivers[f]){var v=l[e];l[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(y||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),O(e,t,h&&"readonly",r,n,i,f);a&&a({replacing:!0});var d=void 0;if(y||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");d=p.replace(t,r)}else d=p.replaceAsync(t,r);return O(e,d,h&&"readonly",r,n,i,f)}}return t},j=O("",t,h,null!=r?r:{},v);if(v.length)return y&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),s=a.sync;function finishRevival(e){if(s)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var y=[],l={},p=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(s&&!("revive"in n))return t;if(!s&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,s){if(!p||"$types"!==t){var l=u[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],O=b[2],g=b[3],j=getByKeyPath(_,m);if(void 0===j)break;O[g]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var S=getByKeyPath(o,r.slice(1));return void 0===S&&y.push([o,r.slice(1),a,s]),S}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?s&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!s&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():s?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var s=["null","boolean","number","string","array","object"],u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<64;l++)y[u.codePointAt(l)]=l;var p=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=u[n[a]>>2],i+=u[(3&n[a])<<4|n[a+1]>>4],i+=u[(15&n[a+1])<<2|n[a+2]>>6],i+=u[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i};return{dataview:{test:function test(e){return"DataView"===toStringTag(e)},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.byteLength;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,byteLength:o}:(t.buffers.push(r),{encoded:p(r),byteOffset:n,byteLength:o})},revive:function revive(e,t){t.buffers||(t.buffers=[]);var r,n=e.byteOffset,o=e.byteLength,i=e.encoded,a=e.index;return"index"in e?r=t.buffers[a]:(r=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var s=new ArrayBuffer(a),u=new Uint8Array(s),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|o>>2,u[c++]=(3&o)<<6|63&i;return s}(i),t.buffers.push(r)),new DataView(r,n,o)}}}}));
//# sourceMappingURL=dataview.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filelist=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,"symbol"==typeof(i=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"))?i:String(i)),n)}var o,i}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),l=u.sync,y={},p=[],f=[],v=[],h=!("cyclic"in u)||u.cyclic,d=u.encapsulateObserver,b=function finish(e){var t=Object.values(y);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=y:e={$:e,$types:{$:y}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),s=c[0],u=c[2],l=c[3],y=c[4],p=c[5],f=c[6],v=g(s,n,u,l,i,!0,f),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&h)return _await(v.p,(function(e){y[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(s?y[p]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},g=function _encapsulate(t,r,a,c,l,v,h){var b,_={},g=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:l,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:O(t,r,c,l,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return y[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,T,P=isPlainObject(r),A=i(r),C=(P||A)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,l,P||A,null,j);if(C!==r?(b=C,_={replaced:C}):""===t&&hasConstructorOf(r,e)?(l.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!P&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),u.iterateNone)return null!==(T=w)&&void 0!==T?T:b;if(!w)return b;if(c.iterateIn){var k=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,l,v);hasConstructorOf(i,e)?l.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var E in r)k(E);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,l,v);hasConstructorOf(t,e)?l.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var N=r.length,I=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,l,v);hasConstructorOf(t,e)?l.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},$=0;$<N;$++)I($);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},O=function replace(e,t,r,n,o,i,a){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var p=c[u];if(p.test(t,r)){var f=p.type;if(s.revivers[f]){var v=y[e];y[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(l||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),g(e,t,h&&"readonly",r,n,i,f);a&&a({replacing:!0});var d=void 0;if(l||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");d=p.replace(t,r)}else d=p.replaceAsync(t,r);return g(e,d,h&&"readonly",r,n,i,f)}}return t},j=g("",t,h,null!=r?r:{},v);if(v.length)return l&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!l&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&l?[b(j)]:l?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),s=a.sync;function finishRevival(e){if(s)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var l=[],y={},p=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(s&&!("revive"in n))return t;if(!s&&n.reviveAsync)return n.reviveAsync(t,y);if(n.revive)return n.revive(t,y);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,s){if(!p||"$types"!==t){var y=u[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;l.length;){var b=_slicedToArray(l[0],4),_=b[0],m=b[1],g=b[2],O=b[3],j=getByKeyPath(_,m);if(void 0===j)break;g[O]=j,l.splice(0,1)}}if(!y)return r;if("#"===y){var S=getByKeyPath(o,r.slice(1));return void 0===S&&l.push([o,r.slice(1),a,s]),S}return[].concat(y).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?s&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!s&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():s?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var l=a;a={test:function test(e){return e&&e.constructor===l},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(l.prototype),e)}}}else if(i(a)){var y=_slicedToArray(a,3);a={test:y[0],replace:y[1],revive:y[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"];function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var u={file:{file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}}.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){_classCallCheck$1(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}};return u}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).filelist=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,"symbol"==typeof(i=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"))?i:String(i)),n)}var o,i}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var s=this,u=_objectSpread2(_objectSpread2({sync:!0},this.options),c),l=u.sync,y={},p=[],f=[],v=[],d=!("cyclic"in u)||u.cyclic,h=u.encapsulateObserver,b=function finish(e){var t=Object.values(y);if(u.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(u.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=y:e={$:e,$types:{$:y}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!u.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),s=c[0],u=c[2],l=c[3],y=c[4],p=c[5],f=c[6],v=g(s,n,u,l,i,!0,f),d=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(s&&d)return _await(v.p,(function(e){y[p]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(s?y[p]=v:t=d?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},g=function _encapsulate(t,r,a,c,l,v,d){var b,_={},g=_typeof(r),j=h?function(n){var o,i=null!==(o=null!=d?d:c.type)&&void 0!==o?o:getJSONType(r);h(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:l,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:O(t,r,c,l,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var S=p.indexOf(r);if(!(S<0))return y[t]="#",j&&j({cyclicKeypath:f[S]}),"#"+f[S];!0===a&&(p.push(r),f.push(t))}var w,T,P=isPlainObject(r),A=i(r),k=(P||A)&&(!s.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,l,P||A,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(l.push([t,r,a,c,void 0,void 0,c.type]),b=r):A&&"object"!==c.iterateIn||"array"===c.iterateIn?(w=new Array(r.length),_={clone:w}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!P&&"object"!==c.iterateIn?b=r:(w={},c.addLength&&(w.length=r.length),_={clone:w}),j&&j(),u.iterateNone)return null!==(T=w)&&void 0!==T?T:b;if(!w)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,l,v);hasConstructorOf(i,e)?l.push([o,i,Boolean(a),c,w,n,c.type]):void 0!==i&&(w[n]=i)}))};for(var E in r)C(E);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,l,v);hasConstructorOf(t,e)?l.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var N=r.length,I=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,l,v);hasConstructorOf(t,e)?l.push([o,t,Boolean(a),c,w,n,c.type]):void 0!==t&&(w[n]=t)}))}},$=0;$<N;$++)I($);j&&j({endIterateUnsetNumeric:!0,end:!0})}return w},O=function replace(e,t,r,n,o,i,a){for(var c=o?s.plainObjectReplacers:s.nonplainObjectReplacers,u=c.length;u--;){var p=c[u];if(p.test(t,r)){var f=p.type;if(s.revivers[f]){var v=y[e];y[e]=v?[f].concat(v):f}if(Object.assign(r,{type:f,replaced:!0}),(l||!p.replaceAsync)&&!p.replace)return a&&a({typeDetected:!0}),g(e,t,d&&"readonly",r,n,i,f);a&&a({replacing:!0});var h=void 0;if(l||!p.replaceAsync){if(void 0===p.replace)throw new TypeError("Missing replacer");h=p.replace(t,r)}else h=p.replaceAsync(t,r);return g(e,h,d&&"readonly",r,n,i,f)}}return t},j=g("",t,d,null!=r?r:{},v);if(v.length)return l&&u.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!l&&u.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return u.stringification&&l?[b(j)]:l?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),s=a.sync;function finishRevival(e){if(s)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var u=t.$types;if(!0===u)return finishRevival(t.$);if(!u||"object"!==_typeof(u)||Array.isArray(u))return finishRevival(t);var l=[],y={},p=!0;u.$&&isPlainObject(u.$)&&(t=t.$,u=u.$,p=!1);var f=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(s&&!("revive"in n))return t;if(!s&&n.reviveAsync)return n.reviveAsync(t,y);if(n.revive)return n.revive(t,y);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var d,h=function revivePlainObjects(){var r=[];if(!u)throw new Error("Found bad `types`");if(Object.entries(u).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete u[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=f(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(h,e)?d=h.then((function(){return t})):(d=function _revive(t,r,o,a,s){if(!p||"$types"!==t){var y=u[t],d=i(r);if(d||isPlainObject(r)){var h=d?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:h,h,n),a=function set(e){return hasConstructorOf(e,c)?h[n]=void 0:void 0!==e&&(h[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=h;l.length;){var b=_slicedToArray(l[0],4),_=b[0],m=b[1],g=b[2],O=b[3],j=getByKeyPath(_,m);if(void 0===j)break;g[O]=j,l.splice(0,1)}}if(!y)return r;if("#"===y){var S=getByKeyPath(o,r.slice(1));return void 0===S&&l.push([o,r.slice(1),a,s]),S}return[].concat(y).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return f(r,t)}),r)}}("",t,null),v.length&&(d=e.resolve(d).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(d)?s&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(d,e)?d.p.then(checkUndefined):d:!s&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():s?checkUndefined(d):Promise.resolve(checkUndefined(d))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(s.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,u=c.filter((function(e){return e.type===t}));if(u.length&&(c.splice(c.indexOf(u[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var l=a;a={test:function test(e){return e&&e.constructor===l},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(l.prototype),e)}}}else if(i(a)){var y=_slicedToArray(a,3);a={test:y[0],replace:y[1],revive:y[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var p={type:t,test:a.test.bind(a)};a.replace&&(p.replace=a.replace.bind(a)),a.replaceAsync&&(p.replaceAsync=a.replaceAsync.bind(a));var f="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(f,0,p):r.nonplainObjectReplacers.splice(f,0,p),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";var s=["null","boolean","number","string","array","object"];function string2arraybuffer(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t.buffer}var u={file:{file:{test:function test(e){return"File"===toStringTag(e)},replace:function replace(e){var t=new XMLHttpRequest;if(t.overrideMimeType("text/plain; charset=x-user-defined"),t.open("GET",URL.createObjectURL(e),!1),t.send(),200!==t.status&&0!==t.status)throw new Error("Bad File access: "+t.status);return{type:e.type,stringContents:t.responseText,name:e.name,lastModified:e.lastModified}},revive:function revive(e){var t=e.name,r=e.type,n=e.stringContents,o=e.lastModified;return new File([string2arraybuffer(n)],t,{type:r,lastModified:o})},replaceAsync:function replaceAsync(t){return new e((function(e,r){var n=new FileReader;n.addEventListener("load",(function(){e({type:t.type,stringContents:n.result,name:t.name,lastModified:t.lastModified})})),n.addEventListener("error",(function(){r(n.error)})),n.readAsBinaryString(t)}))}}}.file,filelist:{test:function test(e){return"FileList"===toStringTag(e)},replace:function replace(e){for(var t=[],r=0;r<e.length;r++)t[r]=e.item(r);return t},revive:function revive(e){var t=function(e){function FileList(){!function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileList),this._files=arguments[0],this.length=this._files.length}return function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(FileList,[{key:"item",value:function item(e){return this._files[e]}},{key:Symbol.toStringTag,get:function get(){return"FileList"}}]),FileList}();return new t(e)}}};return u}));
//# sourceMappingURL=filelist.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).typedArrays=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=s.sync,l={},f=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],y=c[3],l=c[4],f=c[5],p=c[6],v=g(u,n,s,y,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[f]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[f]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},g=function _encapsulate(t,r,a,c,y,v,h){var b,_={},g=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:O(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=f.indexOf(r);if(!(A<0))return l[t]="#",j&&j({cyclicKeypath:p[A]}),"#"+p[A];!0===a&&(f.push(r),p.push(t))}var S,w,T=isPlainObject(r),P=i(r),k=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,y,T||P,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),_={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),_={clone:S}),j&&j(),s.iterateNone)return null!==(w=S)&&void 0!==w?w:b;if(!S)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var I in r)C(I);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var N=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},$=0;$<N;$++)E($);j&&j({endIterateUnsetNumeric:!0,end:!0})}return S},O=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var f=c[s];if(f.test(t,r)){var p=f.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(y||!f.replaceAsync)&&!f.replace)return a&&a({typeDetected:!0}),g(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(y||!f.replaceAsync){if(void 0===f.replace)throw new TypeError("Missing replacer");d=f.replace(t,r)}else d=f.replaceAsync(t,r);return g(e,d,h&&"readonly",r,n,i,p)}}return t},j=g("",t,h,null!=r?r:{},v);if(v.length)return y&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var y=[],l={},f=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,f=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!f||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],g=b[2],O=b[3],j=getByKeyPath(_,m);if(void 0===j)break;g[O]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var A=getByKeyPath(o,r.slice(1));return void 0===A&&y.push([o,r.slice(1),a,u]),A}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var f={type:t,test:a.test.bind(a)};a.replace&&(f.replace=a.replace.bind(a)),a.replaceAsync&&(f.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,f):r.nonplainObjectReplacers.splice(p,0,f),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<s.length;l++)y[s.codePointAt(l)]=l;var f=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=s[n[a]>>2],i+=s[(3&n[a])<<4|n[a+1]>>4],i+=s[(15&n[a+1])<<2|n[a+2]>>6],i+=s[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},p={};function create(e){var t=e.name;p[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:f(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u}(a),r.buffers.push(n)),new e(n,o,i)}}}return"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(function _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}(e)||function _nonIterableSpread(){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"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return create(e)})),p}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).typedArrays=t()}(this,(function(){"use strict";function _typeof$1(e){return _typeof$1="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},_typeof$1(e)}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==_typeof$1(Symbol.iterator)?function(e){return _typeof$1(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":_typeof$1(e)},_typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=_typeof$1(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof$1(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_typeof$1(t)?t:String(t)}var e=_createClass((function TypesonPromise(e){_classCallCheck(this,TypesonPromise),this.p=new Promise(e)}));e.__typeson__type__="TypesonPromise","undefined"!=typeof Symbol&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function get(){return"TypesonPromise"}}),e.prototype.then=function(t,r){var n=this;return new e((function(e,o){n.p.then((function(r){e(t?t(r):r)})).catch((function(e){return r?r(e):Promise.reject(e)})).then(e,o)}))},e.prototype.catch=function(e){return this.then((function(){}),e)},e.resolve=function(t){return new e((function(e){e(t)}))},e.reject=function(t){return new e((function(e,r){r(t)}))},e.all=function(t){return new e((function(e,r){Promise.all(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.race=function(t){return new e((function(e,r){Promise.race(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))},e.allSettled=function(t){return new e((function(e,r){Promise.allSettled(t.map((function(e){return null!=e&&e.constructor&&"__typeson__type__"in e.constructor&&"TypesonPromise"===e.constructor.__typeson__type__?e.p:e}))).then(e,r)}))};var t=Object.hasOwn,r=Object.getPrototypeOf;function isThenable(e,t){return isObject(e)&&"function"==typeof e.then&&(!t||"function"==typeof e.catch)}function toStringTag(e){return Object.prototype.toString.call(e).slice(8,-1)}function hasConstructorOf(e,n){if(!e||"object"!==_typeof(e))return!1;var o=r(e);if(!o)return null===n;var i=t(o,"constructor")&&o.constructor;return"function"!=typeof i?null===n:n===i||null!==n&&Function.prototype.toString.call(i)===Function.prototype.toString.call(n)||"function"==typeof n&&"string"==typeof i.__typeson__type__&&i.__typeson__type__===n.__typeson__type__}function isPlainObject(e){return!(!e||"Object"!==toStringTag(e))&&(!r(e)||hasConstructorOf(e,Object))}function isObject(e){return null!==e&&"object"===_typeof(e)}function escapeKeyPathComponent(e){return e.replace(/''/g,"''''").replace(/^$/,"''").replace(/~/g,"~0").replace(/\./g,"~1")}function unescapeKeyPathComponent(e){return e.replace(/~1/g,".").replace(/~0/g,"~").replace(/^''$/,"").replace(/''''/g,"''")}function getByKeyPath(e,t){if(""===t)return e;if(null===e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var r=t.indexOf(".");if(r>-1){var n=e[unescapeKeyPathComponent(t.slice(0,r))];return void 0===n?void 0:getByKeyPath(n,t.slice(r+1))}return e[unescapeKeyPathComponent(t)]}function setAtKeyPath(e,t,r){if(""===t)return r;if(!e||"object"!==_typeof(e))throw new TypeError("Unexpected non-object type");var n=t.indexOf(".");return n>-1?setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0,n))],t.slice(n+1),r):(e[unescapeKeyPathComponent(t)]=r,e)}function getJSONType(e){return null===e?"null":Array.isArray(e)?"array":_typeof(e)}function _await(e,t,r){return r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)}var n=Object.keys,o=Object.hasOwn,i=Array.isArray,a=["type","replaced","iterateIn","iterateUnsetNumeric","addLength"];function _async(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{return Promise.resolve(e.apply(this,t))}catch(e){return Promise.reject(e)}}}function nestedPathsFirst(e,t){var r,n;if(""===e.keypath)return-1;var o=null!==(r=e.keypath.match(/\./g))&&void 0!==r?r:0,i=null!==(n=t.keypath.match(/\./g))&&void 0!==n?n:0;return o&&(o=o.length),i&&(i=i.length),o>i?-1:o<i?1:e.keypath<t.keypath?-1:e.keypath>t.keypath?1:0}!function(){function Typeson(e){_classCallCheck(this,Typeson),this.options=e,this.plainObjectReplacers=[],this.nonplainObjectReplacers=[],this.revivers={},this.types={}}_createClass(Typeson,[{key:"stringify",value:function stringify(e,t,r,n){n=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),n),{},{stringification:!0});var o=this.encapsulate(e,null,n);return i(o)?JSON.stringify(o[0],t,r):o.then((function(e){return JSON.stringify(e,t,r)}))}},{key:"stringifySync",value:function stringifySync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!0}))}},{key:"stringifyAsync",value:function stringifyAsync(e,t,r,n){return this.stringify(e,t,r,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},n),{},{sync:!1}))}},{key:"parse",value:function parse(e,t,r){return r=_objectSpread2(_objectSpread2(_objectSpread2({},this.options),r),{},{parse:!0}),this.revive(JSON.parse(e,t),r)}},{key:"parseSync",value:function parseSync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"parseAsync",value:function parseAsync(e,t,r){return this.parse(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"specialTypeNames",value:function specialTypeNames(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.returnTypeNames=!0,this.encapsulate(e,t,r)}},{key:"rootTypeName",value:function rootTypeName(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.iterateNone=!0,this.encapsulate(e,t,r)}},{key:"encapsulate",value:function encapsulate(t,r,c){var u=this,s=_objectSpread2(_objectSpread2({sync:!0},this.options),c),y=s.sync,l={},f=[],p=[],v=[],h=!("cyclic"in s)||s.cyclic,d=s.encapsulateObserver,b=function finish(e){var t=Object.values(l);if(s.iterateNone)return t.length?t[0]:getJSONType(e);if(t.length){if(s.returnTypeNames)return function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(new Set(t));e&&isPlainObject(e)&&!o(e,"$types")?e.$types=l:e={$:e,$types:{$:l}}}else isObject(e)&&o(e,"$types")&&(e={$:e,$types:!0});return!s.returnTypeNames&&e},_=_async((function(t,r){return _await(Promise.all(r.map((function(e){return e[1].p}))),(function(n){return _await(Promise.all(n.map(_async((function(n){var o=!1,i=[],a=_slicedToArray(r.splice(0,1),1),c=_slicedToArray(a[0],7),u=c[0],s=c[2],y=c[3],l=c[4],f=c[5],p=c[6],v=g(u,n,s,y,i,!0,p),h=hasConstructorOf(v,e);return function _invoke(e,t){var r=e();return r&&r.then?r.then(t):t(r)}((function(){if(u&&h)return _await(v.p,(function(e){l[f]=e;var r=_(t,i);return o=!0,r}))}),(function(e){return o?e:(u?l[f]=v:t=h?v.p:v,_(t,i))}))})))),(function(){return t}))}))})),m=function _adaptBuiltinStateObjectProperties(e,t,r){Object.assign(e,t);var n=a.map((function(t){var r=e[t];return delete e[t],r}));r(),a.forEach((function(t,r){e[t]=n[r]}))},g=function _encapsulate(t,r,a,c,y,v,h){var b,_={},g=_typeof(r),j=d?function(n){var o,i=null!==(o=null!=h?h:c.type)&&void 0!==o?o:getJSONType(r);d(Object.assign(null!=n?n:_,{keypath:t,value:r,cyclic:a,stateObj:c,promisesData:y,resolvingTypesonPromise:v,awaitingTypesonPromise:hasConstructorOf(r,e)},{type:i}))}:null;if(["string","boolean","number","undefined"].includes(g))return void 0===r||Number.isNaN(r)||r===Number.NEGATIVE_INFINITY||r===Number.POSITIVE_INFINITY||0===r?(b=c.replaced?r:O(t,r,c,y,!1,v,j))!==r&&(_={replaced:b}):b=r,j&&j(),b;if(null===r)return j&&j(),r;if(a&&!c.iterateIn&&!c.iterateUnsetNumeric&&r&&"object"===_typeof(r)){var A=f.indexOf(r);if(!(A<0))return l[t]="#",j&&j({cyclicKeypath:p[A]}),"#"+p[A];!0===a&&(f.push(r),p.push(t))}var S,w,T=isPlainObject(r),P=i(r),k=(T||P)&&(!u.plainObjectReplacers.length||c.replaced)||c.iterateIn?r:O(t,r,c,y,T||P,null,j);if(k!==r?(b=k,_={replaced:k}):""===t&&hasConstructorOf(r,e)?(y.push([t,r,a,c,void 0,void 0,c.type]),b=r):P&&"object"!==c.iterateIn||"array"===c.iterateIn?(S=new Array(r.length),_={clone:S}):(["function","symbol"].includes(_typeof(r))||"toJSON"in r||hasConstructorOf(r,e)||hasConstructorOf(r,Promise)||hasConstructorOf(r,ArrayBuffer))&&!T&&"object"!==c.iterateIn?b=r:(S={},c.addLength&&(S.length=r.length),_={clone:S}),j&&j(),s.iterateNone)return null!==(w=S)&&void 0!==w?w:b;if(!S)return b;if(c.iterateIn){var C=function _loop(n){var i={ownKeys:o(r,n)};m(c,i,(function(){var o=t+(t?".":"")+escapeKeyPathComponent(n),i=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(i,e)?y.push([o,i,Boolean(a),c,S,n,c.type]):void 0!==i&&(S[n]=i)}))};for(var I in r)C(I);j&&j({endIterateIn:!0,end:!0})}else n(r).forEach((function(n){var o=t+(t?".":"")+escapeKeyPathComponent(n);m(c,{ownKeys:!0},(function(){var t=_encapsulate(o,r[n],Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))})),j&&j({endIterateOwn:!0,end:!0});if(c.iterateUnsetNumeric){for(var N=r.length,E=function _loop2(n){if(!(n in r)){var o="".concat(t).concat(t?".":"").concat(n);m(c,{ownKeys:!1},(function(){var t=_encapsulate(o,void 0,Boolean(a),c,y,v);hasConstructorOf(t,e)?y.push([o,t,Boolean(a),c,S,n,c.type]):void 0!==t&&(S[n]=t)}))}},$=0;$<N;$++)E($);j&&j({endIterateUnsetNumeric:!0,end:!0})}return S},O=function replace(e,t,r,n,o,i,a){for(var c=o?u.plainObjectReplacers:u.nonplainObjectReplacers,s=c.length;s--;){var f=c[s];if(f.test(t,r)){var p=f.type;if(u.revivers[p]){var v=l[e];l[e]=v?[p].concat(v):p}if(Object.assign(r,{type:p,replaced:!0}),(y||!f.replaceAsync)&&!f.replace)return a&&a({typeDetected:!0}),g(e,t,h&&"readonly",r,n,i,p);a&&a({replacing:!0});var d=void 0;if(y||!f.replaceAsync){if(void 0===f.replace)throw new TypeError("Missing replacer");d=f.replace(t,r)}else d=f.replaceAsync(t,r);return g(e,d,h&&"readonly",r,n,i,p)}}return t},j=g("",t,h,null!=r?r:{},v);if(v.length)return y&&s.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():Promise.resolve(_(j,v)).then(b);if(!y&&s.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return s.stringification&&y?[b(j)]:y?b(j):Promise.resolve(b(j))}},{key:"encapsulateSync",value:function encapsulateSync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!0}))}},{key:"encapsulateAsync",value:function encapsulateAsync(e,t,r){return this.encapsulate(e,t,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},r),{},{sync:!1}))}},{key:"revive",value:function revive(t,r){var o=this,a=_objectSpread2(_objectSpread2({sync:!0},this.options),r),u=a.sync;function finishRevival(e){if(u)return e;if(a.throwOnBadSyncType)throw new TypeError("Async method requested but sync result obtained");return Promise.resolve(e)}if(!t||"object"!==_typeof(t)||Array.isArray(t))return finishRevival(t);var s=t.$types;if(!0===s)return finishRevival(t.$);if(!s||"object"!==_typeof(s)||Array.isArray(s))return finishRevival(t);var y=[],l={},f=!0;s.$&&isPlainObject(s.$)&&(t=t.$,s=s.$,f=!1);var p=function executeReviver(e,t){var r,n=_slicedToArray(null!==(r=o.revivers[e])&&void 0!==r?r:[],1)[0];if(!n)throw new Error("Unregistered type: "+e);if(u&&!("revive"in n))return t;if(!u&&n.reviveAsync)return n.reviveAsync(t,l);if(n.revive)return n.revive(t,l);throw new Error("Missing reviver")},v=[];function checkUndefined(e){return hasConstructorOf(e,c)?void 0:e}var h,d=function revivePlainObjects(){var r=[];if(!s)throw new Error("Found bad `types`");if(Object.entries(s).forEach((function(e){var t=_slicedToArray(e,2),n=t[0],i=t[1];"#"!==i&&[].concat(i).forEach((function(e){var t;_slicedToArray(null!==(t=o.revivers[e])&&void 0!==t?t:[null,{}],2)[1].plain&&(r.push({keypath:n,type:e}),delete s[n])}))})),r.length)return r.sort(nestedPathsFirst).reduce((function reducer(r,n){var o=n.keypath,i=n.type;if(isThenable(r))return r.then((function(e){return reducer(e,{keypath:o,type:i})}));var a=getByKeyPath(t,o);if(hasConstructorOf(a=p(i,a),e))return a.then((function(e){var r=setAtKeyPath(t,o,e);r===e&&(t=r)}));var c=setAtKeyPath(t,o,a);c===a&&(t=c)}),void 0)}();return hasConstructorOf(d,e)?h=d.then((function(){return t})):(h=function _revive(t,r,o,a,u){if(!f||"$types"!==t){var l=s[t],h=i(r);if(h||isPlainObject(r)){var d=h?new Array(r.length):{};for(n(r).forEach((function(n){var i=_revive(t+(t?".":"")+escapeKeyPathComponent(n),r[n],null!=o?o:d,d,n),a=function set(e){return hasConstructorOf(e,c)?d[n]=void 0:void 0!==e&&(d[n]=e),e};hasConstructorOf(i,e)?v.push(i.then((function(e){return a(e)}))):a(i)})),r=d;y.length;){var b=_slicedToArray(y[0],4),_=b[0],m=b[1],g=b[2],O=b[3],j=getByKeyPath(_,m);if(void 0===j)break;g[O]=j,y.splice(0,1)}}if(!l)return r;if("#"===l){var A=getByKeyPath(o,r.slice(1));return void 0===A&&y.push([o,r.slice(1),a,u]),A}return[].concat(l).reduce((function reducer(t,r){if(hasConstructorOf(t,e))return t.then((function(e){return reducer(e,r)}));if("string"!=typeof r)throw new TypeError("Bad type JSON");return p(r,t)}),r)}}("",t,null),v.length&&(h=e.resolve(h).then((function(t){return e.all([t].concat(v))})).then((function(e){return _slicedToArray(e,1)[0]})))),isThenable(h)?u&&a.throwOnBadSyncType?function(){throw new TypeError("Sync method requested but async result obtained")}():hasConstructorOf(h,e)?h.p.then(checkUndefined):h:!u&&a.throwOnBadSyncType?function(){throw new TypeError("Async method requested but sync result obtained")}():u?checkUndefined(h):Promise.resolve(checkUndefined(h))}},{key:"reviveSync",value:function reviveSync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!0}))}},{key:"reviveAsync",value:function reviveAsync(e,t){return this.revive(e,_objectSpread2(_objectSpread2({throwOnBadSyncType:!0},t),{},{sync:!1}))}},{key:"register",value:function register(e,t){var r=this,o=null!=t?t:{},a=function R(e){i(e)?e.forEach((function(e){return R(e)})):n(e).forEach((function(t){var n;if("#"===t)throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");if(u.includes(t))throw new TypeError("Plain JSON object types are reserved as type names");var a=e[t],c=a&&"function"!=typeof a&&!Array.isArray(a)&&a.testPlainObjects?r.plainObjectReplacers:r.nonplainObjectReplacers,s=c.filter((function(e){return e.type===t}));if(s.length&&(c.splice(c.indexOf(s[0]),1),delete r.revivers[t],delete r.types[t]),"function"==typeof a){var y=a;a={test:function test(e){return e&&e.constructor===y},replace:function replace(e){return _objectSpread2({},e)},revive:function revive(e){return Object.assign(Object.create(y.prototype),e)}}}else if(i(a)){var l=_slicedToArray(a,3);a={test:l[0],replace:l[1],revive:l[2]}}if(null!==(n=a)&&void 0!==n&&n.test){var f={type:t,test:a.test.bind(a)};a.replace&&(f.replace=a.replace.bind(a)),a.replaceAsync&&(f.replaceAsync=a.replaceAsync.bind(a));var p="number"==typeof o.fallback?o.fallback:o.fallback?0:Number.POSITIVE_INFINITY;if(a.testPlainObjects?r.plainObjectReplacers.splice(p,0,f):r.nonplainObjectReplacers.splice(p,0,f),a.revive||a.reviveAsync){var v={};a.revive&&(v.revive=a.revive.bind(a)),a.reviveAsync&&(v.reviveAsync=a.reviveAsync.bind(a)),r.revivers[t]=[v,{plain:a.testPlainObjects}]}r.types[t]=a}}))};return[].concat(e).forEach((function(e){return a(e)})),this}}])}();var c=_createClass((function Undefined(){_classCallCheck(this,Undefined)}));c.__typeson__type__="TypesonUndefined";for(var u=["null","boolean","number","string","array","object"],s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=new Uint8Array(256),l=0;l<64;l++)y[s.codePointAt(l)]=l;var f=function encode(e,t,r){null==r&&(r=e.byteLength);for(var n=new Uint8Array(e,t||0,r),o=n.length,i="",a=0;a<o;a+=3)i+=s[n[a]>>2],i+=s[(3&n[a])<<4|n[a+1]>>4],i+=s[(15&n[a+1])<<2|n[a+2]>>6],i+=s[63&n[a+2]];return o%3==2?i=i.slice(0,-1)+"=":o%3==1&&(i=i.slice(0,-2)+"=="),i},p={};function create(e){var t=e.name;p[t.toLowerCase()]={test:function test(e){return toStringTag(e)===t},replace:function replace(e,t){var r=e.buffer,n=e.byteOffset,o=e.length;t.buffers||(t.buffers=[]);var i=t.buffers.indexOf(r);return i>-1?{index:i,byteOffset:n,length:o}:(t.buffers.push(r),{encoded:f(r),byteOffset:n,length:o})},revive:function revive(t,r){r.buffers||(r.buffers=[]);var n,o=t.byteOffset,i=t.length,a=t.encoded,c=t.index;return"index"in t?n=r.buffers[c]:(n=function decode(e){var t=e.length;if(t%4)throw new Error("Bad base64 length: not divisible by four");var r,n,o,i,a=.75*e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);for(var u=new ArrayBuffer(a),s=new Uint8Array(u),l=0;l<t;l+=4)r=y[e.codePointAt(l)],n=y[e.codePointAt(l+1)],o=y[e.codePointAt(l+2)],i=y[e.codePointAt(l+3)],s[c++]=r<<2|n>>4,s[c++]=(15&n)<<4|o>>2,s[c++]=(3&o)<<6|63&i;return u}(a),r.buffers.push(n)),new e(n,o,i)}}}return"function"==typeof Int8Array&&[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array].concat(function _toConsumableArray$1(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}(e)||function _nonIterableSpread(){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"==typeof BigInt64Array?[BigInt64Array,BigUint64Array]:[])).forEach((function(e){return create(e)})),p}));
//# sourceMappingURL=typed-arrays.umd.js.map
{
"name": "typeson-registry",
"version": "7.2.0",
"version": "7.2.1",
"description": "The type registry for typeson",

@@ -5,0 +5,0 @@ "author": "dfahlander",

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).createObjectURL={})}(this,(function(e){"use strict";function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function a(){if(this instanceof a){var e=[null];e.push.apply(e,arguments);var r=Function.bind.apply(t,e);return new r}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var t={},r={};function _AsyncGenerator(e){var t,r;function resume(t,r){try{var n=e[t](r),i=n.value,o=i instanceof _OverloadYield;Promise.resolve(o?i.v:i).then((function(r){if(o){var s="return"===t?"return":"next";if(!i.k||r.done)return resume(s,r);r=e[s](r).value}settle(n.done?"return":"normal",r)}),(function(e){resume("throw",e)}))}catch(e){settle("throw",e)}}function settle(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?resume(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise((function(i,o){var s={key:e,arg:n,resolve:i,reject:o,next:null};r?r=r.next=s:(t=r=s,resume(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}function _OverloadYield(e,t){this.v=e,this.k=t}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,i){var o=t&&t.prototype instanceof Generator?t:Generator,s=Object.create(o.prototype),l=new Context(i||[]);return n(s,"_invoke",{value:makeInvokeMethod(e,r,l)}),s}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var u={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var c={};define(c,o,(function(){return this}));var h=Object.getPrototypeOf,f=h&&h(h(values([])));f&&f!==t&&r.call(f,o)&&(c=f);var d=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,i,o,s){var l=tryCatch(e[n],e,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){invoke("next",e,o,s)}),(function(e){invoke("throw",e,o,s)})):t.resolve(c).then((function(e){u.value=e,o(u)}),(function(e){return invoke("throw",e,o,s)}))}s(l.arg)}var i;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return doneResult()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var l=maybeInvokeDelegate(s,r);if(l){if(l===u)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=tryCatch(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var i=tryCatch(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,u;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return i.next=i}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(d,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,l,"GeneratorFunction")),e.prototype=Object.create(d),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,s,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new AsyncIterator(wrap(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},defineIteratorMethods(d),define(d,l,"Generator"),define(d,o,(function(){return this})),define(d,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},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),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;resetTryEntry(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _typeof(e){return _typeof="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},_typeof(e)}function _wrapAsyncGenerator(e){return function(){return new _AsyncGenerator(e.apply(this,arguments))}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,l=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,F=function(){};return{s:F,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw i}}}}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}_AsyncGenerator.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},_AsyncGenerator.prototype.next=function(e){return this._invoke("next",e)},_AsyncGenerator.prototype.throw=function(e){return this._invoke("throw",e)},_AsyncGenerator.prototype.return=function(e){return this._invoke("return",e)};var n=require("webidl-conversions"),i=require("./utils.js"),o=i.implSymbol,s=i.ctorRegistrySymbol;function makeWrapper$1(e,t){var r;return void 0!==t&&(r=t.prototype),i.isObject(r)||(r=e[s].URL.prototype),Object.create(r)}e.is=function(e){return i.isObject(e)&&i.hasOwn(e,o)&&e[o]instanceof u.implementation},e.isImpl=function(e){return i.isObject(e)&&e instanceof u.implementation},e.convert=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.context,s=void 0===o?"The provided value":o;if(e.is(r))return i.implForWrapper(r);throw new t.TypeError("".concat(s," is not of type 'URL'."))},e.create=function(t,r,n){var i=makeWrapper$1(t);return e.setup(i,t,r,n)},e.createImpl=function(t,r,n){var o=e.create(t,r,n);return i.implForWrapper(o)},e._internalSetup=function(e,t){},e.setup=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s.wrapper=t,e._internalSetup(t,r),Object.defineProperty(t,o,{value:new u.implementation(r,n,s),configurable:!0}),t[o][i.wrapperSymbol]=t,u.init&&u.init(t[o]),t},e.new=function(t,r){var n=makeWrapper$1(t,r);return e._internalSetup(n,t),Object.defineProperty(n,o,{value:Object.create(u.implementation.prototype),configurable:!0}),n[o][i.wrapperSymbol]=n,u.init&&u.init(n[o]),n[o]};var l=new Set(["Window","Worker"]);e.install=function(t,r){if(r.some((function(e){return l.has(e)}))){var s=i.initCtorRegistry(t),u=function(){function URL(r){if(_classCallCheck(this,URL),arguments.length<1)throw new t.TypeError("Failed to construct 'URL': 1 argument required, but only ".concat(arguments.length," present."));var i=[],o=arguments[0];o=n.USVString(o,{context:"Failed to construct 'URL': parameter 1",globals:t}),i.push(o);var s=arguments[1];return void 0!==s&&(s=n.USVString(s,{context:"Failed to construct 'URL': parameter 2",globals:t})),i.push(s),e.setup(Object.create((this instanceof URL?this.constructor:void 0).prototype),t,i)}return _createClass(URL,[{key:"toJSON",value:function toJSON(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'toJSON' called on an object that is not a valid instance of URL.");return r[o].toJSON()}},{key:"href",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get href' called on an object that is not a valid instance of URL.");return r[o].href},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set href' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'href' property on 'URL': The provided value",globals:t}),i[o].href=r}},{key:"toString",value:function toString(){if(!e.is(this))throw new t.TypeError("'toString' called on an object that is not a valid instance of URL.");return this[o].href}},{key:"origin",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get origin' called on an object that is not a valid instance of URL.");return r[o].origin}},{key:"protocol",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get protocol' called on an object that is not a valid instance of URL.");return r[o].protocol},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set protocol' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'protocol' property on 'URL': The provided value",globals:t}),i[o].protocol=r}},{key:"username",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get username' called on an object that is not a valid instance of URL.");return r[o].username},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set username' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'username' property on 'URL': The provided value",globals:t}),i[o].username=r}},{key:"password",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get password' called on an object that is not a valid instance of URL.");return r[o].password},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set password' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'password' property on 'URL': The provided value",globals:t}),i[o].password=r}},{key:"host",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get host' called on an object that is not a valid instance of URL.");return r[o].host},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set host' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'host' property on 'URL': The provided value",globals:t}),i[o].host=r}},{key:"hostname",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get hostname' called on an object that is not a valid instance of URL.");return r[o].hostname},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set hostname' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'hostname' property on 'URL': The provided value",globals:t}),i[o].hostname=r}},{key:"port",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get port' called on an object that is not a valid instance of URL.");return r[o].port},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set port' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'port' property on 'URL': The provided value",globals:t}),i[o].port=r}},{key:"pathname",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get pathname' called on an object that is not a valid instance of URL.");return r[o].pathname},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set pathname' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'pathname' property on 'URL': The provided value",globals:t}),i[o].pathname=r}},{key:"search",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get search' called on an object that is not a valid instance of URL.");return r[o].search},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set search' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'search' property on 'URL': The provided value",globals:t}),i[o].search=r}},{key:"searchParams",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");return i.getSameObject(this,"searchParams",(function(){return i.tryWrapperForImpl(r[o].searchParams)}))}},{key:"hash",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get hash' called on an object that is not a valid instance of URL.");return r[o].hash},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set hash' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'hash' property on 'URL': The provided value",globals:t}),i[o].hash=r}}]),URL}();Object.defineProperties(u.prototype,_defineProperty({toJSON:{enumerable:!0},href:{enumerable:!0},toString:{enumerable:!0},origin:{enumerable:!0},protocol:{enumerable:!0},username:{enumerable:!0},password:{enumerable:!0},host:{enumerable:!0},hostname:{enumerable:!0},port:{enumerable:!0},pathname:{enumerable:!0},search:{enumerable:!0},searchParams:{enumerable:!0},hash:{enumerable:!0}},Symbol.toStringTag,{value:"URL",configurable:!0})),s.URL=u,Object.defineProperty(t,"URL",{configurable:!0,writable:!0,value:u}),r.includes("Window")&&Object.defineProperty(t,"webkitURL",{configurable:!0,writable:!0,value:u})}};var u=require("./URL-impl.js"),c=getAugmentedNamespace(Object.freeze({__proto__:null})),h=require("webidl-conversions"),f=require("./utils.js"),d=require("./Function.js"),y=f.newObjectInRealm,m=f.implSymbol,v=f.ctorRegistrySymbol,b="URLSearchParams";function makeWrapper(e,t){var r;return void 0!==t&&(r=t.prototype),f.isObject(r)||(r=e[v].URLSearchParams.prototype),Object.create(r)}e.is=function(e){return f.isObject(e)&&f.hasOwn(e,m)&&e[m]instanceof S.implementation},e.isImpl=function(e){return f.isObject(e)&&e instanceof S.implementation},e.convert=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.context,o=void 0===i?"The provided value":i;if(e.is(r))return f.implForWrapper(r);throw new t.TypeError("".concat(o," is not of type 'URLSearchParams'."))},e.createDefaultIterator=function(e,t,r){var n=e[v]["URLSearchParams Iterator"],i=Object.create(n);return Object.defineProperty(i,f.iterInternalSymbol,{value:{target:t,kind:r,index:0},configurable:!0}),i},e.create=function(t,r,n){var i=makeWrapper(t);return e.setup(i,t,r,n)},e.createImpl=function(t,r,n){var i=e.create(t,r,n);return f.implForWrapper(i)},e._internalSetup=function(e,t){},e.setup=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return i.wrapper=t,e._internalSetup(t,r),Object.defineProperty(t,m,{value:new S.implementation(r,n,i),configurable:!0}),t[m][f.wrapperSymbol]=t,S.init&&S.init(t[m]),t},e.new=function(t,r){var n=makeWrapper(t,r);return e._internalSetup(n,t),Object.defineProperty(n,m,{value:Object.create(S.implementation.prototype),configurable:!0}),n[m][f.wrapperSymbol]=n,S.init&&S.init(n[m]),n[m]};var g=new Set(["Window","Worker"]);e.install=function(t,r){var n;if(r.some((function(e){return g.has(e)}))){var i=f.initCtorRegistry(t),o=function(){function URLSearchParams(){_classCallCheck(this,URLSearchParams);var r=[],n=arguments[0];if(void 0!==n)if(f.isObject(n))if(void 0!==n[Symbol.iterator]){if(!f.isObject(n))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");var i,o=[],s=n,l=_createForOfIteratorHelper(s);try{for(l.s();!(i=l.n()).done;){var u=i.value;if(!f.isObject(u))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object.");var c,d=[],y=u,m=_createForOfIteratorHelper(y);try{for(m.s();!(c=m.n()).done;){var v=c.value;v=h.USVString(v,{context:"Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",globals:t}),d.push(v)}}catch(e){m.e(e)}finally{m.f()}u=d,o.push(u)}}catch(e){l.e(e)}finally{l.f()}n=o}else{if(!f.isObject(n))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 record is not an object.");var b,g=Object.create(null),S=_createForOfIteratorHelper(Reflect.ownKeys(n));try{for(S.s();!(b=S.n()).done;){var w=b.value,P=Object.getOwnPropertyDescriptor(n,w);if(P&&P.enumerable){var L=w;L=h.USVString(L,{context:"Failed to construct 'URLSearchParams': parameter 1 record's key",globals:t});var U=n[w];U=h.USVString(U,{context:"Failed to construct 'URLSearchParams': parameter 1 record's value",globals:t}),g[L]=U}}}catch(e){S.e(e)}finally{S.f()}n=g}else n=h.USVString(n,{context:"Failed to construct 'URLSearchParams': parameter 1",globals:t});else n="";return r.push(n),e.setup(Object.create((this instanceof URLSearchParams?this.constructor:void 0).prototype),t,r)}return _createClass(URLSearchParams,[{key:"append",value:function append(r,n){var i,o=null!=this?this:t;if(!e.is(o))throw new t.TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new t.TypeError("Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ".concat(arguments.length," present."));var s=[],l=arguments[0];l=h.USVString(l,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 1",globals:t}),s.push(l);var u=arguments[1];return u=h.USVString(u,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 2",globals:t}),s.push(u),f.tryWrapperForImpl((i=o[m]).append.apply(i,s))}},{key:"delete",value:function _delete(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'delete' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),f.tryWrapperForImpl((n=i[m]).delete.apply(n,o))}},{key:"get",value:function get(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'get' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),(n=i[m]).get.apply(n,o)}},{key:"getAll",value:function getAll(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'getAll' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),f.tryWrapperForImpl((n=i[m]).getAll.apply(n,o))}},{key:"has",value:function has(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'has' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),(n=i[m]).has.apply(n,o)}},{key:"set",value:function set(r,n){var i,o=null!=this?this:t;if(!e.is(o))throw new t.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new t.TypeError("Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ".concat(arguments.length," present."));var s=[],l=arguments[0];l=h.USVString(l,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 1",globals:t}),s.push(l);var u=arguments[1];return u=h.USVString(u,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 2",globals:t}),s.push(u),f.tryWrapperForImpl((i=o[m]).set.apply(i,s))}},{key:"sort",value:function sort(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");return f.tryWrapperForImpl(r[m].sort())}},{key:"toString",value:function toString(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");return r[m].toString()}},{key:"keys",value:function keys(){if(!e.is(this))throw new t.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"key")}},{key:"values",value:function values(){if(!e.is(this))throw new t.TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"value")}},{key:"entries",value:function entries(){if(!e.is(this))throw new t.TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"key+value")}},{key:"forEach",value:function forEach(r){if(!e.is(this))throw new t.TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.");r=d.convert(t,r,{context:"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"});for(var n=arguments[1],i=Array.from(this[m]),o=0;o<i.length;){var s=i[o].map(f.tryWrapperForImpl),l=_slicedToArray(s,2),u=l[0],c=l[1];r.call(n,c,u,this),i=Array.from(this[m]),o++}}}]),URLSearchParams}();Object.defineProperties(o.prototype,(_defineProperty(n={append:{enumerable:!0},delete:{enumerable:!0},get:{enumerable:!0},getAll:{enumerable:!0},has:{enumerable:!0},set:{enumerable:!0},sort:{enumerable:!0},toString:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0},forEach:{enumerable:!0}},Symbol.toStringTag,{value:"URLSearchParams",configurable:!0}),_defineProperty(n,Symbol.iterator,{value:o.prototype.entries,configurable:!0,writable:!0}),n)),i[b]=o,i["URLSearchParams Iterator"]=Object.create(i["%IteratorPrototype%"],_defineProperty({},Symbol.toStringTag,{configurable:!0,value:"URLSearchParams Iterator"})),f.define(i["URLSearchParams Iterator"],{next:function next(){var e=this&&this[f.iterInternalSymbol];if(!e)throw new t.TypeError("next() called on a value that is not a URLSearchParams iterator object");var r=e.target,n=e.kind,i=e.index,o=Array.from(r[m]);if(i>=o.length)return y(t,{value:void 0,done:!0});var s=o[i];return e.index=i+1,y(t,f.iteratorResult(s.map(f.tryWrapperForImpl),n))}}),Object.defineProperty(t,b,{configurable:!0,writable:!0,value:o})}};var S=require("./URLSearchParams-impl.js"),w=c,P=getAugmentedNamespace(Object.freeze({__proto__:null}));r.URL=w,r.URLSearchParams=P;var L=require("tr46"),U=require("./infra"),R=require("./encoding").utf8DecodeWithoutBOM,x=require("./percent-encoding"),O=x.percentDecodeString,E=x.utf8PercentEncodeCodePoint,I=x.utf8PercentEncodeString,j=x.isC0ControlPercentEncode,A=x.isFragmentPercentEncode,T=x.isQueryPercentEncode,_=x.isSpecialQueryPercentEncode,k=x.isPathPercentEncode,$=x.isUserinfoPercentEncode;function p$1(e){return e.codePointAt(0)}var C={ftp:21,file:null,http:80,https:443,ws:80,wss:443},N=Symbol("failure");function countSymbols(e){return _toConsumableArray(e).length}function at(e,t){var r=e[t];return isNaN(r)?void 0:String.fromCodePoint(r)}function isSingleDot(e){return"."===e||"%2e"===e.toLowerCase()}function isWindowsDriveLetterString(e){return 2===e.length&&U.isASCIIAlpha(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function containsForbiddenHostCodePoint(e){return-1!==e.search(/\0|\t|\n|\r| |#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/)}function containsForbiddenDomainCodePoint(e){return containsForbiddenHostCodePoint(e)||-1!==e.search(/[\0-\x1F]|%|\x7F/)}function isSpecialScheme(e){return void 0!==C[e]}function isSpecial(e){return isSpecialScheme(e.scheme)}function isNotSpecial(e){return!isSpecialScheme(e.scheme)}function defaultPort(e){return C[e]}function parseIPv4Number(e){if(""===e)return N;var t=10;if(e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e)return 0;var r=/(?:(?![0-7])[\s\S])/;return 10===t&&(r=/(?:(?![0-9])[\s\S])/),16===t&&(r=/(?:(?![0-9A-Fa-f])[\s\S])/),r.test(e)?N:parseInt(e,t)}function parseIPv4(e){var t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return N;var r,n=[],i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var o=parseIPv4Number(r.value);if(o===N)return N;n.push(o)}}catch(e){i.e(e)}finally{i.f()}for(var s=0;s<n.length-1;++s)if(n[s]>255)return N;if(n[n.length-1]>=Math.pow(256,5-n.length))return N;for(var l=n.pop(),u=0,c=0,h=n;c<h.length;c++){l+=h[c]*Math.pow(256,3-u),++u}return l}function parseIPv6(e){var t=[0,0,0,0,0,0,0,0],r=0,n=null,i=0;if((e=Array.from(e,(function(e){return e.codePointAt(0)})))[i]===p$1(":")){if(e[i+1]!==p$1(":"))return N;i+=2,n=++r}for(;i<e.length;){if(8===r)return N;if(e[i]!==p$1(":")){for(var o=0,s=0;s<4&&U.isASCIIHex(e[i]);)o=16*o+parseInt(at(e,i),16),++i,++s;if(e[i]===p$1(".")){if(0===s)return N;if(i-=s,r>6)return N;for(var l=0;void 0!==e[i];){var u=null;if(l>0){if(!(e[i]===p$1(".")&&l<4))return N;++i}if(!U.isASCIIDigit(e[i]))return N;for(;U.isASCIIDigit(e[i]);){var c=parseInt(at(e,i));if(null===u)u=c;else{if(0===u)return N;u=10*u+c}if(u>255)return N;++i}t[r]=256*t[r]+u,2!==++l&&4!==l||++r}if(4!==l)return N;break}if(e[i]===p$1(":")){if(void 0===e[++i])return N}else if(void 0!==e[i])return N;t[r]=o,++r}else{if(null!==n)return N;++i,n=++r}}if(null!==n){var h=r-n;for(r=7;0!==r&&h>0;){var f=t[n+h-1];t[n+h-1]=t[r],t[r]=f,--r,--h}}else if(null===n&&8!==r)return N;return t}function parseHost(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("["===e[0])return"]"!==e[e.length-1]?N:parseIPv6(e.substring(1,e.length-1));if(t)return parseOpaqueHost(e);var r=R(O(e)),n=domainToASCII(r);return n===N||containsForbiddenDomainCodePoint(n)?N:endsInANumber(n)?parseIPv4(n):n}function endsInANumber(e){var t=e.split(".");if(""===t[t.length-1]){if(1===t.length)return!1;t.pop()}var r=t[t.length-1];return parseIPv4Number(r)!==N||!!/^[0-9]+$/.test(r)}function parseOpaqueHost(e){return containsForbiddenHostCodePoint(e)?N:I(e,j)}function serializeHost(e){return"number"==typeof e?function serializeIPv4(e){for(var t="",r=e,n=1;n<=4;++n)t=String(r%256)+t,4!==n&&(t=".".concat(t)),r=Math.floor(r/256);return t}(e):e instanceof Array?"[".concat(function serializeIPv6(e){for(var t="",r=function findLongestZeroSequence(e){for(var t=null,r=1,n=null,i=0,o=0;o<e.length;++o)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),n=!1,i=0;i<=7;++i)n&&0===e[i]||(n&&(n=!1),r!==i?(t+=e[i].toString(16),7!==i&&(t+=":")):(t+=0===i?"::":":",n=!0));return t}(e),"]"):e}function domainToASCII(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=L.toASCII(e,{checkBidi:!0,checkHyphens:!1,checkJoiners:!0,useSTD3ASCIIRules:t,verifyDNSLength:t});return null===r||""===r?N:r}function shortenPath(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&function isNormalizedWindowsDriveLetter(e){return/^[A-Za-z]:$/.test(e)}(t[0])||t.pop())}function includesCredentials(e){return""!==e.username||""!==e.password}function hasAnOpaquePath(e){return"string"==typeof e.path}function URLStateMachine(e,t,r,n,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=r||"utf-8",this.stateOverride=i,this.url=n,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null};var o=function trimControlChars(e){return e.replace(/^[\0- ]+|[\0- ]+$/g,"")}(this.input);o!==this.input&&(this.parseError=!0),this.input=o}var s=function trimTabAndNewline(e){return e.replace(/\t|\n|\r/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=Array.from(this.input,(function(e){return e.codePointAt(0)}));this.pointer<=this.input.length;++this.pointer){var l=this.input[this.pointer],u=isNaN(l)?void 0:String.fromCodePoint(l),c=this["parse ".concat(this.state)](l,u);if(!c)break;if(c===N){this.failure=!0;break}}}URLStateMachine.prototype["parse scheme start"]=function parseSchemeStart(e,t){if(U.isASCIIAlpha(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,N;this.state="no scheme",--this.pointer}return!0},URLStateMachine.prototype["parse scheme"]=function parseScheme(e,t){if(U.isASCIIAlphanumeric(e)||e===p$1("+")||e===p$1("-")||e===p$1("."))this.buffer+=t.toLowerCase();else if(e===p$1(":")){if(this.stateOverride){if(isSpecial(this.url)&&!isSpecialScheme(this.buffer))return!1;if(!isSpecial(this.url)&&isSpecialScheme(this.buffer))return!1;if((includesCredentials(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&""===this.url.host)return!1}if(this.url.scheme=this.buffer,this.stateOverride)return this.url.port===defaultPort(this.url.scheme)&&(this.url.port=null),!1;this.buffer="","file"===this.url.scheme?(this.input[this.pointer+1]===p$1("/")&&this.input[this.pointer+2]===p$1("/")||(this.parseError=!0),this.state="file"):isSpecial(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":isSpecial(this.url)?this.state="special authority slashes":this.input[this.pointer+1]===p$1("/")?(this.state="path or authority",++this.pointer):(this.url.path="",this.state="opaque path")}else{if(this.stateOverride)return this.parseError=!0,N;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},URLStateMachine.prototype["parse no scheme"]=function parseNoScheme(e){return null===this.base||hasAnOpaquePath(this.base)&&e!==p$1("#")?N:(hasAnOpaquePath(this.base)&&e===p$1("#")?(this.url.scheme=this.base.scheme,this.url.path=this.base.path,this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},URLStateMachine.prototype["parse special relative or authority"]=function parseSpecialRelativeOrAuthority(e){return e===p$1("/")&&this.input[this.pointer+1]===p$1("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},URLStateMachine.prototype["parse path or authority"]=function parsePathOrAuthority(e){return e===p$1("/")?this.state="authority":(this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse relative"]=function parseRelative(e){return this.url.scheme=this.base.scheme,e===p$1("/")?this.state="relative slash":isSpecial(this.url)&&e===p$1("\\")?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,this.url.path.pop(),this.state="path",--this.pointer)),!0},URLStateMachine.prototype["parse relative slash"]=function parseRelativeSlash(e){return!isSpecial(this.url)||e!==p$1("/")&&e!==p$1("\\")?e===p$1("/")?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(e===p$1("\\")&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},URLStateMachine.prototype["parse special authority slashes"]=function parseSpecialAuthoritySlashes(e){return e===p$1("/")&&this.input[this.pointer+1]===p$1("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},URLStateMachine.prototype["parse special authority ignore slashes"]=function parseSpecialAuthorityIgnoreSlashes(e){return e!==p$1("/")&&e!==p$1("\\")?(this.state="authority",--this.pointer):this.parseError=!0,!0},URLStateMachine.prototype["parse authority"]=function parseAuthority(e,t){if(e===p$1("@")){this.parseError=!0,this.atFlag&&(this.buffer="%40".concat(this.buffer)),this.atFlag=!0;for(var r=countSymbols(this.buffer),n=0;n<r;++n){var i=this.buffer.codePointAt(n);if(i!==p$1(":")||this.passwordTokenSeenFlag){var o=E(i,$);this.passwordTokenSeenFlag?this.url.password+=o:this.url.username+=o}else this.passwordTokenSeenFlag=!0}this.buffer=""}else if(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")){if(this.atFlag&&""===this.buffer)return this.parseError=!0,N;this.pointer-=countSymbols(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},URLStateMachine.prototype["parse hostname"]=URLStateMachine.prototype["parse host"]=function parseHostName(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(e!==p$1(":")||this.arrFlag)if(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")){if(--this.pointer,isSpecial(this.url)&&""===this.buffer)return this.parseError=!0,N;if(this.stateOverride&&""===this.buffer&&(includesCredentials(this.url)||null!==this.url.port))return this.parseError=!0,!1;var r=parseHost(this.buffer,isNotSpecial(this.url));if(r===N)return N;if(this.url.host=r,this.buffer="",this.state="path start",this.stateOverride)return!1}else e===p$1("[")?this.arrFlag=!0:e===p$1("]")&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,N;if("hostname"===this.stateOverride)return!1;var n=parseHost(this.buffer,isNotSpecial(this.url));if(n===N)return N;this.url.host=n,this.buffer="",this.state="port"}return!0},URLStateMachine.prototype["parse port"]=function parsePort(e,t){if(U.isASCIIDigit(e))this.buffer+=t;else{if(!(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")||this.stateOverride))return this.parseError=!0,N;if(""!==this.buffer){var r=parseInt(this.buffer);if(r>Math.pow(2,16)-1)return this.parseError=!0,N;this.url.port=r===defaultPort(this.url.scheme)?null:r,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}return!0};var q=new Set([p$1("/"),p$1("\\"),p$1("?"),p$1("#")]);function startsWithWindowsDriveLetter(e,t){var r=e.length-t;return r>=2&&function isWindowsDriveLetterCodePoints(e,t){return U.isASCIIAlpha(e)&&(t===p$1(":")||t===p$1("|"))}(e[t],e[t+1])&&(2===r||q.has(e[t+2]))}function serializePath(e){if(hasAnOpaquePath(e))return e.path;var t,r="",n=_createForOfIteratorHelper(e.path);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="/".concat(i)}}catch(e){n.e(e)}finally{n.f()}return r}URLStateMachine.prototype["parse file"]=function parseFile(e){return this.url.scheme="file",this.url.host="",e===p$1("/")||e===p$1("\\")?(e===p$1("\\")&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,startsWithWindowsDriveLetter(this.input,this.pointer)?(this.parseError=!0,this.url.path=[]):shortenPath(this.url),this.state="path",--this.pointer)):(this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse file slash"]=function parseFileSlash(e){return e===p$1("/")||e===p$1("\\")?(e===p$1("\\")&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(!startsWithWindowsDriveLetter(this.input,this.pointer)&&function isNormalizedWindowsDriveLetterString(e){return 2===e.length&&U.isASCIIAlpha(e.codePointAt(0))&&":"===e[1]}(this.base.path[0])&&this.url.path.push(this.base.path[0]),this.url.host=this.base.host),this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse file host"]=function parseFileHost(e,t){if(isNaN(e)||e===p$1("/")||e===p$1("\\")||e===p$1("?")||e===p$1("#"))if(--this.pointer,!this.stateOverride&&isWindowsDriveLetterString(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{var r=parseHost(this.buffer,isNotSpecial(this.url));if(r===N)return N;if("localhost"===r&&(r=""),this.url.host=r,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},URLStateMachine.prototype["parse path start"]=function parsePathStart(e){return isSpecial(this.url)?(e===p$1("\\")&&(this.parseError=!0),this.state="path",e!==p$1("/")&&e!==p$1("\\")&&--this.pointer):this.stateOverride||e!==p$1("?")?this.stateOverride||e!==p$1("#")?void 0!==e?(this.state="path",e!==p$1("/")&&--this.pointer):this.stateOverride&&null===this.url.host&&this.url.path.push(""):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},URLStateMachine.prototype["parse path"]=function parsePath(e){return isNaN(e)||e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")||!this.stateOverride&&(e===p$1("?")||e===p$1("#"))?(isSpecial(this.url)&&e===p$1("\\")&&(this.parseError=!0),!function isDoubleDot(e){return".."===(e=e.toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e}(this.buffer)?!isSingleDot(this.buffer)||e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")?isSingleDot(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&isWindowsDriveLetterString(this.buffer)&&(this.buffer="".concat(this.buffer[0],":")),this.url.path.push(this.buffer)):this.url.path.push(""):(shortenPath(this.url),e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")||this.url.path.push("")),this.buffer="",e===p$1("?")&&(this.url.query="",this.state="query"),e===p$1("#")&&(this.url.fragment="",this.state="fragment")):(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=E(e,k)),!0},URLStateMachine.prototype["parse opaque path"]=function parseOpaquePath(e){return e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):(isNaN(e)||e===p$1("%")||(this.parseError=!0),e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path+=E(e,j))),!0},URLStateMachine.prototype["parse query"]=function parseQuery(e,t){if(isSpecial(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8"),!this.stateOverride&&e===p$1("#")||isNaN(e)){var r=isSpecial(this.url)?_:T;this.url.query+=I(this.buffer,r),this.buffer="",e===p$1("#")&&(this.url.fragment="",this.state="fragment")}else isNaN(e)||(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t);return!0},URLStateMachine.prototype["parse fragment"]=function parseFragment(e){return isNaN(e)||(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=E(e,A)),!0},module.exports.serializeURL=function serializeURL(e,t){var r="".concat(e.scheme,":");return null!==e.host&&(r+="//",""===e.username&&""===e.password||(r+=e.username,""!==e.password&&(r+=":".concat(e.password)),r+="@"),r+=serializeHost(e.host),null!==e.port&&(r+=":".concat(e.port))),null===e.host&&!hasAnOpaquePath(e)&&e.path.length>1&&""===e.path[0]&&(r+="/."),r+=serializePath(e),null!==e.query&&(r+="?".concat(e.query)),t||null===e.fragment||(r+="#".concat(e.fragment)),r},module.exports.serializePath=serializePath,module.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":try{return module.exports.serializeURLOrigin(module.exports.parseURL(serializePath(e)))}catch(e){return"null"}case"ftp":case"http":case"https":case"ws":case"wss":return function serializeOrigin(e){var t="".concat(e.scheme,"://");return t+=serializeHost(e.host),null!==e.port&&(t+=":".concat(e.port)),t}({scheme:e.scheme,host:e.host,port:e.port});default:return"null"}},module.exports.basicURLParse=function(e,t){void 0===t&&(t={});var r=new URLStateMachine(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return r.failure?null:r.url},module.exports.setTheUsername=function(e,t){e.username=I(t,$)},module.exports.setThePassword=function(e,t){e.password=I(t,$)},module.exports.serializeHost=serializeHost,module.exports.cannotHaveAUsernamePasswordPort=function cannotHaveAUsernamePasswordPort(e){return null===e.host||""===e.host||"file"===e.scheme},module.exports.hasAnOpaquePath=hasAnOpaquePath,module.exports.serializeInteger=function(e){return String(e)},module.exports.parseURL=function(e,t){return void 0===t&&(t={}),module.exports.basicURLParse(e,{baseURL:t.baseURL,encodingOverride:t.encodingOverride})};var W=getAugmentedNamespace(Object.freeze({__proto__:null})),M=require("./infra").isASCIIHex,D=require("./encoding").utf8Encode;function p(e){return e.codePointAt(0)}function percentDecodeBytes(e){for(var t=new Uint8Array(e.byteLength),r=0,n=0;n<e.byteLength;++n){var i=e[n];if(37!==i)t[r++]=i;else if(37!==i||M(e[n+1])&&M(e[n+2])){var o=parseInt(String.fromCodePoint(e[n+1],e[n+2]),16);t[r++]=o,n+=2}else t[r++]=i}return t.slice(0,r)}function isC0ControlPercentEncode(e){return e<=31||e>126}var H=new Set([p(" "),p('"'),p("<"),p(">"),p("`")]);var z=new Set([p(" "),p('"'),p("#"),p("<"),p(">")]);function isQueryPercentEncode(e){return isC0ControlPercentEncode(e)||z.has(e)}var G=new Set([p("?"),p("`"),p("{"),p("}")]);function isPathPercentEncode(e){return isQueryPercentEncode(e)||G.has(e)}var V=new Set([p("/"),p(":"),p(";"),p("="),p("@"),p("["),p("\\"),p("]"),p("^"),p("|")]);function isUserinfoPercentEncode(e){return isPathPercentEncode(e)||V.has(e)}var B=new Set([p("$"),p("%"),p("&"),p("+"),p(",")]);var Q=new Set([p("!"),p("'"),p("("),p(")"),p("~")]);function utf8PercentEncodeCodePointInternal(e,t){var r,n,i="",o=_createForOfIteratorHelper(D(e));try{for(o.s();!(r=o.n()).done;){var s=r.value;t(s)?i+=(n=void 0,1===(n=s.toString(16).toUpperCase()).length&&(n="0".concat(n)),"%".concat(n)):i+=String.fromCharCode(s)}}catch(e){o.e(e)}finally{o.f()}return i}module.exports={isC0ControlPercentEncode:isC0ControlPercentEncode,isFragmentPercentEncode:function isFragmentPercentEncode(e){return isC0ControlPercentEncode(e)||H.has(e)},isQueryPercentEncode:isQueryPercentEncode,isSpecialQueryPercentEncode:function isSpecialQueryPercentEncode(e){return isQueryPercentEncode(e)||e===p("'")},isPathPercentEncode:isPathPercentEncode,isUserinfoPercentEncode:isUserinfoPercentEncode,isURLEncodedPercentEncode:function isURLEncodedPercentEncode(e){return function isComponentPercentEncode(e){return isUserinfoPercentEncode(e)||B.has(e)}(e)||Q.has(e)},percentDecodeString:function percentDecodeString(e){return percentDecodeBytes(D(e))},percentDecodeBytes:percentDecodeBytes,utf8PercentEncodeString:function utf8PercentEncodeString(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i="",o=_createForOfIteratorHelper(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;i+=n&&" "===s?"+":utf8PercentEncodeCodePointInternal(s,t)}}catch(e){o.e(e)}finally{o.f()}return i},utf8PercentEncodeCodePoint:function utf8PercentEncodeCodePoint(e,t){return utf8PercentEncodeCodePointInternal(String.fromCodePoint(e),t)}};var J=getAugmentedNamespace(Object.freeze({__proto__:null})),K=r,Y=K.URL,X=K.URLSearchParams,Z=W,ee=J,te={Array:Array,Object:Object,Promise:Promise,String:String,TypeError:TypeError};Y.install(te,["Window"]),X.install(te,["Window"]),t.URL=te.URL,t.URLSearchParams=te.URLSearchParams,t.parseURL=Z.parseURL,t.basicURLParse=Z.basicURLParse,t.serializeURL=Z.serializeURL,t.serializePath=Z.serializePath,t.serializeHost=Z.serializeHost,t.serializeInteger=Z.serializeInteger,t.serializeURLOrigin=Z.serializeURLOrigin,t.setTheUsername=Z.setTheUsername,t.setThePassword=Z.setThePassword,t.cannotHaveAUsernamePasswordPort=Z.cannotHaveAUsernamePasswordPort,t.hasAnOpaquePath=Z.hasAnOpaquePath,t.percentDecodeString=ee.percentDecodeString,t.percentDecodeBytes=ee.percentDecodeBytes;var re=Function.prototype.call.bind(Object.prototype.hasOwnProperty);var ne=Symbol("wrapper"),ie=Symbol("impl"),ae=Symbol("SameObject caches"),oe=Symbol.for("[webidl2js] constructor registry"),se=Object.getPrototypeOf(Object.getPrototypeOf(_wrapAsyncGenerator(_regeneratorRuntime().mark((function _callee(){return _regeneratorRuntime().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),_callee)})))).prototype);function initCtorRegistry(e){if(re(e,oe))return e[oe];var t=Object.create(null);t["%Object.prototype%"]=e.Object.prototype,t["%IteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf((new e.Array)[Symbol.iterator]()));try{t["%AsyncIteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf(e.eval("(async function* () {})").prototype))}catch(e){t["%AsyncIteratorPrototype%"]=se}return e[oe]=t,t}function wrapperForImpl(e){return e?e[ne]:null}function implForWrapper$1(e){return e?e[ie]:null}var le=Symbol("internal");var ue=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get;var ce=Symbol("supports property index"),he=Symbol("supported property indices"),pe=Symbol("supports property name"),fe=Symbol("supported property names"),de=Symbol("indexed property get"),ye=Symbol("indexed property set new"),me=Symbol("indexed property set existing"),ve=Symbol("named property get"),be=Symbol("named property set new"),ge=Symbol("named property set existing"),Se=Symbol("named property delete"),we=Symbol("async iterator get the next iteration result"),Pe=Symbol("async iterator return steps"),Le=Symbol("async iterator initialization steps"),Ue=Symbol("async iterator end of iteration");module.exports=e={isObject:function isObject(e){return"object"===_typeof(e)&&null!==e||"function"==typeof e},hasOwn:re,define:function define(e,t){var r,n=_createForOfIteratorHelper(Reflect.ownKeys(t));try{for(n.s();!(r=n.n()).done;){var i=r.value,o=Reflect.getOwnPropertyDescriptor(t,i);if(o&&!Reflect.defineProperty(e,i,o))throw new TypeError("Cannot redefine property: ".concat(String(i)))}}catch(e){n.e(e)}finally{n.f()}},newObjectInRealm:function newObjectInRealm(e,t){var r=initCtorRegistry(e);return Object.defineProperties(Object.create(r["%Object.prototype%"]),Object.getOwnPropertyDescriptors(t))},wrapperSymbol:ne,implSymbol:ie,getSameObject:function getSameObject(e,t,r){return e[ae]||(e[ae]=Object.create(null)),t in e[ae]||(e[ae][t]=r()),e[ae][t]},ctorRegistrySymbol:oe,initCtorRegistry:initCtorRegistry,wrapperForImpl:wrapperForImpl,implForWrapper:implForWrapper$1,tryWrapperForImpl:function tryWrapperForImpl(e){var t=wrapperForImpl(e);return t||e},tryImplForWrapper:function tryImplForWrapper(e){var t=implForWrapper$1(e);return t||e},iterInternalSymbol:le,isArrayBuffer:function isArrayBuffer(e){try{return ue.call(e),!0}catch(e){return!1}},isArrayIndexPropName:function isArrayIndexPropName(e){if("string"!=typeof e)return!1;var t=e>>>0;return t!==Math.pow(2,32)-1&&e==="".concat(t)},supportsPropertyIndex:ce,supportedPropertyIndices:he,supportsPropertyName:pe,supportedPropertyNames:fe,indexedGet:de,indexedSetNew:ye,indexedSetExisting:me,namedGet:ve,namedSetNew:be,namedSetExisting:ge,namedDelete:Se,asyncIteratorNext:we,asyncIteratorReturn:Pe,asyncIteratorInit:Le,asyncIteratorEOI:Ue,iteratorResult:function iteratorResult(e,t){var r,n=_slicedToArray(e,2),i=n[0],o=n[1];switch(t){case"key":r=i;break;case"value":r=o;break;case"key+value":r=[i,o]}return{value:r,done:!1}}};var Re=t.serializeURLOrigin,xe=t.parseURL,Oe={},Ee=(void 0).implForWrapper;e.createObjectURL=function createObjectURL(e){var t=xe(location.href),r="blob:"+(t?Re(t):"null")+"/"+function generateUUID(){var e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}();return Oe[r]=e,r},e.revokeObjectURL=function revokeObjectURL(e){delete Oe[e]},e.xmlHttpRequestOverrideMimeType=function xmlHttpRequestOverrideMimeType(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.polyfillDataURLs,r=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.overrideMimeType;return function(e){"text/plain; charset=x-user-defined"===e&&(this.open=function(e,n,i){if(n.startsWith("blob:")){var o=Oe[n];if(!o)return void(this.send=function(){throw new DOMException("Failed to execute 'send' on 'XMLHttpRequest': Failed to "+"load '".concat(n,"'"),"NetworkError")});var s="text/plain",l=Ee(o)._buffer.toString("binary");if(t)return this.status=200,this.send=function(){},this.responseType=s,void(this.responseText=l);n="data:"+s+","+encodeURIComponent(l)}return r.call(this,e,n,i)});for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return n&&n.call.apply(n,[this,e].concat(o))}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).createObjectURL={})}(this,(function(e){"use strict";function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function a(){if(this instanceof a){var e=[null];return e.push.apply(e,arguments),new(Function.bind.apply(t,e))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var t={},r={};function _AsyncGenerator(e){var t,r;function resume(t,r){try{var n=e[t](r),i=n.value,o=i instanceof _OverloadYield;Promise.resolve(o?i.v:i).then((function(r){if(o){var s="return"===t?"return":"next";if(!i.k||r.done)return resume(s,r);r=e[s](r).value}settle(n.done?"return":"normal",r)}),(function(e){resume("throw",e)}))}catch(e){settle("throw",e)}}function settle(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?resume(t.key,t.arg):r=null}this._invoke=function(e,n){return new Promise((function(i,o){var s={key:e,arg:n,resolve:i,reject:o,next:null};r?r=r.next=s:(t=r=s,resume(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}function _OverloadYield(e,t){this.v=e,this.k=t}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,i){var o=t&&t.prototype instanceof Generator?t:Generator,s=Object.create(o.prototype),u=new Context(i||[]);return n(s,"_invoke",{value:makeInvokeMethod(e,r,u)}),s}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=wrap;var l={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var c={};define(c,o,(function(){return this}));var h=Object.getPrototypeOf,f=h&&h(h(values([])));f&&f!==t&&r.call(f,o)&&(c=f);var d=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(n,i,o,s){var u=tryCatch(e[n],e,i);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){invoke("next",e,o,s)}),(function(e){invoke("throw",e,o,s)})):t.resolve(c).then((function(e){l.value=e,o(l)}),(function(e){return invoke("throw",e,o,s)}))}s(u.arg)}var i;n(this,"_invoke",{value:function(e,r){function callInvokeWithMethodAndArg(){return new t((function(t,n){invoke(e,r,t,n)}))}return i=i?i.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return doneResult()}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var u=maybeInvokeDelegate(s,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=tryCatch(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function maybeInvokeDelegate(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,maybeInvokeDelegate(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=tryCatch(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function pushTryEntry(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 resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function next(){for(;++n<e.length;)if(r.call(e,n))return next.value=e[n],next.done=!1,next;return next.value=void 0,next.done=!0,next};return i.next=i}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,n(d,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),n(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,u,"GeneratorFunction")),e.prototype=Object.create(d),e},e.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,s,(function(){return this})),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new AsyncIterator(wrap(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},defineIteratorMethods(d),define(d,u,"Generator"),define(d,o,(function(){return this})),define(d,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function handle(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(s)},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),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;resetTryEntry(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:values(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function _typeof(e){return _typeof="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},_typeof(e)}function _wrapAsyncGenerator(e){return function(){return new _AsyncGenerator(e.apply(this,arguments))}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,u=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return u}}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){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 _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){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 _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,F=function(){};return{s:F,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw i}}}}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}_AsyncGenerator.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},_AsyncGenerator.prototype.next=function(e){return this._invoke("next",e)},_AsyncGenerator.prototype.throw=function(e){return this._invoke("throw",e)},_AsyncGenerator.prototype.return=function(e){return this._invoke("return",e)};var n=require("webidl-conversions"),i=require("./utils.js"),o=i.implSymbol,s=i.ctorRegistrySymbol;function makeWrapper$1(e,t){var r;return void 0!==t&&(r=t.prototype),i.isObject(r)||(r=e[s].URL.prototype),Object.create(r)}e.is=function(e){return i.isObject(e)&&i.hasOwn(e,o)&&e[o]instanceof l.implementation},e.isImpl=function(e){return i.isObject(e)&&e instanceof l.implementation},e.convert=function(t,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).context,o=void 0===n?"The provided value":n;if(e.is(r))return i.implForWrapper(r);throw new t.TypeError("".concat(o," is not of type 'URL'."))},e.create=function(t,r,n){var i=makeWrapper$1(t);return e.setup(i,t,r,n)},e.createImpl=function(t,r,n){var o=e.create(t,r,n);return i.implForWrapper(o)},e._internalSetup=function(e,t){},e.setup=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s.wrapper=t,e._internalSetup(t,r),Object.defineProperty(t,o,{value:new l.implementation(r,n,s),configurable:!0}),t[o][i.wrapperSymbol]=t,l.init&&l.init(t[o]),t},e.new=function(t,r){var n=makeWrapper$1(t,r);return e._internalSetup(n,t),Object.defineProperty(n,o,{value:Object.create(l.implementation.prototype),configurable:!0}),n[o][i.wrapperSymbol]=n,l.init&&l.init(n[o]),n[o]};var u=new Set(["Window","Worker"]);e.install=function(t,r){if(r.some((function(e){return u.has(e)}))){var s=i.initCtorRegistry(t),l=function(){function URL(r){if(_classCallCheck(this,URL),arguments.length<1)throw new t.TypeError("Failed to construct 'URL': 1 argument required, but only ".concat(arguments.length," present."));var i=[],o=arguments[0];o=n.USVString(o,{context:"Failed to construct 'URL': parameter 1",globals:t}),i.push(o);var s=arguments[1];return void 0!==s&&(s=n.USVString(s,{context:"Failed to construct 'URL': parameter 2",globals:t})),i.push(s),e.setup(Object.create((this instanceof URL?this.constructor:void 0).prototype),t,i)}return _createClass(URL,[{key:"toJSON",value:function toJSON(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'toJSON' called on an object that is not a valid instance of URL.");return r[o].toJSON()}},{key:"href",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get href' called on an object that is not a valid instance of URL.");return r[o].href},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set href' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'href' property on 'URL': The provided value",globals:t}),i[o].href=r}},{key:"toString",value:function toString(){if(!e.is(this))throw new t.TypeError("'toString' called on an object that is not a valid instance of URL.");return this[o].href}},{key:"origin",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get origin' called on an object that is not a valid instance of URL.");return r[o].origin}},{key:"protocol",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get protocol' called on an object that is not a valid instance of URL.");return r[o].protocol},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set protocol' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'protocol' property on 'URL': The provided value",globals:t}),i[o].protocol=r}},{key:"username",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get username' called on an object that is not a valid instance of URL.");return r[o].username},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set username' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'username' property on 'URL': The provided value",globals:t}),i[o].username=r}},{key:"password",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get password' called on an object that is not a valid instance of URL.");return r[o].password},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set password' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'password' property on 'URL': The provided value",globals:t}),i[o].password=r}},{key:"host",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get host' called on an object that is not a valid instance of URL.");return r[o].host},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set host' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'host' property on 'URL': The provided value",globals:t}),i[o].host=r}},{key:"hostname",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get hostname' called on an object that is not a valid instance of URL.");return r[o].hostname},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set hostname' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'hostname' property on 'URL': The provided value",globals:t}),i[o].hostname=r}},{key:"port",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get port' called on an object that is not a valid instance of URL.");return r[o].port},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set port' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'port' property on 'URL': The provided value",globals:t}),i[o].port=r}},{key:"pathname",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get pathname' called on an object that is not a valid instance of URL.");return r[o].pathname},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set pathname' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'pathname' property on 'URL': The provided value",globals:t}),i[o].pathname=r}},{key:"search",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get search' called on an object that is not a valid instance of URL.");return r[o].search},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set search' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'search' property on 'URL': The provided value",globals:t}),i[o].search=r}},{key:"searchParams",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");return i.getSameObject(this,"searchParams",(function(){return i.tryWrapperForImpl(r[o].searchParams)}))}},{key:"hash",get:function get(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'get hash' called on an object that is not a valid instance of URL.");return r[o].hash},set:function set(r){var i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'set hash' called on an object that is not a valid instance of URL.");r=n.USVString(r,{context:"Failed to set the 'hash' property on 'URL': The provided value",globals:t}),i[o].hash=r}}]),URL}();Object.defineProperties(l.prototype,_defineProperty({toJSON:{enumerable:!0},href:{enumerable:!0},toString:{enumerable:!0},origin:{enumerable:!0},protocol:{enumerable:!0},username:{enumerable:!0},password:{enumerable:!0},host:{enumerable:!0},hostname:{enumerable:!0},port:{enumerable:!0},pathname:{enumerable:!0},search:{enumerable:!0},searchParams:{enumerable:!0},hash:{enumerable:!0}},Symbol.toStringTag,{value:"URL",configurable:!0})),s.URL=l,Object.defineProperty(t,"URL",{configurable:!0,writable:!0,value:l}),r.includes("Window")&&Object.defineProperty(t,"webkitURL",{configurable:!0,writable:!0,value:l})}};var l=require("./URL-impl.js"),c=getAugmentedNamespace(Object.freeze({__proto__:null})),h=require("webidl-conversions"),f=require("./utils.js"),d=require("./Function.js"),y=f.newObjectInRealm,m=f.implSymbol,v=f.ctorRegistrySymbol,b="URLSearchParams";function makeWrapper(e,t){var r;return void 0!==t&&(r=t.prototype),f.isObject(r)||(r=e[v].URLSearchParams.prototype),Object.create(r)}e.is=function(e){return f.isObject(e)&&f.hasOwn(e,m)&&e[m]instanceof S.implementation},e.isImpl=function(e){return f.isObject(e)&&e instanceof S.implementation},e.convert=function(t,r){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).context,i=void 0===n?"The provided value":n;if(e.is(r))return f.implForWrapper(r);throw new t.TypeError("".concat(i," is not of type 'URLSearchParams'."))},e.createDefaultIterator=function(e,t,r){var n=e[v]["URLSearchParams Iterator"],i=Object.create(n);return Object.defineProperty(i,f.iterInternalSymbol,{value:{target:t,kind:r,index:0},configurable:!0}),i},e.create=function(t,r,n){var i=makeWrapper(t);return e.setup(i,t,r,n)},e.createImpl=function(t,r,n){var i=e.create(t,r,n);return f.implForWrapper(i)},e._internalSetup=function(e,t){},e.setup=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return i.wrapper=t,e._internalSetup(t,r),Object.defineProperty(t,m,{value:new S.implementation(r,n,i),configurable:!0}),t[m][f.wrapperSymbol]=t,S.init&&S.init(t[m]),t},e.new=function(t,r){var n=makeWrapper(t,r);return e._internalSetup(n,t),Object.defineProperty(n,m,{value:Object.create(S.implementation.prototype),configurable:!0}),n[m][f.wrapperSymbol]=n,S.init&&S.init(n[m]),n[m]};var g=new Set(["Window","Worker"]);e.install=function(t,r){var n;if(r.some((function(e){return g.has(e)}))){var i=f.initCtorRegistry(t),o=function(){function URLSearchParams(){_classCallCheck(this,URLSearchParams);var r=[],n=arguments[0];if(void 0!==n)if(f.isObject(n))if(void 0!==n[Symbol.iterator]){if(!f.isObject(n))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");var i,o=[],s=_createForOfIteratorHelper(n);try{for(s.s();!(i=s.n()).done;){var u=i.value;if(!f.isObject(u))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object.");var l,c=[],d=_createForOfIteratorHelper(u);try{for(d.s();!(l=d.n()).done;){var y=l.value;y=h.USVString(y,{context:"Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",globals:t}),c.push(y)}}catch(e){d.e(e)}finally{d.f()}u=c,o.push(u)}}catch(e){s.e(e)}finally{s.f()}n=o}else{if(!f.isObject(n))throw new t.TypeError("Failed to construct 'URLSearchParams': parameter 1 record is not an object.");var m,v=Object.create(null),b=_createForOfIteratorHelper(Reflect.ownKeys(n));try{for(b.s();!(m=b.n()).done;){var g=m.value,S=Object.getOwnPropertyDescriptor(n,g);if(S&&S.enumerable){var w=g;w=h.USVString(w,{context:"Failed to construct 'URLSearchParams': parameter 1 record's key",globals:t});var P=n[g];P=h.USVString(P,{context:"Failed to construct 'URLSearchParams': parameter 1 record's value",globals:t}),v[w]=P}}}catch(e){b.e(e)}finally{b.f()}n=v}else n=h.USVString(n,{context:"Failed to construct 'URLSearchParams': parameter 1",globals:t});else n="";return r.push(n),e.setup(Object.create((this instanceof URLSearchParams?this.constructor:void 0).prototype),t,r)}return _createClass(URLSearchParams,[{key:"append",value:function append(r,n){var i,o=null!=this?this:t;if(!e.is(o))throw new t.TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new t.TypeError("Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ".concat(arguments.length," present."));var s=[],u=arguments[0];u=h.USVString(u,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 1",globals:t}),s.push(u);var l=arguments[1];return l=h.USVString(l,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 2",globals:t}),s.push(l),f.tryWrapperForImpl((i=o[m]).append.apply(i,s))}},{key:"delete",value:function _delete(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'delete' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),f.tryWrapperForImpl((n=i[m]).delete.apply(n,o))}},{key:"get",value:function get(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'get' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),(n=i[m]).get.apply(n,o)}},{key:"getAll",value:function getAll(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'getAll' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),f.tryWrapperForImpl((n=i[m]).getAll.apply(n,o))}},{key:"has",value:function has(r){var n,i=null!=this?this:t;if(!e.is(i))throw new t.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ".concat(arguments.length," present."));var o=[],s=arguments[0];return s=h.USVString(s,{context:"Failed to execute 'has' on 'URLSearchParams': parameter 1",globals:t}),o.push(s),(n=i[m]).has.apply(n,o)}},{key:"set",value:function set(r,n){var i,o=null!=this?this:t;if(!e.is(o))throw new t.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new t.TypeError("Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ".concat(arguments.length," present."));var s=[],u=arguments[0];u=h.USVString(u,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 1",globals:t}),s.push(u);var l=arguments[1];return l=h.USVString(l,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 2",globals:t}),s.push(l),f.tryWrapperForImpl((i=o[m]).set.apply(i,s))}},{key:"sort",value:function sort(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");return f.tryWrapperForImpl(r[m].sort())}},{key:"toString",value:function toString(){var r=null!=this?this:t;if(!e.is(r))throw new t.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");return r[m].toString()}},{key:"keys",value:function keys(){if(!e.is(this))throw new t.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"key")}},{key:"values",value:function values(){if(!e.is(this))throw new t.TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"value")}},{key:"entries",value:function entries(){if(!e.is(this))throw new t.TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");return e.createDefaultIterator(t,this,"key+value")}},{key:"forEach",value:function forEach(r){if(!e.is(this))throw new t.TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new t.TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.");r=d.convert(t,r,{context:"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"});for(var n=arguments[1],i=Array.from(this[m]),o=0;o<i.length;){var s=_slicedToArray(i[o].map(f.tryWrapperForImpl),2),u=s[0],l=s[1];r.call(n,l,u,this),i=Array.from(this[m]),o++}}}]),URLSearchParams}();Object.defineProperties(o.prototype,(_defineProperty(n={append:{enumerable:!0},delete:{enumerable:!0},get:{enumerable:!0},getAll:{enumerable:!0},has:{enumerable:!0},set:{enumerable:!0},sort:{enumerable:!0},toString:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0},forEach:{enumerable:!0}},Symbol.toStringTag,{value:"URLSearchParams",configurable:!0}),_defineProperty(n,Symbol.iterator,{value:o.prototype.entries,configurable:!0,writable:!0}),n)),i[b]=o,i["URLSearchParams Iterator"]=Object.create(i["%IteratorPrototype%"],_defineProperty({},Symbol.toStringTag,{configurable:!0,value:"URLSearchParams Iterator"})),f.define(i["URLSearchParams Iterator"],{next:function next(){var e=this&&this[f.iterInternalSymbol];if(!e)throw new t.TypeError("next() called on a value that is not a URLSearchParams iterator object");var r=e.target,n=e.kind,i=e.index,o=Array.from(r[m]);if(i>=o.length)return y(t,{value:void 0,done:!0});var s=o[i];return e.index=i+1,y(t,f.iteratorResult(s.map(f.tryWrapperForImpl),n))}}),Object.defineProperty(t,b,{configurable:!0,writable:!0,value:o})}};var S=require("./URLSearchParams-impl.js"),w=c,P=getAugmentedNamespace(Object.freeze({__proto__:null}));r.URL=w,r.URLSearchParams=P;var L=require("tr46"),U=require("./infra"),R=require("./encoding").utf8DecodeWithoutBOM,x=require("./percent-encoding"),E=x.percentDecodeString,O=x.utf8PercentEncodeCodePoint,I=x.utf8PercentEncodeString,j=x.isC0ControlPercentEncode,A=x.isFragmentPercentEncode,T=x.isQueryPercentEncode,_=x.isSpecialQueryPercentEncode,k=x.isPathPercentEncode,$=x.isUserinfoPercentEncode;function p$1(e){return e.codePointAt(0)}var C={ftp:21,file:null,http:80,https:443,ws:80,wss:443},D=Symbol("failure");function countSymbols(e){return _toConsumableArray(e).length}function at(e,t){var r=e[t];return isNaN(r)?void 0:String.fromCodePoint(r)}function isSingleDot(e){return"."===e||"%2e"===e.toLowerCase()}function isWindowsDriveLetterString(e){return 2===e.length&&U.isASCIIAlpha(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function containsForbiddenHostCodePoint(e){return-1!==e.search(/\0|\t|\n|\r| |#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/)}function isSpecialScheme(e){return void 0!==C[e]}function isSpecial(e){return isSpecialScheme(e.scheme)}function isNotSpecial(e){return!isSpecialScheme(e.scheme)}function defaultPort(e){return C[e]}function parseIPv4Number(e){if(""===e)return D;var t=10;if(e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e)return 0;var r=/(?:[\0-\/8-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;return 10===t&&(r=/(?:[\0-\/:-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/),16===t&&(r=/(?:[\0-\/:-@G-`g-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/),r.test(e)?D:parseInt(e,t)}function parseHost(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("["===e[0])return"]"!==e[e.length-1]?D:function parseIPv6(e){var t=[0,0,0,0,0,0,0,0],r=0,n=null,i=0;if((e=Array.from(e,(function(e){return e.codePointAt(0)})))[i]===p$1(":")){if(e[i+1]!==p$1(":"))return D;i+=2,n=++r}for(;i<e.length;){if(8===r)return D;if(e[i]!==p$1(":")){for(var o=0,s=0;s<4&&U.isASCIIHex(e[i]);)o=16*o+parseInt(at(e,i),16),++i,++s;if(e[i]===p$1(".")){if(0===s)return D;if(i-=s,r>6)return D;for(var u=0;void 0!==e[i];){var l=null;if(u>0){if(!(e[i]===p$1(".")&&u<4))return D;++i}if(!U.isASCIIDigit(e[i]))return D;for(;U.isASCIIDigit(e[i]);){var c=parseInt(at(e,i));if(null===l)l=c;else{if(0===l)return D;l=10*l+c}if(l>255)return D;++i}t[r]=256*t[r]+l,2!=++u&&4!==u||++r}if(4!==u)return D;break}if(e[i]===p$1(":")){if(void 0===e[++i])return D}else if(void 0!==e[i])return D;t[r]=o,++r}else{if(null!==n)return D;++i,n=++r}}if(null!==n){var h=r-n;for(r=7;0!==r&&h>0;){var f=t[n+h-1];t[n+h-1]=t[r],t[r]=f,--r,--h}}else if(null===n&&8!==r)return D;return t}(e.substring(1,e.length-1));if(t)return function parseOpaqueHost(e){if(containsForbiddenHostCodePoint(e))return D;return I(e,j)}(e);var r=function domainToASCII(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=L.toASCII(e,{checkBidi:!0,checkHyphens:!1,checkJoiners:!0,useSTD3ASCIIRules:t,verifyDNSLength:t});if(null===r||""===r)return D;return r}(R(E(e)));return r===D||function containsForbiddenDomainCodePoint(e){return containsForbiddenHostCodePoint(e)||-1!==e.search(/[\0-\x1F]|%|\x7F/)}(r)?D:function endsInANumber(e){var t=e.split(".");if(""===t[t.length-1]){if(1===t.length)return!1;t.pop()}var r=t[t.length-1];if(parseIPv4Number(r)!==D)return!0;if(/^[0-9]+$/.test(r))return!0;return!1}(r)?function parseIPv4(e){var t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return D;var r,n=[],i=_createForOfIteratorHelper(t);try{for(i.s();!(r=i.n()).done;){var o=parseIPv4Number(r.value);if(o===D)return D;n.push(o)}}catch(e){i.e(e)}finally{i.f()}for(var s=0;s<n.length-1;++s)if(n[s]>255)return D;if(n[n.length-1]>=Math.pow(256,5-n.length))return D;for(var u=n.pop(),l=0,c=0,h=n;c<h.length;c++)u+=h[c]*Math.pow(256,3-l),++l;return u}(r):r}function serializeHost(e){return"number"==typeof e?function serializeIPv4(e){for(var t="",r=e,n=1;n<=4;++n)t=String(r%256)+t,4!==n&&(t=".".concat(t)),r=Math.floor(r/256);return t}(e):e instanceof Array?"[".concat(function serializeIPv6(e){for(var t="",r=function findLongestZeroSequence(e){for(var t=null,r=1,n=null,i=0,o=0;o<e.length;++o)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),n=!1,i=0;i<=7;++i)n&&0===e[i]||(n&&(n=!1),r!==i?(t+=e[i].toString(16),7!==i&&(t+=":")):(t+=0===i?"::":":",n=!0));return t}(e),"]"):e}function shortenPath(e){var t=e.path;0!==t.length&&("file"===e.scheme&&1===t.length&&function isNormalizedWindowsDriveLetter(e){return/^[A-Za-z]:$/.test(e)}(t[0])||t.pop())}function includesCredentials(e){return""!==e.username||""!==e.password}function hasAnOpaquePath(e){return"string"==typeof e.path}function URLStateMachine(e,t,r,n,i){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=r||"utf-8",this.stateOverride=i,this.url=n,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null};var o=function trimControlChars(e){return e.replace(/^[\0- ]+|[\0- ]+$/g,"")}(this.input);o!==this.input&&(this.parseError=!0),this.input=o}var s=function trimTabAndNewline(e){return e.replace(/\t|\n|\r/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=Array.from(this.input,(function(e){return e.codePointAt(0)}));this.pointer<=this.input.length;++this.pointer){var u=this.input[this.pointer],l=isNaN(u)?void 0:String.fromCodePoint(u),c=this["parse ".concat(this.state)](u,l);if(!c)break;if(c===D){this.failure=!0;break}}}URLStateMachine.prototype["parse scheme start"]=function parseSchemeStart(e,t){if(U.isASCIIAlpha(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,D;this.state="no scheme",--this.pointer}return!0},URLStateMachine.prototype["parse scheme"]=function parseScheme(e,t){if(U.isASCIIAlphanumeric(e)||e===p$1("+")||e===p$1("-")||e===p$1("."))this.buffer+=t.toLowerCase();else if(e===p$1(":")){if(this.stateOverride){if(isSpecial(this.url)&&!isSpecialScheme(this.buffer))return!1;if(!isSpecial(this.url)&&isSpecialScheme(this.buffer))return!1;if((includesCredentials(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&""===this.url.host)return!1}if(this.url.scheme=this.buffer,this.stateOverride)return this.url.port===defaultPort(this.url.scheme)&&(this.url.port=null),!1;this.buffer="","file"===this.url.scheme?(this.input[this.pointer+1]===p$1("/")&&this.input[this.pointer+2]===p$1("/")||(this.parseError=!0),this.state="file"):isSpecial(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":isSpecial(this.url)?this.state="special authority slashes":this.input[this.pointer+1]===p$1("/")?(this.state="path or authority",++this.pointer):(this.url.path="",this.state="opaque path")}else{if(this.stateOverride)return this.parseError=!0,D;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},URLStateMachine.prototype["parse no scheme"]=function parseNoScheme(e){return null===this.base||hasAnOpaquePath(this.base)&&e!==p$1("#")?D:(hasAnOpaquePath(this.base)&&e===p$1("#")?(this.url.scheme=this.base.scheme,this.url.path=this.base.path,this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},URLStateMachine.prototype["parse special relative or authority"]=function parseSpecialRelativeOrAuthority(e){return e===p$1("/")&&this.input[this.pointer+1]===p$1("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},URLStateMachine.prototype["parse path or authority"]=function parsePathOrAuthority(e){return e===p$1("/")?this.state="authority":(this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse relative"]=function parseRelative(e){return this.url.scheme=this.base.scheme,e===p$1("/")?this.state="relative slash":isSpecial(this.url)&&e===p$1("\\")?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,this.url.path.pop(),this.state="path",--this.pointer)),!0},URLStateMachine.prototype["parse relative slash"]=function parseRelativeSlash(e){return!isSpecial(this.url)||e!==p$1("/")&&e!==p$1("\\")?e===p$1("/")?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(e===p$1("\\")&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},URLStateMachine.prototype["parse special authority slashes"]=function parseSpecialAuthoritySlashes(e){return e===p$1("/")&&this.input[this.pointer+1]===p$1("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},URLStateMachine.prototype["parse special authority ignore slashes"]=function parseSpecialAuthorityIgnoreSlashes(e){return e!==p$1("/")&&e!==p$1("\\")?(this.state="authority",--this.pointer):this.parseError=!0,!0},URLStateMachine.prototype["parse authority"]=function parseAuthority(e,t){if(e===p$1("@")){this.parseError=!0,this.atFlag&&(this.buffer="%40".concat(this.buffer)),this.atFlag=!0;for(var r=countSymbols(this.buffer),n=0;n<r;++n){var i=this.buffer.codePointAt(n);if(i!==p$1(":")||this.passwordTokenSeenFlag){var o=O(i,$);this.passwordTokenSeenFlag?this.url.password+=o:this.url.username+=o}else this.passwordTokenSeenFlag=!0}this.buffer=""}else if(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")){if(this.atFlag&&""===this.buffer)return this.parseError=!0,D;this.pointer-=countSymbols(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},URLStateMachine.prototype["parse hostname"]=URLStateMachine.prototype["parse host"]=function parseHostName(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(e!==p$1(":")||this.arrFlag)if(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")){if(--this.pointer,isSpecial(this.url)&&""===this.buffer)return this.parseError=!0,D;if(this.stateOverride&&""===this.buffer&&(includesCredentials(this.url)||null!==this.url.port))return this.parseError=!0,!1;var r=parseHost(this.buffer,isNotSpecial(this.url));if(r===D)return D;if(this.url.host=r,this.buffer="",this.state="path start",this.stateOverride)return!1}else e===p$1("[")?this.arrFlag=!0:e===p$1("]")&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,D;if("hostname"===this.stateOverride)return!1;var n=parseHost(this.buffer,isNotSpecial(this.url));if(n===D)return D;this.url.host=n,this.buffer="",this.state="port"}return!0},URLStateMachine.prototype["parse port"]=function parsePort(e,t){if(U.isASCIIDigit(e))this.buffer+=t;else{if(!(isNaN(e)||e===p$1("/")||e===p$1("?")||e===p$1("#")||isSpecial(this.url)&&e===p$1("\\")||this.stateOverride))return this.parseError=!0,D;if(""!==this.buffer){var r=parseInt(this.buffer);if(r>Math.pow(2,16)-1)return this.parseError=!0,D;this.url.port=r===defaultPort(this.url.scheme)?null:r,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}return!0};var N=new Set([p$1("/"),p$1("\\"),p$1("?"),p$1("#")]);function startsWithWindowsDriveLetter(e,t){var r=e.length-t;return r>=2&&function isWindowsDriveLetterCodePoints(e,t){return U.isASCIIAlpha(e)&&(t===p$1(":")||t===p$1("|"))}(e[t],e[t+1])&&(2===r||N.has(e[t+2]))}function serializePath(e){if(hasAnOpaquePath(e))return e.path;var t,r="",n=_createForOfIteratorHelper(e.path);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="/".concat(i)}}catch(e){n.e(e)}finally{n.f()}return r}URLStateMachine.prototype["parse file"]=function parseFile(e){return this.url.scheme="file",this.url.host="",e===p$1("/")||e===p$1("\\")?(e===p$1("\\")&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,startsWithWindowsDriveLetter(this.input,this.pointer)?(this.parseError=!0,this.url.path=[]):shortenPath(this.url),this.state="path",--this.pointer)):(this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse file slash"]=function parseFileSlash(e){return e===p$1("/")||e===p$1("\\")?(e===p$1("\\")&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(!startsWithWindowsDriveLetter(this.input,this.pointer)&&function isNormalizedWindowsDriveLetterString(e){return 2===e.length&&U.isASCIIAlpha(e.codePointAt(0))&&":"===e[1]}(this.base.path[0])&&this.url.path.push(this.base.path[0]),this.url.host=this.base.host),this.state="path",--this.pointer),!0},URLStateMachine.prototype["parse file host"]=function parseFileHost(e,t){if(isNaN(e)||e===p$1("/")||e===p$1("\\")||e===p$1("?")||e===p$1("#"))if(--this.pointer,!this.stateOverride&&isWindowsDriveLetterString(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{var r=parseHost(this.buffer,isNotSpecial(this.url));if(r===D)return D;if("localhost"===r&&(r=""),this.url.host=r,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},URLStateMachine.prototype["parse path start"]=function parsePathStart(e){return isSpecial(this.url)?(e===p$1("\\")&&(this.parseError=!0),this.state="path",e!==p$1("/")&&e!==p$1("\\")&&--this.pointer):this.stateOverride||e!==p$1("?")?this.stateOverride||e!==p$1("#")?void 0!==e?(this.state="path",e!==p$1("/")&&--this.pointer):this.stateOverride&&null===this.url.host&&this.url.path.push(""):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},URLStateMachine.prototype["parse path"]=function parsePath(e){return isNaN(e)||e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")||!this.stateOverride&&(e===p$1("?")||e===p$1("#"))?(isSpecial(this.url)&&e===p$1("\\")&&(this.parseError=!0),!function isDoubleDot(e){return".."===(e=e.toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e}(this.buffer)?!isSingleDot(this.buffer)||e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")?isSingleDot(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&isWindowsDriveLetterString(this.buffer)&&(this.buffer="".concat(this.buffer[0],":")),this.url.path.push(this.buffer)):this.url.path.push(""):(shortenPath(this.url),e===p$1("/")||isSpecial(this.url)&&e===p$1("\\")||this.url.path.push("")),this.buffer="",e===p$1("?")&&(this.url.query="",this.state="query"),e===p$1("#")&&(this.url.fragment="",this.state="fragment")):(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=O(e,k)),!0},URLStateMachine.prototype["parse opaque path"]=function parseOpaquePath(e){return e===p$1("?")?(this.url.query="",this.state="query"):e===p$1("#")?(this.url.fragment="",this.state="fragment"):(isNaN(e)||e===p$1("%")||(this.parseError=!0),e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path+=O(e,j))),!0},URLStateMachine.prototype["parse query"]=function parseQuery(e,t){if(isSpecial(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8"),!this.stateOverride&&e===p$1("#")||isNaN(e)){var r=isSpecial(this.url)?_:T;this.url.query+=I(this.buffer,r),this.buffer="",e===p$1("#")&&(this.url.fragment="",this.state="fragment")}else isNaN(e)||(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t);return!0},URLStateMachine.prototype["parse fragment"]=function parseFragment(e){return isNaN(e)||(e!==p$1("%")||U.isASCIIHex(this.input[this.pointer+1])&&U.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=O(e,A)),!0},module.exports.serializeURL=function serializeURL(e,t){var r="".concat(e.scheme,":");return null!==e.host&&(r+="//",""===e.username&&""===e.password||(r+=e.username,""!==e.password&&(r+=":".concat(e.password)),r+="@"),r+=serializeHost(e.host),null!==e.port&&(r+=":".concat(e.port))),null===e.host&&!hasAnOpaquePath(e)&&e.path.length>1&&""===e.path[0]&&(r+="/."),r+=serializePath(e),null!==e.query&&(r+="?".concat(e.query)),t||null===e.fragment||(r+="#".concat(e.fragment)),r},module.exports.serializePath=serializePath,module.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":try{return module.exports.serializeURLOrigin(module.exports.parseURL(serializePath(e)))}catch(e){return"null"}case"ftp":case"http":case"https":case"ws":case"wss":return function serializeOrigin(e){var t="".concat(e.scheme,"://");return t+=serializeHost(e.host),null!==e.port&&(t+=":".concat(e.port)),t}({scheme:e.scheme,host:e.host,port:e.port});default:return"null"}},module.exports.basicURLParse=function(e,t){void 0===t&&(t={});var r=new URLStateMachine(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return r.failure?null:r.url},module.exports.setTheUsername=function(e,t){e.username=I(t,$)},module.exports.setThePassword=function(e,t){e.password=I(t,$)},module.exports.serializeHost=serializeHost,module.exports.cannotHaveAUsernamePasswordPort=function cannotHaveAUsernamePasswordPort(e){return null===e.host||""===e.host||"file"===e.scheme},module.exports.hasAnOpaquePath=hasAnOpaquePath,module.exports.serializeInteger=function(e){return String(e)},module.exports.parseURL=function(e,t){return void 0===t&&(t={}),module.exports.basicURLParse(e,{baseURL:t.baseURL,encodingOverride:t.encodingOverride})};var q=getAugmentedNamespace(Object.freeze({__proto__:null})),W=require("./infra").isASCIIHex,M=require("./encoding").utf8Encode;function p(e){return e.codePointAt(0)}function percentDecodeBytes(e){for(var t=new Uint8Array(e.byteLength),r=0,n=0;n<e.byteLength;++n){var i=e[n];if(37!==i)t[r++]=i;else if(37!==i||W(e[n+1])&&W(e[n+2])){var o=parseInt(String.fromCodePoint(e[n+1],e[n+2]),16);t[r++]=o,n+=2}else t[r++]=i}return t.slice(0,r)}function isC0ControlPercentEncode(e){return e<=31||e>126}var H=new Set([p(" "),p('"'),p("<"),p(">"),p("`")]);var z=new Set([p(" "),p('"'),p("#"),p("<"),p(">")]);function isQueryPercentEncode(e){return isC0ControlPercentEncode(e)||z.has(e)}var G=new Set([p("?"),p("`"),p("{"),p("}")]);function isPathPercentEncode(e){return isQueryPercentEncode(e)||G.has(e)}var V=new Set([p("/"),p(":"),p(";"),p("="),p("@"),p("["),p("\\"),p("]"),p("^"),p("|")]);function isUserinfoPercentEncode(e){return isPathPercentEncode(e)||V.has(e)}var B=new Set([p("$"),p("%"),p("&"),p("+"),p(",")]);var Q=new Set([p("!"),p("'"),p("("),p(")"),p("~")]);function utf8PercentEncodeCodePointInternal(e,t){var r,n,i="",o=_createForOfIteratorHelper(M(e));try{for(o.s();!(r=o.n()).done;){var s=r.value;t(s)?i+=(n=void 0,1===(n=s.toString(16).toUpperCase()).length&&(n="0".concat(n)),"%".concat(n)):i+=String.fromCharCode(s)}}catch(e){o.e(e)}finally{o.f()}return i}module.exports={isC0ControlPercentEncode:isC0ControlPercentEncode,isFragmentPercentEncode:function isFragmentPercentEncode(e){return isC0ControlPercentEncode(e)||H.has(e)},isQueryPercentEncode:isQueryPercentEncode,isSpecialQueryPercentEncode:function isSpecialQueryPercentEncode(e){return isQueryPercentEncode(e)||e===p("'")},isPathPercentEncode:isPathPercentEncode,isUserinfoPercentEncode:isUserinfoPercentEncode,isURLEncodedPercentEncode:function isURLEncodedPercentEncode(e){return function isComponentPercentEncode(e){return isUserinfoPercentEncode(e)||B.has(e)}(e)||Q.has(e)},percentDecodeString:function percentDecodeString(e){return percentDecodeBytes(M(e))},percentDecodeBytes:percentDecodeBytes,utf8PercentEncodeString:function utf8PercentEncodeString(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i="",o=_createForOfIteratorHelper(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;i+=n&&" "===s?"+":utf8PercentEncodeCodePointInternal(s,t)}}catch(e){o.e(e)}finally{o.f()}return i},utf8PercentEncodeCodePoint:function utf8PercentEncodeCodePoint(e,t){return utf8PercentEncodeCodePointInternal(String.fromCodePoint(e),t)}};var J=getAugmentedNamespace(Object.freeze({__proto__:null})),K=r,Y=K.URL,X=K.URLSearchParams,Z=q,ee=J,te={Array:Array,Object:Object,Promise:Promise,String:String,TypeError:TypeError};Y.install(te,["Window"]),X.install(te,["Window"]),t.URL=te.URL,t.URLSearchParams=te.URLSearchParams,t.parseURL=Z.parseURL,t.basicURLParse=Z.basicURLParse,t.serializeURL=Z.serializeURL,t.serializePath=Z.serializePath,t.serializeHost=Z.serializeHost,t.serializeInteger=Z.serializeInteger,t.serializeURLOrigin=Z.serializeURLOrigin,t.setTheUsername=Z.setTheUsername,t.setThePassword=Z.setThePassword,t.cannotHaveAUsernamePasswordPort=Z.cannotHaveAUsernamePasswordPort,t.hasAnOpaquePath=Z.hasAnOpaquePath,t.percentDecodeString=ee.percentDecodeString,t.percentDecodeBytes=ee.percentDecodeBytes;var re=Function.prototype.call.bind(Object.prototype.hasOwnProperty);var ne=Symbol("wrapper"),ie=Symbol("impl"),ae=Symbol("SameObject caches"),oe=Symbol.for("[webidl2js] constructor registry"),se=Object.getPrototypeOf(Object.getPrototypeOf(_wrapAsyncGenerator(_regeneratorRuntime().mark((function _callee(){return _regeneratorRuntime().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),_callee)})))).prototype);function initCtorRegistry(e){if(re(e,oe))return e[oe];var t=Object.create(null);t["%Object.prototype%"]=e.Object.prototype,t["%IteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf((new e.Array)[Symbol.iterator]()));try{t["%AsyncIteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf(e.eval("(async function* () {})").prototype))}catch(e){t["%AsyncIteratorPrototype%"]=se}return e[oe]=t,t}function wrapperForImpl(e){return e?e[ne]:null}function implForWrapper$1(e){return e?e[ie]:null}var ue=Symbol("internal");var le=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get;var ce=Symbol("supports property index"),he=Symbol("supported property indices"),pe=Symbol("supports property name"),fe=Symbol("supported property names"),de=Symbol("indexed property get"),ye=Symbol("indexed property set new"),me=Symbol("indexed property set existing"),ve=Symbol("named property get"),be=Symbol("named property set new"),ge=Symbol("named property set existing"),Se=Symbol("named property delete"),we=Symbol("async iterator get the next iteration result"),Pe=Symbol("async iterator return steps"),Le=Symbol("async iterator initialization steps"),Ue=Symbol("async iterator end of iteration");module.exports=e={isObject:function isObject(e){return"object"===_typeof(e)&&null!==e||"function"==typeof e},hasOwn:re,define:function define(e,t){var r,n=_createForOfIteratorHelper(Reflect.ownKeys(t));try{for(n.s();!(r=n.n()).done;){var i=r.value,o=Reflect.getOwnPropertyDescriptor(t,i);if(o&&!Reflect.defineProperty(e,i,o))throw new TypeError("Cannot redefine property: ".concat(String(i)))}}catch(e){n.e(e)}finally{n.f()}},newObjectInRealm:function newObjectInRealm(e,t){var r=initCtorRegistry(e);return Object.defineProperties(Object.create(r["%Object.prototype%"]),Object.getOwnPropertyDescriptors(t))},wrapperSymbol:ne,implSymbol:ie,getSameObject:function getSameObject(e,t,r){return e[ae]||(e[ae]=Object.create(null)),t in e[ae]||(e[ae][t]=r()),e[ae][t]},ctorRegistrySymbol:oe,initCtorRegistry:initCtorRegistry,wrapperForImpl:wrapperForImpl,implForWrapper:implForWrapper$1,tryWrapperForImpl:function tryWrapperForImpl(e){var t=wrapperForImpl(e);return t||e},tryImplForWrapper:function tryImplForWrapper(e){var t=implForWrapper$1(e);return t||e},iterInternalSymbol:ue,isArrayBuffer:function isArrayBuffer(e){try{return le.call(e),!0}catch(e){return!1}},isArrayIndexPropName:function isArrayIndexPropName(e){if("string"!=typeof e)return!1;var t=e>>>0;return t!==Math.pow(2,32)-1&&e==="".concat(t)},supportsPropertyIndex:ce,supportedPropertyIndices:he,supportsPropertyName:pe,supportedPropertyNames:fe,indexedGet:de,indexedSetNew:ye,indexedSetExisting:me,namedGet:ve,namedSetNew:be,namedSetExisting:ge,namedDelete:Se,asyncIteratorNext:we,asyncIteratorReturn:Pe,asyncIteratorInit:Le,asyncIteratorEOI:Ue,iteratorResult:function iteratorResult(e,t){var r,n=_slicedToArray(e,2),i=n[0],o=n[1];switch(t){case"key":r=i;break;case"value":r=o;break;case"key+value":r=[i,o]}return{value:r,done:!1}}};var Re=t.serializeURLOrigin,xe=t.parseURL,Fe={},Ee=(void 0).implForWrapper;e.createObjectURL=function createObjectURL(e){var t=xe(location.href),r="blob:"+(t?Re(t):"null")+"/"+function generateUUID(){var e=Date.now()+("undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():0);return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=Math.trunc((e+16*Math.random())%16);return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}();return Fe[r]=e,r},e.revokeObjectURL=function revokeObjectURL(e){delete Fe[e]},e.xmlHttpRequestOverrideMimeType=function xmlHttpRequestOverrideMimeType(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).polyfillDataURLs,t=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.overrideMimeType;return function(n){"text/plain; charset=x-user-defined"===n&&(this.open=function(r,n,i){if(n.startsWith("blob:")){var o=Fe[n];if(!o)return void(this.send=function(){throw new DOMException("Failed to execute 'send' on 'XMLHttpRequest': Failed to "+"load '".concat(n,"'"),"NetworkError")});var s="text/plain",u=Ee(o)._buffer.toString("binary");if(e)return this.status=200,this.send=function(){},this.responseType=s,void(this.responseText=u);n="data:"+s+","+encodeURIComponent(u)}return t.call(this,r,n,i)});for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return r&&r.call.apply(r,[this,n].concat(o))}}}));
//# sourceMappingURL=createObjectURL.umd.js.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc