text: !function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((t="undefined"!=typeof globalThis?globalThis:t||self).ClassTransformer={})}(this,(function(t){"use strict";var o;t.TransformationType=void 0,(o=t.TransformationType||(t.TransformationType={}))[o.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",o[o.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",o[o.CLASS_TO_CLASS=2]="CLASS_TO_CLASS";var e=new(function(){function o(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return o.prototype.addTypeMetadata=function(t){this._typeMetadatas.has(t.target)||this._typeMetadatas.set(t.target,new Map),this._typeMetadatas.get(t.target).set(t.propertyName,t)},o.prototype.addTransformMetadata=function(t){this._transformMetadatas.has(t.target)||this._transformMetadatas.set(t.target,new Map),this._transformMetadatas.get(t.target).has(t.propertyName)||this._transformMetadatas.get(t.target).set(t.propertyName,[]),this._transformMetadatas.get(t.target).get(t.propertyName).push(t)},o.prototype.addExposeMetadata=function(t){this._exposeMetadatas.has(t.target)||this._exposeMetadatas.set(t.target,new Map),this._exposeMetadatas.get(t.target).set(t.propertyName,t)},o.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.has(t.target)||this._excludeMetadatas.set(t.target,new Map),this._excludeMetadatas.get(t.target).set(t.propertyName,t)},o.prototype.findTransformMetadatas=function(o,e,n){return this.findMetadatas(this._transformMetadatas,o,e).filter((function(o){return!o.options||(!0===o.options.toClassOnly&&!0===o.options.toPlainOnly||(!0===o.options.toClassOnly?n===t.TransformationType.CLASS_TO_CLASS||n===t.TransformationType.PLAIN_TO_CLASS:!0!==o.options.toPlainOnly||n===t.TransformationType.CLASS_TO_PLAIN))}))},o.prototype.findExcludeMetadata=function(t,o){return this.findMetadata(this._excludeMetadatas,t,o)},o.prototype.findExposeMetadata=function(t,o){return this.findMetadata(this._exposeMetadatas,t,o)},o.prototype.findExposeMetadataByCustomName=function(t,o){return this.getExposedMetadatas(t).find((function(t){return t.options&&t.options.name===o}))},o.prototype.findTypeMetadata=function(t,o){return this.findMetadata(this._typeMetadatas,t,o)},o.prototype.getStrategy=function(t){var o=this._excludeMetadatas.get(t),e=o&&o.get(void 0),n=this._exposeMetadatas.get(t),r=n&&n.get(void 0);return e&&r||!e&&!r?"none":e?"excludeAll":"exposeAll"},o.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},o.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},o.prototype.getExposedProperties=function(o,e){return this.getExposedMetadatas(o).filter((function(o){return!o.options||(!0===o.options.toClassOnly&&!0===o.options.toPlainOnly||(!0===o.options.toClassOnly?e===t.TransformationType.CLASS_TO_CLASS||e===t.TransformationType.PLAIN_TO_CLASS:!0!==o.options.toPlainOnly||e===t.TransformationType.CLASS_TO_PLAIN))})).map((function(t){return t.propertyName}))},o.prototype.getExcludedProperties=function(o,e){return this.getExcludedMetadatas(o).filter((function(o){return!o.options||(!0===o.options.toClassOnly&&!0===o.options.toPlainOnly||(!0===o.options.toClassOnly?e===t.TransformationType.CLASS_TO_CLASS||e===t.TransformationType.PLAIN_TO_CLASS:!0!==o.options.toPlainOnly||e===t.TransformationType.CLASS_TO_PLAIN))})).map((function(t){return t.propertyName}))},o.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},o.prototype.getMetadata=function(t,o){var e,n=t.get(o);n&&(e=Array.from(n.values()).filter((function(t){return void 0!==t.propertyName})));for(var r=[],a=0,i=this.getAncestors(o);a<i.length;a++){var s=i[a],p=t.get(s);if(p){var f=Array.from(p.values()).filter((function(t){return void 0!==t.propertyName}));r.push.apply(r,f)}}return r.concat(e||[])},o.prototype.findMetadata=function(t,o,e){var n=t.get(o);if(n){var r=n.get(e);if(r)return r}for(var a=0,i=this.getAncestors(o);a<i.length;a++){var s=i[a],p=t.get(s);if(p){var f=p.get(e);if(f)return f}}},o.prototype.findMetadatas=function(t,o,e){var n,r=t.get(o);r&&(n=r.get(e));for(var a=[],i=0,s=this.getAncestors(o);i<s.length;i++){var p=s[i],f=t.get(p);f&&f.has(e)&&a.push.apply(a,f.get(e))}return a.slice().reverse().concat((n||[]).slice().reverse())},o.prototype.getAncestors=function(t){if(!t)return[];if(!this._ancestorsMap.has(t)){for(var o=[],e=Object.getPrototypeOf(t.prototype.constructor);void 0!==e.prototype;e=Object.getPrototypeOf(e.prototype.constructor))o.push(e);this._ancestorsMap.set(t,o)}return this._ancestorsMap.get(t)},o}());var n=function(){function o(t,o){this.transformationType=t,this.options=o,this.recursionStack=new Set}return o.prototype.transform=function(o,n,r,a,i,s){var p,f=this;if(void 0===s&&(s=0),Array.isArray(n)||n instanceof Set){var u=a&&this.transformationType===t.TransformationType.PLAIN_TO_CLASS?function(t){var o=new t;return o instanceof Set||"push"in o?o:[]}(a):[];return n.forEach((function(e,n){var a=o?o[n]:void 0;if(f.options.enableCircularCheck&&f.isCircular(e))f.transformationType===t.TransformationType.CLASS_TO_CLASS&&(u instanceof Set?u.add(e):u.push(e));else{var i=void 0;if("function"!=typeof r&&r&&r.options&&r.options.discriminator&&r.options.discriminator.property&&r.options.discriminator.subTypes){if(f.transformationType===t.TransformationType.PLAIN_TO_CLASS){i=r.options.discriminator.subTypes.find((function(t){return t.name===e[r.options.discriminator.property]}));var p={newObject:u,object:e,property:void 0},c=r.typeFunction(p);i=void 0===i?c:i.value,r.options.keepDiscriminatorProperty||delete e[r.options.discriminator.property]}f.transformationType===t.TransformationType.CLASS_TO_CLASS&&(i=e.constructor),f.transformationType===t.TransformationType.CLASS_TO_PLAIN&&(e[r.options.discriminator.property]=r.options.discriminator.subTypes.find((function(t){return t.value===e.constructor})).name)}else i=r;var l=f.transform(a,e,i,void 0,e instanceof Map,s+1);u instanceof Set?u.add(l):u.push(l)}})),u}if(r!==String||i){if(r!==Number||i){if(r!==Boolean||i){if((r===Date||n instanceof Date)&&!i)return n instanceof Date?new Date(n.valueOf()):null==n?n:new Date(n);if(("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0).Buffer&&(r===Buffer||n instanceof Buffer)&&!i)return null==n?n:Buffer.from(n);if(null===(p=n)||"object"!=typeof p||"function"!=typeof p.then||i){if(i||null===n||"object"!=typeof n||"function"!=typeof n.then){if("object"==typeof n&&null!==n){r||n.constructor===Object||(r=n.constructor),!r&&o&&(r=o.constructor),this.options.enableCircularCheck&&this.recursionStack.add(n);var c=this.getKeys(r,n,i),l=o||{};o||this.transformationType!==t.TransformationType.PLAIN_TO_CLASS&&this.transformationType!==t.TransformationType.CLASS_TO_CLASS||(l=i?new Map:r?new r:{});for(var d=function(a){if("__proto__"===a||"constructor"===a)return"continue";var p=a,f=a,u=a;if(!y.options.ignoreDecorators&&r)if(y.transformationType===t.TransformationType.PLAIN_TO_CLASS)(c=e.findExposeMetadataByCustomName(r,a))&&(u=c.propertyName,f=c.propertyName);else if(y.transformationType===t.TransformationType.CLASS_TO_PLAIN||y.transformationType===t.TransformationType.CLASS_TO_CLASS){var c;(c=e.findExposeMetadata(r,a))&&c.options&&c.options.name&&(f=c.options.name)}var d=void 0;d=n instanceof Map?n.get(p):n[p]instanceof Function?n[p]():n[p];var T=void 0,m=d instanceof Map;if(r&&i)T=r;else if(r){var v=e.findTypeMetadata(r,u);if(v){var h={newObject:l,object:n,property:u},S=v.typeFunction?v.typeFunction(h):v.reflectedType;v.options&&v.options.discriminator&&v.options.discriminator.property&&v.options.discriminator.subTypes?n[p]instanceof Array?T=v:(y.transformationType===t.TransformationType.PLAIN_TO_CLASS&&(T=void 0===(T=v.options.discriminator.subTypes.find((function(t){if(d&&d instanceof Object&&v.options.discriminator.property in d)return t.name===d[v.options.discriminator.property]})))?S:T.value,v.options.keepDiscriminatorProperty||d&&d instanceof Object&&v.options.discriminator.property in d&&delete d[v.options.discriminator.property]),y.transformationType===t.TransformationType.CLASS_TO_CLASS&&(T=d.constructor),y.transformationType===t.TransformationType.CLASS_TO_PLAIN&&(d[v.options.discriminator.property]=v.options.discriminator.subTypes.find((function(t){return t.value===d.constructor})).name)):T=S,m=m||v.reflectedType===Map}else if(y.options.targetMaps)y.options.targetMaps.filter((function(t){return t.target===r&&!!t.properties[u]})).forEach((function(t){return T=t.properties[u]}));else if(y.options.enableImplicitConversion&&y.transformationType===t.TransformationType.PLAIN_TO_CLASS){var _=Reflect.getMetadata("design:type",r.prototype,u);_&&(T=_)}}var g=Array.isArray(n[p])?y.getReflectedType(r,u):void 0,C=o?o[p]:void 0;if(l.constructor.prototype){var A=Object.getOwnPropertyDescriptor(l.constructor.prototype,f);if((y.transformationType===t.TransformationType.PLAIN_TO_CLASS||y.transformationType===t.TransformationType.CLASS_TO_CLASS)&&(A&&!A.set||l[f]instanceof Function))return"continue"}if(y.options.enableCircularCheck&&y.isCircular(d)){if(y.transformationType===t.TransformationType.CLASS_TO_CLASS){L=d;(void 0!==(L=y.applyCustomTransformations(L,r,a,n,y.transformationType))||y.options.exposeUnsetFields)&&(l instanceof Map?l.set(f,L):l[f]=L)}}else{var M=y.transformationType===t.TransformationType.PLAIN_TO_CLASS?f:a,L=void 0;y.transformationType===t.TransformationType.CLASS_TO_PLAIN?(L=n[M],L=y.applyCustomTransformations(L,r,M,n,y.transformationType),L=n[M]===L?d:L,L=y.transform(C,L,T,g,m,s+1)):void 0===d&&y.options.exposeDefaultValues?L=l[f]:(L=y.transform(C,d,T,g,m,s+1),L=y.applyCustomTransformations(L,r,M,n,y.transformationType)),(void 0!==L||y.options.exposeUnsetFields)&&(l instanceof Map?l.set(f,L):l[f]=L)}},y=this,T=0,m=c;T<m.length;T++){d(m[T])}return this.options.enableCircularCheck&&this.recursionStack.delete(n),l}return n}return n}return new Promise((function(t,o){n.then((function(o){return t(f.transform(void 0,o,r,void 0,void 0,s+1))}),o)}))}return null==n?n:Boolean(n)}return null==n?n:Number(n)}return null==n?n:String(n)},o.prototype.applyCustomTransformations=function(t,o,n,r,a){var i=this,s=e.findTransformMetadatas(o,n,this.transformationType);return void 0!==this.options.version&&(s=s.filter((function(t){return!t.options||i.checkVersion(t.options.since,t.options.until)}))),(s=this.options.groups&&this.options.groups.length?s.filter((function(t){return!t.options||i.checkGroups(t.options.groups)})):s.filter((function(t){return!t.options||!t.options.groups||!t.options.groups.length}))).forEach((function(o){t=o.transformFn({value:t,key:n,obj:r,type:a,options:i.options})})),t},o.prototype.isCircular=function(t){return this.recursionStack.has(t)},o.prototype.getReflectedType=function(t,o){if(t){var n=e.findTypeMetadata(t,o);return n?n.reflectedType:void 0}},o.prototype.getKeys=function(o,n,r){var a=this,i=e.getStrategy(o);"none"===i&&(i=this.options.strategy||"exposeAll");var s=[];if(("exposeAll"===i||r)&&(s=n instanceof Map?Array.from(n.keys()):Object.keys(n)),r)return s;if(!this.options.ignoreDecorators&&o){var p=e.getExposedProperties(o,this.transformationType);this.transformationType===t.TransformationType.PLAIN_TO_CLASS&&(p=p.map((function(t){var n=e.findExposeMetadata(o,t);return n&&n.options&&n.options.name?n.options.name:t}))),s=this.options.excludeExtraneousValues?p:s.concat(p);var f=e.getExcludedProperties(o,this.transformationType);f.length>0&&(s=s.filter((function(t){return!f.includes(t)}))),void 0!==this.options.version&&(s=s.filter((function(t){var n=e.findExposeMetadata(o,t);return!n||!n.options||a.checkVersion(n.options.since,n.options.until)}))),s=this.options.groups&&this.options.groups.length?s.filter((function(t){var n=e.findExposeMetadata(o,t);return!n||!n.options||a.checkGroups(n.options.groups)})):s.filter((function(t){var n=e.findExposeMetadata(o,t);return!(n&&n.options&&n.options.groups&&n.options.groups.length)}))}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(s=s.filter((function(t){return a.options.excludePrefixes.every((function(o){return t.substr(0,o.length)!==o}))}))),s=s.filter((function(t,o,e){return e.indexOf(t)===o}))},o.prototype.checkVersion=function(t,o){var e=!0;return e&&t&&(e=this.options.version>=t),e&&o&&(e=this.options.version<o),e},o.prototype.checkGroups=function(t){return!t||this.options.groups.some((function(o){return t.includes(o)}))},o}(),r={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},a=function(){return(a=Object.assign||function(t){for(var o,e=1,n=arguments.length;e<n;e++)for(var r in o=arguments[e])Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r]);return t}).apply(this,arguments)},i=function(){function o(){}return o.prototype.classToPlain=function(o,e){return new n(t.TransformationType.CLASS_TO_PLAIN,a(a({},r),e)).transform(void 0,o,void 0,void 0,void 0,void 0)},o.prototype.classToPlainFromExist=function(o,e,i){return new n(t.TransformationType.CLASS_TO_PLAIN,a(a({},r),i)).transform(e,o,void 0,void 0,void 0,void 0)},o.prototype.plainToClass=function(o,e,i){return new n(t.TransformationType.PLAIN_TO_CLASS,a(a({},r),i)).transform(void 0,e,o,void 0,void 0,void 0)},o.prototype.plainToClassFromExist=function(o,e,i){return new n(t.TransformationType.PLAIN_TO_CLASS,a(a({},r),i)).transform(o,e,void 0,void 0,void 0,void 0)},o.prototype.classToClass=function(o,e){return new n(t.TransformationType.CLASS_TO_CLASS,a(a({},r),e)).transform(void 0,o,void 0,void 0,void 0,void 0)},o.prototype.classToClassFromExist=function(o,e,i){return new n(t.TransformationType.CLASS_TO_CLASS,a(a({},r),i)).transform(e,o,void 0,void 0,void 0,void 0)},o.prototype.serialize=function(t,o){return JSON.stringify(this.classToPlain(t,o))},o.prototype.deserialize=function(t,o,e){var n=JSON.parse(o);return this.plainToClass(t,n,e)},o.prototype.deserializeArray=function(t,o,e){var n=JSON.parse(o);return this.plainToClass(t,n,e)},o}();var s=new i;t.ClassTransformer=i,t.Exclude=function(t){return void 0===t&&(t={}),function(o,n){e.addExcludeMetadata({target:o instanceof Function?o:o.constructor,propertyName:n,options:t})}},t.Expose=function(t){return void 0===t&&(t={}),function(o,n){e.addExposeMetadata({target:o instanceof Function?o:o.constructor,propertyName:n,options:t})}},t.Transform=function(t,o){return void 0===o&&(o={}),function(n,r){e.addTransformMetadata({target:n.constructor,propertyName:r,transformFn:t,options:o})}},t.TransformClassToClass=function(t){return function(o,e,n){var r=new i,a=n.value;n.value=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];var n=a.apply(this,o),i=!!n&&("object"==typeof n||"function"==typeof n)&&"function"==typeof n.then;return i?n.then((function(o){return r.classToClass(o,t)})):r.classToClass(n,t)}}},t.TransformClassToPlain=function(t){return function(o,e,n){var r=new i,a=n.value;n.value=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];var n=a.apply(this,o),i=!!n&&("object"==typeof n||"function"==typeof n)&&"function"==typeof n.then;return i?n.then((function(o){return r.classToPlain(o,t)})):r.classToPlain(n,t)}}},t.TransformPlainToClass=function(t,o){return function(e,n,r){var a=new i,s=r.value;r.value=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=s.apply(this,e),i=!!r&&("object"==typeof r||"function"==typeof r)&&"function"==typeof r.then;return i?r.then((function(e){return a.plainToClass(t,e,o)})):a.plainToClass(t,r,o)}}},t.Type=function(t,o){return void 0===o&&(o={}),function(n,r){var a=Reflect.getMetadata("design:type",n,r);e.addTypeMetadata({target:n.constructor,propertyName:r,reflectedType:a,typeFunction:t,options:o})}},t.classToClass=function(t,o){return s.classToClass(t,o)},t.classToClassFromExist=function(t,o,e){return s.classToClassFromExist(t,o,e)},t.classToPlain=function(t,o){return s.classToPlain(t,o)},t.classToPlainFromExist=function(t,o,e){return s.classToPlainFromExist(t,o,e)},t.deserialize=function(t,o,e){return s.deserialize(t,o,e)},t.deserializeArray=function(t,o,e){return s.deserializeArray(t,o,e)},t.plainToClass=function(t,o,e){return s.plainToClass(t,o,e)},t.plainToClassFromExist=function(t,o,e){return s.plainToClassFromExist(t,o,e)},t.serialize=function(t,o){return s.serialize(t,o)},Object.defineProperty(t,"__esModule",{value:!0})}));
  //# sourceMappingURL=class-transformer.umd.min.js.map
  