UNPKG

@namiml/web-sdk

Version:

Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing

1 lines 1.33 MB
import{css as e,LitElement as t,adoptStyles as n,html as i,unsafeCSS as a,svg as r}from"lit";const o=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}},s=new WeakMap,d=e=>{let t=s.get(e);return void 0===t&&s.set(e,t=new Map),t},l=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(d(this)).map((([e,t])=>({name:e,value:t})))}get shadowRoot(){return"closed"===this.__shadowRootMode?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){d(this).set(e,String(t))}removeAttribute(e){d(this).delete(e)}toggleAttribute(e,t){return this.hasAttribute(e)?!(void 0===t||!t)||(this.removeAttribute(e),!1):!(void 0!==t&&!t)&&(this.setAttribute(e,""),!0)}hasAttribute(e){return d(this).has(e)}attachShadow(e){const t={host:this};return this.__shadowRootMode=e.mode,e&&"open"===e.mode&&(this.__shadowRoot=t),t}attachInternals(){if(null!==this.__internals)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");const e=new o(this);return this.__internals=e,e}getAttribute(e){return d(this).get(e)??null}},u=class extends l{};function c(e,t,n,i){var a,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,n,o):a(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}function h(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=u),"function"==typeof SuppressedError&&SuppressedError;const{NAMI_SDK_VERSION:m="3.2.4",PRODUCTION:f="production",DEVELOPMENT:g="development",PLATFORM_ID_REQUIRED:p="Platform ID is required",DEVICE_ID_REQUIRED:v="Device ID is required",EXTERNAL_ID_REQUIRED:y="External ID is required",SDK_NOT_INITIALIZED:b="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:w="Campaign is not available",UNABLE_TO_UPDATE_CDP_ID:k="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:M="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:S="Anonymous mode is already turned off.",ANONYMOUS_MODE_LOGIN_NOT_ALLOWED:T="Login/logout are not available in anonymous mode",SESSION_REQUIRED:E="Session is required",DEVICE_ID_NOT_SET:P="Nami Device ID is not set",AUTH_DEVICE:A="nami_auth_device",NAMI_CONFIGURATION:x="nami_configuration",NAMI_PROFILE:C="nami_profile",API_CONFIG:L="api_config",API_CAMPAIGN_RULES:D="api_campaign_rules",API_PAYWALLS:I="api_paywalls",API_PRODUCTS:_="api_products",API_ACTIVE_ENTITLEMENTS:R="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:W="server_active_entitlements",INITIAL_APP_CONFIG:N="initial_app_config",INITIAL_CAMPAIGN_RULES:O="initial_campaign_rules",INITIAL_PAYWALLS:F="initial_paywalls",INITIAL_PRODUCTS:j="initial_products",LOCAL_NAMI_ENTITLEMENTS:z="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:$="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:H="nami_customer_journey_state",ANONYMOUS_MODE:U="nami_anonymous_mode",KEY_SESSION_COUNTER:B="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:G=1,NAMI_LAST_IMPRESSION_ID:X="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:Y="nami_purchase_impression_id",NAMI_SESSION_ID:V="nami_session_id",NAMI_LANGUAGE_CODE:K="nami_language_code",NAMI_PURCHASE_CHANNEL:q="nami_purchase_channel",API_VERSION:J="v3",BASE_URL_PATH:Q=`sdk/${J}/platform`,BASE_URL:Z="https://app.namiml.com",BASE_STAGING_URL:ee="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:te="namiAPIHost=",USE_STAGING_API:ne="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:ie="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:ae=":",VALIDATE_PRODUCT_GROUPS:re="validateProductGroups",EXTENDED_PLATFORM:oe="extended-platform",EXTENDED_PLATFORM_VERSION:se="extended-platform-version",API_MAX_CALLS_LIMIT:de=2,API_RETRY_DELAY_SEC:le=2,API_TIMEOUT_LIMIT:ue=2e4,DEVICE_API_TIMEOUT_LIMIT:ce=3e3,STATUS_SUCCESS:he=200,STATUS_BAD_REQUEST:me=400,STATUS_NOT_FOUND:fe=404,STATUS_INTERNAL_SERVER_ERROR:ge=500,INITIAL_SUCCESS:pe="Initial success",RECONFIG_SUCCESS:ve="Reconfig success",ALREADY_CONFIGURED:ye="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:be="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:we="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:ke="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Me="CustomerJourneyStateChanged",SKU_TEXT_REGEX:Se=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:Te=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,HTML_REGEX:Ee=/<\/?[a-z][\s\S]*>/i,SMART_TEXT_PATTERN:Pe="${",CORS_PROXY_URL:Ae="https://hosted-content-staging.namiml.com",CORS_PROXY_URL_LOCAL:xe="http://localhost:8001"}={};var Ce;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR"}(Ce||(Ce={}));const Le={debug:Ce.DEBUG,info:Ce.INFO,warn:Ce.WARN,error:Ce.ERROR};const De=new class{constructor(){this.setLogger=e=>{this.currentLogLevel=e?Le[e]:Ce.WARN}}debug(e,...t){this.shouldLog(Ce.DEBUG)&&console.debug(this.formatMessage(Ce.DEBUG,e,...t))}info(e,...t){this.shouldLog(Ce.INFO)&&console.info(this.formatMessage(Ce.INFO,e,...t))}warn(e,...t){this.shouldLog(Ce.WARN)&&console.warn(this.formatMessage(Ce.WARN,e,...t))}error(e,...t){this.shouldLog(Ce.ERROR)&&console.error(this.formatMessage(Ce.ERROR,e,...t))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(e,t,...n){const i=Ce[e];return`[${(new Date).toISOString()}] [${i}] ${t} ${n=n.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};function Ie(e){for(var t=-1,n=null==e?0:e.length,i=0,a=[];++t<n;){var r=e[t];r&&(a[i++]=r)}return a}function _e(e,t){return e===t||e!=e&&t!=t}function Re(e,t){for(var n=e.length;n--;)if(_e(e[n][0],t))return n;return-1}var We=Array.prototype.splice;function Ne(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ne.prototype.clear=function(){this.__data__=[],this.size=0},Ne.prototype.delete=function(e){var t=this.__data__,n=Re(t,e);return!(n<0)&&(n==t.length-1?t.pop():We.call(t,n,1),--this.size,!0)},Ne.prototype.get=function(e){var t=this.__data__,n=Re(t,e);return n<0?void 0:t[n][1]},Ne.prototype.has=function(e){return Re(this.__data__,e)>-1},Ne.prototype.set=function(e,t){var n=this.__data__,i=Re(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Oe="object"==typeof global&&global&&global.Object===Object&&global,Fe="object"==typeof self&&self&&self.Object===Object&&self,je=Oe||Fe||Function("return this")(),ze=je.Symbol,$e=Object.prototype,He=$e.hasOwnProperty,Ue=$e.toString,Be=ze?ze.toStringTag:void 0;var Ge=Object.prototype.toString;var Xe="[object Null]",Ye="[object Undefined]",Ve=ze?ze.toStringTag:void 0;function Ke(e){return null==e?void 0===e?Ye:Xe:Ve&&Ve in Object(e)?function(e){var t=He.call(e,Be),n=e[Be];try{e[Be]=void 0;var i=!0}catch(e){}var a=Ue.call(e);return i&&(t?e[Be]=n:delete e[Be]),a}(e):function(e){return Ge.call(e)}(e)}function qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var Je="[object AsyncFunction]",Qe="[object Function]",Ze="[object GeneratorFunction]",et="[object Proxy]";function tt(e){if(!qe(e))return!1;var t=Ke(e);return t==Qe||t==Ze||t==Je||t==et}var nt,it=je["__core-js_shared__"],at=(nt=/[^.]+$/.exec(it&&it.keys&&it.keys.IE_PROTO||""))?"Symbol(src)_1."+nt:"";var rt=Function.prototype.toString;function ot(e){if(null!=e){try{return rt.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var st=/^\[object .+?Constructor\]$/,dt=Function.prototype,lt=Object.prototype,ut=dt.toString,ct=lt.hasOwnProperty,ht=RegExp("^"+ut.call(ct).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mt(e){return!(!qe(e)||(t=e,at&&at in t))&&(tt(e)?ht:st).test(ot(e));var t}function ft(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return mt(n)?n:void 0}var gt=ft(je,"Map"),pt=ft(Object,"create");var vt=Object.prototype.hasOwnProperty;var yt=Object.prototype.hasOwnProperty;function bt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function wt(e,t){var n,i,a=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function kt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}bt.prototype.clear=function(){this.__data__=pt?pt(null):{},this.size=0},bt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},bt.prototype.get=function(e){var t=this.__data__;if(pt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return vt.call(t,e)?t[e]:void 0},bt.prototype.has=function(e){var t=this.__data__;return pt?void 0!==t[e]:yt.call(t,e)},bt.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=pt&&void 0===t?"__lodash_hash_undefined__":t,this},kt.prototype.clear=function(){this.size=0,this.__data__={hash:new bt,map:new(gt||Ne),string:new bt}},kt.prototype.delete=function(e){var t=wt(this,e).delete(e);return this.size-=t?1:0,t},kt.prototype.get=function(e){return wt(this,e).get(e)},kt.prototype.has=function(e){return wt(this,e).has(e)},kt.prototype.set=function(e,t){var n=wt(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Mt(e){var t=this.__data__=new Ne(e);this.size=t.size}Mt.prototype.clear=function(){this.__data__=new Ne,this.size=0},Mt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Mt.prototype.get=function(e){return this.__data__.get(e)},Mt.prototype.has=function(e){return this.__data__.has(e)},Mt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ne){var i=n.__data__;if(!gt||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new kt(i)}return n.set(e,t),this.size=n.size,this};function St(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new kt;++t<n;)this.add(e[t])}function Tt(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function Et(e,t){return e.has(t)}St.prototype.add=St.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},St.prototype.has=function(e){return this.__data__.has(e)};var Pt=1,At=2;function xt(e,t,n,i,a,r){var o=n&Pt,s=e.length,d=t.length;if(s!=d&&!(o&&d>s))return!1;var l=r.get(e),u=r.get(t);if(l&&u)return l==t&&u==e;var c=-1,h=!0,m=n&At?new St:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],g=t[c];if(i)var p=o?i(g,f,c,t,e,r):i(f,g,c,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(m){if(!Tt(t,(function(e,t){if(!Et(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==g&&!a(f,g,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Ct=je.Uint8Array;function Lt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Dt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var It=1,_t=2,Rt="[object Boolean]",Wt="[object Date]",Nt="[object Error]",Ot="[object Map]",Ft="[object Number]",jt="[object RegExp]",zt="[object Set]",$t="[object String]",Ht="[object Symbol]",Ut="[object ArrayBuffer]",Bt="[object DataView]",Gt=ze?ze.prototype:void 0,Xt=Gt?Gt.valueOf:void 0;var Yt=Array.isArray;var Vt=Object.prototype.propertyIsEnumerable,Kt=Object.getOwnPropertySymbols,qt=Kt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,a=0,r=[];++n<i;){var o=e[n];t(o,n,e)&&(r[a++]=o)}return r}(Kt(e),(function(t){return Vt.call(e,t)})))}:function(){return[]};function Jt(e){return null!=e&&"object"==typeof e}function Qt(e){return Jt(e)&&"[object Arguments]"==Ke(e)}var Zt=Object.prototype,en=Zt.hasOwnProperty,tn=Zt.propertyIsEnumerable,nn=Qt(function(){return arguments}())?Qt:function(e){return Jt(e)&&en.call(e,"callee")&&!tn.call(e,"callee")};var an="object"==typeof exports&&exports&&!exports.nodeType&&exports,rn=an&&"object"==typeof module&&module&&!module.nodeType&&module,on=rn&&rn.exports===an?je.Buffer:void 0,sn=(on?on.isBuffer:void 0)||function(){return!1},dn=9007199254740991,ln=/^(?:0|[1-9]\d*)$/;function un(e,t){var n=typeof e;return!!(t=null==t?dn:t)&&("number"==n||"symbol"!=n&&ln.test(e))&&e>-1&&e%1==0&&e<t}var cn=9007199254740991;function hn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=cn}var mn={};mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Arguments]"]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object Boolean]"]=mn["[object DataView]"]=mn["[object Date]"]=mn["[object Error]"]=mn["[object Function]"]=mn["[object Map]"]=mn["[object Number]"]=mn["[object Object]"]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object WeakMap]"]=!1;var fn,gn="object"==typeof exports&&exports&&!exports.nodeType&&exports,pn=gn&&"object"==typeof module&&module&&!module.nodeType&&module,vn=pn&&pn.exports===gn&&Oe.process,yn=function(){try{var e=pn&&pn.require&&pn.require("util").types;return e||vn&&vn.binding&&vn.binding("util")}catch(e){}}(),bn=yn&&yn.isTypedArray,wn=bn?(fn=bn,function(e){return fn(e)}):function(e){return Jt(e)&&hn(e.length)&&!!mn[Ke(e)]},kn=Object.prototype.hasOwnProperty;function Mn(e,t){var n=Yt(e),i=!n&&nn(e),a=!n&&!i&&sn(e),r=!n&&!i&&!a&&wn(e),o=n||i||a||r,s=o?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],d=s.length;for(var l in e)!kn.call(e,l)||o&&("length"==l||a&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||un(l,d))||s.push(l);return s}var Sn=Object.prototype;var Tn=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),En=Object.prototype.hasOwnProperty;function Pn(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||Sn))return Tn(e);var t,n,i=[];for(var a in Object(e))En.call(e,a)&&"constructor"!=a&&i.push(a);return i}function An(e){return null!=(t=e)&&hn(t.length)&&!tt(t)?Mn(e):Pn(e);var t}function xn(e){return function(e,t,n){var i=t(e);return Yt(e)?i:function(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}(i,n(e))}(e,An,qt)}var Cn=1,Ln=Object.prototype.hasOwnProperty;var Dn=ft(je,"DataView"),In=ft(je,"Promise"),_n=ft(je,"Set"),Rn=ft(je,"WeakMap"),Wn="[object Map]",Nn="[object Promise]",On="[object Set]",Fn="[object WeakMap]",jn="[object DataView]",zn=ot(Dn),$n=ot(gt),Hn=ot(In),Un=ot(_n),Bn=ot(Rn),Gn=Ke;(Dn&&Gn(new Dn(new ArrayBuffer(1)))!=jn||gt&&Gn(new gt)!=Wn||In&&Gn(In.resolve())!=Nn||_n&&Gn(new _n)!=On||Rn&&Gn(new Rn)!=Fn)&&(Gn=function(e){var t=Ke(e),n="[object Object]"==t?e.constructor:void 0,i=n?ot(n):"";if(i)switch(i){case zn:return jn;case $n:return Wn;case Hn:return Nn;case Un:return On;case Bn:return Fn}return t});var Xn=1,Yn="[object Arguments]",Vn="[object Array]",Kn="[object Object]",qn=Object.prototype.hasOwnProperty;function Jn(e,t,n,i,a,r){var o=Yt(e),s=Yt(t),d=o?Vn:Gn(e),l=s?Vn:Gn(t),u=(d=d==Yn?Kn:d)==Kn,c=(l=l==Yn?Kn:l)==Kn,h=d==l;if(h&&sn(e)){if(!sn(t))return!1;o=!0,u=!1}if(h&&!u)return r||(r=new Mt),o||wn(e)?xt(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case Bt:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Ut:return!(e.byteLength!=t.byteLength||!r(new Ct(e),new Ct(t)));case Rt:case Wt:case Ft:return _e(+e,+t);case Nt:return e.name==t.name&&e.message==t.message;case jt:case $t:return e==t+"";case Ot:var s=Lt;case zt:var d=i&It;if(s||(s=Dt),e.size!=t.size&&!d)return!1;var l=o.get(e);if(l)return l==t;i|=_t,o.set(e,t);var u=xt(s(e),s(t),i,a,r,o);return o.delete(e),u;case Ht:if(Xt)return Xt.call(e)==Xt.call(t)}return!1}(e,t,d,n,i,a,r);if(!(n&Xn)){var m=u&&qn.call(e,"__wrapped__"),f=c&&qn.call(t,"__wrapped__");if(m||f){var g=m?e.value():e,p=f?t.value():t;return r||(r=new Mt),a(g,p,n,i,r)}}return!!h&&(r||(r=new Mt),function(e,t,n,i,a,r){var o=n&Cn,s=xn(e),d=s.length;if(d!=xn(t).length&&!o)return!1;for(var l=d;l--;){var u=s[l];if(!(o?u in t:Ln.call(t,u)))return!1}var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==e;var m=!0;r.set(e,t),r.set(t,e);for(var f=o;++l<d;){var g=e[u=s[l]],p=t[u];if(i)var v=o?i(p,g,u,t,e,r):i(g,p,u,e,t,r);if(!(void 0===v?g===p||a(g,p,n,i,r):v)){m=!1;break}f||(f="constructor"==u)}if(m&&!f){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(m=!1)}return r.delete(e),r.delete(t),m}(e,t,n,i,a,r))}function Qn(e,t,n,i,a){return e===t||(null==e||null==t||!Jt(e)&&!Jt(t)?e!=e&&t!=t:Jn(e,t,n,i,Qn,a))}var Zn=1,ei=2;function ti(e){return e==e&&!qe(e)}function ni(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function ii(e){var t=function(e){for(var t=An(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,ti(a)]}return t}(e);return 1==t.length&&t[0][2]?ni(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,i){var a=n.length,r=a;if(null==e)return!r;for(e=Object(e);a--;){var o=n[a];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++a<r;){var s=(o=n[a])[0],d=e[s],l=o[1];if(o[2]){if(void 0===d&&!(s in e))return!1}else{var u=new Mt;if(!Qn(l,d,Zn|ei,i,u))return!1}}return!0}(n,0,t)}}var ai="[object Symbol]";function ri(e){return"symbol"==typeof e||Jt(e)&&Ke(e)==ai}var oi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,si=/^\w*$/;function di(e,t){if(Yt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ri(e))||(si.test(e)||!oi.test(e)||null!=t&&e in Object(t))}var li="Expected a function";function ui(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(li);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],r=n.cache;if(r.has(a))return r.get(a);var o=e.apply(this,i);return n.cache=r.set(a,o)||r,o};return n.cache=new(ui.Cache||kt),n}ui.Cache=kt;var ci=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hi=/\\(\\)?/g,mi=function(e){var t=ui(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ci,(function(e,n,i,a){t.push(i?a.replace(hi,"$1"):n||e)})),t}));var fi=1/0,gi=ze?ze.prototype:void 0,pi=gi?gi.toString:void 0;function vi(e){if("string"==typeof e)return e;if(Yt(e))return function(e,t){for(var n=-1,i=null==e?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a}(e,vi)+"";if(ri(e))return pi?pi.call(e):"";var t=e+"";return"0"==t&&1/e==-fi?"-0":t}function yi(e){return null==e?"":vi(e)}function bi(e,t){return Yt(e)?e:di(e,t)?[e]:mi(yi(e))}var wi=1/0;function ki(e){if("string"==typeof e||ri(e))return e;var t=e+"";return"0"==t&&1/e==-wi?"-0":t}function Mi(e,t){for(var n=0,i=(t=bi(t,e)).length;null!=e&&n<i;)e=e[ki(t[n++])];return n&&n==i?e:void 0}function Si(e,t){return null!=e&&t in Object(e)}function Ti(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=bi(t,e)).length,r=!1;++i<a;){var o=ki(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&hn(a)&&un(o,a)&&(Yt(e)||nn(e))}(e,t,Si)}var Ei=1,Pi=2;function Ai(e,t){return di(e)&&ti(t)?ni(ki(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Mi(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?Ti(n,e):Qn(t,i,Ei|Pi)}}function xi(e){return e}function Ci(e){return di(e)?(t=ki(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Mi(t,e)}}(e);var t}function Li(e){return e!=e}function Di(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===t)return i;return-1}(e,t,n):function(e,t,n){for(var i=e.length,a=n+-1;++a<i;)if(t(e[a],a,e))return a;return-1}(e,Li,n)}(e,t,0)>-1}var Ii=_n&&1/Dt(new _n([,-0]))[1]==1/0?function(e){return new _n(e)}:function(){},_i=200;function Ri(e,t){return e&&e.length?function(e,t,n){var i=-1,a=Di,r=e.length,o=!0,s=[],d=s;if(r>=_i){var l=t?null:Ii(e);if(l)return Dt(l);o=!1,a=Et,d=new St}else d=t?[]:s;e:for(;++i<r;){var u=e[i],c=t?t(u):u;if(u=0!==u?u:0,o&&c==c){for(var h=d.length;h--;)if(d[h]===c)continue e;t&&d.push(c),s.push(u)}else a(d,c,n)||(d!==s&&d.push(c),s.push(u))}return s}(e,"function"==typeof(n=t)?n:null==n?xi:"object"==typeof n?Yt(n)?Ai(n[0],n[1]):ii(n):Ci(n)):[];var n}const Wi=new class{setDevice(e){this.setItem(A,e)}getDevice(){return this.getItem(A)}resetDevice(){this.resetItem(A)}getAnonymousMode(){return this.getItem(U)||!1}setAnonymousMode(e){this.setItem(U,e)}clearAnonymousMode(){this.resetItem(U)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(K,e||"en")}getLanguageCode(){return this.getItem(K)||"en"}setCampaignRules(e,t){this.setItem(e,t)}getCampaignRules(e){return this.getItem(e)}setPaywalls(e,t){this.setItem(e,t)}getPaywalls(e){return this.getItem(e)}setActiveEntitlements(e,t){this.setItem(e,t)}setNamiEntitlements(e,t){this.setItem(e,t)}getNamiEntitlements(e){return this.getItem(e)||[]}setProducts(e,t){this.setItem(e,t)}getProducts(e){return this.getItem(e)}getCachedProducts(){const e=this.getItem(_)??[];return Ri(Ie([...this.getItem(j)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(x,e)}getNamiConfig(){return this.getItem(x)}setCustomerAttribute(e,t){this.setItem($+e,t)}getCustomerAttribute(e){return this.getItem($+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter((([e])=>e.includes($))).map((([e,t])=>e.replace($,"")+":"+t))}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter((e=>e.includes($))).map((e=>e.replace($,"")))}clearCustomerAttribute(e){const t=$+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes($))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(C,e)}getNamiProfile(){return this.getItem(C)}removeNamiProfile(){this.resetItem(C)}setCustomerJourneyState(e){this.setItem(H,e)}getCustomerJourneyState(){return this.getItem(H)}setSessionCounter(){const e=this.getItem(B),t=e?parseInt(e):G||G;this.setItem(B,t+1)}setLastImpressionId(e){this.setItem(X,e)}getLastImpressionId(){return this.getItem(X)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(Y,e)}getPurchaseImpression(){return this.getItem(Y)??""}setSessionId(e){e&&this.setItem(V,e)}getSessionId(){return this.getItem(V)??""}clearSessionId(){this.resetItem(V)}setPurchaseChannel(e){e&&this.setItem(q,e)}getPurchaseChannel(){return this.getItem(q)}setItem(e,t){try{const n=JSON.stringify(t);localStorage.setItem(e,n)}catch(e){De.error("Error setting item in localStorage:",e)}}getItem(e){try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return De.error("Error getting item from localStorage:",e,": ",t),null}}resetItem(e){try{localStorage.removeItem(e)}catch(e){De.error("Error removing item from localStorage:",e)}}clear(){try{localStorage.clear()}catch(e){De.error("Error clearing localStorage:",e)}}};class Ni extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class Oi extends Error{constructor(){super(b)}}class Fi extends Error{constructor(){super(p)}}class ji extends Error{constructor(){super(v)}}class zi extends Error{constructor(){super(y)}}class $i extends Error{constructor(){super(w)}}class Hi extends Error{constructor(){super(M)}}class Ui extends Error{constructor(){super(S)}}class Bi extends Error{constructor(){super(S)}}class Gi extends Error{constructor(){super(k)}}class Xi extends Error{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class Yi extends Error{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class Vi extends Error{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class Ki extends Error{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const qi=(e,t)=>{if(e==me)throw new Xi(t);if(e==fe)throw new Yi(t);if(e>me&&e<ge)throw new Vi(e,t);if(e>=ge)throw new Ki(t)};async function Ji(e,t,n=ue,i=de){let a=0;const r=async()=>{const o=await async function(e,t={},n){const i=new AbortController,a=setTimeout((()=>i.abort()),n);t.signal=i.signal;const r=await fetch(e,t);return clearTimeout(a),r}(e,t,n);if(!o.ok){if(a++,a<=i){const e=1e3*(a+le);return await new Promise((t=>setTimeout(t,e))),r()}throw new Ni(o.status,`Request failed after ${i} retries`)}return o};return(await r()).json()}var Qi;!function(e){e.SDK="sdk",e.ML="ml",e.THIRD_PARTY_ANALYTICS="third_party_analytics",e.THIRD_PARTY_TRANSACTIONS="third_party_transactions",e.PAYWALL_PERSONALIZATION="paywall_personalization",e.ANONYMOUS_MODE_CAPABILITY="anonymous_allowed",e.LANGUAGE_MANAGEMENT="language_management",e.ENTITLEMENT_MANAGEMENT="entitlement_management"}(Qi||(Qi={}));const Zi=e=>{let t;if(e?.includes(ne))t=ee;else{const n=e?.find((e=>e.includes(te)));t=n?n.split("=")[1]:Z}return t=t.replace(/\/$/,""),t+"/"+Q},ea=e=>{const t=Wi.getAppConfig(L)||Wi.getAppConfig(N);return t?.capabilities?.includes(e)??!1},ta=e=>{const t=!ea(Qi.THIRD_PARTY_TRANSACTIONS);return e&&!t&&De.info(`[${e}] Your plan does not have purchase management features.`),t};function na(e,t,n){const i=n.value;return n.value=function(...e){if(!this.platformID)throw new Fi;return i.apply(this,e)},n}function ia(e,t,n){const i=n.value;return n.value=function(...e){const t=Wi.getDevice();if(!t?.id)throw new ji;return i.apply(this,e)},n}class aa{get deviceID(){return Wi.getDevice()?.id}constructor(){const e=Wi.getNamiConfig();!this.platformID&&e&&this.configure(e)}static configure(e){this.instance.configure(e)}configure(e){this.baseURL=Zi(e.namiCommands),this.platformID=e.appPlatformID}async login(e){if(!e)throw new zi;const t=`device/${this.deviceID}/login/`,n={external_id:e};return await this.requestBodyAPI(t,n,"PUT")}async logout(){const e=`device/${this.deviceID}/logout/`;return await this.requestBodyAPI(e,{},"PUT")}async startSession(e){const t=`device/${this.deviceID}/session/`,n=await this.requestBodyAPI(t,{start_time:e,app_env:"production"});Wi.setSessionCounter(),n.id&&Wi.setSessionId(n.id)}async postImpression(e){const t=`device/${this.deviceID}/impression/`,n=await this.requestBodyAPI(t,e,"POST",!0);n.id&&Wi.setLastImpressionId(n.id)}async postConversion(e){const t=`device/${this.deviceID}/transaction/`;await this.requestBodyAPI(t,e,"POST",!0)}async purchaseValidation(e){const t=`device/${this.deviceID}/purchase_event/`;await this.requestBodyAPI(t,e,"PUT")}async fetchAPI(e){const t=`${this.baseURL}/${this.platformID}/`+e;return await Ji(t)}async requestBodyAPI(e,t,n="POST",i=!1,a){const r=`${this.baseURL}/${this.platformID}/`+e,o={method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:i};return await Ji(r,o,a)}}var ra;aa.instance=new aa,c([ia],aa.prototype,"login",null),c([ia],aa.prototype,"logout",null),c([ia],aa.prototype,"startSession",null),c([ia],aa.prototype,"postImpression",null),c([ia],aa.prototype,"postConversion",null),c([ia],aa.prototype,"purchaseValidation",null),c([na],aa.prototype,"fetchAPI",null),c([na],aa.prototype,"requestBodyAPI",null),function(e){e.DEFAULT="default",e.LABEL="label",e.UNKNOWN="unknown",e.URL="url"}(ra||(ra={}));const oa=()=>Ri(Ie([...Wi.getPaywalls(I)??[],...Wi.getPaywalls(F)??[]]),"id"),sa={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},da={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},la={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},ua={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},ca={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class ha{static getFirstMatch(e,t){const n=t.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,t){const n=t.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,t,n){if(e.test(t))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,n=!1){const i=ha.getVersionPrecision(e),a=ha.getVersionPrecision(t);let r=Math.max(i,a),o=0;const s=ha.map([e,t],(e=>{const t=r-ha.getVersionPrecision(e),n=e+new Array(t+1).join(".0");return ha.map(n.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(n&&(o=r-Math.min(i,a)),r-=1;r>=o;){if(s[0][r]>s[1][r])return 1;if(s[0][r]===s[1][r]){if(r===o)return 0;r-=1}else if(s[0][r]<s[1][r])return-1}}static map(e,t){const n=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)n.push(t(e[i]));return n}static find(e,t){let n,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,i=e.length;n<i;n+=1){const i=e[n];if(t(i,n))return i}}static assign(e,...t){const n=e;let i,a;if(Object.assign)return Object.assign(e,...t);for(i=0,a=t.length;i<a;i+=1){const e=t[i];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{n[t]=e[t]}))}}return e}static getBrowserAlias(e){return sa[e]}static getBrowserTypeByAlias(e){return da[e]||""}}const ma=/version\/(\d+(\.?_?\d+)+)/i,fa=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=ha.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=ha.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=ha.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=ha.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=ha.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=ha.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=ha.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=ha.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=ha.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=ha.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=ha.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=ha.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=ha.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=ha.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=ha.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=ha.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=ha.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=ha.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=ha.getFirstMatch(ma,e)||ha.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=ha.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=ha.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=ha.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=ha.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=ha.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=ha.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=ha.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=ha.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=ha.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=ha.getFirstMatch(ma,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:ha.getFirstMatch(t,e),version:ha.getSecondMatch(t,e)}}}];var ga=[{test:[/Roku\/DVP/],describe(e){const t=ha.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:ua.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=ha.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:ua.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=ha.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=ha.getWindowsVersionName(t);return{name:ua.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:ua.iOS},n=ha.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=ha.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=ha.getMacOSVersionName(t),i={name:ua.MacOS,version:t};return n&&(i.versionName=n),i}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=ha.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:ua.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=ha.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=ha.getAndroidVersionName(t),i={name:ua.Android,version:t};return n&&(i.versionName=n),i}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=ha.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:ua.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=ha.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||ha.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||ha.getFirstMatch(/\bbb(\d+)/i,e);return{name:ua.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=ha.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:ua.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=ha.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:ua.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:ua.Linux})},{test:[/CrOS/],describe:()=>({name:ua.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=ha.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:ua.PlayStation4,version:t}}}],pa=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=ha.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:la.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:la.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:la.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:la.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:la.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:la.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:la.tablet})},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=ha.getFirstMatch(/(ipod|iphone)/i,e);return{type:la.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:la.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:la.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:la.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:la.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:la.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:la.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:la.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:la.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:la.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:la.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:la.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:la.tv})}],va=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:ca.Blink};const t=ha.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:ca.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:ca.Trident},n=ha.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:ca.Presto},n=ha.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:ca.Gecko},n=ha.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:ca.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:ca.WebKit},n=ha.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class ya{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=ha.find(fa,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=ha.find(ga,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=ha.find(pa,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=ha.find(va,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ha.assign({},this.parsedResult)}satisfies(e){const t={};let n=0;const i={};let a=0;if(Object.keys(e).forEach((r=>{const o=e[r];"string"==typeof o?(i[r]=o,a+=1):"object"==typeof o&&(t[r]=o,n+=1)})),n>0){const e=Object.keys(t),n=ha.find(e,(e=>this.isOS(e)));if(n){const e=this.satisfies(t[n]);if(void 0!==e)return e}const i=ha.find(e,(e=>this.isPlatform(e)));if(i){const e=this.satisfies(t[i]);if(void 0!==e)return e}}if(a>0){const e=Object.keys(i),t=ha.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(i[t])}}isBrowser(e,t=!1){const n=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const a=ha.getBrowserTypeByAlias(i);return t&&a&&(i=a.toLowerCase()),i===n}compareVersion(e){let t=[0],n=e,i=!1;const a=this.getBrowserVersion();if("string"==typeof a)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(i=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(i=!0,n=e.substr(1)),t.indexOf(ha.compareVersions(a,n,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}}class ba{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new ya(e,t)}static parse(e){return new ya(e).getResult()}static get BROWSER_MAP(){return da}static get ENGINE_MAP(){return ca}static get OS_MAP(){return ua}static get PLATFORMS_MAP(){return la}}const wa={tablet:"tablet",mobile:"phone",tv:"television",desktop:"desktop"},ka=e=>{if("undefined"==typeof window)return{os_version:"X.X.X",os_name:"Server",browser_name:"Unknown",browser_version:"X.X.X",sdk_client:"web",sdk_version:m,language:"en"};const t=ba.getParser(window.navigator.userAgent),n=t.getPlatform(),i={os_version:t.getOSVersion(),os_name:t.getOSName(),browser_name:t.getBrowserName(),browser_version:t.getBrowserVersion(),sdk_client:"web",sdk_version:m,language:window.navigator.language};if(n.type&&(i.form_factor=wa[n.type]),n.model&&(i.device_model=n.model),e&&e.length>0){const t=(e=>{const t=e.find((e=>e.includes(ie))),n=