@tonysamperi/ts-mapi-core 2.0.0-beta.4 → 2.0.0-beta.5

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/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as Tr,b as jr,c as Lr}from"./chunk-DIVAYUSN.js";import{a as qe,b as Xe}from"./chunk-VBEMFJKM.js";import{a as $}from"./chunk-F3OJMKBL.js";import{a as c}from"./chunk-EI7MMDWY.js";import{Expose as Qe,plainToInstance as or}from"class-transformer";import{Expose as tr,instanceToPlain as rr,plainToInstance as sr,Transform as ir}from"class-transformer";import{Expose as He}from"class-transformer";function Ze(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}c(Ze,"_ts_decorate");function le(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(le,"_ts_metadata");var F=class i{static{c(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=$.ERROR){this._message=e,this._type=t}static sanitizeMessages(e){return typeof e=="string"?e.length?[new i(e)]:[]:[e].flat().map(t=>typeof t=="string"?new i(t):t)}};Ze([He(),le("design:type",String),le("design:paramtypes",[])],F.prototype,"message",null);Ze([He(),le("design:type",typeof $>"u"?Object:$),le("design:paramtypes",[])],F.prototype,"type",null);function er(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}c(er,"_ts_decorate");function Je(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Je,"_ts_metadata");var oe=class i{static{c(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=F.sanitizeMessages(e)}get messages(){return this._messages}constructor(e=[],t){this._messages=e,this.data=t}static buildInfo(e,t){return new i([e].flat().map(r=>new F(r,$.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new F(r,$.SUCCESS)),t)}static fromPlain(e){return sr(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return rr(this,{excludePrefixes:["_"]})}};er([tr(),ir(({value:i})=>i?.length?i:void 0),Je("design:type",Object),Je("design:paramtypes",[])],oe.prototype,"messages",null);function Ye(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}c(Ye,"_ts_decorate");function fe(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(fe,"_ts_metadata");var D=class i extends oe{static{c(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new F("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp=Date.now();constructor(e=i.DEFAULT_MESSAGES,t="GENERIC_ERROR",r=500,s){super(e,s),this._errorCode=t,this._status=r}static create({messages:e=i.DEFAULT_MESSAGES,...t}={}){return new i(F.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=or(nr,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Ye([Qe(),fe("design:type",Object),fe("design:paramtypes",[])],D.prototype,"errorCode",null);Ye([Qe(),fe("design:type",Number),fe("design:paramtypes",[])],D.prototype,"timestamp",null);var nr=class extends D{static{c(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};import{DateTime as Se}from"ts-luxon";var H=class extends qe{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=Se.now().ts)return t.value;this._removeRaw(e);return}return t}remove(e){this._removeRaw(e)}write(e,t,r){if(isNaN(+r)||+r<=0){this._writeRaw(e,t,r);return}let s=Se.now().ts+r*1e3,o={value:t,expiry:s};this._writeRaw(e,o,r)}_isSmpCachedValue(e){return Xe(e)}};var de=class extends H{static{c(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let r=this._storage.key(t);r&&r.startsWith(this._prefix)&&e.push(r)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,r)}}};var pe=class extends de{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var ue=class extends H{static{c(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,t){this._staticSelf._storage.set(e,t)}};var et=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new pe:new ue;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=D;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core.com";static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(s=>this._preprocessResponse(e,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(t.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(e,t){let r=e.startsWith("http");if(t){let s=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),o=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...o,...Object.fromEntries(Object.entries(t).map(([n,h])=>[n,`${h}`]))}).toString(),e=r?s.href:s.pathname+s.search}return e}static _cacheKey(e){return`${this._config.cachePrefix}${e}`}static _cachePop(e){let t=this._cacheRead(e);return this._cacheRemove(e),t}static _cacheRead(e){return this._cacheStrategy.read(this._cacheKey(e))}static _cacheRemove(e){this._cacheStrategy.remove(this._cacheKey(e))}static _cacheWrite(e,t){this._cacheStrategy.write(this._cacheKey(e),t)}static async _preprocessRequest(e){return e}static async _preprocessResponse(e,t){return t}};var tt=(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})({});import{SmpLoggerMethods as hr}from"@tonysamperi/logger";var rt=class{static{c(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new hr;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,s)=>{let o=t[s];return o!==void 0?encodeURIComponent(o):r})}catch(r){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,r)}return e}};var Bs={status:"OK"};var st=(function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i})({});var it=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(e,t,r){this._access_token=e,this._exp=t,this._iss=r}serialize(){return{access_token:this._access_token,exp:this._exp,iss:this._iss}}};var ot=class{static{c(this,"SmpBaseJwtTokenPlain")}access_token;exp;iss};var L=class{static{c(this,"Hex")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s+=2)r[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new g(r,t/2)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push((s>>>4).toString(16)),t.push((s&15).toString(16))}return t.join("")}};var g=class be{static{c(this,"WordArray")}constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],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<e;s+=4){let n=r((o||Math.random())*4294967296);o=n()*987654071,t.push(n()*4294967296|0)}return new be(t,e)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new be(this.words.slice(0),this.sigBytes)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let r=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=r<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}toString(e){return(e||L).stringify(this)}};var we=class{static{c(this,"Latin1")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s++)r[s>>>2]|=(e.charCodeAt(s)&255)<<24-s%4*8;return new g(r,t)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push(String.fromCharCode(s))}return t.join("")}};var R=class{static{c(this,"Utf8")}static parse(e){return we.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(we.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var ge=class{static{c(this,"BufferedBlockAlgorithm")}constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new g,this._nDataBytes=0}clone(){let e=this.constructor();for(let t in this)Object.prototype.hasOwnProperty.call(this,t)&&(e[t]=this[t]);return e._data=this._data.clone(),e}reset(){this._data=new g,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=R.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let t=this.cfg.blockSize*4,r=this._data.sigBytes/t;e?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 g(n,o)}};var J=class{static{c(this,"CipherParams")}constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.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 z=class{static{c(this,"Base64")}static parse(e){let t=e.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=e.indexOf(r);s!==-1&&(t=s)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let s=[],o=0;for(let n=0;n<t;n++)if(n%4){let h=r[e.charCodeAt(n-1)]<<n%4*2,a=r[e.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(h|a)<<24-o%4*8,o++}return new g(s,o)}static stringify(e){e.clamp();let t=[];for(let s=0;s<e.sigBytes;s+=3){let o=e.words[s>>>2]>>>24-s%4*8&255,n=e.words[s+1>>>2]>>>24-(s+1)%4*8&255,h=e.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<e.sigBytes;p++)t.push(this._map.charAt(a>>>6*(3-p)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};z._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";z._reverseMap=void 0;var _e=class{static{c(this,"OpenSSL")}static parse(e){let t=z.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new g(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new J({ciphertext:t,salt:r})}static stringify(e){if(!e.ciphertext)throw new Error("missing ciphertext in params");let t=e.ciphertext,r=e.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new g([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString(z)}};var W=class{static{c(this,"SerializableCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(!o.format)throw new Error("could not determine format");if(t=this._parse(t,o.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,o).finalize(t.ciphertext)}static encrypt(e,t,r,s){let o=Object.assign({},this.cfg,s),n=e.createEncryptor(r,o),h=n.finalize(t);return new J({ciphertext:h,key:r,iv:n.cfg.iv,algorithm:e,mode:n.cfg.mode,padding:n.cfg.padding,blockSize:n.cfg.blockSize,formatter:o.format})}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};W.cfg={blockSize:4,iv:new g([]),format:_e};var E=class extends ge{static{c(this,"Hasher")}constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,s){return new e(s).finalize(r)}return c(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var f=[];for(let i=0;i<64;i++)f[i]=Math.abs(Math.sin(i+1))*4294967296|0;var T=class d extends E{static{c(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,s,o,n,h){let a=e+(t&r|~t&s)+o+h;return(a<<n|a>>>32-n)+t}static GG(e,t,r,s,o,n,h){let a=e+(t&s|r&~s)+o+h;return(a<<n|a>>>32-n)+t}static HH(e,t,r,s,o,n,h){let a=e+(t^r^s)+o+h;return(a<<n|a>>>32-n)+t}static II(e,t,r,s,o,n,h){let a=e+(r^(t|~s))+o+h;return(a<<n|a>>>32-n)+t}reset(){super.reset(),this._hash=new g([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;this._data.words[t>>>5]|=128<<24-t%32;let r=Math.floor(e/4294967296),s=e;this._data.words[(t+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(t+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(e,t){for(let a=0;a<16;a++){let p=t+a,w=e[p];e[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]=e[t+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 Oe=class nt{static{c(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:T,iterations:1},e)}static execute(e,t,r){return new nt(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new g,o;for(;s.words.length<this.cfg.keySize;){o&&r.update(o),o=r.update(e).finalize(t),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 ht=class{static{c(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=g.random(64/8));let o=new Oe({keySize:t+r}).compute(e,s),n=new g(o.words.slice(t),r*4);return o.sigBytes=t*4,new J({key:o,iv:n,salt:s})}};var me=class{static{c(this,"PasswordBasedCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(o.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let n=o.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv!==void 0&&(o.iv=n.iv),W.decrypt.call(this,e,t,n.key,o)}static encrypt(e,t,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,e.keySize,e.ivSize);return n.iv!==void 0&&(o.iv=n.iv),W.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};me.cfg={blockSize:4,iv:new g([]),format:_e,kdf:ht};var ct=class{static{c(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?me.decrypt(this._cipher,e,t,r):W.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?me.encrypt(this._cipher,e,t,r):W.encrypt(this._cipher,e,t,r)}};var Y=class extends ge{static{c(this,"Cipher")}constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new ct(e)}static createDecryptor(e,t){let r=this;return new r(this._DEC_XFORM_MODE,e,t)}static createEncryptor(e,t){return new this(this._ENC_XFORM_MODE,e,t)}finalize(e){return e&&this._append(e),this._doFinalize()}process(e){return this._append(e),this._process()}};Y.ivSize=4;Y.keySize=4;Y._DEC_XFORM_MODE=2;Y._ENC_XFORM_MODE=1;var K=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var ye=class{static{c(this,"BlockCipherMode")}static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};ye.Decryptor=K;ye.Encryptor=K;var at=class extends K{static{c(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var lt=class extends K{static{c(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var U=class extends ye{static{c(this,"CBC")}};U.Decryptor=lt;U.Encryptor=at;var Q=class{static{c(this,"PKCS7")}static pad(e,t){let r=t*4,s=r-e.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 g(n,s);e.concat(h)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var xe=class extends Y{static{c(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:U,padding:Q},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let e;this._xformMode===this.constructor._ENC_XFORM_MODE?e=this.cfg.mode.createEncryptor:(e=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===e?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=e.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=e)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let e;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),e=this._process(!0)}else e=this._process(!0),this.cfg.padding.unpad(e);return e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}};var l=class P{static{c(this,"X64Word")}constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,s=this.high+e.high+r|0;return new P(s,t)}and(e){return new P(this.high&e.high,this.low&e.low)}not(){return new P(~this.high,~this.low)}or(e){return new P(this.high|e.high,this.low|e.low)}rotL(e){return this.shiftL(e).or(this.shiftR(64-e))}rotR(e){return this.shiftR(e).or(this.shiftL(64-e))}shiftL(e){return e<32?new P(this.high<<e|this.low>>>32-e,this.low<<e):new P(this.low<<e-32,0)}shiftR(e){return e<32?new P(this.high>>>e,this.low>>>e|this.high<<32-e):new P(0,this.high>>>e-32)}xor(e){return new P(this.high^e.high,this.low^e.low)}};var ft=class ve{static{c(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new ve(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new ve(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new g(e,this.sigBytes)}};var B=[],dt=[],pt=[],ut=[],wt=[],gt=[],Ie=[],ke=[],Ne=[],Me=[];(function(){let i=[];for(let r=0;r<256;r++)r<128?i[r]=r<<1:i[r]=r<<1^283;let e=0,t=0;for(let r=0;r<256;r++){let s=t^t<<1^t<<2^t<<3^t<<4;s=s>>>8^s&255^99,B[e]=s,dt[s]=e;let o=i[e],n=i[o],h=i[n],a=i[s]*257^s*16843008;pt[e]=a<<24|a>>>8,ut[e]=a<<16|a>>>16,wt[e]=a<<8|a>>>24,gt[e]=a,a=h*16843009^n*65537^o*257^e*16843008,Ie[s]=a<<24|a>>>8,ke[s]=a<<16|a>>>16,Ne[s]=a<<8|a>>>24,Me[s]=a,e?(e=o^i[i[i[h^o]]],t^=i[i[t]]):e=t=1}})();var cr=[0,1,2,4,8,16,32,64,128,27,54],Ee=class extends xe{static{c(this,"AES")}constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,Ie,ke,Ne,Me,dt),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,pt,ut,wt,gt,B)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,o=((this._nRounds=r+6)+1)*4,n=this._keySchedule=[];for(let h=0;h<o;h++)if(h<r)n[h]=t[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^=cr[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]=Ie[B[p>>>24]]^ke[B[p>>>16&255]]^Ne[B[p>>>8&255]]^Me[B[p&255]]}}_doCryptBlock(e,t,r,s,o,n,h,a){let p=e[t]^r[0],w=e[t+1]^r[1],u=e[t+2]^r[2],_=e[t+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[_&255]^r[x++],y=s[w>>>24]^o[u>>>16&255]^n[_>>>8&255]^h[p&255]^r[x++],N=s[u>>>24]^o[_>>>16&255]^n[p>>>8&255]^h[w&255]^r[x++],Be=s[_>>>24]^o[p>>>16&255]^n[w>>>8&255]^h[u&255]^r[x++];p=m,w=y,u=N,_=Be}let b=(a[p>>>24]<<24|a[w>>>16&255]<<16|a[u>>>8&255]<<8|a[_&255])^r[x++],C=(a[w>>>24]<<24|a[u>>>16&255]<<16|a[_>>>8&255]<<8|a[p&255])^r[x++],I=(a[u>>>24]<<24|a[_>>>16&255]<<16|a[p>>>8&255]<<8|a[w&255])^r[x++],k=(a[_>>>24]<<24|a[p>>>16&255]<<16|a[w>>>8&255]<<8|a[u&255])^r[x++];e[t]=b,e[t+1]=C,e[t+2]=I,e[t+3]=k}};Ee.keySize=256/32;var ar=[1732584193,4023233417,2562383102,271733878,3285377520],G=new Array(80),V=class extends E{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new g(ar.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){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)G[a]=e[t+a]|0;else{let _=G[a-3]^G[a-8]^G[a-14]^G[a-16];G[a]=_<<1|_>>>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+G[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 _t=[],mt=[];(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 e(s){return(s-(s|0))*4294967296|0}c(e,"getFractionalBits");let t=2,r=0;for(;r<64;)i(t)&&(r<8&&(_t[r]=e(Math.pow(t,1/2))),mt[r]=e(Math.pow(t,1/3)),r++),t++})();var q=[],ne=class extends E{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new g(_t.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){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)q[u]=e[t+u]|0;else{let A=q[u-15],m=(A<<25|A>>>7)^(A<<14|A>>>18)^A>>>3,y=q[u-2],N=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;q[u]=m+q[u-7]+N+q[u-16]}let _=h&a^~h&p,x=r&s^r&o^s&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),C=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),I=w+C+_+mt[u]+q[u],k=b+x;w=p,p=a,a=h,h=n+I|0,n=o,o=s,s=r,r=I+k|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 Ce=[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)],M=[];(function(){for(let i=0;i<80;i++)M[i]=new l(void 0,void 0)})();var Fe=class extends E{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new ft([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 e=this._data,t=e.words,r=this._nDataBytes*8,s=e.sigBytes*8;return t[s>>>5]|=128<<24-s%32,t[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(s+128>>>10<<5)+31]=r,e.sigBytes=t.length*4,this._process(),this._hash.toX32()}_doProcessBlock(e,t){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,_=this._hash.words[4].low,x=this._hash.words[5].high,b=this._hash.words[5].low,C=this._hash.words[6].high,I=this._hash.words[6].low,k=this._hash.words[7].high,A=this._hash.words[7].low;for(let m=0;m<80;m++){let y,N;if(m<16)N=M[m].high=e[t+m*2]|0,y=M[m].low=e[t+m*2+1]|0;else{let We=M[m-15],X=We.high,se=We.low,Qt=(X>>>1|se<<31)^(X>>>8|se<<24)^X>>>7,Ke=(se>>>1|X<<31)^(se>>>8|X<<24)^(se>>>7|X<<25),Ge=M[m-2],Z=Ge.high,ie=Ge.low,St=(Z>>>19|ie<<13)^(Z<<3|ie>>>29)^Z>>>6,Ve=(ie>>>19|Z<<13)^(ie<<3|Z>>>29)^(ie>>>6|Z<<26);y=Ke+M[m-7].low,N=Qt+M[m-7].high+(y>>>0<Ke>>>0?1:0),y=y+Ve,N=N+St+(y>>>0<Ve>>>0?1:0),y=y+M[m-16].low,N=N+M[m-16].high+(y>>>0<M[m-16].low>>>0?1:0),M[m].high=N,M[m].low=y}let Be=u&x^~u&C,Le=_&b^~_&I,qt=r&o^r&h^o&h,Xt=s&n^s&a^n&a,Zt=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),Ue=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Ht=(u>>>14|_<<18)^(u>>>18|_<<14)^(u<<23|_>>>9),Jt=(_>>>14|u<<18)^(_>>>18|u<<14)^(_<<23|u>>>9),O=A+Jt,j=k+Ht+(O>>>0<A>>>0?1:0);O=O+Le,j=j+Be+(O>>>0<Le>>>0?1:0),O=O+Ce[m].low,j=j+Ce[m].high+(O>>>0<Ce[m].low>>>0?1:0),O=O+y,j=j+N+(O>>>0<y>>>0?1:0);let $e=Ue+Xt,Yt=Zt+qt+($e>>>0<Ue>>>0?1:0);k=C,A=I,C=x,I=b,x=u,b=_,_=w+O|0,u=p+j+(_>>>0<w>>>0?1:0)|0,p=h,w=a,h=o,a=n,o=r,n=s,s=O+$e|0,r=j+Yt+(s>>>0<O>>>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+_,this._hash.words[4].high=this._hash.words[4].high+u+(this._hash.words[4].low>>>0<_>>>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+I,this._hash.words[6].high=this._hash.words[6].high+C+(this._hash.words[6].low>>>0<I>>>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+k+(this._hash.words[7].low>>>0<A>>>0?1:0)}};var yt=class{static{c(this,"HMAC")}constructor(e,t){this._hasher=new e;let r=typeof t=="string"?R.parse(t):t,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(e){let t=this._hasher.finalize(e);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(t))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(e){return this._hasher.update(e),this}};var Pe=class xt{static{c(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:ne,iterations:25e4},e)}static execute(e,t,r){return new xt(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new yt(r.hasher,e),o=new g,n=new g([1]),h=o.words,a=n.words,p=r.keySize,w=r.iterations;for(;h.length<p;){let u=s.update(t).finalize(n);s.reset();let _=u.words,x=_.length,b=u;for(let C=1;C<w;C++){b=s.finalize(b),s.reset();let I=b.words;for(let k=0;k<x;k++)_[k]^=I[k]}o.concat(u),a[0]++}return o.sigBytes=p*4,o}};var he=xe._createHelper(Ee);var S=E._createHelper(T);var ee=E._createHelper(V);var Re=E._createHelper(ne);var Ae=E._createHelper(Fe);var ce=class{static{c(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?L.parse(this._initVector):void 0}_mode=U;_padding=Q;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r}decryptAES(e){return he.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(R)}encryptAES(e){return he.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Pe.execute(this._password,L.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:V})}};var De=class{static{c(this,"SmpCrypto")}static base64Decode(e){return R.stringify(z.parse(e))}static base64Encode(e){return z.stringify(R.parse(e))}static md5(e){return S(e).toString()}static sha1(e){return ee(e).toString()}static sha256(e){return Re(e).toString()}static sha512(e){return Ae(e).toString()}};var ze=class{static{c(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength=5;_seed="changeme";constructor(e){this._baseCode=e}static check(e,t){if(new this(e).secureCode!==t)throw D.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:tt.BadRequest})}_encode(){let e=new T;return e.update(R.parse(this._seed+this._baseCode)),e.finalize().toString(L).substring(0,this._crcLength).toUpperCase()}};import{Expose as fr,instanceToPlain as dr,plainToInstance as pr}from"class-transformer";import{DateTime as Te}from"ts-luxon";var v=(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 te=(function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i})({});function lr(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var h=i.length-1;h>=0;h--)(n=i[h])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}c(lr,"_ts_decorate");function Et(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Et,"_ts_metadata");var je=class i{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new ce("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[v.CHECK]:"",[v.TRANSACTION]:"",[v.TRANSACTION_DETAIL]:"",[v.ACTIVATE]:"A",[v.BLOCK]:"B",[v.DIGITAL_ACTIVATE]:"D",[v.FREEZE]:"F",[v.PURCHASE]:"P",[v.RECHARGE]:"G",[v.ROLLBACK]:"R",[v.UNFREEZE]:"U",[v.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={[te.MD5]:e=>S(e),[te.MD5_HMAC]:e=>{let t=new T;return t.update(R.parse(e)),t.finalize()},[te.SHA1]:e=>ee(e),[te.SHA1_HMAC]:e=>{let t=new V;return t.update(R.parse(e)),t.finalize()}};_hashStrategy=this._hashStrategies[te.MD5];constructor(e="ACTIVATION",t,r,s){this.gc=e,this.op=t,this.ot=r,this._dto=typeof s=="number"&&s>=0?Te.fromMillis(+`${s}000`.slice(0,13)):Te.local()}static build({gc:e,op:t,ot:r,dto:s}){return new this(e,t,r,s?.ts)}static explode(e){let t=this.constructor,r=(e||"").split(t._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${e}"`);return this.build({gc:r[1],op:t.prefixToOperation(r[2]),dto:Te.fromSeconds(+r[3])})}static isBase64(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)&&e.length%4===0}static parse(e){this._LOGGER.info(`${this.constructor.name}: trying to parse ${e}`);try{if(this.isBase64(e)){let t=this._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return pr(i,r)}else return this.explode(e)}catch(t){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${e}`,t),new Error(`UNPARSEABLE "${e}"`)}}static prefixToOperation(e){return Object.entries(this._OP_CODES).find(([,r])=>r===e)[0]}serialize(){return dr(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};lr([fr(),Et("design:type",Number),Et("design:paramtypes",[])],je.prototype,"ts",null);var Rh=(function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i})({});function Bh(i,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{r!=="constructor"&&(r in i.prototype||Object.defineProperty(i.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)))});try{let r=new t;Object.getOwnPropertyNames(r).forEach(s=>{s in i.prototype||Object.defineProperty(i.prototype,s,Object.getOwnPropertyDescriptor(r,s))})}catch{}Object.getOwnPropertyNames(t).forEach(r=>{r!=="prototype"&&r!=="name"&&r!=="length"&&(r in i||Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r)))})})}c(Bh,"smpApplyMixin");var ur=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Rt(i){return i.match(ur)}c(Rt,"smpAsciiWords");var It="\\ud800-\\udfff",wr="\\u0300-\\u036f",gr="\\ufe20-\\ufe2f",_r="\\u20d0-\\u20ff",mr="\\u1ab0-\\u1aff",yr="\\u1dc0-\\u1dff",xr=wr+gr+_r+mr+yr,kt="\\u2700-\\u27bf",Nt="a-z\\xdf-\\xf6\\xf8-\\xff",Er="\\xac\\xb1\\xd7\\xf7",Rr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ar="\\u2000-\\u206f",Br=" \\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",Mt="A-Z\\xc0-\\xd6\\xd8-\\xde",br="\\ufe0e\\ufe0f",Ct=Er+Rr+Ar+Br,Ft="['\u2019]",At=`[${Ct}]`,Or=`[${xr}]`,Pt="\\d",vr=`[${kt}]`,Dt=`[${Nt}]`,zt=`[^${It}${Ct+Pt+kt+Nt+Mt}]`,Ir="\\ud83c[\\udffb-\\udfff]",kr=`(?:${Or}|${Ir})`,Nr=`[^${It}]`,Tt="(?:\\ud83c[\\udde6-\\uddff]){2}",jt="[\\ud800-\\udbff][\\udc00-\\udfff]",re=`[${Mt}]`,Mr="\\u200d",Bt=`(?:${Dt}|${zt})`,Cr=`(?:${re}|${zt})`,bt=`(?:${Ft}(?:d|ll|m|re|s|t|ve))?`,Ot=`(?:${Ft}(?:D|LL|M|RE|S|T|VE))?`,Lt=`${kr}?`,Ut=`[${br}]?`,Fr=`(?:${Mr}(?:${[Nr,Tt,jt].join("|")})${Ut+Lt})*`,Pr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zr=Ut+Lt+Fr,vt=`(?:${[vr,Tt,jt].join("|")})${zr}`,ae=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([`${re}?${Dt}+${bt}(?=${[At,re,"$"].join("|")})`,`${Cr}+${Ot}(?=${[At,re+Bt,"$"].join("|")})`,`${re}?${Bt}+${bt}`,`${re}+${Ot}`,Dr,Pr,`${Pt}+`,vt].join("|"),"g");static RS_EMOJI=vt;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var $t=class i{static{c(this,"SmpCommonUtils")}static arrayRemove(e,t){let r=[],s=e.filter((o,n)=>t(o,n)&&r.push(n));return r.reverse().forEach(o=>e.splice(o,1)),s}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||`${this.constructor.name} => entity was empty`)}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||`${this.constructor.name} => val was not an object`)}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(e,t){if(!e)throw new Error(t||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.setAttribute("download",t),document.body.appendChild(s),s.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let s=0;s<e;s++){let o=Math.floor(Math.random()*t.length);r+=t[o]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}static getDecimalPrecision(e){if(this.assertIsNumeric(e),!isFinite(+e))return 0;let t=1,r=0;for(;Math.round(+e*t)/t!==e;)t*=10,r++;return r}static getType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}static isBoolean(e){return typeof e=="boolean"}static isColor(e){if(!e||!this.isString(e))return!1;let t=new Option().style;return t.color=e,t.color!==""}static isEmpty(e){return!e&&e!==0}static isEqual(e,t){function r(){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(!i.isEqual(e[a],t[a]))return!1;return!0}c(r,"areArraysEqual");function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&!i.isEqual(e[a],t[a]))return!1;return!0}c(s,"areObjectsEqual");function o(){return e.toString()===t.toString()}c(o,"areFunctionsEqual");function n(){return e===t}c(n,"arePrimativesEqual");let h=this.getType(e);return h!==this.getType(t)?!1:h==="array"?r():h==="object"?s():h==="function"?o():n()}static isFormField(e){return/^(?:input|select|textarea|button)$/i.test(e.nodeName)}static isFunction(e){return typeof e==typeof isNaN}static isNotEmpty(e){return!this.isEmpty(e)}static isNumber(e){return typeof e=="number"&&this.isNumeric(e)}static isNumeric(e){return!isNaN(e)}static isObject(e){return!!e&&e===Object(e)&&e.constructor===Object}static isPrimitive(e){let t=this.getType(e);return t!=="function"&&(t!=="object"||!e)}static isString(e){return typeof e=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(e,t){if(this.assertIsFunction(t,`CommonUtils => expected type of iteratee to be Function, got ${typeof t}`),this.isObject(e))return Object.entries(e).reduce((r,[s,o])=>(r.push(t(o,s)),r),[]);if(Array.isArray(e))return e.map(t);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof t}`)}static mapObjectKeys(e,t){return Object.entries(e).reduce((r,[s,o])=>(r[s]=t.call(null,s,o),r),{})}static mapObjectValues(e,t){return this.isObject(e)?Object.entries(e).reduce((r,[s,o])=>(r[s]=t.call(null,o,s),r),{}):{}}static noop(){}static objectHasValue(e,t){return!!~Object.values(e).filter(r=>this.isEqual(r,t))}static omit(e,t){return Object.keys(e).filter(s=>!t.includes(s)).reduce((s,o)=>(s[o]=e[o],s),{})}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:e,error:t});return}}static pick(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}static runSafely(e,t=null,r=[]){if(this.isFunction(e))return e.apply(t,r)}static sleep(e){return new Promise(t=>setTimeout(t,e))}static sprintf(e,...t){return this.isString(e)&&t.length?this.sprintf(e.replace("%s",String(t.shift())),...t):e}static stripComments(e){return typeof e=="string"?e.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):e}static submitFakeForm({action:e,method:t=st.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=t,n.action=e,n.innerHTML=`${o}`,n.target=s||"_self",document.body.append(n),n.submit()}static toCamelCase(e){return this.words(e.replace(/['\u2019]/g,"")).reduce((t,r,s)=>(r=r.toLowerCase(),t+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(e){return this.toCamelCase(e).replace(/^(.)/,t=>t.toUpperCase())}static toSnakeCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(e){return this.toSnakeCase(e).toUpperCase()}static words(e,t){return t===void 0?(ae.HAS_UNICODE_WORD(e)?ae.unicodeWords(e):Rt(e))||[]:e.match(t)||[]}};var Wt=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};import{DateTime as Kt}from"ts-luxon";var Gt=class i{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return Kt.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix="$1";constructor(e=`sid-xxxx-${+Kt.now().ts}`,t=0){this.value=e,this.expiry=t}static parse(e){return new i(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};import{smpNoop as Kh}from"@tonysamperi/logger";var Vt=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 qh="2.0.0-beta.4";export{Bs as SMP_HEALTHZ,qe as SmpAbstractCacheStrategy,H as SmpAbstractTtlCacheStrategy,ce as SmpAesCrypt,rt as SmpApiCommonUtils,it as SmpBaseJwtToken,ot as SmpBaseJwtTokenPlain,de as SmpBrowserCache,$t as SmpCommonUtils,De as SmpCrypto,D as SmpErrorResponse,Wt as SmpFilterException,Lr as SmpFirebaseErrors,oe as SmpGenericResponse,je as SmpGiftcardTransaction,te as SmpGiftcardTransactionHashStrategies,v as SmpGiftcardTransactionOps,et as SmpHttpService,pe as SmpHttpSessionStorageCache,tt as SmpHttpStatusCodes,ue as SmpInMemoryCache,Rh as SmpMarketingCloudValidators,Vt as SmpRegularExpressions,F as SmpResponseMessage,$ as SmpResponseMessageTypes,st as SmpRestVerbs,ze as SmpSecureCode,Gt as SmpSid,Tr as SmpSocialSignInKeys,jr as SmpSocialSignInUxModes,qh as VERSION,Bh as smpApplyMixin,Xe as smpIsSmpCachedValue,Kh as smpNoop};
1
+ import{a as dc,b as mc,c as gc}from"./chunk-DIVAYUSN.js";import{a as Le,b as ze}from"./chunk-VBEMFJKM.js";import{a as ct}from"./chunk-F3OJMKBL.js";import{a as n}from"./chunk-EI7MMDWY.js";import{DateTime as Ue}from"ts-luxon";var ht=class extends Le{static{n(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(t){let e=this._readRaw(t);if(this._isSmpCachedValue(e)){if(e.expiry>=Ue.now().ts)return e.value;this._removeRaw(t);return}return e}remove(t){this._removeRaw(t)}write(t,e,o){if(isNaN(+o)||+o<=0){this._writeRaw(t,e,o);return}let s=Ue.now().ts+o*1e3,i={value:e,expiry:s};this._writeRaw(t,i,o)}_isSmpCachedValue(t){return ze(t)}};var jt=class extends ht{static{n(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 o=this._storage.key(e);o&&o.startsWith(this._prefix)&&t.push(o)}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(o){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+t}`,o)}}};var Mt=class extends jt{static{n(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var $e=(function(r){return r[r.Continue=100]="Continue",r[r.SwitchingProtocols=101]="SwitchingProtocols",r[r.Processing=102]="Processing",r[r.EarlyHints=103]="EarlyHints",r[r.Ok=200]="Ok",r[r.Created=201]="Created",r[r.Accepted=202]="Accepted",r[r.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",r[r.NoContent=204]="NoContent",r[r.ResetContent=205]="ResetContent",r[r.PartialContent=206]="PartialContent",r[r.MultiStatus=207]="MultiStatus",r[r.AlreadyReported=208]="AlreadyReported",r[r.ImUsed=226]="ImUsed",r[r.MultipleChoices=300]="MultipleChoices",r[r.MovedPermanently=301]="MovedPermanently",r[r.Found=302]="Found",r[r.SeeOther=303]="SeeOther",r[r.NotModified=304]="NotModified",r[r.UseProxy=305]="UseProxy",r[r.Unused=306]="Unused",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",r[r.BadRequest=400]="BadRequest",r[r.Unauthorized=401]="Unauthorized",r[r.PaymentRequired=402]="PaymentRequired",r[r.Forbidden=403]="Forbidden",r[r.NotFound=404]="NotFound",r[r.MethodNotAllowed=405]="MethodNotAllowed",r[r.NotAcceptable=406]="NotAcceptable",r[r.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",r[r.RequestTimeout=408]="RequestTimeout",r[r.Conflict=409]="Conflict",r[r.Gone=410]="Gone",r[r.LengthRequired=411]="LengthRequired",r[r.PreconditionFailed=412]="PreconditionFailed",r[r.PayloadTooLarge=413]="PayloadTooLarge",r[r.UriTooLong=414]="UriTooLong",r[r.UnsupportedMediaType=415]="UnsupportedMediaType",r[r.RangeNotSatisfiable=416]="RangeNotSatisfiable",r[r.ExpectationFailed=417]="ExpectationFailed",r[r.ImATeapot=418]="ImATeapot",r[r.MisdirectedRequest=421]="MisdirectedRequest",r[r.UnprocessableEntity=422]="UnprocessableEntity",r[r.Locked=423]="Locked",r[r.FailedDependency=424]="FailedDependency",r[r.TooEarly=425]="TooEarly",r[r.UpgradeRequired=426]="UpgradeRequired",r[r.PreconditionRequired=428]="PreconditionRequired",r[r.TooManyRequests=429]="TooManyRequests",r[r.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",r[r.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",r[r.InternalServerError=500]="InternalServerError",r[r.NotImplemented=501]="NotImplemented",r[r.BadGateway=502]="BadGateway",r[r.ServiceUnavailable=503]="ServiceUnavailable",r[r.GatewayTimeout=504]="GatewayTimeout",r[r.HttpVersionNotSupported=505]="HttpVersionNotSupported",r[r.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",r[r.InsufficientStorage=507]="InsufficientStorage",r[r.LoopDetected=508]="LoopDetected",r[r.NotExtended=510]="NotExtended",r[r.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",r})({});import{Expose as Se,plainToInstance as ys}from"class-transformer";import{Expose as ms,instanceToPlain as gs,plainToInstance as _s,Transform as ws}from"class-transformer";import{Expose as Ge}from"class-transformer";function ke(r,t,e,o){var s=arguments.length,i=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(i=(s<3?a(i):s>3?a(t,e,i):a(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}n(ke,"_ts_decorate");function Dt(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}n(Dt,"_ts_metadata");var F=class r{static{n(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(t,e=ct.ERROR){this._message=t,this._type=e}static sanitizeMessages(t){return typeof t=="string"?t.length?[new r(t)]:[]:[t].flat().map(e=>typeof e=="string"?new r(e):e)}};ke([Ge(),Dt("design:type",String),Dt("design:paramtypes",[])],F.prototype,"message",null);ke([Ge(),Dt("design:type",typeof ct>"u"?Object:ct),Dt("design:paramtypes",[])],F.prototype,"type",null);function ds(r,t,e,o){var s=arguments.length,i=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(i=(s<3?a(i):s>3?a(t,e,i):a(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}n(ds,"_ts_decorate");function Ke(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}n(Ke,"_ts_metadata");var Et=class r{static{n(this,"SmpGenericResponse")}_messages;data;set messages(t){this._messages=F.sanitizeMessages(t)}get messages(){return this._messages}constructor(t=[],e){this._messages=t,this.data=e}static create(t){return new r([t.messages||[]].flat().map(e=>e instanceof F?e:new F(e,t.type||ct.SUCCESS)),t.data)}static fromPlain(t){return _s(r,t)}isError(){return!this.isSuccess()}isSuccess(){return typeof this._errorCode=="number"}serialize(){return gs(this,{excludePrefixes:["_"]})}};ds([ms(),ws(({value:r})=>r?.length?r:void 0),Ke("design:type",Object),Ke("design:paramtypes",[])],Et.prototype,"messages",null);function We(r,t,e,o){var s=arguments.length,i=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(i=(s<3?a(i):s>3?a(t,e,i):a(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}n(We,"_ts_decorate");function Nt(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}n(Nt,"_ts_metadata");var z=class r extends Et{static{n(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new F("GENERIC_ERROR")]}set errorCode(t){this._errorCode=t}get errorCode(){return this._errorCode}get status(){return this._status}set timestamp(t){this._timestamp=t}get timestamp(){return this._timestamp}_timestamp=Date.now();constructor(t=r.DEFAULT_MESSAGES,e="GENERIC_ERROR",o=500,s){super(t,s),this._errorCode=e,this._status=o}static create({messages:t=r.DEFAULT_MESSAGES,...e}={}){return new r(F.sanitizeMessages(t),e.errorCode,e.status,e.data)}static fromPlain(t){let e=ys(xs,t,{excludePrefixes:["_"]}),o=new r;return Object.getOwnPropertyNames(e).forEach(s=>{s in o&&(o[s]=e[s])}),o}};We([Se(),Nt("design:type",Object),Nt("design:paramtypes",[])],z.prototype,"errorCode",null);We([Se(),Nt("design:type",Number),Nt("design:paramtypes",[])],z.prototype,"timestamp",null);var xs=class extends z{static{n(this,"SmpErrorResponseMutable")}set errorCode(t){this._errorCode=t}set status(t){this._status=t}set timestamp(t){this._timestamp=t}};var H=class{static{n(this,"Hex")}static parse(t){let e=t.length,o=[];for(let s=0;s<e;s+=2)o[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new _(o,e/2)}static stringify(t){let e=[];for(let o=0;o<t.sigBytes;o++){let s=t.words[o>>>2]>>>24-o%4*8&255;e.push((s>>>4).toString(16)),e.push((s&15).toString(16))}return e.join("")}};var _=class he{static{n(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=[],o=n(function(s){let i=987654321,a=4294967295;return function(){i=36969*(i&65535)+(i>>16)&a,s=18e3*(s&65535)+(s>>16)&a;let c=(i<<16)+s&a;return c/=4294967296,c+=.5,c*(Math.random()>.5?1:-1)}},"r");for(let s=0,i;s<t;s+=4){let a=o((i||Math.random())*4294967296);i=a()*987654071,e.push(a()*4294967296|0)}return new he(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 he(this.words.slice(0),this.sigBytes)}concat(t){if(this.clamp(),this.sigBytes%4)for(let e=0;e<t.sigBytes;e++){let o=t.words[e>>>2]>>>24-e%4*8&255;this.words[this.sigBytes+e>>>2]|=o<<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||H).stringify(this)}};var Ft=class{static{n(this,"Latin1")}static parse(t){let e=t.length,o=[];for(let s=0;s<e;s++)o[s>>>2]|=(t.charCodeAt(s)&255)<<24-s%4*8;return new _(o,e)}static stringify(t){let e=[];for(let o=0;o<t.sigBytes;o++){let s=t.words[o>>>2]>>>24-o%4*8&255;e.push(String.fromCharCode(s))}return e.join("")}};var I=class{static{n(this,"Utf8")}static parse(t){return Ft.parse(unescape(encodeURIComponent(t)))}static stringify(t){try{return decodeURIComponent(escape(Ft.stringify(t)))}catch(e){throw console.error("Malformed UTF-8 data",e),new Error("Malformed UTF-8 data")}}};var Lt=class{static{n(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=I.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,o=this._data.sigBytes/e;t?o=Math.ceil(o):o=Math.max((o|0)-this._minBufferSize,0);let s=o*this.cfg.blockSize,i=Math.min(s*4,this._data.sigBytes),a;if(s){for(let c=0;c<s;c+=this.cfg.blockSize)this._doProcessBlock(this._data.words,c);a=this._data.words.splice(0,s),this._data.sigBytes-=i}return new _(a,i)}};var lt=class{static{n(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 U=class{static{n(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 o=this._map.charAt(64);if(o){let s=t.indexOf(o);s!==-1&&(e=s)}return this.parseLoop(t,e,this._reverseMap)}static parseLoop(t,e,o){let s=[],i=0;for(let a=0;a<e;a++)if(a%4){let c=o[t.charCodeAt(a-1)]<<a%4*2,h=o[t.charCodeAt(a)]>>>6-a%4*2;s[i>>>2]|=(c|h)<<24-i%4*8,i++}return new _(s,i)}static stringify(t){t.clamp();let e=[];for(let s=0;s<t.sigBytes;s+=3){let i=t.words[s>>>2]>>>24-s%4*8&255,a=t.words[s+1>>>2]>>>24-(s+1)%4*8&255,c=t.words[s+2>>>2]>>>24-(s+2)%4*8&255,h=i<<16|a<<8|c;for(let f=0;f<4&&s+f*.75<t.sigBytes;f++)e.push(this._map.charAt(h>>>6*(3-f)&63))}let o=this._map.charAt(64);if(o)for(;e.length%4;)e.push(o);return e.join("")}};U._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";U._reverseMap=void 0;var zt=class{static{n(this,"OpenSSL")}static parse(t){let e=U.parse(t),o;return e.words[0]===1398893684&&e.words[1]===1701076831&&(o=new _(e.words.slice(2,4)),e.words.splice(0,4),e.sigBytes-=16),new lt({ciphertext:e,salt:o})}static stringify(t){if(!t.ciphertext)throw new Error("missing ciphertext in params");let e=t.ciphertext,o=t.salt,s;if(o){if(typeof o=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(o).concat(e)}else s=e;return s.toString(U)}};var Q=class{static{n(this,"SerializableCipher")}static decrypt(t,e,o,s){let i=Object.assign({},this.cfg,s);if(!i.format)throw new Error("could not determine format");if(e=this._parse(e,i.format),!e.ciphertext)throw new Error("could not determine ciphertext");return t.createDecryptor(o,i).finalize(e.ciphertext)}static encrypt(t,e,o,s){let i=Object.assign({},this.cfg,s),a=t.createEncryptor(o,i),c=a.finalize(e);return new lt({ciphertext:c,key:o,iv:a.cfg.iv,algorithm:t,mode:a.cfg.mode,padding:a.cfg.padding,blockSize:a.cfg.blockSize,formatter:i.format})}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};Q.cfg={blockSize:4,iv:new _([]),format:zt};var C=class extends Lt{static{n(this,"Hasher")}constructor(t){super(Object.assign({blockSize:512/32},t)),this.reset()}static _createHelper(t){function e(o,s){return new t(s).finalize(o)}return n(e,"helper"),e}finalize(t){return t&&this._append(t),this._doFinalize()}update(t){return this._append(t),this._process(),this}};var p=[];for(let r=0;r<64;r++)p[r]=Math.abs(Math.sin(r+1))*4294967296|0;var $=class u extends C{static{n(this,"MD5")}get hash(){return this._hash}static FF(t,e,o,s,i,a,c){let h=t+(e&o|~e&s)+i+c;return(h<<a|h>>>32-a)+e}static GG(t,e,o,s,i,a,c){let h=t+(e&s|o&~s)+i+c;return(h<<a|h>>>32-a)+e}static HH(t,e,o,s,i,a,c){let h=t+(e^o^s)+i+c;return(h<<a|h>>>32-a)+e}static II(t,e,o,s,i,a,c){let h=t+(o^(e|~s))+i+c;return(h<<a|h>>>32-a)+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 o=Math.floor(t/4294967296),s=t;this._data.words[(e+64>>>9<<4)+15]=(o<<8|o>>>24)&16711935|(o<<24|o>>>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 i=0;i<4;i++)this._hash.words[i]=(this._hash.words[i]<<8|this._hash.words[i]>>>24)&16711935|(this._hash.words[i]<<24|this._hash.words[i]>>>8)&4278255360;return this._hash}_doProcessBlock(t,e){for(let h=0;h<16;h++){let f=e+h,g=t[f];t[f]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}let o=Array.from({length:16});for(let h=0;h<16;h++)o[h]=t[e+h];let s=this._hash.words[0],i=this._hash.words[1],a=this._hash.words[2],c=this._hash.words[3];s=u.FF(s,i,a,c,o[0],7,p[0]),c=u.FF(c,s,i,a,o[1],12,p[1]),a=u.FF(a,c,s,i,o[2],17,p[2]),i=u.FF(i,a,c,s,o[3],22,p[3]),s=u.FF(s,i,a,c,o[4],7,p[4]),c=u.FF(c,s,i,a,o[5],12,p[5]),a=u.FF(a,c,s,i,o[6],17,p[6]),i=u.FF(i,a,c,s,o[7],22,p[7]),s=u.FF(s,i,a,c,o[8],7,p[8]),c=u.FF(c,s,i,a,o[9],12,p[9]),a=u.FF(a,c,s,i,o[10],17,p[10]),i=u.FF(i,a,c,s,o[11],22,p[11]),s=u.FF(s,i,a,c,o[12],7,p[12]),c=u.FF(c,s,i,a,o[13],12,p[13]),a=u.FF(a,c,s,i,o[14],17,p[14]),i=u.FF(i,a,c,s,o[15],22,p[15]),s=u.GG(s,i,a,c,o[1],5,p[16]),c=u.GG(c,s,i,a,o[6],9,p[17]),a=u.GG(a,c,s,i,o[11],14,p[18]),i=u.GG(i,a,c,s,o[0],20,p[19]),s=u.GG(s,i,a,c,o[5],5,p[20]),c=u.GG(c,s,i,a,o[10],9,p[21]),a=u.GG(a,c,s,i,o[15],14,p[22]),i=u.GG(i,a,c,s,o[4],20,p[23]),s=u.GG(s,i,a,c,o[9],5,p[24]),c=u.GG(c,s,i,a,o[14],9,p[25]),a=u.GG(a,c,s,i,o[3],14,p[26]),i=u.GG(i,a,c,s,o[8],20,p[27]),s=u.GG(s,i,a,c,o[13],5,p[28]),c=u.GG(c,s,i,a,o[2],9,p[29]),a=u.GG(a,c,s,i,o[7],14,p[30]),i=u.GG(i,a,c,s,o[12],20,p[31]),s=u.HH(s,i,a,c,o[5],4,p[32]),c=u.HH(c,s,i,a,o[8],11,p[33]),a=u.HH(a,c,s,i,o[11],16,p[34]),i=u.HH(i,a,c,s,o[14],23,p[35]),s=u.HH(s,i,a,c,o[1],4,p[36]),c=u.HH(c,s,i,a,o[4],11,p[37]),a=u.HH(a,c,s,i,o[7],16,p[38]),i=u.HH(i,a,c,s,o[10],23,p[39]),s=u.HH(s,i,a,c,o[13],4,p[40]),c=u.HH(c,s,i,a,o[0],11,p[41]),a=u.HH(a,c,s,i,o[3],16,p[42]),i=u.HH(i,a,c,s,o[6],23,p[43]),s=u.HH(s,i,a,c,o[9],4,p[44]),c=u.HH(c,s,i,a,o[12],11,p[45]),a=u.HH(a,c,s,i,o[15],16,p[46]),i=u.HH(i,a,c,s,o[2],23,p[47]),s=u.II(s,i,a,c,o[0],6,p[48]),c=u.II(c,s,i,a,o[7],10,p[49]),a=u.II(a,c,s,i,o[14],15,p[50]),i=u.II(i,a,c,s,o[5],21,p[51]),s=u.II(s,i,a,c,o[12],6,p[52]),c=u.II(c,s,i,a,o[3],10,p[53]),a=u.II(a,c,s,i,o[10],15,p[54]),i=u.II(i,a,c,s,o[1],21,p[55]),s=u.II(s,i,a,c,o[8],6,p[56]),c=u.II(c,s,i,a,o[15],10,p[57]),a=u.II(a,c,s,i,o[6],15,p[58]),i=u.II(i,a,c,s,o[13],21,p[59]),s=u.II(s,i,a,c,o[4],6,p[60]),c=u.II(c,s,i,a,o[11],10,p[61]),a=u.II(a,c,s,i,o[2],15,p[62]),i=u.II(i,a,c,s,o[9],21,p[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+i|0,this._hash.words[2]=this._hash.words[2]+a|0,this._hash.words[3]=this._hash.words[3]+c|0}};var le=class qe{static{n(this,"EVPKDF")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:$,iterations:1},t)}static execute(t,e,o){return new qe(o).compute(t,e)}compute(t,e){let o=new this.cfg.hasher,s=new _,i;for(;s.words.length<this.cfg.keySize;){i&&o.update(i),i=o.update(t).finalize(e),o.reset();for(let a=1;a<this.cfg.iterations;a++)i=o.finalize(i),o.reset();s.concat(i)}return s.sigBytes=this.cfg.keySize*4,s}};var He=class{static{n(this,"OpenSSLKdf")}static execute(t,e,o,s){s||(s=_.random(64/8));let i=new le({keySize:e+o}).compute(t,s),a=new _(i.words.slice(e),o*4);return i.sigBytes=e*4,new lt({key:i,iv:a,salt:s})}};var Ut=class{static{n(this,"PasswordBasedCipher")}static decrypt(t,e,o,s){let i=Object.assign({},this.cfg,s);if(i.format===void 0)throw new Error("missing format in config");if(e=this._parse(e,i.format),i.kdf===void 0)throw new Error("the key derivation function must be set");let a=i.kdf.execute(o,t.keySize,t.ivSize,e.salt);return a.iv!==void 0&&(i.iv=a.iv),Q.decrypt.call(this,t,e,a.key,i)}static encrypt(t,e,o,s){let i=Object.assign({},this.cfg,s);if(i.kdf===void 0)throw new Error("missing kdf in config");let a=i.kdf.execute(o,t.keySize,t.ivSize);return a.iv!==void 0&&(i.iv=a.iv),Q.encrypt.call(this,t,e,a.key,i).extend(a)}static _parse(t,e){return typeof t=="string"?e.parse(t):t}};Ut.cfg={blockSize:4,iv:new _([]),format:zt,kdf:He};var Ve=class{static{n(this,"CipherHelper")}constructor(t){this._cipher=t}decrypt(t,e,o){return typeof e=="string"?Ut.decrypt(this._cipher,t,e,o):Q.decrypt(this._cipher,t,e,o)}encrypt(t,e,o){return typeof e=="string"?Ut.encrypt(this._cipher,t,e,o):Q.encrypt(this._cipher,t,e,o)}};var ft=class extends Lt{static{n(this,"Cipher")}constructor(t,e,o){super(Object.assign({blockSize:1},o)),this._xformMode=t,this._key=e,this.reset()}static _createHelper(t){return new Ve(t)}static createDecryptor(t,e){let o=this;return new o(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()}};ft.ivSize=4;ft.keySize=4;ft._DEC_XFORM_MODE=2;ft._ENC_XFORM_MODE=1;var tt=class{static{n(this,"BlockCipherModeAlgorithm")}constructor(t,e){this.init(t,e)}init(t,e){this._cipher=t,this._iv=e}};var $t=class{static{n(this,"BlockCipherMode")}static createDecryptor(t,e){let o=this.Decryptor;return new o(t,e)}static createEncryptor(t,e){let o=this.Encryptor;return new o(t,e)}};$t.Decryptor=tt;$t.Encryptor=tt;var Xe=class extends tt{static{n(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,o){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<o;i++)t[e+i]^=s[i]}};var Ze=class extends tt{static{n(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 o=t.slice(e,e+this._cipher.cfg.blockSize);this._cipher.decryptBlock(t,e),this.xorBlock(t,e,this._cipher.cfg.blockSize),this._prevBlock=o}xorBlock(t,e,o){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let i=0;i<o;i++)t[e+i]^=s[i]}};var V=class extends $t{static{n(this,"CBC")}};V.Decryptor=Ze;V.Encryptor=Xe;var pt=class{static{n(this,"PKCS7")}static pad(t,e){let o=e*4,s=o-t.sigBytes%o,i=s<<24|s<<16|s<<8|s,a=[];for(let h=0;h<s;h+=4)a.push(i);let c=new _(a,s);t.concat(c)}static unpad(t){let e=t.words[t.sigBytes-1>>>2]&255;t.sigBytes-=e}};var kt=class extends ft{static{n(this,"BlockCipher")}constructor(t,e,o){super(t,e,Object.assign({blockSize:4,mode:V,padding:pt},o))}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 L{static{n(this,"X64Word")}constructor(t,e){this.high=t,this.low=e}add(t){let e=this.low+t.low|0,o=e>>>0<this.low>>>0?1:0,s=this.high+t.high+o|0;return new L(s,e)}and(t){return new L(this.high&t.high,this.low&t.low)}not(){return new L(~this.high,~this.low)}or(t){return new L(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 L(this.high<<t|this.low>>>32-t,this.low<<t):new L(this.low<<t-32,0)}shiftR(t){return t<32?new L(this.high>>>t,this.low>>>t|this.high<<32-t):new L(0,this.high>>>t-32)}xor(t){return new L(this.high^t.high,this.low^t.low)}};var Je=class fe{static{n(this,"X64WordArray")}constructor(t=[],e){this.words=t,this.sigBytes=e!==void 0?e:t.length*8}static create(t=[],e){return new fe(t,e)}clone(){let t=this.words.map(e=>new l(e.high,e.low));return new fe(t,this.sigBytes)}toX32(){let t=[];for(let e of this.words)t.push(e.high,e.low);return new _(t,this.sigBytes)}};var P=[],Ye=[],Qe=[],tr=[],er=[],rr=[],pe=[],ue=[],de=[],me=[];(function(){let r=[];for(let o=0;o<256;o++)o<128?r[o]=o<<1:r[o]=o<<1^283;let t=0,e=0;for(let o=0;o<256;o++){let s=e^e<<1^e<<2^e<<3^e<<4;s=s>>>8^s&255^99,P[t]=s,Ye[s]=t;let i=r[t],a=r[i],c=r[a],h=r[s]*257^s*16843008;Qe[t]=h<<24|h>>>8,tr[t]=h<<16|h>>>16,er[t]=h<<8|h>>>24,rr[t]=h,h=c*16843009^a*65537^i*257^t*16843008,pe[s]=h<<24|h>>>8,ue[s]=h<<16|h>>>16,de[s]=h<<8|h>>>24,me[s]=h,t?(t=i^r[r[r[c^i]]],e^=r[r[e]]):t=e=1}})();var bs=[0,1,2,4,8,16,32,64,128,27,54],Gt=class extends kt{static{n(this,"AES")}constructor(t,e,o){super(t,e,o),super.reset()}decryptBlock(t,e){let o=t[e+1];t[e+1]=t[e+3],t[e+3]=o,this._doCryptBlock(t,e,this._invKeySchedule,pe,ue,de,me,Ye),o=t[e+1],t[e+1]=t[e+3],t[e+3]=o}encryptBlock(t,e){this._doCryptBlock(t,e,this._keySchedule,Qe,tr,er,rr,P)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let t=this._keyPriorReset=this._key,e=t.words,o=t.sigBytes/4,i=((this._nRounds=o+6)+1)*4,a=this._keySchedule=[];for(let c=0;c<i;c++)if(c<o)a[c]=e[c];else{let h=a[c-1];c%o?o>6&&c%o===4&&(h=P[h>>>24]<<24|P[h>>>16&255]<<16|P[h>>>8&255]<<8|P[h&255]):(h=h<<8|h>>>24,h=P[h>>>24]<<24|P[h>>>16&255]<<16|P[h>>>8&255]<<8|P[h&255],h^=bs[c/o|0]<<24),a[c]=a[c-o]^h}this._invKeySchedule=[];for(let c=0;c<i;c++){let h=i-c,f;c%4?f=a[h]:f=a[h-4],c<4||h<=4?this._invKeySchedule[c]=f:this._invKeySchedule[c]=pe[P[f>>>24]]^ue[P[f>>>16&255]]^de[P[f>>>8&255]]^me[P[f&255]]}}_doCryptBlock(t,e,o,s,i,a,c,h){let f=t[e]^o[0],g=t[e+1]^o[1],d=t[e+2]^o[2],m=t[e+3]^o[3],w=4;for(let E=1;E<this._nRounds;E++){let x=s[f>>>24]^i[g>>>16&255]^a[d>>>8&255]^c[m&255]^o[w++],b=s[g>>>24]^i[d>>>16&255]^a[m>>>8&255]^c[f&255]^o[w++],T=s[d>>>24]^i[m>>>16&255]^a[f>>>8&255]^c[g&255]^o[w++],ce=s[m>>>24]^i[f>>>16&255]^a[g>>>8&255]^c[d&255]^o[w++];f=x,g=b,d=T,m=ce}let y=(h[f>>>24]<<24|h[g>>>16&255]<<16|h[d>>>8&255]<<8|h[m&255])^o[w++],v=(h[g>>>24]<<24|h[d>>>16&255]<<16|h[m>>>8&255]<<8|h[f&255])^o[w++],R=(h[d>>>24]<<24|h[m>>>16&255]<<16|h[f>>>8&255]<<8|h[g&255])^o[w++],O=(h[m>>>24]<<24|h[f>>>16&255]<<16|h[g>>>8&255]<<8|h[d&255])^o[w++];t[e]=y,t[e+1]=v,t[e+2]=R,t[e+3]=O}};Gt.keySize=256/32;var As=[1732584193,4023233417,2562383102,271733878,3285377520],et=new Array(80),rt=class extends C{static{n(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(As.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 o=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],a=this._hash.words[3],c=this._hash.words[4];for(let h=0;h<80;h++){if(h<16)et[h]=t[e+h]|0;else{let m=et[h-3]^et[h-8]^et[h-14]^et[h-16];et[h]=m<<1|m>>>31}let f,g;h<20?(f=s&i|~s&a,g=1518500249):h<40?(f=s^i^a,g=1859775393):h<60?(f=s&i|s&a|i&a,g=2400959708):(f=s^i^a,g=3395469782);let d=(o<<5|o>>>27)+f+c+g+et[h];c=a,a=i,i=s<<30|s>>>2,s=o,o=d|0}this._hash.words[0]=this._hash.words[0]+o|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+a|0,this._hash.words[4]=this._hash.words[4]+c|0}};var or=[],sr=[];(function(){function r(s){let i=Math.sqrt(s);for(let a=2;a<=i;a++)if(!(s%a))return!1;return!0}n(r,"isPrime");function t(s){return(s-(s|0))*4294967296|0}n(t,"getFractionalBits");let e=2,o=0;for(;o<64;)r(e)&&(o<8&&(or[o]=t(Math.pow(e,1/2))),sr[o]=t(Math.pow(e,1/3)),o++),e++})();var ot=[],Rt=class extends C{static{n(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(or.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 o=this._hash.words[0],s=this._hash.words[1],i=this._hash.words[2],a=this._hash.words[3],c=this._hash.words[4],h=this._hash.words[5],f=this._hash.words[6],g=this._hash.words[7];for(let d=0;d<64;d++){if(d<16)ot[d]=t[e+d]|0;else{let E=ot[d-15],x=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,b=ot[d-2],T=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;ot[d]=x+ot[d-7]+T+ot[d-16]}let m=c&h^~c&f,w=o&s^o&i^s&i,y=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22),v=(c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25),R=g+v+m+sr[d]+ot[d],O=y+w;g=f,f=h,h=c,c=a+R|0,a=i,i=s,s=o,o=R+O|0}this._hash.words[0]=this._hash.words[0]+o|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+a|0,this._hash.words[4]=this._hash.words[4]+c|0,this._hash.words[5]=this._hash.words[5]+h|0,this._hash.words[6]=this._hash.words[6]+f|0,this._hash.words[7]=this._hash.words[7]+g|0}};var ge=[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 r=0;r<80;r++)D[r]=new l(void 0,void 0)})();var _e=class extends C{static{n(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new Je([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,o=this._nDataBytes*8,s=t.sigBytes*8;return e[s>>>5]|=128<<24-s%32,e[(s+128>>>10<<5)+30]=Math.floor(o/4294967296),e[(s+128>>>10<<5)+31]=o,t.sigBytes=e.length*4,this._process(),this._hash.toX32()}_doProcessBlock(t,e){let o=this._hash.words[0].high,s=this._hash.words[0].low,i=this._hash.words[1].high,a=this._hash.words[1].low,c=this._hash.words[2].high,h=this._hash.words[2].low,f=this._hash.words[3].high,g=this._hash.words[3].low,d=this._hash.words[4].high,m=this._hash.words[4].low,w=this._hash.words[5].high,y=this._hash.words[5].low,v=this._hash.words[6].high,R=this._hash.words[6].low,O=this._hash.words[7].high,E=this._hash.words[7].low;for(let x=0;x<80;x++){let b,T;if(x<16)T=D[x].high=t[e+x*2]|0,b=D[x].low=t[e+x*2+1]|0;else{let Me=D[x-15],nt=Me.high,At=Me.low,ps=(nt>>>1|At<<31)^(nt>>>8|At<<24)^nt>>>7,De=(At>>>1|nt<<31)^(At>>>8|nt<<24)^(At>>>7|nt<<25),Ne=D[x-2],at=Ne.high,vt=Ne.low,us=(at>>>19|vt<<13)^(at<<3|vt>>>29)^at>>>6,Fe=(vt>>>19|at<<13)^(vt<<3|at>>>29)^(vt>>>6|at<<26);b=De+D[x-7].low,T=ps+D[x-7].high+(b>>>0<De>>>0?1:0),b=b+Fe,T=T+us+(b>>>0<Fe>>>0?1:0),b=b+D[x-16].low,T=T+D[x-16].high+(b>>>0<D[x-16].low>>>0?1:0),D[x].high=T,D[x].low=b}let ce=d&w^~d&v,Ie=m&y^~m&R,ns=o&i^o&c^i&c,as=s&a^s&h^a&h,cs=(o>>>28|s<<4)^(o<<30|s>>>2)^(o<<25|s>>>7),Pe=(s>>>28|o<<4)^(s<<30|o>>>2)^(s<<25|o>>>7),hs=(d>>>14|m<<18)^(d>>>18|m<<14)^(d<<23|m>>>9),ls=(m>>>14|d<<18)^(m>>>18|d<<14)^(m<<23|d>>>9),j=E+ls,q=O+hs+(j>>>0<E>>>0?1:0);j=j+Ie,q=q+ce+(j>>>0<Ie>>>0?1:0),j=j+ge[x].low,q=q+ge[x].high+(j>>>0<ge[x].low>>>0?1:0),j=j+b,q=q+T+(j>>>0<b>>>0?1:0);let je=Pe+as,fs=cs+ns+(je>>>0<Pe>>>0?1:0);O=v,E=R,v=w,R=y,w=d,y=m,m=g+j|0,d=f+q+(m>>>0<g>>>0?1:0)|0,f=c,g=h,c=i,h=a,i=o,a=s,s=j+je|0,o=q+fs+(s>>>0<j>>>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+o+(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+a,this._hash.words[1].high=this._hash.words[1].high+i+(this._hash.words[1].low>>>0<a>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+h,this._hash.words[2].high=this._hash.words[2].high+c+(this._hash.words[2].low>>>0<h>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+g,this._hash.words[3].high=this._hash.words[3].high+f+(this._hash.words[3].low>>>0<g>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+m,this._hash.words[4].high=this._hash.words[4].high+d+(this._hash.words[4].low>>>0<m>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+y,this._hash.words[5].high=this._hash.words[5].high+w+(this._hash.words[5].low>>>0<y>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+R,this._hash.words[6].high=this._hash.words[6].high+v+(this._hash.words[6].low>>>0<R>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+E,this._hash.words[7].high=this._hash.words[7].high+O+(this._hash.words[7].low>>>0<E>>>0?1:0)}};var ir=class{static{n(this,"HMAC")}constructor(t,e){this._hasher=new t;let o=typeof e=="string"?I.parse(e):e,s=this._hasher.cfg.blockSize,i=s*4;o.sigBytes>i&&(o=this._hasher.finalize(o)),o.clamp();let a=this._oKey=o.clone(),c=this._iKey=o.clone(),h=a.words,f=c.words;for(let g=0;g<s;g++)h[g]^=1549556828,f[g]^=909522486;a.sigBytes=c.sigBytes=i,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 we=class nr{static{n(this,"PBKDF2")}constructor(t){this.cfg=Object.assign({keySize:128/32,hasher:Rt,iterations:25e4},t)}static execute(t,e,o){return new nr(o).compute(t,e)}compute(t,e){let o=this.cfg,s=new ir(o.hasher,t),i=new _,a=new _([1]),c=i.words,h=a.words,f=o.keySize,g=o.iterations;for(;c.length<f;){let d=s.update(e).finalize(a);s.reset();let m=d.words,w=m.length,y=d;for(let v=1;v<g;v++){y=s.finalize(y),s.reset();let R=y.words;for(let O=0;O<w;O++)m[O]^=R[O]}i.concat(d),h[0]++}return i.sigBytes=f*4,i}};var Ot=kt._createHelper(Gt);var ut=C._createHelper($);var dt=C._createHelper(rt);var Kt=C._createHelper(Rt);var Wt=C._createHelper(_e);var mt=class{static{n(this,"SmpCrypto")}static base64Decode(t){return I.stringify(U.parse(t))}static base64Encode(t){return U.stringify(I.parse(t))}static md5(t){return ut(t).toString()}static sha1(t){return dt(t).toString()}static sha256(t){return Kt(t).toString()}static sha512(t){return Wt(t).toString()}};var St=class extends ht{static{n(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 ar=class{static{n(this,"SmpHttpTwoService")}static _cacheStrategy=typeof sessionStorage<"u"?new Mt:new St;static _errorClass=z;static _mergeParamsFallbackBaseUrl="https://uc-api-nest-common-fe";static _running=new Map;static $http(t){return this._generateAjax(t)}static async _generateAjax(t){let e=this._generateCacheKey(t),o=+(t.ttl||0)>0;if(o){let a=this._cacheStrategy.read(e);if(a)return Promise.resolve(a)}let s=this._running.get(e);if(s)return s;let i=this._generateAjaxBase(t).then(a=>(o&&this._cacheStrategy.write(e,a,t.ttl),a)).finally(()=>{this._running.delete(e)});return this._running.set(e,i),i}static async _generateAjaxBase(t){let e=await this._preprocessRequest(t),o={method:e.method,headers:new Headers({"content-type":"application/json",...e.headers}),body:e.body?JSON.stringify(e.body):null};return e.useCredentials&&(o.credentials="include"),e.url=this.mergeQueryParams(e.url,e.queryParams),fetch(e.url,o).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(i=>{let a=i;try{a=this._errorClass.fromPlain(i)}catch(c){console.debug("http: failed to parse error response into ErrorResponse",c)}return Promise.reject({status:s.status,message:s.statusText,body:a})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(t,e){if(!e||Object.keys(e).length===0)return t;let o=t.startsWith("http"),s=new URL(t,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),a={...Object.fromEntries(new URLSearchParams(s.search).entries()),...e},c=[];for(let[d,m]of Object.entries(a))if(m!=null)if(Array.isArray(m))for(let w of m)c.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(w))}`);else c.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(m))}`);let h=c.length?`?${c.join("&")}`:"",g=s.origin+s.pathname+h;return o?g:g.replace(s.origin,"")}static _generateCacheKey(t){let e=`${t.method}:${t.url}`;return t.queryParams&&Object.keys(t.queryParams).length>0&&(e+=`:${mt.md5(JSON.stringify(t.queryParams))}`),t.body&&Object.keys(t.body).length>0?`${e}:${mt.md5(JSON.stringify(t.body))}`:e}static async _preprocessRequest(t){return t}static async _preprocessResponse(t,e){return e}};import{SmpLoggerMethods as vs}from"@tonysamperi/logger";var cr=class{static{n(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new vs;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,(o,s)=>{let i=e[s];return i!==void 0?encodeURIComponent(i):o})}catch(o){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,o)}return t}};var Ep={status:"OK"};var hr=(function(r){return r.GET="GET",r.POST="POST",r.PUT="PUT",r.DELETE="DELETE",r.PATCH="PATCH",r})({});var lr=class{static{n(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,o){this._access_token=t,this._exp=e,this._iss=o}serialize(){return{access_token:this._access_token,exp:this._exp,iss:this._iss}}};var fr=class{static{n(this,"SmpBaseJwtTokenPlain")}access_token;exp;iss};var Bt=class{static{n(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?H.parse(this._initVector):void 0}_mode=V;_padding=pt;constructor(t,e,o){this._password=t,this._salt=e,this._initVector=o}decryptAES(t){return Ot.decrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(t){return Ot.encrypt(t,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return we.execute(this._password,H.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:rt})}};var ye=class{static{n(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 z.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:$e.BadRequest})}_encode(){let t=new $;return t.update(I.parse(this._seed+this._baseCode)),t.finalize().toString(H).substring(0,this._crcLength).toUpperCase()}};import{Expose as Rs,instanceToPlain as Os,plainToInstance as Bs}from"class-transformer";import{DateTime as xe}from"ts-luxon";var M=(function(r){return r.ACTIVATE="ACTIVATE",r.BLOCK="BLOCK",r.CHECK="CHECK",r.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",r.FREEZE="FREEZE",r.PURCHASE="PURCHASE",r.RECHARGE="RECHARGE",r.ROLLBACK="ROLLBACK",r.TRANSACTION="TRANSACTION",r.TRANSACTION_DETAIL="TRANSACTION_DETAIL",r.UNFREEZE="UNFREEZE",r.XREFUND="XREFUND",r})({});var gt=(function(r){return r.MD5="MD5",r.MD5_HMAC="MD5_HMAC",r.SHA1="SHA1",r.SHA1_HMAC="SHA1_HMAC",r})({});function Es(r,t,e,o){var s=arguments.length,i=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,e):o,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,o);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(i=(s<3?a(i):s>3?a(t,e,i):a(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}n(Es,"_ts_decorate");function pr(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}n(pr,"_ts_metadata");var be=class r{static{n(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new Bt("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _OP_CODES={[M.CHECK]:"",[M.TRANSACTION]:"",[M.TRANSACTION_DETAIL]:"",[M.ACTIVATE]:"A",[M.BLOCK]:"B",[M.DIGITAL_ACTIVATE]:"D",[M.FREEZE]:"F",[M.PURCHASE]:"P",[M.RECHARGE]:"G",[M.ROLLBACK]:"R",[M.UNFREEZE]:"U",[M.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={[gt.MD5]:t=>ut(t),[gt.MD5_HMAC]:t=>{let e=new $;return e.update(I.parse(t)),e.finalize()},[gt.SHA1]:t=>dt(t),[gt.SHA1_HMAC]:t=>{let e=new rt;return e.update(I.parse(t)),e.finalize()}};_hashStrategy=this._hashStrategies[gt.MD5];constructor(t="ACTIVATION",e,o,s){this.gc=t,this.op=e,this.ot=o,this._dto=typeof s=="number"&&s>=0?xe.fromMillis(+`${s}000`.slice(0,13)):xe.local()}static build({gc:t,op:e,ot:o,dto:s}){return new this(t,e,o,s?.ts)}static explode(t){let e=this.constructor,o=(t||"").split(e._SEP);if(o.length<4)throw new Error(`${this.constructor.name}::explode: invalid transactionId provided => "${t}"`);return this.build({gc:o[1],op:e.prefixToOperation(o[2]),dto:xe.fromSeconds(+o[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){console.info(`${this.constructor.name}::parse: trying to parse ${t}`);try{if(this.isBase64(t)){let e=this._AES_ENCODER.decryptAES(t),o=JSON.parse(e);return Bs(r,o)}else return this.explode(t)}catch(e){throw console.error(`${this.constructor.name}::parse: failed to parse ${t}`,e),new Error(`${this.constructor.name}::parse: could not parse transactionId ${t}`)}}static prefixToOperation(t){return Object.entries(this._OP_CODES).find(([,o])=>o===t)[0]}serialize(){return Os(this,{excludePrefixes:["_"]})}toString(){let t=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(t)}};Es([Rs(),pr("design:type",Number),pr("design:paramtypes",[])],be.prototype,"ts",null);var Qp=(function(r){return r.ListDetectiveValidator="ListDetectiveValidator",r.MXValidator="MXValidator",r.SyntaxValidator="SyntaxValidator",r})({});function eu(r,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{o!=="constructor"&&(o in r.prototype||Object.defineProperty(r.prototype,o,Object.getOwnPropertyDescriptor(e.prototype,o)))});try{let o=new e;Object.getOwnPropertyNames(o).forEach(s=>{s in r.prototype||Object.defineProperty(r.prototype,s,Object.getOwnPropertyDescriptor(o,s))})}catch{}Object.getOwnPropertyNames(e).forEach(o=>{o!=="prototype"&&o!=="name"&&o!=="length"&&(o in r||Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o)))})})}n(eu,"smpApplyMixin");function Ts(){this.__data__=[],this.size=0}n(Ts,"listCacheClear");var ur=Ts;function Cs(r,t){return r===t||r!==r&&t!==t}n(Cs,"eq");var qt=Cs;function Is(r,t){for(var e=r.length;e--;)if(qt(r[e][0],t))return e;return-1}n(Is,"assocIndexOf");var X=Is;var Ps=Array.prototype,js=Ps.splice;function Ms(r){var t=this.__data__,e=X(t,r);if(e<0)return!1;var o=t.length-1;return e==o?t.pop():js.call(t,e,1),--this.size,!0}n(Ms,"listCacheDelete");var dr=Ms;function Ds(r){var t=this.__data__,e=X(t,r);return e<0?void 0:t[e][1]}n(Ds,"listCacheGet");var mr=Ds;function Ns(r){return X(this.__data__,r)>-1}n(Ns,"listCacheHas");var gr=Ns;function Fs(r,t){var e=this.__data__,o=X(e,r);return o<0?(++this.size,e.push([r,t])):e[o][1]=t,this}n(Fs,"listCacheSet");var _r=Fs;function _t(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var o=r[t];this.set(o[0],o[1])}}n(_t,"ListCache");_t.prototype.clear=ur;_t.prototype.delete=dr;_t.prototype.get=mr;_t.prototype.has=gr;_t.prototype.set=_r;var Z=_t;function Ls(){this.__data__=new Z,this.size=0}n(Ls,"stackClear");var wr=Ls;function zs(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}n(zs,"stackDelete");var yr=zs;function Us(r){return this.__data__.get(r)}n(Us,"stackGet");var xr=Us;function $s(r){return this.__data__.has(r)}n($s,"stackHas");var br=$s;var ks=typeof global=="object"&&global&&global.Object===Object&&global,Ht=ks;var Gs=typeof self=="object"&&self&&self.Object===Object&&self,Ks=Ht||Gs||Function("return this")(),B=Ks;var Ws=B.Symbol,k=Ws;var Ar=Object.prototype,Ss=Ar.hasOwnProperty,qs=Ar.toString,Tt=k?k.toStringTag:void 0;function Hs(r){var t=Ss.call(r,Tt),e=r[Tt];try{r[Tt]=void 0;var o=!0}catch{}var s=qs.call(r);return o&&(t?r[Tt]=e:delete r[Tt]),s}n(Hs,"getRawTag");var vr=Hs;var Vs=Object.prototype,Xs=Vs.toString;function Zs(r){return Xs.call(r)}n(Zs,"objectToString");var Er=Zs;var Js="[object Null]",Ys="[object Undefined]",Rr=k?k.toStringTag:void 0;function Qs(r){return r==null?r===void 0?Ys:Js:Rr&&Rr in Object(r)?vr(r):Er(r)}n(Qs,"baseGetTag");var G=Qs;function ti(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}n(ti,"isObject");var Vt=ti;var ei="[object AsyncFunction]",ri="[object Function]",oi="[object GeneratorFunction]",si="[object Proxy]";function ii(r){if(!Vt(r))return!1;var t=G(r);return t==ri||t==oi||t==ei||t==si}n(ii,"isFunction");var Xt=ii;var ni=B["__core-js_shared__"],Zt=ni;var Or=(function(){var r=/[^.]+$/.exec(Zt&&Zt.keys&&Zt.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function ai(r){return!!Or&&Or in r}n(ai,"isMasked");var Br=ai;var ci=Function.prototype,hi=ci.toString;function li(r){if(r!=null){try{return hi.call(r)}catch{}try{return r+""}catch{}}return""}n(li,"toSource");var K=li;var fi=/[\\^$.*+?()[\]{}|]/g,pi=/^\[object .+?Constructor\]$/,ui=Function.prototype,di=Object.prototype,mi=ui.toString,gi=di.hasOwnProperty,_i=RegExp("^"+mi.call(gi).replace(fi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function wi(r){if(!Vt(r)||Br(r))return!1;var t=Xt(r)?_i:pi;return t.test(K(r))}n(wi,"baseIsNative");var Tr=wi;function yi(r,t){return r?.[t]}n(yi,"getValue");var Cr=yi;function xi(r,t){var e=Cr(r,t);return Tr(e)?e:void 0}n(xi,"getNative");var N=xi;var bi=N(B,"Map"),J=bi;var Ai=N(Object,"create"),W=Ai;function vi(){this.__data__=W?W(null):{},this.size=0}n(vi,"hashClear");var Ir=vi;function Ei(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}n(Ei,"hashDelete");var Pr=Ei;var Ri="__lodash_hash_undefined__",Oi=Object.prototype,Bi=Oi.hasOwnProperty;function Ti(r){var t=this.__data__;if(W){var e=t[r];return e===Ri?void 0:e}return Bi.call(t,r)?t[r]:void 0}n(Ti,"hashGet");var jr=Ti;var Ci=Object.prototype,Ii=Ci.hasOwnProperty;function Pi(r){var t=this.__data__;return W?t[r]!==void 0:Ii.call(t,r)}n(Pi,"hashHas");var Mr=Pi;var ji="__lodash_hash_undefined__";function Mi(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=W&&t===void 0?ji:t,this}n(Mi,"hashSet");var Dr=Mi;function wt(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var o=r[t];this.set(o[0],o[1])}}n(wt,"Hash");wt.prototype.clear=Ir;wt.prototype.delete=Pr;wt.prototype.get=jr;wt.prototype.has=Mr;wt.prototype.set=Dr;var Ae=wt;function Di(){this.size=0,this.__data__={hash:new Ae,map:new(J||Z),string:new Ae}}n(Di,"mapCacheClear");var Nr=Di;function Ni(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}n(Ni,"isKeyable");var Fr=Ni;function Fi(r,t){var e=r.__data__;return Fr(t)?e[typeof t=="string"?"string":"hash"]:e.map}n(Fi,"getMapData");var Y=Fi;function Li(r){var t=Y(this,r).delete(r);return this.size-=t?1:0,t}n(Li,"mapCacheDelete");var Lr=Li;function zi(r){return Y(this,r).get(r)}n(zi,"mapCacheGet");var zr=zi;function Ui(r){return Y(this,r).has(r)}n(Ui,"mapCacheHas");var Ur=Ui;function $i(r,t){var e=Y(this,r),o=e.size;return e.set(r,t),this.size+=e.size==o?0:1,this}n($i,"mapCacheSet");var $r=$i;function yt(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var o=r[t];this.set(o[0],o[1])}}n(yt,"MapCache");yt.prototype.clear=Nr;yt.prototype.delete=Lr;yt.prototype.get=zr;yt.prototype.has=Ur;yt.prototype.set=$r;var Jt=yt;var ki=200;function Gi(r,t){var e=this.__data__;if(e instanceof Z){var o=e.__data__;if(!J||o.length<ki-1)return o.push([r,t]),this.size=++e.size,this;e=this.__data__=new Jt(o)}return e.set(r,t),this.size=e.size,this}n(Gi,"stackSet");var kr=Gi;function xt(r){var t=this.__data__=new Z(r);this.size=t.size}n(xt,"Stack");xt.prototype.clear=wr;xt.prototype.delete=yr;xt.prototype.get=xr;xt.prototype.has=br;xt.prototype.set=kr;var Yt=xt;var Ki="__lodash_hash_undefined__";function Wi(r){return this.__data__.set(r,Ki),this}n(Wi,"setCacheAdd");var Gr=Wi;function Si(r){return this.__data__.has(r)}n(Si,"setCacheHas");var Kr=Si;function Qt(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new Jt;++t<e;)this.add(r[t])}n(Qt,"SetCache");Qt.prototype.add=Qt.prototype.push=Gr;Qt.prototype.has=Kr;var Wr=Qt;function qi(r,t){for(var e=-1,o=r==null?0:r.length;++e<o;)if(t(r[e],e,r))return!0;return!1}n(qi,"arraySome");var Sr=qi;function Hi(r,t){return r.has(t)}n(Hi,"cacheHas");var qr=Hi;var Vi=1,Xi=2;function Zi(r,t,e,o,s,i){var a=e&Vi,c=r.length,h=t.length;if(c!=h&&!(a&&h>c))return!1;var f=i.get(r),g=i.get(t);if(f&&g)return f==t&&g==r;var d=-1,m=!0,w=e&Xi?new Wr:void 0;for(i.set(r,t),i.set(t,r);++d<c;){var y=r[d],v=t[d];if(o)var R=a?o(v,y,d,t,r,i):o(y,v,d,r,t,i);if(R!==void 0){if(R)continue;m=!1;break}if(w){if(!Sr(t,function(O,E){if(!qr(w,E)&&(y===O||s(y,O,e,o,i)))return w.push(E)})){m=!1;break}}else if(!(y===v||s(y,v,e,o,i))){m=!1;break}}return i.delete(r),i.delete(t),m}n(Zi,"equalArrays");var te=Zi;var Ji=B.Uint8Array,ve=Ji;function Yi(r){var t=-1,e=Array(r.size);return r.forEach(function(o,s){e[++t]=[s,o]}),e}n(Yi,"mapToArray");var Hr=Yi;function Qi(r){var t=-1,e=Array(r.size);return r.forEach(function(o){e[++t]=o}),e}n(Qi,"setToArray");var Vr=Qi;var tn=1,en=2,rn="[object Boolean]",on="[object Date]",sn="[object Error]",nn="[object Map]",an="[object Number]",cn="[object RegExp]",hn="[object Set]",ln="[object String]",fn="[object Symbol]",pn="[object ArrayBuffer]",un="[object DataView]",Xr=k?k.prototype:void 0,Ee=Xr?Xr.valueOf:void 0;function dn(r,t,e,o,s,i,a){switch(e){case un:if(r.byteLength!=t.byteLength||r.byteOffset!=t.byteOffset)return!1;r=r.buffer,t=t.buffer;case pn:return!(r.byteLength!=t.byteLength||!i(new ve(r),new ve(t)));case rn:case on:case an:return qt(+r,+t);case sn:return r.name==t.name&&r.message==t.message;case cn:case ln:return r==t+"";case nn:var c=Hr;case hn:var h=o&tn;if(c||(c=Vr),r.size!=t.size&&!h)return!1;var f=a.get(r);if(f)return f==t;o|=en,a.set(r,t);var g=te(c(r),c(t),o,s,i,a);return a.delete(r),g;case fn:if(Ee)return Ee.call(r)==Ee.call(t)}return!1}n(dn,"equalByTag");var Zr=dn;function mn(r,t){for(var e=-1,o=t.length,s=r.length;++e<o;)r[s+e]=t[e];return r}n(mn,"arrayPush");var Jr=mn;var gn=Array.isArray,st=gn;function _n(r,t,e){var o=t(r);return st(r)?o:Jr(o,e(r))}n(_n,"baseGetAllKeys");var Yr=_n;function wn(r,t){for(var e=-1,o=r==null?0:r.length,s=0,i=[];++e<o;){var a=r[e];t(a,e,r)&&(i[s++]=a)}return i}n(wn,"arrayFilter");var Qr=wn;function yn(){return[]}n(yn,"stubArray");var to=yn;var xn=Object.prototype,bn=xn.propertyIsEnumerable,eo=Object.getOwnPropertySymbols,An=eo?function(r){return r==null?[]:(r=Object(r),Qr(eo(r),function(t){return bn.call(r,t)}))}:to,ro=An;function vn(r,t){for(var e=-1,o=Array(r);++e<r;)o[e]=t(e);return o}n(vn,"baseTimes");var oo=vn;function En(r){return r!=null&&typeof r=="object"}n(En,"isObjectLike");var S=En;var Rn="[object Arguments]";function On(r){return S(r)&&G(r)==Rn}n(On,"baseIsArguments");var Re=On;var so=Object.prototype,Bn=so.hasOwnProperty,Tn=so.propertyIsEnumerable,Cn=Re((function(){return arguments})())?Re:function(r){return S(r)&&Bn.call(r,"callee")&&!Tn.call(r,"callee")},io=Cn;function In(){return!1}n(In,"stubFalse");var no=In;var ho=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ao=ho&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=ao&&ao.exports===ho,co=Pn?B.Buffer:void 0,jn=co?co.isBuffer:void 0,Mn=jn||no,Ct=Mn;var Dn=9007199254740991,Nn=/^(?:0|[1-9]\d*)$/;function Fn(r,t){var e=typeof r;return t=t??Dn,!!t&&(e=="number"||e!="symbol"&&Nn.test(r))&&r>-1&&r%1==0&&r<t}n(Fn,"isIndex");var lo=Fn;var Ln=9007199254740991;function zn(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Ln}n(zn,"isLength");var ee=zn;var Un="[object Arguments]",$n="[object Array]",kn="[object Boolean]",Gn="[object Date]",Kn="[object Error]",Wn="[object Function]",Sn="[object Map]",qn="[object Number]",Hn="[object Object]",Vn="[object RegExp]",Xn="[object Set]",Zn="[object String]",Jn="[object WeakMap]",Yn="[object ArrayBuffer]",Qn="[object DataView]",ta="[object Float32Array]",ea="[object Float64Array]",ra="[object Int8Array]",oa="[object Int16Array]",sa="[object Int32Array]",ia="[object Uint8Array]",na="[object Uint8ClampedArray]",aa="[object Uint16Array]",ca="[object Uint32Array]",A={};A[ta]=A[ea]=A[ra]=A[oa]=A[sa]=A[ia]=A[na]=A[aa]=A[ca]=!0;A[Un]=A[$n]=A[Yn]=A[kn]=A[Qn]=A[Gn]=A[Kn]=A[Wn]=A[Sn]=A[qn]=A[Hn]=A[Vn]=A[Xn]=A[Zn]=A[Jn]=!1;function ha(r){return S(r)&&ee(r.length)&&!!A[G(r)]}n(ha,"baseIsTypedArray");var fo=ha;function la(r){return function(t){return r(t)}}n(la,"baseUnary");var po=la;var uo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,It=uo&&typeof module=="object"&&module&&!module.nodeType&&module,fa=It&&It.exports===uo,Oe=fa&&Ht.process,pa=(function(){try{var r=It&&It.require&&It.require("util").types;return r||Oe&&Oe.binding&&Oe.binding("util")}catch{}})(),Be=pa;var mo=Be&&Be.isTypedArray,ua=mo?po(mo):fo,re=ua;var da=Object.prototype,ma=da.hasOwnProperty;function ga(r,t){var e=st(r),o=!e&&io(r),s=!e&&!o&&Ct(r),i=!e&&!o&&!s&&re(r),a=e||o||s||i,c=a?oo(r.length,String):[],h=c.length;for(var f in r)(t||ma.call(r,f))&&!(a&&(f=="length"||s&&(f=="offset"||f=="parent")||i&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||lo(f,h)))&&c.push(f);return c}n(ga,"arrayLikeKeys");var go=ga;var _a=Object.prototype;function wa(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||_a;return r===e}n(wa,"isPrototype");var _o=wa;function ya(r,t){return function(e){return r(t(e))}}n(ya,"overArg");var wo=ya;var xa=wo(Object.keys,Object),yo=xa;var ba=Object.prototype,Aa=ba.hasOwnProperty;function va(r){if(!_o(r))return yo(r);var t=[];for(var e in Object(r))Aa.call(r,e)&&e!="constructor"&&t.push(e);return t}n(va,"baseKeys");var xo=va;function Ea(r){return r!=null&&ee(r.length)&&!Xt(r)}n(Ea,"isArrayLike");var bo=Ea;function Ra(r){return bo(r)?go(r):xo(r)}n(Ra,"keys");var Ao=Ra;function Oa(r){return Yr(r,Ao,ro)}n(Oa,"getAllKeys");var Te=Oa;var Ba=1,Ta=Object.prototype,Ca=Ta.hasOwnProperty;function Ia(r,t,e,o,s,i){var a=e&Ba,c=Te(r),h=c.length,f=Te(t),g=f.length;if(h!=g&&!a)return!1;for(var d=h;d--;){var m=c[d];if(!(a?m in t:Ca.call(t,m)))return!1}var w=i.get(r),y=i.get(t);if(w&&y)return w==t&&y==r;var v=!0;i.set(r,t),i.set(t,r);for(var R=a;++d<h;){m=c[d];var O=r[m],E=t[m];if(o)var x=a?o(E,O,m,t,r,i):o(O,E,m,r,t,i);if(!(x===void 0?O===E||s(O,E,e,o,i):x)){v=!1;break}R||(R=m=="constructor")}if(v&&!R){var b=r.constructor,T=t.constructor;b!=T&&"constructor"in r&&"constructor"in t&&!(typeof b=="function"&&b instanceof b&&typeof T=="function"&&T instanceof T)&&(v=!1)}return i.delete(r),i.delete(t),v}n(Ia,"equalObjects");var vo=Ia;var Pa=N(B,"DataView"),oe=Pa;var ja=N(B,"Promise"),se=ja;var Ma=N(B,"Set"),ie=Ma;var Da=N(B,"WeakMap"),ne=Da;var Eo="[object Map]",Na="[object Object]",Ro="[object Promise]",Oo="[object Set]",Bo="[object WeakMap]",To="[object DataView]",Fa=K(oe),La=K(J),za=K(se),Ua=K(ie),$a=K(ne),it=G;(oe&&it(new oe(new ArrayBuffer(1)))!=To||J&&it(new J)!=Eo||se&&it(se.resolve())!=Ro||ie&&it(new ie)!=Oo||ne&&it(new ne)!=Bo)&&(it=n(function(r){var t=G(r),e=t==Na?r.constructor:void 0,o=e?K(e):"";if(o)switch(o){case Fa:return To;case La:return Eo;case za:return Ro;case Ua:return Oo;case $a:return Bo}return t},"getTag"));var Ce=it;var ka=1,Co="[object Arguments]",Io="[object Array]",ae="[object Object]",Ga=Object.prototype,Po=Ga.hasOwnProperty;function Ka(r,t,e,o,s,i){var a=st(r),c=st(t),h=a?Io:Ce(r),f=c?Io:Ce(t);h=h==Co?ae:h,f=f==Co?ae:f;var g=h==ae,d=f==ae,m=h==f;if(m&&Ct(r)){if(!Ct(t))return!1;a=!0,g=!1}if(m&&!g)return i||(i=new Yt),a||re(r)?te(r,t,e,o,s,i):Zr(r,t,h,e,o,s,i);if(!(e&ka)){var w=g&&Po.call(r,"__wrapped__"),y=d&&Po.call(t,"__wrapped__");if(w||y){var v=w?r.value():r,R=y?t.value():t;return i||(i=new Yt),s(v,R,e,o,i)}}return m?(i||(i=new Yt),vo(r,t,e,o,s,i)):!1}n(Ka,"baseIsEqualDeep");var jo=Ka;function Mo(r,t,e,o,s){return r===t?!0:r==null||t==null||!S(r)&&!S(t)?r!==r&&t!==t:jo(r,t,e,o,Mo,s)}n(Mo,"baseIsEqual");var Do=Mo;function Wa(r,t){return Do(r,t)}n(Wa,"isEqual");var No=Wa;var Sa=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Fo(r){return r.match(Sa)}n(Fo,"smpAsciiWords");var Go="\\ud800-\\udfff",qa="\\u0300-\\u036f",Ha="\\ufe20-\\ufe2f",Va="\\u20d0-\\u20ff",Xa="\\u1ab0-\\u1aff",Za="\\u1dc0-\\u1dff",Ja=qa+Ha+Va+Xa+Za,Ko="\\u2700-\\u27bf",Wo="a-z\\xdf-\\xf6\\xf8-\\xff",Ya="\\xac\\xb1\\xd7\\xf7",Qa="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",tc="\\u2000-\\u206f",ec=" \\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",So="A-Z\\xc0-\\xd6\\xd8-\\xde",rc="\\ufe0e\\ufe0f",qo=Ya+Qa+tc+ec,Ho="['\u2019]",Lo=`[${qo}]`,oc=`[${Ja}]`,Vo="\\d",sc=`[${Ko}]`,Xo=`[${Wo}]`,Zo=`[^${Go}${qo+Vo+Ko+Wo+So}]`,ic="\\ud83c[\\udffb-\\udfff]",nc=`(?:${oc}|${ic})`,ac=`[^${Go}]`,Jo="(?:\\ud83c[\\udde6-\\uddff]){2}",Yo="[\\ud800-\\udbff][\\udc00-\\udfff]",bt=`[${So}]`,cc="\\u200d",zo=`(?:${Xo}|${Zo})`,hc=`(?:${bt}|${Zo})`,Uo=`(?:${Ho}(?:d|ll|m|re|s|t|ve))?`,$o=`(?:${Ho}(?:D|LL|M|RE|S|T|VE))?`,Qo=`${nc}?`,ts=`[${rc}]?`,lc=`(?:${cc}(?:${[ac,Jo,Yo].join("|")})${ts+Qo})*`,fc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",pc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",uc=ts+Qo+lc,ko=`(?:${[sc,Jo,Yo].join("|")})${uc}`,Pt=class{static{n(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([`${bt}?${Xo}+${Uo}(?=${[Lo,bt,"$"].join("|")})`,`${hc}+${$o}(?=${[Lo,bt+zo,"$"].join("|")})`,`${bt}?${zo}+${Uo}`,`${bt}+${$o}`,pc,fc,`${Vo}+`,ko].join("|"),"g");static RS_EMOJI=ko;static unicodeWords(t){return t.match(this.RE_UNICODE_WORDS)}};var es=class{static{n(this,"SmpCommonUtils")}static arrayRemove(t,e){let o=[],s=t.filter((i,a)=>e(i,a)&&o.push(a));return o.reverse().forEach(i=>t.splice(i,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,o){if(!(t instanceof e))throw new Error(o||`${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(o=>!!o).join("/").replace(/(?<!:)\/\/+/g,"/");return e.startsWith("http")&&!e.endsWith("/")?`${e}/`:e}static downloadBlob(t,e){let o=window.URL.createObjectURL(t),s=document.createElement("a");s.href=o,s.setAttribute("download",e),document.body.appendChild(s),s.click()}static generateRandomHexString(t=12){let e="0123456789abcdef",o="";for(let s=0;s<t;s++){let i=Math.floor(Math.random()*e.length);o+=e[i]}return o}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,o=0;for(;Math.round(+t*e)/e!==t;)e*=10,o++;return o}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){return No(t,e)}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((o,[s,i])=>(o.push(e(i,s)),o),[]);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 this.isObject(t)?Object.entries(t).reduce((o,[s,i])=>{let a=e(s,i);return o[a]=i,o},{}):{}}static mapObjectValues(t,e){return this.isObject(t)?Object.entries(t).reduce((o,[s,i])=>(o[s]=e.call(null,i,s),o),{}):{}}static noop(){}static objectHasValue(t,e){return!!~Object.values(t).filter(o=>this.isEqual(o,e))}static omit(t,e){return Object.keys(t).filter(s=>!e.includes(s)).reduce((s,i)=>(s[i]=t[i],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((o,s)=>(s in t&&(o[s]=t[s]),o),{})}static runSafely(t,e=null,o=[]){if(this.isFunction(t))return t.apply(e,o)}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=hr.POST,data:o,target:s}){let i=Object.entries(o||{}).map(([c,h])=>`<input name="${c}" type="hidden" value="${h}" />`),a=document.createElement("form");a.method=e,a.action=t,a.innerHTML=`${i}`,a.target=s||"_self",document.body.append(a),a.submit()}static toCamelCase(t){return this.words(t.replace(/['\u2019]/g,"")).reduce((e,o,s)=>(o=o.toLowerCase(),e+(s?o.charAt(0).toUpperCase()+o.slice(1):o)),"")}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?(Pt.HAS_UNICODE_WORD(t)?Pt.unicodeWords(t):Fo(t))||[]:t.match(e)||[]}};var rs=class extends Error{static{n(this,"SmpFilterException")}message;data;constructor(t="Filter Exception",e){super(),this.message=t,this.data=e}};import{DateTime as os}from"ts-luxon";var ss=class r{static{n(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return os.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix="$1";constructor(t=`sid-xxxx-${+os.now().ts}`,e=0){this.value=t,this.expiry=e}static parse(t){return new r(t.value,t.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};import{smpNoop as q0}from"@tonysamperi/logger";var is=class{static{n(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 X0="2.0.0-beta.5";export{Ep as SMP_HEALTHZ,Le as SmpAbstractCacheStrategy,ht as SmpAbstractTtlCacheStrategy,Bt as SmpAesCrypt,cr as SmpApiCommonUtils,lr as SmpBaseJwtToken,fr as SmpBaseJwtTokenPlain,jt as SmpBrowserCache,es as SmpCommonUtils,mt as SmpCrypto,z as SmpErrorResponse,rs as SmpFilterException,gc as SmpFirebaseErrors,Et as SmpGenericResponse,be as SmpGiftcardTransaction,gt as SmpGiftcardTransactionHashStrategies,M as SmpGiftcardTransactionOps,Mt as SmpHttpSessionStorageCache,$e as SmpHttpStatusCodes,ar as SmpHttpTwoService,St as SmpInMemoryCache,Qp as SmpMarketingCloudValidators,is as SmpRegularExpressions,F as SmpResponseMessage,ct as SmpResponseMessageTypes,hr as SmpRestVerbs,ye as SmpSecureCode,ss as SmpSid,dc as SmpSocialSignInKeys,mc as SmpSocialSignInUxModes,X0 as VERSION,eu as smpApplyMixin,ze as smpIsSmpCachedValue,q0 as smpNoop};
@@ -101,6 +101,6 @@ declare function smpRxjsThrowIfEmpty<T>(errorFactory?: (value: T) => any): Opera
101
101
  * error: err => console.error("Error:", err)
102
102
  * });
103
103
  */
104
- declare function smpRxjsThrowOnCondition<T>(condition: (value: T) => boolean, errorFactory?: () => any): OperatorFunction<T, T>;
104
+ declare function smpRxjsThrowOnCondition<T>(condition: (value: T) => boolean, errorFactory?: (value: T) => any): OperatorFunction<T, T>;
105
105
 
106
106
  export { SmpAbstractRxjsTtlCacheStrategy, SmpRxjsInMemoryCache, smpRxjsCatchOnly, smpRxjsQueue, smpRxjsSequence, smpRxjsThrowIfEmpty, smpRxjsThrowOnCondition };
package/dist/esm/rxjs.js CHANGED
@@ -1 +1 @@
1
- import{a as u,b as f}from"./chunk-VBEMFJKM.js";import{a as o}from"./chunk-EI7MMDWY.js";import{map as _}from"rxjs";import{DateTime as m}from"ts-luxon";var i=class extends u{static{o(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(t){return this._readRaw(t).pipe(_(e=>{if(this._isSmpCachedValue(e)){if(e.expiry>=m.now().ts)return e.value;this._removeRaw(t).subscribe();return}return e}))}remove(t){return this._removeRaw(t)}write(t,e,s){let n;if(isNaN(+s)||+s<=0)n=this._writeRaw(t,e,s);else{let p=m.now().ts+s*1e3,c={value:e,expiry:p};n=this._writeRaw(t,c,s)}return n.subscribe(),n}_isSmpCachedValue(t){return f(t)}};import{catchError as y,throwError as x}from"rxjs";function k(r,t){return e=>e.pipe(y(s=>(typeof r==typeof isNaN?R(r)?S(s,r):r(s):!1)?t(s):x(()=>s)))}o(k,"smpRxjsCatchOnly");function R(r){try{return Reflect.construct(String,[],r),!0}catch{return!1}}o(R,"isConstructor");function S(r,t){return typeof r=="object"&&r!==null&&r.constructor===t}o(S,"isExactInstance");import{of as a}from"rxjs";var h=class extends i{static{o(this,"SmpRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return this._staticSelf._storage.clear(),a(void 0)}_readRaw(t){return a(this._staticSelf._storage.get(t))}_removeRaw(t){return this._staticSelf._storage.delete(t),a(void 0)}_writeRaw(t,e){return this._staticSelf._storage.set(t,e),a(void 0)}};import{map as d,of as g,defer as E,switchMap as b}from"rxjs";function l(r){let t=[];function e(s){return s>=r.length?g(t):E(()=>r[s]()).pipe(b(n=>(t[s]=n,e(s+1))))}return o(e,"runStep"),e(0)}o(l,"smpRxjsSequence");function P(r){if(Array.isArray(r))return l(r);{let t=Object.keys(r),e=t.map(s=>r[s]);return l(e).pipe(d(s=>{let n={};return t.forEach((p,c)=>{n[p]=s[c]}),n}))}}o(P,"smpRxjsQueue");import{concatMap as j,from as v,toArray as C}from"rxjs";function Y(r){return v(r).pipe(j(e=>e()),C())}o(Y,"smpRxjsSequence");import{map as N}from"rxjs";function w(r=A){return t=>t.pipe(N(e=>{if(~O.indexOf(JSON.stringify(e)))throw r(e);return e}))}o(w,"smpRxjsThrowIfEmpty");var O=[void 0,null,!1,0,"","0",[],{}].map(r=>JSON.stringify(r)),A=o(()=>new Error,"defaultErrorFactory");import{defaultIfEmpty as I,filter as T}from"rxjs";function it(r,t){return e=>e.pipe(T(s=>!r(s)),I(!1),w(t))}o(it,"smpRxjsThrowOnCondition");export{i as SmpAbstractRxjsTtlCacheStrategy,h as SmpRxjsInMemoryCache,k as smpRxjsCatchOnly,P as smpRxjsQueue,Y as smpRxjsSequence,w as smpRxjsThrowIfEmpty,it as smpRxjsThrowOnCondition};
1
+ import{a as u,b as f}from"./chunk-VBEMFJKM.js";import{a as s}from"./chunk-EI7MMDWY.js";import{map as _}from"rxjs";import{DateTime as m}from"ts-luxon";var a=class extends u{static{s(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(t){return this._readRaw(t).pipe(_(e=>{if(this._isSmpCachedValue(e)){if(e.expiry>=m.now().ts)return e.value;this._removeRaw(t).subscribe();return}return e}))}remove(t){return this._removeRaw(t)}write(t,e,o){let n;if(isNaN(+o)||+o<=0)n=this._writeRaw(t,e,o);else{let i=m.now().ts+o*1e3,c={value:e,expiry:i};n=this._writeRaw(t,c,o)}return n.subscribe({error:s(i=>console.error(`${this.constructor.name}::write: error occurred`,i),"error")}),n}_isSmpCachedValue(t){return f(t)}};import{catchError as y,throwError as x}from"rxjs";function k(r,t){return e=>e.pipe(y(o=>(typeof r==typeof isNaN?R(r)?d(o,r):r(o):!1)?t(o):x(()=>o)))}s(k,"smpRxjsCatchOnly");function R(r){try{return Reflect.construct(String,[],r),!0}catch{return!1}}s(R,"isConstructor");function d(r,t){return typeof r=="object"&&r!==null&&r.constructor===t}s(d,"isExactInstance");import{of as p}from"rxjs";var h=class extends a{static{s(this,"SmpRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return this._staticSelf._storage.clear(),p(void 0)}_readRaw(t){return p(this._staticSelf._storage.get(t))}_removeRaw(t){return this._staticSelf._storage.delete(t),p(void 0)}_writeRaw(t,e){return this._staticSelf._storage.set(t,e),p(void 0)}};import{map as S,of as g,defer as E,switchMap as b}from"rxjs";function l(r){let t=[];function e(o){return o>=r.length?g(t):E(()=>r[o]()).pipe(b(n=>(t[o]=n,e(o+1))))}return s(e,"runStep"),e(0)}s(l,"smpRxjsSequence");function P(r){if(Array.isArray(r))return l(r);{let t=Object.keys(r),e=t.map(o=>r[o]);return l(e).pipe(S(o=>{let n={};return t.forEach((i,c)=>{n[i]=o[c]}),n}))}}s(P,"smpRxjsQueue");import{concatMap as j,from as v,toArray as C}from"rxjs";function Y(r){return v(r).pipe(j(e=>e()),C())}s(Y,"smpRxjsSequence");import{map as N}from"rxjs";function w(r=A){return t=>t.pipe(N(e=>{if(~O.indexOf(JSON.stringify(e)))throw r(e);return e}))}s(w,"smpRxjsThrowIfEmpty");var O=[void 0,null,!1,0,"","0",[],{}].map(r=>JSON.stringify(r)),A=s(()=>new Error,"defaultErrorFactory");import{defaultIfEmpty as I,filter as T}from"rxjs";function it(r,t){return e=>e.pipe(T(o=>!r(o)),I(!1),w(t))}s(it,"smpRxjsThrowOnCondition");export{a as SmpAbstractRxjsTtlCacheStrategy,h as SmpRxjsInMemoryCache,k as smpRxjsCatchOnly,P as smpRxjsQueue,Y as smpRxjsSequence,w as smpRxjsThrowIfEmpty,it as smpRxjsThrowOnCondition};
@@ -0,0 +1,25 @@
1
+ declare enum SmpSocialSignInKeys {
2
+ APPLE = "APPLE",
3
+ FACEBOOK = "FACEBOOK",
4
+ GOOGLE = "GOOGLE"
5
+ }
6
+
7
+ declare enum SmpSocialSignInUxModes {
8
+ POPUP = "POPUP",
9
+ REDIRECT = "REDIRECT"
10
+ }
11
+
12
+ declare enum SmpFirebaseErrors {
13
+ DIFFERENT_CREDENTIAL = "auth/account-exists-with-different-credential",
14
+ DIFFERENT_CREDENTIAL_APPLE = "auth/account-exists-with-different-credential/apple",
15
+ DIFFERENT_CREDENTIAL_FACEBOOK = "auth/account-exists-with-different-credential/facebook",
16
+ DIFFERENT_CREDENTIAL_GOOGLE = "auth/account-exists-with-different-credential/google",
17
+ EMAIL_EXISTS = "auth/email-already-exists",
18
+ INVALID_ACTION_CODE = "auth/invalid-action-code",
19
+ POPUP_BLOCKED = "auth/popup-blocked",
20
+ POPUP_CLOSED_BY_USER = "auth/popup-closed-by-user",
21
+ USER_NOT_FOUND = "auth/user-not-found",
22
+ WRONG_PASSWORD = "auth/wrong-password"
23
+ }
24
+
25
+ export { SmpSocialSignInKeys as S, SmpSocialSignInUxModes as a, SmpFirebaseErrors as b };
@@ -24,4 +24,4 @@ interface SmpGenericResponseBase<T = any> {
24
24
  messages: SmpResponseMessageBase[] | void;
25
25
  }
26
26
 
27
- export { SmpResponseMessage as S, type SmpGenericResponseBase as a, type SmpResponseMessageBase as b, SmpResponseMessageTypes as c };
27
+ export { SmpResponseMessage as S, SmpResponseMessageTypes as a, type SmpGenericResponseBase as b, type SmpResponseMessageBase as c };
package/dist/esm/zod.d.ts CHANGED
@@ -1,15 +1,7 @@
1
1
  import z$1, { z, ZodTypeDef, ParseInput, ParseReturnType } from 'zod';
2
- import { S as SmpResponseMessage, a as SmpGenericResponseBase } from './smp-generic-response-base.interface-D0jHrkjw.js';
2
+ import { b as SmpGenericResponseBase, S as SmpResponseMessage } from './smp-generic-response-base.interface-C0On2LBc.js';
3
3
  import { DateTime } from 'ts-luxon';
4
4
 
5
- declare const smpResponseMessageSchema: z.ZodObject<Record<keyof SmpResponseMessage, z.ZodTypeAny>, "strip", z.ZodTypeAny, {
6
- message?: any;
7
- type?: any;
8
- }, {
9
- message?: any;
10
- type?: any;
11
- }>;
12
-
13
5
  declare const smpGenericResponseSchema: z.ZodObject<Record<keyof SmpGenericResponseBase<any>, z.ZodTypeAny>, "strip", z.ZodTypeAny, {
14
6
  messages?: any;
15
7
  data?: any;
@@ -18,6 +10,14 @@ declare const smpGenericResponseSchema: z.ZodObject<Record<keyof SmpGenericRespo
18
10
  data?: any;
19
11
  }>;
20
12
 
13
+ declare const smpResponseMessageSchema: z.ZodObject<Record<keyof SmpResponseMessage, z.ZodTypeAny>, "strip", z.ZodTypeAny, {
14
+ message?: any;
15
+ type?: any;
16
+ }, {
17
+ message?: any;
18
+ type?: any;
19
+ }>;
20
+
21
21
  interface SmpZodDateTimeCheck {
22
22
  kind: "min" | "max" | "between";
23
23
  min?: DateTime;
package/dist/esm/zod.js CHANGED
@@ -1 +1 @@
1
- import{a as h}from"./chunk-F3OJMKBL.js";import{a as o}from"./chunk-EI7MMDWY.js";import{z as p}from"zod";var l=p.object({message:p.string(),type:p.nativeEnum(h)});import{z as f}from"zod";var w=f.object({data:f.unknown().optional(),messages:f.array(l).optional()});import a,{ZodIssueCode as c,ZodParsedType as u}from"zod";import{DateTime as r}from"ts-luxon";var x=class m extends a.ZodType{static{o(this,"SmpZodDateTime")}constructor(t){super({typeName:"SmpZodDateTime",coerce:t?.coerce??!1,checks:t?.checks??[]})}_parse(t){let s=this._getOrReturnCtx(t),n=s.data;if(this._def.coerce&&(n=this._coerceToDateTime(n),!(n instanceof r)||!n.isValid))return a.addIssueToContext(s,{code:c.invalid_type,expected:u.date,received:u.unknown,path:s.path,message:"Invalid date format"}),a.INVALID;if((!(n instanceof r)||!n.isValid)&&!this._def.coerce)return a.addIssueToContext(s,{code:c.invalid_type,expected:u.date,received:u.unknown,path:s.path,message:"Input must be a valid DateTime object"}),a.INVALID;let D={min:o((e,i,d)=>{if(e.min&&i<e.min)return{code:c.too_small,minimum:e.min.toMillis(),type:"date",inclusive:!0,message:e.message??`Date must be \u2265 ${e.min.toISODate()}`,path:d.path}},"min"),max:o((e,i,d)=>{if(e.max&&i>e.max)return{code:c.too_big,maximum:e.max.toMillis(),type:"date",inclusive:!0,message:e.message??`Date must be \u2264 ${e.max.toISODate()}`,path:d.path}},"max"),between:o((e,i,d)=>{if(e.min&&e.max&&(i<e.min||i>e.max))return{code:c.custom,message:e.message??`Date must be between ${e.min.toISODate()} and ${e.max.toISODate()}`,path:d.path}},"between")};for(let e of this._def.checks)if(n instanceof r&&n.isValid){let i=D[e.kind](e,n,s);i&&a.addIssueToContext(s,i)}return s.common.issues.length>0?a.INVALID:a.OK(n)}between(t,s,n){return new m({...this._def,checks:[...this._def.checks,{kind:"between",min:t.toUTC(),max:s.toUTC(),message:n}]})}coerce(){return new m({...this._def,coerce:!0})}max(t,s){return new m({...this._def,checks:[...this._def.checks,{kind:"max",max:t.toUTC(),message:s}]})}min(t,s){return new m({...this._def,checks:[...this._def.checks,{kind:"min",min:t.toUTC(),message:s}]})}_coerceToDateTime(t){if(t instanceof r&&t.isValid)return t;let s={string:o(()=>r.fromJSDate(new Date(t)),"string"),number:o(()=>r.fromMillis(t),"number"),object:o(()=>r.fromJSDate(t),"object"),default:o(()=>null,"default")};return(s[typeof t]||s.default)()}},M=o((m={})=>new x({coerce:m.coerce??!1,checks:[]}),"smpZodDateTime");export{x as SmpZodDateTime,w as smpGenericResponseSchema,l as smpResponseMessageSchema,M as smpZodDateTime};
1
+ import{a as h}from"./chunk-F3OJMKBL.js";import{a as o}from"./chunk-EI7MMDWY.js";import{z as f}from"zod";import{z as p}from"zod";var l=p.object({message:p.string(),type:p.nativeEnum(h)});var w=f.object({data:f.unknown().optional(),messages:f.array(l).optional()});import a,{ZodIssueCode as c,ZodParsedType as u}from"zod";import{DateTime as r}from"ts-luxon";var x=class m extends a.ZodType{static{o(this,"SmpZodDateTime")}constructor(t){super({typeName:"SmpZodDateTime",coerce:t?.coerce??!1,checks:t?.checks??[]})}_parse(t){let s=this._getOrReturnCtx(t),n=s.data;if(this._def.coerce&&(n=this._coerceToDateTime(n),!(n instanceof r)||!n.isValid))return a.addIssueToContext(s,{code:c.invalid_type,expected:u.date,received:u.unknown,path:s.path,message:"Invalid date format"}),a.INVALID;if((!(n instanceof r)||!n.isValid)&&!this._def.coerce)return a.addIssueToContext(s,{code:c.invalid_type,expected:u.date,received:u.unknown,path:s.path,message:"Input must be a valid DateTime object"}),a.INVALID;let D={min:o((e,i,d)=>{if(e.min&&i<e.min)return{code:c.too_small,minimum:e.min.toMillis(),type:"date",inclusive:!0,message:e.message??`Date must be \u2265 ${e.min.toISODate()}`,path:d.path}},"min"),max:o((e,i,d)=>{if(e.max&&i>e.max)return{code:c.too_big,maximum:e.max.toMillis(),type:"date",inclusive:!0,message:e.message??`Date must be \u2264 ${e.max.toISODate()}`,path:d.path}},"max"),between:o((e,i,d)=>{if(e.min&&e.max&&(i<e.min||i>e.max))return{code:c.custom,message:e.message??`Date must be between ${e.min.toISODate()} and ${e.max.toISODate()}`,path:d.path}},"between")};for(let e of this._def.checks)if(n instanceof r&&n.isValid){let i=D[e.kind](e,n,s);i&&a.addIssueToContext(s,i)}return s.common.issues.length>0?a.INVALID:a.OK(n)}between(t,s,n){return new m({...this._def,checks:[...this._def.checks,{kind:"between",min:t.toUTC(),max:s.toUTC(),message:n}]})}coerce(){return new m({...this._def,coerce:!0})}max(t,s){return new m({...this._def,checks:[...this._def.checks,{kind:"max",max:t.toUTC(),message:s}]})}min(t,s){return new m({...this._def,checks:[...this._def.checks,{kind:"min",min:t.toUTC(),message:s}]})}_coerceToDateTime(t){if(t instanceof r&&t.isValid)return t;let s={string:o(()=>r.fromJSDate(new Date(t)),"string"),number:o(()=>r.fromMillis(t),"number"),object:o(()=>r.fromJSDate(t),"object"),default:o(()=>null,"default")};return(s[typeof t]||s.default)()}},M=o((m={})=>new x({coerce:m.coerce??!1,checks:[]}),"smpZodDateTime");export{x as SmpZodDateTime,w as smpGenericResponseSchema,l as smpResponseMessageSchema,M as smpZodDateTime};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonysamperi/ts-mapi-core",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.5",
4
4
  "description": "A set of shared utils to be used at BE or FE",
5
5
  "type": "module",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -115,22 +115,27 @@
115
115
  "devDependencies": {
116
116
  "@aws-sdk/client-dynamodb": "^3.758.0",
117
117
  "@aws-sdk/util-dynamodb": "^3.758.0",
118
+ "@babel/preset-env": "^7.28.5",
118
119
  "@pollyjs/adapter-fetch": "^6.0.6",
119
120
  "@pollyjs/core": "^6.0.6",
120
121
  "@pollyjs/persister-fs": "^6.0.6",
121
122
  "@swc/core": "^1.13.2",
122
123
  "@tonysamperi/krypto": "^1.0.0",
123
124
  "@tonysamperi/logger": "^2.0.0",
125
+ "@types/babel__preset-env": "^7",
124
126
  "@types/jest": "~29.5.14",
127
+ "@types/lodash-es": "^4.17.12",
125
128
  "@types/node": "^22.13.8",
126
129
  "@types/setup-polly-jest": "^0",
127
130
  "@typescript-eslint/eslint-plugin": "^8.32.0",
128
131
  "@typescript-eslint/parser": "^8.32.0",
132
+ "babel-jest": "^30.2.0",
129
133
  "class-transformer": "^0.5.1",
130
134
  "eslint": "^9.26.0",
131
135
  "firebase": "^11.4.0",
132
- "glob": "^11.0.3",
136
+ "glob": "^11.1.0",
133
137
  "jest": "~29.7.0",
138
+ "lodash-es": "^4.17.21",
134
139
  "reflect-metadata": "^0.1.14",
135
140
  "replace-in-file": "^8.3.0",
136
141
  "rxjs": "^7.5.6",
@@ -1,12 +0,0 @@
1
- declare enum SmpSocialSignInKeys {
2
- APPLE = "APPLE",
3
- FACEBOOK = "FACEBOOK",
4
- GOOGLE = "GOOGLE"
5
- }
6
-
7
- declare enum SmpSocialSignInUxModes {
8
- POPUP = "POPUP",
9
- REDIRECT = "REDIRECT"
10
- }
11
-
12
- export { SmpSocialSignInKeys as S, SmpSocialSignInUxModes as a };
@@ -1,12 +0,0 @@
1
- declare enum SmpSocialSignInKeys {
2
- APPLE = "APPLE",
3
- FACEBOOK = "FACEBOOK",
4
- GOOGLE = "GOOGLE"
5
- }
6
-
7
- declare enum SmpSocialSignInUxModes {
8
- POPUP = "POPUP",
9
- REDIRECT = "REDIRECT"
10
- }
11
-
12
- export { SmpSocialSignInKeys as S, SmpSocialSignInUxModes as a };