@tonysamperi/ts-mapi-core 1.6.0 → 1.7.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.
Files changed (105) hide show
  1. package/changelog.md +13 -1
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +17 -8
  5. package/dist/cjs/services/http/index.cjs +1 -1
  6. package/dist/cjs/services/http/index.cjs.map +1 -1
  7. package/dist/cjs/services/http/index.d.cts +3 -4
  8. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -1
  9. package/dist/cjs/services/http/smp-http.service.cjs +1 -1
  10. package/dist/cjs/services/http/smp-http.service.cjs.map +1 -1
  11. package/dist/cjs/services/http/smp-http.service.d.cts +6 -3
  12. package/dist/cjs/services/index.cjs +1 -1
  13. package/dist/cjs/services/index.cjs.map +1 -1
  14. package/dist/cjs/services/index.d.cts +3 -4
  15. package/dist/cjs/shared/api/index.cjs +1 -1
  16. package/dist/cjs/shared/api/index.cjs.map +1 -1
  17. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs +1 -1
  18. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs.map +1 -1
  19. package/dist/cjs/shared/giftcard/index.cjs +1 -1
  20. package/dist/cjs/shared/giftcard/index.cjs.map +1 -1
  21. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs +1 -1
  22. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +1 -1
  23. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.d.cts +1 -1
  24. package/dist/cjs/shared/marketing-cloud/index.d.cts +1 -1
  25. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs.map +1 -1
  26. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.cts +4 -4
  27. package/dist/cjs/shared/rxjs/index.cjs +1 -1
  28. package/dist/cjs/shared/rxjs/index.cjs.map +1 -1
  29. package/dist/cjs/shared/rxjs/index.d.cts +3 -0
  30. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map +1 -1
  31. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +1 -1
  32. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +1 -1
  33. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +3 -3
  34. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs +2 -0
  35. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.cjs.map +1 -0
  36. package/dist/cjs/shared/rxjs/smp-rxjs-queue.function.d.cts +23 -0
  37. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs +2 -0
  38. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.cjs.map +1 -0
  39. package/dist/cjs/shared/rxjs/smp-rxjs-sequence.function.d.cts +11 -0
  40. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs.map +1 -1
  41. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.d.cts +3 -3
  42. package/dist/cjs/shared/utils/cache/index.cjs +1 -1
  43. package/dist/cjs/shared/utils/cache/index.cjs.map +1 -1
  44. package/dist/cjs/shared/utils/cache/index.d.cts +2 -3
  45. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -1
  46. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
  47. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
  48. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +1 -1
  49. package/dist/cjs/shared/utils/index.cjs +1 -1
  50. package/dist/cjs/shared/utils/index.cjs.map +1 -1
  51. package/dist/cjs/shared/utils/index.d.cts +4 -3
  52. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs +2 -0
  53. package/dist/cjs/shared/utils/smp-apply-mixin.function.cjs.map +1 -0
  54. package/dist/cjs/shared/utils/smp-apply-mixin.function.d.cts +5 -0
  55. package/dist/cjs/shared/utils/smp-sid.class.cjs.map +1 -1
  56. package/dist/esm/chunk-3TSDCOVH.js +1 -0
  57. package/dist/esm/chunk-C3LKT6AF.js +1 -0
  58. package/dist/esm/chunk-ENM3HAPF.js +1 -0
  59. package/dist/esm/chunk-JXXO4LSO.js +1 -0
  60. package/dist/esm/chunk-NVYQBLR6.js +1 -0
  61. package/dist/esm/chunk-Z3K5PNSB.js +1 -0
  62. package/dist/esm/chunk-ZKODHJSY.js +1 -0
  63. package/dist/esm/index.d.ts +8 -5
  64. package/dist/esm/index.js +1 -1
  65. package/dist/esm/services/http/index.d.ts +3 -4
  66. package/dist/esm/services/http/index.js +1 -1
  67. package/dist/esm/services/http/smp-http.service.d.ts +6 -3
  68. package/dist/esm/services/http/smp-http.service.js +1 -1
  69. package/dist/esm/services/index.d.ts +3 -4
  70. package/dist/esm/services/index.js +1 -1
  71. package/dist/esm/shared/api/index.js +1 -1
  72. package/dist/esm/shared/api/smp-api-common-utils.class.js +1 -1
  73. package/dist/esm/shared/giftcard/index.js +1 -1
  74. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.d.ts +1 -1
  75. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.js +1 -1
  76. package/dist/esm/shared/marketing-cloud/index.d.ts +1 -1
  77. package/dist/esm/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.ts +4 -4
  78. package/dist/esm/shared/rxjs/index.d.ts +3 -0
  79. package/dist/esm/shared/rxjs/index.js +1 -1
  80. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.d.ts +3 -3
  81. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.js +1 -1
  82. package/dist/esm/shared/rxjs/smp-rxjs-queue.function.d.ts +23 -0
  83. package/dist/esm/shared/rxjs/smp-rxjs-queue.function.js +1 -0
  84. package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.d.ts +11 -0
  85. package/dist/esm/shared/rxjs/smp-rxjs-sequence.function.js +1 -0
  86. package/dist/esm/shared/rxjs/smp-rxjs-throw-on-condition.function.d.ts +3 -3
  87. package/dist/esm/shared/utils/cache/index.d.ts +2 -3
  88. package/dist/esm/shared/utils/cache/index.js +1 -1
  89. package/dist/esm/shared/utils/index.d.ts +4 -3
  90. package/dist/esm/shared/utils/index.js +1 -1
  91. package/dist/esm/shared/utils/smp-apply-mixin.function.d.ts +5 -0
  92. package/dist/esm/shared/utils/smp-apply-mixin.function.js +1 -0
  93. package/package.json +4 -1
  94. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs +0 -2
  95. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +0 -1
  96. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +0 -12
  97. package/dist/esm/chunk-3XWLMKWI.js +0 -1
  98. package/dist/esm/chunk-MD2DPFLF.js +0 -1
  99. package/dist/esm/chunk-T3P4NVTG.js +0 -0
  100. package/dist/esm/chunk-VPL2IMUA.js +0 -1
  101. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +0 -12
  102. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.js +0 -1
  103. /package/dist/esm/{chunk-6MJDU4CZ.js → chunk-DGUMFWCQ.js} +0 -0
  104. /package/dist/esm/{chunk-B3OEBKFG.js → chunk-PKEW426R.js} +0 -0
  105. /package/dist/esm/{chunk-FE4YONC4.js → chunk-SZM4WHQJ.js} +0 -0
package/changelog.md CHANGED
@@ -1,5 +1,17 @@
1
+ ## 1.7.0
2
+ * Added smpApplyMixin
3
+ * Added smpRxjsQueue + smpRxjsSequence
4
+ * Misc fixes on giftcard stuff
5
+
6
+ ## 1.6.2
7
+ * Fix imports
8
+ * Add check import-exports test
9
+
10
+ ## 1.6.1
11
+ * Fixed missing exports in cjs build
12
+
1
13
  ## 1.6.0
2
- * Make arg optional in KikErrorResponse.create, to create a generic error by simply calling KikErrorResponse.create()
14
+ * Make arg optional in SmpErrorResponse.create, to create a generic error by simply calling SmpErrorResponse.create()
3
15
  * Add rxjs implementations of cache
4
16
 
5
17
  ## 1.5.0
@@ -1,2 +1,2 @@
1
- "use strict";var cs=Object.create;var xe=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var ls=Object.getOwnPropertyNames;var ds=Object.getPrototypeOf,fs=Object.prototype.hasOwnProperty;var c=(i,e)=>xe(i,"name",{value:e,configurable:!0});var x=(i,e)=>()=>(i&&(e=i(i=0)),e);var Ee=(i,e)=>{for(var t in e)xe(i,t,{get:e[t],enumerable:!0})},Kt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ls(e))!fs.call(i,s)&&s!==t&&xe(i,s,{get:()=>e[s],enumerable:!(r=hs(e,s))||r.enumerable});return i};var ps=(i,e,t)=>(t=i!=null?cs(ds(i)):{},Kt(e||!i||!i.__esModule?xe(t,"default",{value:i,enumerable:!0}):t,i)),J=i=>Kt(xe({},"__esModule",{value:!0}),i);var Y,at=x(()=>{"use strict";Y=class{static{c(this,"SmpAbstractCacheStrategy")}}});function Re(i){return typeof i=="object"&&i!==null&&"value"in i&&"expiry"in i&&typeof i.expiry=="number"}var ct=x(()=>{"use strict";c(Re,"smpIsSmpCachedValue")});var qt,Xt=x(()=>{"use strict";qt=class{static{c(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:c(()=>null,"getItem"),setItem:c(()=>null,"setItem"),removeItem:c(()=>null,"removeItem"),clear:c(()=>null,"clear")}}}});var k,pt=x(()=>{"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"})(k||(k={}))});function O(){}var Ue=x(()=>{"use strict";c(O,"smpNoop")});var gs,V,ut=x(()=>{"use strict";Ue();gs=class{static{c(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},V=class Zt extends gs{static{c(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 Zt).map(e=>e)}}});var Ht,ke,Me,Jt=x(()=>{"use strict";Xt();pt();ut();Ue();ke="[DEFAULT]",Me=class extends V{static{c(this,"SmpLoggerService")}static get INSTANCE(){return this.get(ke)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(k).filter(e=>+e>k.OFF&&+e<=this.level).map(e=>k[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 qt,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=ke){return this._instances.get(e)||this._instances.get(ke)||this._noopInstance}static init(e,t=ke){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-${k[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=k.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>k.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=k.WARN){this.constructor.describe().forEach(t=>{this[t]=O}),this.constructor._level=e,console&&this._setup(console)}};Ht=Me;Me._instances=new Map;Me._level=k.OFF;Me._noopInstance=new Ht({level:k.OFF})});var Yt=x(()=>{"use strict"});var Qt=x(()=>{"use strict"});var er=x(()=>{"use strict";Yt();Qt();ut();pt();Ue()});var Ce=x(()=>{"use strict";Jt();er()});var q,tr=x(()=>{"use strict";q=function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i}({})});var he,rr=x(()=>{"use strict";he=function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i}({})});var Pe,yr=x(()=>{"use strict";Pe=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 zr={};Ee(zr,{SmpDynamoService:()=>Nt});var Lr,Ye,Je,Nt,$r=x(()=>{"use strict";Lr=require("@aws-sdk/client-dynamodb"),Ye=require("@aws-sdk/util-dynamodb");Ce();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||{}),Nt=class{static{c(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 Lr.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(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 Wr={};Ee(Wr,{SmpFirebaseService:()=>Tt});var Ne,u,Tt,Kr=x(()=>{"use strict";Ce();Ne=require("firebase/app"),u=require("firebase/auth");tr();rr();yr();Tt=class i{static{c(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,Ne.getApps)().length?(0,Ne.getApps)()[0]:(0,Ne.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===Pe.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=Pe["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:c(()=>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===Pe.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)})}}});var Sr,Ft,Qe,Gr=x(()=>{"use strict";Sr=require("rxjs"),Ft=require("ts-luxon");at();ct();Qe=class extends Y{static{c(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(e){return this._readRaw(e).pipe((0,Sr.map)(t=>{if(this._isSmpCachedValue(t)){if(t.expiry>=Ft.DateTime.now().ts)return t.value;this._removeRaw(e).subscribe();return}return t}))}remove(e){return this._removeRaw(e)}write(e,t,r){if(isNaN(+r)||+r<=0)return this._writeRaw(e,t,r);let s=Ft.DateTime.now().ts+r*1e3,o={value:t,expiry:s};return this._writeRaw(e,o,r)}_isSmpCachedValue(e){return Re(e)}}});function Vr(i,e){return t=>t.pipe((0,et.catchError)(r=>(typeof i==typeof isNaN?Gs(i)?Vs(r,i):i(r):!1)?e(r):(0,et.throwError)(()=>r)))}function Gs(i){try{return Reflect.construct(String,[],i),!0}catch{return!1}}function Vs(i,e){return typeof i=="object"&&i!==null&&i.constructor===e}var et,qr=x(()=>{"use strict";et=require("rxjs");c(Vr,"smpRxjsCatchOnly");c(Gs,"isConstructor");c(Vs,"isExactInstance")});function tt(i=Xs){return e=>e.pipe((0,Xr.map)(t=>{if(~qs.indexOf(JSON.stringify(t)))throw i(t);return t}))}var Xr,qs,Xs,Ut=x(()=>{"use strict";Xr=require("rxjs");c(tt,"smpRxjsThrowIfEmpty");qs=[void 0,null,!1,0,"","0",[],{}].map(i=>JSON.stringify(i)),Xs=c(()=>new Error,"defaultErrorFactory")});function Zr(i,e){return t=>t.pipe((0,rt.filter)(r=>!i(r)),(0,rt.defaultIfEmpty)(!1),tt(e))}var rt,Hr=x(()=>{"use strict";rt=require("rxjs");Ut();c(Zr,"smpRxjsThrowOnCondition")});var st={};Ee(st,{SmpAbstractRxjsTtlCacheStrategy:()=>Qe,smpRxjsCatchOnly:()=>Vr,smpRxjsThrowIfEmpty:()=>tt,smpRxjsThrowOnCondition:()=>Zr});var it=x(()=>{"use strict";Gr();qr();Ut();Hr()});var R,H,ot,Zs,Jr=x(()=>{"use strict";R=ps(require("zod"),1),H=require("ts-luxon"),ot=class i extends R.default.ZodType{static{c(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:c((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:c((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:c((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:c(()=>H.DateTime.fromJSDate(new Date(e)),"string"),number:c(()=>H.DateTime.fromMillis(e),"number"),object:c(()=>H.DateTime.fromJSDate(e),"object"),default:c(()=>null,"default")};return(t[typeof e]||t.default)()}},Zs=c((i={})=>new ot({coerce:i.coerce??!1,checks:[]}),"smpZodDateTime")});var Yr={};Ee(Yr,{SmpZodDateTime:()=>ot,smpZodDateTime:()=>Zs});var Qr=x(()=>{"use strict";Jr()});var Js={};Ee(Js,{SMP_HEALTHZ:()=>_s,SmpAbstractCacheStrategy:()=>Y,SmpAbstractTtlCacheStrategy:()=>Q,SmpAesCrypt:()=>me,SmpApiCommonUtils:()=>mt,SmpBrowserCache:()=>Ae,SmpCommonUtils:()=>Ct,SmpCrypto:()=>qe,SmpErrorResponse:()=>L,SmpFilterException:()=>Bt,SmpFirebaseErrors:()=>Pe,SmpGenericResponse:()=>ce,SmpGiftcardTransaction:()=>He,SmpGiftcardTransactionHashStrategies:()=>oe,SmpGiftcardTransactionOps:()=>v,SmpHttpService:()=>dt,SmpHttpSessionStorageCache:()=>be,SmpHttpStatusCodes:()=>ft,SmpInMemoryCache:()=>Oe,SmpMarketingCloudValidators:()=>Es,SmpRegularExpressions:()=>Dt,SmpResponseMessage:()=>U,SmpResponseMessageTypes:()=>S,SmpRestVerbs:()=>gt,SmpSecureCode:()=>Xe,SmpSid:()=>Pt,SmpSocialSignInKeys:()=>q,SmpSocialSignInUxModes:()=>he,VERSION:()=>Hs,smpIsSmpCachedValue:()=>Re,smpNoop:()=>O});module.exports=J(Js);var ht=require("ts-luxon");at();ct();var Q=class extends Y{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=ht.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,r);return}let s=ht.DateTime.now().ts+r*1e3,o={value:t,expiry:s};this._writeRaw(e,o,r)}_isSmpCachedValue(e){return Re(e)}};var Ae=class extends Q{static{c(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let r=this._storage.key(t);r&&r.startsWith(this._prefix)&&e.push(r)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,r)}}};var be=class extends Ae{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var Oe=class extends Q{static{c(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,t){this._staticSelf._storage.set(e,t)}};var Ie=require("class-transformer");var G=require("class-transformer");var lt=require("class-transformer");var S=function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i}({});function St(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}c(St,"_ts_decorate");function Te(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Te,"_ts_metadata");var U=class i{static{c(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=S.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)}};St([(0,lt.Expose)(),Te("design:type",String),Te("design:paramtypes",[])],U.prototype,"message",null);St([(0,lt.Expose)(),Te("design:type",typeof S>"u"?Object:S),Te("design:paramtypes",[])],U.prototype,"type",null);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}c(us,"_ts_decorate");function Gt(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Gt,"_ts_metadata");var ce=class i{static{c(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=U.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 U(r,S.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new U(r,S.SUCCESS)),t)}static fromPlain(e){return(0,G.plainToInstance)(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,G.instanceToPlain)(this,{excludePrefixes:["_"]})}};us([(0,G.Expose)(),(0,G.Transform)(({value:i})=>i?.length?i:void 0),Gt("design:type",Object),Gt("design:paramtypes",[])],ce.prototype,"messages",null);function Vt(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}c(Vt,"_ts_decorate");function Fe(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Fe,"_ts_metadata");var L=class i extends ce{static{c(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new U("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=i.DEFAULT_MESSAGES,t="GENERIC_ERROR",r=500,s){super(e,s),this._errorCode=t,this._status=r,this._timestamp=Date.now()}static create({messages:e=i.DEFAULT_MESSAGES,...t}={}){return new i(U.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=(0,Ie.plainToInstance)(ms,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Vt([(0,Ie.Expose)(),Fe("design:type",Object),Fe("design:paramtypes",[])],L.prototype,"errorCode",null);Vt([(0,Ie.Expose)(),Fe("design:type",Number),Fe("design:paramtypes",[])],L.prototype,"timestamp",null);var ms=class extends L{static{c(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var dt=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new be:new Oe;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 ft=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}({});Ce();var mt=class{static{c(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 _s={status:"OK"};var gt=function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i}({});var X=class{static{c(this,"Hex")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s+=2)r[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new _(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 _t{static{c(this,"WordArray")}constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],r=c(function(s){let o=987654321,n=4294967295;return function(){o=36969*(o&65535)+(o>>16)&n,s=18e3*(s&65535)+(s>>16)&n;let 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 _t(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 _t(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 je=class{static{c(this,"Latin1")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s++)r[s>>>2]|=(e.charCodeAt(s)&255)<<24-s%4*8;return new _(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{c(this,"Utf8")}static parse(e){return je.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(je.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var Le=class{static{c(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 le=class{static{c(this,"CipherParams")}constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var $=class{static{c(this,"Base64")}static parse(e){let t=e.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=e.indexOf(r);s!==-1&&(t=s)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let s=[],o=0;for(let n=0;n<t;n++)if(n%4){let a=r[e.charCodeAt(n-1)]<<n%4*2,h=r[e.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(a|h)<<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,h=o<<16|n<<8|a;for(let p=0;p<4&&s+p*.75<e.sigBytes;p++)t.push(this._map.charAt(h>>>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 ze=class{static{c(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 le({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 ee=class{static{c(this,"SerializableCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(!o.format)throw new Error("could not determine format");if(t=this._parse(t,o.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,o).finalize(t.ciphertext)}static encrypt(e,t,r,s){let o=Object.assign({},this.cfg,s),n=e.createEncryptor(r,o),a=n.finalize(t);return new le({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}};ee.cfg={blockSize:4,iv:new _([]),format:ze};var b=class extends Le{static{c(this,"Hasher")}constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,s){return new e(s).finalize(r)}return c(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let i=0;i<64;i++)d[i]=Math.abs(Math.sin(i+1))*4294967296|0;var W=class f extends b{static{c(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,s,o,n,a){let h=e+(t&r|~t&s)+o+a;return(h<<n|h>>>32-n)+t}static GG(e,t,r,s,o,n,a){let h=e+(t&s|r&~s)+o+a;return(h<<n|h>>>32-n)+t}static HH(e,t,r,s,o,n,a){let h=e+(t^r^s)+o+a;return(h<<n|h>>>32-n)+t}static II(e,t,r,s,o,n,a){let h=e+(r^(t|~s))+o+a;return(h<<n|h>>>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 h=0;h<16;h++){let p=t+h,g=e[p];e[p]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}let r=Array.from({length:16});for(let h=0;h<16;h++)r[h]=e[t+h];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 wt=class sr{static{c(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:W,iterations:1},e)}static execute(e,t,r){return new sr(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 ir=class{static{c(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=_.random(64/8));let o=new wt({keySize:t+r}).compute(e,s),n=new _(o.words.slice(t),r*4);return o.sigBytes=t*4,new le({key:o,iv:n,salt:s})}};var $e=class{static{c(this,"PasswordBasedCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(o.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let n=o.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv!==void 0&&(o.iv=n.iv),ee.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),ee.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};$e.cfg={blockSize:4,iv:new _([]),format:ze,kdf:ir};var or=class{static{c(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?$e.decrypt(this._cipher,e,t,r):ee.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?$e.encrypt(this._cipher,e,t,r):ee.encrypt(this._cipher,e,t,r)}};var de=class extends Le{static{c(this,"Cipher")}constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new or(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()}};de.ivSize=4;de.keySize=4;de._DEC_XFORM_MODE=2;de._ENC_XFORM_MODE=1;var te=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var We=class{static{c(this,"BlockCipherMode")}static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};We.Decryptor=te;We.Encryptor=te;var nr=class extends te{static{c(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var ar=class extends te{static{c(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var Z=class extends We{static{c(this,"CBC")}};Z.Decryptor=ar;Z.Encryptor=nr;var fe=class{static{c(this,"PKCS7")}static pad(e,t){let r=t*4,s=r-e.sigBytes%r,o=s<<24|s<<16|s<<8|s,n=[];for(let h=0;h<s;h+=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 de{static{c(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:Z,padding:fe},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{c(this,"X64Word")}constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,s=this.high+e.high+r|0;return new 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 cr=class yt{static{c(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new yt(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new yt(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=[],hr=[],lr=[],dr=[],fr=[],pr=[],xt=[],Et=[],Rt=[],At=[];(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,hr[s]=e;let o=i[e],n=i[o],a=i[n],h=i[s]*257^s*16843008;lr[e]=h<<24|h>>>8,dr[e]=h<<16|h>>>16,fr[e]=h<<8|h>>>24,pr[e]=h,h=a*16843009^n*65537^o*257^e*16843008,xt[s]=h<<24|h>>>8,Et[s]=h<<16|h>>>16,Rt[s]=h<<8|h>>>24,At[s]=h,e?(e=o^i[i[i[a^o]]],t^=i[i[t]]):e=t=1}})();var ws=[0,1,2,4,8,16,32,64,128,27,54],Se=class extends Ke{static{c(this,"AES")}constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,xt,Et,Rt,At,hr),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,lr,dr,fr,pr,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 h=n[a-1];a%r?r>6&&a%r===4&&(h=B[h>>>24]<<24|B[h>>>16&255]<<16|B[h>>>8&255]<<8|B[h&255]):(h=h<<8|h>>>24,h=B[h>>>24]<<24|B[h>>>16&255]<<16|B[h>>>8&255]<<8|B[h&255],h^=ws[a/r|0]<<24),n[a]=n[a-r]^h}this._invKeySchedule=[];for(let a=0;a<o;a++){let h=o-a,p;a%4?p=n[h]:p=n[h-4],a<4||h<=4?this._invKeySchedule[a]=p:this._invKeySchedule[a]=xt[B[p>>>24]]^Et[B[p>>>16&255]]^Rt[B[p>>>8&255]]^At[B[p&255]]}}_doCryptBlock(e,t,r,s,o,n,a,h){let p=e[t]^r[0],g=e[t+1]^r[1],m=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[g>>>16&255]^n[m>>>8&255]^a[w&255]^r[A++],E=s[g>>>24]^o[m>>>16&255]^n[w>>>8&255]^a[p&255]^r[A++],F=s[m>>>24]^o[w>>>16&255]^n[p>>>8&255]^a[g&255]^r[A++],nt=s[w>>>24]^o[p>>>16&255]^n[g>>>8&255]^a[m&255]^r[A++];p=y,g=E,m=F,w=nt}let P=(h[p>>>24]<<24|h[g>>>16&255]<<16|h[m>>>8&255]<<8|h[w&255])^r[A++],j=(h[g>>>24]<<24|h[m>>>16&255]<<16|h[w>>>8&255]<<8|h[p&255])^r[A++],N=(h[m>>>24]<<24|h[w>>>16&255]<<16|h[p>>>8&255]<<8|h[g&255])^r[A++],T=(h[w>>>24]<<24|h[p>>>16&255]<<16|h[g>>>8&255]<<8|h[m&255])^r[A++];e[t]=P,e[t+1]=j,e[t+2]=N,e[t+3]=T}};Se.keySize=256/32;var ys=[1732584193,4023233417,2562383102,271733878,3285377520],re=new Array(80),se=class extends b{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(ys.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 h=0;h<80;h++){if(h<16)re[h]=e[t+h]|0;else{let w=re[h-3]^re[h-8]^re[h-14]^re[h-16];re[h]=w<<1|w>>>31}let p,g;h<20?(p=s&o|~s&n,g=1518500249):h<40?(p=s^o^n,g=1859775393):h<60?(p=s&o|s&n|o&n,g=2400959708):(p=s^o^n,g=3395469782);let m=(r<<5|r>>>27)+p+a+g+re[h];a=n,n=o,o=s<<30|s>>>2,s=r,r=m|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 ur=[],mr=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}c(i,"isPrime");function e(s){return(s-(s|0))*4294967296|0}c(e,"getFractionalBits");let t=2,r=0;for(;r<64;)i(t)&&(r<8&&(ur[r]=e(Math.pow(t,1/2))),mr[r]=e(Math.pow(t,1/3)),r++),t++})();var ie=[],Be=class extends b{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(ur.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],h=this._hash.words[5],p=this._hash.words[6],g=this._hash.words[7];for(let m=0;m<64;m++){if(m<16)ie[m]=e[t+m]|0;else{let C=ie[m-15],y=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,E=ie[m-2],F=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;ie[m]=y+ie[m-7]+F+ie[m-16]}let w=a&h^~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),N=g+j+w+mr[m]+ie[m],T=P+A;g=p,p=h,h=a,a=n+N|0,n=o,o=s,s=r,r=N+T|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]+h|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+g|0}};var bt=[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 Ot=class extends b{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new cr([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,h=this._hash.words[2].low,p=this._hash.words[3].high,g=this._hash.words[3].low,m=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,N=this._hash.words[6].low,T=this._hash.words[7].high,C=this._hash.words[7].low;for(let y=0;y<80;y++){let E,F;if(y<16)F=M[y].high=e[t+y*2]|0,E=M[y].low=e[t+y*2+1]|0;else{let Lt=M[y-15],ne=Lt.high,we=Lt.low,ns=(ne>>>1|we<<31)^(ne>>>8|we<<24)^ne>>>7,zt=(we>>>1|ne<<31)^(we>>>8|ne<<24)^(we>>>7|ne<<25),$t=M[y-2],ae=$t.high,ye=$t.low,as=(ae>>>19|ye<<13)^(ae<<3|ye>>>29)^ae>>>6,Wt=(ye>>>19|ae<<13)^(ye<<3|ae>>>29)^(ye>>>6|ae<<26);E=zt+M[y-7].low,F=ns+M[y-7].high+(E>>>0<zt>>>0?1:0),E=E+Wt,F=F+as+(E>>>0<Wt>>>0?1:0),E=E+M[y-16].low,F=F+M[y-16].high+(E>>>0<M[y-16].low>>>0?1:0),M[y].high=F,M[y].low=E}let nt=m&A^~m&j,kt=w&P^~w&N,es=r&o^r&a^o&a,ts=s&n^s&h^n&h,rs=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),Mt=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),ss=(m>>>14|w<<18)^(m>>>18|w<<14)^(m<<23|w>>>9),is=(w>>>14|m<<18)^(w>>>18|m<<14)^(w<<23|m>>>9),D=C+is,K=T+ss+(D>>>0<C>>>0?1:0);D=D+kt,K=K+nt+(D>>>0<kt>>>0?1:0),D=D+bt[y].low,K=K+bt[y].high+(D>>>0<bt[y].low>>>0?1:0),D=D+E,K=K+F+(D>>>0<E>>>0?1:0);let jt=Mt+ts,os=rs+es+(jt>>>0<Mt>>>0?1:0);T=j,C=N,j=A,N=P,A=m,P=w,w=g+D|0,m=p+K+(w>>>0<g>>>0?1:0)|0,p=a,g=h,a=o,h=n,o=r,n=s,s=D+jt|0,r=K+os+(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+h,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<h>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+g,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<g>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+w,this._hash.words[4].high=this._hash.words[4].high+m+(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+N,this._hash.words[6].high=this._hash.words[6].high+j+(this._hash.words[6].low>>>0<N>>>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+T+(this._hash.words[7].low>>>0<C>>>0?1:0)}};var gr=class{static{c(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(),h=n.words,p=a.words;for(let g=0;g<s;g++)h[g]^=1549556828,p[g]^=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 It=class _r{static{c(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:Be,iterations:25e4},e)}static execute(e,t,r){return new _r(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new gr(r.hasher,e),o=new _,n=new _([1]),a=o.words,h=n.words,p=r.keySize,g=r.iterations;for(;a.length<p;){let m=s.update(t).finalize(n);s.reset();let w=m.words,A=w.length,P=m;for(let j=1;j<g;j++){P=s.finalize(P),s.reset();let N=P.words;for(let T=0;T<A;T++)w[T]^=N[T]}o.concat(m),h[0]++}return o.sigBytes=p*4,o}};var ve=Ke._createHelper(Se);var pe=b._createHelper(W);var ue=b._createHelper(se);var Ge=b._createHelper(Be);var Ve=b._createHelper(Ot);var me=class{static{c(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=fe}decryptAES(e){return ve.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(e){return ve.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return It.execute(this._password,X.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:se})}};var qe=class{static{c(this,"SmpCrypto")}static base64Decode(e){return I.stringify($.parse(e))}static base64Encode(e){return $.stringify(I.parse(e))}static md5(e){return pe(e).toString()}static sha1(e){return ue(e).toString()}static sha256(e){return Ge(e).toString()}static sha512(e){return Ve(e).toString()}};var Xe=class{static{c(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.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:ft.BadRequest})}_encode(){let e=new W;return e.update(I.parse(this._seed+this._baseCode)),e.finalize().toString(X).substring(0,this._crcLength).toUpperCase()}};var ge=require("class-transformer"),Ze=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 oe=function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i}({});function xs(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}c(xs,"_ts_decorate");function wr(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(wr,"_ts_metadata");var He=class{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new me("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={[oe.MD5]:o=>pe(o),[oe.MD5_HMAC]:o=>{let n=new W;return n.update(I.parse(o)),n.finalize()},[oe.SHA1]:o=>ue(o),[oe.SHA1_HMAC]:o=>{let n=new se;return n.update(I.parse(o)),n.finalize()}},this._hashStrategy=this._hashStrategies[oe.MD5],this._dto=typeof s=="number"&&s>=0?Ze.DateTime.fromMillis(+`${s}000`.slice(0,13)):Ze.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:Ze.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)}};xs([(0,ge.Expose)(),wr("design:type",Number),wr("design:paramtypes",[])],He.prototype,"ts",null);var Es=function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i}({});var Rs=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function xr(i){return i.match(Rs)}c(xr,"smpAsciiWords");var Ir="\\ud800-\\udfff",As="\\u0300-\\u036f",bs="\\ufe20-\\ufe2f",Os="\\u20d0-\\u20ff",Is="\\u1ab0-\\u1aff",Cs="\\u1dc0-\\u1dff",Bs=As+bs+Os+Is+Cs,Cr="\\u2700-\\u27bf",Br="a-z\\xdf-\\xf6\\xf8-\\xff",vs="\\xac\\xb1\\xd7\\xf7",Ps="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ds="\\u2000-\\u206f",Ns=" \\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",vr="A-Z\\xc0-\\xd6\\xd8-\\xde",Ts="\\ufe0e\\ufe0f",Pr=vs+Ps+Ds+Ns,Dr="['\u2019]",Er=`[${Pr}]`,Fs=`[${Bs}]`,Nr="\\d",Us=`[${Cr}]`,Tr=`[${Br}]`,Fr=`[^${Ir}${Pr+Nr+Cr+Br+vr}]`,ks="\\ud83c[\\udffb-\\udfff]",Ms=`(?:${Fs}|${ks})`,js=`[^${Ir}]`,Ur="(?:\\ud83c[\\udde6-\\uddff]){2}",kr="[\\ud800-\\udbff][\\udc00-\\udfff]",_e=`[${vr}]`,Ls="\\u200d",Rr=`(?:${Tr}|${Fr})`,zs=`(?:${_e}|${Fr})`,Ar=`(?:${Dr}(?:d|ll|m|re|s|t|ve))?`,br=`(?:${Dr}(?:D|LL|M|RE|S|T|VE))?`,Mr=`${Ms}?`,jr=`[${Ts}]?`,$s=`(?:${Ls}(?:${[js,Ur,kr].join("|")})${jr+Mr})*`,Ws="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ks="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ss=jr+Mr+$s,Or=`(?:${[Us,Ur,kr].join("|")})${Ss}`,De=class{static{c(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${_e}?${Tr}+${Ar}(?=${[Er,_e,"$"].join("|")})`,`${zs}+${br}(?=${[Er,_e+Rr,"$"].join("|")})`,`${_e}?${Rr}+${Ar}`,`${_e}+${br}`,Ks,Ws,`${Nr}+`,Or].join("|"),"g");static RS_EMOJI=Or;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var Ct=class i{static{c(this,"SmpCommonUtils")}static arrayRemove(e,t){let r=[],s=e.filter((o,n)=>t(o,n)&&r.push(n));return r.reverse().forEach(o=>e.splice(o,1)),s}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||`${this.constructor.name} => entity was empty`)}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||`${this.constructor.name} => val was not an object`)}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(e,t){if(!e)throw new Error(t||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.setAttribute("download",t),document.body.appendChild(s),s.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let s=0;s<e;s++){let o=Math.floor(Math.random()*t.length);r+=t[o]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}static getDecimalPrecision(e){if(this.assertIsNumeric(e),!isFinite(+e))return 0;let t=1,r=0;for(;Math.round(+e*t)/t!==e;)t*=10,r++;return r}static getType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}static isBoolean(e){return typeof e=="boolean"}static isColor(e){if(!e||!this.isString(e))return!1;let t=new Option().style;return t.color=e,t.color!==""}static isEmpty(e){return!e&&e!==0}static isEqual(e,t){function r(){if(e.length!==t.length)return!1;for(let h=0;h<e.length;h++)if(!i.isEqual(e[h],t[h]))return!1;return!0}c(r,"areArraysEqual");function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let h in e)if(Object.prototype.hasOwnProperty.call(e,h)&&!i.isEqual(e[h],t[h]))return!1;return!0}c(s,"areObjectsEqual");function o(){return e.toString()===t.toString()}c(o,"areFunctionsEqual");function n(){return e===t}c(n,"arePrimativesEqual");let 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 omit(e,t){return Object.keys(e).filter(s=>!t.includes(s)).reduce((s,o)=>(s[o]=e[o],s),{})}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:e,error:t});return}}static pick(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}static runSafely(e,t=null,r=[]){if(this.isFunction(e))return e.apply(t,r)}static sleep(e){return new Promise(t=>setTimeout(t,e))}static sprintf(e,...t){return this.isString(e)&&t.length?this.sprintf(e.replace("%s",String(t.shift())),...t):e}static stripComments(e){return typeof e=="string"?e.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):e}static submitFakeForm({action:e,method:t=gt.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([a,h])=>`<input name="${a}" type="hidden" value="${h}" />`),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?(De.HAS_UNICODE_WORD(e)?De.unicodeWords(e):xr(e))||[]:e.match(t)||[]}};var Bt=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var vt=require("ts-luxon");var Pt=class i{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return vt.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`sid-xxxx-${+vt.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}}};Ce();var Dt=class{static{c(this,"SmpRegularExpressions")}static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static _country=/[a-zA-Z]{2}/;static _language=/[a-z]{2}/};var Hs="1.6.0";Object.defineProperties(module.exports,{SmpDynamoService:{get:c(()=>($r(),J(zr)).SmpDynamoService,"get")},SmpFirebaseService:{get:c(()=>(Kr(),J(Wr)).SmpFirebaseService,"get")},smpRxjsCatchOnly:{get:c(()=>(it(),J(st)).smpRxjsCatchOnly,"get")},smpRxjsThrowIfEmpty:{get:c(()=>(it(),J(st)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:c(()=>(it(),J(st)).smpRxjsThrowOnCondition,"get")},smpZodDateTime:{get:c(()=>(Qr(),J(Yr)).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,smpIsSmpCachedValue,smpNoop});
1
+ "use strict";var ws=Object.create;var Ie=Object.defineProperty;var ys=Object.getOwnPropertyDescriptor;var xs=Object.getOwnPropertyNames;var Es=Object.getPrototypeOf,Rs=Object.prototype.hasOwnProperty;var c=(s,e)=>Ie(s,"name",{value:e,configurable:!0});var y=(s,e)=>()=>(s&&(e=s(s=0)),e);var Be=(s,e)=>{for(var t in e)Ie(s,t,{get:e[t],enumerable:!0})},Ht=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xs(e))!Rs.call(s,o)&&o!==t&&Ie(s,o,{get:()=>e[o],enumerable:!(r=ys(e,o))||r.enumerable});return s};var As=(s,e,t)=>(t=s!=null?ws(Es(s)):{},Ht(e||!s||!s.__esModule?Ie(t,"default",{value:s,enumerable:!0}):t,s)),F=s=>Ht(Ie({},"__esModule",{value:!0}),s);var re,pt=y(()=>{"use strict";re=class{static{c(this,"SmpAbstractCacheStrategy")}}});function ve(s){return typeof s=="object"&&s!==null&&"value"in s&&"expiry"in s&&typeof s.expiry=="number"}var ft=y(()=>{"use strict";c(ve,"smpIsSmpCachedValue")});var er,tr=y(()=>{"use strict";er=class{static{c(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:c(()=>null,"getItem"),setItem:c(()=>null,"setItem"),removeItem:c(()=>null,"removeItem"),clear:c(()=>null,"clear")}}}});var k,_t=y(()=>{"use strict";(function(s){s[s.OFF=0]="OFF",s[s.ERROR=1]="ERROR",s[s.WARN=2]="WARN",s[s.INFO=3]="INFO",s[s.LOG=4]="LOG",s[s.DEBUG=5]="DEBUG"})(k||(k={}))});function O(){}var $e=y(()=>{"use strict";c(O,"smpNoop")});var Is,X,wt=y(()=>{"use strict";$e();Is=class{static{c(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},X=class rr extends Is{static{c(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 rr).map(e=>e)}}});var sr,Se,We,or=y(()=>{"use strict";tr();_t();wt();$e();Se="[DEFAULT]",We=class extends X{static{c(this,"SmpLoggerService")}static get INSTANCE(){return this.get(Se)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(k).filter(e=>+e>k.OFF&&+e<=this.level).map(e=>k[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 er,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=Se){return this._instances.get(e)||this._instances.get(Se)||this._noopInstance}static init(e,t=Se){let r;if(this._instances.has(t)){r=this.get(t);let o=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},o),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 o=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||o===null||o===void 0){t[r]=o;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(o)}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(o=>({tags:[this._appName,`level-${k[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(o)}))]}_loadConfig({sensitiveProps:e=[],level:t=k.OFF,enablePreprocessing:r=!1,enableSessionId:o=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=o?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 o=`${r}`.toLowerCase();typeof e[o]==typeof isNaN&&(this[o]=function(...i){e[o].apply(e,t.apply(null,[o,...i]))})}),this.level>k.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=k.WARN){this.constructor.describe().forEach(t=>{this[t]=O}),this.constructor._level=e,console&&this._setup(console)}};sr=We;We._instances=new Map;We._level=k.OFF;We._noopInstance=new sr({level:k.OFF})});var ir=y(()=>{"use strict"});var nr=y(()=>{"use strict"});var ar=y(()=>{"use strict";ir();nr();wt();_t();$e()});var Te=y(()=>{"use strict";or();ar()});var H,cr=y(()=>{"use strict";H=function(s){return s.APPLE="APPLE",s.FACEBOOK="FACEBOOK",s.GOOGLE="GOOGLE",s}({})});var fe,hr=y(()=>{"use strict";fe=function(s){return s.POPUP="POPUP",s.REDIRECT="REDIRECT",s}({})});var Ue,Ir=y(()=>{"use strict";Ue=function(s){return s.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",s.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",s.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",s.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",s.EMAIL_EXISTS="auth/email-already-exists",s.INVALID_ACTION_CODE="auth/invalid-action-code",s.POPUP_BLOCKED="auth/popup-blocked",s.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",s.USER_NOT_FOUND="auth/user-not-found",s.WRONG_PASSWORD="auth/wrong-password",s}({})});var qr={};Be(qr,{SmpDynamoService:()=>Ut});var Vr,ot,st,Ut,Zr=y(()=>{"use strict";Vr=require("@aws-sdk/client-dynamodb"),ot=require("@aws-sdk/util-dynamodb");Te();st=function(s){return s.CouldNotDelete="ERR_COULD_NOT_DELETE",s.CouldNotRead="ERR_COULD_NOT_READ",s.CouldNotWrite="ERR_COULD_NOT_WRITE",s.ConditionalCheckFailedException="ERR_DUPE_TOKEN",s}(st||{}),Ut=class{static{c(this,"SmpDynamoService")}_config;_tableName;get marshall(){return ot.marshall}get unmarshall(){return ot.unmarshall}_db;_logger;constructor(e,t){this._config=e,this._tableName=t,this._db=new Vr.DynamoDB([this._buildConfig()]),this._logger=new X}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let o={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(o).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(st[i.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let o={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(o).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(st[i.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let o={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(o).catch(i=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",i),Promise.reject(st[i.code]||"ERR_COULD_NOT_WRITE")))}}});var Xr={};Be(Xr,{SmpFirebaseService:()=>kt});var Me,u,kt,Hr=y(()=>{"use strict";Te();Me=require("firebase/app"),u=require("firebase/auth");cr();hr();Ir();kt=class s{static{c(this,"SmpFirebaseService")}static get INSTANCE(){if(!(this._instance instanceof s))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":H.FACEBOOK,"google.com":H.GOOGLE,"apple.com":H.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=fe.POPUP;constructor(e,t){this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||fe.POPUP,this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new X,this._app=(0,Me.getApps)().length?(0,Me.getApps)()[0]:(0,Me.initializeApp)(e),this._watchAuthState()}static init(e,t){return this._instance||(this._instance=new s(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),{[H.APPLE]:new u.OAuthProvider("apple.com"),[H.FACEBOOK]:new u.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),[H.GOOGLE]:new u.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code===Ue.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=Ue["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:c(()=>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===fe.POPUP?u.signInWithPopup:u.signInWithRedirect)(this._auth,e).then(o=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),o.user)).catch(async o=>o?.code===Ue.POPUP_BLOCKED&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,fe.REDIRECT)):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,o),await this._expandDifferentCredential(o),Promise.reject(o)))}_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 Jr,Mt,Re,Lt=y(()=>{"use strict";Jr=require("rxjs"),Mt=require("ts-luxon");pt();ft();Re=class extends re{static{c(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(e){return this._readRaw(e).pipe((0,Jr.map)(t=>{if(this._isSmpCachedValue(t)){if(t.expiry>=Mt.DateTime.now().ts)return t.value;this._removeRaw(e).subscribe();return}return t}))}remove(e){return this._removeRaw(e)}write(e,t,r){if(isNaN(+r)||+r<=0)return this._writeRaw(e,t,r);let o=Mt.DateTime.now().ts+r*1e3,i={value:t,expiry:o};return this._writeRaw(e,i,r)}_isSmpCachedValue(e){return ve(e)}}});function Qr(s,e){return t=>t.pipe((0,it.catchError)(r=>(typeof s==typeof isNaN?ro(s)?so(r,s):s(r):!1)?e(r):(0,it.throwError)(()=>r)))}function ro(s){try{return Reflect.construct(String,[],s),!0}catch{return!1}}function so(s,e){return typeof s=="object"&&s!==null&&s.constructor===e}var it,Yr=y(()=>{"use strict";it=require("rxjs");c(Qr,"smpRxjsCatchOnly");c(ro,"isConstructor");c(so,"isExactInstance")});var S,nt,es=y(()=>{"use strict";S=require("rxjs");Lt();nt=class extends Re{static{c(this,"SmpRxjsInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){return(0,S.defer)(()=>(this._staticSelf._storage.clear(),(0,S.of)(void 0)))}_readRaw(e){return(0,S.defer)(()=>(0,S.of)(this._staticSelf._storage.get(e)))}_removeRaw(e){return(0,S.defer)(()=>(this._staticSelf._storage.delete(e),(0,S.of)(void 0)))}_writeRaw(e,t){return(0,S.defer)(()=>(this._staticSelf._storage.set(e,t),(0,S.of)(void 0)))}}});function ts(s){let e=[],t=c(r=>r>=s.length?(0,G.of)(e):(0,G.defer)(()=>s[r]()).pipe((0,G.switchMap)(o=>(e.push(o),t(r+1)))),"runStep");return t(0)}function rs(s){return Array.isArray(s)?ts(s).pipe((0,G.map)(e=>e)):ts(Object.values(s)).pipe((0,G.map)(e=>Object.keys(s).reduce((t,r,o)=>(t[r]=e[o],t),{})))}var G,ss=y(()=>{"use strict";G=require("rxjs");c(ts,"smpRxjsSequence");c(rs,"smpRxjsQueue")});function os(s){return(0,Ae.from)(s).pipe((0,Ae.concatMap)(e=>e()),(0,Ae.toArray)())}var Ae,is=y(()=>{"use strict";Ae=require("rxjs");c(os,"smpRxjsSequence")});function at(s=io){return e=>e.pipe((0,ns.map)(t=>{if(~oo.indexOf(JSON.stringify(t)))throw s(t);return t}))}var ns,oo,io,zt=y(()=>{"use strict";ns=require("rxjs");c(at,"smpRxjsThrowIfEmpty");oo=[void 0,null,!1,0,"","0",[],{}].map(s=>JSON.stringify(s)),io=c(()=>new Error,"defaultErrorFactory")});function as(s,e){return t=>t.pipe((0,ct.filter)(r=>!s(r)),(0,ct.defaultIfEmpty)(!1),at(e))}var ct,cs=y(()=>{"use strict";ct=require("rxjs");zt();c(as,"smpRxjsThrowOnCondition")});var Y={};Be(Y,{SmpAbstractRxjsTtlCacheStrategy:()=>Re,SmpRxjsInMemoryCache:()=>nt,smpRxjsCatchOnly:()=>Qr,smpRxjsQueue:()=>rs,smpRxjsSequence:()=>os,smpRxjsThrowIfEmpty:()=>at,smpRxjsThrowOnCondition:()=>as});var ee=y(()=>{"use strict";Lt();Yr();es();ss();is();zt();cs()});var R,te,ht,no,hs=y(()=>{"use strict";R=As(require("zod"),1),te=require("ts-luxon"),ht=class s extends R.default.ZodType{static{c(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 te.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 te.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 o={min:c((i,n,a)=>{if(i.min&&n<i.min)return{code:R.ZodIssueCode.too_small,minimum:i.min.toMillis(),type:"date",inclusive:!0,message:i.message??`Date must be \u2265 ${i.min.toISODate()}`,path:a.path}},"min"),max:c((i,n,a)=>{if(i.max&&n>i.max)return{code:R.ZodIssueCode.too_big,maximum:i.max.toMillis(),type:"date",inclusive:!0,message:i.message??`Date must be \u2264 ${i.max.toISODate()}`,path:a.path}},"max"),between:c((i,n,a)=>{if(i.min&&i.max&&(n<i.min||n>i.max))return{code:R.ZodIssueCode.custom,message:i.message??`Date must be between ${i.min.toISODate()} and ${i.max.toISODate()}`,path:a.path}},"between")};for(let i of this._def.checks)if(r instanceof te.DateTime&&r.isValid){let n=o[i.kind](i,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 s({...this._def,checks:[...this._def.checks,{kind:"between",min:e.toUTC(),max:t.toUTC(),message:r}]})}coerce(){return new s({...this._def,coerce:!0})}max(e,t){return new s({...this._def,checks:[...this._def.checks,{kind:"max",max:e.toUTC(),message:t}]})}min(e,t){return new s({...this._def,checks:[...this._def.checks,{kind:"min",min:e.toUTC(),message:t}]})}_coerceToDateTime(e){if(e instanceof te.DateTime&&e.isValid)return e;let t={string:c(()=>te.DateTime.fromJSDate(new Date(e)),"string"),number:c(()=>te.DateTime.fromMillis(e),"number"),object:c(()=>te.DateTime.fromJSDate(e),"object"),default:c(()=>null,"default")};return(t[typeof e]||t.default)()}},no=c((s={})=>new ht({coerce:s.coerce??!1,checks:[]}),"smpZodDateTime")});var $t={};Be($t,{SmpZodDateTime:()=>ht,smpZodDateTime:()=>no});var St=y(()=>{"use strict";hs()});var co={};Be(co,{SMP_HEALTHZ:()=>Bs,SmpAbstractCacheStrategy:()=>re,SmpAbstractTtlCacheStrategy:()=>se,SmpAesCrypt:()=>ye,SmpApiCommonUtils:()=>yt,SmpBrowserCache:()=>Pe,SmpCommonUtils:()=>Dt,SmpCrypto:()=>Ye,SmpErrorResponse:()=>z,SmpFilterException:()=>Nt,SmpFirebaseErrors:()=>Ue,SmpGenericResponse:()=>pe,SmpGiftcardTransaction:()=>rt,SmpGiftcardTransactionHashStrategies:()=>he,SmpGiftcardTransactionOps:()=>v,SmpHttpService:()=>mt,SmpHttpSessionStorageCache:()=>De,SmpHttpStatusCodes:()=>gt,SmpInMemoryCache:()=>Ne,SmpMarketingCloudValidators:()=>Ds,SmpRegularExpressions:()=>Ft,SmpResponseMessage:()=>U,SmpResponseMessageTypes:()=>q,SmpRestVerbs:()=>xt,SmpSecureCode:()=>et,SmpSid:()=>jt,SmpSocialSignInKeys:()=>H,SmpSocialSignInUxModes:()=>fe,VERSION:()=>ao,smpApplyMixin:()=>Ns,smpIsSmpCachedValue:()=>ve,smpNoop:()=>O});module.exports=F(co);var Ce=require("class-transformer");var Z=require("class-transformer");var dt=require("class-transformer");var q=function(s){return s.INFO="INFO",s.SUCCESS="SUCCESS",s.WARNING="WARNING",s.ERROR="ERROR",s}({});function Jt(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(i=(o<3?n(i):o>3?n(e,t,i):n(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i}c(Jt,"_ts_decorate");function Le(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}c(Le,"_ts_metadata");var U=class s{static{c(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=q.ERROR){this._message=e,this._type=t}static sanitizeMessages(e){return typeof e=="string"?e.length?[new s(e)]:[]:[e].flat().map(t=>typeof t=="string"?new s(t):t)}};Jt([(0,dt.Expose)(),Le("design:type",String),Le("design:paramtypes",[])],U.prototype,"message",null);Jt([(0,dt.Expose)(),Le("design:type",typeof q>"u"?Object:q),Le("design:paramtypes",[])],U.prototype,"type",null);function bs(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(i=(o<3?n(i):o>3?n(e,t,i):n(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i}c(bs,"_ts_decorate");function Qt(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}c(Qt,"_ts_metadata");var pe=class s{static{c(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=U.sanitizeMessages(e)}get messages(){return this._messages}constructor(e=[],t){this._messages=e,this.data=t}static buildInfo(e,t){return new s([e].flat().map(r=>new U(r,q.INFO)),t)}static buildSuccess(e,t){return new s([e].flat().map(r=>new U(r,q.SUCCESS)),t)}static fromPlain(e){return(0,Z.plainToInstance)(s,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,Z.instanceToPlain)(this,{excludePrefixes:["_"]})}};bs([(0,Z.Expose)(),(0,Z.Transform)(({value:s})=>s?.length?s:void 0),Qt("design:type",Object),Qt("design:paramtypes",[])],pe.prototype,"messages",null);function Yt(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(i=(o<3?n(i):o>3?n(e,t,i):n(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i}c(Yt,"_ts_decorate");function ze(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}c(ze,"_ts_metadata");var z=class s extends pe{static{c(this,"SmpErrorResponse")}_errorCode;_status;static get DEFAULT_MESSAGES(){return[new U("GENERIC_ERROR")]}get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=s.DEFAULT_MESSAGES,t="GENERIC_ERROR",r=500,o){super(e,o),this._errorCode=t,this._status=r,this._timestamp=Date.now()}static create({messages:e=s.DEFAULT_MESSAGES,...t}={}){return new s(U.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=(0,Ce.plainToInstance)(Os,e,{excludePrefixes:["_"]}),r=new s;return Object.getOwnPropertyNames(t).forEach(o=>{o in r&&(r[o]=t[o])}),r}};Yt([(0,Ce.Expose)(),ze("design:type",Object),ze("design:paramtypes",[])],z.prototype,"errorCode",null);Yt([(0,Ce.Expose)(),ze("design:type",Number),ze("design:paramtypes",[])],z.prototype,"timestamp",null);var Os=class extends z{static{c(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var ut=require("ts-luxon");pt();ft();var se=class extends re{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=ut.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,r);return}let o=ut.DateTime.now().ts+r*1e3,i={value:t,expiry:o};this._writeRaw(e,i,r)}_isSmpCachedValue(e){return ve(e)}};var Pe=class extends se{static{c(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let r=this._storage.key(t);r&&r.startsWith(this._prefix)&&e.push(r)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,r)}}};var De=class extends Pe{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var Ne=class extends se{static{c(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,t){this._staticSelf._storage.set(e,t)}};var mt=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new De:new Ne;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=z;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core.com";static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(o=>this._preprocessResponse(e,o)).then(o=>{if(o.ok){if(o.status===204||o.headers.get("content-length")==="0")return null;switch(t.responseType){case"blob":return o.blob();case"arraybuffer":return o.arrayBuffer();case"text":return o.text();case"json":default:return o.json()}}return o.json().then(i=>{let n=i;try{n=this._errorClass.fromPlain(i)}catch(a){console.debug("http: failed to parse error response into ErrorResponse",a)}return Promise.reject({status:o.status,message:o.statusText,body:n})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(e,t){let r=e.startsWith("http");if(t){let o=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),i=Object.fromEntries(o.searchParams.entries());o.search=new URLSearchParams({...i,...Object.fromEntries(Object.entries(t).map(([n,a])=>[n,`${a}`]))}).toString(),e=r?o.href:o.pathname+o.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 gt=function(s){return s[s.Continue=100]="Continue",s[s.SwitchingProtocols=101]="SwitchingProtocols",s[s.Processing=102]="Processing",s[s.EarlyHints=103]="EarlyHints",s[s.Ok=200]="Ok",s[s.Created=201]="Created",s[s.Accepted=202]="Accepted",s[s.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",s[s.NoContent=204]="NoContent",s[s.ResetContent=205]="ResetContent",s[s.PartialContent=206]="PartialContent",s[s.MultiStatus=207]="MultiStatus",s[s.AlreadyReported=208]="AlreadyReported",s[s.ImUsed=226]="ImUsed",s[s.MultipleChoices=300]="MultipleChoices",s[s.MovedPermanently=301]="MovedPermanently",s[s.Found=302]="Found",s[s.SeeOther=303]="SeeOther",s[s.NotModified=304]="NotModified",s[s.UseProxy=305]="UseProxy",s[s.Unused=306]="Unused",s[s.TemporaryRedirect=307]="TemporaryRedirect",s[s.PermanentRedirect=308]="PermanentRedirect",s[s.BadRequest=400]="BadRequest",s[s.Unauthorized=401]="Unauthorized",s[s.PaymentRequired=402]="PaymentRequired",s[s.Forbidden=403]="Forbidden",s[s.NotFound=404]="NotFound",s[s.MethodNotAllowed=405]="MethodNotAllowed",s[s.NotAcceptable=406]="NotAcceptable",s[s.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",s[s.RequestTimeout=408]="RequestTimeout",s[s.Conflict=409]="Conflict",s[s.Gone=410]="Gone",s[s.LengthRequired=411]="LengthRequired",s[s.PreconditionFailed=412]="PreconditionFailed",s[s.PayloadTooLarge=413]="PayloadTooLarge",s[s.UriTooLong=414]="UriTooLong",s[s.UnsupportedMediaType=415]="UnsupportedMediaType",s[s.RangeNotSatisfiable=416]="RangeNotSatisfiable",s[s.ExpectationFailed=417]="ExpectationFailed",s[s.ImATeapot=418]="ImATeapot",s[s.MisdirectedRequest=421]="MisdirectedRequest",s[s.UnprocessableEntity=422]="UnprocessableEntity",s[s.Locked=423]="Locked",s[s.FailedDependency=424]="FailedDependency",s[s.TooEarly=425]="TooEarly",s[s.UpgradeRequired=426]="UpgradeRequired",s[s.PreconditionRequired=428]="PreconditionRequired",s[s.TooManyRequests=429]="TooManyRequests",s[s.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",s[s.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",s[s.InternalServerError=500]="InternalServerError",s[s.NotImplemented=501]="NotImplemented",s[s.BadGateway=502]="BadGateway",s[s.ServiceUnavailable=503]="ServiceUnavailable",s[s.GatewayTimeout=504]="GatewayTimeout",s[s.HttpVersionNotSupported=505]="HttpVersionNotSupported",s[s.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",s[s.InsufficientStorage=507]="InsufficientStorage",s[s.LoopDetected=508]="LoopDetected",s[s.NotExtended=510]="NotExtended",s[s.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",s}({});Te();var yt=class{static{c(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new X;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,o)=>{let i=t[o];return i!==void 0?encodeURIComponent(i):r})}catch(r){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,r)}return e}};var Bs={status:"OK"};var xt=function(s){return s.GET="GET",s.POST="POST",s.PUT="PUT",s.DELETE="DELETE",s.PATCH="PATCH",s}({});var J=class{static{c(this,"Hex")}static parse(e){let t=e.length,r=[];for(let o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new _(r,t/2)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let o=e.words[r>>>2]>>>24-r%4*8&255;t.push((o>>>4).toString(16)),t.push((o&15).toString(16))}return t.join("")}};var _=class Et{static{c(this,"WordArray")}constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],r=c(function(o){let i=987654321,n=4294967295;return function(){i=36969*(i&65535)+(i>>16)&n,o=18e3*(o&65535)+(o>>16)&n;let a=(i<<16)+o&n;return a/=4294967296,a+=.5,a*(Math.random()>.5?1:-1)}},"r");for(let o=0,i;o<e;o+=4){let n=r((i||Math.random())*4294967296);i=n()*987654071,t.push(n()*4294967296|0)}return new Et(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 Et(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||J).stringify(this)}};var Ke=class{static{c(this,"Latin1")}static parse(e){let t=e.length,r=[];for(let o=0;o<t;o++)r[o>>>2]|=(e.charCodeAt(o)&255)<<24-o%4*8;return new _(r,t)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let o=e.words[r>>>2]>>>24-r%4*8&255;t.push(String.fromCharCode(o))}return t.join("")}};var I=class{static{c(this,"Utf8")}static parse(e){return Ke.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(Ke.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var Ge=class{static{c(this,"BufferedBlockAlgorithm")}constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new _,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 o=r*this.cfg.blockSize,i=Math.min(o*4,this._data.sigBytes),n;if(o){for(let a=0;a<o;a+=this.cfg.blockSize)this._doProcessBlock(this._data.words,a);n=this._data.words.splice(0,o),this._data.sigBytes-=i}return new _(n,i)}};var ue=class{static{c(this,"CipherParams")}constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var W=class{static{c(this,"Base64")}static parse(e){let t=e.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let o=0;o<this._map.length;o++)this._reverseMap[this._map.charCodeAt(o)]=o}let r=this._map.charAt(64);if(r){let o=e.indexOf(r);o!==-1&&(t=o)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let o=[],i=0;for(let n=0;n<t;n++)if(n%4){let a=r[e.charCodeAt(n-1)]<<n%4*2,h=r[e.charCodeAt(n)]>>>6-n%4*2;o[i>>>2]|=(a|h)<<24-i%4*8,i++}return new _(o,i)}static stringify(e){e.clamp();let t=[];for(let o=0;o<e.sigBytes;o+=3){let i=e.words[o>>>2]>>>24-o%4*8&255,n=e.words[o+1>>>2]>>>24-(o+1)%4*8&255,a=e.words[o+2>>>2]>>>24-(o+2)%4*8&255,h=i<<16|n<<8|a;for(let f=0;f<4&&o+f*.75<e.sigBytes;f++)t.push(this._map.charAt(h>>>6*(3-f)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};W._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";W._reverseMap=void 0;var Ve=class{static{c(this,"OpenSSL")}static parse(e){let t=W.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 ue({ciphertext:t,salt:r})}static stringify(e){if(!e.ciphertext)throw new Error("missing ciphertext in params");let t=e.ciphertext,r=e.salt,o;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");o=new _([1398893684,1701076831]).concat(r).concat(t)}else o=t;return o.toString(W)}};var oe=class{static{c(this,"SerializableCipher")}static decrypt(e,t,r,o){let i=Object.assign({},this.cfg,o);if(!i.format)throw new Error("could not determine format");if(t=this._parse(t,i.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,i).finalize(t.ciphertext)}static encrypt(e,t,r,o){let i=Object.assign({},this.cfg,o),n=e.createEncryptor(r,i),a=n.finalize(t);return new ue({ciphertext:a,key:r,iv:n.cfg.iv,algorithm:e,mode:n.cfg.mode,padding:n.cfg.padding,blockSize:n.cfg.blockSize,formatter:i.format})}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};oe.cfg={blockSize:4,iv:new _([]),format:Ve};var b=class extends Ge{static{c(this,"Hasher")}constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,o){return new e(o).finalize(r)}return c(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let s=0;s<64;s++)d[s]=Math.abs(Math.sin(s+1))*4294967296|0;var K=class p extends b{static{c(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,o,i,n,a){let h=e+(t&r|~t&o)+i+a;return(h<<n|h>>>32-n)+t}static GG(e,t,r,o,i,n,a){let h=e+(t&o|r&~o)+i+a;return(h<<n|h>>>32-n)+t}static HH(e,t,r,o,i,n,a){let h=e+(t^r^o)+i+a;return(h<<n|h>>>32-n)+t}static II(e,t,r,o,i,n,a){let h=e+(r^(t|~o))+i+a;return(h<<n|h>>>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),o=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]=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let i=0;i<4;i++)this._hash.words[i]=(this._hash.words[i]<<8|this._hash.words[i]>>>24)&16711935|(this._hash.words[i]<<24|this._hash.words[i]>>>8)&4278255360;return this._hash}_doProcessBlock(e,t){for(let h=0;h<16;h++){let f=t+h,g=e[f];e[f]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}let r=Array.from({length:16});for(let h=0;h<16;h++)r[h]=e[t+h];let o=this._hash.words[0],i=this._hash.words[1],n=this._hash.words[2],a=this._hash.words[3];o=p.FF(o,i,n,a,r[0],7,d[0]),a=p.FF(a,o,i,n,r[1],12,d[1]),n=p.FF(n,a,o,i,r[2],17,d[2]),i=p.FF(i,n,a,o,r[3],22,d[3]),o=p.FF(o,i,n,a,r[4],7,d[4]),a=p.FF(a,o,i,n,r[5],12,d[5]),n=p.FF(n,a,o,i,r[6],17,d[6]),i=p.FF(i,n,a,o,r[7],22,d[7]),o=p.FF(o,i,n,a,r[8],7,d[8]),a=p.FF(a,o,i,n,r[9],12,d[9]),n=p.FF(n,a,o,i,r[10],17,d[10]),i=p.FF(i,n,a,o,r[11],22,d[11]),o=p.FF(o,i,n,a,r[12],7,d[12]),a=p.FF(a,o,i,n,r[13],12,d[13]),n=p.FF(n,a,o,i,r[14],17,d[14]),i=p.FF(i,n,a,o,r[15],22,d[15]),o=p.GG(o,i,n,a,r[1],5,d[16]),a=p.GG(a,o,i,n,r[6],9,d[17]),n=p.GG(n,a,o,i,r[11],14,d[18]),i=p.GG(i,n,a,o,r[0],20,d[19]),o=p.GG(o,i,n,a,r[5],5,d[20]),a=p.GG(a,o,i,n,r[10],9,d[21]),n=p.GG(n,a,o,i,r[15],14,d[22]),i=p.GG(i,n,a,o,r[4],20,d[23]),o=p.GG(o,i,n,a,r[9],5,d[24]),a=p.GG(a,o,i,n,r[14],9,d[25]),n=p.GG(n,a,o,i,r[3],14,d[26]),i=p.GG(i,n,a,o,r[8],20,d[27]),o=p.GG(o,i,n,a,r[13],5,d[28]),a=p.GG(a,o,i,n,r[2],9,d[29]),n=p.GG(n,a,o,i,r[7],14,d[30]),i=p.GG(i,n,a,o,r[12],20,d[31]),o=p.HH(o,i,n,a,r[5],4,d[32]),a=p.HH(a,o,i,n,r[8],11,d[33]),n=p.HH(n,a,o,i,r[11],16,d[34]),i=p.HH(i,n,a,o,r[14],23,d[35]),o=p.HH(o,i,n,a,r[1],4,d[36]),a=p.HH(a,o,i,n,r[4],11,d[37]),n=p.HH(n,a,o,i,r[7],16,d[38]),i=p.HH(i,n,a,o,r[10],23,d[39]),o=p.HH(o,i,n,a,r[13],4,d[40]),a=p.HH(a,o,i,n,r[0],11,d[41]),n=p.HH(n,a,o,i,r[3],16,d[42]),i=p.HH(i,n,a,o,r[6],23,d[43]),o=p.HH(o,i,n,a,r[9],4,d[44]),a=p.HH(a,o,i,n,r[12],11,d[45]),n=p.HH(n,a,o,i,r[15],16,d[46]),i=p.HH(i,n,a,o,r[2],23,d[47]),o=p.II(o,i,n,a,r[0],6,d[48]),a=p.II(a,o,i,n,r[7],10,d[49]),n=p.II(n,a,o,i,r[14],15,d[50]),i=p.II(i,n,a,o,r[5],21,d[51]),o=p.II(o,i,n,a,r[12],6,d[52]),a=p.II(a,o,i,n,r[3],10,d[53]),n=p.II(n,a,o,i,r[10],15,d[54]),i=p.II(i,n,a,o,r[1],21,d[55]),o=p.II(o,i,n,a,r[8],6,d[56]),a=p.II(a,o,i,n,r[15],10,d[57]),n=p.II(n,a,o,i,r[6],15,d[58]),i=p.II(i,n,a,o,r[13],21,d[59]),o=p.II(o,i,n,a,r[4],6,d[60]),a=p.II(a,o,i,n,r[11],10,d[61]),n=p.II(n,a,o,i,r[2],15,d[62]),i=p.II(i,n,a,o,r[9],21,d[63]),this._hash.words[0]=this._hash.words[0]+o|0,this._hash.words[1]=this._hash.words[1]+i|0,this._hash.words[2]=this._hash.words[2]+n|0,this._hash.words[3]=this._hash.words[3]+a|0}};var Rt=class lr{static{c(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:K,iterations:1},e)}static execute(e,t,r){return new lr(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,o=new _,i;for(;o.words.length<this.cfg.keySize;){i&&r.update(i),i=r.update(e).finalize(t),r.reset();for(let n=1;n<this.cfg.iterations;n++)i=r.finalize(i),r.reset();o.concat(i)}return o.sigBytes=this.cfg.keySize*4,o}};var dr=class{static{c(this,"OpenSSLKdf")}static execute(e,t,r,o){o||(o=_.random(64/8));let i=new Rt({keySize:t+r}).compute(e,o),n=new _(i.words.slice(t),r*4);return i.sigBytes=t*4,new ue({key:i,iv:n,salt:o})}};var qe=class{static{c(this,"PasswordBasedCipher")}static decrypt(e,t,r,o){let i=Object.assign({},this.cfg,o);if(i.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,i.format),i.kdf===void 0)throw new Error("the key derivation function must be set");let n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv!==void 0&&(i.iv=n.iv),oe.decrypt.call(this,e,t,n.key,i)}static encrypt(e,t,r,o){let i=Object.assign({},this.cfg,o);if(i.kdf===void 0)throw new Error("missing kdf in config");let n=i.kdf.execute(r,e.keySize,e.ivSize);return n.iv!==void 0&&(i.iv=n.iv),oe.encrypt.call(this,e,t,n.key,i).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};qe.cfg={blockSize:4,iv:new _([]),format:Ve,kdf:dr};var pr=class{static{c(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?qe.decrypt(this._cipher,e,t,r):oe.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?qe.encrypt(this._cipher,e,t,r):oe.encrypt(this._cipher,e,t,r)}};var me=class extends Ge{static{c(this,"Cipher")}constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new pr(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()}};me.ivSize=4;me.keySize=4;me._DEC_XFORM_MODE=2;me._ENC_XFORM_MODE=1;var ie=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var Ze=class{static{c(this,"BlockCipherMode")}static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};Ze.Decryptor=ie;Ze.Encryptor=ie;var fr=class extends ie{static{c(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let o;this._iv?(o=this._iv,this._iv=void 0):o=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=o[i]}};var ur=class extends ie{static{c(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let o;this._iv?(o=this._iv,this._iv=void 0):o=this._prevBlock;for(let i=0;i<r;i++)e[t+i]^=o[i]}};var Q=class extends Ze{static{c(this,"CBC")}};Q.Decryptor=ur;Q.Encryptor=fr;var ge=class{static{c(this,"PKCS7")}static pad(e,t){let r=t*4,o=r-e.sigBytes%r,i=o<<24|o<<16|o<<8|o,n=[];for(let h=0;h<o;h+=4)n.push(i);let a=new _(n,o);e.concat(a)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var Xe=class extends me{static{c(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:Q,padding:ge},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 ${static{c(this,"X64Word")}constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,o=this.high+e.high+r|0;return new $(o,t)}and(e){return new $(this.high&e.high,this.low&e.low)}not(){return new $(~this.high,~this.low)}or(e){return new $(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 $(this.high<<e|this.low>>>32-e,this.low<<e):new $(this.low<<e-32,0)}shiftR(e){return e<32?new $(this.high>>>e,this.low>>>e|this.high<<32-e):new $(0,this.high>>>e-32)}xor(e){return new $(this.high^e.high,this.low^e.low)}};var mr=class At{static{c(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new 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 _(e,this.sigBytes)}};var C=[],gr=[],_r=[],wr=[],yr=[],xr=[],bt=[],Ot=[],It=[],Bt=[];(function(){let s=[];for(let r=0;r<256;r++)r<128?s[r]=r<<1:s[r]=r<<1^283;let e=0,t=0;for(let r=0;r<256;r++){let o=t^t<<1^t<<2^t<<3^t<<4;o=o>>>8^o&255^99,C[e]=o,gr[o]=e;let i=s[e],n=s[i],a=s[n],h=s[o]*257^o*16843008;_r[e]=h<<24|h>>>8,wr[e]=h<<16|h>>>16,yr[e]=h<<8|h>>>24,xr[e]=h,h=a*16843009^n*65537^i*257^e*16843008,bt[o]=h<<24|h>>>8,Ot[o]=h<<16|h>>>16,It[o]=h<<8|h>>>24,Bt[o]=h,e?(e=i^s[s[s[a^i]]],t^=s[s[t]]):e=t=1}})();var Cs=[0,1,2,4,8,16,32,64,128,27,54],He=class extends Xe{static{c(this,"AES")}constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,bt,Ot,It,Bt,gr),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,_r,wr,yr,xr,C)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=((this._nRounds=r+6)+1)*4,n=this._keySchedule=[];for(let a=0;a<i;a++)if(a<r)n[a]=t[a];else{let h=n[a-1];a%r?r>6&&a%r===4&&(h=C[h>>>24]<<24|C[h>>>16&255]<<16|C[h>>>8&255]<<8|C[h&255]):(h=h<<8|h>>>24,h=C[h>>>24]<<24|C[h>>>16&255]<<16|C[h>>>8&255]<<8|C[h&255],h^=Cs[a/r|0]<<24),n[a]=n[a-r]^h}this._invKeySchedule=[];for(let a=0;a<i;a++){let h=i-a,f;a%4?f=n[h]:f=n[h-4],a<4||h<=4?this._invKeySchedule[a]=f:this._invKeySchedule[a]=bt[C[f>>>24]]^Ot[C[f>>>16&255]]^It[C[f>>>8&255]]^Bt[C[f&255]]}}_doCryptBlock(e,t,r,o,i,n,a,h){let f=e[t]^r[0],g=e[t+1]^r[1],m=e[t+2]^r[2],w=e[t+3]^r[3],A=4;for(let B=1;B<this._nRounds;B++){let x=o[f>>>24]^i[g>>>16&255]^n[m>>>8&255]^a[w&255]^r[A++],E=o[g>>>24]^i[m>>>16&255]^n[w>>>8&255]^a[f&255]^r[A++],j=o[m>>>24]^i[w>>>16&255]^n[f>>>8&255]^a[g&255]^r[A++],lt=o[w>>>24]^i[f>>>16&255]^n[g>>>8&255]^a[m&255]^r[A++];f=x,g=E,m=j,w=lt}let P=(h[f>>>24]<<24|h[g>>>16&255]<<16|h[m>>>8&255]<<8|h[w&255])^r[A++],L=(h[g>>>24]<<24|h[m>>>16&255]<<16|h[w>>>8&255]<<8|h[f&255])^r[A++],N=(h[m>>>24]<<24|h[w>>>16&255]<<16|h[f>>>8&255]<<8|h[g&255])^r[A++],T=(h[w>>>24]<<24|h[f>>>16&255]<<16|h[g>>>8&255]<<8|h[m&255])^r[A++];e[t]=P,e[t+1]=L,e[t+2]=N,e[t+3]=T}};He.keySize=256/32;var vs=[1732584193,4023233417,2562383102,271733878,3285377520],ne=new Array(80),ae=class extends b{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(vs.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],o=this._hash.words[1],i=this._hash.words[2],n=this._hash.words[3],a=this._hash.words[4];for(let h=0;h<80;h++){if(h<16)ne[h]=e[t+h]|0;else{let w=ne[h-3]^ne[h-8]^ne[h-14]^ne[h-16];ne[h]=w<<1|w>>>31}let f,g;h<20?(f=o&i|~o&n,g=1518500249):h<40?(f=o^i^n,g=1859775393):h<60?(f=o&i|o&n|i&n,g=2400959708):(f=o^i^n,g=3395469782);let m=(r<<5|r>>>27)+f+a+g+ne[h];a=n,n=i,i=o<<30|o>>>2,o=r,r=m|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+i|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+a|0}};var Er=[],Rr=[];(function(){function s(o){let i=Math.sqrt(o);for(let n=2;n<=i;n++)if(!(o%n))return!1;return!0}c(s,"isPrime");function e(o){return(o-(o|0))*4294967296|0}c(e,"getFractionalBits");let t=2,r=0;for(;r<64;)s(t)&&(r<8&&(Er[r]=e(Math.pow(t,1/2))),Rr[r]=e(Math.pow(t,1/3)),r++),t++})();var ce=[],je=class extends b{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(Er.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],o=this._hash.words[1],i=this._hash.words[2],n=this._hash.words[3],a=this._hash.words[4],h=this._hash.words[5],f=this._hash.words[6],g=this._hash.words[7];for(let m=0;m<64;m++){if(m<16)ce[m]=e[t+m]|0;else{let B=ce[m-15],x=(B<<25|B>>>7)^(B<<14|B>>>18)^B>>>3,E=ce[m-2],j=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;ce[m]=x+ce[m-7]+j+ce[m-16]}let w=a&h^~a&f,A=r&o^r&i^o&i,P=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),L=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),N=g+L+w+Rr[m]+ce[m],T=P+A;g=f,f=h,h=a,a=n+N|0,n=i,i=o,o=r,r=N+T|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+i|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]+h|0,this._hash.words[6]=this._hash.words[6]+f|0,this._hash.words[7]=this._hash.words[7]+g|0}};var Ct=[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 s=0;s<80;s++)M[s]=new l(void 0,void 0)})();var vt=class extends b{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new mr([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,o=e.sigBytes*8;return t[o>>>5]|=128<<24-o%32,t[(o+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(o+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,o=this._hash.words[0].low,i=this._hash.words[1].high,n=this._hash.words[1].low,a=this._hash.words[2].high,h=this._hash.words[2].low,f=this._hash.words[3].high,g=this._hash.words[3].low,m=this._hash.words[4].high,w=this._hash.words[4].low,A=this._hash.words[5].high,P=this._hash.words[5].low,L=this._hash.words[6].high,N=this._hash.words[6].low,T=this._hash.words[7].high,B=this._hash.words[7].low;for(let x=0;x<80;x++){let E,j;if(x<16)j=M[x].high=e[t+x*2]|0,E=M[x].low=e[t+x*2+1]|0;else{let Vt=M[x-15],le=Vt.high,be=Vt.low,gs=(le>>>1|be<<31)^(le>>>8|be<<24)^le>>>7,qt=(be>>>1|le<<31)^(be>>>8|le<<24)^(be>>>7|le<<25),Zt=M[x-2],de=Zt.high,Oe=Zt.low,_s=(de>>>19|Oe<<13)^(de<<3|Oe>>>29)^de>>>6,Xt=(Oe>>>19|de<<13)^(Oe<<3|de>>>29)^(Oe>>>6|de<<26);E=qt+M[x-7].low,j=gs+M[x-7].high+(E>>>0<qt>>>0?1:0),E=E+Xt,j=j+_s+(E>>>0<Xt>>>0?1:0),E=E+M[x-16].low,j=j+M[x-16].high+(E>>>0<M[x-16].low>>>0?1:0),M[x].high=j,M[x].low=E}let lt=m&A^~m&L,Wt=w&P^~w&N,ls=r&i^r&a^i&a,ds=o&n^o&h^n&h,ps=(r>>>28|o<<4)^(r<<30|o>>>2)^(r<<25|o>>>7),Kt=(o>>>28|r<<4)^(o<<30|r>>>2)^(o<<25|r>>>7),fs=(m>>>14|w<<18)^(m>>>18|w<<14)^(m<<23|w>>>9),us=(w>>>14|m<<18)^(w>>>18|m<<14)^(w<<23|m>>>9),D=B+us,V=T+fs+(D>>>0<B>>>0?1:0);D=D+Wt,V=V+lt+(D>>>0<Wt>>>0?1:0),D=D+Ct[x].low,V=V+Ct[x].high+(D>>>0<Ct[x].low>>>0?1:0),D=D+E,V=V+j+(D>>>0<E>>>0?1:0);let Gt=Kt+ds,ms=ps+ls+(Gt>>>0<Kt>>>0?1:0);T=L,B=N,L=A,N=P,A=m,P=w,w=g+D|0,m=f+V+(w>>>0<g>>>0?1:0)|0,f=a,g=h,a=i,h=n,i=r,n=o,o=D+Gt|0,r=V+ms+(o>>>0<D>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+o,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<o>>>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+i+(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+h,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<h>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+g,this._hash.words[3].high=this._hash.words[3].high+f+(this._hash.words[3].low>>>0<g>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+w,this._hash.words[4].high=this._hash.words[4].high+m+(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+N,this._hash.words[6].high=this._hash.words[6].high+L+(this._hash.words[6].low>>>0<N>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+B,this._hash.words[7].high=this._hash.words[7].high+T+(this._hash.words[7].low>>>0<B>>>0?1:0)}};var Ar=class{static{c(this,"HMAC")}constructor(e,t){this._hasher=new e;let r=typeof t=="string"?I.parse(t):t,o=this._hasher.cfg.blockSize,i=o*4;r.sigBytes>i&&(r=this._hasher.finalize(r)),r.clamp();let n=this._oKey=r.clone(),a=this._iKey=r.clone(),h=n.words,f=a.words;for(let g=0;g<o;g++)h[g]^=1549556828,f[g]^=909522486;n.sigBytes=a.sigBytes=i,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 Pt=class br{static{c(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:je,iterations:25e4},e)}static execute(e,t,r){return new br(r).compute(e,t)}compute(e,t){let r=this.cfg,o=new Ar(r.hasher,e),i=new _,n=new _([1]),a=i.words,h=n.words,f=r.keySize,g=r.iterations;for(;a.length<f;){let m=o.update(t).finalize(n);o.reset();let w=m.words,A=w.length,P=m;for(let L=1;L<g;L++){P=o.finalize(P),o.reset();let N=P.words;for(let T=0;T<A;T++)w[T]^=N[T]}i.concat(m),h[0]++}return i.sigBytes=f*4,i}};var Fe=Xe._createHelper(He);var _e=b._createHelper(K);var we=b._createHelper(ae);var Je=b._createHelper(je);var Qe=b._createHelper(vt);var ye=class{static{c(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?J.parse(this._initVector):void 0}_mode;_padding;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r,this._mode=Q,this._padding=ge}decryptAES(e){return Fe.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(e){return Fe.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Pt.execute(this._password,J.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:ae})}};var Ye=class{static{c(this,"SmpCrypto")}static base64Decode(e){return I.stringify(W.parse(e))}static base64Encode(e){return W.stringify(I.parse(e))}static md5(e){return _e(e).toString()}static sha1(e){return we(e).toString()}static sha256(e){return Je(e).toString()}static sha512(e){return Qe(e).toString()}};var et=class{static{c(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 z.create({messages:"WRONG_SECURE_CODE",errorCode:"WRONG_SECURE_CODE",status:gt.BadRequest})}_encode(){let e=new K;return e.update(I.parse(this._seed+this._baseCode)),e.finalize().toString(J).substring(0,this._crcLength).toUpperCase()}};var xe=require("class-transformer"),tt=require("ts-luxon");var v=function(s){return s.ACTIVATE="ACTIVATE",s.BLOCK="BLOCK",s.CHECK="CHECK",s.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",s.FREEZE="FREEZE",s.PURCHASE="PURCHASE",s.RECHARGE="RECHARGE",s.ROLLBACK="ROLLBACK",s.TRANSACTION="TRANSACTION",s.TRANSACTION_DETAIL="TRANSACTION_DETAIL",s.UNFREEZE="UNFREEZE",s.XREFUND="XREFUND",s}({});var he=function(s){return s.MD5="MD5",s.MD5_HMAC="MD5_HMAC",s.SHA1="SHA1",s.SHA1_HMAC="SHA1_HMAC",s}({});function Ps(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(i=(o<3?n(i):o>3?n(e,t,i):n(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i}c(Ps,"_ts_decorate");function Or(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}c(Or,"_ts_metadata");var rt=class s{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new ye("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,o){this.gc=e,this.op=t,this.ot=r,this._hashStrategies={[he.MD5]:i=>_e(i),[he.MD5_HMAC]:i=>{let n=new K;return n.update(I.parse(i)),n.finalize()},[he.SHA1]:i=>we(i),[he.SHA1_HMAC]:i=>{let n=new ae;return n.update(I.parse(i)),n.finalize()}},this._hashStrategy=this._hashStrategies[he.MD5],this._dto=typeof o=="number"&&o>=0?tt.DateTime.fromMillis(+`${o}000`.slice(0,13)):tt.DateTime.local()}static build({gc:e,op:t,ot:r,dto:o}){return new this(e,t,r,o?.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:tt.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._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,xe.plainToInstance)(s,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,xe.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};Ps([(0,xe.Expose)(),Or("design:type",Number),Or("design:paramtypes",[])],rt.prototype,"ts",null);var Ds=function(s){return s.ListDetectiveValidator="ListDetectiveValidator",s.MXValidator="MXValidator",s.SyntaxValidator="SyntaxValidator",s}({});function Ns(s,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{r!=="constructor"&&(r in s.prototype||Object.defineProperty(s.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)))});try{let r=new t;Object.getOwnPropertyNames(r).forEach(o=>{o in s.prototype||Object.defineProperty(s.prototype,o,Object.getOwnPropertyDescriptor(r,o))})}catch{}Object.getOwnPropertyNames(t).forEach(r=>{r!=="prototype"&&r!=="name"&&r!=="length"&&(r in s||Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(t,r)))})})}c(Ns,"smpApplyMixin");var Ts=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Br(s){return s.match(Ts)}c(Br,"smpAsciiWords");var Tr="\\ud800-\\udfff",js="\\u0300-\\u036f",Fs="\\ufe20-\\ufe2f",Us="\\u20d0-\\u20ff",ks="\\u1ab0-\\u1aff",Ms="\\u1dc0-\\u1dff",Ls=js+Fs+Us+ks+Ms,jr="\\u2700-\\u27bf",Fr="a-z\\xdf-\\xf6\\xf8-\\xff",zs="\\xac\\xb1\\xd7\\xf7",$s="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ss="\\u2000-\\u206f",Ws=" \\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",Ur="A-Z\\xc0-\\xd6\\xd8-\\xde",Ks="\\ufe0e\\ufe0f",kr=zs+$s+Ss+Ws,Mr="['\u2019]",Cr=`[${kr}]`,Gs=`[${Ls}]`,Lr="\\d",Vs=`[${jr}]`,zr=`[${Fr}]`,$r=`[^${Tr}${kr+Lr+jr+Fr+Ur}]`,qs="\\ud83c[\\udffb-\\udfff]",Zs=`(?:${Gs}|${qs})`,Xs=`[^${Tr}]`,Sr="(?:\\ud83c[\\udde6-\\uddff]){2}",Wr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ee=`[${Ur}]`,Hs="\\u200d",vr=`(?:${zr}|${$r})`,Js=`(?:${Ee}|${$r})`,Pr=`(?:${Mr}(?:d|ll|m|re|s|t|ve))?`,Dr=`(?:${Mr}(?:D|LL|M|RE|S|T|VE))?`,Kr=`${Zs}?`,Gr=`[${Ks}]?`,Qs=`(?:${Hs}(?:${[Xs,Sr,Wr].join("|")})${Gr+Kr})*`,Ys="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",to=Gr+Kr+Qs,Nr=`(?:${[Vs,Sr,Wr].join("|")})${to}`,ke=class{static{c(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${Ee}?${zr}+${Pr}(?=${[Cr,Ee,"$"].join("|")})`,`${Js}+${Dr}(?=${[Cr,Ee+vr,"$"].join("|")})`,`${Ee}?${vr}+${Pr}`,`${Ee}+${Dr}`,eo,Ys,`${Lr}+`,Nr].join("|"),"g");static RS_EMOJI=Nr;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var Dt=class s{static{c(this,"SmpCommonUtils")}static arrayRemove(e,t){let r=[],o=e.filter((i,n)=>t(i,n)&&r.push(n));return r.reverse().forEach(i=>e.splice(i,1)),o}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||`${this.constructor.name} => val was not an array`)}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||`${this.constructor.name} => val was not boolean`)}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||`${this.constructor.name} => entity was not a function`)}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||`${this.constructor.name} => val was not instance of class`)}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||`${this.constructor.name} => entity was empty`)}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||`${this.constructor.name} => val was not numeric`)}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||`${this.constructor.name} => val was not an object`)}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||`${this.constructor.name} => val was not a string`)}static assertIsTruthy(e,t){if(!e)throw new Error(t||`${this.constructor.name} => condition wasn't truthy`)}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),o=document.createElement("a");o.href=r,o.setAttribute("download",t),document.body.appendChild(o),o.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let o=0;o<e;o++){let i=Math.floor(Math.random()*t.length);r+=t[i]}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 h=0;h<e.length;h++)if(!s.isEqual(e[h],t[h]))return!1;return!0}c(r,"areArraysEqual");function o(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let h in e)if(Object.prototype.hasOwnProperty.call(e,h)&&!s.isEqual(e[h],t[h]))return!1;return!0}c(o,"areObjectsEqual");function i(){return e.toString()===t.toString()}c(i,"areFunctionsEqual");function n(){return e===t}c(n,"arePrimativesEqual");let a=this.getType(e);return a!==this.getType(t)?!1:a==="array"?r():a==="object"?o():a==="function"?i():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,[o,i])=>(r.push(t(i,o)),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,[o,i])=>(r[o]=t.call(null,o,i),r),{})}static mapObjectValues(e,t){return this.isObject(e)?Object.entries(e).reduce((r,[o,i])=>(r[o]=t.call(null,i,o),r),{}):{}}static noop(){}static objectHasValue(e,t){return!!~Object.values(e).filter(r=>this.isEqual(r,t))}static omit(e,t){return Object.keys(e).filter(o=>!t.includes(o)).reduce((o,i)=>(o[i]=e[i],o),{})}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn(`${this.constructor.name} => couldn't parse json string`,{str:e,error:t});return}}static pick(e,t){return t.reduce((r,o)=>(o in e&&(r[o]=e[o]),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=xt.POST,data:r,target:o}){let i=Object.entries(r||{}).map(([a,h])=>`<input name="${a}" type="hidden" value="${h}" />`),n=document.createElement("form");n.method=t,n.action=e,n.innerHTML=`${i}`,n.target=o||"_self",document.body.append(n),n.submit()}static toCamelCase(e){return this.words(e.replace(/['\u2019]/g,"")).reduce((t,r,o)=>(r=r.toLowerCase(),t+(o?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?(ke.HAS_UNICODE_WORD(e)?ke.unicodeWords(e):Br(e))||[]:e.match(t)||[]}};var Nt=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var Tt=require("ts-luxon");var jt=class s{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return Tt.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`sid-xxxx-${+Tt.DateTime.now().ts}`,t=0){this.value=e,this.expiry=t,this._controlSuffix="$1"}static parse(e){return new s(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};Te();var Ft=class{static{c(this,"SmpRegularExpressions")}static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static _country=/[a-zA-Z]{2}/;static _language=/[a-z]{2}/};var ao="1.7.0";Object.defineProperties(module.exports,{SmpDynamoService:{get:c(()=>(Zr(),F(qr)).SmpDynamoService,"get")},SmpFirebaseService:{get:c(()=>(Hr(),F(Xr)).SmpFirebaseService,"get")},SmpAbstractRxjsTtlCacheStrategy:{get:c(()=>(ee(),F(Y)).SmpAbstractRxjsTtlCacheStrategy,"get")},smpRxjsCatchOnly:{get:c(()=>(ee(),F(Y)).smpRxjsCatchOnly,"get")},SmpRxjsInMemoryCache:{get:c(()=>(ee(),F(Y)).SmpRxjsInMemoryCache,"get")},smpRxjsQueue:{get:c(()=>(ee(),F(Y)).smpRxjsQueue,"get")},smpRxjsSequence:{get:c(()=>(ee(),F(Y)).smpRxjsSequence,"get")},smpRxjsThrowIfEmpty:{get:c(()=>(ee(),F(Y)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:c(()=>(ee(),F(Y)).smpRxjsThrowOnCondition,"get")},smpZodDateTime:{get:c(()=>(St(),F($t)).smpZodDateTime,"get")},SmpZodDateTime:{get:c(()=>(St(),F($t)).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,smpApplyMixin,smpIsSmpCachedValue,smpNoop});
2
2
  //# sourceMappingURL=index.cjs.map