@tonysamperi/ts-mapi-core 1.4.0-next.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/changelog.md +11 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +19 -14
- package/dist/cjs/services/firebase/index.cjs +1 -1
- package/dist/cjs/services/firebase/index.cjs.map +1 -1
- package/dist/cjs/services/firebase/smp-firebase.service.cjs +1 -1
- package/dist/cjs/services/firebase/smp-firebase.service.cjs.map +1 -1
- package/dist/cjs/services/firebase/smp-firebase.service.d.cts +1 -1
- package/dist/cjs/services/http/index.cjs +1 -1
- package/dist/cjs/services/http/index.cjs.map +1 -1
- package/dist/cjs/services/http/index.d.cts +3 -0
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs +1 -1
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -1
- package/dist/cjs/services/http/smp-http-session-storage-cache.class.d.cts +3 -1
- package/dist/cjs/services/http/smp-http.service.cjs +1 -1
- package/dist/cjs/services/http/smp-http.service.cjs.map +1 -1
- package/dist/cjs/services/index.cjs +1 -1
- package/dist/cjs/services/index.cjs.map +1 -1
- package/dist/cjs/services/index.d.cts +3 -0
- package/dist/cjs/shared/api/index.cjs.map +1 -1
- package/dist/cjs/shared/api/smp-error-response-build-opts.interface.cjs.map +1 -1
- package/dist/cjs/shared/api/smp-error-response.class.cjs.map +1 -1
- package/dist/cjs/shared/common/index.cjs.map +1 -1
- package/dist/cjs/shared/crypto/index.cjs.map +1 -1
- package/dist/cjs/shared/crypto/smp-secure-code.class.cjs.map +1 -1
- package/dist/cjs/shared/giftcard/index.cjs.map +1 -1
- package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/index.cjs +1 -1
- package/dist/cjs/shared/rxjs/index.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.cjs.map +1 -1
- package/dist/cjs/shared/rxjs/smp-rxjs-catch-only.function.d.cts +1 -1
- package/dist/cjs/shared/utils/cache/index.cjs +1 -1
- package/dist/cjs/shared/utils/cache/index.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/index.d.cts +3 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs +2 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.d.cts +8 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs +2 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.cts +16 -0
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs +1 -1
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-browser-cache.class.d.cts +10 -8
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +4 -0
- package/dist/cjs/shared/utils/{smp-gcpsid-raw.interface.cjs → cache/smp-cached-value.interface.cjs} +1 -1
- package/dist/cjs/shared/utils/cache/smp-cached-value.interface.cjs.map +1 -0
- package/dist/cjs/shared/utils/cache/smp-cached-value.interface.d.cts +6 -0
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs +1 -1
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.d.cts +9 -7
- package/dist/cjs/shared/utils/index.cjs +1 -1
- package/dist/cjs/shared/utils/index.cjs.map +1 -1
- package/dist/cjs/shared/utils/index.d.cts +3 -1
- package/dist/cjs/shared/utils/smp-sid.class.cjs +1 -1
- package/dist/cjs/shared/utils/smp-sid.class.cjs.map +1 -1
- package/dist/cjs/shared/utils/smp-sid.class.d.cts +4 -4
- package/dist/cjs/shared/zod/index.cjs +2 -0
- package/dist/cjs/shared/zod/index.cjs.map +1 -0
- package/dist/cjs/shared/zod/index.d.cts +3 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs +2 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.cjs.map +1 -0
- package/dist/cjs/shared/zod/smp-zod-date-time.definition.d.cts +28 -0
- package/dist/esm/{chunk-2NMLPNVZ.js → chunk-7MD4IY4X.js} +1 -1
- package/dist/esm/chunk-CUAIWQU7.js +1 -0
- package/dist/esm/chunk-DADFHUII.js +1 -0
- package/dist/esm/chunk-KEYBWRJC.js +1 -0
- package/dist/esm/{chunk-NIJJBDPY.js → chunk-KZCXOA33.js} +1 -1
- package/dist/esm/{chunk-FUXO6KMS.js → chunk-MMNEY2JK.js} +1 -1
- package/dist/esm/chunk-O7TJDNO6.js +0 -0
- package/dist/esm/{chunk-VTMEEHHD.js → chunk-OM2B3B4I.js} +1 -1
- package/dist/esm/chunk-QPKVVZUA.js +1 -0
- package/dist/esm/chunk-QW43DOPY.js +1 -0
- package/dist/esm/chunk-W7XM5LDH.js +1 -0
- package/dist/esm/{chunk-QZ2KRLHI.js → chunk-WN7IOY62.js} +1 -1
- package/dist/esm/index.d.ts +6 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/services/firebase/index.js +1 -1
- package/dist/esm/services/firebase/smp-firebase.service.d.ts +1 -1
- package/dist/esm/services/firebase/smp-firebase.service.js +1 -1
- package/dist/esm/services/http/index.d.ts +3 -0
- package/dist/esm/services/http/index.js +1 -1
- package/dist/esm/services/http/smp-http-session-storage-cache.class.d.ts +3 -1
- package/dist/esm/services/http/smp-http-session-storage-cache.class.js +1 -1
- package/dist/esm/services/http/smp-http.service.js +1 -1
- package/dist/esm/services/index.d.ts +3 -0
- package/dist/esm/services/index.js +1 -1
- package/dist/esm/shared/crypto/index.js +1 -1
- package/dist/esm/shared/crypto/smp-secure-code.class.js +1 -1
- package/dist/esm/shared/rxjs/index.js +1 -1
- package/dist/esm/shared/rxjs/smp-rxjs-catch-only.function.d.ts +1 -1
- package/dist/esm/shared/rxjs/smp-rxjs-catch-only.function.js +1 -1
- package/dist/esm/shared/utils/cache/index.d.ts +3 -0
- package/dist/esm/shared/utils/cache/index.js +1 -1
- package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.d.ts +8 -0
- package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.js +1 -0
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.ts +16 -0
- package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js +1 -0
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.d.ts +10 -8
- package/dist/esm/shared/utils/cache/smp-browser-cache.class.js +1 -1
- package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +4 -0
- package/dist/esm/shared/utils/cache/smp-cached-value.interface.d.ts +6 -0
- package/dist/esm/shared/utils/cache/smp-cached-value.interface.js +1 -0
- package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.d.ts +9 -7
- package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.js +1 -1
- package/dist/esm/shared/utils/index.d.ts +3 -1
- package/dist/esm/shared/utils/index.js +1 -1
- package/dist/esm/shared/utils/smp-sid.class.d.ts +4 -4
- package/dist/esm/shared/utils/smp-sid.class.js +1 -1
- package/dist/esm/shared/zod/index.d.ts +3 -0
- package/dist/esm/shared/zod/index.js +1 -0
- package/dist/esm/shared/zod/smp-zod-date-time.definition.d.ts +28 -0
- package/dist/esm/shared/zod/smp-zod-date-time.definition.js +1 -0
- package/package.json +8 -6
- package/dist/cjs/shared/utils/smp-gcpsid-raw.interface.cjs.map +0 -1
- package/dist/cjs/shared/utils/smp-gcpsid-raw.interface.d.cts +0 -6
- package/dist/esm/chunk-CZTKNLYX.js +0 -1
- package/dist/esm/chunk-LDLBKVKD.js +0 -1
- package/dist/esm/chunk-OXO327UX.js +0 -1
- package/dist/esm/shared/utils/smp-gcpsid-raw.interface.d.ts +0 -6
- /package/dist/esm/{chunk-THUEL7AA.js → chunk-DGUMFWCQ.js} +0 -0
- /package/dist/esm/{shared/utils/smp-gcpsid-raw.interface.js → chunk-EB55SS67.js} +0 -0
package/README.md
CHANGED
|
@@ -15,3 +15,7 @@ To release a beta version, just push a beta tag, e.g. `3.0.0-beta.0`
|
|
|
15
15
|
|
|
16
16
|
## Release a production version ⚠️
|
|
17
17
|
To release a production version you just need to push a tag
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
`(?:import|export)\s+(?:[^'"]+?\s+from\s+|\*\s+from\s+)?["'](\.\/[^'"]*?)(?<!\.js)["']`
|
|
21
|
+
-->
|
package/changelog.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 1.5.0
|
|
2
|
+
* Fixed smpRxjsCatchOnly catching derived classes
|
|
3
|
+
* Improved dramatically smpZodDateTime that now works like a native definition with concatenation
|
|
4
|
+
* Improved cache utils to support TTL (in seconds)
|
|
5
|
+
* Added SmpCachedValue (removed SmpSidRaw)
|
|
6
|
+
* Added more automatic tests
|
|
7
|
+
|
|
8
|
+
## 1.4.0
|
|
9
|
+
* Breaking change: SmpFirebaseService.instance now is SmpFirebaseService.INSTANCE
|
|
10
|
+
* Improved build to emit decorators
|
|
11
|
+
|
|
1
12
|
## 1.3.0
|
|
2
13
|
* Cleanup dependencies
|
|
3
14
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Ie=Object.defineProperty;var Vr=Object.getOwnPropertyDescriptor;var qr=Object.getOwnPropertyNames;var Xr=Object.prototype.hasOwnProperty;var a=(i,e)=>Ie(i,"name",{value:e,configurable:!0});var E=(i,e)=>()=>(i&&(e=i(i=0)),e);var Be=(i,e)=>{for(var t in e)Ie(i,t,{get:e[t],enumerable:!0})},Zr=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of qr(e))!Xr.call(i,s)&&s!==t&&Ie(i,s,{get:()=>e[s],enumerable:!(r=Vr(e,s))||r.enumerable});return i};var se=i=>Zr(Ie({},"__esModule",{value:!0}),i);var Dt,kt=E(()=>{"use strict";Dt=class{static{a(this,"SmpSessionManagerService")}get sessionId(){return this._sessionId||this._storage.getItem(this._sessionIdKey)||void 0}constructor(e="lggr_sid"){this._sessionIdKey=e,this._storage=this._getStorage(),this._sessionId=this.sessionId||this._generateSessionId()}_generateSessionId(){let e=this._generateUUID();return this._storage.setItem(this._sessionIdKey,e),e}_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)})}_getStorage(){try{if(typeof window<"u"&&typeof window.sessionStorage==typeof isNaN)return sessionStorage}catch(e){console.warn(`${this.constructor.name}: error while checking sessionStorage`,e)}return{getItem:a(()=>null,"getItem"),setItem:a(()=>null,"setItem"),removeItem:a(()=>null,"removeItem"),clear:a(()=>null,"clear")}}}});var U,et=E(()=>{"use strict";(function(i){i[i.OFF=0]="OFF",i[i.ERROR=1]="ERROR",i[i.WARN=2]="WARN",i[i.INFO=3]="INFO",i[i.LOG=4]="LOG",i[i.DEBUG=5]="DEBUG"})(U||(U={}))});function O(){}var Ce=E(()=>{"use strict";a(O,"smpNoop")});var Hr,K,tt=E(()=>{"use strict";Ce();Hr=class{static{a(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},K=class Ut extends Hr{static{a(this,"SmpLoggerMethods")}constructor(){super(...arguments),this.debug=O,this.error=O,this.info=O,this.log=O,this.warn=O}static describe(){return Object.getOwnPropertyNames(new Ut).map(e=>e)}}});var Tt,ve,Pe,Mt=E(()=>{"use strict";kt();et();tt();Ce();ve="[DEFAULT]",Pe=class extends K{static{a(this,"SmpLoggerService")}static get INSTANCE(){return this.get(ve)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(U).filter(e=>+e>U.OFF&&+e<=this.level).map(e=>U[e])}get appName(){return this._appName}get currentConfig(){return{level:this.level,enableSessionId:this.enableSessionId,enablePreprocessing:this.enablePreprocessing,sensitiveProps:this._sensitiveProps}}get enablePreprocessing(){return this.preprocessArgs!==this._noopPreprocessArgs}get enableSessionId(){return!!this.sessionId}get level(){return this.constructor._level}get sessionId(){return this._sessionId}constructor(e){super(),this._sensitivePropMask="*****",this._sessionManager=new Dt,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=ve){return this._instances.get(e)||this._instances.get(ve)||this._noopInstance}static init(e,t=ve){let r;if(this._instances.has(t)){r=this.get(t);let s=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},s),e))}else this._instances.set(t,new this(e)),r=this.get(t),r._appName=t;return r}static pop(e){let t=this.get(e);return this.destroy(e),t}destroy(){return this.constructor.destroy(this.appName)}filterSensitiveData(e){if(e===null||typeof e!="object"||Array.isArray(e)||e.constructor!==Object)return e;let t={};for(let r in e){let s=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||s===null||s===void 0){t[r]=s;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(s)}return t}preprocessArgs(e,...t){return this._defaultPreprocessArgs.apply(this,[e,...t])}_defaultPreprocessArgs(e,...t){let r=new Date;return[`${r.toISOString()}`,`${t.shift()}`.trim(),...t.map(s=>({tags:[this._appName,`level-${U[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=U.OFF,enablePreprocessing:r=!1,enableSessionId:s=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=s?this._sessionManager.sessionId:void 0,this._updateLevel(t)}_noopPreprocessArgs(...e){return e}_setup(e){let t=this.preprocessArgs.bind(this);this.activeLevels.forEach(r=>{let s=`${r}`.toLowerCase();typeof e[s]==typeof isNaN&&(this[s]=function(...o){e[s].apply(e,t.apply(null,[s,...o]))})}),this.level>U.OFF&&console&&(console.group&&console.groupEnd&&(this.group=console.group.bind(console),this.groupEnd=console.groupEnd.bind(console)),console.groupCollapsed&&(this.groupCollapsed=console.groupCollapsed.bind(console)),console.time&&console.timeEnd&&(this.time=console.time.bind(console),this.timeEnd=console.timeEnd.bind(console)))}_updateLevel(e=U.WARN){this.constructor.describe().forEach(t=>{this[t]=O}),this.constructor._level=e,console&&this._setup(console)}};Tt=Pe;Pe._instances=new Map;Pe._level=U.OFF;Pe._noopInstance=new Tt({level:U.OFF})});var jt=E(()=>{"use strict"});var Lt=E(()=>{"use strict"});var zt=E(()=>{"use strict";jt();Lt();tt();et();Ce()});var _e=E(()=>{"use strict";Mt();zt()});var V,Gt=E(()=>{"use strict";V=function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i}({})});var oe,St=E(()=>{"use strict";oe=function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i}({})});var xe,ar=E(()=>{"use strict";xe=function(i){return i.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",i.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",i.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",i.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",i.EMAIL_EXISTS="auth/email-already-exists",i.INVALID_ACTION_CODE="auth/invalid-action-code",i.POPUP_BLOCKED="auth/popup-blocked",i.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",i.USER_NOT_FOUND="auth/user-not-found",i.WRONG_PASSWORD="auth/wrong-password",i}({})});function Cr(i,e){return t=>t.pipe((0,Ve.catchError)(r=>r instanceof i?e(r):(0,Ve.throwError)(()=>r)))}var Ve,vr=E(()=>{"use strict";Ve=require("rxjs");a(Cr,"smpRxjsCatchOnly")});function qe(i=Cs){return e=>e.pipe((0,Pr.map)(t=>{if(~Bs.indexOf(JSON.stringify(t)))throw i(t);return t}))}var Pr,Bs,Cs,At=E(()=>{"use strict";Pr=require("rxjs");a(qe,"smpRxjsThrowIfEmpty");Bs=[void 0,null,!1,0,"","0",[],{}].map(i=>JSON.stringify(i)),Cs=a(()=>new Error,"defaultErrorFactory")});function Nr(i,e){return t=>t.pipe((0,Xe.filter)(r=>!i(r)),(0,Xe.defaultIfEmpty)(!1),qe(e))}var Xe,Fr=E(()=>{"use strict";Xe=require("rxjs");At();a(Nr,"smpRxjsThrowOnCondition")});var Ze={};Be(Ze,{smpRxjsCatchOnly:()=>Cr,smpRxjsThrowIfEmpty:()=>qe,smpRxjsThrowOnCondition:()=>Nr});var He=E(()=>{"use strict";vr();At();Fr()});var kr={};Be(kr,{SmpDynamoService:()=>Ot});var Dr,Ye,Je,Ot,Ur=E(()=>{"use strict";Dr=require("@aws-sdk/client-dynamodb"),Ye=require("@aws-sdk/util-dynamodb");_e();Je=function(i){return i.CouldNotDelete="ERR_COULD_NOT_DELETE",i.CouldNotRead="ERR_COULD_NOT_READ",i.CouldNotWrite="ERR_COULD_NOT_WRITE",i.ConditionalCheckFailedException="ERR_DUPE_TOKEN",i}(Je||{}),Ot=class{static{a(this,"SmpDynamoService")}_config;_tableName;get marshall(){return Ye.marshall}get unmarshall(){return Ye.unmarshall}_db;_logger;constructor(e,t){this._config=e,this._tableName=t,this._db=new Dr.DynamoDB([this._buildConfig()]),this._logger=new K}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(Je[o.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(Je[o.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let s={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(Je[o.code]||"ERR_COULD_NOT_WRITE")))}}});var Tr={};Be(Tr,{SmpFirebaseService:()=>bt});var be,u,bt,Mr=E(()=>{"use strict";_e();be=require("firebase/app"),u=require("firebase/auth");Gt();St();ar();bt=class i{static{a(this,"SmpFirebaseService")}static get instance(){if(!(this._instance instanceof i))throw Error(`${this.constructor.name} instance doesn't exist! Call ${this.constructor.name}.init first!`);return this._instance}static _instance;get config(){return this._config}get enabledSocials(){return this._enabledSocials}get loggedUser(){return this._loggedUser||(this._loggedUser=this._readStoredUser()),this._auth.currentUser||this._loggedUser||void 0}get providersRelation(){return{"facebook.com":V.FACEBOOK,"google.com":V.GOOGLE,"apple.com":V.APPLE}}get socialLoginUXMode(){return this._socialLoginUxMode}get storedUserKey(){return"firebaseUser"}get _auth(){return(0,u.getAuth)(this._app)}_app;_config;_enabledSocials=[];_loggedUser;_logger;_popupErrors=0;_popupFallsBackToRedirect;_providers;_socialLoginUxMode=oe.POPUP;constructor(e,t){this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||oe.POPUP,this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new K,this._app=(0,be.getApps)().length?(0,be.getApps)()[0]:(0,be.initializeApp)(e),this._watchAuthState()}static init(e,t){return this._instance||(this._instance=new i(e,t)),this._instance}addAuthStateChangedCallback(e){return this._auth.onAuthStateChanged(t=>{e(t||this.loggedUser||null)})}checkActionCode(e){return(0,u.checkActionCode)(this._auth,e)}confirmPasswordReset(e,t){return(0,u.confirmPasswordReset)(this._auth,e,t)}fetchSignInMethodsForEmail(e){return(0,u.fetchSignInMethodsForEmail)(this._auth,e).then(t=>t.map(r=>this.providersRelation[r]||r))}getRedirectResult(){return(0,u.getRedirectResult)(this._auth).catch(async e=>(await this._expandDifferentCredential(e),Promise.reject(e)))}initAppCheck(){}sendEmailVerification(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.sendEmailVerification)(this.loggedUser,e?{url:e}:void 0)}sendPasswordResetEmail(e,t){return(0,u.sendPasswordResetEmail)(this._auth,e,{url:t})}setPersistence(e){return(0,u.setPersistence)(this._auth,e?u.browserLocalPersistence:u.browserSessionPersistence)}signInWithCustomToken(e){return(0,u.signInWithCustomToken)(this._auth,e)}signInWithEmailAndPassword(e,t){return(0,u.signInWithEmailAndPassword)(this._auth,e,t).then(async r=>r.user)}signInWithSocialProvider(e){if(!this._providers[e])throw Error(`Firebase: invalid social key provided! Expected one of ${this.enabledSocials}, got ${e}`);return this._signInWithProvider(this._providers[e])}signOut(){return(0,u.signOut)(this._auth)}updatePassword(e,t){if(!this.loggedUser)throw Error("Firebase: user is not logged!");let r=u.EmailAuthProvider.credential(this.loggedUser.email,e);return(0,u.reauthenticateWithCredential)(this.loggedUser,r).then(()=>(0,u.updatePassword)(this.loggedUser,t))}updateUserProfile(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.updateProfile)(this.loggedUser,e)}async verifyIdToken(){return this._auth.currentUser?.getIdTokenResult()}_buildProviders(){this._providers=this._enabledSocials.reduce((e,t)=>(t in e&&(e[t]=e[t]),e),{[V.APPLE]:new u.OAuthProvider("apple.com"),[V.FACEBOOK]:new u.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),[V.GOOGLE]:new u.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code===xe.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=xe["DIFFERENT_CREDENTIAL_"+t[0]],e}}_readStoredUser(){try{let e=localStorage.getItem(this.storedUserKey);if(e){this._logger?.debug("Firebase: found local user",e);let t=JSON.parse(e);return{...t,getIdToken:a(()=>Promise.resolve(t.stsTokenManager.accessToken),"getIdToken")}}}catch(e){this._logger.debug("Firebase: error while getting stored user",e)}}async _signInWithProvider(e,t=this.socialLoginUXMode){return(t===oe.POPUP?u.signInWithPopup:u.signInWithRedirect)(this._auth,e).then(s=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),s.user)).catch(async s=>s?.code===xe.POPUP_BLOCKED&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,oe.REDIRECT)):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,s),await this._expandDifferentCredential(s),Promise.reject(s)))}_updateLocalUser(e){try{e?localStorage.setItem(this.storedUserKey,JSON.stringify(e)):localStorage.removeItem(this.storedUserKey),this._logger.debug("Firebase: updating local user",e),this._loggedUser=e}catch(t){this._logger.warn("Firebase: couldn't update local user",{user:e,error:t})}}_watchAuthState(){this._auth.onAuthStateChanged(e=>{this._logger.debug("Firebase: firebase detected auth state change",e),this._updateLocalUser(e||void 0)})}}});var Ps={};Be(Ps,{SMP_HEALTHZ:()=>Qr,SmpAesCrypt:()=>de,SmpApiCommonUtils:()=>rt,SmpBrowserCache:()=>Re,SmpCommonUtils:()=>mt,SmpCrypto:()=>$e,SmpErrorResponse:()=>j,SmpFilterException:()=>wt,SmpFirebaseErrors:()=>xe,SmpGenericResponse:()=>ie,SmpGiftcardTransaction:()=>Se,SmpGiftcardTransactionHashStrategies:()=>ee,SmpGiftcardTransactionOps:()=>C,SmpHttpService:()=>Rt,SmpHttpSessionStorageCache:()=>Oe,SmpHttpStatusCodes:()=>_t,SmpInMemoryCache:()=>Ae,SmpMarketingCloudValidators:()=>ss,SmpRegularExpressions:()=>Et,SmpResponseMessage:()=>N,SmpResponseMessageTypes:()=>G,SmpRestVerbs:()=>ot,SmpSecureCode:()=>Ke,SmpSid:()=>xt,SmpSocialSignInKeys:()=>V,SmpSocialSignInUxModes:()=>oe,VERSION:()=>vs,smpNoop:()=>O});module.exports=se(Ps);_e();var rt=class{static{a(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new K;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("KikApiCommonUtils: couldn't interpolate params",r)}return e}};var me=require("class-transformer");var S=require("class-transformer");var st=require("class-transformer");var G=function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i}({});function Wt(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}a(Wt,"_ts_decorate");function Ne(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}a(Ne,"_ts_metadata");var N=class i{static{a(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=G.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)}};Wt([(0,st.Expose)(),Ne("design:type",String),Ne("design:paramtypes",[])],N.prototype,"message",null);Wt([(0,st.Expose)(),Ne("design:type",typeof G>"u"?Object:G),Ne("design:paramtypes",[])],N.prototype,"type",null);function Jr(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}a(Jr,"_ts_decorate");function $t(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}a($t,"_ts_metadata");var ie=class i{static{a(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=N.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 N(r,G.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new N(r,G.SUCCESS)),t)}static fromPlain(e){return(0,S.plainToInstance)(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,S.instanceToPlain)(this,{excludePrefixes:["_"]})}};Jr([(0,S.Expose)(),(0,S.Transform)(({value:i})=>i?.length?i:void 0),$t("design:type",Object),$t("design:paramtypes",[])],ie.prototype,"messages",null);function Kt(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}a(Kt,"_ts_decorate");function Fe(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}a(Fe,"_ts_metadata");function it(){return[new N("GENERIC_ERROR")]}a(it,"getDefaultMessages");var j=class i extends ie{static{a(this,"SmpErrorResponse")}_errorCode;_status;get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=it(),t="GENERIC_ERROR",r=500,s){super(e,s),this._errorCode=t,this._status=r,this._timestamp=Date.now()}static build(e=it(),t,r,s){return new i(N.sanitizeMessages(e),t,r,s)}static create({messages:e=it(),...t}){return new i(N.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=(0,me.plainToInstance)(Yr,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Kt([(0,me.Expose)(),Fe("design:type",Object),Fe("design:paramtypes",[])],j.prototype,"errorCode",null);Kt([(0,me.Expose)(),Fe("design:type",Number),Fe("design:paramtypes",[])],j.prototype,"timestamp",null);var Yr=class extends j{static{a(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var Qr={status:"OK"};var ot=function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i}({});var q=class{static{a(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 m(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 m=class nt{static{a(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=a(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 nt(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 nt(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||q).stringify(this)}};var De=class{static{a(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 m(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 b=class{static{a(this,"Utf8")}static parse(e){return De.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(De.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var ke=class{static{a(this,"BufferedBlockAlgorithm")}constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new m,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 m,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=b.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 m(n,o)}};var ne=class{static{a(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{a(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,c=r[e.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(h|c)<<24-o%4*8,o++}return new m(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,c=o<<16|n<<8|h;for(let p=0;p<4&&s+p*.75<e.sigBytes;p++)t.push(this._map.charAt(c>>>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 Ue=class{static{a(this,"OpenSSL")}static parse(e){let t=z.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new m(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new ne({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 m([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString(z)}};var Z=class{static{a(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 ne({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}};Z.cfg={blockSize:4,iv:new m([]),format:Ue};var A=class extends ke{static{a(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 a(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let i=0;i<64;i++)d[i]=Math.abs(Math.sin(i+1))*4294967296|0;var W=class f extends A{static{a(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,s,o,n,h){let c=e+(t&r|~t&s)+o+h;return(c<<n|c>>>32-n)+t}static GG(e,t,r,s,o,n,h){let c=e+(t&s|r&~s)+o+h;return(c<<n|c>>>32-n)+t}static HH(e,t,r,s,o,n,h){let c=e+(t^r^s)+o+h;return(c<<n|c>>>32-n)+t}static II(e,t,r,s,o,n,h){let c=e+(r^(t|~s))+o+h;return(c<<n|c>>>32-n)+t}reset(){super.reset(),this._hash=new m([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 c=0;c<16;c++){let p=t+c,_=e[p];e[p]=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360}let r=Array.from({length:16});for(let c=0;c<16;c++)r[c]=e[t+c];let s=this._hash.words[0],o=this._hash.words[1],n=this._hash.words[2],h=this._hash.words[3];s=f.FF(s,o,n,h,r[0],7,d[0]),h=f.FF(h,s,o,n,r[1],12,d[1]),n=f.FF(n,h,s,o,r[2],17,d[2]),o=f.FF(o,n,h,s,r[3],22,d[3]),s=f.FF(s,o,n,h,r[4],7,d[4]),h=f.FF(h,s,o,n,r[5],12,d[5]),n=f.FF(n,h,s,o,r[6],17,d[6]),o=f.FF(o,n,h,s,r[7],22,d[7]),s=f.FF(s,o,n,h,r[8],7,d[8]),h=f.FF(h,s,o,n,r[9],12,d[9]),n=f.FF(n,h,s,o,r[10],17,d[10]),o=f.FF(o,n,h,s,r[11],22,d[11]),s=f.FF(s,o,n,h,r[12],7,d[12]),h=f.FF(h,s,o,n,r[13],12,d[13]),n=f.FF(n,h,s,o,r[14],17,d[14]),o=f.FF(o,n,h,s,r[15],22,d[15]),s=f.GG(s,o,n,h,r[1],5,d[16]),h=f.GG(h,s,o,n,r[6],9,d[17]),n=f.GG(n,h,s,o,r[11],14,d[18]),o=f.GG(o,n,h,s,r[0],20,d[19]),s=f.GG(s,o,n,h,r[5],5,d[20]),h=f.GG(h,s,o,n,r[10],9,d[21]),n=f.GG(n,h,s,o,r[15],14,d[22]),o=f.GG(o,n,h,s,r[4],20,d[23]),s=f.GG(s,o,n,h,r[9],5,d[24]),h=f.GG(h,s,o,n,r[14],9,d[25]),n=f.GG(n,h,s,o,r[3],14,d[26]),o=f.GG(o,n,h,s,r[8],20,d[27]),s=f.GG(s,o,n,h,r[13],5,d[28]),h=f.GG(h,s,o,n,r[2],9,d[29]),n=f.GG(n,h,s,o,r[7],14,d[30]),o=f.GG(o,n,h,s,r[12],20,d[31]),s=f.HH(s,o,n,h,r[5],4,d[32]),h=f.HH(h,s,o,n,r[8],11,d[33]),n=f.HH(n,h,s,o,r[11],16,d[34]),o=f.HH(o,n,h,s,r[14],23,d[35]),s=f.HH(s,o,n,h,r[1],4,d[36]),h=f.HH(h,s,o,n,r[4],11,d[37]),n=f.HH(n,h,s,o,r[7],16,d[38]),o=f.HH(o,n,h,s,r[10],23,d[39]),s=f.HH(s,o,n,h,r[13],4,d[40]),h=f.HH(h,s,o,n,r[0],11,d[41]),n=f.HH(n,h,s,o,r[3],16,d[42]),o=f.HH(o,n,h,s,r[6],23,d[43]),s=f.HH(s,o,n,h,r[9],4,d[44]),h=f.HH(h,s,o,n,r[12],11,d[45]),n=f.HH(n,h,s,o,r[15],16,d[46]),o=f.HH(o,n,h,s,r[2],23,d[47]),s=f.II(s,o,n,h,r[0],6,d[48]),h=f.II(h,s,o,n,r[7],10,d[49]),n=f.II(n,h,s,o,r[14],15,d[50]),o=f.II(o,n,h,s,r[5],21,d[51]),s=f.II(s,o,n,h,r[12],6,d[52]),h=f.II(h,s,o,n,r[3],10,d[53]),n=f.II(n,h,s,o,r[10],15,d[54]),o=f.II(o,n,h,s,r[1],21,d[55]),s=f.II(s,o,n,h,r[8],6,d[56]),h=f.II(h,s,o,n,r[15],10,d[57]),n=f.II(n,h,s,o,r[6],15,d[58]),o=f.II(o,n,h,s,r[13],21,d[59]),s=f.II(s,o,n,h,r[4],6,d[60]),h=f.II(h,s,o,n,r[11],10,d[61]),n=f.II(n,h,s,o,r[2],15,d[62]),o=f.II(o,n,h,s,r[9],21,d[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 ht=class Vt{static{a(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:W,iterations:1},e)}static execute(e,t,r){return new Vt(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new m,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 qt=class{static{a(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=m.random(64/8));let o=new ht({keySize:t+r}).compute(e,s),n=new m(o.words.slice(t),r*4);return o.sigBytes=t*4,new ne({key:o,iv:n,salt:s})}};var Te=class{static{a(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),Z.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),Z.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};Te.cfg={blockSize:4,iv:new m([]),format:Ue,kdf:qt};var Xt=class{static{a(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?Te.decrypt(this._cipher,e,t,r):Z.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?Te.encrypt(this._cipher,e,t,r):Z.encrypt(this._cipher,e,t,r)}};var he=class extends ke{static{a(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 Xt(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()}};he.ivSize=4;he.keySize=4;he._DEC_XFORM_MODE=2;he._ENC_XFORM_MODE=1;var H=class{static{a(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var Me=class{static{a(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)}};Me.Decryptor=H;Me.Encryptor=H;var Zt=class extends H{static{a(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 Ht=class extends H{static{a(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 X=class extends Me{static{a(this,"CBC")}};X.Decryptor=Ht;X.Encryptor=Zt;var ae=class{static{a(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 c=0;c<s;c+=4)n.push(o);let h=new m(n,s);e.concat(h)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var je=class extends he{static{a(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:X,padding:ae},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 L{static{a(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 L(s,t)}and(e){return new L(this.high&e.high,this.low&e.low)}not(){return new L(~this.high,~this.low)}or(e){return new L(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 L(this.high<<e|this.low>>>32-e,this.low<<e):new L(this.low<<e-32,0)}shiftR(e){return e<32?new L(this.high>>>e,this.low>>>e|this.high<<32-e):new L(0,this.high>>>e-32)}xor(e){return new L(this.high^e.high,this.low^e.low)}};var Jt=class at{static{a(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new at(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new at(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new m(e,this.sigBytes)}};var B=[],Yt=[],Qt=[],er=[],tr=[],rr=[],ct=[],lt=[],dt=[],ft=[];(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,Yt[s]=e;let o=i[e],n=i[o],h=i[n],c=i[s]*257^s*16843008;Qt[e]=c<<24|c>>>8,er[e]=c<<16|c>>>16,tr[e]=c<<8|c>>>24,rr[e]=c,c=h*16843009^n*65537^o*257^e*16843008,ct[s]=c<<24|c>>>8,lt[s]=c<<16|c>>>16,dt[s]=c<<8|c>>>24,ft[s]=c,e?(e=o^i[i[i[h^o]]],t^=i[i[t]]):e=t=1}})();var es=[0,1,2,4,8,16,32,64,128,27,54],Le=class extends je{static{a(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,ct,lt,dt,ft,Yt),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,Qt,er,tr,rr,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 c=n[h-1];h%r?r>6&&h%r===4&&(c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255]):(c=c<<8|c>>>24,c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255],c^=es[h/r|0]<<24),n[h]=n[h-r]^c}this._invKeySchedule=[];for(let h=0;h<o;h++){let c=o-h,p;h%4?p=n[c]:p=n[c-4],h<4||c<=4?this._invKeySchedule[h]=p:this._invKeySchedule[h]=ct[B[p>>>24]]^lt[B[p>>>16&255]]^dt[B[p>>>8&255]]^ft[B[p&255]]}}_doCryptBlock(e,t,r,s,o,n,h,c){let p=e[t]^r[0],_=e[t+1]^r[1],g=e[t+2]^r[2],w=e[t+3]^r[3],R=4;for(let I=1;I<this._nRounds;I++){let y=s[p>>>24]^o[_>>>16&255]^n[g>>>8&255]^h[w&255]^r[R++],x=s[_>>>24]^o[g>>>16&255]^n[w>>>8&255]^h[p&255]^r[R++],k=s[g>>>24]^o[w>>>16&255]^n[p>>>8&255]^h[_&255]^r[R++],Qe=s[w>>>24]^o[p>>>16&255]^n[_>>>8&255]^h[g&255]^r[R++];p=y,_=x,g=k,w=Qe}let v=(c[p>>>24]<<24|c[_>>>16&255]<<16|c[g>>>8&255]<<8|c[w&255])^r[R++],M=(c[_>>>24]<<24|c[g>>>16&255]<<16|c[w>>>8&255]<<8|c[p&255])^r[R++],F=(c[g>>>24]<<24|c[w>>>16&255]<<16|c[p>>>8&255]<<8|c[_&255])^r[R++],D=(c[w>>>24]<<24|c[p>>>16&255]<<16|c[_>>>8&255]<<8|c[g&255])^r[R++];e[t]=v,e[t+1]=M,e[t+2]=F,e[t+3]=D}};Le.keySize=256/32;var ts=[1732584193,4023233417,2562383102,271733878,3285377520],J=new Array(80),Y=class extends A{static{a(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new m(ts.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 c=0;c<80;c++){if(c<16)J[c]=e[t+c]|0;else{let w=J[c-3]^J[c-8]^J[c-14]^J[c-16];J[c]=w<<1|w>>>31}let p,_;c<20?(p=s&o|~s&n,_=1518500249):c<40?(p=s^o^n,_=1859775393):c<60?(p=s&o|s&n|o&n,_=2400959708):(p=s^o^n,_=3395469782);let g=(r<<5|r>>>27)+p+h+_+J[c];h=n,n=o,o=s<<30|s>>>2,s=r,r=g|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 sr=[],ir=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}a(i,"isPrime");function e(s){return(s-(s|0))*4294967296|0}a(e,"getFractionalBits");let t=2,r=0;for(;r<64;)i(t)&&(r<8&&(sr[r]=e(Math.pow(t,1/2))),ir[r]=e(Math.pow(t,1/3)),r++),t++})();var Q=[],we=class extends A{static{a(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new m(sr.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],c=this._hash.words[5],p=this._hash.words[6],_=this._hash.words[7];for(let g=0;g<64;g++){if(g<16)Q[g]=e[t+g]|0;else{let I=Q[g-15],y=(I<<25|I>>>7)^(I<<14|I>>>18)^I>>>3,x=Q[g-2],k=(x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10;Q[g]=y+Q[g-7]+k+Q[g-16]}let w=h&c^~h&p,R=r&s^r&o^s&o,v=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),M=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),F=_+M+w+ir[g]+Q[g],D=v+R;_=p,p=c,c=h,h=n+F|0,n=o,o=s,s=r,r=F+D|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]+c|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+_|0}};var pt=[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)],T=[];(function(){for(let i=0;i<80;i++)T[i]=new l(void 0,void 0)})();var ut=class extends A{static{a(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new Jt([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,c=this._hash.words[2].low,p=this._hash.words[3].high,_=this._hash.words[3].low,g=this._hash.words[4].high,w=this._hash.words[4].low,R=this._hash.words[5].high,v=this._hash.words[5].low,M=this._hash.words[6].high,F=this._hash.words[6].low,D=this._hash.words[7].high,I=this._hash.words[7].low;for(let y=0;y<80;y++){let x,k;if(y<16)k=T[y].high=e[t+y*2]|0,x=T[y].low=e[t+y*2+1]|0;else{let vt=T[y-15],te=vt.high,ue=vt.low,Gr=(te>>>1|ue<<31)^(te>>>8|ue<<24)^te>>>7,Pt=(ue>>>1|te<<31)^(ue>>>8|te<<24)^(ue>>>7|te<<25),Nt=T[y-2],re=Nt.high,ge=Nt.low,Sr=(re>>>19|ge<<13)^(re<<3|ge>>>29)^re>>>6,Ft=(ge>>>19|re<<13)^(ge<<3|re>>>29)^(ge>>>6|re<<26);x=Pt+T[y-7].low,k=Gr+T[y-7].high+(x>>>0<Pt>>>0?1:0),x=x+Ft,k=k+Sr+(x>>>0<Ft>>>0?1:0),x=x+T[y-16].low,k=k+T[y-16].high+(x>>>0<T[y-16].low>>>0?1:0),T[y].high=k,T[y].low=x}let Qe=g&R^~g&M,It=w&v^~w&F,jr=r&o^r&h^o&h,Lr=s&n^s&c^n&c,zr=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),Bt=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Wr=(g>>>14|w<<18)^(g>>>18|w<<14)^(g<<23|w>>>9),$r=(w>>>14|g<<18)^(w>>>18|g<<14)^(w<<23|g>>>9),P=I+$r,$=D+Wr+(P>>>0<I>>>0?1:0);P=P+It,$=$+Qe+(P>>>0<It>>>0?1:0),P=P+pt[y].low,$=$+pt[y].high+(P>>>0<pt[y].low>>>0?1:0),P=P+x,$=$+k+(P>>>0<x>>>0?1:0);let Ct=Bt+Lr,Kr=zr+jr+(Ct>>>0<Bt>>>0?1:0);D=M,I=F,M=R,F=v,R=g,v=w,w=_+P|0,g=p+$+(w>>>0<_>>>0?1:0)|0,p=h,_=c,h=o,c=n,o=r,n=s,s=P+Ct|0,r=$+Kr+(s>>>0<P>>>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+c,this._hash.words[2].high=this._hash.words[2].high+h+(this._hash.words[2].low>>>0<c>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+_,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<_>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+w,this._hash.words[4].high=this._hash.words[4].high+g+(this._hash.words[4].low>>>0<w>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+v,this._hash.words[5].high=this._hash.words[5].high+R+(this._hash.words[5].low>>>0<v>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+F,this._hash.words[6].high=this._hash.words[6].high+M+(this._hash.words[6].low>>>0<F>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+I,this._hash.words[7].high=this._hash.words[7].high+D+(this._hash.words[7].low>>>0<I>>>0?1:0)}};var or=class{static{a(this,"HMAC")}constructor(e,t){this._hasher=new e;let r=typeof t=="string"?b.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(),c=n.words,p=h.words;for(let _=0;_<s;_++)c[_]^=1549556828,p[_]^=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 gt=class nr{static{a(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:we,iterations:25e4},e)}static execute(e,t,r){return new nr(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new or(r.hasher,e),o=new m,n=new m([1]),h=o.words,c=n.words,p=r.keySize,_=r.iterations;for(;h.length<p;){let g=s.update(t).finalize(n);s.reset();let w=g.words,R=w.length,v=g;for(let M=1;M<_;M++){v=s.finalize(v),s.reset();let F=v.words;for(let D=0;D<R;D++)w[D]^=F[D]}o.concat(g),c[0]++}return o.sigBytes=p*4,o}};var ye=je._createHelper(Le);var ce=A._createHelper(W);var le=A._createHelper(Y);var ze=A._createHelper(we);var We=A._createHelper(ut);var de=class{static{a(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?q.parse(this._initVector):void 0}_mode;_padding;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r,this._mode=X,this._padding=ae}decryptAES(e){return ye.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(b)}encryptAES(e){return ye.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return gt.execute(this._password,q.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:Y})}};var $e=class{static{a(this,"SmpCrypto")}static base64Decode(e){return b.stringify(z.parse(e))}static base64Encode(e){return z.stringify(b.parse(e))}static md5(e){return ce(e).toString()}static sha1(e){return le(e).toString()}static sha256(e){return ze(e).toString()}static sha512(e){return We(e).toString()}};var _t=function(i){return i[i.Continue=100]="Continue",i[i.SwitchingProtocols=101]="SwitchingProtocols",i[i.Processing=102]="Processing",i[i.EarlyHints=103]="EarlyHints",i[i.Ok=200]="Ok",i[i.Created=201]="Created",i[i.Accepted=202]="Accepted",i[i.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",i[i.NoContent=204]="NoContent",i[i.ResetContent=205]="ResetContent",i[i.PartialContent=206]="PartialContent",i[i.MultiStatus=207]="MultiStatus",i[i.AlreadyReported=208]="AlreadyReported",i[i.ImUsed=226]="ImUsed",i[i.MultipleChoices=300]="MultipleChoices",i[i.MovedPermanently=301]="MovedPermanently",i[i.Found=302]="Found",i[i.SeeOther=303]="SeeOther",i[i.NotModified=304]="NotModified",i[i.UseProxy=305]="UseProxy",i[i.Unused=306]="Unused",i[i.TemporaryRedirect=307]="TemporaryRedirect",i[i.PermanentRedirect=308]="PermanentRedirect",i[i.BadRequest=400]="BadRequest",i[i.Unauthorized=401]="Unauthorized",i[i.PaymentRequired=402]="PaymentRequired",i[i.Forbidden=403]="Forbidden",i[i.NotFound=404]="NotFound",i[i.MethodNotAllowed=405]="MethodNotAllowed",i[i.NotAcceptable=406]="NotAcceptable",i[i.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",i[i.RequestTimeout=408]="RequestTimeout",i[i.Conflict=409]="Conflict",i[i.Gone=410]="Gone",i[i.LengthRequired=411]="LengthRequired",i[i.PreconditionFailed=412]="PreconditionFailed",i[i.PayloadTooLarge=413]="PayloadTooLarge",i[i.UriTooLong=414]="UriTooLong",i[i.UnsupportedMediaType=415]="UnsupportedMediaType",i[i.RangeNotSatisfiable=416]="RangeNotSatisfiable",i[i.ExpectationFailed=417]="ExpectationFailed",i[i.ImATeapot=418]="ImATeapot",i[i.MisdirectedRequest=421]="MisdirectedRequest",i[i.UnprocessableEntity=422]="UnprocessableEntity",i[i.Locked=423]="Locked",i[i.FailedDependency=424]="FailedDependency",i[i.TooEarly=425]="TooEarly",i[i.UpgradeRequired=426]="UpgradeRequired",i[i.PreconditionRequired=428]="PreconditionRequired",i[i.TooManyRequests=429]="TooManyRequests",i[i.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",i[i.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",i[i.InternalServerError=500]="InternalServerError",i[i.NotImplemented=501]="NotImplemented",i[i.BadGateway=502]="BadGateway",i[i.ServiceUnavailable=503]="ServiceUnavailable",i[i.GatewayTimeout=504]="GatewayTimeout",i[i.HttpVersionNotSupported=505]="HttpVersionNotSupported",i[i.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",i[i.InsufficientStorage=507]="InsufficientStorage",i[i.LoopDetected=508]="LoopDetected",i[i.NotExtended=510]="NotExtended",i[i.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",i}({});var Ke=class{static{a(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength;_seed;constructor(e){this._baseCode=e,this._crcLength=5,this._seed="changeme"}static check(e,t){if(new this(e).secureCode!==t)throw j.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",_t.BadRequest)}_encode(){let e=new W;return e.update(b.parse(this._seed+this._baseCode)),e.finalize().toString(q).substring(0,this._crcLength).toUpperCase()}};var fe=require("class-transformer"),Ge=require("ts-luxon");var C=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 ee=function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i}({});function rs(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}a(rs,"_ts_decorate");function hr(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}a(hr,"_ts_metadata");var Se=class{static{a(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new de("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[C.CHECK]:"",[C.TRANSACTION]:"",[C.TRANSACTION_DETAIL]:"",[C.ACTIVATE]:"A",[C.BLOCK]:"B",[C.DIGITAL_ACTIVATE]:"D",[C.FREEZE]:"F",[C.PURCHASE]:"P",[C.RECHARGE]:"G",[C.ROLLBACK]:"R",[C.UNFREEZE]:"U",[C.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;_hashStrategy;constructor(e="ACTIVATION",t,r,s){this.gc=e,this.op=t,this.ot=r,this._hashStrategies={[ee.MD5]:o=>ce(o),[ee.MD5_HMAC]:o=>{let n=new W;return n.update(b.parse(o)),n.finalize()},[ee.SHA1]:o=>le(o),[ee.SHA1_HMAC]:o=>{let n=new Y;return n.update(b.parse(o)),n.finalize()}},this._hashStrategy=this._hashStrategies[ee.MD5],this._dto=typeof s=="number"&&s>=0?Ge.DateTime.fromMillis(+`${s}000`.slice(0,13)):Ge.DateTime.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:Ge.DateTime.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.constructor._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,fe.plainToInstance)(this,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(0,fe.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};rs([(0,fe.Expose)(),hr("design:type",Number),hr("design:paramtypes",[])],Se.prototype,"ts",null);var ss=function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i}({});var is=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function cr(i){return i.match(is)}a(cr,"smpAsciiWords");var gr="\\ud800-\\udfff",os="\\u0300-\\u036f",ns="\\ufe20-\\ufe2f",hs="\\u20d0-\\u20ff",as="\\u1ab0-\\u1aff",cs="\\u1dc0-\\u1dff",ls=os+ns+hs+as+cs,_r="\\u2700-\\u27bf",mr="a-z\\xdf-\\xf6\\xf8-\\xff",ds="\\xac\\xb1\\xd7\\xf7",fs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",ps="\\u2000-\\u206f",us=" \\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",wr="A-Z\\xc0-\\xd6\\xd8-\\xde",gs="\\ufe0e\\ufe0f",yr=ds+fs+ps+us,xr="['\u2019]",lr=`[${yr}]`,_s=`[${ls}]`,Er="\\d",ms=`[${_r}]`,Rr=`[${mr}]`,Ar=`[^${gr}${yr+Er+_r+mr+wr}]`,ws="\\ud83c[\\udffb-\\udfff]",ys=`(?:${_s}|${ws})`,xs=`[^${gr}]`,Or="(?:\\ud83c[\\udde6-\\uddff]){2}",br="[\\ud800-\\udbff][\\udc00-\\udfff]",pe=`[${wr}]`,Es="\\u200d",dr=`(?:${Rr}|${Ar})`,Rs=`(?:${pe}|${Ar})`,fr=`(?:${xr}(?:d|ll|m|re|s|t|ve))?`,pr=`(?:${xr}(?:D|LL|M|RE|S|T|VE))?`,Ir=`${ys}?`,Br=`[${gs}]?`,As=`(?:${Es}(?:${[xs,Or,br].join("|")})${Br+Ir})*`,Os="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bs="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Is=Br+Ir+As,ur=`(?:${[ms,Or,br].join("|")})${Is}`,Ee=class{static{a(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([`${pe}?${Rr}+${fr}(?=${[lr,pe,"$"].join("|")})`,`${Rs}+${pr}(?=${[lr,pe+dr,"$"].join("|")})`,`${pe}?${dr}+${fr}`,`${pe}+${pr}`,bs,Os,`${Er}+`,ur].join("|"),"g");static RS_EMOJI=ur;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var mt=class i{static{a(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||"KikCommonUtils => val was not an array")}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||"KikCommonUtils => val was not boolean")}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||"KikCommonUtils => entity was not a function")}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||"KikCommonUtils => entity was empty")}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||"KikCommonUtils => val was not an object")}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||"KikCommonUtils => val was not a string")}static assertIsTruthy(e,t){if(!e)throw new Error(t||"KikCommonUtils => 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 c=0;c<e.length;c++)if(!i.isEqual(e[c],t[c]))return!1;return!0}a(r,"areArraysEqual");function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let c in e)if(Object.prototype.hasOwnProperty.call(e,c)&&!i.isEqual(e[c],t[c]))return!1;return!0}a(s,"areObjectsEqual");function o(){return e.toString()===t.toString()}a(o,"areFunctionsEqual");function n(){return e===t}a(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 parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn("KikCommonUtils => 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=ot.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([h,c])=>`<input name="${h}" type="hidden" value="${c}" />`),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?(Ee.HAS_UNICODE_WORD(e)?Ee.unicodeWords(e):cr(e))||[]:e.match(t)||[]}};var wt=class extends Error{static{a(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var yt=require("ts-luxon");var xt=class i{static{a(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return yt.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`gcpsid-xxxx-${+yt.DateTime.now().ts}`,t=0){this.value=e,this.expiry=t,this._controlSuffix="$1"}static parse(e){return new i(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};_e();var Et=class{static{a(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 Re=class{static{a(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){this._storage=e,this._prefix=t}flush(){Object.keys(this._storage).filter(e=>e.startsWith(this._prefix)).forEach(this.remove.bind(this))}read(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{return}}remove(e){this._storage.removeItem(this._prefix+e)}write(e,t){this._storage.setItem(this._prefix+e,JSON.stringify(t))}};var Ae=class{static{a(this,"SmpInMemoryCache")}static _storage=new Map;get staticStorage(){return this.constructor._storage}flush(){this.staticStorage.clear()}read(e){return this.staticStorage.get(e)}remove(e){this.staticStorage.delete(e)}write(e,t){this.staticStorage.set(e,t)}};var Oe=class extends Re{static{a(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var Rt=class{static{a(this,"SmpHttpService")}static _cachePrefix="kik_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new Oe:new Ae;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=j;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core";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 vs="1.4.0-next.0";Object.defineProperties(module.exports,{smpRxjsCatchOnly:{get:a(()=>(He(),se(Ze)).smpRxjsCatchOnly,"get")},smpRxjsThrowIfEmpty:{get:a(()=>(He(),se(Ze)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:a(()=>(He(),se(Ze)).smpRxjsThrowOnCondition,"get")},SmpDynamoService:{get:a(()=>(Ur(),se(kr)).SmpDynamoService,"get")},SmpFirebaseService:{get:a(()=>(Mr(),se(Tr)).SmpFirebaseService,"get")}});0&&(module.exports={SMP_HEALTHZ,SmpAesCrypt,SmpApiCommonUtils,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpNoop});
|
|
1
|
+
"use strict";var rs=Object.create;var ye=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var is=Object.getOwnPropertyNames;var os=Object.getPrototypeOf,ns=Object.prototype.hasOwnProperty;var h=(i,e)=>ye(i,"name",{value:e,configurable:!0});var E=(i,e)=>()=>(i&&(e=i(i=0)),e);var xe=(i,e)=>{for(var t in e)ye(i,t,{get:e[t],enumerable:!0})},Lt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of is(e))!ns.call(i,s)&&s!==t&&ye(i,s,{get:()=>e[s],enumerable:!(r=ss(e,s))||r.enumerable});return i};var as=(i,e,t)=>(t=i!=null?rs(os(i)):{},Lt(e||!i||!i.__esModule?ye(t,"default",{value:i,enumerable:!0}):t,i)),J=i=>Lt(ye({},"__esModule",{value:!0}),i);var Wt,Gt=E(()=>{"use strict";Wt=class{static{h(this,"SmpSessionManagerService")}get sessionId(){return this._sessionId||this._storage.getItem(this._sessionIdKey)||void 0}constructor(e="lggr_sid"){this._sessionIdKey=e,this._storage=this._getStorage(),this._sessionId=this.sessionId||this._generateSessionId()}_generateSessionId(){let e=this._generateUUID();return this._storage.setItem(this._sessionIdKey,e),e}_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)})}_getStorage(){try{if(typeof window<"u"&&typeof window.sessionStorage==typeof isNaN)return sessionStorage}catch(e){console.warn(`${this.constructor.name}: error while checking sessionStorage`,e)}return{getItem:h(()=>null,"getItem"),setItem:h(()=>null,"setItem"),removeItem:h(()=>null,"removeItem"),clear:h(()=>null,"clear")}}}});var F,lt=E(()=>{"use strict";(function(i){i[i.OFF=0]="OFF",i[i.ERROR=1]="ERROR",i[i.WARN=2]="WARN",i[i.INFO=3]="INFO",i[i.LOG=4]="LOG",i[i.DEBUG=5]="DEBUG"})(F||(F={}))});function O(){}var ke=E(()=>{"use strict";h(O,"smpNoop")});var ls,V,dt=E(()=>{"use strict";ke();ls=class{static{h(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},V=class St extends ls{static{h(this,"SmpLoggerMethods")}constructor(){super(...arguments),this.debug=O,this.error=O,this.info=O,this.log=O,this.warn=O}static describe(){return Object.getOwnPropertyNames(new St).map(e=>e)}}});var Vt,Ue,Fe,qt=E(()=>{"use strict";Gt();lt();dt();ke();Ue="[DEFAULT]",Fe=class extends V{static{h(this,"SmpLoggerService")}static get INSTANCE(){return this.get(Ue)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(F).filter(e=>+e>F.OFF&&+e<=this.level).map(e=>F[e])}get appName(){return this._appName}get currentConfig(){return{level:this.level,enableSessionId:this.enableSessionId,enablePreprocessing:this.enablePreprocessing,sensitiveProps:this._sensitiveProps}}get enablePreprocessing(){return this.preprocessArgs!==this._noopPreprocessArgs}get enableSessionId(){return!!this.sessionId}get level(){return this.constructor._level}get sessionId(){return this._sessionId}constructor(e){super(),this._sensitivePropMask="*****",this._sessionManager=new Wt,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=Ue){return this._instances.get(e)||this._instances.get(Ue)||this._noopInstance}static init(e,t=Ue){let r;if(this._instances.has(t)){r=this.get(t);let s=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},s),e))}else this._instances.set(t,new this(e)),r=this.get(t),r._appName=t;return r}static pop(e){let t=this.get(e);return this.destroy(e),t}destroy(){return this.constructor.destroy(this.appName)}filterSensitiveData(e){if(e===null||typeof e!="object"||Array.isArray(e)||e.constructor!==Object)return e;let t={};for(let r in e){let s=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||s===null||s===void 0){t[r]=s;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(s)}return t}preprocessArgs(e,...t){return this._defaultPreprocessArgs.apply(this,[e,...t])}_defaultPreprocessArgs(e,...t){let r=new Date;return[`${r.toISOString()}`,`${t.shift()}`.trim(),...t.map(s=>({tags:[this._appName,`level-${F[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=F.OFF,enablePreprocessing:r=!1,enableSessionId:s=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=s?this._sessionManager.sessionId:void 0,this._updateLevel(t)}_noopPreprocessArgs(...e){return e}_setup(e){let t=this.preprocessArgs.bind(this);this.activeLevels.forEach(r=>{let s=`${r}`.toLowerCase();typeof e[s]==typeof isNaN&&(this[s]=function(...o){e[s].apply(e,t.apply(null,[s,...o]))})}),this.level>F.OFF&&console&&(console.group&&console.groupEnd&&(this.group=console.group.bind(console),this.groupEnd=console.groupEnd.bind(console)),console.groupCollapsed&&(this.groupCollapsed=console.groupCollapsed.bind(console)),console.time&&console.timeEnd&&(this.time=console.time.bind(console),this.timeEnd=console.timeEnd.bind(console)))}_updateLevel(e=F.WARN){this.constructor.describe().forEach(t=>{this[t]=O}),this.constructor._level=e,console&&this._setup(console)}};Vt=Fe;Fe._instances=new Map;Fe._level=F.OFF;Fe._noopInstance=new Vt({level:F.OFF})});var Xt=E(()=>{"use strict"});var Zt=E(()=>{"use strict"});var Ht=E(()=>{"use strict";Xt();Zt();dt();lt();ke()});var Ie=E(()=>{"use strict";qt();Ht()});var q,Jt=E(()=>{"use strict";q=function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i}({})});var he,Yt=E(()=>{"use strict";he=function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i}({})});var ve,gr=E(()=>{"use strict";ve=function(i){return i.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",i.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",i.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",i.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",i.EMAIL_EXISTS="auth/email-already-exists",i.INVALID_ACTION_CODE="auth/invalid-action-code",i.POPUP_BLOCKED="auth/popup-blocked",i.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",i.USER_NOT_FOUND="auth/user-not-found",i.WRONG_PASSWORD="auth/wrong-password",i}({})});var Fr={};xe(Fr,{SmpDynamoService:()=>vt});var Ur,Je,He,vt,Mr=E(()=>{"use strict";Ur=require("@aws-sdk/client-dynamodb"),Je=require("@aws-sdk/util-dynamodb");Ie();He=function(i){return i.CouldNotDelete="ERR_COULD_NOT_DELETE",i.CouldNotRead="ERR_COULD_NOT_READ",i.CouldNotWrite="ERR_COULD_NOT_WRITE",i.ConditionalCheckFailedException="ERR_DUPE_TOKEN",i}(He||{}),vt=class{static{h(this,"SmpDynamoService")}_config;_tableName;get marshall(){return Je.marshall}get unmarshall(){return Je.unmarshall}_db;_logger;constructor(e,t){this._config=e,this._tableName=t,this._db=new Ur.DynamoDB([this._buildConfig()]),this._logger=new V}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let s={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_WRITE")))}}});var jr={};xe(jr,{SmpFirebaseService:()=>Pt});var De,u,Pt,Lr=E(()=>{"use strict";Ie();De=require("firebase/app"),u=require("firebase/auth");Jt();Yt();gr();Pt=class i{static{h(this,"SmpFirebaseService")}static get INSTANCE(){if(!(this._instance instanceof i))throw Error(`${this.constructor.name} instance doesn't exist! Call ${this.constructor.name}.init first!`);return this._instance}static _instance;get config(){return this._config}get enabledSocials(){return this._enabledSocials}get loggedUser(){return this._loggedUser||(this._loggedUser=this._readStoredUser()),this._auth.currentUser||this._loggedUser||void 0}get providersRelation(){return{"facebook.com":q.FACEBOOK,"google.com":q.GOOGLE,"apple.com":q.APPLE}}get socialLoginUXMode(){return this._socialLoginUxMode}get storedUserKey(){return"firebaseUser"}get _auth(){return(0,u.getAuth)(this._app)}_app;_config;_enabledSocials=[];_loggedUser;_logger;_popupErrors=0;_popupFallsBackToRedirect;_providers;_socialLoginUxMode=he.POPUP;constructor(e,t){this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||he.POPUP,this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new V,this._app=(0,De.getApps)().length?(0,De.getApps)()[0]:(0,De.initializeApp)(e),this._watchAuthState()}static init(e,t){return this._instance||(this._instance=new i(e,t)),this._instance}addAuthStateChangedCallback(e){return this._auth.onAuthStateChanged(t=>{e(t||this.loggedUser||null)})}checkActionCode(e){return(0,u.checkActionCode)(this._auth,e)}confirmPasswordReset(e,t){return(0,u.confirmPasswordReset)(this._auth,e,t)}fetchSignInMethodsForEmail(e){return(0,u.fetchSignInMethodsForEmail)(this._auth,e).then(t=>t.map(r=>this.providersRelation[r]||r))}getRedirectResult(){return(0,u.getRedirectResult)(this._auth).catch(async e=>(await this._expandDifferentCredential(e),Promise.reject(e)))}initAppCheck(){}sendEmailVerification(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.sendEmailVerification)(this.loggedUser,e?{url:e}:void 0)}sendPasswordResetEmail(e,t){return(0,u.sendPasswordResetEmail)(this._auth,e,{url:t})}setPersistence(e){return(0,u.setPersistence)(this._auth,e?u.browserLocalPersistence:u.browserSessionPersistence)}signInWithCustomToken(e){return(0,u.signInWithCustomToken)(this._auth,e)}signInWithEmailAndPassword(e,t){return(0,u.signInWithEmailAndPassword)(this._auth,e,t).then(async r=>r.user)}signInWithSocialProvider(e){if(!this._providers[e])throw Error(`Firebase: invalid social key provided! Expected one of ${this.enabledSocials}, got ${e}`);return this._signInWithProvider(this._providers[e])}signOut(){return(0,u.signOut)(this._auth)}updatePassword(e,t){if(!this.loggedUser)throw Error("Firebase: user is not logged!");let r=u.EmailAuthProvider.credential(this.loggedUser.email,e);return(0,u.reauthenticateWithCredential)(this.loggedUser,r).then(()=>(0,u.updatePassword)(this.loggedUser,t))}updateUserProfile(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.updateProfile)(this.loggedUser,e)}async verifyIdToken(){return this._auth.currentUser?.getIdTokenResult()}_buildProviders(){this._providers=this._enabledSocials.reduce((e,t)=>(t in e&&(e[t]=e[t]),e),{[q.APPLE]:new u.OAuthProvider("apple.com"),[q.FACEBOOK]:new u.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),[q.GOOGLE]:new u.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code===ve.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=ve["DIFFERENT_CREDENTIAL_"+t[0]],e}}_readStoredUser(){try{let e=localStorage.getItem(this.storedUserKey);if(e){this._logger?.debug("Firebase: found local user",e);let t=JSON.parse(e);return{...t,getIdToken:h(()=>Promise.resolve(t.stsTokenManager.accessToken),"getIdToken")}}}catch(e){this._logger.debug("Firebase: error while getting stored user",e)}}async _signInWithProvider(e,t=this.socialLoginUXMode){return(t===he.POPUP?u.signInWithPopup:u.signInWithRedirect)(this._auth,e).then(s=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),s.user)).catch(async s=>s?.code===ve.POPUP_BLOCKED&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,he.REDIRECT)):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,s),await this._expandDifferentCredential(s),Promise.reject(s)))}_updateLocalUser(e){try{e?localStorage.setItem(this.storedUserKey,JSON.stringify(e)):localStorage.removeItem(this.storedUserKey),this._logger.debug("Firebase: updating local user",e),this._loggedUser=e}catch(t){this._logger.warn("Firebase: couldn't update local user",{user:e,error:t})}}_watchAuthState(){this._auth.onAuthStateChanged(e=>{this._logger.debug("Firebase: firebase detected auth state change",e),this._updateLocalUser(e||void 0)})}}});function zr(i,e){return t=>t.pipe((0,Ye.catchError)(r=>(typeof i==typeof isNaN?Ls(i)?zs(r,i):i(r):!1)?e(r):(0,Ye.throwError)(()=>r)))}function Ls(i){try{return Reflect.construct(String,[],i),!0}catch{return!1}}function zs(i,e){return typeof i=="object"&&i!==null&&i.constructor===e}var Ye,$r=E(()=>{"use strict";Ye=require("rxjs");h(zr,"smpRxjsCatchOnly");h(Ls,"isConstructor");h(zs,"isExactInstance")});function Qe(i=Ks){return e=>e.pipe((0,Kr.map)(t=>{if(~$s.indexOf(JSON.stringify(t)))throw i(t);return t}))}var Kr,$s,Ks,Dt=E(()=>{"use strict";Kr=require("rxjs");h(Qe,"smpRxjsThrowIfEmpty");$s=[void 0,null,!1,0,"","0",[],{}].map(i=>JSON.stringify(i)),Ks=h(()=>new Error,"defaultErrorFactory")});function Wr(i,e){return t=>t.pipe((0,et.filter)(r=>!i(r)),(0,et.defaultIfEmpty)(!1),Qe(e))}var et,Gr=E(()=>{"use strict";et=require("rxjs");Dt();h(Wr,"smpRxjsThrowOnCondition")});var tt={};xe(tt,{smpRxjsCatchOnly:()=>zr,smpRxjsThrowIfEmpty:()=>Qe,smpRxjsThrowOnCondition:()=>Wr});var rt=E(()=>{"use strict";$r();Dt();Gr()});var R,H,st,Ws,Sr=E(()=>{"use strict";R=as(require("zod"),1),H=require("ts-luxon"),st=class i extends R.default.ZodType{static{h(this,"SmpZodDateTime")}constructor(e){super({typeName:"SmpZodDateTime",coerce:e?.coerce??!1,checks:e?.checks??[]})}_parse(e){let t=this._getOrReturnCtx(e),r=t.data;if(this._def.coerce&&(r=this._coerceToDateTime(r),!(r instanceof H.DateTime)||!r.isValid))return R.default.addIssueToContext(t,{code:R.ZodIssueCode.invalid_type,expected:R.ZodParsedType.date,received:R.ZodParsedType.unknown,path:t.path,message:"Invalid date format"}),R.default.INVALID;if((!(r instanceof H.DateTime)||!r.isValid)&&!this._def.coerce)return R.default.addIssueToContext(t,{code:R.ZodIssueCode.invalid_type,expected:R.ZodParsedType.date,received:R.ZodParsedType.unknown,path:t.path,message:"Input must be a valid DateTime object"}),R.default.INVALID;let s={min:h((o,n,a)=>{if(o.min&&n<o.min)return{code:R.ZodIssueCode.too_small,minimum:o.min.toMillis(),type:"date",inclusive:!0,message:o.message??`Date must be \u2265 ${o.min.toISODate()}`,path:a.path}},"min"),max:h((o,n,a)=>{if(o.max&&n>o.max)return{code:R.ZodIssueCode.too_big,maximum:o.max.toMillis(),type:"date",inclusive:!0,message:o.message??`Date must be \u2264 ${o.max.toISODate()}`,path:a.path}},"max"),between:h((o,n,a)=>{if(o.min&&o.max&&(n<o.min||n>o.max))return{code:R.ZodIssueCode.custom,message:o.message??`Date must be between ${o.min.toISODate()} and ${o.max.toISODate()}`,path:a.path}},"between")};for(let o of this._def.checks)if(r instanceof H.DateTime&&r.isValid){let n=s[o.kind](o,r,t);n&&R.default.addIssueToContext(t,n)}return t.common.issues.length>0?R.default.INVALID:R.default.OK(r)}between(e,t,r){return new i({...this._def,checks:[...this._def.checks,{kind:"between",min:e.toUTC(),max:t.toUTC(),message:r}]})}coerce(){return new i({...this._def,coerce:!0})}max(e,t){return new i({...this._def,checks:[...this._def.checks,{kind:"max",max:e.toUTC(),message:t}]})}min(e,t){return new i({...this._def,checks:[...this._def.checks,{kind:"min",min:e.toUTC(),message:t}]})}_coerceToDateTime(e){if(e instanceof H.DateTime&&e.isValid)return e;let t={string:h(()=>H.DateTime.fromJSDate(new Date(e)),"string"),number:h(()=>H.DateTime.fromMillis(e),"number"),object:h(()=>H.DateTime.fromJSDate(e),"object"),default:h(()=>null,"default")};return(t[typeof e]||t.default)()}},Ws=h((i={})=>new st({coerce:i.coerce??!1,checks:[]}),"smpZodDateTime")});var Vr={};xe(Vr,{SmpZodDateTime:()=>st,smpZodDateTime:()=>Ws});var qr=E(()=>{"use strict";Sr()});var Ss={};xe(Ss,{SMP_HEALTHZ:()=>ds,SmpAbstractCacheStrategy:()=>Ee,SmpAbstractTtlCacheStrategy:()=>Y,SmpAesCrypt:()=>ue,SmpApiCommonUtils:()=>ft,SmpBrowserCache:()=>Re,SmpCommonUtils:()=>bt,SmpCrypto:()=>Ve,SmpErrorResponse:()=>L,SmpFilterException:()=>Ot,SmpFirebaseErrors:()=>ve,SmpGenericResponse:()=>ae,SmpGiftcardTransaction:()=>Ze,SmpGiftcardTransactionHashStrategies:()=>ie,SmpGiftcardTransactionOps:()=>v,SmpHttpService:()=>ht,SmpHttpSessionStorageCache:()=>Ae,SmpHttpStatusCodes:()=>ct,SmpInMemoryCache:()=>be,SmpMarketingCloudValidators:()=>gs,SmpRegularExpressions:()=>Bt,SmpResponseMessage:()=>N,SmpResponseMessageTypes:()=>G,SmpRestVerbs:()=>pt,SmpSecureCode:()=>qe,SmpSid:()=>Ct,SmpSocialSignInKeys:()=>q,SmpSocialSignInUxModes:()=>he,VERSION:()=>Gs,smpNoop:()=>O});module.exports=J(Ss);var ot=require("ts-luxon");var Ee=class{static{h(this,"SmpAbstractCacheStrategy")}};var Y=class extends Ee{static{h(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isKikCachedValue(t)){if(t.expiry>=ot.DateTime.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);return}let s=ot.DateTime.now().ts+r*1e3,o={value:t,expiry:s};this._writeRaw(e,o)}_isKikCachedValue(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}};var Re=class extends Y{static{h(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 Ae=class extends Re{static{h(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var be=class extends Y{static{h(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 Oe=require("class-transformer");var S=require("class-transformer");var nt=require("class-transformer");var G=function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i}({});function zt(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 a=i.length-1;a>=0;a--)(n=i[a])&&(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}h(zt,"_ts_decorate");function Ne(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(Ne,"_ts_metadata");var N=class i{static{h(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=G.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)}};zt([(0,nt.Expose)(),Ne("design:type",String),Ne("design:paramtypes",[])],N.prototype,"message",null);zt([(0,nt.Expose)(),Ne("design:type",typeof G>"u"?Object:G),Ne("design:paramtypes",[])],N.prototype,"type",null);function hs(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 a=i.length-1;a>=0;a--)(n=i[a])&&(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}h(hs,"_ts_decorate");function $t(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h($t,"_ts_metadata");var ae=class i{static{h(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=N.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 N(r,G.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new N(r,G.SUCCESS)),t)}static fromPlain(e){return(0,S.plainToInstance)(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,S.instanceToPlain)(this,{excludePrefixes:["_"]})}};hs([(0,S.Expose)(),(0,S.Transform)(({value:i})=>i?.length?i:void 0),$t("design:type",Object),$t("design:paramtypes",[])],ae.prototype,"messages",null);function Kt(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 a=i.length-1;a>=0;a--)(n=i[a])&&(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}h(Kt,"_ts_decorate");function Te(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(Te,"_ts_metadata");function at(){return[new N("GENERIC_ERROR")]}h(at,"getDefaultMessages");var L=class i extends ae{static{h(this,"SmpErrorResponse")}_errorCode;_status;get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=at(),t="GENERIC_ERROR",r=500,s){super(e,s),this._errorCode=t,this._status=r,this._timestamp=Date.now()}static build(e=at(),t,r,s){return new i(N.sanitizeMessages(e),t,r,s)}static create({messages:e=at(),...t}){return new i(N.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=(0,Oe.plainToInstance)(cs,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Kt([(0,Oe.Expose)(),Te("design:type",Object),Te("design:paramtypes",[])],L.prototype,"errorCode",null);Kt([(0,Oe.Expose)(),Te("design:type",Number),Te("design:paramtypes",[])],L.prototype,"timestamp",null);var cs=class extends L{static{h(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var ht=class{static{h(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new Ae:new be;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=L;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core";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(a){console.debug("http: failed to parse error response into ErrorResponse",a)}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,a])=>[n,`${a}`]))}).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 ct=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}({});Ie();var ft=class{static{h(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new V;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("KikApiCommonUtils: couldn't interpolate params",r)}return e}};var ds={status:"OK"};var pt=function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i}({});var X=class{static{h(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 _(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 _=class ut{static{h(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=h(function(s){let o=987654321,n=4294967295;return function(){o=36969*(o&65535)+(o>>16)&n,s=18e3*(s&65535)+(s>>16)&n;let a=(o<<16)+s&n;return a/=4294967296,a+=.5,a*(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 ut(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 ut(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||X).stringify(this)}};var Me=class{static{h(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 _(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 I=class{static{h(this,"Utf8")}static parse(e){return Me.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(Me.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var je=class{static{h(this,"BufferedBlockAlgorithm")}constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new _,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 _,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=I.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 a=0;a<s;a+=this.cfg.blockSize)this._doProcessBlock(this._data.words,a);n=this._data.words.splice(0,s),this._data.sigBytes-=o}return new _(n,o)}};var ce=class{static{h(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 $=class{static{h(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 a=r[e.charCodeAt(n-1)]<<n%4*2,c=r[e.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return new _(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,a=e.words[s+2>>>2]>>>24-(s+2)%4*8&255,c=o<<16|n<<8|a;for(let p=0;p<4&&s+p*.75<e.sigBytes;p++)t.push(this._map.charAt(c>>>6*(3-p)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};$._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";$._reverseMap=void 0;var Le=class{static{h(this,"OpenSSL")}static parse(e){let t=$.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new _(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new ce({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 _([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString($)}};var Q=class{static{h(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),a=n.finalize(t);return new ce({ciphertext:a,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}};Q.cfg={blockSize:4,iv:new _([]),format:Le};var b=class extends je{static{h(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 h(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let i=0;i<64;i++)d[i]=Math.abs(Math.sin(i+1))*4294967296|0;var K=class f extends b{static{h(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,s,o,n,a){let c=e+(t&r|~t&s)+o+a;return(c<<n|c>>>32-n)+t}static GG(e,t,r,s,o,n,a){let c=e+(t&s|r&~s)+o+a;return(c<<n|c>>>32-n)+t}static HH(e,t,r,s,o,n,a){let c=e+(t^r^s)+o+a;return(c<<n|c>>>32-n)+t}static II(e,t,r,s,o,n,a){let c=e+(r^(t|~s))+o+a;return(c<<n|c>>>32-n)+t}reset(){super.reset(),this._hash=new _([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 c=0;c<16;c++){let p=t+c,m=e[p];e[p]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}let r=Array.from({length:16});for(let c=0;c<16;c++)r[c]=e[t+c];let s=this._hash.words[0],o=this._hash.words[1],n=this._hash.words[2],a=this._hash.words[3];s=f.FF(s,o,n,a,r[0],7,d[0]),a=f.FF(a,s,o,n,r[1],12,d[1]),n=f.FF(n,a,s,o,r[2],17,d[2]),o=f.FF(o,n,a,s,r[3],22,d[3]),s=f.FF(s,o,n,a,r[4],7,d[4]),a=f.FF(a,s,o,n,r[5],12,d[5]),n=f.FF(n,a,s,o,r[6],17,d[6]),o=f.FF(o,n,a,s,r[7],22,d[7]),s=f.FF(s,o,n,a,r[8],7,d[8]),a=f.FF(a,s,o,n,r[9],12,d[9]),n=f.FF(n,a,s,o,r[10],17,d[10]),o=f.FF(o,n,a,s,r[11],22,d[11]),s=f.FF(s,o,n,a,r[12],7,d[12]),a=f.FF(a,s,o,n,r[13],12,d[13]),n=f.FF(n,a,s,o,r[14],17,d[14]),o=f.FF(o,n,a,s,r[15],22,d[15]),s=f.GG(s,o,n,a,r[1],5,d[16]),a=f.GG(a,s,o,n,r[6],9,d[17]),n=f.GG(n,a,s,o,r[11],14,d[18]),o=f.GG(o,n,a,s,r[0],20,d[19]),s=f.GG(s,o,n,a,r[5],5,d[20]),a=f.GG(a,s,o,n,r[10],9,d[21]),n=f.GG(n,a,s,o,r[15],14,d[22]),o=f.GG(o,n,a,s,r[4],20,d[23]),s=f.GG(s,o,n,a,r[9],5,d[24]),a=f.GG(a,s,o,n,r[14],9,d[25]),n=f.GG(n,a,s,o,r[3],14,d[26]),o=f.GG(o,n,a,s,r[8],20,d[27]),s=f.GG(s,o,n,a,r[13],5,d[28]),a=f.GG(a,s,o,n,r[2],9,d[29]),n=f.GG(n,a,s,o,r[7],14,d[30]),o=f.GG(o,n,a,s,r[12],20,d[31]),s=f.HH(s,o,n,a,r[5],4,d[32]),a=f.HH(a,s,o,n,r[8],11,d[33]),n=f.HH(n,a,s,o,r[11],16,d[34]),o=f.HH(o,n,a,s,r[14],23,d[35]),s=f.HH(s,o,n,a,r[1],4,d[36]),a=f.HH(a,s,o,n,r[4],11,d[37]),n=f.HH(n,a,s,o,r[7],16,d[38]),o=f.HH(o,n,a,s,r[10],23,d[39]),s=f.HH(s,o,n,a,r[13],4,d[40]),a=f.HH(a,s,o,n,r[0],11,d[41]),n=f.HH(n,a,s,o,r[3],16,d[42]),o=f.HH(o,n,a,s,r[6],23,d[43]),s=f.HH(s,o,n,a,r[9],4,d[44]),a=f.HH(a,s,o,n,r[12],11,d[45]),n=f.HH(n,a,s,o,r[15],16,d[46]),o=f.HH(o,n,a,s,r[2],23,d[47]),s=f.II(s,o,n,a,r[0],6,d[48]),a=f.II(a,s,o,n,r[7],10,d[49]),n=f.II(n,a,s,o,r[14],15,d[50]),o=f.II(o,n,a,s,r[5],21,d[51]),s=f.II(s,o,n,a,r[12],6,d[52]),a=f.II(a,s,o,n,r[3],10,d[53]),n=f.II(n,a,s,o,r[10],15,d[54]),o=f.II(o,n,a,s,r[1],21,d[55]),s=f.II(s,o,n,a,r[8],6,d[56]),a=f.II(a,s,o,n,r[15],10,d[57]),n=f.II(n,a,s,o,r[6],15,d[58]),o=f.II(o,n,a,s,r[13],21,d[59]),s=f.II(s,o,n,a,r[4],6,d[60]),a=f.II(a,s,o,n,r[11],10,d[61]),n=f.II(n,a,s,o,r[2],15,d[62]),o=f.II(o,n,a,s,r[9],21,d[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]+a|0}};var gt=class Qt{static{h(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:K,iterations:1},e)}static execute(e,t,r){return new Qt(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new _,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 er=class{static{h(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=_.random(64/8));let o=new gt({keySize:t+r}).compute(e,s),n=new _(o.words.slice(t),r*4);return o.sigBytes=t*4,new ce({key:o,iv:n,salt:s})}};var ze=class{static{h(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),Q.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),Q.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};ze.cfg={blockSize:4,iv:new _([]),format:Le,kdf:er};var tr=class{static{h(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?ze.decrypt(this._cipher,e,t,r):Q.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?ze.encrypt(this._cipher,e,t,r):Q.encrypt(this._cipher,e,t,r)}};var le=class extends je{static{h(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 tr(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()}};le.ivSize=4;le.keySize=4;le._DEC_XFORM_MODE=2;le._ENC_XFORM_MODE=1;var ee=class{static{h(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var $e=class{static{h(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)}};$e.Decryptor=ee;$e.Encryptor=ee;var rr=class extends ee{static{h(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 sr=class extends ee{static{h(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 Z=class extends $e{static{h(this,"CBC")}};Z.Decryptor=sr;Z.Encryptor=rr;var de=class{static{h(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 c=0;c<s;c+=4)n.push(o);let a=new _(n,s);e.concat(a)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var Ke=class extends le{static{h(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:Z,padding:de},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 z{static{h(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 z(s,t)}and(e){return new z(this.high&e.high,this.low&e.low)}not(){return new z(~this.high,~this.low)}or(e){return new z(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 z(this.high<<e|this.low>>>32-e,this.low<<e):new z(this.low<<e-32,0)}shiftR(e){return e<32?new z(this.high>>>e,this.low>>>e|this.high<<32-e):new z(0,this.high>>>e-32)}xor(e){return new z(this.high^e.high,this.low^e.low)}};var ir=class mt{static{h(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new mt(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new mt(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new _(e,this.sigBytes)}};var B=[],or=[],nr=[],ar=[],hr=[],cr=[],_t=[],wt=[],yt=[],xt=[];(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,or[s]=e;let o=i[e],n=i[o],a=i[n],c=i[s]*257^s*16843008;nr[e]=c<<24|c>>>8,ar[e]=c<<16|c>>>16,hr[e]=c<<8|c>>>24,cr[e]=c,c=a*16843009^n*65537^o*257^e*16843008,_t[s]=c<<24|c>>>8,wt[s]=c<<16|c>>>16,yt[s]=c<<8|c>>>24,xt[s]=c,e?(e=o^i[i[i[a^o]]],t^=i[i[t]]):e=t=1}})();var fs=[0,1,2,4,8,16,32,64,128,27,54],We=class extends Ke{static{h(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,_t,wt,yt,xt,or),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,nr,ar,hr,cr,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 a=0;a<o;a++)if(a<r)n[a]=t[a];else{let c=n[a-1];a%r?r>6&&a%r===4&&(c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255]):(c=c<<8|c>>>24,c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255],c^=fs[a/r|0]<<24),n[a]=n[a-r]^c}this._invKeySchedule=[];for(let a=0;a<o;a++){let c=o-a,p;a%4?p=n[c]:p=n[c-4],a<4||c<=4?this._invKeySchedule[a]=p:this._invKeySchedule[a]=_t[B[p>>>24]]^wt[B[p>>>16&255]]^yt[B[p>>>8&255]]^xt[B[p&255]]}}_doCryptBlock(e,t,r,s,o,n,a,c){let p=e[t]^r[0],m=e[t+1]^r[1],g=e[t+2]^r[2],w=e[t+3]^r[3],A=4;for(let C=1;C<this._nRounds;C++){let y=s[p>>>24]^o[m>>>16&255]^n[g>>>8&255]^a[w&255]^r[A++],x=s[m>>>24]^o[g>>>16&255]^n[w>>>8&255]^a[p&255]^r[A++],U=s[g>>>24]^o[w>>>16&255]^n[p>>>8&255]^a[m&255]^r[A++],it=s[w>>>24]^o[p>>>16&255]^n[m>>>8&255]^a[g&255]^r[A++];p=y,m=x,g=U,w=it}let P=(c[p>>>24]<<24|c[m>>>16&255]<<16|c[g>>>8&255]<<8|c[w&255])^r[A++],j=(c[m>>>24]<<24|c[g>>>16&255]<<16|c[w>>>8&255]<<8|c[p&255])^r[A++],T=(c[g>>>24]<<24|c[w>>>16&255]<<16|c[p>>>8&255]<<8|c[m&255])^r[A++],k=(c[w>>>24]<<24|c[p>>>16&255]<<16|c[m>>>8&255]<<8|c[g&255])^r[A++];e[t]=P,e[t+1]=j,e[t+2]=T,e[t+3]=k}};We.keySize=256/32;var ps=[1732584193,4023233417,2562383102,271733878,3285377520],te=new Array(80),re=class extends b{static{h(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(ps.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],a=this._hash.words[4];for(let c=0;c<80;c++){if(c<16)te[c]=e[t+c]|0;else{let w=te[c-3]^te[c-8]^te[c-14]^te[c-16];te[c]=w<<1|w>>>31}let p,m;c<20?(p=s&o|~s&n,m=1518500249):c<40?(p=s^o^n,m=1859775393):c<60?(p=s&o|s&n|o&n,m=2400959708):(p=s^o^n,m=3395469782);let g=(r<<5|r>>>27)+p+a+m+te[c];a=n,n=o,o=s<<30|s>>>2,s=r,r=g|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]+a|0}};var lr=[],dr=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}h(i,"isPrime");function e(s){return(s-(s|0))*4294967296|0}h(e,"getFractionalBits");let t=2,r=0;for(;r<64;)i(t)&&(r<8&&(lr[r]=e(Math.pow(t,1/2))),dr[r]=e(Math.pow(t,1/3)),r++),t++})();var se=[],Ce=class extends b{static{h(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(lr.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],a=this._hash.words[4],c=this._hash.words[5],p=this._hash.words[6],m=this._hash.words[7];for(let g=0;g<64;g++){if(g<16)se[g]=e[t+g]|0;else{let C=se[g-15],y=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,x=se[g-2],U=(x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10;se[g]=y+se[g-7]+U+se[g-16]}let w=a&c^~a&p,A=r&s^r&o^s&o,P=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),j=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),T=m+j+w+dr[g]+se[g],k=P+A;m=p,p=c,c=a,a=n+T|0,n=o,o=s,s=r,r=T+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]+a|0,this._hash.words[5]=this._hash.words[5]+c|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+m|0}};var Et=[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 Rt=class extends b{static{h(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new ir([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,a=this._hash.words[2].high,c=this._hash.words[2].low,p=this._hash.words[3].high,m=this._hash.words[3].low,g=this._hash.words[4].high,w=this._hash.words[4].low,A=this._hash.words[5].high,P=this._hash.words[5].low,j=this._hash.words[6].high,T=this._hash.words[6].low,k=this._hash.words[7].high,C=this._hash.words[7].low;for(let y=0;y<80;y++){let x,U;if(y<16)U=M[y].high=e[t+y*2]|0,x=M[y].low=e[t+y*2+1]|0;else{let Ut=M[y-15],oe=Ut.high,_e=Ut.low,es=(oe>>>1|_e<<31)^(oe>>>8|_e<<24)^oe>>>7,Ft=(_e>>>1|oe<<31)^(_e>>>8|oe<<24)^(_e>>>7|oe<<25),Mt=M[y-2],ne=Mt.high,we=Mt.low,ts=(ne>>>19|we<<13)^(ne<<3|we>>>29)^ne>>>6,jt=(we>>>19|ne<<13)^(we<<3|ne>>>29)^(we>>>6|ne<<26);x=Ft+M[y-7].low,U=es+M[y-7].high+(x>>>0<Ft>>>0?1:0),x=x+jt,U=U+ts+(x>>>0<jt>>>0?1:0),x=x+M[y-16].low,U=U+M[y-16].high+(x>>>0<M[y-16].low>>>0?1:0),M[y].high=U,M[y].low=x}let it=g&A^~g&j,Nt=w&P^~w&T,Xr=r&o^r&a^o&a,Zr=s&n^s&c^n&c,Hr=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),Tt=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Jr=(g>>>14|w<<18)^(g>>>18|w<<14)^(g<<23|w>>>9),Yr=(w>>>14|g<<18)^(w>>>18|g<<14)^(w<<23|g>>>9),D=C+Yr,W=k+Jr+(D>>>0<C>>>0?1:0);D=D+Nt,W=W+it+(D>>>0<Nt>>>0?1:0),D=D+Et[y].low,W=W+Et[y].high+(D>>>0<Et[y].low>>>0?1:0),D=D+x,W=W+U+(D>>>0<x>>>0?1:0);let kt=Tt+Zr,Qr=Hr+Xr+(kt>>>0<Tt>>>0?1:0);k=j,C=T,j=A,T=P,A=g,P=w,w=m+D|0,g=p+W+(w>>>0<m>>>0?1:0)|0,p=a,m=c,a=o,c=n,o=r,n=s,s=D+kt|0,r=W+Qr+(s>>>0<D>>>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+c,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<c>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+m,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<m>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+w,this._hash.words[4].high=this._hash.words[4].high+g+(this._hash.words[4].low>>>0<w>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+P,this._hash.words[5].high=this._hash.words[5].high+A+(this._hash.words[5].low>>>0<P>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+T,this._hash.words[6].high=this._hash.words[6].high+j+(this._hash.words[6].low>>>0<T>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+C,this._hash.words[7].high=this._hash.words[7].high+k+(this._hash.words[7].low>>>0<C>>>0?1:0)}};var fr=class{static{h(this,"HMAC")}constructor(e,t){this._hasher=new e;let r=typeof t=="string"?I.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(),a=this._iKey=r.clone(),c=n.words,p=a.words;for(let m=0;m<s;m++)c[m]^=1549556828,p[m]^=909522486;n.sigBytes=a.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 At=class pr{static{h(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:Ce,iterations:25e4},e)}static execute(e,t,r){return new pr(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new fr(r.hasher,e),o=new _,n=new _([1]),a=o.words,c=n.words,p=r.keySize,m=r.iterations;for(;a.length<p;){let g=s.update(t).finalize(n);s.reset();let w=g.words,A=w.length,P=g;for(let j=1;j<m;j++){P=s.finalize(P),s.reset();let T=P.words;for(let k=0;k<A;k++)w[k]^=T[k]}o.concat(g),c[0]++}return o.sigBytes=p*4,o}};var Be=Ke._createHelper(We);var fe=b._createHelper(K);var pe=b._createHelper(re);var Ge=b._createHelper(Ce);var Se=b._createHelper(Rt);var ue=class{static{h(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?X.parse(this._initVector):void 0}_mode;_padding;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r,this._mode=Z,this._padding=de}decryptAES(e){return Be.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(e){return Be.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return At.execute(this._password,X.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:re})}};var Ve=class{static{h(this,"SmpCrypto")}static base64Decode(e){return I.stringify($.parse(e))}static base64Encode(e){return $.stringify(I.parse(e))}static md5(e){return fe(e).toString()}static sha1(e){return pe(e).toString()}static sha256(e){return Ge(e).toString()}static sha512(e){return Se(e).toString()}};var qe=class{static{h(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength;_seed;constructor(e){this._baseCode=e,this._crcLength=5,this._seed="changeme"}static check(e,t){if(new this(e).secureCode!==t)throw L.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",ct.BadRequest)}_encode(){let e=new K;return e.update(I.parse(this._seed+this._baseCode)),e.finalize().toString(X).substring(0,this._crcLength).toUpperCase()}};var ge=require("class-transformer"),Xe=require("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 ie=function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i}({});function us(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 a=i.length-1;a>=0;a--)(n=i[a])&&(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}h(us,"_ts_decorate");function ur(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(ur,"_ts_metadata");var Ze=class{static{h(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new ue("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;_hashStrategy;constructor(e="ACTIVATION",t,r,s){this.gc=e,this.op=t,this.ot=r,this._hashStrategies={[ie.MD5]:o=>fe(o),[ie.MD5_HMAC]:o=>{let n=new K;return n.update(I.parse(o)),n.finalize()},[ie.SHA1]:o=>pe(o),[ie.SHA1_HMAC]:o=>{let n=new re;return n.update(I.parse(o)),n.finalize()}},this._hashStrategy=this._hashStrategies[ie.MD5],this._dto=typeof s=="number"&&s>=0?Xe.DateTime.fromMillis(+`${s}000`.slice(0,13)):Xe.DateTime.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:Xe.DateTime.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.constructor._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,ge.plainToInstance)(this,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(0,ge.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};us([(0,ge.Expose)(),ur("design:type",Number),ur("design:paramtypes",[])],Ze.prototype,"ts",null);var gs=function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i}({});var ms=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function mr(i){return i.match(ms)}h(mr,"smpAsciiWords");var Rr="\\ud800-\\udfff",_s="\\u0300-\\u036f",ws="\\ufe20-\\ufe2f",ys="\\u20d0-\\u20ff",xs="\\u1ab0-\\u1aff",Es="\\u1dc0-\\u1dff",Rs=_s+ws+ys+xs+Es,Ar="\\u2700-\\u27bf",br="a-z\\xdf-\\xf6\\xf8-\\xff",As="\\xac\\xb1\\xd7\\xf7",bs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Os="\\u2000-\\u206f",Is=" \\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",Or="A-Z\\xc0-\\xd6\\xd8-\\xde",Cs="\\ufe0e\\ufe0f",Ir=As+bs+Os+Is,Cr="['\u2019]",_r=`[${Ir}]`,Bs=`[${Rs}]`,Br="\\d",vs=`[${Ar}]`,vr=`[${br}]`,Pr=`[^${Rr}${Ir+Br+Ar+br+Or}]`,Ps="\\ud83c[\\udffb-\\udfff]",Ds=`(?:${Bs}|${Ps})`,Ns=`[^${Rr}]`,Dr="(?:\\ud83c[\\udde6-\\uddff]){2}",Nr="[\\ud800-\\udbff][\\udc00-\\udfff]",me=`[${Or}]`,Ts="\\u200d",wr=`(?:${vr}|${Pr})`,ks=`(?:${me}|${Pr})`,yr=`(?:${Cr}(?:d|ll|m|re|s|t|ve))?`,xr=`(?:${Cr}(?:D|LL|M|RE|S|T|VE))?`,Tr=`${Ds}?`,kr=`[${Cs}]?`,Us=`(?:${Ts}(?:${[Ns,Dr,Nr].join("|")})${kr+Tr})*`,Fs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ms="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",js=kr+Tr+Us,Er=`(?:${[vs,Dr,Nr].join("|")})${js}`,Pe=class{static{h(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([`${me}?${vr}+${yr}(?=${[_r,me,"$"].join("|")})`,`${ks}+${xr}(?=${[_r,me+wr,"$"].join("|")})`,`${me}?${wr}+${yr}`,`${me}+${xr}`,Ms,Fs,`${Br}+`,Er].join("|"),"g");static RS_EMOJI=Er;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var bt=class i{static{h(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||"KikCommonUtils => val was not an array")}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||"KikCommonUtils => val was not boolean")}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||"KikCommonUtils => entity was not a function")}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||"KikCommonUtils => entity was empty")}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||"KikCommonUtils => val was not an object")}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||"KikCommonUtils => val was not a string")}static assertIsTruthy(e,t){if(!e)throw new Error(t||"KikCommonUtils => 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 c=0;c<e.length;c++)if(!i.isEqual(e[c],t[c]))return!1;return!0}h(r,"areArraysEqual");function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let c in e)if(Object.prototype.hasOwnProperty.call(e,c)&&!i.isEqual(e[c],t[c]))return!1;return!0}h(s,"areObjectsEqual");function o(){return e.toString()===t.toString()}h(o,"areFunctionsEqual");function n(){return e===t}h(n,"arePrimativesEqual");let a=this.getType(e);return a!==this.getType(t)?!1:a==="array"?r():a==="object"?s():a==="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 parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn("KikCommonUtils => 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=pt.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([a,c])=>`<input name="${a}" type="hidden" value="${c}" />`),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?(Pe.HAS_UNICODE_WORD(e)?Pe.unicodeWords(e):mr(e))||[]:e.match(t)||[]}};var Ot=class extends Error{static{h(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var It=require("ts-luxon");var Ct=class i{static{h(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return It.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`sid-xxxx-${+It.DateTime.now().ts}`,t=0){this.value=e,this.expiry=t,this._controlSuffix="$1"}static parse(e){return new i(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};Ie();var Bt=class{static{h(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 Gs="1.5.0";Object.defineProperties(module.exports,{SmpDynamoService:{get:h(()=>(Mr(),J(Fr)).SmpDynamoService,"get")},SmpFirebaseService:{get:h(()=>(Lr(),J(jr)).SmpFirebaseService,"get")},smpRxjsCatchOnly:{get:h(()=>(rt(),J(tt)).smpRxjsCatchOnly,"get")},smpRxjsThrowIfEmpty:{get:h(()=>(rt(),J(tt)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:h(()=>(rt(),J(tt)).smpRxjsThrowOnCondition,"get")},smpZodDateTime:{get:h(()=>(qr(),J(Vr)).smpZodDateTime,"get")}});0&&(module.exports={SMP_HEALTHZ,SmpAbstractCacheStrategy,SmpAbstractTtlCacheStrategy,SmpAesCrypt,SmpApiCommonUtils,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpNoop});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|