@tonysamperi/ts-mapi-core 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/rxjs.cjs +1 -1
- package/dist/cjs/rxjs.cjs.map +1 -1
- package/dist/cjs/rxjs.d.cts +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/rxjs.d.ts +2 -2
- package/dist/esm/rxjs.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var gt=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var hr=Object.prototype.hasOwnProperty;var c=(i,t)=>gt(i,"name",{value:t,configurable:!0});var cr=(i,t)=>{for(var e in t)gt(i,e,{get:t[e],enumerable:!0})},ar=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of nr(t))!hr.call(i,s)&&s!==e&>(i,s,{get:()=>t[s],enumerable:!(r=or(t,s))||r.enumerable});return i};var lr=i=>ar(gt({},"__esModule",{value:!0}),i);var qr={};cr(qr,{SMP_HEALTHZ:()=>pr,SmpAbstractCacheStrategy:()=>lt,SmpAbstractTtlCacheStrategy:()=>G,SmpAesCrypt:()=>it,SmpApiCommonUtils:()=>Ut,SmpBaseJwtToken:()=>$t,SmpBaseJwtTokenPlain:()=>Wt,SmpBrowserCache:()=>ft,SmpCommonUtils:()=>St,SmpCrypto:()=>Nt,SmpErrorResponse:()=>F,SmpFilterException:()=>te,SmpFirebaseErrors:()=>mr,SmpGenericResponse:()=>Q,SmpGiftcardTransaction:()=>Dt,SmpGiftcardTransactionHashStrategies:()=>H,SmpGiftcardTransactionOps:()=>O,SmpHttpService:()=>Lt,SmpHttpSessionStorageCache:()=>dt,SmpHttpStatusCodes:()=>zt,SmpInMemoryCache:()=>pt,SmpMarketingCloudValidators:()=>xr,SmpRegularExpressions:()=>se,SmpResponseMessage:()=>C,SmpResponseMessageTypes:()=>U,SmpRestVerbs:()=>jt,SmpSecureCode:()=>Pt,SmpSid:()=>re,SmpSocialSignInKeys:()=>ur,SmpSocialSignInUxModes:()=>wr,VERSION:()=>Vr,smpApplyMixin:()=>Er,smpIsSmpCachedValue:()=>Mt,smpNoop:()=>Je.smpNoop});module.exports=lr(qr);var at=require("class-transformer");var j=require("class-transformer");var Ft=require("class-transformer");var U=(function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i})({});function fe(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(fe,"_ts_decorate");function mt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(mt,"_ts_metadata");var C=class i{static{c(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(t,e=U.ERROR){this._message=t,this._type=e}static sanitizeMessages(t){return typeof t=="string"?t.length?[new i(t)]:[]:[t].flat().map(e=>typeof e=="string"?new i(e):e)}};fe([(0,Ft.Expose)(),mt("design:type",String),mt("design:paramtypes",[])],C.prototype,"message",null);fe([(0,Ft.Expose)(),mt("design:type",typeof U>"u"?Object:U),mt("design:paramtypes",[])],C.prototype,"type",null);function fr(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(fr,"_ts_decorate");function de(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(de,"_ts_metadata");var Q=class i{static{c(this,"SmpGenericResponse")}_messages;data;set messages(t){this._messages=C.sanitizeMessages(t)}get messages(){return this._messages}constructor(t=[],e){this._messages=t,this.data=e}static buildInfo(t,e){return new i([t].flat().map(r=>new C(r,U.INFO)),e)}static buildSuccess(t,e){return new i([t].flat().map(r=>new C(r,U.SUCCESS)),e)}static fromPlain(t){return(0,j.plainToInstance)(i,t)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,j.instanceToPlain)(this,{excludePrefixes:["_"]})}};fr([(0,j.Expose)(),(0,j.Transform)(({value:i})=>i?.length?i:void 0),de("design:type",Object),de("design:paramtypes",[])],Q.prototype,"messages",null);function pe(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(pe,"_ts_decorate");function yt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(yt,"_ts_metadata");var F=class i extends Q{static{c(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new C("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp=Date.now();constructor(t=i.DEFAULT_MESSAGES,e="GENERIC_ERROR",r=500,s){super(t,s),this._errorCode=e,this._status=r}static create({messages:t=i.DEFAULT_MESSAGES,...e}={}){return new i(C.sanitizeMessages(t),e.errorCode,e.status,e.data)}static fromPlain(t){let e=(0,at.plainToInstance)(dr,t,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(e).forEach(s=>{s in r&&(r[s]=e[s])}),r}};pe([(0,at.Expose)(),yt("design:type",Object),yt("design:paramtypes",[])],F.prototype,"errorCode",null);pe([(0,at.Expose)(),yt("design:type",Number),yt("design:paramtypes",[])],F.prototype,"timestamp",null);var dr=class extends F{static{c(this,"SmpErrorResponseMutable")}set errorCode(t){this._errorCode=t}set status(t){this._status=t}set timestamp(t){this._timestamp=t}};var Tt=require("ts-luxon");var lt=class{static{c(this,"SmpAbstractCacheStrategy")}};function Mt(i){return typeof i=="object"&&i!==null&&"value"in i&&"expiry"in i&&typeof i.expiry=="number"}c(Mt,"smpIsSmpCachedValue");var G=class extends lt{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(t){let e=this._readRaw(t);if(this._isSmpCachedValue(e)){if(e.expiry>=Tt.DateTime.now().ts)return e.value;this._removeRaw(t);return}return e}remove(t){this._removeRaw(t)}write(t,e,r){if(isNaN(+r)||+r<=0){this._writeRaw(t,e,r);return}let s=Tt.DateTime.now().ts+r*1e3,o={value:e,expiry:s};this._writeRaw(t,o,r)}_isSmpCachedValue(t){return Mt(t)}};var ft=class extends G{static{c(this,"SmpBrowserCache")}_storage;_prefix;constructor(t,e){super(),this._storage=t,this._prefix=e}_flushRaw(){let t=[],e=-1;for(;++e<this._storage.length;){let r=this._storage.key(e);r&&r.startsWith(this._prefix)&&t.push(r)}for(e=-1;++e<t.length;)this._storage.removeItem(t[e])}_readRaw(t){let e=this._storage.getItem(this._prefix+t);try{return e?JSON.parse(e):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+t}`);return}}_removeRaw(t){this._storage.removeItem(this._prefix+t)}_writeRaw(t,e){try{this._storage.setItem(this._prefix+t,JSON.stringify(e))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+t}`,r)}}};var dt=class extends ft{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var pt=class extends G{static{c(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(t){return this._staticSelf._storage.get(t)}_removeRaw(t){this._staticSelf._storage.delete(t)}_writeRaw(t,e){this._staticSelf._storage.set(t,e)}};var Lt=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new dt:new pt;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=F;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core.com";static $http(t){return this._generateAjax(t)}static async _generateAjax(t){if(t.cacheKey){let e=this._cacheRead(t.cacheKey);return e?Promise.resolve(e):this._generateAjaxBase(t).then(r=>(t.cacheKey&&this._cacheWrite(t.cacheKey,r),r))}return this._generateAjaxBase(t)}static async _generateAjaxBase(t){let e=await this._preprocessRequest(t),r={method:e.method,headers:new Headers({"content-type":"application/json",...e.headers}),body:e.body?JSON.stringify(e.body):null};return e.useCredentials&&(r.credentials="include"),e.url=this.mergeQueryParams(e.url,e.queryParams),fetch(e.url,r).then(s=>this._preprocessResponse(t,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(e.responseType){case"blob":return s.blob();case"arraybuffer":return s.arrayBuffer();case"text":return s.text();case"json":default:return s.json()}}return s.json().then(o=>{let n=o;try{n=this._errorClass.fromPlain(o)}catch(h){console.debug("http: failed to parse error response into ErrorResponse",h)}return Promise.reject({status:s.status,message:s.statusText,body:n})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(t,e){let r=t.startsWith("http");if(e){let s=new URL(t,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),o=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...o,...Object.fromEntries(Object.entries(e).map(([n,h])=>[n,`${h}`]))}).toString(),t=r?s.href:s.pathname+s.search}return t}static _cacheKey(t){return`${this._config.cachePrefix}${t}`}static _cachePop(t){let e=this._cacheRead(t);return this._cacheRemove(t),e}static _cacheRead(t){return this._cacheStrategy.read(this._cacheKey(t))}static _cacheRemove(t){this._cacheStrategy.remove(this._cacheKey(t))}static _cacheWrite(t,e){this._cacheStrategy.write(this._cacheKey(t),e)}static async _preprocessRequest(t){return t}static async _preprocessResponse(t,e){return e}};var zt=(function(i){return i[i.Continue=100]="Continue",i[i.SwitchingProtocols=101]="SwitchingProtocols",i[i.Processing=102]="Processing",i[i.EarlyHints=103]="EarlyHints",i[i.Ok=200]="Ok",i[i.Created=201]="Created",i[i.Accepted=202]="Accepted",i[i.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",i[i.NoContent=204]="NoContent",i[i.ResetContent=205]="ResetContent",i[i.PartialContent=206]="PartialContent",i[i.MultiStatus=207]="MultiStatus",i[i.AlreadyReported=208]="AlreadyReported",i[i.ImUsed=226]="ImUsed",i[i.MultipleChoices=300]="MultipleChoices",i[i.MovedPermanently=301]="MovedPermanently",i[i.Found=302]="Found",i[i.SeeOther=303]="SeeOther",i[i.NotModified=304]="NotModified",i[i.UseProxy=305]="UseProxy",i[i.Unused=306]="Unused",i[i.TemporaryRedirect=307]="TemporaryRedirect",i[i.PermanentRedirect=308]="PermanentRedirect",i[i.BadRequest=400]="BadRequest",i[i.Unauthorized=401]="Unauthorized",i[i.PaymentRequired=402]="PaymentRequired",i[i.Forbidden=403]="Forbidden",i[i.NotFound=404]="NotFound",i[i.MethodNotAllowed=405]="MethodNotAllowed",i[i.NotAcceptable=406]="NotAcceptable",i[i.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",i[i.RequestTimeout=408]="RequestTimeout",i[i.Conflict=409]="Conflict",i[i.Gone=410]="Gone",i[i.LengthRequired=411]="LengthRequired",i[i.PreconditionFailed=412]="PreconditionFailed",i[i.PayloadTooLarge=413]="PayloadTooLarge",i[i.UriTooLong=414]="UriTooLong",i[i.UnsupportedMediaType=415]="UnsupportedMediaType",i[i.RangeNotSatisfiable=416]="RangeNotSatisfiable",i[i.ExpectationFailed=417]="ExpectationFailed",i[i.ImATeapot=418]="ImATeapot",i[i.MisdirectedRequest=421]="MisdirectedRequest",i[i.UnprocessableEntity=422]="UnprocessableEntity",i[i.Locked=423]="Locked",i[i.FailedDependency=424]="FailedDependency",i[i.TooEarly=425]="TooEarly",i[i.UpgradeRequired=426]="UpgradeRequired",i[i.PreconditionRequired=428]="PreconditionRequired",i[i.TooManyRequests=429]="TooManyRequests",i[i.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",i[i.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",i[i.InternalServerError=500]="InternalServerError",i[i.NotImplemented=501]="NotImplemented",i[i.BadGateway=502]="BadGateway",i[i.ServiceUnavailable=503]="ServiceUnavailable",i[i.GatewayTimeout=504]="GatewayTimeout",i[i.HttpVersionNotSupported=505]="HttpVersionNotSupported",i[i.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",i[i.InsufficientStorage=507]="InsufficientStorage",i[i.LoopDetected=508]="LoopDetected",i[i.NotExtended=510]="NotExtended",i[i.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",i})({});var ue=require("@tonysamperi/logger");var Ut=class{static{c(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new ue.SmpLoggerMethods;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(t,e){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}static fromBearer(t=""){return t.split(" ")[1]}static getCountryFromReferer(t){return this.getLocaleFromReferer(t)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(t){return this.getLocaleFromReferer(t)?.split("-")[1]}static getLocaleFromReferer(t){return t?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(t,e){try{return t.replace(this._pathParamRegex,(r,s)=>{let o=e[s];return o!==void 0?encodeURIComponent(o):r})}catch(r){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,r)}return t}};var pr={status:"OK"};var jt=(function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i})({});var $t=class{static{c(this,"SmpBaseJwtToken")}_access_token;_exp;_iss;get access_token(){return this._access_token}get exp(){return this._exp}get iss(){return this._iss}constructor(t,e,r){this._access_token=t,this._exp=e,this._iss=r}serialize(){return{access_token:this._access_token,exp:this._exp,iss:this._iss}}};var Wt=class{static{c(this,"SmpBaseJwtTokenPlain")}access_token;exp;iss};var ur=(function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i})({});var wr=(function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i})({});var $=class{static{c(this,"Hex")}static parse(t){let e=t.length,r=[];for(let s=0;s<e;s+=2)r[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new _(r,e/2)}static stringify(t){let e=[];for(let r=0;r<t.sigBytes;r++){let s=t.words[r>>>2]>>>24-r%4*8&255;e.push((s>>>4).toString(16)),e.push((s&15).toString(16))}return e.join("")}};var _=class Gt{static{c(this,"WordArray")}constructor(t,e){this.words=t||[],e!==void 0?this.sigBytes=e:this.sigBytes=this.words.length*4}static random(t){let e=[],r=c(function(s){let o=987654321,n=4294967295;return function(){o=36969*(o&65535)+(o>>16)&n,s=18e3*(s&65535)+(s>>16)&n;let h=(o<<16)+s&n;return h/=4294967296,h+=.5,h*(Math.random()>.5?1:-1)}},"r");for(let s=0,o;s<t;s+=4){let n=r((o||Math.random())*4294967296);o=n()*987654071,e.push(n()*4294967296|0)}return new Gt(e,t)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new Gt(this.words.slice(0),this.sigBytes)}concat(t){if(this.clamp(),this.sigBytes%4)for(let e=0;e<t.sigBytes;e++){let r=t.words[e>>>2]>>>24-e%4*8&255;this.words[this.sigBytes+e>>>2]|=r<<24-(this.sigBytes+e)%4*8}else for(let e=0;e<t.sigBytes;e+=4)this.words[this.sigBytes+e>>>2]=t.words[e>>>2];return this.sigBytes+=t.sigBytes,this}toString(t){return(t||$).stringify(this)}};var xt=class{static{c(this,"Latin1")}static parse(t){let e=t.length,r=[];for(let s=0;s<e;s++)r[s>>>2]|=(t.charCodeAt(s)&255)<<24-s%4*8;return new _(r,e)}static stringify(t){let e=[];for(let r=0;r<t.sigBytes;r++){let s=t.words[r>>>2]>>>24-r%4*8&255;e.push(String.fromCharCode(s))}return e.join("")}};var R=class{static{c(this,"Utf8")}static parse(t){return xt.parse(unescape(encodeURIComponent(t)))}static stringify(t){try{return decodeURIComponent(escape(xt.stringify(t)))}catch(e){throw console.error("Malformed UTF-8 data",e),new Error("Malformed UTF-8 data")}}};var Et=class{static{c(this,"BufferedBlockAlgorithm")}constructor(t){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},t),this._data=new _,this._nDataBytes=0}clone(){let t=this.constructor();for(let e in this)Object.prototype.hasOwnProperty.call(this,e)&&(t[e]=this[e]);return t._data=this._data.clone(),t}reset(){this._data=new _,this._nDataBytes=0}_append(t){typeof t=="string"&&(t=R.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(t){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let e=this.cfg.blockSize*4,r=this._data.sigBytes/e;t?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let s=r*this.cfg.blockSize,o=Math.min(s*4,this._data.sigBytes),n;if(s){for(let h=0;h<s;h+=this.cfg.blockSize)this._doProcessBlock(this._data.words,h);n=this._data.words.splice(0,s),this._data.sigBytes-=o}return new _(n,o)}};var S=class{static{c(this,"CipherParams")}constructor(t){this.ciphertext=t.ciphertext,this.key=t.key,this.iv=t.iv,this.salt=t.salt,this.algorithm=t.algorithm,this.mode=t.mode,this.padding=t.padding,this.blockSize=t.blockSize,this.formatter=t.formatter}extend(t){return t.ciphertext!==void 0&&(this.ciphertext=t.ciphertext),t.key!==void 0&&(this.key=t.key),t.iv!==void 0&&(this.iv=t.iv),t.salt!==void 0&&(this.salt=t.salt),t.algorithm!==void 0&&(this.algorithm=t.algorithm),t.mode!==void 0&&(this.mode=t.mode),t.padding!==void 0&&(this.padding=t.padding),t.blockSize!==void 0&&(this.blockSize=t.blockSize),t.formatter!==void 0&&(this.formatter=t.formatter),this}toString(t){if(t)return t.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var T=class{static{c(this,"Base64")}static parse(t){let e=t.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=t.indexOf(r);s!==-1&&(e=s)}return this.parseLoop(t,e,this._reverseMap)}static parseLoop(t,e,r){let s=[],o=0;for(let n=0;n<e;n++)if(n%4){let h=r[t.charCodeAt(n-1)]<<n%4*2,a=r[t.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(h|a)<<24-o%4*8,o++}return new _(s,o)}static stringify(t){t.clamp();let e=[];for(let s=0;s<t.sigBytes;s+=3){let o=t.words[s>>>2]>>>24-s%4*8&255,n=t.words[s+1>>>2]>>>24-(s+1)%4*8&255,h=t.words[s+2>>>2]>>>24-(s+2)%4*8&255,a=o<<16|n<<8|h;for(let p=0;p<4&&s+p*.75<t.sigBytes;p++)e.push(this._map.charAt(a>>>6*(3-p)&63))}let r=this._map.charAt(64);if(r)for(;e.length%4;)e.push(r);return e.join("")}};T._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";T._reverseMap=void 0;var Rt=class{static{c(this,"OpenSSL")}static parse(t){let e=T.parse(t),r;return e.words[0]===1398893684&&e.words[1]===1701076831&&(r=new _(e.words.slice(2,4)),e.words.splice(0,4),e.sigBytes-=16),new S({ciphertext:e,salt:r})}static stringify(t){if(!t.ciphertext)throw new Error("missing ciphertext in params");let e=t.ciphertext,r=t.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(r).concat(e)}else s=e;return s.toString(T)}};var K=class{static{c(this,"SerializableCipher")}static decrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(!o.format)throw new Error("could not determine format");if(e=this._parse(e,o.format),!e.ciphertext)throw new Error("could not determine ciphertext");return t.createDecryptor(r,o).finalize(e.ciphertext)}static encrypt(t,e,r,s){let o=Object.assign({},this.cfg,s),n=t.createEncryptor(r,o),h=n.finalize(e);return new S({ciphertext:h,key:r,iv:n.cfg.iv,algorithm:t,mode:n.cfg.mode,padding:n.cfg.padding,blockSize:n.cfg.blockSize,formatter:o.format})}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};K.cfg={blockSize:4,iv:new _([]),format:Rt};var E=class extends Et{static{c(this,"Hasher")}constructor(t){super(Object.assign({blockSize:512/32},t)),this.reset()}static _createHelper(t){function e(r,s){return new t(s).finalize(r)}return c(e,"helper"),e}finalize(t){return t&&this._append(t),this._doFinalize()}update(t){return this._append(t),this._process(),this}};var f=[];for(let i=0;i<64;i++)f[i]=Math.abs(Math.sin(i+1))*4294967296|0;var L=class d extends E{static{c(this,"MD5")}get hash(){return this._hash}static FF(t,e,r,s,o,n,h){let a=t+(e&r|~e&s)+o+h;return(a<<n|a>>>32-n)+e}static GG(t,e,r,s,o,n,h){let a=t+(e&s|r&~s)+o+h;return(a<<n|a>>>32-n)+e}static HH(t,e,r,s,o,n,h){let a=t+(e^r^s)+o+h;return(a<<n|a>>>32-n)+e}static II(t,e,r,s,o,n,h){let a=t+(r^(e|~s))+o+h;return(a<<n|a>>>32-n)+e}reset(){super.reset(),this._hash=new _([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;this._data.words[e>>>5]|=128<<24-e%32;let r=Math.floor(t/4294967296),s=t;this._data.words[(e+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(e+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let o=0;o<4;o++)this._hash.words[o]=(this._hash.words[o]<<8|this._hash.words[o]>>>24)&16711935|(this._hash.words[o]<<24|this._hash.words[o]>>>8)&4278255360;return this._hash}_doProcessBlock(t,e){for(let a=0;a<16;a++){let p=e+a,w=t[p];t[p]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}let r=Array.from({length:16});for(let a=0;a<16;a++)r[a]=t[e+a];let s=this._hash.words[0],o=this._hash.words[1],n=this._hash.words[2],h=this._hash.words[3];s=d.FF(s,o,n,h,r[0],7,f[0]),h=d.FF(h,s,o,n,r[1],12,f[1]),n=d.FF(n,h,s,o,r[2],17,f[2]),o=d.FF(o,n,h,s,r[3],22,f[3]),s=d.FF(s,o,n,h,r[4],7,f[4]),h=d.FF(h,s,o,n,r[5],12,f[5]),n=d.FF(n,h,s,o,r[6],17,f[6]),o=d.FF(o,n,h,s,r[7],22,f[7]),s=d.FF(s,o,n,h,r[8],7,f[8]),h=d.FF(h,s,o,n,r[9],12,f[9]),n=d.FF(n,h,s,o,r[10],17,f[10]),o=d.FF(o,n,h,s,r[11],22,f[11]),s=d.FF(s,o,n,h,r[12],7,f[12]),h=d.FF(h,s,o,n,r[13],12,f[13]),n=d.FF(n,h,s,o,r[14],17,f[14]),o=d.FF(o,n,h,s,r[15],22,f[15]),s=d.GG(s,o,n,h,r[1],5,f[16]),h=d.GG(h,s,o,n,r[6],9,f[17]),n=d.GG(n,h,s,o,r[11],14,f[18]),o=d.GG(o,n,h,s,r[0],20,f[19]),s=d.GG(s,o,n,h,r[5],5,f[20]),h=d.GG(h,s,o,n,r[10],9,f[21]),n=d.GG(n,h,s,o,r[15],14,f[22]),o=d.GG(o,n,h,s,r[4],20,f[23]),s=d.GG(s,o,n,h,r[9],5,f[24]),h=d.GG(h,s,o,n,r[14],9,f[25]),n=d.GG(n,h,s,o,r[3],14,f[26]),o=d.GG(o,n,h,s,r[8],20,f[27]),s=d.GG(s,o,n,h,r[13],5,f[28]),h=d.GG(h,s,o,n,r[2],9,f[29]),n=d.GG(n,h,s,o,r[7],14,f[30]),o=d.GG(o,n,h,s,r[12],20,f[31]),s=d.HH(s,o,n,h,r[5],4,f[32]),h=d.HH(h,s,o,n,r[8],11,f[33]),n=d.HH(n,h,s,o,r[11],16,f[34]),o=d.HH(o,n,h,s,r[14],23,f[35]),s=d.HH(s,o,n,h,r[1],4,f[36]),h=d.HH(h,s,o,n,r[4],11,f[37]),n=d.HH(n,h,s,o,r[7],16,f[38]),o=d.HH(o,n,h,s,r[10],23,f[39]),s=d.HH(s,o,n,h,r[13],4,f[40]),h=d.HH(h,s,o,n,r[0],11,f[41]),n=d.HH(n,h,s,o,r[3],16,f[42]),o=d.HH(o,n,h,s,r[6],23,f[43]),s=d.HH(s,o,n,h,r[9],4,f[44]),h=d.HH(h,s,o,n,r[12],11,f[45]),n=d.HH(n,h,s,o,r[15],16,f[46]),o=d.HH(o,n,h,s,r[2],23,f[47]),s=d.II(s,o,n,h,r[0],6,f[48]),h=d.II(h,s,o,n,r[7],10,f[49]),n=d.II(n,h,s,o,r[14],15,f[50]),o=d.II(o,n,h,s,r[5],21,f[51]),s=d.II(s,o,n,h,r[12],6,f[52]),h=d.II(h,s,o,n,r[3],10,f[53]),n=d.II(n,h,s,o,r[10],15,f[54]),o=d.II(o,n,h,s,r[1],21,f[55]),s=d.II(s,o,n,h,r[8],6,f[56]),h=d.II(h,s,o,n,r[15],10,f[57]),n=d.II(n,h,s,o,r[6],15,f[58]),o=d.II(o,n,h,s,r[13],21,f[59]),s=d.II(s,o,n,h,r[4],6,f[60]),h=d.II(h,s,o,n,r[11],10,f[61]),n=d.II(n,h,s,o,r[2],15,f[62]),o=d.II(o,n,h,s,r[9],21,f[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+n|0,this._hash.words[3]=this._hash.words[3]+h|0}};var Kt=class we{static{c(this,"EVPKDF")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:L,iterations:1},t)}static execute(t,e,r){return new we(r).compute(t,e)}compute(t,e){let r=new this.cfg.hasher,s=new _,o;for(;s.words.length<this.cfg.keySize;){o&&r.update(o),o=r.update(t).finalize(e),r.reset();for(let n=1;n<this.cfg.iterations;n++)o=r.finalize(o),r.reset();s.concat(o)}return s.sigBytes=this.cfg.keySize*4,s}};var _e=class{static{c(this,"OpenSSLKdf")}static execute(t,e,r,s){s||(s=_.random(64/8));let o=new Kt({keySize:e+r}).compute(t,s),n=new _(o.words.slice(e),r*4);return o.sigBytes=e*4,new S({key:o,iv:n,salt:s})}};var At=class{static{c(this,"PasswordBasedCipher")}static decrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(o.format===void 0)throw new Error("missing format in config");if(e=this._parse(e,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let n=o.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv!==void 0&&(o.iv=n.iv),K.decrypt.call(this,t,e,n.key,o)}static encrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(o.kdf===void 0)throw new Error("missing kdf in config");let n=o.kdf.execute(r,t.keySize,t.ivSize);return n.iv!==void 0&&(o.iv=n.iv),K.encrypt.call(this,t,e,n.key,o).extend(n)}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};At.cfg={blockSize:4,iv:new _([]),format:Rt,kdf:_e};var ge=class{static{c(this,"CipherHelper")}constructor(t){this._cipher=t}decrypt(t,e,r){return typeof e=="string"?At.decrypt(this._cipher,t,e,r):K.decrypt(this._cipher,t,e,r)}encrypt(t,e,r){return typeof e=="string"?At.encrypt(this._cipher,t,e,r):K.encrypt(this._cipher,t,e,r)}};var tt=class extends Et{static{c(this,"Cipher")}constructor(t,e,r){super(Object.assign({blockSize:1},r)),this._xformMode=t,this._key=e,this.reset()}static _createHelper(t){return new ge(t)}static createDecryptor(t,e){let r=this;return new r(this._DEC_XFORM_MODE,t,e)}static createEncryptor(t,e){return new this(this._ENC_XFORM_MODE,t,e)}finalize(t){return t&&this._append(t),this._doFinalize()}process(t){return this._append(t),this._process()}};tt.ivSize=4;tt.keySize=4;tt._DEC_XFORM_MODE=2;tt._ENC_XFORM_MODE=1;var V=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(t,e){this.init(t,e)}init(t,e){this._cipher=t,this._iv=e}};var Bt=class{static{c(this,"BlockCipherMode")}static createDecryptor(t,e){let r=this.Decryptor;return new r(t,e)}static createEncryptor(t,e){let r=this.Encryptor;return new r(t,e)}};Bt.Decryptor=V;Bt.Encryptor=V;var me=class extends V{static{c(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(t,e){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(t,e,this._cipher.cfg.blockSize),this._cipher.encryptBlock(t,e),this._prevBlock=t.slice(e,e+this._cipher.cfg.blockSize)}xorBlock(t,e,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)t[e+o]^=s[o]}};var ye=class extends V{static{c(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(t,e){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=t.slice(e,e+this._cipher.cfg.blockSize);this._cipher.decryptBlock(t,e),this.xorBlock(t,e,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(t,e,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)t[e+o]^=s[o]}};var W=class extends Bt{static{c(this,"CBC")}};W.Decryptor=ye;W.Encryptor=me;var et=class{static{c(this,"PKCS7")}static pad(t,e){let r=e*4,s=r-t.sigBytes%r,o=s<<24|s<<16|s<<8|s,n=[];for(let a=0;a<s;a+=4)n.push(o);let h=new _(n,s);t.concat(h)}static unpad(t){let e=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=e}};var Ot=class extends tt{static{c(this,"BlockCipher")}constructor(t,e,r){super(t,e,Object.assign({blockSize:4,mode:W,padding:et},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let t;this._xformMode===this.constructor._ENC_XFORM_MODE?t=this.cfg.mode.createEncryptor:(t=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===t?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=t.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=t)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let t;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),t=this._process(!0)}else t=this._process(!0),this.cfg.padding.unpad(t);return t}_doProcessBlock(t,e){this._mode.processBlock(t,e)}};var l=class M{static{c(this,"X64Word")}constructor(t,e){this.high=t,this.low=e}add(t){let e=this.low+t.low|0,r=e>>>0<this.low>>>0?1:0,s=this.high+t.high+r|0;return new M(s,e)}and(t){return new M(this.high&t.high,this.low&t.low)}not(){return new M(~this.high,~this.low)}or(t){return new M(this.high|t.high,this.low|t.low)}rotL(t){return this.shiftL(t).or(this.shiftR(64-t))}rotR(t){return this.shiftR(t).or(this.shiftL(64-t))}shiftL(t){return t<32?new M(this.high<<t|this.low>>>32-t,this.low<<t):new M(this.low<<t-32,0)}shiftR(t){return t<32?new M(this.high>>>t,this.low>>>t|this.high<<32-t):new M(0,this.high>>>t-32)}xor(t){return new M(this.high^t.high,this.low^t.low)}};var xe=class Vt{static{c(this,"X64WordArray")}constructor(t=[],e){this.words=t,this.sigBytes=e!==void 0?e:t.length*8}static create(t=[],e){return new Vt(t,e)}clone(){let t=this.words.map(e=>new l(e.high,e.low));return new Vt(t,this.sigBytes)}toX32(){let t=[];for(let e of this.words)t.push(e.high,e.low);return new _(t,this.sigBytes)}};var B=[],Ee=[],Re=[],Ae=[],Be=[],Oe=[],qt=[],Xt=[],Zt=[],Ht=[];(function(){let i=[];for(let r=0;r<256;r++)r<128?i[r]=r<<1:i[r]=r<<1^283;let t=0,e=0;for(let r=0;r<256;r++){let s=e^e<<1^e<<2^e<<3^e<<4;s=s>>>8^s&255^99,B[t]=s,Ee[s]=t;let o=i[t],n=i[o],h=i[n],a=i[s]*257^s*16843008;Re[t]=a<<24|a>>>8,Ae[t]=a<<16|a>>>16,Be[t]=a<<8|a>>>24,Oe[t]=a,a=h*16843009^n*65537^o*257^t*16843008,qt[s]=a<<24|a>>>8,Xt[s]=a<<16|a>>>16,Zt[s]=a<<8|a>>>24,Ht[s]=a,t?(t=o^i[i[i[h^o]]],e^=i[i[e]]):t=e=1}})();var _r=[0,1,2,4,8,16,32,64,128,27,54],bt=class extends Ot{static{c(this,"AES")}constructor(t,e,r){super(t,e,r),super.reset()}decryptBlock(t,e){let r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,qt,Xt,Zt,Ht,Ee),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r}encryptBlock(t,e){this._doCryptBlock(t,e,this._keySchedule,Re,Ae,Be,Oe,B)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,o=((this._nRounds=r+6)+1)*4,n=this._keySchedule=[];for(let h=0;h<o;h++)if(h<r)n[h]=e[h];else{let a=n[h-1];h%r?r>6&&h%r===4&&(a=B[a>>>24]<<24|B[a>>>16&255]<<16|B[a>>>8&255]<<8|B[a&255]):(a=a<<8|a>>>24,a=B[a>>>24]<<24|B[a>>>16&255]<<16|B[a>>>8&255]<<8|B[a&255],a^=_r[h/r|0]<<24),n[h]=n[h-r]^a}this._invKeySchedule=[];for(let h=0;h<o;h++){let a=o-h,p;h%4?p=n[a]:p=n[a-4],h<4||a<=4?this._invKeySchedule[h]=p:this._invKeySchedule[h]=qt[B[p>>>24]]^Xt[B[p>>>16&255]]^Zt[B[p>>>8&255]]^Ht[B[p&255]]}}_doCryptBlock(t,e,r,s,o,n,h,a){let p=t[e]^r[0],w=t[e+1]^r[1],u=t[e+2]^r[2],g=t[e+3]^r[3],x=4;for(let A=1;A<this._nRounds;A++){let m=s[p>>>24]^o[w>>>16&255]^n[u>>>8&255]^h[g&255]^r[x++],y=s[w>>>24]^o[u>>>16&255]^n[g>>>8&255]^h[p&255]^r[x++],P=s[u>>>24]^o[g>>>16&255]^n[p>>>8&255]^h[w&255]^r[x++],kt=s[g>>>24]^o[p>>>16&255]^n[w>>>8&255]^h[u&255]^r[x++];p=m,w=y,u=P,g=kt}let b=(a[p>>>24]<<24|a[w>>>16&255]<<16|a[u>>>8&255]<<8|a[g&255])^r[x++],k=(a[w>>>24]<<24|a[u>>>16&255]<<16|a[g>>>8&255]<<8|a[p&255])^r[x++],v=(a[u>>>24]<<24|a[g>>>16&255]<<16|a[p>>>8&255]<<8|a[w&255])^r[x++],N=(a[g>>>24]<<24|a[p>>>16&255]<<16|a[w>>>8&255]<<8|a[u&255])^r[x++];t[e]=b,t[e+1]=k,t[e+2]=v,t[e+3]=N}};bt.keySize=256/32;var gr=[1732584193,4023233417,2562383102,271733878,3285377520],q=new Array(80),X=class extends E{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(gr.slice(0))}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(e+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,e){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],h=this._hash.words[4];for(let a=0;a<80;a++){if(a<16)q[a]=t[e+a]|0;else{let g=q[a-3]^q[a-8]^q[a-14]^q[a-16];q[a]=g<<1|g>>>31}let p,w;a<20?(p=s&o|~s&n,w=1518500249):a<40?(p=s^o^n,w=1859775393):a<60?(p=s&o|s&n|o&n,w=2400959708):(p=s^o^n,w=3395469782);let u=(r<<5|r>>>27)+p+h+w+q[a];h=n,n=o,o=s<<30|s>>>2,s=r,r=u|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+h|0}};var be=[],Ie=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}c(i,"isPrime");function t(s){return(s-(s|0))*4294967296|0}c(t,"getFractionalBits");let e=2,r=0;for(;r<64;)i(e)&&(r<8&&(be[r]=t(Math.pow(e,1/2))),Ie[r]=t(Math.pow(e,1/3)),r++),e++})();var Z=[],ut=class extends E{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(be.slice(0))}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(e+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,e){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],h=this._hash.words[4],a=this._hash.words[5],p=this._hash.words[6],w=this._hash.words[7];for(let u=0;u<64;u++){if(u<16)Z[u]=t[e+u]|0;else{let A=Z[u-15],m=(A<<25|A>>>7)^(A<<14|A>>>18)^A>>>3,y=Z[u-2],P=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;Z[u]=m+Z[u-7]+P+Z[u-16]}let g=h&a^~h&p,x=r&s^r&o^s&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),k=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),v=w+k+g+Ie[u]+Z[u],N=b+x;w=p,p=a,a=h,h=n+v|0,n=o,o=s,s=r,r=v+N|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+h|0,this._hash.words[5]=this._hash.words[5]+a|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+w|0}};var Jt=[new l(1116352408,3609767458),new l(1899447441,602891725),new l(3049323471,3964484399),new l(3921009573,2173295548),new l(961987163,4081628472),new l(1508970993,3053834265),new l(2453635748,2937671579),new l(2870763221,3664609560),new l(3624381080,2734883394),new l(310598401,1164996542),new l(607225278,1323610764),new l(1426881987,3590304994),new l(1925078388,4068182383),new l(2162078206,991336113),new l(2614888103,633803317),new l(3248222580,3479774868),new l(3835390401,2666613458),new l(4022224774,944711139),new l(264347078,2341262773),new l(604807628,2007800933),new l(770255983,1495990901),new l(1249150122,1856431235),new l(1555081692,3175218132),new l(1996064986,2198950837),new l(2554220882,3999719339),new l(2821834349,766784016),new l(2952996808,2566594879),new l(3210313671,3203337956),new l(3336571891,1034457026),new l(3584528711,2466948901),new l(113926993,3758326383),new l(338241895,168717936),new l(666307205,1188179964),new l(773529912,1546045734),new l(1294757372,1522805485),new l(1396182291,2643833823),new l(1695183700,2343527390),new l(1986661051,1014477480),new l(2177026350,1206759142),new l(2456956037,344077627),new l(2730485921,1290863460),new l(2820302411,3158454273),new l(3259730800,3505952657),new l(3345764771,106217008),new l(3516065817,3606008344),new l(3600352804,1432725776),new l(4094571909,1467031594),new l(275423344,851169720),new l(430227734,3100823752),new l(506948616,1363258195),new l(659060556,3750685593),new l(883997877,3785050280),new l(958139571,3318307427),new l(1322822218,3812723403),new l(1537002063,2003034995),new l(1747873779,3602036899),new l(1955562222,1575990012),new l(2024104815,1125592928),new l(2227730452,2716904306),new l(2361852424,442776044),new l(2428436474,593698344),new l(2756734187,3733110249),new l(3204031479,2999351573),new l(3329325298,3815920427),new l(3391569614,3928383900),new l(3515267271,566280711),new l(3940187606,3454069534),new l(4118630271,4000239992),new l(116418474,1914138554),new l(174292421,2731055270),new l(289380356,3203993006),new l(460393269,320620315),new l(685471733,587496836),new l(852142971,1086792851),new l(1017036298,365543100),new l(1126000580,2618297676),new l(1288033470,3409855158),new l(1501505948,4234509866),new l(1607167915,987167468),new l(1816402316,1246189591)],D=[];(function(){for(let i=0;i<80;i++)D[i]=new l(void 0,void 0)})();var Yt=class extends E{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new xe([new l(1779033703,4089235720),new l(3144134277,2227873595),new l(1013904242,4271175723),new l(2773480762,1595750129),new l(1359893119,2917565137),new l(2600822924,725511199),new l(528734635,4215389547),new l(1541459225,327033209)])}_doFinalize(){let t=this._data,e=t.words,r=this._nDataBytes*8,s=t.sigBytes*8;return e[s>>>5]|=128<<24-s%32,e[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),e[(s+128>>>10<<5)+31]=r,t.sigBytes=e.length*4,this._process(),this._hash.toX32()}_doProcessBlock(t,e){let r=this._hash.words[0].high,s=this._hash.words[0].low,o=this._hash.words[1].high,n=this._hash.words[1].low,h=this._hash.words[2].high,a=this._hash.words[2].low,p=this._hash.words[3].high,w=this._hash.words[3].low,u=this._hash.words[4].high,g=this._hash.words[4].low,x=this._hash.words[5].high,b=this._hash.words[5].low,k=this._hash.words[6].high,v=this._hash.words[6].low,N=this._hash.words[7].high,A=this._hash.words[7].low;for(let m=0;m<80;m++){let y,P;if(m<16)P=D[m].high=t[e+m*2]|0,y=D[m].low=t[e+m*2+1]|0;else{let he=D[m-15],J=he.high,ht=he.low,sr=(J>>>1|ht<<31)^(J>>>8|ht<<24)^J>>>7,ce=(ht>>>1|J<<31)^(ht>>>8|J<<24)^(ht>>>7|J<<25),ae=D[m-2],Y=ae.high,ct=ae.low,ir=(Y>>>19|ct<<13)^(Y<<3|ct>>>29)^Y>>>6,le=(ct>>>19|Y<<13)^(ct<<3|Y>>>29)^(ct>>>6|Y<<26);y=ce+D[m-7].low,P=sr+D[m-7].high+(y>>>0<ce>>>0?1:0),y=y+le,P=P+ir+(y>>>0<le>>>0?1:0),y=y+D[m-16].low,P=P+D[m-16].high+(y>>>0<D[m-16].low>>>0?1:0),D[m].high=P,D[m].low=y}let kt=u&x^~u&k,ie=g&b^~g&v,Ye=r&o^r&h^o&h,Qe=s&n^s&a^n&a,Se=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),oe=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),tr=(u>>>14|g<<18)^(u>>>18|g<<14)^(u<<23|g>>>9),er=(g>>>14|u<<18)^(g>>>18|u<<14)^(g<<23|u>>>9),I=A+er,z=N+tr+(I>>>0<A>>>0?1:0);I=I+ie,z=z+kt+(I>>>0<ie>>>0?1:0),I=I+Jt[m].low,z=z+Jt[m].high+(I>>>0<Jt[m].low>>>0?1:0),I=I+y,z=z+P+(I>>>0<y>>>0?1:0);let ne=oe+Qe,rr=Se+Ye+(ne>>>0<oe>>>0?1:0);N=k,A=v,k=x,v=b,x=u,b=g,g=w+I|0,u=p+z+(g>>>0<w>>>0?1:0)|0,p=h,w=a,h=o,a=n,o=r,n=s,s=I+ne|0,r=z+rr+(s>>>0<I>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+n,this._hash.words[1].high=this._hash.words[1].high+o+(this._hash.words[1].low>>>0<n>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+a,this._hash.words[2].high=this._hash.words[2].high+h+(this._hash.words[2].low>>>0<a>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+w,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<w>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+g,this._hash.words[4].high=this._hash.words[4].high+u+(this._hash.words[4].low>>>0<g>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+b,this._hash.words[5].high=this._hash.words[5].high+x+(this._hash.words[5].low>>>0<b>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+v,this._hash.words[6].high=this._hash.words[6].high+k+(this._hash.words[6].low>>>0<v>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+A,this._hash.words[7].high=this._hash.words[7].high+N+(this._hash.words[7].low>>>0<A>>>0?1:0)}};var ve=class{static{c(this,"HMAC")}constructor(t,e){this._hasher=new t;let r=typeof e=="string"?R.parse(e):e,s=this._hasher.cfg.blockSize,o=s*4;r.sigBytes>o&&(r=this._hasher.finalize(r)),r.clamp();let n=this._oKey=r.clone(),h=this._iKey=r.clone(),a=n.words,p=h.words;for(let w=0;w<s;w++)a[w]^=1549556828,p[w]^=909522486;n.sigBytes=h.sigBytes=o,this.reset()}finalize(t){let e=this._hasher.finalize(t);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(e))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(t){return this._hasher.update(t),this}};var Qt=class Ne{static{c(this,"PBKDF2")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:ut,iterations:25e4},t)}static execute(t,e,r){return new Ne(r).compute(t,e)}compute(t,e){let r=this.cfg,s=new ve(r.hasher,t),o=new _,n=new _([1]),h=o.words,a=n.words,p=r.keySize,w=r.iterations;for(;h.length<p;){let u=s.update(e).finalize(n);s.reset();let g=u.words,x=g.length,b=u;for(let k=1;k<w;k++){b=s.finalize(b),s.reset();let v=b.words;for(let N=0;N<x;N++)g[N]^=v[N]}o.concat(u),a[0]++}return o.sigBytes=p*4,o}};var wt=Ot._createHelper(bt);var rt=E._createHelper(L);var st=E._createHelper(X);var It=E._createHelper(ut);var vt=E._createHelper(Yt);var it=class{static{c(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?$.parse(this._initVector):void 0}_mode=W;_padding=et;constructor(t,e,r){this._password=t,this._salt=e,this._initVector=r}decryptAES(t){return wt.decrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(R)}encryptAES(t){return wt.encrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Qt.execute(this._password,$.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:X})}};var Nt=class{static{c(this,"SmpCrypto")}static base64Decode(t){return R.stringify(T.parse(t))}static base64Encode(t){return T.stringify(R.parse(t))}static md5(t){return rt(t).toString()}static sha1(t){return st(t).toString()}static sha256(t){return It(t).toString()}static sha512(t){return vt(t).toString()}};var Pt=class{static{c(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength=5;_seed="changeme";constructor(t){this._baseCode=t}static check(t,e){if(new this(t).secureCode!==e)throw F.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:zt.BadRequest})}_encode(){let t=new L;return t.update(R.parse(this._seed+this._baseCode)),t.finalize().toString($).substring(0,this._crcLength).toUpperCase()}};var mr=(function(i){return i.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",i.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",i.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",i.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",i.EMAIL_EXISTS="auth/email-already-exists",i.INVALID_ACTION_CODE="auth/invalid-action-code",i.POPUP_BLOCKED="auth/popup-blocked",i.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",i.USER_NOT_FOUND="auth/user-not-found",i.WRONG_PASSWORD="auth/wrong-password",i})({});var ot=require("class-transformer"),Ct=require("ts-luxon");var O=(function(i){return i.ACTIVATE="ACTIVATE",i.BLOCK="BLOCK",i.CHECK="CHECK",i.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",i.FREEZE="FREEZE",i.PURCHASE="PURCHASE",i.RECHARGE="RECHARGE",i.ROLLBACK="ROLLBACK",i.TRANSACTION="TRANSACTION",i.TRANSACTION_DETAIL="TRANSACTION_DETAIL",i.UNFREEZE="UNFREEZE",i.XREFUND="XREFUND",i})({});var H=(function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i})({});function yr(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(yr,"_ts_decorate");function Pe(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(Pe,"_ts_metadata");var Dt=class i{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new it("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[O.CHECK]:"",[O.TRANSACTION]:"",[O.TRANSACTION_DETAIL]:"",[O.ACTIVATE]:"A",[O.BLOCK]:"B",[O.DIGITAL_ACTIVATE]:"D",[O.FREEZE]:"F",[O.PURCHASE]:"P",[O.RECHARGE]:"G",[O.ROLLBACK]:"R",[O.UNFREEZE]:"U",[O.XREFUND]:"X"};static _SEP="_";get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}_dto;_hashStrategies={[H.MD5]:t=>rt(t),[H.MD5_HMAC]:t=>{let e=new L;return e.update(R.parse(t)),e.finalize()},[H.SHA1]:t=>st(t),[H.SHA1_HMAC]:t=>{let e=new X;return e.update(R.parse(t)),e.finalize()}};_hashStrategy=this._hashStrategies[H.MD5];constructor(t="ACTIVATION",e,r,s){this.gc=t,this.op=e,this.ot=r,this._dto=typeof s=="number"&&s>=0?Ct.DateTime.fromMillis(+`${s}000`.slice(0,13)):Ct.DateTime.local()}static build({gc:t,op:e,ot:r,dto:s}){return new this(t,e,r,s?.ts)}static explode(t){let e=this.constructor,r=(t||"").split(e._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${t}"`);return this.build({gc:r[1],op:e.prefixToOperation(r[2]),dto:Ct.DateTime.fromSeconds(+r[3])})}static isBase64(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)&&t.length%4===0}static parse(t){this._LOGGER.info(`${this.constructor.name}: trying to parse ${t}`);try{if(this.isBase64(t)){let e=this._AES_ENCODER.decryptAES(t),r=JSON.parse(e);return(0,ot.plainToInstance)(i,r)}else return this.explode(t)}catch(e){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${t}`,e),new Error(`UNPARSEABLE "${t}"`)}}static prefixToOperation(t){return Object.entries(this._OP_CODES).find(([,r])=>r===t)[0]}serialize(){return(0,ot.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let t=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(t)}};yr([(0,ot.Expose)(),Pe("design:type",Number),Pe("design:paramtypes",[])],Dt.prototype,"ts",null);var xr=(function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i})({});function Er(i,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{r!=="constructor"&&(r in i.prototype||Object.defineProperty(i.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)))});try{let r=new e;Object.getOwnPropertyNames(r).forEach(s=>{s in i.prototype||Object.defineProperty(i.prototype,s,Object.getOwnPropertyDescriptor(r,s))})}catch{}Object.getOwnPropertyNames(e).forEach(r=>{r!=="prototype"&&r!=="name"&&r!=="length"&&(r in i||Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r)))})})}c(Er,"smpApplyMixin");var Rr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ce(i){return i.match(Rr)}c(Ce,"smpAsciiWords");var Le="\\ud800-\\udfff",Ar="\\u0300-\\u036f",Br="\\ufe20-\\ufe2f",Or="\\u20d0-\\u20ff",br="\\u1ab0-\\u1aff",Ir="\\u1dc0-\\u1dff",vr=Ar+Br+Or+br+Ir,ze="\\u2700-\\u27bf",Ue="a-z\\xdf-\\xf6\\xf8-\\xff",Nr="\\xac\\xb1\\xd7\\xf7",Pr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cr="\\u2000-\\u206f",Dr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",kr="\\ufe0e\\ufe0f",$e=Nr+Pr+Cr+Dr,We="['\u2019]",De=`[${$e}]`,Fr=`[${vr}]`,Ge="\\d",Mr=`[${ze}]`,Ke=`[${Ue}]`,Ve=`[^${Le}${$e+Ge+ze+Ue+je}]`,Tr="\\ud83c[\\udffb-\\udfff]",Lr=`(?:${Fr}|${Tr})`,zr=`[^${Le}]`,qe="(?:\\ud83c[\\udde6-\\uddff]){2}",Xe="[\\ud800-\\udbff][\\udc00-\\udfff]",nt=`[${je}]`,Ur="\\u200d",ke=`(?:${Ke}|${Ve})`,jr=`(?:${nt}|${Ve})`,Fe=`(?:${We}(?:d|ll|m|re|s|t|ve))?`,Me=`(?:${We}(?:D|LL|M|RE|S|T|VE))?`,Ze=`${Lr}?`,He=`[${kr}]?`,$r=`(?:${Ur}(?:${[zr,qe,Xe].join("|")})${He+Ze})*`,Wr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Gr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Kr=He+Ze+$r,Te=`(?:${[Mr,qe,Xe].join("|")})${Kr}`,_t=class{static{c(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${nt}?${Ke}+${Fe}(?=${[De,nt,"$"].join("|")})`,`${jr}+${Me}(?=${[De,nt+ke,"$"].join("|")})`,`${nt}?${ke}+${Fe}`,`${nt}+${Me}`,Gr,Wr,`${Ge}+`,Te].join("|"),"g");static RS_EMOJI=Te;static unicodeWords(t){return t.match(this.RE_UNICODE_WORDS)}};var St=class i{static{c(this,"SmpCommonUtils")}static arrayRemove(t,e){let r=[],s=t.filter((o,n)=>e(o,n)&&r.push(n));return r.reverse().forEach(o=>t.splice(o,1)),s}static assertIsArray(t,e){if(!Array.isArray(t))throw new Error(e||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(t,e){if(!this.isBoolean(t))throw new Error(e||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(t,e){if(!this.isFunction(t))throw new Error(e||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(t,e,r){if(!(t instanceof e))throw new Error(r||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(t,e){if(this.isEmpty(t))throw new Error(e||`${this.constructor.name} => entity was empty`)}static assertIsNumber(t,e){if(typeof t!="number")throw new Error(e||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(t,e){if(!this.isNumeric(t))throw new Error(e||`${this.constructor.name} => val was not numeric`)}static assertIsObject(t,e){if(!this.isObject(t))throw new Error(e||`${this.constructor.name} => val was not an object`)}static assertIsString(t,e){if(!this.isString(t))throw new Error(e||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(t,e){if(!t)throw new Error(e||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...t){let e=t.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return e.startsWith("http")&&!e.endsWith("/")?`${e}/`:e}static downloadBlob(t,e){let r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.setAttribute("download",e),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let e="0123456789abcdef",r="";for(let s=0;s<t;s++){let o=Math.floor(Math.random()*e.length);r+=e[o]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}static getDecimalPrecision(t){if(this.assertIsNumeric(t),!isFinite(+t))return 0;let e=1,r=0;for(;Math.round(+t*e)/e!==t;)e*=10,r++;return r}static getType(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}static isBoolean(t){return typeof t=="boolean"}static isColor(t){if(!t||!this.isString(t))return!1;let e=new Option().style;return e.color=t,e.color!==""}static isEmpty(t){return!t&&t!==0}static isEqual(t,e){function r(){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!i.isEqual(t[a],e[a]))return!1;return!0}c(r,"areArraysEqual");function s(){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&!i.isEqual(t[a],e[a]))return!1;return!0}c(s,"areObjectsEqual");function o(){return t.toString()===e.toString()}c(o,"areFunctionsEqual");function n(){return t===e}c(n,"arePrimativesEqual");let h=this.getType(t);return h!==this.getType(e)?!1:h==="array"?r():h==="object"?s():h==="function"?o():n()}static isFormField(t){return/^(?:input|select|textarea|button)$/i.test(t.nodeName)}static isFunction(t){return typeof t==typeof isNaN}static isNotEmpty(t){return!this.isEmpty(t)}static isNumber(t){return typeof t=="number"&&this.isNumeric(t)}static isNumeric(t){return!isNaN(t)}static isObject(t){return!!t&&t===Object(t)&&t.constructor===Object}static isPrimitive(t){let e=this.getType(t);return e!=="function"&&(e!=="object"||!t)}static isString(t){return typeof t=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(t,e){if(this.assertIsFunction(e,`CommonUtils => expected type of iteratee to be Function, got ${typeof e}`),this.isObject(t))return Object.entries(t).reduce((r,[s,o])=>(r.push(e(o,s)),r),[]);if(Array.isArray(t))return t.map(e);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof e}`)}static mapObjectKeys(t,e){return Object.entries(t).reduce((r,[s,o])=>(r[s]=e.call(null,s,o),r),{})}static mapObjectValues(t,e){return this.isObject(t)?Object.entries(t).reduce((r,[s,o])=>(r[s]=e.call(null,o,s),r),{}):{}}static noop(){}static objectHasValue(t,e){return!!~Object.values(t).filter(r=>this.isEqual(r,e))}static omit(t,e){return Object.keys(t).filter(s=>!e.includes(s)).reduce((s,o)=>(s[o]=t[o],s),{})}static parseBoolean(t){return t?/^true$/i.test(t):!1}static parseJsonSafely(t){try{return JSON.parse(t)}catch(e){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:t,error:e});return}}static pick(t,e){return e.reduce((r,s)=>(s in t&&(r[s]=t[s]),r),{})}static runSafely(t,e=null,r=[]){if(this.isFunction(t))return t.apply(e,r)}static sleep(t){return new Promise(e=>setTimeout(e,t))}static sprintf(t,...e){return this.isString(t)&&e.length?this.sprintf(t.replace("%s",String(e.shift())),...e):t}static stripComments(t){return typeof t=="string"?t.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):t}static submitFakeForm({action:t,method:e=jt.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([h,a])=>`<input name="${h}" type="hidden" value="${a}" />`),n=document.createElement("form");n.method=e,n.action=t,n.innerHTML=`${o}`,n.target=s||"_self",document.body.append(n),n.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((e,r,s)=>(r=r.toLowerCase(),e+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(t){return this.toCamelCase(t).replace(/^(.)/,e=>e.toUpperCase())}static toSnakeCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(t){return this.toSnakeCase(t).toUpperCase()}static words(t,e){return e===void 0?(_t.HAS_UNICODE_WORD(t)?_t.unicodeWords(t):Ce(t))||[]:t.match(e)||[]}};var te=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(t="Filter Exception",e){super(),this.message=t,this.data=e}};var ee=require("ts-luxon");var re=class i{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return ee.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix="$1";constructor(t=`sid-xxxx-${+ee.DateTime.now().ts}`,e=0){this.value=t,this.expiry=e}static parse(t){return new i(t.value,t.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};var Je=require("@tonysamperi/logger");var se=class{static{c(this,"SmpRegularExpressions")}static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static _country=/[a-zA-Z]{2}/;static _language=/[a-z]{2}/};var Vr="2.0.0-beta.2";0&&(module.exports={SMP_HEALTHZ,SmpAbstractCacheStrategy,SmpAbstractTtlCacheStrategy,SmpAesCrypt,SmpApiCommonUtils,SmpBaseJwtToken,SmpBaseJwtTokenPlain,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpApplyMixin,smpIsSmpCachedValue,smpNoop});
|
|
1
|
+
"use strict";var gt=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var hr=Object.prototype.hasOwnProperty;var c=(i,t)=>gt(i,"name",{value:t,configurable:!0});var cr=(i,t)=>{for(var e in t)gt(i,e,{get:t[e],enumerable:!0})},ar=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of nr(t))!hr.call(i,s)&&s!==e&>(i,s,{get:()=>t[s],enumerable:!(r=or(t,s))||r.enumerable});return i};var lr=i=>ar(gt({},"__esModule",{value:!0}),i);var qr={};cr(qr,{SMP_HEALTHZ:()=>pr,SmpAbstractCacheStrategy:()=>lt,SmpAbstractTtlCacheStrategy:()=>G,SmpAesCrypt:()=>it,SmpApiCommonUtils:()=>Ut,SmpBaseJwtToken:()=>$t,SmpBaseJwtTokenPlain:()=>Wt,SmpBrowserCache:()=>ft,SmpCommonUtils:()=>St,SmpCrypto:()=>Nt,SmpErrorResponse:()=>F,SmpFilterException:()=>te,SmpFirebaseErrors:()=>mr,SmpGenericResponse:()=>Q,SmpGiftcardTransaction:()=>Dt,SmpGiftcardTransactionHashStrategies:()=>H,SmpGiftcardTransactionOps:()=>O,SmpHttpService:()=>Lt,SmpHttpSessionStorageCache:()=>dt,SmpHttpStatusCodes:()=>zt,SmpInMemoryCache:()=>pt,SmpMarketingCloudValidators:()=>xr,SmpRegularExpressions:()=>se,SmpResponseMessage:()=>C,SmpResponseMessageTypes:()=>U,SmpRestVerbs:()=>jt,SmpSecureCode:()=>Pt,SmpSid:()=>re,SmpSocialSignInKeys:()=>ur,SmpSocialSignInUxModes:()=>wr,VERSION:()=>Vr,smpApplyMixin:()=>Er,smpIsSmpCachedValue:()=>Mt,smpNoop:()=>Je.smpNoop});module.exports=lr(qr);var at=require("class-transformer");var j=require("class-transformer");var Ft=require("class-transformer");var U=(function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i})({});function fe(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(fe,"_ts_decorate");function mt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(mt,"_ts_metadata");var C=class i{static{c(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(t,e=U.ERROR){this._message=t,this._type=e}static sanitizeMessages(t){return typeof t=="string"?t.length?[new i(t)]:[]:[t].flat().map(e=>typeof e=="string"?new i(e):e)}};fe([(0,Ft.Expose)(),mt("design:type",String),mt("design:paramtypes",[])],C.prototype,"message",null);fe([(0,Ft.Expose)(),mt("design:type",typeof U>"u"?Object:U),mt("design:paramtypes",[])],C.prototype,"type",null);function fr(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(fr,"_ts_decorate");function de(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(de,"_ts_metadata");var Q=class i{static{c(this,"SmpGenericResponse")}_messages;data;set messages(t){this._messages=C.sanitizeMessages(t)}get messages(){return this._messages}constructor(t=[],e){this._messages=t,this.data=e}static buildInfo(t,e){return new i([t].flat().map(r=>new C(r,U.INFO)),e)}static buildSuccess(t,e){return new i([t].flat().map(r=>new C(r,U.SUCCESS)),e)}static fromPlain(t){return(0,j.plainToInstance)(i,t)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,j.instanceToPlain)(this,{excludePrefixes:["_"]})}};fr([(0,j.Expose)(),(0,j.Transform)(({value:i})=>i?.length?i:void 0),de("design:type",Object),de("design:paramtypes",[])],Q.prototype,"messages",null);function pe(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(pe,"_ts_decorate");function yt(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(yt,"_ts_metadata");var F=class i extends Q{static{c(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new C("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp=Date.now();constructor(t=i.DEFAULT_MESSAGES,e="GENERIC_ERROR",r=500,s){super(t,s),this._errorCode=e,this._status=r}static create({messages:t=i.DEFAULT_MESSAGES,...e}={}){return new i(C.sanitizeMessages(t),e.errorCode,e.status,e.data)}static fromPlain(t){let e=(0,at.plainToInstance)(dr,t,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(e).forEach(s=>{s in r&&(r[s]=e[s])}),r}};pe([(0,at.Expose)(),yt("design:type",Object),yt("design:paramtypes",[])],F.prototype,"errorCode",null);pe([(0,at.Expose)(),yt("design:type",Number),yt("design:paramtypes",[])],F.prototype,"timestamp",null);var dr=class extends F{static{c(this,"SmpErrorResponseMutable")}set errorCode(t){this._errorCode=t}set status(t){this._status=t}set timestamp(t){this._timestamp=t}};var Tt=require("ts-luxon");var lt=class{static{c(this,"SmpAbstractCacheStrategy")}};function Mt(i){return typeof i=="object"&&i!==null&&"value"in i&&"expiry"in i&&typeof i.expiry=="number"}c(Mt,"smpIsSmpCachedValue");var G=class extends lt{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(t){let e=this._readRaw(t);if(this._isSmpCachedValue(e)){if(e.expiry>=Tt.DateTime.now().ts)return e.value;this._removeRaw(t);return}return e}remove(t){this._removeRaw(t)}write(t,e,r){if(isNaN(+r)||+r<=0){this._writeRaw(t,e,r);return}let s=Tt.DateTime.now().ts+r*1e3,o={value:e,expiry:s};this._writeRaw(t,o,r)}_isSmpCachedValue(t){return Mt(t)}};var ft=class extends G{static{c(this,"SmpBrowserCache")}_storage;_prefix;constructor(t,e){super(),this._storage=t,this._prefix=e}_flushRaw(){let t=[],e=-1;for(;++e<this._storage.length;){let r=this._storage.key(e);r&&r.startsWith(this._prefix)&&t.push(r)}for(e=-1;++e<t.length;)this._storage.removeItem(t[e])}_readRaw(t){let e=this._storage.getItem(this._prefix+t);try{return e?JSON.parse(e):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+t}`);return}}_removeRaw(t){this._storage.removeItem(this._prefix+t)}_writeRaw(t,e){try{this._storage.setItem(this._prefix+t,JSON.stringify(e))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+t}`,r)}}};var dt=class extends ft{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var pt=class extends G{static{c(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(t){return this._staticSelf._storage.get(t)}_removeRaw(t){this._staticSelf._storage.delete(t)}_writeRaw(t,e){this._staticSelf._storage.set(t,e)}};var Lt=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new dt:new pt;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=F;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core.com";static $http(t){return this._generateAjax(t)}static async _generateAjax(t){if(t.cacheKey){let e=this._cacheRead(t.cacheKey);return e?Promise.resolve(e):this._generateAjaxBase(t).then(r=>(t.cacheKey&&this._cacheWrite(t.cacheKey,r),r))}return this._generateAjaxBase(t)}static async _generateAjaxBase(t){let e=await this._preprocessRequest(t),r={method:e.method,headers:new Headers({"content-type":"application/json",...e.headers}),body:e.body?JSON.stringify(e.body):null};return e.useCredentials&&(r.credentials="include"),e.url=this.mergeQueryParams(e.url,e.queryParams),fetch(e.url,r).then(s=>this._preprocessResponse(t,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(e.responseType){case"blob":return s.blob();case"arraybuffer":return s.arrayBuffer();case"text":return s.text();case"json":default:return s.json()}}return s.json().then(o=>{let n=o;try{n=this._errorClass.fromPlain(o)}catch(h){console.debug("http: failed to parse error response into ErrorResponse",h)}return Promise.reject({status:s.status,message:s.statusText,body:n})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(t,e){let r=t.startsWith("http");if(e){let s=new URL(t,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),o=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...o,...Object.fromEntries(Object.entries(e).map(([n,h])=>[n,`${h}`]))}).toString(),t=r?s.href:s.pathname+s.search}return t}static _cacheKey(t){return`${this._config.cachePrefix}${t}`}static _cachePop(t){let e=this._cacheRead(t);return this._cacheRemove(t),e}static _cacheRead(t){return this._cacheStrategy.read(this._cacheKey(t))}static _cacheRemove(t){this._cacheStrategy.remove(this._cacheKey(t))}static _cacheWrite(t,e){this._cacheStrategy.write(this._cacheKey(t),e)}static async _preprocessRequest(t){return t}static async _preprocessResponse(t,e){return e}};var zt=(function(i){return i[i.Continue=100]="Continue",i[i.SwitchingProtocols=101]="SwitchingProtocols",i[i.Processing=102]="Processing",i[i.EarlyHints=103]="EarlyHints",i[i.Ok=200]="Ok",i[i.Created=201]="Created",i[i.Accepted=202]="Accepted",i[i.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",i[i.NoContent=204]="NoContent",i[i.ResetContent=205]="ResetContent",i[i.PartialContent=206]="PartialContent",i[i.MultiStatus=207]="MultiStatus",i[i.AlreadyReported=208]="AlreadyReported",i[i.ImUsed=226]="ImUsed",i[i.MultipleChoices=300]="MultipleChoices",i[i.MovedPermanently=301]="MovedPermanently",i[i.Found=302]="Found",i[i.SeeOther=303]="SeeOther",i[i.NotModified=304]="NotModified",i[i.UseProxy=305]="UseProxy",i[i.Unused=306]="Unused",i[i.TemporaryRedirect=307]="TemporaryRedirect",i[i.PermanentRedirect=308]="PermanentRedirect",i[i.BadRequest=400]="BadRequest",i[i.Unauthorized=401]="Unauthorized",i[i.PaymentRequired=402]="PaymentRequired",i[i.Forbidden=403]="Forbidden",i[i.NotFound=404]="NotFound",i[i.MethodNotAllowed=405]="MethodNotAllowed",i[i.NotAcceptable=406]="NotAcceptable",i[i.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",i[i.RequestTimeout=408]="RequestTimeout",i[i.Conflict=409]="Conflict",i[i.Gone=410]="Gone",i[i.LengthRequired=411]="LengthRequired",i[i.PreconditionFailed=412]="PreconditionFailed",i[i.PayloadTooLarge=413]="PayloadTooLarge",i[i.UriTooLong=414]="UriTooLong",i[i.UnsupportedMediaType=415]="UnsupportedMediaType",i[i.RangeNotSatisfiable=416]="RangeNotSatisfiable",i[i.ExpectationFailed=417]="ExpectationFailed",i[i.ImATeapot=418]="ImATeapot",i[i.MisdirectedRequest=421]="MisdirectedRequest",i[i.UnprocessableEntity=422]="UnprocessableEntity",i[i.Locked=423]="Locked",i[i.FailedDependency=424]="FailedDependency",i[i.TooEarly=425]="TooEarly",i[i.UpgradeRequired=426]="UpgradeRequired",i[i.PreconditionRequired=428]="PreconditionRequired",i[i.TooManyRequests=429]="TooManyRequests",i[i.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",i[i.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",i[i.InternalServerError=500]="InternalServerError",i[i.NotImplemented=501]="NotImplemented",i[i.BadGateway=502]="BadGateway",i[i.ServiceUnavailable=503]="ServiceUnavailable",i[i.GatewayTimeout=504]="GatewayTimeout",i[i.HttpVersionNotSupported=505]="HttpVersionNotSupported",i[i.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",i[i.InsufficientStorage=507]="InsufficientStorage",i[i.LoopDetected=508]="LoopDetected",i[i.NotExtended=510]="NotExtended",i[i.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",i})({});var ue=require("@tonysamperi/logger");var Ut=class{static{c(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new ue.SmpLoggerMethods;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(t,e){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}static fromBearer(t=""){return t.split(" ")[1]}static getCountryFromReferer(t){return this.getLocaleFromReferer(t)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(t){return this.getLocaleFromReferer(t)?.split("-")[1]}static getLocaleFromReferer(t){return t?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(t,e){try{return t.replace(this._pathParamRegex,(r,s)=>{let o=e[s];return o!==void 0?encodeURIComponent(o):r})}catch(r){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,r)}return t}};var pr={status:"OK"};var jt=(function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i})({});var $t=class{static{c(this,"SmpBaseJwtToken")}_access_token;_exp;_iss;get access_token(){return this._access_token}get exp(){return this._exp}get iss(){return this._iss}constructor(t,e,r){this._access_token=t,this._exp=e,this._iss=r}serialize(){return{access_token:this._access_token,exp:this._exp,iss:this._iss}}};var Wt=class{static{c(this,"SmpBaseJwtTokenPlain")}access_token;exp;iss};var ur=(function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i})({});var wr=(function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i})({});var $=class{static{c(this,"Hex")}static parse(t){let e=t.length,r=[];for(let s=0;s<e;s+=2)r[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new _(r,e/2)}static stringify(t){let e=[];for(let r=0;r<t.sigBytes;r++){let s=t.words[r>>>2]>>>24-r%4*8&255;e.push((s>>>4).toString(16)),e.push((s&15).toString(16))}return e.join("")}};var _=class Gt{static{c(this,"WordArray")}constructor(t,e){this.words=t||[],e!==void 0?this.sigBytes=e:this.sigBytes=this.words.length*4}static random(t){let e=[],r=c(function(s){let o=987654321,n=4294967295;return function(){o=36969*(o&65535)+(o>>16)&n,s=18e3*(s&65535)+(s>>16)&n;let h=(o<<16)+s&n;return h/=4294967296,h+=.5,h*(Math.random()>.5?1:-1)}},"r");for(let s=0,o;s<t;s+=4){let n=r((o||Math.random())*4294967296);o=n()*987654071,e.push(n()*4294967296|0)}return new Gt(e,t)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new Gt(this.words.slice(0),this.sigBytes)}concat(t){if(this.clamp(),this.sigBytes%4)for(let e=0;e<t.sigBytes;e++){let r=t.words[e>>>2]>>>24-e%4*8&255;this.words[this.sigBytes+e>>>2]|=r<<24-(this.sigBytes+e)%4*8}else for(let e=0;e<t.sigBytes;e+=4)this.words[this.sigBytes+e>>>2]=t.words[e>>>2];return this.sigBytes+=t.sigBytes,this}toString(t){return(t||$).stringify(this)}};var xt=class{static{c(this,"Latin1")}static parse(t){let e=t.length,r=[];for(let s=0;s<e;s++)r[s>>>2]|=(t.charCodeAt(s)&255)<<24-s%4*8;return new _(r,e)}static stringify(t){let e=[];for(let r=0;r<t.sigBytes;r++){let s=t.words[r>>>2]>>>24-r%4*8&255;e.push(String.fromCharCode(s))}return e.join("")}};var R=class{static{c(this,"Utf8")}static parse(t){return xt.parse(unescape(encodeURIComponent(t)))}static stringify(t){try{return decodeURIComponent(escape(xt.stringify(t)))}catch(e){throw console.error("Malformed UTF-8 data",e),new Error("Malformed UTF-8 data")}}};var Et=class{static{c(this,"BufferedBlockAlgorithm")}constructor(t){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},t),this._data=new _,this._nDataBytes=0}clone(){let t=this.constructor();for(let e in this)Object.prototype.hasOwnProperty.call(this,e)&&(t[e]=this[e]);return t._data=this._data.clone(),t}reset(){this._data=new _,this._nDataBytes=0}_append(t){typeof t=="string"&&(t=R.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(t){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let e=this.cfg.blockSize*4,r=this._data.sigBytes/e;t?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let s=r*this.cfg.blockSize,o=Math.min(s*4,this._data.sigBytes),n;if(s){for(let h=0;h<s;h+=this.cfg.blockSize)this._doProcessBlock(this._data.words,h);n=this._data.words.splice(0,s),this._data.sigBytes-=o}return new _(n,o)}};var S=class{static{c(this,"CipherParams")}constructor(t){this.ciphertext=t.ciphertext,this.key=t.key,this.iv=t.iv,this.salt=t.salt,this.algorithm=t.algorithm,this.mode=t.mode,this.padding=t.padding,this.blockSize=t.blockSize,this.formatter=t.formatter}extend(t){return t.ciphertext!==void 0&&(this.ciphertext=t.ciphertext),t.key!==void 0&&(this.key=t.key),t.iv!==void 0&&(this.iv=t.iv),t.salt!==void 0&&(this.salt=t.salt),t.algorithm!==void 0&&(this.algorithm=t.algorithm),t.mode!==void 0&&(this.mode=t.mode),t.padding!==void 0&&(this.padding=t.padding),t.blockSize!==void 0&&(this.blockSize=t.blockSize),t.formatter!==void 0&&(this.formatter=t.formatter),this}toString(t){if(t)return t.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var T=class{static{c(this,"Base64")}static parse(t){let e=t.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=t.indexOf(r);s!==-1&&(e=s)}return this.parseLoop(t,e,this._reverseMap)}static parseLoop(t,e,r){let s=[],o=0;for(let n=0;n<e;n++)if(n%4){let h=r[t.charCodeAt(n-1)]<<n%4*2,a=r[t.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(h|a)<<24-o%4*8,o++}return new _(s,o)}static stringify(t){t.clamp();let e=[];for(let s=0;s<t.sigBytes;s+=3){let o=t.words[s>>>2]>>>24-s%4*8&255,n=t.words[s+1>>>2]>>>24-(s+1)%4*8&255,h=t.words[s+2>>>2]>>>24-(s+2)%4*8&255,a=o<<16|n<<8|h;for(let p=0;p<4&&s+p*.75<t.sigBytes;p++)e.push(this._map.charAt(a>>>6*(3-p)&63))}let r=this._map.charAt(64);if(r)for(;e.length%4;)e.push(r);return e.join("")}};T._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";T._reverseMap=void 0;var Rt=class{static{c(this,"OpenSSL")}static parse(t){let e=T.parse(t),r;return e.words[0]===1398893684&&e.words[1]===1701076831&&(r=new _(e.words.slice(2,4)),e.words.splice(0,4),e.sigBytes-=16),new S({ciphertext:e,salt:r})}static stringify(t){if(!t.ciphertext)throw new Error("missing ciphertext in params");let e=t.ciphertext,r=t.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(r).concat(e)}else s=e;return s.toString(T)}};var K=class{static{c(this,"SerializableCipher")}static decrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(!o.format)throw new Error("could not determine format");if(e=this._parse(e,o.format),!e.ciphertext)throw new Error("could not determine ciphertext");return t.createDecryptor(r,o).finalize(e.ciphertext)}static encrypt(t,e,r,s){let o=Object.assign({},this.cfg,s),n=t.createEncryptor(r,o),h=n.finalize(e);return new S({ciphertext:h,key:r,iv:n.cfg.iv,algorithm:t,mode:n.cfg.mode,padding:n.cfg.padding,blockSize:n.cfg.blockSize,formatter:o.format})}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};K.cfg={blockSize:4,iv:new _([]),format:Rt};var E=class extends Et{static{c(this,"Hasher")}constructor(t){super(Object.assign({blockSize:512/32},t)),this.reset()}static _createHelper(t){function e(r,s){return new t(s).finalize(r)}return c(e,"helper"),e}finalize(t){return t&&this._append(t),this._doFinalize()}update(t){return this._append(t),this._process(),this}};var f=[];for(let i=0;i<64;i++)f[i]=Math.abs(Math.sin(i+1))*4294967296|0;var L=class d extends E{static{c(this,"MD5")}get hash(){return this._hash}static FF(t,e,r,s,o,n,h){let a=t+(e&r|~e&s)+o+h;return(a<<n|a>>>32-n)+e}static GG(t,e,r,s,o,n,h){let a=t+(e&s|r&~s)+o+h;return(a<<n|a>>>32-n)+e}static HH(t,e,r,s,o,n,h){let a=t+(e^r^s)+o+h;return(a<<n|a>>>32-n)+e}static II(t,e,r,s,o,n,h){let a=t+(r^(e|~s))+o+h;return(a<<n|a>>>32-n)+e}reset(){super.reset(),this._hash=new _([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;this._data.words[e>>>5]|=128<<24-e%32;let r=Math.floor(t/4294967296),s=t;this._data.words[(e+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(e+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let o=0;o<4;o++)this._hash.words[o]=(this._hash.words[o]<<8|this._hash.words[o]>>>24)&16711935|(this._hash.words[o]<<24|this._hash.words[o]>>>8)&4278255360;return this._hash}_doProcessBlock(t,e){for(let a=0;a<16;a++){let p=e+a,w=t[p];t[p]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}let r=Array.from({length:16});for(let a=0;a<16;a++)r[a]=t[e+a];let s=this._hash.words[0],o=this._hash.words[1],n=this._hash.words[2],h=this._hash.words[3];s=d.FF(s,o,n,h,r[0],7,f[0]),h=d.FF(h,s,o,n,r[1],12,f[1]),n=d.FF(n,h,s,o,r[2],17,f[2]),o=d.FF(o,n,h,s,r[3],22,f[3]),s=d.FF(s,o,n,h,r[4],7,f[4]),h=d.FF(h,s,o,n,r[5],12,f[5]),n=d.FF(n,h,s,o,r[6],17,f[6]),o=d.FF(o,n,h,s,r[7],22,f[7]),s=d.FF(s,o,n,h,r[8],7,f[8]),h=d.FF(h,s,o,n,r[9],12,f[9]),n=d.FF(n,h,s,o,r[10],17,f[10]),o=d.FF(o,n,h,s,r[11],22,f[11]),s=d.FF(s,o,n,h,r[12],7,f[12]),h=d.FF(h,s,o,n,r[13],12,f[13]),n=d.FF(n,h,s,o,r[14],17,f[14]),o=d.FF(o,n,h,s,r[15],22,f[15]),s=d.GG(s,o,n,h,r[1],5,f[16]),h=d.GG(h,s,o,n,r[6],9,f[17]),n=d.GG(n,h,s,o,r[11],14,f[18]),o=d.GG(o,n,h,s,r[0],20,f[19]),s=d.GG(s,o,n,h,r[5],5,f[20]),h=d.GG(h,s,o,n,r[10],9,f[21]),n=d.GG(n,h,s,o,r[15],14,f[22]),o=d.GG(o,n,h,s,r[4],20,f[23]),s=d.GG(s,o,n,h,r[9],5,f[24]),h=d.GG(h,s,o,n,r[14],9,f[25]),n=d.GG(n,h,s,o,r[3],14,f[26]),o=d.GG(o,n,h,s,r[8],20,f[27]),s=d.GG(s,o,n,h,r[13],5,f[28]),h=d.GG(h,s,o,n,r[2],9,f[29]),n=d.GG(n,h,s,o,r[7],14,f[30]),o=d.GG(o,n,h,s,r[12],20,f[31]),s=d.HH(s,o,n,h,r[5],4,f[32]),h=d.HH(h,s,o,n,r[8],11,f[33]),n=d.HH(n,h,s,o,r[11],16,f[34]),o=d.HH(o,n,h,s,r[14],23,f[35]),s=d.HH(s,o,n,h,r[1],4,f[36]),h=d.HH(h,s,o,n,r[4],11,f[37]),n=d.HH(n,h,s,o,r[7],16,f[38]),o=d.HH(o,n,h,s,r[10],23,f[39]),s=d.HH(s,o,n,h,r[13],4,f[40]),h=d.HH(h,s,o,n,r[0],11,f[41]),n=d.HH(n,h,s,o,r[3],16,f[42]),o=d.HH(o,n,h,s,r[6],23,f[43]),s=d.HH(s,o,n,h,r[9],4,f[44]),h=d.HH(h,s,o,n,r[12],11,f[45]),n=d.HH(n,h,s,o,r[15],16,f[46]),o=d.HH(o,n,h,s,r[2],23,f[47]),s=d.II(s,o,n,h,r[0],6,f[48]),h=d.II(h,s,o,n,r[7],10,f[49]),n=d.II(n,h,s,o,r[14],15,f[50]),o=d.II(o,n,h,s,r[5],21,f[51]),s=d.II(s,o,n,h,r[12],6,f[52]),h=d.II(h,s,o,n,r[3],10,f[53]),n=d.II(n,h,s,o,r[10],15,f[54]),o=d.II(o,n,h,s,r[1],21,f[55]),s=d.II(s,o,n,h,r[8],6,f[56]),h=d.II(h,s,o,n,r[15],10,f[57]),n=d.II(n,h,s,o,r[6],15,f[58]),o=d.II(o,n,h,s,r[13],21,f[59]),s=d.II(s,o,n,h,r[4],6,f[60]),h=d.II(h,s,o,n,r[11],10,f[61]),n=d.II(n,h,s,o,r[2],15,f[62]),o=d.II(o,n,h,s,r[9],21,f[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+n|0,this._hash.words[3]=this._hash.words[3]+h|0}};var Kt=class we{static{c(this,"EVPKDF")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:L,iterations:1},t)}static execute(t,e,r){return new we(r).compute(t,e)}compute(t,e){let r=new this.cfg.hasher,s=new _,o;for(;s.words.length<this.cfg.keySize;){o&&r.update(o),o=r.update(t).finalize(e),r.reset();for(let n=1;n<this.cfg.iterations;n++)o=r.finalize(o),r.reset();s.concat(o)}return s.sigBytes=this.cfg.keySize*4,s}};var _e=class{static{c(this,"OpenSSLKdf")}static execute(t,e,r,s){s||(s=_.random(64/8));let o=new Kt({keySize:e+r}).compute(t,s),n=new _(o.words.slice(e),r*4);return o.sigBytes=e*4,new S({key:o,iv:n,salt:s})}};var At=class{static{c(this,"PasswordBasedCipher")}static decrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(o.format===void 0)throw new Error("missing format in config");if(e=this._parse(e,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let n=o.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv!==void 0&&(o.iv=n.iv),K.decrypt.call(this,t,e,n.key,o)}static encrypt(t,e,r,s){let o=Object.assign({},this.cfg,s);if(o.kdf===void 0)throw new Error("missing kdf in config");let n=o.kdf.execute(r,t.keySize,t.ivSize);return n.iv!==void 0&&(o.iv=n.iv),K.encrypt.call(this,t,e,n.key,o).extend(n)}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};At.cfg={blockSize:4,iv:new _([]),format:Rt,kdf:_e};var ge=class{static{c(this,"CipherHelper")}constructor(t){this._cipher=t}decrypt(t,e,r){return typeof e=="string"?At.decrypt(this._cipher,t,e,r):K.decrypt(this._cipher,t,e,r)}encrypt(t,e,r){return typeof e=="string"?At.encrypt(this._cipher,t,e,r):K.encrypt(this._cipher,t,e,r)}};var tt=class extends Et{static{c(this,"Cipher")}constructor(t,e,r){super(Object.assign({blockSize:1},r)),this._xformMode=t,this._key=e,this.reset()}static _createHelper(t){return new ge(t)}static createDecryptor(t,e){let r=this;return new r(this._DEC_XFORM_MODE,t,e)}static createEncryptor(t,e){return new this(this._ENC_XFORM_MODE,t,e)}finalize(t){return t&&this._append(t),this._doFinalize()}process(t){return this._append(t),this._process()}};tt.ivSize=4;tt.keySize=4;tt._DEC_XFORM_MODE=2;tt._ENC_XFORM_MODE=1;var V=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(t,e){this.init(t,e)}init(t,e){this._cipher=t,this._iv=e}};var Bt=class{static{c(this,"BlockCipherMode")}static createDecryptor(t,e){let r=this.Decryptor;return new r(t,e)}static createEncryptor(t,e){let r=this.Encryptor;return new r(t,e)}};Bt.Decryptor=V;Bt.Encryptor=V;var me=class extends V{static{c(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(t,e){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(t,e,this._cipher.cfg.blockSize),this._cipher.encryptBlock(t,e),this._prevBlock=t.slice(e,e+this._cipher.cfg.blockSize)}xorBlock(t,e,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)t[e+o]^=s[o]}};var ye=class extends V{static{c(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(t,e){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=t.slice(e,e+this._cipher.cfg.blockSize);this._cipher.decryptBlock(t,e),this.xorBlock(t,e,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(t,e,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)t[e+o]^=s[o]}};var W=class extends Bt{static{c(this,"CBC")}};W.Decryptor=ye;W.Encryptor=me;var et=class{static{c(this,"PKCS7")}static pad(t,e){let r=e*4,s=r-t.sigBytes%r,o=s<<24|s<<16|s<<8|s,n=[];for(let a=0;a<s;a+=4)n.push(o);let h=new _(n,s);t.concat(h)}static unpad(t){let e=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=e}};var Ot=class extends tt{static{c(this,"BlockCipher")}constructor(t,e,r){super(t,e,Object.assign({blockSize:4,mode:W,padding:et},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let t;this._xformMode===this.constructor._ENC_XFORM_MODE?t=this.cfg.mode.createEncryptor:(t=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===t?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=t.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=t)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let t;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),t=this._process(!0)}else t=this._process(!0),this.cfg.padding.unpad(t);return t}_doProcessBlock(t,e){this._mode.processBlock(t,e)}};var l=class M{static{c(this,"X64Word")}constructor(t,e){this.high=t,this.low=e}add(t){let e=this.low+t.low|0,r=e>>>0<this.low>>>0?1:0,s=this.high+t.high+r|0;return new M(s,e)}and(t){return new M(this.high&t.high,this.low&t.low)}not(){return new M(~this.high,~this.low)}or(t){return new M(this.high|t.high,this.low|t.low)}rotL(t){return this.shiftL(t).or(this.shiftR(64-t))}rotR(t){return this.shiftR(t).or(this.shiftL(64-t))}shiftL(t){return t<32?new M(this.high<<t|this.low>>>32-t,this.low<<t):new M(this.low<<t-32,0)}shiftR(t){return t<32?new M(this.high>>>t,this.low>>>t|this.high<<32-t):new M(0,this.high>>>t-32)}xor(t){return new M(this.high^t.high,this.low^t.low)}};var xe=class Vt{static{c(this,"X64WordArray")}constructor(t=[],e){this.words=t,this.sigBytes=e!==void 0?e:t.length*8}static create(t=[],e){return new Vt(t,e)}clone(){let t=this.words.map(e=>new l(e.high,e.low));return new Vt(t,this.sigBytes)}toX32(){let t=[];for(let e of this.words)t.push(e.high,e.low);return new _(t,this.sigBytes)}};var B=[],Ee=[],Re=[],Ae=[],Be=[],Oe=[],qt=[],Xt=[],Zt=[],Ht=[];(function(){let i=[];for(let r=0;r<256;r++)r<128?i[r]=r<<1:i[r]=r<<1^283;let t=0,e=0;for(let r=0;r<256;r++){let s=e^e<<1^e<<2^e<<3^e<<4;s=s>>>8^s&255^99,B[t]=s,Ee[s]=t;let o=i[t],n=i[o],h=i[n],a=i[s]*257^s*16843008;Re[t]=a<<24|a>>>8,Ae[t]=a<<16|a>>>16,Be[t]=a<<8|a>>>24,Oe[t]=a,a=h*16843009^n*65537^o*257^t*16843008,qt[s]=a<<24|a>>>8,Xt[s]=a<<16|a>>>16,Zt[s]=a<<8|a>>>24,Ht[s]=a,t?(t=o^i[i[i[h^o]]],e^=i[i[e]]):t=e=1}})();var _r=[0,1,2,4,8,16,32,64,128,27,54],bt=class extends Ot{static{c(this,"AES")}constructor(t,e,r){super(t,e,r),super.reset()}decryptBlock(t,e){let r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,qt,Xt,Zt,Ht,Ee),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r}encryptBlock(t,e){this._doCryptBlock(t,e,this._keySchedule,Re,Ae,Be,Oe,B)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,o=((this._nRounds=r+6)+1)*4,n=this._keySchedule=[];for(let h=0;h<o;h++)if(h<r)n[h]=e[h];else{let a=n[h-1];h%r?r>6&&h%r===4&&(a=B[a>>>24]<<24|B[a>>>16&255]<<16|B[a>>>8&255]<<8|B[a&255]):(a=a<<8|a>>>24,a=B[a>>>24]<<24|B[a>>>16&255]<<16|B[a>>>8&255]<<8|B[a&255],a^=_r[h/r|0]<<24),n[h]=n[h-r]^a}this._invKeySchedule=[];for(let h=0;h<o;h++){let a=o-h,p;h%4?p=n[a]:p=n[a-4],h<4||a<=4?this._invKeySchedule[h]=p:this._invKeySchedule[h]=qt[B[p>>>24]]^Xt[B[p>>>16&255]]^Zt[B[p>>>8&255]]^Ht[B[p&255]]}}_doCryptBlock(t,e,r,s,o,n,h,a){let p=t[e]^r[0],w=t[e+1]^r[1],u=t[e+2]^r[2],g=t[e+3]^r[3],x=4;for(let A=1;A<this._nRounds;A++){let m=s[p>>>24]^o[w>>>16&255]^n[u>>>8&255]^h[g&255]^r[x++],y=s[w>>>24]^o[u>>>16&255]^n[g>>>8&255]^h[p&255]^r[x++],P=s[u>>>24]^o[g>>>16&255]^n[p>>>8&255]^h[w&255]^r[x++],kt=s[g>>>24]^o[p>>>16&255]^n[w>>>8&255]^h[u&255]^r[x++];p=m,w=y,u=P,g=kt}let b=(a[p>>>24]<<24|a[w>>>16&255]<<16|a[u>>>8&255]<<8|a[g&255])^r[x++],k=(a[w>>>24]<<24|a[u>>>16&255]<<16|a[g>>>8&255]<<8|a[p&255])^r[x++],v=(a[u>>>24]<<24|a[g>>>16&255]<<16|a[p>>>8&255]<<8|a[w&255])^r[x++],N=(a[g>>>24]<<24|a[p>>>16&255]<<16|a[w>>>8&255]<<8|a[u&255])^r[x++];t[e]=b,t[e+1]=k,t[e+2]=v,t[e+3]=N}};bt.keySize=256/32;var gr=[1732584193,4023233417,2562383102,271733878,3285377520],q=new Array(80),X=class extends E{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(gr.slice(0))}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(e+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,e){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],h=this._hash.words[4];for(let a=0;a<80;a++){if(a<16)q[a]=t[e+a]|0;else{let g=q[a-3]^q[a-8]^q[a-14]^q[a-16];q[a]=g<<1|g>>>31}let p,w;a<20?(p=s&o|~s&n,w=1518500249):a<40?(p=s^o^n,w=1859775393):a<60?(p=s&o|s&n|o&n,w=2400959708):(p=s^o^n,w=3395469782);let u=(r<<5|r>>>27)+p+h+w+q[a];h=n,n=o,o=s<<30|s>>>2,s=r,r=u|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+h|0}};var be=[],Ie=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}c(i,"isPrime");function t(s){return(s-(s|0))*4294967296|0}c(t,"getFractionalBits");let e=2,r=0;for(;r<64;)i(e)&&(r<8&&(be[r]=t(Math.pow(e,1/2))),Ie[r]=t(Math.pow(e,1/3)),r++),e++})();var Z=[],ut=class extends E{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(be.slice(0))}_doFinalize(){let t=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(t/4294967296),this._data.words[(e+64>>>9<<4)+15]=t,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(t,e){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],h=this._hash.words[4],a=this._hash.words[5],p=this._hash.words[6],w=this._hash.words[7];for(let u=0;u<64;u++){if(u<16)Z[u]=t[e+u]|0;else{let A=Z[u-15],m=(A<<25|A>>>7)^(A<<14|A>>>18)^A>>>3,y=Z[u-2],P=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;Z[u]=m+Z[u-7]+P+Z[u-16]}let g=h&a^~h&p,x=r&s^r&o^s&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),k=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),v=w+k+g+Ie[u]+Z[u],N=b+x;w=p,p=a,a=h,h=n+v|0,n=o,o=s,s=r,r=v+N|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+h|0,this._hash.words[5]=this._hash.words[5]+a|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+w|0}};var Jt=[new l(1116352408,3609767458),new l(1899447441,602891725),new l(3049323471,3964484399),new l(3921009573,2173295548),new l(961987163,4081628472),new l(1508970993,3053834265),new l(2453635748,2937671579),new l(2870763221,3664609560),new l(3624381080,2734883394),new l(310598401,1164996542),new l(607225278,1323610764),new l(1426881987,3590304994),new l(1925078388,4068182383),new l(2162078206,991336113),new l(2614888103,633803317),new l(3248222580,3479774868),new l(3835390401,2666613458),new l(4022224774,944711139),new l(264347078,2341262773),new l(604807628,2007800933),new l(770255983,1495990901),new l(1249150122,1856431235),new l(1555081692,3175218132),new l(1996064986,2198950837),new l(2554220882,3999719339),new l(2821834349,766784016),new l(2952996808,2566594879),new l(3210313671,3203337956),new l(3336571891,1034457026),new l(3584528711,2466948901),new l(113926993,3758326383),new l(338241895,168717936),new l(666307205,1188179964),new l(773529912,1546045734),new l(1294757372,1522805485),new l(1396182291,2643833823),new l(1695183700,2343527390),new l(1986661051,1014477480),new l(2177026350,1206759142),new l(2456956037,344077627),new l(2730485921,1290863460),new l(2820302411,3158454273),new l(3259730800,3505952657),new l(3345764771,106217008),new l(3516065817,3606008344),new l(3600352804,1432725776),new l(4094571909,1467031594),new l(275423344,851169720),new l(430227734,3100823752),new l(506948616,1363258195),new l(659060556,3750685593),new l(883997877,3785050280),new l(958139571,3318307427),new l(1322822218,3812723403),new l(1537002063,2003034995),new l(1747873779,3602036899),new l(1955562222,1575990012),new l(2024104815,1125592928),new l(2227730452,2716904306),new l(2361852424,442776044),new l(2428436474,593698344),new l(2756734187,3733110249),new l(3204031479,2999351573),new l(3329325298,3815920427),new l(3391569614,3928383900),new l(3515267271,566280711),new l(3940187606,3454069534),new l(4118630271,4000239992),new l(116418474,1914138554),new l(174292421,2731055270),new l(289380356,3203993006),new l(460393269,320620315),new l(685471733,587496836),new l(852142971,1086792851),new l(1017036298,365543100),new l(1126000580,2618297676),new l(1288033470,3409855158),new l(1501505948,4234509866),new l(1607167915,987167468),new l(1816402316,1246189591)],D=[];(function(){for(let i=0;i<80;i++)D[i]=new l(void 0,void 0)})();var Yt=class extends E{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new xe([new l(1779033703,4089235720),new l(3144134277,2227873595),new l(1013904242,4271175723),new l(2773480762,1595750129),new l(1359893119,2917565137),new l(2600822924,725511199),new l(528734635,4215389547),new l(1541459225,327033209)])}_doFinalize(){let t=this._data,e=t.words,r=this._nDataBytes*8,s=t.sigBytes*8;return e[s>>>5]|=128<<24-s%32,e[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),e[(s+128>>>10<<5)+31]=r,t.sigBytes=e.length*4,this._process(),this._hash.toX32()}_doProcessBlock(t,e){let r=this._hash.words[0].high,s=this._hash.words[0].low,o=this._hash.words[1].high,n=this._hash.words[1].low,h=this._hash.words[2].high,a=this._hash.words[2].low,p=this._hash.words[3].high,w=this._hash.words[3].low,u=this._hash.words[4].high,g=this._hash.words[4].low,x=this._hash.words[5].high,b=this._hash.words[5].low,k=this._hash.words[6].high,v=this._hash.words[6].low,N=this._hash.words[7].high,A=this._hash.words[7].low;for(let m=0;m<80;m++){let y,P;if(m<16)P=D[m].high=t[e+m*2]|0,y=D[m].low=t[e+m*2+1]|0;else{let he=D[m-15],J=he.high,ht=he.low,sr=(J>>>1|ht<<31)^(J>>>8|ht<<24)^J>>>7,ce=(ht>>>1|J<<31)^(ht>>>8|J<<24)^(ht>>>7|J<<25),ae=D[m-2],Y=ae.high,ct=ae.low,ir=(Y>>>19|ct<<13)^(Y<<3|ct>>>29)^Y>>>6,le=(ct>>>19|Y<<13)^(ct<<3|Y>>>29)^(ct>>>6|Y<<26);y=ce+D[m-7].low,P=sr+D[m-7].high+(y>>>0<ce>>>0?1:0),y=y+le,P=P+ir+(y>>>0<le>>>0?1:0),y=y+D[m-16].low,P=P+D[m-16].high+(y>>>0<D[m-16].low>>>0?1:0),D[m].high=P,D[m].low=y}let kt=u&x^~u&k,ie=g&b^~g&v,Ye=r&o^r&h^o&h,Qe=s&n^s&a^n&a,Se=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),oe=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),tr=(u>>>14|g<<18)^(u>>>18|g<<14)^(u<<23|g>>>9),er=(g>>>14|u<<18)^(g>>>18|u<<14)^(g<<23|u>>>9),I=A+er,z=N+tr+(I>>>0<A>>>0?1:0);I=I+ie,z=z+kt+(I>>>0<ie>>>0?1:0),I=I+Jt[m].low,z=z+Jt[m].high+(I>>>0<Jt[m].low>>>0?1:0),I=I+y,z=z+P+(I>>>0<y>>>0?1:0);let ne=oe+Qe,rr=Se+Ye+(ne>>>0<oe>>>0?1:0);N=k,A=v,k=x,v=b,x=u,b=g,g=w+I|0,u=p+z+(g>>>0<w>>>0?1:0)|0,p=h,w=a,h=o,a=n,o=r,n=s,s=I+ne|0,r=z+rr+(s>>>0<I>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+n,this._hash.words[1].high=this._hash.words[1].high+o+(this._hash.words[1].low>>>0<n>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+a,this._hash.words[2].high=this._hash.words[2].high+h+(this._hash.words[2].low>>>0<a>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+w,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<w>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+g,this._hash.words[4].high=this._hash.words[4].high+u+(this._hash.words[4].low>>>0<g>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+b,this._hash.words[5].high=this._hash.words[5].high+x+(this._hash.words[5].low>>>0<b>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+v,this._hash.words[6].high=this._hash.words[6].high+k+(this._hash.words[6].low>>>0<v>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+A,this._hash.words[7].high=this._hash.words[7].high+N+(this._hash.words[7].low>>>0<A>>>0?1:0)}};var ve=class{static{c(this,"HMAC")}constructor(t,e){this._hasher=new t;let r=typeof e=="string"?R.parse(e):e,s=this._hasher.cfg.blockSize,o=s*4;r.sigBytes>o&&(r=this._hasher.finalize(r)),r.clamp();let n=this._oKey=r.clone(),h=this._iKey=r.clone(),a=n.words,p=h.words;for(let w=0;w<s;w++)a[w]^=1549556828,p[w]^=909522486;n.sigBytes=h.sigBytes=o,this.reset()}finalize(t){let e=this._hasher.finalize(t);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(e))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(t){return this._hasher.update(t),this}};var Qt=class Ne{static{c(this,"PBKDF2")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:ut,iterations:25e4},t)}static execute(t,e,r){return new Ne(r).compute(t,e)}compute(t,e){let r=this.cfg,s=new ve(r.hasher,t),o=new _,n=new _([1]),h=o.words,a=n.words,p=r.keySize,w=r.iterations;for(;h.length<p;){let u=s.update(e).finalize(n);s.reset();let g=u.words,x=g.length,b=u;for(let k=1;k<w;k++){b=s.finalize(b),s.reset();let v=b.words;for(let N=0;N<x;N++)g[N]^=v[N]}o.concat(u),a[0]++}return o.sigBytes=p*4,o}};var wt=Ot._createHelper(bt);var rt=E._createHelper(L);var st=E._createHelper(X);var It=E._createHelper(ut);var vt=E._createHelper(Yt);var it=class{static{c(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?$.parse(this._initVector):void 0}_mode=W;_padding=et;constructor(t,e,r){this._password=t,this._salt=e,this._initVector=r}decryptAES(t){return wt.decrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(R)}encryptAES(t){return wt.encrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Qt.execute(this._password,$.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:X})}};var Nt=class{static{c(this,"SmpCrypto")}static base64Decode(t){return R.stringify(T.parse(t))}static base64Encode(t){return T.stringify(R.parse(t))}static md5(t){return rt(t).toString()}static sha1(t){return st(t).toString()}static sha256(t){return It(t).toString()}static sha512(t){return vt(t).toString()}};var Pt=class{static{c(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength=5;_seed="changeme";constructor(t){this._baseCode=t}static check(t,e){if(new this(t).secureCode!==e)throw F.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:zt.BadRequest})}_encode(){let t=new L;return t.update(R.parse(this._seed+this._baseCode)),t.finalize().toString($).substring(0,this._crcLength).toUpperCase()}};var mr=(function(i){return i.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",i.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",i.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",i.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",i.EMAIL_EXISTS="auth/email-already-exists",i.INVALID_ACTION_CODE="auth/invalid-action-code",i.POPUP_BLOCKED="auth/popup-blocked",i.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",i.USER_NOT_FOUND="auth/user-not-found",i.WRONG_PASSWORD="auth/wrong-password",i})({});var ot=require("class-transformer"),Ct=require("ts-luxon");var O=(function(i){return i.ACTIVATE="ACTIVATE",i.BLOCK="BLOCK",i.CHECK="CHECK",i.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",i.FREEZE="FREEZE",i.PURCHASE="PURCHASE",i.RECHARGE="RECHARGE",i.ROLLBACK="ROLLBACK",i.TRANSACTION="TRANSACTION",i.TRANSACTION_DETAIL="TRANSACTION_DETAIL",i.UNFREEZE="UNFREEZE",i.XREFUND="XREFUND",i})({});var H=(function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i})({});function yr(i,t,e,r){var s=arguments.length,o=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,t,e,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(t,e,o):n(t,e))||o);return s>3&&o&&Object.defineProperty(t,e,o),o}c(yr,"_ts_decorate");function Pe(i,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,t)}c(Pe,"_ts_metadata");var Dt=class i{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new it("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[O.CHECK]:"",[O.TRANSACTION]:"",[O.TRANSACTION_DETAIL]:"",[O.ACTIVATE]:"A",[O.BLOCK]:"B",[O.DIGITAL_ACTIVATE]:"D",[O.FREEZE]:"F",[O.PURCHASE]:"P",[O.RECHARGE]:"G",[O.ROLLBACK]:"R",[O.UNFREEZE]:"U",[O.XREFUND]:"X"};static _SEP="_";get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}_dto;_hashStrategies={[H.MD5]:t=>rt(t),[H.MD5_HMAC]:t=>{let e=new L;return e.update(R.parse(t)),e.finalize()},[H.SHA1]:t=>st(t),[H.SHA1_HMAC]:t=>{let e=new X;return e.update(R.parse(t)),e.finalize()}};_hashStrategy=this._hashStrategies[H.MD5];constructor(t="ACTIVATION",e,r,s){this.gc=t,this.op=e,this.ot=r,this._dto=typeof s=="number"&&s>=0?Ct.DateTime.fromMillis(+`${s}000`.slice(0,13)):Ct.DateTime.local()}static build({gc:t,op:e,ot:r,dto:s}){return new this(t,e,r,s?.ts)}static explode(t){let e=this.constructor,r=(t||"").split(e._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${t}"`);return this.build({gc:r[1],op:e.prefixToOperation(r[2]),dto:Ct.DateTime.fromSeconds(+r[3])})}static isBase64(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)&&t.length%4===0}static parse(t){this._LOGGER.info(`${this.constructor.name}: trying to parse ${t}`);try{if(this.isBase64(t)){let e=this._AES_ENCODER.decryptAES(t),r=JSON.parse(e);return(0,ot.plainToInstance)(i,r)}else return this.explode(t)}catch(e){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${t}`,e),new Error(`UNPARSEABLE "${t}"`)}}static prefixToOperation(t){return Object.entries(this._OP_CODES).find(([,r])=>r===t)[0]}serialize(){return(0,ot.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let t=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(t)}};yr([(0,ot.Expose)(),Pe("design:type",Number),Pe("design:paramtypes",[])],Dt.prototype,"ts",null);var xr=(function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i})({});function Er(i,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(r=>{r!=="constructor"&&(r in i.prototype||Object.defineProperty(i.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)))});try{let r=new e;Object.getOwnPropertyNames(r).forEach(s=>{s in i.prototype||Object.defineProperty(i.prototype,s,Object.getOwnPropertyDescriptor(r,s))})}catch{}Object.getOwnPropertyNames(e).forEach(r=>{r!=="prototype"&&r!=="name"&&r!=="length"&&(r in i||Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(e,r)))})})}c(Er,"smpApplyMixin");var Rr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ce(i){return i.match(Rr)}c(Ce,"smpAsciiWords");var Le="\\ud800-\\udfff",Ar="\\u0300-\\u036f",Br="\\ufe20-\\ufe2f",Or="\\u20d0-\\u20ff",br="\\u1ab0-\\u1aff",Ir="\\u1dc0-\\u1dff",vr=Ar+Br+Or+br+Ir,ze="\\u2700-\\u27bf",Ue="a-z\\xdf-\\xf6\\xf8-\\xff",Nr="\\xac\\xb1\\xd7\\xf7",Pr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Cr="\\u2000-\\u206f",Dr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="A-Z\\xc0-\\xd6\\xd8-\\xde",kr="\\ufe0e\\ufe0f",$e=Nr+Pr+Cr+Dr,We="['\u2019]",De=`[${$e}]`,Fr=`[${vr}]`,Ge="\\d",Mr=`[${ze}]`,Ke=`[${Ue}]`,Ve=`[^${Le}${$e+Ge+ze+Ue+je}]`,Tr="\\ud83c[\\udffb-\\udfff]",Lr=`(?:${Fr}|${Tr})`,zr=`[^${Le}]`,qe="(?:\\ud83c[\\udde6-\\uddff]){2}",Xe="[\\ud800-\\udbff][\\udc00-\\udfff]",nt=`[${je}]`,Ur="\\u200d",ke=`(?:${Ke}|${Ve})`,jr=`(?:${nt}|${Ve})`,Fe=`(?:${We}(?:d|ll|m|re|s|t|ve))?`,Me=`(?:${We}(?:D|LL|M|RE|S|T|VE))?`,Ze=`${Lr}?`,He=`[${kr}]?`,$r=`(?:${Ur}(?:${[zr,qe,Xe].join("|")})${He+Ze})*`,Wr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Gr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Kr=He+Ze+$r,Te=`(?:${[Mr,qe,Xe].join("|")})${Kr}`,_t=class{static{c(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${nt}?${Ke}+${Fe}(?=${[De,nt,"$"].join("|")})`,`${jr}+${Me}(?=${[De,nt+ke,"$"].join("|")})`,`${nt}?${ke}+${Fe}`,`${nt}+${Me}`,Gr,Wr,`${Ge}+`,Te].join("|"),"g");static RS_EMOJI=Te;static unicodeWords(t){return t.match(this.RE_UNICODE_WORDS)}};var St=class i{static{c(this,"SmpCommonUtils")}static arrayRemove(t,e){let r=[],s=t.filter((o,n)=>e(o,n)&&r.push(n));return r.reverse().forEach(o=>t.splice(o,1)),s}static assertIsArray(t,e){if(!Array.isArray(t))throw new Error(e||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(t,e){if(!this.isBoolean(t))throw new Error(e||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(t,e){if(!this.isFunction(t))throw new Error(e||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(t,e,r){if(!(t instanceof e))throw new Error(r||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(t,e){if(this.isEmpty(t))throw new Error(e||`${this.constructor.name} => entity was empty`)}static assertIsNumber(t,e){if(typeof t!="number")throw new Error(e||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(t,e){if(!this.isNumeric(t))throw new Error(e||`${this.constructor.name} => val was not numeric`)}static assertIsObject(t,e){if(!this.isObject(t))throw new Error(e||`${this.constructor.name} => val was not an object`)}static assertIsString(t,e){if(!this.isString(t))throw new Error(e||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(t,e){if(!t)throw new Error(e||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...t){let e=t.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return e.startsWith("http")&&!e.endsWith("/")?`${e}/`:e}static downloadBlob(t,e){let r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.setAttribute("download",e),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let e="0123456789abcdef",r="";for(let s=0;s<t;s++){let o=Math.floor(Math.random()*e.length);r+=e[o]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}static getDecimalPrecision(t){if(this.assertIsNumeric(t),!isFinite(+t))return 0;let e=1,r=0;for(;Math.round(+t*e)/e!==t;)e*=10,r++;return r}static getType(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}static isBoolean(t){return typeof t=="boolean"}static isColor(t){if(!t||!this.isString(t))return!1;let e=new Option().style;return e.color=t,e.color!==""}static isEmpty(t){return!t&&t!==0}static isEqual(t,e){function r(){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!i.isEqual(t[a],e[a]))return!1;return!0}c(r,"areArraysEqual");function s(){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&!i.isEqual(t[a],e[a]))return!1;return!0}c(s,"areObjectsEqual");function o(){return t.toString()===e.toString()}c(o,"areFunctionsEqual");function n(){return t===e}c(n,"arePrimativesEqual");let h=this.getType(t);return h!==this.getType(e)?!1:h==="array"?r():h==="object"?s():h==="function"?o():n()}static isFormField(t){return/^(?:input|select|textarea|button)$/i.test(t.nodeName)}static isFunction(t){return typeof t==typeof isNaN}static isNotEmpty(t){return!this.isEmpty(t)}static isNumber(t){return typeof t=="number"&&this.isNumeric(t)}static isNumeric(t){return!isNaN(t)}static isObject(t){return!!t&&t===Object(t)&&t.constructor===Object}static isPrimitive(t){let e=this.getType(t);return e!=="function"&&(e!=="object"||!t)}static isString(t){return typeof t=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(t,e){if(this.assertIsFunction(e,`CommonUtils => expected type of iteratee to be Function, got ${typeof e}`),this.isObject(t))return Object.entries(t).reduce((r,[s,o])=>(r.push(e(o,s)),r),[]);if(Array.isArray(t))return t.map(e);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof e}`)}static mapObjectKeys(t,e){return Object.entries(t).reduce((r,[s,o])=>(r[s]=e.call(null,s,o),r),{})}static mapObjectValues(t,e){return this.isObject(t)?Object.entries(t).reduce((r,[s,o])=>(r[s]=e.call(null,o,s),r),{}):{}}static noop(){}static objectHasValue(t,e){return!!~Object.values(t).filter(r=>this.isEqual(r,e))}static omit(t,e){return Object.keys(t).filter(s=>!e.includes(s)).reduce((s,o)=>(s[o]=t[o],s),{})}static parseBoolean(t){return t?/^true$/i.test(t):!1}static parseJsonSafely(t){try{return JSON.parse(t)}catch(e){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:t,error:e});return}}static pick(t,e){return e.reduce((r,s)=>(s in t&&(r[s]=t[s]),r),{})}static runSafely(t,e=null,r=[]){if(this.isFunction(t))return t.apply(e,r)}static sleep(t){return new Promise(e=>setTimeout(e,t))}static sprintf(t,...e){return this.isString(t)&&e.length?this.sprintf(t.replace("%s",String(e.shift())),...e):t}static stripComments(t){return typeof t=="string"?t.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):t}static submitFakeForm({action:t,method:e=jt.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([h,a])=>`<input name="${h}" type="hidden" value="${a}" />`),n=document.createElement("form");n.method=e,n.action=t,n.innerHTML=`${o}`,n.target=s||"_self",document.body.append(n),n.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((e,r,s)=>(r=r.toLowerCase(),e+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(t){return this.toCamelCase(t).replace(/^(.)/,e=>e.toUpperCase())}static toSnakeCase(t){return this.words(t.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(t){return this.toSnakeCase(t).toUpperCase()}static words(t,e){return e===void 0?(_t.HAS_UNICODE_WORD(t)?_t.unicodeWords(t):Ce(t))||[]:t.match(e)||[]}};var te=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(t="Filter Exception",e){super(),this.message=t,this.data=e}};var ee=require("ts-luxon");var re=class i{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return ee.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix="$1";constructor(t=`sid-xxxx-${+ee.DateTime.now().ts}`,e=0){this.value=t,this.expiry=e}static parse(t){return new i(t.value,t.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};var Je=require("@tonysamperi/logger");var se=class{static{c(this,"SmpRegularExpressions")}static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static _country=/[a-zA-Z]{2}/;static _language=/[a-z]{2}/};var Vr="2.0.0-beta.3";0&&(module.exports={SMP_HEALTHZ,SmpAbstractCacheStrategy,SmpAbstractTtlCacheStrategy,SmpAesCrypt,SmpApiCommonUtils,SmpBaseJwtToken,SmpBaseJwtTokenPlain,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpApplyMixin,smpIsSmpCachedValue,smpNoop});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|