@tonysamperi/ts-mapi-core 1.5.0 → 1.6.1

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 (140) hide show
  1. package/changelog.md +7 -0
  2. package/dist/cjs/index.cjs +1 -1
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +12 -7
  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 +4 -4
  8. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs +1 -1
  9. package/dist/cjs/services/http/smp-http-session-storage-cache.class.cjs.map +1 -1
  10. package/dist/cjs/services/http/smp-http-session-storage-cache.class.d.cts +1 -0
  11. package/dist/cjs/services/http/smp-http.service.cjs +1 -1
  12. package/dist/cjs/services/http/smp-http.service.cjs.map +1 -1
  13. package/dist/cjs/services/http/smp-http.service.d.cts +6 -3
  14. package/dist/cjs/services/index.cjs +1 -1
  15. package/dist/cjs/services/index.cjs.map +1 -1
  16. package/dist/cjs/services/index.d.cts +4 -4
  17. package/dist/cjs/shared/api/index.cjs +1 -1
  18. package/dist/cjs/shared/api/index.cjs.map +1 -1
  19. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs +1 -1
  20. package/dist/cjs/shared/api/smp-api-common-utils.class.cjs.map +1 -1
  21. package/dist/cjs/shared/api/smp-error-response.class.cjs +1 -1
  22. package/dist/cjs/shared/api/smp-error-response.class.cjs.map +1 -1
  23. package/dist/cjs/shared/api/smp-error-response.class.d.cts +2 -6
  24. package/dist/cjs/shared/crypto/index.cjs +1 -1
  25. package/dist/cjs/shared/crypto/index.cjs.map +1 -1
  26. package/dist/cjs/shared/crypto/smp-secure-code.class.cjs +1 -1
  27. package/dist/cjs/shared/crypto/smp-secure-code.class.cjs.map +1 -1
  28. package/dist/cjs/shared/crypto/smp-secure-code.class.d.cts +5 -0
  29. package/dist/cjs/shared/giftcard/index.cjs.map +1 -1
  30. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.cjs.map +1 -1
  31. package/dist/cjs/shared/giftcard/smp-giftcard-transaction.class.d.cts +1 -1
  32. package/dist/cjs/shared/marketing-cloud/index.d.cts +1 -1
  33. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.cjs.map +1 -1
  34. package/dist/cjs/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.cts +4 -4
  35. package/dist/cjs/shared/rxjs/index.cjs +1 -1
  36. package/dist/cjs/shared/rxjs/index.cjs.map +1 -1
  37. package/dist/cjs/shared/rxjs/index.d.cts +4 -0
  38. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs +2 -0
  39. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.cjs.map +1 -0
  40. package/dist/cjs/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.d.cts +17 -0
  41. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs +2 -0
  42. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.cjs.map +1 -0
  43. package/dist/cjs/shared/rxjs/smp-rxjs-in-memory-cache.class.d.cts +15 -0
  44. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.cjs.map +1 -1
  45. package/dist/cjs/shared/rxjs/smp-rxjs-throw-on-condition.function.d.cts +3 -3
  46. package/dist/cjs/shared/utils/cache/index.cjs +1 -1
  47. package/dist/cjs/shared/utils/cache/index.cjs.map +1 -1
  48. package/dist/cjs/shared/utils/cache/index.d.cts +4 -3
  49. package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.cjs.map +1 -1
  50. package/dist/cjs/shared/utils/cache/smp-abstract-cache-strategy.class.d.cts +6 -4
  51. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs +1 -1
  52. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.cjs.map +1 -1
  53. package/dist/cjs/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.cts +3 -2
  54. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs +1 -1
  55. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.cjs.map +1 -1
  56. package/dist/cjs/shared/utils/cache/smp-browser-cache.class.d.cts +1 -0
  57. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs +1 -1
  58. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.cjs.map +1 -1
  59. package/dist/cjs/shared/utils/cache/smp-in-memory-cache.class.d.cts +1 -0
  60. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs +2 -0
  61. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.cjs.map +1 -0
  62. package/dist/cjs/shared/utils/cache/smp-is-smp-cached-value.function.d.cts +9 -0
  63. package/dist/cjs/shared/utils/index.cjs +1 -1
  64. package/dist/cjs/shared/utils/index.cjs.map +1 -1
  65. package/dist/cjs/shared/utils/index.d.cts +4 -3
  66. package/dist/cjs/shared/utils/smp-common-utils.class.cjs +1 -1
  67. package/dist/cjs/shared/utils/smp-common-utils.class.cjs.map +1 -1
  68. package/dist/cjs/shared/utils/smp-common-utils.class.d.cts +2 -1
  69. package/dist/esm/chunk-3AFPQCOH.js +1 -0
  70. package/dist/esm/chunk-5VCNTUI6.js +1 -0
  71. package/dist/esm/chunk-C3LKT6AF.js +1 -0
  72. package/dist/esm/chunk-DTVHTARR.js +1 -0
  73. package/dist/esm/chunk-ENM3HAPF.js +1 -0
  74. package/dist/esm/{chunk-CUAIWQU7.js → chunk-FAUAQNPB.js} +1 -1
  75. package/dist/esm/{chunk-W7XM5LDH.js → chunk-GALYBKBP.js} +1 -1
  76. package/dist/esm/{chunk-7MD4IY4X.js → chunk-GXH2KPSQ.js} +1 -1
  77. package/dist/esm/chunk-IPMN727M.js +1 -0
  78. package/dist/esm/chunk-JFKLRHIQ.js +1 -0
  79. package/dist/esm/chunk-NVYQBLR6.js +1 -0
  80. package/dist/esm/{chunk-KZCXOA33.js → chunk-V2OQU7B5.js} +1 -1
  81. package/dist/esm/chunk-Z7KKB4KI.js +1 -0
  82. package/dist/esm/index.d.ts +10 -8
  83. package/dist/esm/index.js +1 -1
  84. package/dist/esm/services/firebase/index.js +1 -1
  85. package/dist/esm/services/firebase/smp-firebase.service.js +1 -1
  86. package/dist/esm/services/http/index.d.ts +4 -4
  87. package/dist/esm/services/http/index.js +1 -1
  88. package/dist/esm/services/http/smp-http-session-storage-cache.class.d.ts +1 -0
  89. package/dist/esm/services/http/smp-http-session-storage-cache.class.js +1 -1
  90. package/dist/esm/services/http/smp-http.service.d.ts +6 -3
  91. package/dist/esm/services/http/smp-http.service.js +1 -1
  92. package/dist/esm/services/index.d.ts +4 -4
  93. package/dist/esm/services/index.js +1 -1
  94. package/dist/esm/shared/api/index.js +1 -1
  95. package/dist/esm/shared/api/smp-api-common-utils.class.js +1 -1
  96. package/dist/esm/shared/api/smp-error-response.class.d.ts +2 -6
  97. package/dist/esm/shared/api/smp-error-response.class.js +1 -1
  98. package/dist/esm/shared/common/index.js +1 -1
  99. package/dist/esm/shared/crypto/index.js +1 -1
  100. package/dist/esm/shared/crypto/smp-secure-code.class.d.ts +5 -0
  101. package/dist/esm/shared/crypto/smp-secure-code.class.js +1 -1
  102. package/dist/esm/shared/giftcard/smp-giftcard-transaction.class.d.ts +1 -1
  103. package/dist/esm/shared/marketing-cloud/index.d.ts +1 -1
  104. package/dist/esm/shared/marketing-cloud/smp-marketing-cloud-validation-response.interface.d.ts +4 -4
  105. package/dist/esm/shared/rxjs/index.d.ts +4 -0
  106. package/dist/esm/shared/rxjs/index.js +1 -1
  107. package/dist/esm/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.d.ts +17 -0
  108. package/dist/esm/shared/rxjs/smp-abstract-rxjs-ttl-cache-strategy.class.js +1 -0
  109. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.d.ts +15 -0
  110. package/dist/esm/shared/rxjs/smp-rxjs-in-memory-cache.class.js +1 -0
  111. package/dist/esm/shared/rxjs/smp-rxjs-throw-on-condition.function.d.ts +3 -3
  112. package/dist/esm/shared/utils/cache/index.d.ts +4 -3
  113. package/dist/esm/shared/utils/cache/index.js +1 -1
  114. package/dist/esm/shared/utils/cache/smp-abstract-cache-strategy.class.d.ts +6 -4
  115. package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.d.ts +3 -2
  116. package/dist/esm/shared/utils/cache/smp-abstract-ttl-cache-strategy.class.js +1 -1
  117. package/dist/esm/shared/utils/cache/smp-browser-cache.class.d.ts +1 -0
  118. package/dist/esm/shared/utils/cache/smp-browser-cache.class.js +1 -1
  119. package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.d.ts +1 -0
  120. package/dist/esm/shared/utils/cache/smp-in-memory-cache.class.js +1 -1
  121. package/dist/esm/shared/utils/cache/smp-is-smp-cached-value.function.d.ts +9 -0
  122. package/dist/esm/shared/utils/cache/smp-is-smp-cached-value.function.js +1 -0
  123. package/dist/esm/shared/utils/index.d.ts +4 -3
  124. package/dist/esm/shared/utils/index.js +1 -1
  125. package/dist/esm/shared/utils/smp-common-utils.class.d.ts +2 -1
  126. package/dist/esm/shared/utils/smp-common-utils.class.js +1 -1
  127. package/package.json +4 -2
  128. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs +0 -2
  129. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.cjs.map +0 -1
  130. package/dist/cjs/shared/utils/cache/smp-cache-strategy.interface.d.cts +0 -12
  131. package/dist/esm/chunk-KEYBWRJC.js +0 -1
  132. package/dist/esm/chunk-L6UZLRQU.js +0 -0
  133. package/dist/esm/chunk-MD2DPFLF.js +0 -1
  134. package/dist/esm/chunk-OM2B3B4I.js +0 -1
  135. package/dist/esm/chunk-QMTVV3AM.js +0 -1
  136. package/dist/esm/chunk-RZ4YI35O.js +0 -1
  137. package/dist/esm/chunk-WN7IOY62.js +0 -1
  138. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.d.ts +0 -12
  139. package/dist/esm/shared/utils/cache/smp-cache-strategy.interface.js +0 -1
  140. /package/dist/esm/{chunk-FE4YONC4.js → chunk-JJLFJN7K.js} +0 -0
package/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.6.1
2
+ * Fixed missing exports in cjs build
3
+
4
+ ## 1.6.0
5
+ * Make arg optional in SmpErrorResponse.create, to create a generic error by simply calling SmpErrorResponse.create()
6
+ * Add rxjs implementations of cache
7
+
1
8
  ## 1.5.0
2
9
  * Fixed smpRxjsCatchOnly catching derived classes
3
10
  * Improved dramatically smpZodDateTime that now works like a native definition with concatenation
@@ -1,2 +1,2 @@
1
- "use strict";var rs=Object.create;var ye=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var is=Object.getOwnPropertyNames;var os=Object.getPrototypeOf,ns=Object.prototype.hasOwnProperty;var h=(i,e)=>ye(i,"name",{value:e,configurable:!0});var E=(i,e)=>()=>(i&&(e=i(i=0)),e);var xe=(i,e)=>{for(var t in e)ye(i,t,{get:e[t],enumerable:!0})},Lt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of is(e))!ns.call(i,s)&&s!==t&&ye(i,s,{get:()=>e[s],enumerable:!(r=ss(e,s))||r.enumerable});return i};var as=(i,e,t)=>(t=i!=null?rs(os(i)):{},Lt(e||!i||!i.__esModule?ye(t,"default",{value:i,enumerable:!0}):t,i)),J=i=>Lt(ye({},"__esModule",{value:!0}),i);var Wt,Gt=E(()=>{"use strict";Wt=class{static{h(this,"SmpSessionManagerService")}get sessionId(){return this._sessionId||this._storage.getItem(this._sessionIdKey)||void 0}constructor(e="lggr_sid"){this._sessionIdKey=e,this._storage=this._getStorage(),this._sessionId=this.sessionId||this._generateSessionId()}_generateSessionId(){let e=this._generateUUID();return this._storage.setItem(this._sessionIdKey,e),e}_generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}_getStorage(){try{if(typeof window<"u"&&typeof window.sessionStorage==typeof isNaN)return sessionStorage}catch(e){console.warn(`${this.constructor.name}: error while checking sessionStorage`,e)}return{getItem:h(()=>null,"getItem"),setItem:h(()=>null,"setItem"),removeItem:h(()=>null,"removeItem"),clear:h(()=>null,"clear")}}}});var F,lt=E(()=>{"use strict";(function(i){i[i.OFF=0]="OFF",i[i.ERROR=1]="ERROR",i[i.WARN=2]="WARN",i[i.INFO=3]="INFO",i[i.LOG=4]="LOG",i[i.DEBUG=5]="DEBUG"})(F||(F={}))});function O(){}var ke=E(()=>{"use strict";h(O,"smpNoop")});var ls,V,dt=E(()=>{"use strict";ke();ls=class{static{h(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},V=class St extends ls{static{h(this,"SmpLoggerMethods")}constructor(){super(...arguments),this.debug=O,this.error=O,this.info=O,this.log=O,this.warn=O}static describe(){return Object.getOwnPropertyNames(new St).map(e=>e)}}});var Vt,Ue,Fe,qt=E(()=>{"use strict";Gt();lt();dt();ke();Ue="[DEFAULT]",Fe=class extends V{static{h(this,"SmpLoggerService")}static get INSTANCE(){return this.get(Ue)}static get INSTANCES(){return this._instances.keys()}static get NOOP_INSTANCE(){return this._noopInstance}get activeLevels(){return Object.values(F).filter(e=>+e>F.OFF&&+e<=this.level).map(e=>F[e])}get appName(){return this._appName}get currentConfig(){return{level:this.level,enableSessionId:this.enableSessionId,enablePreprocessing:this.enablePreprocessing,sensitiveProps:this._sensitiveProps}}get enablePreprocessing(){return this.preprocessArgs!==this._noopPreprocessArgs}get enableSessionId(){return!!this.sessionId}get level(){return this.constructor._level}get sessionId(){return this._sessionId}constructor(e){super(),this._sensitivePropMask="*****",this._sessionManager=new Wt,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=Ue){return this._instances.get(e)||this._instances.get(Ue)||this._noopInstance}static init(e,t=Ue){let r;if(this._instances.has(t)){r=this.get(t);let s=r.currentConfig;r._loadConfig(Object.assign(Object.assign({},s),e))}else this._instances.set(t,new this(e)),r=this.get(t),r._appName=t;return r}static pop(e){let t=this.get(e);return this.destroy(e),t}destroy(){return this.constructor.destroy(this.appName)}filterSensitiveData(e){if(e===null||typeof e!="object"||Array.isArray(e)||e.constructor!==Object)return e;let t={};for(let r in e){let s=e[r];if(!Object.prototype.hasOwnProperty.call(e,r)||s===null||s===void 0){t[r]=s;continue}if(this._sensitiveProps.includes(r)){t[r]=this._sensitivePropMask;continue}t[r]=this.filterSensitiveData(s)}return t}preprocessArgs(e,...t){return this._defaultPreprocessArgs.apply(this,[e,...t])}_defaultPreprocessArgs(e,...t){let r=new Date;return[`${r.toISOString()}`,`${t.shift()}`.trim(),...t.map(s=>({tags:[this._appName,`level-${F[this.level]}`,e],timestamp:+r,sessionId:this.sessionId,metadata:this.filterSensitiveData(s)}))]}_loadConfig({sensitiveProps:e=[],level:t=F.OFF,enablePreprocessing:r=!1,enableSessionId:s=!1}){this._sensitiveProps=[...e,"pwd","password","buffer","token","accessToken","refreshToken"],this.preprocessArgs=r?this.preprocessArgs:this._noopPreprocessArgs,this._sessionId=s?this._sessionManager.sessionId:void 0,this._updateLevel(t)}_noopPreprocessArgs(...e){return e}_setup(e){let t=this.preprocessArgs.bind(this);this.activeLevels.forEach(r=>{let s=`${r}`.toLowerCase();typeof e[s]==typeof isNaN&&(this[s]=function(...o){e[s].apply(e,t.apply(null,[s,...o]))})}),this.level>F.OFF&&console&&(console.group&&console.groupEnd&&(this.group=console.group.bind(console),this.groupEnd=console.groupEnd.bind(console)),console.groupCollapsed&&(this.groupCollapsed=console.groupCollapsed.bind(console)),console.time&&console.timeEnd&&(this.time=console.time.bind(console),this.timeEnd=console.timeEnd.bind(console)))}_updateLevel(e=F.WARN){this.constructor.describe().forEach(t=>{this[t]=O}),this.constructor._level=e,console&&this._setup(console)}};Vt=Fe;Fe._instances=new Map;Fe._level=F.OFF;Fe._noopInstance=new Vt({level:F.OFF})});var Xt=E(()=>{"use strict"});var Zt=E(()=>{"use strict"});var Ht=E(()=>{"use strict";Xt();Zt();dt();lt();ke()});var Ie=E(()=>{"use strict";qt();Ht()});var q,Jt=E(()=>{"use strict";q=function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i}({})});var he,Yt=E(()=>{"use strict";he=function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i}({})});var ve,gr=E(()=>{"use strict";ve=function(i){return i.DIFFERENT_CREDENTIAL="auth/account-exists-with-different-credential",i.DIFFERENT_CREDENTIAL_APPLE="auth/account-exists-with-different-credential/apple",i.DIFFERENT_CREDENTIAL_FACEBOOK="auth/account-exists-with-different-credential/facebook",i.DIFFERENT_CREDENTIAL_GOOGLE="auth/account-exists-with-different-credential/google",i.EMAIL_EXISTS="auth/email-already-exists",i.INVALID_ACTION_CODE="auth/invalid-action-code",i.POPUP_BLOCKED="auth/popup-blocked",i.POPUP_CLOSED_BY_USER="auth/popup-closed-by-user",i.USER_NOT_FOUND="auth/user-not-found",i.WRONG_PASSWORD="auth/wrong-password",i}({})});var Fr={};xe(Fr,{SmpDynamoService:()=>vt});var Ur,Je,He,vt,Mr=E(()=>{"use strict";Ur=require("@aws-sdk/client-dynamodb"),Je=require("@aws-sdk/util-dynamodb");Ie();He=function(i){return i.CouldNotDelete="ERR_COULD_NOT_DELETE",i.CouldNotRead="ERR_COULD_NOT_READ",i.CouldNotWrite="ERR_COULD_NOT_WRITE",i.ConditionalCheckFailedException="ERR_DUPE_TOKEN",i}(He||{}),vt=class{static{h(this,"SmpDynamoService")}_config;_tableName;get marshall(){return Je.marshall}get unmarshall(){return Je.unmarshall}_db;_logger;constructor(e,t){this._config=e,this._tableName=t,this._db=new Ur.DynamoDB([this._buildConfig()]),this._logger=new V}_buildConfig(){return this._config}_delete(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.deleteItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_DELETE")))}_read(e,t=this._tableName,r){let s={TableName:t,Key:this.marshall(e),...r};return this._db.getItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_READ")))}_write(e,t=this._tableName,r){let s={TableName:t,Item:this.marshall(e),...r};return this._db.putItem(s).catch(o=>(this._logger.error("DynamoActionTokensService: couldn't write token to DB",o),Promise.reject(He[o.code]||"ERR_COULD_NOT_WRITE")))}}});var jr={};xe(jr,{SmpFirebaseService:()=>Pt});var De,u,Pt,Lr=E(()=>{"use strict";Ie();De=require("firebase/app"),u=require("firebase/auth");Jt();Yt();gr();Pt=class i{static{h(this,"SmpFirebaseService")}static get INSTANCE(){if(!(this._instance instanceof i))throw Error(`${this.constructor.name} instance doesn't exist! Call ${this.constructor.name}.init first!`);return this._instance}static _instance;get config(){return this._config}get enabledSocials(){return this._enabledSocials}get loggedUser(){return this._loggedUser||(this._loggedUser=this._readStoredUser()),this._auth.currentUser||this._loggedUser||void 0}get providersRelation(){return{"facebook.com":q.FACEBOOK,"google.com":q.GOOGLE,"apple.com":q.APPLE}}get socialLoginUXMode(){return this._socialLoginUxMode}get storedUserKey(){return"firebaseUser"}get _auth(){return(0,u.getAuth)(this._app)}_app;_config;_enabledSocials=[];_loggedUser;_logger;_popupErrors=0;_popupFallsBackToRedirect;_providers;_socialLoginUxMode=he.POPUP;constructor(e,t){this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||he.POPUP,this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new V,this._app=(0,De.getApps)().length?(0,De.getApps)()[0]:(0,De.initializeApp)(e),this._watchAuthState()}static init(e,t){return this._instance||(this._instance=new i(e,t)),this._instance}addAuthStateChangedCallback(e){return this._auth.onAuthStateChanged(t=>{e(t||this.loggedUser||null)})}checkActionCode(e){return(0,u.checkActionCode)(this._auth,e)}confirmPasswordReset(e,t){return(0,u.confirmPasswordReset)(this._auth,e,t)}fetchSignInMethodsForEmail(e){return(0,u.fetchSignInMethodsForEmail)(this._auth,e).then(t=>t.map(r=>this.providersRelation[r]||r))}getRedirectResult(){return(0,u.getRedirectResult)(this._auth).catch(async e=>(await this._expandDifferentCredential(e),Promise.reject(e)))}initAppCheck(){}sendEmailVerification(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.sendEmailVerification)(this.loggedUser,e?{url:e}:void 0)}sendPasswordResetEmail(e,t){return(0,u.sendPasswordResetEmail)(this._auth,e,{url:t})}setPersistence(e){return(0,u.setPersistence)(this._auth,e?u.browserLocalPersistence:u.browserSessionPersistence)}signInWithCustomToken(e){return(0,u.signInWithCustomToken)(this._auth,e)}signInWithEmailAndPassword(e,t){return(0,u.signInWithEmailAndPassword)(this._auth,e,t).then(async r=>r.user)}signInWithSocialProvider(e){if(!this._providers[e])throw Error(`Firebase: invalid social key provided! Expected one of ${this.enabledSocials}, got ${e}`);return this._signInWithProvider(this._providers[e])}signOut(){return(0,u.signOut)(this._auth)}updatePassword(e,t){if(!this.loggedUser)throw Error("Firebase: user is not logged!");let r=u.EmailAuthProvider.credential(this.loggedUser.email,e);return(0,u.reauthenticateWithCredential)(this.loggedUser,r).then(()=>(0,u.updatePassword)(this.loggedUser,t))}updateUserProfile(e){if(!this.loggedUser)throw Error("Firebase: user is not logged!");return(0,u.updateProfile)(this.loggedUser,e)}async verifyIdToken(){return this._auth.currentUser?.getIdTokenResult()}_buildProviders(){this._providers=this._enabledSocials.reduce((e,t)=>(t in e&&(e[t]=e[t]),e),{[q.APPLE]:new u.OAuthProvider("apple.com"),[q.FACEBOOK]:new u.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),[q.GOOGLE]:new u.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code===ve.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=ve["DIFFERENT_CREDENTIAL_"+t[0]],e}}_readStoredUser(){try{let e=localStorage.getItem(this.storedUserKey);if(e){this._logger?.debug("Firebase: found local user",e);let t=JSON.parse(e);return{...t,getIdToken:h(()=>Promise.resolve(t.stsTokenManager.accessToken),"getIdToken")}}}catch(e){this._logger.debug("Firebase: error while getting stored user",e)}}async _signInWithProvider(e,t=this.socialLoginUXMode){return(t===he.POPUP?u.signInWithPopup:u.signInWithRedirect)(this._auth,e).then(s=>(this._logger.info(`Firebase: signin with provider ${e.providerId} was successful`),s.user)).catch(async s=>s?.code===ve.POPUP_BLOCKED&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,he.REDIRECT)):(this._logger.error(`Firebase: sign in with ${e.providerId} errored`,s),await this._expandDifferentCredential(s),Promise.reject(s)))}_updateLocalUser(e){try{e?localStorage.setItem(this.storedUserKey,JSON.stringify(e)):localStorage.removeItem(this.storedUserKey),this._logger.debug("Firebase: updating local user",e),this._loggedUser=e}catch(t){this._logger.warn("Firebase: couldn't update local user",{user:e,error:t})}}_watchAuthState(){this._auth.onAuthStateChanged(e=>{this._logger.debug("Firebase: firebase detected auth state change",e),this._updateLocalUser(e||void 0)})}}});function zr(i,e){return t=>t.pipe((0,Ye.catchError)(r=>(typeof i==typeof isNaN?Ls(i)?zs(r,i):i(r):!1)?e(r):(0,Ye.throwError)(()=>r)))}function Ls(i){try{return Reflect.construct(String,[],i),!0}catch{return!1}}function zs(i,e){return typeof i=="object"&&i!==null&&i.constructor===e}var Ye,$r=E(()=>{"use strict";Ye=require("rxjs");h(zr,"smpRxjsCatchOnly");h(Ls,"isConstructor");h(zs,"isExactInstance")});function Qe(i=Ks){return e=>e.pipe((0,Kr.map)(t=>{if(~$s.indexOf(JSON.stringify(t)))throw i(t);return t}))}var Kr,$s,Ks,Dt=E(()=>{"use strict";Kr=require("rxjs");h(Qe,"smpRxjsThrowIfEmpty");$s=[void 0,null,!1,0,"","0",[],{}].map(i=>JSON.stringify(i)),Ks=h(()=>new Error,"defaultErrorFactory")});function Wr(i,e){return t=>t.pipe((0,et.filter)(r=>!i(r)),(0,et.defaultIfEmpty)(!1),Qe(e))}var et,Gr=E(()=>{"use strict";et=require("rxjs");Dt();h(Wr,"smpRxjsThrowOnCondition")});var tt={};xe(tt,{smpRxjsCatchOnly:()=>zr,smpRxjsThrowIfEmpty:()=>Qe,smpRxjsThrowOnCondition:()=>Wr});var rt=E(()=>{"use strict";$r();Dt();Gr()});var R,H,st,Ws,Sr=E(()=>{"use strict";R=as(require("zod"),1),H=require("ts-luxon"),st=class i extends R.default.ZodType{static{h(this,"SmpZodDateTime")}constructor(e){super({typeName:"SmpZodDateTime",coerce:e?.coerce??!1,checks:e?.checks??[]})}_parse(e){let t=this._getOrReturnCtx(e),r=t.data;if(this._def.coerce&&(r=this._coerceToDateTime(r),!(r instanceof H.DateTime)||!r.isValid))return R.default.addIssueToContext(t,{code:R.ZodIssueCode.invalid_type,expected:R.ZodParsedType.date,received:R.ZodParsedType.unknown,path:t.path,message:"Invalid date format"}),R.default.INVALID;if((!(r instanceof H.DateTime)||!r.isValid)&&!this._def.coerce)return R.default.addIssueToContext(t,{code:R.ZodIssueCode.invalid_type,expected:R.ZodParsedType.date,received:R.ZodParsedType.unknown,path:t.path,message:"Input must be a valid DateTime object"}),R.default.INVALID;let s={min:h((o,n,a)=>{if(o.min&&n<o.min)return{code:R.ZodIssueCode.too_small,minimum:o.min.toMillis(),type:"date",inclusive:!0,message:o.message??`Date must be \u2265 ${o.min.toISODate()}`,path:a.path}},"min"),max:h((o,n,a)=>{if(o.max&&n>o.max)return{code:R.ZodIssueCode.too_big,maximum:o.max.toMillis(),type:"date",inclusive:!0,message:o.message??`Date must be \u2264 ${o.max.toISODate()}`,path:a.path}},"max"),between:h((o,n,a)=>{if(o.min&&o.max&&(n<o.min||n>o.max))return{code:R.ZodIssueCode.custom,message:o.message??`Date must be between ${o.min.toISODate()} and ${o.max.toISODate()}`,path:a.path}},"between")};for(let o of this._def.checks)if(r instanceof H.DateTime&&r.isValid){let n=s[o.kind](o,r,t);n&&R.default.addIssueToContext(t,n)}return t.common.issues.length>0?R.default.INVALID:R.default.OK(r)}between(e,t,r){return new i({...this._def,checks:[...this._def.checks,{kind:"between",min:e.toUTC(),max:t.toUTC(),message:r}]})}coerce(){return new i({...this._def,coerce:!0})}max(e,t){return new i({...this._def,checks:[...this._def.checks,{kind:"max",max:e.toUTC(),message:t}]})}min(e,t){return new i({...this._def,checks:[...this._def.checks,{kind:"min",min:e.toUTC(),message:t}]})}_coerceToDateTime(e){if(e instanceof H.DateTime&&e.isValid)return e;let t={string:h(()=>H.DateTime.fromJSDate(new Date(e)),"string"),number:h(()=>H.DateTime.fromMillis(e),"number"),object:h(()=>H.DateTime.fromJSDate(e),"object"),default:h(()=>null,"default")};return(t[typeof e]||t.default)()}},Ws=h((i={})=>new st({coerce:i.coerce??!1,checks:[]}),"smpZodDateTime")});var Vr={};xe(Vr,{SmpZodDateTime:()=>st,smpZodDateTime:()=>Ws});var qr=E(()=>{"use strict";Sr()});var Ss={};xe(Ss,{SMP_HEALTHZ:()=>ds,SmpAbstractCacheStrategy:()=>Ee,SmpAbstractTtlCacheStrategy:()=>Y,SmpAesCrypt:()=>ue,SmpApiCommonUtils:()=>ft,SmpBrowserCache:()=>Re,SmpCommonUtils:()=>bt,SmpCrypto:()=>Ve,SmpErrorResponse:()=>L,SmpFilterException:()=>Ot,SmpFirebaseErrors:()=>ve,SmpGenericResponse:()=>ae,SmpGiftcardTransaction:()=>Ze,SmpGiftcardTransactionHashStrategies:()=>ie,SmpGiftcardTransactionOps:()=>v,SmpHttpService:()=>ht,SmpHttpSessionStorageCache:()=>Ae,SmpHttpStatusCodes:()=>ct,SmpInMemoryCache:()=>be,SmpMarketingCloudValidators:()=>gs,SmpRegularExpressions:()=>Bt,SmpResponseMessage:()=>N,SmpResponseMessageTypes:()=>G,SmpRestVerbs:()=>pt,SmpSecureCode:()=>qe,SmpSid:()=>Ct,SmpSocialSignInKeys:()=>q,SmpSocialSignInUxModes:()=>he,VERSION:()=>Gs,smpNoop:()=>O});module.exports=J(Ss);var ot=require("ts-luxon");var Ee=class{static{h(this,"SmpAbstractCacheStrategy")}};var Y=class extends Ee{static{h(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isKikCachedValue(t)){if(t.expiry>=ot.DateTime.now().ts)return t.value;this._removeRaw(e);return}return t}remove(e){this._removeRaw(e)}write(e,t,r){if(isNaN(+r)||+r<=0){this._writeRaw(e,t);return}let s=ot.DateTime.now().ts+r*1e3,o={value:t,expiry:s};this._writeRaw(e,o)}_isKikCachedValue(e){return typeof e=="object"&&e!==null&&"value"in e&&"expiry"in e&&typeof e.expiry=="number"}};var Re=class extends Y{static{h(this,"SmpBrowserCache")}_storage;_prefix;constructor(e,t){super(),this._storage=e,this._prefix=t}_flushRaw(){let e=[],t=-1;for(;++t<this._storage.length;){let r=this._storage.key(t);r&&r.startsWith(this._prefix)&&e.push(r)}for(t=-1;++t<e.length;)this._storage.removeItem(e[t])}_readRaw(e){let t=this._storage.getItem(this._prefix+e);try{return t?JSON.parse(t):void 0}catch{console.warn(`${this.constructor.name}: failed to parse cache item for key ${this._prefix+e}`);return}}_removeRaw(e){this._storage.removeItem(this._prefix+e)}_writeRaw(e,t){try{this._storage.setItem(this._prefix+e,JSON.stringify(t))}catch(r){console.warn(`${this.constructor.name}: failed to write cache item for key ${this._prefix+e}`,r)}}};var Ae=class extends Re{static{h(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var be=class extends Y{static{h(this,"SmpInMemoryCache")}static _storage=new Map;get _staticSelf(){return this.constructor}_flushRaw(){this._staticSelf._storage.clear()}_readRaw(e){return this._staticSelf._storage.get(e)}_removeRaw(e){this._staticSelf._storage.delete(e)}_writeRaw(e,t){this._staticSelf._storage.set(e,t)}};var Oe=require("class-transformer");var S=require("class-transformer");var nt=require("class-transformer");var G=function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i}({});function zt(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}h(zt,"_ts_decorate");function Ne(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(Ne,"_ts_metadata");var N=class i{static{h(this,"SmpResponseMessage")}_message;_type;get message(){return this._message}get type(){return this._type}constructor(e,t=G.ERROR){this._message=e,this._type=t}static sanitizeMessages(e){return typeof e=="string"?e.length?[new i(e)]:[]:[e].flat().map(t=>typeof t=="string"?new i(t):t)}};zt([(0,nt.Expose)(),Ne("design:type",String),Ne("design:paramtypes",[])],N.prototype,"message",null);zt([(0,nt.Expose)(),Ne("design:type",typeof G>"u"?Object:G),Ne("design:paramtypes",[])],N.prototype,"type",null);function hs(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}h(hs,"_ts_decorate");function $t(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h($t,"_ts_metadata");var ae=class i{static{h(this,"SmpGenericResponse")}_messages;data;set messages(e){this._messages=N.sanitizeMessages(e)}get messages(){return this._messages}constructor(e=[],t){this._messages=e,this.data=t}static buildInfo(e,t){return new i([e].flat().map(r=>new N(r,G.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new N(r,G.SUCCESS)),t)}static fromPlain(e){return(0,S.plainToInstance)(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,S.instanceToPlain)(this,{excludePrefixes:["_"]})}};hs([(0,S.Expose)(),(0,S.Transform)(({value:i})=>i?.length?i:void 0),$t("design:type",Object),$t("design:paramtypes",[])],ae.prototype,"messages",null);function Kt(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}h(Kt,"_ts_decorate");function Te(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(Te,"_ts_metadata");function at(){return[new N("GENERIC_ERROR")]}h(at,"getDefaultMessages");var L=class i extends ae{static{h(this,"SmpErrorResponse")}_errorCode;_status;get errorCode(){return this._errorCode}get status(){return this._status}get timestamp(){return this._timestamp}_timestamp;constructor(e=at(),t="GENERIC_ERROR",r=500,s){super(e,s),this._errorCode=t,this._status=r,this._timestamp=Date.now()}static build(e=at(),t,r,s){return new i(N.sanitizeMessages(e),t,r,s)}static create({messages:e=at(),...t}){return new i(N.sanitizeMessages(e),t.errorCode,t.status,t.data)}static fromPlain(e){let t=(0,Oe.plainToInstance)(cs,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Kt([(0,Oe.Expose)(),Te("design:type",Object),Te("design:paramtypes",[])],L.prototype,"errorCode",null);Kt([(0,Oe.Expose)(),Te("design:type",Number),Te("design:paramtypes",[])],L.prototype,"timestamp",null);var cs=class extends L{static{h(this,"SmpErrorResponseMutable")}set errorCode(e){this._errorCode=e}set status(e){this._status=e}set timestamp(e){this._timestamp=e}};var ht=class{static{h(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new Ae:new be;static _config={cachePrefix:this._cachePrefix,shared:new Map};static _errorClass=L;static _mergeParamsFallbackBaseUrl="https://ts-mapi-core";static $http(e){return this._generateAjax(e)}static async _generateAjax(e){if(e.cacheKey){let t=this._cacheRead(e.cacheKey);return t?Promise.resolve(t):this._generateAjaxBase(e).then(r=>(e.cacheKey&&this._cacheWrite(e.cacheKey,r),r))}return this._generateAjaxBase(e)}static async _generateAjaxBase(e){let t=await this._preprocessRequest(e),r={method:t.method,headers:new Headers({"content-type":"application/json",...t.headers}),body:t.body?JSON.stringify(t.body):null};return t.useCredentials&&(r.credentials="include"),t.url=this.mergeQueryParams(t.url,t.queryParams),fetch(t.url,r).then(s=>this._preprocessResponse(e,s)).then(s=>{if(s.ok){if(s.status===204||s.headers.get("content-length")==="0")return null;switch(t.responseType){case"blob":return s.blob();case"arraybuffer":return s.arrayBuffer();case"text":return s.text();case"json":default:return s.json()}}return s.json().then(o=>{let n=o;try{n=this._errorClass.fromPlain(o)}catch(a){console.debug("http: failed to parse error response into ErrorResponse",a)}return Promise.reject({status:s.status,message:s.statusText,body:n})})})}static cacheFlush(){this._cacheStrategy.flush()}static mergeQueryParams(e,t){let r=e.startsWith("http");if(t){let s=new URL(e,globalThis?.location?.origin||this._mergeParamsFallbackBaseUrl),o=Object.fromEntries(s.searchParams.entries());s.search=new URLSearchParams({...o,...Object.fromEntries(Object.entries(t).map(([n,a])=>[n,`${a}`]))}).toString(),e=r?s.href:s.pathname+s.search}return e}static _cacheKey(e){return`${this._config.cachePrefix}${e}`}static _cachePop(e){let t=this._cacheRead(e);return this._cacheRemove(e),t}static _cacheRead(e){return this._cacheStrategy.read(this._cacheKey(e))}static _cacheRemove(e){this._cacheStrategy.remove(this._cacheKey(e))}static _cacheWrite(e,t){this._cacheStrategy.write(this._cacheKey(e),t)}static async _preprocessRequest(e){return e}static async _preprocessResponse(e,t){return t}};var ct=function(i){return i[i.Continue=100]="Continue",i[i.SwitchingProtocols=101]="SwitchingProtocols",i[i.Processing=102]="Processing",i[i.EarlyHints=103]="EarlyHints",i[i.Ok=200]="Ok",i[i.Created=201]="Created",i[i.Accepted=202]="Accepted",i[i.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",i[i.NoContent=204]="NoContent",i[i.ResetContent=205]="ResetContent",i[i.PartialContent=206]="PartialContent",i[i.MultiStatus=207]="MultiStatus",i[i.AlreadyReported=208]="AlreadyReported",i[i.ImUsed=226]="ImUsed",i[i.MultipleChoices=300]="MultipleChoices",i[i.MovedPermanently=301]="MovedPermanently",i[i.Found=302]="Found",i[i.SeeOther=303]="SeeOther",i[i.NotModified=304]="NotModified",i[i.UseProxy=305]="UseProxy",i[i.Unused=306]="Unused",i[i.TemporaryRedirect=307]="TemporaryRedirect",i[i.PermanentRedirect=308]="PermanentRedirect",i[i.BadRequest=400]="BadRequest",i[i.Unauthorized=401]="Unauthorized",i[i.PaymentRequired=402]="PaymentRequired",i[i.Forbidden=403]="Forbidden",i[i.NotFound=404]="NotFound",i[i.MethodNotAllowed=405]="MethodNotAllowed",i[i.NotAcceptable=406]="NotAcceptable",i[i.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",i[i.RequestTimeout=408]="RequestTimeout",i[i.Conflict=409]="Conflict",i[i.Gone=410]="Gone",i[i.LengthRequired=411]="LengthRequired",i[i.PreconditionFailed=412]="PreconditionFailed",i[i.PayloadTooLarge=413]="PayloadTooLarge",i[i.UriTooLong=414]="UriTooLong",i[i.UnsupportedMediaType=415]="UnsupportedMediaType",i[i.RangeNotSatisfiable=416]="RangeNotSatisfiable",i[i.ExpectationFailed=417]="ExpectationFailed",i[i.ImATeapot=418]="ImATeapot",i[i.MisdirectedRequest=421]="MisdirectedRequest",i[i.UnprocessableEntity=422]="UnprocessableEntity",i[i.Locked=423]="Locked",i[i.FailedDependency=424]="FailedDependency",i[i.TooEarly=425]="TooEarly",i[i.UpgradeRequired=426]="UpgradeRequired",i[i.PreconditionRequired=428]="PreconditionRequired",i[i.TooManyRequests=429]="TooManyRequests",i[i.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",i[i.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",i[i.InternalServerError=500]="InternalServerError",i[i.NotImplemented=501]="NotImplemented",i[i.BadGateway=502]="BadGateway",i[i.ServiceUnavailable=503]="ServiceUnavailable",i[i.GatewayTimeout=504]="GatewayTimeout",i[i.HttpVersionNotSupported=505]="HttpVersionNotSupported",i[i.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",i[i.InsufficientStorage=507]="InsufficientStorage",i[i.LoopDetected=508]="LoopDetected",i[i.NotExtended=510]="NotExtended",i[i.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",i}({});Ie();var ft=class{static{h(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new V;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,s)=>{let o=t[s];return o!==void 0?encodeURIComponent(o):r})}catch(r){this._logger.warn("KikApiCommonUtils: couldn't interpolate params",r)}return e}};var ds={status:"OK"};var pt=function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i}({});var X=class{static{h(this,"Hex")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s+=2)r[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new _(r,t/2)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push((s>>>4).toString(16)),t.push((s&15).toString(16))}return t.join("")}};var _=class ut{static{h(this,"WordArray")}constructor(e,t){this.words=e||[],t!==void 0?this.sigBytes=t:this.sigBytes=this.words.length*4}static random(e){let t=[],r=h(function(s){let o=987654321,n=4294967295;return function(){o=36969*(o&65535)+(o>>16)&n,s=18e3*(s&65535)+(s>>16)&n;let a=(o<<16)+s&n;return a/=4294967296,a+=.5,a*(Math.random()>.5?1:-1)}},"r");for(let s=0,o;s<e;s+=4){let n=r((o||Math.random())*4294967296);o=n()*987654071,t.push(n()*4294967296|0)}return new ut(t,e)}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new ut(this.words.slice(0),this.sigBytes)}concat(e){if(this.clamp(),this.sigBytes%4)for(let t=0;t<e.sigBytes;t++){let r=e.words[t>>>2]>>>24-t%4*8&255;this.words[this.sigBytes+t>>>2]|=r<<24-(this.sigBytes+t)%4*8}else for(let t=0;t<e.sigBytes;t+=4)this.words[this.sigBytes+t>>>2]=e.words[t>>>2];return this.sigBytes+=e.sigBytes,this}toString(e){return(e||X).stringify(this)}};var Me=class{static{h(this,"Latin1")}static parse(e){let t=e.length,r=[];for(let s=0;s<t;s++)r[s>>>2]|=(e.charCodeAt(s)&255)<<24-s%4*8;return new _(r,t)}static stringify(e){let t=[];for(let r=0;r<e.sigBytes;r++){let s=e.words[r>>>2]>>>24-r%4*8&255;t.push(String.fromCharCode(s))}return t.join("")}};var I=class{static{h(this,"Utf8")}static parse(e){return Me.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(Me.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var je=class{static{h(this,"BufferedBlockAlgorithm")}constructor(e){this._minBufferSize=0,this.cfg=Object.assign({blockSize:1},e),this._data=new _,this._nDataBytes=0}clone(){let e=this.constructor();for(let t in this)Object.prototype.hasOwnProperty.call(this,t)&&(e[t]=this[t]);return e._data=this._data.clone(),e}reset(){this._data=new _,this._nDataBytes=0}_append(e){typeof e=="string"&&(e=I.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes}_process(e){if(!this.cfg.blockSize)throw new Error("missing blockSize in config");let t=this.cfg.blockSize*4,r=this._data.sigBytes/t;e?r=Math.ceil(r):r=Math.max((r|0)-this._minBufferSize,0);let s=r*this.cfg.blockSize,o=Math.min(s*4,this._data.sigBytes),n;if(s){for(let a=0;a<s;a+=this.cfg.blockSize)this._doProcessBlock(this._data.words,a);n=this._data.words.splice(0,s),this._data.sigBytes-=o}return new _(n,o)}};var ce=class{static{h(this,"CipherParams")}constructor(e){this.ciphertext=e.ciphertext,this.key=e.key,this.iv=e.iv,this.salt=e.salt,this.algorithm=e.algorithm,this.mode=e.mode,this.padding=e.padding,this.blockSize=e.blockSize,this.formatter=e.formatter}extend(e){return e.ciphertext!==void 0&&(this.ciphertext=e.ciphertext),e.key!==void 0&&(this.key=e.key),e.iv!==void 0&&(this.iv=e.iv),e.salt!==void 0&&(this.salt=e.salt),e.algorithm!==void 0&&(this.algorithm=e.algorithm),e.mode!==void 0&&(this.mode=e.mode),e.padding!==void 0&&(this.padding=e.padding),e.blockSize!==void 0&&(this.blockSize=e.blockSize),e.formatter!==void 0&&(this.formatter=e.formatter),this}toString(e){if(e)return e.stringify(this);if(this.formatter)return this.formatter.stringify(this);throw new Error("cipher needs a formatter to be able to convert the result into a string")}};var $=class{static{h(this,"Base64")}static parse(e){let t=e.length;if(this._reverseMap===void 0){this._reverseMap=[];for(let s=0;s<this._map.length;s++)this._reverseMap[this._map.charCodeAt(s)]=s}let r=this._map.charAt(64);if(r){let s=e.indexOf(r);s!==-1&&(t=s)}return this.parseLoop(e,t,this._reverseMap)}static parseLoop(e,t,r){let s=[],o=0;for(let n=0;n<t;n++)if(n%4){let a=r[e.charCodeAt(n-1)]<<n%4*2,c=r[e.charCodeAt(n)]>>>6-n%4*2;s[o>>>2]|=(a|c)<<24-o%4*8,o++}return new _(s,o)}static stringify(e){e.clamp();let t=[];for(let s=0;s<e.sigBytes;s+=3){let o=e.words[s>>>2]>>>24-s%4*8&255,n=e.words[s+1>>>2]>>>24-(s+1)%4*8&255,a=e.words[s+2>>>2]>>>24-(s+2)%4*8&255,c=o<<16|n<<8|a;for(let p=0;p<4&&s+p*.75<e.sigBytes;p++)t.push(this._map.charAt(c>>>6*(3-p)&63))}let r=this._map.charAt(64);if(r)for(;t.length%4;)t.push(r);return t.join("")}};$._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";$._reverseMap=void 0;var Le=class{static{h(this,"OpenSSL")}static parse(e){let t=$.parse(e),r;return t.words[0]===1398893684&&t.words[1]===1701076831&&(r=new _(t.words.slice(2,4)),t.words.splice(0,4),t.sigBytes-=16),new ce({ciphertext:t,salt:r})}static stringify(e){if(!e.ciphertext)throw new Error("missing ciphertext in params");let t=e.ciphertext,r=e.salt,s;if(r){if(typeof r=="string")throw new Error("salt is expected to be a WordArray");s=new _([1398893684,1701076831]).concat(r).concat(t)}else s=t;return s.toString($)}};var Q=class{static{h(this,"SerializableCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(!o.format)throw new Error("could not determine format");if(t=this._parse(t,o.format),!t.ciphertext)throw new Error("could not determine ciphertext");return e.createDecryptor(r,o).finalize(t.ciphertext)}static encrypt(e,t,r,s){let o=Object.assign({},this.cfg,s),n=e.createEncryptor(r,o),a=n.finalize(t);return new ce({ciphertext:a,key:r,iv:n.cfg.iv,algorithm:e,mode:n.cfg.mode,padding:n.cfg.padding,blockSize:n.cfg.blockSize,formatter:o.format})}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};Q.cfg={blockSize:4,iv:new _([]),format:Le};var b=class extends je{static{h(this,"Hasher")}constructor(e){super(Object.assign({blockSize:512/32},e)),this.reset()}static _createHelper(e){function t(r,s){return new e(s).finalize(r)}return h(t,"helper"),t}finalize(e){return e&&this._append(e),this._doFinalize()}update(e){return this._append(e),this._process(),this}};var d=[];for(let i=0;i<64;i++)d[i]=Math.abs(Math.sin(i+1))*4294967296|0;var K=class f extends b{static{h(this,"MD5")}get hash(){return this._hash}static FF(e,t,r,s,o,n,a){let c=e+(t&r|~t&s)+o+a;return(c<<n|c>>>32-n)+t}static GG(e,t,r,s,o,n,a){let c=e+(t&s|r&~s)+o+a;return(c<<n|c>>>32-n)+t}static HH(e,t,r,s,o,n,a){let c=e+(t^r^s)+o+a;return(c<<n|c>>>32-n)+t}static II(e,t,r,s,o,n,a){let c=e+(r^(t|~s))+o+a;return(c<<n|c>>>32-n)+t}reset(){super.reset(),this._hash=new _([1732584193,4023233417,2562383102,271733878])}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;this._data.words[t>>>5]|=128<<24-t%32;let r=Math.floor(e/4294967296),s=e;this._data.words[(t+64>>>9<<4)+15]=(r<<8|r>>>24)&16711935|(r<<24|r>>>8)&4278255360,this._data.words[(t+64>>>9<<4)+14]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,this._data.sigBytes=(this._data.words.length+1)*4,this._process();for(let o=0;o<4;o++)this._hash.words[o]=(this._hash.words[o]<<8|this._hash.words[o]>>>24)&16711935|(this._hash.words[o]<<24|this._hash.words[o]>>>8)&4278255360;return this._hash}_doProcessBlock(e,t){for(let c=0;c<16;c++){let p=t+c,m=e[p];e[p]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}let r=Array.from({length:16});for(let c=0;c<16;c++)r[c]=e[t+c];let s=this._hash.words[0],o=this._hash.words[1],n=this._hash.words[2],a=this._hash.words[3];s=f.FF(s,o,n,a,r[0],7,d[0]),a=f.FF(a,s,o,n,r[1],12,d[1]),n=f.FF(n,a,s,o,r[2],17,d[2]),o=f.FF(o,n,a,s,r[3],22,d[3]),s=f.FF(s,o,n,a,r[4],7,d[4]),a=f.FF(a,s,o,n,r[5],12,d[5]),n=f.FF(n,a,s,o,r[6],17,d[6]),o=f.FF(o,n,a,s,r[7],22,d[7]),s=f.FF(s,o,n,a,r[8],7,d[8]),a=f.FF(a,s,o,n,r[9],12,d[9]),n=f.FF(n,a,s,o,r[10],17,d[10]),o=f.FF(o,n,a,s,r[11],22,d[11]),s=f.FF(s,o,n,a,r[12],7,d[12]),a=f.FF(a,s,o,n,r[13],12,d[13]),n=f.FF(n,a,s,o,r[14],17,d[14]),o=f.FF(o,n,a,s,r[15],22,d[15]),s=f.GG(s,o,n,a,r[1],5,d[16]),a=f.GG(a,s,o,n,r[6],9,d[17]),n=f.GG(n,a,s,o,r[11],14,d[18]),o=f.GG(o,n,a,s,r[0],20,d[19]),s=f.GG(s,o,n,a,r[5],5,d[20]),a=f.GG(a,s,o,n,r[10],9,d[21]),n=f.GG(n,a,s,o,r[15],14,d[22]),o=f.GG(o,n,a,s,r[4],20,d[23]),s=f.GG(s,o,n,a,r[9],5,d[24]),a=f.GG(a,s,o,n,r[14],9,d[25]),n=f.GG(n,a,s,o,r[3],14,d[26]),o=f.GG(o,n,a,s,r[8],20,d[27]),s=f.GG(s,o,n,a,r[13],5,d[28]),a=f.GG(a,s,o,n,r[2],9,d[29]),n=f.GG(n,a,s,o,r[7],14,d[30]),o=f.GG(o,n,a,s,r[12],20,d[31]),s=f.HH(s,o,n,a,r[5],4,d[32]),a=f.HH(a,s,o,n,r[8],11,d[33]),n=f.HH(n,a,s,o,r[11],16,d[34]),o=f.HH(o,n,a,s,r[14],23,d[35]),s=f.HH(s,o,n,a,r[1],4,d[36]),a=f.HH(a,s,o,n,r[4],11,d[37]),n=f.HH(n,a,s,o,r[7],16,d[38]),o=f.HH(o,n,a,s,r[10],23,d[39]),s=f.HH(s,o,n,a,r[13],4,d[40]),a=f.HH(a,s,o,n,r[0],11,d[41]),n=f.HH(n,a,s,o,r[3],16,d[42]),o=f.HH(o,n,a,s,r[6],23,d[43]),s=f.HH(s,o,n,a,r[9],4,d[44]),a=f.HH(a,s,o,n,r[12],11,d[45]),n=f.HH(n,a,s,o,r[15],16,d[46]),o=f.HH(o,n,a,s,r[2],23,d[47]),s=f.II(s,o,n,a,r[0],6,d[48]),a=f.II(a,s,o,n,r[7],10,d[49]),n=f.II(n,a,s,o,r[14],15,d[50]),o=f.II(o,n,a,s,r[5],21,d[51]),s=f.II(s,o,n,a,r[12],6,d[52]),a=f.II(a,s,o,n,r[3],10,d[53]),n=f.II(n,a,s,o,r[10],15,d[54]),o=f.II(o,n,a,s,r[1],21,d[55]),s=f.II(s,o,n,a,r[8],6,d[56]),a=f.II(a,s,o,n,r[15],10,d[57]),n=f.II(n,a,s,o,r[6],15,d[58]),o=f.II(o,n,a,s,r[13],21,d[59]),s=f.II(s,o,n,a,r[4],6,d[60]),a=f.II(a,s,o,n,r[11],10,d[61]),n=f.II(n,a,s,o,r[2],15,d[62]),o=f.II(o,n,a,s,r[9],21,d[63]),this._hash.words[0]=this._hash.words[0]+s|0,this._hash.words[1]=this._hash.words[1]+o|0,this._hash.words[2]=this._hash.words[2]+n|0,this._hash.words[3]=this._hash.words[3]+a|0}};var gt=class Qt{static{h(this,"EVPKDF")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:K,iterations:1},e)}static execute(e,t,r){return new Qt(r).compute(e,t)}compute(e,t){let r=new this.cfg.hasher,s=new _,o;for(;s.words.length<this.cfg.keySize;){o&&r.update(o),o=r.update(e).finalize(t),r.reset();for(let n=1;n<this.cfg.iterations;n++)o=r.finalize(o),r.reset();s.concat(o)}return s.sigBytes=this.cfg.keySize*4,s}};var er=class{static{h(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=_.random(64/8));let o=new gt({keySize:t+r}).compute(e,s),n=new _(o.words.slice(t),r*4);return o.sigBytes=t*4,new ce({key:o,iv:n,salt:s})}};var ze=class{static{h(this,"PasswordBasedCipher")}static decrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(o.format===void 0)throw new Error("missing format in config");if(t=this._parse(t,o.format),o.kdf===void 0)throw new Error("the key derivation function must be set");let n=o.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv!==void 0&&(o.iv=n.iv),Q.decrypt.call(this,e,t,n.key,o)}static encrypt(e,t,r,s){let o=Object.assign({},this.cfg,s);if(o.kdf===void 0)throw new Error("missing kdf in config");let n=o.kdf.execute(r,e.keySize,e.ivSize);return n.iv!==void 0&&(o.iv=n.iv),Q.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};ze.cfg={blockSize:4,iv:new _([]),format:Le,kdf:er};var tr=class{static{h(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?ze.decrypt(this._cipher,e,t,r):Q.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?ze.encrypt(this._cipher,e,t,r):Q.encrypt(this._cipher,e,t,r)}};var le=class extends je{static{h(this,"Cipher")}constructor(e,t,r){super(Object.assign({blockSize:1},r)),this._xformMode=e,this._key=t,this.reset()}static _createHelper(e){return new tr(e)}static createDecryptor(e,t){let r=this;return new r(this._DEC_XFORM_MODE,e,t)}static createEncryptor(e,t){return new this(this._ENC_XFORM_MODE,e,t)}finalize(e){return e&&this._append(e),this._doFinalize()}process(e){return this._append(e),this._process()}};le.ivSize=4;le.keySize=4;le._DEC_XFORM_MODE=2;le._ENC_XFORM_MODE=1;var ee=class{static{h(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var $e=class{static{h(this,"BlockCipherMode")}static createDecryptor(e,t){let r=this.Decryptor;return new r(e,t)}static createEncryptor(e,t){let r=this.Encryptor;return new r(e,t)}};$e.Decryptor=ee;$e.Encryptor=ee;var rr=class extends ee{static{h(this,"CBCEncryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");this.xorBlock(e,t,this._cipher.cfg.blockSize),this._cipher.encryptBlock(e,t),this._prevBlock=e.slice(t,t+this._cipher.cfg.blockSize)}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var sr=class extends ee{static{h(this,"CBCDecryptor")}get prevBlock(){return this._prevBlock}processBlock(e,t){if(this._cipher.cfg.blockSize===void 0)throw new Error("missing blockSize in cipher config");let r=e.slice(t,t+this._cipher.cfg.blockSize);this._cipher.decryptBlock(e,t),this.xorBlock(e,t,this._cipher.cfg.blockSize),this._prevBlock=r}xorBlock(e,t,r){let s;this._iv?(s=this._iv,this._iv=void 0):s=this._prevBlock;for(let o=0;o<r;o++)e[t+o]^=s[o]}};var Z=class extends $e{static{h(this,"CBC")}};Z.Decryptor=sr;Z.Encryptor=rr;var de=class{static{h(this,"PKCS7")}static pad(e,t){let r=t*4,s=r-e.sigBytes%r,o=s<<24|s<<16|s<<8|s,n=[];for(let c=0;c<s;c+=4)n.push(o);let a=new _(n,s);e.concat(a)}static unpad(e){let t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}};var Ke=class extends le{static{h(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:Z,padding:de},r))}reset(){if(super.reset(),this.cfg.mode===void 0)throw new Error("missing mode in config");let e;this._xformMode===this.constructor._ENC_XFORM_MODE?e=this.cfg.mode.createEncryptor:(e=this.cfg.mode.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator===e?this._mode.init(this,this.cfg.iv&&this.cfg.iv.words):(this._mode=e.call(this.cfg.mode,this,this.cfg.iv&&this.cfg.iv.words),this._mode.__creator=e)}_doFinalize(){if(this.cfg.padding===void 0)throw new Error("missing padding in config");let e;if(this._xformMode===this.constructor._ENC_XFORM_MODE){if(this.cfg.blockSize===void 0)throw new Error("missing blockSize in config");this.cfg.padding.pad(this._data,this.cfg.blockSize),e=this._process(!0)}else e=this._process(!0),this.cfg.padding.unpad(e);return e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}};var l=class z{static{h(this,"X64Word")}constructor(e,t){this.high=e,this.low=t}add(e){let t=this.low+e.low|0,r=t>>>0<this.low>>>0?1:0,s=this.high+e.high+r|0;return new z(s,t)}and(e){return new z(this.high&e.high,this.low&e.low)}not(){return new z(~this.high,~this.low)}or(e){return new z(this.high|e.high,this.low|e.low)}rotL(e){return this.shiftL(e).or(this.shiftR(64-e))}rotR(e){return this.shiftR(e).or(this.shiftL(64-e))}shiftL(e){return e<32?new z(this.high<<e|this.low>>>32-e,this.low<<e):new z(this.low<<e-32,0)}shiftR(e){return e<32?new z(this.high>>>e,this.low>>>e|this.high<<32-e):new z(0,this.high>>>e-32)}xor(e){return new z(this.high^e.high,this.low^e.low)}};var ir=class mt{static{h(this,"X64WordArray")}constructor(e=[],t){this.words=e,this.sigBytes=t!==void 0?t:e.length*8}static create(e=[],t){return new mt(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new mt(e,this.sigBytes)}toX32(){let e=[];for(let t of this.words)e.push(t.high,t.low);return new _(e,this.sigBytes)}};var B=[],or=[],nr=[],ar=[],hr=[],cr=[],_t=[],wt=[],yt=[],xt=[];(function(){let i=[];for(let r=0;r<256;r++)r<128?i[r]=r<<1:i[r]=r<<1^283;let e=0,t=0;for(let r=0;r<256;r++){let s=t^t<<1^t<<2^t<<3^t<<4;s=s>>>8^s&255^99,B[e]=s,or[s]=e;let o=i[e],n=i[o],a=i[n],c=i[s]*257^s*16843008;nr[e]=c<<24|c>>>8,ar[e]=c<<16|c>>>16,hr[e]=c<<8|c>>>24,cr[e]=c,c=a*16843009^n*65537^o*257^e*16843008,_t[s]=c<<24|c>>>8,wt[s]=c<<16|c>>>16,yt[s]=c<<8|c>>>24,xt[s]=c,e?(e=o^i[i[i[a^o]]],t^=i[i[t]]):e=t=1}})();var fs=[0,1,2,4,8,16,32,64,128,27,54],We=class extends Ke{static{h(this,"AES")}constructor(e,t,r){super(e,t,r),super.reset()}decryptBlock(e,t){let r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,_t,wt,yt,xt,or),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,nr,ar,hr,cr,B)}reset(){if(super.reset(),this._nRounds&&this._keyPriorReset===this._key)return;let e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,o=((this._nRounds=r+6)+1)*4,n=this._keySchedule=[];for(let a=0;a<o;a++)if(a<r)n[a]=t[a];else{let c=n[a-1];a%r?r>6&&a%r===4&&(c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255]):(c=c<<8|c>>>24,c=B[c>>>24]<<24|B[c>>>16&255]<<16|B[c>>>8&255]<<8|B[c&255],c^=fs[a/r|0]<<24),n[a]=n[a-r]^c}this._invKeySchedule=[];for(let a=0;a<o;a++){let c=o-a,p;a%4?p=n[c]:p=n[c-4],a<4||c<=4?this._invKeySchedule[a]=p:this._invKeySchedule[a]=_t[B[p>>>24]]^wt[B[p>>>16&255]]^yt[B[p>>>8&255]]^xt[B[p&255]]}}_doCryptBlock(e,t,r,s,o,n,a,c){let p=e[t]^r[0],m=e[t+1]^r[1],g=e[t+2]^r[2],w=e[t+3]^r[3],A=4;for(let C=1;C<this._nRounds;C++){let y=s[p>>>24]^o[m>>>16&255]^n[g>>>8&255]^a[w&255]^r[A++],x=s[m>>>24]^o[g>>>16&255]^n[w>>>8&255]^a[p&255]^r[A++],U=s[g>>>24]^o[w>>>16&255]^n[p>>>8&255]^a[m&255]^r[A++],it=s[w>>>24]^o[p>>>16&255]^n[m>>>8&255]^a[g&255]^r[A++];p=y,m=x,g=U,w=it}let P=(c[p>>>24]<<24|c[m>>>16&255]<<16|c[g>>>8&255]<<8|c[w&255])^r[A++],j=(c[m>>>24]<<24|c[g>>>16&255]<<16|c[w>>>8&255]<<8|c[p&255])^r[A++],T=(c[g>>>24]<<24|c[w>>>16&255]<<16|c[p>>>8&255]<<8|c[m&255])^r[A++],k=(c[w>>>24]<<24|c[p>>>16&255]<<16|c[m>>>8&255]<<8|c[g&255])^r[A++];e[t]=P,e[t+1]=j,e[t+2]=T,e[t+3]=k}};We.keySize=256/32;var ps=[1732584193,4023233417,2562383102,271733878,3285377520],te=new Array(80),re=class extends b{static{h(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(ps.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],a=this._hash.words[4];for(let c=0;c<80;c++){if(c<16)te[c]=e[t+c]|0;else{let w=te[c-3]^te[c-8]^te[c-14]^te[c-16];te[c]=w<<1|w>>>31}let p,m;c<20?(p=s&o|~s&n,m=1518500249):c<40?(p=s^o^n,m=1859775393):c<60?(p=s&o|s&n|o&n,m=2400959708):(p=s^o^n,m=3395469782);let g=(r<<5|r>>>27)+p+a+m+te[c];a=n,n=o,o=s<<30|s>>>2,s=r,r=g|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+a|0}};var lr=[],dr=[];(function(){function i(s){let o=Math.sqrt(s);for(let n=2;n<=o;n++)if(!(s%n))return!1;return!0}h(i,"isPrime");function e(s){return(s-(s|0))*4294967296|0}h(e,"getFractionalBits");let t=2,r=0;for(;r<64;)i(t)&&(r<8&&(lr[r]=e(Math.pow(t,1/2))),dr[r]=e(Math.pow(t,1/3)),r++),t++})();var se=[],Ce=class extends b{static{h(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(lr.slice(0))}_doFinalize(){let e=this._nDataBytes*8,t=this._data.sigBytes*8;return this._data.words[t>>>5]|=128<<24-t%32,this._data.words[(t+64>>>9<<4)+14]=Math.floor(e/4294967296),this._data.words[(t+64>>>9<<4)+15]=e,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}_doProcessBlock(e,t){let r=this._hash.words[0],s=this._hash.words[1],o=this._hash.words[2],n=this._hash.words[3],a=this._hash.words[4],c=this._hash.words[5],p=this._hash.words[6],m=this._hash.words[7];for(let g=0;g<64;g++){if(g<16)se[g]=e[t+g]|0;else{let C=se[g-15],y=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,x=se[g-2],U=(x<<15|x>>>17)^(x<<13|x>>>19)^x>>>10;se[g]=y+se[g-7]+U+se[g-16]}let w=a&c^~a&p,A=r&s^r&o^s&o,P=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),j=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),T=m+j+w+dr[g]+se[g],k=P+A;m=p,p=c,c=a,a=n+T|0,n=o,o=s,s=r,r=T+k|0}this._hash.words[0]=this._hash.words[0]+r|0,this._hash.words[1]=this._hash.words[1]+s|0,this._hash.words[2]=this._hash.words[2]+o|0,this._hash.words[3]=this._hash.words[3]+n|0,this._hash.words[4]=this._hash.words[4]+a|0,this._hash.words[5]=this._hash.words[5]+c|0,this._hash.words[6]=this._hash.words[6]+p|0,this._hash.words[7]=this._hash.words[7]+m|0}};var Et=[new l(1116352408,3609767458),new l(1899447441,602891725),new l(3049323471,3964484399),new l(3921009573,2173295548),new l(961987163,4081628472),new l(1508970993,3053834265),new l(2453635748,2937671579),new l(2870763221,3664609560),new l(3624381080,2734883394),new l(310598401,1164996542),new l(607225278,1323610764),new l(1426881987,3590304994),new l(1925078388,4068182383),new l(2162078206,991336113),new l(2614888103,633803317),new l(3248222580,3479774868),new l(3835390401,2666613458),new l(4022224774,944711139),new l(264347078,2341262773),new l(604807628,2007800933),new l(770255983,1495990901),new l(1249150122,1856431235),new l(1555081692,3175218132),new l(1996064986,2198950837),new l(2554220882,3999719339),new l(2821834349,766784016),new l(2952996808,2566594879),new l(3210313671,3203337956),new l(3336571891,1034457026),new l(3584528711,2466948901),new l(113926993,3758326383),new l(338241895,168717936),new l(666307205,1188179964),new l(773529912,1546045734),new l(1294757372,1522805485),new l(1396182291,2643833823),new l(1695183700,2343527390),new l(1986661051,1014477480),new l(2177026350,1206759142),new l(2456956037,344077627),new l(2730485921,1290863460),new l(2820302411,3158454273),new l(3259730800,3505952657),new l(3345764771,106217008),new l(3516065817,3606008344),new l(3600352804,1432725776),new l(4094571909,1467031594),new l(275423344,851169720),new l(430227734,3100823752),new l(506948616,1363258195),new l(659060556,3750685593),new l(883997877,3785050280),new l(958139571,3318307427),new l(1322822218,3812723403),new l(1537002063,2003034995),new l(1747873779,3602036899),new l(1955562222,1575990012),new l(2024104815,1125592928),new l(2227730452,2716904306),new l(2361852424,442776044),new l(2428436474,593698344),new l(2756734187,3733110249),new l(3204031479,2999351573),new l(3329325298,3815920427),new l(3391569614,3928383900),new l(3515267271,566280711),new l(3940187606,3454069534),new l(4118630271,4000239992),new l(116418474,1914138554),new l(174292421,2731055270),new l(289380356,3203993006),new l(460393269,320620315),new l(685471733,587496836),new l(852142971,1086792851),new l(1017036298,365543100),new l(1126000580,2618297676),new l(1288033470,3409855158),new l(1501505948,4234509866),new l(1607167915,987167468),new l(1816402316,1246189591)],M=[];(function(){for(let i=0;i<80;i++)M[i]=new l(void 0,void 0)})();var Rt=class extends b{static{h(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new ir([new l(1779033703,4089235720),new l(3144134277,2227873595),new l(1013904242,4271175723),new l(2773480762,1595750129),new l(1359893119,2917565137),new l(2600822924,725511199),new l(528734635,4215389547),new l(1541459225,327033209)])}_doFinalize(){let e=this._data,t=e.words,r=this._nDataBytes*8,s=e.sigBytes*8;return t[s>>>5]|=128<<24-s%32,t[(s+128>>>10<<5)+30]=Math.floor(r/4294967296),t[(s+128>>>10<<5)+31]=r,e.sigBytes=t.length*4,this._process(),this._hash.toX32()}_doProcessBlock(e,t){let r=this._hash.words[0].high,s=this._hash.words[0].low,o=this._hash.words[1].high,n=this._hash.words[1].low,a=this._hash.words[2].high,c=this._hash.words[2].low,p=this._hash.words[3].high,m=this._hash.words[3].low,g=this._hash.words[4].high,w=this._hash.words[4].low,A=this._hash.words[5].high,P=this._hash.words[5].low,j=this._hash.words[6].high,T=this._hash.words[6].low,k=this._hash.words[7].high,C=this._hash.words[7].low;for(let y=0;y<80;y++){let x,U;if(y<16)U=M[y].high=e[t+y*2]|0,x=M[y].low=e[t+y*2+1]|0;else{let Ut=M[y-15],oe=Ut.high,_e=Ut.low,es=(oe>>>1|_e<<31)^(oe>>>8|_e<<24)^oe>>>7,Ft=(_e>>>1|oe<<31)^(_e>>>8|oe<<24)^(_e>>>7|oe<<25),Mt=M[y-2],ne=Mt.high,we=Mt.low,ts=(ne>>>19|we<<13)^(ne<<3|we>>>29)^ne>>>6,jt=(we>>>19|ne<<13)^(we<<3|ne>>>29)^(we>>>6|ne<<26);x=Ft+M[y-7].low,U=es+M[y-7].high+(x>>>0<Ft>>>0?1:0),x=x+jt,U=U+ts+(x>>>0<jt>>>0?1:0),x=x+M[y-16].low,U=U+M[y-16].high+(x>>>0<M[y-16].low>>>0?1:0),M[y].high=U,M[y].low=x}let it=g&A^~g&j,Nt=w&P^~w&T,Xr=r&o^r&a^o&a,Zr=s&n^s&c^n&c,Hr=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),Tt=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),Jr=(g>>>14|w<<18)^(g>>>18|w<<14)^(g<<23|w>>>9),Yr=(w>>>14|g<<18)^(w>>>18|g<<14)^(w<<23|g>>>9),D=C+Yr,W=k+Jr+(D>>>0<C>>>0?1:0);D=D+Nt,W=W+it+(D>>>0<Nt>>>0?1:0),D=D+Et[y].low,W=W+Et[y].high+(D>>>0<Et[y].low>>>0?1:0),D=D+x,W=W+U+(D>>>0<x>>>0?1:0);let kt=Tt+Zr,Qr=Hr+Xr+(kt>>>0<Tt>>>0?1:0);k=j,C=T,j=A,T=P,A=g,P=w,w=m+D|0,g=p+W+(w>>>0<m>>>0?1:0)|0,p=a,m=c,a=o,c=n,o=r,n=s,s=D+kt|0,r=W+Qr+(s>>>0<D>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+n,this._hash.words[1].high=this._hash.words[1].high+o+(this._hash.words[1].low>>>0<n>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+c,this._hash.words[2].high=this._hash.words[2].high+a+(this._hash.words[2].low>>>0<c>>>0?1:0),this._hash.words[3].low=this._hash.words[3].low=this._hash.words[3].low+m,this._hash.words[3].high=this._hash.words[3].high+p+(this._hash.words[3].low>>>0<m>>>0?1:0),this._hash.words[4].low=this._hash.words[4].low=this._hash.words[4].low+w,this._hash.words[4].high=this._hash.words[4].high+g+(this._hash.words[4].low>>>0<w>>>0?1:0),this._hash.words[5].low=this._hash.words[5].low=this._hash.words[5].low+P,this._hash.words[5].high=this._hash.words[5].high+A+(this._hash.words[5].low>>>0<P>>>0?1:0),this._hash.words[6].low=this._hash.words[6].low=this._hash.words[6].low+T,this._hash.words[6].high=this._hash.words[6].high+j+(this._hash.words[6].low>>>0<T>>>0?1:0),this._hash.words[7].low=this._hash.words[7].low=this._hash.words[7].low+C,this._hash.words[7].high=this._hash.words[7].high+k+(this._hash.words[7].low>>>0<C>>>0?1:0)}};var fr=class{static{h(this,"HMAC")}constructor(e,t){this._hasher=new e;let r=typeof t=="string"?I.parse(t):t,s=this._hasher.cfg.blockSize,o=s*4;r.sigBytes>o&&(r=this._hasher.finalize(r)),r.clamp();let n=this._oKey=r.clone(),a=this._iKey=r.clone(),c=n.words,p=a.words;for(let m=0;m<s;m++)c[m]^=1549556828,p[m]^=909522486;n.sigBytes=a.sigBytes=o,this.reset()}finalize(e){let t=this._hasher.finalize(e);return this._hasher.reset(),this._hasher.finalize(this._oKey.clone().concat(t))}reset(){this._hasher.reset(),this._hasher.update(this._iKey)}update(e){return this._hasher.update(e),this}};var At=class pr{static{h(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:Ce,iterations:25e4},e)}static execute(e,t,r){return new pr(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new fr(r.hasher,e),o=new _,n=new _([1]),a=o.words,c=n.words,p=r.keySize,m=r.iterations;for(;a.length<p;){let g=s.update(t).finalize(n);s.reset();let w=g.words,A=w.length,P=g;for(let j=1;j<m;j++){P=s.finalize(P),s.reset();let T=P.words;for(let k=0;k<A;k++)w[k]^=T[k]}o.concat(g),c[0]++}return o.sigBytes=p*4,o}};var Be=Ke._createHelper(We);var fe=b._createHelper(K);var pe=b._createHelper(re);var Ge=b._createHelper(Ce);var Se=b._createHelper(Rt);var ue=class{static{h(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?X.parse(this._initVector):void 0}_mode;_padding;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r,this._mode=Z,this._padding=de}decryptAES(e){return Be.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(e){return Be.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return At.execute(this._password,X.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:re})}};var Ve=class{static{h(this,"SmpCrypto")}static base64Decode(e){return I.stringify($.parse(e))}static base64Encode(e){return $.stringify(I.parse(e))}static md5(e){return fe(e).toString()}static sha1(e){return pe(e).toString()}static sha256(e){return Ge(e).toString()}static sha512(e){return Se(e).toString()}};var qe=class{static{h(this,"SmpSecureCode")}_baseCode;get baseCode(){return this._baseCode}get secureCode(){return this._encode()}_crcLength;_seed;constructor(e){this._baseCode=e,this._crcLength=5,this._seed="changeme"}static check(e,t){if(new this(e).secureCode!==t)throw L.build("WRONG_SECURE_CODE","WRONG_SECURE_CODE",ct.BadRequest)}_encode(){let e=new K;return e.update(I.parse(this._seed+this._baseCode)),e.finalize().toString(X).substring(0,this._crcLength).toUpperCase()}};var ge=require("class-transformer"),Xe=require("ts-luxon");var v=function(i){return i.ACTIVATE="ACTIVATE",i.BLOCK="BLOCK",i.CHECK="CHECK",i.DIGITAL_ACTIVATE="DIGITAL_ACTIVATE",i.FREEZE="FREEZE",i.PURCHASE="PURCHASE",i.RECHARGE="RECHARGE",i.ROLLBACK="ROLLBACK",i.TRANSACTION="TRANSACTION",i.TRANSACTION_DETAIL="TRANSACTION_DETAIL",i.UNFREEZE="UNFREEZE",i.XREFUND="XREFUND",i}({});var ie=function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i}({});function us(i,e,t,r){var s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,r);else for(var a=i.length-1;a>=0;a--)(n=i[a])&&(o=(s<3?n(o):s>3?n(e,t,o):n(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}h(us,"_ts_decorate");function ur(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}h(ur,"_ts_metadata");var Ze=class{static{h(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new ue("changeme","5f6eae61d2428b99","d92fbf214e16a79fd36f9a5185ae733f");static _LOGGER=console;static _OP_CODES={[v.CHECK]:"",[v.TRANSACTION]:"",[v.TRANSACTION_DETAIL]:"",[v.ACTIVATE]:"A",[v.BLOCK]:"B",[v.DIGITAL_ACTIVATE]:"D",[v.FREEZE]:"F",[v.PURCHASE]:"P",[v.RECHARGE]:"G",[v.ROLLBACK]:"R",[v.UNFREEZE]:"U",[v.XREFUND]:"X"};static _SEP="_";get dto(){return this._dto}get hash(){return this._hashStrategy(this.toString()).toString()}get iso(){return this.dto.toUTC().toISO()}get ts(){return this._dto.ts}_dto;_hashStrategies;_hashStrategy;constructor(e="ACTIVATION",t,r,s){this.gc=e,this.op=t,this.ot=r,this._hashStrategies={[ie.MD5]:o=>fe(o),[ie.MD5_HMAC]:o=>{let n=new K;return n.update(I.parse(o)),n.finalize()},[ie.SHA1]:o=>pe(o),[ie.SHA1_HMAC]:o=>{let n=new re;return n.update(I.parse(o)),n.finalize()}},this._hashStrategy=this._hashStrategies[ie.MD5],this._dto=typeof s=="number"&&s>=0?Xe.DateTime.fromMillis(+`${s}000`.slice(0,13)):Xe.DateTime.local()}static build({gc:e,op:t,ot:r,dto:s}){return new this(e,t,r,s?.ts)}static explode(e){let t=this.constructor,r=(e||"").split(t._SEP);if(r.length<4)throw new Error(`INVALID_TRANSACTION "${e}"`);return this.build({gc:r[1],op:t.prefixToOperation(r[2]),dto:Xe.DateTime.fromSeconds(+r[3])})}static isBase64(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)&&e.length%4===0}static parse(e){this._LOGGER.info(`${this.constructor.name}: trying to parse ${e}`);try{if(this.isBase64(e)){let t=this.constructor._AES_ENCODER.decryptAES(e),r=JSON.parse(t);return(0,ge.plainToInstance)(this,r)}else return this.explode(e)}catch(t){throw this._LOGGER.error(`${this.constructor.name}: failed to parse ${e}`,t),new Error(`UNPARSEABLE "${e}"`)}}static prefixToOperation(e){return Object.entries(this._OP_CODES).find(([,r])=>r===e)[0]}serialize(){return(0,ge.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};us([(0,ge.Expose)(),ur("design:type",Number),ur("design:paramtypes",[])],Ze.prototype,"ts",null);var gs=function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i}({});var ms=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function mr(i){return i.match(ms)}h(mr,"smpAsciiWords");var Rr="\\ud800-\\udfff",_s="\\u0300-\\u036f",ws="\\ufe20-\\ufe2f",ys="\\u20d0-\\u20ff",xs="\\u1ab0-\\u1aff",Es="\\u1dc0-\\u1dff",Rs=_s+ws+ys+xs+Es,Ar="\\u2700-\\u27bf",br="a-z\\xdf-\\xf6\\xf8-\\xff",As="\\xac\\xb1\\xd7\\xf7",bs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Os="\\u2000-\\u206f",Is=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Or="A-Z\\xc0-\\xd6\\xd8-\\xde",Cs="\\ufe0e\\ufe0f",Ir=As+bs+Os+Is,Cr="['\u2019]",_r=`[${Ir}]`,Bs=`[${Rs}]`,Br="\\d",vs=`[${Ar}]`,vr=`[${br}]`,Pr=`[^${Rr}${Ir+Br+Ar+br+Or}]`,Ps="\\ud83c[\\udffb-\\udfff]",Ds=`(?:${Bs}|${Ps})`,Ns=`[^${Rr}]`,Dr="(?:\\ud83c[\\udde6-\\uddff]){2}",Nr="[\\ud800-\\udbff][\\udc00-\\udfff]",me=`[${Or}]`,Ts="\\u200d",wr=`(?:${vr}|${Pr})`,ks=`(?:${me}|${Pr})`,yr=`(?:${Cr}(?:d|ll|m|re|s|t|ve))?`,xr=`(?:${Cr}(?:D|LL|M|RE|S|T|VE))?`,Tr=`${Ds}?`,kr=`[${Cs}]?`,Us=`(?:${Ts}(?:${[Ns,Dr,Nr].join("|")})${kr+Tr})*`,Fs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ms="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",js=kr+Tr+Us,Er=`(?:${[vs,Dr,Nr].join("|")})${js}`,Pe=class{static{h(this,"SmpUnicodeWords")}static HAS_UNICODE_WORD=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/);static RE_UNICODE_WORDS=RegExp([`${me}?${vr}+${yr}(?=${[_r,me,"$"].join("|")})`,`${ks}+${xr}(?=${[_r,me+wr,"$"].join("|")})`,`${me}?${wr}+${yr}`,`${me}+${xr}`,Ms,Fs,`${Br}+`,Er].join("|"),"g");static RS_EMOJI=Er;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var bt=class i{static{h(this,"SmpCommonUtils")}static arrayRemove(e,t){let r=[],s=e.filter((o,n)=>t(o,n)&&r.push(n));return r.reverse().forEach(o=>e.splice(o,1)),s}static assertIsArray(e,t){if(!Array.isArray(e))throw new Error(t||"KikCommonUtils => val was not an array")}static assertIsBoolean(e,t){if(!this.isBoolean(e))throw new Error(t||"KikCommonUtils => val was not boolean")}static assertIsFunction(e,t){if(!this.isFunction(e))throw new Error(t||"KikCommonUtils => entity was not a function")}static assertIsInstance(e,t,r){if(!(e instanceof t))throw new Error(r||"KikCommonUtils => val was not instance of class")}static assertIsNotEmpty(e,t){if(this.isEmpty(e))throw new Error(t||"KikCommonUtils => entity was empty")}static assertIsNumber(e,t){if(typeof e!="number")throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsNumeric(e,t){if(!this.isNumeric(e))throw new Error(t||"KikCommonUtils => val was not numeric")}static assertIsObject(e,t){if(!this.isObject(e))throw new Error(t||"KikCommonUtils => val was not an object")}static assertIsString(e,t){if(!this.isString(e))throw new Error(t||"KikCommonUtils => val was not a string")}static assertIsTruthy(e,t){if(!e)throw new Error(t||"KikCommonUtils => condition wasn't truthy")}static buildPath(...e){let t=e.filter(r=>!!r).join("/").replace(/(?<!:)\/\/+/g,"/");return t.startsWith("http")&&!t.endsWith("/")?`${t}/`:t}static downloadBlob(e,t){let r=window.URL.createObjectURL(e),s=document.createElement("a");s.href=r,s.setAttribute("download",t),document.body.appendChild(s),s.click()}static generateRandomHexString(e=12){let t="0123456789abcdef",r="";for(let s=0;s<e;s++){let o=Math.floor(Math.random()*t.length);r+=t[o]}return r}static generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}static getDecimalPrecision(e){if(this.assertIsNumeric(e),!isFinite(+e))return 0;let t=1,r=0;for(;Math.round(+e*t)/t!==e;)t*=10,r++;return r}static getType(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}static isBoolean(e){return typeof e=="boolean"}static isColor(e){if(!e||!this.isString(e))return!1;let t=new Option().style;return t.color=e,t.color!==""}static isEmpty(e){return!e&&e!==0}static isEqual(e,t){function r(){if(e.length!==t.length)return!1;for(let c=0;c<e.length;c++)if(!i.isEqual(e[c],t[c]))return!1;return!0}h(r,"areArraysEqual");function s(){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let c in e)if(Object.prototype.hasOwnProperty.call(e,c)&&!i.isEqual(e[c],t[c]))return!1;return!0}h(s,"areObjectsEqual");function o(){return e.toString()===t.toString()}h(o,"areFunctionsEqual");function n(){return e===t}h(n,"arePrimativesEqual");let a=this.getType(e);return a!==this.getType(t)?!1:a==="array"?r():a==="object"?s():a==="function"?o():n()}static isFormField(e){return/^(?:input|select|textarea|button)$/i.test(e.nodeName)}static isFunction(e){return typeof e==typeof isNaN}static isNotEmpty(e){return!this.isEmpty(e)}static isNumber(e){return typeof e=="number"&&this.isNumeric(e)}static isNumeric(e){return!isNaN(e)}static isObject(e){return!!e&&e===Object(e)&&e.constructor===Object}static isPrimitive(e){let t=this.getType(e);return t!=="function"&&(t!=="object"||!e)}static isString(e){return typeof e=="string"}static isWindows(){return navigator.userAgent.toLowerCase().includes("win")}static mapObject(e,t){if(this.assertIsFunction(t,`CommonUtils => expected type of iteratee to be Function, got ${typeof t}`),this.isObject(e))return Object.entries(e).reduce((r,[s,o])=>(r.push(t(o,s)),r),[]);if(Array.isArray(e))return e.map(t);throw new Error(`CommonUtils => invalid object provided. Expected Object or Array, got ${typeof t}`)}static mapObjectKeys(e,t){return Object.entries(e).reduce((r,[s,o])=>(r[s]=t.call(null,s,o),r),{})}static mapObjectValues(e,t){return this.isObject(e)?Object.entries(e).reduce((r,[s,o])=>(r[s]=t.call(null,o,s),r),{}):{}}static noop(){}static objectHasValue(e,t){return!!~Object.values(e).filter(r=>this.isEqual(r,t))}static parseBoolean(e){return e?/^true$/i.test(e):!1}static parseJsonSafely(e){try{return JSON.parse(e)}catch(t){console.warn("KikCommonUtils => couldn't parse json string",{str:e,error:t});return}}static pick(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}static runSafely(e,t=null,r=[]){if(this.isFunction(e))return e.apply(t,r)}static sleep(e){return new Promise(t=>setTimeout(t,e))}static sprintf(e,...t){return this.isString(e)&&t.length?this.sprintf(e.replace("%s",String(t.shift())),...t):e}static stripComments(e){return typeof e=="string"?e.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,""):e}static submitFakeForm({action:e,method:t=pt.POST,data:r,target:s}){let o=Object.entries(r||{}).map(([a,c])=>`<input name="${a}" type="hidden" value="${c}" />`),n=document.createElement("form");n.method=t,n.action=e,n.innerHTML=`${o}`,n.target=s||"_self",document.body.append(n),n.submit()}static toCamelCase(e){return this.words(e.replace(/['\u2019]/g,"")).reduce((t,r,s)=>(r=r.toLowerCase(),t+(s?r.charAt(0).toUpperCase()+r.slice(1):r)),"")}static toKebabCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("-").toLowerCase()}static toPascalCase(e){return this.toCamelCase(e).replace(/^(.)/,t=>t.toUpperCase())}static toSnakeCase(e){return this.words(e.replace(/['\u2019]/g,"")).join("_").toLowerCase()}static toUpperSnakeCase(e){return this.toSnakeCase(e).toUpperCase()}static words(e,t){return t===void 0?(Pe.HAS_UNICODE_WORD(e)?Pe.unicodeWords(e):mr(e))||[]:e.match(t)||[]}};var Ot=class extends Error{static{h(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var It=require("ts-luxon");var Ct=class i{static{h(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return It.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`sid-xxxx-${+It.DateTime.now().ts}`,t=0){this.value=e,this.expiry=t,this._controlSuffix="$1"}static parse(e){return new i(e.value,e.expiry)}toPlain(){return{value:this.value,expiry:this.expiry}}};Ie();var Bt=class{static{h(this,"SmpRegularExpressions")}static get COUNTRY(){return this._country}static get DOMAIN(){return/^(?!www)(\w)([\w.-])*\.[a-z]{2,6}$/}static get EMAIL(){return/^[^\\|!"£$%&/()='?^€*[\]°#§<>,;:\s]+@[a-z0-9.-]+\.[a-z]{2,6}$/}static get LANGUAGE(){return this._language}static get LATIN_CHARS(){return/^[\u0000-\u024F\u1E00-\u1EFF\u2C60-\u2C7F\uA720-\uA7FF]+/}static get LOCALE(){return new RegExp(`${this._country.source}-${this._language.source}`)}static get NO_EMOJI_NO_PUNCTUATION(){return/[^\p{Emoji_Presentation}|\p{P}]/gu}static get PHONE_NUMBER(){return/^(\+\d{1,4}\s)(\d{4,15})$/}static get PHONE_NUMBER_BY_PREFIX(){return{"+971":{dontStartWithZero:/^(\+\d{3}\s)([1-9])/,typeExactlyNineDigits:/^(\+\d{3}\s)([1-9]\d{8}$)/}}}static get TAXCODE_BY_COUNTRY(){return{ES:{DNI:/^\d{8}[A-Z]$/,NIE:/^[A-Z]\d{7}[A-Z]$/,CIF:/^[A-Z]\d{8}$/}}}static _country=/[a-zA-Z]{2}/;static _language=/[a-z]{2}/};var Gs="1.5.0";Object.defineProperties(module.exports,{SmpDynamoService:{get:h(()=>(Mr(),J(Fr)).SmpDynamoService,"get")},SmpFirebaseService:{get:h(()=>(Lr(),J(jr)).SmpFirebaseService,"get")},smpRxjsCatchOnly:{get:h(()=>(rt(),J(tt)).smpRxjsCatchOnly,"get")},smpRxjsThrowIfEmpty:{get:h(()=>(rt(),J(tt)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:h(()=>(rt(),J(tt)).smpRxjsThrowOnCondition,"get")},smpZodDateTime:{get:h(()=>(qr(),J(Vr)).smpZodDateTime,"get")}});0&&(module.exports={SMP_HEALTHZ,SmpAbstractCacheStrategy,SmpAbstractTtlCacheStrategy,SmpAesCrypt,SmpApiCommonUtils,SmpBrowserCache,SmpCommonUtils,SmpCrypto,SmpErrorResponse,SmpFilterException,SmpFirebaseErrors,SmpGenericResponse,SmpGiftcardTransaction,SmpGiftcardTransactionHashStrategies,SmpGiftcardTransactionOps,SmpHttpService,SmpHttpSessionStorageCache,SmpHttpStatusCodes,SmpInMemoryCache,SmpMarketingCloudValidators,SmpRegularExpressions,SmpResponseMessage,SmpResponseMessageTypes,SmpRestVerbs,SmpSecureCode,SmpSid,SmpSocialSignInKeys,SmpSocialSignInUxModes,VERSION,smpNoop});
1
+ "use strict";var ds=Object.create;var be=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var ps=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,ms=Object.prototype.hasOwnProperty;var c=(i,e)=>be(i,"name",{value:e,configurable:!0});var y=(i,e)=>()=>(i&&(e=i(i=0)),e);var Oe=(i,e)=>{for(var t in e)be(i,t,{get:e[t],enumerable:!0})},Zt=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ps(e))!ms.call(i,s)&&s!==t&&be(i,s,{get:()=>e[s],enumerable:!(r=fs(e,s))||r.enumerable});return i};var gs=(i,e,t)=>(t=i!=null?ds(us(i)):{},Zt(e||!i||!i.__esModule?be(t,"default",{value:i,enumerable:!0}):t,i)),L=i=>Zt(be({},"__esModule",{value:!0}),i);var Q,lt=y(()=>{"use strict";Q=class{static{c(this,"SmpAbstractCacheStrategy")}}});function Ce(i){return typeof i=="object"&&i!==null&&"value"in i&&"expiry"in i&&typeof i.expiry=="number"}var dt=y(()=>{"use strict";c(Ce,"smpIsSmpCachedValue")});var Yt,Qt=y(()=>{"use strict";Yt=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,mt=y(()=>{"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 Le=y(()=>{"use strict";c(O,"smpNoop")});var ys,Z,gt=y(()=>{"use strict";Le();ys=class{static{c(this,"SmpConsoleOnlyMethods")}constructor(){this.group=O,this.groupCollapsed=O,this.groupEnd=O,this.time=O,this.timeEnd=O}},Z=class er extends ys{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 er).map(e=>e)}}});var tr,ze,$e,rr=y(()=>{"use strict";Qt();mt();gt();Le();ze="[DEFAULT]",$e=class extends Z{static{c(this,"SmpLoggerService")}static get INSTANCE(){return this.get(ze)}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 Yt,this._loadConfig(e)}static destroy(e){return this._instances.delete(e)}static get(e=ze){return this._instances.get(e)||this._instances.get(ze)||this._noopInstance}static init(e,t=ze){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)}};tr=$e;$e._instances=new Map;$e._level=k.OFF;$e._noopInstance=new tr({level:k.OFF})});var sr=y(()=>{"use strict"});var ir=y(()=>{"use strict"});var or=y(()=>{"use strict";sr();ir();gt();mt();Le()});var Pe=y(()=>{"use strict";rr();or()});var X,nr=y(()=>{"use strict";X=function(i){return i.APPLE="APPLE",i.FACEBOOK="FACEBOOK",i.GOOGLE="GOOGLE",i}({})});var le,ar=y(()=>{"use strict";le=function(i){return i.POPUP="POPUP",i.REDIRECT="REDIRECT",i}({})});var Fe,br=y(()=>{"use strict";Fe=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 Gr={};Oe(Gr,{SmpDynamoService:()=>Ft});var Kr,rt,tt,Ft,Vr=y(()=>{"use strict";Kr=require("@aws-sdk/client-dynamodb"),rt=require("@aws-sdk/util-dynamodb");Pe();tt=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}(tt||{}),Ft=class{static{c(this,"SmpDynamoService")}_config;_tableName;get marshall(){return rt.marshall}get unmarshall(){return rt.unmarshall}_db;_logger;constructor(e,t){this._config=e,this._tableName=t,this._db=new Kr.DynamoDB([this._buildConfig()]),this._logger=new Z}_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(tt[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(tt[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(tt[o.code]||"ERR_COULD_NOT_WRITE")))}}});var qr={};Oe(qr,{SmpFirebaseService:()=>Ut});var ke,u,Ut,Zr=y(()=>{"use strict";Pe();ke=require("firebase/app"),u=require("firebase/auth");nr();ar();br();Ut=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":X.FACEBOOK,"google.com":X.GOOGLE,"apple.com":X.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=le.POPUP;constructor(e,t){this._config=e,this._enabledSocials=t.enabledSocials||[],this._socialLoginUxMode=t.socialLoginUxMode||le.POPUP,this._popupFallsBackToRedirect=!!t.popupFallsBackToRedirect,this._buildProviders(),this._logger=t.logger||new Z,this._app=(0,ke.getApps)().length?(0,ke.getApps)()[0]:(0,ke.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),{[X.APPLE]:new u.OAuthProvider("apple.com"),[X.FACEBOOK]:new u.FacebookAuthProvider().setCustomParameters({prompt:"select_account"}),[X.GOOGLE]:new u.GoogleAuthProvider().setCustomParameters({prompt:"select_account"})})}async _expandDifferentCredential(e){if(e?.code===Fe.DIFFERENT_CREDENTIAL){let t=await this.fetchSignInMethodsForEmail(e.customData.email);throw e.code=Fe["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===le.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===Fe.POPUP_BLOCKED&&(this._logger.warn(`Firebase: social signin popup blocked (${++this._popupErrors}`),this._popupFallsBackToRedirect&&this._popupErrors>1)?(this._popupErrors=0,this._signInWithProvider(e,le.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 Xr,kt,ye,Mt=y(()=>{"use strict";Xr=require("rxjs"),kt=require("ts-luxon");lt();dt();ye=class extends Q{static{c(this,"SmpAbstractRxjsTtlCacheStrategy")}flush(){return this._flushRaw()}read(e){return this._readRaw(e).pipe((0,Xr.map)(t=>{if(this._isSmpCachedValue(t)){if(t.expiry>=kt.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=kt.DateTime.now().ts+r*1e3,o={value:t,expiry:s};return this._writeRaw(e,o,r)}_isSmpCachedValue(e){return Ce(e)}}});function Hr(i,e){return t=>t.pipe((0,st.catchError)(r=>(typeof i==typeof isNaN?Zs(i)?Xs(r,i):i(r):!1)?e(r):(0,st.throwError)(()=>r)))}function Zs(i){try{return Reflect.construct(String,[],i),!0}catch{return!1}}function Xs(i,e){return typeof i=="object"&&i!==null&&i.constructor===e}var st,Jr=y(()=>{"use strict";st=require("rxjs");c(Hr,"smpRxjsCatchOnly");c(Zs,"isConstructor");c(Xs,"isExactInstance")});var S,it,Yr=y(()=>{"use strict";S=require("rxjs");Mt();it=class extends ye{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 ot(i=Js){return e=>e.pipe((0,Qr.map)(t=>{if(~Hs.indexOf(JSON.stringify(t)))throw i(t);return t}))}var Qr,Hs,Js,jt=y(()=>{"use strict";Qr=require("rxjs");c(ot,"smpRxjsThrowIfEmpty");Hs=[void 0,null,!1,0,"","0",[],{}].map(i=>JSON.stringify(i)),Js=c(()=>new Error,"defaultErrorFactory")});function es(i,e){return t=>t.pipe((0,nt.filter)(r=>!i(r)),(0,nt.defaultIfEmpty)(!1),ot(e))}var nt,ts=y(()=>{"use strict";nt=require("rxjs");jt();c(es,"smpRxjsThrowOnCondition")});var xe={};Oe(xe,{SmpAbstractRxjsTtlCacheStrategy:()=>ye,SmpRxjsInMemoryCache:()=>it,smpRxjsCatchOnly:()=>Hr,smpRxjsThrowIfEmpty:()=>ot,smpRxjsThrowOnCondition:()=>es});var Ee=y(()=>{"use strict";Mt();Jr();Yr();jt();ts()});var R,Y,at,Ys,rs=y(()=>{"use strict";R=gs(require("zod"),1),Y=require("ts-luxon"),at=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 Y.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 Y.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 Y.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 Y.DateTime&&e.isValid)return e;let t={string:c(()=>Y.DateTime.fromJSDate(new Date(e)),"string"),number:c(()=>Y.DateTime.fromMillis(e),"number"),object:c(()=>Y.DateTime.fromJSDate(e),"object"),default:c(()=>null,"default")};return(t[typeof e]||t.default)()}},Ys=c((i={})=>new at({coerce:i.coerce??!1,checks:[]}),"smpZodDateTime")});var Lt={};Oe(Lt,{SmpZodDateTime:()=>at,smpZodDateTime:()=>Ys});var zt=y(()=>{"use strict";rs()});var ei={};Oe(ei,{SMP_HEALTHZ:()=>xs,SmpAbstractCacheStrategy:()=>Q,SmpAbstractTtlCacheStrategy:()=>ee,SmpAesCrypt:()=>ge,SmpApiCommonUtils:()=>_t,SmpBrowserCache:()=>Be,SmpCommonUtils:()=>vt,SmpCrypto:()=>Je,SmpErrorResponse:()=>z,SmpFilterException:()=>Dt,SmpFirebaseErrors:()=>Fe,SmpGenericResponse:()=>he,SmpGiftcardTransaction:()=>et,SmpGiftcardTransactionHashStrategies:()=>ne,SmpGiftcardTransactionOps:()=>v,SmpHttpService:()=>pt,SmpHttpSessionStorageCache:()=>ve,SmpHttpStatusCodes:()=>ut,SmpInMemoryCache:()=>De,SmpMarketingCloudValidators:()=>bs,SmpRegularExpressions:()=>Tt,SmpResponseMessage:()=>U,SmpResponseMessageTypes:()=>V,SmpRestVerbs:()=>wt,SmpSecureCode:()=>Ye,SmpSid:()=>Nt,SmpSocialSignInKeys:()=>X,SmpSocialSignInUxModes:()=>le,VERSION:()=>Qs,smpIsSmpCachedValue:()=>Ce,smpNoop:()=>O});module.exports=L(ei);var Ie=require("class-transformer");var q=require("class-transformer");var ht=require("class-transformer");var V=function(i){return i.INFO="INFO",i.SUCCESS="SUCCESS",i.WARNING="WARNING",i.ERROR="ERROR",i}({});function Xt(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(Xt,"_ts_decorate");function Me(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Me,"_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=V.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)}};Xt([(0,ht.Expose)(),Me("design:type",String),Me("design:paramtypes",[])],U.prototype,"message",null);Xt([(0,ht.Expose)(),Me("design:type",typeof V>"u"?Object:V),Me("design:paramtypes",[])],U.prototype,"type",null);function _s(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(_s,"_ts_decorate");function Ht(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Ht,"_ts_metadata");var he=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,V.INFO)),t)}static buildSuccess(e,t){return new i([e].flat().map(r=>new U(r,V.SUCCESS)),t)}static fromPlain(e){return(0,q.plainToInstance)(i,e)}isError(){return!this.isSuccess()}isSuccess(){return"_errorCode"in this&&this._errorCode!==null&&this._errorCode!==void 0}serialize(){return(0,q.instanceToPlain)(this,{excludePrefixes:["_"]})}};_s([(0,q.Expose)(),(0,q.Transform)(({value:i})=>i?.length?i:void 0),Ht("design:type",Object),Ht("design:paramtypes",[])],he.prototype,"messages",null);function Jt(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(Jt,"_ts_decorate");function je(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(je,"_ts_metadata");var z=class i extends he{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)(ws,e,{excludePrefixes:["_"]}),r=new i;return Object.getOwnPropertyNames(t).forEach(s=>{s in r&&(r[s]=t[s])}),r}};Jt([(0,Ie.Expose)(),je("design:type",Object),je("design:paramtypes",[])],z.prototype,"errorCode",null);Jt([(0,Ie.Expose)(),je("design:type",Number),je("design:paramtypes",[])],z.prototype,"timestamp",null);var ws=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 ft=require("ts-luxon");lt();dt();var ee=class extends Q{static{c(this,"SmpAbstractTtlCacheStrategy")}flush(){this._flushRaw()}read(e){let t=this._readRaw(e);if(this._isSmpCachedValue(t)){if(t.expiry>=ft.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=ft.DateTime.now().ts+r*1e3,o={value:t,expiry:s};this._writeRaw(e,o,r)}_isSmpCachedValue(e){return Ce(e)}};var Be=class extends ee{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 ve=class extends Be{static{c(this,"SmpHttpSessionStorageCache")}constructor(){super(sessionStorage,"smp_rest_cache_")}};var De=class extends ee{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 pt=class{static{c(this,"SmpHttpService")}static _cachePrefix="smp_rest_cache_";static _cacheStrategy=typeof sessionStorage<"u"?new ve:new De;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(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 ut=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}({});Pe();var _t=class{static{c(this,"SmpApiCommonUtils")}static _javascriptVariablePattern="[a-zA-Z_$][a-zA-Z_$0-9]*";static _logger=new Z;static _pathParamRegex=new RegExp(`\\{(${this._javascriptVariablePattern})\\}`,"g");static credentialsToBasicAuth(e,t){return`Basic ${Buffer.from(`${e}:${t}`).toString("base64")}`}static fromBearer(e=""){return e.split(" ")[1]}static getCountryFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[0]?.toUpperCase()}static getLanguageFromReferer(e){return this.getLocaleFromReferer(e)?.split("-")[1]}static getLocaleFromReferer(e){return e?.match(/\/([A-Z]{2}-[A-Z]{2})\//i)?.[1]}static interpolateParams(e,t){try{return e.replace(this._pathParamRegex,(r,s)=>{let o=t[s];return o!==void 0?encodeURIComponent(o):r})}catch(r){this._logger.warn(`${this.constructor.name}: couldn't interpolate params`,r)}return e}};var xs={status:"OK"};var wt=function(i){return i.GET="GET",i.POST="POST",i.PUT="PUT",i.DELETE="DELETE",i.PATCH="PATCH",i}({});var H=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 yt{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 yt(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 yt(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||H).stringify(this)}};var Se=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 Se.parse(unescape(encodeURIComponent(e)))}static stringify(e){try{return decodeURIComponent(escape(Se.stringify(e)))}catch(t){throw console.error("Malformed UTF-8 data",t),new Error("Malformed UTF-8 data")}}};var We=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 de=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 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("")}};W._map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";W._reverseMap=void 0;var Ke=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 de({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(W)}};var te=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 de({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}};te.cfg={blockSize:4,iv:new _([]),format:Ke};var b=class extends We{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 K=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 xt=class cr{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 cr(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 hr=class{static{c(this,"OpenSSLKdf")}static execute(e,t,r,s){s||(s=_.random(64/8));let o=new xt({keySize:t+r}).compute(e,s),n=new _(o.words.slice(t),r*4);return o.sigBytes=t*4,new de({key:o,iv:n,salt:s})}};var Ge=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),te.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),te.encrypt.call(this,e,t,n.key,o).extend(n)}static _parse(e,t){return typeof e=="string"?t.parse(e):e}};Ge.cfg={blockSize:4,iv:new _([]),format:Ke,kdf:hr};var lr=class{static{c(this,"CipherHelper")}constructor(e){this._cipher=e}decrypt(e,t,r){return typeof t=="string"?Ge.decrypt(this._cipher,e,t,r):te.decrypt(this._cipher,e,t,r)}encrypt(e,t,r){return typeof t=="string"?Ge.encrypt(this._cipher,e,t,r):te.encrypt(this._cipher,e,t,r)}};var fe=class extends We{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 lr(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()}};fe.ivSize=4;fe.keySize=4;fe._DEC_XFORM_MODE=2;fe._ENC_XFORM_MODE=1;var re=class{static{c(this,"BlockCipherModeAlgorithm")}constructor(e,t){this.init(e,t)}init(e,t){this._cipher=e,this._iv=t}};var Ve=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)}};Ve.Decryptor=re;Ve.Encryptor=re;var dr=class extends re{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 fr=class extends re{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 J=class extends Ve{static{c(this,"CBC")}};J.Decryptor=fr;J.Encryptor=dr;var pe=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 qe=class extends fe{static{c(this,"BlockCipher")}constructor(e,t,r){super(e,t,Object.assign({blockSize:4,mode:J,padding:pe},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,s=this.high+e.high+r|0;return new $(s,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 pr=class Et{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 Et(e,t)}clone(){let e=this.words.map(t=>new l(t.high,t.low));return new Et(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=[],ur=[],mr=[],gr=[],_r=[],wr=[],Rt=[],At=[],bt=[],Ot=[];(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,ur[s]=e;let o=i[e],n=i[o],a=i[n],h=i[s]*257^s*16843008;mr[e]=h<<24|h>>>8,gr[e]=h<<16|h>>>16,_r[e]=h<<8|h>>>24,wr[e]=h,h=a*16843009^n*65537^o*257^e*16843008,Rt[s]=h<<24|h>>>8,At[s]=h<<16|h>>>16,bt[s]=h<<8|h>>>24,Ot[s]=h,e?(e=o^i[i[i[a^o]]],t^=i[i[t]]):e=t=1}})();var Es=[0,1,2,4,8,16,32,64,128,27,54],Ze=class extends qe{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,Rt,At,bt,Ot,ur),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,mr,gr,_r,wr,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^=Es[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]=Rt[B[p>>>24]]^At[B[p>>>16&255]]^bt[B[p>>>8&255]]^Ot[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 x=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++],ct=s[w>>>24]^o[p>>>16&255]^n[g>>>8&255]^a[m&255]^r[A++];p=x,g=E,m=F,w=ct}let D=(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]=D,e[t+1]=j,e[t+2]=N,e[t+3]=T}};Ze.keySize=256/32;var Rs=[1732584193,4023233417,2562383102,271733878,3285377520],se=new Array(80),ie=class extends b{static{c(this,"SHA1")}get hash(){return this._hash}reset(){super.reset(),this._hash=new _(Rs.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)se[h]=e[t+h]|0;else{let w=se[h-3]^se[h-8]^se[h-14]^se[h-16];se[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+se[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 yr=[],xr=[];(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&&(yr[r]=e(Math.pow(t,1/2))),xr[r]=e(Math.pow(t,1/3)),r++),t++})();var oe=[],Ne=class extends b{static{c(this,"SHA256")}constructor(){super()}reset(){super.reset(),this._hash=new _(yr.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)oe[m]=e[t+m]|0;else{let C=oe[m-15],x=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,E=oe[m-2],F=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;oe[m]=x+oe[m-7]+F+oe[m-16]}let w=a&h^~a&p,A=r&s^r&o^s&o,D=(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+xr[m]+oe[m],T=D+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 It=[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 Ct=class extends b{static{c(this,"SHA512")}constructor(){super({blockSize:1024/32})}reset(){super.reset(),this._hash=new pr([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,D=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 x=0;x<80;x++){let E,F;if(x<16)F=M[x].high=e[t+x*2]|0,E=M[x].low=e[t+x*2+1]|0;else{let Kt=M[x-15],ae=Kt.high,Re=Kt.low,hs=(ae>>>1|Re<<31)^(ae>>>8|Re<<24)^ae>>>7,Gt=(Re>>>1|ae<<31)^(Re>>>8|ae<<24)^(Re>>>7|ae<<25),Vt=M[x-2],ce=Vt.high,Ae=Vt.low,ls=(ce>>>19|Ae<<13)^(ce<<3|Ae>>>29)^ce>>>6,qt=(Ae>>>19|ce<<13)^(Ae<<3|ce>>>29)^(Ae>>>6|ce<<26);E=Gt+M[x-7].low,F=hs+M[x-7].high+(E>>>0<Gt>>>0?1:0),E=E+qt,F=F+ls+(E>>>0<qt>>>0?1:0),E=E+M[x-16].low,F=F+M[x-16].high+(E>>>0<M[x-16].low>>>0?1:0),M[x].high=F,M[x].low=E}let ct=m&A^~m&j,$t=w&D^~w&N,ss=r&o^r&a^o&a,is=s&n^s&h^n&h,os=(r>>>28|s<<4)^(r<<30|s>>>2)^(r<<25|s>>>7),St=(s>>>28|r<<4)^(s<<30|r>>>2)^(s<<25|r>>>7),ns=(m>>>14|w<<18)^(m>>>18|w<<14)^(m<<23|w>>>9),as=(w>>>14|m<<18)^(w>>>18|m<<14)^(w<<23|m>>>9),P=C+as,G=T+ns+(P>>>0<C>>>0?1:0);P=P+$t,G=G+ct+(P>>>0<$t>>>0?1:0),P=P+It[x].low,G=G+It[x].high+(P>>>0<It[x].low>>>0?1:0),P=P+E,G=G+F+(P>>>0<E>>>0?1:0);let Wt=St+is,cs=os+ss+(Wt>>>0<St>>>0?1:0);T=j,C=N,j=A,N=D,A=m,D=w,w=g+P|0,m=p+G+(w>>>0<g>>>0?1:0)|0,p=a,g=h,a=o,h=n,o=r,n=s,s=P+Wt|0,r=G+cs+(s>>>0<P>>>0?1:0)|0}this._hash.words[0].low=this._hash.words[0].low=this._hash.words[0].low+s,this._hash.words[0].high=this._hash.words[0].high+r+(this._hash.words[0].low>>>0<s>>>0?1:0),this._hash.words[1].low=this._hash.words[1].low=this._hash.words[1].low+n,this._hash.words[1].high=this._hash.words[1].high+o+(this._hash.words[1].low>>>0<n>>>0?1:0),this._hash.words[2].low=this._hash.words[2].low=this._hash.words[2].low+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+D,this._hash.words[5].high=this._hash.words[5].high+A+(this._hash.words[5].low>>>0<D>>>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 Er=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 Bt=class Rr{static{c(this,"PBKDF2")}constructor(e){this.cfg=Object.assign({keySize:128/32,hasher:Ne,iterations:25e4},e)}static execute(e,t,r){return new Rr(r).compute(e,t)}compute(e,t){let r=this.cfg,s=new Er(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,D=m;for(let j=1;j<g;j++){D=s.finalize(D),s.reset();let N=D.words;for(let T=0;T<A;T++)w[T]^=N[T]}o.concat(m),h[0]++}return o.sigBytes=p*4,o}};var Te=qe._createHelper(Ze);var ue=b._createHelper(K);var me=b._createHelper(ie);var Xe=b._createHelper(Ne);var He=b._createHelper(Ct);var ge=class{static{c(this,"SmpAesCrypt")}_password;_salt;_initVector;get _iv(){return this._initVector?H.parse(this._initVector):void 0}_mode;_padding;constructor(e,t,r){this._password=e,this._salt=t,this._initVector=r,this._mode=J,this._padding=pe}decryptAES(e){return Te.decrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString(I)}encryptAES(e){return Te.encrypt(e,this._buildKey(),{iv:this._iv,mode:this._mode,padding:this._padding}).toString()}_buildKey(){return Bt.execute(this._password,H.parse(this._salt),{keySize:256/32,iterations:1e3,hasher:ie})}};var Je=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 ue(e).toString()}static sha1(e){return me(e).toString()}static sha256(e){return Xe(e).toString()}static sha512(e){return He(e).toString()}};var Ye=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:ut.BadRequest})}_encode(){let e=new K;return e.update(I.parse(this._seed+this._baseCode)),e.finalize().toString(H).substring(0,this._crcLength).toUpperCase()}};var _e=require("class-transformer"),Qe=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 ne=function(i){return i.MD5="MD5",i.MD5_HMAC="MD5_HMAC",i.SHA1="SHA1",i.SHA1_HMAC="SHA1_HMAC",i}({});function As(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(As,"_ts_decorate");function Ar(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)}c(Ar,"_ts_metadata");var et=class{static{c(this,"SmpGiftcardTransaction")}gc;op;ot;static _AES_ENCODER=new ge("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={[ne.MD5]:o=>ue(o),[ne.MD5_HMAC]:o=>{let n=new K;return n.update(I.parse(o)),n.finalize()},[ne.SHA1]:o=>me(o),[ne.SHA1_HMAC]:o=>{let n=new ie;return n.update(I.parse(o)),n.finalize()}},this._hashStrategy=this._hashStrategies[ne.MD5],this._dto=typeof s=="number"&&s>=0?Qe.DateTime.fromMillis(+`${s}000`.slice(0,13)):Qe.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:Qe.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,_e.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,_e.instanceToPlain)(this,{excludePrefixes:["_"]})}toString(){let e=JSON.stringify(this.serialize());return this.constructor._AES_ENCODER.encryptAES(e)}};As([(0,_e.Expose)(),Ar("design:type",Number),Ar("design:paramtypes",[])],et.prototype,"ts",null);var bs=function(i){return i.ListDetectiveValidator="ListDetectiveValidator",i.MXValidator="MXValidator",i.SyntaxValidator="SyntaxValidator",i}({});var Os=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Or(i){return i.match(Os)}c(Or,"smpAsciiWords");var Pr="\\ud800-\\udfff",Is="\\u0300-\\u036f",Cs="\\ufe20-\\ufe2f",Bs="\\u20d0-\\u20ff",vs="\\u1ab0-\\u1aff",Ds="\\u1dc0-\\u1dff",Ps=Is+Cs+Bs+vs+Ds,Nr="\\u2700-\\u27bf",Tr="a-z\\xdf-\\xf6\\xf8-\\xff",Ns="\\xac\\xb1\\xd7\\xf7",Ts="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fs="\\u2000-\\u206f",Us=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Fr="A-Z\\xc0-\\xd6\\xd8-\\xde",ks="\\ufe0e\\ufe0f",Ur=Ns+Ts+Fs+Us,kr="['\u2019]",Ir=`[${Ur}]`,Ms=`[${Ps}]`,Mr="\\d",js=`[${Nr}]`,jr=`[${Tr}]`,Lr=`[^${Pr}${Ur+Mr+Nr+Tr+Fr}]`,Ls="\\ud83c[\\udffb-\\udfff]",zs=`(?:${Ms}|${Ls})`,$s=`[^${Pr}]`,zr="(?:\\ud83c[\\udde6-\\uddff]){2}",$r="[\\ud800-\\udbff][\\udc00-\\udfff]",we=`[${Fr}]`,Ss="\\u200d",Cr=`(?:${jr}|${Lr})`,Ws=`(?:${we}|${Lr})`,Br=`(?:${kr}(?:d|ll|m|re|s|t|ve))?`,vr=`(?:${kr}(?:D|LL|M|RE|S|T|VE))?`,Sr=`${zs}?`,Wr=`[${ks}]?`,Ks=`(?:${Ss}(?:${[$s,zr,$r].join("|")})${Wr+Sr})*`,Gs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vs="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qs=Wr+Sr+Ks,Dr=`(?:${[js,zr,$r].join("|")})${qs}`,Ue=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([`${we}?${jr}+${Br}(?=${[Ir,we,"$"].join("|")})`,`${Ws}+${vr}(?=${[Ir,we+Cr,"$"].join("|")})`,`${we}?${Cr}+${Br}`,`${we}+${vr}`,Vs,Gs,`${Mr}+`,Dr].join("|"),"g");static RS_EMOJI=Dr;static unicodeWords(e){return e.match(this.RE_UNICODE_WORDS)}};var vt=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=wt.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?(Ue.HAS_UNICODE_WORD(e)?Ue.unicodeWords(e):Or(e))||[]:e.match(t)||[]}};var Dt=class extends Error{static{c(this,"SmpFilterException")}message;data;constructor(e="Filter Exception",t){super(),this.message=e,this.data=t}};var Pt=require("ts-luxon");var Nt=class i{static{c(this,"SmpSid")}value;expiry;get active(){return this.value.endsWith(this._controlSuffix)}get expired(){return Pt.DateTime.now().ts>this.expiry}get valid(){return!this.expired}_controlSuffix;constructor(e=`sid-xxxx-${+Pt.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}}};Pe();var Tt=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 Qs="1.6.1";Object.defineProperties(module.exports,{SmpDynamoService:{get:c(()=>(Vr(),L(Gr)).SmpDynamoService,"get")},SmpFirebaseService:{get:c(()=>(Zr(),L(qr)).SmpFirebaseService,"get")},SmpAbstractRxjsTtlCacheStrategy:{get:c(()=>(Ee(),L(xe)).SmpAbstractRxjsTtlCacheStrategy,"get")},smpRxjsCatchOnly:{get:c(()=>(Ee(),L(xe)).smpRxjsCatchOnly,"get")},SmpRxjsInMemoryCache:{get:c(()=>(Ee(),L(xe)).SmpRxjsInMemoryCache,"get")},smpRxjsThrowIfEmpty:{get:c(()=>(Ee(),L(xe)).smpRxjsThrowIfEmpty,"get")},smpRxjsThrowOnCondition:{get:c(()=>(Ee(),L(xe)).smpRxjsThrowOnCondition,"get")},smpZodDateTime:{get:c(()=>(zt(),L(Lt)).smpZodDateTime,"get")},SmpZodDateTime:{get:c(()=>(zt(),L(Lt)).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});
2
2
  //# sourceMappingURL=index.cjs.map